1window.console||(window.console={log:function(){}}),qwiz_={};var qwizf=function(){var qname="qwiz_",debug=[];debug.push(!1),debug.push(!1),debug.push(!1),debug.push(!1),debug.push(!1),debug.push(!1),debug.push(!1),debug.push(!1),debug.push(!1),debug.push(!1),debug.push(!1),debug.push(!1),debug.push(!1);var $=jQuery;this.no_intro_b=[],this.processing_complete_b=!1,this.qrecord_b=!1,this.dataset_b=!1,this.preview=!1,this.any_pay_quiz_f=!1,this.hotspot_alpha_value=121,this.hotspot_alpha_value_tmp=122,this.hotspot_border_alpha_value=254;var q=this,qqc,regular_page_f=!0,content,default_use_dict,default_use_terms,hint_timeout_sec,default_hangman_max_hints,correct,incorrect,errmsgs=[],n_qwizzes=0,qwizzled_b,qwizcards_page_f=!1,qwizdata=[],header_html,drag_and_drop_initialized_b=!1,try_again_obj="",$label_clicked=[],$prev_label_clicked=[],ignore_label_click_b=!1,next_button_active_b=!1,textentry_b=!1,loaded_metaphone_js_b=!1,default_textentry_terms_metaphones,current_question_textentry_terms_metaphones={},textentry_answers={},textentry_answer_metaphones={},textentry_matches={},lc_textentry_matches={},textentry_i_qwiz,suppress_hangman_hint_b=!1,Tcheck_answer_message,show_hint_timeout={},panel_exit_mobile_open_b=!1,panel_exit_mobile_just_closed_b,non_mobile_scrollLeft,non_mobile_scrollTop,qw,set_qwizard_data_b=!1,preview_min_height,preview_mode="questions_active";this.wordpress_page_f=!1;var reinit_highlighting_f=!1,restart_timers_i_qwiz=-1;function process_html(){$('p:contains("[!]"), :header:contains("[!]")').each((function(){0==$(this).html().search(/\s*(<.+?>)*\s*\[!+\][^]*?\[\/!+\]\s*(<.+?>)*\s*$/m)&&$(this).remove()})),$('p:contains("qwiz"), :header:contains("qwiz")').each((function(){var e=$
1(this).html();0==e.search(/\s*\[\/{0,1}qwiz[^\]]*\]\s*/m)&&$(this).replaceWith(e)})),$("span.qwiz_img_swap.not_inited").each((function(){qqc.init_image_swap(this)})),q.qwizard_b||(q.wordpress_page_f=1==qqc.get_qwiz_param("wppf",""));var e="",t=$("div.qwiz_wrapper"),i=$("div.qwiz_wrapper_fallback");if(t.length)e="div.qwiz_wrapper",i.css({display:"none"});else{if(0==i.length){$("head").append('<style type="text/css">\n.qwiz_wrapper_fallback_visible {\nvisibility: visible;\n}\n</style>\n')}-1==(e=content).indexOf("wp-block-post-excerpt")&&(e+=", div.wp-block-post-excerpt")}n_qwizzes=0;var a=0;$(e).each((function(){const e=$(this);var i=e.html();if(i){if(-1!=i.indexOf("[qwiz")){var s=q.process_html2(i,a);if(i=s.htm,q.qwizdemos)for(var _=q.qwizdemos.length,o=0;o<_;o++){var n=q.qwizdemos[o],r=n.length;n=n.substring(10,r-11),i=i.replace("<qwizdemo></qwizdemo>",n)}if(s.replace_body){debug[0]&&console.log("[process_html] document_qwiz_user_logged_in_b:",document_qwiz_user_logged_in_b);var d='<div class="preview_header"><h2 style="margin-bottom: 10px;">Preview quiz</h2><a href="javascript: void (0)" style="float: right; margin-right: 50px;" onclick="'+qname+".reset_preview ("+a+')">Reload preview</a><label><input type="radio" name="preview_radio" value="questions_active" onclick="'+qname+".change_preview_mode (this, "+a+')" checked /> Questions active</label> <label><input type="radio" name="preview_radio" value="show_answers" onclick="'+qname+".change_preview_mode (this, "+a+')" /> Show answers</label> <label><input type="radio" name="preview_radio" value="show_answers_and_feedback" onclick="'+qname+".change_preview_mode (this, "+a+')" /> Show answers and feedback</label> </div>';$("body").html(d+i),$("div#qwiz"+a).css({margin:"auto"})}else e.html(i);if(a!=s.i_qwiz){a=s.i_qwiz,e.find("div.qwiz").on("mouseenter",(function(e){if("div"==e.target.tagName.toLowerCase()&&"qwiz"==e.target.className)document_active_qwiz_qdeck=e.target;else{var t=$(e.target).parents("div.qwiz");t.length&&(document_active_qwiz_qdeck=t[0])}debug[7]&&(console.log("[qwiz mouseenter] e.target:",e.target),console.log("[qwiz mouseenter] document_active_qwiz_qdeck:",document_active_qwiz_qdeck))}));var c=a-1;if(qwizdata[c])for(var l=qwizdata[c].n_questions,w=0;w<l;w++)if(qwizdata[c].bg_img[w]){var h=qwizdata[c].bg_img[w],u=new Image;u.src=h.src,u.i_qwiz=c,u.i_question=w,u.onload=function(){var e,t=this.width,i=this.height,a=$("#qwiz"+u.i_qwiz+"-q"+u.i_question);debug[0]&&console.log("[process_html] w:",t,", h:",i,", $qwizq:",a),e=h.height?h.height:h.width?Math.floor(h.width/t*i):i,e+="px",h.top&&(e="calc("+h.top+"px + "+e+")"),a.css({"min-height":e})}}}}t.length&&e.contents().unwrap()}else;})),n_qwizzes=a,q.n_qwizzes=a,document_qwiz_qwiz_html_completed_f=!0,$("div.qwiz_wrapper").removeClass("qwiz_shortcodes_hidden"),$("div.hangman_label").each((function(){var e=$
1(this),t=e.outerWidth();e.outerWidth(1.2*t)}));for(a=0;a<n_qwizzes;a++)if(qwizdata[a].qrecord_id){var s={qwiz_qdeck:"qwiz",n_questions_cards:qwizdata[a].n_questions};qqc.jjax(qname,a,qwizdata[a].qrecord_id,"check_registered",s)}if(n_qwizzes&&qqc.init_enter_intercept(),q.qrecord_b&&qqc.set_user_menus_and_icons(!1,!1,"doing_quizzes"),textentry_b)if("body"==content&&"undefined"!=typeof qcard_){var _=0,o=function(){var e=!1;debug[6]&&console.log("[run_init_textentry_autocomplete]",_),(qcard_.processing_complete_b||_>30)&&(debug[6]&&console.log("[run_init_textentry_autocomplete] OK"),q.init_textentry_autocomplete($("body")),e=!0),e||(setTimeout(o,100),_++)};o()}else q.init_textentry_autocomplete($("body"));for(a=0;a<n_qwizzes;a++)set_initial_width(a);document_qwiz_qwiz_html_completed_f=!0,q.processing_complete_b=!0}function set_initial_width(e){const t=$("#xqwiz"+e);if(t.length){t.css({height:"","min-height":""});const i=t.outerWidth();debug[0]&&console.log("[set_initial_width] i_qwiz:",e,", initial_width:",i),i&&(qwizdata[e].initial_width=i)}}function dialog_no_credit_html(){htm=[],htm.push('<div id="qwiz_dialog_no_credit" title="'+T("Quiz not assigned in your class")+'">'),htm.push('<div class="has_not_been_assigned">'),htm.push('<p style="margin-bottom: 1em;">'),htm.push(T("Note: this quiz has not been assigned as work you need to do.")),htm.push(T("Your work will be recorded, but it may not count for your class.")),htm.push("</p>"),htm.push("<p>"),htm.push(T("You can send a request message to your teacher asking them to include this quiz in your class.")),htm.push("<br />"),htm.push("<br />"),htm.push('<button id="qwiz_request_assign_to_class" class="qwiz_button" onclick="qwiz_qcards_common.request_assign_to_class (1)">'),htm.push(T("Send request")),htm.push("</button>"),htm.push("</p>"),htm.push("<br />"),htm.push('<div id="qwiz_request_assign_to_class_feedback">'),htm.push("</div>"),htm.push("</div>"),htm.push('<div class="not_in_a_class" style="display: none;">'),htm.push("<p>"),htm.push(T("You are not enrolled in any current class.")),htm.push(T("Your work will be recorded, but your teacher will not see it.")),htm.push("</p>"),htm.push("<p>"),htm.push(T("To add yourself to a class:")),htm.push("</p>"),htm.push("<p>");const e=qqc.get_qwiz_param("server_name")+"/register";return htm.push(T("Go to")+' <a style="text-decoration: underline; color: blue;" href="https://'+e+'">'+e+"</a>"),htm.push("</p>"),htm.push("<p>"),htm.push(T("Enter the registration code given to you by your teacher and enter your login name and password.")),htm.push("</p>"),htm.push("<p>"),htm.push(T("Or you can ask your teacher to add you to their class.")),htm.push("</p>"),htm.push("</div>"),htm.push("<p>"),htm.push("<label>"),htm.push('<input type="checkbox" onclick="qwiz_qcards_common.do_not_show_assign_to_class (this)" />'),htm.push(T("Don’t show me this again for quizzes and flashcard decks on this page")),htm.push("</label>"),htm.push("</p>"),htm.push("</div>"),htm.join("\n")}function init_preview_show_answers(e){$("div#qwiz"+e+' input[type="radio"][data-q="1"]').each((function(){var e=this.id.substr(6);q.process_choice(void 0,e)})),$("div#qwiz"+e+" button.show_the_answer").each((function(){$(this).trigger("click")})),$(`div#qwiz${e} div.show_answer_got_it_or_not`).hide(),$("div#qwiz"+e).find("input.qwiz_textentry, input.qwiz_single_char_entry").each((function(){var t=this.id.split("-")[2].substr(1),i=qwizdata[e].textentry[t].first_correct_answer;$(this).val(i),$(this).parents("div.qwizq").find("button.textentry_check_answer, button.qwiz_textentry_hint").hide(),"show_answers_and_feedback"==preview_mode&&$(this).parents("div.qwizq").find("div.qwiz-feedback").first().show()})),$("div#qwiz"+e).find("span.qwiz_hangman").each((function(){var t=$(this);preview_replace_hangman_entries(t,e,"final"),t.find("span.hangman_type_letters").hide(),"show_answers_and_feedback"==preview_mode&&t.parents("div.qwizq").find(".qwiz-feedback").show()})),$("div#qwiz"+e).find("div.qwizzled_label").each((function(){var e,t=$(this),i=t.attr("class").match(/qtarget_assoc(\d+)/);i?(e=i[1],place_label($(".qwizzled_target-"+e),t)):(e=t.data("label_target_id"))&&place_label($(".qwizzled_target-"+e),t)})),$(".qwiz_hotspot_label").show(),"show_answers_and_feedback"==preview_mode?$(".hotspot_label_feedback_correct").show():$(".hotspot_label_feedback_correct").hide()}function init_preview_questions_active(e){for(var t in $("div#qwiz"+e+' input[type="radio"]').attr("disabled",!1).prop("checked",!1),$("div#qwiz"+e).find("input.qwiz_textentry, input.qwiz_single_char_entry").attr("disabled",!1).val(""),$("div#qwiz"+e).find("button.textentry_check_answer, button.qwiz_textentry_hint").css({display:""}),$("div#qwiz"+e).find("span.qwiz_hangman").each((function(){preview_replace_hangman_entries($(this),e,"initial")})),qwizdata[e].$qwizzled)$("div#"+t).replaceWith(qwizdata[e].$qwizzled[t]),$("div#"+t).addClass("qwizq_preview").show(),qwizdata[e].$qwizzled[t]=$("div#"+t).clone(!0);$(".qwiz_hotspot_label, .hotspot_label_feedback_correct").hide()}function preview_replace_hangman_entries(e,t,i){var a=e.parents("div.qwizq")[0].id.split("-")[1].substr(1),s=e.attr("class").match(/qwiz_hangman_c(\d+)/)[1],_=qwizdata[t].hangman[a].hangman_final_entry[s];if("initial"==i){var o=_.replace(/>[a-z0-9]</gi,"> <");e.find("span.hangman_current_entry").html(o)}else e.find("span.hangman_current_entry").html(_)}function place_labels(e,t,i){for(var a in debug[0]&&console.log("[place_labels] i_qwiz:",e,", i_question:",t,", qwizq_id:, ",i),qwizdata[e].correct_on_try1[t])if(1==qwizdata[e].correct_on_try1[t][a]){var s=$("div#"+i+" div#"+a);0==s.length&&(s=$("div#"+i+" span#"+a).first());var _,o=s.attr("class").match(/qwizzled_target-([0-9]+)/);o&&(_=o[1]),debug[8]&&console.log("[place_labels] $target:",s,", assoc_id:",_);var n=$("td.qwizzled_labels div.qtarget_assoc"+_);n.length||(n=$("div#"+i).find('td.qwizzled_labels div.qwizzled_label[data-label_target_id="'+_+'"]')),place_label(s,n),qwizdata[e].n_labels_correct++,qwizdata[e].n_label_attempts++}else qwizdata[e].correct_on_try1[t][a]=0;q.display_diagram_progress(e)}function place_label(e,t){var i=t.clone(!1);q.qwizard_b&&($editable=i.find(".qwiz_editable"),$editable.removeAttr("id").removeAttr("contenteditable").removeClass("qwiz_editable").addClass("qwizzled_label_placed"),debug[12]&&console.log("[place_label] $editable:",$editable)),i.css({position:"absolute",left:"4px",top:"50%",height:"auto",width:"100%",transform:"translateY(-50%)"}),i.removeClass("qwizzled_label_unplaced"),i.find(".qwizzled_highlight_label").css("cursor","default").removeClass("label_click_highlight"),i.appendTo(e),t.css({left:"0px",top:"0px"});var a=!1;if(n=t.attr("class").match(/qwizzled_n_targets([0-9]*)/)){a=!0;var s=n[0],_=parseInt(n[1],10);if(2==_)t.removeClass(s);else{var o="qwizzled_n_targets"+--_;t.removeClass(s).addClass(o)}}if(!q.qwizard_b&&!a){if(debug[8]&&console.log("[place_label] (draggable disable) $label[0]:",t[0]),t.css({color:"lightgray",left:"0px",top:"0px"}),t.find("*").css({color:"lightgray"}),t.find(".qwizzled_highlight_label").css("cursor","default"),t.removeClass("qwizzled_label_unplaced"),!q.qwizard_b)try{t.draggable("disable")}catch(e){}t.off("click")}if(!q.qwizard_b)if("div"==e[0].tagName.toLowerCase())e.droppable("instance")&&e.droppable("disable");else{var n=e.attr("class").match(/qtarget_sib-[0-9]+/);if(n){var r=e.parents("qwizq").find("span."+n[0]);r.droppable("instance")&&r.droppable("disable")}else{e.siblings("span").andSelf().droppable("disable")}}}function create_qwiz_divs(e,t,i,a){var s=t.match(/\[qwiz([^\]]*)\]/m),_=s[1];debug[0]&&console.log("[create_qwiz_divs] attributes: ",_);var o=[];if(-1!=(_=qqc.replace_smart_quotes(_)).search(/[\s;"]width/m)){var n=_.replace(/;\s*;/g,";");o.push('<div id="xqwiz'+e+'" class="xqwiz" '+n+"></div>\n")}if((s=_.match(/min-height:\s*([^;\s]+)/))&&(preview_min_height=s[1]),qwizdata[e].align){var r=qwizdata[e].align,d="";if("center"==r)d="margin: auto;";else if("right"==r)d="margin-left: auto;";else if("tiled"==r&&(d="float: left;",qwizdata[e].spacing)){var c=qwizdata[e].spacing+"px !important";d+=" margin-left: "+c+"; margin-bottom: "+c+";"}(s=_.match(/style\s*=\s*"[^"]*/m))?_=(_=_.replace(/(style\s*=\s*"[^"]*)/m,"$1; "+d)).replace(/;\s*;/g,";"):_+=' style="'+d+'"',_=_.replace(/align\s*=\s*"[^"]*"/,""),debug[0]&&console.log("[create_qwiz_divs] attributes: ",_)}o.push('<div id="qwiz'+e+'" class="qwiz visibilityhidden" '+_+">");var l="";qwizdata[e].question_time_limit&&(l=qqc.hhmmss_from_sec(qwizdata[e].question_time_limit)),o.push('<div id="qwiz'+e+'-question_timer" class="question-timer">'+l+"</div>"),o.push('<div id="overlay-times-up-qwiz'+e+'" class="overlay-times-up">'),o.push('<div class="overlay-times-up-msg">'),o.push("Sorry, time’s up"),o.push("</div>"),o.push("</div>"),o.push('<div id="overlay-exit-mobile-qwiz'+e+'" class="overlay-exit-mobile-qwiz" onclick="'+qname+'.close_panel_exit_mobile(this)">'),o.push('<div id="panel-exit-mobile-qwiz'+e+'" class="panel-exit-mobile-qwiz">'),o.push('<button onclick="'+qname+".exit_mobile ("+e+')">'),o.push(T("Back to page view")),o.push("</button>"),o.push("<br />"),o.push("<span>"),o.push("("),o.push(T("To return to this full-screen view, tap")),o.push('<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAIAAADZF8uwAAAAk0lEQVR4nI3QMQ6EIBAF0BG2YLiGtjRcgt7EcBfDhShtbLwBHIgCJrPFbrGJqPvrl/k/MzAzPOUFAMYYRCSiaZpijGckAAARSynM3BVf1FpTSkkpQwiXaBzHnLNzbtu2Lhr+GS4exSUyxqzrCgDLssDnBefM87zv+3EcRHS3yVpba0XElFK/znsvhNBal1Lu
1Lv3mDbu1OYLB67+mAAAAAElFTkSuQmCC" />'),o.push(")"),o.push("</span>"),o.push('<div class="panel-icon-exit-mobile-qwiz"></div>'),o.push("</div>"),o.push("</div>"),o.push('<div id="icon-exit-mobile-qwiz'+e+'" class="icon-exit-mobile-qwiz" onclick="'+qname+".open_panel_exit_mobile ("+e+')"></div>'),o.push(`<div class="qwiz-progress_meter-qwiz${e} qwiz-progress_meter">`),o.push("</div>");d="";""!=header_html&&"NA"!=header_html&&-1==header_html.indexOf("Enter header text")||(d=' style="display: none;"'),o.push('<div class="header-qwiz'+e+' qwiz-header qwiz_editable"'+d+">"),o.push(header_html),o.push("</div>"),o=o.join("\n");const w=qqc.get_qwiz_param("url","./");var h=[];h.push('<div class="qwiz-progress-container qwiz'+e+'">');var u=T("Full-screen view");h.push('<div class="go-mobile-qwiz go-mobile-qwiz'+e+'" onclick="'+qname+".go_mobile ("+e+')" title="'+u+'">'),h.push("</div>"),h.push('<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAKwmlDQ1BJQ0MgUHJvZmlsZQAASImVlwdUU9kWhs+96Y2WEAEpofcuXUroAZReRSUkgYQSY0JQsSviCCqKiAiWoQxVwUEpMhbEgm1QbNgnyKCiPgcLNlTeBYYw89567633r3XW/e6+++y9z1nnrLUvABQ8WyTKgJUAyBRmiSMCvBlx8QkM3O8AAligChSAHpsjETHDwkIAounn3/XhDuKN6KblRKx///5fpczlSTgAQGEIJ3MlnEyEjyHjNUckzgIAVY3Y9ZdliSb4IsI0MVIgwg8nOHWKRyY4eZLR6EmfqAgfhNUAwJPZbHEqAGQDxM7I5qQicci+CNsIuQIhwsg78ODw2VyEkbzAIjNzyQTLEDZJ/kuc1L/FTJbHZLNT5Ty1lknhfQUSUQZ7xf+5Hf9bmRnS6RxGyCDzxYERyJOO7Nnd9CXBchYmzw+dZgF30n+S+dLA6GnmSHwSppnL9g2Wz82YHzLNKQJ/ljxOFitqmnkSv8hpFi+JkOdKEfswp5ktnskrTY+W2/k8ljx+Dj8qdpqzBTHzp1mSHhk84+Mjt4ulEfL6ecIA75m8/vK1Z0r+sl4BSz43ix8VKF87e6Z+npA5E1MSJ6+Ny/P1m/GJlvuLsrzluUQZYXJ/XkaA3C7JjpTPzUIO5MzcMPkeprGDwqYZhIAAwADRIANkATFgIxwIkJOaxVs+cUaBzxLRCrEglZ/FYCK3jMdgCTlWFgw7GzsbACbu7NSReHd38i5CdPyMTYJ4uG5DjKIZ20IaAMf4AChwZmxGRch1JAFwNoEjFWdP2SauE8AAIlAENKAOtIE+MAGWwA44AjfgBfxAEAgFUSAeLAIcwAeZSOXLwCqwHuSBArAD7AZl4CCoAnXgMGgB7eAEOAMugCvgOrgNHgAZGAIvwQj4AMYgCMJBFIgKqUM6kCFkDtlBzpAH5AeFQBFQPJQEpUJCSAqtgjZCBVARVAZVQPXQz9Bx6Ax0CeqD7kED0DD0FvoCo2AyTIO1YCPYGnaGmXAwHAUvhFPhpXAOnAtvh0vhSvgQ3Aafga/At2EZ/BIeRQEUCUVH6aIsUc4oH1QoKgGVghKj1qDyUSWoSlQTqhPVg7qJkqFeoT6jsWgqmoG2RLuhA9HRaA56KXoNeiu6DF2HbkOfQ99ED6BH0N8xFIwmxhzjimFh4jCpmGWYPEwJpgbTijmPuY0ZwnzAYrF0rDHWCRuIjcemYVdit2L3Y5uxXdg+7CB2FIfDqePMce64UBwbl4XLw+3FHcKdxt3ADeE+4Ul4Hbwd3h+fgBfiN+BL8A34U/gb+Gf4MYISwZDgSgglcAkrCIWEakIn4RphiDBGVCYaE92JUcQ04npiKbGJeJ74kPiORCLpkVxI4SQBaR2plHSEdJE0QPpMViGbkX3IiWQpeTu5ltxFvkd+R6FQjChelARKFmU7pZ5ylvKY8kmBqmClwFLgKqxVKFdoU7ih8FqRoGioyFRcpJijWKJ4VPGa4islgpKRko8SW2mNUrnScaV+pVFlqrKtcqhypvJW5QblS8rPVXAqRip+KlyVXJUqlbMqg1QUVZ/qQ+VQN1KrqeepQzQszZjGoqXRCmiHab20EVUV1TmqMarLVctVT6rK6Ci6EZ1Fz6AX0lvod+hfZmnNYs7izdoyq2nWjVkf1Wareanx1PLVmtVuq31RZ6j7qaer71RvV3+kgdYw0wjXWKZxQOO8xqvZtNluszmz82e3zL6vCWuaaUZortSs0ryqOaqlrRWgJdLaq3VW65U2XdtLO027WPuU9rAOVcdDR6BTrHNa5wVDlcFkZDBKGecYI7qauoG6Ut0K3V7dMT1jvWi9DXrNeo/0ifrO+in6xfrd+iMGOgbzDFYZNBrcNyQYOhvyDfcY9hh+NDI2ijXabNRu9NxYzZhlnGPcaPzQhGLiabLUpNLklinW1Nk03XS/6XUz2MzBjG9WbnbNHDZ3NBeY7zfvs8BYuFgILSot+i3JlkzLbMtGywErulWI1QardqvX1gbWCdY7rXusv9s42GTYVNs8sFWxDbLdYNtp+9bOzI5jV253y55i72+/1r7D/s0c8zm8OQfm3HWgOsxz2OzQ7fDN0clR7NjkOOxk4JTktM+p35nmHOa81fmiC8bF22WtywmXz66OrlmuLa5/uFm6pbs1uD2fazyXN7d67qC7njvbvcJd5sHwSPL40UPmqevJ9qz0fOKl78X1qvF6xjRlpjEPMV9723iLvVu9P/q4+qz26fJF+Qb45vv2+qn4RfuV+T321/NP9W/0HwlwCFgZ0BWICQwO3BnYz9JicVj1rJEgp6DVQeeCycGRwWXBT0LMQsQhnfPgeUHzds17ON9wvnB+eygIZYXuCn0UZhy2NOyXcGx4WHh5+NMI24hVET2R1MjFkQ2RH6K8owqjHkSbREuju2MUYxJj6mM+xvrGFsXK4qzjVsddideIF8R3JOASYhJqEkYX+C3YvWAo0SExL/HOQuOFyxdeWqSxKGPRycWKi9mLjyZhkmKTGpK+skPZlezRZFbyvuQRjg9nD+cl14tbzB3mufOKeM9S3FOKUp6nuqfuSh3me/JL+K8EPoIywZu0wLSDaR/TQ9Nr08czYjOaM/GZSZnHhSrCdOG5JdpLli/pE5mL8kSypa5Ldy8dEQeLaySQZKGkI4uGNEdXpSbSTdKBbI/s8uxPy2KWHV2uvFy4/OoKsxVbVjzL8c/5aSV6JWdl9yrdVetXDaxmrq5YA61JXtO9Vn9t7tqhdQHr6tYT16ev/3WDzYaiDe83xm7szNXKXZc7uClgU2OeQp44r3+z2+aDP6B/EPzQu8V+y94t3/O5+ZcLbApKCr5u5Wy9vM12W+m28e0p23sLHQsP7MDuEO64s9NzZ12RclFO0eCuebvaihnF+cXvdy/efalkTsnBPcQ90j2y0pDSjr0Ge3fs/VrGL7td7l3evE9z35Z9H/dz99844HWg6aDWwYKDX34U/Hi3IqCirdKosqQKW5Vd9bQ6prrnJ+ef6ms0agpqvtUKa2V1EXXn6p3q6xs0Gwob4UZp4/ChxEPXD/se7miybKpopjcXHAFHpEde/Jz0852W4Jbuo85Hm44ZHtvXSm3Nb4PaVrSNtPPbZR3xHX3Hg453d7p1tv5i9UvtCd0T5SdVTxaeIp7KPTV+Ouf0aJeo69WZ1DOD3Yu7H5yNO3vrXPi53vPB5y9e8L9wtofZc/qi+8UTl1wvHb/sfLn9iuOVtqsOV1t/dfi1tdext+2a07WO6y7XO/vm9p264XnjzE3fmxdusW5duT3/dt+d6Dt3+xP7ZXe5d5/fy7j35n72/bEH6x5iHuY/UnpU8ljzceVvpr81yxxlJwd8B64+iXzyYJAz+PJ3ye9fh3KfUp6WPNN5Vv/c7vmJYf/h6y8WvBh6KXo59irvH8r/2Pfa5PWxP7z+uDoSNzL0Rvxm/O3Wd+rvat/Ped89Gjb6+EPmh7GP+Z/UP9V9dv7c8yX2y7OxZV9xX0u/mX7r/B78/eF45vi4iC1mT7YCKGTAKSkAvK0FgBIPAPU6AMQFUz31pKCp/4BJAv+Jp/ruSTkCgIQC0V0ATLRoVX+2tIrIe5gXAFFeALa3l48/JUmxt5uKRWpHWpOS8fF3SP+IMwXgW//4+Fj7+Pi3GqTY+wB0fZjq5SekjfxXLMADqHzTrZYB8K/6J1bAD27htQDfAAAACXBIWXMAABYlAAAWJQFJUiTwAAACBGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iWE1QIENvcmUgNS40LjAiPgogICA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPgogICAgICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIgogICAgICAgICAgICB4bWxuczpleGlmPSJodHRwOi8vbnMuYWRvYmUuY29tL2V4aWYvMS4wLyIKICAgICAgICAgICAgeG1sbnM6dGlmZj0iaHR0cDovL25zLmFkb2JlLmNvbS90aWZmLzEuMC8iPgogICAgICAgICA8ZXhpZjpQaXhlbFlEaW1lbnNpb24+NDY4PC9leGlmOlBpeGVsWURpbWVuc2lvbj4KICAgICAgICAgPGV4aWY6UGl4ZWxYRGltZW5zaW9uPjQ2NjwvZXhpZjpQaXhlbFhEaW1lbnNpb24+CiAgICAgICAgIDx0aWZmOk9yaWVudGF0aW9uPjE8
1L3RpZmY6T3JpZW50YXRpb24+CiAgICAgIDwvcmRmOkRlc2NyaXB0aW9uPgogICA8L3JkZjpSREY+CjwveDp4bXBtZXRhPgrdRrnkAAADWklEQVRIDZ1VW08TQRT+uvRqCBoI5ckCD3JRjEALCfFNMJHfIH9B0V+BkIj6omgiEilPBiFyT+TRAAX1wQj0JpBIFYQaa6Db7WWcc8rWBKl2nWR2Z3bOfOf2nbMmfzAk1tfWYLfbkclkABN4KIqCpJZEs7sZ5eVOpFIpmExHh1mRwp53+/uFlMw7P3xcFRkhxGEiIVQtaXiaHQ4HW+LxtCAS2UZxcTHS6TS2IxG8np/HhfP1SEhPFJNSmMXHpJRMhowHYrEfUkEEaiKBcDgMr3cEl9vaEFcTx64Y2yp6zK1WG5wVFUglk4wwNPQMgVAYp+y2bG6M4eakFY6+3MbVOHZ3dqCqKmpqazE5MQGPTHAw/ImVUNj+ZyhWq5XvlZWVoae3F9FoFAG/Hw0NF/EzFkODzIHuicy1cR29fX3MIN/yirwvxIvRUd47nRVCesJrm80mAqGQSMvzQ9UYm/D23Xux6FtmcKIhUXJ0bIyBJf/FpcZGXkvTxe7evkhLgYO4WjBdQVYRaDyh5awjbS/Hxhn4rMvF74ePBvg8kUyxbKE1gd/AGltFIaBvNMZfTTD4wOMnIiWt0FLpHDjJHar/9sRElhzPHLWMoqIiULsIh0JwVVbCYrEgKSlM36ltyLzI4oOsG43ljmPo+xMV0KF0gGXsVgtkWHhPCgncIWvj294+Dg8OUFXpoijkVZK3/qmx0ZShYHBaUy1Q4UWj39F98waqqyqxHgjCYbPyWbalZY2jKLCRhSaLYk55iHzdEde7ujg35CjN1XU/pYzZRXKESSMpKYdCFRA1aSwsLjHouZoa0djUlFOkKyEiEOb07Kz4HPlSuAK6ROwiWk9OzzBwSUmJqD0qRt0TovzTwUE+f7OwaFyB7v7k1DSDyPYu6urreX2lvV303OnlNSn0rawYU6B7odfJ1JEnBFZXV5cDdrvdvF5c8om8LJKXThzEJhkFyh06O69hZm6O5YLBIFwuF6qqq+W/JZa9K+vEsAK6SfVANKR/VUfHVXTfus001TQNmxsboLeuwXy0MvQiD8xmM4N6h5/jwf17aGltRTwex+kzZ1BaWoqtra0sJsXV6KQcEFuGvSO5uEu0P9bEoryt4m8ukQfUkwKBALY2N7kv8R9Pxlwf0gK4PR78Ak4cQYObEn/YAAAAAElFTkSuQmCC" class="go-mobile-qwiz go-mobile-qwiz'+e+'" />'),u=T("Exit full-screen view"),h.push('<div class="exit-mobile-qwiz exit-mobile-qwiz'+e+'" onclick="'+qname+".exit_mobile ("+e+')" title="'+u+'">'),h.push("</div>"),h.push('<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAAlwSFlzAAALEwAACxMBAJqcGAAAAVlpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IlhNUCBDb3JlIDUuNC4wIj4KICAgPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICAgICAgPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIKICAgICAgICAgICAgeG1sbnM6dGlmZj0iaHR0cDovL25zLmFkb2JlLmNvbS90aWZmLzEuMC8iPgogICAgICAgICA8dGlmZjpPcmllbnRhdGlvbj4xPC90aWZmOk9yaWVudGF0aW9uPgogICAgICA8L3JkZjpEZXNjcmlwdGlvbj4KICAgPC9yZGY6UkRGPgo8L3g6eG1wbWV0YT4KTMInWQAAAoVJREFUSA2lVj2PEkEY3plZV5I9Q3KBqzFHQkFJaCx0sTCxo6EnsfMPWPjBctqoueqMNf/CwtODxo7ySCxMaAjhgiRGiXjsh8+zzl5WKoZ7k+GdnZ33ed6PeWdRtVrtxnQ6jWxbvrUs8SCO449cq1Qqst1uWxBVr9fFaDSKW62WouaikTiO0xVCxBy2bXdpXC6Xb5ZKpZzv+xKkIp/PH3JuBMzN9FyD/4Fea5IjvmMk1FLKExAfc24sMH6tCQgeYgSa5BXB4MAz/ewbg6cG8M4niAZPotDPZ1ozdZ10v5GuVqsODTIkJGIkkQZn6q5qYwSOzbJYLEYsaBAEvlLqpQYQWq+h07leMlPS87wI4IIFhX4B8zMNGkAnRTaD/H+37Pf7PO+Xw+FwzYLidQPjUm9jBCSiRP+U4S+bJ44twaOoc570w+YcNUIjmkuSXzbRcrl8DPOfGOzUbEPR8z0QfFitVp8xNxNGsG2Hpo1nxmC4e1sSOo0DZO90BHO53H2cuIfw7RfGZjqJeWt/331/cfHjG+bmwoJvHoLss1LyHS9Ipl+ZwyeX3x0AeLD9re15EEIM9KrqhGH4BIQSV7vMhqf3bqVSOxu702bkldNH6o5Yp16v57CJd42ggQjuAZCec5CIchvpsyeTyWmhUFCLxcK6LgHTklyW0OwfAeK74JDz+fzUdd2UGK8MBACdTFGvrnSs8apPvyddQl4nAg8FfR5F0SOmhZ4DL4kCOsRzA9fPHkmMBXjHOIonNEwbD2tdHRWjSL4hIHhjDM4OPTjIH8JDwTn/GPB7QiCQpF9GfqB8ru2SInV+/vX7YDCwx+OxaDabAU8LCzqbzT7BaxcRfEEvPGV0fwEIA/zW345reQAAAABJRU5ErkJggg==" class="exit-mobile-qwiz exit-mobile-qwiz'+e+'" />');var z=qwizdata[e].n_questions;!(z>1||qwizdata[e].use_dataset||qwizdata[e].use_dataset_questions_htm||qwizdata[e].combo)||q.preview&&!q.preview_i_qwiz_plus1||(d="",qwizdata[e].hide_forward_back_b&&(d=' style="visibility: hidden;"'),u=qwizdata[e].use_dataset&&qwizdata[e].dataset_intro_f?T("Go to “Choose questions”"):T("Go to first question"),h.push('<span class="bbfe-wrapper bbfe-wrapper'+e+'">'),h.push('<span class="bbfe bbfe-qwiz'+e+" bck-question-qwiz"+e+'"'+d+' onclick="'+qname+".bck_question ("+e+', true )" title="'+u+'">'),h.push('<img class="icon-beg-end-qwiz" src="'+w+'/images/icon_beg.svg">'),h.push("</span>"),h.push('<span class="bbfe bbfe-qwiz'+e+" bck-question-qwiz"+e+'"'+d+' onclick="'+qname+".bck_question ("+e+', false)" title="'+T("Go to previous question")+'">'),h.push('<img class="icon-bck-fwd-qwiz" src="'+w+'/images/icon_bck.svg">'),h.push("</span>"),h.push('<span class="question-number-qwiz question-number-qwiz'+e+'"'+d+">"),h.push("</span>"),h.push('<span class="bbfe bbfe-qwiz'+e+" fwd-question-qwiz"+e+'"'+d+' onclick="'+qname+".fwd_question ("+e+', false)" title="'+T("Go to next question")+'">'),h.push('<img class="icon-bck-fwd-qwiz" src="'+w+'/images/icon_fwd.svg">'),h.push("</span>"),h.push('<span class="bbfe bbfe-qwiz'+e+" fwd-question-qwiz"+e+'"'+d+' onclick="'+qname+".fwd_question ("+e+', true )" title="'+T("Go to most-recent question")+'">'),h.push('<img class="icon-beg-end-qwiz" src="'+w+'/images/icon_end.svg">'),h.push("</span>"),h.push("</span>"));d="";l="";if(qwizdata[e].qwiz_timer&&!q.preview&&(d=' style="display: inline-block;"',l="0:00"),h.push('<span id="qwiz'+e+'-qwiz_timer" class="qwiz-timer"'+d+">"+l+"</span>"),qwizdata[e].qrecord_id){h.push('<span class="response_recorded_wrapper response_recorded_wrapper-qwiz'+e+'">'),h.push('<span class="response_recorded response_recorded-qwiz'+e+'">'),h.push(`<img src="${w}/images/recording.svg" class="response_recording" >`),h.push("</span>"),h.push("</span>"),h.push('<div class="qwiz_icon_and_menu_container lock_unlock qwiz'+e+'">'),h.push('<div id="locked-qwiz'+e+'" class="qwiz-locked qwiz_menu_icon">'),h.push(`<img src="${w}/images/icon_locked.png" />`),h.push("</div>"),h.push('<div id="unlocked-qwiz'+e+'" class="qwiz-unlocked qwiz_menu_icon">'),h.push(`<img src="${w}/images/icon_unlocked.png" />`),h.push("</div>"),h.push('<div class="qwiz_icon_trigger_and_menu qwiz-hover">'),h.push('<div class="qwiz_icon_trigger">'),h.push("</div>"),h.push('<div id="pay_unlock_menu-qwiz'+e+'" class="qwiz-pay_unlock_menu qwiz_menu">'),h.push("</div>"),h.push("</div>"),h.push("</div>");var m="";(q.no_intro_b[e]||1==z)&&(m=" qwiz-usermenu_icon_no_intro"),h.push('<div class="qwiz_icon_and_menu_container qwiz'+e+'">'),h.push('<div class="qwiz-usermenu_icon qwiz_menu_icon'+m+'">'),h.push("▼"),h.push("</div>"),h.push('<div class="qwiz_icon_trigger_and_menu qwiz-hover">'),h.push('<div class="qwiz_icon_trigger" style="left: -12px; top: -4px;">'),h.push("</div>"),h.push('<div id="usermenu-qwiz'+e+'" class="qwiz-usermenu qwiz_menu">'),h.push("</div>"),h.push("</div>"),h.push("</div>")}d="",qwizdata[e].hide_progress_b&&(d=' style="display: none;"'),h.push('<div id="progress-qwiz'+e+'" class="qwiz-progress"'+d+">"),h.push("</div>"),h.push("</div>"),h=h.join("\n");var p="";(qwizdata[e].qrecord_id||qwizdata[e].use_dataset)&&(p='<div id="qwiz_login-qwiz'+e+'" class="qwiz-login">\n</div>');var g=[];return z>1||qwizdata[e].use_dataset||qwizdata[e].combo||qwizdata[e].use_dataset_questions_htm||q.qwizard_b?(a&&-1!=a.indexOf("[unpaid")&&-1!=a.indexOf("[/unpaid]")?a=(a=a.replace("[unpaid]",'<span class="unpaid_msg">')).replace("[/unpaid]","</span>"):a+='<span class="unpaid_msg_payment_type unpaid_msg"></span>',qwizdata[e].use_dataset&&!q.preview&&-1==a.indexOf("[restart")&&(a+="<br />[restart]"),a&&(a=create_restart_button(e,a)),q.qwizard_b&&(a=qqc.shortcodes_to_video_elements(a)),qwizdata[e].summary_b&&g.push(create_summary_report_div(e,a))):(1==z&&a&&(a=create_restart_button(e,a),g.push('<div class="single-question_exit">
1'),g.push(a),g.push("</div>")),qwizdata[e].qwizzled_b||qwizdata[e].hotspot_b||qwizdata[e].qrecord_id||qqc.is_mobile(qwizdata[e].mobile_enabled)||q.qwizard_b||(h="")),g.push('<div class="next_button" id="next_button-qwiz'+e+'">\n'),g.push('<button class="qwiz_button" onclick="'+qname+".next_question ("+e+')">'),g.push('<span id="next_button_text-qwiz'+e+'">'),g.push(T("Start quiz")),g.push("</span>"),g.push("</button>\n"),g.push("</div>\n"),qwizdata[e].summary_b||(z>1||qwizdata[e].combo)&&a&&g.push(create_summary_report_div(e,a)),qwizdata[e].hide_qwizcards_icon_b||qwizdata[e].icon_swhs||g.push(create_icon_qwiz_div(e)),g.push("</div>"),i=o+h+p+i+g.join("")+"</div>\n"}function create_icon_qwiz_div(e){const t=qwizdata[e].icon_swhs;var i=[];i.push('<div class="icon_qwiz" id="icon_qwiz'+e+'">');var a=qqc.get_qwiz_param("icon_qwiz");if("Not displayed"!=a){const e=t?"swinginghotspot":"qwizcards";"Icon only"!=a&&i.push('<a href="mailto:support@'+e+'.net" style="border: none; box-shadow: none;">');const _=T("Questions, comments, suggestions?")+" support@"+e+".net";var s;s=t?"iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAIAAAAC64paAAAACXBIWXMAABnWAAAZ1gEY0crtAAABiElEQVQ4jZWSv0sCYRyHnzvvinCIhBwEoyFBcJB0CKSmBJejIWhqbAuhv8DFCAdndRehqVDIKdokWlsEI1qiqesMkQNf77yGC/qh1t0zfvg8vO/3fb/gnUiE8/PvgexDLhQIh330v0ilEILNze+Z8qMRCLC7y+oqqoosI8s4DrZNr0e5jK6jafR6mOYs+fSUoyOenrBtAElClllYYGMDReHiguNj3t6oVmfdrVik2yUU+hFms+g6Z2fkcoxGbG3NGUxVabfpdFha+kySSSwLIahUeH/n5OTPhwkGubuj1UJRANJphMCycBxqtT9Nl3CYx8evwba3MQxublBVDzIQi/H6Sj4P0Gjw8MDKijfTZW8Pw2B/n8GAeNyPCSwv4zjU6zSb8yrz19OyAIJBhkP/8mQCIEmMx/5lF3c9fcvuPwvB4uI/B/xmfZ12m+dnNA3TpFQiEPAs399zfc3aGsDODobB4aFn+fIS2+bqioMD+n1Mk0xmuiXNliWJRIJolJcXolFub+n3p1sfn3l/Jjmrf3gAAAAASUVORK5CYII=":"iVBORw0KGgoAAAANSUhEUgAAABAAAAAUCAIAAAALACogAAAABnRSTlMA/wD/AP83WBt9AAAACXBIWXMAAA7EAAAOxAGVKw4bAAABP0lEQVR4nGP8//8/AymAiSTV5GhgwSZ4rcRrxRooW3futlBnJDlGND/cXzXVccFLVP0oepiwqtZJyH2wrenBtogQBgYGhsv9q15j9cO1qTDVW8JEGRgYGBi0PJ0YGBgYrjzCpuH+qv1rGBgYGHQLoaoZGBgYlOTEGRgYGB68uY+h4fXuQy8ZGBgYnLSRvXjv0UsGBgYGBRFFdA1Prm+6x8DAwBBio4XsyO37GBgYGHTkEHaixYO4mszrWTl1CjmH7iMcKe5nhdAAi4cnL6/A3HbrHgMDw56pJ0QYIOHr5JgmgzASZoOFdggDAwPDy03HRCEhs6YJEne6c0uQHYkUcXt76pL3oTqQQbxqVjay8Sh+cC5pmuuEpkFMWQZNBCNpwMDrWTmT2+5hCCu54EqtomkVLjqYwgoiuGzACWifgQDhK2rq5bcX2gAAAABJRU5ErkJggg==",i.push('<img class="icon_qwiz" style="border: none;" title="'+_+'" src="data:image/png;base64,'+s+'" />'),"Icon only"!=a&&i.push("</a>")}return i.join("")}function create_summary_report_div(e,t){var i=[];return i.push('<div id="summary-qwiz'+e+'" class="qwiz-summary">\n'),i.push('<div id="summary_report-qwiz'+e+'" class="qwiz_summary_report">'),i.push("</div>\n"),i.push('<div id="summary-quiz_times_histogram-qwiz'+e+'">'),i.push("</div>\n"),i.push('<div id="qwiz_exit-qwiz'+e+'" class="qwiz-exit qwiz_editable">'),i.push(t),i.push("</div>\n"),i.push('<button class="summary_exit_mobile_qwiz" onclick="'+qname+".exit_mobile ("+e+')">\n'),i.push("Return to page view"),i.push("</button>\n"),i.push("</div>\n"),i.join("")}function get_login_html(e,t,i,a){t=t?1:0,a=a?1:0;var s="onfocus=\"jQuery ('#qwiz_login-qwiz"+e+" p.login_error').hide ()\"",_="<p>";_+=i?"<strong>"+i+"</strong>":t?"<strong>"+T("Add team member")+"</strong>":"<strong>"+T("Record score/credit")+"</strong>",_+="</p>",_+='<form action="nada" onSubmit="return qwiz_.login ('+e+", "+t+", "+a+')">\n<table border="0" align="center" width="100%"><tr><td><label for="qwiz_username-qwiz'+e+'"><nobr>'+T("Login name")+'</nobr></label></td><td><input type="text" id="qwiz_username-qwiz'+e+'" '+s+' /></td></tr><tr><td><label for="qwiz_password-qwiz'+e+'">'+T("Password")+'</label></td><td><input type="password" id="qwiz_password-qwiz'+e+'" /></td></tr><tr><td style="text-align: right;"><span class="qwiz-remember" title="'+T("Save preference (do not use on shared computer)")+'"><label><span class="qwiz-remember"><input type="checkbox" /> '+T("Remember")+'</span></label></span></td><td><button class="qwiz_button">'+T("Student login")+"</button> ",t||(_+='<button type="button" class="qwiz_button" onclick="qwiz_qcards_common.create_register_taker_screen (\''+qname+"', "+e+", "+a+')">'+T("New student - register")+"</button> "),_+='<button type="button" class="qwiz_login_cancel_no_thanks qwiz_button" onclick="'+qname+".no_login ("+e+","+t+')">',_+=T(t?"Cancel":"No thanks"),_+="</button></td></tr>",t||(_+='<tr><td></td><td class="qwiz-smaller"><a href="'+qqc.get_qwiz_param("secure_server_loc","https://qwizcards.net/admin")+'/password_reset_request" target="_blank">'+T("Forgot password?")+"</a></td></tr>");var o="new_account";return-1!=window.location.href.indexOf("learn-biology.com")&&(o="new_account_smv"),_+='<tr><td colspan="2"><hr style="margin: 5px;"></td></tr><tr><td colspan="2" class="qwiz-center"><b>
1'+T("Teachers: track your students’ progress on quizzes and flashcards")+'. <a href="'+qqc.get_qwiz_param("secure_server_loc","https://qwizcards.net/admin")+"/"+o+'" target="_blank"><nobr>'+T("Create teacher administrative account")+'</nobr></a></b></td></tr></table>\n</form><p class="login_error">'+T("Login incorrect. Please try again")+"</p>\n"}function create_restart_button(e,t,i){var a=t.match(/\[restart[^\]]*\]/);if(a){var s;s=i||1==qwizdata[e].n_questions?T("Do this question again"):qwizdata[e].use_dataset&&qwizdata[e].dataset_intro_f?T("Practice more questions"):T("Take this quiz again");var _=get_attr(qqc.replace_smart_quotes(a[0]),"label");_&&(s=_);var o='<button class="qwiz_button qwiz_restart" onclick="'+qname+"."+(i?"redo_question":"restart_quiz")+" ("+e+')">'+s+"</button>";t=t.replace(a,o)}return t}function create_bg_img_style(e,t){var i="",a=qwizdata[e].bg_img[t];if(a){var s=a.top?a.top+"px":"0";i=' style="background: no-repeat '+(a.left?a.left+"px":"0")+" "+s+" / "+(a.width?a.width+"px":"auto")+" "+(a.height?a.height+"px":"auto")+" url("+a.src+')"';debug[0]&&console.log("[create_bg_img_style] style:",i)}return i}function process_question_attributes(e,t,i,a){set_qwizard_data_b&&(void 0===a&&(a=t),qw.questions_cards[a]={}),qwizdata[e].dataset_id[t]=t,qwizdata[e].unit[t]=qwizdata[e].default_unit;var s=i.match(/\[(<code><\/code>)*q\s*([^\]]*)\]/m)[2];if(s){s=qqc.replace_smart_quotes(s),set_qwizard_data_b&&(qw.questions_cards[a].question_attributes=s),q.qwizard_b&&(qwizdata[e].qwizard_multiple_choice_b[t]="true"==get_attr(s,"multiple_choice"));var _=get_attr(s,"topic",!0);if(_||(_=get_attr(s,"unit",!0)),_){debug[4]&&console.log("[process_question_attributes] question_topics: ",_),set_qwizard_data_b&&(qw.questions_cards[a].topic=_),_=_.split(/; */);for(var o=0;o<_.length;o++){_[o]=_[o].replace(/\s/g,"_");var n=_[o];-1==qwizdata[e].topics.indexOf(n)&&qwizdata[e].topics.push(n)}qwizdata[e].question_topics[t]=_}if(qwizdata[e].use_dataset||qwizdata[e].dataset||qwizdata[e].use_dataset_question_ids[t]){const i=get_attr(s,"dataset_id");i&&(qwizdata[e].dataset_id[t]=i)}var r=get_attr(s,"unit");r&&(qwizdata[e].unit[t]=r,set_qwizard_data_b&&(qw.questions_cards[a].unit=r),-1==qwizdata[e].units.indexOf(r)&&qwizdata[e].units.push(r));var d=get_attr(s,"level");d&&(qwizdata[e].level[t]=d,set_qwizard_data_b&&(qw.questions_cards[a].level=d),-1==qwizdata[e].levels.indexOf(d)&&qwizdata[e].levels.push(d));var c=get_attr(s,"use_dataset_question");c&&(qwizdata[e].use_dataset_question_ids[t]=c,qwizdata[e].dataset_id[t]=c,set_qwizard_data_b&&(qw.questions_cards[a].from_dataset_b=!0));var l=get_attr(s,"bg_img_src");if(l){var w={};w.src=l,w.left=get_attr(s,"bg_img_left"),w.top=get_attr(s,"bg_img_top"),w.width=get_attr(s,"bg_img_width"),w.height=get_attr(s,"bg_img_height"),qwizdata[e].bg_img[t]=w,set_qwizard_data_b&&(qw.questions_cards[a].bg_img=w)}const i=get_attr(s,"hotspot_user_interaction");i&&(qwizdata[e].hotspot_user_interaction[t]=i,set_qwizard_data_b&&(qw.questions_cards[a].hotspot_user_interaction=i));const h=get_attr(s,"hotspot_labels_stick");h&&(qwizdata[e].hotspot_labels_stick[t]=h,set_qwizard_data_b&&(qw.questions_cards[a].hotspot_labels_stick=h));const u=get_attr(s,"show_hotspots");u&&(qwizdata[e].show_hotspots[t]=u,set_qwizard_data_b&&(qw.questions_cards[a].show_hotspots=u));const z=get_attr(s,"find_the_dot_width");z&&(qwizdata[e].find_the_dot[t]={},qwizdata[e].find_the_dot[t].width=z,qwizdata[e].find_the_dot[t].height=get_attr(s,"find_the_dot_height"),qwizdata[e].find_the_dot[t].dot_color=get_attr(s,"find_the_dot_dot_color"),qwizdata[e].find_the_dot[t].background_color=get_attr(s,"find_the_dot_background_color"),qwizdata[e].find_the_dot[t].controls="false"!=get_attr(s,"find_the_dot_controls"),qwizdata[e].find_the_dot[t].new_dot_button_style=get_attr(s,"find_the_dot_new_dot_button_style"));const m=get_attr(s,"prompt_intro"),p=get_attr(s,"prompt_intro_add"),g=get_attr(s,"prompt_for_question"),b=get_attr(s,"prompt_for_response"),f=get_attr(s,"response_min_chars"),v=get_attr(s,"prompt_for_feedback");(m||p||g||b||f||v)&&(qwizdata[e].prompt_intro||(qwizdata[e].prompt_intro={},qwizdata[e].prompt_intro_add={},qwizdata[e].prompt_for_question={},qwizdata[e].prompt_for_response={},qwizdata[e].response_min_chars={},qwizdata[e].prompt_for_feedback={})),m&&(qwizdata[e].prompt_intro[t]=m),p&&(qwizdata[e].prompt_intro_add[t]=p),g&&(qwizdata[e].prompt_for_question[t]=g),b&&(qwizdata[e].prompt_for_response[t]=b),f&&(qwizdata[e].response_min_chars[t]=f),v&&(qwizdata[e].prompt_for_feedback[t]=v);const y=get_attr(s,"random_mc");y&&(void 0===qwizdata[e].random_mc&&(qwizdata[e].random_mc={}),qwizdata[e].random_mc[t]="true"==y)}return _}function check_questions_have_topics(e){for(var t=!1,i=0;i<qwizdata[e].n_questions;i++)qwizdata[e].information_question_b[i]||qwizdata[e].question_topics[i]||(qwizdata[e].question_topics[i]=["Other"],t=!0);t&&-1==qwizdata[e].topics.indexOf("Other")&&qwizdata[e].topics.push("Other"),debug[4]&&console.log("[check_questions_have_topics] qwizdata[i_qwiz].question_topics:",qwizdata[e].question_topics),qwizdata[e].topic_statistics={};for(var a=qwizdata[e].topics.length,s=0;s<a;s++){var _=qwizdata[e].topics[s];qwizdata[e].topic_statistics[_]={},qwizdata[e].topic_statistics[_].n_correct=0,qwizdata[e].topic_statistics[_].n_incorrect=0}}function start_timers(e,t){if(debug[0]&&console.log("[start_timers] i_qwiz:",e,", question_time_limit_sec:",t),!q.preview){if(qwizdata[e].question_time_limit&&!qwizdata[e].question_timer_interval_id&&t){const i=$("#qwiz"+e+"-question_timer");qwizdata[e].$question_timer=i;const a=qqc.hhmmss_from_sec(t);i.html(a).show(),q.qwizard_b||(qwizdata[e].question_timer_interval_id=setInterval(update_timer,1e3,e,!0),qwizdata[e].times_up_msec=(new Date).getTime()+1e3*t+500)}if(qwizdata[e].qwiz_timer&&!qwizdata[e].qwiz_timer_interval_id){const t=$("#qwiz"+e+"-qwiz_timer");qwizdata[e].$qwiz_timer=t,q.qwizard_b||(qwizdata[e].qwiz_timer_interval_id=setInterval(update_timer,1e3,e),qwizdata[e].n_qs_done&&0!=qwizdata[e].n_qs_done.size||(qwizdata[e].timer_cumulative_sec=0))}}}function stop_timer(e,t=!1,i){if(i)qwizdata[e].question_timer_interval_id&&(clearInterval(qwizdata[e].question_timer_interval_id),qwizdata[e].question_timer_interval_id="");else if(qwizdata[e].qwiz_timer_interval_id){if(clearInterval(qwizdata[e].qwiz_timer_interval_id),qwizdata[e].qwiz_timer_interval_id="",!t&&qwizdata[e].qrecord_id&&document_qwiz_user_logged_in_b&&qwizdata[e].n_qs_done&&qwizdata[e].n_qs_done.size==qwizdata[e].n_qs){const t=qwizdata[e].timer_cumulative_sec;qwizdata[e].when_done_unix=0;var a={elapsed_time:t,callback:"record_quiz_time_callback"};qqc.jjax(qname,e,qwizdata[e].qrecord_id,"record_quiz_time",a)}-1!=qwizdata[e].qrecord_id.indexOf("finish_times_demo")&&(qwizdata[e].elapsed_time=qwizdata[e].timer_cumulative_sec)}}function update_timer(e,t){var i;if(t){(i=parseInt((qwizdata[e].times_up_msec-(new Date).getTime())/1e3))<=0&&(times_up(e),i=0);const t=qqc.hhmmss_from_sec(i);qwizdata[e].$question_timer.html(t)}
1else{qwizdata[e].timer_cumulative_sec++;const t=qqc.hhmmss_from_sec(qwizdata[e].timer_cumulative_sec);qwizdata[e].$qwiz_timer.html(t)}}function times_up(e){stop_timer(e,!0,!0),qwizdata[e].$question_timer.html("0:00"),$("div#overlay-times-up-qwiz"+e).show(),qwizdata[e].n_incorrect++,update_progress_show_next(e)}function check_timers(){for(var e=0;e<n_qwizzes;e++)if(qwizdata[e].question_timer_interval_id||qwizdata[e].qwiz_timer_interval_id){stop_timer(e,!0,!0),stop_timer(e,!0),restart_timers_i_qwiz=e;break}}function hide_current_question(e,t){var i=`qwiz${e}-q${t}`;$(`div#${i}, div.${i}`).hide(),$(`div#mobile_${i}, div.mobile_${i}`).hide()}function scale_quiz_to_container_when_visible(e,t){debug[0]&&(console.log("[scale_quiz_to_container_when_visible] entries:",e),console.log("[scale_quiz_to_container_when_visible] observer:",t));const i=$(e[0].target);i.is(":visible")&&(scale_quiz_to_container(i),t.unobserve(e[0].target))}function scale_quiz_to_container(e){var t=e.outerWidth(),i=e.parent();if(i.length){var a=i.width();if(a>0&&t>a){const s=a/t,_=Math.round(50*(1-s)),o="rtl"==getComputedStyle(i[0]).direction?1:-1;e.css({transform:"translate("+o*_+"%, -"+_+"%) scale("+s.toFixed(3)+")"}),qqc.offset_height_rescale(e,s);const n=e[0].id.match(/qwiz(\d+)/);if(n){const t=n[1];debug[0]&&(console.log("[scale_quiz_to_container] $qwiz:",e),console.log("[scale_quiz_to_container] i_qwiz:",t)),qwizdata[t].width_reset=!0}e[0].qscale_fac=s}}}function get_my_previous_answer(e,t){qwizdata[e].dataset_id[t]}function record_response(e,t,i,a){if(!q.preview&&!q.qwizard_b&&!a){const t=DateFormat.format.date((new Date).getTime(),"h:mm:ss");$("span.response_recorded_wrapper-qwiz"+e).css({display:"inline-block"}).attr("title",T("Recording your response at")+" "+t+" - "+T("not complete"));$(`span.response_recorded-qwiz${e} img.response_recording`).addClass("response_recording_spin").removeAttr("title")}if(document_qwiz_maker_privileges||document_qwiz_mobile||$.cookie(document_qwiz_username+"do_not_show_assign_to_class")||"start"!=i.type||!qwizdata[e].qrecord_id_not_ok||("not in a class"==qwizdata[e].qrecord_id_not_ok?($(".has_not_been_assigned").hide(),$(".not_in_a_class").show(),$("div#qwizcards_dialog_no_credit").parent().find(".ui-dialog-title").html(T("You are not in a class"))):(qwiz_.assign_to_class_i_qwiz=e,qwiz_.assign_to_class_qrecord_id=t,$(".has_not_been_assigned").show(),$(".not_in_a_class").hide(),$("div#qwizcards_dialog_no_credit").parent().find(".ui-dialog-title").html(T("Quiz not assigned in your class"))),qwiz_.$dialog_no_credit.dialog("open").dialog("moveToTop")),i.correct_b&&!i.secure_f){update_progress_meter(e,t,decodeURIComponent(atob(i.q_and_a_text)),i.q_and_a_crc32,i.type)}var s=t;if(qwizdata[e].combo)if(qwizdata[e].question_qrecord_ids){var _=Math.max(qwizdata[e].i_question,0);s=qwizdata[e].question_qrecord_ids[_]}else s=qwizdata[e].combo_qrecord_id;qqc.qjax(qname,e,s,"record_response_v4",i)}function update_progress_meter(e,t,i,a,s){if(!qqc.question_card_ids_by_qrecord_id)return;let _=i+"||"+a+"||"+s;if(qqc.question_card_ids_by_qrecord_id[t]){if(-1==qqc.question_card_ids_by_qrecord_id[t].indexOf(_)){qqc.question_card_ids_by_qrecord_id[t].push(_);const i=qqc.question_card_ids_by_qrecord_id[t].length;$(`div.qwiz-progress_meter-qwiz${e}`).css({"--m":i})}}else qqc.question_card_ids_by_qrecord_id[t]=[_],$(`div.qwiz-progress_meter-qwiz${e}`).css({"--m":1})}function reset_label_positions(e){debug[8]&&console.log("[reset_label_positions] $qwizq:",e),e.find("td.qwizzled_labels div.qwizzled_label").each((function(){var e=$
1(this).parents("li").offset();debug[8]&&console.log("[reset_label_positions] label_offset:",e),$(this).data("label_x",e.left).data("label_y",e.top)}))}function process_multiple_choice(e,t,i,a){var s,_,o="",n=qqc.opening_tag_shortcode_pos("([c]|[c*])",i);if(n==i.length)errmsgs.push(T('Did not find choices ("[c]")')+". qwiz: "+(e+1)+", "+T("question")+" "+(t+1)),s="",_="";else{var r,d=i.substr(0,n),c=i.match(/\[c\*{0,1}\]/gm),l=0;if(c&&(l=c.length),debug[0]&&(console.log("[process_multiple_choice] n_choices: ",l),console.log("[process_multiple_choice] span_pos: ",n),console.log("[process_multiple_choice] question_htm: ",d)),qwizdata[e].qrecord_id)qqc.isInteger(qwizdata[e].dataset_id[t])?(r=qqc.remove_tags_eols(d),qwizdata[e].q_and_a_text[t]=qqc.q_and_a_hash(r),qwizdata[e].q_and_a_crc32[t]=qwiz_crc32(i)):(qwizdata[e].q_and_a_text[t]=qwizdata[e].dataset_id[t],qwizdata[e].q_and_a_crc32[t]="dataset");if(set_qwizard_data_b&&(qw.questions_cards[t].type="multiple_choice",d=qqc.shortcodes_to_video_elements(d),qw.questions_cards[t].question_text=a+d),1==l){const i=new RegExp("\\[response[^\\]]*\\]"),s=d.match(i);var w=!1,h=!1;if(s||qwizdata[e].generative_feedback){s&&s.length>1&&errmsgs.push(T("More than one [response]")+". qwiz: "+(e+1)+", "+T("question")+" "+(1+t)),s||(d+="[response]",h=!0),w=!0,qwizdata[e].generative_response||(qwizdata[e].generative_response={}),qwizdata[e].generative_response[t]=!0;const _=`\n <div class="qwiz-grow-wrap">\n <textarea id="check_my_answer-qwiz${e}-q${t}" class="qwiz-grow-wrap" onfocus="${qname}.hide_check_my_answer_feedback (${e}, ${t})" oninput="this.parentNode.dataset.replicatedValue=this.value" placeholder="Enter your response"></textarea>\n </div>`;d=q.qwizard_b?create_hangman_textentry_editable_divs(e,t,a,[_],"response",i,d):`<div class="qwiz${e}-q${t} qwizq">\n ${a}${d.replace(i,_)}\n </div>`;d+=`<div style="text-align: right">\n <input class="qwiz${e}-q${t}-generative_hint generative_hint" maxlength="50" placeholder="Ask for a hint (50 letters max)" />\n <button class="qwiz_button_small" onclick="${`${qname}.generate_custom_feedback (${e}, ${t}, this, true)`}">\n ${T("Get hint")}\n </button>\n </div>`}}_=i.substr(n),o="</p>"}set_qwizard_data_b&&(qw.questions_cards[t].n_choices=l,qw.questions_cards[t].choices=[],qw.questions_cards[t].feedbacks=[]);for(var u=0,z=["[c]","[c*]"],m=["[c]","[c*]","[x]"],p=!1,g=-1,b=[],f=[],v=[],y=-1,x=0;x<l;x++){var k=qqc.parse_html_block(_,z,m);if(_=_.substr(k.length),q.wordpress_page_f&&-1!=(k=cvt_feedback(k)).indexOf("[c*]")&&(c[x]="[c*]"),k=(O=process_feedback_item(k,e,t,x,w)).choice_html,O.feedback_div)if(x!=l-1||p||1==l){p=!0,O.fx_b&&(-1==g?g=b.length:errmsgs.push(T("Got more than one [fx]")+". qwiz: "+(1+e)+", "+T("question")+" "+(1+t))),b.push(O.feedback_div),f.push(O.feedback_item_html),(O=process_feedback_item(k,e,t,A)).feedback_div&&errmsgs.push(T("More than one feedback shortcode [f] or [fx] given with a choice")+". qwiz: "+(1+e)+", "+T("question")+" "+(1+t)+", "+T("choice")+" "+(1+x))}else{b[0]=O.feedback_div,f[0]=O.feedback_item_html;var $=1;O.fx_b&&(g=0,$=0);for(var A=1;A<l;A++){if(k=(O=process_feedback_item(k,e,t,A)).choice_html,!O.feedback_div)break;b[A]=O.feedback_div,f[A]=O.feedback_item_html,O.fx_b?-1==g?g=A:errmsgs.push(T("Got more than one [fx]")+". qwiz: "+(e+1)+", "+T("question")+" "+(1+t)):$++}1==$||-1!=g?(b[l-1]=b[0],b[0]="",f[l-1]=f[0],f[0]="",0==g&&(g=l-1)):$!=l?errmsgs.push(T("Number of feedback items does not match number of choices")+". qwiz: "+(1+e)+", "+T("question")+" "+(1+t)):b[0]=b[0].replace(/(qwiz[0-9]+-q[0-9]+-a)[0-9]+/,"$10")}else b.push(""),f.push("");debug[2]&&console.log("[process_multiple_choice] feedback_divs:",b);var C=k.match(/\[c\*{0,1}\]/m)[0],I=k.replace(/\[c\*{0,1}\]/m,"");if(v.push(I),k=/^\s*<([ph]|br)/.test(I)?I.replace(/^\s*<([ph]|br)[^>]*>/,"$&"+C):C+I,q.qwizard_b)k=k.replace(/  /g,"");else(R=k.match(/(<\/p>|<br>)\s*$/))||(R=k.match(/  \s*$/))||(k+="  ");if(l>1||q.qwizard_b&&qwizdata[e].qwizard_multiple_choice_b[t]){var O;(O=create_radio_button_html(e,t,x,c[x])).correct&&(u++,y=x);var j=(G="qwiz"+e+"-q"+t)+"-a"+x,S="";if(q.qwizard_b&&(S=' style="cursor: text;"'),k=k.replace(/\[c\*{0,1}\]/m,O.htm+'<span class="qwiz-choice qwiz_editable" data-i_choice="'+x+'"'+S+">"),/^\s*<[ph]/.test(k)){var E=(k=k.trimEnd()).length;if("</p"!=k.substr(E-4,3)&&"</h"!=k.substr(E-5,3)){var M=k.indexOf(">");-1!=M&&(o+=k.substr(0,M+1),k=k.substr(M+1)),k+="</span>"}else k=k.replace(/<\/(p|h[1-6])>$/,"</span>$&")}else k+="</span>";if(set_qwizard_data_b){var R=k.match(/<span class="qwiz-choice[^>]+>/),Y=(R=k.match(/<span class="qwiz-choice[^>]+>([^]*?)<\/span>/),qqc.shortcodes_to_video_elements(R[1]));qw.questions_cards[t].choices[x]=Y}const i='onclick="'+qname+".process_choice (event, '"+j+"')\"";var N="";qwizdata[e].mc_style&&"radio"!=qwizdata[e].mc_style&&(N="-"+qwizdata[e].mc_style),debug[2]&&(console.log("[process_multiple_choice] choices_html:",o),console.log("[process_multiple_choice] choice_html:",k));var B="";if(x==l-1&&!N){const e=o.match(/<p[^>]*>\s*$/);e&&(i_pos=e.index,o=o.substr(0,i_pos)+'<span class="qwiz-choices">'+o.substr(i_pos),B="</span>")}o+=`<span class="choices-${G} choice-${j} qwiz-choices${N}" ${i} data-i_choice="${x}">
1\n\n <span class="qwiz-choice" data-i_choice="${x}'">\n ${k}\n </span>\n </span>\n `+B}else{k=k.replace(/\[c\*{0,1}\]/m,""),y=0,u=1,Q=w?`${qname}.generate_custom_feedback (${e}, ${t}, this)`:1==qwizdata[e].n_questions?`${qname}.process_choice (event, 'qwiz${e}-q${t}-a0', true)`:`${qname}.show_answer_got_it_or_not (${e}, ${t}, this)`;var F=k;if(w?F=T("Check my answer"):-1!=F.indexOf("[show_me_placeholder]")&&(F=T("Show me the answer")),o+=`<button class="qwiz_button show_the_answer qwiz-choice" data-i_choice="0" style="margin-left: 20px !important;" onclick="${Q}">\n <div class="check_show_answer qwiz_editable" style="padding: 0;">\n ${F}\n </div>\n </button>\n`,w){Q=`${qname}.stuck_show_answer (event, ${e}, ${t})`,o+=`<button class="qwiz_button show_the_answer qwiz-choice ${q.qwizard_b?"":"qwiz_editable"}" data-i_choice="1" onclick="${Q}">`,o+="I’m stuck – show me the answer",o+="</button>\n";o+=`<div class="qwiz${e}-q${t}-spinner qwiz-center" style="display: none;">\n <img src="${qqc.get_qwiz_param("url","./")}images/spinner40x40.gif" />'\n </div>`}set_qwizard_data_b&&(qw.questions_cards[t].type="show_me",w&&(qw.questions_cards[t].generative_response=!0),k=qqc.shortcodes_to_video_elements(k),qw.questions_cards[t].choices[x]=k),b[0]||errmsgs.push(T("Feedback [f] is required for a one-choice question")+". qwiz: "+(1+e)+", "+T("question")+" "+(1+t))}}if(set_qwizard_data_b&&"show_me"!=qw.questions_cards[t].type){debug[12]&&console.log("[process_multiple_choice] choices_html:",o);var L=o.substr(31).indexOf("<span");-1!=L&&-1==o.substr(31+L).search(/<p|<h[1-6]|<br/)&&(qw.questions_cards[t].choices_inline=!0)}s=`<div id="qwiz${e}-q${t}" class="qwiz${e}-q${t} qwizq" ${create_bg_img_style(e,t)}>\n\n ${w?d:`<div class="qwiz-question qwiz_editable">\n ${d}\n </div>`}\n ${o}`,debug[1]&&console.log("[process_multiple_choice] desktop_htm: ",s),0==u?q.qwizard_b||qwizdata[e].use_dataset||qwizdata[e].use_dataset_question_ids[t]||errmsgs.push(T("No choice was marked correct")+". qwiz: "+(1+e)+", "+T("question")+" "+(1+t)):u>1?errmsgs.push(T("More than one choice was marked correct")+". qwiz: "+(1+e)+", "+T("question")+" "+(1+t)):set_qwizard_data_b&&(qw.questions_cards[t].correct_choice=y);for(x=0;x<l;x++)if(!b[x])if(-1!=g&&x!=y)b[x]=b[g].replace(/(qwiz[0-9]+-q[0-9]+-a)[0-9]+/,"$1"+x);else{var W=q.canned_feedback(x==y);b[x]=create_feedback_div_html(e,t,x,W),f[x]=W}if(s+=b=b.join("\n"),set_qwizard_data_b)for(x=0;x<l;x++)qw.questions_cards[t].feedbacks[x]=qqc.shortcodes_to_video_elements(f[x]);if(1==l&&(qwizdata[e].n_questions>1||qwizdata[e].combo||qwizdata[e].use_dataset)){s+=create_got_it_or_not("",e,t,w?"generative":"")}debug[2]&&console.log("[process_multiple_choice] desktop_htm: ",s),s+="</div>\n";var G=`mobile_qwiz${e}-q${t}`;d=d.replace(/qwiz(\d+)/g,"mobile_qwiz$1");var D=[];D.push(`<div id="${G}" class="${G} qwizq-mobile">\n`),D.push(d),D.push('<ul class="mobile_choices">');for(x=0;x<l;x++){j=G+"-a"+x;var Q,P,U=x==y?'data-q="1"':"";w?Q=`${qname}.generate_custom_feedback (${e}, ${t}, this)`:l>1||1==qwizdata[e].n_questions?Q=qname+".process_choice (event, '"+j+"')":(Q=qname+".show_answer_got_it_or_not ("+e+", "+t+", this)",-1!=v[0].indexOf("[show_me_placeholder]")&&(v[0]="Show me the answer")),P=h?"Check my answer":v[x],D.push('<li id="choice-'+j+'" class="mobile_choice" onclick="'+Q+'" '+U+">"),D.push('<div class="mobile_choice">'),D.push(P),D.push("</div>"),D.push("</li>")}if(w&&(Q=`${qname}.stuck_show_answer (event, ${e}, ${t})`,D.push('<li id="choice-'+j+'" class="mobile_choice" onclick="'+Q+'" '+U+">"),D.push('<div class="mobile_choice">'),D.push("I’m stuck – show me the answer"),D.push("</div>"),D.push("</li>")),D.push("</ul>"),D.push('<div style="clear: both;"></div>'),w){const i=qqc.get_qwiz_param("url","./");D.push(`<div class="qwiz${e}-q${t}
1-spinner qwiz-center" style="display: none;">\n <img src="${i}images/spinner40x40.gif" />'\n </div>`)}if(D.push(b.replace(/id="qwiz/gm,'id="mobile_qwiz')),1==l&&(qwizdata[e].n_questions>1||qwizdata[e].combo||qwizdata[e].use_dataset)){const i=w?"generative":"";D.push(create_got_it_or_not("mobile_",e,t,i))}return D.push("</div>"),s+"\n"+(D=D.join("\n"))}function process_textentry(e,t,i,a){qwizdata[e].textentry||(qwizdata[e].textentry={},textentry_b=!0);var s=i,_=qqc.opening_tag_shortcode_pos("([c*]|[c])",i);if(_<i.length?s=i.substr(0,_):errmsgs.push(T("No answer-word given")+". qwiz: "+(1+e)+", "+T("question")+" "+(1+t)),qwizdata[e].qrecord_id)if(qqc.isInteger(qwizdata[e].dataset_id[t])){var o=qqc.remove_tags_eols(s);o=o.replace(/\[textentry[^\]]*\]/,"_________"),qwizdata[e].q_and_a_text[t]=qqc.q_and_a_hash(qqc.remove_tags_eols(o)),qwizdata[e].q_and_a_crc32[t]=qwiz_crc32(i)}else qwizdata[e].q_and_a_text[t]=qwizdata[e].dataset_id[t],qwizdata[e].q_and_a_crc32[t]="dataset";set_qwizard_data_b&&(qw.questions_cards[t].type="textentry",s=qqc.shortcodes_to_video_elements(s),qw.questions_cards[t].question_text=a+s,qw.questions_cards[t].choices=[],qw.questions_cards[t].correct_choice_fs=[],qw.questions_cards[t].feedbacks=[]);var n=!1,r=!0,d=3,c="true"==default_use_dict,l="true"==default_use_terms,w=!1,h=i.match(/\[textentry([^\]]*)\]/m),u="";if(h&&(u=h[1])){n="true"==get_attr(u=qqc.replace_smart_quotes(u),"plural"),r="false"!=get_attr(u,"suggest");var z=get_attr(u,"minlength");""!=z&&(d=z);var m=get_attr(u,"use_terms");m&&(l="false"!=m);var p=get_attr(u,"use_dict");p&&(c="false"!=p),w="true"==get_attr(u,"single_char")}set_qwizard_data_b&&(qw.questions_cards[t].type=w?"one_letter_answer":"textentry",qw.questions_cards[t].textentry_attributes=u,qw.questions_cards[t].textentry_plural_b=n);var g,b,f=i.substr(_);i=i.substr(0,_),w?(g="qwiz_single_char_entry",b='style="width: 2rem; padding: 2px;" '):r?(g="qwiz_textentry",b='style="width: 18em; padding: 2px;" '):(g="qwiz_textentry_no_suggest",b='style="width: 18em; padding: 2px;" ');var v,y='<input type="text" id="textentry-qwiz'+e+"-q"+t+'" autocomplete="off" class="'+g+'" '+b+'onfocus="'+qname+'.set_textentry_i_qwiz (event, this)" />',x=new RegExp("\\[textentry[^\\]]*\\]");v=q.qwizard_b?create_hangman_textentry_editable_divs(e,t,a,[y],"textentry",x,i):'<div id="qwiz'+e+"-q"+t+'" class="qwizq">\n'+a+i.replace(x,y),v+='<br /><div id="textentry_check_answer_div-qwiz'+e+"-q"+t+'" class="textentry_check_answer_div">\n<button class="qwiz_button qwiz_button_disabled textentry_check_answer" onclick="'+qname+".textentry_check_answer ("+e+')">'+T("Check answer")+'</button>\n \n<button class="qwiz_button qwiz_textentry_hint" style="display: none; font-size: 11px; padding: 2px 2px; border-radius: 5px;" onclick="'+qname+".textentry_hint ("+e+')" disabled>'+T("Hint")+"</button>\n</div>\n";var k=0,$=["[c]","[c*]"],A=["[c]","[c*]","[x]"],C=[];qwizdata[e].textentry[t]={},qwizdata[e].textentry[t].choices=[],qwizdata[e].textentry[t].textentry_plural_b=n,qwizdata[e].textentry[t].textentry_suggest_b=r,qwizdata[e].textentry[t].textentry_minlength=d,qwizdata[e].textentry[t].use_terms_b=l,qwizdata[e].textentry[t].use_dict_b=c,qwizdata[e].textentry[t].single_char_b=w,qwizdata[e].textentry[t].choices_correct=[],qwizdata[e].textentry[t].answers=[],qwizdata[e].textentry[t].first_correct_answer="",qwizdata[e].check_answer_disabled_b=!0;for(var I=0,O=!1;;){var j=qqc.parse_html_block(f,$,A);if("NA"==j)break;f=f.substr(j.length),q.wordpress_page_f&&(j=cvt_feedback(j)),j=(S=process_feedback_item(j,e,t,I)).choice_html;var S,E="";if(S.feedback_div)!0,C.push(S.feedback_div),E=S.feedback_item_html,(S=process_feedback_item(j,e,t,I)).feedback_div&&errmsgs.push(T("More than one feedback shortcode [f] given with choice")+". qwiz: "+(1+e)+", "+T("question")+" "+(1+t)+", "+T("choice")+" "+(1+I));else C.push("");set_qwizard_data_b&&(qw.questions_cards[t].feedbacks[I]=qqc.shortcodes_to_video_elements(E));var M=-1!=j.search(/\[c\*\]/);M&&k++,j=j.replace(/[^]*\[c\*{0,1}\]/,""),q.qwizard_b&&-1!=j.indexOf("placeholder")||(j=j.replace(/<[^>]+>|\n| /g,"")),-1==j.replace(";","").search(/\S/)&&errmsgs.push(T("No word(s) given for [textentry] choice")+". qwiz: "+(e+1)+", "+T("question")+" "+(1+t)+", "+T("choice")+" "+(1+I));for(var R=j.split(/\s*;\s*/),Y=[],N=0;N<R.length;N++)-1!=R[N].search(/\S/)&&Y.push(qqc.trim(R[N]));"*"==Y[0]&&(O=!0,M&&errmsgs.push(T('For [textentry] question, wildcard choice ("*", for any other user entry) cannot be marked correct "[c*]"')+". qwiz: "+(e+1)+", "+T("question")+" "+(1+t)+", "+T("choice")+" "+(1+I))),qwizdata[e].textentry[t].choices.push(Y),qwizdata[e].textentry[t].choices_correct.push(M),set_qwizard_data_b&&(qw.questions_cards[t].choices.push(Y.join(";")),qw.questions_cards[t].correct_choice_fs.push(M?1:0)),M&&Y.length&&""==qwizdata[e].textentry[t].first_correct_answer&&(qwizdata[e].textentry[t].first_correct_answer=Y[0]);var B=Y.length;for(N=0;N<B;N++)-1!=qwizdata[e].textentry[t].answers.indexOf(Y[N])&&"Enter word"!=Y&&errmsgs.push(T("Answer given in more than one choice")+": "+Y[N]+". qwiz: "+(e+1)+", "+T("question")+" "+(1+t)+", "+T("choice")+" "+(1+I));qwizdata[e].textentry[t].answers=qwizdata[e].textentry[t].answers.concat(Y),I++}set_qwizard_data_b&&(qw.questions_cards[t].n_choices=I),O||(I++,qwizdata[e].textentry[t].choices.push(["*"]),qwizdata[e].textentry[t].choices_correct.push(!1),set_qwizard_data_b&&(qw.questions_cards[t].choices.push("*"),qw.questions_cards[t].correct_choice_fs.push(0),qw.questions_cards[t].n_choices=I));var F=I;v+='<div style="clear: both;"></div>\n',0==k&&errmsgs.push(T("No choice was marked correct")+". qwiz: "+(1+e)+", "+T("question")+" "+(1+t));for(I=0;I<F;I++)if(!C[I]){var L=q.canned_feedback(qwizdata[e].textentry[t].choices_correct[I]);C[I]=create_feedback_div_html(e,t,I,L),set_qwizard_data_b&&(qw.questions_cards[t].feedbacks[I]=L)}return v+=C.join("\n"),v+="</div>\n",(debug[2]||debug[12])&&console.log("[process_textentry] new_htm: ",v),v}function process_hangman(e,t,i,a){var s=-1!=i.indexOf("hangman_img_wrapper"),_=i,o=qqc.opening_tag_shortcode_pos("([c*]|[c])",i);if(o<i.length?_=i.substr(0,o):(errmsgs.push(T("Did not get [c] or [c*] (hangman answer) with [hangman]")+". qwiz: "+(1+e)+", "+T("question")+" "+(1+t)),o=0),qwizdata[e].qrecord_id)if(qqc.isInteger(qwizdata[e].dataset_id[t])){var n=qqc.remove_tags_eols(_);n=n.replace(/\[hangman[^\]]*\]/g,"_________"),qwizdata[e].q_and_a_text[t]=qqc.q_and_a_hash(qqc.remove_tags_eols(n)),qwizdata[e].q_and_a_crc32[t]=qwiz_crc32(i)}else qwizdata[e].q_and_a_text[t]=qwizdata[e].dataset_id[t],qwizdata[e].q_and_a_crc32[t]="dataset";var r=default_hangman_max_hints,d=!0,c="";if((z=i.match(/\[hangman([^\]]*)\]/m))&&(c=z[1])){var l=get_attr(c=qqc.replace_smart_quotes(c),"hints");l&&(-1==l.search(/[^0-9]/)?r=parseInt(l,10):errmsgs.push(T('"hints" for [hangman] should be a number')+". qwiz: "+(1+e)+", "+T("question")+" "+(1+t))),d=!("false"==get_attr(c,"type_letters"))}var w="hangman",h=a;s&&(w="hangman_labeled_diagram",h=""),set_qwizard_data_b&&(qw.questions_cards[t].type=w,qw.questions_cards[t].hangman_attributes=c,_=qqc.shortcodes_to_video_elements(_),qw.questions_cards[t].question_text=h+_,qw.questions_cards[t].choices=[],qw.questions_cards[t].correct_choice_fs=[],qw.questions_cards[t].feedbacks=[]);var u=i;o&&(u=i.substr(0,o));for(var z,m,p=(z=u.match(/\[hangman/g)).length,g=i.substr(o),b=["[c]","[c*]"],f=["[c]","[c*]","[x]",'<div class="qwizzled_question_bottom_border_title"'],v=[],y=new RegExp("\\[hangman[^\\]]*\\]"),x=[],k=0;;){var $,A="",C=0,I=qqc.parse_html_block(g,b,f);if("NA"==I)break;if(g=g.substr(I.length),q.wordpress_page_f&&(I=cvt_feedback(I)),I=($=process_feedback_item(I,e,t,k)).choice_html,$.feedback_div)!0,v.push($.feedback_div),set_qwizard_data_b&&(qw.questions_cards[t].feedbacks[k]=qqc.shortcodes_to_video_elements($.feedback_item_html)),($=process_feedback_item(I,e,t,k)).feedback_div&&errmsgs.push(T("More than one feedback shortcode [f] given with hangman answer")+". qwiz: "+(1+e)+", "+T("question")+" "+(1+t)+", "+T("choice")+" "+(1+k));else v.push("");var O=I.match(/\[c\*{0,1}\]([^\[]*)/m);O&&(A=(A=O[1]).replace(/<[^>]+>|\n| /g,""),C=(A=qqc.trim(A)).length,debug[0]&&console.log("[process_hangman] hangman_answer:",A)),void 0===qwizdata[e].hangman[t]&&(qwizdata[e].hangman[t]={}),qwizdata[e].hangman[t].hangman_answer||(qwizdata[e].hangman[t].hangman_answer=[],qwizdata[e].hangman[t].hangman_final_entry=[],qwizdata[e].hangman[t].hangman_current_entry=[],qwizdata[e].hangman[t].hangman_incorrect_chars=[],qwizdata[e].hangman[t].hangman_incorrect_chars_before_hint=[],qwizdata[e].hangman[t].hangman_n_hints=[]),0==k&&(qwizdata[e].hangman[t].n_hangman=p,qwizdata[e].hangman[t].hangman_max_hints=r,qwizdata[e].hangman[t].hangman_type_letters=d,qwizdata[e].hangman[t].n_hangman_done=0,qwizdata[e].hangman[t].n_hangman_correct=0),qwizdata[e].hangman[t].hangman_answer[k]=A,set_qwizard_data_b&&(qw.questions_cards[t].choices[k]=A,qw.questions_cards[t].correct_choice_fs[k]=1),qwizdata[e].hangman[t].hangman_n_hints[k]=0;var j=qqc.create_hangman_entry(A);if(qwizdata[e].hangman[t].hangman_final_entry[k]=j,!v[k]){var S=q.canned_feedback(!0);v[k]=create_feedback_div_html(e,t,k,S),set_qwizard_data_b&&(qw.questions_cards[t].feedbacks[k]=S)}var E=new Array(C).join(" "),M=q.qwizard_b?' onfocus="qwizard.update_hangman_options_menu_choice (this, '+k+')"':"",R="",Y="";q.qwizard_b&&"placeholder"==A&&(R=" disabled",Y=" qwiz_button_disabled");var N,B='<span class="qwiz_hangman qwiz_hangman_c'+k+'" onkeyup="'+qname+'.hangman_show (this, true)" onmouseenter="'+qname+'.hangman_show (this)" onmouseleave="'+qname+'.hangman_hide (this)"><span class="hangman_current_entry hangman_entry"></span><input type="text" oninput="'+qname+".hangman_keyup (this, event,' "+E+"', "+e+", "+t+", "+k+')" onblur="'+qname+'.hangman_hide (this.parentElement)"'+M+" />";if(r&&qwizdata[e].repeat_incorrect_b)N=r<A.replace(/[^a-z0-9]/i,"").length?1==r?' title="'+T("You can get one hint letter, but your answer will c
1ount as incorrect")+'"':(N=' title="'+T("You can get %s hint letters, but your answer will count as incorrect")+'"').replace("%s",qqc.number_to_word(r)):' title="'+T("You can get hints, but your answer will count as incorrect")+'"',B+='<button id="hangman_hint-qwiz'+e+"-q"+t+"-c"+k+'" class="qwiz_button hangman_hint'+Y+'" onmouseenter="'+qname+'.hangman_show (this.parentElement)" onclick="'+qname+".hangman_hint ("+e+", "+t+", "+k+')"'+N+R+">"+T("Hint")+"</button>\n";d&&!q.qwizard_b&&(!s||s&&0==k)&&(B+='<span class="hangman_type_letters"></span>'),B+='<span class="hangman_status"></span></span>',q.qwizard_b&&!s?x.push(B):u=u.replace(y,B),k++}if(u=u.replace(/\[(<code><\/code>)*q[^\]]*\]/,""),k!=p&&errmsgs.push("Number of [hangman] shortcodes does not match number of hangman words [c]. qwiz: "+(1+e)+", "+T("question")+" "+(1+t)),set_qwizard_data_b&&(qw.questions_cards[t].n_choices=p),q.qwizard_b&&!s)m=create_hangman_textentry_editable_divs(e,t,h,x,"hangman",y,u);else{if(q.qwizard_b){var F=u.search(/<div[^>]+qwizzled_canvas/);if(-1!=F){var L=u.search(/<div[^>]+hangman_labeled_diagram_fields/);if(1!=L){var W=qqc.find_matching_block(u.substr(L));u=(u=u.replace(W,"")).substr(0,F)+W+u.substr(F)}}}m='<div id="qwiz'+e+"-q"+t+'" class="qwizq"'+create_bg_img_style(e,t)+">\n"+h+u}return debug[0]&&console.log("[process_hangman] new_htm:",m),m+='<div style="clear: both;"></div>\n',m+=v.join("\n"),m+='<div class="qwiz_hangman_msg"></div>',m+="</div>"}$(document).ready((function(){if((qqc=qwiz_qcards_common).qdebug(debug),"undefined"!=typeof document_qwiz_wp_user_session_id){const e={path:"/",expires:1};$.cookie("qwiz_session_id",document_qwiz_wp_user_session_id,e)}else document_qwiz_wp_user_session_id="";var e=$.cookie("qwiz_preview");void 0!==e&&(q.preview_i_qwiz_plus1=parseInt(e,10)+1,document_qwiz_username=$.cookie("qwiz_preview_username"),$.removeCookie("qwiz_preview",{path:"/"})),debug[0]&&(console.log("[qwiz.js > document ready] typeof (document_qwizard_user_page):",typeof document_qwizard_user_page),console.log("[qwiz.js > document ready] q.preview_i_qwiz_plus1:",q.preview_i_qwiz_plus1)),c
1orrect=[T("Good!"),T("Correct!"),T("Excellent!"),T("Great!"),T("Nice!"),T("Good job!"),T("Well done!")],incorrect=[T("Sorry, no."),T("No, that's not correct."),T("Sorry, that's not correct.")];var t=document.location.href;qwizcards_page_f=-1!=t.indexOf("qwizcards.com/u/")||-1!=t.indexOf("qwizcards.com/admin/")||-1!=t.indexOf("qwizcards.net/u/")||-1!=t.indexOf("qwizcards.net/admin/")||-1!=t.indexOf("localhost/u/")||-1!=t.indexOf("localhost/admin/")||-1!=t.indexOf("192.168.1.120/u/")||-1!=t.indexOf("192.168.1.120/admin/"),"undefined"==typeof document_qwizard_user_page&&-1==t.indexOf("admin-ajax")&&-1==window.location.href.indexOf("action=edit")&&-1==window.location.href.indexOf("post-new")?q.qwiz_init():regular_page_f=!1})),this.qwiz_init=function(e,t,i){if(content=qqc.get_qwiz_param("content","body"),default_use_dict=qqc.get_qwiz_param("use_dict","true"),default_use_terms=qqc.get_qwiz_param("use_terms","true"),default_hangman_max_hints=parseInt(qqc.get_qwiz_param("hangman_hints",2),10),hint_timeout_sec=qqc.get_qwiz_param("hint_timeout_sec",20),q.qwizcards_version=qqc.get_qwiz_param("qwizcards_version",""),document_qwiz_mobile_enabled=qqc.get_qwiz_param("mobile_enabled","Always"),"Enabled"==document_qwiz_mobile_enabled&&(document_qwiz_mobile_enabled="Always"),Tcheck_answer_message=T('Need help? Try the "hint" button'),!t){if(qqc.set_force_mobile(),process_html(),errmsgs.length&&!e&&(q.qwizard_b||(qqc.get_qwiz_param("regular_page_error_check")?alert(plural(T("Error found"),T("Errors found"),errmsgs.length)+":\n\n"+errmsgs.join("\n")):console.log("Errors found:\n",errmsgs.join("\n")))),document_qwiz_force_mobile_f&&q.go_mobile(0),n_qwizzes){for(var a=0;a<n_qwizzes;a++)if(qwizdata[a].questions){if(!document_qwiz_force_mobile_f){const e=qwizdata[a].mobile_enabled;("Always"==e||"Small screens only"==e&&qqc.is_mobile(e))&&$(".go-mobile-qwiz"+a).show()}if(qwizdata[a].qrecord_id&&(qwizdata[a].record_start_b=!0),qwizdata[a].use_dataset||q.init_question_order(a),q.no_intro_b[a]||1==qwizdata[a].n_questions||q.preview_i_qwiz_plus1)q.next_question(a);else if(!qwizdata[a].display_pay_screen){var s=$("div.intro-qwiz"+a);s.find("span.qwiz_img_swap.not_inited").each((function(){qqc.init_image_swap(this)})),s.show(),$("div#next_button-qwiz"+a).show()}}if(q.$dialog_no_credit||($("body").append(dialog_no_credit_html()),q.$dialog_no_credit=$("#qwiz_dialog_no_credit").dialog({height:400,width:550,modal:!0,autoOpen:!1,open:function(){check_timers(),$("div#qwiz_request_assign_to_class_feedback").html(""),$("button#qwiz_request_assign_to_class").removeClass("qwiz_button_disabled").prop("disabled",!1)},buttons:{Close:function(){if(q.$dialog_no_credit.dialog("close"),-1!=restart_timers_i_qwiz){const e=restart_timers_i_qwiz;qwizdata[e].question_time_limit&&start_timers(e,qwizdata[e].question_time_limit),qwizdata[e].qwiz_timer&&start_timers(e),restart_timers_i_qwiz=-1}}}})),q.preview_i_qwiz_plus1){var _=q.preview_i_qwiz_plus1-1;qwizdata[_].use_dataset||q.init_preview(_)}else q.preview&&!q.qwizard_b&&q.init_preview(0)}reinit_highlighting_f&&("undefined"!=typeof Prism?Prism.highlightAll():"undefined"!=typeof hljs&&$("code").each((function(e,t){hljs.highlightBlock(t),this.style.display="inline-block"})))}},this.process_html2=function(e,t,i,a){var s=new RegExp("\\[qwizdemo\\][\\s\\S]*?\\[\\/qwizdemo\\]","gm");q.qwizdemos=e.match(s),q.qwizdemos&&(e=e.replace(s,"<qwizdemo></qwizdemo>"),debug[0]&&console.log("[process_html2] q.qwizdemos.length: ",q.qwizdemos.length));var _=0,o=check_qwiz_tag_pairs(e=(e=e.replace(/<!--[^]*?-->/gm,"")).replace(/\[!+\][^]*?\[\/!+\]/gm,""));if(o)e=o,"undefined"!=typeof qwizard&&(qwizard.errmsgs=errmsgs);else{qwizzled_b=!1;var n=e.match(/\[qwiz[^]*?\[\/qwiz\]/gm);if(n){_=n.length,debug[0]&&(console.log("[process_html2] local_n_qwizzes: ",_),console.log(" qwiz_matches[0]: ",n[0])),q.preview_i_qwiz_plus1&&(q.preview=!0);var r=!0,d=!1;q.quizzes_questions=[];for(var c=0;c<_;c++){if(q.preview_i_qwiz_plus1&&(q.preview_i_qwiz_plus1==t+1?(d=!0,r=!0):r=!1),r){var l=q.process_qwiz_pair(n[c],t,i,a,a);if(a&&(qwizard.questions_cards&&qwizard.questions_cards.length&&(debug[0]&&console.log("[process_html2] qwizard.questions_cards:",qwizard.questions_cards),qwizard.questions_cards[0].dataset_b=qwizard.questions_cards_dataset_b,q.quizzes_questions[t]=JSON.parse(JSON.stringify(qwizard.questions_cards))
1),debug[0]&&(console.log("[process_html2] i_qwiz:",t,", qwizard.questions_cards:",qwizard.questions_cards),qwizard.questions_cards))){console.log("[process_html2] JSON.stringify (qwizard.questions_cards):",JSON.stringify(qwizard.questions_cards)),console.log("[process_html2] qwizard.questions_cards.length:",qwizard.questions_cards.length);for(var w=qwizard.questions_cards.length,h=0;h<w;h++)""==qwizard.questions_cards[h]&&console.log("[process_html2] NULL JSON ii:",h)}e=e.replace(/(<[ph][^>]*>\s*)*?\[qwiz[^]*?\[\/qwiz\]/m,(function(){return l}))}else qwizdata[t]={};t++}if(debug[0]&&q.quizzes_questions.length)for(var u=q.quizzes_questions.length,z=0;z<u;z++)console.log("[process_html2] q.quizzes_questions["+z+"]:",q.quizzes_questions[z]);debug[3]&&console.log("[process_html2] htm:",e)}}return debug[0]&&console.log("[process_html2] replace_body:",d),{htm:e,i_qwiz:t,replace_body:d}},this.reset_preview=function(e){$.cookie("qwiz_preview",e,{path:"/"}),window.location=window.location.href},this.process_reg_code=function(e){if(debug[0]&&console.log("[process_reg_code] reg_code:",e),""!=e){var t={reg_code:e};qqc.jjax(qname,0,0,"reg_code_add_to_class",t)}},this.hide_reg_code_error=function(){$("div.qwiz_reg_code_errmsg").html("").hide()},this.init_preview=function(e){const t=$("#qwiz"+e+" div.qwizq");if(preview_min_height&&t.css({"min-height":preview_min_height}),t.addClass("qwizq_preview").on("mouseenter",q.set_i_qwiz_i_question).show(),$("#qwiz"+e).css({border:"none"}),!q.no_intro_b[e]&&!qwizdata[e].use_dataset){var i=$("div.intro-qwiz"+e);i.addClass("qwiz qwizq_preview").show(),i.find("span.qwiz_img_swap.not_inited").each((function(){qqc.init_image_swap(this)}))}q.display_summary_and_exit(e),$("#summary-qwiz"+e).addClass("qwiz qwizq_preview").show(),$("#next_button-qwiz"+e).remove();for(var a=qwizdata[e].n_questions,s=0;s<a;s++)q.display_question(e,s,!1);init_preview_questions_active(e),$("figure").css({position:"relative","z-index":2})},this.change_preview_mode=function(e,t){for(var i in debug[0]&&console.log("[change_preview_mode] radio_el:",e),qwizdata[t].$qwizzled)$("div#"+i).replaceWith(qwizdata[t].$qwizzled[i]),$("div#"+i).addClass("qwizq_preview").show(),qwizdata[t].$qwizzled[i]=$("div#"+i).clone(!0);$("div#qwiz"+t+" button.show_the_answer").show(),$("div#qwiz"+t+" div.show_answer_got_it_or_not").hide(),$("div#qwiz"+t+" div.qwiz-feedback").hide(),"questions_active"==(preview_mode=e.value)?init_preview_questions_active(t):init_preview_show_answers(t)},this.set_i_qwiz_i_question=function(){debug[0]&&console.log("[set_i_qwiz_i_question] this:",this);var e=this.id,t=e.match(/qwiz([^-]+)/)[1],i=e.match(/-q(.+)/)[1];qwizdata[t].i_question=i},this.init_qwizzled=function(e,t,i){var a;debug[0]&&console.log("[init_qwizzled] i_qwiz:",t),sibs={};var s=0;e.find("div.qwizzled_canvas .qwizzled_target").each((function(){var e=$
1(this);e.removeClass("ui-draggable ui-draggable-handle"),e.css({"border-style":"dotted","border-color":"gray"});var t=e.attr("class").match(/qtarget_sib-([0-9]+)/);if(t){var i=t[1];sibs[i]?a=sibs[i]:(a="t"+s,sibs[i]=a,s++)}else a="t"+s,s++;e.attr("id",a),e.on("click",(function(e){debug[8]&&console.log("[target clicked] $ (event.target):",$(e.target));var t=$(e.target);t.hasClass("qwizzled_target")&&(t.droppable("option","disabled")||q.label_dropped(t))}))})),e.find("td.qwizzled_labels div.qwizzled_label").each((function(){$(this).on("click",(function(e){if(debug[8]&&console.log("[label clicked] $ (event.target).html ():",$(e.target).html()),ignore_label_click_b)ignore_label_click_b=!1;else{var t,i=(t="div"==e.target.tagName.toLowerCase()?$(e.target):$(e.target).parents("div.qwizzled_label"))[0].id.match(/qwiz([^-]+)/)[1];$label_clicked[i]=t;var a=t.parents("td.qwizzled_labels");a.find(".qwizzled_highlight_label").removeClass("label_click_highlight"),a.find(".qwizzled_label_head").hide(),a.find(".qwizzled_label_head_label_clicked").show(),t.find(".qwizzled_highlight_label").addClass("label_click_highlight"),q.label_dragstart(t,!0)}}))})),e.find("div.qwizzled_canvas div.ui-resizable-handle").remove(),e.find("div.qwizzled_image div.qwizzled_target").css("border-width","2px"),e.find(".qwizzled_highlight_label").css("border","none"),e.find(".qwizzled_highlight_label *").css("word-wrap","normal"),e.find("div.qwizzled_image").each((function(){var e=$
1(this).width(),t=$(this).height();$(this).find("img").attr("width",e).attr("height",t).removeAttr("sizes").removeAttr("srcset")})),q.init_qwizzled2(e,t,i)},this.init_qwizzled2=function(e,t,i){qwizdata[t].$qwizzled||(qwizdata[t].$qwizzled={});var a="qwiz"+t+"-q"+i;qwizdata[t].$qwizzled[a]=e.clone(!0)},this.init_textentry_autocomplete=function(e){debug[6]&&console.log("[init_textentry_autocomplete]"),e.find("input.qwiz_textentry").autocomplete({source:find_matching_terms,close:menu_closed,open:menu_shown,select:q.item_selected}),e.find("input.qwiz_textentry").keyup(menu_closed),e.find("input.qwiz_single_char_entry").keyup(single_char_textentry_keyup)},this.label_dragstart=function(e,t){var i=e[0].id.match(/qwiz([^-]+)/)[1];if(t)debug[8]&&console.log("[label_dragstart] $label_clicked[i_qwiz].html():",$label_clicked[i].html());else{if($label_clicked[i]){$label_clicked[i].find(".qwizzled_highlight_label").removeClass("label_click_highlight");var a=e.parents("td.qwizzled_labels");a.find(".qwizzled_label_head").hide(),a.find(".qwizzled_label_head_standard").show(),$label_clicked[i]=""}$prev_label_clicked[i]=0}if(try_again_obj&&$prev_label_clicked[i]!==$label_clicked[i]){var s=try_again_obj;try_again_obj="",debug[8]&&(console.log("[label_dragstart] $label.html():",e.html()),console.log("[label_dragstart] local_try_again_obj:",s),console.log("[label_dragstart] local_try_again_obj.$label.attr ('id'):",s.$label.attr("id"))),s.$label.find(".qwizzled_highlight_label").css({background:""}),s.$label.find(".qwizzled_highlight_label img").css({outline:""}),s.$label.attr("id")!=e.attr("id")&&(s.$label.animate({left:"0px",top:"0px"},{duration:750}),s.$label.find(".qwizzled_highlight_label").removeClass("label_click_highlight")),s.$feedback.hide(),s.$target.droppable("enable")}$prev_label_clicked[i]=""},this.label_dropped=function(e,t){if(debug[8]&&console.log("[label_dropped]: $target:",e,", $label:",t),t)ignore_label_click_b=!0;else{var i=e.parents("div.qwizq")[0].id.match(/qwiz([^-]+)/)[1];if(!$label_clicked[i])return!1;debug[8]&&console.log("[label_dropped]: $label_clicked[i_qwiz]:",$label_clicked[i]);var a=(t=$label_clicked[i]).parents("td.qwizzled_labels");a.find(".qwizzled_label_head").hide();var s=document_qwiz_mobile?"mobile":"standard";a.find(".qwizzled_label_head_"+s).show()}(o=t.attr("class").match(/qwizzled_n_targets([0-9]*)/))||t.find(".qwizzled_highlight_label").removeClass("label_click_highlight");var _,o=t.attr("class").match(/qtarget_assoc([0-9]+)/);_=o?o[1]:t.data("label_target_id"),debug[8]&&console.log("[label_dropped] $target:",e,", assoc_id:",_);var n="#"+t.attr("id").substr(6),r=n.split("-"),d=r[0]+"-"+r[1],c=(i=r[0].substr(5),r[1].substr(1));if(debug[8]&&console.log("[label_dropped] question_selector:",d),qwizdata[i].record_start_b&&document_qwiz_user_logged_in_b){qwizdata[i].record_start_b=!1;var l={type:"start",confirm:"js"};record_response(i,qwizdata[i].qrecord_id,l,!0)}1!=qwizdata[i].user_question_number||!q.no_intro_b[i]&&1!=qwizdata[i].n_questions||($("div#icon_qwiz"+i).hide(),alert_not_logged_in(i),qwizdata[i].qwiz_timer&&start_timers(i)),qwizdata[i].n_label_attempts++,$("[id^=qwiz"+i+"-q"+c+"-a]").hide();var w="#qwiz"+i+"-q"+c,h=!1;if(qwizdata[i].qrecord_id&&document_qwiz_user_logged_in_b)if(qqc.isInteger(qwizdata[i].dataset_id[c])){if(!qwizdata[i].q_and_a_text[c]){var u,z=$(w+" div.qwizzled_image img").attr("src");
1z?u=z:z="",$(w+" div.qwizzled_label").each((function(){var e=$(this).html();e&&(u+="\t"+e)})),u=qqc.remove_tags_eols(u),qwizdata[i].q_and_a_text[c]=qqc.q_and_a_hash(u),qwizdata[i].q_and_a_crc32[c]=qwiz_crc32($(w).html()),debug[0]&&console.log("[label_dropped] qwizdata[i_qwiz].q_and_a_crc32[i_question]:",qwizdata[i].q_and_a_crc32[c])}}else qwizdata[i].q_and_a_text[c]=qwizdata[i].dataset_id[c],qwizdata[i].q_and_a_crc32[c]="dataset";var m=!1;if(e.hasClass("qwizzled_target-"+_))if(debug[8]&&(console.log("[label_dropped] feedback_selector:",n+"c"),console.log("[label_dropped] qwizdata[i_qwiz].n_questions:",qwizdata[i].n_questions)),$(n+"c").show(),place_label(e,t),qwizdata[i].n_labels_correct++,qwizdata[i].n_labels_correct==qwizdata[i].n_label_targets){m=!0;var p,g=qwizdata[i].n_label_attempts,b=qwizdata[i].n_label_targets;(h=g==b)?p="You placed all of the items correctly on the first try!":(p=(p=plural(T("It took you one try"),T("It took you %s tries"),g)+" "+plural(T("to place this label correctly"),T("to place these labels correctly"),b)+".").replace("%s",qqc.number_to_word(g)),1==qwizdata[i].n_questions&&qwizdata[i].repeat_incorrect_b&&(p+="<br />Re-do those you did not label correctly ",qwizdata[i].qrecord_id&&document_qwiz_user_logged_in_b&&(p+="to get this question marked “correct” "),p+='<button class="qwiz_button" onclick="qwiz_.next_question ('+i+', true)">
1Re-do</button>',q.qwizard_b||(qwizdata[i].answered_correctly[c]=-1))),$(w+"-ff").html(p).show(),qwizdata[i].n_questions>1||qwizdata[i].combo||qwizdata[i].use_dataset?(q.qwizard_b||(qwizdata[i].answered_correctly[c]=h?1:-1,h?(qwizdata[i].n_correct++,qwizdata[i].n_qs_done&&qwizdata[i].n_qs_done.add(qwizdata[i].dataset_id[c])):qwizdata[i].n_incorrect++,update_topic_statistics(i,c,h)),update_progress_show_next(i)):q.display_diagram_progress(i),update_progress_show_next(i)}else{var f=e.attr("id");void 0===qwizdata[i].correct_on_try1[c]&&(qwizdata[i].correct_on_try1[c]={}),qwizdata[i].correct_on_try1[c][f]||(qwizdata[i].correct_on_try1[c][f]=1),q.display_diagram_progress(i)}else{if(debug[8]&&(console.log("[label_dropped] feedback_selector:",n+"x"),console.log("[label_dropped] qwizdata[i_qwiz].n_questions:",qwizdata[i].n_questions)),$label_clicked[i]){var v=e.offset(),y=v.left,x=v.top,k=$label_clicked[i].data("label_x"),A=$label_clicked[i].data("label_y");debug[8]&&(console.log("[label_dropped] target_x:",y,", target_y:",x),console.log("[label_dropped] label_x:",k,", label_y:",A)),t.css({left:y-k+"px",top:x-A+"px"}),$label_clicked[i]=""}t.find(".qwizzled_highlight_label").css({background:"#FF8080"}),t.find(".qwizzled_highlight_label img").css({outline:"2px solid #FF8080"});var C=$(n+"x");C.show(),try_again_obj={$label:t,$feedback:C,$target:e},e.droppable("disable");f=e.attr("id");void 0===qwizdata[i].correct_on_try1[c]&&(qwizdata[i].correct_on_try1[c]={}),qwizdata[i].correct_on_try1[c][f]=-1}if(qwizdata[i].qrecord_id&&document_qwiz_user_logged_in_b){var I=t.find("span.qwizzled_highlight_label").html();I=qqc.remove_tags_eols(I);var O=e.attr("class").match(/qwizzled_target-([0-9]*)/)[1],j=$(w).find("div.qtarget_assoc"+O).find("span.qwizzled_highlight_label").html();j||(j=$(w).find('div.qwizzled_label[data-label_target_id="'+O+'"]').find("span.qwizzled_highlight_label").html()),j=qqc.remove_tags_eols(j);l={q_and_a_text:btoa(encodeURIComponent(qwizdata[i].q_and_a_text[c])),q_and_a_crc32:qwizdata[i].q_and_a_crc32[c],i_question:qwizdata[i].dataset_id[c],unit:qwizdata[i].unit[c],level:qwizdata[i].level[c],type:"labeled_diagram",response:I+"\t"+j,correct_b:"",confirm:"js"};if(record_response(i,qwizdata[i].qrecord_id,l),m){l={q_and_a_text:btoa(encodeURIComponent(qwizdata[i].q_and_a_text[c])),q_and_a_crc32:qwizdata[i].q_and_a_crc32[c],i_question:qwizdata[i].dataset_id[c],unit:qwizdata[i].unit[c],level:qwizdata[i].level[c],type:"labeled_diagram",response:"done",correct_b:h?1:"",confirm:"js"};setTimeout((function(){record_response(i,qwizdata[i].qrecord_id,l,!0)}),500)}}},this.process_qwiz_pair=function(e,t,i,a,s){q.qwizard_b=i,"undefined"!=typeof qwizard&&(qw=qwizard),a?(n_qwizzes=1,set_qwizard_data_b=!0,q.no_intro_b=[],debug[0]&&console.log("[process_qwiz_pair] htm.substr (0, 2000):",e.substr(0,2e3))):set_qwizard_data_b=!1,qwizdata[t]={},qwizdata[t].questions=[],qwizdata[t].answered_correctly=[],qwizdata[t].i_questions_done=[],qwizdata[t].n_correct=0,qwizdata[t].n_incorrect=0,qwizdata[t].i_question=-1,qwizdata[t].i_user_question=-1,qwizdata[t].ii_question=0,qwizdata[t].user_question_number=0,qwizdata[t].initial_width=500,qwizdata[t].hangman={},qwizdata[t].use_dataset="",qwizdata[t].dataset_id={},qwizdata[t].use_dataset_question_ids={},qwizdata[t].bg_img={},qwizdata[t].align="",qwizdata[t].qrecord_id="",qwizdata[t].information_question_b={},qwizdata[t].unit=[],qwizdata[t].level=[],qwizdata[t].parts_htm={},qwizdata[t].hotspot_user_interaction={},qwizdata[t].hotspot_labels_stick={},qwizdata[t].show_hotspots={},qwizdata[t].find_the_dot={},qwizdata[t].ctx={},qwizdata[t].current_xy_hotspot_no={};var _=(F=e.match(/\[qwiz([^\]]*)\]/m))[0],o=F[1];_=qqc.replace_smart_quotes(_),o=qqc.replace_smart_quotes(o),debug[0]&&(console.log("[process_qwiz_pair] qwiz_tag: ",_),console.log("[process_qwiz_pair] attributes: ",o)),set_qwizard_data_b&&qw.set_qwizard_data("qwiz_deck_attributes",o);var n=!1;qwizdata[t].icon_swhs=!1,qwizdata[t].summary_b="false"!=get_attr(o,"summary");const r="true"==get_attr(o,"random");qwizdata[t].random_b=r,q.qwizard_b&&(qwizdata[t].attr_random_b=r);const d=get_attr(o,"reshow_after");d&&(qwizdata[t].reshow_after=d);var c,l=get_attr(o,"use_dataset",!0);(l||(c=get_attr(o,"dataset",!0))&&(regular_page_f?l=c:qwizdata[t].dataset=c),l||c)&&("true"==get_attr(o,"combo")&&(qwizdata[t].combo=!0,qwizdata[t].dataset_labels=get_attr(o,"dataset_labels"),qwizdata[t].dataset_label_info=get_attr(o,"dataset_label_info")));if(l){qwizdata[t].use_dataset=l;var w=get_attr(o,"dataset_intro");
1w&&"true"!=w?"false"==w&&(w=!1):w=!0,qwizdata[t].dataset_intro_f=w;var h="false"!=get_attr(o,"spaced_repetition");if(qwizdata[t].dataset_questions_to_do=h?"spaced_repetition":"all",w){const e=get_attr(o,"default_max_to_practice");e&&(qwizdata[t].default_max_to_practice=parseInt(e))}if(F=_.match(/\sstyle\s*=\s*"[^"]+"/gm))for(var u=F.length,z=0;z<u;z++){var m=encodeURIComponent(F[z]);_=_.replace(F[z],m)}var p=get_attr(_,"display_name");if(p){qwizdata[t].use_dataset_options_display_name=decodeURIComponent(p);_=_.replace(/\sdisplay_name\s*=\s*"[^"]*?"/,"")}_=decodeURIComponent(_)}const g=parseInt(get_attr(o,"questions_to_show"));qqc.isInteger(g)&&g>0&&(qwizdata[t].questions_to_show=g);var b=get_attr(o,"repeat_incorrect");qwizdata[t].repeat_incorrect_b="false"!=b,debug[0]&&console.log("[process_qwiz_pair] repeat_incorrect_value:",b,", repeat_incorrect_b:",qwizdata[t].repeat_incorrect_b);var f=get_attr(o,"align");"center"!=f&&"right"!=f&&"tiled"!=f||(qwizdata[t].align=f,"tiled"==f&&(qwizdata[t].spacing=20));var v=parseInt(get_attr(o,"spacing"));qqc.isInteger(v)&&(qwizdata[t].spacing=v),qwizdata[t].hide_forward_back_b="true"==get_attr(o,"hide_forward_back"),qwizdata[t].hide_progress_b="true"==get_attr(o,"hide_progress"),qwizdata[t].hide_qwizcards_icon_b="true"==get_attr(o,"hide_qwizcards_icon");const y=get_attr(o,"mc_style");y&&(qwizdata[t].mc_style=y);var x=get_attr(o,"mobile_enabled");x||(x=document_qwiz_mobile_enabled),qwizdata[t].mobile_enabled=x;var k=get_attr(o,"qrecord_id",!0);if(k){if(qwizdata[t].combo){var $=k.split("; ");qwizdata[t].combo_qrecord_id=$[0]}qwizdata[t].qrecord_id=k,qwizdata[t].q_and_a_text={},qwizdata[t].q_and_a_crc32={};const e=get_attr(o,"display_pay_screen");if(e&&"false"!=e){qwizdata[t].display_pay_screen=e;const i=get_attr(o,"immediate_payment");i&&"false"!=i&&(qwizdata[t].immediate_payment=!0)}q.qrecord_b||(q.qrecord_b=!0,"undefined"!=typeof document_qwiz_user_logged_in_b&&"not ready"!=document_qwiz_user_logged_in_b||qqc.check_session_id(t,/register/.test(e)))}if(q.qwizard_b||set_qwizard_data_b){const e=!!get_attr(o,"dataset");q.dataset_b=e,set_qwizard_data_b&&(qw.questions_cards_dataset_b=e)}const A=get_attr(o,"question_time_limit");A&&(qwizdata[t].question_time_limit=parseInt(A));const C="true"==get_attr(o,"quiz_timer");C&&(qwizdata[t].qwiz_timer=C);var I=get_attr(o,"unit");I?(qwizdata[t].default_unit=I.replace(/\s/g,"_"),set_qwizard_data_b&&qw.set_qwizard_data("default_unit",I)):qwizdata[t].default_unit="null";"true"==get_attr(o,"generative_feedback")&&(qwizdata[t].generative_feedback=!0);const O=get_attr(o,"prompt_intro");O&&(qwizdata[t].default_prompt_intro=O);const j=get_attr(o,"prompt_intro_add");j&&(qwizdata[t].default_prompt_intro_add=j);const S=get_attr(o,"hint_prompt_intro");S&&(qwizdata[t].default_hint_prompt_intro=S);const E=get_attr(o,"prompt_for_question");E&&(qwizdata[t].default_prompt_for_question=E);const M=get_attr(o,"prompt_for_response");M&&(qwizdata[t].default_prompt_for_response=M);const R=get_attr(o,"hint_prompt_for_response");R&&(qwizdata[t].default_hint_prompt_for_response=R);const Y=get_attr(o,"response_min_chars");Y&&(qwizdata[t].default_response_min_chars=Y);const N=get_attr(o,"prompt_for_feedback");N&&(qwizdata[t].default_prompt_for_feedback=N);const B=get_attr(o,"temperature");B&&(qwizdata[t].default_temperature=B);"true"==get_attr(o,"random_mc")&&(qwizdata[t].default_random_mc=!0);var F,L="",W=!1;if(F=e.match(/\[qwiz[^\]]*\]((<\/[^>]+>\s*)*)/m,"")){var G=F[1];debug[0]&&console.log("[process_qwiz_pair] initial_closing_tags: ",G)}e=(e=e.replace(/\[qwiz[^\]]*\]((<\/[^>]+>\s*)*)/m,"")).replace(/(<(p|h[1-6]|span)[^>]*>)*\[\/qwiz\]$/,"");var D=(F=(e=qqc.trim(e)).match(/\[(q|<code><\/code>q)([^\]]*)\]/gm))?F.length:0;if(l||c||q.qwizard_b||0!=D){e=qqc.process_inline_textentry_terms(e,"terms",qwizdata,t),errmsgs=errmsgs.concat(qwizdata.additional_errmsgs),e=qqc.process_inline_textentry_terms(e,"add_terms",qwizdata,t),errmsgs=errmsgs.concat(qwizdata.additional_errmsgs);var Q=qqc.parse_html_block(e.substr(0,2e3),["^"],["[h]","[i]","[q]","[q "],"[<code></code>q","return whitespace");Q&&(e=e.replace(Q,"")),e=process_header(e,t,0,!0),set_qwizard_data_b&&"NA"!=header_html&&qw.set_qwizard_data("header_text",header_html);var P=qqc.parse_html_block(e.substr(0,5e3),["[i]"],["[q]","[q ","[<code></code>q",'<div class="qwizzled_question',"[x]"]);if("NA"==P)""==(P=qqc.parse_html_block(e.substr(0,5e3),["^"],["[q]","[q ","[<code></code>q",'<div class="qwizzled_question',"[x]"],!0))&&(l?P="<br /><br /><br />":W=!0);else{var U=e.substr(0,200);U=qqc.trim(U);var Z=qqc.opening_tag_shortcode_pos("[i]",U);U=U.substr(Z,5);var H=P.replace(/<br[^>]*>/g,"");U!=(H=qqc.trim(H).substr(0,5))&&errmsgs.push(T("Text before intro")+" [i]. qwiz: "+(t+1)),P=P.replace("[i]",""),P=qqc.balance_closing_tag(P)}q.qwizard_b&&(P=qqc.shortcodes_to_video_elements(P)),(!W||q.qwizard_b||qwizdata[t].question_time_limit)&&(debug[0]&&console.log("[process_qwiz_pair] intro_html:",P),L+='<div class="intro-qwiz'+t+' qwiz-intro qwiz_editable">'+qqc.decode_image_tags(P)+"</div>\n"),set_qwizard_data_b&&(intro_hmtl=qqc.remove_empty_opening_tags(P),qw.set_qwizard_data("intro_text",P));var V=qqc.parse_html_block(e,["[x]"],[]);if("NA"!=V)if(-1!=(V=V.replace(/\[x\]/,"")).search(/\[q[ \]]|<div class="qwizzled_question/))errmsgs.push("[x] "+T("(exit text) must be last")+". qwiz: "+(t+1));else{var J=qqc.opening_tag_shortcode_pos("[x]",e);e=e.substr(0,J)}else V="";if(set_qwizard_data_b){var X=qqc.shortcodes_to_video_elements(V);X=qqc.remove_empty_opening_tags(X),qw.set_qwizard_data("exit_text",X)}
1if(l||-1!=e.search(/use_dataset_question\s*=\s*/)&&(n=!0,qwizdata[t].use_dataset_questions_htm=e),l||n&&!s)s&&(qwizard.questions_cards_dataset_b=!1),L+='<div id="dataset_questions-qwiz'+t+'"></div>';else if(0==D)qwizdata[t].n_questions=0,L+='<div id="qwiz'+t+'-q-1" class="qwizq"></div>';else{qwizdata[t].n_questions=D;const i=qwizdata[t].questions_to_show;i&&i<D?(qwizdata[t].n_questions_for_done=i,qwizdata[t].random_b=!0):qwizdata[t].n_questions_for_done=D,L=q.process_questions(e,L,t,void 0,void 0,s)}}else errmsgs.push(T('Did not find question tags ("[q]")')+". qwiz: "+(t+1)),header_html="";return q.no_intro_b[t]=W&&!qwizdata[t].question_time_limit,L=create_qwiz_divs(t,_,L,V),void 0!==q.qwizard_b&&"undefined"!=typeof qwizard&&(qwizard.errmsgs=errmsgs),L},this.process_questions=function(e,t,i,a,s,_,o){s&&(qw=qwizard,n_qwizzes=1,set_qwizard_data_b=!0,q.qwizard_b=!0),number_first_question=void 0!==a?a:0,set_qwizard_data_b||-1!=e.indexOf("[!")&&(e=e.replace(/\[!+\][^]*?\[\/!+\]/gm,""));var n=e.match(/(\[q [^\]]*\]|<div class="qwizzled_question|\[q\])[^]*/m)[0],r=n.match(/\[(<code><\/code>)*(q\]|q\s+[^\]]*\])/gm);(debug[4]||debug[11])&&console.log("[process_questions] question_shortcodes: ",r),n_questions=r.length,qwizdata[i].question_topics=new Array(n_questions),o&&(qwizdata[i].question_qrecord_ids=o),q.qwizard_b&&(qwizdata[i].qwizard_multiple_choice_b=[]),qwizdata[i].units=[],qwizdata[i].topics=[],qwizdata[i].levels=[];for(var d=e.match(/(<[^\/][^>]*>\s*)*?(\[q[ \]]|\[<code><\/code>q)/gm),c=[],l=d.length,w=0;w<l;w++){var h=d[w];h=(h=h.replace(/\[q[ \]]|\[<code><\/code>q/gm,"")).replace(/[^]*<(img|input)[^>]+>/,""),c.push(h)}(debug[0]||debug[11])&&(console.log("[process_questions] q_opening_tags: ",c),console.log("[process_questions] question_html: ",n));var u="[q"!=n.substr(0,2);if(u)n=n.replace(/<div class="qwizzled_question[^>]*>/,"");else{var z=n.indexOf("]")+1;n=n.substr(z)}var m=n.split(/<div class="qwizzled_question[^_][^>]*>/);(debug[0]||debug[11])&&console.log("[process_questions] qwizzled_pieces.length:",m.length);var p=[];if(1==m.length){var g=n.split(/(?:(?:<(?:p|h[1-6]|span|em|strong|code)[^>]*|<i|<b)>(?:\s| )*)*?(?:\[q [^\]]*\]|\[<code><\/code>q [^\]]*\]|\[q\]|\[<code><\/code>q\])/);(debug[0]||debug[11])&&console.log("[process_questions] q_split:",g);var b=0;u&&(p.push(g[0]+"[q]"+g[1]),b=2);for(var f=b;f<g.length;f++)p.push(g[f])}else if(m.length>1)if(u)for(var v=0;v<m.length;v++){g=m[v].split(/\[q [^\]]*\]|\[<code><\/code>q [^\]]*\]|\[q\]|\[<code><\/code>q\]/);p.push(g[0]+"[q]"+g[1]);for(f=2;f<g.length;f++)p.push(g[f])}else{for(g=m[0].split(/\[q [^\]]*\]|\[q\]/),f=0;f<g.length;f++)p.push(g[f]);for(v=1;v<m.length;v++){g=m[v].split(/\[q [^\]]*\]|\[<code><\/code>q [^\]]*\]|\[q\]|\[<code><\/code>q\]/);p.push(g[0]+"[q]"+g[1]);for(f=2;f<g.length;f++)p.push(g[f])}}if(set_qwizard_data_b&&void 0===a&&qw.set_qwizard_data("n_questions",n_questions),!q.qwizard_b){qwizdata[i].n_questions=n_questions;const e=qwizdata[i].questions_to_show;e&&e<n_questions?(qwizdata[i].n_questions_for_done=e,qwizdata[i].random_b=!0):qwizdata[i].n_questions_for_done=n_questions}(debug[0]||debug[11])&&(console.log("[process_questions] n_questions:",n_questions),console.log("[process_questions] questions_html:",p.join("\n================================================\n")));for(var y,x=[],k=!1,$=0;$<n_questions;$++){var A,C=$+number_first_question;if(A=void 0!==a?r[0]:r[C],question_topic=process_question_attributes(i,C,A,a),question_topic&&(k=!0),-1!=p[$].indexOf("[hangman")||-1!=p[$].indexOf("hangman_img_wrapper"))y=process_hangman(i,C,p[$],c[$]);else if(-1!=p[$].indexOf("[textentry"))y=process_textentry(i,C,p[$],c[$]);else if(-1!=p[$].search(/\[c\]|\[c\*\]/m))y=process_multiple_choice(i,C,p[$],c[$]);else if(-1!=p[$].indexOf("hotspot_image_stack"))qwizdata[i].hotspot_b=!0,y=process_hotspot_diagram(i,C,p[$],c[$],_);else if(-1!=p[$].search(/<div[^>]+class=".*?qwizzled_label/m))qwizzled_b=!0,qwizdata[i].qwizzled_b=!0,y=process_qwizzled(i,C,p[$],c[$],r[$]),qwizdata[i].correct_on_try1?qwizdata[i].correct_on_try1[C]={}:qwizdata[i].correct_on_try1=[];else{var I=p[$],O=I.replace(/<[^>]+>| |\s/gm,"");if(O||-1!=I.indexOf("img")&&(O=!0),O){const e=I.indexOf("[f]");var j;if(-1!=e&&(errmsgs.push(T("Question appears to be information-only, but feeedback ([f]) was provided")+". qwiz: "+(i+1)+", "+T("question")+" "+(C+1)),q.wordpress_page_f&&(I=cvt_feedback(I,e))),qwizdata[i].information_question_b[C]=!0,qwizdata[i].qrecord_id)qqc.isInteger(qwizdata[i].dataset_id[C])?(j=qqc.remove_tags_eols(I),qwizdata[i].q_and_a_text[C]=qqc.q_and_a_hash(j),qwizdata[i].q_and_a_crc32[C]=qwiz_crc32(p[$])):(qwizdata[i].q_and_a_text[C]=qwizdata[i].dataset_id[C],qwizdata[i].q_and_a_crc32[C]="dataset")}else qwizdata[i].use_dataset_question_ids[C]||errmsgs.push(T("Question is completely blank")+". qwiz: "+(i+1)+", "+T("question")+" "+(C+1));set_qwizard_data_b&&(qw.questions_cards[C].type="information_only",I=qqc.shortcodes_to_video_elements(I),qw.questions_cards[C].question_text=c[$]+I),y='<div id="qwiz'+i+"-q"+C+'" class="qwizq"'+create_bg_img_style(i,C)+'>\n<div class="qwiz-question qwiz_editable">
1'+c[$]+I+"</div></div>"}x.push(y)}t+=x.join("\n");const S=Object.values(qwizdata[i].dataset_id);if(S.length>1){S.sort();const e=S.length;for(var E=!1,M=1;M<e;M++)S[M]==S[M-1]&&(errmsgs.push(T("Duplicate")+" dataset_id: "+S[M]+". qwiz: "+(i+1)),E=!0);E&&errmsgs.push(T('Please delete the duplicate dataset_id="..." attribute(s); new IDs will be created'))}return k&&debug[4]&&console.log("[process_questions] topics: "+qwizdata[i].topics.join("; ")),set_qwizard_data_b&&(qw.unit_names=qwizdata[i].units,qw.level_names=qwizdata[i].levels),qwizdata[i].topics.length&&(check_questions_have_topics(i),set_qwizard_data_b&&(qw.topic_names=qwizdata[i].topics)),(debug[3]||debug[11])&&console.log("[process_questions] new_htm: ",t),debug[12]&&console.log("[process_questions] errmsgs: ",errmsgs.join("\n")),t},this.qwiz_password_focus=function(e,t){e.qwiz_pw="",e.value="",$("#qwiz_login-qwiz"+t+" p.login_error").hide()},this.restart_quiz=function(e){var t=$("#summary-qwiz"+e);for(var i in t.hide(),t.find("button.summary_exit_mobile_qwiz").hide(),$("#qwiz"+e+" div.show_answer_got_it_or_not").hide(),1==qwizdata[e].n_questions&&$("#qwiz"+e+" div.single-question_exit").hide(),q.reset_counters(e),qwizdata[e].hotspot_user_interaction={},qwizdata[e].use_dataset&&(qwizdata[e].information_question_b={},qwizdata[e].hangman={},qwizdata[e].textentry=""),q.display_progress(e),qwizdata[e].$qwizzled)$("div#"+i).replaceWith(qwizdata[e].$qwizzled[i]),qwizdata[e].$qwizzled[i]=$("div#"+i).clone(!0);if(qwizdata[e].qwizzled_b&&(qwizdata[e].correct_on_try1=[]),$("#qwiz"+e).find("div.qwizq").hide(),qwizdata[e].hide_forward_back_b||($(".bbfe-qwiz"+e).css({visibility:"visible",opacity:.2}).removeClass("hover"),$("span.question-number-qwiz"+e).css({visibility:"visible"}).html(1)),$("span.response_recorded_wrapper-qwiz"+e).css({display:"none"}),!qwizdata[e].qwiz_timer||qwizdata[e].n_qs_done&&0!=qwizdata[e].n_qs_done.size||qwizdata[e].$qwiz_timer.html("0:00"),qwizdata[e].qrecord_id&&document_qwiz_user_logged_in_b){qwizdata[e].record_start_b=!1;record_response(e,qwizdata[e].qrecord_id,{type:"start",confirm:"js"},!0)}q.init_question_order(e),q.next_question(e,!0)},this.reset_counters=function(e){const t=qwizdata[e].n_questions;for(var i=0;i<t;i++)qwizdata[e].answered_correctly[i]=0,qwizdata[e].i_questions_done=[],qwizdata[e].questions[i]={};qwizdata[e].n_correct=0,qwizdata[e].n_incorrect=0,qwizdata[e].hotspot_user_interaction={};for(var a=qwizdata[e].topics.length,s=0;s<a;s++){var _=qwizdata[e].topics[s];qwizdata[e].topic_statistics[_].n_correct=0,qwizdata[e].topic_statistics[_].n_incorrect=0}qwizdata[e].i_question=-1,qwizdata[e].i_user_question=-1,qwizdata[e].ii_question=0,qwizdata[e].user_question_number=0},this.record_quiz_time_callback=function(e){let t=e.i_qwiz;e.errmsg?(alert(e.errmsg),qwizdata[t].when_done_unix=0):(qwizdata[t].quiz_elapsed_time_id=e.quiz_elapsed_time_id,qwizdata[t].when_done_unix=e.when_done_unix)},this.redo_question=function(e){1==qwizdata[e].n_questions&&$("#qwiz"+e+" div.single-question_exit").hide(),qwizdata[e].i_question=qwizdata[e].i_question-1,qwizdata[e].answered_correctly[0]=0,qwizdata[e].n_correct=0,q.next_question(e,!0)},this.next_question=function(e,t,i,a){if(debug[0]&&console.log("[next_question] qwizdata[i_qwiz].i_question:",qwizdata[e].i_question),qwizdata[e].bck_f)return void q.fwd_question(e,!1);const s=$("div#overlay-times-up-qwiz"+e);s.is(":visible")&&s.hide();var _=qwizdata[e].i_question;if(-1!=_&&qwizdata[e].combo&&!a)return void qqc.combo_next("Q",e,qwizdata[e].combo_i_deck);-1==_&&(qwizdata[e].use_dataset&&qwizdata[e].dataset_intro_f||$(".bbfe-qwiz"+e).css({visibility:"visible",opacity:.2}).removeClass("hover"));const o=qwizdata[e].n_questions;debug[0]&&console.log("[next_question] i_question: ",_,", n_questions: ",o);var n="qwiz"+e,r=$("#"+n);document_qwiz_mobile?r.css("width",""):qwizdata[e].width_reset&&($("#xqwiz"+e).length?r.css({width:qwizdata[e].initial_width+"px","max-width":"","margin-bottom":""}):r.css({width:"","max-width":""}),r.css({transform:""}),r[0].qscale_fac="",r[0].qstart_left="",r[0].qstart_top="",qwizdata[e].width_reset=!1);var d=!1;if(i=!!i,-1!=_||i){var c=n+"-q"+_;if($("#"+c).hide(),document_qwiz_mobile&&$("#mobile_"+c).hide(),qwizdata[e].pay_quiz_deck_id&&("preview_questions"==qwizdata[e].pay_quiz_ok||"preview_period_expired"==qwizdata[e].pay_quiz_ok||"no_free_trial"==qwizdata[e].pay_quiz_ok)&&qqc.preview_limit("qwiz",qwizdata,e))return}else if(qwizdata[e].use_dataset||qwizdata[e].use_dataset_questions_htm||qwizdata[e].combo||o>1||q.qwizard_b){var l=-1;if(!q.no_intro_b[e]||qwizdata[e].use_dataset_questions_htm){if(d=!0,!t&&!q.qwizard_b&&qwizdata[e].qrecord_id){const t="undefined"!=typeof document_qwiz_user_logged_in_b&&document_qwiz_user_logged_in_b&&"undefined"!=typeof document_qwiz_username;if(!(t||"undefined"!=typeof document_qwiz_declined_login_b&&document_qwiz_declined_login_b))return q.display_login(e),!1;if(t&!document_qwiz_wp_user_session_id){var w=!0;if(!$.cookie("qwiz_current_login_lt_nmin_ago")){w=!1;var h="";if(document_qwiz_team_b&&(h=" "+T("a team")+":"),confirm(T("You are logged in as")+h+" "+document_qwiz_username+".\n"+T('Do you want to continue? (Click "Cancel" to sign out)'))){var u={path:"/",expires:qqc.get_qwiz_param("login_timeout_min",40)/1440};$.cookie("qwiz_current_login_lt_nmin_ago",1,u)}else qqc.sign_out(),document_qwiz_user_logged_in_b=!1}if(w&&document_qwiz_team_b&&!confirm(T("You are logged in as team")+": "+document_qwiz_username+".\n"+T("Do you want to continue as this team?"))){document_qwiz_session_id=document_qwiz_session_id.split(";")[0],document_qwiz_username=document_qwiz_username.split("; ")[0],document_qwiz_team_b=!1,qqc.set_user_menus_and_icons();var z=T("OK. Only %s is logged in now");z=z.replace("%s",document_qwiz_username),alert(z)}if(qwizdata[e].record_start_b=!1,document_qwiz_user_logged_in_b){var m={type:"start",confirm:"js"};record_response(e,qwizdata[e].qrecord_id,m,!0)}}}if(qwizdata[e].use_dataset||qwizdata[e].use_dataset_questions_htm){d&&qqc.is_mobile(qwizdata[e].mobile_enabled)&&q.go_mobile(e);var p=qwizdata[e].dataset_intro_f;if(p&&"topics_only"!=p)q.display_login(e,!1,"use_dataset_options");else{if($(".intro-qwiz"+e).hide(),qwizdata[e].use_dataset)var[g,b,f]=qqc.parse_use_dataset(qwizdata[e].use_dataset);else var b=[],f=[];qqc.get_dataset_questions(g,qname,e,qwizdata[e].qrecord_id,b,f,1e4,qwizdata[e].dataset_questions_to_do,!1,qwizdata[e].use_dataset_questions_htm),l=0}}}else q.no_intro_b[e]&&qwizdata[e].qwiz_timer&&start_timers(e);qwizdata[e].use_dataset||qwizdata[e].use_dataset_questions_htm||q.next_question_from_intro(e,l)}else $("#mode-"+n).css("visibility","hidden");if(0!=o){if(next_button_active_b||($("#next_button-"+n).hide(),qwizdata[e].next_button_show_b=!1),-1!=_||i){const t=qwizdata[e].hotspot_user_interaction[_],i=t&&"info_only"==t;if((qwizdata[e].information_question_b[_]||i)&&($("#next_button_text-qwiz"+e).html(T("Next question")),!q.qwizard_b)){qwizdata[e].answered_correctly[_]=1,qwizdata[e].n_correct++,qwizdata[e].n_qs_done&&qwizdata[e].n_qs_done.add(qwizdata[e].dataset_id[_]),q.display_progress(e),1!=qwizdata[e].user_question_number||!q.no_intro_b[e]&&1!=qwizdata[e].n_questions||($("div#icon_qwiz"+e).hide(),alert_not_logged_in(e),qwizdata[e].qwiz_timer&&start_timers(e));if(qwizdata[e].qrecord_id&&document_qwiz_user_logged_in_b){m={q_and_a_text:btoa(encodeURIComponent(qwizdata[e].q_and_a_text[_])),q_and_a_crc32:qwizdata[e].q_and_a_crc32[_],i_question:qwizdata[e].dataset_id[_],unit:qwizdata[e].unit[_],level:qwizdata[e].level[_],type:"information_only",response:"continue",correct_b:1,confirm:"js"};record_response(e,qwizdata[e].qrecord_id,m)}}}if(next_button_active_b&&qwizdata[e].user_question_number==o)q.display_summary_and_exit(e);else if(!qwizdata[e].use_dataset||-1!=_||i&&!q.qwizard_b){var v=qwizdata[e].n_correct;qwizdata[e].repeat_incorrect_b||(v+=qwizdata[e].n_incorrect);var y=qwizdata[e].n_questions_for_done;if(debug[0]&&console.log("[next_question] n_done:",v,", n_questions:",o,", n_questions_for_done:",y),v>=y){-1==qwizdata[e].i_user_question&&(qwizdata[e].i_question=0,qwizdata[e].i_user_question=0);l=qwizdata[e].i_user_question;qwizdata[e].questions[o]={i_user_prev_question:l,user_question_number:"--"},qwizdata[e].questions[l].i_user_next_question=o,qwizdata[e].i_user_question=o,qwizdata[e].saved_i_question=o,$("span.question-number-qwiz"+e).html("--"),qwizdata[e].qwiz_timer&&(qwizdata[e].n_qs&&qwizdata[e].n_qs_done.size==qwizdata[e].n_qs&&(qwizdata[e].n_qs_done=new Set),stop_timer(e)),stop_timer(e,!0,!0),qwizdata[e].$question_timer&&qwizdata[e].$question_timer.hide(),q.display_summary_and_exit(e)}else{if(q.qwizard_b)qwizdata[e].i_question++,_=qwizdata[e].i_question;else{var x;const t=qwizdata[e].reshow_after;for(;;){if((x=qwizdata[e].ii_question)>=qwizdata[e].n_questions_for_done&&(x=0,qwizdata[e].ii_question=0),_=qwizdata[e].question_order[x],qwizdata[e].repeat_incorrect_b){if(1!=qwizdata[e].answered_correctly[_]){var k=!1;if(t){const i=qwizdata[e].i_questions_done,a=i.length-t;if(a>=0){const t=i[a];1!=qwizdata[e].answered_correctly[t]&&(k=!0,_=t)}}qwizdata[e].i_questions_done.push(_),k||qwizdata[e].ii_question++;break}}else if(void 0===qwizdata[e].answered_correctly[_]||0==qwizdata[e].answered_correctly[_]){qwizdata[e].ii_question++;break}qwizdata[e].ii_question++}}var A=qwizdata[e].i_user_question;qwizdata[e].i_question=_,void 0===qwizdata[e].questions[_]&&(qwizdata[e].questions[_]={});var C=qwizdata[e].questions[_];if(A!=C.i_user_prev_question&&(C.i_user_prev_question=A),-1==A)qwizdata[e].i_first_user_question=_,debug[0]&&console.log("[next_question] i_first_user_question:",_);else{var I=qwizdata[e].questions[A];I?I.i_user_next_question=_:debug[0]&&console.log("[next_question] prev_question for i_prev_question",A,"does not exist"),q.qwizard_b||$(".bck-question-qwiz"+e).css({opacity:.5}).addClass("hover")}qwizdata[e].i_user_question=_,void 0===C.user_question_number&&(qwizdata[e].user_question_number++,C.user_question_number=qwizdata[e].user_question_number),q.qwizard_b||$("span.question-number-qwiz"+e).html(C.user_question_number),q.display_question(e,_,d),q.qwizard_b&&o&&(qwizard.set_qwizard_data("i_question",_),qwizard.go_to_question2(),"hotspot_diagram"!=qw.questions_cards[_].type&&q.display_progress(e))}}}else debug[0]&&console.log("[next_question] n_questions:",o)},this.next_question_from_intro=function(e,t){qwizdata[e].n_questions&&($(".intro-qwiz"+e).hide(),q.no_intro_b[e]||($("#icon_qwiz"+e).hide(),qwizdata[e].qwiz_timer&&(qwizdata[e].n_qs&&(qwizdata[e].n_qs_done||(qwizdata[e].n_qs_done=new Set)),start_timers(e))),$(".bbfe-qwiz"+e).css({visibility:"visible",opacity:.2}).removeClass("hover"),$("span.question-number-qwiz"+e).html(1),$("#next_button-qwiz"+e).css("text-align","left"),qwizdata[e].use_dataset||qwizdata[e].use_dataset_questions_htm||q.display_progress(e,!0),$("#next_button_text-qwiz"+e).html(T("Next question")))},this.bck_question=function(e,t){if(debug[0]&&console.log("[bck_question] i_qwiz:",e),$(".bck-question-qwiz"+e).hasClass("hover")){qwizdata[e].bck_f=!0;var i=qwizdata[e].i_user_question,a=i;if(t){if(qwizdata[e].use_dataset&&qwizdata[e].dataset_intro_f)return qwizdata[e].saved_i_question=qwizdata[e].i_question,$(".bck-question-qwiz"+e).css({opacity:.2}).removeClass("hover"),$(".fwd-question-qwiz"+e).css({opacity:.5}).addClass("hover"),$("span.question-number-qwiz"+e).html("--"),hide_current_question(e,a),i==qwizdata[e].n_questions&&$("div#summary-qwiz"+e).hide(),qwizdata[e].i_question=-1,void q.display_login(e,!1,"use_dataset_options");
1i=qwizdata[e].i_first_user_question}else if(-1==(i=qwizdata[e].questions[i].i_user_prev_question))return;hide_current_question(e,a),$("div#summary-qwiz"+e).hide(),qwizdata[e].i_user_question=i;var s=qwizdata[e].questions[i];if(t||-1==s.i_user_prev_question){var _=$(".bck-question-qwiz"+e);qwizdata[e].use_dataset&&qwizdata[e].dataset_intro_f&&(_=_.last()),_.css({opacity:.2}).removeClass("hover")}var o=s.user_question_number;$("span.question-number-qwiz"+e).html(o),$(".fwd-question-qwiz"+e).css({opacity:.5}).addClass("hover"),qwizq_id="qwiz"+e+"-q"+i,document_qwiz_mobile?$(`div#mobile_${qwizq_id}, div.mobile_${qwizq_id}`).show():$(`div#${qwizq_id}, div.${qwizq_id}`).show(),$(`div.${qwizq_id}-a0_gen`).show(),$("#next_button-qwiz"+e).hide()}},this.fwd_question=function(e,t){if($(".fwd-question-qwiz"+e).hasClass("hover")){if(-1==qwizdata[e].i_question)$("#qwiz_login-qwiz"+e).hide();else{var i=qwizdata[e].i_user_question,a="qwiz"+e+"-q"+i;$(`div#${a}, div.${a}`).hide(),$(`div#mobile_${a}, div.mobile_${a}`).hide()}t?(-1==qwizdata[e].i_question&&(qwizdata[e].i_question=qwizdata[e].saved_i_question),i=qwizdata[e].i_question):-1==qwizdata[e].i_question?(i=qwizdata[e].i_first_user_question,qwizdata[e].i_question=qwizdata[e].saved_i_question):i=qwizdata[e].questions[i].i_user_next_question,qwizdata[e].i_user_question=i;var s=qwizdata[e].questions[i];i==qwizdata[e].i_question&&(qwizdata[e].bck_f=!1,$(".fwd-question-qwiz"+e).css({opacity:.2}).removeClass("hover"),qwizdata[e].next_button_show_b&&$("#next_button-qwiz"+e).show());var _=s.user_question_number;$("span.question-number-qwiz"+e).html(_),i==qwizdata[e].n_questions?$("div#summary-qwiz"+e).show():(a="qwiz"+e+"-q"+i,document_qwiz_mobile?$(`div#mobile_${a}, div.mobile_${a}`).show():$(`div#${a}, div.${a}`).show(),qwizdata[e].summary_b||_==qwizdata[e].n_questions&&$("div#summary-qwiz"+e).show());var o=$(".bck-question-qwiz"+e);-1==s.i_user_prev_question&&(o=o.first()),o.css({opacity:.5}).addClass("hover")}},this.init_question_order=function(e){var t=qwizdata[e].n_questions;qwizdata[e].question_order=new Array(t);for(var i=0;i<t;i++)qwizdata[e].question_order[i]=i;qwizdata[e].random_b&&(qwizdata[e].question_order=qqc.shuffle(qwizdata[e].question_order),debug[0]&&console.log("[init_question_order] qwizdata[i_qwiz].question_order:",qwizdata[e].question_order))},this.display_question=function(e,t,i){var a="qwiz"+e+"-q"+t,s=$(`div#${a}, div.${a}`);debug[0]&&(console.log("[display_question] start_quiz_b:",i),console.log("[display_question] $qwizq:",s)),s.find("[id^="+a+"-a]").hide(),(h=$("div.mobile_"+a
1)).find("[id^=mobile_"+a+"-a]").hide();var _=s.find('input[name="qwiz_img"]');_.length&&(_.changeElements("img"),h.find('input[name="qwiz_img"]').changeElements("img")),qwizdata[e].question_time_limit&&start_timers(e,qwizdata[e].question_time_limit),q.qwizard_b||s.find("span.qwiz_img_swap.not_inited").each((function(){qqc.init_image_swap(this)}));var o=s.hasClass("qwizzled");if(o){if(qwizdata[e].$qwizzled||(qwizdata[e].$qwizzled={}),void 0===qwizdata[e].$qwizzled[a]&&(q.qwizard_b?q.init_qwizzled2(s,e,t):q.init_qwizzled(s,e,t)),qwizdata[e].n_labels_correct=0,qwizdata[e].n_label_attempts=0,-1==qwizdata[e].answered_correctly[t]){s.replaceWith(qwizdata[e].$qwizzled[a]);s=$("div#"+a);qwizdata[e].$qwizzled[a]=$("div#"+a).clone(!0);q.qwizard_b||setTimeout((function(){debug[8]&&console.log("[display_question > delay_init_drag_and_drop] i_qwiz:",e,", i_question:",t),q.init_drag_and_drop(s[0])}),100);setTimeout((function(){place_labels(e,t,a)}),200)}var n=0,r={};s.find("span.qwizzled_target").not(".decoy").each((function(){var e=$
1(this).attr("class"),t=e.match(/qtarget_sib-[0-9]*/);if(t){var i=t[0];r[i]=1}else if(t=e.match(/qwizzled_target-[0-9]*/)){i=t[0];r[i]=1}else n++})),n+=s.find("div.qwizzled_target").not(".decoy").length,qwizdata[e].n_label_targets=n+Object.keys(r).length,q.display_diagram_progress(e)}else if(s.hasClass("hotspot_diagram")){const i=s.find("div.hotspot_image_stack");qwizdata[e].$hotspot_image_stack[t]=i;const a=i.find("canvas.layer0_edited");if(q.qwizard_b)i.find("img.layer0_edited, img.qwiz_style_layer").addClass("qwizard_display_block_important"),i.find("div.qwiz_hotspot_label").removeClass("qwizard_display_none_important"),$("#icon_qwiz"+e).hide();else{qwizdata[e].n_labels_correct=0,qwizdata[e].n_label_attempts=0;const _=qwizdata[e].show_hotspots[t],o=qwizdata[e].find_the_dot[t];if(o){const a=create_find_the_dot_html(e,qwizdata[e].find_the_dot[t]);i.before(a),i.find("img.qwiz_layer0, img.qwiz_style_layer").hide(),s.find("input.find_the_dot_dot_color").simpleColor({boxWidth:"25px",boxHeight:"17px",onSelect:find_the_dot_color_selected}),s.find("input.find_the_dot_background_color").simpleColor({boxWidth:"25px",boxHeight:"17px",onSelect:find_the_dot_color_selected}),q.update_find_the_dot(e,!1,!0),i.find("canvas.layer0_edited").css({outline:"1px dotted gray"}).show()}else{qwizdata[e].spotmap_width[t]=a.data("qwiz_spotmap_width"),qwizdata[e].spotmap_height[t]=a.data("qwiz_spotmap_height");const i=a.data("qwiz_sparsemap");qwizdata[e].sparsemap[t]=i;const s=a.data("qwiz_spotmap");s&&(qwizdata[e].spotmap[t]=i?JSON.parse(s.replace(/(\d+):/g,'"$1":')):new Uint8ClampedArray(base64js.toByteArray(s)))}qwizdata[e].hotspot_image_width[t]=a.attr("width"),qwizdata[e].hotspot_image_height[t]=a.attr("height"),i.find("img.hotspot_only_image").hide(),_&&-1!=_.indexOf("always")&&i.find("img.qwiz_style_layer").show();const n=qwizdata[e].hotspot_user_interaction[t];var d;if(!n||"label_prompt"==n)if(-1==qwizdata[e].answered_correctly[t]){var c=0;d=qwizdata[e].n_hotspots[t];for(var l=0;l<d;l++){const i=qwizdata[e].hotspot_nos[t][l]%1e3;qwizdata[e].hotspot_nos[t][l]<0&&(qwizdata[e].hotspot_nos[t][l]=-i,c++)}qwizdata[e].n_hotspots_to_do[t]=c,debug[0]&&console.log("[display_question] n_hotspots_to_do:",c),qwizdata[e].n_labels_correct=d-c,qwizdata[e].n_label_attempts=0}const r=qwizdata[e].hotspot_labels_stick[t];if(-1!=qwizdata[e].answered_correctly[t]&&(qwizdata[e].hotspot_nos[t]=[],qwizdata[e].hotspot_labels[t]=[],qwizdata[e].hotspot_ver2_f[t]=i.find(".qwiz_hotspot1").hasClass("qwiz_hotspot_ver2"),i.find("div.qwiz_hotspot_label").not(".qwiz_hotspot_deleted").each((function(){const i=$(this),a=i.attr("class").match(/ qwiz_hotspot(\d+)/)[1];qwizdata[e].hotspot_nos[t].push(parseInt(a)),i.find("div.ui-resizable-handle").remove();var s=i.find("div.qwiz_hotspot_label_editable").text();s=qqc.remove_tags_eols(s),qwizdata[e].hotspot_labels[t].push(s),!r||"keep"!=r&&"temporary"!=r||(i.off("mouseenter mouseleave"),i.on("mouseenter",(function(){i.css({opacity:.1})})).on("mouseleave",(function(){i.css({opacity:1})})))})),d=qwizdata[e].hotspot_nos[t].length,qwizdata[e].n_hotspots[t]=d,d||errmsgs.push(T("No hotspots set for hotspot_diagram"),NaN+(e+1)+", "+T("question")+" "+(t+1)),qwizdata[e].n_hotspots_to_do[t]=d,debug[0]&&console.log("[display_question] n_hotspots:",d),_&&-1==_.indexOf("hide")&&!o&&init_hotspot_image_canvas(e,t,i)),qwizdata[e].n_label_targets=d,qwizdata[e].answered_correctly[t]=1,i.find("div.qwiz_hotspot_label").hide(),!n||"label_prompt"==n){s.find("div.hotspot_click_feedback").html("<b>Click on:</b>");const i=pick_random_hotspot(e,t);qwizdata[e].current_query_hotspot_no[t]=i,set_hotspot_label_query(e,t,s)}i.off("click.hotspot_diagram_click"),n&&"info_only"==n?((qwizdata[e].n_questions>1||qwizdata[e].combo||qwizdata[e].use_dataset)&&($("#next_button_text-qwiz"+e).html(T("Continue")),q.position_show_next_button(e),qwizdata[e].next_button_show_b=!0),1==qwizdata[e].user_question_number&&alert_not_logged_in(e)):i.on("click.hotspot_diagram_click",qwiz_.hotspot_diagram_click),(_&&-1!=_.indexOf("hover_show")||r&&-1!=r.indexOf("hover_show"))&&(i.off("mousemove click.mobile_hover_eq"),i.on("mousemove click.mobile_hover_eq",show_hotspot_on_hover),_&&-1==_.indexOf("keep")&&(i.off("mouseleave"),i.on("mouseleave",hide_hotspots)),qwizdata[e].current_xy_hotspot_no=-1),qwizdata[e].icon_swhs&&!qwizdata[e].hide_qwizcards_icon_b&&i.append(create_icon_qwiz_div(e));var w=T("Correctly clicked");
1n&&("find_hotspots"==n?w=T("Found"):"info_only"==n&&(w=T("Visited"))),q.display_diagram_progress(e,w)}}if(i&&qqc.is_mobile(qwizdata[e].mobile_enabled))q.go_mobile(e);else if(document_qwiz_mobile){var h;(h=$(`div#mobile_${a}, div.mobile_${a}`)).length?h.show():s.show(),window.scrollTo(0,1)}else if(debug[0]&&console.log("[display_question] $qwizq:",s),s.css("display","block"),q.qwizard_b){var u=!1;if(qwizdata[e].use_dataset_question_ids[t]){var z=s.find(".qwiz_editable");z.length&&(z.removeClass("qwiz_editable"),u=!0)}else{s.find("div.hangman_image").length;$(`div#${a} .qwiz_editable`).first().each((function(){qwizard.init_tinymce(this),u=!0})),$(`div#${a} .qwiz_editable`).slice(1).each((function(){qwizard.init_tinymce_onclick(this)}))}if(u){var m=t;debug[0]&&console.log("[display_question] reset_i_question:",m);setTimeout((function(){if(void 0!==qwizdata[e].parts_htm[m])for(var t=qwizdata[e].parts_htm[m],i=t.length,a=1;a<=i;a++){var _=t[a];$("#qwiz"+e+"-q"+m+" div.qwiz-part"+a).html(_),debug[12]&&console.log("part_htm:",_)}q.init_textentry_autocomplete(s)}),300)}}setTimeout((function(){const t=$(`#qwiz${e}`).offset().top;$(window).scrollTop()>t&&$("html, body").animate({scrollTop:t-20},1e3,"easeInOutCubic")}),20);var p="#qwiz"+e;q.preview&&(p+="-q"+t+".qwizq_preview");var g=$(p);if(!document_qwiz_mobile&&!document_qwiz_force_mobile_f)if(o){var b=10+s.find("table.qwizzled_table").outerWidth();if(debug[0]&&console.log("[display_question] table_width:",b,", initial_width:",qwizdata[e].initial_width),b>qwizdata[e].initial_width&&(g.css({width:b+"px","max-width":"none"}),qwizdata[e].width_reset=!0),q.qwizard_b)s.find(".qwizzled_highlight_label").addClass("no_move")}else{var f=s.find("img");if(f.length){var v=10+f.outerWidth();q.qwizard_b&&set_initial_width(e),debug[0]&&console.log("[display_question] img_width:",v,", initial_width:",qwizdata[e].initial_width),v>qwizdata[e].initial_width&&(g.css({width:v+"px","max-width":"none"}),qwizdata[e].width_reset=!0)}}if(g.length)if(g.is(":visible"))scale_quiz_to_container(g);else{new IntersectionObserver(scale_quiz_to_container_when_visible,{threshold:1}).observe(g[0])}if(!o)if(qwizdata[e].textentry&&qwizdata[e].textentry[t]){var y=$("#textentry-qwiz"+e+"-q"+t);if(qwizdata[e].textentry[t].textentry_suggest_b){if(!qwizdata[e].textentry[t].single_char_b){if(qwizdata[e].terms)qwizdata[e].textentry_terms_metaphones||(qwizdata[e].textentry_terms_metaphones=qqc.process_textentry_terms(qwizdata[e].terms));else if(!default_textentry_terms_metaphones){var x=qqc.get_qwiz_param("url","./"),k="";"body"==content&&"./"==x?"undefined"!=typeof document_qwiz_terms&&(k=document_qwiz_terms):k=qqc.get_textentry_terms(x+"terms.txt",qwizdata),default_textentry_terms_metaphones=qqc.process_textentry_terms(k)}var A;if(qwizdata[e].add_terms&&(qwizdata[e].add_textentry_terms_metaphones||(qwizdata[e].add_textentry_terms_metaphones=qqc.process_textentry_terms(qwizdata[e].add_terms))),qwizdata[e].check_answer_disabled_b=!0,qwizdata[e].textentry_n_hints=0,textentry_answers[e]=qwizdata[e].textentry[t].answers,textentry_answer_metaphones[e]=textentry_answers[e].map((function(e){return e=e.replace(/\s*(\S+)\s.*/,"$1"),qqc.metaphone(e)})),qwizdata[e].textentry[t].use_terms_b)A=qwizdata[e].textentry[t].textentry_plural_b?"plural":"singular",qwizdata[e].terms?current_question_textentry_terms_metaphones[e]=qwizdata[e].textentry_terms_metaphones[A]:current_question_textentry_terms_metaphones[e]=default_textentry_terms_metaphones[A],qwizdata[e].add_terms&&(current_question_textentry_terms_metaphones[e]=current_question_textentry_terms_metaphones[e].concat(qwizdata[e].add_textentry_terms_metaphones[A]));else current_question_textentry_terms_metaphones[e]=[];var C=textentry_answers[e].map((function(e){return[e,qqc.metaphone(e)]}));if(debug[6]&&console.log("[display_question] textentry_answers_metaphones: ",C),current_question_textentry_terms_metaphones[e]=current_question_textentry_terms_metaphones[e].concat(C),current_question_textentry_terms_metaphones[e]=qqc.sort_dedupe_terms_metaphones(current_question_textentry_terms_metaphones[e]),debug[6]){console.log("[display_question] current_question_textentry_terms_metaphones[i_qwiz].length: ",current_question_textentry_terms_metaphones[e].length),console.log("[display_question] current_question_textentry_terms_metaphones[i_qwiz].slice (0, 10): ",current_question_textentry_terms_metaphones[e].slice(0,10));var I=current_question_textentry_terms_metaphones[e].length-10;I>0&&console.log("[display_question] current_question_textentry_terms_metaphones[i_qwiz].slice ("+I+"): ",current_question_textentry_terms_metaphones[e].slice(I))}var O,j,S,E=qwizdata[e].textentry[t],M=E.textentry_minlength,R=E.first_correct_answer.length;R<M&&(M=R),y.autocomplete("instance")||q.init_textentry_autocomplete(s),y.autocomplete("option","minLength",M),M<=1?(O=T("Type a letter/number"),j=T("Type a letter")):(M=Math.max(M,3),O=(O=T("Type %s+ letters/numbers, then select")).replace("%s",M),j=(j=T("Type %s+ letters")).replace("%s",M)),y.attr("placeholder",O),$("#textentry_check_answer_div-qwiz"+e+"-q"+t+" button.textentry_check_answer").html(j),qwizdata[e].check_answer=j,E.textentry_minlength=M,(S=$("#textentry_check_answer_div-qwiz"+e+"-q"+t)).find("button.textentry_check_answer").addClass("qwiz_button_disabled"),qwizdata[e].check_answer_disabled_b=!0,S.css({display:"inline-block"}),0!=t||!q.no_intro_b[e]&&1!=qwizdata[e].n_questions?q.start_hint_timeout(e):$("div#qwiz"+e).attr("onmouseenter",qname+".start_hint_timeout ("+e+")")}}else(S=$("#textentry_check_answer_div-qwiz"+e+"-q"+t)).find("button.textentry_check_answer").removeClass("qwiz_button_disabled"),qwizdata[e].check_answer_disabled_b=!1,S.css({display:"inline-block"});y.length&&(y.val("").removeAttr("disabled"),qwizdata[e].n_correct+qwizdata[e].n_incorrect==0&&q.no_intro_b[e]||(panel_exit_mobile_just_closed_b=!0,q.preview||y.focus()))}else if(qwizdata[e].information_question_b[t])(qwizdata[e].n_questions>1||qwizdata[e].combo||qwizdata[e].use_dataset)&&($("#next_button_text-qwiz"+e).html(T("Continue")),q.position_show_next_button(e),qwizdata[e].next_button_show_b=!0);else if(void 0!==qwizdata[e].hangman[t]){var Y=qwizdata[e].hangman[t],N=Y.n_hangman;Y.n_hangman_done=0,Y.n_hangman_correct=0;for(var B,F=!0,L=0;L<N;L++)if($hangman=s.find("span.qwiz_hangman.qwiz_hangman_c"+L),B=Y.hangman_final_entry[L],-1==qwizdata[e].answered_correctly[t]&&N>1&&Y.hangman_incorrect_chars[L].length<=3&&0==Y.hangman_n_hints[L])$hangman.find("span.hangman_current_entry").html(B),Y.
1n_hangman_done++,Y.n_hangman_correct++;else{var W,G=B.replace(/>[a-z0-9]</gi,"> <");if(Y.hangman_current_entry[L]=G.replace(/u> </g,"u>\t<"),$hangman.find("span.hangman_current_entry").html(G),q.qwizard_b&&"placeholder"==Y.hangman_answer[L]||($hangman.find("input").off("mousedown"),$("#hangman_hint-qwiz"+e+"-q"+t+"-c"+L).removeAttr("disabled").removeClass("qwiz_button_disabled")),Y.hangman_incorrect_chars[L]="",Y.hangman_incorrect_chars_before_hint[L]=6,Y.hangman_n_hints[L]=0,$hangman[0].done_f=!1,$hangman.find("span.hangman_status").html(""),W=-1!=Y.hangman_answer[L].search(/[a-z]/i)?T("Type letters in the box"):T("Type numbers in the box"),$hangman.find("span.hangman_type_letters").html('<span class="type_letters">'+W+"</span>").show(),s.find("div.qwiz_hangman_msg").hide(),(qwizdata[e].user_question_number>1||!q.no_intro_b[e]||-1==qwizdata[e].answered_correctly[t])&&F&&!q.preview){F=!1,panel_exit_mobile_just_closed_b=!0;var D=s.find("span.qwiz_hangman.qwiz_hangman_c"+L+" input");suppress_hangman_hint_b=!0,q.qwizard_b||D[0].focus()}}}else{if(!q.qwizard_b){var Q=qwizdata[e].default_random_mc;if(qwizdata[e].random_mc&&void 0!==qwizdata[e].random_mc[t]&&(Q=qwizdata[e].random_mc[t]),Q){const e=s.find("span.qwiz-choices"),t=e.length;for(l=0;l<t-1;l++){const i=Math.floor(Math.random()*t);e[0].before(e[i])}}}$("input[name="+a+"]").removeAttr("disabled").prop("checked",!1),$("#mobile_"+a+" li.mobile_choice").show(),s.find("button.show_the_answer").removeClass("qwiz_button_disabled").removeAttr("disabled").show(),s.find("li.mobile_choice").show();$(`div.qwiz${e}-q${t}-a0_gen`);q.qwizard_b||(s.find(`.choices-${a}, .choices-${a} .qwiz-choice`).css({cursor:"",color:""}),s.find(".qwiz_correct_choice").removeClass("qwiz_correct_choice"),s.find(".qwiz_incorrect_choice").removeClass("qwiz_incorrect_choice"))}},this.show_response_recorded=function(e){if(!q.preview){var t=DateFormat.format.date((new Date).getTime(),"h:mm:ss");$(`span.response_recorded-qwiz${e} img.response_recording`).removeClass("response_recording_spin").attr("title",T("Response to question")+" "+qwizdata[e].user_question_number+" "+T("recorded")+" "+t)}},this.pay_lock_settings=function(e,t,i,a,s){qqc.pay_lock_settings(qname,qwizdata,n_qwizzes,t,i,a,e,s)},this.go_mobile=function(e){non_mobile_scrollLeft=window.scrollX,non_mobile_scrollTop=window.scrollY;var t=$("#qwiz"+e);if(qwizdata[e].qwiz_style=t.attr("style"),t.removeAttr("style").removeClass("qwiz").addClass("qwiz-mobile qwizard_qwiz_deck_div"),t.after('<div id="qwiz_div_placeholder"></div>'),t.appendTo("body"),window.scrollTo(0,0),$("body").css({overflow:"hidden"}),$("#icon_qwiz"+e).hide(),qqc.is_mobile(qwizdata[e].mobile_enabled)||!document_qwiz_force_mobile_f){t.find(".qwizzled_label_head_standard").hide(),t.find(".qwizzled_label_head_mobile").show();const _=qwizdata[e].i_user_question;if((-1==_||_<qwizdata[e].n_questions)&&!qwizdata[e].login_show_b){var i="qwiz"+e+"-q"+_,a=$("#"+i),s=$("#mobile_qwiz"+e+"-q"+_);s.length?(s.show(),a.hide()):a.show()}if(qwizdata[e].$qwizzled&&qwizdata[e].$qwizzled[i])reset_label_positions(a),t.css("width","");else if(qwizdata[e].generative_response&&qwizdata[e].generative_response[_]){const t=$(`#qwiz${e}-q${_} textarea`).val();$(`#mobile_qwiz${e}-q${_} textarea`).val(t).trigger("input")}$(".go-mobile-qwiz"+e).hide(),document_qwiz_force_mobile_f||($(".exit-mobile-qwiz"+e).show(),$("#mode-qwiz"+e).hide(),$("#icon-exit-mobile-qwiz"+e).show(),$("#summary-qwiz"+e).find("button.summary_exit_mobile_qwiz").show()),document_qwiz_mobile="mobile_",scale_quiz_to_container(t)}},this.open_panel_exit_mobile=function(e){$("#overlay-exit-mobile-qwiz"+e).show().animate({top:"0px"},500),panel_exit_mobile_open_b=!0,$("#icon-exit-mobile-qwiz"+e).hide()},this.close_panel_exit_mobile=function(e){return $(e).animate({top:"-100px"},500,(function(){$(this).hide(),$("div.icon-exit-mobile-qwiz").show()})),window.scrollTo($(window).scrollLeft(),1),panel_exit_mobile_open_b=!1,panel_exit_mobile_just_closed_b=!0,!1},this.exit_mobile=function(e){var t=$("#qwiz"+e);t.attr("style",qwizdata[e].qwiz_style).removeClass("qwiz-mobile qwizard_qwiz_deck_div").addClass("qwiz"),$("#xqwiz"+e).length&&$("#qwiz"+e).css("width",qwizdata[e].initial_width+"px"),$("#qwiz_div_placeholder").replaceWith(t),$("body").css({overflow:""}),window.scrollTo(non_mobile_scrollLeft,non_mobile_scrollTop),$("#overlay-exit-mobile-qwiz"+e).css({top:"-100px",display:"none"}),$(window).off("scroll"),t.find(".qwizzled_label_head_standard").show(),t.find(".qwizzled_label_head_mobile").hide();const i=qwizdata[e].i_user_question;var a,s="qwiz"+e+"-q"+i,_=$("."+s);i>=0&&i<qwizdata[e].n_questions&&!qwizdata[e].login_show_b&&($(".mobile_qwiz"+e+"-q"+i).hide(),_.show());if((a=qwizdata[e].$qwizzled&&qwizdata[e].$qwizzled[s]?_.find("table.qwizzled_table"):_.find("img")).length){var o=10+a.outerWidth();if(o>qwizdata[e].initial_width){var n="#qwiz"+e;q.preview&&(n+="-q"+i+".qwizq_preview"),$(n).css({width:o+"px","max-width":"none"}),qwizdata[e].width_reset=!0}qwizdata[e].$qwizzled&&qwizdata[e].$qwizzled[s]&&reset_label_positions(_)}if(i>=0&&i<qwizdata[e].n_questions&&qwizdata[e].generative_response&&qwizdata[e].generative_response[i]){const t=$(`#mobile_qwiz${e}-q${i} textarea`).val();$(`#qwiz${e}-q${i} textarea`).val(t).trigger("input")}$("div.icon-exit-mobile-qwiz, div.icon-panel-exit-mobile-qwiz").hide(),$(".exit-mobile-qwiz").hide(),$("button.summary_exit_mobile_qwiz").hide();const r=qwizdata[e].mobile_enabled;("Always"==r||"Small screens only"==r&&qqc.is_mobile(r))&&$(".go-mobile-qwiz"+e).show(),document_qwiz_mobile="",panel_exit_mobile_just_closed_b=!1},this.start_hint_timeout=function(e){$("div#qwiz"+e).removeAttr("onmouseenter");const t=qwizdata[e].i_question,i=$("#textentry_check_answer_div-qwiz"+e+"-q"+t);debug[0]&&console.log("[start_hint_timeout] $check_answer.length:",i.length);i.find("button.qwiz_textentry_hint").html("Hint").hide(),hint_timeout_sec>=0&&(show_hint_timeout[e]=setTimeout((function(){i.find("button.qwiz_textentry_hint").removeAttr("disabled").html("Hint").css({display:"inline-block"})}),1e3*hint_timeout_sec))},this.stuck_show_answer=function(e,t,i){const a=$(`#qwiz${t}-q${i}-a0`),s=$(`#mobile_qwiz${t}-q${i}-a0`),_=a.find(".answer_guide_header"),o=s.find(".answer_guide_header"),n=`<p class="answer_guide_header" style="font-weight: bold; color: blue;">${T("Answer Guide")}</p>`;
10==_.length&&a.prepend(n).css({border:"2px solid blue",padding:"5px"}),0==o.length&&s.prepend(n).css({border:"2px solid blue",padding:"5px"}),a.show(),s.show(),q.preview||qwizdata[t].bck_f||($(`#show_answer_got_it_or_not-qwiz${t}-q${i}`).show(),$(`#mobile_show_answer_got_it_or_not-qwiz${t}-q${i}`).show(),$(`#show_answer_got_it_or_not-qwiz${t}-q${i} .ok_ive_got_it`).attr("disabled",!0).addClass("qwiz_button_disabled"),$(`#mobile_show_answer_got_it_or_not-qwiz${t}-q${i} .ok_ive_got_it`).attr("disabled",!0).addClass("qwiz_button_disabled"),$(`#show_answer_got_it_or_not-qwiz${t}-q${i} button.view_answer_guide`).html(T("Hide answer guide")),$(`#mobile_show_answer_got_it_or_not-qwiz${t}-q${i} button.view_answer_guide`).html(T("Hide answer guide")))};var first_decode_err_f=!0,hotspot_long_hover_id,hotspot_label_hide_id;function cvt_feedback(e,t){var i,a;const s=void 0!==t;if(s)i=e.substr(0,t),a=e.substr(t);else{if(c_pos=e.indexOf("[c]"),-1==c_pos)return e;i=e.substr(0,c_pos),a=e.substr(c_pos+3)}var _,o;-1==(t=a.indexOf("[f]"))&&(t=a.indexOf("[fx]"));var n="";if(-1!=t)for(_=a.substr(t+3),a=a.substr(0,t);;){-1==(t=_.indexOf("[f]"))?o=_:(o=_.substr(0,t),_=_.substr(t+3));var r=(d=feedback_decode(o)).c;if(r&&(n+="[f]"+r),-1==t)break}var d=feedback_decode(a),q="",c="";if(!s)q="[c"+d.star+"]",c=d.c;return i+q+c+n}function feedback_decode(e){var t,i=e.indexOf("[Qq]"),a="";-1!=i?(t=e.substr(0,i),a=e.substr(i+4)):t=e,debug[2]&&console.log("[feedback_decode] s_to_decode:",t);var s="",_="",o=t.split(/<[^>]+>/);if(o.length>1){for(var n=t.match(/<[^>]+>/g),r=[],d=n.length,q=!0,c=0;c<d;c++){if(""!=(l=o[c])){q&&(q=!1,/ /.test(l)&&(s="*"));try{r.push(Base64.decode(l))}catch(e){}}-1!=n[c].indexOf("qcodeq")&&(reinit_highlighting_f=!0,n[c]=n[c].replace("qcodeq","code")),r.push(n[c])}try{var l=o[d];q&&/ /.test(l)&&(s="*"),r.push(Base64.decode(l))}catch(e){}_=r.join("")}else{/ /.test(t)&&(s="*");try{_=Base64.decode(t)}catch(e){}}return _+=a,debug[2]&&console.log("[feedback_decode] decoded_s:",_),{c:_,star:s}}function create_hangman_textentry_editable_divs(e,t,i,a,s,_,o){o=qqc.shortcodes_to_video_elements(o);var n=[],r=create_bg_img_style(e,t);"response"!=s&&n.push('<div id="qwiz'+e+"-q"+t+'" class="qwizq qwizard_line_height"'+r+">\n"),void 0===qwizdata[e].parts_htm[t]&&(qwizdata[e].parts_htm[t]=[]);var d=0,q=1;for(o.length;;){var c=o.substr(d),l=c.search(_);if(-1==l)break;d+=l;var w=c.substr(0,l);1==q&&(w=i+w),-1==(w=qqc.remove_unmatched_tag(w,1==q)).search(/\S/)&&(w=" "),qwizdata[e].parts_htm[t][q]=w;var h=c.match(_);debug[9]&&console.log("[create_hangman_textentry_editable_divs] m[0]:",h[0]),d+=h[0].length,n.push('<div class="qwiz-question qwiz-question-'+s+" qwiz-parts qwiz-part"+q+' qwiz-inline qwiz_editable" data-i_part="'+q+'">\n'),n.push(w),n.push("</div>"),n.push(a[q-1]),q++}if("response"!=s){w=o.substr(d);-1==(w=qqc.remove_unmatched_tag(w,!1,!0)).search(/\S/)&&(w=" "),qwizdata[e].parts_htm[t][q]=w,n.push('<div class="qwiz-question qwiz-question-'+s+" qwiz-parts qwiz-part"+q+' qwiz-inline qwiz_editable" data-i_part="'+q+'">\n'),n.push(w),n.push("</div>")}return n.join("")}function update_hangman_input(e,t,i,a,s,_,o,n){for(var r=!1,d=!1,c=-1,l=new RegExp("u>"+e+"</u","i");;){var w=i.substr(c+1).match(l);if(!w)break;c+=w.index+2,t=qqc.setCharAt(t,c+1,w[0][2]),d=!0}debug[9]&&console.log("[update_hangman_input] keychar:",e,", good_char_b:",d);var h=qwizdata[a].hangman[s],u=h.hangman_incorrect_chars[_],z=(r=!1,!1);if(d){h.hangman_current_entry[_]=t;var m=t.replace(/\t/g," ");$(o).parents("span.qwiz_hangman.qwiz_hangman_c"+_).find("span.hangman_current_entry").html(m),(r=-1==t.indexOf("<u>\t</u>"))&&(h.n_hangman_done++,z=h.n_hangman_done==h.n_hangman)}else e=e.toLowerCase(),-1==u.indexOf(e)&&(u+=e).length>6&&(r=!0,h.n_hangman_done++,z=h.n_hangman_done==h.n_hangman),h.hangman_incorrect_chars[_]=u,debug[9]&&console.log("[hangman_keyup] hangman_incorrect_chars:",u);if(r){$(o).on("mousedown",(function(e){e.preventDefault()})),o.parentElement.done_f=!0;const e=h.hangman_n_hints[_];var p=u.length<=6&&0==e;if(p)h.n_hangman_correct++,h.n_hangman>1&&($("div#qwiz"+a+"-q"+s+" div.qwiz-feedback").hide(),$("div#qwiz"+a+"-q"+s+" div.qwiz_hangman_msg").hide()),$("#qwiz"+a+"-q"+s+"-a"+_).show(),z&&h.n_hangman_correct==h.n_hangman&&(q.qwizard_b||(qwizdata[a].n_correct++,qwizdata[a].n_qs_done&&qwizdata[a].n_qs_done.add(qwizdata[a].dataset_id[s])));else{h.n_hangman>1&&$("div#qwiz"+a+"-q"+s+" div.qwiz-feedback").hide();var g="<hr />";if(qwizdata[a].repeat_incorrect_b){const i=t.match(/<u>[^\t]<\/u>/g);if(i){i.length;1==i.length?g+=T("You got one letter correct")+". ":g=(g+=T("You got %s letters correct")+". ").replace("%s",qqc.number_to_word(i.length)),1==e?g+=T("You used one hint")+". ":e>1&&(g=(g+=T("You used %s hints")+". ").replace("%s",qqc.number_to_word(e))),u.length&&(g+=T("Incorrect letters")+": "+u+". "+T("Pick different letters when you see this word again."))}else g="<hr />"+T("Sorry, you entered more than six incorrect letters")+": "+u+". "+T("Choose different letters when you see this word again!")}else g="<hr />"+T("Sorry, you entered more than six incorrect letters.");$("div#qwiz"+a+"-q"+s+" div.qwiz_hangman_msg").html(g).show(),z&&h.n_hangman_correct!=h.n_hangman&&(q.qwizard_b||qwizdata[a].n_incorrect++)}if(z){if(q.qwizard_b||(qwizdata[a].answered_correctly[s]=h.n_hangman==h.n_hangman_correct?1:-1),o.blur(),qwizdata[a].qrecord_id&&document_qwiz_user_logged_in_b){var b=h.hangman_answer[_],f={q_and_a_text:btoa(encodeURIComponent(qwizdata[a].q_and_a_text[s])),q_and_a_crc32:qwizdata[a].q_and_a_crc32[s],i_question:qwizdata[a].dataset_id[s],unit:qwizdata[a].unit[s],level:qwizdata[a].level[s],type:"hangman",response:b,correct_b:p?1:"",confirm:"js"};record_response(a,qwizdata[a].qrecord_id,f)}update_topic_statistics(a,s,p),update_progress_show_next(a)}else{var v=!0;for(_=0;_<h.n_hangman;_++)if(h.hangman_current_entry[_]!=h.hangman_final_entry[_]&&h.hangman_incorrect_chars[_].length<=6){var y=$("div#qwiz"+a+"-q"+s+" span.qwiz_hangman.qwiz_hangman_c"+_);v?(y.find("input").focus(),v=!1):y.find("span.hangman_type_letters").show()}}r=!0}return r}function single_char_textentry_keyup(e){var t=e.target;if(debug[6]&&console.log("[single_char_textentry_keyup] input_el:",t),-1==t.value.search(/[a-z0-9]/i))return t.value="",!1;var i=t.id.match(/qwiz([0-9]+)/)[1];debug[6]&&console.log("[single_char_textentry_keyup] i_qwiz:",i),1==qwizdata[i].user_question_number&&($("div#icon_qwiz"+i).hide(),alert_not_logged_in(i),qwizdata[i].qwiz_timer&&start_timers(i)),q.textentry_check_answer(i,!0)}function process_feedback_item(e,t,i,a,s){debug[2]&&console.log("[process_feedback_item] choice_html: ",e);var _,o=qqc.parse_html_block(e,["[f]","[fx]"],["[f]","[fx]","[x]"]),n="";return"NA"!=o?(e=e.replace(o,""),debug[2]&&console.log("[process_feedback_item] feedback_item_html: ",o),_=-1!=o.indexOf("[fx]"),n=create_feedback_div_html(t,i,a,o=o.replace(/\[fx{0,1}\]/,""),"",s)):o="",debug[2]&&(console.log("[process_feedback_item] feedback_div:",n),console.log("[process_feedback_item] choice_html: ",e),console.log("[process_feedback_item] fx_b: ",_)),{feedback_div:n,choice_html:e,feedback_item_html:o,fx_b:_}}function init_hotspot_image_canvas(e,t,i){const a=i.find("canvas.layer0_edited")[0],s=a.getContext("2d");qwizdata[e].ctx[t]=s;const _=i.find("img.layer0_edited")[0];if(_.complete)s.drawImage(_,0,0,a.width,a.height);else{const e=new Image;e.src=_.src,e.onload=function(){s.drawImage(e,0,0,a.width,a.height)}}}function process_hotspot_diagram(e,t,i,a,s){debug[0]&&console.log("[process_hotspot_diagram] question_htm: ",i);var _=[];_.push('<div id="qwiz'+e+"-q"+t+'" class="qwizq hotspot_diagram">');const o=i.indexOf('<div class="hotspot_image_stack"'),n=i.substr(0,o);if(q.qwizard_b){_.push('<div class="qwiz_editable qwiz-question">'),_.push(a+n),_.push("</div>");var r=i.substr(o);_.push(r),_.push('<div style="clear: both;"></div>'),_.push('<div class="hotspot_click_feedback hotspot_click_feedback_correct qwiz_editable"></div>'),_.push('<div class="hotspot_click_feedback hotspot_click_feedback_incorrect qwiz_editable"></div>')}else{_.push(a+i);const s=qwizdata[e].hotspot_user_interaction[t];s&&"info_only"==s||(_.push('<div style="clear: both;"></div>'),_.push('<div class="hotspot_click_feedback"></div>'),_.push('<div class="hotspot_label_query"></div>'))}if(_.push("</div>"),set_qwizard_data_b){if(qw.questions_cards[t].type="hotspot_diagram",qw.questions_cards[t].question_text=n,q.qwizard_b){var d="";if(l=r.match(/<img class="qwiz_layer0[^_][^>]*>/)){let e=l[0].match(/ src="([^"]*)"/);e&&(d=e[1])}qw.questions_cards[t].hotspot_image_src=d}qw.questions_cards[t].canvas_el=""}if(_=_.join("\n"),debug[0]&&console.log("[process_hotspot_diagram] htm:",_),qwizdata[e].hotspot_nos||(qwizdata[e].hotspot_nos={},qwizdata[e].hotspot_labels={},qwizdata[e].hotspot_highlighted_fs={},qwizdata[e].hotspot_ver2_f={},qwizdata[e].n_hotspots_to_do={},qwizdata[e].$hotspot_image_stack={},qwizdata[e].hotspot_image_width={},qwizdata[e].hotspot_image_height={},qwizdata[e].spotmap={},qwizdata[e].spotmap_width={},qwizdata[e].spotmap_height={},qwizdata[e].sparsemap={},qwizdata[e].n_hotspots={},qwizdata[e].current_query_hotspot_no={}),qwizdata[e].qrecord_id)if(qqc.isInteger(qwizdata[e].dataset_id[t])){var c=qqc.remove_tags_eols(n);qwizdata[e].q_and_a_text[t]=qqc.q_and_a_hash(c),qwizdata[e].q_and_a_crc32[t]=qwiz_crc32(_),debug[0]&&(console.log("[process_hotspot_diagram] qwizdata[i_qwiz].q_and_a_text[i_question]:",qwizdata[e].q_and_a_text[t]),console.log("[process_hotspot_diagram] qwizdata[i_qwiz].q_and_a_crc32[
1i_question]:",qwizdata[e].q_and_a_crc32[t]))}else qwizdata[e].q_and_a_text[t]=qwizdata[e].dataset_id[t],qwizdata[e].q_and_a_crc32[t]="dataset";if(s){var l;qw.questions_cards[t].question_html=n,(l=i.match(/qwiz_layer0[^"]+"\s+src="([^"]+)/))?qw.questions_cards[t].image_url=l[1]:(console.log("[process_hotspot_diagram] (did not find image) question_htm:",i),qw.questions_cards[t].image_url="NA");var w=[],h=[],u=[];const e=/<div\s*(id=""){0,1}\s*class="qwiz_hotspot_label /,a='<span class="hotspot_label_feedback_correct_content">',s='<span class="hotspot_label_feedback_incorrect_content">';for(var z=i;;){const t=z.search(e);if(-1==t)break;const i=qqc.find_matching_block(z.substr(t));var m,p,g;if(-1!=i.indexOf("qwiz_hotspot_deleted"))m="[deleted]",p="",g="";else{const e=i.search('<div class="hotspot_label_feedback');m=(m=(m=(m=i.substr(0,e)).replace(/<div[^>]+>/,"")).replace(/<div[^>]+>/,"")).replace(/<\/div>[^]*/,"");const t=i.substr(e),_=t.search(a);p=(p=qqc.find_matching_block(t.substr(_)).substr(53)).replace(/<\/span>$/,"");const o=t.search(s);var b=t.substr(o);g=(g=(b=qqc.find_matching_block(b)).substr(55)).replace(/<\/span>$/,"")}w.push(m),h.push(p),u.push(g),z=z.substr(t+i.length)}if(qw.questions_cards[t].hotspot_labels=w,qw.questions_cards[t].feedback_corrects=h,qw.questions_cards[t].feedback_incorrects=u,(l=i.match(/<canvas.*?width="(\d+)/m))?qw.questions_cards[t].hotspot_image_width=l[1]:(console.log("[process_hotspot_diagram] (did not find canvas width) question_htm:",i),qw.questions_cards[t].hotspot_image_width=0),(l=i.match(/<canvas.*?height="(\d+)/m))?qw.questions_cards[t].hotspot_image_height=l[1]:(console.log("[process_hotspot_diagram] (did not find canvas height) question_htm:",i),qw.questions_cards[t].hotspot_image_height=0),(l=i.match(/qwiz_spotmap_width="(\d+)/m))?qw.questions_cards[t].spotmap_width=l[1]:(console.log("[process_hotspot_diagram] (did not find spotmap_width) question_htm:",i),qw.questions_cards[t].spotmap_width=0),(l=i.match(/qwiz_spotmap_height="(\d+)/m))?qw.questions_cards[t].spotmap_height=l[1]:(console.log("[process_hotspot_diagram] (did not find spotmap_height) question_htm:",i),qw.questions_cards[t].spotmap_height=0),l=i.match(/qwiz_sparsemap="(\d+)/m),qw.questions_cards[t].sparsemap=!!l&&"1"==l[1],(l=i.match(/qwiz_spotmap="([^"]+)/m))?qw.questions_cards[t].spotmap=l[1]:(console.log("[process_hotspot_diagram] (did not find spotmap) question_htm:",i),qw.questions_cards[t].spotmap=""),l=i.match(/img class="qwiz_style_layer[^"]+"\s+src="([^"]+)/)){var f=l[1];if("blob"==f.substr(0,4)){const e="wait"+(new Date).getTime();qqc.get_blob_as_data_url(e,f),f=e}qw.questions_cards[t].style_layer_src=f,debug[0]&&console.log("[process_hotspot_diagram] JSON.stringify (qw.questions_cards["+t+"]):",JSON.stringify(qw.questions_cards[t]))}}return _}
1function create_find_the_dot_html(e,t){const i=t.width,a=t.height,s=t.dot_color,_=t.background_color,o=t.controls,n=t.new_dot_button_style;var r=[];const d=o?"block":"none";r.push('<div class="find_the_dot_controls" style="display: '+d+'; margin-bottom: 2px;">'),r.push("Width"),r.push('<input class="find_the_dot_width" type="text" onchange="'+qname+".update_find_the_dot ("+e+')" value="'+i+'" />'),r.push("Height"),r.push('<input class="find_the_dot_height" type="text" onchange="'+qname+".update_find_the_dot ("+e+')" value="'+a+'" />'),r.push('<button class="qwiz_button_small" style="background: gray;">'),r.push("Go"),r.push(" </button>"),r.push(" "),r.push("Dot color"),r.push('<div class="qwiz_simplecolor_wrapper" style="z-index: 3;">'),r.push('<input class="find_the_dot_dot_color" type="text" value="'+s+'" />'),r.push("</div>"),r.push(" "),r.push("Background"),r.push('<div class="qwiz_simplecolor_wrapper" style="z-index: 2;">'),r.push('<input class="find_the_dot_background_color" type="text" value="'+_+'" />'),r.push("</div>"),r.push("</div>");var q=' class="qwiz_button qwiz_smaller"',c="float: right;";return n&&(q="","none"!=n&&(c+=n)),r.push("<button"+q+' style="'+c+'" onclick="'+qname+".update_find_the_dot ("+e+', true)" title="'+T("Place dot at new random location")+'">'),r.push("New dot"),r.push("</button>"),o&&r.push('One in <span class="find_the_dot_n_dots"></span>'),r.push("<br />"),r.join("\n")}function find_the_dot_color_selected(e,t){debug[0]&&console.log("[find_the_dot_color_selected] value:",e,", input_el:",t);const i=$(t).parents("div.qwiz")[0].id.substr(4),a=qwizdata[i].i_question,s=($(t).hasClass("find_the_dot_dot_color")?"dot":"background")+"_color";qwizdata[i].find_the_dot[a][s]="#"+e,q.update_find_the_dot(i)}this.hangman_show=function(e,t){if(suppress_hangman_hint_b)return suppress_hangman_hint_b=!1,!1;var i=$(e);if(i.find("span.hangman_type_letters").hide(),clearTimeout(e.i_hint_timeout),t){e.i_hint_timeout=setTimeout((function(){i.find("button.hangman_hint, span.hangman_status").fadeOut(1e3)}),750)}if(!e.done_f){i.find("button.hangman_hint").show();var a=i.find("span.hangman_status");a.html()&&a.show()}},this.hangman_hide=function(e){var t=$(e);e.i_hint_timeout=setTimeout((function(){t.find("button.hangman_hint, span.hangman_status").fadeOut(500)}),500)},this.hangman_keyup=function(e,t,i,a,s,_){1!=qwizdata[a].user_question_number||!q.no_intro_b[a]&&1!=qwizdata[a].n_questions||($("div#icon_qwiz"+a).hide(),alert_not_logged_in(a),qwizdata[a].qwiz_timer&&start_timers(a));var o=e.value;e.value=i,debug[9]&&console.log("[hangman_keyup] value.charCodeAt:",o.charCodeAt(0),o.charCodeAt(1),o.charCodeAt(2),o.charCodeAt(3));var n=o.replace(/[^a-z0-9]/gi,"");if(""==n)return!1;n=n.toLowerCase(),debug[9]&&console.log("[hangman_keyup] keychars:",n);for(var r=qwizdata[a].hangman[s].hangman_current_entry[_],d=qwizdata[a].hangman[s].hangman_final_entry[_],c=n.length,l=0;l<c;l++){var w;if(w=update_hangman_input(n[l],r,d,a,s,_,e))break}if(!w&&($("div#qwiz"+a+"-q"+s+" div.qwiz-feedback").hide(),$(e).parents("div.qwizq").find("div.qwiz_hangman_msg").hide(),qwizdata[a].hangman[s].hangman_incorrect_chars[_])){var h=qwizdata[a].hangman[s].hangman_incorrect_chars_before_hint[_],u=qqc.create_hangman_incorrect_chars_display(qwizdata[a].hangman[s].hangman_incorrect_chars[_],h,!0);$(e).parents("span.qwiz_hangman.qwiz_hangman_c"+_).find("span.hangman_status").html(u).show()}return!0},this.hangman_hint=function(e,t,i){if(qwizdata[e].hangman[t].hangman_n_hints[i]++,qwizdata[e].hangman[t].hangman_n_hints[i]>qwizdata[e].hangman[t].hangman_max_hints)return!1;qwizdata[e].hangman[t].hangman_n_hints[i]==qwizdata[e].hangman[t].hangman_max_hints?$("#hangman_hint-qwiz"+e+"-q"+t+"-c"+i).attr("disabled",!0).addClass("qwiz_button_disabled"):qwizdata[e].hangman[t].hangman_incorrect_chars_before_hint[i]=qwizdata[e].hangman[t].hangman_incorrect_chars[i].length;qwizdata[e].hangman[t].hangman_answer[i];var a=qwizdata[e].hangman[t].hangman_current_entry[i],s=a.match(/<u>.<\/u>/g),_=s.indexOf("<u>\t</u>");if(debug[9]&&(console.log("[hangman_hint] matches:",s),console.log("[hangman_hint] i_pos:",_)),-1!=_){var o=qwizdata[e].hangman[t].hangman_final_entry[i],n=(s=o.match(/<u>.<\/u>/g))[_][3],r=$("div#"+("qwiz"+e+"-q"+t)).find("span.qwiz_hangman.qwiz_hangman_c"+i+" input");update_hangman_input(n,a,o,e,t,i,r[0],!0),r.focus()}}
1,this.create_hotspot_image=function(e,t,i,a,s){if(debug[0])var _=(new Date).getTime();const o=s.canvas.width,n=s.canvas.height,r=s.getImageData(0,0,o,n).data,d=(new Uint32Array(r.buffer),"qwiz_tmp_hotspot-only_canvas-qwiz"+e);var c=$("canvas."+d),l=!0;c.length||(l=!1,$("body").append('<canvas class="'+d+' qwiz_display_none" width="'+o+'" height="'+n+'"></canvas>'),c=$("canvas."+d));const w=c[0];var h=w.getContext("2d");const u=qwizdata[e].find_the_dot[t];if(u){u.hotspot_only_new_f=!1,c.attr("width",o),c.attr("height",n),h.clearRect(0,0,o,n),h.beginPath();var[z,m,p]=qqc.hex_to_rgb(u.background_color.substr(1));z=255-z,m=255-m,p=255-p,h.strokeStyle="rgb("+z+", "+m+", "+p+")",h.lineWidth=2,h.arc(1+u.ix,1+u.iy,10,0,2*Math.PI),h.stroke();a.find("div.qwiz_hotspot_label.qwiz_hotspot"+i).css({left:8+u.ix,top:8+u.iy})}else{l&&(h.clearRect(0,0,o,n),h.beginPath());hotspot_indexof(qwizdata[e].hotspot_nos[t],i);const a=qwizdata[e].hotspot_ver2_f[t],[s,_,d]=q.hotspot_color_from_no(i,a);if(!a)if(11==i)var[g,b,f]=q.hotspot_color_from_no(1);else if(13==i)var[g,b,f]=q.hotspot_color_from_no(3);var v=!1;const c=$("div#qwiz"+e+"-q"+t),w=c.find("div.qwiz_hotspot_label.qwiz_hotspot1");var y,x=w.attr("data-border_all");x||(x=i);const u=(y=c.find("div.qwiz_hotspot_label.qwiz_hotspot"+x)).data("border_width");u&&"0"!=u&&(v=!0);var k=w.attr("data-highlight_all");if(k||(k=i),y=c.find("div.qwiz_hotspot_label.qwiz_hotspot"+k),!v){const e=y.data("highlight_brightness");e&&"0"!=e&&(v=!0)}if(!v){v=!!y.data("highlight_tint")}qwizdata[e].hotspot_highlighted_fs[t]||(qwizdata[e].hotspot_highlighted_fs[t]={}),qwizdata[e].hotspot_highlighted_fs[t][i]=v;const z=o*n;if(v){const e=c.find("img.qwiz_style_layer")[0];if(e.complete)h.drawImage(e,0,0,o,n);else{const t=new Image;t.src=e.src,t.onload=function(){h.drawImage(t,0,0,o,n)}}var A=(C=h.getImageData(0,0,o,n)).data,T=new Uint32Array(A.buffer);for(let e=0;e<z;e++){let t=e<<2;if(r[t+3]==q.hotspot_alpha_value){const i=r[t],a=r[t+1],o=r[t+2];rgb_same(i,s)&&rgb_same(a,_)&&rgb_same(o,d)||(T[e]=0)}else T[e]=0}}else{var C;A=(C=h.getImageData(0,0,o,n)).data,T=new Uint32Array(A.buffer);const e=-1065320320;for(let t=0;t<z;t++){let o=t<<2;if(r[o+3]==q.hotspot_alpha_value){const n=r[o],q=r[o+1],c=r[o+2];rgb_same(n,s)&&rgb_same(q,_)&&rgb_same(c,d)?a||11!=i&&13!=i||rgb_same(n,g)&&rgb_same(q,b)&&rgb_same(c,f)&&(T[t]=e):T[t]=e}else T[t]=e}}h.putImageData(C,0,0)}const I=w.toDataURL();return debug[0]&&(console.log("[create_hotspot_image] dataURL:",I),console.log("[create_hotspot_image] msec:",(new Date).getTime()-_)),I},this.update_find_the_dot=function(e,t,i){const a=qwizdata[e].i_question,s=$("div#qwiz"+e),_=$("div#qwiz"+e+"-q"+a),o=_.find("div.hotspot_image_stack"),n=o.find("canvas.layer0_edited"),r=n[0].getContext("2d");qwizdata[e].ctx[a]=r;const d=parseInt(_.find("input.find_the_dot_width").val()),c=parseInt(_.find("input.find_the_dot_height").val());if(d<1||d>1e3||c<1||c>1e3)return void alert("Please enter a number between 1 and 1000");var l=qwizdata[e].find_the_dot[a];if(l.hotspot_only_new_f=!0,!t){o.css({width:d,height:c}),n.attr("width",d),n.attr("height",c),qwizdata[e].hotspot_image_width[a]=d,qwizdata[e].hotspot_image_height[a]=c,_.find("span.find_the_dot_n_dots").html((d*c).toLocaleString());const t=10+parseInt(d);t>qwizdata[e].initial_width&&(s.css({width:t+"px","max-width":"none"}),qwizdata[e].width_reset=!0)}if(r.fillStyle=l.background_color,r.fillRect(0,0,d,c),(t||i)&&(l.ix=parseInt(Math.random()*d),l.iy=parseInt(Math.random()*c),t)){qwizdata[e].n_labels_correct=0,qwizdata[e].n_label_attempts=0,q.display_diagram_progress(e,T("Visited"));var w=qwizdata[e].hotspot_nos[a];const t=w.length;for(let e=0;e<t;e++)w[e]=w[e]%1e3}const h=l.ix,u=l.iy;r.fillStyle=l.dot_color,r.fillRect(h,u,1,1),qwizdata[e].sparsemap[a]=1;var z={};const m=Math.max(0,h-1),p=Math.min(d,h+2),g=Math.max(0,u-1),b=Math.min(c,u+2);for(var f=m;f<p;f++){z[f]={};for(var v=g;v<b;v++)z[f][v]=1}debug[0]&&console.log("[update_find_the_dot] spotmap:",z),qwizdata[e].spotmap[a]=z,qwizdata[e].spotmap_width[a]=d,qwizdata[e].spotmap_height[a]=c},this.hotspot_diagram_click=function(e){debug[0]&&console.log("[hotspot_diagram_click] event:",event);const t=$(event.target).parents("div.qwizq")[0].id.match(/qwiz(\d+)/)[1],i=qwizdata[t].i_question;if(1==qwizdata[t].user_question_number&&($("div#icon_qwiz"+t).hide(),alert_not_logged_in(t),qwizdata[t].qwiz_timer&&start_timers(t)),-1==qwizdata[t].use_dataset.indexOf("secure_hotspot")){const e=is_xy_hotspot(t,i,event.offsetX,event.offsetY);q.hotspot_diagram_click2(t,i,e)}else{const e={use_dataset:qwizdata[t].use_dataset,dataset_id:qwizdata[t].dataset_id[i],i_question:i,ix:event.offsetX,iy:event.offsetY};qqc.qjax(qname,t,"","is_xy_hotspot",e)}},this.hotspot_diagram_click2=function(e,t,i){const a=qwizdata[e].hotspot_nos[t],s=qwizdata[e].current_query_hotspot_no[t],_=qwizdata[e].$hotspot_image_stack[t];debug[0]&&console.log("[hotspot_diagram_click2] current_query_hotspot_no:",s),qwizdata[e].n_label_attempts++;var o=qwizdata[e].hotspot_user_interaction[t];o||(o="label_prompt");const n=qwizdata[e].show_hotspots[t];var r=qwizdata[e].hotspot_labels_stick[t];r||(r="hide");var d,c,l="",w=!1,h=!1,u=i>0;"label_prompt"==o?(c=s,u=i==s):c=i;const z=$("#qwiz"+e+"-q"+t);if(d=z.find("div.qwiz_hotspot_label.qwiz_hotspot"+c),c){var m=hotspot_indexof(a,c);-1==m&&(alert("Sorry, error"),m=0)}if("find_hotspots"==o&&(debug[0]&&console.log("[hotspot_diagram_click2] hotspot_nos:",a),Math.abs(a[m])>1e3&&(i=0,u=!1)),u){if(a[m]+=1e3*Math.sign(a[m]),n&&"always"!=n&&-1==n.indexOf("hide")){show_hotspot_on_hover();const a=_.find("img.qwiz_layer"+i),s=qwizdata[e].hotspot_highlighted_fs[t][i]?"keep":"temporary";_.find("img.hotspot_only_image.hotspot_temporary").removeClass("hotspot_temporary").hide(),-1!=n.indexOf("temporary")?a.addClass("hotspot_temporary").show():-1!=n.indexOf("keep")&&a.addClass("hotspot_"+s).show()}if("temporary"==r&&_.find("div.qwiz_hotspot_label").hide(),"temporary"==r||"keep"==r){setTimeout((function(){d.css({display:"inline-block"})}),100),"keep"==r&&d.addClass("hotspot_clicked")}qwizdata[e].n_labels_correct++,qwizdata[e].n_hotspots_to_do[t]--;
1if(l=`<img src="${qqc.get_qwiz_param("url","./")}images/checkmark_icon.png" /> `,(p=d.find("span.hotspot_label_feedback_correct_content")).length?(l+=p.html(),qqc.is_only_tags_and_whitespace(l)?l+=q.canned_feedback(!0):l=l.replace(/ /g," ")):l+=q.canned_feedback(!0),qwizdata[e].n_hotspots_to_do[t]&&"label_prompt"==o){l+="<div><b>"+T("Now click on:")+"</b></div>";const i=pick_random_hotspot(e,t);0==i?qwizdata[e].n_hotspots_to_do[t]=0:(qwizdata[e].current_query_hotspot_no[t]=i,set_hotspot_label_query(e,t,z))}if(!qwizdata[e].n_hotspots_to_do[t]){if(w=!0,set_hotspot_label_query(e,t,z,!0),_.off("mousemove click.hotspot_diagram_click click.mobile_hover_eq"),!q.qwizard_b&&!q.preview){if(h=1==qwizdata[e].answered_correctly[t]){if(qwizdata[e].n_correct++,qwizdata[e].n_qs_done&&qwizdata[e].n_qs_done.add(qwizdata[e].dataset_id[t]),"label_prompt"==o)l+="<div>"+T("You identified all of the items on the first try!")+"</div>";else if("find_hotspots"==o){const t=qwizdata[e].n_label_attempts;t==a.length?l+="<div>"+T("You identified all of the items on the first try!")+"</div>":l=(l+="<div>"+plural(T("It took you one try"),T("It took you %s tries"),t)+" "+plural(T("to identify this item"),T("to identify these items"),qwizdata[e].n_label_targets)+".</div>").replace("%s",qqc.number_to_word(t))}}else{const t=qwizdata[e].n_label_attempts;l=(l+="<div>"+plural(T("It took you one try"),T("It took you %s tries"),t)+" "+plural(T("to identify this item"),T("to identify these items"),qwizdata[e].n_label_targets)+".</div>").replace("%s",qqc.number_to_word(t)),qwizdata[e].n_incorrect++}update_topic_statistics(e,t,h)}update_progress_show_next(e)}}else if(("label_prompt"==o||i>0)&&(a[m]=-s,qwizdata[e].answered_correctly[t]=-1),n&&-1!=n.indexOf("keep")&&_.find("img.hotspot_only_image").removeClass("hotspot_clicked").hide(),"temporary"==r&&_.find("div.qwiz_hotspot_label").removeClass("hotspot_clicked").hide(),"label_prompt"==o){l="❌";const e=_.find(`div.qwiz_hotspot_label.qwiz_hotspot${i} div.qwiz_hotspot_label_editable`).html();var p;e&&!qqc.is_only_tags_and_whitespace(e)&&(l+='You clicked on: <span style="color: red;">'+e+"</span><br />"),(p=d.find("span.hotspot_label_feedback_incorrect_content")).length?(l+=p.html(),qqc.is_only_tags_and_whitespace(l)?l+=q.canned_feedback(!1):l=l.replace(/ /g," ")):l+=q.canned_feedback(!1),l+="<div><b>"+T("Please try again.  Click on")+":</b></div>"}z.find("div.hotspot_click_feedback").html(l);const g=T("label_prompt"==(!o||o)?"Correctly clicked":"Found");if(q.display_diagram_progress(e,g),!q.preview&&qwizdata[e].qrecord_id&&document_qwiz_user_logged_in_b){qwizdata[e].record_start_b&&record_response(e,qwizdata[e].qrecord_id,{type:"start"});if(setTimeout((function(){const s=qwizdata[e].hotspot_labels[t],_=s[m];let o="";if(i!=c){const e=hotspot_indexof(a,i);-1!=e&&(o=s[e]),o+="\t"}let n={q_and_a_text:btoa(encodeURIComponent(qwizdata[e].q_and_a_text[t])),q_and_a_crc32:qwizdata[e].q_and_a_crc32[t],i_question:qwizdata[e].dataset_id[t],unit:qwizdata[e].unit[t],level:qwizdata[e].level[t],type:"hotspot_diagram",response:o+_,correct_b:"",confirm:"js"};record_response(e,qwizdata[e].qrecord_id,n)}),100),w){setTimeout((function(){let i={q_and_a_text:btoa(encodeURIComponent(qwizdata[e].q_and_a_text[t])),q_and_a_crc32:qwizdata[e].q_and_a_crc32[t],i_question:qwizdata[e].dataset_id[t],unit:qwizdata[e].unit[t],level:qwizdata[e].level[t],type:"hotspot_diagram",response:"done",correct_b:h?1:"",confirm:"js"};record_response(e,qwizdata[e].qrecord_id,i,!0)}),600)}}};var delay_hide_hotspot_no=-1;function show_hotspot_on_hover(){debug[0]&&console.log("[show_hotspot_on_hover] event:",event);const e=$(event.target).parents("div.qwizq"),t=e[0].id.match(/qwiz(\d+)/)[1],i=qwizdata[t].i_question,a=qwizdata[t].current_xy_hotspot_no;var s=event.target.className;if(-1==s.indexOf("qwiz_hotspot_label")){const e=$(event.target).parents("div.qwiz_hotspot_label");s=e.length?e[0].className:""}if(s){const _=s.match(/qwiz_hotspot(\d+)/);if(_){const s=_[1];if(s==a||s==delay_hide_hotspot_no){clearTimeout(hotspot_label_hide_id),delay_hide_hotspot_no=-1,qwizdata[t].on_hotspot_label=!0;const a=qwizdata[t].hotspot_labels_stick[i];if(a&&-1==a.indexOf("keep")&&-1==a.indexOf("temporary")){const t=e.find("div.qwiz_hotspot_label.qwiz_hotspot"+s);t.off("mouseleave"),t.on("mouseleave",(function(){t.hide(),t.off("mouseleave")}))}}return}}qwizdata[t].on_hotspot_label=!1;const _=is_xy_hotspot(t,i,event.offsetX,event.offsetY);if(_!=a){if(_){1==qwizdata[t].user_question_number&&$("div#icon_qwiz"+t).hide();const e=qwizdata[t].hotspot_user_interaction[i];if(e&&"find_hotspots"==e){const e=qwizdata[t].hotspot_nos[i],a=hotspot_indexof(e,_);if(Math.abs(e[a])>1e3)return}}const s=qwizdata[t].$hotspot_image_stack[i],n=qwizdata[t].hotspot_user_interaction[i],r=function(){const a=qwizdata[t].show_hotspots[i];if(a&&"always"!=a&&-1==a.indexOf("hide")){var o=qwizdata[t].find_the_dot[i]?.hotspot_only_new_f;const e="qwiz_layer"+_;if(!o){var r=s.find("img."+e);o=0==r.length}if(o){const a=qwizdata[t].ctx[i],o=q.create_hotspot_image(t,i,_,s,a);s.append('<img class="'+e+' hotspot_image_layer hotspot_only_image" />'),(r=s.find("img."+e))[0].src=o}r.show()}if(n&&"info_only"==n){const a=qwizdata[t].hotspot_labels_stick[i];if(a&&-1!=a.indexOf("hover_show")){debug[0]&&console.log("[show_hotspot_on_hover2] (label) new_xy_hotspot_no:",_),-1!=a.indexOf("keep")&&e.find("div.qwiz_hotspot_label").css({opacity:.5});e.find("div.qwiz_hotspot_label.qwiz_hotspot"+_).css({display:"inline-block",opacity:1})}const s=qwizdata[t].hotspot_nos[i],o=hotspot_indexof(s,_);s[o]<1e3&&(qwizdata[t].n_labels_correct++,qwizdata[t].n_hotspots_to_do[i]--,q.display_diagram_progress(t,T("Visited")),s[o]+=1e3)}};qwizdata[t].current_xy_hotspot_no=_;var o="";if(a>0){debug[0]&&console.log("[show_hotspot_on_hover (hide previous)] prev_xy_hotspot_no:",a,", new_xy_hotspot_no:",_);const r=qwizdata[t].hotspot_labels_stick[i],d=s.find("img.qwiz_layer"+a).not("img.hotspot_keep");if(o="hide",0==_){const e=qwizdata[t].show_hotspots[i];n&&"info_only"==n&&e&&-1!=e.indexOf("keep")&&(o=""),o&&r&&-1!=r.indexOf("hover_show")&&n&&"info_only"==n&&(o="delay")}if(o&&(d.hide(),n&&"info_only"==n)){const s=qwizdata[t].hotspot_labels_stick[i];if(s&&-1!=s.indexOf("hover_show")&&-1==s.indexOf("keep")&&-1==s.indexOf("temporary")){const t=e.find("div.qwiz_hotspot_label.qwiz_hotspot"+a);if("delay"==o){const e=function(){t.hide()};clearTimeout(hotspot_label_hide_id),hotspot_label_hide_id=setTimeout(e,700),delay_hide_hotspot_no=a}else t.hide()}else e.find("div.qwiz_hotspot_label").css({opacity:1})}}if(_){const e=qwizdata[t].show_hotspots[i];e&&-1!=e.indexOf("long_hover_show")?(clearTimeout(hotspot_long_hover_id),hotspot_long_hover_id=setTimeout(r,700)):r()}}}function hide_hotspots(e){debug[0]&&console.log("[hide_hotspots] e:",e);const t=$(event.target).parents("div.qwizq")[0].id.match(/qwiz(\d+)/)[1],i=qwizdata[t].i_question;qwizdata[t].current_xy_hotspot_no=-1,clearTimeout(hotspot_long_hover_id);const a=qwizdata[t].show_hotspots[i],s=qwizdata[t].hotspot_user_interaction[i];var _=!1;if(s&&"info_only"==s){const e=qwizdata[t].hotspot_labels_stick[i];if((_=e&&-1!=e.indexOf("hover_show")&&-1==e.indexOf("keep"))&&qwizdata[t].on_hotspot_label)return}a&&-1==a.indexOf("hide")&&(-1!=a.indexOf("temporary")||-1!=a.indexOf("keep")?($(e.currentTarget).find("img.hotspot_only_image").not("img.hotspot_keep").hide(),_&&$(e.currentTarget).find("div.qwiz_hotspot_label").not("div.hotspot_temporary").not("div.hotspot_keep").hide()):($(e.currentTarget).find("img.hotspot_only_image").hide(),_&&$(e.currentTarget).find("div.qwiz_hotspot_label").hide()))}function add_sub_color_variant(e,t,i,a=4){var s=e;const _=t*i*a;return e+_<=255?s+=_:s-=_,s}function rgb_same(e,t){return Math.abs(e-t)<=3}function hotspot_indexof(e,t){var i=-1;const a=e.length;for(var s=0;s<a;s++)if(Math.abs(e[s]%1e3)==t){i=s;break}return i}function is_xy_hotspot(e,t,i,a){const s=qwizdata[e].hotspot_image_width[t],_=qwizdata[e].hotspot_image_height[t],o=qwizdata[e].spotmap[t],n=qwizdata[e].spotmap_width[t],r=qwizdata[e].spotmap_height[t],d=qwizdata[e].sparsemap[t],q=Math.floor(i/s*n),c=Math.floor(a/_*r);var l;return d?(l=0,o[q]&&o[q][c]&&(l=o[q][c])):l=o[c*n+q],debug[0]&&console.log("[is_xy_hotspot] ix:",i,", iy:",a,", hotspot_no:",l),l}function pick_random_hotspot(e,t){const i=qwizdata[e].hotspot_nos[t],a=qwizdata[e].n_hotspots[t];var s=Math.floor(Math.random()*a),_=0;const o=Math.random()<.5?-1:1;for(var n=0;n<a;n+=o){const e=Math.abs(i[s]);if(e<1e3){_=e;break}(s+=o)>=a?s=0:s<0&&(s=a-1)}return 0==_&&alert("Sorry, error: no hotspot"),debug[0]&&(console.log("[pick_random_hotspot] hotspot_nos:",i),console.log("[pick_random_hotspot] hotspot_no:",_)),_}function set_hotspot_label_query(e,t,i,a){var s="";if(!a){const i=qwizdata[e].current_query_hotspot_no[t];s=qwizdata[e].$hotspot_image_stack[t].find("div.qwiz_hotspot_label.qwiz_hotspot"+i).html()}i.find("div.hotspot_label_query").html(s)}function process_qwizzled(e,t,i,a,s){debug[0]&&console.log("[process_qwizzled] question_htm: ",i);var _="",o=s.match(/\[(<code><\/code>)*q([^\]]*)\]/m);if(o){var n=o[2];
1n&&(_=(_=get_attr(n=qqc.replace_smart_quotes(n),"labels")).toLowerCase(),debug[0]&&console.log("[process_qwizzled] labels_position:",_))}var r='<div id="qwiz'+e+"-q"+t+'" ';q.qwizard_b?i=qqc.shortcodes_to_video_elements(i):r+='onmouseover="'+qname+'.init_drag_and_drop (this)" ',r+='class="qwizq qwizzled"><table class="qwizzled_table"><tr class="qwizzled_table">'+i,debug[0]&&console.log("[process_qwizzled] new_htm: ",r);var d=r.indexOf('<div class="qwizzled_canvas');if(-1==d)return errmsgs.push(T('Did not find target "drop-zones" for labels. Please check that all labels and target "drop zones" were correctly processed and saved during the edit of this page')+". qwiz: "+(e+1)+", "+T("question")+" "+(t+1)),"";var c=qqc.find_matching_block(r.substr(d));if(!c)return errmsgs.push('Did not find end of image area. Please check that all labels and target "drop zones" were correctly processed and saved during the edit of this page.'),"";set_qwizard_data_b&&(qw.questions_cards[t].type="labeled_diagram",qw.questions_cards[t].question_text=c,qw.questions_cards[t].labels=[],qw.questions_cards[t].feedback_corrects=[],qw.questions_cards[t].feedback_incorrects=[]);var l=r.substr(d+c.length);r=r.substr(0,d+c.length);var w="qwizzled_canvas-qwiz"+e+"-q"+t,h='<td class="qwizzled_table"><div id="'+w+'"'+c.substring(4)+"</td>";if(h=h.replace('class="','class="'+w+" "),qwizdata[e].qrecord_id)if(qqc.isInteger(qwizdata[e].dataset_id[t])){var u=qqc.remove_tags_eols(i);qwizdata[e].q_and_a_text[t]=qqc.q_and_a_hash(u),qwizdata[e].q_and_a_crc32[t]=qwiz_crc32(i),debug[0]&&(console.log("[process_qwizzled] qwizdata[i_qwiz].q_and_a_text[i_question]:",qwizdata[e].q_and_a_text[t]),console.log("[process_qwizzled] qwizdata[i_qwiz].q_and_a_crc32[i_question]:",qwizdata[e].q_and_a_crc32[t]))}else qwizdata[e].q_and_a_text[t]=qwizdata[e].dataset_id[t],qwizdata[e].q_and_a_crc32[t]="dataset";var z="";"left"==_&&(z=' style="padding-right: 5px;"');var m="";"top"!=_&&"bottom"!=_&&(m=" qwizzled_labels_left_right");var p,g='<td class="qwizzled_table qwizzled_labels'+m+'"'+z+'><div class="qwizzled_labels_border">Q-LABELS-Q<div style="clear: both;"></div>\n</div></td>';p="top"==_?g+'</tr><tr class="qwizzled_table">'+h+"</tr>":"bottom"==_?h+'</tr><tr class="qwizzled_table">'+g+"</tr>":"left"==_?g+h+"</tr>":h+g+"</tr>",debug[0]&&console.log("[process_qwizzled] table_html.substr (0, 100):",p.substr(0,100)),p+='<tr class="qwizzled_table"><td class="qwizzled_table qwizzled_feedback" colspan="2">QWIZZLED-FEEDBACK-Q</td></tr></table>',r=(r=r.replace(c,p)).replace(/\[(<code><\/code>)*q[^\]]*\]/,""),debug[0]&&(console.log("[process_qwizzled] new_htm:",r),console.log("[process_qwizzled] remaining_htm:",l)),l=l.replace(/\[(<code><\/code>)*l\]/gm,"");for(var b=[],f=0;;){var v=l.search(/<div[^>]+class=".*?qwizzled_label/m);if(-1==v)break;var y=qqc.find_matching_block(l.substr(v));debug[0]&&console.log("[process_qwizzled] label_div:",y);var x='<li><div id="label-qwiz'+e+"-q"+t+"-a"+f+'"'+y.substr(4)+"</li>";b.push(x),set_qwizard_data_b&&qw.questions_cards[t].labels.push(y),l=l.replace(y,""),f++}debug[0]&&console.log("[process_qwizzled] label_divs:",b);var k;k="top"==_||"bottom"==_?'<ul class="qwizzled_labels qwizzled_labels_inline">':'<ul class="qwizzled_labels qwizzled_labels_std">',r=r.replace("Q-LABELS-Q",'<p class="qwizzled_label_head qwizzled_label_head_standard">Move each item to its correct <span class="qwizzled_target_border">place</span></p>\n<p class="qwizzled_label_head qwizzled_label_head_mobile">Click an item, then its correct <span class="qwizzled_target_border">place</span></p>\n<p class="qwizzled_label_head qwizzled_label_head_label_clicked">Click the correct <span class="qwizzled_target_border">place</span> for the label</p>'+k+b.join("\n")+"</ul>");for(var $=l,A=[],C=["[f*]","[fx]"],I=["[f*]","[fx]","[x]",'<div class="qwizzled_question_bottom_border_title"'],O=0;;){var j,S=qqc.parse_html_block($,C,I);if("NA"==S)break;$=$.replace(S,""),j=-1!=S.search(/\[f\*\]/)?"c":"x",S=S.replace(/\[f[\*x]\]/,""),debug[2]&&console.log("[process_qwizzled] feedback_item_html: ",S),A.push(create_feedback_div_html(e,t,parseInt(O/2,10),S,j)),set_qwizard_data_b&&("c"==j?qw.questions_cards[t].feedback_corrects.push(S):qw.questions_cards[t].feedback_incorrects.push(S)),O++}
1debug[0]&&(console.log("[process_qwizzled] feedback_divs:",A),console.log("[process_qwizzled] feedback_html:",$));var E=b.length,M=A.length;2*E!=M&&errmsgs.push(T("Number of feedback items")+" ("+M+") "+T("does not match number of labels")+" ("+E+"). qwiz: "+(1+e)+", question "+(1+t)+" labeled diagram\n("+T("There should be two feedback items -- correct and incorrect -- for each label")+")");var R='<div class="qwiz-feedback" id="qwiz'+e+"-q"+t+'-ff"></div>\n';return A.push(R),r=r.replace("QWIZZLED-FEEDBACK-Q",A.join("")),r+="</div>\n",set_qwizard_data_b&&(qw.questions_cards[t].n_labels=E),debug[2]&&console.log("[process_qwizzled] new_htm: ",r),r}function process_header(e,t,i,a){var s=["[q]","[q ",'<div class="qwizzled_question'];if(null!=a&&s.push("[i]"),"NA"!=(header_html=qqc.parse_html_block(e.substr(0,1e3),["[h]"],s,!0))&&""!=header_html){var _=e.substr(0,200);_=qqc.trim(_);var o=qqc.opening_tag_shortcode_pos("[h]",_);_=_.substr(o,5);var n=header_html.replace(/<br[^>]*>/g,"");_!=(n=qqc.trim(n).substr(0,5))&&errmsgs.push(T("Text before header")+" [h]. qwiz: "+(t+1)),e=e.replace(header_html,""),header_html=header_html.replace(/\[h\]/gi,""),header_html=(header_html=qqc.balance_closing_tag(header_html)).replace(/<(p|h[1-6])[^>]*><\/(p|h[1-6])>/g,""),header_html=qqc.decode_image_tags(header_html)}return e}function qwiz_times_histogram_class_everyone_html(e,t,i){var a;a=1!=document_qwiz_school_id?T("Your class"):T("Independent students");var s="",_="";qwizdata[e].leaderboard_class_everyone?s=" checked":_=" checked";var o="";i&&(o=' style="right: 5px; top: 12px;"');return'<div class="qwiz_times_histogram_class_everyone"'+o+'><label><input type="radio" name="qwiz_times_histogram_class_everyone" class="qwiz_radio_smaller_shift" onclick="'+qname+".qwiz_times_histogram_class_everyone (0, "+e+", "+t.summary+')"'+_+" />"+a+'</label><br /><label><input type="radio" name="qwiz_times_histogram_class_everyone" class="qwiz_radio_smaller_shift" onclick="'+qname+".qwiz_times_histogram_class_everyone (1, "+e+", "+t.summary+')"'+s+" />"+T("Everyone")+"</label></div>"}function pick_emoji(e,t){const i=$("input.qwiz_times_histogram_initials-qwiz"+t)[0];i.value=leaderboard_initials_ok(i.value+e.detail.unicode)}function leaderboard_initials_ok(e){if("fuk"==e.toLowerCase())return"";const t=Array.of(...e),i=t.length;for(var a=0,s="",_=0;_<i&&(""==t[_]||(s+=t[_],3!=++a));_++);return s}function qwiz_times_histogram_initials_html(e,t,i){t||(t=0);const a=qqc.get_qwiz_param("url","./");return'<div class="qwiz_times_histogram_initials"><input class="qwiz_times_histogram_initials qwiz_times_histogram_initials-qwiz'+e+'" oninput="'+qname+'.check_leaderboard_initials (this)" title="'+T("Identify yourself - initials, other characters, or emojis! (optional)")+'" value="'+i+'" /> <svg class="qwiz_times_histogram_initials" onclick="'+qname+".show_hide_emoji_picker ("+e+')" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 496 512"><title>'+T("Show/hide emoji picker")+'</title><path fill="currentColor" d="M248 8C111 8 0 119 0 256s111 248 248 248 248-111 248-248S385 8 248 8zm0 448c-110.3 0-200-89.7-200-200S137.7 56 248 56s200 89.7 200 200-89.7 200-200 200zm-80-216c17.7 0 32-14.3 32-32s-14.3-32-32-32-32 14.3-32 32 14.3 32 32 32zm160 0c17.7 0 32-14.3 32-32s-14.3-32-32-32-32 14.3-32 32 14.3 32 32 32zm4 72.6c-20.8 25-51.5 39.4-84 39.4s-63.2-14.3-84-39.4c-8.5-10.2-23.7-11.5-33.8-3.1-10.2 8.5-11.5 23.6-3.1 33.8 30 36 74.1 56.6 120.9 56.6s90.9-20.6 120.9-56.6c8.5-10.2 7.1-25.3-3.1-33.8-10.1-8.4-25.3-7.1-33.8 3.1z"></path></svg> <button class="qwiz_times_histogram_initials" onclick="'+qname+".update_leaderboard_initials ('', this, "+e+", "+t+')">'+T("Save")+'</button><div class="emoji-picker emoji-picker-qwiz'+e+'"><emoji-picker></emoji-picker><img class="icon_emoji_picker_exit" onclick="jQuery (\'div.emoji-picker-qwiz'+e+'\').hide ()" src="'+a+'/images/icon_exit_bw.jpg" /></div></div></div>'}function stats(e){const t=[...e].sort((function(e,t){return t-e})),i=t.length,a=t[0],s=t[i-1];for(var _,o=0,n=0;n<i;n++)o+=t[n];if(i%2){_=t[(i-1)/2]}else{const e=i/2;_=.5*(t[e-1]+t[e])}return{min:s,max:a,median:_,mean:o/i,sorted:t}}function shuffle(e){for(var t=e.length-1;t>0;){const i=Math.floor(Math.random()*(t+1)),a=e[t];e[t]=e[i],e[i]=a,t--}debug[0]&&console.log("[shuffle] a:",e)}function check_qwiz_tag_pairs(e){var t="",i=e.match(/\[qwiz|\[\/qwiz\]/gm);if(i){var a=i.length,s=!1;if(a%2!=0)s=!0;else for(var _=0;_<a;_++)if(_%2==0){if("[qwiz"!=i[_]){s=!0;break}}else if("[/qwiz]"!=i[_]){s=!0;break}if(s){debug[0]&&console.log("[check_qwiz_tag_pairs] (error_b) htm.substr (0, 1000):",e.substr(0,1e3));const i=e.search(/<[pa] class="more-link|<div class="(search|blog)-entry-readmore/);if(-1!=i){const a=e.indexOf("[qwiz");t=-1!=a?e.substring(0,a)+e.substr(i):e}else if(-1!=e.indexOf('class="entry-summary')){const i=e.indexOf("[qwiz"),a=e.search(/\s*\[\u2026\]/);t=-1!=i&&-1!=a?e.substring(0,i)+e.substr(a):e}else errmsgs.push(T("Unmatched [qwiz] - [/qwiz] pairs.")),t="NA";debug[0]&&console.log("[check_qwiz_tag_pairs] (error_b) new_htm:",t)}}return t}function create_radio_button_html(e,t,i,a){var s="",_="",o=0;"[c*]"==a&&(_='data-q="1" ',o=1);var n="";return q.qwizard_b&&(n=' title="'+T("Click to see feedback for this answer choice")+'"'),s+='<input type="radio" id="radio-qwiz'+e+"-q"+t+"-a"+i+'" name="qwiz'+e+"-q"+t+'" '+_+' class="qwiz_choice_radio"'+n+" />\n",debug[1]&&console.log("[create_radio_button_html] htm: ",s),{correct:o,htm:s}}function process_choice_disable(e,t){"mobile"==e.substr(0,6)&&(e=e.substr(7),t=t.substr(7));var i=document.getElementById("radio-"+e);
1i&&(i.checked=!0,q.qwizard_b||q.preview||$("input[name="+t+"]").attr("disabled",!0),$(`#${t} .choices-${t}, #${t} .choices-${t} .qwiz-choice`).css({cursor:"auto",color:"black"}))}function show_generated_custom_feedback(e){debug[0]&&console.log("[show_generated_custom_feedback] data:",e);const t=e.i_qwiz,i=e.i_question;var a=e.custom_feedback;e.hint_f;$(`div.qwiz${t}-q${i}-spinner`).hide(),$(`#show_answer_got_it_or_not-qwiz${t}-q${i}`).css({opacity:1}),$(`#mobile_show_answer_got_it_or_not-qwiz${t}-q${i}`).css({opacity:1});const s=$(`div.qwiz${t}-q${i}-a0_gen`);var _=a.match(/\*\*[^\*]{4,}\*\*/m);if(_)a=marked.parse(a);else if(_=a.match(/<body[^>]*>/m)){const e=_.index+_[0].length,t=a.indexOf("</body>");a=t>0?a.substring(e,t):a.substr(e)}else{var o=a.indexOf("```html");if(-1!=o){const e=(a=qqc.trim(a)).length;a=a.substring(o+7,e-3),debug[0]&&console.log("[show_generated_custom_feedback] (removing ```html) custom_feedback:",a)}else-1!=(o=a.indexOf("html:"))&&(a=a.substr(o+5)),(_=a.match(/<p|<h|<li/))||(a=`<pre style="white-space: pre-wrap">${a}</pre>`)}s.css({"font-size":"10pt"}).html(a).show(),e.error_f&&$(`div#qwiz${t}-q${i} button.show_the_answer`).removeClass("qwiz_button_disabled").removeAttr("disabled")}function create_got_it_or_not(e,t,i,a){a||(a="");var s=[];if(s.push('<div id="'+e+"show_answer_got_it_or_not-qwiz"+t+"-q"+i+'" class="show_answer_got_it_or_not">\n'),a){const e=`${qname}.view_answer_guide (this, ${t}, ${i})`;s.push(`<button class="qwiz_button view_answer_guide" style="color: black; background: white; border: 1px solid gray;" onclick="${e}">`),s.push(T("View answer guide")),s.push("</button>")}return s.push(`<button class="qwiz_button" onclick="${qname}.process_choice (event, '${e}qwiz${t}-q${i}-a0', false, 1, '${a}')">`),s.push(T("Show me again later")),s.push("</button>"),s.push(" "),s.push(`<button class="qwiz_button ok_ive_got_it" onclick="${qname}.process_choice (event, '${e}qwiz${t}-q${i}-a0', true, 1, '${a}')">`),s.push(T("OK, I've got it!")),s.push("</button>"),s.push("</div>"),s.join("\n")}function update_topic_statistics(e,t,i){var a=qwizdata[e].question_topics[t];if(a)for(var s=0;s<a.length;s++){var _=a[s];i?qwizdata[e].topic_statistics[_].n_correct++:qwizdata[e].topic_statistics[_].n_incorrect++}}function update_progress_show_next(e){if(qwizdata[e].question_time_limit&&stop_timer(e,!0,!0),qwizdata[e].n_questions>1||qwizdata[e].use_dataset||qwizdata[e].combo){q.display_progress(e);var t=qwizdata[e].n_correct;if(qwizdata[e].repeat_incorrect_b||(t+=qwizdata[e].n_incorrect),t==qwizdata[e].n_questions_for_done&&!qwizdata[e].combo&&(qwizdata[e].summary_b?$("#next_button_text-qwiz"+e).html(T("View summary report")):$("#summary-qwiz"+e).show(),qwizdata[e].qwiz_timer&&qwizdata[e].n_qs&&(stop_timer(e),qwizdata[e].n_qs_done.size==qwizdata[e].n_qs&&(qwizdata[e].n_qs_done=new Set)),qwizdata[e].$question_timer&&qwizdata[e].$question_timer.hide(),qwizdata[e].qrecord_id&&document_qwiz_user_logged_in_b&&(qwizdata[e].use_dataset||qwizdata[e].repeat_incorrect_b||0==qwizdata[e].n_incorrect))){setTimeout((function(){record_response(e,qwizdata[e].qrecord_id,{type:"completed",confirm:"js"},!0)}),2e3)}(t<qwizdata[e].n_questions_for_done||qwizdata[e].summary_b)&&q.position_show_next_button(e),qwizdata[e].next_button_show_b=!0}if(1==qwizdata[e].n_questions&&($("#qwiz"+e+" div.single-question_exit").show(),qwizdata[e].question_timer_interval_id)){$("div#overlay-times-up-qwiz"+e).is(":visible")||stop_timer(e)}}function create_feedback_div_html(e,t,i,a,s,_){var o="";null!=s&&(o=s);var n=`<div id="qwiz${e}-q${t}-a${i}${o}" class="qwiz-feedback">\n`;o||(n+='<hr style="margin: 0px;" />\n');if(o)n+='<div class="'+("c"==o?"qwizzled-correct_feedback":"qwizzled-incorrect_feedback")+' qwiz_editable" data-i_choice="'+i+'">'+a+"</div>";else{q.qwizard_b&&(a=qqc.shortcodes_to_video_elements(a));n+=`<div class="qwiz-feedback-div qwiz_editable" data-i_choice="${i}"${""}>\n ${a=create_restart_button(e,a,!0)}\n </div>`}return n+='<div style="clear: both;"></div>\n',n+="</div>\n",_&&(n+=`<div class="qwiz${e}-q${t}-a${i}_gen qwiz-feedback"></div>\n`),debug[2]&&console.log("[create_feedback_div_html] htm: ",n),n}this.hotspot_color_from_no=function(e,t=!1){var i;const a=e-1;if(i=[[202,198,191],[143,131,102],[239,210,130],[106,80,0],[251,209,30],[0,210,255],[0,123,201],[0,86,234],[123,132,147],[218,227,243]][a%10],a>9){const e=[[0,0,1],[0,1,0],[0,1,1],[1,0,0],[1,1,0],[1,1,1]][t?Math.floor(a/10)%5:a%5],s=Math.floor(a/60)+1,_=t?5:4;i[0]=add_sub_color_variant(i[0],e[0],s,_),i[1]=add_sub_color_variant(i[1],e[1],s,_),i[2]=add_sub_color_variant(i[2],e[2],s,_)}return i.push(q.hotspot_alpha_value),i},this.init_drag_and_drop=function(e){debug[0]&&console.log("[init_drag_and_drop] qwizq_elm:",e);var t=$(e);t.removeAttr("onmouseover"),t.find("td.qwizzled_labels div.qwizzled_label").each((function(){(debug[0]||debug[8])&&(console.log("[init_drag_and_drop] $ (this):",$(this)),console.log("[init_drag_and_drop] 'td.qwizzled_labels div.qwizzled_label':",$(this)[0]));
1var e=$(this).offset();debug[8]&&console.log("[init_drag_and_drop] label_offset:",e),$(this).data("label_x",e.left).data("label_y",e.top),$(this).draggable({containment:$(this).parents("table.qwizzled_table"),start:function(e,t){var i=$(this).parents("div.qwiz");if(i.length){var a=i[0];a.qscale_fac&&(a.qstart_left=t.position.left,t.position.top?a.qstart_top=t.position.top:a.qstart_top=.1)}q.label_dragstart($(this))},drag:function(e,t){var i=$(this).parents("div.qwiz");if(i.length){var a=i[0];if(a.qscale_fac&&a.qstart_top){var s=a.qscale_fac;t.position.left=(t.position.left-a.qstart_left)/s+a.qstart_left,t.position.top=(t.position.top-a.qstart_top)/s+a.qstart_top}}}}).addClass("qwizzled_label_unplaced")})),t.find(".qwizzled_target").droppable({accept:".qwizzled_label",hoverClass:"qwizzled_target_hover",drop:function(e,t){q.label_dropped($(this),t.draggable)},tolerance:"pointer"})},this.display_summary_and_exit=function(e){if(q.qwizard_b||$(".bck-question-qwiz"+e).css({opacity:.5}).addClass("hover"),qwizdata[e].summary_b){var t,i=[],a=qwizdata[e].n_questions_for_done,s=qwizdata[e].n_correct,_=qwizdata[e].n_incorrect;if(qwizdata[e].repeat_incorrect_b){var o=qwizdata[e].use_dataset&&qwizdata[e].dataset_intro_f?"set":"quiz";i.push("<p><b>"+T("Congratulations, you're done!")+"</b></p>"),t=(t=T(0==_?"quiz"==o?"In this %s-question quiz you answered every question correctly on the first try!":"In this %s-question set you answered every question correctly on the first try!":"quiz"==o?1==_?"In finishing this %s-question quiz you entered one incorrect answer":"In finishing this %s-question quiz you entered %s incorrect answers":1==_?"In finishing this %s-question set you entered one incorrect answer":"In finishing this %s-question set you entered %s incorrect answers")).replace("%s",qqc.number_to_word(a)),_>1&&(t=t.replace("%s",qqc.number_to_word(_)))}else t=0==_?T("Congratulations, you answered all questions correctly"):(t=(t=T("Your score is %s out of %s questions")).replace("%",qqc.number_to_word(s))).replace("%",qqc.number_to_word(a));i.push("<p>"+t+"</p>");var n=0;if(qwizdata[e].topics&&(n=qwizdata[e].topics.length),1==n){const t=qwizdata[e].topics[0];if("Other"!=t){const e=t.replace(/^(\d\.\d+-*(\d\.*\d*)*[\., _]*)*/,"").replace(/_/g," ");var r;1==a?i.push("<p>The question was about topic “"+e+".”</p>"):(r=2==a?T("Both"):T("All")+" "+qqc.number_to_word(a),i.push("<p>"+r+" "+plural(T("question"),T("questions"),a)+" were about topic “"+e+".”</p>"))}}else if(n>1&&_>0){for(var d=[],c=0;c<n;c++){var l=qwizdata[e].topics[c];const t=l.replace(/^(\d\.\d+-*(\d\.*\d*)*[\., _]*)*/,"").replace(/_/g," ");qwizdata[e].topic_statistics[l].n_correct;var w=qwizdata[e].topic_statistics[l].n_incorrect;if(w>0){const e="<strong>"+t+"</strong>: "+qqc.number_to_word(w)+" "+T("incorrect");d.push(e)}}var h=d.length,u=[];if(h>1){u.push(T("These are the topics of questions that you answered incorrectly")),u.push("<ul>");for(var z=0;z<h;z++)u.push("<li>"),u.push(d[z]),u.push("</li>");u.push("</ul>")}else 1==_?u.push(T("The topic of the only question you answered incorrectly is")+"<br />"):u.push(T("The topic of the questions you answered incorrectly is")+"<br />"),u.push(d[0]);i.push(u.join("\n"))}if($("#summary_report-qwiz"+e).html(i.join("\n")),qwizdata[e].qwiz_timer&&!q.qwizard_b&&!q.preview){var m=!0;qwizdata[e].n_qs&&qwizdata[e].n_qs_done.size&&(m=!1,$("#summary_report-qwiz"+e).append("<br />("+T("The leaderboard will be available when you’ve finished all questions in this quiz")+")"));const t=$("div#summary-quiz_times_histogram-qwiz"+e).html("");if(m){const i=`<div style="text-align: center;">\n <img src="${qqc.get_qwiz_param("url","./")}images/spinner40x40.gif" />'\n </div>`;t.html(i);var p={full_quiz_f:1,summary:1};const a=qwizdata[e].qrecord_id;-1!=a.indexOf("finish_times_demo")&&(p.demo_taker_time=qwizdata[e].elapsed_time);var g=0;const s=function(){qwizdata[e].when_done_unix||g>5?qqc.qjax(qname,e,a,"get_quiz_times",p):(g++,setTimeout(s,250))};s()}else t.html("")}}var b=$("#summary-qwiz"+e);if(q.qwizard_b&&0==b.find("div[contenteditable]").length){const t=$(`div#qwiz_exit-qwiz${e} .qwiz_editable`)[0];qwizard.init_tinymce(t)}var f=b.find('input[name="qwiz_img"]');f.length&&f.changeElements("img"),qwizdata[e].cv_index&&b.find("button.qwiz_restart").remove(),b.show(),qwizdata[e].i_question=qwizdata[e].n_questions},this.draw_histogram=function(e){debug[0]&&console.log("[draw_histogram] data:",e);const t=e.i_qwiz,i=1==e.summary?"summary":"leaderboard",a=$("div#"+i+"-quiz_times_histogram-qwiz"+e.i_qwiz);if(qwizdata[t].qwiz_histogram_data=e,e.everyone){qwizdata[t].leaderboard_class_everyone=e.everyone;var s=T("Few or no results available for")+" ";1!=document_qwiz_school_id?s+=T("your class")+".":s+=T("independent students")+".",s+="\n"+T("Showing results for everyone")+".",alert(s)}if(e.errmsg)return alert("Sorry, unable to retrieve data for your classes"),!1;if(0==e.i_takers.length)return void a.html("(No data available for fastest-times graph)");if(1==e.i_takers.length){var _;if("summary"==i)_=1!=document_qwiz_school_id?T("You’re the first person in your class to take this quiz!"):T("You’re the first independent student to take this quiz!"),_+=" "+T("You can enter your initials")+":<br />"+qwiz_times_histogram_initials_html(t,qwizdata[t].quiz_elapsed_time_id,"")+"<br />"+T("Come back later (green down-triangle > “Fastest finish times”) to see more")+".",a.html(_),a.find("emoji-picker").on("emoji-click",(function(){pick_emoji(event,t)}));else _=1!=document_qwiz_school_id?T("Only one person in your class has taken this quiz."):T("Only one independent student has taken this quiz."),_+="<br />"+T("Come back later (green down-triangle > “Fastest finish times”) to see more")+"."+qwiz_times_histogram_class_everyone_html(t,e,!0),a.html(_);return}(_=[]).push('<div class="qwiz_times_histogram_title">'),_.push("</div>"),_.push('<div class="qwiz_times_histogram">');const o=document_qwiz_maker_privileges?' style="max-height: 200px; overflow: auto;"':"";_.push('<div class="qwiz_times_histogram_legend"'+o+">"),_.push('<div class="qwiz_times_histogram_legend_header">'),_.push("</div>"),_.push('<div class="qwiz_times_histogram_legend_content">'),_.push("</div>"),_.push("</div>"),_.push('<div class="qwiz_times_histogram_h_label">'),_.push("<b>"+T("Finish time (min:sec)")+" (<i>"+T("faster")+"</i></b> ➔<b>)</b>"),_.push("</div>"),_.push('<div class="qwiz_times_histogram_v_label qwiz_times_histogram_v_axis">'),_.push("<b>"+T("Number done")+"</b>"),_.push("</div>"),_.push("</div>"),a.html(_.join("\n"));const n=e.times,r=stats(n);debug[0]&&console.log("[draw_histogram] r:",r);const d=10*parseInt(3*r.median/10)+10;if(r.sorted[0]>d){for(var c=1;r.sorted[c]>d;)c++;r.max=r.sorted[c],debug[0]&&console.log("[draw_histogram] r.max:",r.max)}const w=n.length;var h=15;w<25?h=10:w>40&&(h=20);const u=r.max-r.min+.01,z=u/h,m=(z/u*100).toFixed(2),p=z/u*50;var g=new Array(h).fill(0),b=[],f=0;for(c=0;c<w;c++){if(n[c]<=r.max){g[Math.floor((n[c]-r.min)/z)]++,f++}b.push([n[c],c])}b.sort((function(e,t){return e[0]-t[0]}));var v,y=[],x=-1;for(c=0;c<w;c++){const e=b[c][0];e>x&&(x=e,v=c),y[b[c][1]]=v}debug[0]&&(console.log("[draw_histogram] bin_width:",z),console.log("[draw_histogram] bin_counts:",g),console.log("[draw_histogram] times_for_rank:",b),console.log("[draw_histogram] ranks:",y));for(var k=0,A=0;A<h;A++)k=Math.max(k,g[A]);const C=a.find("div.qwiz_times_histogram"),I=(e.quiz_header?e.quiz_header:T("times this quiz"),qqc.hhmmss_from_sec(d)),O=f==w?""
1:" "+T("within")+" "+I+" "+T("cutoff");var j;if(document_qwiz_user_logged_in_b){j=1!=document_qwiz_school_id?document_qwiz_maker_privileges?T("Quizzes done by your classes"):T("Quizzes done by your class"):T("Quizzes done most recently by independent students"),qwizdata[t].leaderboard_class_everyone&&(j=T("Quizzes done most recently"));const s=qwiz_times_histogram_class_everyone_html(t,e);"summary"==i?$("div#summary-qwiz"+t).append(s):a.append(s)}else j=T("Quizzes done most recently");const S=j+O+": "+f;$("div.qwiz_times_histogram_title").html(S),qwizdata[t].$qwiz_times_histogram=C;for(A=0;A<h;A++){if(g[A]){const e='<div class="qwiz_times_histogram_bar qwiz_times_histogram_bar'+A+'" style="right: '+((A+.5)/h*100-p).toFixed(2)+"%; width: calc("+m+"% + 1px); height: "+(g[A]/k*100).toFixed(2)+'%;"><div class="qwiz_times_histogram_bar_label">'+g[A]+"</div>";C.append(e);const t='<div class="qwiz_times_histogram_bin_label" style="right: '+((A+.5)/h*100).toFixed(2)+'%;">'+g[A]+"</div>";C.append(t)}const e='<div class="qwiz_times_histogram_bin_marker" style="right: '+(A/h*100).toFixed(2)+'%;"></div>';C.append(e)}const E=e.dates;var M=e.i_takers;const R=e.initialss,Y=e.quiz_elapsed_time_ids,N=stats(E);var B=-1;const F=qwizdata[t].when_done_unix;if("summary"==i)for(c=0;c<w;c++)M[c]==e.i_taker&&(E[c]==F?B=c:E[c]<0&&(B=c,E[c]=-E[c]));debug[0]&&console.log("[draw_histogram] i_takers:",JSON.parse(JSON.stringify(M)));if(-1==qwizdata[t].qrecord_id.indexOf("finish_times_demo")){var L=-1;for(c=0;c<w;c++)L=Math.max(L,M[c]);var W=[...Array(L+1).keys()];shuffle(W);for(c=0;c<w;c++){const e=M[c];M[c]=W[e]}e.i_taker=W[e.i_taker],e.i_takers=M,debug[0]&&console.log("[draw_histogram] i_takers:",JSON.parse(JSON.stringify(M)))}const G=(N.max-N.min+.01)/9;for(c=0;c<w;c++)if(n[c]<=r.max){const i=Math.floor((N.max-E[c])/G);var D,Q="qwiz_times_histogram_taker"+M[c];R[c]?(D=T("Student")+": "+R[c],e.i_taker==M[c]&&(D+=" ("+T("you")+")")):(D=T("Student")+": #"+(M[c]+1),e.i_taker==M[c]&&(Q+=" qwiz_times_histogram_taker_color",D=T("Student")+": "+T("you")));const a=((n[c]-r.min)/u*100).toFixed(2),s=qqc.hhmmss_from_sec(n[c]),_=DateFormat.format.date(1e3*E[c],"MMM dd h:ss a");var P=T("Finish time:")+" "+s+"\n"+T("Rank:")+" "+(y[c]+1)+"\n"+T("Done:")+" "+_+"\n"+D+"\n\n"+T("Click to highlight student");const o='<div class="qwiz_times_histogram_marker_target qwiz_times_histogram_marker_target'+y[c]+'" onclick="'+qname+".qwiz_times_histogram_show_student (this, "+t+", "+M[c]+", "+e.i_taker+')" style="right: '+a+'%;" title="'+P+'"><div class="qwiz_times_histogram_marker qwiz_times_histogram_marker'+i+" qwiz_times_histogram_marker_gray "+Q+'"></div></div>';C.append(o)}var U=[];const Z=qwizdata[t].leaderboard_graph_options,H="Graph options"==Z?" selected":"";U.push('<select class="qwiz-bold" onchange="'+qname+".qwiz_times_histogram_leaderboard_graph_change (this.value, "+t+", "+e.summary+')">'),U.push("<option>"),U.push("Leaderboard"),U.push("</option>"),U.push("<option"+H+">"),U.push("Graph options"),U.push("</option>"),U.push("</select>"),C.find("div.qwiz_times_histogram_legend_header").html(U.join("\n")),Z&&"Graph options"==Z?q.qwiz_times_histogram_graph_legend(C,t,e.i_taker):q.qwiz_times_histogram_leaderboard_legend(i,C,t,n,b,y,M,R,Y,B,e.i_taker);const V=u/10;var J;J=V<=5?5:V<=10?10:V<=20?20:V<=30?30:60*Math.floor(V/60+1),debug[0]&&console.log("[draw_histogram] interval_sec:",J);for(var X=J-r.min%J,K=r.min-r.min%J;X<=u;){const e=(X/u*100).toFixed(2),t='<div class="qwiz_times_histogram_h_tick" style="right: '+e+'%;"></div>';C.append(t),K+=J;const i='<div class="qwiz_times_histogram_h_tick_label" style="right: '+e+'%;">'+qqc.hhmmss_from_sec(K)+"</div>";C.append(i),X+=J}const ee=k/8;var te;te=ee<1.5?1:ee<3?2:ee<7.5?5:ee<15?10:20*Math.round(ee/20),debug[0]&&console.log("[draw_histogram] interval:",te);for(var ie=te;ie<=k;){const e=(ie/k*100).toFixed(2),t='<div class="qwiz_times_histogram_v_tick qwiz_times_histogram_v_axis" style="bottom: '+e+'%;"></div>';C.append(t);const i='<div class="qwiz_times_histogram_v_tick_label qwiz_times_histogram_v_axis" style="bottom: '+e+'%;">'+ie+"</div>";C.append(i),ie+=te}const ae=DateFormat.format.date(1e3*N.max,"MMM dd h:ss a"),se=DateFormat.format.date(1e3*N.min,"MMM dd h:ss a");l=[],l.push('<div class="qwiz_times_histogram_date_legend">'),l.push('<div class="qwiz_times_histogram_date_legend_top">'),l.push(ae),l.push("</div>");for(var _e=0;_e<9;_e++)l.push('<div class="qwiz_times_histogram_date_legend_rect qwiz_times_histogram_marker'+_e+'">'),l.push("</div>");if(l.push('<div class="qwiz_times_histogram_date_legend_bot">'),l.push(se),l.push("</div>"),l.push("</div>"),C.append(l.join("\n")),qwizdata[t].qwiz_times_histogram_color_by_date){C.find("div.qwiz_times_histogram_marker").removeClass("qwiz_times_histogram_marker_gray qwiz_times_histogram_taker_color qwiz_times_histogram_taker_color0 qwiz_times_histogram_taker_color1 qwiz_times_histogram_taker_color2 qwiz_times_histogram_taker_color3 qwiz_times_histogram_taker_color4 qwiz_times_histogram_taker_color5 qwiz_times_histogram_taker_color6 qwiz_times_histogram_taker_color7 qwiz_times_histogram_taker_color8"),C.find("div.qwiz_times_histogram_date_legend").show();const e=C.find("input.qwiz_times_histogram_color_by_date");e.length&&(e[0].checked=!0)}if(qwizdata[t].qwiz_times_histogram_show_bin_counts){qwizdata[t].qwiz_times_histogram_show_bars?C.find("div.qwiz_times_histogram_bar_label").show():C.find("div.qwiz_times_histogram_bin_label").show();const e=C.find("input.qwiz_times_histogram_show_bin_counts");e.length&&(e[0].checked=!0)}if(qwizdata[t].qwiz_times_histogram_show_bars){C.find("div.qwiz_times_histogram_bar").show(),C.find("div.qwiz_times_histogram_v_axis").show();const e=C.find("input.qwiz_times_histogram_show_bars");e.length&&(e[0].checked=!0)}},this.qwiz_times_histogram_class_everyone=function(e,t,i){var a={full_quiz_f:1,summary:i,everyone:e};qwizdata[t].leaderboard_class_everyone=e,qqc.qjax(qname,t,qwizdata[t].qrecord_id,"get_quiz_times",a)},this.qwiz_times_histogram_show_student=function(e,t,i,a){const s=qwizdata[t].$qwiz_times_histogram;s.find("div.qwiz_times_histogram_marker_target").removeClass("qwiz_times_histogram_taker_color qwiz_times_histogram_taker_color0 qwiz_times_histogram_taker_color1 qwiz_times_histogram_taker_color2 qwiz_times_histogram_taker_color3 qwiz_times_histogram_taker_color4 qwiz_times_histogram_taker_color5 qwiz_times_histogram_taker_color6 qwiz_times_histogram_taker_color7 qwiz_times_histogram_taker_color8");const _=i==a?"":i%9;s.find("div.qwiz_times_histogram_taker"+i).parent().addClass("qwiz_times_histogram_taker_color"+_);const o=i==a?"You":"Student #"+(i+1);s.find("span.qwiz_times_histogram_legend_student").html(o),s.find("div.qwiz_times_histogram_legend_color").attr("class","qwiz_times_histogram_legend_color qwiz_times_histogram_taker_color"+_),qwizdata[t].i_taker_shown=i},this.qwiz_times_histogram_leaderboard_graph_change=function(e,t,i){qwizdata[t].leaderboard_graph_options=e;var a={full_quiz_f:1,summary:i};-1!=qwizdata[t].qrecord_id.indexOf("finish_times_demo")&&(a.demo_taker_time=qwizdata[t].elapsed_time),qqc.qjax(qname,t,qwizdata[t].qrecord_id,"get_quiz_times",a)},this.qwiz_times_histogram_leaderboard_legend=function(e,t,i,a,s,_,o,n,r,d,c){const l=o.length;var w="";if("summary"==e)for(var h=0;h<l;h++)if(c==o[h]&&n[h]){w=n[h];const e=qqc.addSlashes(w);
1q.update_leaderboard_initials(e,"",i,qwizdata[i].quiz_elapsed_time_id);break}var u=!1,z=[];z.push("<table>"),z.push("<tr>"),document_qwiz_maker_privileges||(z.push("<td>"),z.push("<table>"));const m=qqc.get_qwiz_param("url","./"),p=document_qwiz_maker_privileges?o.length:Math.min(10,o.length);for(h=0;h<p;h++){const t=s[h][1];var g;5!=h||document_qwiz_maker_privileges||(z.push("</table>"),z.push("</td>"),z.push('<td style="border-left: 1px solid gray;">'),z.push("<table>")),document_qwiz_maker_privileges?(z.push('<tr class="quiz_elapsed_time_id'+r[t]+'">'),z.push('<td style="padding: 1px 0 0 0;">'),z.push('<img src="'+m+'/images/delete.png" class="qwiz_icon_smaller" onclick="'+qname+".delete_leaderboard_entry ("+i+", "+r[t]+')" title="'+T("Teachers only: delete this entry")+'" />'),z.push("</td>")):z.push("<tr>"),z.push('<td class="qwiz-bold qwiz-right">'),z.push(_[t]+1),z.push("</td>"),z.push('<td onmouseenter="'+qname+".qwiz_times_histogram_highlight_leader (1, this, "+i+", "+_[t]+')" onmouseleave="'+qname+".qwiz_times_histogram_highlight_leader (0, this, "+i+", "+_[t]+')">'),n[t]?(g=n[t],c==o[t]&&(g+=" (you)")):(g=T("Student")+" #"+(o[t]+1),c==o[t]&&("summary"==e&&t==d?(g=qwiz_times_histogram_initials_html(i,qwizdata[i].quiz_elapsed_time_id,w),u=!0):g=T("You"))),z.push(g),z.push("</td>"),z.push('<td class="qwiz-right">');const q=qqc.hhmmss_from_sec(a[t]);z.push(q),z.push("</td>"),z.push("</tr>")}if(document_qwiz_maker_privileges||(z.push("</table>"),z.push("</td>")),z.push("</tr>"),z.push("</table>"),t.find("div.qwiz_times_histogram_legend_content").html(z.join("\n")),u){t.find("div.qwiz_times_histogram_legend_content emoji-picker").on("emoji-click",(function(){pick_emoji(event,i)}));const e=t.find("input.qwiz_times_histogram_initials");w?e.css({background:"white"}):e.focus()}},this.delete_leaderboard_entry=function(e,t){data={quiz_elapsed_time_id:t},qqc.jjax(qname,e,"","delete_quiz_elapsed_time",data)},this.delete_leaderboard_entry_callback=function(e){debug[0]&&console.log("[delete_leaderboard_entry_callback] data:",e),e.errmsg?alert(e.errmsg):$("div#qwiz"+e.i_qwiz+" div.qwiz_times_histogram_legend_content tr.quiz_elapsed_time_id"+e.quiz_elapsed_time_id).remove()},this.show_hide_emoji_picker=function(e){$("div.emoji-picker-qwiz"+e).toggle()},this.check_leaderboard_initials=function(e){e.value=leaderboard_initials_ok(e.value)},this.update_leaderboard_initials=function(e,t,i,a){if(!e){const a=$(t).prevAll("input.qwiz_times_histogram_initials");if(e=a.val()){const t=qwizdata[i].qwiz_histogram_data,_=t.i_takers.length;for(var s=0;s<_;s++)if(e==t.initialss[s]&&t.i_takers[s]!=t.i_taker)return alert(T("These initials have already been used by someone else")),void a.focus()}a.css({background:"white"})}if($("div.emoji-picker-qwiz"+i).hide(),a){const t='<img src="'+qqc.get_qwiz_param("url","./")+'images/spinner16x16.gif" />';$("div#summary-quiz_times_histogram-qwiz"+i).find("button.qwiz_times_histogram_initials").html(t);const s={quiz_elapsed_time_id:a,initials:e,callback:"update_quiz_elapsed_time_callback"};qqc.qjax(qname,i,qwizdata[i].qrecord_id,"update_quiz_elapsed_time",s)}},this.update_quiz_elapsed_time_callback=function(e,t){$("div#summary-quiz_times_histogram-qwiz"+e).find("button.qwiz_times_histogram_initials").html(T("Save")),t&&alert(t)},this.qwiz_times_histogram_highlight_leader=function(e,t,i,a){const s=$(t),_=qwizdata[i].$qwiz_times_histogram.find("div.qwiz_times_histogram_marker_target"+a);1==e?(s.addClass("qwiz_times_histogram_highlight"),_.addClass("qwiz_times_histogram_highlight")):(s.removeClass("qwiz_times_histogram_highlight"),_.removeClass("qwiz_times_histogram_highlight"))},this.qwiz_times_histogram_graph_legend=function(e,t,i){var a=[];const s=i>-1?" qwiz_times_histogram_taker_color":"";a.push('<div class="qwiz_times_histogram_legend_color'+s+'">'),a.push("</div>"),a.push('<span class="qwiz_times_histogram_legend_student">'),a.push("You"),a.push("</span>"),a.push("<br />"),a.push("<label>"),a.push('<input type="checkbox" class="qwiz_times_histogram_color_by_date" onchange="'+qname+".qwiz_times_histogram_legend_change (this.className, this.checked, "+t+", "+i+')" style="margin-right: 3px; margin-left: 0;" />'+T("When done")),a.push("</label>"),a.push(" "),a.push("<label>"),a.push('<input type="checkbox" class="qwiz_times_histogram_show_bin_counts" onchange="'+qname+".qwiz_times_histogram_legend_change (this.className, this.checked, "+t+", "+i+')" style="margin-right: 3px;" />#/'+T("bin")),a.push("</label>"),a.push(" "),a.push("<label>"),a.push('<input type="checkbox" class="qwiz_times_histogram_show_bars" onchange="'+qname+".qwiz_times_histogram_legend_change (this.className, this.checked, "+t+", "+i+')" style="margin-right: 3px;" />'+T("Bars")),a.push("</label>"),e.find("div.qwiz_times_histogram_legend_content").html(a.join("\n")),qwizdata[t].i_taker_shown=i},this.qwiz_times_histogram_legend_change=function(e,t,i,a){if($qwiz_times_histogram=qwizdata[i].$qwiz_times_histogram,"qwiz_times_histogram_color_by_date"==e){if(t)$qwiz_times_histogram.find("div.qwiz_times_histogram_marker").removeClass("qwiz_times_histogram_marker_gray qwiz_times_histogram_taker_color qwiz_times_histogram_taker_color0 qwiz_times_histogram_taker_color1 qwiz_times_histogram_taker_color2 qwiz_times_histogram_taker_color3 qwiz_times_histogram_taker_color4 qwiz_times_histogram_taker_color5 qwiz_times_histogram_taker_color6 qwiz_times_histogram_taker_color7 qwiz_times_histogram_taker_color8"),$qwiz_times_histogram.find("div.qwiz_times_histogram_date_legend").show();else{const e=qwizdata[i].i_taker_shown;$qwiz_times_histogram.find("div.qwiz_times_histogram_marker").addClass("qwiz_times_histogram_marker_gray"),$qwiz_times_histogram.find("div.qwiz_times_histogram_taker"+e).addClass("qwiz_times_histogram_taker");const t=e==a?"You":"Student #"+(e+1);$qwiz_times_histogram.find("span.qwiz_times_histogram_legend_student").html(t);const s=e==a?"":e%9;$qwiz_times_histogram.find("div.qwiz_times_histogram_legend_color").attr("class","qwiz_times_histogram_legend_color qwiz_times_histogram_taker_color"+s),$qwiz_times_histogram.find("div.qwiz_times_histogram_date_legend").hide()}qwizdata[i].qwiz_times_histogram_color_by_date=t}else"qwiz_times_histogram_show_bin_counts"==e?(t?qwizdata[i].qwiz_times_histogram_show_bars?$qwiz_times_histogram.find("div.qwiz_times_histogram_bar_label").show():($qwiz_times_histogram.find("div.qwiz_times_histogram_bin_label").show(),$qwiz_times_histogram.find("div.qwiz_times_histogram_bin_marker").show()):($qwiz_times_histogram.find("div.qwiz_times_histogram_bar_label").hide(),$qwiz_times_histogram.find("div.qwiz_times_histogram_bin_label").hide(),$qwiz_times_histogram.find("div.qwiz_times_histogram_bin_marker").hide()),qwizdata[i].qwiz_times_histogram_show_bin_counts=t):"qwiz_times_histogram_show_bars"==e&&(t?($qwiz_times_histogram.find("div.qwiz_times_histogram_bar").show(),$qwiz_times_histogram.find("div.qwiz_times_histogram_v_axis").show(),$qwiz_times_histogram.find("div.qwiz_times_histogram_bin_marker").hide(),qwizdata[i].qwiz_times_histogram_show_bin_counts?($qwiz_times_histogram.find("div.qwiz_times_histogram_bar_label").show(),$qwiz_times_histogram.find("div.qwiz_times_histogram_bin_label").hide()):($qwiz_times_histogram.find("div.qwiz_times_histogram_bar_label").hide(),$qwiz_times_histogram.find("div.qwiz_times_histogram_bin_label").hide())):($qwiz_times_histogram.find("div.qwiz_times_histogram_bar").hide(),$qwiz_times_histogram.find("div.qwiz_times_histogram_v_axis").hide(),qwizdata[i].qwiz_times_histogram_show_bin_counts&&($qwiz_times_histogram.find("div.qwiz_times_histogram_bin_marker").show(),$qwiz_times_histogram.find("div.qwiz_times_histogram_bin_label").show())),qwizdata[i].qwiz_times_histogram_show_bars=t)},this.process_choice=function(e,t,i,a,s){s||(s=""),e&&e.stopPropagation();a=a?1:0;var _=t.match(/(.*)-/)[1],o=t.match(/(qwiz.*?)-/)[1];i_qwiz=parseInt(o.substr(4),10);var n=t.match(/-q([0-9]+)-/)[1];debug[0]&&console.log("[process_choice] feedback_id: ",t,", qwizq_id: ",_,", i_qwiz: ",i_qwiz);var r=10;if(!q.preview&&qwizdata[i_qwiz].record_start_b&&document_qwiz_user_logged_in_b){r=500,qwizdata[i_qwiz].record_start_b=!1;record_response(i_qwiz,qwizdata[i_qwiz].qrecord_id,{type:"start",confirm:"js"},!0)}if(q.qwizard_b){var d=t.match(/-a([0-9]+)$/)[1],c="span.choice-qwiz"+i_qwiz+"-q"+n+"-a"+d,l=$(c+" span.qwiz-choice.qwiz_editable");l.css({position:"unset"});var w=l[0];qw.answer_choice_focus(w)}var h=qwizdata[i_qwiz].qrecord_id&&qwizdata[i_qwiz].use_dataset&&!qqc.isInteger(qwizdata[i_qwiz].dataset_id[n]);const u="mobile_"==t.substr(0,7)?"mobile_":"",z=u?t.substr(7):t;var m;document.getElementById("radio-"+z)&&(i=!!$("#radio-"+z).data("q"));const p=i?"qwiz_correct_choice":"qwiz_incorrect_choice",g=u?"#":".";if(u){$("#"+_+" li.mobile_choice").hide(),$("#"+_+" .qwiz-feedback").hide(),h||($("#"+t).show(),q.qwizard_b||$(g+"choice-"+t).addClass(p));$("#choice-"+t).show(),m=""}else m=$("input[name="+_+"]").attr("disabled");if("disabled"!=m){if(u&&(t=t.substr(7),_=_.substr(7)),$("#"+_+" .qwiz-feedback").hide(),process_choice_disable(t,_),h||s||($("#"+t).show(),q.qwizard_b||$(g+"choice-"+t).addClass(p)),1!=qwizdata[i_qwiz].user_question_number||!q.no_intro_b[i_qwiz]&&1!=qwizdata[i_qwiz].n_questions||($("div#icon_qwiz"+i_qwiz).hide(),alert_not_logged_in(i_qwiz),qwizdata[i_qwiz].qwiz_timer&&start_timers(i_qwiz)),h||qwizdata[i_qwiz].qrecord_id&&document_qwiz_user_logged_in_b){d=t.match(/-a([0-9]+)$/)[1];var b=$("#"+_+" .choice-"+t).html();b=b?qqc.remove_tags_eols(b):"stuck"==s?"I’m stuck – show me the answer":"generative"==s?btoa(encodeURIComponent($(`textarea#check_my_answer-${_}`).val())):qqc.remove_tags_eols($(`#${_} button.qwiz_button`).first().html())+"\t"+qqc.remove_tags_eols($("#"+t).html());setTimeout((function(){var e={q_and_a_text:btoa(encodeURIComponent(qwizdata[i_qwiz].q_and_a_text[n])),q_and_a_crc32:qwizdata[i_qwiz].q_and_a_crc32[n],i_question:qwizdata[i_qwiz].dataset_id[n],unit:qwizdata[i_qwiz].unit[n],level:qwizdata[i_qwiz].level[n],type:"multiple_choice",response:b,i_choice:d,correct_b:i?1:"",feedback_id:u+t,got_it_more_practice_f:a,confirm:"js"};h&&(e.secure_f=1),q.preview_i_qwiz_plus1&&(e.preview_no_record=1),qwizdata[i_qwiz].cv_index&&(e.cv_index=qwizdata[i_qwiz].cv_index),"generative"==s&&(e.generative_feedback=btoa(encodeURIComponent($(`div.${_}-a0_gen`).html()))),record_response(i_qwiz,qwizdata[i_qwiz].qrecord_id,e)}),r)}h||q.process_choice2(u+t,a,i,-1)}},this.process_choice2=function(e,t,i,a,s,_,o,n){const r=e.match(/qwiz([0-9]+)-/)[1],d=e.match(/-q([0-9]+)-/)[1];debug[0]&&(console.log("[process_choice2] correct_f:",i,", feedback_html:",a),console.log("[process_choice2] i_question:",d));const c="mobile"==e.substr(0,6),l=i?"qwiz_correct_choice":"qwiz_incorrect_choice",w=c?"#":".";if(-1!=a){if("show_answers"!=preview_mode&&($("#"+e).html(a).show(),$(w+"choice-"+e).addClass(l)),c){const t=e.substr(7);$("#"+t).html(a).show(),$(w+"choice-"+t).addClass(l)}if(i){update_progress_meter(r,s,atob(_),o,n)}}q.qwizard_b||q.preview||(qwizdata[r].answered_correctly[d]=i?1:-1,i?(qwizdata[r].n_correct++,qwizdata[r].n_qs_done&&qwizdata[r].n_qs_done.add(qwizdata[r].dataset_id[d])):qwizdata[r].n_incorrect++,update_topic_statistics(r,d,i)),1==t?($("#show_answer_got_it_or_not-qwiz"+r+"-q"+d).hide(),$("#mobile_show_answer_got_it_or_not-qwiz"+r+"-q"+d).hide(),q.qwizard_b||q.display_progress(r),q.next_question(r)):($(`div#qwiz${r}-q${d} button.show_the_answer`).addClass("qwiz_button_disabled").attr("disabled",!0),$(`div#mobile_qwiz${r}-q${d} li.mobile_choice`).hide(),update_progress_show_next(r))},this.generate_custom_feedback=function(e,t,i,a){var s="";qwizdata[e].prompt_intro&&void 0!==qwizdata[e].prompt_intro[t]?s=qwizdata[e].prompt_intro[t]:qwizdata[e].default_prompt_intro&&(s=qwizdata[e].default_prompt_intro);var _="";qwizdata[e].prompt_intro_add&&void 0!==qwizdata[e].prompt_intro_add[t]?_=qwizdata[e].prompt_intro_add[t]:qwizdata[e].default_prompt_intro_add&&(_=qwizdata[e].default_prompt_intro_add);var o="";qwizdata[e].prompt_for_question&&void 0!==qwizdata[e].prompt_for_question[t]?o=qwizdata[e].prompt_for_question[t]:qwizdata[e].default_prompt_for_question&&(o=qwizdata[e].default_prompt_for_question);var n="";qwizdata[e].prompt_for_response&&void 0!==qwizdata[e].prompt_for_response[t]?n=qwizdata[e].prompt_for_response[t]:qwizdata[e].default_prompt_for_response&&(n=qwizdata[e].default_prompt_for_response);var r=20;qwizdata[e].response_min_chars&&void 0!==qwizdata[e].response_min_chars[t]?r=qwizdata[e].response_min_chars[t]:qwizdata[e].default_response_min_chars&&(r=qwizdata[e].default_response_min_chars);var d="";qwizdata[e].prompt_for_feedback&&void 0!==qwizdata[e].prompt_for_feedback[t]?d=qwizdata[e].prompt_for_feedback[t]:qwizdata[e].default_prompt_for_feedback&&(d=qwizdata[e].default_prompt_for_feedback);var c,l="";qwizdata[e].temperature&&void 0!==qwizdata[e].temperature[t]?l=qwizdata[e].temperature[t]:qwizdata[e].default_temperature&&(l=qwizdata[e].default_temperature),1==qwizdata[e].user_question_number&&($("div#icon_qwiz"+e).hide(),alert_not_logged_in(e),qwizdata[e].qwiz_timer&&start_timers(e)),c=qwizcards_page_f?qqc.get_qwiz_param("server_loc","http://qwizcards.net/admin")+"/qwizard_textentry_suggestions.php":qqc.get_qwiz_param("ajaxurl",""),debug[0]&&(c+="?qwiz_debug=0");const w=$(`#${document_qwiz_mobile}qwiz${e}-q${t}-a0 .qwiz-feedback-div`);var h,u=$(`#${document_qwiz_mobile}qwiz${e}-q${t} div.qwizq`).html();if(u=qqc.remove_tags_eols(u),u=qqc.decodeHtmlEntities(u),a){const i=$(`input.${document_qwiz_mobile}qwiz${e}-q${t}-generative_hint`);if(h=i.val(),!/\S/.test(h)){return setTimeout((function(){alert("Please enter a hint topic")}),100),void i.focus()}var z="";qwizdata[e].default_hint_prompt_intro&&(z=qwizdata[e].default_hint_prompt_intro);qwizdata[e].default_hint_prompt_for_response&&(n=qwizdata[e].default_hint_prompt_for_response),s=z,n=""}else{h=$(`#${document_qwiz_mobile}qwiz${e}-q${t} textarea`).val();const i=document_qwiz_mobile?"":"mobile_";if($(`#${i}qwiz${e}-q${t} textarea`).val(h).trigger("input"),$(`#${document_qwiz_mobile}qwiz${e}-q${t} button.view_answer_guide`).html(T("View answer guide")),(h=qqc.remove_tags_eols(h)).length<r){return $(`div.qwiz${e}-q${t}-a0_gen`).html(T("Please enter a longer response!")).show(),void(qwizdata[e].generative_response_error=!0)}$(`div#qwiz${e}-q${t} button.show_the_answer`).addClass("qwiz_button_disabled").attr("disabled",!0),$(`div#mobile_qwiz${e}-q${t} li.mobile_choice`).hide()}debug[0]&&(console.log("[generate_custom_feedback] prompt_intro:",s),console.log("[generate_custom_feedback] prompt_for_question:",o),console.log("[generate_custom_feedback] prompt_for_response:",n),console.log("[generate_custom_feedback] prompt_for_feedback:",d),console.log("[generate_custom_feedback] temperature:",l)),$(`div.qwiz${e}-q${t}-a0_gen`).html(""),$(`div.qwiz${e}-q${t}
1-spinner`).show();var m=w.html();m=qqc.remove_tags_eols(m);var p={action:"generate_custom_feedback",i_qwiz:e,i_question:t,prompt_intro:s,prompt_intro_add:_,prompt_for_question:o,question:u,prompt_for_response:n,response:h,prompt_for_feedback:d,feedback:m=qqc.decodeHtmlEntities(m),temperature:l,hint_f:a?1:0};debug[0]&&console.log("[generate_custom_feedback] data:",p),$.ajax({type:"POST",url:c,data:p,dataType:"json",error:function(e,t){debug[0]&&console.log("[generate_custom_feedback] error desc:",t)},success:show_generated_custom_feedback}),a||q.preview||qwizdata[e].bck_f||($(`#show_answer_got_it_or_not-qwiz${e}-q${t}`).css({opacity:.2}).show(),$(`#mobile_show_answer_got_it_or_not-qwiz${e}-q${t}`).css({opacity:.2}).show(),$(`#show_answer_got_it_or_not-qwiz${e}-q${t} .ok_ive_got_it`).removeAttr("disabled").removeClass("qwiz_button_disabled"),$(`#mobile_show_answer_got_it_or_not-qwiz${e}-q${t} .ok_ive_got_it`).removeAttr("disabled").removeClass("qwiz_button_disabled"))},this.hide_check_my_answer_feedback=function(e,t){qwizdata[e].generative_response_error&&(qwizdata[e].generative_response_error=!1,$(`div.qwiz${e}-q${t}-a0_gen`).hide())},this.show_answer_got_it_or_not=function(e,t,i){1==qwizdata[e].user_question_number&&($("div#icon_qwiz"+e).hide(),alert_not_logged_in(e),qwizdata[e].qwiz_timer&&start_timers(e)),q.qwizard_b||(i.style.display="none"),$(`#qwiz${e}-q${t}-a0`).show(),$(`#mobile_qwiz${e}-q${t}-a0`).show(),q.preview||qwizdata[e].bck_f||($(`#show_answer_got_it_or_not-qwiz${e}-q${t}`).css({opacity:1}).show(),$(`#mobile_show_answer_got_it_or_not-qwiz${e}-q${t}`).css({opacity:1}).show(),$(`#show_answer_got_it_or_not-qwiz${e}-q${t} .ok_ive_got_it`).removeAttr("disabled").removeClass("qwiz_button_disabled"),$(`#mobile_show_answer_got_it_or_not-qwiz${e}-q${t} .ok_ive_got_it`).removeAttr("disabled").removeClass("qwiz_button_disabled"))},this.view_answer_guide=function(e,t,i){const a=$(`#${document_qwiz_mobile}qwiz${t}-q${i}-a0`);if(a.is(":visible"))a.hide(),e.innerHTML=T("View answer guide");else{if(0==a.find(".answer_guide_header").length){const e='<p class="answer_guide_header" style="font-weight: bold; color: blue;">Answer Guide</p>';a.prepend(e).css({border:"2px solid blue",padding:"5px"})}a.show(),$("html, body").animate({scrollTop:a.offset().top},500),e.innerHTML=T("Hide answer guide")}},this.display_progress=function(e,t){if(debug[0]&&console.log("[display_progress] qwizdata[i_qwiz].i_question:",qwizdata[e].i_question,", came_from_start_b:",t),!qwizdata[e].hide_progress_b){var i,a=qwizdata[e].n_correct+qwizdata[e].n_incorrect,s=qwizdata[e].n_correct;if(qwizdata[e].repeat_incorrect_b||(s+=qwizdata[e].n_incorrect),q.qwizard_b)if(-1!=qwizdata[e].i_question||t){var _=qwizdata[e].i_question+1;t&&_++,i="Question "+_+" of "+qwizdata[e].n_questions}else i=T("Questions in this quiz:")+" "+qwizdata[e].n_questions;else{const t=qwizdata[e].n_questions_for_done,_=t-s;if(0==a){const a=qwizdata[e].n_qs;i=T(a&&t<a?"Questions in this set:":"Questions in this quiz:"),i+=" "+_}else{var o,n;document_qwiz_mobile||qwizdata[e].qwiz_timer?(o=T("Qs"),n=T("not")):(o=T("questions"),n=T("incorrect")),i=t+" "+o+", "+a+" "+plural(T("response"),T("responses"),a)+", "+qwizdata[e].n_correct+" "+T("correct")+", "+qwizdata[e].n_incorrect+" "+n+", "+_+" "+T("to go")}}$("#progress-qwiz"+e).html(i).show()}},this.display_diagram_progress=function(e,t="Correctly labeled",i=-1){if(!qwizdata[e].hide_progress_b){var a,s,_=qwizdata[e].user_question_number,o=qwizdata[e].n_questions_for_done,n="";(o>1||qwizdata[e].combo)&&(n="Q #"+_+"/"+o+"; "),-1==i?(a=qwizdata[e].n_labels_correct,s=qwizdata[e].n_label_targets):(a=i,s=i),"Correctly labeled"==t&&(t=T("Correctly labeled")),n+=t+" "+a+" "+T("out of")+" "+s+" "+T("items"),$("#progress-qwiz"+e).html(n).show()}},this.canned_feedback=function(e,t){var i;if(e){var a=Math.floor(Math.random()*correct.length);i=correct[a]}else{a=Math.floor(Math.random()*incorrect.length);i=incorrect[a]}return t||(i="<p><strong>"+i+"</strong></p>"),debug[0]&&console.log("[canned_feedback] response:",i),i};var find_matching_terms=function(e,t){1==qwizdata[textentry_i_qwiz].user_question_number&&($("div#icon_qwiz"+textentry_i_qwiz).hide(),alert_not_logged_in(textentry_i_qwiz),qwizdata[textentry_i_qwiz].qwiz_timer&&start_timers(textentry_i_qwiz));var i=e.term.toLowerCase(),a=qqc.metaphone(i);debug[6]&&console.log("[find_matching_terms] entry_metaphone; ",a);for(var s=100,_=100,o=qwizdata[textentry_i_qwiz].i_question,n=qwizdata[textentry_i_qwiz].textentry[o].textentry_minlength,r=0;r<textentry_answer_metaphones[textentry_i_qwiz].length;r++)i[0]==textentry_answers[textentry_i_qwiz][r][0].toLowerCase()&&(s=Math.min(s,textentry_answers[textentry_i_qwiz][r].length),debug[6]&&console.log("[find_matching_terms] entry[0]:",i[0],", textentry_answers[textentry_i_qwiz][i][0]:",textentry_answers[textentry_i_qwiz][r][0])),a[0]==textentry_answer_metaphones[textentry_i_qwiz][r][0]&&(_=Math.min(_,textentry_answer_metaphones[textentry_i_qwiz][r].length),debug[6]&&console.log("[find_matching_terms] textentry_answer_metaphones[textentry_i_qwiz][i]:",textentry_answer_metaphones[textentry_i_qwiz][r],", required_metaphone_length:",_));
1100==s?s=n:(s-=2,s=Math.min(n,s)),100!=_&&(--_<2?_=2:_>4&&(_=4)),debug[6]&&console.log("[find_matching_terms] required_entry_length:",s,", required_metaphone_length:",_);var d=i.replace(/(.)\1{2,}/gi,"$1");if(d.length<s&&a.length<_)textentry_matches[textentry_i_qwiz]=[],lc_textentry_matches[textentry_i_qwiz]=[],find_matching_terms2(t,d);else if(debug[6]&&console.log("[find_matching_terms] request.term:",e.term,", entry_metaphone:",a,", entry_metaphone.length:",a.length),textentry_matches[textentry_i_qwiz]=$.map(current_question_textentry_terms_metaphones[textentry_i_qwiz],(function(e){if(""==a?""==e[1]||0===e[0].toLowerCase().indexOf(i):0===e[1].indexOf(a)||0===e[0].toLowerCase().indexOf(i))return debug[6]&&console.log("[find_matching_terms] term_i:",e),e[0]})),debug[6]&&console.log("[find_matching_terms] textentry_matches[textentry_i_qwiz]:",textentry_matches[textentry_i_qwiz]),qwizdata[textentry_i_qwiz].textentry[o].use_dict_b){var q,c=qwizdata[textentry_i_qwiz].textentry[o].textentry_plural_b?1:0,l={action:"textentry_suggestions",entry:encodeURIComponent(i),entry_metaphone:encodeURIComponent(a),n_hints:qwizdata[textentry_i_qwiz].textentry_n_hints,terms:textentry_matches[textentry_i_qwiz],plural_f:c};q=qwizcards_page_f?qqc.get_qwiz_param("server_loc","http://qwizcards.net/admin")+"/qwizard_textentry_suggestions.php":qqc.get_qwiz_param("ajaxurl",""),$.ajax({type:"POST",url:q,data:l,dataType:"json",error:function(e,t){debug[0]&&console.log("[find_matching_terms] error desc:",t)},success:function(e){textentry_matches[textentry_i_qwiz]=e,find_matching_terms2(t,d)}})}else find_matching_terms2(t,d)};function find_matching_terms2(e,t){textentry_matches[textentry_i_qwiz].length&&(lc_textentry_matches[textentry_i_qwiz]=textentry_matches[textentry_i_qwiz].map((function(e){return e.toLowerCase()})),debug[6]&&console.log("[find_matching_terms2] textentry_matches[textentry_i_qwiz]:",textentry_matches[textentry_i_qwiz])),debug[6]&&console.log("[find_matching_terms2] deduped_entry.length: ",t.length,", textentry_matches[textentry_i_qwiz].length: ",textentry_matches[textentry_i_qwiz].length,", qwizdata[textentry_i_qwiz].textentry_n_hints: ",qwizdata[textentry_i_qwiz].textentry_n_hints);var i=qwizdata[textentry_i_qwiz].i_question,a=qwizdata[textentry_i_qwiz].textentry[i].textentry_minlength;if(t.length>=a&&qwizdata[textentry_i_qwiz].textentry_n_hints<5){var s=qwizdata[textentry_i_qwiz].textentry[i].first_correct_answer.toLowerCase();void 0!==lc_textentry_matches[textentry_i_qwiz]&&-1!=lc_textentry_matches[textentry_i_qwiz].indexOf(s)||($("#textentry_check_answer_div-qwiz"+textentry_i_qwiz+"-q"+i+" button.qwiz_textentry_hint").removeAttr("disabled").removeClass("qwiz_button_disabled").css({display:"inline-block"}),q.qwizard_b&&$("#qwiz"+textentry_i_qwiz+"-q"+i+" .qwiz-feedback").hide())}e(textentry_matches[textentry_i_qwiz])}function menu_closed(e){var t=e.target.value.toLowerCase(),i=qwizdata[textentry_i_qwiz].i_question,a=qwizdata[textentry_i_qwiz].textentry_n_hints;if(t.length<a){var s=qwizdata[textentry_i_qwiz].textentry[i].first_correct_answer.substr(0,a);e.target.value=s}(qwizdata[textentry_i_qwiz].check_answer_disabled_b||(debug[6]&&console.log("[menu_closed] textentry_matches[textentry_i_qwiz]: ",textentry_matches[textentry_i_qwiz]),void 0!==lc_textentry_matches[textentry_i_qwiz]&&-1!=lc_textentry_matches[textentry_i_qwiz].indexOf(t)||($("#textentry_check_answer_div-qwiz"+textentry_i_qwiz+"-q"+i+" button.textentry_check_answer").addClass("qwiz_button_disabled").html(qwizdata[textentry_i_qwiz].check_answer),qwizdata[textentry_i_qwiz].check_answer_disabled_b=!0,q.qwizard_b&&$("#qwiz"+textentry_i_qwiz+"-q"+i+" .qwiz-feedback").hide())),show_hint_timeout[textentry_i_qwiz])&&($("#textentry-qwiz"+textentry_i_qwiz+"-q"+i).val().length>=qwizdata[textentry_i_qwiz].textentry[i].textentry_minlength&&(clearTimeout(show_hint_timeout[textentry_i_qwiz]),show_hint_timeout[textentry_i_qwiz]=0))}function menu_shown(e){if(qwizdata[textentry_i_qwiz].record_start_b&&document_qwiz_user_logged_in_b){qwizdata[textentry_i_qwiz].record_start_b=!1;record_response(textentry_i_qwiz,qwizdata[textentry_i_qwiz].qrecord_id,{type:"start",confirm:"js"},!0)}var t=e.target.value.toLowerCase(),i=qwizdata[textentry_i_qwiz].i_question,a=qwizdata[textentry_i_qwiz].textentry[i].first_correct_answer.toLowerCase();-1!=lc_textentry_matches[textentry_i_qwiz].indexOf(a)&&$("#textentry_check_answer_div-qwiz"+textentry_i_qwiz+"-q"+i+" button.qwiz_textentry_hint").attr("disabled",!0).addClass("qwiz_button_disabled"),-1!=lc_textentry_matches[textentry_i_qwiz].indexOf(t)?($("#textentry_check_answer_div-qwiz"+textentry_i_qwiz+"-q"+i+" button.textentry_check_answer").removeClass("qwiz_button_disabled").html(T("Check answer")),qwizdata[textentry_i_qwiz].check_answer_disabled_b=!1):($("#textentry_check_answer_div-qwiz"+textentry_i_qwiz+"-q"+i+" button.textentry_check_answer").addClass("qwiz_button_disabled").html(qwizdata[textentry_i_qwiz].check_answer),qwizdata[textentry_i_qwiz].check_answer_disabled_b=!0)}function alert_not_logged_in(e){if(q.no_intro_b[e]&&qwizdata[e].qrecord_id&&$.cookie("qwiz_user_login")){"undefined"!=typeof document_qwiz_user_logged_in_b&&document_qwiz_user_logged_in_b&&"undefined"!=typeof document_qwiz_username||document_qwiz_declined_login_b||document_qwiz_not_logged_in_alerted||q.qwizard_b||-1==qwizdata[e].qrecord_id.indexOf("finish_times_demo")&&(alert("Note: you are not logged in. You must be logged in to receive credit."),document_qwiz_not_logged_in_alerted=!0)}}function redisplay_current_question(e,t){if(t<qwizdata[e].n_questions)if(document_qwiz_mobile){var i=$("#mobile_qwiz"+e+"-q"+t);i.length?i.show():$("#qwiz"+e+"-q"+t).show()}else $("#qwiz"+e+"-q"+t).show();else $("#summary-qwiz"+e).show();$(".bbfe-qwiz"+e).css({visibility:"visible"}),$("span.question-number-qwiz"+e).css({visibility:"visible"})}function get_attr(e,t,i){var a=qqc.get_attr(e,t);return i&&!a&&(a=qqc.get_attr(e,t+"s")),a}function S(e){return qqc.T(e)}function T(e){return qqc.T(e)}function plural(e,t,i){return qqc.plural(e,t,i)}function inarray0(e,t){for(var i=e.length,a=0;a<i;a++)if(e[a][0]==t)return!0;return!1}this.textentry_check_answer=function(e,t,i){var a=qwizdata[e].i_question,s=$("#textentry-qwiz"+e+"-q"+a);if(debug[6]&&(n=s.val(),console.log("[textentry_check_answer] $textentry.val ():",s.val())),!qwizdata[e].textentry[a].textentry_suggest_b){if(qwizdata[e].record_start_b&&document_qwiz_user_logged_in_b){qwizdata[e].record_start_b=!1;var _={type:"start",confirm:"js"};record_response(e,qwizdata[e].qrecord_id,_,!0)}if(""==(n=s.val()))return!1}if(!t&&!q.qwizard_b&&!q.preview){if(qwizdata[e].check_answer_disabled_b)return alert(Tcheck_answer_message),void $("#textentry_check_answer_div-qwiz"+e+"-q"+a+" button.qwiz_textentry_hint").removeAttr("disabled").removeClass("qwiz_button_disabled").css({display:"inline-block"});$("#textentry_check_answer_div-qwiz"+e+"-q"+a).hide()}s.blur(),q.qwizard_b||q.preview||s.attr("disabled",!0);for(var o,n=s.val().toLowerCase(),r=-1,d=!1,c=qwizdata[e].textentry[a].choices.length,l=0;l<c;l++){var w=qwizdata[e].textentry[a].choices[l];if("*"==w[0])o=l;else{var h=!1;if(q.qwizard_b&&void 0!==i&&"Enter word"==w&&l==i&&(h=!0),!h)h=-1!=w.map((function(e){return e.toLowerCase()})).indexOf(n);if(h){d=qwizdata[e].textentry[a].choices_correct[l],r=l;break}}}if(-1==r&&(r=o),"questions_active"==preview_mode&&$("#qwiz"+e+"-q"+a+" .qwiz-feedback").hide(),$("#qwiz"+e+"-q"+a+"-a"+r).show(),!q.qwizard_b){if(qwizdata[e].answered_correctly[a]=d?1:-1,d?(qwizdata[e].n_correct++,qwizdata[e].n_qs_done&&qwizdata[e].n_qs_done.add(qwizdata[e].dataset_id[a])):qwizdata[e].n_incorrect++,qwizdata[e].qrecord_id&&document_qwiz_user_logged_in_b){_={q_and_a_text:btoa(encodeURIComponent(qwizdata[e].q_and_a_text[a])),q_and_a_crc32:qwizdata[e].q_and_a_crc32[a],i_question:qwizdata[e].dataset_id[a],unit:qwizdata[e].unit[a],level:qwizdata[e].level[a],type:"textentry",response:n,i_choice:-1,correct_b:d?1:"",confirm:"js"};record_response(e,qwizdata[e].qrecord_id,_)}update_topic_statistics(e,a,d)}update_progress_show_next(e)},this.textentry_hint=function(e){clearTimeout(show_hint_timeout[e]),show_hint_timeout[e]=0,qwizdata[e].textentry_n_hints++;var t=qwizdata[e].i_question,i=qwizdata[e].textentry[t].first_correct_answer.substr(0,qwizdata[e].textentry_n_hints);$("#textentry-qwiz"+e+"-q"+t).val(i).focus().trigger("keydown"),$("#textentry_check_answer_div-qwiz"+e+"-q"+t+" button.qwiz_textentry_hint").attr("disabled",!0).addClass("qwiz_button_disabled").html("Another hint");var a=$("#textentry_check_answer_div-qwiz"+e+"-q"+t);hint_timeout_sec>=0&&(show_hint_timeout[e]=setTimeout((function(){a.find("button.qwiz_textentry_hint").removeAttr("disabled").removeClass("qwiz_button_disabled")}),1e3*hint_timeout_sec))},this.set_textentry_i_qwiz=function(e,t){var i=t.id;if(textentry_i_qwiz=i.match(/[0-9]+/)[0],debug[6]&&console.log("[set_textentry_i_qwiz] textentry_i_qwiz: ",textentry_i_qwiz),e.stopPropagation(),q.qwizard_b){var a=i.match(/qwiz.*/)[0];$("#"+a+" .qwiz-feedback").hide()}},this.item_selected=function(){var e=qwizdata[textentry_i_qwiz].i_question;$("#textentry_check_answer_div-qwiz"+textentry_i_qwiz+"-q"+e+" button.textentry_check_answer").removeClass("qwiz_button_disabled").html(T("Check answer")),qwizdata[textentry_i_qwiz].check_answer_disabled_b=!1},this.keep_next_button_active=function(){next_button_active_b=!0,qqc.next_button_active_b=!0,$(".next_button").show()},this.position_show_next_button=function(e){$("#next_button-qwiz"+e).show()},this.hide_menu_and_display_login=function(e,t,i,a,s,_){var o=$("div.qwiz_icon_and_menu_container.qwiz"+e+" div.qwiz_icon_trigger_and_menu");o.removeClass("qwiz-hover"),q.display_login(e,t,i,a,s,_);setTimeout((function(){o.addClass("qwiz-hover")}),500)},this.display_login=function(e,t,i,a,s,_){i||(i=""),t||i||$("div.qwiz-usermenu_icon").removeClass("qwiz-icon-bounce");var o=qwizdata[e].i_question;if(-1==o?($(".intro-qwiz"+e).hide(),q.no_intro_b[e]||$("div#icon_qwiz"+e).hide()):o>=qwizdata[e].n_questions?$("#summary-qwiz"+e).hide():($textentry_check_answer_div=$("#textentry_check_answer_div-qwiz"+e+"-q"+o),$textentry_check_answer_div.is(":visible")?($textentry_check_answer_div.hide(),qwizdata[e].textentry_check_answer_show_b=!0):qwizdata[e].textentry_check_answer_show_b=!1,hide_current_question(e,qwizdata[e].i_user_question),$(".bbfe-qwiz"+e).css({visibility:"hidden"}),$("span.question-number-qwiz"+e).css({visibility:"hidden"})),$("#next_button-qwiz"+e).hide(),"progress_bars"==i||"leaderboard"==i){const t=qwizdata[e].display_pay_screen;"register"==t||"open_register"==t||"subscribe"==t||"free_trial"==t?$(".intro-qwiz"+e).show():(qwizdata[e].leaderboard_class_everyone=0,qqc.create_progress_bars(qname,qwizdata,e,i))}else"feedback"==i?qqc.create_provide_feedback_screen(qname,e,qwizdata[e].i_question):"use_dataset_options"==i?qqc.create_use_dataset_options(qname,qwizdata,e):"pay"==i?qqc.create_pay_screen(qname,qwizdata,e,a,_):"maker_pay"==i?qqc.create_maker_pay_screen(qname,qwizdata,e,a):"enroll"==i?qqc.create_enroll_screen(qname,e):"register"==i?qqc.create_register_taker_screen(qname,e,s,a,i):"open_register"==i?qqc.create_register_taker_screen(qname,e,!1,a,i):"free_trial"==i?qqc.create_register_taker_screen(qname,e,!0,a,i):"paypal_subscription"==i?qqc.create_paypal_subscription_screen(qname,e):"special_offer"==i?qqc.create_paypal_subscription_screen(qname,e,!0):document_qwiz_wp_user_session_id?qqc.create_refresh_page_notice(qname,e):($("#qwiz_login-qwiz"+e).html(get_login_html(e,t,a,s)).show(),qqc.init_hide_show_password("#qwiz_password-qwiz"+e),qwizdata[e].display_pay_screen||$("#qwiz_username-qwiz"+e).focus());qwizdata[e].login_show_b=!0},this.login=function(e,t,i){t=t?1:0,i=i?1:0,$.removeCookie("qwiz_declined_login",{path:"/"}),document_qwiz_declined_login_b=!1;var a=$("#qwiz_username-qwiz"+e),s=a.val();if(!s)return alert(T("Please enter Login name")),a.focus(),!1;if(t&&-1!=document_qwiz_username.split("; ").indexOf(s))return alert("User "+s+" is already on your team."),!1;var _=$("#qwiz_password-qwiz"+e),o=_.val();if(!o)return alert(T("Please enter Password")),_.focus(),!1;_.blur();var n,r=CryptoJS.SHA3(o).toString();t?n=document_qwiz_remember_f:(n=$("#qwiz_login-qwiz"+e+' input[type="checkbox"]').prop("checked")?1:0,document_qwiz_remember_f=n);var d={username:s,sha3_password:r,remember_f:n,add_team_member_f:t};return t&&(d.previous_username=document_qwiz_username),i&&(d.proceed_to_pay_f="1"),qqc.jjax(qname,e,qwizdata[e].qrecord_id,"login",d),!1},this.login_ok=function(e,t,i,a){var s={path:"/"};1==i&&(s.expires=1),$.cookie("qwiz_session_id",document_qwiz_session_id,s),s.expires=30,$.cookie("qwiz_user_login",1,s),qqc.check_session_id(e),document_qwiz_user_logged_in_b=!0;var _=qqc.get_qwiz_param("login_timeout_min",40);if(s.expires=_/1440,$.cookie("qwiz_current_login_lt_nmin_ago",1,s),qqc.set_user_menus_and_icons(),qwiz_&&qwiz_.any_pay_quiz_f&&qwiz_.pay_lock_settings(),qcard_&&qcard_.any_pay_deck_f&&qcard_.pay_lock_settings(),$("#qwiz_login-qwiz"+e).hide(),qwizdata[e].login_show_b=!1,q.qrecord_b)for(var o=0;o<n_qwizzes;o++)qwizdata[o].qrecord_id&&(qwizdata[o].record_start_b=!0);return"special_offer"==qwizdata[e].display_pay_screen?(document.location=document.location,!1):(a&&"paid"==qwizdata[e].pay_quiz_ok&&(a=!1),a?q.display_login(e,!1,"pay"):qwizdata[e].display_pay_screen?($(`.intro-qwiz${e}`).show(),$(`#qwiz${e}-q0`).hide()):q.login_ok_start_quiz(e),!1)},this.login_ok_start_quiz=function(e){var t=qwizdata[e].i_user_question;if(-1==t)q.next_question(e);else{redisplay_current_question(e,t),qwizdata[e].record_start_b=!1;record_response(e,qwizdata[e].qrecord_id,{type:"start",confirm:"js"},!0),qwizdata[e].next_button_show_b&&q.position_show_next_button(e),qwizdata[e].textentry_check_answer_show_b&&$("#textentry_check_answer_div-qwiz"+e+"-q"+t).css({display:"inline-block"})}},this.login_not_ok=function(e,t){t||(t=T("Login incorrect. Please try again")),$("#qwiz_login-qwiz"+e+" p.login_error").html(t).show(),debug[0]&&console.log("[login_not_ok] $ ('#qwiz_login-qwiz"+e+" p.login_error'):",$("#qwiz_login-qwiz"+e+" p.login_error"))},this.no_login=function(e,t,i){t||i||($("#qwiz_login-qwiz"+e+' input[type="checkbox"]').prop("checked")&&($.cookie("qwiz_declined_login",1,{path:"/"}),document_qwiz_declined_login_b=!0),$("div.qwiz-usermenu_icon").removeClass("qwiz-icon-bounce")),$("#qwiz_login-qwiz"+e).hide(),qwizdata[e].login_show_b=!1;var a=qwizdata[e].i_user_question;return-1==a?i?($(".intro-qwiz"+e).show(),$("#next_button-qwiz"+e).show()):q.next_question(e,!0):(redisplay_current_question(e,a),qwizdata[e].next_button_show_b&&q.position_show_next_button(e),qwizdata[e].textentry_check_answer_show_b&&$("#textentry_check_answer_div-qwiz"+e+"-q"+a).show()),!1},this.icon_no_login=function(e,t){$("div.qwiz-usermenu_icon").removeClass("qwiz-icon-bounce"),t||$("#usermenu-qwiz"+e+' input[type="checkbox"]').prop("checked")&&($.cookie("qwiz_declined_login",1,{path:"/"}),document_qwiz_declined_login_b=!0)},this.get_qwizdata=function(e,t){return void 0===qwizdata[e][t]?"":qwizdata[e][t]},this.set_qwizdata=function(i_qwiz,variable,value){if(-1==i_qwiz){var s=variable+" = "+value;eval(s)}else qwizdata[i_qwiz][variable]=value}};qwizf.call(qwiz_);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.