@pie-element/multiple-choice 13.2.0-next.1 → 13.2.0-next.19
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/configure/package.json +3 -3
- package/controller/package.json +1 -1
- package/lib/choice-input.js +1 -7
- package/lib/choice-input.js.map +1 -1
- package/lib/choice.js +2 -7
- package/lib/choice.js.map +1 -1
- package/lib/index.js +0 -5
- package/lib/index.js.map +1 -1
- package/lib/multiple-choice.js +8 -23
- package/lib/multiple-choice.js.map +1 -1
- package/module/configure.js +1 -1
- package/module/element.js +1 -1
- package/module/index.html +1 -1
- package/module/manifest.json +3 -3
- package/module/print.html +1 -1
- package/module/print.js +1 -1
- package/package.json +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multiple-choice.js","names":["_react","_interopRequireDefault","require","_propTypes","_correctAnswerToggle","_classnames","_styles","_Box","_renderUi","_translator","_choice","translator","Translator","MainContainer","styled","Box","color","text","backgroundColor","background","position","border","PartLabel","theme","display","fontSize","margin","fontWeight","paddingBottom","spacing","TeacherInstructions","marginBottom","HorizontalLayout","flexDirection","flexWrap","GridLayout","StyledFieldset","padding","minWidth","outline","SrOnly","left","top","width","height","overflow","ErrorText","typography","palette","error","main","paddingTop","MultipleChoice","React","Component","constructor","props","_defineProperty2","default","event","value","checked","target","maxSelections","onChoiceChanged","session","length","setState","maxSelectionsErrorState","selected","selector","mode","showCorrect","state","onShowCorrectToggle","choice","isCorrect","correct","isChecked","isSelected","undefined","e","fieldset","currentTarget","activeEl","document","activeElement","contains","relatedTarget","compareDocumentPosition","Node","DOCUMENT_POSITION_PRECEDING","firstInputRef","current","focus","options","alwaysShowCorrect","onToggle","bind","createRef","sessionValue","indexOf","UNSAFE_componentWillReceiveProps","nextProps","correctResponse","indexToSymbol","index","keyMode","String","fromCharCode","toUpperCase","getChecked","isPrintMode","isEvaluateMode","renderHeading","choiceMode","includeSrHeading","baseHeadingLevel","partLabel","shouldRenderSrHeading","clampedLevel","Math","min","HeadingTag","withComponent","label","createElement","render","disabled","className","choices","gridColumns","prompt","responseCorrect","teacherInstructions","animationsDisabled","language","isSelectionButtonBelow","minSelections","autoplayAudioEnabled","customAudioButton","showCorrectAnswerToggle","columnsStyle","gridTemplateColumns","selections","getContentHeadingLevel","offset","contentHeadingLevel","transformPrompt","html","transformDataHeadings","teacherInstructionsDiv","PreviewPrompt","tagName","defaultClassName","getMultipleChoiceMinSelectionErrorMessage","t","lng","LayoutComponent","choicesLayout","id","classNames","as","Collapsible","labels","hidden","visible","tabIndex","onFocus","handleGroupFocus","role","show","toggled","style","map","autoFocusRef","selectedAnswerBackgroundColor","selectedAnswerStrokeColor","selectedAnswerStrokeWidth","hoverAnswerBackgroundColor","hoverAnswerStrokeColor","hoverAnswerStrokeWidth","key","choicesLength","handleChange","hideTick","correctness","getCorrectness","displayKey","exports","PropTypes","string","oneOf","array","object","bool","func","number","playImage","pauseImage","defaultProps","_default"],"sources":["../src/multiple-choice.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport CorrectAnswerToggle from '@pie-lib/correct-answer-toggle';\nimport classNames from 'classnames';\nimport { styled } from '@mui/material/styles';\nimport Box from '@mui/material/Box';\nimport { color, Collapsible, PreviewPrompt, transformDataHeadings } from '@pie-lib/render-ui';\nimport Translator from '@pie-lib/translator';\n\nimport Choice from './choice';\n\nconst { translator } = Translator;\n\nconst MainContainer = styled(Box)({\n color: color.text(),\n backgroundColor: color.background(),\n '& *': {\n '-webkit-font-smoothing': 'antialiased',\n },\n position: 'relative',\n // remove border from legend tags inside main to override the OT default styles\n '& legend': {\n border: 'none !important',\n },\n});\n\nconst PartLabel = styled('h2')(({ theme }) => ({\n display: 'block',\n fontSize: 'inherit',\n margin: '0',\n fontWeight: 'normal',\n paddingBottom: theme.spacing(2),\n}));\n\nconst TeacherInstructions = styled(Box)(({ theme }) => ({\n marginBottom: theme.spacing(2),\n}));\n\nconst HorizontalLayout = styled(Box)({\n display: 'flex',\n flexDirection: 'row',\n flexWrap: 'wrap',\n});\n\nconst GridLayout = styled(Box)({\n display: 'grid',\n});\n\nconst StyledFieldset = styled('fieldset')({\n border: '0px',\n padding: '0.01em 0 0 0',\n margin: '0px',\n minWidth: '0px',\n '&:focus': {\n outline: 'none',\n },\n});\n\nconst SrOnly = styled('h3')({\n position: 'absolute',\n left: '-10000px',\n top: 'auto',\n width: '1px',\n height: '1px',\n overflow: 'hidden',\n});\n\nconst ErrorText = styled('div')(({ theme }) => ({\n fontSize: theme.typography.fontSize - 2,\n color: theme.palette.error.main,\n paddingTop: theme.spacing(1),\n}));\n\nexport class MultipleChoice extends React.Component {\n static propTypes = {\n className: PropTypes.string,\n mode: PropTypes.oneOf(['gather', 'view', 'evaluate']),\n choiceMode: PropTypes.oneOf(['radio', 'checkbox']),\n keyMode: PropTypes.oneOf(['numbers', 'letters', 'none']),\n choices: PropTypes.array,\n partLabel: PropTypes.string,\n prompt: PropTypes.string,\n teacherInstructions: PropTypes.string,\n session: PropTypes.object,\n disabled: PropTypes.bool,\n onChoiceChanged: PropTypes.func,\n responseCorrect: PropTypes.bool,\n correctResponse: PropTypes.array,\n choicesLayout: PropTypes.oneOf(['vertical', 'grid', 'horizontal']),\n gridColumns: PropTypes.string,\n alwaysShowCorrect: PropTypes.bool,\n animationsDisabled: PropTypes.bool,\n language: PropTypes.string,\n selectedAnswerBackgroundColor: PropTypes.string,\n selectedAnswerStrokeColor: PropTypes.string,\n selectedAnswerStrokeWidth: PropTypes.string,\n hoverAnswerBackgroundColor: PropTypes.string,\n hoverAnswerStrokeColor: PropTypes.string,\n hoverAnswerStrokeWidth: PropTypes.string,\n onShowCorrectToggle: PropTypes.func,\n isSelectionButtonBelow: PropTypes.bool,\n minSelections: PropTypes.number,\n maxSelections: PropTypes.number,\n autoplayAudioEnabled: PropTypes.bool,\n customAudioButton: {\n playImage: PropTypes.string,\n pauseImage: PropTypes.string,\n },\n options: PropTypes.object,\n baseHeadingLevel: PropTypes.number,\n includeSrHeading: PropTypes.bool,\n };\n\n constructor(props) {\n super(props);\n\n this.state = {\n showCorrect: (this.props.options && this.props.alwaysShowCorrect) || false,\n maxSelectionsErrorState: false,\n };\n\n this.onToggle = this.onToggle.bind(this);\n this.firstInputRef = React.createRef();\n }\n\n isSelected(value) {\n const sessionValue = this.props.session && this.props.session.value;\n\n return sessionValue && sessionValue.indexOf && sessionValue.indexOf(value) >= 0;\n }\n\n // handleChange was added for accessibility. Please see comments and videos from PD-2441.\n handleChange = (event) => {\n const { value, checked } = event.target;\n const { maxSelections, onChoiceChanged, session } = this.props;\n\n if (session.value && session.value.length >= maxSelections) {\n // show/hide max selections error when user select/deselect an answer\n this.setState({ maxSelectionsErrorState: checked });\n\n if (checked) {\n // prevent selecting more answers\n return;\n }\n }\n\n onChoiceChanged({ value, selected: checked, selector: 'Mouse' });\n };\n\n onToggle = () => {\n if (this.props.mode === 'evaluate') {\n this.setState({ showCorrect: !this.state.showCorrect }, () => {\n if (this.props.onShowCorrectToggle) {\n this.props.onShowCorrectToggle();\n }\n });\n }\n };\n\n UNSAFE_componentWillReceiveProps(nextProps) {\n if (!nextProps.correctResponse && this.state.showCorrect !== false) {\n this.setState({ showCorrect: false }, () => {\n if (this.props.onShowCorrectToggle) {\n this.props.onShowCorrectToggle();\n }\n });\n }\n\n if (nextProps.options && nextProps.alwaysShowCorrect && this.state.showCorrect !== true) {\n this.setState({ showCorrect: true }, () => {\n if (this.props.onShowCorrectToggle) {\n this.props.onShowCorrectToggle();\n }\n });\n }\n }\n\n indexToSymbol(index) {\n if (this.props.keyMode === 'numbers') {\n return `${index + 1}`;\n }\n\n if (this.props.keyMode === 'letters') {\n return String.fromCharCode(97 + index).toUpperCase();\n }\n\n return '';\n }\n\n getCorrectness = (choice = {}) => {\n const isCorrect = choice.correct;\n const isChecked = this.isSelected(choice.value);\n\n if (this.state.showCorrect) {\n return isCorrect ? 'correct' : undefined;\n }\n\n if (isCorrect) {\n if (isChecked) {\n // A correct answer is selected: marked with a green checkmark\n return 'correct';\n } else {\n // A correct answer is NOT selected: marked with an orange X\n return 'incorrect';\n }\n } else {\n if (isChecked) {\n // An incorrect answer is selected: marked with an orange X\n return 'incorrect';\n } else {\n // An incorrect answer is NOT selected: not marked\n return undefined;\n }\n }\n };\n\n getChecked(choice) {\n // check for print context: options prop is passed from print.js and alwaysShowCorrect is true\n const isPrintMode = this.props.options && this.props.alwaysShowCorrect;\n\n if (isPrintMode) {\n return choice.correct || false;\n }\n\n // evaluate mode with show correct toggled\n const isEvaluateMode = this.state.showCorrect && this.props.mode === 'evaluate';\n\n if (isEvaluateMode) {\n return choice.correct || false;\n }\n\n // default behavior: show what the user has selected\n return this.isSelected(choice.value);\n }\n\n // renderHeading function was added for accessibility.\n renderHeading() {\n const { mode, choiceMode, includeSrHeading, baseHeadingLevel, partLabel } = this.props;\n\n // When a part label is present the item is an EBSR part — the SR heading\n // is provided by the EBSR element, not here.\n const shouldRenderSrHeading = !partLabel && includeSrHeading !== false;\n\n if (!shouldRenderSrHeading || mode !== 'gather') {\n return null;\n }\n\n const clampedLevel = baseHeadingLevel ? Math.min(6, baseHeadingLevel) : 2;\n const HeadingTag = SrOnly.withComponent(`h${clampedLevel}`);\n const label = choiceMode === 'radio' ? 'Multiple Choice Question' : 'Multiple Select Question';\n\n return <HeadingTag>{label}</HeadingTag>;\n }\n\n handleGroupFocus = (e) => {\n const fieldset = e.currentTarget;\n const activeEl = document.activeElement;\n\n if (fieldset.contains(activeEl) && activeEl !== fieldset) {\n return;\n }\n\n // Only focus the first input if user is tabbing forward\n if (!e.relatedTarget || fieldset.compareDocumentPosition(e.relatedTarget) & Node.DOCUMENT_POSITION_PRECEDING) {\n if (this.firstInputRef?.current) {\n this.firstInputRef.current.focus();\n }\n }\n };\n\n render() {\n const {\n mode,\n disabled,\n className,\n choices = [],\n choiceMode,\n gridColumns,\n partLabel,\n prompt,\n responseCorrect,\n teacherInstructions,\n alwaysShowCorrect,\n animationsDisabled,\n language,\n isSelectionButtonBelow,\n minSelections,\n maxSelections,\n autoplayAudioEnabled,\n session,\n customAudioButton,\n options,\n baseHeadingLevel,\n } = this.props;\n const { showCorrect, maxSelectionsErrorState } = this.state;\n const isEvaluateMode = mode === 'evaluate';\n const showCorrectAnswerToggle = isEvaluateMode && !responseCorrect;\n const columnsStyle = gridColumns > 1 ? { gridTemplateColumns: `repeat(${gridColumns}, 1fr)` } : undefined;\n const selections = (session.value && session.value.length) || 0;\n\n // Heading levels are optional and only applied when baseHeadingLevel is provided.\n const getContentHeadingLevel = () => {\n if (!baseHeadingLevel) return undefined;\n // SR heading (rendered or external) sits at baseHeadingLevel.\n // Content is always one below that; part label (EBSR) sits between them.\n let offset = 1; // content default: baseHeadingLevel + 1\n if (partLabel) offset += 1; // part label at base + 1, content pushed to base + 2\n return Math.min(6, baseHeadingLevel + offset);\n };\n const contentHeadingLevel = getContentHeadingLevel();\n const transformPrompt = (html) => (html && contentHeadingLevel) ? transformDataHeadings(html, contentHeadingLevel) : html;\n\n const teacherInstructionsDiv = (\n <PreviewPrompt\n tagName=\"div\"\n className=\"prompt\"\n defaultClassName=\"teacher-instructions\"\n prompt={teacherInstructions}\n />\n );\n\n const getMultipleChoiceMinSelectionErrorMessage = () => {\n if (minSelections && maxSelections) {\n return minSelections === maxSelections\n ? translator.t('translation:multipleChoice:minmaxSelections_equal', { lng: language, minSelections })\n : translator.t('translation:multipleChoice:minmaxSelections_range', {\n lng: language,\n minSelections,\n maxSelections,\n });\n }\n\n if (minSelections) {\n return translator.t('translation:multipleChoice:minSelections', { lng: language, minSelections });\n }\n\n return '';\n };\n\n const LayoutComponent = this.props.choicesLayout === 'grid'\n ? GridLayout\n : this.props.choicesLayout === 'horizontal'\n ? HorizontalLayout\n : Box;\n\n return (\n <MainContainer id={'main-container'} className={classNames(className, 'multiple-choice')}>\n {partLabel && <PartLabel as={baseHeadingLevel ? `h${Math.min(6, baseHeadingLevel + 1)}` : 'h2'}>{partLabel}</PartLabel>}\n\n {this.renderHeading()}\n\n {teacherInstructions && (\n <TeacherInstructions>\n {!animationsDisabled ? (\n <Collapsible\n labels={{\n hidden: 'Show Teacher Instructions',\n visible: 'Hide Teacher Instructions',\n }}\n >\n {teacherInstructionsDiv}\n </Collapsible>\n ) : (\n teacherInstructionsDiv\n )}\n </TeacherInstructions>\n )}\n\n <StyledFieldset\n tabIndex={0}\n onFocus={this.handleGroupFocus}\n role={choiceMode === 'radio' ? 'radiogroup' : 'group'}\n >\n <PreviewPrompt\n className=\"prompt\"\n defaultClassName=\"prompt\"\n prompt={transformPrompt(prompt)}\n tagName={'legend'}\n autoplayAudioEnabled={autoplayAudioEnabled}\n customAudioButton={customAudioButton}\n />\n\n {!(options && alwaysShowCorrect) && (\n <CorrectAnswerToggle\n show={showCorrectAnswerToggle}\n toggled={showCorrect}\n onToggle={this.onToggle.bind(this)}\n language={language}\n />\n )}\n\n <LayoutComponent style={columnsStyle}>\n {choices.map((choice, index) => (\n <Choice\n autoFocusRef={index === 0 ? this.firstInputRef : null}\n choicesLayout={this.props.choicesLayout}\n selectedAnswerBackgroundColor={this.props.selectedAnswerBackgroundColor}\n selectedAnswerStrokeColor={this.props.selectedAnswerStrokeColor}\n selectedAnswerStrokeWidth={this.props.selectedAnswerStrokeWidth}\n hoverAnswerBackgroundColor={this.props.hoverAnswerBackgroundColor}\n hoverAnswerStrokeColor={this.props.hoverAnswerStrokeColor}\n hoverAnswerStrokeWidth={this.props.hoverAnswerStrokeWidth}\n gridColumns={gridColumns}\n key={`choice-${index}`}\n choice={choice}\n index={index}\n choicesLength={choices.length}\n showCorrect={showCorrect}\n isEvaluateMode={isEvaluateMode}\n choiceMode={choiceMode}\n disabled={disabled}\n tagName={partLabel ? `group-${partLabel}` : 'group'}\n onChoiceChanged={this.handleChange}\n hideTick={choice.hideTick}\n checked={this.getChecked(choice)}\n correctness={isEvaluateMode ? this.getCorrectness(choice) : undefined}\n displayKey={this.indexToSymbol(index)}\n isSelectionButtonBelow={isSelectionButtonBelow}\n />\n ))}\n </LayoutComponent>\n </StyledFieldset>\n\n {choiceMode === 'checkbox' && selections < minSelections && (\n <ErrorText>{getMultipleChoiceMinSelectionErrorMessage()}</ErrorText>\n )}\n {choiceMode === 'checkbox' && maxSelectionsErrorState && (\n <ErrorText>\n {translator.t(`translation:multipleChoice:maxSelections_${maxSelections === 1 ? 'one' : 'other'}`, {\n lng: language,\n maxSelections,\n })}\n </ErrorText>\n )}\n </MainContainer>\n );\n }\n}\n\nMultipleChoice.defaultProps = {\n session: {\n value: [],\n },\n};\n\nexport default MultipleChoice;\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,oBAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,WAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,IAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AACA,IAAAO,WAAA,GAAAR,sBAAA,CAAAC,OAAA;AAEA,IAAAQ,OAAA,GAAAT,sBAAA,CAAAC,OAAA;AAEA,MAAM;EAAES;AAAW,CAAC,GAAGC,mBAAU;AAEjC,MAAMC,aAAa,GAAG,IAAAC,cAAM,EAACC,YAAG,CAAC,CAAC;EAChCC,KAAK,EAAEA,eAAK,CAACC,IAAI,CAAC,CAAC;EACnBC,eAAe,EAAEF,eAAK,CAACG,UAAU,CAAC,CAAC;EACnC,KAAK,EAAE;IACL,wBAAwB,EAAE;EAC5B,CAAC;EACDC,QAAQ,EAAE,UAAU;EACpB;EACA,UAAU,EAAE;IACVC,MAAM,EAAE;EACV;AACF,CAAC,CAAC;AAEF,MAAMC,SAAS,GAAG,IAAAR,cAAM,EAAC,IAAI,CAAC,CAAC,CAAC;EAAES;AAAM,CAAC,MAAM;EAC7CC,OAAO,EAAE,OAAO;EAChB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propTypes","_correctAnswerToggle","_classnames","_styles","_Box","_renderUi","_translator","_choice","translator","Translator","MainContainer","styled","Box","color","text","backgroundColor","background","position","border","PartLabel","theme","display","fontSize","margin","fontWeight","paddingBottom","spacing","TeacherInstructions","marginBottom","HorizontalLayout","flexDirection","flexWrap","GridLayout","StyledFieldset","padding","minWidth","SrOnly","left","top","width","height","overflow","ErrorText","typography","palette","error","main","paddingTop","MultipleChoice","React","Component","constructor","props","_defineProperty2","default","event","value","checked","target","maxSelections","onChoiceChanged","session","length","setState","maxSelectionsErrorState","selected","selector","mode","showCorrect","state","onShowCorrectToggle","choice","isCorrect","correct","isChecked","isSelected","undefined","options","alwaysShowCorrect","onToggle","bind","groupName","Math","random","toString","slice","sessionValue","indexOf","UNSAFE_componentWillReceiveProps","nextProps","correctResponse","indexToSymbol","index","keyMode","String","fromCharCode","toUpperCase","getChecked","isPrintMode","isEvaluateMode","renderHeading","choiceMode","includeSrHeading","baseHeadingLevel","partLabel","shouldRenderSrHeading","clampedLevel","min","HeadingTag","withComponent","label","createElement","render","disabled","className","choices","gridColumns","prompt","responseCorrect","teacherInstructions","animationsDisabled","language","isSelectionButtonBelow","minSelections","autoplayAudioEnabled","customAudioButton","showCorrectAnswerToggle","columnsStyle","gridTemplateColumns","selections","getContentHeadingLevel","offset","contentHeadingLevel","transformPrompt","html","transformDataHeadings","teacherInstructionsDiv","PreviewPrompt","tagName","defaultClassName","getMultipleChoiceMinSelectionErrorMessage","t","lng","LayoutComponent","choicesLayout","id","classNames","as","Collapsible","labels","hidden","visible","role","show","toggled","style","map","selectedAnswerBackgroundColor","selectedAnswerStrokeColor","selectedAnswerStrokeWidth","hoverAnswerBackgroundColor","hoverAnswerStrokeColor","hoverAnswerStrokeWidth","key","choicesLength","handleChange","hideTick","correctness","getCorrectness","displayKey","exports","PropTypes","string","oneOf","array","object","bool","func","number","playImage","pauseImage","defaultProps","_default"],"sources":["../src/multiple-choice.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport CorrectAnswerToggle from '@pie-lib/correct-answer-toggle';\nimport classNames from 'classnames';\nimport { styled } from '@mui/material/styles';\nimport Box from '@mui/material/Box';\nimport { color, Collapsible, PreviewPrompt, transformDataHeadings } from '@pie-lib/render-ui';\nimport Translator from '@pie-lib/translator';\n\nimport Choice from './choice';\n\nconst { translator } = Translator;\n\nconst MainContainer = styled(Box)({\n color: color.text(),\n backgroundColor: color.background(),\n '& *': {\n '-webkit-font-smoothing': 'antialiased',\n },\n position: 'relative',\n // remove border from legend tags inside main to override the OT default styles\n '& legend': {\n border: 'none !important',\n },\n});\n\nconst PartLabel = styled('h2')(({ theme }) => ({\n display: 'block',\n fontSize: 'inherit',\n margin: '0',\n fontWeight: 'normal',\n paddingBottom: theme.spacing(2),\n}));\n\nconst TeacherInstructions = styled(Box)(({ theme }) => ({\n marginBottom: theme.spacing(2),\n}));\n\nconst HorizontalLayout = styled(Box)({\n display: 'flex',\n flexDirection: 'row',\n flexWrap: 'wrap',\n});\n\nconst GridLayout = styled(Box)({\n display: 'grid',\n});\n\nconst StyledFieldset = styled('fieldset')({\n border: '0px',\n padding: '0.01em 0 0 0',\n margin: '0px',\n minWidth: '0px',\n});\n\nconst SrOnly = styled('h3')({\n position: 'absolute',\n left: '-10000px',\n top: 'auto',\n width: '1px',\n height: '1px',\n overflow: 'hidden',\n});\n\nconst ErrorText = styled('div')(({ theme }) => ({\n fontSize: theme.typography.fontSize - 2,\n color: theme.palette.error.main,\n paddingTop: theme.spacing(1),\n}));\n\nexport class MultipleChoice extends React.Component {\n static propTypes = {\n className: PropTypes.string,\n mode: PropTypes.oneOf(['gather', 'view', 'evaluate']),\n choiceMode: PropTypes.oneOf(['radio', 'checkbox']),\n keyMode: PropTypes.oneOf(['numbers', 'letters', 'none']),\n choices: PropTypes.array,\n partLabel: PropTypes.string,\n prompt: PropTypes.string,\n teacherInstructions: PropTypes.string,\n session: PropTypes.object,\n disabled: PropTypes.bool,\n onChoiceChanged: PropTypes.func,\n responseCorrect: PropTypes.bool,\n correctResponse: PropTypes.array,\n choicesLayout: PropTypes.oneOf(['vertical', 'grid', 'horizontal']),\n gridColumns: PropTypes.string,\n alwaysShowCorrect: PropTypes.bool,\n animationsDisabled: PropTypes.bool,\n language: PropTypes.string,\n selectedAnswerBackgroundColor: PropTypes.string,\n selectedAnswerStrokeColor: PropTypes.string,\n selectedAnswerStrokeWidth: PropTypes.string,\n hoverAnswerBackgroundColor: PropTypes.string,\n hoverAnswerStrokeColor: PropTypes.string,\n hoverAnswerStrokeWidth: PropTypes.string,\n onShowCorrectToggle: PropTypes.func,\n isSelectionButtonBelow: PropTypes.bool,\n minSelections: PropTypes.number,\n maxSelections: PropTypes.number,\n autoplayAudioEnabled: PropTypes.bool,\n customAudioButton: {\n playImage: PropTypes.string,\n pauseImage: PropTypes.string,\n },\n options: PropTypes.object,\n baseHeadingLevel: PropTypes.number,\n includeSrHeading: PropTypes.bool,\n };\n\n constructor(props) {\n super(props);\n\n this.state = {\n showCorrect: (this.props.options && this.props.alwaysShowCorrect) || false,\n maxSelectionsErrorState: false,\n };\n\n this.onToggle = this.onToggle.bind(this);\n\n // Unique radio `name` attribute per instance, so separate MultipleChoice\n // instances (e.g. Part A and Part B inside EBSR, or two EBSRs on the same\n // page) are always treated as independent radio groups by the browser,\n // regardless of any label-related model settings or bundle deduplication.\n this.groupName = `mc-group-${Math.random().toString(36).slice(2, 10)}`;\n }\n\n isSelected(value) {\n const sessionValue = this.props.session && this.props.session.value;\n\n return sessionValue && sessionValue.indexOf && sessionValue.indexOf(value) >= 0;\n }\n\n // handleChange was added for accessibility. Please see comments and videos from PD-2441.\n handleChange = (event) => {\n const { value, checked } = event.target;\n const { maxSelections, onChoiceChanged, session } = this.props;\n\n if (session.value && session.value.length >= maxSelections) {\n // show/hide max selections error when user select/deselect an answer\n this.setState({ maxSelectionsErrorState: checked });\n\n if (checked) {\n // prevent selecting more answers\n return;\n }\n }\n\n onChoiceChanged({ value, selected: checked, selector: 'Mouse' });\n };\n\n onToggle = () => {\n if (this.props.mode === 'evaluate') {\n this.setState({ showCorrect: !this.state.showCorrect }, () => {\n if (this.props.onShowCorrectToggle) {\n this.props.onShowCorrectToggle();\n }\n });\n }\n };\n\n UNSAFE_componentWillReceiveProps(nextProps) {\n if (!nextProps.correctResponse && this.state.showCorrect !== false) {\n this.setState({ showCorrect: false }, () => {\n if (this.props.onShowCorrectToggle) {\n this.props.onShowCorrectToggle();\n }\n });\n }\n\n if (nextProps.options && nextProps.alwaysShowCorrect && this.state.showCorrect !== true) {\n this.setState({ showCorrect: true }, () => {\n if (this.props.onShowCorrectToggle) {\n this.props.onShowCorrectToggle();\n }\n });\n }\n }\n\n indexToSymbol(index) {\n if (this.props.keyMode === 'numbers') {\n return `${index + 1}`;\n }\n\n if (this.props.keyMode === 'letters') {\n return String.fromCharCode(97 + index).toUpperCase();\n }\n\n return '';\n }\n\n getCorrectness = (choice = {}) => {\n const isCorrect = choice.correct;\n const isChecked = this.isSelected(choice.value);\n\n if (this.state.showCorrect) {\n return isCorrect ? 'correct' : undefined;\n }\n\n if (isCorrect) {\n if (isChecked) {\n // A correct answer is selected: marked with a green checkmark\n return 'correct';\n } else {\n // A correct answer is NOT selected: marked with an orange X\n return 'incorrect';\n }\n } else {\n if (isChecked) {\n // An incorrect answer is selected: marked with an orange X\n return 'incorrect';\n } else {\n // An incorrect answer is NOT selected: not marked\n return undefined;\n }\n }\n };\n\n getChecked(choice) {\n // check for print context: options prop is passed from print.js and alwaysShowCorrect is true\n const isPrintMode = this.props.options && this.props.alwaysShowCorrect;\n\n if (isPrintMode) {\n return choice.correct || false;\n }\n\n // evaluate mode with show correct toggled\n const isEvaluateMode = this.state.showCorrect && this.props.mode === 'evaluate';\n\n if (isEvaluateMode) {\n return choice.correct || false;\n }\n\n // default behavior: show what the user has selected\n return this.isSelected(choice.value);\n }\n\n // renderHeading function was added for accessibility.\n renderHeading() {\n const { mode, choiceMode, includeSrHeading, baseHeadingLevel, partLabel } = this.props;\n\n // When a part label is present the item is an EBSR part — the SR heading\n // is provided by the EBSR element, not here.\n const shouldRenderSrHeading = !partLabel && includeSrHeading !== false;\n\n if (!shouldRenderSrHeading || mode !== 'gather') {\n return null;\n }\n\n const clampedLevel = baseHeadingLevel ? Math.min(6, baseHeadingLevel) : 2;\n const HeadingTag = SrOnly.withComponent(`h${clampedLevel}`);\n const label = choiceMode === 'radio' ? 'Multiple Choice Question' : 'Multiple Select Question';\n\n return <HeadingTag>{label}</HeadingTag>;\n }\n\n render() {\n const {\n mode,\n disabled,\n className,\n choices = [],\n choiceMode,\n gridColumns,\n partLabel,\n prompt,\n responseCorrect,\n teacherInstructions,\n alwaysShowCorrect,\n animationsDisabled,\n language,\n isSelectionButtonBelow,\n minSelections,\n maxSelections,\n autoplayAudioEnabled,\n session,\n customAudioButton,\n options,\n baseHeadingLevel,\n } = this.props;\n const { showCorrect, maxSelectionsErrorState } = this.state;\n const isEvaluateMode = mode === 'evaluate';\n const showCorrectAnswerToggle = isEvaluateMode && !responseCorrect;\n const columnsStyle = gridColumns > 1 ? { gridTemplateColumns: `repeat(${gridColumns}, 1fr)` } : undefined;\n const selections = (session.value && session.value.length) || 0;\n\n // Heading levels are optional and only applied when baseHeadingLevel is provided.\n const getContentHeadingLevel = () => {\n if (!baseHeadingLevel) return undefined;\n // SR heading (rendered or external) sits at baseHeadingLevel.\n // Content is always one below that; part label (EBSR) sits between them.\n let offset = 1; // content default: baseHeadingLevel + 1\n if (partLabel) offset += 1; // part label at base + 1, content pushed to base + 2\n return Math.min(6, baseHeadingLevel + offset);\n };\n const contentHeadingLevel = getContentHeadingLevel();\n const transformPrompt = (html) => (html && contentHeadingLevel) ? transformDataHeadings(html, contentHeadingLevel) : html;\n\n const teacherInstructionsDiv = (\n <PreviewPrompt\n tagName=\"div\"\n className=\"prompt\"\n defaultClassName=\"teacher-instructions\"\n prompt={teacherInstructions}\n />\n );\n\n const getMultipleChoiceMinSelectionErrorMessage = () => {\n if (minSelections && maxSelections) {\n return minSelections === maxSelections\n ? translator.t('translation:multipleChoice:minmaxSelections_equal', { lng: language, minSelections })\n : translator.t('translation:multipleChoice:minmaxSelections_range', {\n lng: language,\n minSelections,\n maxSelections,\n });\n }\n\n if (minSelections) {\n return translator.t('translation:multipleChoice:minSelections', { lng: language, minSelections });\n }\n\n return '';\n };\n\n const LayoutComponent = this.props.choicesLayout === 'grid'\n ? GridLayout\n : this.props.choicesLayout === 'horizontal'\n ? HorizontalLayout\n : Box;\n\n return (\n <MainContainer id={'main-container'} className={classNames(className, 'multiple-choice')}>\n {partLabel && <PartLabel as={baseHeadingLevel ? `h${Math.min(6, baseHeadingLevel + 1)}` : 'h2'}>{partLabel}</PartLabel>}\n\n {this.renderHeading()}\n\n {teacherInstructions && (\n <TeacherInstructions>\n {!animationsDisabled ? (\n <Collapsible\n labels={{\n hidden: 'Show Teacher Instructions',\n visible: 'Hide Teacher Instructions',\n }}\n >\n {teacherInstructionsDiv}\n </Collapsible>\n ) : (\n teacherInstructionsDiv\n )}\n </TeacherInstructions>\n )}\n\n <StyledFieldset role={choiceMode === 'radio' ? 'radiogroup' : 'group'}>\n <PreviewPrompt\n className=\"prompt\"\n defaultClassName=\"prompt\"\n prompt={transformPrompt(prompt)}\n tagName={'legend'}\n autoplayAudioEnabled={autoplayAudioEnabled}\n customAudioButton={customAudioButton}\n />\n\n {!(options && alwaysShowCorrect) && (\n <CorrectAnswerToggle\n show={showCorrectAnswerToggle}\n toggled={showCorrect}\n onToggle={this.onToggle.bind(this)}\n language={language}\n />\n )}\n\n <LayoutComponent style={columnsStyle}>\n {choices.map((choice, index) => (\n <Choice\n choicesLayout={this.props.choicesLayout}\n selectedAnswerBackgroundColor={this.props.selectedAnswerBackgroundColor}\n selectedAnswerStrokeColor={this.props.selectedAnswerStrokeColor}\n selectedAnswerStrokeWidth={this.props.selectedAnswerStrokeWidth}\n hoverAnswerBackgroundColor={this.props.hoverAnswerBackgroundColor}\n hoverAnswerStrokeColor={this.props.hoverAnswerStrokeColor}\n hoverAnswerStrokeWidth={this.props.hoverAnswerStrokeWidth}\n gridColumns={gridColumns}\n key={`choice-${index}`}\n choice={choice}\n index={index}\n choicesLength={choices.length}\n showCorrect={showCorrect}\n isEvaluateMode={isEvaluateMode}\n choiceMode={choiceMode}\n disabled={disabled}\n tagName={this.groupName}\n onChoiceChanged={this.handleChange}\n hideTick={choice.hideTick}\n checked={this.getChecked(choice)}\n correctness={isEvaluateMode ? this.getCorrectness(choice) : undefined}\n displayKey={this.indexToSymbol(index)}\n isSelectionButtonBelow={isSelectionButtonBelow}\n />\n ))}\n </LayoutComponent>\n </StyledFieldset>\n\n {choiceMode === 'checkbox' && selections < minSelections && (\n <ErrorText>{getMultipleChoiceMinSelectionErrorMessage()}</ErrorText>\n )}\n {choiceMode === 'checkbox' && maxSelectionsErrorState && (\n <ErrorText>\n {translator.t(`translation:multipleChoice:maxSelections_${maxSelections === 1 ? 'one' : 'other'}`, {\n lng: language,\n maxSelections,\n })}\n </ErrorText>\n )}\n </MainContainer>\n );\n }\n}\n\nMultipleChoice.defaultProps = {\n session: {\n value: [],\n },\n};\n\nexport default MultipleChoice;\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,oBAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,WAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,IAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AACA,IAAAO,WAAA,GAAAR,sBAAA,CAAAC,OAAA;AAEA,IAAAQ,OAAA,GAAAT,sBAAA,CAAAC,OAAA;AAEA,MAAM;EAAES;AAAW,CAAC,GAAGC,mBAAU;AAEjC,MAAMC,aAAa,GAAG,IAAAC,cAAM,EAACC,YAAG,CAAC,CAAC;EAChCC,KA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,MAAM;EAC1Bf,6BAA6B,EAAEc,kBAAS,CAACC,MAAM;EAC/Cd,yBAAyB,EAAEa,kBAAS,CAACC,MAAM;EAC3Cb,yBAAyB,EAAEY,kBAAS,CAACC,MAAM;EAC3CZ,0BAA0B,EAAEW,kBAAS,CAACC,MAAM;EAC5CX,sBAAsB,EAAEU,kBAAS,CAACC,MAAM;EACxCV,sBAAsB,EAAES,kBAAS,CAACC,MAAM;EACxCtG,mBAAmB,EAAEqG,kBAAS,CAACM,IAAI;EACnCvD,sBAAsB,EAAEiD,kBAAS,CAACK,IAAI;EACtCrD,aAAa,EAAEgD,kBAAS,CAACO,MAAM;EAC/BvH,aAAa,EAAEgH,kBAAS,CAACO,MAAM;EAC/BtD,oBAAoB,EAAE+C,kBAAS,CAACK,IAAI;EACpCnD,iBAAiB,EAAE;IACjBsD,SAAS,EAAER,kBAAS,CAACC,MAAM;IAC3BQ,UAAU,EAAET,kBAAS,CAACC;EACxB,CAAC;EACD/F,OAAO,EAAE8F,kBAAS,CAACI,MAAM;EACzBxE,gBAAgB,EAAEoE,kBAAS,CAACO,MAAM;EAClC5E,gBAAgB,EAAEqE,kBAAS,CAACK;AAC9B,CAAC;AAwTHhI,cAAc,CAACqI,YAAY,GAAG;EAC5BxH,OAAO,EAAE;IACPL,KAAK,EAAE;EACT;AACF,CAAC;AAAC,IAAA8H,QAAA,GAAAZ,OAAA,CAAApH,OAAA,GAEaN,cAAc","ignoreList":[]}
|
package/module/configure.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_dll_react as e,_dll_prop_types as t,_dll_mui__material_styles as n,_dll_pie_lib__render_ui as o,_dll_mui__material as i,_dll_mui__icons_material as r,_dll_debug as a,_dll_react_dom_client as s}from"../../../@pie-lib/shared-module@^5.1.1/module/index.js";import{_dll_pie_lib__config_ui as l}from"../../../@pie-lib/config-module@^4.0.4/module/index.js";import{_dll_pie_lib__editable_html_tip_tap as c}from"../../../@pie-lib/editable-html-module@^7.1.1/module/index.js";var u={};Object.defineProperty(u,"__esModule",{value:!0});class d extends CustomEvent{constructor(e,t=!1){super(d.TYPE,{bubbles:!0,detail:{update:e,reset:t}}),this.update=e,this.reset=t}}d.TYPE="model.updated";var h=u.ModelUpdatedEvent=d;class p extends CustomEvent{constructor(e,t){super(p.TYPE,{bubbles:!0,detail:{src:e,done:t}}),this.src=e,this.done=t}}p.TYPE="delete.image";var g=u.DeleteImageEvent=p;class f extends CustomEvent{constructor(e){super(f.TYPE,{bubbles:!0,detail:e}),this.handler=e}}f.TYPE="insert.image";var b=u.InsertImageEvent=f;class m extends CustomEvent{constructor(e,t){super(m.TYPE,{bubbles:!0,detail:{src:e,done:t}}),this.src=e,this.done=t}}m.TYPE="delete.sound";var _=u.DeleteSoundEvent=m;class y extends CustomEvent{constructor(e){super(y.TYPE,{bubbles:!0,detail:e}),this.handler=e}}y.TYPE="insert.sound";var C=u.InsertSoundEvent=y,v="object"==typeof global&&global&&global.Object===Object&&global,E="object"==typeof self&&self&&self.Object===Object&&self,j=v||E||Function("return this")(),A=j.Symbol,S=Object.prototype,x=S.hasOwnProperty,w=S.toString,O=A?A.toStringTag:void 0,P=Object.prototype.toString,I=A?A.toStringTag:void 0;function k(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":I&&I in Object(e)?function(e){var t=x.call(e,O),n=e[O];try{e[O]=void 0;var o=!0}catch(e){}var i=w.call(e);return o&&(t?e[O]=n:delete e[O]),i}(e):function(e){return P.call(e)}(e)}function M(e){return null!=e&&"object"==typeof e}var T=Array.isArray;function z(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function R(e){return e}function L(e){if(!z(e))return!1;var t=k(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}var D,q=j["__core-js_shared__"],F=(D=/[^.]+$/.exec(q&&q.keys&&q.keys.IE_PROTO||""))?"Symbol(src)_1."+D:"",U=Function.prototype.toString,$=/^\[object .+?Constructor\]$/,B=Function.prototype,W=Object.prototype,Y=B.toString,H=W.hasOwnProperty,N=RegExp("^"+Y.call(H).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function G(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return function(e){return!(!z(e)||(t=e,F&&F in t))&&(L(e)?N:$).test(function(e){if(null!=e){try{return U.call(e)}catch(e){}try{return e+""}catch(e){}}return""}(e));var t}(n)?n:void 0}var V,J,K,Q=Object.create,X=function(){function e(){}return function(t){if(!z(t))return{};if(Q)return Q(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}(),Z=Date.now,ee=function(){try{var e=G(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),te=ee,ne=te?function(e,t){return te(e,"toString",{configurable:!0,enumerable:!1,value:(n=t,function(){return n}),writable:!0});var n}:R,oe=(V=ne,J=0,K=0,function(){var e=Z(),t=16-(e-K);if(K=e,t>0){if(++J>=800)return arguments[0]}else J=0;return V.apply(void 0,arguments)}),ie=/^(?:0|[1-9]\d*)$/;function re(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&ie.test(e))&&e>-1&&e%1==0&&e<t}function ae(e,t,n){"__proto__"==t&&te?te(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function se(e,t){return e===t||e!=e&&t!=t}var le=Object.prototype.hasOwnProperty;function ce(e,t,n){var o=e[t];le.call(e,t)&&se(o,n)&&(void 0!==n||t in e)||ae(e,t,n)}var ue=Math.max;function de(e,t){return oe(function(e,t,n){return t=ue(void 0===t?e.length-1:t,0),function(){for(var o=arguments,i=-1,r=ue(o.length-t,0),a=Array(r);++i<r;)a[i]=o[t+i];i=-1;for(var s=Array(t+1);++i<t;)s[i]=o[i];return s[t]=n(a),function(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}(e,this,s)}}(e,t,R),e+"")}function he(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function pe(e){return null!=e&&he(e.length)&&!L(e)}function ge(e,t,n){if(!z(n))return!1;var o=typeof t;return!!("number"==o?pe(n)&&re(t,n.length):"string"==o&&t in n)&&se(n[t],e)}var fe=Object.prototype;function be(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||fe)}function me(e){return M(e)&&"[object Arguments]"==k(e)}var _e=Object.prototype,ye=_e.hasOwnProperty,Ce=_e.propertyIsEnumerable,ve=me(function(){return arguments}())?me:function(e){return M(e)&&ye.call(e,"callee")&&!Ce.call(e,"callee")},Ee="object"==typeof exports&&exports&&!exports.nodeType&&exports,je=Ee&&"object"==typeof module&&module&&!module.nodeType&&module,Ae=je&&je.exports===Ee?j.Buffer:void 0,Se=(Ae?Ae.isBuffer:void 0)||function(){return!1},xe={};xe["[object Float32Array]"]=xe["[object Float64Array]"]=xe["[object Int8Array]"]=xe["[object Int16Array]"]=xe["[object Int32Array]"]=xe["[object Uint8Array]"]=xe["[object Uint8ClampedArray]"]=xe["[object Uint16Array]"]=xe["[object Uint32Array]"]=!0,xe["[object Arguments]"]=xe["[object Array]"]=xe["[object ArrayBuffer]"]=xe["[object Boolean]"]=xe["[object DataView]"]=xe["[object Date]"]=xe["[object Error]"]=xe["[object Function]"]=xe["[object Map]"]=xe["[object Number]"]=xe["[object Object]"]=xe["[object RegExp]"]=xe["[object Set]"]=xe["[object String]"]=xe["[object WeakMap]"]=!1;var we="object"==typeof exports&&exports&&!exports.nodeType&&exports,Oe=we&&"object"==typeof module&&module&&!module.nodeType&&module,Pe=Oe&&Oe.exports===we&&v.process,Ie=function(){try{return Oe&&Oe.require&&Oe.require("util").types||Pe&&Pe.binding&&Pe.binding("util")}catch(e){}}(),ke=Ie&&Ie.isTypedArray,Me=ke?function(e){return function(t){return e(t)}}(ke):function(e){return M(e)&&he(e.length)&&!!xe[k(e)]},Te=Me,ze=Object.prototype.hasOwnProperty;var Re=Object.prototype.hasOwnProperty;function Le(e){return pe(e)?function(e,t){var n=T(e),o=!n&&ve(e),i=!n&&!o&&Se(e),r=!n&&!o&&!i&&Te(e),a=n||o||i||r,s=a?function(e,t){for(var n=-1,o=Array(e);++n<e;)o[n]=t(n);return o}(e.length,String):[],l=s.length;for(var c in e)!t&&!ze.call(e,c)||a&&("length"==c||i&&("offset"==c||"parent"==c)||r&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||re(c,l))||s.push(c);return s}(e,!0):function(e){if(!z(e))return function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}(e);var t=be(e),n=[];for(var o in e)("constructor"!=o||!t&&Re.call(e,o))&&n.push(o);return n}(e)}var De=G(Object,"create"),qe=Object.prototype.hasOwnProperty,Fe=Object.prototype.hasOwnProperty;function Ue(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var o=e[t];this.set(o[0],o[1])}}function $e(e,t){for(var n=e.length;n--;)if(se(e[n][0],t))return n;return-1}Ue.prototype.clear=function(){this.__data__=De?De(null):{},this.size=0},Ue.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Ue.prototype.get=function(e){var t=this.__data__;if(De){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return qe.call(t,e)?t[e]:void 0},Ue.prototype.has=function(e){var t=this.__data__;return De?void 0!==t[e]:Fe.call(t,e)},Ue.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=De&&void 0===t?"__lodash_hash_undefined__":t,this};var Be=Array.prototype.splice;function We(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var o=e[t];this.set(o[0],o[1])}}We.prototype.clear=function(){this.__data__=[],this.size=0},We.prototype.delete=function(e){var t=this.__data__,n=$e(t,e);return!(n<0||(n==t.length-1?t.pop():Be.call(t,n,1),--this.size,0))},We.prototype.get=function(e){var t=this.__data__,n=$e(t,e);return n<0?void 0:t[n][1]},We.prototype.has=function(e){return $e(this.__data__,e)>-1},We.prototype.set=function(e,t){var n=this.__data__,o=$e(n,e);return o<0?(++this.size,n.push([e,t])):n[o][1]=t,this};var Ye=G(j,"Map");function He(e,t){var n,o,i=e.__data__;return("string"==(o=typeof(n=t))||"number"==o||"symbol"==o||"boolean"==o?"__proto__"!==n:null===n)?i["string"==typeof t?"string":"hash"]:i.map}function Ne(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var o=e[t];this.set(o[0],o[1])}}Ne.prototype.clear=function(){this.size=0,this.__data__={hash:new Ue,map:new(Ye||We),string:new Ue}},Ne.prototype.delete=function(e){var t=He(this,e).delete(e);return this.size-=t?1:0,t},Ne.prototype.get=function(e){return He(this,e).get(e)},Ne.prototype.has=function(e){return He(this,e).has(e)},Ne.prototype.set=function(e,t){var n=He(this,e),o=n.size;return n.set(e,t),this.size+=n.size==o?0:1,this};var Ge=function(e,t){return function(n){return e(t(n))}}(Object.getPrototypeOf,Object),Ve=Ge,Je=Function.prototype,Ke=Object.prototype,Qe=Je.toString,Xe=Ke.hasOwnProperty,Ze=Qe.call(Object);function et(e){var t=this.__data__=new We(e);this.size=t.size}et.prototype.clear=function(){this.__data__=new We,this.size=0},et.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},et.prototype.get=function(e){return this.__data__.get(e)},et.prototype.has=function(e){return this.__data__.has(e)},et.prototype.set=function(e,t){var n=this.__data__;if(n instanceof We){var o=n.__data__;if(!Ye||o.length<199)return o.push([e,t]),this.size=++n.size,this;n=this.__data__=new Ne(o)}return n.set(e,t),this.size=n.size,this};var tt="object"==typeof exports&&exports&&!exports.nodeType&&exports,nt=tt&&"object"==typeof module&&module&&!module.nodeType&&module,ot=nt&&nt.exports===tt?j.Buffer:void 0,it=(ot&&ot.allocUnsafe,j.Uint8Array);var rt=Object.prototype,at=rt.hasOwnProperty,st=de(function(e,t){e=Object(e);var n=-1,o=t.length,i=o>2?t[2]:void 0;for(i&&ge(t[0],t[1],i)&&(o=1);++n<o;)for(var r=t[n],a=Le(r),s=-1,l=a.length;++s<l;){var c=a[s],u=e[c];(void 0===u||se(u,rt[c])&&!at.call(e,c))&&(e[c]=r[c])}return e});function lt(e,t,n){(void 0!==n&&!se(e[t],n)||void 0===n&&!(t in e))&&ae(e,t,n)}function ct(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}function ut(e,t,n,o,i,r,a){var s=ct(e,n),l=ct(t,n),c=a.get(l);if(c)lt(e,n,c);else{var u,d=r?r(s,l,n+"",e,t,a):void 0,h=void 0===d;if(h){var p=T(l),g=!p&&Se(l),f=!p&&!g&&Te(l);d=l,p||g||f?T(s)?d=s:M(u=s)&&pe(u)?d=function(e,t){var n=-1,o=e.length;for(t||(t=Array(o));++n<o;)t[n]=e[n];return t}(s):g?(h=!1,d=function(e){return e.slice()}(l)):f?(h=!1,d=function(e,t){var n,o,i=t?(o=new(n=e.buffer).constructor(n.byteLength),new it(o).set(new it(n)),o):e.buffer;return new e.constructor(i,e.byteOffset,e.length)}(l,!0)):d=[]:function(e){if(!M(e)||"[object Object]"!=k(e))return!1;var t=Ve(e);if(null===t)return!0;var n=Xe.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&Qe.call(n)==Ze}(l)||ve(l)?(d=s,ve(s)?d=function(e){return function(e,t,n){var o=!n;n||(n={});for(var i=-1,r=t.length;++i<r;){var a=t[i],s=void 0;void 0===s&&(s=e[a]),o?ae(n,a,s):ce(n,a,s)}return n}(e,Le(e))}(s):z(s)&&!L(s)||(d=function(e){return"function"!=typeof e.constructor||be(e)?{}:X(Ve(e))}(l))):h=!1}h&&(a.set(l,d),i(d,l,o,r,a),a.delete(l)),lt(e,n,d)}}function dt(e,t,n,o,i){e!==t&&function(e,t,n){for(var o=-1,i=Object(e),r=n(e),a=r.length;a--;){var s=r[++o];if(!1===t(i[s],s,i))break}}(t,function(r,a){if(i||(i=new et),z(r))ut(e,t,a,n,dt,o,i);else{var s=o?o(ct(e,a),r,a+"",e,t,i):void 0;void 0===s&&(s=r),lt(e,a,s)}},Le)}var ht,pt=(ht=function(e,t,n){dt(e,t,n)},de(function(e,t){var n=-1,o=t.length,i=o>1?t[o-1]:void 0,r=o>2?t[2]:void 0;for(i=ht.length>3&&"function"==typeof i?(o--,i):void 0,r&&ge(t[0],t[1],r)&&(i=o<3?void 0:i,o=1),e=Object(e);++n<o;){var a=t[n];a&&ht(e,a,n)}return e}));const gt=e,ft=t,{styled:bt}=n,{color:mt}=o,{Button:_t}=i,{Tooltip:yt}=i,{Typography:Ct}=i,{Box:vt}=i,{Info:Et}=r,jt=c,{AlertDialog:At}=l,{InputContainer:St}=l,{ChoiceConfiguration:xt}=l,{settings:wt}=l,{layout:Ot}=l,{choiceUtils:Pt}=l;function It(e){let t,n=e[0],o=1;for(;o<e.length;){const i=e[o],r=e[o+1];if(o+=2,("optionalAccess"===i||"optionalCall"===i)&&null==n)return;"access"===i||"optionalAccess"===i?(t=n,n=r(n)):"call"!==i&&"optionalCall"!==i||(n=r((...e)=>n.call(t,...e)),t=void 0)}return n}const{Panel:kt,toggle:Mt,radio:Tt,dropdown:zt}=wt,Rt=bt(St)(({theme:e})=>({width:"100%",paddingTop:e.spacing(2),marginBottom:e.spacing(2)})),Lt=bt(St)(({theme:e})=>({flex:1,marginTop:e.spacing(1.5),paddingTop:e.spacing(2),marginLeft:e.spacing(3.5)})),Dt=bt(St)(({theme:e})=>({display:"flex",flexDirection:"column",marginBottom:e.spacing(1),width:"100%"})),qt=bt(_t)(({theme:e})=>({marginTop:e.spacing(1),float:"right"})),Ft=bt(qt)({cursor:"not-allowed",pointerEvents:"all",backgroundColor:mt.disabled(),"&:hover":{backgroundColor:mt.disabled()},"&:focus":{backgroundColor:mt.disabled()}}),Ut=bt(vt)({display:"flex",alignItems:"center"}),$t=bt(Ct)(({theme:e})=>({fontSize:e.typography.fontSize+2,marginRight:e.spacing(1)})),Bt=bt(yt)(({theme:e})=>({"& .MuiTooltip-tooltip":{fontSize:e.typography.fontSize-2,whiteSpace:"pre",maxWidth:"500px"}})),Wt=bt("div")(({theme:e})=>({fontSize:e.typography.fontSize-2,color:e.palette.error.main,paddingTop:e.spacing(1)})),Yt=e=>{const{model:t,configuration:n,onPromptChanged:o,onChoiceChanged:i,onRemoveChoice:r,onAddChoice:a,imageSupport:s,uploadSoundSupport:l,onChangeModel:c,onConfigurationChanged:u,onTeacherInstructionsChanged:d}=e,{addChoiceButton:h={},contentDimensions:p={},feedback:g={},deleteChoice:f={},choiceMode:b={},choicePrefix:m={},partialScoring:_={},lockChoiceOrder:y={},teacherInstructions:C={},studentInstructions:v={},rationale:E={},scoringType:j={},sequentialChoiceLabels:A={},settingsPanelDisabled:S,choicesLayout:x,spellCheck:w={},gridColumns:O,maxImageWidth:P={},maxImageHeight:I={},prompt:k={},withRubric:M={},mathMlOptions:T={},language:z={},languageChoices:R={}}=n||{};let{maxAnswerChoices:L}=n||{};const{limitChoicesNumber:D,teacherInstructionsEnabled:q,rationaleEnabled:F,feedbackEnabled:U,promptEnabled:$,spellCheckEnabled:B,choices:W,errors:Y,toolbarEditorPosition:H,extraCSSRules:N}=t||{},{answerChoices:G,choices:V,correctResponse:J,prompt:K,rationale:Q,teacherInstructions:X}=Y||{},Z=It([W,"optionalAccess",e=>e.length])?Array.from({length:W.length},(e,t)=>`${t+1}`):[],{baseInputConfiguration:ee={}}=n,te={position:"top"===H?"top":"bottom"};D&&(L=9);const ne=(e={})=>({...ee,...e}),oe=(e=>{const{minAnswerChoices:t,maxAnswerChoices:n}=e;return`Validation requirements:\nThere should be at least ${t} `+(n?`and at most ${n} `:"")+"answer choices defined.\nEvery answer choice should be non-blank and unique.\nA correct answer must be defined."})(n),ie=P&&P.prompt,re=I&&I.prompt,ae=L&&It([W,"optionalAccess",e=>e.length])>=L?`Only ${L} allowed maximum`:"",se={choiceMode:b.settings&&Tt(b.label,["checkbox","radio"]),"sequentialChoiceLabels.enabled":A.settings&&Mt(A.label,!0),choicePrefix:m.settings&&Tt(m.label,["numbers","letters"]),partialScoring:_.settings&&Mt(_.label),lockChoiceOrder:y.settings&&Mt(y.label),feedbackEnabled:g.settings&&Mt(g.label),choicesLayout:x.settings&&zt(x.label,["vertical","grid","horizontal"]),gridColumns:x.settings&&"grid"===t.choicesLayout&&Z.length>0&&zt(O.label,Z),"language.enabled":z.settings&&Mt(z.label,!0),language:z.settings&&z.enabled&&zt(R.label,R.options)},le={teacherInstructionsEnabled:C.settings&&Mt(C.label),studentInstructionsEnabled:v.settings&&Mt(v.label),promptEnabled:k.settings&&Mt(k.label),rationaleEnabled:E.settings&&Mt(E.label),spellCheckEnabled:w.settings&&Mt(w.label),scoringType:j.settings&&Tt(j.label,["auto","rubric"]),rubricEnabled:It([M,"optionalAccess",e=>e.settings])&&Mt(It([M,"optionalAccess",e=>e.label]))};return gt.createElement(Ot.ConfigLayout,{dimensions:p,hideSettings:S,extraCSSRules:N,classes:{},settings:gt.createElement(kt,{model:t,onChangeModel:c,configuration:n,onChangeConfiguration:u,groups:{Settings:se,Properties:le}})},q&>.createElement(Rt,{label:C.label},gt.createElement(jt,{markup:t.teacherInstructions||"",onChange:d,imageSupport:s,nonEmpty:!1,disableUnderline:!0,error:X,toolbarOpts:te,pluginProps:ne(It([n,"optionalAccess",e=>e.teacherInstructions,"optionalAccess",e=>e.inputConfiguration])),spellCheck:B,maxImageWidth:P&&P.teacherInstructions||ie,maxImageHeight:I&&I.teacherInstructions||re,uploadSoundSupport:l,languageCharactersProps:[{language:"spanish"},{language:"special"}],mathMlOptions:T}),X&>.createElement(Wt,null,X)),$&>.createElement(Rt,{label:k.label},gt.createElement(jt,{markup:t.prompt,onChange:o,imageSupport:s,nonEmpty:!1,disableUnderline:!0,error:K,toolbarOpts:te,pluginProps:ne(It([n,"optionalAccess",e=>e.prompt,"optionalAccess",e=>e.inputConfiguration])),spellCheck:B,maxImageWidth:P&&P.prompt,maxImageHeight:I&&I.prompt,uploadSoundSupport:l,languageCharactersProps:[{language:"spanish"},{language:"special"}],mathMlOptions:T}),K&>.createElement(Wt,null,K)),gt.createElement(Ut,null,gt.createElement($t,{component:"div"},"Choices"),gt.createElement(Bt,{disableFocusListener:!0,disableTouchListener:!0,placement:"right",title:oe},gt.createElement(Et,{fontSize:"small",color:"primary"}))),W.map((e,o)=>gt.createElement(Dt,{key:`choice-${o}`},gt.createElement(xt,{key:o,index:o+1,useLetterOrdering:"letters"===t.choicePrefix,mode:t.choiceMode,data:e,defaultFeedback:{},imageSupport:s,disableImageAlignmentButtons:!0,onDelete:()=>r(o),onChange:e=>i(o,e),allowFeedBack:U,allowDelete:f.settings,noLabels:!0,pluginOpts:ne(It([n,"optionalAccess",e=>e.choices,"optionalAccess",e=>e.inputConfiguration])),toolbarOpts:te,spellCheck:B,error:It([V,"optionalAccess",t=>t[e.value]])||null,noCorrectAnswerError:J,maxImageWidth:P&&P.choices||ie,maxImageHeight:I&&I.choices||re,uploadSoundSupport:l,mathMlOptions:T}),F&>.createElement(Lt,{key:`rationale-${o}`,label:E.label},gt.createElement(jt,{markup:e.rationale||"",onChange:t=>i(o,{...e,rationale:t}),imageSupport:s,error:It([Q,"optionalAccess",t=>t[e.value]])||null,toolbarOpts:te,pluginProps:ne(It([n,"optionalAccess",e=>e.rationale,"optionalAccess",e=>e.inputConfiguration])),spellCheck:B,maxImageWidth:P&&P.rationale||ie,maxImageHeight:I&&I.rationale||re,uploadSoundSupport:l,languageCharactersProps:[{language:"spanish"},{language:"special"}],mathMlOptions:T}),It([Q,"optionalAccess",t=>t[e.value]])&>.createElement(Wt,null,It([Q,"optionalAccess",t=>t[e.value]]))))),J&>.createElement(Wt,null,J),G&>.createElement(Wt,null,G),h.settings&>.createElement(Bt,{title:ae},L&&It([W,"optionalAccess",e=>e.length])>=L?gt.createElement(Ft,{variant:"contained",color:"primary",onClick:a,disabled:!0},h.label):gt.createElement(qt,{variant:"contained",color:"primary",onClick:a},h.label)))};class Ht extends gt.Component{constructor(...e){super(...e),Ht.prototype.__init.call(this),Ht.prototype.__init2.call(this),Ht.prototype.__init3.call(this),Ht.prototype.__init4.call(this),Ht.prototype.__init5.call(this),Ht.prototype.__init6.call(this),Ht.prototype.__init7.call(this)}static __initStatic(){this.propTypes={model:ft.object.isRequired,configuration:ft.object.isRequired,disableSidePanel:ft.bool,onModelChanged:ft.func.isRequired,onConfigurationChanged:ft.func.isRequired,imageSupport:ft.shape({add:ft.func.isRequired,delete:ft.func.isRequired})}}__init(){this.state={showWarning:!1}}__init2(){this.onRemoveChoice=e=>{const{model:t,configuration:n,onModelChanged:o}=this.props,{minAnswerChoices:i}=n||{};i&&t.choices.length===i?this.setState({showWarning:!0}):(t.choices.splice(e,1),o({choices:t.choices}))}}__init3(){this.onAddChoice=()=>{const{model:e,configuration:t,onModelChanged:n}=this.props;let{maxAnswerChoices:o}=t||{};const{limitChoicesNumber:i}=e||{};i&&(o=9),o&&e.choices.length>=o||(e.choices.push({label:"",value:Pt.firstAvailableIndex(e.choices.map(e=>e.value),0),feedback:{type:"none"}}),n({choices:e.choices}))}}__init4(){this.onChoiceChanged=(e,t)=>{const{model:n,onModelChanged:o}=this.props;t.correct&&"radio"===n.choiceMode&&(n.choices=n.choices.map(e=>pt({},e,{correct:!1}))),n.choices.splice(e,1,t),o({choices:n.choices})}}__init5(){this.onPromptChanged=e=>{this.props.onModelChanged({prompt:e})}}__init6(){this.onTeacherInstructionsChanged=e=>{this.props.onModelChanged({teacherInstructions:e})}}__init7(){this.onModelChanged=(e,t)=>{const{onModelChanged:n}=this.props;if("choiceMode"===t){if("radio"===e.choiceMode){let t=!1;e.choices=e.choices.map(e=>t?(e.correct=!1,e):(e.correct&&(t=!0),e))}n({choices:e.choices},!0)}else n(e)}}render(){const{configuration:{minAnswerChoices:e}={}}=this.props,{showWarning:t}=this.state;return gt.createElement(gt.Fragment,null,gt.createElement(At,{open:t,title:"Warning",text:`There can't be less than ${e||0} choices.`,onConfirm:()=>this.setState({showWarning:!1})}),gt.createElement(Yt,{...this.props,onChangeModel:this.onModelChanged,onRemoveChoice:this.onRemoveChoice,onChoiceChanged:this.onChoiceChanged,onAddChoice:this.onAddChoice,onPromptChanged:this.onPromptChanged,onTeacherInstructionsChanged:this.onTeacherInstructionsChanged}))}}Ht.__initStatic();var Nt={choiceMode:"checkbox",choicePrefix:"letters",choices:[],choicesLayout:"vertical",feedbackEnabled:!1,gridColumns:2,lockChoiceOrder:!0,partialScoring:!0,prompt:"",promptEnabled:!0,rationale:"",rationaleEnabled:!0,scoringType:"auto",studentInstructionsEnabled:!0,teacherInstructions:"",teacherInstructionsEnabled:!0,toolbarEditorPosition:"bottom",selectedAnswerBackgroundColor:"initial",keyboardEventsEnabled:!1},Gt={baseInputConfiguration:{h3:{disabled:!0},audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1},textAlign:{disabled:!0},showParagraphs:{disabled:!1},separateParagraphs:{disabled:!0}},choices:{inputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1}}},spellCheck:{label:"Spellcheck",settings:!1,enabled:!0},choicesLayout:{settings:!1,label:"Choices Layout"},gridColumns:{label:"Grid columns"},answerChoiceCount:0,addChoiceButton:{settings:!0,label:"Add a Choice"},choiceMode:{settings:!0,label:"Response Type"},choicePrefix:{settings:!0,label:"Choice Labels"},deleteChoice:{settings:!0},feedback:{settings:!0,label:"Feedback"},prompt:{settings:!0,label:"Prompt",inputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1}},required:!1},lockChoiceOrder:{settings:!0,label:"Lock Choice Order"},partialScoring:{settings:!1,label:"Allow Partial Scoring"},rationale:{settings:!0,label:"Rationale",inputConfiguration:{audio:{disabled:!0},video:{disabled:!0},image:{disabled:!1}},required:!1},scoringType:{settings:!1,label:"Scoring Type"},studentInstructions:{settings:!1,label:"Student Instructions"},teacherInstructions:{settings:!0,label:"Teacher Instructions",inputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1}},required:!1},toolbarEditorPosition:{settings:!1,label:"Toolbar Editor Position"},minAnswerChoices:2,maxAnswerChoices:5,maxImageWidth:{teacherInstructions:300,prompt:300,rationale:636,choices:900},maxImageHeight:{teacherInstructions:300,prompt:300,rationale:300,choices:300},withRubric:{settings:!1,label:"Add Rubric"},mathMlOptions:{mmlOutput:!1,mmlEditing:!1},language:{settings:!1,label:"Specify Language",enabled:!1},languageChoices:{label:"Language Choices",options:[]}};const Vt=e,{createRoot:Jt}=s,Kt=a,{choiceUtils:Qt}=l;function Xt(e){let t,n=e[0],o=1;for(;o<e.length;){const i=e[o],r=e[o+1];if(o+=2,("optionalAccess"===i||"optionalCall"===i)&&null==n)return;"access"===i||"optionalAccess"===i?(t=n,n=r(n)):"call"!==i&&"optionalCall"!==i||(n=r((...e)=>n.call(t,...e)),t=void 0)}return n}const Zt=Kt("multiple-choice:configure"),en=(e,t=0)=>{if(!e||0===e.length){let e=[];for(let n=0;n<t;n++)e.push({value:`${n}`,label:"",feedback:{type:"none",value:""}});return e}return e},tn=(e,t)=>{const n=st(e,Gt);return{configuration:n,model:{...t,choices:en(t&&t.choices||[],n&&n.answerChoiceCount)}}};class nn extends HTMLElement{static __initStatic(){this.createDefaultModel=(e={})=>{const t=Qt.normalizeChoices({...Nt,...e,choices:en(e&&e.choices||[])});return t.choicesLayout=e.choicesLayout||!1===e.verticalMode&&"horizontal"||Nt.choicesLayout,t}}constructor(){super(),this._root=null,this._reactContainer=null,this._model=nn.createDefaultModel(),this._configuration=Gt,this.onModelChanged=this.onModelChanged.bind(this),this.onConfigurationChanged=this.onConfigurationChanged.bind(this)}set model(e){this._model=nn.createDefaultModel(e),this._render()}set configuration(e){const t=tn(e,this._model);this.onModelChanged(t.model);const n={...Gt,...t.configuration};this._configuration=n,Xt([n,"optionalAccess",e=>e.language,"optionalAccess",e=>e.enabled])?Xt([n,"optionalAccess",e=>e.languageChoices,"optionalAccess",e=>e.options,"optionalAccess",e=>e.length])&&(this._model.language=Xt([n,"optionalAccess",e=>e.languageChoices,"access",e=>e.options,"access",e=>e[0],"access",e=>e.value])):n.language.settings&&this._model.language?(this._configuration.language.enabled=!0,this._configuration.languageChoices.options&&this._configuration.languageChoices.options.length||(this._configuration.languageChoices.options=[]),this._configuration.languageChoices.options.find(e=>e.value===this._model.language)||this._configuration.languageChoices.options.push({value:this._model.language,label:this._model.language})):delete this._model.language,this._render()}set disableSidePanel(e){this._disableSidePanel=e,this._render()}dispatchModelUpdated(e){const t=!!e;this.dispatchEvent(new h(this._model,t))}onModelChanged(e,t){this._model={...this._model,...e},this._render(),this.dispatchModelUpdated(t)}onConfigurationChanged(e){this._configuration=tn(e,this._model).configuration,this._model&&this.onModelChanged(this._model),this._render()}insertImage(e){this.dispatchEvent(new b(e))}onDeleteImage(e,t){this.dispatchEvent(new g(e,t))}insertSound(e){this.dispatchEvent(new C(e))}onDeleteSound(e,t){this.dispatchEvent(new _(e,t))}_render(){Zt("_render - Starting render"),Zt("_render - Model:",this._model?"present":"missing"),Zt("_render - Configuration:",this._configuration?"present":"missing"),Zt("_render - Root exists:",!!this._root);try{let e=Vt.createElement(Ht,{model:this._model,configuration:this._configuration,onModelChanged:this.onModelChanged,onConfigurationChanged:this.onConfigurationChanged,disableSidePanel:this._disableSidePanel,imageSupport:{add:this.insertImage.bind(this),delete:this.onDeleteImage.bind(this)},uploadSoundSupport:{add:this.insertSound.bind(this),delete:this.onDeleteSound.bind(this)}});this._root||(Zt("_render - Creating React container"),this._reactContainer=document.createElement("div"),this._reactContainer.className="pie-configure-wrapper",this.appendChild(this._reactContainer),Zt("_render - Creating new React root"),this._root=Jt(this._reactContainer),Zt("_render - React root created successfully")),Zt("_render - Calling root.render()"),this._root.render(e),Zt("_render - Render completed successfully")}catch(e){throw console.error("❌ [multiple-choice-configure] Render error:",e),console.error("Error stack:",e.stack),e}}connectedCallback(){Zt("connectedCallback - Component connected to DOM"),Zt("connectedCallback - Model:",this._model?"present":"missing"),Zt("connectedCallback - Configuration:",this._configuration?"present":"missing")}disconnectedCallback(){Zt("disconnectedCallback - Component disconnected from DOM"),this._root&&(Zt("disconnectedCallback - Unmounting React root"),this._root.unmount(),this._root=null),this._reactContainer&&(this._reactContainer=null)}}nn.__initStatic();export{nn as default};
|
|
1
|
+
import{_dll_react as e,_dll_prop_types as t,_dll_mui__material_styles as n,_dll_pie_lib__render_ui as o,_dll_mui__material as i,_dll_mui__icons_material as r,_dll_debug as a,_dll_react_dom_client as s}from"../../../@pie-lib/shared-module@^5.2.1/module/index.js";import{_dll_pie_lib__config_ui as l}from"../../../@pie-lib/config-module@^4.0.6/module/index.js";import{_dll_pie_lib__editable_html_tip_tap as c}from"../../../@pie-lib/editable-html-module@^7.1.3/module/index.js";var u={};Object.defineProperty(u,"__esModule",{value:!0});class d extends CustomEvent{constructor(e,t=!1){super(d.TYPE,{bubbles:!0,detail:{update:e,reset:t}}),this.update=e,this.reset=t}}d.TYPE="model.updated";var h=u.ModelUpdatedEvent=d;class p extends CustomEvent{constructor(e,t){super(p.TYPE,{bubbles:!0,detail:{src:e,done:t}}),this.src=e,this.done=t}}p.TYPE="delete.image";var g=u.DeleteImageEvent=p;class f extends CustomEvent{constructor(e){super(f.TYPE,{bubbles:!0,detail:e}),this.handler=e}}f.TYPE="insert.image";var b=u.InsertImageEvent=f;class m extends CustomEvent{constructor(e,t){super(m.TYPE,{bubbles:!0,detail:{src:e,done:t}}),this.src=e,this.done=t}}m.TYPE="delete.sound";var _=u.DeleteSoundEvent=m;class y extends CustomEvent{constructor(e){super(y.TYPE,{bubbles:!0,detail:e}),this.handler=e}}y.TYPE="insert.sound";var C=u.InsertSoundEvent=y,v="object"==typeof global&&global&&global.Object===Object&&global,E="object"==typeof self&&self&&self.Object===Object&&self,j=v||E||Function("return this")(),A=j.Symbol,S=Object.prototype,x=S.hasOwnProperty,w=S.toString,O=A?A.toStringTag:void 0,P=Object.prototype.toString,I=A?A.toStringTag:void 0;function k(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":I&&I in Object(e)?function(e){var t=x.call(e,O),n=e[O];try{e[O]=void 0;var o=!0}catch(e){}var i=w.call(e);return o&&(t?e[O]=n:delete e[O]),i}(e):function(e){return P.call(e)}(e)}function M(e){return null!=e&&"object"==typeof e}var T=Array.isArray;function z(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function R(e){return e}function L(e){if(!z(e))return!1;var t=k(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}var D,q=j["__core-js_shared__"],F=(D=/[^.]+$/.exec(q&&q.keys&&q.keys.IE_PROTO||""))?"Symbol(src)_1."+D:"",U=Function.prototype.toString,$=/^\[object .+?Constructor\]$/,B=Function.prototype,W=Object.prototype,Y=B.toString,H=W.hasOwnProperty,N=RegExp("^"+Y.call(H).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function G(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return function(e){return!(!z(e)||(t=e,F&&F in t))&&(L(e)?N:$).test(function(e){if(null!=e){try{return U.call(e)}catch(e){}try{return e+""}catch(e){}}return""}(e));var t}(n)?n:void 0}var V,J,K,Q=Object.create,X=function(){function e(){}return function(t){if(!z(t))return{};if(Q)return Q(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}(),Z=Date.now,ee=function(){try{var e=G(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),te=ee,ne=te?function(e,t){return te(e,"toString",{configurable:!0,enumerable:!1,value:(n=t,function(){return n}),writable:!0});var n}:R,oe=(V=ne,J=0,K=0,function(){var e=Z(),t=16-(e-K);if(K=e,t>0){if(++J>=800)return arguments[0]}else J=0;return V.apply(void 0,arguments)}),ie=/^(?:0|[1-9]\d*)$/;function re(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&ie.test(e))&&e>-1&&e%1==0&&e<t}function ae(e,t,n){"__proto__"==t&&te?te(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function se(e,t){return e===t||e!=e&&t!=t}var le=Object.prototype.hasOwnProperty;function ce(e,t,n){var o=e[t];le.call(e,t)&&se(o,n)&&(void 0!==n||t in e)||ae(e,t,n)}var ue=Math.max;function de(e,t){return oe(function(e,t,n){return t=ue(void 0===t?e.length-1:t,0),function(){for(var o=arguments,i=-1,r=ue(o.length-t,0),a=Array(r);++i<r;)a[i]=o[t+i];i=-1;for(var s=Array(t+1);++i<t;)s[i]=o[i];return s[t]=n(a),function(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}(e,this,s)}}(e,t,R),e+"")}function he(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function pe(e){return null!=e&&he(e.length)&&!L(e)}function ge(e,t,n){if(!z(n))return!1;var o=typeof t;return!!("number"==o?pe(n)&&re(t,n.length):"string"==o&&t in n)&&se(n[t],e)}var fe=Object.prototype;function be(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||fe)}function me(e){return M(e)&&"[object Arguments]"==k(e)}var _e=Object.prototype,ye=_e.hasOwnProperty,Ce=_e.propertyIsEnumerable,ve=me(function(){return arguments}())?me:function(e){return M(e)&&ye.call(e,"callee")&&!Ce.call(e,"callee")},Ee="object"==typeof exports&&exports&&!exports.nodeType&&exports,je=Ee&&"object"==typeof module&&module&&!module.nodeType&&module,Ae=je&&je.exports===Ee?j.Buffer:void 0,Se=(Ae?Ae.isBuffer:void 0)||function(){return!1},xe={};xe["[object Float32Array]"]=xe["[object Float64Array]"]=xe["[object Int8Array]"]=xe["[object Int16Array]"]=xe["[object Int32Array]"]=xe["[object Uint8Array]"]=xe["[object Uint8ClampedArray]"]=xe["[object Uint16Array]"]=xe["[object Uint32Array]"]=!0,xe["[object Arguments]"]=xe["[object Array]"]=xe["[object ArrayBuffer]"]=xe["[object Boolean]"]=xe["[object DataView]"]=xe["[object Date]"]=xe["[object Error]"]=xe["[object Function]"]=xe["[object Map]"]=xe["[object Number]"]=xe["[object Object]"]=xe["[object RegExp]"]=xe["[object Set]"]=xe["[object String]"]=xe["[object WeakMap]"]=!1;var we="object"==typeof exports&&exports&&!exports.nodeType&&exports,Oe=we&&"object"==typeof module&&module&&!module.nodeType&&module,Pe=Oe&&Oe.exports===we&&v.process,Ie=function(){try{return Oe&&Oe.require&&Oe.require("util").types||Pe&&Pe.binding&&Pe.binding("util")}catch(e){}}(),ke=Ie&&Ie.isTypedArray,Me=ke?function(e){return function(t){return e(t)}}(ke):function(e){return M(e)&&he(e.length)&&!!xe[k(e)]},Te=Me,ze=Object.prototype.hasOwnProperty;var Re=Object.prototype.hasOwnProperty;function Le(e){return pe(e)?function(e,t){var n=T(e),o=!n&&ve(e),i=!n&&!o&&Se(e),r=!n&&!o&&!i&&Te(e),a=n||o||i||r,s=a?function(e,t){for(var n=-1,o=Array(e);++n<e;)o[n]=t(n);return o}(e.length,String):[],l=s.length;for(var c in e)!t&&!ze.call(e,c)||a&&("length"==c||i&&("offset"==c||"parent"==c)||r&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||re(c,l))||s.push(c);return s}(e,!0):function(e){if(!z(e))return function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}(e);var t=be(e),n=[];for(var o in e)("constructor"!=o||!t&&Re.call(e,o))&&n.push(o);return n}(e)}var De=G(Object,"create"),qe=Object.prototype.hasOwnProperty,Fe=Object.prototype.hasOwnProperty;function Ue(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var o=e[t];this.set(o[0],o[1])}}function $e(e,t){for(var n=e.length;n--;)if(se(e[n][0],t))return n;return-1}Ue.prototype.clear=function(){this.__data__=De?De(null):{},this.size=0},Ue.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Ue.prototype.get=function(e){var t=this.__data__;if(De){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return qe.call(t,e)?t[e]:void 0},Ue.prototype.has=function(e){var t=this.__data__;return De?void 0!==t[e]:Fe.call(t,e)},Ue.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=De&&void 0===t?"__lodash_hash_undefined__":t,this};var Be=Array.prototype.splice;function We(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var o=e[t];this.set(o[0],o[1])}}We.prototype.clear=function(){this.__data__=[],this.size=0},We.prototype.delete=function(e){var t=this.__data__,n=$e(t,e);return!(n<0||(n==t.length-1?t.pop():Be.call(t,n,1),--this.size,0))},We.prototype.get=function(e){var t=this.__data__,n=$e(t,e);return n<0?void 0:t[n][1]},We.prototype.has=function(e){return $e(this.__data__,e)>-1},We.prototype.set=function(e,t){var n=this.__data__,o=$e(n,e);return o<0?(++this.size,n.push([e,t])):n[o][1]=t,this};var Ye=G(j,"Map");function He(e,t){var n,o,i=e.__data__;return("string"==(o=typeof(n=t))||"number"==o||"symbol"==o||"boolean"==o?"__proto__"!==n:null===n)?i["string"==typeof t?"string":"hash"]:i.map}function Ne(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var o=e[t];this.set(o[0],o[1])}}Ne.prototype.clear=function(){this.size=0,this.__data__={hash:new Ue,map:new(Ye||We),string:new Ue}},Ne.prototype.delete=function(e){var t=He(this,e).delete(e);return this.size-=t?1:0,t},Ne.prototype.get=function(e){return He(this,e).get(e)},Ne.prototype.has=function(e){return He(this,e).has(e)},Ne.prototype.set=function(e,t){var n=He(this,e),o=n.size;return n.set(e,t),this.size+=n.size==o?0:1,this};var Ge=function(e,t){return function(n){return e(t(n))}}(Object.getPrototypeOf,Object),Ve=Ge,Je=Function.prototype,Ke=Object.prototype,Qe=Je.toString,Xe=Ke.hasOwnProperty,Ze=Qe.call(Object);function et(e){var t=this.__data__=new We(e);this.size=t.size}et.prototype.clear=function(){this.__data__=new We,this.size=0},et.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},et.prototype.get=function(e){return this.__data__.get(e)},et.prototype.has=function(e){return this.__data__.has(e)},et.prototype.set=function(e,t){var n=this.__data__;if(n instanceof We){var o=n.__data__;if(!Ye||o.length<199)return o.push([e,t]),this.size=++n.size,this;n=this.__data__=new Ne(o)}return n.set(e,t),this.size=n.size,this};var tt="object"==typeof exports&&exports&&!exports.nodeType&&exports,nt=tt&&"object"==typeof module&&module&&!module.nodeType&&module,ot=nt&&nt.exports===tt?j.Buffer:void 0,it=(ot&&ot.allocUnsafe,j.Uint8Array);var rt=Object.prototype,at=rt.hasOwnProperty,st=de(function(e,t){e=Object(e);var n=-1,o=t.length,i=o>2?t[2]:void 0;for(i&&ge(t[0],t[1],i)&&(o=1);++n<o;)for(var r=t[n],a=Le(r),s=-1,l=a.length;++s<l;){var c=a[s],u=e[c];(void 0===u||se(u,rt[c])&&!at.call(e,c))&&(e[c]=r[c])}return e});function lt(e,t,n){(void 0!==n&&!se(e[t],n)||void 0===n&&!(t in e))&&ae(e,t,n)}function ct(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}function ut(e,t,n,o,i,r,a){var s=ct(e,n),l=ct(t,n),c=a.get(l);if(c)lt(e,n,c);else{var u,d=r?r(s,l,n+"",e,t,a):void 0,h=void 0===d;if(h){var p=T(l),g=!p&&Se(l),f=!p&&!g&&Te(l);d=l,p||g||f?T(s)?d=s:M(u=s)&&pe(u)?d=function(e,t){var n=-1,o=e.length;for(t||(t=Array(o));++n<o;)t[n]=e[n];return t}(s):g?(h=!1,d=function(e){return e.slice()}(l)):f?(h=!1,d=function(e,t){var n,o,i=t?(o=new(n=e.buffer).constructor(n.byteLength),new it(o).set(new it(n)),o):e.buffer;return new e.constructor(i,e.byteOffset,e.length)}(l,!0)):d=[]:function(e){if(!M(e)||"[object Object]"!=k(e))return!1;var t=Ve(e);if(null===t)return!0;var n=Xe.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&Qe.call(n)==Ze}(l)||ve(l)?(d=s,ve(s)?d=function(e){return function(e,t,n){var o=!n;n||(n={});for(var i=-1,r=t.length;++i<r;){var a=t[i],s=void 0;void 0===s&&(s=e[a]),o?ae(n,a,s):ce(n,a,s)}return n}(e,Le(e))}(s):z(s)&&!L(s)||(d=function(e){return"function"!=typeof e.constructor||be(e)?{}:X(Ve(e))}(l))):h=!1}h&&(a.set(l,d),i(d,l,o,r,a),a.delete(l)),lt(e,n,d)}}function dt(e,t,n,o,i){e!==t&&function(e,t,n){for(var o=-1,i=Object(e),r=n(e),a=r.length;a--;){var s=r[++o];if(!1===t(i[s],s,i))break}}(t,function(r,a){if(i||(i=new et),z(r))ut(e,t,a,n,dt,o,i);else{var s=o?o(ct(e,a),r,a+"",e,t,i):void 0;void 0===s&&(s=r),lt(e,a,s)}},Le)}var ht,pt=(ht=function(e,t,n){dt(e,t,n)},de(function(e,t){var n=-1,o=t.length,i=o>1?t[o-1]:void 0,r=o>2?t[2]:void 0;for(i=ht.length>3&&"function"==typeof i?(o--,i):void 0,r&&ge(t[0],t[1],r)&&(i=o<3?void 0:i,o=1),e=Object(e);++n<o;){var a=t[n];a&&ht(e,a,n)}return e}));const gt=e,ft=t,{styled:bt}=n,{color:mt}=o,{Button:_t}=i,{Tooltip:yt}=i,{Typography:Ct}=i,{Box:vt}=i,{Info:Et}=r,jt=c,{AlertDialog:At}=l,{InputContainer:St}=l,{ChoiceConfiguration:xt}=l,{settings:wt}=l,{layout:Ot}=l,{choiceUtils:Pt}=l;function It(e){let t,n=e[0],o=1;for(;o<e.length;){const i=e[o],r=e[o+1];if(o+=2,("optionalAccess"===i||"optionalCall"===i)&&null==n)return;"access"===i||"optionalAccess"===i?(t=n,n=r(n)):"call"!==i&&"optionalCall"!==i||(n=r((...e)=>n.call(t,...e)),t=void 0)}return n}const{Panel:kt,toggle:Mt,radio:Tt,dropdown:zt}=wt,Rt=bt(St)(({theme:e})=>({width:"100%",paddingTop:e.spacing(2),marginBottom:e.spacing(2)})),Lt=bt(St)(({theme:e})=>({flex:1,marginTop:e.spacing(1.5),paddingTop:e.spacing(2),marginLeft:e.spacing(3.5)})),Dt=bt(St)(({theme:e})=>({display:"flex",flexDirection:"column",marginBottom:e.spacing(1),width:"100%"})),qt=bt(_t)(({theme:e})=>({marginTop:e.spacing(1),float:"right"})),Ft=bt(qt)({cursor:"not-allowed",pointerEvents:"all",backgroundColor:mt.disabled(),"&:hover":{backgroundColor:mt.disabled()},"&:focus":{backgroundColor:mt.disabled()}}),Ut=bt(vt)({display:"flex",alignItems:"center"}),$t=bt(Ct)(({theme:e})=>({fontSize:e.typography.fontSize+2,marginRight:e.spacing(1)})),Bt=bt(yt)(({theme:e})=>({"& .MuiTooltip-tooltip":{fontSize:e.typography.fontSize-2,whiteSpace:"pre",maxWidth:"500px"}})),Wt=bt("div")(({theme:e})=>({fontSize:e.typography.fontSize-2,color:e.palette.error.main,paddingTop:e.spacing(1)})),Yt=e=>{const{model:t,configuration:n,onPromptChanged:o,onChoiceChanged:i,onRemoveChoice:r,onAddChoice:a,imageSupport:s,uploadSoundSupport:l,onChangeModel:c,onConfigurationChanged:u,onTeacherInstructionsChanged:d}=e,{addChoiceButton:h={},contentDimensions:p={},feedback:g={},deleteChoice:f={},choiceMode:b={},choicePrefix:m={},partialScoring:_={},lockChoiceOrder:y={},teacherInstructions:C={},studentInstructions:v={},rationale:E={},scoringType:j={},sequentialChoiceLabels:A={},settingsPanelDisabled:S,choicesLayout:x,spellCheck:w={},gridColumns:O,maxImageWidth:P={},maxImageHeight:I={},prompt:k={},withRubric:M={},mathMlOptions:T={},language:z={},languageChoices:R={}}=n||{};let{maxAnswerChoices:L}=n||{};const{limitChoicesNumber:D,teacherInstructionsEnabled:q,rationaleEnabled:F,feedbackEnabled:U,promptEnabled:$,spellCheckEnabled:B,choices:W,errors:Y,toolbarEditorPosition:H,extraCSSRules:N}=t||{},{answerChoices:G,choices:V,correctResponse:J,prompt:K,rationale:Q,teacherInstructions:X}=Y||{},Z=It([W,"optionalAccess",e=>e.length])?Array.from({length:W.length},(e,t)=>`${t+1}`):[],{baseInputConfiguration:ee={}}=n,te={position:"top"===H?"top":"bottom"};D&&(L=9);const ne=(e={})=>({...ee,...e}),oe=(e=>{const{minAnswerChoices:t,maxAnswerChoices:n}=e;return`Validation requirements:\nThere should be at least ${t} `+(n?`and at most ${n} `:"")+"answer choices defined.\nEvery answer choice should be non-blank and unique.\nA correct answer must be defined."})(n),ie=P&&P.prompt,re=I&&I.prompt,ae=L&&It([W,"optionalAccess",e=>e.length])>=L?`Only ${L} allowed maximum`:"",se={choiceMode:b.settings&&Tt(b.label,["checkbox","radio"]),"sequentialChoiceLabels.enabled":A.settings&&Mt(A.label,!0),choicePrefix:m.settings&&Tt(m.label,["numbers","letters"]),partialScoring:_.settings&&Mt(_.label),lockChoiceOrder:y.settings&&Mt(y.label),feedbackEnabled:g.settings&&Mt(g.label),choicesLayout:x.settings&&zt(x.label,["vertical","grid","horizontal"]),gridColumns:x.settings&&"grid"===t.choicesLayout&&Z.length>0&&zt(O.label,Z),"language.enabled":z.settings&&Mt(z.label,!0),language:z.settings&&z.enabled&&zt(R.label,R.options)},le={teacherInstructionsEnabled:C.settings&&Mt(C.label),studentInstructionsEnabled:v.settings&&Mt(v.label),promptEnabled:k.settings&&Mt(k.label),rationaleEnabled:E.settings&&Mt(E.label),spellCheckEnabled:w.settings&&Mt(w.label),scoringType:j.settings&&Tt(j.label,["auto","rubric"]),rubricEnabled:It([M,"optionalAccess",e=>e.settings])&&Mt(It([M,"optionalAccess",e=>e.label]))};return gt.createElement(Ot.ConfigLayout,{dimensions:p,hideSettings:S,extraCSSRules:N,classes:{},settings:gt.createElement(kt,{model:t,onChangeModel:c,configuration:n,onChangeConfiguration:u,groups:{Settings:se,Properties:le}})},q&>.createElement(Rt,{label:C.label},gt.createElement(jt,{markup:t.teacherInstructions||"",onChange:d,imageSupport:s,nonEmpty:!1,disableUnderline:!0,error:X,toolbarOpts:te,pluginProps:ne(It([n,"optionalAccess",e=>e.teacherInstructions,"optionalAccess",e=>e.inputConfiguration])),spellCheck:B,maxImageWidth:P&&P.teacherInstructions||ie,maxImageHeight:I&&I.teacherInstructions||re,uploadSoundSupport:l,languageCharactersProps:[{language:"spanish"},{language:"special"}],mathMlOptions:T}),X&>.createElement(Wt,null,X)),$&>.createElement(Rt,{label:k.label},gt.createElement(jt,{markup:t.prompt,onChange:o,imageSupport:s,nonEmpty:!1,disableUnderline:!0,error:K,toolbarOpts:te,pluginProps:ne(It([n,"optionalAccess",e=>e.prompt,"optionalAccess",e=>e.inputConfiguration])),spellCheck:B,maxImageWidth:P&&P.prompt,maxImageHeight:I&&I.prompt,uploadSoundSupport:l,languageCharactersProps:[{language:"spanish"},{language:"special"}],mathMlOptions:T}),K&>.createElement(Wt,null,K)),gt.createElement(Ut,null,gt.createElement($t,{component:"div"},"Choices"),gt.createElement(Bt,{disableFocusListener:!0,disableTouchListener:!0,placement:"right",title:oe},gt.createElement(Et,{fontSize:"small",color:"primary"}))),W.map((e,o)=>gt.createElement(Dt,{key:`choice-${o}`},gt.createElement(xt,{key:o,index:o+1,useLetterOrdering:"letters"===t.choicePrefix,mode:t.choiceMode,data:e,defaultFeedback:{},imageSupport:s,disableImageAlignmentButtons:!0,onDelete:()=>r(o),onChange:e=>i(o,e),allowFeedBack:U,allowDelete:f.settings,noLabels:!0,pluginOpts:ne(It([n,"optionalAccess",e=>e.choices,"optionalAccess",e=>e.inputConfiguration])),toolbarOpts:te,spellCheck:B,error:It([V,"optionalAccess",t=>t[e.value]])||null,noCorrectAnswerError:J,maxImageWidth:P&&P.choices||ie,maxImageHeight:I&&I.choices||re,uploadSoundSupport:l,mathMlOptions:T}),F&>.createElement(Lt,{key:`rationale-${o}`,label:E.label},gt.createElement(jt,{markup:e.rationale||"",onChange:t=>i(o,{...e,rationale:t}),imageSupport:s,error:It([Q,"optionalAccess",t=>t[e.value]])||null,toolbarOpts:te,pluginProps:ne(It([n,"optionalAccess",e=>e.rationale,"optionalAccess",e=>e.inputConfiguration])),spellCheck:B,maxImageWidth:P&&P.rationale||ie,maxImageHeight:I&&I.rationale||re,uploadSoundSupport:l,languageCharactersProps:[{language:"spanish"},{language:"special"}],mathMlOptions:T}),It([Q,"optionalAccess",t=>t[e.value]])&>.createElement(Wt,null,It([Q,"optionalAccess",t=>t[e.value]]))))),J&>.createElement(Wt,null,J),G&>.createElement(Wt,null,G),h.settings&>.createElement(Bt,{title:ae},L&&It([W,"optionalAccess",e=>e.length])>=L?gt.createElement(Ft,{variant:"contained",color:"primary",onClick:a,disabled:!0},h.label):gt.createElement(qt,{variant:"contained",color:"primary",onClick:a},h.label)))};class Ht extends gt.Component{constructor(...e){super(...e),Ht.prototype.__init.call(this),Ht.prototype.__init2.call(this),Ht.prototype.__init3.call(this),Ht.prototype.__init4.call(this),Ht.prototype.__init5.call(this),Ht.prototype.__init6.call(this),Ht.prototype.__init7.call(this)}static __initStatic(){this.propTypes={model:ft.object.isRequired,configuration:ft.object.isRequired,disableSidePanel:ft.bool,onModelChanged:ft.func.isRequired,onConfigurationChanged:ft.func.isRequired,imageSupport:ft.shape({add:ft.func.isRequired,delete:ft.func.isRequired})}}__init(){this.state={showWarning:!1}}__init2(){this.onRemoveChoice=e=>{const{model:t,configuration:n,onModelChanged:o}=this.props,{minAnswerChoices:i}=n||{};i&&t.choices.length===i?this.setState({showWarning:!0}):(t.choices.splice(e,1),o({choices:t.choices}))}}__init3(){this.onAddChoice=()=>{const{model:e,configuration:t,onModelChanged:n}=this.props;let{maxAnswerChoices:o}=t||{};const{limitChoicesNumber:i}=e||{};i&&(o=9),o&&e.choices.length>=o||(e.choices.push({label:"",value:Pt.firstAvailableIndex(e.choices.map(e=>e.value),0),feedback:{type:"none"}}),n({choices:e.choices}))}}__init4(){this.onChoiceChanged=(e,t)=>{const{model:n,onModelChanged:o}=this.props;t.correct&&"radio"===n.choiceMode&&(n.choices=n.choices.map(e=>pt({},e,{correct:!1}))),n.choices.splice(e,1,t),o({choices:n.choices})}}__init5(){this.onPromptChanged=e=>{this.props.onModelChanged({prompt:e})}}__init6(){this.onTeacherInstructionsChanged=e=>{this.props.onModelChanged({teacherInstructions:e})}}__init7(){this.onModelChanged=(e,t)=>{const{onModelChanged:n}=this.props;if("choiceMode"===t){if("radio"===e.choiceMode){let t=!1;e.choices=e.choices.map(e=>t?(e.correct=!1,e):(e.correct&&(t=!0),e))}n({choices:e.choices},!0)}else n(e)}}render(){const{configuration:{minAnswerChoices:e}={}}=this.props,{showWarning:t}=this.state;return gt.createElement(gt.Fragment,null,gt.createElement(At,{open:t,title:"Warning",text:`There can't be less than ${e||0} choices.`,onConfirm:()=>this.setState({showWarning:!1})}),gt.createElement(Yt,{...this.props,onChangeModel:this.onModelChanged,onRemoveChoice:this.onRemoveChoice,onChoiceChanged:this.onChoiceChanged,onAddChoice:this.onAddChoice,onPromptChanged:this.onPromptChanged,onTeacherInstructionsChanged:this.onTeacherInstructionsChanged}))}}Ht.__initStatic();var Nt={choiceMode:"checkbox",choicePrefix:"letters",choices:[],choicesLayout:"vertical",feedbackEnabled:!1,gridColumns:2,lockChoiceOrder:!0,partialScoring:!0,prompt:"",promptEnabled:!0,rationale:"",rationaleEnabled:!0,scoringType:"auto",studentInstructionsEnabled:!0,teacherInstructions:"",teacherInstructionsEnabled:!0,toolbarEditorPosition:"bottom",selectedAnswerBackgroundColor:"initial",keyboardEventsEnabled:!1},Gt={baseInputConfiguration:{h3:{disabled:!0},audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1},textAlign:{disabled:!0},showParagraphs:{disabled:!1},separateParagraphs:{disabled:!0}},choices:{inputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1}}},spellCheck:{label:"Spellcheck",settings:!1,enabled:!0},choicesLayout:{settings:!1,label:"Choices Layout"},gridColumns:{label:"Grid columns"},answerChoiceCount:0,addChoiceButton:{settings:!0,label:"Add a Choice"},choiceMode:{settings:!0,label:"Response Type"},choicePrefix:{settings:!0,label:"Choice Labels"},deleteChoice:{settings:!0},feedback:{settings:!0,label:"Feedback"},prompt:{settings:!0,label:"Prompt",inputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1}},required:!1},lockChoiceOrder:{settings:!0,label:"Lock Choice Order"},partialScoring:{settings:!1,label:"Allow Partial Scoring"},rationale:{settings:!0,label:"Rationale",inputConfiguration:{audio:{disabled:!0},video:{disabled:!0},image:{disabled:!1}},required:!1},scoringType:{settings:!1,label:"Scoring Type"},studentInstructions:{settings:!1,label:"Student Instructions"},teacherInstructions:{settings:!0,label:"Teacher Instructions",inputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1}},required:!1},toolbarEditorPosition:{settings:!1,label:"Toolbar Editor Position"},minAnswerChoices:2,maxAnswerChoices:5,maxImageWidth:{teacherInstructions:300,prompt:300,rationale:636,choices:900},maxImageHeight:{teacherInstructions:300,prompt:300,rationale:300,choices:300},withRubric:{settings:!1,label:"Add Rubric"},mathMlOptions:{mmlOutput:!1,mmlEditing:!1},language:{settings:!1,label:"Specify Language",enabled:!1},languageChoices:{label:"Language Choices",options:[]}};const Vt=e,{createRoot:Jt}=s,Kt=a,{choiceUtils:Qt}=l;function Xt(e){let t,n=e[0],o=1;for(;o<e.length;){const i=e[o],r=e[o+1];if(o+=2,("optionalAccess"===i||"optionalCall"===i)&&null==n)return;"access"===i||"optionalAccess"===i?(t=n,n=r(n)):"call"!==i&&"optionalCall"!==i||(n=r((...e)=>n.call(t,...e)),t=void 0)}return n}const Zt=Kt("multiple-choice:configure"),en=(e,t=0)=>{if(!e||0===e.length){let e=[];for(let n=0;n<t;n++)e.push({value:`${n}`,label:"",feedback:{type:"none",value:""}});return e}return e},tn=(e,t)=>{const n=st(e,Gt);return{configuration:n,model:{...t,choices:en(t&&t.choices||[],n&&n.answerChoiceCount)}}};class nn extends HTMLElement{static __initStatic(){this.createDefaultModel=(e={})=>{const t=Qt.normalizeChoices({...Nt,...e,choices:en(e&&e.choices||[])});return t.choicesLayout=e.choicesLayout||!1===e.verticalMode&&"horizontal"||Nt.choicesLayout,t}}constructor(){super(),this._root=null,this._reactContainer=null,this._model=nn.createDefaultModel(),this._configuration=Gt,this.onModelChanged=this.onModelChanged.bind(this),this.onConfigurationChanged=this.onConfigurationChanged.bind(this)}set model(e){this._model=nn.createDefaultModel(e),this._render()}set configuration(e){const t=tn(e,this._model);this.onModelChanged(t.model);const n={...Gt,...t.configuration};this._configuration=n,Xt([n,"optionalAccess",e=>e.language,"optionalAccess",e=>e.enabled])?Xt([n,"optionalAccess",e=>e.languageChoices,"optionalAccess",e=>e.options,"optionalAccess",e=>e.length])&&(this._model.language=Xt([n,"optionalAccess",e=>e.languageChoices,"access",e=>e.options,"access",e=>e[0],"access",e=>e.value])):n.language.settings&&this._model.language?(this._configuration.language.enabled=!0,this._configuration.languageChoices.options&&this._configuration.languageChoices.options.length||(this._configuration.languageChoices.options=[]),this._configuration.languageChoices.options.find(e=>e.value===this._model.language)||this._configuration.languageChoices.options.push({value:this._model.language,label:this._model.language})):delete this._model.language,this._render()}set disableSidePanel(e){this._disableSidePanel=e,this._render()}dispatchModelUpdated(e){const t=!!e;this.dispatchEvent(new h(this._model,t))}onModelChanged(e,t){this._model={...this._model,...e},this._render(),this.dispatchModelUpdated(t)}onConfigurationChanged(e){this._configuration=tn(e,this._model).configuration,this._model&&this.onModelChanged(this._model),this._render()}insertImage(e){this.dispatchEvent(new b(e))}onDeleteImage(e,t){this.dispatchEvent(new g(e,t))}insertSound(e){this.dispatchEvent(new C(e))}onDeleteSound(e,t){this.dispatchEvent(new _(e,t))}_render(){Zt("_render - Starting render"),Zt("_render - Model:",this._model?"present":"missing"),Zt("_render - Configuration:",this._configuration?"present":"missing"),Zt("_render - Root exists:",!!this._root);try{let e=Vt.createElement(Ht,{model:this._model,configuration:this._configuration,onModelChanged:this.onModelChanged,onConfigurationChanged:this.onConfigurationChanged,disableSidePanel:this._disableSidePanel,imageSupport:{add:this.insertImage.bind(this),delete:this.onDeleteImage.bind(this)},uploadSoundSupport:{add:this.insertSound.bind(this),delete:this.onDeleteSound.bind(this)}});this._root||(Zt("_render - Creating React container"),this._reactContainer=document.createElement("div"),this._reactContainer.className="pie-configure-wrapper",this.appendChild(this._reactContainer),Zt("_render - Creating new React root"),this._root=Jt(this._reactContainer),Zt("_render - React root created successfully")),Zt("_render - Calling root.render()"),this._root.render(e),Zt("_render - Render completed successfully")}catch(e){throw console.error("❌ [multiple-choice-configure] Render error:",e),console.error("Error stack:",e.stack),e}}connectedCallback(){Zt("connectedCallback - Component connected to DOM"),Zt("connectedCallback - Model:",this._model?"present":"missing"),Zt("connectedCallback - Configuration:",this._configuration?"present":"missing")}disconnectedCallback(){Zt("disconnectedCallback - Component disconnected from DOM"),this._root&&(Zt("disconnectedCallback - Unmounting React root"),this._root.unmount(),this._root=null),this._reactContainer&&(this._reactContainer=null)}}nn.__initStatic();export{nn as default};
|