CoolFace
Datasetpublic

basant307/AI_Governance_Project

sourceHugging Faceapache-2.0updated 2mo agoView on Hugging Face
0likes48downloads
protobuf.js8042 linesDownload Raw Back to light
1/*!2 * protobuf.js v7.6.4 (c) 2016, daniel wirtz3 * compiled fri, 12 jun 2026 12:10:46 utc4 * licensed under the bsd-3-clause license5 * see: https://github.com/dcodeio/protobuf.js for details6 */7(function(undefined){"use strict";(function prelude(modules, cache, entries) {8 9    // This is the prelude used to bundle protobuf.js for the browser. Wraps up the CommonJS10    // sources through a conflict-free require shim and is again wrapped within an iife that11    // provides a minification-friendly `undefined` var plus a global "use strict" directive12    // so that minification can remove the directives of each module.13 14    function $require(name) {15        var $module = cache[name];16        if (!$module)17            modules[name][0].call($module = cache[name] = { exports: {} }, $require, $module, $module.exports);18        return $module.exports;19    }20 21    var protobuf = $require(entries[0]);22 23    // Expose globally24    protobuf.util.global.protobuf = protobuf;25 26    // Be nice to AMD27    if (typeof define === "function" && define.amd)28        define(["long"], function(Long) {29            if (Long && Long.isLong) {30                protobuf.util.Long = Long;31                protobuf.configure();32            }33            return protobuf;34        });35 36    // Be nice to CommonJS37    if (typeof module === "object" && module && module.exports)38        module.exports = protobuf;39 40})/* end of prelude */({1:[function(require,module,exports){41"use strict";
42module.exports = asPromise;
43
44/**
45 * Callback as used by {@link util.asPromise}.
46 * @typedef asPromiseCallback
47 * @type {function}
48 * @param {Error|null} error Error, if any
49 * @param {...*} params Additional arguments
50 * @returns {undefined}
51 */
52
53/**
54 * Returns a promise from a node-style callback function.
55 * @memberof util
56 * @param {asPromiseCallback} fn Function to call
57 * @param {*} ctx Function context
58 * @param {...*} params Function arguments
59 * @returns {Promise<*>} Promisified function
60 */
61function asPromise(fn, ctx/*, varargs */) {
62    var params  = new Array(arguments.length - 1),
63        offset  = 0,
64        index   = 2,
65        pending = true;
66    while (index < arguments.length)
67        params[offset++] = arguments[index++];
68    return new Promise(function executor(resolve, reject) {
69        params[offset] = function callback(err/*, varargs */) {
70            if (pending) {
71                pending = false;
72                if (err)
73                    reject(err);
74                else {
75                    var params = new Array(arguments.length - 1),
76                        offset = 0;
77                    while (offset < params.length)
78                        params[offset++] = arguments[offset];
79                    resolve.apply(null, params);
80                }
81            }
82        };
83        try {
84            fn.apply(ctx || null, params);
85        } catch (err) {
86            if (pending) {
87                pending = false;
88                reject(err);
89            }
90        }
91    });
92}
93 94},{}],2:[function(require,module,exports){95"use strict";
96
97/**
98 * A minimal base64 implementation for number arrays.
99 * @memberof util
100 * @namespace
101 */
102var base64 = exports;
103
104/**
105 * Calculates the byte length of a base64 encoded string.
106 * @param {string} string Base64 encoded string
107 * @returns {number} Byte length
108 */
109base64.length = function length(string) {
110    var p = string.length;
111    if (!p)
112        return 0;
113    var n = 0;
114    while (--p % 4 > 1 && string.charAt(p) === "=")
115        ++n;
116    return Math.ceil(string.length * 3) / 4 - n;
117};
118
119// Base64 encoding table
120var b64 = new Array(64);
121
122// Base64 decoding table
123var s64 = new Array(123);
124
125// 65..90, 97..122, 48..57, 43, 47
126for (var i = 0; i < 64;)
127    s64[b64[i] = i < 26 ? i + 65 : i < 52 ? i + 71 : i < 62 ? i - 4 : i - 59 | 43] = i++;
128
129/**
130 * Encodes a buffer to a base64 encoded string.
131 * @param {Uint8Array} buffer Source buffer
132 * @param {number} start Source start
133 * @param {number} end Source end
134 * @returns {string} Base64 encoded string
135 */
136base64.encode = function encode(buffer, start, end) {
137    var parts = null,
138        chunk = [];
139    var i = 0, // output index
140        j = 0, // goto index
141        t;     // temporary
142    while (start < end) {
143        var b = buffer[start++];
144        switch (j) {
145            case 0:
146                chunk[i++] = b64[b >> 2];
147                t = (b & 3) << 4;
148                j = 1;
149                break;
150            case 1:
151                chunk[i++] = b64[t | b >> 4];
152                t = (b & 15) << 2;
153                j = 2;
154                break;
155            case 2:
156                chunk[i++] = b64[t | b >> 6];
157                chunk[i++] = b64[b & 63];
158                j = 0;
159                break;
160        }
161        if (i > 8191) {
162            (parts || (parts = [])).push(String.fromCharCode.apply(String, chunk));
163            i = 0;
164        }
165    }
166    if (j) {
167        chunk[i++] = b64[t];
168        chunk[i++] = 61;
169        if (j === 1)
170            chunk[i++] = 61;
171    }
172    if (parts) {
173        if (i)
174            parts.push(String.fromCharCode.apply(String, chunk.slice(0, i)));
175        return parts.join("");
176    }
177    return String.fromCharCode.apply(String, chunk.slice(0, i));
178};
179
180var invalidEncoding = "invalid encoding";
181
182/**
183 * Decodes a base64 encoded string to a buffer.
184 * @param {string} string Source string
185 * @param {Uint8Array} buffer Destination buffer
186 * @param {number} offset Destination offset
187 * @returns {number} Number of bytes written
188 * @throws {Error} If encoding is invalid
189 */
190base64.decode = function decode(string, buffer, offset) {
191    var start = offset;
192    var j = 0, // goto index
193        t;     // temporary
194    for (var i = 0; i < string.length;) {
195        var c = string.charCodeAt(i++);
196        if (c === 61 && j > 1)
197            break;
198        if ((c = s64[c]) === undefined)
199            throw Error(invalidEncoding);
200        switch (j) {
201            case 0:
202                t = c;
203                j = 1;
204                break;
205            case 1:
206                buffer[offset++] = t << 2 | (c & 48) >> 4;
207                t = c;
208                j = 2;
209                break;
210            case 2:
211                buffer[offset++] = (t & 15) << 4 | (c & 60) >> 2;
212                t = c;
213                j = 3;
214                break;
215            case 3:
216                buffer[offset++] = (t & 3) << 6 | c;
217                j = 0;
218                break;
219        }
220    }
221    if (j === 1)
222        throw Error(invalidEncoding);
223    return offset - start;
224};
225
226/**
227 * Tests if the specified string appears to be base64 encoded.
228 * @param {string} string String to test
229 * @returns {boolean} `true` if probably base64 encoded, otherwise false
230 */
231base64.test = function test(string) {
232    return /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(string);
233};
234 235},{}],3:[function(require,module,exports){236"use strict";
237module.exports = codegen;
238
239var reservedRe = /^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$/;
240
241/**
242 * Begins generating a function.
243 * @memberof util
244 * @param {string[]} functionParams Function parameter names
245 * @param {string} [functionName] Function name if not anonymous
246 * @returns {Codegen} Appender that appends code to the function's body
247 */
248function codegen(functionParams, functionName) {
249
250    /* istanbul ignore if */
251    if (typeof functionParams === "string") {
252        functionName = functionParams;
253        functionParams = undefined;
254    }
255
256    var body = [];
257
258    /**
259     * Appends code to the function's body or finishes generation.
260     * @typedef Codegen
261     * @type {function}
262     * @param {string|Object.<string,*>} [formatStringOrScope] Format string or, to finish the function, an object of additional scope variables, if any
263     * @param {...*} [formatParams] Format parameters
264     * @returns {Codegen|Function} Itself or the generated function if finished
265     * @throws {Error} If format parameter counts do not match
266     */
267
268    function Codegen(formatStringOrScope) {
269        // note that explicit array handling below makes this ~50% faster
270
271        // finish the function
272        if (typeof formatStringOrScope !== "string") {
273            var source = toString();
274            if (codegen.verbose)
275                console.log("codegen: " + source); // eslint-disable-line no-console
276            source = "return " + source;
277            if (formatStringOrScope) {
278                var scopeKeys   = Object.keys(formatStringOrScope),
279                    scopeParams = new Array(scopeKeys.length + 1),
280                    scopeValues = new Array(scopeKeys.length),
281                    scopeOffset = 0;
282                while (scopeOffset < scopeKeys.length) {
283                    scopeParams[scopeOffset] = scopeKeys[scopeOffset];
284                    scopeValues[scopeOffset] = formatStringOrScope[scopeKeys[scopeOffset++]];
285                }
286                scopeParams[scopeOffset] = source;
287                return Function.apply(null, scopeParams).apply(null, scopeValues); // eslint-disable-line no-new-func
288            }
289            return Function(source)(); // eslint-disable-line no-new-func
290        }
291
292        // otherwise append to body
293        var formatParams = new Array(arguments.length - 1),
294            formatOffset = 0;
295        while (formatOffset < formatParams.length)
296            formatParams[formatOffset] = arguments[++formatOffset];
297        formatOffset = 0;
298        formatStringOrScope = formatStringOrScope.replace(/%([%dfijs])/g, function replace($0, $1) {
299            var value = formatParams[formatOffset++];
300            switch ($1) {
301                case "d": case "f": return String(Number(value));
302                case "i": return String(Math.floor(value));
303                case "j": return JSON.stringify(value);
304                case "s": return String(value);
305            }
306            return "%";
307        });
308        if (formatOffset !== formatParams.length)
309            throw Error("parameter count mismatch");
310        body.push(formatStringOrScope);
311        return Codegen;
312    }
313
314    function toString(functionNameOverride) {
315        return "function " + safeFunctionName(functionNameOverride || functionName) + "(" + (functionParams && functionParams.join(",") || "") + "){\n  " + body.join("\n  ") + "\n}";
316    }
317
318    Codegen.toString = toString;
319    return Codegen;
320}
321
322/**
323 * Begins generating a function.
324 * @memberof util
325 * @function codegen
326 * @param {string} [functionName] Function name if not anonymous
327 * @returns {Codegen} Appender that appends code to the function's body
328 * @variation 2
329 */
330
331/**
332 * When set to `true`, codegen will log generated code to console. Useful for debugging.
333 * @name util.codegen.verbose
334 * @type {boolean}
335 */
336codegen.verbose = false;
337
338function safeFunctionName(name) {
339    if (!name)
340        return "";
341    name = String(name).replace(/[^\w$]/g, "");
342    if (!name)
343        return "";
344    if (/^\d/.test(name))
345        name = "_" + name;
346    return reservedRe.test(name) ? name + "_" : name;
347}
348 349},{}],4:[function(require,module,exports){350"use strict";
351module.exports = EventEmitter;
352
353/**
354 * Constructs a new event emitter instance.
355 * @classdesc A minimal event emitter.
356 * @memberof util
357 * @constructor
358 */
359function EventEmitter() {
360
361    /**
362     * Registered listeners.
363     * @type {Object.<string,*>}
364     * @private
365     */
366    this._listeners = Object.create(null);
367}
368
369/**
370 * Event listener as used by {@link util.EventEmitter}.
371 * @typedef EventEmitterListener
372 * @type {function}
373 * @param {...*} args Arguments
374 * @returns {undefined}
375 */
376
377/**
378 * Registers an event listener.
379 * @param {string} evt Event name
380 * @param {EventEmitterListener} fn Listener
381 * @param {*} [ctx] Listener context
382 * @returns {this} `this`
383 */
384EventEmitter.prototype.on = function on(evt, fn, ctx) {
385    (this._listeners[evt] || (this._listeners[evt] = [])).push({
386        fn  : fn,
387        ctx : ctx || this
388    });
389    return this;
390};
391
392/**
393 * Removes an event listener or any matching listeners if arguments are omitted.
394 * @param {string} [evt] Event name. Removes all listeners if omitted.
395 * @param {EventEmitterListener} [fn] Listener to remove. Removes all listeners of `evt` if omitted.
396 * @returns {this} `this`
397 */
398EventEmitter.prototype.off = function off(evt, fn) {
399    if (evt === undefined)
400        this._listeners = Object.create(null);
401    else {
402        if (fn === undefined)
403            this._listeners[evt] = [];
404        else {
405            var listeners = this._listeners[evt];
406            if (!listeners)
407                return this;
408            for (var i = 0; i < listeners.length;)
409                if (listeners[i].fn === fn)
410                    listeners.splice(i, 1);
411                else
412                    ++i;
413        }
414    }
415    return this;
416};
417
418/**
419 * Emits an event by calling its listeners with the specified arguments.
420 * @param {string} evt Event name
421 * @param {...*} args Arguments
422 * @returns {this} `this`
423 */
424EventEmitter.prototype.emit = function emit(evt) {
425    var listeners = this._listeners[evt];
426    if (listeners) {
427        var args = [],
428            i = 1;
429        for (; i < arguments.length;)
430            args.push(arguments[i++]);
431        for (i = 0; i < listeners.length;)
432            listeners[i].fn.apply(listeners[i++].ctx, args);
433    }
434    return this;
435};
436 437},{}],5:[function(require,module,exports){438"use strict";
439module.exports = fetch;
440
441var asPromise = require(1),
442    fs        = require(6);
443
444/**
445 * Node-style callback as used by {@link util.fetch}.
446 * @typedef FetchCallback
447 * @type {function}
448 * @param {?Error} error Error, if any, otherwise `null`
449 * @param {string} [contents] File contents, if there hasn't been an error
450 * @returns {undefined}
451 */
452
453/**
454 * Options as used by {@link util.fetch}.
455 * @interface IFetchOptions
456 * @property {boolean} [binary=false] Whether expecting a binary response
457 * @property {boolean} [xhr=false] If `true`, forces the use of XMLHttpRequest
458 */
459
460/**
461 * Fetches the contents of a file.
462 * @memberof util
463 * @param {string} filename File path or url
464 * @param {IFetchOptions} options Fetch options
465 * @param {FetchCallback} callback Callback function
466 * @returns {undefined}
467 */
468function fetch(filename, options, callback) {
469    if (typeof options === "function") {
470        callback = options;
471        options = {};
472    } else if (!options)
473        options = {};
474
475    if (!callback)
476        return asPromise(fetch, this, filename, options); // eslint-disable-line no-invalid-this
477
478    // if a node-like filesystem is present, try it first but fall back to XHR if nothing is found.
479    if (!options.xhr && fs && fs.readFile)
480        return fs.readFile(filename, function fetchReadFileCallback(err, contents) {
481            return err && typeof XMLHttpRequest !== "undefined"
482                ? fetch.xhr(filename, options, callback)
483                : err
484                ? callback(err)
485                : callback(null, options.binary ? contents : contents.toString("utf8"));
486        });
487
488    // use the XHR version otherwise.
489    return fetch.xhr(filename, options, callback);
490}
491
492/**
493 * Fetches the contents of a file.
494 * @name util.fetch
495 * @function
496 * @param {string} path File path or url
497 * @param {FetchCallback} callback Callback function
498 * @returns {undefined}
499 * @variation 2
500 */
501
502/**
503 * Fetches the contents of a file.
504 * @name util.fetch
505 * @function
506 * @param {string} path File path or url
507 * @param {IFetchOptions} [options] Fetch options
508 * @returns {Promise<string|Uint8Array>} Promise
509 * @variation 3
510 */
511
512/**/
513fetch.xhr = function fetch_xhr(filename, options, callback) {
514    var xhr = new XMLHttpRequest();
515    xhr.onreadystatechange /* works everywhere */ = function fetchOnReadyStateChange() {
516
517        if (xhr.readyState !== 4)
518            return undefined;
519
520        // local cors security errors return status 0 / empty string, too. afaik this cannot be
521        // reliably distinguished from an actually empty file for security reasons. feel free
522        // to send a pull request if you are aware of a solution.
523        if (xhr.status !== 0 && xhr.status !== 200)
524            return callback(Error("status " + xhr.status));
525
526        // if binary data is expected, make sure that some sort of array is returned, even if
527        // ArrayBuffers are not supported. the binary string fallback, however, is unsafe.
528        if (options.binary) {
529            var buffer = xhr.response;
530            if (!buffer) {
531                buffer = [];
532                for (var i = 0; i < xhr.responseText.length; ++i)
533                    buffer.push(xhr.responseText.charCodeAt(i) & 255);
534            }
535            return callback(null, typeof Uint8Array !== "undefined" ? new Uint8Array(buffer) : buffer);
536        }
537        return callback(null, xhr.responseText);
538    };
539
540    if (options.binary) {
541        // ref: https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/Sending_and_Receiving_Binary_Data#Receiving_binary_data_in_older_browsers
542        if ("overrideMimeType" in xhr)
543            xhr.overrideMimeType("text/plain; charset=x-user-defined");
544        xhr.responseType = "arraybuffer";
545    }
546
547    xhr.open("GET", filename);
548    xhr.send();
549};
550 551},{"1":1,"6":6}],6:[function(require,module,exports){552"use strict";
553
554var fs = null;
555try {
556    fs = require(11);
557    if (!fs || !fs.readFile || !fs.readFileSync)
558        fs = null;
559} catch (e) {
560    // `fs` is unavailable in browsers and browser-like bundles.
561}
562module.exports = fs;
563 564},{"11":11}],7:[function(require,module,exports){565"use strict";
566
567module.exports = factory(factory);
568
569/**
570 * Reads / writes floats / doubles from / to buffers.
571 * @name util.float
572 * @namespace
573 */
574
575/**
576 * Writes a 32 bit float to a buffer using little endian byte order.
577 * @name util.float.writeFloatLE
578 * @function
579 * @param {number} val Value to write
580 * @param {Uint8Array} buf Target buffer
581 * @param {number} pos Target buffer offset
582 * @returns {undefined}
583 */
584
585/**
586 * Writes a 32 bit float to a buffer using big endian byte order.
587 * @name util.float.writeFloatBE
588 * @function
589 * @param {number} val Value to write
590 * @param {Uint8Array} buf Target buffer
591 * @param {number} pos Target buffer offset
592 * @returns {undefined}
593 */
594
595/**
596 * Reads a 32 bit float from a buffer using little endian byte order.
597 * @name util.float.readFloatLE
598 * @function
599 * @param {Uint8Array} buf Source buffer
600 * @param {number} pos Source buffer offset
601 * @returns {number} Value read
602 */
603
604/**
605 * Reads a 32 bit float from a buffer using big endian byte order.
606 * @name util.float.readFloatBE
607 * @function
608 * @param {Uint8Array} buf Source buffer
609 * @param {number} pos Source buffer offset
610 * @returns {number} Value read
611 */
612
613/**
614 * Writes a 64 bit double to a buffer using little endian byte order.
615 * @name util.float.writeDoubleLE
616 * @function
617 * @param {number} val Value to write
618 * @param {Uint8Array} buf Target buffer
619 * @param {number} pos Target buffer offset
620 * @returns {undefined}
621 */
622
623/**
624 * Writes a 64 bit double to a buffer using big endian byte order.
625 * @name util.float.writeDoubleBE
626 * @function
627 * @param {number} val Value to write
628 * @param {Uint8Array} buf Target buffer
629 * @param {number} pos Target buffer offset
630 * @returns {undefined}
631 */
632
633/**
634 * Reads a 64 bit double from a buffer using little endian byte order.
635 * @name util.float.readDoubleLE
636 * @function
637 * @param {Uint8Array} buf Source buffer
638 * @param {number} pos Source buffer offset
639 * @returns {number} Value read
640 */
641
642/**
643 * Reads a 64 bit double from a buffer using big endian byte order.
644 * @name util.float.readDoubleBE
645 * @function
646 * @param {Uint8Array} buf Source buffer
647 * @param {number} pos Source buffer offset
648 * @returns {number} Value read
649 */
650
651// Factory function for the purpose of node-based testing in modified global environments
652function factory(exports) {
653
654    // float: typed array
655    if (typeof Float32Array !== "undefined") (function() {
656
657        var f32 = new Float32Array([ -0 ]),
658            f8b = new Uint8Array(f32.buffer),
659            le  = f8b[3] === 128;
660
661        function writeFloat_f32_cpy(val, buf, pos) {
662            f32[0] = val;
663            buf[pos    ] = f8b[0];
664            buf[pos + 1] = f8b[1];
665            buf[pos + 2] = f8b[2];
666            buf[pos + 3] = f8b[3];
667        }
668
669        function writeFloat_f32_rev(val, buf, pos) {
670            f32[0] = val;
671            buf[pos    ] = f8b[3];
672            buf[pos + 1] = f8b[2];
673            buf[pos + 2] = f8b[1];
674            buf[pos + 3] = f8b[0];
675        }
676
677        /* istanbul ignore next */
678        exports.writeFloatLE = le ? writeFloat_f32_cpy : writeFloat_f32_rev;
679        /* istanbul ignore next */
680        exports.writeFloatBE = le ? writeFloat_f32_rev : writeFloat_f32_cpy;
681
682        function readFloat_f32_cpy(buf, pos) {
683            f8b[0] = buf[pos    ];
684            f8b[1] = buf[pos + 1];
685            f8b[2] = buf[pos + 2];
686            f8b[3] = buf[pos + 3];
687            return f32[0];
688        }
689
690        function readFloat_f32_rev(buf, pos) {
691            f8b[3] = buf[pos    ];
692            f8b[2] = buf[pos + 1];
693            f8b[1] = buf[pos + 2];
694            f8b[0] = buf[pos + 3];
695            return f32[0];
696        }
697
698        /* istanbul ignore next */
699        exports.readFloatLE = le ? readFloat_f32_cpy : readFloat_f32_rev;
700        /* istanbul ignore next */
701        exports.readFloatBE = le ? readFloat_f32_rev : readFloat_f32_cpy;
702
703    // float: ieee754
704    })(); else (function() {
705
706        function writeFloat_ieee754(writeUint, val, buf, pos) {
707            var sign = val < 0 ? 1 : 0;
708            if (sign)
709                val = -val;
710            if (val === 0)
711                writeUint(1 / val > 0 ? /* positive */ 0 : /* negative 0 */ 2147483648, buf, pos);
712            else if (isNaN(val))
713                writeUint(2143289344, buf, pos);
714            else if (val > 3.4028234663852886e+38) // +-Infinity
715                writeUint((sign << 31 | 2139095040) >>> 0, buf, pos);
716            else if (val < 1.1754943508222875e-38) // denormal
717                writeUint((sign << 31 | Math.round(val / 1.401298464324817e-45)) >>> 0, buf, pos);
718            else {
719                var exponent = Math.floor(Math.log(val) / Math.LN2),
720                    mantissa = Math.round(val * Math.pow(2, -exponent) * 8388608) & 8388607;
721                writeUint((sign << 31 | exponent + 127 << 23 | mantissa) >>> 0, buf, pos);
722            }
723        }
724
725        exports.writeFloatLE = writeFloat_ieee754.bind(null, writeUintLE);
726        exports.writeFloatBE = writeFloat_ieee754.bind(null, writeUintBE);
727
728        function readFloat_ieee754(readUint, buf, pos) {
729            var uint = readUint(buf, pos),
730                sign = (uint >> 31) * 2 + 1,
731                exponent = uint >>> 23 & 255,
732                mantissa = uint & 8388607;
733            return exponent === 255
734                ? mantissa
735                ? NaN
736                : sign * Infinity
737                : exponent === 0 // denormal
738                ? sign * 1.401298464324817e-45 * mantissa
739                : sign * Math.pow(2, exponent - 150) * (mantissa + 8388608);
740        }
741
742        exports.readFloatLE = readFloat_ieee754.bind(null, readUintLE);
743        exports.readFloatBE = readFloat_ieee754.bind(null, readUintBE);
744
745    })();
746
747    // double: typed array
748    if (typeof Float64Array !== "undefined") (function() {
749
750        var f64 = new Float64Array([-0]),
751            f8b = new Uint8Array(f64.buffer),
752            le  = f8b[7] === 128;
753
754        function writeDouble_f64_cpy(val, buf, pos) {
755            f64[0] = val;
756            buf[pos    ] = f8b[0];
757            buf[pos + 1] = f8b[1];
758            buf[pos + 2] = f8b[2];
759            buf[pos + 3] = f8b[3];
760            buf[pos + 4] = f8b[4];
761            buf[pos + 5] = f8b[5];
762            buf[pos + 6] = f8b[6];
763            buf[pos + 7] = f8b[7];
764        }
765
766        function writeDouble_f64_rev(val, buf, pos) {
767            f64[0] = val;
768            buf[pos    ] = f8b[7];
769            buf[pos + 1] = f8b[6];
770            buf[pos + 2] = f8b[5];
771            buf[pos + 3] = f8b[4];
772            buf[pos + 4] = f8b[3];
773            buf[pos + 5] = f8b[2];
774            buf[pos + 6] = f8b[1];
775            buf[pos + 7] = f8b[0];
776        }
777
778        /* istanbul ignore next */
779        exports.writeDoubleLE = le ? writeDouble_f64_cpy : writeDouble_f64_rev;
780        /* istanbul ignore next */
781        exports.writeDoubleBE = le ? writeDouble_f64_rev : writeDouble_f64_cpy;
782
783        function readDouble_f64_cpy(buf, pos) {
784            f8b[0] = buf[pos    ];
785            f8b[1] = buf[pos + 1];
786            f8b[2] = buf[pos + 2];
787            f8b[3] = buf[pos + 3];
788            f8b[4] = buf[pos + 4];
789            f8b[5] = buf[pos + 5];
790            f8b[6] = buf[pos + 6];
791            f8b[7] = buf[pos + 7];
792            return f64[0];
793        }
794
795        function readDouble_f64_rev(buf, pos) {
796            f8b[7] = buf[pos    ];
797            f8b[6] = buf[pos + 1];
798            f8b[5] = buf[pos + 2];
799            f8b[4] = buf[pos + 3];
800            f8b[3] = buf[pos + 4];
801            f8b[2] = buf[pos + 5];
802            f8b[1] = buf[pos + 6];
803            f8b[0] = buf[pos + 7];
804            return f64[0];
805        }
806
807        /* istanbul ignore next */
808        exports.readDoubleLE = le ? readDouble_f64_cpy : readDouble_f64_rev;
809        /* istanbul ignore next */
810        exports.readDoubleBE = le ? readDouble_f64_rev : readDouble_f64_cpy;
811
812    // double: ieee754
813    })(); else (function() {
814
815        function writeDouble_ieee754(writeUint, off0, off1, val, buf, pos) {
816            var sign = val < 0 ? 1 : 0;
817            if (sign)
818                val = -val;
819            if (val === 0) {
820                writeUint(0, buf, pos + off0);
821                writeUint(1 / val > 0 ? /* positive */ 0 : /* negative 0 */ 2147483648, buf, pos + off1);
822            } else if (isNaN(val)) {
823                writeUint(0, buf, pos + off0);
824                writeUint(2146959360, buf, pos + off1);
825            } else if (val > 1.7976931348623157e+308) { // +-Infinity
826                writeUint(0, buf, pos + off0);
827                writeUint((sign << 31 | 2146435072) >>> 0, buf, pos + off1);
828            } else {
829                var mantissa;
830                if (val < 2.2250738585072014e-308) { // denormal
831                    mantissa = val / 5e-324;
832                    writeUint(mantissa >>> 0, buf, pos + off0);
833                    writeUint((sign << 31 | mantissa / 4294967296) >>> 0, buf, pos + off1);
834                } else {
835                    var exponent = Math.floor(Math.log(val) / Math.LN2);
836                    if (exponent === 1024)
837                        exponent = 1023;
838                    mantissa = val * Math.pow(2, -exponent);
839                    writeUint(mantissa * 4503599627370496 >>> 0, buf, pos + off0);
840                    writeUint((sign << 31 | exponent + 1023 << 20 | mantissa * 1048576 & 1048575) >>> 0, buf, pos + off1);
841                }
842            }
843        }
844
845        exports.writeDoubleLE = writeDouble_ieee754.bind(null, writeUintLE, 0, 4);
846        exports.writeDoubleBE = writeDouble_ieee754.bind(null, writeUintBE, 4, 0);
847
848        function readDouble_ieee754(readUint, off0, off1, buf, pos) {
849            var lo = readUint(buf, pos + off0),
850                hi = readUint(buf, pos + off1);
851            var sign = (hi >> 31) * 2 + 1,
852                exponent = hi >>> 20 & 2047,
853                mantissa = 4294967296 * (hi & 1048575) + lo;
854            return exponent === 2047
855                ? mantissa
856                ? NaN
857                : sign * Infinity
858                : exponent === 0 // denormal
859                ? sign * 5e-324 * mantissa
860                : sign * Math.pow(2, exponent - 1075) * (mantissa + 4503599627370496);
861        }
862
863        exports.readDoubleLE = readDouble_ieee754.bind(null, readUintLE, 0, 4);
864        exports.readDoubleBE = readDouble_ieee754.bind(null, readUintBE, 4, 0);
865
866    })();
867
868    return exports;
869}
870
871// uint helpers
872
873function writeUintLE(val, buf, pos) {
874    buf[pos    ] =  val        & 255;
875    buf[pos + 1] =  val >>> 8  & 255;
876    buf[pos + 2] =  val >>> 16 & 255;
877    buf[pos + 3] =  val >>> 24;
878}
879
880function writeUintBE(val, buf, pos) {
881    buf[pos    ] =  val >>> 24;
882    buf[pos + 1] =  val >>> 16 & 255;
883    buf[pos + 2] =  val >>> 8  & 255;
884    buf[pos + 3] =  val        & 255;
885}
886
887function readUintLE(buf, pos) {
888    return (buf[pos    ]
889          | buf[pos + 1] << 8
890          | buf[pos + 2] << 16
891          | buf[pos + 3] << 24) >>> 0;
892}
893
894function readUintBE(buf, pos) {
895    return (buf[pos    ] << 24
896          | buf[pos + 1] << 16
897          | buf[pos + 2] << 8
898          | buf[pos + 3]) >>> 0;
899}
900 901},{}],8:[function(require,module,exports){902"use strict";
903
904/**
905 * A minimal path module to resolve Unix, Windows and URL paths alike.
906 * @memberof util
907 * @namespace
908 */
909var path = exports;
910
911var isAbsolute =
912/**
913 * Tests if the specified path is absolute.
914 * @param {string} path Path to test
915 * @returns {boolean} `true` if path is absolute
916 */
917path.isAbsolute = function isAbsolute(path) {
918    return /^(?:\/|\w+:)/.test(path);
919};
920
921var normalize =
922/**
923 * Normalizes the specified path.
924 * @param {string} path Path to normalize
925 * @returns {string} Normalized path
926 */
927path.normalize = function normalize(path) {
928    path = path.replace(/\\/g, "/")
929               .replace(/\/{2,}/g, "/");
930    var parts    = path.split("/"),
931        absolute = isAbsolute(path),
932        prefix   = "";
933    if (absolute)
934        prefix = parts.shift() + "/";
935    for (var i = 0; i < parts.length;) {
936        if (parts[i] === "..") {
937            if (i > 0 && parts[i - 1] !== "..")
938                parts.splice(--i, 2);
939            else if (absolute)
940                parts.splice(i, 1);
941            else
942                ++i;
943        } else if (parts[i] === ".")
944            parts.splice(i, 1);
945        else
946            ++i;
947    }
948    return prefix + parts.join("/");
949};
950
951/**
952 * Resolves the specified include path against the specified origin path.
953 * @param {string} originPath Path to the origin file
954 * @param {string} includePath Include path relative to origin path
955 * @param {boolean} [alreadyNormalized=false] `true` if both paths are already known to be normalized
956 * @returns {string} Path to the include file
957 */
958path.resolve = function resolve(originPath, includePath, alreadyNormalized) {
959    if (!alreadyNormalized)
960        includePath = normalize(includePath);
961    if (isAbsolute(includePath))
962        return includePath;
963    if (!alreadyNormalized)
964        originPath = normalize(originPath);
965    return (originPath = originPath.replace(/(?:\/|^)[^/]+$/, "")).length ? normalize(originPath + "/" + includePath) : includePath;
966};
967 968},{}],9:[function(require,module,exports){969"use strict";
970module.exports = pool;
971
972/**
973 * An allocator as used by {@link util.pool}.
974 * @typedef PoolAllocator
975 * @type {function}
976 * @param {number} size Buffer size
977 * @returns {Uint8Array} Buffer
978 */
979
980/**
981 * A slicer as used by {@link util.pool}.
982 * @typedef PoolSlicer
983 * @type {function}
984 * @param {number} start Start offset
985 * @param {number} end End offset
986 * @returns {Uint8Array} Buffer slice
987 * @this {Uint8Array}
988 */
989
990/**
991 * A general purpose buffer pool.
992 * @memberof util
993 * @function
994 * @param {PoolAllocator} alloc Allocator
995 * @param {PoolSlicer} slice Slicer
996 * @param {number} [size=8192] Slab size
997 * @returns {PoolAllocator} Pooled allocator
998 */
999function pool(alloc, slice, size) {
1000    var SIZE   = size || 8192;
1001    var MAX    = SIZE >>> 1;
1002    var slab   = null;
1003    var offset = SIZE;
1004    return function pool_alloc(size) {
1005        if (size < 1 || size > MAX)
1006            return alloc(size);
1007        if (offset + size > SIZE) {
1008            slab = alloc(SIZE);
1009            offset = 0;
1010        }
1011        var buf = slice.call(slab, offset, offset += size);
1012        if (offset & 7) // align to 32 bit
1013            offset = (offset | 7) + 1;
1014        return buf;
1015    };
1016}
1017 1018},{}],10:[function(require,module,exports){1019"use strict";
1020
1021/**
1022 * A minimal UTF8 implementation for number arrays.
1023 * @memberof util
1024 * @namespace
1025 */
1026var utf8 = exports,
1027    replacementChar = "\ufffd";
1028
1029/**
1030 * Calculates the UTF8 byte length of a string.
1031 * @param {string} string String
1032 * @returns {number} Byte length
1033 */
1034utf8.length = function utf8_length(string) {
1035    var len = 0,
1036        c = 0;
1037    for (var i = 0; i < string.length; ++i) {
1038        c = string.charCodeAt(i);
1039        if (c < 128)
1040            len += 1;
1041        else if (c < 2048)
1042            len += 2;
1043        else if ((c & 0xFC00) === 0xD800 && (string.charCodeAt(i + 1) & 0xFC00) === 0xDC00) {
1044            ++i;
1045            len += 4;
1046        } else
1047            len += 3;
1048    }
1049    return len;
1050};
1051
1052/**
1053 * Reads UTF8 bytes as a string.
1054 * @param {Uint8Array} buffer Source buffer
1055 * @param {number} start Source start
1056 * @param {number} end Source end
1057 * @returns {string} String read
1058 */
1059utf8.read = function utf8_read(buffer, start, end) {
1060    if (end - start < 1) {
1061        return "";
1062    }
1063
1064    var str = "";
1065    for (var i = start; i < end;) {
1066        var t = buffer[i++];
1067        if (t <= 0x7F) {
1068            str += String.fromCharCode(t);
1069        } else if (t >= 0xC0 && t < 0xE0) {
1070            var c2 = (t & 0x1F) << 6 | buffer[i++] & 0x3F;
1071            str += c2 >= 0x80 ? String.fromCharCode(c2) : replacementChar;
1072        } else if (t >= 0xE0 && t < 0xF0) {
1073            var c3 = (t & 0xF) << 12 | (buffer[i++] & 0x3F) << 6 | buffer[i++] & 0x3F;
1074            str += c3 >= 0x800 ? String.fromCharCode(c3) : replacementChar;
1075        } else if (t >= 0xF0) {
1076            var t2 = (t & 7) << 18 | (buffer[i++] & 0x3F) << 12 | (buffer[i++] & 0x3F) << 6 | buffer[i++] & 0x3F;
1077            if (t2 < 0x10000 || t2 > 0x10FFFF)
1078                str += replacementChar;
1079            else {
1080                t2 -= 0x10000;
1081                str += String.fromCharCode(0xD800 + (t2 >> 10));
1082                str += String.fromCharCode(0xDC00 + (t2 & 0x3FF));
1083            }
1084        }
1085    }
1086
1087    return str;
1088};
1089
1090/**
1091 * Writes a string as UTF8 bytes.
1092 * @param {string} string Source string
1093 * @param {Uint8Array} buffer Destination buffer
1094 * @param {number} offset Destination offset
1095 * @returns {number} Bytes written
1096 */
1097utf8.write = function utf8_write(string, buffer, offset) {
1098    var start = offset,
1099        c1, // character 1
1100        c2; // character 2
1101    for (var i = 0; i < string.length; ++i) {
1102        c1 = string.charCodeAt(i);
1103        if (c1 < 128) {
1104            buffer[offset++] = c1;
1105        } else if (c1 < 2048) {
1106            buffer[offset++] = c1 >> 6       | 192;
1107            buffer[offset++] = c1       & 63 | 128;
1108        } else if ((c1 & 0xFC00) === 0xD800 && ((c2 = string.charCodeAt(i + 1)) & 0xFC00) === 0xDC00) {
1109            c1 = 0x10000 + ((c1 & 0x03FF) << 10) + (c2 & 0x03FF);
1110            ++i;
1111            buffer[offset++] = c1 >> 18      | 240;
1112            buffer[offset++] = c1 >> 12 & 63 | 128;
1113            buffer[offset++] = c1 >> 6  & 63 | 128;
1114            buffer[offset++] = c1       & 63 | 128;
1115        } else {
1116            buffer[offset++] = c1 >> 12      | 224;
1117            buffer[offset++] = c1 >> 6  & 63 | 128;
1118            buffer[offset++] = c1       & 63 | 128;
1119        }
1120    }
1121    return offset - start;
1122};
1123 1124},{}],11:[function(require,module,exports){1125 1126},{}],12:[function(require,module,exports){1127"use strict";1128/**1129 * Runtime message from/to plain object converters.1130 * @namespace1131 */1132var converter = exports;1133 1134var Enum = require(15),1135    util = require(34);1136 1137/**1138 * Generates a partial value fromObject conveter.1139 * @param {Codegen} gen Codegen instance1140 * @param {Field} field Reflected field1141 * @param {number} fieldIndex Field index1142 * @param {string} prop Property reference1143 * @returns {Codegen} Codegen instance1144 * @ignore1145 */1146function genValuePartial_fromObject(gen, field, fieldIndex, prop) {1147    var defaultAlreadyEmitted = false;1148    /* eslint-disable no-unexpected-multiline, block-scoped-var, no-redeclare */1149    if (field.resolvedType) {1150        if (field.resolvedType instanceof Enum) { gen1151            ("switch(d%s){", prop);1152            for (var values = field.resolvedType.values, keys = Object.keys(values), i = 0; i < keys.length; ++i) {1153                // enum unknown values passthrough1154                if (values[keys[i]] === field.typeDefault && !defaultAlreadyEmitted) { gen1155                    ("default:")1156                        ("if(typeof(d%s)===\"number\"){m%s=d%s;break}", prop, prop, prop);1157                    if (!field.repeated) gen // fallback to default value only for1158                                             // arrays, to avoid leaving holes.1159                        ("break");           // for non-repeated fields, just ignore1160                    defaultAlreadyEmitted = true;1161                }1162                gen1163                ("case%j:", keys[i])1164                ("case %i:", values[keys[i]])1165                    ("m%s=%j", prop, values[keys[i]])1166                    ("break");1167            } gen1168            ("}");1169        } else gen1170            ("if(!util.isObject(d%s))", prop)1171                ("throw TypeError(%j)", field.fullName + ": object expected")1172            ("m%s=types[%i].fromObject(d%s,n+1)", prop, fieldIndex, prop);1173    } else {1174        var isUnsigned = false;1175        switch (field.type) {1176            case "double":1177            case "float": gen1178                ("m%s=Number(d%s)", prop, prop); // also catches "NaN", "Infinity"1179                break;1180            case "uint32":1181            case "fixed32": gen1182                ("m%s=d%s>>>0", prop, prop);1183                break;1184            case "int32":1185            case "sint32":1186            case "sfixed32": gen1187                ("m%s=d%s|0", prop, prop);1188                break;1189            case "uint64":1190            case "fixed64":1191                isUnsigned = true;1192                // eslint-disable-next-line no-fallthrough1193            case "int64":1194            case "sint64":1195            case "sfixed64": gen1196                ("if(util.Long)")1197                    ("m%s=util.Long.fromValue(d%s,%j)", prop, prop, isUnsigned)1198                ("else if(typeof d%s===\"string\")", prop)1199                    ("m%s=parseInt(d%s,10)", prop, prop)1200                ("else if(typeof d%s===\"number\")", prop)

Showing the first 1,200 of 8042 lines. Download the file for the rest.

basant307/AI_Governance_Project · CoolFace