PageSourceSearch

https://codecombat.com/javascripts/chunks/AllCoursesCertificatesView-7f1ed464e307a27290f5.bundle.js

js codecombat.com collected 2026-09-24 08:30:28 UTC 10,828 bytes, 2 lines download raw bytes

1"use strict";(self.webpackChunkcodecombat=self.webpackChunkcodecombat||[]).push([[5709],{739572:(e,t,r)=>{function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,i(n.key),n)}}function i(e){var t=function(e,t){if("object"!=n(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t);if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==n(t)?t:t+""}function u(e,t,r){return t=a(t),function(e,t){if(t&&("object"==n(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,c()?Reflect.construct(t,r||[],a(e).constructor):t.apply(e,r))}function c(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(c=function(){return!!e})()}function a(e){return a=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},a(e)}function l(e,t){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},l(e,t)}var f,h=r(864481),p=r(566978);e.exports=((f=function(e){function t(){return o(this,t),u(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&l(e,t)}(t,e),r=t,i=[{key:"initClass",value:function(){this.prototype.model=h,this.prototype.url="/db/course_instance"}}],(n=[{key:"fetchByOwner",value:function(e,t){return null==t&&(t={}),e=e.id||e,null==t.data&&(t.data={}),t.data.ownerID=e,this.fetch(t)}},{key:"fetchForClassroom",value:function(e,t){return null==t&&(t={}),e=e.id||e,null==t.data&&(t.data={}),t.data.classroomID=e,this.fetch(t)}},{key:"fetchByClassrooms",value:function(e,t){return null==t&&(t={}),null==(t=_.extend({url:"/db/course_instance/-/by-classrooms"},t)).data&&(t.data={}),t.data.classroomIds=e,this.fetch(t)}}])&&s(r.prototype,n),i&&s(r,i),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n,i}(p)).initClass(),f)},912830:(e,t,r)=>{var n,o=r(619755);function s(e){return s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s(e)}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,c(n.key),n)}}function c(e){var t=function(e,t){if("object"!=s(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t);if("object"!=s(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==s(t)?t:t+""}function a(e,t,r){return t=f(t),function(e,t){if(t&&("object"==s(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,l()?Reflect.construct(t,r||[],f(e).constructor):t.apply(e,r))}function l(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(l=function(){return!!e})()}function f(e){return f=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},f(e)}
1function h(e,t){return h=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},h(e,t)}r(471413);var p=r(976911),d=r(249449),y=r(609838),m=r(573131),g=r(759075),v=r(318038),b=r(579483),w=r(34088),C=r(299498),S=r(86856),O=r(7288),k=r(739572);function j(e,t){return null!=e?t(e):void 0}e.exports=((n=function(e){function t(){return i(this,t),a(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&h(e,t)}(t,e),n=t,s=[{key:"getTitle",value:function(){return"Anonymous"===this.user.broadName()?"Certificate":"Certificate: ".concat(this.user.broadName())}},{key:"hashString",value:function(e){return function(e,t,r){for(var n=[],o=0<t,s=t,i=0;o?i<s:i>s;o?i++:i--)n.push(i);return n}(0,e.length).map((function(t){return e.charCodeAt(t)})).reduce((function(e,t){return(e<<5)+e+t}),5381)}},{key:"initialize",value:function(e,t){var r=this;this.userID=t,this.multipleCoursesStats={},this.utils=C,this.userID===me.id?(this.user=me,C.isCodeCombat&&this.setHero()):(this.user=new d({_id:this.userID}),this.user.fetch(),this.supermodel.trackModel(this.user),C.isCodeCombat&&this.listenToOnce(this.user,"sync",(function(){return"function"==typeof r.setHero?r.setHero():void 0})),this.user.fetchNameForClassmate({success:function(e){return r.studentName=d.broadName(e),"function"==typeof r.render?r.render():void 0}}));var n=C.getQueryVariable("class");n&&(this.classroom=new y({_id:n}),this.classroom.fetch(),this.supermodel.trackModel(this.classroom),this.listenToOnce(this.classroom,"sync",this.onClassroomLoaded),this.courseInstances=new k,this.supermodel.trackRequest(this.courseInstances.fetchForClassroom(this.classroom.get("_id"))),this.listenToOnce(this.courseInstances,"sync",this.loadStats));var o=9e7;("undefined"!=typeof features&&null!==features?features.chinaUx:void 0)&&(this.certificateNumber=(this.hashString(this.user.id+this.courseInstanceID)%o+o)%o+1e7),this.currentLang=me.get("preferredLanguage",!0),this.needLanguageToggle="en"!==this.currentLang.split("-")[0]}},{key:"setHero",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return t||(t=C.getQueryVariable("hero")||j(this.user.get("heroConfig"),(function(e){return e.thangType}))||b.heroes.captain),this.thangType=new w,this.supermodel.trackRequest(this.thangType.fetchLatestVersion(t,{data:{project:"slug,version,original,extendedName,heroClass"}})),this.thangType.once("sync",(function(t){if("Warrior"!==e.thangType.get("heroClass"))return e.setHero(b.heroes.captain)}))}},{key:"onClassroomLoaded",value:function(){var e=this;if(this.loadStats(),me.id!==this.classroom.get("ownerID"))return new d({_id:this.classroom.get("ownerID")}).fetchNameForClassmate({success:function(t){return e.teacherName=d.broadName(t),"function"==typeof e.render?e.render():void 0}});this.teacherName=me.broadName()}},{key:"loadStats",value:function(){var e=this;if(this.courseInstances.loaded&&this.classroom.loaded){var t=this.classroom.get("courses").map((function(e){return e._id}));if(this.courseInstances.models.forEach((function(e){var r=e.get("courseID");t=t.filter((function(e){return e!==r}))})),!t.length)return this.courseInstances.models.forEach((function(t){var r=t.get("courseID"),n=new g,o=new v,s=new m({_id:r}),i=function(){if(n.loaded&&o.loaded&&s.loaded&&e.multipleCoursesStats)return e.multipleCoursesStats[t.get("_id")]=e.classroom.statsForSessions(n,t.get("courseID"),o),e.multipleCoursesStats[t.get("_id")].sessions=n,e.multipleCoursesStats[t.get("_id")].course=s,e.mergeStats()};return n.fetchForCourseInstance(t.get("_id"),{userID:e.userID,data:{project:"state.complete,level.original,playtime,changed,code,codeLanguage,team"}}),e.listenToOnce(n,"sync",i),o.fetchForClassroomAndCourse(e.classroom.get("_id"),t.get("courseID"),{data:{project:"concepts,practice,assessment,primerLanguage,type,slug,name,original,description,shareable,i18n,thangs.id,thangs.components.c
1onfig.programmableMethods"}}),e.listenToOnce(o,"sync",i),s.fetch(),e.listenToOnce(s,"sync",i)}));this.multipleCoursesStats=null}}},{key:"getCodeLanguageName",value:function(){return this.classroom?this.course&&/web-dev-1/.test(this.course.get("slug"))?"HTML/CSS":this.course&&/web-dev/.test(this.course.get("slug"))?"HTML/CSS/JS":this.classroom.capitalizeLanguageName():"Code"}},{key:"mergeStats",value:function(){var e=this;return this.projectLinks=[],this.courseStats={levels:{numDone:0},linesOfCode:0},this.concepts=[],function(){for(var t=[],r=function(){var r,s,i=o[n];if(!i.courseComplete)return e.multipleCoursesStats=null,1;if(e.courseStats.levels.numDone+=i.levels.numDone,e.courseStats.linesOfCode+=i.linesOfCode,e.concepts=_.uniq(e.concepts.concat(i.course.get("concepts").slice().reverse().slice(0,10))),i.levels.project){var u=i.sessions.find((function(e){return e.get("level").original===i.levels.project.get("original")}));u?t.push((r="".concat(window.location.origin,"/play/").concat(i.levels.project.get("type"),"-level/").concat(u.id),s={link:r},e.projectLinks.push(s),S("/db/level.session/short-link",{method:"POST",json:{url:r}}).then((function(t){return s.shortLink=t.shortLink,e.render()})))):t.push(void 0)}else t.push(void 0)},n=0,o=Array.from(Object.values(e.multipleCoursesStats));n<o.length;n++)r();return t}()}},{key:"onClickPrintButton",value:function(){return window.print()}},{key:"onClickToggleButton",value:function(){var e=this,t="en";return"en"===this.currentLang.split("-")[0]&&(t=me.get("preferredLanguage",!0)),this.currentLang=t,o.i18n.changeLanguage(t,(function(){return O.load(t).then((function(){return e.render()}))}))}},{key:"afterRender",value:function(){return this.autoSizeText(".student-name")}},{key:"autoSizeText",value:function(e){return this.$(e).each((function(e,t){return function(){for(var e=[];t.scrollWidth>t.offsetWidth||t.scrollHeight>t.offsetHeight;){var r=.95*parseFloat(o(t).css("font-size").slice(0,-2))+"px";e.push(o(t).css("font-size",r))}return e}()}))}}],c=[{key:"initClass",value:function(){this.prototype.id="certificates-view",this.prototype.template=r(613845),this.prototype.events={"click .print-btn":"onClickPrintButton","click .toggle-btn":"onClickToggleButton"}}}],s&&u(n.prototype,s),c&&u(n,c),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,s,c}(p)).initClass(),n)}}]);
2//# sourceMappingURL=AllCoursesCertificatesView-7f1ed464e307a27290f5.bundle.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.