<commit_before>define(["app/config", "app/i18n/bg", "app/i18n/cs", "app/i18n/de",
        "app/i18n/en", "app/i18n/fi", "app/i18n/fr", "app/i18n/hr",
        "app/i18n/ru", "app/i18n/it", "app/i18n/eo", "app/i18n/sv",
        "app/i18n/nl", "app/i18n/el_GR", "app/i18n/es", "app/i18n/vi",
        "app/i18n/zh_CN"],
        function(config, bg, cs, de, en, fi, fr, hr, ru, it, eo, sv, nl, el, es, vi, zh) {

    "use strict";

    var pluralforms = function(lang) {
        switch (lang) {
        case "bg":
        case "cs":
        case "de":
        case "el":
        case "en":
        case "es":
        case "eo":
        case "fi":
        case "hr":
        case "it":
        case "sv":
        case "nl":
        case "vi":
        case "zh":
            return function(msgs, n) {
                return msgs[n === 1 ? 0 : 1];
            };
        case "fr":
            return function(msgs, n) {
                return msgs[n > 1 ? 1 : 0];
            };
        case "ru":
            return function(msgs, n) {
                if (n % 10 === 1 && n % 100 !== 11) {
                    return msgs[0];
                } else if (n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 10 || n % 100 >= 20)) {
                    return msgs[1];
                } else {
                    return typeof msgs[2] !== "undefined" ? msgs[2] : msgs[1];
                }
            };
        default:
            return null;
        }
    };

    // useragent's prefered language (or manually overridden)
    var lang = config.lang;

    // fall back to English
    if (! pluralforms(lang)) {
        lang = "en";
    }

    var catalogue = {
        cs: cs,
        de: de,
        el: el,
        en: en,
        eo: eo,
        es: es,
        fi: fi,
        fr: fr,
        it: it,
        hr: hr,
        ru: ru,
        sv: sv,
        nl: nl,
        vi: vi,
        zh: zh
    };

    var plural = pluralforms(lang);

    var translate = function(msgid) {
        return catalogue[lang][msgid] || en[msgid] || "???";
    };

    var pluralize = function(msgid, n) {
        var msg;

        msg = translate(msgid);
        if (msg.indexOf("\n") > -1) {
            msg = plural(msg.split("\n"), (+ n));
        }

        return msg ? msg.replace("{{ n }}", (+ n)) : msg;
    };

    return {
        lang: lang,
        translate: translate,
        pluralize: pluralize
    };
});
<commit_msg>add persian to i18n<commit_after>define(["app/config", "app/i18n/bg", "app/i18n/cs", "app/i18n/de",
        "app/i18n/en", "app/i18n/fa", "app/i18n/fi", "app/i18n/fr",
        "app/i18n/hr", "app/i18n/ru", "app/i18n/it", "app/i18n/eo",
        "app/i18n/sv", "app/i18n/nl", "app/i18n/el_GR", "app/i18n/es",
        "app/i18n/vi", "app/i18n/zh_CN"],
        function(config, bg, cs, de, en, fa, fi, fr, hr, ru, it, eo, sv, nl, el, es, vi, zh) {

    "use strict";

    var pluralforms = function(lang) {
        switch (lang) {
        case "bg":
        case "cs":
        case "de":
        case "el":
        case "en":
        case "es":
        case "eo":
        case "fa":
        case "fi":
        case "hr":
        case "it":
        case "sv":
        case "nl":
        case "vi":
        case "zh":
            return function(msgs, n) {
                return msgs[n === 1 ? 0 : 1];
            };
        case "fr":
            return function(msgs, n) {
                return msgs[n > 1 ? 1 : 0];
            };
        case "ru":
            return function(msgs, n) {
                if (n % 10 === 1 && n % 100 !== 11) {
                    return msgs[0];
                } else if (n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 10 || n % 100 >= 20)) {
                    return msgs[1];
                } else {
                    return typeof msgs[2] !== "undefined" ? msgs[2] : msgs[1];
                }
            };
        default:
            return null;
        }
    };

    // useragent's prefered language (or manually overridden)
    var lang = config.lang;

    // fall back to English
    if (! pluralforms(lang)) {
        lang = "en";
    }

    var catalogue = {
        cs: cs,
        de: de,
        el: el,
        en: en,
        eo: eo,
        es: es,
        fa: fa,
        fi: fi,
        fr: fr,
        it: it,
        hr: hr,
        ru: ru,
        sv: sv,
        nl: nl,
        vi: vi,
        zh: zh
    };

    var plural = pluralforms(lang);

    var translate = function(msgid) {
        return catalogue[lang][msgid] || en[msgid] || "???";
    };

    var pluralize = function(msgid, n) {
        var msg;

        msg = translate(msgid);
        if (msg.indexOf("\n") > -1) {
            msg = plural(msg.split("\n"), (+ n));
        }

        return msg ? msg.replace("{{ n }}", (+ n)) : msg;
    };

    return {
        lang: lang,
        translate: translate,
        pluralize: pluralize
    };
});
<|endoftext|>


<commit_before>import Shader from '../../low_level/shaders/Shader';
import DecalShader from './DecalShader';
import Vector4 from '../../low_level/math/Vector4';

export class PBRPrincipledShaderSource {

  FSDefine_PBRPrincipledShaderSource(in_, f, lights) {

    var sampler2D = this._sampler2DShadow_func();
    var shaderText = '';
    shaderText += 'uniform vec4 Kd;\n';
    shaderText += 'uniform vec4 ambient;\n'; // Ka * amount of ambient lights

    let lightNumExceptAmbient = lights.filter((light)=>{return !light.isTypeAmbient();}).length;
    if (lightNumExceptAmbient > 0) {
      shaderText += `uniform highp ${sampler2D} uDepthTexture[${lightNumExceptAmbient}];\n`;
      shaderText += `uniform int isShadowCasting[${lightNumExceptAmbient}];\n`;
    }

    return shaderText;
  }

  VSMethodDefine_PBRPrincipledShaderSource(f, lights, material, extraData) {
    let shaderText = '';
    shaderText += `
    float foo(float val) {
      return val;
    }
    `;

    return shaderText;
  }

  FSShade_PBRPrincipledShaderSource(f, gl, lights) {
    var shaderText = '';

    shaderText += '  vec4 surfaceColor = rt0;\n';
    shaderText += '  rt0 = vec4(0.0, 0.0, 0.0, 0.0);\n';

    for (let i=0; i<lights.length; i++) {
      let light = lights[i];
      let isShadowEnabledAsTexture = (light.camera && light.camera.texture) ? true:false;
      shaderText += `  {\n`;
      shaderText +=      Shader._generateLightStr(i);
      shaderText +=      Shader._generateShadowingStr(gl, i, isShadowEnabledAsTexture);
      shaderText += `    float diffuse = max(dot(lightDirection, normal), 0.0);\n`;
      shaderText += `    rt0 += spotEffect * vec4(visibility, visibility, visibility, 1.0) * Kd * lightDiffuse[${i}] * vec4(diffuse, diffuse, diffuse, 1.0) * surfaceColor;\n`;
      shaderText += `  }\n`;
    }
    shaderText += '  rt0.xyz += ambient.xyz;\n';

    //shaderText += '  rt0.a = 1.0;\n';
    // shaderText += '  rt0 = surfaceColor;\n';
//    shaderText += '  rt0 = vec4(v_shadowCoord[0].xy, 0.0, 1.0);\n';

    return shaderText;
  }

  prepare_PBRPrincipledShaderSource(gl, shaderProgram, expression, vertexAttribs, existCamera_f, lights, material, extraData) {

    var vertexAttribsAsResult = [];

    material.setUniform(shaderProgram, 'uniform_Kd', this._glContext.getUniformLocation(shaderProgram, 'Kd'));
    material.setUniform(shaderProgram, 'uniform_ambient', this._glContext.getUniformLocation(shaderProgram, 'ambient'));

    return vertexAttribsAsResult;
  }
}

export default class PBRPrincipledShader extends DecalShader {
  constructor(glBoostContext, basicShader) {

    super(glBoostContext, basicShader);
    LambertShader.mixin(LambertShaderSource);
  }

  setUniforms(gl, glslProgram, scene, material, camera, mesh, lights) {
    super.setUniforms(gl, glslProgram, scene, material, camera, mesh, lights);

  }

}

GLBoost['PBRPrincipledShader'] = PBRPrincipledShader;
<commit_msg>Add PBRPrincipledShader.js<commit_after>import Shader from '../../low_level/shaders/Shader';
import DecalShader from './DecalShader';
import Vector4 from '../../low_level/math/Vector4';

export class PBRPrincipledShaderSource {

  FSDefine_PBRPrincipledShaderSource(in_, f, lights) {

    var sampler2D = this._sampler2DShadow_func();
    var shaderText = '';
    shaderText += 'uniform vec4 Kd;\n';
    shaderText += 'uniform vec4 ambient;\n'; // Ka * amount of ambient lights

    let lightNumExceptAmbient = lights.filter((light)=>{return !light.isTypeAmbient();}).length;
    if (lightNumExceptAmbient > 0) {
      shaderText += `uniform highp ${sampler2D} uDepthTexture[${lightNumExceptAmbient}];\n`;
      shaderText += `uniform int isShadowCasting[${lightNumExceptAmbient}];\n`;
    }

    return shaderText;
  }

  VSMethodDefine_PBRPrincipledShaderSource(f, lights, material, extraData) {
    let shaderText = '';

    shaderText += `
      const float M_PI = 3.141592653589793;
    `;

    shaderText += `
    float angular_n_h(float NH) {
      return acos(NH);
    }
    `;

    shaderText += `
    float sqr(float x) {
      return x*x;
    }
    `;

    shaderText += `
    float d_phong(float NH, float c1) {
      return pow(
        cos(acos(NH))
        , c1
      );
    }
    `;

    shaderText += `
    // GGX NDF
    float d_ggx(float NH, float alphaRoughness) {
      float roughnessSqr = alphaRoughness * alphaRoughness;
      float f = (roughnessSqr - 1) * NH * NH + 1.0;
      return roughnessSq / (M_PI * f * f);
    }
    `;

    shaderText += `
    float d_torrance_reiz(float NH, float c3) {
      float CosSquared = NH*NH;
      float TanSquared = (1.0 - CosSquared)/CosSquared;
      //return (1.0/PI) * sqr(c3/(CosSquared * (c3*c3 + TanSquared)));  // gamma = 2, aka GGX
      return (1.0/sqrt(PI)) * (sqr(c3)/(CosSquared * (c3*c3 + TanSquared))); // gamma = 1, D_Berry
    }
    `;

    shaderText += `
    float d_beckmann(float NH, float m) {
      float co = 1.0 / (4.0 * m * m * NH * NH * NH * NH);
      float expx = exp((NH * NH - 1.0) / (m * m * NH * NH));
      return co * expx;
    }
    `;

    shaderText += `
    float g_shielding(float NH, float NV, float NL, float VH) {
      float g1 = 2.0 * NH * NV / VH;
      float g2 = 2.0 * NH * NL / VH;
      return max(0.0, min(1.0, min(g1, g2)));
    }
    `;

    shaderText += `
    float fresnel(float n, float VH) {
      float c = VH;
      float g = sqrt(n * n + c * c - 1.0);
      float f = ((g - c)*(g - c))/((g + c)*(g + c)) * (1.0 +
      ((c * (g + c) - 1.0)*(c * (g + c) - 1.0))
      /
      ((c * (g - c) - 1.0)*(c * (g - c) - 1.0))
      );
      return f;
    }
    `;

    shaderText += `
    float cook_torrance_specular_brdf(float n, float NH, float NV, float NL, float VH, float power) {
      float D = d_torrance_reiz(NH, power);
      float G = g_shielding(NH, NV, NL, VH);
      float F = fresnel(n, VH);
      return D*G*F/(4*NL*NV);
    }
    `;

    return shaderText;
  }

  FSShade_PBRPrincipledShaderSource(f, gl, lights) {
    var shaderText = '';

    shaderText += '  vec4 surfaceColor = rt0;\n';
    shaderText += '  rt0 = vec4(0.0, 0.0, 0.0, 0.0);\n';

    for (let i=0; i<lights.length; i++) {
      let light = lights[i];
      let isShadowEnabledAsTexture = (light.camera && light.camera.texture) ? true:false;
      shaderText += `  {\n`;
      shaderText +=      Shader._generateLightStr(i);
      shaderText +=      Shader._generateShadowingStr(gl, i, isShadowEnabledAsTexture);
      shaderText += `    float diffuse = max(dot(lightDirection, normal), 0.0);\n`;
      shaderText += `    rt0 += spotEffect * vec4(visibility, visibility, visibility, 1.0) * Kd * lightDiffuse[${i}] * vec4(diffuse, diffuse, diffuse, 1.0) * surfaceColor;\n`;
      shaderText += `  }\n`;
    }
    shaderText += '  rt0.xyz += ambient.xyz;\n';

    //shaderText += '  rt0.a = 1.0;\n';
    // shaderText += '  rt0 = surfaceColor;\n';
//    shaderText += '  rt0 = vec4(v_shadowCoord[0].xy, 0.0, 1.0);\n';

    return shaderText;
  }

  prepare_PBRPrincipledShaderSource(gl, shaderProgram, expression, vertexAttribs, existCamera_f, lights, material, extraData) {

    var vertexAttribsAsResult = [];

    material.setUniform(shaderProgram, 'uniform_Kd', this._glContext.getUniformLocation(shaderProgram, 'Kd'));
    material.setUniform(shaderProgram, 'uniform_ambient', this._glContext.getUniformLocation(shaderProgram, 'ambient'));

    return vertexAttribsAsResult;
  }
}

export default class PBRPrincipledShader extends DecalShader {
  constructor(glBoostContext, basicShader) {

    super(glBoostContext, basicShader);
    LambertShader.mixin(LambertShaderSource);
  }

  setUniforms(gl, glslProgram, scene, material, camera, mesh, lights) {
    super.setUniforms(gl, glslProgram, scene, material, camera, mesh, lights);

  }

}

GLBoost['PBRPrincipledShader'] = PBRPrincipledShader;
<|endoftext|>


<commit_before>import flags from './flags';
class Currency {
  /**
   * @param {Object} currency
   * @param {string} currency.name - Curreny Name
   * @param {string} currency.value - Defaults to Curreny Name
   * @param {string} currency.img - Path to Icon
   */
  constructor({ name, value = name, img }) {
    this.name = name;
    this.value = value;
    this.img = img;
  }
}
/**
 * Returns array of Currency values with icons
 */
export default [
  /**
   * Unsorted currencies go here
   */
  new Currency({ name: 'USD', img: flags.usFlag }),
  ...[
    new Currency({ name: 'AED', img: flags.aeFlag }),
    new Currency({ name: 'AFN', img: flags.afFlag }),
    new Currency({ name: 'ALL', img: flags.alFlag }),
    new Currency({ name: 'AMD', img: flags.amFlag }),
    new Currency({ name: 'ANG', img: flags.sxFlag }),
    new Currency({ name: 'AOA', img: flags.aoFlag }),
    new Currency({ name: 'ARS', img: flags.arFlag }),
    new Currency({ name: 'AUD', img: flags.auFlag }),
    new Currency({ name: 'AWG', img: flags.awFlag }),
    new Currency({ name: 'AZN', img: flags.azFlag }),
    new Currency({ name: 'BAM', img: flags.baFlag }),
    new Currency({ name: 'BBD', img: flags.bbFlag }),
    new Currency({ name: 'BDT', img: flags.bdFlag }),
    new Currency({ name: 'BGN', img: flags.bgFlag }),
    new Currency({ name: 'BHD', img: flags.bhFlag }),
    new Currency({ name: 'BIF', img: flags.biFlag }),
    new Currency({ name: 'BMD', img: flags.bmFlag }),
    new Currency({ name: 'BND', img: flags.bnFlag }),
    new Currency({ name: 'BOB', img: flags.boFlag }),
    new Currency({ name: 'BRL', img: flags.brFlag }),
    new Currency({ name: 'BSD', img: flags.bsFlag }),
    //new Currency({ name: 'BTC', img: flags.btFlag }),
    new Currency({ name: 'BTN', img: flags.btFlag }),
    new Currency({ name: 'BWP', img: flags.bwFlag }),
    new Currency({ name: 'BYN', img: flags.byFlag }),
    //new Currency({ name: 'BYR', img: flags }),
    new Currency({ name: 'BZD', img: flags.bzFlag }),
    new Currency({ name: 'CAD', img: flags.caFlag }),
    new Currency({ name: 'CDF', img: flags.cdFlag }),
    new Currency({ name: 'CHF', img: flags.liFlag }),
    new Currency({ name: 'CLF', img: flags.clFlag }),
    new Currency({ name: 'CLP', img: flags.clFlag }),
    new Currency({ name: 'CNY', img: flags.cnFlag }),
    new Currency({ name: 'COP', img: flags.coFlag }),
    new Currency({ name: 'CRC', img: flags.crFlag }),
    new Currency({ name: 'CUC', img: flags.cuFlag }),
    new Currency({ name: 'CUP', img: flags.cuFlag }),
    new Currency({ name: 'CVE', img: flags.cvFlag }),
    new Currency({ name: 'CZK', img: flags.czFlag }),
    new Currency({ name: 'DJF', img: flags.djFlag }),
    new Currency({ name: 'DKK', img: flags.dkFlag }),
    new Currency({ name: 'DOP', img: flags.doFlag }),
    new Currency({ name: 'DZD', img: flags.dzFlag }),
    new Currency({ name: 'EGP', img: flags.egFlag }),
    new Currency({ name: 'ERN', img: flags.erFlag }),
    new Currency({ name: 'ETB', img: flags.etFlag }),
    new Currency({ name: 'EUR', img: flags.europeanUnFlag }),
    new Currency({ name: 'FJD', img: flags.fjFlag }),
    new Currency({ name: 'FKP', img: flags.fkFlag }),
    new Currency({ name: 'GBP', img: flags.gbFlag }),
    new Currency({ name: 'GEL', img: flags.geFlag }),
    //new Currency({ name: 'GGP', img: flags }),
    new Currency({ name: 'GHS', img: flags.ghFlag }),
    new Currency({ name: 'GIP', img: flags.giFlag }),
    new Currency({ name: 'GMD', img: flags.gmFlag }),
    new Currency({ name: 'GNF', img: flags.gnFlag }),
    new Currency({ name: 'GTQ', img: flags.gtFlag }),
    new Currency({ name: 'GYD', img: flags.gyFlag }),
    new Currency({ name: 'HKD', img: flags.hkFlag }),
    new Currency({ name: 'HNL', img: flags.hnFlag }),
    new Currency({ name: 'HRK', img: flags.hrFlag }),
    new Currency({ name: 'HTG', img: flags.htFlag }),
    new Currency({ name: 'HUF', img: flags.huFlag }),
    new Currency({ name: 'IDR', img: flags.idFlag }),
    new Currency({ name: 'ILS', img: flags.ilFlag }),
    //new Currency({ name: 'IMP', img: flags }),
    new Currency({ name: 'INR', img: flags.btFlag }),
    new Currency({ name: 'IQD', img: flags.iqFlag }),
    new Currency({ name: 'IRR', img: flags.irFlag }),
    new Currency({ name: 'ISK', img: flags.isFlag }),
    //new Currency({ name: 'JEP', img: flags }),
    new Currency({ name: 'JMD', img: flags.jmFlag }),
    new Currency({ name: 'JOD', img: flags.joFlag }),
    new Currency({ name: 'JPY', img: flags.jpFlag }),
    new Currency({ name: 'KES', img: flags.keFlag }),
    new Currency({ name: 'KGS', img: flags.kgFlag }),
    new Currency({ name: 'KHR', img: flags.khFlag }),
    new Currency({ name: 'KMF', img: flags.kmFlag }),
    new Currency({ name: 'KPW', img: flags.kpFlag }),
    new Currency({ name: 'KRW', img: flags.krFlag }),
    new Currency({ name: 'KWD', img: flags.kwFlag }),
    new Currency({ name: 'KYD', img: flags.kyFlag }),
    new Currency({ name: 'KZT', img: flags.kzFlag }),
    new Currency({ name: 'LAK', img: flags.laFlag }),
    new Currency({ name: 'LBP', img: flags.lbFlag }),
    new Currency({ name: 'LKR', img: flags.lkFlag }),
    new Currency({ name: 'LRD', img: flags.lrFlag }),
    new Currency({ name: 'LSL', img: flags.lsFlag }),
    //new Currency({ name: 'LTL', img: flags }),
    //new Currency({ name: 'LVL', img: flags }),
    new Currency({ name: 'LYD', img: flags.lyFlag }),
    new Currency({ name: 'MAD', img: flags.ehFlag }),
    new Currency({ name: 'MDL', img: flags.mdFlag }),
    new Currency({ name: 'MGA', img: flags.mgFlag }),
    new Currency({ name: 'MKD', img: flags.mkFlag }),
    new Currency({ name: 'MMK', img: flags.mmFlag }),
    new Currency({ name: 'MNT', img: flags.mnFlag }),
    new Currency({ name: 'MOP', img: flags.moFlag }),
    //new Currency({ name: 'MRO', img: flags }),
    new Currency({ name: 'MUR', img: flags.muFlag }),
    new Currency({ name: 'MVR', img: flags.mvFlag }),
    new Currency({ name: 'MWK', img: flags.mwFlag }),
    new Currency({ name: 'MXN', img: flags.mxFlag }),
    new Currency({ name: 'MYR', img: flags.myFlag }),
    new Currency({ name: 'MZN', img: flags.mzFlag }),
    new Currency({ name: 'NAD', img: flags.naFlag }),
    new Currency({ name: 'NGN', img: flags.ngFlag }),
    new Currency({ name: 'NIO', img: flags.niFlag }),
    new Currency({ name: 'NOK', img: flags.noFlag }),
    new Currency({ name: 'NPR', img: flags.npFlag }),
    new Currency({ name: 'NZD', img: flags.nzFlag }),
    new Currency({ name: 'OMR', img: flags.omFlag }),
    new Currency({ name: 'PAB', img: flags.paFlag }),
    new Currency({ name: 'PEN', img: flags.peFlag }),
    new Currency({ name: 'PGK', img: flags.pgFlag }),
    new Currency({ name: 'PHP', img: flags.phFlag }),
    new Currency({ name: 'PKR', img: flags.pkFlag }),
    new Currency({ name: 'PLN', img: flags.plFlag }),
    new Currency({ name: 'PYG', img: flags.pyFlag }),
    new Currency({ name: 'QAR', img: flags.qaFlag }),
    new Currency({ name: 'RON', img: flags.roFlag }),
    new Currency({ name: 'RSD', img: flags.rsFlag }),
    new Currency({ name: 'RUB', img: flags.ruFlag }),
    new Currency({ name: 'RWF', img: flags.rwFlag }),
    new Currency({ name: 'SAR', img: flags.saFlag }),
    new Currency({ name: 'SBD', img: flags.sbFlag }),
    new Currency({ name: 'SCR', img: flags.scFlag }),
    new Currency({ name: 'SDG', img: flags.sdFlag }),
    new Currency({ name: 'SEK', img: flags.seFlag }),
    new Currency({ name: 'SGD', img: flags.sgFlag }),
    new Currency({ name: 'SHP', img: flags.gpFlag }),
    new Currency({ name: 'SLL', img: flags.slFlag }),
    new Currency({ name: 'SOS', img: flags.soFlag }),
    new Currency({ name: 'SRD', img: flags.srFlag }),
    //new Currency({ name: 'STD', img: flags.st }),
    new Currency({ name: 'SVC', img: flags.svFlag }),
    new Currency({ name: 'SYP', img: flags.syFlag }),
    new Currency({ name: 'SZL', img: flags.szFlag }),
    new Currency({ name: 'THB', img: flags.thFlag }),
    new Currency({ name: 'TJS', img: flags.tjFlag }),
    new Currency({ name: 'TMT', img: flags.tmFlag }),
    new Currency({ name: 'TND', img: flags.tnFlag }),
    new Currency({ name: 'TOP', img: flags.toFlag }),
    new Currency({ name: 'TRY', img: flags.trFlag }),
    new Currency({ name: 'TTD', img: flags.ttFlag }),
    new Currency({ name: 'TWD', img: flags.twFlag }),
    new Currency({ name: 'TZS', img: flags.tzFlag }),
    new Currency({ name: 'UAH', img: flags.uaFlag }),
    new Currency({ name: 'UGX', img: flags.ugFlag }),
    new Currency({ name: 'UYU', img: flags.uyFlag }),
    new Currency({ name: 'UZS', img: flags.uzFlag }),
    //new Currency({ name: 'VEF', img: flags }),
    new Currency({ name: 'VND', img: flags.vnFlag }),
    new Currency({ name: 'VUV', img: flags.vuFlag }),
    new Currency({ name: 'WST', img: flags.wsFlag }),
    new Currency({ name: 'XAF', img: flags.cfFlag }),
    //new Currency({ name: 'XAG', img: flags }),
    //new Currency({ name: 'XAU', img: flags }),
    new Currency({ name: 'XCD', img: flags.dmFlag }),
    //new Currency({ name: 'XDR', img: flags }),
    new Currency({ name: 'XOF', img: flags.ciFlag }),
    new Currency({ name: 'XPF', img: flags.wfFlag }),
    new Currency({ name: 'YER', img: flags.yeFlag }),
    new Currency({ name: 'ZAR', img: flags.zaFlag }),
    //new Currency({ name: 'ZMK', img: flags }),
    new Currency({ name: 'ZMW', img: flags.zmFlag }),
    new Currency({ name: 'ZWL', img: flags.zwFlag })
  ].sort((a, b) => {
    if (a.name > b.name) return 1;
    if (a.name < b.name) return -1;
    return 0;
  })
];
<commit_msg>devop: 🔧 updated list<commit_after>import flags from './flags';

import btcIcon from '@/assets/images/currencies/btc.png';
class Currency {
  /**
   * @param {Object} currency
   * @param {string} currency.name - Curreny Name
   * @param {string} currency.value - Defaults to Curreny Name
   * @param {string} currency.img - Path to Icon
   */
  constructor({ name, value = name, img }) {
    this.name = name;
    this.value = value;
    this.img = img;
  }
}
/**
 * Returns array of Currency values with icons
 */
export default [
  /**
   * Unsorted currencies go here
   */
  new Currency({ name: 'USD', img: flags.usFlag }),
  ...[
    new Currency({ name: 'AED', img: flags.aeFlag }),
    new Currency({ name: 'AFN', img: flags.afFlag }),
    new Currency({ name: 'ALL', img: flags.alFlag }),
    new Currency({ name: 'AMD', img: flags.amFlag }),
    new Currency({ name: 'ANG', img: flags.sxFlag }),
    new Currency({ name: 'AOA', img: flags.aoFlag }),
    new Currency({ name: 'ARS', img: flags.arFlag }),
    new Currency({ name: 'AUD', img: flags.auFlag }),
    new Currency({ name: 'AWG', img: flags.awFlag }),
    new Currency({ name: 'AZN', img: flags.azFlag }),
    new Currency({ name: 'BAM', img: flags.baFlag }),
    new Currency({ name: 'BBD', img: flags.bbFlag }),
    new Currency({ name: 'BDT', img: flags.bdFlag }),
    new Currency({ name: 'BGN', img: flags.bgFlag }),
    new Currency({ name: 'BHD', img: flags.bhFlag }),
    new Currency({ name: 'BIF', img: flags.biFlag }),
    new Currency({ name: 'BMD', img: flags.bmFlag }),
    new Currency({ name: 'BND', img: flags.bnFlag }),
    new Currency({ name: 'BOB', img: flags.boFlag }),
    new Currency({ name: 'BRL', img: flags.brFlag }),
    new Currency({ name: 'BSD', img: flags.bsFlag }),
    //bitcoin?
    new Currency({ name: 'BTC', img: btcIcon }),
    new Currency({ name: 'BTN', img: flags.btFlag }),
    new Currency({ name: 'BWP', img: flags.bwFlag }),
    new Currency({ name: 'BYN', img: flags.byFlag }),
    new Currency({ name: 'BYR', img: flags.byFlag }),
    new Currency({ name: 'BZD', img: flags.bzFlag }),
    new Currency({ name: 'CAD', img: flags.caFlag }),
    new Currency({ name: 'CDF', img: flags.cdFlag }),
    new Currency({ name: 'CHF', img: flags.liFlag }),
    new Currency({ name: 'CLF', img: flags.clFlag }),
    new Currency({ name: 'CLP', img: flags.clFlag }),
    new Currency({ name: 'CNY', img: flags.cnFlag }),
    new Currency({ name: 'COP', img: flags.coFlag }),
    new Currency({ name: 'CRC', img: flags.crFlag }),
    new Currency({ name: 'CUC', img: flags.cuFlag }),
    new Currency({ name: 'CUP', img: flags.cuFlag }),
    new Currency({ name: 'CVE', img: flags.cvFlag }),
    new Currency({ name: 'CZK', img: flags.czFlag }),
    new Currency({ name: 'DJF', img: flags.djFlag }),
    new Currency({ name: 'DKK', img: flags.dkFlag }),
    new Currency({ name: 'DOP', img: flags.doFlag }),
    new Currency({ name: 'DZD', img: flags.dzFlag }),
    new Currency({ name: 'EGP', img: flags.egFlag }),
    new Currency({ name: 'ERN', img: flags.erFlag }),
    new Currency({ name: 'ETB', img: flags.etFlag }),
    new Currency({ name: 'EUR', img: flags.europeanUnFlag }),
    new Currency({ name: 'FJD', img: flags.fjFlag }),
    new Currency({ name: 'FKP', img: flags.fkFlag }),
    new Currency({ name: 'GBP', img: flags.gbFlag }),
    new Currency({ name: 'GEL', img: flags.geFlag }),
    new Currency({ name: 'GGP', img: flags.gpFlag }),
    new Currency({ name: 'GHS', img: flags.ghFlag }),
    new Currency({ name: 'GIP', img: flags.giFlag }),
    new Currency({ name: 'GMD', img: flags.gmFlag }),
    new Currency({ name: 'GNF', img: flags.gnFlag }),
    new Currency({ name: 'GTQ', img: flags.gtFlag }),
    new Currency({ name: 'GYD', img: flags.gyFlag }),
    new Currency({ name: 'HKD', img: flags.hkFlag }),
    new Currency({ name: 'HNL', img: flags.hnFlag }),
    new Currency({ name: 'HRK', img: flags.hrFlag }),
    new Currency({ name: 'HTG', img: flags.htFlag }),
    new Currency({ name: 'HUF', img: flags.huFlag }),
    new Currency({ name: 'IDR', img: flags.idFlag }),
    new Currency({ name: 'ILS', img: flags.ilFlag }),
    new Currency({ name: 'IMP', img: flags.imFlag }),
    new Currency({ name: 'INR', img: flags.btFlag }),
    new Currency({ name: 'IQD', img: flags.iqFlag }),
    new Currency({ name: 'IRR', img: flags.irFlag }),
    new Currency({ name: 'ISK', img: flags.isFlag }),
    new Currency({ name: 'JEP', img: flags.jeFlag }),
    new Currency({ name: 'JMD', img: flags.jmFlag }),
    new Currency({ name: 'JOD', img: flags.joFlag }),
    new Currency({ name: 'JPY', img: flags.jpFlag }),
    new Currency({ name: 'KES', img: flags.keFlag }),
    new Currency({ name: 'KGS', img: flags.kgFlag }),
    new Currency({ name: 'KHR', img: flags.khFlag }),
    new Currency({ name: 'KMF', img: flags.kmFlag }),
    new Currency({ name: 'KPW', img: flags.kpFlag }),
    new Currency({ name: 'KRW', img: flags.krFlag }),
    new Currency({ name: 'KWD', img: flags.kwFlag }),
    new Currency({ name: 'KYD', img: flags.kyFlag }),
    new Currency({ name: 'KZT', img: flags.kzFlag }),
    new Currency({ name: 'LAK', img: flags.laFlag }),
    new Currency({ name: 'LBP', img: flags.lbFlag }),
    new Currency({ name: 'LKR', img: flags.lkFlag }),
    new Currency({ name: 'LRD', img: flags.lrFlag }),
    new Currency({ name: 'LSL', img: flags.lsFlag }),
    new Currency({ name: 'LTL', img: flags.ltFlag }),
    new Currency({ name: 'LVL', img: flags.lvFlag }),
    new Currency({ name: 'LYD', img: flags.lyFlag }),
    new Currency({ name: 'MAD', img: flags.ehFlag }),
    new Currency({ name: 'MDL', img: flags.mdFlag }),
    new Currency({ name: 'MGA', img: flags.mgFlag }),
    new Currency({ name: 'MKD', img: flags.mkFlag }),
    new Currency({ name: 'MMK', img: flags.mmFlag }),
    new Currency({ name: 'MNT', img: flags.mnFlag }),
    new Currency({ name: 'MOP', img: flags.moFlag }),
    new Currency({ name: 'MRO', img: flags.mrFlag }),
    new Currency({ name: 'MUR', img: flags.muFlag }),
    new Currency({ name: 'MVR', img: flags.mvFlag }),
    new Currency({ name: 'MWK', img: flags.mwFlag }),
    new Currency({ name: 'MXN', img: flags.mxFlag }),
    new Currency({ name: 'MYR', img: flags.myFlag }),
    new Currency({ name: 'MZN', img: flags.mzFlag }),
    new Currency({ name: 'NAD', img: flags.naFlag }),
    new Currency({ name: 'NGN', img: flags.ngFlag }),
    new Currency({ name: 'NIO', img: flags.niFlag }),
    new Currency({ name: 'NOK', img: flags.noFlag }),
    new Currency({ name: 'NPR', img: flags.npFlag }),
    new Currency({ name: 'NZD', img: flags.nzFlag }),
    new Currency({ name: 'OMR', img: flags.omFlag }),
    new Currency({ name: 'PAB', img: flags.paFlag }),
    new Currency({ name: 'PEN', img: flags.peFlag }),
    new Currency({ name: 'PGK', img: flags.pgFlag }),
    new Currency({ name: 'PHP', img: flags.phFlag }),
    new Currency({ name: 'PKR', img: flags.pkFlag }),
    new Currency({ name: 'PLN', img: flags.plFlag }),
    new Currency({ name: 'PYG', img: flags.pyFlag }),
    new Currency({ name: 'QAR', img: flags.qaFlag }),
    new Currency({ name: 'RON', img: flags.roFlag }),
    new Currency({ name: 'RSD', img: flags.rsFlag }),
    new Currency({ name: 'RUB', img: flags.ruFlag }),
    new Currency({ name: 'RWF', img: flags.rwFlag }),
    new Currency({ name: 'SAR', img: flags.saFlag }),
    new Currency({ name: 'SBD', img: flags.sbFlag }),
    new Currency({ name: 'SCR', img: flags.scFlag }),
    new Currency({ name: 'SDG', img: flags.sdFlag }),
    new Currency({ name: 'SEK', img: flags.seFlag }),
    new Currency({ name: 'SGD', img: flags.sgFlag }),
    new Currency({ name: 'SHP', img: flags.gpFlag }),
    new Currency({ name: 'SLL', img: flags.slFlag }),
    new Currency({ name: 'SOS', img: flags.soFlag }),
    new Currency({ name: 'SRD', img: flags.srFlag }),
    new Currency({ name: 'STD', img: flags.stFlag }),
    new Currency({ name: 'SVC', img: flags.svFlag }),
    new Currency({ name: 'SYP', img: flags.syFlag }),
    new Currency({ name: 'SZL', img: flags.szFlag }),
    new Currency({ name: 'THB', img: flags.thFlag }),
    new Currency({ name: 'TJS', img: flags.tjFlag }),
    new Currency({ name: 'TMT', img: flags.tmFlag }),
    new Currency({ name: 'TND', img: flags.tnFlag }),
    new Currency({ name: 'TOP', img: flags.toFlag }),
    new Currency({ name: 'TRY', img: flags.trFlag }),
    new Currency({ name: 'TTD', img: flags.ttFlag }),
    new Currency({ name: 'TWD', img: flags.twFlag }),
    new Currency({ name: 'TZS', img: flags.tzFlag }),
    new Currency({ name: 'UAH', img: flags.uaFlag }),
    new Currency({ name: 'UGX', img: flags.ugFlag }),
    new Currency({ name: 'UYU', img: flags.uyFlag }),
    new Currency({ name: 'UZS', img: flags.uzFlag }),
    new Currency({ name: 'VEF', img: flags.veFlag }),
    new Currency({ name: 'VND', img: flags.vnFlag }),
    new Currency({ name: 'VUV', img: flags.vuFlag }),
    new Currency({ name: 'WST', img: flags.wsFlag }),
    new Currency({ name: 'XAF', img: flags.cfFlag }),
    //silver
    //new Currency({ name: 'XAG', img: flags }),
    //gold
    //new Currency({ name: 'XAU', img: flags }),
    new Currency({ name: 'XCD', img: flags.dmFlag }),
    //exchange currency?
    new Currency({ name: 'XDR', img: flags.usFlag }),
    new Currency({ name: 'XOF', img: flags.ciFlag }),
    new Currency({ name: 'XPF', img: flags.wfFlag }),
    new Currency({ name: 'YER', img: flags.yeFlag }),
    new Currency({ name: 'ZAR', img: flags.zaFlag }),
    new Currency({ name: 'ZMK', img: flags.zmFlag }),
    new Currency({ name: 'ZMW', img: flags.zmFlag }),
    new Currency({ name: 'ZWL', img: flags.zwFlag })
  ].sort((a, b) => {
    if (a.name > b.name) return 1;
    if (a.name < b.name) return -1;
    return 0;
  })
];
<|endoftext|>


<commit_before>var alloc_http_request = new Array();

function makeAjaxRequest(url,entityid,extra_fields) {
  $("#"+entityid).html('');
  jQuery.get(url,extra_fields,function(data) {
    $("#"+entityid).hide();
    $("#"+entityid).html(data);
    $("#"+entityid).fadeIn("fast");
  })
}

// This is a generic show/hide for anything
function set_grow_shrink(id, id_to_hide, use_classes_instead_of_ids) {
  // toggle the other div - if any
  if (use_classes_instead_of_ids && id_to_hide) {
    $("."+id_to_hide).slideToggle("fast");
  } else if (id_to_hide) {
    $("#"+id_to_hide).slideToggle("fast");
  }
  // hide or show the actual div
  if (use_classes_instead_of_ids) {
    $("."+id).slideToggle("fast");
  } else {
    $("#"+id).slideToggle("fast");
  }
  return false;
}

function sidebyside_activate(id,arr) {
  if (id == "sbsAll") {
    for (var i=0; i<arr.length; i++) {
      if (arr[i] != "sbsAll") {
        //$("#"+arr[i]).show(); konqueror doesn't like this
        document.getElementById(arr[i]).style.display = 'inline';
        $('#sbs_link_'+arr[i]).removeClass("sidebyside_active").addClass("sidebyside");
      }
    }
    $('#sbs_link_' + id).addClass("sidebyside_active");

  } else {
    for (var i=0; i<arr.length; i++) {
      if (arr[i] != "sbsAll") {
        //$("#"+arr[i]).hide();  konqueror doesn't like this
        document.getElementById(arr[i]).style.display = 'none';
      }
      $('#sbs_link_' + arr[i]).removeClass("sidebyside_active").addClass("sidebyside");
    }
    $('#sbs_link_' + id).addClass("sidebyside_active");
    //$("#"+id).show(); konqueror doesn't like this
    document.getElementById(id).style.display = 'inline';
  }
}

function help_text_on(id, str) {
  $('#main').append("

");
  $('#helper').hide().html(str).corner();

  offset = $('#'+id).offset();

  x = offset.left -400;
  if (x < 0) {
    x = x + 380;
  }
  $("#helper").css('left',x);

  y = offset.top - 50;
  if (y > 350) {
    y = y-$('#helper').height() -40;
  }

  $("#helper").css('top',y);
  $("#helper").fadeIn("normal");
}
function help_text_off(id) {
  $("#helper").fadeOut("normal");
  $('#helper').remove();
}
function preload_field(element, text) {
  $(element).bind("focus", function(e){
    if (this.value == text) {
      this.style.color = "#333333";
      this.value = "";
    }
  });
  $(element).each(function(){
    if (this.value == "") {
      this.style.color = "#bbbbbb";
      this.value = text;
    }
  });
  $('form').submit(function(){
    $(element).each(function(){
      if (this.value == text) {
        this.value = "";
      }
    });
  });
}

// Preload mouseover images
if (document.images) {
  pic1= new Image(9,11);
  pic1.src="../images/arrow_blank.gif";
  pic2= new Image(9,11);
  pic2.src="../images/arrow_faded.gif";
  pic3= new Image(9,11);
  pic3.src="../images/arrow_down.gif";
  pic4= new Image(9,11);
  pic4.src="../images/arrow_up.gif";
  pic5= new Image(119,13);
  pic5.src="../images/ticker2.gif";
}

// When the document has loaded...
$(document).ready(function() {
  // Give the tables alternating stripes
  $(".list tr:nth-child(even)").addClass("even");
  $(".list tr:nth-child(odd)").addClass("odd");
  $(".corner").corner();
  $(".delete_button").bind("click", function(e){
    return confirm("Click OK to confirm deletion.");
  });
  $(".confirm_button").bind("click", function(e){
    return confirm("Click OK to confirm.");
  });
  $("input.datefield").bind("dblclick", function(e){
    var now = new Date();
    this.value=now.getFullYear()+'-'+(now.getMonth()+1)+'-'+now.getDate();
  });

  $('tr.clickrow').bind('click',function(e){
    var id = this.id.split('_')[1]; // clickrow_43242
    if (id && !$(e.target).is('input:checkbox') && !$(e.target).is('a')) {
      $('#checkbox_'+id).attr('checked',!$('#checkbox_'+id).attr('checked'));
    }
  });

  // This loads up certain textboxes with faint help text that vanishes upon focus
  preload_field("#menu_form_needle", "Enter Search...");
  preload_field("input.datefield", "YYYY-MM-DD");

  // Add resize grippies to all textareas
  $('textarea:not(.processed)').TextAreaResizer();

});

<commit_msg>Removed unused javascript variable.<commit_after>function makeAjaxRequest(url,entityid,extra_fields) {
  $("#"+entityid).html('');
  jQuery.get(url,extra_fields,function(data) {
    $("#"+entityid).hide();
    $("#"+entityid).html(data);
    $("#"+entityid).fadeIn("fast");
  })
}

// This is a generic show/hide for anything
function set_grow_shrink(id, id_to_hide, use_classes_instead_of_ids) {
  // toggle the other div - if any
  if (use_classes_instead_of_ids && id_to_hide) {
    $("."+id_to_hide).slideToggle("fast");
  } else if (id_to_hide) {
    $("#"+id_to_hide).slideToggle("fast");
  }
  // hide or show the actual div
  if (use_classes_instead_of_ids) {
    $("."+id).slideToggle("fast");
  } else {
    $("#"+id).slideToggle("fast");
  }
  return false;
}

function sidebyside_activate(id,arr) {
  if (id == "sbsAll") {
    for (var i=0; i<arr.length; i++) {
      if (arr[i] != "sbsAll") {
        //$("#"+arr[i]).show(); konqueror doesn't like this
        document.getElementById(arr[i]).style.display = 'inline';
        $('#sbs_link_'+arr[i]).removeClass("sidebyside_active").addClass("sidebyside");
      }
    }
    $('#sbs_link_' + id).addClass("sidebyside_active");

  } else {
    for (var i=0; i<arr.length; i++) {
      if (arr[i] != "sbsAll") {
        //$("#"+arr[i]).hide();  konqueror doesn't like this
        document.getElementById(arr[i]).style.display = 'none';
      }
      $('#sbs_link_' + arr[i]).removeClass("sidebyside_active").addClass("sidebyside");
    }
    $('#sbs_link_' + id).addClass("sidebyside_active");
    //$("#"+id).show(); konqueror doesn't like this
    document.getElementById(id).style.display = 'inline';
  }
}

function help_text_on(id, str) {
  $('#main').append("

");
  $('#helper').hide().html(str).corner();

  offset = $('#'+id).offset();

  x = offset.left -400;
  if (x < 0) {
    x = x + 380;
  }
  $("#helper").css('left',x);

  y = offset.top - 50;
  if (y > 350) {
    y = y-$('#helper').height() -40;
  }

  $("#helper").css('top',y);
  $("#helper").fadeIn("normal");
}
function help_text_off(id) {
  $("#helper").fadeOut("normal");
  $('#helper').remove();
}
function preload_field(element, text) {
  $(element).bind("focus", function(e){
    if (this.value == text) {
      this.style.color = "#333333";
      this.value = "";
    }
  });
  $(element).each(function(){
    if (this.value == "") {
      this.style.color = "#bbbbbb";
      this.value = text;
    }
  });
  $('form').submit(function(){
    $(element).each(function(){
      if (this.value == text) {
        this.value = "";
      }
    });
  });
}

// Preload mouseover images
if (document.images) {
  pic1= new Image(9,11);
  pic1.src="../images/arrow_blank.gif";
  pic2= new Image(9,11);
  pic2.src="../images/arrow_faded.gif";
  pic3= new Image(9,11);
  pic3.src="../images/arrow_down.gif";
  pic4= new Image(9,11);
  pic4.src="../images/arrow_up.gif";
  pic5= new Image(119,13);
  pic5.src="../images/ticker2.gif";
}

// When the document has loaded...
$(document).ready(function() {
  // Give the tables alternating stripes
  $(".list tr:nth-child(even)").addClass("even");
  $(".list tr:nth-child(odd)").addClass("odd");
  $(".corner").corner();
  $(".delete_button").bind("click", function(e){
    return confirm("Click OK to confirm deletion.");
  });
  $(".confirm_button").bind("click", function(e){
    return confirm("Click OK to confirm.");
  });
  $("input.datefield").bind("dblclick", function(e){
    var now = new Date();
    this.value=now.getFullYear()+'-'+(now.getMonth()+1)+'-'+now.getDate();
  });

  $('tr.clickrow').bind('click',function(e){
    var id = this.id.split('_')[1]; // clickrow_43242
    if (id && !$(e.target).is('input:checkbox') && !$(e.target).is('a')) {
      $('#checkbox_'+id).attr('checked',!$('#checkbox_'+id).attr('checked'));
    }
  });

  // This loads up certain textboxes with faint help text that vanishes upon focus
  preload_field("#menu_form_needle", "Enter Search...");
  preload_field("input.datefield", "YYYY-MM-DD");

  // Add resize grippies to all textareas
  $('textarea:not(.processed)').TextAreaResizer();

});

<|endoftext|>


<commit_before>     /* Playa written by Evan Short 2009 */

/* available at http://github.com/whtevn/playa */

/* distributed under the mit standard license  */

/************ Sharing is caring ****************/
//                                             //
// if you have changes to make to this project //
//    fork it on github,                       //
//        and the whole world will love you    //
//                            forever and ever.//
//                                             //
/***********************************************/

var Playa =
  {
    init: function(name){
      var instance =
        {
          name: "",
          playlist:{},
          currentTrack: 0,
          totalTracks: 0,
          playhead: 0,
          playing: false,
          id3Info: {},
          trackTime: 0,
          setTrackTime: function(time) { this.trackTime = time; },
          setPlayState: function(state){ this.playing = state; },
          setPlayhead: function(time){ this.playhead = time; },
          updatePlayhead: function() { this.setPlayhead(this.app.playheadPosition()); },
          setCurrentTrack: function(track){
            if(!track)
              track = this.currentTrack;

            var playa = this;
            this.currentTrack = track;
            $("#"+this.name +" .track").each(function(i){
              var active_track = (i == playa.currentTrack)
              if(active_track){
                $(this).addClass("active");
              }else{
                $(this).removeClass("active");
              }
              play.doOnActivateTrack(this, active_track);
            })
          },
          gotoNext: function(){
            this.setPlayhead(0)

            if(this.currentTrack != this.totalTracks-1)
              this.setCurrentTrack(this.currentTrack += 1);

            return(this.currentTrack);
          },
          gotoPrevious: function(){
            this.setPlayhead(0)

            if(this.currentTrack != 0)
              this.setCurrentTrack(this.currentTrack -= 1);

            return(this.currentTrack);
          },
          playNext: function(){
            this.stop();
            if(this.currentTrack != this.gotoNext()){
              this.play();
              this.doOnPlayNext();
            }
          },
          playPrevious: function(){
            this.stop();
            if(this.currentTrac != this.gotoPrevious()){
               this.play();
               this.doOnPlayPrevious();
            }
          },
          currentTrackUrl: function(){
            var item = this.playlist[this.currentTrack];

            if(typeof item != 'string')
              { item = item.url };

            return(item);
          },
          play: function(url, time){
            if(!url)
              url = this.currentTrackUrl();

            if(!time)
              time = this.playhead

            if(this.playing == false){
              this.setCurrentTrack()
              if(this.app.play(this.name, url, time)==true){
                this.doOnPlay();
                this.startDoingWhilePlaying();
              }
            }
          },
          pause: function(){
            if(this.playing==true && this.app.pause(this.name)==true){
              this.doOnPause();
              this.stopDoingWhilePlaying();
            }
          },
          stop: function(){
            if(this.app.stop(this.name)==true){
              this.stopDoingWhilePlaying();
            }
            this.doOnStop();
          },
          playIntervalId: '',
          playheadUpdater: function(){
            /*
             * setInterval re-scopes everything to window
             * Playa only has a .current because of that
             * it is very disspointing to me that these
             * functions have to be called this way.
             * very dissapointing, indeed.
             */
            Playa.current.updatePlayhead();
            Playa.current.doWhilePlaying();
          },
          doOnPlay: function(){},
          doOnPause: function(){},
          doOnStop: function(){
            this.updateDisplay("0/"+(this.trackTime/1000).toFixed(0));
          },
          doOnPlayNext: function(){},
          doOnPlayPrevious: function(){},
          doOnActivateTrack: function(element, active){},
          doWhilePlaying: function(){
            var playheadDisplay = (this.playhead/1000)
            playheadDisplay = playheadDisplay.toFixed(0)
            playheadDisplay = playheadDisplay +"/"+(this.trackTime/1000).toFixed(0);
            this.updateDisplay(playheadDisplay);
          },
          startDoingWhilePlaying: function(){
            this.playIntervalId = setInterval(this.playheadUpdater, 100);
          },
          stopDoingWhilePlaying: function(){
            clearInterval(this.playIntervalId);
          },
          updateDisplay: function(text){
            $("#"+this.name +" .display").each(function(i){
              $(this).text(text);
            })
          }

        };
      instance.name = name;
      return(instance);
    },

    setup: function(name, playlist) {
      if(typeof playlist == "string")
        playlist = eval('('+playlist+')');

      instance = Playa.init(name);
      instance.playlist = playlist;
      instance.totalTracks = Playa.countTracks(playlist);
      instance.setCurrentTrack(0);
      instance['app'] = FlashInterface.get('Playa');
      Playa.add(name, instance);

      return(instance)
    },

    countTracks: function(playlist){ return(playlist.length) },
    add: function(name, instance) { this.get[name] = instance; },
    get: {},
    current: {},
    setCurrent: function(name){ this.current = this.get[name]; }
  };

$(document).ready(function(){
  $(".playa").each(function(i){
    var element = this;
    var playa;
    $(this).find(".playlist").each(function(){
      if(!this.value){
        var playlist = []
        $(this).find(".track").each(function(i){
          var href
          if(!this.href){
            $(this).find("a").each(function(i){
              if(i==0)
                href = this.href
            });
          }else{
            href = this.href;
          }
          playlist.push(href)
        });
        playa = Playa.setup(element.id, playlist);
          $(this).find(".track").each(function(i){
            $(this).bind("click", function(e){
              playa.stop();
              playa.currentTrack = i;
              playa.play(this.href);
              e.preventDefault()
            });
        });
      }else{
        playa = Playa.setup(element.id, this.value);
      }
    });
    $(this).find(".display").each(function(){
      playa["display"] = this;
    });
    $(this).find(".play").each(function(){
      $(this).bind("click", function(e){
        playa.play();
      });
    });
    $(this).find(".pause").each(function(){
      $(this).bind("click", function(e){
        playa.pause();
      });
    });
    $(this).find(".stop").each(function(){
      $(this).bind("click", function(e){
        playa.stop();
      });
    });
    $(this).find(".next").each(function(){
      $(this).bind("click", function(e){
        if(playa.playing==true){
          playa.playNext();
        }else{
          playa.gotoNext();
        }
      });
    });
    $(this).find(".previous").each(function(){
      $(this).bind("click", function(e){
        if(playa.playing==true){
          playa.playPrevious();
        }else{
          playa.gotoPrevious();
        }
      });
    });
  });
  FlashInterface.pageInit();
});

<commit_msg>fixing variable mis-naming<commit_after>     /* Playa written by Evan Short 2009 */

/* available at http://github.com/whtevn/playa */

/* distributed under the mit standard license  */

/************ Sharing is caring ****************/
//                                             //
// if you have changes to make to this project //
//    fork it on github,                       //
//        and the whole world will love you    //
//                            forever and ever.//
//                                             //
/***********************************************/

var Playa =
  {
    init: function(name){
      var instance =
        {
          name: "",
          playlist:{},
          currentTrack: 0,
          totalTracks: 0,
          playhead: 0,
          playing: false,
          id3Info: {},
          trackTime: 0,
          setTrackTime: function(time) { this.trackTime = time; },
          setPlayState: function(state){ this.playing = state; },
          setPlayhead: function(time){ this.playhead = time; },
          updatePlayhead: function() { this.setPlayhead(this.app.playheadPosition()); },
          setCurrentTrack: function(track){
            if(!track)
              track = this.currentTrack;

            var playa = this;
            this.currentTrack = track;
            $("#"+this.name +" .track").each(function(i){
              var active_track = (i == playa.currentTrack)
              if(active_track){
                $(this).addClass("active");
              }else{
                $(this).removeClass("active");
              }
              playa.doOnActivateTrack(this, active_track);
            })
          },
          gotoNext: function(){
            this.setPlayhead(0)

            if(this.currentTrack != this.totalTracks-1)
              this.setCurrentTrack(this.currentTrack += 1);

            return(this.currentTrack);
          },
          gotoPrevious: function(){
            this.setPlayhead(0)

            if(this.currentTrack != 0)
              this.setCurrentTrack(this.currentTrack -= 1);

            return(this.currentTrack);
          },
          playNext: function(){
            this.stop();
            if(this.currentTrack != this.gotoNext()){
              this.play();
              this.doOnPlayNext();
            }
          },
          playPrevious: function(){
            this.stop();
            if(this.currentTrac != this.gotoPrevious()){
               this.play();
               this.doOnPlayPrevious();
            }
          },
          currentTrackUrl: function(){
            var item = this.playlist[this.currentTrack];

            if(typeof item != 'string')
              { item = item.url };

            return(item);
          },
          play: function(url, time){
            if(!url)
              url = this.currentTrackUrl();

            if(!time)
              time = this.playhead

            if(this.playing == false){
              this.setCurrentTrack()
              if(this.app.play(this.name, url, time)==true){
                this.doOnPlay();
                this.startDoingWhilePlaying();
              }
            }
          },
          pause: function(){
            if(this.playing==true && this.app.pause(this.name)==true){
              this.doOnPause();
              this.stopDoingWhilePlaying();
            }
          },
          stop: function(){
            if(this.app.stop(this.name)==true){
              this.stopDoingWhilePlaying();
            }
            this.doOnStop();
          },
          playIntervalId: '',
          playheadUpdater: function(){
            /*
             * setInterval re-scopes everything to window
             * Playa only has a .current because of that
             * it is very disspointing to me that these
             * functions have to be called this way.
             * very dissapointing, indeed.
             */
            Playa.current.updatePlayhead();
            Playa.current.doWhilePlaying();
          },
          doOnPlay: function(){},
          doOnPause: function(){},
          doOnStop: function(){
            this.updateDisplay("0/"+(this.trackTime/1000).toFixed(0));
          },
          doOnPlayNext: function(){},
          doOnPlayPrevious: function(){},
          doOnActivateTrack: function(element, active){},
          doWhilePlaying: function(){
            var playheadDisplay = (this.playhead/1000)
            playheadDisplay = playheadDisplay.toFixed(0)
            playheadDisplay = playheadDisplay +"/"+(this.trackTime/1000).toFixed(0);
            this.updateDisplay(playheadDisplay);
          },
          startDoingWhilePlaying: function(){
            this.playIntervalId = setInterval(this.playheadUpdater, 100);
          },
          stopDoingWhilePlaying: function(){
            clearInterval(this.playIntervalId);
          },
          updateDisplay: function(text){
            $("#"+this.name +" .display").each(function(i){
              $(this).text(text);
            })
          }

        };
      instance.name = name;
      return(instance);
    },

    setup: function(name, playlist) {
      if(typeof playlist == "string")
        playlist = eval('('+playlist+')');

      instance = Playa.init(name);
      instance.playlist = playlist;
      instance.totalTracks = Playa.countTracks(playlist);
      instance.setCurrentTrack(0);
      instance['app'] = FlashInterface.get('Playa');
      Playa.add(name, instance);

      return(instance)
    },

    countTracks: function(playlist){ return(playlist.length) },
    add: function(name, instance) { this.get[name] = instance; },
    get: {},
    current: {},
    setCurrent: function(name){ this.current = this.get[name]; }
  };

$(document).ready(function(){
  $(".playa").each(function(i){
    var element = this;
    var playa;
    $(this).find(".playlist").each(function(){
      if(!this.value){
        var playlist = []
        $(this).find(".track").each(function(i){
          var href
          if(!this.href){
            $(this).find("a").each(function(i){
              if(i==0)
                href = this.href
            });
          }else{
            href = this.href;
          }
          playlist.push(href)
        });
        playa = Playa.setup(element.id, playlist);
          $(this).find(".track").each(function(i){
            $(this).bind("click", function(e){
              playa.stop();
              playa.currentTrack = i;
              playa.play(this.href);
              e.preventDefault()
            });
        });
      }else{
        playa = Playa.setup(element.id, this.value);
      }
    });
    $(this).find(".display").each(function(){
      playa["display"] = this;
    });
    $(this).find(".play").each(function(){
      $(this).bind("click", function(e){
        playa.play();
      });
    });
    $(this).find(".pause").each(function(){
      $(this).bind("click", function(e){
        playa.pause();
      });
    });
    $(this).find(".stop").each(function(){
      $(this).bind("click", function(e){
        playa.stop();
      });
    });
    $(this).find(".next").each(function(){
      $(this).bind("click", function(e){
        if(playa.playing==true){
          playa.playNext();
        }else{
          playa.gotoNext();
        }
      });
    });
    $(this).find(".previous").each(function(){
      $(this).bind("click", function(e){
        if(playa.playing==true){
          playa.playPrevious();
        }else{
          playa.gotoPrevious();
        }
      });
    });
  });
  FlashInterface.pageInit();
});

<|endoftext|>


<commit_before>define([], () => {
    function outerDimensions(el) {
        el.offsetHeight;
        const rect = el.getBoundingClientRect();
        const width = Math.ceil(rect.right - rect.left);
        const height = Math.ceil(rect.bottom - rect.top);
        return {
            width, height
        };
    }

    class ResizeObserver {
        constructor(callback) {
            if (window.ResizeObserver) {
                this.observer = new window.ResizeObserver(callback);
            } else {
                this.observer = new FakeResizeObserver(callback);
            }
        }

        observe(element) {
            this.observer.observe(element);
        }

        unobserve(element) {
            this.observer.unobserve(element);
        }
    }

    class FakeResizeObserver {
        constructor(callback) {
            this.callback = callback;
            this.interval = 100; // ms
            this.lastWidth;
            this.lastHeight;
        }

        observe(element) {
            this.observedElement = element;
            this.intervalTimer = window.setInterval(() => {
                const {width, height} = outerDimensions(element);
                if (this.lastWidth !== width || this.lastHeight !== height) {
                    try {
                        this.callback();
                    } catch (ex) {
                        console.error('Error in callback, stopping observation.');
                        this.unobserve();
                    }
                }
            }, this.interval);
        }

        unobserve() {
            if (this.intervalTimer) {
                window.clearTimeout(this.intervalTimer);
            }
            this.observedElement = null;
        }
    }

    return ResizeObserver;
});<commit_msg>improve resize observer<commit_after>define([], () => {

    const DEFAULT_INTERVAL = 100;

    function outerDimensions(el) {
        el.offsetHeight;
        const rect = el.getBoundingClientRect();
        const width = Math.ceil(rect.right - rect.left);
        const height = Math.ceil(rect.bottom - rect.top);
        return {
            width, height
        };
    }

    class ResizeObserver {
        constructor(callback) {
            if (window.ResizeObserver) {
                this.observer = new window.ResizeObserver(callback);
            } else {
                this.observer = new FakeResizeObserver(callback);
            }
        }

        observe(element) {
            this.observer.observe(element);
        }

        unobserve(element) {
            this.observer.unobserve(element);
        }
    }

    class FakeResizeObserver {
        constructor(callback) {
            this.callback = callback;
            this.interval = 100; // ms
            this.lastWidth;
            this.lastHeight;
        }

        observe(element) {
            this.observedElement = element;
            this.intervalTimer = window.setInterval(() => {
                const {width, height} = outerDimensions(element);
                if (this.lastWidth !== width || this.lastHeight !== height) {
                    try {
                        this.callback();
                        this.lastWidth = width;
                        this.lastHeight = height;
                    } catch (ex) {
                        console.error('Error in callback, stopping observation.');
                        this.unobserve();
                    }
                }
            }, this.interval);
        }

        unobserve() {
            if (this.intervalTimer) {
                window.clearTimeout(this.intervalTimer);
            }
            this.observedElement = null;
        }
    }

    return ResizeObserver;
});<|endoftext|>


<commit_before>/*
**  ComponentJS -- Component System for JavaScript <http://componentjs.com>
**  Copyright (c) 2009-2014 Ralf S. Engelschall <http://engelschall.com>
**
**  This Source Code Form is subject to the terms of the Mozilla Public
**  License (MPL), version 2.0. If a copy of the MPL was not distributed
**  with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

/*  determine component information for infobox  */
_cs.dbg_infobox_content = function (comp) {
    var name, method, id;
    var html = "";

    /*  name and path  */
    name = comp.name().replace(/</, "<").replace(/>/, ">");
    html += "
" +
        "Name:	" +
        "" + name + "	" +
        "
";
    html += "
" +
        "Path:	" +
        "" + comp.path("/") + "	" +
        "
";

    /*  role markers  */
    var markers = "";
    if ($cs.marked(comp.obj(), "view"))       markers += "view, ";
    if ($cs.marked(comp.obj(), "model"))      markers += "model, ";
    if ($cs.marked(comp.obj(), "controller")) markers += "controller, ";
    if ($cs.marked(comp.obj(), "service"))    markers += "service, ";
    markers = markers.replace(/, $/, "");
    if (markers === "")
        markers = "none";
    html += "
" +
        "Markers:	" +
        "" + markers + "	" +
        "
";

    /*  state and guards  */
    html += "
" +
        "State:	" +
        "" + comp.state() + "	" +
        "
";
    var guards = "";
    for (method in comp.__state_guards)
        if (_cs.isown(comp.__state_guards, method))
            if (typeof comp.__state_guards[method] === "number" &&
                comp.__state_guards[method] !== 0                 )
                guards += "" + method + " (" + comp.__state_guards[method] + "), ";
    guards = guards.replace(/, $/, "");
    if (guards === "")
        guards = "none";
    html += "
" +
        "Guards:	" +
        "" + guards + "	" +
        "
";

    /*  spools  */
    var spools = "";
    for (name in comp.__spool)
        if (_cs.isown(comp.__spool, name))
            if (typeof comp.__spool[name] !== "undefined" &&
                comp.__spool[name].length > 0            )
                spools += "" + name + " (" + comp.__spool[name].length + "), ";
    spools = spools.replace(/, $/, "");
    if (spools === "")
        spools = "none";
    html += "
" +
        "Spools:	" +
        "" + spools + "	" +
        "
";

    /*  model values  */
    var values = "";
    for (id in comp.__config)
        if (_cs.isown(comp.__config, id))
            if (id.match(/^ComponentJS:property:ComponentJS:model/))
                if (typeof comp.__config[id] === "object")
                    for (name in comp.__config[id])
                        if (_cs.isown(comp.__config[id], name))
                            values += "" + name + ", ";
    values = values.replace(/, $/, "");
    if (values === "")
        values = "none";
    html += "
" +
        "Model Values:	" +
        "" + values + "	" +
        "
";

    /*  sockets  */
    var sockets = "";
    for (id in comp.__config)
        if (_cs.isown(comp.__config, id))
            if (id.match(/^ComponentJS:property:ComponentJS:socket:/))
                if (typeof comp.__config[id] === "object")
                    sockets += "" + id
                        .replace(/^ComponentJS:property:ComponentJS:socket:/, "") + ", ";
    sockets = sockets.replace(/, $/, "");
    if (sockets === "")
        sockets = "none";
    html += "
" +
        "Sockets:	" +
        "" + sockets + "	" +
        "
";

    /*  event subscriptions  */
    var subscriptions = "";
    for (id in comp.__subscription)
        if (_cs.isown(comp.__subscription, id))
            if (typeof comp.__subscription[id] === "object")
                if (typeof comp.__subscription[id].name === "string")
                    if (!comp.__subscription[id].name.match(/^ComponentJS:/))
                        subscriptions += "" + comp.__subscription[id].name + ", ";
    subscriptions = subscriptions.replace(/, $/, "");
    if (subscriptions === "")
        subscriptions = "none";
    html += "
" +
        "Event Subscriptions:	" +
        "" + subscriptions + "	" +
        "
";

    /*  service registrations  */
    var registrations = "";
    for (id in comp.__subscription)
        if (_cs.isown(comp.__subscription, id))
            if (typeof comp.__subscription[id] === "object")
                if (typeof comp.__subscription[id].name === "string")
                    if (comp.__subscription[id].name.match(/^ComponentJS:service:/))
                        registrations += "" + comp.__subscription[id].name
                            .replace(/^ComponentJS:service:/, "") + ", ";
    registrations = registrations.replace(/, $/, "");
    if (registrations === "")
        registrations = "none";
    html += "
" +
        "Service Registrations:	" +
        "" + registrations + "	" +
        "
";

    /*  hooks  */
    var hooks = "";
    for (id in comp.__subscription)
        if (_cs.isown(comp.__subscription, id))
            if (typeof comp.__subscription[id] === "object")
                if (typeof comp.__subscription[id].name === "string")
                    if (comp.__subscription[id].name.match(/^ComponentJS:hook:/))
                        hooks += "" + comp.__subscription[id].name
                            .replace(/^ComponentJS:hook:/, "") + ", ";
    hooks = hooks.replace(/, $/, "");
    if (hooks === "")
        hooks = "none";
    html += "
" +
        "Hook Points:	" +
        "" + hooks + "	" +
        "
";

    /*  finish and return table  */
    html = "
" + html + "
";
    return html;
};

<commit_msg>fix debugger: the model values were not correctly shown because they are one level deeper in the data structure<commit_after>/*
**  ComponentJS -- Component System for JavaScript <http://componentjs.com>
**  Copyright (c) 2009-2014 Ralf S. Engelschall <http://engelschall.com>
**
**  This Source Code Form is subject to the terms of the Mozilla Public
**  License (MPL), version 2.0. If a copy of the MPL was not distributed
**  with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

/*  determine component information for infobox  */
_cs.dbg_infobox_content = function (comp) {
    var name, method, id;
    var html = "";

    /*  name and path  */
    name = comp.name().replace(/</, "<").replace(/>/, ">");
    html += "
" +
        "Name:	" +
        "" + name + "	" +
        "
";
    html += "
" +
        "Path:	" +
        "" + comp.path("/") + "	" +
        "
";

    /*  role markers  */
    var markers = "";
    if ($cs.marked(comp.obj(), "view"))       markers += "view, ";
    if ($cs.marked(comp.obj(), "model"))      markers += "model, ";
    if ($cs.marked(comp.obj(), "controller")) markers += "controller, ";
    if ($cs.marked(comp.obj(), "service"))    markers += "service, ";
    markers = markers.replace(/, $/, "");
    if (markers === "")
        markers = "none";
    html += "
" +
        "Markers:	" +
        "" + markers + "	" +
        "
";

    /*  state and guards  */
    html += "
" +
        "State:	" +
        "" + comp.state() + "	" +
        "
";
    var guards = "";
    for (method in comp.__state_guards)
        if (_cs.isown(comp.__state_guards, method))
            if (typeof comp.__state_guards[method] === "number" &&
                comp.__state_guards[method] !== 0                 )
                guards += "" + method + " (" + comp.__state_guards[method] + "), ";
    guards = guards.replace(/, $/, "");
    if (guards === "")
        guards = "none";
    html += "
" +
        "Guards:	" +
        "" + guards + "	" +
        "
";

    /*  spools  */
    var spools = "";
    for (name in comp.__spool)
        if (_cs.isown(comp.__spool, name))
            if (typeof comp.__spool[name] !== "undefined" &&
                comp.__spool[name].length > 0            )
                spools += "" + name + " (" + comp.__spool[name].length + "), ";
    spools = spools.replace(/, $/, "");
    if (spools === "")
        spools = "none";
    html += "
" +
        "Spools:	" +
        "" + spools + "	" +
        "
";

    /*  model values  */
    var values = "";
    for (id in comp.__config)
        if (_cs.isown(comp.__config, id))
            if (id.match(/^ComponentJS:property:ComponentJS:model/))
                if (typeof comp.__config[id] === "object")
                    for (name in comp.__config[id].data)
                        if (_cs.isown(comp.__config[id].data, name))
                            values += "" + name + ", ";
    values = values.replace(/, $/, "");
    if (values === "")
        values = "none";
    html += "
" +
        "Model Values:	" +
        "" + values + "	" +
        "
";

    /*  sockets  */
    var sockets = "";
    for (id in comp.__config)
        if (_cs.isown(comp.__config, id))
            if (id.match(/^ComponentJS:property:ComponentJS:socket:/))
                if (typeof comp.__config[id] === "object")
                    sockets += "" + id
                        .replace(/^ComponentJS:property:ComponentJS:socket:/, "") + ", ";
    sockets = sockets.replace(/, $/, "");
    if (sockets === "")
        sockets = "none";
    html += "
" +
        "Sockets:	" +
        "" + sockets + "	" +
        "
";

    /*  event subscriptions  */
    var subscriptions = "";
    for (id in comp.__subscription)
        if (_cs.isown(comp.__subscription, id))
            if (typeof comp.__subscription[id] === "object")
                if (typeof comp.__subscription[id].name === "string")
                    if (!comp.__subscription[id].name.match(/^ComponentJS:/))
                        subscriptions += "" + comp.__subscription[id].name + ", ";
    subscriptions = subscriptions.replace(/, $/, "");
    if (subscriptions === "")
        subscriptions = "none";
    html += "
" +
        "Event Subscriptions:	" +
        "" + subscriptions + "	" +
        "
";

    /*  service registrations  */
    var registrations = "";
    for (id in comp.__subscription)
        if (_cs.isown(comp.__subscription, id))
            if (typeof comp.__subscription[id] === "object")
                if (typeof comp.__subscription[id].name === "string")
                    if (comp.__subscription[id].name.match(/^ComponentJS:service:/))
                        registrations += "" + comp.__subscription[id].name
                            .replace(/^ComponentJS:service:/, "") + ", ";
    registrations = registrations.replace(/, $/, "");
    if (registrations === "")
        registrations = "none";
    html += "
" +
        "Service Registrations:	" +
        "" + registrations + "	" +
        "
";

    /*  hooks  */
    var hooks = "";
    for (id in comp.__subscription)
        if (_cs.isown(comp.__subscription, id))
            if (typeof comp.__subscription[id] === "object")
                if (typeof comp.__subscription[id].name === "string")
                    if (comp.__subscription[id].name.match(/^ComponentJS:hook:/))
                        hooks += "" + comp.__subscription[id].name
                            .replace(/^ComponentJS:hook:/, "") + ", ";
    hooks = hooks.replace(/, $/, "");
    if (hooks === "")
        hooks = "none";
    html += "
" +
        "Hook Points:	" +
        "" + hooks + "	" +
        "
";

    /*  finish and return table  */
    html = "
" + html + "
";
    return html;
};

<|endoftext|>


<commit_before>/**
 * Copyright 2013-present, Facebook, Inc.
 * All rights reserved.
 *
 * This source code is licensed under the BSD-style license found in the
 * LICENSE file in the root directory of this source tree. An additional grant
 * of patent rights can be found in the PATENTS file in the same directory.
 *
 * @providesModule SVGDOMPropertyConfig
 */

'use strict';

var NS = {
  xlink: 'http://www.w3.org/1999/xlink',
  xml: 'http://www.w3.org/XML/1998/namespace',
};

// We use attributes for everything SVG so let's avoid some duplication and run
// code instead.
// The following are all specified in the HTML config already so we exclude here.
// - class (as className)
// - color
// - height
// - id
// - lang
// - max
// - media
// - method
// - min
// - name
// - style
// - target
// - type
// - width
var ATTRS = {
  accentHeight: 'accent-height',
  accumulate: 0,
  additive: 0,
  alignmentBaseline: 'alignment-baseline',
  allowReorder: 'allowReorder',
  alphabetic: 0,
  amplitude: 0,
  arabicForm: 'arabic-form',
  ascent: 0,
  attributeName: 'attributeName',
  attributeType: 'attributeType',
  autoReverse: 'autoReverse',
  azimuth: 0,
  baseFrequency: 'baseFrequency',
  baseProfile: 'baseProfile',
  baselineShift: 'baseline-shift',
  bbox: 0,
  begin: 0,
  bias: 0,
  by: 0,
  calcMode: 'calcMode',
  capHeight: 'cap-height',
  clip: 0,
  clipPath: 'clip-path',
  clipRule: 'clip-rule',
  clipPathUnits: 'clipPathUnits',
  colorInterpolation: 'color-interpolation',
  colorInterpolationFilters: 'color-interpolation-filters',
  colorProfile: 'color-profile',
  colorRendering: 'color-rendering',
  contentScriptType: 'contentScriptType',
  contentStyleType: 'contentStyleType',
  cursor: 0,
  cx: 0,
  cy: 0,
  d: 0,
  decelerate: 0,
  descent: 0,
  diffuseConstant: 'diffuseConstant',
  direction: 0,
  display: 0,
  divisor: 0,
  dominantBaseline: 'dominant-baseline',
  dur: 0,
  dx: 0,
  dy: 0,
  edgeMode: 'edgeMode',
  elevation: 0,
  enableBackground: 'enable-background',
  end: 0,
  exponent: 0,
  externalResourcesRequired: 'externalResourcesRequired',
  fill: 0,
  fillOpacity: 'fill-opacity',
  fillRule: 'fill-rule',
  filter: 0,
  filterRes: 'filterRes',
  filterUnits: 'filterUnits',
  floodColor: 'flood-color',
  floodOpacity: 'flood-opacity',
  focusable: 0,
  fontFamily: 'font-family',
  fontSize: 'font-size',
  fontSizeAdjust: 'font-size-adjust',
  fontStretch: 'font-stretch',
  fontStyle: 'font-style',
  fontVariant: 'font-variant',
  fontWeight: 'font-weight',
  format: 0,
  from: 0,
  fx: 0,
  fy: 0,
  g1: 0,
  g2: 0,
  glyphName: 'glyph-name',
  glyphOrientationHorizontal: 'glyph-orientation-horizontal',
  glyphOrientationVertical: 'glyph-orientation-vertical',
  glyphRef: 'glyphRef',
  gradientTransform: 'gradientTransform',
  gradientUnits: 'gradientUnits',
  hanging: 0,
  horizAdvX: 'horiz-adv-x',
  horizOriginX: 'horiz-origin-x',
  ideographic: 0,
  imageRendering: 'image-rendering',
  in: 0,
  in2: 0,
  intercept: 0,
  k: 0,
  k1: 0,
  k2: 0,
  k3: 0,
  k4: 0,
  kernelMatrix: 'kernelMatrix',
  kernelUnitLength: 'kernelUnitLength',
  kerning: 0,
  keyPoints: 'keyPoints',
  keySplines: 'keySplines',
  keyTimes: 'keyTimes',
  lengthAdjust: 'lengthAdjust',
  letterSpacing: 'letter-spacing',
  lightingColor: 'lighting-color',
  limitingConeAngle: 'limitingConeAngle',
  local: 0,
  markerEnd: 'marker-end',
  markerMid: 'marker-mid',
  markerStart: 'marker-start',
  markerHeight: 'markerHeight',
  markerUnits: 'markerUnits',
  markerWidth: 'markerWidth',
  mask: 0,
  maskContentUnits: 'maskContentUnits',
  maskUnits: 'maskUnits',
  mathematical: 0,
  mode: 0,
  numOctaves: 'numOctaves',
  offset: 0,
  opacity: 0,
  operator: 0,
  order: 0,
  orient: 0,
  orientation: 0,
  origin: 0,
  overflow: 0,
  overlinePosition: 'overline-position',
  overlineThickness: 'overline-thickness',
  paintOrder: 'paint-order',
  panose1: 'panose-1',
  pathLength: 'pathLength',
  patternContentUnits: 'patternContentUnits',
  patternTransform: 'patternTransform',
  patternUnits: 'patternUnits',
  pointerEvents: 'pointer-events',
  points: 0,
  pointsAtX: 'pointsAtX',
  pointsAtY: 'pointsAtY',
  pointsAtZ: 'pointsAtZ',
  preserveAlpha: 'preserveAlpha',
  preserveAspectRatio: 'preserveAspectRatio',
  primitiveUnits: 'primitiveUnits',
  r: 0,
  radius: 0,
  refX: 'refX',
  refY: 'refY',
  renderingIntent: 'rendering-intent',
  repeatCount: 'repeatCount',
  repeatDur: 'repeatDur',
  requiredExtensions: 'requiredExtensions',
  requiredFeatures: 'requiredFeatures',
  restart: 0,
  result: 0,
  rotate: 0,
  rx: 0,
  ry: 0,
  scale: 0,
  seed: 0,
  shapeRendering: 'shape-rendering',
  slope: 0,
  spacing: 0,
  specularConstant: 'specularConstant',
  specularExponent: 'specularExponent',
  speed: 0,
  spreadMethod: 'spreadMethod',
  startOffset: 'startOffset',
  stdDeviation: 'stdDeviation',
  stemh: 0,
  stemv: 0,
  stitchTiles: 'stitchTiles',
  stopColor: 'stop-color',
  stopOpacity: 'stop-opacity',
  strikethroughPosition: 'strikethrough-position',
  strikethroughThickness: 'strikethrough-thickness',
  string: 0,
  stroke: 0,
  strokeDasharray: 'stroke-dasharray',
  strokeDashoffset: 'stroke-dashoffset',
  strokeLinecap: 'stroke-linecap',
  strokeLinejoin: 'stroke-linejoin',
  strokeMiterlimit: 'stroke-miterlimit',
  strokeOpacity: 'stroke-opacity',
  strokeWidth: 'stroke-width',
  surfaceScale: 'surfaceScale',
  systemLanguage: 'systemLanguage',
  tableValues: 'tableValues',
  targetX: 'targetX',
  targetY: 'targetY',
  textAnchor: 'text-anchor',
  textDecoration: 'text-decoration',
  textRendering: 'text-rendering',
  textLength: 'textLength',
  to: 0,
  transform: 0,
  u1: 0,
  u2: 0,
  underlinePosition: 'underline-position',
  underlineThickness: 'underline-thickness',
  unicode: 0,
  unicodeBidi: 'unicode-bidi',
  unicodeRange: 'unicode-range',
  unitsPerEm: 'units-per-em',
  vAlphabetic: 'v-alphabetic',
  vHanging: 'v-hanging',
  vIdeographic: 'v-ideographic',
  vMathematical: 'v-mathematical',
  values: 0,
  vectorEffect: 'vector-effect',
  version: 0,
  vertAdvY: 'vert-adv-y',
  vertOriginX: 'vert-origin-x',
  vertOriginY: 'vert-origin-y',
  viewBox: 'viewBox',
  viewTarget: 'viewTarget',
  visibility: 0,
  widths: 0,
  wordSpacing: 'word-spacing',
  writingMode: 'writing-mode',
  x: 0,
  xHeight: 'x-height',
  x1: 0,
  x2: 0,
  xChannelSelector: 'xChannelSelector',
  xlinkActuate: 'xlink:actuate',
  xlinkArcrole: 'xlink:arcrole',
  xlinkHref: 'xlink:href',
  xlinkRole: 'xlink:role',
  xlinkShow: 'xlink:show',
  xlinkTitle: 'xlink:title',
  xlinkType: 'xlink:type',
  xmlBase: 'xml:base',
  xmlLang: 'xml:lang',
  xmlSpace: 'xml:space',
  y: 0,
  y1: 0,
  y2: 0,
  yChannelSelector: 'yChannelSelector',
  z: 0,
  zoomAndPan: 'zoomAndPan',
};

var SVGDOMPropertyConfig = {
  Properties: {},
  DOMAttributeNamespaces: {
    xlinkActuate: NS.xlink,
    xlinkArcrole: NS.xlink,
    xlinkHref: NS.xlink,
    xlinkRole: NS.xlink,
    xlinkShow: NS.xlink,
    xlinkTitle: NS.xlink,
    xlinkType: NS.xlink,
    xmlBase: NS.xml,
    xmlLang: NS.xml,
    xmlSpace: NS.xml,
  },
  DOMAttributeNames: {},
};

Object.keys(ATTRS).forEach((key) => {
  SVGDOMPropertyConfig.Properties[key] = 0;
  if (ATTRS[key]) {
    SVGDOMPropertyConfig.DOMAttributeNames[key] = ATTRS[key];
  }
});

module.exports = SVGDOMPropertyConfig;
<commit_msg>Add xmlns and xmlns:xlink attributes (#6471)<commit_after>/**
 * Copyright 2013-present, Facebook, Inc.
 * All rights reserved.
 *
 * This source code is licensed under the BSD-style license found in the
 * LICENSE file in the root directory of this source tree. An additional grant
 * of patent rights can be found in the PATENTS file in the same directory.
 *
 * @providesModule SVGDOMPropertyConfig
 */

'use strict';

var NS = {
  xlink: 'http://www.w3.org/1999/xlink',
  xml: 'http://www.w3.org/XML/1998/namespace',
};

// We use attributes for everything SVG so let's avoid some duplication and run
// code instead.
// The following are all specified in the HTML config already so we exclude here.
// - class (as className)
// - color
// - height
// - id
// - lang
// - max
// - media
// - method
// - min
// - name
// - style
// - target
// - type
// - width
var ATTRS = {
  accentHeight: 'accent-height',
  accumulate: 0,
  additive: 0,
  alignmentBaseline: 'alignment-baseline',
  allowReorder: 'allowReorder',
  alphabetic: 0,
  amplitude: 0,
  arabicForm: 'arabic-form',
  ascent: 0,
  attributeName: 'attributeName',
  attributeType: 'attributeType',
  autoReverse: 'autoReverse',
  azimuth: 0,
  baseFrequency: 'baseFrequency',
  baseProfile: 'baseProfile',
  baselineShift: 'baseline-shift',
  bbox: 0,
  begin: 0,
  bias: 0,
  by: 0,
  calcMode: 'calcMode',
  capHeight: 'cap-height',
  clip: 0,
  clipPath: 'clip-path',
  clipRule: 'clip-rule',
  clipPathUnits: 'clipPathUnits',
  colorInterpolation: 'color-interpolation',
  colorInterpolationFilters: 'color-interpolation-filters',
  colorProfile: 'color-profile',
  colorRendering: 'color-rendering',
  contentScriptType: 'contentScriptType',
  contentStyleType: 'contentStyleType',
  cursor: 0,
  cx: 0,
  cy: 0,
  d: 0,
  decelerate: 0,
  descent: 0,
  diffuseConstant: 'diffuseConstant',
  direction: 0,
  display: 0,
  divisor: 0,
  dominantBaseline: 'dominant-baseline',
  dur: 0,
  dx: 0,
  dy: 0,
  edgeMode: 'edgeMode',
  elevation: 0,
  enableBackground: 'enable-background',
  end: 0,
  exponent: 0,
  externalResourcesRequired: 'externalResourcesRequired',
  fill: 0,
  fillOpacity: 'fill-opacity',
  fillRule: 'fill-rule',
  filter: 0,
  filterRes: 'filterRes',
  filterUnits: 'filterUnits',
  floodColor: 'flood-color',
  floodOpacity: 'flood-opacity',
  focusable: 0,
  fontFamily: 'font-family',
  fontSize: 'font-size',
  fontSizeAdjust: 'font-size-adjust',
  fontStretch: 'font-stretch',
  fontStyle: 'font-style',
  fontVariant: 'font-variant',
  fontWeight: 'font-weight',
  format: 0,
  from: 0,
  fx: 0,
  fy: 0,
  g1: 0,
  g2: 0,
  glyphName: 'glyph-name',
  glyphOrientationHorizontal: 'glyph-orientation-horizontal',
  glyphOrientationVertical: 'glyph-orientation-vertical',
  glyphRef: 'glyphRef',
  gradientTransform: 'gradientTransform',
  gradientUnits: 'gradientUnits',
  hanging: 0,
  horizAdvX: 'horiz-adv-x',
  horizOriginX: 'horiz-origin-x',
  ideographic: 0,
  imageRendering: 'image-rendering',
  in: 0,
  in2: 0,
  intercept: 0,
  k: 0,
  k1: 0,
  k2: 0,
  k3: 0,
  k4: 0,
  kernelMatrix: 'kernelMatrix',
  kernelUnitLength: 'kernelUnitLength',
  kerning: 0,
  keyPoints: 'keyPoints',
  keySplines: 'keySplines',
  keyTimes: 'keyTimes',
  lengthAdjust: 'lengthAdjust',
  letterSpacing: 'letter-spacing',
  lightingColor: 'lighting-color',
  limitingConeAngle: 'limitingConeAngle',
  local: 0,
  markerEnd: 'marker-end',
  markerMid: 'marker-mid',
  markerStart: 'marker-start',
  markerHeight: 'markerHeight',
  markerUnits: 'markerUnits',
  markerWidth: 'markerWidth',
  mask: 0,
  maskContentUnits: 'maskContentUnits',
  maskUnits: 'maskUnits',
  mathematical: 0,
  mode: 0,
  numOctaves: 'numOctaves',
  offset: 0,
  opacity: 0,
  operator: 0,
  order: 0,
  orient: 0,
  orientation: 0,
  origin: 0,
  overflow: 0,
  overlinePosition: 'overline-position',
  overlineThickness: 'overline-thickness',
  paintOrder: 'paint-order',
  panose1: 'panose-1',
  pathLength: 'pathLength',
  patternContentUnits: 'patternContentUnits',
  patternTransform: 'patternTransform',
  patternUnits: 'patternUnits',
  pointerEvents: 'pointer-events',
  points: 0,
  pointsAtX: 'pointsAtX',
  pointsAtY: 'pointsAtY',
  pointsAtZ: 'pointsAtZ',
  preserveAlpha: 'preserveAlpha',
  preserveAspectRatio: 'preserveAspectRatio',
  primitiveUnits: 'primitiveUnits',
  r: 0,
  radius: 0,
  refX: 'refX',
  refY: 'refY',
  renderingIntent: 'rendering-intent',
  repeatCount: 'repeatCount',
  repeatDur: 'repeatDur',
  requiredExtensions: 'requiredExtensions',
  requiredFeatures: 'requiredFeatures',
  restart: 0,
  result: 0,
  rotate: 0,
  rx: 0,
  ry: 0,
  scale: 0,
  seed: 0,
  shapeRendering: 'shape-rendering',
  slope: 0,
  spacing: 0,
  specularConstant: 'specularConstant',
  specularExponent: 'specularExponent',
  speed: 0,
  spreadMethod: 'spreadMethod',
  startOffset: 'startOffset',
  stdDeviation: 'stdDeviation',
  stemh: 0,
  stemv: 0,
  stitchTiles: 'stitchTiles',
  stopColor: 'stop-color',
  stopOpacity: 'stop-opacity',
  strikethroughPosition: 'strikethrough-position',
  strikethroughThickness: 'strikethrough-thickness',
  string: 0,
  stroke: 0,
  strokeDasharray: 'stroke-dasharray',
  strokeDashoffset: 'stroke-dashoffset',
  strokeLinecap: 'stroke-linecap',
  strokeLinejoin: 'stroke-linejoin',
  strokeMiterlimit: 'stroke-miterlimit',
  strokeOpacity: 'stroke-opacity',
  strokeWidth: 'stroke-width',
  surfaceScale: 'surfaceScale',
  systemLanguage: 'systemLanguage',
  tableValues: 'tableValues',
  targetX: 'targetX',
  targetY: 'targetY',
  textAnchor: 'text-anchor',
  textDecoration: 'text-decoration',
  textRendering: 'text-rendering',
  textLength: 'textLength',
  to: 0,
  transform: 0,
  u1: 0,
  u2: 0,
  underlinePosition: 'underline-position',
  underlineThickness: 'underline-thickness',
  unicode: 0,
  unicodeBidi: 'unicode-bidi',
  unicodeRange: 'unicode-range',
  unitsPerEm: 'units-per-em',
  vAlphabetic: 'v-alphabetic',
  vHanging: 'v-hanging',
  vIdeographic: 'v-ideographic',
  vMathematical: 'v-mathematical',
  values: 0,
  vectorEffect: 'vector-effect',
  version: 0,
  vertAdvY: 'vert-adv-y',
  vertOriginX: 'vert-origin-x',
  vertOriginY: 'vert-origin-y',
  viewBox: 'viewBox',
  viewTarget: 'viewTarget',
  visibility: 0,
  widths: 0,
  wordSpacing: 'word-spacing',
  writingMode: 'writing-mode',
  x: 0,
  xHeight: 'x-height',
  x1: 0,
  x2: 0,
  xChannelSelector: 'xChannelSelector',
  xlinkActuate: 'xlink:actuate',
  xlinkArcrole: 'xlink:arcrole',
  xlinkHref: 'xlink:href',
  xlinkRole: 'xlink:role',
  xlinkShow: 'xlink:show',
  xlinkTitle: 'xlink:title',
  xlinkType: 'xlink:type',
  xmlBase: 'xml:base',
  xmlns: 0,
  xmlnsXlink: 'xmlns:xlink',
  xmlLang: 'xml:lang',
  xmlSpace: 'xml:space',
  y: 0,
  y1: 0,
  y2: 0,
  yChannelSelector: 'yChannelSelector',
  z: 0,
  zoomAndPan: 'zoomAndPan',
};

var SVGDOMPropertyConfig = {
  Properties: {},
  DOMAttributeNamespaces: {
    xlinkActuate: NS.xlink,
    xlinkArcrole: NS.xlink,
    xlinkHref: NS.xlink,
    xlinkRole: NS.xlink,
    xlinkShow: NS.xlink,
    xlinkTitle: NS.xlink,
    xlinkType: NS.xlink,
    xmlBase: NS.xml,
    xmlLang: NS.xml,
    xmlSpace: NS.xml,
  },
  DOMAttributeNames: {},
};

Object.keys(ATTRS).forEach((key) => {
  SVGDOMPropertyConfig.Properties[key] = 0;
  if (ATTRS[key]) {
    SVGDOMPropertyConfig.DOMAttributeNames[key] = ATTRS[key];
  }
});

module.exports = SVGDOMPropertyConfig;
<|endoftext|>