@bikdotai/bik-component-library 0.0.823 → 0.0.824-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/adbanner/AdBanner.js.map +1 -0
- package/dist/cjs/components/{banner → adbanner}/Banner.styled.js +13 -9
- package/dist/cjs/components/adbanner/Banner.styled.js.map +1 -0
- package/dist/cjs/components/adbanner/BannerInline.js.map +1 -0
- package/dist/cjs/components/adbanner/BannerWithImage.js.map +1 -0
- package/dist/cjs/components/adbanner/CardBanner.js.map +1 -0
- package/dist/cjs/components/adbanner/CardBannerWithImage.js.map +1 -0
- package/dist/cjs/components/adbanner/model.js.map +1 -0
- package/dist/cjs/editor/BikEditor.js +1 -1
- package/dist/cjs/editor/BikEditor.js.map +1 -1
- package/dist/cjs/editor/BikEditor.styles.js +122 -2
- package/dist/cjs/editor/BikEditor.styles.js.map +1 -1
- package/dist/cjs/editor/BikEditor.types.js.map +1 -1
- package/dist/cjs/editor/BikEditor.utils.js +3 -2
- package/dist/cjs/editor/BikEditor.utils.js.map +1 -1
- package/dist/cjs/editor/extensions/buildExtensions.js +3 -1
- package/dist/cjs/editor/extensions/buildExtensions.js.map +1 -1
- package/dist/cjs/editor/extensions/jsonHighlight/JsonHighlightExtension.js +3 -0
- package/dist/cjs/editor/extensions/jsonHighlight/JsonHighlightExtension.js.map +1 -0
- package/dist/cjs/editor/extensions/jsonHighlight/tokenizeJson.js +2 -0
- package/dist/cjs/editor/extensions/jsonHighlight/tokenizeJson.js.map +1 -0
- package/dist/cjs/icons/BIK AI specific/WandSparkles.js +2 -0
- package/dist/cjs/icons/BIK AI specific/WandSparkles.js.map +1 -0
- package/dist/cjs/icons/index.js +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/esm/components/adbanner/AdBanner.js.map +1 -0
- package/dist/esm/components/{banner → adbanner}/Banner.styled.js +18 -14
- package/dist/esm/components/adbanner/Banner.styled.js.map +1 -0
- package/dist/esm/components/adbanner/BannerInline.js.map +1 -0
- package/dist/esm/components/adbanner/BannerWithImage.js.map +1 -0
- package/dist/esm/components/adbanner/CardBanner.js.map +1 -0
- package/dist/esm/components/adbanner/CardBannerWithImage.js.map +1 -0
- package/dist/esm/components/adbanner/model.js.map +1 -0
- package/dist/esm/editor/BikEditor.js +254 -181
- package/dist/esm/editor/BikEditor.js.map +1 -1
- package/dist/esm/editor/BikEditor.styles.d.ts +9 -0
- package/dist/esm/editor/BikEditor.styles.js +128 -6
- package/dist/esm/editor/BikEditor.styles.js.map +1 -1
- package/dist/esm/editor/BikEditor.types.d.ts +76 -0
- package/dist/esm/editor/BikEditor.types.js.map +1 -1
- package/dist/esm/editor/BikEditor.utils.d.ts +15 -1
- package/dist/esm/editor/BikEditor.utils.js +155 -92
- package/dist/esm/editor/BikEditor.utils.js.map +1 -1
- package/dist/esm/editor/extensions/buildExtensions.d.ts +1 -1
- package/dist/esm/editor/extensions/buildExtensions.js +86 -55
- package/dist/esm/editor/extensions/buildExtensions.js.map +1 -1
- package/dist/esm/editor/extensions/jsonHighlight/JsonHighlightExtension.d.ts +14 -0
- package/dist/esm/editor/extensions/jsonHighlight/JsonHighlightExtension.js +64 -0
- package/dist/esm/editor/extensions/jsonHighlight/JsonHighlightExtension.js.map +1 -0
- package/dist/esm/editor/extensions/jsonHighlight/tokenizeJson.d.ts +18 -0
- package/dist/esm/editor/extensions/jsonHighlight/tokenizeJson.js +21 -0
- package/dist/esm/editor/extensions/jsonHighlight/tokenizeJson.js.map +1 -0
- package/dist/esm/editor/index.d.ts +1 -1
- package/dist/esm/icons/BIK AI specific/WandSparkles.d.ts +7 -0
- package/dist/esm/icons/BIK AI specific/WandSparkles.js +39 -0
- package/dist/esm/icons/BIK AI specific/WandSparkles.js.map +1 -0
- package/dist/esm/icons/BIK AI specific/index.d.ts +1 -0
- package/dist/esm/icons/index.d.ts +1 -1
- package/dist/esm/icons/index.js +18 -16
- package/dist/esm/icons/index.js.map +1 -1
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +2 -2
- package/package.json +1 -1
- package/dist/cjs/components/banner/AdBanner.js.map +0 -1
- package/dist/cjs/components/banner/Banner.styled.js.map +0 -1
- package/dist/cjs/components/banner/BannerInline.js.map +0 -1
- package/dist/cjs/components/banner/BannerWithImage.js.map +0 -1
- package/dist/cjs/components/banner/CardBanner.js.map +0 -1
- package/dist/cjs/components/banner/CardBannerWithImage.js.map +0 -1
- package/dist/cjs/components/banner/model.js.map +0 -1
- package/dist/esm/components/banner/AdBanner.js.map +0 -1
- package/dist/esm/components/banner/Banner.stories.d.ts +0 -39
- package/dist/esm/components/banner/Banner.styled.js.map +0 -1
- package/dist/esm/components/banner/BannerInline.js.map +0 -1
- package/dist/esm/components/banner/BannerWithImage.js.map +0 -1
- package/dist/esm/components/banner/CardBanner.js.map +0 -1
- package/dist/esm/components/banner/CardBannerWithImage.js.map +0 -1
- package/dist/esm/components/banner/model.js.map +0 -1
- /package/dist/cjs/components/{banner → adbanner}/AdBanner.js +0 -0
- /package/dist/cjs/components/{banner → adbanner}/BannerInline.js +0 -0
- /package/dist/cjs/components/{banner → adbanner}/BannerWithImage.js +0 -0
- /package/dist/cjs/components/{banner → adbanner}/CardBanner.js +0 -0
- /package/dist/cjs/components/{banner → adbanner}/CardBannerWithImage.js +0 -0
- /package/dist/cjs/components/{banner → adbanner}/model.js +0 -0
- /package/dist/esm/components/{banner → adbanner}/AdBanner.d.ts +0 -0
- /package/dist/esm/components/{banner → adbanner}/AdBanner.js +0 -0
- /package/dist/esm/components/{banner → adbanner}/Banner.styled.d.ts +0 -0
- /package/dist/esm/components/{banner → adbanner}/BannerInline.d.ts +0 -0
- /package/dist/esm/components/{banner → adbanner}/BannerInline.js +0 -0
- /package/dist/esm/components/{banner → adbanner}/BannerWithImage.d.ts +0 -0
- /package/dist/esm/components/{banner → adbanner}/BannerWithImage.js +0 -0
- /package/dist/esm/components/{banner → adbanner}/CardBanner.d.ts +0 -0
- /package/dist/esm/components/{banner → adbanner}/CardBanner.js +0 -0
- /package/dist/esm/components/{banner → adbanner}/CardBannerWithImage.d.ts +0 -0
- /package/dist/esm/components/{banner → adbanner}/CardBannerWithImage.js +0 -0
- /package/dist/esm/components/{banner → adbanner}/index.d.ts +0 -0
- /package/dist/esm/components/{banner → adbanner}/model.d.ts +0 -0
- /package/dist/esm/components/{banner → adbanner}/model.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AdBanner.js","sources":["../../../../src/components/adbanner/AdBanner.tsx"],"sourcesContent":["import React from 'react';\nimport BannerInline from './BannerInline';\nimport BannerWithImage from './BannerWithImage';\nimport CardBanner from './CardBanner';\nimport CardBannerWithImage from './CardBannerWithImage';\nimport { AdBannerProps, BannerType } from './model';\n\nconst AdBanner: React.FC<AdBannerProps> = (props) => {\n\tswitch (props.bannerType) {\n\t\tcase BannerType.CARD_BANNER:\n\t\t\treturn <CardBanner {...props} />;\n\t\tcase BannerType.CARD_BANNER_WITH_IMAGE:\n\t\t\treturn <CardBannerWithImage {...props} />;\n\t\tcase BannerType.BANNER_INLINE:\n\t\t\treturn <BannerInline {...props} />;\n\t\tcase BannerType.BANNER_WITH_IMAGE:\n\t\t\treturn <BannerWithImage {...props} />;\n\t\tdefault:\n\t\t\treturn null;\n\t}\n};\n\nexport default AdBanner;\n"],"names":["AdBanner","props","BannerType","jsx","CardBanner","CardBannerWithImage","BannerInline","BannerWithImage"],"mappings":"6SAOMA,EAAqCC,GAAU,CACpD,OAAQA,EAAM,WAAA,CACb,KAAKC,EAAAA,WAAW,YACf,OAAOC,MAACC,EAAAA,QAAA,CAAY,GAAGH,CAAA,CAAO,EAC/B,KAAKC,EAAAA,WAAW,uBACf,OAAOC,MAACE,EAAAA,QAAA,CAAqB,GAAGJ,CAAA,CAAO,EACxC,KAAKC,EAAAA,WAAW,cACf,OAAOC,MAACG,EAAAA,QAAA,CAAc,GAAGL,CAAA,CAAO,EACjC,KAAKC,EAAAA,WAAW,kBACf,OAAOC,MAACI,EAAAA,QAAA,CAAiB,GAAGN,CAAA,CAAO,EACpC,QACC,OAAO,IAAA,CAEV"}
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
width: 100%;
|
|
37
37
|
height: auto;
|
|
38
38
|
}
|
|
39
|
-
`,
|
|
39
|
+
`,x=e.default.div`
|
|
40
40
|
width: 100%;
|
|
41
41
|
height: auto;
|
|
42
42
|
max-height: 303px;
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
border: 1px solid ${a.COLORS.stroke.primary};
|
|
49
49
|
background-color: #fff;
|
|
50
50
|
overflow: hidden;
|
|
51
|
-
`,
|
|
51
|
+
`,u=e.default.div`
|
|
52
52
|
width: 100%;
|
|
53
53
|
height: 72px;
|
|
54
54
|
display: flex;
|
|
@@ -56,8 +56,9 @@
|
|
|
56
56
|
justify-content: space-between;
|
|
57
57
|
padding: 16px;
|
|
58
58
|
gap: 16px;
|
|
59
|
-
`,
|
|
59
|
+
`,g=e.default(n)``,c=e.default(r)``,h=e.default.div`
|
|
60
60
|
width: 100%;
|
|
61
|
+
box-sizing: border-box;
|
|
61
62
|
padding: 16px;
|
|
62
63
|
border: 1px solid ${a.COLORS.stroke.brandLightAlt};
|
|
63
64
|
border-radius: 8px;
|
|
@@ -70,19 +71,20 @@
|
|
|
70
71
|
flex-direction: column;
|
|
71
72
|
gap: 16px;
|
|
72
73
|
flex-grow: 1;
|
|
74
|
+
min-width: 0;
|
|
73
75
|
`,W=e.default.div`
|
|
74
76
|
display: flex;
|
|
75
77
|
flex-direction: column;
|
|
76
78
|
gap: 4px;
|
|
77
|
-
`,
|
|
79
|
+
`,b=e.default.div`
|
|
78
80
|
display: flex;
|
|
79
81
|
gap: 8px;
|
|
80
|
-
`,
|
|
82
|
+
`,C=e.default.div`
|
|
81
83
|
width: fit-content;
|
|
82
84
|
display: flex;
|
|
83
85
|
align-items: end;
|
|
84
86
|
gap: 8px;
|
|
85
|
-
`,
|
|
87
|
+
`,B=e.default.div`
|
|
86
88
|
width: 100%;
|
|
87
89
|
height: 170px;
|
|
88
90
|
display: flex;
|
|
@@ -90,14 +92,16 @@
|
|
|
90
92
|
justify-content: space-between;
|
|
91
93
|
border: 1px solid #e0e0e0;
|
|
92
94
|
border-radius: 8px;
|
|
93
|
-
background-color: ${a.COLORS.background.
|
|
95
|
+
background-color: ${a.COLORS.background.brandVeryLight};
|
|
94
96
|
`,y=e.default.div`
|
|
95
97
|
display: flex;
|
|
96
98
|
flex-direction: column;
|
|
97
99
|
gap: 24px;
|
|
98
|
-
flex
|
|
100
|
+
flex: 0 0 50%;
|
|
101
|
+
max-width: 50%;
|
|
99
102
|
padding: 24px;
|
|
100
103
|
z-index: 1;
|
|
104
|
+
box-sizing: border-box;
|
|
101
105
|
`,v=e.default.div`
|
|
102
106
|
height: 170px;
|
|
103
107
|
position: relative;
|
|
@@ -114,5 +118,5 @@
|
|
|
114
118
|
button {
|
|
115
119
|
border-radius: 32px;
|
|
116
120
|
}
|
|
117
|
-
`;exports.BannerContainer=h;exports.BannerImageWrapper=v;exports.BannerWithImageButtonWrapper=w;exports.BannerWithImageContainer=
|
|
121
|
+
`;exports.BannerContainer=h;exports.BannerImageWrapper=v;exports.BannerWithImageButtonWrapper=w;exports.BannerWithImageContainer=B;exports.BottomButtonWrapper=C;exports.ButtonWrapper=r;exports.CardBannerButtonWrapper=s;exports.CardBannerContent=o;exports.CardBannerIconsWrapper=l;exports.CardBannerWrapper=i;exports.CardButtonWrapper=c;exports.CardFooterWrapper=u;exports.CardImageWrapper=g;exports.CardWrapper=x;exports.CompanyImageWrapper=f;exports.ContentWrapper=y;exports.ImageWrapper=n;exports.MainContentWrapper=m;exports.TagWrapper=b;exports.TextWrapper=W;
|
|
118
122
|
//# sourceMappingURL=Banner.styled.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Banner.styled.js","sources":["../../../../src/components/adbanner/Banner.styled.tsx"],"sourcesContent":["import styled from 'styled-components';\nimport { COLORS } from '../../constants/Theme';\n\nexport const CardBannerWrapper = styled.div`\n\tborder: 1px solid #e0e0e0;\n\tborder-radius: 8px;\n\tbackground: rgba(239, 230, 249, 0.2);\n\tpadding: 24px;\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 12px;\n`;\n\nexport const CardBannerContent = styled.div`\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 8px;\n`;\n\nexport const CardBannerIconsWrapper = styled.div`\n\tdisplay: flex;\n\tgap: 8px;\n`;\n\nexport const CardBannerButtonWrapper = styled.div`\n\tdisplay: flex;\n\tgap: 8px;\n\tmargin-top: 16px;\n`;\n\n// ==================== Common Shared Styles ====================\nexport const CompanyImageWrapper = styled.div`\n\twidth: 40px;\n\taspect-ratio: 1;\n\toverflow: hidden;\n\tflex-shrink: 0;\n\timg {\n\t\twidth: 100%;\n\t\theight: auto;\n\t\tborder-radius: 8px;\n\t}\n`;\n\nexport const ButtonWrapper = styled.div`\n\twidth: fit-content;\n`;\n\nexport const ImageWrapper = styled.div`\n\twidth: 100%;\n\theight: auto;\n\timg {\n\t\twidth: 100%;\n\t\theight: auto;\n\t}\n`;\n\n// ==================== CardBanner Styles ====================\nexport const CardWrapper = styled.div`\n\twidth: 100%;\n\theight: auto;\n\tmax-height: 303px;\n\tmax-width: 440px;\n\tborder-radius: 8px;\n\tdisplay: flex;\n\tflex-direction: column;\n\talign-items: center;\n\tborder: 1px solid ${COLORS.stroke.primary};\n\tbackground-color: #fff;\n\toverflow: hidden;\n`;\n\nexport const CardFooterWrapper = styled.div`\n\twidth: 100%;\n\theight: 72px;\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: space-between;\n\tpadding: 16px;\n\tgap: 16px;\n`;\n\nexport const CardImageWrapper = styled(ImageWrapper)``;\n\nexport const CardButtonWrapper = styled(ButtonWrapper)``;\n\n// ==================== BannerInline Styles ====================\nexport const BannerContainer = styled.div`\n\twidth: 100%;\n\tbox-sizing: border-box;\n\tpadding: 16px;\n\tborder: 1px solid ${COLORS.stroke.brandLightAlt};\n\tborder-radius: 8px;\n\tdisplay: flex;\n\talign-items: stretch;\n\tgap: 16px;\n\tbackground: linear-gradient(180deg, #f8f6ff 0%, #ffffff 100%);\n`;\n\nexport const MainContentWrapper = styled.div`\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 16px;\n\tflex-grow: 1;\n\tmin-width: 0;\n`;\n\nexport const TextWrapper = styled.div`\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 4px;\n`;\n\nexport const TagWrapper = styled.div`\n\tdisplay: flex;\n\tgap: 8px;\n`;\n\nexport const BottomButtonWrapper = styled.div`\n\twidth: fit-content;\n\tdisplay: flex;\n\talign-items: end;\n\tgap: 8px;\n`;\n\n// ==================== BannerWithImage Styles ====================\nexport const BannerWithImageContainer = styled.div`\n\twidth: 100%;\n\theight: 170px;\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: space-between;\n\tborder: 1px solid #e0e0e0;\n\tborder-radius: 8px;\n\tbackground-color: ${COLORS.background.brandVeryLight};\n`;\n\nexport const ContentWrapper = styled.div`\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 24px;\n\tflex: 0 0 50%;\n\tmax-width: 50%;\n\tpadding: 24px;\n\tz-index: 1;\n\tbox-sizing: border-box;\n`;\n\nexport const BannerImageWrapper = styled.div`\n\theight: 170px;\n\tposition: relative;\n\timg {\n\t\tposition: absolute;\n\t\theight: 170px;\n\t\tbottom: 0;\n\t\tright: 0;\n\t}\n`;\n\nexport const BannerWithImageButtonWrapper = styled(ButtonWrapper)`\n\tdisplay: flex;\n\tjustify-content: start;\n\tgap: 8px;\n\tbutton {\n\t\tborder-radius: 32px;\n\t}\n`;\n"],"names":["CardBannerWrapper","styled","CardBannerContent","CardBannerIconsWrapper","CardBannerButtonWrapper","CompanyImageWrapper","ButtonWrapper","ImageWrapper","CardWrapper","COLORS","CardFooterWrapper","CardImageWrapper","CardButtonWrapper","BannerContainer","MainContentWrapper","TextWrapper","TagWrapper","Bottom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AAAA,qBAQ1BQ,EAAAA,OAAO,WAAW,cAAc;AAAA,EAGxCU,EAAiBlB,EAAAA,QAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWxBmB,EAAqBnB,EAAAA,QAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAW5BoB,EAA+BpB,EAAAA,QAAOK,CAAa;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BannerInline.js","sources":["../../../../src/components/adbanner/BannerInline.tsx"],"sourcesContent":["import { Button } from '../button';\nimport { Tag } from '../tag';\nimport { BodyCaption, TitleRegular } from '../TypographyStyle';\nimport {\n\tBannerContainer,\n\tBottomButtonWrapper,\n\tCompanyImageWrapper,\n\tMainContentWrapper,\n\tTagWrapper,\n\tTextWrapper,\n} from './Banner.styled';\nimport { AdBannerProps } from './model';\n\n/**\n * BannerInline component - An inline banner with company logo, title, subtitle, tags, and button\n */\nfunction BannerInline(props: AdBannerProps) {\n\treturn (\n\t\t<BannerContainer style={props?.containerStyle}>\n\t\t\t<CompanyImageWrapper>\n\t\t\t\t<img\n\t\t\t\t\tsrc={props.companyImageUrl}\n\t\t\t\t\talt=\"Company Img\"\n\t\t\t\t\tstyle={{ aspectRatio: 'auto' }}\n\t\t\t\t/>\n\t\t\t</CompanyImageWrapper>\n\t\t\t<MainContentWrapper>\n\t\t\t\t<TextWrapper>\n\t\t\t\t\t<TitleRegular>{props.title}</TitleRegular>\n\t\t\t\t\t<BodyCaption>{props.subTitle}</BodyCaption>\n\t\t\t\t</TextWrapper>\n\t\t\t\t{props?.tags && props?.tags?.length > 0 && (\n\t\t\t\t\t<TagWrapper>\n\t\t\t\t\t\t{props?.tags?.map((tag, index) => (\n\t\t\t\t\t\t\t<Tag\n\t\t\t\t\t\t\t\tkey={index}\n\t\t\t\t\t\t\t\ttagText={tag}\n\t\t\t\t\t\t\t\tvariant=\"circle\"\n\t\t\t\t\t\t\t\ttype=\"purple\"\n\t\t\t\t\t\t\t\ttagColor=\"#212121\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t))}\n\t\t\t\t\t</TagWrapper>\n\t\t\t\t)}\n\t\t\t</MainContentWrapper>\n\t\t\t<BottomButtonWrapper>\n\t\t\t\t<Button\n\t\t\t\t\tbuttonText={props.buttonText}\n\t\t\t\t\tbuttonType={props.buttonType || 'secondary'}\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\tborderRadius: '32px',\n\t\t\t\t\t\twidth: 'fit-content',\n\t\t\t\t\t\twhiteSpace: 'nowrap',\n\t\t\t\t\t}}\n\t\t\t\t\tonClick={props.onClick}\n\t\t\t\t/>\n\t\t\t\t{props?.buttonSecondaryText && props?.onClickSecondary && (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tbuttonText={props.buttonSecondaryText}\n\t\t\t\t\t\tbuttonType={props.buttonTypeSecondary || 'primary'}\n\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\tborderRadius: '32px',\n\t\t\t\t\t\t\twidth: 'fit-content',\n\t\t\t\t\t\t\twhiteSpace: 'nowrap',\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tonClick={props.onClickSecondary}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t</BottomButtonWrapper>\n\t\t</BannerContainer>\n\t);\n}\n\nexport default BannerInline;\n"],"names":["BannerInline","props","jsxs","BannerContainer","jsx","CompanyImageWrapper","MainContentWrapper","TextWrapper","TitleRegular","BodyCaption","TagWrapper","tag","index","Tag","BottomButtonWrapper","Button"],"mappings":"gRAgBA,SAASA,EAAaC,EAAsB,CAC3C,OACCC,EAAAA,KAACC,EAAAA,gBAAA,CAAgB,MAAOF,GAAO,eAC9B,SAAA,CAAAG,MAACC,EAAAA,oBAAA,CACA,SAAAD,EAAAA,IAAC,MAAA,CACA,IAAKH,EAAM,gBACX,IAAI,cACJ,MAAO,CAAE,YAAa,MAAA,CAAO,CAAA,EAE/B,SACCK,EAAAA,mBAAA,CACA,SAAA,CAAAJ,OAACK,EAAAA,YAAA,CACA,SAAA,CAAAH,EAAAA,IAACI,EAAAA,aAAA,CAAc,WAAM,KAAA,CAAM,EAC3BJ,EAAAA,IAACK,EAAAA,YAAA,CAAa,SAAAR,EAAM,QAAA,CAAS,CAAA,EAC9B,EACCA,GAAO,MAAQA,GAAO,MAAM,OAAS,GACrCG,MAACM,EAAAA,WAAA,CACC,SAAAT,GAAO,MAAM,IAAI,CAACU,EAAKC,IACvBR,EAAAA,IAACS,EAAAA,IAAA,CAEA,QAASF,EACT,QAAQ,SACR,KAAK,SACL,SAAS,SAAA,EAJJC,CAAA,CAMN,CAAA,CACF,CAAA,EAEF,SACCE,EAAAA,oBAAA,CACA,SAAA,CAAAV,EAAAA,IAACW,EAAAA,OAAA,CACA,WAAYd,EAAM,WAClB,WAAYA,EAAM,YAAc,YAChC,MAAO,CACN,aAAc,OACd,MAAO,cACP,WAAY,QAAA,EAEb,QAASA,EAAM,OAAA,CAAA,EAEfA,GAAO,qBAAuBA,GAAO,kBACrCG,EAAAA,IAACW,EAAAA,OAAA,CACA,WAAYd,EAAM,oBAClB,WAAYA,EAAM,qBAAuB,UACzC,MAAO,CACN,aAAc,OACd,MAAO,cACP,WAAY,QAAA,EAEb,QAASA,EAAM,gBAAA,CAAA,CAChB,CAAA,CAEF,CAAA,EACD,CAEF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BannerWithImage.js","sources":["../../../../src/components/adbanner/BannerWithImage.tsx"],"sourcesContent":["import { Button } from '../button';\nimport { BodyPrimary, TitleMedium } from '../TypographyStyle';\nimport {\n\tBannerImageWrapper,\n\tBannerWithImageButtonWrapper,\n\tBannerWithImageContainer,\n\tContentWrapper,\n} from './Banner.styled';\nimport { AdBannerProps } from './model';\n\n/**\n * BannerWithImage component - A full-width banner with background image, title, subtitle, and action buttons\n */\nfunction BannerWithImage(props: AdBannerProps) {\n\treturn (\n\t\t<BannerWithImageContainer style={props?.containerStyle}>\n\t\t\t<ContentWrapper>\n\t\t\t\t<div style={{ display: 'flex', flexDirection: 'column', gap: 8 }}>\n\t\t\t\t\t<TitleMedium color={'#28034e'}>{props?.title} </TitleMedium>\n\t\t\t\t\t<BodyPrimary>{props?.subTitle} </BodyPrimary>\n\t\t\t\t</div>\n\t\t\t\t{props?.buttonText && (\n\t\t\t\t\t<BannerWithImageButtonWrapper>\n\t\t\t\t\t\t{props?.onClickSecondary && props?.buttonSecondaryText && (\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tonClick={props?.onClickSecondary}\n\t\t\t\t\t\t\t\tbuttonText={props?.buttonSecondaryText}\n\t\t\t\t\t\t\t\tbuttonType={props?.buttonTypeSecondary || 'secondary'}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tonClick={props?.onClick}\n\t\t\t\t\t\t\tbuttonText={props?.buttonText}\n\t\t\t\t\t\t\tbuttonType={props?.buttonType || 'primary'}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</BannerWithImageButtonWrapper>\n\t\t\t\t)}\n\t\t\t</ContentWrapper>\n\t\t\t<BannerImageWrapper>\n\t\t\t\t<img src={props?.bannerWithImageUrl} alt=\"Banner image\" />\n\t\t\t</BannerImageWrapper>\n\t\t</BannerWithImageContainer>\n\t);\n}\n\nexport default BannerWithImage;\n"],"names":["BannerWithImage","props","jsxs","BannerWithImageContainer","ContentWrapper","TitleMedium","BodyPrimary","BannerWithImageButtonWrapper","jsx","Button","BannerImageWrapper"],"mappings":"qPAaA,SAASA,EAAgBC,EAAsB,CAC9C,OACCC,EAAAA,KAACC,EAAAA,yBAAA,CAAyB,MAAOF,GAAO,eACvC,SAAA,CAAAC,OAACE,EAAAA,eAAA,CACA,SAAA,CAAAF,EAAAA,KAAC,MAAA,CAAI,MAAO,CAAE,QAAS,OAAQ,cAAe,SAAU,IAAK,CAAA,EAC5D,SAAA,CAAAA,EAAAA,KAACG,EAAAA,YAAA,CAAY,MAAO,UAAY,SAAA,CAAAJ,GAAO,MAAM,GAAA,EAAC,SAC7CK,EAAAA,YAAA,CAAa,SAAA,CAAAL,GAAO,SAAS,GAAA,CAAA,CAAC,CAAA,EAChC,EACCA,GAAO,YACPC,EAAAA,KAACK,EAAAA,6BAAA,CACC,SAAA,CAAAN,GAAO,kBAAoBA,GAAO,qBAClCO,EAAAA,IAACC,EAAAA,OAAA,CACA,QAASR,GAAO,iBAChB,WAAYA,GAAO,oBACnB,WAAYA,GAAO,qBAAuB,WAAA,CAAA,EAG5CO,EAAAA,IAACC,EAAAA,OAAA,CACA,QAASR,GAAO,QAChB,WAAYA,GAAO,WACnB,WAAYA,GAAO,YAAc,SAAA,CAAA,CAClC,CAAA,CACD,CAAA,EAEF,EACAO,EAAAA,IAACE,EAAAA,oBACA,SAAAF,EAAAA,IAAC,MAAA,CAAI,IAAKP,GAAO,mBAAoB,IAAI,cAAA,CAAe,CAAA,CACzD,CAAA,EACD,CAEF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CardBanner.js","sources":["../../../../src/components/adbanner/CardBanner.tsx"],"sourcesContent":["import { useCallback } from 'react';\nimport { Button } from '../button';\nimport { BodyCaption, TitleSmall } from '../TypographyStyle';\nimport {\n\tCardBannerButtonWrapper,\n\tCardBannerContent,\n\tCardBannerIconsWrapper,\n\tCardBannerWrapper,\n} from './Banner.styled';\nimport {\n\tAdBannerProps,\n\tBannerThirdPartyIcon,\n\tgetUrlForBannerThirdPartyIcon,\n} from './model';\n\n/**\n * CardBanner - Banner with TitleSmall, BodyCaption, 3 icons, and button\n */\n\nfunction CardBanner(props: AdBannerProps) {\n\tconst imgUrlForIcons = useCallback((icon: BannerThirdPartyIcon) => {\n\t\treturn getUrlForBannerThirdPartyIcon(icon);\n\t}, []);\n\n\treturn (\n\t\t<CardBannerWrapper style={props?.containerStyle}>\n\t\t\t<CardBannerContent>\n\t\t\t\t<TitleSmall>{props.title}</TitleSmall>\n\t\t\t\t<BodyCaption>{props.subTitle}</BodyCaption>\n\t\t\t\t<CardBannerIconsWrapper>\n\t\t\t\t\t{props.icons?.map((icon, idx) => (\n\t\t\t\t\t\t<img\n\t\t\t\t\t\t\tkey={idx}\n\t\t\t\t\t\t\tsrc={imgUrlForIcons(icon)}\n\t\t\t\t\t\t\talt={`icon-${idx}`}\n\t\t\t\t\t\t\t// width={32}\n\t\t\t\t\t\t\t// height={32}\n\t\t\t\t\t\t\tstyle={{ width: 32, height: 32, aspectRatio: 1 }}\n\t\t\t\t\t\t/>\n\t\t\t\t\t))}\n\t\t\t\t</CardBannerIconsWrapper>\n\t\t\t</CardBannerContent>\n\t\t\t<CardBannerButtonWrapper>\n\t\t\t\t<Button\n\t\t\t\t\tbuttonText={props.buttonText}\n\t\t\t\t\tbuttonType={props.buttonType || 'secondary'}\n\t\t\t\t\tonClick={props.onClick}\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\tborderRadius: '32px',\n\t\t\t\t\t\twidth: 'fit-content',\n\t\t\t\t\t\twhiteSpace: 'nowrap',\n\t\t\t\t\t}}\n\t\t\t\t/>\n\t\t\t\t{props?.buttonSecondaryText && props?.onClickSecondary && (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tbuttonText={props.buttonSecondaryText}\n\t\t\t\t\t\tbuttonType={props.buttonTypeSecondary || 'primary'}\n\t\t\t\t\t\tonClick={props.onClickSecondary}\n\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\tborderRadius: '32px',\n\t\t\t\t\t\t\twidth: 'fit-content',\n\t\t\t\t\t\t\twhiteSpace: 'nowrap',\n\t\t\t\t\t\t}}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t</CardBannerButtonWrapper>\n\t\t</CardBannerWrapper>\n\t);\n}\n\nexport default CardBanner;\n"],"names":["CardBanner","props","imgUrlForIcons","useCallback","icon","getUrlForBannerThirdPartyIcon","jsxs","CardBannerWrapper","CardBannerContent","jsx","TitleSmall","BodyCaption","CardBannerIconsWrapper","idx","CardBannerButtonWrapper","Button"],"mappings":"gSAmBA,SAASA,EAAWC,EAAsB,CACzC,MAAMC,EAAiBC,cAAaC,GAC5BC,EAAAA,8BAA8BD,CAAI,EACvC,CAAA,CAAE,EAEL,OACCE,EAAAA,KAACC,EAAAA,kBAAA,CAAkB,MAAON,GAAO,eAChC,SAAA,CAAAK,OAACE,EAAAA,kBAAA,CACA,SAAA,CAAAC,EAAAA,IAACC,EAAAA,WAAA,CAAY,WAAM,KAAA,CAAM,EACzBD,EAAAA,IAACE,EAAAA,YAAA,CAAa,SAAAV,EAAM,QAAA,CAAS,QAC5BW,EAAAA,uBAAA,CACC,SAAAX,EAAM,OAAO,IAAI,CAACG,EAAMS,IACxBJ,EAAAA,IAAC,MAAA,CAEA,IAAKP,EAAeE,CAAI,EACxB,IAAK,QAAQS,CAAG,GAGhB,MAAO,CAAE,MAAO,GAAI,OAAQ,GAAI,YAAa,CAAA,CAAE,EAL1CA,CAAA,CAON,CAAA,CACF,CAAA,EACD,SACCC,EAAAA,wBAAA,CACA,SAAA,CAAAL,EAAAA,IAACM,EAAAA,OAAA,CACA,WAAYd,EAAM,WAClB,WAAYA,EAAM,YAAc,YAChC,QAASA,EAAM,QACf,MAAO,CACN,aAAc,OACd,MAAO,cACP,WAAY,QAAA,CACb,CAAA,EAEAA,GAAO,qBAAuBA,GAAO,kBACrCQ,EAAAA,IAACM,EAAAA,OAAA,CACA,WAAYd,EAAM,oBAClB,WAAYA,EAAM,qBAAuB,UACzC,QAASA,EAAM,iBACf,MAAO,CACN,aAAc,OACd,MAAO,cACP,WAAY,QAAA,CACb,CAAA,CACD,CAAA,CAEF,CAAA,EACD,CAEF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CardBannerWithImage.js","sources":["../../../../src/components/adbanner/CardBannerWithImage.tsx"],"sourcesContent":["import { Button } from '../button';\nimport { TitleSmall } from '../TypographyStyle';\nimport {\n\tCardButtonWrapper,\n\tCardFooterWrapper,\n\tCardImageWrapper,\n\tCardWrapper,\n\tCompanyImageWrapper,\n} from './Banner.styled';\nimport { AdBannerProps } from './model';\n\n/**\n * CardBanner component - A banner with a card-style layout featuring an image, company logo, title, and button\n */\nfunction CardBanner(props: AdBannerProps) {\n\treturn (\n\t\t<CardWrapper style={props?.containerStyle}>\n\t\t\t<CardImageWrapper>\n\t\t\t\t<img\n\t\t\t\t\tsrc={props?.cardImageUrl}\n\t\t\t\t\talt=\"Card Img\"\n\t\t\t\t\tstyle={{ aspectRatio: 'auto' }}\n\t\t\t\t/>\n\t\t\t</CardImageWrapper>\n\t\t\t<CardFooterWrapper>\n\t\t\t\t<CompanyImageWrapper>\n\t\t\t\t\t<img\n\t\t\t\t\t\tsrc={props.companyImageUrl}\n\t\t\t\t\t\talt=\"Company Img\"\n\t\t\t\t\t\tstyle={{ aspectRatio: 'auto' }}\n\t\t\t\t\t/>\n\t\t\t\t</CompanyImageWrapper>\n\t\t\t\t<TitleSmall>{props?.title}</TitleSmall>\n\t\t\t\t<CardButtonWrapper>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tonClick={props?.onClick}\n\t\t\t\t\t\tbuttonType={props?.buttonType || 'secondary'}\n\t\t\t\t\t\tbuttonText={props?.buttonText}\n\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\twidth: 'fit-content',\n\t\t\t\t\t\t\twhiteSpace: 'nowrap',\n\t\t\t\t\t\t}}\n\t\t\t\t\t/>\n\t\t\t\t</CardButtonWrapper>\n\t\t\t</CardFooterWrapper>\n\t\t</CardWrapper>\n\t);\n}\n\nexport default CardBanner;\n"],"names":["CardBanner","props","jsxs","CardWrapper","jsx","CardImageWrapper","CardFooterWrapper","CompanyImageWrapper","TitleSmall","CardButtonWrapper","Button"],"mappings":"qPAcA,SAASA,EAAWC,EAAsB,CACzC,OACCC,EAAAA,KAACC,EAAAA,YAAA,CAAY,MAAOF,GAAO,eAC1B,SAAA,CAAAG,MAACC,EAAAA,iBAAA,CACA,SAAAD,EAAAA,IAAC,MAAA,CACA,IAAKH,GAAO,aACZ,IAAI,WACJ,MAAO,CAAE,YAAa,MAAA,CAAO,CAAA,EAE/B,SACCK,EAAAA,kBAAA,CACA,SAAA,CAAAF,MAACG,EAAAA,oBAAA,CACA,SAAAH,EAAAA,IAAC,MAAA,CACA,IAAKH,EAAM,gBACX,IAAI,cACJ,MAAO,CAAE,YAAa,MAAA,CAAO,CAAA,EAE/B,EACAG,EAAAA,IAACI,EAAAA,WAAA,CAAY,SAAAP,GAAO,KAAA,CAAM,QACzBQ,EAAAA,kBAAA,CACA,SAAAL,EAAAA,IAACM,EAAAA,OAAA,CACA,QAAST,GAAO,QAChB,WAAYA,GAAO,YAAc,YACjC,WAAYA,GAAO,WACnB,MAAO,CACN,MAAO,cACP,WAAY,QAAA,CACb,CAAA,CACD,CACD,CAAA,CAAA,CACD,CAAA,EACD,CAEF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model.js","sources":["../../../../src/components/adbanner/model.ts"],"sourcesContent":["import React from 'react';\nimport { Type } from '../button/model';\n\nexport enum BannerType {\n\tCARD_BANNER = 'CARD_BANNER',\n\tCARD_BANNER_WITH_IMAGE = 'CARD_BANNER_WITH_IMAGE',\n\tBANNER_INLINE = 'BANNER_INLINE',\n\tBANNER_WITH_IMAGE = 'BANNER_WITH_IMAGE',\n}\n\nexport enum BannerThirdPartyIcon {\n\tWHATSAPP = 'WHATSAPP',\n\tINSTAGRAM = 'INSTAGRAM',\n\tEMAIL = 'EMAIL',\n}\n\nexport const getUrlForBannerThirdPartyIcon = (\n\ticon: BannerThirdPartyIcon,\n): string => {\n\tswitch (icon) {\n\t\tcase BannerThirdPartyIcon.WHATSAPP:\n\t\t\treturn 'https://firebasestorage.googleapis.com/v0/b/bikayi-chat.appspot.com/o/images-uid%2Fe106cfaf-05f5-455a-90db-e03f73840879?alt=media&token=2ad25cc1-c9c9-4b4c-9273-7654fe4ab802';\n\t\tcase BannerThirdPartyIcon.INSTAGRAM:\n\t\t\treturn 'https://firebasestorage.googleapis.com/v0/b/bikayi-chat.appspot.com/o/images-uid%2Fbdcc71a8-f505-4549-8278-d6e7a95e1e19?alt=media&token=1729b489-3eb6-4dd3-b74d-e7115afdb2af';\n\t\tcase BannerThirdPartyIcon.EMAIL:\n\t\t\treturn 'https://firebasestorage.googleapis.com/v0/b/bikayi-chat.appspot.com/o/images-uid%2F00910e7b-2ce2-4b14-aea1-543a138c1653?alt=media&token=93e3e15e-4a0f-4737-b9a1-c9b0168a7d62';\n\t\tdefault:\n\t\t\treturn '';\n\t}\n};\n\nexport interface AdBannerProps {\n\t/**\n\t * Type of banner to render\n\t */\n\tbannerType: BannerType;\n\n\t/**\n\t * Title text for the banner\n\t */\n\ttitle: string;\n\n\t/**\n\t * Subtitle or description text\n\t */\n\tsubTitle?: React.ReactNode;\n\n\t/**\n\t * Primary button click handler\n\t */\n\tonClick: () => void;\n\n\t/**\n\t * Type/variant of the primary button\n\t * @default 'secondary'\n\t */\n\tbuttonType?: Type;\n\n\t/**\n\t * Text for the primary button\n\t */\n\tbuttonText: string;\n\n\t/**\n\t * Text for the secondary button\n\t */\n\tbuttonSecondaryText?: string;\n\n\t/**\n\t * Secondary button click handler\n\t */\n\tonClickSecondary?: () => void;\n\n\t/**\n\t * Type/variant of the secondary button\n\t */\n\tbuttonTypeSecondary?: Type;\n\n\t/**\n\t * Array of tag labels\n\t */\n\ttags?: string[];\n\n\t/**\n\t * URL for the card image (CardBanner)\n\t */\n\tcardImageUrl?: string;\n\n\t/**\n\t * URL for the company/brand logo image\n\t */\n\tcompanyImageUrl?: string;\n\n\t/**\n\t * URL for the banner background image (BannerWithImage)\n\t */\n\tbannerWithImageUrl?: string;\n\n\t/**\n\t * Custom styles for the banner container\n\t */\n\tcontainerStyle?: React.CSSProperties;\n\n\t/**\n\t * Icons array for CardBanner\n\t */\n\ticons?: BannerThirdPartyIcon[];\n}\n"],"names":["BannerType","BannerThirdPartyIcon","getUrlForBannerThirdPartyIcon","icon"],"mappings":"gFAGO,IAAKA,GAAAA,IACXA,EAAA,YAAc,cACdA,EAAA,uBAAyB,yBACzBA,EAAA,cAAgB,gBAChBA,EAAA,kBAAoB,oBAJTA,IAAAA,GAAA,CAAA,CAAA,EAOAC,GAAAA,IACXA,EAAA,SAAW,WACXA,EAAA,UAAY,YACZA,EAAA,MAAQ,QAHGA,IAAAA,GAAA,CAAA,CAAA,EAML,MAAMC,EACZC,GACY,CACZ,OAAQA,EAAA,CACP,IAAK,WACJ,MAAO,+KACR,IAAK,YACJ,MAAO,+KACR,IAAK,QACJ,MAAO,+KACR,QACC,MAAO,EAAA,CAEV"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("react/jsx-runtime"),te=require("../node_modules/@tiptap/core/dist/index.js"),j=require("@tiptap/react"),c=require("react"),ne=require("./BikEditor.styles.js"),U=require("./BikEditor.types.js"),s=require("./BikEditor.utils.js"),oe=require("./extensions/buildExtensions.js"),re=require("./floating/LinkBubbleMenu.js");function se(g){return Object.entries(g).map(([h,f])=>`${h.replace(/([A-Z])/g,m=>`-${m.toLowerCase()}`)}:${f}`).join(";")}const ie=(g,h)=>{const{initialContent:f,sections:m,features:k,disabled:N,maxCharacters:y,shortcuts:W,sendShortcut:$,mentions:l,slashCommands:d,link:J,onPaste:Q,onReady:R,onChange:x,onSend:p,onFocus:B,onBlur:b,onSelectionChange:A,minHeight:V,maxHeight:Z,style:G,className:K,editorClassName:E,editorStyle:z}=g,X=m?.length?s.buildSectionedContent(s.normalizeHtml(f??""),m.map(e=>({...e,content:s.normalizeHtml(e.content)}))):s.normalizeHtml(f??""),C=c.useRef([]),H=c.useRef(!1),T=c.useRef(R);T.current=R;const I=c.useRef(x);I.current=x;const v=c.useRef(A);v.current=A;const L=c.useRef(U.DEFAULT_FORMAT_STATE),F=c.useRef(B);F.current=B;const M=c.useRef(b);M.current=b;const q=c.useRef(p);q.current=p;const O=c.useRef(l?.agents??[]);O.current=l?.agents??[];const P=c.useRef(l?.teams??[]);P.current=l?.teams??[];const w=c.useRef(d?.items??[]);w.current=d?.items??[];const o=j.useEditor({extensions:oe.buildExtensions({features:k,placeholder:g.placeholder,maxCharacters:y,hasSections:(m?.length??0)>0,mentions:{agents:l?O:void 0,teams:l?P:void 0},slashCommands:d?w:void 0,onPaste:Q,onSend:p?e=>q.current?.(e):void 0,sendShortcut:$,shortcuts:W,onMentionSelected:l?.onSelect,onSlashCommandSelected:d?.onSelect,renderMentionItem:l?.renderItem,renderMentionDropdown:l?.renderDropdown,removeMentionTriggerOnDismiss:l?.removeTriggerOnDismiss,renderSlashCommandItem:d?.renderItem,renderSlashCommandDropdown:d?.renderDropdown}),content:X,editable:!N,immediatelyRender:!1,editorProps:{attributes:{...E?{class:E}:{},...z?{style:se(z)}:{}}},onUpdate:({editor:e})=>{I.current?.(s.extractContent(e))},onTransaction:({editor:e})=>{const t=s.extractActiveFormats(e),n=L.current;(n.bold!==t.bold||n.italic!==t.italic||n.underline!==t.underline||n.strike!==t.strike||n.bulletList!==t.bulletList||n.orderedList!==t.orderedList||n.blockquote!==t.blockquote||n.codeBlock!==t.codeBlock||n.superscript!==t.superscript||n.subscript!==t.subscript||n.textAlign!==t.textAlign||n.fontFamily!==t.fontFamily||n.fontSize!==t.fontSize||n.color!==t.color||n.highlight!==t.highlight||n.link?.href!==t.link?.href)&&(L.current=t,v.current?.(t))},onFocus:()=>F.current?.(),onBlur:()=>M.current?.()});function i(e){o?e(o):C.current.push(e)}return c.useEffect(()=>{o&&(C.current.length>0&&C.current.splice(0).forEach(t=>t(o)),H.current||(H.current=!0,T.current?.()))},[o]),c.useImperativeHandle(h,()=>({focus:e=>i(t=>t.commands.focus(e)),blur:()=>i(e=>e.commands.blur()),clearContent:()=>i(e=>e.commands.clearContent(!0)),setContent:e=>{const t=s.normalizeHtml(e);i(n=>n.commands.setContent(t,{emitUpdate:!0}))},insertContent:e=>{const t=s.normalizeHtml(e);i(n=>n.commands.insertContent(t))},insertInlineContent:e=>{i(t=>s.insertInlineHtml(t,e))},insertAtStart:e=>{const t=s.normalizeHtml(e);i(n=>n.commands.insertContentAt(1,t))},insertBlock:e=>{const t=s.normalizeHtml(e);i(n=>n.commands.insertContentAt(n.state.doc.content.size,t))},appendInline:e=>{const t=s.normalizeHtml(e);i(n=>n.commands.insertContentAt(n.state.doc.content.size-1,t))},insertAtEnd(e){this.insertBlock(e)},appendContent(e){this.appendInline(e)},getContent:()=>o?s.extractContent(o):{html:"",text:"",isEmpty:!0,characterCount:0},getJSON:()=>o?.getJSON()??null,getMentions:()=>{const e=new Set,t=new Set;return o?(o.state.doc.descendants(n=>{n.type.name==="mentionAgent"&&n.attrs.id!=null?e.add(String(n.attrs.id)):n.type.name==="mentionTeam"&&n.attrs.id!=null&&t.add(String(n.attrs.id))}),{agentIds:Array.from(e),teamIds:Array.from(t)}):{agentIds:[],teamIds:[]}},getCursorPosition:()=>{if(!o)return{from:0,to:0};const{from:e,to:t}=o.state.selection;return{from:e,to:t}},insertAtPosition:(e,t)=>{const n=s.normalizeHtml(t);i(r=>r.commands.insertContentAt(e,n))},getSelectedText:()=>{if(!o)return"";const{state:e}=o,{from:t,to:n,empty:r}=e.selection;if(!r)return e.doc.textBetween(t,n," ");const a=e.schema.marks.link;if(a){const u=te.getMarkRange(e.doc.resolve(t),a);if(u)return e.doc.textBetween(u.from,u.to," ")}return""},getCharacterCount:()=>({count:o?.storage.characterCount?.characters?.()??o?.getText().length??0,limit:y??null}),getSectionContent:e=>o?s.extractSectionContent(o,e):{html:"",text:"",isEmpty:!0,characterCount:0},setSectionContent:(e,t)=>{const n=s.normalizeHtml(t);i(r=>s.setSectionContentInEditor(r,e,n))},focusSection:e=>{i(t=>{if(e==="body"){let r=t.state.doc.content.size-1;t.state.doc.descendants((a,u)=>(a.type.name==="sectionDivider"&&r===t.state.doc.content.size-1&&(r=u-1),r===t.state.doc.content.size-1)),r<1&&(r=1),t.chain().focus().setTextSelection(r).run();return}let n=-1;t.state.doc.descendants((r,a)=>{if(n!==-1)return!1;r.type.name==="sectionDivider"&&r.attrs.sectionId===e&&(n=a+r.nodeSize+1)}),n!==-1&&t.chain().focus().setTextSelection(n).run()})},clearSection:e=>{i(t=>s.setSectionContentInEditor(t,e,"<p></p>"))},getBodyContent:()=>o?s.extractBodyContent(o):{html:"",text:"",isEmpty:!0,characterCount:0},setBodyContent:e=>{const t=s.normalizeHtml(e);i(n=>s.setSectionContentInEditor(n,"body",t))},setBodyAndSections:(e,t)=>{const n=s.buildSectionedContent(s.normalizeHtml(e),t.map(r=>({id:r.id,content:s.normalizeHtml(r.content)})));i(r=>r.commands.setContent(n,{emitUpdate:!0}))},appendBodyContent:e=>{const t=s.normalizeHtml(e);i(n=>{const r=s.findSectionEndPos(n,"body");n.commands.insertContentAt(r-1,t,{parseOptions:{preserveWhitespace:!0}})})},insertAtSectionStart:(e,t)=>{const n=s.normalizeHtml(t);i(r=>{const a=s.findSectionStartPos(r,e);a!==-1&&r.commands.insertContentAt(a,n,{parseOptions:{preserveWhitespace:!0}})})},insertAtSectionEnd:(e,t)=>{const n=s.normalizeHtml(t);i(r=>{const a=s.findSectionEndPos(r,e);r.commands.insertContentAt(a,n,{parseOptions:{preserveWhitespace:!0}})})},getActiveFormats:()=>o?s.extractActiveFormats(o):U.DEFAULT_FORMAT_STATE,actions:{toggleBold:()=>o?.chain().focus().toggleBold().run(),toggleItalic:()=>o?.chain().focus().toggleItalic().run(),toggleUnderline:()=>o?.chain().focus().toggleUnderline().run(),toggleStrike:()=>o?.chain().focus().toggleStrike().run(),toggleBulletList:()=>o?.chain().focus().toggleBulletList().run(),toggleOrderedList:()=>o?.chain().focus().toggleOrderedList().run(),toggleBlockquote:()=>o?.chain().focus().toggleBlockquote().run(),toggleCodeBlock:()=>o?.chain().focus().toggleCodeBlock().run(),setTextAlign:e=>o?.chain().focus().setTextAlign(e).run(),setFontFamily:e=>o?.chain().focus().setFontFamily(e).run(),setFontSize:e=>o?.chain().focus().setFontSize(e).run(),setColor:e=>o?.chain().focus().setColor(e).run(),setHighlight:e=>o?.chain().focus().toggleHighlight({color:e}).run(),unsetColor:()=>o?.chain().focus().unsetColor().run(),unsetHighlight:()=>o?.chain().focus().unsetHighlight().run(),setLink:(e,t)=>{o&&(t!==void 0?o.chain().focus().extendMarkRange("link").command(({tr:n,state:r})=>{const{from:a,to:u}=n.selection,D=r.schema.marks.link;if(!D)return!1;const Y=r.schema.text(t,[D.create({href:e})]),ee=r.schema.text(" ");return n.replaceWith(a,u,[Y,ee]),!0}).run():o.chain().focus().extendMarkRange("link").setLink({href:e}).insertContent(" ").run())},updateLink:e=>o?.chain().focus().extendMarkRange("link").setLink({href:e}).run(),removeLink:()=>o?.chain().focus().extendMarkRange("link").unsetLink().run(),insertEmoji:e=>o?.chain().focus().insertContent(e).run(),insertVariable:e=>o?.chain().focus().insertContent(`{{${e}}}`).run(),insertHtml:e=>o?.commands.insertContent(s.normalizeHtml(e)),undo:()=>o?.chain().focus().undo().run(),redo:()=>o?.chain().focus().redo().run(),canUndo:()=>o?.can().undo()??!1,canRedo:()=>o?.can().redo()??!1,toggleSuperscript:()=>o?.chain().focus().toggleSuperscript().run(),toggleSubscript:()=>o?.chain().focus().toggleSubscript().run(),insertImage:e=>o?.chain().focus().setImage({src:e}).run()}}),[o]),o?S.jsxs(ne.BikEditorShell,{minHeight:V,maxHeight:Z,tightParagraphs:!k?.richPaste,style:G,className:K,children:[S.jsx(j.EditorContent,{editor:o}),S.jsx(re.LinkBubbleMenu,{editor:o,renderLinkTooltip:J?.renderTooltip})]}):null},_=c.forwardRef(ie);_.displayName="BikEditor";exports.BikEditor=_;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),de=require("../node_modules/@tiptap/core/dist/index.js"),$=require("@tiptap/react"),c=require("react"),V=require("../components/TypographyStyle.js"),B=require("./BikEditor.styles.js"),Q=require("./BikEditor.types.js"),s=require("./BikEditor.utils.js"),me=require("./extensions/buildExtensions.js"),ge=require("./floating/LinkBubbleMenu.js"),fe=require("../icons/BIK AI specific/WandSparkles.js"),he=require("../icons/Actions/Formatting/Copy.js");function pe(C){return Object.entries(C).map(([S,h])=>`${S.replace(/([A-Z])/g,p=>`-${p.toLowerCase()}`)}:${h}`).join(";")}const Ce=(C,S)=>{const{initialContent:h,sections:p,features:k,disabled:G,maxCharacters:T,shortcuts:K,sendShortcut:X,mentions:u,slashCommands:f,link:Y,onPaste:ee,onReady:b,onChange:R,onSend:x,onFocus:E,onBlur:v,onSelectionChange:A,minHeight:te,maxHeight:ne,style:oe,className:se,editorClassName:z,editorStyle:H,renderJsonError:j}=C,m=!!k?.jsonMode,[d,I]=c.useState(null),[re,J]=c.useState(!1),ie=m?s.buildJsonCodeBlockHtml(h??""):p?.length?s.buildSectionedContent(s.normalizeHtml(h??""),p.map(e=>({...e,content:s.normalizeHtml(e.content)}))):s.normalizeHtml(h??""),y=c.useRef([]),M=c.useRef(!1),L=c.useRef(b);L.current=b;const F=c.useRef(R);F.current=R;const O=c.useRef(A);O.current=A;const q=c.useRef(Q.DEFAULT_FORMAT_STATE),P=c.useRef(E);P.current=E;const w=c.useRef(v);w.current=v;const N=c.useRef(x);N.current=x;const D=c.useRef(u?.agents??[]);D.current=u?.agents??[];const U=c.useRef(u?.teams??[]);U.current=u?.teams??[];const _=c.useRef(f?.items??[]);_.current=f?.items??[];const n=$.useEditor({extensions:me.buildExtensions({features:k,placeholder:C.placeholder,maxCharacters:T,hasSections:(p?.length??0)>0,mentions:{agents:u?D:void 0,teams:u?U:void 0},slashCommands:f?_:void 0,onPaste:ee,onSend:x?e=>N.current?.(e):void 0,sendShortcut:X,shortcuts:K,onMentionSelected:u?.onSelect,onSlashCommandSelected:f?.onSelect,renderMentionItem:u?.renderItem,renderMentionDropdown:u?.renderDropdown,removeMentionTriggerOnDismiss:u?.removeTriggerOnDismiss,renderSlashCommandItem:f?.renderItem,renderSlashCommandDropdown:f?.renderDropdown}),content:ie,editable:!G,immediatelyRender:!1,editorProps:{attributes:{...z?{class:z}:{},...H?{style:pe(H)}:{}}},onUpdate:({editor:e})=>{if(F.current?.(s.extractContent(e)),m){const t=s.parseJson(s.getCodeBlockText(e));I(t.valid?null:t)}},onTransaction:({editor:e})=>{const t=s.extractActiveFormats(e),o=q.current;(o.bold!==t.bold||o.italic!==t.italic||o.underline!==t.underline||o.strike!==t.strike||o.bulletList!==t.bulletList||o.orderedList!==t.orderedList||o.blockquote!==t.blockquote||o.codeBlock!==t.codeBlock||o.superscript!==t.superscript||o.subscript!==t.subscript||o.textAlign!==t.textAlign||o.fontFamily!==t.fontFamily||o.fontSize!==t.fontSize||o.color!==t.color||o.highlight!==t.highlight||o.link?.href!==t.link?.href)&&(q.current=t,O.current?.(t))},onFocus:()=>P.current?.(),onBlur:()=>w.current?.()});function i(e){n?e(n):y.current.push(e)}c.useEffect(()=>{if(n&&(y.current.length>0&&y.current.splice(0).forEach(t=>t(n)),M.current||(M.current=!0,L.current?.()),m)){const e=s.parseJson(s.getCodeBlockText(n));I(e.valid?null:e)}},[n,m]),c.useImperativeHandle(S,()=>({focus:e=>i(t=>t.commands.focus(e)),blur:()=>i(e=>e.commands.blur()),clearContent:()=>i(e=>e.commands.clearContent(!0)),setContent:e=>{const t=s.normalizeHtml(e);i(o=>o.commands.setContent(t,{emitUpdate:!0}))},insertContent:e=>{const t=s.normalizeHtml(e);i(o=>o.commands.insertContent(t))},insertInlineContent:e=>{i(t=>s.insertInlineHtml(t,e))},insertAtStart:e=>{const t=s.normalizeHtml(e);i(o=>o.commands.insertContentAt(1,t))},insertBlock:e=>{const t=s.normalizeHtml(e);i(o=>o.commands.insertContentAt(o.state.doc.content.size,t))},appendInline:e=>{const t=s.normalizeHtml(e);i(o=>o.commands.insertContentAt(o.state.doc.content.size-1,t))},insertAtEnd(e){this.insertBlock(e)},appendContent(e){this.appendInline(e)},getContent:()=>n?s.extractContent(n):{html:"",text:"",isEmpty:!0,characterCount:0},getJSON:()=>n?.getJSON()??null,getMentions:()=>{const e=new Set,t=new Set;return n?(n.state.doc.descendants(o=>{o.type.name==="mentionAgent"&&o.attrs.id!=null?e.add(String(o.attrs.id)):o.type.name==="mentionTeam"&&o.attrs.id!=null&&t.add(String(o.attrs.id))}),{agentIds:Array.from(e),teamIds:Array.from(t)}):{agentIds:[],teamIds:[]}},getCursorPosition:()=>{if(!n)return{from:0,to:0};const{from:e,to:t}=n.state.selection;return{from:e,to:t}},insertAtPosition:(e,t)=>{const o=s.normalizeHtml(t);i(r=>r.commands.insertContentAt(e,o))},getSelectedText:()=>{if(!n)return"";const{state:e}=n,{from:t,to:o,empty:r}=e.selection;if(!r)return e.doc.textBetween(t,o," ");const l=e.schema.marks.link;if(l){const g=de.getMarkRange(e.doc.resolve(t),l);if(g)return e.doc.textBetween(g.from,g.to," ")}return""},getCharacterCount:()=>({count:n?.storage.characterCount?.characters?.()??n?.getText().length??0,limit:T??null}),getSectionContent:e=>n?s.extractSectionContent(n,e):{html:"",text:"",isEmpty:!0,characterCount:0},setSectionContent:(e,t)=>{const o=s.normalizeHtml(t);i(r=>s.setSectionContentInEditor(r,e,o))},focusSection:e=>{i(t=>{if(e==="body"){let r=t.state.doc.content.size-1;t.state.doc.descendants((l,g)=>(l.type.name==="sectionDivider"&&r===t.state.doc.content.size-1&&(r=g-1),r===t.state.doc.content.size-1)),r<1&&(r=1),t.chain().focus().setTextSelection(r).run();return}let o=-1;t.state.doc.descendants((r,l)=>{if(o!==-1)return!1;r.type.name==="sectionDivider"&&r.attrs.sectionId===e&&(o=l+r.nodeSize+1)}),o!==-1&&t.chain().focus().setTextSelection(o).run()})},clearSection:e=>{i(t=>s.setSectionContentInEditor(t,e,"<p></p>"))},getBodyContent:()=>n?s.extractBodyContent(n):{html:"",text:"",isEmpty:!0,characterCount:0},setBodyContent:e=>{const t=s.normalizeHtml(e);i(o=>s.setSectionContentInEditor(o,"body",t))},setBodyAndSections:(e,t)=>{const o=s.buildSectionedContent(s.normalizeHtml(e),t.map(r=>({id:r.id,content:s.normalizeHtml(r.content)})));i(r=>r.commands.setContent(o,{emitUpdate:!0}))},appendBodyContent:e=>{const t=s.normalizeHtml(e);i(o=>{const r=s.findSectionEndPos(o,"body");o.commands.insertContentAt(r-1,t,{parseOptions:{preserveWhitespace:!0}})})},insertAtSectionStart:(e,t)=>{const o=s.normalizeHtml(t);i(r=>{const l=s.findSectionStartPos(r,e);l!==-1&&r.commands.insertContentAt(l,o,{parseOptions:{preserveWhitespace:!0}})})},insertAtSectionEnd:(e,t)=>{const o=s.normalizeHtml(t);i(r=>{const l=s.findSectionEndPos(r,e);r.commands.insertContentAt(l,o,{parseOptions:{preserveWhitespace:!0}})})},getActiveFormats:()=>n?s.extractActiveFormats(n):Q.DEFAULT_FORMAT_STATE,actions:{toggleBold:()=>n?.chain().focus().toggleBold().run(),toggleItalic:()=>n?.chain().focus().toggleItalic().run(),toggleUnderline:()=>n?.chain().focus().toggleUnderline().run(),toggleStrike:()=>n?.chain().focus().toggleStrike().run(),toggleBulletList:()=>n?.chain().focus().toggleBulletList().run(),toggleOrderedList:()=>n?.chain().focus().toggleOrderedList().run(),toggleBlockquote:()=>n?.chain().focus().toggleBlockquote().run(),toggleCodeBlock:()=>n?.chain().focus().toggleCodeBlock().run(),setTextAlign:e=>n?.chain().focus().setTextAlign(e).run(),setFontFamily:e=>n?.chain().focus().setFontFamily(e).run(),setFontSize:e=>n?.chain().focus().setFontSize(e).run(),setColor:e=>n?.chain().focus().setColor(e).run(),setHighlight:e=>n?.chain().focus().toggleHighlight({color:e}).run(),unsetColor:()=>n?.chain().focus().unsetColor().run(),unsetHighlight:()=>n?.chain().focus().unsetHighlight().run(),setLink:(e,t)=>{n&&(t!==void 0?n.chain().focus().extendMarkRange("link").command(({tr:o,state:r})=>{const{from:l,to:g}=o.selection,W=r.schema.marks.link;if(!W)return!1;const ae=r.schema.text(t,[W.create({href:e})]),ue=r.schema.text(" ");return o.replaceWith(l,g,[ae,ue]),!0}).run():n.chain().focus().extendMarkRange("link").setLink({href:e}).insertContent(" ").run())},updateLink:e=>n?.chain().focus().extendMarkRange("link").setLink({href:e}).run(),removeLink:()=>n?.chain().focus().extendMarkRange("link").unsetLink().run(),insertEmoji:e=>n?.chain().focus().insertContent(e).run(),insertVariable:e=>n?.chain().focus().insertContent(`{{${e}}}`).run(),insertHtml:e=>n?.commands.insertContent(s.normalizeHtml(e)),undo:()=>n?.chain().focus().undo().run(),redo:()=>n?.chain().focus().redo().run(),canUndo:()=>n?.can().undo()??!1,canRedo:()=>n?.can().redo()??!1,toggleSuperscript:()=>n?.chain().focus().toggleSuperscript().run(),toggleSubscript:()=>n?.chain().focus().toggleSubscript().run(),insertImage:e=>n?.chain().focus().setImage({src:e}).run()},json:k?.jsonMode?{getText:()=>n?s.getCodeBlockText(n):"",setText:e=>i(t=>s.setCodeBlockText(t,e)),parse:()=>s.parseJson(n?s.getCodeBlockText(n):""),isValid:()=>s.parseJson(n?s.getCodeBlockText(n):"").valid,format:(e=2)=>i(t=>{const{valid:o,value:r}=s.parseJson(s.getCodeBlockText(t));!o||r===null||s.setCodeBlockText(t,JSON.stringify(r,null,e))}),minify:()=>i(e=>{const{valid:t,value:o}=s.parseJson(s.getCodeBlockText(e));!t||o===null||s.setCodeBlockText(e,JSON.stringify(o))})}:void 0}),[n]);const ce=()=>{if(!n)return;const{valid:e,value:t}=s.parseJson(s.getCodeBlockText(n));!e||t===null||s.setCodeBlockText(n,JSON.stringify(t,null,2))},le=()=>{n&&(navigator.clipboard?.writeText(s.getCodeBlockText(n)),J(!0),setTimeout(()=>J(!1),1500))};return n?a.jsxs(B.BikEditorShell,{minHeight:te,maxHeight:ne,tightParagraphs:!k?.richPaste,jsonMode:m,style:oe,className:se,children:[a.jsx($.EditorContent,{editor:n}),m&&a.jsxs(B.BikJsonActions,{children:[a.jsxs("button",{type:"button",onClick:ce,disabled:!!d,title:"Format JSON",style:{padding:8},children:[a.jsx(fe.default,{size:16}),a.jsx(V.BodyCaption,{children:" Beautify "})]}),a.jsxs("button",{type:"button",onClick:le,title:"Copy JSON",style:{padding:8},children:[a.jsx(he.default,{size:16}),re&&a.jsx(V.BodyCaption,{children:" Copied "})]})]}),a.jsx(ge.LinkBubbleMenu,{editor:n,renderLinkTooltip:Y?.renderTooltip}),m&&d?j?j(d):a.jsxs(B.BikJsonError,{children:[d.line!=null&&a.jsxs("strong",{children:["Line ",d.line,d.column!=null?`, column ${d.column}`:"",":"," "]}),d.error]}):null]}):null},Z=c.forwardRef(Ce);Z.displayName="BikEditor";exports.BikEditor=Z;
|
|
2
2
|
//# sourceMappingURL=BikEditor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BikEditor.js","sources":["../../../src/editor/BikEditor.tsx"],"sourcesContent":["'use client';\n\n/**\n * IMPLEMENTATION LAYER — TipTap-specific.\n * If the underlying editor is swapped, this file changes; BikEditor.types.ts and\n * src/editor/index.ts (the consumer contract) do NOT change.\n */\nimport { Editor, getMarkRange } from '@tiptap/core';\nimport { EditorContent, useEditor } from '@tiptap/react';\nimport React, {\n\tforwardRef,\n\tuseEffect,\n\tuseImperativeHandle,\n\tuseRef,\n} from 'react';\nimport { BikEditorShell } from './BikEditor.styles';\nimport {\n\tBikEditorProps,\n\tBikEditorRef,\n\tDEFAULT_FORMAT_STATE,\n\tFormatState,\n} from './BikEditor.types';\nimport {\n\tbuildSectionedContent,\n\textractActiveFormats,\n\textractBodyContent,\n\textractContent,\n\textractSectionContent,\n\tfindSectionEndPos,\n\tfindSectionStartPos,\n\tinsertInlineHtml,\n\tnormalizeHtml,\n\tsetSectionContentInEditor,\n} from './BikEditor.utils';\nimport { buildExtensions } from './extensions/buildExtensions';\nimport { LinkBubbleMenu } from './floating/LinkBubbleMenu';\n\n/** Convert React.CSSProperties to an inline CSS string for editorProps.attributes. */\nfunction cssToString(style: React.CSSProperties): string {\n\treturn Object.entries(style)\n\t\t.map(\n\t\t\t([k, v]) => `${k.replace(/([A-Z])/g, (c) => `-${c.toLowerCase()}`)}:${v}`,\n\t\t)\n\t\t.join(';');\n}\n\nconst BikEditorInner = (\n\tprops: BikEditorProps,\n\tref: React.Ref<BikEditorRef>,\n) => {\n\tconst {\n\t\tinitialContent,\n\t\tsections,\n\t\tfeatures,\n\t\tdisabled,\n\t\tmaxCharacters,\n\t\tshortcuts,\n\t\tsendShortcut,\n\t\tmentions,\n\t\tslashCommands,\n\t\tlink,\n\t\tonPaste,\n\t\tonReady,\n\t\tonChange,\n\t\tonSend,\n\t\tonFocus,\n\t\tonBlur,\n\t\tonSelectionChange,\n\t\tminHeight,\n\t\tmaxHeight,\n\t\tstyle,\n\t\tclassName,\n\t\teditorClassName,\n\t\teditorStyle,\n\t} = props;\n\n\tconst initialEditorContent = sections?.length\n\t\t? buildSectionedContent(\n\t\t\t\tnormalizeHtml(initialContent ?? ''),\n\t\t\t\tsections.map((s) => ({ ...s, content: normalizeHtml(s.content) })),\n\t\t )\n\t\t: normalizeHtml(initialContent ?? '');\n\n\t// ── Command queue ─────────────────────────────────────────────────────────\n\t// TipTap's useEditor initializes asynchronously; the editor instance is null\n\t// until the first commit. Any imperative method called before the editor is\n\t// ready is enqueued here and flushed automatically once it becomes non-null.\n\t// Consumers never need setTimeout or readiness guards.\n\tconst pendingQueue = useRef<Array<(e: Editor) => void>>([]);\n\tconst hasCalledOnReady = useRef(false);\n\t// Keep stable refs to all callbacks so useEditor receives the same function\n\t// identity on every render — prevents TipTap from re-registering event\n\t// handlers every time the parent re-renders with new inline function props.\n\tconst onReadyRef = useRef(onReady);\n\tonReadyRef.current = onReady;\n\tconst onChangeRef = useRef(onChange);\n\tonChangeRef.current = onChange;\n\tconst onSelectionChangeRef = useRef(onSelectionChange);\n\tonSelectionChangeRef.current = onSelectionChange;\n\tconst prevFormatsRef = useRef<FormatState>(DEFAULT_FORMAT_STATE);\n\tconst onFocusRef = useRef(onFocus);\n\tonFocusRef.current = onFocus;\n\tconst onBlurRef = useRef(onBlur);\n\tonBlurRef.current = onBlur;\n\tconst onSendRef = useRef(onSend);\n\tonSendRef.current = onSend;\n\tconst agentMentionsRef = useRef(mentions?.agents ?? []);\n\tagentMentionsRef.current = mentions?.agents ?? [];\n\tconst teamMentionsRef = useRef(mentions?.teams ?? []);\n\tteamMentionsRef.current = mentions?.teams ?? [];\n\tconst slashCommandsRef = useRef(slashCommands?.items ?? []);\n\tslashCommandsRef.current = slashCommands?.items ?? [];\n\n\tconst editor = useEditor({\n\t\textensions: buildExtensions({\n\t\t\tfeatures,\n\t\t\tplaceholder: props.placeholder,\n\t\t\tmaxCharacters,\n\t\t\thasSections: (sections?.length ?? 0) > 0,\n\t\t\tmentions: {\n\t\t\t\tagents: mentions ? agentMentionsRef : undefined,\n\t\t\t\tteams: mentions ? teamMentionsRef : undefined,\n\t\t\t},\n\t\t\tslashCommands: slashCommands ? slashCommandsRef : undefined,\n\t\t\tonPaste,\n\t\t\tonSend: onSend ? (snapshot) => onSendRef.current?.(snapshot) : undefined,\n\t\t\tsendShortcut,\n\t\t\tshortcuts,\n\t\t\tonMentionSelected: mentions?.onSelect,\n\t\t\tonSlashCommandSelected: slashCommands?.onSelect,\n\t\t\trenderMentionItem: mentions?.renderItem,\n\t\t\trenderMentionDropdown: mentions?.renderDropdown,\n\t\t\tremoveMentionTriggerOnDismiss: mentions?.removeTriggerOnDismiss,\n\t\t\trenderSlashCommandItem: slashCommands?.renderItem,\n\t\t\trenderSlashCommandDropdown: slashCommands?.renderDropdown,\n\t\t}),\n\t\tcontent: initialEditorContent,\n\t\teditable: !disabled,\n\t\timmediatelyRender: false, // SSR-safe — NEVER remove this\n\t\teditorProps: {\n\t\t\tattributes: {\n\t\t\t\t...(editorClassName ? { class: editorClassName } : {}),\n\t\t\t\t...(editorStyle ? { style: cssToString(editorStyle) } : {}),\n\t\t\t},\n\t\t},\n\t\tonUpdate: ({ editor: e }) => {\n\t\t\tonChangeRef.current?.(extractContent(e));\n\t\t},\n\t\tonTransaction: ({ editor: e }) => {\n\t\t\tconst next = extractActiveFormats(e);\n\t\t\tconst prev = prevFormatsRef.current;\n\t\t\tconst changed =\n\t\t\t\tprev.bold !== next.bold ||\n\t\t\t\tprev.italic !== next.italic ||\n\t\t\t\tprev.underline !== next.underline ||\n\t\t\t\tprev.strike !== next.strike ||\n\t\t\t\tprev.bulletList !== next.bulletList ||\n\t\t\t\tprev.orderedList !== next.orderedList ||\n\t\t\t\tprev.blockquote !== next.blockquote ||\n\t\t\t\tprev.codeBlock !== next.codeBlock ||\n\t\t\t\tprev.superscript !== next.superscript ||\n\t\t\t\tprev.subscript !== next.subscript ||\n\t\t\t\tprev.textAlign !== next.textAlign ||\n\t\t\t\tprev.fontFamily !== next.fontFamily ||\n\t\t\t\tprev.fontSize !== next.fontSize ||\n\t\t\t\tprev.color !== next.color ||\n\t\t\t\tprev.highlight !== next.highlight ||\n\t\t\t\tprev.link?.href !== next.link?.href;\n\t\t\tif (changed) {\n\t\t\t\tprevFormatsRef.current = next;\n\t\t\t\tonSelectionChangeRef.current?.(next);\n\t\t\t}\n\t\t},\n\t\tonFocus: () => onFocusRef.current?.(),\n\t\tonBlur: () => onBlurRef.current?.(),\n\t});\n\n\t// ── enqueue ───────────────────────────────────────────────────────────────\n\t// Run immediately if the editor is ready; otherwise defer to the queue.\n\t// Closures passed to enqueue MUST capture all parameters explicitly —\n\t// they must NOT close over `editor` (which would be null at enqueue time).\n\tfunction enqueue(op: (e: Editor) => void): void {\n\t\tif (editor) {\n\t\t\top(editor);\n\t\t} else {\n\t\t\tpendingQueue.current.push(op);\n\t\t}\n\t}\n\n\t// Flush the pending queue and fire onReady when editor transitions null → ready.\n\tuseEffect(() => {\n\t\tif (!editor) return;\n\t\tif (pendingQueue.current.length > 0) {\n\t\t\tconst queue = pendingQueue.current.splice(0);\n\t\t\tqueue.forEach((op) => op(editor));\n\t\t}\n\t\tif (!hasCalledOnReady.current) {\n\t\t\thasCalledOnReady.current = true;\n\t\t\tonReadyRef.current?.();\n\t\t}\n\t}, [editor]);\n\n\tuseImperativeHandle(\n\t\tref,\n\t\t() => ({\n\t\t\t// ── Focus ────────────────────────────────────────────────────────\n\t\t\tfocus: (position) => enqueue((e) => e.commands.focus(position)),\n\t\t\tblur: () => enqueue((e) => e.commands.blur()),\n\n\t\t\t// ── Content ──────────────────────────────────────────────────────\n\t\t\tclearContent: () => enqueue((e) => e.commands.clearContent(true)),\n\t\t\tsetContent: (html) => {\n\t\t\t\tconst normalised = normalizeHtml(html);\n\t\t\t\tenqueue((e) => e.commands.setContent(normalised, { emitUpdate: true }));\n\t\t\t},\n\t\t\tinsertContent: (html) => {\n\t\t\t\tconst normalised = normalizeHtml(html);\n\t\t\t\tenqueue((e) => e.commands.insertContent(normalised));\n\t\t\t},\n\t\t\tinsertInlineContent: (html) => {\n\t\t\t\tenqueue((e) => insertInlineHtml(e, html));\n\t\t\t},\n\t\t\tinsertAtStart: (html) => {\n\t\t\t\tconst normalised = normalizeHtml(html);\n\t\t\t\tenqueue((e) => e.commands.insertContentAt(1, normalised));\n\t\t\t},\n\t\t\tinsertBlock: (html) => {\n\t\t\t\tconst normalised = normalizeHtml(html);\n\t\t\t\tenqueue((e) =>\n\t\t\t\t\te.commands.insertContentAt(e.state.doc.content.size, normalised),\n\t\t\t\t);\n\t\t\t},\n\t\t\tappendInline: (html) => {\n\t\t\t\tconst normalised = normalizeHtml(html);\n\t\t\t\t// doc.content.size is after the last </p> (block boundary).\n\t\t\t\t// Subtract 1 to land inside the last paragraph so text appends\n\t\t\t\t// inline rather than being wrapped in a new paragraph each call.\n\t\t\t\tenqueue((e) =>\n\t\t\t\t\te.commands.insertContentAt(e.state.doc.content.size - 1, normalised),\n\t\t\t\t);\n\t\t\t},\n\t\t\t// Backwards-compatible aliases\n\t\t\tinsertAtEnd(html) {\n\t\t\t\tthis.insertBlock(html);\n\t\t\t},\n\t\t\tappendContent(html) {\n\t\t\t\tthis.appendInline(html);\n\t\t\t},\n\t\t\tgetContent: () =>\n\t\t\t\teditor\n\t\t\t\t\t? extractContent(editor)\n\t\t\t\t\t: { html: '', text: '', isEmpty: true, characterCount: 0 },\n\t\t\tgetJSON: () => editor?.getJSON() ?? null,\n\t\t\tgetMentions: () => {\n\t\t\t\tconst agentIds = new Set<string>();\n\t\t\t\tconst teamIds = new Set<string>();\n\t\t\t\tif (!editor) return { agentIds: [], teamIds: [] };\n\t\t\t\teditor.state.doc.descendants((node) => {\n\t\t\t\t\tif (node.type.name === 'mentionAgent' && node.attrs['id'] != null) {\n\t\t\t\t\t\tagentIds.add(String(node.attrs['id']));\n\t\t\t\t\t} else if (\n\t\t\t\t\t\tnode.type.name === 'mentionTeam' &&\n\t\t\t\t\t\tnode.attrs['id'] != null\n\t\t\t\t\t) {\n\t\t\t\t\t\tteamIds.add(String(node.attrs['id']));\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\treturn { agentIds: Array.from(agentIds), teamIds: Array.from(teamIds) };\n\t\t\t},\n\n\t\t\t// ── Selection ────────────────────────────────────────────────────\n\t\t\tgetCursorPosition: () => {\n\t\t\t\tif (!editor) return { from: 0, to: 0 };\n\t\t\t\tconst { from, to } = editor.state.selection;\n\t\t\t\treturn { from, to };\n\t\t\t},\n\t\t\tinsertAtPosition: (pos, html) => {\n\t\t\t\tconst normalised = normalizeHtml(html);\n\t\t\t\tenqueue((e) => e.commands.insertContentAt(pos, normalised));\n\t\t\t},\n\t\t\tgetSelectedText: () => {\n\t\t\t\tif (!editor) return '';\n\t\t\t\tconst { state } = editor;\n\t\t\t\tconst { from, to, empty } = state.selection;\n\t\t\t\tif (!empty) {\n\t\t\t\t\treturn state.doc.textBetween(from, to, ' ');\n\t\t\t\t}\n\t\t\t\t// When the cursor is inside a link with nothing selected, return the\n\t\t\t\t// full link text — useful for pre-filling a link modal's text field.\n\t\t\t\tconst linkMarkType = state.schema.marks['link'];\n\t\t\t\tif (linkMarkType) {\n\t\t\t\t\tconst range = getMarkRange(state.doc.resolve(from), linkMarkType);\n\t\t\t\t\tif (range) {\n\t\t\t\t\t\treturn state.doc.textBetween(range.from, range.to, ' ');\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn '';\n\t\t\t},\n\n\t\t\t// ── Character count ───────────────────────────────────────────────\n\t\t\tgetCharacterCount: () => ({\n\t\t\t\tcount:\n\t\t\t\t\teditor?.storage.characterCount?.characters?.() ??\n\t\t\t\t\teditor?.getText().length ??\n\t\t\t\t\t0,\n\t\t\t\tlimit: maxCharacters ?? null,\n\t\t\t}),\n\n\t\t\t// ── Sections ─────────────────────────────────────────────────────\n\t\t\tgetSectionContent: (sectionId) =>\n\t\t\t\teditor\n\t\t\t\t\t? extractSectionContent(editor, sectionId)\n\t\t\t\t\t: { html: '', text: '', isEmpty: true, characterCount: 0 },\n\n\t\t\tsetSectionContent: (sectionId, html) => {\n\t\t\t\tconst normalised = normalizeHtml(html);\n\t\t\t\tenqueue((e) => setSectionContentInEditor(e, sectionId, normalised));\n\t\t\t},\n\n\t\t\tfocusSection: (sectionId) => {\n\t\t\t\tenqueue((e) => {\n\t\t\t\t\tif (sectionId === 'body') {\n\t\t\t\t\t\tlet endOfBody = e.state.doc.content.size - 1;\n\t\t\t\t\t\te.state.doc.descendants((node, pos) => {\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tnode.type.name === 'sectionDivider' &&\n\t\t\t\t\t\t\t\tendOfBody === e.state.doc.content.size - 1\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tendOfBody = pos - 1;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn endOfBody === e.state.doc.content.size - 1;\n\t\t\t\t\t\t});\n\t\t\t\t\t\tif (endOfBody < 1) endOfBody = 1;\n\t\t\t\t\t\te.chain().focus().setTextSelection(endOfBody).run();\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tlet targetPos = -1;\n\t\t\t\t\te.state.doc.descendants((node, pos) => {\n\t\t\t\t\t\tif (targetPos !== -1) return false;\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tnode.type.name === 'sectionDivider' &&\n\t\t\t\t\t\t\tnode.attrs['sectionId'] === sectionId\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t// pos + nodeSize lands right after the divider;\n\t\t\t\t\t\t\t// +1 more puts us inside the first paragraph of that section.\n\t\t\t\t\t\t\ttargetPos = pos + node.nodeSize + 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t\tif (targetPos !== -1) {\n\t\t\t\t\t\te.chain().focus().setTextSelection(targetPos).run();\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t},\n\n\t\t\tclearSection: (sectionId) => {\n\t\t\t\tenqueue((e) => setSectionContentInEditor(e, sectionId, '<p></p>'));\n\t\t\t},\n\n\t\t\t// ── Convenience body shorthands ───────────────────────────────────\n\t\t\tgetBodyContent: () =>\n\t\t\t\teditor\n\t\t\t\t\t? extractBodyContent(editor)\n\t\t\t\t\t: { html: '', text: '', isEmpty: true, characterCount: 0 },\n\t\t\tsetBodyContent: (html) => {\n\t\t\t\tconst normalised = normalizeHtml(html);\n\t\t\t\tenqueue((e) => setSectionContentInEditor(e, 'body', normalised));\n\t\t\t},\n\t\t\tsetBodyAndSections: (body, sections) => {\n\t\t\t\tconst html = buildSectionedContent(\n\t\t\t\t\tnormalizeHtml(body),\n\t\t\t\t\tsections.map((s) => ({\n\t\t\t\t\t\tid: s.id,\n\t\t\t\t\t\tcontent: normalizeHtml(s.content),\n\t\t\t\t\t})),\n\t\t\t\t);\n\t\t\t\tenqueue((e) => e.commands.setContent(html, { emitUpdate: true }));\n\t\t\t},\n\t\t\tappendBodyContent: (html) => {\n\t\t\t\tconst normalised = normalizeHtml(html);\n\t\t\t\t// findSectionEndPos returns the position of the first divider (or\n\t\t\t\t// doc.content.size), which is the block boundary after the last </p>.\n\t\t\t\t// Subtract 1 to stay inside the last paragraph so successive calls\n\t\t\t\t// append inline text rather than creating a new paragraph each time.\n\t\t\t\tenqueue((e) => {\n\t\t\t\t\tconst boundaryPos = findSectionEndPos(e, 'body');\n\t\t\t\t\te.commands.insertContentAt(boundaryPos - 1, normalised, {\n\t\t\t\t\t\tparseOptions: { preserveWhitespace: true },\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t},\n\t\t\tinsertAtSectionStart: (sectionId, html) => {\n\t\t\t\tconst normalised = normalizeHtml(html);\n\t\t\t\tenqueue((e) => {\n\t\t\t\t\tconst pos = findSectionStartPos(e, sectionId);\n\t\t\t\t\tif (pos !== -1)\n\t\t\t\t\t\te.commands.insertContentAt(pos, normalised, {\n\t\t\t\t\t\t\tparseOptions: { preserveWhitespace: true },\n\t\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t},\n\t\t\tinsertAtSectionEnd: (sectionId, html) => {\n\t\t\t\tconst normalised = normalizeHtml(html);\n\t\t\t\tenqueue((e) => {\n\t\t\t\t\tconst pos = findSectionEndPos(e, sectionId);\n\t\t\t\t\te.commands.insertContentAt(pos, normalised, {\n\t\t\t\t\t\tparseOptions: { preserveWhitespace: true },\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t},\n\t\t\t// ── Formats & actions ─────────────────────────────────────────────\n\t\t\tgetActiveFormats: () =>\n\t\t\t\teditor ? extractActiveFormats(editor) : DEFAULT_FORMAT_STATE,\n\t\t\tactions: {\n\t\t\t\ttoggleBold: () => editor?.chain().focus().toggleBold().run(),\n\t\t\t\ttoggleItalic: () => editor?.chain().focus().toggleItalic().run(),\n\t\t\t\ttoggleUnderline: () => editor?.chain().focus().toggleUnderline().run(),\n\t\t\t\ttoggleStrike: () => editor?.chain().focus().toggleStrike().run(),\n\t\t\t\ttoggleBulletList: () =>\n\t\t\t\t\teditor?.chain().focus().toggleBulletList().run(),\n\t\t\t\ttoggleOrderedList: () =>\n\t\t\t\t\teditor?.chain().focus().toggleOrderedList().run(),\n\t\t\t\ttoggleBlockquote: () =>\n\t\t\t\t\teditor?.chain().focus().toggleBlockquote().run(),\n\t\t\t\ttoggleCodeBlock: () => editor?.chain().focus().toggleCodeBlock().run(),\n\t\t\t\tsetTextAlign: (align) =>\n\t\t\t\t\teditor?.chain().focus().setTextAlign(align).run(),\n\t\t\t\tsetFontFamily: (font) =>\n\t\t\t\t\teditor?.chain().focus().setFontFamily(font).run(),\n\t\t\t\tsetFontSize: (size) => editor?.chain().focus().setFontSize(size).run(),\n\t\t\t\tsetColor: (color) => editor?.chain().focus().setColor(color).run(),\n\t\t\t\tsetHighlight: (color) =>\n\t\t\t\t\teditor?.chain().focus().toggleHighlight({ color }).run(),\n\t\t\t\tunsetColor: () => editor?.chain().focus().unsetColor().run(),\n\t\t\t\tunsetHighlight: () => editor?.chain().focus().unsetHighlight().run(),\n\t\t\t\tsetLink: (href, text) => {\n\t\t\t\t\tif (!editor) return;\n\t\t\t\t\tif (text !== undefined) {\n\t\t\t\t\t\teditor\n\t\t\t\t\t\t\t.chain()\n\t\t\t\t\t\t\t.focus()\n\t\t\t\t\t\t\t.extendMarkRange('link')\n\t\t\t\t\t\t\t.command(({ tr, state }) => {\n\t\t\t\t\t\t\t\tconst { from, to } = tr.selection;\n\t\t\t\t\t\t\t\tconst linkMarkType = state.schema.marks['link'];\n\t\t\t\t\t\t\t\tif (!linkMarkType) return false;\n\t\t\t\t\t\t\t\tconst linkNode = state.schema.text(text, [\n\t\t\t\t\t\t\t\t\tlinkMarkType.create({ href }),\n\t\t\t\t\t\t\t\t]);\n\t\t\t\t\t\t\t\tconst space = state.schema.text(' ');\n\t\t\t\t\t\t\t\ttr.replaceWith(from, to, [linkNode, space]);\n\t\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t.run();\n\t\t\t\t\t} else {\n\t\t\t\t\t\teditor\n\t\t\t\t\t\t\t.chain()\n\t\t\t\t\t\t\t.focus()\n\t\t\t\t\t\t\t.extendMarkRange('link')\n\t\t\t\t\t\t\t.setLink({ href })\n\t\t\t\t\t\t\t.insertContent(' ')\n\t\t\t\t\t\t\t.run();\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tupdateLink: (href) =>\n\t\t\t\t\teditor\n\t\t\t\t\t\t?.chain()\n\t\t\t\t\t\t.focus()\n\t\t\t\t\t\t.extendMarkRange('link')\n\t\t\t\t\t\t.setLink({ href })\n\t\t\t\t\t\t.run(),\n\t\t\t\tremoveLink: () =>\n\t\t\t\t\teditor?.chain().focus().extendMarkRange('link').unsetLink().run(),\n\t\t\t\tinsertEmoji: (emoji) =>\n\t\t\t\t\teditor?.chain().focus().insertContent(emoji).run(),\n\t\t\t\tinsertVariable: (variableName) =>\n\t\t\t\t\teditor?.chain().focus().insertContent(`{{${variableName}}}`).run(),\n\t\t\t\tinsertHtml: (html) =>\n\t\t\t\t\teditor?.commands.insertContent(normalizeHtml(html)),\n\t\t\t\tundo: () => editor?.chain().focus().undo().run(),\n\t\t\t\tredo: () => editor?.chain().focus().redo().run(),\n\t\t\t\tcanUndo: () => editor?.can().undo() ?? false,\n\t\t\t\tcanRedo: () => editor?.can().redo() ?? false,\n\t\t\t\ttoggleSuperscript: () =>\n\t\t\t\t\teditor?.chain().focus().toggleSuperscript().run(),\n\t\t\t\ttoggleSubscript: () => editor?.chain().focus().toggleSubscript().run(),\n\t\t\t\tinsertImage: (src) => editor?.chain().focus().setImage({ src }).run(),\n\t\t\t},\n\t\t}),\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t[editor],\n\t);\n\n\tif (!editor) return null;\n\n\treturn (\n\t\t<BikEditorShell\n\t\t\tminHeight={minHeight}\n\t\t\tmaxHeight={maxHeight}\n\t\t\ttightParagraphs={!features?.richPaste}\n\t\t\tstyle={style}\n\t\t\tclassName={className}\n\t\t>\n\t\t\t<EditorContent editor={editor} />\n\t\t\t<LinkBubbleMenu editor={editor} renderLinkTooltip={link?.renderTooltip} />\n\t\t</BikEditorShell>\n\t);\n};\n\nexport const BikEditor = forwardRef<BikEditorRef, BikEditorProps>(\n\tBikEditorInner,\n);\nBikEditor.displayName = 'BikEditor';\n"],"names":["cssToString","style","k","v","c","BikEditorInner","props","ref","initialContent","sections","features","disabled","maxCharacters","shortcuts","sendShortcut","mentions","slashCommands","link","onPaste","onReady","onChange","onSend","onFocus","onBlur","onSelectionChange","minHeight","maxHeight","className","editorClassName","editorStyle","initialEditorContent","buildSectionedContent","normalizeHtml","s","pendingQueue","useRef","hasCalledOnReady","onReadyRef","onChangeRef","onSelectionChangeRef","prevFormatsRef","DEFAULT_FORMAT_STATE","onFocusRef","onBlurRef","onSendRef","agentMentionsRef","teamMentionsRef","slashCommandsRef","editor","useEditor","buildExtensions","snapshot","extractContent","next","extractActiveFormats","prev","enqueue","op","useEffect","useImperativeHandle","position","e","html","normalised","insertInlineHtml","agentIds","teamIds","node","from","to","pos","state","empty","linkMarkType","range","getMarkRange","sectionId","extractSectionContent","setSectionContentInEditor","endOfBody","targetPos","extractBodyContent","body","boundaryPos","findSectionEndPos","findSectionStartPos","align","font","size","color","href","text","tr","linkNode","space","emoji","variableName","src","jsxs","BikEditorShell","jsx","EditorContent","LinkBubbleMenu","BikEditor","forwardRef"],"mappings":"6ZAsCA,SAASA,GAAYC,EAAoC,CACxD,OAAO,OAAO,QAAQA,CAAK,EACzB,IACA,CAAC,CAACC,EAAGC,CAAC,IAAM,GAAGD,EAAE,QAAQ,WAAaE,GAAM,IAAIA,EAAE,YAAA,CAAa,EAAE,CAAC,IAAID,CAAC,EAAA,EAEvE,KAAK,GAAG,CACX,CAEA,MAAME,GAAiB,CACtBC,EACAC,IACI,CACJ,KAAM,CACL,eAAAC,EACA,SAAAC,EACA,SAAAC,EACA,SAAAC,EACA,cAAAC,EACA,UAAAC,EACA,aAAAC,EACA,SAAAC,EACA,cAAAC,EACA,KAAAC,EACA,QAAAC,EACA,QAAAC,EACA,SAAAC,EACA,OAAAC,EACA,QAAAC,EACA,OAAAC,EACA,kBAAAC,EACA,UAAAC,EACA,UAAAC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MPLEMENTATION LAYER — TipTap-specific.\n * If the underlying editor is swapped, this file changes; BikEditor.types.ts and\n * src/editor/index.ts (the consumer contract) do NOT change.\n */\nimport { Editor, getMarkRange } from '@tiptap/core';\nimport { EditorContent, useEditor } from '@tiptap/react';\nimport React, {\n\tforwardRef,\n\tuseEffect,\n\tuseImperativeHandle,\n\tuseRef,\n\tuseState,\n} from 'react';\nimport { BodyCaption } from '@src/components/TypographyStyle';\nimport { Copy, WandSparkles } from '../icons';\nimport {\n\tBikEditorShell,\n\tBikJsonActions,\n\tBikJsonError,\n} from './BikEditor.styles';\nimport {\n\tBikEditorProps,\n\tBikEditorRef,\n\tDEFAULT_FORMAT_STATE,\n\tFormatState,\n\tJsonParseResult,\n} from './BikEditor.types';\nimport {\n\tbuildJsonCodeBlockHtml,\n\tbuildSectionedContent,\n\textractActiveFormats,\n\textractBodyContent,\n\textractContent,\n\textractSectionContent,\n\tfindSectionEndPos,\n\tfindSectionStartPos,\n\tgetCodeBlockText,\n\tinsertInlineHtml,\n\tnormalizeHtml,\n\tparseJson,\n\tsetCodeBlockText,\n\tsetSectionContentInEditor,\n} from './BikEditor.utils';\nimport { buildExtensions } from './extensions/buildExtensions';\nimport { LinkBubbleMenu } from './floating/LinkBubbleMenu';\n\n/** Convert React.CSSProperties to an inline CSS string for editorProps.attributes. */\nfunction cssToString(style: React.CSSProperties): string {\n\treturn Object.entries(style)\n\t\t.map(\n\t\t\t([k, v]) => `${k.replace(/([A-Z])/g, (c) => `-${c.toLowerCase()}`)}:${v}`,\n\t\t)\n\t\t.join(';');\n}\n\nconst BikEditorInner = (\n\tprops: BikEditorProps,\n\tref: React.Ref<BikEditorRef>,\n) => {\n\tconst {\n\t\tinitialContent,\n\t\tsections,\n\t\tfeatures,\n\t\tdisabled,\n\t\tmaxCharacters,\n\t\tshortcuts,\n\t\tsendShortcut,\n\t\tmentions,\n\t\tslashCommands,\n\t\tlink,\n\t\tonPaste,\n\t\tonReady,\n\t\tonChange,\n\t\tonSend,\n\t\tonFocus,\n\t\tonBlur,\n\t\tonSelectionChange,\n\t\tminHeight,\n\t\tmaxHeight,\n\t\tstyle,\n\t\tclassName,\n\t\teditorClassName,\n\t\teditorStyle,\n\t\trenderJsonError,\n\t} = props;\n\n\tconst isJsonMode = !!features?.jsonMode;\n\n\t// Live JSON parse error, shown inside the editor when jsonMode is on.\n\t// null = valid (or not applicable) → nothing rendered.\n\tconst [jsonError, setJsonError] = useState<JsonParseResult | null>(null);\n\t// Transient \"Copied\" state for the jsonMode copy button.\n\tconst [jsonCopied, setJsonCopied] = useState(false);\n\n\t// JSON body mode: treat initialContent as raw JSON text and wrap it in a code\n\t// block. Skips section/HTML normalisation entirely.\n\tconst initialEditorContent = isJsonMode\n\t\t? buildJsonCodeBlockHtml(initialContent ?? '')\n\t\t: sections?.length\n\t\t? buildSectionedContent(\n\t\t\t\tnormalizeHtml(initialContent ?? ''),\n\t\t\t\tsections.map((s) => ({ ...s, content: normalizeHtml(s.content) })),\n\t\t )\n\t\t: normalizeHtml(initialContent ?? '');\n\n\t// ── Command queue ─────────────────────────────────────────────────────────\n\t// TipTap's useEditor initializes asynchronously; the editor instance is null\n\t// until the first commit. Any imperative method called before the editor is\n\t// ready is enqueued here and flushed automatically once it becomes non-null.\n\t// Consumers never need setTimeout or readiness guards.\n\tconst pendingQueue = useRef<Array<(e: Editor) => void>>([]);\n\tconst hasCalledOnReady = useRef(false);\n\t// Keep stable refs to all callbacks so useEditor receives the same function\n\t// identity on every render — prevents TipTap from re-registering event\n\t// handlers every time the parent re-renders with new inline function props.\n\tconst onReadyRef = useRef(onReady);\n\tonReadyRef.current = onReady;\n\tconst onChangeRef = useRef(onChange);\n\tonChangeRef.current = onChange;\n\tconst onSelectionChangeRef = useRef(onSelectionChange);\n\tonSelectionChangeRef.current = onSelectionChange;\n\tconst prevFormatsRef = useRef<FormatState>(DEFAULT_FORMAT_STATE);\n\tconst onFocusRef = useRef(onFocus);\n\tonFocusRef.current = onFocus;\n\tconst onBlurRef = useRef(onBlur);\n\tonBlurRef.current = onBlur;\n\tconst onSendRef = useRef(onSend);\n\tonSendRef.current = onSend;\n\tconst agentMentionsRef = useRef(mentions?.agents ?? []);\n\tagentMentionsRef.current = mentions?.agents ?? [];\n\tconst teamMentionsRef = useRef(mentions?.teams ?? []);\n\tteamMentionsRef.current = mentions?.teams ?? [];\n\tconst slashCommandsRef = useRef(slashCommands?.items ?? []);\n\tslashCommandsRef.current = slashCommands?.items ?? [];\n\n\tconst editor = useEditor({\n\t\textensions: buildExtensions({\n\t\t\tfeatures,\n\t\t\tplaceholder: props.placeholder,\n\t\t\tmaxCharacters,\n\t\t\thasSections: (sections?.length ?? 0) > 0,\n\t\t\tmentions: {\n\t\t\t\tagents: mentions ? agentMentionsRef : undefined,\n\t\t\t\tteams: mentions ? teamMentionsRef : undefined,\n\t\t\t},\n\t\t\tslashCommands: slashCommands ? slashCommandsRef : undefined,\n\t\t\tonPaste,\n\t\t\tonSend: onSend ? (snapshot) => onSendRef.current?.(snapshot) : undefined,\n\t\t\tsendShortcut,\n\t\t\tshortcuts,\n\t\t\tonMentionSelected: mentions?.onSelect,\n\t\t\tonSlashCommandSelected: slashCommands?.onSelect,\n\t\t\trenderMentionItem: mentions?.renderItem,\n\t\t\trenderMentionDropdown: mentions?.renderDropdown,\n\t\t\tremoveMentionTriggerOnDismiss: mentions?.removeTriggerOnDismiss,\n\t\t\trenderSlashCommandItem: slashCommands?.renderItem,\n\t\t\trenderSlashCommandDropdown: slashCommands?.renderDropdown,\n\t\t}),\n\t\tcontent: initialEditorContent,\n\t\teditable: !disabled,\n\t\timmediatelyRender: false, // SSR-safe — NEVER remove this\n\t\teditorProps: {\n\t\t\tattributes: {\n\t\t\t\t...(editorClassName ? { class: editorClassName } : {}),\n\t\t\t\t...(editorStyle ? { style: cssToString(editorStyle) } : {}),\n\t\t\t},\n\t\t},\n\t\tonUpdate: ({ editor: e }) => {\n\t\t\tonChangeRef.current?.(extractContent(e));\n\t\t\tif (isJsonMode) {\n\t\t\t\tconst result = parseJson(getCodeBlockText(e));\n\t\t\t\tsetJsonError(result.valid ? null : result);\n\t\t\t}\n\t\t},\n\t\tonTransaction: ({ editor: e }) => {\n\t\t\tconst next = extractActiveFormats(e);\n\t\t\tconst prev = prevFormatsRef.current;\n\t\t\tconst changed =\n\t\t\t\tprev.bold !== next.bold ||\n\t\t\t\tprev.italic !== next.italic ||\n\t\t\t\tprev.underline !== next.underline ||\n\t\t\t\tprev.strike !== next.strike ||\n\t\t\t\tprev.bulletList !== next.bulletList ||\n\t\t\t\tprev.orderedList !== next.orderedList ||\n\t\t\t\tprev.blockquote !== next.blockquote ||\n\t\t\t\tprev.codeBlock !== next.codeBlock ||\n\t\t\t\tprev.superscript !== next.superscript ||\n\t\t\t\tprev.subscript !== next.subscript ||\n\t\t\t\tprev.textAlign !== next.textAlign ||\n\t\t\t\tprev.fontFamily !== next.fontFamily ||\n\t\t\t\tprev.fontSize !== next.fontSize ||\n\t\t\t\tprev.color !== next.color ||\n\t\t\t\tprev.highlight !== next.highlight ||\n\t\t\t\tprev.link?.href !== next.link?.href;\n\t\t\tif (changed) {\n\t\t\t\tprevFormatsRef.current = next;\n\t\t\t\tonSelectionChangeRef.current?.(next);\n\t\t\t}\n\t\t},\n\t\tonFocus: () => onFocusRef.current?.(),\n\t\tonBlur: () => onBlurRef.current?.(),\n\t});\n\n\t// ── enqueue ───────────────────────────────────────────────────────────────\n\t// Run immediately if the editor is ready; otherwise defer to the queue.\n\t// Closures passed to enqueue MUST capture all parameters explicitly —\n\t// they must NOT close over `editor` (which would be null at enqueue time).\n\tfunction enqueue(op: (e: Editor) => void): void {\n\t\tif (editor) {\n\t\t\top(editor);\n\t\t} else {\n\t\t\tpendingQueue.current.push(op);\n\t\t}\n\t}\n\n\t// Flush the pending queue and fire onReady when editor transitions null → ready.\n\tuseEffect(() => {\n\t\tif (!editor) return;\n\t\tif (pendingQueue.current.length > 0) {\n\t\t\tconst queue = pendingQueue.current.splice(0);\n\t\t\tqueue.forEach((op) => op(editor));\n\t\t}\n\t\tif (!hasCalledOnReady.current) {\n\t\t\thasCalledOnReady.current = true;\n\t\t\tonReadyRef.current?.();\n\t\t}\n\t\t// Surface an error for invalid initialContent immediately on mount.\n\t\tif (isJsonMode) {\n\t\t\tconst result = parseJson(getCodeBlockText(editor));\n\t\t\tsetJsonError(result.valid ? null : result);\n\t\t}\n\t}, [editor, isJsonMode]);\n\n\tuseImperativeHandle(\n\t\tref,\n\t\t() => ({\n\t\t\t// ── Focus ────────────────────────────────────────────────────────\n\t\t\tfocus: (position) => enqueue((e) => e.commands.focus(position)),\n\t\t\tblur: () => enqueue((e) => e.commands.blur()),\n\n\t\t\t// ── Content ──────────────────────────────────────────────────────\n\t\t\tclearContent: () => enqueue((e) => e.commands.clearContent(true)),\n\t\t\tsetContent: (html) => {\n\t\t\t\tconst normalised = normalizeHtml(html);\n\t\t\t\tenqueue((e) => e.commands.setContent(normalised, { emitUpdate: true }));\n\t\t\t},\n\t\t\tinsertContent: (html) => {\n\t\t\t\tconst normalised = normalizeHtml(html);\n\t\t\t\tenqueue((e) => e.commands.insertContent(normalised));\n\t\t\t},\n\t\t\tinsertInlineContent: (html) => {\n\t\t\t\tenqueue((e) => insertInlineHtml(e, html));\n\t\t\t},\n\t\t\tinsertAtStart: (html) => {\n\t\t\t\tconst normalised = normalizeHtml(html);\n\t\t\t\tenqueue((e) => e.commands.insertContentAt(1, normalised));\n\t\t\t},\n\t\t\tinsertBlock: (html) => {\n\t\t\t\tconst normalised = normalizeHtml(html);\n\t\t\t\tenqueue((e) =>\n\t\t\t\t\te.commands.insertContentAt(e.state.doc.content.size, normalised),\n\t\t\t\t);\n\t\t\t},\n\t\t\tappendInline: (html) => {\n\t\t\t\tconst normalised = normalizeHtml(html);\n\t\t\t\t// doc.content.size is after the last </p> (block boundary).\n\t\t\t\t// Subtract 1 to land inside the last paragraph so text appends\n\t\t\t\t// inline rather than being wrapped in a new paragraph each call.\n\t\t\t\tenqueue((e) =>\n\t\t\t\t\te.commands.insertContentAt(e.state.doc.content.size - 1, normalised),\n\t\t\t\t);\n\t\t\t},\n\t\t\t// Backwards-compatible aliases\n\t\t\tinsertAtEnd(html) {\n\t\t\t\tthis.insertBlock(html);\n\t\t\t},\n\t\t\tappendContent(html) {\n\t\t\t\tthis.appendInline(html);\n\t\t\t},\n\t\t\tgetContent: () =>\n\t\t\t\teditor\n\t\t\t\t\t? extractContent(editor)\n\t\t\t\t\t: { html: '', text: '', isEmpty: true, characterCount: 0 },\n\t\t\tgetJSON: () => editor?.getJSON() ?? null,\n\t\t\tgetMentions: () => {\n\t\t\t\tconst agentIds = new Set<string>();\n\t\t\t\tconst teamIds = new Set<string>();\n\t\t\t\tif (!editor) return { agentIds: [], teamIds: [] };\n\t\t\t\teditor.state.doc.descendants((node) => {\n\t\t\t\t\tif (node.type.name === 'mentionAgent' && node.attrs['id'] != null) {\n\t\t\t\t\t\tagentIds.add(String(node.attrs['id']));\n\t\t\t\t\t} else if (\n\t\t\t\t\t\tnode.type.name === 'mentionTeam' &&\n\t\t\t\t\t\tnode.attrs['id'] != null\n\t\t\t\t\t) {\n\t\t\t\t\t\tteamIds.add(String(node.attrs['id']));\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\treturn { agentIds: Array.from(agentIds), teamIds: Array.from(teamIds) };\n\t\t\t},\n\n\t\t\t// ── Selection ────────────────────────────────────────────────────\n\t\t\tgetCursorPosition: () => {\n\t\t\t\tif (!editor) return { from: 0, to: 0 };\n\t\t\t\tconst { from, to } = editor.state.selection;\n\t\t\t\treturn { from, to };\n\t\t\t},\n\t\t\tinsertAtPosition: (pos, html) => {\n\t\t\t\tconst normalised = normalizeHtml(html);\n\t\t\t\tenqueue((e) => e.commands.insertContentAt(pos, normalised));\n\t\t\t},\n\t\t\tgetSelectedText: () => {\n\t\t\t\tif (!editor) return '';\n\t\t\t\tconst { state } = editor;\n\t\t\t\tconst { from, to, empty } = state.selection;\n\t\t\t\tif (!empty) {\n\t\t\t\t\treturn state.doc.textBetween(from, to, ' ');\n\t\t\t\t}\n\t\t\t\t// When the cursor is inside a link with nothing selected, return the\n\t\t\t\t// full link text — useful for pre-filling a link modal's text field.\n\t\t\t\tconst linkMarkType = state.schema.marks['link'];\n\t\t\t\tif (linkMarkType) {\n\t\t\t\t\tconst range = getMarkRange(state.doc.resolve(from), linkMarkType);\n\t\t\t\t\tif (range) {\n\t\t\t\t\t\treturn state.doc.textBetween(range.from, range.to, ' ');\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn '';\n\t\t\t},\n\n\t\t\t// ── Character count ───────────────────────────────────────────────\n\t\t\tgetCharacterCount: () => ({\n\t\t\t\tcount:\n\t\t\t\t\teditor?.storage.characterCount?.characters?.() ??\n\t\t\t\t\teditor?.getText().length ??\n\t\t\t\t\t0,\n\t\t\t\tlimit: maxCharacters ?? null,\n\t\t\t}),\n\n\t\t\t// ── Sections ─────────────────────────────────────────────────────\n\t\t\tgetSectionContent: (sectionId) =>\n\t\t\t\teditor\n\t\t\t\t\t? extractSectionContent(editor, sectionId)\n\t\t\t\t\t: { html: '', text: '', isEmpty: true, characterCount: 0 },\n\n\t\t\tsetSectionContent: (sectionId, html) => {\n\t\t\t\tconst normalised = normalizeHtml(html);\n\t\t\t\tenqueue((e) => setSectionContentInEditor(e, sectionId, normalised));\n\t\t\t},\n\n\t\t\tfocusSection: (sectionId) => {\n\t\t\t\tenqueue((e) => {\n\t\t\t\t\tif (sectionId === 'body') {\n\t\t\t\t\t\tlet endOfBody = e.state.doc.content.size - 1;\n\t\t\t\t\t\te.state.doc.descendants((node, pos) => {\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tnode.type.name === 'sectionDivider' &&\n\t\t\t\t\t\t\t\tendOfBody === e.state.doc.content.size - 1\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tendOfBody = pos - 1;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn endOfBody === e.state.doc.content.size - 1;\n\t\t\t\t\t\t});\n\t\t\t\t\t\tif (endOfBody < 1) endOfBody = 1;\n\t\t\t\t\t\te.chain().focus().setTextSelection(endOfBody).run();\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tlet targetPos = -1;\n\t\t\t\t\te.state.doc.descendants((node, pos) => {\n\t\t\t\t\t\tif (targetPos !== -1) return false;\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tnode.type.name === 'sectionDivider' &&\n\t\t\t\t\t\t\tnode.attrs['sectionId'] === sectionId\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t// pos + nodeSize lands right after the divider;\n\t\t\t\t\t\t\t// +1 more puts us inside the first paragraph of that section.\n\t\t\t\t\t\t\ttargetPos = pos + node.nodeSize + 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t\tif (targetPos !== -1) {\n\t\t\t\t\t\te.chain().focus().setTextSelection(targetPos).run();\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t},\n\n\t\t\tclearSection: (sectionId) => {\n\t\t\t\tenqueue((e) => setSectionContentInEditor(e, sectionId, '<p></p>'));\n\t\t\t},\n\n\t\t\t// ── Convenience body shorthands ───────────────────────────────────\n\t\t\tgetBodyContent: () =>\n\t\t\t\teditor\n\t\t\t\t\t? extractBodyContent(editor)\n\t\t\t\t\t: { html: '', text: '', isEmpty: true, characterCount: 0 },\n\t\t\tsetBodyContent: (html) => {\n\t\t\t\tconst normalised = normalizeHtml(html);\n\t\t\t\tenqueue((e) => setSectionContentInEditor(e, 'body', normalised));\n\t\t\t},\n\t\t\tsetBodyAndSections: (body, sections) => {\n\t\t\t\tconst html = buildSectionedContent(\n\t\t\t\t\tnormalizeHtml(body),\n\t\t\t\t\tsections.map((s) => ({\n\t\t\t\t\t\tid: s.id,\n\t\t\t\t\t\tcontent: normalizeHtml(s.content),\n\t\t\t\t\t})),\n\t\t\t\t);\n\t\t\t\tenqueue((e) => e.commands.setContent(html, { emitUpdate: true }));\n\t\t\t},\n\t\t\tappendBodyContent: (html) => {\n\t\t\t\tconst normalised = normalizeHtml(html);\n\t\t\t\t// findSectionEndPos returns the position of the first divider (or\n\t\t\t\t// doc.content.size), which is the block boundary after the last </p>.\n\t\t\t\t// Subtract 1 to stay inside the last paragraph so successive calls\n\t\t\t\t// append inline text rather than creating a new paragraph each time.\n\t\t\t\tenqueue((e) => {\n\t\t\t\t\tconst boundaryPos = findSectionEndPos(e, 'body');\n\t\t\t\t\te.commands.insertContentAt(boundaryPos - 1, normalised, {\n\t\t\t\t\t\tparseOptions: { preserveWhitespace: true },\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t},\n\t\t\tinsertAtSectionStart: (sectionId, html) => {\n\t\t\t\tconst normalised = normalizeHtml(html);\n\t\t\t\tenqueue((e) => {\n\t\t\t\t\tconst pos = findSectionStartPos(e, sectionId);\n\t\t\t\t\tif (pos !== -1)\n\t\t\t\t\t\te.commands.insertContentAt(pos, normalised, {\n\t\t\t\t\t\t\tparseOptions: { preserveWhitespace: true },\n\t\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t},\n\t\t\tinsertAtSectionEnd: (sectionId, html) => {\n\t\t\t\tconst normalised = normalizeHtml(html);\n\t\t\t\tenqueue((e) => {\n\t\t\t\t\tconst pos = findSectionEndPos(e, sectionId);\n\t\t\t\t\te.commands.insertContentAt(pos, normalised, {\n\t\t\t\t\t\tparseOptions: { preserveWhitespace: true },\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t},\n\t\t\t// ── Formats & actions ─────────────────────────────────────────────\n\t\t\tgetActiveFormats: () =>\n\t\t\t\teditor ? extractActiveFormats(editor) : DEFAULT_FORMAT_STATE,\n\t\t\tactions: {\n\t\t\t\ttoggleBold: () => editor?.chain().focus().toggleBold().run(),\n\t\t\t\ttoggleItalic: () => editor?.chain().focus().toggleItalic().run(),\n\t\t\t\ttoggleUnderline: () => editor?.chain().focus().toggleUnderline().run(),\n\t\t\t\ttoggleStrike: () => editor?.chain().focus().toggleStrike().run(),\n\t\t\t\ttoggleBulletList: () =>\n\t\t\t\t\teditor?.chain().focus().toggleBulletList().run(),\n\t\t\t\ttoggleOrderedList: () =>\n\t\t\t\t\teditor?.chain().focus().toggleOrderedList().run(),\n\t\t\t\ttoggleBlockquote: () =>\n\t\t\t\t\teditor?.chain().focus().toggleBlockquote().run(),\n\t\t\t\ttoggleCodeBlock: () => editor?.chain().focus().toggleCodeBlock().run(),\n\t\t\t\tsetTextAlign: (align) =>\n\t\t\t\t\teditor?.chain().focus().setTextAlign(align).run(),\n\t\t\t\tsetFontFamily: (font) =>\n\t\t\t\t\teditor?.chain().focus().setFontFamily(font).run(),\n\t\t\t\tsetFontSize: (size) => editor?.chain().focus().setFontSize(size).run(),\n\t\t\t\tsetColor: (color) => editor?.chain().focus().setColor(color).run(),\n\t\t\t\tsetHighlight: (color) =>\n\t\t\t\t\teditor?.chain().focus().toggleHighlight({ color }).run(),\n\t\t\t\tunsetColor: () => editor?.chain().focus().unsetColor().run(),\n\t\t\t\tunsetHighlight: () => editor?.chain().focus().unsetHighlight().run(),\n\t\t\t\tsetLink: (href, text) => {\n\t\t\t\t\tif (!editor) return;\n\t\t\t\t\tif (text !== undefined) {\n\t\t\t\t\t\teditor\n\t\t\t\t\t\t\t.chain()\n\t\t\t\t\t\t\t.focus()\n\t\t\t\t\t\t\t.extendMarkRange('link')\n\t\t\t\t\t\t\t.command(({ tr, state }) => {\n\t\t\t\t\t\t\t\tconst { from, to } = tr.selection;\n\t\t\t\t\t\t\t\tconst linkMarkType = state.schema.marks['link'];\n\t\t\t\t\t\t\t\tif (!linkMarkType) return false;\n\t\t\t\t\t\t\t\tconst linkNode = state.schema.text(text, [\n\t\t\t\t\t\t\t\t\tlinkMarkType.create({ href }),\n\t\t\t\t\t\t\t\t]);\n\t\t\t\t\t\t\t\tconst space = state.schema.text(' ');\n\t\t\t\t\t\t\t\ttr.replaceWith(from, to, [linkNode, space]);\n\t\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t.run();\n\t\t\t\t\t} else {\n\t\t\t\t\t\teditor\n\t\t\t\t\t\t\t.chain()\n\t\t\t\t\t\t\t.focus()\n\t\t\t\t\t\t\t.extendMarkRange('link')\n\t\t\t\t\t\t\t.setLink({ href })\n\t\t\t\t\t\t\t.insertContent(' ')\n\t\t\t\t\t\t\t.run();\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tupdateLink: (href) =>\n\t\t\t\t\teditor\n\t\t\t\t\t\t?.chain()\n\t\t\t\t\t\t.focus()\n\t\t\t\t\t\t.extendMarkRange('link')\n\t\t\t\t\t\t.setLink({ href })\n\t\t\t\t\t\t.run(),\n\t\t\t\tremoveLink: () =>\n\t\t\t\t\teditor?.chain().focus().extendMarkRange('link').unsetLink().run(),\n\t\t\t\tinsertEmoji: (emoji) =>\n\t\t\t\t\teditor?.chain().focus().insertContent(emoji).run(),\n\t\t\t\tinsertVariable: (variableName) =>\n\t\t\t\t\teditor?.chain().focus().insertContent(`{{${variableName}}}`).run(),\n\t\t\t\tinsertHtml: (html) =>\n\t\t\t\t\teditor?.commands.insertContent(normalizeHtml(html)),\n\t\t\t\tundo: () => editor?.chain().focus().undo().run(),\n\t\t\t\tredo: () => editor?.chain().focus().redo().run(),\n\t\t\t\tcanUndo: () => editor?.can().undo() ?? false,\n\t\t\t\tcanRedo: () => editor?.can().redo() ?? false,\n\t\t\t\ttoggleSuperscript: () =>\n\t\t\t\t\teditor?.chain().focus().toggleSuperscript().run(),\n\t\t\t\ttoggleSubscript: () => editor?.chain().focus().toggleSubscript().run(),\n\t\t\t\tinsertImage: (src) => editor?.chain().focus().setImage({ src }).run(),\n\t\t\t},\n\n\t\t\t// ── JSON body ─────────────────────────────────────────────────────\n\t\t\tjson: features?.jsonMode\n\t\t\t\t? {\n\t\t\t\t\t\tgetText: () => (editor ? getCodeBlockText(editor) : ''),\n\t\t\t\t\t\tsetText: (raw) => enqueue((e) => setCodeBlockText(e, raw)),\n\t\t\t\t\t\tparse: () => parseJson(editor ? getCodeBlockText(editor) : ''),\n\t\t\t\t\t\tisValid: () =>\n\t\t\t\t\t\t\tparseJson(editor ? getCodeBlockText(editor) : '').valid,\n\t\t\t\t\t\tformat: (indent = 2) =>\n\t\t\t\t\t\t\tenqueue((e) => {\n\t\t\t\t\t\t\t\tconst { valid, value } = parseJson(getCodeBlockText(e));\n\t\t\t\t\t\t\t\tif (!valid || value === null) return;\n\t\t\t\t\t\t\t\tsetCodeBlockText(e, JSON.stringify(value, null, indent));\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\tminify: () =>\n\t\t\t\t\t\t\tenqueue((e) => {\n\t\t\t\t\t\t\t\tconst { valid, value } = parseJson(getCodeBlockText(e));\n\t\t\t\t\t\t\t\tif (!valid || value === null) return;\n\t\t\t\t\t\t\t\tsetCodeBlockText(e, JSON.stringify(value));\n\t\t\t\t\t\t\t}),\n\t\t\t\t }\n\t\t\t\t: undefined,\n\t\t}),\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t[editor],\n\t);\n\n\t// ── jsonMode floating actions ────────────────────────────────────────────\n\t// Beautify pretty-prints in place (no-op / disabled while the JSON is broken);\n\t// Copy writes the raw text to the clipboard with transient feedback.\n\tconst handleJsonBeautify = () => {\n\t\tif (!editor) return;\n\t\tconst { valid, value } = parseJson(getCodeBlockText(editor));\n\t\tif (!valid || value === null) return;\n\t\tsetCodeBlockText(editor, JSON.stringify(value, null, 2));\n\t};\n\tconst handleJsonCopy = () => {\n\t\tif (!editor) return;\n\t\tvoid navigator.clipboard?.writeText(getCodeBlockText(editor));\n\t\tsetJsonCopied(true);\n\t\tsetTimeout(() => setJsonCopied(false), 1500);\n\t};\n\n\tif (!editor) return null;\n\n\treturn (\n\t\t<BikEditorShell\n\t\t\tminHeight={minHeight}\n\t\t\tmaxHeight={maxHeight}\n\t\t\ttightParagraphs={!features?.richPaste}\n\t\t\tjsonMode={isJsonMode}\n\t\t\tstyle={style}\n\t\t\tclassName={className}\n\t\t>\n\t\t\t<EditorContent editor={editor} />\n\t\t\t{isJsonMode && (\n\t\t\t\t<BikJsonActions>\n\t\t\t\t\t<button\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tonClick={handleJsonBeautify}\n\t\t\t\t\t\tdisabled={!!jsonError}\n\t\t\t\t\t\ttitle=\"Format JSON\"\n\t\t\t\t\t\tstyle={{ padding: 8 }}\n\t\t\t\t\t>\n\t\t\t\t\t\t<WandSparkles size={16} />\n\t\t\t\t\t\t<BodyCaption> Beautify </BodyCaption>\n\t\t\t\t\t</button>\n\t\t\t\t\t<button\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tonClick={handleJsonCopy}\n\t\t\t\t\t\ttitle=\"Copy JSON\"\n\t\t\t\t\t\tstyle={{ padding: 8 }}\n\t\t\t\t\t>\n\t\t\t\t\t\t<Copy size={16} />\n\t\t\t\t\t\t{jsonCopied && <BodyCaption> Copied </BodyCaption>}\n\t\t\t\t\t</button>\n\t\t\t\t</BikJsonActions>\n\t\t\t)}\n\t\t\t<LinkBubbleMenu editor={editor} renderLinkTooltip={link?.renderTooltip} />\n\t\t\t{isJsonMode && jsonError ? (\n\t\t\t\trenderJsonError ? (\n\t\t\t\t\trenderJsonError(jsonError)\n\t\t\t\t) : (\n\t\t\t\t\t<BikJsonError>\n\t\t\t\t\t\t{jsonError.line != null && (\n\t\t\t\t\t\t\t<strong>\n\t\t\t\t\t\t\t\tLine {jsonError.line}\n\t\t\t\t\t\t\t\t{jsonError.column != null ? `, column ${jsonError.column}` : ''}\n\t\t\t\t\t\t\t\t:{' '}\n\t\t\t\t\t\t\t</strong>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{jsonError.error}\n\t\t\t\t\t</BikJsonError>\n\t\t\t\t)\n\t\t\t) : null}\n\t\t</BikEditorShell>\n\t);\n};\n\nexport const BikEditor = forwardRef<BikEditorRef, BikEditorProps>(\n\tBikEditorInner,\n);\nBikEditor.displayName = 'BikEditor';\n"],"names":["cssToString","style","k","v","c","BikEditorInner","props","ref","initialContent","sections","features","disabled","maxCharacters","shortcuts","sendShortcut","mentions","slashCommands","link","onPaste","onReady","onChange","onSend","onFocus","onBlur","onSelectionChange","minHeight","maxHeight","className","editorClassName","editorStyle","renderJsonError","isJsonMode","jsonError","setJsonError","useState","jsonCopied","setJsonCopied","initialEditorContent","buildJsonCodeBlockHtml","buildSectionedContent","normalizeHtml","s","pendingQueue","useRef","hasCalledOnReady","onReadyRef","onChangeRef","onSelectionChangeRef","prevFormatsRef","DEFAULT_FORMAT_STATE","onFocusRef","onBlurRef","onSendRef","agentMentionsRef","teamMentionsRef","slashCommandsRef","editor","useEditor","buildExtensions","snapshot","extractContent","result","parseJson","getCodeBlockText","next","extractActiveFormats","prev","enqueue","op","useEffect","useImperativeHandle","position","e","html","normalised","insertInlineHtml","agentIds","teamIds","node","from","to","pos","state","empty","linkMarkType","range","getMarkRange","sectionId","extractSectionContent","setSectionContentInEditor","endOfBody","targetPos","extractBodyContent","body","boundaryPos","findSectionEndPos","findSectionStartPos","align","font","size","color","href","text","tr","linkNode","space","emoji","variableName","src","raw","setCodeBlockText","indent","valid","value","handleJsonBeautify","handleJsonCopy","jsxs","BikEditorShell","jsx","EditorContent","BikJsonActions","WandSparkles","BodyCaption","Copy","LinkBubbleMenu","BikJsonError","BikEditor","forwardRef"],"mappings":"mjBAkDA,SAASA,GAAYC,EAAoC,CACxD,OAAO,OAAO,QAAQA,CAAK,EACzB,IACA,CAAC,CAACC,EAAGC,CAAC,IAAM,GAAGD,EAAE,QAAQ,WAAaE,GAAM,IAAIA,EAAE,YAAA,CAAa,EAAE,CAAC,IAAID,CAAC,EAAA,EAEvE,KAAK,GAAG,CACX,CAEA,MAAME,GAAiB,CACtBC,EACAC,IACI,CACJ,KAAM,CACL,eAAAC,EACA,SAAAC,EACA,SAAAC,EACA,SAAAC,EACA,cAAAC,EACA,UAAAC,EACA,aAAAC,EACA,SAAAC,EACA,cAAAC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,WACxB1H,EACD,EACAyH,EAAU,YAAc"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("styled-components"),t=require("../constants/Theme.js"),r=e=>e&&typeof e=="object"&&"default"in e?e:{default:e},
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("styled-components"),t=require("../constants/Theme.js"),r=e=>e&&typeof e=="object"&&"default"in e?e:{default:e},o=r(i),n=o.default.div`
|
|
2
2
|
position: relative;
|
|
3
3
|
width: 100%;
|
|
4
4
|
|
|
@@ -68,6 +68,82 @@
|
|
|
68
68
|
.bik-variable {
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
+
/* JSON body mode — scoped so normal-mode code blocks keep their default look
|
|
72
|
+
(no reserved gutter, no monospace override). */
|
|
73
|
+
${({jsonMode:e})=>e&&i.css`
|
|
74
|
+
/* The code block IS the editor surface. Put the grey on the scroller so
|
|
75
|
+
it always fills the min-height (no blank strip below short JSON) and
|
|
76
|
+
drop the frame padding so it reaches the edges. */
|
|
77
|
+
.ProseMirror {
|
|
78
|
+
padding: 0;
|
|
79
|
+
background: #f6f8fa;
|
|
80
|
+
}
|
|
81
|
+
/* ProseMirror appends an empty trailing paragraph AFTER the code block
|
|
82
|
+
(a <p><br class="ProseMirror-trailingBreak"></p> caret-escape node).
|
|
83
|
+
In JSON mode there's nothing to escape to — it only renders as a blank
|
|
84
|
+
line under the JSON, which is the "extra space at the bottom". Hide it. */
|
|
85
|
+
.ProseMirror pre + p {
|
|
86
|
+
display: none;
|
|
87
|
+
}
|
|
88
|
+
.ProseMirror pre {
|
|
89
|
+
position: relative;
|
|
90
|
+
margin: 0;
|
|
91
|
+
background: transparent;
|
|
92
|
+
/* Left padding reserves the line-number gutter; the extra top padding
|
|
93
|
+
keeps line 1 clear of the floating Beautify/Copy actions. Each
|
|
94
|
+
.bik-json-lineno widget hangs back into the left padding with a
|
|
95
|
+
matching negative margin. */
|
|
96
|
+
padding: 34px 12px 12px 3.5em;
|
|
97
|
+
font-family: 'SFMono-Regular', ui-monospace, 'JetBrains Mono', Menlo,
|
|
98
|
+
Consolas, 'Liberation Mono', monospace;
|
|
99
|
+
font-size: 13px;
|
|
100
|
+
line-height: 1.6;
|
|
101
|
+
white-space: pre;
|
|
102
|
+
overflow-x: auto;
|
|
103
|
+
tab-size: 2;
|
|
104
|
+
}
|
|
105
|
+
.ProseMirror pre code {
|
|
106
|
+
background: none;
|
|
107
|
+
padding: 0;
|
|
108
|
+
font-size: inherit;
|
|
109
|
+
color: #1f2328;
|
|
110
|
+
}
|
|
111
|
+
/* Line-number gutter. Numbers hang into the code block's left padding via
|
|
112
|
+
a negative margin (width + margin-right == the reserved padding, so the
|
|
113
|
+
code text still starts at the padding edge). Stacked right borders form
|
|
114
|
+
one continuous divider line. */
|
|
115
|
+
.bik-json-lineno {
|
|
116
|
+
display: inline-block;
|
|
117
|
+
box-sizing: border-box;
|
|
118
|
+
width: 2.5em;
|
|
119
|
+
margin-left: -3.5em;
|
|
120
|
+
margin-right: 1em;
|
|
121
|
+
padding-right: 0.7em;
|
|
122
|
+
text-align: right;
|
|
123
|
+
color: #8c959f;
|
|
124
|
+
border-right: 1px solid #e1e4e8;
|
|
125
|
+
user-select: none;
|
|
126
|
+
-webkit-user-select: none;
|
|
127
|
+
}
|
|
128
|
+
.bik-json-key {
|
|
129
|
+
color: #0550ae;
|
|
130
|
+
}
|
|
131
|
+
.bik-json-string {
|
|
132
|
+
color: #0a7d33;
|
|
133
|
+
}
|
|
134
|
+
.bik-json-number {
|
|
135
|
+
color: #b5590a;
|
|
136
|
+
}
|
|
137
|
+
.bik-json-boolean,
|
|
138
|
+
.bik-json-null {
|
|
139
|
+
color: #8250df;
|
|
140
|
+
font-weight: 500;
|
|
141
|
+
}
|
|
142
|
+
.bik-json-punct {
|
|
143
|
+
color: #57606a;
|
|
144
|
+
}
|
|
145
|
+
`}
|
|
146
|
+
|
|
71
147
|
a,
|
|
72
148
|
.bik-link {
|
|
73
149
|
color: #4f46e5;
|
|
@@ -80,5 +156,49 @@
|
|
|
80
156
|
text-decoration-color: #6366f1;
|
|
81
157
|
}
|
|
82
158
|
}
|
|
83
|
-
|
|
159
|
+
`,a=o.default.div`
|
|
160
|
+
position: absolute;
|
|
161
|
+
top: 6px;
|
|
162
|
+
right: 6px;
|
|
163
|
+
z-index: 2;
|
|
164
|
+
display: flex;
|
|
165
|
+
gap: 6px;
|
|
166
|
+
|
|
167
|
+
button {
|
|
168
|
+
display: inline-flex;
|
|
169
|
+
align-items: center;
|
|
170
|
+
gap: 4px;
|
|
171
|
+
padding: 8px;
|
|
172
|
+
font-family: inherit;
|
|
173
|
+
font-size: 12px;
|
|
174
|
+
line-height: 1.4;
|
|
175
|
+
color: #57606a;
|
|
176
|
+
background: rgba(255, 255, 255, 0.85);
|
|
177
|
+
backdrop-filter: blur(2px);
|
|
178
|
+
border: 1px solid #e0e0e0;
|
|
179
|
+
border-radius: 4px;
|
|
180
|
+
cursor: pointer;
|
|
181
|
+
|
|
182
|
+
&:hover:not(:disabled) {
|
|
183
|
+
background: #ffffff;
|
|
184
|
+
border-color: #adb5bd;
|
|
185
|
+
}
|
|
186
|
+
&:disabled {
|
|
187
|
+
opacity: 0.5;
|
|
188
|
+
cursor: not-allowed;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
`,d=o.default.div`
|
|
192
|
+
padding: 6px 12px;
|
|
193
|
+
font-size: 12px;
|
|
194
|
+
line-height: 1.5;
|
|
195
|
+
color: #d1242f;
|
|
196
|
+
background: #fff0f0;
|
|
197
|
+
border-top: 1px solid #ffd7d5;
|
|
198
|
+
word-break: break-word;
|
|
199
|
+
|
|
200
|
+
strong {
|
|
201
|
+
font-weight: 600;
|
|
202
|
+
}
|
|
203
|
+
`;exports.BikEditorShell=n;exports.BikJsonActions=a;exports.BikJsonError=d;
|
|
84
204
|
//# sourceMappingURL=BikEditor.styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BikEditor.styles.js","sources":["../../../src/editor/BikEditor.styles.ts"],"sourcesContent":["import styled from 'styled-components';\nimport { COLORS } from '../constants/Theme';\n\nexport const BikEditorShell = styled.div<{\n\tminHeight?: string;\n\tmaxHeight?: string;\n\ttightParagraphs?: boolean;\n}>`\n\tposition: relative;\n\twidth: 100%;\n\n\t.ProseMirror {\n\t\tmin-height: ${({ minHeight }) => minHeight ?? '80px'};\n\t\tmax-height: ${({ maxHeight }) => maxHeight ?? 'none'};\n\t\toverflow-y: auto;\n\t\toutline: none;\n\t\tpadding: 8px 12px;\n\t\tfont-size: 14px;\n\t\tline-height: 1.5;\n\t\tword-break: break-word;\n\n\t\t/* Paragraph spacing.\n\t\t Email/signature (rich): paragraphs carry the browser-default 1em block\n\t\t margin — the SAME spacing the sent HTML gets (we emit plain <p>, which\n\t\t renders against the default <p> margin in Gmail and our email viewer),\n\t\t so editor view == emitted HTML == Gmail. A single Enter = a new\n\t\t paragraph with a visible gap, like pasted Gmail/ChatGPT/Docs content.\n\t\t Other channels (WhatsApp/IG/FB/comments) are plain-text messaging, with\n\t\t no paragraph-gap concept — paragraphs are tight (margin:0) regardless of\n\t\t typed vs pasted. (A margin:0 attr still overrides to tight either way.) */\n\t\tp {\n\t\t\tmargin: ${({ tightParagraphs }) => (tightParagraphs ? '0' : '1em 0')};\n\t\t\tpadding: 0;\n\t\t}\n\n\t\tul,\n\t\tol {\n\t\t\tmargin: 0;\n\t\t\tpadding-left: 1.5em;\n\t\t}\n\n\t\tli + li {\n\t\t\tmargin-top: 2px;\n\t\t}\n\n\t\tp.is-editor-empty:first-child::before {\n\t\t\tcontent: attr(data-placeholder);\n\t\t\tfloat: left;\n\t\t\tcolor: #adb5bd;\n\t\t\tpointer-events: none;\n\t\t\theight: 0;\n\t\t}\n\t}\n\n\t.bik-mention {\n\t\tcolor: ${COLORS.content.brand};\n\t\tpadding: 1px 4px;\n\t}\n\t.bik-mention--team {\n\t\tcolor: ${COLORS.content.brand};\n\t}\n\t/* Typed mention chips (agent-builder): distinct colour per reference kind. */\n\t.bik-mention[data-kind='tool'] {\n\t\tcolor: #1570ef;\n\t\tbackground: #eff8ff;\n\t\tborder-radius: 4px;\n\t\tfont-weight: 500;\n\t}\n\t.bik-mention[data-kind='subagent'] {\n\t\tcolor: #6938ef;\n\t\tbackground: #f4f3ff;\n\t\tborder-radius: 4px;\n\t\tfont-weight: 500;\n\t}\n\t.bik-variable {\n\t}\n\n\ta,\n\t.bik-link {\n\t\tcolor: #4f46e5;\n\t\ttext-decoration: underline;\n\t\ttext-decoration-color: #a5b4fc;\n\t\ttext-underline-offset: 2px;\n\t\tcursor: pointer;\n\t\t&:hover {\n\t\t\tcolor: #3730a3;\n\t\t\ttext-decoration-color: #6366f1;\n\t\t}\n\t}\n`;\n"],"names":["BikEditorShell","styled","minHeight","maxHeight","tightParagraphs","COLORS"],"mappings":"uNAGaA,EAAiBC,EAAAA,QAAO;AAAA;AAAA;AAAA;AAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"BikEditor.styles.js","sources":["../../../src/editor/BikEditor.styles.ts"],"sourcesContent":["import styled, { css } from 'styled-components';\nimport { COLORS } from '../constants/Theme';\n\nexport const BikEditorShell = styled.div<{\n\tminHeight?: string;\n\tmaxHeight?: string;\n\ttightParagraphs?: boolean;\n\tjsonMode?: boolean;\n}>`\n\tposition: relative;\n\twidth: 100%;\n\n\t.ProseMirror {\n\t\tmin-height: ${({ minHeight }) => minHeight ?? '80px'};\n\t\tmax-height: ${({ maxHeight }) => maxHeight ?? 'none'};\n\t\toverflow-y: auto;\n\t\toutline: none;\n\t\tpadding: 8px 12px;\n\t\tfont-size: 14px;\n\t\tline-height: 1.5;\n\t\tword-break: break-word;\n\n\t\t/* Paragraph spacing.\n\t\t Email/signature (rich): paragraphs carry the browser-default 1em block\n\t\t margin — the SAME spacing the sent HTML gets (we emit plain <p>, which\n\t\t renders against the default <p> margin in Gmail and our email viewer),\n\t\t so editor view == emitted HTML == Gmail. A single Enter = a new\n\t\t paragraph with a visible gap, like pasted Gmail/ChatGPT/Docs content.\n\t\t Other channels (WhatsApp/IG/FB/comments) are plain-text messaging, with\n\t\t no paragraph-gap concept — paragraphs are tight (margin:0) regardless of\n\t\t typed vs pasted. (A margin:0 attr still overrides to tight either way.) */\n\t\tp {\n\t\t\tmargin: ${({ tightParagraphs }) => (tightParagraphs ? '0' : '1em 0')};\n\t\t\tpadding: 0;\n\t\t}\n\n\t\tul,\n\t\tol {\n\t\t\tmargin: 0;\n\t\t\tpadding-left: 1.5em;\n\t\t}\n\n\t\tli + li {\n\t\t\tmargin-top: 2px;\n\t\t}\n\n\t\tp.is-editor-empty:first-child::before {\n\t\t\tcontent: attr(data-placeholder);\n\t\t\tfloat: left;\n\t\t\tcolor: #adb5bd;\n\t\t\tpointer-events: none;\n\t\t\theight: 0;\n\t\t}\n\t}\n\n\t.bik-mention {\n\t\tcolor: ${COLORS.content.brand};\n\t\tpadding: 1px 4px;\n\t}\n\t.bik-mention--team {\n\t\tcolor: ${COLORS.content.brand};\n\t}\n\t/* Typed mention chips (agent-builder): distinct colour per reference kind. */\n\t.bik-mention[data-kind='tool'] {\n\t\tcolor: #1570ef;\n\t\tbackground: #eff8ff;\n\t\tborder-radius: 4px;\n\t\tfont-weight: 500;\n\t}\n\t.bik-mention[data-kind='subagent'] {\n\t\tcolor: #6938ef;\n\t\tbackground: #f4f3ff;\n\t\tborder-radius: 4px;\n\t\tfont-weight: 500;\n\t}\n\t.bik-variable {\n\t}\n\n\t/* JSON body mode — scoped so normal-mode code blocks keep their default look\n\t (no reserved gutter, no monospace override). */\n\t${({ jsonMode }) =>\n\t\tjsonMode &&\n\t\tcss`\n\t\t\t/* The code block IS the editor surface. Put the grey on the scroller so\n\t\t\t it always fills the min-height (no blank strip below short JSON) and\n\t\t\t drop the frame padding so it reaches the edges. */\n\t\t\t.ProseMirror {\n\t\t\t\tpadding: 0;\n\t\t\t\tbackground: #f6f8fa;\n\t\t\t}\n\t\t\t/* ProseMirror appends an empty trailing paragraph AFTER the code block\n\t\t\t (a <p><br class=\"ProseMirror-trailingBreak\"></p> caret-escape node).\n\t\t\t In JSON mode there's nothing to escape to — it only renders as a blank\n\t\t\t line under the JSON, which is the \"extra space at the bottom\". Hide it. */\n\t\t\t.ProseMirror pre + p {\n\t\t\t\tdisplay: none;\n\t\t\t}\n\t\t\t.ProseMirror pre {\n\t\t\t\tposition: relative;\n\t\t\t\tmargin: 0;\n\t\t\t\tbackground: transparent;\n\t\t\t\t/* Left padding reserves the line-number gutter; the extra top padding\n\t\t\t\t keeps line 1 clear of the floating Beautify/Copy actions. Each\n\t\t\t\t .bik-json-lineno widget hangs back into the left padding with a\n\t\t\t\t matching negative margin. */\n\t\t\t\tpadding: 34px 12px 12px 3.5em;\n\t\t\t\tfont-family: 'SFMono-Regular', ui-monospace, 'JetBrains Mono', Menlo,\n\t\t\t\t\tConsolas, 'Liberation Mono', monospace;\n\t\t\t\tfont-size: 13px;\n\t\t\t\tline-height: 1.6;\n\t\t\t\twhite-space: pre;\n\t\t\t\toverflow-x: auto;\n\t\t\t\ttab-size: 2;\n\t\t\t}\n\t\t\t.ProseMirror pre code {\n\t\t\t\tbackground: none;\n\t\t\t\tpadding: 0;\n\t\t\t\tfont-size: inherit;\n\t\t\t\tcolor: #1f2328;\n\t\t\t}\n\t\t\t/* Line-number gutter. Numbers hang into the code block's left padding via\n\t\t\t a negative margin (width + margin-right == the reserved padding, so the\n\t\t\t code text still starts at the padding edge). Stacked right borders form\n\t\t\t one continuous divider line. */\n\t\t\t.bik-json-lineno {\n\t\t\t\tdisplay: inline-block;\n\t\t\t\tbox-sizing: border-box;\n\t\t\t\twidth: 2.5em;\n\t\t\t\tmargin-left: -3.5em;\n\t\t\t\tmargin-right: 1em;\n\t\t\t\tpadding-right: 0.7em;\n\t\t\t\ttext-align: right;\n\t\t\t\tcolor: #8c959f;\n\t\t\t\tborder-right: 1px solid #e1e4e8;\n\t\t\t\tuser-select: none;\n\t\t\t\t-webkit-user-select: none;\n\t\t\t}\n\t\t\t.bik-json-key {\n\t\t\t\tcolor: #0550ae;\n\t\t\t}\n\t\t\t.bik-json-string {\n\t\t\t\tcolor: #0a7d33;\n\t\t\t}\n\t\t\t.bik-json-number {\n\t\t\t\tcolor: #b5590a;\n\t\t\t}\n\t\t\t.bik-json-boolean,\n\t\t\t.bik-json-null {\n\t\t\t\tcolor: #8250df;\n\t\t\t\tfont-weight: 500;\n\t\t\t}\n\t\t\t.bik-json-punct {\n\t\t\t\tcolor: #57606a;\n\t\t\t}\n\t\t`}\n\n\ta,\n\t.bik-link {\n\t\tcolor: #4f46e5;\n\t\ttext-decoration: underline;\n\t\ttext-decoration-color: #a5b4fc;\n\t\ttext-underline-offset: 2px;\n\t\tcursor: pointer;\n\t\t&:hover {\n\t\t\tcolor: #3730a3;\n\t\t\ttext-decoration-color: #6366f1;\n\t\t}\n\t}\n`;\n\n/**\n * Floating Beautify / Copy action group for jsonMode, pinned to the top-right of\n * the editor so it never collides with a consumer-owned title/header. Sits above\n * the scrolling code area (absolute inside the position:relative shell).\n */\nexport const BikJsonActions = styled.div`\n\tposition: absolute;\n\ttop: 6px;\n\tright: 6px;\n\tz-index: 2;\n\tdisplay: flex;\n\tgap: 6px;\n\n\tbutton {\n\t\tdisplay: inline-flex;\n\t\talign-items: center;\n\t\tgap: 4px;\n\t\tpadding: 8px;\n\t\tfont-family: inherit;\n\t\tfont-size: 12px;\n\t\tline-height: 1.4;\n\t\tcolor: #57606a;\n\t\tbackground: rgba(255, 255, 255, 0.85);\n\t\tbackdrop-filter: blur(2px);\n\t\tborder: 1px solid #e0e0e0;\n\t\tborder-radius: 4px;\n\t\tcursor: pointer;\n\n\t\t&:hover:not(:disabled) {\n\t\t\tbackground: #ffffff;\n\t\t\tborder-color: #adb5bd;\n\t\t}\n\t\t&:disabled {\n\t\t\topacity: 0.5;\n\t\t\tcursor: not-allowed;\n\t\t}\n\t}\n`;\n\n/** Inline JSON parse-error banner rendered by BikEditor in jsonMode. */\nexport const BikJsonError = styled.div`\n\tpadding: 6px 12px;\n\tfont-size: 12px;\n\tline-height: 1.5;\n\tcolor: #d1242f;\n\tbackground: #fff0f0;\n\tborder-top: 1px solid #ffd7d5;\n\tword-break: break-word;\n\n\tstrong {\n\t\tfont-weight: 600;\n\t}\n`;\n"],"names":["BikEditorShell","styled","minHeight","maxHeight","tightParagraphs","COLORS","jsonMode","css","BikJsonActions","BikJsonError"],"mappings":"uNAGaA,EAAiBC,EAAAA,QAAO;AAAA;AAAA;AAAA;AAAA;AAAA,gBAUrB,CAAC,CAAE,UAAAC,KAAgBA,GAAa,MAAM;AAAA,gBACtC,CAAC,CAAE,UAAAC,KAAgBA,GAAa,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAkBzC,CAAC,CAAE,gBAAAC,CAAA,IAAuBA,EAAkB,IAAM,OAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,WAwB5DC,EAAAA,OAAO,QAAQ,KAAK;AAAA;AAAA;AAAA;AAAA,WAIpBA,EAAAA,OAAO,QAAQ,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAoB5B,CAAC,CAAE,SAAAC,KACJA,GACAC,EAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAA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