Files
Probability-and-Statistics-…/_static/39.dc45aaf5abca8027.js
T
2026-01-11 13:24:27 -05:00

3 lines
96 KiB
JavaScript
Executable File
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/*! For license information please see 39.dc45aaf5abca8027.js.LICENSE.txt */
(self.webpackChunkWebComponents=self.webpackChunkWebComponents||[]).push([[39,420],{52420:(e,t,i)=>{"use strict";i.r(t),i.d(t,{default:()=>_});var s=i(78673);i(75794),i(56906),i(78811);class n{constructor(e){this.problem=e}inverseLISIndices(e){for(var t=[],i=0;i<e.length;i++){for(var s=[e[i]],n=e[i],r=-1,o=i;o<e.length;o++){var a=e[o];a>n&&r<a&&(s.push(a),r=a)}t.push(s)}var l,h=-1;for(let e in t){var c=t[e];c.length>h&&(h=c.length,l=c)}var d=[],u=0;for(let t=0;t<e.length;t++)u>l.length?d.push(t):e[t]==l[u]?u+=1:d.push(t);return d}grade(){var e=this.problem;e.clearFeedback(),this.correctLines=0,this.percentLines=0,this.incorrectIndents=0;var t,i=e.solution,s=e.answerLines();this.percentLines=Math.min(s.length,i.length)/Math.max(s.length,i.length),s.length<i.length?(t="incorrectTooShort",this.correctLength=!1):s.length==i.length?this.correctLength=!0:(t="incorrectMoveBlocks",this.correctLength=!1);let n=this.checkCorrectOrdering(i,s);return this.checkCorrectIndentation(i,s)&&n&&this.correctLength?t="correct":this.correctLength&&n?t="incorrectIndent":n||"incorrectTooShort"==t||(t="incorrectMoveBlocks"),this.calculatePercent(),this.graderState=t,t}checkCorrectIndentation(e,t){if(!this.problem.usesIndentation())return!0;this.indentLeft=[],this.indentRight=[];let i=Math.min(e.length,t.length);for(let s=0;s<i;s++)t[s].viewIndent()<e[s].indent?this.indentRight.push(t[s]):t[s].viewIndent()>e[s].indent&&this.indentLeft.push(t[s]);return this.incorrectIndents=this.indentLeft.length+this.indentRight.length,0==this.incorrectIndents}checkCorrectOrdering(e,t){let i=!0;this.correctLines=0,this.solutionLength=e.length;let s=Math.min(e.length,t.length);for(let n=0;n<s;n++)t[n].text!==e[n].text?i=!1:this.correctLines+=1;return i}calculatePercent(){let e=.2*this.percentLines,t=this.problem.answerLines().length,i=e+this.correctLines/t*.4+(this.correctLines-this.incorrectIndents)/t*.4;i=Math.max(i,0),this.problem.percent=i}}function r(e,{source:t,target:i}){try{!function(e,t,i){for(var[s,n,r]=function(e,t,i){if((s=t)===(n=i)||"object"==typeof s&&s.toString()===n.toString())return[new Map([[t,null]]),new Map([[i,null]]),t];var s,n,r,o;r=e.predecessorsIter.bind(e),o=e.successorsIter.bind(e);for(var a,l=new Map([[t,null]]),h=new Map([[i,null]]),c=[t],u=[i];c.length>0&&u.length>0;)if(c.length<=u.length){a=c,c=[];for(let e of a)for(let t of o(e))if(l.has(t)||(c.push(t),l.set(t,e)),h.has(t))return[l,h,t]}else{a=u,u=[];for(let e of a)for(let t of r(e))if(h.has(t)||(u.push(t),h.set(t,e)),l.has(t))return[l,h,t]}throw new d("No path between "+t.toString()+" and "+i.toString()+".")}(e,t,i),o=[];null!=r;)o.push(r),r=s.get(r);for(r=n.get(o[0]),o.reverse();null!=r;)o.push(r),r=n.get(r)}(e,t,i)}catch(e){if(e instanceof d)return!1;throw e}return!0}class o{constructor(){this.graph={},this.node=new Map,this.adj=new Map,this.pred=new Map,this.succ=this.adj,this.edge=this.adj}addNode(e){this.succ.has(e)||(this.succ.set(e,new Map),this.pred.set(e,new Map),this.node.set(e))}addEdge(e,t){this.succ.has(e)||(this.succ.set(e,new Map),this.pred.set(e,new Map),this.node.set(e,{})),this.succ.has(t)||(this.succ.set(t,new Map),this.pred.set(t,new Map),this.node.set(t,{}));var i=this.adj.get(e).get(t)||{};this.succ.get(e).set(t,i),this.pred.get(t).set(e,i)}nodes(e=!1){return Array.from(e?this.node.entries():this.node.keys())}edges(e,t=!1){return Array.from(this.edgesIter(e,t))}nodesIter(e=!1){return e?toIterator(this.node):this.node.keys()}get(e){var t=this.adj.get(e);if(void 0===t)throw new KeyError("Graph does not contain node "+e+".");return t}numberOfNodes(){return this.node.size}*nbunchIter(e){if(null==e)yield*this.adj.keys();else if(this.hasNode(e))yield e;else{var t=this.adj;try{for(var i of toIterator(e))t.has(i)&&(yield i)}catch(e){if(e instanceof TypeError)throw new h("nbunch is not a node or a sequence of nodes")}}}*edgesIter(e,t=!1){var i;for(var s of((!0===(i=e)||!1===i||function(e){return!!e&&"object"==typeof e}(i)&&"[object Boolean]"==Object.prototype.toString.call(i))&&(t=e,e=void 0),void 0===e?this.adj:mapIterator(this.nbunchIter(e),(e=>tuple2(e,this.adj.get(e))))))for(var n of s[1]){var r=[s[0],n[0]];t&&(r[2]=n[1]),yield r}}reverse(e=!0){var t;if(e)(t=new this.constructor(null,{name:"Reverse of ("+this.name+")"})).addNodesFrom(this),t.addEdgesFrom(mapIterator(this.edgesIter(null,!0),(e=>tuple3c(e[1],e[0],deepcopy(e[2]),e)))),t.graph=deepcopy(this.graph),t.node=deepcopy(this.node);else{var i=this.pred,s=this.succ;this.succ=i,this.pred=s,this.adj=this.succ,t=this}return t}successorsIter(e){var t=this.succ.get(e);if(void 0!==t)return t.keys();throw new h(sprintf('The node "%j" is not in the digraph.',e))}predecessorsIter(e){var t=this.pred.get(e);if(void 0!==t)return t.keys();throw new h(sprintf('The node "%j" is not in the digraph.',e))}successors(e){return Array.from(this.successorsIter(e))}predecessors(e){return Array.from(this.predecessorsIter(e))}}class a{constructor(e){this.name="JSNetworkXException",this.message=e}}class l extends a{constructor(e){super(e),this.name="JSNetworkXAlgorithmError"}}class h extends a{constructor(e){super(e),this.name="JSNetworkXError"}}class c extends l{constructor(e){super(e),this.name="JSNetworkXUnfeasible"}}class d extends c{constructor(e){super(e),this.name="JSNetworkXNoPath"}}function u(e){var t=new o;for(let i of e){t.addNode(i.tag);for(let e of i.depends)t.addEdge(e,i.tag)}return t}function p(e,t){for(let i of e.edges())if(!t.has(i[0])&&!t.has(i[1]))return!1;return!0}class v extends n{inverseLISIndices(e,t){var i=this.problem.solution,s=t.map((e=>e.lines[0]));let n=u(i),a=new Set,l=new o;for(let e of s){for(let t of a)r(n,{source:e.tag,target:t.tag})&&l.addEdge(e.tag,t.tag);a.add(e)}let h=null,c=function(e){let t={};for(let i=0;i<=e.length;i++)t[i]=[];for(let i=0;i<Math.pow(2,e.length);i++){let s=i.toString(2);for(;s.length<e.length;)s="0"+s;let n=new Set;for(let t=0;t<s.length;t++)"1"==s[t]&&n.add(e[t]);t[n.size].push(n)}return t}(l.nodes());for(let e=0;e<=l.numberOfNodes();e++){for(let t of c[e])if(p(l,t)){h=t;break}if(null!=h)break}return[...h].map((e=>{for(let t=0;t<s.length;t++)if(s[t].tag===e)return t}))}checkCorrectIndentation(){if(!this.problem.usesIndentation())return!0;this.indentLeft=[],this.indentRight=[];for(const e of this.problem.blocks){if(e.isDistractor())continue;const t=e.indent,i=e.solutionIndent();t<i?this.indentRight.push(e.lines[0]):t>i&&this.indentLeft.push(e.lines[0])}return this.incorrectIndents=this.indentLeft.length+this.indentRight.length,0==this.incorrectIndents}checkCorrectOrdering(e,t){if(!function(e){try{return function(e,t){var i=new Set,s=[],n=new Set;null==t&&(t=e.nodesIter());for(let l of t){if(n.has(l))return;for(var r=[l];r.length>0;){var o=r[r.length-1];if(n.has(o))r.pop();else{i.add(o);var a=[];e.get(o).forEach((function(e,t){if(!n.has(t)){if(i.has(t))throw new c("Graph contains a cycle.");a.push(t)}})),a.length>0?r.push.apply(r,a):(n.add(o),s.unshift(o))}}}}(e),!0}catch(e){if(e instanceof c)return!1;throw e}}(u(e)))throw"Dependency between blocks does not form a Directed Acyclic Graph; Problem unsolvable.";let i=new Set,s=!0;this.correctLines=0,this.solutionLength=e.length;let n=Math.min(e.length,t.length);for(let e=0;e<n;e++){let n=t[e];if(n.distractor)s=!1;else for(let e=0;e<n.depends.length;e++)i.has(n.depends[e])||(s=!1);s&&(this.correctLines+=1),i.add(n.tag)}return s}}class g{constructor(e,t,i){this.problem=e,this.index=e.lines.length;var s,n=t.replace(/\s*$/,"");if(!0===this.problem.options.scaffolding)if(this.problem.noindent?this.text=n:this.text=n.replace(/^\s*/,""),"java"==this.problem.options.language)this.text=this.text.replace(/\t/g," "),this.text.toLowerCase().startsWith("public class")?this.indent=0:this.indent=n.length-this.text.length;else{const e=this.problem.lines;this.text.toLowerCase().startsWith("import")&&(this.indent=0),e.some((({text:e})=>e.trimStart().toLowerCase().startsWith("class ")))?this.text.toLowerCase().startsWith("class")?this.indent=0:this.indent=n.length-this.text.length:this.text.toLowerCase().startsWith("def")?this.indent=0:this.indent=n.length-this.text.length}else this.text=n.replace(/^\s*/,""),this.indent=n.length-this.text.length;"natural"==e.options.language||"math"==e.options.language?s=i?document.createElement("div"):document.createElement("p"):(s=document.createElement("code"),$(s).addClass(e.options.prettifyLanguage)),s.id=e.counterId+"-line-"+this.index,s.innerHTML+=this.text,this.view=s,e.lines.push(this)}initializeWidth(){this.width=$(this.view).outerWidth(!0)-this.problem.options.pixelsPerIndent*this.indent,this.view.fontSize=window.getComputedStyle(this.view,null).getPropertyValue("font-size"),this.view.pixelsPerIndent=this.problem.options.pixelsPerIndent,this.view.indent=this.indent;var e=document.createElement("canvas").getContext("2d"),t=window.getComputedStyle(this.view,null).getPropertyValue("font-family").split(", "),i="abcdefghijklmnopqrstuvwxyz0123456789,./!@#$%^&*-+";e.font=this.view.fontSize+" serif";var s=e.measureText(i).width;for(let n=0;n<t.length;n++)if(t[n].includes('"')&&(t[n]=t[n].replaceAll('"',"")),t[n].includes("'")&&(t[n]=t[n].replaceAll("'","")),e.font=this.view.fontSize+" "+t[n],e.measureText(i).width!==s){this.view.fontFamily=t[n];break}}block(){for(let i=0;i<this.problem.blocks.length;i++)for(var e=this.problem.blocks[i],t=0;t<e.lines.length;t++)if(e.lines[t]===this)return e}viewIndent(){if(this.problem.noindent)return this.indent;var e=this.block();return this.indent-e.solutionIndent()+e.indent}}var f=i(88210),m=i.n(f);class b{constructor(e,t){this.problem=e,this.lines=t,this.indent=0,this.labels=[];var i=document.createElement("div");i.id=e.counterId+"-block-"+e.blockIndex,e.blockIndex+=1,$(i).addClass("block");var s=t[0].indent;for(let e=1;e<t.length;e++)s=Math.min(s,t[e].indent);var n=document.createElement("div");$(n).addClass("lines"),$(i).append(n);for(let i=0;i<t.length;i++){var r,o=t[i];r=e.noindent?o.indent:o.indent-s,$(o.view).removeClass("indent1 indent2 indent3 indent4 indent5 indent6"),"natural"!=this.problem.options.language&&"math"!=this.problem.options.language&&r>0&&$(o.view).addClass("indent"+r),n.appendChild(o.view)}var a=document.createElement("div");$(a).addClass("labels"),"left"==this.problem.options.numbered?($(n).addClass("border_left"),$(i).prepend(a),$(i).css({"justify-content":"flex-start"})):"right"==this.problem.options.numbered&&($(a).addClass("border_left"),$(a).css({float:"right"}),$(i).css({"justify-content":"space-between"}),$(i).append(a)),this.view=i,this.isPlaceholder=!1}addLine(e){if($(e.view).removeClass("indent1 indent2 indent3 indent4 indent5 indent6"),this.problem.noindent)e.indent>0&&$(e.view).addClass("indent"+e.indent);else{var t=this.lines,i=t[0].indent;for(let e=1;e<t.length;e++)i=Math.min(i,t[e].indent);if(i<e.indent)$(e.view).addClass("indent"+(e.indent-i));else if(i>e.indent)for(let i=0;i<t.length;i++)$(t[i].view).removeClass("indent1 indent2 indent3 indent4 indent5 indent6"),"natural"!==this.problem.options.language&&"math"!==this.problem.options.language&&$(t[i].view).addClass("indent"+(t[i].indent-e.indent))}this.lines.push(e),$(this.view).children(".lines")[0].appendChild(e.view)}consumeBlock(e){for(let t=0;t<e.lines.length;t++)this.addLine(e.lines[t]);"0"==$(e.view).attr("tabindex")&&this.makeTabIndex(),$(e.view).detach();var t=[];for(let i=0;i<this.problem.blocks.length;i++)this.problem.blocks[i]!==e&&t.push(this.problem.blocks[i]);for(let t=0;t<e.labels.length;t++)this.addLabel(e.labels[t][0],this.lines.length-e.lines.length+e.labels[t][1]);this.problem.blocks=t,this.problem.state=void 0,this.problem.updateView()}addIndent(){for(let t=0;t<this.lines.length;t++){var e=this.lines[t];e.indent>0&&($(e.view).removeClass("indent1 indent2 indent3 indent4 indent5 indent6"),$(e.view).addClass("indent"+e.indent))}this.indent=0,$(this.view).css({"padding-left":"",width:this.problem.areaWidth-22})}addLabel(e,t){var i=document.createElement("div");$(i).addClass("block-label"),"right"==this.problem.options.numbered&&$(i).addClass("right-label"),"left"==this.problem.options.numbered&&$(i).addClass("left-label"),$(i).append(document.createTextNode(e)),$(this.view).children(".labels")[0].append(i),0!=this.labels.length&&$(i).css("margin-top",(t-this.labels[this.labels.length-1][1]-1)*this.lines[t].view.offsetHeight),this.labels.push([e,t])}initializeInteractivity(){if($(this.view).hasClass("disabled"))return this;$(this.view).attr("tabindex","-1"),this.hammer=new(m().Manager)(this.view,{recognizers:[[m().Pan,{direction:m().DIRECTION_ALL,threshold:0,pointers:1}]]});var e=this;this.hammer.on("panstart",(function(t){e.panStart(t)})),this.hammer.on("panend",(function(t){e.panEnd(t)})),this.hammer.on("panmove",(function(t){e.panMove(t)}))}enabled(){return void 0!==$(this.view).attr("tabindex")}isDistractor(){return this.lines[0].distractor}inSourceArea(){var e=this.problem.sourceArea.childNodes;for(let t=0;t<e.length;t++)if(e[t].id==this.view.id)return!0;return!1}pageXCenter(){var e=this.view.getBoundingClientRect();return window.pageXOffset+e.left+e.width/2}pageYCenter(){var e=this.view.getBoundingClientRect();return window.pageYOffset+e.top+e.height/2}minimumLineIndent(){var e=this.lines[0].indent;for(let t=1;t<this.lines.length;t++)e=Math.min(this.lines[t].indent,e);return e}slideUnderBlock(){var e=this.problem.sourceBlocks();if(0!=e.length){var t=this.pairedBin();if(-1==t)return e[e.length-1];for(let s=e.length-1;s>=0;s--){var i=e[s];if(i.pairedBin()==t)return i}return e[e.length-1]}}pairedBin(){for(var e=this.problem.pairedBins,t=0;t<e.length;t++)if(this.matchesBin(e[t]))return t;return-1}matchesBin(e){for(var t=0;t<this.lines.length;t++){var i=this.lines[t].index;if(-1==e.indexOf(i))return!1}return!0}validSourceIndexes(){var e,t,i=this.problem.sourceBlocks(),s=[],n=this.pairedBin();if(n>=0){for(e=0;e<i.length;e++){var r=i[e];if(r.view.id!==this.view.id){var o=r.pairedBin();(o==n||t==n)&&s.push(e),t=o}}if(t==n&&s.push(i.length),s.length>0)return s}for(e=0;e<i.length;e++){let n=i[e];if(n.view.id!==this.view.id){let i=n.pairedBin();(i!==t||-1==i)&&s.push(e),t=i}}return s.push(i.length),s}verticalOffset(){var e;return e=this.inSourceArea()?this.problem.sourceArea.getBoundingClientRect().top:this.problem.answerArea.getBoundingClientRect().top,this.view.getBoundingClientRect().top+this.view.getBoundingClientRect().bottom-2*e}newFocus(){null==this.problem.textFocus?(this.problem.enterKeyboardMode(),this.problem.textFocus=this,this.problem.textMove=!1,$(this.view).addClass("down")):this.problem.textFocus==this?this.problem.textMove?$(this.view).addClass("up"):$(this.view).addClass("down"):(this.problem.textFocus=this,this.problem.textMove=!1,$(this.view).addClass("down")),this.problem.textMoving=!1}releaseFocus(){$(this.view).removeClass("down up"),this.problem.textFocus==this?this.problem.textMoving||(this.problem.textFocus=void 0,this.problem.textMove&&(this.problem.logMove("kmove"),this.problem.textMove=!1,this.problem.updatePlaceholders()),this.problem.exitKeyboardMode()):($(this.view).attr("tabindex","-1"),$(this.view).unbind("focus"),$(this.view).unbind("blur"),$(this.view).unbind("keydown"))}makeTabIndex(){$(this.view).attr("tabindex","0");var e=this;$(this.view).focus((function(){e.newFocus()})),$(this.view).blur((function(){e.releaseFocus()})),$(this.view).keydown((function(t){e.keyDown(t)}))}disable(){void 0!==this.hammer&&this.hammer.set({enable:!1}),"0"==$(this.view).attr("tabindex")?(this.releaseFocus(),$(this.view).removeAttr("tabindex"),this.problem.initializeTabIndex()):$(this.view).removeAttr("tabindex")}resetView(){void 0!==this.hammer&&this.hammer.set({enable:!0}),$(this.view)[0].hasAttribute("tabindex")||$(this.view).attr("tabindex","-1"),$(this.view).css({opacity:""})}destroy(){void 0!==this.hammer&&(this.hammer.destroy(),delete this.hammer),"0"==$(this.view).attr("tabindex")&&this.releaseFocus(),$(this.view).removeAttr("tabindex")}panStart(e){this.problem.clearFeedback(),null==this.problem.started&&(this.problem.started=!0,this.problem.logMove("start")),void 0!==this.problem.textFocus&&this.problem.textFocus.releaseFocus(),this.problem.moving=this,this.problem.movingX=e.srcEvent.pageX,this.problem.movingY=e.srcEvent.pageY,this.problem.updateView()}panEnd(e){this.problem.isAnswered=!0,delete this.problem.moving,delete this.problem.movingX,delete this.problem.movingY,this.problem.updateView(),this.problem.logMove("move"),this.problem.updatePlaceholders()}panMove(e){this.problem.movingX=e.srcEvent.pageX,this.problem.movingY=e.srcEvent.pageY,this.problem.updateView()}keyDown(e){switch(null==this.problem.started&&(this.problem.started=!0,this.problem.logMove("kstart")),e.keyCode){case 37:this.problem.textMove?this.moveLeft():this.selectLeft();break;case 38:this.problem.textMove?this.moveUp():this.selectUp(),e.preventDefault();break;case 39:this.problem.textMove?this.moveRight():this.selectRight(),e.preventDefault();break;case 40:this.problem.textMove?this.moveDown():this.selectDown(),e.preventDefault();break;case 32:case 13:this.toggleMove(),e.preventDefault()}}moveLeft(){var e,t;if(!this.inSourceArea()){if(0==this.indent){for(var i=this.problem.sourceBlocks(),s=this.verticalOffset(),n=this.validSourceIndexes(),r=0;r<n.length;r++){if((e=n[r])==i.length)return this.problem.textMoving=!0,this.problem.sourceArea.appendChild(this.view),$(this.view).focus(),this.problem.state=void 0,this.problem.updateView(),this;if((t=i[e]).verticalOffset()>=s)break}this.problem.textMoving=!0,this.problem.sourceArea.insertBefore(this.view,t.view),$(this.view).focus()}else this.indent=this.indent-1;this.problem.state=void 0,this.problem.updateView()}}moveUp(){if(this.inSourceArea()){let n=this.problem.sourceBlocks();var e=this.verticalOffset(),t=this.validSourceIndexes();for(let r=0;r<t.length;r++){var i=t[t.length-1-r];if(i<n.length){var s=n[i];if(s.verticalOffset()<e)return this.problem.textMoving=!0,this.problem.sourceArea.insertBefore(this.view,s.view),$(this.view).focus(),this.problem.state=void 0,this.problem.updateView(),this}}}else{let e=this.problem.answerBlocks();for(let t=0;t<e.length;t++)if(e[t].view.id==this.view.id){if(0==t)return this;this.problem.textMoving=!0,this.problem.answerArea.insertBefore(this.view,e[t-1].view),$(this.view).focus(),this.problem.state=void 0,this.problem.updateView()}}}moveRight(){if(this.inSourceArea()){this.indent=0;for(var e=this.verticalOffset(),t=this.problem.answerBlocks(),i=0;i<t.length;i++){var s=t[i];if(s.verticalOffset()>=e)return this.problem.textMoving=!0,this.problem.answerArea.insertBefore(this.view,s.view),$(this.view).focus(),this.problem.state=void 0,this.problem.updateView(),this}this.problem.textMoving=!0,this.problem.answerArea.appendChild(this.view),$(this.view).focus(),this.problem.state=void 0,this.problem.updateView()}else this.indent!==this.problem.indent&&(this.indent=this.indent+1,this.problem.state=void 0,this.problem.updateView())}moveDown(){if(this.inSourceArea()){let s=this.problem.sourceBlocks();var e=this.validSourceIndexes();for(let e=0;e<s.length;e++)if(s[e].view.id==this.view.id)var t=e;for(let n=0;n<e.length;n++){var i=e[n];if(i==s.length)return this.problem.textMoving=!0,this.problem.sourceArea.appendChild(this.view),$(this.view).focus(),this.problem.state=void 0,this.problem.updateView(),this;if(i-t>1)return this.problem.textMoving=!0,this.problem.sourceArea.insertBefore(this.view,s[i].view),$(this.view).focus(),this.problem.state=void 0,this.problem.updateView(),this}}else{let e=this.problem.answerBlocks();for(var s=0;s<e.length;s++)if(e[s].view.id==this.view.id){if(s==e.length-1)return this;s==e.length-2?(this.problem.textMoving=!0,this.problem.answerArea.appendChild(this.view)):(this.problem.textMoving=!0,this.problem.answerArea.insertBefore(this.view,e[s+2].view)),$(this.view).focus(),this.problem.state=void 0,this.problem.updateView()}}}selectLeft(){if(!this.inSourceArea()){var e=this.verticalOffset(),t=this.problem.enabledSourceBlocks();if(0==t.length)return this;for(var i=t[0],s=i.verticalOffset()-e,n=1;n<t.length;n++){var r=t[n],o=r.verticalOffset()-e;Math.abs(o)<Math.abs(s)&&(i=r,s=o)}this.problem.textFocus=i,i.makeTabIndex(),$(i.view).focus()}}selectUp(){for(var e,t=!1,i=(e=this.inSourceArea()?this.problem.enabledSourceBlocks():this.problem.enabledAnswerBlocks()).length-1;i>=0;i--){var s=e[i];if(t)return this.problem.textFocus=s,s.makeTabIndex(),$(s.view).focus(),this;s.view.id==this.view.id&&(t=!0)}}selectRight(){if(this.inSourceArea()){var e=this.verticalOffset(),t=this.problem.enabledAnswerBlocks();if(0==t.length)return this;for(var i=t[0],s=i.verticalOffset()-e,n=1;n<t.length;n++){var r=t[n],o=r.verticalOffset()-e;Math.abs(o)<Math.abs(s)&&(i=r,s=o)}this.problem.textFocus=i,i.makeTabIndex(),$(i.view).focus()}}selectDown(){var e,t=!1;e=this.inSourceArea()?this.problem.enabledSourceBlocks():this.problem.enabledAnswerBlocks();for(var i=0;i<e.length;i++){var s=e[i];if(t)return this.problem.textFocus=s,s.makeTabIndex(),$(s.view).focus(),this;s.view.id==this.view.id&&(t=!0)}}toggleMove(){this.problem.textMove?($(this.view).removeClass("up"),$(this.view).addClass("down"),this.problem.textMove=!1,this.problem.logMove("kmove"),this.isPlaceholder||this.problem.updatePlaceholders()):($(this.view).removeClass("down"),$(this.view).addClass("up"),this.problem.textMove=!0)}hash(){for(var e="",t=0;t<this.lines.length;t++)e+=this.lines[t].index+"_";return e+this.indent}solutionIndent(){for(var e=this.lines[0].indent,t=1;t<this.lines.length;t++)e=Math.min(e,this.lines[t].indent);return e}}class w extends b{constructor(e,t,i,s){super(e,t),this.placeholderLines=t,this.afterSettledBlockCount=s,$(this.view).addClass("placeholder-block"),$(this.view).addClass("disabled"),this.placeholderSize=i;var n=document.createElement("div");$(n).addClass("placeholder-text"),n.innerText=i>1?`${i} blocks are missing here`:`${i} block is missing here`,$(this.view).append(n),this.isPlaceholder=!0}}class k extends g{constructor(e){super(e,"placeholder",!1),this.isPlaceholderLine=!0}}class y extends b{constructor(e,t){super(e,t),this.isSettled=!0,$(this.view).addClass("settled-block"),$(this.view).addClass("disabled");let i=document.createElement("span");i.classList.add("settled-tooltip"),$(this.view).append(i),$(this.view).find(".settled-tooltip").text("OK")}setBlocksBefore(e){this.blocksBefore=e;var t=e>1?"s":"";if(this.blocksAfter){var i=this.blocksAfter>1?"s":"";$(this.view).find(".settled-tooltip").html(`${e} block${t} ⬆️), ${this.blocksAfter} block${i} ⬇️`)}else $(this.view).find(".settled-tooltip").html(`${e} block${t} ⬆️`)}setBlocksAfter(e){this.blocksAfter=e;var t=e>1?"s":"";if(this.blocksBefore){var i=this.blocksBefore>1?"s":"";$(this.view).find(".settled-tooltip").html(`${this.blocksBefore} block${i} ⬆️, ${e} block${t} ⬇️`)}else $(this.view).find(".settled-tooltip").html(`${e} block${t} ️⬇️`)}}class x extends s.A{constructor(e){super(e);var t=e.orig;this.containerDiv=t,this.origElem=$(t).find("pre.parsonsblocks")[0],this.question=$(t).find(".parsons_question")[0],this.useRunestoneServices=e.useRunestoneServices,this.divid=e.orig.id;var i=super.localStorageKey();this.storageId=i,this.children=this.origElem.childNodes,this.contentArray=[],x.counter++,this.counterId="parsons-"+x.counter,this.initializeOptions(),this.grader="dag"===this.options.grader?new v(this):new n(this),this.grader.showfeedback=this.showfeedback;var s=$(this.origElem).html();this.blockIndex=0,this.checkCount=0,this.numDistinct=0,this.hasSolved=!1,this.initializeLines(s.trim()),this.initializeView(),this.caption="Parsons",this.addCaption("runestone"),this.checkServer("parsons",!0),this.runnableDiv=null}initializeOptions(){var e={pixelsPerIndent:30},t=$(this.origElem).data("maxdist"),i=$(this.origElem).data("order"),s=$(this.origElem).data("noindent"),n=$(this.origElem).data("adaptive"),r=$(this.origElem).data("numbered"),o=$(this.origElem).data("grader"),a=$(this.origElem).data("scaffolding");if(e.numbered=r,e.grader=o,e.scaffolding=a,void 0!==t&&(e.maxdist=t),void 0!==i){i=i.match(/\d+/g);for(var l=0;l<i.length;l++)i[l]=parseInt(i[l]);e.order=i}null==s&&(s=!1),e.noindent=s,this.noindent=s,null==n?n=!1:n&&this.initializeAdaptive(),e.adaptive=n;var h=eBookConfig.locale;null==h&&(h="en"),e.locale=h;var c=$(this.origElem).data("language");null==c&&null==(c=eBookConfig.language)&&(c="python"),e.language=c;var d={python:"prettyprint lang-py",java:"prettyprint lang-java",javascript:"prettyprint lang-js",html:"prettyprint lang-html",c:"prettyprint lang-c","c++":"prettyprint lang-cpp",cpp:"prettyprint lang-cpp",ruby:"prettyprint lang-rb"}[c];null==d&&(d=""),e.prettifyLanguage=d,e.runnable=$(this.origElem).data("runnable"),this.options=e}initializeView(){this.outerDiv=document.createElement("div"),$(this.outerDiv).addClass("parsons"),this.outerDiv.id=this.counterId;let e=this.containerDiv.querySelector(".parsons-text");e&&!e.classList.contains("exercise-statement")&&e.classList.add("exercise-statement"),this.keyboardTip=document.createElement("div"),$(this.keyboardTip).attr("role","tooltip"),this.keyboardTip.id=this.counterId+"-tip",this.keyboardTip.innerHTML=$.i18n("msg_parson_arrow_navigate"),this.outerDiv.appendChild(this.keyboardTip),$(this.keyboardTip).hide(),this.sortContainerDiv=document.createElement("div"),$(this.sortContainerDiv).addClass("sortable-code-container"),$(this.sortContainerDiv).attr("aria-describedby",this.counterId+"-tip"),this.outerDiv.appendChild(this.sortContainerDiv),this.sourceRegionDiv=document.createElement("div"),this.sourceRegionDiv.id=this.counterId+"-sourceRegion",$(this.sourceRegionDiv).addClass("sortable-code"),this.sourceLabel=document.createElement("div"),$(this.sourceLabel).attr("role","tooltip"),this.sourceLabel.id=this.counterId+"-sourceTip",this.sourceLabel.innerHTML=$.i18n("msg_parson_drag_from_here"),this.sourceRegionDiv.appendChild(this.sourceLabel),this.sortContainerDiv.appendChild(this.sourceRegionDiv),this.sourceArea=document.createElement("div"),this.sourceArea.id=this.counterId+"-source",$(this.sourceArea).addClass("source"),$(this.sourceArea).attr("aria-describedby",this.counterId+"-sourceTip"),this.sourceRegionDiv.appendChild(this.sourceArea),this.answerRegionDiv=document.createElement("div"),this.answerRegionDiv.id=this.counterId+"-answerRegion",$(this.answerRegionDiv).addClass("sortable-code"),this.answerLabel=document.createElement("div"),$(this.answerLabel).attr("role","tooltip"),this.answerLabel.id=this.counterId+"-answerTip",this.answerLabel.innerHTML=$.i18n("msg_parson_drag_to_here"),this.answerRegionDiv.appendChild(this.answerLabel),this.sortContainerDiv.appendChild(this.answerRegionDiv),this.answerArea=document.createElement("div"),this.answerArea.id=this.counterId+"-answer",$(this.answerArea).attr("aria-describedby",this.counterId+"-answerTip"),this.answerRegionDiv.appendChild(this.answerArea),this.parsonsControlDiv=document.createElement("div"),$(this.parsonsControlDiv).addClass("parsons-controls"),this.outerDiv.appendChild(this.parsonsControlDiv);var t=this;this.checkButton=document.createElement("button"),$(this.checkButton).attr("class","btn btn-success"),this.checkButton.textContent=$.i18n("msg_parson_check_me"),this.checkButton.id=this.counterId+"-check",this.parsonsControlDiv.appendChild(this.checkButton),this.checkButton.type="button",this.checkButton.addEventListener("click",(function(e){e.preventDefault(),t.checkCurrentAnswer(),t.logCurrentAnswer(),t.renderFeedback()})),this.resetButton=document.createElement("button"),$(this.resetButton).attr("class","btn btn-default"),this.resetButton.textContent=$.i18n("msg_parson_reset"),this.resetButton.id=this.counterId+"-reset",this.resetButton.type="button",this.parsonsControlDiv.appendChild(this.resetButton),this.resetButton.addEventListener("click",(function(e){e.preventDefault(),t.clearFeedback(),$(t.checkButton).prop("disabled",!1),t.resetView(),t.checkCount=0,t.logMove("reset"),t.setLocalStorage()})),this.options.adaptive&&(this.helpButton=document.createElement("button"),$(this.helpButton).attr("class","btn btn-primary"),this.helpButton.textContent=$.i18n("msg_parson_help"),this.helpButton.id=this.counterId+"-help",this.helpButton.disabled=!1,this.parsonsControlDiv.appendChild(this.helpButton),this.helpButton.addEventListener("click",(function(e){e.preventDefault(),t.helpMe()}))),this.messageDiv=document.createElement("div"),this.messageDiv.id=this.counterId+"-message",this.messageDiv.setAttribute("aria-live","polite"),this.messageDiv.setAttribute("role","status"),this.parsonsControlDiv.appendChild(this.messageDiv),this.messageDiv.style.visibility="hidden",$(this.origElem).replaceWith(this.outerDiv),$(this.outerDiv).closest(".sqcontainer").css("max-width","none"),this.outerDiv&&($(this.question).html().match(/^\s+$/)?$(this.question).remove():$(this.outerDiv).prepend(this.question))}initializeLines(e){this.lines=[];var t=e.split("---");1===t.length&&(t=e.split("\n"));var i=[],s=[];if(!0===this.options.scaffolding){for(var n=!1,r=0;r<t.length;r++){var o=t[r],a={},l="",h=[];if(o.includes("#paired:"))b=o.indexOf("#paired:"),l=o.substring(b+8,o.length).trim(),o=o.substring(0,b+7);else if(o.includes("#distractor:"))b=o.indexOf("#distractor:"),l=o.substring(b+12,o.length).trim(),o=o.substring(0,b+11);else if(o.includes("#settled")){var c=o.indexOf("#settled");l=o.substring(c+8,o.length).trim(),o=o.substring(0,c+8)}else if(o.includes("#tag:")){w=(o=o.replace(/#tag:.*;.*;/,(e=>e.replace(/\s+/g,"")))).indexOf("#tag:"),""==(y=o.substring(w+5,o.indexOf(";",w+5)))&&(y="block-"+r),x=o.indexOf(";depends:");let e=o.substring(x+9,o.indexOf(";",x+9));h=e.length>0?e.split(","):[]}if(o.includes('class="displaymath')?a.displaymath=!0:a.displaymath=!1,o=o.replace(/#(paired|distractor|settled|tag:.*;.*;)/,(function(e,t){return a[t]=!0,""})),a.settled&&r>0&&u.length>0&&!u[u.length-1].isSettled){var d=new k(this);u.push(d),d.distractor=!0,d.paired=!1,d.distractHelptext="",d.groupWithNext=!1,d.indent=0}a.settled&&(n=!0);var u=[];if(a.displaymath)p=[o];else var p=o.split("\n");for(var v=0;v<p.length;v++){var f=p[v];if(!/^\s*$/.test(f)){var m=new g(this,f,a.displaymath);u.push(m),a.paired?(m.distractor=!0,m.paired=!0,m.distractHelptext=l):a.distractor?(m.distractor=!0,m.paired=!1,m.distractHelptext=l):a.settled?(m.distractor=!1,m.paired=!1,m.isSettled=!0,i.push(m)):(m.distractor=!1,m.paired=!1,"dag"===this.options.grader&&(m.tag=y,m.depends=h),i.push(m)),-1==$.inArray(m.indent,s)&&s.push(m.indent)}}if(u.length>0){for(v=0;v<u.length-1;v++)u[v].groupWithNext=!0;u[u.length-1].groupWithNext=!1}}if(n&&!u[u.length-1].isSettled&&(d=new k(this),u.push(d),d.distractor=!0,d.paired=!1,d.distractHelptext="",d.groupWithNext=!1),"java"===this.options.language){let e=null,t=null;for(let i=0;i<this.lines.length;i++){const s=this.lines[i].text;if(null===e&&(s.includes("public class")||s.startsWith("import"))&&(e=this.lines[i].indent),null===t&&s.includes("public static")&&(t=this.lines[i].indent),null!==e&&null!==t)break}if(0===e&&8===t){s=s.sort((function(e,t){return e-t}));for(let e=0;e<this.lines.length;e++){let t=this.lines[e],i=t.indent,n=s.indexOf(i);n>0&&(n-=1),t.indent=n}}else{s=s.sort((function(e,t){return e-t}));for(let e=0;e<this.lines.length;e++){let t=this.lines[e];t.indent=s.indexOf(t.indent)}}}else{s=s.sort((function(e,t){return e-t}));for(let e=0;e<this.lines.length;e++){let t=this.lines[e];t.indent=s.indexOf(t.indent)}}this.solution=i}else{for(r=0;r<t.length;r++){var b,w,y,x;if(o=t[r],a={},l="",h=[],o.includes("#paired:"))b=o.indexOf("#paired:"),l=o.substring(b+8,o.length).trim(),o=o.substring(0,b+7);else if(o.includes("#distractor:"))b=o.indexOf("#distractor:"),l=o.substring(b+12,o.length).trim(),o=o.substring(0,b+11);else if(o.includes("#tag:")){w=(o=o.replace(/#tag:.*;.*;/,(e=>e.replace(/\s+/g,"")))).indexOf("#tag:"),""==(y=o.substring(w+5,o.indexOf(";",w+5)))&&(y="block-"+r),x=o.indexOf(";depends:");let e=o.substring(x+9,o.indexOf(";",x+9));h=e.length>0?e.split(","):[]}if(o.includes('class="displaymath')?a.displaymath=!0:a.displaymath=!1,o=o.replace(/\s*#(paired|distractor|tag:.*;.*;)\s*/g,(function(e,t){return a[t]=!0,""})),u=[],a.displaymath)p=[o];else p=o.split("\n");for(v=0;v<p.length;v++)f=p[v],(!/^\s*$/.test(f)||0!=v&&v!=p.length-1)&&(m=new g(this,f,a.displaymath),u.push(m),a.paired?(m.distractor=!0,m.paired=!0,m.distractHelptext=l):a.distractor?(m.distractor=!0,m.paired=!1,m.distractHelptext=l):(m.distractor=!1,m.paired=!1,"dag"===this.options.grader&&(m.tag=y,m.depends=h),i.push(m)),-1==$.inArray(m.indent,s)&&s.push(m.indent));if(u.length>0){for(v=0;v<u.length-1;v++)u[v].groupWithNext=!0;u[u.length-1].groupWithNext=!1}}for(s=s.sort((function(e,t){return e-t})),r=0;r<this.lines.length;r++)(m=this.lines[r]).indent=s.indexOf(m.indent);this.solution=i}}async initializeAreas(e,t,i){var s,n,r=[];for(s=0;s<e.length;s++)n=e[s],r.push(n),this.sourceArea.appendChild(n.view);for(s=0;s<t.length;s++)n=t[s],r.push(n),this.answerArea.appendChild(n.view);this.blocks=r;var o=i.disabled;if(void 0!==o)for(s=0;s<r.length;s++)n=r[s],o.includes(n.lines[0].index)&&$(n.view).addClass("disabled");var a=0;this.noindent||(a="natural"==this.options.language?this.solutionIndent():Math.max(0,this.solutionIndent())),this.indent=a;var l,h=null==this.outerDiv.offsetParent;h&&((l=document.createElement("div")).classList.add("runestone-sphinx"),$(this.outerDiv).replaceWith(l),$(this.outerDiv).addClass("runestone-sphinx"),document.body.appendChild(this.outerDiv)),""!==this.options.prettifyLanguage&&"undefined"==typeof Prism&&prettyPrint();const c=this.options.language;if(c&&"undefined"!=typeof Prism){const e=this.containerDiv.querySelectorAll("code");for(const t of e)t.classList.add(`language-${c}`);Prism.highlightAllUnder(this.containerDiv)}for(let e=0;e<this.lines.length;e++)this.lines[e].initializeWidth();let d=(this.outerDiv.offsetWidth-this.options.pixelsPerIndent*this.indent-80)/2;var u,p,v;null!=this.options.numbered&&(d-=25),this.sourceArea.style.width=d+"px",p=20;var g=0;null!=this.options.numbered&&(g=1),u=0;let f=this;for(v=async function(e){"natural"!=this.options.language&&"math"!=this.options.language||("undefined"!=typeof runestoneMathReady?await runestoneMathReady.then((async()=>await f.queueMathJax(e[0]))):void 0!==MathJax.startup&&await f.queueMathJax(e[0])),u=Math.max(u,e.outerWidth(!0)),e.width(u-22);var t=3.8;let i=e.outerHeight(!0);38!=i&&(t=3.1*(i-38)/21),p+=i+g*t}.bind(this),s=0;s<r.length;s++)await v($(r[s].view));this.isTimed&&p<38*r.length&&(p=50*r.length),this.areaWidth=u,null!=this.options.numbered&&(this.areaWidth+=25),a>0&&a<=4?$(this.answerArea).addClass("answer"+a):$(this.answerArea).addClass("answer");var m=[],b=[];for(s=0;s<this.lines.length;s++){var w=this.lines[s];null==w.block()?b.length>0&&(m.push(b),b=[]):(b.push(w),w.groupWithNext||(m.push(b),b=[]))}var k,y=[],x=[],_=[];if(this.pairDistractors||!this.options.adaptive){for(s=m.length-1;s>-1;s--)if((b=m[s])[0].paired)for(k=b.length-1;k>-1;k--)x.unshift(b[k].index);else if(x.length>0){for(k=b.length-1;k>-1;k--)x.unshift(b[k].index);y.unshift(x),x=[]}for(s=0;s<y.length;s++){var C=document.createElement("div");$(C).addClass("paired"),$(C).html("<span id= 'st' style = 'vertical-align: middle; font-weight: bold'>or{</span>"),_.push(C),this.sourceArea.appendChild(C)}}else y=[];p+=10*y.length,this.areaHeight=p+40,$(this.sourceArea).css({width:this.areaWidth+2,height:p}),$(this.answerArea).css({width:this.options.pixelsPerIndent*a+this.areaWidth+2,height:p}),this.pairedBins=y,this.pairedDivs=_,null!=this.options.numbered&&this.addBlockLabels(e.concat(t)),this.state=void 0,this.updateView(),h&&$(l).replaceWith(this.outerDiv)}initializeInteractivity(){for(var e=0;e<this.blocks.length;e++)this.blocks[e].initializeInteractivity();this.initializeTabIndex();"natural"!=this.options.language&&"math"!=this.options.language||void 0!==MathJax.startup&&this.queueMathJax(this.outerDiv)}initializeTabIndex(){for(var e=0;e<this.blocks.length;e++){var t=this.blocks[e];if(t.enabled())return t.makeTabIndex(),this}}newerData(e,t){var i=e.timestamp,s=t.timestamp;return null==i?t:null==s||(i=this.dateFromTimestamp(i))>(s=this.dateFromTimestamp(s))?e:t}async loadData(e){if(!0===this.options.scaffolding){null==(i=e.source)&&(i=e.trash);var t=e.answer;void 0!==(n=null==(s=e.adaptive)?{}:this.optionsFromHash(s)).noindent&&(this.noindent=!0),void 0!==n.checkCount&&(this.checkCount=n.checkCount),void 0!==n.hasSolved&&(this.hasSolved=n.hasSolved),await this.initializeAreas(this.blocksFromSource(),this.settledBlocksFromSource(),n),!0!==this.needsReinitialization&&(this.initializeInteractivity(),this.isTimed&&!this.assessmentTaken&&this.resetView())}else{var i,s,n;null==(i=e.source)&&(i=e.trash),t=e.answer,void 0!==(n=null==(s=e.adaptive)?{}:this.optionsFromHash(s)).noindent&&(this.noindent=!0),void 0!==n.checkCount&&(this.checkCount=n.checkCount),void 0!==n.hasSolved&&(this.hasSolved=n.hasSolved),null==i||null==t||1==t.length?await this.initializeAreas(this.blocksFromSource(),[],n):(this.initializeAreas(this.blocksFromHash(i),this.blocksFromHash(t),n),this.grade=this.grader.grade(),"correct"==this.grade?this.correct=!0:0==this.answerLines().length?this.correct=null:this.correct=!1),!0!==this.needsReinitialization&&(this.initializeInteractivity(),this.isTimed&&!this.assessmentTaken&&this.resetView())}}localData(){var e=localStorage.getItem(this.storageId);return null!==e&&"{"==e.charAt(0)?JSON.parse(e):{}}restoreAnswers(e){this.loadData(e)}checkLocalStorage(){this.graderactive||this.loadData(this.localData())}setLocalStorage(e){var t;if(null==e){t={source:this.sourceHash(),answer:this.answerHash(),timestamp:new Date};var i=this.adaptiveHash();i.length>0&&(t.adaptive=i)}else t=e;localStorage.setItem(this.storageId,JSON.stringify(t))}async updatePlaceholders(){setTimeout((()=>{var e,t,i,s=this.answerBlocks();for(e=0;e<s.length;++e)if(s[e].isPlaceholder&&(i=s[e],t=!1,e>0&&!s[e-1].isSettled&&!s[e-1].isPlaceholder&&(t=!0),e<s.length-1&&!s[e+1].isSettled&&!s[e+1].isPlaceholder&&(t=!0),t&&!$(i.view).hasClass("hide"))){$(i.view).addClass("hide");for(var n=0;n<s.length-1-e;n++)i.moveDown()}}),5),setTimeout((()=>{for(var e=this.answerBlocks(),t=0;t<e.length&&!$(e[t].view).hasClass("hide");)t++;var i=!0;this.firstBlockSettled&&(i=!1);var s,n,r=0;for(s=0;s<t&&(!e[s].isSettled||!i);++s)e[s].isSettled?(i=!0,r++):i=!1;if(s<t||e[t-1]&&e[t-1].isSettled&&!this.lastBlockSettled){var o;for(o=e.length-1;o>=t;o--)if(e[o].afterSettledBlockCount==r){n=e[o];break}if(e[o].afterSettledBlockCount!=r)return void console.log("error moving up; no placeholder found");if($(n.view).hasClass("hide")){$(n.view).removeClass("hide");for(var a=0;a<o-s;a++)n.moveUp()}}}),10)}logMove(e){var t={event:"parsonsMove",div_id:this.divid,storageid:super.localStorageKey()},i=e+"|"+this.sourceHash()+"|"+this.answerHash(),s=this.adaptiveHash();""!==s&&(i=i+"|"+s),t.act=i,this.logBookEvent(t)}async logCurrentAnswer(e){var t={event:"parsons",div_id:this.divid},i=this.answerHash();t.answer=i;var s=this.sourceHash();t.source=s;var n=s+"|"+i,r=this.adaptiveHash();""!==r&&(t.adaptive=r,n=n+"|"+r),"correct"==this.grade?(n="correct|"+n,t.correct="T"):(n="incorrect|"+n,t.correct="F"),t.act=n,void 0!==e&&(t.sid=e),await this.logBookEvent(t)}adaptiveHash(){if(!this.options.adaptive)return"";for(var e=[],t=0;t<this.blocks.length;t++){var i=this.blocks[t];i.enabled()||e.push("d"+i.lines[0].index)}return this.noindent!==this.options.noindent&&e.push("i"),e.push("c"+this.checkCount),this.hasSolved&&e.push("s"),e.join("-")}optionsFromHash(e){var t;t="-"===e||""===e||null===e?[]:e.split("-");for(var i={},s=[],n=0;n<t.length;n++){var r=t[n];"i"==r[0]?i.noindent=!0:"d"==r[0]?s.push(parseInt(r.slice(1))):"s"==r[0]?i.hasSolved=!0:"c"==r[0]&&(i.checkCount=parseInt(r.slice(1)))}return s.length>0&&(i.disabled=s),i}answerHash(){for(var e=[],t=this.answerBlocks(),i=0;i<t.length;i++)e.push(t[i].hash());return 0===e.length?"-":e.join("-")}sourceHash(){for(var e=[],t=this.sourceBlocks(),i=0;i<t.length;i++)e.push(t[i].hash());return 0===e.length?"-":e.join("-")}adaptBlocks(e){for(var t,i=[],s=[],n=0;n<e.length;n++)(t=e[n]).isDistractor()?s.push(t):i.push(t);this.recentAttempts=localStorage.getItem(this.adaptiveId+"recentAttempts"),null!=this.recentAttempts&&"NaN"!=this.recentAttempts||(this.recentAttempts=3);var r=this.recentAttempts,o=i.length,a=0,l=s.length,h=0;this.pairDistractors=!0,r<2?(this.pairDistractors=!1,this.limitDistractors=!1):r<4||r<6?this.pairDistractors=!0:r<8?(h=.5*l,this.pairDistractors=!0):(h=l,this.pairDistractors=!0),a=Math.min(a,o-3),s=(s=this.shuffled(s)).slice(0,h);var c=[];for(n=0;n<e.length;n++)(t=e[n]).isDistractor()?-1==$.inArray(t,s)&&c.push(t):c.push(t);var d=[];for(n=0;n<this.lines.length;n++)for(var u=0;u<c.length;u++)c[u].lines[0].index==n&&d.push(c[u]);for(let e=0;e<a;e++){var p=-10,v=-10;for(u=0;u<d.length-1;u++){t=d[u];var g=d[u+1],f=10-t.lines.length-g.lines.length,m=t.minimumLineIndent(),b=g.minimumLineIndent();m==b?f+=2:m>b&&(f-=1),t.lines[t.lines.length-1].indent==g.lines[0].indent&&(f+=1),f>=p&&(p=f,v=u)}for(t=d[v],g=d[v+1],u=0;u<g.lines.length;u++)t.addLine(g.lines[u]);var w=[];for(u=0;u<d.length;u++)u!==v+1&&w.push(d[u]);d=w}var k=[];for(n=0;n<c.length;n++)for(u=0;u<d.length;u++)c[n].lines[0].index==d[u].lines[0].index&&k.push(d[u]);return k}blocksFromSource(){var e,t,i,s,n=[],r=[],o=[];for(s=0;s<this.lines.length;s++)(i=this.lines[s]).isPlaceholderLine||i.isSettled||(o.push(i),i.groupWithNext||(n.push(new b(this,o)),o=[]));e=n;var a=[];if(void 0!==this.options.maxdist){var l=this.options.maxdist,h=[];for(s=0;s<n.length;s++)(t=n[s]).lines[0].distractor&&h.push(t);if(l<h.length){for(h=(h=this.shuffled(h)).slice(0,l),s=0;s<n.length;s++)(t=n[s]).lines[0].distractor?$.inArray(t,h)>-1?r.push(t):a.push(s):r.push(t);n=r,r=[]}}if(this.recentAttempts<2?this.pairDistractors=!1:this.pairDistractors=!0,void 0===this.options.order){var c=[],d=[];for(s=0;s<n.length;s++)(t=n[s]).lines[0].paired&&this.pairDistractors?d.push(t):((d=[]).push(t),c.push(d));for(c=this.shuffled(c),s=0;s<c.length;s++)if((d=c[s]).length>1)for(d=this.shuffled(d),p=0;p<d.length;p++)r.push(d[p]);else r.push(d[0])}else for(s=0;s<this.options.order.length;s++)void 0!==(t=e[this.options.order[s]])&&$.inArray(this.options.order[s],a)<0&&r.push(t);if(this.pairDistractors=!0,this.options.adaptive&&(this.limitDistractors=!0,r=this.adaptBlocks(r),!this.limitDistractors))for(s=0;s<a.length;s++){var u=null==this.options.order?Math.random(0,r.length):$.inArray(a[s],this.options.order);r.splice(u,0,e[a[s]])}if(this.pairDistractors&&null!=this.options.order)for(s=1;s<e.length;s++)if(e[s].lines[0].paired&&$.inArray(e[s],r)>=0){for(var p=s;$.inArray(e[p-1],r)<0;)p--;var v=$.inArray(e[p-1],r),g=$.inArray(e[s],r);r.splice(g,1),r.splice(v,0,e[s])}return r}blockFromHash(e){for(var t=e.split("_"),i=[],s=0;s<t.length-1;s++)i.push(this.lines[t[s]]);var n=new b(this,i);return this.noindent?n.indent=0:n.indent=Number(t[t.length-1]),n}blocksFromHash(e){var t;t="-"===e||""===e||null===e?[]:e.split("-");for(var i=[],s=0;s<t.length;s++)i.push(this.blockFromHash(t[s]));return this.options.adaptive?this.adaptBlocks(i):i}settledBlocksFromSource(){var e,t,i=[],s=[],n=0,r=0,o=void 0,a=0;for(t=0;t<this.lines.length;t++)if(e=this.lines[t],s.push(e),!e.groupWithNext)if(e.isPlaceholderLine)i.push(new w(this,s,n,r)),o&&o.setBlocksAfter(n),a=n,n=0,s=[];else if(e.isSettled){0==i.length&&(this.firstBlockSettled=!0);var l=new y(this,s);this.noindent||(l.indent=s[0].indent),console.log("settled block set",l),i.push(l),a>0&&l.setBlocksBefore(a),o=l,r++,n=0,s=[]}else s[0].distractor||n++,s=[];return i.length>0&&i[i.length-1].isSettled&&(this.lastBlockSettled=!0),console.log("settledblocksfromsource",i),i}getBlockById(e){for(var t=0;t<this.blocks.length;t++){var i=this.blocks[t];if(i.view.id==e)return i}}solutionBlocks(){for(var e=[],t=[],i=0;i<this.lines.length;i++)this.lines[i].distractor||t.push(this.lines[i]);var s=t[0].block();e.push(s);for(let i=1;i<t.length;i++){var n=t[i].block();s!==n&&(s=n,e.push(s))}return e}sourceBlocks(){for(var e=[],t=this.sourceArea.childNodes,i=0;i<t.length;i++){var s=t[i];$(s).hasClass("block")&&e.push(this.getBlockById(s.id))}return e}enabledSourceBlocks(){for(var e=this.sourceBlocks(),t=[],i=0;i<e.length;i++){var s=e[i];s.enabled()&&t.push(s)}return t}answerBlocks(){for(var e=[],t=this.answerArea.childNodes,i=0;i<t.length;i++){var s=this.getBlockById(t[i].id);void 0!==s&&e.push(s)}return e}enabledAnswerBlocks(){for(var e=this.answerBlocks(),t=[],i=0;i<e.length;i++){var s=e[i];s.enabled()&&t.push(s)}return t}answerLines(){for(var e=[],t=this.answerBlocks(),i=0;i<t.length;i++){var s=t[i];if(!s.isPlaceholder)for(var n=0;n<s.lines.length;n++)e.push(s.lines[n])}return e}getBlockFor(e){for(var t=e;!t.classList.contains("block");)t=t.parentElement;return t}solutionIndent(){for(var e=0,t=0;t<this.blocks.length;t++){var i=this.blocks[t];e=Math.max(e,i.solutionIndent())}return e}checkCurrentAnswer(){if(!this.hasSolved){if(this.checkCount++,this.clearFeedback(),null==this.adaptiveId&&(this.adaptiveId=this.storageId),this.grader.showfeedback=!1,this.grade=this.grader.grade(),"correct"==this.grade){if(this.hasSolved=!0,this.correct=!0,$(this.checkButton).prop("disabled",!0),this.hasSolved&&this.options.scaffolding){const e=document.querySelector(`#copy-answer-button-${this.divid}`);e&&e.classList.remove("copy-button-hide")}localStorage.setItem(this.adaptiveId+"Solved",!0),this.recentAttempts=this.checkCount,localStorage.setItem(this.adaptiveId+"recentAttempts",this.recentAttempts)}if(localStorage.setItem(this.adaptiveId+this.divid+"Count",this.checkCount),this.setLocalStorage(),!this.hasSolved&&"incorrectTooShort"!==this.grade&&this.canHelp){var e=this.answerHash();this.lastAnswerHash!==e&&(this.numDistinct++,this.lastAnswerHash=e),3!=this.numDistinct||this.gotHelp||alert($.i18n("msg_parson_help_info"))}}this.hasSolved&&this.options.runnable&&(this.runnableDiv?this.runnableDiv.style.display=null:this.generateRunableVersion())}generateRunableVersion(){this.runnableDiv=document.getElementById(this.divid+"-runnable"),this.runnableDiv.style.display=null;let e="";for(let t of this.answerBlocks())for(let i of t.lines)e+=" ".repeat(i.indent)+i.text+"\n";e=e.slice(0,-1);const t=this.runnableDiv.querySelector("textarea");t.innerHTML=t.innerHTML.replace("==PARSONSCODE==",e),this.runnableDiv.querySelector('[data-component="parsons-runnable"]').dataset.component="activecode",window.runestoneComponents.renderOneComponent(this.runnableDiv)}renderFeedback(){var e;this.grader.showfeedback=!0,this.grade=this.grader.graderState;var t=$(this.answerArea);if(e=!0===this.showfeedback?$(this.messageDiv):$("#doesnotexist"),"correct"===this.grade){t.addClass("correct"),this.messageDiv.style.visibility="visible",e.attr("class","alert alert-info");let i=this.checkCount>1?$.i18n("msg_parson_correct",this.checkCount):$.i18n("msg_parson_correct_first_try");this.options.runnable&&(i+=" "+$.i18n("msg_parson_correct_runnable")),setTimeout((()=>{e.html(i)}),10)}if("incorrectTooShort"===this.grade&&(t.addClass("incorrect"),this.messageDiv.style.visibility="visible",e.attr("class","alert alert-danger"),setTimeout((()=>{e.html($.i18n("msg_parson_too_short"))}),10)),"incorrectIndent"===this.grade){var i=[];for(let e=0;e<this.grader.indentLeft.length;e++)a=this.grader.indentLeft[e].block(),-1==i.indexOf(a)&&(i.push(a),$(a.view).addClass("indentLeft"));for(let e=0;e<this.grader.indentRight.length;e++)a=this.grader.indentRight[e].block(),-1==i.indexOf(a)&&(i.push(a),$(a.view).addClass("indentRight"));this.messageDiv.style.visibility="visible",e.attr("class","alert alert-danger"),setTimeout((()=>{1==i.length?e.html($.i18n("msg_parson_wrong_indent")):e.html($.i18n("msg_parson_wrong_indents"))}),10)}if("incorrectMoveBlocks"===this.grade){var s=this.answerBlocks(),n=[],r=[],o=[];for(let e=0;e<s.length;e++){var a=s[e],l=this.solution.indexOf(a.lines[0]);-1==l?o.push(a):(n.push(a),r.push(l))}var h=this.grader.inverseLISIndices(r,n);for(let e=0;e<h.length;e++)o.push(n[h[e]]);if(t.addClass("incorrect"),this.messageDiv.style.visibility="visible",e.attr("class","alert alert-danger"),!0===this.showfeedback)for(let e=0;e<o.length;e++)$(o[e].view).addClass("incorrectPosition");setTimeout((()=>{e.html($.i18n("msg_parson_wrong_order"))}),10)}}initializeAdaptive(){if(this.adaptiveId=super.localStorageKey(),this.canHelp=!0,this.checkCount=0,this.numDistinct=0,this.gotHelp=!1,localStorage.getItem(this.adaptiveId+"Problem")==this.divid)return this.checkCount=localStorage.getItem(this.adaptiveId+this.divid+"Count"),null==this.checkCount&&(this.checkCount=0),this;var e=localStorage.getItem(this.adaptiveId+this.divid+"Count");null!=e&&"NaN"!=e||(e=0),this.checkCount=e,this.recentAttempts=localStorage.getItem(this.adaptiveId+"recentAttempts"),null!=this.recentAttempts&&"NaN"!=this.recentAttempts||(this.recentAttempts=3),localStorage.setItem(this.adaptiveId+"recentAttempts",this.recentAttempts),localStorage.setItem(this.adaptiveId+"Problem",this.divid),localStorage.setItem(this.adaptiveId+this.divid+"Count",this.checkCount),localStorage.setItem(this.adaptiveId+"Solved",!1)}usesIndentation(){return!this.noindent&&0!=this.solutionIndent()}distractorToRemove(){var e,t=this.enabledAnswerBlocks();for(let i=0;i<t.length;i++)if((e=t[i]).isDistractor())return e;t=this.enabledSourceBlocks();for(let i=0;i<t.length;i++)if((e=t[i]).isDistractor())return e}numberOfBlocks(e=!0){for(var t=0,i=0;i<this.blocks.length;i++)!this.blocks[i].enabled()||!e&&this.blocks[i].isDistractor()||(t+=1);return t}removeDistractor(e){var t=$(this.messageDiv);if(this.messageDiv.style.visibility="visible",t.attr("class","alert alert-info"),setTimeout((()=>{t.html($.i18n("msg_parson_not_solution"))}),10),e.lines[0].distractHelptext&&(e.view.setAttribute("data-toggle","tooltip"),e.view.setAttribute("title",e.lines[0].distractHelptext)),e.disable(),e.inSourceArea())$(e.view).css({"border-color":"#000","background-color":"#fff"}),$(e.view).animate({opacity:.3,"border-color":"#d3d3d3","background-color":"#efefef"},{duration:2e3,complete:function(){$(e.view).css({"border-color":"","background-color":""})}});else{var i=this.sourceArea.getBoundingClientRect(),s=e.pageXCenter()-1,n=e.pageYCenter(),r=i.left+window.pageXOffset+i.width/2,o=i.top+window.pageYOffset+e.view.getBoundingClientRect().height/2,a=e.slideUnderBlock();void 0!==a&&(o+=a.view.getBoundingClientRect().height+20,o+=parseInt($(a.view).css("top")));var l=this;$(e.view).css({"border-color":"#000","background-color":"#fff"}),$(e.view).animate({opacity:1},{duration:4*Math.sqrt(Math.pow(o-n,2)+Math.pow(r-s,2))+500,start:function(){l.moving=e,l.movingX=s,l.movingY=n,l.updateView()},progress:function(e,t,i){l.movingX=s*(1-t)+r*t,l.movingY=n*(1-t)+o*t,l.updateView()},complete:function(){delete l.moving,delete l.movingX,delete l.movingY,l.updateView(),$(e.view).animate({opacity:.3,"border-color":"#d3d3d3","background-color":"#efefef"},{duration:1e3,complete:function(){$(e.view).css({opacity:"","border-color":"","background-color":""}),$(e.view).addClass("disabled")}})}})}}removeIndentation(){var e=$(this.messageDiv);this.messageDiv.style.visibility="visible",e.attr("class","alert alert-info"),setTimeout((()=>{e.html($.i18n("msg_parson_provided_indent"))}),10);for(var t,i,s=200,n=0;n<this.lines.length;n++){var r=this.lines[n],o=r.width+r.indent*this.options.pixelsPerIndent+30;s=Math.max(s,o)}null!=this.options.numbered&&(s+=25),this.areaWidth=s+22;var a=this.sourceBlocks();for(let e=0;e<a.length;e++)0==(i=(t=a[e]).solutionIndent())?$(t.view).animate({width:s},{duration:1e3}):$(t.view).animate({width:s-i*this.options.pixelsPerIndent,"padding-left":i*this.options.pixelsPerIndent+10},{duration:1e3});for(let e=0;e<this.pairedDivs.length;e++)$(this.pairedDivs[e]).animate({width:s+34},{duration:1e3});var l=this.answerBlocks();for(let e=0;e<l.length;e++)0==(i=(t=l[e]).solutionIndent())?$(t.view).animate({left:0,width:s},{duration:1e3}):$(t.view).animate({left:0,width:s-i*this.options.pixelsPerIndent,"padding-left":i*this.options.pixelsPerIndent+10},{duration:1e3});$(this.answerArea).removeClass("answer1 answer2 answer3 answer4"),$(this.answerArea).addClass("answer"),this.indent=0,this.noindent=!0,$(this.sourceArea).animate({width:this.areaWidth+2},{duration:1e3}),$(this.answerArea).animate({width:this.areaWidth+2},{duration:1e3}),$(this.answerArea).animate({opacity:1},{duration:1100,complete:function(){$(this.answerArea).css({opacity:""});for(let e=0;e<a.length;e++)a[e].addIndent();for(let e=0;e<l.length;e++)l[e].addIndent()}})}getSolutionBlockInSource(){for(var e=this.solutionBlocks(),t=this.answerBlocks(),i=this.sourceBlocks(),s=null,n=0;n<i.length;n++)if(s=i[n],e.indexOf(s)>0&&t.indexOf(s)<0)return s;return null}getFurthestBlock(){for(var e=this.solutionBlocks(),t=this.answerBlocks(),i=0,s=0,n=null,r=null,o=0,a=null,l=0,h=0;h<t.length;h++)r=t[h],(o=e.indexOf(r))>0&&(a=e[o-1],l=t.indexOf(a),(s=Math.abs(h-l))>i&&(i=s,n=r));return n}combineBlocks(){var e=this.solutionBlocks(),t=this.answerBlocks(),i=this.sourceBlocks(),s=$(this.messageDiv);this.messageDiv.style.visibility="visible",s.attr("class","alert alert-info"),setTimeout((()=>{s.html($.i18n("msg_parson_combined_blocks"))}),10);var n=null,r=null;null==(r=this.getSolutionBlockInSource())&&(r=this.getFurthestBlock());var o=e.indexOf(r);n=e[o-1];var a=t.indexOf(n),l=t.indexOf(r),h=!1;a>=0&&l>=0?h=a+1!==l:a<0&&l<0?h=(a=i.indexOf(n))+1!==(l=i.indexOf(r)):(h=!0,a<0&&(a=i.indexOf(n)),l<0&&(l=i.indexOf(r)));var c=l<a;if(h){var d=r.pageXCenter()-1,u=r.pageYCenter(),p=n.pageXCenter()-1,v=n.pageYCenter()+n.view.getBoundingClientRect().height/2+5;c?v-=r.view.getBoundingClientRect().height/2:v+=r.view.getBoundingClientRect().height/2;var g=this;$(r.view).animate({opacity:1},{duration:1e3,start:function(){$(n.view).css({"border-color":"#000","background-color":"#fff"}),$(r.view).css({"border-color":"#000","background-color":"#fff"}),r.lines[0].index+=1e3,g.moving=r,g.movingX=d,g.movingY=u,g.updateView()},progress:function(e,t,i){g.movingX=d*(1-t)+p*t,g.movingY=u*(1-t)+v*t,g.updateView()},complete:function(){delete g.moving,delete g.movingX,delete g.movingY,g.updateView(),r.lines[0].index-=1e3,n.consumeBlock(r),$(n.view).animate({"border-color":"#d3d3d3","background-color":"#efefef"},{duration:1e3,complete:function(){$(n.view).css({"border-color":"","background-color":""})}})}})}else $(r.view).animate({opacity:1},{duration:1e3,start:function(){$(n.view).css({"border-color":"#000","background-color":"#fff"}),$(r.view).css({"border-color":"#000","background-color":"#fff"})},complete:function(){n.consumeBlock(r),$(n.view).animate({"border-color":"#d3d3d3","background-color":"#efefef"},{duration:1e3,complete:function(){$(n.view).css({"border-color":"","background-color":""})}})}})}makeEasier(){var e=this.distractorToRemove();void 0===e||e.inSourceArea()?this.numberOfBlocks(!1)>3?(alert($.i18n("msg_parson_will_combine")),this.combineBlocks(),this.logMove("combinedBlocks")):(alert($.i18n("msg_parson_three_blocks_left")),this.canHelp=!1):(alert($.i18n("msg_parson_remove_incorrect")),this.removeDistractor(e),this.logMove("removedDistractor-"+e.hash()))}helpMe(){this.clearFeedback(),this.numDistinct<3?alert($.i18n("msg_parson_atleast_three_attempts")):(this.gotHelp=!0,this.makeEasier())}dateFromTimestamp(e){var t=new Date(e);if(isNaN(t.getTime())){var i=e.split(/[- :]/);t=new Date(i[0],i[1]-1,i[2],i[3],i[4],i[5])}return t}shuffled(e){for(var t,i,s=e.length,n=e.slice();0!==s;)i=Math.floor(Math.random()*s),t=n[s-=1],n[s]=n[i],n[i]=t;return n}enterKeyboardMode(){$(this.keyboardTip).show(),$(this.sourceLabel).hide(),$(this.answerLabel).hide(),this.clearFeedback()}exitKeyboardMode(){$(this.keyboardTip).hide(),$(this.sourceLabel).show(),$(this.answerLabel).show()}clearFeedback(){$(this.answerArea).removeClass("incorrect correct");for(var e=this.answerArea.childNodes,t=0;t<e.length;t++)$(e[t]).removeClass("correctPosition incorrectPosition indentLeft indentRight");this.messageDiv.style.visibility="hidden"}async disableInteraction(){if(await this.checkServerComplete,console.log("disabling blocks"),void 0!==this.blocks)for(var e=0;e<this.blocks.length;e++)this.blocks[e].disable();$(this.checkButton).hide(),$(this.resetButton).hide()}movingState(){if(null==this.moving)return"rest";var e=this.movingX-window.pageXOffset,t=this.movingY-window.pageYOffset,i=this.answerArea.getBoundingClientRect();return e>=i.left&&e<=i.right&&t>=i.top&&t<=i.bottom?"answer":e>=(i=this.sourceArea.getBoundingClientRect()).left&&e<=i.right&&t>=i.top&&t<=i.bottom?"source":"moving"}updateView(){var e,t,i,s=this.state,n=this.movingState(),r=!0,o=!0,a="moving"==n;s==n&&("rest"==n?(r=!1,o=!1):"source"==n?o=!1:"answer"==n?r=!1:"moving"==n&&(o=!1,r=!1)),void 0!==this.moving&&(e=$(this.moving.view).outerHeight(!0),$(this.moving.view).detach());var l,h,c=this.areaWidth-22;if(r){t=0;var d=this.sourceBlocks();if("source"==n){var u=!1,p=this.moving.pairedBin(),v=[];for(y=0;y<d.length;y++)v.push(d[y].pairedBin());v.includes(p)||(p=-1);var g=[];if(0==v.length)g.push(0);else{for((-1==p||v[0]==p)&&g.push(0),y=1;y<d.length;y++)(v[y-1]==p||v[y]==p||-1==p&&v[y-1]!=v[y])&&g.push(y);(-1==p||v[v.length-1]==p)&&g.push(v.length)}var f=this.movingX-this.sourceArea.getBoundingClientRect().left-window.pageXOffset-c/2-11,m=this.movingY-this.sourceArea.getBoundingClientRect().top-window.pageYOffset;for(y=0;y<d.length;y++){var b,w=d[y];if(!u&&g.includes(y)){var k=$(w.view).outerHeight(!0);for(b=y+1;b<d.length&&!g.includes(b);b++)k+=$(d[b].view).outerHeight(!0);(m-t<e+k/2||y==g[g.length-1])&&(u=!0,this.sourceArea.insertBefore(this.moving.view,w.view),$(this.moving.view).css({left:f,top:m-e/2,width:c,"z-index":3}),t+=e)}$(w.view).css({left:0,top:t,width:c,"z-index":2}),t+=$(w.view).outerHeight(!0)}u||($(this.moving.view).appendTo("#"+this.counterId+"-source"),$(this.moving.view).css({left:f,top:m-$(this.moving.view).outerHeight(!0)/2,width:c,"z-index":3}))}else for(var y=0;y<d.length;y++)w=d[y],$(w.view).css({left:0,top:t,width:c,"z-index":2}),t+=$(w.view).outerHeight(!0);for(y=0;y<this.pairedBins.length;y++){var x=this.pairedBins[y],_=[];for(b=0;b<d.length;b++)(l=d[b]).matchesBin(x)&&_.push(l);var C=this.pairedDivs[y];if(0==_.length)$(C).hide();else{$(C).show();var I=-5;I+=parseInt($(_[_.length-1].view).css("top")),I-=parseInt($(_[0].view).css("top")),I+=$(_[_.length-1].view).outerHeight(!0),$(C).css({left:-6,top:$(_[0].view).css("top"),width:c+34,height:I,"z-index":1,"text-indent":-30,"padding-top":(I-70)/2,overflow:"visible","font-size":43,"vertical-align":"middle",color:"#7e7ee7"}),$(C).html("<span id= 'st' style = 'vertical-align: middle; font-weight: bold; font-size: 15px'>or</span>{")}1==_.length&&$(C).html("")}}if(o)if(t=0,i=this.areaWidth+this.indent*this.options.pixelsPerIndent-22,d=this.answerBlocks(),"answer"==n){u=!1,f=this.movingX-this.answerArea.getBoundingClientRect().left-window.pageXOffset-c/2-11;var A=Math.round(f/this.options.pixelsPerIndent);for(A<0?A=0:A>this.indent?A=this.indent:f=A*this.options.pixelsPerIndent,m=this.movingY-this.answerArea.getBoundingClientRect().top-window.pageYOffset,this.moving.indent=A,y=0;y<d.length;y++)l=d[y],u||m-t<(e+$(l.view).outerHeight(!0))/2&&(u=!0,this.answerArea.insertBefore(this.moving.view,l.view),$(this.moving.view).css({left:f,top:m-e/2,width:c,"z-index":3}),t+=e),h=l.indent*this.options.pixelsPerIndent,$(l.view).css({left:h,top:t,width:i-h,"z-index":2}),t+=$(l.view).outerHeight(!0);u||($(this.moving.view).appendTo("#"+this.counterId+"-answer"),$(this.moving.view).css({left:f,top:m-$(this.moving.view).outerHeight(!0)/2,width:c,"z-index":3}))}else for(let e=0;e<d.length;e++)h=(l=d[e]).indent*this.options.pixelsPerIndent,$(l.view).css({left:h,top:t,width:i-h,"z-index":2}),t+=$(l.view).outerHeight(!0);if(a){if(-1==(p=this.moving.pairedBin()))$(this.moving.view).appendTo("#"+this.counterId+"-source");else{var S;for(d=this.sourceBlocks,y=0;y<d.length;y++)(l=d[y]).pairedBin()==p&&(S=y+1);null==S||S==d.length?$(this.moving.view).appendTo("#"+this.counterId+"-source"):this.sourceArea.insertBefore(this.moving.view,d[S].view)}$(this.moving.view).css({left:this.movingX-this.sourceArea.getBoundingClientRect().left-window.pageXOffset-$(this.moving.view).outerWidth(!0)/2,top:this.movingY-this.sourceArea.getBoundingClientRect().top-window.pageYOffset-e/2,width:c,"z-index":3})}s=n,this.state=s}addBlockLabels(e){var t=-1,i=0,s=0,n=0;for(let t=0;t<e.length;t++)-1==e[t].pairedBin()&&n++;for(let a=0;a<e.length;a++){var r=e[a].pairedBin();-1!=r&&r==t||(t=r,s=0,i++);var o=""+i+(-1!=r?String.fromCharCode(97+s):" ");i<10&&n+this.pairedBins.length>=10&&(o+=" "),e[a].addLabel(o,0),s++}n+this.pairedBins.length>=10&&(this.areaWidth+=5,$(this.sourceArea).css({width:$(this.sourceArea).width()+5}),$(this.answerArea).css({width:$(this.answerArea).width()+5}))}resetView(){if(this.clearFeedback(),!0===this.options.scaffolding){const e=document.querySelector(`#copy-answer-button-${this.divid}`);e&&e.classList.add("copy-button-hide")}var e,t=document.body.scrollTop;for(let t=0;t<this.blocks.length;t++){e=this.blocks[t];for(var i=0;i<e.lines.length;i++)for(var s=$(e.lines[i].view).find(".block-label"),n=0;n<s.length;n++)s[n].remove();e.destroy(),$(this.blocks[t].view).detach()}if(delete this.blocks,this.blockIndex=0,this.pairedDivs)for(let e=0;e<this.pairedDivs.length;e++)$(this.pairedDivs[e]).detach();$(this.sourceArea).attr("style",""),$(this.answerArea).removeClass(),$(this.answerArea).attr("style",""),this.noindent=this.options.noindent,this.hasSolved&&(this.checkCount=0,this.numDistinct=0,this.hasSolved=!1,this.options.adaptive&&(this.canHelp=!0),localStorage.setItem(this.adaptiveId+"Problem",this.divid),localStorage.setItem(this.adaptiveId+this.divid+"Count",this.checkCount),localStorage.setItem(this.adaptiveId+"Solved",!1)),!0===this.options.scaffolding?this.initializeAreas(this.blocksFromSource(),this.settledBlocksFromSource(),{}):this.initializeAreas(this.blocksFromSource(),[],{}),this.initializeInteractivity(),document.body.scrollTop=t,this.runnableDiv&&(this.runnableDiv.style.display="none")}}x.counter=0,$(document).on("runestone:login-complete",(function(){$("[data-component=parsons]").each((function(e){if(0==$(this).closest("[data-component=timedAssessment]").length)try{window.componentMap[this.id]=new x({orig:this,useRunestoneServices:eBookConfig.useRunestoneServices})}catch(e){console.log(`Error rendering Parsons Problem ${this.id}\n Details: ${e}`),console.log(e.stack)}}))}));class _ extends x{constructor(e){super(e),e.timedfeedback?this.showfeedback=!0:this.showfeedback=!1,this.grader.showfeedback=this.showfeedback,this.hideFeedback(),$(this.checkButton).hide(),$(this.helpButton).hide(),$(this.resetButton).hide()}checkCorrectTimed(){return this.correct?"T":"F"}hideFeedback(){$(this.messageDiv).hide()}}void 0===window.component_factory&&(window.component_factory={}),window.component_factory.parsons=function(e){return e.timed?new _(e):new x(e)}},56906:()=>{$.i18n().load({"pt-br":{msg_parson_check_me:"Verificar",msg_parson_reset:"Resetar",msg_parson_help:"Ajuda",msg_parson_too_short:"Seu programa é muito curto. Adicione mais blocos.",msg_parson_drag_from_here:"Arraste daqui",msg_parson_drag_to_here:"Largue os blocos aqui",msg_parson_correct_first_try:"Perfeito! Você levou apenas uma tentativa para resolver. Bom trabalho!",msg_parson_correct:"Perfeito! Você levou $1 tentativas para resolver. Clique em Resetar para tentar resolver em uma tentativa.",msg_parson_wrong_indent:"Este bloco não está indentado corretamente. Indente mais arrastando-o para a direita ou reduza a indentação arrastando para a esquerda.",msg_parson_wrong_indents:"Estes blocos não estão indentados corretamente. Para indentar mais, arraste o bloco para a direita. Para reduzir a indentação, arraste para a esquerda.",msg_parson_wrong_order:"Blocos destacados no seu programa estão errados ou estão na ordem errada. Isso pode ser resolvido movendo, excluindo ou substituindo os blocos destacados.",msg_parson_arrow_navigate:"Use as teclas de setas para navegar. Espaço para selecionar/ desmarcar blocos para mover.",msg_parson_help_info:"Clique no botão Ajuda se você quiser facilitar o problema",msg_parson_not_solution:"Foi desabilitado um bloco de código desnecessário (que não faz parte da solução).",msg_parson_provided_indent:"Foi fornecida a indentação.",msg_parson_combined_blocks:"Dois blocos de códigos foram combinados em um.",msg_parson_remove_incorrect:"Será removido um bloco de código incorreto da área de resposta",msg_parson_will_combine:"Serão combinados dois blocos",msg_parson_atleast_three_attempts:"Você deve tentar pelo menos três vezes antes de pedir ajuda",msg_parson_three_blocks_left:"Restam apenas 3 blocos corretos. Você deve colocá-los em ordem",msg_parson_will_provide_indent:"Será fornecida a indentação"}})},75794:()=>{$.i18n().load({en:{msg_parson_check_me:"Check",msg_parson_reset:"Reset",msg_parson_help:"Help me",msg_parson_too_short:"Your answer is too short. Add more blocks.",msg_parson_drag_from_here:"Drag from here",msg_parson_drag_to_here:"Drop blocks here",msg_parson_correct_first_try:"Perfect! It took you only one try to solve this. Great job!",msg_parson_correct:"Perfect! It took you $1 tries to solve this. Click Reset to try to solve it in one attempt.",msg_parson_correct_runnable:"Click Run below to test out your solution.",msg_parson_wrong_indent:"This block is not indented correctly. Either indent it more by dragging it right or reduce the indention by dragging it left.",msg_parson_wrong_indents:"These blocks are not indented correctly. To indent a block more, drag it to the right. To reduce the indention, drag it to the left.",msg_parson_wrong_order:"Highlighted blocks in your answer are wrong or are in the wrong order. This can be fixed by moving, removing, or replacing highlighted blocks.",msg_parson_arrow_navigate:"Arrow keys to navigate. Space to select / deselect block to move.",msg_parson_help_info:"Click on the Help Me button if you want to make the problem easier",msg_parson_not_solution:"Disabled an unneeded code block (one that is not part of the solution).",msg_parson_provided_indent:"Provided the indentation.",msg_parson_combined_blocks:"Combined two code blocks into one.",msg_parson_remove_incorrect:"Will remove an incorrect code block from answer area",msg_parson_will_combine:"Will combine two blocks",msg_parson_atleast_three_attempts:"You must make at least three distinct full attempts at a solution before you can get help",msg_parson_three_blocks_left:"There are only 3 correct blocks left. You should be able to put them in order",msg_parson_will_provide_indent:"Will provide indentation"}})},78811:()=>{function e(){var t=navigator&&navigator.userAgent&&/\bMSIE 6\./.test(navigator.userAgent);return e=function(){return t},t}!function(){var t="break continue do else for if return while ",i=t+"auto case char const default double enum extern float goto int long register short signed sizeof static struct switch typedef union unsigned void volatile catch class delete false import new operator private protected public this throw true try ",s=i+"alignof align_union asm axiom bool concept concept_map const_cast constexpr decltype dynamic_cast explicit export friend inline late_check mutable namespace nullptr reinterpret_cast static_assert static_cast template typeid typename typeof using virtual wchar_t where ",n=i+"boolean byte extends final finally implements import instanceof null native package strictfp super synchronized throws transient ",r=i+"debugger eval export function get null set undefined var with Infinity NaN ",o="caller delete die do dump elsif eval exit foreach for goto if import last local my next no our print package redo require sub undef unless until use wantarray while BEGIN END ",a=t+"and as assert class def del elif except exec finally from global import in is lambda nonlocal not or pass print raise try with yield False True None ",l=t+"alias and begin case class def defined elsif end ensure false in module next nil not or redo rescue retry self super then true undef unless until when yield BEGIN END ",h=t+"case done elif esac eval fi function in local set then until ",c=s+(n+"as base by checked decimal delegate descending event fixed foreach from group implicit in interface internal into is lock object out override orderby params readonly ref sbyte sealed stackalloc string select uint ulong unchecked unsafe ushort var ")+r+o+a+l+h;function d(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"}function u(e,t,i,s){e.unshift(i,s||0);try{t.splice.apply(t,e)}finally{e.splice(0,2)}}var p=function(){for(var e=["!","!=","!==","#","%","%=","&","&&","&&=","&=","(","*","*=","+=",",","-=","->","/","/=",":","::",";","<","<<","<<=","<=","=","==","===",">",">=",">>",">>=",">>>",">>>=","?","@","[","^","^=","^^","^^=","{","|","|=","||","||=","~","break","case","continue","delete","do","else","finally","instanceof","return","throw","try","typeof"],t="(?:(?:(?:^|[^0-9.])\\.{1,3})|(?:(?:^|[^\\+])\\+)|(?:(?:^|[^\\-])-)",i=0;i<e.length;++i){var s=e[i];t+=d(s.charAt(0))?"|\\b"+s:"|"+s.replace(/([^=<>:&])/g,"\\$1")}return t+="|^)\\s*$",new RegExp(t)}(),v=/&/g,g=/</g,f=/>/g,m=/\"/g;function b(e){return e.replace(v,"&amp;").replace(g,"&lt;").replace(f,"&gt;")}var w=/&lt;/g,k=/&gt;/g,y=/&apos;/g,$=/&quot;/g,x=/&amp;/g,_=/&nbsp;/g;function C(e){var t=e.indexOf("&");if(t<0)return e;for(--t;(t=e.indexOf("&#",t+1))>=0;){var i=e.indexOf(";",t);if(i>=0){var s=e.substring(t+3,i),n=10;s&&"x"===s.charAt(0)&&(s=s.substring(1),n=16);var r=parseInt(s,n);isNaN(r)||(e=e.substring(0,t)+String.fromCharCode(r)+e.substring(i+1))}}return e.replace(w,"<").replace(k,">").replace(y,"'").replace($,'"').replace(x,"&").replace(_," ")}function I(e){return"XMP"===e.tagName}function A(e,t){switch(e.nodeType){case 1:var i=e.tagName.toLowerCase();t.push("<",i);for(var s=0;s<e.attributes.length;++s){var n=e.attributes[s];n.specified&&(t.push(" "),A(n,t))}t.push(">");for(var r=e.firstChild;r;r=r.nextSibling)A(r,t);!e.firstChild&&/^(?:br|link|img)$/.test(i)||t.push("</",i,">");break;case 2:t.push(e.name.toLowerCase(),'="',function(e){return e.replace(v,"&amp;").replace(g,"&lt;").replace(f,"&gt;").replace(m,"&quot;")}(e.value),'"');break;case 3:case 4:t.push(b(e.nodeValue))}}var S=null;function T(e){if(null===S){var t=document.createElement("PRE");t.appendChild(document.createTextNode('<!DOCTYPE foo PUBLIC "foo bar">\n<foo />')),S=!/</.test(t.innerHTML)}if(S){var i=e.innerHTML;return I(e)&&(i=b(i)),i}for(var s=[],n=e.firstChild;n;n=n.nextSibling)A(n,s);return s.join("")}var B=/(?:[^<]+|<!--[\s\S]*?--\>|<!\[CDATA\[([\s\S]*?)\]\]>|<\/?[a-zA-Z][^>]*>|<)/g,D=/^<!--/,E=/^<\[CDATA\[/,M=/^<br\b/i;function L(e,t){var i={};!function(){for(var s=e.concat(t),n=s.length;--n>=0;){var r=s[n],o=r[3];if(o)for(var a=o.length;--a>=0;)i[o.charAt(a)]=r}}();var s=t.length;return function(e,n){for(var r=[n=n||0,"pln"],o="",a=0,l=e;l.length;){var h,c,d=null,u=i[l.charAt(0)];if(u)d=(c=l.match(u[1]))[0],h=u[0];else{for(var p=0;p<s;++p){var v=(u=t[p])[2];if((!v||v.test(o))&&(c=l.match(u[1]))){d=c[0],h=u[0];break}}d||(h="pln",d=l.substring(0,1))}r.push(n+a,h),a+=d.length,l=l.substring(d.length),"com"!==h&&/\S/.test(d)&&(o=d)}return r}}var P=L([],[["pln",/^[^<]+/,null],["dec",/^<!\w[^>]*(?:>|$)/,null],["com",/^<!--[\s\S]*?(?:--\>|$)/,null],["src",/^<\?[\s\S]*?(?:\?>|$)/,null],["src",/^<%[\s\S]*?(?:%>|$)/,null],["src",/^<(script|style|xmp)\b[^>]*>[\s\S]*?<\/\1\b[^>]*>/i,null],["tag",/^<\/?\w[^<>]*>/,null]]),R=L([["atv",/^\'[^\']*(?:\'|$)/,null,"'"],["atv",/^\"[^\"]*(?:\"|$)/,null,'"'],["pun",/^[<>\/=]+/,null,"<>/="]],[["tag",/^[\w:\-]+/,/^</],["atv",/^[\w\-]+/,/^=/],["atn",/^[\w:\-]+/,null],["pln",/^\s+/,null," \t\r\n"]]);function O(e){var t=[],i=[];e.tripleQuotedStrings?t.push(["str",/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,"'\""]):e.multiLineStrings?t.push(["str",/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):t.push(["str",/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,"\"'"]),i.push(["pln",/^(?:[^\'\"\`\/\#]+)/,null," \r\n"]),e.hashComments&&t.push(["com",/^#[^\r\n]*/,null,"#"]),e.cStyleComments&&i.push(["com",/^\/\/[^\r\n]*/,null]),e.regexLiterals&&i.push(["str",/^\/(?:[^\\\*\/\[]|\\[\s\S]|\[(?:[^\]\\]|\\.)*(?:\]|$))+(?:\/|$)/,p]),e.cStyleComments&&i.push(["com",/^\/\*[\s\S]*?(?:\*\/|$)/,null]);var s=function(e){for(var t={},i=(e=e.split(/ /g)).length;--i>=0;){var s=e[i];s&&(t[s]=null)}return t}(e.keywords);e=null;var n=L(t,i),r=L([],[["pln",/^\s+/,null," \r\n"],["pln",/^[a-z_$@][a-z_$@0-9]*/i,null],["lit",/^0x[a-f0-9]+[a-z]/i,null],["lit",/^(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d+)(?:e[+\-]?\d+)?[a-z]*/i,null,"123456789"],["pun",/^[^\s\w\.$@]+/,null]]);return function(e){var t=n(e);return t=function(e,t){for(var i=0;i<t.length;i+=2)if("pln"===t[i+1]){var n,o,a,l;n=t[i],o=i+2<t.length?t[i+2]:e.length,a=e.substring(n,o);for(var h=0,c=(l=r(a,n)).length;h<c;h+=2)if("pln"===l[h+1]){var d=l[h],p=h+2<c?l[h+2]:a.length,v=e.substring(d,p);"."===v?l[h+1]="pun":v in s?l[h+1]="kwd":/^@?[A-Z][A-Z$]*[a-z][A-Za-z$]*$/.test(v)&&(l[h+1]="@"===v.charAt(0)?"lit":"typ")}u(l,t,i,2),i+=l.length-2}return t}(e,t),t}}var N=O({keywords:c,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),z={};function F(e,t){for(var i=t.length;--i>=0;){var s=t[i];z.hasOwnProperty(s)?"console"in window&&console.log("cannot override language handler %s",s):z[s]=e}}function H(e,t){try{var i=function(e){var t=e.match(B),i=[],s=0,n=[];if(t)for(var r=0,o=t.length;r<o;++r){var a=t[r];if(a.length>1&&"<"===a.charAt(0)){if(D.test(a))continue;E.test(a)?(i.push(a.substring(9,a.length-3)),s+=a.length-12):M.test(a)?(i.push("\n"),++s):n.push(s,a)}else{var l=C(a);i.push(l),s+=l.length}}return{source:i.join(""),tags:n}}(e),s=i.source,n=i.tags;return z.hasOwnProperty(t)||(t=/^\s*</.test(s)?"default-markup":"default-code"),function(e,t,i){var s=[],n=0,r=null,o=null,a=0,l=0,h=function(){var e=0;return function(t){for(var i=null,s=0,n=0,r=t.length;n<r;++n)switch(t.charAt(n)){case"\t":i||(i=[]),i.push(t.substring(s,n));var o=8-e%8;for(e+=o;o>=0;o-=16)i.push(" ".substring(0,o));s=n+1;break;case"\n":e=0;break;default:++e}return i?(i.push(t.substring(s)),i.join("")):t}}();function c(t){if(t>n){r&&r!==o&&(s.push("</span>"),r=null),!r&&o&&(r=o,s.push('<span class="',r,'">'));var i=b(h(e.substring(n,t))).replace(/(\r\n?|\n| ) /g,"$1&nbsp;").replace(/\r\n?|\n/g,"<br />");s.push(i),n=t}}for(;;)if(a<t.length&&(!(l<i.length)||t[a]<=i[l]))c(t[a]),r&&(s.push("</span>"),r=null),s.push(t[a+1]),a+=2;else{if(!(l<i.length))break;c(i[l]),o=i[l+1],l+=2}return c(e.length),r&&s.push("</span>"),s.join("")}(s,n,z[t].call({},s))}catch(t){return"console"in window&&(console.log(t),console.trace()),e}}F(N,["default-code"]),F((function(e){var t=function(e){for(var t=P(e),i=0;i<t.length;i+=2)if("src"===t[i+1]){var s,n;s=t[i],n=i+2<t.length?t[i+2]:e.length;var r=e.substring(s,n).match(/^(<[^>]*>)([\s\S]*)(<\/[^>]*>)$/);r&&t.splice(i,2,s,"tag",s+r[1].length,"src",s+r[1].length+(r[2]||"").length,"tag")}return t}(e);return t=function(e,t){for(var i=0;i<t.length;i+=2)if("tag"===t[i+1]){var s,n;s=t[i],n=i+2<t.length?t[i+2]:e.length;var r=e.substring(s,n),o=R(r,s);u(o,t,i,2),i+=o.length-2}return t}(e,t),t=function(e,t){for(var i=0;i<t.length;i+=2)if("src"===t[i+1]){var s,n;s=t[i],n=i+2<t.length?t[i+2]:e.length;for(var r=N(e.substring(s,n)),o=0,a=r.length;o<a;o+=2)r[o]+=s;u(r,t,i,2),i+=r.length-2}return t}(e,t),function(e,t){for(var i=!1,s=0;s<t.length;s+=2){var n,r,o=t[s+1];if("atn"===o)n=t[s],r=s+2<t.length?t[s+2]:e.length,i=/^on|^style$/i.test(e.substring(n,r));else if("atv"===o){if(i){n=t[s],r=s+2<t.length?t[s+2]:e.length;var a,l,h,c=e.substring(n,r),d=c.length,p=d>=2&&/^[\"\']/.test(c)&&c.charAt(0)===c.charAt(d-1);p?(l=n+1,h=r-1,a=c):(l=n+1,h=r-1,a=c.substring(1,c.length-1));for(var v=N(a),g=0,f=v.length;g<f;g+=2)v[g]+=l;p?(v.push(h,"atv"),u(v,t,s+2,0)):u(v,t,s,2)}i=!1}}return t}(e,t)}),["default-markup","html","htm","xhtml","xml","xsl"]),F(O({keywords:s,hashComments:!0,cStyleComments:!0}),["c","cc","cpp","cs","cxx","cyc"]),F(O({keywords:n,cStyleComments:!0}),["java"]),F(O({keywords:h,hashComments:!0,multiLineStrings:!0}),["bsh","csh","sh"]),F(O({keywords:a,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py"]),F(O({keywords:o,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["perl","pl","pm"]),F(O({keywords:l,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb"]),F(O({keywords:r,cStyleComments:!0,regexLiterals:!0}),["js"]),window.PR_normalizedHtml=A,window.prettyPrintOne=H,window.prettyPrint=function(t){for(var i=e(),s=[document.getElementsByTagName("pre"),document.getElementsByTagName("code"),document.getElementsByTagName("li"),document.getElementsByTagName("xmp")],n=[],r=0;r<s.length;++r)for(var o=0;o<s[r].length;++o)n.push(s[r][o]);s=null;var a=0;!function e(){for(var s=(new Date).getTime()+250;a<n.length&&(new Date).getTime()<s;a++){var r=n[a];if(r.className&&r.className.indexOf("prettyprint")>=0){var o=r.className.match(/\blang-(\w+)\b/);o&&(o=o[1]);for(var l=!1,h=r.parentNode;h;h=h.parentNode)if(("pre"===h.tagName||"code"===h.tagName||"xmp"===h.tagName)&&h.className&&h.className.indexOf("prettyprint")>=0){l=!0;break}if(!l){var c=T(r),d=H(c=c.replace(/(?:\r\n?|\n)$/,""),o);if(I(r)){for(var u=document.createElement("PRE"),p=0;p<r.attributes.length;++p){var v=r.attributes[p];v.specified&&u.setAttribute(v.name,v.value)}u.innerHTML=d,r.parentNode.replaceChild(u,r),u=r}else r.innerHTML=d;if(i&&"PRE"===r.tagName)for(var g=r.getElementsByTagName("br"),f=g.length;--f>=0;){var m=g[f];m.parentNode.replaceChild(document.createTextNode("\r\n"),m)}}}}a<n.length?setTimeout(e,250):t&&t()}()},window.PR={createSimpleLexer:L,registerLangHandler:F,sourceDecorator:O,PR_ATTRIB_NAME:"atn",PR_ATTRIB_VALUE:"atv",PR_COMMENT:"com",PR_DECLARATION:"dec",PR_KEYWORD:"kwd",PR_LITERAL:"lit",PR_PLAIN:"pln",PR_PUNCTUATION:"pun",PR_SOURCE:"src",PR_STRING:"str",PR_TAG:"tag",PR_TYPE:"typ"}}()},88210:(e,t,i)=>{var s;!function(n,r,o,a){"use strict";function l(e,t,i){return setTimeout(p(e,i),t)}function h(e,t,i){return!!Array.isArray(e)&&(c(e,i[t],i),!0)}function c(e,t,i){var s;if(e)if(e.forEach)e.forEach(t,i);else if(e.length!==a)for(s=0;s<e.length;)t.call(i,e[s],s,e),s++;else for(s in e)e.hasOwnProperty(s)&&t.call(i,e[s],s,e)}function d(e,t,i){var s="DEPRECATED METHOD: "+t+"\n"+i+" AT \n";return function(){var t=new Error("get-stack-trace"),i=t&&t.stack?t.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",r=n.console&&(n.console.warn||n.console.log);return r&&r.call(n.console,s,i),e.apply(this,arguments)}}function u(e,t,i){var s,n=t.prototype;(s=e.prototype=Object.create(n)).constructor=e,s._super=n,i&&ae(s,i)}function p(e,t){return function(){return e.apply(t,arguments)}}function v(e,t){return typeof e==ce?e.apply(t&&t[0]||a,t):e}function g(e,t){return e===a?t:e}function f(e,t,i){c(k(t),(function(t){e.addEventListener(t,i,!1)}))}function m(e,t,i){c(k(t),(function(t){e.removeEventListener(t,i,!1)}))}function b(e,t){for(;e;){if(e==t)return!0;e=e.parentNode}return!1}function w(e,t){return e.indexOf(t)>-1}function k(e){return e.trim().split(/\s+/g)}function y(e,t,i){if(e.indexOf&&!i)return e.indexOf(t);for(var s=0;s<e.length;){if(i&&e[s][i]==t||!i&&e[s]===t)return s;s++}return-1}function $(e){return Array.prototype.slice.call(e,0)}function x(e,t,i){for(var s=[],n=[],r=0;r<e.length;){var o=t?e[r][t]:e[r];y(n,o)<0&&s.push(e[r]),n[r]=o,r++}return i&&(s=t?s.sort((function(e,i){return e[t]>i[t]})):s.sort()),s}function _(e,t){for(var i,s,n=t[0].toUpperCase()+t.slice(1),r=0;r<le.length;){if((s=(i=le[r])?i+n:t)in e)return s;r++}return a}function C(e){var t=e.ownerDocument||e;return t.defaultView||t.parentWindow||n}function I(e,t){var i=this;this.manager=e,this.callback=t,this.element=e.element,this.target=e.options.inputTarget,this.domHandler=function(t){v(e.options.enable,[e])&&i.handler(t)},this.init()}function A(e,t,i){var s=i.pointers.length,n=i.changedPointers.length,r=t&xe&&s-n==0,o=t&(Ce|Ie)&&s-n==0;i.isFirst=!!r,i.isFinal=!!o,r&&(e.session={}),i.eventType=t,function(e,t){var i=e.session,s=t.pointers,n=s.length;i.firstInput||(i.firstInput=T(t)),n>1&&!i.firstMultiple?i.firstMultiple=T(t):1===n&&(i.firstMultiple=!1);var r=i.firstInput,o=i.firstMultiple,a=o?o.center:r.center,l=t.center=B(s);t.timeStamp=pe(),t.deltaTime=t.timeStamp-r.timeStamp,t.angle=L(a,l),t.distance=M(a,l),function(e,t){var i=t.center,s=e.offsetDelta||{},n=e.prevDelta||{},r=e.prevInput||{};t.eventType!==xe&&r.eventType!==Ce||(n=e.prevDelta={x:r.deltaX||0,y:r.deltaY||0},s=e.offsetDelta={x:i.x,y:i.y}),t.deltaX=n.x+(i.x-s.x),t.deltaY=n.y+(i.y-s.y)}(i,t),t.offsetDirection=E(t.deltaX,t.deltaY);var h=D(t.deltaTime,t.deltaX,t.deltaY);t.overallVelocityX=h.x,t.overallVelocityY=h.y,t.overallVelocity=ue(h.x)>ue(h.y)?h.x:h.y,t.scale=o?function(e,t){return M(t[0],t[1],Re)/M(e[0],e[1],Re)}(o.pointers,s):1,t.rotation=o?function(e,t){return L(t[1],t[0],Re)+L(e[1],e[0],Re)}(o.pointers,s):0,t.maxPointers=i.prevInput?t.pointers.length>i.prevInput.maxPointers?t.pointers.length:i.prevInput.maxPointers:t.pointers.length,S(i,t);var c=e.element;b(t.srcEvent.target,c)&&(c=t.srcEvent.target),t.target=c}(e,i),e.emit("hammer.input",i),e.recognize(i),e.session.prevInput=i}function S(e,t){var i,s,n,r,o=e.lastInterval||t,l=t.timeStamp-o.timeStamp;if(t.eventType!=Ie&&(l>$e||o.velocity===a)){var h=t.deltaX-o.deltaX,c=t.deltaY-o.deltaY,d=D(l,h,c);s=d.x,n=d.y,i=ue(d.x)>ue(d.y)?d.x:d.y,r=E(h,c),e.lastInterval=t}else i=o.velocity,s=o.velocityX,n=o.velocityY,r=o.direction;t.velocity=i,t.velocityX=s,t.velocityY=n,t.direction=r}function T(e){for(var t=[],i=0;i<e.pointers.length;)t[i]={clientX:de(e.pointers[i].clientX),clientY:de(e.pointers[i].clientY)},i++;return{timeStamp:pe(),pointers:t,center:B(t),deltaX:e.deltaX,deltaY:e.deltaY}}function B(e){var t=e.length;if(1===t)return{x:de(e[0].clientX),y:de(e[0].clientY)};for(var i=0,s=0,n=0;t>n;)i+=e[n].clientX,s+=e[n].clientY,n++;return{x:de(i/t),y:de(s/t)}}function D(e,t,i){return{x:t/e||0,y:i/e||0}}function E(e,t){return e===t?Ae:ue(e)>=ue(t)?0>e?Se:Te:0>t?Be:De}function M(e,t,i){i||(i=Pe);var s=t[i[0]]-e[i[0]],n=t[i[1]]-e[i[1]];return Math.sqrt(s*s+n*n)}function L(e,t,i){i||(i=Pe);var s=t[i[0]]-e[i[0]],n=t[i[1]]-e[i[1]];return 180*Math.atan2(n,s)/Math.PI}function P(){this.evEl=Ne,this.evWin=ze,this.pressed=!1,I.apply(this,arguments)}function R(){this.evEl=We,this.evWin=Xe,I.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}function O(){this.evTarget=Ve,this.evWin=je,this.started=!1,I.apply(this,arguments)}function N(e,t){var i=$(e.touches),s=$(e.changedTouches);return t&(Ce|Ie)&&(i=x(i.concat(s),"identifier",!0)),[i,s]}function z(){this.evTarget=Ue,this.targetIds={},I.apply(this,arguments)}function F(e,t){var i=$(e.touches),s=this.targetIds;if(t&(xe|_e)&&1===i.length)return s[i[0].identifier]=!0,[i,i];var n,r,o=$(e.changedTouches),a=[],l=this.target;if(r=i.filter((function(e){return b(e.target,l)})),t===xe)for(n=0;n<r.length;)s[r[n].identifier]=!0,n++;for(n=0;n<o.length;)s[o[n].identifier]&&a.push(o[n]),t&(Ce|Ie)&&delete s[o[n].identifier],n++;return a.length?[x(r.concat(a),"identifier",!0),a]:void 0}function H(){I.apply(this,arguments);var e=p(this.handler,this);this.touch=new z(this.manager,e),this.mouse=new P(this.manager,e),this.primaryTouch=null,this.lastTouches=[]}function W(e,t){e&xe?(this.primaryTouch=t.changedPointers[0].identifier,X.call(this,t)):e&(Ce|Ie)&&X.call(this,t)}function X(e){var t=e.changedPointers[0];if(t.identifier===this.primaryTouch){var i={x:t.clientX,y:t.clientY};this.lastTouches.push(i);var s=this.lastTouches;setTimeout((function(){var e=s.indexOf(i);e>-1&&s.splice(e,1)}),Ge)}}function Y(e){for(var t=e.srcEvent.clientX,i=e.srcEvent.clientY,s=0;s<this.lastTouches.length;s++){var n=this.lastTouches[s],r=Math.abs(t-n.x),o=Math.abs(i-n.y);if(Je>=r&&Je>=o)return!0}return!1}function V(e,t){this.manager=e,this.set(t)}function j(e){this.options=ae({},this.defaults,e||{}),this.id=fe++,this.manager=null,this.options.enable=g(this.options.enable,!0),this.state=ot,this.simultaneous={},this.requireFail=[]}function q(e){return e&dt?"cancel":e&ht?"end":e&lt?"move":e&at?"start":""}function U(e){return e==De?"down":e==Be?"up":e==Se?"left":e==Te?"right":""}function G(e,t){var i=t.manager;return i?i.get(e):e}function J(){j.apply(this,arguments)}function K(){J.apply(this,arguments),this.pX=null,this.pY=null}function Z(){J.apply(this,arguments)}function Q(){j.apply(this,arguments),this._timer=null,this._input=null}function ee(){J.apply(this,arguments)}function te(){J.apply(this,arguments)}function ie(){j.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}function se(e,t){return(t=t||{}).recognizers=g(t.recognizers,se.defaults.preset),new ne(e,t)}function ne(e,t){this.options=ae({},se.defaults,t||{}),this.options.inputTarget=this.options.inputTarget||e,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=e,this.input=function(e){return new(e.options.inputClass||(be?R:we?z:me?H:P))(e,A)}(this),this.touchAction=new V(this,this.options.touchAction),re(this,!0),c(this.options.recognizers,(function(e){var t=this.add(new e[0](e[1]));e[2]&&t.recognizeWith(e[2]),e[3]&&t.requireFailure(e[3])}),this)}function re(e,t){var i,s=e.element;s.style&&(c(e.options.cssProps,(function(n,r){i=_(s.style,r),t?(e.oldCssProps[i]=s.style[i],s.style[i]=n):s.style[i]=e.oldCssProps[i]||""})),t||(e.oldCssProps={}))}function oe(e,t){var i=r.createEvent("Event");i.initEvent(e,!0,!0),i.gesture=t,t.target.dispatchEvent(i)}var ae,le=["","webkit","Moz","MS","ms","o"],he=r.createElement("div"),ce="function",de=Math.round,ue=Math.abs,pe=Date.now;ae="function"!=typeof Object.assign?function(e){if(e===a||null===e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),i=1;i<arguments.length;i++){var s=arguments[i];if(s!==a&&null!==s)for(var n in s)s.hasOwnProperty(n)&&(t[n]=s[n])}return t}:Object.assign;var ve=d((function(e,t,i){for(var s=Object.keys(t),n=0;n<s.length;)(!i||i&&e[s[n]]===a)&&(e[s[n]]=t[s[n]]),n++;return e}),"extend","Use `assign`."),ge=d((function(e,t){return ve(e,t,!0)}),"merge","Use `assign`."),fe=1,me="ontouchstart"in n,be=_(n,"PointerEvent")!==a,we=me&&/mobile|tablet|ip(ad|hone|od)|android/i.test(navigator.userAgent),ke="touch",ye="mouse",$e=25,xe=1,_e=2,Ce=4,Ie=8,Ae=1,Se=2,Te=4,Be=8,De=16,Ee=Se|Te,Me=Be|De,Le=Ee|Me,Pe=["x","y"],Re=["clientX","clientY"];I.prototype={handler:function(){},init:function(){this.evEl&&f(this.element,this.evEl,this.domHandler),this.evTarget&&f(this.target,this.evTarget,this.domHandler),this.evWin&&f(C(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&m(this.element,this.evEl,this.domHandler),this.evTarget&&m(this.target,this.evTarget,this.domHandler),this.evWin&&m(C(this.element),this.evWin,this.domHandler)}};var Oe={mousedown:xe,mousemove:_e,mouseup:Ce},Ne="mousedown",ze="mousemove mouseup";u(P,I,{handler:function(e){var t=Oe[e.type];t&xe&&0===e.button&&(this.pressed=!0),t&_e&&1!==e.which&&(t=Ce),this.pressed&&(t&Ce&&(this.pressed=!1),this.callback(this.manager,t,{pointers:[e],changedPointers:[e],pointerType:ye,srcEvent:e}))}});var Fe={pointerdown:xe,pointermove:_e,pointerup:Ce,pointercancel:Ie,pointerout:Ie},He={2:ke,3:"pen",4:ye,5:"kinect"},We="pointerdown",Xe="pointermove pointerup pointercancel";n.MSPointerEvent&&!n.PointerEvent&&(We="MSPointerDown",Xe="MSPointerMove MSPointerUp MSPointerCancel"),u(R,I,{handler:function(e){var t=this.store,i=!1,s=e.type.toLowerCase().replace("ms",""),n=Fe[s],r=He[e.pointerType]||e.pointerType,o=r==ke,a=y(t,e.pointerId,"pointerId");n&xe&&(0===e.button||o)?0>a&&(t.push(e),a=t.length-1):n&(Ce|Ie)&&(i=!0),0>a||(t[a]=e,this.callback(this.manager,n,{pointers:t,changedPointers:[e],pointerType:r,srcEvent:e}),i&&t.splice(a,1))}});var Ye={touchstart:xe,touchmove:_e,touchend:Ce,touchcancel:Ie},Ve="touchstart",je="touchstart touchmove touchend touchcancel";u(O,I,{handler:function(e){var t=Ye[e.type];if(t===xe&&(this.started=!0),this.started){var i=N.call(this,e,t);t&(Ce|Ie)&&i[0].length-i[1].length==0&&(this.started=!1),this.callback(this.manager,t,{pointers:i[0],changedPointers:i[1],pointerType:ke,srcEvent:e})}}});var qe={touchstart:xe,touchmove:_e,touchend:Ce,touchcancel:Ie},Ue="touchstart touchmove touchend touchcancel";u(z,I,{handler:function(e){var t=qe[e.type],i=F.call(this,e,t);i&&this.callback(this.manager,t,{pointers:i[0],changedPointers:i[1],pointerType:ke,srcEvent:e})}});var Ge=2500,Je=25;u(H,I,{handler:function(e,t,i){var s=i.pointerType==ke,n=i.pointerType==ye;if(!(n&&i.sourceCapabilities&&i.sourceCapabilities.firesTouchEvents)){if(s)W.call(this,t,i);else if(n&&Y.call(this,i))return;this.callback(e,t,i)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});var Ke=_(he.style,"touchAction"),Ze=Ke!==a,Qe="compute",et="auto",tt="manipulation",it="none",st="pan-x",nt="pan-y",rt=function(){if(!Ze)return!1;var e={},t=n.CSS&&n.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach((function(i){e[i]=!t||n.CSS.supports("touch-action",i)})),e}();V.prototype={set:function(e){e==Qe&&(e=this.compute()),Ze&&this.manager.element.style&&rt[e]&&(this.manager.element.style[Ke]=e),this.actions=e.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var e=[];return c(this.manager.recognizers,(function(t){v(t.options.enable,[t])&&(e=e.concat(t.getTouchAction()))})),function(e){if(w(e,it))return it;var t=w(e,st),i=w(e,nt);return t&&i?it:t||i?t?st:nt:w(e,tt)?tt:et}(e.join(" "))},preventDefaults:function(e){var t=e.srcEvent,i=e.offsetDirection;if(!this.manager.session.prevented){var s=this.actions,n=w(s,it)&&!rt[it],r=w(s,nt)&&!rt[nt],o=w(s,st)&&!rt[st];if(n){var a=1===e.pointers.length,l=e.distance<2,h=e.deltaTime<250;if(a&&l&&h)return}return o&&r?void 0:n||r&&i&Ee||o&&i&Me?this.preventSrc(t):void 0}t.preventDefault()},preventSrc:function(e){this.manager.session.prevented=!0,e.preventDefault()}};var ot=1,at=2,lt=4,ht=8,ct=ht,dt=16,ut=32;j.prototype={defaults:{},set:function(e){return ae(this.options,e),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(e){if(h(e,"recognizeWith",this))return this;var t=this.simultaneous;return t[(e=G(e,this)).id]||(t[e.id]=e,e.recognizeWith(this)),this},dropRecognizeWith:function(e){return h(e,"dropRecognizeWith",this)||(e=G(e,this),delete this.simultaneous[e.id]),this},requireFailure:function(e){if(h(e,"requireFailure",this))return this;var t=this.requireFail;return-1===y(t,e=G(e,this))&&(t.push(e),e.requireFailure(this)),this},dropRequireFailure:function(e){if(h(e,"dropRequireFailure",this))return this;e=G(e,this);var t=y(this.requireFail,e);return t>-1&&this.requireFail.splice(t,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(e){return!!this.simultaneous[e.id]},emit:function(e){function t(t){i.manager.emit(t,e)}var i=this,s=this.state;ht>s&&t(i.options.event+q(s)),t(i.options.event),e.additionalEvent&&t(e.additionalEvent),s>=ht&&t(i.options.event+q(s))},tryEmit:function(e){return this.canEmit()?this.emit(e):void(this.state=ut)},canEmit:function(){for(var e=0;e<this.requireFail.length;){if(!(this.requireFail[e].state&(ut|ot)))return!1;e++}return!0},recognize:function(e){var t=ae({},e);return v(this.options.enable,[this,t])?(this.state&(ct|dt|ut)&&(this.state=ot),this.state=this.process(t),void(this.state&(at|lt|ht|dt)&&this.tryEmit(t))):(this.reset(),void(this.state=ut))},process:function(e){},getTouchAction:function(){},reset:function(){}},u(J,j,{defaults:{pointers:1},attrTest:function(e){var t=this.options.pointers;return 0===t||e.pointers.length===t},process:function(e){var t=this.state,i=e.eventType,s=t&(at|lt),n=this.attrTest(e);return s&&(i&Ie||!n)?t|dt:s||n?i&Ce?t|ht:t&at?t|lt:at:ut}}),u(K,J,{defaults:{event:"pan",threshold:10,pointers:1,direction:Le},getTouchAction:function(){var e=this.options.direction,t=[];return e&Ee&&t.push(nt),e&Me&&t.push(st),t},directionTest:function(e){var t=this.options,i=!0,s=e.distance,n=e.direction,r=e.deltaX,o=e.deltaY;return n&t.direction||(t.direction&Ee?(n=0===r?Ae:0>r?Se:Te,i=r!=this.pX,s=Math.abs(e.deltaX)):(n=0===o?Ae:0>o?Be:De,i=o!=this.pY,s=Math.abs(e.deltaY))),e.direction=n,i&&s>t.threshold&&n&t.direction},attrTest:function(e){return J.prototype.attrTest.call(this,e)&&(this.state&at||!(this.state&at)&&this.directionTest(e))},emit:function(e){this.pX=e.deltaX,this.pY=e.deltaY;var t=U(e.direction);t&&(e.additionalEvent=this.options.event+t),this._super.emit.call(this,e)}}),u(Z,J,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[it]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.scale-1)>this.options.threshold||this.state&at)},emit:function(e){if(1!==e.scale){var t=e.scale<1?"in":"out";e.additionalEvent=this.options.event+t}this._super.emit.call(this,e)}}),u(Q,j,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[et]},process:function(e){var t=this.options,i=e.pointers.length===t.pointers,s=e.distance<t.threshold,n=e.deltaTime>t.time;if(this._input=e,!s||!i||e.eventType&(Ce|Ie)&&!n)this.reset();else if(e.eventType&xe)this.reset(),this._timer=l((function(){this.state=ct,this.tryEmit()}),t.time,this);else if(e.eventType&Ce)return ct;return ut},reset:function(){clearTimeout(this._timer)},emit:function(e){this.state===ct&&(e&&e.eventType&Ce?this.manager.emit(this.options.event+"up",e):(this._input.timeStamp=pe(),this.manager.emit(this.options.event,this._input)))}}),u(ee,J,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[it]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.rotation)>this.options.threshold||this.state&at)}}),u(te,J,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:Ee|Me,pointers:1},getTouchAction:function(){return K.prototype.getTouchAction.call(this)},attrTest:function(e){var t,i=this.options.direction;return i&(Ee|Me)?t=e.overallVelocity:i&Ee?t=e.overallVelocityX:i&Me&&(t=e.overallVelocityY),this._super.attrTest.call(this,e)&&i&e.offsetDirection&&e.distance>this.options.threshold&&e.maxPointers==this.options.pointers&&ue(t)>this.options.velocity&&e.eventType&Ce},emit:function(e){var t=U(e.offsetDirection);t&&this.manager.emit(this.options.event+t,e),this.manager.emit(this.options.event,e)}}),u(ie,j,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[tt]},process:function(e){var t=this.options,i=e.pointers.length===t.pointers,s=e.distance<t.threshold,n=e.deltaTime<t.time;if(this.reset(),e.eventType&xe&&0===this.count)return this.failTimeout();if(s&&n&&i){if(e.eventType!=Ce)return this.failTimeout();var r=!this.pTime||e.timeStamp-this.pTime<t.interval,o=!this.pCenter||M(this.pCenter,e.center)<t.posThreshold;if(this.pTime=e.timeStamp,this.pCenter=e.center,o&&r?this.count+=1:this.count=1,this._input=e,0==this.count%t.taps)return this.hasRequireFailures()?(this._timer=l((function(){this.state=ct,this.tryEmit()}),t.interval,this),at):ct}return ut},failTimeout:function(){return this._timer=l((function(){this.state=ut}),this.options.interval,this),ut},reset:function(){clearTimeout(this._timer)},emit:function(){this.state==ct&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}}),se.VERSION="2.0.8",se.defaults={domEvents:!1,touchAction:Qe,enable:!0,inputTarget:null,inputClass:null,preset:[[ee,{enable:!1}],[Z,{enable:!1},["rotate"]],[te,{direction:Ee}],[K,{direction:Ee},["swipe"]],[ie],[ie,{event:"doubletap",taps:2},["tap"]],[Q]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}},ne.prototype={set:function(e){return ae(this.options,e),e.touchAction&&this.touchAction.update(),e.inputTarget&&(this.input.destroy(),this.input.target=e.inputTarget,this.input.init()),this},stop:function(e){this.session.stopped=e?2:1},recognize:function(e){var t=this.session;if(!t.stopped){this.touchAction.preventDefaults(e);var i,s=this.recognizers,n=t.curRecognizer;(!n||n&&n.state&ct)&&(n=t.curRecognizer=null);for(var r=0;r<s.length;)i=s[r],2===t.stopped||n&&i!=n&&!i.canRecognizeWith(n)?i.reset():i.recognize(e),!n&&i.state&(at|lt|ht)&&(n=t.curRecognizer=i),r++}},get:function(e){if(e instanceof j)return e;for(var t=this.recognizers,i=0;i<t.length;i++)if(t[i].options.event==e)return t[i];return null},add:function(e){if(h(e,"add",this))return this;var t=this.get(e.options.event);return t&&this.remove(t),this.recognizers.push(e),e.manager=this,this.touchAction.update(),e},remove:function(e){if(h(e,"remove",this))return this;if(e=this.get(e)){var t=this.recognizers,i=y(t,e);-1!==i&&(t.splice(i,1),this.touchAction.update())}return this},on:function(e,t){if(e!==a&&t!==a){var i=this.handlers;return c(k(e),(function(e){i[e]=i[e]||[],i[e].push(t)})),this}},off:function(e,t){if(e!==a){var i=this.handlers;return c(k(e),(function(e){t?i[e]&&i[e].splice(y(i[e],t),1):delete i[e]})),this}},emit:function(e,t){this.options.domEvents&&oe(e,t);var i=this.handlers[e]&&this.handlers[e].slice();if(i&&i.length){t.type=e,t.preventDefault=function(){t.srcEvent.preventDefault()};for(var s=0;s<i.length;)i[s](t),s++}},destroy:function(){this.element&&re(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}},ae(se,{INPUT_START:xe,INPUT_MOVE:_e,INPUT_END:Ce,INPUT_CANCEL:Ie,STATE_POSSIBLE:ot,STATE_BEGAN:at,STATE_CHANGED:lt,STATE_ENDED:ht,STATE_RECOGNIZED:ct,STATE_CANCELLED:dt,STATE_FAILED:ut,DIRECTION_NONE:Ae,DIRECTION_LEFT:Se,DIRECTION_RIGHT:Te,DIRECTION_UP:Be,DIRECTION_DOWN:De,DIRECTION_HORIZONTAL:Ee,DIRECTION_VERTICAL:Me,DIRECTION_ALL:Le,Manager:ne,Input:I,TouchAction:V,TouchInput:z,MouseInput:P,PointerEventInput:R,TouchMouseInput:H,SingleTouchInput:O,Recognizer:j,AttrRecognizer:J,Tap:ie,Pan:K,Swipe:te,Pinch:Z,Rotate:ee,Press:Q,on:f,off:m,each:c,merge:ge,extend:ve,assign:ae,inherit:u,bindFn:p,prefixed:_}),(void 0!==n?n:"undefined"!=typeof self?self:{}).Hammer=se,void 0===(s=function(){return se}.call(t,i,t,e))||(e.exports=s)}(window,document)}}]);
//# sourceMappingURL=39.dc45aaf5abca8027.js.map