dash-button-web 0.0.9 → 0.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2477,7 +2477,1405 @@ function Keycloak (config) {
2477
2477
  }
2478
2478
  }
2479
2479
 
2480
- const dashButtonCss = ".button{display:flex;height:50px;padding:0;background:#3e7671;border:none;outline:none;border-radius:5px;overflow:hidden;font-size:16px;font-weight:500;cursor:pointer;min-width:220px;max-width:220px}.button:hover{background:#008168}.button:active{background:#3e7671}.button-text{display:block;margin:auto;padding:0 24px;color:#fff;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;width:80px}.button-icon{margin:auto;padding:10px}.button-profile{display:inline-flex;align-items:center;color:#fff}.button-profile img{height:50px}.button-text-full-width{width:auto!important}.button-link{text-decoration:none!important}.gg-menu-grid-r{color:#fff;box-sizing:border-box;position:relative;display:block;transform:scale(var(--ggs,1));width:16px;height:16px}.gg-menu-grid-r::before{content:\"\";display:block;box-sizing:border-box;position:absolute;width:4px;height:4px;background:currentColor;box-shadow:0 6px 0,\n 6px 6px 0,\n 12px 6px 0,\n 6px 12px 0,\n 12px 12px 0,\n 6px 0 0,\n 12px 0 0,\n 0 12px 0}.dropdown{position:relative;display:inline-block}.dropdown-content{display:none;position:absolute;right:0;background-color:#f9f9f9;min-width:180px;box-shadow:0px 8px 16px 0px rgba(0,0,0,0.2);z-index:1;border-radius:5px}.dropdown-content a{color:#71797E;padding:16px 20px;text-decoration:none;display:block;cursor:pointer}.dropdown-content a:hover{background-color:#f1f1f1;color:#000;opacity:0.7}.dropdown:hover .dropdown-content{display:block}.modal{display:none;position:fixed;z-index:1;padding-top:100px;left:0;top:0;width:100%;height:100%;overflow:auto;background-color:rgb(0,0,0);background-color:rgba(0,0,0,0.4);text-align:center}.modal-content{background-color:#fefefe;margin:auto;padding:20px;border:1px solid #888;width:40%}.modal-body{max-height:50vh;overflow-y:auto}.close{color:#aaaaaa;float:right;font-size:28px;font-weight:bold}.close:hover,.close:focus{color:#000;text-decoration:none;cursor:pointer}.modal-app{background-color:#c3e9bc;padding:15px;margin:10px;border-radius:5px}.external-app-link{text-decoration:none;color:#000}.gray-text{color:#606060}.green-text{color:#3e7671}#countdown{position:relative;margin:auto;margin-top:30px;height:40px;width:40px;text-align:center}#countdown-number{color:#2e2e2e;display:inline-block;line-height:40px}svg{position:absolute;top:0;right:0;width:40px;height:40px;transform:rotateY(-180deg) rotateZ(-90deg)}svg circle{stroke-dasharray:113px;stroke-dashoffset:0px;stroke-linecap:round;stroke-width:4px;stroke:#008168;fill:none;animation:countdown 6s linear infinite forwards}@keyframes countdown{from{stroke-dashoffset:0px}to{stroke-dashoffset:113px}}.lds-ring{color:#fff}.lds-ring{display:flex;justify-content:center;align-items:center;margin:auto;position:relative}.lds-ring div{box-sizing:border-box;display:block;position:absolute;width:30px;height:30px;margin:3px;border:3px solid currentColor;border-radius:50%;animation:lds-ring 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;border-color:currentColor transparent transparent transparent}.lds-ring div:nth-child(1){animation-delay:-0.45s}.lds-ring div:nth-child(2){animation-delay:-0.3s}.lds-ring div:nth-child(3){animation-delay:-0.15s}@keyframes lds-ring{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}";
2480
+ /**
2481
+ * Jdenticon 3.3.0
2482
+ * http://jdenticon.com
2483
+ *
2484
+ * Built: 2024-05-10T09:48:41.921Z
2485
+ *
2486
+ * MIT License
2487
+ *
2488
+ * Copyright (c) 2014-2024 Daniel Mester Pirttijärvi
2489
+ *
2490
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
2491
+ * of this software and associated documentation files (the "Software"), to deal
2492
+ * in the Software without restriction, including without limitation the rights
2493
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
2494
+ * copies of the Software, and to permit persons to whom the Software is
2495
+ * furnished to do so, subject to the following conditions:
2496
+ *
2497
+ * The above copyright notice and this permission notice shall be included in all
2498
+ * copies or substantial portions of the Software.
2499
+ *
2500
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2501
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2502
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2503
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2504
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2505
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2506
+ * SOFTWARE.
2507
+ */
2508
+
2509
+ /**
2510
+ * Parses a substring of the hash as a number.
2511
+ * @param {number} startPosition
2512
+ * @param {number=} octets
2513
+ */
2514
+ function parseHex(hash, startPosition, octets) {
2515
+ return parseInt(hash.substr(startPosition, octets), 16);
2516
+ }
2517
+
2518
+ function decToHex(v) {
2519
+ v |= 0; // Ensure integer value
2520
+ return v < 0 ? "00" :
2521
+ v < 16 ? "0" + v.toString(16) :
2522
+ v < 256 ? v.toString(16) :
2523
+ "ff";
2524
+ }
2525
+
2526
+ function hueToRgb(m1, m2, h) {
2527
+ h = h < 0 ? h + 6 : h > 6 ? h - 6 : h;
2528
+ return decToHex(255 * (
2529
+ h < 1 ? m1 + (m2 - m1) * h :
2530
+ h < 3 ? m2 :
2531
+ h < 4 ? m1 + (m2 - m1) * (4 - h) :
2532
+ m1));
2533
+ }
2534
+
2535
+ /**
2536
+ * @param {string} color Color value to parse. Currently hexadecimal strings on the format #rgb[a] and #rrggbb[aa] are supported.
2537
+ * @returns {string}
2538
+ */
2539
+ function parseColor(color) {
2540
+ if (/^#[0-9a-f]{3,8}$/i.test(color)) {
2541
+ var result;
2542
+ var colorLength = color.length;
2543
+
2544
+ if (colorLength < 6) {
2545
+ var r = color[1],
2546
+ g = color[2],
2547
+ b = color[3],
2548
+ a = color[4] || "";
2549
+ result = "#" + r + r + g + g + b + b + a + a;
2550
+ }
2551
+ if (colorLength == 7 || colorLength > 8) {
2552
+ result = color;
2553
+ }
2554
+
2555
+ return result;
2556
+ }
2557
+ }
2558
+
2559
+ /**
2560
+ * Converts a hexadecimal color to a CSS3 compatible color.
2561
+ * @param {string} hexColor Color on the format "#RRGGBB" or "#RRGGBBAA"
2562
+ * @returns {string}
2563
+ */
2564
+ function toCss3Color(hexColor) {
2565
+ var a = parseHex(hexColor, 7, 2);
2566
+ var result;
2567
+
2568
+ if (isNaN(a)) {
2569
+ result = hexColor;
2570
+ } else {
2571
+ var r = parseHex(hexColor, 1, 2),
2572
+ g = parseHex(hexColor, 3, 2),
2573
+ b = parseHex(hexColor, 5, 2);
2574
+ result = "rgba(" + r + "," + g + "," + b + "," + (a / 255).toFixed(2) + ")";
2575
+ }
2576
+
2577
+ return result;
2578
+ }
2579
+
2580
+ /**
2581
+ * Converts an HSL color to a hexadecimal RGB color.
2582
+ * @param {number} hue Hue in range [0, 1]
2583
+ * @param {number} saturation Saturation in range [0, 1]
2584
+ * @param {number} lightness Lightness in range [0, 1]
2585
+ * @returns {string}
2586
+ */
2587
+ function hsl(hue, saturation, lightness) {
2588
+ // Based on http://www.w3.org/TR/2011/REC-css3-color-20110607/#hsl-color
2589
+ var result;
2590
+
2591
+ if (saturation == 0) {
2592
+ var partialHex = decToHex(lightness * 255);
2593
+ result = partialHex + partialHex + partialHex;
2594
+ }
2595
+ else {
2596
+ var m2 = lightness <= 0.5 ? lightness * (saturation + 1) : lightness + saturation - lightness * saturation,
2597
+ m1 = lightness * 2 - m2;
2598
+ result =
2599
+ hueToRgb(m1, m2, hue * 6 + 2) +
2600
+ hueToRgb(m1, m2, hue * 6) +
2601
+ hueToRgb(m1, m2, hue * 6 - 2);
2602
+ }
2603
+
2604
+ return "#" + result;
2605
+ }
2606
+
2607
+ /**
2608
+ * Converts an HSL color to a hexadecimal RGB color. This function will correct the lightness for the "dark" hues
2609
+ * @param {number} hue Hue in range [0, 1]
2610
+ * @param {number} saturation Saturation in range [0, 1]
2611
+ * @param {number} lightness Lightness in range [0, 1]
2612
+ * @returns {string}
2613
+ */
2614
+ function correctedHsl(hue, saturation, lightness) {
2615
+ // The corrector specifies the perceived middle lightness for each hue
2616
+ var correctors = [ 0.55, 0.5, 0.5, 0.46, 0.6, 0.55, 0.55 ],
2617
+ corrector = correctors[(hue * 6 + 0.5) | 0];
2618
+
2619
+ // Adjust the input lightness relative to the corrector
2620
+ lightness = lightness < 0.5 ? lightness * corrector * 2 : corrector + (lightness - 0.5) * (1 - corrector) * 2;
2621
+
2622
+ return hsl(hue, saturation, lightness);
2623
+ }
2624
+
2625
+ // In the future we can replace `GLOBAL` with `globalThis`, but for now use the old school global detection for
2626
+ // backward compatibility.
2627
+
2628
+ var GLOBAL =
2629
+ typeof window !== "undefined" ? window :
2630
+ typeof self !== "undefined" ? self :
2631
+ typeof commonjsGlobal !== "undefined" ? commonjsGlobal :
2632
+ {};
2633
+
2634
+ /**
2635
+ * @typedef {Object} ParsedConfiguration
2636
+ * @property {number} colorSaturation
2637
+ * @property {number} grayscaleSaturation
2638
+ * @property {string} backColor
2639
+ * @property {number} iconPadding
2640
+ * @property {function(number):number} hue
2641
+ * @property {function(number):number} colorLightness
2642
+ * @property {function(number):number} grayscaleLightness
2643
+ */
2644
+
2645
+ var CONFIG_PROPERTIES = {
2646
+ W/*GLOBAL*/: "jdenticon_config",
2647
+ n/*MODULE*/: "config",
2648
+ };
2649
+
2650
+ var rootConfigurationHolder = {};
2651
+
2652
+ /**
2653
+ * Defines the deprecated `config` property on the root Jdenticon object without printing a warning in the console
2654
+ * when it is being used.
2655
+ * @param {!Object} rootObject
2656
+ */
2657
+ function defineConfigProperty(rootObject) {
2658
+ rootConfigurationHolder = rootObject;
2659
+ }
2660
+
2661
+ /**
2662
+ * Sets a new icon style configuration. The new configuration is not merged with the previous one. *
2663
+ * @param {Object} newConfiguration - New configuration object.
2664
+ */
2665
+ function configure(newConfiguration) {
2666
+ if (arguments.length) {
2667
+ rootConfigurationHolder[CONFIG_PROPERTIES.n/*MODULE*/] = newConfiguration;
2668
+ }
2669
+ return rootConfigurationHolder[CONFIG_PROPERTIES.n/*MODULE*/];
2670
+ }
2671
+
2672
+ /**
2673
+ * Gets the normalized current Jdenticon color configuration. Missing fields have default values.
2674
+ * @param {Object|number|undefined} paddingOrLocalConfig - Configuration passed to the called API method. A
2675
+ * local configuration overrides the global configuration in it entirety. This parameter can for backward
2676
+ * compatibility also contain a padding value. A padding value only overrides the global padding, not the
2677
+ * entire global configuration.
2678
+ * @param {number} defaultPadding - Padding used if no padding is specified in neither the configuration nor
2679
+ * explicitly to the API method.
2680
+ * @returns {ParsedConfiguration}
2681
+ */
2682
+ function getConfiguration(paddingOrLocalConfig, defaultPadding) {
2683
+ var configObject =
2684
+ typeof paddingOrLocalConfig == "object" && paddingOrLocalConfig ||
2685
+ rootConfigurationHolder[CONFIG_PROPERTIES.n/*MODULE*/] ||
2686
+ GLOBAL[CONFIG_PROPERTIES.W/*GLOBAL*/] ||
2687
+ { },
2688
+
2689
+ lightnessConfig = configObject["lightness"] || { },
2690
+
2691
+ // In versions < 2.1.0 there was no grayscale saturation -
2692
+ // saturation was the color saturation.
2693
+ saturation = configObject["saturation"] || { },
2694
+ colorSaturation = "color" in saturation ? saturation["color"] : saturation,
2695
+ grayscaleSaturation = saturation["grayscale"],
2696
+
2697
+ backColor = configObject["backColor"],
2698
+ padding = configObject["padding"];
2699
+
2700
+ /**
2701
+ * Creates a lightness range.
2702
+ */
2703
+ function lightness(configName, defaultRange) {
2704
+ var range = lightnessConfig[configName];
2705
+
2706
+ // Check if the lightness range is an array-like object. This way we ensure the
2707
+ // array contain two values at the same time.
2708
+ if (!(range && range.length > 1)) {
2709
+ range = defaultRange;
2710
+ }
2711
+
2712
+ /**
2713
+ * Gets a lightness relative the specified value in the specified lightness range.
2714
+ */
2715
+ return function (value) {
2716
+ value = range[0] + value * (range[1] - range[0]);
2717
+ return value < 0 ? 0 : value > 1 ? 1 : value;
2718
+ };
2719
+ }
2720
+
2721
+ /**
2722
+ * Gets a hue allowed by the configured hue restriction,
2723
+ * provided the originally computed hue.
2724
+ */
2725
+ function hueFunction(originalHue) {
2726
+ var hueConfig = configObject["hues"];
2727
+ var hue;
2728
+
2729
+ // Check if 'hues' is an array-like object. This way we also ensure that
2730
+ // the array is not empty, which would mean no hue restriction.
2731
+ if (hueConfig && hueConfig.length > 0) {
2732
+ // originalHue is in the range [0, 1]
2733
+ // Multiply with 0.999 to change the range to [0, 1) and then truncate the index.
2734
+ hue = hueConfig[0 | (0.999 * originalHue * hueConfig.length)];
2735
+ }
2736
+
2737
+ return typeof hue == "number" ?
2738
+
2739
+ // A hue was specified. We need to convert the hue from
2740
+ // degrees on any turn - e.g. 746° is a perfectly valid hue -
2741
+ // to turns in the range [0, 1).
2742
+ ((((hue / 360) % 1) + 1) % 1) :
2743
+
2744
+ // No hue configured => use original hue
2745
+ originalHue;
2746
+ }
2747
+
2748
+ return {
2749
+ X/*hue*/: hueFunction,
2750
+ o/*colorSaturation*/: typeof colorSaturation == "number" ? colorSaturation : 0.5,
2751
+ F/*grayscaleSaturation*/: typeof grayscaleSaturation == "number" ? grayscaleSaturation : 0,
2752
+ p/*colorLightness*/: lightness("color", [0.4, 0.8]),
2753
+ G/*grayscaleLightness*/: lightness("grayscale", [0.3, 0.9]),
2754
+ H/*backColor*/: parseColor(backColor),
2755
+ Y/*iconPadding*/:
2756
+ typeof paddingOrLocalConfig == "number" ? paddingOrLocalConfig :
2757
+ typeof padding == "number" ? padding :
2758
+ defaultPadding
2759
+ }
2760
+ }
2761
+
2762
+ /**
2763
+ * Represents a point.
2764
+ */
2765
+ function Point(x, y) {
2766
+ this.x = x;
2767
+ this.y = y;
2768
+ }
2769
+
2770
+ /**
2771
+ * Translates and rotates a point before being passed on to the canvas context. This was previously done by the canvas context itself,
2772
+ * but this caused a rendering issue in Chrome on sizes > 256 where the rotation transformation of inverted paths was not done properly.
2773
+ */
2774
+ function Transform(x, y, size, rotation) {
2775
+ this.q/*_x*/ = x;
2776
+ this.t/*_y*/ = y;
2777
+ this.I/*_size*/ = size;
2778
+ this.Z/*_rotation*/ = rotation;
2779
+ }
2780
+
2781
+ /**
2782
+ * Transforms the specified point based on the translation and rotation specification for this Transform.
2783
+ * @param {number} x x-coordinate
2784
+ * @param {number} y y-coordinate
2785
+ * @param {number=} w The width of the transformed rectangle. If greater than 0, this will ensure the returned point is of the upper left corner of the transformed rectangle.
2786
+ * @param {number=} h The height of the transformed rectangle. If greater than 0, this will ensure the returned point is of the upper left corner of the transformed rectangle.
2787
+ */
2788
+ Transform.prototype.J/*transformIconPoint*/ = function transformIconPoint (x, y, w, h) {
2789
+ var right = this.q/*_x*/ + this.I/*_size*/,
2790
+ bottom = this.t/*_y*/ + this.I/*_size*/,
2791
+ rotation = this.Z/*_rotation*/;
2792
+ return rotation === 1 ? new Point(right - y - (h || 0), this.t/*_y*/ + x) :
2793
+ rotation === 2 ? new Point(right - x - (w || 0), bottom - y - (h || 0)) :
2794
+ rotation === 3 ? new Point(this.q/*_x*/ + y, bottom - x - (w || 0)) :
2795
+ new Point(this.q/*_x*/ + x, this.t/*_y*/ + y);
2796
+ };
2797
+
2798
+ var NO_TRANSFORM = new Transform(0, 0, 0, 0);
2799
+
2800
+
2801
+
2802
+ /**
2803
+ * Provides helper functions for rendering common basic shapes.
2804
+ */
2805
+ function Graphics(renderer) {
2806
+ /**
2807
+ * @type {Renderer}
2808
+ * @private
2809
+ */
2810
+ this.K/*_renderer*/ = renderer;
2811
+
2812
+ /**
2813
+ * @type {Transform}
2814
+ */
2815
+ this.u/*currentTransform*/ = NO_TRANSFORM;
2816
+ }
2817
+ var Graphics__prototype = Graphics.prototype;
2818
+
2819
+ /**
2820
+ * Adds a polygon to the underlying renderer.
2821
+ * @param {Array<number>} points The points of the polygon clockwise on the format [ x0, y0, x1, y1, ..., xn, yn ]
2822
+ * @param {boolean=} invert Specifies if the polygon will be inverted.
2823
+ */
2824
+ Graphics__prototype.g/*addPolygon*/ = function addPolygon (points, invert) {
2825
+ var this$1$1 = this;
2826
+
2827
+ var di = invert ? -2 : 2,
2828
+ transformedPoints = [];
2829
+
2830
+ for (var i = invert ? points.length - 2 : 0; i < points.length && i >= 0; i += di) {
2831
+ transformedPoints.push(this$1$1.u/*currentTransform*/.J/*transformIconPoint*/(points[i], points[i + 1]));
2832
+ }
2833
+
2834
+ this.K/*_renderer*/.g/*addPolygon*/(transformedPoints);
2835
+ };
2836
+
2837
+ /**
2838
+ * Adds a polygon to the underlying renderer.
2839
+ * Source: http://stackoverflow.com/a/2173084
2840
+ * @param {number} x The x-coordinate of the upper left corner of the rectangle holding the entire ellipse.
2841
+ * @param {number} y The y-coordinate of the upper left corner of the rectangle holding the entire ellipse.
2842
+ * @param {number} size The size of the ellipse.
2843
+ * @param {boolean=} invert Specifies if the ellipse will be inverted.
2844
+ */
2845
+ Graphics__prototype.h/*addCircle*/ = function addCircle (x, y, size, invert) {
2846
+ var p = this.u/*currentTransform*/.J/*transformIconPoint*/(x, y, size, size);
2847
+ this.K/*_renderer*/.h/*addCircle*/(p, size, invert);
2848
+ };
2849
+
2850
+ /**
2851
+ * Adds a rectangle to the underlying renderer.
2852
+ * @param {number} x The x-coordinate of the upper left corner of the rectangle.
2853
+ * @param {number} y The y-coordinate of the upper left corner of the rectangle.
2854
+ * @param {number} w The width of the rectangle.
2855
+ * @param {number} h The height of the rectangle.
2856
+ * @param {boolean=} invert Specifies if the rectangle will be inverted.
2857
+ */
2858
+ Graphics__prototype.i/*addRectangle*/ = function addRectangle (x, y, w, h, invert) {
2859
+ this.g/*addPolygon*/([
2860
+ x, y,
2861
+ x + w, y,
2862
+ x + w, y + h,
2863
+ x, y + h
2864
+ ], invert);
2865
+ };
2866
+
2867
+ /**
2868
+ * Adds a right triangle to the underlying renderer.
2869
+ * @param {number} x The x-coordinate of the upper left corner of the rectangle holding the triangle.
2870
+ * @param {number} y The y-coordinate of the upper left corner of the rectangle holding the triangle.
2871
+ * @param {number} w The width of the triangle.
2872
+ * @param {number} h The height of the triangle.
2873
+ * @param {number} r The rotation of the triangle (clockwise). 0 = right corner of the triangle in the lower left corner of the bounding rectangle.
2874
+ * @param {boolean=} invert Specifies if the triangle will be inverted.
2875
+ */
2876
+ Graphics__prototype.j/*addTriangle*/ = function addTriangle (x, y, w, h, r, invert) {
2877
+ var points = [
2878
+ x + w, y,
2879
+ x + w, y + h,
2880
+ x, y + h,
2881
+ x, y
2882
+ ];
2883
+ points.splice(((r || 0) % 4) * 2, 2);
2884
+ this.g/*addPolygon*/(points, invert);
2885
+ };
2886
+
2887
+ /**
2888
+ * Adds a rhombus to the underlying renderer.
2889
+ * @param {number} x The x-coordinate of the upper left corner of the rectangle holding the rhombus.
2890
+ * @param {number} y The y-coordinate of the upper left corner of the rectangle holding the rhombus.
2891
+ * @param {number} w The width of the rhombus.
2892
+ * @param {number} h The height of the rhombus.
2893
+ * @param {boolean=} invert Specifies if the rhombus will be inverted.
2894
+ */
2895
+ Graphics__prototype.L/*addRhombus*/ = function addRhombus (x, y, w, h, invert) {
2896
+ this.g/*addPolygon*/([
2897
+ x + w / 2, y,
2898
+ x + w, y + h / 2,
2899
+ x + w / 2, y + h,
2900
+ x, y + h / 2
2901
+ ], invert);
2902
+ };
2903
+
2904
+ /**
2905
+ * @param {number} index
2906
+ * @param {Graphics} g
2907
+ * @param {number} cell
2908
+ * @param {number} positionIndex
2909
+ */
2910
+ function centerShape(index, g, cell, positionIndex) {
2911
+ index = index % 14;
2912
+
2913
+ var k, m, w, h, inner, outer;
2914
+
2915
+ !index ? (
2916
+ k = cell * 0.42,
2917
+ g.g/*addPolygon*/([
2918
+ 0, 0,
2919
+ cell, 0,
2920
+ cell, cell - k * 2,
2921
+ cell - k, cell,
2922
+ 0, cell
2923
+ ])) :
2924
+
2925
+ index == 1 ? (
2926
+ w = 0 | (cell * 0.5),
2927
+ h = 0 | (cell * 0.8),
2928
+
2929
+ g.j/*addTriangle*/(cell - w, 0, w, h, 2)) :
2930
+
2931
+ index == 2 ? (
2932
+ w = 0 | (cell / 3),
2933
+ g.i/*addRectangle*/(w, w, cell - w, cell - w)) :
2934
+
2935
+ index == 3 ? (
2936
+ inner = cell * 0.1,
2937
+ // Use fixed outer border widths in small icons to ensure the border is drawn
2938
+ outer =
2939
+ cell < 6 ? 1 :
2940
+ cell < 8 ? 2 :
2941
+ (0 | (cell * 0.25)),
2942
+
2943
+ inner =
2944
+ inner > 1 ? (0 | inner) : // large icon => truncate decimals
2945
+ inner > 0.5 ? 1 : // medium size icon => fixed width
2946
+ inner, // small icon => anti-aliased border
2947
+
2948
+ g.i/*addRectangle*/(outer, outer, cell - inner - outer, cell - inner - outer)) :
2949
+
2950
+ index == 4 ? (
2951
+ m = 0 | (cell * 0.15),
2952
+ w = 0 | (cell * 0.5),
2953
+ g.h/*addCircle*/(cell - w - m, cell - w - m, w)) :
2954
+
2955
+ index == 5 ? (
2956
+ inner = cell * 0.1,
2957
+ outer = inner * 4,
2958
+
2959
+ // Align edge to nearest pixel in large icons
2960
+ outer > 3 && (outer = 0 | outer),
2961
+
2962
+ g.i/*addRectangle*/(0, 0, cell, cell),
2963
+ g.g/*addPolygon*/([
2964
+ outer, outer,
2965
+ cell - inner, outer,
2966
+ outer + (cell - outer - inner) / 2, cell - inner
2967
+ ], true)) :
2968
+
2969
+ index == 6 ?
2970
+ g.g/*addPolygon*/([
2971
+ 0, 0,
2972
+ cell, 0,
2973
+ cell, cell * 0.7,
2974
+ cell * 0.4, cell * 0.4,
2975
+ cell * 0.7, cell,
2976
+ 0, cell
2977
+ ]) :
2978
+
2979
+ index == 7 ?
2980
+ g.j/*addTriangle*/(cell / 2, cell / 2, cell / 2, cell / 2, 3) :
2981
+
2982
+ index == 8 ? (
2983
+ g.i/*addRectangle*/(0, 0, cell, cell / 2),
2984
+ g.i/*addRectangle*/(0, cell / 2, cell / 2, cell / 2),
2985
+ g.j/*addTriangle*/(cell / 2, cell / 2, cell / 2, cell / 2, 1)) :
2986
+
2987
+ index == 9 ? (
2988
+ inner = cell * 0.14,
2989
+ // Use fixed outer border widths in small icons to ensure the border is drawn
2990
+ outer =
2991
+ cell < 4 ? 1 :
2992
+ cell < 6 ? 2 :
2993
+ (0 | (cell * 0.35)),
2994
+
2995
+ inner =
2996
+ cell < 8 ? inner : // small icon => anti-aliased border
2997
+ (0 | inner), // large icon => truncate decimals
2998
+
2999
+ g.i/*addRectangle*/(0, 0, cell, cell),
3000
+ g.i/*addRectangle*/(outer, outer, cell - outer - inner, cell - outer - inner, true)) :
3001
+
3002
+ index == 10 ? (
3003
+ inner = cell * 0.12,
3004
+ outer = inner * 3,
3005
+
3006
+ g.i/*addRectangle*/(0, 0, cell, cell),
3007
+ g.h/*addCircle*/(outer, outer, cell - inner - outer, true)) :
3008
+
3009
+ index == 11 ?
3010
+ g.j/*addTriangle*/(cell / 2, cell / 2, cell / 2, cell / 2, 3) :
3011
+
3012
+ index == 12 ? (
3013
+ m = cell * 0.25,
3014
+ g.i/*addRectangle*/(0, 0, cell, cell),
3015
+ g.L/*addRhombus*/(m, m, cell - m, cell - m, true)) :
3016
+
3017
+ // 13
3018
+ (
3019
+ !positionIndex && (
3020
+ m = cell * 0.4, w = cell * 1.2,
3021
+ g.h/*addCircle*/(m, m, w)
3022
+ )
3023
+ );
3024
+ }
3025
+
3026
+ /**
3027
+ * @param {number} index
3028
+ * @param {Graphics} g
3029
+ * @param {number} cell
3030
+ */
3031
+ function outerShape(index, g, cell) {
3032
+ index = index % 4;
3033
+
3034
+ var m;
3035
+
3036
+ !index ?
3037
+ g.j/*addTriangle*/(0, 0, cell, cell, 0) :
3038
+
3039
+ index == 1 ?
3040
+ g.j/*addTriangle*/(0, cell / 2, cell, cell / 2, 0) :
3041
+
3042
+ index == 2 ?
3043
+ g.L/*addRhombus*/(0, 0, cell, cell) :
3044
+
3045
+ // 3
3046
+ (
3047
+ m = cell / 6,
3048
+ g.h/*addCircle*/(m, m, cell - 2 * m)
3049
+ );
3050
+ }
3051
+
3052
+ /**
3053
+ * Gets a set of identicon color candidates for a specified hue and config.
3054
+ * @param {number} hue
3055
+ * @param {ParsedConfiguration} config
3056
+ */
3057
+ function colorTheme(hue, config) {
3058
+ hue = config.X/*hue*/(hue);
3059
+ return [
3060
+ // Dark gray
3061
+ correctedHsl(hue, config.F/*grayscaleSaturation*/, config.G/*grayscaleLightness*/(0)),
3062
+ // Mid color
3063
+ correctedHsl(hue, config.o/*colorSaturation*/, config.p/*colorLightness*/(0.5)),
3064
+ // Light gray
3065
+ correctedHsl(hue, config.F/*grayscaleSaturation*/, config.G/*grayscaleLightness*/(1)),
3066
+ // Light color
3067
+ correctedHsl(hue, config.o/*colorSaturation*/, config.p/*colorLightness*/(1)),
3068
+ // Dark color
3069
+ correctedHsl(hue, config.o/*colorSaturation*/, config.p/*colorLightness*/(0))
3070
+ ];
3071
+ }
3072
+
3073
+ /**
3074
+ * Draws an identicon to a specified renderer.
3075
+ * @param {Renderer} renderer
3076
+ * @param {string} hash
3077
+ * @param {Object|number=} config
3078
+ */
3079
+ function iconGenerator(renderer, hash, config) {
3080
+ var parsedConfig = getConfiguration(config, 0.08);
3081
+
3082
+ // Set background color
3083
+ if (parsedConfig.H/*backColor*/) {
3084
+ renderer.m/*setBackground*/(parsedConfig.H/*backColor*/);
3085
+ }
3086
+
3087
+ // Calculate padding and round to nearest integer
3088
+ var size = renderer.k/*iconSize*/;
3089
+ var padding = (0.5 + size * parsedConfig.Y/*iconPadding*/) | 0;
3090
+ size -= padding * 2;
3091
+
3092
+ var graphics = new Graphics(renderer);
3093
+
3094
+ // Calculate cell size and ensure it is an integer
3095
+ var cell = 0 | (size / 4);
3096
+
3097
+ // Since the cell size is integer based, the actual icon will be slightly smaller than specified => center icon
3098
+ var x = 0 | (padding + size / 2 - cell * 2);
3099
+ var y = 0 | (padding + size / 2 - cell * 2);
3100
+
3101
+ function renderShape(colorIndex, shapes, index, rotationIndex, positions) {
3102
+ var shapeIndex = parseHex(hash, index, 1);
3103
+ var r = rotationIndex ? parseHex(hash, rotationIndex, 1) : 0;
3104
+
3105
+ renderer.M/*beginShape*/(availableColors[selectedColorIndexes[colorIndex]]);
3106
+
3107
+ for (var i = 0; i < positions.length; i++) {
3108
+ graphics.u/*currentTransform*/ = new Transform(x + positions[i][0] * cell, y + positions[i][1] * cell, cell, r++ % 4);
3109
+ shapes(shapeIndex, graphics, cell, i);
3110
+ }
3111
+
3112
+ renderer.N/*endShape*/();
3113
+ }
3114
+
3115
+ // AVAILABLE COLORS
3116
+ var hue = parseHex(hash, -7) / 0xfffffff,
3117
+
3118
+ // Available colors for this icon
3119
+ availableColors = colorTheme(hue, parsedConfig),
3120
+
3121
+ // The index of the selected colors
3122
+ selectedColorIndexes = [];
3123
+
3124
+ var index;
3125
+
3126
+ function isDuplicate(values) {
3127
+ if (values.indexOf(index) >= 0) {
3128
+ for (var i = 0; i < values.length; i++) {
3129
+ if (selectedColorIndexes.indexOf(values[i]) >= 0) {
3130
+ return true;
3131
+ }
3132
+ }
3133
+ }
3134
+ }
3135
+
3136
+ for (var i = 0; i < 3; i++) {
3137
+ index = parseHex(hash, 8 + i, 1) % availableColors.length;
3138
+ if (isDuplicate([0, 4]) || // Disallow dark gray and dark color combo
3139
+ isDuplicate([2, 3])) { // Disallow light gray and light color combo
3140
+ index = 1;
3141
+ }
3142
+ selectedColorIndexes.push(index);
3143
+ }
3144
+
3145
+ // ACTUAL RENDERING
3146
+ // Sides
3147
+ renderShape(0, outerShape, 2, 3, [[1, 0], [2, 0], [2, 3], [1, 3], [0, 1], [3, 1], [3, 2], [0, 2]]);
3148
+ // Corners
3149
+ renderShape(1, outerShape, 4, 5, [[0, 0], [3, 0], [3, 3], [0, 3]]);
3150
+ // Center
3151
+ renderShape(2, centerShape, 1, null, [[1, 1], [2, 1], [2, 2], [1, 2]]);
3152
+
3153
+ renderer.finish();
3154
+ }
3155
+
3156
+ /**
3157
+ * Computes a SHA1 hash for any value and returns it as a hexadecimal string.
3158
+ *
3159
+ * This function is optimized for minimal code size and rather short messages.
3160
+ *
3161
+ * @param {string} message
3162
+ */
3163
+ function sha1(message) {
3164
+ var HASH_SIZE_HALF_BYTES = 40;
3165
+ var BLOCK_SIZE_WORDS = 16;
3166
+
3167
+ // Variables
3168
+ // `var` is used to be able to minimize the number of `var` keywords.
3169
+ var i = 0,
3170
+ f = 0,
3171
+
3172
+ // Use `encodeURI` to UTF8 encode the message without any additional libraries
3173
+ // We could use `unescape` + `encodeURI` to minimize the code, but that would be slightly risky
3174
+ // since `unescape` is deprecated.
3175
+ urlEncodedMessage = encodeURI(message) + "%80", // trailing '1' bit padding
3176
+
3177
+ // This can be changed to a preallocated Uint32Array array for greater performance and larger code size
3178
+ data = [],
3179
+ dataSize,
3180
+
3181
+ hashBuffer = [],
3182
+
3183
+ a = 0x67452301,
3184
+ b = 0xefcdab89,
3185
+ c = ~a,
3186
+ d = ~b,
3187
+ e = 0xc3d2e1f0,
3188
+ hash = [a, b, c, d, e],
3189
+
3190
+ blockStartIndex = 0,
3191
+ hexHash = "";
3192
+
3193
+ /**
3194
+ * Rotates the value a specified number of bits to the left.
3195
+ * @param {number} value Value to rotate
3196
+ * @param {number} shift Bit count to shift.
3197
+ */
3198
+ function rotl(value, shift) {
3199
+ return (value << shift) | (value >>> (32 - shift));
3200
+ }
3201
+
3202
+ // Message data
3203
+ for ( ; i < urlEncodedMessage.length; f++) {
3204
+ data[f >> 2] = data[f >> 2] |
3205
+ (
3206
+ (
3207
+ urlEncodedMessage[i] == "%"
3208
+ // Percent encoded byte
3209
+ ? parseInt(urlEncodedMessage.substring(i + 1, i += 3), 16)
3210
+ // Unencoded byte
3211
+ : urlEncodedMessage.charCodeAt(i++)
3212
+ )
3213
+
3214
+ // Read bytes in reverse order (big endian words)
3215
+ << ((3 - (f & 3)) * 8)
3216
+ );
3217
+ }
3218
+
3219
+ // f is now the length of the utf8 encoded message
3220
+ // 7 = 8 bytes (64 bit) for message size, -1 to round down
3221
+ // >> 6 = integer division with block size
3222
+ dataSize = (((f + 7) >> 6) + 1) * BLOCK_SIZE_WORDS;
3223
+
3224
+ // Message size in bits.
3225
+ // SHA1 uses a 64 bit integer to represent the size, but since we only support short messages only the least
3226
+ // significant 32 bits are set. -8 is for the '1' bit padding byte.
3227
+ data[dataSize - 1] = f * 8 - 8;
3228
+
3229
+ // Compute hash
3230
+ for ( ; blockStartIndex < dataSize; blockStartIndex += BLOCK_SIZE_WORDS) {
3231
+ for (i = 0; i < 80; i++) {
3232
+ f = rotl(a, 5) + e + (
3233
+ // Ch
3234
+ i < 20 ? ((b & c) ^ ((~b) & d)) + 0x5a827999 :
3235
+
3236
+ // Parity
3237
+ i < 40 ? (b ^ c ^ d) + 0x6ed9eba1 :
3238
+
3239
+ // Maj
3240
+ i < 60 ? ((b & c) ^ (b & d) ^ (c & d)) + 0x8f1bbcdc :
3241
+
3242
+ // Parity
3243
+ (b ^ c ^ d) + 0xca62c1d6
3244
+ ) + (
3245
+ hashBuffer[i] = i < BLOCK_SIZE_WORDS
3246
+ // Bitwise OR is used to coerse `undefined` to 0
3247
+ ? (data[blockStartIndex + i] | 0)
3248
+ : rotl(hashBuffer[i - 3] ^ hashBuffer[i - 8] ^ hashBuffer[i - 14] ^ hashBuffer[i - 16], 1)
3249
+ );
3250
+
3251
+ e = d;
3252
+ d = c;
3253
+ c = rotl(b, 30);
3254
+ b = a;
3255
+ a = f;
3256
+ }
3257
+
3258
+ hash[0] = a = ((hash[0] + a) | 0);
3259
+ hash[1] = b = ((hash[1] + b) | 0);
3260
+ hash[2] = c = ((hash[2] + c) | 0);
3261
+ hash[3] = d = ((hash[3] + d) | 0);
3262
+ hash[4] = e = ((hash[4] + e) | 0);
3263
+ }
3264
+
3265
+ // Format hex hash
3266
+ for (i = 0; i < HASH_SIZE_HALF_BYTES; i++) {
3267
+ hexHash += (
3268
+ (
3269
+ // Get word (2^3 half-bytes per word)
3270
+ hash[i >> 3] >>>
3271
+
3272
+ // Append half-bytes in reverse order
3273
+ ((7 - (i & 7)) * 4)
3274
+ )
3275
+ // Clamp to half-byte
3276
+ & 0xf
3277
+ ).toString(16);
3278
+ }
3279
+
3280
+ return hexHash;
3281
+ }
3282
+
3283
+ /**
3284
+ * Inputs a value that might be a valid hash string for Jdenticon and returns it
3285
+ * if it is determined valid, otherwise a falsy value is returned.
3286
+ */
3287
+ function isValidHash(hashCandidate) {
3288
+ return /^[0-9a-f]{11,}$/i.test(hashCandidate) && hashCandidate;
3289
+ }
3290
+
3291
+ /**
3292
+ * Computes a hash for the specified value. Currently SHA1 is used. This function
3293
+ * always returns a valid hash.
3294
+ */
3295
+ function computeHash(value) {
3296
+ return sha1(value == null ? "" : "" + value);
3297
+ }
3298
+
3299
+
3300
+
3301
+ /**
3302
+ * Renderer redirecting drawing commands to a canvas context.
3303
+ * @implements {Renderer}
3304
+ */
3305
+ function CanvasRenderer(ctx, iconSize) {
3306
+ var canvas = ctx.canvas;
3307
+ var width = canvas.width;
3308
+ var height = canvas.height;
3309
+
3310
+ ctx.save();
3311
+
3312
+ if (!iconSize) {
3313
+ iconSize = Math.min(width, height);
3314
+
3315
+ ctx.translate(
3316
+ ((width - iconSize) / 2) | 0,
3317
+ ((height - iconSize) / 2) | 0);
3318
+ }
3319
+
3320
+ /**
3321
+ * @private
3322
+ */
3323
+ this.l/*_ctx*/ = ctx;
3324
+ this.k/*iconSize*/ = iconSize;
3325
+
3326
+ ctx.clearRect(0, 0, iconSize, iconSize);
3327
+ }
3328
+ var CanvasRenderer__prototype = CanvasRenderer.prototype;
3329
+
3330
+ /**
3331
+ * Fills the background with the specified color.
3332
+ * @param {string} fillColor Fill color on the format #rrggbb[aa].
3333
+ */
3334
+ CanvasRenderer__prototype.m/*setBackground*/ = function setBackground (fillColor) {
3335
+ var ctx = this.l/*_ctx*/;
3336
+ var iconSize = this.k/*iconSize*/;
3337
+
3338
+ ctx.fillStyle = toCss3Color(fillColor);
3339
+ ctx.fillRect(0, 0, iconSize, iconSize);
3340
+ };
3341
+
3342
+ /**
3343
+ * Marks the beginning of a new shape of the specified color. Should be ended with a call to endShape.
3344
+ * @param {string} fillColor Fill color on format #rrggbb[aa].
3345
+ */
3346
+ CanvasRenderer__prototype.M/*beginShape*/ = function beginShape (fillColor) {
3347
+ var ctx = this.l/*_ctx*/;
3348
+ ctx.fillStyle = toCss3Color(fillColor);
3349
+ ctx.beginPath();
3350
+ };
3351
+
3352
+ /**
3353
+ * Marks the end of the currently drawn shape. This causes the queued paths to be rendered on the canvas.
3354
+ */
3355
+ CanvasRenderer__prototype.N/*endShape*/ = function endShape () {
3356
+ this.l/*_ctx*/.fill();
3357
+ };
3358
+
3359
+ /**
3360
+ * Adds a polygon to the rendering queue.
3361
+ * @param points An array of Point objects.
3362
+ */
3363
+ CanvasRenderer__prototype.g/*addPolygon*/ = function addPolygon (points) {
3364
+ var ctx = this.l/*_ctx*/;
3365
+ ctx.moveTo(points[0].x, points[0].y);
3366
+ for (var i = 1; i < points.length; i++) {
3367
+ ctx.lineTo(points[i].x, points[i].y);
3368
+ }
3369
+ ctx.closePath();
3370
+ };
3371
+
3372
+ /**
3373
+ * Adds a circle to the rendering queue.
3374
+ * @param {Point} point The upper left corner of the circle bounding box.
3375
+ * @param {number} diameter The diameter of the circle.
3376
+ * @param {boolean} counterClockwise True if the circle is drawn counter-clockwise (will result in a hole if rendered on a clockwise path).
3377
+ */
3378
+ CanvasRenderer__prototype.h/*addCircle*/ = function addCircle (point, diameter, counterClockwise) {
3379
+ var ctx = this.l/*_ctx*/,
3380
+ radius = diameter / 2;
3381
+ ctx.moveTo(point.x + radius, point.y + radius);
3382
+ ctx.arc(point.x + radius, point.y + radius, radius, 0, Math.PI * 2, counterClockwise);
3383
+ ctx.closePath();
3384
+ };
3385
+
3386
+ /**
3387
+ * Called when the icon has been completely drawn.
3388
+ */
3389
+ CanvasRenderer__prototype.finish = function finish () {
3390
+ this.l/*_ctx*/.restore();
3391
+ };
3392
+
3393
+ var ICON_TYPE_SVG = 1;
3394
+
3395
+ var ICON_TYPE_CANVAS = 2;
3396
+
3397
+ var ATTRIBUTES = {
3398
+ O/*HASH*/: "data-jdenticon-hash",
3399
+ v/*VALUE*/: "data-jdenticon-value"
3400
+ };
3401
+
3402
+ var IS_RENDERED_PROPERTY = "jdenticonRendered";
3403
+
3404
+ var ICON_SELECTOR = "[" + ATTRIBUTES.O/*HASH*/ +"],[" + ATTRIBUTES.v/*VALUE*/ +"]";
3405
+
3406
+ var documentQuerySelectorAll = /** @type {!Function} */ (
3407
+ typeof document !== "undefined" && document.querySelectorAll.bind(document));
3408
+
3409
+ function getIdenticonType(el) {
3410
+ if (el) {
3411
+ var tagName = el["tagName"];
3412
+
3413
+ if (/^svg$/i.test(tagName)) {
3414
+ return ICON_TYPE_SVG;
3415
+ }
3416
+
3417
+ if (/^canvas$/i.test(tagName) && "getContext" in el) {
3418
+ return ICON_TYPE_CANVAS;
3419
+ }
3420
+ }
3421
+ }
3422
+
3423
+ /**
3424
+ * Draws an identicon to a context.
3425
+ * @param {CanvasRenderingContext2D} ctx - Canvas context on which the icon will be drawn at location (0, 0).
3426
+ * @param {*} hashOrValue - A hexadecimal hash string or any value that will be hashed by Jdenticon.
3427
+ * @param {number} size - Icon size in pixels.
3428
+ * @param {Object|number=} config - Optional configuration. If specified, this configuration object overrides any
3429
+ * global configuration in its entirety. For backward compatibility a padding value in the range [0.0, 0.5) can be
3430
+ * specified in place of a configuration object.
3431
+ */
3432
+ function drawIcon(ctx, hashOrValue, size, config) {
3433
+ if (!ctx) {
3434
+ throw new Error("No canvas specified.");
3435
+ }
3436
+
3437
+ iconGenerator(new CanvasRenderer(ctx, size),
3438
+ isValidHash(hashOrValue) || computeHash(hashOrValue),
3439
+ config);
3440
+
3441
+ var canvas = ctx.canvas;
3442
+ if (canvas) {
3443
+ canvas[IS_RENDERED_PROPERTY] = true;
3444
+ }
3445
+ }
3446
+
3447
+ /**
3448
+ * Prepares a measure to be used as a measure in an SVG path, by
3449
+ * rounding the measure to a single decimal. This reduces the file
3450
+ * size of the generated SVG with more than 50% in some cases.
3451
+ */
3452
+ function svgValue(value) {
3453
+ return ((value * 10 + 0.5) | 0) / 10;
3454
+ }
3455
+
3456
+ /**
3457
+ * Represents an SVG path element.
3458
+ */
3459
+ function SvgPath() {
3460
+ /**
3461
+ * This property holds the data string (path.d) of the SVG path.
3462
+ * @type {string}
3463
+ */
3464
+ this.A/*dataString*/ = "";
3465
+ }
3466
+ var SvgPath__prototype = SvgPath.prototype;
3467
+
3468
+ /**
3469
+ * Adds a polygon with the current fill color to the SVG path.
3470
+ * @param points An array of Point objects.
3471
+ */
3472
+ SvgPath__prototype.g/*addPolygon*/ = function addPolygon (points) {
3473
+ var dataString = "";
3474
+ for (var i = 0; i < points.length; i++) {
3475
+ dataString += (i ? "L" : "M") + svgValue(points[i].x) + " " + svgValue(points[i].y);
3476
+ }
3477
+ this.A/*dataString*/ += dataString + "Z";
3478
+ };
3479
+
3480
+ /**
3481
+ * Adds a circle with the current fill color to the SVG path.
3482
+ * @param {Point} point The upper left corner of the circle bounding box.
3483
+ * @param {number} diameter The diameter of the circle.
3484
+ * @param {boolean} counterClockwise True if the circle is drawn counter-clockwise (will result in a hole if rendered on a clockwise path).
3485
+ */
3486
+ SvgPath__prototype.h/*addCircle*/ = function addCircle (point, diameter, counterClockwise) {
3487
+ var sweepFlag = counterClockwise ? 0 : 1,
3488
+ svgRadius = svgValue(diameter / 2),
3489
+ svgDiameter = svgValue(diameter),
3490
+ svgArc = "a" + svgRadius + "," + svgRadius + " 0 1," + sweepFlag + " ";
3491
+
3492
+ this.A/*dataString*/ +=
3493
+ "M" + svgValue(point.x) + " " + svgValue(point.y + diameter / 2) +
3494
+ svgArc + svgDiameter + ",0" +
3495
+ svgArc + (-svgDiameter) + ",0";
3496
+ };
3497
+
3498
+
3499
+
3500
+ /**
3501
+ * Renderer producing SVG output.
3502
+ * @implements {Renderer}
3503
+ */
3504
+ function SvgRenderer(target) {
3505
+
3506
+ /**
3507
+ * @type {Object.<string,SvgPath>}
3508
+ * @private
3509
+ */
3510
+ this.C/*_pathsByColor*/ = { };
3511
+
3512
+ /**
3513
+ * @type {SvgElement|SvgWriter}
3514
+ * @private
3515
+ */
3516
+ this.P/*_target*/ = target;
3517
+
3518
+ /**
3519
+ * @type {number}
3520
+ */
3521
+ this.k/*iconSize*/ = target.k/*iconSize*/;
3522
+ }
3523
+ var SvgRenderer__prototype = SvgRenderer.prototype;
3524
+
3525
+ /**
3526
+ * Fills the background with the specified color.
3527
+ * @param {string} fillColor Fill color on the format #rrggbb[aa].
3528
+ */
3529
+ SvgRenderer__prototype.m/*setBackground*/ = function setBackground (fillColor) {
3530
+ var match = /^(#......)(..)?/.exec(fillColor),
3531
+ opacity = match[2] ? parseHex(match[2], 0) / 255 : 1;
3532
+ this.P/*_target*/.m/*setBackground*/(match[1], opacity);
3533
+ };
3534
+
3535
+ /**
3536
+ * Marks the beginning of a new shape of the specified color. Should be ended with a call to endShape.
3537
+ * @param {string} color Fill color on format #xxxxxx.
3538
+ */
3539
+ SvgRenderer__prototype.M/*beginShape*/ = function beginShape (color) {
3540
+ this.B/*_path*/ = this.C/*_pathsByColor*/[color] || (this.C/*_pathsByColor*/[color] = new SvgPath());
3541
+ };
3542
+
3543
+ /**
3544
+ * Marks the end of the currently drawn shape.
3545
+ */
3546
+ SvgRenderer__prototype.N/*endShape*/ = function endShape () { };
3547
+
3548
+ /**
3549
+ * Adds a polygon with the current fill color to the SVG.
3550
+ * @param points An array of Point objects.
3551
+ */
3552
+ SvgRenderer__prototype.g/*addPolygon*/ = function addPolygon (points) {
3553
+ this.B/*_path*/.g/*addPolygon*/(points);
3554
+ };
3555
+
3556
+ /**
3557
+ * Adds a circle with the current fill color to the SVG.
3558
+ * @param {Point} point The upper left corner of the circle bounding box.
3559
+ * @param {number} diameter The diameter of the circle.
3560
+ * @param {boolean} counterClockwise True if the circle is drawn counter-clockwise (will result in a hole if rendered on a clockwise path).
3561
+ */
3562
+ SvgRenderer__prototype.h/*addCircle*/ = function addCircle (point, diameter, counterClockwise) {
3563
+ this.B/*_path*/.h/*addCircle*/(point, diameter, counterClockwise);
3564
+ };
3565
+
3566
+ /**
3567
+ * Called when the icon has been completely drawn.
3568
+ */
3569
+ SvgRenderer__prototype.finish = function finish () {
3570
+ var this$1$1 = this;
3571
+
3572
+ var pathsByColor = this.C/*_pathsByColor*/;
3573
+ for (var color in pathsByColor) {
3574
+ // hasOwnProperty cannot be shadowed in pathsByColor
3575
+ // eslint-disable-next-line no-prototype-builtins
3576
+ if (pathsByColor.hasOwnProperty(color)) {
3577
+ this$1$1.P/*_target*/.R/*appendPath*/(color, pathsByColor[color].A/*dataString*/);
3578
+ }
3579
+ }
3580
+ };
3581
+
3582
+ var SVG_CONSTANTS = {
3583
+ S/*XMLNS*/: "http://www.w3.org/2000/svg",
3584
+ T/*WIDTH*/: "width",
3585
+ U/*HEIGHT*/: "height",
3586
+ };
3587
+
3588
+ /**
3589
+ * Renderer producing SVG output.
3590
+ */
3591
+ function SvgWriter(iconSize) {
3592
+ /**
3593
+ * @type {number}
3594
+ */
3595
+ this.k/*iconSize*/ = iconSize;
3596
+
3597
+ /**
3598
+ * @type {string}
3599
+ * @private
3600
+ */
3601
+ this.D/*_s*/ =
3602
+ '<svg xmlns="' + SVG_CONSTANTS.S/*XMLNS*/ + '" width="' +
3603
+ iconSize + '" height="' + iconSize + '" viewBox="0 0 ' +
3604
+ iconSize + ' ' + iconSize + '">';
3605
+ }
3606
+ var SvgWriter__prototype = SvgWriter.prototype;
3607
+
3608
+ /**
3609
+ * Fills the background with the specified color.
3610
+ * @param {string} fillColor Fill color on the format #rrggbb.
3611
+ * @param {number} opacity Opacity in the range [0.0, 1.0].
3612
+ */
3613
+ SvgWriter__prototype.m/*setBackground*/ = function setBackground (fillColor, opacity) {
3614
+ if (opacity) {
3615
+ this.D/*_s*/ += '<rect width="100%" height="100%" fill="' +
3616
+ fillColor + '" opacity="' + opacity.toFixed(2) + '"/>';
3617
+ }
3618
+ };
3619
+
3620
+ /**
3621
+ * Writes a path to the SVG string.
3622
+ * @param {string} color Fill color on format #rrggbb.
3623
+ * @param {string} dataString The SVG path data string.
3624
+ */
3625
+ SvgWriter__prototype.R/*appendPath*/ = function appendPath (color, dataString) {
3626
+ this.D/*_s*/ += '<path fill="' + color + '" d="' + dataString + '"/>';
3627
+ };
3628
+
3629
+ /**
3630
+ * Gets the rendered image as an SVG string.
3631
+ */
3632
+ SvgWriter__prototype.toString = function toString () {
3633
+ return this.D/*_s*/ + "</svg>";
3634
+ };
3635
+
3636
+ /**
3637
+ * Draws an identicon as an SVG string.
3638
+ * @param {*} hashOrValue - A hexadecimal hash string or any value that will be hashed by Jdenticon.
3639
+ * @param {number} size - Icon size in pixels.
3640
+ * @param {Object|number=} config - Optional configuration. If specified, this configuration object overrides any
3641
+ * global configuration in its entirety. For backward compatibility a padding value in the range [0.0, 0.5) can be
3642
+ * specified in place of a configuration object.
3643
+ * @returns {string} SVG string
3644
+ */
3645
+ function toSvg(hashOrValue, size, config) {
3646
+ var writer = new SvgWriter(size);
3647
+ iconGenerator(new SvgRenderer(writer),
3648
+ isValidHash(hashOrValue) || computeHash(hashOrValue),
3649
+ config);
3650
+ return writer.toString();
3651
+ }
3652
+
3653
+ /**
3654
+ * Creates a new element and adds it to the specified parent.
3655
+ * @param {Element} parentNode
3656
+ * @param {string} name
3657
+ * @param {...(string|number)} keyValuePairs
3658
+ */
3659
+ function SvgElement_append(parentNode, name) {
3660
+ var keyValuePairs = [], len = arguments.length - 2;
3661
+ while ( len-- > 0 ) keyValuePairs[ len ] = arguments[ len + 2 ];
3662
+
3663
+ var el = document.createElementNS(SVG_CONSTANTS.S/*XMLNS*/, name);
3664
+
3665
+ for (var i = 0; i + 1 < keyValuePairs.length; i += 2) {
3666
+ el.setAttribute(
3667
+ /** @type {string} */(keyValuePairs[i]),
3668
+ /** @type {string} */(keyValuePairs[i + 1])
3669
+ );
3670
+ }
3671
+
3672
+ parentNode.appendChild(el);
3673
+ }
3674
+
3675
+
3676
+ /**
3677
+ * Renderer producing SVG output.
3678
+ */
3679
+ function SvgElement(element) {
3680
+ // Don't use the clientWidth and clientHeight properties on SVG elements
3681
+ // since Firefox won't serve a proper value of these properties on SVG
3682
+ // elements (https://bugzilla.mozilla.org/show_bug.cgi?id=874811)
3683
+ // Instead use 100px as a hardcoded size (the svg viewBox will rescale
3684
+ // the icon to the correct dimensions)
3685
+ var iconSize = this.k/*iconSize*/ = Math.min(
3686
+ (Number(element.getAttribute(SVG_CONSTANTS.T/*WIDTH*/)) || 100),
3687
+ (Number(element.getAttribute(SVG_CONSTANTS.U/*HEIGHT*/)) || 100)
3688
+ );
3689
+
3690
+ /**
3691
+ * @type {Element}
3692
+ * @private
3693
+ */
3694
+ this.V/*_el*/ = element;
3695
+
3696
+ // Clear current SVG child elements
3697
+ while (element.firstChild) {
3698
+ element.removeChild(element.firstChild);
3699
+ }
3700
+
3701
+ // Set viewBox attribute to ensure the svg scales nicely.
3702
+ element.setAttribute("viewBox", "0 0 " + iconSize + " " + iconSize);
3703
+ element.setAttribute("preserveAspectRatio", "xMidYMid meet");
3704
+ }
3705
+ var SvgElement__prototype = SvgElement.prototype;
3706
+
3707
+ /**
3708
+ * Fills the background with the specified color.
3709
+ * @param {string} fillColor Fill color on the format #rrggbb.
3710
+ * @param {number} opacity Opacity in the range [0.0, 1.0].
3711
+ */
3712
+ SvgElement__prototype.m/*setBackground*/ = function setBackground (fillColor, opacity) {
3713
+ if (opacity) {
3714
+ SvgElement_append(this.V/*_el*/, "rect",
3715
+ SVG_CONSTANTS.T/*WIDTH*/, "100%",
3716
+ SVG_CONSTANTS.U/*HEIGHT*/, "100%",
3717
+ "fill", fillColor,
3718
+ "opacity", opacity);
3719
+ }
3720
+ };
3721
+
3722
+ /**
3723
+ * Appends a path to the SVG element.
3724
+ * @param {string} color Fill color on format #xxxxxx.
3725
+ * @param {string} dataString The SVG path data string.
3726
+ */
3727
+ SvgElement__prototype.R/*appendPath*/ = function appendPath (color, dataString) {
3728
+ SvgElement_append(this.V/*_el*/, "path",
3729
+ "fill", color,
3730
+ "d", dataString);
3731
+ };
3732
+
3733
+ /**
3734
+ * Updates all canvas elements with the `data-jdenticon-hash` or `data-jdenticon-value` attribute.
3735
+ */
3736
+ function updateAll() {
3737
+ if (documentQuerySelectorAll) {
3738
+ update(ICON_SELECTOR);
3739
+ }
3740
+ }
3741
+
3742
+ /**
3743
+ * Updates the identicon in the specified `<canvas>` or `<svg>` elements.
3744
+ * @param {(string|Element)} el - Specifies the container in which the icon is rendered as a DOM element of the type
3745
+ * `<svg>` or `<canvas>`, or a CSS selector to such an element.
3746
+ * @param {*=} hashOrValue - Optional hash or value to be rendered. If not specified, the `data-jdenticon-hash` or
3747
+ * `data-jdenticon-value` attribute will be evaluated.
3748
+ * @param {Object|number=} config - Optional configuration. If specified, this configuration object overrides any
3749
+ * global configuration in its entirety. For backward compability a padding value in the range [0.0, 0.5) can be
3750
+ * specified in place of a configuration object.
3751
+ */
3752
+ function update(el, hashOrValue, config) {
3753
+ renderDomElement(el, hashOrValue, config, function (el, iconType) {
3754
+ if (iconType) {
3755
+ return iconType == ICON_TYPE_SVG ?
3756
+ new SvgRenderer(new SvgElement(el)) :
3757
+ new CanvasRenderer(/** @type {HTMLCanvasElement} */(el).getContext("2d"));
3758
+ }
3759
+ });
3760
+ }
3761
+
3762
+ /**
3763
+ * Updates the identicon in the specified `<canvas>` elements.
3764
+ * @param {(string|Element)} el - Specifies the container in which the icon is rendered as a DOM element of the type
3765
+ * `<canvas>`, or a CSS selector to such an element.
3766
+ * @param {*=} hashOrValue - Optional hash or value to be rendered. If not specified, the `data-jdenticon-hash` or
3767
+ * `data-jdenticon-value` attribute will be evaluated.
3768
+ * @param {Object|number=} config - Optional configuration. If specified, this configuration object overrides any
3769
+ * global configuration in its entirety. For backward compability a padding value in the range [0.0, 0.5) can be
3770
+ * specified in place of a configuration object.
3771
+ */
3772
+ function updateCanvas(el, hashOrValue, config) {
3773
+ renderDomElement(el, hashOrValue, config, function (el, iconType) {
3774
+ if (iconType == ICON_TYPE_CANVAS) {
3775
+ return new CanvasRenderer(/** @type {HTMLCanvasElement} */(el).getContext("2d"));
3776
+ }
3777
+ });
3778
+ }
3779
+
3780
+ /**
3781
+ * Updates the identicon in the specified `<svg>` elements.
3782
+ * @param {(string|Element)} el - Specifies the container in which the icon is rendered as a DOM element of the type
3783
+ * `<svg>`, or a CSS selector to such an element.
3784
+ * @param {*=} hashOrValue - Optional hash or value to be rendered. If not specified, the `data-jdenticon-hash` or
3785
+ * `data-jdenticon-value` attribute will be evaluated.
3786
+ * @param {Object|number=} config - Optional configuration. If specified, this configuration object overrides any
3787
+ * global configuration in its entirety. For backward compability a padding value in the range [0.0, 0.5) can be
3788
+ * specified in place of a configuration object.
3789
+ */
3790
+ function updateSvg(el, hashOrValue, config) {
3791
+ renderDomElement(el, hashOrValue, config, function (el, iconType) {
3792
+ if (iconType == ICON_TYPE_SVG) {
3793
+ return new SvgRenderer(new SvgElement(el));
3794
+ }
3795
+ });
3796
+ }
3797
+
3798
+ /**
3799
+ * Updates the identicon in the specified canvas or svg elements.
3800
+ * @param {(string|Element)} el - Specifies the container in which the icon is rendered as a DOM element of the type
3801
+ * `<svg>` or `<canvas>`, or a CSS selector to such an element.
3802
+ * @param {*} hashOrValue - Optional hash or value to be rendered. If not specified, the `data-jdenticon-hash` or
3803
+ * `data-jdenticon-value` attribute will be evaluated.
3804
+ * @param {Object|number|undefined} config
3805
+ * @param {function(Element,number):Renderer} rendererFactory - Factory function for creating an icon renderer.
3806
+ */
3807
+ function renderDomElement(el, hashOrValue, config, rendererFactory) {
3808
+ if (typeof el === "string") {
3809
+ if (documentQuerySelectorAll) {
3810
+ var elements = documentQuerySelectorAll(el);
3811
+ for (var i = 0; i < elements.length; i++) {
3812
+ renderDomElement(elements[i], hashOrValue, config, rendererFactory);
3813
+ }
3814
+ }
3815
+ return;
3816
+ }
3817
+
3818
+ // Hash selection. The result from getValidHash or computeHash is
3819
+ // accepted as a valid hash.
3820
+ var hash =
3821
+ // 1. Explicit valid hash
3822
+ isValidHash(hashOrValue) ||
3823
+
3824
+ // 2. Explicit value (`!= null` catches both null and undefined)
3825
+ hashOrValue != null && computeHash(hashOrValue) ||
3826
+
3827
+ // 3. `data-jdenticon-hash` attribute
3828
+ isValidHash(el.getAttribute(ATTRIBUTES.O/*HASH*/)) ||
3829
+
3830
+ // 4. `data-jdenticon-value` attribute.
3831
+ // We want to treat an empty attribute as an empty value.
3832
+ // Some browsers return empty string even if the attribute
3833
+ // is not specified, so use hasAttribute to determine if
3834
+ // the attribute is specified.
3835
+ el.hasAttribute(ATTRIBUTES.v/*VALUE*/) && computeHash(el.getAttribute(ATTRIBUTES.v/*VALUE*/));
3836
+
3837
+ if (!hash) {
3838
+ // No hash specified. Don't render an icon.
3839
+ return;
3840
+ }
3841
+
3842
+ var renderer = rendererFactory(el, getIdenticonType(el));
3843
+ if (renderer) {
3844
+ // Draw icon
3845
+ iconGenerator(renderer, hash, config);
3846
+ el[IS_RENDERED_PROPERTY] = true;
3847
+ }
3848
+ }
3849
+
3850
+ // This file is compiled to dist/jdenticon-module.js
3851
+
3852
+ var jdenticon = updateAll;
3853
+
3854
+ defineConfigProperty(jdenticon);
3855
+
3856
+ // Export public API
3857
+ jdenticon["configure"] = configure;
3858
+ jdenticon["drawIcon"] = drawIcon;
3859
+ jdenticon["toSvg"] = toSvg;
3860
+ jdenticon["update"] = update;
3861
+ jdenticon["updateCanvas"] = updateCanvas;
3862
+ jdenticon["updateSvg"] = updateSvg;
3863
+
3864
+ /**
3865
+ * Specifies the version of the Jdenticon package in use.
3866
+ * @type {string}
3867
+ */
3868
+ jdenticon["version"] = "3.3.0";
3869
+
3870
+ /**
3871
+ * Specifies which bundle of Jdenticon that is used.
3872
+ * @type {string}
3873
+ */
3874
+ jdenticon["bundle"] = "browser-cjs";
3875
+
3876
+ var jdenticonModule = jdenticon;
3877
+
3878
+ const dashButtonCss = ".button{display:flex;height:50px;padding:0;background:#3e7671;border:none;outline:none;border-radius:5px;overflow:hidden;font-size:16px;font-weight:500;cursor:pointer;min-width:220px;max-width:220px}.button:hover{background:#008168}.button:active{background:#3e7671}.button-text{display:block;margin:auto;padding:0 24px;color:#fff;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;width:80px;text-transform:capitalize}.button-icon{margin:auto;padding:10px}.button-profile{margin:auto}.button-profile svg{display:flex;margin-left:4px;background-color:#fff;border-radius:4px}.button-text-full-width{width:auto!important}.button-link{text-decoration:none!important}.gg-menu-grid-r{color:#fff;box-sizing:border-box;position:relative;display:block;transform:scale(var(--ggs,1));width:16px;height:16px}.gg-menu-grid-r::before{content:\"\";display:block;box-sizing:border-box;position:absolute;width:4px;height:4px;background:currentColor;box-shadow:0 6px 0,\n 6px 6px 0,\n 12px 6px 0,\n 6px 12px 0,\n 12px 12px 0,\n 6px 0 0,\n 12px 0 0,\n 0 12px 0}.dropdown{position:relative;display:inline-block}.dropdown-content{display:none;position:absolute;right:0;background-color:#f9f9f9;min-width:180px;box-shadow:0px 8px 16px 0px rgba(0,0,0,0.2);z-index:1;border-radius:5px}.dropdown-content a{color:#71797E;padding:16px 20px;text-decoration:none;display:block;cursor:pointer}.dropdown-content a:hover{background-color:#f1f1f1;color:#000;opacity:0.7}.dropdown:hover .dropdown-content{display:block}.modal{display:none;position:fixed;z-index:1;padding-top:100px;left:0;top:0;width:100%;height:100%;overflow:auto;background-color:rgb(0,0,0);background-color:rgba(0,0,0,0.4);text-align:center}.modal-content{background-color:#fefefe;margin:auto;padding:20px;border:1px solid #888;width:40%}.modal-body{max-height:50vh;overflow-y:auto}.close{color:#aaaaaa;float:right;font-size:28px;font-weight:bold}.close:hover,.close:focus{color:#000;text-decoration:none;cursor:pointer}.modal-app{background-color:#c3e9bc;padding:15px;margin:10px;border-radius:5px}.external-app-link{text-decoration:none;color:#000}.gray-text{color:#606060}.green-text{color:#3e7671}#countdown{position:relative;margin:auto;margin-top:30px;height:40px;width:40px;text-align:center}#countdown-number{color:#2e2e2e;display:inline-block;line-height:40px}#countdown svg{position:absolute;top:0;right:0;width:40px;height:40px;transform:rotateY(-180deg) rotateZ(-90deg)}#countdown svg circle{stroke-dasharray:113px;stroke-dashoffset:0px;stroke-linecap:round;stroke-width:4px;stroke:#008168;fill:none;animation:countdown 6s linear infinite forwards}@keyframes countdown{from{stroke-dashoffset:0px}to{stroke-dashoffset:113px}}.lds-ring{color:#fff}.lds-ring{display:flex;justify-content:center;align-items:center;margin:auto;position:relative}.lds-ring div{box-sizing:border-box;display:block;position:absolute;width:30px;height:30px;margin:3px;border:3px solid currentColor;border-radius:50%;animation:lds-ring 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;border-color:currentColor transparent transparent transparent}.lds-ring div:nth-child(1){animation-delay:-0.45s}.lds-ring div:nth-child(2){animation-delay:-0.3s}.lds-ring div:nth-child(3){animation-delay:-0.15s}@keyframes lds-ring{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}.menu-bar-icons{color:#008168;display:inline-block;margin-bottom:-3px}.gg-microsoft{transform:scale(var(--ggs,1));margin-right:12px}.gg-microsoft,.gg-microsoft::after,.gg-microsoft::before{box-sizing:border-box;position:relative;width:18px;height:18px}.gg-microsoft::after,.gg-microsoft::before{content:\"\";position:absolute;width:8px;border-top:8px solid;border-bottom:8px solid}.gg-microsoft::after{right:0}.gg-ereader{box-sizing:border-box;position:relative;transform:scale(var(--ggs,1));width:20px;height:18px;border:2px solid;border-radius:3px;margin-right:9px}.gg-ereader::after,.gg-ereader::before{content:\"\";display:block;box-sizing:border-box;position:absolute;border-radius:3px;width:2px;height:18px;right:9px;top:-2px;background:currentColor}.gg-ereader::after{width:5px;height:2px;box-shadow:0 4px 0,0 8px 0;top:2px;right:2px}.gg-display-flex{box-sizing:border-box;position:relative;transform:scale(var(--ggs,1));height:14px;width:16px;border:2px solid transparent;margin-right:13px;box-shadow:0 0 0 2px,\n inset -2px 0 0 0,\n inset 2px 0 0 0}.gg-align-bottom{box-sizing:border-box;position:relative;height:12px;width:12px;border-bottom:2px solid;transform:scale(var(--ggs,1));margin-top:4px;margin-right:16px}.gg-align-bottom::after,.gg-align-bottom::before{content:\"\";display:block;box-sizing:border-box;position:absolute;width:4px;background:currentColor;bottom:2px}.gg-align-bottom::before{left:1px;height:12px}.gg-align-bottom::after{height:6px;right:1px;opacity:.5}.gg-log-out{box-sizing:border-box;position:relative;width:6px;height:16px;border:2px solid;transform:scale(var(--ggs,1));border-right:0;border-top-left-radius:2px;border-bottom-left-radius:2px;margin-right:22px}.gg-log-out::after,.gg-log-out::before{content:\"\";display:block;box-sizing:border-box;position:absolute}.gg-log-out::after{border-top:2px solid;border-left:2px solid;transform:rotate(-45deg);width:8px;height:8px;left:4px;bottom:2px}.gg-log-out::before{border-radius:3px;width:10px;height:2px;background:currentColor;left:5px;bottom:5px}";
2481
3879
  const DashButtonStyle0 = dashButtonCss;
2482
3880
 
2483
3881
  const DashButtonComponent = class {
@@ -2494,6 +3892,7 @@ const DashButtonComponent = class {
2494
3892
  this.portalUrl = "";
2495
3893
  this.marketplaceUrl = "https://marketplace-zdzw.cloud.zdzw-project.com";
2496
3894
  this.plmUrl = "https://productlicensemanager-zdzw.cloud.zdzw-project.com";
3895
+ this.usageTrackingUrl = "https://usage-tracking-ui-zdzw.cloud.zdzw-project.com";
2497
3896
  this.showUnauthorizedModal = false;
2498
3897
  this.postTextDelayDuration = undefined;
2499
3898
  this.keycloak = new Keycloak({
@@ -2502,10 +3901,11 @@ const DashButtonComponent = class {
2502
3901
  clientId: this.clientId,
2503
3902
  });
2504
3903
  this.isAuth = false;
2505
- this.givenName = "";
3904
+ this.givenUserName = "";
2506
3905
  this.silentCheckSsoRedirectUri = window.location.origin + '/assets/verificar-sso.html';
2507
3906
  this.appList = [];
2508
3907
  this.showPostLoginLoadingSpinner = false;
3908
+ this.avatarSvg = jdenticonModule.toSvg("init-avatar", 40);
2509
3909
  }
2510
3910
  ;
2511
3911
  componentWillLoad() {
@@ -2580,7 +3980,10 @@ const DashButtonComponent = class {
2580
3980
  this.isAuth = true;
2581
3981
  localStorage.setItem("keycloak", JSON.stringify(this.keycloak));
2582
3982
  document.cookie = "ZDZW_cookie=" + JSON.parse(localStorage.getItem('keycloak')).token;
2583
- this.givenName = JSON.parse(localStorage.getItem('keycloak')).idTokenParsed.given_name;
3983
+ // Set userName
3984
+ this.givenUserName = JSON.parse(localStorage.getItem('keycloak')).idTokenParsed.preferred_username;
3985
+ // Set user avatar
3986
+ this.avatarSvg = jdenticonModule.toSvg(JSON.parse(localStorage.getItem('keycloak')).idTokenParsed.sub, 40);
2584
3987
  }
2585
3988
  });
2586
3989
  }
@@ -2616,7 +4019,7 @@ const DashButtonComponent = class {
2616
4019
  appModal.style.display = "none";
2617
4020
  }
2618
4021
  render() {
2619
- return index.h("div", { key: '7843bbee4940a6a252e61442f8d77d467ee769c2' }, index.h("div", { key: 'd0940bd721a4eab5533cb7b136fabe8353cbb535' }, (() => {
4022
+ return index.h("div", { key: 'ba94f3503dbaaa921cb29d1e15e576c96a2b86c6' }, index.h("div", { key: '24aff9e285c7477761f048e1868e8aed724aa7ea' }, (() => {
2620
4023
  if (this.isAuth && this.showPostLoginText) {
2621
4024
  // User set post-text-delay-duration for displaying loading spinner
2622
4025
  if (this.showPostLoginLoadingSpinner) {
@@ -2627,14 +4030,14 @@ const DashButtonComponent = class {
2627
4030
  }
2628
4031
  }
2629
4032
  else if (this.isAuth) {
2630
- return (index.h("div", { id: "profile-btn", class: "dropdown" }, index.h("button", { type: "button", class: "button" }, index.h("span", { class: "button-profile" }, index.h("img", { src: "https://i.pravatar.cc/100?img=32", alt: "" })), index.h("span", { id: "given-name", class: "button-text" }, this.givenName), index.h("div", { class: "button-icon" }, index.h("span", { class: "gg-menu-grid-r" }))), index.h("div", { class: "dropdown-content" }, index.h("a", { onClick: this.showModal.bind(this), id: "applications-btn" }, "Applications"), index.h("a", { href: this.portalUrl, target: '_blank', id: "applications-btn" }, "Portal"), index.h("a", { href: this.marketplaceUrl, target: '_blank', id: "applications-btn" }, "Marketplace"), index.h("a", { onClick: this.logout.bind(this), id: "logout-btn" }, "Logout"))));
4033
+ return (index.h("div", { id: "profile-btn", class: "dropdown" }, index.h("button", { type: "button", class: "button" }, index.h("span", { class: "button-profile" }, index.h("div", { innerHTML: this.avatarSvg })), index.h("span", { id: "given-name", class: "button-text" }, this.givenUserName), index.h("div", { class: "button-icon" }, index.h("span", { class: "gg-menu-grid-r" }))), index.h("div", { class: "dropdown-content" }, index.h("a", { onClick: this.showModal.bind(this), id: "applications-btn" }, index.h("i", { class: "menu-bar-icons gg-microsoft" }), "Applications"), index.h("a", { href: this.portalUrl, target: '_blank', id: "applications-btn" }, index.h("i", { class: "menu-bar-icons gg-ereader" }), "Portal"), index.h("a", { href: this.marketplaceUrl, target: '_blank', id: "applications-btn" }, index.h("i", { class: "menu-bar-icons gg-display-flex" }), "Marketplace"), index.h("a", { href: this.usageTrackingUrl, target: '_blank', id: "applications-btn" }, index.h("i", { class: "menu-bar-icons gg-align-bottom" }), "Usage Tracking"), index.h("a", { onClick: this.logout.bind(this), id: "logout-btn" }, index.h("i", { class: "menu-bar-icons gg-log-out" }), "Logout"))));
2631
4034
  }
2632
4035
  else {
2633
4036
  return (index.h("button", { onClick: this.login.bind(this), id: "login-btn", type: "button", class: "button" }, index.h("span", { class: "button-text" }, "Login")));
2634
4037
  }
2635
- })()), index.h("div", { key: '2c2f55d80917b2dc2b7a9279f2f76bc3a7f2e202', id: "appListModal", class: "modal" }, index.h("div", { key: '90d14c23cdbb1a129ba99f00518cff0a0a65baeb', class: "modal-content" }, index.h("span", { key: '6879c9fdc1d9a4a7075616f96ff63d95f8eaaea7', onClick: this.closeModal.bind(this), class: "close" }, "\u00D7"), index.h("h3", { key: '06a0268e396c3aeda8cf90e93e3dde405743abcd' }, "Applications"), index.h("div", { key: '2f77c0e5d35acdb101cfe9caf2b6e26be241dae9', class: "modal-body" }, this.appList.length > 0 ? this.appList.map(app => {
4038
+ })()), index.h("div", { key: 'ea4d022e81fc6e7506c6c774c60b8c8ad5a727b5', id: "appListModal", class: "modal" }, index.h("div", { key: '13baaa2ee3cc0dac2c259f03d12ff5359c537e27', class: "modal-content" }, index.h("span", { key: '3dec21d8be01de78931ef1a4f52b54795589d032', onClick: this.closeModal.bind(this), class: "close" }, "\u00D7"), index.h("h3", { key: '6b9b8000e7e8d66402b4cebd83c102e1a6790674' }, "Applications"), index.h("div", { key: 'bdf1eee7bdee6e8b13c97a01cbccc80d6e4658cf', class: "modal-body" }, this.appList.length > 0 ? this.appList.map(app => {
2636
4039
  return (index.h("a", { class: "external-app-link", target: '_blank', href: "https://" + app.shortname + "-zdzw" + this.portalUrl.replace(/(^\w+:|^)\/\//, '').replace('portal-frontend-zdzw', '') }, index.h("div", { class: "modal-app" }, index.h("div", null, app.name))));
2637
- }) : index.h("div", null, index.h("h3", { class: "gray-text" }, "Not installed application found."), " ", index.h("p", { class: "gray-text" }, "Please contact administration."))))), index.h("div", { key: 'bd4688753740aa007b07c2eae3addb53735d8f0a', id: "appPermissionErrorModal", class: "modal" }, index.h("div", { key: 'e4456ad3eca347536e671acd7194e7b9edde14c9', class: "modal-content" }, index.h("img", { key: '2332a30194ff8629bfee4e80c87b6a537962b97c', src: "data:image/png;base64,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" }), index.h("h2", { key: 'b0e4790f74c08bbc7f3b3ebfdc1f5a910eff8c2f', class: "green-text margin-b" }, "You don't have permission to access this application."), index.h("h3", { key: '8de093a380855028b879686a9ab1b345dea4e356', class: "green-text" }, "Please contact the administration."), (this.portalUrl && this.showUnauthorizedModal) ?
4040
+ }) : index.h("div", null, index.h("h3", { class: "gray-text" }, "Not installed application found."), " ", index.h("p", { class: "gray-text" }, "Please contact administration."))))), index.h("div", { key: '0716882a9de0dea9d7e5111a82df972f172b9ed9', id: "appPermissionErrorModal", class: "modal" }, index.h("div", { key: 'a6e1210bac100315259cc32bf06f53bb9c9276fe', class: "modal-content" }, index.h("img", { key: 'db854af453ead6b1737f9adfc274f25540d85d94', src: "data:image/png;base64,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" }), index.h("h2", { key: 'b7fefcf4dfbd20b181c73df0d6fdcb9bbee92609', class: "green-text margin-b" }, "You don't have permission to access this application."), index.h("h3", { key: '9c9187a3f0432073509141952ee7e2efb6619b2c', class: "green-text" }, "Please contact the administration."), (this.portalUrl && this.showUnauthorizedModal) ?
2638
4041
  index.h("div", null, index.h("h4", { class: "gray-text" }, "You will be automatically redirected to the portal."), index.h("div", { id: "countdown" }, index.h("div", { id: "countdown-number" }), index.h("svg", null, index.h("circle", { r: "18", cx: "20", cy: "20" }))))
2639
4042
  : index.h("div", null))));
2640
4043
  }