@bikdotai/bik-component-library 0.0.826 → 0.0.827

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.
Files changed (40) hide show
  1. package/dist/cjs/components/QueryBuilder/components/Connectors/Components/EmojiPicker.js.map +1 -1
  2. package/dist/cjs/components/agent-builder/components/CreateSubAgentPanel.js +17 -1
  3. package/dist/cjs/components/agent-builder/components/CreateSubAgentPanel.js.map +1 -1
  4. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/HorizontalBarGraph/HorizontalGraph.js.map +1 -1
  5. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/VerticalBarGraph/VerticalGraph.js.map +1 -1
  6. package/dist/cjs/components/switch/Switch.js.map +1 -1
  7. package/dist/cjs/icons/Media/Visual/{Frame26086263.js → FormkitNeutral.js} +1 -1
  8. package/dist/cjs/icons/Media/Visual/FormkitNeutral.js.map +1 -0
  9. package/dist/cjs/icons/Media/Visual/{IconTrailing.js → FormkitSad.js} +1 -1
  10. package/dist/cjs/icons/Media/Visual/FormkitSad.js.map +1 -0
  11. package/dist/cjs/icons/index.js +1 -1
  12. package/dist/esm/components/QueryBuilder/components/Connectors/Components/EmojiPicker.js.map +1 -1
  13. package/dist/esm/components/QueryBuilder/helpers/PropertyCustomProcessor.d.ts +1 -1
  14. package/dist/esm/components/agent-builder/components/CreateSubAgentPanel.js +167 -120
  15. package/dist/esm/components/agent-builder/components/CreateSubAgentPanel.js.map +1 -1
  16. package/dist/esm/components/analytics-chips-and-dropdowns/chart/HorizontalBarGraph/HorizontalGraph.d.ts +1 -1
  17. package/dist/esm/components/analytics-chips-and-dropdowns/chart/HorizontalBarGraph/HorizontalGraph.js.map +1 -1
  18. package/dist/esm/components/analytics-chips-and-dropdowns/chart/HorizontalBarGraph/HorizontalGraph.type.d.ts +57 -0
  19. package/dist/esm/components/analytics-chips-and-dropdowns/chart/LazyCharts.d.ts +1 -1
  20. package/dist/esm/components/analytics-chips-and-dropdowns/chart/VerticalBarGraph/VerticalGraph.d.ts +1 -1
  21. package/dist/esm/components/analytics-chips-and-dropdowns/chart/VerticalBarGraph/VerticalGraph.js.map +1 -1
  22. package/dist/esm/components/analytics-chips-and-dropdowns/chart/VerticalBarGraph/VerticalGraph.type.d.ts +46 -0
  23. package/dist/esm/components/switch/Switch.d.ts +2 -2
  24. package/dist/esm/components/switch/Switch.js.map +1 -1
  25. package/dist/esm/components/switch/Switch.type.d.ts +19 -0
  26. package/dist/esm/icons/Media/Visual/{Frame26086263.js → FormkitNeutral.js} +1 -1
  27. package/dist/esm/icons/Media/Visual/FormkitNeutral.js.map +1 -0
  28. package/dist/esm/icons/Media/Visual/{IconTrailing.js → FormkitSad.js} +1 -1
  29. package/dist/esm/icons/Media/Visual/FormkitSad.js.map +1 -0
  30. package/dist/esm/icons/Media/Visual/index.d.ts +2 -2
  31. package/dist/esm/icons/index.d.ts +25 -25
  32. package/dist/esm/icons/index.js +184 -184
  33. package/dist/esm/index.d.ts +1 -0
  34. package/package.json +1 -1
  35. package/dist/cjs/icons/Media/Visual/Frame26086263.js.map +0 -1
  36. package/dist/cjs/icons/Media/Visual/IconTrailing.js.map +0 -1
  37. package/dist/esm/icons/Media/Visual/Frame26086263.js.map +0 -1
  38. package/dist/esm/icons/Media/Visual/IconTrailing.js.map +0 -1
  39. /package/dist/esm/icons/Media/Visual/{Frame26086263.d.ts → FormkitNeutral.d.ts} +0 -0
  40. /package/dist/esm/icons/Media/Visual/{IconTrailing.d.ts → FormkitSad.d.ts} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"EmojiPicker.js","sources":["../../../../../../../src/components/QueryBuilder/components/Connectors/Components/EmojiPicker.tsx"],"sourcesContent":["import EmojiIcon from '@src/assets/icons/emoji.svg';\nimport React, { LegacyRef, Suspense, useRef, useState } from 'react';\nimport styled from 'styled-components';\nimport { IconButton } from '@src/components/icon-button';\nimport ChipInput from '@src/components/input/ChipInput';\nimport { CONNECTOR_VALUE_TYPE } from '@src/components/QueryBuilder/types/QueryBuilderConnector';\nimport { ConnectorComponentProps } from '@src/components/QueryBuilder/types/QueryBuilderConnector.type';\nimport { useOutside } from '@src/hooks/useOutside';\n\ntype EmojiClickData = {\n\temoji: string;\n};\n\nconst LazyEmojiPicker = React.lazy(async () => {\n\tconst mod = await import('emoji-picker-react');\n\treturn { default: mod.default };\n});\n\ntype Props = Omit<Omit<ConnectorComponentProps, 'val'>, 'onChange'> & {\n\tval: string[];\n\tonChange: (val: (string | number)[]) => void;\n};\n\nconst EmojiPicker: React.FC<ConnectorComponentProps> = ({\n\tval,\n\tonChange,\n\terrors,\n\tnativeID,\n\tdisabled,\n}) => {\n\tconst [showPicker, setShowPicker] = useState<boolean>(false);\n\tconst valArr = (Array.isArray(val) ? val : []).map((valEl) => {\n\t\treturn valEl;\n\t});\n\tconst ref = useRef();\n\n\tuseOutside(ref, () => {\n\t\tsetShowPicker(false);\n\t});\n\n\treturn (\n\t\t<div\n\t\t\tstyle={{ position: 'relative', opacity: disabled ? 0.5 : 1, width: 300 }}\n\t\t\tid={nativeID}\n\t\t>\n\t\t\t{!!disabled && (\n\t\t\t\t<div\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\twidth: '100%',\n\t\t\t\t\t\theight: '100%',\n\t\t\t\t\t\ttop: 0,\n\t\t\t\t\t\tleft: 0,\n\t\t\t\t\t\tzIndex: 1,\n\t\t\t\t\t}}\n\t\t\t\t/>\n\t\t\t)}\n\t\t\t<EmojiInput>\n\t\t\t\t<ChipInput\n\t\t\t\t\terror={errors?.val as string}\n\t\t\t\t\tonChipsChange={onChange as Props['onChange']}\n\t\t\t\t\tchipsContainerCustomStyle={{\n\t\t\t\t\t\tpadding: '0px 32px 0px 8px',\n\t\t\t\t\t}}\n\t\t\t\t\tcreateChipKeys={[13, 188]}\n\t\t\t\t\tplaceholder={'add emojis'}\n\t\t\t\t\tchips={valArr}\n\t\t\t\t/>\n\n\t\t\t\t<EmojiContainer>\n\t\t\t\t\t<IconButton Icon={EmojiIcon} onClick={() => setShowPicker(true)} />\n\t\t\t\t</EmojiContainer>\n\t\t\t\t{showPicker && (\n\t\t\t\t\t<div\n\t\t\t\t\t\tref={ref as unknown as LegacyRef<HTMLDivElement>}\n\t\t\t\t\t\tclassName=\"absolute-picker\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<Suspense fallback={null}>\n\t\t\t\t\t\t\t<LazyEmojiPicker\n\t\t\t\t\t\t\t\tpreviewConfig={{ showPreview: false }}\n\t\t\t\t\t\t\t\tskinTonesDisabled\n\t\t\t\t\t\t\t\tsearchDisabled\n\t\t\t\t\t\t\t\ttheme={'dark' as unknown as never}\n\t\t\t\t\t\t\t\temojiStyle={'native' as unknown as never}\n\t\t\t\t\t\t\t\tonEmojiClick={(emoji: EmojiClickData) => {\n\t\t\t\t\t\t\t\t\tconst exists = valArr.find((em) => emoji.emoji === em);\n\t\t\t\t\t\t\t\t\tif (exists) return;\n\t\t\t\t\t\t\t\t\tonChange?.([\n\t\t\t\t\t\t\t\t\t\t...valArr,\n\t\t\t\t\t\t\t\t\t\temoji.emoji,\n\t\t\t\t\t\t\t\t\t] as unknown as CONNECTOR_VALUE_TYPE);\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</Suspense>\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\t\t\t</EmojiInput>\n\t\t</div>\n\t);\n};\n\nexport default function EmojiPickerConnector(props: ConnectorComponentProps) {\n\treturn <EmojiPicker {...props} />;\n}\n\nconst EmojiContainer = styled.div`\n\tposition: absolute;\n\tright: 0;\n\ttop: 0;\n`;\n\nconst EmojiInput = styled.div`\n\tinput {\n\t\tpointer-events: none;\n\t}\n\t.absolute-picker {\n\t\tposition: absolute;\n\t\ttop: 50px;\n\t\tz-index: 1;\n\t}\n`;\n"],"names":["LazyEmojiPicker","React","EmojiPicker","val","onChange","errors","nativeID","disabled","showPicker","setShowPicker","useState","valArr","valEl","ref","useRef","useOutside","jsxs","jsx","EmojiInput","ChipInput","EmojiContainer","IconButton","EmojiIcon","Suspense","emoji","em","EmojiPickerConnector","props","styled"],"mappings":";;;;;;;AAaA,MAAMA,IAAkBC,EAAM,KAAK,aAE3B,EAAE,UADG,MAAM,OAAO,oBAAoB,GACvB,QAAA,EACtB,GAOKC,IAAiD,CAAC;AAAA,EACvD,KAAAC;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AAAA,EACA,UAAAC;AAAA,EACA,UAAAC;AACD,MAAM;AACL,QAAM,CAACC,GAAYC,CAAa,IAAIC,EAAkB,EAAK,GACrDC,KAAU,MAAM,QAAQR,CAAG,IAAIA,IAAM,CAAA,GAAI,IAAI,CAACS,MAC5CA,CACP,GACKC,IAAMC,EAAA;AAEZ,SAAAC,EAAWF,GAAK,MAAM;AACrB,IAAAJ,EAAc,EAAK;AAAA,EACpB,CAAC,GAGA,gBAAAO;AAAA,IAAC;AAAA,IAAA;AAAA,MACA,OAAO,EAAE,UAAU,YAAY,SAAST,IAAW,MAAM,GAAG,OAAO,IAAA;AAAA,MACnE,IAAID;AAAA,MAEH,UAAA;AAAA,QAAA,CAAC,CAACC,KACF,gBAAAU;AAAA,UAAC;AAAA,UAAA;AAAA,YACA,OAAO;AAAA,cACN,UAAU;AAAA,cACV,OAAO;AAAA,cACP,QAAQ;AAAA,cACR,KAAK;AAAA,cACL,MAAM;AAAA,cACN,QAAQ;AAAA,YAAA;AAAA,UACT;AAAA,QAAA;AAAA,0BAGDC,GAAA,EACA,UAAA;AAAA,UAAA,gBAAAD;AAAA,YAACE;AAAA,YAAA;AAAA,cACA,OAAOd,GAAQ;AAAA,cACf,eAAeD;AAAA,cACf,2BAA2B;AAAA,gBAC1B,SAAS;AAAA,cAAA;AAAA,cAEV,gBAAgB,CAAC,IAAI,GAAG;AAAA,cACxB,aAAa;AAAA,cACb,OAAOO;AAAA,YAAA;AAAA,UAAA;AAAA,UAGR,gBAAAM,EAACG,GAAA,EACA,UAAA,gBAAAH,EAACI,GAAA,EAAW,MAAMC,GAAW,SAAS,MAAMb,EAAc,EAAI,EAAA,CAAG,EAAA,CAClE;AAAA,UACCD,KACA,gBAAAS;AAAA,YAAC;AAAA,YAAA;AAAA,cACA,KAAAJ;AAAA,cACA,WAAU;AAAA,cAEV,UAAA,gBAAAI,EAACM,GAAA,EAAS,UAAU,MACnB,UAAA,gBAAAN;AAAA,gBAACjB;AAAA,gBAAA;AAAA,kBACA,eAAe,EAAE,aAAa,GAAA;AAAA,kBAC9B,mBAAiB;AAAA,kBACjB,gBAAc;AAAA,kBACd,OAAO;AAAA,kBACP,YAAY;AAAA,kBACZ,cAAc,CAACwB,MAA0B;AAExC,oBADeb,EAAO,KAAK,CAACc,MAAOD,EAAM,UAAUC,CAAE,KAErDrB,IAAW;AAAA,sBACV,GAAGO;AAAA,sBACHa,EAAM;AAAA,oBAAA,CAC6B;AAAA,kBACrC;AAAA,gBAAA;AAAA,cAAA,EACD,CACD;AAAA,YAAA;AAAA,UAAA;AAAA,QACD,EAAA,CAEF;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGH;AAEA,SAAwBE,EAAqBC,GAAgC;AAC5E,SAAO,gBAAAV,EAACf,GAAA,EAAa,GAAGyB,EAAA,CAAO;AAChC;AAEA,MAAMP,IAAiBQ,EAAO;AAAA;AAAA;AAAA;AAAA,GAMxBV,IAAaU,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;"}
1
+ {"version":3,"file":"EmojiPicker.js","sources":["../../../../../../../src/components/QueryBuilder/components/Connectors/Components/EmojiPicker.tsx"],"sourcesContent":["import EmojiIcon from '@src/assets/icons/emoji.svg';\nimport React, { LegacyRef, Suspense, useRef, useState } from 'react';\nimport styled from 'styled-components';\nimport { IconButton } from '@src/components/icon-button';\nimport ChipInput from '@src/components/input/ChipInput';\nimport { CONNECTOR_VALUE_TYPE } from '@src/components/QueryBuilder/types/QueryBuilderConnector.type';\nimport { ConnectorComponentProps } from '@src/components/QueryBuilder/types/QueryBuilderConnector.type';\nimport { useOutside } from '@src/hooks/useOutside';\n\ntype EmojiClickData = {\n\temoji: string;\n};\n\nconst LazyEmojiPicker = React.lazy(async () => {\n\tconst mod = await import('emoji-picker-react');\n\treturn { default: mod.default };\n});\n\ntype Props = Omit<Omit<ConnectorComponentProps, 'val'>, 'onChange'> & {\n\tval: string[];\n\tonChange: (val: (string | number)[]) => void;\n};\n\nconst EmojiPicker: React.FC<ConnectorComponentProps> = ({\n\tval,\n\tonChange,\n\terrors,\n\tnativeID,\n\tdisabled,\n}) => {\n\tconst [showPicker, setShowPicker] = useState<boolean>(false);\n\tconst valArr = (Array.isArray(val) ? val : []).map((valEl) => {\n\t\treturn valEl;\n\t});\n\tconst ref = useRef();\n\n\tuseOutside(ref, () => {\n\t\tsetShowPicker(false);\n\t});\n\n\treturn (\n\t\t<div\n\t\t\tstyle={{ position: 'relative', opacity: disabled ? 0.5 : 1, width: 300 }}\n\t\t\tid={nativeID}\n\t\t>\n\t\t\t{!!disabled && (\n\t\t\t\t<div\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\twidth: '100%',\n\t\t\t\t\t\theight: '100%',\n\t\t\t\t\t\ttop: 0,\n\t\t\t\t\t\tleft: 0,\n\t\t\t\t\t\tzIndex: 1,\n\t\t\t\t\t}}\n\t\t\t\t/>\n\t\t\t)}\n\t\t\t<EmojiInput>\n\t\t\t\t<ChipInput\n\t\t\t\t\terror={errors?.val as string}\n\t\t\t\t\tonChipsChange={onChange as Props['onChange']}\n\t\t\t\t\tchipsContainerCustomStyle={{\n\t\t\t\t\t\tpadding: '0px 32px 0px 8px',\n\t\t\t\t\t}}\n\t\t\t\t\tcreateChipKeys={[13, 188]}\n\t\t\t\t\tplaceholder={'add emojis'}\n\t\t\t\t\tchips={valArr}\n\t\t\t\t/>\n\n\t\t\t\t<EmojiContainer>\n\t\t\t\t\t<IconButton Icon={EmojiIcon} onClick={() => setShowPicker(true)} />\n\t\t\t\t</EmojiContainer>\n\t\t\t\t{showPicker && (\n\t\t\t\t\t<div\n\t\t\t\t\t\tref={ref as unknown as LegacyRef<HTMLDivElement>}\n\t\t\t\t\t\tclassName=\"absolute-picker\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<Suspense fallback={null}>\n\t\t\t\t\t\t\t<LazyEmojiPicker\n\t\t\t\t\t\t\t\tpreviewConfig={{ showPreview: false }}\n\t\t\t\t\t\t\t\tskinTonesDisabled\n\t\t\t\t\t\t\t\tsearchDisabled\n\t\t\t\t\t\t\t\ttheme={'dark' as unknown as never}\n\t\t\t\t\t\t\t\temojiStyle={'native' as unknown as never}\n\t\t\t\t\t\t\t\tonEmojiClick={(emoji: EmojiClickData) => {\n\t\t\t\t\t\t\t\t\tconst exists = valArr.find((em) => emoji.emoji === em);\n\t\t\t\t\t\t\t\t\tif (exists) return;\n\t\t\t\t\t\t\t\t\tonChange?.([\n\t\t\t\t\t\t\t\t\t\t...valArr,\n\t\t\t\t\t\t\t\t\t\temoji.emoji,\n\t\t\t\t\t\t\t\t\t] as unknown as CONNECTOR_VALUE_TYPE);\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</Suspense>\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\t\t\t</EmojiInput>\n\t\t</div>\n\t);\n};\n\nexport default function EmojiPickerConnector(props: ConnectorComponentProps) {\n\treturn <EmojiPicker {...props} />;\n}\n\nconst EmojiContainer = styled.div`\n\tposition: absolute;\n\tright: 0;\n\ttop: 0;\n`;\n\nconst EmojiInput = styled.div`\n\tinput {\n\t\tpointer-events: none;\n\t}\n\t.absolute-picker {\n\t\tposition: absolute;\n\t\ttop: 50px;\n\t\tz-index: 1;\n\t}\n`;\n"],"names":["LazyEmojiPicker","React","EmojiPicker","val","onChange","errors","nativeID","disabled","showPicker","setShowPicker","useState","valArr","valEl","ref","useRef","useOutside","jsxs","jsx","EmojiInput","ChipInput","EmojiContainer","IconButton","EmojiIcon","Suspense","emoji","em","EmojiPickerConnector","props","styled"],"mappings":";;;;;;;AAaA,MAAMA,IAAkBC,EAAM,KAAK,aAE3B,EAAE,UADG,MAAM,OAAO,oBAAoB,GACvB,QAAA,EACtB,GAOKC,IAAiD,CAAC;AAAA,EACvD,KAAAC;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AAAA,EACA,UAAAC;AAAA,EACA,UAAAC;AACD,MAAM;AACL,QAAM,CAACC,GAAYC,CAAa,IAAIC,EAAkB,EAAK,GACrDC,KAAU,MAAM,QAAQR,CAAG,IAAIA,IAAM,CAAA,GAAI,IAAI,CAACS,MAC5CA,CACP,GACKC,IAAMC,EAAA;AAEZ,SAAAC,EAAWF,GAAK,MAAM;AACrB,IAAAJ,EAAc,EAAK;AAAA,EACpB,CAAC,GAGA,gBAAAO;AAAA,IAAC;AAAA,IAAA;AAAA,MACA,OAAO,EAAE,UAAU,YAAY,SAAST,IAAW,MAAM,GAAG,OAAO,IAAA;AAAA,MACnE,IAAID;AAAA,MAEH,UAAA;AAAA,QAAA,CAAC,CAACC,KACF,gBAAAU;AAAA,UAAC;AAAA,UAAA;AAAA,YACA,OAAO;AAAA,cACN,UAAU;AAAA,cACV,OAAO;AAAA,cACP,QAAQ;AAAA,cACR,KAAK;AAAA,cACL,MAAM;AAAA,cACN,QAAQ;AAAA,YAAA;AAAA,UACT;AAAA,QAAA;AAAA,0BAGDC,GAAA,EACA,UAAA;AAAA,UAAA,gBAAAD;AAAA,YAACE;AAAA,YAAA;AAAA,cACA,OAAOd,GAAQ;AAAA,cACf,eAAeD;AAAA,cACf,2BAA2B;AAAA,gBAC1B,SAAS;AAAA,cAAA;AAAA,cAEV,gBAAgB,CAAC,IAAI,GAAG;AAAA,cACxB,aAAa;AAAA,cACb,OAAOO;AAAA,YAAA;AAAA,UAAA;AAAA,UAGR,gBAAAM,EAACG,GAAA,EACA,UAAA,gBAAAH,EAACI,GAAA,EAAW,MAAMC,GAAW,SAAS,MAAMb,EAAc,EAAI,EAAA,CAAG,EAAA,CAClE;AAAA,UACCD,KACA,gBAAAS;AAAA,YAAC;AAAA,YAAA;AAAA,cACA,KAAAJ;AAAA,cACA,WAAU;AAAA,cAEV,UAAA,gBAAAI,EAACM,GAAA,EAAS,UAAU,MACnB,UAAA,gBAAAN;AAAA,gBAACjB;AAAA,gBAAA;AAAA,kBACA,eAAe,EAAE,aAAa,GAAA;AAAA,kBAC9B,mBAAiB;AAAA,kBACjB,gBAAc;AAAA,kBACd,OAAO;AAAA,kBACP,YAAY;AAAA,kBACZ,cAAc,CAACwB,MAA0B;AAExC,oBADeb,EAAO,KAAK,CAACc,MAAOD,EAAM,UAAUC,CAAE,KAErDrB,IAAW;AAAA,sBACV,GAAGO;AAAA,sBACHa,EAAM;AAAA,oBAAA,CAC6B;AAAA,kBACrC;AAAA,gBAAA;AAAA,cAAA,EACD,CACD;AAAA,YAAA;AAAA,UAAA;AAAA,QACD,EAAA,CAEF;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGH;AAEA,SAAwBE,EAAqBC,GAAgC;AAC5E,SAAO,gBAAAV,EAACf,GAAA,EAAa,GAAGyB,EAAA,CAAO;AAChC;AAEA,MAAMP,IAAiBQ,EAAO;AAAA;AAAA;AAAA;AAAA,GAMxBV,IAAaU,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;"}
@@ -8,7 +8,7 @@ export declare class PropertyCustomProcessor {
8
8
  _id: string;
9
9
  name?: string | number | undefined;
10
10
  dataType?: import('..').QueryBuilderConnectorType | undefined;
11
- operator?: import('..').CONNECTOR_OPERATORS | undefined;
11
+ operator?: import('../types/QueryBuilderOperator.type').CONNECTOR_OPERATORS | undefined;
12
12
  value?: import('..').CONNECTOR_VALUE_TYPE;
13
13
  _refresh?: boolean | undefined;
14
14
  error: {
@@ -1,214 +1,261 @@
1
- import { jsxs as l, Fragment as rt, jsx as r } from "react/jsx-runtime";
2
- import st from "../../../assets/icons/cross.svg.js";
3
- import { useState as s, useMemo as at, useRef as f, useCallback as c } from "react";
4
- import { TitleRegular as it, BodySecondary as lt } from "../../TypographyStyle.js";
5
- import { addUnique as L } from "../../../utils/arrayUtils.js";
6
- import { COLORS as _ } from "../../../constants/Theme.js";
7
- import { SubAgentScrim as ct, SubAgentPanel as ut, SubAgentPanelHeader as dt, SubAgentPanelHeaderText as mt, SubAgentCloseButton as gt, SubAgentPanelBody as pt, SubAgentPanelFooter as ft } from "../AgentBuilder.styled.js";
8
- import { AGENT_CHAR_LIMITS as ht } from "../constants/charLimits.js";
9
- import { buildAgentMentionItems as bt, toolSourceLabel as yt } from "../utils/mentionSerialization.js";
10
- import { SOURCE_ICONS as P, renderSourceIcon as F } from "../utils/sourceIcons.js";
11
- import { MentionEditor as N } from "./MentionEditor.js";
12
- import { SelectableListSection as St } from "./SelectableListSection.js";
13
- import { Input as Ct } from "../../input/Input.js";
14
- import { Button as U } from "../../button/Button.js";
15
- import { Toaster as xt } from "../../toaster/Toaster.js";
16
- const Ut = ({
17
- onClose: h,
18
- onSave: j,
1
+ import { jsxs as l, Fragment as ct, jsx as o } from "react/jsx-runtime";
2
+ import ut from "../../../assets/icons/cross.svg.js";
3
+ import { useState as i, useMemo as dt, useRef as x, useCallback as c } from "react";
4
+ import mt from "styled-components";
5
+ import { TitleRegular as gt, BodySecondary as pt } from "../../TypographyStyle.js";
6
+ import { addUnique as N } from "../../../utils/arrayUtils.js";
7
+ import { COLORS as u } from "../../../constants/Theme.js";
8
+ import { SubAgentScrim as ft, SubAgentPanel as ht, SubAgentPanelHeader as bt, SubAgentPanelHeaderText as yt, SubAgentCloseButton as St, SubAgentPanelBody as xt, SubAgentPanelFooter as Ct } from "../AgentBuilder.styled.js";
9
+ import { AGENT_CHAR_LIMITS as vt } from "../constants/charLimits.js";
10
+ import { buildAgentMentionItems as It, toolSourceLabel as Tt } from "../utils/mentionSerialization.js";
11
+ import { SOURCE_ICONS as k, renderSourceIcon as U } from "../utils/sourceIcons.js";
12
+ import { MentionEditor as j } from "./MentionEditor.js";
13
+ import { SelectableListSection as At } from "./SelectableListSection.js";
14
+ import { Input as Rt } from "../../input/Input.js";
15
+ import { Button as z } from "../../button/Button.js";
16
+ import { Toaster as _t } from "../../toaster/Toaster.js";
17
+ const q = mt.button`
18
+ align-self: flex-start;
19
+ border: 1px solid ${u.stroke.primary};
20
+ color: ${u.content.primary};
21
+ background: ${u.surface.standard};
22
+ border-radius: 8px;
23
+ padding: 6px 12px;
24
+ font-size: 13px;
25
+ line-height: 1.1;
26
+ font-weight: 600;
27
+ cursor: pointer;
28
+
29
+ &:disabled {
30
+ cursor: default;
31
+ opacity: 0.6;
32
+ }
33
+ `, zt = ({
34
+ onClose: C,
35
+ onSave: W,
19
36
  availableTools: a,
20
- onImprove: It,
21
- title: w = "Create sub-agent",
22
- initial: u,
23
- appLabel: G = "Manifest",
24
- charLimits: b = ht
37
+ onImprove: p,
38
+ title: D = "Create sub-agent",
39
+ initial: f,
40
+ appLabel: w = "Manifest",
41
+ charLimits: v = vt
25
42
  }) => {
26
- const [y, $] = s(u?.name ?? ""), [d, S] = s(u?.instructions ?? ""), [m, C] = s(u?.guardrail ?? ""), [x, g] = s(u?.tools ?? []), [M, B] = s(!1), [z, k] = s(0), [q, E] = s(0), [Tt, vt] = s(null), I = at(
27
- () => bt(a, [], G),
28
- [a, G]
29
- ), p = f({}), T = f("instructions"), W = c((t) => {
30
- p.current.instructions = t ?? void 0;
31
- }, []), D = c((t) => {
32
- p.current.guardrail = t ?? void 0;
33
- }, []), J = c(() => {
34
- T.current = "instructions";
35
- }, []), Q = c(() => {
36
- T.current = "guardrail";
37
- }, []), O = c(
43
+ const [I, J] = i(f?.name ?? ""), [d, h] = i(f?.instructions ?? ""), [m, b] = i(f?.guardrail ?? ""), [T, y] = i(f?.tools ?? []), [E, O] = i(!1), [Q, A] = i(0), [V, R] = i(0), [g, $] = i(null), _ = dt(
44
+ () => It(a, [], w),
45
+ [a, w]
46
+ ), S = x({}), P = x("instructions"), X = c((t) => {
47
+ S.current.instructions = t ?? void 0;
48
+ }, []), Y = c((t) => {
49
+ S.current.guardrail = t ?? void 0;
50
+ }, []), Z = c(() => {
51
+ P.current = "instructions";
52
+ }, []), tt = c(() => {
53
+ P.current = "guardrail";
54
+ }, []), H = c(
38
55
  (t, e) => {
39
- t === "tool" && g((n) => L(n, e));
56
+ t === "tool" && y((n) => N(n, e));
40
57
  },
41
58
  []
42
- ), V = c((t) => {
43
- (p.current[T.current] ?? p.current.instructions)?.("tool", t);
44
- }, []), [v, A] = s(
59
+ ), et = c((t) => {
60
+ (S.current[P.current] ?? S.current.instructions)?.("tool", t);
61
+ }, []), [B, G] = i(
45
62
  null
46
- ), R = f(null), H = f(0), X = (t) => {
47
- const e = a.find((o) => o.tool_id === t), n = `{{tool:${t}}}`, i = (o) => o.split(n).join("");
48
- R.current = { instructions: d, guardrail: m, tools: x }, S((o) => i(o)), C((o) => i(o)), g((o) => o.filter((ot) => ot !== t)), k((o) => o + 1), E((o) => o + 1), H.current += 1, A({
49
- id: H.current,
63
+ ), M = x(null), K = x(0), nt = (t) => {
64
+ const e = a.find((r) => r.tool_id === t), n = `{{tool:${t}}}`, s = (r) => r.split(n).join("");
65
+ M.current = { instructions: d, guardrail: m, tools: T }, h((r) => s(r)), b((r) => s(r)), y((r) => r.filter((lt) => lt !== t)), A((r) => r + 1), R((r) => r + 1), K.current += 1, G({
66
+ id: K.current,
50
67
  message: `Tool "${e?.display_name ?? "Tool"}" removed`
51
68
  });
52
- }, Y = () => {
53
- const t = R.current;
54
- t && (S(t.instructions), C(t.guardrail), g(t.tools), k((e) => e + 1), E((e) => e + 1), R.current = null), A(null);
55
- }, K = y.trim().length > 0 && (d.trim().length > 0 || m.trim().length > 0), Z = x.map((t) => {
69
+ }, ot = () => {
70
+ const t = M.current;
71
+ t && (h(t.instructions), b(t.guardrail), y(t.tools), A((e) => e + 1), R((e) => e + 1), M.current = null), G(null);
72
+ }, L = I.trim().length > 0 && (d.trim().length > 0 || m.trim().length > 0), rt = T.map((t) => {
56
73
  const e = a.find((n) => n.tool_id === t);
57
74
  return e ? {
58
75
  id: t,
59
76
  label: e.display_name,
60
- icon: P[e.source ?? "manifest"]
77
+ icon: k[e.source ?? "manifest"]
61
78
  } : null;
62
- }).filter((t) => t !== null), tt = a.map((t) => ({
79
+ }).filter((t) => t !== null), st = a.map((t) => ({
63
80
  label: t.display_name,
64
81
  value: t.tool_id,
65
- leadingIcon: F(P[t.source ?? "manifest"]) ?? void 0
66
- })), et = (() => {
82
+ leadingIcon: U(k[t.source ?? "manifest"]) ?? void 0
83
+ })), it = (() => {
67
84
  const t = [], e = /* @__PURE__ */ new Map();
68
85
  return a.forEach((n) => {
69
- const i = n.source ?? "manifest";
70
- e.has(i) || (e.set(i, []), t.push(i)), e.get(i)?.push({
86
+ const s = n.source ?? "manifest";
87
+ e.has(s) || (e.set(s, []), t.push(s)), e.get(s)?.push({
71
88
  label: n.display_name,
72
89
  value: n.tool_id,
73
- leadingIcon: F(P[n.source ?? "manifest"]) ?? void 0
90
+ leadingIcon: U(k[n.source ?? "manifest"]) ?? void 0
74
91
  });
75
92
  }), t.map((n) => ({
76
93
  source: n,
77
- label: yt(n),
94
+ label: Tt(n),
78
95
  options: e.get(n) ?? []
79
96
  }));
80
- })(), nt = async () => {
81
- if (!K || M)
97
+ })(), at = async () => {
98
+ if (!L || E)
82
99
  return;
83
- const t = j({
84
- name: y.trim(),
100
+ const t = W({
101
+ name: I.trim(),
85
102
  instructions: d,
86
103
  guardrail: m,
87
- tools: x
104
+ tools: T
88
105
  });
89
106
  if (t && typeof t.then == "function") {
90
- B(!0);
107
+ O(!0);
91
108
  try {
92
109
  await t;
93
110
  } finally {
94
- B(!1);
111
+ O(!1);
112
+ }
113
+ }
114
+ }, F = async (t) => {
115
+ if (!(!p || g)) {
116
+ $(t);
117
+ try {
118
+ const n = await p(t, t === "instructions" ? d : m);
119
+ t === "instructions" ? (h(n), A((s) => s + 1)) : (b(n), R((s) => s + 1));
120
+ } finally {
121
+ $(null);
95
122
  }
96
123
  }
97
124
  };
98
- return /* @__PURE__ */ l(rt, { children: [
99
- /* @__PURE__ */ r(ct, { onClick: h, "data-test": "subagent-scrim" }),
100
- /* @__PURE__ */ l(ut, { "data-test": "create-subagent-panel", children: [
101
- /* @__PURE__ */ l(dt, { children: [
102
- /* @__PURE__ */ l(mt, { children: [
103
- /* @__PURE__ */ r(it, { color: _.content.primary, children: w }),
104
- /* @__PURE__ */ r(lt, { color: _.content.secondary, children: "Each sub-agent handles one piece of the job. Use @ in the main instructions to call them." })
125
+ return /* @__PURE__ */ l(ct, { children: [
126
+ /* @__PURE__ */ o(ft, { onClick: C, "data-test": "subagent-scrim" }),
127
+ /* @__PURE__ */ l(ht, { "data-test": "create-subagent-panel", children: [
128
+ /* @__PURE__ */ l(bt, { children: [
129
+ /* @__PURE__ */ l(yt, { children: [
130
+ /* @__PURE__ */ o(gt, { color: u.content.primary, children: D }),
131
+ /* @__PURE__ */ o(pt, { color: u.content.secondary, children: "Each sub-agent handles one piece of the job. Use @ in the main instructions to call them." })
105
132
  ] }),
106
- /* @__PURE__ */ r(gt, { onClick: h, "aria-label": "Close", children: /* @__PURE__ */ r(
107
- st,
133
+ /* @__PURE__ */ o(St, { onClick: C, "aria-label": "Close", children: /* @__PURE__ */ o(
134
+ ut,
108
135
  {
109
136
  width: 20,
110
137
  height: 20,
111
- color: _.content.secondary
138
+ color: u.content.secondary
112
139
  }
113
140
  ) })
114
141
  ] }),
115
- /* @__PURE__ */ l(pt, { children: [
116
- /* @__PURE__ */ r(
117
- Ct,
142
+ /* @__PURE__ */ l(xt, { children: [
143
+ /* @__PURE__ */ o(
144
+ Rt,
118
145
  {
119
146
  "data-test": "subagent-name",
120
147
  labelText: "Agent name",
121
148
  labelTextBold: !0,
122
149
  placeholder: "Enter agent name",
123
- value: y,
124
- maxCharLimit: b.name,
150
+ value: I,
151
+ maxCharLimit: v.name,
125
152
  maxCharLimitPosition: "TOP",
126
153
  maxCharStyle: { fontSize: 12, lineHeight: "16px" },
127
- onChangeText: $
154
+ onChangeText: J
128
155
  }
129
156
  ),
130
- /* @__PURE__ */ r(
131
- N,
157
+ /* @__PURE__ */ o(
158
+ j,
132
159
  {
133
160
  "data-test": "subagent-instructions",
134
161
  label: "Instructions",
135
162
  value: d,
136
- onChange: S,
137
- maxLength: b.instructions,
163
+ onChange: h,
164
+ maxLength: v.instructions,
138
165
  placeholder: "Write the steps in plain English. Type @ to reference a tool.",
139
166
  minHeight: "160px",
140
- resetKey: `instr-${z}`,
141
- mentionItems: I,
167
+ resetKey: `instr-${Q}`,
168
+ mentionItems: _,
142
169
  tools: a,
143
- onMentionSelect: O,
144
- onFocus: J,
145
- registerInsert: W
170
+ onMentionSelect: H,
171
+ onFocus: Z,
172
+ registerInsert: X,
173
+ action: p ? /* @__PURE__ */ o(
174
+ q,
175
+ {
176
+ type: "button",
177
+ "data-test": "subagent-improve-instructions",
178
+ disabled: g !== null,
179
+ onClick: () => F("instructions"),
180
+ children: g === "instructions" ? "Improving…" : "Improve with AI"
181
+ }
182
+ ) : void 0
146
183
  }
147
184
  ),
148
- /* @__PURE__ */ r(
149
- N,
185
+ /* @__PURE__ */ o(
186
+ j,
150
187
  {
151
188
  "data-test": "subagent-guardrail",
152
189
  label: "Guardrails",
153
190
  value: m,
154
- onChange: C,
155
- maxLength: b.guardrail,
191
+ onChange: b,
192
+ maxLength: v.guardrail,
156
193
  placeholder: "e.g. Never discuss competitor pricing. Type @ to reference a tool.",
157
194
  minHeight: "160px",
158
- resetKey: `guard-${q}`,
159
- mentionItems: I,
195
+ resetKey: `guard-${V}`,
196
+ mentionItems: _,
160
197
  tools: a,
161
- onMentionSelect: O,
162
- onFocus: Q,
163
- registerInsert: D
198
+ onMentionSelect: H,
199
+ onFocus: tt,
200
+ registerInsert: Y,
201
+ action: p ? /* @__PURE__ */ o(
202
+ q,
203
+ {
204
+ type: "button",
205
+ "data-test": "subagent-improve-guardrail",
206
+ disabled: g !== null,
207
+ onClick: () => F("guardrail"),
208
+ children: g === "guardrail" ? "Improving…" : "Improve with AI"
209
+ }
210
+ ) : void 0
164
211
  }
165
212
  ),
166
- /* @__PURE__ */ r(
167
- St,
213
+ /* @__PURE__ */ o(
214
+ At,
168
215
  {
169
216
  title: "Tools this agent can use",
170
217
  dataTestPrefix: "subagent-tools",
171
- items: Z,
172
- addableOptions: tt,
173
- sourceGroups: et,
174
- mentionItems: I,
218
+ items: rt,
219
+ addableOptions: st,
220
+ sourceGroups: it,
221
+ mentionItems: _,
175
222
  emptyText: "No tools added yet.",
176
223
  onAdd: (t) => {
177
- V(t), g((e) => L(e, t));
224
+ et(t), y((e) => N(e, t));
178
225
  },
179
- onRemove: X
226
+ onRemove: nt
180
227
  }
181
228
  )
182
229
  ] }),
183
- /* @__PURE__ */ l(ft, { children: [
184
- /* @__PURE__ */ r(
185
- U,
230
+ /* @__PURE__ */ l(Ct, { children: [
231
+ /* @__PURE__ */ o(
232
+ z,
186
233
  {
187
234
  "data-test": "subagent-save",
188
235
  buttonType: "primary",
189
236
  size: "small",
190
237
  buttonText: "Save",
191
- disabled: !K,
192
- isLoading: M,
193
- onClick: nt
238
+ disabled: !L,
239
+ isLoading: E,
240
+ onClick: at
194
241
  }
195
242
  ),
196
- /* @__PURE__ */ r(
197
- U,
243
+ /* @__PURE__ */ o(
244
+ z,
198
245
  {
199
246
  "data-test": "subagent-cancel",
200
247
  buttonType: "tertiaryGray",
201
248
  size: "small",
202
249
  buttonText: "Cancel",
203
- onClick: h
250
+ onClick: C
204
251
  }
205
252
  )
206
253
  ] })
207
254
  ] }),
208
- v && /* @__PURE__ */ r(
209
- xt,
255
+ B && /* @__PURE__ */ o(
256
+ _t,
210
257
  {
211
- text: v.message,
258
+ text: B.message,
212
259
  type: "info",
213
260
  position: "top-right",
214
261
  autoClose: 5e3,
@@ -216,15 +263,15 @@ const Ut = ({
216
263
  buttonProps: {
217
264
  buttonText: "Undo",
218
265
  showButton: !0,
219
- onButtonClick: () => (Y(), {})
266
+ onButtonClick: () => (ot(), {})
220
267
  },
221
- onCloseToast: () => A(null)
268
+ onCloseToast: () => G(null)
222
269
  },
223
- v.id
270
+ B.id
224
271
  )
225
272
  ] });
226
273
  };
227
274
  export {
228
- Ut as CreateSubAgentPanel
275
+ zt as CreateSubAgentPanel
229
276
  };
230
277
  //# sourceMappingURL=CreateSubAgentPanel.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CreateSubAgentPanel.js","sources":["../../../../../src/components/agent-builder/components/CreateSubAgentPanel.tsx"],"sourcesContent":["import CrossIcon from '@src/assets/icons/cross.svg';\nimport React, { useCallback, useMemo, useRef, useState } from 'react';\nimport { Button } from '@src/components/button';\nimport { SingleOption } from '@src/components/dropdown/type';\nimport { Input } from '@src/components/input';\nimport { Toaster } from '@src/components/toaster';\nimport { BodySecondary, TitleRegular } from '@src/components/TypographyStyle';\nimport { addUnique } from '@src/utils/arrayUtils';\nimport { COLORS } from '@src/constants/Theme';\nimport { AgentTool, SubAgentDraft } from '../AgentBuilder.model';\nimport {\n\tSubAgentCloseButton,\n\tSubAgentPanel,\n\tSubAgentPanelBody,\n\tSubAgentPanelFooter,\n\tSubAgentPanelHeader,\n\tSubAgentPanelHeaderText,\n\tSubAgentScrim,\n} from '../AgentBuilder.styled';\nimport { AGENT_CHAR_LIMITS } from '../constants/charLimits';\nimport type { AgentCharLimits } from '../constants/charLimits';\nimport {\n\tbuildAgentMentionItems,\n\ttoolSourceLabel,\n} from '../utils/mentionSerialization';\nimport { renderSourceIcon, SOURCE_ICONS } from '../utils/sourceIcons';\nimport { MentionEditor } from './MentionEditor';\nimport {\n\tSelectableItem,\n\tSelectableListSection,\n\tSourceGroup,\n} from './SelectableListSection';\n\ntype InsertFn = (kind: 'tool' | 'subagent', id: string, label?: string) => void;\n\ninterface CreateSubAgentPanelProps {\n\tonClose: () => void;\n\t/** Persist the draft. The drawer shows a loader while the returned promise is pending. */\n\tonSave: (draft: SubAgentDraft) => void | Promise<void>;\n\tavailableTools: AgentTool[];\n\t/** Optional \"Improve with AI\" for instructions / guardrails. Omit to hide the buttons. */\n\tonImprove?: (\n\t\tkind: 'instructions' | 'guardrail',\n\t\ttext: string,\n\t) => Promise<string>;\n\t/** Header title — \"Create sub-agent\" (default) or \"Edit sub-agent\". */\n\ttitle?: string;\n\t/** Initial values, e.g. when configuring an existing sub-agent. */\n\tinitial?: SubAgentDraft;\n\t/** Tool-source fallback label for chips (host app). */\n\tappLabel?: string;\n\t/** Resolved character limits (defaults to {@link AGENT_CHAR_LIMITS}). */\n\tcharLimits?: AgentCharLimits;\n}\n\n/**\n * Right-side drawer for creating / editing a sub-agent (name, instructions,\n * guardrails, tools). Instructions & Guardrails are `@`-mention editors (tools\n * only — sub-agents can't nest); adding a tool from the list inserts it at the\n * last-focused field's cursor. Mount it fresh per open (key it) so `initial`\n * seeds the draft.\n */\nexport const CreateSubAgentPanel: React.FC<CreateSubAgentPanelProps> = ({\n\tonClose,\n\tonSave,\n\tavailableTools,\n\tonImprove,\n\ttitle = 'Create sub-agent',\n\tinitial,\n\tappLabel = 'Manifest',\n\tcharLimits = AGENT_CHAR_LIMITS,\n}) => {\n\tconst [name, setName] = useState(initial?.name ?? '');\n\tconst [instructions, setInstructions] = useState(initial?.instructions ?? '');\n\tconst [guardrail, setGuardrail] = useState(initial?.guardrail ?? '');\n\tconst [tools, setTools] = useState<string[]>(initial?.tools ?? []);\n\tconst [saving, setSaving] = useState(false);\n\t// Bumped to remount a field after its text is replaced (e.g. by Improve).\n\tconst [instrKey, setInstrKey] = useState(0);\n\tconst [guardKey, setGuardKey] = useState(0);\n\tconst [improving, setImproving] = useState<\n\t\t'instructions' | 'guardrail' | null\n\t>(null);\n\n\t// Tools-only mention list (sub-agents can't reference other sub-agents).\n\tconst mentionItems = useMemo(\n\t\t() => buildAgentMentionItems(availableTools, [], appLabel),\n\t\t[availableTools, appLabel],\n\t);\n\n\t// Per-field insert + focus registry, so the Tools list inserts a chip into the\n\t// last-focused editor at its cursor.\n\tconst insertersRef = useRef<\n\t\tPartial<Record<'instructions' | 'guardrail', InsertFn>>\n\t>({});\n\tconst lastFocusedRef = useRef<'instructions' | 'guardrail'>('instructions');\n\tconst registerInstr = useCallback((fn: InsertFn | null) => {\n\t\tinsertersRef.current.instructions = fn ?? undefined;\n\t}, []);\n\tconst registerGuard = useCallback((fn: InsertFn | null) => {\n\t\tinsertersRef.current.guardrail = fn ?? undefined;\n\t}, []);\n\tconst focusInstr = useCallback(() => {\n\t\tlastFocusedRef.current = 'instructions';\n\t}, []);\n\tconst focusGuard = useCallback(() => {\n\t\tlastFocusedRef.current = 'guardrail';\n\t}, []);\n\tconst addToolMention = useCallback(\n\t\t(kind: 'tool' | 'subagent', id: string) => {\n\t\t\tif (kind === 'tool') {\n\t\t\t\tsetTools((prev) => addUnique(prev, id));\n\t\t\t}\n\t\t},\n\t\t[],\n\t);\n\tconst insertToolAtCursor = useCallback((id: string) => {\n\t\tconst target =\n\t\t\tinsertersRef.current[lastFocusedRef.current] ??\n\t\t\tinsertersRef.current.instructions;\n\t\ttarget?.('tool', id);\n\t}, []);\n\n\t// Local undo toast for tool removal (drawer state isn't in AgentValue).\n\tconst [undo, setUndo] = useState<{ id: number; message: string } | null>(\n\t\tnull,\n\t);\n\tconst undoSnapshotRef = useRef<{\n\t\tinstructions: string;\n\t\tguardrail: string;\n\t\ttools: string[];\n\t} | null>(null);\n\tconst undoIdRef = useRef(0);\n\n\tconst removeTool = (id: string) => {\n\t\tconst tool = availableTools.find((t) => t.tool_id === id);\n\t\t// The token stores the tool id (a tool's id is its tool_id).\n\t\tconst token = `{{tool:${id}}}`;\n\t\tconst strip = (text: string) => text.split(token).join('');\n\t\tundoSnapshotRef.current = { instructions, guardrail, tools };\n\t\tsetInstructions((prev) => strip(prev));\n\t\tsetGuardrail((prev) => strip(prev));\n\t\tsetTools((prev) => prev.filter((t) => t !== id));\n\t\tsetInstrKey((k) => k + 1);\n\t\tsetGuardKey((k) => k + 1);\n\t\tundoIdRef.current += 1;\n\t\tsetUndo({\n\t\t\tid: undoIdRef.current,\n\t\t\tmessage: `Tool \"${tool?.display_name ?? 'Tool'}\" removed`,\n\t\t});\n\t};\n\n\tconst undoRemove = () => {\n\t\tconst snap = undoSnapshotRef.current;\n\t\tif (snap) {\n\t\t\tsetInstructions(snap.instructions);\n\t\t\tsetGuardrail(snap.guardrail);\n\t\t\tsetTools(snap.tools);\n\t\t\tsetInstrKey((k) => k + 1);\n\t\t\tsetGuardKey((k) => k + 1);\n\t\t\tundoSnapshotRef.current = null;\n\t\t}\n\t\tsetUndo(null);\n\t};\n\n\tconst canSave =\n\t\tname.trim().length > 0 &&\n\t\t(instructions.trim().length > 0 || guardrail.trim().length > 0);\n\n\tconst toolItems: SelectableItem[] = tools\n\t\t.map((id): SelectableItem | null => {\n\t\t\tconst tool = availableTools.find((t) => t.tool_id === id);\n\t\t\treturn tool\n\t\t\t\t? {\n\t\t\t\t\t\tid,\n\t\t\t\t\t\tlabel: tool.display_name,\n\t\t\t\t\t\ticon: SOURCE_ICONS[tool.source ?? 'manifest'],\n\t\t\t\t }\n\t\t\t\t: null;\n\t\t})\n\t\t.filter((x): x is SelectableItem => x !== null);\n\n\t// Offer all tools (re-add allowed); the chip list stays deduped. Icon left of\n\t// the name, no description.\n\tconst toolOptions: SingleOption[] = availableTools.map((t) => ({\n\t\tlabel: t.display_name,\n\t\tvalue: t.tool_id,\n\t\tleadingIcon:\n\t\t\trenderSourceIcon(SOURCE_ICONS[t.source ?? 'manifest']) ?? undefined,\n\t}));\n\n\t// Group tools by source (Manifest / Shopify / …) so the empty state shows the\n\t// same per-source buttons as the main builder's side panel.\n\tconst toolSourceGroups: SourceGroup[] = (() => {\n\t\tconst order: string[] = [];\n\t\tconst bySource = new Map<string, SingleOption[]>();\n\t\tavailableTools.forEach((t) => {\n\t\t\tconst src = t.source ?? 'manifest';\n\t\t\tif (!bySource.has(src)) {\n\t\t\t\tbySource.set(src, []);\n\t\t\t\torder.push(src);\n\t\t\t}\n\t\t\tbySource.get(src)?.push({\n\t\t\t\tlabel: t.display_name,\n\t\t\t\tvalue: t.tool_id,\n\t\t\t\tleadingIcon:\n\t\t\t\t\trenderSourceIcon(SOURCE_ICONS[t.source ?? 'manifest']) ?? undefined,\n\t\t\t});\n\t\t});\n\t\treturn order.map((src) => ({\n\t\t\tsource: src,\n\t\t\tlabel: toolSourceLabel(src),\n\t\t\toptions: bySource.get(src) ?? [],\n\t\t}));\n\t})();\n\n\tconst handleSave = async () => {\n\t\tif (!canSave || saving) {\n\t\t\treturn;\n\t\t}\n\t\tconst result = onSave({\n\t\t\tname: name.trim(),\n\t\t\tinstructions,\n\t\t\tguardrail,\n\t\t\ttools,\n\t\t});\n\t\tif (result && typeof (result as Promise<void>).then === 'function') {\n\t\t\tsetSaving(true);\n\t\t\ttry {\n\t\t\t\tawait result;\n\t\t\t} finally {\n\t\t\t\tsetSaving(false);\n\t\t\t}\n\t\t}\n\t};\n\n\tconst handleImprove = async (kind: 'instructions' | 'guardrail') => {\n\t\tif (!onImprove || improving) {\n\t\t\treturn;\n\t\t}\n\t\tsetImproving(kind);\n\t\ttry {\n\t\t\tconst current = kind === 'instructions' ? instructions : guardrail;\n\t\t\tconst improved = await onImprove(kind, current);\n\t\t\tif (kind === 'instructions') {\n\t\t\t\tsetInstructions(improved);\n\t\t\t\tsetInstrKey((k) => k + 1);\n\t\t\t} else {\n\t\t\t\tsetGuardrail(improved);\n\t\t\t\tsetGuardKey((k) => k + 1);\n\t\t\t}\n\t\t} finally {\n\t\t\tsetImproving(null);\n\t\t}\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<SubAgentScrim onClick={onClose} data-test=\"subagent-scrim\" />\n\t\t\t<SubAgentPanel data-test=\"create-subagent-panel\">\n\t\t\t\t<SubAgentPanelHeader>\n\t\t\t\t\t<SubAgentPanelHeaderText>\n\t\t\t\t\t\t<TitleRegular color={COLORS.content.primary}>{title}</TitleRegular>\n\t\t\t\t\t\t<BodySecondary color={COLORS.content.secondary}>\n\t\t\t\t\t\t\tEach sub-agent handles one piece of the job. Use @ in the main\n\t\t\t\t\t\t\tinstructions to call them.\n\t\t\t\t\t\t</BodySecondary>\n\t\t\t\t\t</SubAgentPanelHeaderText>\n\t\t\t\t\t<SubAgentCloseButton onClick={onClose} aria-label=\"Close\">\n\t\t\t\t\t\t<CrossIcon\n\t\t\t\t\t\t\twidth={20}\n\t\t\t\t\t\t\theight={20}\n\t\t\t\t\t\t\tcolor={COLORS.content.secondary}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</SubAgentCloseButton>\n\t\t\t\t</SubAgentPanelHeader>\n\n\t\t\t\t<SubAgentPanelBody>\n\t\t\t\t\t<Input\n\t\t\t\t\t\tdata-test=\"subagent-name\"\n\t\t\t\t\t\tlabelText=\"Agent name\"\n\t\t\t\t\t\tlabelTextBold\n\t\t\t\t\t\tplaceholder=\"Enter agent name\"\n\t\t\t\t\t\tvalue={name}\n\t\t\t\t\t\tmaxCharLimit={charLimits.name}\n\t\t\t\t\t\tmaxCharLimitPosition=\"TOP\"\n\t\t\t\t\t\tmaxCharStyle={{ fontSize: 12, lineHeight: '16px' }}\n\t\t\t\t\t\tonChangeText={setName}\n\t\t\t\t\t/>\n\n\t\t\t\t\t<MentionEditor\n\t\t\t\t\t\tdata-test=\"subagent-instructions\"\n\t\t\t\t\t\tlabel=\"Instructions\"\n\t\t\t\t\t\tvalue={instructions}\n\t\t\t\t\t\tonChange={setInstructions}\n\t\t\t\t\t\tmaxLength={charLimits.instructions}\n\t\t\t\t\t\tplaceholder=\"Write the steps in plain English. Type @ to reference a tool.\"\n\t\t\t\t\t\tminHeight=\"160px\"\n\t\t\t\t\t\tresetKey={`instr-${instrKey}`}\n\t\t\t\t\t\tmentionItems={mentionItems}\n\t\t\t\t\t\ttools={availableTools}\n\t\t\t\t\t\tonMentionSelect={addToolMention}\n\t\t\t\t\t\tonFocus={focusInstr}\n\t\t\t\t\t\tregisterInsert={registerInstr}\n\t\t\t\t\t/>\n\n\t\t\t\t\t<MentionEditor\n\t\t\t\t\t\tdata-test=\"subagent-guardrail\"\n\t\t\t\t\t\tlabel=\"Guardrails\"\n\t\t\t\t\t\tvalue={guardrail}\n\t\t\t\t\t\tonChange={setGuardrail}\n\t\t\t\t\t\tmaxLength={charLimits.guardrail}\n\t\t\t\t\t\tplaceholder=\"e.g. Never discuss competitor pricing. Type @ to reference a tool.\"\n\t\t\t\t\t\tminHeight=\"160px\"\n\t\t\t\t\t\tresetKey={`guard-${guardKey}`}\n\t\t\t\t\t\tmentionItems={mentionItems}\n\t\t\t\t\t\ttools={availableTools}\n\t\t\t\t\t\tonMentionSelect={addToolMention}\n\t\t\t\t\t\tonFocus={focusGuard}\n\t\t\t\t\t\tregisterInsert={registerGuard}\n\t\t\t\t\t/>\n\n\t\t\t\t\t<SelectableListSection\n\t\t\t\t\t\ttitle=\"Tools this agent can use\"\n\t\t\t\t\t\tdataTestPrefix=\"subagent-tools\"\n\t\t\t\t\t\titems={toolItems}\n\t\t\t\t\t\taddableOptions={toolOptions}\n\t\t\t\t\t\tsourceGroups={toolSourceGroups}\n\t\t\t\t\t\tmentionItems={mentionItems}\n\t\t\t\t\t\temptyText=\"No tools added yet.\"\n\t\t\t\t\t\tonAdd={(id) => {\n\t\t\t\t\t\t\tinsertToolAtCursor(id);\n\t\t\t\t\t\t\tsetTools((prev) => addUnique(prev, id));\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tonRemove={removeTool}\n\t\t\t\t\t/>\n\t\t\t\t</SubAgentPanelBody>\n\n\t\t\t\t<SubAgentPanelFooter>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tdata-test=\"subagent-save\"\n\t\t\t\t\t\tbuttonType=\"primary\"\n\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\tbuttonText=\"Save\"\n\t\t\t\t\t\tdisabled={!canSave}\n\t\t\t\t\t\tisLoading={saving}\n\t\t\t\t\t\tonClick={handleSave}\n\t\t\t\t\t/>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tdata-test=\"subagent-cancel\"\n\t\t\t\t\t\tbuttonType=\"tertiaryGray\"\n\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\tbuttonText=\"Cancel\"\n\t\t\t\t\t\tonClick={onClose}\n\t\t\t\t\t/>\n\t\t\t\t</SubAgentPanelFooter>\n\t\t\t</SubAgentPanel>\n\n\t\t\t{undo && (\n\t\t\t\t<Toaster\n\t\t\t\t\tkey={undo.id}\n\t\t\t\t\ttext={undo.message}\n\t\t\t\t\ttype=\"info\"\n\t\t\t\t\tposition=\"top-right\"\n\t\t\t\t\tautoClose={5000}\n\t\t\t\t\thideCloseButton\n\t\t\t\t\tbuttonProps={{\n\t\t\t\t\t\tbuttonText: 'Undo',\n\t\t\t\t\t\tshowButton: true,\n\t\t\t\t\t\tonButtonClick: () => {\n\t\t\t\t\t\t\tundoRemove();\n\t\t\t\t\t\t\treturn {} as Record<string, never>;\n\t\t\t\t\t\t},\n\t\t\t\t\t}}\n\t\t\t\t\tonCloseToast={() => setUndo(null)}\n\t\t\t\t/>\n\t\t\t)}\n\t\t</>\n\t);\n};\n"],"names":["CreateSubAgentPanel","onClose","onSave","availableTools","onImprove","title","initial","appLabel","charLimits","AGENT_CHAR_LIMITS","name","setName","useState","instructions","setInstructions","guardrail","setGuardrail","tools","setTools","saving","setSaving","instrKey","setInstrKey","guardKey","setGuardKey","improving","setImproving","mentionItems","useMemo","buildAgentMentionItems","insertersRef","useRef","lastFocusedRef","registerInstr","useCallback","fn","registerGuard","focusInstr","focusGuard","addToolMention","kind","id","prev","addUnique","insertToolAtCursor","undo","setUndo","undoSnapshotRef","undoIdRef","removeTool","tool","t","token","strip","text","k","undoRemove","snap","canSave","toolItems","SOURCE_ICONS","x","toolOptions","renderSourceIcon","toolSourceGroups","order","bySource","src","toolSourceLabel","handleSave","result","jsxs","Fragment","jsx","SubAgentScrim","SubAgentPanel","SubAgentPanelHeader","SubAgentPanelHeaderText","TitleRegular","COLORS","BodySecondary","SubAgentCloseButton","CrossIcon","SubAgentPanelBody","Input","MentionEditor","SelectableListSection","SubAgentPanelFooter","Button","Toaster"],"mappings":";;;;;;;;;;;;;;;AA8DO,MAAMA,KAA0D,CAAC;AAAA,EACvE,SAAAC;AAAA,EACA,QAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,WAAAC;AAAA,EACA,OAAAC,IAAQ;AAAA,EACR,SAAAC;AAAA,EACA,UAAAC,IAAW;AAAA,EACX,YAAAC,IAAaC;AACd,MAAM;AACL,QAAM,CAACC,GAAMC,CAAO,IAAIC,EAASN,GAAS,QAAQ,EAAE,GAC9C,CAACO,GAAcC,CAAe,IAAIF,EAASN,GAAS,gBAAgB,EAAE,GACtE,CAACS,GAAWC,CAAY,IAAIJ,EAASN,GAAS,aAAa,EAAE,GAC7D,CAACW,GAAOC,CAAQ,IAAIN,EAAmBN,GAAS,SAAS,EAAE,GAC3D,CAACa,GAAQC,CAAS,IAAIR,EAAS,EAAK,GAEpC,CAACS,GAAUC,CAAW,IAAIV,EAAS,CAAC,GACpC,CAACW,GAAUC,CAAW,IAAIZ,EAAS,CAAC,GACpC,CAACa,IAAWC,EAAY,IAAId,EAEhC,IAAI,GAGAe,IAAeC;AAAA,IACpB,MAAMC,GAAuB1B,GAAgB,CAAA,GAAII,CAAQ;AAAA,IACzD,CAACJ,GAAgBI,CAAQ;AAAA,EAAA,GAKpBuB,IAAeC,EAEnB,EAAE,GACEC,IAAiBD,EAAqC,cAAc,GACpEE,IAAgBC,EAAY,CAACC,MAAwB;AAC1D,IAAAL,EAAa,QAAQ,eAAeK,KAAM;AAAA,EAC3C,GAAG,CAAA,CAAE,GACCC,IAAgBF,EAAY,CAACC,MAAwB;AAC1D,IAAAL,EAAa,QAAQ,YAAYK,KAAM;AAAA,EACxC,GAAG,CAAA,CAAE,GACCE,IAAaH,EAAY,MAAM;AACpC,IAAAF,EAAe,UAAU;AAAA,EAC1B,GAAG,CAAA,CAAE,GACC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AAA,EACA,UAAA;AAAA,QAAA,gBAAAd;AAAA,UAACe;AAAA,UAAA;AAAA,YACA,aAAU;AAAA,YACV,YAAW;AAAA,YACX,MAAK;AAAA,YACL,YAAW;AAAA,YACX,UAAU,CAAC9B;AAAA,YACX,WAAWvC;AAAA,YACX,SAASkD;AAAA,UAAA;AAAA,QAAA;AAAA,QAEV,gBAAAI;AAAA,UAACe;AAAA,UAAA;AAAA,YACA,aAAU;AAAA,YACV,YAAW;AAAA,YACX,MAAK;AAAA,YACL,YAAW;AAAA,YACX,SAASvF;AAAA,UAAA;AAAA,QAAA;AAAA,MACV,EAAA,CACD;AAAA,IAAA,GACD;AAAA,IAEC4C,KACA,gBAAA4B;AAAA,MAACgB;AAAA,MAAA;AAAA,QAEA,MAAM5C,EAAK;AAAA,QACX,MAAK;AAAA,QACL,UAAS;AAAA,QACT,WAAW;AAAA,QACX,iBAAe;AAAA,QACf,aAAa;AAAA,UACZ,YAAY;AAAA,UACZ,YAAY;AAAA,UACZ,eAAe,OACdW,EAAA,GACO,CAAA;AAAA,QACR;AAAA,QAED,cAAc,MAAMV,EAAQ,IAAI;AAAA,MAAA;AAAA,MAd3BD,EAAK;AAAA,IAAA;AAAA,EAeX,GAEF;AAEF;"}
1
+ {"version":3,"file":"CreateSubAgentPanel.js","sources":["../../../../../src/components/agent-builder/components/CreateSubAgentPanel.tsx"],"sourcesContent":["import CrossIcon from '@src/assets/icons/cross.svg';\nimport React, { useCallback, useMemo, useRef, useState } from 'react';\nimport styled from 'styled-components';\nimport { Button } from '@src/components/button';\nimport { SingleOption } from '@src/components/dropdown/type';\nimport { Input } from '@src/components/input';\nimport { Toaster } from '@src/components/toaster';\nimport { BodySecondary, TitleRegular } from '@src/components/TypographyStyle';\nimport { addUnique } from '@src/utils/arrayUtils';\nimport { COLORS } from '@src/constants/Theme';\nimport { AgentTool, SubAgentDraft } from '../AgentBuilder.model';\nimport {\n\tSubAgentCloseButton,\n\tSubAgentPanel,\n\tSubAgentPanelBody,\n\tSubAgentPanelFooter,\n\tSubAgentPanelHeader,\n\tSubAgentPanelHeaderText,\n\tSubAgentScrim,\n} from '../AgentBuilder.styled';\nimport { AGENT_CHAR_LIMITS } from '../constants/charLimits';\nimport type { AgentCharLimits } from '../constants/charLimits';\nimport {\n\tbuildAgentMentionItems,\n\ttoolSourceLabel,\n} from '../utils/mentionSerialization';\nimport { renderSourceIcon, SOURCE_ICONS } from '../utils/sourceIcons';\nimport { MentionEditor } from './MentionEditor';\nimport {\n\tSelectableItem,\n\tSelectableListSection,\n\tSourceGroup,\n} from './SelectableListSection';\n\nconst ImproveButton = styled.button`\n\talign-self: flex-start;\n\tborder: 1px solid ${COLORS.stroke.primary};\n\tcolor: ${COLORS.content.primary};\n\tbackground: ${COLORS.surface.standard};\n\tborder-radius: 8px;\n\tpadding: 6px 12px;\n\tfont-size: 13px;\n\tline-height: 1.1;\n\tfont-weight: 600;\n\tcursor: pointer;\n\n\t&:disabled {\n\t\tcursor: default;\n\t\topacity: 0.6;\n\t}\n`;\n\ntype InsertFn = (kind: 'tool' | 'subagent', id: string, label?: string) => void;\n\ninterface CreateSubAgentPanelProps {\n\tonClose: () => void;\n\t/** Persist the draft. The drawer shows a loader while the returned promise is pending. */\n\tonSave: (draft: SubAgentDraft) => void | Promise<void>;\n\tavailableTools: AgentTool[];\n\t/** Optional \"Improve with AI\" for instructions / guardrails. Omit to hide the buttons. */\n\tonImprove?: (\n\t\tkind: 'instructions' | 'guardrail',\n\t\ttext: string,\n\t) => Promise<string>;\n\t/** Header title — \"Create sub-agent\" (default) or \"Edit sub-agent\". */\n\ttitle?: string;\n\t/** Initial values, e.g. when configuring an existing sub-agent. */\n\tinitial?: SubAgentDraft;\n\t/** Tool-source fallback label for chips (host app). */\n\tappLabel?: string;\n\t/** Resolved character limits (defaults to {@link AGENT_CHAR_LIMITS}). */\n\tcharLimits?: AgentCharLimits;\n}\n\n/**\n * Right-side drawer for creating / editing a sub-agent (name, instructions,\n * guardrails, tools). Instructions & Guardrails are `@`-mention editors (tools\n * only — sub-agents can't nest); adding a tool from the list inserts it at the\n * last-focused field's cursor. Mount it fresh per open (key it) so `initial`\n * seeds the draft.\n */\nexport const CreateSubAgentPanel: React.FC<CreateSubAgentPanelProps> = ({\n\tonClose,\n\tonSave,\n\tavailableTools,\n\tonImprove,\n\ttitle = 'Create sub-agent',\n\tinitial,\n\tappLabel = 'Manifest',\n\tcharLimits = AGENT_CHAR_LIMITS,\n}) => {\n\tconst [name, setName] = useState(initial?.name ?? '');\n\tconst [instructions, setInstructions] = useState(initial?.instructions ?? '');\n\tconst [guardrail, setGuardrail] = useState(initial?.guardrail ?? '');\n\tconst [tools, setTools] = useState<string[]>(initial?.tools ?? []);\n\tconst [saving, setSaving] = useState(false);\n\t// Bumped to remount a field after its text is replaced (e.g. by Improve).\n\tconst [instrKey, setInstrKey] = useState(0);\n\tconst [guardKey, setGuardKey] = useState(0);\n\tconst [improving, setImproving] = useState<\n\t\t'instructions' | 'guardrail' | null\n\t>(null);\n\n\t// Tools-only mention list (sub-agents can't reference other sub-agents).\n\tconst mentionItems = useMemo(\n\t\t() => buildAgentMentionItems(availableTools, [], appLabel),\n\t\t[availableTools, appLabel],\n\t);\n\n\t// Per-field insert + focus registry, so the Tools list inserts a chip into the\n\t// last-focused editor at its cursor.\n\tconst insertersRef = useRef<\n\t\tPartial<Record<'instructions' | 'guardrail', InsertFn>>\n\t>({});\n\tconst lastFocusedRef = useRef<'instructions' | 'guardrail'>('instructions');\n\tconst registerInstr = useCallback((fn: InsertFn | null) => {\n\t\tinsertersRef.current.instructions = fn ?? undefined;\n\t}, []);\n\tconst registerGuard = useCallback((fn: InsertFn | null) => {\n\t\tinsertersRef.current.guardrail = fn ?? undefined;\n\t}, []);\n\tconst focusInstr = useCallback(() => {\n\t\tlastFocusedRef.current = 'instructions';\n\t}, []);\n\tconst focusGuard = useCallback(() => {\n\t\tlastFocusedRef.current = 'guardrail';\n\t}, []);\n\tconst addToolMention = useCallback(\n\t\t(kind: 'tool' | 'subagent', id: string) => {\n\t\t\tif (kind === 'tool') {\n\t\t\t\tsetTools((prev) => addUnique(prev, id));\n\t\t\t}\n\t\t},\n\t\t[],\n\t);\n\tconst insertToolAtCursor = useCallback((id: string) => {\n\t\tconst target =\n\t\t\tinsertersRef.current[lastFocusedRef.current] ??\n\t\t\tinsertersRef.current.instructions;\n\t\ttarget?.('tool', id);\n\t}, []);\n\n\t// Local undo toast for tool removal (drawer state isn't in AgentValue).\n\tconst [undo, setUndo] = useState<{ id: number; message: string } | null>(\n\t\tnull,\n\t);\n\tconst undoSnapshotRef = useRef<{\n\t\tinstructions: string;\n\t\tguardrail: string;\n\t\ttools: string[];\n\t} | null>(null);\n\tconst undoIdRef = useRef(0);\n\n\tconst removeTool = (id: string) => {\n\t\tconst tool = availableTools.find((t) => t.tool_id === id);\n\t\t// The token stores the tool id (a tool's id is its tool_id).\n\t\tconst token = `{{tool:${id}}}`;\n\t\tconst strip = (text: string) => text.split(token).join('');\n\t\tundoSnapshotRef.current = { instructions, guardrail, tools };\n\t\tsetInstructions((prev) => strip(prev));\n\t\tsetGuardrail((prev) => strip(prev));\n\t\tsetTools((prev) => prev.filter((t) => t !== id));\n\t\tsetInstrKey((k) => k + 1);\n\t\tsetGuardKey((k) => k + 1);\n\t\tundoIdRef.current += 1;\n\t\tsetUndo({\n\t\t\tid: undoIdRef.current,\n\t\t\tmessage: `Tool \"${tool?.display_name ?? 'Tool'}\" removed`,\n\t\t});\n\t};\n\n\tconst undoRemove = () => {\n\t\tconst snap = undoSnapshotRef.current;\n\t\tif (snap) {\n\t\t\tsetInstructions(snap.instructions);\n\t\t\tsetGuardrail(snap.guardrail);\n\t\t\tsetTools(snap.tools);\n\t\t\tsetInstrKey((k) => k + 1);\n\t\t\tsetGuardKey((k) => k + 1);\n\t\t\tundoSnapshotRef.current = null;\n\t\t}\n\t\tsetUndo(null);\n\t};\n\n\tconst canSave =\n\t\tname.trim().length > 0 &&\n\t\t(instructions.trim().length > 0 || guardrail.trim().length > 0);\n\n\tconst toolItems: SelectableItem[] = tools\n\t\t.map((id): SelectableItem | null => {\n\t\t\tconst tool = availableTools.find((t) => t.tool_id === id);\n\t\t\treturn tool\n\t\t\t\t? {\n\t\t\t\t\t\tid,\n\t\t\t\t\t\tlabel: tool.display_name,\n\t\t\t\t\t\ticon: SOURCE_ICONS[tool.source ?? 'manifest'],\n\t\t\t\t }\n\t\t\t\t: null;\n\t\t})\n\t\t.filter((x): x is SelectableItem => x !== null);\n\n\t// Offer all tools (re-add allowed); the chip list stays deduped. Icon left of\n\t// the name, no description.\n\tconst toolOptions: SingleOption[] = availableTools.map((t) => ({\n\t\tlabel: t.display_name,\n\t\tvalue: t.tool_id,\n\t\tleadingIcon:\n\t\t\trenderSourceIcon(SOURCE_ICONS[t.source ?? 'manifest']) ?? undefined,\n\t}));\n\n\t// Group tools by source (Manifest / Shopify / …) so the empty state shows the\n\t// same per-source buttons as the main builder's side panel.\n\tconst toolSourceGroups: SourceGroup[] = (() => {\n\t\tconst order: string[] = [];\n\t\tconst bySource = new Map<string, SingleOption[]>();\n\t\tavailableTools.forEach((t) => {\n\t\t\tconst src = t.source ?? 'manifest';\n\t\t\tif (!bySource.has(src)) {\n\t\t\t\tbySource.set(src, []);\n\t\t\t\torder.push(src);\n\t\t\t}\n\t\t\tbySource.get(src)?.push({\n\t\t\t\tlabel: t.display_name,\n\t\t\t\tvalue: t.tool_id,\n\t\t\t\tleadingIcon:\n\t\t\t\t\trenderSourceIcon(SOURCE_ICONS[t.source ?? 'manifest']) ?? undefined,\n\t\t\t});\n\t\t});\n\t\treturn order.map((src) => ({\n\t\t\tsource: src,\n\t\t\tlabel: toolSourceLabel(src),\n\t\t\toptions: bySource.get(src) ?? [],\n\t\t}));\n\t})();\n\n\tconst handleSave = async () => {\n\t\tif (!canSave || saving) {\n\t\t\treturn;\n\t\t}\n\t\tconst result = onSave({\n\t\t\tname: name.trim(),\n\t\t\tinstructions,\n\t\t\tguardrail,\n\t\t\ttools,\n\t\t});\n\t\tif (result && typeof (result as Promise<void>).then === 'function') {\n\t\t\tsetSaving(true);\n\t\t\ttry {\n\t\t\t\tawait result;\n\t\t\t} finally {\n\t\t\t\tsetSaving(false);\n\t\t\t}\n\t\t}\n\t};\n\n\tconst handleImprove = async (kind: 'instructions' | 'guardrail') => {\n\t\tif (!onImprove || improving) {\n\t\t\treturn;\n\t\t}\n\t\tsetImproving(kind);\n\t\ttry {\n\t\t\tconst current = kind === 'instructions' ? instructions : guardrail;\n\t\t\tconst improved = await onImprove(kind, current);\n\t\t\tif (kind === 'instructions') {\n\t\t\t\tsetInstructions(improved);\n\t\t\t\tsetInstrKey((k) => k + 1);\n\t\t\t} else {\n\t\t\t\tsetGuardrail(improved);\n\t\t\t\tsetGuardKey((k) => k + 1);\n\t\t\t}\n\t\t} finally {\n\t\t\tsetImproving(null);\n\t\t}\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<SubAgentScrim onClick={onClose} data-test=\"subagent-scrim\" />\n\t\t\t<SubAgentPanel data-test=\"create-subagent-panel\">\n\t\t\t\t<SubAgentPanelHeader>\n\t\t\t\t\t<SubAgentPanelHeaderText>\n\t\t\t\t\t\t<TitleRegular color={COLORS.content.primary}>{title}</TitleRegular>\n\t\t\t\t\t\t<BodySecondary color={COLORS.content.secondary}>\n\t\t\t\t\t\t\tEach sub-agent handles one piece of the job. Use @ in the main\n\t\t\t\t\t\t\tinstructions to call them.\n\t\t\t\t\t\t</BodySecondary>\n\t\t\t\t\t</SubAgentPanelHeaderText>\n\t\t\t\t\t<SubAgentCloseButton onClick={onClose} aria-label=\"Close\">\n\t\t\t\t\t\t<CrossIcon\n\t\t\t\t\t\t\twidth={20}\n\t\t\t\t\t\t\theight={20}\n\t\t\t\t\t\t\tcolor={COLORS.content.secondary}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</SubAgentCloseButton>\n\t\t\t\t</SubAgentPanelHeader>\n\n\t\t\t\t<SubAgentPanelBody>\n\t\t\t\t\t<Input\n\t\t\t\t\t\tdata-test=\"subagent-name\"\n\t\t\t\t\t\tlabelText=\"Agent name\"\n\t\t\t\t\t\tlabelTextBold\n\t\t\t\t\t\tplaceholder=\"Enter agent name\"\n\t\t\t\t\t\tvalue={name}\n\t\t\t\t\t\tmaxCharLimit={charLimits.name}\n\t\t\t\t\t\tmaxCharLimitPosition=\"TOP\"\n\t\t\t\t\t\tmaxCharStyle={{ fontSize: 12, lineHeight: '16px' }}\n\t\t\t\t\t\tonChangeText={setName}\n\t\t\t\t\t/>\n\n\t\t\t\t\t<MentionEditor\n\t\t\t\t\t\tdata-test=\"subagent-instructions\"\n\t\t\t\t\t\tlabel=\"Instructions\"\n\t\t\t\t\t\tvalue={instructions}\n\t\t\t\t\t\tonChange={setInstructions}\n\t\t\t\t\t\tmaxLength={charLimits.instructions}\n\t\t\t\t\t\tplaceholder=\"Write the steps in plain English. Type @ to reference a tool.\"\n\t\t\t\t\t\tminHeight=\"160px\"\n\t\t\t\t\t\tresetKey={`instr-${instrKey}`}\n\t\t\t\t\t\tmentionItems={mentionItems}\n\t\t\t\t\t\ttools={availableTools}\n\t\t\t\t\t\tonMentionSelect={addToolMention}\n\t\t\t\t\t\tonFocus={focusInstr}\n\t\t\t\t\t\tregisterInsert={registerInstr}\n\t\t\t\t\t\taction={\n\t\t\t\t\t\t\tonImprove ? (\n\t\t\t\t\t\t\t\t<ImproveButton\n\t\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\t\tdata-test=\"subagent-improve-instructions\"\n\t\t\t\t\t\t\t\t\tdisabled={improving !== null}\n\t\t\t\t\t\t\t\t\tonClick={() => handleImprove('instructions')}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{improving === 'instructions'\n\t\t\t\t\t\t\t\t\t\t? 'Improving…'\n\t\t\t\t\t\t\t\t\t\t: 'Improve with AI'}\n\t\t\t\t\t\t\t\t</ImproveButton>\n\t\t\t\t\t\t\t) : undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\n\t\t\t\t\t<MentionEditor\n\t\t\t\t\t\tdata-test=\"subagent-guardrail\"\n\t\t\t\t\t\tlabel=\"Guardrails\"\n\t\t\t\t\t\tvalue={guardrail}\n\t\t\t\t\t\tonChange={setGuardrail}\n\t\t\t\t\t\tmaxLength={charLimits.guardrail}\n\t\t\t\t\t\tplaceholder=\"e.g. Never discuss competitor pricing. Type @ to reference a tool.\"\n\t\t\t\t\t\tminHeight=\"160px\"\n\t\t\t\t\t\tresetKey={`guard-${guardKey}`}\n\t\t\t\t\t\tmentionItems={mentionItems}\n\t\t\t\t\t\ttools={availableTools}\n\t\t\t\t\t\tonMentionSelect={addToolMention}\n\t\t\t\t\t\tonFocus={focusGuard}\n\t\t\t\t\t\tregisterInsert={registerGuard}\n\t\t\t\t\t\taction={\n\t\t\t\t\t\t\tonImprove ? (\n\t\t\t\t\t\t\t\t<ImproveButton\n\t\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\t\tdata-test=\"subagent-improve-guardrail\"\n\t\t\t\t\t\t\t\t\tdisabled={improving !== null}\n\t\t\t\t\t\t\t\t\tonClick={() => handleImprove('guardrail')}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{improving === 'guardrail' ? 'Improving…' : 'Improve with AI'}\n\t\t\t\t\t\t\t\t</ImproveButton>\n\t\t\t\t\t\t\t) : undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\n\t\t\t\t\t<SelectableListSection\n\t\t\t\t\t\ttitle=\"Tools this agent can use\"\n\t\t\t\t\t\tdataTestPrefix=\"subagent-tools\"\n\t\t\t\t\t\titems={toolItems}\n\t\t\t\t\t\taddableOptions={toolOptions}\n\t\t\t\t\t\tsourceGroups={toolSourceGroups}\n\t\t\t\t\t\tmentionItems={mentionItems}\n\t\t\t\t\t\temptyText=\"No tools added yet.\"\n\t\t\t\t\t\tonAdd={(id) => {\n\t\t\t\t\t\t\tinsertToolAtCursor(id);\n\t\t\t\t\t\t\tsetTools((prev) => addUnique(prev, id));\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tonRemove={removeTool}\n\t\t\t\t\t/>\n\t\t\t\t</SubAgentPanelBody>\n\n\t\t\t\t<SubAgentPanelFooter>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tdata-test=\"subagent-save\"\n\t\t\t\t\t\tbuttonType=\"primary\"\n\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\tbuttonText=\"Save\"\n\t\t\t\t\t\tdisabled={!canSave}\n\t\t\t\t\t\tisLoading={saving}\n\t\t\t\t\t\tonClick={handleSave}\n\t\t\t\t\t/>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tdata-test=\"subagent-cancel\"\n\t\t\t\t\t\tbuttonType=\"tertiaryGray\"\n\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\tbuttonText=\"Cancel\"\n\t\t\t\t\t\tonClick={onClose}\n\t\t\t\t\t/>\n\t\t\t\t</SubAgentPanelFooter>\n\t\t\t</SubAgentPanel>\n\n\t\t\t{undo && (\n\t\t\t\t<Toaster\n\t\t\t\t\tkey={undo.id}\n\t\t\t\t\ttext={undo.message}\n\t\t\t\t\ttype=\"info\"\n\t\t\t\t\tposition=\"top-right\"\n\t\t\t\t\tautoClose={5000}\n\t\t\t\t\thideCloseButton\n\t\t\t\t\tbuttonProps={{\n\t\t\t\t\t\tbuttonText: 'Undo',\n\t\t\t\t\t\tshowButton: true,\n\t\t\t\t\t\tonButtonClick: () => {\n\t\t\t\t\t\t\tundoRemove();\n\t\t\t\t\t\t\treturn {} as Record<string, never>;\n\t\t\t\t\t\t},\n\t\t\t\t\t}}\n\t\t\t\t\tonCloseToast={() => setUndo(null)}\n\t\t\t\t/>\n\t\t\t)}\n\t\t</>\n\t);\n};\n"],"names":["ImproveButton","styled","COLORS","CreateSubAgentPanel","onClose","onSave","availableTools","onImprove","title","initial","appLabel","charLimits","AGENT_CHAR_LIMITS","name","setName","useState","instructions","setInstructions","guardrail","setGuardrail","tools","setTools","saving","setSaving","instrKey","setInstrKey","guardKey","setGuardKey","improving","setImproving","mentionItems","useMemo","buildAgentMentionItems","insertersRef","useRef","lastFocusedRef","registerInstr","useCallback","fn","registerGuard","focusInstr","focusGuard","addToolMention","kind","id","prev","addUnique","insertToolAtCursor","undo","setUndo","undoSnapshotRef","undoIdRef","removeTool","tool","t","token","strip","text","k","undoRemove","snap","canSave","toolItems","SOURCE_ICONS","x","toolOptions","renderSourceIcon","toolSourceGroups","order","bySource","src","toolSourceLabel","handleSave","result","handleImprove","improved","jsxs","Fragment","jsx","SubAgentScrim","SubAgentPanel","SubAgentPanelHeader","SubAgentPanelHeaderText","TitleRegular","BodySecondary","SubAgentCloseButton","CrossIcon","SubAgentPanelBody","Input","MentionEditor","SelectableListSection","SubAgentPanelFooter","Button","Toaster"],"mappings":";;;;;;;;;;;;;;;;AAkCA,MAAMA,IAAgBC,GAAO;AAAA;AAAA,qBAERC,EAAO,OAAO,OAAO;AAAA,UAChCA,EAAO,QAAQ,OAAO;AAAA,eACjBA,EAAO,QAAQ,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GA2CzBC,KAA0D,CAAC;AAAA,EACvE,SAAAC;AAAA,EACA,QAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,WAAAC;AAAA,EACA,OAAAC,IAAQ;AAAA,EACR,SAAAC;AAAA,EACA,UAAAC,IAAW;AAAA,EACX,YAAAC,IAAaC;AACd,MAAM;AACL,QAAM,CAACC,GAAMC,CAAO,IAAIC,EAASN,GAAS,QAAQ,EAAE,GAC9C,CAACO,GAAcC,CAAe,IAAIF,EAASN,GAAS,gBAAgB,EAAE,GACtE,CAACS,GAAWC,CAAY,IAAIJ,EAASN,GAAS,aAAa,EAAE,GAC7D,CAACW,GAAOC,CAAQ,IAAIN,EAAmBN,GAAS,SAAS,EAAE,GAC3D,CAACa,GAAQC,CAAS,IAAIR,EA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AAgBG;AAAA,YAChB,cAAcE;AAAA,YACd,cAAArC;AAAA,YACA,WAAU;AAAA,YACV,OAAO,CAACc,MAAO;AACd,cAAAG,GAAmBH,CAAE,GACrBvB,EAAS,CAACwB,MAASC,EAAUD,GAAMD,CAAE,CAAC;AAAA,YACvC;AAAA,YACA,UAAUQ;AAAA,UAAA;AAAA,QAAA;AAAA,MACX,GACD;AAAA,wBAECuC,IAAA,EACA,UAAA;AAAA,QAAA,gBAAAb;AAAA,UAACc;AAAA,UAAA;AAAA,YACA,aAAU;AAAA,YACV,YAAW;AAAA,YACX,MAAK;AAAA,YACL,YAAW;AAAA,YACX,UAAU,CAAC/B;AAAA,YACX,WAAWvC;AAAA,YACX,SAASkD;AAAA,UAAA;AAAA,QAAA;AAAA,QAEV,gBAAAM;AAAA,UAACc;AAAA,UAAA;AAAA,YACA,aAAU;AAAA,YACV,YAAW;AAAA,YACX,MAAK;AAAA,YACL,YAAW;AAAA,YACX,SAASxF;AAAA,UAAA;AAAA,QAAA;AAAA,MACV,EAAA,CACD;AAAA,IAAA,GACD;AAAA,IAEC4C,KACA,gBAAA8B;AAAA,MAACe;AAAA,MAAA;AAAA,QAEA,MAAM7C,EAAK;AAAA,QACX,MAAK;AAAA,QACL,UAAS;AAAA,QACT,WAAW;AAAA,QACX,iBAAe;AAAA,QACf,aAAa;AAAA,UACZ,YAAY;AAAA,UACZ,YAAY;AAAA,UACZ,eAAe,OACdW,GAAA,GACO,CAAA;AAAA,QACR;AAAA,QAED,cAAc,MAAMV,EAAQ,IAAI;AAAA,MAAA;AAAA,MAd3BD,EAAK;AAAA,IAAA;AAAA,EAeX,GAEF;AAEF;"}
@@ -1,3 +1,3 @@
1
1
  import { default as React } from 'react';
2
- import { HorizontalGraphI } from './HorizontalGraph.d';
2
+ import { HorizontalGraphI } from './HorizontalGraph.type';
3
3
  export declare const HorizontalGraph: React.FC<HorizontalGraphI>;
@@ -1 +1 @@
1
- {"version":3,"file":"HorizontalGraph.js","sources":["../../../../../../src/components/analytics-chips-and-dropdowns/chart/HorizontalBarGraph/HorizontalGraph.tsx"],"sourcesContent":["import {\n\tBarElement,\n\tCategoryScale,\n\tChart as ChartJS,\n\tLinearScale,\n\tTooltip,\n} from 'chart.js';\nimport ChartDataLabels from 'chartjs-plugin-datalabels';\nimport React from 'react';\nimport { Bar } from 'react-chartjs-2';\nimport { TitleRegular } from '@src/components/TypographyStyle';\nimport { COLORS, FONTS } from '@src/constants/Theme';\nimport {\n\ttruncateValueForIndianStore,\n\ttruncateValueForInternationalStore,\n} from '../utils/calcPercentage';\nimport { HorizontalGraphI } from './HorizontalGraph.d';\nimport { GraphContainerWrapper } from './HorizontalGraph.styles';\n\nChartJS.register(\n\tCategoryScale,\n\tLinearScale,\n\tBarElement,\n\tTooltip,\n\tChartDataLabels,\n);\n\nexport const HorizontalGraph: React.FC<HorizontalGraphI> = (props) => {\n\tconst dummyValues = [250, 1000, 800, 1500, 300, 600];\n\n\t// Check if data is present - consider both regular xAxis data and stacked datasets\n\tconst hasStackedData =\n\t\tprops.stacked &&\n\t\tprops.stackedDatasets &&\n\t\tprops.stackedDatasets.length > 0 &&\n\t\tprops.stackedDatasets.some((ds) => ds.data.some((val) => val !== 0));\n\n\tconst hasXAxisData = props.xAxis.data.findIndex((ele) => ele !== 0) !== -1;\n\n\tconst noDataPresent = !hasStackedData && !hasXAxisData;\n\tconst xAxisConfigForNoData = {\n\t\tmin: 0,\n\t\tmax: 2000,\n\t\tstepSize: props.xAxis.stepSize ?? 200,\n\t};\n\tconst options = {\n\t\tindexAxis: 'y' as const,\n\t\telements: {},\n\t\tresponsive: true,\n\t\tmaintainAspectRatio: props.maintainAspectRatio,\n\t\tlayout: {\n\t\t\tpadding: {\n\t\t\t\tright: props.showTotal ? 50 : 0,\n\t\t\t},\n\t\t},\n\t\tplugins: {\n\t\t\tlegend: {\n\t\t\t\tdisplay: false,\n\t\t\t},\n\t\t\ttooltip: {\n\t\t\t\tenabled: !noDataPresent,\n\t\t\t\tcallbacks: {\n\t\t\t\t\tlabel: props.xAxis.toolTipCallback,\n\t\t\t\t\tfooter: props.tooltipConfig?.footerCallback,\n\t\t\t\t},\n\t\t\t\tfooterFont: props.tooltipConfig?.footerStyles?.footerFont,\n\t\t\t},\n\t\t\tdatalabels: {\n\t\t\t\tdisplay: (!noDataPresent && props.showTotal) ?? false,\n\t\t\t\tanchor: 'end' as const,\n\t\t\t\talign: 'end' as const,\n\t\t\t\tclamp: true,\n\t\t\t\tformatter: (_, context) => {\n\t\t\t\t\tconst datasetIndex = context.datasetIndex;\n\t\t\t\t\tconst datasets = context.chart.data.datasets;\n\t\t\t\t\tif (datasetIndex !== datasets.length - 1) {\n\t\t\t\t\t\treturn '';\n\t\t\t\t\t}\n\t\t\t\t\tconst dataIndex = context.dataIndex;\n\t\t\t\t\tlet sum = 0;\n\t\t\t\t\tfor (let i = 0; i < datasets.length; i++) {\n\t\t\t\t\t\tsum += datasets[i].data[dataIndex] ?? 0;\n\t\t\t\t\t}\n\t\t\t\t\tif (!sum) {\n\t\t\t\t\t\treturn '';\n\t\t\t\t\t}\n\t\t\t\t\treturn props.isInternationalStore\n\t\t\t\t\t\t? truncateValueForInternationalStore(sum)\n\t\t\t\t\t\t: truncateValueForIndianStore(sum);\n\t\t\t\t},\n\t\t\t\tcolor: COLORS.content.secondary,\n\t\t\t},\n\t\t},\n\t\tscales: {\n\t\t\ty: {\n\t\t\t\tstacked: props.stacked ?? false,\n\t\t\t\ttitle: {\n\t\t\t\t\tdisplay: !!props.yAxis.title,\n\t\t\t\t\ttext: props.yAxis.title,\n\t\t\t\t\tcolor: props.yAxis.titleColor,\n\t\t\t\t\tfont: { size: FONTS.caption.fontSize, color: props.yAxis.titleColor },\n\t\t\t\t\tpadding: { bottom: 10 },\n\t\t\t\t},\n\t\t\t\tgrid: {\n\t\t\t\t\tdisplay: false,\n\t\t\t\t\tborderColor: COLORS.background.base,\n\t\t\t\t},\n\n\t\t\t\tticks: {\n\t\t\t\t\tfontSize: FONTS.caption.fontSize,\n\t\t\t\t\tcolor: props.yAxis.labelColor ?? COLORS.content.secondary,\n\t\t\t\t},\n\t\t\t},\n\n\t\t\tx: {\n\t\t\t\tstacked: props.stacked ?? false,\n\t\t\t\ttitle: {\n\t\t\t\t\tdisplay: !!props.xAxis.title,\n\t\t\t\t\ttext: props.xAxis.title,\n\t\t\t\t\tcolor: props.xAxis.titleColor,\n\t\t\t\t\tfont: { size: FONTS.caption.fontSize },\n\t\t\t\t\tpadding: { top: 10 },\n\t\t\t\t},\n\t\t\t\tgrid: {\n\t\t\t\t\tborderColor: 'white',\n\t\t\t\t\tcolor: COLORS.background.base,\n\t\t\t\t},\n\t\t\t\tticks: {\n\t\t\t\t\tcallback: props.xAxis.ticksCallback,\n\t\t\t\t\tfontSize: FONTS.caption.fontSize,\n\t\t\t\t\tcolor: props.xAxis.labelColor ?? COLORS.content.secondary,\n\t\t\t\t\t...(noDataPresent\n\t\t\t\t\t\t? xAxisConfigForNoData\n\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\tmax: props.xAxis.max,\n\t\t\t\t\t\t\t\tstepSize: props.xAxis.stepSize,\n\t\t\t\t\t\t }),\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tonClick: (_event: any, elements: any[]) => {\n\t\t\tif (elements.length > 0 && props.onBarClick) {\n\t\t\t\tconst index = elements[0].index;\n\t\t\t\tprops.onBarClick(index);\n\t\t\t}\n\t\t},\n\t} as any;\n\n\tconst getColorSpectrum = (context) => {\n\t\tconst ctx = context.chart.ctx;\n\t\tconst gradient = ctx.createLinearGradient(0, 0, 0, 200);\n\t\tlet rgbaColor = '';\n\t\tif (noDataPresent) {\n\t\t\trgbaColor = 'rgba(0,0,0,0)';\n\t\t} else if (props.barColorRGBA) {\n\t\t\tconst rgb = props.barColorRGBA;\n\t\t\trgbaColor = `rgba(${rgb.r}, ${rgb.g}, ${rgb.b}, ${rgb.a ?? '0.3'})`;\n\t\t}\n\n\t\tgradient.addColorStop(0, rgbaColor ? rgbaColor : 'rgba(146, 96, 237, 0.3)');\n\t\tgradient.addColorStop(1, rgbaColor ? rgbaColor : `rgba(146, 96, 237, 0.3)`);\n\n\t\treturn gradient;\n\t};\n\n\t// Get background color - supports per-bar colors via barColors array\n\tconst getBackgroundColor = () => {\n\t\tif (noDataPresent) {\n\t\t\treturn 'rgba(0,0,0,0)';\n\t\t}\n\t\t// If barColors array is provided, use it for per-bar coloring\n\t\tif (props.barColors && props.barColors.length > 0) {\n\t\t\treturn props.barColors;\n\t\t}\n\t\t// Fallback to single color via getColorSpectrum\n\t\treturn (context) => getColorSpectrum(context);\n\t};\n\n\t// Build datasets - support stacked datasets if provided\n\tconst buildDatasets = () => {\n\t\tif (\n\t\t\tprops.stacked &&\n\t\t\tprops.stackedDatasets &&\n\t\t\tprops.stackedDatasets.length > 0\n\t\t) {\n\t\t\treturn props.stackedDatasets.map((dataset) => ({\n\t\t\t\tlabel: dataset.label || '',\n\t\t\t\tdata: noDataPresent ? dummyValues : dataset.data,\n\t\t\t\tbackgroundColor: dataset.backgroundColor,\n\t\t\t\tbarPercentage: 0.4,\n\t\t\t\tcategoryPercentage: 1,\n\t\t\t\tborderRadius: 4,\n\t\t\t}));\n\t\t}\n\t\t// Default single dataset\n\t\treturn [\n\t\t\t{\n\t\t\t\tdata: noDataPresent ? dummyValues : props.xAxis.data,\n\t\t\t\tbackgroundColor: getBackgroundColor(),\n\t\t\t\tbarPercentage: 0.4,\n\t\t\t\tcategoryPercentage: 1,\n\t\t\t\tborderRadius: 4,\n\t\t\t},\n\t\t];\n\t};\n\n\tconst data = {\n\t\tlabels: props.yAxis.data.map((d) => d.toString()),\n\t\tdatasets: buildDatasets(),\n\t};\n\treturn (\n\t\t<GraphContainerWrapper\n\t\t\tpadding={props.outerPadding}\n\t\t\tskipOuterLayout={props.skipOuterLayout}\n\t\t>\n\t\t\t{props.chartHeading && (\n\t\t\t\t<TitleRegular\n\t\t\t\t\tcolor={props.chartHeading.color ?? COLORS.content.secondary}\n\t\t\t\t>\n\t\t\t\t\t{props.chartHeading.heading}\n\t\t\t\t</TitleRegular>\n\t\t\t)}\n\t\t\t<div\n\t\t\t\tstyle={{\n\t\t\t\t\theight: props.maintainAspectRatio\n\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t: props.graphCanvasHeight ?? 500,\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t<Bar options={options} data={data} />\n\t\t\t</div>\n\t\t</GraphContainerWrapper>\n\t);\n};\n"],"names":["ChartJS","CategoryScale","LinearScale","BarElement","Tooltip","ChartDataLabels","HorizontalGraph","props","dummyValues","hasStackedData","ds","val","hasXAxisData","ele","noDataPresent","xAxisConfigForNoData","options","_","context","datasetIndex","datasets","dataIndex","sum","i","truncateValueForInternationalStore","truncateValueForIndianStore","COLORS","FONTS","_event","elements","index","getColorSpectrum","gradient","rgbaColor","rgb","getBackgroundColor","buildDatasets","dataset","data","d","jsxs","GraphContainerWrapper","jsx","TitleRegular","Bar"],"mappings":";;;;;;;;AAmBAA,EAAQ;AAAA,EACPC;AAAA,EACAC;AAAA,EACAC;AAAA,EACAC;AAAA,EACAC;AACD;AAEO,MAAMC,IAA8C,CAACC,MAAU;AACrE,QAAMC,IAAc,CAAC,KAAK,KAAM,KAAK,MAAM,KAAK,GAAG,GAG7CC,IACLF,EAAM,WACNA,EAAM,mBACNA,EAAM,gBAAgB,SAAS,KAC/BA,EAAM,gBAAgB,KAAK,CAACG,MAAOA,EAAG,KAAK,KAAK,CAACC,MAAQA,MAAQ,CAAC,CAAC,GAE9DC,IAAeL,EAAM,MAAM,KAAK,UAAU,CAACM,MAAQA,MAAQ,CAAC,MAAM,IAElEC,IAAgB,CAACL,KAAkB,CAACG,GACpCG,IAAuB;AAAA,IAC5B,KAAK;AAAA,IACL,KAAK;AAAA,IACL,UAAUR,EAAM,MAAM,YAAY;AAAA,EAAA,GAE7BS,IAAU;AAAA,IACf,WAAW;AAAA,IACX,UAAU,CAAA;AAAA,IACV,YAAY;AAAA,IACZ,q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AAA,UAAC;AAAA,UAAA;AAAA,YACA,OAAO;AAAA,cACN,QAAQnC,EAAM,sBACX,SACAA,EAAM,qBAAqB;AAAA,YAAA;AAAA,YAG/B,UAAA,gBAAAmC,EAACE,GAAA,EAAI,SAAA5B,GAAkB,MAAAsB,EAAA,CAAY;AAAA,UAAA;AAAA,QAAA;AAAA,MACpC;AAAA,IAAA;AAAA,EAAA;AAGH;"}
1
+ {"version":3,"file":"HorizontalGraph.js","sources":["../../../../../../src/components/analytics-chips-and-dropdowns/chart/HorizontalBarGraph/HorizontalGraph.tsx"],"sourcesContent":["import {\n\tBarElement,\n\tCategoryScale,\n\tChart as ChartJS,\n\tLinearScale,\n\tTooltip,\n} from 'chart.js';\nimport ChartDataLabels from 'chartjs-plugin-datalabels';\nimport React from 'react';\nimport { Bar } from 'react-chartjs-2';\nimport { TitleRegular } from '@src/components/TypographyStyle';\nimport { COLORS, FONTS } from '@src/constants/Theme';\nimport {\n\ttruncateValueForIndianStore,\n\ttruncateValueForInternationalStore,\n} from '../utils/calcPercentage';\nimport { GraphContainerWrapper } from './HorizontalGraph.styles';\nimport { HorizontalGraphI } from './HorizontalGraph.type';\n\nChartJS.register(\n\tCategoryScale,\n\tLinearScale,\n\tBarElement,\n\tTooltip,\n\tChartDataLabels,\n);\n\nexport const HorizontalGraph: React.FC<HorizontalGraphI> = (props) => {\n\tconst dummyValues = [250, 1000, 800, 1500, 300, 600];\n\n\t// Check if data is present - consider both regular xAxis data and stacked datasets\n\tconst hasStackedData =\n\t\tprops.stacked &&\n\t\tprops.stackedDatasets &&\n\t\tprops.stackedDatasets.length > 0 &&\n\t\tprops.stackedDatasets.some((ds) => ds.data.some((val) => val !== 0));\n\n\tconst hasXAxisData = props.xAxis.data.findIndex((ele) => ele !== 0) !== -1;\n\n\tconst noDataPresent = !hasStackedData && !hasXAxisData;\n\tconst xAxisConfigForNoData = {\n\t\tmin: 0,\n\t\tmax: 2000,\n\t\tstepSize: props.xAxis.stepSize ?? 200,\n\t};\n\tconst options = {\n\t\tindexAxis: 'y' as const,\n\t\telements: {},\n\t\tresponsive: true,\n\t\tmaintainAspectRatio: props.maintainAspectRatio,\n\t\tlayout: {\n\t\t\tpadding: {\n\t\t\t\tright: props.showTotal ? 50 : 0,\n\t\t\t},\n\t\t},\n\t\tplugins: {\n\t\t\tlegend: {\n\t\t\t\tdisplay: false,\n\t\t\t},\n\t\t\ttooltip: {\n\t\t\t\tenabled: !noDataPresent,\n\t\t\t\tcallbacks: {\n\t\t\t\t\tlabel: props.xAxis.toolTipCallback,\n\t\t\t\t\tfooter: props.tooltipConfig?.footerCallback,\n\t\t\t\t},\n\t\t\t\tfooterFont: props.tooltipConfig?.footerStyles?.footerFont,\n\t\t\t},\n\t\t\tdatalabels: {\n\t\t\t\tdisplay: (!noDataPresent && props.showTotal) ?? false,\n\t\t\t\tanchor: 'end' as const,\n\t\t\t\talign: 'end' as const,\n\t\t\t\tclamp: true,\n\t\t\t\tformatter: (_, context) => {\n\t\t\t\t\tconst datasetIndex = context.datasetIndex;\n\t\t\t\t\tconst datasets = context.chart.data.datasets;\n\t\t\t\t\tif (datasetIndex !== datasets.length - 1) {\n\t\t\t\t\t\treturn '';\n\t\t\t\t\t}\n\t\t\t\t\tconst dataIndex = context.dataIndex;\n\t\t\t\t\tlet sum = 0;\n\t\t\t\t\tfor (let i = 0; i < datasets.length; i++) {\n\t\t\t\t\t\tsum += datasets[i].data[dataIndex] ?? 0;\n\t\t\t\t\t}\n\t\t\t\t\tif (!sum) {\n\t\t\t\t\t\treturn '';\n\t\t\t\t\t}\n\t\t\t\t\treturn props.isInternationalStore\n\t\t\t\t\t\t? truncateValueForInternationalStore(sum)\n\t\t\t\t\t\t: truncateValueForIndianStore(sum);\n\t\t\t\t},\n\t\t\t\tcolor: COLORS.content.secondary,\n\t\t\t},\n\t\t},\n\t\tscales: {\n\t\t\ty: {\n\t\t\t\tstacked: props.stacked ?? false,\n\t\t\t\ttitle: {\n\t\t\t\t\tdisplay: !!props.yAxis.title,\n\t\t\t\t\ttext: props.yAxis.title,\n\t\t\t\t\tcolor: props.yAxis.titleColor,\n\t\t\t\t\tfont: { size: FONTS.caption.fontSize, color: props.yAxis.titleColor },\n\t\t\t\t\tpadding: { bottom: 10 },\n\t\t\t\t},\n\t\t\t\tgrid: {\n\t\t\t\t\tdisplay: false,\n\t\t\t\t\tborderColor: COLORS.background.base,\n\t\t\t\t},\n\n\t\t\t\tticks: {\n\t\t\t\t\tfontSize: FONTS.caption.fontSize,\n\t\t\t\t\tcolor: props.yAxis.labelColor ?? COLORS.content.secondary,\n\t\t\t\t},\n\t\t\t},\n\n\t\t\tx: {\n\t\t\t\tstacked: props.stacked ?? false,\n\t\t\t\ttitle: {\n\t\t\t\t\tdisplay: !!props.xAxis.title,\n\t\t\t\t\ttext: props.xAxis.title,\n\t\t\t\t\tcolor: props.xAxis.titleColor,\n\t\t\t\t\tfont: { size: FONTS.caption.fontSize },\n\t\t\t\t\tpadding: { top: 10 },\n\t\t\t\t},\n\t\t\t\tgrid: {\n\t\t\t\t\tborderColor: 'white',\n\t\t\t\t\tcolor: COLORS.background.base,\n\t\t\t\t},\n\t\t\t\tticks: {\n\t\t\t\t\tcallback: props.xAxis.ticksCallback,\n\t\t\t\t\tfontSize: FONTS.caption.fontSize,\n\t\t\t\t\tcolor: props.xAxis.labelColor ?? COLORS.content.secondary,\n\t\t\t\t\t...(noDataPresent\n\t\t\t\t\t\t? xAxisConfigForNoData\n\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\tmax: props.xAxis.max,\n\t\t\t\t\t\t\t\tstepSize: props.xAxis.stepSize,\n\t\t\t\t\t\t }),\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tonClick: (_event: any, elements: any[]) => {\n\t\t\tif (elements.length > 0 && props.onBarClick) {\n\t\t\t\tconst index = elements[0].index;\n\t\t\t\tprops.onBarClick(index);\n\t\t\t}\n\t\t},\n\t} as any;\n\n\tconst getColorSpectrum = (context) => {\n\t\tconst ctx = context.chart.ctx;\n\t\tconst gradient = ctx.createLinearGradient(0, 0, 0, 200);\n\t\tlet rgbaColor = '';\n\t\tif (noDataPresent) {\n\t\t\trgbaColor = 'rgba(0,0,0,0)';\n\t\t} else if (props.barColorRGBA) {\n\t\t\tconst rgb = props.barColorRGBA;\n\t\t\trgbaColor = `rgba(${rgb.r}, ${rgb.g}, ${rgb.b}, ${rgb.a ?? '0.3'})`;\n\t\t}\n\n\t\tgradient.addColorStop(0, rgbaColor ? rgbaColor : 'rgba(146, 96, 237, 0.3)');\n\t\tgradient.addColorStop(1, rgbaColor ? rgbaColor : `rgba(146, 96, 237, 0.3)`);\n\n\t\treturn gradient;\n\t};\n\n\t// Get background color - supports per-bar colors via barColors array\n\tconst getBackgroundColor = () => {\n\t\tif (noDataPresent) {\n\t\t\treturn 'rgba(0,0,0,0)';\n\t\t}\n\t\t// If barColors array is provided, use it for per-bar coloring\n\t\tif (props.barColors && props.barColors.length > 0) {\n\t\t\treturn props.barColors;\n\t\t}\n\t\t// Fallback to single color via getColorSpectrum\n\t\treturn (context) => getColorSpectrum(context);\n\t};\n\n\t// Build datasets - support stacked datasets if provided\n\tconst buildDatasets = () => {\n\t\tif (\n\t\t\tprops.stacked &&\n\t\t\tprops.stackedDatasets &&\n\t\t\tprops.stackedDatasets.length > 0\n\t\t) {\n\t\t\treturn props.stackedDatasets.map((dataset) => ({\n\t\t\t\tlabel: dataset.label || '',\n\t\t\t\tdata: noDataPresent ? dummyValues : dataset.data,\n\t\t\t\tbackgroundColor: dataset.backgroundColor,\n\t\t\t\tbarPercentage: 0.4,\n\t\t\t\tcategoryPercentage: 1,\n\t\t\t\tborderRadius: 4,\n\t\t\t}));\n\t\t}\n\t\t// Default single dataset\n\t\treturn [\n\t\t\t{\n\t\t\t\tdata: noDataPresent ? dummyValues : props.xAxis.data,\n\t\t\t\tbackgroundColor: getBackgroundColor(),\n\t\t\t\tbarPercentage: 0.4,\n\t\t\t\tcategoryPercentage: 1,\n\t\t\t\tborderRadius: 4,\n\t\t\t},\n\t\t];\n\t};\n\n\tconst data = {\n\t\tlabels: props.yAxis.data.map((d) => d.toString()),\n\t\tdatasets: buildDatasets(),\n\t};\n\treturn (\n\t\t<GraphContainerWrapper\n\t\t\tpadding={props.outerPadding}\n\t\t\tskipOuterLayout={props.skipOuterLayout}\n\t\t>\n\t\t\t{props.chartHeading && (\n\t\t\t\t<TitleRegular\n\t\t\t\t\tcolor={props.chartHeading.color ?? COLORS.content.secondary}\n\t\t\t\t>\n\t\t\t\t\t{props.chartHeading.heading}\n\t\t\t\t</TitleRegular>\n\t\t\t)}\n\t\t\t<div\n\t\t\t\tstyle={{\n\t\t\t\t\theight: props.maintainAspectRatio\n\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t: props.graphCanvasHeight ?? 500,\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t<Bar options={options} data={data} />\n\t\t\t</div>\n\t\t</GraphContainerWrapper>\n\t);\n};\n"],"names":["ChartJS","CategoryScale","LinearScale","BarElement","Tooltip","ChartDataLabels","HorizontalGraph","props","dummyValues","hasStackedData","ds","val","hasXAxisData","ele","noDataPresent","xAxisConfigForNoData","options","_","context","datasetIndex","datasets","dataIndex","sum","i","truncateValueForInternationalStore","truncateValueForIndianStore","COLORS","FONTS","_event","elements","index","getColorSpectrum","gradient","rgbaColor","rgb","getBackgroundColor","buildDatasets","dataset","data","d","jsxs","GraphContainerWrapper","jsx","TitleRegular","Bar"],"mappings":";;;;;;;;AAmBAA,EAAQ;AAAA,EACPC;AAAA,EACAC;AAAA,EACAC;AAAA,EACAC;AAAA,EACAC;AACD;AAEO,MAAMC,IAA8C,CAACC,MAAU;AACrE,QAAMC,IAAc,CAAC,KAAK,KAAM,KAAK,MAAM,KAAK,GAAG,GAG7CC,IACLF,EAAM,WACNA,EAAM,mBACNA,EAAM,gBAAgB,SAAS,KAC/BA,EAAM,gBAAgB,KAAK,CAACG,MAAOA,EAAG,KAAK,KAAK,CAACC,MAAQA,MAAQ,CAAC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