function _defineProperty(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function _toConsumableArray(arr){return _arrayWithoutHoles(arr)||_iterableToArray(arr)||_unsupportedIterableToArray(arr)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _iterableToArray(iter){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(iter))return Array.from(iter)}function _arrayWithoutHoles(arr){if(Array.isArray(arr))return _arrayLikeToArray(arr)}function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_unsupportedIterableToArray(arr,i)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(o,minLen){if(o){if("string"==typeof o)return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);return"Object"===n&&o.constructor&&(n=o.constructor.name),"Map"===n||"Set"===n?Array.from(o):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(o,minLen):void 0}}function _arrayLikeToArray(arr,len){(null==len||len>arr.length)&&(len=arr.length);for(var i=0,arr2=Array(len);i_.indexOf(options.include,typeIdentifier))||void configLoadingStack.push(loadModuleConfig(self.get(typeIdentifier)))}),Promise.all(configLoadingStack).then(function(moduleConfigs){var requireConfigAliases=_.reduce(moduleConfigs,function(acc,paths){return _.merge(acc,paths)},{});_requirejs.config({paths:requireConfigAliases})})})}),loadPromise.then(function(){self.trigger("runtimesloaded")}).catch(function(err){self.trigger("error",err)}),loadPromise},loadCreators:function(options){var self=this,loadPromise;return options=_.defaults(options||{},_defaultLoadingOptions),loadPromise=self.loadRuntimes(options).then(function(){var requiredCreatorHooks=[];return _.forIn(self._registry,function(versions,typeIdentifier){var portableElementModel=self.get(typeIdentifier);if(portableElementModel.creator&&portableElementModel.creator.hook){if(portableElementModel.enabled){if(_.isArray(options.include)&&0>_.indexOf(options.include,typeIdentifier))return!0;}else if(!_.isArray(options.include)||0>_.indexOf(options.include,typeIdentifier))return!0;requiredCreatorHooks.push(portableElementModel.creator.hook.replace(/\.js$/,""))}}),requiredCreatorHooks.length?new Promise(function(resolve,reject){_requirejs(requiredCreatorHooks,function(){var creators={};_.each(arguments,function(creatorHook){var id=creatorHook.getTypeIdentifier(),portableElementModel=self.get(id),i=_.findIndex(self._registry[id],{version:portableElementModel.version});0>i?self.trigger("error","no creator found for id/version "+id+"/"+portableElementModel.version):(self._registry[id][i].creator.module=creatorHook,creators[id]=creatorHook)}),resolve(creators)},reject)}):Promise.resolve({})}),loadPromise.then(function(creators){return self.trigger("creatorsloaded",creators),creators}).catch(function(err){self.trigger("error",err)}),loadPromise},enable:function(typeIdentifier,version){var portableElement=this.get(typeIdentifier,version);return portableElement&&(portableElement.enabled=!0),this},disable:function(typeIdentifier,version){var portableElement=this.get(typeIdentifier,version);return portableElement&&(portableElement.enabled=!1),this},isEnabled:function(typeIdentifier,version){var portableElement=this.get(typeIdentifier,version);return portableElement&&!0===portableElement.enabled}}))}}),define("taoQtiItem/qtiCreator/helper/qtiElements",["jquery","lodash","i18n"],function($,_,__){"use strict";var QtiElements={};return QtiElements.classes={itemBody:{parents:["bodyElement"],contains:["block"],abstract:!0},atomicBlock:{parents:["blockStatic","bodyElement","flowStatic"],contains:["inline"],abstract:!0},atomicInline:{parents:["bodyElement","flowStatic","inlineStatic"],contains:["inline"],abstract:!0},simpleBlock:{parents:["blockStatic","bodyElement","flowStatic"],contains:["block"],abstract:!0},simpleInline:{parents:["bodyElement","flowStatic","inlineStatic"],contains:["inline"],abstract:!0},flowStatic:{parents:["flow"],abstract:!0},blockStatic:{parents:["block"],abstract:!0},inlineStatic:{parents:["inline"],abstract:!0},flow:{parents:["objectFlow"],abstract:!0},tableCell:{parents:["bodyElement"],contains:["flow"],abstract:!0},caption:{parents:["bodyElement"],contains:["inline"],xhtml:!0},col:{parents:["bodyElement"],xhtml:!0},colgroup:{parents:["bodyElement"],contains:["col"],xhtml:!0},div:{parents:["blockStatic","bodyElement","flowStatic"],contains:["flow"],xhtml:!0},dl:{parents:["blockStatic","bodyElement","flowStatic"],contains:["dlElement"],xhtml:!0},dt:{parents:["dlElement"],contains:["inline"],xhtml:!0},dd:{parents:["dlElement"],contains:["flow"],xhtml:!0},hr:{parents:["blockStatic","bodyElement","flowStatic"],xhtml:!0},math:{parents:["blockStatic","flowStatic","inlineStatic"],xhtml:!0},li:{parents:["bodyElement"],contains:["flow"],xhtml:!0},ol:{parents:["blockStatic","bodyElement","flowStatic"],contains:["li"],xhtml:!0},ul:{parents:["blockStatic","bodyElement","flowStatic"],contains:["li"],xhtml:!0},object:{parents:["bodyElement","flowStatic","inlineStatic"],contains:["objectFlow"],xhtml:!0},param:{parents:["objectFlow"],xhtml:!0},table:{parents:["blockStatic","bodyElement","flowStatic"],contains:["caption","col","colgroup","thead","tfoot","tbody"],xhtml:!0},tbody:{parents:["bodyElement"],contains:["tr"],xhtml:!0},tfoot:{parents:["bodyElement"],contains:["tr"],xhtml:!0},thead:{parents:["bodyElement"],contains:["tr"],xhtml:!0},td:{parents:["tableCell"],xhtml:!0},th:{parents:["tableCell"],xhtml:!0},tr:{parents:["bodyElement"],contains:["tableCell"],xhtml:!0},a:{parents:["simpleInline"],xhtml:!0},abbr:{parents:["simpleInline"],xhtml:!0},acronym:{parents:["simpleInline"],xhtml:!0},b:{parents:["simpleInline"],xhtml:!0},big:{parents:["simpleInline"],xhtml:!0},cite:{parents:["simpleInline"],xhtml:!0},code:{parents:["simpleInline"],xhtml:!0},dfn:{parents:["simpleInline"],xhtml:!0},em:{parents:["simpleInline"],xhtml:!0},i:{parents:["simpleInline"],xhtml:!0},kbd:{parents:["simpleInline"],xhtml:!0},q:{parents:["simpleInline"],xhtml:!0},samp:{parents:["simpleInline"],xhtml:!0},small:{parents:["simpleInline"],xhtml:!0},span:{parents:["simpleInline"],xhtml:!0},strong:{parents:["simpleInline"],xhtml:!0},sub:{parents:["simpleInline"],xhtml:!0},sup:{parents:["simpleInline"],xhtml:!0},tt:{parents:["simpleInline"],xhtml:!0},var:{parents:["simpleInline"],xhtml:!0},blockquote:{parents:["simpleBlock"],xhtml:!0},address:{parents:["atomicBlock"],xhtml:!0},h1:{parents:["atomicBlock"],xhtml:!0},h2:{parents:["atomicBlock"],xhtml:!0},h3:{parents:["atomicBlock"],xhtml:!0},h4:{parents:["atomicBlock"],xhtml:!0},h5:{parents:["atomicBlock"],xhtml:!0},h6:{parents:["atomicBlock"],xhtml:!0},p:{parents:["atomicBlock"],xhtml:!0},pre:{parents:["atomicBlock"],xhtml:!0},img:{parents:["atomicInline"],xhtml:!0,attributes:["src","alt","longdesc","height","width"]},br:{parents:["atomicInline"],xhtml:!0},infoControl:{parents:["blockStatic","bodyElement","flowStatic"],qti:!0},textRun:{parents:["inlineStatic","flowstatic"],qti:!0},feedbackInline:{parents:["simpleInline","feedbackElement"],qti:!0},feedbackBlock:{parents:["simpleBlock"],qti:!0},rubricBlock:{parents:["simpleBlock"],qti:!0},blockInteraction:{parents:["block","flow","interaction"],qti:!0},inlineInteraction:{parents:["inline","flow","interaction"],qti:!0},gap:{parents:["inlineStatic"],qti:!0},hottext:{parents:["flowstatic","inlineStatic"],contains:["inlineStatic"],qti:!0},printedVariable:{parents:["bodyElement","flowStatic","inlineStatic","textOrVariable"],qti:!0},prompt:{parents:["bodyElement"],contains:["inlineStatic"],qti:!0},templateElement:{parents:["bodyElement"],qti:!0},templateBlock:{parents:["blockStatic","flowStatic","templateElement"],contains:["blockStatic"],qti:!0},templateInline:{parents:["inlineStatic","flowStatic","templateElement"],contains:["inlineStatic"],qti:!0},choiceInteraction:{parents:["blockInteraction"],qti:!0},associateInteraction:{parents:["blockInteraction"],qti:!0},orderInteraction:{parents:["blockInteraction"],qti:!0},matchInteraction:{parents:["blockInteraction"],qti:!0},hottextInteraction:{parents:["blockInteraction"],qti:!0},gapMatchInteraction:{parents:["blockInteraction"],qti:!0},mediaInteraction:{parents:["blockInteraction"],qti:!0},sliderInteraction:{parents:["blockInteraction"],qti:!0},uploadInteraction:{parents:["blockInteraction"],qti:!0},drawingInteraction:{parents:["blockInteraction"],qti:!0},graphicInteraction:{parents:["blockInteraction"],qti:!0},hotspotInteraction:{parents:["graphicInteraction"],qti:!0},graphicAssociateInteraction:{parents:["graphicInteraction"],qti:!0},graphicOrderInteraction:{parents:["graphicInteraction"],qti:!0},graphicGapMatchInteraction:{parents:["graphicInteraction"],qti:!0},selectPointInteraction:{parents:["graphicInteraction"],qti:!0},textEntryInteraction:{parents:["stringInteraction","inlineInteraction"],qti:!0},extendedTextInteraction:{parents:["stringInteraction","blockInteraction"],qti:!0},inlineChoiceInteraction:{parents:["inlineInteraction"],qti:!0},endAttemptInteraction:{parents:["inlineInteraction"],qti:!0},customInteraction:{parents:["block","flow","interaction"],qti:!0},_container:{parents:["block"],qti:!0}},QtiElements.cache={containable:{},children:{},parents:{}},QtiElements.getAllowedContainersElements=function(qtiClass,$container){var classes=QtiElements.getAllowedContainers(qtiClass),jqSelector="";for(var i in classes)classes[i].qti||(jqSelector+=classes[i]+", ");return jqSelector&&(jqSelector=jqSelector.substring(0,jqSelector.length-2)),$(jqSelector,$container?$container:$(document)).filter(":not([data-qti-type])")},QtiElements.getAllowedContainers=function(qtiClass){var ret;if(QtiElements.cache.containable[qtiClass])ret=QtiElements.cache.containable[qtiClass];else{ret=[];var parents=QtiElements.getParentClasses(qtiClass,!0);for(var aClass in QtiElements.classes){var model=QtiElements.classes[aClass];if(model.contains){var intersect=_.intersection(model.contains,parents);intersect.length&&(!model.abstract&&ret.push(aClass),ret=_.union(ret,QtiElements.getChildClasses(aClass,!0)))}}QtiElements.cache.containable[qtiClass]=ret}return ret},QtiElements.getAllowedContents=function(qtiClass,recursive,checked){var ret=[];checked=checked||{};var model=QtiElements.classes[qtiClass];if(model&&model.contains)for(var i in model.contains){var contain=model.contains[i];if(!checked[contain]){checked[contain]=!0,ret.push(contain);var children=QtiElements.getChildClasses(contain,!0);for(var i in children){var child=children[i];checked[child]||(checked[child]=!0,ret.push(child),recursive&&(ret=_.union(ret,QtiElements.getAllowedContents(child,!0,checked))))}recursive&&(ret=_.union(ret,QtiElements.getAllowedContents(contain,!0,checked)))}}var parents=QtiElements.getParentClasses(qtiClass,!0);for(var i in parents)ret=_.union(ret,QtiElements.getAllowedContents(parents[i],recursive,checked));return _.uniq(ret,!1)},QtiElements.isAllowedClass=function(qtiContainerClass,qtiContentClass){var allowedClasses=QtiElements.getAllowedContents(qtiContainerClass);return 0<=_.indexOf(allowedClasses,qtiContentClass)},QtiElements.getParentClasses=function(qtiClass,recursive){var ret;if(recursive&&QtiElements.cache.parents[qtiClass])ret=QtiElements.cache.parents[qtiClass];else{if(ret=[],QtiElements.classes[qtiClass]&&(ret=QtiElements.classes[qtiClass].parents,recursive)){for(var i in ret)ret=_.union(ret,QtiElements.getParentClasses(ret[i],recursive));ret=_.uniq(ret,!1)}QtiElements.cache.parents[qtiClass]=ret}return ret},QtiElements.getChildClasses=function(qtiClass,recursive,type){var cacheType=type?type:"all",ret;if(recursive&&QtiElements.cache.children[qtiClass]&&QtiElements.cache.children[qtiClass][cacheType])ret=QtiElements.cache.children[qtiClass][cacheType];else{for(var aClass in ret=[],QtiElements.classes){var model=QtiElements.classes[aClass];0<=_.indexOf(model.parents,qtiClass)&&(type?model[type]&&ret.push(aClass):ret.push(aClass),recursive&&(ret=_.union(ret,QtiElements.getChildClasses(aClass,recursive,type))))}QtiElements.cache.children[qtiClass]||(QtiElements.cache.children[qtiClass]={}),QtiElements.cache.children[qtiClass][cacheType]=ret}return ret},QtiElements.isBlock=function(qtiClass){return QtiElements.is(qtiClass,"block")},QtiElements.isInline=function(qtiClass){return QtiElements.is(qtiClass,"inline")},QtiElements.is=function(qtiClass,topClass){if(qtiClass===topClass)return!0;var parents=QtiElements.getParentClasses(qtiClass,!0);return 0<=_.indexOf(parents,topClass)},QtiElements.getAvailableAuthoringElements=function(){var tagTitles={commonInteractions:__("Common Interactions"),inlineInteractions:__("Inline Interactions"),graphicInteractions:__("Graphic Interactions")};return{choiceInteraction:{label:__("Choice Interaction"),description:__("Select a single (radio buttons) or multiple (check boxes) responses among a set of choices."),icon:"icon-choice",short:__("Choice"),qtiClass:"choiceInteraction",tags:[tagTitles.commonInteractions,"mcq"],group:"common-interactions"},orderInteraction:{label:__("Order Interaction"),icon:"icon-order",description:__("Arrange a list of choices in the correct order."),short:__("Order"),qtiClass:"orderInteraction",tags:[tagTitles.commonInteractions,"ordering"],group:"common-interactions"},associateInteraction:{label:__("Associate Interaction"),icon:"icon-associate",description:__("Create pair(s) from a series of choices."),short:__("Associate"),qtiClass:"associateInteraction",tags:[tagTitles.commonInteractions,"association"],group:"common-interactions"},matchInteraction:{label:__("Match Interaction"),icon:"icon-match",description:__("Create association(s) between two sets of choices displayed in a table (row and column)."),short:__("Match"),qtiClass:"matchInteraction",tags:[tagTitles.commonInteractions,"association"],group:"common-interactions"},hottextInteraction:{label:__("Hottext Interaction"),icon:"icon-hottext",description:__("Select one or more text parts (hottext) within a text."),short:__("Hottext"),qtiClass:"hottextInteraction",tags:[tagTitles.commonInteractions,"text"],group:"common-interactions"},gapMatchInteraction:{label:__("Gap Match Interaction"),icon:"icon-gap-match",description:__(" Fill in the gaps in a text from a set of choices."),short:__("Gap Match"),qtiClass:"gapMatchInteraction",tags:[tagTitles.commonInteractions,"text","association"],group:"common-interactions"},sliderInteraction:{label:__("Slider Interaction"),icon:"icon-slider",description:__("Select a value within a numerical range."),short:__("Slider"),qtiClass:"sliderInteraction",tags:[tagTitles.commonInteractions,"special"],group:"common-interactions"},extendedTextInteraction:{label:__("Extended Text Interaction"),icon:"icon-extended-text",description:__("Collect open-ended information in one or more text area(s) (strings or numeric values)."),short:__("Extended Text"),qtiClass:"extendedTextInteraction",tags:[tagTitles.commonInteractions,"text"],group:"common-interactions"},uploadInteraction:{label:__("File Upload Interaction"),icon:"icon-upload",description:__("Upload a file (e.g. document, picture...) as a response."),short:__("File Upload"),qtiClass:"uploadInteraction",tags:[tagTitles.commonInteractions,"special"],group:"common-interactions"},mediaInteraction:{label:__("Media Interaction"),icon:"icon-media",description:__("Control the playing parameters (auto-start, loop) of a video or audio file and report the number of time it has been played."),short:__("Media"),qtiClass:"mediaInteraction",tags:[tagTitles.commonInteractions,"media"],group:"common-interactions"},_container:{label:__("Text Block"),icon:"icon-font",description:__("Block contains the content (stimulus) of the item such as text or image. It is also required for Inline Interactions."),short:__("Block"),qtiClass:"_container",tags:[tagTitles.inlineInteractions,"text"],group:"inline-interactions"},inlineChoiceInteraction:{label:__("Inline Choice Interaction"),icon:"icon-inline-choice",description:__("Select a choice from a drop-down list."),short:__("Inline Choice"),qtiClass:"inlineChoiceInteraction",tags:[tagTitles.inlineInteractions,"inline-interactions","mcq"],group:"inline-interactions"},textEntryInteraction:{label:__("Text Entry Interaction"),icon:"icon-text-entry",description:__("Collect open-ended information in a short text input (strings or numeric values)."),short:__("Text Entry"),qtiClass:"textEntryInteraction",tags:[tagTitles.inlineInteractions,"inline-interactions","text"],group:"inline-interactions"},endAttemptInteraction:{label:__("End Attempt Interaction"),icon:"icon-end-attempt",description:__("Trigger the end of the item attempt."),short:__("End Attempt"),qtiClass:"endAttemptInteraction",tags:[tagTitles.inlineInteractions,"inline-interactions","button","submit"],group:"inline-interactions"},hotspotInteraction:{label:__("Hotspot Interaction"),icon:"icon-hotspot",description:__("Select one or more areas (hotspots) displayed on an picture."),short:__("Hotspot"),qtiClass:"hotspotInteraction",tags:[tagTitles.graphicInteractions,"mcq"],group:"graphic-interactions"},graphicOrderInteraction:{label:__("Graphic Order Interaction"),icon:"icon-graphic-order",description:__("Order the areas (hotspots) displayed on a picture."),short:__("Order"),qtiClass:"graphicOrderInteraction",tags:[tagTitles.graphicInteractions,"ordering"],group:"graphic-interactions"},graphicAssociateInteraction:{label:__("Graphic Associate Interaction"),icon:"icon-graphic-associate",description:__("Create association(s) between areas (hotspots) displayed on a picture."),short:__("Associate"),qtiClass:"graphicAssociateInteraction",tags:[tagTitles.graphicInteractions,"association"],group:"graphic-interactions"},graphicGapMatchInteraction:{label:__("Graphic Gap Match Interaction"),icon:"icon-graphic-gap",description:__("Fill in the gaps on a picture with a set of image choices."),short:__("Gap Match"),qtiClass:"graphicGapMatchInteraction",tags:[tagTitles.graphicInteractions,"association"],group:"graphic-interactions"},selectPointInteraction:{label:__("Select Point Interaction"),icon:"icon-select-point",description:__("Position one or more points on a picture (response areas are not displayed)."),short:__("Select Point"),qtiClass:"selectPointInteraction",tags:[tagTitles.graphicInteractions],group:"graphic-interactions"}}},QtiElements}),define("taoQtiItem/portableElementRegistry/factory/ciRegistry",["lodash","taoQtiItem/portableElementRegistry/factory/factory","taoQtiItem/qtiCreator/helper/qtiElements"],function(_,portableElementRegistry,qtiElements){'use strict';return function(){return portableElementRegistry({getAuthoringData:function(typeIdentifier,options){var pciModel;if(options=_.defaults(options||{},{version:0,enabledOnly:!1}),pciModel=this.get(typeIdentifier,options.version),pciModel&&pciModel.creator&&pciModel.creator.hook&&pciModel.creator.icon&&(pciModel.enabled||!options.enabledOnly))return{label:pciModel.label,icon:pciModel.creator.icon.replace(new RegExp("^"+typeIdentifier+"/"),pciModel.baseUrl),short:pciModel.short,description:pciModel.description,qtiClass:"customInteraction."+pciModel.typeIdentifier,tags:_.union(["Custom Interactions"],pciModel.tags),group:"custom-interactions"}}}).on("creatorsloaded",function(){var creators=this.getLatestCreators();_.forEach(creators,function(creator,typeIdentifier){qtiElements.classes["customInteraction."+typeIdentifier]={parents:["customInteraction"],qti:!0}})})}}),define("taoQtiItem/portableElementRegistry/ciRegistry",["lodash","taoQtiItem/portableElementRegistry/factory/ciRegistry","module"],function(_,ciRegistry,module){'use strict';var registry=ciRegistry(),providers=[],config=module.config();return config&&config.providers&&(providers=config.providers),_.each(providers,function(provider){provider.name&&provider.module&®istry.registerProvider(provider.module)}),registry}),define("taoQtiItem/portableElementRegistry/factory/icRegistry",["lodash","taoQtiItem/portableElementRegistry/factory/factory"],function(_,portableElementRegistry){'use strict';return function(){return portableElementRegistry()}}),define("taoQtiItem/portableElementRegistry/icRegistry",["lodash","taoQtiItem/portableElementRegistry/factory/icRegistry","module"],function(_,icRegistry,module){'use strict';var registry=icRegistry(),providers=[],config=module.config();return config&&config.providers&&(providers=config.providers),_.each(providers,function(provider){provider.name&&provider.module&®istry.registerProvider(provider.module)}),registry}),define("taoQtiItem/qtiCreator/context/plugins/content/windowResizer",["jquery","lodash","core/plugin"],function($,_,pluginFactory){'use strict';var $window=$(window);return pluginFactory({name:"windowResizer",init:function(){var qtiCreatorContext=this.getHost();$window.on("resize.itemcreatorwindowresizer",_.throttle(function(){qtiCreatorContext.trigger("resize")},200))},destroy:function(){$window.off("resize.itemcreatorwindowresizer")}})}),define("taoQtiItem/qtiCreator/context/loader",["core/pluginLoader","taoQtiItem/qtiCreator/context/plugins/content/windowResizer"],function(pluginLoader,windowResizer){'use strict';return pluginLoader({content:[windowResizer]})}),define("taoQtiItem/qtiCreator/context/qtiCreatorContext",["lodash","core/eventifier","core/promise","taoQtiItem/qtiCreator/context/loader"],function(_,eventifier,Promise,pluginLoader){'use strict';return function(){var plugins={},pluginRun=function(method){var execStack=[];return _.forEach(plugins,function(plugin){_.isFunction(plugin[method])&&execStack.push(plugin[method]())}),Promise.all(execStack)};return eventifier({init:function init(){var _this2=this;return pluginLoader.load().then(function(){var pluginFactories=pluginLoader.getPlugins();return _.forEach(pluginFactories,function(pluginFactory){var plugin=pluginFactory(_this2);plugins[plugin.getName()]=plugin}),pluginRun("init").then(function(){_this2.trigger("init")})}).catch(function(err){_this2.trigger("error",err)})},destroy:function destroy(){var _this3=this;return pluginRun("destroy").then(function(){_this3.trigger("destroy")}).catch(function(err){this.trigger("error",err)})}})}}),define("taoQtiItem/qtiItem/core/qtiClasses",[],function(){'use strict';return{_container:"taoQtiItem/qtiItem/core/Container",assessmentItem:"taoQtiItem/qtiItem/core/Item",responseProcessing:"taoQtiItem/qtiItem/core/ResponseProcessing",_simpleFeedbackRule:"taoQtiItem/qtiItem/core/response/SimpleFeedbackRule",stylesheet:"taoQtiItem/qtiItem/core/Stylesheet",math:"taoQtiItem/qtiItem/core/Math",img:"taoQtiItem/qtiItem/core/Img",object:"taoQtiItem/qtiItem/core/Object",outcomeDeclaration:"taoQtiItem/qtiItem/core/variables/OutcomeDeclaration",responseDeclaration:"taoQtiItem/qtiItem/core/variables/ResponseDeclaration",rubricBlock:"taoQtiItem/qtiItem/core/RubricBlock",associableHotspot:"taoQtiItem/qtiItem/core/choices/AssociableHotspot",gap:"taoQtiItem/qtiItem/core/choices/Gap",gapImg:"taoQtiItem/qtiItem/core/choices/GapImg",gapText:"taoQtiItem/qtiItem/core/choices/GapText",hotspotChoice:"taoQtiItem/qtiItem/core/choices/HotspotChoice",hottext:"taoQtiItem/qtiItem/core/choices/Hottext",inlineChoice:"taoQtiItem/qtiItem/core/choices/InlineChoice",simpleAssociableChoice:"taoQtiItem/qtiItem/core/choices/SimpleAssociableChoice",simpleChoice:"taoQtiItem/qtiItem/core/choices/SimpleChoice",associateInteraction:"taoQtiItem/qtiItem/core/interactions/AssociateInteraction",choiceInteraction:"taoQtiItem/qtiItem/core/interactions/ChoiceInteraction",endAttemptInteraction:"taoQtiItem/qtiItem/core/interactions/EndAttemptInteraction",extendedTextInteraction:"taoQtiItem/qtiItem/core/interactions/ExtendedTextInteraction",gapMatchInteraction:"taoQtiItem/qtiItem/core/interactions/GapMatchInteraction",graphicAssociateInteraction:"taoQtiItem/qtiItem/core/interactions/GraphicAssociateInteraction",graphicGapMatchInteraction:"taoQtiItem/qtiItem/core/interactions/GraphicGapMatchInteraction",graphicOrderInteraction:"taoQtiItem/qtiItem/core/interactions/GraphicOrderInteraction",hotspotInteraction:"taoQtiItem/qtiItem/core/interactions/HotspotInteraction",hottextInteraction:"taoQtiItem/qtiItem/core/interactions/HottextInteraction",inlineChoiceInteraction:"taoQtiItem/qtiItem/core/interactions/InlineChoiceInteraction",matchInteraction:"taoQtiItem/qtiItem/core/interactions/MatchInteraction",mediaInteraction:"taoQtiItem/qtiItem/core/interactions/MediaInteraction",orderInteraction:"taoQtiItem/qtiItem/core/interactions/OrderInteraction",prompt:"taoQtiItem/qtiItem/core/interactions/Prompt",selectPointInteraction:"taoQtiItem/qtiItem/core/interactions/SelectPointInteraction",sliderInteraction:"taoQtiItem/qtiItem/core/interactions/SliderInteraction",textEntryInteraction:"taoQtiItem/qtiItem/core/interactions/TextEntryInteraction",uploadInteraction:"taoQtiItem/qtiItem/core/interactions/UploadInteraction",feedbackBlock:"taoQtiItem/qtiItem/core/feedbacks/FeedbackBlock",feedbackInline:"taoQtiItem/qtiItem/core/feedbacks/FeedbackInline",modalFeedback:"taoQtiItem/qtiItem/core/feedbacks/ModalFeedback",customInteraction:"taoQtiItem/qtiItem/core/interactions/CustomInteraction",infoControl:"taoQtiItem/qtiItem/core/PortableInfoControl",include:"taoQtiItem/qtiItem/core/Include",table:"taoQtiItem/qtiItem/core/Table",printedVariable:"taoQtiItem/qtiItem/core/PrintedVariable",_tooltip:"taoQtiItem/qtiItem/core/Tooltip"}}),define("taoQtiItem/qtiItem/helper/util",["lodash"],function(_){'use strict';_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_;return{buildSerial:function(prefix){for(var id=prefix||"",chars="abcdefghijklmnopqrstuvwxyz0123456789",i=0;22>i;i++)id+=chars.charAt(Math.floor(Math.random()*chars.length));return id},buildId:function(item,prefix){var i=1,suffix="",exists=!1,id,usedIds;if(!item)throw new TypeError("A item is required to generate a unique identifier");usedIds=item.getUsedIds();do exists=!1,id=prefix+suffix,_.contains(usedIds,id)&&(exists=!0,suffix="_"+i,i++);while(exists);return id},buildIdentifier:function(item,prefix,useSuffix){var suffix="",i=1,exists=!1,id,usedIds;if(!item)throw new TypeError("A item is required to generate a unique identifier");if(!prefix)throw new TypeError("Prefix is required to build an identifier");usedIds=item.getUsedIdentifiers(),useSuffix=!!_.isUndefined(useSuffix)||useSuffix,prefix&&(prefix=prefix.replace(/_[0-9]+$/gi,"_").replace(/[^a-zA-Z0-9_]/gi,"_").replace(/(_)+/gi,"_"),useSuffix&&(suffix="_"+i));do exists=!1,id=prefix+suffix,usedIds[id]&&(exists=!0,suffix="_"+i,i++);while(exists);return id},findInCollection:function(element,collectionNames,searchedSerial){var found=null;if(_.isString(collectionNames)&&(collectionNames=[collectionNames]),_.isArray(collectionNames))_.each(collectionNames,function(collectionName){var collection=element;_.each(collectionName.split("."),function(nameToken){collection=collection[nameToken]});var elt=collection[searchedSerial];return elt?(found={parent:element,element:elt},!1):(_.each(collection,function(elt){if(_.isFunction(elt.find)&&(found=elt.find(searchedSerial),found))return!1}),!found)&&void 0});else throw new Error("invalid argument : collectionNames must be an array or a string");return found},addMarkupNamespace:function(markup,ns){return ns?(markup=markup.replace(/<(\/)?([a-z:]+)(\s?)([^><]*)>/g,function($0,$1,$2,$3,$4){return 0<$2.indexOf(":")?$0:($1=$1||"",$3=$3||"","<"+$1+ns+":"+$2+$3+$4+">")}),markup):markup},removeMarkupNamespaces:function(markup){return markup.replace(/<(\/)?(\w*):([^>]*)>/g,"<$1$3>")},getMarkupUsedNamespaces:function(markup){var namespaces=[];return markup.replace(/<(\/)?(\w*):([^>]*)>/g,function(original,slash,ns,node){return namespaces.push(ns),"<"+slash+node+">"}),_.uniq(namespaces)}}}),define("taoQtiItem/qtiItem/helper/rendererConfig",["lodash","jquery"],function(_,$){'use strict';_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,$=$&&Object.prototype.hasOwnProperty.call($,"default")?$["default"]:$;return{getOptionsFromArguments:function(args){var options={data:{},placeholder:null,subclass:"",renderer:null};return _.each(args,function(arg){arg&&(arg.isRenderer?options.renderer=arg:arg instanceof $&&arg.length?options.placeholder=arg:_.isString(arg)?options.subclass=arg:_.isPlainObject(arg)?options.data=arg:console.log("invalid arg",arg,args))}),options}}}),define("taoQtiItem/qtiItem/core/Element",["jquery","lodash","class","core/logger","taoQtiItem/qtiItem/helper/util","taoQtiItem/qtiItem/helper/rendererConfig"],function($,_,_class,loggerFactory,util,rendererConfig){'use strict';$=$&&Object.prototype.hasOwnProperty.call($,"default")?$["default"]:$,_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,loggerFactory=loggerFactory&&Object.prototype.hasOwnProperty.call(loggerFactory,"default")?loggerFactory["default"]:loggerFactory,util=util&&Object.prototype.hasOwnProperty.call(util,"default")?util["default"]:util,rendererConfig=rendererConfig&&Object.prototype.hasOwnProperty.call(rendererConfig,"default")?rendererConfig["default"]:rendererConfig;var _instances={},logger=loggerFactory("taoQtiItem/qtiItem/core/Element"),Element=Class.extend({qtiClass:"",serial:"",rootElement:null,init:function init(serial,attributes){if(this.attributes={},this.metaData={},"object"===_typeof(serial)&&(attributes=serial,serial=""),serial||(serial=util.buildSerial(this.qtiClass+"_")),serial&&("string"!=typeof serial||!serial.match(/^[a-z_0-9]*$/i)))throw"invalid QTI serial : ("+_typeof(serial)+") "+serial;if(!_instances[serial])_instances[serial]=this,this.serial=serial,this.setAttributes(attributes||{});else throw"a QTI Element with the same serial already exists "+serial;"function"==typeof this.initContainer&&this.initContainer(arguments[2]||""),"function"==typeof this.initObject&&this.initObject()},is:function is(qtiClass){return qtiClass===this.qtiClass},placeholder:function placeholder(){return"{{"+this.serial+"}}"},getSerial:function getSerial(){return this.serial},getUsedIdentifiers:function getUsedIdentifiers(){var usedIds={},elts=this.getComposingElements();for(var i in elts){var elt=elts[i],id=elt.attr("identifier");id&&(usedIds[id]=elt)}return usedIds},getUsedIds:function(){var usedIds=[];return _.forEach(this.getComposingElements(),function(elt){var id=elt.attr("id");id&&!_.contains(usedIds,id)&&usedIds.push(id)}),usedIds},attr:function attr(name,value){if(name)if(void 0!==value)this.attributes[name]=value;else if("object"===_typeof(name))for(var prop in name)this.attr(prop,name[prop]);else if("string"==typeof name)return void 0===this.attributes[name]?void 0:this.attributes[name];return this},data:function data(name,value){if(name)if(void 0!==value)this.metaData[name]=value,$(document).trigger("metaChange.qti-widget",{element:this,key:name,value:value});else if("object"===_typeof(name))for(var prop in name)this.data(prop,name[prop]);else if("string"==typeof name)return void 0===this.metaData[name]?void 0:this.metaData[name];return this},removeData:function removeData(name){return delete this.metaData[name],this},removeAttr:function removeAttr(name){return this.removeAttributes(name)},setAttributes:function setAttributes(attributes){return _.isPlainObject(attributes)||logger.warn("attributes should be a plain object"),this.attributes=attributes,this},getAttributes:function getAttributes(){return _.clone(this.attributes)},removeAttributes:function removeAttributes(attrNames){for(var i in"string"==typeof attrNames&&(attrNames=[attrNames]),attrNames)delete this.attributes[attrNames[i]];return this},getComposingElements:function getComposingElements(){function append(element){elts[element.getSerial()]=element,elts=_.extend(elts,element.getComposingElements())}var elts={};return"function"==typeof this.initContainer&&append(this.getBody()),"function"==typeof this.initObject&&append(this.getObject()),_.each(this.metaData,function(v){Element.isA(v,"_container")?append(v):_.isArray(v)&&_.each(v,function(v){Element.isA(v,"_container")&&append(v)})}),elts},getUsedClasses:function getUsedClasses(){var ret=[this.qtiClass],composingElts=this.getComposingElements();return _.each(composingElts,function(elt){ret.push(elt.qtiClass)}),_.uniq(ret)},find:function find(serial){var found=null,object,body;return"function"==typeof this.initObject&&(object=this.getObject(),object.serial===serial&&(found={parent:this,element:object,location:"object"})),found||"function"!=typeof this.initContainer||(body=this.getBody(),found=body.serial===serial?{parent:this,element:body,location:"body"}:this.getBody().find(serial,this)),found},parent:function parent(){var item=this.getRootElement();if(item){var found=item.find(this.getSerial());if(found)return found.parent}return null},setRelatedItem:function setRelatedItem(item){logger.warn("Deprecated use of setRelatedItem()"),this.setRootElement(item)},setRootElement:function setRootElement(item){var composingElts,i;if(Element.isA(item,"assessmentItem"))for(i in this.rootElement=item,composingElts=this.getComposingElements(),composingElts)composingElts[i].setRootElement(item)},getRelatedItem:function getRelatedItem(){return logger.warn("Deprecated use of getRelatedItem()"),this.getRootElement()},getRootElement:function getRootElement(){var ret=null;return Element.isA(this.rootElement,"assessmentItem")&&(ret=this.rootElement),ret},setRenderer:function setRenderer(renderer){if(renderer&&renderer.isRenderer){this.renderer=renderer;var elts=this.getComposingElements();for(var serial in elts)elts[serial].setRenderer(renderer)}else throw"invalid qti rendering engine"},getRenderer:function getRenderer(){return this.renderer},render:function(){var args=rendererConfig.getOptionsFromArguments(arguments),_renderer=args.renderer||this.getRenderer(),tplData={},defaultData={tag:this.qtiClass,serial:this.serial,attributes:this.getAttributes()},rendering;if(!_renderer)throw new Error("render: no renderer found for the element "+this.qtiClass+":"+this.serial);return"function"==typeof this.initContainer&&(defaultData.body=this.getBody().render(args.renderer)),"function"==typeof this.initObject&&(defaultData.object={attributes:this.object.getAttributes()},defaultData.object.attributes.data=_renderer.resolveUrl(this.object.attr("data"))),tplData=_.merge(defaultData,args.data||{}),tplData=_renderer.getData(this,tplData,args.subclass),rendering=_renderer.renderTpl(this,tplData,args.subclass),args.placeholder&&args.placeholder.replaceWith(rendering),rendering},postRender:function postRender(data,altClassName,renderer){var postRenderers=[],_renderer=renderer||this.getRenderer();if("function"==typeof this.initContainer&&(postRenderers=this.getBody().postRender(data,"",renderer)),_renderer)postRenderers.push(_renderer.postRender(this,data,altClassName));else throw"postRender: no renderer found for the element "+this.qtiClass+":"+this.serial;return _.compact(postRenderers)},getContainer:function getContainer($scope,subclass){var renderer=this.getRenderer();if(renderer)return renderer.getContainer(this,$scope,subclass);throw"getContainer: no renderer found for the element "+this.qtiClass+":"+this.serial},toArray:function toArray(){var arr={serial:this.serial,type:this.qtiClass,attributes:this.getAttributes()};return"function"==typeof this.initContainer&&(arr.body=this.getBody().toArray()),"function"==typeof this.initObject&&(arr.object=this.object.toArray()),arr},isEmpty:function isEmpty(){return!1},addClass:function addClass(className){var clazz=this.attr("class")||"";_containClass(clazz,className)||this.attr("class",clazz+(clazz.length?" ":"")+className)},hasClass:function hasClass(className){return _containClass(this.attr("class"),className)},removeClass:function removeClass(className){var clazz=this.attr("class")||"";if(clazz){var regex=new RegExp("(?:^|\\s)"+className+"(?:\\s|$)");clazz=clazz.replace(regex," ").trim(),clazz?this.attr("class",clazz):this.removeAttr("class")}},toggleClass:function toggleClass(className,state){return"boolean"==typeof state?state?this.addClass(className):this.removeClass(className):this.hasClass(className)?this.removeClass(className):this.addClass(className)},isset:function isset(){return Element.issetElement(this.serial)},unset:function unset(){return Element.unsetElement(this.serial)}}),_containClass=function(allClassStr,className){var regex=new RegExp("(?:^|\\s)"+className+"(?:\\s|$)","");return allClassStr&®ex.test(allClassStr)};return Element.isA=function(qtiElement,qtiClass){return qtiElement instanceof Element&&qtiElement.is(qtiClass)},Element.getElementBySerial=function(serial){return _instances[serial]},Element.issetElement=function(serial){return!!_instances[serial]},Element.unsetElement=function(serial){var element=Element.getElementBySerial(serial);if(element){var composingElements=element.getComposingElements();return _.each(composingElements,function(elt){delete _instances[elt.serial]}),delete _instances[element.serial],!0}return!1},Element}),define("taoQtiItem/qtiItem/helper/xmlNsHandler",[],function(){'use strict';function getPrefix(namespaces,html5Ns){for(var key in namespaces)if(namespaces[key]===html5Ns)return key;return"qh5"}return{stripNs:function(body){return body.replace(/(<([\w]+)\:(article|aside|bdi|figure|footer|header|nav|rb|rp|rt|rtc|ruby|section))/gi,"<$3").replace(/(<\/([\w]+)\:(article|aside|bdi|figure|footer|header|nav|rb|rp|rt|rtc|ruby|section)>)/gi,"")},restoreNs:function(xml,namespaces){var xmlMatch=xml.match(/(<(article|aside|bdi|figure|footer|header|nav|rb|rp|rt|rtc|ruby|section)[^>]*>|<\/(article|aside|bdi|figure|footer|header|nav|rb|rp|rt|rtc|ruby|section)>)/gi),imsXsd="http://www.imsglobal.org/xsd",html5Ns=imsXsd+"/imsqtiv2p2_html5_v1p0",prefix=getPrefix(namespaces,html5Ns),prefixAtt="xmlns:"+prefix+"=\""+html5Ns+"\"",i=xmlMatch?xmlMatch.length:0,tagMatch;if(!xmlMatch)return xml;for(;i--;)tagMatch=xmlMatch[i].match(/((<)(article|aside|bdi|figure|footer|header|nav|rb|rp|rt|rtc|ruby|section)([^>]*)(>)|(<\/)(article|aside|bdi|figure|footer|header|nav|rb|rp|rt|rtc|ruby|section)(>))/i),xml=xml.replace(xmlMatch[i],tagMatch[5]?"<"+prefix+":"+tagMatch[3]+tagMatch[4]+">":"");return xmlMatch.length&&-1===xml.indexOf(prefixAtt)&&(xml=xml.replace("set;set++){if(!data.choices[set])throw new Error("missing match set #".concat(set));var matchSet=data.choices[set];for(var serial in matchSet){var choice=this.buildElement(matchSet[serial]);choice&&interaction.addChoice(choice,set)}}else for(var _serial in data.choices){var _choice=this.buildElement(data.choices[_serial]);_choice&&interaction.addChoice(_choice)}if(Element.isA(interaction,"graphicGapMatchInteraction")&&data.gapImgs)for(var _serial2 in data.gapImgs){var gapImg=this.buildElement(data.gapImgs[_serial2]);gapImg&&interaction.addGapImg(gapImg)}}},loadChoiceData:function loadChoiceData(choice,data){if(Element.isA(choice,"textVariableChoice"))choice.val(data.text);else if(Element.isA(choice,"gapImg"));else if(Element.isA(choice,"gapText"))choice.body()||choice.body(data.text);else if(Element.isA(choice,"containerChoice"));},loadObjectData:function loadObjectData(object,data){object.setAttributes(data.attributes),data._alt&&("object"===data._alt.qtiClass?object._alt=Loader.buildElement(data._alt):object._alt=data._alt)},loadMathData:function loadMathData(math,data){math.ns=data.ns||{},math.setMathML(data.mathML||""),_.forIn(data.annotations||{},function(value,encoding){math.setAnnotation(encoding,value)})},loadTooltipData:function loadTooltipData(tooltip,data){tooltip.content(data.content)},loadPciData:function loadPciData(pci,data){loadPortableCustomElementData(pci,data)},loadPicData:function loadPicData(pic,data){loadPortableCustomElementData(pic,data)}});return Loader}),define("taoQtiItem/qtiCreator/model/helper/event",["jquery","lodash"],function($,_){"use strict";var namespaceModel=".qti-creator",eventList=["containerBodyChange","containerElementAdded","elementCreated.qti-widget","attributeChange.qti-widget","choiceCreated.qti-widget","correctResponseChange.qti-widget","mapEntryChange.qti-widget","mapEntryRemove.qti-widget","deleted.qti-widget","choiceTextChange.qti-widget","responseTemplateChange.qti-widget","mappingAttributeChange.qti-widget","feedbackRuleConditionChange.qti-widget","feedbackRuleCreated.qti-widget","feedbackRuleRemoved.qti-widget","feedbackRuleElseCreated.qti-widget","feedbackRuleElseRemoved.qti-widget"],event={choiceCreated:function(choice,interaction){$(document).trigger("choiceCreated.qti-widget",{choice:choice,interaction:interaction})},choiceDeleted:function(choice,interaction){$(document).trigger("choiceDeleted.qti-widget",{choice:choice,interaction:interaction})},deleted:function deleted(element,parent){element.isset()&&element.unset(),$(document).off("."+element.getSerial()),$(document).trigger("deleted.qti-widget",{element:element,parent:parent})},getList:function getList(addedNamespace){var events=_.clone(eventList);return addedNamespace?_.map(events,function(e){return e+"."+addedNamespace}):events},initElementToWidgetListeners:function initElementToWidgetListeners(){$(document).off(".widget-container").on(event.getList(".widget-container").join(" "),function(e,data){var element=data.element||data.container||null,widget=data&&element&&element.data("widget");!widget&&data.parent&&(element=data.parent,widget=element.data("widget")),widget&&widget.$container.trigger(e.type+".qti-creator"+namespaceModel,data)})},getNs:function getNs(){return".qti-creator"},getNsModel:function getNsModel(){return namespaceModel}};return event}),define("taoQtiItem/qtiCreator/model/helper/invalidator",["lodash"],function(_){'use strict';return{completelyValid:function completelyValid(element){var item=element.getRootElement();if(item){var serial=element.getSerial(),invalidElements=item.data("invalid")||{};delete invalidElements[serial],item.data("invalid",invalidElements)}},valid:function valid(element,key){var item=element.getRootElement(),serial=element.getSerial();if(item){var invalidElements=item.data("invalid")||{};if(key)invalidElements[serial]&&invalidElements[serial][key]&&(delete invalidElements[serial][key],!_.size(invalidElements[serial])&&delete invalidElements[serial],item.data("invalid",invalidElements));else throw new Error("missing required argument \"key\"")}},invalid:function invalid(element,key,message,stateName){var item=element.getRootElement(),serial=element.getSerial();if(item){var invalidElements=item.data("invalid")||{};if(key)invalidElements[serial]||(invalidElements[serial]={}),invalidElements[serial][key]={message:message||"",stateName:stateName||"active"},item.data("invalid",invalidElements);else throw new Error("missing required arguments \"key\"")}},isValid:function isValid(element,key){var item=element.getRootElement(),serial=element.getSerial();if(item){var invalidElements=item.data("invalid")||{};return key?!(invalidElements[serial]&&invalidElements[serial][key]):!invalidElements[serial]}return!0}}}),define("taoQtiItem/qtiCreator/model/mixin/editable",["lodash","jquery","core/encoder/entity","taoQtiItem/qtiItem/core/Element","taoQtiItem/qtiCreator/model/helper/event","taoQtiItem/qtiCreator/model/helper/invalidator"],function(_,$,entity,Element,event,invalidator){'use strict';var _removeSelf=function(element){var removed=!1,related=element.getRootElement();if(related){var found=related.find(element.getSerial());if(found){var parent=found.parent;if(element.getResponseDeclaration){var response=element.getResponseDeclaration();response&&(invalidator.completelyValid(response),Element.unsetElement(response))}Element.isA(parent,"interaction")?("gapImg"===element.qtiClass?parent.removeGapImg(element):Element.isA(element,"choice")&&parent.removeChoice(element),removed=!0):"body"===found.location&&_.isFunction(parent.initContainer)?(_.isFunction(element.beforeRemove)&&element.beforeRemove(),parent.getBody().removeElement(element),removed=!0):Element.isA(parent,"_container")&&(_.isFunction(element.beforeRemove)&&element.beforeRemove(),parent.removeElement(element),removed=!0),removed&&(element.data("removed",!0),invalidator.completelyValid(element),event.deleted(element,parent))}}else throw new Error("no related item found");return removed},_removeElement=function(element,containerPropName,eltToBeRemoved){var targetSerial="",targetElt;return element[containerPropName]&&("string"==typeof eltToBeRemoved?(targetSerial=eltToBeRemoved,targetElt=Element.getElementBySerial(targetSerial)):eltToBeRemoved instanceof Element&&(targetSerial=eltToBeRemoved.getSerial(),targetElt=eltToBeRemoved),targetSerial&&(invalidator.completelyValid(targetElt),delete element[containerPropName][targetSerial],Element.unsetElement(targetSerial))),element};return{init:function init(serial,attributes){var attr={};"object"===_typeof(serial)&&(attributes=serial,serial=""),_.isFunction(this.getDefaultAttributes)&&_.extend(attr,this.getDefaultAttributes()),_.extend(attr,attributes),this._super(serial,attr)},attr:function attr(key,value){var ret=this._super(key,value);return"undefined"!=typeof key&&"undefined"!=typeof value&&$(document).trigger("attributeChange.qti-widget",{element:this,key:key,value:entity.encode(value)}),_.isString(ret)?entity.decode(ret):ret},removeAttr:function removeAttr(key){var ret=this._super(key);return $(document).trigger("attributeChange.qti-widget",{element:this,key:key,value:null}),ret},remove:function remove(){if(0===arguments.length)return _removeSelf(this);if(2===arguments.length)return _removeElement(this,arguments[0],arguments[1]);throw new Error("invalid number of argument given")}}}),define("taoQtiItem/qtiCreator/model/qtiClasses",["lodash","taoQtiItem/qtiItem/core/qtiClasses"],function(_,qtiClasses){"use strict";return _.defaults({assessmentItem:"taoQtiItem/qtiCreator/model/Item",_container:"taoQtiItem/qtiCreator/model/Container",img:"taoQtiItem/qtiCreator/model/Img",math:"taoQtiItem/qtiCreator/model/Math",object:"taoQtiItem/qtiCreator/model/Object",table:"taoQtiItem/qtiCreator/model/Table",rubricBlock:"taoQtiItem/qtiCreator/model/RubricBlock",modalFeedback:"taoQtiItem/qtiCreator/model/feedbacks/ModalFeedback",choiceInteraction:"taoQtiItem/qtiCreator/model/interactions/ChoiceInteraction",orderInteraction:"taoQtiItem/qtiCreator/model/interactions/OrderInteraction",associateInteraction:"taoQtiItem/qtiCreator/model/interactions/AssociateInteraction",matchInteraction:"taoQtiItem/qtiCreator/model/interactions/MatchInteraction",inlineChoiceInteraction:"taoQtiItem/qtiCreator/model/interactions/InlineChoiceInteraction",simpleChoice:"taoQtiItem/qtiCreator/model/choices/SimpleChoice",simpleAssociableChoice:"taoQtiItem/qtiCreator/model/choices/SimpleAssociableChoice",inlineChoice:"taoQtiItem/qtiCreator/model/choices/InlineChoice",mediaInteraction:"taoQtiItem/qtiCreator/model/interactions/MediaInteraction",uploadInteraction:"taoQtiItem/qtiCreator/model/interactions/UploadInteraction",textEntryInteraction:"taoQtiItem/qtiCreator/model/interactions/TextEntryInteraction",sliderInteraction:"taoQtiItem/qtiCreator/model/interactions/SliderInteraction",extendedTextInteraction:"taoQtiItem/qtiCreator/model/interactions/ExtendedTextInteraction",hotspotInteraction:"taoQtiItem/qtiCreator/model/interactions/HotspotInteraction",selectPointInteraction:"taoQtiItem/qtiCreator/model/interactions/SelectPointInteraction",graphicInteraction:"taoQtiItem/qtiCreator/model/interactions/GraphicOrderInteraction",graphicAssociateInteraction:"taoQtiItem/qtiCreator/model/interactions/GraphicAssociateInteraction",graphicGapMatchInteraction:"taoQtiItem/qtiCreator/model/interactions/GraphicGapMatchInteraction",graphicOrderInteraction:"taoQtiItem/qtiCreator/model/interactions/GraphicOrderInteraction",hotspotChoice:"taoQtiItem/qtiCreator/model/choices/HotspotChoice",gapImg:"taoQtiItem/qtiCreator/model/choices/GapImg",associableHotspot:"taoQtiItem/qtiCreator/model/choices/AssociableHotspot",gapMatchInteraction:"taoQtiItem/qtiCreator/model/interactions/GapMatchInteraction",hottextInteraction:"taoQtiItem/qtiCreator/model/interactions/HottextInteraction",hottext:"taoQtiItem/qtiCreator/model/choices/Hottext",gapText:"taoQtiItem/qtiCreator/model/choices/GapText",gap:"taoQtiItem/qtiCreator/model/choices/Gap",responseDeclaration:"taoQtiItem/qtiCreator/model/variables/ResponseDeclaration",responseProcessing:"taoQtiItem/qtiCreator/model/ResponseProcessing",customInteraction:"taoQtiItem/qtiCreator/model/interactions/PortableCustomInteraction",endAttemptInteraction:"taoQtiItem/qtiCreator/model/interactions/EndAttemptInteraction",infoControl:"taoQtiItem/qtiCreator/model/PortableInfoControl",include:"taoQtiItem/qtiCreator/model/Include",printedVariable:"taoQtiItem/qtiCreator/model/PrintedVariable",_tooltip:"taoQtiItem/qtiCreator/model/Tooltip"},qtiClasses)}),define("taoQtiItem/qtiCreator/model/helper/container",["jquery","lodash","taoQtiItem/qtiCreator/model/qtiClasses"],function($,_,qtiClasses){"use strict";return{createElements:function createElements(container,body,callback){var regex=/{{([a-z_]+)\.?([a-z_]*):new}}/ig,required={};body.replace(regex,function(original,qtiClass){if(qtiClasses[qtiClass])required[qtiClass]=qtiClasses[qtiClass];else throw new Error("missing required class : "+qtiClass)}),require(_.values(required),function(){var Qti=_.reduce([].slice.call(arguments),function(acc,qtiClassElt){return acc[qtiClassElt.prototype.qtiClass]=qtiClassElt,acc},{}),promises=[],$doc=$(document),newElts={},newBody=body.replace(regex,function(original,qtiClass,subClass){var elt=new Qti[qtiClass];return Qti[qtiClass]?(container.getRenderer()&&elt.setRenderer(container.getRenderer()),newElts[elt.getSerial()]=elt,subClass&&(elt.typeIdentifier=subClass),elt.placeholder()):original});container.setElements(newElts,newBody),_.each(newElts,function(elt){_.isFunction(elt.buildIdentifier)&&elt.buildIdentifier(),_.isFunction(elt.afterCreate)&&promises.push(elt.afterCreate())}),"function"==typeof callback&&Promise.all(promises).then(function(){_.each(newElts,function(elt){$doc.trigger("elementCreated.qti-widget",{parent:container.parent(),element:elt})}),callback.call(container,newElts)}).catch(function(err){container.getRenderer().getCreatorContext().trigger("error",err)})})}}}),define("taoQtiItem/qtiCreator/model/mixin/editableContainer",["taoQtiItem/qtiCreator/model/helper/container"],function(containerHelper){"use strict";return{createElements:function createElements(body,callback){var _this=this;containerHelper.createElements(_this.getBody(),body,function(newElts){callback.call(_this,newElts)})}}}),define("taoQtiItem/qtiItem/core/IdentifiedElement",["taoQtiItem/qtiItem/core/Element","taoQtiItem/qtiItem/helper/util"],function(Element,util){'use strict';Element=Element&&Object.prototype.hasOwnProperty.call(Element,"default")?Element["default"]:Element,util=util&&Object.prototype.hasOwnProperty.call(util,"default")?util["default"]:util;var IdentifiedElement=Element.extend({buildIdentifier:function(prefix,useSuffix){var item=this.getRootElement(),id=util.buildIdentifier(item,prefix||this.qtiClass,useSuffix);return id&&this.attr("identifier",id),this},id:function(value){return value||this.attr("identifier")||this.buildIdentifier(this.qtiClass,!0),this.attr("identifier",value)}});return IdentifiedElement}),define("taoQtiItem/qtiItem/mixin/Mixin",[],function(){'use strict';return{augment:function augment(targetClass,methods,options){if("function"==typeof targetClass&&"object"===_typeof(methods))for(var methodName in methods)if(!Object.hasOwnProperty(targetClass.prototype,methodName))targetClass.prototype[methodName]=methods[methodName];else if(options&&options.append){var _parent=targetClass.prototype[methodName];targetClass.prototype[methodName]=function(){return methods[methodName].apply(this,arguments),_parent.apply(this,arguments)}}}}}),define("taoQtiItem/qtiItem/core/Container",["jquery","lodash","taoQtiItem/qtiItem/core/Element","taoQtiItem/qtiItem/helper/rendererConfig"],function($,_,Element,rendererConfig){'use strict';$=$&&Object.prototype.hasOwnProperty.call($,"default")?$["default"]:$,_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,Element=Element&&Object.prototype.hasOwnProperty.call(Element,"default")?Element["default"]:Element,rendererConfig=rendererConfig&&Object.prototype.hasOwnProperty.call(rendererConfig,"default")?rendererConfig["default"]:rendererConfig;var Container=Element.extend({qtiClass:"_container",init:function init(body){if(this._super(),body&&"string"!=typeof body)throw"the body of a container must be a string";this.bdy=body||"",this.elements={}},body:function body(_body){if("undefined"==typeof _body)return this.bdy;if("string"==typeof _body)this.bdy=_body,$(document).trigger("containerBodyChange",{body:_body,container:this,parent:this.parent()});else throw"body must be a string"},setElements:function setElements(elements,body){var returnValue=!1;for(var i in elements){var elt=elements[i];if(elt instanceof Element)body=body||this.bdy,-1===body.indexOf(elt.placeholder())&&(body+=elt.placeholder()),elt.setRootElement(this.getRootElement()||null),this.elements[elt.getSerial()]=elt,$(document).trigger("containerElementAdded",{element:elt,container:this}),returnValue=!0;else throw returnValue=!1,"expected a qti element"}return this.body(body),returnValue},setElement:function setElement(element,body){return this.setElements([element],body)},removeElement:function removeElement(element){var serial="";return"string"==typeof element?serial=element:element instanceof Element&&(serial=element.getSerial()),delete this.elements[serial],this.body(this.body().replace("{{"+serial+"}}","")),this},getElements:function getElements(qtiClass){var elts={};if("string"==typeof qtiClass)for(var serial in this.elements)Element.isA(this.elements[serial],qtiClass)&&(elts[serial]=this.elements[serial]);else elts=_.clone(this.elements);return elts},getElement:function getElement(serial){return this.elements[serial]?this.elements[serial]:null},getComposingElements:function getComposingElements(){var elements=this.getElements(),elts={};for(var serial in elements)elts[serial]=elements[serial],elts=_.extend(elts,elements[serial].getComposingElements());return elts},render:function render(){var args=rendererConfig.getOptionsFromArguments(arguments),renderer=args.renderer||this.getRenderer(),elementsData=[],tpl=this.body();for(var serial in this.elements){var elt=this.elements[serial];if("function"==typeof elt.render)"_container"===elt.qtiClass?tpl=tpl.replace(elt.placeholder(),elt.render(renderer)):(tpl=tpl.replace(elt.placeholder(),"{{{"+serial+"}}}"),elementsData[serial]=elt.render(renderer));else throw"render() is not defined for the qti element: "+serial}if(renderer.isRenderer)return this._super({body:renderer.renderDirect(tpl,elementsData),contentModel:this.contentModel||"flow"},renderer,args.placeholder);throw"invalid qti renderer for qti container"},postRender:function postRender(data,altClassName,renderer){renderer=renderer||this.getRenderer();var res=_(this.elements).filter(function(elt){return"function"==typeof elt.postRender}).map(function(elt){return elt.postRender(data,"",renderer)}).flatten(!0).value().concat(this._super(data,altClassName,renderer));return res},toArray:function toArray(){var arr={serial:this.serial,body:this.bdy,elements:{}};for(var serial in this.elements)arr.elements[serial]=this.elements[serial].toArray();return arr},find:function find(serial,parent){var found=null;return this.elements[serial]?found={parent:parent||this,element:this.elements[serial],location:"body"}:_.each(this.elements,function(elt){if(found=elt.find(serial),found)return!1}),found},isEmpty:function isEmpty(){return!this.bdy}});return Container}),define("taoQtiItem/qtiItem/mixin/Container",["taoQtiItem/qtiItem/mixin/Mixin","taoQtiItem/qtiItem/core/Container"],function(Mixin,Container$1){'use strict';Mixin=Mixin&&Object.prototype.hasOwnProperty.call(Mixin,"default")?Mixin["default"]:Mixin,Container$1=Container$1&&Object.prototype.hasOwnProperty.call(Container$1,"default")?Container$1["default"]:Container$1;var methods={initContainer:function initContainer(body){this.bdy=new Container$1(body||""),this.bdy.setRootElement(this.getRootElement()||null),this.bdy.contentModel="blockStatic"},getBody:function getBody(){return this.bdy},body:function body(_body2){var ret=this.bdy.body(_body2);return _body2?this:ret},setElement:function setElement(element,body){return this.bdy.setElement(element,body),this},removeElement:function removeElement(element){return this.bdy.removeElement(element)},getElements:function getElements(qtiClass){return this.bdy.getElements(qtiClass)},getElement:function getElement(serial){return this.bdy.getElement(serial)}};return{augment:function augment(targetClass){Mixin.augment(targetClass,methods)},methods:methods}}),define("taoQtiItem/qtiItem/mixin/ContainerItemBody",["taoQtiItem/qtiItem/mixin/Mixin","taoQtiItem/qtiItem/mixin/Container","lodash"],function(Mixin,Container,_){'use strict';Mixin=Mixin&&Object.prototype.hasOwnProperty.call(Mixin,"default")?Mixin["default"]:Mixin,Container=Container&&Object.prototype.hasOwnProperty.call(Container,"default")?Container["default"]:Container,_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_;var methods={};_.extend(methods,Container.methods),_.extend(methods,{initContainer:function initContainer(body){Container.methods.initContainer.call(this,body),this.bdy.contentModel="itemBody"}});return{augment:function augment(targetClass){Mixin.augment(targetClass,methods)},methods:methods}}),define("taoQtiItem/qtiItem/core/Item",["taoQtiItem/qtiItem/core/Element","taoQtiItem/qtiItem/core/IdentifiedElement","taoQtiItem/qtiItem/mixin/ContainerItemBody","lodash","jquery","taoQtiItem/qtiItem/helper/util"],function(Element,IdentifiedElement,Container,_,$,util){'use strict';Element=Element&&Object.prototype.hasOwnProperty.call(Element,"default")?Element["default"]:Element,IdentifiedElement=IdentifiedElement&&Object.prototype.hasOwnProperty.call(IdentifiedElement,"default")?IdentifiedElement["default"]:IdentifiedElement,Container=Container&&Object.prototype.hasOwnProperty.call(Container,"default")?Container["default"]:Container,_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,$=$&&Object.prototype.hasOwnProperty.call($,"default")?$["default"]:$,util=util&&Object.prototype.hasOwnProperty.call(util,"default")?util["default"]:util;var Item=IdentifiedElement.extend({qtiClass:"assessmentItem",init:function(serial,attributes){this._super(serial,attributes),this.rootElement=this,this.stylesheets={},this.responses={},this.outcomes={},this.modalFeedbacks={},this.namespaces={},this.schemaLocations={},this.responseProcessing=null,this.apipAccessibility=null},getInteractions:function(){var interactions=[],elts=this.getComposingElements();for(var serial in elts)Element.isA(elts[serial],"interaction")&&interactions.push(elts[serial]);return interactions},addResponseDeclaration:function(response){if(Element.isA(response,"responseDeclaration"))response.setRootElement(this),this.responses[response.getSerial()]=response;else throw"is not a qti response declaration";return this},getResponseDeclaration:function(identifier){for(var i in this.responses)if(this.responses[i].attr("identifier")===identifier)return this.responses[i];return null},addOutcomeDeclaration:function(outcome){if(Element.isA(outcome,"outcomeDeclaration"))outcome.setRootElement(this),this.outcomes[outcome.getSerial()]=outcome;else throw"is not a qti outcome declaration";return this},getOutcomeDeclaration:function(identifier){var found;return _.forEach(this.outcomes,function(outcome){if(outcome.id()===identifier)return found=outcome,!1}),found},getOutcomes:function(){return _.clone(this.outcomes)},removeOutcome:function(identifier){var outcome=this.getOutcomeDeclaration(identifier);outcome&&(this.outcomes=_.omit(this.outcomes,outcome.getSerial()))},addModalFeedback:function(feedback){if(Element.isA(feedback,"modalFeedback"))feedback.setRootElement(this),this.modalFeedbacks[feedback.getSerial()]=feedback;else throw"is not a qti modal feedback";return this},getComposingElements:function(){var elts=this._super(),_this=this;return _.forEach(["responses","outcomes","modalFeedbacks","stylesheets"],function(elementCollection){for(var i in _this[elementCollection]){var elt=_this[elementCollection][i];elts[i]=elt,elts=_.extend(elts,elt.getComposingElements())}}),this.responseProcessing instanceof Element&&(elts[this.responseProcessing.getSerial()]=this.responseProcessing),elts},find:function(serial){var found=this._super(serial);return found||(found=util.findInCollection(this,["responses","outcomes","modalFeedbacks","stylesheets"],serial)),found},getResponses:function(){return _.clone(this.responses)},getRootElement:function(){return this},addNamespace:function(name,uri){this.namespaces[name]=uri},setNamespaces:function(namespaces){this.namespaces=namespaces},getNamespaces:function(){return _.clone(this.namespaces)},setSchemaLocations:function(locations){this.schemaLocations=locations},getSchemaLocations:function(){return _.clone(this.schemaLocations)},setApipAccessibility:function(apip){this.apipAccessibility=apip||null},getApipAccessibility:function(){return this.apipAccessibility},addStylesheet:function(stylesheet){if(Element.isA(stylesheet,"stylesheet"))stylesheet.setRootElement(this),this.stylesheets[stylesheet.getSerial()]=stylesheet;else throw"is not a qti stylesheet declaration";return this},removeStyleSheet:function(stylesheet){return delete this.stylesheets[stylesheet.getSerial()],this},stylesheetExists:function(href){var exists=!1;return _.forEach(this.stylesheets,function(stylesheet){if(stylesheet.attr("href")===href)return exists=!0,!1}),exists},setResponseProcessing:function(rp){if(Element.isA(rp,"responseProcessing"))rp.setRootElement(this),this.responseProcessing=rp;else throw"is not a response processing";return this},toArray:function toArray(){var arr=this._super(),toArray=function(elt){return elt.toArray()};return arr.namespaces=this.namespaces,arr.schemaLocations=this.schemaLocations,arr.outcomes=_.map(this.outcomes,toArray),arr.responses=_.map(this.responses,toArray),arr.stylesheets=_.map(this.stylesheets,toArray),arr.modalFeedbacks=_.map(this.modalFeedbacks,toArray),arr.responseProcessing=this.responseProcessing.toArray(),arr},isEmpty:function(){var body=this.body().trim();if(body){var $dummy=$("
").html(body),$children=$dummy.children();return!!(1===$children.length&&$children.hasClass("empty"))}return!0},clear:function(){var renderer=this.getRenderer();renderer&&_.isFunction(renderer.destroy)&&renderer.destroy(this)}});return Container.augment(Item),Item}),define("taoQtiItem/qtiItem/core/Stylesheet",["taoQtiItem/qtiItem/core/Element","lodash","taoQtiItem/qtiItem/helper/rendererConfig"],function(Element,_,rendererConfig){'use strict';Element=Element&&Object.prototype.hasOwnProperty.call(Element,"default")?Element["default"]:Element,_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,rendererConfig=rendererConfig&&Object.prototype.hasOwnProperty.call(rendererConfig,"default")?rendererConfig["default"]:rendererConfig;var Stylesheet=Element.extend({qtiClass:"stylesheet",render:function render(){var args=rendererConfig.getOptionsFromArguments(arguments),renderer=args.renderer||this.getRenderer(),defaultData={};return defaultData.attributes={href:renderer.resolveUrl(this.attr("href"))},this._super(_.merge(defaultData,args.data),args.placeholder,args.subclass,renderer)}});return Stylesheet}),define("taoQtiItem/qtiCreator/model/Stylesheet",["lodash","taoQtiItem/qtiCreator/model/mixin/editable","taoQtiItem/qtiItem/core/Stylesheet"],function(_,editable,Stylesheet){"use strict";var methods={};return _.extend(methods,editable),_.extend(methods,{getDefaultAttributes:function getDefaultAttributes(){return{href:"css/tao-user-styles.css",title:"",type:"text/css",media:"all"}}}),Stylesheet.extend(methods)}),define("taoQtiItem/qtiItem/core/ResponseProcessing",["taoQtiItem/qtiItem/core/Element"],function(Element){'use strict';Element=Element&&Object.prototype.hasOwnProperty.call(Element,"default")?Element["default"]:Element;var ResponseProcessing=Element.extend({qtiClass:"responseProcessing",processingType:"",xml:"",toArray:function toArray(){var arr=this._super();return arr.processingType=this.processingType,arr.xml=this.xml,arr}});return ResponseProcessing}),define("taoQtiItem/qtiItem/helper/interactionHelper",["lodash","taoQtiItem/qtiItem/core/Element"],function(_,Element){'use strict';var _Mathfloor=Math.floor;_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,Element=Element&&Object.prototype.hasOwnProperty.call(Element,"default")?Element["default"]:Element;return{convertChoices:function convertChoices(choices,outputType){var ret=[],_this=this;return _.each(choices,function(c){Element.isA(c,"choice")?"serial"===outputType?ret.push(c.getSerial()):"identifier"===outputType?ret.push(c.id()):ret.push(c):_.isArray(c)&&ret.push(_this.convertChoices(c,outputType))}),ret},findChoices:function findChoices(interaction,choices,inputType){var ret=[],_this=this;return _.each(choices,function(c){var choice;_.isString(c)?"serial"===inputType?(choice=interaction.getChoice(c),choice&&ret.push(choice)):"identifier"===inputType?(choice=interaction.getChoiceByIdentifier(c),choice&&ret.push(choice)):ret.push(c):_.isArray(c)?ret.push(_this.findChoices(interaction,c,inputType)):ret.push(c)}),ret},shuffleChoices:function shuffleChoices(choices){var r=[],f={},j=0;for(var i in choices)if(Element.isA(choices[i],"choice")){var choice=choices[i];choice.attr("fixed")&&(f[j]=choice),r.push(choice),j++}else throw"invalid element in array: is not a qti choice";for(var n=0;nindex&&_.forEach(this.shuffledChoices[serial][i],function(choiceSerial){choice.push(interaction.getChoice(choiceSerial))})}):_.forEach(this.shuffledChoices[serial],function(choiceSerial){choices.push(interaction.getChoice(choiceSerial))});else if(Element.isA(interaction,"matchInteraction"))for(this.shuffledChoices[serial]=[],i=0;2>i;i++)choices[i]=interactionHelper.shuffleChoices(interaction.getChoices(i)),this.shuffledChoices[serial][i]=_.pluck(choices[i],"serial");else choices=interactionHelper.shuffleChoices(interaction.getChoices()),this.shuffledChoices[serial]=_.pluck(choices,"serial");return"serial"===returnedType||"identifier"===returnedType?interactionHelper.convertChoices(choices,returnedType):_.clone(choices)}return[]},this.getRenderers=function(){return _renderers},this.getLocations=function(){return _locations},this.resolveUrl=function(url){return options.assetManager?"string"==typeof url&&0maxChoice||responseDeclaration.correctResponse.lengthscore&&0>=requiredChoiceCount&&(score=0),requiredChoiceCount--,gamp.add(acc,score)},0),responseDeclaration.mappingAttributes.upperBound&&(max=_Mathmin(max,parseFloat(responseDeclaration.mappingAttributes.upperBound||0)))}else"MAP_RESPONSE_POINT"===template&&(max=0);return max},orderInteractionBased:function(interaction){var maxChoice=parseInt(interaction.attr("maxChoices")||0,10),responseDeclaration=interaction.getResponseDeclaration(),template=responseHelper.getTemplateNameFromUri(responseDeclaration.template),max;return maxChoice&&0&&0>maxChoice?0:("MATCH_CORRECT"===template?_.isArray(responseDeclaration.correctResponse)&&maxChoice&&responseDeclaration.correctResponse.length>maxChoice||0?max=0:responseDeclaration.correctResponse&&(!_.isArray(responseDeclaration.correctResponse)||responseDeclaration.correctResponse.length)?max=1:max=0:("MAP_RESPONSE"===template||"MAP_RESPONSE_POINT"===template)&&(max=0),max)},associateInteractionBased:function(interaction,options){var responseDeclaration=interaction.getResponseDeclaration(),template=responseHelper.getTemplateNameFromUri(responseDeclaration.template),maxAssoc=parseInt(interaction.attr("maxAssociations")||0,10),minAssoc=0,mapDefault=parseFloat(responseDeclaration.mappingAttributes.defaultValue||0),max,requiredAssoc,totalAnswerableResponse,usedChoices,choicesIdentifiers,sortedMapEntries,i,allPossibleMapEntries,infiniteScoringPair;if(options=_.defaults(options||{},{possiblePairs:[],checkInfinitePair:!1}),maxAssoc&&minAssoc&&maxAssocmaxAssoc||minAssoc)?max=0:(max=1,choicesIdentifiers=[],_.forEach(responseDeclaration.correctResponse,function(pair){var choices;_.isString(pair)&&(choices=pair.trim().split(" "),_.isArray(choices)&&2===choices.length&&(choicesIdentifiers.push(choices[0].trim()),choicesIdentifiers.push(choices[1].trim())))}),_.forEach(_.countBy(choicesIdentifiers),function(count,identifier){var choice=interaction.getChoiceByIdentifier(identifier),matchMax;return choice?(matchMax=parseInt(choice.attr("matchMax"),10),matchMax&&matchMaxi;i++){if(choiceId=choices[i],!_usedChoices[choiceId]){if(choice=interaction.getChoiceByIdentifier(choiceId),!choice)return!1;_usedChoices[choiceId]={used:0,max:parseInt(choice.attr("matchMax"),10)}}if(_usedChoices[choiceId].max&&_usedChoices[choiceId].used===_usedChoices[choiceId].max)return!1;_usedChoices[choiceId].used++}return infiniteScoringPair=infiniteScoringPair||options.checkInfinitePair&&0v.score&&0>=requiredAssoc&&(score=0),requiredAssoc--,gamp.add(acc,score)},0),responseDeclaration.mappingAttributes.upperBound&&(max=_Mathmin(max,parseFloat(responseDeclaration.mappingAttributes.upperBound||0)))}else"MAP_RESPONSE_POINT"===template&&(max=0);return max},gapMatchInteractionBased:function(interaction){var responseDeclaration=interaction.getResponseDeclaration(),template=responseHelper.getTemplateNameFromUri(responseDeclaration.template),mapDefault=parseFloat(responseDeclaration.mappingAttributes.defaultValue||0),getMatchMaxOrderedChoices=function(choiceCollection){return _(choiceCollection).map(function(choice){return{matchMax:0===choice.attr("matchMax")?1/0:choice.attr("matchMax")||0,id:choice.id()}}).sortBy("matchMax").reverse().valueOf()},calculatePossiblePairs=function(gapMatchInteraction){var pairs=[],matchSet1=getMatchMaxOrderedChoices(gapMatchInteraction.getChoices()),matchSet2=getMatchMaxOrderedChoices(gapMatchInteraction.getGaps());return _.forEach(matchSet1,function(choice1){_.forEach(matchSet2,function(choice2){pairs.push([choice1.id,choice2.id])})}),pairs},max,skippableWrongResponse,totalAnswerableResponse,usedChoices,usedGaps,group1,group2,allPossibleMapEntries;if("MATCH_CORRECT"===template)responseDeclaration.correctResponse&&(!_.isArray(responseDeclaration.correctResponse)||responseDeclaration.correctResponse.length)?(max=1,group1=[],group2=[],_.forEach(responseDeclaration.correctResponse,function(pair){var choices;_.isString(pair)&&(choices=pair.trim().split(" "),_.isArray(choices)&&2===choices.length&&(group1.push(choices[0].trim()),group2.push(choices[1].trim())))}),_.forEach(_.countBy(group1),function(count,identifier){var choice=interaction.getChoiceByIdentifier(identifier),matchMax=parseInt(choice.attr("matchMax"),10);if(matchMax&&matchMax",""":"\"","'":"'"};return str.replace(/&|<|>|"|'/g,function(m){return map[m]})},qtiNamespace="http://www.imsglobal.org/xsd/imsqti_v2p2",qtiSchemaLocation={"http://www.imsglobal.org/xsd/imsqti_v2p2":"http://www.imsglobal.org/xsd/qti/qtiv2p2/imsqti_v2p2.xsd"},languagesUrl=urlUtil.route("index","Languages","tao");return{loadItem:function(config,callback){if(config.uri){var langList=request(languagesUrl),itemRdf=request(config.itemDataUrl,{uri:config.uri}).catch(function(d){return d});Promise.all([langList,itemRdf]).then(function(_ref6){var _ref7=_slicedToArray(_ref6,2),languagesList=_ref7[0],data=_ref7[1],loader,itemData,newItem;if(data.itemData)for(var response in data.itemData.responses){var newObject={};for(var mapKey in data.itemData.responses[response].mapping)newObject[decodeHtml(mapKey)]=data.itemData.responses[response].mapping[mapKey];data.itemData.responses[response].mapping=newObject}data.itemData&&"assessmentItem"===data.itemData.qtiClass?(loader=new Loader().setClassesLocation(qtiClasses),itemData=data.itemData,loader.loadItemData(itemData,function(loadedItem){var namespaces;loadedItem.isEmpty()&&loadedItem.body(""),namespaces=loadedItem.getNamespaces(),namespaces[""]=qtiNamespace,loadedItem.setNamespaces(namespaces),loadedItem.setSchemaLocations(qtiSchemaLocation),languagesList&&loadedItem.data("languagesList",languagesList);var _loadedItem$responseP=loadedItem.responseProcessing;_loadedItem$responseP=void 0===_loadedItem$responseP?{}:_loadedItem$responseP;var processingType=_loadedItem$responseP.processingType;if(!config.perInteractionRp&&"templateDriven"===processingType){var _itemData=itemData,_itemData$responses=_itemData.responses,responses=void 0===_itemData$responses?{}:_itemData$responses,_itemData$responsePro=_itemData.responseProcessing;_itemData$responsePro=void 0===_itemData$responsePro?{}:_itemData$responsePro;var _data=_itemData$responsePro.data,_itemData$responsePro2=_itemData$responsePro.responseRules,responseRules=void 0===_itemData$responsePro2?[]:_itemData$responsePro2,responseIdentifiers=[];_.forOwn(responses,function(_ref8){var identifier=_ref8.identifier;responseIdentifiers.push(identifier)});var itemScoreRP=itemScoreHelper(responseIdentifiers);responseRules.some(function(responseRule){return _.isEqual(responseRule,itemScoreRP)})&&loadedItem.responseProcessing.setProcessingType("custom",_data)}callback(loadedItem,this.getLoadedClasses())})):(newItem=new Item().id(_generateIdentifier(config.uri)).attr("title",config.label),newItem.createResponseProcessing(),newItem.setNamespaces({"":qtiNamespace,xsi:"http://www.w3.org/2001/XMLSchema-instance",m:"http://www.w3.org/1998/Math/MathML"}),newItem.setSchemaLocations(qtiSchemaLocation),newItem.data("new",!0),languagesList&&newItem.data("languagesList",languagesList),callback(newItem))})}}}}),define("taoQtiItem/portableElementRegistry/assetManager/portableAssetStrategy",["taoQtiItem/portableElementRegistry/ciRegistry","taoQtiItem/portableElementRegistry/icRegistry"],function(ciRegistry,icRegistry){'use strict';function getBaseUrlByIdentifier(typeIdentifier){return ciRegistry.get(typeIdentifier)?ciRegistry.getBaseUrl(typeIdentifier):icRegistry.get(typeIdentifier)?icRegistry.getBaseUrl(typeIdentifier):typeIdentifier}return{name:"portableElementLocation",handle:function(url){if(url.file===url.path)return getBaseUrlByIdentifier(url.file);return url.source===url.relative?url.relative.replace(/^(\.\/)?([a-z_0-9]+)\/(.*)/i,function(fullmatch,$1,typeIdentifier,relPath){var runtimeLocation=getBaseUrlByIdentifier(typeIdentifier);return runtimeLocation?runtimeLocation+"/"+relPath:fullmatch}):void 0}}}),define("taoQtiItem/qtiCommonRenderer/renderers/config",["lodash","context","ui/themes","taoItems/assets/manager","taoItems/assets/strategies","module","taoQtiItem/portableElementRegistry/assetManager/portableAssetStrategy"],function(_,context,themes,assetManagerFactory,assetStrategies,module,portableAssetStrategy){'use strict';_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,context=context&&Object.prototype.hasOwnProperty.call(context,"default")?context["default"]:context,themes=themes&&Object.prototype.hasOwnProperty.call(themes,"default")?themes["default"]:themes,assetManagerFactory=assetManagerFactory&&Object.prototype.hasOwnProperty.call(assetManagerFactory,"default")?assetManagerFactory["default"]:assetManagerFactory,assetStrategies=assetStrategies&&Object.prototype.hasOwnProperty.call(assetStrategies,"default")?assetStrategies["default"]:assetStrategies,module=module&&Object.prototype.hasOwnProperty.call(module,"default")?module["default"]:module,portableAssetStrategy=portableAssetStrategy&&Object.prototype.hasOwnProperty.call(portableAssetStrategy,"default")?portableAssetStrategy["default"]:portableAssetStrategy;var itemThemes=themes.get("items"),moduleConfig=module.config(),assetManager=assetManagerFactory([{name:"theme",handle:function(url){if(itemThemes&&url.path&&(url.path===itemThemes.base||_.contains(_.pluck(itemThemes.available,"path"),url.path)))return context.root_url+url.toString()}},assetStrategies.taomedia,assetStrategies.external,assetStrategies.base64,assetStrategies.itemCssNoCache,assetStrategies.baseUrl,portableAssetStrategy],{baseUrl:""}),config={name:"commonRenderer",locations:{assessmentItem:"taoQtiItem/qtiCommonRenderer/renderers/Item",_container:"taoQtiItem/qtiCommonRenderer/renderers/Container",_simpleFeedbackRule:!1,_tooltip:"taoQtiItem/qtiCommonRenderer/renderers/Tooltip",stylesheet:"taoQtiItem/qtiCommonRenderer/renderers/Stylesheet",outcomeDeclaration:!1,responseDeclaration:!1,responseProcessing:!1,img:"taoQtiItem/qtiCommonRenderer/renderers/Img",math:"taoQtiItem/qtiCommonRenderer/renderers/Math",object:"taoQtiItem/qtiCommonRenderer/renderers/Object",table:"taoQtiItem/qtiCommonRenderer/renderers/Table",printedVariable:"taoQtiItem/qtiCommonRenderer/renderers/PrintedVariable",rubricBlock:"taoQtiItem/qtiCommonRenderer/renderers/RubricBlock",modalFeedback:"taoQtiItem/qtiCommonRenderer/renderers/ModalFeedback",prompt:"taoQtiItem/qtiCommonRenderer/renderers/interactions/Prompt",choiceInteraction:"taoQtiItem/qtiCommonRenderer/renderers/interactions/ChoiceInteraction",extendedTextInteraction:"taoQtiItem/qtiCommonRenderer/renderers/interactions/ExtendedTextInteraction",orderInteraction:"taoQtiItem/qtiCommonRenderer/renderers/interactions/OrderInteraction",associateInteraction:"taoQtiItem/qtiCommonRenderer/renderers/interactions/AssociateInteraction",matchInteraction:"taoQtiItem/qtiCommonRenderer/renderers/interactions/MatchInteraction",textEntryInteraction:"taoQtiItem/qtiCommonRenderer/renderers/interactions/TextEntryInteraction",sliderInteraction:"taoQtiItem/qtiCommonRenderer/renderers/interactions/SliderInteraction",inlineChoiceInteraction:"taoQtiItem/qtiCommonRenderer/renderers/interactions/InlineChoiceInteraction","simpleChoice.choiceInteraction":"taoQtiItem/qtiCommonRenderer/renderers/choices/SimpleChoice.ChoiceInteraction","simpleChoice.orderInteraction":"taoQtiItem/qtiCommonRenderer/renderers/choices/SimpleChoice.OrderInteraction",hottext:"taoQtiItem/qtiCommonRenderer/renderers/choices/Hottext",gap:"taoQtiItem/qtiCommonRenderer/renderers/choices/Gap",gapText:"taoQtiItem/qtiCommonRenderer/renderers/choices/GapText","simpleAssociableChoice.matchInteraction":"taoQtiItem/qtiCommonRenderer/renderers/choices/SimpleAssociableChoice.MatchInteraction","simpleAssociableChoice.associateInteraction":"taoQtiItem/qtiCommonRenderer/renderers/choices/SimpleAssociableChoice.AssociateInteraction",inlineChoice:"taoQtiItem/qtiCommonRenderer/renderers/choices/InlineChoice",hottextInteraction:"taoQtiItem/qtiCommonRenderer/renderers/interactions/HottextInteraction",hotspotInteraction:"taoQtiItem/qtiCommonRenderer/renderers/interactions/HotspotInteraction",hotspotChoice:!1,gapMatchInteraction:"taoQtiItem/qtiCommonRenderer/renderers/interactions/GapMatchInteraction",selectPointInteraction:"taoQtiItem/qtiCommonRenderer/renderers/interactions/SelectPointInteraction",graphicOrderInteraction:"taoQtiItem/qtiCommonRenderer/renderers/interactions/GraphicOrderInteraction",mediaInteraction:"taoQtiItem/qtiCommonRenderer/renderers/interactions/MediaInteraction",uploadInteraction:"taoQtiItem/qtiCommonRenderer/renderers/interactions/UploadInteraction",graphicGapMatchInteraction:"taoQtiItem/qtiCommonRenderer/renderers/interactions/GraphicGapMatchInteraction",gapImg:"taoQtiItem/qtiCommonRenderer/renderers/choices/GapImg",graphicAssociateInteraction:"taoQtiItem/qtiCommonRenderer/renderers/interactions/GraphicAssociateInteraction",associableHotspot:!1,customInteraction:"taoQtiItem/qtiCommonRenderer/renderers/interactions/PortableCustomInteraction",infoControl:"taoQtiItem/qtiCommonRenderer/renderers/PortableInfoControl",include:"taoQtiItem/qtiCommonRenderer/renderers/Include",endAttemptInteraction:"taoQtiItem/qtiCommonRenderer/renderers/interactions/EndAttemptInteraction"},options:{assetManager:assetManager,themes:itemThemes,enableDragAndDrop:{associate:!!moduleConfig.associateDragAndDrop,gapMatch:!!moduleConfig.gapMatchDragAndDrop,graphicGapMatch:!!moduleConfig.graphicGapMatchDragAndDrop,order:!!moduleConfig.orderDragAndDrop},messages:moduleConfig.messages}};return config}),define("taoQtiItem/qtiCreator/renderers/config",["lodash","context","taoQtiItem/qtiCommonRenderer/renderers/config","taoItems/assets/manager","taoItems/assets/strategies"],function(_,context,commonRenderConfig,assetManagerFactory,assetStrategies){'use strict';var assetManager=assetManagerFactory([assetStrategies.taomedia,assetStrategies.external,assetStrategies.base64,assetStrategies.baseUrl],{baseUrl:""}),locations=_.defaults({_container:"taoQtiItem/qtiCreator/renderers/Container",_tooltip:"taoQtiItem/qtiCreator/renderers/Tooltip",assessmentItem:"taoQtiItem/qtiCreator/renderers/Item",rubricBlock:"taoQtiItem/qtiCreator/renderers/RubricBlock",img:"taoQtiItem/qtiCreator/renderers/Img",math:"taoQtiItem/qtiCreator/renderers/Math",object:"taoQtiItem/qtiCreator/renderers/Object",table:"taoQtiItem/qtiCreator/renderers/Table",modalFeedback:"taoQtiItem/qtiCreator/renderers/ModalFeedback",choiceInteraction:"taoQtiItem/qtiCreator/renderers/interactions/ChoiceInteraction",orderInteraction:"taoQtiItem/qtiCreator/renderers/interactions/OrderInteraction",matchInteraction:"taoQtiItem/qtiCreator/renderers/interactions/MatchInteraction",associateInteraction:"taoQtiItem/qtiCreator/renderers/interactions/AssociateInteraction",inlineChoiceInteraction:"taoQtiItem/qtiCreator/renderers/interactions/InlineChoiceInteraction",textEntryInteraction:"taoQtiItem/qtiCreator/renderers/interactions/TextEntryInteraction",hotspotInteraction:"taoQtiItem/qtiCreator/renderers/interactions/HotspotInteraction",selectPointInteraction:"taoQtiItem/qtiCreator/renderers/interactions/SelectPointInteraction",graphicOrderInteraction:"taoQtiItem/qtiCreator/renderers/interactions/GraphicOrderInteraction",graphicAssociateInteraction:"taoQtiItem/qtiCreator/renderers/interactions/GraphicAssociateInteraction",graphicGapMatchInteraction:"taoQtiItem/qtiCreator/renderers/interactions/GraphicGapMatchInteraction",mediaInteraction:"taoQtiItem/qtiCreator/renderers/interactions/MediaInteraction",uploadInteraction:"taoQtiItem/qtiCreator/renderers/interactions/UploadInteraction",sliderInteraction:"taoQtiItem/qtiCreator/renderers/interactions/SliderInteraction",extendedTextInteraction:"taoQtiItem/qtiCreator/renderers/interactions/ExtendedTextInteraction","simpleChoice.choiceInteraction":"taoQtiItem/qtiCreator/renderers/choices/SimpleChoice.ChoiceInteraction","simpleChoice.orderInteraction":"taoQtiItem/qtiCreator/renderers/choices/SimpleChoice.OrderInteraction","simpleAssociableChoice.associateInteraction":"taoQtiItem/qtiCreator/renderers/choices/SimpleAssociableChoice.AssociateInteraction","simpleAssociableChoice.matchInteraction":"taoQtiItem/qtiCreator/renderers/choices/SimpleAssociableChoice.MatchInteraction",gapMatchInteraction:"taoQtiItem/qtiCreator/renderers/interactions/GapMatchInteraction",hottextInteraction:"taoQtiItem/qtiCreator/renderers/interactions/HottextInteraction",customInteraction:"taoQtiItem/qtiCreator/renderers/interactions/PortableCustomInteraction",endAttemptInteraction:"taoQtiItem/qtiCreator/renderers/interactions/EndAttemptInteraction",infoControl:"taoQtiItem/qtiCreator/renderers/PortableInfoControl",include:"taoQtiItem/qtiCreator/renderers/Include",gap:"taoQtiItem/qtiCreator/renderers/choices/Gap",gapText:"taoQtiItem/qtiCreator/renderers/choices/GapText",hottext:"taoQtiItem/qtiCreator/renderers/choices/Hottext",printedVariable:"taoQtiItem/qtiCreator/renderers/PrintedVariable"},commonRenderConfig.locations);return{name:"creatorRenderer",locations:locations,options:{assetManager:assetManager}}}),define("taoQtiItem/qtiCreator/renderers/Renderer",["taoQtiItem/qtiRunner/core/Renderer","taoQtiItem/qtiCreator/renderers/config"],function(Renderer,config){'use strict';return Renderer.build(config.locations,config.name,config.options)}),define("taoQtiItem/qtiCreator/helper/creatorRenderer",["jquery","lodash","taoQtiItem/qtiCreator/renderers/Renderer","taoItems/assets/manager","taoItems/assets/strategies","util/dom"],function($,_,Renderer,assetManagerFactory,assetStrategies,dom){"use strict";var _creatorRenderer=null,_configurableInteractions=["endAttempt"],_extractInteractionsConfig=function(config){var ret={};return config&&config.properties&&_.each(_configurableInteractions,function(interactionName){config.properties[interactionName]&&(ret[interactionName]=config.properties[interactionName])}),ret},get=function(reset,config,areaBroker){var $bodyEltForm;return config=config||{},config.properties=config.properties||{},(!_creatorRenderer||reset)&&($bodyEltForm=_creatorRenderer?_creatorRenderer.getOption("bodyElementOptionForm"):null,(reset||!$bodyEltForm||!$bodyEltForm.length||!dom.contains($bodyEltForm))&&(_creatorRenderer=new Renderer({lang:"",uri:"",shuffleChoices:!1,itemOptionForm:$("#item-editor-item-property-bar .panel"),interactionOptionForm:$("#item-editor-interaction-property-bar .panel"),choiceOptionForm:$("#item-editor-choice-property-bar .panel"),responseOptionForm:$("#item-editor-response-property-bar .panel"),bodyElementOptionForm:areaBroker.getElementPropertyPanelArea(),textOptionForm:$("#item-editor-text-property-bar .panel"),modalFeedbackOptionForm:$("#item-editor-modal-feedback-property-bar .panel"),mediaManager:{appendContainer:"#mediaManager",browseUrl:config.properties.getFilesUrl,uploadUrl:config.properties.fileUploadUrl,deleteUrl:config.properties.fileDeleteUrl,downloadUrl:config.properties.fileDownloadUrl,fileExistsUrl:config.properties.fileExistsUrl,mediaSourcesUrl:config.properties.mediaSourcesUrl},interactions:_extractInteractionsConfig(config),qtiCreatorContext:config.qtiCreatorContext}),_creatorRenderer.getAssetManager().setData({baseUrl:config.properties.baseUrl||""}),_creatorRenderer.setAreaBroker(areaBroker),_.assign(_creatorRenderer,{getCreatorContext:function(){return this.getOption("qtiCreatorContext")}}))),_creatorRenderer};return{get:get,setOption:function setOption(name,value){return get().setOption(name,value)},setOptions:function setOptions(options){return get().setOptions(options)},load:function load(qtiClasses,done){return get().load(function(){_.isFunction(done)&&done.apply(this,arguments)},qtiClasses)}}}),define("taoQtiItem/qtiCommonRenderer/renderers/Renderer",["taoQtiItem/qtiRunner/core/Renderer","taoQtiItem/qtiCommonRenderer/renderers/config"],function(Renderer$1,config){'use strict';Renderer$1=Renderer$1&&Object.prototype.hasOwnProperty.call(Renderer$1,"default")?Renderer$1["default"]:Renderer$1,config=config&&Object.prototype.hasOwnProperty.call(config,"default")?config["default"]:config;var Renderer=Renderer$1.build(config.locations,config.name,config.options);return Renderer}),define("taoQtiItem/qtiCommonRenderer/helpers/container",["lodash","jquery","taoQtiItem/qtiItem/core/Element"],function(_,$,Element){'use strict';_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,$=$&&Object.prototype.hasOwnProperty.call($,"default")?$["default"]:$,Element=Element&&Object.prototype.hasOwnProperty.call(Element,"default")?Element["default"]:Element;var _containers={},_$containerContext=$(),_getSelector=function(element){var serial=element.getSerial(),selector="[data-serial=".concat(serial,"]");return Element.isA(element,"choice")?selector=".qti-choice".concat(selector):Element.isA(element,"interaction")&&(selector=".qti-interaction".concat(selector)),selector};return{setContext:function setContext($scope){_$containerContext=$scope},getContext:function getContext(){return _$containerContext},get:function get(element,$scope){var serial=element.getSerial();return $scope instanceof $&&$scope.length?$scope.find(_getSelector(element)):_$containerContext instanceof $&&_$containerContext.length?_$containerContext.find(_getSelector(element)):(_containers[serial]&&_containers[serial].length||(_containers[serial]=$(_getSelector(element))),_containers[serial])},reset:function reset(element){element instanceof Element&&_containers[element.getSerial()]&&(_containers=_.omit(_containers,element.getSerial()))},clear:function clear(){_containers={},_$containerContext=$()},trigger:function trigger(eventType,element,data){eventType&&(data&&!_.isArray(data)&&(data=[data]),this.get(element).trigger(eventType,data))},triggerResponseChangeEvent:function triggerResponseChangeEvent(interaction,extraData){this.trigger("responseChange",interaction,[{interaction:interaction,response:interaction.getResponse()},extraData])},targetBlank:function targetBlank($container){$container.on("click","a",function(e){e.preventDefault();var href=$(this).attr("href");href&&href.match(/^http/i)&&window.open(href,"_blank")})}}}),define("taoQtiItem/qtiCreator/helper/commonRenderer",["lodash","taoQtiItem/qtiCommonRenderer/renderers/Renderer","taoQtiItem/qtiCommonRenderer/helpers/container"],function(_,Renderer,containerHelper){"use strict";var _$previousContext=null,commonRenderer={render:function render(item,$container){return commonRenderer.setContext($container),_renderer.load(function(){$container.append(item.render(this)),item.postRender({},"",this)},item.getUsedClasses())},get:function get(reset,config){return(!_renderer||reset)&&(_renderer=new Renderer({shuffleChoices:!0}),config&&_renderer.getAssetManager().setData({baseUrl:config.properties.baseUrl||""})),_renderer},getOption:function getOption(name){return _renderer.getOption(name)},setOption:function setOption(name,value){return _renderer.setOption(name,value)},setOptions:function setOptions(options){return _renderer.setOptions(options)},setContext:function setContext($context){return _$previousContext=$context,containerHelper.setContext($context)},restoreContext:function restoreContext(){containerHelper.setContext(_$previousContext),_$previousContext=null},load:function load(qtiClasses,done){var renderer=_renderer||this.get();return renderer.load(function(){_.isFunction(done)&&done.apply(this,arguments)},qtiClasses)}},_renderer;return commonRenderer}),define("taoQtiItem/qtiItem/helper/simpleParser",["lodash","jquery","taoQtiItem/qtiItem/helper/util","taoQtiItem/qtiItem/core/Loader"],function(_,$,util,Loader){'use strict';function _getElementSelector(qtiClass,ns){return ns?ns+"\\:"+qtiClass+","+qtiClass:qtiClass}function getQtiClassFromXmlDom($node){var qtiClass=$node.prop("tagName").toLowerCase();return qtiClass=qtiClass.replace(/.*:/,""),_qtiClassNames[qtiClass]?_qtiClassNames[qtiClass]:qtiClass}function buildElement($elt){var qtiClass=getQtiClassFromXmlDom($elt),elt={qtiClass:qtiClass,serial:util.buildSerial(qtiClass+"_"),attributes:{}};return $.each($elt[0].attributes,function(){var attrName;this.specified&&(attrName=_qtiAttributesNames[this.name]||this.name,elt.attributes[attrName]=this.value)}),elt}function buildMath($elt,options){var elt=buildElement($elt);return elt.annotations={},$elt.find(_getElementSelector("annotation",options.ns.math)).each(function(){var $annotation=$(this),encoding=$annotation.attr("encoding");encoding&&(elt.annotations[encoding]=_.unescape($annotation.html())),$annotation.remove()}),elt.mathML=$elt.html(),elt.ns={name:"m",uri:"http://www.w3.org/1998/Math/MathML"},elt}function buildTooltip(targetHtml,contentId,contentHtml){return{elements:{},qtiClass:"_tooltip",serial:util.buildSerial("_tooltip_"),attributes:{"aria-describedby":contentId},content:contentHtml,body:{elements:{},serial:util.buildSerial("container"),body:targetHtml}}}function parseTable($elt,elt,options){elt.body={body:"",elements:{}};var $parsedTable=parseContainer($elt,options);return elt.body.body=$parsedTable.body,elt.body.elements=$parsedTable.elements,elt}function parseContainer($container,options){var ret={serial:util.buildSerial("_container_"),body:"",elements:{}};return $container.find("table").each(function(){var $qtiElement=$(this),element=buildElement($qtiElement);element=parseTable($qtiElement,element,options),ret.elements[element.serial]=element,$qtiElement.replaceWith(_placeholder(element))}),$container.find(_getElementSelector("math",options.ns.math)).each(function(){var $qtiElement=$(this),element=buildMath($qtiElement,options);ret.elements[element.serial]=element,$qtiElement.replaceWith(_placeholder(element))}),$container.find(_getElementSelector("include",options.ns.include)).each(function(){var $qtiElement=$(this),element=buildElement($qtiElement);ret.elements[element.serial]=element,$qtiElement.replaceWith(_placeholder(element))}),$container.find("[data-role=\"tooltip-target\"]").each(function(){var $target=$(this),contentId=$target.attr("aria-describedBy"),element,$content,contentHtml;contentId&&($content=$container.find("#"+contentId),$content.length&&(contentHtml=$content.html(),element=buildTooltip($target.html(),contentId,contentHtml),ret.elements[element.serial]=element,$target.replaceWith(_placeholder(element)),$content.remove()))}),_.each(_parsableElements,function(qtiClass){$container.find(qtiClass).each(function(){var $qtiElement=$(this),element=buildElement($qtiElement);ret.elements[element.serial]=element,$qtiElement.replaceWith(_placeholder(element))})}),ret.body=$container.html(),ret}function _placeholder(element){return"{{"+element.serial+"}}"}_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,$=$&&Object.prototype.hasOwnProperty.call($,"default")?$["default"]:$,util=util&&Object.prototype.hasOwnProperty.call(util,"default")?util["default"]:util,Loader=Loader&&Object.prototype.hasOwnProperty.call(Loader,"default")?Loader["default"]:Loader;var _parsableElements=["img","object","printedVariable"],_qtiClassNames={rubricblock:"rubricBlock",printedvariable:"printedVariable"},_qtiAttributesNames={powerform:"powerForm",mappingindicator:"mappingIndicator"},_defaultOptions={ns:{math:"",include:"xi",table:"table",image:"img",object:""},loaded:null,model:null},parser;parser={parse:function parse(xmlStr,opts){var options=_.merge(_.clone(_defaultOptions),opts||{}),$container=$(xmlStr),element=buildElement($container),data=parseContainer($container,options),loader;return _.isUndefined(data.body)||(element.body=data),_.isFunction(options.loaded)&&options.model&&(loader=new Loader().setClassesLocation(options.model),loader.loadAndBuildElement(element,options.loaded)),element}};var parser$1=parser;return parser$1}),define("taoQtiItem/qtiItem/helper/xincludeLoader",["jquery","lodash","taoQtiItem/qtiItem/helper/simpleParser","taoQtiItem/qtiItem/core/Loader"],function($,_,simpleParser,Loader){'use strict';$=$&&Object.prototype.hasOwnProperty.call($,"default")?$["default"]:$,_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,simpleParser=simpleParser&&Object.prototype.hasOwnProperty.call(simpleParser,"default")?simpleParser["default"]:simpleParser,Loader=Loader&&Object.prototype.hasOwnProperty.call(Loader,"default")?Loader["default"]:Loader;return{load:function(xinclude,baseUrl,callback){var href=xinclude.attr("href");href&&baseUrl&&require(["text!".concat(baseUrl).concat(href)],function(stimulusXml){var $wrapper=$.parseXML(stimulusXml),$sampleXMLrootNode=$wrapper.children,$stimulus=$("").append($sampleXMLrootNode),data=simpleParser.parse($stimulus,{ns:{math:"m"}});new Loader().loadElement(xinclude,data,function(){if(_.isFunction(callback)){var loadedClasses=this.getLoadedClasses();loadedClasses.push("_container"),callback(xinclude,data,loadedClasses)}})},function(){callback(xinclude,!1,[])})}}}),define("taoQtiItem/qtiCreator/helper/xincludeRenderer",["lodash","taoQtiItem/qtiCreator/helper/commonRenderer","taoQtiItem/qtiItem/helper/xincludeLoader"],function(_,commonRenderer,xincludeLoader){'use strict';return{render:function(xincludeWidget,baseUrl,newHref){var xinclude=xincludeWidget.element;newHref&&xinclude.attr("href",newHref),xincludeLoader.load(xinclude,baseUrl,function(xi,data,loadedClasses){data?commonRenderer.get().load(function(){_.each(xinclude.getComposingElements(),function(elt){elt.setRenderer(commonRenderer.get())}),xincludeWidget.refresh()},loadedClasses):xinclude.removeAttr("href")})}}}),define("tpl!taoQtiItem/qtiCreator/tpl/toolbars/insertInteractionButton",["handlebars"],function(hb){return hb.template(function(Handlebars,depth0,helpers,partials,data){function program1(depth0,data){var buffer="",stack1,helper;return buffer+="\n data-sub-group=\"",(helper=helpers.subGroup)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.subGroup,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\"\n",buffer}function program5(depth0,data){var buffer="",stack1,helper;return buffer+="\n title=\"",(helper=helpers.title)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.title,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\"\n",buffer}function program7(depth0,data){var buffer="",stack1,helper;return buffer+="\n \n ",buffer}function program9(depth0,data){var buffer="",stack1,helper;return buffer+="\n \n ",buffer}this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",escapeExpression=this.escapeExpression,self=this,stack1,helper;return buffer+="\n ",stack1=helpers["if"].call(depth0,depth0&&depth0.iconFont,{hash:{},inverse:self.program(9,program9,data),fn:self.program(7,program7,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n \n
",(helper=helpers.short)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.short,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"
\n",buffer})}),define("tpl!taoQtiItem/qtiCreator/tpl/toolbars/insertInteractionGroup",["handlebars"],function(hb){return hb.template(function(Handlebars,depth0,helpers,partials,data){this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",escapeExpression=this.escapeExpression,stack1,helper;return buffer+="
\n

",(helper=helpers.label)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.label,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"

\n
\n
    \n
    \n
    ",buffer})}),define("tpl!taoQtiItem/qtiCreator/tpl/toolbars/tooltip",["handlebars"],function(hb){return hb.template(function(Handlebars,depth0,helpers,partials,data){this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",escapeExpression=this.escapeExpression,stack1,helper;return buffer+="
    \n \n
    \n ",(helper=helpers.message)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.message,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\n
    \n
    ",buffer})}),define("taoQtiItem/qtiCreator/editor/interactionsToolbar",["jquery","lodash","i18n","ui/hider","tpl!taoQtiItem/qtiCreator/tpl/toolbars/insertInteractionButton","tpl!taoQtiItem/qtiCreator/tpl/toolbars/insertInteractionGroup","tpl!taoQtiItem/qtiCreator/tpl/toolbars/tooltip","ui/tooltip"],function($,_,__,hider,insertInteractionTpl,insertSectionTpl,tooltipTpl,tooltip){'use strict';function getGroupId(groupId){return groupId.replace(/\W+/g,"-").toLowerCase()}function getGroupSectionId(groupId){return"sidebar-left-section-"+getGroupId(groupId)}function addGroup($sidebar,groupId,groupLabel){var groupSectionId=getGroupSectionId(groupId),$section=$(insertSectionTpl({id:groupSectionId,label:groupLabel}));return $sidebar.append($section),$section}function getGroup($sidebar,groupId){var groupSectionId=getGroupSectionId(groupId);return $sidebar.find("#"+groupSectionId)}function isReady($sidebar){return!!$sidebar.data("interaction-toolbar-ready")}function exists($sidebar,interactionClass){return!!$sidebar.find("li[data-qti-class=\""+interactionClass+"\"]").length}function add($sidebar,interactionAuthoringData){if(exists($sidebar,interactionAuthoringData.qtiClass))throw"the interaction is already in the sidebar";var groupId=interactionAuthoringData.group,groupLabel=interactionAuthoringData.tags[0]||"",subGroupId=interactionAuthoringData.tags[1],tplData={qtiClass:interactionAuthoringData.qtiClass,disabled:!!interactionAuthoringData.disabled,title:interactionAuthoringData.description,iconFont:/^icon-/.test(interactionAuthoringData.icon),icon:interactionAuthoringData.icon,short:interactionAuthoringData.short,dev:!1},$group=getGroup($sidebar,groupId);subGroupId&&_subgroups[subGroupId]&&(tplData.subGroup=subGroupId),$group.length||($group=addGroup($sidebar,groupId,groupLabel)),subGroupId&&_subgroups[subGroupId]&&(tplData.subGroup=subGroupId),$group.length||($group=addGroup($sidebar,groupId,groupLabel));var $interaction=$(insertInteractionTpl(tplData));return $group.find(".tool-list").append($interaction),$interaction}function buildSubGroups($sidebar){$sidebar.find("[data-sub-group]").each(function(){var $element=$(this),$section=$element.parents("section"),subGroup=$element.data("sub-group"),$subGroupPanel,$subGroupList,$cover;subGroup&&($subGroupPanel=$section.find(".sub-group."+subGroup),$subGroupList=$subGroupPanel.find(".tool-list"),!$subGroupPanel.length&&($subGroupPanel=$("
    ",{class:"panel clearfix sub-group "+subGroup}),$subGroupList=$("
      ",{class:"tool-list plain clearfix"}),$subGroupPanel.append($subGroupList),$section.append($subGroupPanel),$cover=$("
      ",{class:"sub-group-cover blocking"}),$subGroupPanel.append($cover),$subGroupPanel.data("cover",$cover)),$subGroupList.append($element))}),addInlineInteractionTooltip()}function addInlineInteractionTooltip(){var $inlineInteractionsPanel=$("#sidebar-left-section-inline-interactions .inline-interactions"),$tooltip=$(tooltipTpl({message:__("Inline interactions need to be inserted into a text block.")})),timer;$inlineInteractionsPanel.append($tooltip),tooltip.lookup($inlineInteractionsPanel),$tooltip.css({position:"absolute",zIndex:11,top:0,right:10}),$inlineInteractionsPanel.on("mouseenter",".sub-group-cover",function(){timer=setTimeout(function(){$tooltip.find("[data-tooltip]").data("$tooltip").show()},300)}).on("mouseleave",".sub-group-cover",function(){$tooltip.find("[data-tooltip]").data("$tooltip").hide(),clearTimeout(timer)})}var _subgroups={"inline-interactions":"Inline Interactions"},_events={interactiontoolbarready:"interactiontoolbarready.qti-widget"};return{create:function($sidebar,interactions){_.each(interactions,function(interactionAuthoringData){add($sidebar,interactionAuthoringData)}),buildSubGroups($sidebar),$sidebar.data("interaction-toolbar-ready",!0),$sidebar.trigger(_events.interactiontoolbarready)},add:add,exists:exists,addGroup:addGroup,getGroupId:getGroupId,getGroupSectionId:getGroupSectionId,getGroup:getGroup,isReady:isReady,whenReady:function($sidebar){return new Promise(function(resolve){isReady($sidebar)?resolve():$sidebar.on(_events.interactiontoolbarready,function(){resolve()})})},remove:function($sidebar,interactionClass){$sidebar.find("li[data-qti-class=\""+interactionClass+"\"]").remove()},disable:function($sidebar,interactionClass){hider.hide($sidebar.find("li[data-qti-class=\""+interactionClass+"\"]"))},enable:function($sidebar,interactionClass){hider.show($sidebar.find("li[data-qti-class=\""+interactionClass+"\"]"))},getCustomInteractionTag:function getCustomInteractionTag(){return"Custom Interactions"}}}),define("taoQtiItem/qtiCreator/helper/panel",["jquery","lodash","taoQtiItem/qtiItem/core/Element"],function($,_,Element){"use strict";var _getItemContainer=function(){return $("#item-editor-panel")},showPanel=function($panel,$fold){$panel.show(),openSections($panel.children("section")),$fold&&$fold.length&&closeSections($fold.children("section"))},toggleInlineInteractionGroup=function(){var $itemContainer=_getItemContainer();$itemContainer.find(".widget-textBlock").length?enableSubGroup("inline-interactions"):disableSubGroup("inline-interactions")},heading="h2",section="section",panel="hr, .panel",closed="closed",ns="accordion",_toggleSections=function(sections,preserveOthers,state){sections.each(function(){$(this).find(heading).trigger("click",{preserveOthers:preserveOthers,forceState:state})})},closeSections=function(sections,preserveOthers){_toggleSections(sections,!!preserveOthers,"close")},openSections=function(sections,preserveOthers){_toggleSections(sections,!!preserveOthers,"open")},_toggleSubGroup=function(subGroup,state){if(subGroup=$("."+subGroup),subGroup.length){var fn="disable"===state?"addClass":"removeClass";subGroup.data("cover")[fn]("blocking")}},enableSubGroup=function(subGroup){_toggleSubGroup(subGroup,"enable")},disableSubGroup=function(subGroup){_toggleSubGroup(subGroup,"disable")};return{initFormVisibilityListener:function initFormVisibilityListener(){$(document).off(".panel");var $itemContainer=_getItemContainer(),_staticElements={_tooltip:"Tooltip",img:"Image",object:"Media",rubricBlock:"Rubric Block",math:"Math",table:"Table",include:"Shared Stimulus",infoControl:"Student Tool"},$formInteractionPanel=$("#item-editor-interaction-property-bar"),$formChoicePanel=$("#item-editor-choice-property-bar"),$formResponsePanel=$("#item-editor-response-property-bar"),$formItemPanel=$("#item-editor-item-property-bar"),$formBodyElementPanel=$("#item-editor-body-element-property-bar"),$formTextBlockPanel=$("#item-editor-text-property-bar"),$formModalFeedbackPanel=$("#item-editor-modal-feedback-property-bar"),$formStylePanel=$("#item-style-editor-bar"),$appearanceToggler=$("#appearance-trigger"),$menuLabel=$appearanceToggler.find(".menu-label"),$itemIcon=$appearanceToggler.find(".icon-item"),$styleIcon=$appearanceToggler.find(".icon-style"),_toggleAppearanceEditor=function(active){active?($appearanceToggler.addClass("active"),$formStylePanel.show(),$formItemPanel.hide(),$itemContainer.trigger("styleedit"),showPanel($formStylePanel),$menuLabel.text($menuLabel.data("item")),$itemIcon.show(),$styleIcon.hide()):($appearanceToggler.removeClass("active"),$formStylePanel.hide(),showPanel($formItemPanel),$menuLabel.text($menuLabel.data("style")),$itemIcon.hide(),$styleIcon.show())};$appearanceToggler.on("click",function(){$appearanceToggler.hasClass("active")?_toggleAppearanceEditor(!1):_toggleAppearanceEditor(!0)}),_.delay(function(){showPanel($formItemPanel)},200),$(document).on("afterStateInit.qti-widget.panel",function(e,element,state){switch(state.name){case"active":_toggleAppearanceEditor(!1),Element.isA(element,"assessmentItem")||$formItemPanel.hide();var label=_staticElements[element.qtiClass];label?($formBodyElementPanel.find("h2").html(label+" Properties"),showPanel($formBodyElementPanel)):"_container"===element.qtiClass&&showPanel($formTextBlockPanel),"modalFeedback"===element.qtiClass&&(showPanel($formModalFeedbackPanel),$formResponsePanel.hide());break;case"question":showPanel($formInteractionPanel);break;case"answer":showPanel($formResponsePanel);break;case"choice":showPanel($formChoicePanel,$formInteractionPanel);break;case"sleep":_staticElements[element.qtiClass]?$formBodyElementPanel.hide():"_container"===element.qtiClass&&$formTextBlockPanel.hide(),Element.isA(element,"choice")||$itemContainer.find(".widget-box.edit-active").length||showPanel($formItemPanel);}}).on("afterStateExit.qti-widget.panel",function(e,element,state){switch(state.name){case"active":"modalFeedback"===element.qtiClass&&(showPanel($formResponsePanel),$formModalFeedbackPanel.hide());break;case"question":element.is("interaction")&&($formChoicePanel.hide(),$formInteractionPanel.hide());break;case"choice":$formChoicePanel.hide(),showPanel($formInteractionPanel);break;case"answer":$formResponsePanel.hide();}}).on("elementCreated.qti-widget.panel",function(e,data){"_container"===data.element.qtiClass&&enableSubGroup("inline-interactions")}).on("deleted.qti-widget.panel",function(e,data){"_container"===data.element.qtiClass&&toggleInlineInteractionGroup()})},showPanel:showPanel,toggleInlineInteractionGroup:toggleInlineInteractionGroup,initSidebarAccordion:function initSidebarAccordion($sidebar){var $sections=$sidebar.find(section),$allPanels=$sidebar.children(panel).hide(),$allTriggers=$sidebar.find(heading);return!(0!==$allTriggers.length)||void($allTriggers.each(function(){var $heading=$(this),$section=$heading.parents(section),$panel=$section.children(panel),$closer=$("",{class:"icon-up"}),$opener=$("",{class:"icon-down"}),action=$panel.is(":visible")?"open":"close";($heading.append($closer).append($opener).addClass(closed),!$heading.hasClass("_accordion"))&&($heading.addClass("_accordion"),$panel.on("panelclose."+ns+" panelopen."+ns,function(e,args){var fn="panelclose"===e.type?"add":"remove";args.heading[fn+"Class"](closed)}),$panel.trigger("panel"+action+"."+ns,{heading:$heading}))}),$sections.each(function(){$(this).find(heading).on("click",function(e,args){var $heading=$(this),$panel=$heading.parents(section).children(panel),preserveOthers=!!(args&&args.preserveOthers),forceState=!!(args&&args.forceState)&&args.forceState,action,classFn;forceState&&(classFn="open"===forceState?"addClass":"removeClass",$heading[classFn](closed)),action=$heading.hasClass(closed)?"open":"close",!1,$panel.trigger("panel"+action+"."+ns,{heading:$heading})[{close:"hide",open:"fadeIn"}[action]]()})}))},openSections:openSections,closeSections:closeSections,enableSubGroup:enableSubGroup,disableSubGroup:disableSubGroup}}),define("taoQtiItem/qtiCreator/editor/interactionsPanel",["lodash","taoQtiItem/qtiCreator/editor/interactionsToolbar","taoQtiItem/qtiCreator/helper/panel","taoQtiItem/qtiCreator/helper/qtiElements","taoQtiItem/portableElementRegistry/ciRegistry"],function(_,interactionsToolbar,panel,qtiElements,ciRegistry){'use strict';return function($container){var interactions=qtiElements.getAvailableAuthoringElements();_.forIn(ciRegistry.getAllVersions(),function(versions,typeId){var data=ciRegistry.getAuthoringData(typeId,{enabledOnly:!0});data&&data.tags&&data.tags[0]===interactionsToolbar.getCustomInteractionTag()&&(interactions[data.qtiClass]=data)}),interactionsToolbar.create($container,interactions),panel.initSidebarAccordion($container),panel.closeSections($container.find("section")),panel.openSections($container.find("#sidebar-left-section-common-interactions"),!1),panel.toggleInlineInteractionGroup()}}),define("tpl!taoQtiItem/qtiCreator/tpl/toolbars/cssToggler",["handlebars"],function(hb){return hb.template(function(Handlebars,depth0,helpers,partials,data){this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",escapeExpression=this.escapeExpression,stack1,helper;return buffer+="
    • \n \n ",(helper=helpers.label)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.label,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\n \n \n \n
    • ",buffer})}),define("taoQtiItem/qtiCreator/editor/styleEditor/styleEditor",["jquery","lodash","i18n","util/urlParser","core/promise","tpl!taoQtiItem/qtiCreator/tpl/toolbars/cssToggler","jquery.fileDownload"],function($,_,__,UrlParser,Promise,cssTpl){'use strict';var _getUri=function(action){return globalConfig["".concat(action,"CssUrl")]},_basename=function(path){return path.substring(path.lastIndexOf("/")+1)},style={},$styleElem=function(){var styleElem=$("#item-editor-user-styles");return styleElem.length?styleElem.empty():(styleElem=$("