@buoy-gg/ask-buoy 7.0.63 → 7.0.65
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/lib/commonjs/blocks/ChromePrototypes.js +1 -1
- package/lib/commonjs/blocks/DataBlocks.js +1 -1
- package/lib/commonjs/blocks/ExtraBlocks.js +1 -1
- package/lib/commonjs/blocks/ReceiptBlocks.js +2 -2
- package/lib/commonjs/blocks/primitives.js +1 -1
- package/lib/commonjs/components/EmptyState.js +1 -1
- package/lib/commonjs/components/Markdown.js +1 -1
- package/lib/module/blocks/ChromePrototypes.js +1 -1
- package/lib/module/blocks/DataBlocks.js +1 -1
- package/lib/module/blocks/ExtraBlocks.js +1 -1
- package/lib/module/blocks/ReceiptBlocks.js +2 -2
- package/lib/module/blocks/primitives.js +1 -1
- package/lib/module/components/EmptyState.js +1 -1
- package/lib/module/components/Markdown.js +1 -1
- package/lib/web/index.mjs +11 -11
- package/package.json +7 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.EditableUserBubble=EditableUserBubble;exports.ElapsedRow=ElapsedRow;exports.MessageActions=MessageActions;exports.QueuedComposer=QueuedComposer;exports.ReasoningStrip=ReasoningStrip;exports.ReloadDivider=ReloadDivider;exports.Timestamp=Timestamp;var _react=require("react");var _reactNative=require("react-native");var _sharedUi=require("@buoy-gg/shared-ui");var _context=require("./context");var _jsxRuntime=require("react/jsx-runtime");function IconButton({label:e,onPress:r,children:o}){return(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:r,accessibilityRole:"button",accessibilityLabel:e,style:({pressed:t})=>[styles.iconBtn,t&&styles.pressed],children:o})}function MessageActions({id:e="chrome-actions"}){const r=(0,_context.useBlockHandlers)();const[o,t]=(0,_react.useState)(null);const i=n=>void r.runAction({label:n,send:`__chrome__:${n}`},e);return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.actions,testID:"chrome-message-actions",children:[(0,_jsxRuntime.jsx)(IconButton,{label:"Copy",onPress:()=>i("copy"),children:(0,_jsxRuntime.jsx)(_sharedUi.Copy,{size:13,color:_sharedUi.night.color.textSecondary})}),(0,_jsxRuntime.jsx)(IconButton,{label:"Retry",onPress:()=>i("retry"),children:(0,_jsxRuntime.jsx)(_sharedUi.RefreshCw,{size:13,color:_sharedUi.night.color.textSecondary})}),(0,_jsxRuntime.jsx)(IconButton,{label:"Good answer",onPress:()=>{t("up");i("thumbs up")},children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.glyph,o==="up"&&styles.glyphOn],children:"\u{1F44D}"})}),(0,_jsxRuntime.jsx)(IconButton,{label:"Bad answer",onPress:()=>{t("down");i("thumbs down")},children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.glyph,o==="down"&&styles.glyphOn],children:"\u{1F44E}"})}),(0,_jsxRuntime.jsx)(IconButton,{label:"Export",onPress:()=>i("export transcript"),children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.textBtn,children:"Export"})})]})}function ReasoningStrip({text:e,live:r}){const[o,t]=(0,_react.useState)(false);return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.reasoning,testID:"chrome-reasoning",children:[(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{onPress:()=>t(i=>!i),style:styles.reasoningHead,accessibilityRole:"button",accessibilityState:{expanded:o},children:[r?(0,_jsxRuntime.jsx)(_reactNative.ActivityIndicator,{size:"small",color:_sharedUi.night.color.textTertiary}):null,(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.reasoningTitle,children:r?"Working it out\u2026":"How I got here"}),o?(0,_jsxRuntime.jsx)(_sharedUi.ChevronDown,{size:12,color:_sharedUi.night.color.textTertiary}):(0,_jsxRuntime.jsx)(_sharedUi.ChevronRight,{size:12,color:_sharedUi.night.color.textTertiary})]}),o?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.reasoningBody,children:e}):null]})}function ElapsedRow({label:e}){const[r,o]=(0,_react.useState)(0);(0,_react.useEffect)(()=>{const t=setInterval(()=>o(i=>i+250),250);return()=>clearInterval(t)},[]);return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.elapsed,testID:"chrome-elapsed",children:[(0,_jsxRuntime.jsx)(_reactNative.ActivityIndicator,{size:"small",color:_sharedUi.night.color.textSecondary}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.elapsedLabel,children:e}),(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.elapsedMs,children:[(r/1e3).toFixed(1),"s"]})]})}function QueuedComposer(){const[e,r]=(0,_react.useState)("");const[o,t]=(0,_react.useState)(null);return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.composerWrap,testID:"chrome-queue",children:[o?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.queuedRow,children:[(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.queuedText,numberOfLines:1,children:['Queued: "',o,'"']}),(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:()=>t(null),children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.queuedCancel,children:"Cancel"})})]}):null,(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.composer,children:[(0,_jsxRuntime.jsx)(_reactNative.TextInput,{style:styles.composerInput,value:e,onChangeText:r,placeholder:"Agent is busy \u2014 type and it sends next",placeholderTextColor:_sharedUi.night.color.placeholder}),(0,_jsxRuntime.jsx)(_reactNative.Pressable,{disabled:!e.trim(),onPress:()=>{t(e.trim());r("")},style:[styles.queueBtn,!e.trim()&&{opacity:.5}],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.queueBtnText,children:"Queue"})})]})]})}function ReloadDivider({at:e}){return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.divider,testID:"chrome-divider",children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.dividerLine}),(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.dividerText,children:["App reloaded \xB7 ",e]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.dividerLine})]})}function Timestamp({at:e}){return(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.timestamp,children:e})}function EditableUserBubble({text:e}){const r=(0,_context.useBlockHandlers)();const[o,t]=(0,_react.useState)(false);const[i,n]=(0,_react.useState)(e);return(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.userWrap,testID:"chrome-edit-bubble",children:o?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.editBox,children:[(0,_jsxRuntime.jsx)(_reactNative.TextInput,{style:styles.editInput,value:i,onChangeText:n,multiline:true}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.editActions,children:[(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:()=>{t(false);void r.runAction({label:"re-run edited",send:`__chrome__:re-run "${i}"`},"chrome-edit")},style:styles.editPrimary,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.editPrimaryText,children:"Re-run from here"})}),(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:()=>{t(false);void r.runAction({label:"branch",send:`__chrome__:branch "${i}"`},"chrome-edit")},style:styles.editPlate,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.editPlateText,children:"Branch"})}),(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:()=>t(false),style:styles.editPlate,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.editPlateText,children:"Cancel"})})]})]}):(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{onLongPress:()=>t(true),onPress:()=>t(true),style:styles.bubble,accessibilityRole:"button",accessibilityLabel:"Edit message",children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.bubbleText,children:i}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.bubbleHint,children:"tap to edit \xB7 2 branches"})]})})}const styles=_reactNative.StyleSheet.create({actions:{flexDirection:"row",alignItems:"center",gap:4,paddingHorizontal:2},iconBtn:{paddingHorizontal:8,paddingVertical:6,borderRadius:_sharedUi.night.radius.badge},pressed:{backgroundColor:_sharedUi.night.color.fill},glyph:{fontSize:13,opacity:.6},glyphOn:{opacity:1},textBtn:{color:_sharedUi.night.color.textSecondary,fontSize:_sharedUi.night.font.micro,fontWeight:"600"},reasoning:{borderRadius:_sharedUi.night.radius.row,backgroundColor:_sharedUi.night.color.fill,overflow:"hidden"},reasoningHead:{flexDirection:"row",alignItems:"center",gap:8,paddingHorizontal:12,paddingVertical:8},reasoningTitle:{flex:1,color:_sharedUi.night.color.textSecondary,fontSize:_sharedUi.night.font.caption,fontStyle:"italic"},reasoningBody:{color:_sharedUi.night.color.textSecondary,fontSize:_sharedUi.night.font.caption,lineHeight:18,paddingHorizontal:12,paddingBottom:10},elapsed:{flexDirection:"row",alignItems:"center",gap:10,paddingHorizontal:12,paddingVertical:10,borderRadius:_sharedUi.night.radius.card,borderWidth:_reactNative.StyleSheet.hairlineWidth,borderColor:_sharedUi.night.color.border,backgroundColor:_sharedUi.night.color.surface},elapsedLabel:{flex:1,color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.body},elapsedMs:{color:_sharedUi.night.color.textTertiary,fontSize:_sharedUi.night.font.caption,fontFamily:"Menlo"},composerWrap:{gap:6},queuedRow:{flexDirection:"row",alignItems:"center",gap:8,paddingHorizontal:12,paddingVertical:6,borderRadius:_sharedUi.night.radius.row,backgroundColor:_sharedUi.night.color.infoSoft},queuedText:{flex:1,color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.caption},queuedCancel:{color:_sharedUi.night.color.info,fontSize:_sharedUi.night.font.caption,fontWeight:"600"},composer:{flexDirection:"row",alignItems:"center",gap:8},composerInput:{flex:1,height:40,paddingHorizontal:16,borderRadius:20,borderWidth:_reactNative.StyleSheet.hairlineWidth,borderColor:_sharedUi.night.color.border,backgroundColor:_sharedUi.night.color.surfaceElevated,color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.body},queueBtn:{paddingHorizontal:14,height:40,borderRadius:20,backgroundColor:_sharedUi.night.color.button,alignItems:"center",justifyContent:"center"},queueBtnText:{color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.caption,fontWeight:"600"},divider:{flexDirection:"row",alignItems:"center",gap:10,paddingVertical:4},dividerLine:{flex:1,height:_reactNative.StyleSheet.hairlineWidth,backgroundColor:_sharedUi.night.color.border},dividerText:{color:_sharedUi.night.color.textTertiary,fontSize:_sharedUi.night.font.micro},timestamp:{alignSelf:"center",color:_sharedUi.night.color.textTertiary,fontSize:_sharedUi.night.font.micro},userWrap:{alignItems:"flex-end"},bubble:{maxWidth:"84%",paddingHorizontal:14,paddingVertical:9,borderRadius:18,borderBottomRightRadius:6,backgroundColor:_sharedUi.night.color.accentFill,borderWidth:_reactNative.StyleSheet.hairlineWidth,borderColor:_sharedUi.night.color.accentBorder,gap:4},bubbleText:{color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.row,lineHeight:21},bubbleHint:{color:_sharedUi.night.color.textTertiary,fontSize:10,textAlign:"right"},editBox:{width:"100%",gap:8},editInput:{minHeight:60,padding:12,borderRadius:_sharedUi.night.radius.row,backgroundColor:_sharedUi.night.color.surfaceElevated,color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.row,borderWidth:_reactNative.StyleSheet.hairlineWidth,borderColor:_sharedUi.night.color.accentBorderStrong},editActions:{flexDirection:"row",gap:8,justifyContent:"flex-end",flexWrap:"wrap"},editPrimary:{paddingHorizontal:12,paddingVertical:8,borderRadius:_sharedUi.night.radius.row,backgroundColor:_sharedUi.night.color.accent},editPrimaryText:{color:_sharedUi.night.color.onAccent,fontSize:_sharedUi.night.font.caption,fontWeight:"600"},editPlate:{paddingHorizontal:12,paddingVertical:8,borderRadius:_sharedUi.night.radius.row,backgroundColor:_sharedUi.night.color.button},editPlateText:{color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.caption,fontWeight:"600"}});
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.EditableUserBubble=EditableUserBubble;exports.ElapsedRow=ElapsedRow;exports.MessageActions=MessageActions;exports.QueuedComposer=QueuedComposer;exports.ReasoningStrip=ReasoningStrip;exports.ReloadDivider=ReloadDivider;exports.Timestamp=Timestamp;var _sharedUi=require("@buoy-gg/shared-ui");var _reactNative=require("react-native");var _react=require("react");var _context=require("./context");var _jsxRuntime=require("react/jsx-runtime");function IconButton({label:e,onPress:r,children:o}){return(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:r,accessibilityRole:"button",accessibilityLabel:e,style:({pressed:t})=>[styles.iconBtn,t&&styles.pressed],children:o})}function MessageActions({id:e="chrome-actions"}){const r=(0,_context.useBlockHandlers)();const[o,t]=(0,_react.useState)(null);const i=n=>void r.runAction({label:n,send:`__chrome__:${n}`},e);return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.actions,testID:"chrome-message-actions",children:[(0,_jsxRuntime.jsx)(IconButton,{label:"Copy",onPress:()=>i("copy"),children:(0,_jsxRuntime.jsx)(_sharedUi.Copy,{size:13,color:_sharedUi.night.color.textSecondary})}),(0,_jsxRuntime.jsx)(IconButton,{label:"Retry",onPress:()=>i("retry"),children:(0,_jsxRuntime.jsx)(_sharedUi.RefreshCw,{size:13,color:_sharedUi.night.color.textSecondary})}),(0,_jsxRuntime.jsx)(IconButton,{label:"Good answer",onPress:()=>{t("up");i("thumbs up")},children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.glyph,o==="up"&&styles.glyphOn],children:"\u{1F44D}"})}),(0,_jsxRuntime.jsx)(IconButton,{label:"Bad answer",onPress:()=>{t("down");i("thumbs down")},children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.glyph,o==="down"&&styles.glyphOn],children:"\u{1F44E}"})}),(0,_jsxRuntime.jsx)(IconButton,{label:"Export",onPress:()=>i("export transcript"),children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.textBtn,children:"Export"})})]})}function ReasoningStrip({text:e,live:r}){const[o,t]=(0,_react.useState)(false);return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.reasoning,testID:"chrome-reasoning",children:[(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{onPress:()=>t(i=>!i),style:styles.reasoningHead,accessibilityRole:"button",accessibilityState:{expanded:o},children:[r?(0,_jsxRuntime.jsx)(_reactNative.ActivityIndicator,{size:"small",color:_sharedUi.night.color.textTertiary}):null,(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.reasoningTitle,children:r?"Working it out\u2026":"How I got here"}),o?(0,_jsxRuntime.jsx)(_sharedUi.ChevronDown,{size:12,color:_sharedUi.night.color.textTertiary}):(0,_jsxRuntime.jsx)(_sharedUi.ChevronRight,{size:12,color:_sharedUi.night.color.textTertiary})]}),o?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.reasoningBody,children:e}):null]})}function ElapsedRow({label:e}){const[r,o]=(0,_react.useState)(0);(0,_react.useEffect)(()=>{const t=setInterval(()=>o(i=>i+250),250);return()=>clearInterval(t)},[]);return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.elapsed,testID:"chrome-elapsed",children:[(0,_jsxRuntime.jsx)(_reactNative.ActivityIndicator,{size:"small",color:_sharedUi.night.color.textSecondary}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.elapsedLabel,children:e}),(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.elapsedMs,children:[(r/1e3).toFixed(1),"s"]})]})}function QueuedComposer(){const[e,r]=(0,_react.useState)("");const[o,t]=(0,_react.useState)(null);return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.composerWrap,testID:"chrome-queue",children:[o?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.queuedRow,children:[(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.queuedText,numberOfLines:1,children:['Queued: "',o,'"']}),(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:()=>t(null),children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.queuedCancel,children:"Cancel"})})]}):null,(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.composer,children:[(0,_jsxRuntime.jsx)(_reactNative.TextInput,{style:styles.composerInput,value:e,onChangeText:r,placeholder:"Agent is busy \u2014 type and it sends next",placeholderTextColor:_sharedUi.night.color.placeholder}),(0,_jsxRuntime.jsx)(_reactNative.Pressable,{disabled:!e.trim(),onPress:()=>{t(e.trim());r("")},style:[styles.queueBtn,!e.trim()&&{opacity:.5}],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.queueBtnText,children:"Queue"})})]})]})}function ReloadDivider({at:e}){return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.divider,testID:"chrome-divider",children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.dividerLine}),(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.dividerText,children:["App reloaded \xB7 ",e]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.dividerLine})]})}function Timestamp({at:e}){return(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.timestamp,children:e})}function EditableUserBubble({text:e}){const r=(0,_context.useBlockHandlers)();const[o,t]=(0,_react.useState)(false);const[i,n]=(0,_react.useState)(e);return(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.userWrap,testID:"chrome-edit-bubble",children:o?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.editBox,children:[(0,_jsxRuntime.jsx)(_reactNative.TextInput,{style:styles.editInput,value:i,onChangeText:n,multiline:true}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.editActions,children:[(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:()=>{t(false);void r.runAction({label:"re-run edited",send:`__chrome__:re-run "${i}"`},"chrome-edit")},style:styles.editPrimary,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.editPrimaryText,children:"Re-run from here"})}),(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:()=>{t(false);void r.runAction({label:"branch",send:`__chrome__:branch "${i}"`},"chrome-edit")},style:styles.editPlate,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.editPlateText,children:"Branch"})}),(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:()=>t(false),style:styles.editPlate,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.editPlateText,children:"Cancel"})})]})]}):(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{onLongPress:()=>t(true),onPress:()=>t(true),style:styles.bubble,accessibilityRole:"button",accessibilityLabel:"Edit message",children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.bubbleText,children:i}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.bubbleHint,children:"tap to edit \xB7 2 branches"})]})})}const styles=_reactNative.StyleSheet.create({actions:{flexDirection:"row",alignItems:"center",gap:4,paddingHorizontal:2},iconBtn:{paddingHorizontal:8,paddingVertical:6,borderRadius:_sharedUi.night.radius.badge},pressed:{backgroundColor:_sharedUi.night.color.fill},glyph:{fontSize:13,opacity:.6},glyphOn:{opacity:1},textBtn:{color:_sharedUi.night.color.textSecondary,fontSize:_sharedUi.night.font.micro,fontWeight:"600"},reasoning:{borderRadius:_sharedUi.night.radius.row,backgroundColor:_sharedUi.night.color.fill,overflow:"hidden"},reasoningHead:{flexDirection:"row",alignItems:"center",gap:8,paddingHorizontal:12,paddingVertical:8},reasoningTitle:{flex:1,color:_sharedUi.night.color.textSecondary,fontSize:_sharedUi.night.font.caption,fontStyle:"italic"},reasoningBody:{color:_sharedUi.night.color.textSecondary,fontSize:_sharedUi.night.font.caption,lineHeight:18,paddingHorizontal:12,paddingBottom:10},elapsed:{flexDirection:"row",alignItems:"center",gap:10,paddingHorizontal:12,paddingVertical:10,borderRadius:_sharedUi.night.radius.card,borderWidth:_reactNative.StyleSheet.hairlineWidth,borderColor:_sharedUi.night.color.border,backgroundColor:_sharedUi.night.color.surface},elapsedLabel:{flex:1,color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.body},elapsedMs:{color:_sharedUi.night.color.textTertiary,fontSize:_sharedUi.night.font.caption,fontFamily:_reactNative.Platform.OS==="web"?_sharedUi.monoFont:"Menlo"},composerWrap:{gap:6},queuedRow:{flexDirection:"row",alignItems:"center",gap:8,paddingHorizontal:12,paddingVertical:6,borderRadius:_sharedUi.night.radius.row,backgroundColor:_sharedUi.night.color.infoSoft},queuedText:{flex:1,color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.caption},queuedCancel:{color:_sharedUi.night.color.info,fontSize:_sharedUi.night.font.caption,fontWeight:"600"},composer:{flexDirection:"row",alignItems:"center",gap:8},composerInput:{flex:1,height:40,paddingHorizontal:16,borderRadius:20,borderWidth:_reactNative.StyleSheet.hairlineWidth,borderColor:_sharedUi.night.color.border,backgroundColor:_sharedUi.night.color.surfaceElevated,color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.body},queueBtn:{paddingHorizontal:14,height:40,borderRadius:20,backgroundColor:_sharedUi.night.color.button,alignItems:"center",justifyContent:"center"},queueBtnText:{color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.caption,fontWeight:"600"},divider:{flexDirection:"row",alignItems:"center",gap:10,paddingVertical:4},dividerLine:{flex:1,height:_reactNative.StyleSheet.hairlineWidth,backgroundColor:_sharedUi.night.color.border},dividerText:{color:_sharedUi.night.color.textTertiary,fontSize:_sharedUi.night.font.micro},timestamp:{alignSelf:"center",color:_sharedUi.night.color.textTertiary,fontSize:_sharedUi.night.font.micro},userWrap:{alignItems:"flex-end"},bubble:{maxWidth:"84%",paddingHorizontal:14,paddingVertical:9,borderRadius:18,borderBottomRightRadius:6,backgroundColor:_sharedUi.night.color.accentFill,borderWidth:_reactNative.StyleSheet.hairlineWidth,borderColor:_sharedUi.night.color.accentBorder,gap:4},bubbleText:{color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.row,lineHeight:21},bubbleHint:{color:_sharedUi.night.color.textTertiary,fontSize:10,textAlign:"right"},editBox:{width:"100%",gap:8},editInput:{minHeight:60,padding:12,borderRadius:_sharedUi.night.radius.row,backgroundColor:_sharedUi.night.color.surfaceElevated,color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.row,borderWidth:_reactNative.StyleSheet.hairlineWidth,borderColor:_sharedUi.night.color.accentBorderStrong},editActions:{flexDirection:"row",gap:8,justifyContent:"flex-end",flexWrap:"wrap"},editPrimary:{paddingHorizontal:12,paddingVertical:8,borderRadius:_sharedUi.night.radius.row,backgroundColor:_sharedUi.night.color.accent},editPrimaryText:{color:_sharedUi.night.color.onAccent,fontSize:_sharedUi.night.font.caption,fontWeight:"600"},editPlate:{paddingHorizontal:12,paddingVertical:8,borderRadius:_sharedUi.night.radius.row,backgroundColor:_sharedUi.night.color.button},editPlateText:{color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.caption,fontWeight:"600"}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.Chart=Chart;exports.Code=Code;exports.Diff=Diff;exports.Finding=Finding;exports.KeyValue=KeyValue;exports.List=List;exports.Notice=Notice;exports.Steps=Steps;exports.Table=Table;exports.listRowBehaviour=listRowBehaviour;var _react=require("react");var _reactNative=require("react-native");var _sharedUi=require("@buoy-gg/shared-ui");var _dataViewer=require("@buoy-gg/shared-ui/dataViewer");var _agentCore=require("@buoy-gg/agent-core");var _primitivesIndex=require("./primitivesIndex");var _Markdown=require("../components/Markdown");var _useCopyAction=require("../components/useCopyAction");var _blockText=require("./blockText");var _icons=require("./icons");var _jsxRuntime=require("react/jsx-runtime");function fmt(e){if(e===void 0)return"\u2014";if(e===null)return"null";if(typeof e==="string")return e;if(typeof e==="number"||typeof e==="boolean")return String(e);try{const t=JSON.stringify(e);return t.length>120?`${t.slice(0,117)}\u2026`:t}catch{return String(e)}}function Table({block:e}){const t=(0,_primitivesIndex.usePaged)(e.rows,_agentCore.CAPS.tableRows);const{visible:n}=t;const o=e.columns.slice(0,4);return(0,_jsxRuntime.jsxs)(_primitivesIndex.Card,{title:e.title,source:e.source,testID:`buoy-block-table-${e.id}`,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.tableHead,children:o.map((l,r)=>(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.th,r===0&&styles.firstCol],numberOfLines:1,children:l},l))}),n.map((l,r)=>(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.tr,r>0&&_primitivesIndex.blockStyles.rowDivider],children:o.map((i,a)=>{const s=l[a];const c=typeof s==="string"?s:s?.text??"";const d=typeof s==="string"?void 0:s?.tone;return(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.td,a===0&&styles.firstCol,a===0&&styles.tdFirst,d&&{color:(0,_primitivesIndex.toneColor)(d)}],numberOfLines:2,children:(0,_Markdown.renderInline)(c,styles.td)},a)})},r)),(0,_jsxRuntime.jsx)(_primitivesIndex.More,{paged:t})]})}function KeyValue({block:e}){const t=(0,_primitivesIndex.usePaged)(e.pairs,_agentCore.CAPS.keyValuePairs);const{visible:n}=t;const[o,l]=(0,_react.useState)(null);return(0,_jsxRuntime.jsxs)(_primitivesIndex.Card,{title:e.title,source:e.source,testID:`buoy-block-keyvalue-${e.id}`,children:[n.map((r,i)=>{const a=typeof r.value==="object"&&r.value!==null;const s=o===r.key;return(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{onPress:a?()=>l(s?null:r.key):void 0,style:[styles.kvRow,i>0&&_primitivesIndex.blockStyles.rowDivider],children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.kvKey,numberOfLines:1,children:r.key}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.kvValue,s&&_primitivesIndex.blockStyles.mono],numberOfLines:s?void 0:2,selectable:true,children:s?JSON.stringify(r.value,null,2):fmt(r.value)})]},r.key)}),(0,_jsxRuntime.jsx)(_primitivesIndex.More,{paged:t})]})}function listRowBehaviour(e){const t=Boolean(e.image);return{canExpand:t,rowRunsAction:Boolean(e.action)&&!t,actionIsOwnControl:Boolean(e.action)&&t}}function List({block:e}){const t=(0,_primitivesIndex.useBlockHandlers)();const n=(0,_primitivesIndex.usePaged)(e.items,_agentCore.CAPS.listItems);const{visible:o}=n;const[l,r]=(0,_react.useState)(null);return(0,_jsxRuntime.jsxs)(_primitivesIndex.Card,{title:e.title,source:e.source,testID:`buoy-block-list-${e.id}`,children:[o.map((i,a)=>{const s=`${i.id??i.title}-${a}`;const c=l===s;const{canExpand:d,rowRunsAction:u,actionIsOwnControl:f}=listRowBehaviour(i);const g=d||u?_reactNative.Pressable:_reactNative.View;const h=d?{onPress:()=>r(c?null:s),accessibilityRole:"button",accessibilityState:{expanded:c},accessibilityLabel:`${i.title}, ${c?"hide":"show"} picture`,testID:`buoy-block-list-row-${s}`}:u?{onPress:()=>void t.runAction(i.action,e.id),accessibilityRole:"button"}:{};return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:a>0?_primitivesIndex.blockStyles.rowDivider:void 0,children:[c&&i.image?(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:()=>r(null),accessibilityRole:"button",accessibilityLabel:`Hide ${i.title}`,testID:`buoy-block-list-hero-${s}`,style:styles.listHero,children:(0,_jsxRuntime.jsx)(_reactNative.Image,{testID:"buoy-internal-chat-image",source:{uri:i.image},style:styles.listHeroImage,resizeMode:"contain",accessibilityLabel:i.title})}):null,(0,_jsxRuntime.jsxs)(g,{...h,style:_primitivesIndex.blockStyles.row,children:[i.image&&!c?(0,_jsxRuntime.jsx)(_reactNative.Image,{testID:"buoy-internal-chat-image",source:{uri:i.image},style:styles.thumb,resizeMode:"contain",accessibilityLabel:i.title}):i.icon?(0,_jsxRuntime.jsx)(_icons.BlockIcon,{name:i.icon}):null,(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.flex,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[_primitivesIndex.blockStyles.rowTitle,i.tone&&{color:(0,_primitivesIndex.toneColor)(i.tone)}],numberOfLines:c?void 0:2,children:(0,_Markdown.renderInline)(i.title,_primitivesIndex.blockStyles.rowTitle)}),i.subtitle?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:_primitivesIndex.blockStyles.rowSub,numberOfLines:c?void 0:2,children:(0,_Markdown.renderInline)(i.subtitle,_primitivesIndex.blockStyles.rowSub)}):null]}),i.trailing?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[_primitivesIndex.blockStyles.rowTrailing,i.tone&&{color:(0,_primitivesIndex.toneColor)(i.tone)}],numberOfLines:1,children:i.trailing}):null,i.action?f?(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:()=>void t.runAction(i.action,e.id),accessibilityRole:"button",accessibilityLabel:i.action.label,hitSlop:8,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.rowAction,children:i.action.label})}):(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.rowAction,children:i.action.label}):null]})]},s)}),(0,_jsxRuntime.jsx)(_primitivesIndex.More,{paged:n})]})}function isStructured(e){return e!==null&&typeof e==="object"}function diffSummary(e){const t=e.map(r=>r.path);const n=t.slice(0,3).join(", ");const o=t.length-3;const l=t.length===1?"1 field":`${t.length} fields`;return`${l} \xB7 ${n}${o>0?`, +${o}`:""}`}function Diff({block:e}){const t=(0,_primitivesIndex.usePaged)(e.changes,_agentCore.CAPS.keyValuePairs);return(0,_jsxRuntime.jsxs)(_primitivesIndex.Card,{title:e.title??"What changed",source:e.source,testID:`buoy-block-diff-${e.id}`,collapsible:true,summary:diffSummary(e.changes),children:[t.visible.map((n,o)=>{const l=n.before===void 0&&n.after!==void 0;const r=n.after===void 0&&n.before!==void 0;return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.diffRow,o>0&&_primitivesIndex.blockStyles.rowDivider],children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.diffPath,numberOfLines:1,children:n.path}),isStructured(n.before)||isStructured(n.after)?(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.diffTree,children:(0,_jsxRuntime.jsx)(_dataViewer.TreeDiffViewer,{oldValue:n.before,newValue:n.after,showUnchanged:false,scrollEnabled:false})}):(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[!l?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.diffLine,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.diffMark,{color:_sharedUi.night.color.danger}],children:"\u2212"}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.diffValue,{color:_sharedUi.night.color.danger}],numberOfLines:3,selectable:true,children:fmt(n.before)})]}):null,!r?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.diffLine,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.diffMark,{color:_sharedUi.night.color.accent}],children:"+"}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.diffValue,{color:_sharedUi.night.color.accent}],numberOfLines:3,selectable:true,children:fmt(n.after)})]}):null]})]},`${n.path}-${o}`)}),(0,_jsxRuntime.jsx)(_primitivesIndex.More,{paged:t})]})}function Chart({block:e}){const t=e.bars.slice(0,_agentCore.CAPS.chartBars);const n=e.max??Math.max(1,...t.map(o=>o.value));return(0,_jsxRuntime.jsx)(_primitivesIndex.Card,{title:e.title,source:e.source,testID:`buoy-block-chart-${e.id}`,children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.chart,children:t.map((o,l)=>(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.barRow,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.barLabel,numberOfLines:1,children:o.label}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.barTrack,children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.bar,{width:`${Math.max(2,Math.round(o.value/n*100))}%`,backgroundColor:(0,_primitivesIndex.toneColor)(o.tone??"accent")}]})}),(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.barValue,numberOfLines:1,children:[o.value,o.unit?` ${o.unit}`:""]})]},`${o.label}-${l}`))})})}function Steps({block:e}){return(0,_jsxRuntime.jsx)(_primitivesIndex.Card,{title:e.title,testID:`buoy-block-steps-${e.id}`,children:e.steps.map((t,n)=>(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.step,n>0&&_primitivesIndex.blockStyles.rowDivider],children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.stepMark,t.state==="done"&&styles.stepDone,t.state==="failed"&&styles.stepFailed],children:t.state==="done"?(0,_jsxRuntime.jsx)(_sharedUi.Check,{size:10,color:_sharedUi.night.color.onAccent}):t.state==="failed"?(0,_jsxRuntime.jsx)(_sharedUi.X,{size:10,color:_sharedUi.night.color.text}):(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.stepNum,children:n+1})}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[_primitivesIndex.blockStyles.rowTitle,t.state==="done"&&styles.stepTextDone],children:t.text})]},n))})}function parseJson(e){try{const t=JSON.parse(e);return t!==null&&typeof t==="object"?t:void 0}catch{return void 0}}function JsonCode({block:e,value:t}){return(0,_jsxRuntime.jsx)(_primitivesIndex.Card,{title:e.title,testID:`buoy-block-code-${e.id}`,children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.viewer,children:(0,_jsxRuntime.jsx)(_dataViewer.DataViewer,{title:e.title??"Payload",data:t,initialExpanded:true,showTypeFilter:false,testIDPrefix:`buoy-block-code-${e.id}`})})})}function TextCode({block:e}){return(0,_jsxRuntime.jsx)(_primitivesIndex.Card,{title:e.title,testID:`buoy-block-code-${e.id}`,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[_primitivesIndex.blockStyles.mono,styles.code],selectable:true,children:e.text})})}function Code({block:e}){const t=parseJson(e.text);if(t===void 0)return(0,_jsxRuntime.jsx)(TextCode,{block:e});return(0,_jsxRuntime.jsx)(JsonCode,{block:e,value:t})}function Notice({block:e}){const t=e.tone==="danger"?_sharedUi.night.color.danger:e.tone==="warning"?_sharedUi.night.color.warning:_sharedUi.night.color.info;const n=e.tone==="info"?_sharedUi.Info:_sharedUi.AlertTriangle;return(0,_jsxRuntime.jsxs)(_primitivesIndex.Card,{tone:e.tone,testID:`buoy-block-notice-${e.id}`,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.noticeRow,children:[(0,_jsxRuntime.jsx)(n,{size:14,color:t}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.noticeText,children:e.text})]}),(0,_jsxRuntime.jsx)(_primitivesIndex.ActionRow,{actions:e.actions,blockId:e.id})]})}function Finding({block:e}){const{copied:t,copy:n}=(0,_useCopyAction.useCopyAction)(()=>(0,_blockText.blockToText)(e)??e.title);return(0,_jsxRuntime.jsxs)(_primitivesIndex.Card,{title:e.title,source:e.source,testID:`buoy-block-finding-${e.id}`,tone:"warning",children:[e.evidence.map((o,l)=>(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.kvRow,l>0&&_primitivesIndex.blockStyles.rowDivider],children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.kvKey,numberOfLines:1,children:o.label}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.kvValue,o.tone&&{color:(0,_primitivesIndex.toneColor)(o.tone)}],selectable:true,children:o.value})]},`${o.label}-${l}`)),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.findingFoot,children:(0,_jsxRuntime.jsx)(_reactNative.Pressable,{testID:`buoy-block-finding-copy-${e.id}`,accessibilityRole:"button",accessibilityLabel:t?"Copied":"Copy this finding",onPress:n,style:({pressed:o})=>[styles.findingCopy,o&&{opacity:.7}],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.findingCopyText,t&&{color:_sharedUi.night.color.accent}],children:t?"Copied":"Copy finding"})})}),(0,_jsxRuntime.jsx)(_primitivesIndex.ActionRow,{actions:e.actions,blockId:e.id})]})}const styles=_reactNative.StyleSheet.create({flex:{flex:1},tableHead:{flexDirection:"row",paddingHorizontal:12,paddingVertical:6,gap:8,backgroundColor:_sharedUi.night.color.fill},th:{flex:1,color:_sharedUi.night.color.textTertiary,fontSize:_sharedUi.night.font.micro,fontWeight:"700",letterSpacing:.6,textTransform:"uppercase"},tr:{flexDirection:"row",paddingHorizontal:12,paddingVertical:8,gap:8,alignItems:"center"},td:{flex:1,color:_sharedUi.night.color.textSecondary,fontSize:_sharedUi.night.font.caption,lineHeight:17},tdFirst:{color:_sharedUi.night.color.text,fontWeight:"500"},firstCol:{flex:1.4},kvRow:{flexDirection:"row",gap:12,paddingHorizontal:12,paddingVertical:8,alignItems:"flex-start"},kvKey:{width:110,color:_sharedUi.night.color.textSecondary,fontSize:_sharedUi.night.font.caption,paddingTop:1},kvValue:{flex:1,color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.caption,lineHeight:17},findingFoot:{flexDirection:"row",paddingHorizontal:12,paddingVertical:8,borderTopWidth:_reactNative.StyleSheet.hairlineWidth,borderTopColor:_sharedUi.night.color.separator},findingCopy:{paddingHorizontal:10,paddingVertical:5,borderRadius:_sharedUi.night.radius.badge,backgroundColor:_sharedUi.night.color.fill},findingCopyText:{color:_sharedUi.night.color.textSecondary,fontSize:_sharedUi.night.font.micro,fontWeight:"600"},thumb:{width:40,height:40,borderRadius:8,backgroundColor:_sharedUi.night.color.fill},listHero:{paddingHorizontal:12,paddingTop:12},listHeroImage:{width:"100%",height:240,borderRadius:_sharedUi.night.radius.row,backgroundColor:_sharedUi.night.color.fill},rowAction:{color:_sharedUi.night.color.accent,fontSize:_sharedUi.night.font.caption,fontWeight:"600"},diffRow:{paddingHorizontal:12,paddingVertical:8,gap:3},diffPath:{color:_sharedUi.night.color.textSecondary,fontSize:_sharedUi.night.font.micro,fontWeight:"600",letterSpacing:.3},diffLine:{flexDirection:"row",gap:8,alignItems:"flex-start"},diffMark:{fontFamily:"Menlo",fontSize:12,width:10},diffValue:{flex:1,fontFamily:"Menlo",fontSize:12,lineHeight:16},diffTree:{borderRadius:_sharedUi.night.radius.row,overflow:"hidden"},chart:{paddingHorizontal:12,paddingVertical:10,gap:8},barRow:{flexDirection:"row",alignItems:"center",gap:8},barLabel:{width:96,color:_sharedUi.night.color.textSecondary,fontSize:_sharedUi.night.font.caption},barTrack:{flex:1,height:10,borderRadius:5,backgroundColor:_sharedUi.night.color.fill,overflow:"hidden"},bar:{height:10,borderRadius:5},barValue:{width:72,textAlign:"right",color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.caption,fontWeight:"600"},step:{flexDirection:"row",alignItems:"center",gap:10,paddingHorizontal:12,paddingVertical:9},stepMark:{width:20,height:20,borderRadius:10,backgroundColor:_sharedUi.night.color.fillTertiary,alignItems:"center",justifyContent:"center"},stepDone:{backgroundColor:_sharedUi.night.color.accent},stepFailed:{backgroundColor:_sharedUi.night.color.danger},stepNum:{color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.micro,fontWeight:"700"},stepTextDone:{color:_sharedUi.night.color.textSecondary},viewer:{paddingHorizontal:4,paddingBottom:8},code:{paddingHorizontal:12,paddingVertical:10,lineHeight:17},noticeRow:{flexDirection:"row",alignItems:"flex-start",gap:8,paddingHorizontal:12,paddingTop:10,paddingBottom:4},noticeText:{flex:1,color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.caption,lineHeight:18}});
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.Chart=Chart;exports.Code=Code;exports.Diff=Diff;exports.Finding=Finding;exports.KeyValue=KeyValue;exports.List=List;exports.Notice=Notice;exports.Steps=Steps;exports.Table=Table;exports.listRowBehaviour=listRowBehaviour;var _sharedUi=require("@buoy-gg/shared-ui");var _reactNative=require("react-native");var _react=require("react");var _dataViewer=require("@buoy-gg/shared-ui/dataViewer");var _agentCore=require("@buoy-gg/agent-core");var _primitivesIndex=require("./primitivesIndex");var _Markdown=require("../components/Markdown");var _useCopyAction=require("../components/useCopyAction");var _blockText=require("./blockText");var _icons=require("./icons");var _jsxRuntime=require("react/jsx-runtime");function fmt(e){if(e===void 0)return"\u2014";if(e===null)return"null";if(typeof e==="string")return e;if(typeof e==="number"||typeof e==="boolean")return String(e);try{const t=JSON.stringify(e);return t.length>120?`${t.slice(0,117)}\u2026`:t}catch{return String(e)}}function Table({block:e}){const t=(0,_primitivesIndex.usePaged)(e.rows,_agentCore.CAPS.tableRows);const{visible:n}=t;const i=e.columns.slice(0,4);return(0,_jsxRuntime.jsxs)(_primitivesIndex.Card,{title:e.title,source:e.source,testID:`buoy-block-table-${e.id}`,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.tableHead,children:i.map((l,r)=>(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.th,r===0&&styles.firstCol],numberOfLines:1,children:l},l))}),n.map((l,r)=>(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.tr,r>0&&_primitivesIndex.blockStyles.rowDivider],children:i.map((o,a)=>{const s=l[a];const c=typeof s==="string"?s:s?.text??"";const d=typeof s==="string"?void 0:s?.tone;return(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.td,a===0&&styles.firstCol,a===0&&styles.tdFirst,d&&{color:(0,_primitivesIndex.toneColor)(d)}],numberOfLines:2,children:(0,_Markdown.renderInline)(c,styles.td)},a)})},r)),(0,_jsxRuntime.jsx)(_primitivesIndex.More,{paged:t})]})}function KeyValue({block:e}){const t=(0,_primitivesIndex.usePaged)(e.pairs,_agentCore.CAPS.keyValuePairs);const{visible:n}=t;const[i,l]=(0,_react.useState)(null);return(0,_jsxRuntime.jsxs)(_primitivesIndex.Card,{title:e.title,source:e.source,testID:`buoy-block-keyvalue-${e.id}`,children:[n.map((r,o)=>{const a=typeof r.value==="object"&&r.value!==null;const s=i===r.key;return(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{onPress:a?()=>l(s?null:r.key):void 0,style:[styles.kvRow,o>0&&_primitivesIndex.blockStyles.rowDivider],children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.kvKey,numberOfLines:1,children:r.key}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.kvValue,s&&_primitivesIndex.blockStyles.mono],numberOfLines:s?void 0:2,selectable:true,children:s?JSON.stringify(r.value,null,2):fmt(r.value)})]},r.key)}),(0,_jsxRuntime.jsx)(_primitivesIndex.More,{paged:t})]})}function listRowBehaviour(e){const t=Boolean(e.image);return{canExpand:t,rowRunsAction:Boolean(e.action)&&!t,actionIsOwnControl:Boolean(e.action)&&t}}function List({block:e}){const t=(0,_primitivesIndex.useBlockHandlers)();const n=(0,_primitivesIndex.usePaged)(e.items,_agentCore.CAPS.listItems);const{visible:i}=n;const[l,r]=(0,_react.useState)(null);return(0,_jsxRuntime.jsxs)(_primitivesIndex.Card,{title:e.title,source:e.source,testID:`buoy-block-list-${e.id}`,children:[i.map((o,a)=>{const s=`${o.id??o.title}-${a}`;const c=l===s;const{canExpand:d,rowRunsAction:u,actionIsOwnControl:f}=listRowBehaviour(o);const g=d||u?_reactNative.Pressable:_reactNative.View;const h=d?{onPress:()=>r(c?null:s),accessibilityRole:"button",accessibilityState:{expanded:c},accessibilityLabel:`${o.title}, ${c?"hide":"show"} picture`,testID:`buoy-block-list-row-${s}`}:u?{onPress:()=>void t.runAction(o.action,e.id),accessibilityRole:"button"}:{};return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:a>0?_primitivesIndex.blockStyles.rowDivider:void 0,children:[c&&o.image?(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:()=>r(null),accessibilityRole:"button",accessibilityLabel:`Hide ${o.title}`,testID:`buoy-block-list-hero-${s}`,style:styles.listHero,children:(0,_jsxRuntime.jsx)(_reactNative.Image,{testID:"buoy-internal-chat-image",source:{uri:o.image},style:styles.listHeroImage,resizeMode:"contain",accessibilityLabel:o.title})}):null,(0,_jsxRuntime.jsxs)(g,{...h,style:_primitivesIndex.blockStyles.row,children:[o.image&&!c?(0,_jsxRuntime.jsx)(_reactNative.Image,{testID:"buoy-internal-chat-image",source:{uri:o.image},style:styles.thumb,resizeMode:"contain",accessibilityLabel:o.title}):o.icon?(0,_jsxRuntime.jsx)(_icons.BlockIcon,{name:o.icon}):null,(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.flex,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[_primitivesIndex.blockStyles.rowTitle,o.tone&&{color:(0,_primitivesIndex.toneColor)(o.tone)}],numberOfLines:c?void 0:2,children:(0,_Markdown.renderInline)(o.title,_primitivesIndex.blockStyles.rowTitle)}),o.subtitle?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:_primitivesIndex.blockStyles.rowSub,numberOfLines:c?void 0:2,children:(0,_Markdown.renderInline)(o.subtitle,_primitivesIndex.blockStyles.rowSub)}):null]}),o.trailing?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[_primitivesIndex.blockStyles.rowTrailing,o.tone&&{color:(0,_primitivesIndex.toneColor)(o.tone)}],numberOfLines:1,children:o.trailing}):null,o.action?f?(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:()=>void t.runAction(o.action,e.id),accessibilityRole:"button",accessibilityLabel:o.action.label,hitSlop:8,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.rowAction,children:o.action.label})}):(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.rowAction,children:o.action.label}):null]})]},s)}),(0,_jsxRuntime.jsx)(_primitivesIndex.More,{paged:n})]})}function isStructured(e){return e!==null&&typeof e==="object"}function diffSummary(e){const t=e.map(r=>r.path);const n=t.slice(0,3).join(", ");const i=t.length-3;const l=t.length===1?"1 field":`${t.length} fields`;return`${l} \xB7 ${n}${i>0?`, +${i}`:""}`}function Diff({block:e}){const t=(0,_primitivesIndex.usePaged)(e.changes,_agentCore.CAPS.keyValuePairs);return(0,_jsxRuntime.jsxs)(_primitivesIndex.Card,{title:e.title??"What changed",source:e.source,testID:`buoy-block-diff-${e.id}`,collapsible:true,summary:diffSummary(e.changes),children:[t.visible.map((n,i)=>{const l=n.before===void 0&&n.after!==void 0;const r=n.after===void 0&&n.before!==void 0;return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.diffRow,i>0&&_primitivesIndex.blockStyles.rowDivider],children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.diffPath,numberOfLines:1,children:n.path}),isStructured(n.before)||isStructured(n.after)?(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.diffTree,children:(0,_jsxRuntime.jsx)(_dataViewer.TreeDiffViewer,{oldValue:n.before,newValue:n.after,showUnchanged:false,scrollEnabled:false})}):(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[!l?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.diffLine,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.diffMark,{color:_sharedUi.night.color.danger}],children:"\u2212"}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.diffValue,{color:_sharedUi.night.color.danger}],numberOfLines:3,selectable:true,children:fmt(n.before)})]}):null,!r?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.diffLine,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.diffMark,{color:_sharedUi.night.color.accent}],children:"+"}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.diffValue,{color:_sharedUi.night.color.accent}],numberOfLines:3,selectable:true,children:fmt(n.after)})]}):null]})]},`${n.path}-${i}`)}),(0,_jsxRuntime.jsx)(_primitivesIndex.More,{paged:t})]})}function Chart({block:e}){const t=e.bars.slice(0,_agentCore.CAPS.chartBars);const n=e.max??Math.max(1,...t.map(i=>i.value));return(0,_jsxRuntime.jsx)(_primitivesIndex.Card,{title:e.title,source:e.source,testID:`buoy-block-chart-${e.id}`,children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.chart,children:t.map((i,l)=>(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.barRow,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.barLabel,numberOfLines:1,children:i.label}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.barTrack,children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.bar,{width:`${Math.max(2,Math.round(i.value/n*100))}%`,backgroundColor:(0,_primitivesIndex.toneColor)(i.tone??"accent")}]})}),(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.barValue,numberOfLines:1,children:[i.value,i.unit?` ${i.unit}`:""]})]},`${i.label}-${l}`))})})}function Steps({block:e}){return(0,_jsxRuntime.jsx)(_primitivesIndex.Card,{title:e.title,testID:`buoy-block-steps-${e.id}`,children:e.steps.map((t,n)=>(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.step,n>0&&_primitivesIndex.blockStyles.rowDivider],children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.stepMark,t.state==="done"&&styles.stepDone,t.state==="failed"&&styles.stepFailed],children:t.state==="done"?(0,_jsxRuntime.jsx)(_sharedUi.Check,{size:10,color:_sharedUi.night.color.onAccent}):t.state==="failed"?(0,_jsxRuntime.jsx)(_sharedUi.X,{size:10,color:_sharedUi.night.color.text}):(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.stepNum,children:n+1})}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[_primitivesIndex.blockStyles.rowTitle,t.state==="done"&&styles.stepTextDone],children:t.text})]},n))})}function parseJson(e){try{const t=JSON.parse(e);return t!==null&&typeof t==="object"?t:void 0}catch{return void 0}}function JsonCode({block:e,value:t}){return(0,_jsxRuntime.jsx)(_primitivesIndex.Card,{title:e.title,testID:`buoy-block-code-${e.id}`,children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.viewer,children:(0,_jsxRuntime.jsx)(_dataViewer.DataViewer,{title:e.title??"Payload",data:t,initialExpanded:true,showTypeFilter:false,testIDPrefix:`buoy-block-code-${e.id}`})})})}function TextCode({block:e}){return(0,_jsxRuntime.jsx)(_primitivesIndex.Card,{title:e.title,testID:`buoy-block-code-${e.id}`,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[_primitivesIndex.blockStyles.mono,styles.code],selectable:true,children:e.text})})}function Code({block:e}){const t=parseJson(e.text);if(t===void 0)return(0,_jsxRuntime.jsx)(TextCode,{block:e});return(0,_jsxRuntime.jsx)(JsonCode,{block:e,value:t})}function Notice({block:e}){const t=e.tone==="danger"?_sharedUi.night.color.danger:e.tone==="warning"?_sharedUi.night.color.warning:_sharedUi.night.color.info;const n=e.tone==="info"?_sharedUi.Info:_sharedUi.AlertTriangle;return(0,_jsxRuntime.jsxs)(_primitivesIndex.Card,{tone:e.tone,testID:`buoy-block-notice-${e.id}`,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.noticeRow,children:[(0,_jsxRuntime.jsx)(n,{size:14,color:t}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.noticeText,children:e.text})]}),(0,_jsxRuntime.jsx)(_primitivesIndex.ActionRow,{actions:e.actions,blockId:e.id})]})}function Finding({block:e}){const{copied:t,copy:n}=(0,_useCopyAction.useCopyAction)(()=>(0,_blockText.blockToText)(e)??e.title);return(0,_jsxRuntime.jsxs)(_primitivesIndex.Card,{title:e.title,source:e.source,testID:`buoy-block-finding-${e.id}`,tone:"warning",children:[e.evidence.map((i,l)=>(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.kvRow,l>0&&_primitivesIndex.blockStyles.rowDivider],children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.kvKey,numberOfLines:1,children:i.label}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.kvValue,i.tone&&{color:(0,_primitivesIndex.toneColor)(i.tone)}],selectable:true,children:i.value})]},`${i.label}-${l}`)),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.findingFoot,children:(0,_jsxRuntime.jsx)(_reactNative.Pressable,{testID:`buoy-block-finding-copy-${e.id}`,accessibilityRole:"button",accessibilityLabel:t?"Copied":"Copy this finding",onPress:n,style:({pressed:i})=>[styles.findingCopy,i&&{opacity:.7}],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.findingCopyText,t&&{color:_sharedUi.night.color.accent}],children:t?"Copied":"Copy finding"})})}),(0,_jsxRuntime.jsx)(_primitivesIndex.ActionRow,{actions:e.actions,blockId:e.id})]})}const styles=_reactNative.StyleSheet.create({flex:{flex:1},tableHead:{flexDirection:"row",paddingHorizontal:12,paddingVertical:6,gap:8,backgroundColor:_sharedUi.night.color.fill},th:{flex:1,color:_sharedUi.night.color.textTertiary,fontSize:_sharedUi.night.font.micro,fontWeight:"700",letterSpacing:.6,textTransform:"uppercase"},tr:{flexDirection:"row",paddingHorizontal:12,paddingVertical:8,gap:8,alignItems:"center"},td:{flex:1,color:_sharedUi.night.color.textSecondary,fontSize:_sharedUi.night.font.caption,lineHeight:17},tdFirst:{color:_sharedUi.night.color.text,fontWeight:"500"},firstCol:{flex:1.4},kvRow:{flexDirection:"row",gap:12,paddingHorizontal:12,paddingVertical:8,alignItems:"flex-start"},kvKey:{width:110,color:_sharedUi.night.color.textSecondary,fontSize:_sharedUi.night.font.caption,paddingTop:1},kvValue:{flex:1,color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.caption,lineHeight:17},findingFoot:{flexDirection:"row",paddingHorizontal:12,paddingVertical:8,borderTopWidth:_reactNative.StyleSheet.hairlineWidth,borderTopColor:_sharedUi.night.color.separator},findingCopy:{paddingHorizontal:10,paddingVertical:5,borderRadius:_sharedUi.night.radius.badge,backgroundColor:_sharedUi.night.color.fill},findingCopyText:{color:_sharedUi.night.color.textSecondary,fontSize:_sharedUi.night.font.micro,fontWeight:"600"},thumb:{width:40,height:40,borderRadius:8,backgroundColor:_sharedUi.night.color.fill},listHero:{paddingHorizontal:12,paddingTop:12},listHeroImage:{width:"100%",height:240,borderRadius:_sharedUi.night.radius.row,backgroundColor:_sharedUi.night.color.fill},rowAction:{color:_sharedUi.night.color.accent,fontSize:_sharedUi.night.font.caption,fontWeight:"600"},diffRow:{paddingHorizontal:12,paddingVertical:8,gap:3},diffPath:{color:_sharedUi.night.color.textSecondary,fontSize:_sharedUi.night.font.micro,fontWeight:"600",letterSpacing:.3},diffLine:{flexDirection:"row",gap:8,alignItems:"flex-start"},diffMark:{fontFamily:_reactNative.Platform.OS==="web"?_sharedUi.monoFont:"Menlo",fontSize:12,width:10},diffValue:{flex:1,fontFamily:_reactNative.Platform.OS==="web"?_sharedUi.monoFont:"Menlo",fontSize:12,lineHeight:16},diffTree:{borderRadius:_sharedUi.night.radius.row,overflow:"hidden"},chart:{paddingHorizontal:12,paddingVertical:10,gap:8},barRow:{flexDirection:"row",alignItems:"center",gap:8},barLabel:{width:96,color:_sharedUi.night.color.textSecondary,fontSize:_sharedUi.night.font.caption},barTrack:{flex:1,height:10,borderRadius:5,backgroundColor:_sharedUi.night.color.fill,overflow:"hidden"},bar:{height:10,borderRadius:5},barValue:{width:72,textAlign:"right",color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.caption,fontWeight:"600"},step:{flexDirection:"row",alignItems:"center",gap:10,paddingHorizontal:12,paddingVertical:9},stepMark:{width:20,height:20,borderRadius:10,backgroundColor:_sharedUi.night.color.fillTertiary,alignItems:"center",justifyContent:"center"},stepDone:{backgroundColor:_sharedUi.night.color.accent},stepFailed:{backgroundColor:_sharedUi.night.color.danger},stepNum:{color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.micro,fontWeight:"700"},stepTextDone:{color:_sharedUi.night.color.textSecondary},viewer:{paddingHorizontal:4,paddingBottom:8},code:{paddingHorizontal:12,paddingVertical:10,lineHeight:17},noticeRow:{flexDirection:"row",alignItems:"flex-start",gap:8,paddingHorizontal:12,paddingTop:10,paddingBottom:4},noticeText:{flex:1,color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.caption,lineHeight:18}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.Banner=Banner;exports.CardCarousel=CardCarousel;exports.CardView=CardView;exports.Checkpoint=Checkpoint;exports.Claim=Claim;exports.Compare=Compare;exports.DateTime=DateTime;exports.Details=Details;exports.File=File;exports.Form=Form;exports.LivePill=LivePill;exports.MultiSelect=MultiSelect;exports.Plan=Plan;exports.Proposal=Proposal;exports.Screenshot=Screenshot;exports.Select=Select;exports.Slider=Slider;exports.Sparkline=Sparkline;exports.Suggestions=Suggestions;exports.Tabs=Tabs;exports.Task=Task;exports.Timeline=Timeline;exports.Upload=Upload;var _react=require("react");var _reactNative=require("react-native");var _sharedUi=require("@buoy-gg/shared-ui");var _context=require("./context");var _primitives=require("./primitives");var _jsxRuntime=require("react/jsx-runtime");const fmt=e=>typeof e==="string"?e:e===void 0?"\u2014":JSON.stringify(e);function Suggestions({block:e}){const i=(0,_context.useBlockHandlers)();return(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.chips,testID:`buoy-block-suggestions-${e.id}`,children:e.chips.slice(0,4).map(t=>(0,_jsxRuntime.jsx)(_reactNative.Pressable,{disabled:!!i.busy,onPress:()=>void i.runAction({label:t.label,send:t.send??t.label},e.id),style:({pressed:n})=>[styles.chip,n&&styles.pressed],accessibilityRole:"button",children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.chipText,children:t.label})},t.label))})}function MultiSelect({block:e}){const i=(0,_context.useBlockHandlers)();const t=i.answered[e.id];const n=!!t;const[o,l]=(0,_react.useState)([]);const r=t?.kind==="multi"?t.optionIds:o;const d=a=>l(s=>s.includes(a)?s.filter(c=>c!==a):[...s,a]);const h=o.length>=(e.min??1)&&(!e.max||o.length<=e.max);return(0,_jsxRuntime.jsxs)(_primitives.Card,{testID:`buoy-block-multi-${e.id}`,tone:n?void 0:"info",children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.question,children:e.question}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.optionsBox,children:e.options.map((a,s)=>{const c=r.includes(a.id);return(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{disabled:n,onPress:()=>d(a.id),style:[styles.option,s>0&&_primitives.blockStyles.rowDivider,n&&!c&&styles.dim],accessibilityRole:"checkbox",accessibilityState:{checked:c},children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.checkbox,c&&styles.checkboxOn],children:c?(0,_jsxRuntime.jsx)(_sharedUi.Check,{size:11,color:_sharedUi.night.color.onAccent}):null}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.flex,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.optionLabel,children:a.label}),a.detail?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.optionDetail,children:a.detail}):null]})]},a.id)})}),n?null:(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.rowEnd,children:(0,_jsxRuntime.jsx)(_reactNative.Pressable,{testID:"buoy-block-multi-submit",disabled:!h,onPress:()=>i.answer({blockId:e.id,kind:"multi",optionIds:o,labels:e.options.filter(a=>o.includes(a.id)).map(a=>a.label)}),style:[styles.button,styles.buttonPrimary,!h&&styles.disabled],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.buttonTextPrimary,children:e.submitLabel??`Use ${o.length||""}`.trim()})})})]})}const SEARCH_FROM=8;function Select({block:e}){const i=(0,_context.useBlockHandlers)();const t=i.answered[e.id];const[n,o]=(0,_react.useState)("");const[l,r]=(0,_react.useState)(false);const d=t?.kind==="select"?t.label:null;const h=e.options.filter(s=>!n||s.label.toLowerCase().includes(n.toLowerCase())).slice(0,8);const a=e.searchable!==false&&e.options.length>=SEARCH_FROM;return(0,_jsxRuntime.jsxs)(_primitives.Card,{testID:`buoy-block-select-${e.id}`,tone:t?void 0:"info",children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.question,children:e.label}),d?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.decided,children:d}):(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.selectBox,children:[(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{onPress:()=>r(s=>!s),style:styles.selectField,accessibilityRole:"button",children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.selectPlaceholder,children:l?"Choose\u2026":`${e.options.length} options`}),(0,_jsxRuntime.jsx)(_sharedUi.ChevronDown,{size:14,color:_sharedUi.night.color.textSecondary})]}),l&&(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[a&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.search,children:[(0,_jsxRuntime.jsx)(_sharedUi.Search,{size:12,color:_sharedUi.night.color.textSecondary}),(0,_jsxRuntime.jsx)(_reactNative.TextInput,{style:styles.searchInput,value:n,onChangeText:o,placeholder:"Search",placeholderTextColor:_sharedUi.night.color.placeholder,autoCapitalize:"none",autoCorrect:false})]}),h.map((s,c)=>(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{onPress:()=>i.answer({blockId:e.id,kind:"select",optionId:s.id,label:s.label}),style:[styles.option,c>0&&_primitives.blockStyles.rowDivider],accessibilityRole:"button",children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.flex,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.optionLabel,children:s.label}),s.detail?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.optionDetail,children:s.detail}):null]}),(0,_jsxRuntime.jsx)(_sharedUi.ChevronRight,{size:12,color:_sharedUi.night.color.textTertiary})]},s.id)),e.options.length>h.length?(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.hint,children:[e.options.length-h.length," more \u2014 keep typing"]}):null]})]})]})}function SliderControl({min:e,max:i,step:t=1,value:n,unit:o,onChange:l,disabled:r}){const d=(0,_react.useRef)(0);const h=i>e?(n-e)/(i-e)*100:0;const a=g=>Math.min(i,Math.max(e,+(Math.round((g-e)/t)*t+e).toFixed(6)));const s=g=>!r&&l(a(n+g*t));const c=g=>{if(r||d.current<=0)return;const x=Math.min(1,Math.max(0,g.nativeEvent.locationX/d.current));l(a(e+x*(i-e)))};const u=g=>{d.current=g.nativeEvent.layout.width};return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.sliderRow,children:[(0,_jsxRuntime.jsx)(_reactNative.Pressable,{disabled:r,onPress:()=>s(-1),style:styles.stepBtn,accessibilityRole:"button",accessibilityLabel:"Decrease",children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.stepText,children:"\u2212"})}),(0,_jsxRuntime.jsx)(_reactNative.Pressable,{style:styles.trackHit,onLayout:u,onPress:c,disabled:r,accessibilityRole:"adjustable",accessibilityValue:{min:e,max:i,now:n},accessibilityActions:[{name:"increment"},{name:"decrement"}],onAccessibilityAction:g=>s(g.nativeEvent.actionName==="increment"?1:-1),children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.track,pointerEvents:"none",children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.fill,{width:`${h}%`}]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.thumb,{left:`${h}%`}]})]})}),(0,_jsxRuntime.jsx)(_reactNative.Pressable,{disabled:r,onPress:()=>s(1),style:styles.stepBtn,accessibilityRole:"button",accessibilityLabel:"Increase",children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.stepText,children:"+"})}),(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.sliderValue,children:[n,o?` ${o}`:""]})]})}function Slider({block:e}){const i=(0,_context.useBlockHandlers)();const t=i.answered[e.id];const[n,o]=(0,_react.useState)(e.value??e.min);return(0,_jsxRuntime.jsxs)(_primitives.Card,{testID:`buoy-block-slider-${e.id}`,tone:t?void 0:"info",children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.question,children:e.label}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.pad,children:(0,_jsxRuntime.jsx)(SliderControl,{min:e.min,max:e.max,step:e.step,value:t?.kind==="slider"?t.value:n,unit:e.unit,onChange:o,disabled:!!t})}),t?null:(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.rowEnd,children:(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:()=>i.answer({blockId:e.id,kind:"slider",value:n,unit:e.unit}),style:[styles.button,styles.buttonPrimary],children:(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.buttonTextPrimary,children:["Use ",n,e.unit?` ${e.unit}`:""]})})})]})}function DateTime({block:e}){const i=(0,_context.useBlockHandlers)();const t=i.answered[e.id];const[n,o]=(0,_react.useState)("");const l=e.presets??[{label:"Now",value:new Date().toISOString()},{label:"Tomorrow",value:new Date(Date.now()+864e5).toISOString()},{label:"+7 days",value:new Date(Date.now()+7*864e5).toISOString()},{label:"+30 days",value:new Date(Date.now()+30*864e5).toISOString()}];return(0,_jsxRuntime.jsxs)(_primitives.Card,{testID:`buoy-block-datetime-${e.id}`,tone:t?void 0:"info",children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.question,children:e.label}),t?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.decided,children:t.kind==="dateTime"?t.label??t.value:"(skipped)"}):(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.chips,styles.pad],children:l.map(r=>(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:()=>i.answer({blockId:e.id,kind:"dateTime",value:r.value,label:r.label}),style:styles.chip,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.chipText,children:r.label})},r.label))}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.inputRow,styles.pad],children:[(0,_jsxRuntime.jsx)(_reactNative.TextInput,{style:styles.input,value:n,onChangeText:o,placeholder:e.mode==="time"?"14:30":"2026-09-15",placeholderTextColor:_sharedUi.night.color.placeholder,keyboardType:"numbers-and-punctuation"}),(0,_jsxRuntime.jsx)(_reactNative.Pressable,{disabled:!n.trim(),onPress:()=>i.answer({blockId:e.id,kind:"dateTime",value:n.trim()}),style:[styles.button,styles.buttonPrimary,!n.trim()&&styles.disabled],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.buttonTextPrimary,children:"Use"})})]})]})]})}function FieldRow({f:e,value:i,onChange:t,disabled:n}){if(e.type==="toggle"){return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.fieldRow,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.fieldLabel,children:e.label}),(0,_jsxRuntime.jsx)(_reactNative.Switch,{value:!!i,onValueChange:t,disabled:n,trackColor:{true:_sharedUi.night.color.accent,false:_sharedUi.night.color.fillTertiary},thumbColor:_sharedUi.night.color.knob})]})}if(e.type==="select"){return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.fieldCol,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.fieldLabel,children:e.label}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.chips,children:e.options.map(o=>(0,_jsxRuntime.jsx)(_reactNative.Pressable,{disabled:n,onPress:()=>t(o.id),style:[styles.chip,i===o.id&&styles.chipOn],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.chipText,i===o.id&&styles.chipTextOn],children:o.label})},o.id))})]})}if(e.type==="slider"){return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.fieldCol,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.fieldLabel,children:e.label}),(0,_jsxRuntime.jsx)(SliderControl,{min:e.min,max:e.max,step:e.step,unit:e.unit,value:typeof i==="number"?i:e.min,onChange:t,disabled:n})]})}return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.fieldRow,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.fieldLabel,children:e.label}),(0,_jsxRuntime.jsx)(_reactNative.TextInput,{style:styles.fieldInput,value:i===void 0||i===null?"":String(i),onChangeText:t,editable:!n,placeholder:e.placeholder??"",placeholderTextColor:_sharedUi.night.color.placeholder,keyboardType:e.type==="number"?"numeric":"ascii-capable",secureTextEntry:e.type==="secret",autoCapitalize:"none",autoCorrect:false})]})}function useFormValues(e){const[i,t]=(0,_react.useState)(()=>Object.fromEntries(e.map(n=>[n.key,n.value])));return{values:i,set:(n,o)=>t(l=>({...l,[n]:o}))}}function Form({block:e}){const i=(0,_context.useBlockHandlers)();const t=i.answered[e.id];const{values:n,set:o}=useFormValues(e.fields);return(0,_jsxRuntime.jsxs)(_primitives.Card,{title:e.title,testID:`buoy-block-form-${e.id}`,tone:t?void 0:"info",children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.pad,children:e.fields.map(l=>(0,_jsxRuntime.jsx)(FieldRow,{f:l,value:n[l.key],onChange:r=>o(l.key,r),disabled:!!t},l.key))}),t?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.decided,children:"Sent"}):(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.rowEnd,children:(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:()=>i.answer({blockId:e.id,kind:"form",values:n}),style:[styles.button,styles.buttonPrimary],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.buttonTextPrimary,children:e.submitLabel??"Send"})})})]})}function Proposal({block:e}){const i=(0,_context.useBlockHandlers)();const t=i.answered[e.id];const{values:n,set:o}=useFormValues(e.fields);const l=t?.kind==="proposal"?t.approved:null;return(0,_jsxRuntime.jsxs)(_primitives.Card,{testID:`buoy-block-proposal-${e.id}`,tone:t?void 0:"warning",children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.confirmTitle,children:e.title}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.confirmChange,children:e.change}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.pad,children:e.fields.map(r=>(0,_jsxRuntime.jsx)(FieldRow,{f:r,value:n[r.key],onChange:d=>o(r.key,d),disabled:!!t},r.key))}),e.consequence?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.consequence,children:e.consequence}):null,(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.actionsRow,children:t?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.decided,children:l?"\u2713 Applied with these values":"\u2715 Not applied"}):(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:()=>i.answer({blockId:e.id,kind:"proposal",approved:true,values:n}),style:[styles.button,styles.buttonPrimary],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.buttonTextPrimary,children:e.approveLabel??"Apply"})}),(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:()=>i.answer({blockId:e.id,kind:"proposal",approved:false}),style:[styles.button,styles.buttonPlate],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.buttonTextPlate,children:"Not now"})})]})})]})}function Claim({block:e}){const i=(0,_context.useBlockHandlers)();const[t,n]=(0,_react.useState)(null);const o=i.actionState?.[`${e.id}:${e.verify?.label??"Verify"}`];const l=e.verified||o==="done";return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.claim,testID:`buoy-block-claim-${e.id}`,children:[(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.claimText,children:[e.text,e.sources.map((r,d)=>(0,_jsxRuntime.jsxs)(_reactNative.Text,{onPress:()=>n(t===d?null:d),style:styles.cite,children:[" [",d+1,"]"]},d)),l?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.verified,children:" \u2713 verified"}):null]}),t!==null&&e.sources[t]?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.citeBox,children:[(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.citeLabel,children:["[",t+1,"] ",e.sources[t].label]}),e.sources[t].detail?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.citeDetail,children:e.sources[t].detail}):null]}):null,e.verify&&!l?(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{onPress:()=>void i.runAction(e.verify,e.id),style:styles.verifyBtn,accessibilityRole:"button",children:[(0,_jsxRuntime.jsx)(_sharedUi.RefreshCw,{size:11,color:_sharedUi.night.color.accent}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.verifyText,children:o==="running"?"Checking\u2026":e.verify.label})]}):null]})}function Details({block:e}){const[i,t]=(0,_react.useState)(!!e.open);return(0,_jsxRuntime.jsxs)(_primitives.Card,{testID:`buoy-block-details-${e.id}`,children:[(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{onPress:()=>t(n=>!n),style:_primitives.blockStyles.row,accessibilityRole:"button",accessibilityState:{expanded:i},children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:_primitives.blockStyles.rowTitle,children:e.summary}),i?(0,_jsxRuntime.jsx)(_sharedUi.ChevronDown,{size:12,color:_sharedUi.night.color.textTertiary}):(0,_jsxRuntime.jsx)(_sharedUi.ChevronRight,{size:12,color:_sharedUi.night.color.textTertiary})]}),i?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.detailsBody,selectable:true,children:e.body}):null]})}function Tabs({block:e,renderNested:i}){const[t,n]=(0,_react.useState)(0);const o=e.tabs.map((r,d)=>({key:String(d),label:r.label}));const l=e.tabs[t];return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.tabsWrap,testID:`buoy-block-tabs-${e.id}`,children:[(0,_jsxRuntime.jsx)(_sharedUi.NightSegmented,{tabs:o,activeKey:String(t),onChange:r=>n(Number(r)),size:"sm"}),l&&i?i(l.block):null]})}const TIMELINE_CAP=10;function Timeline({block:e}){const i=(0,_primitives.usePaged)(e.events,TIMELINE_CAP);return(0,_jsxRuntime.jsxs)(_primitives.Card,{title:e.title??"What happened",source:e.source,testID:`buoy-block-timeline-${e.id}`,children:[i.visible.map((t,n)=>(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.tlRow,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.tlAt,children:t.at}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.tlLine,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.tlDot,{backgroundColor:(0,_primitives.toneColor)(t.tone??"muted")}]}),n<i.visible.length-1?(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.tlStem}):null]}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.flex,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.tlSource,children:t.source.toUpperCase()}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:_primitives.blockStyles.rowTitle,numberOfLines:2,children:t.label})]})]},n)),(0,_jsxRuntime.jsx)(_primitives.More,{paged:i})]})}function Sparkline({block:e}){const i=e.series.slice(-60);const t=Math.max(1,...i);const n=Math.min(...i,0);const o=44;return(0,_jsxRuntime.jsxs)(_primitives.Card,{title:e.title,source:e.source,testID:`buoy-block-sparkline-${e.id}`,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.sparkHead,children:[(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.sparkCurrent,children:[e.current??i[i.length-1],e.unit?(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.sparkUnit,children:[" ",e.unit]}):null]}),e.live?(0,_jsxRuntime.jsx)(LivePill,{}):null]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.spark,{height:o}],children:i.map((l,r)=>(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.sparkBar,{height:Math.max(2,(l-n)/(t-n||1)*o),backgroundColor:r===i.length-1?_sharedUi.night.color.accent:_sharedUi.night.color.accentBorderStrong}]},r))}),e.label?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.hint,children:e.label}):null]})}function LivePill(){const e=(0,_react.useRef)(new _reactNative.Animated.Value(1)).current;(0,_react.useEffect)(()=>{const i=_reactNative.Animated.loop(_reactNative.Animated.sequence([_reactNative.Animated.timing(e,{toValue:.3,duration:700,useNativeDriver:true}),_reactNative.Animated.timing(e,{toValue:1,duration:700,useNativeDriver:true})]));i.start();return()=>i.stop()},[e]);return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.live,children:[(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:[styles.liveDot,{opacity:e}]}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.liveText,children:"LIVE"})]})}function Compare({block:e}){const i=[...new Set([...e.left.pairs.map(o=>o.key),...e.right.pairs.map(o=>o.key)])];const t=Object.fromEntries(e.left.pairs.map(o=>[o.key,o.value]));const n=Object.fromEntries(e.right.pairs.map(o=>[o.key,o.value]));return(0,_jsxRuntime.jsxs)(_primitives.Card,{title:e.title,source:e.source,testID:`buoy-block-compare-${e.id}`,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.cmpHead,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.cmpKey}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.cmpCol,children:e.left.title}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.cmpCol,children:e.right.title})]}),i.map((o,l)=>{const r=JSON.stringify(t[o])!==JSON.stringify(n[o]);return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.cmpRow,l>0&&_primitives.blockStyles.rowDivider,r&&styles.cmpDiff],children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.cmpKey,numberOfLines:1,children:o}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.cmpVal,r&&{color:_sharedUi.night.color.danger}],numberOfLines:2,children:fmt(t[o])}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.cmpVal,r&&{color:_sharedUi.night.color.accent}],numberOfLines:2,children:fmt(n[o])})]},o)})]})}function CardBody({c:e,id:i}){return(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[e.image?(0,_jsxRuntime.jsx)(_reactNative.Image,{testID:"buoy-internal-chat-image",source:{uri:e.image},style:styles.cardImage,resizeMode:"contain",accessibilityLabel:e.title}):null,(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.cardText,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.cardTitle,numberOfLines:2,children:e.title}),e.subtitle?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:_primitives.blockStyles.rowSub,numberOfLines:2,children:e.subtitle}):null,e.facts?.slice(0,4).map(t=>(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.fact,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.factLabel,children:t.label}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.factValue,t.tone&&{color:(0,_primitives.toneColor)(t.tone)}],children:t.value})]},t.label))]}),(0,_jsxRuntime.jsx)(_primitives.ActionRow,{actions:e.actions,blockId:i})]})}function CardView({block:e}){return(0,_jsxRuntime.jsx)(_primitives.Card,{source:e.source,testID:`buoy-block-card-${e.id}`,children:(0,_jsxRuntime.jsx)(CardBody,{c:e,id:e.id})})}function CardCarousel({block:e}){return(0,_jsxRuntime.jsxs)(_reactNative.View,{testID:`buoy-block-cardcarousel-${e.id}`,children:[e.title?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.carouselTitle,children:e.title}):null,(0,_jsxRuntime.jsx)(_reactNative.ScrollView,{horizontal:true,showsHorizontalScrollIndicator:false,snapToInterval:232,decelerationRate:"fast",contentContainerStyle:styles.carousel,children:e.cards.slice(0,8).map((i,t)=>(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.carouselCard,children:(0,_jsxRuntime.jsx)(CardBody,{c:i,id:`${e.id}-${t}`})},`${i.title}-${t}`))})]})}function Screenshot({block:e}){const[i,t]=(0,_react.useState)(false);return(0,_jsxRuntime.jsxs)(_primitives.Card,{title:e.route?`Screen \xB7 ${e.route}`:"Screen",source:e.source,testID:`buoy-block-screenshot-${e.id}`,children:[(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:()=>t(n=>!n),accessibilityRole:"imagebutton",accessibilityLabel:e.caption??"Screenshot",children:(0,_jsxRuntime.jsx)(_reactNative.Image,{testID:"buoy-internal-chat-image",source:{uri:e.url},style:[styles.shot,i&&styles.shotBig],resizeMode:"contain"})}),e.caption?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.hint,children:e.caption}):null]})}function Plan({block:e}){const i=e.steps.filter(t=>t.state==="done").length;return(0,_jsxRuntime.jsxs)(_primitives.Card,{title:e.title,testID:`buoy-block-plan-${e.id}`,tone:e.pending?"info":void 0,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.progress,children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.progressFill,{width:`${i/Math.max(1,e.steps.length)*100}%`}]})}),e.steps.map((t,n)=>(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.step,n>0&&_primitives.blockStyles.rowDivider],children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.stepMark,t.state==="done"&&styles.stepDone,t.state==="failed"&&styles.stepFailed,t.state==="running"&&styles.stepRunning],children:t.state==="done"?(0,_jsxRuntime.jsx)(_sharedUi.Check,{size:10,color:_sharedUi.night.color.onAccent}):t.state==="failed"?(0,_jsxRuntime.jsx)(_sharedUi.X,{size:10,color:_sharedUi.night.color.text}):(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.stepNum,children:n+1})}),(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:[_primitives.blockStyles.rowTitle,t.state==="done"&&styles.muted],children:[t.text,t.state==="running"?"\u2026":""]})]},n)),(0,_jsxRuntime.jsx)(_primitives.ActionRow,{actions:e.actions??(e.pending?[{label:"Go",primary:true,send:"Go ahead with the plan."},{label:"Change it",send:"Let me change the plan first."}]:void 0),blockId:e.id})]})}function Checkpoint({block:e}){const i=(0,_context.useBlockHandlers)();return(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{testID:`buoy-block-checkpoint-${e.id}`,disabled:!e.restore,onPress:()=>e.restore&&void i.runAction(e.restore,e.id),style:styles.checkpoint,accessibilityRole:"button",children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.cpFlag}),(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.cpText,children:[e.label,e.at?` \xB7 ${e.at}`:""]}),e.restore?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.cpRestore,children:e.restore.label}):null]})}function Task({block:e}){const i=e.status==="failed"?_sharedUi.night.color.danger:e.status==="done"?_sharedUi.night.color.accent:_sharedUi.night.color.info;return(0,_jsxRuntime.jsxs)(_primitives.Card,{testID:`buoy-block-task-${e.id}`,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.taskHead,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.cardTitle,children:e.title}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:[_primitives.blockStyles.pill,{backgroundColor:`${i}22`}],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[_primitives.blockStyles.pillText,{color:i}],children:e.status.toUpperCase()})})]}),e.progress!==void 0?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.progress,styles.pad],children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.progressFill,{width:`${Math.round(e.progress*100)}%`,backgroundColor:i}]})}):null,e.detail?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.hint,children:e.detail}):null,(0,_jsxRuntime.jsx)(_primitives.ActionRow,{actions:e.actions,blockId:e.id})]})}function Banner({block:e}){const i=e.tone==="danger"?_sharedUi.night.color.danger:e.tone==="warning"?_sharedUi.night.color.warning:_sharedUi.night.color.info;return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.banner,{borderColor:i,backgroundColor:`${i}1A`}],testID:`buoy-block-banner-${e.id}`,children:[(0,_jsxRuntime.jsx)(_sharedUi.AlertTriangle,{size:13,color:i}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.bannerText,{color:i}],numberOfLines:2,children:e.text}),e.actions?.[0]?(0,_jsxRuntime.jsx)(_primitives.ActionRow,{actions:e.actions.slice(0,1),blockId:e.id,align:"right"}):null]})}function File({block:e}){return(0,_jsxRuntime.jsxs)(_primitives.Card,{testID:`buoy-block-file-${e.id}`,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:_primitives.blockStyles.row,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.fileIcon,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.fileExt,children:(e.type??e.name.split(".").pop()??"file").toUpperCase().slice(0,4)})}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.flex,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:_primitives.blockStyles.rowTitle,numberOfLines:1,children:e.name}),e.size?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:_primitives.blockStyles.rowSub,children:e.size}):null]})]}),(0,_jsxRuntime.jsx)(_primitives.ActionRow,{actions:e.actions,blockId:e.id})]})}function Upload({block:e}){const i=(0,_context.useBlockHandlers)();const t=i.answered[e.id];return(0,_jsxRuntime.jsxs)(_primitives.Card,{testID:`buoy-block-upload-${e.id}`,tone:t?void 0:"info",children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.question,children:e.label}),t?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.decided,children:t.kind==="upload"?`Attached ${t.name}`:"(skipped)"}):(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.rowEnd,{justifyContent:"flex-start"}],children:(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:()=>i.answer({blockId:e.id,kind:"upload",name:"screenshot.png"}),style:[styles.button,styles.buttonPlate],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.buttonTextPlate,children:e.accept==="image"?"Choose a screenshot":"Choose a file"})})})]})}const styles=_reactNative.StyleSheet.create({flex:{flex:1},pad:{paddingHorizontal:12,paddingBottom:8},muted:{color:_sharedUi.night.color.textSecondary},dim:{opacity:.45},disabled:{opacity:.5},pressed:{opacity:.7},question:{color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.row,fontWeight:"600",lineHeight:20,paddingHorizontal:12,paddingTop:12,paddingBottom:8},hint:{color:_sharedUi.night.color.textTertiary,fontSize:_sharedUi.night.font.micro,paddingHorizontal:12,paddingBottom:10},decided:{color:_sharedUi.night.color.textSecondary,fontSize:_sharedUi.night.font.caption,fontWeight:"600",paddingHorizontal:12,paddingVertical:10},rowEnd:{flexDirection:"row",justifyContent:"flex-end",paddingHorizontal:12,paddingBottom:12,gap:8},actionsRow:{flexDirection:"row",gap:8,paddingHorizontal:12,paddingVertical:12,alignItems:"center"},button:{paddingHorizontal:14,paddingVertical:9,borderRadius:_sharedUi.night.radius.row},buttonPrimary:{backgroundColor:_sharedUi.night.color.accent},buttonPlate:{backgroundColor:_sharedUi.night.color.button},buttonTextPrimary:{color:_sharedUi.night.color.onAccent,fontSize:_sharedUi.night.font.caption,fontWeight:"600"},buttonTextPlate:{color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.caption,fontWeight:"600"},chips:{flexDirection:"row",flexWrap:"wrap",gap:6},chip:{paddingHorizontal:12,paddingVertical:7,borderRadius:_sharedUi.night.radius.chip,backgroundColor:_sharedUi.night.color.fill,borderWidth:_reactNative.StyleSheet.hairlineWidth,borderColor:_sharedUi.night.color.border},chipOn:{backgroundColor:_sharedUi.night.color.accentSoft,borderColor:_sharedUi.night.color.accentBorderStrong},chipText:{color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.caption},chipTextOn:{color:_sharedUi.night.color.accent,fontWeight:"600"},optionsBox:{marginHorizontal:8,marginBottom:8,borderRadius:_sharedUi.night.radius.row,backgroundColor:_sharedUi.night.color.surfaceElevated,overflow:"hidden"},option:{flexDirection:"row",alignItems:"center",gap:10,paddingHorizontal:12,paddingVertical:10},optionLabel:{color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.body,fontWeight:"500"},optionDetail:{color:_sharedUi.night.color.textSecondary,fontSize:_sharedUi.night.font.caption},checkbox:{width:20,height:20,borderRadius:6,borderWidth:1.5,borderColor:_sharedUi.night.color.textTertiary,alignItems:"center",justifyContent:"center"},checkboxOn:{backgroundColor:_sharedUi.night.color.accent,borderColor:_sharedUi.night.color.accent},selectBox:{marginHorizontal:12,marginBottom:12,borderRadius:_sharedUi.night.radius.row,backgroundColor:_sharedUi.night.color.surfaceElevated,overflow:"hidden"},selectField:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:12,paddingVertical:11},selectPlaceholder:{color:_sharedUi.night.color.textSecondary,fontSize:_sharedUi.night.font.body},search:{flexDirection:"row",alignItems:"center",gap:6,paddingHorizontal:12,paddingVertical:6,borderTopWidth:_reactNative.StyleSheet.hairlineWidth,borderTopColor:_sharedUi.night.color.separator},searchInput:{flex:1,color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.caption,paddingVertical:4},sliderRow:{flexDirection:"row",alignItems:"center",gap:8},stepBtn:{width:28,height:28,borderRadius:14,backgroundColor:_sharedUi.night.color.fill,alignItems:"center",justifyContent:"center"},stepText:{color:_sharedUi.night.color.text,fontSize:16,fontWeight:"600"},trackHit:{flex:1,height:36,justifyContent:"center"},track:{height:6,borderRadius:3,backgroundColor:_sharedUi.night.color.fillTertiary,justifyContent:"center"},fill:{height:6,borderRadius:3,backgroundColor:_sharedUi.night.color.accent},thumb:{position:"absolute",width:20,height:20,borderRadius:10,backgroundColor:_sharedUi.night.color.knob,marginLeft:-10,shadowColor:"#000",shadowOpacity:.35,shadowRadius:3,shadowOffset:{width:0,height:1}},sliderValue:{width:64,textAlign:"right",color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.caption,fontWeight:"600"},inputRow:{flexDirection:"row",alignItems:"center",gap:8,paddingBottom:12},input:{flex:1,height:38,paddingHorizontal:12,borderRadius:_sharedUi.night.radius.row,backgroundColor:_sharedUi.night.color.surfaceElevated,color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.body},fieldRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:10,paddingVertical:6},fieldCol:{paddingVertical:6,gap:6},fieldLabel:{color:_sharedUi.night.color.textSecondary,fontSize:_sharedUi.night.font.caption,width:110},fieldInput:{flex:1,height:34,paddingHorizontal:10,borderRadius:_sharedUi.night.radius.segment,backgroundColor:_sharedUi.night.color.surfaceElevated,color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.caption},confirmTitle:{color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.row,fontWeight:"600",paddingHorizontal:12,paddingTop:12},confirmChange:{color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.body,lineHeight:19,paddingHorizontal:12,paddingTop:6,paddingBottom:6},consequence:{color:_sharedUi.night.color.warning,fontSize:_sharedUi.night.font.caption,paddingHorizontal:12},claim:{gap:6,paddingHorizontal:2},claimText:{color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.row,lineHeight:22},cite:{color:_sharedUi.night.color.accent,fontSize:_sharedUi.night.font.caption,fontWeight:"700"},verified:{color:_sharedUi.night.color.accent,fontSize:_sharedUi.night.font.caption,fontWeight:"600"},citeBox:{padding:10,borderRadius:_sharedUi.night.radius.row,backgroundColor:_sharedUi.night.color.surface,borderWidth:_reactNative.StyleSheet.hairlineWidth,borderColor:_sharedUi.night.color.border,gap:2},citeLabel:{color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.caption,fontWeight:"600"},citeDetail:{color:_sharedUi.night.color.textSecondary,fontSize:_sharedUi.night.font.caption,fontFamily:"Menlo"},verifyBtn:{alignSelf:"flex-start",flexDirection:"row",alignItems:"center",gap:5,paddingHorizontal:10,paddingVertical:5,borderRadius:_sharedUi.night.radius.chip,backgroundColor:_sharedUi.night.color.accentSoft},verifyText:{color:_sharedUi.night.color.accent,fontSize:_sharedUi.night.font.micro,fontWeight:"700"},detailsBody:{color:_sharedUi.night.color.textSecondary,fontSize:_sharedUi.night.font.caption,lineHeight:18,paddingHorizontal:12,paddingBottom:12},tabsWrap:{gap:8},tabBar:{flexDirection:"row",gap:6},tab:{paddingHorizontal:12,paddingVertical:6,borderRadius:_sharedUi.night.radius.badge,backgroundColor:_sharedUi.night.color.fill},tabOn:{backgroundColor:_sharedUi.night.color.accentSoft},tabText:{color:_sharedUi.night.color.textSecondary,fontSize:_sharedUi.night.font.caption,fontWeight:"600"},tabTextOn:{color:_sharedUi.night.color.accent},tlRow:{flexDirection:"row",gap:10,paddingHorizontal:12,paddingVertical:4,alignItems:"flex-start"},tlAt:{width:46,color:_sharedUi.night.color.textTertiary,fontSize:_sharedUi.night.font.micro,fontFamily:"Menlo",paddingTop:3},tlLine:{width:12,alignItems:"center"},tlDot:{width:8,height:8,borderRadius:4,marginTop:5},tlStem:{width:1,flex:1,minHeight:18,backgroundColor:_sharedUi.night.color.separator,marginTop:2},tlSource:{color:_sharedUi.night.color.textTertiary,fontSize:9,fontWeight:"700",letterSpacing:.6},sparkHead:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:12,paddingTop:8},sparkCurrent:{color:_sharedUi.night.color.text,fontSize:22,fontWeight:"700"},sparkUnit:{color:_sharedUi.night.color.textSecondary,fontSize:_sharedUi.night.font.caption,fontWeight:"500"},spark:{flexDirection:"row",alignItems:"flex-end",gap:2,paddingHorizontal:12,paddingTop:6,paddingBottom:6},sparkBar:{flex:1,borderRadius:1},live:{flexDirection:"row",alignItems:"center",gap:5,paddingHorizontal:8,paddingVertical:3,borderRadius:_sharedUi.night.radius.badge,backgroundColor:_sharedUi.night.color.dangerSoft},liveDot:{width:6,height:6,borderRadius:3,backgroundColor:_sharedUi.night.color.danger},liveText:{color:_sharedUi.night.color.danger,fontSize:9,fontWeight:"800",letterSpacing:.8},cmpHead:{flexDirection:"row",paddingHorizontal:12,paddingVertical:6,backgroundColor:_sharedUi.night.color.fill,gap:8},cmpCol:{flex:1,color:_sharedUi.night.color.textTertiary,fontSize:_sharedUi.night.font.micro,fontWeight:"700",letterSpacing:.6,textTransform:"uppercase"},cmpRow:{flexDirection:"row",paddingHorizontal:12,paddingVertical:8,gap:8,alignItems:"flex-start"},cmpDiff:{backgroundColor:_sharedUi.night.color.fill},cmpKey:{width:90,color:_sharedUi.night.color.textSecondary,fontSize:_sharedUi.night.font.caption},cmpVal:{flex:1,color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.caption,fontFamily:"Menlo"},cardImage:{width:"100%",height:140,backgroundColor:_sharedUi.night.color.fill},cardText:{paddingHorizontal:12,paddingTop:10,paddingBottom:4,gap:4},cardTitle:{color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.row,fontWeight:"600"},fact:{flexDirection:"row",justifyContent:"space-between",gap:8},factLabel:{color:_sharedUi.night.color.textSecondary,fontSize:_sharedUi.night.font.caption},factValue:{color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.caption,fontWeight:"500"},carouselTitle:{color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.caption,fontWeight:"600",paddingBottom:8},carousel:{gap:8,paddingRight:8},carouselCard:{width:224,borderRadius:_sharedUi.night.radius.card,borderWidth:_reactNative.StyleSheet.hairlineWidth,borderColor:_sharedUi.night.color.border,backgroundColor:_sharedUi.night.color.surface,overflow:"hidden"},shot:{width:"100%",height:220,backgroundColor:_sharedUi.night.color.fill},shotBig:{height:520},progress:{height:4,backgroundColor:_sharedUi.night.color.fill,marginHorizontal:12,marginTop:6,marginBottom:8,borderRadius:2,overflow:"hidden"},progressFill:{height:4,backgroundColor:_sharedUi.night.color.accent},step:{flexDirection:"row",alignItems:"center",gap:10,paddingHorizontal:12,paddingVertical:9},stepMark:{width:20,height:20,borderRadius:10,backgroundColor:_sharedUi.night.color.fillTertiary,alignItems:"center",justifyContent:"center"},stepDone:{backgroundColor:_sharedUi.night.color.accent},stepFailed:{backgroundColor:_sharedUi.night.color.danger},stepRunning:{backgroundColor:_sharedUi.night.color.info},stepNum:{color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.micro,fontWeight:"700"},checkpoint:{alignSelf:"flex-start",flexDirection:"row",alignItems:"center",gap:8,paddingHorizontal:12,paddingVertical:7,borderRadius:_sharedUi.night.radius.chip,backgroundColor:_sharedUi.night.color.fill},cpFlag:{width:8,height:8,borderRadius:2,backgroundColor:_sharedUi.night.color.info},cpText:{color:_sharedUi.night.color.textSecondary,fontSize:_sharedUi.night.font.caption},cpRestore:{color:_sharedUi.night.color.accent,fontSize:_sharedUi.night.font.caption,fontWeight:"600"},taskHead:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:8,paddingHorizontal:12,paddingTop:12},banner:{flexDirection:"row",alignItems:"center",gap:8,paddingLeft:12,paddingRight:4,paddingVertical:4,borderRadius:_sharedUi.night.radius.row,borderWidth:_reactNative.StyleSheet.hairlineWidth},bannerText:{flex:1,fontSize:_sharedUi.night.font.caption,fontWeight:"600"},fileIcon:{width:40,height:40,borderRadius:8,backgroundColor:_sharedUi.night.color.fill,alignItems:"center",justifyContent:"center"},fileExt:{color:_sharedUi.night.color.textSecondary,fontSize:10,fontWeight:"800"}});
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.Banner=Banner;exports.CardCarousel=CardCarousel;exports.CardView=CardView;exports.Checkpoint=Checkpoint;exports.Claim=Claim;exports.Compare=Compare;exports.DateTime=DateTime;exports.Details=Details;exports.File=File;exports.Form=Form;exports.LivePill=LivePill;exports.MultiSelect=MultiSelect;exports.Plan=Plan;exports.Proposal=Proposal;exports.Screenshot=Screenshot;exports.Select=Select;exports.Slider=Slider;exports.Sparkline=Sparkline;exports.Suggestions=Suggestions;exports.Tabs=Tabs;exports.Task=Task;exports.Timeline=Timeline;exports.Upload=Upload;var _sharedUi=require("@buoy-gg/shared-ui");var _reactNative=require("react-native");var _react=require("react");var _context=require("./context");var _primitives=require("./primitives");var _jsxRuntime=require("react/jsx-runtime");const fmt=e=>typeof e==="string"?e:e===void 0?"\u2014":JSON.stringify(e);function Suggestions({block:e}){const i=(0,_context.useBlockHandlers)();return(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.chips,testID:`buoy-block-suggestions-${e.id}`,children:e.chips.slice(0,4).map(t=>(0,_jsxRuntime.jsx)(_reactNative.Pressable,{disabled:!!i.busy,onPress:()=>void i.runAction({label:t.label,send:t.send??t.label},e.id),style:({pressed:n})=>[styles.chip,n&&styles.pressed],accessibilityRole:"button",children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.chipText,children:t.label})},t.label))})}function MultiSelect({block:e}){const i=(0,_context.useBlockHandlers)();const t=i.answered[e.id];const n=!!t;const[o,l]=(0,_react.useState)([]);const r=t?.kind==="multi"?t.optionIds:o;const d=a=>l(s=>s.includes(a)?s.filter(c=>c!==a):[...s,a]);const h=o.length>=(e.min??1)&&(!e.max||o.length<=e.max);return(0,_jsxRuntime.jsxs)(_primitives.Card,{testID:`buoy-block-multi-${e.id}`,tone:n?void 0:"info",children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.question,children:e.question}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.optionsBox,children:e.options.map((a,s)=>{const c=r.includes(a.id);return(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{disabled:n,onPress:()=>d(a.id),style:[styles.option,s>0&&_primitives.blockStyles.rowDivider,n&&!c&&styles.dim],accessibilityRole:"checkbox",accessibilityState:{checked:c},children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.checkbox,c&&styles.checkboxOn],children:c?(0,_jsxRuntime.jsx)(_sharedUi.Check,{size:11,color:_sharedUi.night.color.onAccent}):null}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.flex,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.optionLabel,children:a.label}),a.detail?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.optionDetail,children:a.detail}):null]})]},a.id)})}),n?null:(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.rowEnd,children:(0,_jsxRuntime.jsx)(_reactNative.Pressable,{testID:"buoy-block-multi-submit",disabled:!h,onPress:()=>i.answer({blockId:e.id,kind:"multi",optionIds:o,labels:e.options.filter(a=>o.includes(a.id)).map(a=>a.label)}),style:[styles.button,styles.buttonPrimary,!h&&styles.disabled],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.buttonTextPrimary,children:e.submitLabel??`Use ${o.length||""}`.trim()})})})]})}const SEARCH_FROM=8;function Select({block:e}){const i=(0,_context.useBlockHandlers)();const t=i.answered[e.id];const[n,o]=(0,_react.useState)("");const[l,r]=(0,_react.useState)(false);const d=t?.kind==="select"?t.label:null;const h=e.options.filter(s=>!n||s.label.toLowerCase().includes(n.toLowerCase())).slice(0,8);const a=e.searchable!==false&&e.options.length>=SEARCH_FROM;return(0,_jsxRuntime.jsxs)(_primitives.Card,{testID:`buoy-block-select-${e.id}`,tone:t?void 0:"info",children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.question,children:e.label}),d?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.decided,children:d}):(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.selectBox,children:[(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{onPress:()=>r(s=>!s),style:styles.selectField,accessibilityRole:"button",children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.selectPlaceholder,children:l?"Choose\u2026":`${e.options.length} options`}),(0,_jsxRuntime.jsx)(_sharedUi.ChevronDown,{size:14,color:_sharedUi.night.color.textSecondary})]}),l&&(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[a&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.search,children:[(0,_jsxRuntime.jsx)(_sharedUi.Search,{size:12,color:_sharedUi.night.color.textSecondary}),(0,_jsxRuntime.jsx)(_reactNative.TextInput,{style:styles.searchInput,value:n,onChangeText:o,placeholder:"Search",placeholderTextColor:_sharedUi.night.color.placeholder,autoCapitalize:"none",autoCorrect:false})]}),h.map((s,c)=>(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{onPress:()=>i.answer({blockId:e.id,kind:"select",optionId:s.id,label:s.label}),style:[styles.option,c>0&&_primitives.blockStyles.rowDivider],accessibilityRole:"button",children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.flex,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.optionLabel,children:s.label}),s.detail?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.optionDetail,children:s.detail}):null]}),(0,_jsxRuntime.jsx)(_sharedUi.ChevronRight,{size:12,color:_sharedUi.night.color.textTertiary})]},s.id)),e.options.length>h.length?(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.hint,children:[e.options.length-h.length," more \u2014 keep typing"]}):null]})]})]})}function SliderControl({min:e,max:i,step:t=1,value:n,unit:o,onChange:l,disabled:r}){const d=(0,_react.useRef)(0);const h=i>e?(n-e)/(i-e)*100:0;const a=g=>Math.min(i,Math.max(e,+(Math.round((g-e)/t)*t+e).toFixed(6)));const s=g=>!r&&l(a(n+g*t));const c=g=>{if(r||d.current<=0)return;const x=Math.min(1,Math.max(0,g.nativeEvent.locationX/d.current));l(a(e+x*(i-e)))};const u=g=>{d.current=g.nativeEvent.layout.width};return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.sliderRow,children:[(0,_jsxRuntime.jsx)(_reactNative.Pressable,{disabled:r,onPress:()=>s(-1),style:styles.stepBtn,accessibilityRole:"button",accessibilityLabel:"Decrease",children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.stepText,children:"\u2212"})}),(0,_jsxRuntime.jsx)(_reactNative.Pressable,{style:styles.trackHit,onLayout:u,onPress:c,disabled:r,accessibilityRole:"adjustable",accessibilityValue:{min:e,max:i,now:n},accessibilityActions:[{name:"increment"},{name:"decrement"}],onAccessibilityAction:g=>s(g.nativeEvent.actionName==="increment"?1:-1),children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.track,pointerEvents:"none",children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.fill,{width:`${h}%`}]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.thumb,{left:`${h}%`}]})]})}),(0,_jsxRuntime.jsx)(_reactNative.Pressable,{disabled:r,onPress:()=>s(1),style:styles.stepBtn,accessibilityRole:"button",accessibilityLabel:"Increase",children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.stepText,children:"+"})}),(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.sliderValue,children:[n,o?` ${o}`:""]})]})}function Slider({block:e}){const i=(0,_context.useBlockHandlers)();const t=i.answered[e.id];const[n,o]=(0,_react.useState)(e.value??e.min);return(0,_jsxRuntime.jsxs)(_primitives.Card,{testID:`buoy-block-slider-${e.id}`,tone:t?void 0:"info",children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.question,children:e.label}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.pad,children:(0,_jsxRuntime.jsx)(SliderControl,{min:e.min,max:e.max,step:e.step,value:t?.kind==="slider"?t.value:n,unit:e.unit,onChange:o,disabled:!!t})}),t?null:(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.rowEnd,children:(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:()=>i.answer({blockId:e.id,kind:"slider",value:n,unit:e.unit}),style:[styles.button,styles.buttonPrimary],children:(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.buttonTextPrimary,children:["Use ",n,e.unit?` ${e.unit}`:""]})})})]})}function DateTime({block:e}){const i=(0,_context.useBlockHandlers)();const t=i.answered[e.id];const[n,o]=(0,_react.useState)("");const l=e.presets??[{label:"Now",value:new Date().toISOString()},{label:"Tomorrow",value:new Date(Date.now()+864e5).toISOString()},{label:"+7 days",value:new Date(Date.now()+7*864e5).toISOString()},{label:"+30 days",value:new Date(Date.now()+30*864e5).toISOString()}];return(0,_jsxRuntime.jsxs)(_primitives.Card,{testID:`buoy-block-datetime-${e.id}`,tone:t?void 0:"info",children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.question,children:e.label}),t?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.decided,children:t.kind==="dateTime"?t.label??t.value:"(skipped)"}):(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.chips,styles.pad],children:l.map(r=>(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:()=>i.answer({blockId:e.id,kind:"dateTime",value:r.value,label:r.label}),style:styles.chip,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.chipText,children:r.label})},r.label))}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.inputRow,styles.pad],children:[(0,_jsxRuntime.jsx)(_reactNative.TextInput,{style:styles.input,value:n,onChangeText:o,placeholder:e.mode==="time"?"14:30":"2026-09-15",placeholderTextColor:_sharedUi.night.color.placeholder,keyboardType:"numbers-and-punctuation"}),(0,_jsxRuntime.jsx)(_reactNative.Pressable,{disabled:!n.trim(),onPress:()=>i.answer({blockId:e.id,kind:"dateTime",value:n.trim()}),style:[styles.button,styles.buttonPrimary,!n.trim()&&styles.disabled],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.buttonTextPrimary,children:"Use"})})]})]})]})}function FieldRow({f:e,value:i,onChange:t,disabled:n}){if(e.type==="toggle"){return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.fieldRow,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.fieldLabel,children:e.label}),(0,_jsxRuntime.jsx)(_reactNative.Switch,{value:!!i,onValueChange:t,disabled:n,trackColor:{true:_sharedUi.night.color.accent,false:_sharedUi.night.color.fillTertiary},thumbColor:_sharedUi.night.color.knob})]})}if(e.type==="select"){return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.fieldCol,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.fieldLabel,children:e.label}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.chips,children:e.options.map(o=>(0,_jsxRuntime.jsx)(_reactNative.Pressable,{disabled:n,onPress:()=>t(o.id),style:[styles.chip,i===o.id&&styles.chipOn],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.chipText,i===o.id&&styles.chipTextOn],children:o.label})},o.id))})]})}if(e.type==="slider"){return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.fieldCol,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.fieldLabel,children:e.label}),(0,_jsxRuntime.jsx)(SliderControl,{min:e.min,max:e.max,step:e.step,unit:e.unit,value:typeof i==="number"?i:e.min,onChange:t,disabled:n})]})}return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.fieldRow,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.fieldLabel,children:e.label}),(0,_jsxRuntime.jsx)(_reactNative.TextInput,{style:styles.fieldInput,value:i===void 0||i===null?"":String(i),onChangeText:t,editable:!n,placeholder:e.placeholder??"",placeholderTextColor:_sharedUi.night.color.placeholder,keyboardType:e.type==="number"?"numeric":"ascii-capable",secureTextEntry:e.type==="secret",autoCapitalize:"none",autoCorrect:false})]})}function useFormValues(e){const[i,t]=(0,_react.useState)(()=>Object.fromEntries(e.map(n=>[n.key,n.value])));return{values:i,set:(n,o)=>t(l=>({...l,[n]:o}))}}function Form({block:e}){const i=(0,_context.useBlockHandlers)();const t=i.answered[e.id];const{values:n,set:o}=useFormValues(e.fields);return(0,_jsxRuntime.jsxs)(_primitives.Card,{title:e.title,testID:`buoy-block-form-${e.id}`,tone:t?void 0:"info",children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.pad,children:e.fields.map(l=>(0,_jsxRuntime.jsx)(FieldRow,{f:l,value:n[l.key],onChange:r=>o(l.key,r),disabled:!!t},l.key))}),t?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.decided,children:"Sent"}):(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.rowEnd,children:(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:()=>i.answer({blockId:e.id,kind:"form",values:n}),style:[styles.button,styles.buttonPrimary],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.buttonTextPrimary,children:e.submitLabel??"Send"})})})]})}function Proposal({block:e}){const i=(0,_context.useBlockHandlers)();const t=i.answered[e.id];const{values:n,set:o}=useFormValues(e.fields);const l=t?.kind==="proposal"?t.approved:null;return(0,_jsxRuntime.jsxs)(_primitives.Card,{testID:`buoy-block-proposal-${e.id}`,tone:t?void 0:"warning",children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.confirmTitle,children:e.title}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.confirmChange,children:e.change}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.pad,children:e.fields.map(r=>(0,_jsxRuntime.jsx)(FieldRow,{f:r,value:n[r.key],onChange:d=>o(r.key,d),disabled:!!t},r.key))}),e.consequence?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.consequence,children:e.consequence}):null,(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.actionsRow,children:t?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.decided,children:l?"\u2713 Applied with these values":"\u2715 Not applied"}):(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:()=>i.answer({blockId:e.id,kind:"proposal",approved:true,values:n}),style:[styles.button,styles.buttonPrimary],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.buttonTextPrimary,children:e.approveLabel??"Apply"})}),(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:()=>i.answer({blockId:e.id,kind:"proposal",approved:false}),style:[styles.button,styles.buttonPlate],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.buttonTextPlate,children:"Not now"})})]})})]})}function Claim({block:e}){const i=(0,_context.useBlockHandlers)();const[t,n]=(0,_react.useState)(null);const o=i.actionState?.[`${e.id}:${e.verify?.label??"Verify"}`];const l=e.verified||o==="done";return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.claim,testID:`buoy-block-claim-${e.id}`,children:[(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.claimText,children:[e.text,e.sources.map((r,d)=>(0,_jsxRuntime.jsxs)(_reactNative.Text,{onPress:()=>n(t===d?null:d),style:styles.cite,children:[" [",d+1,"]"]},d)),l?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.verified,children:" \u2713 verified"}):null]}),t!==null&&e.sources[t]?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.citeBox,children:[(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.citeLabel,children:["[",t+1,"] ",e.sources[t].label]}),e.sources[t].detail?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.citeDetail,children:e.sources[t].detail}):null]}):null,e.verify&&!l?(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{onPress:()=>void i.runAction(e.verify,e.id),style:styles.verifyBtn,accessibilityRole:"button",children:[(0,_jsxRuntime.jsx)(_sharedUi.RefreshCw,{size:11,color:_sharedUi.night.color.accent}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.verifyText,children:o==="running"?"Checking\u2026":e.verify.label})]}):null]})}function Details({block:e}){const[i,t]=(0,_react.useState)(!!e.open);return(0,_jsxRuntime.jsxs)(_primitives.Card,{testID:`buoy-block-details-${e.id}`,children:[(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{onPress:()=>t(n=>!n),style:_primitives.blockStyles.row,accessibilityRole:"button",accessibilityState:{expanded:i},children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:_primitives.blockStyles.rowTitle,children:e.summary}),i?(0,_jsxRuntime.jsx)(_sharedUi.ChevronDown,{size:12,color:_sharedUi.night.color.textTertiary}):(0,_jsxRuntime.jsx)(_sharedUi.ChevronRight,{size:12,color:_sharedUi.night.color.textTertiary})]}),i?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.detailsBody,selectable:true,children:e.body}):null]})}function Tabs({block:e,renderNested:i}){const[t,n]=(0,_react.useState)(0);const o=e.tabs.map((r,d)=>({key:String(d),label:r.label}));const l=e.tabs[t];return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.tabsWrap,testID:`buoy-block-tabs-${e.id}`,children:[(0,_jsxRuntime.jsx)(_sharedUi.NightSegmented,{tabs:o,activeKey:String(t),onChange:r=>n(Number(r)),size:"sm"}),l&&i?i(l.block):null]})}const TIMELINE_CAP=10;function Timeline({block:e}){const i=(0,_primitives.usePaged)(e.events,TIMELINE_CAP);return(0,_jsxRuntime.jsxs)(_primitives.Card,{title:e.title??"What happened",source:e.source,testID:`buoy-block-timeline-${e.id}`,children:[i.visible.map((t,n)=>(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.tlRow,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.tlAt,children:t.at}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.tlLine,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.tlDot,{backgroundColor:(0,_primitives.toneColor)(t.tone??"muted")}]}),n<i.visible.length-1?(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.tlStem}):null]}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.flex,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.tlSource,children:t.source.toUpperCase()}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:_primitives.blockStyles.rowTitle,numberOfLines:2,children:t.label})]})]},n)),(0,_jsxRuntime.jsx)(_primitives.More,{paged:i})]})}function Sparkline({block:e}){const i=e.series.slice(-60);const t=Math.max(1,...i);const n=Math.min(...i,0);const o=44;return(0,_jsxRuntime.jsxs)(_primitives.Card,{title:e.title,source:e.source,testID:`buoy-block-sparkline-${e.id}`,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.sparkHead,children:[(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.sparkCurrent,children:[e.current??i[i.length-1],e.unit?(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.sparkUnit,children:[" ",e.unit]}):null]}),e.live?(0,_jsxRuntime.jsx)(LivePill,{}):null]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.spark,{height:o}],children:i.map((l,r)=>(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.sparkBar,{height:Math.max(2,(l-n)/(t-n||1)*o),backgroundColor:r===i.length-1?_sharedUi.night.color.accent:_sharedUi.night.color.accentBorderStrong}]},r))}),e.label?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.hint,children:e.label}):null]})}function LivePill(){const e=(0,_react.useRef)(new _reactNative.Animated.Value(1)).current;(0,_react.useEffect)(()=>{const i=_reactNative.Animated.loop(_reactNative.Animated.sequence([_reactNative.Animated.timing(e,{toValue:.3,duration:700,useNativeDriver:true}),_reactNative.Animated.timing(e,{toValue:1,duration:700,useNativeDriver:true})]));i.start();return()=>i.stop()},[e]);return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.live,children:[(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:[styles.liveDot,{opacity:e}]}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.liveText,children:"LIVE"})]})}function Compare({block:e}){const i=[...new Set([...e.left.pairs.map(o=>o.key),...e.right.pairs.map(o=>o.key)])];const t=Object.fromEntries(e.left.pairs.map(o=>[o.key,o.value]));const n=Object.fromEntries(e.right.pairs.map(o=>[o.key,o.value]));return(0,_jsxRuntime.jsxs)(_primitives.Card,{title:e.title,source:e.source,testID:`buoy-block-compare-${e.id}`,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.cmpHead,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.cmpKey}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.cmpCol,children:e.left.title}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.cmpCol,children:e.right.title})]}),i.map((o,l)=>{const r=JSON.stringify(t[o])!==JSON.stringify(n[o]);return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.cmpRow,l>0&&_primitives.blockStyles.rowDivider,r&&styles.cmpDiff],children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.cmpKey,numberOfLines:1,children:o}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.cmpVal,r&&{color:_sharedUi.night.color.danger}],numberOfLines:2,children:fmt(t[o])}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.cmpVal,r&&{color:_sharedUi.night.color.accent}],numberOfLines:2,children:fmt(n[o])})]},o)})]})}function CardBody({c:e,id:i}){return(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[e.image?(0,_jsxRuntime.jsx)(_reactNative.Image,{testID:"buoy-internal-chat-image",source:{uri:e.image},style:styles.cardImage,resizeMode:"contain",accessibilityLabel:e.title}):null,(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.cardText,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.cardTitle,numberOfLines:2,children:e.title}),e.subtitle?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:_primitives.blockStyles.rowSub,numberOfLines:2,children:e.subtitle}):null,e.facts?.slice(0,4).map(t=>(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.fact,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.factLabel,children:t.label}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.factValue,t.tone&&{color:(0,_primitives.toneColor)(t.tone)}],children:t.value})]},t.label))]}),(0,_jsxRuntime.jsx)(_primitives.ActionRow,{actions:e.actions,blockId:i})]})}function CardView({block:e}){return(0,_jsxRuntime.jsx)(_primitives.Card,{source:e.source,testID:`buoy-block-card-${e.id}`,children:(0,_jsxRuntime.jsx)(CardBody,{c:e,id:e.id})})}function CardCarousel({block:e}){return(0,_jsxRuntime.jsxs)(_reactNative.View,{testID:`buoy-block-cardcarousel-${e.id}`,children:[e.title?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.carouselTitle,children:e.title}):null,(0,_jsxRuntime.jsx)(_reactNative.ScrollView,{horizontal:true,showsHorizontalScrollIndicator:false,snapToInterval:232,decelerationRate:"fast",contentContainerStyle:styles.carousel,children:e.cards.slice(0,8).map((i,t)=>(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.carouselCard,children:(0,_jsxRuntime.jsx)(CardBody,{c:i,id:`${e.id}-${t}`})},`${i.title}-${t}`))})]})}function Screenshot({block:e}){const[i,t]=(0,_react.useState)(false);return(0,_jsxRuntime.jsxs)(_primitives.Card,{title:e.route?`Screen \xB7 ${e.route}`:"Screen",source:e.source,testID:`buoy-block-screenshot-${e.id}`,children:[(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:()=>t(n=>!n),accessibilityRole:"imagebutton",accessibilityLabel:e.caption??"Screenshot",children:(0,_jsxRuntime.jsx)(_reactNative.Image,{testID:"buoy-internal-chat-image",source:{uri:e.url},style:[styles.shot,i&&styles.shotBig],resizeMode:"contain"})}),e.caption?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.hint,children:e.caption}):null]})}function Plan({block:e}){const i=e.steps.filter(t=>t.state==="done").length;return(0,_jsxRuntime.jsxs)(_primitives.Card,{title:e.title,testID:`buoy-block-plan-${e.id}`,tone:e.pending?"info":void 0,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.progress,children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.progressFill,{width:`${i/Math.max(1,e.steps.length)*100}%`}]})}),e.steps.map((t,n)=>(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.step,n>0&&_primitives.blockStyles.rowDivider],children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.stepMark,t.state==="done"&&styles.stepDone,t.state==="failed"&&styles.stepFailed,t.state==="running"&&styles.stepRunning],children:t.state==="done"?(0,_jsxRuntime.jsx)(_sharedUi.Check,{size:10,color:_sharedUi.night.color.onAccent}):t.state==="failed"?(0,_jsxRuntime.jsx)(_sharedUi.X,{size:10,color:_sharedUi.night.color.text}):(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.stepNum,children:n+1})}),(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:[_primitives.blockStyles.rowTitle,t.state==="done"&&styles.muted],children:[t.text,t.state==="running"?"\u2026":""]})]},n)),(0,_jsxRuntime.jsx)(_primitives.ActionRow,{actions:e.actions??(e.pending?[{label:"Go",primary:true,send:"Go ahead with the plan."},{label:"Change it",send:"Let me change the plan first."}]:void 0),blockId:e.id})]})}function Checkpoint({block:e}){const i=(0,_context.useBlockHandlers)();return(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{testID:`buoy-block-checkpoint-${e.id}`,disabled:!e.restore,onPress:()=>e.restore&&void i.runAction(e.restore,e.id),style:styles.checkpoint,accessibilityRole:"button",children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.cpFlag}),(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.cpText,children:[e.label,e.at?` \xB7 ${e.at}`:""]}),e.restore?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.cpRestore,children:e.restore.label}):null]})}function Task({block:e}){const i=e.status==="failed"?_sharedUi.night.color.danger:e.status==="done"?_sharedUi.night.color.accent:_sharedUi.night.color.info;return(0,_jsxRuntime.jsxs)(_primitives.Card,{testID:`buoy-block-task-${e.id}`,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.taskHead,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.cardTitle,children:e.title}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:[_primitives.blockStyles.pill,{backgroundColor:`${i}22`}],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[_primitives.blockStyles.pillText,{color:i}],children:e.status.toUpperCase()})})]}),e.progress!==void 0?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.progress,styles.pad],children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.progressFill,{width:`${Math.round(e.progress*100)}%`,backgroundColor:i}]})}):null,e.detail?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.hint,children:e.detail}):null,(0,_jsxRuntime.jsx)(_primitives.ActionRow,{actions:e.actions,blockId:e.id})]})}function Banner({block:e}){const i=e.tone==="danger"?_sharedUi.night.color.danger:e.tone==="warning"?_sharedUi.night.color.warning:_sharedUi.night.color.info;return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.banner,{borderColor:i,backgroundColor:`${i}1A`}],testID:`buoy-block-banner-${e.id}`,children:[(0,_jsxRuntime.jsx)(_sharedUi.AlertTriangle,{size:13,color:i}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.bannerText,{color:i}],numberOfLines:2,children:e.text}),e.actions?.[0]?(0,_jsxRuntime.jsx)(_primitives.ActionRow,{actions:e.actions.slice(0,1),blockId:e.id,align:"right"}):null]})}function File({block:e}){return(0,_jsxRuntime.jsxs)(_primitives.Card,{testID:`buoy-block-file-${e.id}`,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:_primitives.blockStyles.row,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.fileIcon,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.fileExt,children:(e.type??e.name.split(".").pop()??"file").toUpperCase().slice(0,4)})}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.flex,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:_primitives.blockStyles.rowTitle,numberOfLines:1,children:e.name}),e.size?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:_primitives.blockStyles.rowSub,children:e.size}):null]})]}),(0,_jsxRuntime.jsx)(_primitives.ActionRow,{actions:e.actions,blockId:e.id})]})}function Upload({block:e}){const i=(0,_context.useBlockHandlers)();const t=i.answered[e.id];return(0,_jsxRuntime.jsxs)(_primitives.Card,{testID:`buoy-block-upload-${e.id}`,tone:t?void 0:"info",children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.question,children:e.label}),t?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.decided,children:t.kind==="upload"?`Attached ${t.name}`:"(skipped)"}):(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.rowEnd,{justifyContent:"flex-start"}],children:(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:()=>i.answer({blockId:e.id,kind:"upload",name:"screenshot.png"}),style:[styles.button,styles.buttonPlate],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.buttonTextPlate,children:e.accept==="image"?"Choose a screenshot":"Choose a file"})})})]})}const styles=_reactNative.StyleSheet.create({flex:{flex:1},pad:{paddingHorizontal:12,paddingBottom:8},muted:{color:_sharedUi.night.color.textSecondary},dim:{opacity:.45},disabled:{opacity:.5},pressed:{opacity:.7},question:{color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.row,fontWeight:"600",lineHeight:20,paddingHorizontal:12,paddingTop:12,paddingBottom:8},hint:{color:_sharedUi.night.color.textTertiary,fontSize:_sharedUi.night.font.micro,paddingHorizontal:12,paddingBottom:10},decided:{color:_sharedUi.night.color.textSecondary,fontSize:_sharedUi.night.font.caption,fontWeight:"600",paddingHorizontal:12,paddingVertical:10},rowEnd:{flexDirection:"row",justifyContent:"flex-end",paddingHorizontal:12,paddingBottom:12,gap:8},actionsRow:{flexDirection:"row",gap:8,paddingHorizontal:12,paddingVertical:12,alignItems:"center"},button:{paddingHorizontal:14,paddingVertical:9,borderRadius:_sharedUi.night.radius.row},buttonPrimary:{backgroundColor:_sharedUi.night.color.accent},buttonPlate:{backgroundColor:_sharedUi.night.color.button},buttonTextPrimary:{color:_sharedUi.night.color.onAccent,fontSize:_sharedUi.night.font.caption,fontWeight:"600"},buttonTextPlate:{color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.caption,fontWeight:"600"},chips:{flexDirection:"row",flexWrap:"wrap",gap:6},chip:{paddingHorizontal:12,paddingVertical:7,borderRadius:_sharedUi.night.radius.chip,backgroundColor:_sharedUi.night.color.fill,borderWidth:_reactNative.StyleSheet.hairlineWidth,borderColor:_sharedUi.night.color.border},chipOn:{backgroundColor:_sharedUi.night.color.accentSoft,borderColor:_sharedUi.night.color.accentBorderStrong},chipText:{color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.caption},chipTextOn:{color:_sharedUi.night.color.accent,fontWeight:"600"},optionsBox:{marginHorizontal:8,marginBottom:8,borderRadius:_sharedUi.night.radius.row,backgroundColor:_sharedUi.night.color.surfaceElevated,overflow:"hidden"},option:{flexDirection:"row",alignItems:"center",gap:10,paddingHorizontal:12,paddingVertical:10},optionLabel:{color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.body,fontWeight:"500"},optionDetail:{color:_sharedUi.night.color.textSecondary,fontSize:_sharedUi.night.font.caption},checkbox:{width:20,height:20,borderRadius:6,borderWidth:1.5,borderColor:_sharedUi.night.color.textTertiary,alignItems:"center",justifyContent:"center"},checkboxOn:{backgroundColor:_sharedUi.night.color.accent,borderColor:_sharedUi.night.color.accent},selectBox:{marginHorizontal:12,marginBottom:12,borderRadius:_sharedUi.night.radius.row,backgroundColor:_sharedUi.night.color.surfaceElevated,overflow:"hidden"},selectField:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:12,paddingVertical:11},selectPlaceholder:{color:_sharedUi.night.color.textSecondary,fontSize:_sharedUi.night.font.body},search:{flexDirection:"row",alignItems:"center",gap:6,paddingHorizontal:12,paddingVertical:6,borderTopWidth:_reactNative.StyleSheet.hairlineWidth,borderTopColor:_sharedUi.night.color.separator},searchInput:{flex:1,color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.caption,paddingVertical:4},sliderRow:{flexDirection:"row",alignItems:"center",gap:8},stepBtn:{width:28,height:28,borderRadius:14,backgroundColor:_sharedUi.night.color.fill,alignItems:"center",justifyContent:"center"},stepText:{color:_sharedUi.night.color.text,fontSize:16,fontWeight:"600"},trackHit:{flex:1,height:36,justifyContent:"center"},track:{height:6,borderRadius:3,backgroundColor:_sharedUi.night.color.fillTertiary,justifyContent:"center"},fill:{height:6,borderRadius:3,backgroundColor:_sharedUi.night.color.accent},thumb:{position:"absolute",width:20,height:20,borderRadius:10,backgroundColor:_sharedUi.night.color.knob,marginLeft:-10,shadowColor:"#000",shadowOpacity:.35,shadowRadius:3,shadowOffset:{width:0,height:1}},sliderValue:{width:64,textAlign:"right",color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.caption,fontWeight:"600"},inputRow:{flexDirection:"row",alignItems:"center",gap:8,paddingBottom:12},input:{flex:1,height:38,paddingHorizontal:12,borderRadius:_sharedUi.night.radius.row,backgroundColor:_sharedUi.night.color.surfaceElevated,color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.body},fieldRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:10,paddingVertical:6},fieldCol:{paddingVertical:6,gap:6},fieldLabel:{color:_sharedUi.night.color.textSecondary,fontSize:_sharedUi.night.font.caption,width:110},fieldInput:{flex:1,height:34,paddingHorizontal:10,borderRadius:_sharedUi.night.radius.segment,backgroundColor:_sharedUi.night.color.surfaceElevated,color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.caption},confirmTitle:{color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.row,fontWeight:"600",paddingHorizontal:12,paddingTop:12},confirmChange:{color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.body,lineHeight:19,paddingHorizontal:12,paddingTop:6,paddingBottom:6},consequence:{color:_sharedUi.night.color.warning,fontSize:_sharedUi.night.font.caption,paddingHorizontal:12},claim:{gap:6,paddingHorizontal:2},claimText:{color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.row,lineHeight:22},cite:{color:_sharedUi.night.color.accent,fontSize:_sharedUi.night.font.caption,fontWeight:"700"},verified:{color:_sharedUi.night.color.accent,fontSize:_sharedUi.night.font.caption,fontWeight:"600"},citeBox:{padding:10,borderRadius:_sharedUi.night.radius.row,backgroundColor:_sharedUi.night.color.surface,borderWidth:_reactNative.StyleSheet.hairlineWidth,borderColor:_sharedUi.night.color.border,gap:2},citeLabel:{color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.caption,fontWeight:"600"},citeDetail:{color:_sharedUi.night.color.textSecondary,fontSize:_sharedUi.night.font.caption,fontFamily:_reactNative.Platform.OS==="web"?_sharedUi.monoFont:"Menlo"},verifyBtn:{alignSelf:"flex-start",flexDirection:"row",alignItems:"center",gap:5,paddingHorizontal:10,paddingVertical:5,borderRadius:_sharedUi.night.radius.chip,backgroundColor:_sharedUi.night.color.accentSoft},verifyText:{color:_sharedUi.night.color.accent,fontSize:_sharedUi.night.font.micro,fontWeight:"700"},detailsBody:{color:_sharedUi.night.color.textSecondary,fontSize:_sharedUi.night.font.caption,lineHeight:18,paddingHorizontal:12,paddingBottom:12},tabsWrap:{gap:8},tabBar:{flexDirection:"row",gap:6},tab:{paddingHorizontal:12,paddingVertical:6,borderRadius:_sharedUi.night.radius.badge,backgroundColor:_sharedUi.night.color.fill},tabOn:{backgroundColor:_sharedUi.night.color.accentSoft},tabText:{color:_sharedUi.night.color.textSecondary,fontSize:_sharedUi.night.font.caption,fontWeight:"600"},tabTextOn:{color:_sharedUi.night.color.accent},tlRow:{flexDirection:"row",gap:10,paddingHorizontal:12,paddingVertical:4,alignItems:"flex-start"},tlAt:{width:46,color:_sharedUi.night.color.textTertiary,fontSize:_sharedUi.night.font.micro,fontFamily:_reactNative.Platform.OS==="web"?_sharedUi.monoFont:"Menlo",paddingTop:3},tlLine:{width:12,alignItems:"center"},tlDot:{width:8,height:8,borderRadius:4,marginTop:5},tlStem:{width:1,flex:1,minHeight:18,backgroundColor:_sharedUi.night.color.separator,marginTop:2},tlSource:{color:_sharedUi.night.color.textTertiary,fontSize:9,fontWeight:"700",letterSpacing:.6},sparkHead:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:12,paddingTop:8},sparkCurrent:{color:_sharedUi.night.color.text,fontSize:22,fontWeight:"700"},sparkUnit:{color:_sharedUi.night.color.textSecondary,fontSize:_sharedUi.night.font.caption,fontWeight:"500"},spark:{flexDirection:"row",alignItems:"flex-end",gap:2,paddingHorizontal:12,paddingTop:6,paddingBottom:6},sparkBar:{flex:1,borderRadius:1},live:{flexDirection:"row",alignItems:"center",gap:5,paddingHorizontal:8,paddingVertical:3,borderRadius:_sharedUi.night.radius.badge,backgroundColor:_sharedUi.night.color.dangerSoft},liveDot:{width:6,height:6,borderRadius:3,backgroundColor:_sharedUi.night.color.danger},liveText:{color:_sharedUi.night.color.danger,fontSize:9,fontWeight:"800",letterSpacing:.8},cmpHead:{flexDirection:"row",paddingHorizontal:12,paddingVertical:6,backgroundColor:_sharedUi.night.color.fill,gap:8},cmpCol:{flex:1,color:_sharedUi.night.color.textTertiary,fontSize:_sharedUi.night.font.micro,fontWeight:"700",letterSpacing:.6,textTransform:"uppercase"},cmpRow:{flexDirection:"row",paddingHorizontal:12,paddingVertical:8,gap:8,alignItems:"flex-start"},cmpDiff:{backgroundColor:_sharedUi.night.color.fill},cmpKey:{width:90,color:_sharedUi.night.color.textSecondary,fontSize:_sharedUi.night.font.caption},cmpVal:{flex:1,color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.caption,fontFamily:_reactNative.Platform.OS==="web"?_sharedUi.monoFont:"Menlo"},cardImage:{width:"100%",height:140,backgroundColor:_sharedUi.night.color.fill},cardText:{paddingHorizontal:12,paddingTop:10,paddingBottom:4,gap:4},cardTitle:{color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.row,fontWeight:"600"},fact:{flexDirection:"row",justifyContent:"space-between",gap:8},factLabel:{color:_sharedUi.night.color.textSecondary,fontSize:_sharedUi.night.font.caption},factValue:{color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.caption,fontWeight:"500"},carouselTitle:{color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.caption,fontWeight:"600",paddingBottom:8},carousel:{gap:8,paddingRight:8},carouselCard:{width:224,borderRadius:_sharedUi.night.radius.card,borderWidth:_reactNative.StyleSheet.hairlineWidth,borderColor:_sharedUi.night.color.border,backgroundColor:_sharedUi.night.color.surface,overflow:"hidden"},shot:{width:"100%",height:220,backgroundColor:_sharedUi.night.color.fill},shotBig:{height:520},progress:{height:4,backgroundColor:_sharedUi.night.color.fill,marginHorizontal:12,marginTop:6,marginBottom:8,borderRadius:2,overflow:"hidden"},progressFill:{height:4,backgroundColor:_sharedUi.night.color.accent},step:{flexDirection:"row",alignItems:"center",gap:10,paddingHorizontal:12,paddingVertical:9},stepMark:{width:20,height:20,borderRadius:10,backgroundColor:_sharedUi.night.color.fillTertiary,alignItems:"center",justifyContent:"center"},stepDone:{backgroundColor:_sharedUi.night.color.accent},stepFailed:{backgroundColor:_sharedUi.night.color.danger},stepRunning:{backgroundColor:_sharedUi.night.color.info},stepNum:{color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.micro,fontWeight:"700"},checkpoint:{alignSelf:"flex-start",flexDirection:"row",alignItems:"center",gap:8,paddingHorizontal:12,paddingVertical:7,borderRadius:_sharedUi.night.radius.chip,backgroundColor:_sharedUi.night.color.fill},cpFlag:{width:8,height:8,borderRadius:2,backgroundColor:_sharedUi.night.color.info},cpText:{color:_sharedUi.night.color.textSecondary,fontSize:_sharedUi.night.font.caption},cpRestore:{color:_sharedUi.night.color.accent,fontSize:_sharedUi.night.font.caption,fontWeight:"600"},taskHead:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:8,paddingHorizontal:12,paddingTop:12},banner:{flexDirection:"row",alignItems:"center",gap:8,paddingLeft:12,paddingRight:4,paddingVertical:4,borderRadius:_sharedUi.night.radius.row,borderWidth:_reactNative.StyleSheet.hairlineWidth},bannerText:{flex:1,fontSize:_sharedUi.night.font.caption,fontWeight:"600"},fileIcon:{width:40,height:40,borderRadius:8,backgroundColor:_sharedUi.night.color.fill,alignItems:"center",justifyContent:"center"},fileExt:{color:_sharedUi.night.color.textSecondary,fontSize:10,fontWeight:"800"}});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.Crash=Crash;exports.LogList=LogList;exports.Peek=Peek;exports.RequestCard=RequestCard;exports.RequestList=RequestList;exports.RouteChips=RouteChips;exports.RuleCard=RuleCard;exports.ScreenElements=ScreenElements;var
|
|
2
|
-
\u2026`:t}),(0,_jsxRuntime.jsx)(_primitives.ActionRow,{blockId:e.id,actions:[{label:"Open in Network",openTool:{toolId:"network",select:e.request.id}}]}),i.supports?.openTool===false?null:null]})}function RuleCard({block:e}){const n=(0,_context.useBlockHandlers)();const r=n.rules?.[e.rule.id];const o=r?.deleted===true;const t={...e.rule,enabled:o?false:r?.enabled??e.rule.enabled};const i=t.kind==="fail"?"fails (no network)":t.kind==="delay"?`delayed ${t.delayMs??0} ms`:`returns ${t.status??200}`;return(0,_jsxRuntime.jsxs)(_primitives.Card,{title:t.name??"Network override",source:e.source,testID:`buoy-block-rule-${e.id}`,tone:t.enabled?"warning":void 0,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.ruleBody,children:[(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.ruleLine,children:[(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.ruleKey,children:[t.methods?.length?t.methods.join("/"):"ANY"," "]}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:_primitives.blockStyles.mono,children:t.urlPattern})]}),(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.ruleLine,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.ruleKey,children:"\u2192 "}),i,t.times?` \xB7 ${t.times===1?"once":`${t.times} times`}`:" \xB7 every time",t.hits!==void 0?` \xB7 ${t.hits} hit${t.hits===1?"":"s"}`:""]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:[_primitives.blockStyles.pill,t.enabled?styles.on:styles.off],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[_primitives.blockStyles.pillText,{color:t.enabled?_sharedUi.night.color.onAccent:_sharedUi.night.color.textSecondary}],children:o?"DELETED":t.enabled?"ON":"OFF"})})]}),o?null:(0,_jsxRuntime.jsx)(_primitives.ActionRow,{blockId:e.id,actions:[t.enabled?{label:"Turn off",dispatch:{toolId:"network",action:"setOverrideRuleEnabled",params:{id:t.id,enabled:false}}}:{label:"Turn on",primary:true,dispatch:{toolId:"network",action:"setOverrideRuleEnabled",params:{id:t.id,enabled:true}}},{label:"Delete",dispatch:{toolId:"network",action:"deleteOverrideRule",params:{id:t.id}}}]})]})}function ScreenElements({block:e}){const n=(0,_context.useBlockHandlers)();const r=(0,_primitives.usePaged)(e.elements,_agentCore.CAPS.chips);const{visible:o}=r;return(0,_jsxRuntime.jsxs)(_primitives.Card,{title:e.title??"On screen right now",source:e.source,testID:`buoy-block-screen-${e.id}`,children:[o.map((t,i)=>(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{onPress:()=>void n.runAction({label:"Highlight",dispatch:{toolId:"highlight-updates",action:"setSpotlight",params:{nativeTag:t.nativeTag}}},e.id),disabled:n.supports?.dispatch===false,style:[_primitives.blockStyles.row,i>0&&_primitives.blockStyles.rowDivider],accessibilityRole:"button",children:[(0,_jsxRuntime.jsx)(_sharedUi.Eye,{size:12,color:_sharedUi.night.color.textTertiary}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:_primitives.blockStyles.rowTitle,numberOfLines:1,children:t.label??t.testID??t.name}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:_primitives.blockStyles.rowTrailing,numberOfLines:1,children:t.name})]},`${t.nativeTag}-${i}`)),(0,_jsxRuntime.jsx)(_primitives.More,{paged:r})]})}function RouteChips({block:e}){const n=(0,_context.useBlockHandlers)();const r=(0,_primitives.usePaged)(e.routes,_agentCore.CAPS.chips);const o=r.visible;return(0,_jsxRuntime.jsxs)(_primitives.Card,{title:e.current?`Routes \xB7 you're on ${e.current}`:"Routes",source:e.source,testID:`buoy-block-routes-${e.id}`,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.chips,children:o.map((t,i)=>(0,_jsxRuntime.jsx)(_reactNative.Pressable,{disabled:n.supports?.dispatch===false,onPress:()=>t.dynamic?n.answer({blockId:e.id,kind:"input",value:`Open ${t.path} \u2014 which id?`}):void n.runAction({label:`Open ${t.path}`,dispatch:{toolId:"route-events",action:"navigate",params:{path:t.path}}},e.id),style:[styles.chip,t.path===e.current&&styles.chipCurrent],accessibilityRole:"button",children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.chipText,t.dynamic&&styles.chipDynamic],children:t.path})},`${t.path}-${i}`))}),(0,_jsxRuntime.jsx)(_primitives.More,{paged:r})]})}const LEVEL_COLOR={error:_sharedUi.night.color.danger,warn:_sharedUi.night.color.warning,warning:_sharedUi.night.color.warning,info:_sharedUi.night.color.info};function LogList({block:e}){const n=(0,_primitives.usePaged)(e.entries,_agentCore.CAPS.listItems);const{visible:r}=n;return(0,_jsxRuntime.jsxs)(_primitives.Card,{title:"Console",source:e.source,testID:`buoy-block-logs-${e.id}`,children:[r.map((o,t)=>(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[_primitives.blockStyles.row,t>0&&_primitives.blockStyles.rowDivider,styles.logRow],children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:[_primitives.blockStyles.pill,{backgroundColor:`${LEVEL_COLOR[o.level]??_sharedUi.night.color.textTertiary}22`}],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[_primitives.blockStyles.pillText,{color:LEVEL_COLOR[o.level]??_sharedUi.night.color.textSecondary}],children:o.level.toUpperCase()})}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[_primitives.blockStyles.rowTitle,_primitives.blockStyles.mono],numberOfLines:3,children:o.message}),o.count>1?(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:_primitives.blockStyles.rowTrailing,children:["\xD7",o.count]}):null]},`${o.level}-${o.message}-${t}`)),(0,_jsxRuntime.jsx)(_primitives.More,{paged:n})]})}function Crash({block:e}){return(0,_jsxRuntime.jsxs)(_primitives.Card,{tone:"danger",testID:`buoy-block-crash-${e.id}`,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.crashHead,children:[(0,_jsxRuntime.jsx)(_sharedUi.AlertTriangle,{size:14,color:_sharedUi.night.color.danger}),(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.crashTitle,children:["The app crashed",e.route?` on ${e.route}`:""]})]}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[_primitives.blockStyles.mono,styles.crashMsg],numberOfLines:4,selectable:true,children:e.message}),e.suspect?(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.suspect,children:["Most likely cause: ",e.suspect.label]}):null,(0,_jsxRuntime.jsx)(_primitives.ActionRow,{blockId:e.id,actions:[...e.suspect?.action?[{...e.suspect.action,primary:true}]:[],...e.actions??[]].slice(0,2)})]})}function Peek({block:e}){const n=(0,_context.useBlockHandlers)();const r=n.supports?.minimize!==false;return(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{testID:`buoy-block-peek-${e.id}`,disabled:!r,onPress:()=>void n.runAction({label:"Look",minimize:true},e.id),style:({pressed:o})=>[styles.peek,o&&{opacity:.7}],accessibilityRole:"button",accessibilityLabel:`${e.label}. Look at the app`,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.peekText,children:e.label}),r?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.peekLook,children:[(0,_jsxRuntime.jsx)(_sharedUi.Eye,{size:12,color:_sharedUi.night.color.accent}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.peekLookText,children:"Look"})]}):null]})}const styles=_reactNative.StyleSheet.create({method:{color:_sharedUi.night.color.textSecondary,fontSize:_sharedUi.night.font.micro,fontWeight:"700",letterSpacing:.4,width:44},mockedChip:{color:_sharedUi.night.color.warning,backgroundColor:_sharedUi.night.color.warningSoft,fontSize:9,fontWeight:"700",letterSpacing:.6,paddingHorizontal:5,paddingVertical:1,borderRadius:_sharedUi.night.radius.badge,overflow:"hidden"},reqHead:{paddingTop:12},tabs:{paddingHorizontal:12,paddingTop:4,paddingBottom:8},tab:{paddingHorizontal:10,paddingVertical:5,borderRadius:_sharedUi.night.radius.badge,backgroundColor:_sharedUi.night.color.fill},tabOn:{backgroundColor:_sharedUi.night.color.accentSoft},tabText:{color:_sharedUi.night.color.textSecondary,fontSize:_sharedUi.night.font.micro,fontWeight:"600"},tabTextOn:{color:_sharedUi.night.color.accent},body:{paddingHorizontal:12,paddingBottom:4,lineHeight:16,color:_sharedUi.night.color.textSecondary},ruleBody:{paddingHorizontal:12,paddingTop:4,paddingBottom:4,gap:4},ruleLine:{color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.caption,lineHeight:18},ruleKey:{color:_sharedUi.night.color.textSecondary,fontWeight:"700"},on:{alignSelf:"flex-start",backgroundColor:_sharedUi.night.color.accent,marginTop:4},off:{alignSelf:"flex-start",backgroundColor:_sharedUi.night.color.fillTertiary,marginTop:4},chips:{flexDirection:"row",flexWrap:"wrap",gap:6,padding:12},chip:{paddingHorizontal:10,paddingVertical:6,borderRadius:_sharedUi.night.radius.chip,backgroundColor:_sharedUi.night.color.fill,borderWidth:_reactNative.StyleSheet.hairlineWidth,borderColor:_sharedUi.night.color.border},chipCurrent:{backgroundColor:_sharedUi.night.color.accentSoft,borderColor:_sharedUi.night.color.accentBorderStrong},chipText:{color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.caption,fontFamily:"Menlo"},chipDynamic:{color:_sharedUi.night.color.textSecondary},logRow:{alignItems:"flex-start"},crashHead:{flexDirection:"row",alignItems:"center",gap:8,paddingHorizontal:12,paddingTop:12},crashTitle:{color:_sharedUi.night.color.danger,fontSize:_sharedUi.night.font.row,fontWeight:"600"},crashMsg:{paddingHorizontal:12,paddingTop:6,color:_sharedUi.night.color.text},suspect:{color:_sharedUi.night.color.textSecondary,fontSize:_sharedUi.night.font.caption,paddingHorizontal:12,paddingTop:6},peek:{alignSelf:"flex-start",flexDirection:"row",alignItems:"center",gap:10,paddingLeft:12,paddingRight:10,paddingVertical:7,borderRadius:_sharedUi.night.radius.chip,backgroundColor:_sharedUi.night.color.fill},peekText:{color:_sharedUi.night.color.textSecondary,fontSize:_sharedUi.night.font.caption},peekLook:{flexDirection:"row",alignItems:"center",gap:4},peekLookText:{color:_sharedUi.night.color.accent,fontSize:_sharedUi.night.font.caption,fontWeight:"600"}});
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.Crash=Crash;exports.LogList=LogList;exports.Peek=Peek;exports.RequestCard=RequestCard;exports.RequestList=RequestList;exports.RouteChips=RouteChips;exports.RuleCard=RuleCard;exports.ScreenElements=ScreenElements;var _sharedUi=require("@buoy-gg/shared-ui");var _reactNative=require("react-native");var _react=require("react");var _agentCore=require("@buoy-gg/agent-core");var _context=require("./context");var _primitives=require("./primitives");var _jsxRuntime=require("react/jsx-runtime");function statusColor(e){if(e===void 0)return _sharedUi.night.color.textTertiary;if(e>=500)return _sharedUi.night.color.danger;if(e>=400)return _sharedUi.night.color.warning;if(e>=300)return _sharedUi.night.color.info;return _sharedUi.night.color.accent}function pathOf(e){try{const n=new URL(e);return n.pathname+(n.search?"?\u2026":"")}catch{return e}}function StatusPill({status:e}){return(0,_jsxRuntime.jsx)(_reactNative.View,{style:[_primitives.blockStyles.pill,{backgroundColor:`${statusColor(e)}22`}],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[_primitives.blockStyles.pillText,{color:statusColor(e)}],children:e??"\u2026"})})}function RequestList({block:e}){const n=(0,_context.useBlockHandlers)();const r=n.supports?.openTool!==false;const o=(0,_primitives.usePaged)(e.requests,_agentCore.CAPS.listItems);const{visible:t}=o;return(0,_jsxRuntime.jsxs)(_primitives.Card,{title:e.title??"Network requests",source:e.source,testID:`buoy-block-requests-${e.id}`,children:[t.map((i,s)=>(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{disabled:!r,onPress:()=>void n.runAction({label:"Open in Network",openTool:{toolId:"network",select:i.id}},e.id),style:[_primitives.blockStyles.row,s>0&&_primitives.blockStyles.rowDivider],accessibilityRole:r?"button":void 0,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.method,children:i.method}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:_primitives.blockStyles.rowTitle,numberOfLines:1,children:pathOf(i.url)}),i.mocked?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.mockedChip,children:"MOCKED"}):null,i.durationMs!==void 0?(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:_primitives.blockStyles.rowTrailing,children:[i.durationMs," ms"]}):null,(0,_jsxRuntime.jsx)(StatusPill,{status:i.status}),r?(0,_jsxRuntime.jsx)(_sharedUi.ChevronRight,{size:12,color:_sharedUi.night.color.textTertiary}):null]},`${i.id}-${s}`)),(0,_jsxRuntime.jsx)(_primitives.More,{paged:o})]})}const REQUEST_TABS=[{key:"response",label:"Response"},{key:"request",label:"Request"}];function RequestCard({block:e}){const[n,r]=(0,_react.useState)("response");const o=n==="response"?e.responseBody:e.requestBody;const t=o===void 0?"(none)":typeof o==="string"?o:JSON.stringify(o,null,2);const i=(0,_context.useBlockHandlers)();return(0,_jsxRuntime.jsxs)(_primitives.Card,{source:e.source,testID:`buoy-block-request-${e.id}`,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[_primitives.blockStyles.row,styles.reqHead],children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.method,children:e.request.method}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:_primitives.blockStyles.rowTitle,numberOfLines:2,children:pathOf(e.request.url)}),e.request.mocked?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.mockedChip,children:"MOCKED"}):null,(0,_jsxRuntime.jsx)(StatusPill,{status:e.request.status})]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.tabs,children:(0,_jsxRuntime.jsx)(_sharedUi.NightSegmented,{tabs:REQUEST_TABS,activeKey:n,onChange:s=>r(s),size:"sm"})}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[_primitives.blockStyles.mono,styles.body],numberOfLines:14,selectable:true,children:t.length>1600?`${t.slice(0,1600)}
|
|
2
|
+
\u2026`:t}),(0,_jsxRuntime.jsx)(_primitives.ActionRow,{blockId:e.id,actions:[{label:"Open in Network",openTool:{toolId:"network",select:e.request.id}}]}),i.supports?.openTool===false?null:null]})}function RuleCard({block:e}){const n=(0,_context.useBlockHandlers)();const r=n.rules?.[e.rule.id];const o=r?.deleted===true;const t={...e.rule,enabled:o?false:r?.enabled??e.rule.enabled};const i=t.kind==="fail"?"fails (no network)":t.kind==="delay"?`delayed ${t.delayMs??0} ms`:`returns ${t.status??200}`;return(0,_jsxRuntime.jsxs)(_primitives.Card,{title:t.name??"Network override",source:e.source,testID:`buoy-block-rule-${e.id}`,tone:t.enabled?"warning":void 0,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.ruleBody,children:[(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.ruleLine,children:[(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.ruleKey,children:[t.methods?.length?t.methods.join("/"):"ANY"," "]}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:_primitives.blockStyles.mono,children:t.urlPattern})]}),(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.ruleLine,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.ruleKey,children:"\u2192 "}),i,t.times?` \xB7 ${t.times===1?"once":`${t.times} times`}`:" \xB7 every time",t.hits!==void 0?` \xB7 ${t.hits} hit${t.hits===1?"":"s"}`:""]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:[_primitives.blockStyles.pill,t.enabled?styles.on:styles.off],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[_primitives.blockStyles.pillText,{color:t.enabled?_sharedUi.night.color.onAccent:_sharedUi.night.color.textSecondary}],children:o?"DELETED":t.enabled?"ON":"OFF"})})]}),o?null:(0,_jsxRuntime.jsx)(_primitives.ActionRow,{blockId:e.id,actions:[t.enabled?{label:"Turn off",dispatch:{toolId:"network",action:"setOverrideRuleEnabled",params:{id:t.id,enabled:false}}}:{label:"Turn on",primary:true,dispatch:{toolId:"network",action:"setOverrideRuleEnabled",params:{id:t.id,enabled:true}}},{label:"Delete",dispatch:{toolId:"network",action:"deleteOverrideRule",params:{id:t.id}}}]})]})}function ScreenElements({block:e}){const n=(0,_context.useBlockHandlers)();const r=(0,_primitives.usePaged)(e.elements,_agentCore.CAPS.chips);const{visible:o}=r;return(0,_jsxRuntime.jsxs)(_primitives.Card,{title:e.title??"On screen right now",source:e.source,testID:`buoy-block-screen-${e.id}`,children:[o.map((t,i)=>(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{onPress:()=>void n.runAction({label:"Highlight",dispatch:{toolId:"highlight-updates",action:"setSpotlight",params:{nativeTag:t.nativeTag}}},e.id),disabled:n.supports?.dispatch===false,style:[_primitives.blockStyles.row,i>0&&_primitives.blockStyles.rowDivider],accessibilityRole:"button",children:[(0,_jsxRuntime.jsx)(_sharedUi.Eye,{size:12,color:_sharedUi.night.color.textTertiary}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:_primitives.blockStyles.rowTitle,numberOfLines:1,children:t.label??t.testID??t.name}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:_primitives.blockStyles.rowTrailing,numberOfLines:1,children:t.name})]},`${t.nativeTag}-${i}`)),(0,_jsxRuntime.jsx)(_primitives.More,{paged:r})]})}function RouteChips({block:e}){const n=(0,_context.useBlockHandlers)();const r=(0,_primitives.usePaged)(e.routes,_agentCore.CAPS.chips);const o=r.visible;return(0,_jsxRuntime.jsxs)(_primitives.Card,{title:e.current?`Routes \xB7 you're on ${e.current}`:"Routes",source:e.source,testID:`buoy-block-routes-${e.id}`,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.chips,children:o.map((t,i)=>(0,_jsxRuntime.jsx)(_reactNative.Pressable,{disabled:n.supports?.dispatch===false,onPress:()=>t.dynamic?n.answer({blockId:e.id,kind:"input",value:`Open ${t.path} \u2014 which id?`}):void n.runAction({label:`Open ${t.path}`,dispatch:{toolId:"route-events",action:"navigate",params:{path:t.path}}},e.id),style:[styles.chip,t.path===e.current&&styles.chipCurrent],accessibilityRole:"button",children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.chipText,t.dynamic&&styles.chipDynamic],children:t.path})},`${t.path}-${i}`))}),(0,_jsxRuntime.jsx)(_primitives.More,{paged:r})]})}const LEVEL_COLOR={error:_sharedUi.night.color.danger,warn:_sharedUi.night.color.warning,warning:_sharedUi.night.color.warning,info:_sharedUi.night.color.info};function LogList({block:e}){const n=(0,_primitives.usePaged)(e.entries,_agentCore.CAPS.listItems);const{visible:r}=n;return(0,_jsxRuntime.jsxs)(_primitives.Card,{title:"Console",source:e.source,testID:`buoy-block-logs-${e.id}`,children:[r.map((o,t)=>(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[_primitives.blockStyles.row,t>0&&_primitives.blockStyles.rowDivider,styles.logRow],children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:[_primitives.blockStyles.pill,{backgroundColor:`${LEVEL_COLOR[o.level]??_sharedUi.night.color.textTertiary}22`}],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[_primitives.blockStyles.pillText,{color:LEVEL_COLOR[o.level]??_sharedUi.night.color.textSecondary}],children:o.level.toUpperCase()})}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[_primitives.blockStyles.rowTitle,_primitives.blockStyles.mono],numberOfLines:3,children:o.message}),o.count>1?(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:_primitives.blockStyles.rowTrailing,children:["\xD7",o.count]}):null]},`${o.level}-${o.message}-${t}`)),(0,_jsxRuntime.jsx)(_primitives.More,{paged:n})]})}function Crash({block:e}){return(0,_jsxRuntime.jsxs)(_primitives.Card,{tone:"danger",testID:`buoy-block-crash-${e.id}`,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.crashHead,children:[(0,_jsxRuntime.jsx)(_sharedUi.AlertTriangle,{size:14,color:_sharedUi.night.color.danger}),(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.crashTitle,children:["The app crashed",e.route?` on ${e.route}`:""]})]}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[_primitives.blockStyles.mono,styles.crashMsg],numberOfLines:4,selectable:true,children:e.message}),e.suspect?(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.suspect,children:["Most likely cause: ",e.suspect.label]}):null,(0,_jsxRuntime.jsx)(_primitives.ActionRow,{blockId:e.id,actions:[...e.suspect?.action?[{...e.suspect.action,primary:true}]:[],...e.actions??[]].slice(0,2)})]})}function Peek({block:e}){const n=(0,_context.useBlockHandlers)();const r=n.supports?.minimize!==false;return(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{testID:`buoy-block-peek-${e.id}`,disabled:!r,onPress:()=>void n.runAction({label:"Look",minimize:true},e.id),style:({pressed:o})=>[styles.peek,o&&{opacity:.7}],accessibilityRole:"button",accessibilityLabel:`${e.label}. Look at the app`,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.peekText,children:e.label}),r?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.peekLook,children:[(0,_jsxRuntime.jsx)(_sharedUi.Eye,{size:12,color:_sharedUi.night.color.accent}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.peekLookText,children:"Look"})]}):null]})}const styles=_reactNative.StyleSheet.create({method:{color:_sharedUi.night.color.textSecondary,fontSize:_sharedUi.night.font.micro,fontWeight:"700",letterSpacing:.4,width:44},mockedChip:{color:_sharedUi.night.color.warning,backgroundColor:_sharedUi.night.color.warningSoft,fontSize:9,fontWeight:"700",letterSpacing:.6,paddingHorizontal:5,paddingVertical:1,borderRadius:_sharedUi.night.radius.badge,overflow:"hidden"},reqHead:{paddingTop:12},tabs:{paddingHorizontal:12,paddingTop:4,paddingBottom:8},tab:{paddingHorizontal:10,paddingVertical:5,borderRadius:_sharedUi.night.radius.badge,backgroundColor:_sharedUi.night.color.fill},tabOn:{backgroundColor:_sharedUi.night.color.accentSoft},tabText:{color:_sharedUi.night.color.textSecondary,fontSize:_sharedUi.night.font.micro,fontWeight:"600"},tabTextOn:{color:_sharedUi.night.color.accent},body:{paddingHorizontal:12,paddingBottom:4,lineHeight:16,color:_sharedUi.night.color.textSecondary},ruleBody:{paddingHorizontal:12,paddingTop:4,paddingBottom:4,gap:4},ruleLine:{color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.caption,lineHeight:18},ruleKey:{color:_sharedUi.night.color.textSecondary,fontWeight:"700"},on:{alignSelf:"flex-start",backgroundColor:_sharedUi.night.color.accent,marginTop:4},off:{alignSelf:"flex-start",backgroundColor:_sharedUi.night.color.fillTertiary,marginTop:4},chips:{flexDirection:"row",flexWrap:"wrap",gap:6,padding:12},chip:{paddingHorizontal:10,paddingVertical:6,borderRadius:_sharedUi.night.radius.chip,backgroundColor:_sharedUi.night.color.fill,borderWidth:_reactNative.StyleSheet.hairlineWidth,borderColor:_sharedUi.night.color.border},chipCurrent:{backgroundColor:_sharedUi.night.color.accentSoft,borderColor:_sharedUi.night.color.accentBorderStrong},chipText:{color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.caption,fontFamily:_reactNative.Platform.OS==="web"?_sharedUi.monoFont:"Menlo"},chipDynamic:{color:_sharedUi.night.color.textSecondary},logRow:{alignItems:"flex-start"},crashHead:{flexDirection:"row",alignItems:"center",gap:8,paddingHorizontal:12,paddingTop:12},crashTitle:{color:_sharedUi.night.color.danger,fontSize:_sharedUi.night.font.row,fontWeight:"600"},crashMsg:{paddingHorizontal:12,paddingTop:6,color:_sharedUi.night.color.text},suspect:{color:_sharedUi.night.color.textSecondary,fontSize:_sharedUi.night.font.caption,paddingHorizontal:12,paddingTop:6},peek:{alignSelf:"flex-start",flexDirection:"row",alignItems:"center",gap:10,paddingLeft:12,paddingRight:10,paddingVertical:7,borderRadius:_sharedUi.night.radius.chip,backgroundColor:_sharedUi.night.color.fill},peekText:{color:_sharedUi.night.color.textSecondary,fontSize:_sharedUi.night.font.caption},peekLook:{flexDirection:"row",alignItems:"center",gap:4},peekLookText:{color:_sharedUi.night.color.accent,fontSize:_sharedUi.night.font.caption,fontWeight:"600"}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.ActionRow=ActionRow;exports.Card=Card;exports.More=More;exports.MoreNote=MoreNote;exports.ProvenanceBadge=ProvenanceBadge;exports.blockStyles=void 0;exports.toneColor=toneColor;exports.usePaged=usePaged;var
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.ActionRow=ActionRow;exports.Card=Card;exports.More=More;exports.MoreNote=MoreNote;exports.ProvenanceBadge=ProvenanceBadge;exports.blockStyles=void 0;exports.toneColor=toneColor;exports.usePaged=usePaged;var _sharedUi=require("@buoy-gg/shared-ui");var _reactNative=require("react-native");var _react=require("react");var _context=require("./context");var _pageState=require("./pageState");var _jsxRuntime=require("react/jsx-runtime");function toneColor(e){switch(e){case"accent":return _sharedUi.night.color.accent;case"warning":return _sharedUi.night.color.warning;case"danger":return _sharedUi.night.color.danger;case"info":return _sharedUi.night.color.info;case"muted":return _sharedUi.night.color.textTertiary;default:return _sharedUi.night.color.text}}function ProvenanceBadge({source:e}){if(!e||e==="live")return null;const o=e==="changed"?"CHANGED BY ASK BUOY":e==="mocked"?"MOCKED":"FROM THE MODEL";const n=e==="changed"?_sharedUi.night.color.warning:e==="mocked"?_sharedUi.night.color.danger:_sharedUi.night.color.textTertiary;return(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.badge,{borderColor:n}],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.badgeText,{color:n}],children:o})})}function Card({title:e,source:o,children:n,testID:r,tone:l,collapsible:t,summary:i}){const[c,a]=(0,_react.useState)(false);const s=!!t&&!c;return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.card,l==="warning"&&styles.cardWarning,l==="danger"&&styles.cardDanger,l==="info"&&styles.cardInfo],testID:r,children:[(e||o&&o!=="live")&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.titleRow,children:[e?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.title,numberOfLines:2,children:e}):(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.flex}),(0,_jsxRuntime.jsx)(ProvenanceBadge,{source:o})]}),t?(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{testID:r?`${r}-toggle`:void 0,onPress:()=>a(d=>!d),accessibilityRole:"button",accessibilityState:{expanded:c},accessibilityLabel:`${i??"Details"}, ${c?"hide":"show"}`,style:({pressed:d})=>[styles.disclosure,!s&&styles.disclosureOpen,d&&styles.pressed],children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.disclosureText,numberOfLines:1,children:i??"Details"}),s?(0,_jsxRuntime.jsx)(_sharedUi.ChevronDown,{size:12,color:_sharedUi.night.color.textTertiary}):(0,_jsxRuntime.jsx)(_sharedUi.ChevronUp,{size:12,color:_sharedUi.night.color.textTertiary})]}):null,s?null:n]})}const PAGE_STEP=5;function usePaged(e,o,n=PAGE_STEP){const[r,l]=(0,_react.useState)(o);const{hidden:t,next:i,expanded:c,canExpand:a,canCollapse:s}=(0,_pageState.pageState)(e.length,o,r,n);return{visible:e.slice(0,r),hidden:t,next:i,expanded:c,showMore:a?()=>l(d=>d+n):void 0,showLess:s?()=>l(o):void 0}}function More({paged:e}){const{next:o,showMore:n,showLess:r}=e;if(!n&&!r)return null;return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.moreRow,children:[n?(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{testID:"buoy-block-show-more",onPress:n,style:[styles.more,styles.moreCell],accessibilityRole:"button",children:[(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.moreText,children:["Show ",o," more"]}),(0,_jsxRuntime.jsx)(_sharedUi.ChevronDown,{size:12,color:_sharedUi.night.color.textTertiary})]}):null,r?(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{testID:"buoy-block-show-fewer",onPress:r,style:[styles.more,styles.moreCell],accessibilityRole:"button",children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.moreText,children:"Show fewer"}),(0,_jsxRuntime.jsx)(_sharedUi.ChevronUp,{size:12,color:_sharedUi.night.color.textTertiary})]}):null]})}function MoreNote({shown:e,total:o}){if(!o||o<=e)return null;return(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.more,children:(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.moreNote,children:[e," of ",o," shown"]})})}function ActionRow({actions:e,blockId:o,align:n="left"}){const r=(0,_context.useBlockHandlers)();if(!e?.length)return null;const l=e.filter(t=>{if(t.openTool)return r.supports?.openTool!==false;if(t.minimize)return r.supports?.minimize!==false;if(t.dispatch)return r.supports?.dispatch!==false;return true});if(l.length===0)return null;return(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.actions,n==="right"&&styles.actionsRight],children:l.slice(0,2).map(t=>{const i=r.actionState?.[(0,_context.actionKey)(o,t)];const c=!!r.busy||i==="running"||i==="done";return(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{accessibilityRole:"button",accessibilityLabel:t.label,testID:`buoy-block-action-${t.label.toLowerCase().replace(/\s+/g,"-")}`,disabled:c,onPress:()=>void r.runAction(t,o),style:({pressed:a})=>[styles.button,t.primary?styles.buttonPrimary:styles.buttonPlate,c&&styles.buttonDisabled,a&&!c&&styles.pressed],children:[i==="running"?(0,_jsxRuntime.jsx)(_reactNative.ActivityIndicator,{size:"small",color:t.primary?_sharedUi.night.color.onAccent:_sharedUi.night.color.text}):i==="done"?(0,_jsxRuntime.jsx)(_sharedUi.Check,{size:12,color:t.primary?_sharedUi.night.color.onAccent:_sharedUi.night.color.accent}):i==="failed"?(0,_jsxRuntime.jsx)(_sharedUi.X,{size:12,color:_sharedUi.night.color.danger}):null,(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.buttonText,t.primary?styles.buttonTextPrimary:styles.buttonTextPlate],children:t.label})]},t.label)})})}const blockStyles=exports.blockStyles=_reactNative.StyleSheet.create({row:{flexDirection:"row",alignItems:"center",gap:10,paddingHorizontal:12,paddingVertical:9},rowDivider:{borderTopWidth:_reactNative.StyleSheet.hairlineWidth,borderTopColor:_sharedUi.night.color.separator},rowTitle:{flex:1,color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.body,lineHeight:19},rowSub:{color:_sharedUi.night.color.textSecondary,fontSize:_sharedUi.night.font.caption,lineHeight:17},rowTrailing:{color:_sharedUi.night.color.textTertiary,fontSize:_sharedUi.night.font.caption,maxWidth:120,textAlign:"right"},mono:{fontFamily:_reactNative.Platform.OS==="web"?_sharedUi.monoFont:"Menlo",fontSize:12,color:_sharedUi.night.color.text},pill:{paddingHorizontal:7,paddingVertical:2,borderRadius:_sharedUi.night.radius.badge,backgroundColor:_sharedUi.night.color.fill},pillText:{fontSize:_sharedUi.night.font.micro,fontWeight:"700",letterSpacing:.4,color:_sharedUi.night.color.textSecondary}});const styles=_reactNative.StyleSheet.create({card:{borderRadius:_sharedUi.night.radius.card,borderWidth:_reactNative.StyleSheet.hairlineWidth,borderColor:_sharedUi.night.color.border,backgroundColor:_sharedUi.night.color.surface,overflow:"hidden"},cardWarning:{borderColor:_sharedUi.night.color.warning,backgroundColor:_sharedUi.night.color.warningSoft},cardDanger:{borderColor:_sharedUi.night.color.danger,backgroundColor:_sharedUi.night.color.dangerSoft},cardInfo:{borderColor:_sharedUi.night.color.accentBorderStrong,backgroundColor:_sharedUi.night.color.accentSoft},titleRow:{flexDirection:"row",alignItems:"center",gap:8,paddingHorizontal:12,paddingTop:10,paddingBottom:6},flex:{flex:1},title:{flex:1,color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.caption,fontWeight:"600"},disclosure:{flexDirection:"row",alignItems:"center",gap:8,paddingHorizontal:12,paddingVertical:9},disclosureOpen:{borderBottomWidth:_reactNative.StyleSheet.hairlineWidth,borderBottomColor:_sharedUi.night.color.separator},disclosureText:{flex:1,color:_sharedUi.night.color.textSecondary,fontSize:_sharedUi.night.font.caption},badge:{borderWidth:_reactNative.StyleSheet.hairlineWidth,borderRadius:_sharedUi.night.radius.badge,paddingHorizontal:6,paddingVertical:2},badgeText:{fontSize:9,fontWeight:"700",letterSpacing:.6},moreRow:{flexDirection:"row"},more:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:4,paddingVertical:9,paddingHorizontal:8,borderTopWidth:_reactNative.StyleSheet.hairlineWidth,borderTopColor:_sharedUi.night.color.separator},moreCell:{flex:1},moreText:{color:_sharedUi.night.color.textSecondary,fontSize:_sharedUi.night.font.caption,fontWeight:"600"},moreNote:{color:_sharedUi.night.color.textTertiary,fontSize:_sharedUi.night.font.caption},actions:{flexDirection:"row",gap:8,paddingHorizontal:12,paddingVertical:10,flexWrap:"wrap"},actionsRight:{justifyContent:"flex-end"},button:{flexDirection:"row",alignItems:"center",gap:6,paddingHorizontal:14,paddingVertical:9,borderRadius:_sharedUi.night.radius.row},buttonPrimary:{backgroundColor:_sharedUi.night.color.accent},buttonPlate:{backgroundColor:_sharedUi.night.color.button},buttonDisabled:{opacity:.55},buttonText:{fontSize:_sharedUi.night.font.caption,fontWeight:"600"},buttonTextPrimary:{color:_sharedUi.night.color.onAccent},buttonTextPlate:{color:_sharedUi.night.color.text},pressed:{opacity:.7}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.EmptyState=EmptyState;var
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.EmptyState=EmptyState;var _sharedUi=require("@buoy-gg/shared-ui");var _reactNative=require("react-native");var _suggestions=require("../store/suggestions");var _jsxRuntime=require("react/jsx-runtime");const isRelease=typeof __DEV__!=="undefined"&&!__DEV__;function EmptyState({configured:e,onPick:t,availableToolIds:o=[],readOnly:i=false}){const r=(0,_suggestions.pickSuggestions)({availableToolIds:o,readOnly:i,isRelease});if(!e){return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.wrap,testID:"buoy-ask-buoy-unconfigured",children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.title,children:"Not set up yet"}),(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.body,children:["Ask Buoy talks to your own company's AI endpoint \u2014 nothing goes to Buoy. A developer needs to add the ",(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.code,children:"askBuoy"})," prop to"," ",(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.code,children:"<FloatingDevTools />"})," with your team's endpoint and model."]})]})}return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.wrap,testID:"buoy-ask-buoy-empty",children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.title,children:"Ask about this app"}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.body,children:"Ask what the app is doing right now, or tell it to change something. Anything it changes shows up in a bar at the top, with what can be undone."}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.buildLine,testID:"buoy-ask-buoy-build-line",children:isRelease?"Release build \u2014 reading, impersonation and navigation work; simulations (forcing server responses, driving the screen) need a dev build.":"Dev build \u2014 full simulation available."}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.group,children:[(0,_jsxRuntime.jsx)(_sharedUi.NightSectionLabel,{children:"Try asking"}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.card,children:r.map((n,s)=>(0,_jsxRuntime.jsx)(Suggestion,{text:n,onPick:t,last:s===r.length-1},n))})]})]})}function Suggestion({text:e,onPick:t,last:o}){return(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{testID:`buoy-ask-buoy-suggestion-${e.slice(0,12)}`,accessibilityRole:"button",onPress:()=>t(e),style:({pressed:i})=>[styles.row,!o&&styles.rowDivider,i&&styles.pressed],children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.rowText,children:e}),(0,_jsxRuntime.jsx)(_sharedUi.ChevronRight,{size:14,color:_sharedUi.night.color.textTertiary})]})}const styles=_reactNative.StyleSheet.create({wrap:{flex:1,justifyContent:"center",paddingHorizontal:_sharedUi.night.gutter,paddingVertical:24,gap:8},title:{color:_sharedUi.night.color.text,fontSize:22,fontWeight:"700",letterSpacing:-.3},body:{color:_sharedUi.night.color.textSecondary,fontSize:_sharedUi.night.font.body,lineHeight:20},code:{color:_sharedUi.night.color.text,fontFamily:_reactNative.Platform.OS==="web"?_sharedUi.monoFont:"Menlo"},buildLine:{marginTop:8,color:_sharedUi.night.color.textTertiary,fontSize:_sharedUi.night.font.micro,lineHeight:15},group:{marginTop:_sharedUi.night.groupGap-8},card:{borderRadius:_sharedUi.night.radius.card,borderWidth:_reactNative.StyleSheet.hairlineWidth,borderColor:_sharedUi.night.color.border,backgroundColor:_sharedUi.night.color.surface,overflow:"hidden"},row:{flexDirection:"row",alignItems:"center",gap:10,paddingHorizontal:_sharedUi.night.rowPadH,paddingVertical:13},rowDivider:{borderBottomWidth:_reactNative.StyleSheet.hairlineWidth,borderBottomColor:_sharedUi.night.color.separator},rowText:{flex:1,color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.body,lineHeight:19},pressed:{backgroundColor:_sharedUi.night.color.fill}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.Markdown=Markdown;exports.renderInline=renderInline;var
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.Markdown=Markdown;exports.renderInline=renderInline;var _sharedUi=require("@buoy-gg/shared-ui");var _reactNative=require("react-native");var _react=require("react");var _markdownParse=require("./markdownParse");var _jsxRuntime=require("react/jsx-runtime");function renderInline(l,o){const t=l.replace(/!?\[([^\]]*)\]\([^)]*\)/g,"$1");const e=[];const i=/(\*\*[^*]+\*\*|`[^`]+`|\*[^*\s][^*]*\*|_[^_\s][^_]*_)/g;let n=0;let c;let s=0;while(c=i.exec(t)){if(c.index>n)e.push(t.slice(n,c.index));const r=c[0];if(r.startsWith("**")){e.push((0,_jsxRuntime.jsx)(_reactNative.Text,{style:[o,styles.bold],children:r.slice(2,-2)},s++))}else if(r.startsWith("`")){e.push((0,_jsxRuntime.jsx)(_reactNative.Text,{style:[o,styles.code],children:r.slice(1,-1)},s++))}else{e.push((0,_jsxRuntime.jsx)(_reactNative.Text,{style:[o,styles.italic],children:r.slice(1,-1)},s++))}n=c.index+r.length}if(n<t.length)e.push(t.slice(n));return e}const stripLinks=l=>l.replace(/!?\[([^\]]*)\]\([^)]*\)/g,"$1");function MarkdownTable({header:l,rows:o}){const[t,e]=(0,_react.useState)(false);const i=(0,_markdownParse.tableTruncation)(l,o);const n=t?l:l.slice(0,_markdownParse.TABLE_PREVIEW_COLS);const c=t?o:o.slice(0,_markdownParse.TABLE_PREVIEW_ROWS);const s=(0,_jsxRuntime.jsxs)(_reactNative.View,{style:t&&styles.tableWide,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.tableHead,children:n.map((r,d)=>(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.th,d===0&&styles.firstCol,t&&styles.colFixed],numberOfLines:1,children:r.replace(/\*\*/g,"")},d))}),c.map((r,d)=>(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.tr,d>0&&styles.trDivider],children:n.map((h,a)=>(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.td,a===0&&styles.firstCol,a===0&&styles.tdFirst,t&&styles.colFixed],numberOfLines:t?3:2,children:renderInline(stripLinks(r[a]??""),styles.td)},a))},d))]});return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.table,testID:"buoy-ask-buoy-md-table",children:[t?(0,_jsxRuntime.jsx)(_reactNative.ScrollView,{style:styles.tableScrollV,nestedScrollEnabled:true,children:(0,_jsxRuntime.jsx)(_reactNative.ScrollView,{horizontal:true,showsHorizontalScrollIndicator:true,children:s})}):s,i?(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{testID:"buoy-ask-buoy-md-table-toggle",accessibilityRole:"button",accessibilityLabel:t?"Show fewer rows":"Show all rows and columns",onPress:()=>e(r=>!r),style:({pressed:r})=>[styles.tfoot,r&&styles.pressed],children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.tfootText,children:t?`All ${o.length} rows \xB7 ${l.length} columns`:i}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.tfootAction,children:t?"Show fewer":"Show all"})]}):null]})}function Markdown({text:l,style:o}){const t=(0,_markdownParse.parseBlocks)(l);return(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.wrap,children:t.map((e,i)=>{if(e.kind==="table")return(0,_jsxRuntime.jsx)(MarkdownTable,{header:e.header,rows:e.rows},i);if(e.kind==="code"){return(0,_jsxRuntime.jsx)(_reactNative.ScrollView,{horizontal:true,style:styles.codeBlock,contentContainerStyle:styles.codeBlockContent,testID:"buoy-ask-buoy-md-code",children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.codeText,selectable:true,children:e.text})},i)}if(e.kind==="li"){return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.li,{paddingLeft:4+e.depth*14}],children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[o,styles.marker],children:e.marker}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[o,styles.liText],selectable:true,children:renderInline(e.text,o)})]},i)}return(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[o,e.kind==="h"&&styles.bold],selectable:true,children:renderInline(e.text,o)},i)})})}const styles=_reactNative.StyleSheet.create({wrap:{gap:8},bold:{fontWeight:"600"},italic:{fontStyle:"italic"},code:{fontFamily:_reactNative.Platform.OS==="web"?_sharedUi.monoFont:"Menlo",fontSize:13,color:_sharedUi.night.color.accent,backgroundColor:_sharedUi.night.color.fill},codeBlock:{borderRadius:_sharedUi.night.radius.row,borderWidth:_reactNative.StyleSheet.hairlineWidth,borderColor:_sharedUi.night.color.border,backgroundColor:_sharedUi.night.color.surface},codeBlockContent:{paddingHorizontal:12,paddingVertical:10},codeText:{fontFamily:_reactNative.Platform.OS==="web"?_sharedUi.monoFont:"Menlo",fontSize:12,lineHeight:18,color:_sharedUi.night.color.text},li:{flexDirection:"row",gap:8},table:{borderRadius:_sharedUi.night.radius.row,borderWidth:_reactNative.StyleSheet.hairlineWidth,borderColor:_sharedUi.night.color.border,backgroundColor:_sharedUi.night.color.surface,overflow:"hidden"},tableWide:{minWidth:"100%"},tableScrollV:{maxHeight:320},tableHead:{flexDirection:"row",paddingHorizontal:10,paddingVertical:6,gap:8,backgroundColor:_sharedUi.night.color.fill},th:{flex:1,color:_sharedUi.night.color.textTertiary,fontSize:_sharedUi.night.font.micro,fontWeight:"700",letterSpacing:.6,textTransform:"uppercase"},tr:{flexDirection:"row",paddingHorizontal:10,paddingVertical:7,gap:8},trDivider:{borderTopWidth:_reactNative.StyleSheet.hairlineWidth,borderTopColor:_sharedUi.night.color.separator},td:{flex:1,color:_sharedUi.night.color.textSecondary,fontSize:_sharedUi.night.font.caption,lineHeight:17},tdFirst:{color:_sharedUi.night.color.text,fontWeight:"500"},firstCol:{flex:1.3},colFixed:{flex:0,width:110},tfoot:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingHorizontal:10,paddingVertical:8,borderTopWidth:_reactNative.StyleSheet.hairlineWidth,borderTopColor:_sharedUi.night.color.border},tfootText:{color:_sharedUi.night.color.textSecondary,fontSize:_sharedUi.night.font.micro},tfootAction:{color:_sharedUi.night.color.accent,fontSize:_sharedUi.night.font.micro,fontWeight:"600"},pressed:{opacity:.7},marker:{color:_sharedUi.night.color.textSecondary,minWidth:14,textAlign:"right"},liText:{flex:1}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{useEffect as
|
|
1
|
+
"use strict";import{monoFont as m}from"@buoy-gg/shared-ui";import{Platform as z}from"react-native";import{useEffect as S,useState as p}from"react";import{ActivityIndicator as b,Pressable as u,StyleSheet as h,Text as i,TextInput as y,View as s}from"react-native";import{ChevronDown as C,ChevronRight as w,Copy as T,night as e,RefreshCw as P}from"@buoy-gg/shared-ui";import{useBlockHandlers as x}from"./context";import{jsx as t,jsxs as a}from"react/jsx-runtime";function g({label:r,onPress:d,children:l}){return t(u,{onPress:d,accessibilityRole:"button",accessibilityLabel:r,style:({pressed:n})=>[o.iconBtn,n&&o.pressed],children:l})}export function MessageActions({id:r="chrome-actions"}){const d=x();const[l,n]=p(null);const c=f=>void d.runAction({label:f,send:`__chrome__:${f}`},r);return a(s,{style:o.actions,testID:"chrome-message-actions",children:[t(g,{label:"Copy",onPress:()=>c("copy"),children:t(T,{size:13,color:e.color.textSecondary})}),t(g,{label:"Retry",onPress:()=>c("retry"),children:t(P,{size:13,color:e.color.textSecondary})}),t(g,{label:"Good answer",onPress:()=>{n("up");c("thumbs up")},children:t(i,{style:[o.glyph,l==="up"&&o.glyphOn],children:"\u{1F44D}"})}),t(g,{label:"Bad answer",onPress:()=>{n("down");c("thumbs down")},children:t(i,{style:[o.glyph,l==="down"&&o.glyphOn],children:"\u{1F44E}"})}),t(g,{label:"Export",onPress:()=>c("export transcript"),children:t(i,{style:o.textBtn,children:"Export"})})]})}export function ReasoningStrip({text:r,live:d}){const[l,n]=p(false);return a(s,{style:o.reasoning,testID:"chrome-reasoning",children:[a(u,{onPress:()=>n(c=>!c),style:o.reasoningHead,accessibilityRole:"button",accessibilityState:{expanded:l},children:[d?t(b,{size:"small",color:e.color.textTertiary}):null,t(i,{style:o.reasoningTitle,children:d?"Working it out\u2026":"How I got here"}),l?t(C,{size:12,color:e.color.textTertiary}):t(w,{size:12,color:e.color.textTertiary})]}),l?t(i,{style:o.reasoningBody,children:r}):null]})}export function ElapsedRow({label:r}){const[d,l]=p(0);S(()=>{const n=setInterval(()=>l(c=>c+250),250);return()=>clearInterval(n)},[]);return a(s,{style:o.elapsed,testID:"chrome-elapsed",children:[t(b,{size:"small",color:e.color.textSecondary}),t(i,{style:o.elapsedLabel,children:r}),a(i,{style:o.elapsedMs,children:[(d/1e3).toFixed(1),"s"]})]})}export function QueuedComposer(){const[r,d]=p("");const[l,n]=p(null);return a(s,{style:o.composerWrap,testID:"chrome-queue",children:[l?a(s,{style:o.queuedRow,children:[a(i,{style:o.queuedText,numberOfLines:1,children:['Queued: "',l,'"']}),t(u,{onPress:()=>n(null),children:t(i,{style:o.queuedCancel,children:"Cancel"})})]}):null,a(s,{style:o.composer,children:[t(y,{style:o.composerInput,value:r,onChangeText:d,placeholder:"Agent is busy \u2014 type and it sends next",placeholderTextColor:e.color.placeholder}),t(u,{disabled:!r.trim(),onPress:()=>{n(r.trim());d("")},style:[o.queueBtn,!r.trim()&&{opacity:.5}],children:t(i,{style:o.queueBtnText,children:"Queue"})})]})]})}export function ReloadDivider({at:r}){return a(s,{style:o.divider,testID:"chrome-divider",children:[t(s,{style:o.dividerLine}),a(i,{style:o.dividerText,children:["App reloaded \xB7 ",r]}),t(s,{style:o.dividerLine})]})}export function Timestamp({at:r}){return t(i,{style:o.timestamp,children:r})}export function EditableUserBubble({text:r}){const d=x();const[l,n]=p(false);const[c,f]=p(r);return t(s,{style:o.userWrap,testID:"chrome-edit-bubble",children:l?a(s,{style:o.editBox,children:[t(y,{style:o.editInput,value:c,onChangeText:f,multiline:true}),a(s,{style:o.editActions,children:[t(u,{onPress:()=>{n(false);void d.runAction({label:"re-run edited",send:`__chrome__:re-run "${c}"`},"chrome-edit")},style:o.editPrimary,children:t(i,{style:o.editPrimaryText,children:"Re-run from here"})}),t(u,{onPress:()=>{n(false);void d.runAction({label:"branch",send:`__chrome__:branch "${c}"`},"chrome-edit")},style:o.editPlate,children:t(i,{style:o.editPlateText,children:"Branch"})}),t(u,{onPress:()=>n(false),style:o.editPlate,children:t(i,{style:o.editPlateText,children:"Cancel"})})]})]}):a(u,{onLongPress:()=>n(true),onPress:()=>n(true),style:o.bubble,accessibilityRole:"button",accessibilityLabel:"Edit message",children:[t(i,{style:o.bubbleText,children:c}),t(i,{style:o.bubbleHint,children:"tap to edit \xB7 2 branches"})]})})}const o=h.create({actions:{flexDirection:"row",alignItems:"center",gap:4,paddingHorizontal:2},iconBtn:{paddingHorizontal:8,paddingVertical:6,borderRadius:e.radius.badge},pressed:{backgroundColor:e.color.fill},glyph:{fontSize:13,opacity:.6},glyphOn:{opacity:1},textBtn:{color:e.color.textSecondary,fontSize:e.font.micro,fontWeight:"600"},reasoning:{borderRadius:e.radius.row,backgroundColor:e.color.fill,overflow:"hidden"},reasoningHead:{flexDirection:"row",alignItems:"center",gap:8,paddingHorizontal:12,paddingVertical:8},reasoningTitle:{flex:1,color:e.color.textSecondary,fontSize:e.font.caption,fontStyle:"italic"},reasoningBody:{color:e.color.textSecondary,fontSize:e.font.caption,lineHeight:18,paddingHorizontal:12,paddingBottom:10},elapsed:{flexDirection:"row",alignItems:"center",gap:10,paddingHorizontal:12,paddingVertical:10,borderRadius:e.radius.card,borderWidth:h.hairlineWidth,borderColor:e.color.border,backgroundColor:e.color.surface},elapsedLabel:{flex:1,color:e.color.text,fontSize:e.font.body},elapsedMs:{color:e.color.textTertiary,fontSize:e.font.caption,fontFamily:z.OS==="web"?m:"Menlo"},composerWrap:{gap:6},queuedRow:{flexDirection:"row",alignItems:"center",gap:8,paddingHorizontal:12,paddingVertical:6,borderRadius:e.radius.row,backgroundColor:e.color.infoSoft},queuedText:{flex:1,color:e.color.text,fontSize:e.font.caption},queuedCancel:{color:e.color.info,fontSize:e.font.caption,fontWeight:"600"},composer:{flexDirection:"row",alignItems:"center",gap:8},composerInput:{flex:1,height:40,paddingHorizontal:16,borderRadius:20,borderWidth:h.hairlineWidth,borderColor:e.color.border,backgroundColor:e.color.surfaceElevated,color:e.color.text,fontSize:e.font.body},queueBtn:{paddingHorizontal:14,height:40,borderRadius:20,backgroundColor:e.color.button,alignItems:"center",justifyContent:"center"},queueBtnText:{color:e.color.text,fontSize:e.font.caption,fontWeight:"600"},divider:{flexDirection:"row",alignItems:"center",gap:10,paddingVertical:4},dividerLine:{flex:1,height:h.hairlineWidth,backgroundColor:e.color.border},dividerText:{color:e.color.textTertiary,fontSize:e.font.micro},timestamp:{alignSelf:"center",color:e.color.textTertiary,fontSize:e.font.micro},userWrap:{alignItems:"flex-end"},bubble:{maxWidth:"84%",paddingHorizontal:14,paddingVertical:9,borderRadius:18,borderBottomRightRadius:6,backgroundColor:e.color.accentFill,borderWidth:h.hairlineWidth,borderColor:e.color.accentBorder,gap:4},bubbleText:{color:e.color.text,fontSize:e.font.row,lineHeight:21},bubbleHint:{color:e.color.textTertiary,fontSize:10,textAlign:"right"},editBox:{width:"100%",gap:8},editInput:{minHeight:60,padding:12,borderRadius:e.radius.row,backgroundColor:e.color.surfaceElevated,color:e.color.text,fontSize:e.font.row,borderWidth:h.hairlineWidth,borderColor:e.color.accentBorderStrong},editActions:{flexDirection:"row",gap:8,justifyContent:"flex-end",flexWrap:"wrap"},editPrimary:{paddingHorizontal:12,paddingVertical:8,borderRadius:e.radius.row,backgroundColor:e.color.accent},editPrimaryText:{color:e.color.onAccent,fontSize:e.font.caption,fontWeight:"600"},editPlate:{paddingHorizontal:12,paddingVertical:8,borderRadius:e.radius.row,backgroundColor:e.color.button},editPlateText:{color:e.color.text,fontSize:e.font.caption,fontWeight:"600"}});
|