Files
Probability-and-Statistics-…/_static/420.e197c63136060d40.js
T
2026-04-02 07:47:45 -04:00

3 lines
98 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 420.e197c63136060d40.js.LICENSE.txt */
(self.webpackChunkWebComponents=self.webpackChunkWebComponents||[]).push([[420],{52420:(t,e,i)=>{"use strict";i.r(e),i.d(e,{default:()=>_});var s=i(78673);i(75794),i(56906),i(78811);class n{constructor(t){this.problem=t}inverseLISIndices(t){for(var e=[],i=0;i<t.length;i++){for(var s=[t[i]],n=t[i],r=-1,o=i;o<t.length;o++){var a=t[o];a>n&&r<a&&(s.push(a),r=a)}e.push(s)}var l,h=-1;for(let t in e){var c=e[t];c.length>h&&(h=c.length,l=c)}var d=[],u=0;for(let e=0;e<t.length;e++)u>l.length?d.push(e):t[e]==l[u]?u+=1:d.push(e);return d}grade(){var t=this.problem;t.clearFeedback(),this.correctLines=0,this.percentLines=0,this.incorrectIndents=0;var e,i=t.solution,s=t.answerLines();this.percentLines=Math.min(s.length,i.length)/Math.max(s.length,i.length),s.length<i.length?(e="incorrectTooShort",this.correctLength=!1):s.length==i.length?this.correctLength=!0:(e="incorrectMoveBlocks",this.correctLength=!1);let n=this.checkCorrectOrdering(i,s);return this.checkCorrectIndentation(i,s)&&n&&this.correctLength?e="correct":this.correctLength&&n?e="incorrectIndent":n||"incorrectTooShort"==e||(e="incorrectMoveBlocks"),this.calculatePercent(),this.graderState=e,e}checkCorrectIndentation(t,e){if(!this.problem.usesIndentation())return!0;this.indentLeft=[],this.indentRight=[];let i=Math.min(t.length,e.length);for(let s=0;s<i;s++)e[s].viewIndent()<t[s].indent?this.indentRight.push(e[s]):e[s].viewIndent()>t[s].indent&&this.indentLeft.push(e[s]);return this.incorrectIndents=this.indentLeft.length+this.indentRight.length,0==this.incorrectIndents}checkCorrectOrdering(t,e){let i=!0;this.correctLines=0,this.solutionLength=t.length;let s=Math.min(t.length,e.length);for(let n=0;n<s;n++)e[n].text!==t[n].text?i=!1:this.correctLines+=1;return i}calculatePercent(){let t=.2*this.percentLines,e=this.problem.answerLines().length,i=t+this.correctLines/e*.4+(this.correctLines-this.incorrectIndents)/e*.4;i=Math.max(i,0),this.problem.percent=i}}function r(t,{source:e,target:i}){try{!function(t,e,i){for(var[s,n,r]=function(t,e,i){if((s=e)===(n=i)||"object"==typeof s&&s.toString()===n.toString())return[new Map([[e,null]]),new Map([[i,null]]),e];var s,n,r,o;r=t.predecessorsIter.bind(t),o=t.successorsIter.bind(t);for(var a,l=new Map([[e,null]]),h=new Map([[i,null]]),c=[e],u=[i];c.length>0&&u.length>0;)if(c.length<=u.length){a=c,c=[];for(let t of a)for(let e of o(t))if(l.has(e)||(c.push(e),l.set(e,t)),h.has(e))return[l,h,e]}else{a=u,u=[];for(let t of a)for(let e of r(t))if(h.has(e)||(u.push(e),h.set(e,t)),l.has(e))return[l,h,e]}throw new d("No path between "+e.toString()+" and "+i.toString()+".")}(t,e,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)}(t,e,i)}catch(t){if(t instanceof d)return!1;throw t}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(t){this.succ.has(t)||(this.succ.set(t,new Map),this.pred.set(t,new Map),this.node.set(t))}addEdge(t,e){this.succ.has(t)||(this.succ.set(t,new Map),this.pred.set(t,new Map),this.node.set(t,{})),this.succ.has(e)||(this.succ.set(e,new Map),this.pred.set(e,new Map),this.node.set(e,{}));var i=this.adj.get(t).get(e)||{};this.succ.get(t).set(e,i),this.pred.get(e).set(t,i)}nodes(t=!1){return Array.from(t?this.node.entries():this.node.keys())}edges(t,e=!1){return Array.from(this.edgesIter(t,e))}nodesIter(t=!1){return t?toIterator(this.node):this.node.keys()}get(t){var e=this.adj.get(t);if(void 0===e)throw new KeyError("Graph does not contain node "+t+".");return e}numberOfNodes(){return this.node.size}*nbunchIter(t){if(null==t)yield*this.adj.keys();else if(this.hasNode(t))yield t;else{var e=this.adj;try{for(var i of toIterator(t))e.has(i)&&(yield i)}catch(t){if(t instanceof TypeError)throw new h("nbunch is not a node or a sequence of nodes")}}}*edgesIter(t,e=!1){var i;for(var s of((!0===(i=t)||!1===i||function(t){return!!t&&"object"==typeof t}(i)&&"[object Boolean]"==Object.prototype.toString.call(i))&&(e=t,t=void 0),void 0===t?this.adj:mapIterator(this.nbunchIter(t),(t=>tuple2(t,this.adj.get(t))))))for(var n of s[1]){var r=[s[0],n[0]];e&&(r[2]=n[1]),yield r}}reverse(t=!0){var e;if(t)(e=new this.constructor(null,{name:"Reverse of ("+this.name+")"})).addNodesFrom(this),e.addEdgesFrom(mapIterator(this.edgesIter(null,!0),(t=>tuple3c(t[1],t[0],deepcopy(t[2]),t)))),e.graph=deepcopy(this.graph),e.node=deepcopy(this.node);else{var i=this.pred,s=this.succ;this.succ=i,this.pred=s,this.adj=this.succ,e=this}return e}successorsIter(t){var e=this.succ.get(t);if(void 0!==e)return e.keys();throw new h(sprintf('The node "%j" is not in the digraph.',t))}predecessorsIter(t){var e=this.pred.get(t);if(void 0!==e)return e.keys();throw new h(sprintf('The node "%j" is not in the digraph.',t))}successors(t){return Array.from(this.successorsIter(t))}predecessors(t){return Array.from(this.predecessorsIter(t))}}class a{constructor(t){this.name="JSNetworkXException",this.message=t}}class l extends a{constructor(t){super(t),this.name="JSNetworkXAlgorithmError"}}class h extends a{constructor(t){super(t),this.name="JSNetworkXError"}}class c extends l{constructor(t){super(t),this.name="JSNetworkXUnfeasible"}}class d extends c{constructor(t){super(t),this.name="JSNetworkXNoPath"}}function u(t){var e=new o;for(let i of t){e.addNode(i.tag);for(let t of i.depends)e.addEdge(t,i.tag)}return e}function p(t,e){for(let i of t.edges())if(!e.has(i[0])&&!e.has(i[1]))return!1;return!0}class v extends n{inverseLISIndices(t,e){var i=this.problem.solution,s=e.map((t=>t.lines[0]));let n=u(i),a=new Set,l=new o;for(let t of s){for(let e of a)r(n,{source:t.tag,target:e.tag})&&l.addEdge(t.tag,e.tag);a.add(t)}let h=null,c=function(t){let e={};for(let i=0;i<=t.length;i++)e[i]=[];for(let i=0;i<Math.pow(2,t.length);i++){let s=i.toString(2);for(;s.length<t.length;)s="0"+s;let n=new Set;for(let e=0;e<s.length;e++)"1"==s[e]&&n.add(t[e]);e[n.size].push(n)}return e}(l.nodes());for(let t=0;t<=l.numberOfNodes();t++){for(let e of c[t])if(p(l,e)){h=e;break}if(null!=h)break}return[...h].map((t=>{for(let e=0;e<s.length;e++)if(s[e].tag===t)return e}))}checkCorrectIndentation(){if(!this.problem.usesIndentation())return!0;this.indentLeft=[],this.indentRight=[];for(const t of this.problem.blocks){if(t.isDistractor())continue;const e=t.indent,i=t.solutionIndent();e<i?this.indentRight.push(t.lines[0]):e>i&&this.indentLeft.push(t.lines[0])}return this.incorrectIndents=this.indentLeft.length+this.indentRight.length,0==this.incorrectIndents}checkCorrectOrdering(t,e){if(!function(t){try{return function(t,e){var i=new Set,s=[],n=new Set;null==e&&(e=t.nodesIter());for(let l of e){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=[];t.get(o).forEach((function(t,e){if(!n.has(e)){if(i.has(e))throw new c("Graph contains a cycle.");a.push(e)}})),a.length>0?r.push.apply(r,a):(n.add(o),s.unshift(o))}}}}(t),!0}catch(t){if(t instanceof c)return!1;throw t}}(u(t)))throw"Dependency between blocks does not form a Directed Acyclic Graph; Problem unsolvable.";let i=new Set,s=!0;this.correctLines=0,this.solutionLength=t.length;let n=Math.min(t.length,e.length);for(let t=0;t<n;t++){let n=e[t];if(n.distractor)s=!1;else for(let t=0;t<n.depends.length;t++)i.has(n.depends[t])||(s=!1);s&&(this.correctLines+=1),i.add(n.tag)}return s}}class g{constructor(t,e,i){this.problem=t,this.index=t.lines.length;var s,n=e.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 t=this.problem.lines;this.text.toLowerCase().startsWith("import")&&(this.indent=0),t.some((({text:t})=>t.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"==t.options.language||"math"==t.options.language?s=i?document.createElement("div"):document.createElement("p"):(s=document.createElement("code"),$(s).addClass(t.options.prettifyLanguage)),s.id=t.counterId+"-line-"+this.index,s.innerHTML+=this.text,this.view=s,t.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 t=document.createElement("canvas").getContext("2d"),e=window.getComputedStyle(this.view,null).getPropertyValue("font-family").split(", "),i="abcdefghijklmnopqrstuvwxyz0123456789,./!@#$%^&*-+";t.font=this.view.fontSize+" serif";var s=t.measureText(i).width;for(let n=0;n<e.length;n++)if(e[n].includes('"')&&(e[n]=e[n].replaceAll('"',"")),e[n].includes("'")&&(e[n]=e[n].replaceAll("'","")),t.font=this.view.fontSize+" "+e[n],t.measureText(i).width!==s){this.view.fontFamily=e[n];break}}block(){for(let i=0;i<this.problem.blocks.length;i++)for(var t=this.problem.blocks[i],e=0;e<t.lines.length;e++)if(t.lines[e]===this)return t}viewIndent(){if(this.problem.noindent)return this.indent;var t=this.block();return this.indent-t.solutionIndent()+t.indent}}var f=i(88210),m=i.n(f);class b{constructor(t,e){this.problem=t,this.lines=e,this.indent=0,this.labels=[];var i=document.createElement("div");i.id=t.counterId+"-block-"+t.blockIndex,t.blockIndex+=1,$(i).addClass("block");var s=e[0].indent;for(let t=1;t<e.length;t++)s=Math.min(s,e[t].indent);var n=document.createElement("div");$(n).addClass("lines"),$(i).append(n);for(let i=0;i<e.length;i++){var r,o=e[i];r=t.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(t){if($(t.view).removeClass("indent1 indent2 indent3 indent4 indent5 indent6"),this.problem.noindent)t.indent>0&&$(t.view).addClass("indent"+t.indent);else{var e=this.lines,i=e[0].indent;for(let t=1;t<e.length;t++)i=Math.min(i,e[t].indent);if(i<t.indent)$(t.view).addClass("indent"+(t.indent-i));else if(i>t.indent)for(let i=0;i<e.length;i++)$(e[i].view).removeClass("indent1 indent2 indent3 indent4 indent5 indent6"),"natural"!==this.problem.options.language&&"math"!==this.problem.options.language&&$(e[i].view).addClass("indent"+(e[i].indent-t.indent))}this.lines.push(t),$(this.view).children(".lines")[0].appendChild(t.view)}consumeBlock(t){for(let e=0;e<t.lines.length;e++)this.addLine(t.lines[e]);"0"==$(t.view).attr("tabindex")&&this.makeTabIndex(),$(t.view).detach();var e=[];for(let i=0;i<this.problem.blocks.length;i++)this.problem.blocks[i]!==t&&e.push(this.problem.blocks[i]);for(let e=0;e<t.labels.length;e++)this.addLabel(t.labels[e][0],this.lines.length-t.lines.length+t.labels[e][1]);this.problem.blocks=e,this.problem.state=void 0,this.problem.updateView()}addIndent(){for(let e=0;e<this.lines.length;e++){var t=this.lines[e];t.indent>0&&($(t.view).removeClass("indent1 indent2 indent3 indent4 indent5 indent6"),$(t.view).addClass("indent"+t.indent))}this.indent=0,$(this.view).css({"padding-left":"",width:this.problem.areaWidth-22})}addLabel(t,e){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(t)),$(this.view).children(".labels")[0].append(i),0!=this.labels.length&&$(i).css("margin-top",(e-this.labels[this.labels.length-1][1]-1)*this.lines[e].view.offsetHeight),this.labels.push([t,e])}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 t=this;this.hammer.on("panstart",(function(e){t.panStart(e)})),this.hammer.on("panend",(function(e){t.panEnd(e)})),this.hammer.on("panmove",(function(e){t.panMove(e)}))}enabled(){return void 0!==$(this.view).attr("tabindex")}isDistractor(){return this.lines[0].distractor}inSourceArea(){var t=this.problem.sourceArea.childNodes;for(let e=0;e<t.length;e++)if(t[e].id==this.view.id)return!0;return!1}pageXCenter(){var t=this.view.getBoundingClientRect();return window.pageXOffset+t.left+t.width/2}pageYCenter(){var t=this.view.getBoundingClientRect();return window.pageYOffset+t.top+t.height/2}minimumLineIndent(){var t=this.lines[0].indent;for(let e=1;e<this.lines.length;e++)t=Math.min(this.lines[e].indent,t);return t}slideUnderBlock(){var t=this.problem.sourceBlocks();if(0!=t.length){var e=this.pairedBin();if(-1==e)return t[t.length-1];for(let s=t.length-1;s>=0;s--){var i=t[s];if(i.pairedBin()==e)return i}return t[t.length-1]}}pairedBin(){for(var t=this.problem.pairedBins,e=0;e<t.length;e++)if(this.matchesBin(t[e]))return e;return-1}matchesBin(t){for(var e=0;e<this.lines.length;e++){var i=this.lines[e].index;if(-1==t.indexOf(i))return!1}return!0}validSourceIndexes(){var t,e,i=this.problem.sourceBlocks(),s=[],n=this.pairedBin();if(n>=0){for(t=0;t<i.length;t++){var r=i[t];if(r.view.id!==this.view.id){var o=r.pairedBin();(o==n||e==n)&&s.push(t),e=o}}if(e==n&&s.push(i.length),s.length>0)return s}for(t=0;t<i.length;t++){let n=i[t];if(n.view.id!==this.view.id){let i=n.pairedBin();(i!==e||-1==i)&&s.push(t),e=i}}return s.push(i.length),s}verticalOffset(){var t;return t=this.inSourceArea()?this.problem.sourceArea.getBoundingClientRect().top:this.problem.answerArea.getBoundingClientRect().top,this.view.getBoundingClientRect().top+this.view.getBoundingClientRect().bottom-2*t}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 t=this;$(this.view).focus((function(){t.newFocus()})),$(this.view).blur((function(){t.releaseFocus()})),$(this.view).keydown((function(e){t.keyDown(e)}))}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(t){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=t.srcEvent.pageX,this.problem.movingY=t.srcEvent.pageY,this.problem.updateView()}panEnd(t){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(t){this.problem.movingX=t.srcEvent.pageX,this.problem.movingY=t.srcEvent.pageY,this.problem.updateView()}keyDown(t){switch(null==this.problem.started&&(this.problem.started=!0,this.problem.logMove("kstart")),t.keyCode){case 37:this.problem.textMove?this.moveLeft():this.selectLeft();break;case 38:this.problem.textMove?this.moveUp():this.selectUp(),t.preventDefault();break;case 39:this.problem.textMove?this.moveRight():this.selectRight(),t.preventDefault();break;case 40:this.problem.textMove?this.moveDown():this.selectDown(),t.preventDefault();break;case 32:case 13:this.toggleMove(),t.preventDefault()}}moveLeft(){var t,e;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((t=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((e=i[t]).verticalOffset()>=s)break}this.problem.textMoving=!0,this.problem.sourceArea.insertBefore(this.view,e.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 t=this.verticalOffset(),e=this.validSourceIndexes();for(let r=0;r<e.length;r++){var i=e[e.length-1-r];if(i<n.length){var s=n[i];if(s.verticalOffset()<t)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 t=this.problem.answerBlocks();for(let e=0;e<t.length;e++)if(t[e].view.id==this.view.id){if(0==e)return this;this.problem.textMoving=!0,this.problem.answerArea.insertBefore(this.view,t[e-1].view),$(this.view).focus(),this.problem.state=void 0,this.problem.updateView()}}}moveRight(){if(this.inSourceArea()){this.indent=0;for(var t=this.verticalOffset(),e=this.problem.answerBlocks(),i=0;i<e.length;i++){var s=e[i];if(s.verticalOffset()>=t)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 t=this.validSourceIndexes();for(let t=0;t<s.length;t++)if(s[t].view.id==this.view.id)var e=t;for(let n=0;n<t.length;n++){var i=t[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-e>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 t=this.problem.answerBlocks();for(var s=0;s<t.length;s++)if(t[s].view.id==this.view.id){if(s==t.length-1)return this;s==t.length-2?(this.problem.textMoving=!0,this.problem.answerArea.appendChild(this.view)):(this.problem.textMoving=!0,this.problem.answerArea.insertBefore(this.view,t[s+2].view)),$(this.view).focus(),this.problem.state=void 0,this.problem.updateView()}}}selectLeft(){if(!this.inSourceArea()){var t=this.verticalOffset(),e=this.problem.enabledSourceBlocks();if(0==e.length)return this;for(var i=e[0],s=i.verticalOffset()-t,n=1;n<e.length;n++){var r=e[n],o=r.verticalOffset()-t;Math.abs(o)<Math.abs(s)&&(i=r,s=o)}this.problem.textFocus=i,i.makeTabIndex(),$(i.view).focus()}}selectUp(){for(var t,e=!1,i=(t=this.inSourceArea()?this.problem.enabledSourceBlocks():this.problem.enabledAnswerBlocks()).length-1;i>=0;i--){var s=t[i];if(e)return this.problem.textFocus=s,s.makeTabIndex(),$(s.view).focus(),this;s.view.id==this.view.id&&(e=!0)}}selectRight(){if(this.inSourceArea()){var t=this.verticalOffset(),e=this.problem.enabledAnswerBlocks();if(0==e.length)return this;for(var i=e[0],s=i.verticalOffset()-t,n=1;n<e.length;n++){var r=e[n],o=r.verticalOffset()-t;Math.abs(o)<Math.abs(s)&&(i=r,s=o)}this.problem.textFocus=i,i.makeTabIndex(),$(i.view).focus()}}selectDown(){var t,e=!1;t=this.inSourceArea()?this.problem.enabledSourceBlocks():this.problem.enabledAnswerBlocks();for(var i=0;i<t.length;i++){var s=t[i];if(e)return this.problem.textFocus=s,s.makeTabIndex(),$(s.view).focus(),this;s.view.id==this.view.id&&(e=!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 t="",e=0;e<this.lines.length;e++)t+=this.lines[e].index+"_";return t+this.indent}solutionIndent(){for(var t=this.lines[0].indent,e=1;e<this.lines.length;e++)t=Math.min(t,this.lines[e].indent);return t}}class w extends b{constructor(t,e,i,s){super(t,e),this.placeholderLines=e,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(t){super(t,"placeholder",!1),this.isPlaceholderLine=!0}}class y extends b{constructor(t,e){super(t,e),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(t){this.blocksBefore=t;var e=t>1?"s":"";if(this.blocksAfter){var i=this.blocksAfter>1?"s":"";$(this.view).find(".settled-tooltip").html(`${t} block${e} ⬆️), ${this.blocksAfter} block${i} ⬇️`)}else $(this.view).find(".settled-tooltip").html(`${t} block${e} ⬆️`)}setBlocksAfter(t){this.blocksAfter=t;var e=t>1?"s":"";if(this.blocksBefore){var i=this.blocksBefore>1?"s":"";$(this.view).find(".settled-tooltip").html(`${this.blocksBefore} block${i} ⬆️, ${t} block${e} ⬇️`)}else $(this.view).find(".settled-tooltip").html(`${t} block${e} ️⬇️`)}}class x extends s.A{constructor(t){super(t);var e=t.orig;this.containerDiv=e,this.origElem=$(e).find("pre.parsonsblocks")[0],this.question=$(e).find(".parsons_question")[0],this.useRunestoneServices=t.useRunestoneServices,this.divid=t.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 t={pixelsPerIndent:30},e=$(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(t.numbered=r,t.grader=o,t.scaffolding=a,void 0!==e&&(t.maxdist=e),void 0!==i){i=i.match(/\d+/g);for(var l=0;l<i.length;l++)i[l]=parseInt(i[l]);t.order=i}null==s&&(s=!1),t.noindent=s,this.noindent=s,null==n?n=!1:n&&this.initializeAdaptive(),t.adaptive=n;var h=eBookConfig.locale;null==h&&(h="en"),t.locale=h;var c=$(this.origElem).data("language");null==c&&null==(c=eBookConfig.language)&&(c="python"),t.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=""),t.prettifyLanguage=d,t.runnable=$(this.origElem).data("runnable");var u=$(this.origElem).attr("data-explanations");if(u)try{this.blockExplanations=JSON.parse(u)}catch(t){this.blockExplanations={}}else this.blockExplanations={};this.options=t}initializeView(){this.outerDiv=document.createElement("div"),$(this.outerDiv).addClass("parsons"),this.outerDiv.id=this.counterId;let t=this.containerDiv.querySelector(".parsons-text");t&&!t.classList.contains("exercise-statement")&&t.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 e=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(t){t.preventDefault(),e.checkCurrentAnswer(),e.logCurrentAnswer(),e.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(t){t.preventDefault(),e.clearFeedback(),$(e.checkButton).prop("disabled",!1),e.resetView(),e.checkCount=0,e.logMove("reset"),e.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(t){t.preventDefault(),e.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(t){this.lines=[];var e=t.split("---");1===e.length&&(e=t.split("\n"));var i=[],s=[];if(!0===this.options.scaffolding){for(var n=!1,r=0;r<e.length;r++){var o=e[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:.*;.*;/,(t=>t.replace(/\s+/g,"")))).indexOf("#tag:"),""==(y=o.substring(w+5,o.indexOf(";",w+5)))&&(y="block-"+r),x=o.indexOf(";depends:");let t=o.substring(x+9,o.indexOf(";",x+9));h=t.length>0?t.split(","):[]}if(o.includes('class="displaymath')?a.displaymath=!0:a.displaymath=!1,o=o.replace(/#(paired|distractor|settled|tag:.*;.*;)/,(function(t,e){return a[e]=!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 t=null,e=null;for(let i=0;i<this.lines.length;i++){const s=this.lines[i].text;if(null===t&&(s.includes("public class")||s.startsWith("import"))&&(t=this.lines[i].indent),null===e&&s.includes("public static")&&(e=this.lines[i].indent),null!==t&&null!==e)break}if(0===t&&8===e){s=s.sort((function(t,e){return t-e}));for(let t=0;t<this.lines.length;t++){let e=this.lines[t],i=e.indent,n=s.indexOf(i);n>0&&(n-=1),e.indent=n}}else{s=s.sort((function(t,e){return t-e}));for(let t=0;t<this.lines.length;t++){let e=this.lines[t];e.indent=s.indexOf(e.indent)}}}else{s=s.sort((function(t,e){return t-e}));for(let t=0;t<this.lines.length;t++){let e=this.lines[t];e.indent=s.indexOf(e.indent)}}this.solution=i}else{for(r=0;r<e.length;r++){var b,w,y,x;if(o=e[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:.*;.*;/,(t=>t.replace(/\s+/g,"")))).indexOf("#tag:"),""==(y=o.substring(w+5,o.indexOf(";",w+5)))&&(y="block-"+r),x=o.indexOf(";depends:");let t=o.substring(x+9,o.indexOf(";",x+9));h=t.length>0?t.split(","):[]}if(o.includes('class="displaymath')?a.displaymath=!0:a.displaymath=!1,o=o.replace(/\s*#(paired|distractor|tag:.*;.*;)\s*/g,(function(t,e){return a[e]=!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(t,e){return t-e})),r=0;r<this.lines.length;r++)(m=this.lines[r]).indent=s.indexOf(m.indent);this.solution=i}}async initializeAreas(t,e,i){var s,n,r=[];for(s=0;s<t.length;s++)n=t[s],r.push(n),this.sourceArea.appendChild(n.view);for(s=0;s<e.length;s++)n=e[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 t=this.containerDiv.querySelectorAll("code");for(const e of t)e.classList.add(`language-${c}`);Prism.highlightAllUnder(this.containerDiv)}for(let t=0;t<this.lines.length;t++)this.lines[t].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(t){"natural"!=this.options.language&&"math"!=this.options.language||("undefined"!=typeof runestoneMathReady?await runestoneMathReady.then((async()=>await f.queueMathJax(t[0]))):void 0!==MathJax.startup&&await f.queueMathJax(t[0])),u=Math.max(u,t.outerWidth(!0)),t.width(u-22);var e=3.8;let i=t.outerHeight(!0);38!=i&&(e=3.1*(i-38)/21),p+=i+g*e}.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(t.concat(e)),this.state=void 0,this.updateView(),h&&$(l).replaceWith(this.outerDiv)}initializeInteractivity(){for(var t=0;t<this.blocks.length;t++)this.blocks[t].initializeInteractivity();this.initializeTabIndex();"natural"!=this.options.language&&"math"!=this.options.language||void 0!==MathJax.startup&&this.queueMathJax(this.outerDiv)}initializeTabIndex(){for(var t=0;t<this.blocks.length;t++){var e=this.blocks[t];if(e.enabled())return e.makeTabIndex(),this}}newerData(t,e){var i=t.timestamp,s=e.timestamp;return null==i?e:null==s||(i=this.dateFromTimestamp(i))>(s=this.dateFromTimestamp(s))?t:e}async loadData(t){try{if(!0===this.options.scaffolding){null==(i=t.source)&&(i=t.trash);var e=t.answer;void 0!==(n=null==(s=t.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)}else{var i,s,n;null==(i=t.source)&&(i=t.trash),e=t.answer,void 0!==(n=null==(s=t.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==e||1==e.length?await this.initializeAreas(this.blocksFromSource(),[],n):(this.initializeAreas(this.blocksFromHash(i),this.blocksFromHash(e),n),this.grade=this.grader.grade(),"correct"==this.grade?this.correct=!0:0==this.answerLines().length?this.correct=null:this.correct=!1)}}catch(e){await this.initializeAreas(this.blocksFromSource(),[],n),console.log(`Error restoring answer for student ${t.sid} in ${t.div_id}. Defaulting to original state.`)}!0!==this.needsReinitialization&&(this.initializeInteractivity(),this.isTimed&&!this.assessmentTaken&&this.resetView())}localData(){var t=localStorage.getItem(this.storageId);return null!==t&&"{"==t.charAt(0)?JSON.parse(t):{}}restoreAnswers(t){this.loadData(t)}checkLocalStorage(){if(this.graderactive)return;const t=this.localData();t.timestamp&&t.timestamp<eBookConfig.termStartDate&&(localStorage.removeItem(this.storageId),t={}),this.loadData(t)}setLocalStorage(t){var e;if(null==t){e={source:this.sourceHash(),answer:this.answerHash(),timestamp:new Date};var i=this.adaptiveHash();i.length>0&&(e.adaptive=i)}else e=t;localStorage.setItem(this.storageId,JSON.stringify(e))}async updatePlaceholders(){setTimeout((()=>{var t,e,i,s=this.answerBlocks();for(t=0;t<s.length;++t)if(s[t].isPlaceholder&&(i=s[t],e=!1,t>0&&!s[t-1].isSettled&&!s[t-1].isPlaceholder&&(e=!0),t<s.length-1&&!s[t+1].isSettled&&!s[t+1].isPlaceholder&&(e=!0),e&&!$(i.view).hasClass("hide"))){$(i.view).addClass("hide");for(var n=0;n<s.length-1-t;n++)i.moveDown()}}),5),setTimeout((()=>{for(var t=this.answerBlocks(),e=0;e<t.length&&!$(t[e].view).hasClass("hide");)e++;var i=!0;this.firstBlockSettled&&(i=!1);var s,n,r=0;for(s=0;s<e&&(!t[s].isSettled||!i);++s)t[s].isSettled?(i=!0,r++):i=!1;if(s<e||t[e-1]&&t[e-1].isSettled&&!this.lastBlockSettled){var o;for(o=t.length-1;o>=e;o--)if(t[o].afterSettledBlockCount==r){n=t[o];break}if(t[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(t){var e={event:"parsonsMove",div_id:this.divid,storageid:super.localStorageKey()},i=t+"|"+this.sourceHash()+"|"+this.answerHash(),s=this.adaptiveHash();""!==s&&(i=i+"|"+s),e.act=i,this.logBookEvent(e)}async logCurrentAnswer(t){var e={event:"parsons",div_id:this.divid},i=this.answerHash();e.answer=i;var s=this.sourceHash();e.source=s;var n=s+"|"+i,r=this.adaptiveHash();""!==r&&(e.adaptive=r,n=n+"|"+r),"correct"==this.grade?(n="correct|"+n,e.correct="T"):(n="incorrect|"+n,e.correct="F"),e.act=n,void 0!==t&&(e.sid=t),await this.logBookEvent(e)}adaptiveHash(){if(!this.options.adaptive)return"";for(var t=[],e=0;e<this.blocks.length;e++){var i=this.blocks[e];i.enabled()||t.push("d"+i.lines[0].index)}return this.noindent!==this.options.noindent&&t.push("i"),t.push("c"+this.checkCount),this.hasSolved&&t.push("s"),t.join("-")}optionsFromHash(t){var e;e="-"===t||""===t||null===t?[]:t.split("-");for(var i={},s=[],n=0;n<e.length;n++){var r=e[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 t=[],e=this.answerBlocks(),i=0;i<e.length;i++)t.push(e[i].hash());return 0===t.length?"-":t.join("-")}sourceHash(){for(var t=[],e=this.sourceBlocks(),i=0;i<e.length;i++)t.push(e[i].hash());return 0===t.length?"-":t.join("-")}adaptBlocks(t){for(var e,i=[],s=[],n=0;n<t.length;n++)(e=t[n]).isDistractor()?s.push(e):i.push(e);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<t.length;n++)(e=t[n]).isDistractor()?-1==$.inArray(e,s)&&c.push(e):c.push(e);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 t=0;t<a;t++){var p=-10,v=-10;for(u=0;u<d.length-1;u++){e=d[u];var g=d[u+1],f=10-e.lines.length-g.lines.length,m=e.minimumLineIndent(),b=g.minimumLineIndent();m==b?f+=2:m>b&&(f-=1),e.lines[e.lines.length-1].indent==g.lines[0].indent&&(f+=1),f>=p&&(p=f,v=u)}for(e=d[v],g=d[v+1],u=0;u<g.lines.length;u++)e.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 t,e,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=[]));t=n;var a=[];if(void 0!==this.options.maxdist){var l=this.options.maxdist,h=[];for(s=0;s<n.length;s++)(e=n[s]).lines[0].distractor&&h.push(e);if(l<h.length){for(h=(h=this.shuffled(h)).slice(0,l),s=0;s<n.length;s++)(e=n[s]).lines[0].distractor?$.inArray(e,h)>-1?r.push(e):a.push(s):r.push(e);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++)(e=n[s]).lines[0].paired&&this.pairDistractors?d.push(e):((d=[]).push(e),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!==(e=t[this.options.order[s]])&&$.inArray(this.options.order[s],a)<0&&r.push(e);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,t[a[s]])}if(this.pairDistractors&&null!=this.options.order)for(s=1;s<t.length;s++)if(t[s].lines[0].paired&&$.inArray(t[s],r)>=0){for(var p=s;$.inArray(t[p-1],r)<0;)p--;var v=$.inArray(t[p-1],r),g=$.inArray(t[s],r);r.splice(g,1),r.splice(v,0,t[s])}return r}blockFromHash(t){for(var e=t.split("_"),i=[],s=0;s<e.length-1;s++)i.push(this.lines[e[s]]);var n=new b(this,i);return this.noindent?n.indent=0:n.indent=Number(e[e.length-1]),n}blocksFromHash(t){var e;e="-"===t||""===t||null===t?[]:t.split("-");for(var i=[],s=0;s<e.length;s++)i.push(this.blockFromHash(e[s]));return this.options.adaptive?this.adaptBlocks(i):i}settledBlocksFromSource(){var t,e,i=[],s=[],n=0,r=0,o=void 0,a=0;for(e=0;e<this.lines.length;e++)if(t=this.lines[e],s.push(t),!t.groupWithNext)if(t.isPlaceholderLine)i.push(new w(this,s,n,r)),o&&o.setBlocksAfter(n),a=n,n=0,s=[];else if(t.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(t){for(var e=0;e<this.blocks.length;e++){var i=this.blocks[e];if(i.view.id==t)return i}}solutionBlocks(){for(var t=[],e=[],i=0;i<this.lines.length;i++)this.lines[i].distractor||e.push(this.lines[i]);var s=e[0].block();t.push(s);for(let i=1;i<e.length;i++){var n=e[i].block();s!==n&&(s=n,t.push(s))}return t}sourceBlocks(){for(var t=[],e=this.sourceArea.childNodes,i=0;i<e.length;i++){var s=e[i];$(s).hasClass("block")&&t.push(this.getBlockById(s.id))}return t}enabledSourceBlocks(){for(var t=this.sourceBlocks(),e=[],i=0;i<t.length;i++){var s=t[i];s.enabled()&&e.push(s)}return e}answerBlocks(){for(var t=[],e=this.answerArea.childNodes,i=0;i<e.length;i++){var s=this.getBlockById(e[i].id);void 0!==s&&t.push(s)}return t}enabledAnswerBlocks(){for(var t=this.answerBlocks(),e=[],i=0;i<t.length;i++){var s=t[i];s.enabled()&&e.push(s)}return e}answerLines(){for(var t=[],e=this.answerBlocks(),i=0;i<e.length;i++){var s=e[i];if(!s.isPlaceholder)for(var n=0;n<s.lines.length;n++)t.push(s.lines[n])}return t}getBlockFor(t){for(var e=t;!e.classList.contains("block");)e=e.parentElement;return e}solutionIndent(){for(var t=0,e=0;e<this.blocks.length;e++){var i=this.blocks[e];t=Math.max(t,i.solutionIndent())}return t}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 t=document.querySelector(`#copy-answer-button-${this.divid}`);t&&t.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 t=this.answerHash();this.lastAnswerHash!==t&&(this.numDistinct++,this.lastAnswerHash=t),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 t="";for(let e of this.answerBlocks())for(let i of e.lines)t+=" ".repeat(i.indent)+i.text+"\n";t=t.slice(0,-1);const e=this.runnableDiv.querySelector("textarea");e.innerHTML=e.innerHTML.replace("==PARSONSCODE==",t),this.runnableDiv.querySelector('[data-component="parsons-runnable"]').dataset.component="activecode",window.runestoneComponents.renderOneComponent(this.runnableDiv)}renderFeedback(){var t;this.grader.showfeedback=!0,this.grade=this.grader.graderState;var e=$(this.answerArea);if(t=!0===this.showfeedback?$(this.messageDiv):$("#doesnotexist"),"correct"===this.grade){e.addClass("correct"),this.messageDiv.style.visibility="visible",t.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((()=>{t.html(i)}),10),this.showBlockExplanations()}if("incorrectTooShort"===this.grade&&(e.addClass("incorrect"),this.messageDiv.style.visibility="visible",t.attr("class","alert alert-danger"),setTimeout((()=>{t.html($.i18n("msg_parson_too_short"))}),10)),"incorrectIndent"===this.grade){var i=[];for(let t=0;t<this.grader.indentLeft.length;t++)a=this.grader.indentLeft[t].block(),-1==i.indexOf(a)&&(i.push(a),$(a.view).addClass("indentLeft"));for(let t=0;t<this.grader.indentRight.length;t++)a=this.grader.indentRight[t].block(),-1==i.indexOf(a)&&(i.push(a),$(a.view).addClass("indentRight"));this.messageDiv.style.visibility="visible",t.attr("class","alert alert-danger"),setTimeout((()=>{1==i.length?t.html($.i18n("msg_parson_wrong_indent")):t.html($.i18n("msg_parson_wrong_indents"))}),10)}if("incorrectMoveBlocks"===this.grade){var s=this.answerBlocks(),n=[],r=[],o=[];for(let t=0;t<s.length;t++){var a=s[t],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 t=0;t<h.length;t++)o.push(n[h[t]]);if(e.addClass("incorrect"),this.messageDiv.style.visibility="visible",t.attr("class","alert alert-danger"),!0===this.showfeedback)for(let t=0;t<o.length;t++)$(o[t].view).addClass("incorrectPosition");setTimeout((()=>{t.html($.i18n("msg_parson_wrong_order"))}),10)}}showBlockExplanations(){if(this.blockExplanations&&0!==Object.keys(this.blockExplanations).length){this.hideBlockExplanations();for(var t=this.answerBlocks(),e=0;e<t.length;e++){var i=t[e],s=i.lines[0].index,n=this.blockExplanations[String(s)];n||(n=this.blockExplanations[String(e)]),n&&(i.view.setAttribute("data-toggle","tooltip"),i.view.setAttribute("title",n),$(i.view).addClass("has-explanation"))}}}hideBlockExplanations(){var t=$(this.answerArea).find(".has-explanation");t.each((function(){this.removeAttribute("data-toggle"),this.removeAttribute("title"),this.removeAttribute("data-original-title")})),t.removeClass("has-explanation")}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 t=localStorage.getItem(this.adaptiveId+this.divid+"Count");null!=t&&"NaN"!=t||(t=0),this.checkCount=t,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 t,e=this.enabledAnswerBlocks();for(let i=0;i<e.length;i++)if((t=e[i]).isDistractor())return t;e=this.enabledSourceBlocks();for(let i=0;i<e.length;i++)if((t=e[i]).isDistractor())return t}numberOfBlocks(t=!0){for(var e=0,i=0;i<this.blocks.length;i++)!this.blocks[i].enabled()||!t&&this.blocks[i].isDistractor()||(e+=1);return e}removeDistractor(t){var e=$(this.messageDiv);if(this.messageDiv.style.visibility="visible",e.attr("class","alert alert-info"),setTimeout((()=>{e.html($.i18n("msg_parson_not_solution"))}),10),t.lines[0].distractHelptext&&(t.view.setAttribute("data-toggle","tooltip"),t.view.setAttribute("title",t.lines[0].distractHelptext)),t.disable(),t.inSourceArea())$(t.view).css({"border-color":"#000","background-color":"#fff"}),$(t.view).animate({opacity:.3,"border-color":"#d3d3d3","background-color":"#efefef"},{duration:2e3,complete:function(){$(t.view).css({"border-color":"","background-color":""})}});else{var i=this.sourceArea.getBoundingClientRect(),s=t.pageXCenter()-1,n=t.pageYCenter(),r=i.left+window.pageXOffset+i.width/2,o=i.top+window.pageYOffset+t.view.getBoundingClientRect().height/2,a=t.slideUnderBlock();void 0!==a&&(o+=a.view.getBoundingClientRect().height+20,o+=parseInt($(a.view).css("top")));var l=this;$(t.view).css({"border-color":"#000","background-color":"#fff"}),$(t.view).animate({opacity:1},{duration:4*Math.sqrt(Math.pow(o-n,2)+Math.pow(r-s,2))+500,start:function(){l.moving=t,l.movingX=s,l.movingY=n,l.updateView()},progress:function(t,e,i){l.movingX=s*(1-e)+r*e,l.movingY=n*(1-e)+o*e,l.updateView()},complete:function(){delete l.moving,delete l.movingX,delete l.movingY,l.updateView(),$(t.view).animate({opacity:.3,"border-color":"#d3d3d3","background-color":"#efefef"},{duration:1e3,complete:function(){$(t.view).css({opacity:"","border-color":"","background-color":""}),$(t.view).addClass("disabled")}})}})}}removeIndentation(){var t=$(this.messageDiv);this.messageDiv.style.visibility="visible",t.attr("class","alert alert-info"),setTimeout((()=>{t.html($.i18n("msg_parson_provided_indent"))}),10);for(var e,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 t=0;t<a.length;t++)0==(i=(e=a[t]).solutionIndent())?$(e.view).animate({width:s},{duration:1e3}):$(e.view).animate({width:s-i*this.options.pixelsPerIndent,"padding-left":i*this.options.pixelsPerIndent+10},{duration:1e3});for(let t=0;t<this.pairedDivs.length;t++)$(this.pairedDivs[t]).animate({width:s+34},{duration:1e3});var l=this.answerBlocks();for(let t=0;t<l.length;t++)0==(i=(e=l[t]).solutionIndent())?$(e.view).animate({left:0,width:s},{duration:1e3}):$(e.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 t=0;t<a.length;t++)a[t].addIndent();for(let t=0;t<l.length;t++)l[t].addIndent()}})}getSolutionBlockInSource(){for(var t=this.solutionBlocks(),e=this.answerBlocks(),i=this.sourceBlocks(),s=null,n=0;n<i.length;n++)if(s=i[n],t.indexOf(s)>0&&e.indexOf(s)<0)return s;return null}getFurthestBlock(){for(var t=this.solutionBlocks(),e=this.answerBlocks(),i=0,s=0,n=null,r=null,o=0,a=null,l=0,h=0;h<e.length;h++)r=e[h],(o=t.indexOf(r))>0&&(a=t[o-1],l=e.indexOf(a),(s=Math.abs(h-l))>i&&(i=s,n=r));return n}combineBlocks(){var t=this.solutionBlocks(),e=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=t.indexOf(r);n=t[o-1];var a=e.indexOf(n),l=e.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(t,e,i){g.movingX=d*(1-e)+p*e,g.movingY=u*(1-e)+v*e,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 t=this.distractorToRemove();void 0===t||t.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(t),this.logMove("removedDistractor-"+t.hash()))}helpMe(){this.clearFeedback(),this.numDistinct<3?alert($.i18n("msg_parson_atleast_three_attempts")):(this.gotHelp=!0,this.makeEasier())}dateFromTimestamp(t){var e=new Date(t);if(isNaN(e.getTime())){var i=t.split(/[- :]/);e=new Date(i[0],i[1]-1,i[2],i[3],i[4],i[5])}return e}shuffled(t){for(var e,i,s=t.length,n=t.slice();0!==s;)i=Math.floor(Math.random()*s),e=n[s-=1],n[s]=n[i],n[i]=e;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 t=this.answerArea.childNodes,e=0;e<t.length;e++)$(t[e]).removeClass("correctPosition incorrectPosition indentLeft indentRight");this.messageDiv.style.visibility="hidden",this.hideBlockExplanations()}async disableInteraction(){if(await this.checkServerComplete,console.log("disabling blocks"),void 0!==this.blocks)for(var t=0;t<this.blocks.length;t++)this.blocks[t].disable();$(this.checkButton).hide(),$(this.resetButton).hide()}movingState(){if(null==this.moving)return"rest";var t=this.movingX-window.pageXOffset,e=this.movingY-window.pageYOffset,i=this.answerArea.getBoundingClientRect();return t>=i.left&&t<=i.right&&e>=i.top&&e<=i.bottom?"answer":t>=(i=this.sourceArea.getBoundingClientRect()).left&&t<=i.right&&e>=i.top&&e<=i.bottom?"source":"moving"}updateView(){var t,e,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&&(t=$(this.moving.view).outerHeight(!0),$(this.moving.view).detach());var l,h,c=this.areaWidth-22;if(r){e=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-e<t+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-t/2,width:c,"z-index":3}),e+=t)}$(w.view).css({left:0,top:e,width:c,"z-index":2}),e+=$(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:e,width:c,"z-index":2}),e+=$(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(e=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-e<(t+$(l.view).outerHeight(!0))/2&&(u=!0,this.answerArea.insertBefore(this.moving.view,l.view),$(this.moving.view).css({left:f,top:m-t/2,width:c,"z-index":3}),e+=t),h=l.indent*this.options.pixelsPerIndent,$(l.view).css({left:h,top:e,width:i-h,"z-index":2}),e+=$(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 t=0;t<d.length;t++)h=(l=d[t]).indent*this.options.pixelsPerIndent,$(l.view).css({left:h,top:e,width:i-h,"z-index":2}),e+=$(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-t/2,width:c,"z-index":3})}s=n,this.state=s}addBlockLabels(t){var e=-1,i=0,s=0,n=0;for(let e=0;e<t.length;e++)-1==t[e].pairedBin()&&n++;for(let a=0;a<t.length;a++){var r=t[a].pairedBin();-1!=r&&r==e||(e=r,s=0,i++);var o=""+i+(-1!=r?String.fromCharCode(97+s):" ");i<10&&n+this.pairedBins.length>=10&&(o+=" "),t[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 t=document.querySelector(`#copy-answer-button-${this.divid}`);t&&t.classList.add("copy-button-hide")}var t,e=document.body.scrollTop;for(let e=0;e<this.blocks.length;e++){t=this.blocks[e];for(var i=0;i<t.lines.length;i++)for(var s=$(t.lines[i].view).find(".block-label"),n=0;n<s.length;n++)s[n].remove();t.destroy(),$(this.blocks[e].view).detach()}if(delete this.blocks,this.blockIndex=0,this.pairedDivs)for(let t=0;t<this.pairedDivs.length;t++)$(this.pairedDivs[t]).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=e,this.runnableDiv&&(this.runnableDiv.style.display="none")}}x.counter=0,$(document).on("runestone:login-complete",(function(){$("[data-component=parsons]").each((function(t){if(0==$(this).closest("[data-component=timedAssessment]").length)try{window.componentMap[this.id]=new x({orig:this,useRunestoneServices:eBookConfig.useRunestoneServices})}catch(t){console.log(`Error rendering Parsons Problem ${this.id}\n Details: ${t}`),console.log(t.stack)}}))}));class _ extends x{constructor(t){super(t),t.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(t){return t.timed?new _(t):new x(t)}},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 t(){var e=navigator&&navigator.userAgent&&/\bMSIE 6\./.test(navigator.userAgent);return t=function(){return e},e}!function(){var e="break continue do else for if return while ",i=e+"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=e+"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=e+"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=e+"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(t){return t>="a"&&t<="z"||t>="A"&&t<="Z"}function u(t,e,i,s){t.unshift(i,s||0);try{e.splice.apply(e,t)}finally{t.splice(0,2)}}var p=function(){for(var t=["!","!=","!==","#","%","%=","&","&&","&&=","&=","(","*","*=","+=",",","-=","->","/","/=",":","::",";","<","<<","<<=","<=","=","==","===",">",">=",">>",">>=",">>>",">>>=","?","@","[","^","^=","^^","^^=","{","|","|=","||","||=","~","break","case","continue","delete","do","else","finally","instanceof","return","throw","try","typeof"],e="(?:(?:(?:^|[^0-9.])\\.{1,3})|(?:(?:^|[^\\+])\\+)|(?:(?:^|[^\\-])-)",i=0;i<t.length;++i){var s=t[i];e+=d(s.charAt(0))?"|\\b"+s:"|"+s.replace(/([^=<>:&])/g,"\\$1")}return e+="|^)\\s*$",new RegExp(e)}(),v=/&/g,g=/</g,f=/>/g,m=/\"/g;function b(t){return t.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(t){var e=t.indexOf("&");if(e<0)return t;for(--e;(e=t.indexOf("&#",e+1))>=0;){var i=t.indexOf(";",e);if(i>=0){var s=t.substring(e+3,i),n=10;s&&"x"===s.charAt(0)&&(s=s.substring(1),n=16);var r=parseInt(s,n);isNaN(r)||(t=t.substring(0,e)+String.fromCharCode(r)+t.substring(i+1))}}return t.replace(w,"<").replace(k,">").replace(y,"'").replace($,'"').replace(x,"&").replace(_," ")}function I(t){return"XMP"===t.tagName}function A(t,e){switch(t.nodeType){case 1:var i=t.tagName.toLowerCase();e.push("<",i);for(var s=0;s<t.attributes.length;++s){var n=t.attributes[s];n.specified&&(e.push(" "),A(n,e))}e.push(">");for(var r=t.firstChild;r;r=r.nextSibling)A(r,e);!t.firstChild&&/^(?:br|link|img)$/.test(i)||e.push("</",i,">");break;case 2:e.push(t.name.toLowerCase(),'="',function(t){return t.replace(v,"&amp;").replace(g,"&lt;").replace(f,"&gt;").replace(m,"&quot;")}(t.value),'"');break;case 3:case 4:e.push(b(t.nodeValue))}}var S=null;function T(t){if(null===S){var e=document.createElement("PRE");e.appendChild(document.createTextNode('<!DOCTYPE foo PUBLIC "foo bar">\n<foo />')),S=!/</.test(e.innerHTML)}if(S){var i=t.innerHTML;return I(t)&&(i=b(i)),i}for(var s=[],n=t.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(t,e){var i={};!function(){for(var s=t.concat(e),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=e.length;return function(t,n){for(var r=[n=n||0,"pln"],o="",a=0,l=t;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=e[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(t){var e=[],i=[];t.tripleQuotedStrings?e.push(["str",/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,"'\""]):t.multiLineStrings?e.push(["str",/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):e.push(["str",/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,"\"'"]),i.push(["pln",/^(?:[^\'\"\`\/\#]+)/,null," \r\n"]),t.hashComments&&e.push(["com",/^#[^\r\n]*/,null,"#"]),t.cStyleComments&&i.push(["com",/^\/\/[^\r\n]*/,null]),t.regexLiterals&&i.push(["str",/^\/(?:[^\\\*\/\[]|\\[\s\S]|\[(?:[^\]\\]|\\.)*(?:\]|$))+(?:\/|$)/,p]),t.cStyleComments&&i.push(["com",/^\/\*[\s\S]*?(?:\*\/|$)/,null]);var s=function(t){for(var e={},i=(t=t.split(/ /g)).length;--i>=0;){var s=t[i];s&&(e[s]=null)}return e}(t.keywords);t=null;var n=L(e,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(t){var e=n(t);return e=function(t,e){for(var i=0;i<e.length;i+=2)if("pln"===e[i+1]){var n,o,a,l;n=e[i],o=i+2<e.length?e[i+2]:t.length,a=t.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=t.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,e,i,2),i+=l.length-2}return e}(t,e),e}}var N=O({keywords:c,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),z={};function F(t,e){for(var i=e.length;--i>=0;){var s=e[i];z.hasOwnProperty(s)?"console"in window&&console.log("cannot override language handler %s",s):z[s]=t}}function H(t,e){try{var i=function(t){var e=t.match(B),i=[],s=0,n=[];if(e)for(var r=0,o=e.length;r<o;++r){var a=e[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}}(t),s=i.source,n=i.tags;return z.hasOwnProperty(e)||(e=/^\s*</.test(s)?"default-markup":"default-code"),function(t,e,i){var s=[],n=0,r=null,o=null,a=0,l=0,h=function(){var t=0;return function(e){for(var i=null,s=0,n=0,r=e.length;n<r;++n)switch(e.charAt(n)){case"\t":i||(i=[]),i.push(e.substring(s,n));var o=8-t%8;for(t+=o;o>=0;o-=16)i.push(" ".substring(0,o));s=n+1;break;case"\n":t=0;break;default:++t}return i?(i.push(e.substring(s)),i.join("")):e}}();function c(e){if(e>n){r&&r!==o&&(s.push("</span>"),r=null),!r&&o&&(r=o,s.push('<span class="',r,'">'));var i=b(h(t.substring(n,e))).replace(/(\r\n?|\n| ) /g,"$1&nbsp;").replace(/\r\n?|\n/g,"<br />");s.push(i),n=e}}for(;;)if(a<e.length&&(!(l<i.length)||e[a]<=i[l]))c(e[a]),r&&(s.push("</span>"),r=null),s.push(e[a+1]),a+=2;else{if(!(l<i.length))break;c(i[l]),o=i[l+1],l+=2}return c(t.length),r&&s.push("</span>"),s.join("")}(s,n,z[e].call({},s))}catch(e){return"console"in window&&(console.log(e),console.trace()),t}}F(N,["default-code"]),F((function(t){var e=function(t){for(var e=P(t),i=0;i<e.length;i+=2)if("src"===e[i+1]){var s,n;s=e[i],n=i+2<e.length?e[i+2]:t.length;var r=t.substring(s,n).match(/^(<[^>]*>)([\s\S]*)(<\/[^>]*>)$/);r&&e.splice(i,2,s,"tag",s+r[1].length,"src",s+r[1].length+(r[2]||"").length,"tag")}return e}(t);return e=function(t,e){for(var i=0;i<e.length;i+=2)if("tag"===e[i+1]){var s,n;s=e[i],n=i+2<e.length?e[i+2]:t.length;var r=t.substring(s,n),o=R(r,s);u(o,e,i,2),i+=o.length-2}return e}(t,e),e=function(t,e){for(var i=0;i<e.length;i+=2)if("src"===e[i+1]){var s,n;s=e[i],n=i+2<e.length?e[i+2]:t.length;for(var r=N(t.substring(s,n)),o=0,a=r.length;o<a;o+=2)r[o]+=s;u(r,e,i,2),i+=r.length-2}return e}(t,e),function(t,e){for(var i=!1,s=0;s<e.length;s+=2){var n,r,o=e[s+1];if("atn"===o)n=e[s],r=s+2<e.length?e[s+2]:t.length,i=/^on|^style$/i.test(t.substring(n,r));else if("atv"===o){if(i){n=e[s],r=s+2<e.length?e[s+2]:t.length;var a,l,h,c=t.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,e,s+2,0)):u(v,e,s,2)}i=!1}}return e}(t,e)}),["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(e){for(var i=t(),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 t(){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(t,250):e&&e()}()},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:(t,e,i)=>{var s;!function(n,r,o,a){"use strict";function l(t,e,i){return setTimeout(p(t,i),e)}function h(t,e,i){return!!Array.isArray(t)&&(c(t,i[e],i),!0)}function c(t,e,i){var s;if(t)if(t.forEach)t.forEach(e,i);else if(t.length!==a)for(s=0;s<t.length;)e.call(i,t[s],s,t),s++;else for(s in t)t.hasOwnProperty(s)&&e.call(i,t[s],s,t)}function d(t,e,i){var s="DEPRECATED METHOD: "+e+"\n"+i+" AT \n";return function(){var e=new Error("get-stack-trace"),i=e&&e.stack?e.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),t.apply(this,arguments)}}function u(t,e,i){var s,n=e.prototype;(s=t.prototype=Object.create(n)).constructor=t,s._super=n,i&&at(s,i)}function p(t,e){return function(){return t.apply(e,arguments)}}function v(t,e){return typeof t==ct?t.apply(e&&e[0]||a,e):t}function g(t,e){return t===a?e:t}function f(t,e,i){c(k(e),(function(e){t.addEventListener(e,i,!1)}))}function m(t,e,i){c(k(e),(function(e){t.removeEventListener(e,i,!1)}))}function b(t,e){for(;t;){if(t==e)return!0;t=t.parentNode}return!1}function w(t,e){return t.indexOf(e)>-1}function k(t){return t.trim().split(/\s+/g)}function y(t,e,i){if(t.indexOf&&!i)return t.indexOf(e);for(var s=0;s<t.length;){if(i&&t[s][i]==e||!i&&t[s]===e)return s;s++}return-1}function $(t){return Array.prototype.slice.call(t,0)}function x(t,e,i){for(var s=[],n=[],r=0;r<t.length;){var o=e?t[r][e]:t[r];y(n,o)<0&&s.push(t[r]),n[r]=o,r++}return i&&(s=e?s.sort((function(t,i){return t[e]>i[e]})):s.sort()),s}function _(t,e){for(var i,s,n=e[0].toUpperCase()+e.slice(1),r=0;r<lt.length;){if((s=(i=lt[r])?i+n:e)in t)return s;r++}return a}function C(t){var e=t.ownerDocument||t;return e.defaultView||e.parentWindow||n}function I(t,e){var i=this;this.manager=t,this.callback=e,this.element=t.element,this.target=t.options.inputTarget,this.domHandler=function(e){v(t.options.enable,[t])&&i.handler(e)},this.init()}function A(t,e,i){var s=i.pointers.length,n=i.changedPointers.length,r=e&xt&&s-n==0,o=e&(Ct|It)&&s-n==0;i.isFirst=!!r,i.isFinal=!!o,r&&(t.session={}),i.eventType=e,function(t,e){var i=t.session,s=e.pointers,n=s.length;i.firstInput||(i.firstInput=T(e)),n>1&&!i.firstMultiple?i.firstMultiple=T(e):1===n&&(i.firstMultiple=!1);var r=i.firstInput,o=i.firstMultiple,a=o?o.center:r.center,l=e.center=B(s);e.timeStamp=pt(),e.deltaTime=e.timeStamp-r.timeStamp,e.angle=L(a,l),e.distance=M(a,l),function(t,e){var i=e.center,s=t.offsetDelta||{},n=t.prevDelta||{},r=t.prevInput||{};e.eventType!==xt&&r.eventType!==Ct||(n=t.prevDelta={x:r.deltaX||0,y:r.deltaY||0},s=t.offsetDelta={x:i.x,y:i.y}),e.deltaX=n.x+(i.x-s.x),e.deltaY=n.y+(i.y-s.y)}(i,e),e.offsetDirection=E(e.deltaX,e.deltaY);var h=D(e.deltaTime,e.deltaX,e.deltaY);e.overallVelocityX=h.x,e.overallVelocityY=h.y,e.overallVelocity=ut(h.x)>ut(h.y)?h.x:h.y,e.scale=o?function(t,e){return M(e[0],e[1],Rt)/M(t[0],t[1],Rt)}(o.pointers,s):1,e.rotation=o?function(t,e){return L(e[1],e[0],Rt)+L(t[1],t[0],Rt)}(o.pointers,s):0,e.maxPointers=i.prevInput?e.pointers.length>i.prevInput.maxPointers?e.pointers.length:i.prevInput.maxPointers:e.pointers.length,S(i,e);var c=t.element;b(e.srcEvent.target,c)&&(c=e.srcEvent.target),e.target=c}(t,i),t.emit("hammer.input",i),t.recognize(i),t.session.prevInput=i}function S(t,e){var i,s,n,r,o=t.lastInterval||e,l=e.timeStamp-o.timeStamp;if(e.eventType!=It&&(l>$t||o.velocity===a)){var h=e.deltaX-o.deltaX,c=e.deltaY-o.deltaY,d=D(l,h,c);s=d.x,n=d.y,i=ut(d.x)>ut(d.y)?d.x:d.y,r=E(h,c),t.lastInterval=e}else i=o.velocity,s=o.velocityX,n=o.velocityY,r=o.direction;e.velocity=i,e.velocityX=s,e.velocityY=n,e.direction=r}function T(t){for(var e=[],i=0;i<t.pointers.length;)e[i]={clientX:dt(t.pointers[i].clientX),clientY:dt(t.pointers[i].clientY)},i++;return{timeStamp:pt(),pointers:e,center:B(e),deltaX:t.deltaX,deltaY:t.deltaY}}function B(t){var e=t.length;if(1===e)return{x:dt(t[0].clientX),y:dt(t[0].clientY)};for(var i=0,s=0,n=0;e>n;)i+=t[n].clientX,s+=t[n].clientY,n++;return{x:dt(i/e),y:dt(s/e)}}function D(t,e,i){return{x:e/t||0,y:i/t||0}}function E(t,e){return t===e?At:ut(t)>=ut(e)?0>t?St:Tt:0>e?Bt:Dt}function M(t,e,i){i||(i=Pt);var s=e[i[0]]-t[i[0]],n=e[i[1]]-t[i[1]];return Math.sqrt(s*s+n*n)}function L(t,e,i){i||(i=Pt);var s=e[i[0]]-t[i[0]],n=e[i[1]]-t[i[1]];return 180*Math.atan2(n,s)/Math.PI}function P(){this.evEl=Nt,this.evWin=zt,this.pressed=!1,I.apply(this,arguments)}function R(){this.evEl=Wt,this.evWin=Xt,I.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}function O(){this.evTarget=Vt,this.evWin=jt,this.started=!1,I.apply(this,arguments)}function N(t,e){var i=$(t.touches),s=$(t.changedTouches);return e&(Ct|It)&&(i=x(i.concat(s),"identifier",!0)),[i,s]}function z(){this.evTarget=Ut,this.targetIds={},I.apply(this,arguments)}function F(t,e){var i=$(t.touches),s=this.targetIds;if(e&(xt|_t)&&1===i.length)return s[i[0].identifier]=!0,[i,i];var n,r,o=$(t.changedTouches),a=[],l=this.target;if(r=i.filter((function(t){return b(t.target,l)})),e===xt)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]),e&(Ct|It)&&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 t=p(this.handler,this);this.touch=new z(this.manager,t),this.mouse=new P(this.manager,t),this.primaryTouch=null,this.lastTouches=[]}function W(t,e){t&xt?(this.primaryTouch=e.changedPointers[0].identifier,X.call(this,e)):t&(Ct|It)&&X.call(this,e)}function X(t){var e=t.changedPointers[0];if(e.identifier===this.primaryTouch){var i={x:e.clientX,y:e.clientY};this.lastTouches.push(i);var s=this.lastTouches;setTimeout((function(){var t=s.indexOf(i);t>-1&&s.splice(t,1)}),Jt)}}function Y(t){for(var e=t.srcEvent.clientX,i=t.srcEvent.clientY,s=0;s<this.lastTouches.length;s++){var n=this.lastTouches[s],r=Math.abs(e-n.x),o=Math.abs(i-n.y);if(Gt>=r&&Gt>=o)return!0}return!1}function V(t,e){this.manager=t,this.set(e)}function j(t){this.options=at({},this.defaults,t||{}),this.id=ft++,this.manager=null,this.options.enable=g(this.options.enable,!0),this.state=oe,this.simultaneous={},this.requireFail=[]}function q(t){return t&de?"cancel":t&he?"end":t&le?"move":t&ae?"start":""}function U(t){return t==Dt?"down":t==Bt?"up":t==St?"left":t==Tt?"right":""}function J(t,e){var i=e.manager;return i?i.get(t):t}function G(){j.apply(this,arguments)}function K(){G.apply(this,arguments),this.pX=null,this.pY=null}function Z(){G.apply(this,arguments)}function Q(){j.apply(this,arguments),this._timer=null,this._input=null}function tt(){G.apply(this,arguments)}function et(){G.apply(this,arguments)}function it(){j.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}function st(t,e){return(e=e||{}).recognizers=g(e.recognizers,st.defaults.preset),new nt(t,e)}function nt(t,e){this.options=at({},st.defaults,e||{}),this.options.inputTarget=this.options.inputTarget||t,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=t,this.input=function(t){return new(t.options.inputClass||(bt?R:wt?z:mt?H:P))(t,A)}(this),this.touchAction=new V(this,this.options.touchAction),rt(this,!0),c(this.options.recognizers,(function(t){var e=this.add(new t[0](t[1]));t[2]&&e.recognizeWith(t[2]),t[3]&&e.requireFailure(t[3])}),this)}function rt(t,e){var i,s=t.element;s.style&&(c(t.options.cssProps,(function(n,r){i=_(s.style,r),e?(t.oldCssProps[i]=s.style[i],s.style[i]=n):s.style[i]=t.oldCssProps[i]||""})),e||(t.oldCssProps={}))}function ot(t,e){var i=r.createEvent("Event");i.initEvent(t,!0,!0),i.gesture=e,e.target.dispatchEvent(i)}var at,lt=["","webkit","Moz","MS","ms","o"],ht=r.createElement("div"),ct="function",dt=Math.round,ut=Math.abs,pt=Date.now;at="function"!=typeof Object.assign?function(t){if(t===a||null===t)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(t),i=1;i<arguments.length;i++){var s=arguments[i];if(s!==a&&null!==s)for(var n in s)s.hasOwnProperty(n)&&(e[n]=s[n])}return e}:Object.assign;var vt=d((function(t,e,i){for(var s=Object.keys(e),n=0;n<s.length;)(!i||i&&t[s[n]]===a)&&(t[s[n]]=e[s[n]]),n++;return t}),"extend","Use `assign`."),gt=d((function(t,e){return vt(t,e,!0)}),"merge","Use `assign`."),ft=1,mt="ontouchstart"in n,bt=_(n,"PointerEvent")!==a,wt=mt&&/mobile|tablet|ip(ad|hone|od)|android/i.test(navigator.userAgent),kt="touch",yt="mouse",$t=25,xt=1,_t=2,Ct=4,It=8,At=1,St=2,Tt=4,Bt=8,Dt=16,Et=St|Tt,Mt=Bt|Dt,Lt=Et|Mt,Pt=["x","y"],Rt=["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 Ot={mousedown:xt,mousemove:_t,mouseup:Ct},Nt="mousedown",zt="mousemove mouseup";u(P,I,{handler:function(t){var e=Ot[t.type];e&xt&&0===t.button&&(this.pressed=!0),e&_t&&1!==t.which&&(e=Ct),this.pressed&&(e&Ct&&(this.pressed=!1),this.callback(this.manager,e,{pointers:[t],changedPointers:[t],pointerType:yt,srcEvent:t}))}});var Ft={pointerdown:xt,pointermove:_t,pointerup:Ct,pointercancel:It,pointerout:It},Ht={2:kt,3:"pen",4:yt,5:"kinect"},Wt="pointerdown",Xt="pointermove pointerup pointercancel";n.MSPointerEvent&&!n.PointerEvent&&(Wt="MSPointerDown",Xt="MSPointerMove MSPointerUp MSPointerCancel"),u(R,I,{handler:function(t){var e=this.store,i=!1,s=t.type.toLowerCase().replace("ms",""),n=Ft[s],r=Ht[t.pointerType]||t.pointerType,o=r==kt,a=y(e,t.pointerId,"pointerId");n&xt&&(0===t.button||o)?0>a&&(e.push(t),a=e.length-1):n&(Ct|It)&&(i=!0),0>a||(e[a]=t,this.callback(this.manager,n,{pointers:e,changedPointers:[t],pointerType:r,srcEvent:t}),i&&e.splice(a,1))}});var Yt={touchstart:xt,touchmove:_t,touchend:Ct,touchcancel:It},Vt="touchstart",jt="touchstart touchmove touchend touchcancel";u(O,I,{handler:function(t){var e=Yt[t.type];if(e===xt&&(this.started=!0),this.started){var i=N.call(this,t,e);e&(Ct|It)&&i[0].length-i[1].length==0&&(this.started=!1),this.callback(this.manager,e,{pointers:i[0],changedPointers:i[1],pointerType:kt,srcEvent:t})}}});var qt={touchstart:xt,touchmove:_t,touchend:Ct,touchcancel:It},Ut="touchstart touchmove touchend touchcancel";u(z,I,{handler:function(t){var e=qt[t.type],i=F.call(this,t,e);i&&this.callback(this.manager,e,{pointers:i[0],changedPointers:i[1],pointerType:kt,srcEvent:t})}});var Jt=2500,Gt=25;u(H,I,{handler:function(t,e,i){var s=i.pointerType==kt,n=i.pointerType==yt;if(!(n&&i.sourceCapabilities&&i.sourceCapabilities.firesTouchEvents)){if(s)W.call(this,e,i);else if(n&&Y.call(this,i))return;this.callback(t,e,i)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});var Kt=_(ht.style,"touchAction"),Zt=Kt!==a,Qt="compute",te="auto",ee="manipulation",ie="none",se="pan-x",ne="pan-y",re=function(){if(!Zt)return!1;var t={},e=n.CSS&&n.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach((function(i){t[i]=!e||n.CSS.supports("touch-action",i)})),t}();V.prototype={set:function(t){t==Qt&&(t=this.compute()),Zt&&this.manager.element.style&&re[t]&&(this.manager.element.style[Kt]=t),this.actions=t.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var t=[];return c(this.manager.recognizers,(function(e){v(e.options.enable,[e])&&(t=t.concat(e.getTouchAction()))})),function(t){if(w(t,ie))return ie;var e=w(t,se),i=w(t,ne);return e&&i?ie:e||i?e?se:ne:w(t,ee)?ee:te}(t.join(" "))},preventDefaults:function(t){var e=t.srcEvent,i=t.offsetDirection;if(!this.manager.session.prevented){var s=this.actions,n=w(s,ie)&&!re[ie],r=w(s,ne)&&!re[ne],o=w(s,se)&&!re[se];if(n){var a=1===t.pointers.length,l=t.distance<2,h=t.deltaTime<250;if(a&&l&&h)return}return o&&r?void 0:n||r&&i&Et||o&&i&Mt?this.preventSrc(e):void 0}e.preventDefault()},preventSrc:function(t){this.manager.session.prevented=!0,t.preventDefault()}};var oe=1,ae=2,le=4,he=8,ce=he,de=16,ue=32;j.prototype={defaults:{},set:function(t){return at(this.options,t),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(t){if(h(t,"recognizeWith",this))return this;var e=this.simultaneous;return e[(t=J(t,this)).id]||(e[t.id]=t,t.recognizeWith(this)),this},dropRecognizeWith:function(t){return h(t,"dropRecognizeWith",this)||(t=J(t,this),delete this.simultaneous[t.id]),this},requireFailure:function(t){if(h(t,"requireFailure",this))return this;var e=this.requireFail;return-1===y(e,t=J(t,this))&&(e.push(t),t.requireFailure(this)),this},dropRequireFailure:function(t){if(h(t,"dropRequireFailure",this))return this;t=J(t,this);var e=y(this.requireFail,t);return e>-1&&this.requireFail.splice(e,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(t){return!!this.simultaneous[t.id]},emit:function(t){function e(e){i.manager.emit(e,t)}var i=this,s=this.state;he>s&&e(i.options.event+q(s)),e(i.options.event),t.additionalEvent&&e(t.additionalEvent),s>=he&&e(i.options.event+q(s))},tryEmit:function(t){return this.canEmit()?this.emit(t):void(this.state=ue)},canEmit:function(){for(var t=0;t<this.requireFail.length;){if(!(this.requireFail[t].state&(ue|oe)))return!1;t++}return!0},recognize:function(t){var e=at({},t);return v(this.options.enable,[this,e])?(this.state&(ce|de|ue)&&(this.state=oe),this.state=this.process(e),void(this.state&(ae|le|he|de)&&this.tryEmit(e))):(this.reset(),void(this.state=ue))},process:function(t){},getTouchAction:function(){},reset:function(){}},u(G,j,{defaults:{pointers:1},attrTest:function(t){var e=this.options.pointers;return 0===e||t.pointers.length===e},process:function(t){var e=this.state,i=t.eventType,s=e&(ae|le),n=this.attrTest(t);return s&&(i&It||!n)?e|de:s||n?i&Ct?e|he:e&ae?e|le:ae:ue}}),u(K,G,{defaults:{event:"pan",threshold:10,pointers:1,direction:Lt},getTouchAction:function(){var t=this.options.direction,e=[];return t&Et&&e.push(ne),t&Mt&&e.push(se),e},directionTest:function(t){var e=this.options,i=!0,s=t.distance,n=t.direction,r=t.deltaX,o=t.deltaY;return n&e.direction||(e.direction&Et?(n=0===r?At:0>r?St:Tt,i=r!=this.pX,s=Math.abs(t.deltaX)):(n=0===o?At:0>o?Bt:Dt,i=o!=this.pY,s=Math.abs(t.deltaY))),t.direction=n,i&&s>e.threshold&&n&e.direction},attrTest:function(t){return G.prototype.attrTest.call(this,t)&&(this.state&ae||!(this.state&ae)&&this.directionTest(t))},emit:function(t){this.pX=t.deltaX,this.pY=t.deltaY;var e=U(t.direction);e&&(t.additionalEvent=this.options.event+e),this._super.emit.call(this,t)}}),u(Z,G,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[ie]},attrTest:function(t){return this._super.attrTest.call(this,t)&&(Math.abs(t.scale-1)>this.options.threshold||this.state&ae)},emit:function(t){if(1!==t.scale){var e=t.scale<1?"in":"out";t.additionalEvent=this.options.event+e}this._super.emit.call(this,t)}}),u(Q,j,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[te]},process:function(t){var e=this.options,i=t.pointers.length===e.pointers,s=t.distance<e.threshold,n=t.deltaTime>e.time;if(this._input=t,!s||!i||t.eventType&(Ct|It)&&!n)this.reset();else if(t.eventType&xt)this.reset(),this._timer=l((function(){this.state=ce,this.tryEmit()}),e.time,this);else if(t.eventType&Ct)return ce;return ue},reset:function(){clearTimeout(this._timer)},emit:function(t){this.state===ce&&(t&&t.eventType&Ct?this.manager.emit(this.options.event+"up",t):(this._input.timeStamp=pt(),this.manager.emit(this.options.event,this._input)))}}),u(tt,G,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[ie]},attrTest:function(t){return this._super.attrTest.call(this,t)&&(Math.abs(t.rotation)>this.options.threshold||this.state&ae)}}),u(et,G,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:Et|Mt,pointers:1},getTouchAction:function(){return K.prototype.getTouchAction.call(this)},attrTest:function(t){var e,i=this.options.direction;return i&(Et|Mt)?e=t.overallVelocity:i&Et?e=t.overallVelocityX:i&Mt&&(e=t.overallVelocityY),this._super.attrTest.call(this,t)&&i&t.offsetDirection&&t.distance>this.options.threshold&&t.maxPointers==this.options.pointers&&ut(e)>this.options.velocity&&t.eventType&Ct},emit:function(t){var e=U(t.offsetDirection);e&&this.manager.emit(this.options.event+e,t),this.manager.emit(this.options.event,t)}}),u(it,j,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[ee]},process:function(t){var e=this.options,i=t.pointers.length===e.pointers,s=t.distance<e.threshold,n=t.deltaTime<e.time;if(this.reset(),t.eventType&xt&&0===this.count)return this.failTimeout();if(s&&n&&i){if(t.eventType!=Ct)return this.failTimeout();var r=!this.pTime||t.timeStamp-this.pTime<e.interval,o=!this.pCenter||M(this.pCenter,t.center)<e.posThreshold;if(this.pTime=t.timeStamp,this.pCenter=t.center,o&&r?this.count+=1:this.count=1,this._input=t,0==this.count%e.taps)return this.hasRequireFailures()?(this._timer=l((function(){this.state=ce,this.tryEmit()}),e.interval,this),ae):ce}return ue},failTimeout:function(){return this._timer=l((function(){this.state=ue}),this.options.interval,this),ue},reset:function(){clearTimeout(this._timer)},emit:function(){this.state==ce&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}}),st.VERSION="2.0.8",st.defaults={domEvents:!1,touchAction:Qt,enable:!0,inputTarget:null,inputClass:null,preset:[[tt,{enable:!1}],[Z,{enable:!1},["rotate"]],[et,{direction:Et}],[K,{direction:Et},["swipe"]],[it],[it,{event:"doubletap",taps:2},["tap"]],[Q]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}},nt.prototype={set:function(t){return at(this.options,t),t.touchAction&&this.touchAction.update(),t.inputTarget&&(this.input.destroy(),this.input.target=t.inputTarget,this.input.init()),this},stop:function(t){this.session.stopped=t?2:1},recognize:function(t){var e=this.session;if(!e.stopped){this.touchAction.preventDefaults(t);var i,s=this.recognizers,n=e.curRecognizer;(!n||n&&n.state&ce)&&(n=e.curRecognizer=null);for(var r=0;r<s.length;)i=s[r],2===e.stopped||n&&i!=n&&!i.canRecognizeWith(n)?i.reset():i.recognize(t),!n&&i.state&(ae|le|he)&&(n=e.curRecognizer=i),r++}},get:function(t){if(t instanceof j)return t;for(var e=this.recognizers,i=0;i<e.length;i++)if(e[i].options.event==t)return e[i];return null},add:function(t){if(h(t,"add",this))return this;var e=this.get(t.options.event);return e&&this.remove(e),this.recognizers.push(t),t.manager=this,this.touchAction.update(),t},remove:function(t){if(h(t,"remove",this))return this;if(t=this.get(t)){var e=this.recognizers,i=y(e,t);-1!==i&&(e.splice(i,1),this.touchAction.update())}return this},on:function(t,e){if(t!==a&&e!==a){var i=this.handlers;return c(k(t),(function(t){i[t]=i[t]||[],i[t].push(e)})),this}},off:function(t,e){if(t!==a){var i=this.handlers;return c(k(t),(function(t){e?i[t]&&i[t].splice(y(i[t],e),1):delete i[t]})),this}},emit:function(t,e){this.options.domEvents&&ot(t,e);var i=this.handlers[t]&&this.handlers[t].slice();if(i&&i.length){e.type=t,e.preventDefault=function(){e.srcEvent.preventDefault()};for(var s=0;s<i.length;)i[s](e),s++}},destroy:function(){this.element&&rt(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}},at(st,{INPUT_START:xt,INPUT_MOVE:_t,INPUT_END:Ct,INPUT_CANCEL:It,STATE_POSSIBLE:oe,STATE_BEGAN:ae,STATE_CHANGED:le,STATE_ENDED:he,STATE_RECOGNIZED:ce,STATE_CANCELLED:de,STATE_FAILED:ue,DIRECTION_NONE:At,DIRECTION_LEFT:St,DIRECTION_RIGHT:Tt,DIRECTION_UP:Bt,DIRECTION_DOWN:Dt,DIRECTION_HORIZONTAL:Et,DIRECTION_VERTICAL:Mt,DIRECTION_ALL:Lt,Manager:nt,Input:I,TouchAction:V,TouchInput:z,MouseInput:P,PointerEventInput:R,TouchMouseInput:H,SingleTouchInput:O,Recognizer:j,AttrRecognizer:G,Tap:it,Pan:K,Swipe:et,Pinch:Z,Rotate:tt,Press:Q,on:f,off:m,each:c,merge:gt,extend:vt,assign:at,inherit:u,bindFn:p,prefixed:_}),(void 0!==n?n:"undefined"!=typeof self?self:{}).Hammer=st,void 0===(s=function(){return st}.call(e,i,e,t))||(t.exports=s)}(window,document)}}]);
//# sourceMappingURL=420.e197c63136060d40.js.map