{ "version": 3, "sources": ["../helpers.imba", "img:assets/union.svg", "../pages/allcourses.imba"], "sourcesContent": ["export const levels = {\n\t'1': 'Beginner'\n\t'2': 'Intermediate'\n\t'3': 'Advanced'\n}\n\nexport const colors = [\n\t'lavendar'\n\t'bubble-gum'\n\t'baby'\n\t'crab-cake'\n\t'moss'\n\t'lemony'\n]\nexport const weekdays = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']\nexport const months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']\nexport const bootcamp-price = 199\n\nexport const level-descriptions = \"Beginner = little or no experience in the topic.\\nNoob = learn the basics of the topic\\nIntermediate = reach a professional level.\\nAdvanced = level up your already existing knowledge of the topic\"\n\nexport def avatar-url user, s = 64\n\tif user\n\t\t\"/avatars/uid/{user.id}/{s}\"\n\telse\n\t\t\"/avatars/scrimba/{s}\"\n\nexport def uuid a,b\n\tb = a = ''\n\twhile a++ < 36\n\t\tb += a*51 & 52 ? (a^15 ? 8^Math.random! * (a^20 ? 16 : 4) : 4).toString(16) : '-'\n\treturn b\n\nexport const welcome-scrim = \"/scrim/cof5644d6891c46f3f2e1b3de\";\nexport const karma-notion-page = \"https://scrimba-community-handbook.super.site/how-to-earn-karma-points\"\nexport const rate-limit-message = \"You've been rate limited. Please wait for a few minutes and before trying again.\"\n\nexport class UserTime\n\tprop d\n\n\t# Accepts a epoch timestamp to format a certain date to the user's local timezone and format.\n\t# Optional duration to display a from - to time\n\tconstructor timestamp, duration = 0\n\t\td = new Date(timestamp)\n\t\tdur = duration\n\n\tget user_time do #user_time ||= Intl.DateTimeFormat().resolvedOptions()\n\tget timezone do user_time.timeZone\n\tget locale do user_time.locale\n\tget weekday do new Intl.DateTimeFormat(locale, weekday: 'long').format(d)\n\tget month do new Intl.DateTimeFormat(locale, month: 'long').format(d)\n\tget month_short do new Intl.DateTimeFormat(locale, month: 'short').format(d)\n\tget time\n\t\tlet fmt = new Intl.DateTimeFormat(locale, hour: 'numeric', minute: 'numeric')\n\t\tlet endDate = new Date(d.getTime() + dur * 60000)\n\t\tlet from = fmt.format(d)\n\t\tlet to = fmt.format(endDate)\n\t\tif duration > 0 \n\t\t\t\"{from} - {to}\"\n\t\telse\n\t\t\t\"{from}\"\n\tdef date options = {month: 'short', day: 'numeric'}\n\t\tnew Intl.DateTimeFormat(locale, options).format(d)\n\n\tdef timezone date\n\t\tlet t = new Intl.DateTimeFormat(locale, timeZoneName: 'short').formatToParts(d)\n\t\tlet tz = t.find do $1.type == 'timeZoneName'\n\t\ttz.value\n\n\tdef formatDateDetails date, ev\n\t\tlet details = ''\n\t\tfor tz in infoZones\n\t\t\tlet fmt = new Intl.DateTimeFormat(user_locale, {hour: 'numeric', minute: 'numeric', timeZone: tz})\n\t\t\tdetails += \"{tz}: {fmt.format(date)}\\n\"\n\t\tdetails\n", "import {asset} from 'imba';\nimport url from './union.svg';\nexport default asset({\n\turl: url,\n\ttype: 'svg',\n\tmeta: {\"attributes\":{\"width\":\"25\",\"height\":\"30\",\"viewBox\":\"0 0 25 30\",\"fill\":\"none\"},\"flags\":[],\"content\":\"\\n\\n\"},\n\ttoString: function(){ return this.url;}\n})", "import {levels} from '../helpers'\n\n# basic list of predefined filters\nconst filters = {\n\tshort: do(item) 3600 > item.casts_duration\n\tmedium: do(item) 10800 > item.casts_duration >= 3600\n\tlong: do(item) item.casts_duration >= 10800\n\tpaid: do(item) item.access == 'members'\n\tfree: do(item) item.access == 'users' or item.access == 'guests'\n}\n\nconst topics = {\n\t'': 'All Topics'\n\thtml: 'HTML'\n\tcss: 'CSS'\n\tjavascript: 'Javascript'\n\treact: 'React'\n\tpopular: 'Popular'\n\tai: 'Artificial Intelligence'\n\tother: 'Other'\n}\n\nconst durations = {\n\t'': 'All Durations'\n\tshort: 'Short (<1hr)'\n\tmedium: 'Medium (1-3hr)'\n\tlong: 'Long (>3hr)'\n}\n\nconst prices = {\n\t'': 'Free and Paid'\n\tfree: 'Free'\n\tpaid: 'Paid'\n}\n\ntag allcourses-page\n\n\tcss .all-courses h:>800px bg:$light-moss px: 2.5rem\n\tcss .filter-wrapper m:10px 0 js:flex-start grid-area:f\n\tcss .tiles\n\t\tpos:relative\n\t\tgrid-area:c\n\t\t$cols:1 @570:2 @880:3 @1350:5\n\t\tp@lt-sm:0\n\tcss .nomatch h:100% d:flex jc:center ai:center\n\tcss .filter-toggle\n\t\tpx:6 py:4\n\t\td:hflex j:center rd:lg cursor:pointer us:none\n\t\t@hover td:underline\n\n\tcss .permanent-query-container\n\t\td:vflex @sm:hflex\n\t\tjc:flex-start\n\t\t# max-width:980px\n\t\tm:0 @sm:5 5 1 5\n\t\tbg:transparent\n\n\tcss .neutral-button\n\t\t# Brought from .button - could be extended better\n\t\td:hflex j:center rd:lg cursor:pointer us:none\n\t\tpx:6 py:4\n\t\tw:max-content mx:auto\n\t\ttt:capitalize td:none fs:1.25rem/1.4 @page-scrim:1rem/1.4 fw:bold ff:inherit ws:nowrap td:none @hover:none\n\t\ttween:all 0.1s ease-out\n\t\tbg:transparent\n\t\t@hover bxs:0px 2px 40px 0px rgba(0,0,0,0.3) y:-3px\n\t\t@active bxs:none y:0\n\t\tmax-height:16\n\n\tcss .toggled-parent\n\t\tac:center\n\t\tai:center\n\t\tmb:8\n\n\tcss .toggled-query-container\n\t\td:vflex @lg:hflex\n\t\tja:center\n\t\tp:3 7\n\t\tm@sm:7\n\t\trd:2\n\t\tbg:white\n\t\tbox-shadow: 0px 2px 20px rgba(0, 0, 0, 0.3)\n\t\tmax-width:max-content\n\n\tcss .reset-filters\n\t\td:hflex\n\t\ta:center\n\t\tbg:$light-lemony\n\t\tcursor:pointer\n\t\tp:2.5 3\n\t\trd:3\n\t\tbd: 1px solid\n\t\tfw:bold\n\t\tmax-width:max-content\n\t\tmax-height:16\n\n\tcss .search-box d:flex fld:column mb:20px\n\t\t>> input p:10px 20px bd:0.3px solid rd:3px\n\tcss .checkbox-field \n\t\td:flex ai:center\n\t\t>> input mr:0.5rem scale:scale(1.5)\n\n\tcss .ss-select\n\t\td:flex\n\t\tjc:center \n\t\trd:2\n\t\tm:2\n\t\tbd: 1px solid\n\t\tbg:transparent .selected:white\n\t\t>> select\n\t\t\tcursor:pointer\n\t\t\tfs:16px\n\t\t\tfw:bold\n\t\t\tbd:none\n\t\t\td:block\n\t\t\tappearance:none\n\t\t\tp:14px 50px 14px 26px\n\t\t\trd:4px\n\t\t\tbox-shadow:0px 1px 4px rgba(0, 0, 0, 0.15)\n\t\t\tbg:url(\"/static/art/dropdown_arrow.svg\") no-repeat 85% center\n\t\t\tbgc:white\n\t\t\tfocus@outline:none\n\n\tcss .content\n\t\tmin-width:100% @570:40vw @880:min-content\n\t\tp:0 2\n\n\t\t>> h4 m: 0 2\n\t\t>> .ss-select\n\t\t\t>> select width: 100%\n\t\n\tcss\t.dropdown background:url('/static/art/dropdown_arrow.svg') no-repeat right background-position:right 8% bottom 50% -webkit-appearance:none\n\n\tcss .topics\n\t\td:hflex\n\t\tja:flex-start\n\t\tflw:wrap\n\n\tcss .topic\n\t\td:hflex\n\t\tja: center\n\t\tp:5 5\n\t\th:9\n\t\trd:2\n\t\tm:2\n\t\tbd: 1px solid\n\t\tbox-sizing: border-box\n\t\tbg:transparent .selected:white\n\t\tws:nowrap\n\t\tfw:bold\n\n\tcss only-wide d:none @880:block\n\n\tprop showFilters? = no\n\n\tget query do store.query\n\n\t#courses = null\n\tget courses do\n\t\t#courses ||= store.courses\n\t\tconst {level,price,duration,topic} = query\n\t\treturn #courses unless level or price or duration or topic\n\n\t\t#courses.filter do\n\t\t\tif level and $1.level != level\n\t\t\t\treturn no\n\n\t\t\tif filters[price] and filters[price]($1) == no\n\t\t\t\treturn no\n\n\t\t\tif filters[duration] and filters[duration]($1) == no\n\t\t\t\treturn no\n\n\t\t\tif topic and (!$1.tags or !$1.tags.includes(\"#{topic}\"))\n\t\t\t\treturn no\n\n\t\t\t# TODO: Bring back when we have search again?\n\t\t\t# if q and !$1.title.toLowerCase!.includes(q.toLowerCase!)\n\t\t\t# \treturn no\n\n\t\t\tyes\n\n\tdef hydrate\n\t\tinnerHTML = ''\n\t\tschedule!\n\t\trender!\n\n\tdef mount\n\t\tshowFilters? = !!(store.query.level or store.query.duration or store.query.price)\n\n\tdef reset\n\t\tquery.level = null\n\t\t$level.value = ''\n\t\tquery.duration = null\n\t\t$duration.value = ''\n\t\tquery.price = null\n\t\t$price.value = ''\n\t\timba.commit!\n\n\tdef render\n\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t# \n\t\t\t\t\n\t\t\t\t# \n\t\t\t\t \"Scrimba Courses Library\"\n\t\t\t\n\t\t\t\t<.permanent-query-container>\n\t\t\t\t\t<.topics> for own id, topic of topics\n\t\t\t\t\t\t topic\n\t\t\t\t\t<[d:hflex jc:space-between ai:center mb:2]>\n\t\t\t\t\t\t<.filter-toggle @click=(showFilters? = !showFilters?)>\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t \"Filters\"\n\t\t\t\t\t\t<.neutral-button.reset-filters[d:none] [d@lt-sm:hflex p:2 m:2]=showFilters? @click=reset>\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t

\"Reset\"\n\t\t\t\t\n\t\t\t\t\t<.toggled-query-container>\n\t\t\t\t\t\t<.content>\n\t\t\t\t\t\t\t

\"Level\"\n\t\t\t\t\t\t\t<.ss-select>\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t