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,EAAS,EAAO,CAAA,CAAE,OAAA,CAAQ,KAAhC,CACM,EAAgB,AAAS,EAAT,EAAa,KAAK,EAAxC,AAEA,CAAA,EAAO,KAAA,CAAM,eAAA,CAAkB,CAAC,EAAE,EAAc,CAAC,EAAE,EAAc,CAAC,CAClE,EAAO,KAAA,CAAM,gBAAA,CAAmB,CAAC,EAAE,EAAc,CAAC,CAElD,IAAM,EAAS,EAAgB,EAAU,CACzC,CAAA,EAAO,KAAA,CAAM,gBAAA,CAAmB,CACjC,C,4D","sources":["","frontend/global/progress.js"],"sourcesContent":["(function () {\nvar $6104b92333f17991$exports = {};\nfunction $6104b92333f17991$var$update_progress(data) {\n const progress_parent = getel(\"progress_parent\");\n if (!progress_parent) return;\n data = data[1].filter((x)=>![\n \"BeforeSchool\",\n \"AfterSchool\"\n ].includes(x.kind));\n progress_parent.innerHTML = \"\";\n if (data.length === 0) progress_parent.style.display = \"none\";\n else {\n progress_parent.style.display = \"block\";\n for (const period of data){\n const progress = document.createElement(\"div\");\n progress.classList.add(\"progress_bar\");\n progress.id = `progress_bar_${period.friendly_name.split(\" \").join(\"_\")}`;\n const length = (date_from_api(period.end) - date_from_api(period.start)) / 1000;\n const now = (current_date().getTime() - date_from_api(period.start)) / 1000;\n const position = now / length;\n progress.style.setProperty(\"--width\", `${position * 100}%`);\n progress.title = `${period.friendly_name} progress`;\n progress_parent.append(progress);\n }\n }\n}\nfunction $6104b92333f17991$var$calculate_progress_percent(period) {\n const length = (date_from_api(period.end) - date_from_api(period.start)) / 1000;\n const now = (current_date().getTime() - date_from_api(period.start)) / 1000;\n const position = now / length;\n return position;\n}\nfunction $6104b92333f17991$var$update_progress_circular(period, element) {\n const percent = $6104b92333f17991$var$calculate_progress_percent(period);\n const circle = element.querySelector(\".progress-ring__circle\");\n const radius = circle.r.baseVal.value;\n const circumference = radius * 2 * Math.PI;\n circle.style.strokeDasharray = `${circumference} ${circumference}`;\n circle.style.strokeDashoffset = `${circumference}`;\n const offset = circumference - percent * circumference;\n circle.style.strokeDashoffset = offset;\n}\nwindow.update_progress = $6104b92333f17991$var$update_progress;\nwindow.update_progress_circular = $6104b92333f17991$var$update_progress_circular;\n\n})();\n//# sourceMappingURL=index.627e6cbb.js.map\n","function update_progress(data) {\n\tconst progress_parent = getel('progress_parent');\n\tif (!progress_parent) {\n\t\treturn;\n\t}\n\n\tdata = data[1].filter(x => !['BeforeSchool', 'AfterSchool'].includes(x.kind));\n\n\tprogress_parent.innerHTML = '';\n\tif (data.length === 0) {\n\t\tprogress_parent.style.display = 'none';\n\t} else {\n\t\tprogress_parent.style.display = 'block';\n\t\tfor (const period of data) {\n\t\t\tconst progress = document.createElement('div');\n\t\t\tprogress.classList.add('progress_bar');\n\t\t\tprogress.id = `progress_bar_${period.friendly_name.split(' ').join('_')}`;\n\t\t\tconst length = (date_from_api(period.end) - date_from_api(period.start)) / 1000;\n\t\t\tconst now = (current_date().getTime() - date_from_api(period.start)) / 1000;\n\t\t\tconst position = now / length;\n\t\t\tprogress.style.setProperty('--width', `${position * 100}%`);\n\t\t\tprogress.title = `${period.friendly_name} progress`;\n\t\t\tprogress_parent.append(progress);\n\t\t}\n\t}\n}\n\nfunction calculate_progress_percent(period) {\n\tconst length = (date_from_api(period.end) - date_from_api(period.start)) / 1000;\n\tconst now = (current_date().getTime() - date_from_api(period.start)) / 1000;\n\tconst position = now / length;\n\treturn position;\n}\n\nfunction update_progress_circular(period, element) {\n\tconst percent = calculate_progress_percent(period);\n\n\tconst circle = element.querySelector('.progress-ring__circle');\n\n\tconst radius = circle.r.baseVal.value;\n\tconst circumference = radius * 2 * Math.PI;\n\n\tcircle.style.strokeDasharray = `${circumference} ${circumference}`;\n\tcircle.style.strokeDashoffset = `${circumference}`;\n\n\tconst offset = circumference - percent * circumference;\n\tcircle.style.strokeDashoffset = offset;\n}\n\nwindow.update_progress = update_progress;\nwindow.update_progress_circular = update_progress_circular;\n"],"names":["window","update_progress","data","progress_parent","getel","filter","x","includes","kind","innerHTML","length","style","display","period","progress","document","createElement","classList","add","id","friendly_name","split","join","date_from_api","end","start","now","current_date","getTime","position","setProperty","title","append","update_progress_circular","element","percent","$6104b92333f17991$var$calculate_progress_percent","circle","querySelector","radius","r","baseVal","value","circumference","Math","PI","strokeDasharray","strokeDashoffset","offset"],"version":3,"file":"index.627e6cbb.js.map"}