UNPKG

opal-compiler

Version:
830 lines (620 loc) 31.1 kB
Opal.modules["base64"] = function(Opal) {/* Generated by Opal 1.7.3 */ var $module = Opal.module, $defs = Opal.defs, $ensure_kwargs = Opal.ensure_kwargs, $truthy = Opal.truthy, $nesting = [], nil = Opal.nil; Opal.add_stubs('raise,delete'); return (function($base, $parent_nesting) { var self = $module($base, 'Base64'); var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; var encode, decode; // encoder // [https://gist.github.com/999166] by [https://github.com/nignag] encode = function (input) { var str = String(input); /* eslint-disable */ for ( // initialize result and counter var block, charCode, idx = 0, map = chars, output = ''; // if the next str index does not exist: // change the mapping table to "=" // check if d has no fractional digits str.charAt(idx | 0) || (map = '=', idx % 1); // "8 - idx % 1 * 8" generates the sequence 2, 4, 6, 8 output += map.charAt(63 & block >> 8 - idx % 1 * 8) ) { charCode = str.charCodeAt(idx += 3/4); if (charCode > 0xFF) { self.$raise($$('ArgumentError'), "invalid character (failed: The string to be encoded contains characters outside of the Latin1 range.)"); } block = block << 8 | charCode; } return output; /* eslint-enable */ }; // decoder // [https://gist.github.com/1020396] by [https://github.com/atk] decode = function (input) { var str = String(input).replace(/=+$/, ''); if (str.length % 4 == 1) { self.$raise($$('ArgumentError'), "invalid base64 (failed: The string to be decoded is not correctly encoded.)"); } /* eslint-disable */ for ( // initialize result and counters var bc = 0, bs, buffer, idx = 0, output = ''; // get next character buffer = str.charAt(idx++); // character found in table? initialize bit storage and add its ascii value; ~buffer && (bs = bc % 4 ? bs * 64 + buffer : buffer, // and if not first of each 4 characters, // convert the first 8 bits to one ascii character bc++ % 4) ? output += String.fromCharCode(255 & bs >> (-2 * bc & 6)) : 0 ) { // try to find character in table (0-63, not found => -1) buffer = chars.indexOf(buffer); } return output; /* eslint-enable */ }; ; $defs(self, '$decode64', function $$decode64(string) { return decode(string.replace(/\r?\n/g, '')); }); $defs(self, '$encode64', function $$encode64(string) { return encode(string).replace(/(.{60})/g, "$1\n").replace(/([^\n])$/g, "$1\n"); }); $defs(self, '$strict_decode64', function $$strict_decode64(string) { return decode(string); }); $defs(self, '$strict_encode64', function $$strict_encode64(string) { return encode(string); }); $defs(self, '$urlsafe_decode64', function $$urlsafe_decode64(string) { return decode(string.replace(/\-/g, '+').replace(/_/g, '/')); }); return $defs(self, '$urlsafe_encode64', function $$urlsafe_encode64(string, $kwargs) { var padding, str = nil; $kwargs = $ensure_kwargs($kwargs); padding = $kwargs.$$smap["padding"];if (padding == null) padding = true; str = encode(string).replace(/\+/g, '-').replace(/\//g, '_'); if (!$truthy(padding)) { str = str.$delete("=") }; return str; }, -2); })($nesting[0], $nesting) }; Opal.modules["json"] = function(Opal) {/* Generated by Opal 1.7.3 */ var $module = Opal.module, $klass = Opal.klass, $send = Opal.send, $Object = Opal.Object, $hash2 = Opal.hash2, $eqeqeq = Opal.eqeqeq, $defs = Opal.defs, $truthy = Opal.truthy, $def = Opal.def, $return_val = Opal.return_val, $nesting = [], nil = Opal.nil, $$$ = Opal.$$$; Opal.add_stubs('raise,new,push,[]=,[],create_id,json_create,const_get,attr_accessor,create_id=,===,parse,generate,from_object,merge,to_json,responds_to?,to_io,write,to_s,to_a,strftime'); (function($base, $parent_nesting) { var self = $module($base, 'JSON'); var $a, $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); $klass($nesting[0], $$('StandardError'), 'JSONError'); $klass($nesting[0], $$('JSONError'), 'ParserError'); var $hasOwn = Opal.hasOwnProperty; function $parse(source) { try { return JSON.parse(source); } catch (e) { self.$raise($$$($$('JSON'), 'ParserError'), e.message); } }; function to_opal(value, options) { var klass, arr, hash, i, ii, k; switch (typeof value) { case 'string': return value; case 'number': return value; case 'boolean': return !!value; case 'undefined': return nil; case 'object': if (!value) return nil; if (value.$$is_array) { arr = (options.array_class).$new(); for (i = 0, ii = value.length; i < ii; i++) { (arr).$push(to_opal(value[i], options)); } return arr; } else { hash = (options.object_class).$new(); for (k in value) { if ($hasOwn.call(value, k)) { ($a = [k, to_opal(value[k], options)], $send((hash), '[]=', $a), $a[$a.length - 1]); } } if (!options.parse && (klass = (hash)['$[]']($$('JSON').$create_id())) != nil) { return $Object.$const_get(klass).$json_create(hash); } else { return hash; } } } }; ; (function(self, $parent_nesting) { return self.$attr_accessor("create_id") })(Opal.get_singleton_class(self), $nesting); self['$create_id=']("json_class"); $defs(self, '$[]', function $JSON_$$$1(value, options) { var self = this; if (options == null) options = $hash2([], {}); if ($eqeqeq($$('String'), value)) { return self.$parse(value, options) } else { return self.$generate(value, options) }; }, -2); $defs(self, '$parse', function $$parse(source, options) { var self = this; if (options == null) options = $hash2([], {}); return self.$from_object($parse(source), options.$merge($hash2(["parse"], {"parse": true}))); }, -2); $defs(self, '$parse!', function $JSON_parse$excl$2(source, options) { var self = this; if (options == null) options = $hash2([], {}); return self.$parse(source, options); }, -2); $defs(self, '$load', function $$load(source, options) { var self = this; if (options == null) options = $hash2([], {}); return self.$from_object($parse(source), options); }, -2); $defs(self, '$from_object', function $$from_object(js_object, options) { var $ret_or_1 = nil; if (options == null) options = $hash2([], {}); if ($truthy(($ret_or_1 = options['$[]']("object_class")))) { $ret_or_1 } else { options['$[]=']("object_class", $$('Hash')) }; if ($truthy(($ret_or_1 = options['$[]']("array_class")))) { $ret_or_1 } else { options['$[]=']("array_class", $$('Array')) }; return to_opal(js_object, options.$$smap);; }, -2); $defs(self, '$generate', function $$generate(obj, options) { if (options == null) options = $hash2([], {}); return obj.$to_json(options); }, -2); return $defs(self, '$dump', function $$dump(obj, io, limit) { var self = this, string = nil; if (io == null) io = nil; if (limit == null) limit = nil; string = self.$generate(obj); if ($truthy(io)) { if ($truthy(io['$responds_to?']("to_io"))) { io = io.$to_io() }; io.$write(string); return io; } else { return string }; }, -2); })($nesting[0], $nesting); (function($base, $super) { var self = $klass($base, $super, 'Object'); return $def(self, '$to_json', function $$to_json() { var self = this; return self.$to_s().$to_json() }) })($nesting[0], null); (function($base) { var self = $module($base, 'Enumerable'); return $def(self, '$to_json', function $$to_json() { var self = this; return self.$to_a().$to_json() }) })($nesting[0]); (function($base, $super) { var self = $klass($base, $super, 'Array'); return $def(self, '$to_json', function $$to_json() { var self = this; var result = []; for (var i = 0, length = self.length; i < length; i++) { result.push((self[i]).$to_json()); } return '[' + result.join(',') + ']'; }) })($nesting[0], null); (function($base, $super) { var self = $klass($base, $super, 'Boolean'); return $def(self, '$to_json', function $$to_json() { var self = this; return (self == true) ? 'true' : 'false'; }) })($nesting[0], null); (function($base, $super) { var self = $klass($base, $super, 'Hash'); return $def(self, '$to_json', function $$to_json() { var self = this; var result = []; for (var i = 0, keys = self.$$keys, length = keys.length, key, value; i < length; i++) { key = keys[i]; if (key.$$is_string) { value = self.$$smap[key]; } else { value = key.value; key = key.key; } result.push((key).$to_s().$to_json() + ':' + (value).$to_json()); } return '{' + result.join(',') + '}'; }) })($nesting[0], null); (function($base, $super) { var self = $klass($base, $super, 'NilClass'); return $def(self, '$to_json', $return_val("null")) })($nesting[0], null); (function($base, $super) { var self = $klass($base, $super, 'Numeric'); return $def(self, '$to_json', function $$to_json() { var self = this; return self.toString(); }) })($nesting[0], null); (function($base, $super) { var self = $klass($base, $super, 'String'); return $def(self, '$to_json', function $$to_json() { var self = this; return JSON.stringify(self); }) })($nesting[0], null); (function($base, $super) { var self = $klass($base, $super, 'Time'); return $def(self, '$to_json', function $$to_json() { var self = this; return self.$strftime("%FT%T%z").$to_json() }) })($nesting[0], null); return (function($base, $super) { var self = $klass($base, $super, 'Date'); $def(self, '$to_json', function $$to_json() { var self = this; return self.$to_s().$to_json() }); return $def(self, '$as_json', function $$as_json() { var self = this; return self.$to_s() }); })($nesting[0], null); }; Opal.modules["opal/source_map/map"] = function(Opal) {/* Generated by Opal 1.7.3 */ var $module = Opal.module, $truthy = Opal.truthy, $def = Opal.def, $send = Opal.send, $slice = Opal.slice, $to_ary = Opal.to_ary, self = Opal.top, $nesting = [], $$ = Opal.$r($nesting), nil = Opal.nil, $$$ = Opal.$$$; Opal.add_stubs('require,map,to_h,to_json,each,[],delete,to_s,encode64,generated_code'); self.$require("base64"); self.$require("json"); return (function($base, $parent_nesting) { var self = $module($base, 'Map'); var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); $def(self, '$to_h', function $$to_h() { var self = this, $ret_or_1 = nil; if (self.to_h == null) self.to_h = nil; if ($truthy(($ret_or_1 = self.to_h))) { return $ret_or_1 } else { return self.$map() } }); $def(self, '$to_json', function $$to_json() { var self = this, map = nil; try { map = self.$to_h(); return map.$to_json(); } catch ($err) { if (Opal.rescue($err, [$$$($$('Encoding'), 'UndefinedConversionError')])) { try { $send(map['$[]']("sections"), 'each', [], function $$1(i){ if (i == null) i = nil; try { return i.$to_json() } catch ($err) { if (Opal.rescue($err, [$$$($$('Encoding'), 'UndefinedConversionError')])) { try { return map['$[]']("sections").$delete(i) } finally { Opal.pop_exception(); } } else { throw $err; } };}); return map.$to_json(); } finally { Opal.pop_exception(); } } else { throw $err; } } }); $def(self, '$as_json', function $$as_json($a) { var $post_args, $fwd_rest, self = this; $post_args = $slice(arguments); $fwd_rest = $post_args; return self.$to_h(); }, -1); $def(self, '$to_s', function $$to_s() { var self = this; return self.$to_h().$to_s() }); $def(self, '$to_data_uri_comment', function $$to_data_uri_comment() { var self = this; return "//# sourceMappingURL=data:application/json;base64," + ($$('Base64').$encode64(self.$to_json()).$delete("\n")) }); $def(self, '$cache', function $$cache() { var self = this, $ret_or_1 = nil; if (self.to_h == null) self.to_h = nil; self.to_h = ($truthy(($ret_or_1 = self.to_h)) ? ($ret_or_1) : (self.$map())); return self; }); $def(self, '$marshal_dump', function $$marshal_dump() { var self = this; return [self.$to_h(), self.$generated_code()] }); return $def(self, '$marshal_load', function $$marshal_load(value) { var $a, $b, self = this; return $b = value, $a = $to_ary($b), (self.to_h = ($a[0] == null ? nil : $a[0])), (self.generated_code = ($a[1] == null ? nil : $a[1])), $b }); })($$$($$('Opal'), 'SourceMap'), $nesting); }; Opal.modules["opal/source_map/file"] = function(Opal) {/* Generated by Opal 1.7.3 */ var $klass = Opal.klass, $send = Opal.send, $def = Opal.def, $truthy = Opal.truthy, $ensure_kwargs = Opal.ensure_kwargs, $hash2 = Opal.hash2, $eqeq = Opal.eqeq, $rb_minus = Opal.rb_minus, $rb_lt = Opal.rb_lt, $to_ary = Opal.to_ary, $rb_plus = Opal.rb_plus, $not = Opal.not, $nesting = [], $$ = Opal.$r($nesting), nil = Opal.nil, $$$ = Opal.$$$; Opal.add_stubs('include,attr_reader,new,[]=,size,join,map,to_proc,file,==,encoding,source,encode,names,encode_mappings,relative_mappings,absolute_mappings,sort_by,to_a,-,line,<,column,source_map_name,[],to_s,to_int,each,fragments_by_line,skip_source_map?,is_a?,<<,segment_from_fragment,+,private,flat_map,fragments,code,match?,split,with_index,!,zero?,last'); return (function($base, $super, $parent_nesting) { var self = $klass($base, $super, 'File'); var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting), $proto = self.$$prototype; $proto.generated_code = $proto.fragments = $proto.names = $proto.names_map = $proto.relative_mappings = $proto.absolute_mappings = nil; self.$include($$$($$$($$('Opal'), 'SourceMap'), 'Map')); self.$attr_reader("fragments"); self.$attr_reader("file"); self.$attr_reader("source"); $def(self, '$initialize', function $$initialize(fragments, file, source, generated_code) { var self = this; if (generated_code == null) generated_code = nil; self.fragments = fragments; self.file = file; self.source = source; self.names_map = $send($$('Hash'), 'new', [], function $$1(hash, name){var $a; if (hash == null) hash = nil; if (name == null) name = nil; return ($a = [name, hash.$size()], $send(hash, '[]=', $a), $a[$a.length - 1]);}); self.generated_code = generated_code; return (self.absolute_mappings = nil); }, -4); $def(self, '$generated_code', function $$generated_code() { var self = this, $ret_or_1 = nil; return (self.generated_code = ($truthy(($ret_or_1 = self.generated_code)) ? ($ret_or_1) : ($send(self.fragments, 'map', [], "code".$to_proc()).$join()))) }); $def(self, '$map', function $$map($kwargs) { var source_root, self = this; $kwargs = $ensure_kwargs($kwargs); source_root = $kwargs.$$smap["source_root"];if (source_root == null) source_root = ""; return $hash2(["version", "sourceRoot", "sources", "sourcesContent", "names", "mappings"], {"version": 3, "sourceRoot": source_root, "sources": [self.$file()], "sourcesContent": [($eqeq(self.$source().$encoding(), $$$($$('Encoding'), 'UTF_8')) ? (self.$source()) : (self.$source().$encode("UTF-8", $hash2(["undef"], {"undef": "replace"}))))], "names": self.$names(), "mappings": $$$($$$($$('Opal'), 'SourceMap'), 'VLQ').$encode_mappings(self.$relative_mappings())}); }, -1); $def(self, '$names', function $$names() { var self = this, $ret_or_1 = nil; return (self.names = ($truthy(($ret_or_1 = self.names)) ? ($ret_or_1) : ((self.$absolute_mappings(), $send($send(self.names_map.$to_a(), 'sort_by', [], function $$2(_, index){ if (_ == null) _ = nil; if (index == null) index = nil; return index;}), 'map', [], function $$3(name, _){ if (name == null) name = nil; if (_ == null) _ = nil; return name;}))))) }); $def(self, '$segment_from_fragment', function $$segment_from_fragment(fragment, generated_column) { var $a, self = this, source_index = nil, original_line = nil, $ret_or_1 = nil, original_column = nil, map_name_index = nil; source_index = 0; original_line = $rb_minus(($truthy(($ret_or_1 = fragment.$line())) ? ($ret_or_1) : (0)), 1); if ($truthy($rb_lt(original_line, 0))) { original_line = 0 }; original_column = ($truthy(($ret_or_1 = fragment.$column())) ? ($ret_or_1) : (0)); if ($truthy(fragment.$source_map_name())) { map_name_index = ($truthy(($ret_or_1 = self.names_map['$[]'](fragment.$source_map_name().$to_s()))) ? ($ret_or_1) : (($a = [fragment.$source_map_name().$to_s(), self.names_map.$size()], $send(self.names_map, '[]=', $a), $a[$a.length - 1]))); return [generated_column, source_index, original_line, original_column, map_name_index]; } else { return [generated_column, source_index, original_line, original_column] }; }); $def(self, '$relative_mappings', function $$relative_mappings() { var self = this, $ret_or_1 = nil, reference_segment = nil, reference_name_index = nil; return (self.relative_mappings = ($truthy(($ret_or_1 = self.relative_mappings)) ? ($ret_or_1) : (((reference_segment = [0, 0, 0, 0, 0]), (reference_name_index = 0), $send(self.$absolute_mappings(), 'map', [], function $$4(absolute_mapping){ if (absolute_mapping == null) absolute_mapping = nil; reference_segment['$[]='](0, 0); return $send(absolute_mapping, 'map', [], function $$5(absolute_segment){var segment = nil, $ret_or_2 = nil; if (absolute_segment == null) absolute_segment = nil; segment = []; segment['$[]='](0, $rb_minus(absolute_segment['$[]'](0), reference_segment['$[]'](0))); segment['$[]='](1, $rb_minus(absolute_segment['$[]'](1), ($truthy(($ret_or_2 = reference_segment['$[]'](1))) ? ($ret_or_2) : (0)))); segment['$[]='](2, $rb_minus(absolute_segment['$[]'](2), ($truthy(($ret_or_2 = reference_segment['$[]'](2))) ? ($ret_or_2) : (0)))); segment['$[]='](3, $rb_minus(absolute_segment['$[]'](3), ($truthy(($ret_or_2 = reference_segment['$[]'](3))) ? ($ret_or_2) : (0)))); if ($truthy(absolute_segment['$[]'](4))) { segment['$[]='](4, $rb_minus(absolute_segment['$[]'](4).$to_int(), ($truthy(($ret_or_2 = reference_segment['$[]'](4))) ? ($ret_or_2) : (reference_name_index)).$to_int())); reference_name_index = absolute_segment['$[]'](4); }; reference_segment = absolute_segment; return segment;});}))))) }); $def(self, '$absolute_mappings', function $$absolute_mappings() { var self = this, $ret_or_1 = nil, mappings = nil; return (self.absolute_mappings = ($truthy(($ret_or_1 = self.absolute_mappings)) ? ($ret_or_1) : (((mappings = []), $send(self.$fragments_by_line(), 'each', [], function $$6(raw_segments){var self = $$6.$$s == null ? this : $$6.$$s, generated_column = nil, segments = nil; if (raw_segments == null) raw_segments = nil; generated_column = 0; segments = []; $send(raw_segments, 'each', [], function $$7($mlhs_tmp1){var $a, $b, self = $$7.$$s == null ? this : $$7.$$s, generated_code = nil, fragment = nil; if ($mlhs_tmp1 == null) $mlhs_tmp1 = nil; $b = $mlhs_tmp1, $a = $to_ary($b), (generated_code = ($a[0] == null ? nil : $a[0])), (fragment = ($a[1] == null ? nil : $a[1])), $b; if (!($truthy(fragment['$is_a?']($$$($$('Opal'), 'Fragment'))) && ($truthy(fragment['$skip_source_map?']())))) { segments['$<<'](self.$segment_from_fragment(fragment, generated_column)) }; return (generated_column = $rb_plus(generated_column, generated_code.$size()));}, {$$s: self, $$has_top_level_mlhs_arg: true}); return mappings['$<<'](segments);}, {$$s: self}), mappings)))) }); self.$private(); return $def(self, '$fragments_by_line', function $$fragments_by_line() { var self = this, raw_mappings = nil; raw_mappings = [[]]; $send(self.$fragments(), 'flat_map', [], function $$8(fragment){var fragment_code = nil, splitter = nil, fragment_lines = nil; if (fragment == null) fragment = nil; fragment_code = fragment.$code(); splitter = ($truthy(/\r/['$match?'](fragment_code)) ? (/\r?\n/) : ("\n")); fragment_lines = fragment_code.$split(splitter, -1); return $send(fragment_lines.$each(), 'with_index', [], function $$9(fragment_line, index){var raw_segment = nil; if (fragment_line == null) fragment_line = nil; if (index == null) index = nil; raw_segment = [fragment_line, fragment]; if (($truthy(index['$zero?']()) && ($not(fragment_line.$size()['$zero?']())))) { return raw_mappings.$last()['$<<'](raw_segment) } else if (($truthy(index['$zero?']()) && ($truthy(fragment_line.$size()['$zero?']())))) { return nil } else if ($truthy(fragment_line.$size()['$zero?']())) { return raw_mappings['$<<']([]) } else { return raw_mappings['$<<']([raw_segment]) };});}); return raw_mappings; }); })($$$($$('Opal'), 'SourceMap'), null, $nesting) }; Opal.modules["opal/source_map/index"] = function(Opal) {/* Generated by Opal 1.7.3 */ var $klass = Opal.klass, $ensure_kwargs = Opal.ensure_kwargs, $def = Opal.def, $hash2 = Opal.hash2, $send = Opal.send, $truthy = Opal.truthy, $rb_plus = Opal.rb_plus, $nesting = [], $$ = Opal.$r($nesting), nil = Opal.nil, $$$ = Opal.$$$; Opal.add_stubs('include,attr_reader,map,to_h,generated_code,+,count,[],rindex,size'); return (function($base, $super, $parent_nesting) { var self = $klass($base, $super, 'Index'); var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting), $proto = self.$$prototype; $proto.source_maps = nil; self.$include($$$($$$($$('Opal'), 'SourceMap'), 'Map')); self.$attr_reader("source_maps"); $def(self, '$initialize', function $$initialize(source_maps, $kwargs) { var join, self = this; $kwargs = $ensure_kwargs($kwargs); join = $kwargs.$$smap["join"];if (join == null) join = nil; self.source_maps = source_maps; return (self.join = join); }, -2); return $def(self, '$map', function $$map() { var self = this, offset_line = nil, offset_column = nil; offset_line = 0; offset_column = 0; return $hash2(["version", "sections"], {"version": 3, "sections": $send(self.source_maps, 'map', [], function $$1(source_map){var self = $$1.$$s == null ? this : $$1.$$s, map = nil, generated_code = nil, new_lines_count = nil, last_line = nil; if (self.join == null) self.join = nil; if (source_map == null) source_map = nil; map = $hash2(["offset", "map"], {"offset": $hash2(["line", "column"], {"line": offset_line, "column": offset_column}), "map": source_map.$to_h()}); generated_code = source_map.$generated_code(); if ($truthy(self.join)) { generated_code = $rb_plus(generated_code, self.join) }; new_lines_count = generated_code.$count("\n"); last_line = generated_code['$[]'](Opal.Range.$new($rb_plus(generated_code.$rindex("\n"), 1), -1, false)); offset_line = $rb_plus(offset_line, new_lines_count); offset_column = $rb_plus(offset_column, last_line.$size()); return map;}, {$$s: self})}); }); })($$$($$('Opal'), 'SourceMap'), null, $nesting) }; Opal.modules["opal/source_map/vlq"] = function(Opal) {/* Generated by Opal 1.7.3 */ var $module = Opal.module, $const_set = Opal.const_set, $rb_minus = Opal.rb_minus, $send = Opal.send, $range = Opal.range, $hash2 = Opal.hash2, $truthy = Opal.truthy, $rb_lt = Opal.rb_lt, $rb_plus = Opal.rb_plus, $rb_gt = Opal.rb_gt, $thrower = Opal.thrower, $defs = Opal.defs, $eqeq = Opal.eqeq, $nesting = [], $$ = Opal.$r($nesting), nil = Opal.nil, $$$ = Opal.$$$; Opal.add_stubs('<<,-,split,inject,[]=,[],each,<,+,-@,loop,&,>>,>,|,join,any?,shift,raise,==,map,encode,each_with_index,decode'); return (function($base, $parent_nesting) { var self = $module($base, 'VLQ'); var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); $const_set($nesting[0], 'VLQ_BASE_SHIFT', 5); $const_set($nesting[0], 'VLQ_BASE', (1)['$<<']($$('VLQ_BASE_SHIFT'))); $const_set($nesting[0], 'VLQ_BASE_MASK', $rb_minus($$('VLQ_BASE'), 1)); $const_set($nesting[0], 'VLQ_CONTINUATION_BIT', $$('VLQ_BASE')); $const_set($nesting[0], 'BASE64_DIGITS', "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".$split("")); $const_set($nesting[0], 'BASE64_VALUES', $send($range(0, 64, true), 'inject', [$hash2([], {})], function $VLQ$1(h, i){ if (h == null) h = nil; if (i == null) i = nil; h['$[]=']($$('BASE64_DIGITS')['$[]'](i), i); return h;})); $defs(self, '$encode', function $$encode(ary) { var self = this, result = nil; result = []; $send(ary, 'each', [], function $$2(n){var self = $$2.$$s == null ? this : $$2.$$s, vlq = nil; if (n == null) n = nil; vlq = ($truthy($rb_lt(n, 0)) ? ($rb_plus(n['$-@']()['$<<'](1), 1)) : (n['$<<'](1))); return (function(){try { var $t_break = $thrower('break'); return $send(self, 'loop', [], function $$3(){var digit = nil; digit = vlq['$&']($$('VLQ_BASE_MASK')); vlq = vlq['$>>']($$('VLQ_BASE_SHIFT')); if ($truthy($rb_gt(vlq, 0))) { digit = digit['$|']($$('VLQ_CONTINUATION_BIT')) }; result['$<<']($$('BASE64_DIGITS')['$[]'](digit)); if ($truthy($rb_gt(vlq, 0))) { return nil } else { $t_break.$throw() };})} catch($e) { if ($e === $t_break) return $e.$v; throw $e; }})();}, {$$s: self}); return result.$join(); }); $defs(self, '$decode', function $$decode(str) { var self = this, result = nil, chars = nil, vlq = nil, shift = nil, continuation = nil, char$ = nil, digit = nil; result = []; chars = str.$split(""); while ($truthy(chars['$any?']())) { vlq = 0; shift = 0; continuation = true; while ($truthy(continuation)) { char$ = chars.$shift(); if (!$truthy(char$)) { self.$raise($$('ArgumentError')) }; digit = $$('BASE64_VALUES')['$[]'](char$); if ($eqeq(digit['$&']($$('VLQ_CONTINUATION_BIT')), 0)) { continuation = false }; digit = digit['$&']($$('VLQ_BASE_MASK')); vlq = $rb_plus(vlq, digit['$<<'](shift)); shift = $rb_plus(shift, $$('VLQ_BASE_SHIFT')); }; result['$<<'](($eqeq(vlq['$&'](1), 1) ? (vlq['$>>'](1)['$-@']()) : (vlq['$>>'](1)))); }; return result; }); $defs(self, '$encode_mappings', function $$encode_mappings(ary) { var self = this; return $send(ary, 'map', [], function $$4(group){var self = $$4.$$s == null ? this : $$4.$$s; if (group == null) group = nil; return $send(group, 'map', [], function $$5(segment){var self = $$5.$$s == null ? this : $$5.$$s; if (segment == null) segment = nil; return self.$encode(segment);}, {$$s: self}).$join(",");}, {$$s: self}).$join(";") }); return $defs(self, '$decode_mappings', function $$decode_mappings(str) { var self = this, mappings = nil; mappings = []; $send(str.$split(";"), 'each_with_index', [], function $$6(group, index){var self = $$6.$$s == null ? this : $$6.$$s; if (group == null) group = nil; if (index == null) index = nil; mappings['$[]='](index, []); return $send(group.$split(","), 'each', [], function $$7(segment){var self = $$7.$$s == null ? this : $$7.$$s; if (segment == null) segment = nil; return mappings['$[]'](index)['$<<'](self.$decode(segment));}, {$$s: self});}, {$$s: self}); return mappings; }); })($$$($$('Opal'), 'SourceMap'), $nesting) }; Opal.modules["opal/source_map"] = function(Opal) {/* Generated by Opal 1.7.3 */ var $module = Opal.module, $nesting = [], nil = Opal.nil; Opal.add_stubs('autoload'); return (function($base, $parent_nesting) { var self = $module($base, 'Opal'); var $nesting = [self].concat($parent_nesting); return (function($base) { var self = $module($base, 'SourceMap'); self.$autoload("Map", "opal/source_map/map"); self.$autoload("File", "opal/source_map/file"); self.$autoload("Index", "opal/source_map/index"); return self.$autoload("VLQ", "opal/source_map/vlq"); })($nesting[0]) })($nesting[0], $nesting) }; Opal.modules["opal-source-maps"] = function(Opal) {/* Generated by Opal 1.7.3 */ var self = Opal.top, nil = Opal.nil; Opal.add_stubs('require'); return self.$require("opal/source_map") };