/* eslint-disable */
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// Note: This is a generated file. Do not edit by hand. Instead, run
// components/variations/proto/devtools/update_client_variations.py to update.

const gen = {};

// clang-format off
(function(){var f=this||self;function l(a,b){a=a.split(".");var c=f;a[0]in c||"undefined"==typeof c.execScript||c.execScript("var "+a[0]);for(var d;a.length&&(d=a.shift());)a.length||void 0===b?c[d]&&c[d]!==Object.prototype[d]?c=c[d]:c=c[d]={}:c[d]=b}
function m(a){var b=typeof a;if("object"==b)if(a){if(a instanceof Array)return"array";if(a instanceof Object)return b;var c=Object.prototype.toString.call(a);if("[object Window]"==c)return"object";if("[object Array]"==c||"number"==typeof a.length&&"undefined"!=typeof a.splice&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("splice"))return"array";if("[object Function]"==c||"undefined"!=typeof a.call&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("call"))return"function"}else return"null";
else if("function"==b&&"undefined"==typeof a.call)return"object";return b}function n(a,b){function c(){}c.prototype=b.prototype;a.prototype=new c;a.prototype.constructor=a;a.base=function(d,e,g){for(var k=Array(arguments.length-2),h=2;h<arguments.length;h++)k[h-2]=arguments[h];return b.prototype[e].apply(d,k)}};function p(a){if(Error.captureStackTrace)Error.captureStackTrace(this,p);else{const b=Error().stack;b&&(this.stack=b)}a&&(this.message=String(a))}n(p,Error);p.prototype.name="CustomError";function q(a,b){a=a.split("%s");for(var c="",d=a.length-1,e=0;e<d;e++)c+=a[e]+(e<b.length?b[e]:"%s");p.call(this,c+a[d])}n(q,p);q.prototype.name="AssertionError";function r(a,b){throw new q("Failure"+(a?": "+a:""),Array.prototype.slice.call(arguments,1));};var t=null;function u(a){var b=a.length,c=3*b/4;c%3?c=Math.floor(c):-1!="=.".indexOf(a[b-1])&&(c=-1!="=.".indexOf(a[b-2])?c-2:c-1);var d=new Uint8Array(c),e=0;w(a,function(g){d[e++]=g});return d.subarray(0,e)}
function w(a,b){function c(I){for(;d<a.length;){var v=a.charAt(d++),x=t[v];if(null!=x)return x;if(!/^[\s\xa0]*$/.test(v))throw Error("Unknown base64 encoding at char: "+v);}return I}y();for(var d=0;;){var e=c(-1),g=c(0),k=c(64),h=c(64);if(64===h&&-1===e)break;b(e<<2|g>>4);64!=k&&(b(g<<4&240|k>>2),64!=h&&b(k<<6&192|h))}}
function y(){if(!t){t={};for(var a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),b=["+/=","+/","-_=","-_.","-_"],c=0;5>c;c++)for(var d=a.concat(b[c].split("")),e=0;e<d.length;e++){var g=d[e];void 0===t[g]&&(t[g]=e)}}};function z(a){if(a.constructor===Uint8Array)return a;if(a.constructor===ArrayBuffer)return new Uint8Array(a);if("undefined"!=typeof Buffer&&a.constructor===Buffer)return new Uint8Array(a);if(a.constructor===Array)return new Uint8Array(a);if(a.constructor===String)return u(a);r("Type not convertible to Uint8Array.");return new Uint8Array(0)};function A(a){this.b=null;this.a=this.c=this.g=0;a&&B(this,a)}var C=[];function B(a,b){a.b=z(b);a.g=0;a.c=a.b.length;a.a=a.g}A.prototype.reset=function(){this.a=this.g};
A.prototype.f=function(){var a=this.b;var b=a[this.a];var c=b&127;if(128>b)return this.a+=1,c;b=a[this.a+1];c|=(b&127)<<7;if(128>b)return this.a+=2,c;b=a[this.a+2];c|=(b&127)<<14;if(128>b)return this.a+=3,c;b=a[this.a+3];c|=(b&127)<<21;if(128>b)return this.a+=4,c;b=a[this.a+4];c|=(b&15)<<28;if(128>b)return this.a+=5,c>>>0;this.a+=5;128<=a[this.a++]&&128<=a[this.a++]&&128<=a[this.a++]&&128<=a[this.a++]&&this.a++;return c};A.prototype.h=A.prototype.f;function D(a){if(C.length){var b=C.pop();a&&B(b,a);a=b}else a=new A(a);this.a=a;this.g=this.a.a;this.b=this.c=-1;this.f=!1}D.prototype.reset=function(){this.a.reset();this.b=this.c=-1};function E(a){var b=a.a;if(b.a==b.c)return!1;(b=a.f)||(b=a.a,b=0>b.a||b.a>b.c);if(b)return r("Decoder hit an error"),!1;a.g=a.a.a;var c=a.a.f();b=c>>>3;c&=7;if(0!=c&&5!=c&&1!=c&&2!=c&&3!=c&&4!=c)return r("Invalid wire type: %s (at position %s)",c,a.g),a.f=!0,!1;a.c=b;a.b=c;return!0}
function F(a){switch(a.b){case 0:if(0!=a.b)r("Invalid wire type for skipVarintField"),F(a);else{for(a=a.a;a.b[a.a]&128;)a.a++;a.a++}break;case 1:1!=a.b?(r("Invalid wire type for skipFixed64Field"),F(a)):(a=a.a,a.a+=8);break;case 2:if(2!=a.b)r("Invalid wire type for skipDelimitedField"),F(a);else{var b=a.a.f();a=a.a;a.a+=b}break;case 5:5!=a.b?(r("Invalid wire type for skipFixed32Field"),F(a)):(a=a.a,a.a+=4);break;case 3:b=a.c;do{if(!E(a)){r("Unmatched start-group tag: stream EOF");a.f=!0;break}if(4==
a.b){a.c!=b&&(r("Unmatched end-group tag"),a.f=!0);break}F(a)}while(1);break;default:r("Invalid wire encoding for field.")}};function G(){}var H="function"==typeof Uint8Array,J=Object.freeze?Object.freeze([]):[];function K(a,b){if(b<a.c){b+=a.f;var c=a.a[b];return c===J?a.a[b]=[]:c}if(a.b)return c=a.b[b],c===J?a.b[b]=[]:c}G.prototype.toString=function(){return this.a.toString()};function L(a){var b=a;a=M;b||(b=[]);this.f=-1;this.a=b;a:{if(b=this.a.length){--b;var c=this.a[b];if(!(null===c||"object"!=typeof c||"array"==m(c)||H&&c instanceof Uint8Array)){this.c=b- -1;this.b=c;break a}}this.c=Number.MAX_VALUE}if(a)for(b=0;b<a.length;b++)if(c=a[b],c<this.c)c+=-1,this.a[c]=this.a[c]||J;else{var d=this.c+-1;this.a[d]||(this.b=this.a[d]={});this.b[c]=this.b[c]||J}}n(L,G);var M=[1,3];l("parseClientVariations",function(a){var b="";try{b=atob(a)}catch(d){}a=[];for(var c=0;c<b.length;c++)a.push(b.charCodeAt(c));b=new D(a);for(a=new L;E(b)&&4!=b.b;)switch(b.c){case 1:c=b.a.h();K(a,1).push(c);break;case 3:c=b.a.h();K(a,3).push(c);break;default:F(b)}return{variationIds:K(a,1),triggerVariationIds:K(a,3)}});
l("formatClientVariations",function(a,b="Active client experiment variation IDs.",c="Active client experiment variation IDs that trigger server-side behavior."){const d=a.variationIds;a=a.triggerVariationIds;const e=["message ClientVariations {"];d.length&&e.push(`  // ${b}`,`  repeated int32 variation_id = [${d.join(", ")}];`);a.length&&e.push(`  // ${c}`,`  repeated int32 trigger_variation_id = [${a.join(", ")}];`);e.push("}");return e.join("\n")});}).call(gen);
// clang-format on

export function parseClientVariations(data) {
  return gen.parseClientVariations(data);
}
export function formatClientVariations(data) {
  return gen.formatClientVariations(data);
}
