Changeset 3722232
- Timestamp:
- 10/01/2026 12:07:59 AM (4 weeks ago)
- Location:
- qwiz-online-quizzes-and-flashcards/tags/4.05
- Files:
-
- 7 edited
- 1 copied
-
. (copied) (copied from qwiz-online-quizzes-and-flashcards/tags/4.04 )
-
qwiz.js (modified) (3 diffs)
-
qwiz.min.js (modified) (1 diff)
-
qwiz_qcards_common.js (modified) (17 diffs)
-
qwiz_qcards_common.min.js (modified) (2 diffs)
-
qwizard.css (modified) (1 diff)
-
qwizard.js (modified) (28 diffs)
-
qwizcards-plugin.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
qwiz-online-quizzes-and-flashcards/tags/4.05/qwiz.js
r3708145 r3722232 5929 5929 qwizdata[i_qwiz].spotmap_height[i_question] = height; 5930 5930 } 5931 this.hotspot_diagram_click = function (e ) {5931 this.hotspot_diagram_click = function (event) { 5932 5932 if (debug[0]) { 5933 5933 console.log ('[hotspot_diagram_click] event:', event); … … 6171 6171 var hotspot_label_hide_id; 6172 6172 var delay_hide_hotspot_no = -1; 6173 function show_hotspot_on_hover ( ) {6173 function show_hotspot_on_hover (event) { 6174 6174 if (debug[0]) { 6175 6175 console.log ('[show_hotspot_on_hover] event:', event); … … 6332 6332 } 6333 6333 } 6334 function hide_hotspots (e ) {6334 function hide_hotspots (event) { 6335 6335 if (debug[0]) { 6336 6336 console.log ('[hide_hotspots] e:', e); -
qwiz-online-quizzes-and-flashcards/tags/4.05/qwiz.min.js
r3708145 r3722232 1 window.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=$(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=$(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/znsvhNBal1LuLv3mDbu1OYLB67+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+CiAgICAgICAgIDx0aWZmOk9yaWVudGF0aW9uPjE8L3RpZmY6T3JpZW50YXRpb24+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">'),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>'+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)}else{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=$(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}">\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}-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 count 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)),correct=[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))),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=$(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=$(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");z?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)">Re-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");w&&"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)}if(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">'+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");i=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)).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=$(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");n&&("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.n_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>`;0==_.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[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";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 _}function 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()}},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]--;if(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];n&&(_=(_=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++}debug[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);i&&(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]));var 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?"":" "+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);q.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}-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:",_));100==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_);1 window.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=$(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=$(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/znsvhNBal1LuLv3mDbu1OYLB67+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+CiAgICAgICAgIDx0aWZmOk9yaWVudGF0aW9uPjE8L3RpZmY6T3JpZW50YXRpb24+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">'),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>'+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)}else{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=$(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}">\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}-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)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)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 count 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)),correct=[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))),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=$(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=$(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");z?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)">Re-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");w&&"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)}if(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">'+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");i=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)).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=$(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");n&&("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.n_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>`;0==_.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[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";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 _}function 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()}},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:",e);const t=$(e.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 a=is_xy_hotspot(t,i,e.offsetX,e.offsetY);q.hotspot_diagram_click2(t,i,a)}else{const a={use_dataset:qwizdata[t].use_dataset,dataset_id:qwizdata[t].dataset_id[i],i_question:i,ix:e.offsetX,iy:e.offsetY};qqc.qjax(qname,t,"","is_xy_hotspot",a)}},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]--;if(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(e){debug[0]&&console.log("[show_hotspot_on_hover] event:",e);const t=$(e.target).parents("div.qwizq"),i=t[0].id.match(/qwiz(\d+)/)[1],a=qwizdata[i].i_question,s=qwizdata[i].current_xy_hotspot_no;var _=e.target.className;if(-1==_.indexOf("qwiz_hotspot_label")){const t=$(e.target).parents("div.qwiz_hotspot_label");_=t.length?t[0].className:""}if(_){const e=_.match(/qwiz_hotspot(\d+)/);if(e){const _=e[1];if(_==s||_==delay_hide_hotspot_no){clearTimeout(hotspot_label_hide_id),delay_hide_hotspot_no=-1,qwizdata[i].on_hotspot_label=!0;const e=qwizdata[i].hotspot_labels_stick[a];if(e&&-1==e.indexOf("keep")&&-1==e.indexOf("temporary")){const e=t.find("div.qwiz_hotspot_label.qwiz_hotspot"+_);e.off("mouseleave"),e.on("mouseleave",function(){e.hide(),e.off("mouseleave")})}}return}}qwizdata[i].on_hotspot_label=!1;const o=is_xy_hotspot(i,a,e.offsetX,e.offsetY);if(o!=s){if(o){1==qwizdata[i].user_question_number&&$("div#icon_qwiz"+i).hide();const e=qwizdata[i].hotspot_user_interaction[a];if(e&&"find_hotspots"==e){const e=qwizdata[i].hotspot_nos[a],t=hotspot_indexof(e,o);if(Math.abs(e[t])>1e3)return}}const e=qwizdata[i].$hotspot_image_stack[a],_=qwizdata[i].hotspot_user_interaction[a],r=function(){const s=qwizdata[i].show_hotspots[a];if(s&&"always"!=s&&-1==s.indexOf("hide")){var n=qwizdata[i].find_the_dot[a]?.hotspot_only_new_f;const t="qwiz_layer"+o;if(!n){var r=e.find("img."+t);n=0==r.length}if(n){const s=qwizdata[i].ctx[a],_=q.create_hotspot_image(i,a,o,e,s);e.append('<img class="'+t+' hotspot_image_layer hotspot_only_image" />'),(r=e.find("img."+t))[0].src=_}r.show()}if(_&&"info_only"==_){const e=qwizdata[i].hotspot_labels_stick[a];if(e&&-1!=e.indexOf("hover_show")){debug[0]&&console.log("[show_hotspot_on_hover2] (label) new_xy_hotspot_no:",o),-1!=e.indexOf("keep")&&t.find("div.qwiz_hotspot_label").css({opacity:.5});t.find("div.qwiz_hotspot_label.qwiz_hotspot"+o).css({display:"inline-block",opacity:1})}const s=qwizdata[i].hotspot_nos[a],_=hotspot_indexof(s,o);s[_]<1e3&&(qwizdata[i].n_labels_correct++,qwizdata[i].n_hotspots_to_do[a]--,q.display_diagram_progress(i,T("Visited")),s[_]+=1e3)}};qwizdata[i].current_xy_hotspot_no=o;var n="";if(s>0){debug[0]&&console.log("[show_hotspot_on_hover (hide previous)] prev_xy_hotspot_no:",s,", new_xy_hotspot_no:",o);const r=qwizdata[i].hotspot_labels_stick[a],d=e.find("img.qwiz_layer"+s).not("img.hotspot_keep");if(n="hide",0==o){const e=qwizdata[i].show_hotspots[a];_&&"info_only"==_&&e&&-1!=e.indexOf("keep")&&(n=""),n&&r&&-1!=r.indexOf("hover_show")&&_&&"info_only"==_&&(n="delay")}if(n&&(d.hide(),_&&"info_only"==_)){const e=qwizdata[i].hotspot_labels_stick[a];if(e&&-1!=e.indexOf("hover_show")&&-1==e.indexOf("keep")&&-1==e.indexOf("temporary")){const e=t.find("div.qwiz_hotspot_label.qwiz_hotspot"+s);if("delay"==n){const t=function(){e.hide()};clearTimeout(hotspot_label_hide_id),hotspot_label_hide_id=setTimeout(t,700),delay_hide_hotspot_no=s}else e.hide()}else t.find("div.qwiz_hotspot_label").css({opacity:1})}}if(o){const e=qwizdata[i].show_hotspots[a];e&&-1!=e.indexOf("long_hover_show")?(clearTimeout(hotspot_long_hover_id),hotspot_long_hover_id=setTimeout(r,700)):r()}}}function hide_hotspots(t){debug[0]&&console.log("[hide_hotspots] e:",e);const i=$(t.target).parents("div.qwizq")[0].id.match(/qwiz(\d+)/)[1],a=qwizdata[i].i_question;qwizdata[i].current_xy_hotspot_no=-1,clearTimeout(hotspot_long_hover_id);const s=qwizdata[i].show_hotspots[a],_=qwizdata[i].hotspot_user_interaction[a];var o=!1;if(_&&"info_only"==_){const e=qwizdata[i].hotspot_labels_stick[a];if((o=e&&-1!=e.indexOf("hover_show")&&-1==e.indexOf("keep"))&&qwizdata[i].on_hotspot_label)return}s&&-1==s.indexOf("hide")&&(-1!=s.indexOf("temporary")||-1!=s.indexOf("keep")?($(e.currentTarget).find("img.hotspot_only_image").not("img.hotspot_keep").hide(),o&&$(e.currentTarget).find("div.qwiz_hotspot_label").not("div.hotspot_temporary").not("div.hotspot_keep").hide()):($(e.currentTarget).find("img.hotspot_only_image").hide(),o&&$(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];n&&(_=(_=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++}debug[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);i&&(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]));var 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?"":" "+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);q.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}-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:",_));100==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_); -
qwiz-online-quizzes-and-flashcards/tags/4.05/qwiz_qcards_common.js
r3710306 r3722232 77 77 var units_topics_state = {}; 78 78 var selected_levels = {}; 79 qqc.default_level = 'Intermediate'; 79 80 var debug = []; 80 81 debug[0] = false; // General. … … 1428 1429 var datasets_ds = [0]; 1429 1430 var q_fs = []; 1430 var non_default_levels= {};1431 var selected_levels_this_qwiz = [];1431 var all_levels = {}; 1432 var selected_levels_this_qwiz; 1432 1433 if (selected_levels[qname + i_qwiz]) { 1433 1434 selected_levels_this_qwiz = selected_levels[qname + i_qwiz]; … … 1441 1442 for (let d of datasets_ds) { 1442 1443 let data_d = data.datasets_data[d]; 1443 [units[d], topics[d], n_units_topics[d], 1444 [ 1445 units[d], topics[d], n_units_topics[d], 1444 1446 unit_topic_order[d], n_unit_qss[d], n_qs_by_unit_topic[d], 1445 1447 n_unit_cgs[d], n_cg_by_unit_topic[d], 1446 1448 n_qs[d], units_all_other[d], unit_topics_all_other[d], 1447 non_default_levels]1448 = units_topics_counts (data_d, non_default_levels,1449 selected_levels_this_qwiz);1449 all_levels 1450 ] = units_topics_counts (qname, i_qwiz, data_d, all_levels, 1451 selected_levels_this_qwiz); 1450 1452 datasets.push (data_d.dataset); 1451 1453 qrecord_ids.push (data_d.qrecord_id); … … 1498 1500 } 1499 1501 } else { 1500 [units[0], topics[0], n_units_topics[0], 1501 unit_topic_order[0], n_unit_qss[0], n_qs_by_unit_topic[0], 1502 n_unit_cgs[0], n_cg_by_unit_topic[0], 1503 n_qs[0], units_all_other, unit_topics_all_other[0], 1504 non_default_levels] 1505 = units_topics_counts (data, non_default_levels, 1506 selected_levels_this_qwiz); 1502 [ 1503 units[0], topics[0], n_units_topics[0], 1504 unit_topic_order[0], n_unit_qss[0], n_qs_by_unit_topic[0], 1505 n_unit_cgs[0], n_cg_by_unit_topic[0], 1506 n_qs[0], units_all_other, unit_topics_all_other[0], 1507 all_levels 1508 ] = units_topics_counts (data, qname, i_qwiz, all_levels, 1509 selected_levels_this_qwiz); 1507 1510 qrecord_id = data.qrecord_id; 1508 1511 qrecord_ids = [qrecord_id]; … … 1511 1514 q_fs = [data.q_f]; 1512 1515 } 1513 non_default_levels = Object.keys (non_default_levels); 1514 non_default_levels.sort (); 1516 all_levels = Object.keys (all_levels); 1515 1517 var dataset_reset_questions_date = data.dataset_reset_questions_date; 1516 1518 if (! dataset_reset_questions_date) { … … 1531 1533 tot_n_units_topics += n; 1532 1534 } 1535 /* 1533 1536 if (tot_n_units_topics == 0) { 1534 1537 var msg; … … 1541 1544 return false; 1542 1545 } 1546 */ 1543 1547 maker_specific_n_qs_by_unit_topic = []; 1544 1548 for (let d of datasets_ds) { … … 1606 1610 let spacer = ''; 1607 1611 let help = ''; 1608 if ( non_default_levels.length) {1612 if (all_levels.length) { 1609 1613 spacer = '<span style="visibility: hidden;">*</span>'; 1610 if (l_selected_levels && l_selected_levels.length > 1) {1611 if ( non_default_levels.length == 1) {1612 title = qqc.T ('Includes additional questions if levelselected below');1613 } else {1614 title = qqc.T ('Includes additional questions if levelsselected below');1614 if (l_selected_levels && l_selected_levels.length > 0) { 1615 if (all_levels.length > 2) { 1616 title = qqc.T ('Includes additional questions if additional levels selected below'); 1617 } else if (all_levels.length > 1) { 1618 title = qqc.T ('Includes additional questions if additional level selected below'); 1615 1619 } 1616 1620 asterisk = '*'; … … 1981 1985 } 1982 1986 } 1983 if (non_default_levels.length) { 1984 let label; 1985 if (non_default_levels.length == 1) { 1986 label = qqc.T ('Include level'); 1987 } else { 1988 label = qqc.T ('Include levels'); 1989 } 1987 if (all_levels.length > 1) { 1988 let label = qqc.T ('Include levels'); 1990 1989 let l_selected_levels = selected_levels[qname + i_qwiz]; 1991 1990 let asterisk = ''; … … 1994 1993 } 1995 1994 htm.push (`<span class="use_dataset_options${blue}">${asterisk} ${label}:</span>`); 1996 for (var level of non_default_levels) {1995 for (var level of all_levels) { 1997 1996 let onclick = `onclick="qwiz_qcards_common.select_level (this, '${level}', '${qname}', ${i_qwiz})"`; 1998 let check_f = l_selected_levels 1999 && l_selected_levels.indexOf (level) != -1; 1997 1998 let check_f = false; 1999 if (l_selected_levels) { 2000 if (l_selected_levels.indexOf (level) != -1) { 2001 check_f = true; 2002 } 2003 } else if (level == qqc.default_level) { 2004 check_f = true; 2005 } 2000 2006 let checked = check_f ? 'checked' : ''; 2001 2007 htm.push (`<label class="use_dataset_options${blue}">`); … … 2036 2042 this.select_level = function (checkbox_el, level, qname, i_qwiz_qdeck) { 2037 2043 var $use_dataset_options_div = qqc.$get_login_div (qname, i_qwiz_qdeck); 2038 selected_levels[qname + i_qwiz_qdeck] = [ ''];2044 selected_levels[qname + i_qwiz_qdeck] = []; 2039 2045 $use_dataset_options_div.find ('input.select_level') 2040 2046 .each (function () { … … 2151 2157 return unit_topic_order; 2152 2158 } 2153 function units_topics_counts (data, non_default_levels, selected_levels) {2159 function units_topics_counts (data, qname, i_qwiz, all_levels, selected_levels) { 2154 2160 var units = data.units; 2155 2161 var topics = data.topics; … … 2188 2194 var unit_topic_class = units[i] + '__' + topics[i]; 2189 2195 unit_topic_class = unit_topic_class.replace (/[^a-z0-9 ]/gi, '_'); 2190 if (levels[i]) { 2191 non_default_levels[levels[i]] = ''; // "set ()". 2192 if (selected_levels.indexOf (levels[i]) == -1) { 2196 if (levels[i] == '') { 2197 all_levels[qqc.default_level] = ''; // "set ()". 2198 if (selected_levels && selected_levels.indexOf (qqc.default_level) == -1) { 2199 continue; 2200 } 2201 } else { 2202 all_levels[levels[i]] = ''; 2203 if (! selected_levels || selected_levels.indexOf (levels[i]) == -1) { 2193 2204 continue; 2194 2205 } … … 2229 2240 var i = unit_topic_order[0] 2230 2241 var skip_f = false; 2231 if (levels[i]) { 2232 non_default_levels[levels[i]] = ''; // "set ()". 2242 if (levels[i] == '') { 2243 all_levels[qqc.default_level] = ''; // "set ()". 2244 } else { 2245 all_levels[levels[i]] = ''; 2233 2246 if (selected_levels.indexOf (levels[i]) == -1) { 2234 2247 skip_f = true; … … 2251 2264 n_unit_cgs, n_cg_by_unit_topic, 2252 2265 n_tot_qs, units_all_other, unit_topics_all_other, 2253 non_default_levels]2266 all_levels] 2254 2267 } 2255 2268 function create_units_topics_correspondence (ounits, otopics) { … … 5593 5606 } 5594 5607 }); 5595 } else {5596 for (let d=0; d<n_datasets; d++) {5597 selected_units[d].push (btoa ('Other'));5598 selected_topics[d].push (btoa ('Other'));5599 }5600 5608 } 5601 5609 if (debug[11]) { … … 7188 7196 } 7189 7197 if (id && id.substr (0, 5) == 'qcard') { 7190 $edit_field.off ('keydown').off ('click'); 7198 if (! qcard_.qwizard_b) { 7199 $edit_field.off ('keydown').off ('click'); 7200 } 7191 7201 var replace_w_space_b = $edit_field[0].tagName.toLowerCase () == 'span'; 7192 7202 $edit_field.on ('click keydown', function (e) { -
qwiz-online-quizzes-and-flashcards/tags/4.05/qwiz_qcards_common.min.js
r3710306 r3722232 1 var document_qwiz_declined_login_b="not ready",document_qwiz_user_logged_in_b="not ready",document_qwiz_wp_user_session_id,document_qwiz_maker_privileges=!1,qjax_bypass="not ready",qwiz_wp_site_url,document_qwiz_remember_f=!1,document_active_qwiz_qdeck="",document_qwiz_username="",document_qwiz_independent_taker_f="",document_qwiz_email="",default_document_qwiz_email_confirm=1,document_qwiz_email_confirm=default_document_qwiz_email_confirm,$dialog_current_password="",$dialog_assign_to_classes="",document_qwiz_class_id="",document_qwiz_school_id=0,document_qwiz_session_id,document_qwiz_login_timeout,document_qwiz_team_b=!1,document_qwiz_mobile_enabled="Always",document_qwiz_mobile="",document_qwiz_bubblebar_enabled_b=!0,document_qwiz_force_mobile_f=!1,document_qwiz_qdeck_maker_ids={},document_qwiz_pay_registration_date_unix=0,document_qwiz_not_logged_in_alerted=!1,document_qwiz_qwiz_html_completed_f,document_qwiz_qdeck_html_completed_f,document_qwiz_preview_i_qwiz,document_qwiz_preview_i_deck,document_qwiz_set_user_menus_and_icons_done="",document_qwiz_good_through_date,document_qwiz_good_through_date_ok,document_qwiz_subscription_id,document_qwiz_immediate_payment,document_qwiz_university_discount;qwiz_qcards_common={};var qwiz_qcards_common_f=function(){var qqc=this,qqcname="qwiz_qcards_common",$=jQuery,init_enter_intercept_f,jjax_script_no=0,head="not ready",server_loc="not ready",secure_server_loc,qwiz_ajaxurl="not ready",plugin_url="",icon_expand_src="not ready",icon_collapse_src,maker_specific_n_qs_by_unit_topic,use_dataset_options_display_name={},progress_bars_leaderboard={},refresh_leaderboard_timeout={},dataset_questions_countdown_timeout={},pay_qwiz_qdeck_,pay_i_qwiz_deck,payment_received_f=!1,register_taker_global_reg_code_ok_f=!1,register_taker_display_pay_screen=!1,register_taker_global_username,register_taker_global_first_name,register_taker_global_last_name,register_taker_global_sha3_password,register_taker_global_username_unique_f,register_taker_global_email_unique_f,register_taker_global_reg_code_maker_id="",register_taker_global_reg_code_school_id="",register_taker_global_reg_code_class_id="",register_taker_global_reg_code_class_name="",register_taker_global_reg_code_school_name="",register_taker_global_reg_code_professor_f="",register_taker_global_in_process_b=!1,provide_feedback_html={},dataset_units_topics_data,units_topics_state={},selected_levels={} ,debug=[];function qjax_callback(js){debug[0]&&console.log("[qjax_callback] js:",js),js&&(js=js.replace(/var /g,""),eval(js))}function check_maker_session_id(){var e=$.cookie("maker_session_id");if(debug[0]&&console.log("[check_maker_session_id] cookie_session_id:",e),e){var t={cookie_session_id:e,callback:"maker_session_id_ok_or_no"};qqc.qjax("qwiz_qcards_common",0,"","check_maker_session_id",t)}else qqc.maker_session_id_ok_or_no()}function get_progress_meter_data(){var e={},t="";if(qwiz_.n_qwizzes){t=[];for(var s=0;s<qwiz_.n_qwizzes;s++){let i=qwiz_.get_qwizdata(s,"qrecord_id");i&&(t.push(i),e[i]=["Q",s])}}var i="";if(qcard_.n_decks){i=[];for(var a=0;a<qcard_.n_decks;a++){let t=qcard_.get_deckdata(a,"qrecord_id");t&&(i.push(t),e[t]=["F",a])}}if(debug[0]&&(console.log("[get_progress_meter_data] qwiz_qrecord_ids:",t),console.log("[get_progress_meter_data] qdeck_qrecord_ids:",i)),t||i){var r={qwiz_qrecord_ids:t,qdeck_qrecord_ids:i,qrecord_id_to_i_qwiz_i_deck:e};qqc.qjax("",0,"","get_progress_meter_data",r)}}function reset_progress_meters(){if(qwiz_)for(var e=0;e<qwiz_.n_qwizzes;e++)qwiz_.set_qwizdata(e,"progress_meter",!1),$(`div.qwiz-progress_meter-qwiz${e}`).hide();if(qcard_)for(var t=0;t<qcard_.n_decks;t++)qcard_.set_deckdata(t,"progress_meter",!1),$(`div.qcard-progress_meter-qdeck${t}`).hide()}debug[0]=!1,debug[5]=!1,debug[7]=!1,debug[9]=!1,debug[10]=!1,debug[11]=!1,debug[12]=!1,debug[13]=!1,$(document).ready((function(){qqc.qdebug(debug),$.cookie&&(document_qwiz_declined_login_b=$.cookie("qwiz_declined_login")),head=document.getElementsByTagName("head")[0],debug[0]&&console.log("[qwiz_qcards_common ready] head:",head);var e=$("a.unit.unit_button"),t=e.html();if(t&&"start course"==t.toLowerCase()){var s=function(){$("div.qwiz_wrapper_fallback").is(":visible")&&qwiz_.qwiz_init(),$("div.qdeck_wrapper_fallback").is(":visible")&&qcard_.qdeck_init()};e.click((function(){setTimeout(s,3e3)}))}})),this.jjax=function(e,t,s,i,a){return qqc.qjax(e,t,s,i,a),!1},this.qjax=function(e,t,s,i,a){if(a||(a={}),a.qname=e,a.i_qwiz=t,a.qrecord_id=s,a.dest=i,a.js_f=1,void 0!==document_qwiz_session_id&&(a.qwiz_session_id=document_qwiz_session_id),debug[0]&&console.log("[qjax] qwizdata:",a),"not ready"==qjax_bypass&&(qjax_bypass=qqc.get_qwiz_param("qjax_bypass","")),qwiz_wp_site_url=qqc.get_qwiz_param("wp_site_url",""),qjax_bypass){var r=qwiz_wp_site_url+"/admin/"+i;debug[0]&&console.log("[qjax] url:",r),$.ajax({type:"POST",url:r,data:a,error:function(s,i,o){var n;console.log("[qjax] XMLHttpRequest:",s,", statusText:",i,", errorThrown:",o),console.log("[qjax] url:",r);var _=s.readyState;-1!=r.indexOf("record")?("qwiz_"==e?$(`span.response_recorded-qwiz${t} img.response_recording`).removeClass("response_recording_spin"):$(`span.response_recorded-qdeck${t} img.response_recording`).removeClass("response_recording_spin"),n=0==_?a.secure_f?"Sorry, unable to record your response. Please try again. Perhaps check your Internet connection?":"Sorry, unable to record your response. Perhaps check your Internet connection?":a.secure_f?"Sorry, unable to record your response. Please try again. If the problem reoccurs, contact support@qwizcards.com":"Sorry, unable to record your response. If the problem reoccurs, please contact support@qwizcards.com"):n=0==_?"Sorry, unable to process request. Perhaps check your Internet connection?":"Sorry, unable to process request. If the problem persists, please contact support@qwizcards.com",alert(n)},success:qjax_callback})}else{"not ready"==qwiz_ajaxurl&&(qwiz_ajaxurl=qqc.get_qwiz_param("ajaxurl",""));var o={action:"qjax"};o.qwizdata=a,$.ajax({type:"POST",url:qwiz_ajaxurl,data:o,success:qjax_callback})}},this.check_session_id=function(e,t){var s=$.cookie("qwiz_session_id");if(debug[0]&&console.log("[check_session_id] cookie_session_id:",s),s){document_qwiz_session_id=s;var i={cookie_session_id:s};t&&(i.register_f=1),debug[0]&&(i.qdebug=1),qqc.qjax("",e,"","check_session_id",i)}else document_qwiz_user_logged_in_b=!1},this.maker_session_id_ok_or_no=function(){if(!qqc.maker_logged_in_b){setTimeout((function(){$("a.teacher_subscriptions").each((function(){var e=$(this),t=e.data("query_string");debug[0]&&console.log("[maker_session_id_ok_or_no]: query_string:",t);const s=qqc.get_qwiz_param("secure_server_loc")+"/maker_login_register"+t;e.attr("href",s)}))}),250)}},this.set_user_menus_and_icons=function(e,t,s){if("doing_quizzes"==s){if(/decks/.test(document_qwiz_set_user_menus_and_icons_done+="quizzes"))return}else if("doing_decks"==s&&/quizzes/.test(document_qwiz_set_user_menus_and_icons_done+="decks"))return;var i="",a="black",r=0,o=function(){if("not ready"!=document_qwiz_user_logged_in_b&&document_qwiz_qwiz_html_completed_f&&document_qwiz_qdeck_html_completed_f){if(!0===document_qwiz_user_logged_in_b){get_progress_meter_data();var t=document_qwiz_maker_privileges?"Teacher logged in as student":"Logged in as";if(i+='<div style="text-align: right;">'+qqc.T(t)+" <strong>"+document_qwiz_username+"</strong></div>",document_qwiz_maker_privileges&&!qwiz_.preview_i_qwiz_plus1&&!qcard_.preview_ideck_plus1){const e="javascript: qwiz_qcards_common.do_preview (i_qwiz, 'qname')";i+='<div class="teacher_preview_qname"><table class="teacher_preview"><tr><td><b>'+qqc.T("Teachers only:")+' </b></td><td style="padding-bottom: 5px;"><a href="'+e+'" title="View this quiz/deck in expanded, all-question display">'+qqc.T("preview this")+' quiz_flashcard_deck</a></td></tr><tr><td></td><td><a href="javascript: qwiz_qcards_common.assign_to_classes (\'qname\', i_qwiz)" title="Assign this quiz_flashcard_deck to your classes">'+qqc.T("assign to classes")+"</a></td></tr></table></div>"}document_qwiz_independent_taker_f?i+='<div><a href="javascript: qname.hide_menu_and_display_login (i_qwiz, false, \'enroll\')" title="You are currently registered as an independent student. If you have a registration code you can join a class">'+qqc.T("Enroll in a school/class")+"</a></div>":document_qwiz_wp_user_session_id||(i+='<div><a href="javascript: qname.hide_menu_and_display_login (i_qwiz, true)">'+qqc.T("Add team member")+"</a></div>"),"not ready"==server_loc&&(server_loc=qqc.get_qwiz_param("server_loc","http://qwizcards.com/admin")),i+='<div><a href="'+server_loc+"/index?student_view=1&time="+document_qwiz_session_id+'" target="_blank">'+qqc.T("My scores")+"</a></div>",i+="leaderboard",i+="</nobr></div>",document_qwiz_wp_user_session_id||(i+='<div><a href="javascript:'+qqcname+'.my_account ()" title="'+qqc.T("View/edit login name, password, ...")+'">'+qqc.T("My account - settings")+"</a></div>"),i+='<div><a href="javascript: qname.hide_menu_and_display_login (i_qwiz, false, \'feedback\')" title="'+qqc.T("Report errors/bugs, comment, make suggestions...")+'">'+qqc.T("Feedback")+"</a></div>",document_qwiz_wp_user_session_id||(i+="<div>"+qqc.T("Not")+" "+document_qwiz_username+"? <a href=\"javascript: qwiz_qcards_common.sign_out (false, false, 'qname', i_qwiz)\">"+qqc.T("Sign out")+"</a></div>"),a=document_qwiz_maker_privileges?"#00b8ff":"#20a020",$("div.qwiz-usermenu_icon").removeClass("qwiz-icon-bounce")}else document_qwiz_wp_user_session_id?i+="<b>Authentication expired. Please re-load this page to record your work</b>":(reset_progress_meters(),i+='<br /><div><nobr><a href="javascript: qname.hide_menu_and_display_login (i_qwiz)"><strong>'+qqc.T("Log in")+"</strong> "+qqc.T("to record/get credit")+"</a></nobr></div>",i+='<div> <span class="qwiz-remember" title="'+qqc.T("Skip login in the future")+'"><label class="qwiz_label"><span class="qwiz-remember"><input type="checkbox" /> '+qqc.T("Remember")+'</span></label></span> <a href="javascript: qname.icon_no_login (i_qwiz)"><strong>'+qqc.T("No thanks")+"</strong></a></div>",i+="leaderboard","not ready"==document_qwiz_declined_login_b&&(document_qwiz_declined_login_b=$.cookie("qwiz_declined_login")),e||document_qwiz_declined_login_b||($("div.qwiz-usermenu_icon_no_intro").addClass("qwiz-icon-bounce"),$("div.qwiz-usermenu_icon").addClass("qwiz-icon-bounce")));const r='<div class="qwiz_leaderboard_link"><a href="javascript: qwiz_.hide_menu_and_display_login (i_qwiz, false, \'leaderboard\')">'+qqc.T("Fastest finish times")+"</a></div>";var s=i.replace(/qname/g,"qwiz_").replace(/quiz_flashcard_deck/g,"quiz");$("div.qwiz-usermenu").each((function(){const e=$(this).attr("id").substr(13);var t="";qwiz_.get_qwizdata(e,"qwiz_timer")&&(t=r),$(this).html(s.replace("leaderboard",t).replace(/i_qwiz/g,e))}));var n=i.replace(/qname/g,"qcard_").replace(/quiz_flashcard_deck/g,"deck").replace("leaderboard","");$("div.qdeck-usermenu").each((function(){const e=$(this).attr("id").substr(14);$(this).html(n.replace(/i_qwiz/g,e))})),$("div.qwiz-usermenu_icon").css({display:"block",color:a}),$qscores=$("span.qscores"),$qscores.length&&qqc.set_qscore_menus($qscores)}else debug[0]&&console.log("[set_user_menus_and_icons] n_tries:",r),++r<20?setTimeout(o,"250"):console.log("[set_user_menus_and_icons] document_qwiz_user_logged_in_b not set");!0!==document_qwiz_user_logged_in_b&&$("div.qwiz_progress_meter").hide()};o()},this.set_progress_meters=function(e){if(debug[0]&&console.log("[set_progress_meters] data:",e),!e)return;const t=e.n_questions_by_qrecord_id;qqc.question_card_ids_by_qrecord_id=e.question_card_ids_by_qrecord_id;const s=e.qrecord_id_to_i_qwiz_i_deck,i=e.qrecord_id_oks;for(var[a,r]of Object.entries(t)){const e=s[a],t=e[0],_=e[1];let c=!0;1==document_qwiz_school_id||document_qwiz_maker_privileges||(c=i[a]);var o=5;r>150?o=0:r>100?o=1:r>10?o=2:r>4&&(o=3);let d=0;var n;if(qqc.question_card_ids_by_qrecord_id[a]&&(d=qqc.question_card_ids_by_qrecord_id[a].length),"Q"==t){n=$(`div.qwiz-progress_meter-qwiz${_}`),qwiz_.set_qwizdata(_,"progress_meter",!0),d&&qwiz_.set_qwizdata(_,"progress_meter_previous",!0);const e=parseFloat($(`#qwiz${_}`).css("border-width"));n.css({top:-e-7+"px",left:-e+"px",width:'calc(100% + 2*quiz_border_width + "px")'})}else n=$(`div.qcard-progress_meter-qdeck${_}`),qcard_.set_deckdata(_,"progress_meter",!0),d&&qcard_.set_deckdata(_,"progress_meter_previous",!0);const l=n[0];let u="";1==document_qwiz_school_id||document_qwiz_maker_privileges||("not in a class"==c||"no credit"==i[a])&&(u=c),u?n.css({"--dash-bg":"rgb(255, 233, 192)","--dash-border":"rgb(255, 165, 0)"}):n.css({"--dash-bg":"","--dash-border":""}),l.qrecord_id_not_ok=u,"Q"==t?qwiz_.set_qwizdata(_,"qrecord_id_not_ok",u):qcard_.set_deckdata(_,"qrecord_id_not_ok",u),n.css({"--n":r,"--m":d,"--gap":o+"px"}),qqc.init_progress_meter(l),l.previous_n_correct=d>0}},this.mb_strcut=function(e,t){const s=(new TextEncoder).encode(e);if(s.length<=t)return e;const i=s.slice(0,t),a=new TextDecoder("utf-8",{fatal:!1}).decode(i).replace(/\uFFFD$/g,"");return debug[0]&&console.log("[mb_strcut] return_str:",a),a},this.mb_substr=function(e,t){return Array.from(e).slice(0,t).join("")},this.update_progress_meter=function(e){const t=getComputedStyle(e),s=parseInt(t.getPropertyValue("--n"),10)||0,i=Math.max(0,Math.min(parseInt(t.getPropertyValue("--m"),10)||0,s)),a=parseInt(t.getPropertyValue("--gap"),10)||0;if(e.innerHTML="",s<=0)return;const r=/qwiz/.test(e.className);e.innerHTML=r?'<div class="progress_meter_overlay"></div>':'<div class="qcard-progress_meter_overlay"></div>';var o="";const n=e.qrecord_id_not_ok;if("not in a class"==n)o="You are not in a class. To get credit, enroll in a class (green down-triangle menu). ";else if("no credit"==n){o=`This ${r?"quiz":"flashcard deck"} is not assigned as work you need to do. `}const _=e.previous_n_correct?"("+qqc.T("including previous work")+")":"";o+=r?`${i} ${qqc.T("correct")} / ${s} ${qqc.T("questions")} ${_}`:`${i} ${qqc.T('"Got-its"')} / ${s} ${qqc.T("cards")} ${_}`,e.title=o;const c=document.createDocumentFragment(),d=s-1;for(let e=0;e<s;e++){const t=document.createElement("div");let s="dash"+(e<i?" filled":"");0==a&&(s+=0==e?" border-left":e==d?" border-right":" border-top-bottom"),t.className=s,c.appendChild(t)}e.appendChild(c)},this.init_progress_meter=function(e){qqc.update_progress_meter(e),e.style.display="flex";new MutationObserver((e=>{for(const t of e)"attributes"===t.type&&"style"===t.attributeName&&qqc.update_progress_meter(t.target)})).observe(e,{attributes:!0})},this.my_account=function(){var e=server_loc+"/my_account?time="+document_qwiz_session_id;if(document_qwiz_good_through_date){e+="&good_through_date="+DateFormat.format.date(Date.parse(document_qwiz_good_through_date),"MMMM d, yyyy")}window.open(e,"my_account")};var do_preview_form=!1,assign_to_classes_data;function deassign_class_from_quiz(e){debug&&(console.log("[deassign_class_from_quiz] e.params.data:",e.params.data),console.log("[deassign_class_from_quiz] e.params.data.element.value:",e.params.data.element.value));const t={class_id:e.params.data.element.value,class_name:e.params.data.element.text,i_row:0,callback:"qwiz_qcards_common.assign_to_classes_updated"};qqc.qjax("",0,assign_to_classes_data.qrecord_id,"delete_class_from_qwiz_qdeck",t)}function add_class_to_qwiz_qdeck(e){debug&&(console.log("[add_class_to_qwiz_qdeck] e.params.data:",e.params.data),console.log("[add_class_to_qwiz_qdeck] e.params.data.element.value:",e.params.data.element.value));const t={class_id:e.params.data.element.value,class_name:e.params.data.element.text,i_row:0,callback:"qwiz_qcards_common.assign_to_classes_updated"};qqc.qjax("",0,assign_to_classes_data.qrecord_id,"add_class_to_qwiz_qdeck",t)}function set_pay_unlock_menu(e,t,s,i,a,r,o,n,_){var c,d,l,u="";"qwiz_"==e?(c="quiz",d="qwiz",l="qwiz_"):(c="flashcard deck",d="qdeck",l="qcard_"),u+='<div class="pay_preview_status">'+i+"</div>";var p=!1;if(!0===document_qwiz_user_logged_in_b){if("paid"!=get_qwizdeckdata(e,t,"pay_quiz_ok"))if(r.length){u+=a+r.join("");var g=o?"Sign up":"Pay now";u+='<a href="javascript: '+e+".hide_menu_and_display_login ("+t+", false, 'pay', '', 0, '"+g+'\')" class="qwiz_pay_unlock_menu_pay_now">'+g+"</a>"}else u+=1==document_qwiz_school_id?"Please contact the maker of this "+c+": they need to provide an individual-student payment option for you":"Please talk to your teacher: they need to provide access to this "+c+" for you"}else if(!s){var h="?url="+encodeURIComponent(qqc.get_qwiz_param("url","./"))+"&qname="+l+"&i_qwiz="+t;qqc.get_qwiz_param("secure_server_loc");if(u+=`<div><b>Students in a teacher’s class</b>: Use your teacher’s registration code to <a href="javascript: qwiz_qcards_common.pay_unlock_menu_display_login ('${e}', ${t}, 'register')" class="qwiz_login">`+qqc.T("register")+"</a>. ",r.length&&(u+="<br />"+a+r.join(""),!o)){u+=`<a href="javascript: qwiz_qcards_common.pay_unlock_menu_display_login ('${e}', ${t}, 'register', '${"Please register so you can get credited for your payment"}')" class="qwiz_login qwiz_pay_unlock_menu_pay_now">\n Pay now\n </a>`}if(u+="</div>",n.length&&(u+="<div><b>Teachers</b>: "+n.join("<br />"),_)){qqc.maker_logged_in_b||(p=!0);u+='<br /><a href="'+("javascript: "+e+".hide_menu_and_display_login ("+t+", false, 'maker_pay')")+'" class="teacher_subscriptions qwiz_login" data-query_string="'+h+'" target="_blank">Teacher subscriptions</a>'}u+="</div>"}return $("div#pay_unlock_menu-"+d+t).html(u),p}this.do_preview=function(e,t){if(!do_preview_form){var s=[];s.push('<form name="do_preview" target="_blank">'),s.push('<input type="hidden" name="qwizmin">'),s.push("</form>"),$("body").append(s.join("\n")),do_preview_form=!0}const i="qwiz_"==t?"qwiz":"deck";$.cookie(i+"_preview",e,{path:"/"}),$.cookie("qwiz_preview_username",document_qwiz_username,{path:"/"});const a=document.forms.do_preview,r=document.location.href,o=document.location.search.match(/qwizmin=(\d)/);o&&(a.qwizmin.value=o[1]),a.action=r,a.submit()},this.assign_to_classes=function(e,t){var s;s="qwiz_"==e?$("div#qwiz"+t).attr("qrecord_id"):$("div.qcard_card-qdeck"+t+" div.qcard-front").attr("qrecord_id");qqc.qjax(e,t,s,"assign_to_classes",{modal:1})},this.dialog_assign_to_classes=function(e){if(debug[0]&&console.log("[dialog_assign_to_classes] data:",e),e.errmsg)return void alert(e.errmsg);if(assign_to_classes_data=e,!$dialog_assign_to_classes){var t=[];t.push('<div id="dialog_assign_to_classes" title="Assign quiz/flashcard deck to classes">'),t.push('<div id="assign_to_classes_feedback_msg">'),t.push(" "),t.push("</div>"),t.push('<h3 class="assign_to_classes qwiz_display_none">'),t.push('Assign <span id="assign_to_classes_quiz_flashcard_deck"></span> to classes'),t.push("</h3>"),t.push('<div id="assign_to_classes_select">'),t.push("</div>"),t.push("<br />"),t.push('<h3 class="assign_to_classes qwiz_display_none">'),t.push('Set <span id="assign_to_classes_assignment_due"></span> date'),t.push("</h3>"),t.push('<input id="assign_to_classes_assignment_date" class="qwiz_display_none" type="date" onchange="qwiz_qcards_common.update_assignment_date (this)" />'),t.push("</div>"),$("body").append(t.join("\n")),$dialog_assign_to_classes=$("div#dialog_assign_to_classes").dialog({autoOpen:!1,width:600,height:600,modal:!0,resizable:!1,buttons:{Close:function(){$dialog_assign_to_classes.dialog("close")}}})}const s={class_id:"all",maker_id:e.maker_id,callback:"qwiz_qcards_common.assign_to_classes_set_quizzes_decks"};qqc.qjax(e.qname,0,e.qrecord_id,"get_quizzes_decks",s)},this.assign_to_classes_set_quizzes_decks=function(e){debug[0]&&console.log("[assign_to_classes_set_quizzes_decks] data:",e);const t="qwiz_"==assign_to_classes_data.qname?"quiz":"flashcard deck";var s=[];if(0==e.class_ids_assigned_to_qwiz.length){const e=assign_to_classes_data.qrecord_id.replace(/sciencemusicvideosMeister1961-/,"");s.push("<b>Sorry, this "+t+", “"+e+"”, has not been made available to you for use in your classes."),s.push("<br />"),s.push("<br />"),s.push("You will have to contact the "+t+" owner/creator and ask them to provide it to you.</b>"),$("div#assign_to_classes_select").html(s.join("\n"))}else{s.push('<select id="class_select" multiple="multiple">');const n=assign_to_classes_data.class_ids,_=assign_to_classes_data.class_names,c=assign_to_classes_data.deleted_fs,d=n.length;for(var i=!1,a=0;a<d;a++)if(!c[a]){var r="";-1!=e.class_ids_assigned_to_qwiz[0].indexOf(n[a])&&(r=" selected",i=!0),s.push('<option value="'+n[a]+'"'+r+">"),s.push(_[a]),s.push("</option>")}s.push("</select>"),i&&(s.push("<br />"),s.push('<span style="font-size: 8pt; color: gray;">'),s.push("Click in the box for options dropdown"),s.push("</span>")),$("div#assign_to_classes_select").html(s.join("\n")),$("h3.assign_to_classes").removeClass("qwiz_display_none"),$("span#assign_to_classes_quiz_flashcard_deck").html(t+" “"+e.display_names[0]+"”");var o=$("select#class_select");o.select2({placeholder:"Select...",width:"250px"}),o.on("select2:unselect",deassign_class_from_quiz),o.on("select2:select",add_class_to_qwiz_qdeck);const l=e.assignment_due?"due":"assignment";if($("span#assign_to_classes_assignment_due").html(l),$("input#assign_to_classes_assignment_date").removeClass("qwiz_display_none"),void 0!==e.assignment_dates[0]){const t=DateFormat.format.date(1e3*e.assignment_dates[0],"yyyy-MM-dd");$("input#assign_to_classes_assignment_date").val(t)}}$dialog_assign_to_classes.dialog("open")},this.update_assignment_date=function(e){var t=e.value;if(!t)return void $("div#assign_to_classes_feedback_msg").html('<span class="qwiz_errmsg">Please enter a valid date</span>');t=Date.parse(t+"T00:00")/1e3;const s={qrecord_ids:[assign_to_classes_data.qrecord_id],field:"assignment_date",value:t,callback:"qwiz_qcards_common.assign_to_classes_updated"};qqc.qjax("",0,assign_to_classes_data.qrecord_id,"update_quiz_deck",s)},this.assign_to_classes_updated=function(e){var t,s=DateFormat.format.date((new Date).getTime(),"h:mm:ss");t=e.affected_rows>=1?"Database updated "+s:'<span class="qwiz_red">Sorry, unable to update database</span>',$("div#assign_to_classes_feedback_msg").html(t)},this.request_assign_to_class=function(e){var t,s,i;e?(t="qwiz_",s=qwiz_.assign_to_class_i_qwiz,i=qwiz_.assign_to_class_qrecord_id):(t="qcard_",s=qcard_.assign_to_class_i_deck,i=qcard_.assign_to_class_qrecord_id,document_qwiz_qdeck_maker_ids["qdeck"+s]);const a=document_qwiz_school_id,r=document_qwiz_taker_id,o=window.location.href,n={taker_username:document_qwiz_username,school_id:a,taker_id:r,page_url:o};plugin_url||(plugin_url=qqc.get_qwiz_param("url","./"));const _='<img src="'+plugin_url+'images/spinner16x16.gif" />';$("div#"+t+"request_assign_to_class_feedback").html(_),qqc.qjax(t,s,i,"request_assign_to_class",n)},this.do_not_show_assign_to_class=function(e){const t=document_qwiz_username+"do_not_show_assign_to_class";if(e.checked){const e={expires:7};$.cookie(t,1,e)}else $.removeCookie(t)},this.pay_unlock_menu_display_login=function(e,t,s,i,a,r){var o,n;"qwiz_"==e?(o="qwiz",n=qwiz_):(o="qdeck",n=qcard_);var _=$("div.qwiz_icon_and_menu_container."+o+t);_.css({"z-index":"-1"}),n.display_login(t,!1,s,i,a,r);setTimeout((function(){_.css({"z-index":""})}),100)},this.sign_out=function(e,t,s,i){var a={session_id:document_qwiz_session_id,table:"session_id"};if(qqc.qjax("",-1,"","delete_session_id",a),$.removeCookie("qwiz_session_id",{path:"/"}),document_qwiz_user_logged_in_b=!1,document_qwiz_maker_privileges=!1,document_qwiz_session_id="",document_qwiz_username="",document_qwiz_independent_taker_f="",document_qwiz_email="",document_qwiz_email_confirm=default_document_qwiz_email_confirm,document_qwiz_school_id=0,document_qwiz_team_b=!1,document_qwiz_good_through_date="",document_qwiz_good_through_date_ok=!1,document_qwiz_university_discount=!1,s){setTimeout((function(){var e=qwiz_deck_selector(s,i);$(e+"input.register_taker_username").val("")}),50)}qqc.set_user_menus_and_icons(!e,t),qwiz_&&qwiz_.any_pay_quiz_f&&qwiz_.pay_lock_settings(),qcard_&&qcard_.any_pay_deck_f&&qcard_.pay_lock_settings(),document_qwiz_pay_registration_date_unix=0;const r=set_display_pay_screen(s,i),o="qwiz_"==s?qwiz_:qcard_;"open_register"==r?o.hide_menu_and_display_login(i,!1,"open_register","",!1):"free_trial"==r?o.hide_menu_and_display_login(i,!1,"free_trial","",!0):"register"==r&&o.hide_menu_and_display_login(i,!1,"register","",!1)},this.usermenu_pay=function(e,t){"qwiz_"==e?$("div.qwiz-progress-container.qwiz"+t).find("a.qwiz_pay_unlock_menu_pay_now")[0].click():$("div#qcard_progress-qdeck"+t).find("a.qwiz_pay_unlock_menu_pay_now")[0].click()},this.set_qscore_menus=function(e){var t;"not ready"==server_loc&&(server_loc=qqc.get_qwiz_param("server_loc"),secure_server_loc=qqc.get_qwiz_param("secure_server_loc")),!0===document_qwiz_user_logged_in_b?(t='<a href="'+secure_server_loc+"/index.php?student_view=1&time="+document_qwiz_session_id+'" target="_blank">',t+=qqc.T("View scores")):(t='<a href="'+secure_server_loc+'/student_login.php" target="_blank">',t+=qqc.T("Login/View scores")),t+="</a>",e.html(t)},this.create_progress_bars=function(e,t,s,i){progress_bars_leaderboard[e+s]=i,plugin_url||(plugin_url=qqc.get_qwiz_param("url","./"));var a='<img src="'+(plugin_url+"images/spinner40x40.gif")+'" class="qwiz-center" style="margin-top: 100px;" />';e&&qqc.$get_login_div(e,s).html(a).show();if(!0!==document_qwiz_user_logged_in_b){var r={not_logged_in_f:1,qname:e,i_qwiz_qdeck:s,qrecord_id:t[s].qrecord_id};return qqc.create_progress_bars3(r),!1}if(t[s].record_start_b&&!0===document_qwiz_user_logged_in_b){t[s].record_start_b=!1;var o=(new Date).getTime()/1e3,n=(r={qrecord_id_ok:t[s].qrecord_id_ok,type:"start",now_sec:o,callback:"create_progress_bars2"},"qwiz_"==e?"record_response_v4":"record_qcard_v3");qqc.qjax(e,s,t[s].qrecord_id,n,r)}else qqc.create_progress_bars2(e,s,t[s].qrecord_id)},this.create_progress_bars2=function(e,t,s){var i;if(document_qwiz_independent_taker_f&&(document_qwiz_class_id="independent_student"),i=get_qwizdeckdata(e,t,"use_dataset")){if(/\|\s*unit:/.test(i))var[i,a,r]=qqc.parse_use_dataset(i);else var a=[],r=[];get_dataset_units_topics(e,t,s,i,a,r,"create_progress_bars3")}else{var o,n;if("qwiz_"==e)n=qwiz_.get_qwizdata(t,"n_questions"),o=qwiz_.get_qwizdata(t,"n_correct");else o=(n=qcard_.get_deckdata(t,"n_cards"))-qcard_.get_deckdata(t,"n_to_go");var _={qname:e,i_qwiz_qdeck:t,qrecord_id:s,units:[""],n_correct_by_unit_topic:[o],n_questions_by_unit_topic:[n]};qqc.create_progress_bars3(_)}};var leaderboard_refresh_sec=0,update_email_data,enroll_reg_code_ok_f,enroll_reg_code_school_id,enroll_reg_code_school_name,enroll_reg_code_class_id,enroll_reg_code_class_name,global_data_urls,global_blob_urls,number_word,ordinal_words;function record_units_topics_state(e,t){var s=qqc.$get_login_div(e,t),i=[];s.find("img.expand_collapse_unit.collapse").each((function(){var e=$(this).parents("tr.unit_head")[0].id.match(/\d+$/)[0];i.push(e)}));var a=!1,r=[],o=[];s.find('table.dataset_units_topics input[type="checkbox"]').each((function(){if(this.checked)if(this.id){var e=this.id.match(/\d+$/)[0];o.push(e)}else{var t=$(this).parents("tr.unit_head");if(t.length){var s=t[0].id.match(/\d+$/)[0];r.push(s)}else a=this.checked}}));const n={i_units_expanded:i,table_head_checked:a,i_units_checked:r,i_topics_checked:o};debug[0]&&console.log("[record_units_topics_state] state:",n),units_topics_state[e+t]=n}function restore_units_topics_state(e,t){var s=units_topics_state[e+t];if(s){debug[0]&&console.log("[restore_units_topics_state] state:",s);var i=qqc.$get_login_div(e,t),a=s.i_units_expanded;i.find("img.expand_collapse_unit").each((function(){let e=$(this);var t=e.parents("tr.unit_head")[0].id.match(/\d+$/)[0];-1!=a.indexOf(t)&&e.trigger("click")})),i.find('table.dataset_units_topics input[type="checkbox"]').each((function(){this.checked=!1}));var r=s.i_units_checked,o=s.i_topics_checked;i.find('table.dataset_units_topics input[type="checkbox"]').each((function(){if(this.id){var e=this.id.match(/\d+$/)[0];-1!=o.indexOf(e)&&(this.checked=!0)}else{var t=$(this).parents("tr.unit_head");if(t.length){var i=t[0].id.match(/\d+$/)[0];-1!=r.indexOf(i)&&(this.checked=!0)}else this.checked=s.table_head_checked}}))}else debug[0]&&console.log("[restore_units_topics_state] (not available)")}function units_topics_sort(e,t){var s=[];const i=e.length;for(var a=0;a<i;a++)s.push([a,qqc.create_sortable_unit_number(e[a]),qqc.create_sortable_unit_number(t[a])]);s.sort(firstBy(1).thenBy(2));var r=[];for(a=0;a<i;a++)r.push(s[a][0]);return r}function units_topics_counts(e,t,s){var i=e.units,a=e.topics,r=e.levels,o=e.n_questions_by_unit_topic,n=e.n_correct_by_unit_topic,_=i.length,c=units_topics_sort(i,a),d=[],l=[],u={},p={},g={},h={},q=!0,m={},f=0,w=i[_-1];w||(w="Other");for(var b=0,v=0,k=0,z="",y=_-1;y>=0;y--){const e=c[y],_=parseInt(o[e],10),T=null===n[e]?0:parseInt(n[e],10);i[e]||(i[e]="Other"),a[e]||(a[e]="Other");var $=i[e]+"__"+a[e];if($=$.replace(/[^a-z0-9 ]/gi,"_"),!r[e]||(t[r[e]]="",-1!=s.indexOf(r[e]))){if(p[$]||(p[$]=0,g[$]=0),p[$]+=_,g[$]+=T,i[e]!=w){var x=w.replace(/[^a-z0-9 ]/gi,"_");u[x]=b,h[x]=v,"Other"!=w&&(q=!1),m[x]=0==k,b=0,v=0,k=0,w=i[e]}b+=_,v+=T,f+=_,$!=z&&("Other"!=a[e]&&k++,d.push(i[e]),l.push(a[e]),z=$)}}if(_){var T=c[0],S=!1;if(r[T]&&(t[r[T]]="",-1==s.indexOf(r[T])&&(S=!0)),!S){var j=i[T].replace(/[^a-z0-9 ]/gi,"_");u[j]=b,h[j]=v,"Other"!=i[T]&&(q=!1),m[j]=0==k}}return[d,l,_=d.length,c=units_topics_sort(d,l),u,p,h,g,f,q,m,t]}function create_units_topics_correspondence(e,t){for(var s=e.length,i=[],a=[],r=[],o=0,n=0;n<s;n++){var _=e[n].length;r.push(_);for(var c=[],d=[],l=0;l<_;l++){var u=e[n][l].replace(/\.{0,1}([a-z])/i," $1").replace(/[-_]/g," ").replace(/s /g," ").replace(/s$/,""),p=t[n][l].replace(/\.{0,1}([a-z])/i," $1").replace(/[-_]/g," ").replace(/s /g," ").replace(/s$/,"");c.push(u),d.push(p)}i.push(c),a.push(d),_>o&&(o=_)}var g=[];const h=i[0].length;for(n=1;n<s;n++){g.push([]);var q=0,m=3,f=0;const e=i[n].length;for(l=0;l<h;l++){for(var w=!1,b=q;b<m&&!(f+b>=e);b++){if(units_topics_correspondence_twoway_comparison(i[0][l],a[0][l],i[n][f+b],a[n][f+b])){if(b<0&&-1!=g[n-1].indexOf(f+b)){debug[13]&&console.log("[create_units_topics_correspondence] (already used) j + jj:",f+b);continue}g[n-1].push(f+b),w=!0,debug[13]&&(console.log(`[create_units_topics_correspondence] Match: ${i[0][l]} | ${a[0][l]} (i=${l})`),console.log(` ${i[n][f+b]} | ${a[n][f+b]} (j=${f+b})`)),q=b>0?-b:b,m=3,f+=b+1;break}}w||(g[n-1].push(-1),debug[13]&&console.log(`[create_units_topics_correspondence] No match to ${i[0][l]} | ${a[0][l]} (i=${l})`),m++)}}if(debug[13]){console.log("[create_units_topics_correspondence] datasets_matches:",g);var v,k=[]}var z="",y=(f=new Array(s-1).fill(0),[]);for(n=0;n<s;n++)y.push([]);for(l=0;l<r[0];l++){(u=e[0][l])!=z&&(debug[13]&&k.push("UNIT "+u),z=u);var $=t[0][l];y[0].push(l),debug[13]&&(k.push([$]),v=k.length-1);var x=[],T=["NA"];for(n=0;n<s-1;n++){for(x.push(-1),(b=g[n][l])>=0&&(y[n+1].push(b),debug[13]&&k[v].push(t[n+1][b]));;){if(b==f[n]){f[n]++;break}if(b<0){y[n+1].push(-1),debug[13]&&k[v].push("NA");break}if(-1==g[n].indexOf(f[n])){if(x.push(f[n]),T.push(t[n+1][f[n]]),n==s-2){for(var S=0;S<s;S++)y[S].push(x[S]);debug[13]&&k.push(T)}f[n]++;break}f[n]++}}}if(debug[13]&&console.log("[create_units_topics_correspondence] lines:",k),debug[0]){k=[];for(_=y[0].length,l=0;l<_;l++){k.push([]);for(n=0;n<s;n++){(b=y[n][l])>=0?k[l].push(t[n][b]):k[l].push("NA")}}console.log("[create_units_topics_correspondence] display_line_to_dataset_j: ",y),console.log("[create_units_topics_correspondence] lines:",k)}return y}function units_topics_correspondence_twoway_comparison(e,t,s,i){const a=.69;var r=!1;return(units_topics_correspondence_com_score(e,s)>a||units_topics_correspondence_com_score(s,e)>a)&&(units_topics_correspondence_com_score(t,i)>a||units_topics_correspondence_com_score(i,t)>a)&&(r=!0),r}function units_topics_correspondence_com_score(e,t){s1s=e.split(/\s+/);var s=0;for(var i of s1s)e.includes(i)&&(/[a-z]/i.test(i)?s+=1:s+=.3);var a=0;for(var i of s1s)t.includes(i)&&(/[a-z]/i.test(i)?a+=1:a+=.3);return cscore=a/s,debug[13]&&(console.log("[units_topics_correspondence_twoway_comparison] s1:",e),console.log("[units_topics_correspondence_twoway_comparison] s2:",t),console.log("[units_topics_correspondence_twoway_comparison] cscore:",cscore.toFixed(2))),cscore}function get_dataset_units_topics(e,t,s,i,a,r,o){var n="";void 0!==document_qwiz_session_id&&(n=document_qwiz_session_id);var _={qname:e,i_qwiz_qdeck:t,dataset:i,units:a,topics:r,qwiz_session_id:n};o&&(_.callback=o),debug[0]&&(_.qdebug=1),qqc.qjax(e,t,s,"get_dataset_units_topics",_)}function get_combo_units_topics(e,t,s,i,a,r,o){var n="";void 0!==document_qwiz_session_id&&(n=document_qwiz_session_id);var _={qname:e,i_qwiz_qdeck:t,dataset:i,units:a,topics:r,qwiz_session_id:n};o&&(_.callback=o),debug[0]&&(_.qdebug=1),qqc.qjax(e,t,s,"get_combo_units_topics",_)}function subscription_plan_data(e,t){var s,i,a=qqc.set_immediate_payment(e,t);const r="05-04",o=parseInt(r.split("-")[0])-1,n=parseInt(r.split("-")[1]),_=1e3*qqc.get_qwiz_param("current_time_unix"),c=DateFormat.format.date(_,"yyyy"),d=DateFormat.format.date(_,"MM-dd"),l=new Date(parseInt(c),o-2,n).getTime(),u=DateFormat.format.date(l,"MM-dd"),p=new Date(parseInt(c),o-1,n).getTime(),g=DateFormat.format.date(p,"MM-dd");var h=!1;return!a&&d>=r?(s="P-19D295110R601454BM5XCHMY",i=29.95):!a&&d<u?(s="P-62Y81532P85606323NFP47AA",i=39.95):!a&&d<g?(s="P-2J818600MG931162NNGEM3DY",i=49.95,h=!0):(a=!0,s="P-4MH87306J1361740NNGEM5BY",i=49.95),["AdMvaQesYKbCDS3vl8-_Td2bmsnVdwrPl3jbkMzefr3RUZIsmK8BHwUZxEfg_f2m2jfmLJwh4-iEikTC",s,i,a,o,n,h]}function resize_feedback_images(e){$(e).find("img").each((function(){if(!this.qwiz_sizing){var e,t=$(this),s=parseInt(t.parents("div.qwiz-provide_feedback").width()),i=parseInt(t.width());debug[0]&&console.log("[resize_feedback_images] img_width:",i,", container_width:",s),e=i==s?1:1/window.devicePixelRatio;var a=parseInt(i*e),r=parseInt(t.height()*e);t.css({cssText:"border: 1px solid gray !important",width:a+"px",height:r+"px",margin:"0 5px 5px 0",float:"left"}),this.qwiz_sizing=1}}))}function submit_feedback2(e,t,s,i,a){if(a){debug[0]&&console.log("[submit_feedback2] global_data_urls[0].substr (0, 50):",global_data_urls[0].substr(0,50));for(var r=a.length,o=0;o<r;o++)i=i.replace(a[o],'<img src="'+global_data_urls[o]);debug[0]&&console.log("[submit_feedback2] feedback_html.length:",i.length)}var n,_,c,d;if("qwiz_"==e?(n="div#qwiz"+t,_="qwiz",c=qwiz_.get_qwizdata,d=$("div.header-qwiz"+t).html()):(n="div.qcard_card-qdeck"+t,_="qdeck",c=qcard_.get_deckdata,d=$("div#qcard_header-qdeck"+t).html()),provide_feedback_html[n]=i,i.length>25e6)return alert("Sorry, your feedback is too big (large images). Please use smaller/fewer images."),!1;var l=c(t,"qrecord_id"),u=document_qwiz_qdeck_maker_ids[_+t],p={feedback_html:i,page_url:window.location.href,user_agent:navigator.userAgent,qwiz_qcard:n,qname:e,header_html:d,i_qwiz:t,i_question:s,maker_id:u,taker_username:document_qwiz_username,taker_email:document_qwiz_email};qqc.jjax(e,t,l,"receive_feedback",p)}function qwiz_deck_selector(e,t){return("qwiz_"==e?"div#qwiz"+t:"div.qcard_card-qdeck"+t)+" "}function set_display_pay_screen(e,t){var s;return s=get_qwizdeckdata(e,t,"display_pay_screen"),debug[0]&&console.log("[set_display_pay_screen] i_qwiz_deck:",t,", display_pay_screen:",s),s}function register_taker_open_register_pay_feedback(e,t){htm.push("<p>"),htm.push("Thanks. "),htm.push("</p>"),qqc.$get_login_div(e,t).html(htm.join("\n")).show()}function register_taker_registered_feedback(e,t,s,i){debug[0]&&(console.log("[register_taker_registered_feedback] qname:",e),console.log("[register_taker_registered_feedback] proceed_to_pay_f:",i));var a="";"qwiz_"==e&&(a=get_qwizdeckdata(e,t,"display_pay_screen"));var r=[];if(i)if("free_trial"==a)document_qwiz_good_through_date_ok=!0;else{if(/register/.test(a)){qwiz_.pay_lock_settings();return setTimeout((function(){qwiz_.display_login(t,!1,"pay","")}),500),!1}"qwiz_"==e?qwiz_.display_login(t,!1,"pay","",1):qcard_.display_login(t,!1,"pay","",1)}else{if(s){plugin_url||(plugin_url=qqc.get_qwiz_param("url","./"));const e=plugin_url+"images/spinner40x40.gif";r.push('<img src="'+e+'" class="qwiz-center" style="margin-top: 70px;" />'),r.push("<p>"),r.push("You are now logged in so that your work can be recorded. "),r.push("In the future, use the pull-down triangle at the top right of any quiz or deck to log in."),r.push("</p>"),r.push("<p>"),r.push("The green triangle also gives you a menu option to view your scores."),r.push("</p>"),r.push("<p>")}else r.push("<br />"),r.push("<br />"),r.push("<p>"),r.push("<b>Thank you. You are now registered for class "+register_taker_global_reg_code_class_name+", "+register_taker_global_reg_code_school_name+"</b>"),r.push("</p>"),r.push("<p>"),r.push("When you do a quiz or flashcard deck, be sure to log in (under the"),r.push("pull-down triangle icon at the top right of any quiz or deck)."),r.push("</p>"),a||(i=register_taker_global_reg_code_ok_f?0:1,r.push('<button class="qwiz_button" onclick="'+e+".login_ok ("+t+", 0, "+i+')">'),r.push("Continue"),r.push("</button>"));qqc.$get_login_div(e,t).html(r.join("\n")).show()}return!1}function extract_delete_shortcode_content(e,t,s,i){for(var a=[],r="["+t+"]",o="[/"+t+"]";;){var n=e.indexOf(r);if(-1==n)break;if(e.indexOf(o)<n)i.additional_errmsgs.push(r+" "+qqc.T("found, but not")+" "+o);else{var _=new RegExp("(<[^\\/][^>]*>\\s*)*?\\["+t+"\\]([\\s\\S]*?)\\[\\/"+t+"\\]((<\\/[^>]+>\\s*)*)","m"),c=e.substr(n).match(_);a.push(c[2]),e=e.replace(_,"")}if(!s)break}return{htm:e,content:a=a.length?a.join(""):"NA"}}function add_span_if_empty(e,t){t||-1!=e.search(/\S/)?-1==e.replace(/ | | | | /,"").search(/\S/)&&(e+='<span class="qwiz-avoid-br" style="display: none;">x</span>'):e="";return e}function htmlDecode(e){return(new DOMParser).parseFromString(e,"text/html").documentElement.textContent}this.create_progress_bars3=function(e){debug[12]&&console.log("[create_progress_bars3] data:",e);var t,s=document_qwiz_user_logged_in_b,i=e.qname,a=e.i_qwiz_qdeck,r=e.qrecord_id;if(s){var o=e.units,n=e.n_correct_by_unit_topic,_=e.n_questions_by_unit_topic;t=o.length;for(var c=0,d=0,l=0;l<t;l++)c+=n[l],d+=_[l]}var u=[];const p=qwiz_.get_qwizdata(a,"qwiz_timer");if(u.push('<div id="progress_bars_leaderboard_tabs_'+i+a+'" class="progress_bars_leaderboard_tabs">'),u.push("<ul>"),p&&(u.push("<li>"),u.push('<a href="#leaderboard_tab_'+i+a+'">'),u.push("Fastest finish times"),u.push("</a>"),u.push("</li>")),u.push("</ul>"),p){u.push('<div id="leaderboard_tab_'+i+a+'" class="leaderboard">'),u.push('<div id="leaderboard-quiz_times_histogram-qwiz'+a+'">'),u.push("</div>"),u.push('<div class="refresh_leaderboard">'),u.push("Refresh every"),u.push('<select onchange="'+qqcname+".refresh_leaderboard_change (this, '"+i+"', "+a+", '"+r+"')\">");var g=["","5","10","15","30","60"],h=g.length;for(l=0;l<h;l++){var q=leaderboard_refresh_sec==g[l]?" selected":"";u.push('<option value="'+g[l]+'"'+q+">"),u.push(g[l]),u.push("</option>")}u.push("</select>"),u.push(" seconds"),u.push("</div>"),u.push('<button class="qwiz_button exit_progress_bars" style="float: right;" onclick="'+i+".no_login ("+a+', false, true, event)">'),u.push("Continue"),u.push("</button>"),u.push("</div>")}u.push("</div>"),$(i?"qwiz_"==i?"#qwiz_login-qwiz"+a:"div.qcard_card-qdeck"+a+" div.qcard-front div.qcard_content_size":"#progress_bars"+a).html(u.join("\n")).show();var m=0;if("leaderboard"==progress_bars_leaderboard[i+a]&&(m=1,qqc.qjax(i,a,r,"get_quiz_times",{full_quiz_f:1,summary:0})),$("#progress_bars_leaderboard_tabs_"+i+a).tabs({active:m,activate:function(e,t){t.newPanel.hasClass("leaderboard")&&(debug[12]&&console.log("[create_progress_bars3 > leaderboard activate] qrecord_id:",r),qqc.qjax(i,a,r,"get_quiz_times",{full_quiz_f:1,summary:0}))}}),s){if(t>1)for(l=0;l<t;l++){if("(excluded)"!=o[l]){var f=parseInt(100*n[l]/_[l],10),w=$("#unit_progress_bar-"+i+a+"-unit"+l);w.progressbar({value:f});var b=n[l]+"/"+_[l];w.find("div.progress-label").text(b)}}var v=$("#course_progress_bar-"+i+a);f=parseInt(100*c/d,10);v.progressbar({value:f});b=c+"/"+d;v.find("div.progress-label").text(b)}},this.refresh_leaderboard_change=function(e,t,s,i){if(void 0!==refresh_leaderboard_timeout[s]&&clearTimeout(refresh_leaderboard_timeout[s]),leaderboard_refresh_sec=e.value){var a=function(){qqc.qjax(t,s,i,"get_quiz_times",{summary:0}),refresh_leaderboard_timeout[s]=setTimeout(a,1e3*leaderboard_refresh_sec)};refresh_leaderboard_timeout[s]=setTimeout(a,1e3*leaderboard_refresh_sec)}},this.update_leaderboard_opt_out=function(e,t,s){var i=s.checked?1:0;qqc.qjax(e,t,"","update_leaderboard_opt_out",{opt_out_f:i})},this.create_use_dataset_options=function(e,t,s){"qwiz_"==e?$("#progress-qwiz"+s).html(""):$("#progress-qdeck"+s).html(""),plugin_url||(plugin_url=qqc.get_qwiz_param("url","./"));const i='<img src="'+(plugin_url+"images/spinner40x40.gif")+'" class="qwiz-center" style="margin-top: 100px;" />';qqc.$get_login_div(e,s).html(i).show(),use_dataset_options_display_name[e+s]=t[s].use_dataset_options_display_name;const a=t[s].qrecord_id,r=t[s].use_dataset;qqc.create_use_dataset_options2(e,s,r,a)},this.create_use_dataset_options2=function(e,t,s,i){if(debug[11]&&console.log("[create_use_dataset_options2] dataset:",s,", qrecord_id:",i),/\|\s*unit:/.test(s))var[s,a,r]=qqc.parse_use_dataset(s);else var a=[],r=[];"qwiz_"==e&&qwiz_.get_qwizdata(t,"combo")?get_combo_units_topics(e,t,i,s,a,r):get_dataset_units_topics(e,t,i,s,a,r)},this.create_use_dataset_options3=function(e,t,s){var i,a,r,o;debug[11]&&console.log("[create_use_dataset_options3] data:",e),dataset_units_topics_data=e;var n,_=[],c=[],d=[],l=[],u=[],p=[],g=[],h=[],q=[],m=[],f=1,w=[0],b=[],v={},k=[];if(selected_levels[t+s]&&(k=selected_levels[t+s]),void 0!==e.datasets_data){f=e.datasets_data.length,w=[...Array(f).keys()],n=[],o=[],a=[];for(let t of w){let s=e.datasets_data[t];[_[t],c[t],d[t],l[t],u[t],p[t],g[t],h[t],q[t],n[t],m[t],v]=units_topics_counts(s,v,k),o.push(s.dataset),a.push(s.qrecord_id),b.push(s.q_f),u[t].NA=1,g[t].NA=1,p[t].NA__NA=0,h[t].NA__NA=0}debug[11]&&console.log("[create_use_dataset_options3] n_cg_by_unit_topic:",h),n=-1==n.indexOf(!1);var z=e.datasets_data[0];t=z.qname,s=z.i_qwiz_qdeck,r=o.join("; "),i=a.join("; ");for(var y=create_units_topics_correspondence(_,c),x=[],T=[],S=y[0].length,j="",C=0;C<S;C++){if(-1!=(re=y[0][C]))ee=_[0][re],te=c[0][re];else for(let e=1;e<f;e++)-1!=(re=y[e][C])&&(ee=_[e][re],te=c[e][re]);x.push(ee),T.push(te),j=ee}l[0]=units_topics_sort(x,T),debug[0]&&(console.log("[create_use_dataset_options3] sort_units:",x),console.log("[create_use_dataset_options3 sort_topics:",T),console.log("[create_use_dataset_options3 unit_topic_order[0]:",l[0]))}else[_[0],c[0],d[0],l[0],u[0],p[0],g[0],h[0],q[0],n,m[0],v]=units_topics_counts(e,v,k),a=[i=e.qrecord_id],o=[r=e.dataset],b=[e.q_f];(v=Object.keys(v)).sort();var A=e.dataset_reset_questions_date;A||(A="");e.maker_specific_random;var M=e.maker_specific_questions_cards_to_show;M||(M=0);var P=qqc.$get_login_div(t,s);if(e.errmsg)return P.html("<br /><b>"+e.errmsg+"</b>").show(),!1;var O,N=0;for(var S of d)N+=S;if(0==N)return O="qwiz_"==t?qqc.T("You have completed all questions correctly"):qqc.T("You have marked all cards")+" “"+qqc.T("Got it!")+"”",P.html("<br /><b>"+O+"</b>").show(),!1;maker_specific_n_qs_by_unit_topic=[];for(let e of w)maker_specific_n_qs_by_unit_topic[e]={};"not ready"==icon_expand_src&&(plugin_url||(plugin_url=qqc.get_qwiz_param("url","./")),icon_expand_src=plugin_url+"images/icon_expand.gif",icon_collapse_src=plugin_url+"images/icon_collapse.gif");var E=[],I=o[0];use_dataset_options_display_name[t+s]&&(I=use_dataset_options_display_name[t+s]),I=I.replace(/_/g," "),/cb=1/.test(document.location.search)&&(I=I.replace(/(AP|HS|High School) Bio(logy)*/gi,"Biology"));var D="topics_only"==get_qwizdeckdata(t,s,"dataset_intro_f"),R=get_qwizdeckdata(t,s,"dataset_intro_info_only_msg"),F="qwiz_"==t?qqc.T("questions"):qqc.T("cards");R&&E.push('<span class="qwiz_errmsg">'+R+"</span><br />"),E.push('<div class="use_dataset_options_header">'+I+"</div>");var B="";const H=m[0].Other;if(!n||void 0!==H&&!H){n&&qqc.set_qwizdeckdata(t,s,"expand_topics",!0),D||("qwiz_"==t?qwiz_.get_qwizdata(s,"qwiz_timer")?E.push('<p class="use_dataset_options">'+qqc.T("Note: you can do subsets, but you have to do all questions for the leaderboard")+"</p>"):E.push('<p class="use_dataset_options">'+qqc.T("Choose the type of questions you want to practice")+"</p>"):E.push('<p class="use_dataset_options">'+qqc.T("Choose the type of cards you want to practice")+"</p>")),E.push('<table id="dataset_units_topics-'+t+s+'" class="dataset_units_topics" align="center">'),E.push("<tr>"),E.push("<th>"),E.push("</th>");var L=D?"hidden":"visible";E.push("<th>"),E.push('<input type="checkbox" onclick="qwiz_qcards_common.dataset_units_topics_toggle_all (this)" style="visibility: '+L+'" checked />'),E.push("</th>"),E.push("<th>"),E.push('<span class="units_header">Unit</span>'),E.push("</th>"),E.push("<th>"),E.push('<span class="topics_header">Topic</span>'),E.push("</th>");let e=selected_levels[t+s],a="",r="",o="",b="";if(v.length&&(o='<span style="visibility: hidden;">*</span>',e&&e.length>1&&(a=1==v.length?qqc.T("Includes additional questions if level selected below"):qqc.T("Includes additional questions if levels selected below"),r="*",o="",B=" qwiz-blue",b='style="cursor: help;" ')),E.push(`<th class="qwiz-center${B}" ${b}colspan="9" title="${a}">`),i&&!0===document_qwiz_user_logged_in_b?"qwiz_"==t?E.push(o+qqc.T("Correct")+r):E.push(o+"“"+qqc.T("Got it!")+"”"+r):"qwiz_"==t?E.push(o+"Qs"+r):E.push(o+"Cards"+r),E.push("</th>"),E.push("</tr>"),f>1){E.push("<tr>"),E.push("<td>"),E.push("</td>");L=D?"hidden":"visible";E.push("<td>"),E.push("</td>"),E.push("<td>"),E.push("</td>"),E.push("<td>"),E.push("</td>");var J=qwiz_.get_qwizdata(s,"dataset_labels");for(var Y of((J=J.split("; ")).length!=f&&(J=[...Array(f+1).keys()].slice(1)),J))E.push('<td class="qwiz-right qwiz-bold" style="padding-right: 8px;">'),E.push(Y),E.push("</td>");E.push("</tr>")}j="";var U,V,Q=-1,W=new Array(f).fill(0),K=new Array(f).fill(0),G=new Array(f).fill(0),X=new Array(f).fill(0),Z=M/q[0];Z>1&&(Z=1),V=f>1?y[0].length:d[0];for(C=0;C<V;C++){var ee,te,se=l[0][C],ie=[],ae=[];if(f>1){ee=x[se],te=T[se];for(let e of w){var re;-1!=(re=y[e][se])?(ie[e]=_[e][re],ae[e]=c[e][re]):(ee=j,ie[e]="NA",ae[e]="NA")}C}else{let e=0;ee=_[e][se],te=c[e][se],ie[0]=ee,ae[0]=te,se}if(ee!=j){Q++,j=ee;var oe=t+s+"-unit"+Q,ne=ee.replace(/[^a-z0-9 ]/gi,"_"),_e=[];for(let e of w)_e[e]=ie[e].replace(/[^a-z0-9 ]/gi,"_");var ce=[],de=0;for(let e of w)ce[e]=u[e][_e[e]],M&&(ce[e]=Math.ceil(ce[e]*Z),G[e]+ce[e]>M&&(ce[e]=Math.max(M-G[e],0)),X[e]=0),de+=ce[e];if(de>0){E.push('<tr id="'+oe+'" class="unit_head">'),E.push('<td style="padding-right: 5px;">'),m[_e[0]]||E.push('<img src="'+icon_expand_src+'" class="expand expand_collapse expand_collapse_unit qwiz-inline" onclick="qwiz_qcards_common.dataset_unit_expand_collapse (\''+t+"', "+s+', this)" title="'+qqc.T("Show/hide topics in this unit")+'" />'),E.push("</td>"),E.push("<td>"),E.push('<input type="checkbox" class="toggle_topics" style="visibility: '+L+'" onclick="qwiz_qcards_common.dataset_unit_toggle_topics (this)" title="'+qqc.T("Select/deselect all topics in this unit")+'" checked />'),E.push("</td>"),E.push('<td colspan="2" class="unit">'),E.push("<b>"),E.push(ee.replace(/_/g," ")),E.push("</b>"),E.push("</td>");for(let e of w){E.push('<td class="qwiz-right qwiz-nowrap nquestions '+ne+'">');var le="";i&&!0===document_qwiz_user_logged_in_b&&(le=`${g[e][_e[e]]}/`),le+=ce[e],E.push("<b>"),E.push(le),E.push("</b>"),E.push("</td>"),G[e]+=ce[e]}E.push("</tr>")}}var ue=ee+"__"+te;ue=ue.replace(/[^a-z0-9 ]/gi,"_");var pe=[],ge=[];for(let e of w)pe[e]=ie[e]+"__"+ae[e],pe[e]=pe[e].replace(/[^a-z0-9 ]/gi,"_"),ge[e]=p[e][pe[e]];if(debug[11]&&console.log("[create_use_dataset_options3] ounit_otopic_class:",pe),de>0){var he=0;for(let e of w)M&&(ge[e]=Math.ceil(ge[e]*Z),X[e]+ge[e]>ce[e]&&(ge[e]=Math.max(ce[e]-X[e],0)),maker_specific_n_qs_by_unit_topic[e][pe[e]]=ge[e]),he+=ge[e];if(he>0||f>1){E.push('<tr class="unit_topic unit_topic'+Q+'" data-unit="'+btoa(ee)+'">'),E.push("<td>"),E.push("</td>");var qe=t+s+"-unit_topic"+se;E.push("<td>"),E.push('<input type="checkbox" id="'+qe+'" style="visibility: '+L+'" checked />'),E.push("</td>"),E.push("<td>"),E.push("</td>");const e=te.replace(/^(\d{1,2}\.\d+-*(\d\.*\d*)*[\., _]*)*/,"").replace(/_/g," ");E.push('<td class="topic" data-topic="'+btoa(te)+'">'),E.push(e),E.push("</td>");for(let e of w){E.push(`<td class="qwiz-right qwiz-nowrap nquestions ${ue}" data-unit="${btoa(ie[e])}" data-topic="${btoa(ae[e])}">`);le="";i&&!0===document_qwiz_user_logged_in_b&&(debug[11]&&void 0===h[e][pe[e]]&&console.log(`n_cg_by_unit_topic[${e}][${pe[e]}]`),le=`${h[e][pe[e]]}/`),le+=ge[e],E.push(le),E.push("</td>"),W[e]+=ge[e],K[e]+=h[e][pe[e]],X[e]+=ge[e]}E.push("</tr>")}}}E.push('<tr class="border-top">'),E.push("<td>"),E.push("</td>"),E.push("<td>"),E.push("</td>"),E.push('<td colspan="2">'),E.push("<b>"),E.push(qqc.T("Total")),E.push("</b>"),E.push("</td>"),U=0;for(let e of w){E.push('<td class="qwiz-right qwiz-nowrap">');le="";W[e]?(i&&!0===document_qwiz_user_logged_in_b&&(le=`${K[e]}/`),le+=W[e],U+=W[e]):le="–",E.push("<b>"),E.push(le),E.push("</b>"),E.push("</td>")}E.push("</tr>"),E.push("</table>")}else{let e=0;U=M||p[e].Other__Other;K=h[e].Other__Other;E.push("<br /><br />"),"qwiz_"==t?(E.push("<b>"+qqc.T("Questions")+": "+U),i&&!0===document_qwiz_user_logged_in_b&&E.push("  "+qqc.T("Correct")+": "+K),E.push("</b><br />")):(E.push("<b>"+qqc.T("Cards")+": "+U),i&&!0===document_qwiz_user_logged_in_b&&E.push("  “"+qqc.T("Got it!")+"”: "+K),E.push("</b><br />"))}if(!R){var me,fe;if(me=M?0:get_qwizdeckdata(t,s,"qwiz_"==t?"questions_to_show":"cards_to_show"),E.push('<p class="use_dataset_options">'),fe="qwiz_"==t?qqc.T("'Redo' - questions done before this date will not be counted in totals"):qqc.T("'Redo' - cards done before this date will not be counted in totals"),E.push("Restart:"),E.push('<input type="date" id="dataset_reset_questions_date_'+t+s+'" class="dataset_reset_questions_date" value='+A+" />"),E.push('<img src="'+plugin_url+'images/info_icon.png" class="qwiz_icon_smaller qwiz-inline" style="cursor: help;" title="'+fe+'">'),E.push(" "),D?E.push(F):E.push(qqc.T("Max to practice in this session")+":"),E.push('<select id="dataset_max_q_'+t+s+'" class="dataset_max_q">'),D)E.push("<option selected>"),E.push(U),E.push("</option>");else{var we=[5,10,20,30,50];debug[11]&&we.unshift(3);var be=!1;if("qwiz_"==t){const e=get_qwizdeckdata(t,s,"default_max_to_practice");e&&(me=e)}var ve=we.length;for(se=0;se<ve;se++){if(!be&&me&&we[se]>=me&&(E.push("<option selected>"),E.push(me),E.push("</option>"),be=!0),we[se]>=U){const e=be?"":" selected";E.push("<option"+e+">"),E.push(U),E.push("</option>");break}me&&we[se]==me||(E.push("<option>"),E.push(we[se]),E.push("</option>"))}if(U>we[ve-1]){const e=be?"":" selected";E.push("<option"+e+">"),E.push(U),E.push("</option>")}}if(E.push("</select>"),fe="qwiz_"==t?"Note: questions that you miss will be repeated within this session":"Note: cards that you mark “Need more practice” will be repeated within this session",E.push('<img src="'+plugin_url+'images/info_icon.png" class="qwiz_icon_smaller qwiz-inline" style="cursor: help;" title="'+fe+'">'),E.push("</p>"),i&&!0===document_qwiz_user_logged_in_b&&!D){var ke;E.push('<span class="use_dataset_options">'),E.push("Do "+F+":"),E.push("</span>"),E.push('<label class="qwiz_label use_dataset_options">'),ke="qwiz_"==t?qqc.T("Priority is questions you answered incorrectly and new questions, but questions you answered correctly will sometimes be shown for review"):qqc.T("Priority is cards you marked")+" “"+qqc.T("Need more practice")+"” "+qqc.T("and new cards, but cards you marked")+" “"+qqc.T("Got it!")+"” "+qqc.T("will sometimes be shown for review"),E.push('<input type="radio" name="spaced_repetition" class="qwiz_radio_smaller" value="spaced_repetition" checked />'+qqc.T("Spaced repetition")+'<img src="'+plugin_url+'images/info_icon.png" class="qwiz_icon_smaller qwiz-inline" style="cursor: help;" title="'+ke+'" />  '),E.push("</label>"),E.push('<label class="qwiz_label use_dataset_options">'),E.push('<input type="radio" name="spaced_repetition" class="qwiz_radio_smaller" value="new" />'+qqc.T("New")+" "),E.push("</label>"),E.push('<label class="qwiz_label use_dataset_options">');let e="qwiz_"==t?qqc.T("Incorrect"):"“"+qqc.T("Need more practice")+"”";E.push('<input type="radio" name="spaced_repetition" class="qwiz_radio_smaller" value="incorrect" />'+e+"  "),E.push("</label>"),E.push('<label class="qwiz_label use_dataset_options">'),E.push('<input type="radio" name="spaced_repetition" class="qwiz_radio_smaller" value="all" />'+qqc.T("All")),E.push("</label>"),E.push("<br />")}if(v.length){let e;e=1==v.length?qqc.T("Include level"):qqc.T("Include levels");let i=selected_levels[t+s],a="";for(var ze of(i&&i.length>1&&(a='<span class="qwiz-bold">*</span>'),E.push(`<span class="use_dataset_options${B}">${a} ${e}:</span>`),v)){let e=`onclick="qwiz_qcards_common.select_level (this, '${ze}', '${t}', ${s})"`,a=i&&-1!=i.indexOf(ze)?"checked":"";E.push(`<label class="use_dataset_options${B}">`),E.push(`<input type="checkbox" class="select_level qwiz_radio_smaller" data-level="${ze}" ${e} ${a} />`+qqc.capitalize(ze)+" "),E.push("</label>")}E.push("<br />")}var ye=qqc.T("Begin practice");let e=0;var $e=`'${qqc.addSlashes(r)}', '${t}', ${s}, '${qqc.addSlashes(i)}', ${q[e]}, 0, 0, '${A}', ${M}, '${b.join("; ")}'`;E.push(`<button class="qwiz_button begin_practice" onclick="qwiz_qcards_common.begin_dataset_quiz_deck (${$e})">`),D&&(ye="qwiz_"==t?qqc.T("Start questions"):qqc.T("Start cards")),E.push(ye),E.push("</button>"),E.push("<br />"),E.push("<br />")}P.html(E.join("\n")).show(),"qcard_"==t&&qcard_.set_container_width_height(s),"qwiz_"==t?$(`div.qwiz-progress_meter-qwiz${s}`).css({"--n":U}):$(`div.qcard-progress_meter-qdeck${s}`).css({"--n":U}),D||get_qwizdeckdata(t,s,"expand_topics")?$("table#dataset_units_topics-qwiz_"+s+" img.expand_collapse_unit").each((function(){qqc.dataset_unit_expand_collapse(t,s,this)})):restore_units_topics_state(t,s)},this.select_level=function(e,t,s,i){var a=qqc.$get_login_div(s,i);selected_levels[s+i]=[""],a.find("input.select_level").each((function(){if(this.checked){let e=$(this).data("level");selected_levels[s+i].push(e)}})),record_units_topics_state(s,i),qqc.create_use_dataset_options3(dataset_units_topics_data,s,i)},this.offset_height_rescale=function(e,t,s){var i=e.outerHeight()*(t-1);s&&(i+=s),e.css({"margin-bottom":i.toFixed(1)+"px"})},this.create_sortable_unit_number=function(e){var t="",s=typeof e;if("number"!=s&&"string"!=s)t="z";else if(""==e)t="z";else{var i=e.split("."),a=i.length;if(a>1){var r=i[1].split("-");i[1]=r[0]}for(var o=Math.min(2,a),n=0;n<o;n++)isNaN(i[n])||(i[n]=("++++++"+i[n]).slice(-6));t=i.join(".")+" "+e}return t},this.shuffle=function(e){for(var t,s,i=e.length;0!==i;)s=Math.floor(Math.random()*i),t=e[i-=1],e[i]=e[s],e[s]=t;return e},firstBy=function(){function e(e,t){if("function"!=typeof e){var s=e,i=window.navigator.userLanguage||window.navigator.language;e=function(e,t){if("number"==typeof e[s]&&"number"==typeof t[s])return e[s]-t[s];var a=e[s]||"zzz",r=t[s]||"zzz";return a.toString().toLowerCase().localeCompare(r.toString().toLowerCase(),i)}}return-1===t?function(t,s){return-e(t,s)}:e}function t(t,i){return(t=e(t,i)).thenBy=s,t}function s(s,i){var a=this;return s=e(s,i),t((function(e,t){return a(e,t)||s(e,t)}))}return t}(),this.create_paypal_subscription_screen=function(e,t,s){$("div.qwiz-usermenu_icon").removeClass("qwiz-icon-bounce");const i=qqc.$get_login_div(e,t),[a,r,o,n,_,c,d]=subscription_plan_data(e,t);var l=[];if(s&&!document_qwiz_user_logged_in_b)return l.push("Please log in"),void i.html(l.join("\n")).show();if(n){const e=new Date(parseInt(today_yyyy),_,c).getTime(),t=DateFormat.format.date(e,"MMMM d, yyyy");l.push(`\n Start your subscription with PayPal or credit card. \n The cost is $${o} for access through ${t}. \n There will no further charges.\n <br />\n `)}else l.push(`\n <b>Start your free trial</b>\n <br />\n Start your two-week free trial with a PayPal or credit card\n authorization. \n There is no charge; you can cancel any time. \n After two weeks you will be charged $${o} per month;\n again, you can cancel any time. \n `);document_qwiz_user_logged_in_b&&document_qwiz_good_through_date&&l.push('\n <br />\n <span class="qwiz-smaller">\n <i>Note: free trials cannot be started with an existing\n account/login name. \n You will have to create a new account with a new login\n name after returning from PayPal<i>.\n </span>\n ');get_qwizdeckdata(e,t,"display_pay_screen");if(debug[0]){const s="test"+(parseInt(1e6*Math.random())+1e5);document_qwiz_good_through_date?l.push(`\n <br />\n <button onclick="qwiz_qcards_common.register_taker_open_register_pay_feedback ('${e}', ${t})">\n open_register test (bypass PayPal)\n </button>\n <br />\n `):l.push(`\n <br />\n <button onclick="qwiz_qcards_common.new_student_license ('${e}', ${t}, {subscriptionID: '${s}'})">\n Test (bypass PayPal)\n </button>\n <br />\n `)}l.push("<br />"),plugin_url||(plugin_url=qqc.get_qwiz_param("url","./"));const u='<img src="'+plugin_url+'images/spinner16x16.gif" />';l.push(`\n <script src="https://www.paypal.com/sdk/js?client-id=${a}&vault=true&intent=subscription">\n <\/script>\n <div id="paypal-button-container-${e}${t}" class="qwiz-paypal-button-container" style="width: 250px; height: 150px; margin: auto;">\n ${u}\n </div>\n `),i.html(l.join("\n")).show();var p=0;const g=function(){if("undefined"==typeof paypal)++p<20&&setTimeout(g,250);else{var s=[];if(s.push(`\n <script>\n parent.jQuery ('#paypal-button-container-${e}${t}').html ('');\n paypal.Buttons({\n style: {\n height: 40,\n shape: 'pill',\n tagline: false\n },\n createSubscription: function (data, actions) {\n return actions.subscription.create({\n plan_id: '${r}',\n application_context: {\n shipping_preference: 'NO_SHIPPING'\n }\n });\n },\n onApprove: function (data, actions) {\n if (document_qwiz_user_logged_in_b) {\n parent.qwiz_qcards_common.new_student_license ('${e}', ${t}, data);\n } else {\n parent.qwiz_qcards_common.post_paypal_student_registration_and_license ('${e}', ${t}, data);\n }\n }\n }).render("#paypal-button-container-${e}${t}");\n <\/script>\n `),!get_qwizdeckdata(e,t,"display_pay_screen")){const i="qwiz_"==e?"quiz":"flashcard deck";s.push(`\n <div class="qwiz-smaller" style="text-align: right; margin-top: 18px;">\n <button onclick="${e}.no_login (${t}, false, true)">\n Return to ${i}\n </button>\n </div>\n `)}i.append(s.join("\n"))}};setTimeout(g,250)},this.post_paypal_student_registration_and_license=function(e,t,s){debug[0]&&console.log("[post_paypal_student_registration_and_license] data:",s),document_qwiz_subscription_id=s.subscriptionID;const i=get_qwizdeckdata(e,t,"display_pay_screen"),a=qqc.set_immediate_payment(e,t);if("special_offer"==i||document_qwiz_user_logged_in_b&&"free_trial"==i&&a){s={login_f:"",special_offer:1,register_v2:"1",subscription:1,payment_type_id:a?65:52,subscription_id:document_qwiz_subscription_id,called_from:"post_paypal_student_registration_and_license",callback:"special_offer_callback"};return debug[0]&&console.log("[post_paypal_student_registration_and_license] data",s),void qqc.qjax(e,t,"","new_student_registration",s)}var r;r=qqc.set_immediate_payment(e,t)?"Create a new account – or log in with your existing account":"Create a new Learn-Biology.com login account",r+='<br /><span class="qwiz-smaller qwiz-highlight">Please be sure to complete this step in order to access learn-biology.com</span>',"qwiz_"==e?qwiz_.display_login(t,!1,"register",r):qcard_.display_login(t,!1,"register",r)},this.new_student_license=function(e,t,s){debug[0]&&console.log("[new_student_license] data:",s);const i=qqc.$get_login_div(e,t);plugin_url||(plugin_url=qqc.get_qwiz_param("url","./"));const a='<img src="'+plugin_url+'images/spinner40x40.gif" />';i.html(a).show(),document_qwiz_subscription_id=s.subscriptionID;s={login_f:"",license_only:1,register_v2:"1",subscription:1,payment_type_id:qqc.set_immediate_payment(e,t)?65:52,subscription_id:document_qwiz_subscription_id,called_from:"new_student_license",callback:"new_student_license_feedback"};debug[0]&&console.log("[new_student_license] data",s),qqc.qjax(e,t,"","new_student_registration",s)},this.new_student_license_feedback=function(e){debug[0]&&console.log("[new_student_license_feedback] data:",e);var t=e.qname,s=e.i_qwiz;e.errmsg;if(e.errmsg){qqc.$get_login_div(t,s).html(e.errmsg).show()}else{if("learn-biology.com"==qqc.get_qwiz_param("server_name")||debug[0]){get_qwizdeckdata(t,s,"display_pay_screen")?document.location="https://learn-biology.com/getstarted":("qwiz_"==t?qwiz_.login_ok(s):qcard_.login_ok(s),window.open("https://learn-biology.com/getstarted","_blank").focus())}}},this.create_pay_screen=function(e,t,s,i,a){debug[0]&&console.log("[create_pay_screen] msg:",i,", pay_now_sign_up:",a);var r=qqc.$get_login_div(e,s),o=[];if(t[s].pay_errmsg)o.push("<strong>"+t[s].pay_errmsg+"</strong><br />");else{i&&o.push(i+"<br />");var n=t[s].taker_payment_type_ids.length;if(0==n||"paid"==qwiz_.get_qwizdata(s,"pay_quiz_ok")){const t=get_qwizdeckdata(e,s,"display_pay_screen");return o.push("<br />"),o.push("<br />"),o.push("<p>"),"open_register"==t?o.push("<b>You are currently signed in to Learn-Biology.com. </b>"):(o.push("<b>You are currently signed in with an account that has access to quizzes and decks. </b>"),o.push("</p>"),o.push("<p>"),o.push("If you need to sign up with a different account, or you need to register for a class, please sign out by clicking on the green down-triangle, above right."),o.push("</p>")),void r.html(o.join("\n")).show()}t[s].any_promo;o.push('<form action="https://www.paypal.com/cgi-bin/webscr" onSubmit="return qwiz_qcards_common.submit_for_payment (\''+e+"', "+s+', this)" method="post" target="_blank">'),o.push('<input type="hidden" name="cmd" value="_s-xclick">'),o.push('<input type="hidden" name="hosted_button_id" value="WH6FWJY29SWN8">');var _=-1,c=0,d=n;void 0!==t[s].i_promo&&-1!=(_=t[s].i_promo)&&(c=_,d=_+1,n=1,a="Pay now"),o.push('<table class="pay_options">'),o.push("<tr>"),o.push("<td>"),o.push('<input type="hidden" name="on0" value="Options">'),n>1&&o.push("Please choose:"),o.push("</td>"),o.push("</tr>"),o.push("<tr>"),o.push("<td>");var l="";n<=2?l=' size="2" style="min-height: 42px;"':3==n?l=' size="3" style="min-height: 64px;"':n>=4&&(l=' size="4" style="min-height: 86px;"'),o.push('<select name="os0" class="qwiz_paypal_select"'+l+" onchange=\"qwiz_qcards_common.update_pay_button (this, '"+e+"', "+s+')">');for(var u=!0,p=!1,g=c;g<d;g++){var h=t[s].taker_fees[g],q=t[s].taker_payment_type_ids[g];if(debug[0]&&19.99==h&&(h="1.00"),!(document_qwiz_good_through_date_ok&&h<=0||8==q||65==q)){var m,f=t[s].taker_good_for_n_periodss[g],w=t[s].taker_good_for_periods[g],b=t[s].taker_payment_descriptions[g],v=t[s].taker_payment_selected_bs[g];h<=0?(m=qqc.capitalize(qqc.number_to_word(f))+" "+qqc.plural(w,w+"s",f),0==g&&(v=!0,p=!0)):(m=qqc.currency(h)+" "+qqc.number_to_word(f)+" "+qqc.plural(w,w+"s",f),a&&"Pay now"==a&&(p||(v=!0,p=!0))),b&&(m+=" - "+(b=(b=b.replace(/<\/{0,1}b>/gi,"")).replace(/<[^>]+>.*/,"")));var k=v?" selected":"";o.push('<option value="'+h+'"'+k+">"),o.push(m),o.push("</option>"),h>0&&(u=!1)}}o.push("</select> "),o.push("</td>"),o.push("</tr>"),o.push("</table>"),o.push('<input type="hidden" name="currency_code" value="USD">'),u||t[s].taker_fees[0]<=0&&(!a||"Sign up"==a)?(sign_up_display="block",paypal_display="none"):(sign_up_display="none",paypal_display="block");var z='style="display: '+sign_up_display+';"';o.push('<div class="sign_up_button" '+z+">"),o.push('<input type="submit" class="qwiz_button" value="Sign up" />'),o.push('<div class="signup_confirm_email_errmsg qwiz_errmsg" style="display: none;">'),o.push("</div>"),o.push("</div>"),z='style="display: '+paypal_display+';"',o.push('<div class="paypal_button" '+z+">"),o.push('<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_paynowCC_LG.gif" style="border: none;" name="submit" alt="PayPal - The safer, easier way to pay online!">'),o.push('<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">'),o.push("</div>"),o.push('<input type="hidden" name="custom">'),o.push("</form>"),o.push("<button onclick=\"qwiz_qcards_common.payment_received (1, '"+e+"', "+s+')" class="qwiz_pay_cancel qwiz-smaller">'),o.push("Cancel"),o.push("</button>")}r.html(o.join("\n")).show()},this.update_pay_button=function(e,t,s){var i=qwiz_deck_selector(t,s);$(i+" div.signup_confirm_email_errmsg").hide(),e.value<="0.00"?($(i+"div.sign_up_button").show(),$(i+"div.paypal_button").hide()):($(i+"div.sign_up_button").hide(),$(i+"div.paypal_button").show())},this.hide_signup_confirm_email_errmsg=function(e){$(e).parents("div.sign_up_button").find("div.signup_confirm_email_errmsg").hide()},this.update_email_callback=function(e,t,s){debug&&console.log("[update_email_callback] qname:",e,", i_qwiz:",t,", errmsg:",s);var i=qwiz_deck_selector(e,t);if("need_password"==s)return qqc.create_password_dialog(e,t),$dialog_current_password.dialog("open"),!1;"password_incorrect"==s?$("#current_password_errmsg").html("Password incorrect"):"not_unique"==s?($(i+" div.update_email_errmsg").html("Email address already in use"),$(i+" span.confirm_email_address").addClass("qwiz_button_disabled")):"fail"==s?$(i+" div.update_email_errmsg").html("Sorry, unable to update email"):"ok"==s&&(document_qwiz_email=$(i+" input.confirm_email_address").val(),qqc.confirm_email2(e,t)),$dialog_current_password&&$dialog_current_password.dialog("close")},this.update_email_hide_error=function(e,t){var s=qwiz_deck_selector(e,t);return $(s+" div.update_email_errmsg").html(""),$(s+" span.confirm_email_address").removeClass("qwiz_button_disabled"),!1},this.confirm_email=function(e,t,s){if($(e).hasClass("qwiz_button_disabled"))return!1;var i=qwiz_deck_selector(t,s),a=$(i+"input.confirm_email_address").val();if(""==a)return $(i+" div.update_email_errmsg").html("Please enter email address"),$(e).addClass("qwiz_button_disabled"),!1;if(a!=document_qwiz_email){return/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i.test(a)?(update_email_data={field:"email",value:a,callback:"qwiz_qcards_common.update_email_callback"},$(i+" span.confirm_email_address").addClass("qwiz_button_disabled"),qqc.qjax(t,s,"","update_my_account",update_email_data)):($(i+" div.update_email_errmsg").html("Not a valid email address"),$(e).addClass("qwiz_button_disabled")),!1}qqc.confirm_email2(t,s)},this.confirm_email2=function(e,t){var s=qwiz_deck_selector(e,t);$(s+" .signup_confirm_email").css({visibility:"visible"}),$(s+" input.signup_confirm_email").val("").focus(),$(s+" input.sign_up").removeClass("qwiz_button_disabled").prop("disabled",!1),$(s+" div.signup_confirm_email_errmsg").hide();var i={field:"email_confirm",value:"",email_address:$(s+" input.confirm_email_address").val(),username:document_qwiz_username,callback:"qwiz_qcards_common.confirm_email_callback"};qqc.qjax(e,t,"","update_my_account",i)},this.confirm_email_callback=function(e,t,s){debug[0]&&console.log("[confirm_email_callback] errmsg:",s),"need_password"==s&&(qqc.create_password_dialog(e,t),$dialog_current_password.dialog("open"))},this.hide_current_password_errmsg=function(){$("#current_password_errmsg").html("")},this.create_password_dialog=function(e,t){var s=[];s.push('<div id="dialog_current_password" title="Security check: re-enter password">'),s.push("<tr>"),s.push("<td>"),s.push("Password"),s.push("</td>"),s.push("<td>"),s.push('<input id="current_password" type="password" onfocus="qwiz_qcards_common.hide_current_password_errmsg ()" />'),s.push("<br />"),s.push('<div id="current_password_errmsg" class="qwiz_errmsg">'),s.push("</div>"),s.push("</td>"),s.push("</tr>"),s.push("</div>"),$("body").append(s.join("\n")),$dialog_current_password=$("#dialog_current_password").dialog({autoOpen:!1,height:200,width:350,modal:!0,buttons:{Submit:function(){qqc.update_session_id(e,t)},Cancel:function(){$dialog_current_password.dialog("close")}}})},this.update_session_id=function(e,t){var s=$("#current_password").val();""!=s?(update_email_data.sha3_current_password=CryptoJS.SHA3(s).toString(),update_email_data.current_username=document_qwiz_username,qqc.qjax(e,t,"","update_my_account",update_email_data)):$("#current_password_errmsg").html("Please enter password")},this.create_enroll_screen=function(e,t){var s=[];s.push('<p style="font-weight: normal; text-align: left; margin: 0 0 0 10px;">'),s.push("You are currently registered as an “independent student,” not enrolled in a school or class. "),s.push("If you have a registration code you can join a class. "),s.push("<br />(Any work you have completed on quizzes and flashcard decks will be transferred to the teacher’s gradebook.)"),s.push("</p>"),s.push('<table class="qwiz-border-none qwiz-padding" border="0" align="center"'),s.push("<tr>"),s.push('<td style="vertical-align: top;">'),s.push("<b>Registration code</b>"),s.push("</td>"),s.push("<td>"),s.push('<input type="text" class="enroll_screen_reg_code" style="padding: 2px;" onfocus="qwiz_qcards_common.hide_enroll_error ()" onkeydown="qwiz_qcards_common.enroll_registration_code_keydown (\''+e+"', "+t+');" />'),s.push('<div class="enroll_screen_reg_code_errmsg qwiz_errmsg"></div>'),s.push('<div class="enroll_screen_reg_code_class_name"></div>'),s.push("</td>"),s.push("</tr>"),s.push("<tr>"),s.push("<td>"),s.push("</td>"),s.push("<td>"),s.push('<button class="enroll_check_reg_code qwiz_button" onclick="qwiz_qcards_common.check_reg_code (\''+e+"', "+t+')">'),s.push("Check code"),s.push("</button>"),s.push('<button class="enroll_join_class qwiz_button" style="display: none;" onclick="qwiz_qcards_common.reset_independent_student (\''+e+"', "+t+')">'),s.push("Join class"),s.push("</button>"),plugin_url||(plugin_url=qqc.get_qwiz_param("url","./")),s.push('<img class="enroll_spinner" style="display: none;" src="'+plugin_url+'images/spinner16x16.gif" />'),s.push("</td>"),s.push("</tr>"),s.push("</table>"),s.push('<div style="text-align: right; padding-right: 10px;">'),s.push('<button class="qwiz-smaller" onclick="'+e+".no_login ("+t+', false, true)">'),s.push("Cancel"),s.push("</button>"),s.push("</div>");qqc.$get_login_div(e,t).html(s.join("\n")).show()},this.create_refresh_page_notice=function(e,t){qqc.$get_login_div(e,t).html('\n <div class="qwiz-center">\n <br />\n <br />\n <p>\n <b>Score-recording authentication expired.\n <br />\n Please re-load this page to continue</b>\n </p>\n </div>\n ').show()},this.check_reg_code=function(e,t){var s=qwiz_deck_selector(e,t),i=$(s+"input.enroll_screen_reg_code").val();if(""!=i){$(".enroll_spinner").show();var a={reg_code:i,js_f:1};qqc.qjax(e,t,"","check_reg_code",a)}return!1},this.reg_code_ok_or_no=function(e){debug[0]&&console.log("[reg_code_ok_or_no] data:",e);var t=qwiz_deck_selector(e.qname,e.i_qwiz);$(t+".enroll_spinner").hide(),(enroll_reg_code_ok_f=1==e.num_rows)?(enroll_reg_code_school_id=e.school_id,enroll_reg_code_school_name=e.school_name,enroll_reg_code_class_id=e.class_id,enroll_reg_code_class_name=e.class_name,$(t+"div.enroll_screen_reg_code_class_name").html("<b>Registration for class "+e.class_name+", "+e.school_name+"</b>").show(),$(t+"button.enroll_check_reg_code").hide(),$(t+"button.enroll_join_class").show()):($(t+"div.enroll_screen_reg_code_errmsg").html("Could not find registration code").show(),$(t+"div.enroll_screen_reg_code_class_name").html("").hide())},this.hide_enroll_error=function(){$("div.enroll_screen_reg_code_errmsg").html("").hide()},this.enroll_registration_code_keydown=function(e,t){debug[0]&&console.log("[enroll_registration_code_keydown] enroll_reg_code_ok_f:",enroll_reg_code_ok_f);var s=qwiz_deck_selector(e,t);enroll_reg_code_ok_f?($(s+"button.enroll_join_class").hide(),$(s+"button.enroll_check_reg_code").show()):($(s+"div.enroll_screen_reg_code_errmsg").html("").hide(),$(s+"div.enroll_screen_reg_code_class_name").html("").hide())},this.reset_independent_student=function(e,t){debug[0]&&console.log("[reset_independent_student]");var s=qwiz_deck_selector(e,t);if(""==$(s+"input.enroll_screen_reg_code").val())return $("div.enroll_screen_reg_code_errmsg").html("Please enter registration code").show(),!1;$(s+".enroll_spinner").show();var i={jjax:1,school_id:enroll_reg_code_school_id,class_id:enroll_reg_code_class_id,taker_id:document_qwiz_taker_id};return qqc.qjax(e,t,"","reset_independent_student",i),!1},this.reset_independent_student_callback=function(e){if(debug[0]&&console.log("[reset_independent_student_callback] data:",e),"ok"==e.errmsg)e.jjax=1,qqc.qjax(e.qname,e.i_qwiz,"","add_to_class",e);else{var t=[];t.push("<br /><p><b>Sorry, unable to reset status</b></p>"),t.push('<button class="qwiz_button" onclick="'+e.qname+".no_login ("+e.i_qwiz+', false, true, event)">'),t.push("Continue"),t.push("</button>"),t=t.join("\n"),qqc.$get_login_div(e.qname,e.i_qwiz).html(t).show()}},this.add_to_class_callback=function(e){debug[0]&&console.log("[add_to_class_callback] data:",e);const t=e.qname,s=e.i_qwiz;var i=qwiz_deck_selector(t,s);$(i+".enroll_spinner").hide();var a=[];"ok"==e.errmsg?(document_qwiz_school_id=enroll_reg_code_school_id,document_qwiz_class_id=enroll_reg_code_class_id,document_qwiz_independent_taker_f=!1,qqc.set_user_menus_and_icons(),qwiz_&&qwiz_.any_pay_quiz_f&&qwiz_.pay_lock_settings(s,s),qcard_&&qcard_.any_pay_deck_f&&qcard_.pay_lock_settings(s,s),a.push("<br /><p><b>You are now enrolled in "+enroll_reg_code_class_name+", "+enroll_reg_code_school_name+"</b></p>")):a.push("<br /><p><b>Sorry, unable to reset status</b></p>"),a.push('<button class="qwiz_button" onclick="'+t+".no_login ("+s+', false, true, event)">'),a.push("Continue"),a.push("</button>"),a=a.join("\n"),qqc.$get_login_div(t,s).html(a).show()},this.create_provide_feedback_screen=function(e,t,s){var i,a,r=[];if(r.push('<div style="margin-top: 5px">'),r.push("<b>Feedback - bugs, errors, suggestions...?</b>"),r.push("</div>"),r.push('<div class="qwiz-normal qwiz-smaller">'),r.push("Feel free to copy and paste, including screenshots!"),r.push("</div>"),"qcard_"==e){var o=$("div.qcard_card-qdeck"+t),n=o.width()-16,_=.62*o.height();i=' style="width: '+parseInt(n)+"px; height: "+parseInt(_)+'px;"',a="div.qcard_card-qdeck"+t}else i=' style="min-height: 175px;"',a="div#qwiz"+t;r.push('<div class="qwiz-provide_feedback"'+i+' contenteditable="true">'),provide_feedback_html[a]&&r.push(provide_feedback_html[a]),r.push("</div>"),r.push('<div class="qwiz-normal qwiz-smaller" style="text-align: left;">'),r.push("From: "+document_qwiz_username),r.push("</div>"),r.push("<div>"),r.push('<button class="qwiz_button" onclick="qwiz_qcards_common.submit_feedback (\''+e+"', "+t+", "+s+')">'),r.push("Submit"),r.push("</button>"),r.push(" "),r.push('<button class="qwiz_button_small qwiz-b_and_w" onclick="qwiz_qcards_common.cancel_provide_feedback (\''+e+"', "+t+')">'),r.push("Back"),r.push("</button>"),r.push('<span class="qwiz-smaller qwiz-normal">'),r.push("(you can return to complete your comments)"),r.push("</span>"),r.push("</div>"),qqc.$get_login_div(e,t).html(r.join("\n")).show();$("div.qwiz-provide_feedback").on("paste",(function(e){var t=this;setTimeout((function(){resize_feedback_images(t)}),100)}))},this.submit_feedback=function(e,t,s){var i=$(("qwiz_"==e?"div#qwiz"+t:"div.qcard_card-qdeck"+t)+" div.qwiz-provide_feedback").html();if(-1!=i.indexOf("<img")){var a=i.match(/<img src="blob:[^"]+/g);if(a){global_blob_urls=[],global_data_urls=[];for(var r=a.length,o=0;o<r;o++){a[o].length;global_blob_urls.push(a[o].substr(10))}qqc.get_blobs_as_data_urls(e,t,s,r,i,a)}else submit_feedback2(e,t,s,i)}else{if(qqc.is_only_tags_and_whitespace(i))return!1;submit_feedback2(e,t,s,i)}},this.remove_empty_opening_tags=function(e){return e=e.replace(/^\s*<(p|h\d)>\s*<\/(p|h\d)>/,"")},this.is_only_tags_and_whitespace=function(e){return-1==(e=(e=qqc.remove_tags_eols(e,!0)).replace(/ | | | | /,"")).search(/\S/)},this.get_blobs_as_data_urls=function(e,t,s,i,a,r){i--;var o=new XMLHttpRequest;o.responseType="blob",o.onload=function(){var n=o.response,_=new FileReader;_.onload=function(){debug[0]&&console.log("[get_blobs_as_data_urls] i_do:",i,", reader.result.length:",_.result.length),global_data_urls.push(_.result),0==i?submit_feedback2(e,t,s,a,r):qqc.get_blobs_as_data_urls(e,t,s,i,a,r)},_.readAsDataURL(n)},o.open("GET",global_blob_urls[i]),o.send()},this.blobUrlToBase64=async function(e){const t=await fetch(e),s=await t.blob();return new Promise(((e,t)=>{const i=new FileReader;i.onloadend=()=>e(i.result),i.onerror=t,i.readAsDataURL(s)}))},this.blob_data={},this.get_blob_as_data_url=function(e,t){debug[0]&&console.log("[get_blob_as_data_url] imageUrl:",t);const s=new FileReader;s.onloadend=()=>{const t=s.result;debug[0]&&(console.log("[get_blob_as_data_url] base64data.length:",t.length),console.log("[get_blob_as_data_url] base64data.substr (0, 50):",t.substr(0,50))),qqc.blob_data[e]=t},(async()=>{const e=await fetch(t),i=await e.blob();s.readAsDataURL(i)})()},this.submit_feedback_callback=function(e,t,s,i,a){var r=[];r.push("<p>"),r.push("<b>"+a+"</b>"),r.push("</p>"),i?(provide_feedback_html[s]="",r.push('<button class="qwiz_button" onclick="'+e+".no_login ("+t+', false, true)">'),r.push("Continue"),r.push("</button>")):(r.push('<button class="qwiz-smaller" onclick="'+e+".no_login ("+t+', false, true)">'),r.push("Back"),r.push("</button>")),qqc.$get_login_div(e,t).html(r.join("\n")).show()},this.cancel_provide_feedback=function(e,t){var s,i=$((s="qwiz_"==e?"div#qwiz"+t:"div.qcard_card-qdeck"+t)+" div.qwiz-provide_feedback");provide_feedback_html[s]=i.html(),provide_feedback_html[s].length>2e7&&alert("Please note: the images in your feedback are large. You may want to submit your comments so far before adding more images."),("qwiz_"==e?qwiz_:qcard_).no_login(t,!1,!0)},this.preview_iframe_close=function(){$("div#preview_iframe_wrapper").remove()},this.init_hide_show_password=function(e){$(e).hidePassword(!0,{states:{shown:{toggle:{className:"qwiz-hideShowPassword-toggle-hide"}},hidden:{toggle:{className:"qwiz-hideShowPassword-toggle-show"}}}})},this.create_register_taker_screen=function(e,t,s,i,a){register_taker_global_reg_code_ok_f=!1,register_taker_global_username="",register_taker_global_first_name="",register_taker_global_last_name="",register_taker_global_sha3_password="",register_taker_global_username_unique_f=!1,register_taker_global_email_unique_f=!1;var r=set_display_pay_screen(e,t),o=!1;r||get_qwizdeckdata(e,t,"pay_quiz_deck_id")||(qqc.set_qwizdeckdata(e,t,"display_pay_screen","open_register"),o=!0,r="open_register",i="<b>Create an account to save your work</b>");var n=[];if(i&&(n.push(i+"<br />"),/free/.test(i)&&"free"),n.push(`<form name="register_taker_'${e}${t}" action="nada.php" onSubmit="return qwiz_qcards_common.register_taker ('${e}', ${t}, ${s}, '${a}')">`),n.push('<table class="register_taker">'),"subscribe"!=r&&"special_offer"!=r&&"open_register"!=r){if(n.push("<tr>"),n.push('<td colspan="3" class="register_taker_if_your_teacher" style="font-weight: normal; text-align: center;">'),"signup"==r)n.push("<i>Please enter the registration code you received"),n.push("from Mr. W on TikTok, Youtube, etc.");else if("free_trial"==r||"free_trial"==a){const[s,i,a,o,_,c,d]=subscription_plan_data(e,t);if(o){const e=new Date(parseInt(today_yyyy),_,c).getTime();DateFormat.format.date(e,"MMMM d, yyyy");n.push("<b>Please create an account first. \n Then we will set up your free trial with a PayPal or credit card authorization. </b>\n There is no charge; you can cancel any time.")}else n.push(`<b>Please create an account first. \n Then we will set up your free trial with a PayPal or credit card authorization. </b>\n <br />\n There is no charge; you can cancel any time. \n After two weeks you will be charged $${a} per month;\n again, you can cancel any time. \n `),"free_trial"!=r&&(n.push("(Registering for a class? Go"),n.push('<a href="https://learn-biology.com/register" target="_blank">'),n.push("here</a>)"))}else"special_offer"!=r&&(n.push("<i>Enter the registration code that your teacher gave you</i>"),n.push("<br />"),n.push("(Not in a class? Go"),n.push('<a href="https://learn-biology.com/student-free-trial" target="_blank">'),n.push("here</a>)"));n.push("</td>"),n.push("</tr>"),"free_trial"!=r&&"free_trial"!=a&&(n.push("<tr>"),n.push("<td>"),n.push("</td>"),n.push("<td>"),n.push('<label for="reg_code">'),n.push("Registration code"),n.push("</label>"),n.push("</td>"),n.push("<td>"),n.push('<input type="text" class="register_taker_reg_code" onchange="qwiz_qcards_common.register_taker_check_reg_code (\''+e+"', "+t+', this.value)" onfocus="qwiz_qcards_common.register_taker_hide_error (\''+e+"', "+t+', this);"> <span class="qwiz-required">*</span>'),n.push('<div class="register_taker_reg_code_errmsg qwiz_errmsg"></div>'),n.push('<div class="register_taker_reg_code_class_name"></div>'),n.push("</td>"),n.push("</tr>"),n.push('<tr class="register_taker_please_continue_below">'),n.push("<td>"),n.push("</td>")),n.push('<td colspan="2" style="font-weight: normal;">'),"signup"==r&&n.push("<i>Please provide the following information. "),n.push("</td>"),n.push("</tr>")}n.push('<tr class="register_taker_login_name_exists">'),n.push("<td>"),n.push("</td>"),n.push('<td colspan="2">'),n.push("<i>This login name exists."),"free_trial"==r||"free_trial"==a?n.push("Either log in to set up a free trial for your account or choose another name to set up a free trial for a new account</i>"):n.push("Either log in or choose another name</i>"),n.push("</td>"),n.push("</tr>"),n.push("<tr>"),n.push("<td>"),n.push("</td>"),n.push("<td>"),n.push('<label for="username">'),n.push("Login name"),n.push("</label>"),n.push("</td>"),n.push("<td>"),n.push(`<input type="text" class="register_taker_username" onchange="qwiz_qcards_common.register_taker_check_unique ('${e}', ${t}, 'username', '${a}', 'onchange')" onblur="qwiz_qcards_common.register_taker_check_unique ('${e}', ${t}, '${a}', 'username', 'onblur')" onfocus="qwiz_qcards_common.register_taker_hide_error ('${e}', ${t}, this);" /> <span class="qwiz-required">*</span>`),n.push('<div class="register_taker_username_errmsg qwiz_errmsg"></div>'),n.push("</td>"),n.push("</tr>"),n.push('<tr class="register_taker_first_name_last_name">'),n.push("<td>"),n.push("</td>"),n.push("<td>"),n.push('<label for="first_name">'),n.push("First name"),n.push("</label>"),n.push("</td>"),n.push("<td>"),n.push('<input type="text" class="register_taker_first_name" onfocus="qwiz_qcards_common.register_taker_hide_error (\''+e+"', "+t+', this);" /> <span class="qwiz-required">*</span>'),n.push('<div class="register_taker_first_name_errmsg qwiz_errmsg"></div>'),n.push("</td>"),n.push("</tr>"),n.push('<tr class="register_taker_first_name_last_name">'),n.push("<td>"),n.push("</td>"),n.push("<td>"),n.push('<label for="last_name">'),n.push("Last name"),n.push("</label>"),n.push("</td>"),n.push("<td>"),n.push('<input type="text" class="register_taker_last_name" onfocus="qwiz_qcards_common.register_taker_hide_error (\''+e+"', "+t+', this);" /> <span class="qwiz-required">*</span>'),n.push('<div class="register_taker_last_name_errmsg qwiz_errmsg"></div>'),n.push("</td>"),n.push("</tr>"),n.push("<tr>"),n.push("<td>"),n.push("</td>"),n.push("<td>"),n.push('<label for="password">'),n.push("Password"),n.push("</label>"),n.push("</td>"),n.push("<td>"),n.push('<input type="password" class="register_taker_password" onchange="qwiz_qcards_common.register_taker_check_password_match (\''+e+"', "+t+')" onfocus="qwiz_qcards_common.register_taker_hide_error (\''+e+"', "+t+', this);" /> <span class="qwiz-required">*</span>'),n.push('<div class="register_taker_password_errmsg register_taker_confirm_password_errmsg qwiz_errmsg"></div>'),n.push("</td>"),n.push("</tr>"),n.push('<tr class="register_taker_confirm_password register_taker_confirm_password_email">'),n.push("<td>"),n.push("</td>"),n.push("<td>"),n.push('<label for="confirm_password">'),n.push("Confirm password"),n.push("</label>"),n.push("</td>"),n.push("<td>"),n.push('<input type="password" class="register_taker_confirm_password" onchange="qwiz_qcards_common.register_taker_check_password_match (\''+e+"', "+t+')" onfocus="qwiz_qcards_common.register_taker_hide_error (\''+e+"', "+t+', this);" /> <span class="qwiz-required">*</span>'),n.push("</td>"),n.push("</tr>"),n.push('<tr class="register_taker_email register_taker_confirm_password_email">'),n.push("<td>"),n.push("</td>"),n.push("<td>"),n.push('<label for="email">'),n.push("Email"),n.push("</label>"),n.push("</td>"),n.push("<td>"),n.push(`<input type="text" class="register_taker_email" onchange="qwiz_qcards_common.register_taker_validate_email ('${e}', ${t}, false, true, '${a}')" onfocus="qwiz_qcards_common.register_taker_hide_error ('${e}', ${t}, this);" /> <span class="qwiz-required register_taker_email_required">*</span>`),n.push('<div class="register_taker_email_errmsg qwiz_errmsg"></div>'),n.push("</td>"),n.push("</tr>"),n.push("</tr>"),n.push('<td colspan="2">'),n.push("</td>"),n.push("<td>"),n.push('<span style="float: right;">'),n.push('<span class="qwiz-required ">*</span>'),n.push('<span class="qwiz-smaller">required</span>'),n.push("</span>"),n.push('<button type="submit" class="register_taker_submit qwiz_button">'),n.push('<span class="register_taker_login" style="font-size: 12pt !important;">'),n.push(qqc.T("Register")),n.push("</span>"),n.push("</button>"),n.push(" "),/register|free_trial/.test(r)&&!o||(n.push('<span class="qwiz_button" style="font-size: 9pt !important;" onclick="'+e+".no_login ("+t+', false, true, event)">'),n.push("Cancel"),n.push("</span>")),n.push("<br />"),n.push('<span class="register_taker_forgot_password">'),"not ready"==server_loc&&(secure_server_loc=qqc.get_qwiz_param("secure_server_loc")),n.push('<a href="'+secure_server_loc+'/password_reset_request" target="_blank">'),n.push("Forgot password?</a>"),n.push("</span>"),n.push("</td>"),n.push("</tr>"),n.push("<tr>"),n.push("<td>"),n.push("</td>"),n.push('<td colspan="2" class="register_taker_errmsg qwiz_errmsg">'),n.push("</td>"),n.push("</tr>"),n.push("</table>"),n.push("</form>"),qqc.$get_login_div(e,t).html(n.join("\n")).show();var _=qwiz_deck_selector(e,t);if(qqc.init_hide_show_password(_+"input.register_taker_password"),qqc.init_hide_show_password(_+"input.register_taker_confirm_password"),debug[0]){console.log("[create_register_taker_screen] (show email) display_pay_screen:",r);const e=$(_+"tr.register_taker_email");console.log("[create_register_taker_screen] $email:",e)}if($(_+"tr.register_taker_email").hide(),"subscribe"==r||"open_register"==r||"open_register"==a||"free_trial"==r||"free_trial"==a||"special_offer"==r){setTimeout((function(){$(_+"tr.register_taker_email").show(),$(_+".register_taker_username").val("")}),200)}else"signup"==r?($(_+"tr.register_taker_email").show(),$(_+".register_taker_reg_code").val("")):$(_+".register_taker_reg_code").val("");$("div.qwiz-usermenu_icon").removeClass("qwiz-icon-bounce")},this.register_taker_check_password_match=function(e,t){var s=qwiz_deck_selector(e,t);$(s+"button.register_taker_submit").prop("disabled",!0);setTimeout((function(){$(s+"button.register_taker_submit").prop("disabled",!1)}),1e3),$(s+".register_taker_password_errmsg").hide();var i=$(s+".register_taker_password").val();if(""!=i&&/[#?]/.test(i)){setTimeout((function(){$(s+".register_taker_password_errmsg").html("Note: Biomania app will not work with passwords containing “#” or “?”").show()}),20)}var a=$(s+"input.register_taker_confirm_password").val();if(a&&""!=i&&i!=a){return setTimeout((function(){$(s+".register_taker_password_errmsg").html("Password and Confirm password do not match").show()}),40),!1}},this.register_taker_check_reg_code=function(e,t,s){if(""==s){var i=qwiz_deck_selector(e,t);$(i+"tr.register_taker_first_name_last_name").show(),$(i+".register_taker_reg_code_class_name").html("").hide(),$(i+".register_taker_login_name_exists,"+i+" .register_taker_forgot_password").hide(),$(i+"span.register_taker_login").html(qqc.T("Register")),$(i+"tr.register_taker_confirm_password_email").show(),$(i+"tr.register_taker_please_continue_below").show(),$(i+".register_taker_email_required, "+i+"tr.register_taker_email").show(),register_taker_global_reg_code_ok_f=!1,qqc.register_taker_check_unique(e,t,"","username")}else{var a={reg_code:s,callback:"register_taker_reg_code_ok_or_no"};register_taker_global_in_process_b=!0,qqc.qjax(e,t,"","check_reg_code",a)}return!1},this.set_immediate_payment=function(e,t){var s=!1;return void 0===document_qwiz_immediate_payment?"qwiz_"==e&&(s=qwiz_.get_qwizdata(t,"immediate_payment")):s=document_qwiz_immediate_payment,s},this.register_taker_reg_code_ok_or_no=function(e){debug[0]&&console.log("[register_taker_reg_code_ok_or_no] data:",e),register_taker_global_reg_code_ok_f=1==e.num_rows;var t=qwiz_deck_selector(e.qname,e.i_qwiz);if(register_taker_global_reg_code_ok_f){$(t+".register_taker_if_your_teacher").hide(),$(t+"tr.register_taker_please_continue_below").hide(),$(t+"tr.register_taker_first_name_last_name").show(),"signup"!=set_display_pay_screen(e.qname,e.i_qwiz)&&$(t+".register_taker_email_required, "+t+"tr.register_taker_email").hide(),register_taker_global_reg_code_maker_id=e.maker_id,register_taker_global_reg_code_school_id=e.school_id,register_taker_global_reg_code_class_id=e.class_id,register_taker_global_reg_code_class_name=e.class_name,register_taker_global_reg_code_school_name=e.school_name,register_taker_global_reg_code_professor_f=e.professor_f,$(t+".register_taker_reg_code_class_name").html("<b>Registration for class "+register_taker_global_reg_code_class_name+", "+register_taker_global_reg_code_school_name+"</b>").show()}else{var s=e.errmsg?e.errmsg:"Could not find registration code";$(t+".register_taker_reg_code_errmsg").html(s).show(),$(t+".register_taker_reg_code_class_name").html("").hide()}register_taker_global_in_process_b=!1},this.register_taker_check_unique=function(e,t,s,i,a){debug[0]&&console.log("[register_taker_check_unique] field:",s,"which:",a);var r=qwiz_deck_selector(e,t),o=$(r+"input.register_taker_"+s).val();if(debug[0]&&console.log("[register_taker_check_unique] value:",o),o){if("username"==s){if(/["\\;]/.test(o))return $(r+".register_taker_username_errmsg").html("Invalid characters").show(),!1;if(/[#?]/.test(o))return $(r+".register_taker_username_errmsg").html("Note: Biomania app will not work with login names containing “#” or “?”").show(),!1}var n={field:s,value:o,login_alt:i,callback:"register_taker_unique_or_no"};register_taker_global_in_process_b=!0,qqc.qjax(e,t,"","check_taker_name_email_unique",n)}return!1},this.register_taker_unique_or_no=function(e){debug[0]&&console.log("[register_taker_unique_or_no] data:",e);var t=qwiz_deck_selector(e.qname,e.i_qwiz),s=e.field,i=e.unique_f;if("username"==s){var a=e.login_alt;get_qwizdeckdata(e.qname,e.i_qwiz,"display_pay_screen");register_taker_global_username_unique_f=i,0==i?(debug[0]&&console.log('[register_taker_unique_or_no] "username already in use"'),$(t+".register_taker_login_name_exists, "+t+".register_taker_forgot_password").show(),$(t+"tr.register_taker_first_name_last_name").hide(),$(t+"tr.register_taker_confirm_password_email").hide(),$(t+"span.register_taker_login").html(qqc.T("Log in")),$(t+".register_taker_password").focus()):($(t+"span.register_taker_login").html(qqc.T("Register")),$(t+".register_taker_username_errmsg").hide(),$(t+"tr.register_taker_first_name_last_name").show(),$(t+".register_taker_login_name_exists, "+t+".register_taker_forgot_password").hide(),$(t+"tr.register_taker_confirm_password").show(),"register"==a?$(t+"tr.register_taker_email").hide():$(t+"tr.register_taker_email").show(),$(t+".register_taker_first_name").focus())}else register_taker_global_email_unique_f=i,0==i&&(debug[0]&&console.log('[register_taker_unique_or_no] "email already in use"'),$(t+".register_taker_email_errmsg").html("Email already in use").show());register_taker_global_in_process_b=!1},this.register_taker=function(e,t,s,i){debug[0]&&console.log("[register_taker] register_taker_global_in_process_b:",register_taker_global_in_process_b);var a=0,r=function(){if(register_taker_global_in_process_b){if(debug[0]&&console.log("[delay_register_taker] n_tries:",a),a>40)return alert("Sorry, unable to process request"),!1;a++,setTimeout(r,250)}else qqc.register_taker2(e,t,s,i)};return setTimeout(r,250),!1},this.register_taker2=function(e,t,s,i){debug[0]&&console.log("[register_taker2] proceed_to_pay:",s);var a=!0,r=qwiz_deck_selector(e,t),o="";"register"==i&&(o=$(r+".register_taker_reg_code").val(),""==(o=qqc.trim(o))&&($(r+".register_taker_reg_code_errmsg").html("Please enter registration code").show(),a=!1)),""==(register_taker_global_username=$(r+".register_taker_username").val())&&($(r+".register_taker_username_errmsg").html("Please enter login name").show(),a=!1),/["\\;]/.test(register_taker_global_username)&&($(r+".register_taker_username_errmsg").html("Invalid characters").show(),a=!1);var n=$(r+".register_taker_password").val();""==n&&($(r+".register_taker_password_errmsg").html("Please enter password").show(),a=!1);var _=$(r+"input.register_taker_email").val();s||(s=register_taker_global_reg_code_professor_f);const c=$(r+"span.register_taker_login").html()==qqc.T("Log in");if(!c&&(!register_taker_global_reg_code_ok_f&&!s||1==register_taker_global_username_unique_f||""==register_taker_global_username)){(a=a&®ister_taker_global_username_unique_f)&&""!=register_taker_global_username&&!register_taker_global_username_unique_f&&($(r+".register_taker_username_errmsg").html("Login name already in use").show(),a=!1),""==(register_taker_global_first_name=$(r+".register_taker_first_name").val())&&($(r+".register_taker_first_name_errmsg").html("Please enter first name").show(),a=!1),""==(register_taker_global_last_name=$(r+".register_taker_last_name").val())&&($(r+".register_taker_last_name_errmsg").html("Please enter last name").show(),a=!1),!o||register_taker_global_reg_code_ok_f||register_taker_display_pay_screen||(a=!1,$(r+".register_taker_reg_code_errmsg").html("Could not find registration code").show());var d=set_display_pay_screen(e,t);if(!c)if(""==_?register_taker_global_reg_code_ok_f&&"signup"!=d||($(r+".register_taker_email_errmsg").html("Please enter email").show(),a=!1):register_taker_global_email_unique_f?a=qqc.register_taker_validate_email(e,t,a,!1,i):($(r+".register_taker_email_errmsg").html("Email already in use").show(),a=!1),""!=n)n!=$(r+"input.register_taker_confirm_password").val()&&($(r+".register_taker_password_errmsg").html("Password and Confirm password do not match").show(),a=!1);o||"signup"!=d||($(r+".register_taker_reg_code_errmsg").html("Please enter registration code").show(),$(r+".register_taker_reg_code_class_name").html("").hide()),a?"register"!=i||o||(a=confirm('You have not entered a registration code;\nyou will be an "independent student," not in a class.\n\nIs this OK? If not, click "Cancel" and enter a code.')):"qcard_"==e&&qcard_.set_container_width_height(t)}if(register_taker_global_sha3_password=CryptoJS.SHA3(n).toString(),a){const i=qqc.set_immediate_payment(e,t);var l={login_f:c?1:"",reg_code:o,school_id:register_taker_global_reg_code_school_id,username:register_taker_global_username,firstname:register_taker_global_first_name,lastname:register_taker_global_last_name,sha3_password:register_taker_global_sha3_password,email:_,register_v2:"1",payment_type_id:i?65:52,called_from:"register_taker2",callback:"taker_registered"};s&&(l.proceed_to_pay_f="1"),document_qwiz_subscription_id&&(l.subscription_id=document_qwiz_subscription_id,l.subscription="1"),debug[0]&&console.log("[register_taker2] data",l),qqc.qjax(e,t,"","new_student_registration",l)}return!1},this.register_taker_hide_error=function(e,t,s){var i=s.className.split(/\s+/)[0],a=qwiz_deck_selector(e,t);$(a+"."+i+"_errmsg").hide(),$(a+".register_taker_errmsg").hide()},this.taker_registered=function(e){debug[0]&&(console.log("[taker_registered] data:",e),console.log("[taker_registered] register_taker_global_reg_code_ok_f:",register_taker_global_reg_code_ok_f,", register_taker_global_username_unique_f:",register_taker_global_username_unique_f),console.log("[taker_registered] register_taker_display_pay_screen:",register_taker_display_pay_screen));var t=e.errmsg,s="";const i=e.qname,a=parseInt(e.i_qwiz);if(t)s="login unsuccessful"==t?"Incorrect username/password":"duplicate username"==t?"Login name is already in database":t;else{document_qwiz_user_logged_in_b=!0,document_qwiz_session_id=e.session_id,document_qwiz_username=register_taker_global_username,document_qwiz_school_id=e.school_id,document_qwiz_taker_id=e.taker_id,document_qwiz_email=e.email,document_qwiz_independent_taker_f=1==e.school_id,e.university_discount&&(document_qwiz_university_discount=!0),document_qwiz_good_through_date=e.good_through_date;$.cookie("qwiz_session_id",document_qwiz_session_id,{path:"/",expires:1}),document_qwiz_remember_f=!0,qqc.set_user_menus_and_icons();var r="";if(e.show_paypal_screen_f)if(document_qwiz_good_through_date){qqc.$get_login_div(i,a).html("<i>Sorry; a free trial subscription is not available to existing users</i>")}else qqc.create_paypal_subscription_screen(i,a);else{var o="";if(e.add_and_provide_f||e.login_f)if("open_register"==(r=get_qwizdeckdata(i,a,"display_pay_screen")))o=`<br />\n <b>Thanks! You now have a Learn-Biology.com account and your work will be saved.</b>\n <br />\n <br />\n <button class="qwiz_button" onclick="${i}.no_login (${a})">\n Continue\n </button>`;else{o=qqc.set_immediate_payment(i,a)?"<b>Thanks! You now have a Learn-Biology.com subscription.</b>":1==e.school_id?"<b>Thanks! You now have a free-trial subscription.</b>":"<b>Thanks! You now have a free account.</b>"}if("open_register"!=r&&get_qwizdeckdata(i,a,"pay_quiz_deck_id"))qwiz_&&qwiz_.any_pay_quiz_f&&qwiz_.pay_lock_settings(a,a,void 0,void 0,o),qcard_&&qcard_.any_pay_deck_f&&qcard_.pay_lock_settings(a,a,void 0,void 0,o);else{qqc.$get_login_div(i,a).html(o)}if(register_taker_global_reg_code_ok_f){e.login_f&&(register_taker_global_first_name=e.firstname,register_taker_global_last_name=e.lastname);var n={};n.First_name=[register_taker_global_first_name],n.Last_name=[register_taker_global_last_name];var _={userids:[document_qwiz_taker_id],usernames:[register_taker_global_username],passwords:[register_taker_global_sha3_password],custom_input_data:{input_field_names:["First_name","Last_name"],fields:n}};e.proceed_to_pay_f&&(_.proceed_to_pay_f=e.proceed_to_pay_f),qqc.input_data_to_db(i,a,register_taker_global_reg_code_maker_id,register_taker_global_reg_code_school_id,register_taker_global_reg_code_class_id,register_taker_global_reg_code_class_name,_),document_qwiz_class_id=register_taker_global_reg_code_class_id}}}if(s){var c=qwiz_deck_selector(i,a);$(c+".register_taker_errmsg").html(s).show()}return!1},this.special_offer_callback=function(e){debug[0]&&console.log("[special_offer_callback] data:",e);var t="<br /><br />";t+=qqc.set_immediate_payment(e.qname,e.i_qwiz)?"<b>Thanks! You now have a Learn-Biology.com subscription.</b>":"<b>Thanks! You now have a new free-trial subscription.</b>";qqc.$get_login_div("qwiz_",e.i_qwiz).html(t)},this.register_taker_validate_email=function(e,t,s,i,a){var r=qwiz_deck_selector(e,t),o=$(r+"input.register_taker_email").val();if(""!=o){/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i.test(o)?i&&qqc.register_taker_check_unique(e,t,"email",a,"email"):($(r+".register_taker_email_errmsg").html("Not a valid email address").show(),s=!1)}return s},this.input_data_to_db=function(e,t,s,i,a,r,o){debug[0]&&console.log("[input_data_to_db] taker_data:",o);var n={};n.qname=e,n.i_qwiz=t,n.class_id=a,n.class_name=r,n.school_id=i,n.maker_id=s,n.taker_data=o,n.callback="register_taker_input_data_to_db_callback",debug[0]&&console.log("[input_data_to_db] data:",n),qwiz_qcards_common.qjax(e,t,"","new_class",n)},this.register_taker_input_data_to_db_callback=function(e){if(debug[0]&&console.log("[input_data_to_db_callback] data:",e),e.error_f)alert("Sorry, registration did not work");else{const t=1==e.proceed_to_pay_f;register_taker_registered_feedback(e.qname,e.i_qwiz,!1,t)}},this.check_promo_code=function(e,t){var s=$("#"+e+"promo_code"+t+" input").val();if(""!=s){var i={qname:e,promo_code:s,pay_quiz_deck_id:get_qwizdeckdata(e,t,"pay_quiz_deck_id")};qqc.qjax(e,t,"","check_promo_code",i)}return!1},this.check_promo_code2=function(e){debug[0]&&console.log("[check_promo_code2] data:",e);var t=e.qname,s=e.i_qwiz,i=$("p#"+t+"promo_code"+s);e.errmsg?(i.find("span.promo_code_errmsg").html("<br />"+e.errmsg),i.find("span.promo_code_okmsg").html("")):(qqc.set_qwizdeckdata(t,s,"promo_code",e.promo_code),"qwiz_"==t?qwiz_.pay_lock_settings(s,s):qcard_.pay_lock_settings(s,s))},this.clear_promo_code_msgs=function(e,t){$("p#"+e+"promo_code"+t+" span.promo_code_msg").html("")},this.submit_for_payment=function(e,t,s){debug[0]&&console.log("[submit_for_payment] qname:",e,", i_qwiz:",t,", form_el:",s);var i=get_qwizdeckdata(e,t,"pay_quiz_deck_id"),a=s.os0.selectedIndex;if(-1==a){var r=qwiz_deck_selector(e,t);return $(r+" div.signup_confirm_email_errmsg").html("Please choose a payment option").show(),!1}if(!document_qwiz_session_id){r=qwiz_deck_selector(e,t);return $(r+" div.signup_confirm_email_errmsg").html("Sorry, login session not set. Please refresh this page in your browser and try again, or contact support@qwizcards.com").show(),!1}var o=get_qwizdeckdata(e,t,"taker_payment_type_ids")[a],n=s.os0.value;if(pay_qwiz_qdeck_=e,pay_i_qwiz_deck=t,n<=0)return!1;var _={m:0,pid:i,ptid:o,sid:document_qwiz_session_id,url:qqc.get_qwiz_param("url","./")};return debug[0]&&console.log("[submit_for_payment] custom_data:",_),s.custom.value=btoa(JSON.stringify(_)),!0},this.create_maker_pay_screen=function(e,t,s,i){var a=qqc.$get_login_div(e,s),r=[];if(t[s].pay_errmsg)r.push("<strong>"+t[s].pay_errmsg+"</strong><br />");else{i&&r.push("<strong>"+i+"</strong><br />");var o=t[s].maker_payment_type_ids.length;r.push('<form action="https://www.paypal.com/cgi-bin/webscr" onSubmit="return qwiz_qcards_common.submit_for_payment (\''+e+"', "+s+', this)" method="post" target="_blank">'),r.push('<input type="hidden" name="cmd" value="_s-xclick">'),r.push('<input type="hidden" name="hosted_button_id" value="QK2XZUEFF9RNS">'),r.push('<table class="pay_options">'),r.push("<tr>"),r.push("<td>"),r.push('<input type="hidden" name="on0" value="Options">'),o>1&&r.push("Please choose:"),r.push("</td>"),r.push("</tr>"),r.push("<tr>"),r.push("<td>"),r.push('<select name="os0" class="qwiz_paypal_select">');for(var n=0;n<o;n++){var _=t[s].maker_fees[n],c=t[s].maker_good_for_n_periodss[n],d=t[s].maker_good_for_periods[n],l=t[s].maker_payment_descriptions[n],u=qqc.currency(_)+" "+qqc.number_to_word(c)+" "+qqc.plural(d,d+"s",c);l&&(u+=" - "+l),r.push('<option value="'+_+'">'),r.push(u),r.push("</option>")}r.push("</select> "),r.push("</td>"),r.push("</tr>"),r.push("</table>"),r.push('<input type="hidden" name="currency_code" value="USD">'),r.push('<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_paynowCC_LG.gif" style="border: none;" name="submit" alt="PayPal - The safer, easier way to pay online!">'),r.push('<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">'),r.push('<input type="hidden" name="custom">'),r.push("</form>")}a.html(r.join("\n")).show()},this.submit_for_maker_payment=function(e,t,s){debug[0]&&console.log("[submit_for_maker_payment] qname:",e,", i_qwiz:",t,", form_el:",s);var i=get_qwizdeckdata(e,t,"pay_quiz_deck_id"),a=s.os0.selectedIndex,r={m:1,pid:i,ptid:get_qwizdeckdata(e,t,"maker_payment_type_ids")[a],sid:qqc.maker_session_id,url:qqc.get_qwiz_param("url","./")};return debug[0]&&console.log("[submit_for_maker_payment] custom_data:",r),s.custom.value=btoa(JSON.stringify(r)),pay_qwiz_qdeck_=e,pay_i_qwiz_deck=t,!0},this.payment_received=function(e,t,s,i){if(debug[0]&&console.log("[payment_received] no_set_f:",e,", confirm_email_errmsg:",i),i){var a=qwiz_deck_selector(t,s);return $(a+" div.signup_confirm_email_errmsg").html(i).show(),!1}if(e)pay_qwiz_qdeck_=t,pay_i_qwiz_deck=s;else{document_qwiz_email_confirm=1;const e=get_qwizdeckdata(t,s,"display_pay_screen");qwiz_&&qwiz_.any_pay_quiz_f&&(e&&(payment_received_f=!0),qwiz_.pay_lock_settings()),qcard_&&qcard_.any_pay_deck_f&&(e&&(payment_received_f=!0),qcard_.pay_lock_settings())}"qwiz_"==pay_qwiz_qdeck_?($("#qwiz_login-qwiz"+pay_i_qwiz_deck).hide(),-1==qwiz_.get_qwizdata(pay_i_qwiz_deck,"i_question")?($(".intro-qwiz"+pay_i_qwiz_deck).show(),qwiz_.position_show_next_button(pay_i_qwiz_deck)):qwiz_.login_ok_start_quiz(pay_i_qwiz_deck)):($("#qdeck_login-qdeck"+pay_i_qwiz_deck).hide(),qcard_.login_ok_start_deck(pay_i_qwiz_deck))},this.registration_complete=function(e,t,s,i){debug[0]&&console.log("[registration_complete] qname:",e,", i_qwiz:",t,", session_id:",s,", username:",i),document_qwiz_session_id=s,document_qwiz_username=i,document_qwiz_school_id=1,document_qwiz_independent_taker_f=1,("qwiz_"==e?qwiz_:qcard_).login_ok(t,s,0)},this.maker_login_registration_complete=function(e,t,s,i){debug[0]&&console.log("[maker_login_registration_complete] qname:",e,", i_qwiz:",t,", maker_session_id:",s,", username:",i),qqc.maker_session_id=s;$.cookie("maker_session_id",s,{path:"/",expires:1}),("qwiz_"==e?qwiz_:qcard_).hide_menu_and_display_login(t,!1,"maker_pay"),setTimeout((function(){alert("Admin registration/login successful")}),250)},this.set_login_expiry=function(){debug[0]&&console.log("[set_login_expiry]"),clearTimeout(document_qwiz_login_timeout),document_qwiz_login_timeout=setTimeout("qwiz_qcards_common.login_expired ()",864e5)},this.login_expired=function(){document_qwiz_user_logged_in_b=!1,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(),document_qwiz_pay_registration_date_unix=0;setTimeout((function(){document_qwiz_wp_user_session_id?alert(qqc.T("Score-recording authentication expired. Please re-load this page")):alert(qqc.T("Qwizcards login session expired. Please log in again"))}),20)},this.is_mobile=function(e){var t;return document_qwiz_force_mobile_f||(t="Disabled"!=e&&(window.innerWidth<961||window.innerHeight<450)),t},this.set_force_mobile=function(){parent!==window&&-1!=document.location.href.search(/(localhost|192.168.1.120|qwizcards.com|swinginghotspot.com)\/u\//)&&(document_qwiz_force_mobile_f=!0)},this.process_textentry_terms=function(e){debug[0]&&console.log("process_textentry_terms] data:",e.substr(0,50),"..."),terms={singular:[],plural:[]};for(var t=e.split(/\n|;/),s=t.length,i=0;i<s;i++){var a,r,o=t[i];if(-1!=o.search(/\S/)){var n=o.indexOf("/");if(-1==n){a=o;var _=o.length-1,c=o[_],d=o.substr(_-1);r="es"==d?o:"y"==c?o.substr(0,_)+"ies":"s"==c||"sh"==d||"ch"==d?o+"es":"x"==c?o:o+"s"}else a=o.substr(0,n),r=n==o.length-1?o.substr(0,n):o.substr(n+1);terms.singular.push([a,qqc.metaphone(a)]),terms.plural.push([r,qqc.metaphone(r)])}}return terms},this.process_inline_textentry_terms=function(e,t,s,i){s.additional_errmsgs=[];var a=extract_delete_shortcode_content(e,t,"add_terms"==t,s);if("NA"==a.content)return e;for(var r=[a.content],o=new RegExp('<a.*?href="([^"]*)"[\\s\\S]*?<\\/a>',"m");;){var n=r[0].match(o);if(!n)break;var _=n[1],c=qqc.get_textentry_terms(_,s);c&&(".txt"!=_.substr(_.length-4)||-1!=c.indexOf("[terms]")?(r_remote=extract_delete_shortcode_content(c,"terms",!1,s),"NA"==r_remote.content?s.additional_errmsgs.push(qqc.T("Did not find [terms]...[/terms] shortcode pair in file")+" "+_):r.push(r_remote.content)):r.push(c)),r[0]=r[0].replace(o,"")}return r=(r=r.join("")).replace(/<[^>]+>| /g,"\n"),s[i][t]=r,a.htm},this.sort_dedupe_terms_metaphones=function(e){var t=window.navigator.userLanguage||window.navigator.language;e.sort((function(e,s){return e[0].toLowerCase().localeCompare(s[0].toLowerCase(),t,{numeric:!0})}));for(var s=[e[0]],i=e.length,a=1;a<i;a++)e[a][0]!=e[a-1][0]&&s.push(e[a]);return s},this.get_textentry_terms=function(e,t){debug[0]&&console.log("[get_textentry_terms] terms_url:",e);var s=!1,i="";return $.ajax({type:"GET",async:!1,url:e,dataType:"text",error:function(i,a){t.additional_errmsgs.push(qqc.T("Could not read terms file")+": "+e),s=!0},success:function(e){i=e}}),s||i||t.additional_errmsgs.push(qqc.T("No data read from terms file")+": "+e),i},this.create_hangman_entry=function(e){var t='<span class="qwiz-hairsp"></span>',s=0;e&&(s=e.length);for(var i=[],a=0;a<s;a++)e[a].match(/[a-z0-9]/i)?i.push("<u>"+e[a]+"</u>"+t):" "==e[a]?i.push(" "+t):i.push(e[a]+t);e=i.join("");return debug[9]&&console.log("[create_hangman_entry] entry:",e),e},this.create_hangman_incorrect_chars_display=function(e,t,s){var i=e.length,a=[];0==t?a.push('<span class="hangman_incorrect_letters_exceeded inline-block entry">'):a.push('<span class="hangman_incorrect_letters_allowed inline-block entry">');for(var r=s?12:i,o=0;o<r;o++){var n=o<i?e[o]:'<span class="qwiz_spacer">x</span>';a.push(n),o+1==t&&a.push('</span><span class="hangman_incorrect_letters_exceeded inline-block entry">')}return a.push("</span>"),a="Incorrect: "+a.join("")},this.setCharAt=function(e,t,s){return t>e.length-1?e:e.substr(0,t)+s+e.substr(t+1)},this.make_inline=function(e,t){var s=e.substr(t),i=s.match(/<[hp][^>]*>/)[0],a=i[1];"h"==a&&(a+=i[2]);var r=qqc.add_attr_value("style","display: inline;",i);debug[9]&&console.log("[make_inline] new_tag:",r);var o=s.replace(i,r),n="</"+a+">";-1!=(o=r.replace(a,"div")+o).search(n)?o=o.replace(n,n+"</div>"):o+="</div>";var _="</"+a+">";return r="<"+a+' style="display: inline;">',e=(e=e.substr(0,t)+o).replace(/\[hangman[^\]]*\]/,_+"$&"+r),debug[9]&&console.log("[make_inline] htm:",e),e},this.add_attr_value=function(e,t,s){var i=new RegExp(e+"\\s*=\\s*[\"']","im"),a=s.match(i);return a?-1==s.search(t)&&(s=s.replace(i,a[0]+t+" ")):s=s.replace(">"," "+e+'="'+t+'">'),debug[0]&&console.log("[add_attr_value] attributes:",s),s},this.remove_tags_eols=function(e,t){return e&&(t&&(e=e.replace(/<img/g,"xXximg")),e=qqc.trim(e.replace(/<[^>]+>/g,"").replace(/\n| /g," ").replace(/ {2,}/g," ")),t&&(e=e.replace(/xXximg/g,"<img"))),e},this.q_and_a_hash=function(e){return e.length>200&&(e=e.substr(0,184)+"CRC32:"+qwiz_crc32(e)),e},this.init_enter_intercept=function(){init_enter_intercept_f||(init_enter_intercept_f=!0,$("html").on("keydown",(function(e){if(document_active_qwiz_qdeck&&13==e.keyCode){debug[7]&&(console.log("[init_enter_intercept] document_active_qwiz_qdeck:",document_active_qwiz_qdeck),console.log("[init_enter_intercept] e.target:",e.target));var t=e.target.tagName.toLowerCase();if("input"==t||"textarea"==t)if(-1==(i=e.target.id.toLowerCase()).indexOf("qwiz")&&-1==i.indexOf("qdeck"))return;if(-1!=e.target.className.indexOf("user_html"))if(-1==(i=e.target.id.toLowerCase()).indexOf("qwiz")&&-1==i.indexOf("qdeck"))return;var s=$(document_active_qwiz_qdeck);if(-1==document_active_qwiz_qdeck.className.toLowerCase().indexOf("qcard_window"))if(s.find("div.next_button").is(":visible"))debug[7]&&(console.log("[init_enter_intercept] qwiz next_button trigger"),console.log("[init_enter_intercept] $document_active_qwiz_qdeck.find ('div.next_button button'):",s.find("div.next_button button"))),qqc.next_button_active_b||s.find("div.next_button button").trigger("click");else if(s.find("div.textentry_check_answer_div").is(":visible")){debug[7]&&console.log("[init_enter_intercept] qwiz call text_entry_check_answer ()");var i=document_active_qwiz_qdeck.id,a=parseInt(i.substr(4),10);qwiz_.textentry_check_answer(a)}else s.find("button.login_button").is(":visible")?(debug[7]&&console.log("[init_enter_intercept] qwiz login_button trigger"),s.find("div.qwiz-login button.login_button").trigger("click")):s.find("button.begin_practice").is(":visible")?(debug[7]&&console.log("[init_enter_intercept] qwiz begin_practice trigger"),s.find("div.qwiz-login button.begin_practice").trigger("click")):s.find(".exit_progress_bars").is(":visible")&&(debug[7]&&console.log("[init_enter_intercept] qwiz exit_progress_bars trigger"),s.find("div.qwiz-login button.exit_progress_bars").trigger("click"));else if(!qcard_.qwizard_b){if(-1!=e.target.className.indexOf("flip"))return;s.find("button.login_button").is(":visible")?(debug[7]&&console.log("[init_enter_intercept] qdeck login_button trigger"),s.find("button.login_button").trigger("click")):s.find("button.begin_practice").is(":visible")?(debug[7]&&console.log("[init_enter_intercept] qdeck begin_practice trigger"),s.find("div.button.begin_practice").trigger("click")):s.find(".exit_progress_bars").is(":visible")?(debug[7]&&console.log("[init_enter_intercept] qdeck exit_progress_bars trigger"),s.find(".exit_progress_bars").trigger("click")):s.find("div.qcard_next_buttons button.flip.qwiz_button").length&&(debug[7]&&(console.log("[init_enter_intercept] qdeck Check answer trigger"),console.log("[init_enter_intercept] find:",s.find("div.qcard_next_buttons button.flip"))),s.find("div.qcard_next_buttons button.flip").trigger("click"))}}})))},this.$get_login_div=function(e,t){var s;return"qwiz_"==e?(s="#qwiz_login-qwiz"+t,$("#progress-qwiz"+t).html("")):(s="div.qcard_card-qdeck"+t+" div.qcard-front div.qcard_content_size",$("#progress-qdeck"+t).html("")),$(s)},this.get_attr=function(e,t){var s="",i=new RegExp("(\\s|^)"+t+'\\s*=\\s*("([^"]+)")*',"m"),a=e.match(i);return a&&a[3]&&(s=qqc.trim(a[3])),s},this.opening_tag_shortcode_pos=function(e,t){e=e.replace(/([\[\]\*])/g,"\\$1");var s=new RegExp("(<[^\\/][^>]*>\\s*)*?"+e+"[\\s\\S]*"),i=t.search(s);if(-1==i)i=t.length;else{var a=new RegExp(e),r=t.search(a),o=!1,n=t.substring(i,r).lastIndexOf("<img");-1!=n&&(i+=n+3,o=!0);var _=t.substring(i,r).lastIndexOf("<input");-1!=_&&(i+=_+3,o=!0);var c=t.substring(i,r).lastIndexOf('<span class="qwizard_placeholder">');-1!=c&&(i+=c+3,o=!0);var d,l=t.substring(i,r).lastIndexOf("<br");if(-1!=l&&(i+=l+3,o=!0),-1!=(d=t.substring(i,r).lastIndexOf("<video"))&&(i+=d+3,o=!0),-1!=(d=t.substring(i,r).lastIndexOf("<iframe"))&&(i+=d+3,o=!0),o)i+=t.substr(i).search(s)}return i},this.replace_smart_quotes=function(e){var t=e.replace(/[\u201C\u201D\u2033\u00AB\u00BB]/gm,'"');return t=(t=(t=t.replace(/[\u2018\u2019]/gm,"'")).replace(/ |\u000A0/gm," ")).replace(/–|\u2013/gm,"-")},this.balance_closing_tag=function(e){var t=e.search(/<\/[ph]/);if(-1!=t){var s,i=e.substr(t+2,2);s=">"==i.substr(1)?"<p":"<"+i;var a=new RegExp(s),r=e.search(a);(-1==r||r>t)&&(e=s+">"+e)}return e},this.remove_unmatched_tag=function(e,t,s){var i=e,a=e.split(/(<[ph][^>]*>[^]*?<\/[ph][^>]*>)/),r=a.length,o=a[r-1],n=o.replace(/<\/{0,1}[ph][^>]*>/g,""),_=!0;if(-1!=o.search(/<\/{0,1}[ph]/)&&!(s&&-1==o.search(/<[ph]/)||t&&-1==o.search(/<[ph]/)||-1==n.search(/\S/))){var c=new RegExp(/<[ph][^>]*>/),d=o.match(c),l="<p>",u=-1;if(d)l=d[0],u=o.search(c);else if(r>1){(d=a[r-2].match(c))&&(l=d[0])}if(-1!=u){var p,g=new RegExp(/<\/{0,1}([ph][^>\s]*)/);l?p=l.match(g)[1]:l="<"+(p=o.match(g)[1])+">";var h,q="</"+p+">",m=o.split(c,2);sub_piece1=m[0].replace(/<\/{0,1}[ph][^>]*>/g,""),sub_piece2=m[1].replace(/<\/{0,1}[ph][^>]*>/g,""),h=-1!=l.search("class")?l.replace(/class\s*=\s*"/,'class="qwiz-inline '):"<"+p+' class="qwiz-inline">',sub_piece1=add_span_if_empty(sub_piece1),sub_piece2=add_span_if_empty(sub_piece2),sub_piece1&&(sub_piece1=h+sub_piece1+q),sub_piece2&&(sub_piece2=h+sub_piece2+q),n=sub_piece1,sub_piece1&&sub_piece2&&(n+=l+add_span_if_empty("",!0)+q),n+=sub_piece2,_=!1}}return _&&(n='<p class="qwiz-inline">'+add_span_if_empty(n,!0)+"</p>"),e=a.slice(0,r-1).join("")+n,debug[0]&&e!=i&&(console.log("[remove_unmatched_tag] part_orig:",i),console.log("[remove_unmatched_tag] part: ",e)),e},this.number_to_word=function(e){return number_word||(number_word=[qqc.S("zero"),qqc.S("one"),qqc.S("two"),qqc.S("three"),qqc.S("four"),qqc.S("five"),qqc.S("six"),qqc.S("seven"),qqc.S("eight"),qqc.S("nine"),qqc.S("ten")]),e>10?e.toString():number_word[e]},this.number_to_ordinal_word=function(e,t){var s;if(ordinal_words||(ordinal_words=[qqc.T("zeroth"),qqc.T("first"),qqc.T("second"),qqc.T("third"),qqc.T("fourth"),qqc.T("fifth"),qqc.T("sixth"),qqc.T("seventh"),qqc.T("eighth"),qqc.T("ninth"),qqc.T("tenth"),qqc.T("eleventh"),qqc.T("twelfth"),qqc.T("thirteenth")]),e<14)s=ordinal_words[e];else{var i=e%10;s=1==i?e+"st":2==i?e+"nd":3==i?e+"rd":e+"th"}return t&&(s=qqc.capitalize(s)),s},this.capitalize=function(e){return e=e.substr(0,1).toUpperCase()+e.substr(1)},this.plural=function(e,t,s){return 1==s?e:t},this.S=function(e){return qqc.T(e)},this.T=function(e){var t="";return"undefined"!=typeof qwiz_params?void 0!==qwiz_params.T&&(e=htmlDecode(e),void 0!==qwiz_params.T[e]&&(t=qwiz_params.T[e])):"undefined"!=typeof qwizzled_params&&void 0!==qwizzled_params.T&&(e=htmlDecode(e),void 0!==qwizzled_params.T[e]&&(t=qwizzled_params.T[e])),""==t&&(t=e),t},this.currency=function(e){if(0==e)return"$0.00";var t=""+parseInt(100*e+.5,10),s=t.length;return"$"+t.substr(0,s-2)+"."+t.substr(s-2)},this.get_qwiz_param=function(e,t){var s="";return"undefined"!=typeof qwiz_params?void 0!==qwiz_params[e]&&(s=qwiz_params[e]):"undefined"!=typeof qwizzled_params&&void 0!==qwizzled_params[e]&&(s=qwizzled_params[e]),s||null!=t&&(s=t),s},this.trim=function(e){return e&&(e=e.toString(),e="a".trim?e.trim():e.replace(/^\s+|\s+$/g,"")),e},this.add_script=function(e){var t=document.createElement("script");t.setAttribute("charset","utf-8"),t.src=e;var s=[];try{s=$("head")}catch(e){}s.length?s.append(t):$("body").append(t)},this.dataset_units_topics_toggle_all=function(e){$(e).parents("table.dataset_units_topics").find("input:checkbox").prop("checked",e.checked),e.checked?$(e).attr("checked",!0):$(e).removeAttr("checked")},this.dataset_unit_toggle_topics=function(e){var t=$(e).parents("tr.unit_head").attr("id").match(/-unit([0-9]+)/)[1];$(e).parents("table.dataset_units_topics").find("tr.unit_topic"+t+" input:checkbox").prop("checked",e.checked),e.checked?$(e).attr("checked",!0):$(e).removeAttr("checked")};var n_dataset_units_expanded=[];function separate_combo(e,t,s){var i=e.split("[qQq]"),a=t.split("[qQq]");const r=i.length;e=[];for(var o=[],n=[],_=[],c=0;c<r;c++)"Q"==a[c]?(e.push(i[c]),o.push(s[c])):(n.push(i[c]),_.push(s[c]));const d=e.length;e=e.join("");const l=n.length;return[e,o,d,n=n.join(""),_,l]}function combo_switch(e,t,s,i){const a=$(`#qwiz${s}`),r=$(`#qcard_window-qdeck${i}`);t!=e&&("Q"==t?(a.css({display:"block"}),r.css({display:"none"})):(r.css({display:"block"}),a.css({display:"none"})))}function filter_maker_specific_questions_cards(e,t){var s=e.split("[qQq]"),i=[],a={};for(var r of s){var o="",n="",_=r.match(/\[(<code><\/code>)*q\s*([^\]]*)\]/gm);if(_&&_.length){var c=_[0];c=qqc.replace_smart_quotes(c),o=qqc.get_attr(c,"unit"),n=qqc.get_attr(c,"topic")}o||(o="Other"),n||(n="Other");var d=o+"__"+n;void 0===a[d=d.replace(/[^a-z0-9 ]/gi,"_")]&&(a[d]=0),(void 0===maker_specific_n_qs_by_unit_topic||a[d]<maker_specific_n_qs_by_unit_topic[d])&&(i.push(r),a[d]++)}const l=i.length;if(t<l){const e=l-t;for(var u=0;u<e;u++){const e=i.length,t=Math.floor(Math.random()*e);i.splice(t,1)}}return i.join("")}function insert_dataset_questions(e,t,s){for(var i=t.split("[qQq]"),a=i.length,r={},o=0;o<a;o++){r[parse_dataset_question_ids(i[o],"dataset_id")[0]]=o}var n=e.match(/\[q[^\]]* use_dataset_(question|card)\s*=\s*\S[^\]]+/g);a=n.length;for(ii=0;ii<a;ii++){o=r[qqc.replace_smart_quotes(n[ii]).match(/use_dataset_[^"]+"([^"]+)/)[1]];e=e.replace(/\[q([^\]]* )use_dataset_(question|card)\s*=\s*[^\]]+\]/,i[o])}var _="qwiz_"==s?"use_dataset_question":"use_dataset_card";return e=e.replace(/dataset_id/g,_)}function parse_dataset_question_ids(e,t){var s=new RegExp(t+"\\s*=\\s*\\S[^\\]]+","g"),a=e.match(s),r=a.length,o=[];for(i=0;i<r;i++){var n=qqc.replace_smart_quotes(a[i]).match(/"([^"]+)/)[1];o.push(n)}return o}function start_dataset_questions_countdown(e,t,s,i,a,r){var o=$("#dataset_questions_countdown_display-"+e+t),n=31,_=function(){if(--n>0){var c=qqc.T("Trying for")+" "+n+" "+qqc.T("more")+" "+qqc.plural(qqc.T("second"),qqc.T("seconds"),n)+"...";o.html(c),dataset_questions_countdown_timeout[e+t]=setTimeout(_,1e3)}else{$("#dataset_questions_spinner-"+e+t).css({visibility:"hidden"});var d="qwiz_"==e?qqc.T("questions"):qqc.T("cards"),l=`'${qqc.addSlashes(s)}', '${e}', ${t}, '${qqc.addSlashes(i)}', ${a}, ${r}, 0, ''`;c=qqc.T("Sorry, could not get")+" "+d+"<br /><br />"+`<button class="qwiz_button begin_practice" onclick="qwiz_qcards_common.begin_dataset_quiz_deck (${l})">`+qqc.T("Try again")+"</button>";o.html(c),dataset_questions_countdown_timeout[e+t]="fail"}};_()}function get_qwizdeckdata(e,t,s){return"qwiz_"==e?qwiz_.get_qwizdata(t,s):qcard_.get_deckdata(t,s)}function parse_html_block_pattern(e){var t="("+e.join(")|(")+")";return t="(("+(t=t.replace(/([\[\]\*])/g,"\\$1"))+")\\s*)"}function select_text(e){if(document.body.createTextRange)(t=document.body.createTextRange()).moveToElementText(e),t.select();else if(window.getSelection){var t,s=window.getSelection();(t=document.createRange()).selectNodeContents(e),s.removeAllRanges(),s.addRange(t)}}this.dataset_unit_expand_collapse=function(e,t,s){$icon_el=$(s);var i=$icon_el.parents("tr.unit_head").attr("id").match(/-unit([0-9]+)/)[1],a=$icon_el.parents("table.dataset_units_topics").find("tr.unit_topic"+i);$icon_el.hasClass("expand")?($icon_el.removeClass("expand").addClass("collapse").attr("src",icon_collapse_src),a.show(),void 0===n_dataset_units_expanded[t]?n_dataset_units_expanded[t]=1:n_dataset_units_expanded[t]++,$icon_el.parents("table.dataset_units_topics").find("span.topics_header").css({visibility:"visible"}),$icon_el.parents("table.dataset_units_topics").find("span.units_header").css({"vertical-align":"top"})):($icon_el.removeClass("collapse").addClass("expand").attr("src",icon_expand_src),a.hide(),n_dataset_units_expanded[t]--,0==n_dataset_units_expanded[t]&&($icon_el.parents("table.dataset_units_topics").find("span.topics_header").css({visibility:"hidden"}),$icon_el.parents("table.dataset_units_topics").find("span.units_header").css({"vertical-align":"bottom"}))),"qcard_"==e&&qcard_.set_container_width_height(t)},this.begin_dataset_quiz_deck=function(e,t,s,i,a,r,o,n,_,c){var d=e.split("; "),l=i.split("; ");c&&(c=c.split("; "));var u=d.length,p=[],g=[];for(let e=0;e<u;e++)if(p.push([]),g.push([]),c){c&&"F"==c[e]&&(qcard_.set_deckdata(0,"qrecord_id",l[e]),qcard_.set_deckdata(0,"combo",!0),qcard_.set_deckdata(0,"combo_i_qwiz",s)),qwiz_.set_qwizdata(s,"combo_i_deck",0)}var h=$("#dataset_units_topics-"+t+s+" tr.unit_topic");if(h.length)h.each((function(){if($tr=$(this),$tr.find("input:checkbox").prop("checked")){var e=0;$tr.find("td.nquestions").each((function(){let t=$(this),s=t.data("unit"),i=t.data("topic");p[e].push(s),g[e].push(i),e++})),$tr.prev("tr.unit_head").find("input:checkbox").prop("checked",!0)}}));else for(let e=0;e<u;e++)p[e].push(btoa("Other")),g[e].push(btoa("Other"));if(debug[11]&&(console.log("[begin_dataset_quiz_deck] selected_units:",p),console.log("[begin_dataset_quiz_deck] selected_topics:",g)),0==p[0].length)return alert(qqc.T("Please select at least one unit/topic")),!1;record_units_topics_state(t,s);var q=$("#dataset_reset_questions_date_"+t+s).val();q==n&&(q=""),r||(r=$("#dataset_max_q_"+t+s).val()),o||(o=$('input[name="spaced_repetition"]:checked').val()),_||(_=0);var m=get_qwizdeckdata(t,s,"random_b");i&&document_qwiz_user_logged_in_b||r<a&&(m=!0),qqc.get_dataset_questions(e,t,s,i,p,g,r,o,m,!1,!1,q,_,a,c)},this.parse_use_dataset=function(e){var t=[],s=[],i=[];const a=e.split(";");for(var r of a){const e=r.split(/\|\s*unit:/i);for(var o of(t.push(e[0].trim()),e.slice(1))){const e=o.split(/\|\s*topic:/i);var n=e[0].trim().replace(/ /g,"_");if(n="%"+n,1==e.length)s.push(n),i.push("*");else for(var _ of e.slice(1)){var c=_.trim().replace(/ /g,"_");c="%"+c,s.push(n),i.push(c)}}}return[t=t.join(";"),s,i]},this.get_dataset_questions=function(e,t,s,i,a,r,o,n,_,c,d,l,u,p,g){if(debug[11]&&(console.log("[get_dataset_questions] dataset:",e),console.log("[get_dataset_questions] qrecord_id:",i),console.log("[get_dataset_questions] units:",a),console.log("[get_dataset_questions] topics:",r),console.log("[get_dataset_questions] q_fs:",g)),!c){var h="qwiz_"==t?"questions":"cards";plugin_url||(plugin_url=qqc.get_qwiz_param("url","./"));var q='<div id="dataset_questions_spinner-'+t+s+'" style="margin-top: 100px;" >Getting '+h+' from Qwizcards server...<br /><img src="'+(plugin_url+"images/spinner40x40.gif")+'" class="qwiz-center" /><br /></div><p id="dataset_questions_countdown_display-'+t+s+'" style="text-align: center;"></p>';qqc.$get_login_div(t,s).html(q).show();dataset_questions_countdown_timeout[t+s]=setTimeout((function(){start_dataset_questions_countdown(t,s,e,i,o,n)}),5e3)}var m="";void 0!==document_qwiz_session_id&&(m=document_qwiz_session_id);var f=window.location.href,w=_?1:0,b="qwiz_"==t&&qwiz_.wordpress_page_f?1:0,v={action:"get_dataset_questions",dataset:e,qname:t,i_qwiz_qdeck:s,units:a,topics:r,n_questions_in_set:o,questions_to_do:n,random_f:w,qf_f:b,qwiz_session_id:m,page_url:f};if(c){var k=parse_dataset_question_ids(c,"qwiz_"==t?"use_dataset_question":"use_dataset_card");v.use_dataset_question_ids=k,v.maker_session_id="qwiz_"==t&&qwiz_.qwizard_b?qwizzled.maker_session_id:0}d&&(v.no_display_f=1),l&&(v.dataset_reset_questions_date=l),u&&(v.maker_specific_questions_cards=u),p&&(v.n_qs=p),g&&(v.q_fs=g);let z=selected_levels[t+s];z&&z.length>1&&(v.selected_levels=z);var y=qqc.get_qwiz_param("ajaxurl","");debug[11]&&(console.log("[get_dataset_questions] data:",v),console.log("[get_dataset_questions] local_ajaxurl:",y)),y?(v.qrecord_id=i,$.ajax({type:"POST",url:y,data:v,success:qqc.receive_and_place_dataset_questions})):(v.callback="receive_and_place_dataset_questions",v.units=btoa(JSON.stringify(v.units)),v.topics=btoa(JSON.stringify(v.topics)),v.use_dataset_question_ids=btoa(JSON.stringify(v.use_dataset_question_ids)),qqc.qjax(t,s,i,"get_dataset_questions_v3",v))},this.receive_and_place_dataset_questions=function(response){if(debug[11]&&console.log("[receive_and_place_dataset_questions] response:",response),response){var dataset=response.dataset,ok_f=response.ok_f,qname=response.qname,i_qwiz_qdeck=response.i_qwiz_qdeck,no_display_f=response.no_display_f,n_questions_in_set=response.n_questions_in_set,maker_specific_questions_cards=parseInt(response.maker_specific_questions_cards),n_qs=parseInt(response.n_qs);if("fail"!=dataset_questions_countdown_timeout[qname+i_qwiz_qdeck]){if(response.cv_index&&qwiz_.set_qwizdata(i_qwiz_qdeck,"cv_index",response.cv_index),response.rvt&&(qwiz_.set_qwizdata(i_qwiz_qdeck,"random_b",!0),qwiz_.set_qwizdata(i_qwiz_qdeck,"repeat_incorrect_b",!1)),0==ok_f){var errmsg=response.errmsg;if(errmsg){if(qqc.isInteger(errmsg)){var beg_time_unix=errmsg,beg_date=DateFormat.format.date(1e3*beg_time_unix,"h:mm a");errmsg="Test will be available at "+beg_date+'<br /><br /><button class="qwiz_button" onclick="'+qname+".next_question ("+i_qwiz_qdeck+')"><span id="next_button_text-qwiz'+i_qwiz_qdeck+'">'+qqc.T("Start quiz")+"</span></button>\n"}else if("Quiz completed"==errmsg||"Quiz not available"==errmsg||"Quiz no longer available"==errmsg){var dataset_intro_f=qwiz_.get_qwizdata(i_qwiz_qdeck,"dataset_intro_f");if((!dataset_intro_f||"topics_only"==dataset_intro_f)&&dataset){if("Quiz not available"==errmsg&&(errmsg+='</span><br /><button class="qwiz_button" onclick="'+qname+".next_question ("+i_qwiz_qdeck+')"><span id="next_button_text-qwiz'+i_qwiz_qdeck+'">'+qqc.T("Try again")+"</span></button><span>\n"),qwiz_.set_qwizdata(i_qwiz_qdeck,"dataset_intro_f","topics_only"),qwiz_.set_qwizdata(i_qwiz_qdeck,"dataset_intro_info_only_msg",errmsg),/\|\s*unit:/.test(dataset))var[dataset,units,topics]=qqc.parse_use_dataset(dataset);else var units=[],topics=[];return get_dataset_units_topics(qname,i_qwiz_qdeck,response.qrecord_id,dataset,units,topics),!1}}}else{var no_datasets=response.no_datasets;if(no_datasets.length)errmsg="Could not find dataset(s): "+no_datasets.join(", ");else{var s=-1!=dataset.indexOf(";")?"s":"";errmsg="Permission needed for questions from dataset"+s+" "+dataset+" (see qwizcards.com/admin/manage_datasets.php)"}alert(errmsg)}clearTimeout(dataset_questions_countdown_timeout[qname+i_qwiz_qdeck]);var $use_dataset_options_div=qqc.$get_login_div(qname,i_qwiz_qdeck);return $use_dataset_options_div.html("<br /><b>"+errmsg+"</b>").show(),!1}!qwiz_.preview&&response.rvt&&eval(atob(response.rvt));var n_questions=response.n_questions,questions_html=response.questions_html,questions_q_f=response.questions_q_f,question_qrecord_ids=response.question_qrecord_ids,card_qrecord_ids,use_dataset_questions_f=response.use_dataset_questions_f;if(clearTimeout(dataset_questions_countdown_timeout[qname+i_qwiz_qdeck]),0==n_questions){var dataset_intro_f=qwiz_.get_qwizdata(i_qwiz_qdeck,"dataset_intro_f");if(dataset_intro_f){var msg;msg="qwiz_"==qname?qqc.T("There are no questions available of the type you selected"):qqc.T("There are no cards available of the type you selected"),alert(msg),qqc.create_use_dataset_options3(dataset_units_topics_data,qname,i_qwiz_qdeck)}else{var msg=qqc.T("Sorry, could not get questions"),$use_dataset_options_div=qqc.$get_login_div(qname,i_qwiz_qdeck);$use_dataset_options_div.html("<br /><b>"+msg+"</b>").show()}return!1}questions_html=qqc.decodeHtmlEntities(questions_html);var cards_html="",n_cards=0;if(questions_q_f&&([questions_html,question_qrecord_ids,n_questions,cards_html,card_qrecord_ids,n_cards]=separate_combo(questions_html,questions_q_f,question_qrecord_ids)),"qwiz_"==qname&&n_questions){if(1==use_dataset_questions_f){var htm=qwiz_.get_qwizdata(i_qwiz_qdeck,"use_dataset_questions_htm");if(questions_html=insert_dataset_questions(htm,questions_html,qname),no_display_f)return}else questions_html=maker_specific_questions_cards?filter_maker_specific_questions_cards(questions_html,n_questions_in_set):questions_html.replace(/\[qQq\]/g,"");n_qs&&qwiz_.set_qwizdata(i_qwiz_qdeck,"n_qs",n_qs);var new_htm=qwiz_.process_questions(questions_html,"",i_qwiz_qdeck,void 0,qwiz_.qwizard_b,!1,question_qrecord_ids);qwiz_.display_progress(i_qwiz_qdeck);var $login_div=$("#qwiz_login-qwiz"+i_qwiz_qdeck).hide(),$questions=$("#dataset_questions-qwiz"+i_qwiz_qdeck),typeset_latex_f;if(qwiz_.init_question_order(i_qwiz_qdeck),[new_htm,typeset_latex_f]=qqc.qlatex_convert(new_htm),$questions.html(new_htm),qwiz_.preview&&(qwiz_.init_preview(i_qwiz_qdeck),response.rvt)){var delay_setp=function(){eval(atob(response.rvt))};setTimeout(delay_setp,500)}if(qwiz_.qwizard_b){qwizard.questions_list_html();var ii_question=qwiz_.no_intro_b[i_qwiz_qdeck]?-1:0;qwizard.highlight_accordion_question(ii_question)}if(qwiz_.init_textentry_autocomplete($questions),$questions.find(".wp-audio-shortcode").css({visibility:"visible"}),"undefined"!=typeof Prism){const e=$questions[0];Prism.highlightAllUnder(e)}else"undefined"!=typeof hljs&&$questions.find("code").each((function(e,t){hljs.highlightBlock(t),this.style.display="inline-block"}));if(typeset_latex_f&&qqc.qlatex_init($questions),response.run_get_dataset_units_topics_f){if(/\|\s*unit:/.test(dataset))var[dataset,units,topics]=qqc.parse_use_dataset(dataset);else var units=[],topics=[];get_dataset_units_topics(qname,i_qwiz_qdeck,response.qrecord_id,dataset,units,topics,"restore_topic_question_counts")}else qwiz_.set_qwizdata(i_qwiz_qdeck,"login_show_b",!1),qwiz_.get_qwizdata(i_qwiz_qdeck,"bck_f")&&(qwiz_.set_qwizdata(i_qwiz_qdeck,"bck_f",!1),qwiz_.reset_counters(i_qwiz_qdeck)),qwiz_.set_qwizdata(i_qwiz_qdeck,"i_question",-1),qwiz_.preview||qwiz_.next_question(i_qwiz_qdeck,!0,!0),qwiz_.next_question_from_intro(i_qwiz_qdeck,0)}if("qwiz_"==qname&&0==n_questions&&(qwiz_.set_qwizdata(i_qwiz_qdeck,n_questions_done,0),qwiz_.set_qwizdata(i_qwiz_qdeck,n_questions_for_done,0)),"qcard_"==qname||cards_html&&n_cards){var i_deck=i_qwiz_qdeck;if(cards_html&&(questions_html=cards_html,i_deck=0),1==use_dataset_questions_f){var htm=qcard_.get_deckdata(i_deck,"use_dataset_card_html");if(questions_html=insert_dataset_questions(htm,questions_html,qname),no_display_f)return}else questions_html=questions_html.replace(/\[qQq\]/g,"");var card_tags=questions_html.match(/\[q[^\]]*\]/gm);qcard_.process_card_attributes(i_deck,card_tags);var n_cards=qcard_.process_cards(questions_html,i_deck,void 0,qcard_.qwizard_b,card_qrecord_ids);if(qcard_.set_deckdata(i_deck,"n_cards",n_cards),qcard_.set_deckdata(i_deck,"n_to_go",n_cards),qcard_.init_card_order(i_deck),$("#qcard_next_buttons-qdeck"+i_deck).css("visibility","visible"),qcard_.set_deckdata(i_deck,"bck_f",!1),qcard_.qwizard_b&&(qwizard.set_qwizard_data("n_questions",n_cards),qwizard.cards_list_html(),qwizard.highlight_accordion_question(0)),qcard_.set_deckdata(i_deck,"no_flip_b",!1),0==use_dataset_questions_f||qcard_.no_intro_b[i_deck]||1==n_cards)qcard_.start_deck2(i_deck,void 0,!0);else{var intro_html=qcard_.get_deckdata(i_deck,"intro_html");qcard_.qwizard_b?(qcard_.set_editable_parts_front(i_deck,intro_html),qwizard.highlight_accordion_question(-1)):(qcard_.get_card_front(i_deck,-1).html(intro_html),qcard_.set_deckdata(i_deck,"no_flip_b",!0)),qcard_.qwiz_icon_stop_propagation(i_deck),qcard_.set_container_width_height(i_deck)}}if(questions_q_f&&0==n_cards){var i_deck=0;qcard_.set_deckdata(i_deck,"n_cards",0),qcard_.set_deckdata(i_deck,"n_to_go",0)}questions_q_f&&qqc.combo_next("",i_qwiz_qdeck,i_deck)}}},this.combo_next=function(e,t,s,i){var a=qwiz_.get_qwizdata(t,"n_correct");qwiz_.get_qwizdata(t,"repeat_incorrect_b")||(a+=qwiz_.get_qwizdata(t,"n_incorrect"));const r=qwiz_.get_qwizdata(t,"n_questions_for_done")-a,o=qcard_.get_deckdata(s,"n_cards"),n=qcard_.get_deckdata(s,"n_to_go"),_=r+n;var c;if(0==_)c="Q";else{const e=r/_;c=Math.random()<e?"Q":"F"}combo_switch(e,c,t,s),"Q"==c?a>0&&qwiz_.next_question(t,!0,!0,!0):o>n&&qcard_.next_card(s,i,!0)},this.qlatex_convert=function(e){var t;return/\[qlatex|\[latex\]/.test(e)?(e=(e=e.replace(/\[qlatex\]/g,"\\[").replace(/\[\/qlatex\]/g,"\\]")).replace(/\[qlatexinline\]|\[latex\]/g,"\\(").replace(/\[\/qlatexinline\]|\[\/latex\]/g,"\\)"),t=!0):t=/\\[(\]]/.test(e),[e,t]},this.qlatex_init=function(e){if(!window.MathJax){debug[0]&&console.log("[qwiz_mathjax.js] (load MathJax)");var t=document.createElement("script");t.src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js",document.head.appendChild(t)}var s=0;const i=function(){if(debug[0]&&console.log("[qlatex_init > delay_qwiz_mathjax_config] window.MathJax:",window.MathJax),window.MathJax&&window.MathJax.version){"2"==MathJax.version[0]?MathJax.Hub.Queue(["Typeset",MathJax.Hub],e[0]):MathJax.typeset()}else++s<20?setTimeout(i,200):console.log("[qlatex_init] unable to configure MathJax")};setTimeout(i,10)},this.restore_topic_question_counts=function(e){debug[0]&&console.log("[restore_topic_question_counts] data:",e);for(var t=e.i_qwiz_qdeck,s=e.topics.length,i=qwiz_.get_qwizdata(t,"topic_statistics"),a=qwiz_.get_qwizdata(t,"topics"),r=0,o=0,n=0,_=0;_<s;_++){var c=e.topics[_].replace(/\s/g,"_");c||(c="Other"),i||(i={}),i[c]||(i[c]={},i[c].n_correct=0,i[c].n_incorrect=0,-1==a.indexOf(c)&&a.push(c)),i[c].n_correct+=e.n_correct_by_unit_topic[_],i[c].n_incorrect+=e.n_incorrect_by_unit_topic[_],r+=e.n_correct_by_unit_topic[_],o+=e.n_incorrect_by_unit_topic[_],n+=e.n_questions_by_unit_topic[_]}debug[0]&&console.log("[restore_topic_question_counts] topic_statistics:",i),qwiz_.set_qwizdata(t,"topic_statistics",i),qwiz_.set_qwizdata(t,"topics",a),qwiz_.set_qwizdata(t,"n_correct",r),qwiz_.set_qwizdata(t,"n_incorrect",o),qwiz_.set_qwizdata(t,"restore_n_questions",n),qwiz_.set_qwizdata(t,"n_questions_for_done",n),qwiz_.set_qwizdata(t,"login_show_b",!1),qwiz_.set_qwizdata(t,"i_question",-1),qwiz_.next_question(t,!0,!0),qwiz_.next_question_from_intro(t,0),qwiz_.display_progress(t)},this.preview_limit=function(e,t,s){var i,a,r,o;"qwiz"==e?(i="quiz",a=qqc.T("question"),questions_cards=qqc.T("questions"),r="qwiz_",o=qwiz_):(i="flashcard deck",a=qqc.T("card"),questions_cards=qqc.T("cards"),r="qcard_",o=qcard_);var n="",_=!1;if("preview_period_expired"==t[s].pay_quiz_ok||"no_free_trial"==t[s].pay_quiz_ok)n="preview_period_expired"==t[s].pay_quiz_ok?"Your free trial period for quizzes has expired":"Sorry, no free trial for this quiz/deck.",o.display_login(s,!1,"pay",n),_=!0;else{if(-1==t[s].n_preview_questions)n="Sorry, you must register/log in to do this "+i,_=!0;else{t[s].n_preview_questions--;var c=$("div#pay_unlock_menu-"+("qwiz"==e?"qwiz":"qdeck")+s).find(" div.pay_preview_status");0==t[s].n_preview_questions?(n="Please log in or register to do more of this "+i,t[s].n_preview_questions=-1,_=!0,$("#unlocked-"+e+s).css({display:"none"}),$("#locked-"+e+s).css({display:"block"}),c.html(qqc.T("Preview mode. You have no")+" "+questions_cards+" "+qqc.T("remaining. Please log in or register to continue")+".")):c.html(qqc.T("Preview mode. You have")+" "+qqc.number_to_word(t[s].n_preview_questions)+" "+qqc.plural(a,questions_cards,t[s].n_preview_questions)+" "+qqc.T("remaining"))}_&&(n="Preview limit reached",!0===document_qwiz_user_logged_in_b?document_qwiz_university_discount?o.hide_menu_and_display_login(s,!1,"pay",n,!0,"Pay now"):o.hide_menu_and_display_login(s,!1,"paypal_subscription"):qqc.pay_unlock_menu_display_login(r,s,"free_trial",n,"","Sign up"))}return _},this.pay_lock_settings=function(e,t,s,i,a,r,o,n){var _=0,c=function(){if("not ready"==document_qwiz_user_logged_in_b)debug[0]&&console.log("[pay_lock_settings] n_tries:",_),++_<20?setTimeout(c,"100"):console.log("[pay_lock_settings] document_qwiz_user_logged_in_b not set");else{var d=0,l=s;void 0!==o&&(l=(d=parseInt(o))+1);for(var u=[],p=[],g=[],h=d;h<l;h++)if(t[h].pay_quiz_deck_id){u.push(h),p.push(t[h].pay_quiz_deck_id);var q=t[h].promo_code;q=q||"",g.push(q)}n=void 0!==n?n:"";var m={logged_in_f:document_qwiz_user_logged_in_b?1:0,i_qwizzes_decks:btoa(JSON.stringify(u)),pay_quiz_deck_ids:btoa(JSON.stringify(p)),promo_codes:btoa(JSON.stringify(g)),pay_registration_date_unix:document_qwiz_pay_registration_date_unix,msg:n};void 0!==i&&(m.i_login_qwiz=i,void 0===a&&(a=0,r=0),m.escaped_session_id=a,m.remember_f=r),debug[0]&&(m.qdebug=1);var f="get_pay_settings";/xget=/.test(document.location.search)&&(f="x"+f),qqc.qjax(e,h,"",f,m)}};c()},this.set_pay_settings=function(e){debug[0]&&(console.log("[set_pay_settings] data:",e),console.log("[set_pay_settings] document_qwiz_university_discount:",document_qwiz_university_discount));var t,s,i,a,r=void 0!==e.i_login_qwiz,o=e.qname;"qwiz_"==o?(t="qwiz",s=qqc.T("question"),questions_cards=qqc.T("questions"),i=qqc.T("quiz"),a=qwiz_):(t="deck",s=qqc.T("card"),questions_cards=qqc.T("cards"),i=qqc.T("flashcard deck"),a=qcard_);for(var n=e.pay_qwiz_decks_data,_=e.pay_qwiz_decks_maker_options,c=n.length,d=(new Date).getTime()/1e3,l=0;l<c;l++){var u=n[l],p=u.i_qwiz_deck,g=u.pay_errmsg,h="",q="";if(g)qqc.set_qwizdeckdata(o,p,"pay_errmsg",g);else{for(var m,f,w=u.payment_type_via,b=u.payment_type_id,v=u.maker_f,k=u.fee,z=u.good_for_n_periods,y=u.good_for_period,x=u.payment_description,T=u.n_preview_free_default,S=(u.registration_required,u.unpaid_msg),j=u.parallel_payment_type_id,C=u.n_preview_free,A=u.registration_trial_days,M=u.registration_trial_days_default,P=u.good_through_date_unix,O=(u.promo_code,u.promo_fee),N=u.promo_description,E=b.length,I=[],D=0,R="",F=-1,B=0,H=0,L=0,J=0,Y=[],U=[],V=[],Q=[],W=[],K=[],G=[],X=!1,Z=!0,ee=!1,te=!1,se=!1,ie=-1,ae=0;ae<E;ae++){if(f=!1,!v[ae]&&(!P[ae]||P[ae]+259200<d)){if(-1!=j.slice(0,ae).indexOf(b[ae]))continue;var re=!1;if(k[ae]<=0&&document_qwiz_good_through_date_ok&&(re=!0),65==b[ae]&&(re=!0),document_qwiz_independent_taker_f&&47==b[ae]&&(re=!0),document_qwiz_university_discount&&47!=b[ae]&&(debug[0]&&console.log("[set_pay_settings] skipping payment_type_id:",b[ae]),re=!0),!re){var oe;if(k[ae]<=0?(oe='<div style="margin-left: 10px; padding: 0;">',oe+=qqc.capitalize(qqc.number_to_word(z[ae])),X=!0):(oe='<div style="padding: 0;">',oe+="<b>College students</b>: $"+k[ae]+" for "+qqc.number_to_word(z[ae]),Z=!1),oe+=" "+y[ae]+qqc.plural("’s","s’",z[ae])+" access",x[ae]&&(oe+=" to "+x[ae],k[ae]<=0)){var ne="Sign up for a free trial";oe+=' <a href="javascript: '+(!0===document_qwiz_user_logged_in_b?`${o}.hide_menu_and_display_login (${p}, false, 'paypal_subscription')`:`qwiz_qcards_common.pay_unlock_menu_display_login ('${o}', ${p}, 'free_trial', ' ${ne}', '', 'Sign up')`)+'" class="qwiz_login">sign up</a>'}oe+="</div>",I.push(oe),-1!=O[ae]&&(te=!0,k[ae]=O[ae],x[ae]+=" - "+N[ae],f=!0,se=!0,ie=J),Y.push(b[ae]),U.push(k[ae]),V.push(z[ae]),Q.push(y[ae]),W.push(x[ae]),K.push(f),S[ae]&&G.push(S[ae]),J++;var _e=C[ae];-1==_e&&(_e=T[ae]),_e>H&&(H=_e);var ce=A[ae],de=M[ae];-1==ce&&(ce=de),ce>L&&(L=ce,m=de)}}(!0===document_qwiz_user_logged_in_b||r)&&P[ae]>=D&&(D=P[ae],k[ae]>F&&(F=k[ae]),B=v[ae],R=w[ae])}qqc.set_qwizdeckdata(o,p,"taker_payment_type_ids",Y),qqc.set_qwizdeckdata(o,p,"taker_fees",U),qqc.set_qwizdeckdata(o,p,"taker_good_for_n_periodss",V),qqc.set_qwizdeckdata(o,p,"taker_good_for_periods",Q),qqc.set_qwizdeckdata(o,p,"taker_payment_descriptions",W),qqc.set_qwizdeckdata(o,p,"taker_payment_selected_bs",K),qqc.set_qwizdeckdata(o,p,"taker_unpaid_msgs",G),qqc.set_qwizdeckdata(o,p,"any_taker_options_free_b",X),qqc.set_qwizdeckdata(o,p,"all_taker_options_free_b",Z),qqc.set_qwizdeckdata(o,p,"any_promo",te),-1!=ie&&qqc.set_qwizdeckdata(o,p,"i_promo",ie);var le=get_qwizdeckdata(o,p,"pay_quiz_deck_id");qqc.set_qwizdeckdata(o,p,"taker_pay_quiz_deck_id",le),qqc.set_qwizdeckdata(o,p,"promo_applied",se);var ue=[],pe=!1;if(!document_qwiz_user_logged_in_b&&_.length){var ge=_[l],he=(b=ge.payment_type_id,k=ge.fee,z=ge.good_for_n_periods,y=ge.good_for_period,x=ge.payment_description,[]),qe=[],me=[],fe=[],we=[],be=k.length;for(ae=0;ae<be;ae++){var ve;k[ae]<-1.5||(k[ae]<0?ve=x[ae]:(pe=!0,ve="$"+k[ae]+" for "+qqc.number_to_word(z[ae])+" "+y[ae]+qqc.plural("","s",z[ae]),x[ae]&&(ve+=" - "+x[ae])),ue.push(ve),he.push(b[ae]),qe.push(k[ae]),me.push(z[ae]),fe.push(y[ae]),we.push(x[ae]))}qqc.set_qwizdeckdata(o,p,"maker_payment_type_ids",b),qqc.set_qwizdeckdata(o,p,"maker_fees",k),qqc.set_qwizdeckdata(o,p,"maker_good_for_n_periodss",z),qqc.set_qwizdeckdata(o,p,"maker_good_for_periods",y),qqc.set_qwizdeckdata(o,p,"maker_payment_descriptions",x);le=get_qwizdeckdata(o,p,"pay_quiz_deck_id");qqc.set_qwizdeckdata(o,p,"maker_pay_quiz_deck_id",le)}}var ke=$("#locked-"+t+p),ze=$("#unlocked-"+t+p);if(qqc.set_qwizdeckdata(o,p,"pay_quiz_ok","preview_questions"),!0===document_qwiz_user_logged_in_b||r){document_qwiz_pay_registration_date_unix||(document_qwiz_pay_registration_date_unix=parseInt(e.pay_registration_date_unix,10));d=(new Date).getTime()/1e3;var ye=!1;if(document_qwiz_maker_privileges){ye=!0,qqc.set_qwizdeckdata(o,p,"pay_quiz_ok","paid"),ze.css({display:"block",filter:"none"}),ke.css({display:"none"}),document_qwiz_good_through_date_ok=!0,document_qwiz_good_through_date=DateFormat.format.date(1e3*D,"yyyy-MM-dd");h="Available through "+DateFormat.format.date(1e3*D,"MMMM d, yyyy")}else if(F>=0||1==B)if(D+259200>d){ye=!0,qqc.set_qwizdeckdata(o,p,"pay_quiz_ok","paid"),get_qwizdeckdata(o,p,"display_pay_screen")&&!0,ze.css({display:"block",filter:"none"}),document_qwiz_good_through_date=DateFormat.format.date(1e3*D,"yyyy-MM-dd");const e=DateFormat.format.date(1e3*D,"MMMM d, yyyy");h="student"==R?0==F?"Subscription - free trial through "+e:document_qwiz_university_discount?"University discount good to "+e:"Subscription good through "+e:"teacher"==R?"Class access available through "+e:"Available through "+e,void 0===document_qwiz_good_through_date_ok&&(document_qwiz_good_through_date_ok=!0),ke.css({display:"none"})}else if(ye=!0,document_qwiz_good_through_date_ok=!1,D){document_qwiz_good_through_date=DateFormat.format.date(1e3*D,"yyyy-MM-dd");const e=DateFormat.format.date(1e3*D,"MMMM d, yyyy");h=qqc.T("Access expired "+e),ze.css({display:"none"}),ke.css({display:"block"}),qqc.set_qwizdeckdata(o,p,"pay_quiz_ok","preview_period_expired")}else document_qwiz_good_through_date="",h=qqc.T("Limited preview."),ze.css({display:"block",filter:""}),ke.css({display:"none"}),qqc.set_qwizdeckdata(o,p,"pay_quiz_ok","preview_questions"),qqc.set_qwizdeckdata(o,p,"n_preview_questions",H);if(!ye)if(document_qwiz_good_through_date_ok=!1,ee)if(document_qwiz_pay_registration_date_unix+48*L*3600<d)ke.css({display:"block"}),0==L?(h="Preview mode. You have "+qqc.number_to_word(H)+" "+qqc.plural(s,questions_cards,H)+" remaining",qqc.set_qwizdeckdata(o,p,"pay_quiz_ok","preview_questions"),qqc.set_qwizdeckdata(o,p,"n_preview_questions",H),F<0&&D+172800>d&&(h+="<br />This "+i+" is not part of the free trial")):L==de?(h="Sorry, your free trial period for quizzes has expired",q="To continue use:<br />",qqc.set_qwizdeckdata(o,p,"pay_quiz_ok","preview_period_expired")):(h="Sorry, your free trial period for this quiz/deck has expired",q="To continue use:",qqc.set_qwizdeckdata(o,p,"pay_quiz_ok","preview_period_expired")),ze.css({display:"none"});else{var $e=parseInt((document_qwiz_pay_registration_date_unix+24*L*3600-d)/86400,10);h=$e>0?L==de?"You have "+qqc.number_to_word($e)+" "+qqc.plural(qqc.T("day"),qqc.T("days"),$e)+" "+qqc.T("left in your free trial of quizzes/flashcard decks"):"You have "+qqc.number_to_word($e)+" "+qqc.plural(qqc.T("day"),qqc.T("days"),$e)+" "+qqc.T("left in your free trial of this quiz/flashcard deck"):qqc.T("You have less than one day left in your free trial"),q=qqc.T("After your free trial:"),ke.css({display:"none"}),ze.css({display:"block"}),qqc.set_qwizdeckdata(o,p,"pay_quiz_ok","preview_period")}else 0==H?qqc.set_qwizdeckdata(o,p,"n_preview_questions",-1):qqc.set_qwizdeckdata(o,p,"n_preview_questions",H),ze.css({display:"block"}),h=qqc.T("Preview mode. You have")+" "+qqc.number_to_word(H)+" "+qqc.plural(s,questions_cards,H)+" "+qqc.T("remaining"),ke.css({display:"none"})}else if(0==H)qqc.set_qwizdeckdata(o,p,"n_preview_questions",-1),ke.css({display:"block"}),h=qqc.T("Sorry, no preview available for this quiz/deck."),q="",qqc.set_qwizdeckdata(o,p,"pay_quiz_ok","no_free_trial"),ze.css({display:"none"});else{if(0==L)h=qqc.T("Preview mode. You have")+" "+qqc.number_to_word(H)+" "+qqc.plural(s,questions_cards,H)+" "+qqc.T("remaining"),q="<b>Students working on their own:</b>";else{ne=qqc.T("Log in")+" – "+qqc.T("or register for a free trial");h=qqc.T("Please")+" <a href=\"javascript: qwiz_qcards_common.pay_unlock_menu_display_login ('"+o+"', "+p+", '', '"+ne+'\')" class="qwiz_login">'+qqc.T("log in or register")+"</a> for a "+qqc.number_to_word(L)+"-day free trial of ",h+=L==m?qqc.T("quizzes on this site."):qqc.T("this quiz/deck."),q=qqc.T("After your free trial:")}qqc.set_qwizdeckdata(o,p,"n_preview_questions",H),ke.css({display:"none"}),ze.css({display:"block",filter:""})}var xe=set_pay_unlock_menu(o,p,g,h,q,I,Z,ue,pe);if("qwiz_"==o){var Te=$("div#summary-qwiz"+p+" span.unpaid_msg");Te.length&&("paid"==qwiz_.get_qwizdata(p,"pay_quiz_ok")?Te.hide():Te.show());var Se=$("div#summary-qwiz"+p+" span.unpaid_msg_payment_type");if(Se.length)if("paid"!=qwiz_.get_qwizdata(p,"pay_quiz_ok"))if((S=qwiz_.get_qwizdata(p,"taker_unpaid_msgs")).length){var je=Math.floor(Math.random()*S.length);Se.html(S[je])}}}xe&&check_maker_session_id();const Ce=set_display_pay_screen(o,p);if(Ce||e.msg){$("div.qwiz-progress-container.qwiz"+p).show();ne=e.msg?e.msg:"";const t=qqc.$get_login_div(o,p);if(document_qwiz_user_logged_in_b)if("free_trial"==Ce){const e=qqc.set_immediate_payment(o,p);ne="<br /><br />";if(e){const e=(new Date).getTime()/1e3;Date.parse(document_qwiz_good_through_date+"T00:00:00Z")/1e3>e+1209600?(ne+="<i>Thanks for using Learn-Biology.com!</i>",t.append(ne).show()):a.hide_menu_and_display_login(p,!1,"free_trial")}else document_qwiz_good_through_date_ok?(ne+="<i>Thanks for using Learn-Biology.com!</i>",t.append(ne).show()):document_qwiz_good_through_date?(ne+="<i>Sorry; a free trial subscription is not available to existing users</i>",t.html(ne).show()):a.hide_menu_and_display_login(p,!1,"paypal_subscription")}else if("special_offer"==Ce)document_qwiz_good_through_date>"2024-03-26"?(ne="<br />\n <br />\n <i>Sorry; special offer not available</i>\n ",t.append(ne).show()):a.hide_menu_and_display_login(p,!1,"free_trial");else if("login"==Ce)$(`#qwiz${p}-q0`).html(' <br />\n <p class="qwiz-center qwiz-bold">\n You are currently logged in.\n </p>\n <p>\n If you want to log in as a different user, hover on the green down-triangle (above right) and click "Sign out".\n </p>\n ');else if("open_register"==Ce)ne||(ne="<br />\n <b>You are currently logged in.</b>\n <br />\n <i>If you want to create a new account hover over the green down-triangle to sign out.</i>\n "),t.append(ne).show();else{/register/.test(Ce)&&qqc.check_session_id(p,!0);setTimeout((function(){void 0===document_qwiz_university_discount&&"paid"!=qwiz_.get_qwizdata(p,"pay_quiz_ok")?a.hide_menu_and_display_login(p,!1,"register",ne):register_taker_global_reg_code_ok_f||a.hide_menu_and_display_login(p,!1,"pay",ne,!0,"Pay now")}),500)}else if("register"==Ce||"open_register"==Ce||"subscribe"==Ce||"signup"==Ce){var Ae="register";"open_register"==Ce&&(Ae="open_register"),a.hide_menu_and_display_login(p,!1,Ae,ne,!1)}else"free_trial"==Ce?a.hide_menu_and_display_login(p,!1,"free_trial"):"special_offer"==Ce?(ne="Please log in (black down-triangle above right)",t.append(ne).show()):"login"==Ce?a.hide_menu_and_display_login(p,!1,""):(ne="Please log in or register so you can get credited for your payment",qqc.pay_unlock_menu_display_login(o,p,"",ne));$("div#mode-qwiz"+p).hide(),$("div.lock_unlock.qwiz"+p).hide(),$("div#qwiz_login-qwiz"+p+" button.qwiz_pay_cancel").hide(),$("div#qwiz_login-qwiz"+p+" .qwiz_login_cancel_no_thanks").hide(),$("div#next_button-qwiz"+p+" button").hide()}},this.set_qwizdeckdata=function(e,t,s,i){"qwiz_"==e?qwiz_.set_qwizdata(t,s,i):qcard_.set_deckdata(t,s,i)},this.find_opening_tags_at_end=function(e){var t=e.match(/(\s*(<[^/][^>]*>\s*)*)$/);debug[10]&&(console.log("[find_opening_tags_at_end] htm:",e),console.log("[find_opening_tags_at_end] all_opening_tags_match:",t));var s="";if(t&&void 0!==t[1]){var i=t[1],a=i.match(/\s*(<[^/][^>]*>\s*)|([^<]*$)/g);if(debug[10]&&(console.log("[find_opening_tags_at_end] all_opening_tags:",i),console.log("[find_opening_tags_at_end] opening_tags_match:",a)),a){for(var r=[],o=a.length-1;o>=0;o--){var n=a[o];if(""!=n){if("<"!=n[0]&&!/\s/.test(n[0]))break;var _=n.replace(/\s/g,"").substr(0,4);if("<br>"==_)break;if("<img"==_||"<inp"==_)break;r.unshift(n)}}s=r.join("")}}return debug[10]&&console.log("[find_opening_tags_at_end] opening_tags:",s),s},this.parse_html_block=function(e,t,s,i){debug[10]&&console.log("[parse_html_block] shortcodes: ",t,", htm: ",e);var a,r="string"==typeof i,o=0,n="";if("^"!=t[0]){var _=parse_html_block_pattern(t),c=new RegExp(_),d=e.search(c);if(-1==d)return debug[10]&&console.log("[parse_html_block] html_block: NA"),"NA";o=3;var l=e.substr(0,d);n=qqc.find_opening_tags_at_end(l)}var u=-1;if(s.length){_=parse_html_block_pattern(s);c=new RegExp(_),u=e.substr(d+o).search(c)}if(-1==u)a=n+e.substr(d);else if(0==u)a="";else{var p,g,h=e.substr(d,o+u);if(""!=(p=qqc.find_opening_tags_at_end(h)))c=new RegExp(p+"$"),g=h.replace(c,"");else g=h;if(""!=(a=n+g)){var q=g.replace(/<[^>]+>/gm,"");null!=i&&(q=q.replace(/ | |<br[^>]*>/gm,""));var m=-1==q.search(/\S/);m&&(r||(a=""))}}return r&&!m&&(a=""),debug[10]&&console.log("[parse_html_block] html_block:",a),a},this.find_matching_block=function(e){for(var t="",s=e.length,i=0,a=0,r=[],o=!1;i<s;){if("<"==e[i]){if("<br>"==e.substr(i,4)||"<hr>"==e.substr(i,4)){i+=3;continue}if("\x3c!--"==e.substr(i,4)){i+=4;continue}if("<img"==e.substr(i,4)||"<input"==e.substr(i,6)||"<br"==e.substr(i,3)||"<hr"==e.substr(i,3)){for(i+=3;i<s&&">"!=e[++i];);continue}if("<p"==e.substr(i,2)){if(o){i++;continue}o=!0}if("/"==e[++i]){"/div"==e.substr(i,4)?o&&(a--,o=!1):"/p"==e.substr(i,2)&&(o=!1),a--,i++;for(var n="";i<s&&">"!=e[i];)n+=e[i],i++;if(debug[5]&&console.log("[find_matching_block] i_level: ",a,", closing_tag:",n,", tags:",r.slice(0,a+1)),n!=r[a]&&(debug[5]&&console.log("XXX"),a++),a<=0){for(t=e.substring(0,i);i<s&&">"!=e[i];)t+=e[i];t+=">";break}}else{for(var _="";i<s&&">"!=e[i]&&!/\s/.test(e[i]);)_+=e[i],i++;r[a]=_,debug[5]&&(console.log("[find_matching_block] (new_level) tag_i_level:",_,", (followed by): ",e.substr(i+1,30)),console.log("[find_matching_block] tags:",r.slice(0,a+1))),a++}}else"/"==e[i]&&">"==e[++i]&&a--;i++}return debug[5]&&console.log("[find_matching_block] htm_block:",t),t},this.select_placeholder=function(e){debug[0]&&console.log("[select_placeholder] $edit_field:",e);var t=e.find("span.qwizard_placeholder");if(0!=t.length){document_qwiz_bubblebar_enabled_b=!1,setTimeout((function(){t[0];var s,i=e.attr("id");if(i&&(s=tinyMCE.get(i),debug[0]&&console.log("[select_placeholder] ed:",s),!s)){setTimeout((function(){s=tinyMCE.get(i),debug[0]&&console.log("[select_placeholder > delay_get ] ed:",s)}),500)}if(s&&s.selection&&s.dom.select("span")&&s.selection.select(s.dom.select("span")[0]),i&&"qcard"==i.substr(0,5)){e.off("keydown").off("click");var a="span"==e[0].tagName.toLowerCase();e.on("click keydown",(function(t){qwizard.remove_placeholder(t,e,a)}))}setTimeout("document_qwiz_bubblebar_enabled_b = true",200)}),500)}else debug[0]&&console.log("[select_placeholder] $placeholder.length: 0")},this.check_pairs=function(e,t,s){for(var i="",a=0,r=0;opening_pos=s.indexOf(e,a),closing_pos=s.indexOf(t,r),-1!=opening_pos||-1!=closing_pos;){if(i="ok",closing_pos<=opening_pos||-1==opening_pos||opening_pos<r){i="Mis-matched pairs for "+e+"..."+t;break}a=opening_pos+1,r=closing_pos+1}return i},this.qdebug=function(e){if(/qdebug=/.test(document.location.search)){e[0]=!0;let t=decodeURIComponent(document.location.search).match(/qdebug=([\d,]+)/)[1];if(t){t=t.split(",");for(const s of t){e[parseInt(s)]=!0}}}},this.hex_to_rgb=function(e){const t=e.substr(0,2),s=e.substr(2,2),i=e.substr(4,2);return[parseInt(t,16),parseInt(s,16),parseInt(i,16)]},this.decodeHtmlEntities=function(e){var t=document.createElement("textarea");return t.innerHTML=e,t.value},this.encodeHtmlEntities=function(e){for(var t=[],s=e.length-1;s>=0;s--)t.unshift(["&#",e[s].charCodeAt(),";"].join(""));return t.join("")},this.addSlashes=function(e){return(e+"").replace(/[\\"']/g,"\\$&").replace(/\n/g,"\\n").replace(/\u0000/g,"\\0")},this.decode_image_tags=function(e){return e=e.replace(/<input[^>]+?name="qwiz_img"/g,"<img")},this.shortcodes_to_video_elements=function(e){if(e=e.replace(/\[audio(.*?)(src|mp3|m4a|ogg|wav|wma|mp4|m4v|webm|ogv|wmv|flv)([^\]]*)\]/g,'<video controls$1src$3 data-audio_video="audio" height="30" width="280"></video>').replace(/\[video(.*?)(src|mp3|m4a|ogg|wav|wma|mp4|m4v|webm|ogv|wmv|flv)([^\]]*)\]/g,'<video controls$1src$3 data-audio_video="video"></video>'),qwizzled.wp_editing_page_f){var t=e.match(/\[embed\][^\[]+\[\/embed\]/g);if(t){for(var s=[],i=[],a=t.length,r=0;r<a;r++)s.push(t[r].replace(/\[\/{0,1}embed\]/g,"")),i.push({width:500});"not ready"==qwiz_ajaxurl&&(qwiz_ajaxurl=qqc.get_qwiz_param("ajaxurl",""));var o={action:"process_embeds",urls:encodeURIComponent(JSON.stringify(s)),args:encodeURIComponent(JSON.stringify(i))};$.ajax({type:"POST",async:!1,url:qwiz_ajaxurl,data:o,success:function(s){for(var i=0;i<a;i++){var r=s[i].replace(">",' data-embed="true">');e=e.replace(t[i],r)}}})}}return debug[0]&&console.log("[shortcodes_to_video_elements] htm:",e),e},this.init_image_swap=function(e,t){var s=$(e),i=s.find("img");if(i.length){var a=i.attr("src"),r=$("img"),o=r.eq(r.index(i)-1),n=o.attr("src");o.removeAttr("srcset"),s.hasClass("hover")?o.attr("onmouseenter",`qwiz_qcards_common.img_swap (this, 'hover', '${a}')`).attr("onmouseleave",`this.src="${n}"`):(t&&o.click((function(e){e.stopPropagation()})),o.attr("onclick",`qwiz_qcards_common.img_swap (this, 'click', '${a}', '${n}')`).css({cursor:"pointer"})),s.removeClass("not_inited")}},this.img_swap=function(e,t,s,i){if(!e.style.width){var a=e.width,r=e.height;$(e).css({width:a+"px",height:r+"px"})}"hover"==t?e.src=s:e.qwiz_alt_img?(e.src=i,e.qwiz_alt_img=!1):(e.src=s,e.qwiz_alt_img=!0)},this.hhmmss_from_sec=function(e){var t=e%60;t<10&&(t="0"+t);var s=parseInt(e/60)%60,i=s+":"+t;if(e>=3600){s<10&&(s="0"+s);i=parseInt(e/3600)+":"+i}return i},this.isInteger=function(e){return(0^e)===e},this.bin2hex=function(e){var t,s,i,a="";for(t=0,s=(e+="").length;t<s;t++)a+=(i=e.charCodeAt(t).toString(16)).length<2?"0"+i:i;return a},$.fn.changeElements=function(e){return $(this).each((function(){var t={};$.each(this.attributes,(function(e,s){t[s.nodeName]=s.nodeValue}));var s=$("<"+e+"/>",t);$(this).replaceWith(s)})),$([])},this.metaphone=function(e,t){var s=typeof e;if("undefined"===s||"object"===s&&null!==e)return null;if("number"===s&&(isNaN(e)?e="NAN":isFinite(e)||(e="INF")),t<0)return!1;t=Math.floor(+t)||0;var i="ABCDEFGHIJKLMNOPQRSTUVWXYZ",a="AEIOU",r="EIY",o=new RegExp("^[^"+i+"]+");if(!(e=(e="string"==typeof e?e:"").toUpperCase().replace(o,"")))return"";var n,_,c=function(e,t){return""!==t&&-1!==e.indexOf(t)},d=0,l=e.charAt(0),u=e.charAt(1),p=e.length,g="";switch(l){case"A":g+="E"===u?u:l,d+=1;break;case"G":case"K":case"P":"N"===u&&(g+=u,d+=2);break;case"W":"R"===u?(g+=u,d+=2):("H"===u||c(a,u))&&(g+="W",d+=2);break;case"X":g+="S",d+=1;break;case"E":case"I":case"O":case"U":g+=l,d++}for(;d<p&&(0===t||g.length<t);d+=1)if(l=e.charAt(d),u=e.charAt(d+1),_=e.charAt(d-1),n=e.charAt(d+2),l!==_||"C"===l)switch(l){case"B":"M"!==_&&(g+=l);break;case"C":c(r,u)?"I"===u&&"A"===n?g+="X":"S"!==_&&(g+="S"):"H"===u?(g+="X",d+=1):g+="K";break;case"D":"G"===u&&c(r,n)?(g+="J",d+=1):g+="T";break;case"G":"H"===u?c("BDH",e.charAt(d-3))||"H"===e.charAt(d-4)||(g+="F",d+=1):"N"===u?c(i,n)&&"NED"!==e.substr(d+1,3)&&(g+="K"):c(r,u)&&"G"!==_?g+="J":g+="K";break;case"H":c(a,u)&&!c("CGPST",_)&&(g+=l);break;case"K":"C"!==_&&(g+="K");break;case"P":g+="H"===u?"F":l;break;case"Q":g+="K";break;case"S":"I"===u&&c("AO",n)?g+="X":"H"===u?(g+="X",d+=1):g+="S";break;case"T":"I"===u&&c("AO",n)?g+="X":"H"===u?(g+="0",d+=1):"CH"!==e.substr(d+1,2)&&(g+="T");break;case"V":g+="F";break;case"W":case"Y":c(a,u)&&(g+=l);break;case"X":g+="KS";break;case"Z":g+="S";break;case"F":case"J":case"L":case"M":case"N":case"R":g+=l}return g}};qwiz_qcards_common_f.call(qwiz_qcards_common),1 var document_qwiz_declined_login_b="not ready",document_qwiz_user_logged_in_b="not ready",document_qwiz_wp_user_session_id,document_qwiz_maker_privileges=!1,qjax_bypass="not ready",qwiz_wp_site_url,document_qwiz_remember_f=!1,document_active_qwiz_qdeck="",document_qwiz_username="",document_qwiz_independent_taker_f="",document_qwiz_email="",default_document_qwiz_email_confirm=1,document_qwiz_email_confirm=default_document_qwiz_email_confirm,$dialog_current_password="",$dialog_assign_to_classes="",document_qwiz_class_id="",document_qwiz_school_id=0,document_qwiz_session_id,document_qwiz_login_timeout,document_qwiz_team_b=!1,document_qwiz_mobile_enabled="Always",document_qwiz_mobile="",document_qwiz_bubblebar_enabled_b=!0,document_qwiz_force_mobile_f=!1,document_qwiz_qdeck_maker_ids={},document_qwiz_pay_registration_date_unix=0,document_qwiz_not_logged_in_alerted=!1,document_qwiz_qwiz_html_completed_f,document_qwiz_qdeck_html_completed_f,document_qwiz_preview_i_qwiz,document_qwiz_preview_i_deck,document_qwiz_set_user_menus_and_icons_done="",document_qwiz_good_through_date,document_qwiz_good_through_date_ok,document_qwiz_subscription_id,document_qwiz_immediate_payment,document_qwiz_university_discount;qwiz_qcards_common={};var qwiz_qcards_common_f=function(){var qqc=this,qqcname="qwiz_qcards_common",$=jQuery,init_enter_intercept_f,jjax_script_no=0,head="not ready",server_loc="not ready",secure_server_loc,qwiz_ajaxurl="not ready",plugin_url="",icon_expand_src="not ready",icon_collapse_src,maker_specific_n_qs_by_unit_topic,use_dataset_options_display_name={},progress_bars_leaderboard={},refresh_leaderboard_timeout={},dataset_questions_countdown_timeout={},pay_qwiz_qdeck_,pay_i_qwiz_deck,payment_received_f=!1,register_taker_global_reg_code_ok_f=!1,register_taker_display_pay_screen=!1,register_taker_global_username,register_taker_global_first_name,register_taker_global_last_name,register_taker_global_sha3_password,register_taker_global_username_unique_f,register_taker_global_email_unique_f,register_taker_global_reg_code_maker_id="",register_taker_global_reg_code_school_id="",register_taker_global_reg_code_class_id="",register_taker_global_reg_code_class_name="",register_taker_global_reg_code_school_name="",register_taker_global_reg_code_professor_f="",register_taker_global_in_process_b=!1,provide_feedback_html={},dataset_units_topics_data,units_topics_state={},selected_levels={};qqc.default_level="Intermediate";var debug=[];function qjax_callback(js){debug[0]&&console.log("[qjax_callback] js:",js),js&&(js=js.replace(/var /g,""),eval(js))}function check_maker_session_id(){var e=$.cookie("maker_session_id");if(debug[0]&&console.log("[check_maker_session_id] cookie_session_id:",e),e){var t={cookie_session_id:e,callback:"maker_session_id_ok_or_no"};qqc.qjax("qwiz_qcards_common",0,"","check_maker_session_id",t)}else qqc.maker_session_id_ok_or_no()}function get_progress_meter_data(){var e={},t="";if(qwiz_.n_qwizzes){t=[];for(var s=0;s<qwiz_.n_qwizzes;s++){let i=qwiz_.get_qwizdata(s,"qrecord_id");i&&(t.push(i),e[i]=["Q",s])}}var i="";if(qcard_.n_decks){i=[];for(var a=0;a<qcard_.n_decks;a++){let t=qcard_.get_deckdata(a,"qrecord_id");t&&(i.push(t),e[t]=["F",a])}}if(debug[0]&&(console.log("[get_progress_meter_data] qwiz_qrecord_ids:",t),console.log("[get_progress_meter_data] qdeck_qrecord_ids:",i)),t||i){var r={qwiz_qrecord_ids:t,qdeck_qrecord_ids:i,qrecord_id_to_i_qwiz_i_deck:e};qqc.qjax("",0,"","get_progress_meter_data",r)}}function reset_progress_meters(){if(qwiz_)for(var e=0;e<qwiz_.n_qwizzes;e++)qwiz_.set_qwizdata(e,"progress_meter",!1),$(`div.qwiz-progress_meter-qwiz${e}`).hide();if(qcard_)for(var t=0;t<qcard_.n_decks;t++)qcard_.set_deckdata(t,"progress_meter",!1),$(`div.qcard-progress_meter-qdeck${t}`).hide()}debug[0]=!1,debug[5]=!1,debug[7]=!1,debug[9]=!1,debug[10]=!1,debug[11]=!1,debug[12]=!1,debug[13]=!1,$(document).ready(function(){qqc.qdebug(debug),$.cookie&&(document_qwiz_declined_login_b=$.cookie("qwiz_declined_login")),head=document.getElementsByTagName("head")[0],debug[0]&&console.log("[qwiz_qcards_common ready] head:",head);var e=$("a.unit.unit_button"),t=e.html();if(t&&"start course"==t.toLowerCase()){var s=function(){$("div.qwiz_wrapper_fallback").is(":visible")&&qwiz_.qwiz_init(),$("div.qdeck_wrapper_fallback").is(":visible")&&qcard_.qdeck_init()};e.click(function(){setTimeout(s,3e3)})}}),this.jjax=function(e,t,s,i,a){return qqc.qjax(e,t,s,i,a),!1},this.qjax=function(e,t,s,i,a){if(a||(a={}),a.qname=e,a.i_qwiz=t,a.qrecord_id=s,a.dest=i,a.js_f=1,void 0!==document_qwiz_session_id&&(a.qwiz_session_id=document_qwiz_session_id),debug[0]&&console.log("[qjax] qwizdata:",a),"not ready"==qjax_bypass&&(qjax_bypass=qqc.get_qwiz_param("qjax_bypass","")),qwiz_wp_site_url=qqc.get_qwiz_param("wp_site_url",""),qjax_bypass){var r=qwiz_wp_site_url+"/admin/"+i;debug[0]&&console.log("[qjax] url:",r),$.ajax({type:"POST",url:r,data:a,error:function(s,i,o){var n;console.log("[qjax] XMLHttpRequest:",s,", statusText:",i,", errorThrown:",o),console.log("[qjax] url:",r);var _=s.readyState;-1!=r.indexOf("record")?("qwiz_"==e?$(`span.response_recorded-qwiz${t} img.response_recording`).removeClass("response_recording_spin"):$(`span.response_recorded-qdeck${t} img.response_recording`).removeClass("response_recording_spin"),n=0==_?a.secure_f?"Sorry, unable to record your response. Please try again. Perhaps check your Internet connection?":"Sorry, unable to record your response. Perhaps check your Internet connection?":a.secure_f?"Sorry, unable to record your response. Please try again. If the problem reoccurs, contact support@qwizcards.com":"Sorry, unable to record your response. If the problem reoccurs, please contact support@qwizcards.com"):n=0==_?"Sorry, unable to process request. Perhaps check your Internet connection?":"Sorry, unable to process request. If the problem persists, please contact support@qwizcards.com",alert(n)},success:qjax_callback})}else{"not ready"==qwiz_ajaxurl&&(qwiz_ajaxurl=qqc.get_qwiz_param("ajaxurl",""));var o={action:"qjax"};o.qwizdata=a,$.ajax({type:"POST",url:qwiz_ajaxurl,data:o,success:qjax_callback})}},this.check_session_id=function(e,t){var s=$.cookie("qwiz_session_id");if(debug[0]&&console.log("[check_session_id] cookie_session_id:",s),s){document_qwiz_session_id=s;var i={cookie_session_id:s};t&&(i.register_f=1),debug[0]&&(i.qdebug=1),qqc.qjax("",e,"","check_session_id",i)}else document_qwiz_user_logged_in_b=!1},this.maker_session_id_ok_or_no=function(){if(!qqc.maker_logged_in_b){setTimeout(function(){$("a.teacher_subscriptions").each(function(){var e=$(this),t=e.data("query_string");debug[0]&&console.log("[maker_session_id_ok_or_no]: query_string:",t);const s=qqc.get_qwiz_param("secure_server_loc")+"/maker_login_register"+t;e.attr("href",s)})},250)}},this.set_user_menus_and_icons=function(e,t,s){if("doing_quizzes"==s){if(/decks/.test(document_qwiz_set_user_menus_and_icons_done+="quizzes"))return}else if("doing_decks"==s&&/quizzes/.test(document_qwiz_set_user_menus_and_icons_done+="decks"))return;var i="",a="black",r=0,o=function(){if("not ready"!=document_qwiz_user_logged_in_b&&document_qwiz_qwiz_html_completed_f&&document_qwiz_qdeck_html_completed_f){if(!0===document_qwiz_user_logged_in_b){get_progress_meter_data();var t=document_qwiz_maker_privileges?"Teacher logged in as student":"Logged in as";if(i+='<div style="text-align: right;">'+qqc.T(t)+" <strong>"+document_qwiz_username+"</strong></div>",document_qwiz_maker_privileges&&!qwiz_.preview_i_qwiz_plus1&&!qcard_.preview_ideck_plus1){const e="javascript: qwiz_qcards_common.do_preview (i_qwiz, 'qname')";i+='<div class="teacher_preview_qname"><table class="teacher_preview"><tr><td><b>'+qqc.T("Teachers only:")+' </b></td><td style="padding-bottom: 5px;"><a href="'+e+'" title="View this quiz/deck in expanded, all-question display">'+qqc.T("preview this")+' quiz_flashcard_deck</a></td></tr><tr><td></td><td><a href="javascript: qwiz_qcards_common.assign_to_classes (\'qname\', i_qwiz)" title="Assign this quiz_flashcard_deck to your classes">'+qqc.T("assign to classes")+"</a></td></tr></table></div>"}document_qwiz_independent_taker_f?i+='<div><a href="javascript: qname.hide_menu_and_display_login (i_qwiz, false, \'enroll\')" title="You are currently registered as an independent student. If you have a registration code you can join a class">'+qqc.T("Enroll in a school/class")+"</a></div>":document_qwiz_wp_user_session_id||(i+='<div><a href="javascript: qname.hide_menu_and_display_login (i_qwiz, true)">'+qqc.T("Add team member")+"</a></div>"),"not ready"==server_loc&&(server_loc=qqc.get_qwiz_param("server_loc","http://qwizcards.com/admin")),i+='<div><a href="'+server_loc+"/index?student_view=1&time="+document_qwiz_session_id+'" target="_blank">'+qqc.T("My scores")+"</a></div>",i+="leaderboard",i+="</nobr></div>",document_qwiz_wp_user_session_id||(i+='<div><a href="javascript:'+qqcname+'.my_account ()" title="'+qqc.T("View/edit login name, password, ...")+'">'+qqc.T("My account - settings")+"</a></div>"),i+='<div><a href="javascript: qname.hide_menu_and_display_login (i_qwiz, false, \'feedback\')" title="'+qqc.T("Report errors/bugs, comment, make suggestions...")+'">'+qqc.T("Feedback")+"</a></div>",document_qwiz_wp_user_session_id||(i+="<div>"+qqc.T("Not")+" "+document_qwiz_username+"? <a href=\"javascript: qwiz_qcards_common.sign_out (false, false, 'qname', i_qwiz)\">"+qqc.T("Sign out")+"</a></div>"),a=document_qwiz_maker_privileges?"#00b8ff":"#20a020",$("div.qwiz-usermenu_icon").removeClass("qwiz-icon-bounce")}else document_qwiz_wp_user_session_id?i+="<b>Authentication expired. Please re-load this page to record your work</b>":(reset_progress_meters(),i+='<br /><div><nobr><a href="javascript: qname.hide_menu_and_display_login (i_qwiz)"><strong>'+qqc.T("Log in")+"</strong> "+qqc.T("to record/get credit")+"</a></nobr></div>",i+='<div> <span class="qwiz-remember" title="'+qqc.T("Skip login in the future")+'"><label class="qwiz_label"><span class="qwiz-remember"><input type="checkbox" /> '+qqc.T("Remember")+'</span></label></span> <a href="javascript: qname.icon_no_login (i_qwiz)"><strong>'+qqc.T("No thanks")+"</strong></a></div>",i+="leaderboard","not ready"==document_qwiz_declined_login_b&&(document_qwiz_declined_login_b=$.cookie("qwiz_declined_login")),e||document_qwiz_declined_login_b||($("div.qwiz-usermenu_icon_no_intro").addClass("qwiz-icon-bounce"),$("div.qwiz-usermenu_icon").addClass("qwiz-icon-bounce")));const r='<div class="qwiz_leaderboard_link"><a href="javascript: qwiz_.hide_menu_and_display_login (i_qwiz, false, \'leaderboard\')">'+qqc.T("Fastest finish times")+"</a></div>";var s=i.replace(/qname/g,"qwiz_").replace(/quiz_flashcard_deck/g,"quiz");$("div.qwiz-usermenu").each(function(){const e=$(this).attr("id").substr(13);var t="";qwiz_.get_qwizdata(e,"qwiz_timer")&&(t=r),$(this).html(s.replace("leaderboard",t).replace(/i_qwiz/g,e))});var n=i.replace(/qname/g,"qcard_").replace(/quiz_flashcard_deck/g,"deck").replace("leaderboard","");$("div.qdeck-usermenu").each(function(){const e=$(this).attr("id").substr(14);$(this).html(n.replace(/i_qwiz/g,e))}),$("div.qwiz-usermenu_icon").css({display:"block",color:a}),$qscores=$("span.qscores"),$qscores.length&&qqc.set_qscore_menus($qscores)}else debug[0]&&console.log("[set_user_menus_and_icons] n_tries:",r),++r<20?setTimeout(o,"250"):console.log("[set_user_menus_and_icons] document_qwiz_user_logged_in_b not set");!0!==document_qwiz_user_logged_in_b&&$("div.qwiz_progress_meter").hide()};o()},this.set_progress_meters=function(e){if(debug[0]&&console.log("[set_progress_meters] data:",e),!e)return;const t=e.n_questions_by_qrecord_id;qqc.question_card_ids_by_qrecord_id=e.question_card_ids_by_qrecord_id;const s=e.qrecord_id_to_i_qwiz_i_deck,i=e.qrecord_id_oks;for(var[a,r]of Object.entries(t)){const e=s[a],t=e[0],_=e[1];let c=!0;1==document_qwiz_school_id||document_qwiz_maker_privileges||(c=i[a]);var o=5;r>150?o=0:r>100?o=1:r>10?o=2:r>4&&(o=3);let d=0;var n;if(qqc.question_card_ids_by_qrecord_id[a]&&(d=qqc.question_card_ids_by_qrecord_id[a].length),"Q"==t){n=$(`div.qwiz-progress_meter-qwiz${_}`),qwiz_.set_qwizdata(_,"progress_meter",!0),d&&qwiz_.set_qwizdata(_,"progress_meter_previous",!0);const e=parseFloat($(`#qwiz${_}`).css("border-width"));n.css({top:-e-7+"px",left:-e+"px",width:'calc(100% + 2*quiz_border_width + "px")'})}else n=$(`div.qcard-progress_meter-qdeck${_}`),qcard_.set_deckdata(_,"progress_meter",!0),d&&qcard_.set_deckdata(_,"progress_meter_previous",!0);const l=n[0];let u="";1==document_qwiz_school_id||document_qwiz_maker_privileges||("not in a class"==c||"no credit"==i[a])&&(u=c),u?n.css({"--dash-bg":"rgb(255, 233, 192)","--dash-border":"rgb(255, 165, 0)"}):n.css({"--dash-bg":"","--dash-border":""}),l.qrecord_id_not_ok=u,"Q"==t?qwiz_.set_qwizdata(_,"qrecord_id_not_ok",u):qcard_.set_deckdata(_,"qrecord_id_not_ok",u),n.css({"--n":r,"--m":d,"--gap":o+"px"}),qqc.init_progress_meter(l),l.previous_n_correct=d>0}},this.mb_strcut=function(e,t){const s=(new TextEncoder).encode(e);if(s.length<=t)return e;const i=s.slice(0,t),a=new TextDecoder("utf-8",{fatal:!1}).decode(i).replace(/\uFFFD$/g,"");return debug[0]&&console.log("[mb_strcut] return_str:",a),a},this.mb_substr=function(e,t){return Array.from(e).slice(0,t).join("")},this.update_progress_meter=function(e){const t=getComputedStyle(e),s=parseInt(t.getPropertyValue("--n"),10)||0,i=Math.max(0,Math.min(parseInt(t.getPropertyValue("--m"),10)||0,s)),a=parseInt(t.getPropertyValue("--gap"),10)||0;if(e.innerHTML="",s<=0)return;const r=/qwiz/.test(e.className);e.innerHTML=r?'<div class="progress_meter_overlay"></div>':'<div class="qcard-progress_meter_overlay"></div>';var o="";const n=e.qrecord_id_not_ok;if("not in a class"==n)o="You are not in a class. To get credit, enroll in a class (green down-triangle menu). ";else if("no credit"==n){o=`This ${r?"quiz":"flashcard deck"} is not assigned as work you need to do. `}const _=e.previous_n_correct?"("+qqc.T("including previous work")+")":"";o+=r?`${i} ${qqc.T("correct")} / ${s} ${qqc.T("questions")} ${_}`:`${i} ${qqc.T('"Got-its"')} / ${s} ${qqc.T("cards")} ${_}`,e.title=o;const c=document.createDocumentFragment(),d=s-1;for(let e=0;e<s;e++){const t=document.createElement("div");let s="dash"+(e<i?" filled":"");0==a&&(s+=0==e?" border-left":e==d?" border-right":" border-top-bottom"),t.className=s,c.appendChild(t)}e.appendChild(c)},this.init_progress_meter=function(e){qqc.update_progress_meter(e),e.style.display="flex";new MutationObserver(e=>{for(const t of e)"attributes"===t.type&&"style"===t.attributeName&&qqc.update_progress_meter(t.target)}).observe(e,{attributes:!0})},this.my_account=function(){var e=server_loc+"/my_account?time="+document_qwiz_session_id;if(document_qwiz_good_through_date){e+="&good_through_date="+DateFormat.format.date(Date.parse(document_qwiz_good_through_date),"MMMM d, yyyy")}window.open(e,"my_account")};var do_preview_form=!1,assign_to_classes_data;function deassign_class_from_quiz(e){debug&&(console.log("[deassign_class_from_quiz] e.params.data:",e.params.data),console.log("[deassign_class_from_quiz] e.params.data.element.value:",e.params.data.element.value));const t={class_id:e.params.data.element.value,class_name:e.params.data.element.text,i_row:0,callback:"qwiz_qcards_common.assign_to_classes_updated"};qqc.qjax("",0,assign_to_classes_data.qrecord_id,"delete_class_from_qwiz_qdeck",t)}function add_class_to_qwiz_qdeck(e){debug&&(console.log("[add_class_to_qwiz_qdeck] e.params.data:",e.params.data),console.log("[add_class_to_qwiz_qdeck] e.params.data.element.value:",e.params.data.element.value));const t={class_id:e.params.data.element.value,class_name:e.params.data.element.text,i_row:0,callback:"qwiz_qcards_common.assign_to_classes_updated"};qqc.qjax("",0,assign_to_classes_data.qrecord_id,"add_class_to_qwiz_qdeck",t)}function set_pay_unlock_menu(e,t,s,i,a,r,o,n,_){var c,d,l,u="";"qwiz_"==e?(c="quiz",d="qwiz",l="qwiz_"):(c="flashcard deck",d="qdeck",l="qcard_"),u+='<div class="pay_preview_status">'+i+"</div>";var p=!1;if(!0===document_qwiz_user_logged_in_b){if("paid"!=get_qwizdeckdata(e,t,"pay_quiz_ok"))if(r.length){u+=a+r.join("");var g=o?"Sign up":"Pay now";u+='<a href="javascript: '+e+".hide_menu_and_display_login ("+t+", false, 'pay', '', 0, '"+g+'\')" class="qwiz_pay_unlock_menu_pay_now">'+g+"</a>"}else u+=1==document_qwiz_school_id?"Please contact the maker of this "+c+": they need to provide an individual-student payment option for you":"Please talk to your teacher: they need to provide access to this "+c+" for you"}else if(!s){var h="?url="+encodeURIComponent(qqc.get_qwiz_param("url","./"))+"&qname="+l+"&i_qwiz="+t;qqc.get_qwiz_param("secure_server_loc");if(u+=`<div><b>Students in a teacher’s class</b>: Use your teacher’s registration code to <a href="javascript: qwiz_qcards_common.pay_unlock_menu_display_login ('${e}', ${t}, 'register')" class="qwiz_login">`+qqc.T("register")+"</a>. ",r.length&&(u+="<br />"+a+r.join(""),!o)){u+=`<a href="javascript: qwiz_qcards_common.pay_unlock_menu_display_login ('${e}', ${t}, 'register', '${"Please register so you can get credited for your payment"}')" class="qwiz_login qwiz_pay_unlock_menu_pay_now">\n Pay now\n </a>`}if(u+="</div>",n.length&&(u+="<div><b>Teachers</b>: "+n.join("<br />"),_)){qqc.maker_logged_in_b||(p=!0);u+='<br /><a href="'+("javascript: "+e+".hide_menu_and_display_login ("+t+", false, 'maker_pay')")+'" class="teacher_subscriptions qwiz_login" data-query_string="'+h+'" target="_blank">Teacher subscriptions</a>'}u+="</div>"}return $("div#pay_unlock_menu-"+d+t).html(u),p}this.do_preview=function(e,t){if(!do_preview_form){var s=[];s.push('<form name="do_preview" target="_blank">'),s.push('<input type="hidden" name="qwizmin">'),s.push("</form>"),$("body").append(s.join("\n")),do_preview_form=!0}const i="qwiz_"==t?"qwiz":"deck";$.cookie(i+"_preview",e,{path:"/"}),$.cookie("qwiz_preview_username",document_qwiz_username,{path:"/"});const a=document.forms.do_preview,r=document.location.href,o=document.location.search.match(/qwizmin=(\d)/);o&&(a.qwizmin.value=o[1]),a.action=r,a.submit()},this.assign_to_classes=function(e,t){var s;s="qwiz_"==e?$("div#qwiz"+t).attr("qrecord_id"):$("div.qcard_card-qdeck"+t+" div.qcard-front").attr("qrecord_id");qqc.qjax(e,t,s,"assign_to_classes",{modal:1})},this.dialog_assign_to_classes=function(e){if(debug[0]&&console.log("[dialog_assign_to_classes] data:",e),e.errmsg)return void alert(e.errmsg);if(assign_to_classes_data=e,!$dialog_assign_to_classes){var t=[];t.push('<div id="dialog_assign_to_classes" title="Assign quiz/flashcard deck to classes">'),t.push('<div id="assign_to_classes_feedback_msg">'),t.push(" "),t.push("</div>"),t.push('<h3 class="assign_to_classes qwiz_display_none">'),t.push('Assign <span id="assign_to_classes_quiz_flashcard_deck"></span> to classes'),t.push("</h3>"),t.push('<div id="assign_to_classes_select">'),t.push("</div>"),t.push("<br />"),t.push('<h3 class="assign_to_classes qwiz_display_none">'),t.push('Set <span id="assign_to_classes_assignment_due"></span> date'),t.push("</h3>"),t.push('<input id="assign_to_classes_assignment_date" class="qwiz_display_none" type="date" onchange="qwiz_qcards_common.update_assignment_date (this)" />'),t.push("</div>"),$("body").append(t.join("\n")),$dialog_assign_to_classes=$("div#dialog_assign_to_classes").dialog({autoOpen:!1,width:600,height:600,modal:!0,resizable:!1,buttons:{Close:function(){$dialog_assign_to_classes.dialog("close")}}})}const s={class_id:"all",maker_id:e.maker_id,callback:"qwiz_qcards_common.assign_to_classes_set_quizzes_decks"};qqc.qjax(e.qname,0,e.qrecord_id,"get_quizzes_decks",s)},this.assign_to_classes_set_quizzes_decks=function(e){debug[0]&&console.log("[assign_to_classes_set_quizzes_decks] data:",e);const t="qwiz_"==assign_to_classes_data.qname?"quiz":"flashcard deck";var s=[];if(0==e.class_ids_assigned_to_qwiz.length){const e=assign_to_classes_data.qrecord_id.replace(/sciencemusicvideosMeister1961-/,"");s.push("<b>Sorry, this "+t+", “"+e+"”, has not been made available to you for use in your classes."),s.push("<br />"),s.push("<br />"),s.push("You will have to contact the "+t+" owner/creator and ask them to provide it to you.</b>"),$("div#assign_to_classes_select").html(s.join("\n"))}else{s.push('<select id="class_select" multiple="multiple">');const n=assign_to_classes_data.class_ids,_=assign_to_classes_data.class_names,c=assign_to_classes_data.deleted_fs,d=n.length;for(var i=!1,a=0;a<d;a++)if(!c[a]){var r="";-1!=e.class_ids_assigned_to_qwiz[0].indexOf(n[a])&&(r=" selected",i=!0),s.push('<option value="'+n[a]+'"'+r+">"),s.push(_[a]),s.push("</option>")}s.push("</select>"),i&&(s.push("<br />"),s.push('<span style="font-size: 8pt; color: gray;">'),s.push("Click in the box for options dropdown"),s.push("</span>")),$("div#assign_to_classes_select").html(s.join("\n")),$("h3.assign_to_classes").removeClass("qwiz_display_none"),$("span#assign_to_classes_quiz_flashcard_deck").html(t+" “"+e.display_names[0]+"”");var o=$("select#class_select");o.select2({placeholder:"Select...",width:"250px"}),o.on("select2:unselect",deassign_class_from_quiz),o.on("select2:select",add_class_to_qwiz_qdeck);const l=e.assignment_due?"due":"assignment";if($("span#assign_to_classes_assignment_due").html(l),$("input#assign_to_classes_assignment_date").removeClass("qwiz_display_none"),void 0!==e.assignment_dates[0]){const t=DateFormat.format.date(1e3*e.assignment_dates[0],"yyyy-MM-dd");$("input#assign_to_classes_assignment_date").val(t)}}$dialog_assign_to_classes.dialog("open")},this.update_assignment_date=function(e){var t=e.value;if(!t)return void $("div#assign_to_classes_feedback_msg").html('<span class="qwiz_errmsg">Please enter a valid date</span>');t=Date.parse(t+"T00:00")/1e3;const s={qrecord_ids:[assign_to_classes_data.qrecord_id],field:"assignment_date",value:t,callback:"qwiz_qcards_common.assign_to_classes_updated"};qqc.qjax("",0,assign_to_classes_data.qrecord_id,"update_quiz_deck",s)},this.assign_to_classes_updated=function(e){var t,s=DateFormat.format.date((new Date).getTime(),"h:mm:ss");t=e.affected_rows>=1?"Database updated "+s:'<span class="qwiz_red">Sorry, unable to update database</span>',$("div#assign_to_classes_feedback_msg").html(t)},this.request_assign_to_class=function(e){var t,s,i;e?(t="qwiz_",s=qwiz_.assign_to_class_i_qwiz,i=qwiz_.assign_to_class_qrecord_id):(t="qcard_",s=qcard_.assign_to_class_i_deck,i=qcard_.assign_to_class_qrecord_id,document_qwiz_qdeck_maker_ids["qdeck"+s]);const a=document_qwiz_school_id,r=document_qwiz_taker_id,o=window.location.href,n={taker_username:document_qwiz_username,school_id:a,taker_id:r,page_url:o};plugin_url||(plugin_url=qqc.get_qwiz_param("url","./"));const _='<img src="'+plugin_url+'images/spinner16x16.gif" />';$("div#"+t+"request_assign_to_class_feedback").html(_),qqc.qjax(t,s,i,"request_assign_to_class",n)},this.do_not_show_assign_to_class=function(e){const t=document_qwiz_username+"do_not_show_assign_to_class";if(e.checked){const e={expires:7};$.cookie(t,1,e)}else $.removeCookie(t)},this.pay_unlock_menu_display_login=function(e,t,s,i,a,r){var o,n;"qwiz_"==e?(o="qwiz",n=qwiz_):(o="qdeck",n=qcard_);var _=$("div.qwiz_icon_and_menu_container."+o+t);_.css({"z-index":"-1"}),n.display_login(t,!1,s,i,a,r);setTimeout(function(){_.css({"z-index":""})},100)},this.sign_out=function(e,t,s,i){var a={session_id:document_qwiz_session_id,table:"session_id"};if(qqc.qjax("",-1,"","delete_session_id",a),$.removeCookie("qwiz_session_id",{path:"/"}),document_qwiz_user_logged_in_b=!1,document_qwiz_maker_privileges=!1,document_qwiz_session_id="",document_qwiz_username="",document_qwiz_independent_taker_f="",document_qwiz_email="",document_qwiz_email_confirm=default_document_qwiz_email_confirm,document_qwiz_school_id=0,document_qwiz_team_b=!1,document_qwiz_good_through_date="",document_qwiz_good_through_date_ok=!1,document_qwiz_university_discount=!1,s){setTimeout(function(){var e=qwiz_deck_selector(s,i);$(e+"input.register_taker_username").val("")},50)}qqc.set_user_menus_and_icons(!e,t),qwiz_&&qwiz_.any_pay_quiz_f&&qwiz_.pay_lock_settings(),qcard_&&qcard_.any_pay_deck_f&&qcard_.pay_lock_settings(),document_qwiz_pay_registration_date_unix=0;const r=set_display_pay_screen(s,i),o="qwiz_"==s?qwiz_:qcard_;"open_register"==r?o.hide_menu_and_display_login(i,!1,"open_register","",!1):"free_trial"==r?o.hide_menu_and_display_login(i,!1,"free_trial","",!0):"register"==r&&o.hide_menu_and_display_login(i,!1,"register","",!1)},this.usermenu_pay=function(e,t){"qwiz_"==e?$("div.qwiz-progress-container.qwiz"+t).find("a.qwiz_pay_unlock_menu_pay_now")[0].click():$("div#qcard_progress-qdeck"+t).find("a.qwiz_pay_unlock_menu_pay_now")[0].click()},this.set_qscore_menus=function(e){var t;"not ready"==server_loc&&(server_loc=qqc.get_qwiz_param("server_loc"),secure_server_loc=qqc.get_qwiz_param("secure_server_loc")),!0===document_qwiz_user_logged_in_b?(t='<a href="'+secure_server_loc+"/index.php?student_view=1&time="+document_qwiz_session_id+'" target="_blank">',t+=qqc.T("View scores")):(t='<a href="'+secure_server_loc+'/student_login.php" target="_blank">',t+=qqc.T("Login/View scores")),t+="</a>",e.html(t)},this.create_progress_bars=function(e,t,s,i){progress_bars_leaderboard[e+s]=i,plugin_url||(plugin_url=qqc.get_qwiz_param("url","./"));var a='<img src="'+(plugin_url+"images/spinner40x40.gif")+'" class="qwiz-center" style="margin-top: 100px;" />';e&&qqc.$get_login_div(e,s).html(a).show();if(!0!==document_qwiz_user_logged_in_b){var r={not_logged_in_f:1,qname:e,i_qwiz_qdeck:s,qrecord_id:t[s].qrecord_id};return qqc.create_progress_bars3(r),!1}if(t[s].record_start_b&&!0===document_qwiz_user_logged_in_b){t[s].record_start_b=!1;var o=(new Date).getTime()/1e3,n=(r={qrecord_id_ok:t[s].qrecord_id_ok,type:"start",now_sec:o,callback:"create_progress_bars2"},"qwiz_"==e?"record_response_v4":"record_qcard_v3");qqc.qjax(e,s,t[s].qrecord_id,n,r)}else qqc.create_progress_bars2(e,s,t[s].qrecord_id)},this.create_progress_bars2=function(e,t,s){var i;if(document_qwiz_independent_taker_f&&(document_qwiz_class_id="independent_student"),i=get_qwizdeckdata(e,t,"use_dataset")){if(/\|\s*unit:/.test(i))var[i,a,r]=qqc.parse_use_dataset(i);else var a=[],r=[];get_dataset_units_topics(e,t,s,i,a,r,"create_progress_bars3")}else{var o,n;if("qwiz_"==e)n=qwiz_.get_qwizdata(t,"n_questions"),o=qwiz_.get_qwizdata(t,"n_correct");else o=(n=qcard_.get_deckdata(t,"n_cards"))-qcard_.get_deckdata(t,"n_to_go");var _={qname:e,i_qwiz_qdeck:t,qrecord_id:s,units:[""],n_correct_by_unit_topic:[o],n_questions_by_unit_topic:[n]};qqc.create_progress_bars3(_)}};var leaderboard_refresh_sec=0,update_email_data,enroll_reg_code_ok_f,enroll_reg_code_school_id,enroll_reg_code_school_name,enroll_reg_code_class_id,enroll_reg_code_class_name,global_data_urls,global_blob_urls,number_word,ordinal_words;function record_units_topics_state(e,t){var s=qqc.$get_login_div(e,t),i=[];s.find("img.expand_collapse_unit.collapse").each(function(){var e=$(this).parents("tr.unit_head")[0].id.match(/\d+$/)[0];i.push(e)});var a=!1,r=[],o=[];s.find('table.dataset_units_topics input[type="checkbox"]').each(function(){if(this.checked)if(this.id){var e=this.id.match(/\d+$/)[0];o.push(e)}else{var t=$(this).parents("tr.unit_head");if(t.length){var s=t[0].id.match(/\d+$/)[0];r.push(s)}else a=this.checked}});const n={i_units_expanded:i,table_head_checked:a,i_units_checked:r,i_topics_checked:o};debug[0]&&console.log("[record_units_topics_state] state:",n),units_topics_state[e+t]=n}function restore_units_topics_state(e,t){var s=units_topics_state[e+t];if(s){debug[0]&&console.log("[restore_units_topics_state] state:",s);var i=qqc.$get_login_div(e,t),a=s.i_units_expanded;i.find("img.expand_collapse_unit").each(function(){let e=$(this);var t=e.parents("tr.unit_head")[0].id.match(/\d+$/)[0];-1!=a.indexOf(t)&&e.trigger("click")}),i.find('table.dataset_units_topics input[type="checkbox"]').each(function(){this.checked=!1});var r=s.i_units_checked,o=s.i_topics_checked;i.find('table.dataset_units_topics input[type="checkbox"]').each(function(){if(this.id){var e=this.id.match(/\d+$/)[0];-1!=o.indexOf(e)&&(this.checked=!0)}else{var t=$(this).parents("tr.unit_head");if(t.length){var i=t[0].id.match(/\d+$/)[0];-1!=r.indexOf(i)&&(this.checked=!0)}else this.checked=s.table_head_checked}})}else debug[0]&&console.log("[restore_units_topics_state] (not available)")}function units_topics_sort(e,t){var s=[];const i=e.length;for(var a=0;a<i;a++)s.push([a,qqc.create_sortable_unit_number(e[a]),qqc.create_sortable_unit_number(t[a])]);s.sort(firstBy(1).thenBy(2));var r=[];for(a=0;a<i;a++)r.push(s[a][0]);return r}function units_topics_counts(e,t,s,i,a){var r=e.units,o=e.topics,n=e.levels,_=e.n_questions_by_unit_topic,c=e.n_correct_by_unit_topic,d=r.length,l=units_topics_sort(r,o),u=[],p=[],g={},h={},q={},m={},f=!0,w={},b=0,v=r[d-1];v||(v="Other");for(var k=0,z=0,y=0,$="",x=d-1;x>=0;x--){const e=l[x],t=parseInt(_[e],10),s=null===c[e]?0:parseInt(c[e],10);r[e]||(r[e]="Other"),o[e]||(o[e]="Other");var T=r[e]+"__"+o[e];if(T=T.replace(/[^a-z0-9 ]/gi,"_"),""==n[e]){if(i[qqc.default_level]="",a&&-1==a.indexOf(qqc.default_level))continue}else if(i[n[e]]="",!a||-1==a.indexOf(n[e]))continue;if(h[T]||(h[T]=0,q[T]=0),h[T]+=t,q[T]+=s,r[e]!=v){var S=v.replace(/[^a-z0-9 ]/gi,"_");g[S]=k,m[S]=z,"Other"!=v&&(f=!1),w[S]=0==y,k=0,z=0,y=0,v=r[e]}k+=t,z+=s,b+=t,T!=$&&("Other"!=o[e]&&y++,u.push(r[e]),p.push(o[e]),$=T)}if(d){var j=l[0],C=!1;if(""==n[j]?i[qqc.default_level]="":(i[n[j]]="",-1==a.indexOf(n[j])&&(C=!0)),!C){var A=r[j].replace(/[^a-z0-9 ]/gi,"_");g[A]=k,m[A]=z,"Other"!=r[j]&&(f=!1),w[A]=0==y}}return[u,p,d=u.length,l=units_topics_sort(u,p),g,h,m,q,b,f,w,i]}function create_units_topics_correspondence(e,t){for(var s=e.length,i=[],a=[],r=[],o=0,n=0;n<s;n++){var _=e[n].length;r.push(_);for(var c=[],d=[],l=0;l<_;l++){var u=e[n][l].replace(/\.{0,1}([a-z])/i," $1").replace(/[-_]/g," ").replace(/s /g," ").replace(/s$/,""),p=t[n][l].replace(/\.{0,1}([a-z])/i," $1").replace(/[-_]/g," ").replace(/s /g," ").replace(/s$/,"");c.push(u),d.push(p)}i.push(c),a.push(d),_>o&&(o=_)}var g=[];const h=i[0].length;for(n=1;n<s;n++){g.push([]);var q=0,m=3,f=0;const e=i[n].length;for(l=0;l<h;l++){for(var w=!1,b=q;b<m&&!(f+b>=e);b++){if(units_topics_correspondence_twoway_comparison(i[0][l],a[0][l],i[n][f+b],a[n][f+b])){if(b<0&&-1!=g[n-1].indexOf(f+b)){debug[13]&&console.log("[create_units_topics_correspondence] (already used) j + jj:",f+b);continue}g[n-1].push(f+b),w=!0,debug[13]&&(console.log(`[create_units_topics_correspondence] Match: ${i[0][l]} | ${a[0][l]} (i=${l})`),console.log(` ${i[n][f+b]} | ${a[n][f+b]} (j=${f+b})`)),q=b>0?-b:b,m=3,f+=b+1;break}}w||(g[n-1].push(-1),debug[13]&&console.log(`[create_units_topics_correspondence] No match to ${i[0][l]} | ${a[0][l]} (i=${l})`),m++)}}if(debug[13]){console.log("[create_units_topics_correspondence] datasets_matches:",g);var v,k=[]}var z="",y=(f=new Array(s-1).fill(0),[]);for(n=0;n<s;n++)y.push([]);for(l=0;l<r[0];l++){(u=e[0][l])!=z&&(debug[13]&&k.push("UNIT "+u),z=u);var $=t[0][l];y[0].push(l),debug[13]&&(k.push([$]),v=k.length-1);var x=[],T=["NA"];for(n=0;n<s-1;n++){for(x.push(-1),(b=g[n][l])>=0&&(y[n+1].push(b),debug[13]&&k[v].push(t[n+1][b]));;){if(b==f[n]){f[n]++;break}if(b<0){y[n+1].push(-1),debug[13]&&k[v].push("NA");break}if(-1==g[n].indexOf(f[n])){if(x.push(f[n]),T.push(t[n+1][f[n]]),n==s-2){for(var S=0;S<s;S++)y[S].push(x[S]);debug[13]&&k.push(T)}f[n]++;break}f[n]++}}}if(debug[13]&&console.log("[create_units_topics_correspondence] lines:",k),debug[0]){k=[];for(_=y[0].length,l=0;l<_;l++){k.push([]);for(n=0;n<s;n++){(b=y[n][l])>=0?k[l].push(t[n][b]):k[l].push("NA")}}console.log("[create_units_topics_correspondence] display_line_to_dataset_j: ",y),console.log("[create_units_topics_correspondence] lines:",k)}return y}function units_topics_correspondence_twoway_comparison(e,t,s,i){const a=.69;var r=!1;return(units_topics_correspondence_com_score(e,s)>a||units_topics_correspondence_com_score(s,e)>a)&&(units_topics_correspondence_com_score(t,i)>a||units_topics_correspondence_com_score(i,t)>a)&&(r=!0),r}function units_topics_correspondence_com_score(e,t){s1s=e.split(/\s+/);var s=0;for(var i of s1s)e.includes(i)&&(/[a-z]/i.test(i)?s+=1:s+=.3);var a=0;for(var i of s1s)t.includes(i)&&(/[a-z]/i.test(i)?a+=1:a+=.3);return cscore=a/s,debug[13]&&(console.log("[units_topics_correspondence_twoway_comparison] s1:",e),console.log("[units_topics_correspondence_twoway_comparison] s2:",t),console.log("[units_topics_correspondence_twoway_comparison] cscore:",cscore.toFixed(2))),cscore}function get_dataset_units_topics(e,t,s,i,a,r,o){var n="";void 0!==document_qwiz_session_id&&(n=document_qwiz_session_id);var _={qname:e,i_qwiz_qdeck:t,dataset:i,units:a,topics:r,qwiz_session_id:n};o&&(_.callback=o),debug[0]&&(_.qdebug=1),qqc.qjax(e,t,s,"get_dataset_units_topics",_)}function get_combo_units_topics(e,t,s,i,a,r,o){var n="";void 0!==document_qwiz_session_id&&(n=document_qwiz_session_id);var _={qname:e,i_qwiz_qdeck:t,dataset:i,units:a,topics:r,qwiz_session_id:n};o&&(_.callback=o),debug[0]&&(_.qdebug=1),qqc.qjax(e,t,s,"get_combo_units_topics",_)}function subscription_plan_data(e,t){var s,i,a=qqc.set_immediate_payment(e,t);const r="05-04",o=parseInt(r.split("-")[0])-1,n=parseInt(r.split("-")[1]),_=1e3*qqc.get_qwiz_param("current_time_unix"),c=DateFormat.format.date(_,"yyyy"),d=DateFormat.format.date(_,"MM-dd"),l=new Date(parseInt(c),o-2,n).getTime(),u=DateFormat.format.date(l,"MM-dd"),p=new Date(parseInt(c),o-1,n).getTime(),g=DateFormat.format.date(p,"MM-dd");var h=!1;return!a&&d>=r?(s="P-19D295110R601454BM5XCHMY",i=29.95):!a&&d<u?(s="P-62Y81532P85606323NFP47AA",i=39.95):!a&&d<g?(s="P-2J818600MG931162NNGEM3DY",i=49.95,h=!0):(a=!0,s="P-4MH87306J1361740NNGEM5BY",i=49.95),["AdMvaQesYKbCDS3vl8-_Td2bmsnVdwrPl3jbkMzefr3RUZIsmK8BHwUZxEfg_f2m2jfmLJwh4-iEikTC",s,i,a,o,n,h]}function resize_feedback_images(e){$(e).find("img").each(function(){if(!this.qwiz_sizing){var e,t=$(this),s=parseInt(t.parents("div.qwiz-provide_feedback").width()),i=parseInt(t.width());debug[0]&&console.log("[resize_feedback_images] img_width:",i,", container_width:",s),e=i==s?1:1/window.devicePixelRatio;var a=parseInt(i*e),r=parseInt(t.height()*e);t.css({cssText:"border: 1px solid gray !important",width:a+"px",height:r+"px",margin:"0 5px 5px 0",float:"left"}),this.qwiz_sizing=1}})}function submit_feedback2(e,t,s,i,a){if(a){debug[0]&&console.log("[submit_feedback2] global_data_urls[0].substr (0, 50):",global_data_urls[0].substr(0,50));for(var r=a.length,o=0;o<r;o++)i=i.replace(a[o],'<img src="'+global_data_urls[o]);debug[0]&&console.log("[submit_feedback2] feedback_html.length:",i.length)}var n,_,c,d;if("qwiz_"==e?(n="div#qwiz"+t,_="qwiz",c=qwiz_.get_qwizdata,d=$("div.header-qwiz"+t).html()):(n="div.qcard_card-qdeck"+t,_="qdeck",c=qcard_.get_deckdata,d=$("div#qcard_header-qdeck"+t).html()),provide_feedback_html[n]=i,i.length>25e6)return alert("Sorry, your feedback is too big (large images). Please use smaller/fewer images."),!1;var l=c(t,"qrecord_id"),u=document_qwiz_qdeck_maker_ids[_+t],p={feedback_html:i,page_url:window.location.href,user_agent:navigator.userAgent,qwiz_qcard:n,qname:e,header_html:d,i_qwiz:t,i_question:s,maker_id:u,taker_username:document_qwiz_username,taker_email:document_qwiz_email};qqc.jjax(e,t,l,"receive_feedback",p)}function qwiz_deck_selector(e,t){return("qwiz_"==e?"div#qwiz"+t:"div.qcard_card-qdeck"+t)+" "}function set_display_pay_screen(e,t){var s;return s=get_qwizdeckdata(e,t,"display_pay_screen"),debug[0]&&console.log("[set_display_pay_screen] i_qwiz_deck:",t,", display_pay_screen:",s),s}function register_taker_open_register_pay_feedback(e,t){htm.push("<p>"),htm.push("Thanks. "),htm.push("</p>"),qqc.$get_login_div(e,t).html(htm.join("\n")).show()}function register_taker_registered_feedback(e,t,s,i){debug[0]&&(console.log("[register_taker_registered_feedback] qname:",e),console.log("[register_taker_registered_feedback] proceed_to_pay_f:",i));var a="";"qwiz_"==e&&(a=get_qwizdeckdata(e,t,"display_pay_screen"));var r=[];if(i)if("free_trial"==a)document_qwiz_good_through_date_ok=!0;else{if(/register/.test(a)){qwiz_.pay_lock_settings();return setTimeout(function(){qwiz_.display_login(t,!1,"pay","")},500),!1}"qwiz_"==e?qwiz_.display_login(t,!1,"pay","",1):qcard_.display_login(t,!1,"pay","",1)}else{if(s){plugin_url||(plugin_url=qqc.get_qwiz_param("url","./"));const e=plugin_url+"images/spinner40x40.gif";r.push('<img src="'+e+'" class="qwiz-center" style="margin-top: 70px;" />'),r.push("<p>"),r.push("You are now logged in so that your work can be recorded. "),r.push("In the future, use the pull-down triangle at the top right of any quiz or deck to log in."),r.push("</p>"),r.push("<p>"),r.push("The green triangle also gives you a menu option to view your scores."),r.push("</p>"),r.push("<p>")}else r.push("<br />"),r.push("<br />"),r.push("<p>"),r.push("<b>Thank you. You are now registered for class "+register_taker_global_reg_code_class_name+", "+register_taker_global_reg_code_school_name+"</b>"),r.push("</p>"),r.push("<p>"),r.push("When you do a quiz or flashcard deck, be sure to log in (under the"),r.push("pull-down triangle icon at the top right of any quiz or deck)."),r.push("</p>"),a||(i=register_taker_global_reg_code_ok_f?0:1,r.push('<button class="qwiz_button" onclick="'+e+".login_ok ("+t+", 0, "+i+')">'),r.push("Continue"),r.push("</button>"));qqc.$get_login_div(e,t).html(r.join("\n")).show()}return!1}function extract_delete_shortcode_content(e,t,s,i){for(var a=[],r="["+t+"]",o="[/"+t+"]";;){var n=e.indexOf(r);if(-1==n)break;if(e.indexOf(o)<n)i.additional_errmsgs.push(r+" "+qqc.T("found, but not")+" "+o);else{var _=new RegExp("(<[^\\/][^>]*>\\s*)*?\\["+t+"\\]([\\s\\S]*?)\\[\\/"+t+"\\]((<\\/[^>]+>\\s*)*)","m"),c=e.substr(n).match(_);a.push(c[2]),e=e.replace(_,"")}if(!s)break}return{htm:e,content:a=a.length?a.join(""):"NA"}}function add_span_if_empty(e,t){t||-1!=e.search(/\S/)?-1==e.replace(/ | | | | /,"").search(/\S/)&&(e+='<span class="qwiz-avoid-br" style="display: none;">x</span>'):e="";return e}function htmlDecode(e){return(new DOMParser).parseFromString(e,"text/html").documentElement.textContent}this.create_progress_bars3=function(e){debug[12]&&console.log("[create_progress_bars3] data:",e);var t,s=document_qwiz_user_logged_in_b,i=e.qname,a=e.i_qwiz_qdeck,r=e.qrecord_id;if(s){var o=e.units,n=e.n_correct_by_unit_topic,_=e.n_questions_by_unit_topic;t=o.length;for(var c=0,d=0,l=0;l<t;l++)c+=n[l],d+=_[l]}var u=[];const p=qwiz_.get_qwizdata(a,"qwiz_timer");if(u.push('<div id="progress_bars_leaderboard_tabs_'+i+a+'" class="progress_bars_leaderboard_tabs">'),u.push("<ul>"),p&&(u.push("<li>"),u.push('<a href="#leaderboard_tab_'+i+a+'">'),u.push("Fastest finish times"),u.push("</a>"),u.push("</li>")),u.push("</ul>"),p){u.push('<div id="leaderboard_tab_'+i+a+'" class="leaderboard">'),u.push('<div id="leaderboard-quiz_times_histogram-qwiz'+a+'">'),u.push("</div>"),u.push('<div class="refresh_leaderboard">'),u.push("Refresh every"),u.push('<select onchange="'+qqcname+".refresh_leaderboard_change (this, '"+i+"', "+a+", '"+r+"')\">");var g=["","5","10","15","30","60"],h=g.length;for(l=0;l<h;l++){var q=leaderboard_refresh_sec==g[l]?" selected":"";u.push('<option value="'+g[l]+'"'+q+">"),u.push(g[l]),u.push("</option>")}u.push("</select>"),u.push(" seconds"),u.push("</div>"),u.push('<button class="qwiz_button exit_progress_bars" style="float: right;" onclick="'+i+".no_login ("+a+', false, true, event)">'),u.push("Continue"),u.push("</button>"),u.push("</div>")}u.push("</div>"),$(i?"qwiz_"==i?"#qwiz_login-qwiz"+a:"div.qcard_card-qdeck"+a+" div.qcard-front div.qcard_content_size":"#progress_bars"+a).html(u.join("\n")).show();var m=0;if("leaderboard"==progress_bars_leaderboard[i+a]&&(m=1,qqc.qjax(i,a,r,"get_quiz_times",{full_quiz_f:1,summary:0})),$("#progress_bars_leaderboard_tabs_"+i+a).tabs({active:m,activate:function(e,t){t.newPanel.hasClass("leaderboard")&&(debug[12]&&console.log("[create_progress_bars3 > leaderboard activate] qrecord_id:",r),qqc.qjax(i,a,r,"get_quiz_times",{full_quiz_f:1,summary:0}))}}),s){if(t>1)for(l=0;l<t;l++){if("(excluded)"!=o[l]){var f=parseInt(100*n[l]/_[l],10),w=$("#unit_progress_bar-"+i+a+"-unit"+l);w.progressbar({value:f});var b=n[l]+"/"+_[l];w.find("div.progress-label").text(b)}}var v=$("#course_progress_bar-"+i+a);f=parseInt(100*c/d,10);v.progressbar({value:f});b=c+"/"+d;v.find("div.progress-label").text(b)}},this.refresh_leaderboard_change=function(e,t,s,i){if(void 0!==refresh_leaderboard_timeout[s]&&clearTimeout(refresh_leaderboard_timeout[s]),leaderboard_refresh_sec=e.value){var a=function(){qqc.qjax(t,s,i,"get_quiz_times",{summary:0}),refresh_leaderboard_timeout[s]=setTimeout(a,1e3*leaderboard_refresh_sec)};refresh_leaderboard_timeout[s]=setTimeout(a,1e3*leaderboard_refresh_sec)}},this.update_leaderboard_opt_out=function(e,t,s){var i=s.checked?1:0;qqc.qjax(e,t,"","update_leaderboard_opt_out",{opt_out_f:i})},this.create_use_dataset_options=function(e,t,s){"qwiz_"==e?$("#progress-qwiz"+s).html(""):$("#progress-qdeck"+s).html(""),plugin_url||(plugin_url=qqc.get_qwiz_param("url","./"));const i='<img src="'+(plugin_url+"images/spinner40x40.gif")+'" class="qwiz-center" style="margin-top: 100px;" />';qqc.$get_login_div(e,s).html(i).show(),use_dataset_options_display_name[e+s]=t[s].use_dataset_options_display_name;const a=t[s].qrecord_id,r=t[s].use_dataset;qqc.create_use_dataset_options2(e,s,r,a)},this.create_use_dataset_options2=function(e,t,s,i){if(debug[11]&&console.log("[create_use_dataset_options2] dataset:",s,", qrecord_id:",i),/\|\s*unit:/.test(s))var[s,a,r]=qqc.parse_use_dataset(s);else var a=[],r=[];"qwiz_"==e&&qwiz_.get_qwizdata(t,"combo")?get_combo_units_topics(e,t,i,s,a,r):get_dataset_units_topics(e,t,i,s,a,r)},this.create_use_dataset_options3=function(e,t,s){var i,a,r,o;debug[11]&&console.log("[create_use_dataset_options3] data:",e),dataset_units_topics_data=e;var n,_,c=[],d=[],l=[],u=[],p=[],g=[],h=[],q=[],m=[],f=[],w=1,b=[0],v=[],k={};if(selected_levels[t+s]&&(_=selected_levels[t+s]),void 0!==e.datasets_data){w=e.datasets_data.length,b=[...Array(w).keys()],n=[],o=[],a=[];for(let i of b){let r=e.datasets_data[i];[c[i],d[i],l[i],u[i],p[i],g[i],h[i],q[i],m[i],n[i],f[i],k]=units_topics_counts(t,s,r,k,_),o.push(r.dataset),a.push(r.qrecord_id),v.push(r.q_f),p[i].NA=1,h[i].NA=1,g[i].NA__NA=0,q[i].NA__NA=0}debug[11]&&console.log("[create_use_dataset_options3] n_cg_by_unit_topic:",q),n=-1==n.indexOf(!1);var z=e.datasets_data[0];t=z.qname,s=z.i_qwiz_qdeck,r=o.join("; "),i=a.join("; ");for(var y=create_units_topics_correspondence(c,d),x=[],T=[],S=y[0].length,j="",C=0;C<S;C++){if(-1!=(ie=y[0][C]))X=c[0][ie],Z=d[0][ie];else for(let e=1;e<w;e++)-1!=(ie=y[e][C])&&(X=c[e][ie],Z=d[e][ie]);x.push(X),T.push(Z),j=X}u[0]=units_topics_sort(x,T),debug[0]&&(console.log("[create_use_dataset_options3] sort_units:",x),console.log("[create_use_dataset_options3 sort_topics:",T),console.log("[create_use_dataset_options3 unit_topic_order[0]:",u[0]))}else[c[0],d[0],l[0],u[0],p[0],g[0],h[0],q[0],m[0],n,f[0],k]=units_topics_counts(e,t,s,k,_),a=[i=e.qrecord_id],o=[r=e.dataset],v=[e.q_f];k=Object.keys(k);var A=e.dataset_reset_questions_date;A||(A="");e.maker_specific_random;var M=e.maker_specific_questions_cards_to_show;M||(M=0);var P=qqc.$get_login_div(t,s);if(e.errmsg)return P.html("<br /><b>"+e.errmsg+"</b>").show(),!1;for(var S of l)0;maker_specific_n_qs_by_unit_topic=[];for(let e of b)maker_specific_n_qs_by_unit_topic[e]={};"not ready"==icon_expand_src&&(plugin_url||(plugin_url=qqc.get_qwiz_param("url","./")),icon_expand_src=plugin_url+"images/icon_expand.gif",icon_collapse_src=plugin_url+"images/icon_collapse.gif");var O=[],N=o[0];use_dataset_options_display_name[t+s]&&(N=use_dataset_options_display_name[t+s]),N=N.replace(/_/g," "),/cb=1/.test(document.location.search)&&(N=N.replace(/(AP|HS|High School) Bio(logy)*/gi,"Biology"));var E="topics_only"==get_qwizdeckdata(t,s,"dataset_intro_f"),I=get_qwizdeckdata(t,s,"dataset_intro_info_only_msg"),D="qwiz_"==t?qqc.T("questions"):qqc.T("cards");I&&O.push('<span class="qwiz_errmsg">'+I+"</span><br />"),O.push('<div class="use_dataset_options_header">'+N+"</div>");var R="";const F=f[0].Other;if(!n||void 0!==F&&!F){n&&qqc.set_qwizdeckdata(t,s,"expand_topics",!0),E||("qwiz_"==t?qwiz_.get_qwizdata(s,"qwiz_timer")?O.push('<p class="use_dataset_options">'+qqc.T("Note: you can do subsets, but you have to do all questions for the leaderboard")+"</p>"):O.push('<p class="use_dataset_options">'+qqc.T("Choose the type of questions you want to practice")+"</p>"):O.push('<p class="use_dataset_options">'+qqc.T("Choose the type of cards you want to practice")+"</p>")),O.push('<table id="dataset_units_topics-'+t+s+'" class="dataset_units_topics" align="center">'),O.push("<tr>"),O.push("<th>"),O.push("</th>");var B=E?"hidden":"visible";O.push("<th>"),O.push('<input type="checkbox" onclick="qwiz_qcards_common.dataset_units_topics_toggle_all (this)" style="visibility: '+B+'" checked />'),O.push("</th>"),O.push("<th>"),O.push('<span class="units_header">Unit</span>'),O.push("</th>"),O.push("<th>"),O.push('<span class="topics_header">Topic</span>'),O.push("</th>");let e=selected_levels[t+s],a="",r="",o="",_="";if(k.length&&(o='<span style="visibility: hidden;">*</span>',e&&e.length>0&&(k.length>2?a=qqc.T("Includes additional questions if additional levels selected below"):k.length>1&&(a=qqc.T("Includes additional questions if additional level selected below")),r="*",o="",R=" qwiz-blue",_='style="cursor: help;" ')),O.push(`<th class="qwiz-center${R}" ${_}colspan="9" title="${a}">`),i&&!0===document_qwiz_user_logged_in_b?"qwiz_"==t?O.push(o+qqc.T("Correct")+r):O.push(o+"“"+qqc.T("Got it!")+"”"+r):"qwiz_"==t?O.push(o+"Qs"+r):O.push(o+"Cards"+r),O.push("</th>"),O.push("</tr>"),w>1){O.push("<tr>"),O.push("<td>"),O.push("</td>");B=E?"hidden":"visible";O.push("<td>"),O.push("</td>"),O.push("<td>"),O.push("</td>"),O.push("<td>"),O.push("</td>");var H=qwiz_.get_qwizdata(s,"dataset_labels");for(var L of((H=H.split("; ")).length!=w&&(H=[...Array(w+1).keys()].slice(1)),H))O.push('<td class="qwiz-right qwiz-bold" style="padding-right: 8px;">'),O.push(L),O.push("</td>");O.push("</tr>")}j="";var J,U,Y=-1,V=new Array(w).fill(0),Q=new Array(w).fill(0),W=new Array(w).fill(0),K=new Array(w).fill(0),G=M/m[0];G>1&&(G=1),U=w>1?y[0].length:l[0];for(C=0;C<U;C++){var X,Z,ee=u[0][C],te=[],se=[];if(w>1){X=x[ee],Z=T[ee];for(let e of b){var ie;-1!=(ie=y[e][ee])?(te[e]=c[e][ie],se[e]=d[e][ie]):(X=j,te[e]="NA",se[e]="NA")}0}else{let e=0;X=c[e][ee],Z=d[e][ee],te[0]=X,se[0]=Z}if(X!=j){Y++,j=X;var ae=t+s+"-unit"+Y,re=X.replace(/[^a-z0-9 ]/gi,"_"),oe=[];for(let e of b)oe[e]=te[e].replace(/[^a-z0-9 ]/gi,"_");var ne=[],_e=0;for(let e of b)ne[e]=p[e][oe[e]],M&&(ne[e]=Math.ceil(ne[e]*G),W[e]+ne[e]>M&&(ne[e]=Math.max(M-W[e],0)),K[e]=0),_e+=ne[e];if(_e>0){O.push('<tr id="'+ae+'" class="unit_head">'),O.push('<td style="padding-right: 5px;">'),f[oe[0]]||O.push('<img src="'+icon_expand_src+'" class="expand expand_collapse expand_collapse_unit qwiz-inline" onclick="qwiz_qcards_common.dataset_unit_expand_collapse (\''+t+"', "+s+', this)" title="'+qqc.T("Show/hide topics in this unit")+'" />'),O.push("</td>"),O.push("<td>"),O.push('<input type="checkbox" class="toggle_topics" style="visibility: '+B+'" onclick="qwiz_qcards_common.dataset_unit_toggle_topics (this)" title="'+qqc.T("Select/deselect all topics in this unit")+'" checked />'),O.push("</td>"),O.push('<td colspan="2" class="unit">'),O.push("<b>"),O.push(X.replace(/_/g," ")),O.push("</b>"),O.push("</td>");for(let e of b){O.push('<td class="qwiz-right qwiz-nowrap nquestions '+re+'">');var ce="";i&&!0===document_qwiz_user_logged_in_b&&(ce=`${h[e][oe[e]]}/`),ce+=ne[e],O.push("<b>"),O.push(ce),O.push("</b>"),O.push("</td>"),W[e]+=ne[e]}O.push("</tr>")}}var de=X+"__"+Z;de=de.replace(/[^a-z0-9 ]/gi,"_");var le=[],ue=[];for(let e of b)le[e]=te[e]+"__"+se[e],le[e]=le[e].replace(/[^a-z0-9 ]/gi,"_"),ue[e]=g[e][le[e]];if(debug[11]&&console.log("[create_use_dataset_options3] ounit_otopic_class:",le),_e>0){var pe=0;for(let e of b)M&&(ue[e]=Math.ceil(ue[e]*G),K[e]+ue[e]>ne[e]&&(ue[e]=Math.max(ne[e]-K[e],0)),maker_specific_n_qs_by_unit_topic[e][le[e]]=ue[e]),pe+=ue[e];if(pe>0||w>1){O.push('<tr class="unit_topic unit_topic'+Y+'" data-unit="'+btoa(X)+'">'),O.push("<td>"),O.push("</td>");var ge=t+s+"-unit_topic"+ee;O.push("<td>"),O.push('<input type="checkbox" id="'+ge+'" style="visibility: '+B+'" checked />'),O.push("</td>"),O.push("<td>"),O.push("</td>");const e=Z.replace(/^(\d{1,2}\.\d+-*(\d\.*\d*)*[\., _]*)*/,"").replace(/_/g," ");O.push('<td class="topic" data-topic="'+btoa(Z)+'">'),O.push(e),O.push("</td>");for(let e of b){O.push(`<td class="qwiz-right qwiz-nowrap nquestions ${de}" data-unit="${btoa(te[e])}" data-topic="${btoa(se[e])}">`);ce="";i&&!0===document_qwiz_user_logged_in_b&&(debug[11]&&void 0===q[e][le[e]]&&console.log(`n_cg_by_unit_topic[${e}][${le[e]}]`),ce=`${q[e][le[e]]}/`),ce+=ue[e],O.push(ce),O.push("</td>"),V[e]+=ue[e],Q[e]+=q[e][le[e]],K[e]+=ue[e]}O.push("</tr>")}}}O.push('<tr class="border-top">'),O.push("<td>"),O.push("</td>"),O.push("<td>"),O.push("</td>"),O.push('<td colspan="2">'),O.push("<b>"),O.push(qqc.T("Total")),O.push("</b>"),O.push("</td>"),J=0;for(let e of b){O.push('<td class="qwiz-right qwiz-nowrap">');ce="";V[e]?(i&&!0===document_qwiz_user_logged_in_b&&(ce=`${Q[e]}/`),ce+=V[e],J+=V[e]):ce="–",O.push("<b>"),O.push(ce),O.push("</b>"),O.push("</td>")}O.push("</tr>"),O.push("</table>")}else{let e=0;J=M||g[e].Other__Other;Q=q[e].Other__Other;O.push("<br /><br />"),"qwiz_"==t?(O.push("<b>"+qqc.T("Questions")+": "+J),i&&!0===document_qwiz_user_logged_in_b&&O.push("  "+qqc.T("Correct")+": "+Q),O.push("</b><br />")):(O.push("<b>"+qqc.T("Cards")+": "+J),i&&!0===document_qwiz_user_logged_in_b&&O.push("  “"+qqc.T("Got it!")+"”: "+Q),O.push("</b><br />"))}if(!I){var he,qe;if(he=M?0:get_qwizdeckdata(t,s,"qwiz_"==t?"questions_to_show":"cards_to_show"),O.push('<p class="use_dataset_options">'),qe="qwiz_"==t?qqc.T("'Redo' - questions done before this date will not be counted in totals"):qqc.T("'Redo' - cards done before this date will not be counted in totals"),O.push("Restart:"),O.push('<input type="date" id="dataset_reset_questions_date_'+t+s+'" class="dataset_reset_questions_date" value='+A+" />"),O.push('<img src="'+plugin_url+'images/info_icon.png" class="qwiz_icon_smaller qwiz-inline" style="cursor: help;" title="'+qe+'">'),O.push(" "),E?O.push(D):O.push(qqc.T("Max to practice in this session")+":"),O.push('<select id="dataset_max_q_'+t+s+'" class="dataset_max_q">'),E)O.push("<option selected>"),O.push(J),O.push("</option>");else{var me=[5,10,20,30,50];debug[11]&&me.unshift(3);var fe=!1;if("qwiz_"==t){const e=get_qwizdeckdata(t,s,"default_max_to_practice");e&&(he=e)}var we=me.length;for(ee=0;ee<we;ee++){if(!fe&&he&&me[ee]>=he&&(O.push("<option selected>"),O.push(he),O.push("</option>"),fe=!0),me[ee]>=J){const e=fe?"":" selected";O.push("<option"+e+">"),O.push(J),O.push("</option>");break}he&&me[ee]==he||(O.push("<option>"),O.push(me[ee]),O.push("</option>"))}if(J>me[we-1]){const e=fe?"":" selected";O.push("<option"+e+">"),O.push(J),O.push("</option>")}}if(O.push("</select>"),qe="qwiz_"==t?"Note: questions that you miss will be repeated within this session":"Note: cards that you mark “Need more practice” will be repeated within this session",O.push('<img src="'+plugin_url+'images/info_icon.png" class="qwiz_icon_smaller qwiz-inline" style="cursor: help;" title="'+qe+'">'),O.push("</p>"),i&&!0===document_qwiz_user_logged_in_b&&!E){var be;O.push('<span class="use_dataset_options">'),O.push("Do "+D+":"),O.push("</span>"),O.push('<label class="qwiz_label use_dataset_options">'),be="qwiz_"==t?qqc.T("Priority is questions you answered incorrectly and new questions, but questions you answered correctly will sometimes be shown for review"):qqc.T("Priority is cards you marked")+" “"+qqc.T("Need more practice")+"” "+qqc.T("and new cards, but cards you marked")+" “"+qqc.T("Got it!")+"” "+qqc.T("will sometimes be shown for review"),O.push('<input type="radio" name="spaced_repetition" class="qwiz_radio_smaller" value="spaced_repetition" checked />'+qqc.T("Spaced repetition")+'<img src="'+plugin_url+'images/info_icon.png" class="qwiz_icon_smaller qwiz-inline" style="cursor: help;" title="'+be+'" />  '),O.push("</label>"),O.push('<label class="qwiz_label use_dataset_options">'),O.push('<input type="radio" name="spaced_repetition" class="qwiz_radio_smaller" value="new" />'+qqc.T("New")+" "),O.push("</label>"),O.push('<label class="qwiz_label use_dataset_options">');let e="qwiz_"==t?qqc.T("Incorrect"):"“"+qqc.T("Need more practice")+"”";O.push('<input type="radio" name="spaced_repetition" class="qwiz_radio_smaller" value="incorrect" />'+e+"  "),O.push("</label>"),O.push('<label class="qwiz_label use_dataset_options">'),O.push('<input type="radio" name="spaced_repetition" class="qwiz_radio_smaller" value="all" />'+qqc.T("All")),O.push("</label>"),O.push("<br />")}if(k.length>1){let e=qqc.T("Include levels"),i=selected_levels[t+s],a="";for(var ve of(i&&i.length>1&&(a='<span class="qwiz-bold">*</span>'),O.push(`<span class="use_dataset_options${R}">${a} ${e}:</span>`),k)){let e=`onclick="qwiz_qcards_common.select_level (this, '${ve}', '${t}', ${s})"`,a=!1;i?-1!=i.indexOf(ve)&&(a=!0):ve==qqc.default_level&&(a=!0);let r=a?"checked":"";O.push(`<label class="use_dataset_options${R}">`),O.push(`<input type="checkbox" class="select_level qwiz_radio_smaller" data-level="${ve}" ${e} ${r} />`+qqc.capitalize(ve)+" "),O.push("</label>")}O.push("<br />")}var ke=qqc.T("Begin practice");let e=0;var ze=`'${qqc.addSlashes(r)}', '${t}', ${s}, '${qqc.addSlashes(i)}', ${m[e]}, 0, 0, '${A}', ${M}, '${v.join("; ")}'`;O.push(`<button class="qwiz_button begin_practice" onclick="qwiz_qcards_common.begin_dataset_quiz_deck (${ze})">`),E&&(ke="qwiz_"==t?qqc.T("Start questions"):qqc.T("Start cards")),O.push(ke),O.push("</button>"),O.push("<br />"),O.push("<br />")}P.html(O.join("\n")).show(),"qcard_"==t&&qcard_.set_container_width_height(s),"qwiz_"==t?$(`div.qwiz-progress_meter-qwiz${s}`).css({"--n":J}):$(`div.qcard-progress_meter-qdeck${s}`).css({"--n":J}),E||get_qwizdeckdata(t,s,"expand_topics")?$("table#dataset_units_topics-qwiz_"+s+" img.expand_collapse_unit").each(function(){qqc.dataset_unit_expand_collapse(t,s,this)}):restore_units_topics_state(t,s)},this.select_level=function(e,t,s,i){var a=qqc.$get_login_div(s,i);selected_levels[s+i]=[],a.find("input.select_level").each(function(){if(this.checked){let e=$(this).data("level");selected_levels[s+i].push(e)}}),record_units_topics_state(s,i),qqc.create_use_dataset_options3(dataset_units_topics_data,s,i)},this.offset_height_rescale=function(e,t,s){var i=e.outerHeight()*(t-1);s&&(i+=s),e.css({"margin-bottom":i.toFixed(1)+"px"})},this.create_sortable_unit_number=function(e){var t="",s=typeof e;if("number"!=s&&"string"!=s)t="z";else if(""==e)t="z";else{var i=e.split("."),a=i.length;if(a>1){var r=i[1].split("-");i[1]=r[0]}for(var o=Math.min(2,a),n=0;n<o;n++)isNaN(i[n])||(i[n]=("++++++"+i[n]).slice(-6));t=i.join(".")+" "+e}return t},this.shuffle=function(e){for(var t,s,i=e.length;0!==i;)s=Math.floor(Math.random()*i),t=e[i-=1],e[i]=e[s],e[s]=t;return e},firstBy=function(){function e(e,t){if("function"!=typeof e){var s=e,i=window.navigator.userLanguage||window.navigator.language;e=function(e,t){if("number"==typeof e[s]&&"number"==typeof t[s])return e[s]-t[s];var a=e[s]||"zzz",r=t[s]||"zzz";return a.toString().toLowerCase().localeCompare(r.toString().toLowerCase(),i)}}return-1===t?function(t,s){return-e(t,s)}:e}function t(t,i){return(t=e(t,i)).thenBy=s,t}function s(s,i){var a=this;return s=e(s,i),t(function(e,t){return a(e,t)||s(e,t)})}return t}(),this.create_paypal_subscription_screen=function(e,t,s){$("div.qwiz-usermenu_icon").removeClass("qwiz-icon-bounce");const i=qqc.$get_login_div(e,t),[a,r,o,n,_,c,d]=subscription_plan_data(e,t);var l=[];if(s&&!document_qwiz_user_logged_in_b)return l.push("Please log in"),void i.html(l.join("\n")).show();if(n){const e=new Date(parseInt(today_yyyy),_,c).getTime(),t=DateFormat.format.date(e,"MMMM d, yyyy");l.push(`\n Start your subscription with PayPal or credit card. \n The cost is $${o} for access through ${t}. \n There will no further charges.\n <br />\n `)}else l.push(`\n <b>Start your free trial</b>\n <br />\n Start your two-week free trial with a PayPal or credit card\n authorization. \n There is no charge; you can cancel any time. \n After two weeks you will be charged $${o} per month;\n again, you can cancel any time. \n `);document_qwiz_user_logged_in_b&&document_qwiz_good_through_date&&l.push('\n <br />\n <span class="qwiz-smaller">\n <i>Note: free trials cannot be started with an existing\n account/login name. \n You will have to create a new account with a new login\n name after returning from PayPal<i>.\n </span>\n ');get_qwizdeckdata(e,t,"display_pay_screen");if(debug[0]){const s="test"+(parseInt(1e6*Math.random())+1e5);document_qwiz_good_through_date?l.push(`\n <br />\n <button onclick="qwiz_qcards_common.register_taker_open_register_pay_feedback ('${e}', ${t})">\n open_register test (bypass PayPal)\n </button>\n <br />\n `):l.push(`\n <br />\n <button onclick="qwiz_qcards_common.new_student_license ('${e}', ${t}, {subscriptionID: '${s}'})">\n Test (bypass PayPal)\n </button>\n <br />\n `)}l.push("<br />"),plugin_url||(plugin_url=qqc.get_qwiz_param("url","./"));const u='<img src="'+plugin_url+'images/spinner16x16.gif" />';l.push(`\n <script src="https://www.paypal.com/sdk/js?client-id=${a}&vault=true&intent=subscription">\n <\/script>\n <div id="paypal-button-container-${e}${t}" class="qwiz-paypal-button-container" style="width: 250px; height: 150px; margin: auto;">\n ${u}\n </div>\n `),i.html(l.join("\n")).show();var p=0;const g=function(){if("undefined"==typeof paypal)++p<20&&setTimeout(g,250);else{var s=[];if(s.push(`\n <script>\n parent.jQuery ('#paypal-button-container-${e}${t}').html ('');\n paypal.Buttons({\n style: {\n height: 40,\n shape: 'pill',\n tagline: false\n },\n createSubscription: function (data, actions) {\n return actions.subscription.create({\n plan_id: '${r}',\n application_context: {\n shipping_preference: 'NO_SHIPPING'\n }\n });\n },\n onApprove: function (data, actions) {\n if (document_qwiz_user_logged_in_b) {\n parent.qwiz_qcards_common.new_student_license ('${e}', ${t}, data);\n } else {\n parent.qwiz_qcards_common.post_paypal_student_registration_and_license ('${e}', ${t}, data);\n }\n }\n }).render("#paypal-button-container-${e}${t}");\n <\/script>\n `),!get_qwizdeckdata(e,t,"display_pay_screen")){const i="qwiz_"==e?"quiz":"flashcard deck";s.push(`\n <div class="qwiz-smaller" style="text-align: right; margin-top: 18px;">\n <button onclick="${e}.no_login (${t}, false, true)">\n Return to ${i}\n </button>\n </div>\n `)}i.append(s.join("\n"))}};setTimeout(g,250)},this.post_paypal_student_registration_and_license=function(e,t,s){debug[0]&&console.log("[post_paypal_student_registration_and_license] data:",s),document_qwiz_subscription_id=s.subscriptionID;const i=get_qwizdeckdata(e,t,"display_pay_screen"),a=qqc.set_immediate_payment(e,t);if("special_offer"==i||document_qwiz_user_logged_in_b&&"free_trial"==i&&a){s={login_f:"",special_offer:1,register_v2:"1",subscription:1,payment_type_id:a?65:52,subscription_id:document_qwiz_subscription_id,called_from:"post_paypal_student_registration_and_license",callback:"special_offer_callback"};return debug[0]&&console.log("[post_paypal_student_registration_and_license] data",s),void qqc.qjax(e,t,"","new_student_registration",s)}var r;r=qqc.set_immediate_payment(e,t)?"Create a new account – or log in with your existing account":"Create a new Learn-Biology.com login account",r+='<br /><span class="qwiz-smaller qwiz-highlight">Please be sure to complete this step in order to access learn-biology.com</span>',"qwiz_"==e?qwiz_.display_login(t,!1,"register",r):qcard_.display_login(t,!1,"register",r)},this.new_student_license=function(e,t,s){debug[0]&&console.log("[new_student_license] data:",s);const i=qqc.$get_login_div(e,t);plugin_url||(plugin_url=qqc.get_qwiz_param("url","./"));const a='<img src="'+plugin_url+'images/spinner40x40.gif" />';i.html(a).show(),document_qwiz_subscription_id=s.subscriptionID;s={login_f:"",license_only:1,register_v2:"1",subscription:1,payment_type_id:qqc.set_immediate_payment(e,t)?65:52,subscription_id:document_qwiz_subscription_id,called_from:"new_student_license",callback:"new_student_license_feedback"};debug[0]&&console.log("[new_student_license] data",s),qqc.qjax(e,t,"","new_student_registration",s)},this.new_student_license_feedback=function(e){debug[0]&&console.log("[new_student_license_feedback] data:",e);var t=e.qname,s=e.i_qwiz;e.errmsg;if(e.errmsg){qqc.$get_login_div(t,s).html(e.errmsg).show()}else{if("learn-biology.com"==qqc.get_qwiz_param("server_name")||debug[0]){get_qwizdeckdata(t,s,"display_pay_screen")?document.location="https://learn-biology.com/getstarted":("qwiz_"==t?qwiz_.login_ok(s):qcard_.login_ok(s),window.open("https://learn-biology.com/getstarted","_blank").focus())}}},this.create_pay_screen=function(e,t,s,i,a){debug[0]&&console.log("[create_pay_screen] msg:",i,", pay_now_sign_up:",a);var r=qqc.$get_login_div(e,s),o=[];if(t[s].pay_errmsg)o.push("<strong>"+t[s].pay_errmsg+"</strong><br />");else{i&&o.push(i+"<br />");var n=t[s].taker_payment_type_ids.length;if(0==n||"paid"==qwiz_.get_qwizdata(s,"pay_quiz_ok")){const t=get_qwizdeckdata(e,s,"display_pay_screen");return o.push("<br />"),o.push("<br />"),o.push("<p>"),"open_register"==t?o.push("<b>You are currently signed in to Learn-Biology.com. </b>"):(o.push("<b>You are currently signed in with an account that has access to quizzes and decks. </b>"),o.push("</p>"),o.push("<p>"),o.push("If you need to sign up with a different account, or you need to register for a class, please sign out by clicking on the green down-triangle, above right."),o.push("</p>")),void r.html(o.join("\n")).show()}t[s].any_promo;o.push('<form action="https://www.paypal.com/cgi-bin/webscr" onSubmit="return qwiz_qcards_common.submit_for_payment (\''+e+"', "+s+', this)" method="post" target="_blank">'),o.push('<input type="hidden" name="cmd" value="_s-xclick">'),o.push('<input type="hidden" name="hosted_button_id" value="WH6FWJY29SWN8">');var _=-1,c=0,d=n;void 0!==t[s].i_promo&&-1!=(_=t[s].i_promo)&&(c=_,d=_+1,n=1,a="Pay now"),o.push('<table class="pay_options">'),o.push("<tr>"),o.push("<td>"),o.push('<input type="hidden" name="on0" value="Options">'),n>1&&o.push("Please choose:"),o.push("</td>"),o.push("</tr>"),o.push("<tr>"),o.push("<td>");var l="";n<=2?l=' size="2" style="min-height: 42px;"':3==n?l=' size="3" style="min-height: 64px;"':n>=4&&(l=' size="4" style="min-height: 86px;"'),o.push('<select name="os0" class="qwiz_paypal_select"'+l+" onchange=\"qwiz_qcards_common.update_pay_button (this, '"+e+"', "+s+')">');for(var u=!0,p=!1,g=c;g<d;g++){var h=t[s].taker_fees[g],q=t[s].taker_payment_type_ids[g];if(debug[0]&&19.99==h&&(h="1.00"),!(document_qwiz_good_through_date_ok&&h<=0||8==q||65==q)){var m,f=t[s].taker_good_for_n_periodss[g],w=t[s].taker_good_for_periods[g],b=t[s].taker_payment_descriptions[g],v=t[s].taker_payment_selected_bs[g];h<=0?(m=qqc.capitalize(qqc.number_to_word(f))+" "+qqc.plural(w,w+"s",f),0==g&&(v=!0,p=!0)):(m=qqc.currency(h)+" "+qqc.number_to_word(f)+" "+qqc.plural(w,w+"s",f),a&&"Pay now"==a&&(p||(v=!0,p=!0))),b&&(m+=" - "+(b=(b=b.replace(/<\/{0,1}b>/gi,"")).replace(/<[^>]+>.*/,"")));var k=v?" selected":"";o.push('<option value="'+h+'"'+k+">"),o.push(m),o.push("</option>"),h>0&&(u=!1)}}o.push("</select> "),o.push("</td>"),o.push("</tr>"),o.push("</table>"),o.push('<input type="hidden" name="currency_code" value="USD">'),u||t[s].taker_fees[0]<=0&&(!a||"Sign up"==a)?(sign_up_display="block",paypal_display="none"):(sign_up_display="none",paypal_display="block");var z='style="display: '+sign_up_display+';"';o.push('<div class="sign_up_button" '+z+">"),o.push('<input type="submit" class="qwiz_button" value="Sign up" />'),o.push('<div class="signup_confirm_email_errmsg qwiz_errmsg" style="display: none;">'),o.push("</div>"),o.push("</div>"),z='style="display: '+paypal_display+';"',o.push('<div class="paypal_button" '+z+">"),o.push('<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_paynowCC_LG.gif" style="border: none;" name="submit" alt="PayPal - The safer, easier way to pay online!">'),o.push('<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">'),o.push("</div>"),o.push('<input type="hidden" name="custom">'),o.push("</form>"),o.push("<button onclick=\"qwiz_qcards_common.payment_received (1, '"+e+"', "+s+')" class="qwiz_pay_cancel qwiz-smaller">'),o.push("Cancel"),o.push("</button>")}r.html(o.join("\n")).show()},this.update_pay_button=function(e,t,s){var i=qwiz_deck_selector(t,s);$(i+" div.signup_confirm_email_errmsg").hide(),e.value<="0.00"?($(i+"div.sign_up_button").show(),$(i+"div.paypal_button").hide()):($(i+"div.sign_up_button").hide(),$(i+"div.paypal_button").show())},this.hide_signup_confirm_email_errmsg=function(e){$(e).parents("div.sign_up_button").find("div.signup_confirm_email_errmsg").hide()},this.update_email_callback=function(e,t,s){debug&&console.log("[update_email_callback] qname:",e,", i_qwiz:",t,", errmsg:",s);var i=qwiz_deck_selector(e,t);if("need_password"==s)return qqc.create_password_dialog(e,t),$dialog_current_password.dialog("open"),!1;"password_incorrect"==s?$("#current_password_errmsg").html("Password incorrect"):"not_unique"==s?($(i+" div.update_email_errmsg").html("Email address already in use"),$(i+" span.confirm_email_address").addClass("qwiz_button_disabled")):"fail"==s?$(i+" div.update_email_errmsg").html("Sorry, unable to update email"):"ok"==s&&(document_qwiz_email=$(i+" input.confirm_email_address").val(),qqc.confirm_email2(e,t)),$dialog_current_password&&$dialog_current_password.dialog("close")},this.update_email_hide_error=function(e,t){var s=qwiz_deck_selector(e,t);return $(s+" div.update_email_errmsg").html(""),$(s+" span.confirm_email_address").removeClass("qwiz_button_disabled"),!1},this.confirm_email=function(e,t,s){if($(e).hasClass("qwiz_button_disabled"))return!1;var i=qwiz_deck_selector(t,s),a=$(i+"input.confirm_email_address").val();if(""==a)return $(i+" div.update_email_errmsg").html("Please enter email address"),$(e).addClass("qwiz_button_disabled"),!1;if(a!=document_qwiz_email){return/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i.test(a)?(update_email_data={field:"email",value:a,callback:"qwiz_qcards_common.update_email_callback"},$(i+" span.confirm_email_address").addClass("qwiz_button_disabled"),qqc.qjax(t,s,"","update_my_account",update_email_data)):($(i+" div.update_email_errmsg").html("Not a valid email address"),$(e).addClass("qwiz_button_disabled")),!1}qqc.confirm_email2(t,s)},this.confirm_email2=function(e,t){var s=qwiz_deck_selector(e,t);$(s+" .signup_confirm_email").css({visibility:"visible"}),$(s+" input.signup_confirm_email").val("").focus(),$(s+" input.sign_up").removeClass("qwiz_button_disabled").prop("disabled",!1),$(s+" div.signup_confirm_email_errmsg").hide();var i={field:"email_confirm",value:"",email_address:$(s+" input.confirm_email_address").val(),username:document_qwiz_username,callback:"qwiz_qcards_common.confirm_email_callback"};qqc.qjax(e,t,"","update_my_account",i)},this.confirm_email_callback=function(e,t,s){debug[0]&&console.log("[confirm_email_callback] errmsg:",s),"need_password"==s&&(qqc.create_password_dialog(e,t),$dialog_current_password.dialog("open"))},this.hide_current_password_errmsg=function(){$("#current_password_errmsg").html("")},this.create_password_dialog=function(e,t){var s=[];s.push('<div id="dialog_current_password" title="Security check: re-enter password">'),s.push("<tr>"),s.push("<td>"),s.push("Password"),s.push("</td>"),s.push("<td>"),s.push('<input id="current_password" type="password" onfocus="qwiz_qcards_common.hide_current_password_errmsg ()" />'),s.push("<br />"),s.push('<div id="current_password_errmsg" class="qwiz_errmsg">'),s.push("</div>"),s.push("</td>"),s.push("</tr>"),s.push("</div>"),$("body").append(s.join("\n")),$dialog_current_password=$("#dialog_current_password").dialog({autoOpen:!1,height:200,width:350,modal:!0,buttons:{Submit:function(){qqc.update_session_id(e,t)},Cancel:function(){$dialog_current_password.dialog("close")}}})},this.update_session_id=function(e,t){var s=$("#current_password").val();""!=s?(update_email_data.sha3_current_password=CryptoJS.SHA3(s).toString(),update_email_data.current_username=document_qwiz_username,qqc.qjax(e,t,"","update_my_account",update_email_data)):$("#current_password_errmsg").html("Please enter password")},this.create_enroll_screen=function(e,t){var s=[];s.push('<p style="font-weight: normal; text-align: left; margin: 0 0 0 10px;">'),s.push("You are currently registered as an “independent student,” not enrolled in a school or class. "),s.push("If you have a registration code you can join a class. "),s.push("<br />(Any work you have completed on quizzes and flashcard decks will be transferred to the teacher’s gradebook.)"),s.push("</p>"),s.push('<table class="qwiz-border-none qwiz-padding" border="0" align="center"'),s.push("<tr>"),s.push('<td style="vertical-align: top;">'),s.push("<b>Registration code</b>"),s.push("</td>"),s.push("<td>"),s.push('<input type="text" class="enroll_screen_reg_code" style="padding: 2px;" onfocus="qwiz_qcards_common.hide_enroll_error ()" onkeydown="qwiz_qcards_common.enroll_registration_code_keydown (\''+e+"', "+t+');" />'),s.push('<div class="enroll_screen_reg_code_errmsg qwiz_errmsg"></div>'),s.push('<div class="enroll_screen_reg_code_class_name"></div>'),s.push("</td>"),s.push("</tr>"),s.push("<tr>"),s.push("<td>"),s.push("</td>"),s.push("<td>"),s.push('<button class="enroll_check_reg_code qwiz_button" onclick="qwiz_qcards_common.check_reg_code (\''+e+"', "+t+')">'),s.push("Check code"),s.push("</button>"),s.push('<button class="enroll_join_class qwiz_button" style="display: none;" onclick="qwiz_qcards_common.reset_independent_student (\''+e+"', "+t+')">'),s.push("Join class"),s.push("</button>"),plugin_url||(plugin_url=qqc.get_qwiz_param("url","./")),s.push('<img class="enroll_spinner" style="display: none;" src="'+plugin_url+'images/spinner16x16.gif" />'),s.push("</td>"),s.push("</tr>"),s.push("</table>"),s.push('<div style="text-align: right; padding-right: 10px;">'),s.push('<button class="qwiz-smaller" onclick="'+e+".no_login ("+t+', false, true)">'),s.push("Cancel"),s.push("</button>"),s.push("</div>");qqc.$get_login_div(e,t).html(s.join("\n")).show()},this.create_refresh_page_notice=function(e,t){qqc.$get_login_div(e,t).html('\n <div class="qwiz-center">\n <br />\n <br />\n <p>\n <b>Score-recording authentication expired.\n <br />\n Please re-load this page to continue</b>\n </p>\n </div>\n ').show()},this.check_reg_code=function(e,t){var s=qwiz_deck_selector(e,t),i=$(s+"input.enroll_screen_reg_code").val();if(""!=i){$(".enroll_spinner").show();var a={reg_code:i,js_f:1};qqc.qjax(e,t,"","check_reg_code",a)}return!1},this.reg_code_ok_or_no=function(e){debug[0]&&console.log("[reg_code_ok_or_no] data:",e);var t=qwiz_deck_selector(e.qname,e.i_qwiz);$(t+".enroll_spinner").hide(),(enroll_reg_code_ok_f=1==e.num_rows)?(enroll_reg_code_school_id=e.school_id,enroll_reg_code_school_name=e.school_name,enroll_reg_code_class_id=e.class_id,enroll_reg_code_class_name=e.class_name,$(t+"div.enroll_screen_reg_code_class_name").html("<b>Registration for class "+e.class_name+", "+e.school_name+"</b>").show(),$(t+"button.enroll_check_reg_code").hide(),$(t+"button.enroll_join_class").show()):($(t+"div.enroll_screen_reg_code_errmsg").html("Could not find registration code").show(),$(t+"div.enroll_screen_reg_code_class_name").html("").hide())},this.hide_enroll_error=function(){$("div.enroll_screen_reg_code_errmsg").html("").hide()},this.enroll_registration_code_keydown=function(e,t){debug[0]&&console.log("[enroll_registration_code_keydown] enroll_reg_code_ok_f:",enroll_reg_code_ok_f);var s=qwiz_deck_selector(e,t);enroll_reg_code_ok_f?($(s+"button.enroll_join_class").hide(),$(s+"button.enroll_check_reg_code").show()):($(s+"div.enroll_screen_reg_code_errmsg").html("").hide(),$(s+"div.enroll_screen_reg_code_class_name").html("").hide())},this.reset_independent_student=function(e,t){debug[0]&&console.log("[reset_independent_student]");var s=qwiz_deck_selector(e,t);if(""==$(s+"input.enroll_screen_reg_code").val())return $("div.enroll_screen_reg_code_errmsg").html("Please enter registration code").show(),!1;$(s+".enroll_spinner").show();var i={jjax:1,school_id:enroll_reg_code_school_id,class_id:enroll_reg_code_class_id,taker_id:document_qwiz_taker_id};return qqc.qjax(e,t,"","reset_independent_student",i),!1},this.reset_independent_student_callback=function(e){if(debug[0]&&console.log("[reset_independent_student_callback] data:",e),"ok"==e.errmsg)e.jjax=1,qqc.qjax(e.qname,e.i_qwiz,"","add_to_class",e);else{var t=[];t.push("<br /><p><b>Sorry, unable to reset status</b></p>"),t.push('<button class="qwiz_button" onclick="'+e.qname+".no_login ("+e.i_qwiz+', false, true, event)">'),t.push("Continue"),t.push("</button>"),t=t.join("\n"),qqc.$get_login_div(e.qname,e.i_qwiz).html(t).show()}},this.add_to_class_callback=function(e){debug[0]&&console.log("[add_to_class_callback] data:",e);const t=e.qname,s=e.i_qwiz;var i=qwiz_deck_selector(t,s);$(i+".enroll_spinner").hide();var a=[];"ok"==e.errmsg?(document_qwiz_school_id=enroll_reg_code_school_id,document_qwiz_class_id=enroll_reg_code_class_id,document_qwiz_independent_taker_f=!1,qqc.set_user_menus_and_icons(),qwiz_&&qwiz_.any_pay_quiz_f&&qwiz_.pay_lock_settings(s,s),qcard_&&qcard_.any_pay_deck_f&&qcard_.pay_lock_settings(s,s),a.push("<br /><p><b>You are now enrolled in "+enroll_reg_code_class_name+", "+enroll_reg_code_school_name+"</b></p>")):a.push("<br /><p><b>Sorry, unable to reset status</b></p>"),a.push('<button class="qwiz_button" onclick="'+t+".no_login ("+s+', false, true, event)">'),a.push("Continue"),a.push("</button>"),a=a.join("\n"),qqc.$get_login_div(t,s).html(a).show()},this.create_provide_feedback_screen=function(e,t,s){var i,a,r=[];if(r.push('<div style="margin-top: 5px">'),r.push("<b>Feedback - bugs, errors, suggestions...?</b>"),r.push("</div>"),r.push('<div class="qwiz-normal qwiz-smaller">'),r.push("Feel free to copy and paste, including screenshots!"),r.push("</div>"),"qcard_"==e){var o=$("div.qcard_card-qdeck"+t),n=o.width()-16,_=.62*o.height();i=' style="width: '+parseInt(n)+"px; height: "+parseInt(_)+'px;"',a="div.qcard_card-qdeck"+t}else i=' style="min-height: 175px;"',a="div#qwiz"+t;r.push('<div class="qwiz-provide_feedback"'+i+' contenteditable="true">'),provide_feedback_html[a]&&r.push(provide_feedback_html[a]),r.push("</div>"),r.push('<div class="qwiz-normal qwiz-smaller" style="text-align: left;">'),r.push("From: "+document_qwiz_username),r.push("</div>"),r.push("<div>"),r.push('<button class="qwiz_button" onclick="qwiz_qcards_common.submit_feedback (\''+e+"', "+t+", "+s+')">'),r.push("Submit"),r.push("</button>"),r.push(" "),r.push('<button class="qwiz_button_small qwiz-b_and_w" onclick="qwiz_qcards_common.cancel_provide_feedback (\''+e+"', "+t+')">'),r.push("Back"),r.push("</button>"),r.push('<span class="qwiz-smaller qwiz-normal">'),r.push("(you can return to complete your comments)"),r.push("</span>"),r.push("</div>"),qqc.$get_login_div(e,t).html(r.join("\n")).show();$("div.qwiz-provide_feedback").on("paste",function(e){var t=this;setTimeout(function(){resize_feedback_images(t)},100)})},this.submit_feedback=function(e,t,s){var i=$(("qwiz_"==e?"div#qwiz"+t:"div.qcard_card-qdeck"+t)+" div.qwiz-provide_feedback").html();if(-1!=i.indexOf("<img")){var a=i.match(/<img src="blob:[^"]+/g);if(a){global_blob_urls=[],global_data_urls=[];for(var r=a.length,o=0;o<r;o++){a[o].length;global_blob_urls.push(a[o].substr(10))}qqc.get_blobs_as_data_urls(e,t,s,r,i,a)}else submit_feedback2(e,t,s,i)}else{if(qqc.is_only_tags_and_whitespace(i))return!1;submit_feedback2(e,t,s,i)}},this.remove_empty_opening_tags=function(e){return e=e.replace(/^\s*<(p|h\d)>\s*<\/(p|h\d)>/,"")},this.is_only_tags_and_whitespace=function(e){return-1==(e=(e=qqc.remove_tags_eols(e,!0)).replace(/ | | | | /,"")).search(/\S/)},this.get_blobs_as_data_urls=function(e,t,s,i,a,r){i--;var o=new XMLHttpRequest;o.responseType="blob",o.onload=function(){var n=o.response,_=new FileReader;_.onload=function(){debug[0]&&console.log("[get_blobs_as_data_urls] i_do:",i,", reader.result.length:",_.result.length),global_data_urls.push(_.result),0==i?submit_feedback2(e,t,s,a,r):qqc.get_blobs_as_data_urls(e,t,s,i,a,r)},_.readAsDataURL(n)},o.open("GET",global_blob_urls[i]),o.send()},this.blobUrlToBase64=async function(e){const t=await fetch(e),s=await t.blob();return new Promise((e,t)=>{const i=new FileReader;i.onloadend=()=>e(i.result),i.onerror=t,i.readAsDataURL(s)})},this.blob_data={},this.get_blob_as_data_url=function(e,t){debug[0]&&console.log("[get_blob_as_data_url] imageUrl:",t);const s=new FileReader;s.onloadend=()=>{const t=s.result;debug[0]&&(console.log("[get_blob_as_data_url] base64data.length:",t.length),console.log("[get_blob_as_data_url] base64data.substr (0, 50):",t.substr(0,50))),qqc.blob_data[e]=t},(async()=>{const e=await fetch(t),i=await e.blob();s.readAsDataURL(i)})()},this.submit_feedback_callback=function(e,t,s,i,a){var r=[];r.push("<p>"),r.push("<b>"+a+"</b>"),r.push("</p>"),i?(provide_feedback_html[s]="",r.push('<button class="qwiz_button" onclick="'+e+".no_login ("+t+', false, true)">'),r.push("Continue"),r.push("</button>")):(r.push('<button class="qwiz-smaller" onclick="'+e+".no_login ("+t+', false, true)">'),r.push("Back"),r.push("</button>")),qqc.$get_login_div(e,t).html(r.join("\n")).show()},this.cancel_provide_feedback=function(e,t){var s,i=$((s="qwiz_"==e?"div#qwiz"+t:"div.qcard_card-qdeck"+t)+" div.qwiz-provide_feedback");provide_feedback_html[s]=i.html(),provide_feedback_html[s].length>2e7&&alert("Please note: the images in your feedback are large. You may want to submit your comments so far before adding more images."),("qwiz_"==e?qwiz_:qcard_).no_login(t,!1,!0)},this.preview_iframe_close=function(){$("div#preview_iframe_wrapper").remove()},this.init_hide_show_password=function(e){$(e).hidePassword(!0,{states:{shown:{toggle:{className:"qwiz-hideShowPassword-toggle-hide"}},hidden:{toggle:{className:"qwiz-hideShowPassword-toggle-show"}}}})},this.create_register_taker_screen=function(e,t,s,i,a){register_taker_global_reg_code_ok_f=!1,register_taker_global_username="",register_taker_global_first_name="",register_taker_global_last_name="",register_taker_global_sha3_password="",register_taker_global_username_unique_f=!1,register_taker_global_email_unique_f=!1;var r=set_display_pay_screen(e,t),o=!1;r||get_qwizdeckdata(e,t,"pay_quiz_deck_id")||(qqc.set_qwizdeckdata(e,t,"display_pay_screen","open_register"),o=!0,r="open_register",i="<b>Create an account to save your work</b>");var n=[];if(i&&(n.push(i+"<br />"),/free/.test(i)&&"free"),n.push(`<form name="register_taker_'${e}${t}" action="nada.php" onSubmit="return qwiz_qcards_common.register_taker ('${e}', ${t}, ${s}, '${a}')">`),n.push('<table class="register_taker">'),"subscribe"!=r&&"special_offer"!=r&&"open_register"!=r){if(n.push("<tr>"),n.push('<td colspan="3" class="register_taker_if_your_teacher" style="font-weight: normal; text-align: center;">'),"signup"==r)n.push("<i>Please enter the registration code you received"),n.push("from Mr. W on TikTok, Youtube, etc.");else if("free_trial"==r||"free_trial"==a){const[s,i,a,o,_,c,d]=subscription_plan_data(e,t);if(o){const e=new Date(parseInt(today_yyyy),_,c).getTime();DateFormat.format.date(e,"MMMM d, yyyy");n.push("<b>Please create an account first. \n Then we will set up your free trial with a PayPal or credit card authorization. </b>\n There is no charge; you can cancel any time.")}else n.push(`<b>Please create an account first. \n Then we will set up your free trial with a PayPal or credit card authorization. </b>\n <br />\n There is no charge; you can cancel any time. \n After two weeks you will be charged $${a} per month;\n again, you can cancel any time. \n `),"free_trial"!=r&&(n.push("(Registering for a class? Go"),n.push('<a href="https://learn-biology.com/register" target="_blank">'),n.push("here</a>)"))}else"special_offer"!=r&&(n.push("<i>Enter the registration code that your teacher gave you</i>"),n.push("<br />"),n.push("(Not in a class? Go"),n.push('<a href="https://learn-biology.com/student-free-trial" target="_blank">'),n.push("here</a>)"));n.push("</td>"),n.push("</tr>"),"free_trial"!=r&&"free_trial"!=a&&(n.push("<tr>"),n.push("<td>"),n.push("</td>"),n.push("<td>"),n.push('<label for="reg_code">'),n.push("Registration code"),n.push("</label>"),n.push("</td>"),n.push("<td>"),n.push('<input type="text" class="register_taker_reg_code" onchange="qwiz_qcards_common.register_taker_check_reg_code (\''+e+"', "+t+', this.value)" onfocus="qwiz_qcards_common.register_taker_hide_error (\''+e+"', "+t+', this);"> <span class="qwiz-required">*</span>'),n.push('<div class="register_taker_reg_code_errmsg qwiz_errmsg"></div>'),n.push('<div class="register_taker_reg_code_class_name"></div>'),n.push("</td>"),n.push("</tr>"),n.push('<tr class="register_taker_please_continue_below">'),n.push("<td>"),n.push("</td>")),n.push('<td colspan="2" style="font-weight: normal;">'),"signup"==r&&n.push("<i>Please provide the following information. "),n.push("</td>"),n.push("</tr>")}n.push('<tr class="register_taker_login_name_exists">'),n.push("<td>"),n.push("</td>"),n.push('<td colspan="2">'),n.push("<i>This login name exists."),"free_trial"==r||"free_trial"==a?n.push("Either log in to set up a free trial for your account or choose another name to set up a free trial for a new account</i>"):n.push("Either log in or choose another name</i>"),n.push("</td>"),n.push("</tr>"),n.push("<tr>"),n.push("<td>"),n.push("</td>"),n.push("<td>"),n.push('<label for="username">'),n.push("Login name"),n.push("</label>"),n.push("</td>"),n.push("<td>"),n.push(`<input type="text" class="register_taker_username" onchange="qwiz_qcards_common.register_taker_check_unique ('${e}', ${t}, 'username', '${a}', 'onchange')" onblur="qwiz_qcards_common.register_taker_check_unique ('${e}', ${t}, '${a}', 'username', 'onblur')" onfocus="qwiz_qcards_common.register_taker_hide_error ('${e}', ${t}, this);" /> <span class="qwiz-required">*</span>`),n.push('<div class="register_taker_username_errmsg qwiz_errmsg"></div>'),n.push("</td>"),n.push("</tr>"),n.push('<tr class="register_taker_first_name_last_name">'),n.push("<td>"),n.push("</td>"),n.push("<td>"),n.push('<label for="first_name">'),n.push("First name"),n.push("</label>"),n.push("</td>"),n.push("<td>"),n.push('<input type="text" class="register_taker_first_name" onfocus="qwiz_qcards_common.register_taker_hide_error (\''+e+"', "+t+', this);" /> <span class="qwiz-required">*</span>'),n.push('<div class="register_taker_first_name_errmsg qwiz_errmsg"></div>'),n.push("</td>"),n.push("</tr>"),n.push('<tr class="register_taker_first_name_last_name">'),n.push("<td>"),n.push("</td>"),n.push("<td>"),n.push('<label for="last_name">'),n.push("Last name"),n.push("</label>"),n.push("</td>"),n.push("<td>"),n.push('<input type="text" class="register_taker_last_name" onfocus="qwiz_qcards_common.register_taker_hide_error (\''+e+"', "+t+', this);" /> <span class="qwiz-required">*</span>'),n.push('<div class="register_taker_last_name_errmsg qwiz_errmsg"></div>'),n.push("</td>"),n.push("</tr>"),n.push("<tr>"),n.push("<td>"),n.push("</td>"),n.push("<td>"),n.push('<label for="password">'),n.push("Password"),n.push("</label>"),n.push("</td>"),n.push("<td>"),n.push('<input type="password" class="register_taker_password" onchange="qwiz_qcards_common.register_taker_check_password_match (\''+e+"', "+t+')" onfocus="qwiz_qcards_common.register_taker_hide_error (\''+e+"', "+t+', this);" /> <span class="qwiz-required">*</span>'),n.push('<div class="register_taker_password_errmsg register_taker_confirm_password_errmsg qwiz_errmsg"></div>'),n.push("</td>"),n.push("</tr>"),n.push('<tr class="register_taker_confirm_password register_taker_confirm_password_email">'),n.push("<td>"),n.push("</td>"),n.push("<td>"),n.push('<label for="confirm_password">'),n.push("Confirm password"),n.push("</label>"),n.push("</td>"),n.push("<td>"),n.push('<input type="password" class="register_taker_confirm_password" onchange="qwiz_qcards_common.register_taker_check_password_match (\''+e+"', "+t+')" onfocus="qwiz_qcards_common.register_taker_hide_error (\''+e+"', "+t+', this);" /> <span class="qwiz-required">*</span>'),n.push("</td>"),n.push("</tr>"),n.push('<tr class="register_taker_email register_taker_confirm_password_email">'),n.push("<td>"),n.push("</td>"),n.push("<td>"),n.push('<label for="email">'),n.push("Email"),n.push("</label>"),n.push("</td>"),n.push("<td>"),n.push(`<input type="text" class="register_taker_email" onchange="qwiz_qcards_common.register_taker_validate_email ('${e}', ${t}, false, true, '${a}')" onfocus="qwiz_qcards_common.register_taker_hide_error ('${e}', ${t}, this);" /> <span class="qwiz-required register_taker_email_required">*</span>`),n.push('<div class="register_taker_email_errmsg qwiz_errmsg"></div>'),n.push("</td>"),n.push("</tr>"),n.push("</tr>"),n.push('<td colspan="2">'),n.push("</td>"),n.push("<td>"),n.push('<span style="float: right;">'),n.push('<span class="qwiz-required ">*</span>'),n.push('<span class="qwiz-smaller">required</span>'),n.push("</span>"),n.push('<button type="submit" class="register_taker_submit qwiz_button">'),n.push('<span class="register_taker_login" style="font-size: 12pt !important;">'),n.push(qqc.T("Register")),n.push("</span>"),n.push("</button>"),n.push(" "),/register|free_trial/.test(r)&&!o||(n.push('<span class="qwiz_button" style="font-size: 9pt !important;" onclick="'+e+".no_login ("+t+', false, true, event)">'),n.push("Cancel"),n.push("</span>")),n.push("<br />"),n.push('<span class="register_taker_forgot_password">'),"not ready"==server_loc&&(secure_server_loc=qqc.get_qwiz_param("secure_server_loc")),n.push('<a href="'+secure_server_loc+'/password_reset_request" target="_blank">'),n.push("Forgot password?</a>"),n.push("</span>"),n.push("</td>"),n.push("</tr>"),n.push("<tr>"),n.push("<td>"),n.push("</td>"),n.push('<td colspan="2" class="register_taker_errmsg qwiz_errmsg">'),n.push("</td>"),n.push("</tr>"),n.push("</table>"),n.push("</form>"),qqc.$get_login_div(e,t).html(n.join("\n")).show();var _=qwiz_deck_selector(e,t);if(qqc.init_hide_show_password(_+"input.register_taker_password"),qqc.init_hide_show_password(_+"input.register_taker_confirm_password"),debug[0]){console.log("[create_register_taker_screen] (show email) display_pay_screen:",r);const e=$(_+"tr.register_taker_email");console.log("[create_register_taker_screen] $email:",e)}if($(_+"tr.register_taker_email").hide(),"subscribe"==r||"open_register"==r||"open_register"==a||"free_trial"==r||"free_trial"==a||"special_offer"==r){setTimeout(function(){$(_+"tr.register_taker_email").show(),$(_+".register_taker_username").val("")},200)}else"signup"==r?($(_+"tr.register_taker_email").show(),$(_+".register_taker_reg_code").val("")):$(_+".register_taker_reg_code").val("");$("div.qwiz-usermenu_icon").removeClass("qwiz-icon-bounce")},this.register_taker_check_password_match=function(e,t){var s=qwiz_deck_selector(e,t);$(s+"button.register_taker_submit").prop("disabled",!0);setTimeout(function(){$(s+"button.register_taker_submit").prop("disabled",!1)},1e3),$(s+".register_taker_password_errmsg").hide();var i=$(s+".register_taker_password").val();if(""!=i&&/[#?]/.test(i)){setTimeout(function(){$(s+".register_taker_password_errmsg").html("Note: Biomania app will not work with passwords containing “#” or “?”").show()},20)}var a=$(s+"input.register_taker_confirm_password").val();if(a&&""!=i&&i!=a){return setTimeout(function(){$(s+".register_taker_password_errmsg").html("Password and Confirm password do not match").show()},40),!1}},this.register_taker_check_reg_code=function(e,t,s){if(""==s){var i=qwiz_deck_selector(e,t);$(i+"tr.register_taker_first_name_last_name").show(),$(i+".register_taker_reg_code_class_name").html("").hide(),$(i+".register_taker_login_name_exists,"+i+" .register_taker_forgot_password").hide(),$(i+"span.register_taker_login").html(qqc.T("Register")),$(i+"tr.register_taker_confirm_password_email").show(),$(i+"tr.register_taker_please_continue_below").show(),$(i+".register_taker_email_required, "+i+"tr.register_taker_email").show(),register_taker_global_reg_code_ok_f=!1,qqc.register_taker_check_unique(e,t,"","username")}else{var a={reg_code:s,callback:"register_taker_reg_code_ok_or_no"};register_taker_global_in_process_b=!0,qqc.qjax(e,t,"","check_reg_code",a)}return!1},this.set_immediate_payment=function(e,t){var s=!1;return void 0===document_qwiz_immediate_payment?"qwiz_"==e&&(s=qwiz_.get_qwizdata(t,"immediate_payment")):s=document_qwiz_immediate_payment,s},this.register_taker_reg_code_ok_or_no=function(e){debug[0]&&console.log("[register_taker_reg_code_ok_or_no] data:",e),register_taker_global_reg_code_ok_f=1==e.num_rows;var t=qwiz_deck_selector(e.qname,e.i_qwiz);if(register_taker_global_reg_code_ok_f){$(t+".register_taker_if_your_teacher").hide(),$(t+"tr.register_taker_please_continue_below").hide(),$(t+"tr.register_taker_first_name_last_name").show(),"signup"!=set_display_pay_screen(e.qname,e.i_qwiz)&&$(t+".register_taker_email_required, "+t+"tr.register_taker_email").hide(),register_taker_global_reg_code_maker_id=e.maker_id,register_taker_global_reg_code_school_id=e.school_id,register_taker_global_reg_code_class_id=e.class_id,register_taker_global_reg_code_class_name=e.class_name,register_taker_global_reg_code_school_name=e.school_name,register_taker_global_reg_code_professor_f=e.professor_f,$(t+".register_taker_reg_code_class_name").html("<b>Registration for class "+register_taker_global_reg_code_class_name+", "+register_taker_global_reg_code_school_name+"</b>").show()}else{var s=e.errmsg?e.errmsg:"Could not find registration code";$(t+".register_taker_reg_code_errmsg").html(s).show(),$(t+".register_taker_reg_code_class_name").html("").hide()}register_taker_global_in_process_b=!1},this.register_taker_check_unique=function(e,t,s,i,a){debug[0]&&console.log("[register_taker_check_unique] field:",s,"which:",a);var r=qwiz_deck_selector(e,t),o=$(r+"input.register_taker_"+s).val();if(debug[0]&&console.log("[register_taker_check_unique] value:",o),o){if("username"==s){if(/["\\;]/.test(o))return $(r+".register_taker_username_errmsg").html("Invalid characters").show(),!1;if(/[#?]/.test(o))return $(r+".register_taker_username_errmsg").html("Note: Biomania app will not work with login names containing “#” or “?”").show(),!1}var n={field:s,value:o,login_alt:i,callback:"register_taker_unique_or_no"};register_taker_global_in_process_b=!0,qqc.qjax(e,t,"","check_taker_name_email_unique",n)}return!1},this.register_taker_unique_or_no=function(e){debug[0]&&console.log("[register_taker_unique_or_no] data:",e);var t=qwiz_deck_selector(e.qname,e.i_qwiz),s=e.field,i=e.unique_f;if("username"==s){var a=e.login_alt;get_qwizdeckdata(e.qname,e.i_qwiz,"display_pay_screen");register_taker_global_username_unique_f=i,0==i?(debug[0]&&console.log('[register_taker_unique_or_no] "username already in use"'),$(t+".register_taker_login_name_exists, "+t+".register_taker_forgot_password").show(),$(t+"tr.register_taker_first_name_last_name").hide(),$(t+"tr.register_taker_confirm_password_email").hide(),$(t+"span.register_taker_login").html(qqc.T("Log in")),$(t+".register_taker_password").focus()):($(t+"span.register_taker_login").html(qqc.T("Register")),$(t+".register_taker_username_errmsg").hide(),$(t+"tr.register_taker_first_name_last_name").show(),$(t+".register_taker_login_name_exists, "+t+".register_taker_forgot_password").hide(),$(t+"tr.register_taker_confirm_password").show(),"register"==a?$(t+"tr.register_taker_email").hide():$(t+"tr.register_taker_email").show(),$(t+".register_taker_first_name").focus())}else register_taker_global_email_unique_f=i,0==i&&(debug[0]&&console.log('[register_taker_unique_or_no] "email already in use"'),$(t+".register_taker_email_errmsg").html("Email already in use").show());register_taker_global_in_process_b=!1},this.register_taker=function(e,t,s,i){debug[0]&&console.log("[register_taker] register_taker_global_in_process_b:",register_taker_global_in_process_b);var a=0,r=function(){if(register_taker_global_in_process_b){if(debug[0]&&console.log("[delay_register_taker] n_tries:",a),a>40)return alert("Sorry, unable to process request"),!1;a++,setTimeout(r,250)}else qqc.register_taker2(e,t,s,i)};return setTimeout(r,250),!1},this.register_taker2=function(e,t,s,i){debug[0]&&console.log("[register_taker2] proceed_to_pay:",s);var a=!0,r=qwiz_deck_selector(e,t),o="";"register"==i&&(o=$(r+".register_taker_reg_code").val(),""==(o=qqc.trim(o))&&($(r+".register_taker_reg_code_errmsg").html("Please enter registration code").show(),a=!1)),""==(register_taker_global_username=$(r+".register_taker_username").val())&&($(r+".register_taker_username_errmsg").html("Please enter login name").show(),a=!1),/["\\;]/.test(register_taker_global_username)&&($(r+".register_taker_username_errmsg").html("Invalid characters").show(),a=!1);var n=$(r+".register_taker_password").val();""==n&&($(r+".register_taker_password_errmsg").html("Please enter password").show(),a=!1);var _=$(r+"input.register_taker_email").val();s||(s=register_taker_global_reg_code_professor_f);const c=$(r+"span.register_taker_login").html()==qqc.T("Log in");if(!c&&(!register_taker_global_reg_code_ok_f&&!s||1==register_taker_global_username_unique_f||""==register_taker_global_username)){(a=a&®ister_taker_global_username_unique_f)&&""!=register_taker_global_username&&!register_taker_global_username_unique_f&&($(r+".register_taker_username_errmsg").html("Login name already in use").show(),a=!1),""==(register_taker_global_first_name=$(r+".register_taker_first_name").val())&&($(r+".register_taker_first_name_errmsg").html("Please enter first name").show(),a=!1),""==(register_taker_global_last_name=$(r+".register_taker_last_name").val())&&($(r+".register_taker_last_name_errmsg").html("Please enter last name").show(),a=!1),!o||register_taker_global_reg_code_ok_f||register_taker_display_pay_screen||(a=!1,$(r+".register_taker_reg_code_errmsg").html("Could not find registration code").show());var d=set_display_pay_screen(e,t);if(!c)if(""==_?register_taker_global_reg_code_ok_f&&"signup"!=d||($(r+".register_taker_email_errmsg").html("Please enter email").show(),a=!1):register_taker_global_email_unique_f?a=qqc.register_taker_validate_email(e,t,a,!1,i):($(r+".register_taker_email_errmsg").html("Email already in use").show(),a=!1),""!=n)n!=$(r+"input.register_taker_confirm_password").val()&&($(r+".register_taker_password_errmsg").html("Password and Confirm password do not match").show(),a=!1);o||"signup"!=d||($(r+".register_taker_reg_code_errmsg").html("Please enter registration code").show(),$(r+".register_taker_reg_code_class_name").html("").hide()),a?"register"!=i||o||(a=confirm('You have not entered a registration code;\nyou will be an "independent student," not in a class.\n\nIs this OK? If not, click "Cancel" and enter a code.')):"qcard_"==e&&qcard_.set_container_width_height(t)}if(register_taker_global_sha3_password=CryptoJS.SHA3(n).toString(),a){const i=qqc.set_immediate_payment(e,t);var l={login_f:c?1:"",reg_code:o,school_id:register_taker_global_reg_code_school_id,username:register_taker_global_username,firstname:register_taker_global_first_name,lastname:register_taker_global_last_name,sha3_password:register_taker_global_sha3_password,email:_,register_v2:"1",payment_type_id:i?65:52,called_from:"register_taker2",callback:"taker_registered"};s&&(l.proceed_to_pay_f="1"),document_qwiz_subscription_id&&(l.subscription_id=document_qwiz_subscription_id,l.subscription="1"),debug[0]&&console.log("[register_taker2] data",l),qqc.qjax(e,t,"","new_student_registration",l)}return!1},this.register_taker_hide_error=function(e,t,s){var i=s.className.split(/\s+/)[0],a=qwiz_deck_selector(e,t);$(a+"."+i+"_errmsg").hide(),$(a+".register_taker_errmsg").hide()},this.taker_registered=function(e){debug[0]&&(console.log("[taker_registered] data:",e),console.log("[taker_registered] register_taker_global_reg_code_ok_f:",register_taker_global_reg_code_ok_f,", register_taker_global_username_unique_f:",register_taker_global_username_unique_f),console.log("[taker_registered] register_taker_display_pay_screen:",register_taker_display_pay_screen));var t=e.errmsg,s="";const i=e.qname,a=parseInt(e.i_qwiz);if(t)s="login unsuccessful"==t?"Incorrect username/password":"duplicate username"==t?"Login name is already in database":t;else{document_qwiz_user_logged_in_b=!0,document_qwiz_session_id=e.session_id,document_qwiz_username=register_taker_global_username,document_qwiz_school_id=e.school_id,document_qwiz_taker_id=e.taker_id,document_qwiz_email=e.email,document_qwiz_independent_taker_f=1==e.school_id,e.university_discount&&(document_qwiz_university_discount=!0),document_qwiz_good_through_date=e.good_through_date;$.cookie("qwiz_session_id",document_qwiz_session_id,{path:"/",expires:1}),document_qwiz_remember_f=!0,qqc.set_user_menus_and_icons();var r="";if(e.show_paypal_screen_f)if(document_qwiz_good_through_date){qqc.$get_login_div(i,a).html("<i>Sorry; a free trial subscription is not available to existing users</i>")}else qqc.create_paypal_subscription_screen(i,a);else{var o="";if(e.add_and_provide_f||e.login_f)if("open_register"==(r=get_qwizdeckdata(i,a,"display_pay_screen")))o=`<br />\n <b>Thanks! You now have a Learn-Biology.com account and your work will be saved.</b>\n <br />\n <br />\n <button class="qwiz_button" onclick="${i}.no_login (${a})">\n Continue\n </button>`;else{o=qqc.set_immediate_payment(i,a)?"<b>Thanks! You now have a Learn-Biology.com subscription.</b>":1==e.school_id?"<b>Thanks! You now have a free-trial subscription.</b>":"<b>Thanks! You now have a free account.</b>"}if("open_register"!=r&&get_qwizdeckdata(i,a,"pay_quiz_deck_id"))qwiz_&&qwiz_.any_pay_quiz_f&&qwiz_.pay_lock_settings(a,a,void 0,void 0,o),qcard_&&qcard_.any_pay_deck_f&&qcard_.pay_lock_settings(a,a,void 0,void 0,o);else{qqc.$get_login_div(i,a).html(o)}if(register_taker_global_reg_code_ok_f){e.login_f&&(register_taker_global_first_name=e.firstname,register_taker_global_last_name=e.lastname);var n={};n.First_name=[register_taker_global_first_name],n.Last_name=[register_taker_global_last_name];var _={userids:[document_qwiz_taker_id],usernames:[register_taker_global_username],passwords:[register_taker_global_sha3_password],custom_input_data:{input_field_names:["First_name","Last_name"],fields:n}};e.proceed_to_pay_f&&(_.proceed_to_pay_f=e.proceed_to_pay_f),qqc.input_data_to_db(i,a,register_taker_global_reg_code_maker_id,register_taker_global_reg_code_school_id,register_taker_global_reg_code_class_id,register_taker_global_reg_code_class_name,_),document_qwiz_class_id=register_taker_global_reg_code_class_id}}}if(s){var c=qwiz_deck_selector(i,a);$(c+".register_taker_errmsg").html(s).show()}return!1},this.special_offer_callback=function(e){debug[0]&&console.log("[special_offer_callback] data:",e);var t="<br /><br />";t+=qqc.set_immediate_payment(e.qname,e.i_qwiz)?"<b>Thanks! You now have a Learn-Biology.com subscription.</b>":"<b>Thanks! You now have a new free-trial subscription.</b>";qqc.$get_login_div("qwiz_",e.i_qwiz).html(t)},this.register_taker_validate_email=function(e,t,s,i,a){var r=qwiz_deck_selector(e,t),o=$(r+"input.register_taker_email").val();if(""!=o){/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i.test(o)?i&&qqc.register_taker_check_unique(e,t,"email",a,"email"):($(r+".register_taker_email_errmsg").html("Not a valid email address").show(),s=!1)}return s},this.input_data_to_db=function(e,t,s,i,a,r,o){debug[0]&&console.log("[input_data_to_db] taker_data:",o);var n={};n.qname=e,n.i_qwiz=t,n.class_id=a,n.class_name=r,n.school_id=i,n.maker_id=s,n.taker_data=o,n.callback="register_taker_input_data_to_db_callback",debug[0]&&console.log("[input_data_to_db] data:",n),qwiz_qcards_common.qjax(e,t,"","new_class",n)},this.register_taker_input_data_to_db_callback=function(e){if(debug[0]&&console.log("[input_data_to_db_callback] data:",e),e.error_f)alert("Sorry, registration did not work");else{const t=1==e.proceed_to_pay_f;register_taker_registered_feedback(e.qname,e.i_qwiz,!1,t)}},this.check_promo_code=function(e,t){var s=$("#"+e+"promo_code"+t+" input").val();if(""!=s){var i={qname:e,promo_code:s,pay_quiz_deck_id:get_qwizdeckdata(e,t,"pay_quiz_deck_id")};qqc.qjax(e,t,"","check_promo_code",i)}return!1},this.check_promo_code2=function(e){debug[0]&&console.log("[check_promo_code2] data:",e);var t=e.qname,s=e.i_qwiz,i=$("p#"+t+"promo_code"+s);e.errmsg?(i.find("span.promo_code_errmsg").html("<br />"+e.errmsg),i.find("span.promo_code_okmsg").html("")):(qqc.set_qwizdeckdata(t,s,"promo_code",e.promo_code),"qwiz_"==t?qwiz_.pay_lock_settings(s,s):qcard_.pay_lock_settings(s,s))},this.clear_promo_code_msgs=function(e,t){$("p#"+e+"promo_code"+t+" span.promo_code_msg").html("")},this.submit_for_payment=function(e,t,s){debug[0]&&console.log("[submit_for_payment] qname:",e,", i_qwiz:",t,", form_el:",s);var i=get_qwizdeckdata(e,t,"pay_quiz_deck_id"),a=s.os0.selectedIndex;if(-1==a){var r=qwiz_deck_selector(e,t);return $(r+" div.signup_confirm_email_errmsg").html("Please choose a payment option").show(),!1}if(!document_qwiz_session_id){r=qwiz_deck_selector(e,t);return $(r+" div.signup_confirm_email_errmsg").html("Sorry, login session not set. Please refresh this page in your browser and try again, or contact support@qwizcards.com").show(),!1}var o=get_qwizdeckdata(e,t,"taker_payment_type_ids")[a],n=s.os0.value;if(pay_qwiz_qdeck_=e,pay_i_qwiz_deck=t,n<=0)return!1;var _={m:0,pid:i,ptid:o,sid:document_qwiz_session_id,url:qqc.get_qwiz_param("url","./")};return debug[0]&&console.log("[submit_for_payment] custom_data:",_),s.custom.value=btoa(JSON.stringify(_)),!0},this.create_maker_pay_screen=function(e,t,s,i){var a=qqc.$get_login_div(e,s),r=[];if(t[s].pay_errmsg)r.push("<strong>"+t[s].pay_errmsg+"</strong><br />");else{i&&r.push("<strong>"+i+"</strong><br />");var o=t[s].maker_payment_type_ids.length;r.push('<form action="https://www.paypal.com/cgi-bin/webscr" onSubmit="return qwiz_qcards_common.submit_for_payment (\''+e+"', "+s+', this)" method="post" target="_blank">'),r.push('<input type="hidden" name="cmd" value="_s-xclick">'),r.push('<input type="hidden" name="hosted_button_id" value="QK2XZUEFF9RNS">'),r.push('<table class="pay_options">'),r.push("<tr>"),r.push("<td>"),r.push('<input type="hidden" name="on0" value="Options">'),o>1&&r.push("Please choose:"),r.push("</td>"),r.push("</tr>"),r.push("<tr>"),r.push("<td>"),r.push('<select name="os0" class="qwiz_paypal_select">');for(var n=0;n<o;n++){var _=t[s].maker_fees[n],c=t[s].maker_good_for_n_periodss[n],d=t[s].maker_good_for_periods[n],l=t[s].maker_payment_descriptions[n],u=qqc.currency(_)+" "+qqc.number_to_word(c)+" "+qqc.plural(d,d+"s",c);l&&(u+=" - "+l),r.push('<option value="'+_+'">'),r.push(u),r.push("</option>")}r.push("</select> "),r.push("</td>"),r.push("</tr>"),r.push("</table>"),r.push('<input type="hidden" name="currency_code" value="USD">'),r.push('<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_paynowCC_LG.gif" style="border: none;" name="submit" alt="PayPal - The safer, easier way to pay online!">'),r.push('<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">'),r.push('<input type="hidden" name="custom">'),r.push("</form>")}a.html(r.join("\n")).show()},this.submit_for_maker_payment=function(e,t,s){debug[0]&&console.log("[submit_for_maker_payment] qname:",e,", i_qwiz:",t,", form_el:",s);var i=get_qwizdeckdata(e,t,"pay_quiz_deck_id"),a=s.os0.selectedIndex,r={m:1,pid:i,ptid:get_qwizdeckdata(e,t,"maker_payment_type_ids")[a],sid:qqc.maker_session_id,url:qqc.get_qwiz_param("url","./")};return debug[0]&&console.log("[submit_for_maker_payment] custom_data:",r),s.custom.value=btoa(JSON.stringify(r)),pay_qwiz_qdeck_=e,pay_i_qwiz_deck=t,!0},this.payment_received=function(e,t,s,i){if(debug[0]&&console.log("[payment_received] no_set_f:",e,", confirm_email_errmsg:",i),i){var a=qwiz_deck_selector(t,s);return $(a+" div.signup_confirm_email_errmsg").html(i).show(),!1}if(e)pay_qwiz_qdeck_=t,pay_i_qwiz_deck=s;else{document_qwiz_email_confirm=1;const e=get_qwizdeckdata(t,s,"display_pay_screen");qwiz_&&qwiz_.any_pay_quiz_f&&(e&&(payment_received_f=!0),qwiz_.pay_lock_settings()),qcard_&&qcard_.any_pay_deck_f&&(e&&(payment_received_f=!0),qcard_.pay_lock_settings())}"qwiz_"==pay_qwiz_qdeck_?($("#qwiz_login-qwiz"+pay_i_qwiz_deck).hide(),-1==qwiz_.get_qwizdata(pay_i_qwiz_deck,"i_question")?($(".intro-qwiz"+pay_i_qwiz_deck).show(),qwiz_.position_show_next_button(pay_i_qwiz_deck)):qwiz_.login_ok_start_quiz(pay_i_qwiz_deck)):($("#qdeck_login-qdeck"+pay_i_qwiz_deck).hide(),qcard_.login_ok_start_deck(pay_i_qwiz_deck))},this.registration_complete=function(e,t,s,i){debug[0]&&console.log("[registration_complete] qname:",e,", i_qwiz:",t,", session_id:",s,", username:",i),document_qwiz_session_id=s,document_qwiz_username=i,document_qwiz_school_id=1,document_qwiz_independent_taker_f=1,("qwiz_"==e?qwiz_:qcard_).login_ok(t,s,0)},this.maker_login_registration_complete=function(e,t,s,i){debug[0]&&console.log("[maker_login_registration_complete] qname:",e,", i_qwiz:",t,", maker_session_id:",s,", username:",i),qqc.maker_session_id=s;$.cookie("maker_session_id",s,{path:"/",expires:1}),("qwiz_"==e?qwiz_:qcard_).hide_menu_and_display_login(t,!1,"maker_pay"),setTimeout(function(){alert("Admin registration/login successful")},250)},this.set_login_expiry=function(){debug[0]&&console.log("[set_login_expiry]"),clearTimeout(document_qwiz_login_timeout),document_qwiz_login_timeout=setTimeout("qwiz_qcards_common.login_expired ()",864e5)},this.login_expired=function(){document_qwiz_user_logged_in_b=!1,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(),document_qwiz_pay_registration_date_unix=0;setTimeout(function(){document_qwiz_wp_user_session_id?alert(qqc.T("Score-recording authentication expired. Please re-load this page")):alert(qqc.T("Qwizcards login session expired. Please log in again"))},20)},this.is_mobile=function(e){var t;return document_qwiz_force_mobile_f||(t="Disabled"!=e&&(window.innerWidth<961||window.innerHeight<450)),t},this.set_force_mobile=function(){parent!==window&&-1!=document.location.href.search(/(localhost|192.168.1.120|qwizcards.com|swinginghotspot.com)\/u\//)&&(document_qwiz_force_mobile_f=!0)},this.process_textentry_terms=function(e){debug[0]&&console.log("process_textentry_terms] data:",e.substr(0,50),"..."),terms={singular:[],plural:[]};for(var t=e.split(/\n|;/),s=t.length,i=0;i<s;i++){var a,r,o=t[i];if(-1!=o.search(/\S/)){var n=o.indexOf("/");if(-1==n){a=o;var _=o.length-1,c=o[_],d=o.substr(_-1);r="es"==d?o:"y"==c?o.substr(0,_)+"ies":"s"==c||"sh"==d||"ch"==d?o+"es":"x"==c?o:o+"s"}else a=o.substr(0,n),r=n==o.length-1?o.substr(0,n):o.substr(n+1);terms.singular.push([a,qqc.metaphone(a)]),terms.plural.push([r,qqc.metaphone(r)])}}return terms},this.process_inline_textentry_terms=function(e,t,s,i){s.additional_errmsgs=[];var a=extract_delete_shortcode_content(e,t,"add_terms"==t,s);if("NA"==a.content)return e;for(var r=[a.content],o=new RegExp('<a.*?href="([^"]*)"[\\s\\S]*?<\\/a>',"m");;){var n=r[0].match(o);if(!n)break;var _=n[1],c=qqc.get_textentry_terms(_,s);c&&(".txt"!=_.substr(_.length-4)||-1!=c.indexOf("[terms]")?(r_remote=extract_delete_shortcode_content(c,"terms",!1,s),"NA"==r_remote.content?s.additional_errmsgs.push(qqc.T("Did not find [terms]...[/terms] shortcode pair in file")+" "+_):r.push(r_remote.content)):r.push(c)),r[0]=r[0].replace(o,"")}return r=(r=r.join("")).replace(/<[^>]+>| /g,"\n"),s[i][t]=r,a.htm},this.sort_dedupe_terms_metaphones=function(e){var t=window.navigator.userLanguage||window.navigator.language;e.sort(function(e,s){return e[0].toLowerCase().localeCompare(s[0].toLowerCase(),t,{numeric:!0})});for(var s=[e[0]],i=e.length,a=1;a<i;a++)e[a][0]!=e[a-1][0]&&s.push(e[a]);return s},this.get_textentry_terms=function(e,t){debug[0]&&console.log("[get_textentry_terms] terms_url:",e);var s=!1,i="";return $.ajax({type:"GET",async:!1,url:e,dataType:"text",error:function(i,a){t.additional_errmsgs.push(qqc.T("Could not read terms file")+": "+e),s=!0},success:function(e){i=e}}),s||i||t.additional_errmsgs.push(qqc.T("No data read from terms file")+": "+e),i},this.create_hangman_entry=function(e){var t='<span class="qwiz-hairsp"></span>',s=0;e&&(s=e.length);for(var i=[],a=0;a<s;a++)e[a].match(/[a-z0-9]/i)?i.push("<u>"+e[a]+"</u>"+t):" "==e[a]?i.push(" "+t):i.push(e[a]+t);e=i.join("");return debug[9]&&console.log("[create_hangman_entry] entry:",e),e},this.create_hangman_incorrect_chars_display=function(e,t,s){var i=e.length,a=[];0==t?a.push('<span class="hangman_incorrect_letters_exceeded inline-block entry">'):a.push('<span class="hangman_incorrect_letters_allowed inline-block entry">');for(var r=s?12:i,o=0;o<r;o++){var n=o<i?e[o]:'<span class="qwiz_spacer">x</span>';a.push(n),o+1==t&&a.push('</span><span class="hangman_incorrect_letters_exceeded inline-block entry">')}return a.push("</span>"),a="Incorrect: "+a.join("")},this.setCharAt=function(e,t,s){return t>e.length-1?e:e.substr(0,t)+s+e.substr(t+1)},this.make_inline=function(e,t){var s=e.substr(t),i=s.match(/<[hp][^>]*>/)[0],a=i[1];"h"==a&&(a+=i[2]);var r=qqc.add_attr_value("style","display: inline;",i);debug[9]&&console.log("[make_inline] new_tag:",r);var o=s.replace(i,r),n="</"+a+">";-1!=(o=r.replace(a,"div")+o).search(n)?o=o.replace(n,n+"</div>"):o+="</div>";var _="</"+a+">";return r="<"+a+' style="display: inline;">',e=(e=e.substr(0,t)+o).replace(/\[hangman[^\]]*\]/,_+"$&"+r),debug[9]&&console.log("[make_inline] htm:",e),e},this.add_attr_value=function(e,t,s){var i=new RegExp(e+"\\s*=\\s*[\"']","im"),a=s.match(i);return a?-1==s.search(t)&&(s=s.replace(i,a[0]+t+" ")):s=s.replace(">"," "+e+'="'+t+'">'),debug[0]&&console.log("[add_attr_value] attributes:",s),s},this.remove_tags_eols=function(e,t){return e&&(t&&(e=e.replace(/<img/g,"xXximg")),e=qqc.trim(e.replace(/<[^>]+>/g,"").replace(/\n| /g," ").replace(/ {2,}/g," ")),t&&(e=e.replace(/xXximg/g,"<img"))),e},this.q_and_a_hash=function(e){return e.length>200&&(e=e.substr(0,184)+"CRC32:"+qwiz_crc32(e)),e},this.init_enter_intercept=function(){init_enter_intercept_f||(init_enter_intercept_f=!0,$("html").on("keydown",function(e){if(document_active_qwiz_qdeck&&13==e.keyCode){debug[7]&&(console.log("[init_enter_intercept] document_active_qwiz_qdeck:",document_active_qwiz_qdeck),console.log("[init_enter_intercept] e.target:",e.target));var t=e.target.tagName.toLowerCase();if("input"==t||"textarea"==t)if(-1==(i=e.target.id.toLowerCase()).indexOf("qwiz")&&-1==i.indexOf("qdeck"))return;if(-1!=e.target.className.indexOf("user_html"))if(-1==(i=e.target.id.toLowerCase()).indexOf("qwiz")&&-1==i.indexOf("qdeck"))return;var s=$(document_active_qwiz_qdeck);if(-1==document_active_qwiz_qdeck.className.toLowerCase().indexOf("qcard_window"))if(s.find("div.next_button").is(":visible"))debug[7]&&(console.log("[init_enter_intercept] qwiz next_button trigger"),console.log("[init_enter_intercept] $document_active_qwiz_qdeck.find ('div.next_button button'):",s.find("div.next_button button"))),qqc.next_button_active_b||s.find("div.next_button button").trigger("click");else if(s.find("div.textentry_check_answer_div").is(":visible")){debug[7]&&console.log("[init_enter_intercept] qwiz call text_entry_check_answer ()");var i=document_active_qwiz_qdeck.id,a=parseInt(i.substr(4),10);qwiz_.textentry_check_answer(a)}else s.find("button.login_button").is(":visible")?(debug[7]&&console.log("[init_enter_intercept] qwiz login_button trigger"),s.find("div.qwiz-login button.login_button").trigger("click")):s.find("button.begin_practice").is(":visible")?(debug[7]&&console.log("[init_enter_intercept] qwiz begin_practice trigger"),s.find("div.qwiz-login button.begin_practice").trigger("click")):s.find(".exit_progress_bars").is(":visible")&&(debug[7]&&console.log("[init_enter_intercept] qwiz exit_progress_bars trigger"),s.find("div.qwiz-login button.exit_progress_bars").trigger("click"));else if(!qcard_.qwizard_b){if(-1!=e.target.className.indexOf("flip"))return;s.find("button.login_button").is(":visible")?(debug[7]&&console.log("[init_enter_intercept] qdeck login_button trigger"),s.find("button.login_button").trigger("click")):s.find("button.begin_practice").is(":visible")?(debug[7]&&console.log("[init_enter_intercept] qdeck begin_practice trigger"),s.find("div.button.begin_practice").trigger("click")):s.find(".exit_progress_bars").is(":visible")?(debug[7]&&console.log("[init_enter_intercept] qdeck exit_progress_bars trigger"),s.find(".exit_progress_bars").trigger("click")):s.find("div.qcard_next_buttons button.flip.qwiz_button").length&&(debug[7]&&(console.log("[init_enter_intercept] qdeck Check answer trigger"),console.log("[init_enter_intercept] find:",s.find("div.qcard_next_buttons button.flip"))),s.find("div.qcard_next_buttons button.flip").trigger("click"))}}}))},this.$get_login_div=function(e,t){var s;return"qwiz_"==e?(s="#qwiz_login-qwiz"+t,$("#progress-qwiz"+t).html("")):(s="div.qcard_card-qdeck"+t+" div.qcard-front div.qcard_content_size",$("#progress-qdeck"+t).html("")),$(s)},this.get_attr=function(e,t){var s="",i=new RegExp("(\\s|^)"+t+'\\s*=\\s*("([^"]+)")*',"m"),a=e.match(i);return a&&a[3]&&(s=qqc.trim(a[3])),s},this.opening_tag_shortcode_pos=function(e,t){e=e.replace(/([\[\]\*])/g,"\\$1");var s=new RegExp("(<[^\\/][^>]*>\\s*)*?"+e+"[\\s\\S]*"),i=t.search(s);if(-1==i)i=t.length;else{var a=new RegExp(e),r=t.search(a),o=!1,n=t.substring(i,r).lastIndexOf("<img");-1!=n&&(i+=n+3,o=!0);var _=t.substring(i,r).lastIndexOf("<input");-1!=_&&(i+=_+3,o=!0);var c=t.substring(i,r).lastIndexOf('<span class="qwizard_placeholder">');-1!=c&&(i+=c+3,o=!0);var d,l=t.substring(i,r).lastIndexOf("<br");if(-1!=l&&(i+=l+3,o=!0),-1!=(d=t.substring(i,r).lastIndexOf("<video"))&&(i+=d+3,o=!0),-1!=(d=t.substring(i,r).lastIndexOf("<iframe"))&&(i+=d+3,o=!0),o)i+=t.substr(i).search(s)}return i},this.replace_smart_quotes=function(e){var t=e.replace(/[\u201C\u201D\u2033\u00AB\u00BB]/gm,'"');return t=(t=(t=t.replace(/[\u2018\u2019]/gm,"'")).replace(/ |\u000A0/gm," ")).replace(/–|\u2013/gm,"-")},this.balance_closing_tag=function(e){var t=e.search(/<\/[ph]/);if(-1!=t){var s,i=e.substr(t+2,2);s=">"==i.substr(1)?"<p":"<"+i;var a=new RegExp(s),r=e.search(a);(-1==r||r>t)&&(e=s+">"+e)}return e},this.remove_unmatched_tag=function(e,t,s){var i=e,a=e.split(/(<[ph][^>]*>[^]*?<\/[ph][^>]*>)/),r=a.length,o=a[r-1],n=o.replace(/<\/{0,1}[ph][^>]*>/g,""),_=!0;if(-1!=o.search(/<\/{0,1}[ph]/)&&!(s&&-1==o.search(/<[ph]/)||t&&-1==o.search(/<[ph]/)||-1==n.search(/\S/))){var c=new RegExp(/<[ph][^>]*>/),d=o.match(c),l="<p>",u=-1;if(d)l=d[0],u=o.search(c);else if(r>1){(d=a[r-2].match(c))&&(l=d[0])}if(-1!=u){var p,g=new RegExp(/<\/{0,1}([ph][^>\s]*)/);l?p=l.match(g)[1]:l="<"+(p=o.match(g)[1])+">";var h,q="</"+p+">",m=o.split(c,2);sub_piece1=m[0].replace(/<\/{0,1}[ph][^>]*>/g,""),sub_piece2=m[1].replace(/<\/{0,1}[ph][^>]*>/g,""),h=-1!=l.search("class")?l.replace(/class\s*=\s*"/,'class="qwiz-inline '):"<"+p+' class="qwiz-inline">',sub_piece1=add_span_if_empty(sub_piece1),sub_piece2=add_span_if_empty(sub_piece2),sub_piece1&&(sub_piece1=h+sub_piece1+q),sub_piece2&&(sub_piece2=h+sub_piece2+q),n=sub_piece1,sub_piece1&&sub_piece2&&(n+=l+add_span_if_empty("",!0)+q),n+=sub_piece2,_=!1}}return _&&(n='<p class="qwiz-inline">'+add_span_if_empty(n,!0)+"</p>"),e=a.slice(0,r-1).join("")+n,debug[0]&&e!=i&&(console.log("[remove_unmatched_tag] part_orig:",i),console.log("[remove_unmatched_tag] part: ",e)),e},this.number_to_word=function(e){return number_word||(number_word=[qqc.S("zero"),qqc.S("one"),qqc.S("two"),qqc.S("three"),qqc.S("four"),qqc.S("five"),qqc.S("six"),qqc.S("seven"),qqc.S("eight"),qqc.S("nine"),qqc.S("ten")]),e>10?e.toString():number_word[e]},this.number_to_ordinal_word=function(e,t){var s;if(ordinal_words||(ordinal_words=[qqc.T("zeroth"),qqc.T("first"),qqc.T("second"),qqc.T("third"),qqc.T("fourth"),qqc.T("fifth"),qqc.T("sixth"),qqc.T("seventh"),qqc.T("eighth"),qqc.T("ninth"),qqc.T("tenth"),qqc.T("eleventh"),qqc.T("twelfth"),qqc.T("thirteenth")]),e<14)s=ordinal_words[e];else{var i=e%10;s=1==i?e+"st":2==i?e+"nd":3==i?e+"rd":e+"th"}return t&&(s=qqc.capitalize(s)),s},this.capitalize=function(e){return e=e.substr(0,1).toUpperCase()+e.substr(1)},this.plural=function(e,t,s){return 1==s?e:t},this.S=function(e){return qqc.T(e)},this.T=function(e){var t="";return"undefined"!=typeof qwiz_params?void 0!==qwiz_params.T&&(e=htmlDecode(e),void 0!==qwiz_params.T[e]&&(t=qwiz_params.T[e])):"undefined"!=typeof qwizzled_params&&void 0!==qwizzled_params.T&&(e=htmlDecode(e),void 0!==qwizzled_params.T[e]&&(t=qwizzled_params.T[e])),""==t&&(t=e),t},this.currency=function(e){if(0==e)return"$0.00";var t=""+parseInt(100*e+.5,10),s=t.length;return"$"+t.substr(0,s-2)+"."+t.substr(s-2)},this.get_qwiz_param=function(e,t){var s="";return"undefined"!=typeof qwiz_params?void 0!==qwiz_params[e]&&(s=qwiz_params[e]):"undefined"!=typeof qwizzled_params&&void 0!==qwizzled_params[e]&&(s=qwizzled_params[e]),s||null!=t&&(s=t),s},this.trim=function(e){return e&&(e=e.toString(),e="a".trim?e.trim():e.replace(/^\s+|\s+$/g,"")),e},this.add_script=function(e){var t=document.createElement("script");t.setAttribute("charset","utf-8"),t.src=e;var s=[];try{s=$("head")}catch(e){}s.length?s.append(t):$("body").append(t)},this.dataset_units_topics_toggle_all=function(e){$(e).parents("table.dataset_units_topics").find("input:checkbox").prop("checked",e.checked),e.checked?$(e).attr("checked",!0):$(e).removeAttr("checked")},this.dataset_unit_toggle_topics=function(e){var t=$(e).parents("tr.unit_head").attr("id").match(/-unit([0-9]+)/)[1];$(e).parents("table.dataset_units_topics").find("tr.unit_topic"+t+" input:checkbox").prop("checked",e.checked),e.checked?$(e).attr("checked",!0):$(e).removeAttr("checked")};var n_dataset_units_expanded=[];function separate_combo(e,t,s){var i=e.split("[qQq]"),a=t.split("[qQq]");const r=i.length;e=[];for(var o=[],n=[],_=[],c=0;c<r;c++)"Q"==a[c]?(e.push(i[c]),o.push(s[c])):(n.push(i[c]),_.push(s[c]));const d=e.length;e=e.join("");const l=n.length;return[e,o,d,n=n.join(""),_,l]}function combo_switch(e,t,s,i){const a=$(`#qwiz${s}`),r=$(`#qcard_window-qdeck${i}`);t!=e&&("Q"==t?(a.css({display:"block"}),r.css({display:"none"})):(r.css({display:"block"}),a.css({display:"none"})))}function filter_maker_specific_questions_cards(e,t){var s=e.split("[qQq]"),i=[],a={};for(var r of s){var o="",n="",_=r.match(/\[(<code><\/code>)*q\s*([^\]]*)\]/gm);if(_&&_.length){var c=_[0];c=qqc.replace_smart_quotes(c),o=qqc.get_attr(c,"unit"),n=qqc.get_attr(c,"topic")}o||(o="Other"),n||(n="Other");var d=o+"__"+n;void 0===a[d=d.replace(/[^a-z0-9 ]/gi,"_")]&&(a[d]=0),(void 0===maker_specific_n_qs_by_unit_topic||a[d]<maker_specific_n_qs_by_unit_topic[d])&&(i.push(r),a[d]++)}const l=i.length;if(t<l){const e=l-t;for(var u=0;u<e;u++){const e=i.length,t=Math.floor(Math.random()*e);i.splice(t,1)}}return i.join("")}function insert_dataset_questions(e,t,s){for(var i=t.split("[qQq]"),a=i.length,r={},o=0;o<a;o++){r[parse_dataset_question_ids(i[o],"dataset_id")[0]]=o}var n=e.match(/\[q[^\]]* use_dataset_(question|card)\s*=\s*\S[^\]]+/g);a=n.length;for(ii=0;ii<a;ii++){o=r[qqc.replace_smart_quotes(n[ii]).match(/use_dataset_[^"]+"([^"]+)/)[1]];e=e.replace(/\[q([^\]]* )use_dataset_(question|card)\s*=\s*[^\]]+\]/,i[o])}var _="qwiz_"==s?"use_dataset_question":"use_dataset_card";return e=e.replace(/dataset_id/g,_)}function parse_dataset_question_ids(e,t){var s=new RegExp(t+"\\s*=\\s*\\S[^\\]]+","g"),a=e.match(s),r=a.length,o=[];for(i=0;i<r;i++){var n=qqc.replace_smart_quotes(a[i]).match(/"([^"]+)/)[1];o.push(n)}return o}function start_dataset_questions_countdown(e,t,s,i,a,r){var o=$("#dataset_questions_countdown_display-"+e+t),n=31,_=function(){if(--n>0){var c=qqc.T("Trying for")+" "+n+" "+qqc.T("more")+" "+qqc.plural(qqc.T("second"),qqc.T("seconds"),n)+"...";o.html(c),dataset_questions_countdown_timeout[e+t]=setTimeout(_,1e3)}else{$("#dataset_questions_spinner-"+e+t).css({visibility:"hidden"});var d="qwiz_"==e?qqc.T("questions"):qqc.T("cards"),l=`'${qqc.addSlashes(s)}', '${e}', ${t}, '${qqc.addSlashes(i)}', ${a}, ${r}, 0, ''`;c=qqc.T("Sorry, could not get")+" "+d+"<br /><br />"+`<button class="qwiz_button begin_practice" onclick="qwiz_qcards_common.begin_dataset_quiz_deck (${l})">`+qqc.T("Try again")+"</button>";o.html(c),dataset_questions_countdown_timeout[e+t]="fail"}};_()}function get_qwizdeckdata(e,t,s){return"qwiz_"==e?qwiz_.get_qwizdata(t,s):qcard_.get_deckdata(t,s)}function parse_html_block_pattern(e){var t="("+e.join(")|(")+")";return t="(("+(t=t.replace(/([\[\]\*])/g,"\\$1"))+")\\s*)"}function select_text(e){if(document.body.createTextRange)(t=document.body.createTextRange()).moveToElementText(e),t.select();else if(window.getSelection){var t,s=window.getSelection();(t=document.createRange()).selectNodeContents(e),s.removeAllRanges(),s.addRange(t)}}this.dataset_unit_expand_collapse=function(e,t,s){$icon_el=$(s);var i=$icon_el.parents("tr.unit_head").attr("id").match(/-unit([0-9]+)/)[1],a=$icon_el.parents("table.dataset_units_topics").find("tr.unit_topic"+i);$icon_el.hasClass("expand")?($icon_el.removeClass("expand").addClass("collapse").attr("src",icon_collapse_src),a.show(),void 0===n_dataset_units_expanded[t]?n_dataset_units_expanded[t]=1:n_dataset_units_expanded[t]++,$icon_el.parents("table.dataset_units_topics").find("span.topics_header").css({visibility:"visible"}),$icon_el.parents("table.dataset_units_topics").find("span.units_header").css({"vertical-align":"top"})):($icon_el.removeClass("collapse").addClass("expand").attr("src",icon_expand_src),a.hide(),n_dataset_units_expanded[t]--,0==n_dataset_units_expanded[t]&&($icon_el.parents("table.dataset_units_topics").find("span.topics_header").css({visibility:"hidden"}),$icon_el.parents("table.dataset_units_topics").find("span.units_header").css({"vertical-align":"bottom"}))),"qcard_"==e&&qcard_.set_container_width_height(t)},this.begin_dataset_quiz_deck=function(e,t,s,i,a,r,o,n,_,c){var d=e.split("; "),l=i.split("; ");c&&(c=c.split("; "));var u=d.length,p=[],g=[];for(let e=0;e<u;e++)if(p.push([]),g.push([]),c){c&&"F"==c[e]&&(qcard_.set_deckdata(0,"qrecord_id",l[e]),qcard_.set_deckdata(0,"combo",!0),qcard_.set_deckdata(0,"combo_i_qwiz",s)),qwiz_.set_qwizdata(s,"combo_i_deck",0)}var h=$("#dataset_units_topics-"+t+s+" tr.unit_topic");if(h.length&&h.each(function(){if($tr=$(this),$tr.find("input:checkbox").prop("checked")){var e=0;$tr.find("td.nquestions").each(function(){let t=$(this),s=t.data("unit"),i=t.data("topic");p[e].push(s),g[e].push(i),e++}),$tr.prev("tr.unit_head").find("input:checkbox").prop("checked",!0)}}),debug[11]&&(console.log("[begin_dataset_quiz_deck] selected_units:",p),console.log("[begin_dataset_quiz_deck] selected_topics:",g)),0==p[0].length)return alert(qqc.T("Please select at least one unit/topic")),!1;record_units_topics_state(t,s);var q=$("#dataset_reset_questions_date_"+t+s).val();q==n&&(q=""),r||(r=$("#dataset_max_q_"+t+s).val()),o||(o=$('input[name="spaced_repetition"]:checked').val()),_||(_=0);var m=get_qwizdeckdata(t,s,"random_b");i&&document_qwiz_user_logged_in_b||r<a&&(m=!0),qqc.get_dataset_questions(e,t,s,i,p,g,r,o,m,!1,!1,q,_,a,c)},this.parse_use_dataset=function(e){var t=[],s=[],i=[];const a=e.split(";");for(var r of a){const e=r.split(/\|\s*unit:/i);for(var o of(t.push(e[0].trim()),e.slice(1))){const e=o.split(/\|\s*topic:/i);var n=e[0].trim().replace(/ /g,"_");if(n="%"+n,1==e.length)s.push(n),i.push("*");else for(var _ of e.slice(1)){var c=_.trim().replace(/ /g,"_");c="%"+c,s.push(n),i.push(c)}}}return[t=t.join(";"),s,i]},this.get_dataset_questions=function(e,t,s,i,a,r,o,n,_,c,d,l,u,p,g){if(debug[11]&&(console.log("[get_dataset_questions] dataset:",e),console.log("[get_dataset_questions] qrecord_id:",i),console.log("[get_dataset_questions] units:",a),console.log("[get_dataset_questions] topics:",r),console.log("[get_dataset_questions] q_fs:",g)),!c){var h="qwiz_"==t?"questions":"cards";plugin_url||(plugin_url=qqc.get_qwiz_param("url","./"));var q='<div id="dataset_questions_spinner-'+t+s+'" style="margin-top: 100px;" >Getting '+h+' from Qwizcards server...<br /><img src="'+(plugin_url+"images/spinner40x40.gif")+'" class="qwiz-center" /><br /></div><p id="dataset_questions_countdown_display-'+t+s+'" style="text-align: center;"></p>';qqc.$get_login_div(t,s).html(q).show();dataset_questions_countdown_timeout[t+s]=setTimeout(function(){start_dataset_questions_countdown(t,s,e,i,o,n)},5e3)}var m="";void 0!==document_qwiz_session_id&&(m=document_qwiz_session_id);var f=window.location.href,w=_?1:0,b="qwiz_"==t&&qwiz_.wordpress_page_f?1:0,v={action:"get_dataset_questions",dataset:e,qname:t,i_qwiz_qdeck:s,units:a,topics:r,n_questions_in_set:o,questions_to_do:n,random_f:w,qf_f:b,qwiz_session_id:m,page_url:f};if(c){var k=parse_dataset_question_ids(c,"qwiz_"==t?"use_dataset_question":"use_dataset_card");v.use_dataset_question_ids=k,v.maker_session_id="qwiz_"==t&&qwiz_.qwizard_b?qwizzled.maker_session_id:0}d&&(v.no_display_f=1),l&&(v.dataset_reset_questions_date=l),u&&(v.maker_specific_questions_cards=u),p&&(v.n_qs=p),g&&(v.q_fs=g);let z=selected_levels[t+s];z&&z.length>1&&(v.selected_levels=z);var y=qqc.get_qwiz_param("ajaxurl","");debug[11]&&(console.log("[get_dataset_questions] data:",v),console.log("[get_dataset_questions] local_ajaxurl:",y)),y?(v.qrecord_id=i,$.ajax({type:"POST",url:y,data:v,success:qqc.receive_and_place_dataset_questions})):(v.callback="receive_and_place_dataset_questions",v.units=btoa(JSON.stringify(v.units)),v.topics=btoa(JSON.stringify(v.topics)),v.use_dataset_question_ids=btoa(JSON.stringify(v.use_dataset_question_ids)),qqc.qjax(t,s,i,"get_dataset_questions_v3",v))},this.receive_and_place_dataset_questions=function(response){if(debug[11]&&console.log("[receive_and_place_dataset_questions] response:",response),response){var dataset=response.dataset,ok_f=response.ok_f,qname=response.qname,i_qwiz_qdeck=response.i_qwiz_qdeck,no_display_f=response.no_display_f,n_questions_in_set=response.n_questions_in_set,maker_specific_questions_cards=parseInt(response.maker_specific_questions_cards),n_qs=parseInt(response.n_qs);if("fail"!=dataset_questions_countdown_timeout[qname+i_qwiz_qdeck]){if(response.cv_index&&qwiz_.set_qwizdata(i_qwiz_qdeck,"cv_index",response.cv_index),response.rvt&&(qwiz_.set_qwizdata(i_qwiz_qdeck,"random_b",!0),qwiz_.set_qwizdata(i_qwiz_qdeck,"repeat_incorrect_b",!1)),0==ok_f){var errmsg=response.errmsg;if(errmsg){if(qqc.isInteger(errmsg)){var beg_time_unix=errmsg,beg_date=DateFormat.format.date(1e3*beg_time_unix,"h:mm a");errmsg="Test will be available at "+beg_date+'<br /><br /><button class="qwiz_button" onclick="'+qname+".next_question ("+i_qwiz_qdeck+')"><span id="next_button_text-qwiz'+i_qwiz_qdeck+'">'+qqc.T("Start quiz")+"</span></button>\n"}else if("Quiz completed"==errmsg||"Quiz not available"==errmsg||"Quiz no longer available"==errmsg){var dataset_intro_f=qwiz_.get_qwizdata(i_qwiz_qdeck,"dataset_intro_f");if((!dataset_intro_f||"topics_only"==dataset_intro_f)&&dataset){if("Quiz not available"==errmsg&&(errmsg+='</span><br /><button class="qwiz_button" onclick="'+qname+".next_question ("+i_qwiz_qdeck+')"><span id="next_button_text-qwiz'+i_qwiz_qdeck+'">'+qqc.T("Try again")+"</span></button><span>\n"),qwiz_.set_qwizdata(i_qwiz_qdeck,"dataset_intro_f","topics_only"),qwiz_.set_qwizdata(i_qwiz_qdeck,"dataset_intro_info_only_msg",errmsg),/\|\s*unit:/.test(dataset))var[dataset,units,topics]=qqc.parse_use_dataset(dataset);else var units=[],topics=[];return get_dataset_units_topics(qname,i_qwiz_qdeck,response.qrecord_id,dataset,units,topics),!1}}}else{var no_datasets=response.no_datasets;if(no_datasets.length)errmsg="Could not find dataset(s): "+no_datasets.join(", ");else{var s=-1!=dataset.indexOf(";")?"s":"";errmsg="Permission needed for questions from dataset"+s+" "+dataset+" (see qwizcards.com/admin/manage_datasets.php)"}alert(errmsg)}clearTimeout(dataset_questions_countdown_timeout[qname+i_qwiz_qdeck]);var $use_dataset_options_div=qqc.$get_login_div(qname,i_qwiz_qdeck);return $use_dataset_options_div.html("<br /><b>"+errmsg+"</b>").show(),!1}!qwiz_.preview&&response.rvt&&eval(atob(response.rvt));var n_questions=response.n_questions,questions_html=response.questions_html,questions_q_f=response.questions_q_f,question_qrecord_ids=response.question_qrecord_ids,card_qrecord_ids,use_dataset_questions_f=response.use_dataset_questions_f;if(clearTimeout(dataset_questions_countdown_timeout[qname+i_qwiz_qdeck]),0==n_questions){var dataset_intro_f=qwiz_.get_qwizdata(i_qwiz_qdeck,"dataset_intro_f");if(dataset_intro_f){var msg;msg="qwiz_"==qname?qqc.T("There are no questions available of the type you selected"):qqc.T("There are no cards available of the type you selected"),alert(msg),qqc.create_use_dataset_options3(dataset_units_topics_data,qname,i_qwiz_qdeck)}else{var msg=qqc.T("Sorry, could not get questions"),$use_dataset_options_div=qqc.$get_login_div(qname,i_qwiz_qdeck);$use_dataset_options_div.html("<br /><b>"+msg+"</b>").show()}return!1}questions_html=qqc.decodeHtmlEntities(questions_html);var cards_html="",n_cards=0;if(questions_q_f&&([questions_html,question_qrecord_ids,n_questions,cards_html,card_qrecord_ids,n_cards]=separate_combo(questions_html,questions_q_f,question_qrecord_ids)),"qwiz_"==qname&&n_questions){if(1==use_dataset_questions_f){var htm=qwiz_.get_qwizdata(i_qwiz_qdeck,"use_dataset_questions_htm");if(questions_html=insert_dataset_questions(htm,questions_html,qname),no_display_f)return}else questions_html=maker_specific_questions_cards?filter_maker_specific_questions_cards(questions_html,n_questions_in_set):questions_html.replace(/\[qQq\]/g,"");n_qs&&qwiz_.set_qwizdata(i_qwiz_qdeck,"n_qs",n_qs);var new_htm=qwiz_.process_questions(questions_html,"",i_qwiz_qdeck,void 0,qwiz_.qwizard_b,!1,question_qrecord_ids);qwiz_.display_progress(i_qwiz_qdeck);var $login_div=$("#qwiz_login-qwiz"+i_qwiz_qdeck).hide(),$questions=$("#dataset_questions-qwiz"+i_qwiz_qdeck),typeset_latex_f;if(qwiz_.init_question_order(i_qwiz_qdeck),[new_htm,typeset_latex_f]=qqc.qlatex_convert(new_htm),$questions.html(new_htm),qwiz_.preview&&(qwiz_.init_preview(i_qwiz_qdeck),response.rvt)){var delay_setp=function(){eval(atob(response.rvt))};setTimeout(delay_setp,500)}if(qwiz_.qwizard_b){qwizard.questions_list_html();var ii_question=qwiz_.no_intro_b[i_qwiz_qdeck]?-1:0;qwizard.highlight_accordion_question(ii_question)}if(qwiz_.init_textentry_autocomplete($questions),$questions.find(".wp-audio-shortcode").css({visibility:"visible"}),"undefined"!=typeof Prism){const e=$questions[0];Prism.highlightAllUnder(e)}else"undefined"!=typeof hljs&&$questions.find("code").each(function(e,t){hljs.highlightBlock(t),this.style.display="inline-block"});if(typeset_latex_f&&qqc.qlatex_init($questions),response.run_get_dataset_units_topics_f){if(/\|\s*unit:/.test(dataset))var[dataset,units,topics]=qqc.parse_use_dataset(dataset);else var units=[],topics=[];get_dataset_units_topics(qname,i_qwiz_qdeck,response.qrecord_id,dataset,units,topics,"restore_topic_question_counts")}else qwiz_.set_qwizdata(i_qwiz_qdeck,"login_show_b",!1),qwiz_.get_qwizdata(i_qwiz_qdeck,"bck_f")&&(qwiz_.set_qwizdata(i_qwiz_qdeck,"bck_f",!1),qwiz_.reset_counters(i_qwiz_qdeck)),qwiz_.set_qwizdata(i_qwiz_qdeck,"i_question",-1),qwiz_.preview||qwiz_.next_question(i_qwiz_qdeck,!0,!0),qwiz_.next_question_from_intro(i_qwiz_qdeck,0)}if("qwiz_"==qname&&0==n_questions&&(qwiz_.set_qwizdata(i_qwiz_qdeck,n_questions_done,0),qwiz_.set_qwizdata(i_qwiz_qdeck,n_questions_for_done,0)),"qcard_"==qname||cards_html&&n_cards){var i_deck=i_qwiz_qdeck;if(cards_html&&(questions_html=cards_html,i_deck=0),1==use_dataset_questions_f){var htm=qcard_.get_deckdata(i_deck,"use_dataset_card_html");if(questions_html=insert_dataset_questions(htm,questions_html,qname),no_display_f)return}else questions_html=questions_html.replace(/\[qQq\]/g,"");var card_tags=questions_html.match(/\[q[^\]]*\]/gm);qcard_.process_card_attributes(i_deck,card_tags);var n_cards=qcard_.process_cards(questions_html,i_deck,void 0,qcard_.qwizard_b,card_qrecord_ids);if(qcard_.set_deckdata(i_deck,"n_cards",n_cards),qcard_.set_deckdata(i_deck,"n_to_go",n_cards),qcard_.init_card_order(i_deck),$("#qcard_next_buttons-qdeck"+i_deck).css("visibility","visible"),qcard_.set_deckdata(i_deck,"bck_f",!1),qcard_.qwizard_b&&(qwizard.set_qwizard_data("n_questions",n_cards),qwizard.cards_list_html(),qwizard.highlight_accordion_question(0)),qcard_.set_deckdata(i_deck,"no_flip_b",!1),0==use_dataset_questions_f||qcard_.no_intro_b[i_deck]||1==n_cards)qcard_.start_deck2(i_deck,void 0,!0);else{var intro_html=qcard_.get_deckdata(i_deck,"intro_html");qcard_.qwizard_b?(qcard_.set_editable_parts_front(i_deck,intro_html),qwizard.highlight_accordion_question(-1)):(qcard_.get_card_front(i_deck,-1).html(intro_html),qcard_.set_deckdata(i_deck,"no_flip_b",!0)),qcard_.qwiz_icon_stop_propagation(i_deck),qcard_.set_container_width_height(i_deck)}}if(questions_q_f&&0==n_cards){var i_deck=0;qcard_.set_deckdata(i_deck,"n_cards",0),qcard_.set_deckdata(i_deck,"n_to_go",0)}questions_q_f&&qqc.combo_next("",i_qwiz_qdeck,i_deck)}}},this.combo_next=function(e,t,s,i){var a=qwiz_.get_qwizdata(t,"n_correct");qwiz_.get_qwizdata(t,"repeat_incorrect_b")||(a+=qwiz_.get_qwizdata(t,"n_incorrect"));const r=qwiz_.get_qwizdata(t,"n_questions_for_done")-a,o=qcard_.get_deckdata(s,"n_cards"),n=qcard_.get_deckdata(s,"n_to_go"),_=r+n;var c;if(0==_)c="Q";else{const e=r/_;c=Math.random()<e?"Q":"F"}combo_switch(e,c,t,s),"Q"==c?a>0&&qwiz_.next_question(t,!0,!0,!0):o>n&&qcard_.next_card(s,i,!0)},this.qlatex_convert=function(e){var t;return/\[qlatex|\[latex\]/.test(e)?(e=(e=e.replace(/\[qlatex\]/g,"\\[").replace(/\[\/qlatex\]/g,"\\]")).replace(/\[qlatexinline\]|\[latex\]/g,"\\(").replace(/\[\/qlatexinline\]|\[\/latex\]/g,"\\)"),t=!0):t=/\\[(\]]/.test(e),[e,t]},this.qlatex_init=function(e){if(!window.MathJax){debug[0]&&console.log("[qwiz_mathjax.js] (load MathJax)");var t=document.createElement("script");t.src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js",document.head.appendChild(t)}var s=0;const i=function(){if(debug[0]&&console.log("[qlatex_init > delay_qwiz_mathjax_config] window.MathJax:",window.MathJax),window.MathJax&&window.MathJax.version){"2"==MathJax.version[0]?MathJax.Hub.Queue(["Typeset",MathJax.Hub],e[0]):MathJax.typeset()}else++s<20?setTimeout(i,200):console.log("[qlatex_init] unable to configure MathJax")};setTimeout(i,10)},this.restore_topic_question_counts=function(e){debug[0]&&console.log("[restore_topic_question_counts] data:",e);for(var t=e.i_qwiz_qdeck,s=e.topics.length,i=qwiz_.get_qwizdata(t,"topic_statistics"),a=qwiz_.get_qwizdata(t,"topics"),r=0,o=0,n=0,_=0;_<s;_++){var c=e.topics[_].replace(/\s/g,"_");c||(c="Other"),i||(i={}),i[c]||(i[c]={},i[c].n_correct=0,i[c].n_incorrect=0,-1==a.indexOf(c)&&a.push(c)),i[c].n_correct+=e.n_correct_by_unit_topic[_],i[c].n_incorrect+=e.n_incorrect_by_unit_topic[_],r+=e.n_correct_by_unit_topic[_],o+=e.n_incorrect_by_unit_topic[_],n+=e.n_questions_by_unit_topic[_]}debug[0]&&console.log("[restore_topic_question_counts] topic_statistics:",i),qwiz_.set_qwizdata(t,"topic_statistics",i),qwiz_.set_qwizdata(t,"topics",a),qwiz_.set_qwizdata(t,"n_correct",r),qwiz_.set_qwizdata(t,"n_incorrect",o),qwiz_.set_qwizdata(t,"restore_n_questions",n),qwiz_.set_qwizdata(t,"n_questions_for_done",n),qwiz_.set_qwizdata(t,"login_show_b",!1),qwiz_.set_qwizdata(t,"i_question",-1),qwiz_.next_question(t,!0,!0),qwiz_.next_question_from_intro(t,0),qwiz_.display_progress(t)},this.preview_limit=function(e,t,s){var i,a,r,o;"qwiz"==e?(i="quiz",a=qqc.T("question"),questions_cards=qqc.T("questions"),r="qwiz_",o=qwiz_):(i="flashcard deck",a=qqc.T("card"),questions_cards=qqc.T("cards"),r="qcard_",o=qcard_);var n="",_=!1;if("preview_period_expired"==t[s].pay_quiz_ok||"no_free_trial"==t[s].pay_quiz_ok)n="preview_period_expired"==t[s].pay_quiz_ok?"Your free trial period for quizzes has expired":"Sorry, no free trial for this quiz/deck.",o.display_login(s,!1,"pay",n),_=!0;else{if(-1==t[s].n_preview_questions)n="Sorry, you must register/log in to do this "+i,_=!0;else{t[s].n_preview_questions--;var c=$("div#pay_unlock_menu-"+("qwiz"==e?"qwiz":"qdeck")+s).find(" div.pay_preview_status");0==t[s].n_preview_questions?(n="Please log in or register to do more of this "+i,t[s].n_preview_questions=-1,_=!0,$("#unlocked-"+e+s).css({display:"none"}),$("#locked-"+e+s).css({display:"block"}),c.html(qqc.T("Preview mode. You have no")+" "+questions_cards+" "+qqc.T("remaining. Please log in or register to continue")+".")):c.html(qqc.T("Preview mode. You have")+" "+qqc.number_to_word(t[s].n_preview_questions)+" "+qqc.plural(a,questions_cards,t[s].n_preview_questions)+" "+qqc.T("remaining"))}_&&(n="Preview limit reached",!0===document_qwiz_user_logged_in_b?document_qwiz_university_discount?o.hide_menu_and_display_login(s,!1,"pay",n,!0,"Pay now"):o.hide_menu_and_display_login(s,!1,"paypal_subscription"):qqc.pay_unlock_menu_display_login(r,s,"free_trial",n,"","Sign up"))}return _},this.pay_lock_settings=function(e,t,s,i,a,r,o,n){var _=0,c=function(){if("not ready"==document_qwiz_user_logged_in_b)debug[0]&&console.log("[pay_lock_settings] n_tries:",_),++_<20?setTimeout(c,"100"):console.log("[pay_lock_settings] document_qwiz_user_logged_in_b not set");else{var d=0,l=s;void 0!==o&&(l=(d=parseInt(o))+1);for(var u=[],p=[],g=[],h=d;h<l;h++)if(t[h].pay_quiz_deck_id){u.push(h),p.push(t[h].pay_quiz_deck_id);var q=t[h].promo_code;q=q||"",g.push(q)}n=void 0!==n?n:"";var m={logged_in_f:document_qwiz_user_logged_in_b?1:0,i_qwizzes_decks:btoa(JSON.stringify(u)),pay_quiz_deck_ids:btoa(JSON.stringify(p)),promo_codes:btoa(JSON.stringify(g)),pay_registration_date_unix:document_qwiz_pay_registration_date_unix,msg:n};void 0!==i&&(m.i_login_qwiz=i,void 0===a&&(a=0,r=0),m.escaped_session_id=a,m.remember_f=r),debug[0]&&(m.qdebug=1);var f="get_pay_settings";/xget=/.test(document.location.search)&&(f="x"+f),qqc.qjax(e,h,"",f,m)}};c()},this.set_pay_settings=function(e){debug[0]&&(console.log("[set_pay_settings] data:",e),console.log("[set_pay_settings] document_qwiz_university_discount:",document_qwiz_university_discount));var t,s,i,a,r=void 0!==e.i_login_qwiz,o=e.qname;"qwiz_"==o?(t="qwiz",s=qqc.T("question"),questions_cards=qqc.T("questions"),i=qqc.T("quiz"),a=qwiz_):(t="deck",s=qqc.T("card"),questions_cards=qqc.T("cards"),i=qqc.T("flashcard deck"),a=qcard_);for(var n=e.pay_qwiz_decks_data,_=e.pay_qwiz_decks_maker_options,c=n.length,d=(new Date).getTime()/1e3,l=0;l<c;l++){var u=n[l],p=u.i_qwiz_deck,g=u.pay_errmsg,h="",q="";if(g)qqc.set_qwizdeckdata(o,p,"pay_errmsg",g);else{for(var m,f,w=u.payment_type_via,b=u.payment_type_id,v=u.maker_f,k=u.fee,z=u.good_for_n_periods,y=u.good_for_period,x=u.payment_description,T=u.n_preview_free_default,S=(u.registration_required,u.unpaid_msg),j=u.parallel_payment_type_id,C=u.n_preview_free,A=u.registration_trial_days,M=u.registration_trial_days_default,P=u.good_through_date_unix,O=(u.promo_code,u.promo_fee),N=u.promo_description,E=b.length,I=[],D=0,R="",F=-1,B=0,H=0,L=0,J=0,U=[],Y=[],V=[],Q=[],W=[],K=[],G=[],X=!1,Z=!0,ee=!1,te=!1,se=!1,ie=-1,ae=0;ae<E;ae++){if(f=!1,!v[ae]&&(!P[ae]||P[ae]+259200<d)){if(-1!=j.slice(0,ae).indexOf(b[ae]))continue;var re=!1;if(k[ae]<=0&&document_qwiz_good_through_date_ok&&(re=!0),65==b[ae]&&(re=!0),document_qwiz_independent_taker_f&&47==b[ae]&&(re=!0),document_qwiz_university_discount&&47!=b[ae]&&(debug[0]&&console.log("[set_pay_settings] skipping payment_type_id:",b[ae]),re=!0),!re){var oe;if(k[ae]<=0?(oe='<div style="margin-left: 10px; padding: 0;">',oe+=qqc.capitalize(qqc.number_to_word(z[ae])),X=!0):(oe='<div style="padding: 0;">',oe+="<b>College students</b>: $"+k[ae]+" for "+qqc.number_to_word(z[ae]),Z=!1),oe+=" "+y[ae]+qqc.plural("’s","s’",z[ae])+" access",x[ae]&&(oe+=" to "+x[ae],k[ae]<=0)){var ne="Sign up for a free trial";oe+=' <a href="javascript: '+(!0===document_qwiz_user_logged_in_b?`${o}.hide_menu_and_display_login (${p}, false, 'paypal_subscription')`:`qwiz_qcards_common.pay_unlock_menu_display_login ('${o}', ${p}, 'free_trial', ' ${ne}', '', 'Sign up')`)+'" class="qwiz_login">sign up</a>'}oe+="</div>",I.push(oe),-1!=O[ae]&&(te=!0,k[ae]=O[ae],x[ae]+=" - "+N[ae],f=!0,se=!0,ie=J),U.push(b[ae]),Y.push(k[ae]),V.push(z[ae]),Q.push(y[ae]),W.push(x[ae]),K.push(f),S[ae]&&G.push(S[ae]),J++;var _e=C[ae];-1==_e&&(_e=T[ae]),_e>H&&(H=_e);var ce=A[ae],de=M[ae];-1==ce&&(ce=de),ce>L&&(L=ce,m=de)}}(!0===document_qwiz_user_logged_in_b||r)&&P[ae]>=D&&(D=P[ae],k[ae]>F&&(F=k[ae]),B=v[ae],R=w[ae])}qqc.set_qwizdeckdata(o,p,"taker_payment_type_ids",U),qqc.set_qwizdeckdata(o,p,"taker_fees",Y),qqc.set_qwizdeckdata(o,p,"taker_good_for_n_periodss",V),qqc.set_qwizdeckdata(o,p,"taker_good_for_periods",Q),qqc.set_qwizdeckdata(o,p,"taker_payment_descriptions",W),qqc.set_qwizdeckdata(o,p,"taker_payment_selected_bs",K),qqc.set_qwizdeckdata(o,p,"taker_unpaid_msgs",G),qqc.set_qwizdeckdata(o,p,"any_taker_options_free_b",X),qqc.set_qwizdeckdata(o,p,"all_taker_options_free_b",Z),qqc.set_qwizdeckdata(o,p,"any_promo",te),-1!=ie&&qqc.set_qwizdeckdata(o,p,"i_promo",ie);var le=get_qwizdeckdata(o,p,"pay_quiz_deck_id");qqc.set_qwizdeckdata(o,p,"taker_pay_quiz_deck_id",le),qqc.set_qwizdeckdata(o,p,"promo_applied",se);var ue=[],pe=!1;if(!document_qwiz_user_logged_in_b&&_.length){var ge=_[l],he=(b=ge.payment_type_id,k=ge.fee,z=ge.good_for_n_periods,y=ge.good_for_period,x=ge.payment_description,[]),qe=[],me=[],fe=[],we=[],be=k.length;for(ae=0;ae<be;ae++){var ve;k[ae]<-1.5||(k[ae]<0?ve=x[ae]:(pe=!0,ve="$"+k[ae]+" for "+qqc.number_to_word(z[ae])+" "+y[ae]+qqc.plural("","s",z[ae]),x[ae]&&(ve+=" - "+x[ae])),ue.push(ve),he.push(b[ae]),qe.push(k[ae]),me.push(z[ae]),fe.push(y[ae]),we.push(x[ae]))}qqc.set_qwizdeckdata(o,p,"maker_payment_type_ids",b),qqc.set_qwizdeckdata(o,p,"maker_fees",k),qqc.set_qwizdeckdata(o,p,"maker_good_for_n_periodss",z),qqc.set_qwizdeckdata(o,p,"maker_good_for_periods",y),qqc.set_qwizdeckdata(o,p,"maker_payment_descriptions",x);le=get_qwizdeckdata(o,p,"pay_quiz_deck_id");qqc.set_qwizdeckdata(o,p,"maker_pay_quiz_deck_id",le)}}var ke=$("#locked-"+t+p),ze=$("#unlocked-"+t+p);if(qqc.set_qwizdeckdata(o,p,"pay_quiz_ok","preview_questions"),!0===document_qwiz_user_logged_in_b||r){document_qwiz_pay_registration_date_unix||(document_qwiz_pay_registration_date_unix=parseInt(e.pay_registration_date_unix,10));d=(new Date).getTime()/1e3;var ye=!1;if(document_qwiz_maker_privileges){ye=!0,qqc.set_qwizdeckdata(o,p,"pay_quiz_ok","paid"),ze.css({display:"block",filter:"none"}),ke.css({display:"none"}),document_qwiz_good_through_date_ok=!0,document_qwiz_good_through_date=DateFormat.format.date(1e3*D,"yyyy-MM-dd");h="Available through "+DateFormat.format.date(1e3*D,"MMMM d, yyyy")}else if(F>=0||1==B)if(D+259200>d){ye=!0,qqc.set_qwizdeckdata(o,p,"pay_quiz_ok","paid"),get_qwizdeckdata(o,p,"display_pay_screen")&&!0,ze.css({display:"block",filter:"none"}),document_qwiz_good_through_date=DateFormat.format.date(1e3*D,"yyyy-MM-dd");const e=DateFormat.format.date(1e3*D,"MMMM d, yyyy");h="student"==R?0==F?"Subscription - free trial through "+e:document_qwiz_university_discount?"University discount good to "+e:"Subscription good through "+e:"teacher"==R?"Class access available through "+e:"Available through "+e,void 0===document_qwiz_good_through_date_ok&&(document_qwiz_good_through_date_ok=!0),ke.css({display:"none"})}else if(ye=!0,document_qwiz_good_through_date_ok=!1,D){document_qwiz_good_through_date=DateFormat.format.date(1e3*D,"yyyy-MM-dd");const e=DateFormat.format.date(1e3*D,"MMMM d, yyyy");h=qqc.T("Access expired "+e),ze.css({display:"none"}),ke.css({display:"block"}),qqc.set_qwizdeckdata(o,p,"pay_quiz_ok","preview_period_expired")}else document_qwiz_good_through_date="",h=qqc.T("Limited preview."),ze.css({display:"block",filter:""}),ke.css({display:"none"}),qqc.set_qwizdeckdata(o,p,"pay_quiz_ok","preview_questions"),qqc.set_qwizdeckdata(o,p,"n_preview_questions",H);if(!ye)if(document_qwiz_good_through_date_ok=!1,ee)if(document_qwiz_pay_registration_date_unix+48*L*3600<d)ke.css({display:"block"}),0==L?(h="Preview mode. You have "+qqc.number_to_word(H)+" "+qqc.plural(s,questions_cards,H)+" remaining",qqc.set_qwizdeckdata(o,p,"pay_quiz_ok","preview_questions"),qqc.set_qwizdeckdata(o,p,"n_preview_questions",H),F<0&&D+172800>d&&(h+="<br />This "+i+" is not part of the free trial")):L==de?(h="Sorry, your free trial period for quizzes has expired",q="To continue use:<br />",qqc.set_qwizdeckdata(o,p,"pay_quiz_ok","preview_period_expired")):(h="Sorry, your free trial period for this quiz/deck has expired",q="To continue use:",qqc.set_qwizdeckdata(o,p,"pay_quiz_ok","preview_period_expired")),ze.css({display:"none"});else{var $e=parseInt((document_qwiz_pay_registration_date_unix+24*L*3600-d)/86400,10);h=$e>0?L==de?"You have "+qqc.number_to_word($e)+" "+qqc.plural(qqc.T("day"),qqc.T("days"),$e)+" "+qqc.T("left in your free trial of quizzes/flashcard decks"):"You have "+qqc.number_to_word($e)+" "+qqc.plural(qqc.T("day"),qqc.T("days"),$e)+" "+qqc.T("left in your free trial of this quiz/flashcard deck"):qqc.T("You have less than one day left in your free trial"),q=qqc.T("After your free trial:"),ke.css({display:"none"}),ze.css({display:"block"}),qqc.set_qwizdeckdata(o,p,"pay_quiz_ok","preview_period")}else 0==H?qqc.set_qwizdeckdata(o,p,"n_preview_questions",-1):qqc.set_qwizdeckdata(o,p,"n_preview_questions",H),ze.css({display:"block"}),h=qqc.T("Preview mode. You have")+" "+qqc.number_to_word(H)+" "+qqc.plural(s,questions_cards,H)+" "+qqc.T("remaining"),ke.css({display:"none"})}else if(0==H)qqc.set_qwizdeckdata(o,p,"n_preview_questions",-1),ke.css({display:"block"}),h=qqc.T("Sorry, no preview available for this quiz/deck."),q="",qqc.set_qwizdeckdata(o,p,"pay_quiz_ok","no_free_trial"),ze.css({display:"none"});else{if(0==L)h=qqc.T("Preview mode. You have")+" "+qqc.number_to_word(H)+" "+qqc.plural(s,questions_cards,H)+" "+qqc.T("remaining"),q="<b>Students working on their own:</b>";else{ne=qqc.T("Log in")+" – "+qqc.T("or register for a free trial");h=qqc.T("Please")+" <a href=\"javascript: qwiz_qcards_common.pay_unlock_menu_display_login ('"+o+"', "+p+", '', '"+ne+'\')" class="qwiz_login">'+qqc.T("log in or register")+"</a> for a "+qqc.number_to_word(L)+"-day free trial of ",h+=L==m?qqc.T("quizzes on this site."):qqc.T("this quiz/deck."),q=qqc.T("After your free trial:")}qqc.set_qwizdeckdata(o,p,"n_preview_questions",H),ke.css({display:"none"}),ze.css({display:"block",filter:""})}var xe=set_pay_unlock_menu(o,p,g,h,q,I,Z,ue,pe);if("qwiz_"==o){var Te=$("div#summary-qwiz"+p+" span.unpaid_msg");Te.length&&("paid"==qwiz_.get_qwizdata(p,"pay_quiz_ok")?Te.hide():Te.show());var Se=$("div#summary-qwiz"+p+" span.unpaid_msg_payment_type");if(Se.length)if("paid"!=qwiz_.get_qwizdata(p,"pay_quiz_ok"))if((S=qwiz_.get_qwizdata(p,"taker_unpaid_msgs")).length){var je=Math.floor(Math.random()*S.length);Se.html(S[je])}}}xe&&check_maker_session_id();const Ce=set_display_pay_screen(o,p);if(Ce||e.msg){$("div.qwiz-progress-container.qwiz"+p).show();ne=e.msg?e.msg:"";const t=qqc.$get_login_div(o,p);if(document_qwiz_user_logged_in_b)if("free_trial"==Ce){const e=qqc.set_immediate_payment(o,p);ne="<br /><br />";if(e){const e=(new Date).getTime()/1e3;Date.parse(document_qwiz_good_through_date+"T00:00:00Z")/1e3>e+1209600?(ne+="<i>Thanks for using Learn-Biology.com!</i>",t.append(ne).show()):a.hide_menu_and_display_login(p,!1,"free_trial")}else document_qwiz_good_through_date_ok?(ne+="<i>Thanks for using Learn-Biology.com!</i>",t.append(ne).show()):document_qwiz_good_through_date?(ne+="<i>Sorry; a free trial subscription is not available to existing users</i>",t.html(ne).show()):a.hide_menu_and_display_login(p,!1,"paypal_subscription")}else if("special_offer"==Ce)document_qwiz_good_through_date>"2024-03-26"?(ne="<br />\n <br />\n <i>Sorry; special offer not available</i>\n ",t.append(ne).show()):a.hide_menu_and_display_login(p,!1,"free_trial");else if("login"==Ce)$(`#qwiz${p}-q0`).html(' <br />\n <p class="qwiz-center qwiz-bold">\n You are currently logged in.\n </p>\n <p>\n If you want to log in as a different user, hover on the green down-triangle (above right) and click "Sign out".\n </p>\n ');else if("open_register"==Ce)ne||(ne="<br />\n <b>You are currently logged in.</b>\n <br />\n <i>If you want to create a new account hover over the green down-triangle to sign out.</i>\n "),t.append(ne).show();else{/register/.test(Ce)&&qqc.check_session_id(p,!0);setTimeout(function(){void 0===document_qwiz_university_discount&&"paid"!=qwiz_.get_qwizdata(p,"pay_quiz_ok")?a.hide_menu_and_display_login(p,!1,"register",ne):register_taker_global_reg_code_ok_f||a.hide_menu_and_display_login(p,!1,"pay",ne,!0,"Pay now")},500)}else if("register"==Ce||"open_register"==Ce||"subscribe"==Ce||"signup"==Ce){var Ae="register";"open_register"==Ce&&(Ae="open_register"),a.hide_menu_and_display_login(p,!1,Ae,ne,!1)}else"free_trial"==Ce?a.hide_menu_and_display_login(p,!1,"free_trial"):"special_offer"==Ce?(ne="Please log in (black down-triangle above right)",t.append(ne).show()):"login"==Ce?a.hide_menu_and_display_login(p,!1,""):(ne="Please log in or register so you can get credited for your payment",qqc.pay_unlock_menu_display_login(o,p,"",ne));$("div#mode-qwiz"+p).hide(),$("div.lock_unlock.qwiz"+p).hide(),$("div#qwiz_login-qwiz"+p+" button.qwiz_pay_cancel").hide(),$("div#qwiz_login-qwiz"+p+" .qwiz_login_cancel_no_thanks").hide(),$("div#next_button-qwiz"+p+" button").hide()}},this.set_qwizdeckdata=function(e,t,s,i){"qwiz_"==e?qwiz_.set_qwizdata(t,s,i):qcard_.set_deckdata(t,s,i)},this.find_opening_tags_at_end=function(e){var t=e.match(/(\s*(<[^/][^>]*>\s*)*)$/);debug[10]&&(console.log("[find_opening_tags_at_end] htm:",e),console.log("[find_opening_tags_at_end] all_opening_tags_match:",t));var s="";if(t&&void 0!==t[1]){var i=t[1],a=i.match(/\s*(<[^/][^>]*>\s*)|([^<]*$)/g);if(debug[10]&&(console.log("[find_opening_tags_at_end] all_opening_tags:",i),console.log("[find_opening_tags_at_end] opening_tags_match:",a)),a){for(var r=[],o=a.length-1;o>=0;o--){var n=a[o];if(""!=n){if("<"!=n[0]&&!/\s/.test(n[0]))break;var _=n.replace(/\s/g,"").substr(0,4);if("<br>"==_)break;if("<img"==_||"<inp"==_)break;r.unshift(n)}}s=r.join("")}}return debug[10]&&console.log("[find_opening_tags_at_end] opening_tags:",s),s},this.parse_html_block=function(e,t,s,i){debug[10]&&console.log("[parse_html_block] shortcodes: ",t,", htm: ",e);var a,r="string"==typeof i,o=0,n="";if("^"!=t[0]){var _=parse_html_block_pattern(t),c=new RegExp(_),d=e.search(c);if(-1==d)return debug[10]&&console.log("[parse_html_block] html_block: NA"),"NA";o=3;var l=e.substr(0,d);n=qqc.find_opening_tags_at_end(l)}var u=-1;if(s.length){_=parse_html_block_pattern(s);c=new RegExp(_),u=e.substr(d+o).search(c)}if(-1==u)a=n+e.substr(d);else if(0==u)a="";else{var p,g,h=e.substr(d,o+u);if(""!=(p=qqc.find_opening_tags_at_end(h)))c=new RegExp(p+"$"),g=h.replace(c,"");else g=h;if(""!=(a=n+g)){var q=g.replace(/<[^>]+>/gm,"");null!=i&&(q=q.replace(/ | |<br[^>]*>/gm,""));var m=-1==q.search(/\S/);m&&(r||(a=""))}}return r&&!m&&(a=""),debug[10]&&console.log("[parse_html_block] html_block:",a),a},this.find_matching_block=function(e){for(var t="",s=e.length,i=0,a=0,r=[],o=!1;i<s;){if("<"==e[i]){if("<br>"==e.substr(i,4)||"<hr>"==e.substr(i,4)){i+=3;continue}if("\x3c!--"==e.substr(i,4)){i+=4;continue}if("<img"==e.substr(i,4)||"<input"==e.substr(i,6)||"<br"==e.substr(i,3)||"<hr"==e.substr(i,3)){for(i+=3;i<s&&">"!=e[++i];);continue}if("<p"==e.substr(i,2)){if(o){i++;continue}o=!0}if("/"==e[++i]){"/div"==e.substr(i,4)?o&&(a--,o=!1):"/p"==e.substr(i,2)&&(o=!1),a--,i++;for(var n="";i<s&&">"!=e[i];)n+=e[i],i++;if(debug[5]&&console.log("[find_matching_block] i_level: ",a,", closing_tag:",n,", tags:",r.slice(0,a+1)),n!=r[a]&&(debug[5]&&console.log("XXX"),a++),a<=0){for(t=e.substring(0,i);i<s&&">"!=e[i];)t+=e[i];t+=">";break}}else{for(var _="";i<s&&">"!=e[i]&&!/\s/.test(e[i]);)_+=e[i],i++;r[a]=_,debug[5]&&(console.log("[find_matching_block] (new_level) tag_i_level:",_,", (followed by): ",e.substr(i+1,30)),console.log("[find_matching_block] tags:",r.slice(0,a+1))),a++}}else"/"==e[i]&&">"==e[++i]&&a--;i++}return debug[5]&&console.log("[find_matching_block] htm_block:",t),t},this.select_placeholder=function(e){debug[0]&&console.log("[select_placeholder] $edit_field:",e);var t=e.find("span.qwizard_placeholder");if(0!=t.length){document_qwiz_bubblebar_enabled_b=!1,setTimeout(function(){t[0];var s,i=e.attr("id");if(i&&(s=tinyMCE.get(i),debug[0]&&console.log("[select_placeholder] ed:",s),!s)){setTimeout(function(){s=tinyMCE.get(i),debug[0]&&console.log("[select_placeholder > delay_get ] ed:",s)},500)}if(s&&s.selection&&s.dom.select("span")&&s.selection.select(s.dom.select("span")[0]),i&&"qcard"==i.substr(0,5)){qcard_.qwizard_b||e.off("keydown").off("click");var a="span"==e[0].tagName.toLowerCase();e.on("click keydown",function(t){qwizard.remove_placeholder(t,e,a)})}setTimeout("document_qwiz_bubblebar_enabled_b = true",200)},500)}else debug[0]&&console.log("[select_placeholder] $placeholder.length: 0")},this.check_pairs=function(e,t,s){for(var i="",a=0,r=0;opening_pos=s.indexOf(e,a),closing_pos=s.indexOf(t,r),-1!=opening_pos||-1!=closing_pos;){if(i="ok",closing_pos<=opening_pos||-1==opening_pos||opening_pos<r){i="Mis-matched pairs for "+e+"..."+t;break}a=opening_pos+1,r=closing_pos+1}return i},this.qdebug=function(e){if(/qdebug=/.test(document.location.search)){e[0]=!0;let t=decodeURIComponent(document.location.search).match(/qdebug=([\d,]+)/)[1];if(t){t=t.split(",");for(const s of t){e[parseInt(s)]=!0}}}},this.hex_to_rgb=function(e){const t=e.substr(0,2),s=e.substr(2,2),i=e.substr(4,2);return[parseInt(t,16),parseInt(s,16),parseInt(i,16)]},this.decodeHtmlEntities=function(e){var t=document.createElement("textarea");return t.innerHTML=e,t.value},this.encodeHtmlEntities=function(e){for(var t=[],s=e.length-1;s>=0;s--)t.unshift(["&#",e[s].charCodeAt(),";"].join(""));return t.join("")},this.addSlashes=function(e){return(e+"").replace(/[\\"']/g,"\\$&").replace(/\n/g,"\\n").replace(/\u0000/g,"\\0")},this.decode_image_tags=function(e){return e=e.replace(/<input[^>]+?name="qwiz_img"/g,"<img")},this.shortcodes_to_video_elements=function(e){if(e=e.replace(/\[audio(.*?)(src|mp3|m4a|ogg|wav|wma|mp4|m4v|webm|ogv|wmv|flv)([^\]]*)\]/g,'<video controls$1src$3 data-audio_video="audio" height="30" width="280"></video>').replace(/\[video(.*?)(src|mp3|m4a|ogg|wav|wma|mp4|m4v|webm|ogv|wmv|flv)([^\]]*)\]/g,'<video controls$1src$3 data-audio_video="video"></video>'),qwizzled.wp_editing_page_f){var t=e.match(/\[embed\][^\[]+\[\/embed\]/g);if(t){for(var s=[],i=[],a=t.length,r=0;r<a;r++)s.push(t[r].replace(/\[\/{0,1}embed\]/g,"")),i.push({width:500});"not ready"==qwiz_ajaxurl&&(qwiz_ajaxurl=qqc.get_qwiz_param("ajaxurl",""));var o={action:"process_embeds",urls:encodeURIComponent(JSON.stringify(s)),args:encodeURIComponent(JSON.stringify(i))};$.ajax({type:"POST",async:!1,url:qwiz_ajaxurl,data:o,success:function(s){for(var i=0;i<a;i++){var r=s[i].replace(">",' data-embed="true">');e=e.replace(t[i],r)}}})}}return debug[0]&&console.log("[shortcodes_to_video_elements] htm:",e),e},this.init_image_swap=function(e,t){var s=$(e),i=s.find("img");if(i.length){var a=i.attr("src"),r=$("img"),o=r.eq(r.index(i)-1),n=o.attr("src");o.removeAttr("srcset"),s.hasClass("hover")?o.attr("onmouseenter",`qwiz_qcards_common.img_swap (this, 'hover', '${a}')`).attr("onmouseleave",`this.src="${n}"`):(t&&o.click(function(e){e.stopPropagation()}),o.attr("onclick",`qwiz_qcards_common.img_swap (this, 'click', '${a}', '${n}')`).css({cursor:"pointer"})),s.removeClass("not_inited")}},this.img_swap=function(e,t,s,i){if(!e.style.width){var a=e.width,r=e.height;$(e).css({width:a+"px",height:r+"px"})}"hover"==t?e.src=s:e.qwiz_alt_img?(e.src=i,e.qwiz_alt_img=!1):(e.src=s,e.qwiz_alt_img=!0)},this.hhmmss_from_sec=function(e){var t=e%60;t<10&&(t="0"+t);var s=parseInt(e/60)%60,i=s+":"+t;if(e>=3600){s<10&&(s="0"+s);i=parseInt(e/3600)+":"+i}return i},this.isInteger=function(e){return(0^e)===e},this.bin2hex=function(e){var t,s,i,a="";for(t=0,s=(e+="").length;t<s;t++)a+=(i=e.charCodeAt(t).toString(16)).length<2?"0"+i:i;return a},$.fn.changeElements=function(e){return $(this).each(function(){var t={};$.each(this.attributes,function(e,s){t[s.nodeName]=s.nodeValue});var s=$("<"+e+"/>",t);$(this).replaceWith(s)}),$([])},this.metaphone=function(e,t){var s=typeof e;if("undefined"===s||"object"===s&&null!==e)return null;if("number"===s&&(isNaN(e)?e="NAN":isFinite(e)||(e="INF")),t<0)return!1;t=Math.floor(+t)||0;var i="ABCDEFGHIJKLMNOPQRSTUVWXYZ",a="AEIOU",r="EIY",o=new RegExp("^[^"+i+"]+");if(!(e=(e="string"==typeof e?e:"").toUpperCase().replace(o,"")))return"";var n,_,c=function(e,t){return""!==t&&-1!==e.indexOf(t)},d=0,l=e.charAt(0),u=e.charAt(1),p=e.length,g="";switch(l){case"A":g+="E"===u?u:l,d+=1;break;case"G":case"K":case"P":"N"===u&&(g+=u,d+=2);break;case"W":"R"===u?(g+=u,d+=2):("H"===u||c(a,u))&&(g+="W",d+=2);break;case"X":g+="S",d+=1;break;case"E":case"I":case"O":case"U":g+=l,d++}for(;d<p&&(0===t||g.length<t);d+=1)if(l=e.charAt(d),u=e.charAt(d+1),_=e.charAt(d-1),n=e.charAt(d+2),l!==_||"C"===l)switch(l){case"B":"M"!==_&&(g+=l);break;case"C":c(r,u)?"I"===u&&"A"===n?g+="X":"S"!==_&&(g+="S"):"H"===u?(g+="X",d+=1):g+="K";break;case"D":"G"===u&&c(r,n)?(g+="J",d+=1):g+="T";break;case"G":"H"===u?c("BDH",e.charAt(d-3))||"H"===e.charAt(d-4)||(g+="F",d+=1):"N"===u?c(i,n)&&"NED"!==e.substr(d+1,3)&&(g+="K"):c(r,u)&&"G"!==_?g+="J":g+="K";break;case"H":c(a,u)&&!c("CGPST",_)&&(g+=l);break;case"K":"C"!==_&&(g+="K");break;case"P":g+="H"===u?"F":l;break;case"Q":g+="K";break;case"S":"I"===u&&c("AO",n)?g+="X":"H"===u?(g+="X",d+=1):g+="S";break;case"T":"I"===u&&c("AO",n)?g+="X":"H"===u?(g+="0",d+=1):"CH"!==e.substr(d+1,2)&&(g+="T");break;case"V":g+="F";break;case"W":case"Y":c(a,u)&&(g+=l);break;case"X":g+="KS";break;case"Z":g+="S";break;case"F":case"J":case"L":case"M":case"N":case"R":g+=l}return g}};qwiz_qcards_common_f.call(qwiz_qcards_common), 2 2 /*! 3 3 * jQuery Cookie Plugin v1.4.1 … … 7 7 * Released under the MIT license 8 8 */ 9 function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?e(require("jquery")):e(jQuery)}( (function(e){var t=/\+/g;function s(e){return r.raw?e:encodeURIComponent(e)}function i(e){return s(r.json?JSON.stringify(e):String(e))}function a(s,i){var a=r.raw?s:function(e){0===e.indexOf('"')&&(e=e.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,"\\"));try{return e=decodeURIComponent(e.replace(t," ")),r.json?JSON.parse(e):e}catch(e){}}(s);return e.isFunction(i)?i(a):a}var r=e.cookie=function(t,o,n){if(void 0!==o&&!e.isFunction(o)){if("number"==typeof(n=e.extend({},r.defaults,n)).expires){var _=n.expires,c=new Date;c.setMilliseconds(c.getMilliseconds()+864e5*_)}const a=[s(t),"=",i(o),n.expires?";expires="+c.toUTCString():"",n.path?";path="+n.path:"",n.domain?";domain="+n.domain:"",n.secure?";secure":""].join("");return document.cookie=a}for(var d,l=t?void 0:{},u=document.cookie?document.cookie.split("; "):[],p=0,g=u.length;p<g;p++){var h=u[p].split("="),q=(d=h.shift(),r.raw?d:decodeURIComponent(d)),m=h.join("=");if(t&&t===q){l=a(m,o);break}t||void 0===(m=a(m))||(l[q]=m)}return l};r.defaults={},e.removeCookie=function(t,s){return void 0!==e.cookie(t)&&(e.cookie(t,"",e.extend({},s,{expires:-1})),!e.cookie(t))}}));var CryptoJS=CryptoJS||function(e,t){var s={},i=s.lib={},a=function(){},r=i.Base={extend:function(e){a.prototype=this;var t=new a;return e&&t.mixIn(e),t.hasOwnProperty("init")||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},o=i.WordArray=r.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||_).stringify(this)},concat:function(e){var t=this.words,s=e.words,i=this.sigBytes;if(e=e.sigBytes,this.clamp(),i%4)for(var a=0;a<e;a++)t[i+a>>>2]|=(s[a>>>2]>>>24-a%4*8&255)<<24-(i+a)%4*8;else if(65535<s.length)for(a=0;a<e;a+=4)t[i+a>>>2]=s[a>>>2];else t.push.apply(t,s);return this.sigBytes+=e,this},clamp:function(){var t=this.words,s=this.sigBytes;t[s>>>2]&=4294967295<<32-s%4*8,t.length=e.ceil(s/4)},clone:function(){var e=r.clone.call(this);return e.words=this.words.slice(0),e},random:function(t){for(var s=[],i=0;i<t;i+=4)s.push(4294967296*e.random()|0);return new o.init(s,t)}}),n=s.enc={},_=n.Hex={stringify:function(e){var t=e.words;e=e.sigBytes;for(var s=[],i=0;i<e;i++){var a=t[i>>>2]>>>24-i%4*8&255;s.push((a>>>4).toString(16)),s.push((15&a).toString(16))}return s.join("")},parse:function(e){for(var t=e.length,s=[],i=0;i<t;i+=2)s[i>>>3]|=parseInt(e.substr(i,2),16)<<24-i%8*4;return new o.init(s,t/2)}},c=n.Latin1={stringify:function(e){var t=e.words;e=e.sigBytes;for(var s=[],i=0;i<e;i++)s.push(String.fromCharCode(t[i>>>2]>>>24-i%4*8&255));return s.join("")},parse:function(e){for(var t=e.length,s=[],i=0;i<t;i++)s[i>>>2]|=(255&e.charCodeAt(i))<<24-i%4*8;return new o.init(s,t)}},d=n.Utf8={stringify:function(e){try{return decodeURIComponent(escape(c.stringify(e)))}catch(e){throw Error("Malformed UTF-8 data")}},parse:function(e){return c.parse(unescape(encodeURIComponent(e)))}},l=i.BufferedBlockAlgorithm=r.extend({reset:function(){this._data=new o.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=d.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var s=this._data,i=s.words,a=s.sigBytes,r=this.blockSize,n=a/(4*r);if(t=(n=t?e.ceil(n):e.max((0|n)-this._minBufferSize,0))*r,a=e.min(4*t,a),t){for(var _=0;_<t;_+=r)this._doProcessBlock(i,_);_=i.splice(0,t),s.sigBytes-=a}return new o.init(_,a)},clone:function(){var e=r.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0});i.Hasher=l.extend({cfg:r.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){l.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,s){return new e.init(s).finalize(t)}},_createHmacHelper:function(e){return function(t,s){return new u.HMAC.init(e,s).finalize(t)}}});var u=s.algo={};return s}(Math);!function(e){var t,s=(t=CryptoJS).lib,i=s.Base,a=s.WordArray;(t=t.x64={}).Word=i.extend({init:function(e,t){this.high=e,this.low=t}}),t.WordArray=i.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:8*e.length},toX32:function(){for(var e=this.words,t=e.length,s=[],i=0;i<t;i++){var r=e[i];s.push(r.high),s.push(r.low)}return a.create(s,this.sigBytes)},clone:function(){for(var e=i.clone.call(this),t=e.words=this.words.slice(0),s=t.length,a=0;a<s;a++)t[a]=t[a].clone();return e}})}(),function(e){for(var t=CryptoJS,s=(r=t.lib).WordArray,i=r.Hasher,a=t.x64.Word,r=t.algo,o=[],n=[],_=[],c=1,d=0,l=0;24>l;l++){o[c+5*d]=(l+1)*(l+2)/2%64;var u=(2*c+3*d)%5;c=d%5,d=u}for(c=0;5>c;c++)for(d=0;5>d;d++)n[c+5*d]=d+(2*c+3*d)%5*5;for(c=1,d=0;24>d;d++){for(var p=u=l=0;7>p;p++){if(1&c){var g=(1<<p)-1;32>g?u^=1<<g:l^=1<<g-32}c=128&c?c<<1^113:c<<1}_[d]=a.create(l,u)}var h=[];for(c=0;25>c;c++)h[c]=a.create();r=r.SHA3=i.extend({cfg:i.cfg.extend({outputLength:512}),_doReset:function(){for(var e=this._state=[],t=0;25>t;t++)e[t]=new a.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(e,t){for(var s=this._state,i=this.blockSize/2,a=0;a<i;a++){var r=16711935&((r=e[t+2*a])<<8|r>>>24)|4278255360&(r<<24|r>>>8),c=16711935&((c=e[t+2*a+1])<<8|c>>>24)|4278255360&(c<<24|c>>>8),d=s[a];d.high^=c,d.low^=r}for(i=0;24>i;i++){for(a=0;5>a;a++){for(var l=r=0,u=0;5>u;u++)r^=(d=s[a+5*u]).high,l^=d.low;(d=h[a]).high=r,d.low=l}for(a=0;5>a;a++)for(d=h[(a+4)%5],c=(r=h[(a+1)%5]).high,u=r.low,r=d.high^(c<<1|u>>>31),l=d.low^(u<<1|c>>>31),u=0;5>u;u++)(d=s[a+5*u]).high^=r,d.low^=l;for(c=1;25>c;c++)a=(d=s[c]).high,d=d.low,32>(u=o[c])?(r=a<<u|d>>>32-u,l=d<<u|a>>>32-u):(r=d<<u-32|a>>>64-u,l=a<<u-32|d>>>64-u),(d=h[n[c]]).high=r,d.low=l;for(d=h[0],a=s[0],d.high=a.high,d.low=a.low,a=0;5>a;a++)for(u=0;5>u;u++)d=s[c=a+5*u],r=h[c],c=h[(a+1)%5+5*u],l=h[(a+2)%5+5*u],d.high=r.high^~c.high&l.high,d.low=r.low^~c.low&l.low;d=s[0],a=_[i],d.high^=a.high,d.low^=a.low}},_doFinalize:function(){var t=(r=this._data).words,i=8*r.sigBytes,a=32*this.blockSize;t[i>>>5]|=1<<24-i%32,t[(e.ceil((i+1)/a)*a>>>5)-1]|=128,r.sigBytes=4*t.length,this._process();for(var r=this._state,o=(i=(t=this.cfg.outputLength/8)/8,a=[],0);o<i;o++){var n=16711935&((n=(_=r[o]).high)<<8|n>>>24)|4278255360&(n<<24|n>>>8),_=16711935&((_=_.low)<<8|_>>>24)|4278255360&(_<<24|_>>>8);a.push(_),a.push(n)}return new s.init(a,t)},clone:function(){for(var e=i.clone.call(this),t=e._state=this._state.slice(0),s=0;25>s;s++)t[s]=t[s].clone();return e}}),t.SHA3=i._createHelper(r),t.HmacSHA3=i._createHmacHelper(r)}(Math);var DateFormat={};!function(e){var t=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],s=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],i=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],a=["January","February","March","April","May","June","July","August","September","October","November","December"],r={Jan:"01",Feb:"02",Mar:"03",Apr:"04",May:"05",Jun:"06",Jul:"07",Aug:"08",Sep:"09",Oct:"10",Nov:"11",Dec:"12"},o=/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.?\d{0,3}[Z\-+]?(\d{2}:?\d{2})?/;DateFormat.format=function(){function e(e){return t[parseInt(e,10)]||e}function n(e){return s[parseInt(e,10)]||e}function _(e){var t=parseInt(e,10)-1;return i[t]||e}function c(e){var t=parseInt(e,10)-1;return a[t]||e}function d(e){return r[e]||e}function l(e){var t,s,i,a,r,o=e,n="";return-1!==o.indexOf(".")&&(a=o.split("."),o=a[0],n=a[1]),3===(r=o.split(":")).length?(t=r[0],s=r[1],i=r[2].replace(/\s.+/,"").replace(/[a-z]/gi,""),{time:o=o.replace(/\s.+/,"").replace(/[a-z]/gi,""),hour:t,minute:s,second:i,millis:n}):{time:"",hour:"",minute:"",second:"",millis:""}}function u(e,t){for(var s=t-String(e).length,i=0;i<s;i++)e="0"+e;return e}return{parseDate:function(e){var t={date:null,year:null,month:null,dayOfMonth:null,dayOfWeek:null,time:null};if("number"==typeof e)return this.parseDate(new Date(e));if("function"==typeof e.getFullYear)t.year=String(e.getFullYear()),t.month=String(e.getMonth()+1),t.dayOfMonth=String(e.getDate()),t.time=l(e.toTimeString()+"."+e.getMilliseconds());else if(-1!=e.search(o))values=e.split(/[T\+-]/),t.year=values[0],t.month=values[1],t.dayOfMonth=values[2],t.time=l(values[3].split(".")[0]);else switch(values=e.split(" "),6===values.length&&isNaN(values[5])&&(values[values.length]="()"),values.length){case 6:t.year=values[5],t.month=d(values[1]),t.dayOfMonth=values[2],t.time=l(values[3]);break;case 2:subValues=values[0].split("-"),t.year=subValues[0],t.month=subValues[1],t.dayOfMonth=subValues[2],t.time=l(values[1]);break;case 7:case 9:case 10:t.year=values[3],t.month=d(values[1]),t.dayOfMonth=values[2],t.time=l(values[4]);break;case 1:subValues=values[0].split(""),t.year=subValues[0]+subValues[1]+subValues[2]+subValues[3],t.month=subValues[5]+subValues[6],t.dayOfMonth=subValues[8]+subValues[9],t.time=l(subValues[13]+subValues[14]+subValues[15]+subValues[16]+subValues[17]+subValues[18]+subValues[19]+subValues[20]);break;default:return null}return t.time?t.date=new Date(t.year,t.month-1,t.dayOfMonth,t.time.hour,t.time.minute,t.time.second,t.time.millis):t.date=new Date(t.year,t.month-1,t.dayOfMonth),t.dayOfWeek=String(t.date.getDay()),t},date:function(t,s){try{var i=this.parseDate(t);if(null===i)return t;i.date;for(var a=i.year,r=i.month,o=i.dayOfMonth,d=i.dayOfWeek,l=i.time,p="",g="",h="",q=!1,m=0;m<s.length;m++){var f=s.charAt(m),w=s.charAt(m+1);if(q)"'"==f?(g+=""===p?"'":p,p="",q=!1):p+=f;else switch(h="",p+=f){case"ddd":g+=e(d),p="";break;case"dd":if("d"===w)break;g+=u(o,2),p="";break;case"d":if("d"===w)break;g+=parseInt(o,10),p="";break;case"D":g+=o=1==o||21==o||31==o?parseInt(o,10)+"st":2==o||22==o?parseInt(o,10)+"nd":3==o||23==o?parseInt(o,10)+"rd":parseInt(o,10)+"th",p="";break;case"MMMM":g+=c(r),p="";break;case"MMM":if("M"===w)break;g+=_(r),p="";break;case"MM":if("M"===w)break;g+=u(r,2),p="";break;case"M":if("M"===w)break;g+=parseInt(r,10),p="";break;case"y":case"yyy":if("y"===w)break;g+=p,p="";break;case"yy":if("y"===w)break;g+=String(a).slice(-2),p="";break;case"yyyy":g+=a,p="";break;case"HH":g+=u(l.hour,2),p="";break;case"H":if("H"===w)break;g+=parseInt(l.hour,10),p="";break;case"hh":hour=0===parseInt(l.hour,10)?12:l.hour<13?l.hour:l.hour-12,g+=u(hour,2),p="";break;case"h":if("h"===w)break;hour=0===parseInt(l.hour,10)?12:l.hour<13?l.hour:l.hour-12,g+=parseInt(hour,10),p="";break;case"mm":g+=u(l.minute,2),p="";break;case"m":if("m"===w)break;g+=l.minute,p="";break;case"ss":g+=u(l.second.substring(0,2),2),p="";break;case"s":if("s"===w)break;g+=l.second,p="";break;case"S":case"SS":if("S"===w)break;g+=p,p="";break;case"SSS":g+=l.millis.substring(0,3),p="";break;case"a":g+=l.hour>=12?"PM":"AM",p="";break;case"p":g+=l.hour>=12?"p.m.":"a.m.",p="";break;case"E":g+=n(d),p="";break;case"'":p="",q=!0;break;default:g+=f,p=""}}return g+=h}catch(e){return console&&console.log&&console.log(e),t}},toBrowserTimeZone:function(e,t){return this.date(new Date(e),t||"MM/dd/yyyy HH:mm:ss")}}}()}(),function(){"use strict";var e="object"==typeof window?window:{};!e.JS_CRC_NO_NODE_JS&&"object"==typeof process&&process.versions&&process.versions.node&&(e=global);var t,s,i,a,r=!e.JS_CRC_NO_COMMON_JS&&"object"==typeof module&&module.exports,o="function"==typeof define&&define.amd,n=!e.JS_CRC_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,_="0123456789abcdef".split(""),c=[{name:"qwiz_crc32",polynom:3988292384,initValue:-1,bytes:4},{name:"qwiz_crc16",polynom:40961,initValue:0,bytes:2}];for(t=0;t<c.length;++t){for((u=c[t]).method=function(e){return function(t){return d(t,e)}}(u),u.table=[],s=0;256>s;++s){for(a=s,i=0;8>i;++i)a=1&a?u.polynom^a>>>1:a>>>1;u.table[s]=a>>>0}}var d=function(e,t){var s="string"!=typeof e;s&&n&&e instanceof ArrayBuffer&&(e=new Uint8Array(e));var i,a,r=t.initValue,o=e.length,c=t.table;if(s)for(a=0;o>a;++a)r=c[255&(r^e[a])]^r>>>8;else for(a=0;o>a;++a)128>(i=e.charCodeAt(a))?r=c[255&(r^i)]^r>>>8:2048>i?r=c[255&((r=c[255&(r^(192|i>>6))]^r>>>8)^(128|63&i))]^r>>>8:55296>i||i>=57344?r=c[255&((r=c[255&((r=c[255&(r^(224|i>>12))]^r>>>8)^(128|i>>6&63))]^r>>>8)^(128|63&i))]^r>>>8:r=c[255&((r=c[255&((r=c[255&((r=c[255&(r^(240|(i=65536+((1023&i)<<10|1023&e.charCodeAt(++a)))>>18))]^r>>>8)^(128|i>>12&63))]^r>>>8)^(128|i>>6&63))]^r>>>8)^(128|63&i))]^r>>>8;r^=t.initValue;var d="";return t.bytes>2&&(d+=_[r>>28&15]+_[r>>24&15]+_[r>>20&15]+_[r>>16&15]),d+(_[r>>12&15]+_[r>>8&15]+_[r>>4&15]+_[15&r])},l={};for(t=0;t<c.length;++t){l[(u=c[t]).name]=u.method}if(r)module.exports=l;else{for(t=0;t<c.length;++t){var u;e[(u=c[t]).name]=u.method}o&&define((function(){return l}))}}(),function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?e(require("jquery")):e(jQuery)}((function(e,t){var s="plugin_hideShowPassword",i=["show","innerToggle"],a=function(){var e=document.body,t=document.createElement("input"),s=!0;e||(e=document.createElement("body")),t=e.appendChild(t);try{t.setAttribute("type","text")}catch(e){s=!1}return e.removeChild(t),s}();function r(t,s){this.element=e(t),this.wrapperElement=e(),this.toggleElement=e(),this.init(s)}r.prototype={init:function(t){this.update(t,e.fn.hideShowPassword.defaults)&&(this.element.addClass(this.options.className),this.options.innerToggle&&(this.wrapElement(this.options.wrapper),this.initToggle(this.options.toggle),"string"==typeof this.options.innerToggle&&(this.toggleElement.hide(),this.element.one(this.options.innerToggle,e.proxy((function(){this.toggleElement.show()}),this)))),this.element.trigger(this.options.initEvent,[this]))},update:function(e,t){return this.options=this.prepareOptions(e,t),this.updateElement()&&this.element.trigger(this.options.changeEvent,[this]).trigger(this.state().changeEvent,[this]),this.options.enable},toggle:function(e){return e=e||"toggle",this.update({show:e})},prepareOptions:function(t,s){var i,a=t||{},r=[];if(s=s||this.options,t=e.extend(!0,{},s,t),a.hasOwnProperty("wrapper")&&a.wrapper.hasOwnProperty("inheritStyles")&&(t.wrapper.inheritStyles=a.wrapper.inheritStyles),t.enable&&("toggle"===t.show?t.show=this.isType("hidden",t.states):"infer"===t.show&&(t.show=this.isType("shown",t.states)),"infer"===t.toggle.position&&(t.toggle.position="rtl"===this.element.css("text-direction")?"left":"right"),!e.isArray(t.toggle.attachToKeyCodes))){if(!0===t.toggle.attachToKeyCodes)switch((i=e(t.toggle.element)).prop("tagName").toLowerCase()){case"button":case"input":break;case"a":if(i.filter("[href]").length){r.push(32);break}default:r.push(32,13)}t.toggle.attachToKeyCodes=r}return t},updateElement:function(){return!(!this.options.enable||this.isType())&&(this.element.prop(e.extend({},this.options.props,this.state().props)).addClass(this.state().className).removeClass(this.otherState().className),this.options.triggerOnToggle&&this.element.trigger(this.options.triggerOnToggle,[this]),this.updateToggle(),!0)},isType:function(e,s){return(s=s||this.options.states)[e=e||this.state(t,t,s).props.type]&&(e=s[e].props.type),this.element.prop("type")===e},state:function(e,s,i){return i=i||this.options.states,e===t&&(e=this.options.show),"boolean"==typeof e&&(e=e?"shown":"hidden"),s&&(e="shown"===e?"hidden":"shown"),i[e]},otherState:function(e){return this.state(e,!0)},wrapElement:function(t){var s,i=t.enforceWidth;return this.wrapperElement.length||(s=this.element.outerWidth(),e.each(t.inheritStyles,e.proxy((function(e,s){t.styles[s]=this.element.css(s)}),this)),this.element.css(t.innerElementStyles).wrap(e(t.element).addClass(t.className).css(t.styles)),this.wrapperElement=this.element.parent(),!0===i&&(i=this.wrapperElement.outerWidth()!==s&&s),!1!==i&&this.wrapperElement.css("width",i)),this.wrapperElement},initToggle:function(t){return this.toggleElement.length||(this.toggleElement=e(t.element).attr(t.attr).addClass(t.className).css(t.styles).appendTo(this.wrapperElement),this.updateToggle(),this.positionToggle(t.position,t.verticalAlign,t.offset),t.touchSupport?(this.toggleElement.css(t.touchStyles),this.element.on(t.attachToTouchEvent,e.proxy(this.toggleTouchEvent,this))):this.toggleElement.on(t.attachToEvent,e.proxy(this.toggleEvent,this)),t.attachToKeyCodes.length&&this.toggleElement.on(t.attachToKeyEvent,e.proxy(this.toggleKeyEvent,this))),this.toggleElement},positionToggle:function(e,t,s){var i={};switch(i[e]=s,t){case"top":case"bottom":i[t]=s;break;case"middle":i.top="50%",i.marginTop=this.toggleElement.outerHeight()/-2}return this.toggleElement.css(i)},updateToggle:function(e,t){var s,i;return this.toggleElement.length&&(s="padding-"+this.options.toggle.position,e=e||this.state().toggle,t=t||this.otherState().toggle,this.toggleElement.attr(e.attr).addClass(e.className).removeClass(t.className).html(e.content),i=this.toggleElement.outerWidth()+2*this.options.toggle.offset,this.element.css(s)!==i&&this.element.css(s,i)),this.toggleElement},toggleEvent:function(e){e.preventDefault(),this.toggle()},toggleKeyEvent:function(t){e.each(this.options.toggle.attachToKeyCodes,e.proxy((function(e,s){if(t.which===s)return this.toggleEvent(t),!1}),this))},toggleTouchEvent:function(e){var t,s,i,a=this.toggleElement.offset().left;a&&(t=e.pageX||e.originalEvent.pageX,"left"===this.options.toggle.position?(s=t,i=a+=this.toggleElement.outerWidth()):(s=a,i=t),i>=s&&this.toggleEvent(e))}},e.fn.hideShowPassword=function(){var t={};return e.each(arguments,(function(s,a){var r={};if("object"==typeof a)r=a;else{if(!i[s])return!1;r[i[s]]=a}e.extend(!0,t,r)})),this.each((function(){var i=e(this),a=i.data(s);a?a.update(t):i.data(s,new r(this,t))}))},e.each({show:!0,hide:!1,toggle:"toggle"},(function(t,s){e.fn[t+"Password"]=function(e,t){return this.hideShowPassword(s,e,t)}})),e.fn.hideShowPassword.defaults={show:"infer",innerToggle:!1,enable:a,triggerOnToggle:!1,className:"hideShowPassword-field",initEvent:"hideShowPasswordInit",changeEvent:"passwordVisibilityChange",props:{autocapitalize:"off",autocomplete:"off",autocorrect:"off",spellcheck:"false"},toggle:{element:'<button type="button">',className:"hideShowPassword-toggle",touchSupport:"undefined"!=typeof Modernizr&&Modernizr.touchevents,attachToEvent:"click.hideShowPassword",attachToTouchEvent:"touchstart.hideShowPassword mousedown.hideShowPassword",attachToKeyEvent:"keyup",attachToKeyCodes:!0,styles:{position:"absolute"},touchStyles:{pointerEvents:"none"},position:"infer",verticalAlign:"middle",offset:0,attr:{tabindex:"-1",role:"button","aria-label":"Show password",title:"Show password",tabIndex:0}},wrapper:{element:"<div>",className:"hideShowPassword-wrapper",enforceWidth:!0,styles:{position:"relative"},inheritStyles:["display","verticalAlign","marginTop","marginRight","marginBottom","marginLeft"],innerElementStyles:{marginTop:0,marginRight:0,marginBottom:0,marginLeft:0}},states:{shown:{className:"hideShowPassword-shown",changeEvent:"passwordShown",props:{type:"text"},toggle:{className:"hideShowPassword-toggle-hide",content:"Hide",attr:{tabindex:"-1","aria-pressed":"true",title:"Hide password"}}},hidden:{className:"hideShowPassword-hidden",changeEvent:"passwordHidden",props:{type:"password"},toggle:{className:"hideShowPassword-toggle-show",content:"Show",attr:{tabindex:"-1","aria-pressed":"false",title:"Show password"}}}}}})),function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"==typeof window?"undefined"==typeof global?"undefined"==typeof self?this:self:global:window).base64js=e()}}((function(){return function e(t,s,i){function a(o,n){if(!s[o]){if(!t[o]){var _="function"==typeof require&&require;if(!n&&_)return _(o,!0);if(r)return r(o,!0);var c=new Error("Cannot find module '"+o+"'");throw c.code="MODULE_NOT_FOUND",c}var d=s[o]={exports:{}};t[o][0].call(d.exports,(function(e){return a(t[o][1][e]||e)}),d,d.exports,e,t,s,i)}return s[o].exports}for(var r="function"==typeof require&&require,o=0;o<i.length;o++)a(i[o]);return a}({"/":[function(e,t,s){"use strict";function i(e){var t=e.length;if(0<t%4)throw new Error("Invalid string. Length must be a multiple of 4");var s=e.indexOf("=");return-1===s&&(s=t),[s,s===t?0:4-s%4]}function a(e){return o[63&e>>18]+o[63&e>>12]+o[63&e>>6]+o[63&e]}function r(e,t,s){for(var i,r=[],o=t;o<s;o+=3)i=(16711680&e[o]<<16)+(65280&e[o+1]<<8)+(255&e[o+2]),r.push(a(i));return r.join("")}s.byteLength=function(e){var t=i(e),s=t[0],a=t[1];return 3*(s+a)/4-a},s.toByteArray=function(e){var t,s,a=i(e),r=a[0],o=a[1],c=new _(function(e,t,s){return 3*(t+s)/4-s}(0,r,o)),d=0,l=0<o?r-4:r;for(s=0;s<l;s+=4)t=n[e.charCodeAt(s)]<<18|n[e.charCodeAt(s+1)]<<12|n[e.charCodeAt(s+2)]<<6|n[e.charCodeAt(s+3)],c[d++]=255&t>>16,c[d++]=255&t>>8,c[d++]=255&t;return 2===o&&(t=n[e.charCodeAt(s)]<<2|n[e.charCodeAt(s+1)]>>4,c[d++]=255&t),1===o&&(t=n[e.charCodeAt(s)]<<10|n[e.charCodeAt(s+1)]<<4|n[e.charCodeAt(s+2)]>>2,c[d++]=255&t>>8,c[d++]=255&t),c},s.fromByteArray=function(e){for(var t,s=e.length,i=s%3,a=[],n=16383,_=0,c=s-i;_<c;_+=n)a.push(r(e,_,_+n>c?c:_+n));return 1===i?(t=e[s-1],a.push(o[t>>2]+o[63&t<<4]+"==")):2===i&&(t=(e[s-2]<<8)+e[s-1],a.push(o[t>>10]+o[63&t>>4]+o[63&t<<2]+"=")),a.join("")};for(var o=[],n=[],_="undefined"==typeof Uint8Array?Array:Uint8Array,c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",d=0,l=c.length;d<l;++d)o[d]=c[d],n[c.charCodeAt(d)]=d;n[45]=62,n[95]=63},{}]},{},[])("/")}));var Base64={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode:function(e){var t,s,i,a,r,o,n,_="",c=0;for(e=Base64._utf8_encode(e);c<e.length;)a=(t=e.charCodeAt(c++))>>2,r=(3&t)<<4|(s=e.charCodeAt(c++))>>4,o=(15&s)<<2|(i=e.charCodeAt(c++))>>6,n=63&i,isNaN(s)?o=n=64:isNaN(i)&&(n=64),_=_+this._keyStr.charAt(a)+this._keyStr.charAt(r)+this._keyStr.charAt(o)+this._keyStr.charAt(n);return _},decode:function(e){var t,s,i,a,r,o,n="",_=0;for(e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");_<e.length;)t=this._keyStr.indexOf(e.charAt(_++))<<2|(a=this._keyStr.indexOf(e.charAt(_++)))>>4,s=(15&a)<<4|(r=this._keyStr.indexOf(e.charAt(_++)))>>2,i=(3&r)<<6|(o=this._keyStr.indexOf(e.charAt(_++))),n+=String.fromCharCode(t),64!=r&&(n+=String.fromCharCode(s)),64!=o&&(n+=String.fromCharCode(i));return n=Base64._utf8_decode(n)},_utf8_encode:function(e){var t="";e=e.replace(/\r\n/g,"\n");for(var s=0;s<e.length;s++){var i=e.charCodeAt(s);i<128?t+=String.fromCharCode(i):i>127&&i<2048?(t+=String.fromCharCode(i>>6|192),t+=String.fromCharCode(63&i|128)):(t+=String.fromCharCode(i>>12|224),t+=String.fromCharCode(i>>6&63|128),t+=String.fromCharCode(63&i|128))}return t},_utf8_decode:function(e){var t,s,i,a="",r=0;for(t=s=0;r<e.length;)(t=e.charCodeAt(r))<128?(a+=String.fromCharCode(t),r++):t>191&&t<224?(s=e.charCodeAt(r+1),a+=String.fromCharCode((31&t)<<6|63&s),r+=2):(s=e.charCodeAt(r+1),i=e.charCodeAt(r+2),a+=String.fromCharCode((15&t)<<12|(63&s)<<6|63&i),r+=3);return a}};9 function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?e(require("jquery")):e(jQuery)}(function(e){var t=/\+/g;function s(e){return o.raw?e:encodeURIComponent(e)}function i(e){return o.raw?e:decodeURIComponent(e)}function a(e){return s(o.json?JSON.stringify(e):String(e))}function r(s,i){var a=o.raw?s:function(e){0===e.indexOf('"')&&(e=e.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,"\\"));try{return e=decodeURIComponent(e.replace(t," ")),o.json?JSON.parse(e):e}catch(e){}}(s);return e.isFunction(i)?i(a):a}var o=e.cookie=function(t,n,_){if(void 0!==n&&!e.isFunction(n)){if("number"==typeof(_=e.extend({},o.defaults,_)).expires){var c=_.expires,d=new Date;d.setMilliseconds(d.getMilliseconds()+864e5*c)}const i=[s(t),"=",a(n),_.expires?";expires="+d.toUTCString():"",_.path?";path="+_.path:"",_.domain?";domain="+_.domain:"",_.secure?";secure":""].join("");return document.cookie=i}for(var l=t?void 0:{},u=document.cookie?document.cookie.split("; "):[],p=0,g=u.length;p<g;p++){var h=u[p].split("="),q=i(h.shift()),m=h.join("=");if(t&&t===q){l=r(m,n);break}t||void 0===(m=r(m))||(l[q]=m)}return l};o.defaults={},e.removeCookie=function(t,s){return void 0!==e.cookie(t)&&(e.cookie(t,"",e.extend({},s,{expires:-1})),!e.cookie(t))}});var CryptoJS=CryptoJS||function(e,t){var s={},i=s.lib={},a=function(){},r=i.Base={extend:function(e){a.prototype=this;var t=new a;return e&&t.mixIn(e),t.hasOwnProperty("init")||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},o=i.WordArray=r.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||_).stringify(this)},concat:function(e){var t=this.words,s=e.words,i=this.sigBytes;if(e=e.sigBytes,this.clamp(),i%4)for(var a=0;a<e;a++)t[i+a>>>2]|=(s[a>>>2]>>>24-a%4*8&255)<<24-(i+a)%4*8;else if(65535<s.length)for(a=0;a<e;a+=4)t[i+a>>>2]=s[a>>>2];else t.push.apply(t,s);return this.sigBytes+=e,this},clamp:function(){var t=this.words,s=this.sigBytes;t[s>>>2]&=4294967295<<32-s%4*8,t.length=e.ceil(s/4)},clone:function(){var e=r.clone.call(this);return e.words=this.words.slice(0),e},random:function(t){for(var s=[],i=0;i<t;i+=4)s.push(4294967296*e.random()|0);return new o.init(s,t)}}),n=s.enc={},_=n.Hex={stringify:function(e){var t=e.words;e=e.sigBytes;for(var s=[],i=0;i<e;i++){var a=t[i>>>2]>>>24-i%4*8&255;s.push((a>>>4).toString(16)),s.push((15&a).toString(16))}return s.join("")},parse:function(e){for(var t=e.length,s=[],i=0;i<t;i+=2)s[i>>>3]|=parseInt(e.substr(i,2),16)<<24-i%8*4;return new o.init(s,t/2)}},c=n.Latin1={stringify:function(e){var t=e.words;e=e.sigBytes;for(var s=[],i=0;i<e;i++)s.push(String.fromCharCode(t[i>>>2]>>>24-i%4*8&255));return s.join("")},parse:function(e){for(var t=e.length,s=[],i=0;i<t;i++)s[i>>>2]|=(255&e.charCodeAt(i))<<24-i%4*8;return new o.init(s,t)}},d=n.Utf8={stringify:function(e){try{return decodeURIComponent(escape(c.stringify(e)))}catch(e){throw Error("Malformed UTF-8 data")}},parse:function(e){return c.parse(unescape(encodeURIComponent(e)))}},l=i.BufferedBlockAlgorithm=r.extend({reset:function(){this._data=new o.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=d.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var s=this._data,i=s.words,a=s.sigBytes,r=this.blockSize,n=a/(4*r);if(t=(n=t?e.ceil(n):e.max((0|n)-this._minBufferSize,0))*r,a=e.min(4*t,a),t){for(var _=0;_<t;_+=r)this._doProcessBlock(i,_);_=i.splice(0,t),s.sigBytes-=a}return new o.init(_,a)},clone:function(){var e=r.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0});i.Hasher=l.extend({cfg:r.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){l.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,s){return new e.init(s).finalize(t)}},_createHmacHelper:function(e){return function(t,s){return new u.HMAC.init(e,s).finalize(t)}}});var u=s.algo={};return s}(Math);!function(e){var t,s=(t=CryptoJS).lib,i=s.Base,a=s.WordArray;(t=t.x64={}).Word=i.extend({init:function(e,t){this.high=e,this.low=t}}),t.WordArray=i.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:8*e.length},toX32:function(){for(var e=this.words,t=e.length,s=[],i=0;i<t;i++){var r=e[i];s.push(r.high),s.push(r.low)}return a.create(s,this.sigBytes)},clone:function(){for(var e=i.clone.call(this),t=e.words=this.words.slice(0),s=t.length,a=0;a<s;a++)t[a]=t[a].clone();return e}})}(),function(e){for(var t=CryptoJS,s=(r=t.lib).WordArray,i=r.Hasher,a=t.x64.Word,r=t.algo,o=[],n=[],_=[],c=1,d=0,l=0;24>l;l++){o[c+5*d]=(l+1)*(l+2)/2%64;var u=(2*c+3*d)%5;c=d%5,d=u}for(c=0;5>c;c++)for(d=0;5>d;d++)n[c+5*d]=d+(2*c+3*d)%5*5;for(c=1,d=0;24>d;d++){for(var p=u=l=0;7>p;p++){if(1&c){var g=(1<<p)-1;32>g?u^=1<<g:l^=1<<g-32}c=128&c?c<<1^113:c<<1}_[d]=a.create(l,u)}var h=[];for(c=0;25>c;c++)h[c]=a.create();r=r.SHA3=i.extend({cfg:i.cfg.extend({outputLength:512}),_doReset:function(){for(var e=this._state=[],t=0;25>t;t++)e[t]=new a.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(e,t){for(var s=this._state,i=this.blockSize/2,a=0;a<i;a++){var r=16711935&((r=e[t+2*a])<<8|r>>>24)|4278255360&(r<<24|r>>>8),c=16711935&((c=e[t+2*a+1])<<8|c>>>24)|4278255360&(c<<24|c>>>8),d=s[a];d.high^=c,d.low^=r}for(i=0;24>i;i++){for(a=0;5>a;a++){for(var l=r=0,u=0;5>u;u++)r^=(d=s[a+5*u]).high,l^=d.low;(d=h[a]).high=r,d.low=l}for(a=0;5>a;a++)for(d=h[(a+4)%5],c=(r=h[(a+1)%5]).high,u=r.low,r=d.high^(c<<1|u>>>31),l=d.low^(u<<1|c>>>31),u=0;5>u;u++)(d=s[a+5*u]).high^=r,d.low^=l;for(c=1;25>c;c++)a=(d=s[c]).high,d=d.low,32>(u=o[c])?(r=a<<u|d>>>32-u,l=d<<u|a>>>32-u):(r=d<<u-32|a>>>64-u,l=a<<u-32|d>>>64-u),(d=h[n[c]]).high=r,d.low=l;for(d=h[0],a=s[0],d.high=a.high,d.low=a.low,a=0;5>a;a++)for(u=0;5>u;u++)d=s[c=a+5*u],r=h[c],c=h[(a+1)%5+5*u],l=h[(a+2)%5+5*u],d.high=r.high^~c.high&l.high,d.low=r.low^~c.low&l.low;d=s[0],a=_[i],d.high^=a.high,d.low^=a.low}},_doFinalize:function(){var t=(r=this._data).words,i=8*r.sigBytes,a=32*this.blockSize;t[i>>>5]|=1<<24-i%32,t[(e.ceil((i+1)/a)*a>>>5)-1]|=128,r.sigBytes=4*t.length,this._process();for(var r=this._state,o=(i=(t=this.cfg.outputLength/8)/8,a=[],0);o<i;o++){var n=16711935&((n=(_=r[o]).high)<<8|n>>>24)|4278255360&(n<<24|n>>>8),_=16711935&((_=_.low)<<8|_>>>24)|4278255360&(_<<24|_>>>8);a.push(_),a.push(n)}return new s.init(a,t)},clone:function(){for(var e=i.clone.call(this),t=e._state=this._state.slice(0),s=0;25>s;s++)t[s]=t[s].clone();return e}}),t.SHA3=i._createHelper(r),t.HmacSHA3=i._createHmacHelper(r)}(Math);var DateFormat={};!function(e){var t=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],s=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],i=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],a=["January","February","March","April","May","June","July","August","September","October","November","December"],r={Jan:"01",Feb:"02",Mar:"03",Apr:"04",May:"05",Jun:"06",Jul:"07",Aug:"08",Sep:"09",Oct:"10",Nov:"11",Dec:"12"},o=/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.?\d{0,3}[Z\-+]?(\d{2}:?\d{2})?/;DateFormat.format=function(){function e(e){return t[parseInt(e,10)]||e}function n(e){return s[parseInt(e,10)]||e}function _(e){var t=parseInt(e,10)-1;return i[t]||e}function c(e){var t=parseInt(e,10)-1;return a[t]||e}function d(e){return r[e]||e}function l(e){var t,s,i,a,r,o=e,n="";return-1!==o.indexOf(".")&&(a=o.split("."),o=a[0],n=a[1]),3===(r=o.split(":")).length?(t=r[0],s=r[1],i=r[2].replace(/\s.+/,"").replace(/[a-z]/gi,""),{time:o=o.replace(/\s.+/,"").replace(/[a-z]/gi,""),hour:t,minute:s,second:i,millis:n}):{time:"",hour:"",minute:"",second:"",millis:""}}function u(e,t){for(var s=t-String(e).length,i=0;i<s;i++)e="0"+e;return e}return{parseDate:function(e){var t={date:null,year:null,month:null,dayOfMonth:null,dayOfWeek:null,time:null};if("number"==typeof e)return this.parseDate(new Date(e));if("function"==typeof e.getFullYear)t.year=String(e.getFullYear()),t.month=String(e.getMonth()+1),t.dayOfMonth=String(e.getDate()),t.time=l(e.toTimeString()+"."+e.getMilliseconds());else if(-1!=e.search(o))values=e.split(/[T\+-]/),t.year=values[0],t.month=values[1],t.dayOfMonth=values[2],t.time=l(values[3].split(".")[0]);else switch(values=e.split(" "),6===values.length&&isNaN(values[5])&&(values[values.length]="()"),values.length){case 6:t.year=values[5],t.month=d(values[1]),t.dayOfMonth=values[2],t.time=l(values[3]);break;case 2:subValues=values[0].split("-"),t.year=subValues[0],t.month=subValues[1],t.dayOfMonth=subValues[2],t.time=l(values[1]);break;case 7:case 9:case 10:t.year=values[3],t.month=d(values[1]),t.dayOfMonth=values[2],t.time=l(values[4]);break;case 1:subValues=values[0].split(""),t.year=subValues[0]+subValues[1]+subValues[2]+subValues[3],t.month=subValues[5]+subValues[6],t.dayOfMonth=subValues[8]+subValues[9],t.time=l(subValues[13]+subValues[14]+subValues[15]+subValues[16]+subValues[17]+subValues[18]+subValues[19]+subValues[20]);break;default:return null}return t.time?t.date=new Date(t.year,t.month-1,t.dayOfMonth,t.time.hour,t.time.minute,t.time.second,t.time.millis):t.date=new Date(t.year,t.month-1,t.dayOfMonth),t.dayOfWeek=String(t.date.getDay()),t},date:function(t,s){try{var i=this.parseDate(t);if(null===i)return t;i.date;for(var a=i.year,r=i.month,o=i.dayOfMonth,d=i.dayOfWeek,l=i.time,p="",g="",h="",q=!1,m=0;m<s.length;m++){var f=s.charAt(m),w=s.charAt(m+1);if(q)"'"==f?(g+=""===p?"'":p,p="",q=!1):p+=f;else switch(h="",p+=f){case"ddd":g+=e(d),p="";break;case"dd":if("d"===w)break;g+=u(o,2),p="";break;case"d":if("d"===w)break;g+=parseInt(o,10),p="";break;case"D":g+=o=1==o||21==o||31==o?parseInt(o,10)+"st":2==o||22==o?parseInt(o,10)+"nd":3==o||23==o?parseInt(o,10)+"rd":parseInt(o,10)+"th",p="";break;case"MMMM":g+=c(r),p="";break;case"MMM":if("M"===w)break;g+=_(r),p="";break;case"MM":if("M"===w)break;g+=u(r,2),p="";break;case"M":if("M"===w)break;g+=parseInt(r,10),p="";break;case"y":case"yyy":if("y"===w)break;g+=p,p="";break;case"yy":if("y"===w)break;g+=String(a).slice(-2),p="";break;case"yyyy":g+=a,p="";break;case"HH":g+=u(l.hour,2),p="";break;case"H":if("H"===w)break;g+=parseInt(l.hour,10),p="";break;case"hh":hour=0===parseInt(l.hour,10)?12:l.hour<13?l.hour:l.hour-12,g+=u(hour,2),p="";break;case"h":if("h"===w)break;hour=0===parseInt(l.hour,10)?12:l.hour<13?l.hour:l.hour-12,g+=parseInt(hour,10),p="";break;case"mm":g+=u(l.minute,2),p="";break;case"m":if("m"===w)break;g+=l.minute,p="";break;case"ss":g+=u(l.second.substring(0,2),2),p="";break;case"s":if("s"===w)break;g+=l.second,p="";break;case"S":case"SS":if("S"===w)break;g+=p,p="";break;case"SSS":g+=l.millis.substring(0,3),p="";break;case"a":g+=l.hour>=12?"PM":"AM",p="";break;case"p":g+=l.hour>=12?"p.m.":"a.m.",p="";break;case"E":g+=n(d),p="";break;case"'":p="",q=!0;break;default:g+=f,p=""}}return g+=h}catch(e){return console&&console.log&&console.log(e),t}},toBrowserTimeZone:function(e,t){return this.date(new Date(e),t||"MM/dd/yyyy HH:mm:ss")}}}()}(),function(){"use strict";var e="object"==typeof window?window:{};!e.JS_CRC_NO_NODE_JS&&"object"==typeof process&&process.versions&&process.versions.node&&(e=global);var t,s,i,a,r=!e.JS_CRC_NO_COMMON_JS&&"object"==typeof module&&module.exports,o="function"==typeof define&&define.amd,n=!e.JS_CRC_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,_="0123456789abcdef".split(""),c=[{name:"qwiz_crc32",polynom:3988292384,initValue:-1,bytes:4},{name:"qwiz_crc16",polynom:40961,initValue:0,bytes:2}];for(t=0;t<c.length;++t){for((u=c[t]).method=function(e){return function(t){return d(t,e)}}(u),u.table=[],s=0;256>s;++s){for(a=s,i=0;8>i;++i)a=1&a?u.polynom^a>>>1:a>>>1;u.table[s]=a>>>0}}var d=function(e,t){var s="string"!=typeof e;s&&n&&e instanceof ArrayBuffer&&(e=new Uint8Array(e));var i,a,r=t.initValue,o=e.length,c=t.table;if(s)for(a=0;o>a;++a)r=c[255&(r^e[a])]^r>>>8;else for(a=0;o>a;++a)128>(i=e.charCodeAt(a))?r=c[255&(r^i)]^r>>>8:2048>i?r=c[255&((r=c[255&(r^(192|i>>6))]^r>>>8)^(128|63&i))]^r>>>8:55296>i||i>=57344?r=c[255&((r=c[255&((r=c[255&(r^(224|i>>12))]^r>>>8)^(128|i>>6&63))]^r>>>8)^(128|63&i))]^r>>>8:r=c[255&((r=c[255&((r=c[255&((r=c[255&(r^(240|(i=65536+((1023&i)<<10|1023&e.charCodeAt(++a)))>>18))]^r>>>8)^(128|i>>12&63))]^r>>>8)^(128|i>>6&63))]^r>>>8)^(128|63&i))]^r>>>8;r^=t.initValue;var d="";return t.bytes>2&&(d+=_[r>>28&15]+_[r>>24&15]+_[r>>20&15]+_[r>>16&15]),d+(_[r>>12&15]+_[r>>8&15]+_[r>>4&15]+_[15&r])},l={};for(t=0;t<c.length;++t){l[(u=c[t]).name]=u.method}if(r)module.exports=l;else{for(t=0;t<c.length;++t){var u;e[(u=c[t]).name]=u.method}o&&define(function(){return l})}}(),function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?e(require("jquery")):e(jQuery)}(function(e,t){var s="plugin_hideShowPassword",i=["show","innerToggle"],a=function(){var e=document.body,t=document.createElement("input"),s=!0;e||(e=document.createElement("body")),t=e.appendChild(t);try{t.setAttribute("type","text")}catch(e){s=!1}return e.removeChild(t),s}();function r(t,s){this.element=e(t),this.wrapperElement=e(),this.toggleElement=e(),this.init(s)}r.prototype={init:function(t){this.update(t,e.fn.hideShowPassword.defaults)&&(this.element.addClass(this.options.className),this.options.innerToggle&&(this.wrapElement(this.options.wrapper),this.initToggle(this.options.toggle),"string"==typeof this.options.innerToggle&&(this.toggleElement.hide(),this.element.one(this.options.innerToggle,e.proxy(function(){this.toggleElement.show()},this)))),this.element.trigger(this.options.initEvent,[this]))},update:function(e,t){return this.options=this.prepareOptions(e,t),this.updateElement()&&this.element.trigger(this.options.changeEvent,[this]).trigger(this.state().changeEvent,[this]),this.options.enable},toggle:function(e){return e=e||"toggle",this.update({show:e})},prepareOptions:function(t,s){var i,a=t||{},r=[];if(s=s||this.options,t=e.extend(!0,{},s,t),a.hasOwnProperty("wrapper")&&a.wrapper.hasOwnProperty("inheritStyles")&&(t.wrapper.inheritStyles=a.wrapper.inheritStyles),t.enable&&("toggle"===t.show?t.show=this.isType("hidden",t.states):"infer"===t.show&&(t.show=this.isType("shown",t.states)),"infer"===t.toggle.position&&(t.toggle.position="rtl"===this.element.css("text-direction")?"left":"right"),!e.isArray(t.toggle.attachToKeyCodes))){if(!0===t.toggle.attachToKeyCodes)switch((i=e(t.toggle.element)).prop("tagName").toLowerCase()){case"button":case"input":break;case"a":if(i.filter("[href]").length){r.push(32);break}default:r.push(32,13)}t.toggle.attachToKeyCodes=r}return t},updateElement:function(){return!(!this.options.enable||this.isType())&&(this.element.prop(e.extend({},this.options.props,this.state().props)).addClass(this.state().className).removeClass(this.otherState().className),this.options.triggerOnToggle&&this.element.trigger(this.options.triggerOnToggle,[this]),this.updateToggle(),!0)},isType:function(e,s){return(s=s||this.options.states)[e=e||this.state(t,t,s).props.type]&&(e=s[e].props.type),this.element.prop("type")===e},state:function(e,s,i){return i=i||this.options.states,e===t&&(e=this.options.show),"boolean"==typeof e&&(e=e?"shown":"hidden"),s&&(e="shown"===e?"hidden":"shown"),i[e]},otherState:function(e){return this.state(e,!0)},wrapElement:function(t){var s,i=t.enforceWidth;return this.wrapperElement.length||(s=this.element.outerWidth(),e.each(t.inheritStyles,e.proxy(function(e,s){t.styles[s]=this.element.css(s)},this)),this.element.css(t.innerElementStyles).wrap(e(t.element).addClass(t.className).css(t.styles)),this.wrapperElement=this.element.parent(),!0===i&&(i=this.wrapperElement.outerWidth()!==s&&s),!1!==i&&this.wrapperElement.css("width",i)),this.wrapperElement},initToggle:function(t){return this.toggleElement.length||(this.toggleElement=e(t.element).attr(t.attr).addClass(t.className).css(t.styles).appendTo(this.wrapperElement),this.updateToggle(),this.positionToggle(t.position,t.verticalAlign,t.offset),t.touchSupport?(this.toggleElement.css(t.touchStyles),this.element.on(t.attachToTouchEvent,e.proxy(this.toggleTouchEvent,this))):this.toggleElement.on(t.attachToEvent,e.proxy(this.toggleEvent,this)),t.attachToKeyCodes.length&&this.toggleElement.on(t.attachToKeyEvent,e.proxy(this.toggleKeyEvent,this))),this.toggleElement},positionToggle:function(e,t,s){var i={};switch(i[e]=s,t){case"top":case"bottom":i[t]=s;break;case"middle":i.top="50%",i.marginTop=this.toggleElement.outerHeight()/-2}return this.toggleElement.css(i)},updateToggle:function(e,t){var s,i;return this.toggleElement.length&&(s="padding-"+this.options.toggle.position,e=e||this.state().toggle,t=t||this.otherState().toggle,this.toggleElement.attr(e.attr).addClass(e.className).removeClass(t.className).html(e.content),i=this.toggleElement.outerWidth()+2*this.options.toggle.offset,this.element.css(s)!==i&&this.element.css(s,i)),this.toggleElement},toggleEvent:function(e){e.preventDefault(),this.toggle()},toggleKeyEvent:function(t){e.each(this.options.toggle.attachToKeyCodes,e.proxy(function(e,s){if(t.which===s)return this.toggleEvent(t),!1},this))},toggleTouchEvent:function(e){var t,s,i,a=this.toggleElement.offset().left;a&&(t=e.pageX||e.originalEvent.pageX,"left"===this.options.toggle.position?(s=t,i=a+=this.toggleElement.outerWidth()):(s=a,i=t),i>=s&&this.toggleEvent(e))}},e.fn.hideShowPassword=function(){var t={};return e.each(arguments,function(s,a){var r={};if("object"==typeof a)r=a;else{if(!i[s])return!1;r[i[s]]=a}e.extend(!0,t,r)}),this.each(function(){var i=e(this),a=i.data(s);a?a.update(t):i.data(s,new r(this,t))})},e.each({show:!0,hide:!1,toggle:"toggle"},function(t,s){e.fn[t+"Password"]=function(e,t){return this.hideShowPassword(s,e,t)}}),e.fn.hideShowPassword.defaults={show:"infer",innerToggle:!1,enable:a,triggerOnToggle:!1,className:"hideShowPassword-field",initEvent:"hideShowPasswordInit",changeEvent:"passwordVisibilityChange",props:{autocapitalize:"off",autocomplete:"off",autocorrect:"off",spellcheck:"false"},toggle:{element:'<button type="button">',className:"hideShowPassword-toggle",touchSupport:"undefined"!=typeof Modernizr&&Modernizr.touchevents,attachToEvent:"click.hideShowPassword",attachToTouchEvent:"touchstart.hideShowPassword mousedown.hideShowPassword",attachToKeyEvent:"keyup",attachToKeyCodes:!0,styles:{position:"absolute"},touchStyles:{pointerEvents:"none"},position:"infer",verticalAlign:"middle",offset:0,attr:{tabindex:"-1",role:"button","aria-label":"Show password",title:"Show password",tabIndex:0}},wrapper:{element:"<div>",className:"hideShowPassword-wrapper",enforceWidth:!0,styles:{position:"relative"},inheritStyles:["display","verticalAlign","marginTop","marginRight","marginBottom","marginLeft"],innerElementStyles:{marginTop:0,marginRight:0,marginBottom:0,marginLeft:0}},states:{shown:{className:"hideShowPassword-shown",changeEvent:"passwordShown",props:{type:"text"},toggle:{className:"hideShowPassword-toggle-hide",content:"Hide",attr:{tabindex:"-1","aria-pressed":"true",title:"Hide password"}}},hidden:{className:"hideShowPassword-hidden",changeEvent:"passwordHidden",props:{type:"password"},toggle:{className:"hideShowPassword-toggle-show",content:"Show",attr:{tabindex:"-1","aria-pressed":"false",title:"Show password"}}}}}}),function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"==typeof window?"undefined"==typeof global?"undefined"==typeof self?this:self:global:window).base64js=e()}}(function(){return function e(t,s,i){function a(o,n){if(!s[o]){if(!t[o]){var _="function"==typeof require&&require;if(!n&&_)return _(o,!0);if(r)return r(o,!0);var c=new Error("Cannot find module '"+o+"'");throw c.code="MODULE_NOT_FOUND",c}var d=s[o]={exports:{}};t[o][0].call(d.exports,function(e){return a(t[o][1][e]||e)},d,d.exports,e,t,s,i)}return s[o].exports}for(var r="function"==typeof require&&require,o=0;o<i.length;o++)a(i[o]);return a}({"/":[function(e,t,s){"use strict";function i(e){var t=e.length;if(0<t%4)throw new Error("Invalid string. Length must be a multiple of 4");var s=e.indexOf("=");return-1===s&&(s=t),[s,s===t?0:4-s%4]}function a(e){return o[63&e>>18]+o[63&e>>12]+o[63&e>>6]+o[63&e]}function r(e,t,s){for(var i,r=[],o=t;o<s;o+=3)i=(16711680&e[o]<<16)+(65280&e[o+1]<<8)+(255&e[o+2]),r.push(a(i));return r.join("")}s.byteLength=function(e){var t=i(e),s=t[0],a=t[1];return 3*(s+a)/4-a},s.toByteArray=function(e){var t,s,a=i(e),r=a[0],o=a[1],c=new _(function(e,t,s){return 3*(t+s)/4-s}(0,r,o)),d=0,l=0<o?r-4:r;for(s=0;s<l;s+=4)t=n[e.charCodeAt(s)]<<18|n[e.charCodeAt(s+1)]<<12|n[e.charCodeAt(s+2)]<<6|n[e.charCodeAt(s+3)],c[d++]=255&t>>16,c[d++]=255&t>>8,c[d++]=255&t;return 2===o&&(t=n[e.charCodeAt(s)]<<2|n[e.charCodeAt(s+1)]>>4,c[d++]=255&t),1===o&&(t=n[e.charCodeAt(s)]<<10|n[e.charCodeAt(s+1)]<<4|n[e.charCodeAt(s+2)]>>2,c[d++]=255&t>>8,c[d++]=255&t),c},s.fromByteArray=function(e){for(var t,s=e.length,i=s%3,a=[],n=16383,_=0,c=s-i;_<c;_+=n)a.push(r(e,_,_+n>c?c:_+n));return 1===i?(t=e[s-1],a.push(o[t>>2]+o[63&t<<4]+"==")):2===i&&(t=(e[s-2]<<8)+e[s-1],a.push(o[t>>10]+o[63&t>>4]+o[63&t<<2]+"=")),a.join("")};for(var o=[],n=[],_="undefined"==typeof Uint8Array?Array:Uint8Array,c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",d=0;d<64;++d)o[d]=c[d],n[c.charCodeAt(d)]=d;n[45]=62,n[95]=63},{}]},{},[])("/")});var Base64={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode:function(e){var t,s,i,a,r,o,n,_="",c=0;for(e=Base64._utf8_encode(e);c<e.length;)a=(t=e.charCodeAt(c++))>>2,r=(3&t)<<4|(s=e.charCodeAt(c++))>>4,o=(15&s)<<2|(i=e.charCodeAt(c++))>>6,n=63&i,isNaN(s)?o=n=64:isNaN(i)&&(n=64),_=_+this._keyStr.charAt(a)+this._keyStr.charAt(r)+this._keyStr.charAt(o)+this._keyStr.charAt(n);return _},decode:function(e){var t,s,i,a,r,o,n="",_=0;for(e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");_<e.length;)t=this._keyStr.indexOf(e.charAt(_++))<<2|(a=this._keyStr.indexOf(e.charAt(_++)))>>4,s=(15&a)<<4|(r=this._keyStr.indexOf(e.charAt(_++)))>>2,i=(3&r)<<6|(o=this._keyStr.indexOf(e.charAt(_++))),n+=String.fromCharCode(t),64!=r&&(n+=String.fromCharCode(s)),64!=o&&(n+=String.fromCharCode(i));return n=Base64._utf8_decode(n)},_utf8_encode:function(e){var t="";e=e.replace(/\r\n/g,"\n");for(var s=0;s<e.length;s++){var i=e.charCodeAt(s);i<128?t+=String.fromCharCode(i):i>127&&i<2048?(t+=String.fromCharCode(i>>6|192),t+=String.fromCharCode(63&i|128)):(t+=String.fromCharCode(i>>12|224),t+=String.fromCharCode(i>>6&63|128),t+=String.fromCharCode(63&i|128))}return t},_utf8_decode:function(e){var t,s,i,a="",r=0;for(t=s=0;r<e.length;)(t=e.charCodeAt(r))<128?(a+=String.fromCharCode(t),r++):t>191&&t<224?(s=e.charCodeAt(r+1),a+=String.fromCharCode((31&t)<<6|63&s),r+=2):(s=e.charCodeAt(r+1),i=e.charCodeAt(r+2),a+=String.fromCharCode((15&t)<<12|(63&s)<<6|63&i),r+=3);return a}}; -
qwiz-online-quizzes-and-flashcards/tags/4.05/qwizard.css
r3708145 r3722232 683 683 display: block !important; 684 684 } 685 } 686 div#dialog_qwizard div.hotspot_image_stack_size_feedback { 685 div#dialog_qwizard div.hotspot_image_stack div.hotspot_image_stack_size_feedback { 687 686 display: none; 688 687 position: absolute; -
qwiz-online-quizzes-and-flashcards/tags/4.05/qwizard.js
r3708145 r3722232 230 230 qw.go_to_question (-1, true); 231 231 } else { 232 qw.go_to_card ( -1, true);232 qw.go_to_card ('', -1, true); 233 233 } 234 234 } … … 687 687 + '[start]  '; 688 688 } 689 qw.go_to_card ( -1, true);689 qw.go_to_card ('', -1, true); 690 690 } else { 691 691 qcard_.no_intro_b[i_qwiz] = true; 692 692 intro_text = ''; 693 qw.go_to_card ( 0);693 qw.go_to_card ('', 0); 694 694 } 695 695 } … … 976 976 }); 977 977 }; 978 setTimeout (delay_init, 100);978 setTimeout (delay_init, 200); 979 979 } 980 980 function qqc_rm_br (ed) { … … 2647 2647 */ 2648 2648 } 2649 function insert_image_or_code (editor, image_code, edited_layer_f) {2649 function insert_image_or_code (editor, image_code, update_base_f) { 2650 2650 if (debug[0]) { 2651 2651 console.log ('[insert_image_or_code]: editor:', editor); … … 2687 2687 } 2688 2688 var $qwizq; 2689 var $img; 2690 if (edited_layer_f) { 2691 $img = $hotspot_image_stack.find ('img.layer0_edited'); 2692 } else { 2693 $img = $hotspot_image_stack.find ('img.qwiz_layer0'); 2694 } 2689 var $img = $hotspot_image_stack.find ('img.qwiz_layer0'); 2695 2690 if ($img.length) { 2696 2691 const img_el = $img[0]; 2697 const is_sample_image = img_el.src.indexOf ('sample_hotspot_image') != -1 || img_el.src.indexOf ('sample_r_diagrams_image') != -1;2692 const existing_is_sample_image = img_el.src.indexOf ('sample_hotspot_image') != -1 || img_el.src.indexOf ('sample_r_diagrams_image') != -1; 2698 2693 img_el.src = src; 2699 2694 if (alt) { 2700 2695 img_el.alt = alt; 2701 2696 } 2702 if (edited_layer_f) { 2703 qw.questions_cards[i_question].hotspot_image_img_el = img_el; 2704 } else { 2705 qw.questions_cards[i_question].hotspot_image_src = src; 2706 } 2697 qw.questions_cards[i_question].hotspot_image_src = src; 2698 qw.questions_cards[i_question].canvas_el = ''; 2699 qw.init_hotspot_image_canvas (); 2707 2700 let $canvas = $hotspot_image_stack.find ('canvas.layer0_edited'); 2708 if ( is_sample_image || ! edited_layer_f) {2701 if (existing_is_sample_image) { 2709 2702 img_el.onload = function () { 2710 2703 img_el.style.width = 'fit-content'; … … 2716 2709 img_el.style.width = ''; 2717 2710 img_el.style.height = ''; 2718 qw.questions_cards[i_question].canvas_el = ''; 2719 qw.init_hotspot_image_canvas (); 2720 const ctx = qw.questions_cards[i_question].ctx; 2721 const canvas_el = qw.questions_cards[i_question].canvas_el; 2722 check_image_alphas (ctx, canvas_el.width, canvas_el.height); 2711 } 2712 } else { 2713 img_el.onload = function () { 2714 $img.css ({width: '100%', height: '100%'}); 2715 } 2716 } 2717 const ctx = qw.questions_cards[i_question].ctx; 2718 const canvas_el = qw.questions_cards[i_question].canvas_el; 2719 check_image_alphas (ctx, canvas_el.width, canvas_el.height); 2720 if (update_base_f) { 2721 $edited_img = $hotspot_image_stack.find ('img.layer0_edited'); 2722 const edited_img_el = $edited_img[0]; 2723 if (edited_img_el.src) { 2724 transfer_base_to_edited_and_canvas (); 2723 2725 } 2724 2726 } 2725 2727 make_hotspot_image_stack_resizable ($hotspot_image_stack, $canvas); 2726 if ( is_sample_image) {2728 if (existing_is_sample_image) { 2727 2729 $hotspot_image_stack.find ('div.qwiz_hotspot_label').remove (); 2728 2730 } … … 5045 5047 style = ' style="font-weight: bold;"'; 5046 5048 } 5047 m.push ('<div id="qwizard_menu_question-q' + ii_question + '" class="qwizard_menu_item qwizard_menu_question q' + ii_question + sortable + '" data-i_question="' + ii_question + '" onclick="qwizard.go_to_card ( ' + ii_question + ')"' + style + '>');5049 m.push ('<div id="qwizard_menu_question-q' + ii_question + '" class="qwizard_menu_item qwizard_menu_question q' + ii_question + sortable + '" data-i_question="' + ii_question + '" onclick="qwizard.go_to_card (event, ' + ii_question + ')"' + style + '>'); 5048 5050 m.push ( add_delete_buttons_html (ii_question, false)); 5049 5051 m.push ( '<div class="qwizard_menu_question_label">'); … … 5641 5643 qw.cards_list_html (); 5642 5644 if (typeof (local_i_question) != 'undefined') { 5643 qw.go_to_card ( local_i_question, true);5645 qw.go_to_card ('', local_i_question, true); 5644 5646 } 5645 5647 } … … 6401 6403 qqc.select_placeholder ($ ('#qwiz' + i_qwiz + '-q' + i_question + ' div.qwiz-question').first ()); 6402 6404 } 6403 this.go_to_card = function ( local_i_question, force_f) {6405 this.go_to_card = function (event, local_i_question, force_f) { 6404 6406 if (debug[0]) { 6405 6407 console.log ('[go_to_card] i_question:', i_question, ', local_i_question:', local_i_question, ', event:', event); … … 6687 6689 h.push ('<div class="qwizard_floating_menu_title">'); 6688 6690 h.push ( '<div class="qwizard_inline_block qwizard_float_right">'); 6689 h.push ( '<button onclick="qwizard.toggle_hotspot_image_hide_show ()" style="padding: 0;" title="On-off: hide image and show onlyhotspots">');6691 h.push ( '<button onclick="qwizard.toggle_hotspot_image_hide_show ()" style="padding: 0;" title="On-off: hide image under hotspots">'); 6690 6692 h.push ( '<img src="' + qwizzled_params.url + '/images/qwiz_icon_image_x.svg" border="0" style="width: 16px; height: 14px;" />'); 6691 6693 h.push ( '</button>'); … … 7244 7246 } 7245 7247 $hotspot_image_stack.resizable ({ 7248 create: function() { 7249 $ (this).find ('.ui-resizable-handle').attr ('title', 'shift-drag to preserve aspect ratio'); 7250 }, 7246 7251 start: function(e, ui_obj) { 7247 7252 $hotspot_image_stack_size_feedback.show (); … … 7265 7270 const ctx = canvas_el.getContext ('2d'); 7266 7271 $canvas.attr ('width', width).attr ('height', height); 7267 const img = qw.questions_cards[i_question].hotspot_image_img_el; 7268 const delay_draw = function () { 7269 ctx.drawImage (img, 0, 0, width, height); 7272 const img_el = qw.questions_cards[i_question].hotspot_image_img_el; 7273 if (img_el) { 7274 const delay_draw = function () { 7275 ctx.drawImage (img, 0, 0, width, height); 7276 } 7277 setTimeout (delay_draw, 200); 7270 7278 } 7271 setTimeout (delay_draw, 200);7272 7279 if ($hotspot_image_stack[0].qwiz_style_canvas_el) { 7273 7280 const style_canvas_el = $hotspot_image_stack[0].qwiz_style_canvas_el; … … 7275 7282 const style_ctx = style_canvas_el.getContext ('2d'); 7276 7283 $style_canvas.attr ('width', width).attr ('height', height); 7277 const style_img = $hotspot_image_stack.find ('img.qwiz_style_layer')[0]; 7278 const delay_style_draw = function () { 7279 style_ctx.drawImage (style_img, 0, 0, width, height); 7284 const $style_img = $hotspot_image_stack.find ('img.qwiz_style_layer'); 7285 if ($style_img.length) { 7286 const style_img_el = $style_img[0]; 7287 const delay_style_draw = function () { 7288 style_ctx.drawImage (style_img_el, 0, 0, width, height); 7289 } 7290 setTimeout (delay_style_draw, 200); 7280 7291 } 7281 setTimeout (delay_style_draw, 200);7282 7292 } 7283 7293 } … … 7292 7302 var idx = i << 2; 7293 7303 const a = data[idx + 3] 7304 7294 7305 if (a >= 121 && a <= 123) { 7295 7306 data[idx + 3] = 124; … … 7306 7317 } 7307 7318 } 7319 } 7320 function transfer_base_to_edited_and_canvas () { 7321 const ctx = qw.questions_cards[i_question].ctx; 7322 const i_width = ctx.canvas.width; 7323 const i_height = ctx.canvas.height; 7324 const imageData = ctx.getImageData(0, 0, i_width, i_height); 7325 const data = imageData.data; 7326 const p32 = new Uint32Array (data.buffer); 7327 const r_obj = get_base_image_data (i_width, i_height); 7328 const base_p32 = r_obj.base_p32; 7329 const n_pixels = i_width * i_height; 7330 for (var i=0; i<n_pixels; i++) { 7331 const idx = i << 2; 7332 const a = data[idx + 3]; 7333 if (a != qwiz_.hotspot_alpha_value && a != qwiz_.hotspot_border_alpha_value) { 7334 p32[i] = base_p32[i]; 7335 } 7336 } 7337 ctx.putImageData (imageData, 0, 0); 7308 7338 } 7309 7339 var editing_hotspot_f = false; … … 8134 8164 return [json, response]; 8135 8165 } 8136 this.hotspot_ai_assist_refine = function () {8137 $ ('#hotspot_ai_assist_dialog_spinner').show ();8138 for (const ai_hotspot of ai_hotspots) {8139 current_hotspot_no = ai_hotspot['hotspot_no'];8140 var image_url = qw.questions_cards[i_question].hotspot_image_src;8141 var query = '';8142 var text = ai_hotspot['text'];8143 var x = ai_hotspot['x'];8144 var y = ai_hotspot['y'];8145 if (text != 'no text') {8146 query = `Create a new image from this image. The new image should be the same except that one of these items -- ${hotspot_ai_assist_initial_query} -- should be replaced with transparent background. The item that should be changed to transparent has text "${text} inside and is approximately ${x} percent from the left and ${y} percent from the top. Change everything inside the item to transparent. Leave everything outside the item, including lines touching the item. The new image should have the same aspect ratio as the original.`;8147 }8148 var data = {action: 'hotspot_ai_assist_refine',8149 query: query,8150 image_url: image_url8151 };8152 if (debug[0]) {8153 console.log ('[hotspot_ai_assist_refine] data:', data);8154 }8155 $.ajax ({8156 type: 'POST',8157 url: qwizzled_params.ajaxurl,8158 data: data,8159 error: function (xhr, desc) {8160 if (debug[0]) {8161 console.log ('[hotspot_ai_assist_refine] error desc:', desc);8162 }8163 },8164 success: hotspot_ai_assist_refine_callback8165 });8166 break; //DKTMP8167 }8168 }8169 function hotspot_ai_assist_refine_callback (data) {8170 if (debug[0]) {8171 console.log ('[hotspot_ai_assist_refine_callback] data:', data);8172 }8173 $ ('#hotspot_ai_assist_dialog_spinner').hide ();8174 if (data['error_f']) {8175 hotspot_ai_assist_display_response (data);8176 } else {8177 }8178 }8179 8166 this.hotspot_ai_assist_start_over = function () { 8180 8167 const $rectlipses = $hotspot_image_stack.find (`div.qwiz_rectlipse`); … … 8279 8266 $ ('#ai_image_edit_dialog').draggable ().resizable ().show (); 8280 8267 } 8281 this.ai_image_edit_go = function () {8268 this.ai_image_edit_go = async function () { 8282 8269 var query = $ ('#ai_image_edit_dialog_textarea').val () 8283 8270 if (! /\S/.test (query)) { … … 8293 8280 image_height: image_height 8294 8281 }; 8295 var image_src = get_edited_or_original ();8282 var image_src = qw.questions_cards[i_question].hotspot_image_src; 8296 8283 if (image_src.substr (0, 5) == 'data:') { 8297 8284 data.image_data = image_src; 8285 } else if (image_src.substr (0, 5) == 'blob:') { 8286 try { 8287 data.image_data = await qqc.blobUrlToBase64 (image_src); 8288 } catch (error) { 8289 console.error ('Failed to convert blob to base64:', error); 8290 alert ('Sorry, unable to process image'); 8291 return false; 8292 } 8298 8293 } else { 8299 8294 data.image_url = image_src; … … 8329 8324 $ ('#ai_image_edit_dialog_spinner').hide (); 8330 8325 if (data.response['image_b64']) { 8326 const ctx = qw.questions_cards[i_question].ctx; 8327 const image_width = ctx.canvas.width; 8328 const image_height = ctx.canvas.height; 8331 8329 const image_mimetype = data.response['image_mimetype']; 8332 8330 const image_b64 = data.response['image_b64']; 8333 const img = `<img class="ai_image_edit_new_image" src="data:${image_mimetype};base64,${image_b64}" />`8331 const img = `<img class="ai_image_edit_new_image" src="data:${image_mimetype};base64,${image_b64}" style="width: ${image_width}px; height: ${image_height}px;"/>` 8334 8332 $ ('div#ai_image_edit_new_image').html (img); 8335 8333 } … … 8351 8349 this.ai_image_edit_done_save = function () { 8352 8350 var img = $ ('div#ai_image_edit_new_image').html (); 8351 8353 8352 insert_image_or_code ('', img, true); 8354 8353 $ ('#ai_image_edit_dialog').hide (); … … 8470 8469 const data = imageData.data; 8471 8470 const n_pixels = i_width * i_height; 8472 const r_obj = get_ original_hotspot_image_data (i_width, i_height);8473 const orig_image_data = r_obj.orig_image_data;8471 const r_obj = get_base_image_data (i_width, i_height); 8472 const base_image_data = r_obj.base_image_data; 8474 8473 [$hotspot_style_canvas, hotspot_style_ctx] 8475 8474 = init_hotspot_style_canvas (i_width, i_height); … … 9466 9465 selecting_hotspot_f = true; 9467 9466 } 9468 this.select_hotspot_click = function (e ) {9467 this.select_hotspot_click = function (event) { 9469 9468 if (debug[0]) { 9470 9469 console.log ('[select_hotspot_click] event.offsetX:', event.offsetX, ', event.offsetY:', event.offsetY); … … 9879 9878 $hotspot_image_stack.removeClass ('qwizard_paintbucket').css ({cursor: ''}); 9880 9879 } 9881 this.floodFill = function (e ) {9880 this.floodFill = function (event) { 9882 9881 if (debug[0]) { 9883 9882 console.log ('[floodFill] event.offsetX:', event.offsetX, ', event.offsetY:', event.offsetY); … … 9938 9937 } 9939 9938 } else { 9940 const r_obj = get_ original_hotspot_image_data (width, height);9941 const orig_image_data = r_obj.orig_image_data;9939 const r_obj = get_base_image_data (width, height); 9940 const base_image_data = r_obj.base_image_data; 9942 9941 click_r = orig_image_data[idx] ; 9943 9942 click_g = orig_image_data[idx + 1]; … … 10114 10113 const do_highlight_f = $highlight_label.attr ('data-highlight_brightness') || $highlight_label.attr ('data-highlight_tint'); 10115 10114 if (do_highlight_f || do_border_f) { 10116 const r_obj = get_ original_hotspot_image_data (i_width, i_height);10117 const orig_image_data = r_obj.orig_image_data;10115 const r_obj = get_base_image_data (i_width, i_height); 10116 const base_image_data = r_obj.base_image_data; 10118 10117 [$hotspot_style_canvas, hotspot_style_ctx] 10119 10118 = init_hotspot_style_canvas (i_width, i_height); … … 10939 10938 const p32 = new Uint32Array (data.buffer); 10940 10939 hotspot_saved_images[0] = [...data]; 10941 const r_obj = get_ original_hotspot_image_data (i_width, i_height);10942 const orig_p32 = r_obj.orig_p32;10940 const r_obj = get_base_image_data (i_width, i_height); 10941 const base_p32 = r_obj.base_p32; 10943 10942 var hotspot_style_layer_img_src_f = false; 10944 10943 if (typeof qw.questions_cards[i_question].hotspot_style_layer_img_src_f … … 10963 10962 const b = data[idx + 2]; 10964 10963 if (rgb_same (r, cur_r) && rgb_same (g, cur_g) && rgb_same (b, cur_b)) { 10965 p32[i] = orig_p32[i];10964 p32[i] = base_p32[i]; 10966 10965 if (hotspot_style_layer_img_src_f) { 10967 10966 hotspot_style_p32[i] = 0; … … 10984 10983 } 10985 10984 } 10986 function get_ original_hotspot_image_data (i_width, i_height) {10987 if (debug[0]) { 10988 console.log ('[get_ original_hotspot_image_data] i_width:', i_width, ', i_height:', i_height);10985 function get_base_image_data (i_width, i_height) { 10986 if (debug[0]) { 10987 console.log ('[get_base_image_data] i_width:', i_width, ', i_height:', i_height); 10989 10988 } 10990 10989 const canvas_class = 'qwiz_tmp_canvas-qwiz' + i_qwiz + '-q' + i_question; 10991 var $ orig_image_canvas = $ ('canvas.' + canvas_class);10990 var $base_image_canvas = $ ('canvas.' + canvas_class); 10992 10991 var new_f = false; 10993 if (! $ orig_image_canvas.length) {10992 if (! $base_image_canvas.length) { 10994 10993 new_f = true; 10995 10994 $ ('canvas.qwiz_tmp_canvas').remove (); 10996 10995 $ ('body').append ('<canvas class="' + canvas_class + '" width="' + i_width + '" height="' + i_height + '"></canvas>'); 10997 $ orig_image_canvas = $ ('canvas.' + canvas_class);10998 } 10999 const orig_image_canvas_el = $orig_image_canvas[0];11000 var orig_image_ctx = orig_image_canvas_el.getContext ('2d');10996 $base_image_canvas = $ ('canvas.' + canvas_class); 10997 } 10998 const base_image_canvas_el = $base_image_canvas[0]; 10999 var base_image_ctx = base_image_canvas_el.getContext ('2d'); 11001 11000 if (new_f) { 11002 const orig_img = $hotspot_image_stack.find ('img.qwiz_layer0')[0];11003 orig_image_ctx.drawImage (orig_img, 0, 0, i_width, i_height);11004 } 11005 const orig_imageData = orig_image_ctx.getImageData(0, 0, i_width, i_height);11006 const orig_image_data = orig_imageData.data;11007 const orig_p32 = new Uint32Array (orig_image_data.buffer);11008 if (debug[0]) { 11009 console.log ('[get_ original_hotspot_image_data] orig_image_data.length:', orig_image_data.length);11010 } 11011 return { orig_image_data: orig_image_data, orig_p32: orig_p32};11001 const base_img = $hotspot_image_stack.find ('img.qwiz_layer0')[0]; 11002 base_image_ctx.drawImage (base_img, 0, 0, i_width, i_height); 11003 } 11004 const base_imageData = base_image_ctx.getImageData(0, 0, i_width, i_height); 11005 const base_image_data = base_imageData.data; 11006 const base_p32 = new Uint32Array (base_image_data.buffer); 11007 if (debug[0]) { 11008 console.log ('[get_base_image_data] base_image_data.length:', base_image_data.length); 11009 } 11010 return {base_image_data: base_image_data, base_p32: base_p32}; 11012 11011 } 11013 11012 function discard_edit () { -
qwiz-online-quizzes-and-flashcards/tags/4.05/qwizcards-plugin.php
r3712310 r3722232 1 1 <?php 2 2 if (! defined ('ABSPATH')) exit; 3 $qwizcards_version = '4.0 4';3 $qwizcards_version = '4.05b2'; 4 4 $PLUGIN_FILE = 'qwizcards-header.php'; 5 5 $qwiz_alt_options_yn = 'n';
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)