├── challenge #2
├── SergiuNegara
│ └── jsmd
├── hobroker
│ └── find.js
├── README.md
└── egorbwork
│ └── jsmdFinder.js
├── challenge #0
├── nicu-chiciuc
│ ├── readme.md
│ ├── index.html
│ └── dat.gui.min.js
├── hobroker
│ ├── index.html
│ └── triangle.js
├── README.md
└── egorbwork
│ ├── canvas.html
│ └── impossibleTriangle.js
├── challenge #5
└── README.md
├── challenge #4
├── wanoo21
│ ├── index.js
│ └── chemical-symbols.json
├── README.md
├── egorbwork
│ ├── inputPage.html
│ ├── chemicalSymbolsApplication.js
│ ├── chemicalSymbolsStringFinder.js
│ └── chemicalSymbolsMap.js
├── oresh
│ └── index.js
└── slkelevro
│ └── jmsd-challenge4.html
├── challenge #1
├── README.md
├── hobroker
│ └── chemistry.js
├── oresh
│ └── index.js
├── vlebedeff
│ └── formula.js
└── egorbwork
│ └── chemicalFormulasParser.js
├── README.md
├── challenge #6
└── README.md
└── challenge #3
└── README.md
/challenge #2/SergiuNegara/jsmd:
--------------------------------------------------------------------------------
1 | function jsmd(o) {
2 | return JSON.stringify(o).indexOf('JSMD') !== -1
3 | }
4 |
--------------------------------------------------------------------------------
/challenge #0/nicu-chiciuc/readme.md:
--------------------------------------------------------------------------------
1 | This folder contains just the distribution.
2 | The full source code is in the repository nicu-chiciuc/impossible-object.
3 |
--------------------------------------------------------------------------------
/challenge #0/nicu-chiciuc/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/challenge #0/hobroker/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
11 | The Impossible Triangle
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/challenge #5/README.md:
--------------------------------------------------------------------------------
1 | # Challenge #5 - Draw the dragon curve
2 | Do you know what is a dragon curve? Find out [here](https://en.wikipedia.org/wiki/Dragon_curve)
3 |
4 | This challenge is about to draw using Canvas API the Dragon curve.
5 |
6 | Use any colors you want (even the rainbow colors), use any line style or animate the drawing.
7 |
8 | Reference example:
9 |
10 |
--------------------------------------------------------------------------------
/challenge #2/hobroker/find.js:
--------------------------------------------------------------------------------
1 | const countOccurrences = (json, word) => {
2 | let temp = JSON.stringify(json);
3 | let substrings = temp.split(word);
4 | return substrings.length - 1;
5 | };
6 |
7 | const tests = [
8 | [[["JSMD"]]],
9 | {a: {b: {c: "JSMD"}}},
10 | {a: ["random-string", "JSDM", "JMSD", "J S M D", "BDSM"]}
11 | ];
12 |
13 | tests.forEach(item => {
14 | console.log(JSON.stringify(item), countOccurrences(item, "JSMD"))
15 | });
16 |
--------------------------------------------------------------------------------
/challenge #0/README.md:
--------------------------------------------------------------------------------
1 | # Challenge #0 - The Impossible Triangle
2 | Draw using Canvas API the impossible triangle of Reutersvärd.
3 |
4 | Example:
5 |
6 |
7 |
8 | Optional condition is to make the triangle animated.
9 |
10 | Example:
11 |
12 |
--------------------------------------------------------------------------------
/challenge #0/egorbwork/canvas.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Impossible Triangle
6 |
7 |
8 |
9 |
10 |
11 |
12 | To be able to see content, please use a modern version of Chrome or Firefox!
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/challenge #4/wanoo21/index.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | const symbols = require('./chemical-symbols.json')
4 | const phrase = process.argv[3] || 'NICU'
5 |
6 | const findSymbols = (() => {
7 | const foundSymbols = []
8 | symbols.forEach(symbol => {
9 | const output = new RegExp(symbol.symbol, 'i').exec(phrase)
10 | output && foundSymbols.push(Object.assign(symbol, { index: output.index }))
11 | })
12 | return foundSymbols.sort((s, s2) => s.index - s2.index).map(symbol => {
13 | delete symbol.index
14 | return symbol
15 | })
16 | })()
17 |
18 | console.log(findSymbols)
19 |
--------------------------------------------------------------------------------
/challenge #4/README.md:
--------------------------------------------------------------------------------
1 | # Challenge #4 - Chemical symbols from words
2 | This challenge consists in creating a function that will receive as argument a string of latin letters from which the output is created as chemical symbols. As a simple task it should return only one set of possible combinations, as a more complex task it should return multiple combinations (maybe all?) of chemical symbols.
3 |
4 | Examples:
5 |
6 | I will use my name
7 | ```js
8 | 'Nicu' // => ['N', 'I', 'C', 'U'] or ['Ni', 'Cu']
9 | ```
10 |
11 | The best place in the world
12 | ```js
13 | 'Moldova' // => ['Mo', 'O', 'V'] not all characters can be used :(
14 | ```
--------------------------------------------------------------------------------
/challenge #2/README.md:
--------------------------------------------------------------------------------
1 | # Challenge #2 - Find "JSMD"
2 | Write a function that will receive as a parameter an object, which can have any structure, and finds in this object the string `"JSMD"`. The function should return `true` if the string was found and `false` - otherwise.
3 |
4 | Examples:
5 | ```js
6 | [ [ [ "JSMD" ] ] ] // => true
7 |
8 | { a: { b: { c: "JSMD" } } } // => true
9 |
10 | { a: [ "random-string", "JSDM", "JMSD", "J S M D", "BDSM" ] } // => false
11 | ```
12 |
13 | An additional condition would be to make the function more complex and find all the occurrences of the string in the object and return the number of occurrences.
--------------------------------------------------------------------------------
/challenge #2/egorbwork/jsmdFinder.js:
--------------------------------------------------------------------------------
1 | function findWordOccurrencesInInput(input, word = 'JSMD') {
2 | let stringifiedInput = JSON.stringify(input);
3 | let regexp = RegExp(word, 'g');
4 | let matches;
5 |
6 | if (matches = stringifiedInput.match(regexp)) {
7 | return matches.length;
8 | } else {
9 | return 0;
10 | }
11 | }
12 |
13 | function testFindWordOccurrencesInInput() {
14 | console.log(findWordOccurrencesInInput([ [ [ "JSMD" ] ] ]));
15 | console.log(findWordOccurrencesInInput({ a: { b: { c: "JSMD" } } }));
16 | console.log(findWordOccurrencesInInput({ a: { b: { c: 'JSMD' }, d: "JSMD", JSMD: '22', text: '\'JSMD\'"JSMD"' } }));
17 | console.log(findWordOccurrencesInInput({ a: [ "random-string", "JSDM", "JMSD", "J S M D", "BDSM" ] }));
18 | }
19 |
20 | testFindWordInInput();
21 |
--------------------------------------------------------------------------------
/challenge #4/egorbwork/inputPage.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Chemical symbols searcher page
6 |
7 |
8 |
9 |
10 |
11 |
12 |
Strategies:
13 |
Single Character first
14 |
15 |
Pair of Character first
16 |
17 |
Input for chemical symbols search:
18 |
19 |
Find Chemical symbols
20 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/challenge #4/egorbwork/chemicalSymbolsApplication.js:
--------------------------------------------------------------------------------
1 | var finder = new ChemicalSymbolsStringFinder(chemicalSymbols);
2 |
3 | document.addEventListener('DOMContentLoaded', function() {
4 | document.getElementById('findSymbolsButton').addEventListener('click', findChemicalSymbols);
5 | });
6 |
7 | function findChemicalSymbols() {
8 | let resultContainer = document.getElementById('resultContainer');
9 | resultContainer.innerHTML = '';
10 | let textInput = document.getElementById('stringForSearch');
11 | let radioButtons = document.getElementsByName('find-strategy');
12 | let strategy = 'single-first';
13 | for (let radioButton of radioButtons) {
14 | if (radioButton.checked) {
15 | strategy = radioButton.value;
16 | }
17 | }
18 |
19 | try {
20 | let result = finder.find(textInput.value, strategy);
21 |
22 | resultContainer.innerHTML = result.length ? result.toString(): 'Nothing found';
23 | } catch (exception) {
24 | alert(exception);
25 | }
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/challenge #1/README.md:
--------------------------------------------------------------------------------
1 | # Challenge #1 - Chemical Formulas Parser
2 | Write a function that will receive as a parameter a string that will contain a chemical formula, `H20` (water) for example, and will return an object which should contain how many atoms are of each type:
3 | ```js
4 | {
5 | H: 2
6 | O: 1
7 | }
8 | ```
9 |
10 | Take in consideration that the name of some atoms can have to letters, one uppercased letter and another lowercased letter like `Li`.
11 |
12 | Some atoms can be found multiple times in the formula, like for `CH3COOH` (acetic acid) as a result we need:
13 | ```js
14 | {
15 | C: 2,
16 | H: 4,
17 | O: 2
18 | }
19 | ```
20 |
21 | Some formulas can contain round and square brackets, which should also be parsed accordingly, examples:
22 |
23 | Aluminium Sulfacetate formula: `Al2SO4(CH3CO2)4`
24 | ```js
25 | {
26 | Al: 2,
27 | S: 1,
28 | O: 12,
29 | C: 8,
30 | H: 12
31 | }
32 | ```
33 |
34 | Fremy Salt formula: `K4[ON(SO3)2]2`
35 | ```js
36 | {
37 | K: 4,
38 | O: 14,
39 | N: 2,
40 | S: 4
41 | }
42 | ```
--------------------------------------------------------------------------------
/challenge #1/hobroker/chemistry.js:
--------------------------------------------------------------------------------
1 | const splitFormula = /[A-Z][a-z]?\d*|\(.*?\)\d+|\[.*?]\d+/g;
2 | const splitElements = /\d+|\D+/g;
3 |
4 | const parseFormula = (formula, final = {}, multiply = 1) => {
5 | let splitted = formula.match(splitFormula);
6 | splitted.forEach(mole => {
7 | if (mole.includes('[')) {
8 | let exploded = mole.split(']');
9 | exploded[0] = exploded[0].substr(1);
10 | final = parseFormula(exploded[0], final, multiply * parseInt(exploded[1]));
11 | } else if (mole.includes('(')) {
12 | let exploded = mole.split(')');
13 | exploded[0] = exploded[0].substr(1);
14 | final = parseFormula(exploded[0], final, parseInt(exploded[1]) * multiply);
15 | } else {
16 | let exploded = mole.match(splitElements);
17 | final[exploded[0]] = final[exploded[0]] || 0;
18 | exploded[1] = parseInt(exploded[1]) || 1;
19 | final[exploded[0]] += exploded[1] * multiply;
20 | }
21 | });
22 | return final;
23 | };
24 |
25 | const tests = [
26 | 'H2O',
27 | 'CH3COOH',
28 | 'Al2SO4(CH3CO2)40',
29 | 'K4[ON(SO3)2]2'
30 | ];
31 |
32 | tests.forEach(formula => {
33 | let parsed = parseFormula(formula);
34 | console.log(formula, parsed)
35 | });
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Challenges
2 | Solutions to the JSMD Challenges
3 |
4 | # Info
5 | This repo contains the solutions to the JSMD Challenges, which are solved by the members of the JSMD community. You can make a pull request to the directory of the solved challenge, anytime, even when the challenge contest ended. The structure of the repo is the following:
6 |
7 | ```
8 | [root]
9 | |-- challenge #0
10 | | |--README.md
11 | | |-- [solution by author name #1]
12 | | | |-- file1
13 | | | |-- file2
14 | | | ...
15 | | | +-- fileN
16 | | |-- [solution by author name #2]
17 | | | |-- file1
18 | | | |-- file2
19 | | | ...
20 | | | +-- fileN
21 | | |-- [solution by author name #3]
22 | | | |-- file1
23 | | | |-- file2
24 | | | ...
25 | | | +-- fileN
26 | | +-- README.md
27 | |-- challenge #1
28 | | |--README.md
29 | | |-- [solution by author name #1]
30 | | | |-- file1
31 | | | ...
32 | | ...
33 | |-- challenge #N
34 | | |-- README.md
35 | | |-- [solution by author name #1]
36 | | | |-- file1
37 | | | ...
38 | | ...
39 | +-- README.md
40 | ```
41 |
42 | We hope you will enjoy solving our challenges, good luck and have fun :)
--------------------------------------------------------------------------------
/challenge #1/oresh/index.js:
--------------------------------------------------------------------------------
1 | function count(str) {
2 | var out = {};
3 | for (var i = str.length-1, el_length = 1; i >= 0; i-- && el_length++) {
4 | if (str[i] != str[i].toLowerCase()) {
5 | var element = str.substr(i, el_length)
6 | if (out[element]) out[element] += 1; else out[element] = 1
7 | el_length = 0
8 | }
9 | }
10 | return out;
11 | }
12 |
13 | function replacer(input, regExp) {
14 | var numbReg = new RegExp(/[0-9]+/)
15 | while (find = regExp.exec(input)) {
16 | if (find[0].indexOf('(') == 0) {
17 | var parsed = find[0].split(')')
18 | var insert = parsed[0].slice(1).repeat(parsed[1])
19 | } else {
20 | var number = numbReg.exec(find[0])
21 | var insert = find[0].split(number)[0].repeat(number)
22 | }
23 | var parts = [input.indexOf(find[0]), find[0].length]
24 | input = input.slice(0, parts[0]) + insert + input.slice(parts[0] + parts[1], input.length)
25 | }
26 | return input;
27 | }
28 |
29 | function parseFormula(input) {
30 | input = input.replace(/\[/g, "(").replace(/\]/g, ")")
31 | input = replacer(input, new RegExp(/\([0-9a-zA-Z]+\)[0-9]+/))
32 | input = replacer(input, new RegExp(/[A-Z][0-9]+/))
33 | input = replacer(input, new RegExp(/[A-Z][a-z][0-9]+/))
34 | return count(input);
35 | }
36 |
37 | console.log(parseFormula("CH3COOH"));
38 | console.log(parseFormula("Al2SO4(CH3CO2)4"));
39 | console.log(parseFormula("K4[ON(SO3)2]2"));
--------------------------------------------------------------------------------
/challenge #6/README.md:
--------------------------------------------------------------------------------
1 | # Challenge #6 - Cloud Generator
2 | This challenge is about generating a random cloud-like shape created from 2 or more circles, the output can be implemented in Canvas API or SVG. So the actual challenge consists in creating a function which must accept one argument which is a integer number greater or equal to `2` and output graphics which represent the generated "cloud". There are some rules:
3 |
4 | 1. The generated circles centers coordinates must NOT coincide
5 | 2. There should be NO circles which are just tangent with the others or totally separated
6 | 3. There should be NO circles which are totally overlapped by the area of other circles
7 | 4. In the output only the outline of the shape has to be drawn
8 | 5. Size constraints, circle radius: 10 - 1000px, outline width: 5px
9 | 6. For simplicity of the challenge, please use only integer numbers
10 |
11 | Simplest example:
12 |
13 |
14 | Bad example:
15 |
16 |
17 |
18 | Another bad example:
19 |
20 |
21 |
22 | A more complex example:
23 |
24 |
25 |
26 | With circles visible:
27 |
28 |
29 |
30 | Bad example with circles totally being overlapped:
31 |
32 |
--------------------------------------------------------------------------------
/challenge #3/README.md:
--------------------------------------------------------------------------------
1 | # Challenge #3 - Chain system with gears
2 | Draw using Canvas API or maybe in SVG, a chain system connected with multiple gears.
3 |
4 | Based on the input gears the chain system should be created. As basic requirement the chain may not be animated, for more advanced solutions it should be animated.
5 |
6 | Example:
7 |
8 | Here is defined the chain system:
9 |
10 | ```js
11 | [{
12 | x: 0,
13 | y: 0,
14 | r: 16
15 | }, {
16 | x: 100,
17 | y: 0,
18 | r: 16
19 | }, {
20 | x: 100,
21 | y: 100,
22 | r: 12
23 | }, {
24 | x: 50,
25 | y: 50,
26 | r: 24
27 | }, {
28 | x: 0,
29 | y: 100,
30 | r: 12
31 | }]
32 | ```
33 |
34 | Here is the animated version:
35 |
36 |
37 |
38 | Size instructions:
39 |
40 |
41 |
42 |
43 |
44 | Some more examples:
45 |
46 | ```js
47 | [{
48 | x: 0,
49 | y: 0,
50 | r: 26
51 | }, {
52 | x: 120,
53 | y: 0,
54 | r: 26
55 | }]
56 | ```
57 |
58 |
59 |
60 |
61 | ```js
62 | [{
63 | x: 100,
64 | y: 100,
65 | r: 60
66 | }, {
67 | x: 220,
68 | y: 100,
69 | r: 14
70 | }]
71 | ```
72 |
73 |
74 |
75 | ```js
76 | [{
77 | x: 100,
78 | y: 100,
79 | r: 16
80 | }, {
81 | x: 100,
82 | y: 0,
83 | r: 24
84 | }, {
85 | x: 0,
86 | y: 100,
87 | r: 24
88 | }, {
89 | x: 0,
90 | y: 0,
91 | r: 16
92 | }
93 | ```
94 |
95 |
--------------------------------------------------------------------------------
/challenge #4/oresh/index.js:
--------------------------------------------------------------------------------
1 | let elements = [
2 | 'H', 'He', 'Li', 'Be', 'B', 'C', 'N', 'O', 'F', 'Ne', 'Na', 'Mg', 'Al',
3 | 'Si', 'P', 'S', 'Cl', 'Ar', 'K', 'Ca', 'Sc', 'Ti', 'V', 'Cr', 'Mn', 'Fe',
4 | 'Co', 'Ni', 'Cu', 'Zn', 'Ga', 'Ge', 'As', 'Se', 'Br', 'Kr', 'Rb', 'Sr', 'Y',
5 | 'Zr', 'Nb', 'Mo', 'Tc', 'Ru', 'Rh', 'Pd', 'Ag', 'Cd', 'In', 'Sn', 'Sb',
6 | 'Te', 'I', 'Xe', 'Cs', 'Ba', 'La', 'Ce', 'Pr', 'Nd', 'Pm', 'Sm', 'Eu', 'Gd',
7 | 'Tb', 'Dy', 'Ho', 'Er', 'Tm', 'Yb', 'Lu', 'Hf', 'Ta', 'W', 'Re', 'Os', 'Ir',
8 | 'Pt', 'Au', 'Hg', 'Tl', 'Pb', 'Bi', 'Po', 'At', 'Rn', 'Fr', 'Ra', 'Ac',
9 | 'Th', 'Pa', 'U', 'Np', 'Pu', 'Am', 'Cm', 'Bk', 'Cf', 'Es', 'Fm', 'Md', 'No',
10 | 'Lr', 'Rf', 'Db', 'Sg', 'Bh', 'Hs', 'Mt', 'Ds', 'Rg', 'Cn', 'Nh', 'Fl',
11 | 'Mc', 'Lv', 'Ts', 'Og'
12 | ]
13 |
14 | class ElementSearch {
15 | get_variants (str) {
16 | this.search_for = str;
17 | this.start_search(str, '', []);
18 | }
19 | start_search (str, word, combination) {
20 | let flag = false;
21 | if (word.length == str.length) {
22 | console.log('word', word, ', combination', combination);
23 | return;
24 | }
25 | for (let i = 0, len = elements.length; i < len; i++) {
26 | let new_word = word + elements[i];
27 | if (str.toLowerCase().indexOf(new_word.toLowerCase()) === 0) {
28 | flag = true;
29 | let newcomb = combination.slice(0);
30 | newcomb.push(elements[i]);
31 | this.start_search(str, new_word, newcomb);
32 | }
33 | }
34 | if (!flag) {
35 | let new_str = str.slice(0, word.length) + str.slice(word.length + 1);
36 | this.start_search(new_str, word, combination);
37 | }
38 | }
39 | }
40 |
41 | d = new ElementSearch();
42 | d.get_variants('Nicu')
43 | d.get_variants('Moldova')
--------------------------------------------------------------------------------
/challenge #1/vlebedeff/formula.js:
--------------------------------------------------------------------------------
1 | class Formula {
2 |
3 | constructor(source) {
4 | this.source = source;
5 | }
6 |
7 | atomCount() {
8 | const tokens = this.tokens();
9 | const factors = [1];
10 | const counts = {};
11 | let currentFactor = 1;
12 |
13 | while (tokens.length > 0) {
14 | let token = tokens.pop();
15 | if (Number(token)) {
16 | currentFactor = Number(token);
17 | } else if (token === ")") {
18 | factors.push(currentFactor);
19 | currentFactor = 1;
20 | } else if (token === "(") {
21 | factors.pop();
22 | } else {
23 | counts[token] = (counts[token] || 0) + factors.reduce((acc, f) => acc * f, currentFactor);
24 | currentFactor = 1;
25 | }
26 | }
27 | return counts;
28 | }
29 |
30 | tokens() {
31 | const uniformGroupFormula = this.source.replace("[", "(").replace("]", ")");
32 | return Array.from(uniformGroupFormula).reduce((tokens, ch) => {
33 | const lastToken = tokens[tokens.length - 1];
34 | if (tokens.length > 0 && (this.isAtomPart(ch) || this.areFactorParts(lastToken, ch))) {
35 | tokens[tokens.length - 1] = `${lastToken}${ch}`;
36 | return tokens;
37 | } else {
38 | return [...tokens, ch];
39 | }
40 | }, []);
41 | }
42 |
43 | areFactorParts(part1, part2) {
44 | return !isNaN(part1) && !isNaN(part2);
45 | }
46 |
47 | isAtomPart(ch) {
48 | return ch !== "("
49 | && ch !== ")"
50 | && isNaN(ch)
51 | && (ch === ch.toLowerCase());
52 | }
53 | }
54 |
55 | function logFormulae() {
56 | ["H2O", "CH3COOH", "Al2SO4(CH3CO2)4", "K4[ON(SO3)2]2"].forEach((f) => {
57 | console.log(f, new Formula(f).atomCount());
58 | });
59 | }
60 |
61 | logFormulae();
62 |
--------------------------------------------------------------------------------
/challenge #0/hobroker/triangle.js:
--------------------------------------------------------------------------------
1 | const box = document.getElementById("sheet");
2 | const ctx = box.getContext("2d");
3 |
4 | const COLORS = ['#FFD700', '#FF6347', '#008080'];
5 | const SIZE = 80;
6 | const CANVAS_SIZE = 650;
7 | const ANIMATION_INTERVAL = 20;
8 | const ANIMATION_MOVE_DISTANCE = 2;
9 |
10 | const draw = (point, orientation, sides = [1, 2, 3]) => {
11 | orientation = orientation || [[1, 2, 3], []];
12 | let points = {1: [], 2: [], 3: []},
13 | c = 0, x, y;
14 | [x, y] = [point.x, point.y];
15 | for (let angle = 0; angle < 360; angle += 360 / 6) {
16 | const point = {
17 | x: getEndPoint.x(x, angle, SIZE),
18 | y: getEndPoint.y(y, angle, SIZE)
19 | };
20 | if ([0, 1, 2].includes(c)) points[1].push(point);
21 | if ([2, 3, 4].includes(c)) points[2].push(point);
22 | if ([4, 5, 6].includes(c)) points[3].push(point);
23 | c++;
24 | }
25 | points[3].push({
26 | x: x + SIZE,
27 | y: y
28 | });
29 | sides.filter(Number).forEach(side => {
30 | ctx.globalCompositeOperation = orientation[0].includes(side) ? 'destination-over' : orientation[1].includes(side) ? 'source-over' : 'source-over';
31 | ctx.fillStyle = COLORS[side - 1];
32 | ctx.beginPath();
33 | ctx.moveTo(x, y);
34 | points[side].forEach(point => ctx.lineTo(point.x, point.y));
35 | ctx.closePath();
36 | ctx.fill();
37 | });
38 | };
39 |
40 | window.onload = () => {
41 | box.width = box.height = CANVAS_SIZE;
42 | const half = CANVAS_SIZE / 2;
43 | let points = [], x, y;
44 | let DIST = 0;
45 | setInterval(() => {
46 | points = [];
47 | if ((DIST += ANIMATION_MOVE_DISTANCE) > SIZE * 1.5)
48 | DIST = ANIMATION_MOVE_DISTANCE;
49 | const path = [
50 | {
51 | cubes: [0],
52 | sides: [1, 2, (DIST <= 70 ? 3 : 0)]
53 | }, {
54 | cubes: [1, 2, 3, 4, 5, 6, 7],
55 | }, {
56 | cubes: [8],
57 | orientation: [
58 | [3, (DIST > 70 ? 2 : 0)],
59 | [1, (DIST <= 70 ? 2 : 0)]
60 | ]
61 | }, {
62 | cubes: [0],
63 | sides: [(DIST >= 70 ? 3 : '')]
64 | }
65 | ];
66 | ctx.clearRect(0, 0, box.width, box.height);
67 | let move = {x: 0, y: 0};
68 | x = half;
69 | y = SIZE;
70 | move = {
71 | x: getEndPoint.x(x, 300, DIST) - x,
72 | y: getEndPoint.y(y, 300, DIST) - y,
73 | };
74 | points.push({
75 | x: x + move.x,
76 | y: y + move.y
77 | });
78 | [[240, 3], [0, 3], [120, 2]].forEach(direction => {
79 | for (let i = 0; i < direction[1]; i++) {
80 | let id = points.length;
81 | x = getEndPoint.x(x, direction[0], SIZE + SIZE / 2);
82 | y = getEndPoint.y(y, direction[0], SIZE + SIZE / 2);
83 | if ([8, 7].includes(id))
84 | move = {
85 | x: getEndPoint.x(x, 300, DIST) - x,
86 | y: getEndPoint.y(y, 300, DIST) - y,
87 | };
88 | else if ([6, 5, 4].includes(id))
89 | move = {
90 | x: getEndPoint.x(x, 300, -DIST * 2) - x,
91 | y: 0
92 | };
93 | else if ([3, 2, 1].includes(id))
94 | move = {
95 | x: getEndPoint.x(x, 300, DIST) - x,
96 | y: getEndPoint.y(y, 300, -DIST) - y,
97 | };
98 | points.push({
99 | x: x + move.x,
100 | y: y + move.y
101 | });
102 | }
103 | });
104 | path.forEach(item => item.cubes.forEach(cube => draw(points[cube], item.orientation, item.sides)));
105 | }, ANIMATION_INTERVAL)
106 | };
107 |
108 | const getEndPoint = {
109 | x: (x, angle, size) => x + size * Math.cos(angle / 180 * Math.PI),
110 | y: (y, angle, size) => y - size * Math.sin(angle / 180 * Math.PI)
111 | };
112 |
113 |
--------------------------------------------------------------------------------
/challenge #4/egorbwork/chemicalSymbolsStringFinder.js:
--------------------------------------------------------------------------------
1 | class ChemicalSymbolsStringFinder {
2 | constructor(chemicalSymbols) {
3 | this.chemicalSymbols = chemicalSymbols;
4 | this.strategies = ['single-first', 'pair-first'];
5 | }
6 |
7 | find(stringForParsing, strategy = 'single-first') {
8 |
9 | this.validateInput(stringForParsing, strategy);
10 |
11 | let variantGenerator, result = [], isIterationFinished, wasSymbolValid = false;
12 |
13 | if (strategy === 'pair-first') {
14 | variantGenerator = this.chemicalSymbolsVariantsPairFirstGenerator(stringForParsing);
15 | } else if (strategy === 'single-first') {
16 | variantGenerator = this.chemicalSymbolsVariantsSingleFirstGenerator(stringForParsing);
17 | }
18 |
19 | do {
20 | let chemicalSymbolVariant;
21 | ({value: chemicalSymbolVariant, done: isIterationFinished} = variantGenerator.next(wasSymbolValid));
22 |
23 | if (this.chemicalSymbols.has(chemicalSymbolVariant)) {
24 | result.push(this.chemicalSymbols.get(chemicalSymbolVariant));
25 | wasSymbolValid = true;
26 | } else {
27 | wasSymbolValid = false;
28 | }
29 | } while (!isIterationFinished);
30 |
31 | return result;
32 | }
33 |
34 | validateInput(stringForParsing, strategy) {
35 | if (!this.strategies.includes(strategy)) {
36 | throw 'Strategy unknown!';
37 | }
38 | let regexValidator = /[A-Za-z]+/;
39 | if (!regexValidator.test(stringForParsing)) {
40 | throw 'Invalid string provided!';
41 | }
42 | }
43 |
44 | * chemicalSymbolsVariantsSingleFirstGenerator(stringForParsing) {
45 | let wasUsed = false;
46 | for (
47 | let currentCharacterPosition = 0, nextCharacterPosition = 1, stringLength = stringForParsing.length;
48 | nextCharacterPosition < stringLength;
49 | currentCharacterPosition++, nextCharacterPosition++
50 | ) {
51 | if (wasUsed) {
52 | // If This character was used at previous iteration, reset was used status and skip this iteration
53 | wasUsed = false;
54 | continue;
55 | } else {
56 | wasUsed = yield stringForParsing[currentCharacterPosition].toLowerCase();
57 | }
58 | if (wasUsed) {
59 | // Next character is not used in this iteration
60 | wasUsed = false;
61 | } else {
62 | wasUsed = yield stringForParsing.substr(currentCharacterPosition, 2).toLowerCase();
63 | }
64 | }
65 | if (!wasUsed) {
66 | // If last character was not used yield it
67 | yield stringForParsing[stringForParsing.length - 1].toLowerCase();
68 | }
69 | }
70 |
71 | * chemicalSymbolsVariantsPairFirstGenerator(stringForParsing) {
72 | let wasUsed = false;
73 | for (
74 | let currentCharacterPosition = 0, nextCharacterPosition = 1, stringLength = stringForParsing.length;
75 | nextCharacterPosition < stringLength;
76 | currentCharacterPosition++, nextCharacterPosition++
77 | ) {
78 | if (wasUsed) {
79 | // If first character was used at previous iteration, skip current iteration and reset was used status
80 | wasUsed = false;
81 | continue;
82 | } else {
83 | wasUsed = yield stringForParsing.substr(currentCharacterPosition, 2).toLowerCase();
84 | }
85 | if (wasUsed) {
86 | // If this character was used before, than it should be skipped
87 | continue;
88 | } else {
89 | yield stringForParsing[currentCharacterPosition].toLowerCase();
90 | }
91 | }
92 | if (!wasUsed) {
93 | yield stringForParsing[stringForParsing.length - 1].toLowerCase();
94 | }
95 | }
96 | }
97 |
--------------------------------------------------------------------------------
/challenge #1/egorbwork/chemicalFormulasParser.js:
--------------------------------------------------------------------------------
1 | class chemicalFormulasParser {
2 | constructor() {
3 | this.chemicalFormulaProcessed = '';
4 | this.regexpSquaresGroup = /\[.*\][0-9]+/g;
5 | this.regexpBracersGroup = /\(.*\)[0-9]+/g;
6 | this.regexBracersMultiplier = /\][0-9]+/g;
7 | this.regexBracersMultiplier = /\)[0-9]+/g;
8 | this.regexpForAtomsGroups = /[A-Z][a-z]?[0-9]*/g;
9 | this.regexpForAtomNumber = /[A-Z][a-z]?|[0-9]+/g;
10 | this.result = {};
11 | }
12 |
13 | parse(chemicalFormula) {
14 | this.result = {};
15 | this.chemicalFormulaProcessed = chemicalFormula;
16 |
17 | this.parseSquaresGroups();
18 | this.parseBracersGroups();
19 | this.parseSimpleAtomGroups();
20 |
21 | return this.result;
22 | }
23 |
24 | parseSquaresGroups() {
25 | let squaresGroupMatches = this.chemicalFormulaProcessed.match(this.regexpSquaresGroup);
26 | let reducedChemicalFormulaProcessed;
27 | for (let squaresGroupMatchKey in squaresGroupMatches) {
28 | let squaresGroup = squaresGroupMatches[squaresGroupMatchKey];
29 | reducedChemicalFormulaProcessed = this.chemicalFormulaProcessed.replace(squaresGroup, '');
30 | this.chemicalFormulaProcessed = squaresGroup;
31 | this.parseSquaresGroup();
32 | }
33 | this.chemicalFormulaProcessed = reducedChemicalFormulaProcessed || this.chemicalFormulaProcessed;
34 | }
35 |
36 | parseSquaresGroup() {
37 | let BracersMultiplierMatches = this.chemicalFormulaProcessed.match(this.regexBracersMultiplier);
38 | let squaresMultiplier = parseInt(BracersMultiplierMatches[0].substr(1));
39 | this.parseBracersGroups(squaresMultiplier);
40 | this.parseSimpleAtomGroups(squaresMultiplier);
41 | }
42 |
43 | parseBracersGroups(multiplier = 1) {
44 | let bracersGroupMatches = this.chemicalFormulaProcessed.match(this.regexpBracersGroup);
45 | let reducedChemicalFormulaProcessed;
46 | for (let bracersGroupMatchKey in bracersGroupMatches) {
47 | let bracersGroup = bracersGroupMatches[bracersGroupMatchKey];
48 | reducedChemicalFormulaProcessed = this.chemicalFormulaProcessed.replace(bracersGroup, '');
49 | this.chemicalFormulaProcessed = bracersGroup;
50 | this.parseBracersGroup(multiplier);
51 | }
52 | this.chemicalFormulaProcessed = reducedChemicalFormulaProcessed || this.chemicalFormulaProcessed;
53 | }
54 |
55 | parseBracersGroup(multiplier = 1) {
56 | let bracersMultiplierMatches = this.chemicalFormulaProcessed.match(this.regexBracersMultiplier);
57 | let bracersMultiplier = parseInt(bracersMultiplierMatches[0].substr(1));
58 | this.parseSimpleAtomGroups(bracersMultiplier * multiplier);
59 | }
60 |
61 | parseSimpleAtomGroups(multiplier = 1) {
62 | let atomGroupMatches = this.chemicalFormulaProcessed.match(this.regexpForAtomsGroups);
63 | for (let atomGroupKey in atomGroupMatches) {
64 | this.parseAtomGroup(atomGroupMatches[atomGroupKey], multiplier);
65 | }
66 | }
67 |
68 | parseAtomGroup(atomGroup, multiplier = 1) {
69 | let parsedAtomNameNumber = atomGroup.match(this.regexpForAtomNumber);
70 | let atomName = parsedAtomNameNumber[0];
71 | let atomNumber = (parsedAtomNameNumber.length > 1) ? parseInt(parsedAtomNameNumber[1]) : 1;
72 | this.addAtomGroup(atomName, atomNumber * multiplier);
73 | }
74 |
75 | addAtomGroup(atomName, atomNumber) {
76 | if (this.result.hasOwnProperty(atomName)) {
77 | this.result[atomName] += atomNumber;
78 | } else {
79 | this.result[atomName] = atomNumber;
80 | }
81 | }
82 | }
83 |
84 | function testParseChemicalFormula() {
85 | let parser = new chemicalFormulasParser();
86 | console.log(parser.parse('H2O'));
87 | console.log(parser.parse('CH3COOH'));
88 | console.log(parser.parse('Al2SO4(CH3CO2)4'));
89 | console.log(parser.parse('K4[ON(SO3)2]2'));
90 | }
91 |
92 | testParseChemicalFormula();
93 |
--------------------------------------------------------------------------------
/challenge #4/egorbwork/chemicalSymbolsMap.js:
--------------------------------------------------------------------------------
1 | var chemicalSymbols = new Map();
2 |
3 | chemicalSymbols.set('h', 'H');
4 | chemicalSymbols.set('he', 'He');
5 | chemicalSymbols.set('li', 'Li');
6 | chemicalSymbols.set('be', 'Be');
7 | chemicalSymbols.set('b', 'B');
8 | chemicalSymbols.set('c', 'C');
9 | chemicalSymbols.set('n', 'N');
10 | chemicalSymbols.set('o', 'O');
11 | chemicalSymbols.set('f', 'F');
12 | chemicalSymbols.set('ne', 'Ne');
13 | chemicalSymbols.set('na', 'Na');
14 | chemicalSymbols.set('mg', 'Mg');
15 | chemicalSymbols.set('al', 'Al');
16 | chemicalSymbols.set('si', 'Si');
17 | chemicalSymbols.set('p', 'P');
18 | chemicalSymbols.set('s', 'S');
19 | chemicalSymbols.set('cl', 'Cl');
20 | chemicalSymbols.set('ar', 'Ar');
21 | chemicalSymbols.set('k', 'K');
22 | chemicalSymbols.set('ca', 'Ca');
23 | chemicalSymbols.set('sc', 'Sc');
24 | chemicalSymbols.set('ti', 'Ti');
25 | chemicalSymbols.set('v', 'V');
26 | chemicalSymbols.set('cr', 'Cr');
27 | chemicalSymbols.set('mn', 'Mn');
28 | chemicalSymbols.set('fe', 'Fe');
29 | chemicalSymbols.set('co', 'Co');
30 | chemicalSymbols.set('ni', 'Ni');
31 | chemicalSymbols.set('cu', 'Cu');
32 | chemicalSymbols.set('zn', 'Zn');
33 | chemicalSymbols.set('ga', 'Ga');
34 | chemicalSymbols.set('ge', 'Ge');
35 | chemicalSymbols.set('as', 'As');
36 | chemicalSymbols.set('se', 'Se');
37 | chemicalSymbols.set('br', 'Br');
38 | chemicalSymbols.set('kr', 'Kr');
39 | chemicalSymbols.set('rb', 'Rb');
40 | chemicalSymbols.set('sr', 'Sr');
41 | chemicalSymbols.set('y', 'Y');
42 | chemicalSymbols.set('zr', 'Zr');
43 | chemicalSymbols.set('nb', 'Nb');
44 | chemicalSymbols.set('mo', 'Mo');
45 | chemicalSymbols.set('tc', 'Tc');
46 | chemicalSymbols.set('ru', 'Ru');
47 | chemicalSymbols.set('rh', 'Rh');
48 | chemicalSymbols.set('pd', 'Pd');
49 | chemicalSymbols.set('ag', 'Ag');
50 | chemicalSymbols.set('cd', 'Cd');
51 | chemicalSymbols.set('in', 'In');
52 | chemicalSymbols.set('sn', 'Sn');
53 | chemicalSymbols.set('sb', 'Sb');
54 | chemicalSymbols.set('te', 'Te');
55 | chemicalSymbols.set('i', 'I');
56 | chemicalSymbols.set('xe', 'Xe');
57 | chemicalSymbols.set('cs', 'Cs');
58 | chemicalSymbols.set('ba', 'Ba');
59 | chemicalSymbols.set('la', 'La');
60 | chemicalSymbols.set('ce', 'Ce');
61 | chemicalSymbols.set('pr', 'Pr');
62 | chemicalSymbols.set('nd', 'Nd');
63 | chemicalSymbols.set('pm', 'Pm');
64 | chemicalSymbols.set('sm', 'Sm');
65 | chemicalSymbols.set('eu', 'Eu');
66 | chemicalSymbols.set('gd', 'Gd');
67 | chemicalSymbols.set('tb', 'Tb');
68 | chemicalSymbols.set('dy', 'Dy');
69 | chemicalSymbols.set('ho', 'Ho');
70 | chemicalSymbols.set('er', 'Er');
71 | chemicalSymbols.set('tm', 'Tm');
72 | chemicalSymbols.set('yb', 'Yb');
73 | chemicalSymbols.set('lu', 'Lu');
74 | chemicalSymbols.set('hf', 'Hf');
75 | chemicalSymbols.set('ta', 'Ta');
76 | chemicalSymbols.set('w', 'W');
77 | chemicalSymbols.set('re', 'Re');
78 | chemicalSymbols.set('os', 'Os');
79 | chemicalSymbols.set('ir', 'Ir');
80 | chemicalSymbols.set('pt', 'Pt');
81 | chemicalSymbols.set('au', 'Au');
82 | chemicalSymbols.set('hg', 'Hg');
83 | chemicalSymbols.set('tl', 'Tl');
84 | chemicalSymbols.set('pb', 'Pb');
85 | chemicalSymbols.set('bi', 'Bi');
86 | chemicalSymbols.set('po', 'Po');
87 | chemicalSymbols.set('at', 'At');
88 | chemicalSymbols.set('rn', 'Rn');
89 | chemicalSymbols.set('fr', 'Fr');
90 | chemicalSymbols.set('ra', 'Ra');
91 | chemicalSymbols.set('ac', 'Ac');
92 | chemicalSymbols.set('th', 'Th');
93 | chemicalSymbols.set('pa', 'Pa');
94 | chemicalSymbols.set('u', 'U');
95 | chemicalSymbols.set('np', 'Np');
96 | chemicalSymbols.set('pu', 'Pu');
97 | chemicalSymbols.set('am', 'Am');
98 | chemicalSymbols.set('cm', 'Cm');
99 | chemicalSymbols.set('bk', 'Bk');
100 | chemicalSymbols.set('cf', 'Cf');
101 | chemicalSymbols.set('es', 'Es');
102 | chemicalSymbols.set('fm', 'Fm');
103 | chemicalSymbols.set('md', 'Md');
104 | chemicalSymbols.set('no', 'No');
105 | chemicalSymbols.set('lr', 'Lr');
106 | chemicalSymbols.set('rf', 'Rf');
107 | chemicalSymbols.set('db', 'Db');
108 | chemicalSymbols.set('sg', 'Sg');
109 | chemicalSymbols.set('bh', 'Bh');
110 | chemicalSymbols.set('hs', 'Hs');
111 | chemicalSymbols.set('mt', 'Mt');
112 | chemicalSymbols.set('ds', 'Ds');
113 | chemicalSymbols.set('rg', 'Rg');
114 | chemicalSymbols.set('cn', 'Cn');
115 | chemicalSymbols.set('nh', 'Nh');
116 | chemicalSymbols.set('fl', 'Fl');
117 | chemicalSymbols.set('mc', 'Mc');
118 | chemicalSymbols.set('lv', 'Lv');
119 | chemicalSymbols.set('ts', 'Ts');
120 | chemicalSymbols.set('og', 'Og');
121 |
--------------------------------------------------------------------------------
/challenge #0/egorbwork/impossibleTriangle.js:
--------------------------------------------------------------------------------
1 | class TriangleDrawingEngine {
2 |
3 | constructor(drawingContext) {
4 | this.drawingContext = drawingContext;
5 | this.cubeDimension = 90;
6 | this.yellowColor = '#FFD700';
7 | this.redColor = '#FF6347';
8 | this.greenColor = '#008080';
9 | this.destinationOverAllColors = [this.yellowColor, this.redColor, this.greenColor];
10 | this.positionXGenerator = this.animationXPositionGeneration();
11 | this.positionYGenerator = this.animationYPositionGeneration();
12 | }
13 |
14 | drawCube(coordinateX = 0, coordinateY = 0, destinationOverColors = []) {
15 | this.drawingContext.save();
16 |
17 | this.drawingContext.globalCompositeOperation =
18 | destinationOverColors.includes(this.redColor)
19 | ? 'destination-over' : 'source-over';
20 | this.drawingContext.beginPath();
21 | this.drawingContext.moveTo(coordinateX, coordinateY);
22 | this.drawingContext.lineTo(coordinateX - this.cubeDimension, coordinateY - this.cubeDimension * 0.5);
23 | this.drawingContext.lineTo(coordinateX - this.cubeDimension, coordinateY - this.cubeDimension * 1.5);
24 | this.drawingContext.lineTo(coordinateX, coordinateY - this.cubeDimension);
25 | this.drawingContext.closePath();
26 | this.drawingContext.fillStyle = this.redColor;
27 | this.drawingContext.fill();
28 |
29 | this.drawingContext.globalCompositeOperation =
30 | destinationOverColors.includes(this.greenColor)
31 | ? 'destination-over' : 'source-over';
32 | this.drawingContext.beginPath();
33 | this.drawingContext.moveTo(coordinateX, coordinateY);
34 | this.drawingContext.lineTo(coordinateX + this.cubeDimension, coordinateY - this.cubeDimension * 0.5);
35 | this.drawingContext.lineTo(coordinateX + this.cubeDimension, coordinateY - this.cubeDimension * 1.5);
36 | this.drawingContext.lineTo(coordinateX, coordinateY - this.cubeDimension);
37 | this.drawingContext.closePath();
38 | this.drawingContext.fillStyle = this.greenColor;
39 | this.drawingContext.fill();
40 |
41 | this.drawingContext.globalCompositeOperation =
42 | destinationOverColors.includes(this.yellowColor)
43 | ? 'destination-over' : 'source-over';
44 | this.drawingContext.beginPath();
45 | this.drawingContext.moveTo(coordinateX, coordinateY - this.cubeDimension);
46 | this.drawingContext.lineTo(coordinateX - this.cubeDimension, coordinateY - this.cubeDimension * 1.5);
47 | this.drawingContext.lineTo(coordinateX, coordinateY - this.cubeDimension * 2);
48 | this.drawingContext.lineTo(coordinateX + this.cubeDimension, coordinateY - this.cubeDimension * 1.5);
49 | this.drawingContext.closePath();
50 | this.drawingContext.fillStyle = this.yellowColor;
51 | this.drawingContext.fill();
52 |
53 | this.drawingContext.restore();
54 | }
55 |
56 | drawImpossibleTriangle(animationPositionX = 0, animationPositionY = 0) {
57 | // All positions now were calculated
58 | // Moving vertical
59 | this.drawCube(400, 700 - animationPositionY);
60 | this.drawCube(400, 550 - animationPositionY);
61 | this.drawCube(400, 400 - animationPositionY);
62 |
63 | // Moving from right to left and from top to bottom
64 | this.drawCube(400 + animationPositionX, 250 + (animationPositionY / 2));
65 | this.drawCube(530 + animationPositionX, 325 + (animationPositionY / 2));
66 | this.drawCube(660 + animationPositionX, 400 + (animationPositionY / 2));
67 |
68 |
69 | // Moving from left to right and from top to bottom
70 |
71 | // This cube is destination over for start
72 | if (animationPositionY <= 75) {
73 | this.drawCube(
74 | 790 - animationPositionX,
75 | 475 + (animationPositionY / 2)
76 | );
77 | }
78 | // Specific order to keep required order of colors
79 | this.drawCube(530 - animationPositionX, 625 + (animationPositionY / 2), this.destinationOverAllColors);
80 | this.drawCube(
81 | 660 - animationPositionX,
82 | 550 + (animationPositionY / 2),
83 | animationPositionY <= 75 ? [this.redColor] : [this.redColor, this.yellowColor]
84 | );
85 |
86 | // Now this cube has only red color as destination over
87 | if (animationPositionY >= 75) {
88 | this.drawCube(
89 | 790 - animationPositionX,
90 | 475 + (animationPositionY / 2),
91 | [this.redColor]
92 | );
93 | }
94 | }
95 |
96 | animateImpossibleTriangle() {
97 | this.drawingContext.clearRect(0, 0, 1000, 1000);
98 | this.drawImpossibleTriangle(this.positionXGenerator.next().value, this.positionYGenerator.next().value);
99 | window.requestAnimationFrame(() => {this.animateImpossibleTriangle();});
100 | }
101 |
102 | * animationXPositionGeneration() {
103 | while(true) {
104 | for (let counter = 0; counter <= 150; counter += 2) {
105 | // Keeping same speed animation speed with Y coordinates, but keeping in ming that instead of 150
106 | // it uses 130 for standard cycle
107 | yield counter * 13 / 15;
108 | }
109 | }
110 | }
111 |
112 | * animationYPositionGeneration() {
113 | while(true) {
114 | for (let counter = 0; counter <= 150; counter += 2) {
115 | yield counter;
116 | }
117 | }
118 | }
119 | }
120 |
121 | document.addEventListener("DOMContentLoaded", function() {
122 | var drawingEngine = new TriangleDrawingEngine(document.getElementById('triangle').getContext('2d'));
123 | drawingEngine.animateImpossibleTriangle();
124 | });
125 |
126 |
127 |
--------------------------------------------------------------------------------
/challenge #4/slkelevro/jmsd-challenge4.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
196 |
197 |
198 |
--------------------------------------------------------------------------------
/challenge #4/wanoo21/chemical-symbols.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "symbol": "H",
4 | "name": "Hydrogen"
5 | },
6 | {
7 | "symbol": "He",
8 | "name": "Helium"
9 | },
10 | {
11 | "symbol": "Li",
12 | "name": "Lithium"
13 | },
14 | {
15 | "symbol": "Be",
16 | "name": "Beryllium"
17 | },
18 | {
19 | "symbol": "B",
20 | "name": "Boron"
21 | },
22 | {
23 | "symbol": "C",
24 | "name": "Carbon"
25 | },
26 | {
27 | "symbol": "N",
28 | "name": "Nitrogen"
29 | },
30 | {
31 | "symbol": "O",
32 | "name": "Oxygen"
33 | },
34 | {
35 | "symbol": "F",
36 | "name": "Fluorine"
37 | },
38 | {
39 | "symbol": "Ne",
40 | "name": "Neon"
41 | },
42 | {
43 | "symbol": "Na",
44 | "name": "Sodium"
45 | },
46 | {
47 | "symbol": "Mg",
48 | "name": "Magnesium"
49 | },
50 | {
51 | "symbol": "Al",
52 | "name": "Aluminium"
53 | },
54 | {
55 | "symbol": "Si",
56 | "name": "Silicon"
57 | },
58 | {
59 | "symbol": "P",
60 | "name": "Phosphorus"
61 | },
62 | {
63 | "symbol": "S",
64 | "name": "Sulfur"
65 | },
66 | {
67 | "symbol": "Cl",
68 | "name": "Chlorine"
69 | },
70 | {
71 | "symbol": "Ar",
72 | "name": "Argon"
73 | },
74 | {
75 | "symbol": "K",
76 | "name": "Potassium"
77 | },
78 | {
79 | "symbol": "Ca",
80 | "name": "Calcium"
81 | },
82 | {
83 | "symbol": "Sc",
84 | "name": "Scandium"
85 | },
86 | {
87 | "symbol": "Ti",
88 | "name": "Titanium"
89 | },
90 | {
91 | "symbol": "V",
92 | "name": "Vanadium"
93 | },
94 | {
95 | "symbol": "Cr",
96 | "name": "Chromium"
97 | },
98 | {
99 | "symbol": "Mn",
100 | "name": "Manganese"
101 | },
102 | {
103 | "symbol": "Fe",
104 | "name": "Iron"
105 | },
106 | {
107 | "symbol": "Co",
108 | "name": "Cobalt"
109 | },
110 | {
111 | "symbol": "Ni",
112 | "name": "Nickel"
113 | },
114 | {
115 | "symbol": "Cu",
116 | "name": "Copper"
117 | },
118 | {
119 | "symbol": "Zn",
120 | "name": "Zinc"
121 | },
122 | {
123 | "symbol": "Ga",
124 | "name": "Gallium"
125 | },
126 | {
127 | "symbol": "Ge",
128 | "name": "Germanium"
129 | },
130 | {
131 | "symbol": "As",
132 | "name": "Arsenic"
133 | },
134 | {
135 | "symbol": "Se",
136 | "name": "Selenium"
137 | },
138 | {
139 | "symbol": "Br",
140 | "name": "Bromine"
141 | },
142 | {
143 | "symbol": "Kr",
144 | "name": "Krypton"
145 | },
146 | {
147 | "symbol": "Rb",
148 | "name": "Rubidium"
149 | },
150 | {
151 | "symbol": "Sr",
152 | "name": "Strontium"
153 | },
154 | {
155 | "symbol": "Y",
156 | "name": "Yttrium"
157 | },
158 | {
159 | "symbol": "Zr",
160 | "name": "Zirconium"
161 | },
162 | {
163 | "symbol": "Nb",
164 | "name": "Niobium"
165 | },
166 | {
167 | "symbol": "Mo",
168 | "name": "Molybdenum"
169 | },
170 | {
171 | "symbol": "Tc",
172 | "name": "Technetium"
173 | },
174 | {
175 | "symbol": "Ru",
176 | "name": "Ruthenium"
177 | },
178 | {
179 | "symbol": "Rh",
180 | "name": "Rhodium"
181 | },
182 | {
183 | "symbol": "Pd",
184 | "name": "Palladium"
185 | },
186 | {
187 | "symbol": "Ag",
188 | "name": "Silver"
189 | },
190 | {
191 | "symbol": "Cd",
192 | "name": "Cadmium"
193 | },
194 | {
195 | "symbol": "In",
196 | "name": "Indium"
197 | },
198 | {
199 | "symbol": "Sn",
200 | "name": "Tin"
201 | },
202 | {
203 | "symbol": "Sb",
204 | "name": "Antimony"
205 | },
206 | {
207 | "symbol": "Te",
208 | "name": "Tellurium"
209 | },
210 | {
211 | "symbol": "I",
212 | "name": "Iodine"
213 | },
214 | {
215 | "symbol": "Xe",
216 | "name": "Xenon"
217 | },
218 | {
219 | "symbol": "Cs",
220 | "name": "Caesium"
221 | },
222 | {
223 | "symbol": "Ba",
224 | "name": "Barium"
225 | },
226 | {
227 | "symbol": "La",
228 | "name": "Lanthanum"
229 | },
230 | {
231 | "symbol": "Ce",
232 | "name": "Cerium"
233 | },
234 | {
235 | "symbol": "Pr",
236 | "name": "Praseodymium"
237 | },
238 | {
239 | "symbol": "Nd",
240 | "name": "Neodymium"
241 | },
242 | {
243 | "symbol": "Pm",
244 | "name": "Promethium"
245 | },
246 | {
247 | "symbol": "Sm",
248 | "name": "Samarium"
249 | },
250 | {
251 | "symbol": "Eu",
252 | "name": "Europium"
253 | },
254 | {
255 | "symbol": "Gd",
256 | "name": "Gadolinium"
257 | },
258 | {
259 | "symbol": "Tb",
260 | "name": "Terbium"
261 | },
262 | {
263 | "symbol": "Dy",
264 | "name": "Dysprosium"
265 | },
266 | {
267 | "symbol": "Ho",
268 | "name": "Holmium"
269 | },
270 | {
271 | "symbol": "Er",
272 | "name": "Erbium"
273 | },
274 | {
275 | "symbol": "Tm",
276 | "name": "Thulium"
277 | },
278 | {
279 | "symbol": "Yb",
280 | "name": "Ytterbium"
281 | },
282 | {
283 | "symbol": "Lu",
284 | "name": "Lutetium"
285 | },
286 | {
287 | "symbol": "Hf",
288 | "name": "Hafnium"
289 | },
290 | {
291 | "symbol": "Ta",
292 | "name": "Tantalum"
293 | },
294 | {
295 | "symbol": "W",
296 | "name": "Tungsten"
297 | },
298 | {
299 | "symbol": "Re",
300 | "name": "Rhenium"
301 | },
302 | {
303 | "symbol": "Os",
304 | "name": "Osmium"
305 | },
306 | {
307 | "symbol": "Ir",
308 | "name": "Iridium"
309 | },
310 | {
311 | "symbol": "Pt",
312 | "name": "Platinum"
313 | },
314 | {
315 | "symbol": "Au",
316 | "name": "Gold"
317 | },
318 | {
319 | "symbol": "Hg",
320 | "name": "Mercury"
321 | },
322 | {
323 | "symbol": "Tl",
324 | "name": "Thallium"
325 | },
326 | {
327 | "symbol": "Pb",
328 | "name": "Lead"
329 | },
330 | {
331 | "symbol": "Bi",
332 | "name": "Bismuth"
333 | },
334 | {
335 | "symbol": "Po",
336 | "name": "Polonium"
337 | },
338 | {
339 | "symbol": "At",
340 | "name": "Astatine"
341 | },
342 | {
343 | "symbol": "Rn",
344 | "name": "Radon"
345 | },
346 | {
347 | "symbol": "Fr",
348 | "name": "Francium"
349 | },
350 | {
351 | "symbol": "Ra",
352 | "name": "Radium"
353 | },
354 | {
355 | "symbol": "Ac",
356 | "name": "Actinium"
357 | },
358 | {
359 | "symbol": "Th",
360 | "name": "Thorium"
361 | },
362 | {
363 | "symbol": "Pa",
364 | "name": "Protactinium"
365 | },
366 | {
367 | "symbol": "U",
368 | "name": "Uranium"
369 | },
370 | {
371 | "symbol": "Np",
372 | "name": "Neptunium"
373 | },
374 | {
375 | "symbol": "Pu",
376 | "name": "Plutonium"
377 | },
378 | {
379 | "symbol": "Am",
380 | "name": "Americium"
381 | },
382 | {
383 | "symbol": "Cm",
384 | "name": "Curium"
385 | },
386 | {
387 | "symbol": "Bk",
388 | "name": "Berkelium"
389 | },
390 | {
391 | "symbol": "Cf",
392 | "name": "Californium"
393 | },
394 | {
395 | "symbol": "Es",
396 | "name": "Einsteinium"
397 | },
398 | {
399 | "symbol": "Fm",
400 | "name": "Fermium"
401 | },
402 | {
403 | "symbol": "Md",
404 | "name": "Mendelevium"
405 | },
406 | {
407 | "symbol": "No",
408 | "name": "Nobelium"
409 | },
410 | {
411 | "symbol": "Lr",
412 | "name": "Lawrencium"
413 | },
414 | {
415 | "symbol": "Rf",
416 | "name": "Rutherfordium"
417 | },
418 | {
419 | "symbol": "Db",
420 | "name": "Dubnium"
421 | },
422 | {
423 | "symbol": "Sg",
424 | "name": "Seaborgium"
425 | },
426 | {
427 | "symbol": "Bh",
428 | "name": "Bohrium"
429 | },
430 | {
431 | "symbol": "Hs",
432 | "name": "Hassium"
433 | },
434 | {
435 | "symbol": "Mt",
436 | "name": "Meitnerium"
437 | },
438 | {
439 | "symbol": "Ds",
440 | "name": "Darmstadtium"
441 | },
442 | {
443 | "symbol": "Rg",
444 | "name": "Roentgenium"
445 | },
446 | {
447 | "symbol": "Cn",
448 | "name": "Copernicium"
449 | },
450 | {
451 | "symbol": "Nh",
452 | "name": "Nihonium"
453 | },
454 | {
455 | "symbol": "Fl",
456 | "name": "Flerovium"
457 | },
458 | {
459 | "symbol": "Mc",
460 | "name": "Moscovium"
461 | },
462 | {
463 | "symbol": "Lv",
464 | "name": "Livermorium"
465 | },
466 | {
467 | "symbol": "Ts",
468 | "name": "Tennessine"
469 | },
470 | {
471 | "symbol": "Og",
472 | "name": "Oganesson"
473 | }
474 | ]
475 |
--------------------------------------------------------------------------------
/challenge #0/nicu-chiciuc/dat.gui.min.js:
--------------------------------------------------------------------------------
1 | !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.dat=t():e.dat=t()}(this,function(){return function(e){function t(o){if(n[o])return n[o].exports;var i=n[o]={exports:{},id:o,loaded:!1};return e[o].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}var i=n(1),r=o(i);e.exports=r["default"]},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}t.__esModule=!0;var i=n(2),r=o(i),a=n(6),l=o(a),s=n(3),u=o(s),d=n(7),c=o(d),f=n(8),_=o(f),p=n(10),h=o(p),m=n(11),b=o(m),g=n(12),v=o(g),y=n(13),w=o(y),x=n(14),E=o(x),C=n(15),A=o(C),S=n(16),k=o(S),O=n(9),T=o(O),R=n(17),L=o(R);t["default"]={color:{Color:r["default"],math:l["default"],interpret:u["default"]},controllers:{Controller:c["default"],BooleanController:_["default"],OptionController:h["default"],StringController:b["default"],NumberController:v["default"],NumberControllerBox:w["default"],NumberControllerSlider:E["default"],FunctionController:A["default"],ColorController:k["default"]},dom:{dom:T["default"]},gui:{GUI:L["default"]},GUI:L["default"]}},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t,n){Object.defineProperty(e,t,{get:function(){return"RGB"===this.__state.space?this.__state[t]:(h.recalculateRGB(this,t,n),this.__state[t])},set:function(e){"RGB"!==this.__state.space&&(h.recalculateRGB(this,t,n),this.__state.space="RGB"),this.__state[t]=e}})}function a(e,t){Object.defineProperty(e,t,{get:function(){return"HSV"===this.__state.space?this.__state[t]:(h.recalculateHSV(this),this.__state[t])},set:function(e){"HSV"!==this.__state.space&&(h.recalculateHSV(this),this.__state.space="HSV"),this.__state[t]=e}})}t.__esModule=!0;var l=n(3),s=o(l),u=n(6),d=o(u),c=n(4),f=o(c),_=n(5),p=o(_),h=function(){function e(){if(i(this,e),this.__state=s["default"].apply(this,arguments),this.__state===!1)throw new Error("Failed to interpret color arguments");this.__state.a=this.__state.a||1}return e.prototype.toString=function(){return(0,f["default"])(this)},e.prototype.toHexString=function(){return(0,f["default"])(this,!0)},e.prototype.toOriginal=function(){return this.__state.conversion.write(this)},e}();h.recalculateRGB=function(e,t,n){if("HEX"===e.__state.space)e.__state[t]=d["default"].component_from_hex(e.__state.hex,n);else{if("HSV"!==e.__state.space)throw new Error("Corrupted color state");p["default"].extend(e.__state,d["default"].hsv_to_rgb(e.__state.h,e.__state.s,e.__state.v))}},h.recalculateHSV=function(e){var t=d["default"].rgb_to_hsv(e.r,e.g,e.b);p["default"].extend(e.__state,{s:t.s,v:t.v}),p["default"].isNaN(t.h)?p["default"].isUndefined(e.__state.h)&&(e.__state.h=0):e.__state.h=t.h},h.COMPONENTS=["r","g","b","h","s","v","hex","a"],r(h.prototype,"r",2),r(h.prototype,"g",1),r(h.prototype,"b",0),a(h.prototype,"h"),a(h.prototype,"s"),a(h.prototype,"v"),Object.defineProperty(h.prototype,"a",{get:function(){return this.__state.a},set:function(e){this.__state.a=e}}),Object.defineProperty(h.prototype,"hex",{get:function(){return"HEX"!==!this.__state.space&&(this.__state.hex=d["default"].rgb_to_hex(this.r,this.g,this.b)),this.__state.hex},set:function(e){this.__state.space="HEX",this.__state.hex=e}}),t["default"]=h},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}t.__esModule=!0;var i=n(4),r=o(i),a=n(5),l=o(a),s=[{litmus:l["default"].isString,conversions:{THREE_CHAR_HEX:{read:function(e){var t=e.match(/^#([A-F0-9])([A-F0-9])([A-F0-9])$/i);return null!==t&&{space:"HEX",hex:parseInt("0x"+t[1].toString()+t[1].toString()+t[2].toString()+t[2].toString()+t[3].toString()+t[3].toString(),0)}},write:r["default"]},SIX_CHAR_HEX:{read:function(e){var t=e.match(/^#([A-F0-9]{6})$/i);return null!==t&&{space:"HEX",hex:parseInt("0x"+t[1].toString(),0)}},write:r["default"]},CSS_RGB:{read:function(e){var t=e.match(/^rgb\(\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*\)/);return null!==t&&{space:"RGB",r:parseFloat(t[1]),g:parseFloat(t[2]),b:parseFloat(t[3])}},write:r["default"]},CSS_RGBA:{read:function(e){var t=e.match(/^rgba\(\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*\)/);return null!==t&&{space:"RGB",r:parseFloat(t[1]),g:parseFloat(t[2]),b:parseFloat(t[3]),a:parseFloat(t[4])}},write:r["default"]}}},{litmus:l["default"].isNumber,conversions:{HEX:{read:function(e){return{space:"HEX",hex:e,conversionName:"HEX"}},write:function(e){return e.hex}}}},{litmus:l["default"].isArray,conversions:{RGB_ARRAY:{read:function(e){return 3===e.length&&{space:"RGB",r:e[0],g:e[1],b:e[2]}},write:function(e){return[e.r,e.g,e.b]}},RGBA_ARRAY:{read:function(e){return 4===e.length&&{space:"RGB",r:e[0],g:e[1],b:e[2],a:e[3]}},write:function(e){return[e.r,e.g,e.b,e.a]}}}},{litmus:l["default"].isObject,conversions:{RGBA_OBJ:{read:function(e){return!!(l["default"].isNumber(e.r)&&l["default"].isNumber(e.g)&&l["default"].isNumber(e.b)&&l["default"].isNumber(e.a))&&{space:"RGB",r:e.r,g:e.g,b:e.b,a:e.a}},write:function(e){return{r:e.r,g:e.g,b:e.b,a:e.a}}},RGB_OBJ:{read:function(e){return!!(l["default"].isNumber(e.r)&&l["default"].isNumber(e.g)&&l["default"].isNumber(e.b))&&{space:"RGB",r:e.r,g:e.g,b:e.b}},write:function(e){return{r:e.r,g:e.g,b:e.b}}},HSVA_OBJ:{read:function(e){return!!(l["default"].isNumber(e.h)&&l["default"].isNumber(e.s)&&l["default"].isNumber(e.v)&&l["default"].isNumber(e.a))&&{space:"HSV",h:e.h,s:e.s,v:e.v,a:e.a}},write:function(e){return{h:e.h,s:e.s,v:e.v,a:e.a}}},HSV_OBJ:{read:function(e){return!!(l["default"].isNumber(e.h)&&l["default"].isNumber(e.s)&&l["default"].isNumber(e.v))&&{space:"HSV",h:e.h,s:e.s,v:e.v}},write:function(e){return{h:e.h,s:e.s,v:e.v}}}}}],u=void 0,d=void 0,c=function(){d=!1;var e=arguments.length>1?l["default"].toArray(arguments):arguments[0];return l["default"].each(s,function(t){if(t.litmus(e))return l["default"].each(t.conversions,function(t,n){if(u=t.read(e),d===!1&&u!==!1)return d=u,u.conversionName=n,u.conversion=t,l["default"].BREAK}),l["default"].BREAK}),d};t["default"]=c},function(e,t){"use strict";t.__esModule=!0,t["default"]=function(e,t){var n=e.__state.conversionName.toString(),o=Math.round(e.r),i=Math.round(e.g),r=Math.round(e.b),a=e.a,l=Math.round(e.h),s=e.s.toFixed(1),u=e.v.toFixed(1);if(t||"THREE_CHAR_HEX"===n||"SIX_CHAR_HEX"===n){for(var d=e.hex.toString(16);d.length<6;)d="0"+d;return"#"+d}return"CSS_RGB"===n?"rgb("+o+","+i+","+r+")":"CSS_RGBA"===n?"rgba("+o+","+i+","+r+","+a+")":"HEX"===n?"0x"+e.hex.toString(16):"RGB_ARRAY"===n?"["+o+","+i+","+r+"]":"RGBA_ARRAY"===n?"["+o+","+i+","+r+","+a+"]":"RGB_OBJ"===n?"{r:"+o+",g:"+i+",b:"+r+"}":"RGBA_OBJ"===n?"{r:"+o+",g:"+i+",b:"+r+",a:"+a+"}":"HSV_OBJ"===n?"{h:"+l+",s:"+s+",v:"+u+"}":"HSVA_OBJ"===n?"{h:"+l+",s:"+s+",v:"+u+",a:"+a+"}":"unknown format"}},function(e,t){"use strict";t.__esModule=!0;var n=Array.prototype.forEach,o=Array.prototype.slice,i={BREAK:{},extend:function(e){return this.each(o.call(arguments,1),function(t){var n=this.isObject(t)?Object.keys(t):[];n.forEach(function(n){this.isUndefined(t[n])||(e[n]=t[n])}.bind(this))},this),e},defaults:function(e){return this.each(o.call(arguments,1),function(t){var n=this.isObject(t)?Object.keys(t):[];n.forEach(function(n){this.isUndefined(e[n])&&(e[n]=t[n])}.bind(this))},this),e},compose:function(){var e=o.call(arguments);return function(){for(var t=o.call(arguments),n=e.length-1;n>=0;n--)t=[e[n].apply(this,t)];return t[0]}},each:function(e,t,o){if(e)if(n&&e.forEach&&e.forEach===n)e.forEach(t,o);else if(e.length===e.length+0){var i=void 0,r=void 0;for(i=0,r=e.length;i>8*t&255},hex_with_component:function(e,t,o){return o<<(n=8*t)|e&~(255<-1?t.length-t.indexOf(".")-1:0}t.__esModule=!0;var s=n(7),u=o(s),d=n(5),c=o(d),f=function(e){function t(n,o,a){i(this,t);var s=r(this,e.call(this,n,o)),u=a||{};return s.__min=u.min,s.__max=u.max,s.__step=u.step,c["default"].isUndefined(s.__step)?0===s.initialValue?s.__impliedStep=1:s.__impliedStep=Math.pow(10,Math.floor(Math.log(Math.abs(s.initialValue))/Math.LN10))/10:s.__impliedStep=s.__step,s.__precision=l(s.__impliedStep),s}return a(t,e),t.prototype.setValue=function(t){var n=t;return void 0!==this.__min&&nthis.__max&&(n=this.__max),void 0!==this.__step&&n%this.__step!==0&&(n=Math.round(n/this.__step)*this.__step),e.prototype.setValue.call(this,n)},t.prototype.min=function(e){return this.__min=e,this},t.prototype.max=function(e){return this.__max=e,this},t.prototype.step=function(e){return this.__step=e,this.__impliedStep=e,this.__precision=l(e),this},t}(u["default"]);t["default"]=f},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function l(e,t){var n=Math.pow(10,t);return Math.round(e*n)/n}t.__esModule=!0;var s=n(12),u=o(s),d=n(9),c=o(d),f=n(5),_=o(f),p=function(e){function t(n,o,a){function l(){var e=parseFloat(m.__input.value);_["default"].isNaN(e)||m.setValue(e)}function s(){m.__onFinishChange&&m.__onFinishChange.call(m,m.getValue())}function u(){s()}function d(e){var t=b-e.clientY;m.setValue(m.getValue()+t*m.__impliedStep),b=e.clientY}function f(){c["default"].unbind(window,"mousemove",d),c["default"].unbind(window,"mouseup",f),s()}function p(e){c["default"].bind(window,"mousemove",d),c["default"].bind(window,"mouseup",f),b=e.clientY}i(this,t);var h=r(this,e.call(this,n,o,a));h.__truncationSuspended=!1;var m=h,b=void 0;return h.__input=document.createElement("input"),h.__input.setAttribute("type","text"),c["default"].bind(h.__input,"change",l),c["default"].bind(h.__input,"blur",u),c["default"].bind(h.__input,"mousedown",p),c["default"].bind(h.__input,"keydown",function(e){13===e.keyCode&&(m.__truncationSuspended=!0,this.blur(),m.__truncationSuspended=!1,s())}),h.updateDisplay(),h.domElement.appendChild(h.__input),h}return a(t,e),t.prototype.updateDisplay=function(){return this.__input.value=this.__truncationSuspended?this.getValue():l(this.getValue(),this.__precision),e.prototype.updateDisplay.call(this)},t}(u["default"]);t["default"]=p},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function l(e,t,n,o,i){return o+(i-o)*((e-t)/(n-t))}t.__esModule=!0;var s=n(12),u=o(s),d=n(9),c=o(d),f=function(e){function t(n,o,a,s,u){function d(e){document.activeElement.blur(),c["default"].bind(window,"mousemove",f),c["default"].bind(window,"mouseup",_),f(e)}function f(e){e.preventDefault();var t=h.__background.getBoundingClientRect();return h.setValue(l(e.clientX,t.left,t.right,h.__min,h.__max)),!1}function _(){c["default"].unbind(window,"mousemove",f),c["default"].unbind(window,"mouseup",_),h.__onFinishChange&&h.__onFinishChange.call(h,h.getValue())}i(this,t);var p=r(this,e.call(this,n,o,{min:a,max:s,step:u})),h=p;return p.__background=document.createElement("div"),p.__foreground=document.createElement("div"),c["default"].bind(p.__background,"mousedown",d),c["default"].addClass(p.__background,"slider"),c["default"].addClass(p.__foreground,"slider-fg"),p.updateDisplay(),p.__background.appendChild(p.__foreground),p.domElement.appendChild(p.__background),p}return a(t,e),t.prototype.updateDisplay=function(){var t=(this.getValue()-this.__min)/(this.__max-this.__min);return this.__foreground.style.width=100*t+"%",e.prototype.updateDisplay.call(this)},t}(u["default"]);t["default"]=f},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var l=n(7),s=o(l),u=n(9),d=o(u),c=function(e){function t(n,o,a){i(this,t);var l=r(this,e.call(this,n,o)),s=l;return l.__button=document.createElement("div"),l.__button.innerHTML=void 0===a?"Fire":a,d["default"].bind(l.__button,"click",function(e){return e.preventDefault(),s.fire(),!1}),d["default"].addClass(l.__button,"button"),l.domElement.appendChild(l.__button),l}return a(t,e),t.prototype.fire=function(){this.__onChange&&this.__onChange.call(this),this.getValue().call(this.object),this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue())},t}(s["default"]);t["default"]=c},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function l(e,t,n,o){e.style.background="",g["default"].each(y,function(i){e.style.cssText+="background: "+i+"linear-gradient("+t+", "+n+" 0%, "+o+" 100%); "})}function s(e){e.style.background="",e.style.cssText+="background: -moz-linear-gradient(top, #ff0000 0%, #ff00ff 17%, #0000ff 34%, #00ffff 50%, #00ff00 67%, #ffff00 84%, #ff0000 100%);",e.style.cssText+="background: -webkit-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: -o-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: -ms-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);"}t.__esModule=!0;var u=n(7),d=o(u),c=n(9),f=o(c),_=n(2),p=o(_),h=n(3),m=o(h),b=n(5),g=o(b),v=function(e){function t(n,o){function a(e){h(e),f["default"].bind(window,"mousemove",h),f["default"].bind(window,"mouseup",u)}function u(){f["default"].unbind(window,"mousemove",h),f["default"].unbind(window,"mouseup",u),_()}function d(){var e=(0,m["default"])(this.value);e!==!1?(y.__color.__state=e,y.setValue(y.__color.toOriginal())):this.value=y.__color.toString()}function c(){f["default"].unbind(window,"mousemove",b),f["default"].unbind(window,"mouseup",c),_()}function _(){y.__onFinishChange&&y.__onFinishChange.call(y,y.__color.toOriginal())}function h(e){e.preventDefault();var t=y.__saturation_field.getBoundingClientRect(),n=(e.clientX-t.left)/(t.right-t.left),o=1-(e.clientY-t.top)/(t.bottom-t.top);return o>1?o=1:o<0&&(o=0),n>1?n=1:n<0&&(n=0),y.__color.v=o,y.__color.s=n,y.setValue(y.__color.toOriginal()),!1}function b(e){e.preventDefault();var t=y.__hue_field.getBoundingClientRect(),n=1-(e.clientY-t.top)/(t.bottom-t.top);return n>1?n=1:n<0&&(n=0),y.__color.h=360*n,y.setValue(y.__color.toOriginal()),!1}i(this,t);var v=r(this,e.call(this,n,o));v.__color=new p["default"](v.getValue()),v.__temp=new p["default"](0);var y=v;v.domElement=document.createElement("div"),f["default"].makeSelectable(v.domElement,!1),v.__selector=document.createElement("div"),v.__selector.className="selector",v.__saturation_field=document.createElement("div"),v.__saturation_field.className="saturation-field",v.__field_knob=document.createElement("div"),v.__field_knob.className="field-knob",v.__field_knob_border="2px solid ",v.__hue_knob=document.createElement("div"),v.__hue_knob.className="hue-knob",v.__hue_field=document.createElement("div"),v.__hue_field.className="hue-field",v.__input=document.createElement("input"),v.__input.type="text",v.__input_textShadow="0 1px 1px ",f["default"].bind(v.__input,"keydown",function(e){13===e.keyCode&&d.call(this)}),f["default"].bind(v.__input,"blur",d),f["default"].bind(v.__selector,"mousedown",function(){f["default"].addClass(this,"drag").bind(window,"mouseup",function(){f["default"].removeClass(y.__selector,"drag")})});var w=document.createElement("div");return g["default"].extend(v.__selector.style,{width:"122px",height:"102px",padding:"3px",backgroundColor:"#222",boxShadow:"0px 1px 3px rgba(0,0,0,0.3)"}),g["default"].extend(v.__field_knob.style,{position:"absolute",width:"12px",height:"12px",border:v.__field_knob_border+(v.__color.v<.5?"#fff":"#000"),boxShadow:"0px 1px 3px rgba(0,0,0,0.5)",borderRadius:"12px",zIndex:1}),g["default"].extend(v.__hue_knob.style,{position:"absolute",width:"15px",height:"2px",borderRight:"4px solid #fff",zIndex:1}),g["default"].extend(v.__saturation_field.style,{width:"100px",height:"100px",border:"1px solid #555",marginRight:"3px",display:"inline-block",cursor:"pointer"}),g["default"].extend(w.style,{width:"100%",height:"100%",background:"none"}),l(w,"top","rgba(0,0,0,0)","#000"),g["default"].extend(v.__hue_field.style,{width:"15px",height:"100px",border:"1px solid #555",cursor:"ns-resize",position:"absolute",top:"3px",right:"3px"}),s(v.__hue_field),g["default"].extend(v.__input.style,{outline:"none",textAlign:"center",color:"#fff",border:0,fontWeight:"bold",textShadow:v.__input_textShadow+"rgba(0,0,0,0.7)"}),f["default"].bind(v.__saturation_field,"mousedown",a),f["default"].bind(v.__field_knob,"mousedown",a),f["default"].bind(v.__hue_field,"mousedown",function(e){b(e),f["default"].bind(window,"mousemove",b),f["default"].bind(window,"mouseup",c)}),v.__saturation_field.appendChild(w),v.__selector.appendChild(v.__field_knob),v.__selector.appendChild(v.__saturation_field),v.__selector.appendChild(v.__hue_field),v.__hue_field.appendChild(v.__hue_knob),v.domElement.appendChild(v.__input),v.domElement.appendChild(v.__selector),v.updateDisplay(),v}return a(t,e),t.prototype.updateDisplay=function(){var e=(0,m["default"])(this.getValue());if(e!==!1){var t=!1;g["default"].each(p["default"].COMPONENTS,function(n){if(!g["default"].isUndefined(e[n])&&!g["default"].isUndefined(this.__color.__state[n])&&e[n]!==this.__color.__state[n])return t=!0,{}},this),t&&g["default"].extend(this.__color.__state,e)}g["default"].extend(this.__temp.__state,this.__color.__state),this.__temp.a=1;var n=this.__color.v<.5||this.__color.s>.5?255:0,o=255-n;g["default"].extend(this.__field_knob.style,{marginLeft:100*this.__color.s-7+"px",marginTop:100*(1-this.__color.v)-7+"px",backgroundColor:this.__temp.toHexString(),border:this.__field_knob_border+"rgb("+n+","+n+","+n+")"}),this.__hue_knob.style.marginTop=100*(1-this.__color.h/360)+"px",this.__temp.s=1,this.__temp.v=1,l(this.__saturation_field,"left","#fff",this.__temp.toHexString()),this.__input.value=this.__color.toString(),g["default"].extend(this.__input.style,{backgroundColor:this.__color.toHexString(),color:"rgb("+n+","+n+","+n+")",textShadow:this.__input_textShadow+"rgba("+o+","+o+","+o+",.7)"})},t}(d["default"]),y=["-moz-","-o-","-webkit-","-ms-",""];t["default"]=v},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function i(e,t,n){var o=document.createElement("li");return t&&o.appendChild(t),n?e.__ul.insertBefore(o,n):e.__ul.appendChild(o),e.onResize(),o}function r(e,t){var n=e.__preset_select[e.__preset_select.selectedIndex];t?n.innerHTML=n.value+"*":n.innerHTML=n.value}function a(e,t,n){if(n.__li=t,n.__gui=e,U["default"].extend(n,{options:function(t){if(arguments.length>1){var o=n.__li.nextElementSibling;return n.remove(),s(e,n.object,n.property,{before:o,factoryArgs:[U["default"].toArray(arguments)]})}if(U["default"].isArray(t)||U["default"].isObject(t)){var i=n.__li.nextElementSibling;return n.remove(),s(e,n.object,n.property,{before:i,factoryArgs:[t]})}},name:function(e){return n.__li.firstElementChild.firstElementChild.innerHTML=e,n},listen:function(){return n.__gui.listen(n),n},remove:function(){
2 | return n.__gui.remove(n),n}}),n instanceof B["default"])!function(){var e=new N["default"](n.object,n.property,{min:n.__min,max:n.__max,step:n.__step});U["default"].each(["updateDisplay","onChange","onFinishChange","step"],function(t){var o=n[t],i=e[t];n[t]=e[t]=function(){var t=Array.prototype.slice.call(arguments);return i.apply(e,t),o.apply(n,t)}}),z["default"].addClass(t,"has-slider"),n.domElement.insertBefore(e.domElement,n.domElement.firstElementChild)}();else if(n instanceof N["default"]){var o=function(t){if(U["default"].isNumber(n.__min)&&U["default"].isNumber(n.__max)){var o=n.__li.firstElementChild.firstElementChild.innerHTML,i=n.__gui.__listening.indexOf(n)>-1;n.remove();var r=s(e,n.object,n.property,{before:n.__li.nextElementSibling,factoryArgs:[n.__min,n.__max,n.__step]});return r.name(o),i&&r.listen(),r}return t};n.min=U["default"].compose(o,n.min),n.max=U["default"].compose(o,n.max)}else n instanceof O["default"]?(z["default"].bind(t,"click",function(){z["default"].fakeEvent(n.__checkbox,"click")}),z["default"].bind(n.__checkbox,"click",function(e){e.stopPropagation()})):n instanceof R["default"]?(z["default"].bind(t,"click",function(){z["default"].fakeEvent(n.__button,"click")}),z["default"].bind(t,"mouseover",function(){z["default"].addClass(n.__button,"hover")}),z["default"].bind(t,"mouseout",function(){z["default"].removeClass(n.__button,"hover")})):n instanceof j["default"]&&(z["default"].addClass(t,"color"),n.updateDisplay=U["default"].compose(function(e){return t.style.borderLeftColor=n.__color.toString(),e},n.updateDisplay),n.updateDisplay());n.setValue=U["default"].compose(function(t){return e.getRoot().__preset_select&&n.isModified()&&r(e.getRoot(),!0),t},n.setValue)}function l(e,t){var n=e.getRoot(),o=n.__rememberedObjects.indexOf(t.object);if(o!==-1){var i=n.__rememberedObjectIndecesToControllers[o];if(void 0===i&&(i={},n.__rememberedObjectIndecesToControllers[o]=i),i[t.property]=t,n.load&&n.load.remembered){var r=n.load.remembered,a=void 0;if(r[e.preset])a=r[e.preset];else{if(!r[Q])return;a=r[Q]}if(a[o]&&void 0!==a[o][t.property]){var l=a[o][t.property];t.initialValue=l,t.setValue(l)}}}}function s(e,t,n,o){if(void 0===t[n])throw new Error('Object "'+t+'" has no property "'+n+'"');var r=void 0;if(o.color)r=new j["default"](t,n);else{var s=[t,n].concat(o.factoryArgs);r=C["default"].apply(e,s)}o.before instanceof S["default"]&&(o.before=o.before.__li),l(e,r),z["default"].addClass(r.domElement,"c");var u=document.createElement("span");z["default"].addClass(u,"property-name"),u.innerHTML=r.property;var d=document.createElement("div");d.appendChild(u),d.appendChild(r.domElement);var c=i(e,d,o.before);return z["default"].addClass(c,oe.CLASS_CONTROLLER_ROW),r instanceof j["default"]?z["default"].addClass(c,"color"):z["default"].addClass(c,g(r.getValue())),a(e,c,r),e.__controllers.push(r),r}function u(e,t){return document.location.href+"."+t}function d(e,t,n){var o=document.createElement("option");o.innerHTML=t,o.value=t,e.__preset_select.appendChild(o),n&&(e.__preset_select.selectedIndex=e.__preset_select.length-1)}function c(e,t){t.style.display=e.useLocalStorage?"block":"none"}function f(e){var t=e.__save_row=document.createElement("li");z["default"].addClass(e.domElement,"has-save"),e.__ul.insertBefore(t,e.__ul.firstChild),z["default"].addClass(t,"save-row");var n=document.createElement("span");n.innerHTML=" ",z["default"].addClass(n,"button gears");var o=document.createElement("span");o.innerHTML="Save",z["default"].addClass(o,"button"),z["default"].addClass(o,"save");var i=document.createElement("span");i.innerHTML="New",z["default"].addClass(i,"button"),z["default"].addClass(i,"save-as");var r=document.createElement("span");r.innerHTML="Revert",z["default"].addClass(r,"button"),z["default"].addClass(r,"revert");var a=e.__preset_select=document.createElement("select");e.load&&e.load.remembered?U["default"].each(e.load.remembered,function(t,n){d(e,n,n===e.preset)}):d(e,Q,!1),z["default"].bind(a,"change",function(){for(var t=0;t0&&(e.preset=this.preset,e.remembered||(e.remembered={}),e.remembered[this.preset]=h(this)),e.folders={},U["default"].each(this.__folders,function(t,n){e.folders[n]=t.getSaveObject()}),e},save:function(){this.load.remembered||(this.load.remembered={}),this.load.remembered[this.preset]=h(this),r(this,!1),this.saveToLocalStorageIfPossible()},saveAs:function(e){this.load.remembered||(this.load.remembered={},this.load.remembered[Q]=h(this,!0)),this.load.remembered[e]=h(this),this.preset=e,d(this,e,!0),this.saveToLocalStorageIfPossible()},revert:function(e){U["default"].each(this.__controllers,function(t){this.getRoot().load.remembered?l(e||this.getRoot(),t):t.setValue(t.initialValue),t.__onFinishChange&&t.__onFinishChange.call(t,t.getValue())},this),U["default"].each(this.__folders,function(e){e.revert(e)}),e||r(this.getRoot(),!1)},listen:function(e){var t=0===this.__listening.length;this.__listening.push(e),t&&b(this.__listening)},updateDisplay:function(){U["default"].each(this.__controllers,function(e){e.updateDisplay()}),U["default"].each(this.__folders,function(e){e.updateDisplay()})}}),e.exports=oe},function(e,t){"use strict";e.exports={load:function(e,t){var n=t||document,o=n.createElement("link");o.type="text/css",o.rel="stylesheet",o.href=e,n.getElementsByTagName("head")[0].appendChild(o)},inject:function(e,t){var n=t||document,o=document.createElement("style");o.type="text/css",o.innerHTML=e;var i=n.getElementsByTagName("head")[0];try{i.appendChild(o)}catch(r){}}}},function(e,t){e.exports=" Here's the new load parameter for your
GUI's constructor:
Automatically save values to
localStorage on exit.
The values saved to localStorage will override those passed to dat.GUI's constructor. This makes it easier to work incrementally, but localStorage is fragile, and your friends may not see the same values you do.
"},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}t.__esModule=!0;var i=n(10),r=o(i),a=n(13),l=o(a),s=n(14),u=o(s),d=n(11),c=o(d),f=n(15),_=o(f),p=n(8),h=o(p),m=n(5),b=o(m),g=function(e,t){var n=e[t];return b["default"].isArray(arguments[2])||b["default"].isObject(arguments[2])?new r["default"](e,t,arguments[2]):b["default"].isNumber(n)?b["default"].isNumber(arguments[2])&&b["default"].isNumber(arguments[3])?b["default"].isNumber(arguments[4])?new u["default"](e,t,arguments[2],arguments[3],arguments[4]):new u["default"](e,t,arguments[2],arguments[3]):b["default"].isNumber(arguments[4])?new l["default"](e,t,{min:arguments[2],max:arguments[3],step:arguments[4]}):new l["default"](e,t,{min:arguments[2],max:arguments[3]}):b["default"].isString(n)?new c["default"](e,t):b["default"].isFunction(n)?new _["default"](e,t,""):b["default"].isBoolean(n)?new h["default"](e,t):null};t["default"]=g},function(e,t){"use strict";function n(e){setTimeout(e,1e3/60)}t.__esModule=!0,t["default"]=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||n},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var r=n(9),a=o(r),l=n(5),s=o(l),u=function(){function e(){i(this,e),this.backgroundElement=document.createElement("div"),s["default"].extend(this.backgroundElement.style,{backgroundColor:"rgba(0,0,0,0.8)",top:0,left:0,display:"none",zIndex:"1000",opacity:0,WebkitTransition:"opacity 0.2s linear",transition:"opacity 0.2s linear"}),a["default"].makeFullscreen(this.backgroundElement),this.backgroundElement.style.position="fixed",this.domElement=document.createElement("div"),s["default"].extend(this.domElement.style,{position:"fixed",display:"none",zIndex:"1001",opacity:0,WebkitTransition:"-webkit-transform 0.2s ease-out, opacity 0.2s linear",transition:"transform 0.2s ease-out, opacity 0.2s linear"}),document.body.appendChild(this.backgroundElement),document.body.appendChild(this.domElement);var t=this;a["default"].bind(this.backgroundElement,"click",function(){t.hide()})}return e.prototype.show=function(){var e=this;this.backgroundElement.style.display="block",this.domElement.style.display="block",this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)",this.layout(),s["default"].defer(function(){e.backgroundElement.style.opacity=1,e.domElement.style.opacity=1,e.domElement.style.webkitTransform="scale(1)"})},e.prototype.hide=function t(){var e=this,t=function n(){e.domElement.style.display="none",e.backgroundElement.style.display="none",a["default"].unbind(e.domElement,"webkitTransitionEnd",n),a["default"].unbind(e.domElement,"transitionend",n),a["default"].unbind(e.domElement,"oTransitionEnd",n)};a["default"].bind(this.domElement,"webkitTransitionEnd",t),a["default"].bind(this.domElement,"transitionend",t),a["default"].bind(this.domElement,"oTransitionEnd",t),this.backgroundElement.style.opacity=0,this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)"},e.prototype.layout=function(){this.domElement.style.left=window.innerWidth/2-a["default"].getWidth(this.domElement)/2+"px",this.domElement.style.top=window.innerHeight/2-a["default"].getHeight(this.domElement)/2+"px"},e}();t["default"]=u},function(e,t,n){t=e.exports=n(24)(),t.push([e.id,".dg ul{list-style:none;margin:0;padding:0;width:100%;clear:both}.dg.ac{position:fixed;top:0;left:0;right:0;height:0;z-index:0}.dg:not(.ac) .main{overflow:hidden}.dg.main{-webkit-transition:opacity .1s linear;transition:opacity .1s linear}.dg.main.taller-than-window{overflow-y:auto}.dg.main.taller-than-window .close-button{opacity:1;margin-top:-1px;border-top:1px solid #2c2c2c}.dg.main ul.closed .close-button{opacity:1!important}.dg.main .close-button.drag,.dg.main:hover .close-button{opacity:1}.dg.main .close-button{-webkit-transition:opacity .1s linear;transition:opacity .1s linear;border:0;position:absolute;line-height:19px;height:20px;cursor:pointer;text-align:center;background-color:#000}.dg.main .close-button:hover{background-color:#111}.dg.a{float:right;margin-right:15px;overflow-x:hidden}.dg.a.has-save>ul{margin-top:27px}.dg.a.has-save>ul.closed{margin-top:0}.dg.a .save-row{position:fixed;top:0;z-index:1002}.dg li{-webkit-transition:height .1s ease-out;transition:height .1s ease-out}.dg li:not(.folder){cursor:auto;height:27px;line-height:27px;overflow:hidden;padding:0 4px 0 5px}.dg li.folder{padding:0;border-left:4px solid transparent}.dg li.title{cursor:pointer;margin-left:-4px}.dg .closed li:not(.title),.dg .closed ul li,.dg .closed ul li>*{height:0;overflow:hidden;border:0}.dg .cr{clear:both;padding-left:3px;height:27px}.dg .property-name{cursor:default;float:left;clear:left;width:40%;overflow:hidden;text-overflow:ellipsis}.dg .c{float:left;width:60%}.dg .c input[type=text]{border:0;margin-top:4px;padding:3px;width:100%;float:right}.dg .has-slider input[type=text]{width:30%;margin-left:0}.dg .slider{float:left;width:66%;margin-left:-5px;margin-right:0;height:19px;margin-top:4px}.dg .slider-fg{height:100%}.dg .c input[type=checkbox]{margin-top:9px}.dg .c select{margin-top:5px}.dg .cr.boolean,.dg .cr.boolean *,.dg .cr.function,.dg .cr.function *,.dg .cr.function .property-name{cursor:pointer}.dg .selector{display:none;position:absolute;margin-left:-9px;margin-top:23px;z-index:10}.dg .c:hover .selector,.dg .selector.drag{display:block}.dg li.save-row{padding:0}.dg li.save-row .button{display:inline-block;padding:0 6px}.dg.dialogue{background-color:#222;width:460px;padding:15px;font-size:13px;line-height:15px}#dg-new-constructor{padding:10px;color:#222;font-family:Monaco,monospace;font-size:10px;border:0;resize:none;box-shadow:inset 1px 1px 1px #888;word-wrap:break-word;margin:12px 0;display:block;width:440px;overflow-y:scroll;height:100px;position:relative}#dg-local-explain{display:none;font-size:11px;line-height:17px;border-radius:3px;background-color:#333;padding:8px;margin-top:10px}#dg-local-explain code{font-size:10px}#dat-gui-save-locally{display:none}.dg{color:#eee;font:11px Lucida Grande,sans-serif;text-shadow:0 -1px 0 #111}.dg.main::-webkit-scrollbar{width:5px;background:#1a1a1a}.dg.main::-webkit-scrollbar-corner{height:0;display:none}.dg.main::-webkit-scrollbar-thumb{border-radius:5px;background:#676767}.dg li:not(.folder){background:#1a1a1a;border-bottom:1px solid #2c2c2c}.dg li.save-row{line-height:25px;background:#dad5cb;border:0}.dg li.save-row select{margin-left:5px;width:108px}.dg li.save-row .button{margin-left:5px;margin-top:1px;border-radius:2px;font-size:9px;line-height:7px;padding:4px 4px 5px;background:#c5bdad;color:#fff;text-shadow:0 1px 0 #b0a58f;box-shadow:0 -1px 0 #b0a58f;cursor:pointer}.dg li.save-row .button.gears{background:#c5bdad url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAANCAYAAAB/9ZQ7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQJJREFUeNpiYKAU/P//PwGIC/ApCABiBSAW+I8AClAcgKxQ4T9hoMAEUrxx2QSGN6+egDX+/vWT4e7N82AMYoPAx/evwWoYoSYbACX2s7KxCxzcsezDh3evFoDEBYTEEqycggWAzA9AuUSQQgeYPa9fPv6/YWm/Acx5IPb7ty/fw+QZblw67vDs8R0YHyQhgObx+yAJkBqmG5dPPDh1aPOGR/eugW0G4vlIoTIfyFcA+QekhhHJhPdQxbiAIguMBTQZrPD7108M6roWYDFQiIAAv6Aow/1bFwXgis+f2LUAynwoIaNcz8XNx3Dl7MEJUDGQpx9gtQ8YCueB+D26OECAAQDadt7e46D42QAAAABJRU5ErkJggg==) 2px 1px no-repeat;height:7px;width:8px}.dg li.save-row .button:hover{background-color:#bab19e;box-shadow:0 -1px 0 #b0a58f}.dg li.folder{border-bottom:0}.dg li.title{padding-left:16px;background:#000 url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlI+hKgFxoCgAOw==) 6px 10px no-repeat;cursor:pointer;border-bottom:1px solid hsla(0,0%,100%,.2)}.dg .closed li.title{background-image:url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlGIWqMCbWAEAOw==)}.dg .cr.boolean{border-left:3px solid #806787}.dg .cr.color{border-left:3px solid}.dg .cr.function{border-left:3px solid #e61d5f}.dg .cr.number{border-left:3px solid #2fa1d6}.dg .cr.number input[type=text]{color:#2fa1d6}.dg .cr.string{border-left:3px solid #1ed36f}.dg .cr.string input[type=text]{color:#1ed36f}.dg .cr.boolean:hover,.dg .cr.function:hover{background:#111}.dg .c input[type=text]{background:#303030;outline:none}.dg .c input[type=text]:hover{background:#3c3c3c}.dg .c input[type=text]:focus{background:#494949;color:#fff}.dg .c .slider{background:#303030;cursor:ew-resize}.dg .c .slider-fg{background:#2fa1d6;max-width:100%}.dg .c .slider:hover{background:#3c3c3c}.dg .c .slider:hover .slider-fg{background:#44abda}",""])},function(e,t){e.exports=function(){var e=[];return e.toString=function(){for(var e=[],t=0;t