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N,EAASC,EAAYY,GAAGjB,UACxCM,KACgB,GAATA,GACPI,GAAgBL,EAAYY,GAAGjB,UAC/BM,MAQAI,GANAA,EACIA,EACA,iCAEAN,EACAC,EAAYY,GAAGjB,WACSnI,QACxB,+BACA,IAEJyI,KAIhB,CAEA,IAAIc,EAAgBzF,EAAQkC,MACxB,EACAlC,EAAQG,QAAQ,aACZH,EAAQwB,MAAM,aAAa,GAAGrB,QAAQ,KACtC,IAEJuF,EAAgB1F,EAAQkC,MACxBlC,EAAQG,QAAQ,eAChBH,EAAQ0B,QAEZ1B,EAAUyF,EAAgBV,EAAeW,QAEnC9H,KAAKmG,UACPX,EACAE,EACAtD,EACAgC,GAEJvF,EAAE,sBAAsB8F,MAC5B,OAGoC,IAA7BjG,OAAOY,oBACdZ,OAAOY,kBAAoB,CAAC,GAGhCZ,OAAOY,kBAAkByI,eAAiB,SAAUjI,GAChD,OAAO,IAAIF,EAAUE,EACzB,EAMAjB,EAAEiE,UAAUkF,GAAG,4BAA4BjK,iBACvC,IAAIkK,EAAenF,SAASmE,iBACxB,mCAEJ,IAAK,IAAIiB,KAAMD,EACX,IACI,GAAgE,GAA5DpJ,EAAEqJ,GAAIC,QAAQ,oCAAoCrE,OAAa,CAE/D,IAAIsE,EAAM,IAAIxI,EAAU,CAAEZ,KAAMkJ,UAC1BE,EAAIC,YACd,CAKJ,CAJE,MAAOC,GACL/G,QAAQC,IAAI,gCAAgC0G,EAAGjH,yCACvBqH,KACxB/G,QAAQC,IAAI8G,EAAIC,MACpB,CAER,G","sources":["webpack://WebComponents/./runestone/common/js/renderComponent.js","webpack://WebComponents/./runestone/selectquestion/js/selectone.js"],"sourcesContent":["import { runestone_import } from \"../../../webpack.index.js\";\n\nexport async function renderRunestoneComponent(componentSrc, whereDiv, moreOpts) {\n /**\n * The easy part is adding the componentSrc to the existing div.\n * The tedious part is calling the right functions to turn the\n * source into the actual component.\n */\n if (!componentSrc) {\n jQuery(`#${whereDiv}`).html(`
Sorry, no source is available for preview.
`);\n return;\n }\n let patt = /..\\/_images/g;\n componentSrc = componentSrc.replace(\n patt,\n `${eBookConfig.app}/books/published/${eBookConfig.basecourse}/_images`\n );\n jQuery(`#${whereDiv}`).html(componentSrc);\n\n if (typeof window.edList === \"undefined\") {\n window.edList = {};\n }\n\n let componentKind = $($(`#${whereDiv} [data-component]`)[0]).data(\n \"component\"\n );\n // Import the JavaScript for this component before proceeding.\n await runestone_import(componentKind);\n let opt = {};\n opt.orig = jQuery(`#${whereDiv} [data-component]`)[0];\n if (opt.orig) {\n opt.lang = $(opt.orig).data(\"lang\");\n opt.useRunestoneServices = true;\n opt.graderactive = false;\n opt.python3 = true;\n if (typeof moreOpts !== \"undefined\") {\n for (let key in moreOpts) {\n opt[key] = moreOpts[key];\n }\n }\n }\n\n if (typeof component_factory === \"undefined\") {\n alert(\n \"Error: Missing the component factory!\"\n );\n } else {\n if (\n !window.component_factory[componentKind] &&\n !jQuery(`#${whereDiv}`).html()\n ) {\n jQuery(`#${whereDiv}`).html(\n `Preview not available for ${componentKind}
`\n );\n } else {\n let res = window.component_factory[componentKind](opt);\n if (componentKind === \"activecode\") {\n if (moreOpts.multiGrader) {\n window.edList[\n `${moreOpts.gradingContainer} ${res.divid}`\n ] = res;\n } else {\n window.edList[res.divid] = res;\n }\n }\n }\n }\n}\n\nexport function createTimedComponent(componentSrc, moreOpts) {\n /* The important distinction is that the component does not really need to be rendered\n into the page, in fact, due to the async nature of getting the source the list of questions\n is made and the original html is replaced by the look of the exam.\n */\n\n let patt = /..\\/_images/g;\n componentSrc = componentSrc.replace(\n patt,\n `${eBookConfig.app}/books/published/${eBookConfig.basecourse}/_images`\n );\n\n let componentKind = $($(componentSrc).find(\"[data-component]\")[0]).data(\n \"component\"\n );\n\n let origId = $(componentSrc).find(\"[data-component]\").first().attr(\"id\");\n\n // Double check -- if the component source is not in the DOM, then briefly add it\n // and call the constructor.\n let hdiv;\n if (!document.getElementById(origId)) {\n hdiv = $(\"\", {\n css: { display: \"none\" },\n }).appendTo(\"body\");\n hdiv.html(componentSrc);\n }\n // at this point hdiv is a jquery object\n\n let ret;\n let opts = {\n orig: document.getElementById(origId),\n timed: true,\n };\n if (typeof moreOpts !== \"undefined\") {\n for (let key in moreOpts) {\n opts[key] = moreOpts[key];\n }\n }\n\n if (componentKind in window.component_factory) {\n ret = window.component_factory[componentKind](opts);\n }\n\n let rdict = {};\n rdict.question = ret;\n return rdict;\n}\n","/**\n * *******************************\n * |docname| - SelectOne Component\n * *******************************\n */\nimport {\n renderRunestoneComponent,\n createTimedComponent,\n} from \"../../common/js/renderComponent.js\";\nimport RunestoneBase from \"../../common/js/runestonebase.js\";\nimport \"../css/selectquestion.css\";\n\nexport default class SelectOne extends RunestoneBase {\n /**\n * constructor --\n * Making an instance of a selectone is a bit more complicated because it is\n * a kind of meta directive. That is, go to the server and randomly select\n * a question to display in this spot. Or, if a student has already seen this question\n * in the context of an exam retrieve the question they saw in the first place.\n * Making an API call and waiting for the response is handled asynchronously.\n * But lots of code is not written with that assumption. So we do the initialization in\n * two parts.\n * 1. Create the object with the usual constructor\n * 2. call initialize, which returns a promise. When that promise is resolved\n * the \"replacement\" component will replace the original selectone component in the DOM.\n *\n * @param {} opts\n */\n constructor(opts) {\n super(opts);\n this.origOpts = opts;\n this.questions = $(opts.orig).data(\"questionlist\");\n this.proficiency = $(opts.orig).data(\"proficiency\");\n this.minDifficulty = $(opts.orig).data(\"minDifficulty\");\n this.maxDifficulty = $(opts.orig).data(\"maxDifficulty\");\n this.points = $(opts.orig).data(\"points\");\n this.autogradable = $(opts.orig).data(\"autogradable\");\n this.not_seen_ever = $(opts.orig).data(\"not_seen_ever\");\n this.selector_id = $(opts.orig).first().attr(\"id\");\n this.primaryOnly = $(opts.orig).data(\"primary\");\n this.ABExperiment = $(opts.orig).data(\"ab\");\n this.toggleOptions = $(opts.orig).data(\"toggleoptions\");\n this.toggleLabels = $(opts.orig).data(\"togglelabels\");\n this.limitBaseCourse = $(opts.orig).data(\"limit-basecourse\");\n opts.orig.id = this.selector_id;\n }\n /**\n * initialize --\n * initialize is used so that the constructor does not have to be async.\n * Constructors should definitely not return promises that would seriously\n * mess things up.\n * @return {Promise} Will resolve after component from DB is reified\n */\n async initialize() {\n let self = this;\n let data = { selector_id: this.selector_id };\n if (this.questions) {\n data.questions = this.questions;\n } else if (this.proficiency) {\n data.proficiency = this.proficiency;\n }\n if (this.minDifficulty) {\n data.minDifficulty = this.minDifficulty;\n }\n if (this.maxDifficulty) {\n data.maxDifficulty = this.maxDifficulty;\n }\n if (this.points) {\n data.points = this.points;\n }\n if (this.autogradable) {\n data.autogradable = this.autogradable;\n }\n if (this.not_seen_ever) {\n data.not_seen_ever = this.not_seen_ever;\n }\n if (this.primaryOnly) {\n data.primary = this.primaryOnly;\n }\n if (this.ABExperiment) {\n data.AB = this.ABExperiment;\n }\n if (this.timedWrapper) {\n data.timedWrapper = this.timedWrapper;\n }\n if (this.toggleOptions) {\n data.toggleOptions = this.toggleOptions;\n }\n if (this.toggleLabels) {\n data.toggleLabels = this.toggleLabels;\n }\n if (this.limitBaseCourse) {\n data.limitBaseCourse = eBookConfig.basecourse;\n }\n let opts = this.origOpts;\n let selectorId = this.selector_id;\n console.log(\"getting question source\");\n let request = new Request(\n `${eBookConfig.new_server_prefix}/assessment/get_question_source`,\n {\n method: \"POST\",\n headers: this.jsonHeaders,\n body: JSON.stringify(data),\n }\n );\n let response = await fetch(request);\n let htmlsrc = await response.json();\n htmlsrc = htmlsrc.detail;\n if (htmlsrc.indexOf(\"No preview\") >= 0) {\n alert(\n `Error: Not able to find a question for ${selectorId} based on the criteria`\n );\n throw new Error(`Unable to find a question for ${selectorId}`);\n }\n let res;\n if (opts.timed) {\n // timed components are not rendered immediately, only when the student\n // starts the assessment and visits this particular entry.\n res = createTimedComponent(htmlsrc, {\n timed: true,\n selector_id: selectorId,\n assessmentTaken: opts.assessmentTaken,\n });\n // replace the entry in the timed assessment's list of components\n // with the component created by createTimedComponent\n for (let component of opts.rqa) {\n if (component.question == self) {\n component.question = res.question;\n break;\n }\n }\n self.realComponent = res.question;\n self.containerDiv = res.question.containerDiv;\n self.realComponent.selectorId = selectorId;\n } else {\n if (data.toggleOptions) {\n var toggleLabels = data.toggleLabels\n .replace(\"togglelabels:\", \"\")\n .trim();\n if (toggleLabels) {\n toggleLabels = toggleLabels.split(\",\");\n for (var t = 0; t < toggleLabels.length; t++) {\n toggleLabels[t] = toggleLabels[t].trim();\n }\n }\n var toggleQuestions = this.questions.split(\", \");\n var toggleUI = \"\";\n // check so that only the first toggle select question on the assignments page has a preview panel created, then all toggle select previews use this same panel\n if (!document.getElementById(\"component-preview\")) {\n toggleUI +=\n '