markdown-flow-ui 0.3.10 → 0.3.12

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 (73) hide show
  1. package/README.md +50 -0
  2. package/dist/assets/markdown-flow-ui.css +1 -1
  3. package/dist/components/ContentRender/ContentRender.cjs +2 -2
  4. package/dist/components/ContentRender/ContentRender.cjs.map +1 -1
  5. package/dist/components/ContentRender/ContentRender.d.ts +5 -0
  6. package/dist/components/ContentRender/ContentRender.es.js +405 -394
  7. package/dist/components/ContentRender/ContentRender.es.js.map +1 -1
  8. package/dist/components/ContentRender/ImageInputGroup.cjs +2 -0
  9. package/dist/components/ContentRender/ImageInputGroup.cjs.map +1 -0
  10. package/dist/components/ContentRender/ImageInputGroup.d.ts +31 -0
  11. package/dist/components/ContentRender/ImageInputGroup.es.js +100 -0
  12. package/dist/components/ContentRender/ImageInputGroup.es.js.map +1 -0
  13. package/dist/components/ContentRender/MarkdownFlowInput.cjs +1 -1
  14. package/dist/components/ContentRender/MarkdownFlowInput.cjs.map +1 -1
  15. package/dist/components/ContentRender/MarkdownFlowInput.d.ts +5 -0
  16. package/dist/components/ContentRender/MarkdownFlowInput.es.js +47 -40
  17. package/dist/components/ContentRender/MarkdownFlowInput.es.js.map +1 -1
  18. package/dist/components/ContentRender/contentRenderI18n.cjs.map +1 -1
  19. package/dist/components/ContentRender/contentRenderI18n.d.ts +4 -0
  20. package/dist/components/ContentRender/contentRenderI18n.es.js.map +1 -1
  21. package/dist/components/ContentRender/locales/contentRender.json.cjs +1 -1
  22. package/dist/components/ContentRender/locales/contentRender.json.d.ts +56 -12
  23. package/dist/components/ContentRender/locales/contentRender.json.es.js +11 -11
  24. package/dist/components/ContentRender/plugins/CustomVariable.cjs +1 -1
  25. package/dist/components/ContentRender/plugins/CustomVariable.cjs.map +1 -1
  26. package/dist/components/ContentRender/plugins/CustomVariable.d.ts +4 -1
  27. package/dist/components/ContentRender/plugins/CustomVariable.es.js +212 -173
  28. package/dist/components/ContentRender/plugins/CustomVariable.es.js.map +1 -1
  29. package/dist/components/MarkdownFlow/MarkdownFlow.cjs +1 -1
  30. package/dist/components/MarkdownFlow/MarkdownFlow.cjs.map +1 -1
  31. package/dist/components/MarkdownFlow/MarkdownFlow.d.ts +7 -0
  32. package/dist/components/MarkdownFlow/MarkdownFlow.es.js +63 -53
  33. package/dist/components/MarkdownFlow/MarkdownFlow.es.js.map +1 -1
  34. package/dist/components/Slide/Player.cjs +1 -1
  35. package/dist/components/Slide/Player.cjs.map +1 -1
  36. package/dist/components/Slide/Player.es.js +319 -321
  37. package/dist/components/Slide/Player.es.js.map +1 -1
  38. package/dist/components/Slide/Slide.cjs +1 -1
  39. package/dist/components/Slide/Slide.cjs.map +1 -1
  40. package/dist/components/Slide/Slide.d.ts +5 -0
  41. package/dist/components/Slide/Slide.es.js +661 -650
  42. package/dist/components/Slide/Slide.es.js.map +1 -1
  43. package/dist/components/Slide/useWakePlayerFromIframe.cjs +1 -1
  44. package/dist/components/Slide/useWakePlayerFromIframe.cjs.map +1 -1
  45. package/dist/components/Slide/useWakePlayerFromIframe.es.js +32 -32
  46. package/dist/components/Slide/useWakePlayerFromIframe.es.js.map +1 -1
  47. package/dist/components/Slide/utils/interactionResolution.cjs +1 -1
  48. package/dist/components/Slide/utils/interactionResolution.cjs.map +1 -1
  49. package/dist/components/Slide/utils/interactionResolution.es.js +15 -15
  50. package/dist/components/Slide/utils/interactionResolution.es.js.map +1 -1
  51. package/dist/components/Slide/utils/playerKeyboardShortcuts.cjs +1 -1
  52. package/dist/components/Slide/utils/playerKeyboardShortcuts.cjs.map +1 -1
  53. package/dist/components/Slide/utils/playerKeyboardShortcuts.d.ts +2 -1
  54. package/dist/components/Slide/utils/playerKeyboardShortcuts.es.js +71 -25
  55. package/dist/components/Slide/utils/playerKeyboardShortcuts.es.js.map +1 -1
  56. package/dist/components/types.d.ts +2 -0
  57. package/dist/lib/interaction-defaults.cjs +1 -1
  58. package/dist/lib/interaction-defaults.cjs.map +1 -1
  59. package/dist/lib/interaction-defaults.d.ts +4 -0
  60. package/dist/lib/interaction-defaults.es.js +47 -41
  61. package/dist/lib/interaction-defaults.es.js.map +1 -1
  62. package/dist/markdown-flow-ui-lib.css +1 -1
  63. package/dist/markdown-flow-ui.css +1 -1
  64. package/dist/node_modules/lucide-react/dist/esm/icons/image-plus.cjs +2 -0
  65. package/dist/node_modules/lucide-react/dist/esm/icons/image-plus.cjs.map +1 -0
  66. package/dist/node_modules/lucide-react/dist/esm/icons/image-plus.es.js +19 -0
  67. package/dist/node_modules/lucide-react/dist/esm/icons/image-plus.es.js.map +1 -0
  68. package/dist/renderer.d.ts +1 -0
  69. package/package.json +1 -1
  70. package/dist/node_modules/lucide-react/dist/esm/icons/grip-horizontal.cjs +0 -2
  71. package/dist/node_modules/lucide-react/dist/esm/icons/grip-horizontal.cjs.map +0 -1
  72. package/dist/node_modules/lucide-react/dist/esm/icons/grip-horizontal.es.js +0 -20
  73. package/dist/node_modules/lucide-react/dist/esm/icons/grip-horizontal.es.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"CustomVariable.es.js","sources":["../../../../src/components/ContentRender/plugins/CustomVariable.tsx"],"sourcesContent":["import React from \"react\";\nimport { normalizeVariableName } from \"remark-flow\";\nimport type { Components } from \"react-markdown\";\nimport { OnSendContentParams } from \"../../types\";\nimport { Button } from \"../../ui/button\";\nimport { Checkbox } from \"../../ui/checkbox\";\nimport MarkdownFlowInput from \"../MarkdownFlowInput\";\nimport { acceptPlaceholder } from \"../utils/accept-placeholder\";\nimport {\n InputGroup,\n InputGroupTextarea,\n} from \"../../ui/inputGroup/input-group\";\nimport type { MarkdownFlowLocale } from \"../../../lib/locale\";\nimport { cn } from \"../../../lib/utils\";\nimport { getContentRenderLocaleTexts } from \"../contentRenderI18n\";\n\n// Define custom variable node type\ninterface CustomVariableNode {\n tagName: \"custom-variable\";\n properties?: {\n variableName?: string;\n buttonTexts?: string[];\n buttonValues?: string[];\n placeholder?: string;\n isMultiSelect?: boolean;\n };\n}\n\n// Define custom variable component Props type\ninterface CustomVariableProps {\n /** Explicit direction for nested input controls. */\n dir?: React.HTMLAttributes<HTMLDivElement>[\"dir\"];\n /** Explicit language for nested input controls. */\n lang?: string;\n node: CustomVariableNode;\n defaultButtonText?: string;\n defaultInputText?: string;\n defaultSelectedValues?: string[];\n locale?: MarkdownFlowLocale;\n readonly?: boolean;\n onSend?: (content: OnSendContentParams) => void;\n onPlaceholderAccepted?: () => void;\n // Multi-select confirm button text (i18n support)\n confirmButtonText?: string;\n beforeSend?: (param: OnSendContentParams) => boolean;\n}\n\ninterface ComponentsWithCustomVariable extends Components {\n \"custom-variable\"?: React.ComponentType<CustomVariableProps>;\n}\n\n// Multi select section( with checkboxes and input)\ninterface MultiSelectSectionProps {\n node: CustomVariableNode;\n readonly?: boolean;\n selectedValues: string[];\n inputValue: string;\n confirmButtonText: string;\n handleCheckboxChange: (value: string, checked: boolean) => void;\n handleInputChange: (event: React.ChangeEvent<HTMLTextAreaElement>) => void;\n handleKeyDown: (event: React.KeyboardEvent<HTMLTextAreaElement>) => void;\n handleConfirmClick: () => void;\n}\n\nconst MultiSelectSection = ({\n node,\n readonly,\n selectedValues,\n inputValue,\n confirmButtonText,\n handleCheckboxChange,\n handleInputChange,\n handleKeyDown,\n handleConfirmClick,\n}: MultiSelectSectionProps) => {\n const placeholder = node.properties?.placeholder;\n const confirmDisabled =\n readonly || (selectedValues.length === 0 && !inputValue?.trim());\n\n const renderConfirmButton = (extraWrapperClassName?: string) => (\n <span\n className={cn(\n \"multi-select-confirm-wrapper flex flex-col items-center\",\n confirmDisabled ? \"opacity-50 cursor-not-allowed\" : \"cursor-pointer\",\n extraWrapperClassName\n )}\n >\n <button\n type=\"button\"\n className=\"multi-select-confirm-button text-sm font-medium text-primary\"\n disabled={confirmDisabled}\n onClick={handleConfirmClick}\n >\n {confirmButtonText}\n </button>\n </span>\n );\n\n return (\n <span className=\"multi-select-container flex w-full flex-col\">\n <span className=\"flex flex-wrap gap-y-[9px] gap-x-6\">\n {node.properties?.buttonTexts?.map((text, index) => {\n const value = node.properties?.buttonValues?.[index];\n const buttonValue = value !== undefined ? value : text;\n return (\n <Checkbox\n key={index}\n label={text}\n disabled={readonly}\n checked={selectedValues.includes(buttonValue)}\n onCheckedChange={(checked) =>\n handleCheckboxChange(buttonValue, checked)\n }\n className=\"text-sm\"\n />\n );\n })}\n </span>\n {placeholder ? (\n <span className=\"block mb-1 w-full max-w-[500px]\">\n <span className=\"multi-select-input-row flex w-full items-end gap-3\">\n <InputGroup data-disabled={readonly} className=\"flex-1\">\n <InputGroupTextarea\n disabled={readonly}\n placeholder={placeholder}\n value={inputValue}\n onChange={handleInputChange}\n onKeyDown={handleKeyDown}\n className=\"text-sm px-3\"\n title={placeholder}\n />\n </InputGroup>\n {renderConfirmButton(\"shrink-0\")}\n </span>\n </span>\n ) : (\n renderConfirmButton(\"self-start multi-select-confirm-wrapper--stacked\")\n )}\n </span>\n );\n};\n\n// Single select section( with buttons and input)\ninterface SingleSelectSectionProps {\n dir?: CustomVariableProps[\"dir\"];\n lang?: string;\n node: CustomVariableNode;\n readonly?: boolean;\n locale?: MarkdownFlowLocale;\n resolvedDefaultButtonText?: string;\n handleButtonClick: (value: string) => void;\n inputValue: string;\n handleInputChange: (event: React.ChangeEvent<HTMLTextAreaElement>) => void;\n handleSendClick: () => void;\n onAcceptPlaceholder: (value: string) => void;\n}\n\nconst SingleSelectSection = ({\n dir,\n lang,\n node,\n readonly,\n locale,\n resolvedDefaultButtonText,\n handleButtonClick,\n inputValue,\n handleInputChange,\n handleSendClick,\n onAcceptPlaceholder,\n}: SingleSelectSectionProps) => (\n <span className=\"single-select-container inline-flex w-full flex-col\">\n <span className=\"flex flex-wrap gap-y-[9px] gap-x-2\">\n {node.properties?.buttonTexts?.map((text, index) => {\n const value = node.properties?.buttonValues?.[index];\n const buttonValue = value !== undefined ? value : text;\n return (\n <Button\n key={index}\n disabled={readonly}\n variant=\"outline\"\n type=\"button\"\n size=\"sm\"\n onClick={() => handleButtonClick(buttonValue)}\n className={cn(\n \"max-w-full shrink whitespace-normal break-words text-start leading-5 h-auto min-h-8 px-3 py-1.5\",\n \"hover:bg-gray-200\",\n resolvedDefaultButtonText === text && \"select\"\n )}\n >\n {text}\n </Button>\n );\n })}\n </span>\n {node.properties?.placeholder && (\n <span className=\"mt-[9px] mb-1\">\n <MarkdownFlowInput\n dir={dir}\n lang={lang}\n disabled={readonly}\n locale={locale}\n placeholder={node.properties.placeholder}\n value={inputValue}\n onChange={handleInputChange}\n onSend={handleSendClick}\n onAcceptPlaceholder={onAcceptPlaceholder}\n title={node.properties.placeholder}\n />\n </span>\n )}\n </span>\n);\n\n// Pure input\ninterface InputSectionProps {\n dir?: CustomVariableProps[\"dir\"];\n lang?: string;\n readonly?: boolean;\n locale?: MarkdownFlowLocale;\n placeholder?: string;\n value: string;\n onChange: (event: React.ChangeEvent<HTMLTextAreaElement>) => void;\n onSend: () => void;\n onAcceptPlaceholder: (value: string) => void;\n}\n\nconst InputSection = ({\n dir,\n lang,\n readonly,\n locale,\n placeholder,\n value,\n onChange,\n onSend,\n onAcceptPlaceholder,\n}: InputSectionProps) => {\n if (!placeholder) {\n return null;\n }\n\n return (\n <MarkdownFlowInput\n dir={dir}\n lang={lang}\n disabled={readonly}\n locale={locale}\n placeholder={placeholder}\n value={value}\n onChange={onChange}\n onSend={onSend}\n onAcceptPlaceholder={onAcceptPlaceholder}\n title={placeholder}\n />\n );\n};\n\n// Define custom variable component\nconst CustomButtonInputVariable = ({\n dir,\n lang,\n node,\n readonly,\n locale,\n defaultButtonText,\n defaultInputText,\n defaultSelectedValues,\n onSend,\n confirmButtonText,\n beforeSend = () => true,\n onPlaceholderAccepted,\n}: CustomVariableProps) => {\n const localeTexts = getContentRenderLocaleTexts(locale);\n const resolvedConfirmButtonText =\n confirmButtonText || localeTexts.confirmButtonText;\n const [inputValue, setInputValue] = React.useState(defaultInputText || \"\");\n const [selectedValues, setSelectedValues] = React.useState<string[]>(\n defaultSelectedValues || []\n );\n const interactionDefinitionKey = JSON.stringify({\n buttonTexts: node.properties?.buttonTexts,\n buttonValues: node.properties?.buttonValues,\n isMultiSelect: node.properties?.isMultiSelect,\n placeholder: node.properties?.placeholder,\n variableName: node.properties?.variableName,\n });\n const isMultiSelect = node.properties?.isMultiSelect ?? false;\n const baseButtonTexts = node.properties?.buttonTexts || [];\n const shouldUseFallbackButton =\n !isMultiSelect &&\n baseButtonTexts.length === 0 &&\n !node.properties?.placeholder;\n const fallbackButtonLabel =\n normalizeVariableName(node.properties?.variableName || \"\") ||\n defaultButtonText ||\n resolvedConfirmButtonText;\n\n const singleSelectNode = React.useMemo<CustomVariableNode>(() => {\n if (!shouldUseFallbackButton) {\n return node;\n }\n return {\n ...node,\n properties: {\n ...(node.properties || {}),\n buttonTexts: [fallbackButtonLabel],\n buttonValues: [fallbackButtonLabel],\n },\n };\n }, [fallbackButtonLabel, node, shouldUseFallbackButton]);\n\n const singleSelectButtonTexts =\n singleSelectNode.properties?.buttonTexts || [];\n const singleSelectButtonValues =\n singleSelectNode.properties?.buttonValues || [];\n const isSingleSelect = !isMultiSelect && singleSelectButtonTexts.length > 0;\n\n const handleButtonClick = (value: string) => {\n const param = {\n variableName: node.properties?.variableName || \"\",\n buttonText: value,\n };\n if (!beforeSend?.(param)) return;\n onSend?.(param);\n };\n\n const handleCheckboxChange = (value: string, checked: boolean) => {\n setSelectedValues((prev) => {\n if (checked) {\n return [...prev, value];\n } else {\n return prev.filter((v) => v !== value);\n }\n });\n };\n\n const handleConfirmClick = () => {\n const noSelection = selectedValues.length === 0 && !inputValue?.trim();\n const param = {\n variableName: node.properties?.variableName || \"\",\n selectedValues,\n inputText: inputValue?.trim() || undefined,\n };\n if (readonly || noSelection) return;\n if (!beforeSend?.(param)) return;\n onSend?.(param);\n };\n\n const handleInputChange = (e: React.ChangeEvent<HTMLTextAreaElement>) => {\n setInputValue(e.target.value);\n };\n const handleAcceptPlaceholder = (value: string) => {\n setInputValue(value);\n // Observer failures must never prevent editing or submitting an answer.\n try {\n void Promise.resolve(onPlaceholderAccepted?.()).catch(() => {});\n } catch {}\n };\n const handleKeyDown = (e: React.KeyboardEvent<HTMLTextAreaElement>) => {\n if (\n acceptPlaceholder(\n e,\n node.properties?.placeholder,\n readonly,\n handleAcceptPlaceholder\n )\n ) {\n return;\n }\n if (e.nativeEvent.isComposing || e.keyCode === 229) {\n return;\n }\n if (e.key === \"Enter\" && !e.shiftKey) {\n e.preventDefault();\n if (isMultiSelect) {\n const noSelection = selectedValues.length === 0 && !inputValue.trim();\n if (!noSelection) handleConfirmClick();\n } else {\n handleSendClick();\n }\n }\n };\n const handleSendClick = () => {\n const param = {\n variableName: node.properties?.variableName || \"\",\n inputText: inputValue,\n };\n if (!beforeSend?.(param)) return;\n onSend?.(param);\n };\n\n const resolvedDefaultButtonText = React.useMemo(() => {\n if (!defaultButtonText) {\n return undefined;\n }\n const valueIndex = singleSelectButtonValues.indexOf(defaultButtonText);\n if (valueIndex > -1) {\n return singleSelectButtonTexts[valueIndex] ?? defaultButtonText;\n }\n const textIndex = singleSelectButtonTexts.indexOf(defaultButtonText);\n if (textIndex > -1) {\n return singleSelectButtonTexts[textIndex];\n }\n return undefined;\n }, [defaultButtonText, singleSelectButtonTexts, singleSelectButtonValues]);\n\n React.useEffect(() => {\n setInputValue(defaultInputText || \"\");\n }, [defaultInputText, interactionDefinitionKey]);\n\n React.useEffect(() => {\n setSelectedValues(defaultSelectedValues || []);\n }, [defaultSelectedValues, interactionDefinitionKey]);\n\n return (\n <span className=\"custom-variable-container inline-flex items-center flex-wrap\">\n {isMultiSelect && (\n <MultiSelectSection\n node={node}\n readonly={readonly}\n selectedValues={selectedValues}\n inputValue={inputValue}\n confirmButtonText={resolvedConfirmButtonText}\n handleCheckboxChange={handleCheckboxChange}\n handleInputChange={handleInputChange}\n handleKeyDown={handleKeyDown}\n handleConfirmClick={handleConfirmClick}\n />\n )}\n\n {!isMultiSelect && isSingleSelect && (\n <SingleSelectSection\n dir={dir}\n lang={lang}\n node={singleSelectNode}\n readonly={readonly}\n locale={locale}\n resolvedDefaultButtonText={resolvedDefaultButtonText}\n handleButtonClick={handleButtonClick}\n inputValue={inputValue}\n handleInputChange={handleInputChange}\n handleSendClick={handleSendClick}\n onAcceptPlaceholder={handleAcceptPlaceholder}\n />\n )}\n\n {!isMultiSelect && !isSingleSelect && node.properties?.placeholder && (\n <InputSection\n dir={dir}\n lang={lang}\n readonly={readonly}\n locale={locale}\n placeholder={node.properties.placeholder}\n value={inputValue}\n onChange={handleInputChange}\n onSend={handleSendClick}\n onAcceptPlaceholder={handleAcceptPlaceholder}\n />\n )}\n </span>\n );\n};\n\nexport default CustomButtonInputVariable;\nexport type {\n ComponentsWithCustomVariable,\n CustomVariableNode,\n CustomVariableProps,\n};\n"],"names":["MultiSelectSection","node","readonly","selectedValues","inputValue","confirmButtonText","handleCheckboxChange","handleInputChange","handleKeyDown","handleConfirmClick","placeholder","confirmDisabled","renderConfirmButton","extraWrapperClassName","jsx","cn","jsxs","text","index","value","buttonValue","Checkbox","checked","InputGroup","InputGroupTextarea","SingleSelectSection","dir","lang","locale","resolvedDefaultButtonText","handleButtonClick","handleSendClick","onAcceptPlaceholder","Button","MarkdownFlowInput","InputSection","onChange","onSend","CustomButtonInputVariable","defaultButtonText","defaultInputText","defaultSelectedValues","beforeSend","onPlaceholderAccepted","localeTexts","getContentRenderLocaleTexts","resolvedConfirmButtonText","setInputValue","React","setSelectedValues","interactionDefinitionKey","isMultiSelect","baseButtonTexts","shouldUseFallbackButton","fallbackButtonLabel","normalizeVariableName","singleSelectNode","singleSelectButtonTexts","singleSelectButtonValues","isSingleSelect","param","prev","v","noSelection","e","handleAcceptPlaceholder","acceptPlaceholder","valueIndex","textIndex"],"mappings":";;;;;;;;;;AAgEA,MAAMA,IAAqB,CAAC;AAAA,EAC1B,MAAAC;AAAA,EACA,UAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,YAA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AAD,EAAcP,KAAoB,EAAE;AAAA,EACtC,GAAG,CAACA,GAAkBU,CAAwB,CAAC,GAE/CF,EAAM,UAAU,MAAM;AACpB,IAAAC,EAAkBR,KAAyB,EAAE;AAAA,EAC/C,GAAG,CAACA,GAAuBS,CAAwB,CAAC,GAGlD,gBAAAlC,EAAC,QAAA,EAAK,WAAU,gEACb,UAAA;AAAA,IAAAmC,KACC,gBAAArC;AAAA,MAACd;AAAA,MAAA;AAAA,QACC,MAAAC;AAAA,QACA,UAAAC;AAAA,QACA,gBAAAC;AAAA,QACA,YAAAC;AAAA,QACA,mBAAmB0C;AAAA,QACnB,sBAAAxC;AAAA,QACA,mBAAAC;AAAA,QACA,eAAAC;AAAA,QACA,oBAAAC;AAAA,MAAA;AAAA,IAAA;AAAA,IAIH,CAAC0C,KAAiBQ,KACjB,gBAAA7C;AAAA,MAACW;AAAA,MAAA;AAAA,QACC,KAAAC;AAAA,QACA,MAAAC;AAAA,QACA,MAAM6B;AAAA,QACN,UAAAtD;AAAA,QACA,QAAA0B;AAAA,QACA,2BAAAC;AAAA,QACA,mBAAAC;AAAA,QACA,YAAA1B;AAAA,QACA,mBAAAG;AAAA,QACA,iBAAAwB;AAAA,QACA,qBAAqBkC;AAAA,MAAA;AAAA,IAAA;AAAA,IAIxB,CAACd,KAAiB,CAACQ,KAAkB1D,EAAK,YAAY,eACrD,gBAAAa;AAAA,MAACqB;AAAA,MAAA;AAAA,QACC,KAAAT;AAAA,QACA,MAAAC;AAAA,QACA,UAAAzB;AAAA,QACA,QAAA0B;AAAA,QACA,aAAa3B,EAAK,WAAW;AAAA,QAC7B,OAAOG;AAAA,QACP,UAAUG;AAAA,QACV,QAAQwB;AAAA,QACR,qBAAqBkC;AAAA,MAAA;AAAA,IAAA;AAAA,EACvB,GAEJ;AAEJ;"}
1
+ {"version":3,"file":"CustomVariable.es.js","sources":["../../../../src/components/ContentRender/plugins/CustomVariable.tsx"],"sourcesContent":["import React from \"react\";\nimport { normalizeVariableName } from \"remark-flow\";\nimport type { Components } from \"react-markdown\";\nimport { OnSendContentParams } from \"../../types\";\nimport { Button } from \"../../ui/button\";\nimport { Checkbox } from \"../../ui/checkbox\";\nimport MarkdownFlowInput from \"../MarkdownFlowInput\";\nimport { ImageInputGroup, type ImageInputOptions } from \"../ImageInputGroup\";\nimport { acceptPlaceholder } from \"../utils/accept-placeholder\";\nimport { InputGroupTextarea } from \"../../ui/inputGroup/input-group\";\nimport type { MarkdownFlowLocale } from \"../../../lib/locale\";\nimport { cn } from \"../../../lib/utils\";\nimport { getContentRenderLocaleTexts } from \"../contentRenderI18n\";\n\n// Define custom variable node type\ninterface CustomVariableNode {\n tagName: \"custom-variable\";\n properties?: {\n variableName?: string;\n buttonTexts?: string[];\n buttonValues?: string[];\n placeholder?: string;\n isMultiSelect?: boolean;\n };\n}\n\n// Define custom variable component Props type\ninterface CustomVariableProps {\n showImageInput?: boolean;\n imageInput?: ImageInputOptions;\n /** Explicit direction for nested input controls. */\n dir?: React.HTMLAttributes<HTMLDivElement>[\"dir\"];\n /** Explicit language for nested input controls. */\n lang?: string;\n node: CustomVariableNode;\n defaultButtonText?: string;\n defaultInputText?: string;\n defaultSelectedValues?: string[];\n locale?: MarkdownFlowLocale;\n readonly?: boolean;\n onSend?: (content: OnSendContentParams) => void;\n onPlaceholderAccepted?: () => void;\n // Multi-select confirm button text (i18n support)\n confirmButtonText?: string;\n beforeSend?: (param: OnSendContentParams) => boolean;\n}\n\ninterface ComponentsWithCustomVariable extends Components {\n \"custom-variable\"?: React.ComponentType<CustomVariableProps>;\n}\n\n// Multi select section( with checkboxes and input)\ninterface MultiSelectSectionProps extends Pick<\n CustomVariableProps,\n \"showImageInput\" | \"imageInput\"\n> {\n node: CustomVariableNode;\n readonly?: boolean;\n selectedValues: string[];\n inputValue: string;\n confirmButtonText: string;\n handleCheckboxChange: (value: string, checked: boolean) => void;\n handleInputChange: (event: React.ChangeEvent<HTMLTextAreaElement>) => void;\n handleKeyDown: (event: React.KeyboardEvent<HTMLTextAreaElement>) => void;\n handleConfirmClick: () => void;\n locale?: MarkdownFlowLocale;\n}\n\nconst MultiSelectSection = ({\n node,\n readonly,\n selectedValues,\n inputValue,\n confirmButtonText,\n handleCheckboxChange,\n handleInputChange,\n handleKeyDown,\n handleConfirmClick,\n showImageInput,\n imageInput,\n locale,\n}: MultiSelectSectionProps) => {\n const placeholder = node.properties?.placeholder;\n const confirmDisabled =\n readonly ||\n imageInput?.uploading ||\n (selectedValues.length === 0 &&\n !inputValue?.trim() &&\n !(node.properties?.placeholder && imageInput?.images.length));\n\n const renderConfirmButton = (extraWrapperClassName?: string) => (\n <span\n className={cn(\n \"multi-select-confirm-wrapper flex flex-col items-center\",\n confirmDisabled ? \"opacity-50 cursor-not-allowed\" : \"cursor-pointer\",\n extraWrapperClassName\n )}\n >\n <button\n type=\"button\"\n className=\"multi-select-confirm-button text-sm font-medium text-primary\"\n disabled={confirmDisabled}\n onClick={handleConfirmClick}\n >\n {confirmButtonText}\n </button>\n </span>\n );\n\n return (\n <span className=\"multi-select-container flex w-full flex-col\">\n <span className=\"flex flex-wrap gap-y-[9px] gap-x-6\">\n {node.properties?.buttonTexts?.map((text, index) => {\n const value = node.properties?.buttonValues?.[index];\n const buttonValue = value !== undefined ? value : text;\n return (\n <Checkbox\n key={index}\n label={text}\n disabled={readonly}\n checked={selectedValues.includes(buttonValue)}\n onCheckedChange={(checked) =>\n handleCheckboxChange(buttonValue, checked)\n }\n className=\"text-sm\"\n />\n );\n })}\n </span>\n {placeholder ? (\n <span className=\"block mb-1 w-full max-w-[500px]\">\n <span className=\"multi-select-input-row flex w-full items-end gap-3\">\n <ImageInputGroup\n disabled={readonly}\n locale={locale}\n showImageInput={showImageInput}\n imageInput={imageInput}\n className=\"flex-1\"\n >\n <InputGroupTextarea\n disabled={readonly}\n placeholder={placeholder}\n value={inputValue}\n onChange={handleInputChange}\n onKeyDown={handleKeyDown}\n className=\"text-sm px-3\"\n title={placeholder}\n />\n </ImageInputGroup>\n {renderConfirmButton(\"shrink-0\")}\n </span>\n </span>\n ) : (\n renderConfirmButton(\"self-start multi-select-confirm-wrapper--stacked\")\n )}\n </span>\n );\n};\n\n// Single select section( with buttons and input)\ninterface SingleSelectSectionProps extends Pick<\n CustomVariableProps,\n \"showImageInput\" | \"imageInput\"\n> {\n dir?: CustomVariableProps[\"dir\"];\n lang?: string;\n node: CustomVariableNode;\n readonly?: boolean;\n locale?: MarkdownFlowLocale;\n resolvedDefaultButtonText?: string;\n handleButtonClick: (value: string) => void;\n inputValue: string;\n handleInputChange: (event: React.ChangeEvent<HTMLTextAreaElement>) => void;\n handleSendClick: () => void;\n onAcceptPlaceholder: (value: string) => void;\n}\n\nconst SingleSelectSection = ({\n dir,\n lang,\n node,\n readonly,\n locale,\n resolvedDefaultButtonText,\n handleButtonClick,\n inputValue,\n handleInputChange,\n handleSendClick,\n onAcceptPlaceholder,\n showImageInput,\n imageInput,\n}: SingleSelectSectionProps) => (\n <span className=\"single-select-container inline-flex w-full flex-col\">\n <span className=\"flex flex-wrap gap-y-[9px] gap-x-2\">\n {node.properties?.buttonTexts?.map((text, index) => {\n const value = node.properties?.buttonValues?.[index];\n const buttonValue = value !== undefined ? value : text;\n return (\n <Button\n key={index}\n disabled={readonly}\n variant=\"outline\"\n type=\"button\"\n size=\"sm\"\n onClick={() => handleButtonClick(buttonValue)}\n className={cn(\n \"max-w-full shrink whitespace-normal break-words text-start leading-5 h-auto min-h-8 px-3 py-1.5\",\n \"hover:bg-gray-200\",\n resolvedDefaultButtonText === text && \"select\"\n )}\n >\n {text}\n </Button>\n );\n })}\n </span>\n {node.properties?.placeholder && (\n <span className=\"mt-[9px] mb-1\">\n <MarkdownFlowInput\n showImageInput={showImageInput}\n imageInput={imageInput}\n dir={dir}\n lang={lang}\n disabled={readonly}\n locale={locale}\n placeholder={node.properties.placeholder}\n value={inputValue}\n onChange={handleInputChange}\n onSend={handleSendClick}\n onAcceptPlaceholder={onAcceptPlaceholder}\n title={node.properties.placeholder}\n />\n </span>\n )}\n </span>\n);\n\n// Pure input\ninterface InputSectionProps extends Pick<\n CustomVariableProps,\n \"showImageInput\" | \"imageInput\"\n> {\n dir?: CustomVariableProps[\"dir\"];\n lang?: string;\n readonly?: boolean;\n locale?: MarkdownFlowLocale;\n placeholder?: string;\n value: string;\n onChange: (event: React.ChangeEvent<HTMLTextAreaElement>) => void;\n onSend: () => void;\n onAcceptPlaceholder: (value: string) => void;\n}\n\nconst InputSection = ({\n dir,\n lang,\n readonly,\n locale,\n placeholder,\n value,\n onChange,\n onSend,\n onAcceptPlaceholder,\n showImageInput,\n imageInput,\n}: InputSectionProps) => {\n if (!placeholder) {\n return null;\n }\n\n return (\n <MarkdownFlowInput\n showImageInput={showImageInput}\n imageInput={imageInput}\n dir={dir}\n lang={lang}\n disabled={readonly}\n locale={locale}\n placeholder={placeholder}\n value={value}\n onChange={onChange}\n onSend={onSend}\n onAcceptPlaceholder={onAcceptPlaceholder}\n title={placeholder}\n />\n );\n};\n\n// Define custom variable component\nconst CustomButtonInputVariable = ({\n dir,\n lang,\n node,\n readonly,\n locale,\n defaultButtonText,\n defaultInputText,\n defaultSelectedValues,\n onSend,\n confirmButtonText,\n beforeSend = () => true,\n onPlaceholderAccepted,\n showImageInput,\n imageInput,\n}: CustomVariableProps) => {\n const localeTexts = getContentRenderLocaleTexts(locale);\n const resolvedConfirmButtonText =\n confirmButtonText || localeTexts.confirmButtonText;\n const [inputValue, setInputValue] = React.useState(defaultInputText || \"\");\n const [selectedValues, setSelectedValues] = React.useState<string[]>(\n defaultSelectedValues || []\n );\n const interactionDefinitionKey = JSON.stringify({\n buttonTexts: node.properties?.buttonTexts,\n buttonValues: node.properties?.buttonValues,\n isMultiSelect: node.properties?.isMultiSelect,\n placeholder: node.properties?.placeholder,\n variableName: node.properties?.variableName,\n });\n const isMultiSelect = node.properties?.isMultiSelect ?? false;\n const baseButtonTexts = node.properties?.buttonTexts || [];\n const shouldUseFallbackButton =\n !isMultiSelect &&\n baseButtonTexts.length === 0 &&\n !node.properties?.placeholder;\n const fallbackButtonLabel =\n normalizeVariableName(node.properties?.variableName || \"\") ||\n defaultButtonText ||\n resolvedConfirmButtonText;\n\n const singleSelectNode = React.useMemo<CustomVariableNode>(() => {\n if (!shouldUseFallbackButton) {\n return node;\n }\n return {\n ...node,\n properties: {\n ...(node.properties || {}),\n buttonTexts: [fallbackButtonLabel],\n buttonValues: [fallbackButtonLabel],\n },\n };\n }, [fallbackButtonLabel, node, shouldUseFallbackButton]);\n\n const singleSelectButtonTexts =\n singleSelectNode.properties?.buttonTexts || [];\n const singleSelectButtonValues =\n singleSelectNode.properties?.buttonValues || [];\n const isSingleSelect = !isMultiSelect && singleSelectButtonTexts.length > 0;\n\n const send = (param: OnSendContentParams) => {\n if (readonly || imageInput?.uploading) return;\n const images =\n node.properties?.placeholder && imageInput?.images.length\n ? [...imageInput.images]\n : undefined;\n const submission = images\n ? {\n ...param,\n ...(param.buttonText !== undefined && inputValue\n ? { inputText: inputValue }\n : {}),\n images,\n }\n : param;\n if (!beforeSend?.(submission)) return;\n onSend?.(submission);\n };\n\n const handleButtonClick = (value: string) => {\n const param = {\n variableName: node.properties?.variableName || \"\",\n buttonText: value,\n };\n send(param);\n };\n\n const handleCheckboxChange = (value: string, checked: boolean) => {\n setSelectedValues((prev) => {\n if (checked) {\n return [...prev, value];\n } else {\n return prev.filter((v) => v !== value);\n }\n });\n };\n\n const handleConfirmClick = () => {\n const noSelection =\n selectedValues.length === 0 &&\n !inputValue?.trim() &&\n !(node.properties?.placeholder && imageInput?.images.length);\n const param = {\n variableName: node.properties?.variableName || \"\",\n selectedValues,\n inputText: inputValue?.trim() || undefined,\n };\n if (readonly || noSelection) return;\n send(param);\n };\n\n const handleInputChange = (e: React.ChangeEvent<HTMLTextAreaElement>) => {\n setInputValue(e.target.value);\n };\n const handleAcceptPlaceholder = (value: string) => {\n setInputValue(value);\n // Observer failures must never prevent editing or submitting an answer.\n try {\n void Promise.resolve(onPlaceholderAccepted?.()).catch(() => {});\n } catch {}\n };\n const handleKeyDown = (e: React.KeyboardEvent<HTMLTextAreaElement>) => {\n if (\n acceptPlaceholder(\n e,\n node.properties?.placeholder,\n readonly,\n handleAcceptPlaceholder\n )\n ) {\n return;\n }\n if (e.nativeEvent.isComposing || e.keyCode === 229) {\n return;\n }\n if (e.key === \"Enter\" && !e.shiftKey) {\n e.preventDefault();\n if (isMultiSelect) {\n const noSelection =\n selectedValues.length === 0 &&\n !inputValue.trim() &&\n !imageInput?.images.length;\n if (!noSelection) handleConfirmClick();\n } else {\n handleSendClick();\n }\n }\n };\n const handleSendClick = () => {\n const param = {\n variableName: node.properties?.variableName || \"\",\n inputText: inputValue,\n };\n send(param);\n };\n\n const resolvedDefaultButtonText = React.useMemo(() => {\n if (!defaultButtonText) {\n return undefined;\n }\n const valueIndex = singleSelectButtonValues.indexOf(defaultButtonText);\n if (valueIndex > -1) {\n return singleSelectButtonTexts[valueIndex] ?? defaultButtonText;\n }\n const textIndex = singleSelectButtonTexts.indexOf(defaultButtonText);\n if (textIndex > -1) {\n return singleSelectButtonTexts[textIndex];\n }\n return undefined;\n }, [defaultButtonText, singleSelectButtonTexts, singleSelectButtonValues]);\n\n React.useEffect(() => {\n setInputValue(defaultInputText || \"\");\n }, [defaultInputText, interactionDefinitionKey]);\n\n React.useEffect(() => {\n setSelectedValues(defaultSelectedValues || []);\n }, [defaultSelectedValues, interactionDefinitionKey]);\n\n return (\n <span className=\"custom-variable-container inline-flex items-center flex-wrap\">\n {isMultiSelect && (\n <MultiSelectSection\n locale={locale}\n showImageInput={showImageInput}\n imageInput={imageInput}\n node={node}\n readonly={readonly}\n selectedValues={selectedValues}\n inputValue={inputValue}\n confirmButtonText={resolvedConfirmButtonText}\n handleCheckboxChange={handleCheckboxChange}\n handleInputChange={handleInputChange}\n handleKeyDown={handleKeyDown}\n handleConfirmClick={handleConfirmClick}\n />\n )}\n\n {!isMultiSelect && isSingleSelect && (\n <SingleSelectSection\n showImageInput={showImageInput}\n imageInput={imageInput}\n dir={dir}\n lang={lang}\n node={singleSelectNode}\n readonly={readonly}\n locale={locale}\n resolvedDefaultButtonText={resolvedDefaultButtonText}\n handleButtonClick={handleButtonClick}\n inputValue={inputValue}\n handleInputChange={handleInputChange}\n handleSendClick={handleSendClick}\n onAcceptPlaceholder={handleAcceptPlaceholder}\n />\n )}\n\n {!isMultiSelect && !isSingleSelect && node.properties?.placeholder && (\n <InputSection\n showImageInput={showImageInput}\n imageInput={imageInput}\n dir={dir}\n lang={lang}\n readonly={readonly}\n locale={locale}\n placeholder={node.properties.placeholder}\n value={inputValue}\n onChange={handleInputChange}\n onSend={handleSendClick}\n onAcceptPlaceholder={handleAcceptPlaceholder}\n />\n )}\n </span>\n );\n};\n\nexport default CustomButtonInputVariable;\nexport type {\n ComponentsWithCustomVariable,\n CustomVariableNode,\n CustomVariableProps,\n};\n"],"names":["MultiSelectSection","node","readonly","selectedValues","inputValue","confirmButtonText","handleCheckboxChange","handleInputChange","handleKeyDown","handleConfirmClick","showImageInput","imageInput","locale","placeholder","confirmDisabled","renderConfirmButton","extraWrapperClassName","jsx","cn","jsxs","text","index","value","buttonValue","Checkbox","checked","ImageInputGroup","InputGroupTextarea","SingleSelectSection","dir","lang","resolvedDefaultButtonText","handleButtonClick","handleSendClick","onAcceptPlaceholder","Button","MarkdownFlowInput","InputSection","onChange","onSend","CustomButtonInputVariable","defaultButtonText","defaultInputText","defaultSelectedValues","beforeSend","onPlaceholderAccepted","localeTexts","getContentRenderLocaleTexts","resolvedConfirmButtonText","setInputValue","React","setSelectedValues","interactionDefinitionKey","isMultiSelect","baseButtonTexts","shouldUseFallbackButton","fallbackButtonLabel","normalizeVariableName","singleSelectNode","singleSelectButtonTexts","singleSelectButtonValues","isSingleSelect","send","param","images","submission","prev","v","noSelection","e","handleAcceptPlaceholder","acceptPlaceholder","valueIndex","textIndex"],"mappings":";;;;;;;;;;;AAoEA,MAAMA,KAAqB,CAAC;AAAA,EAC1B,MAAAC;AAAA,EACA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AA,QACA,mBAAmB4C;AAAA,QACnB,sBAAA1C;AAAA,QACA,mBAAAC;AAAA,QACA,eAAAC;AAAA,QACA,oBAAAC;AAAA,MAAA;AAAA,IAAA;AAAA,IAIH,CAAC4C,KAAiBQ,KACjB,gBAAA5C;AAAA,MAACW;AAAA,MAAA;AAAA,QACC,gBAAAlB;AAAA,QACA,YAAAC;AAAA,QACA,KAAAkB;AAAA,QACA,MAAAC;AAAA,QACA,MAAM4B;AAAA,QACN,UAAAxD;AAAA,QACA,QAAAU;AAAA,QACA,2BAAAmB;AAAA,QACA,mBAAAC;AAAA,QACA,YAAA5B;AAAA,QACA,mBAAAG;AAAA,QACA,iBAAA0B;AAAA,QACA,qBAAqBqC;AAAA,MAAA;AAAA,IAAA;AAAA,IAIxB,CAACjB,KAAiB,CAACQ,KAAkB5D,EAAK,YAAY,eACrD,gBAAAgB;AAAA,MAACoB;AAAA,MAAA;AAAA,QACC,gBAAA3B;AAAA,QACA,YAAAC;AAAA,QACA,KAAAkB;AAAA,QACA,MAAAC;AAAA,QACA,UAAA5B;AAAA,QACA,QAAAU;AAAA,QACA,aAAaX,EAAK,WAAW;AAAA,QAC7B,OAAOG;AAAA,QACP,UAAUG;AAAA,QACV,QAAQ0B;AAAA,QACR,qBAAqBqC;AAAA,MAAA;AAAA,IAAA;AAAA,EACvB,GAEJ;AAEJ;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("react/jsx-runtime"),d=require("../../lib/locale.cjs"),C=require("../ContentRender/ContentRender.cjs");require("react");require("react-dom/client");require("../ContentRender/utils/inline-code-ranges.cjs");require("../ui/inputGroup/input-group.cjs");;/* empty css */const f=({initialContentList:i=[],locale:t,lang:r,dir:u,customRenderBar:n,onSend:s,onPlaceholderAccepted:l,confirmButtonText:o,copyButtonText:c,copiedButtonText:m,beforeSend:q,interactionDefaultValueOptions:w})=>a.jsx("div",{className:"markdown-flow",dir:u??d.getMarkdownFlowDirection(t),lang:r??d.getMarkdownFlowLanguage(t),children:i.map((e,F)=>{const S=e.isFinished??!1?void 0:s,x=q??(()=>!0);return a.jsx(C.default,{content:e.content,userInput:e.userInput,defaultInputText:e.defaultInputText,defaultButtonText:e.defaultButtonText,defaultSelectedValues:e.defaultSelectedValues,readonly:e.readonly,customRenderBar:e.customRenderBar||n,onSend:S,onPlaceholderAccepted:l,beforeSend:x,locale:t,lang:r,dir:u,interactionDefaultValueOptions:w,onClickCustomButtonAfterContent:e.onClickCustomButtonAfterContent,confirmButtonText:o,copyButtonText:c,copiedButtonText:m,dynamicInteractionFormat:e.dynamicInteractionFormat},F)})});exports.default=f;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("react/jsx-runtime"),k=require("react"),n=require("../../lib/locale.cjs"),M=require("../ContentRender/ContentRender.cjs");require("react-dom/client");require("../ContentRender/utils/inline-code-ranges.cjs");require("../ui/inputGroup/input-group.cjs");;/* empty css */const b=({initialContentList:m=[],locale:t,lang:a,dir:s,customRenderBar:c,onSend:g,onPlaceholderAccepted:w,confirmButtonText:p,copyButtonText:q,copiedButtonText:S,beforeSend:x,interactionDefaultValueOptions:r,showImageInput:d=!1,imageInput:l})=>{const o=d||!!l,B=k.useMemo(()=>o?{...r,allowImages:!0}:r,[o,r]);return i.jsx("div",{className:"markdown-flow",dir:s??n.getMarkdownFlowDirection(t),lang:a??n.getMarkdownFlowLanguage(t),children:m.map((e,C)=>{const u=e.isFinished??!1,F=u?void 0:g,f=x??(()=>!0);return i.jsx(M.default,{content:e.content,userInput:e.userInput,defaultInputText:e.defaultInputText,defaultButtonText:e.defaultButtonText,defaultSelectedValues:e.defaultSelectedValues,readonly:e.readonly,showImageInput:e.showImageInput??(!u&&d),imageInput:e.imageInput??(u?void 0:l),customRenderBar:e.customRenderBar||c,onSend:F,onPlaceholderAccepted:w,beforeSend:f,locale:t,lang:a,dir:s,interactionDefaultValueOptions:B,onClickCustomButtonAfterContent:e.onClickCustomButtonAfterContent,confirmButtonText:p,copyButtonText:q,copiedButtonText:S,dynamicInteractionFormat:e.dynamicInteractionFormat},C)})})};exports.default=b;
2
2
  //# sourceMappingURL=MarkdownFlow.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"MarkdownFlow.cjs","sources":["../../../src/components/MarkdownFlow/MarkdownFlow.tsx"],"sourcesContent":["import React from \"react\";\nimport type { InteractionDefaultValueOptions } from \"../../lib/interaction-defaults\";\nimport {\n getMarkdownFlowDirection,\n getMarkdownFlowLanguage,\n type MarkdownFlowLocale,\n} from \"../../lib/locale\";\nimport ContentRender from \"../ContentRender\";\nimport { CustomRenderBarProps, OnSendContentParams } from \"../types\";\nimport \"./markdownFlow.css\";\n\nexport interface MarkdownFlowProps {\n initialContentList?: {\n content: string;\n isFinished?: boolean;\n userInput?: string;\n defaultInputText?: string;\n defaultButtonText?: string;\n defaultSelectedValues?: string[];\n readonly?: boolean;\n customRenderBar?: CustomRenderBarProps;\n onClickCustomButtonAfterContent?: () => void;\n dynamicInteractionFormat?: string;\n }[];\n /**\n * Locale used for built-in UI text when a more specific text prop is not provided.\n * Arabic sets RTL direction; other supported locales set LTR direction.\n * When omitted, direction is inherited from the host and UI text uses the default locale.\n */\n locale?: MarkdownFlowLocale;\n /** Overrides the locale-derived language. */\n lang?: string;\n /** Overrides the locale-derived direction. */\n dir?: React.HTMLAttributes<HTMLDivElement>[\"dir\"];\n customRenderBar?: CustomRenderBarProps;\n onSend?: (content: OnSendContentParams) => void;\n /** Observes an accepted Tab completion without receiving authored text. */\n onPlaceholderAccepted?: () => void;\n // Multi-select confirm button text (i18n support)\n confirmButtonText?: string;\n // Copy button text for code blocks\n copyButtonText?: string;\n // Copied state text for code blocks\n copiedButtonText?: string;\n beforeSend?: (content: OnSendContentParams) => boolean;\n interactionDefaultValueOptions?: InteractionDefaultValueOptions;\n}\n\nconst MarkdownFlow: React.FC<MarkdownFlowProps> = ({\n initialContentList = [],\n locale,\n lang,\n dir,\n customRenderBar,\n onSend: onSendProp,\n onPlaceholderAccepted,\n confirmButtonText,\n copyButtonText,\n copiedButtonText,\n beforeSend: beforeSendProp,\n interactionDefaultValueOptions,\n}) => {\n return (\n <div\n className=\"markdown-flow\"\n dir={dir ?? getMarkdownFlowDirection(locale)}\n lang={lang ?? getMarkdownFlowLanguage(locale)}\n >\n {initialContentList.map((contentInfo, index) => {\n const isFinished = contentInfo.isFinished ?? false;\n const onSend = isFinished ? undefined : onSendProp;\n const beforeSend = beforeSendProp ?? (() => true);\n return (\n <ContentRender\n key={index}\n content={contentInfo.content}\n userInput={contentInfo.userInput}\n defaultInputText={contentInfo.defaultInputText}\n defaultButtonText={contentInfo.defaultButtonText}\n defaultSelectedValues={contentInfo.defaultSelectedValues}\n readonly={contentInfo.readonly}\n customRenderBar={contentInfo.customRenderBar || customRenderBar}\n onSend={onSend}\n onPlaceholderAccepted={onPlaceholderAccepted}\n beforeSend={beforeSend}\n locale={locale}\n lang={lang}\n dir={dir}\n interactionDefaultValueOptions={interactionDefaultValueOptions}\n onClickCustomButtonAfterContent={\n contentInfo.onClickCustomButtonAfterContent\n }\n confirmButtonText={confirmButtonText}\n copyButtonText={copyButtonText}\n copiedButtonText={copiedButtonText}\n dynamicInteractionFormat={contentInfo.dynamicInteractionFormat}\n />\n );\n })}\n </div>\n );\n};\n\nexport default MarkdownFlow;\n"],"names":["MarkdownFlow","initialContentList","locale","lang","dir","customRenderBar","onSendProp","onPlaceholderAccepted","confirmButtonText","copyButtonText","copiedButtonText","beforeSendProp","interactionDefaultValueOptions","jsx","getMarkdownFlowDirection","getMarkdownFlowLanguage","contentInfo","index","onSend","beforeSend","ContentRender"],"mappings":"uZAgDA,MAAMA,EAA4C,CAAC,CACjD,mBAAAC,EAAqB,CAAA,EAAC,OACtBC,EACA,KAAAC,EACA,IAAAC,EACA,gBAAAC,EACA,OAAQC,EACR,sBAAAC,EACA,kBAAAC,EACA,eAAAC,EACA,iBAAAC,EACA,WAAYC,EACZ,+BAAAC,CACF,IAEIC,EAAAA,IAAC,MAAA,CACC,UAAU,gBACV,IAAKT,GAAOU,EAAAA,yBAAyBZ,CAAM,EAC3C,KAAMC,GAAQY,EAAAA,wBAAwBb,CAAM,EAE3C,SAAAD,EAAmB,IAAI,CAACe,EAAaC,IAAU,CAE9C,MAAMC,EADaF,EAAY,YAAc,GACjB,OAAYV,EAClCa,EAAaR,IAAmB,IAAM,IAC5C,OACEE,EAAAA,IAACO,EAAAA,QAAA,CAEC,QAASJ,EAAY,QACrB,UAAWA,EAAY,UACvB,iBAAkBA,EAAY,iBAC9B,kBAAmBA,EAAY,kBAC/B,sBAAuBA,EAAY,sBACnC,SAAUA,EAAY,SACtB,gBAAiBA,EAAY,iBAAmBX,EAChD,OAAAa,EACA,sBAAAX,EACA,WAAAY,EAAA,OACAjB,EACA,KAAAC,EACA,IAAAC,EACA,+BAAAQ,EACA,gCACEI,EAAY,gCAEd,kBAAAR,EACA,eAAAC,EACA,iBAAAC,EACA,yBAA0BM,EAAY,wBAAA,EArBjCC,CAAA,CAwBX,CAAC,CAAA,CAAA"}
1
+ {"version":3,"file":"MarkdownFlow.cjs","sources":["../../../src/components/MarkdownFlow/MarkdownFlow.tsx"],"sourcesContent":["import React from \"react\";\nimport type { InteractionDefaultValueOptions } from \"../../lib/interaction-defaults\";\nimport {\n getMarkdownFlowDirection,\n getMarkdownFlowLanguage,\n type MarkdownFlowLocale,\n} from \"../../lib/locale\";\nimport ContentRender from \"../ContentRender\";\nimport type { ImageInputOptions } from \"../ContentRender/ImageInputGroup\";\nimport { CustomRenderBarProps, OnSendContentParams } from \"../types\";\nimport \"./markdownFlow.css\";\n\nexport interface MarkdownFlowProps {\n initialContentList?: {\n content: string;\n isFinished?: boolean;\n userInput?: string;\n defaultInputText?: string;\n defaultButtonText?: string;\n defaultSelectedValues?: string[];\n readonly?: boolean;\n showImageInput?: boolean;\n imageInput?: ImageInputOptions;\n customRenderBar?: CustomRenderBarProps;\n onClickCustomButtonAfterContent?: () => void;\n dynamicInteractionFormat?: string;\n }[];\n /**\n * Locale used for built-in UI text when a more specific text prop is not provided.\n * Arabic sets RTL direction; other supported locales set LTR direction.\n * When omitted, direction is inherited from the host and UI text uses the default locale.\n */\n locale?: MarkdownFlowLocale;\n /** Overrides the locale-derived language. */\n lang?: string;\n /** Overrides the locale-derived direction. */\n dir?: React.HTMLAttributes<HTMLDivElement>[\"dir\"];\n customRenderBar?: CustomRenderBarProps;\n onSend?: (content: OnSendContentParams) => void;\n /** Observes an accepted Tab completion without receiving authored text. */\n onPlaceholderAccepted?: () => void;\n // Multi-select confirm button text (i18n support)\n confirmButtonText?: string;\n // Copy button text for code blocks\n copyButtonText?: string;\n // Copied state text for code blocks\n copiedButtonText?: string;\n beforeSend?: (content: OnSendContentParams) => boolean;\n interactionDefaultValueOptions?: InteractionDefaultValueOptions;\n /** Show the image picker on unfinished text interactions. Hidden by default. */\n showImageInput?: boolean;\n /** Controlled images for unfinished interactions; history uses each item. */\n imageInput?: ImageInputOptions;\n}\n\nconst MarkdownFlow: React.FC<MarkdownFlowProps> = ({\n initialContentList = [],\n locale,\n lang,\n dir,\n customRenderBar,\n onSend: onSendProp,\n onPlaceholderAccepted,\n confirmButtonText,\n copyButtonText,\n copiedButtonText,\n beforeSend: beforeSendProp,\n interactionDefaultValueOptions,\n showImageInput = false,\n imageInput,\n}) => {\n const imageDefaultsEnabled = showImageInput || Boolean(imageInput);\n const defaultValueOptions = React.useMemo(\n () =>\n imageDefaultsEnabled\n ? { ...interactionDefaultValueOptions, allowImages: true }\n : interactionDefaultValueOptions,\n [imageDefaultsEnabled, interactionDefaultValueOptions]\n );\n return (\n <div\n className=\"markdown-flow\"\n dir={dir ?? getMarkdownFlowDirection(locale)}\n lang={lang ?? getMarkdownFlowLanguage(locale)}\n >\n {initialContentList.map((contentInfo, index) => {\n const isFinished = contentInfo.isFinished ?? false;\n const onSend = isFinished ? undefined : onSendProp;\n const beforeSend = beforeSendProp ?? (() => true);\n return (\n <ContentRender\n key={index}\n content={contentInfo.content}\n userInput={contentInfo.userInput}\n defaultInputText={contentInfo.defaultInputText}\n defaultButtonText={contentInfo.defaultButtonText}\n defaultSelectedValues={contentInfo.defaultSelectedValues}\n readonly={contentInfo.readonly}\n showImageInput={\n contentInfo.showImageInput ?? (!isFinished && showImageInput)\n }\n imageInput={\n contentInfo.imageInput ?? (!isFinished ? imageInput : undefined)\n }\n customRenderBar={contentInfo.customRenderBar || customRenderBar}\n onSend={onSend}\n onPlaceholderAccepted={onPlaceholderAccepted}\n beforeSend={beforeSend}\n locale={locale}\n lang={lang}\n dir={dir}\n interactionDefaultValueOptions={defaultValueOptions}\n onClickCustomButtonAfterContent={\n contentInfo.onClickCustomButtonAfterContent\n }\n confirmButtonText={confirmButtonText}\n copyButtonText={copyButtonText}\n copiedButtonText={copiedButtonText}\n dynamicInteractionFormat={contentInfo.dynamicInteractionFormat}\n />\n );\n })}\n </div>\n );\n};\n\nexport default MarkdownFlow;\n"],"names":["MarkdownFlow","initialContentList","locale","lang","dir","customRenderBar","onSendProp","onPlaceholderAccepted","confirmButtonText","copyButtonText","copiedButtonText","beforeSendProp","interactionDefaultValueOptions","showImageInput","imageInput","imageDefaultsEnabled","defaultValueOptions","React","jsx","getMarkdownFlowDirection","getMarkdownFlowLanguage","contentInfo","index","isFinished","onSend","beforeSend","ContentRender"],"mappings":"yZAuDA,MAAMA,EAA4C,CAAC,CACjD,mBAAAC,EAAqB,CAAA,EAAC,OACtBC,EACA,KAAAC,EACA,IAAAC,EACA,gBAAAC,EACA,OAAQC,EACR,sBAAAC,EACA,kBAAAC,EACA,eAAAC,EACA,iBAAAC,EACA,WAAYC,EACZ,+BAAAC,EACA,eAAAC,EAAiB,GACjB,WAAAC,CACF,IAAM,CACJ,MAAMC,EAAuBF,GAAkB,EAAQC,EACjDE,EAAsBC,EAAM,QAChC,IACEF,EACI,CAAE,GAAGH,EAAgC,YAAa,IAClDA,EACN,CAACG,EAAsBH,CAA8B,CAAA,EAEvD,OACEM,EAAAA,IAAC,MAAA,CACC,UAAU,gBACV,IAAKd,GAAOe,EAAAA,yBAAyBjB,CAAM,EAC3C,KAAMC,GAAQiB,EAAAA,wBAAwBlB,CAAM,EAE3C,SAAAD,EAAmB,IAAI,CAACoB,EAAaC,IAAU,CAC9C,MAAMC,EAAaF,EAAY,YAAc,GACvCG,EAASD,EAAa,OAAYjB,EAClCmB,EAAad,IAAmB,IAAM,IAC5C,OACEO,EAAAA,IAACQ,EAAAA,QAAA,CAEC,QAASL,EAAY,QACrB,UAAWA,EAAY,UACvB,iBAAkBA,EAAY,iBAC9B,kBAAmBA,EAAY,kBAC/B,sBAAuBA,EAAY,sBACnC,SAAUA,EAAY,SACtB,eACEA,EAAY,iBAAmB,CAACE,GAAcV,GAEhD,WACEQ,EAAY,aAAgBE,EAA0B,OAAbT,GAE3C,gBAAiBO,EAAY,iBAAmBhB,EAChD,OAAAmB,EACA,sBAAAjB,EACA,WAAAkB,EAAA,OACAvB,EACA,KAAAC,EACA,IAAAC,EACA,+BAAgCY,EAChC,gCACEK,EAAY,gCAEd,kBAAAb,EACA,eAAAC,EACA,iBAAAC,EACA,yBAA0BW,EAAY,wBAAA,EA3BjCC,CAAA,CA8BX,CAAC,CAAA,CAAA,CAGP"}
@@ -1,6 +1,7 @@
1
1
  import { default as React } from 'react';
2
2
  import { InteractionDefaultValueOptions } from '../../lib/interaction-defaults.js';
3
3
  import { MarkdownFlowLocale } from '../../lib/locale.js';
4
+ import { ImageInputOptions } from '../ContentRender/ImageInputGroup.js';
4
5
  import { CustomRenderBarProps, OnSendContentParams } from '../types.js';
5
6
  export interface MarkdownFlowProps {
6
7
  initialContentList?: {
@@ -11,6 +12,8 @@ export interface MarkdownFlowProps {
11
12
  defaultButtonText?: string;
12
13
  defaultSelectedValues?: string[];
13
14
  readonly?: boolean;
15
+ showImageInput?: boolean;
16
+ imageInput?: ImageInputOptions;
14
17
  customRenderBar?: CustomRenderBarProps;
15
18
  onClickCustomButtonAfterContent?: () => void;
16
19
  dynamicInteractionFormat?: string;
@@ -34,6 +37,10 @@ export interface MarkdownFlowProps {
34
37
  copiedButtonText?: string;
35
38
  beforeSend?: (content: OnSendContentParams) => boolean;
36
39
  interactionDefaultValueOptions?: InteractionDefaultValueOptions;
40
+ /** Show the image picker on unfinished text interactions. Hidden by default. */
41
+ showImageInput?: boolean;
42
+ /** Controlled images for unfinished interactions; history uses each item. */
43
+ imageInput?: ImageInputOptions;
37
44
  }
38
45
  declare const MarkdownFlow: React.FC<MarkdownFlowProps>;
39
46
  export default MarkdownFlow;
@@ -1,61 +1,71 @@
1
- import { jsx as d } from "react/jsx-runtime";
2
- import { getMarkdownFlowLanguage as C, getMarkdownFlowDirection as k } from "../../lib/locale.es.js";
3
- import x from "../ContentRender/ContentRender.es.js";
4
- import "react";
1
+ import { jsx as i } from "react/jsx-runtime";
2
+ import S from "react";
3
+ import { getMarkdownFlowLanguage as h, getMarkdownFlowDirection as y } from "../../lib/locale.es.js";
4
+ import M from "../ContentRender/ContentRender.es.js";
5
5
  import "react-dom/client";
6
6
  import "../ContentRender/utils/inline-code-ranges.es.js";
7
7
  import "../ui/inputGroup/input-group.es.js";
8
8
  /* empty css */
9
- const v = ({
10
- initialContentList: a = [],
9
+ const D = ({
10
+ initialContentList: l = [],
11
11
  locale: t,
12
- lang: r,
13
- dir: o,
14
- customRenderBar: i,
15
- onSend: u,
16
- onPlaceholderAccepted: n,
17
- confirmButtonText: s,
18
- copyButtonText: m,
19
- copiedButtonText: l,
20
- beforeSend: p,
21
- interactionDefaultValueOptions: c
22
- }) => /* @__PURE__ */ d(
23
- "div",
24
- {
25
- className: "markdown-flow",
26
- dir: o ?? k(t),
27
- lang: r ?? C(t),
28
- children: a.map((e, w) => {
29
- const F = e.isFinished ?? !1 ? void 0 : u, f = p ?? (() => !0);
30
- return /* @__PURE__ */ d(
31
- x,
32
- {
33
- content: e.content,
34
- userInput: e.userInput,
35
- defaultInputText: e.defaultInputText,
36
- defaultButtonText: e.defaultButtonText,
37
- defaultSelectedValues: e.defaultSelectedValues,
38
- readonly: e.readonly,
39
- customRenderBar: e.customRenderBar || i,
40
- onSend: F,
41
- onPlaceholderAccepted: n,
42
- beforeSend: f,
43
- locale: t,
44
- lang: r,
45
- dir: o,
46
- interactionDefaultValueOptions: c,
47
- onClickCustomButtonAfterContent: e.onClickCustomButtonAfterContent,
48
- confirmButtonText: s,
49
- copyButtonText: m,
50
- copiedButtonText: l,
51
- dynamicInteractionFormat: e.dynamicInteractionFormat
52
- },
53
- w
54
- );
55
- })
56
- }
57
- );
12
+ lang: o,
13
+ dir: d,
14
+ customRenderBar: n,
15
+ onSend: p,
16
+ onPlaceholderAccepted: w,
17
+ confirmButtonText: f,
18
+ copyButtonText: c,
19
+ copiedButtonText: g,
20
+ beforeSend: B,
21
+ interactionDefaultValueOptions: r,
22
+ showImageInput: u = !1,
23
+ imageInput: m
24
+ }) => {
25
+ const s = u || !!m, C = S.useMemo(
26
+ () => s ? { ...r, allowImages: !0 } : r,
27
+ [s, r]
28
+ );
29
+ return /* @__PURE__ */ i(
30
+ "div",
31
+ {
32
+ className: "markdown-flow",
33
+ dir: d ?? y(t),
34
+ lang: o ?? h(t),
35
+ children: l.map((e, F) => {
36
+ const a = e.isFinished ?? !1, k = a ? void 0 : p, x = B ?? (() => !0);
37
+ return /* @__PURE__ */ i(
38
+ M,
39
+ {
40
+ content: e.content,
41
+ userInput: e.userInput,
42
+ defaultInputText: e.defaultInputText,
43
+ defaultButtonText: e.defaultButtonText,
44
+ defaultSelectedValues: e.defaultSelectedValues,
45
+ readonly: e.readonly,
46
+ showImageInput: e.showImageInput ?? (!a && u),
47
+ imageInput: e.imageInput ?? (a ? void 0 : m),
48
+ customRenderBar: e.customRenderBar || n,
49
+ onSend: k,
50
+ onPlaceholderAccepted: w,
51
+ beforeSend: x,
52
+ locale: t,
53
+ lang: o,
54
+ dir: d,
55
+ interactionDefaultValueOptions: C,
56
+ onClickCustomButtonAfterContent: e.onClickCustomButtonAfterContent,
57
+ confirmButtonText: f,
58
+ copyButtonText: c,
59
+ copiedButtonText: g,
60
+ dynamicInteractionFormat: e.dynamicInteractionFormat
61
+ },
62
+ F
63
+ );
64
+ })
65
+ }
66
+ );
67
+ };
58
68
  export {
59
- v as default
69
+ D as default
60
70
  };
61
71
  //# sourceMappingURL=MarkdownFlow.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"MarkdownFlow.es.js","sources":["../../../src/components/MarkdownFlow/MarkdownFlow.tsx"],"sourcesContent":["import React from \"react\";\nimport type { InteractionDefaultValueOptions } from \"../../lib/interaction-defaults\";\nimport {\n getMarkdownFlowDirection,\n getMarkdownFlowLanguage,\n type MarkdownFlowLocale,\n} from \"../../lib/locale\";\nimport ContentRender from \"../ContentRender\";\nimport { CustomRenderBarProps, OnSendContentParams } from \"../types\";\nimport \"./markdownFlow.css\";\n\nexport interface MarkdownFlowProps {\n initialContentList?: {\n content: string;\n isFinished?: boolean;\n userInput?: string;\n defaultInputText?: string;\n defaultButtonText?: string;\n defaultSelectedValues?: string[];\n readonly?: boolean;\n customRenderBar?: CustomRenderBarProps;\n onClickCustomButtonAfterContent?: () => void;\n dynamicInteractionFormat?: string;\n }[];\n /**\n * Locale used for built-in UI text when a more specific text prop is not provided.\n * Arabic sets RTL direction; other supported locales set LTR direction.\n * When omitted, direction is inherited from the host and UI text uses the default locale.\n */\n locale?: MarkdownFlowLocale;\n /** Overrides the locale-derived language. */\n lang?: string;\n /** Overrides the locale-derived direction. */\n dir?: React.HTMLAttributes<HTMLDivElement>[\"dir\"];\n customRenderBar?: CustomRenderBarProps;\n onSend?: (content: OnSendContentParams) => void;\n /** Observes an accepted Tab completion without receiving authored text. */\n onPlaceholderAccepted?: () => void;\n // Multi-select confirm button text (i18n support)\n confirmButtonText?: string;\n // Copy button text for code blocks\n copyButtonText?: string;\n // Copied state text for code blocks\n copiedButtonText?: string;\n beforeSend?: (content: OnSendContentParams) => boolean;\n interactionDefaultValueOptions?: InteractionDefaultValueOptions;\n}\n\nconst MarkdownFlow: React.FC<MarkdownFlowProps> = ({\n initialContentList = [],\n locale,\n lang,\n dir,\n customRenderBar,\n onSend: onSendProp,\n onPlaceholderAccepted,\n confirmButtonText,\n copyButtonText,\n copiedButtonText,\n beforeSend: beforeSendProp,\n interactionDefaultValueOptions,\n}) => {\n return (\n <div\n className=\"markdown-flow\"\n dir={dir ?? getMarkdownFlowDirection(locale)}\n lang={lang ?? getMarkdownFlowLanguage(locale)}\n >\n {initialContentList.map((contentInfo, index) => {\n const isFinished = contentInfo.isFinished ?? false;\n const onSend = isFinished ? undefined : onSendProp;\n const beforeSend = beforeSendProp ?? (() => true);\n return (\n <ContentRender\n key={index}\n content={contentInfo.content}\n userInput={contentInfo.userInput}\n defaultInputText={contentInfo.defaultInputText}\n defaultButtonText={contentInfo.defaultButtonText}\n defaultSelectedValues={contentInfo.defaultSelectedValues}\n readonly={contentInfo.readonly}\n customRenderBar={contentInfo.customRenderBar || customRenderBar}\n onSend={onSend}\n onPlaceholderAccepted={onPlaceholderAccepted}\n beforeSend={beforeSend}\n locale={locale}\n lang={lang}\n dir={dir}\n interactionDefaultValueOptions={interactionDefaultValueOptions}\n onClickCustomButtonAfterContent={\n contentInfo.onClickCustomButtonAfterContent\n }\n confirmButtonText={confirmButtonText}\n copyButtonText={copyButtonText}\n copiedButtonText={copiedButtonText}\n dynamicInteractionFormat={contentInfo.dynamicInteractionFormat}\n />\n );\n })}\n </div>\n );\n};\n\nexport default MarkdownFlow;\n"],"names":["MarkdownFlow","initialContentList","locale","lang","dir","customRenderBar","onSendProp","onPlaceholderAccepted","confirmButtonText","copyButtonText","copiedButtonText","beforeSendProp","interactionDefaultValueOptions","jsx","getMarkdownFlowDirection","getMarkdownFlowLanguage","contentInfo","index","onSend","beforeSend","ContentRender"],"mappings":";;;;;;;;AAgDA,MAAMA,IAA4C,CAAC;AAAA,EACjD,oBAAAC,IAAqB,CAAA;AAAA,EACrB,QAAAC;AAAA,EACA,MAAAC;AAAA,EACA,KAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,QAAQC;AAAA,EACR,uBAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,YAAYC;AAAA,EACZ,gCAAAC;AACF,MAEI,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,WAAU;AAAA,IACV,KAAKT,KAAOU,EAAyBZ,CAAM;AAAA,IAC3C,MAAMC,KAAQY,EAAwBb,CAAM;AAAA,IAE3C,UAAAD,EAAmB,IAAI,CAACe,GAAaC,MAAU;AAE9C,YAAMC,IADaF,EAAY,cAAc,KACjB,SAAYV,GAClCa,IAAaR,MAAmB,MAAM;AAC5C,aACE,gBAAAE;AAAA,QAACO;AAAA,QAAA;AAAA,UAEC,SAASJ,EAAY;AAAA,UACrB,WAAWA,EAAY;AAAA,UACvB,kBAAkBA,EAAY;AAAA,UAC9B,mBAAmBA,EAAY;AAAA,UAC/B,uBAAuBA,EAAY;AAAA,UACnC,UAAUA,EAAY;AAAA,UACtB,iBAAiBA,EAAY,mBAAmBX;AAAA,UAChD,QAAAa;AAAA,UACA,uBAAAX;AAAA,UACA,YAAAY;AAAA,UACA,QAAAjB;AAAA,UACA,MAAAC;AAAA,UACA,KAAAC;AAAA,UACA,gCAAAQ;AAAA,UACA,iCACEI,EAAY;AAAA,UAEd,mBAAAR;AAAA,UACA,gBAAAC;AAAA,UACA,kBAAAC;AAAA,UACA,0BAA0BM,EAAY;AAAA,QAAA;AAAA,QArBjCC;AAAA,MAAA;AAAA,IAwBX,CAAC;AAAA,EAAA;AAAA;"}
1
+ {"version":3,"file":"MarkdownFlow.es.js","sources":["../../../src/components/MarkdownFlow/MarkdownFlow.tsx"],"sourcesContent":["import React from \"react\";\nimport type { InteractionDefaultValueOptions } from \"../../lib/interaction-defaults\";\nimport {\n getMarkdownFlowDirection,\n getMarkdownFlowLanguage,\n type MarkdownFlowLocale,\n} from \"../../lib/locale\";\nimport ContentRender from \"../ContentRender\";\nimport type { ImageInputOptions } from \"../ContentRender/ImageInputGroup\";\nimport { CustomRenderBarProps, OnSendContentParams } from \"../types\";\nimport \"./markdownFlow.css\";\n\nexport interface MarkdownFlowProps {\n initialContentList?: {\n content: string;\n isFinished?: boolean;\n userInput?: string;\n defaultInputText?: string;\n defaultButtonText?: string;\n defaultSelectedValues?: string[];\n readonly?: boolean;\n showImageInput?: boolean;\n imageInput?: ImageInputOptions;\n customRenderBar?: CustomRenderBarProps;\n onClickCustomButtonAfterContent?: () => void;\n dynamicInteractionFormat?: string;\n }[];\n /**\n * Locale used for built-in UI text when a more specific text prop is not provided.\n * Arabic sets RTL direction; other supported locales set LTR direction.\n * When omitted, direction is inherited from the host and UI text uses the default locale.\n */\n locale?: MarkdownFlowLocale;\n /** Overrides the locale-derived language. */\n lang?: string;\n /** Overrides the locale-derived direction. */\n dir?: React.HTMLAttributes<HTMLDivElement>[\"dir\"];\n customRenderBar?: CustomRenderBarProps;\n onSend?: (content: OnSendContentParams) => void;\n /** Observes an accepted Tab completion without receiving authored text. */\n onPlaceholderAccepted?: () => void;\n // Multi-select confirm button text (i18n support)\n confirmButtonText?: string;\n // Copy button text for code blocks\n copyButtonText?: string;\n // Copied state text for code blocks\n copiedButtonText?: string;\n beforeSend?: (content: OnSendContentParams) => boolean;\n interactionDefaultValueOptions?: InteractionDefaultValueOptions;\n /** Show the image picker on unfinished text interactions. Hidden by default. */\n showImageInput?: boolean;\n /** Controlled images for unfinished interactions; history uses each item. */\n imageInput?: ImageInputOptions;\n}\n\nconst MarkdownFlow: React.FC<MarkdownFlowProps> = ({\n initialContentList = [],\n locale,\n lang,\n dir,\n customRenderBar,\n onSend: onSendProp,\n onPlaceholderAccepted,\n confirmButtonText,\n copyButtonText,\n copiedButtonText,\n beforeSend: beforeSendProp,\n interactionDefaultValueOptions,\n showImageInput = false,\n imageInput,\n}) => {\n const imageDefaultsEnabled = showImageInput || Boolean(imageInput);\n const defaultValueOptions = React.useMemo(\n () =>\n imageDefaultsEnabled\n ? { ...interactionDefaultValueOptions, allowImages: true }\n : interactionDefaultValueOptions,\n [imageDefaultsEnabled, interactionDefaultValueOptions]\n );\n return (\n <div\n className=\"markdown-flow\"\n dir={dir ?? getMarkdownFlowDirection(locale)}\n lang={lang ?? getMarkdownFlowLanguage(locale)}\n >\n {initialContentList.map((contentInfo, index) => {\n const isFinished = contentInfo.isFinished ?? false;\n const onSend = isFinished ? undefined : onSendProp;\n const beforeSend = beforeSendProp ?? (() => true);\n return (\n <ContentRender\n key={index}\n content={contentInfo.content}\n userInput={contentInfo.userInput}\n defaultInputText={contentInfo.defaultInputText}\n defaultButtonText={contentInfo.defaultButtonText}\n defaultSelectedValues={contentInfo.defaultSelectedValues}\n readonly={contentInfo.readonly}\n showImageInput={\n contentInfo.showImageInput ?? (!isFinished && showImageInput)\n }\n imageInput={\n contentInfo.imageInput ?? (!isFinished ? imageInput : undefined)\n }\n customRenderBar={contentInfo.customRenderBar || customRenderBar}\n onSend={onSend}\n onPlaceholderAccepted={onPlaceholderAccepted}\n beforeSend={beforeSend}\n locale={locale}\n lang={lang}\n dir={dir}\n interactionDefaultValueOptions={defaultValueOptions}\n onClickCustomButtonAfterContent={\n contentInfo.onClickCustomButtonAfterContent\n }\n confirmButtonText={confirmButtonText}\n copyButtonText={copyButtonText}\n copiedButtonText={copiedButtonText}\n dynamicInteractionFormat={contentInfo.dynamicInteractionFormat}\n />\n );\n })}\n </div>\n );\n};\n\nexport default MarkdownFlow;\n"],"names":["MarkdownFlow","initialContentList","locale","lang","dir","customRenderBar","onSendProp","onPlaceholderAccepted","confirmButtonText","copyButtonText","copiedButtonText","beforeSendProp","interactionDefaultValueOptions","showImageInput","imageInput","imageDefaultsEnabled","defaultValueOptions","React","jsx","getMarkdownFlowDirection","getMarkdownFlowLanguage","contentInfo","index","isFinished","onSend","beforeSend","ContentRender"],"mappings":";;;;;;;;AAuDA,MAAMA,IAA4C,CAAC;AAAA,EACjD,oBAAA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AAAA,YAEd,mBAAAb;AAAA,YACA,gBAAAC;AAAA,YACA,kBAAAC;AAAA,YACA,0BAA0BW,EAAY;AAAA,UAAA;AAAA,UA3BjCC;AAAA,QAAA;AAAA,MA8BX,CAAC;AAAA,IAAA;AAAA,EAAA;AAGP;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("react/jsx-runtime"),t=require("react"),Dt=require("../../lib/locale.cjs"),Sr=require("../../lib/useDetachedLanguage.cjs"),kr=require("../../lib/useResolvedDirection.cjs"),Cr=require("../../lib/utils.cjs"),_r=require("./MobilePlayerSettingsSheet.cjs"),xr=require("./slideI18n.cjs"),Mr=require("./utils/mobileScreenMode.cjs"),wr=require("./utils/audioCompletion.cjs"),Tr=require("./utils/playerKeyboardShortcutContext.cjs"),he=require("./utils/playerKeyboardShortcuts.cjs"),vr=require("./utils/playbackSource.cjs"),Er=require("./utils/playbackPreference.cjs"),Lr=require("./utils/playerCustomActions.cjs"),Ze=require("./utils/playerNavigationContext.cjs"),be=require("./utils/segmentSeek.cjs"),Ht=require("./utils/audioSegments.cjs"),Pt=require("./utils/subtitleCue.cjs");;/* empty css */const Ar=require("../../node_modules/lucide-react/dist/esm/icons/ellipsis-vertical.cjs"),Rr=require("../../node_modules/lucide-react/dist/esm/icons/volume-2.cjs"),Nr=require("../../node_modules/lucide-react/dist/esm/icons/skip-back.cjs"),jr=require("../../node_modules/lucide-react/dist/esm/icons/skip-forward.cjs"),Kr=require("../../node_modules/lucide-react/dist/esm/icons/rewind.cjs"),Fr=require("../../node_modules/lucide-react/dist/esm/icons/fast-forward.cjs"),Ur=require("../../node_modules/lucide-react/dist/esm/icons/captions.cjs"),Wr=require("../../node_modules/lucide-react/dist/esm/icons/captions-off.cjs"),Br=require("../../node_modules/lucide-react/dist/esm/icons/scan-line.cjs"),Or=require("../../node_modules/lucide-react/dist/esm/icons/maximize.cjs"),Ir=require("../../node_modules/lucide-react/dist/esm/icons/loader-circle.cjs"),Jt=new Map,$t=f=>{if(typeof window>"u"||!f||Jt.has(f))return;const d=window.document.createElement("audio");d.preload="auto",d.setAttribute("playsinline","true"),d.src=f,d.load(),Jt.set(f,d)},qr=(f,d)=>d!==null&&d.audioList===f&&d.subtitleCueLists.length===f.length&&f.every((l,C)=>{const _=l.element?.subtitle_cues;return d.subtitleCueLists[C]===_&&d.subtitleCueLengths[C]===(_?.length??0)}),Vr=f=>{const d=f.map(l=>l.element?.subtitle_cues);return{audioList:f,subtitleCueLists:d,subtitleCueLengths:d.map(l=>l?.length??0),tracks:d.map(l=>({subtitleCues:l??[]}))}},Dr=()=>s.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"34",height:"34",viewBox:"0 0 34 34",fill:"none",children:[s.jsx("path",{d:"M16.6667 33.3333C25.8714 33.3333 33.3333 25.8714 33.3333 16.6667C33.3333 7.46192 25.8714 0 16.6667 0C7.46192 0 0 7.46192 0 16.6667C0 25.8714 7.46192 33.3333 16.6667 33.3333Z",fill:"#0A0A0A"}),s.jsx("path",{d:"M12 10H16V24H12V10ZM18 10H22V24H18V10Z",fill:"white"})]}),Hr=()=>s.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"34",height:"34",viewBox:"0 0 34 34",fill:"none",children:[s.jsx("path",{d:"M16.6667 33.3333C25.8714 33.3333 33.3333 25.8714 33.3333 16.6667C33.3333 7.46192 25.8714 0 16.6667 0C7.46192 0 0 7.46192 0 16.6667C0 25.8714 7.46192 33.3333 16.6667 33.3333Z",fill:"#0A0A0A"}),s.jsx("path",{d:"M13.3333 10L23.3333 16.6667L13.3333 23.3333V10Z",fill:"white"})]}),P={fullscreen:"F",next:"→",nextSubtitle:"Shift+→",previous:"←",previousSubtitle:"Shift+←",subtitle:"C"},Pr=250,Jr=15e3,$r=(f,d)=>f?`${f} (${d})`:d,Zr=({audioList:f=[],className:d,currentAudioIndex:l=-1,defaultPlaying:C=!0,isPlaybackPaused:_=!1,isAutoAdvanceEnabled:J=!0,useAutoAdvanceToggle:F=!1,onLoadingChange:Ge,onPlaybackPreferenceChange:ze,onPlaybackStarted:Ye,onPlaybackTimeChange:ge,onPlaybackCheckpoint:ee,playbackRestoreRequest:S=null,onPlaybackRestoreComplete:ae,onSubtitleToggle:le,onPrev:ye,onNext:Se,onSubtitleJump:ke,canJumpToSubtitleTarget:je,onFullscreen:ce,isFullscreen:Qe=!1,mobileViewMode:Gt=Mr.DEFAULT_MOBILE_VIEW_MODE,settingsPortalContainer:zt,onMobileViewModeChange:Xe,onEnded:et,onAutoAdvanceToggle:tt,onInteractionToggle:Gr,hasInteraction:zr,isInteractionOpen:Ce=!1,isSubtitleEnabled:Ke=!0,prevDisabled:Fe=!1,nextDisabled:Ue=!1,showControls:We=!0,onControlsPointerEnter:Yt,onControlsPointerLeave:Qt,slideProgress:p=null,enableKeyboardShortcuts:Xt=!0,subtitleSeekRequest:I=null,customActions:rt,customActionContext:nt,locale:_e,texts:ut,onFocusCapture:st,onPointerDown:at,...Be})=>{const Oe=Be.dir??Dt.getMarkdownFlowDirection(_e),lt=Be.lang??Dt.getMarkdownFlowLanguage(_e),er=t.useId(),ct=t.useContext(Tr.PlayerKeyboardShortcutContext),h=t.useRef(null),it=t.useRef(null),ot=t.useRef(null),{resolvedDirection:ft,readDirection:dt}=kr.useResolvedDirection(h,Oe),xe=ft==="rtl",tr=Sr.useDetachedLanguage(h,lt),mt=t.useRef(Ce),U=t.useRef(null),Me=t.useRef(null),R=t.useRef(0),m=t.useRef(null),ie=t.useRef(void 0),x=t.useRef([]),oe=t.useRef(F?J:C),fe=t.useRef(!1),pt=t.useRef(!1),M=t.useRef(!1),K=t.useRef(null),$=t.useRef(null),L=t.useRef(!1),c=t.useRef(!1),E=t.useRef(null),N=t.useRef(!1),Z=t.useRef(null),we=t.useRef(0),ht=t.useRef(()=>{}),Te=t.useRef(null),de=t.useRef(null),bt=t.useRef(null),G=t.useRef(null),gt=t.useRef(0),Ie=t.useRef(!1),qe=t.useRef(!1),yt=t.useRef(ee),St=t.useRef(()=>0),kt=t.useRef(null),W=t.useRef("unknown"),[ve,b]=t.useState(C),[Ct,te]=t.useState(!1),[re,rr]=t.useState({next:!1,previous:!1}),z=ct?.ownerId??er,B=Xt&&(ct?.enabled??!0),o=l>=0?f[l]:void 0,T=o?.audioUrl,_t=o?.audioSegments,nr=_t?.length??0,j=t.useMemo(()=>Ht.getSortedAudioSegments(o),[o,nr,_t]);let Ee=kt.current;qr(f,Ee)||(Ee=Vr(f),kt.current=Ee);const xt=Ee.tracks,Ve=t.useMemo(()=>Lr.toPlayerCustomActionList(rt,nt),[nt,rt]),Mt=Ve.length+6,ur=t.useMemo(()=>({"--slide-player-mobile-control-count":String(Mt)}),[Mt]),i=t.useMemo(()=>({...xr.getSlidePlayerTexts(_e),...ut}),[_e,ut]),De=t.useMemo(()=>o?o.audioKey??`${String(o.sequenceNumber??"none")}:${String(o.audioUrl??"")}`:"none",[o]),sr=F?J:ve,wt=F?J?i.pauseAutoplayLabel:i.playAutoplayLabel:ve?i.pauseLabel:i.playLabel,Tt=Qe?i.exitFullscreenLabel:i.enterFullscreenLabel,Y=t.useCallback((e,r,n)=>({ariaKeyShortcuts:B?n:void 0,title:B?$r(e,r):e}),[B]),vt=Y(i.subtitleToggleAriaLabel,P.subtitle,"c"),Et=Y(i.previousLabel,xe?P.next:P.previous,xe?"ArrowRight":"ArrowLeft"),Lt=Y(i.previousSubtitleLabel,P.previousSubtitle,"Shift+ArrowLeft"),At=Y(wt,i.playbackShortcutLabel,"Space"),Rt=Y(i.nextLabel,xe?P.previous:P.next,xe?"ArrowLeft":"ArrowRight"),Nt=Y(i.nextSubtitleLabel,P.nextSubtitle,"Shift+ArrowRight"),jt=Y(Tt,P.fullscreen,"f"),Le=t.useCallback(()=>{B&&he.activatePlayerKeyboardShortcutOwner(z)},[z,B]),ar=t.useCallback(e=>{Le(),at?.(e)},[Le,at]),lr=t.useCallback(e=>{Le(),st?.(e)},[Le,st]);t.useEffect(()=>{ie.current=o},[o]),t.useEffect(()=>{oe.current=F?J:C},[C,J,F]),t.useEffect(()=>{We||te(!1)},[We]),t.useEffect(()=>{!mt.current&&Ce&&te(!1),mt.current=Ce},[Ce]),t.useEffect(()=>{x.current=j},[j]),t.useEffect(()=>{const e=o?.audioUrl,r=l>=0?f[l+1]?.audioUrl:void 0;$t(e),$t(r)},[f,o?.audioUrl,l]);const a=t.useCallback((e,r=null)=>{pt.current===e&&(!e||r===null)||(pt.current=e,Ge?.({loading:e,reason:e?r:null}))},[Ge]),O=t.useCallback(e=>{oe.current=e,ze?.(e)},[ze]),q=t.useCallback(()=>F?{shouldContinuePlayback:oe.current}:{shouldContinuePlayback:Er.shouldKeepPlayingAfterNavigation({defaultPlaying:oe.current,isPausedByUser:M.current})},[F]);t.useEffect(()=>{const e=it.current,r=ot.current;!e||!r||typeof e.scrollTo!="function"||e.scrollTo({behavior:"smooth",left:r.offsetLeft-e.clientWidth/2+r.clientWidth/2})},[p?.currentIndex]);const Kt=t.useCallback(e=>e instanceof DOMException?e.name==="NotAllowedError"||e.name==="SecurityError":!1,[]),V=t.useCallback(()=>C&&!_&&!M.current&&W.current!=="blocked",[C,_]),Ft=t.useCallback(e=>e?e.startsWith("data:")?e:`data:audio/mpeg;base64,${e}`:"",[]),Ut=t.useCallback(()=>{const e=m.current;return e==null||e<=0?0:x.current.slice(0,e).reduce((r,n)=>r+Math.max(Number(n.duration_ms??0),0),0)/1e3},[]),Q=t.useCallback(e=>e<=0?0:x.current.slice(0,e).reduce((r,n)=>r+Math.max(Number(n.duration_ms??0),0),0),[]),Ae=t.useCallback((e,r)=>!e||_?!1:e.audioUrl?!0:be.isPlaybackTimeCoveredBySegments(Ht.getSortedAudioSegments(e),r),[_]),me=t.useCallback((e,r,n={})=>{const u=Pt.getSubtitleCueJumpTarget({currentAudioIndex:l,currentTimeMs:r,direction:e,excludeTarget:n.excludeTarget,tracks:xt});return!u||!Ae(f[u.audioIndex],u.timeMs)||u.audioIndex!==l&&(!ke||je&&!je(u))?null:u},[f,je,Ae,l,ke,xt]),He=t.useCallback((e,r=!1)=>{const n=Math.max(Number(e),0);if(!r&&Te.current!==null&&Math.abs(n-Te.current)<Pr)return;Te.current=n;const u={previous:me("previous",n)!==null,next:me("next",n)!==null};rr(y=>y.previous===u.previous&&y.next===u.next?y:u)},[me]);t.useEffect(()=>{ht.current=He,He(we.current,!0)},[He]);const D=t.useCallback(()=>{const e=h.current;return e?K.current==="segment"?Q(R.current)+Math.max(e.currentTime,0)*1e3:E.current!==null&&e.readyState===0?E.current*1e3:Math.max(e.currentTime,0)*1e3:m.current!=null?Q(m.current):0},[Q]);t.useEffect(()=>{yt.current=ee},[ee]),t.useEffect(()=>{St.current=D},[D]);const A=t.useCallback(e=>{const r=Math.max(e,0);we.current!==r&&(we.current=r,Pt.shouldClearSubtitleCueJumpTarget({currentAudioIndex:l,currentTimeMs:r,target:de.current})&&(de.current=null),ge?.(r),ht.current(r))},[l,ge]),g=t.useCallback(()=>{A(D())},[D,A]),H=t.useCallback((e=!1,r=!1)=>{const n=Me.current;if(!ee||!n)return;const u=Date.now();!e&&u-gt.current<5e3||(gt.current=u,Ie.current=r,ee({audioKey:n,isComplete:r,timeMs:D()}))},[D,ee]);t.useEffect(()=>()=>{Ie.current||yt.current?.({audioKey:Me.current??"none",isComplete:!1,timeMs:St.current()})},[]),t.useEffect(()=>{Ie.current=!1},[l]);const k=t.useCallback(()=>{typeof window>"u"||Z.current===null||(window.cancelAnimationFrame(Z.current),Z.current=null)},[]),Wt=t.useCallback(()=>{if(typeof window>"u"||Z.current!==null)return;const e=()=>{g();const r=h.current;if(!r||r.paused||r.ended){Z.current=null;return}Z.current=window.requestAnimationFrame(e)};Z.current=window.requestAnimationFrame(e)},[g]),ne=t.useCallback(()=>{const e=h.current;e&&(k(),c.current=!1,M.current=!1,fe.current=!1,K.current=null,E.current=null,L.current=!1,N.current=!1,$.current=null,e.pause(),e.removeAttribute("src"),e.load(),U.current=null,R.current=0,m.current=null,A(0),b(!1),a(!1))},[A,k,a]),w=t.useCallback(e=>{const r=h.current;if(!r)return!1;const n=r.play();return n&&typeof n.then=="function"&&n.then(()=>{W.current==="unknown"&&(W.current="auto"),c.current=!1,N.current=!1}).catch(u=>{W.current==="unknown"&&Kt(u)&&(W.current="blocked",c.current=!1,a(!1)),N.current=!1,b(!1)}),!0},[Kt,a]),v=t.useCallback((e,r,n={})=>{const u=h.current,y=x.current[e];if(!u||!y)return!1;const X=Ft(y.audio_data),$e=Math.max(Number(n.seekTimeSeconds??0),0);R.current=e,m.current=null,L.current=!1,N.current=!0,$.current="segment",A(Q(e)+$e*1e3);const Vt=n.shouldResume??V();c.current=Vt,a(!1);const yr=U.current!==X;return K.current="segment",yr&&(u.pause(),u.removeAttribute("src"),u.load(),U.current=X,u.src=X,u.load()),E.current=$e,u.readyState>0&&(u.currentTime=$e,E.current=null),Vt?w(`start-segment:${r}`):(c.current=!1,N.current=!1,u.pause(),b(!1),!0)},[V,Ft,Q,A,w,a]),ue=t.useCallback((e,r)=>{const n=h.current;if(!n)return!1;const u=Math.max(Number(r),0)/1e3;return U.current!==e&&(n.pause(),n.removeAttribute("src"),n.load(),U.current=e,K.current="url",$.current="url",n.src=e,n.load()),E.current=u,A(u*1e3),n.readyState>0&&(n.currentTime=u,E.current=null),!0},[A]),Re=t.useCallback(e=>{const r=h.current;if(!r||!o||_)return!1;const n=Math.max(Number(e),0),u=!r.paused&&!r.ended||c.current||N.current||m.current!==null&&oe.current&&!M.current,y=be.isPlaybackTimeCoveredBySegments(x.current,n)?be.resolveSegmentSeekTarget(x.current,n):null;return Te.current=null,k(),c.current=u,a(!1),u&&(W.current="manual",M.current=!1,O(!0)),y&&(K.current==="segment"||!T)?v(y.segmentIndex,"subtitle-seek-segment",{seekTimeSeconds:y.segmentTimeSeconds,shouldResume:u}):T&&ue(T,n)?u?w("subtitle-seek-url"):(c.current=!1,r.pause(),b(!1),!0):!1},[o,T,_,ue,v,k,w,a,O]),Bt=t.useCallback(e=>{if(!h.current||!o)return!1;const n=Math.max(Number(e),0),u=be.isPlaybackTimeCoveredBySegments(x.current,n)?be.resolveSegmentSeekTarget(x.current,n):null;return c.current=!0,a(!1),u&&(K.current==="segment"||!T)?v(u.segmentIndex,"restore",{seekTimeSeconds:u.segmentTimeSeconds,shouldResume:!0}):!T||!ue(T,n)?!1:(w("restore"),!0)},[o,T,ue,v,w,a]),pe=t.useCallback(e=>{const r=me(e,D(),{excludeTarget:e==="previous"?de.current:null});if(r===null)return!1;if(r.audioIndex===l){const u=Re(r.timeMs);return u&&(de.current=r),u}const n=!!ke?.(r,Ze.suppressPlayerControlsWakeAfterNavigation(q()));return n&&(de.current=r),n},[l,D,q,me,ke,Re]),se=t.useCallback(e=>{k(),c.current=!1,L.current=!1,N.current=!1,g(),b(!1),a(!1),l>=0&&et?.(l)},[l,et,k,g,a]),Ne=t.useCallback(e=>{const r=h.current;return!r||K.current!=="url"||!wr.hasReachedAudioEnd({currentTimeSeconds:Math.max(r.currentTime,0),durationSeconds:r.duration})?!1:(c.current=!1,r.pause(),se(e),!0)},[se]),Ot=t.useCallback(()=>{const e=R.current+1,r=x.current,n=r[e],u=ie.current,y=r.some(X=>X.is_final);if(n){v(e,"ended");return}if(u?.isAudioStreaming||!y){R.current=e,m.current=e,L.current=!0,c.current=C,A(Q(e)),b(!1),a(!0,"waitingForMoreAudio");return}se("segments-completed")},[C,se,Q,A,v,a]);t.useEffect(()=>{if(Me.current===De)return;H(!0),Me.current=De,R.current=0,m.current=null,L.current=!1,M.current=!1,fe.current=!1,c.current=!1,N.current=!1,K.current=null,$.current=null,U.current=null,k(),A(0),a(!1);const e=h.current;e&&(qe.current=!0,e.pause(),e.removeAttribute("src"),e.load(),qe.current=!1,b(!1))},[l,De,j.length,T,H,A,k,a]),t.useEffect(()=>{const e=h.current;if(e){if(_){fe.current=!!(ie.current&&!M.current&&(!e.paused||c.current||m.current!==null)),c.current=!1,a(!1),e.pause(),b(!1);return}if(!(!fe.current||!ie.current||M.current)){if(fe.current=!1,m.current!==null){if(m.current<x.current.length){v(m.current,"external-resume");return}c.current=!0,a(!0,"waitingForMoreAudio");return}if(!U.current&&x.current.length>0){v(Math.min(R.current,x.current.length-1),"external-resume-init");return}e.paused&&(c.current=!0,w("external-resume"))}}},[_,v,w,a]),t.useEffect(()=>{const e=h.current;if(!e)return;if(!o){ne();return}if(S&&S.id!==G.current)return;if(_){c.current=!1,a(!1),e.pause(),b(!1);return}const r=vr.resolveAudioPlaybackSourceType({activeSourceType:K.current,hasAudioUrl:!!T,segmentCount:j.length,preferredSourceType:$.current,waitingSegmentIndex:m.current});if(r&&$.current!==r&&($.current=r),r==="url"&&T){const n=U.current!==T,u=V();if(n){const y=m.current!==null?Ut():0;ue(T,y*1e3)}if(c.current=u,L.current=!1,N.current=!1,a(!1),!u){c.current=!1,e.pause(),b(!1);return}w(n?"sync-url-init":"sync-url");return}if(r==="segment"&&m.current!==null){if(m.current<j.length){if(M.current){b(!1),a(!1);return}v(m.current,"wait-resume");return}L.current=!0,c.current=V(),b(!1),a(V());return}if(r==="segment"&&!j.length){if(o.isAudioStreaming){m.current=R.current,L.current=!0,c.current=V(),b(!1),a(V());return}ne();return}if(r==="segment"&&!U.current){v(Math.min(R.current,j.length-1),"effect-init");return}if(r!=="segment"){ne();return}if(!C||M.current){c.current=!1,e.pause(),b(!1);return}e.paused&&(c.current=!0,w("sync-paused-retry"))},[o,l,j,T,C,_,S,V,ne,ue,v,w,Ut,a]),t.useEffect(()=>{if(!I||I.id===bt.current||I.audioIndex!==l)return;const e=f[I.audioIndex];Ae(e,I.timeMs)&&(bt.current=I.id,Re(I.timeMs))},[f,Ae,l,Re,I]),t.useEffect(()=>{if(!(!S||S.id===G.current||l<0)){if(Bt(S.timeMs)){G.current=S.id,ae?.(S.id);return}o?.isAudioStreaming||(G.current=S.id,ae?.(S.id))}},[o?.isAudioStreaming,l,ae,S,Bt]),t.useEffect(()=>{if(!S||S.id===G.current||l<0||!o?.isAudioStreaming)return;const e=window.setTimeout(()=>{S.id!==G.current&&(G.current=S.id,ae?.(S.id))},Jr);return()=>{window.clearTimeout(e)}},[o?.isAudioStreaming,l,ae,S]),t.useEffect(()=>ne,[ne]),t.useEffect(()=>k,[k]);const cr=t.useCallback(()=>{g(),Wt(),b(!0),a(!1),Ye?.()},[Ye,Wt,g,a]),ir=t.useCallback(()=>{qe.current||L.current||N.current||(k(),g(),H(!0),b(!1))},[H,k,g]),or=t.useCallback(()=>{const e=h.current;e&&E.current!==null&&(e.currentTime=E.current,E.current=null),g(),!Ne("canplay-seek-finished")&&(!c.current||!C||w("canplay"))},[l,C,Ne,g,w]),fr=t.useCallback(()=>{const e=h.current;e&&E.current!==null&&(e.currentTime=E.current,E.current=null),g(),Ne("metadata-seek-finished")},[l,Ne,g]),dr=t.useCallback(()=>{g(),H()},[H,g]),mr=t.useCallback(()=>{L.current||a(!0,"loadingAudio")},[a]),pr=t.useCallback(()=>{if(L.current){a(!0,"waitingForMoreAudio");return}a(!0,"loadingAudio")},[a]),It=t.useCallback(()=>{g()},[g]),hr=t.useCallback(()=>{const e=ie.current,r=K.current==="url"||x.current.length===0,n=!!x.current[R.current+1],u=x.current.some(X=>X.is_final),y=!!e?.isAudioStreaming;if(H(!0,r||!y&&!n&&u),k(),N.current=!1,r){se("url-ended");return}Ot()},[H,se,Ot,k]),br=t.useCallback(()=>{k(),g(),b(!1),a(!1)},[k,g,a]),gr=t.useCallback(e=>{Xe?.(e),te(!1)},[Xe]),Pe=t.useCallback(()=>{if(F){const r=!J;return O(r),tt?.(r),!0}const e=h.current;return _||!e||!o?!1:m.current!==null?ve?(O(!1),c.current=!1,M.current=!0,m.current=null,L.current=!1,b(!1),a(!1),e.pause(),!0):(O(!0),W.current="manual",M.current=!1,c.current=!0,a(!0,"waitingForMoreAudio"),!0):!e.src&&j.length>0?(O(!0),W.current="manual",M.current=!1,v(Math.min(R.current,j.length-1),"toggle"),!0):e.paused?(O(!0),W.current="manual",M.current=!1,c.current=!0,w("toggle-resume"),!0):(O(!1),c.current=!1,M.current=!0,e.pause(),!0)},[o,j.length,J,_,ve,tt,v,w,a,O,F]);t.useEffect(()=>{if(B)return he.registerPlayerKeyboardShortcutOwner(z)},[z,B]);const Je=t.useMemo(()=>({fullscreen:()=>ce?(ce(),!0):!1,next:()=>Se?(Ue||Se(Ze.suppressPlayerControlsWakeAfterNavigation(q())),!0):!1,nextSubtitle:()=>re.next?pe("next"):!0,previous:()=>ye?(Fe||ye(Ze.suppressPlayerControlsWakeAfterNavigation(q())),!0):!1,previousSubtitle:()=>re.previous?pe("previous"):!0,subtitle:()=>le?(le(),!0):!1,togglePlayback:()=>(Pe(),!0)}),[q,pe,Ue,ce,Se,ye,le,Fe,re.next,re.previous,Pe]),qt=t.useRef(Je);return t.useEffect(()=>{qt.current=Je},[Je]),t.useEffect(()=>{if(!B||typeof document>"u")return;const e=r=>{if(!he.isActivePlayerKeyboardShortcutOwner(z))return;const n=he.getPlayerKeyboardShortcutAction(r,dt());if(!n||he.shouldIgnorePlayerKeyboardShortcutEvent(r,n))return;let u=!1;const y=qt.current[n];u=y(),u&&r.preventDefault()};return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}},[z,dt,B]),t.useEffect(()=>{ge?.(we.current)},[ge]),s.jsxs("div",{...Be,dir:Oe,lang:lt,"data-slide-player-shortcut-owner":z,className:Cr.cn("slide-player",p&&(p.totalSteps>1||p.isGenerating)&&"slide-player--with-slide-progress",d),onFocusCapture:lr,onPointerDown:ar,children:[s.jsx("audio",{ref:h,preload:"auto",playsInline:!0,onLoadStart:mr,onLoadedMetadata:fr,onCanPlay:or,onPlay:cr,onPause:ir,onWaiting:pr,onSeeking:It,onSeeked:It,onTimeUpdate:dr,onEnded:hr,onError:br}),We?s.jsxs(s.Fragment,{children:[s.jsx(_r.default,{container:zt,dir:Oe??ft,lang:tr,labels:{closeSettings:i.closeSettingsLabel,fullscreen:i.fullscreenLabel,nonFullscreen:i.nonFullscreenLabel,screen:i.screenLabel,screenMode:i.screenModeLabel,subtitle:i.subtitleLabel,subtitleToggle:i.subtitleToggleAriaLabel,title:i.settingsTitle},isSubtitleEnabled:Ke,onClose:()=>te(!1),onOpenChange:te,onSubtitleToggle:le??(()=>{}),onViewModeChange:gr,open:Ct,viewMode:Gt}),s.jsxs("div",{className:"slide-player__controls",onPointerEnter:Yt,onPointerLeave:Qt,style:ur,children:[s.jsxs("div",{className:"slide-player__group",children:[s.jsx("button",{"aria-expanded":Ct,"aria-haspopup":"dialog","aria-label":i.moreOptionsAriaLabel,className:"slide-player__action slide-player__action--mobile-more",onClick:()=>{te(e=>!e)},type:"button",children:s.jsx(Ar.default,{className:"slide-player__icon",strokeWidth:2.25})}),s.jsx("button",{"aria-label":i.volumeAriaLabel,className:"hidden",type:"button",children:s.jsx(Rr.default,{className:"slide-player__icon",strokeWidth:2.25})}),s.jsx("button",{"aria-label":wt,"aria-keyshortcuts":At.ariaKeyShortcuts,className:"slide-player__toggle slide-player__toggle--playback",onClick:()=>{Pe()},title:At.title,type:"button",children:sr?s.jsx(Dr,{}):s.jsx(Hr,{})}),s.jsx("button",{"aria-keyshortcuts":Et.ariaKeyShortcuts,"aria-label":i.previousLabel,className:"slide-player__action slide-player__action--prev",disabled:Fe,onClick:()=>{ye?.(q())},title:Et.title,type:"button",children:s.jsx(Nr.default,{className:"slide-player__icon",strokeWidth:2.25})}),s.jsx("button",{"aria-keyshortcuts":Rt.ariaKeyShortcuts,"aria-label":i.nextLabel,className:"slide-player__action slide-player__action--next",disabled:Ue,onClick:()=>{Se?.(q())},title:Rt.title,type:"button",children:s.jsx(jr.default,{className:"slide-player__icon",strokeWidth:2.25})}),s.jsx("button",{"aria-keyshortcuts":Lt.ariaKeyShortcuts,"aria-label":i.previousSubtitleLabel,className:"slide-player__action slide-player__action--prev-subtitle",disabled:!re.previous,onClick:()=>{pe("previous")},title:Lt.title,type:"button",children:s.jsx(Kr.default,{className:"slide-player__icon",strokeWidth:2.25})}),s.jsx("button",{"aria-keyshortcuts":Nt.ariaKeyShortcuts,"aria-label":i.nextSubtitleLabel,className:"slide-player__action slide-player__action--next-subtitle",disabled:!re.next,onClick:()=>{pe("next")},title:Nt.title,type:"button",children:s.jsx(Fr.default,{className:"slide-player__icon",strokeWidth:2.25})}),s.jsx("button",{"aria-label":i.subtitleToggleAriaLabel,"aria-keyshortcuts":vt.ariaKeyShortcuts,"aria-pressed":Ke,className:"slide-player__action slide-player__action--subtitle",onClick:le,title:vt.title,type:"button",children:Ke?s.jsx(Ur.default,{className:"slide-player__icon",strokeWidth:2.25}):s.jsx(Wr.default,{className:"slide-player__icon",strokeWidth:2.25})}),ce?s.jsx("button",{"aria-label":Tt,"aria-keyshortcuts":jt.ariaKeyShortcuts,className:"slide-player__action slide-player__action--fullscreen",onClick:ce,title:jt.title,type:"button",children:Qe?s.jsx(Br.default,{className:"slide-player__icon",strokeWidth:2.25}):s.jsx(Or.default,{className:"slide-player__icon",strokeWidth:2.25})}):null]}),Ve.length>0?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"slide-player__separator"}),s.jsx("div",{className:"slide-player__group slide-player__group--custom-actions",children:Ve.map((e,r)=>s.jsx(t.Fragment,{children:e},`custom-action-${r}`))})]}):null]}),p&&(p.totalSteps>1||p.isGenerating)?s.jsxs("div",{"aria-label":p.ariaLabel,className:"slide-player__slide-progress",role:"navigation",children:[s.jsx("div",{className:"slide-player__slide-progress-viewport",ref:it,children:s.jsx("div",{className:"slide-player__slide-progress-track",children:Array.from({length:p.totalSteps},(e,r)=>s.jsx("button",{"aria-current":r===p.currentIndex?"step":void 0,"aria-label":`${p.ariaLabel} ${r+1}`,className:"slide-player__slide-progress-segment","data-state":r<p.currentIndex?"completed":r===p.currentIndex?"current":"upcoming",onClick:()=>p.onNavigate?.(r,q()),ref:r===p.currentIndex?ot:void 0,type:"button"},r))})}),s.jsxs("span",{"aria-hidden":!p.isGenerating,className:"slide-player__slide-progress-generating","data-visible":p.isGenerating?"true":"false",children:[s.jsx(Ir.default,{"aria-hidden":"true"}),p.generatingLabel]})]}):null]}):null]})},Zt=t.memo(Zr);Zt.displayName="Player";exports.default=Zt;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("react/jsx-runtime"),t=require("react"),Vt=require("../../lib/locale.cjs"),Sr=require("../../lib/useDetachedLanguage.cjs"),kr=require("../../lib/useResolvedDirection.cjs"),Cr=require("../../lib/utils.cjs"),_r=require("./MobilePlayerSettingsSheet.cjs"),Mr=require("./slideI18n.cjs"),xr=require("./utils/mobileScreenMode.cjs"),wr=require("./utils/audioCompletion.cjs"),Tr=require("./utils/playerKeyboardShortcutContext.cjs"),pe=require("./utils/playerKeyboardShortcuts.cjs"),vr=require("./utils/playbackSource.cjs"),Ar=require("./utils/playbackPreference.cjs"),Er=require("./utils/playerCustomActions.cjs"),Ze=require("./utils/playerNavigationContext.cjs"),he=require("./utils/segmentSeek.cjs"),Ht=require("./utils/audioSegments.cjs"),Pt=require("./utils/subtitleCue.cjs");;/* empty css */const Lr=require("../../node_modules/lucide-react/dist/esm/icons/ellipsis-vertical.cjs"),Rr=require("../../node_modules/lucide-react/dist/esm/icons/volume-2.cjs"),Nr=require("../../node_modules/lucide-react/dist/esm/icons/skip-back.cjs"),jr=require("../../node_modules/lucide-react/dist/esm/icons/skip-forward.cjs"),Kr=require("../../node_modules/lucide-react/dist/esm/icons/rewind.cjs"),Ur=require("../../node_modules/lucide-react/dist/esm/icons/fast-forward.cjs"),Fr=require("../../node_modules/lucide-react/dist/esm/icons/captions.cjs"),Wr=require("../../node_modules/lucide-react/dist/esm/icons/captions-off.cjs"),Br=require("../../node_modules/lucide-react/dist/esm/icons/scan-line.cjs"),Or=require("../../node_modules/lucide-react/dist/esm/icons/maximize.cjs"),Ir=require("../../node_modules/lucide-react/dist/esm/icons/loader-circle.cjs"),Jt=new Map,$t=f=>{if(typeof window>"u"||!f||Jt.has(f))return;const d=window.document.createElement("audio");d.preload="auto",d.setAttribute("playsinline","true"),d.src=f,d.load(),Jt.set(f,d)},qr=(f,d)=>d!==null&&d.audioList===f&&d.subtitleCueLists.length===f.length&&f.every((l,C)=>{const _=l.element?.subtitle_cues;return d.subtitleCueLists[C]===_&&d.subtitleCueLengths[C]===(_?.length??0)}),Dr=f=>{const d=f.map(l=>l.element?.subtitle_cues);return{audioList:f,subtitleCueLists:d,subtitleCueLengths:d.map(l=>l?.length??0),tracks:d.map(l=>({subtitleCues:l??[]}))}},Vr=()=>s.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"34",height:"34",viewBox:"0 0 34 34",fill:"none",children:[s.jsx("path",{d:"M16.6667 33.3333C25.8714 33.3333 33.3333 25.8714 33.3333 16.6667C33.3333 7.46192 25.8714 0 16.6667 0C7.46192 0 0 7.46192 0 16.6667C0 25.8714 7.46192 33.3333 16.6667 33.3333Z",fill:"#0A0A0A"}),s.jsx("path",{d:"M12 10H16V24H12V10ZM18 10H22V24H18V10Z",fill:"white"})]}),Hr=()=>s.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"34",height:"34",viewBox:"0 0 34 34",fill:"none",children:[s.jsx("path",{d:"M16.6667 33.3333C25.8714 33.3333 33.3333 25.8714 33.3333 16.6667C33.3333 7.46192 25.8714 0 16.6667 0C7.46192 0 0 7.46192 0 16.6667C0 25.8714 7.46192 33.3333 16.6667 33.3333Z",fill:"#0A0A0A"}),s.jsx("path",{d:"M13.3333 10L23.3333 16.6667L13.3333 23.3333V10Z",fill:"white"})]}),Ne={fullscreen:"F",nextSubtitle:"Shift+→",previousSubtitle:"Shift+←",subtitle:"C"},Pr=250,Jr=15e3,$r=(f,d)=>f?`${f} (${d})`:d,Zr=({audioList:f=[],className:d,currentAudioIndex:l=-1,defaultPlaying:C=!0,isPlaybackPaused:_=!1,isAutoAdvanceEnabled:P=!0,useAutoAdvanceToggle:U=!1,onLoadingChange:Ge,onPlaybackPreferenceChange:ze,onPlaybackStarted:Ye,onPlaybackTimeChange:be,onPlaybackCheckpoint:X,playbackRestoreRequest:S=null,onPlaybackRestoreComplete:se,onSubtitleToggle:ae,onPrev:ge,onNext:ye,onSubtitleJump:Se,canJumpToSubtitleTarget:je,onFullscreen:le,isFullscreen:Qe=!1,mobileViewMode:Gt=xr.DEFAULT_MOBILE_VIEW_MODE,settingsPortalContainer:zt,onMobileViewModeChange:Xe,onEnded:et,onAutoAdvanceToggle:tt,onInteractionToggle:Gr,hasInteraction:zr,isInteractionOpen:ke=!1,isSubtitleEnabled:Ke=!0,prevDisabled:Ue=!1,nextDisabled:Fe=!1,showControls:We=!0,onControlsPointerEnter:Yt,onControlsPointerLeave:Qt,slideProgress:p=null,enableKeyboardShortcuts:Xt=!0,subtitleSeekRequest:I=null,customActions:rt,customActionContext:nt,locale:Ce,texts:ut,onFocusCapture:st,onPointerDown:at,...Be})=>{const Oe=Be.dir??Vt.getMarkdownFlowDirection(Ce),lt=Be.lang??Vt.getMarkdownFlowLanguage(Ce),er=t.useId(),ct=t.useContext(Tr.PlayerKeyboardShortcutContext),h=t.useRef(null),it=t.useRef(null),ot=t.useRef(null),{resolvedDirection:ft,readDirection:dt}=kr.useResolvedDirection(h,Oe),_e=ft==="rtl",tr=Sr.useDetachedLanguage(h,lt),mt=t.useRef(ke),F=t.useRef(null),Me=t.useRef(null),R=t.useRef(0),m=t.useRef(null),ce=t.useRef(void 0),M=t.useRef([]),ie=t.useRef(U?P:C),oe=t.useRef(!1),pt=t.useRef(!1),x=t.useRef(!1),K=t.useRef(null),J=t.useRef(null),E=t.useRef(!1),c=t.useRef(!1),A=t.useRef(null),N=t.useRef(!1),$=t.useRef(null),xe=t.useRef(0),ht=t.useRef(()=>{}),we=t.useRef(null),fe=t.useRef(null),bt=t.useRef(null),Z=t.useRef(null),gt=t.useRef(0),Ie=t.useRef(!1),qe=t.useRef(!1),yt=t.useRef(X),St=t.useRef(()=>0),kt=t.useRef(null),W=t.useRef("unknown"),[Te,b]=t.useState(C),[Ct,ee]=t.useState(!1),[te,rr]=t.useState({next:!1,previous:!1}),G=ct?.ownerId??er,B=Xt&&(ct?.enabled??!0),o=l>=0?f[l]:void 0,T=o?.audioUrl,_t=o?.audioSegments,nr=_t?.length??0,j=t.useMemo(()=>Ht.getSortedAudioSegments(o),[o,nr,_t]);let ve=kt.current;qr(f,ve)||(ve=Dr(f),kt.current=ve);const Mt=ve.tracks,De=t.useMemo(()=>Er.toPlayerCustomActionList(rt,nt),[nt,rt]),xt=De.length+6,ur=t.useMemo(()=>({"--slide-player-mobile-control-count":String(xt)}),[xt]),i=t.useMemo(()=>({...Mr.getSlidePlayerTexts(Ce),...ut}),[Ce,ut]),Ve=t.useMemo(()=>o?o.audioKey??`${String(o.sequenceNumber??"none")}:${String(o.audioUrl??"")}`:"none",[o]),sr=U?P:Te,wt=U?P?i.pauseAutoplayLabel:i.playAutoplayLabel:Te?i.pauseLabel:i.playLabel,Tt=Qe?i.exitFullscreenLabel:i.enterFullscreenLabel,z=t.useCallback((e,r,n)=>({ariaKeyShortcuts:B?n:void 0,title:B?$r(e,r):e}),[B]),vt=z(i.subtitleToggleAriaLabel,Ne.subtitle,"c"),At=z(i.previousLabel,_e?"→ / ↑":"← / ↑",_e?"ArrowRight ArrowUp":"ArrowLeft ArrowUp"),Et=z(i.previousSubtitleLabel,Ne.previousSubtitle,"Shift+ArrowLeft"),Lt=z(wt,i.playbackShortcutLabel,"Space"),Rt=z(i.nextLabel,_e?"← / ↓":"→ / ↓",_e?"ArrowLeft ArrowDown":"ArrowRight ArrowDown"),Nt=z(i.nextSubtitleLabel,Ne.nextSubtitle,"Shift+ArrowRight"),jt=z(Tt,Ne.fullscreen,"f"),Ae=t.useCallback(()=>{B&&pe.activatePlayerKeyboardShortcutOwner(G)},[G,B]),ar=t.useCallback(e=>{Ae(),at?.(e)},[Ae,at]),lr=t.useCallback(e=>{Ae(),st?.(e)},[Ae,st]);t.useEffect(()=>{ce.current=o},[o]),t.useEffect(()=>{ie.current=U?P:C},[C,P,U]),t.useEffect(()=>{We||ee(!1)},[We]),t.useEffect(()=>{!mt.current&&ke&&ee(!1),mt.current=ke},[ke]),t.useEffect(()=>{M.current=j},[j]),t.useEffect(()=>{const e=o?.audioUrl,r=l>=0?f[l+1]?.audioUrl:void 0;$t(e),$t(r)},[f,o?.audioUrl,l]);const a=t.useCallback((e,r=null)=>{pt.current===e&&(!e||r===null)||(pt.current=e,Ge?.({loading:e,reason:e?r:null}))},[Ge]),O=t.useCallback(e=>{ie.current=e,ze?.(e)},[ze]),q=t.useCallback(()=>U?{shouldContinuePlayback:ie.current}:{shouldContinuePlayback:Ar.shouldKeepPlayingAfterNavigation({defaultPlaying:ie.current,isPausedByUser:x.current})},[U]);t.useEffect(()=>{const e=it.current,r=ot.current;!e||!r||typeof e.scrollTo!="function"||e.scrollTo({behavior:"smooth",left:r.offsetLeft-e.clientWidth/2+r.clientWidth/2})},[p?.currentIndex]);const Kt=t.useCallback(e=>e instanceof DOMException?e.name==="NotAllowedError"||e.name==="SecurityError":!1,[]),D=t.useCallback(()=>C&&!_&&!x.current&&W.current!=="blocked",[C,_]),Ut=t.useCallback(e=>e?e.startsWith("data:")?e:`data:audio/mpeg;base64,${e}`:"",[]),Ft=t.useCallback(()=>{const e=m.current;return e==null||e<=0?0:M.current.slice(0,e).reduce((r,n)=>r+Math.max(Number(n.duration_ms??0),0),0)/1e3},[]),Y=t.useCallback(e=>e<=0?0:M.current.slice(0,e).reduce((r,n)=>r+Math.max(Number(n.duration_ms??0),0),0),[]),Ee=t.useCallback((e,r)=>!e||_?!1:e.audioUrl?!0:he.isPlaybackTimeCoveredBySegments(Ht.getSortedAudioSegments(e),r),[_]),de=t.useCallback((e,r,n={})=>{const u=Pt.getSubtitleCueJumpTarget({currentAudioIndex:l,currentTimeMs:r,direction:e,excludeTarget:n.excludeTarget,tracks:Mt});return!u||!Ee(f[u.audioIndex],u.timeMs)||u.audioIndex!==l&&(!Se||je&&!je(u))?null:u},[f,je,Ee,l,Se,Mt]),He=t.useCallback((e,r=!1)=>{const n=Math.max(Number(e),0);if(!r&&we.current!==null&&Math.abs(n-we.current)<Pr)return;we.current=n;const u={previous:de("previous",n)!==null,next:de("next",n)!==null};rr(y=>y.previous===u.previous&&y.next===u.next?y:u)},[de]);t.useEffect(()=>{ht.current=He,He(xe.current,!0)},[He]);const V=t.useCallback(()=>{const e=h.current;return e?K.current==="segment"?Y(R.current)+Math.max(e.currentTime,0)*1e3:A.current!==null&&e.readyState===0?A.current*1e3:Math.max(e.currentTime,0)*1e3:m.current!=null?Y(m.current):0},[Y]);t.useEffect(()=>{yt.current=X},[X]),t.useEffect(()=>{St.current=V},[V]);const L=t.useCallback(e=>{const r=Math.max(e,0);xe.current!==r&&(xe.current=r,Pt.shouldClearSubtitleCueJumpTarget({currentAudioIndex:l,currentTimeMs:r,target:fe.current})&&(fe.current=null),be?.(r),ht.current(r))},[l,be]),g=t.useCallback(()=>{L(V())},[V,L]),H=t.useCallback((e=!1,r=!1)=>{const n=Me.current;if(!X||!n)return;const u=Date.now();!e&&u-gt.current<5e3||(gt.current=u,Ie.current=r,X({audioKey:n,isComplete:r,timeMs:V()}))},[V,X]);t.useEffect(()=>()=>{Ie.current||yt.current?.({audioKey:Me.current??"none",isComplete:!1,timeMs:St.current()})},[]),t.useEffect(()=>{Ie.current=!1},[l]);const k=t.useCallback(()=>{typeof window>"u"||$.current===null||(window.cancelAnimationFrame($.current),$.current=null)},[]),Wt=t.useCallback(()=>{if(typeof window>"u"||$.current!==null)return;const e=()=>{g();const r=h.current;if(!r||r.paused||r.ended){$.current=null;return}$.current=window.requestAnimationFrame(e)};$.current=window.requestAnimationFrame(e)},[g]),re=t.useCallback(()=>{const e=h.current;e&&(k(),c.current=!1,x.current=!1,oe.current=!1,K.current=null,A.current=null,E.current=!1,N.current=!1,J.current=null,e.pause(),e.removeAttribute("src"),e.load(),F.current=null,R.current=0,m.current=null,L(0),b(!1),a(!1))},[L,k,a]),w=t.useCallback(e=>{const r=h.current;if(!r)return!1;const n=r.play();return n&&typeof n.then=="function"&&n.then(()=>{W.current==="unknown"&&(W.current="auto"),c.current=!1,N.current=!1}).catch(u=>{W.current==="unknown"&&Kt(u)&&(W.current="blocked",c.current=!1,a(!1)),N.current=!1,b(!1)}),!0},[Kt,a]),v=t.useCallback((e,r,n={})=>{const u=h.current,y=M.current[e];if(!u||!y)return!1;const Q=Ut(y.audio_data),$e=Math.max(Number(n.seekTimeSeconds??0),0);R.current=e,m.current=null,E.current=!1,N.current=!0,J.current="segment",L(Y(e)+$e*1e3);const Dt=n.shouldResume??D();c.current=Dt,a(!1);const yr=F.current!==Q;return K.current="segment",yr&&(u.pause(),u.removeAttribute("src"),u.load(),F.current=Q,u.src=Q,u.load()),A.current=$e,u.readyState>0&&(u.currentTime=$e,A.current=null),Dt?w(`start-segment:${r}`):(c.current=!1,N.current=!1,u.pause(),b(!1),!0)},[D,Ut,Y,L,w,a]),ne=t.useCallback((e,r)=>{const n=h.current;if(!n)return!1;const u=Math.max(Number(r),0)/1e3;return F.current!==e&&(n.pause(),n.removeAttribute("src"),n.load(),F.current=e,K.current="url",J.current="url",n.src=e,n.load()),A.current=u,L(u*1e3),n.readyState>0&&(n.currentTime=u,A.current=null),!0},[L]),Le=t.useCallback(e=>{const r=h.current;if(!r||!o||_)return!1;const n=Math.max(Number(e),0),u=!r.paused&&!r.ended||c.current||N.current||m.current!==null&&ie.current&&!x.current,y=he.isPlaybackTimeCoveredBySegments(M.current,n)?he.resolveSegmentSeekTarget(M.current,n):null;return we.current=null,k(),c.current=u,a(!1),u&&(W.current="manual",x.current=!1,O(!0)),y&&(K.current==="segment"||!T)?v(y.segmentIndex,"subtitle-seek-segment",{seekTimeSeconds:y.segmentTimeSeconds,shouldResume:u}):T&&ne(T,n)?u?w("subtitle-seek-url"):(c.current=!1,r.pause(),b(!1),!0):!1},[o,T,_,ne,v,k,w,a,O]),Bt=t.useCallback(e=>{if(!h.current||!o)return!1;const n=Math.max(Number(e),0),u=he.isPlaybackTimeCoveredBySegments(M.current,n)?he.resolveSegmentSeekTarget(M.current,n):null;return c.current=!0,a(!1),u&&(K.current==="segment"||!T)?v(u.segmentIndex,"restore",{seekTimeSeconds:u.segmentTimeSeconds,shouldResume:!0}):!T||!ne(T,n)?!1:(w("restore"),!0)},[o,T,ne,v,w,a]),me=t.useCallback(e=>{const r=de(e,V(),{excludeTarget:e==="previous"?fe.current:null});if(r===null)return!1;if(r.audioIndex===l){const u=Le(r.timeMs);return u&&(fe.current=r),u}const n=!!Se?.(r,Ze.suppressPlayerControlsWakeAfterNavigation(q()));return n&&(fe.current=r),n},[l,V,q,de,Se,Le]),ue=t.useCallback(e=>{k(),c.current=!1,E.current=!1,N.current=!1,g(),b(!1),a(!1),l>=0&&et?.(l)},[l,et,k,g,a]),Re=t.useCallback(e=>{const r=h.current;return!r||K.current!=="url"||!wr.hasReachedAudioEnd({currentTimeSeconds:Math.max(r.currentTime,0),durationSeconds:r.duration})?!1:(c.current=!1,r.pause(),ue(e),!0)},[ue]),Ot=t.useCallback(()=>{const e=R.current+1,r=M.current,n=r[e],u=ce.current,y=r.some(Q=>Q.is_final);if(n){v(e,"ended");return}if(u?.isAudioStreaming||!y){R.current=e,m.current=e,E.current=!0,c.current=C,L(Y(e)),b(!1),a(!0,"waitingForMoreAudio");return}ue("segments-completed")},[C,ue,Y,L,v,a]);t.useEffect(()=>{if(Me.current===Ve)return;H(!0),Me.current=Ve,R.current=0,m.current=null,E.current=!1,x.current=!1,oe.current=!1,c.current=!1,N.current=!1,K.current=null,J.current=null,F.current=null,k(),L(0),a(!1);const e=h.current;e&&(qe.current=!0,e.pause(),e.removeAttribute("src"),e.load(),qe.current=!1,b(!1))},[l,Ve,j.length,T,H,L,k,a]),t.useEffect(()=>{const e=h.current;if(e){if(_){oe.current=!!(ce.current&&!x.current&&(!e.paused||c.current||m.current!==null)),c.current=!1,a(!1),e.pause(),b(!1);return}if(!(!oe.current||!ce.current||x.current)){if(oe.current=!1,m.current!==null){if(m.current<M.current.length){v(m.current,"external-resume");return}c.current=!0,a(!0,"waitingForMoreAudio");return}if(!F.current&&M.current.length>0){v(Math.min(R.current,M.current.length-1),"external-resume-init");return}e.paused&&(c.current=!0,w("external-resume"))}}},[_,v,w,a]),t.useEffect(()=>{const e=h.current;if(!e)return;if(!o){re();return}if(S&&S.id!==Z.current)return;if(_){c.current=!1,a(!1),e.pause(),b(!1);return}const r=vr.resolveAudioPlaybackSourceType({activeSourceType:K.current,hasAudioUrl:!!T,segmentCount:j.length,preferredSourceType:J.current,waitingSegmentIndex:m.current});if(r&&J.current!==r&&(J.current=r),r==="url"&&T){const n=F.current!==T,u=D();if(n){const y=m.current!==null?Ft():0;ne(T,y*1e3)}if(c.current=u,E.current=!1,N.current=!1,a(!1),!u){c.current=!1,e.pause(),b(!1);return}w(n?"sync-url-init":"sync-url");return}if(r==="segment"&&m.current!==null){if(m.current<j.length){if(x.current){b(!1),a(!1);return}v(m.current,"wait-resume");return}E.current=!0,c.current=D(),b(!1),a(D());return}if(r==="segment"&&!j.length){if(o.isAudioStreaming){m.current=R.current,E.current=!0,c.current=D(),b(!1),a(D());return}re();return}if(r==="segment"&&!F.current){v(Math.min(R.current,j.length-1),"effect-init");return}if(r!=="segment"){re();return}if(!C||x.current){c.current=!1,e.pause(),b(!1);return}e.paused&&(c.current=!0,w("sync-paused-retry"))},[o,l,j,T,C,_,S,D,re,ne,v,w,Ft,a]),t.useEffect(()=>{if(!I||I.id===bt.current||I.audioIndex!==l)return;const e=f[I.audioIndex];Ee(e,I.timeMs)&&(bt.current=I.id,Le(I.timeMs))},[f,Ee,l,Le,I]),t.useEffect(()=>{if(!(!S||S.id===Z.current||l<0)){if(Bt(S.timeMs)){Z.current=S.id,se?.(S.id);return}o?.isAudioStreaming||(Z.current=S.id,se?.(S.id))}},[o?.isAudioStreaming,l,se,S,Bt]),t.useEffect(()=>{if(!S||S.id===Z.current||l<0||!o?.isAudioStreaming)return;const e=window.setTimeout(()=>{S.id!==Z.current&&(Z.current=S.id,se?.(S.id))},Jr);return()=>{window.clearTimeout(e)}},[o?.isAudioStreaming,l,se,S]),t.useEffect(()=>re,[re]),t.useEffect(()=>k,[k]);const cr=t.useCallback(()=>{g(),Wt(),b(!0),a(!1),Ye?.()},[Ye,Wt,g,a]),ir=t.useCallback(()=>{qe.current||E.current||N.current||(k(),g(),H(!0),b(!1))},[H,k,g]),or=t.useCallback(()=>{const e=h.current;e&&A.current!==null&&(e.currentTime=A.current,A.current=null),g(),!Re("canplay-seek-finished")&&(!c.current||!C||w("canplay"))},[l,C,Re,g,w]),fr=t.useCallback(()=>{const e=h.current;e&&A.current!==null&&(e.currentTime=A.current,A.current=null),g(),Re("metadata-seek-finished")},[l,Re,g]),dr=t.useCallback(()=>{g(),H()},[H,g]),mr=t.useCallback(()=>{E.current||a(!0,"loadingAudio")},[a]),pr=t.useCallback(()=>{if(E.current){a(!0,"waitingForMoreAudio");return}a(!0,"loadingAudio")},[a]),It=t.useCallback(()=>{g()},[g]),hr=t.useCallback(()=>{const e=ce.current,r=K.current==="url"||M.current.length===0,n=!!M.current[R.current+1],u=M.current.some(Q=>Q.is_final),y=!!e?.isAudioStreaming;if(H(!0,r||!y&&!n&&u),k(),N.current=!1,r){ue("url-ended");return}Ot()},[H,ue,Ot,k]),br=t.useCallback(()=>{k(),g(),b(!1),a(!1)},[k,g,a]),gr=t.useCallback(e=>{Xe?.(e),ee(!1)},[Xe]),Pe=t.useCallback(()=>{if(U){const r=!P;return O(r),tt?.(r),!0}const e=h.current;return _||!e||!o?!1:m.current!==null?Te?(O(!1),c.current=!1,x.current=!0,m.current=null,E.current=!1,b(!1),a(!1),e.pause(),!0):(O(!0),W.current="manual",x.current=!1,c.current=!0,a(!0,"waitingForMoreAudio"),!0):!e.src&&j.length>0?(O(!0),W.current="manual",x.current=!1,v(Math.min(R.current,j.length-1),"toggle"),!0):e.paused?(O(!0),W.current="manual",x.current=!1,c.current=!0,w("toggle-resume"),!0):(O(!1),c.current=!1,x.current=!0,e.pause(),!0)},[o,j.length,P,_,Te,tt,v,w,a,O,U]);t.useEffect(()=>{if(B)return pe.registerPlayerKeyboardShortcutOwner(G)},[G,B]);const Je=t.useMemo(()=>({fullscreen:()=>le?(le(),!0):!1,next:()=>ye?(Fe||ye(Ze.suppressPlayerControlsWakeAfterNavigation(q())),!0):!1,nextSubtitle:()=>te.next?me("next"):!0,previous:()=>ge?(Ue||ge(Ze.suppressPlayerControlsWakeAfterNavigation(q())),!0):!1,previousSubtitle:()=>te.previous?me("previous"):!0,subtitle:()=>ae?(ae(),!0):!1,togglePlayback:()=>(Pe(),!0)}),[q,me,Fe,le,ye,ge,ae,Ue,te.next,te.previous,Pe]),qt=t.useRef(Je);return t.useEffect(()=>{qt.current=Je},[Je]),t.useEffect(()=>{if(!B||typeof document>"u")return;const e=r=>{if(!pe.isActivePlayerKeyboardShortcutOwner(G))return;const n=pe.getPlayerKeyboardShortcutAction(r,dt());if(!n||pe.shouldIgnorePlayerKeyboardShortcutEvent(r,n))return;let u=!1;const y=qt.current[n];u=y(),u&&r.preventDefault()};return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}},[G,dt,B]),t.useEffect(()=>{be?.(xe.current)},[be]),s.jsxs("div",{...Be,dir:Oe,lang:lt,"data-slide-player-shortcut-owner":G,className:Cr.cn("slide-player",p&&(p.totalSteps>1||p.isGenerating)&&"slide-player--with-slide-progress",d),onFocusCapture:lr,onPointerDown:ar,children:[s.jsx("audio",{ref:h,preload:"auto",playsInline:!0,onLoadStart:mr,onLoadedMetadata:fr,onCanPlay:or,onPlay:cr,onPause:ir,onWaiting:pr,onSeeking:It,onSeeked:It,onTimeUpdate:dr,onEnded:hr,onError:br}),We?s.jsxs(s.Fragment,{children:[s.jsx(_r.default,{container:zt,dir:Oe??ft,lang:tr,labels:{closeSettings:i.closeSettingsLabel,fullscreen:i.fullscreenLabel,nonFullscreen:i.nonFullscreenLabel,screen:i.screenLabel,screenMode:i.screenModeLabel,subtitle:i.subtitleLabel,subtitleToggle:i.subtitleToggleAriaLabel,title:i.settingsTitle},isSubtitleEnabled:Ke,onClose:()=>ee(!1),onOpenChange:ee,onSubtitleToggle:ae??(()=>{}),onViewModeChange:gr,open:Ct,viewMode:Gt}),s.jsxs("div",{className:"slide-player__controls",onPointerEnter:Yt,onPointerLeave:Qt,style:ur,children:[s.jsxs("div",{className:"slide-player__group",children:[s.jsx("button",{"aria-expanded":Ct,"aria-haspopup":"dialog","aria-label":i.moreOptionsAriaLabel,className:"slide-player__action slide-player__action--mobile-more",onClick:()=>{ee(e=>!e)},type:"button",children:s.jsx(Lr.default,{className:"slide-player__icon",strokeWidth:2.25})}),s.jsx("button",{"aria-label":i.volumeAriaLabel,className:"hidden",type:"button",children:s.jsx(Rr.default,{className:"slide-player__icon",strokeWidth:2.25})}),s.jsx("button",{"aria-label":wt,"aria-keyshortcuts":Lt.ariaKeyShortcuts,className:"slide-player__toggle slide-player__toggle--playback",onClick:()=>{Pe()},title:Lt.title,type:"button",children:sr?s.jsx(Vr,{}):s.jsx(Hr,{})}),s.jsx("button",{"aria-keyshortcuts":At.ariaKeyShortcuts,"aria-label":i.previousLabel,className:"slide-player__action slide-player__action--prev",disabled:Ue,onClick:()=>{ge?.(q())},title:At.title,type:"button",children:s.jsx(Nr.default,{className:"slide-player__icon",strokeWidth:2.25})}),s.jsx("button",{"aria-keyshortcuts":Rt.ariaKeyShortcuts,"aria-label":i.nextLabel,className:"slide-player__action slide-player__action--next",disabled:Fe,onClick:()=>{ye?.(q())},title:Rt.title,type:"button",children:s.jsx(jr.default,{className:"slide-player__icon",strokeWidth:2.25})}),s.jsx("button",{"aria-keyshortcuts":Et.ariaKeyShortcuts,"aria-label":i.previousSubtitleLabel,className:"slide-player__action slide-player__action--prev-subtitle",disabled:!te.previous,onClick:()=>{me("previous")},title:Et.title,type:"button",children:s.jsx(Kr.default,{className:"slide-player__icon",strokeWidth:2.25})}),s.jsx("button",{"aria-keyshortcuts":Nt.ariaKeyShortcuts,"aria-label":i.nextSubtitleLabel,className:"slide-player__action slide-player__action--next-subtitle",disabled:!te.next,onClick:()=>{me("next")},title:Nt.title,type:"button",children:s.jsx(Ur.default,{className:"slide-player__icon",strokeWidth:2.25})}),s.jsx("button",{"aria-label":i.subtitleToggleAriaLabel,"aria-keyshortcuts":vt.ariaKeyShortcuts,"aria-pressed":Ke,className:"slide-player__action slide-player__action--subtitle",onClick:ae,title:vt.title,type:"button",children:Ke?s.jsx(Fr.default,{className:"slide-player__icon",strokeWidth:2.25}):s.jsx(Wr.default,{className:"slide-player__icon",strokeWidth:2.25})}),le?s.jsx("button",{"aria-label":Tt,"aria-keyshortcuts":jt.ariaKeyShortcuts,className:"slide-player__action slide-player__action--fullscreen",onClick:le,title:jt.title,type:"button",children:Qe?s.jsx(Br.default,{className:"slide-player__icon",strokeWidth:2.25}):s.jsx(Or.default,{className:"slide-player__icon",strokeWidth:2.25})}):null]}),De.length>0?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"slide-player__separator"}),s.jsx("div",{className:"slide-player__group slide-player__group--custom-actions",children:De.map((e,r)=>s.jsx(t.Fragment,{children:e},`custom-action-${r}`))})]}):null]}),p&&(p.totalSteps>1||p.isGenerating)?s.jsxs("div",{"aria-label":p.ariaLabel,className:"slide-player__slide-progress",role:"navigation",children:[s.jsx("div",{className:"slide-player__slide-progress-viewport",ref:it,children:s.jsx("div",{className:"slide-player__slide-progress-track",children:Array.from({length:p.totalSteps},(e,r)=>s.jsx("button",{"aria-current":r===p.currentIndex?"step":void 0,"aria-label":`${p.ariaLabel} ${r+1}`,className:"slide-player__slide-progress-segment","data-state":r<p.currentIndex?"completed":r===p.currentIndex?"current":"upcoming",onClick:()=>p.onNavigate?.(r,q()),ref:r===p.currentIndex?ot:void 0,type:"button"},r))})}),s.jsxs("span",{"aria-hidden":!p.isGenerating,className:"slide-player__slide-progress-generating","data-visible":p.isGenerating?"true":"false",children:[s.jsx(Ir.default,{"aria-hidden":"true"}),p.generatingLabel]})]}):null]}):null]})},Zt=t.memo(Zr);Zt.displayName="Player";exports.default=Zt;
2
2
  //# sourceMappingURL=Player.cjs.map