<commit_before>// Copyright (c) 2014-16 <NAME>
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the The GNU Affero General Public
// License as published by the Free Software Foundation; either
// version 3 of the License, or (at your option) any later version.
//
// You should have received a copy of the GNU Affero General Public
// License along with this library; if not, write to the Free Software
// Foundation, 51 Franklin Street, Suite 500 Boston, MA 02110-1335 USA

// Defined below are the inline SVGs used for turtles and blocks. SVGs
// are modified by fill_color, stroke_color, block_label, et al. using
// .replace, e.g.,
// BASICBLOCK.replace(/fill_color/g,
// PALETTEFILLCOLORS['turtle']).replace(/stroke_color/g,
// PALETTESTROKECOLORS['turtle']).replace('block_label', 'clear'));
// Chrome can load the image type "data:image/svg+xml;utf8," inline,
// but Firefox cannot, so we set it in the async methods instead.
// The relative position of the button added to collapsible blocks,
// e.g., start and action. (TODO: Calculate these values.)
const COLLAPSEBUTTONXOFF = -48;
const COLLAPSEBUTTONYOFF = 9;

// With default scaling, blocks are multiples of a standard height.
const STANDARDBLOCKHEIGHT = 42;
const DEFAULTBLOCKSCALE = 1.5;  // scale used in block factory

// The default turtles are generated from the TURTLESVG template.
const FILLCOLORS = ['#ed001d', '#a34600', '#fb5f00', '#6cc600', '#00843c', '#008283', '#007ac9', '#005dff', '#b500e3', '#ec008a'];

const STROKECOLORS = ['#ffada6', '#ffa300', '#ffc000', '#037700', '#00fa8c', '#00f3db', '#00e3ff', '#8dceff', '#f3aeff', '#ff97d5'];

// (fill_color, stroke_color)
const TURTLESVG = '<svg height="55" id="svg40" inkscape:version="0.91 r13725" sodipodi:docname="hey.svg" version="1.1" viewBox="0 0 54.999998 54.999998" width="55" xmlns="http://www.w3.org/2000/svg" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:svg="http://www.w3.org/2000/svg"><sodipodi:namedview bordercolor="#666666" borderopacity="1" gridtolerance="10" guidetolerance="10" id="namedview24" inkscape:current-layer="g3586" inkscape:cx="21.308179" inkscape:cy="27.899852" inkscape:pageopacity="0" inkscape:pageshadow="2" inkscape:window-height="773" inkscape:window-maximized="0" inkscape:window-width="1444" inkscape:window-x="0" inkscape:window-y="0" inkscape:zoom="12.136524" objecttolerance="10" pagecolor="#ffffff" showgrid="false"/><metadata id="metadata46"><rdf:RDF><cc:Work rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/><dc:title/></cc:Work></rdf:RDF></metadata><defs id="defs44"/><g id="g3586" style="fill:fill_color;stroke:stroke_color;stroke-width:1.99999976;stroke-miterlimit:4;stroke-dasharray:none" transform="translate(-3.1884835,0.12548216)"><path d="m 31.188483,5.8745178 -2,-1 -4,2 -3,6.0000002 -3,3 -5.999999,3 -2,4 2,4 c 2.595129,1.449868 7.411581,2 2,2 l -1,5 c 0,0 1.999999,7 1.999999,8 0,1 6,6 6,6 l 8,3 9,-2 4,-4 4,-7 v -5 l -1,-4 3,-4 1,-5 -5,-3 -3,-2 -5,-6.0000002 -2,-3 -3,-1 -1,1" id="path4725" style="fill:fill_color;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"/><g id="g4704" transform="translate(1.449727)"><path d="m 44.760059,28.156906 c 0,0 1.463947,5.738921 1.001084,8.583832 -0.503422,3.094194 -1.733796,6.320068 -4.004337,8.583833 -2.061998,2.055845 -3.20724,2.828474 -6.006505,3.815036 -1.290398,0.454783 -4.973515,0.953759 -6.514048,0.953759 -1.540535,0 -5.223651,-0.498977 -6.514049,-0.95376 -2.799265,-0.986562 -3.944507,-1.759191 -6.006506,-3.815036 -2.270541,-2.263765 -3.500915,-5.489639 -4.004337,-8.583833 -0.462863,-2.844911 1.001084,-8.583832 1.001084,-8.583832 M 26.72654,22.43435 c 0,0 -4.122174,4.705629 -7.007589,5.722555 -1.877805,0.661806 -4.201946,0.826315 -6.006506,0 -1.925806,-0.881834 -3.58357,-2.772978 -4.0043369,-4.768796 -0.4783972,-2.26917 0.5589559,-4.123549 2.4704769,-5.529022 2.067374,-1.520067 4.598363,-1.662883 6.539282,-3.054811 2.515152,-1.803739 2.912345,-5.389772 5.005421,-7.6300732 1.420632,-1.520559 5.512965,-3.8150366 5.512965,-3.8150366 0,0 4.092331,2.2944775 5.512964,3.8150365 2.093073,2.2403013 2.490269,5.8263353 5.005421,7.6300743 1.940919,1.391928 4.538808,1.465531 6.606183,2.927334 1.937249,1.369793 2.881973,3.387329 2.403575,5.656499 -0.420767,1.995818 -2.078532,3.886962 -4.004337,4.768796 -1.80456,0.826315 -4.1287,0.661806 -6.006505,0 -2.885416,-1.016926 -7.00759,-5.722555 -7.00759,-5.722555" id="path4505-6" inkscape:connector-curvature="0" sodipodi:nodetypes="csssssssccsssssscssssssc" style="fill:none;stroke:stroke_color;stroke-width:1.95427048;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"/><g id="g4565" transform="matrix(1.0010843,0,0,0.95375917,55.952224,5.3863652)"><g id="g4553" transform="translate(0,-1)"><path d="M -30.228157,8.514322 C -33.422908,9.40349 -38.624018,5.874516 -40.102591,4.585664" id="path3411-7" style="fill:fill_color;fill-rule:evenodd;stroke:stroke_color;stroke-width:1.93205309;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"/><path d="M -29.760199,5.904536 C -33.101366,5.473905 -35.931474,3.7361852 -37.633646,2.3416285" id="path3413-5" style="fill:fill_color;fill-rule:evenodd;stroke:stroke_color;stroke-width:1.93205309;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"/></g><g id="g4557"><path d="m -23.145912,7.514322 c 3.194751,0.889168 8.395861,-2.639806 9.874434,-3.928658" id="path3411-3" style="fill:fill_color;fill-rule:evenodd;stroke:stroke_color;stroke-width:1.93205309;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"/><path d="m -23.61387,4.904536 c 3.341167,-0.430631 6.171275,-2.168351 7.873447,-3.5629075" id="path3413-56" style="fill:fill_color;fill-rule:evenodd;stroke:stroke_color;stroke-width:1.93205309;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"/></g></g><g id="g4636" transform="matrix(1.0010843,0,0,0.95375917,56.48087,3.4788469)"><ellipse cx="-30.836912" cy="14.612609" id="circle3409-2" rx="1.8846371" ry="2.0666313" style="fill:none;fill-rule:evenodd;stroke:stroke_color;stroke-width:1.99999976;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"/><ellipse cx="-23.593306" cy="14.699166" id="ellipse4229-9" rx="1.8846371" ry="2.0666313" style="fill:none;fill-rule:evenodd;stroke:stroke_color;stroke-width:1.99999976;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"/></g><g id="g4632" transform="matrix(1.0010843,0,0,0.95375917,56.577383,3.4788469)"><path d="m -37.186516,14.624518 c -14.340024,2.75008 -4.810404,15.671871 4.375,5.25" id="path4303-1" style="fill:none;fill-rule:evenodd;stroke:stroke_color;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"/><path d="m -17.436517,14.624518 c 14.3400245,2.75008 4.810404,15.671872 -4.375,5.25" id="path4303-1-2" style="fill:none;fill-rule:evenodd;stroke:stroke_color;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"/></g><path d="m 31.678113,3.3591671 c -1.384692,1.3140551 -1.985761,2.3793068 -2.459835,2.3793068 -0.662709,0 -1.27278,-1.0652517 -2.459836,-2.3793068 -0.97292,-1.0770097 1.101306,-2.37930771 2.459836,-2.37930771 1.358531,0 3.532987,1.36090081 2.459835,2.37930771 z" id="path4227-7" style="fill:stroke_color;fill-rule:evenodd;stroke:stroke_color;stroke-width:2.16383076;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"/></g><path d="m 31.302308,50.085622 c 0,0 0.723125,3.123831 5.500191,3.669996 4.777067,0.546166 11.784656,-3.778776 14.78791,-9.501331 3.003254,-5.722555 2.402683,-11.490783 3.003253,-18.121425" id="path4653" inkscape:connector-curvature="0" style="fill:none;stroke:stroke_color;stroke-width:1.95427048;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"/></g></svg>';

const DRUMSVG = '<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" version="1.1" width="55" height="55" viewBox="0 0 55 55" id="svg2" xml:space="preserve"><path d="m 9.653,18.199 h 35.54 c 0.772,0 1.4,0.628 1.4,1.403 v 2.362 c 0,0.771 -0.628,1.401 -1.4,1.401 H 9.653 c -0.775,0 -1.403,-0.628 -1.403,-1.401 v -2.361 c 0,-0.777 0.627,-1.404 1.403,-1.404 z" id="path8" style="fill:stroke_color;stroke:stroke_color;stroke-width:3.5;stroke-linecap:round;stroke-linejoin:round;display:inline" /><rect width="33.139" height="22.128" x="10.852" y="23.365" id="rect10" style="fill:fill_color;stroke:stroke_color;stroke-width:3.5;stroke-linecap:round;stroke-linejoin:round;display:inline" /><path d="m 9.653,45.493 h 35.54 c 0.772,0 1.4,0.627 1.4,1.401 v 2.362 c 0,0.775 -0.628,1.405 -1.4,1.405 H 9.653 c -0.775,0 -1.403,-0.629 -1.403,-1.405 v -2.362 c 0,-0.77 0.627,-1.401 1.403,-1.401 z" id="path17" style="fill:stroke_color;stroke:stroke_color;stroke-width:3.5;stroke-linecap:round;stroke-linejoin:round;display:inline" /><path d="M 10.851,45.491 19.395,23.365 27.291,45.49 35.217,23.364" id="path19" style="fill:none;stroke:stroke_color;stroke-width:3.5;stroke-linecap:round;stroke-linejoin:round;display:inline" /><path d="M 43.987,45.491 35.217,23.365" id="path21" style="fill:none;stroke:stroke_color;stroke-width:3.5;stroke-linecap:round;stroke-linejoin:round;display:inline" /><line style="fill:none;stroke:stroke_color;stroke-width:3.5;stroke-linecap:round;stroke-linejoin:round;display:inline" y2="5.948" y1="13.149" x2="48.335999" x1="33.689999" id="line27" display="inline" /><line style="fill:none;stroke:stroke_color;stroke-width:3.5;stroke-linecap:round;stroke-linejoin:round;display:inline" y2="9.4799995" y1="2.2130001" x2="20.658001" x1="6.0419998" id="line29" display="inline" /><path d="m 25.721,9.802 c 0.55,1.451 -0.171,3.066 -1.608,3.612 -1.437,0.545 -3.049,-0.188 -3.599,-1.639 -0.547,-1.45 0.174,-3.067 1.609,-3.613 1.438,-0.542 3.049,0.19 3.598,1.64 z" id="path23" style="fill:fill_color;stroke:stroke_color;stroke-width:2.25;stroke-linecap:round;stroke-linejoin:round;display:inline" /><path d="m 33.338,16.442 c -1.04,1.125 -2.798,1.189 -3.928,0.144 -1.128,-1.044 -1.197,-2.801 -0.155,-3.927 1.041,-1.125 2.8,-1.19 3.926,-0.146 1.129,1.045 1.2,2.803 0.157,3.929 z" id="path25" style="fill:fill_color;stroke:stroke_color;stroke-width:2.25;stroke-linecap:round;stroke-linejoin:round;display:inline" /></svg>';

// Offsets for placing text ontop of value blocks.
const TEXTX = 26;
const TEXTY = 26;
const VALUETEXTX = 70;

// Collapse text label positions
const COLLAPSETEXTX = 10;
const COLLAPSETEXTY = 40;

// Artwork position in Media Block
const MEDIASAFEAREA = [40, 4, 108, 80];

// Palette-related artwork
const HIGHLIGHTCOLOR = '#FFFFFF';
const ACTIVECOLOR = '#212121';


function showMaterialHighlight(x, y, r, event, scale, stage) {
    var circles = {
        highlight: new createjs.Shape(),
        active: new createjs.Shape()
    };

    circles.highlight.graphics.f(HIGHLIGHTCOLOR).drawCircle(0, 0, r);
    circles.highlight.alpha = 0.3;
    circles.highlight.x = x;
    circles.highlight.y = y;

    circles.active.graphics.f(ACTIVECOLOR).drawCircle(0, 0, r);
    circles.active.alpha = 0;

    stage.addChild(circles.highlight, circles.active);

    createjs.Tween.get(circles.active).to({scaleX: 0.3, scaleY: 0.3, x: event.rawX / scale, y: event.rawY / scale}).to({scaleX: 1, scaleY: 1, x: x, y: y}, 650, createjs.Ease.circInOut);

    createjs.Tween.get(circles.active).to({alpha: 0.05}).to({alpha: 0.3}, 400);
    return circles;
}


function hideButtonHighlight(circles, stage) {
    // Un-real circles!
    if (circles.active === undefined) {
        return;
    }

    createjs.Tween.get(circles.active).to({alpha: 0}, 400);
    createjs.Tween.get(circles.highlight).to({alpha: 0}, 400);
    setTimeout(function() {
        stage.removeChild(circles.active, circles.highlight);
    }, 650);
}


const MENUWIDTH = 200;

const PALETTEFILLER = '<svg xmlns="http://www.w3.org/2000/svg" width="200" height="filler_height">' + '<rect width="200" height="filler_height" x="0" y="0" style="fill:#b3b3b3;fill-opacity:1;stroke:none" />' + '</svg>';

const PALETTEHEADER = '<svg xmlns="http://www.w3.org/2000/svg" width="header_width" height="42">' + '<rect width="header_width" height="42" x="0" y="0" style="fill:fill_color;fill-opacity:1;stroke:none" />' + '<text style="font-size:16px;font-style:normal;font-weight:normal;text-align:end;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:end;fill-opacity:1;stroke:none;font-family:Sans">' + '<tspan  x="55" y="30" style="font-size:24px;text-align:start;text-anchor:start;fill:#ffffff">palette_label</tspan>' + '</text>' + '</svg>';

const PALETTEBUTTON = '<svg xmlns="http://www.w3.org/2000/svg" width="55" height="55">' + '<circle cx="27.5" cy="27.5" r="27.5" x="0" y="0" style="fill:fill_color;fill-opacity:1;stroke:none" />' + '</svg>';

// samples-viewer related artwork

const BACKGROUND = '<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="650" height="590">' + '<rect width="650" height="590" x="0" y="0" style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none" />' + '<g transform="translate(595,0)" style="fill:#000000;display:block">' + '<path d="m 27.557,5.053 c -12.43,0 -22.5,10.076 -22.5,22.497 0,12.432 10.07,22.503 22.5,22.503 12.431,0 22.5,-10.071 22.5,-22.503 0,-12.421 -10.07,-22.497 -22.5,-22.497 z m 10.199,28.159 c 1.254,1.256 1.257,3.291 0,4.545 -0.628,0.629 -1.451,0.943 -2.274,0.943 -0.822,0 -1.644,-0.314 -2.27,-0.94 l -5.76,-5.761 -5.76,5.761 c -0.627,0.626 -1.449,0.94 -2.271,0.94 -0.823,0 -1.647,-0.314 -2.275,-0.943 -1.254,-1.254 -1.254,-3.289 0.004,-4.545 l 5.758,-5.758 -5.758,-5.758 c -1.258,-1.254 -1.258,-3.292 -0.004,-4.546 1.255,-1.254 3.292,-1.259 4.546,0 l 5.76,5.759 5.76,-5.759 c 1.252,-1.259 3.288,-1.254 4.544,0 1.257,1.254 1.254,3.292 0,4.546 l -5.758,5.758 5.758,5.758 z" style="fill:#000000;display:inline" />' + '</g>' + '</svg>';

const NEXTBUTTON = '<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="55" height="55">' + '<path d="M27.5,50C39.927,50,50,39.927,50,27.5C50,15.072,39.927,5,27.5,5S5,15.072,5,27.5 C5,39.927,15.073,50,27.5,50z M17.093,22.725c0.626-0.624,1.447-0.939,2.271-0.939c0.822,0,1.645,0.315,2.271,0.939l5.84,5.833 l5.657-5.802c0.63-0.645,1.464-0.967,2.3-0.967c0.808,0,1.62,0.305,2.246,0.914c1.266,1.238,1.295,3.271,0.056,4.546l-7.929,8.126 c-0.002,0-0.002,0-0.003,0c-0.01,0.011-0.015,0.021-0.022,0.028c-0.116,0.115-0.245,0.208-0.371,0.302 c-0.039,0.028-0.071,0.064-0.111,0.093c-0.114,0.075-0.24,0.133-0.36,0.194c-0.068,0.035-0.131,0.078-0.2,0.107 c-0.1,0.039-0.203,0.064-0.306,0.093c-0.099,0.032-0.191,0.068-0.292,0.09c-0.083,0.018-0.169,0.018-0.251,0.028 c-0.122,0.015-0.244,0.033-0.366,0.036c-0.071,0-0.147-0.014-0.219-0.021c-0.133-0.007-0.266-0.011-0.395-0.036 c-0.075-0.014-0.147-0.043-0.223-0.064c-0.124-0.035-0.251-0.061-0.373-0.111c-0.083-0.032-0.161-0.082-0.244-0.121 c-0.106-0.055-0.215-0.104-0.316-0.165c-0.084-0.058-0.16-0.13-0.239-0.194c-0.086-0.064-0.176-0.122-0.254-0.201 c-0.005-0.003-0.009-0.011-0.013-0.014c-0.007-0.004-0.011-0.008-0.014-0.011l-8.142-8.13 C15.837,26.019,15.834,23.986,17.093,22.725z" fill="#000000"/>' + '</svg>';

const PREVBUTTON = '<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="55" height="55">' + '<path d="M27.5,5C15.073,5,5,15.073,5,27.5C5,39.928,15.073,50,27.5,50S50,39.928,50,27.5 C50,15.073,39.927,5,27.5,5z M37.906,32.275c-0.626,0.624-1.447,0.939-2.271,0.939c-0.821,0-1.645-0.315-2.271-0.939l-5.84-5.833 l-5.657,5.802c-0.63,0.645-1.464,0.967-2.3,0.967c-0.808,0-1.62-0.305-2.246-0.914c-1.266-1.238-1.295-3.271-0.056-4.546 l7.929-8.126c0.002,0,0.002,0,0.003,0c0.01-0.011,0.015-0.021,0.022-0.028c0.116-0.115,0.245-0.208,0.371-0.302 c0.039-0.028,0.071-0.064,0.111-0.093c0.114-0.075,0.24-0.133,0.36-0.194c0.068-0.035,0.131-0.078,0.2-0.107 c0.1-0.039,0.203-0.064,0.306-0.093c0.099-0.032,0.191-0.068,0.292-0.09c0.083-0.018,0.169-0.018,0.251-0.028 c0.122-0.015,0.244-0.033,0.366-0.036c0.071,0,0.147,0.014,0.219,0.021c0.133,0.007,0.266,0.011,0.395,0.036 c0.075,0.014,0.146,0.043,0.223,0.064c0.123,0.035,0.251,0.061,0.373,0.111c0.082,0.032,0.161,0.082,0.243,0.121 c0.106,0.055,0.216,0.104,0.316,0.165c0.084,0.058,0.159,0.13,0.238,0.194c0.086,0.064,0.176,0.122,0.255,0.201 c0.005,0.003,0.009,0.011,0.013,0.014c0.007,0.004,0.011,0.008,0.014,0.011l8.142,8.13C39.162,28.981,39.166,31.014,37.906,32.275 z" fill="#000000"/>' + '</svg>';

// for print and error messages
const MSGBLOCK = '<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="1000" height="42">' + '<g transform="matrix(2,0,0,2,0,8)">' + '<path d="m 0.5,8.5 0,-8 c 0,-2.09 1.91,-4 4,-4 l 4,0 10,0 473,0 4,0 c 2.09,0 4.26,1.92 4,4 l 0,8 0,4 c 0,2.09 -1.91,4 -4,4 l -4,0 -473,0 -10,0 -4,0 c -2.09,0 -4,-1.91 -4,-4 z" style="fill:fill_color;fill-opacity:1;stroke:stroke_color;stroke-width:1;stroke-linecap:round;stroke-opacity:1" />' + '</g>' + '</svg>';

// boundary for screen
const BOUNDARY = '<svg xmlns="http://www.w3.org/2000/svg" height="HEIGHT" width="WIDTH"> <rect style="fill:none;stroke:stroke_color;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:9, 9;stroke-dashoffset:0;stroke-opacity:1" y="Y" x="X" height="DY" width="DX" /></svg>';

// border for trashcan
const BORDER = '<svg xmlns="http://www.w3.org/2000/svg" width="120" height="120">' + '<rect width="115" height="115" x="2.5" y="2.5" style="fill:none;stroke:stroke_color;stroke-width:5.0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:15, 15;stroke-dashoffset:0" />' + '</svg>';

// palette artwork
// Palettes have different colored blocks
// hue, value, chroma
const PALETTECOLORS0 = {
    'widgets': [37.5, 70, 50],
    'pitch': [37.5, 70, 50],
    'rhythm' : [12.5, 60, 80],
    'tone' : [57.5, 50, 28],
    'intervals':  [57.5, 50, 28],
    'drum' : [57.5, 50, 28],
    'turtle': [37.5, 70, 50],
    'pen': [57.5, 50, 28],
    'boxes': [12.5, 60, 80],
    'action': [22.5, 80, 57],
    'media': [57.5, 70, 28],
    'number': [0, 70, 42],
    'boolean': [30, 80, 57],
    'flow': [15, 60, 50],
    'sensors': [7.5, 60, 80],
    'extras': [7.5, 50, 50],
    'myblocks': [57.5, 70, 14],
    'heap': [17.5, 60, 70],
};

const PALETTECOLORS = {
    'widgets': [37.5, 70, 35],
    'pitch': [37.5, 70, 42],
    'rhythm' : [12.5, 60, 49],
    'tone' : [57.5, 50, 21],
    'intervals' : [57.5, 50, 21],
    'drum' : [57.5, 50, 21],
    'turtle': [37.5, 70, 35],
    'pen': [57.5, 50, 21],
    'boxes': [12.5, 60, 49],
    'action': [22.5, 80, 35],
    'media': [57.5, 70, 21],
    'number': [0, 70, 28],
    'boolean': [30, 80, 35],
    'flow': [15, 60, 28],
    'sensors': [7.5, 60, 35],
    'extras': [7.5, 50, 28],
    'myblocks': [57.5, 70, 14],
    'heap': [17.5, 60, 28],
};

// These colors are calculated at load time from the colors defined above.
var PALETTEFILLCOLORS = {
};

var PALETTESTROKECOLORS = {
};

var PALETTEHIGHLIGHTCOLORS = {
};

var HIGHLIGHTSTROKECOLORS = {
};

const UPICON = '<svg width="55" height="55" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 55 55"><path d="M27.5,5C15.073,5,5,15.073,5,27.5C5,39.928,15.073,50,27.5,50S50,39.928,50,27.5 C50,15.073,39.927,5,27.5,5z M37.906,32.275c-0.626,0.624-1.447,0.939-2.271,0.939c-0.821,0-1.645-0.315-2.271-0.939l-5.84-5.833 l-5.657,5.802c-0.63,0.645-1.464,0.967-2.3,0.967c-0.808,0-1.62-0.305-2.246-0.914c-1.266-1.238-1.295-3.271-0.056-4.546 l7.929-8.126c0.002,0,0.002,0,0.003,0c0.01-0.011,0.015-0.021,0.022-0.028c0.116-0.115,0.245-0.208,0.371-0.302 c0.039-0.028,0.071-0.064,0.111-0.093c0.114-0.075,0.24-0.133,0.36-0.194c0.068-0.035,0.131-0.078,0.2-0.107 c0.1-0.039,0.203-0.064,0.306-0.093c0.099-0.032,0.191-0.068,0.292-0.09c0.083-0.018,0.169-0.018,0.251-0.028 c0.122-0.015,0.244-0.033,0.366-0.036c0.071,0,0.147,0.014,0.219,0.021c0.133,0.007,0.266,0.011,0.395,0.036 c0.075,0.014,0.146,0.043,0.223,0.064c0.123,0.035,0.251,0.061,0.373,0.111c0.082,0.032,0.161,0.082,0.243,0.121 c0.106,0.055,0.216,0.104,0.316,0.165c0.084,0.058,0.159,0.13,0.238,0.194c0.086,0.064,0.176,0.122,0.255,0.201 c0.005,0.003,0.009,0.011,0.013,0.014c0.007,0.004,0.011,0.008,0.014,0.011l8.142,8.13C39.162,28.981,39.166,31.014,37.906,32.275 z" fill="#000000"/></svg>';

const DOWNICON = '<svg width="55" height="55" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 55 55"><path d="M27.5,50C39.927,50,50,39.927,50,27.5C50,15.072,39.927,5,27.5,5S5,15.072,5,27.5 C5,39.927,15.073,50,27.5,50z M17.093,22.725c0.626-0.624,1.447-0.939,2.271-0.939c0.822,0,1.645,0.315,2.271,0.939l5.84,5.833 l5.657-5.802c0.63-0.645,1.464-0.967,2.3-0.967c0.808,0,1.62,0.305,2.246,0.914c1.266,1.238,1.295,3.271,0.056,4.546l-7.929,8.126 c-0.002,0-0.002,0-0.003,0c-0.01,0.011-0.015,0.021-0.022,0.028c-0.116,0.115-0.245,0.208-0.371,0.302 c-0.039,0.028-0.071,0.064-0.111,0.093c-0.114,0.075-0.24,0.133-0.36,0.194c-0.068,0.035-0.131,0.078-0.2,0.107 c-0.1,0.039-0.203,0.064-0.306,0.093c-0.099,0.032-0.191,0.068-0.292,0.09c-0.083,0.018-0.169,0.018-0.251,0.028 c-0.122,0.015-0.244,0.033-0.366,0.036c-0.071,0-0.147-0.014-0.219-0.021c-0.133-0.007-0.266-0.011-0.395-0.036 c-0.075-0.014-0.147-0.043-0.223-0.064c-0.124-0.035-0.251-0.061-0.373-0.111c-0.083-0.032-0.161-0.082-0.244-0.121 c-0.106-0.055-0.215-0.104-0.316-0.165c-0.084-0.058-0.16-0.13-0.239-0.194c-0.086-0.064-0.176-0.122-0.254-0.201 c-0.005-0.003-0.009-0.011-0.013-0.014c-0.007-0.004-0.011-0.008-0.014-0.011l-8.142-8.13 C15.837,26.019,15.834,23.986,17.093,22.725z" fill="#000000"/></svg>';

const FADEDUPICON = '<svg width="55" height="55" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 55 55"><path d="M27.5,5C15.073,5,5,15.073,5,27.5C5,39.928,15.073,50,27.5,50S50,39.928,50,27.5 C50,15.073,39.927,5,27.5,5z M37.906,32.275c-0.626,0.624-1.447,0.939-2.271,0.939c-0.821,0-1.645-0.315-2.271-0.939l-5.84-5.833 l-5.657,5.802c-0.63,0.645-1.464,0.967-2.3,0.967c-0.808,0-1.62-0.305-2.246-0.914c-1.266-1.238-1.295-3.271-0.056-4.546 l7.929-8.126c0.002,0,0.002,0,0.003,0c0.01-0.011,0.015-0.021,0.022-0.028c0.116-0.115,0.245-0.208,0.371-0.302 c0.039-0.028,0.071-0.064,0.111-0.093c0.114-0.075,0.24-0.133,0.36-0.194c0.068-0.035,0.131-0.078,0.2-0.107 c0.1-0.039,0.203-0.064,0.306-0.093c0.099-0.032,0.191-0.068,0.292-0.09c0.083-0.018,0.169-0.018,0.251-0.028 c0.122-0.015,0.244-0.033,0.366-0.036c0.071,0,0.147,0.014,0.219,0.021c0.133,0.007,0.266,0.011,0.395,0.036 c0.075,0.014,0.146,0.043,0.223,0.064c0.123,0.035,0.251,0.061,0.373,0.111c0.082,0.032,0.161,0.082,0.243,0.121 c0.106,0.055,0.216,0.104,0.316,0.165c0.084,0.058,0.159,0.13,0.238,0.194c0.086,0.064,0.176,0.122,0.255,0.201 c0.005,0.003,0.009,0.011,0.013,0.014c0.007,0.004,0.011,0.008,0.014,0.011l8.142,8.13C39.162,28.981,39.166,31.014,37.906,32.275 z" fill="#b8b8b8"/></svg>';

const FADEDDOWNICON = '<svg width="55" height="55" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 55 55"><path d="M27.5,50C39.927,50,50,39.927,50,27.5C50,15.072,39.927,5,27.5,5S5,15.072,5,27.5 C5,39.927,15.073,50,27.5,50z M17.093,22.725c0.626-0.624,1.447-0.939,2.271-0.939c0.822,0,1.645,0.315,2.271,0.939l5.84,5.833 l5.657-5.802c0.63-0.645,1.464-0.967,2.3-0.967c0.808,0,1.62,0.305,2.246,0.914c1.266,1.238,1.295,3.271,0.056,4.546l-7.929,8.126 c-0.002,0-0.002,0-0.003,0c-0.01,0.011-0.015,0.021-0.022,0.028c-0.116,0.115-0.245,0.208-0.371,0.302 c-0.039,0.028-0.071,0.064-0.111,0.093c-0.114,0.075-0.24,0.133-0.36,0.194c-0.068,0.035-0.131,0.078-0.2,0.107 c-0.1,0.039-0.203,0.064-0.306,0.093c-0.099,0.032-0.191,0.068-0.292,0.09c-0.083,0.018-0.169,0.018-0.251,0.028 c-0.122,0.015-0.244,0.033-0.366,0.036c-0.071,0-0.147-0.014-0.219-0.021c-0.133-0.007-0.266-0.011-0.395-0.036 c-0.075-0.014-0.147-0.043-0.223-0.064c-0.124-0.035-0.251-0.061-0.373-0.111c-0.083-0.032-0.161-0.082-0.244-0.121 c-0.106-0.055-0.215-0.104-0.316-0.165c-0.084-0.058-0.16-0.13-0.239-0.194c-0.086-0.064-0.176-0.122-0.254-0.201 c-0.005-0.003-0.009-0.011-0.013-0.014c-0.007-0.004-0.011-0.008-0.014-0.011l-8.142-8.13 C15.837,26.019,15.834,23.986,17.093,22.725z" fill="#b8b8b8"/></svg>';

const CLOSEICON = '<svg width="55" height="55" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 55 55"><g transform="translate(0-997.36)"><path fill="#282828" d="m0 997.36h55v54.998h-55z"/><g fill="#fff"><path d="m44.971 1036.26c1.675 1.674 1.675 4.39 0 6.06-1.675 1.674-4.391 1.674-6.07 0l-28.875-28.872c-1.675-1.674-1.675-4.39 0-6.06 1.675-1.674 4.391-1.674 6.07 0l28.875 28.872"/><path d="m16.09 1042.33c-1.675 1.674-4.391 1.674-6.07 0-1.675-1.674-1.675-4.39 0-6.06l28.875-28.871c1.675-1.674 4.391-1.674 6.07 0 1.675 1.674 1.675 4.39 0 6.06l-28.875 28.871"/></g></g></svg>';

const TURTLEPALETTEICON = '<svg height="55" id="svg40" inkscape:version="0.91 r13725" sodipodi:docname="hey.svg" version="1.1" viewBox="0 0 54.999998 54.999998" width="55" xmlns="http://www.w3.org/2000/svg" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:svg="http://www.w3.org/2000/svg"><sodipodi:namedview bordercolor="#666666" borderopacity="1" gridtolerance="10" guidetolerance="10" id="namedview24" inkscape:current-layer="g3586" inkscape:cx="21.308179" inkscape:cy="27.899852" inkscape:pageopacity="0" inkscape:pageshadow="2" inkscape:window-height="773" inkscape:window-maximized="0" inkscape:window-width="1444" inkscape:window-x="0" inkscape:window-y="0" inkscape:zoom="12.136524" objecttolerance="10" pagecolor="#ffffff" showgrid="false"/><metadata id="metadata46"><rdf:RDF><cc:Work rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/><dc:title/></cc:Work></rdf:RDF></metadata><defs id="defs44"/><g id="g3586" style="fill:#6cc600;stroke:#037700;stroke-width:1.99999976;stroke-miterlimit:4;stroke-dasharray:none" transform="translate(-3.1884835,0.12548216)"><path d="m 31.188483,5.8745178 -2,-1 -4,2 -3,6.0000002 -3,3 -5.999999,3 -2,4 2,4 c 2.595129,1.449868 7.411581,2 2,2 l -1,5 c 0,0 1.999999,7 1.999999,8 0,1 6,6 6,6 l 8,3 9,-2 4,-4 4,-7 v -5 l -1,-4 3,-4 1,-5 -5,-3 -3,-2 -5,-6.0000002 -2,-3 -3,-1 -1,1" id="path4725" style="fill:#6cc600;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"/><g id="g4704" transform="translate(1.449727)"><path d="m 44.760059,28.156906 c 0,0 1.463947,5.738921 1.001084,8.583832 -0.503422,3.094194 -1.733796,6.320068 -4.004337,8.583833 -2.061998,2.055845 -3.20724,2.828474 -6.006505,3.815036 -1.290398,0.454783 -4.973515,0.953759 -6.514048,0.953759 -1.540535,0 -5.223651,-0.498977 -6.514049,-0.95376 -2.799265,-0.986562 -3.944507,-1.759191 -6.006506,-3.815036 -2.270541,-2.263765 -3.500915,-5.489639 -4.004337,-8.583833 -0.462863,-2.844911 1.001084,-8.583832 1.001084,-8.583832 M 26.72654,22.43435 c 0,0 -4.122174,4.705629 -7.007589,5.722555 -1.877805,0.661806 -4.201946,0.826315 -6.006506,0 -1.925806,-0.881834 -3.58357,-2.772978 -4.0043369,-4.768796 -0.4783972,-2.26917 0.5589559,-4.123549 2.4704769,-5.529022 2.067374,-1.520067 4.598363,-1.662883 6.539282,-3.054811 2.515152,-1.803739 2.912345,-5.389772 5.005421,-7.6300732 1.420632,-1.520559 5.512965,-3.8150366 5.512965,-3.8150366 0,0 4.092331,2.2944775 5.512964,3.8150365 2.093073,2.2403013 2.490269,5.8263353 5.005421,7.6300743 1.940919,1.391928 4.538808,1.465531 6.606183,2.927334 1.937249,1.369793 2.881973,3.387329 2.403575,5.656499 -0.420767,1.995818 -2.078532,3.886962 -4.004337,4.768796 -1.80456,0.826315 -4.1287,0.661806 -6.006505,0 -2.885416,-1.016926 -7.00759,-5.722555 -7.00759,-5.722555" id="path4505-6" inkscape:connector-curvature="0" sodipodi:nodetypes="csssssssccsssssscssssssc" style="fill:none;stroke:#037700;stroke-width:1.95427048;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"/><g id="g4565" transform="matrix(1.0010843,0,0,0.95375917,55.952224,5.3863652)"><g id="g4553" transform="translate(0,-1)"><path d="M -30.228157,8.514322 C -33.422908,9.40349 -38.624018,5.874516 -40.102591,4.585664" id="path3411-7" style="fill:#6cc600;fill-rule:evenodd;stroke:#037700;stroke-width:1.93205309;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"/><path d="M -29.760199,5.904536 C -33.101366,5.473905 -35.931474,3.7361852 -37.633646,2.3416285" id="path3413-5" style="fill:#6cc600;fill-rule:evenodd;stroke:#037700;stroke-width:1.93205309;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"/></g><g id="g4557"><path d="m -23.145912,7.514322 c 3.194751,0.889168 8.395861,-2.639806 9.874434,-3.928658" id="path3411-3" style="fill:#6cc600;fill-rule:evenodd;stroke:#037700;stroke-width:1.93205309;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"/><path d="m -23.61387,4.904536 c 3.341167,-0.430631 6.171275,-2.168351 7.873447,-3.5629075" id="path3413-56" style="fill:#6cc600;fill-rule:evenodd;stroke:#037700;stroke-width:1.93205309;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"/></g></g><g id="g4636" transform="matrix(1.0010843,0,0,0.95375917,56.48087,3.4788469)"><ellipse cx="-30.836912" cy="14.612609" id="circle3409-2" rx="1.8846371" ry="2.0666313" style="fill:none;fill-rule:evenodd;stroke:#037700;stroke-width:1.99999976;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"/><ellipse cx="-23.593306" cy="14.699166" id="ellipse4229-9" rx="1.8846371" ry="2.0666313" style="fill:none;fill-rule:evenodd;stroke:#037700;stroke-width:1.99999976;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"/></g><g id="g4632" transform="matrix(1.0010843,0,0,0.95375917,56.577383,3.4788469)"><path d="m -37.186516,14.624518 c -14.340024,2.75008 -4.810404,15.671871 4.375,5.25" id="path4303-1" style="fill:none;fill-rule:evenodd;stroke:#037700;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"/><path d="m -17.436517,14.624518 c 14.3400245,2.75008 4.810404,15.671872 -4.375,5.25" id="path4303-1-2" style="fill:none;fill-rule:evenodd;stroke:#037700;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"/></g><path d="m 31.678113,3.3591671 c -1.384692,1.3140551 -1.985761,2.3793068 -2.459835,2.3793068 -0.662709,0 -1.27278,-1.0652517 -2.459836,-2.3793068 -0.97292,-1.0770097 1.101306,-2.37930771 2.459836,-2.37930771 1.358531,0 3.532987,1.36090081 2.459835,2.37930771 z" id="path4227-7" style="fill:#037700;fill-rule:evenodd;stroke:#037700;stroke-width:2.16383076;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"/></g><path d="m 31.302308,50.085622 c 0,0 0.723125,3.123831 5.500191,3.669996 4.777067,0.546166 11.784656,-3.778776 14.78791,-9.501331 3.003254,-5.722555 2.402683,-11.490783 3.003253,-18.121425" id="path4653" inkscape:connector-curvature="0" style="fill:none;stroke:#037700;stroke-width:1.95427048;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"/></g></svg>';<commit_msg>clean up turtle SVG; swap fill and stroke on turtle SVG<commit_after>// Copyright (c) 2014-16 <NAME>
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the The GNU Affero General Public
// License as published by the Free Software Foundation; either
// version 3 of the License, or (at your option) any later version.
//
// You should have received a copy of the GNU Affero General Public
// License along with this library; if not, write to the Free Software
// Foundation, 51 Franklin Street, Suite 500 Boston, MA 02110-1335 USA

// Defined below are the inline SVGs used for turtles and blocks. SVGs
// are modified by fill_color, stroke_color, block_label, et al. using
// .replace, e.g.,
// BASICBLOCK.replace(/fill_color/g,
// PALETTEFILLCOLORS['turtle']).replace(/stroke_color/g,
// PALETTESTROKECOLORS['turtle']).replace('block_label', 'clear'));
// Chrome can load the image type "data:image/svg+xml;utf8," inline,
// but Firefox cannot, so we set it in the async methods instead.
// The relative position of the button added to collapsible blocks,
// e.g., start and action. (TODO: Calculate these values.)
const COLLAPSEBUTTONXOFF = -48;
const COLLAPSEBUTTONYOFF = 9;

// With default scaling, blocks are multiples of a standard height.
const STANDARDBLOCKHEIGHT = 42;
const DEFAULTBLOCKSCALE = 1.5;  // scale used in block factory

// The default turtles are generated from the TURTLESVG template.
const FILLCOLORS = ['#ed001d', '#a34600', '#fb5f00', '#6cc600', '#00843c', '#008283', '#007ac9', '#005dff', '#b500e3', '#ec008a'];

const STROKECOLORS = ['#ffada6', '#ffa300', '#ffc000', '#037700', '#00fa8c', '#00f3db', '#00e3ff', '#8dceff', '#f3aeff', '#ff97d5'];

// (fill_color, stroke_color)
const TURTLESVG = '<?xml version="1.0" encoding="UTF-8" standalone="no"?> <svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" width="55" viewBox="0 0 54.999998 54.999998" version="1.1" id="svg40" height="55"> <g transform="translate(-3.1884835,0.12548216)" style="fill:stroke_color;stroke:fill_color;stroke-width:1.99999976;stroke-miterlimit:4;stroke-dasharray:none" id="g3586"> <path style="fill:stroke_color;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" id="path4725" d="m 31.188483,5.8745178 c 0,0 -1.254644,-1 -2,-1 -1.490712,0 -2.945907,0.9459074 -4,2 -1.581139,1.5811389 -1.692548,4.1860072 -3,6.0000002 -0.826905,1.14727 -1.85273,2.173095 -3,3 -1.813992,1.307452 -4.41886,1.418861 -5.999999,3 -1.054093,1.054093 -2,2.509288 -2,4 0,1.490712 1.176934,3.540162 2,4 2.595129,1.449868 0.836609,0.648512 2,2 0,0 -1.040434,3.300808 -1,5 0.06539,2.747959 1.999999,7 1.999999,8 0,1 3.621931,4.46873 6,6 2.394526,1.541867 5.323775,2.059095 8.164792,2.258437 3.065644,0.215103 5.976447,-0.356365 8.670416,-1.835208 1.652944,-0.907377 3.020234,-1.924716 4.164792,-3.423229 1.631246,-2.13571 3.310226,-4.40261 4,-7 0.42778,-1.610833 0.203639,-3.345821 0,-5 -0.167925,-1.364071 -1.27205,-2.652826 -1,-4 0.329909,-1.633688 2.319717,-2.47849 3,-4 0.693755,-1.551642 1.687609,-3.445625 1,-5 -0.786311,-1.777496 -3.357594,-1.960634 -5,-3 -1.015577,-0.642689 -2.106041,-1.196706 -3,-2 -1.93647,-1.740075 -3.442391,-3.913943 -5,-6.0000002 -0.71906,-0.9630146 -1.044881,-2.2704844 -2,-3 -0.837694,-0.6398275 -1.974105,-1.2421808 -3,-1 -0.458794,0.1083066 -1,1 -1,1" /> <path d="m 46.209786,28.156906 c 0,0 1.463947,5.738921 1.001084,8.583832 -0.503422,3.094194 -1.733796,6.320068 -4.004337,8.583833 -2.061998,2.055845 -3.20724,2.828474 -6.006505,3.815036 -1.290398,0.454783 -4.973515,0.953759 -6.514048,0.953759 -1.540535,0 -5.223651,-0.498977 -6.514049,-0.95376 -2.799265,-0.986562 -3.944507,-1.759191 -6.006506,-3.815036 -2.270541,-2.263765 -3.500915,-5.489639 -4.004337,-8.583833 -0.462863,-2.844911 1.001084,-8.583832 1.001084,-8.583832 M 28.176267,22.43435 c 0,0 -4.122174,4.705629 -7.007589,5.722555 -1.877805,0.661806 -4.201946,0.826315 -6.006506,0 -1.925806,-0.881834 -3.58357,-2.772978 -4.004337,-4.768796 -0.478397,-2.26917 0.558956,-4.123549 2.470477,-5.529022 2.067374,-1.520067 4.598363,-1.662883 6.539282,-3.054811 2.515152,-1.803739 2.912345,-5.389772 5.005421,-7.6300732 1.420632,-1.520559 5.512965,-3.8150366 5.512965,-3.8150366 0,0 4.092331,2.2944775 5.512964,3.8150365 2.093073,2.2403013 2.490269,5.8263353 5.005421,7.6300743 1.940919,1.391928 4.538808,1.465531 6.606183,2.927334 1.937249,1.369793 2.881973,3.387329 2.403575,5.656499 -0.420767,1.995818 -2.078532,3.886962 -4.004337,4.768796 -1.80456,0.826315 -4.1287,0.661806 -6.006505,0 -2.885416,-1.016926 -7.00759,-5.722555 -7.00759,-5.722555" id="path4505-6" style="fill:none;stroke:fill_color;stroke-width:1.95427048;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> <g id="g4565" transform="matrix(1.0010843,0,0,0.95375917,57.401951,5.3863652)" style="fill:none;stroke:fill_color;stroke-opacity:1"> <g id="g4553" transform="translate(0,-1)" style="fill:none;stroke:fill_color;stroke-opacity:1"> <path d="M -30.228157,8.514322 C -33.422908,9.40349 -38.624018,5.874516 -40.102591,4.585664" id="path3411-7" style="fill:none;fill-rule:evenodd;stroke:fill_color;stroke-width:1.93205309;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> <path d="M -29.760199,5.904536 C -33.101366,5.473905 -35.931474,3.7361852 -37.633646,2.3416285" id="path3413-5" style="fill:none;fill-rule:evenodd;stroke:fill_color;stroke-width:1.93205309;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> </g> <g id="g4557" style="fill:none;stroke:fill_color;stroke-opacity:1"> <path d="m -23.145912,7.514322 c 3.194751,0.889168 8.395861,-2.639806 9.874434,-3.928658" id="path3411-3" style="fill:none;fill-rule:evenodd;stroke:fill_color;stroke-width:1.93205309;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> <path d="m -23.61387,4.904536 c 3.341167,-0.430631 6.171275,-2.168351 7.873447,-3.5629075" id="path3413-56" style="fill:none;fill-rule:evenodd;stroke:fill_color;stroke-width:1.93205309;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> </g> </g> <g id="g4636" transform="matrix(1.0010843,0,0,0.95375917,57.930597,3.4788469)" style="fill:#ffffff;stroke:fill_color;stroke-opacity:1;fill-opacity:0.94117647"> <ellipse cx="-30.836912" cy="14.612609" id="circle3409-2" rx="1.8846371" ry="2.0666313" style="fill:#ffffff;fill-rule:evenodd;stroke:fill_color;stroke-width:1.99999976;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;fill-opacity:0.94117647" /> <ellipse cx="-23.593306" cy="14.699166" id="ellipse4229-9" rx="1.8846371" ry="2.0666313" style="fill:#ffffff;fill-rule:evenodd;stroke:fill_color;stroke-width:1.99999976;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;fill-opacity:0.94117647" /> </g> <g id="g4632" transform="matrix(1.0010843,0,0,0.95375917,58.02711,3.4788469)" style="fill:none;stroke:fill_color;stroke-opacity:1"> <path d="m -37.186516,14.624518 c -14.340024,2.75008 -4.810404,15.671871 4.375,5.25" id="path4303-1" style="fill:none;fill-rule:evenodd;stroke:fill_color;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> <path d="m -17.436517,14.624518 c 14.3400245,2.75008 4.810404,15.671872 -4.375,5.25" id="path4303-1-2" style="fill:none;fill-rule:evenodd;stroke:fill_color;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> </g> <path d="m 33.12784,3.3591671 c -1.384692,1.3140551 -1.985761,2.3793068 -2.459835,2.3793068 -0.662709,0 -1.27278,-1.0652517 -2.459836,-2.3793068 -0.97292,-1.0770097 1.101306,-2.37930771 2.459836,-2.37930771 1.358531,0 3.532987,1.36090081 2.459835,2.37930771 z" id="path4227-7" style="fill:fill_color;fill-rule:evenodd;stroke:fill_color;stroke-width:2.16383076;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;fill-opacity:1" /> <path style="fill:none;stroke:fill_color;stroke-width:1.95427048;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" id="path4653" d="m 31.302308,50.085622 c 0,0 0.723125,3.123831 5.500191,3.669996 4.777067,0.546166 11.784656,-3.778776 14.78791,-9.501331 3.003254,-5.722555 2.402683,-11.490783 3.003253,-18.121425" /> </g> </svg>'

const DRUMSVG = '<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" version="1.1" width="55" height="55" viewBox="0 0 55 55" id="svg2" xml:space="preserve"><path d="m 9.653,18.199 h 35.54 c 0.772,0 1.4,0.628 1.4,1.403 v 2.362 c 0,0.771 -0.628,1.401 -1.4,1.401 H 9.653 c -0.775,0 -1.403,-0.628 -1.403,-1.401 v -2.361 c 0,-0.777 0.627,-1.404 1.403,-1.404 z" id="path8" style="fill:stroke_color;stroke:stroke_color;stroke-width:3.5;stroke-linecap:round;stroke-linejoin:round;display:inline" /><rect width="33.139" height="22.128" x="10.852" y="23.365" id="rect10" style="fill:stroke_color;stroke:stroke_color;stroke-width:3.5;stroke-linecap:round;stroke-linejoin:round;display:inline" /><path d="m 9.653,45.493 h 35.54 c 0.772,0 1.4,0.627 1.4,1.401 v 2.362 c 0,0.775 -0.628,1.405 -1.4,1.405 H 9.653 c -0.775,0 -1.403,-0.629 -1.403,-1.405 v -2.362 c 0,-0.77 0.627,-1.401 1.403,-1.401 z" id="path17" style="fill:stroke_color;stroke:stroke_color;stroke-width:3.5;stroke-linecap:round;stroke-linejoin:round;display:inline" /><path d="M 10.851,45.491 19.395,23.365 27.291,45.49 35.217,23.364" id="path19" style="fill:none;stroke:stroke_color;stroke-width:3.5;stroke-linecap:round;stroke-linejoin:round;display:inline" /><path d="M 43.987,45.491 35.217,23.365" id="path21" style="fill:none;stroke:stroke_color;stroke-width:3.5;stroke-linecap:round;stroke-linejoin:round;display:inline" /><line style="fill:none;stroke:stroke_color;stroke-width:3.5;stroke-linecap:round;stroke-linejoin:round;display:inline" y2="5.948" y1="13.149" x2="48.335999" x1="33.689999" id="line27" display="inline" /><line style="fill:none;stroke:stroke_color;stroke-width:3.5;stroke-linecap:round;stroke-linejoin:round;display:inline" y2="9.4799995" y1="2.2130001" x2="20.658001" x1="6.0419998" id="line29" display="inline" /><path d="m 25.721,9.802 c 0.55,1.451 -0.171,3.066 -1.608,3.612 -1.437,0.545 -3.049,-0.188 -3.599,-1.639 -0.547,-1.45 0.174,-3.067 1.609,-3.613 1.438,-0.542 3.049,0.19 3.598,1.64 z" id="path23" style="fill:stroke_color;stroke:stroke_color;stroke-width:2.25;stroke-linecap:round;stroke-linejoin:round;display:inline" /><path d="m 33.338,16.442 c -1.04,1.125 -2.798,1.189 -3.928,0.144 -1.128,-1.044 -1.197,-2.801 -0.155,-3.927 1.041,-1.125 2.8,-1.19 3.926,-0.146 1.129,1.045 1.2,2.803 0.157,3.929 z" id="path25" style="fill:stroke_color;stroke:stroke_color;stroke-width:2.25;stroke-linecap:round;stroke-linejoin:round;display:inline" /></svg>';

// Offsets for placing text ontop of value blocks.
const TEXTX = 26;
const TEXTY = 26;
const VALUETEXTX = 70;

// Collapse text label positions
const COLLAPSETEXTX = 10;
const COLLAPSETEXTY = 40;

// Artwork position in Media Block
const MEDIASAFEAREA = [40, 4, 108, 80];

// Palette-related artwork
const HIGHLIGHTCOLOR = '#FFFFFF';
const ACTIVECOLOR = '#212121';


function showMaterialHighlight(x, y, r, event, scale, stage) {
    var circles = {
        highlight: new createjs.Shape(),
        active: new createjs.Shape()
    };

    circles.highlight.graphics.f(HIGHLIGHTCOLOR).drawCircle(0, 0, r);
    circles.highlight.alpha = 0.3;
    circles.highlight.x = x;
    circles.highlight.y = y;

    circles.active.graphics.f(ACTIVECOLOR).drawCircle(0, 0, r);
    circles.active.alpha = 0;

    stage.addChild(circles.highlight, circles.active);

    createjs.Tween.get(circles.active).to({scaleX: 0.3, scaleY: 0.3, x: event.rawX / scale, y: event.rawY / scale}).to({scaleX: 1, scaleY: 1, x: x, y: y}, 650, createjs.Ease.circInOut);

    createjs.Tween.get(circles.active).to({alpha: 0.05}).to({alpha: 0.3}, 400);
    return circles;
}


function hideButtonHighlight(circles, stage) {
    // Un-real circles!
    if (circles.active === undefined) {
        return;
    }

    createjs.Tween.get(circles.active).to({alpha: 0}, 400);
    createjs.Tween.get(circles.highlight).to({alpha: 0}, 400);
    setTimeout(function() {
        stage.removeChild(circles.active, circles.highlight);
    }, 650);
}


const MENUWIDTH = 200;

const PALETTEFILLER = '<svg xmlns="http://www.w3.org/2000/svg" width="200" height="filler_height">' + '<rect width="200" height="filler_height" x="0" y="0" style="fill:#b3b3b3;fill-opacity:1;stroke:none" />' + '</svg>';

const PALETTEHEADER = '<svg xmlns="http://www.w3.org/2000/svg" width="header_width" height="42">' + '<rect width="header_width" height="42" x="0" y="0" style="fill:fill_color;fill-opacity:1;stroke:none" />' + '<text style="font-size:16px;font-style:normal;font-weight:normal;text-align:end;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:end;fill-opacity:1;stroke:none;font-family:Sans">' + '<tspan  x="55" y="30" style="font-size:24px;text-align:start;text-anchor:start;fill:#ffffff">palette_label</tspan>' + '</text>' + '</svg>';

const PALETTEBUTTON = '<svg xmlns="http://www.w3.org/2000/svg" width="55" height="55">' + '<circle cx="27.5" cy="27.5" r="27.5" x="0" y="0" style="fill:fill_color;fill-opacity:1;stroke:none" />' + '</svg>';

// samples-viewer related artwork

const BACKGROUND = '<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="650" height="590">' + '<rect width="650" height="590" x="0" y="0" style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none" />' + '<g transform="translate(595,0)" style="fill:#000000;display:block">' + '<path d="m 27.557,5.053 c -12.43,0 -22.5,10.076 -22.5,22.497 0,12.432 10.07,22.503 22.5,22.503 12.431,0 22.5,-10.071 22.5,-22.503 0,-12.421 -10.07,-22.497 -22.5,-22.497 z m 10.199,28.159 c 1.254,1.256 1.257,3.291 0,4.545 -0.628,0.629 -1.451,0.943 -2.274,0.943 -0.822,0 -1.644,-0.314 -2.27,-0.94 l -5.76,-5.761 -5.76,5.761 c -0.627,0.626 -1.449,0.94 -2.271,0.94 -0.823,0 -1.647,-0.314 -2.275,-0.943 -1.254,-1.254 -1.254,-3.289 0.004,-4.545 l 5.758,-5.758 -5.758,-5.758 c -1.258,-1.254 -1.258,-3.292 -0.004,-4.546 1.255,-1.254 3.292,-1.259 4.546,0 l 5.76,5.759 5.76,-5.759 c 1.252,-1.259 3.288,-1.254 4.544,0 1.257,1.254 1.254,3.292 0,4.546 l -5.758,5.758 5.758,5.758 z" style="fill:#000000;display:inline" />' + '</g>' + '</svg>';

const NEXTBUTTON = '<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="55" height="55">' + '<path d="M27.5,50C39.927,50,50,39.927,50,27.5C50,15.072,39.927,5,27.5,5S5,15.072,5,27.5 C5,39.927,15.073,50,27.5,50z M17.093,22.725c0.626-0.624,1.447-0.939,2.271-0.939c0.822,0,1.645,0.315,2.271,0.939l5.84,5.833 l5.657-5.802c0.63-0.645,1.464-0.967,2.3-0.967c0.808,0,1.62,0.305,2.246,0.914c1.266,1.238,1.295,3.271,0.056,4.546l-7.929,8.126 c-0.002,0-0.002,0-0.003,0c-0.01,0.011-0.015,0.021-0.022,0.028c-0.116,0.115-0.245,0.208-0.371,0.302 c-0.039,0.028-0.071,0.064-0.111,0.093c-0.114,0.075-0.24,0.133-0.36,0.194c-0.068,0.035-0.131,0.078-0.2,0.107 c-0.1,0.039-0.203,0.064-0.306,0.093c-0.099,0.032-0.191,0.068-0.292,0.09c-0.083,0.018-0.169,0.018-0.251,0.028 c-0.122,0.015-0.244,0.033-0.366,0.036c-0.071,0-0.147-0.014-0.219-0.021c-0.133-0.007-0.266-0.011-0.395-0.036 c-0.075-0.014-0.147-0.043-0.223-0.064c-0.124-0.035-0.251-0.061-0.373-0.111c-0.083-0.032-0.161-0.082-0.244-0.121 c-0.106-0.055-0.215-0.104-0.316-0.165c-0.084-0.058-0.16-0.13-0.239-0.194c-0.086-0.064-0.176-0.122-0.254-0.201 c-0.005-0.003-0.009-0.011-0.013-0.014c-0.007-0.004-0.011-0.008-0.014-0.011l-8.142-8.13 C15.837,26.019,15.834,23.986,17.093,22.725z" fill="#000000"/>' + '</svg>';

const PREVBUTTON = '<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="55" height="55">' + '<path d="M27.5,5C15.073,5,5,15.073,5,27.5C5,39.928,15.073,50,27.5,50S50,39.928,50,27.5 C50,15.073,39.927,5,27.5,5z M37.906,32.275c-0.626,0.624-1.447,0.939-2.271,0.939c-0.821,0-1.645-0.315-2.271-0.939l-5.84-5.833 l-5.657,5.802c-0.63,0.645-1.464,0.967-2.3,0.967c-0.808,0-1.62-0.305-2.246-0.914c-1.266-1.238-1.295-3.271-0.056-4.546 l7.929-8.126c0.002,0,0.002,0,0.003,0c0.01-0.011,0.015-0.021,0.022-0.028c0.116-0.115,0.245-0.208,0.371-0.302 c0.039-0.028,0.071-0.064,0.111-0.093c0.114-0.075,0.24-0.133,0.36-0.194c0.068-0.035,0.131-0.078,0.2-0.107 c0.1-0.039,0.203-0.064,0.306-0.093c0.099-0.032,0.191-0.068,0.292-0.09c0.083-0.018,0.169-0.018,0.251-0.028 c0.122-0.015,0.244-0.033,0.366-0.036c0.071,0,0.147,0.014,0.219,0.021c0.133,0.007,0.266,0.011,0.395,0.036 c0.075,0.014,0.146,0.043,0.223,0.064c0.123,0.035,0.251,0.061,0.373,0.111c0.082,0.032,0.161,0.082,0.243,0.121 c0.106,0.055,0.216,0.104,0.316,0.165c0.084,0.058,0.159,0.13,0.238,0.194c0.086,0.064,0.176,0.122,0.255,0.201 c0.005,0.003,0.009,0.011,0.013,0.014c0.007,0.004,0.011,0.008,0.014,0.011l8.142,8.13C39.162,28.981,39.166,31.014,37.906,32.275 z" fill="#000000"/>' + '</svg>';

// for print and error messages
const MSGBLOCK = '<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="1000" height="42">' + '<g transform="matrix(2,0,0,2,0,8)">' + '<path d="m 0.5,8.5 0,-8 c 0,-2.09 1.91,-4 4,-4 l 4,0 10,0 473,0 4,0 c 2.09,0 4.26,1.92 4,4 l 0,8 0,4 c 0,2.09 -1.91,4 -4,4 l -4,0 -473,0 -10,0 -4,0 c -2.09,0 -4,-1.91 -4,-4 z" style="fill:fill_color;fill-opacity:1;stroke:stroke_color;stroke-width:1;stroke-linecap:round;stroke-opacity:1" />' + '</g>' + '</svg>';

// boundary for screen
const BOUNDARY = '<svg xmlns="http://www.w3.org/2000/svg" height="HEIGHT" width="WIDTH"> <rect style="fill:none;stroke:stroke_color;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:9, 9;stroke-dashoffset:0;stroke-opacity:1" y="Y" x="X" height="DY" width="DX" /></svg>';

// border for trashcan
const BORDER = '<svg xmlns="http://www.w3.org/2000/svg" width="120" height="120">' + '<rect width="115" height="115" x="2.5" y="2.5" style="fill:none;stroke:stroke_color;stroke-width:5.0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:15, 15;stroke-dashoffset:0" />' + '</svg>';

// palette artwork
// Palettes have different colored blocks
// hue, value, chroma
const PALETTECOLORS0 = {
    'widgets': [37.5, 70, 50],
    'pitch': [37.5, 70, 50],
    'rhythm' : [12.5, 60, 80],
    'tone' : [57.5, 50, 28],
    'intervals':  [57.5, 50, 28],
    'drum' : [57.5, 50, 28],
    'turtle': [37.5, 70, 50],
    'pen': [57.5, 50, 28],
    'boxes': [12.5, 60, 80],
    'action': [22.5, 80, 57],
    'media': [57.5, 70, 28],
    'number': [0, 70, 42],
    'boolean': [30, 80, 57],
    'flow': [15, 60, 50],
    'sensors': [7.5, 60, 80],
    'extras': [7.5, 50, 50],
    'myblocks': [57.5, 70, 14],
    'heap': [17.5, 60, 70],
};

const PALETTECOLORS = {
    'widgets': [37.5, 70, 35],
    'pitch': [37.5, 70, 42],
    'rhythm' : [12.5, 60, 49],
    'tone' : [57.5, 50, 21],
    'intervals' : [57.5, 50, 21],
    'drum' : [57.5, 50, 21],
    'turtle': [37.5, 70, 35],
    'pen': [57.5, 50, 21],
    'boxes': [12.5, 60, 49],
    'action': [22.5, 80, 35],
    'media': [57.5, 70, 21],
    'number': [0, 70, 28],
    'boolean': [30, 80, 35],
    'flow': [15, 60, 28],
    'sensors': [7.5, 60, 35],
    'extras': [7.5, 50, 28],
    'myblocks': [57.5, 70, 14],
    'heap': [17.5, 60, 28],
};

// These colors are calculated at load time from the colors defined above.
var PALETTEFILLCOLORS = {
};

var PALETTESTROKECOLORS = {
};

var PALETTEHIGHLIGHTCOLORS = {
};

var HIGHLIGHTSTROKECOLORS = {
};

const UPICON = '<svg width="55" height="55" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 55 55"><path d="M27.5,5C15.073,5,5,15.073,5,27.5C5,39.928,15.073,50,27.5,50S50,39.928,50,27.5 C50,15.073,39.927,5,27.5,5z M37.906,32.275c-0.626,0.624-1.447,0.939-2.271,0.939c-0.821,0-1.645-0.315-2.271-0.939l-5.84-5.833 l-5.657,5.802c-0.63,0.645-1.464,0.967-2.3,0.967c-0.808,0-1.62-0.305-2.246-0.914c-1.266-1.238-1.295-3.271-0.056-4.546 l7.929-8.126c0.002,0,0.002,0,0.003,0c0.01-0.011,0.015-0.021,0.022-0.028c0.116-0.115,0.245-0.208,0.371-0.302 c0.039-0.028,0.071-0.064,0.111-0.093c0.114-0.075,0.24-0.133,0.36-0.194c0.068-0.035,0.131-0.078,0.2-0.107 c0.1-0.039,0.203-0.064,0.306-0.093c0.099-0.032,0.191-0.068,0.292-0.09c0.083-0.018,0.169-0.018,0.251-0.028 c0.122-0.015,0.244-0.033,0.366-0.036c0.071,0,0.147,0.014,0.219,0.021c0.133,0.007,0.266,0.011,0.395,0.036 c0.075,0.014,0.146,0.043,0.223,0.064c0.123,0.035,0.251,0.061,0.373,0.111c0.082,0.032,0.161,0.082,0.243,0.121 c0.106,0.055,0.216,0.104,0.316,0.165c0.084,0.058,0.159,0.13,0.238,0.194c0.086,0.064,0.176,0.122,0.255,0.201 c0.005,0.003,0.009,0.011,0.013,0.014c0.007,0.004,0.011,0.008,0.014,0.011l8.142,8.13C39.162,28.981,39.166,31.014,37.906,32.275 z" fill="#000000"/></svg>';

const DOWNICON = '<svg width="55" height="55" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 55 55"><path d="M27.5,50C39.927,50,50,39.927,50,27.5C50,15.072,39.927,5,27.5,5S5,15.072,5,27.5 C5,39.927,15.073,50,27.5,50z M17.093,22.725c0.626-0.624,1.447-0.939,2.271-0.939c0.822,0,1.645,0.315,2.271,0.939l5.84,5.833 l5.657-5.802c0.63-0.645,1.464-0.967,2.3-0.967c0.808,0,1.62,0.305,2.246,0.914c1.266,1.238,1.295,3.271,0.056,4.546l-7.929,8.126 c-0.002,0-0.002,0-0.003,0c-0.01,0.011-0.015,0.021-0.022,0.028c-0.116,0.115-0.245,0.208-0.371,0.302 c-0.039,0.028-0.071,0.064-0.111,0.093c-0.114,0.075-0.24,0.133-0.36,0.194c-0.068,0.035-0.131,0.078-0.2,0.107 c-0.1,0.039-0.203,0.064-0.306,0.093c-0.099,0.032-0.191,0.068-0.292,0.09c-0.083,0.018-0.169,0.018-0.251,0.028 c-0.122,0.015-0.244,0.033-0.366,0.036c-0.071,0-0.147-0.014-0.219-0.021c-0.133-0.007-0.266-0.011-0.395-0.036 c-0.075-0.014-0.147-0.043-0.223-0.064c-0.124-0.035-0.251-0.061-0.373-0.111c-0.083-0.032-0.161-0.082-0.244-0.121 c-0.106-0.055-0.215-0.104-0.316-0.165c-0.084-0.058-0.16-0.13-0.239-0.194c-0.086-0.064-0.176-0.122-0.254-0.201 c-0.005-0.003-0.009-0.011-0.013-0.014c-0.007-0.004-0.011-0.008-0.014-0.011l-8.142-8.13 C15.837,26.019,15.834,23.986,17.093,22.725z" fill="#000000"/></svg>';

const FADEDUPICON = '<svg width="55" height="55" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 55 55"><path d="M27.5,5C15.073,5,5,15.073,5,27.5C5,39.928,15.073,50,27.5,50S50,39.928,50,27.5 C50,15.073,39.927,5,27.5,5z M37.906,32.275c-0.626,0.624-1.447,0.939-2.271,0.939c-0.821,0-1.645-0.315-2.271-0.939l-5.84-5.833 l-5.657,5.802c-0.63,0.645-1.464,0.967-2.3,0.967c-0.808,0-1.62-0.305-2.246-0.914c-1.266-1.238-1.295-3.271-0.056-4.546 l7.929-8.126c0.002,0,0.002,0,0.003,0c0.01-0.011,0.015-0.021,0.022-0.028c0.116-0.115,0.245-0.208,0.371-0.302 c0.039-0.028,0.071-0.064,0.111-0.093c0.114-0.075,0.24-0.133,0.36-0.194c0.068-0.035,0.131-0.078,0.2-0.107 c0.1-0.039,0.203-0.064,0.306-0.093c0.099-0.032,0.191-0.068,0.292-0.09c0.083-0.018,0.169-0.018,0.251-0.028 c0.122-0.015,0.244-0.033,0.366-0.036c0.071,0,0.147,0.014,0.219,0.021c0.133,0.007,0.266,0.011,0.395,0.036 c0.075,0.014,0.146,0.043,0.223,0.064c0.123,0.035,0.251,0.061,0.373,0.111c0.082,0.032,0.161,0.082,0.243,0.121 c0.106,0.055,0.216,0.104,0.316,0.165c0.084,0.058,0.159,0.13,0.238,0.194c0.086,0.064,0.176,0.122,0.255,0.201 c0.005,0.003,0.009,0.011,0.013,0.014c0.007,0.004,0.011,0.008,0.014,0.011l8.142,8.13C39.162,28.981,39.166,31.014,37.906,32.275 z" fill="#b8b8b8"/></svg>';

const FADEDDOWNICON = '<svg width="55" height="55" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 55 55"><path d="M27.5,50C39.927,50,50,39.927,50,27.5C50,15.072,39.927,5,27.5,5S5,15.072,5,27.5 C5,39.927,15.073,50,27.5,50z M17.093,22.725c0.626-0.624,1.447-0.939,2.271-0.939c0.822,0,1.645,0.315,2.271,0.939l5.84,5.833 l5.657-5.802c0.63-0.645,1.464-0.967,2.3-0.967c0.808,0,1.62,0.305,2.246,0.914c1.266,1.238,1.295,3.271,0.056,4.546l-7.929,8.126 c-0.002,0-0.002,0-0.003,0c-0.01,0.011-0.015,0.021-0.022,0.028c-0.116,0.115-0.245,0.208-0.371,0.302 c-0.039,0.028-0.071,0.064-0.111,0.093c-0.114,0.075-0.24,0.133-0.36,0.194c-0.068,0.035-0.131,0.078-0.2,0.107 c-0.1,0.039-0.203,0.064-0.306,0.093c-0.099,0.032-0.191,0.068-0.292,0.09c-0.083,0.018-0.169,0.018-0.251,0.028 c-0.122,0.015-0.244,0.033-0.366,0.036c-0.071,0-0.147-0.014-0.219-0.021c-0.133-0.007-0.266-0.011-0.395-0.036 c-0.075-0.014-0.147-0.043-0.223-0.064c-0.124-0.035-0.251-0.061-0.373-0.111c-0.083-0.032-0.161-0.082-0.244-0.121 c-0.106-0.055-0.215-0.104-0.316-0.165c-0.084-0.058-0.16-0.13-0.239-0.194c-0.086-0.064-0.176-0.122-0.254-0.201 c-0.005-0.003-0.009-0.011-0.013-0.014c-0.007-0.004-0.011-0.008-0.014-0.011l-8.142-8.13 C15.837,26.019,15.834,23.986,17.093,22.725z" fill="#b8b8b8"/></svg>';

const CLOSEICON = '<svg width="55" height="55" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 55 55"><g transform="translate(0-997.36)"><path fill="#282828" d="m0 997.36h55v54.998h-55z"/><g fill="#fff"><path d="m44.971 1036.26c1.675 1.674 1.675 4.39 0 6.06-1.675 1.674-4.391 1.674-6.07 0l-28.875-28.872c-1.675-1.674-1.675-4.39 0-6.06 1.675-1.674 4.391-1.674 6.07 0l28.875 28.872"/><path d="m16.09 1042.33c-1.675 1.674-4.391 1.674-6.07 0-1.675-1.674-1.675-4.39 0-6.06l28.875-28.871c1.675-1.674 4.391-1.674 6.07 0 1.675 1.674 1.675 4.39 0 6.06l-28.875 28.871"/></g></g></svg>';

const TURTLEPALETTEICON = '<?xml version="1.0" encoding="UTF-8" standalone="no"?> <svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" width="55" viewBox="0 0 54.999998 54.999998" version="1.1" id="svg40" height="55"> <g transform="translate(-3.1884835,0.12548216)" style="fill:#6cc600;stroke:#037700;stroke-width:1.99999976;stroke-miterlimit:4;stroke-dasharray:none" id="g3586"> <path style="fill:#6cc600;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" id="path4725" d="m 31.188483,5.8745178 c 0,0 -1.254644,-1 -2,-1 -1.490712,0 -2.945907,0.9459074 -4,2 -1.581139,1.5811389 -1.692548,4.1860072 -3,6.0000002 -0.826905,1.14727 -1.85273,2.173095 -3,3 -1.813992,1.307452 -4.41886,1.418861 -5.999999,3 -1.054093,1.054093 -2,2.509288 -2,4 0,1.490712 1.176934,3.540162 2,4 2.595129,1.449868 0.836609,0.648512 2,2 0,0 -1.040434,3.300808 -1,5 0.06539,2.747959 1.999999,7 1.999999,8 0,1 3.621931,4.46873 6,6 2.394526,1.541867 5.323775,2.059095 8.164792,2.258437 3.065644,0.215103 5.976447,-0.356365 8.670416,-1.835208 1.652944,-0.907377 3.020234,-1.924716 4.164792,-3.423229 1.631246,-2.13571 3.310226,-4.40261 4,-7 0.42778,-1.610833 0.203639,-3.345821 0,-5 -0.167925,-1.364071 -1.27205,-2.652826 -1,-4 0.329909,-1.633688 2.319717,-2.47849 3,-4 0.693755,-1.551642 1.687609,-3.445625 1,-5 -0.786311,-1.777496 -3.357594,-1.960634 -5,-3 -1.015577,-0.642689 -2.106041,-1.196706 -3,-2 -1.93647,-1.740075 -3.442391,-3.913943 -5,-6.0000002 -0.71906,-0.9630146 -1.044881,-2.2704844 -2,-3 -0.837694,-0.6398275 -1.974105,-1.2421808 -3,-1 -0.458794,0.1083066 -1,1 -1,1" /> <path d="m 46.209786,28.156906 c 0,0 1.463947,5.738921 1.001084,8.583832 -0.503422,3.094194 -1.733796,6.320068 -4.004337,8.583833 -2.061998,2.055845 -3.20724,2.828474 -6.006505,3.815036 -1.290398,0.454783 -4.973515,0.953759 -6.514048,0.953759 -1.540535,0 -5.223651,-0.498977 -6.514049,-0.95376 -2.799265,-0.986562 -3.944507,-1.759191 -6.006506,-3.815036 -2.270541,-2.263765 -3.500915,-5.489639 -4.004337,-8.583833 -0.462863,-2.844911 1.001084,-8.583832 1.001084,-8.583832 M 28.176267,22.43435 c 0,0 -4.122174,4.705629 -7.007589,5.722555 -1.877805,0.661806 -4.201946,0.826315 -6.006506,0 -1.925806,-0.881834 -3.58357,-2.772978 -4.004337,-4.768796 -0.478397,-2.26917 0.558956,-4.123549 2.470477,-5.529022 2.067374,-1.520067 4.598363,-1.662883 6.539282,-3.054811 2.515152,-1.803739 2.912345,-5.389772 5.005421,-7.6300732 1.420632,-1.520559 5.512965,-3.8150366 5.512965,-3.8150366 0,0 4.092331,2.2944775 5.512964,3.8150365 2.093073,2.2403013 2.490269,5.8263353 5.005421,7.6300743 1.940919,1.391928 4.538808,1.465531 6.606183,2.927334 1.937249,1.369793 2.881973,3.387329 2.403575,5.656499 -0.420767,1.995818 -2.078532,3.886962 -4.004337,4.768796 -1.80456,0.826315 -4.1287,0.661806 -6.006505,0 -2.885416,-1.016926 -7.00759,-5.722555 -7.00759,-5.722555" id="path4505-6" style="fill:none;stroke:#037700;stroke-width:1.95427048;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> <g id="g4565" transform="matrix(1.0010843,0,0,0.95375917,57.401951,5.3863652)" style="fill:none;stroke:#037700;stroke-opacity:1"> <g id="g4553" transform="translate(0,-1)" style="fill:none;stroke:#037700;stroke-opacity:1"> <path d="M -30.228157,8.514322 C -33.422908,9.40349 -38.624018,5.874516 -40.102591,4.585664" id="path3411-7" style="fill:none;fill-rule:evenodd;stroke:#037700;stroke-width:1.93205309;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> <path d="M -29.760199,5.904536 C -33.101366,5.473905 -35.931474,3.7361852 -37.633646,2.3416285" id="path3413-5" style="fill:none;fill-rule:evenodd;stroke:#037700;stroke-width:1.93205309;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> </g> <g id="g4557" style="fill:none;stroke:#037700;stroke-opacity:1"> <path d="m -23.145912,7.514322 c 3.194751,0.889168 8.395861,-2.639806 9.874434,-3.928658" id="path3411-3" style="fill:none;fill-rule:evenodd;stroke:#037700;stroke-width:1.93205309;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> <path d="m -23.61387,4.904536 c 3.341167,-0.430631 6.171275,-2.168351 7.873447,-3.5629075" id="path3413-56" style="fill:none;fill-rule:evenodd;stroke:#037700;stroke-width:1.93205309;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> </g> </g> <g id="g4636" transform="matrix(1.0010843,0,0,0.95375917,57.930597,3.4788469)" style="fill:#ffffff;stroke:#037700;stroke-opacity:1;fill-opacity:0.94117647"> <ellipse cx="-30.836912" cy="14.612609" id="circle3409-2" rx="1.8846371" ry="2.0666313" style="fill:#ffffff;fill-rule:evenodd;stroke:#037700;stroke-width:1.99999976;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;fill-opacity:0.94117647" /> <ellipse cx="-23.593306" cy="14.699166" id="ellipse4229-9" rx="1.8846371" ry="2.0666313" style="fill:#ffffff;fill-rule:evenodd;stroke:#037700;stroke-width:1.99999976;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;fill-opacity:0.94117647" /> </g> <g id="g4632" transform="matrix(1.0010843,0,0,0.95375917,58.02711,3.4788469)" style="fill:none;stroke:#037700;stroke-opacity:1"> <path d="m -37.186516,14.624518 c -14.340024,2.75008 -4.810404,15.671871 4.375,5.25" id="path4303-1" style="fill:none;fill-rule:evenodd;stroke:#037700;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> <path d="m -17.436517,14.624518 c 14.3400245,2.75008 4.810404,15.671872 -4.375,5.25" id="path4303-1-2" style="fill:none;fill-rule:evenodd;stroke:#037700;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> </g> <path d="m 33.12784,3.3591671 c -1.384692,1.3140551 -1.985761,2.3793068 -2.459835,2.3793068 -0.662709,0 -1.27278,-1.0652517 -2.459836,-2.3793068 -0.97292,-1.0770097 1.101306,-2.37930771 2.459836,-2.37930771 1.358531,0 3.532987,1.36090081 2.459835,2.37930771 z" id="path4227-7" style="fill:#037700;fill-rule:evenodd;stroke:#037700;stroke-width:2.16383076;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;fill-opacity:1" /> <path style="fill:none;stroke:#037700;stroke-width:1.95427048;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" id="path4653" d="m 31.302308,50.085622 c 0,0 0.723125,3.123831 5.500191,3.669996 4.777067,0.546166 11.784656,-3.778776 14.78791,-9.501331 3.003254,-5.722555 2.402683,-11.490783 3.003253,-18.121425" /> </g> </svg>'
{'fraction_non_alphanumeric': 0.23343123086724785, 'fraction_numerical': 0.35243112209221017, 'mean_word_length': 4.61602234051837, 'pattern_counts': {'":': 0, '<': 275, '<?xml version=': 2, '>': 275, 'https://': 0, 'lorem ipsum': 0, 'www.': 48, 'xml': 70}, 'pii_count': 0, 'substrings_counts': 2, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6028597', 'n_tokens_mistral': 43336, 'n_tokens_neox': 31608, 'n_words': 3295}