markdown-flow-ui 0.2.5 → 0.2.7-dev.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/index.cjs8.js +1 -1
- package/dist/_virtual/index.cjs9.js +1 -1
- package/dist/_virtual/index.es8.js +2 -2
- package/dist/_virtual/index.es9.js +2 -2
- package/dist/assets/markdown-flow-ui.css +1 -1
- package/dist/components/ContentRender/CodeBlock.cjs.js.map +1 -1
- package/dist/components/ContentRender/CodeBlock.d.ts +1 -1
- package/dist/components/ContentRender/CodeBlock.es.js.map +1 -1
- package/dist/components/ContentRender/ContentRender.cjs.js +2 -2
- package/dist/components/ContentRender/ContentRender.cjs.js.map +1 -1
- package/dist/components/ContentRender/ContentRender.es.js +212 -191
- package/dist/components/ContentRender/ContentRender.es.js.map +1 -1
- package/dist/components/ContentRender/plugins/CustomVariable.cjs.js +1 -1
- package/dist/components/ContentRender/plugins/CustomVariable.cjs.js.map +1 -1
- package/dist/components/ContentRender/plugins/CustomVariable.es.js +49 -43
- package/dist/components/ContentRender/plugins/CustomVariable.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/locales/en-US.json.d.ts +70 -0
- package/dist/components/MarkdownFlowEditor/locales/fr-FR.json.d.ts +70 -0
- package/dist/components/MarkdownFlowEditor/locales/zh-CN.json.d.ts +70 -0
- package/dist/components/Slide/Slide.cjs.js +1 -1
- package/dist/components/Slide/Slide.cjs.js.map +1 -1
- package/dist/components/Slide/Slide.es.js +258 -254
- package/dist/components/Slide/Slide.es.js.map +1 -1
- package/dist/components/Slide/diff-utils.cjs.js +4 -4
- package/dist/components/Slide/diff-utils.cjs.js.map +1 -1
- package/dist/components/Slide/diff-utils.es.js +49 -49
- package/dist/components/Slide/diff-utils.es.js.map +1 -1
- package/dist/components/Slide/types.d.ts +1 -0
- package/dist/components/ui/inputGroup/input-group.cjs.js +1 -1
- package/dist/components/ui/inputGroup/input-group.cjs.js.map +1 -1
- package/dist/components/ui/inputGroup/input-group.d.ts +21 -1
- package/dist/components/ui/inputGroup/input-group.es.js +19 -17
- package/dist/components/ui/inputGroup/input-group.es.js.map +1 -1
- package/dist/components/ui/inputGroup/textarea.cjs.js.map +1 -1
- package/dist/components/ui/inputGroup/textarea.d.ts +2 -1
- package/dist/components/ui/inputGroup/textarea.es.js.map +1 -1
- package/dist/lib/mobileDevice.cjs.js +1 -1
- package/dist/lib/mobileDevice.cjs.js.map +1 -1
- package/dist/lib/mobileDevice.d.ts +1 -3
- package/dist/lib/mobileDevice.es.js +29 -38
- package/dist/lib/mobileDevice.es.js.map +1 -1
- package/dist/markdown-flow-ui-lib.css +1 -1
- package/dist/node_modules/@braintree/sanitize-url/dist/index.cjs.js +1 -1
- package/dist/node_modules/@braintree/sanitize-url/dist/index.es.js +1 -1
- package/dist/node_modules/classnames/index.cjs.js +1 -1
- package/dist/node_modules/classnames/index.es.js +1 -1
- package/package.json +1 -1
- package/dist/components/ContentRender/ContentRender.stories.d.ts +0 -37
- package/dist/components/ContentRender/MarkdownFlowInput.stories.d.ts +0 -33
- package/dist/components/MarkdownFlow/MarkdownFlow.stories.d.ts +0 -31
- package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.stories.d.ts +0 -64
- package/dist/components/Slide/Slide.stories.d.ts +0 -2590
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomVariable.es.js","sources":["../../../../src/components/ContentRender/plugins/CustomVariable.tsx"],"sourcesContent":["import React from \"react\";\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 {\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 node: CustomVariableNode;\n defaultButtonText?: string;\n defaultInputText?: string;\n defaultSelectedValues?: string[];\n locale?: MarkdownFlowLocale;\n readonly?: boolean;\n onSend?: (content: OnSendContentParams) => 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 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}\n\nconst SingleSelectSection = ({\n node,\n readonly,\n locale,\n resolvedDefaultButtonText,\n handleButtonClick,\n inputValue,\n handleInputChange,\n handleSendClick,\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-left 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 disabled={readonly}\n locale={locale}\n placeholder={node.properties.placeholder}\n value={inputValue}\n onChange={handleInputChange}\n onSend={handleSendClick}\n title={node.properties.placeholder}\n />\n </span>\n )}\n </span>\n);\n\n// Pure input\ninterface InputSectionProps {\n readonly?: boolean;\n locale?: MarkdownFlowLocale;\n placeholder?: string;\n value: string;\n onChange: (event: React.ChangeEvent<HTMLTextAreaElement>) => void;\n onSend: () => void;\n}\n\nconst InputSection = ({\n readonly,\n locale,\n placeholder,\n value,\n onChange,\n onSend,\n}: InputSectionProps) => {\n if (!placeholder) {\n return null;\n }\n\n return (\n <MarkdownFlowInput\n disabled={readonly}\n locale={locale}\n placeholder={placeholder}\n value={value}\n onChange={onChange}\n onSend={onSend}\n title={placeholder}\n />\n );\n};\n\n// Define custom variable component\nconst CustomButtonInputVariable = ({\n node,\n readonly,\n locale,\n defaultButtonText,\n defaultInputText,\n defaultSelectedValues,\n onSend,\n confirmButtonText,\n beforeSend = () => true,\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 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 node.properties?.variableName?.trim() ||\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 handleKeyDown = (e: React.KeyboardEvent<HTMLTextAreaElement>) => {\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, node]);\n\n React.useEffect(() => {\n setSelectedValues(defaultSelectedValues || []);\n }, [defaultSelectedValues, node]);\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 node={singleSelectNode}\n readonly={readonly}\n locale={locale}\n resolvedDefaultButtonText={resolvedDefaultButtonText}\n handleButtonClick={handleButtonClick}\n inputValue={inputValue}\n handleInputChange={handleInputChange}\n handleSendClick={handleSendClick}\n />\n )}\n\n {!isMultiSelect && !isSingleSelect && node.properties?.placeholder && (\n <InputSection\n readonly={readonly}\n locale={locale}\n placeholder={node.properties.placeholder}\n value={inputValue}\n onChange={handleInputChange}\n onSend={handleSendClick}\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","locale","resolvedDefaultButtonText","handleButtonClick","handleSendClick","Button","MarkdownFlowInput","InputSection","onChange","onSend","CustomButtonInputVariable","defaultButtonText","defaultInputText","defaultSelectedValues","beforeSend","localeTexts","getContentRenderLocaleTexts","resolvedConfirmButtonText","setInputValue","React","setSelectedValues","isMultiSelect","baseButtonTexts","shouldUseFallbackButton","fallbackButtonLabel","singleSelectNode","singleSelectButtonTexts","singleSelectButtonValues","isSingleSelect","param","prev","v","noSelection","e","valueIndex","textIndex"],"mappings":";;;;;;;;AAyDA,MAAMA,IAAqB,CAAC;AAAA,EAC1B,MAAAC;AAAA,EACA,UAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,YAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,sBAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,eAAAC;AAAA,EACA,oBAAAC;AACF,MAA+B;AAC7B,QAAMC,IAAcT,EAAK,YAAY,aAC/BU,IACJT,KAAaC,EAAe,WAAW,KAAK,CAACC,GAAY,KAAA,GAErDQ,IAAsB,CAACC,MAC3BC,gBAAAA,EAAAA;AAAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWC;AAAA,QACT;AAAA,QACAJ,IAAkB,kCAAkC;AAAA,QACpDE;AAAA,MAAA;AAAA,MAGF,UAAAC,gBAAAA,EAAAA;AAAAA,QAAC;AAAA,QAAA;AAAA,UACC,MAAK;AAAA,UACL,WAAU;AAAA,UACV,UAAUH;AAAA,UACV,SAASF;AAAA,UAER,UAAAJ;AAAA,QAAA;AAAA,MAAA;AAAA,IACH;AAAA,EAAA;AAIJ,SACEW,gBAAAA,EAAAA,KAAC,QAAA,EAAK,WAAU,+CACd,UAAA;AAAA,IAAAF,gBAAAA,EAAAA,IAAC,QAAA,EAAK,WAAU,sCACb,UAAAb,EAAK,YAAY,aAAa,IAAI,CAACgB,GAAMC,MAAU;AAClD,YAAMC,IAAQlB,EAAK,YAAY,eAAeiB,CAAK,GAC7CE,IAAcD,MAAU,SAAYA,IAAQF;AAClD,aACEH,gBAAAA,EAAAA;AAAAA,QAACO;AAAA,QAAA;AAAA,UAEC,OAAOJ;AAAA,UACP,UAAUf;AAAA,UACV,SA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ACA,gBAAAC;AAAA,QACA,YAAAC;AAAA,QACA,mBAAmBsC;AAAA,QACnB,sBAAApC;AAAA,QACA,mBAAAC;AAAA,QACA,eAAAC;AAAA,QACA,oBAAAC;AAAA,MAAA;AAAA,IAAA;AAAA,IAIH,CAACqC,KAAiBO,KACjBvC,gBAAAA,EAAAA;AAAAA,MAACW;AAAA,MAAA;AAAA,QACC,MAAMyB;AAAA,QACN,UAAAhD;AAAA,QACA,QAAAwB;AAAA,QACA,2BAAAC;AAAA,QACA,mBAAAC;AAAA,QACA,YAAAxB;AAAA,QACA,mBAAAG;AAAA,QACA,iBAAAsB;AAAA,MAAA;AAAA,IAAA;AAAA,IAIH,CAACiB,KAAiB,CAACO,KAAkBpD,EAAK,YAAY,eACrDa,gBAAAA,EAAAA;AAAAA,MAACkB;AAAA,MAAA;AAAA,QACC,UAAA9B;AAAA,QACA,QAAAwB;AAAA,QACA,aAAazB,EAAK,WAAW;AAAA,QAC7B,OAAOG;AAAA,QACP,UAAUG;AAAA,QACV,QAAQsB;AAAA,MAAA;AAAA,IAAA;AAAA,EACV,GAEJ;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"CustomVariable.es.js","sources":["../../../../src/components/ContentRender/plugins/CustomVariable.tsx"],"sourcesContent":["import React from \"react\";\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 {\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 node: CustomVariableNode;\n defaultButtonText?: string;\n defaultInputText?: string;\n defaultSelectedValues?: string[];\n locale?: MarkdownFlowLocale;\n readonly?: boolean;\n onSend?: (content: OnSendContentParams) => 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 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}\n\nconst SingleSelectSection = ({\n node,\n readonly,\n locale,\n resolvedDefaultButtonText,\n handleButtonClick,\n inputValue,\n handleInputChange,\n handleSendClick,\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-left 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 disabled={readonly}\n locale={locale}\n placeholder={node.properties.placeholder}\n value={inputValue}\n onChange={handleInputChange}\n onSend={handleSendClick}\n title={node.properties.placeholder}\n />\n </span>\n )}\n </span>\n);\n\n// Pure input\ninterface InputSectionProps {\n readonly?: boolean;\n locale?: MarkdownFlowLocale;\n placeholder?: string;\n value: string;\n onChange: (event: React.ChangeEvent<HTMLTextAreaElement>) => void;\n onSend: () => void;\n}\n\nconst InputSection = ({\n readonly,\n locale,\n placeholder,\n value,\n onChange,\n onSend,\n}: InputSectionProps) => {\n if (!placeholder) {\n return null;\n }\n\n return (\n <MarkdownFlowInput\n disabled={readonly}\n locale={locale}\n placeholder={placeholder}\n value={value}\n onChange={onChange}\n onSend={onSend}\n title={placeholder}\n />\n );\n};\n\n// Define custom variable component\nconst CustomButtonInputVariable = ({\n node,\n readonly,\n locale,\n defaultButtonText,\n defaultInputText,\n defaultSelectedValues,\n onSend,\n confirmButtonText,\n beforeSend = () => true,\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 node.properties?.variableName?.trim() ||\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 handleKeyDown = (e: React.KeyboardEvent<HTMLTextAreaElement>) => {\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 node={singleSelectNode}\n readonly={readonly}\n locale={locale}\n resolvedDefaultButtonText={resolvedDefaultButtonText}\n handleButtonClick={handleButtonClick}\n inputValue={inputValue}\n handleInputChange={handleInputChange}\n handleSendClick={handleSendClick}\n />\n )}\n\n {!isMultiSelect && !isSingleSelect && node.properties?.placeholder && (\n <InputSection\n readonly={readonly}\n locale={locale}\n placeholder={node.properties.placeholder}\n value={inputValue}\n onChange={handleInputChange}\n onSend={handleSendClick}\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","locale","resolvedDefaultButtonText","handleButtonClick","handleSendClick","Button","MarkdownFlowInput","InputSection","onChange","onSend","CustomButtonInputVariable","defaultButtonText","defaultInputText","defaultSelectedValues","beforeSend","localeTexts","getContentRenderLocaleTexts","resolvedConfirmButtonText","setInputValue","React","setSelectedValues","interactionDefinitionKey","isMultiSelect","baseButtonTexts","shouldUseFallbackButton","fallbackButtonLabel","singleSelectNode","singleSelectButtonTexts","singleSelectButtonValues","isSingleSelect","param","prev","v","noSelection","e","valueIndex","textIndex"],"mappings":";;;;;;;;AAyDA,MAAMA,IAAqB,CAAC;AAAA,EAC1B,MAAAC;AAAA,EACA,UAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,YAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,sBAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,eAAAC;AAAA,EACA,oBAAAC;AACF,MAA+B;AAC7B,QAAMC,IAAcT,EAAK,YAAY,aAC/BU,IACJT,KAAaC,EAAe,WAAW,KAAK,CAACC,GAAY,KAAA,GAErDQ,IAAsB,CAACC,MAC3BC,gBAAAA,EAAAA;AAAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWC;AAAA,QACT;AAAA,QACAJ,IAAkB,kCAAkC;AAAA,QACpDE;AAAA,MAAA;AAAA,MAGF,UAAAC,gBAAAA,EAAAA;AAAAA,QAAC;AAAA,QAAA;AAAA,UACC,MAAK;AAAA,UACL,WAAU;AAAA,UACV,UAAUH;AAAA,UACV,SAASF;AAAA,UAER,UAAAJ;AAAA,QAAA;AAAA,MAAA;AAAA,IACH;AAAA,EAAA;AAIJ,SACEW,gBAAAA,EAAAA,KAAC,QAAA,EAAK,WAAU,+CACd,UAAA;AAAA,IAAAF,gBAAAA,EAAAA,IAAC,QAAA,EAAK,WAAU,sCACb,UAAAb,EAAK,YAAY,aAAa,IAAI,CAACgB,GAAMC,MAAU;AAClD,YAAMC,IAAQlB,EAAK,YAAY,eAAeiB,CAAK,GAC7CE,IAAcD,MAAU,SAAYA,IAAQF;AAClD,aACEH,gBAAAA,EAAAA;AAAAA,QAACO;AAAA,QAAA;AAA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U,MAAM;AACpB,IAAAC,EAAkBP,KAAyB,EAAE;AAAA,EAC/C,GAAG,CAACA,GAAuBQ,CAAwB,CAAC,GAGlD9B,gBAAAA,EAAAA,KAAC,QAAA,EAAK,WAAU,gEACb,UAAA;AAAA,IAAA+B,KACCjC,gBAAAA,EAAAA;AAAAA,MAACd;AAAA,MAAA;AAAA,QACC,MAAAC;AAAA,QACA,UAAAC;AAAA,QACA,gBAAAC;AAAA,QACA,YAAAC;AAAA,QACA,mBAAmBsC;AAAA,QACnB,sBAAApC;AAAA,QACA,mBAAAC;AAAA,QACA,eAAAC;AAAA,QACA,oBAAAC;AAAA,MAAA;AAAA,IAAA;AAAA,IAIH,CAACsC,KAAiBO,KACjBxC,gBAAAA,EAAAA;AAAAA,MAACW;AAAA,MAAA;AAAA,QACC,MAAM0B;AAAA,QACN,UAAAjD;AAAA,QACA,QAAAwB;AAAA,QACA,2BAAAC;AAAA,QACA,mBAAAC;AAAA,QACA,YAAAxB;AAAA,QACA,mBAAAG;AAAA,QACA,iBAAAsB;AAAA,MAAA;AAAA,IAAA;AAAA,IAIH,CAACkB,KAAiB,CAACO,KAAkBrD,EAAK,YAAY,eACrDa,gBAAAA,EAAAA;AAAAA,MAACkB;AAAA,MAAA;AAAA,QACC,UAAA9B;AAAA,QACA,QAAAwB;AAAA,QACA,aAAazB,EAAK,WAAW;AAAA,QAC7B,OAAOG;AAAA,QACP,UAAUG;AAAA,QACV,QAAQsB;AAAA,MAAA;AAAA,IAAA;AAAA,EACV,GAEJ;AAEJ;"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
"placeholder": "Type '/' to insert content",
|
|
3
|
+
"placeholderCodeEdit": "Please enter your content",
|
|
4
|
+
"placeholderQuickEdit": "Please enter your content, type '/' for more",
|
|
5
|
+
"dialogTitle": "Settings",
|
|
6
|
+
"dialogTitleImage": "Add Image",
|
|
7
|
+
"dialogTitleVideo": "Add Video",
|
|
8
|
+
"imageUrlPlaceholder": "Please enter image URL",
|
|
9
|
+
"imageUrlLabel": "URL",
|
|
10
|
+
"imageRunButton": "Preview",
|
|
11
|
+
"imageTitlePlaceholder": "Please enter image title",
|
|
12
|
+
"imageUseButton": "Use Image",
|
|
13
|
+
"imageDefaultTitle": "Image name",
|
|
14
|
+
"imageUploadLabel": "Upload",
|
|
15
|
+
"imageUploadPlaceholder": "Drag files or click to upload",
|
|
16
|
+
"imageUploading": "Uploading...",
|
|
17
|
+
"imageUploadSuccess": "Upload complete",
|
|
18
|
+
"imageUploadError": "Upload failed, please retry",
|
|
19
|
+
"fixedTextPlaceholder": "Add fixed text",
|
|
20
|
+
"fixedTextTooltip": "Fixed text",
|
|
21
|
+
"slashDivider": "Divider",
|
|
22
|
+
"imageTitleLabel": "Image Title",
|
|
23
|
+
"imageScaleLabel": "Scale",
|
|
24
|
+
"imageCancelButton": "Cancel",
|
|
25
|
+
"imageUrlRequired": "Please enter image URL",
|
|
26
|
+
"imageInvalidUrl": "Please enter a valid image URL",
|
|
27
|
+
"videoUrlPlaceholder": "Please enter Bilibili or YouTube video URL",
|
|
28
|
+
"videoUrlLabel": "URL",
|
|
29
|
+
"videoRunButton": "Preview",
|
|
30
|
+
"videoUseButton": "Use Resource",
|
|
31
|
+
"videoTitlePlaceholder": "Please enter video title",
|
|
32
|
+
"videoTitleLabel": "Title",
|
|
33
|
+
"videoDefaultTitle": "Video Title",
|
|
34
|
+
"videoDefaultTitleBilibili": "Bilibili Video",
|
|
35
|
+
"videoDefaultTitleYoutube": "YouTube Video",
|
|
36
|
+
"videoInvalidUrl": "Please enter a valid Bilibili or YouTube video URL",
|
|
37
|
+
"videoCancelButton": "Cancel",
|
|
38
|
+
"videoUseVideoButton": "Use Video",
|
|
39
|
+
"videoPreviewPlaceholder": "Preview will appear here",
|
|
40
|
+
"slashImage": "Image",
|
|
41
|
+
"slashVideo": "Video",
|
|
42
|
+
"slashVariable": "Variable",
|
|
43
|
+
"slashFixedText": "Fixed Text",
|
|
44
|
+
"dialogTitleVariable": "Select Variable",
|
|
45
|
+
"variableSearchPlaceholder": "Search variable",
|
|
46
|
+
"variableNotFound": "No variables found",
|
|
47
|
+
"variableEmpty": "No variables yet",
|
|
48
|
+
"variableNamePlaceholder": "Variable name",
|
|
49
|
+
"variableAlreadyExists": "Variable already exists",
|
|
50
|
+
"variableNameInvalid": "Use letters, numbers, or underscores without spaces",
|
|
51
|
+
"variableSectionSystem": "System Variables",
|
|
52
|
+
"variableSectionCustom": "Custom Variables",
|
|
53
|
+
"variableAddNew": "Add variable",
|
|
54
|
+
"toolbarInsertNewVariable": "Insert new variable",
|
|
55
|
+
"toolbarInsertExistingVariable": "Insert existing variable",
|
|
56
|
+
"toolbarConfirmOutput": "Insert confirm output",
|
|
57
|
+
"toolbarInsertLink": "Insert link",
|
|
58
|
+
"toolbarInsertButton": "Insert button",
|
|
59
|
+
"toolbarInsertSingleChoice": "Insert single choice",
|
|
60
|
+
"toolbarChoiceOption1": "Option 1",
|
|
61
|
+
"toolbarChoiceOption2": "Option 2",
|
|
62
|
+
"toolbarInsertMultiChoice": "Insert multi choice",
|
|
63
|
+
"toolbarInsertInput": "Insert input",
|
|
64
|
+
"toolbarInputPlaceholder": "Please enter",
|
|
65
|
+
"toolbarInsertImage": "Insert image",
|
|
66
|
+
"toolbarInsertVideo": "Insert video"
|
|
67
|
+
}
|
|
68
|
+
;
|
|
69
|
+
|
|
70
|
+
export default _default;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
"placeholder": "Tapez '/' pour insérer du contenu",
|
|
3
|
+
"placeholderCodeEdit": "Veuillez saisir votre contenu",
|
|
4
|
+
"placeholderQuickEdit": "Veuillez saisir votre contenu, tapez '/' pour plus d'options",
|
|
5
|
+
"dialogTitle": "Paramètres",
|
|
6
|
+
"dialogTitleImage": "Ajouter une image",
|
|
7
|
+
"dialogTitleVideo": "Ajouter une vidéo",
|
|
8
|
+
"imageUrlPlaceholder": "Veuillez saisir l'URL de l'image",
|
|
9
|
+
"imageUrlLabel": "URL",
|
|
10
|
+
"imageRunButton": "Prévisualiser",
|
|
11
|
+
"imageTitlePlaceholder": "Veuillez saisir le titre de l'image",
|
|
12
|
+
"imageUseButton": "Utiliser l'image",
|
|
13
|
+
"imageDefaultTitle": "Nom de l'image",
|
|
14
|
+
"imageUploadLabel": "Téléverser",
|
|
15
|
+
"imageUploadPlaceholder": "Glissez les fichiers ici ou cliquez pour téléverser",
|
|
16
|
+
"imageUploading": "Téléversement en cours...",
|
|
17
|
+
"imageUploadSuccess": "Téléversement terminé",
|
|
18
|
+
"imageUploadError": "Échec du téléversement, veuillez réessayer",
|
|
19
|
+
"fixedTextPlaceholder": "Ajouter un texte fixe",
|
|
20
|
+
"fixedTextTooltip": "Texte fixe",
|
|
21
|
+
"slashDivider": "Séparateur",
|
|
22
|
+
"imageTitleLabel": "Titre de l'image",
|
|
23
|
+
"imageScaleLabel": "Échelle",
|
|
24
|
+
"imageCancelButton": "Annuler",
|
|
25
|
+
"imageUrlRequired": "Veuillez saisir l'URL de l'image",
|
|
26
|
+
"imageInvalidUrl": "Veuillez saisir une URL d'image valide",
|
|
27
|
+
"videoUrlPlaceholder": "Veuillez saisir une URL de vidéo Bilibili ou YouTube",
|
|
28
|
+
"videoUrlLabel": "URL",
|
|
29
|
+
"videoRunButton": "Prévisualiser",
|
|
30
|
+
"videoUseButton": "Utiliser la ressource",
|
|
31
|
+
"videoTitlePlaceholder": "Veuillez saisir le titre de la vidéo",
|
|
32
|
+
"videoTitleLabel": "Titre",
|
|
33
|
+
"videoDefaultTitle": "Titre de la vidéo",
|
|
34
|
+
"videoDefaultTitleBilibili": "Vidéo Bilibili",
|
|
35
|
+
"videoDefaultTitleYoutube": "Vidéo YouTube",
|
|
36
|
+
"videoInvalidUrl": "Veuillez saisir une URL Bilibili ou YouTube valide",
|
|
37
|
+
"videoCancelButton": "Annuler",
|
|
38
|
+
"videoUseVideoButton": "Utiliser la vidéo",
|
|
39
|
+
"videoPreviewPlaceholder": "L'aperçu s'affichera ici",
|
|
40
|
+
"slashImage": "Image",
|
|
41
|
+
"slashVideo": "Vidéo",
|
|
42
|
+
"slashVariable": "Variable",
|
|
43
|
+
"slashFixedText": "Texte fixe",
|
|
44
|
+
"dialogTitleVariable": "Sélectionner une variable",
|
|
45
|
+
"variableSearchPlaceholder": "Rechercher une variable",
|
|
46
|
+
"variableNotFound": "Aucune variable trouvée",
|
|
47
|
+
"variableEmpty": "Aucune variable pour le moment",
|
|
48
|
+
"variableNamePlaceholder": "Nom de la variable",
|
|
49
|
+
"variableAlreadyExists": "La variable existe déjà",
|
|
50
|
+
"variableNameInvalid": "Utilisez des lettres, des chiffres ou des underscores sans espaces",
|
|
51
|
+
"variableSectionSystem": "Variables système",
|
|
52
|
+
"variableSectionCustom": "Variables personnalisées",
|
|
53
|
+
"variableAddNew": "Ajouter une variable",
|
|
54
|
+
"toolbarInsertNewVariable": "Insérer une nouvelle variable",
|
|
55
|
+
"toolbarInsertExistingVariable": "Insérer une variable existante",
|
|
56
|
+
"toolbarConfirmOutput": "Insérer une sortie de confirmation",
|
|
57
|
+
"toolbarInsertLink": "Insérer un lien",
|
|
58
|
+
"toolbarInsertButton": "Insérer un bouton",
|
|
59
|
+
"toolbarInsertSingleChoice": "Insérer un choix unique",
|
|
60
|
+
"toolbarChoiceOption1": "Option 1",
|
|
61
|
+
"toolbarChoiceOption2": "Option 2",
|
|
62
|
+
"toolbarInsertMultiChoice": "Insérer un choix multiple",
|
|
63
|
+
"toolbarInsertInput": "Insérer un champ de saisie",
|
|
64
|
+
"toolbarInputPlaceholder": "Veuillez saisir",
|
|
65
|
+
"toolbarInsertImage": "Insérer une image",
|
|
66
|
+
"toolbarInsertVideo": "Insérer une vidéo"
|
|
67
|
+
}
|
|
68
|
+
;
|
|
69
|
+
|
|
70
|
+
export default _default;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
"placeholder": "输入'/'快速插入内容",
|
|
3
|
+
"placeholderCodeEdit": "请输入你的内容",
|
|
4
|
+
"placeholderQuickEdit": "请输入你的内容,输入 / 唤起更多",
|
|
5
|
+
"dialogTitle": "设置",
|
|
6
|
+
"dialogTitleImage": "添加图片",
|
|
7
|
+
"dialogTitleVideo": "添加视频",
|
|
8
|
+
"imageUrlPlaceholder": "请输入图片地址",
|
|
9
|
+
"imageUrlLabel": "URL",
|
|
10
|
+
"imageRunButton": "预览",
|
|
11
|
+
"imageTitlePlaceholder": "请输入图片标题",
|
|
12
|
+
"imageUseButton": "使用图片",
|
|
13
|
+
"imageDefaultTitle": "图片名称",
|
|
14
|
+
"imageUploadLabel": "上传",
|
|
15
|
+
"imageUploadPlaceholder": "拖拽文件或点击上传",
|
|
16
|
+
"imageUploading": "正在上传...",
|
|
17
|
+
"imageUploadSuccess": "上传完成",
|
|
18
|
+
"imageUploadError": "上传失败,请重试",
|
|
19
|
+
"fixedTextPlaceholder": "添加固定文本",
|
|
20
|
+
"fixedTextTooltip": "固定文本",
|
|
21
|
+
"slashDivider": "分割线",
|
|
22
|
+
"imageTitleLabel": "图片标题",
|
|
23
|
+
"imageScaleLabel": "缩放比例",
|
|
24
|
+
"imageCancelButton": "取消",
|
|
25
|
+
"imageUrlRequired": "请输入图片地址",
|
|
26
|
+
"imageInvalidUrl": "请输入有效的图片地址",
|
|
27
|
+
"videoUrlPlaceholder": "请输入 B 站或 YouTube 视频链接",
|
|
28
|
+
"videoUrlLabel": "URL",
|
|
29
|
+
"videoRunButton": "预览",
|
|
30
|
+
"videoUseButton": "使用资源",
|
|
31
|
+
"videoTitlePlaceholder": "请输入视频标题",
|
|
32
|
+
"videoTitleLabel": "标题",
|
|
33
|
+
"videoDefaultTitle": "视频标题",
|
|
34
|
+
"videoDefaultTitleBilibili": "哔哩哔哩视频",
|
|
35
|
+
"videoDefaultTitleYoutube": "YouTube 视频",
|
|
36
|
+
"videoInvalidUrl": "请输入有效的 B 站或 YouTube 视频链接",
|
|
37
|
+
"videoCancelButton": "取消",
|
|
38
|
+
"videoUseVideoButton": "使用视频",
|
|
39
|
+
"videoPreviewPlaceholder": "预览将在这里显示",
|
|
40
|
+
"slashImage": "图片",
|
|
41
|
+
"slashVideo": "视频",
|
|
42
|
+
"slashVariable": "变量",
|
|
43
|
+
"slashFixedText": "固定文本",
|
|
44
|
+
"dialogTitleVariable": "选择变量",
|
|
45
|
+
"variableSearchPlaceholder": "搜索变量",
|
|
46
|
+
"variableNotFound": "未找到变量",
|
|
47
|
+
"variableEmpty": "暂无变量",
|
|
48
|
+
"variableNamePlaceholder": "变量名称",
|
|
49
|
+
"variableAlreadyExists": "变量已存在",
|
|
50
|
+
"variableNameInvalid": "仅可包含字母、数字或下划线,且不能有空格",
|
|
51
|
+
"variableSectionSystem": "系统变量",
|
|
52
|
+
"variableSectionCustom": "自定义变量",
|
|
53
|
+
"variableAddNew": "添加变量",
|
|
54
|
+
"toolbarInsertNewVariable": "插入新变量",
|
|
55
|
+
"toolbarInsertExistingVariable": "插入已有变量",
|
|
56
|
+
"toolbarConfirmOutput": "插入确定内容",
|
|
57
|
+
"toolbarInsertLink": "插入链接",
|
|
58
|
+
"toolbarInsertButton": "插入按钮",
|
|
59
|
+
"toolbarInsertSingleChoice": "插入单选",
|
|
60
|
+
"toolbarChoiceOption1": "选项1",
|
|
61
|
+
"toolbarChoiceOption2": "选项2",
|
|
62
|
+
"toolbarInsertMultiChoice": "插入多选",
|
|
63
|
+
"toolbarInsertInput": "插入输入框",
|
|
64
|
+
"toolbarInputPlaceholder": "请输入",
|
|
65
|
+
"toolbarInsertImage": "插入图片",
|
|
66
|
+
"toolbarInsertVideo": "插入视频"
|
|
67
|
+
}
|
|
68
|
+
;
|
|
69
|
+
|
|
70
|
+
export default _default;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("../../_virtual/jsx-runtime.cjs.js"),t=require("react"),vr=require("../../lib/sandboxInteraction.cjs.js"),de=require("../../lib/utils.cjs.js"),Er=require("../ui/loading-overlay-card.cjs.js"),Ir=require("../ContentRender/ContentRender.cjs.js"),pn=require("../ContentRender/IframeSandbox.cjs.js");require("../ui/inputGroup/input-group.cjs.js");require("../ContentRender/contentRenderI18n.cjs.js");const Qe=require("../../lib/mobileDevice.cjs.js"),Rr=require("./Player.cjs.js"),Ar=require("./MarkdownSlideScaling.cjs.js"),Cr=require("./SubtitleOverlay.cjs.js"),wr=require("./useSlide.cjs.js"),kr=require("./useWakePlayerFromIframe.cjs.js"),Tr=require("./utils/playerKeyboardShortcutContext.cjs.js"),Mr=require("./utils/playerKeyboardShortcuts.cjs.js"),Oe=require("./utils/mobileScreenMode.cjs.js"),Ze=require("./utils/interactionPlayback.cjs.js"),Pr=require("./utils/markdownScaling.cjs.js"),Rt=require("./utils/playerNavigationContext.cjs.js"),_r=require("./utils/appendedMarkerAdvance.cjs.js"),yn=require("./utils/playbackSequence.cjs.js"),At=require("./utils/subtitleJumpNavigation.cjs.js"),hn=require("./utils/playerCustomActions.cjs.js"),Or=require("./utils/playbackTimeStore.cjs.js"),jr=require("./utils/interactionResolution.cjs.js"),qr=require("./utils/playerToggleMode.cjs.js"),xn=require("./utils/imageOnlyStepVisualReady.cjs.js"),Fr=require("./utils/silentStepAutoAdvance.cjs.js"),Br=require("./utils/playerVisibility.cjs.js"),gn=require("./slideI18n.cjs.js");;/* empty css */const Dr=require("../../node_modules/lucide-react/dist/esm/icons/grip-horizontal.cjs.js"),Nr=require("../../node_modules/lucide-react/dist/esm/icons/chevron-left.cjs.js"),Lr=2e3,Vr=300,Kr=160,Ur=16,Sn=3e3,bn={x:0,y:0},Hr=typeof window>"u"?t.useEffect:t.useLayoutEffect,Yr=["button","input","textarea",'[contenteditable=""]','[contenteditable="true"]','[contenteditable="plaintext-only"]'].join(", "),wt="waitingForAudio",Wr=(i,f)=>typeof i=="string"?i:i[f]??i[wt]??gn.DEFAULT_SLIDE_BUFFERING_TEXTS[f],Gr=(i,f)=>typeof i=="string"?i:{...f,...i},Jr=(i,f)=>f?i!=="loadingAudio":!1,vn=t.memo(({content:i,title:f,locale:L,defaultButtonText:fe,defaultInputText:V,defaultSelectedValues:K,confirmButtonText:$,copyButtonText:z,copiedButtonText:je,onSend:et,onDragHandlePointerCancel:X,onDragHandlePointerDown:tt,onDragHandlePointerMove:me,onDragHandlePointerUp:qe,readonly:Fe=!1})=>a.jsxRuntimeExports.jsxs("div",{className:"slide-player__interaction-card",children:[a.jsxRuntimeExports.jsx("button",{type:"button",className:"slide-player__interaction-drag-handle","aria-label":"Move interaction",onPointerCancel:X,onPointerDown:tt,onPointerMove:me,onPointerUp:qe,children:a.jsxRuntimeExports.jsx("span",{className:"slide-player__interaction-drag-handle-icon",children:a.jsxRuntimeExports.jsx(Dr.default,{"aria-hidden":"true"})})}),a.jsxRuntimeExports.jsx("div",{className:"slide-player__interaction-header",children:a.jsxRuntimeExports.jsx("p",{className:"slide-player__interaction-title",children:f})}),a.jsxRuntimeExports.jsx("div",{className:"slide-player__interaction-body",children:a.jsxRuntimeExports.jsx(Ir.default,{content:i,locale:L,defaultButtonText:fe,defaultInputText:V,defaultSelectedValues:K,confirmButtonText:$,copyButtonText:z,copiedButtonText:je,onSend:et,readonly:Fe,sandboxMode:"content"})})]}));vn.displayName="InteractionOverlayCard";const $r=(i,f)=>i.length===f.length&&i.every((L,fe)=>{const V=f[fe];return L.sequence_number===V?.sequence_number&&L.type===V?.type&&L.content===V?.content}),Ct=i=>i instanceof HTMLElement&&!!i.closest(Yr),zr=({elementList:i=[],locale:f,playerEnabled:L,playerControlsVisibility:fe,playerClassName:V,fullscreenHeader:K,playerCustomActions:$,playerCustomActionPauseOnActive:z=!0,bufferingText:je,interactionTitle:et,interactionTexts:X,playerTexts:tt,playerAutoHideDelay:me=3e3,markerAutoAdvanceDelay:qe=Lr,interactionDefaultValueOptions:Fe,onSend:kt,onPlayerVisibilityChange:nt,onMobileViewModeChange:Tt,onStepChange:Mt,enableKeyboardShortcuts:Q=!0,enableIframeScaling:En=!0,enableMarkdownScaling:In=!0,disableLoadingOverlay:C=!1,className:Rn,onPointerDown:Pt,onFocusCapture:_t,...An})=>{const U=t.useMemo(()=>gn.getSlideLocaleTexts(f),[f]),Cn=t.useMemo(()=>Gr(je,U.bufferingText),[je,U.bufferingText]),{playerEnabled:wn,playerControlsVisibility:F}=Br.resolveSlidePlayerVisibility({playerEnabled:L,playerControlsVisibility:fe}),Be=t.useId(),pe=t.useRef(null),rt=t.useRef(null),De=t.useRef(null),Ot=t.useRef(null),Z=t.useRef(null),Ne=t.useRef(!1),ye=t.useRef(null),Le=t.useRef(null),H=t.useRef(null),he=t.useRef(null),xe=t.useRef(null),Se=t.useRef(null),be=t.useRef(null),jt=t.useRef([]),ge=t.useRef(!1),Y=t.useRef(null),ve=t.useRef(null),qt=t.useRef(0),Ft=t.useRef(null),Bt=t.useRef({markerCount:0,currentIndex:-1,canGoNext:!1}),ot=t.useRef(!1),{currentElementList:R,stepElementLists:Dt,slideElementList:I,currentIndex:u,audioList:y,audioSlideIndexes:Ve,currentAudioSequenceIndexes:Ke,currentStepHasSpeakableElement:h,currentInteractionElement:c,canGoPrev:kn,canGoNext:A,handlePrev:Nt,handleNext:w,handleGoTo:Lt}=wr.default(i),Ee=t.useMemo(()=>{if(!(u<0))return I[u]},[u,I]),ee=t.useMemo(()=>R.map((e,n)=>`${e.sequence_number??`${e.type}-${n}`}:${String(e.is_new??"")}`),[R]),Tn=I.filter(e=>e.is_renderable!==!1).length===1,m=wn&&(I.length>0||y.length>0||!!c),Mn=t.useMemo(()=>({enabled:Q,ownerId:Be}),[Q,Be]),B=t.useCallback(()=>{!Q||!m||Mr.activatePlayerKeyboardShortcutOwner(Be)},[Q,Be,m]),k=t.useMemo(()=>Ke.map(e=>y[e]?.audioKey).filter(e=>!!e),[y,Ke]),[Pn,Ie]=t.useState(!0),[Ue,te]=t.useState(!1),[st,Vt]=t.useState(!0),[Re,Kt]=t.useState(!0),[b,D]=t.useState(null),[_n,Ut]=t.useState(null),[On,x]=t.useState(!1),[jn,lt]=t.useState(wt),[T,at]=t.useState(!1),[qn,He]=t.useState(!1),[Ht,Fn]=t.useState(!0),[ut,it]=t.useState(!1),[d,ct]=t.useState(),[ne,Ye]=t.useState(!1),[Yt,We]=t.useState(!1),[S,dt]=t.useState(bn),[ft,mt]=t.useState(!1),[Bn,Ae]=t.useState(0),[Wt,Dn]=t.useState(!1),j=t.useMemo(()=>Qe.isMobileDevice(),[]),[Ge,pt]=t.useState(Oe.DEFAULT_MOBILE_VIEW_MODE),[Gt,yt]=t.useState(!1),[Nn,Jt]=t.useState(()=>j?Qe.isLandscapeViewport():!1),re=t.useMemo(()=>Or.createPlaybackTimeStore(),[]),{effectiveMobileViewMode:oe,isImmersiveMobileFullscreen:se,isNativeMobileFullscreen:$t,shouldRotateFullscreenViewport:Ln}=t.useMemo(()=>Oe.resolveMobileViewModeState({hasManualMobileViewMode:Gt,isMobileDevice:j,mobileViewMode:Ge}),[Gt,j,Nn,Ge]),Vn=t.useRef(oe),g=m&&F!=="hidden"&&(F==="visible"||Pn),Kn=se&&g,Un=se&&g,Hn=se||$t,zt=Wt&&!j,Yn=t.useCallback(e=>{yt(!0),pt(e)},[]),Xt=t.useCallback(()=>{yt(!1),pt(Oe.DEFAULT_MOBILE_VIEW_MODE)},[]),Wn=t.useCallback(()=>{Xt(),K?.onBack?.()},[K,Xt]),Qt=t.useCallback(e=>{it(e)},[]),Zt=t.useCallback(()=>{it(e=>!e)},[]),{mountedStepStates:Gn,currentMountedStateIndex:Jn}=t.useMemo(()=>{const e=[],n=new Map;return Dt.forEach((o,s)=>{const l=e.findIndex(r=>$r(r.elementList,o));if(l>=0){e[l]?.sourceStepIndexes.push(s),n.set(s,l);return}e.push({elementList:o,sourceStepIndexes:[s]}),n.set(s,e.length-1)}),{mountedStepStates:e,currentMountedStateIndex:u>=0?n.get(u)??-1:-1}},[u,Dt]),en=t.useMemo(()=>String(u),[u]),v=t.useMemo(()=>b?y.findIndex(e=>(e.audioKey??"")===b):-1,[y,b]),ht=t.useMemo(()=>v>=0?y[v]:void 0,[y,v]),$n=ht?.element?.subtitle_cues??[],Je=t.useMemo(()=>k[0]??"none",[k]),xt=t.useMemo(()=>({currentElement:hn.resolvePlayerCustomActionElement({currentAudioIndex:v,currentAudioSequenceIndexes:Ke,audioList:y,currentInteractionElement:d,currentStepElement:Ee}),currentIndex:u,currentStepElement:Ee,isActive:ut,setActive:Qt,toggleActive:Zt}),[d,y,v,Ke,u,Ee,ut,Qt,Zt]),St=t.useMemo(()=>hn.getPlayerCustomActionCount($,xt),[xt,$]),zn=t.useMemo(()=>({"--slide-player-custom-action-count":String(St),"--slide-player-mobile-control-count":String(St+4),"--slide-interaction-drag-x":`${S.x}px`,"--slide-interaction-drag-y":`${S.y}px`}),[S.x,S.y,St]),tn=k.length>0,nn=t.useMemo(()=>c?`${c.sequence_number??"none"}:${String(c.content??"")}`:"none",[c]),Ce=t.useMemo(()=>[en,nn].join("|"),[nn,en]),Xn=t.useMemo(()=>[Ce,ht?.audioKey??"none",String(v)].join("|"),[v,ht?.audioKey,Ce]),rn=!!t.useMemo(()=>!Je||Je==="none"?"":y.find(n=>n.audioKey===Je)?.audioUrl?.trim()??"",[y,Je]),W=z&&!!$&&ut,we=t.useMemo(()=>qr.shouldUseAutoAdvanceToggle({canGoNext:A,currentAudioIndex:v,currentStepHasSpeakableElement:h,hasInteraction:!!c}),[A,v,c,h]),on=t.useMemo(()=>Fr.resolveSilentStepAutoAdvanceBehavior({currentElementList:R,currentStepHasSpeakableElement:h,currentInteractionElement:c,markerAutoAdvanceDelay:qe}),[R,c,h,qe]),sn=on.delayMs,ke=on.usesImageOnlyDelay,bt=t.useMemo(()=>`${u}:${ee.join("|")}`,[u,ee]),[Qn,Zn]=t.useState(null),ln=!ke||Qn===bt,q=t.useCallback(()=>{Z.current!==null&&(window.clearTimeout(Z.current),Z.current=null)},[]),M=t.useCallback(()=>{H.current!==null&&(window.clearTimeout(H.current),H.current=null)},[]),P=t.useCallback(()=>{he.current!==null&&(window.clearTimeout(he.current),he.current=null)},[]),le=t.useCallback(()=>{ye.current!==null&&(window.clearTimeout(ye.current),ye.current=null)},[]),N=t.useCallback(()=>{Le.current!==null&&(window.clearTimeout(Le.current),Le.current=null)},[]),_=t.useCallback((e={})=>{le(),M(),P(),N(),D(null),re.reset(),x(!1),lt(wt),at(!1),He(!1),Ut(null),e.preservePendingSubtitleJump||(ve.current=null),ct(void 0),Ye(!1),Ae(0)},[le,N,M,P,re]),$e=t.useCallback(e=>{qt.current+=1,Ut({...e,id:qt.current})},[]),ae=t.useCallback(()=>{const e=k[0];return e?(D(e),!0):!1},[k]),Te=t.useCallback(()=>{M(),P(),Ye(!1),Ae(0),!ae()&&A&&w()},[A,M,P,w,ae]),an=t.useCallback(e=>{if(P(),!e)return;const n=()=>{he.current=null,Ae(Kr),Ye(!0),Y.current=null};he.current=window.setTimeout(n,Vr)},[P]),gt=t.useCallback(()=>Ne.current||!!pe.current?.querySelector(".slide-player__controls:hover"),[]),p=t.useCallback((e=Ue)=>{!m||F==="hidden"||(Ie(!0),q(),!(F==="visible"||!e||me<=0||gt())&&(Z.current=window.setTimeout(()=>{if(gt()){Z.current=null;return}Ie(!1),Z.current=null},me)))},[q,Ue,gt,me,F,m]),Me=!!At.hasResolvedInteractionElement(c),ue=!!c&&!Me,er=t.useCallback(e=>{Vt(e)},[]),ie=t.useCallback(e=>{e&&Vt(e.shouldContinuePlayback)},[]);t.useEffect(()=>{Kt(st)},[u,st,z]),t.useEffect(()=>{z&&it(!1)},[u,z]),t.useEffect(()=>()=>{le(),N(),q(),M(),P()},[le,N,M,P,q]),t.useEffect(()=>{if(!ke){N();return}let e=!1,n=null,o=null;const s=()=>{o?.(),o=null},l=()=>{e||(s(),N(),Zn(bt))},r=()=>{if(e)return;s();const E=De.current?.querySelector('[data-active-step="true"]');if(!E)return;const O=Array.from(E.querySelectorAll("iframe"));if(O.length===0||xn.areImageOnlyStepIframeVisualsReady(O)){l();return}const Xe=[],_e=()=>{e||(n!==null&&window.cancelAnimationFrame(n),n=window.requestAnimationFrame(()=>{n=null,r()}))},It=(G,ce,J)=>{G.addEventListener(ce,J,{once:!0}),Xe.push(()=>G.removeEventListener(ce,J))};O.forEach(G=>{const ce=G.contentDocument;if(!ce||ce.readyState!=="complete"){It(G,"load",_e);return}Array.from(ce.images).filter(J=>!J.complete).forEach(J=>{It(J,"load",_e),It(J,"error",_e)})}),o=()=>{Xe.forEach(G=>G())}};return n=window.requestAnimationFrame(()=>{n=null,r()}),Le.current=window.setTimeout(()=>{l()},xn.DEFAULT_IMAGE_ONLY_VISUAL_READY_TIMEOUT_MS),()=>{e=!0,s(),N(),n!==null&&window.cancelAnimationFrame(n)}},[N,R,u,bt,ke]),t.useEffect(()=>(nt?.(g),()=>{nt?.(!1)}),[nt,g]),t.useEffect(()=>{g||(Ne.current=!1)},[g]),t.useEffect(()=>{j||Ge===Oe.DEFAULT_MOBILE_VIEW_MODE||(yt(!1),pt(Oe.DEFAULT_MOBILE_VIEW_MODE))},[j,Ge]),t.useEffect(()=>{if(!j){Jt(!1);return}const e=()=>{Jt(Qe.isLandscapeViewport())};return e(),Qe.subscribeMobileDeviceChange(e)},[j]),t.useEffect(()=>{Tt?.(oe)},[oe,Tt]),t.useEffect(()=>{Vn.current=oe},[oe]),t.useEffect(()=>{Mt?.(Ee,u)},[u,Ee,Mt]),t.useEffect(()=>{const e=Bt.current,n=_r.shouldAutoAdvanceIntoAppendedMarker({previousMarkerCount:e.markerCount,nextMarkerCount:I.length,previousIndex:e.currentIndex,previousCanGoNext:e.canGoNext,nextCanGoNext:A,currentAudioKey:b,hasCompletedCurrentStepAudio:T,hasResolvedCurrentInteraction:Me,currentStepHasSpeakableElement:h,currentInteractionElement:c,isAutoAdvanceEnabled:Re,shouldUseSilentStepAutoAdvanceToggle:we});Bt.current={markerCount:I.length,currentIndex:u,canGoNext:A},n&&w()},[A,b,u,c,h,w,T,Me,Re,we,I.length]),t.useEffect(()=>{if(!m||F==="hidden"){q(),Ie(!1);return}if(F==="visible"){q(),Ie(!0);return}Ue||p(!0)},[q,Ue,F,m,p]),t.useEffect(()=>{if(typeof window>"u")return;const e=n=>{n.origin===window.location.origin&&vr.isSandboxInteractionMessage(n.data)&&n.data.eventType==="click"&&m&&(B(),te(!0),p(!0))};return window.addEventListener("message",e),()=>{window.removeEventListener("message",e)}},[B,m,p]),kr.default({sectionRef:pe,enabled:m,keyboardShortcutsEnabled:Q,onKeyboardShortcut:B,onWake:()=>{B(),te(!0),p(!0)}}),t.useEffect(()=>{if(!m){_();return}const{hasPlaybackContextChanged:e,shouldInitializeAudioSequence:n}=yn.getPlaybackSequenceTransition({previousResetKey:Ft.current,nextResetKey:Ce,currentAudioKey:b,hasCompletedCurrentStepAudio:T});Ft.current=Ce;const o=Y.current===u&&!!c,s=Ze.shouldPresentInteractionOverlay({hasInteraction:!!c,shouldBlockPlaybackForInteraction:ue,shouldOpenInteractionOverlayAfterAudio:o,hasPlaybackContextChanged:e,hasResolvedCurrentInteraction:Me,currentStepHasSpeakableElement:h}),l=ve.current,r=l?.slideIndex===u;if(e&&_({preservePendingSubtitleJump:r}),!(R.length===0&&!c)&&!W){if(l?.slideIndex===u&&At.canReachSubtitleJumpTarget({currentIndex:u,resolvedCurrentInteractionElement:d,slideElementList:I,targetSlideIndex:l.slideIndex})){ve.current=null,ot.current=!0,D(l.audioKey),$e({audioIndex:l.audioIndex,timeMs:l.timeMs});return}if(c&&ct(c),s){an(c);return}if(P(),Y.current=null,!!n&&!ae()){if(h){if(C){x(!1);return}x(!0);return}if(A&&!(we&&!Re)&&!(ke&&!ln))return ye.current=window.setTimeout(()=>{ye.current=null,w()},sn),()=>{le()}}}},[d,A,le,R.length,u,c,b,Ce,h,ke,ln,sn,w,T,C,Re,Me,ue,P,_,$e,an,m,I,ae,W,we]),t.useEffect(()=>{if(C||W||!h||ue){x(!1);return}if(T){x(!1);return}if(tn){x(!1);return}lt("waitingForAudio"),x(!0)},[tn,h,T,C,W,ue]),t.useEffect(()=>{const e=ot.current;ot.current=!1,yn.shouldStartDefaultAudioSequence({currentAudioKey:b,currentAudioSequenceLength:k.length,currentStepHasSpeakableElement:h,hasCompletedCurrentStepAudio:T,shouldBlockPlaybackForInteraction:ue,shouldPausePlaybackForCustomAction:W,shouldSkipDefaultAudioStart:e})&&ae()},[b,k,h,T,W,ue,ae]),t.useEffect(()=>{!b||v>=0||D(null)},[v,b]),t.useEffect(()=>{v>=0||re.reset()},[v,re]),t.useEffect(()=>{He(!1)},[Xn]);const{interactionDefaults:un,interactionDefaultSelectedValues:tr,hasResolvedInteractionInput:cn,isInteractionReadonly:nr,shouldAutoContinueInteraction:dn}=t.useMemo(()=>jr.resolveSlideInteractionState(d,{interactionDefaultValueOptions:Fe}),[d,Fe]),rr=!!d?.readonly||nr,Pe=Ze.shouldRenderInteractionOverlay({hasActiveInteraction:!!d,isInteractionOverlayOpen:ne}),or=t.useCallback(e=>{const o=[...e.selectedValues??[],e.inputText?.trim()??"",e.buttonText?.trim()??""].filter(Boolean).join(", ");ct(s=>!s||!o?s:{...s,user_input:o}),kt?.(e,d),Te()},[d,Te,kt]);t.useEffect(()=>{const e=()=>{Dn(document.fullscreenElement===pe.current)};return e(),document.addEventListener("fullscreenchange",e),()=>{document.removeEventListener("fullscreenchange",e)}},[]),t.useEffect(()=>{d&&ne||We(!1)},[d,ne]),t.useEffect(()=>{dt(bn),mt(!1),be.current=null,Se.current=null},[d]),t.useEffect(()=>{if(!Pe){Ae(0);return}const e=xe.current;if(!e)return;const n=()=>{const s=Math.ceil(e.getBoundingClientRect().height);Ae(s+Ur)};if(n(),typeof ResizeObserver>"u")return;const o=new ResizeObserver(()=>{n()});return o.observe(e),()=>{o.disconnect()}},[Pe]),t.useEffect(()=>{if(M(),!!ne){if(dn)return H.current=window.setTimeout(()=>{H.current=null,Te()},Sn),()=>{M()};if(!(Yt||!cn))return H.current=window.setTimeout(()=>{H.current=null,Te()},Sn),()=>{M()}}},[M,Te,Yt,cn,ne,dn]);const sr=(e,n={})=>e?e.type==="slot"?a.jsxRuntimeExports.jsx(a.jsxRuntimeExports.Fragment,{children:e.content}):e.type==="html"?a.jsxRuntimeExports.jsx(pn.default,{className:"content-render-iframe",disableLoadingOverlay:C,hideFullScreen:!0,locale:f,mode:"blackboard",replaceRootScreenHeightWithFull:n.replaceRootScreenHeightWithFull,type:"sandbox",content:e.content,enableScaling:En}):a.jsxRuntimeExports.jsx(pn.default,{className:"content-render-iframe",disableLoadingOverlay:C,hideFullScreen:!0,locale:f,mode:"blackboard",type:"markdown",content:e.content}):null,lr=(e=[],n=!1)=>{if(e.length===0)return null;const o=e.filter(r=>r.is_renderable!==!1).length,s=n&&In?Pr.resolveMarkdownScalingMode(e):"disabled",l=e.reduce((r,E,O)=>E.is_renderable!==!1?O:r,-1);return a.jsxRuntimeExports.jsx(Ar.default,{className:"slide-stage__content flex w-full flex-col gap-4",mode:s,children:e.map((r,E)=>{const O=r.type==="html"&&r.is_renderable===!1;return a.jsxRuntimeExports.jsx("div",{ref:n&&E===l?Ot:null,"aria-hidden":O||void 0,className:de.cn("w-full shrink-0",o===1&&r.is_renderable!==!1&&"slide-element--single",O?"pointer-events-none fixed left-[-200vw] top-0 -z-10 h-[100dvh] w-[100vw] overflow-hidden opacity-0":r.is_renderable===!1&&"hidden"),children:sr(r,{replaceRootScreenHeightWithFull:o===1&&r.type==="html"&&r.is_renderable!==!1})},r.sequence_number??`${r.type}-${E}`)})})},ar=t.useCallback(()=>{const e=pe.current;if(e){if(document.fullscreenElement===e){document.exitFullscreen().catch(()=>{});return}e.requestFullscreen?.().catch(()=>{})}},[]),fn=t.useCallback(()=>{const e=De.current;e&&e.scrollTo({top:e.scrollHeight,behavior:"smooth"})},[]),vt=t.useCallback(e=>At.canReachSubtitleJumpTarget({currentIndex:u,resolvedCurrentInteractionElement:d,slideElementList:I,targetSlideIndex:Ve[e.audioIndex]}),[d,Ve,u,I]),ur=t.useCallback((e,n)=>{const s=y[e.audioIndex]?.audioKey,l=Ve[e.audioIndex];return!s||l==null||!vt(e)?!1:(ie(n),Y.current=null,x(!1),at(!1),He(!1),Rt.shouldWakePlayerControlsAfterNavigation(n)&&(te(!0),p(!0)),l===u?(ve.current=null,_(),D(s),$e(e),!0):(ge.current=!0,_(),ve.current={audioIndex:e.audioIndex,audioKey:s,slideIndex:l,timeMs:e.timeMs},Lt(l),!0))},[y,Ve,vt,u,Lt,$e,_,p,ie]),ir=t.useCallback(e=>{ie(e),ge.current=!0,Y.current=null,x(!1),Rt.shouldWakePlayerControlsAfterNavigation(e)&&(te(!0),p(!0)),_(),Nt()},[Nt,_,p,ie]),cr=t.useCallback(e=>{ie(e),ge.current=!0,Y.current=null,x(!1),Rt.shouldWakePlayerControlsAfterNavigation(e)&&(te(!0),p(!0)),_(),w()},[w,_,p,ie]),dr=t.useCallback(({loading:e,reason:n})=>{if(C){x(!1);return}if(!h||T){x(!1);return}e&&n&<(n),x(Jr(n,e))},[h,T,C]);t.useEffect(()=>{C&&x(!1)},[C]);const fr=t.useCallback(e=>{const n=y[e]?.audioKey;if(!n||!b||n!==b)return;const o=k.findIndex(r=>r===n);if(o<0){D(null);return}const s=o+1,l=k[s];if(l){D(l);return}if(D(null),at(!0),x(!1),A){const r=u+1,E=I[r];rn&&E?.type==="interaction"&&(Y.current=r),w();return}},[y,A,u,b,k,w,rn,I]),mr=t.useCallback(()=>{d&&Ye(e=>!e)},[d]),pr=t.useCallback(()=>{Ne.current=!0,q(),m&&Ie(!0)},[q,m]),yr=t.useCallback(()=>{Ne.current=!1,p(!0)},[p]),Et=t.useCallback(e=>{e.stopPropagation(),g&&p(!0)},[g,p]),ze=t.useCallback((e,n)=>{const o=rt.current;if(!o)return null;const s=e.getBoundingClientRect(),l=o.getBoundingClientRect();return{minX:n.x+l.left-s.left,maxX:n.x+l.right-s.right,minY:n.y+l.top-s.top,maxY:n.y+l.bottom-s.bottom}},[]);Hr(()=>{const e=xe.current;if(!Pe||!e){Se.current=null;return}const n=Se.current,o=e.getBoundingClientRect();if(!n||ft){Se.current=o;return}const s={x:S.x+n.left-o.left,y:S.y+n.top-o.top},l=ze(e,S),r=l?Ze.clampInteractionOverlayDragOffset(s,l):s;Se.current={left:o.left+r.x-S.x,top:o.top+r.y-S.y},(r.x!==S.x||r.y!==S.y)&&dt(r)},[ze,S,ft,g,m,Pe]);const hr=t.useCallback(e=>{if(Et(e),e.button!==0||!e.currentTarget.isConnected||!xe.current)return;const n=ze(xe.current,S);n&&(e.preventDefault(),e.currentTarget.setPointerCapture(e.pointerId),be.current={pointerId:e.pointerId,startClientX:e.clientX,startClientY:e.clientY,startOffset:S,bounds:n},mt(!0))},[ze,S,Et]),xr=t.useCallback(e=>{const n=be.current;!n||n.pointerId!==e.pointerId||(e.preventDefault(),e.stopPropagation(),dt(Ze.clampInteractionOverlayDragOffset({x:n.startOffset.x+e.clientX-n.startClientX,y:n.startOffset.y+e.clientY-n.startClientY},n.bounds)))},[]),mn=t.useCallback(e=>{const n=be.current;!n||n.pointerId!==e.pointerId||(e.stopPropagation(),e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId),be.current=null,mt(!1))},[]),Sr=t.useCallback(e=>{B(),Pt?.(e)},[B,Pt]),br=t.useCallback(e=>{B(),_t?.(e)},[B,_t]),gr=t.useCallback(()=>{te(!0),p(!0)},[p]);return t.useEffect(()=>{const e=jt.current,s=(e.length>0&&e.length<ee.length&&e.every((r,E)=>r===ee[E])?R.slice(e.length):[]).some(r=>r.is_new===!1);if(jt.current=ee,!s)return;const l=window.requestAnimationFrame(()=>{const r=De.current,E=Ot.current;if(!r||!E)return;const O=r.getBoundingClientRect(),Xe=E.getBoundingClientRect(),_e=r.scrollTop+(Xe.top-O.top);r.scrollTo({top:Math.max(_e,0),behavior:"smooth"})});return()=>{window.cancelAnimationFrame(l)}},[R,ee]),t.useEffect(()=>{if(!ge.current||(ge.current=!1,R.length===0))return;const e=window.requestAnimationFrame(()=>{fn()});return()=>{window.cancelAnimationFrame(e)}},[R,fn]),a.jsxRuntimeExports.jsxs("section",{ref:pe,className:de.cn("relative h-full w-full",j&&"slide--mobile-device",zt&&"slide--browser-fullscreen",se&&"slide--mobile-landscape",$t&&"slide--mobile-landscape-native",Rn),onClick:gr,onFocusCapture:br,onPointerDown:Sr,...An,children:[Hn?a.jsxRuntimeExports.jsx("div",{"aria-hidden":"true",className:"pointer-events-none fixed left-0 top-0 z-[9999] h-[100vh] max-h-[100vh] w-[100vw]"}):null,a.jsxRuntimeExports.jsxs("div",{ref:rt,className:de.cn("slide__viewport relative h-full min-h-0 w-full",se&&"slide__viewport--mobile-landscape",se&&!Ln&&"slide__viewport--mobile-landscape-native"),children:[Kn?a.jsxRuntimeExports.jsxs("div",{className:"slide-landscape-header",children:[a.jsxRuntimeExports.jsx("button",{"aria-label":K?.backAriaLabel??U.fullscreenBackAriaLabel,className:"slide-landscape-header__back",onClick:Wn,type:"button",children:a.jsxRuntimeExports.jsx(Nr.default,{className:"slide-landscape-header__icon h-6 w-6",strokeWidth:2.25})}),K?.content?a.jsxRuntimeExports.jsx("div",{className:"min-w-0 flex-1 overflow-hidden",children:K.content}):null]}):null,a.jsxRuntimeExports.jsx("div",{className:de.cn("h-full min-h-0 w-full",Un&&"slide__viewport-content--with-header",Tn?"slide-content--single":"grid gap-4"),children:R.length>0?a.jsxRuntimeExports.jsx("div",{className:"slide-stage",children:a.jsxRuntimeExports.jsx("div",{ref:De,className:"slide-stage__layer w-full",children:Gn.map((e,n)=>{const o=n===Jn;return a.jsxRuntimeExports.jsx("div",{"data-active-step":o?"true":void 0,"aria-hidden":!o||void 0,className:"w-full h-full",style:{display:o?void 0:"none"},children:lr(e.elementList,o)},e.sourceStepIndexes[0]??n)})})}):null}),On?a.jsxRuntimeExports.jsx(Er.default,{message:Wr(Cn,jn),className:"absolute left-1/2 top-1/2 z-[3] -translate-x-1/2 -translate-y-1/2"}):null,a.jsxRuntimeExports.jsx(Cr.default,{extraBottomOffset:Bn,hasPlayerGap:g,isEnabled:Ht&&qn,isPlayerHidden:m&&!g,playbackTimeStore:re,subtitleCues:$n}),Pe?a.jsxRuntimeExports.jsx("div",{ref:xe,"data-player-keyboard-shortcuts-ignore":"true",className:de.cn("slide-interaction-overlay",g&&m?"slide-interaction-overlay--with-player":"slide-interaction-overlay--standalone",ft&&"slide-interaction-overlay--dragging"),onClick:Et,onPointerDownCapture:e=>{Ct(e.target)&&We(!0)},onFocusCapture:e=>{Ct(e.target)&&We(!0)},onInputCapture:e=>{Ct(e.target)&&We(!0)},style:zn,children:a.jsxRuntimeExports.jsx(vn,{content:String(d?.content??""),locale:f,defaultButtonText:un.buttonText??"",defaultInputText:un.inputText??"",defaultSelectedValues:tr,confirmButtonText:X?.confirmButtonText??U.interactionTexts.confirmButtonText,copyButtonText:X?.copyButtonText??U.interactionTexts.copyButtonText,copiedButtonText:X?.copiedButtonText??U.interactionTexts.copiedButtonText,onSend:or,onDragHandlePointerCancel:mn,onDragHandlePointerDown:hr,onDragHandlePointerMove:xr,onDragHandlePointerUp:mn,readonly:rr,title:X?.title??et??U.interactionTexts.title})}):null,m?a.jsxRuntimeExports.jsx(Tr.PlayerKeyboardShortcutContext.Provider,{value:Mn,children:a.jsxRuntimeExports.jsx(Rr.default,{audioList:y,className:de.cn("absolute left-1/2 z-[2] -translate-x-1/2",zt?"bottom-3":"-bottom-3",V,!g&&"pointer-events-none opacity-0"),currentAudioIndex:v,defaultPlaying:st,enableKeyboardShortcuts:Q,isPlaybackPaused:W,isAutoAdvanceEnabled:Re,locale:f,hasInteraction:!!d,isInteractionOpen:ne,isSubtitleEnabled:Ht,onAutoAdvanceToggle:Kt,onLoadingChange:dr,onPlaybackStarted:()=>{He(!0)},onPlaybackPreferenceChange:er,onPlaybackTimeChange:re.setTime,onSubtitleToggle:()=>{Fn(e=>!e)},nextDisabled:!A,onEnded:fr,onFullscreen:ar,isFullscreen:Wt,mobileViewMode:oe,settingsPortalContainer:rt.current,onMobileViewModeChange:Yn,onControlsPointerEnter:pr,onControlsPointerLeave:yr,onInteractionToggle:mr,onNext:cr,onPrev:ir,onSubtitleJump:ur,canJumpToSubtitleTarget:vt,prevDisabled:!kn,showControls:g,subtitleSeekRequest:_n,texts:tt,customActionContext:xt,customActions:$,useAutoAdvanceToggle:we})}):null]})]})};exports.default=zr;
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("../../_virtual/jsx-runtime.cjs.js"),t=require("react"),Er=require("../../lib/sandboxInteraction.cjs.js"),de=require("../../lib/utils.cjs.js"),Ir=require("../ui/loading-overlay-card.cjs.js"),Rr=require("../ContentRender/ContentRender.cjs.js"),yn=require("../ContentRender/IframeSandbox.cjs.js");require("../ui/inputGroup/input-group.cjs.js");require("../ContentRender/contentRenderI18n.cjs.js");const Qe=require("../../lib/mobileDevice.cjs.js"),Ar=require("./Player.cjs.js"),Cr=require("./MarkdownSlideScaling.cjs.js"),wr=require("./SubtitleOverlay.cjs.js"),kr=require("./useSlide.cjs.js"),Tr=require("./useWakePlayerFromIframe.cjs.js"),Mr=require("./utils/playerKeyboardShortcutContext.cjs.js"),Pr=require("./utils/playerKeyboardShortcuts.cjs.js"),Oe=require("./utils/mobileScreenMode.cjs.js"),Ze=require("./utils/interactionPlayback.cjs.js"),_r=require("./utils/markdownScaling.cjs.js"),Rt=require("./utils/playerNavigationContext.cjs.js"),Or=require("./utils/appendedMarkerAdvance.cjs.js"),hn=require("./utils/playbackSequence.cjs.js"),At=require("./utils/subtitleJumpNavigation.cjs.js"),xn=require("./utils/playerCustomActions.cjs.js"),jr=require("./utils/playbackTimeStore.cjs.js"),qr=require("./utils/interactionResolution.cjs.js"),Fr=require("./utils/playerToggleMode.cjs.js"),Sn=require("./utils/imageOnlyStepVisualReady.cjs.js"),Br=require("./utils/silentStepAutoAdvance.cjs.js"),Dr=require("./utils/playerVisibility.cjs.js"),vn=require("./slideI18n.cjs.js");;/* empty css */const Ct=require("../../node_modules/lucide-react/dist/esm/icons/grip-horizontal.cjs.js"),Nr=require("../../node_modules/lucide-react/dist/esm/icons/chevron-left.cjs.js"),Lr=2e3,Vr=300,Kr=160,Ur=16,bn=3e3,gn={x:0,y:0},Hr=typeof window>"u"?t.useEffect:t.useLayoutEffect,Yr=["button","input","textarea",'[contenteditable=""]','[contenteditable="true"]','[contenteditable="plaintext-only"]'].join(", "),kt="waitingForAudio",Wr=(i,f)=>typeof i=="string"?i:i[f]??i[kt]??vn.DEFAULT_SLIDE_BUFFERING_TEXTS[f],Gr=(i,f)=>typeof i=="string"?i:{...f,...i},Jr=(i,f)=>f?i!=="loadingAudio":!1,En=t.memo(({content:i,title:f,locale:L,defaultButtonText:fe,defaultInputText:V,defaultSelectedValues:K,confirmButtonText:$,copyButtonText:z,copiedButtonText:je,onSend:et,onDragHandlePointerCancel:X,onDragHandlePointerDown:tt,onDragHandlePointerMove:me,onDragHandlePointerUp:qe,readonly:Fe=!1})=>a.jsxRuntimeExports.jsxs("div",{className:"slide-player__interaction-card",children:[a.jsxRuntimeExports.jsx("button",{type:"button",className:"slide-player__interaction-drag-handle","aria-label":"Move interaction",onPointerCancel:X,onPointerDown:tt,onPointerMove:me,onPointerUp:qe,children:a.jsxRuntimeExports.jsxs("span",{className:"slide-player__interaction-drag-handle-icon",children:[a.jsxRuntimeExports.jsx(Ct.default,{"aria-hidden":"true"}),a.jsxRuntimeExports.jsx(Ct.default,{"aria-hidden":"true"}),a.jsxRuntimeExports.jsx(Ct.default,{"aria-hidden":"true"})]})}),a.jsxRuntimeExports.jsx("div",{className:"slide-player__interaction-header",children:a.jsxRuntimeExports.jsx("p",{className:"slide-player__interaction-title",children:f})}),a.jsxRuntimeExports.jsx("div",{className:"slide-player__interaction-body",children:a.jsxRuntimeExports.jsx(Rr.default,{content:i,locale:L,defaultButtonText:fe,defaultInputText:V,defaultSelectedValues:K,confirmButtonText:$,copyButtonText:z,copiedButtonText:je,onSend:et,readonly:Fe,sandboxMode:"content"})})]}));En.displayName="InteractionOverlayCard";const $r=(i,f)=>i.length===f.length&&i.every((L,fe)=>{const V=f[fe];return L.sequence_number===V?.sequence_number&&L.type===V?.type&&L.content===V?.content}),wt=i=>i instanceof HTMLElement&&!!i.closest(Yr),zr=({elementList:i=[],locale:f,playerEnabled:L,playerControlsVisibility:fe,playerClassName:V,fullscreenHeader:K,playerCustomActions:$,playerCustomActionPauseOnActive:z=!0,bufferingText:je,interactionTitle:et,interactionTexts:X,playerTexts:tt,playerAutoHideDelay:me=3e3,markerAutoAdvanceDelay:qe=Lr,interactionDefaultValueOptions:Fe,onSend:Tt,onPlayerVisibilityChange:nt,onMobileViewModeChange:Mt,onStepChange:Pt,enableKeyboardShortcuts:Q=!0,enableIframeScaling:In=!0,enableMarkdownScaling:Rn=!0,disableLoadingOverlay:C=!1,className:An,onPointerDown:_t,onFocusCapture:Ot,...Cn})=>{const U=t.useMemo(()=>vn.getSlideLocaleTexts(f),[f]),wn=t.useMemo(()=>Gr(je,U.bufferingText),[je,U.bufferingText]),{playerEnabled:kn,playerControlsVisibility:F}=Dr.resolveSlidePlayerVisibility({playerEnabled:L,playerControlsVisibility:fe}),Be=t.useId(),pe=t.useRef(null),rt=t.useRef(null),De=t.useRef(null),jt=t.useRef(null),Z=t.useRef(null),Ne=t.useRef(!1),ye=t.useRef(null),Le=t.useRef(null),H=t.useRef(null),he=t.useRef(null),xe=t.useRef(null),Se=t.useRef(null),be=t.useRef(null),qt=t.useRef([]),ge=t.useRef(!1),Y=t.useRef(null),ve=t.useRef(null),Ft=t.useRef(0),Bt=t.useRef(null),Dt=t.useRef({markerCount:0,currentIndex:-1,canGoNext:!1}),ot=t.useRef(!1),{currentElementList:R,stepElementLists:Nt,slideElementList:I,currentIndex:u,audioList:y,audioSlideIndexes:Ve,currentAudioSequenceIndexes:Ke,currentStepHasSpeakableElement:h,currentInteractionElement:c,canGoPrev:Tn,canGoNext:A,handlePrev:Lt,handleNext:w,handleGoTo:Vt}=kr.default(i),Ee=t.useMemo(()=>{if(!(u<0))return I[u]},[u,I]),ee=t.useMemo(()=>R.map((e,n)=>`${e.sequence_number??`${e.type}-${n}`}:${String(e.is_new??"")}`),[R]),Mn=I.filter(e=>e.is_renderable!==!1).length===1,m=kn&&(I.length>0||y.length>0||!!c),Pn=t.useMemo(()=>({enabled:Q,ownerId:Be}),[Q,Be]),B=t.useCallback(()=>{!Q||!m||Pr.activatePlayerKeyboardShortcutOwner(Be)},[Q,Be,m]),k=t.useMemo(()=>Ke.map(e=>y[e]?.audioKey).filter(e=>!!e),[y,Ke]),[_n,Ie]=t.useState(!0),[Ue,te]=t.useState(!1),[st,Kt]=t.useState(!0),[Re,Ut]=t.useState(!0),[b,D]=t.useState(null),[On,Ht]=t.useState(null),[jn,x]=t.useState(!1),[qn,lt]=t.useState(kt),[T,at]=t.useState(!1),[Fn,He]=t.useState(!1),[Yt,Bn]=t.useState(!0),[ut,it]=t.useState(!1),[d,ct]=t.useState(),[ne,Ye]=t.useState(!1),[Wt,We]=t.useState(!1),[S,dt]=t.useState(gn),[ft,mt]=t.useState(!1),[Dn,Ae]=t.useState(0),[Gt,Nn]=t.useState(!1),j=t.useMemo(()=>Qe.isMobileDevice(),[]),[Ge,pt]=t.useState(Oe.DEFAULT_MOBILE_VIEW_MODE),[Jt,yt]=t.useState(!1),[Ln,$t]=t.useState(()=>j?Qe.isLandscapeViewport():!1),re=t.useMemo(()=>jr.createPlaybackTimeStore(),[]),{effectiveMobileViewMode:oe,isImmersiveMobileFullscreen:se,isNativeMobileFullscreen:zt,shouldRotateFullscreenViewport:Vn}=t.useMemo(()=>Oe.resolveMobileViewModeState({hasManualMobileViewMode:Jt,isMobileDevice:j,mobileViewMode:Ge}),[Jt,j,Ln,Ge]),Kn=t.useRef(oe),g=m&&F!=="hidden"&&(F==="visible"||_n),Un=se&&g,Hn=se&&g,Yn=se||zt,Xt=Gt&&!j,Wn=t.useCallback(e=>{yt(!0),pt(e)},[]),Qt=t.useCallback(()=>{yt(!1),pt(Oe.DEFAULT_MOBILE_VIEW_MODE)},[]),Gn=t.useCallback(()=>{Qt(),K?.onBack?.()},[K,Qt]),Zt=t.useCallback(e=>{it(e)},[]),en=t.useCallback(()=>{it(e=>!e)},[]),{mountedStepStates:Jn,currentMountedStateIndex:$n}=t.useMemo(()=>{const e=[],n=new Map;return Nt.forEach((o,s)=>{const l=e.findIndex(r=>$r(r.elementList,o));if(l>=0){e[l]?.sourceStepIndexes.push(s),n.set(s,l);return}e.push({elementList:o,sourceStepIndexes:[s]}),n.set(s,e.length-1)}),{mountedStepStates:e,currentMountedStateIndex:u>=0?n.get(u)??-1:-1}},[u,Nt]),tn=t.useMemo(()=>String(u),[u]),v=t.useMemo(()=>b?y.findIndex(e=>(e.audioKey??"")===b):-1,[y,b]),ht=t.useMemo(()=>v>=0?y[v]:void 0,[y,v]),zn=ht?.element?.subtitle_cues??[],Je=t.useMemo(()=>k[0]??"none",[k]),xt=t.useMemo(()=>({currentElement:xn.resolvePlayerCustomActionElement({currentAudioIndex:v,currentAudioSequenceIndexes:Ke,audioList:y,currentInteractionElement:d,currentStepElement:Ee}),currentIndex:u,currentStepElement:Ee,isActive:ut,setActive:Zt,toggleActive:en}),[d,y,v,Ke,u,Ee,ut,Zt,en]),St=t.useMemo(()=>xn.getPlayerCustomActionCount($,xt),[xt,$]),Xn=t.useMemo(()=>({"--slide-player-custom-action-count":String(St),"--slide-player-mobile-control-count":String(St+4),"--slide-interaction-drag-x":`${S.x}px`,"--slide-interaction-drag-y":`${S.y}px`}),[S.x,S.y,St]),nn=k.length>0,rn=t.useMemo(()=>c?`${c.sequence_number??"none"}:${String(c.content??"")}`:"none",[c]),Ce=t.useMemo(()=>[tn,rn].join("|"),[rn,tn]),Qn=t.useMemo(()=>[Ce,ht?.audioKey??"none",String(v)].join("|"),[v,ht?.audioKey,Ce]),on=!!t.useMemo(()=>!Je||Je==="none"?"":y.find(n=>n.audioKey===Je)?.audioUrl?.trim()??"",[y,Je]),W=z&&!!$&&ut,we=t.useMemo(()=>Fr.shouldUseAutoAdvanceToggle({canGoNext:A,currentAudioIndex:v,currentStepHasSpeakableElement:h,hasInteraction:!!c}),[A,v,c,h]),sn=t.useMemo(()=>Br.resolveSilentStepAutoAdvanceBehavior({currentElementList:R,currentStepHasSpeakableElement:h,currentInteractionElement:c,markerAutoAdvanceDelay:qe}),[R,c,h,qe]),ln=sn.delayMs,ke=sn.usesImageOnlyDelay,bt=t.useMemo(()=>`${u}:${ee.join("|")}`,[u,ee]),[Zn,er]=t.useState(null),an=!ke||Zn===bt,q=t.useCallback(()=>{Z.current!==null&&(window.clearTimeout(Z.current),Z.current=null)},[]),M=t.useCallback(()=>{H.current!==null&&(window.clearTimeout(H.current),H.current=null)},[]),P=t.useCallback(()=>{he.current!==null&&(window.clearTimeout(he.current),he.current=null)},[]),le=t.useCallback(()=>{ye.current!==null&&(window.clearTimeout(ye.current),ye.current=null)},[]),N=t.useCallback(()=>{Le.current!==null&&(window.clearTimeout(Le.current),Le.current=null)},[]),_=t.useCallback((e={})=>{le(),M(),P(),N(),D(null),re.reset(),x(!1),lt(kt),at(!1),He(!1),Ht(null),e.preservePendingSubtitleJump||(ve.current=null),ct(void 0),Ye(!1),Ae(0)},[le,N,M,P,re]),$e=t.useCallback(e=>{Ft.current+=1,Ht({...e,id:Ft.current})},[]),ae=t.useCallback(()=>{const e=k[0];return e?(D(e),!0):!1},[k]),Te=t.useCallback(()=>{M(),P(),Ye(!1),Ae(0),!ae()&&A&&w()},[A,M,P,w,ae]),un=t.useCallback(e=>{if(P(),!e)return;const n=()=>{he.current=null,Ae(Kr),Ye(!0),Y.current=null};he.current=window.setTimeout(n,Vr)},[P]),gt=t.useCallback(()=>Ne.current||!!pe.current?.querySelector(".slide-player__controls:hover"),[]),p=t.useCallback((e=Ue)=>{!m||F==="hidden"||(Ie(!0),q(),!(F==="visible"||!e||me<=0||gt())&&(Z.current=window.setTimeout(()=>{if(gt()){Z.current=null;return}Ie(!1),Z.current=null},me)))},[q,Ue,gt,me,F,m]),Me=!!At.hasResolvedInteractionElement(c),ue=!!c&&!Me,tr=t.useCallback(e=>{Kt(e)},[]),ie=t.useCallback(e=>{e&&Kt(e.shouldContinuePlayback)},[]);t.useEffect(()=>{Ut(st)},[u,st,z]),t.useEffect(()=>{z&&it(!1)},[u,z]),t.useEffect(()=>()=>{le(),N(),q(),M(),P()},[le,N,M,P,q]),t.useEffect(()=>{if(!ke){N();return}let e=!1,n=null,o=null;const s=()=>{o?.(),o=null},l=()=>{e||(s(),N(),er(bt))},r=()=>{if(e)return;s();const E=De.current?.querySelector('[data-active-step="true"]');if(!E)return;const O=Array.from(E.querySelectorAll("iframe"));if(O.length===0||Sn.areImageOnlyStepIframeVisualsReady(O)){l();return}const Xe=[],_e=()=>{e||(n!==null&&window.cancelAnimationFrame(n),n=window.requestAnimationFrame(()=>{n=null,r()}))},It=(G,ce,J)=>{G.addEventListener(ce,J,{once:!0}),Xe.push(()=>G.removeEventListener(ce,J))};O.forEach(G=>{const ce=G.contentDocument;if(!ce||ce.readyState!=="complete"){It(G,"load",_e);return}Array.from(ce.images).filter(J=>!J.complete).forEach(J=>{It(J,"load",_e),It(J,"error",_e)})}),o=()=>{Xe.forEach(G=>G())}};return n=window.requestAnimationFrame(()=>{n=null,r()}),Le.current=window.setTimeout(()=>{l()},Sn.DEFAULT_IMAGE_ONLY_VISUAL_READY_TIMEOUT_MS),()=>{e=!0,s(),N(),n!==null&&window.cancelAnimationFrame(n)}},[N,R,u,bt,ke]),t.useEffect(()=>(nt?.(g),()=>{nt?.(!1)}),[nt,g]),t.useEffect(()=>{g||(Ne.current=!1)},[g]),t.useEffect(()=>{j||Ge===Oe.DEFAULT_MOBILE_VIEW_MODE||(yt(!1),pt(Oe.DEFAULT_MOBILE_VIEW_MODE))},[j,Ge]),t.useEffect(()=>{if(!j){$t(!1);return}const e=()=>{$t(Qe.isLandscapeViewport())};return e(),Qe.subscribeMobileDeviceChange(e)},[j]),t.useEffect(()=>{Mt?.(oe)},[oe,Mt]),t.useEffect(()=>{Kn.current=oe},[oe]),t.useEffect(()=>{Pt?.(Ee,u)},[u,Ee,Pt]),t.useEffect(()=>{const e=Dt.current,n=Or.shouldAutoAdvanceIntoAppendedMarker({previousMarkerCount:e.markerCount,nextMarkerCount:I.length,previousIndex:e.currentIndex,previousCanGoNext:e.canGoNext,nextCanGoNext:A,currentAudioKey:b,hasCompletedCurrentStepAudio:T,hasResolvedCurrentInteraction:Me,currentStepHasSpeakableElement:h,currentInteractionElement:c,isAutoAdvanceEnabled:Re,shouldUseSilentStepAutoAdvanceToggle:we});Dt.current={markerCount:I.length,currentIndex:u,canGoNext:A},n&&w()},[A,b,u,c,h,w,T,Me,Re,we,I.length]),t.useEffect(()=>{if(!m||F==="hidden"){q(),Ie(!1);return}if(F==="visible"){q(),Ie(!0);return}Ue||p(!0)},[q,Ue,F,m,p]),t.useEffect(()=>{if(typeof window>"u")return;const e=n=>{n.origin===window.location.origin&&Er.isSandboxInteractionMessage(n.data)&&n.data.eventType==="click"&&m&&(B(),te(!0),p(!0))};return window.addEventListener("message",e),()=>{window.removeEventListener("message",e)}},[B,m,p]),Tr.default({sectionRef:pe,enabled:m,keyboardShortcutsEnabled:Q,onKeyboardShortcut:B,onWake:()=>{B(),te(!0),p(!0)}}),t.useEffect(()=>{if(!m){_();return}const{hasPlaybackContextChanged:e,shouldInitializeAudioSequence:n}=hn.getPlaybackSequenceTransition({previousResetKey:Bt.current,nextResetKey:Ce,currentAudioKey:b,hasCompletedCurrentStepAudio:T});Bt.current=Ce;const o=Y.current===u&&!!c,s=Ze.shouldPresentInteractionOverlay({hasInteraction:!!c,shouldBlockPlaybackForInteraction:ue,shouldOpenInteractionOverlayAfterAudio:o,hasPlaybackContextChanged:e,hasResolvedCurrentInteraction:Me,currentStepHasSpeakableElement:h}),l=ve.current,r=l?.slideIndex===u;if(e&&_({preservePendingSubtitleJump:r}),!(R.length===0&&!c)&&!W){if(l?.slideIndex===u&&At.canReachSubtitleJumpTarget({currentIndex:u,resolvedCurrentInteractionElement:d,slideElementList:I,targetSlideIndex:l.slideIndex})){ve.current=null,ot.current=!0,D(l.audioKey),$e({audioIndex:l.audioIndex,timeMs:l.timeMs});return}if(c&&ct(c),s){un(c);return}if(P(),Y.current=null,!!n&&!ae()){if(h){if(C){x(!1);return}x(!0);return}if(A&&!(we&&!Re)&&!(ke&&!an))return ye.current=window.setTimeout(()=>{ye.current=null,w()},ln),()=>{le()}}}},[d,A,le,R.length,u,c,b,Ce,h,ke,an,ln,w,T,C,Re,Me,ue,P,_,$e,un,m,I,ae,W,we]),t.useEffect(()=>{if(C||W||!h||ue){x(!1);return}if(T){x(!1);return}if(nn){x(!1);return}lt("waitingForAudio"),x(!0)},[nn,h,T,C,W,ue]),t.useEffect(()=>{const e=ot.current;ot.current=!1,hn.shouldStartDefaultAudioSequence({currentAudioKey:b,currentAudioSequenceLength:k.length,currentStepHasSpeakableElement:h,hasCompletedCurrentStepAudio:T,shouldBlockPlaybackForInteraction:ue,shouldPausePlaybackForCustomAction:W,shouldSkipDefaultAudioStart:e})&&ae()},[b,k,h,T,W,ue,ae]),t.useEffect(()=>{!b||v>=0||D(null)},[v,b]),t.useEffect(()=>{v>=0||re.reset()},[v,re]),t.useEffect(()=>{He(!1)},[Qn]);const{interactionDefaults:cn,interactionDefaultSelectedValues:nr,hasResolvedInteractionInput:dn,isInteractionReadonly:rr,shouldAutoContinueInteraction:fn}=t.useMemo(()=>qr.resolveSlideInteractionState(d,{interactionDefaultValueOptions:Fe}),[d,Fe]),or=!!d?.readonly||rr,Pe=Ze.shouldRenderInteractionOverlay({hasActiveInteraction:!!d,isInteractionOverlayOpen:ne}),sr=t.useCallback(e=>{const o=[...e.selectedValues??[],e.inputText?.trim()??"",e.buttonText?.trim()??""].filter(Boolean).join(", ");ct(s=>!s||!o?s:{...s,user_input:o}),Tt?.(e,d),Te()},[d,Te,Tt]);t.useEffect(()=>{const e=()=>{Nn(document.fullscreenElement===pe.current)};return e(),document.addEventListener("fullscreenchange",e),()=>{document.removeEventListener("fullscreenchange",e)}},[]),t.useEffect(()=>{d&&ne||We(!1)},[d,ne]),t.useEffect(()=>{dt(gn),mt(!1),be.current=null,Se.current=null},[d]),t.useEffect(()=>{if(!Pe){Ae(0);return}const e=xe.current;if(!e)return;const n=()=>{const s=Math.ceil(e.getBoundingClientRect().height);Ae(s+Ur)};if(n(),typeof ResizeObserver>"u")return;const o=new ResizeObserver(()=>{n()});return o.observe(e),()=>{o.disconnect()}},[Pe]),t.useEffect(()=>{if(M(),!!ne){if(fn)return H.current=window.setTimeout(()=>{H.current=null,Te()},bn),()=>{M()};if(!(Wt||!dn))return H.current=window.setTimeout(()=>{H.current=null,Te()},bn),()=>{M()}}},[M,Te,Wt,dn,ne,fn]);const lr=(e,n={})=>e?e.type==="slot"?a.jsxRuntimeExports.jsx(a.jsxRuntimeExports.Fragment,{children:e.content}):e.type==="html"?a.jsxRuntimeExports.jsx(yn.default,{className:"content-render-iframe",disableLoadingOverlay:C,hideFullScreen:!0,locale:f,mode:"blackboard",replaceRootScreenHeightWithFull:n.replaceRootScreenHeightWithFull,type:"sandbox",content:e.content,enableScaling:In}):a.jsxRuntimeExports.jsx(yn.default,{className:"content-render-iframe",disableLoadingOverlay:C,hideFullScreen:!0,locale:f,mode:"blackboard",type:"markdown",content:e.content}):null,ar=(e=[],n=!1)=>{if(e.length===0)return null;const o=e.filter(r=>r.is_renderable!==!1).length,s=n&&Rn?_r.resolveMarkdownScalingMode(e):"disabled",l=e.reduce((r,E,O)=>E.is_renderable!==!1?O:r,-1);return a.jsxRuntimeExports.jsx(Cr.default,{className:"slide-stage__content flex w-full flex-col gap-4",mode:s,children:e.map((r,E)=>{const O=r.type==="html"&&r.is_renderable===!1;return a.jsxRuntimeExports.jsx("div",{ref:n&&E===l?jt:null,"aria-hidden":O||void 0,className:de.cn("w-full shrink-0",o===1&&r.is_renderable!==!1&&"slide-element--single",O?"pointer-events-none fixed left-[-200vw] top-0 -z-10 h-[100dvh] w-[100vw] overflow-hidden opacity-0":r.is_renderable===!1&&"hidden"),children:lr(r,{replaceRootScreenHeightWithFull:o===1&&r.type==="html"&&r.is_renderable!==!1})},r.sequence_number??`${r.type}-${E}`)})})},ur=t.useCallback(()=>{const e=pe.current;if(e){if(document.fullscreenElement===e){document.exitFullscreen().catch(()=>{});return}e.requestFullscreen?.().catch(()=>{})}},[]),mn=t.useCallback(()=>{const e=De.current;e&&e.scrollTo({top:e.scrollHeight,behavior:"smooth"})},[]),vt=t.useCallback(e=>At.canReachSubtitleJumpTarget({currentIndex:u,resolvedCurrentInteractionElement:d,slideElementList:I,targetSlideIndex:Ve[e.audioIndex]}),[d,Ve,u,I]),ir=t.useCallback((e,n)=>{const s=y[e.audioIndex]?.audioKey,l=Ve[e.audioIndex];return!s||l==null||!vt(e)?!1:(ie(n),Y.current=null,x(!1),at(!1),He(!1),Rt.shouldWakePlayerControlsAfterNavigation(n)&&(te(!0),p(!0)),l===u?(ve.current=null,_(),D(s),$e(e),!0):(ge.current=!0,_(),ve.current={audioIndex:e.audioIndex,audioKey:s,slideIndex:l,timeMs:e.timeMs},Vt(l),!0))},[y,Ve,vt,u,Vt,$e,_,p,ie]),cr=t.useCallback(e=>{ie(e),ge.current=!0,Y.current=null,x(!1),Rt.shouldWakePlayerControlsAfterNavigation(e)&&(te(!0),p(!0)),_(),Lt()},[Lt,_,p,ie]),dr=t.useCallback(e=>{ie(e),ge.current=!0,Y.current=null,x(!1),Rt.shouldWakePlayerControlsAfterNavigation(e)&&(te(!0),p(!0)),_(),w()},[w,_,p,ie]),fr=t.useCallback(({loading:e,reason:n})=>{if(C){x(!1);return}if(!h||T){x(!1);return}e&&n&<(n),x(Jr(n,e))},[h,T,C]);t.useEffect(()=>{C&&x(!1)},[C]);const mr=t.useCallback(e=>{const n=y[e]?.audioKey;if(!n||!b||n!==b)return;const o=k.findIndex(r=>r===n);if(o<0){D(null);return}const s=o+1,l=k[s];if(l){D(l);return}if(D(null),at(!0),x(!1),A){const r=u+1,E=I[r];on&&E?.type==="interaction"&&(Y.current=r),w();return}},[y,A,u,b,k,w,on,I]),pr=t.useCallback(()=>{d&&Ye(e=>!e)},[d]),yr=t.useCallback(()=>{Ne.current=!0,q(),m&&Ie(!0)},[q,m]),hr=t.useCallback(()=>{Ne.current=!1,p(!0)},[p]),Et=t.useCallback(e=>{e.stopPropagation(),g&&p(!0)},[g,p]),ze=t.useCallback((e,n)=>{const o=rt.current;if(!o)return null;const s=e.getBoundingClientRect(),l=o.getBoundingClientRect();return{minX:n.x+l.left-s.left,maxX:n.x+l.right-s.right,minY:n.y+l.top-s.top,maxY:n.y+l.bottom-s.bottom}},[]);Hr(()=>{const e=xe.current;if(!Pe||!e){Se.current=null;return}const n=Se.current,o=e.getBoundingClientRect();if(!n||ft){Se.current=o;return}const s={x:S.x+n.left-o.left,y:S.y+n.top-o.top},l=ze(e,S),r=l?Ze.clampInteractionOverlayDragOffset(s,l):s;Se.current={left:o.left+r.x-S.x,top:o.top+r.y-S.y},(r.x!==S.x||r.y!==S.y)&&dt(r)},[ze,S,ft,g,m,Pe]);const xr=t.useCallback(e=>{if(Et(e),e.button!==0||!e.currentTarget.isConnected||!xe.current)return;const n=ze(xe.current,S);n&&(e.preventDefault(),e.currentTarget.setPointerCapture(e.pointerId),be.current={pointerId:e.pointerId,startClientX:e.clientX,startClientY:e.clientY,startOffset:S,bounds:n},mt(!0))},[ze,S,Et]),Sr=t.useCallback(e=>{const n=be.current;!n||n.pointerId!==e.pointerId||(e.preventDefault(),e.stopPropagation(),dt(Ze.clampInteractionOverlayDragOffset({x:n.startOffset.x+e.clientX-n.startClientX,y:n.startOffset.y+e.clientY-n.startClientY},n.bounds)))},[]),pn=t.useCallback(e=>{const n=be.current;!n||n.pointerId!==e.pointerId||(e.stopPropagation(),e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId),be.current=null,mt(!1))},[]),br=t.useCallback(e=>{B(),_t?.(e)},[B,_t]),gr=t.useCallback(e=>{B(),Ot?.(e)},[B,Ot]),vr=t.useCallback(()=>{te(!0),p(!0)},[p]);return t.useEffect(()=>{const e=qt.current,s=(e.length>0&&e.length<ee.length&&e.every((r,E)=>r===ee[E])?R.slice(e.length):[]).some(r=>r.is_new===!1);if(qt.current=ee,!s)return;const l=window.requestAnimationFrame(()=>{const r=De.current,E=jt.current;if(!r||!E)return;const O=r.getBoundingClientRect(),Xe=E.getBoundingClientRect(),_e=r.scrollTop+(Xe.top-O.top);r.scrollTo({top:Math.max(_e,0),behavior:"smooth"})});return()=>{window.cancelAnimationFrame(l)}},[R,ee]),t.useEffect(()=>{if(!ge.current||(ge.current=!1,R.length===0))return;const e=window.requestAnimationFrame(()=>{mn()});return()=>{window.cancelAnimationFrame(e)}},[R,mn]),a.jsxRuntimeExports.jsxs("section",{ref:pe,className:de.cn("relative h-full w-full",j&&"slide--mobile-device",Xt&&"slide--browser-fullscreen",se&&"slide--mobile-landscape",zt&&"slide--mobile-landscape-native",An),onClick:vr,onFocusCapture:gr,onPointerDown:br,...Cn,children:[Yn?a.jsxRuntimeExports.jsx("div",{"aria-hidden":"true",className:"pointer-events-none fixed left-0 top-0 z-[9999] h-[100vh] max-h-[100vh] w-[100vw]"}):null,a.jsxRuntimeExports.jsxs("div",{ref:rt,className:de.cn("slide__viewport relative h-full min-h-0 w-full",se&&"slide__viewport--mobile-landscape",se&&!Vn&&"slide__viewport--mobile-landscape-native"),children:[Un?a.jsxRuntimeExports.jsxs("div",{className:"slide-landscape-header",children:[a.jsxRuntimeExports.jsx("button",{"aria-label":K?.backAriaLabel??U.fullscreenBackAriaLabel,className:"slide-landscape-header__back",onClick:Gn,type:"button",children:a.jsxRuntimeExports.jsx(Nr.default,{className:"slide-landscape-header__icon h-6 w-6",strokeWidth:2.25})}),K?.content?a.jsxRuntimeExports.jsx("div",{className:"min-w-0 flex-1 overflow-hidden",children:K.content}):null]}):null,a.jsxRuntimeExports.jsx("div",{className:de.cn("h-full min-h-0 w-full",Hn&&"slide__viewport-content--with-header",Mn?"slide-content--single":"grid gap-4"),children:R.length>0?a.jsxRuntimeExports.jsx("div",{className:"slide-stage",children:a.jsxRuntimeExports.jsx("div",{ref:De,className:"slide-stage__layer w-full",children:Jn.map((e,n)=>{const o=n===$n;return a.jsxRuntimeExports.jsx("div",{"data-active-step":o?"true":void 0,"aria-hidden":!o||void 0,className:"w-full h-full",style:{display:o?void 0:"none"},children:ar(e.elementList,o)},e.sourceStepIndexes[0]??n)})})}):null}),jn?a.jsxRuntimeExports.jsx(Ir.default,{message:Wr(wn,qn),className:"absolute left-1/2 top-1/2 z-[3] -translate-x-1/2 -translate-y-1/2"}):null,a.jsxRuntimeExports.jsx(wr.default,{extraBottomOffset:Dn,hasPlayerGap:g,isEnabled:Yt&&Fn,isPlayerHidden:m&&!g,playbackTimeStore:re,subtitleCues:zn}),Pe?a.jsxRuntimeExports.jsx("div",{ref:xe,"data-player-keyboard-shortcuts-ignore":"true",className:de.cn("slide-interaction-overlay",g&&m?"slide-interaction-overlay--with-player":"slide-interaction-overlay--standalone",ft&&"slide-interaction-overlay--dragging"),onClick:Et,onPointerDownCapture:e=>{wt(e.target)&&We(!0)},onFocusCapture:e=>{wt(e.target)&&We(!0)},onInputCapture:e=>{wt(e.target)&&We(!0)},style:Xn,children:a.jsxRuntimeExports.jsx(En,{content:String(d?.content??""),locale:f,defaultButtonText:cn.buttonText??"",defaultInputText:cn.inputText??"",defaultSelectedValues:nr,confirmButtonText:X?.confirmButtonText??U.interactionTexts.confirmButtonText,copyButtonText:X?.copyButtonText??U.interactionTexts.copyButtonText,copiedButtonText:X?.copiedButtonText??U.interactionTexts.copiedButtonText,onSend:sr,onDragHandlePointerCancel:pn,onDragHandlePointerDown:xr,onDragHandlePointerMove:Sr,onDragHandlePointerUp:pn,readonly:or,title:X?.title??et??U.interactionTexts.title})}):null,m?a.jsxRuntimeExports.jsx(Mr.PlayerKeyboardShortcutContext.Provider,{value:Pn,children:a.jsxRuntimeExports.jsx(Ar.default,{audioList:y,className:de.cn("absolute left-1/2 z-[2] -translate-x-1/2",Xt?"bottom-3":"-bottom-3",V,!g&&"pointer-events-none opacity-0"),currentAudioIndex:v,defaultPlaying:st,enableKeyboardShortcuts:Q,isPlaybackPaused:W,isAutoAdvanceEnabled:Re,locale:f,hasInteraction:!!d,isInteractionOpen:ne,isSubtitleEnabled:Yt,onAutoAdvanceToggle:Ut,onLoadingChange:fr,onPlaybackStarted:()=>{He(!0)},onPlaybackPreferenceChange:tr,onPlaybackTimeChange:re.setTime,onSubtitleToggle:()=>{Bn(e=>!e)},nextDisabled:!A,onEnded:mr,onFullscreen:ur,isFullscreen:Gt,mobileViewMode:oe,settingsPortalContainer:rt.current,onMobileViewModeChange:Wn,onControlsPointerEnter:yr,onControlsPointerLeave:hr,onInteractionToggle:pr,onNext:dr,onPrev:cr,onSubtitleJump:ir,canJumpToSubtitleTarget:vt,prevDisabled:!Tn,showControls:g,subtitleSeekRequest:On,texts:tt,customActionContext:xt,customActions:$,useAutoAdvanceToggle:we})}):null]})]})};exports.default=zr;
|
|
2
2
|
//# sourceMappingURL=Slide.cjs.js.map
|