
    \j                       S SK Jr  S SK Jr  S SKJr  S SKJr  S SKJr  S SKJr  S SKJ	r	  S SK
Jr  S S	K
Jr  S S
K
Jr  S SK
Jr  S SK
Jr  S SK
Jr  S SK
Jr  S SK
Jr  S SK
Jr  S SK
Jr  S SK
Jr  S SK
Jr  S SK
Jr  S SK
Jr  S SK
Jr  S SK
Jr  S SK
Jr  S SK
Jr  S SK
Jr  S SK
Jr  S SK
Jr  S SK
J r   S SK!J"r"  S SK#J$r$  S S K%J&r&  S S!K%J'r'  S S"K%J(r(  S S#K%J)r)  S S$K*J+r+  S S%K*J,r,  S S&K*J-r-  S S'K*J.r.  S S(K*J/r/  S S)K*J0r0  S S*K*J1r1  \ " S+ S,5      5       r2S-\\/   S.\	S/\24S0 jr3S1\/S/\44S2 jr5S1\/S.\	S/\64S3 jr7S4\S5\-S6\$S/S74S8 jr8S4\S9\,S6\$S.\	S/S74
S: jr9S;\\,   S.\	S/\\,   4S< jr:S4\S5\-S6\$S/S74S= jr;S4\S9\,S6\$S.\	S/S74
S> jr<S?\4S6\$S/\44S@ jr=S?\4S6\$S/\44SA jr>SB\4S?\4S6\$SC\?\4\44   S/\44
SD jr@S?\4S6\$SC\?\4\44   S/\44SE jrAS?\4S6\$SC\?\4\44   S/\44SF jrBS?\4S6\$SC\?\4\44   S/\44SG jrCS?\4S6\$SC\?\4\44   S/\44SH jrDS?\4S6\$SC\?\4\44   S/\44SI jrES?\4S6\$SC\?\4\44   S/\44SJ jrFS?\4S6\$SC\?\4\44   S/\44SK jrGS?\4S6\$SC\?\4\44   S/\44SL jrHS?\4S6\$SM\4S/\44SN jrIS?\4S6\$S/\44SO jrJS?\4S6\$SM\4S/\44SP jrKS?\4S6\$S/\44SQ jrLS?\4S6\$S/\44SR jrM  StS?\4S6\$SC\\?\4\44      SS\4S/\44
ST jjrNS?\4S6\$S/\44SU jrO  SuS?\4S6\$SC\\?\4\44      SS\4S/\44
SV jjrPS?\4S6\$S/\44SW jrQS?\4S6\$S/\44SX jrRS?\4S6\$SY\S/\44SZ jrSS?\4S6\$S[\1S/\44S\ jrTS1\/S?\4S6\$S.\	S/\44
S] jrUS1\/S?\4S6\$S.\	S/\44
S^ jrVS_\4S`\+S?\4S6\$S/\44
Sa jrWS1\/SM\4SC\?\4\44   S_\4S?\4S6\$S.\	S/\44Sb jrXSc\.SM\4S?\4S6\$S.\	S/\44Sd jrYSc\.SM\4S?\4Se\4S6\$S.\	S/\44Sf jrZS/\4Sg jr[Sh\.SM\4S?\4S6\$S.\	S/\44Si jr\S?\4S6\$S/\44Sj jr]Sk\0SM\4SC\?\4\44   S?\4S6\$S.\	S/\44Sl jr^S1\/SC\?\4\44   Sm\4S?\4S6\$S.\	S/\44Sn jr_  SvS1\/SM\4SC\?\4\44   S?\4S6\$S.\	S_\\4   Sm\\4   S/\44So jjr`Sp\S?\4S6\$S.\	S/\44
Sq jraS1\/S?\4S6\$S.\	Sr\4S/\44Ss jrbg7)w    )	dataclass)field)List)NoReturn)Optional)TextIO)GenerationContext)DictionaryMemberOrAttribute)InterfaceLikeType)add_binding_include_for_type)add_buffer_source_type_include)add_header_includes_for_type)add_include_for_string_cpp_type)converter_function_name)cpp_empty_value)cpp_name)cpp_type)cpp_type_for_idl_type)cpp_type_for_idl_type_details)cpp_type_name_for_string)cpp_value_type)"fully_qualified_name_for_interface)#implementation_header_for_interface) interface_like_type_for_idl_type)is_buffer_source_type)is_numeric_type)is_string_type)is_typed_array_type)union_type_to_variant)cpp_default_value_conversion)GeneratedIncludes)make_name_acceptable_cpp)string_to_cpp_enum_name)title_case_to_snake_case)underlying_type_for_enum)CallbackFunction)
Dictionary)Enumeration)IDLParameterizedType)IDLType)IDLUnionType)	Interfacec                   x   \ rS rSr% Sr\\   \S'   Sr\\   \S'   Sr	\\   \S'   Sr
\\   \S'   Sr\\   \S'   Sr\\   \S'   Sr\\   \S	'   Sr\\   \S
'   Sr\\   \S'   Sr\\   \S'   \" \S9r\\   \S'   \" \S9r\\   \S'   \" \S9r\\   \S'   \" \S9r\\   \S'   \" \S9r\\   \S'   Sr\\S'   Srg)
UnionTypes2   Nboolean_typenumeric_typestring_typebigint_typearray_buffer_typedata_view_typesequence_typefrozen_array_typerecord_typedictionary_type)default_factoryenumeration_typesinterface_typescallback_function_typescallback_interface_typestyped_array_typesFincludes_object_type )__name__
__module____qualname____firstlineno__r0   r   r*   __annotations__r1   r2   r3   r4   r5   r6   r)   r7   r8   r9   r   listr;   r   r<   r=   r>   r?   r@   bool__static_attributes__rA       Z/mnt/mint/home/seanl/public/Repos/ladybird/Meta/Generators/libweb_bindings/to_idl_value.pyr.   r.   2   s   &*L(7#*&*L(7#*%)K'")%)K'")+/x(/(,NHW%,48M80188<x 45<26K./6)-OXg&-',T'BtG}B%*4%@OT']@-24-HT']H.3D.Id7mI',T'BtG}B!&$&rJ   r.   flattened_member_typescontextreturnc                 Z   [        5       nU  GH  nUR                  c  UR                  S:X  a  X2l        UR                  c   [	        UR                  5      (       a  X2l        UR
                  c   [        UR                  5      (       a  X2l        UR                  c  UR                  S:X  a  X2l        UR                  U5      b  UR                  R                  U5        [        X15      b  UR                  R                  U5        UR                  U5      b  UR                  R                  U5        UR                  U5      nUb,  UR                   (       a  UR"                  R                  U5        UR                  S:X  a  SUl        UR&                  c  UR                  S:X  a  X2l        UR(                  c  UR                  S:X  a  X2l        [+        U5      (       a  UR,                  R                  U5        UR.                  c  UR1                  U5      b  X2l        [3        U[4        5      (       d  GM*  UR6                  c  UR                  S:X  a  X2l        UR8                  c  UR                  S:X  a  X2l        UR:                  b  GM  UR                  S	:X  d  GM  X2l        GM     U$ )
NbooleanbigintobjectTArrayBufferDataViewsequenceFrozenArrayrecord)r.   r0   namer1   r   r2   r   r3   enumerationr;   appendr   r<   callback_functionr=   	interfaceis_callback_interfacer>   r@   r4   r5   r   r?   r9   
dictionary
isinstancer)   r6   r7   r8   )rL   rM   typesmember_typer\   s        rK   collect_union_typesrb   H   s<   LE-%+*:*:i*G!,%/+:J:J*K*K!,$8H8H)I)I +$)9)9X)E +{+7##**;7+KAM!!((5$$[1=))00=%%k2	 Y%D%D**11+>x')-E&""*{/?/?=/P&1#'K,<,<
,J#. {++##**;7  (W-?-?-L-X$/!+';<<&;+;+;z+I"-""*{/?/?=/P&1#$)9)9X)E +Q .T LrJ   idl_typec                      [        SU  S35      e)Nz&Unsupported IDL value conversion for ''RuntimeError)rc   s    rK   unsupported_to_idl_valuerh   x   s    
?zK
LLrJ   c                      U R                   S;  $ )N)anyrP   )rX   )rc   rM   s     rK    idl_value_conversion_is_throwingrk   |   s    == 222rJ   outrY   includesNc           
         UR                  S5        UR                  S5        U R                  SUR                   S[        [	        UR
                  5      5       S35        UR
                   H!  nU R                  S[        U5       S35        M#     U R                  S5        U R                  S	UR                   S
[        U5       S35        g )NLibJS/Forward.hLibJS/Runtime/Value.hzenum class z :  {
    z,
};

JS::ThrowCompletionOr<> (JS::VM&, JS::Value);

)addwriterX   r%   lenvaluesr#   r   rl   rY   rm   values       rK   write_enumeration_declarationr}      s    LL"#LL()IIK,,-S1I#kN`N`Ja1b0cchij##		D078<= $IIhII
 !1!1 2"5L[5Y4ZZstrJ   r^   c           
         UR                  S5        UR                  S5        UR                  U5      nUb%  UR                  UR                  R                  5        UR
                  (       a  SUR
                   3OSnU R                  SUR                   U S35        UR                   H  n[        XbU5        SnUR                  b  S[        Xc5       S3n[        Xc5      nUR                  (       a0  UR                  c#  U R                  SU S[        U5       S	35        My  U R                  SU S[        U5       S
U S35        M     U R                  S5        U R                  SUR                   S[        U5       S35        g )Nro   rp   z
 : public  zstruct rq    rr   ;
z {z};
rs   rt   ru   rv   )rw   dictionary_parentadd_bindingpathstemparent_namerx   rX   membersr   default_valuer    r   requiredr   r   )	rl   r^   rm   rM   parent_dictionaryparentmemberr   member_cpp_types	            rK   write_dictionary_declarationr      sl    LL"#LL()11*=$.338896@6L6Lz*0012RTFII
(67$$$Vw?+ <V MNaPM"63??v33;II_-Qx/?.@DEII_-Qx/?.@M?RWXY % IIhII
  14KJ4W3XXqrrJ   dictionariesc                 "  ^^^^^^^ U  Vs0 s H  o"R                   U_M     snm[        5       m[        5       m/ mS[        S[        [           4U4S jjmS[        SS 4UUUUUU4S jjmTR	                  5        H  nT" U5        M     T$ s  snf )Nr^   rN   c                   > U R                   (       a  U R                   1O	[        5       nU R                   H-  nUR                  TR	                  UR
                  5      5        M/     UR                  U R                  5        U$ N)r   setr   updatedictionary_type_namestypediscardrX   )r^   dependency_namesr   rM   s      rK   dependency_names_for>dictionaries_in_dependency_order.<locals>.dependency_names_for   se    7A7M7MJ223SVSX ((F##G$A$A&++$NO )  1rJ   c                   > U R                   T;   a  g U R                   T;   a  [        SU R                    S35      eTR                  U R                   5        T" U 5       H!  nTR                  U5      nUc  M  T" U5        M#     TR	                  U R                   5        TR                  U 5        TR                  U R                   5        g )NzDictionary 'z' depends on itself)rX   rg   rw   getremoverZ   )	r^   dependency_name
dependencyr   emittedlocal_dictionariesordered_dictionariesvisitvisitings	      rK   r   /dictionaries_in_dependency_order.<locals>.visit   s    ??g%??h&joo->>QRSSZ__%3J?O+//@J%j!  @ 	
(##J/JOO$rJ   )rX   r   r'   strrz   )	r   rM   r^   r   r   r   r   r   r   s	    ` @@@@@@rK    dictionaries_in_dependency_orderr      s    HTU*//:5UGH-/   C  %* % % %  )//1
j 2  ? Vs   Bc           	         UR                  S5        UR                  S5        UR                  S5        U R                  SUR                   S[        U5       S35        UR                   HC  nU R                  SU S35        U R                  S	UR                   S
[        U5       S35        ME     U R                  SUR                   S35        g )NLibJS/Runtime/Error.hLibJS/Runtime/VM.hLibJS/Runtime/ValueInlines.hzI// https://webidl.spec.whatwg.org/#idl-enumeration
JS::ThrowCompletionOr<ru   u(  (JS::VM& vm, JS::Value value)
{
    // 1. Let S be the result of calling ? ToString(V).
    auto value_as_string = TRY(value.to_utf16_string(vm));

    // 2. If S is not one of E’s enumeration values, then throw a TypeError.
    // 3. Return the enumeration value of type E that is equal to S.
z    if (value_as_string == "z"sv)
z        return ::r   zh    return vm.throw_completion<JS::TypeError>(JS::ErrorType::InvalidEnumerationValue, value_as_string, "z");
}

)rw   rx   rX   r   rz   r#   r{   s       rK   write_enumeration_conversionr      s    LL()LL%&LL/0II"''(+B;+O*P Q	
 ##		0v>?		OK$4$4#5R8OPU8V7WWZ[\ $ IIt  vA  vF  vF  uG G 	rJ   c                    UR                  S5        UR                  S5        UR                  S5        UR                  S5        UR                  S5        UR                  U5      nU R                  SUR                   S[	        U5       SUR                   S	UR                   S
3	5        Ub  U R                  S[	        U5       S35        UR
                   H  n[        USX#5      n[        XS5      nUb  SOS[        U5       S3nU R                  SU SU SUR                   SU S3	5        UR                  b  U R                  S[        XS5       S35        OOUR                  (       a   U R                  SUR                   S35        OU R                  S[        XS5       S35        U R                  S5        M     U R                  S5        g )Nr   r   rp   r   "LibWeb/Bindings/ExceptionOrUtils.hzG// https://webidl.spec.whatwg.org/#es-dictionary
JS::ThrowCompletionOr<ru   a  (JS::VM& vm, JS::Value js_dict)
{
    // 1. If jsDict is not an Object and jsDict is neither undefined nor null, then throw a TypeError.
    if (!js_dict.is_object() && !js_dict.is_nullish())
        return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAnObjectOfType, "u  ");

    // 2. Let idlDict be an empty ordered map, representing a dictionary of type D.
    // 3. Let dictionaries be a list consisting of D and all of D’s inherited dictionaries, in order from least to most derived.
    // 4. For each dictionary dictionary in dictionaries, in order:
    // NB: We defer construction until the return initializer because some members may not be default-constructible. Inherited dictionaries are represented by the generated C++ struct inheritance.

    // 5. Return idlDict.
    return rq   z        TRY(z(vm, js_dict)),
js_member_valuer   .z = z        z#TRY([&]() -> JS::ThrowCompletionOr<a  > {
            // 1. Let key be the identifier of member.
            // 2. If jsDict is either undefined or null, then:
            //     1. Let jsMemberValue be undefined.
            // 3. Otherwise,
            //     1. Let jsMemberValue be ? Get(jsDict, key).
            auto js_member_value = JS::js_undefined();
            if (js_dict.is_object())
                js_member_value = TRY(js_dict.as_object().get("aw  "_utf16_fly_string));

            // 4. If jsMemberValue is not undefined, then:
            if (!js_member_value.is_undefined()) {
                // 1. Let idlMemberValue be the result of converting jsMemberValue to an IDL value whose type is the type member is declared to be of.
                auto idl_member_value = TRY(throw_dom_exception_if_needed(vm, [&] { return zy; }));

                // 2. Set idlDict[key] to idlMemberValue.
                return idl_member_value;
            }
a!              // 5. Otherwise, if jsMemberValue is undefined but member has a default value, then:
            // 1. Let idlMemberValue be the result of converting member's default value to an IDL value whose type is the type member is declared to be of.
            auto idl_member_value = z^;

            // 2. Set idlDict[key] to idlMemberValue.
            return idl_member_value;
z            // 6. Otherwise, if jsMemberValue is undefined and member is required, then throw a TypeError.
            return vm.throw_completion<JS::TypeError>(JS::ErrorType::MissingRequiredProperty, "");
zg            // 7. Otherwise, jsMemberValue is undefined and the member is optional.
            return r   z        }()),
z
    };
}

)rw   r   rx   rX   r   r   to_idl_valuer   r   r   r    r   r   )	rl   r^   rm   rM   r   r   
conversionr   member_designators	            rK   write_dictionary_conversionr      s     LL()LL%&LL()LL/0LL5611*=II !'r*A**M)N OV WaVeVeUf g OO   $		L!89J!K LL]^_ $$!&*;XO
"63"3"?BqRXIYHZZ]E^		*++NN_ `@ AG} M]
 ^h\h i	
* +II%%A&%R$S T __II``f`k`k_l m II#F45 6 			#$a %b II	rJ   
value_namec                 (    UR                  S5        U $ )Nrp   rw   r   rm   s     rK   any_to_idl_valuer   F  s    LL() rJ   c                 .    UR                  S5        U  S3$ )Nrp   z.to_boolean()r   r   s     rK   boolean_to_idl_valuer   V  s    LL() \''rJ   r   extended_attributesc           	          UR                  S5        UR                  S5        SU;   a  SOSnSU;   a  SOSnSU  SU S	U S
U S3	$ )NzLibWeb/WebIDL/Types.h"LibWeb/WebIDL/AbstractOperations.hEnforceRangeYesNoClampzWebIDL::convert_to_int<z>(vm, z, WebIDL::EnforceRange::z, WebIDL::Clamp::)r   )r   r   rm   r   enforce_rangeclamps         rK   convert_to_intr   _  sg     LL()LL56+/BBEM 33EE
!(6* >!!./@q	JrJ   c                     [        SXU5      $ )NzWebIDL::Byter   r   rm   r   s      rK   byte_to_idl_valuer   q       .*@STTrJ   c                     [        SXU5      $ )NzWebIDL::Octetr   r   s      rK   octet_to_idl_valuer   x       /:ATUUrJ   c                     [        SXU5      $ )NzWebIDL::Shortr   r   s      rK   short_to_idl_valuer     r   rJ   c                     [        SXU5      $ )NzWebIDL::UnsignedShortr   r   s      rK   unsigned_short_to_idl_valuer     s    
 1:I\]]rJ   c                     [        SXU5      $ )NzWebIDL::Longr   r   s      rK   long_to_idl_valuer     r   rJ   c                     [        SXU5      $ )NzWebIDL::UnsignedLongr   r   s      rK   unsigned_long_to_idl_valuer     s    
 0*H[\\rJ   c                     [        SXU5      $ )NzWebIDL::LongLongr   r   s      rK   long_long_to_idl_valuer     s     ,jDWXXrJ   c                     [        SXU5      $ )NzWebIDL::UnsignedLongLongr   r   s      rK   unsigned_long_long_to_idl_valuer     s     4jL_``rJ   
identifierc                 X    UR                  S5        UR                  S5        SU  SU S3$ )Nr   r   z>[&]() -> JS::ThrowCompletionOr<float> {
        float x = TRY(.to_double(vm));
        if (isinf(x) || isnan(x))
            return vm.throw_completion<JS::TypeError>(JS::ErrorType::InvalidRestrictedFloatingPointParameter, "");
        return x;
    }()r   r   rm   r   s      rK   float_to_idl_valuer     sB    LL()LL/0!l #ppzo{ |	 rJ   c                 0    UR                  S5        SU  S3$ )Nr   zN[&]() -> JS::ThrowCompletionOr<float> {
        return static_cast<float>(TRY(z.to_double(vm)));
    }()r   r   s     rK   unrestricted_float_to_idl_valuer     s(    LL/0''1l 3	 rJ   c                 X    UR                  S5        UR                  S5        SU  SU S3$ )Nr   r   z>[&]() -> JS::ThrowCompletionOr<double> {
        auto x = TRY(r   r   r   r   s      rK   double_to_idl_valuer     sB    LL()LL/0
 \ "ppzo{ |	 rJ   c                 .    UR                  S5        U  S3$ )Nr   z.to_double(vm)r   r   s     rK    unrestricted_double_to_idl_valuer     s    LL/0
 \((rJ   c                 r    UR                  S5        UR                  S5        UR                  S5        U  S3$ )NLibJS/Runtime/BigInt.hrp   r   z.to_bigint(vm)r   r   s     rK   bigint_to_idl_valuer     s8    LL)*LL()LL/0 \((rJ   	type_namec                     UR                  S5        UR                  S5        [        X25      n[        XA5        SU;   a  SOSnUb  SU;   a  SU SU S	U  S
U SU  S3$ SU SU SU  S3$ )Nrp   r   Utf16to_utf16_string	to_stringLegacyNullToEmptyString[&]() -> JS::ThrowCompletionOr<> {
        z string;
        if (!z-.is_null())
            string = TRY(WebIDL::(vm, z"));
        return string;
    }()> {
        return TRY(WebIDL::));
    }()rw   r   r   r   rm   r   r   cpp_type_namer   s         rK   dom_string_to_idl_valuer     s     LL()LL56,YLM#M<%,	%9!{I &+DH[+[2=/ B		 \ ""+E* >	 	 /}o >%;eJ< 8	 rJ   c                     UR                  S5        UR                  S5        [        S5      n[        X!5        SU SU  S3$ )Nrp   r   
ByteStringr   z2> {
        return TRY(WebIDL::to_byte_string(vm, r   r   )r   rm   r   s      rK   bytestring_to_idl_valuer     sP    LL()LL56,\:M#M< /}o >//9l ;	 rJ   c                     UR                  S5        UR                  S5        [        X25      n[        XA5        SU;   a  SOSnSU SU SU  S	3$ )
Nrp   r   r   to_utf16_usv_stringto_usv_stringr   r   r   r   r   r   s         rK   usv_string_to_idl_valuer  '  sg     LL()LL56,YLM#M<)0I)=%?I
 /}o >%;eJ< 8	 rJ   c                     UR                  S5        UR                  S5        UR                  S5        UR                  S5        SU  SU  SU  S3$ )	Nr   zLibJS/Runtime/Object.hrp   r   zC[&]() -> JS::ThrowCompletionOr<GC::Ref<JS::Object>> {
        if (!`.is_object())
            return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAnObject, z);
        return GC::Ref { z.as_object() };
    }()r   r   s     rK   object_to_idl_valuer  <  sf    LL()LL)*LL()LL/0\ SS]R^ _%, '	 rJ   c                 :    UR                  S5        [        S5      e)Nrp   z5symbol to IDL value conversion is not yet implemented)rw   rg   r   s     rK   symbol_to_idl_valuer  K  s    LL() N
OOrJ   interface_like_typec           	          UR                  S5        UR                  S5        UR                  S5        UR                  UR                  5        SUR                   SU  SUR                   SUR                   S3	$ )	Nr   rp   r   '[&]() -> JS::ThrowCompletionOr<GC::Ref<z>> {
        if (auto impl = z.as_if<zt>())
            return *impl;
        return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAnObjectOfType, "z");
    }())rw   implementation_headerfully_qualified_namerX   )r   rm   r  s      rK   interface_to_idl_valuer  S  s    
 LL()LL()LL/0LL$::; 77J7_7_6` a#G,?,T,T+U VVViVnVnUo p	 rJ   r\   c                 ^   UR                  S5        UR                  S5        UR                  S5        UR                  S5        UR                  S5        UR                  S5        UR                  S5        UR                  [        U5      5        [        U5      nSU S	U  S
U  SU  SU S3$ )NLibGC/Heap.hr   rp   r   r   $LibWeb/HTML/Scripting/Environments.hLibWeb/WebIDL/CallbackType.hr	  >> {
        if (!r  zJ);

        auto callback_type = vm.heap().allocate<WebIDL::CallbackType>(zj.as_object(), HTML::incumbent_realm());
        return TRY(throw_dom_exception_if_needed(vm, [&] { return z,::create(realm, callback_type); }));
    }())rw   r   r   )r   rm   r\   r   s       rK   callback_interface_to_idl_valuer  g  s    
 LL LL()LL()LL/0LL56LL78LL/0LL4Y?@1)<H 7xj A\ SS]R^ _GGQl SDDL: N	 rJ   c                 <    [        XU5        [        U 5       SU S3$ Nr   r   r   r   rc   r   rm   rM   s       rK   dictionary_to_idl_valuer    '     !W=%h/0j\CCrJ   c                 <    [        XU5        [        U 5       SU S3$ r  r  r  s       rK   enumeration_to_idl_valuer    r  rJ   return_cpp_typer[   c                    UR                  S5        UR                  S5        UR                  S5        UR                  S5        UR                  S5        UR                  R                  R                  SS5      S   S	:X  a  S
OSnSUR                  ;   nU(       a  SOU n SU  S3nU(       d  USU SU S3-  nUSU SU S3-  nU$ )Nr  r   zLibJS/Runtime/FunctionObject.hr  r  <   r   Promisez$WebIDL::OperationReturnsPromise::Yesz#WebIDL::OperationReturnsPromise::NoLegacyTreatNonObjectAsNullzGC::Ptr<WebIDL::CallbackType>r   > {

        if (!zc.is_function())
            return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAFunction, z);
z9
        return vm.heap().allocate<WebIDL::CallbackType>(z(.as_object(),  HTML::incumbent_realm(), 
);
    }())rw   return_typerX   splitr   )r  r[   r   rm   operation_returns_promiselegacy_treat_non_object_as_nullr   s          rK   callback_function_to_idl_valuer(    s    LL LL()LL12LL78LL/0 ((--33C;A>)K 	/2  'CFWFkFk&k#9X5^mO4_4E F J + \ TT^S_ ` 	
  99CDl  nG  mH H	 J rJ   c                    U R                  S5      n[        U UUS9nSU SUR                   S3n	UR                  U5      n
U
S L=(       a    SU
R                  ;   nU(       a	  U	SU S3-  n	[        XqX$XV5      n[        Xv5      (       a  S	U S
3OUnUR                  5       nU(       a  U	SU S3-  n	U	SU S3-  n	O	U	SU S3-  n	U	SU S3-  n	U(       a  U	S-  n	U	S-  n	U	$ )NFr   r   r   z value;
r   z        if (z.is_object()) {
zTRY(r   
        if (z;.is_undefined()) {
            value = Empty {};
        }
z
        else if (!z.is_nullish()) {
r"  z
            value = z;
        }

        }
z        return value;
    }())clone_with_nullabler   rX   r[   r   to_idl_value_from_typerk   includes_undefined)rc   r   r   r  r   rm   rM   
inner_typer   r   r[   r'  inner_conversioninner_returninner_type_includes_undefineds                  rK   nullable_to_idl_valuer4    s    --e4J,/H
 5_4E F		 J  11*=%o*FJ[JoJo*o $ 'ZL0BCC
- 3 'Gz&[&[$ "aq  %/$A$A$C! % L  	
 	 ,  	

 	 \  	

  !N # J
 'm#
  JrJ   r6   c                     U R                   S   n[        XT5      nUR                  R                  nSU SUR                   SU SU SU SU S[        XUS	X45       S
3$ )Nr   r   r  r  r  z);

        auto method = TRY(z.get_method(vm, vm.well_known_symbol_iterator()));
        if (!method)
            return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotIterable, z);

        return TRY(methodr#  )
parametersr   contained_storage_typer|   rX   create_sequence_from_iterable)r6   r   r   rm   rM   element_typeelement_cpp_typestorage_type_names           rK   sequence_to_idl_valuer=  	  s     !++A.L4\K(??EE //@.ACSCXCXBY Z\ SS]R^ _%, 'SS]R^ _1-ZYackuv w		 	rJ   iterator_method_namec                 |   UR                  S5        UR                  S5        UR                  S5        UR                  S5        UR                  S5        U R                  S   n[        Xe5      nUR                  R                  nSU SUR
                   S	U S
U SU SUR
                   S[        Xa0 SXE5       S3$ )Nr   zLibJS/Runtime/Iterator.hrp   r   r   r   r   r  a  >> {
        // To create an IDL value of type sequence<T> given an iterable iterable and an iterator getter method, perform the following steps:
        // 1. Let iteratorRecord be ? GetIteratorFromMethod(iterable, method).
        auto iterator = TRY(JS::get_iterator_from_method(vm, z, *z));

        a  > sequence;

        // 2. Initialize i to be 0.
        // 3. Repeat
        for (;;) {
            // 1. Let next be ? IteratorStepValue(iteratorRecord).
            auto next = TRY(JS::iterator_step_value(vm, iterator));

            // 2. If next is done, then return an IDL sequence value of type sequence<T> of length i, where the value of the element at index j is Sj.
            if (!next.has_value())
                break;

            // 3. Initialize Si to the result of converting next to an IDL value of type T.
            auto next_value = next.release_value();
            auto sequence_item = TRY(throw_dom_exception_if_needed(vm, [&] { return 
next_valuez; }));

            // 4. Set i to i + 1.
            sequence.append(sequence_item);
        }

        return sequence;
    }())rw   r7  r   r8  r|   rX   r.  )	r6   r   r   r>  rm   rM   r:  r;  r<  s	            rK   r9  r9  %  s     LL()LL+,LL()LL/0LL56 ++A.L4\K(??EE./@.ACSCXCXBY Z> ?I\MaLb c		1-223 4V Wmmy  HJ  LX  Zb  Wl  Vm m	' rJ   c                      [        S5      e)Nz=async sequence to IDL value conversion is not yet implementedrf   rA   rJ   rK   async_sequence_to_idl_valuerB  U  s    
V
WWrJ   r8   c                    [        U R                  5      S:w  a  [        S5      eU R                  S   nU R                  S   n[        UR                  5      (       d  [        S5      eUR                  S5        UR                  S5        UR                  S5        UR                  S	5        [        X5      nS
U SU SU SU SU S[        XQ0 SX45       S[        Xa0 SX45       S3$ )N   z,Record type must have exactly two parametersr   r  z%Record key type must be a string typer   zLibJS/Runtime/PropertyKey.hrp   r   r   z> {
        // An ECMAScript value O is converted to an IDL record<K, V> value as follows:
        // 1. If Type(O) is not Object, throw a TypeError.
        if (!r  z#);

        auto& record_object0 = zY.as_object();

        // 2. Let result be a new empty instance of record<K, V>.
        a   record;

        // 3. Let keys be ? O.[[OwnPropertyKeys]]().
        auto keys = TRY(record_object0.internal_own_property_keys());

        // 4. For each key of keys:
        for (auto& key : keys) {
            auto property_key = MUST(JS::PropertyKey::from_value(vm, key));

            // 1. Let desc be ? O.[[GetOwnProperty]](key).
            auto desc = TRY(record_object0.internal_get_own_property(property_key));

            // 2. If desc is not undefined and desc.[[Enumerable]] is true:
            if (!desc.has_value() || !desc->enumerable.has_value() || !desc->enumerable.value())
                continue;

            // 1. Let typedKey be key converted to an IDL value of type K.
            auto typed_key = TRY(keyz);

            // 2. Let value be ? Get(O, key).
            auto value = TRY(record_object0.get(property_key));

            // 3. Let typedValue be value converted to an IDL value of type V.
            auto typed_value = TRY(r|   z);

            // 4. Set result[typedKey] to typedValue.
            record.set(typed_key, typed_value);
        }

        // 5. Return result.
        return record;
    }())ry   r7  rg   r   rX   rw   r   r.  )r8   r   r   rm   rM   key_type
value_typerecord_cpp_types           rK   record_to_idl_valuerI  Z  s    ;!!"a'IJJ%%a(H''*J(--((BCCLL()LL./LL()LL/0+KAO..? @ \ SS]R^ _  *| ,	 
 "" #9rSXZb"l!m n$ %;:SUW^`h$r#s t	A( (rJ   c                 R    UR                  S5        UR                  S5        SU  S3$ )Nz"LibJS/Runtime/AbstractOperations.hz"LibJS/Runtime/PromiseConstructor.hu  [&]() -> JS::ThrowCompletionOr<GC::Ref<WebIDL::Promise>> {
        auto& realm = *vm.current_realm();

        // 1. Let promiseCapability be ? NewPromiseCapability(%Promise%).
        auto promise_capability0 = TRY(JS::new_promise_capability(vm, realm.intrinsics().promise_constructor()));

        // 2. Perform ? Call(promiseCapability.[[Resolve]], undefined, « V »).
        TRY(JS::call(vm, *promise_capability0->resolve(), JS::js_undefined(), zX));

        // 3. Return promiseCapability.
        return promise_capability0;
    }()r   r   s     rK   promise_to_idl_valuerK    s=     LL56LL56O PZl [	 rJ   
union_typec                 N  ^^^^^" TR                  S5        [        U T5      n[        U R                  5       T5      n/ m"U4S[        S[
        S[
        4UUUU4S jjjnS[
        SS 4U"4S jjn	U R                  5       (       a  TR                  S5        U	" S	U S
35        U R                  5       (       a  TR                  S5        U	" S	U S35        U R                  5       (       d5  UR                  b(  U	" S	U SU S[        UR                  UTT5       S35        U	" S	U SU S35        UR                  (       a  TR                  S5        U	" S5        UR                   HJ  n
[        U
T5      nUc   eUR                  nTR                  UR                  5        U	" SU SU S35        ML     UR                  (       a  U	" SU S35        U	" S5        UR                  b2  TR                  S5        U" UR                  5      nU	" SU SU S35        UR                   b2  TR                  S5        U" UR                   5      nU	" SU SU S 35        UR"                  (       al  TR                  S!5        UR"                   HK  nU" U5      n[%        ['        UR(                  5      5      nU	" S"UR(                   S#U S$U SU S%U S&35        MM     UR*                  (       aK  UR*                  S'   nTR-                  U5      nUc   e[/        [1        UTTS(9UUT5      nU	" S)U SU S*35        UR2                  b*  U	" S+U S,[5        UR2                  TUS-TT5       SU S.35        UR6                  b*  U	" S/U S0[5        UR6                  TUS1TT5       SU S235        UR                  b'  [        UR                  UTT5      nU	" S3U SU S435        UR8                  b(  [;        UR8                  TUTT5      nU	" S5U S6U S735        UR<                  (       aA  UR<                  S'   nTR?                  U5      nUc   e[A        UTU5      nU	" S8U S6U S935        UR                  (       a  U	" S:U S35        U	" S;5        URB                  b  U	" S	U S<U S%U S=35        URD                  b8  [%        T5       S>3nU" URD                  5      nU	" S	U S?U S@U S6U S%U SA35        URF                  b#  TR                  SB5        U	" S	U SCU SDU SE35        URH                  (       a  TR                  SF5        TR                  SG5        S	U SHU SI3nURH                   HQ  nTRK                  U5      nUc   eURL                   H(  nUSJU SKU S%UR(                   SL[O        U5       SM3	-  nM*     MS     USN-  nU	" U5        URP                  b5  [%        T5       SO3n U" URP                  5      n!U	" SPU  S@U! SQU S%U  SM3	5        URD                  bk  URF                  b^  TR                  SB5        TR                  SG5        [%        T5       S>3nU" URD                  SR5      nU	" SSU STU SUU SVU SQU S%U SW35        URD                  b5  [%        T5       S>3nU" URD                  5      nU	" SPU SVU SQU S%U SW3	5        URB                  b  U	" SXU S%U SY35        URF                  b  U	" SZ[S        UT5       SQU S[35        TR                  S\5        U	" S]5        S^U S_S`RU                  T"5       Sa3$ )bNzAK/Variant.hra   rX   rN   c                 B   > [        U R                  S5      TTUTT5      $ )NF)r.  r-  )ra   rX   rM   r   r   rm   s     rK   conversion_for*union_to_idl_value.<locals>.conversion_for  s-    %++E2
 	
rJ   sectionc                 8   > U (       a  TR                  U 5        g g r   )rZ   )rQ  sectionss    rK   rZ   "union_to_idl_value.<locals>.append  s    OOG$ rJ   z
AK/Types.hr+  z:.is_undefined()) {
            return Empty {};
        }
z8.is_nullish()) {
            return Empty {};
        }
z$.is_nullish()) {
            return z { TRY(z) };
        }
z<.is_object()) {
            [[maybe_unused]] auto& object = z.as_object();
z LibWeb/Bindings/PlatformObject.hz/
            if (is<PlatformObject>(object)) {
z*
                if (auto* result = as_if<z&>(object))
                    return z { GC::Ref { *result } };
z                return z { GC::Ref { object } };
z            }
zLibJS/Runtime/ArrayBuffer.ha.  
            if (auto* array_buffer = as_if<JS::ArrayBuffer>(object)) {
                if (!array_buffer->is_shared_array_buffer()) {
                    // 1. If types includes ArrayBuffer, then return the result of converting V to ArrayBuffer.
                    auto array_buffer_union_type = TRY(z);
                    return z> { array_buffer_union_type };
                }
            }
LibJS/Runtime/DataView.hz
            if (as_if<JS::DataView>(object)) {
                // 1. If types includes DataView, then return the result of converting V to DataView.
                auto data_view_union_type = TRY(z);
                return z) { data_view_union_type };
            }
LibJS/Runtime/TypedArray.hz
            if (as_if<JS::z">(object)) {
                auto z_union_type = TRY(z { z_union_type };
            }
r   r*  za
            if (object.is_function()) {
                auto callback_function_union_type = TRY(z2 { callback_function_union_type };
            }

z[
            // 1. Let method be ? GetMethod(V, @@iterator).
            auto method = TRY(z.get_method(vm, vm.well_known_symbol_iterator()));

            // 2. If method is not undefined, return the result of creating a sequence of that type from V and method.
            if (method) {
                auto sequence_union_type = TRY(r6  z) { sequence_union_type };
            }

zh
            // 1. Let method be ? GetMethod(V, @@iterator).
            auto frozen_array_method = TRY(a	  .get_method(vm, vm.well_known_symbol_iterator()));

            // 2. If method is not undefined, return the result of creating a frozen array of that type from V and method.
            if (frozen_array_method) {
                auto frozen_array_union_type = TRY(frozen_array_methodz, { frozen_array_union_type };
            }
z            return z) };
z*
            auto record_union_type = TRY(z);
            return z { record_union_type };
z6
            auto callback_interface_union_type = TRY(z$ { callback_interface_union_type };
z
            return r,  z".is_boolean())
            return z.as_bool() };
_numberz!.is_number()) {
            auto z = TRY(z };
        }
r   z!.is_bigint())
            return z { GC::Ref { z.as_bigint() } };
zAK/StringView.hr   z:.is_string()) {
            auto enumeration_string = TRY(z.to_utf16_string(vm));
z'            if (enumeration_string == "z"sv)
                return r   z };
z        }

_stringz
        auto z);
        return xz
        // An ECMAScript value V is converted to an IDL numeric type T or bigint value by running the following algorithm:
        // 1. Let x be ? ToNumeric(V).
        auto x = TRY(z.to_numeric(vm));

        // 2. If Type(x) is BigInt, then:
        if (x.is_bigint())
            // 1. Return the IDL bigint value that represents the same numeric value as x.
            return z { GC::Ref { x.as_bigint() } };

        // 3. Assert: Type(x) is Number.
        VERIFY(x.is_number());

        // 4. Return the result of converting x to T.
        auto z_fallback = TRY(z_fallback };
z
        return z.to_boolean() };
z$
        auto bigint_fallback = TRY(z { bigint_fallback };
r   zT
        return vm.throw_completion<JS::TypeError>("No union types matched"_utf16);
r   r!  r   z    }())+rw   r   rb   rL   r*   r   r/  includes_nullable_typer9   r  r<   r   r  r
  r@   r4   r5   r?   r"   r$   rX   r=   r[   r(  r   r6   r9  r7   r8   rI  r>   r\   r  r0   r1   r3   r;   rY   rz   r#   r2   r   join)#rL  r   r   r   rm   rM   variant_typer`   rO  rZ   interface_typer  platform_object_cpp_typearray_buffer_conversiondata_view_conversiontyped_array_typetyped_array_conversiontyped_array_cpp_namecallback_function_typer[   callback_function_conversiondictionary_conversionrecord_conversioncallback_interface_typecallback_interfacecallback_interface_conversionnumeric_value_namenumeric_conversion_expressionenumeration_conversionenumeration_typerY   enumeration_valuestring_value_namestring_conversion_expressionrS  s#    `` ``                            @rK   union_to_idl_valuers    s2
    LL (W=L
 A A CWMEH9C 	
G 	
3 	
 	
 	
% % %
 $$&&\" L  	 ((**\" L  	 ,,..53H3H3T L  >*A%BWBWYcemov*w)x y 	  L --7L 9  78  	 $33N"B>SZ"[&222':'O'O$LL,BBC **B)C D(> *  4 %%.|n =    	 *23"01H1H"I 	 8 9P7P Q(> * 	 '/0-e.B.BC 	 1 2F0F G$~ &	 	 12 % 7 7%34D%E"#;<TUeUjUj<k#l   +001 2*++=>T=U V$~T*>)? @  !8 $$!&!>!>q!A#556LM ,,, (F!"8'Wjk	(
$ 	 99U8V W$~ & 	 & )l +0 1NeNaNacmoy  |D  FN  PW  1X  0Y Y$~ &
 
	 * ,,6< 84 5RRWRiRiku  xB  DY  [c  el  5m  4n n$~ &	 		 ( 78M8Mz[cel m$\N(;P:QQXYZ $/0A0A:z[celm **;)< = > " 	 %%"'"@"@"C$../FG!---(G)
%
 	 66S5T U > " 	 !!  > " 	 = % L  >j\ 2 	 % 8 DEWM(6u7I7I(J% L $%W-J,K L >&8%9 : 	 $-. L  > = 	 &'34&L ++5, 7" !& 7 7!--.>?K***%0%7%7!&.UVgUh i$~T+*:*:);2>UVg>h=i j+ & &8 !8 	 # 	 	%& $7
CDGL'5e6G6G'H$  (D'E F~T"3!4 5 	 %%*;*;*G-.34 8 DEWM(6u7I7I3(O%  !\ "
 !> " !!!12O1P Q~T"4!5 6 	& % 8 DEWM(6u7I7I(J%  !!12O1P Q~T"4!5 6 	 % ~T* . 	
 $$$7
H$M#N O~ 	
 LL()
   /|n = 8 rJ   value_cpp_type_namec                   ^^ U R                   mUR                  S5        UR                  S5        UR                  S5        [        X5        S[        S[        4UU4S jjnS[        S[        4UU4S jjnTS:X  a  S	U S
U ST SU" S5       S3	$ TS:X  a&  UR                  S5        S	U SU ST SU" S5       S3	$ [	        U 5      (       a)  UR                  S5        S	U SU ST ST SU" S5       S3$ [        U 5      $ )NAK/TypeCasts.hr   rp   buffer_namerN   c                 N   > SnST;  a  SU  S3nSnST;  a	  SU  ST S3nU U 3$ )	Nr   AllowSharedzU        // 2. If IsSharedArrayBuffer(V) is true, then throw a TypeError.
        if (zv->is_shared_array_buffer())
            return vm.throw_completion<JS::TypeError>(JS::ErrorType::SharedArrayBuffer);

AllowResizablez        // 3. If the conversion is not to an IDL type associated with the [AllowResizable] extended attribute, and
        //    IsFixedLengthArrayBuffer(V) is false, then throw a TypeError.
        if (!z{->is_fixed_length())
            return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAnObjectOfType, "fixed-length ");

rA   rw  allow_shared_checkallow_resizable_checkr   r   s      rK   array_buffer_checks7buffer_source_to_idl_value.<locals>.array_buffer_checks  sr     33&M " !##66)] ggpfq r%! %%&;%<==rJ   c                 N   > SnST;  a  SU  S3nSnST;  a	  SU  ST S3nU U 3$ )	Nr   ry  z        // 2. If the conversion is not to an IDL type associated with the [AllowShared] extended attribute, and
        //    IsSharedArrayBuffer(V.[[ViewedArrayBuffer]]) is true, then throw a TypeError.
        if (zu.is_shared_array_buffer())
            return vm.throw_completion<JS::TypeError>(JS::ErrorType::SharedArrayBuffer);

rz  z        // 3. If the conversion is not to an IDL type associated with the [AllowResizable] extended attribute, and
        //    IsFixedLengthArrayBuffer(V.[[ViewedArrayBuffer]]) is false, then throw a TypeError.
        if (!zz.is_fixed_length())
            return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAnObjectOfType, "fixed-length r{  rA   r|  s      rK   array_buffer_view_checks<buffer_source_to_idl_value.<locals>.array_buffer_view_checks&  sr     33&M " !##66)] ggpfq r%! %%&;%<==rJ   rS   r   a  > {
        // A JavaScript value V is converted to an IDL ArrayBuffer value by running the following algorithm:
        // 1. If V is not an Object, or V does not have an [[ArrayBufferData]] internal slot, then throw a TypeError.
        auto builtin_buffer = z.as_if<JS::ArrayBuffer>();
        if (!builtin_buffer)
            return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAnObjectOfType, "r{  builtin_bufferz        // 4. Return the IDL ArrayBuffer value that is a reference to the same object as V.
        return GC::Ref { *builtin_buffer };
    }()rT   rU  z> {
        // A JavaScript value V is converted to an IDL DataView value by running the following algorithm:
        // 1. If V is not an Object, or V does not have a [[DataView]] internal slot, then throw a TypeError.
        auto builtin_buffer = z.as_if<JS::DataView>();
        if (!builtin_buffer)
            return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAnObjectOfType, "zR");

        auto& viewed_array_buffer = *builtin_buffer->viewed_array_buffer();

viewed_array_bufferz        // 4. Return the IDL DataView value that is a reference to the same object as V.
        return GC::Ref { *builtin_buffer };
    }()rV  am  > {
        // A JavaScript value V is converted to an IDL typed array value by running the following algorithm:
        // 1. Let T be the IDL type V is being converted to.
        // 2. If V is not an Object, or V does not have a [[TypedArrayName]] internal slot with a value equal to T's name,
        //    then throw a TypeError.
        auto builtin_buffer = z.as_if<JS::z{>();
        if (!builtin_buffer)
            return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAnObjectOfType, "z        // 5. Return the IDL value of type T that is a reference to the same object as V.
        return GC::Ref { *builtin_buffer };
    }())rX   rw   r   r   r   rh   )	rc   r   rt  r   rm   rM   r  r  r   s	    `      @rK   buffer_source_to_idl_valuer    s    ILL!"LL()LL()"86> > > >(>c >c > >* M!23F2G H  *l +ZZcYd e%& ' (		 		 J/023F2G H  *l +ZZcYd e /0 1 2	 	 8$$1223F2G H
  *l+i[ AZZcYd e /0 1 2	 	 $H--rJ   c           	         U R                   nU=(       d
    [        XUS9nU=(       d    UnU R                  (       a  [        XX&X4U5      $ US:X  a  [	        X45      $ US:X  a  [        X45      $ US:X  a  [        X4U5      $ US:X  a  [        X4U5      $ US:X  a  [        X4U5      $ US:X  a  [        X4U5      $ US:X  a  [        X4U5      $ US	:X  a  [        X4U5      $ US
:X  a  [        X4U5      $ US:X  a  [        X4U5      $ US:X  a  [        X4U5      $ US:X  a  [        X45      $ US:X  a  [!        X4U5      $ US:X  a  [#        X45      $ US:X  a  [%        X45      $ US;   a  ['        UUUU5      $ US:X  a  [)        X45      $ US;   a  [+        UUUU5      $ US:X  a  [-        X45      $ US:X  a  [/        X45      $ [1        X5      n	U	b  [3        X4U	5      $ UR5                  U 5      n
U
b  U
R6                  (       a  [9        X4U
5      $ UR;                  U 5      b  [=        XXE5      $ UR?                  U 5      b  [A        XXE5      $ URC                  U 5      nUb  [E        XkX45      $ [G        U [H        5      (       a  US:X  a  [K        XX4U5      $ [G        U [H        5      (       a  US:X  a
  [M        5       $ [G        U [H        5      (       a  US:X  a  [O        XX4U5      $ [G        U [H        5      (       a  US:X  a  [Q        X45      $ [G        U [R        5      (       a  [U        XX#XE5      $ [W        U 5      (       a  [Y        XXsXE5      $ [G        U [H        5      (       a  US:X  a  [K        XX4U5      $ [[        U 5      $ )Nr*  rj   rP   byteoctetshortzunsigned shortlongzunsigned longz	long longzunsigned long longfloatzunrestricted floatdoublezunrestricted doublerQ   )	DOMStringUtf16DOMStringr   )	USVStringUtf16USVStringrR   symbolrU   async_sequencerW   r  rV   ).rX   r   nullabler4  r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r  r   r  r\   r]   r  r^   r  rY   r  r[   r(  r_   r)   r=  rB  rI  rK  r+   rs  r   r  rh   )rc   r   r   r   rm   rM   r  rt  r   r  r\   r[   s               rK   r.  r.  j  s    I% )>/B*O .@$"5
^e
 	
 E
55I#J99F 7JKKG!*8KLLG!*8KLL$$*:ATUUF 7JKKO#)*@STTK%j<OPP((.zEXYYG!*
CC((.zDDH":DD))/
EEH":8833&	
 	
 L &z<<33&	
 	
 H":88H":88:8M&%j<OPP!!(+I!@!@.zYOO(#/&xXOO8$0'hPP11(;$-oR\gg(011i:6M$X:QXYY(011iCS6S*,,(011i86K"8wWW(011i96L#J99(L))!(8KYakkX&&)+>H
 	
 (011i=6P$X:QXYY#H--rJ   r   c                     [        U R                  U R                  [        U S0 5      UUU[	        X5      [        X5      S9$ )Nr   )r  rt  )r.  r   rX   getattrr   r   )r   r   rm   rM   s       rK   r   r     sE     "-r2 1*6;	 	rJ   interface_namec                 .   [        U R                  5      (       a  SU S3$ [        X5      nUc  [        SU R                   SU S35      eUR	                  S5        UR	                  UR
                  5        SU SUR                   SUR                   S	3$ )
Nz	    if (!zm.is_string())
        return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAnObjectOfType, "String");
zUnsupported IDL value type 'z' on 're   rv  z.is<zZ>())
        return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAnObjectOfType, "r   )r   rX   r   rg   rw   r
  r  )rc   r   rm   rM   r  r  s         rK   type_check_idl_valuer    s     hmm$$ZL )  	 ;8M"9(--~N^^_`aaLL!"LL$::;D)<)Q)Q(R SVViV~V~U @ rJ   )Nr  )Nr  )NN)cdataclassesr   r   typingr   r   r   r   "Generators.libweb_bindings.contextr	   $Generators.libweb_bindings.cpp_typesr
   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   )Generators.libweb_bindings.default_valuesr    #Generators.libweb_bindings.includesr!   Utils.utilsr"   r#   r$   r%   Utils.webidl_parserr&   r'   r(   r)   r*   r+   r,   r.   rb   r   rh   rH   rk   r}   r   r   r   r   r   r   dictr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r  r  r  r  r  r(  r4  r=  r9  rB  rI  rK  rs  r  r.  r   r  rA   rJ   rK   <module>r     sK	  
 "      @ L B M O M P H @ 9 9 F N I ? S T Q F @ ? D F R A 0 / 0 0 0 * + 4 ' , ) ' ' '*-W -HY -^h -`Mw M3 M3w 3AR 3W[ 3
v 
K 
Sd 
im 
	   	
 
>  4
3C   N_   dhisdt   Ff ; Rc hl 8W	WW  W 	W
 
Wv 0A c  (S (4E (# (   c3h	
 	$U# U1B UY]^acf^fYg Ulo UV3 V2C VZ^_bdg_gZh Vmp VV3 V2C VZ^_bdg_gZh Vmp V^^0^GKCQTH~^^U# U1B UY]^acf^fYg Ulo U]]0]GKCQTH~]]Ys Y6G Y^bcfhkck^l Yqt Yaaa c3ha 		a3 2C QT Y\ * ?P UX $C 3D RU Z]  ) )@Q )VY ))C )3D ) ) 59 	 "$sCx.1 	
 	8
 
7H 
S 
" 59 	 "$sCx.1 	
 	*C 3D  PC P3D P P + 		(  		6DDD  D 	D
 	DDDD  D 	D
 	D&&'& &  	&
 	&TAAA c3hA 	A
 A  A A 	AJ'   	
  	8,',, , 	,
  , , 	,`XX X
>%>> >  	>
 > 	>D 	.MMM c3hM 	M
  M M 	M`
d.d.c3hd. d. 	d.
  d. d. 	d.\ &*)-q.q.q. c3hq. 	q.
  q. q. c]q. "#q. 	q.h'   	
 	$   	
  	rJ   