From 09f368835b38f686852a0166d27d041076b1f549 Mon Sep 17 00:00:00 2001 From: poppingmoon <63451158+poppingmoon@users.noreply.github.com> Date: Sun, 16 Jun 2024 17:21:47 +0000 Subject: [PATCH] feat: Play (#207) * refactor: rename UserTile to UserPreview * refactor: add a widget to display account info * feat: do not remove tabs when sign out * refactor: add showErrorMessageDialog * refactor: make bottom ads rounded * fix: do not save draft if guest * feat: edit Play * feat: support clickable mfm * feat: play Play * feat: backup aiscript storage * ci: install rust --- Dockerfile | 2 + analysis_options.yaml | 2 + flutter_rust_bridge.yaml | 2 + lib/main.dart | 2 + lib/model/aria_backup.dart | 1 + lib/model/aria_backup.freezed.dart | 57 +- lib/model/aria_backup.g.dart | 4 + lib/provider/accounts_notifier_provider.dart | 4 - .../accounts_notifier_provider.g.dart | 2 +- .../aiscript_storage_notifier_provider.dart | 46 + .../aiscript_storage_notifier_provider.g.dart | 176 + lib/provider/api/play_notifier_provider.dart | 59 + .../api/play_notifier_provider.g.dart | 195 + lib/provider/api/post_notifier_provider.dart | 8 +- .../api/post_notifier_provider.g.dart | 2 +- .../timeline_tabs_notifier_provider.dart | 6 - .../timeline_tabs_notifier_provider.g.dart | 2 +- lib/router/router.dart | 27 + lib/router/router.g.dart | 2 +- lib/rust/api/aiscript.dart | 27 + lib/rust/api/aiscript/api.dart | 44 + lib/rust/api/aiscript/play.dart | 30 + lib/rust/api/aiscript/ui.dart | 558 +++ lib/rust/api/aiscript/ui.freezed.dart | 3110 ++++++++++++ lib/rust/api/init.dart | 7 + lib/rust/frb_generated.dart | 4346 +++++++++++++++++ lib/rust/frb_generated.io.dart | 1722 +++++++ lib/rust/frb_generated.web.dart | 1602 ++++++ lib/util/future_with_dialog.dart | 10 +- lib/util/navigate.dart | 1 + lib/view/dialog/error_message_dialog.dart | 14 + lib/view/dialog/user_select_dialog.dart | 6 +- lib/view/page/gallery/gallery_post_page.dart | 9 +- lib/view/page/page/page_page.dart | 9 +- lib/view/page/play/play_edit_page.dart | 193 + lib/view/page/play/play_page.dart | 227 + lib/view/page/play/plays_featured.dart | 8 +- lib/view/page/play/plays_liked.dart | 7 +- lib/view/page/play/plays_my.dart | 7 +- lib/view/page/play/plays_page.dart | 8 + lib/view/page/settings/accounts_page.dart | 16 +- lib/view/page/settings/emoji_picker_page.dart | 30 +- .../page/settings/import_export_page.dart | 62 +- lib/view/page/share_page.dart | 14 +- lib/view/page/user/user_list_page.dart | 4 +- lib/view/page/user/user_plays.dart | 7 +- lib/view/widget/account_preview.dart | 40 + lib/view/widget/as_ui_widget.dart | 701 +++ lib/view/widget/mfm.dart | 5 + lib/view/widget/mfm/mfm_builder.dart | 22 + lib/view/widget/note_sheet.dart | 32 +- lib/view/widget/play_preview.dart | 19 +- lib/view/widget/play_widget.dart | 541 ++ lib/view/widget/post_form.dart | 16 +- lib/view/widget/reaction_users_sheet.dart | 4 +- lib/view/widget/renote_users_sheet.dart | 4 +- lib/view/widget/streaming_error_icon.dart | 10 +- .../{user_tile.dart => user_preview.dart} | 4 +- lib/view/widget/user_sheet.dart | 32 +- linux/flutter/generated_plugins.cmake | 1 + pubspec.lock | 27 +- pubspec.yaml | 5 +- rust/.gitignore | 1 + rust/Cargo.lock | 1010 ++++ rust/Cargo.toml | 15 + rust/src/api/aiscript.rs | 73 + rust/src/api/aiscript/api.rs | 304 ++ rust/src/api/aiscript/play.rs | 16 + rust/src/api/aiscript/ui.rs | 1795 +++++++ rust/src/api/mod.rs | 1 + rust/src/frb_generated.io.rs | 156 + rust/src/frb_generated.rs | 3197 ++++++++++++ rust/src/frb_generated.web.rs | 158 + rust/src/lib.rs | 2 + rust_builder/.gitignore | 29 + rust_builder/README.md | 1 + rust_builder/android/.gitignore | 9 + rust_builder/android/build.gradle | 56 + rust_builder/android/settings.gradle | 1 + .../android/src/main/AndroidManifest.xml | 3 + rust_builder/cargokit/.gitignore | 4 + rust_builder/cargokit/LICENSE | 42 + rust_builder/cargokit/README | 11 + rust_builder/cargokit/build_pod.sh | 58 + rust_builder/cargokit/build_tool/README.md | 5 + .../cargokit/build_tool/analysis_options.yaml | 34 + .../cargokit/build_tool/bin/build_tool.dart | 8 + .../cargokit/build_tool/lib/build_tool.dart | 8 + .../lib/src/android_environment.dart | 195 + .../lib/src/artifacts_provider.dart | 266 + .../build_tool/lib/src/build_cmake.dart | 40 + .../build_tool/lib/src/build_gradle.dart | 49 + .../build_tool/lib/src/build_pod.dart | 89 + .../build_tool/lib/src/build_tool.dart | 271 + .../cargokit/build_tool/lib/src/builder.dart | 198 + .../cargokit/build_tool/lib/src/cargo.dart | 48 + .../build_tool/lib/src/crate_hash.dart | 124 + .../build_tool/lib/src/environment.dart | 68 + .../cargokit/build_tool/lib/src/logging.dart | 52 + .../cargokit/build_tool/lib/src/options.dart | 309 ++ .../lib/src/precompile_binaries.dart | 202 + .../cargokit/build_tool/lib/src/rustup.dart | 136 + .../cargokit/build_tool/lib/src/target.dart | 140 + .../cargokit/build_tool/lib/src/util.dart | 172 + .../build_tool/lib/src/verify_binaries.dart | 84 + rust_builder/cargokit/build_tool/pubspec.lock | 453 ++ rust_builder/cargokit/build_tool/pubspec.yaml | 33 + rust_builder/cargokit/cmake/cargokit.cmake | 99 + .../cargokit/cmake/resolve_symlinks.ps1 | 27 + rust_builder/cargokit/gradle/plugin.gradle | 175 + rust_builder/cargokit/run_build_tool.cmd | 91 + rust_builder/cargokit/run_build_tool.sh | 94 + rust_builder/ios/Classes/dummy_file.c | 1 + rust_builder/ios/rust_lib_aria.podspec | 45 + rust_builder/linux/CMakeLists.txt | 19 + rust_builder/macos/Classes/dummy_file.c | 1 + rust_builder/macos/rust_lib_aria.podspec | 44 + rust_builder/pubspec.yaml | 34 + rust_builder/windows/.gitignore | 17 + rust_builder/windows/CMakeLists.txt | 20 + windows/flutter/generated_plugins.cmake | 1 + 121 files changed, 24536 insertions(+), 198 deletions(-) create mode 100644 flutter_rust_bridge.yaml create mode 100644 lib/provider/aiscript_storage_notifier_provider.dart create mode 100644 lib/provider/aiscript_storage_notifier_provider.g.dart create mode 100644 lib/provider/api/play_notifier_provider.dart create mode 100644 lib/provider/api/play_notifier_provider.g.dart create mode 100644 lib/rust/api/aiscript.dart create mode 100644 lib/rust/api/aiscript/api.dart create mode 100644 lib/rust/api/aiscript/play.dart create mode 100644 lib/rust/api/aiscript/ui.dart create mode 100644 lib/rust/api/aiscript/ui.freezed.dart create mode 100644 lib/rust/api/init.dart create mode 100644 lib/rust/frb_generated.dart create mode 100644 lib/rust/frb_generated.io.dart create mode 100644 lib/rust/frb_generated.web.dart create mode 100644 lib/view/page/play/play_edit_page.dart create mode 100644 lib/view/page/play/play_page.dart create mode 100644 lib/view/widget/account_preview.dart create mode 100644 lib/view/widget/as_ui_widget.dart create mode 100644 lib/view/widget/play_widget.dart rename lib/view/widget/{user_tile.dart => user_preview.dart} (92%) create mode 100644 rust/.gitignore create mode 100644 rust/Cargo.lock create mode 100644 rust/Cargo.toml create mode 100644 rust/src/api/aiscript.rs create mode 100644 rust/src/api/aiscript/api.rs create mode 100644 rust/src/api/aiscript/play.rs create mode 100644 rust/src/api/aiscript/ui.rs create mode 100644 rust/src/api/mod.rs create mode 100644 rust/src/frb_generated.io.rs create mode 100644 rust/src/frb_generated.rs create mode 100644 rust/src/frb_generated.web.rs create mode 100644 rust/src/lib.rs create mode 100644 rust_builder/.gitignore create mode 100644 rust_builder/README.md create mode 100644 rust_builder/android/.gitignore create mode 100644 rust_builder/android/build.gradle create mode 100644 rust_builder/android/settings.gradle create mode 100644 rust_builder/android/src/main/AndroidManifest.xml create mode 100644 rust_builder/cargokit/.gitignore create mode 100644 rust_builder/cargokit/LICENSE create mode 100644 rust_builder/cargokit/README create mode 100644 rust_builder/cargokit/build_pod.sh create mode 100644 rust_builder/cargokit/build_tool/README.md create mode 100644 rust_builder/cargokit/build_tool/analysis_options.yaml create mode 100644 rust_builder/cargokit/build_tool/bin/build_tool.dart create mode 100644 rust_builder/cargokit/build_tool/lib/build_tool.dart create mode 100644 rust_builder/cargokit/build_tool/lib/src/android_environment.dart create mode 100644 rust_builder/cargokit/build_tool/lib/src/artifacts_provider.dart create mode 100644 rust_builder/cargokit/build_tool/lib/src/build_cmake.dart create mode 100644 rust_builder/cargokit/build_tool/lib/src/build_gradle.dart create mode 100644 rust_builder/cargokit/build_tool/lib/src/build_pod.dart create mode 100644 rust_builder/cargokit/build_tool/lib/src/build_tool.dart create mode 100644 rust_builder/cargokit/build_tool/lib/src/builder.dart create mode 100644 rust_builder/cargokit/build_tool/lib/src/cargo.dart create mode 100644 rust_builder/cargokit/build_tool/lib/src/crate_hash.dart create mode 100644 rust_builder/cargokit/build_tool/lib/src/environment.dart create mode 100644 rust_builder/cargokit/build_tool/lib/src/logging.dart create mode 100644 rust_builder/cargokit/build_tool/lib/src/options.dart create mode 100644 rust_builder/cargokit/build_tool/lib/src/precompile_binaries.dart create mode 100644 rust_builder/cargokit/build_tool/lib/src/rustup.dart create mode 100644 rust_builder/cargokit/build_tool/lib/src/target.dart create mode 100644 rust_builder/cargokit/build_tool/lib/src/util.dart create mode 100644 rust_builder/cargokit/build_tool/lib/src/verify_binaries.dart create mode 100644 rust_builder/cargokit/build_tool/pubspec.lock create mode 100644 rust_builder/cargokit/build_tool/pubspec.yaml create mode 100644 rust_builder/cargokit/cmake/cargokit.cmake create mode 100644 rust_builder/cargokit/cmake/resolve_symlinks.ps1 create mode 100644 rust_builder/cargokit/gradle/plugin.gradle create mode 100644 rust_builder/cargokit/run_build_tool.cmd create mode 100644 rust_builder/cargokit/run_build_tool.sh create mode 100644 rust_builder/ios/Classes/dummy_file.c create mode 100644 rust_builder/ios/rust_lib_aria.podspec create mode 100644 rust_builder/linux/CMakeLists.txt create mode 100644 rust_builder/macos/Classes/dummy_file.c create mode 100644 rust_builder/macos/rust_lib_aria.podspec create mode 100644 rust_builder/pubspec.yaml create mode 100644 rust_builder/windows/.gitignore create mode 100644 rust_builder/windows/CMakeLists.txt diff --git a/Dockerfile b/Dockerfile index b652d538..170924b7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,3 +23,5 @@ RUN ARCH=$(case $TARGETARCH in \ && tar xzf fvm.tar.gz -C $FVM_DIR \ && rm -f fvm.tar.gz \ && ln -sf $FVM_DIR/fvm/fvm /usr/local/bin/fvm + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y diff --git a/analysis_options.yaml b/analysis_options.yaml index 54995435..94fc8991 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -4,6 +4,8 @@ analyzer: exclude: - "**/*.freezed.dart" - "**/*.g.dart" + - "lib/rust/**" + - "rust_builder/**" language: strict-casts: true strict-inference: true diff --git a/flutter_rust_bridge.yaml b/flutter_rust_bridge.yaml new file mode 100644 index 00000000..bdef4ca9 --- /dev/null +++ b/flutter_rust_bridge.yaml @@ -0,0 +1,2 @@ +rust_input: rust/src/api/**/*.rs +dart_output: lib/rust diff --git a/lib/main.dart b/lib/main.dart index 0f896da9..eff8c81c 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -14,6 +14,7 @@ import 'provider/general_settings_notifier_provider.dart'; import 'provider/shared_preferences_provider.dart'; import 'provider/theme_data_provider.dart'; import 'router/router.dart'; +import 'rust/frb_generated.dart'; void main() async { WidgetsFlutterBinding.ensureInitialized(); @@ -68,6 +69,7 @@ void main() async { ); }); final prefs = await SharedPreferences.getInstance(); + await RustLib.init(); runApp( ProviderScope( overrides: [sharedPreferencesProvider.overrideWithValue(prefs)], diff --git a/lib/model/aria_backup.dart b/lib/model/aria_backup.dart index 150ff4d5..0ee08f0e 100644 --- a/lib/model/aria_backup.dart +++ b/lib/model/aria_backup.dart @@ -15,6 +15,7 @@ class AriaBackup with _$AriaBackup { Map? accountSettings, GeneralSettings? generalSettings, List? themes, + Map>? aiscriptStorage, }) = _AriaBackup; factory AriaBackup.fromJson(Map json) => diff --git a/lib/model/aria_backup.freezed.dart b/lib/model/aria_backup.freezed.dart index 1229cbbe..87447299 100644 --- a/lib/model/aria_backup.freezed.dart +++ b/lib/model/aria_backup.freezed.dart @@ -26,6 +26,8 @@ mixin _$AriaBackup { throw _privateConstructorUsedError; GeneralSettings? get generalSettings => throw _privateConstructorUsedError; List? get themes => throw _privateConstructorUsedError; + Map>? get aiscriptStorage => + throw _privateConstructorUsedError; Map toJson() => throw _privateConstructorUsedError; @JsonKey(ignore: true) @@ -44,7 +46,8 @@ abstract class $AriaBackupCopyWith<$Res> { List? timelineTabs, Map? accountSettings, GeneralSettings? generalSettings, - List? themes}); + List? themes, + Map>? aiscriptStorage}); $GeneralSettingsCopyWith<$Res>? get generalSettings; } @@ -67,6 +70,7 @@ class _$AriaBackupCopyWithImpl<$Res, $Val extends AriaBackup> Object? accountSettings = freezed, Object? generalSettings = freezed, Object? themes = freezed, + Object? aiscriptStorage = freezed, }) { return _then(_value.copyWith( metadata: freezed == metadata @@ -89,6 +93,10 @@ class _$AriaBackupCopyWithImpl<$Res, $Val extends AriaBackup> ? _value.themes : themes // ignore: cast_nullable_to_non_nullable as List?, + aiscriptStorage: freezed == aiscriptStorage + ? _value.aiscriptStorage + : aiscriptStorage // ignore: cast_nullable_to_non_nullable + as Map>?, ) as $Val); } @@ -118,7 +126,8 @@ abstract class _$$AriaBackupImplCopyWith<$Res> List? timelineTabs, Map? accountSettings, GeneralSettings? generalSettings, - List? themes}); + List? themes, + Map>? aiscriptStorage}); @override $GeneralSettingsCopyWith<$Res>? get generalSettings; @@ -140,6 +149,7 @@ class __$$AriaBackupImplCopyWithImpl<$Res> Object? accountSettings = freezed, Object? generalSettings = freezed, Object? themes = freezed, + Object? aiscriptStorage = freezed, }) { return _then(_$AriaBackupImpl( metadata: freezed == metadata @@ -162,6 +172,10 @@ class __$$AriaBackupImplCopyWithImpl<$Res> ? _value._themes : themes // ignore: cast_nullable_to_non_nullable as List?, + aiscriptStorage: freezed == aiscriptStorage + ? _value._aiscriptStorage + : aiscriptStorage // ignore: cast_nullable_to_non_nullable + as Map>?, )); } } @@ -174,11 +188,13 @@ class _$AriaBackupImpl implements _AriaBackup { final List? timelineTabs, final Map? accountSettings, this.generalSettings, - final List? themes}) + final List? themes, + final Map>? aiscriptStorage}) : _metadata = metadata, _timelineTabs = timelineTabs, _accountSettings = accountSettings, - _themes = themes; + _themes = themes, + _aiscriptStorage = aiscriptStorage; factory _$AriaBackupImpl.fromJson(Map json) => _$$AriaBackupImplFromJson(json); @@ -225,9 +241,19 @@ class _$AriaBackupImpl implements _AriaBackup { return EqualUnmodifiableListView(value); } + final Map>? _aiscriptStorage; + @override + Map>? get aiscriptStorage { + final value = _aiscriptStorage; + if (value == null) return null; + if (_aiscriptStorage is EqualUnmodifiableMapView) return _aiscriptStorage; + // ignore: implicit_dynamic_type + return EqualUnmodifiableMapView(value); + } + @override String toString() { - return 'AriaBackup(metadata: $metadata, timelineTabs: $timelineTabs, accountSettings: $accountSettings, generalSettings: $generalSettings, themes: $themes)'; + return 'AriaBackup(metadata: $metadata, timelineTabs: $timelineTabs, accountSettings: $accountSettings, generalSettings: $generalSettings, themes: $themes, aiscriptStorage: $aiscriptStorage)'; } @override @@ -242,7 +268,9 @@ class _$AriaBackupImpl implements _AriaBackup { .equals(other._accountSettings, _accountSettings) && (identical(other.generalSettings, generalSettings) || other.generalSettings == generalSettings) && - const DeepCollectionEquality().equals(other._themes, _themes)); + const DeepCollectionEquality().equals(other._themes, _themes) && + const DeepCollectionEquality() + .equals(other._aiscriptStorage, _aiscriptStorage)); } @JsonKey(ignore: true) @@ -253,7 +281,8 @@ class _$AriaBackupImpl implements _AriaBackup { const DeepCollectionEquality().hash(_timelineTabs), const DeepCollectionEquality().hash(_accountSettings), generalSettings, - const DeepCollectionEquality().hash(_themes)); + const DeepCollectionEquality().hash(_themes), + const DeepCollectionEquality().hash(_aiscriptStorage)); @JsonKey(ignore: true) @override @@ -271,11 +300,13 @@ class _$AriaBackupImpl implements _AriaBackup { abstract class _AriaBackup implements AriaBackup { const factory _AriaBackup( - {final Map? metadata, - final List? timelineTabs, - final Map? accountSettings, - final GeneralSettings? generalSettings, - final List? themes}) = _$AriaBackupImpl; + {final Map? metadata, + final List? timelineTabs, + final Map? accountSettings, + final GeneralSettings? generalSettings, + final List? themes, + final Map>? aiscriptStorage}) = + _$AriaBackupImpl; factory _AriaBackup.fromJson(Map json) = _$AriaBackupImpl.fromJson; @@ -291,6 +322,8 @@ abstract class _AriaBackup implements AriaBackup { @override List? get themes; @override + Map>? get aiscriptStorage; + @override @JsonKey(ignore: true) _$$AriaBackupImplCopyWith<_$AriaBackupImpl> get copyWith => throw _privateConstructorUsedError; diff --git a/lib/model/aria_backup.g.dart b/lib/model/aria_backup.g.dart index 99c81baf..b0e79d3f 100644 --- a/lib/model/aria_backup.g.dart +++ b/lib/model/aria_backup.g.dart @@ -22,6 +22,9 @@ _$AriaBackupImpl _$$AriaBackupImplFromJson(Map json) => json['generalSettings'] as Map), themes: (json['themes'] as List?)?.map((e) => e as String).toList(), + aiscriptStorage: (json['aiscriptStorage'] as Map?)?.map( + (k, e) => MapEntry(k, Map.from(e as Map)), + ), ); Map _$$AriaBackupImplToJson(_$AriaBackupImpl instance) { @@ -40,5 +43,6 @@ Map _$$AriaBackupImplToJson(_$AriaBackupImpl instance) { instance.accountSettings?.map((k, e) => MapEntry(k, e.toJson()))); writeNotNull('generalSettings', instance.generalSettings?.toJson()); writeNotNull('themes', instance.themes); + writeNotNull('aiscriptStorage', instance.aiscriptStorage); return val; } diff --git a/lib/provider/accounts_notifier_provider.dart b/lib/provider/accounts_notifier_provider.dart index d1d6f9ce..14ba165f 100644 --- a/lib/provider/accounts_notifier_provider.dart +++ b/lib/provider/accounts_notifier_provider.dart @@ -7,7 +7,6 @@ import '../model/account.dart'; import 'dio_provider.dart'; import 'emojis_notifier_provider.dart'; import 'shared_preferences_provider.dart'; -import 'timeline_tabs_notifier_provider.dart'; import 'tokens_notifier_provider.dart'; part 'accounts_notifier_provider.g.dart'; @@ -80,9 +79,6 @@ class AccountsNotifier extends _$AccountsNotifier { } Future remove(Account account) async { - await ref - .read(timelineTabsNotifierProvider.notifier) - .deleteTabsOfAccount(account); state = state.where((acct) => acct != account).toList(); await ref.read(tokensNotifierProvider.notifier).remove(account); } diff --git a/lib/provider/accounts_notifier_provider.g.dart b/lib/provider/accounts_notifier_provider.g.dart index 9442ef9a..719e9087 100644 --- a/lib/provider/accounts_notifier_provider.g.dart +++ b/lib/provider/accounts_notifier_provider.g.dart @@ -6,7 +6,7 @@ part of 'accounts_notifier_provider.dart'; // RiverpodGenerator // ************************************************************************** -String _$accountsNotifierHash() => r'27a1e06e2ca9c77ab0fe2ac190550688d25bae79'; +String _$accountsNotifierHash() => r'b189860bade1f41f2db460cdf5b5175acf9cc01f'; /// See also [AccountsNotifier]. @ProviderFor(AccountsNotifier) diff --git a/lib/provider/aiscript_storage_notifier_provider.dart b/lib/provider/aiscript_storage_notifier_provider.dart new file mode 100644 index 00000000..b017d83c --- /dev/null +++ b/lib/provider/aiscript_storage_notifier_provider.dart @@ -0,0 +1,46 @@ +import 'dart:convert'; + +import 'package:riverpod_annotation/riverpod_annotation.dart'; + +import '../model/account.dart'; +import 'shared_preferences_provider.dart'; + +part 'aiscript_storage_notifier_provider.g.dart'; + +@riverpod +class AiscriptStorageNotifier extends _$AiscriptStorageNotifier { + @override + Map build(Account account) { + final value = ref.watch(sharedPreferencesProvider).getString(_key); + if (value != null) { + final json = jsonDecode(value); + if (json is Map) { + return json.map((key, value) => MapEntry(key, value.toString())); + } + } + return {}; + } + + String get _key => '$account/aiscript'; + + Future save(String key, String value) async { + state = { + ...state, + key: value, + }; + await ref + .read(sharedPreferencesProvider) + .setString(_key, jsonEncode(state)); + } + + String? load(String key) { + return state[key]; + } + + Future import(Map storage) async { + state = storage; + await ref + .read(sharedPreferencesProvider) + .setString(_key, jsonEncode(state)); + } +} diff --git a/lib/provider/aiscript_storage_notifier_provider.g.dart b/lib/provider/aiscript_storage_notifier_provider.g.dart new file mode 100644 index 00000000..ae990c29 --- /dev/null +++ b/lib/provider/aiscript_storage_notifier_provider.g.dart @@ -0,0 +1,176 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'aiscript_storage_notifier_provider.dart'; + +// ************************************************************************** +// RiverpodGenerator +// ************************************************************************** + +String _$aiscriptStorageNotifierHash() => + r'98f3510b7a9b94d0a03dbb8839b4679738c0ae27'; + +/// Copied from Dart SDK +class _SystemHash { + _SystemHash._(); + + static int combine(int hash, int value) { + // ignore: parameter_assignments + hash = 0x1fffffff & (hash + value); + // ignore: parameter_assignments + hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10)); + return hash ^ (hash >> 6); + } + + static int finish(int hash) { + // ignore: parameter_assignments + hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3)); + // ignore: parameter_assignments + hash = hash ^ (hash >> 11); + return 0x1fffffff & (hash + ((0x00003fff & hash) << 15)); + } +} + +abstract class _$AiscriptStorageNotifier + extends BuildlessAutoDisposeNotifier> { + late final Account account; + + Map build( + Account account, + ); +} + +/// See also [AiscriptStorageNotifier]. +@ProviderFor(AiscriptStorageNotifier) +const aiscriptStorageNotifierProvider = AiscriptStorageNotifierFamily(); + +/// See also [AiscriptStorageNotifier]. +class AiscriptStorageNotifierFamily extends Family> { + /// See also [AiscriptStorageNotifier]. + const AiscriptStorageNotifierFamily(); + + /// See also [AiscriptStorageNotifier]. + AiscriptStorageNotifierProvider call( + Account account, + ) { + return AiscriptStorageNotifierProvider( + account, + ); + } + + @override + AiscriptStorageNotifierProvider getProviderOverride( + covariant AiscriptStorageNotifierProvider provider, + ) { + return call( + provider.account, + ); + } + + static const Iterable? _dependencies = null; + + @override + Iterable? get dependencies => _dependencies; + + static const Iterable? _allTransitiveDependencies = null; + + @override + Iterable? get allTransitiveDependencies => + _allTransitiveDependencies; + + @override + String? get name => r'aiscriptStorageNotifierProvider'; +} + +/// See also [AiscriptStorageNotifier]. +class AiscriptStorageNotifierProvider extends AutoDisposeNotifierProviderImpl< + AiscriptStorageNotifier, Map> { + /// See also [AiscriptStorageNotifier]. + AiscriptStorageNotifierProvider( + Account account, + ) : this._internal( + () => AiscriptStorageNotifier()..account = account, + from: aiscriptStorageNotifierProvider, + name: r'aiscriptStorageNotifierProvider', + debugGetCreateSourceHash: + const bool.fromEnvironment('dart.vm.product') + ? null + : _$aiscriptStorageNotifierHash, + dependencies: AiscriptStorageNotifierFamily._dependencies, + allTransitiveDependencies: + AiscriptStorageNotifierFamily._allTransitiveDependencies, + account: account, + ); + + AiscriptStorageNotifierProvider._internal( + super._createNotifier, { + required super.name, + required super.dependencies, + required super.allTransitiveDependencies, + required super.debugGetCreateSourceHash, + required super.from, + required this.account, + }) : super.internal(); + + final Account account; + + @override + Map runNotifierBuild( + covariant AiscriptStorageNotifier notifier, + ) { + return notifier.build( + account, + ); + } + + @override + Override overrideWith(AiscriptStorageNotifier Function() create) { + return ProviderOverride( + origin: this, + override: AiscriptStorageNotifierProvider._internal( + () => create()..account = account, + from: from, + name: null, + dependencies: null, + allTransitiveDependencies: null, + debugGetCreateSourceHash: null, + account: account, + ), + ); + } + + @override + AutoDisposeNotifierProviderElement> createElement() { + return _AiscriptStorageNotifierProviderElement(this); + } + + @override + bool operator ==(Object other) { + return other is AiscriptStorageNotifierProvider && other.account == account; + } + + @override + int get hashCode { + var hash = _SystemHash.combine(0, runtimeType.hashCode); + hash = _SystemHash.combine(hash, account.hashCode); + + return _SystemHash.finish(hash); + } +} + +mixin AiscriptStorageNotifierRef + on AutoDisposeNotifierProviderRef> { + /// The parameter `account` of this provider. + Account get account; +} + +class _AiscriptStorageNotifierProviderElement + extends AutoDisposeNotifierProviderElement> with AiscriptStorageNotifierRef { + _AiscriptStorageNotifierProviderElement(super.provider); + + @override + Account get account => (origin as AiscriptStorageNotifierProvider).account; +} +// ignore_for_file: type=lint +// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member diff --git a/lib/provider/api/play_notifier_provider.dart b/lib/provider/api/play_notifier_provider.dart new file mode 100644 index 00000000..e8874143 --- /dev/null +++ b/lib/provider/api/play_notifier_provider.dart @@ -0,0 +1,59 @@ +import 'package:misskey_dart/misskey_dart.dart'; +import 'package:riverpod_annotation/riverpod_annotation.dart'; + +import '../../model/account.dart'; +import 'misskey_provider.dart'; + +part 'play_notifier_provider.g.dart'; + +@riverpod +class PlayNotifier extends _$PlayNotifier { + @override + FutureOr build(Account account, String playId) async { + return _misskey.flash.show(FlashShowRequest(flashId: playId)); + } + + Misskey get _misskey => ref.read(misskeyProvider(account)); + + Future updatePlay({ + required String title, + required String summary, + required String script, + required FlashVisibility visibility, + }) async { + await _misskey.flash.update( + FlashUpdateRequest( + flashId: playId, + title: title, + summary: summary, + script: script, + permissions: [], + visibility: visibility, + ), + ); + final play = await future; + state = AsyncValue.data( + play.copyWith( + title: title, + summary: summary, + script: script, + ), + ); + } + + Future like() async { + await _misskey.flash.like(FlashLikeRequest(flashId: playId)); + final play = await future; + state = AsyncValue.data( + play.copyWith(isLiked: true, likedCount: (play.likedCount ?? 0) + 1), + ); + } + + Future unlike() async { + await _misskey.flash.unlike(FlashUnlikeRequest(flashId: playId)); + final play = await future; + state = AsyncValue.data( + play.copyWith(isLiked: false, likedCount: (play.likedCount ?? 1) - 1), + ); + } +} diff --git a/lib/provider/api/play_notifier_provider.g.dart b/lib/provider/api/play_notifier_provider.g.dart new file mode 100644 index 00000000..bb5ebb52 --- /dev/null +++ b/lib/provider/api/play_notifier_provider.g.dart @@ -0,0 +1,195 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'play_notifier_provider.dart'; + +// ************************************************************************** +// RiverpodGenerator +// ************************************************************************** + +String _$playNotifierHash() => r'e736c91d84dd55f3fcad3b676e876c8c7d4a4869'; + +/// Copied from Dart SDK +class _SystemHash { + _SystemHash._(); + + static int combine(int hash, int value) { + // ignore: parameter_assignments + hash = 0x1fffffff & (hash + value); + // ignore: parameter_assignments + hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10)); + return hash ^ (hash >> 6); + } + + static int finish(int hash) { + // ignore: parameter_assignments + hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3)); + // ignore: parameter_assignments + hash = hash ^ (hash >> 11); + return 0x1fffffff & (hash + ((0x00003fff & hash) << 15)); + } +} + +abstract class _$PlayNotifier extends BuildlessAutoDisposeAsyncNotifier { + late final Account account; + late final String playId; + + FutureOr build( + Account account, + String playId, + ); +} + +/// See also [PlayNotifier]. +@ProviderFor(PlayNotifier) +const playNotifierProvider = PlayNotifierFamily(); + +/// See also [PlayNotifier]. +class PlayNotifierFamily extends Family> { + /// See also [PlayNotifier]. + const PlayNotifierFamily(); + + /// See also [PlayNotifier]. + PlayNotifierProvider call( + Account account, + String playId, + ) { + return PlayNotifierProvider( + account, + playId, + ); + } + + @override + PlayNotifierProvider getProviderOverride( + covariant PlayNotifierProvider provider, + ) { + return call( + provider.account, + provider.playId, + ); + } + + static const Iterable? _dependencies = null; + + @override + Iterable? get dependencies => _dependencies; + + static const Iterable? _allTransitiveDependencies = null; + + @override + Iterable? get allTransitiveDependencies => + _allTransitiveDependencies; + + @override + String? get name => r'playNotifierProvider'; +} + +/// See also [PlayNotifier]. +class PlayNotifierProvider + extends AutoDisposeAsyncNotifierProviderImpl { + /// See also [PlayNotifier]. + PlayNotifierProvider( + Account account, + String playId, + ) : this._internal( + () => PlayNotifier() + ..account = account + ..playId = playId, + from: playNotifierProvider, + name: r'playNotifierProvider', + debugGetCreateSourceHash: + const bool.fromEnvironment('dart.vm.product') + ? null + : _$playNotifierHash, + dependencies: PlayNotifierFamily._dependencies, + allTransitiveDependencies: + PlayNotifierFamily._allTransitiveDependencies, + account: account, + playId: playId, + ); + + PlayNotifierProvider._internal( + super._createNotifier, { + required super.name, + required super.dependencies, + required super.allTransitiveDependencies, + required super.debugGetCreateSourceHash, + required super.from, + required this.account, + required this.playId, + }) : super.internal(); + + final Account account; + final String playId; + + @override + FutureOr runNotifierBuild( + covariant PlayNotifier notifier, + ) { + return notifier.build( + account, + playId, + ); + } + + @override + Override overrideWith(PlayNotifier Function() create) { + return ProviderOverride( + origin: this, + override: PlayNotifierProvider._internal( + () => create() + ..account = account + ..playId = playId, + from: from, + name: null, + dependencies: null, + allTransitiveDependencies: null, + debugGetCreateSourceHash: null, + account: account, + playId: playId, + ), + ); + } + + @override + AutoDisposeAsyncNotifierProviderElement createElement() { + return _PlayNotifierProviderElement(this); + } + + @override + bool operator ==(Object other) { + return other is PlayNotifierProvider && + other.account == account && + other.playId == playId; + } + + @override + int get hashCode { + var hash = _SystemHash.combine(0, runtimeType.hashCode); + hash = _SystemHash.combine(hash, account.hashCode); + hash = _SystemHash.combine(hash, playId.hashCode); + + return _SystemHash.finish(hash); + } +} + +mixin PlayNotifierRef on AutoDisposeAsyncNotifierProviderRef { + /// The parameter `account` of this provider. + Account get account; + + /// The parameter `playId` of this provider. + String get playId; +} + +class _PlayNotifierProviderElement + extends AutoDisposeAsyncNotifierProviderElement + with PlayNotifierRef { + _PlayNotifierProviderElement(super.provider); + + @override + Account get account => (origin as PlayNotifierProvider).account; + @override + String get playId => (origin as PlayNotifierProvider).playId; +} +// ignore_for_file: type=lint +// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member diff --git a/lib/provider/api/post_notifier_provider.dart b/lib/provider/api/post_notifier_provider.dart index ddc597f6..6ea00a1b 100644 --- a/lib/provider/api/post_notifier_provider.dart +++ b/lib/provider/api/post_notifier_provider.dart @@ -74,9 +74,11 @@ class PostNotifier extends _$PostNotifier { void save() { _saveScheduled = false; _timer?.cancel(); - ref - .read(sharedPreferencesProvider) - .setString(_key, jsonEncode(state.toJson())); + if (!account.isGuest) { + ref + .read(sharedPreferencesProvider) + .setString(_key, jsonEncode(state.toJson())); + } } void _scheduleSave() { diff --git a/lib/provider/api/post_notifier_provider.g.dart b/lib/provider/api/post_notifier_provider.g.dart index d7b8007f..1604267c 100644 --- a/lib/provider/api/post_notifier_provider.g.dart +++ b/lib/provider/api/post_notifier_provider.g.dart @@ -6,7 +6,7 @@ part of 'post_notifier_provider.dart'; // RiverpodGenerator // ************************************************************************** -String _$postNotifierHash() => r'ca2f158153ca6354c70a4ab21018738ba855373f'; +String _$postNotifierHash() => r'0ad470215a7835d3745c38ea455560fef9ce6f6c'; /// Copied from Dart SDK class _SystemHash { diff --git a/lib/provider/timeline_tabs_notifier_provider.dart b/lib/provider/timeline_tabs_notifier_provider.dart index a352eeba..3519cc2f 100644 --- a/lib/provider/timeline_tabs_notifier_provider.dart +++ b/lib/provider/timeline_tabs_notifier_provider.dart @@ -3,7 +3,6 @@ import 'dart:convert'; import 'package:riverpod_annotation/riverpod_annotation.dart'; import 'package:uuid/uuid.dart'; -import '../model/account.dart'; import '../model/tab_settings.dart'; import '../model/tab_type.dart'; import 'shared_preferences_provider.dart'; @@ -73,11 +72,6 @@ class TimelineTabsNotifier extends _$TimelineTabsNotifier { await _save(); } - Future deleteTabsOfAccount(Account account) async { - state = state.where((tabSetting) => tabSetting.account != account).toList(); - await _save(); - } - Future reorder(int oldIndex, int newIndex) async { final items = state.toList(); final item = items.removeAt(oldIndex); diff --git a/lib/provider/timeline_tabs_notifier_provider.g.dart b/lib/provider/timeline_tabs_notifier_provider.g.dart index 7cf6a0e7..d632f7a4 100644 --- a/lib/provider/timeline_tabs_notifier_provider.g.dart +++ b/lib/provider/timeline_tabs_notifier_provider.g.dart @@ -7,7 +7,7 @@ part of 'timeline_tabs_notifier_provider.dart'; // ************************************************************************** String _$timelineTabsNotifierHash() => - r'ed406d8f56cfdc80307cb285ee9dce0fc0b106d3'; + r'4ee03caf8e1f1d981afa38dc2a1cc1183308a989'; /// See also [TimelineTabsNotifier]. @ProviderFor(TimelineTabsNotifier) diff --git a/lib/router/router.dart b/lib/router/router.dart index 020790af..00becbcc 100644 --- a/lib/router/router.dart +++ b/lib/router/router.dart @@ -42,6 +42,8 @@ import '../view/page/notes_after_renotes_page.dart'; import '../view/page/notifications_page.dart'; import '../view/page/page/page_page.dart'; import '../view/page/page/pages_page.dart'; +import '../view/page/play/play_edit_page.dart'; +import '../view/page/play/play_page.dart'; import '../view/page/play/plays_page.dart'; import '../view/page/post_page.dart'; import '../view/page/role_page.dart'; @@ -524,6 +526,31 @@ GoRouter router(RouterRef ref) { builder: (_, state) => PlaysPage( account: Account.fromString(state.pathParameters['acct']!), ), + routes: [ + GoRoute( + path: 'new', + builder: (_, state) => PlayEditPage( + account: Account.fromString(state.pathParameters['acct']!), + ), + ), + GoRoute( + path: ':playId', + builder: (_, state) => PlayPage( + account: Account.fromString(state.pathParameters['acct']!), + playId: state.pathParameters['playId']!, + ), + routes: [ + GoRoute( + path: 'edit', + builder: (_, state) => PlayEditPage( + account: + Account.fromString(state.pathParameters['acct']!), + playId: state.pathParameters['playId'], + ), + ), + ], + ), + ], ), GoRoute( path: 'post', diff --git a/lib/router/router.g.dart b/lib/router/router.g.dart index 57600fdf..5cbf96b1 100644 --- a/lib/router/router.g.dart +++ b/lib/router/router.g.dart @@ -6,7 +6,7 @@ part of 'router.dart'; // RiverpodGenerator // ************************************************************************** -String _$routerHash() => r'92ffc00f91e92699dbf218436d904a1f75294034'; +String _$routerHash() => r'a815db148a0d2d2cae9dd2e3d26fc0fd4a22dd29'; /// See also [router]. @ProviderFor(router) diff --git a/lib/rust/api/aiscript.dart b/lib/rust/api/aiscript.dart new file mode 100644 index 00000000..8a1e1636 --- /dev/null +++ b/lib/rust/api/aiscript.dart @@ -0,0 +1,27 @@ +// This file is automatically generated, so please do not edit it. +// Generated by `flutter_rust_bridge`@ 2.0.0-dev.39. + +// ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import + +import '../frb_generated.dart'; +import 'aiscript/api.dart'; +import 'aiscript/play.dart'; +import 'aiscript/ui.dart'; +import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart'; + +// Rust type: RustOpaqueMoi> +abstract class AiScript implements RustOpaqueInterface { + Future abort(); + + Future exec({required String input}); + + // HINT: Make it `#[frb(sync)]` to let it become the default constructor of Dart class. + static Future newInstance( + {required FutureOr Function(String) read, + required FutureOr Function(String) write, + AsApiLib? api, + AsUiLib? ui, + AsPlayLib? play}) => + RustLib.instance.api.crateApiAiscriptAiScriptNew( + read: read, write: write, api: api, ui: ui, play: play); +} diff --git a/lib/rust/api/aiscript/api.dart b/lib/rust/api/aiscript/api.dart new file mode 100644 index 00000000..5c940a5e --- /dev/null +++ b/lib/rust/api/aiscript/api.dart @@ -0,0 +1,44 @@ +// This file is automatically generated, so please do not edit it. +// Generated by `flutter_rust_bridge`@ 2.0.0-dev.39. + +// ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import + +import '../../frb_generated.dart'; +import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart'; + +// These functions are ignored because they are not marked as `pub`: `register` + +// Rust type: RustOpaqueMoi> +abstract class AsApiLib implements RustOpaqueInterface { + factory AsApiLib( + {String? userId, + String? userName, + String? userUsername, + required String customEmojis, + required String locale, + required String serverUrl, + required FutureOr Function(String, String, String) dialog, + required FutureOr Function(String, String, String) confirm, + String? token, + required FutureOr<(String, String?)> Function(String, String, String?) + api, + required FutureOr Function(String, String) save, + required FutureOr Function(String) load, + required String url, + required FutureOr Function(String) nyaize}) => + RustLib.instance.api.crateApiAiscriptApiAsApiLibNew( + userId: userId, + userName: userName, + userUsername: userUsername, + customEmojis: customEmojis, + locale: locale, + serverUrl: serverUrl, + dialog: dialog, + confirm: confirm, + token: token, + api: api, + save: save, + load: load, + url: url, + nyaize: nyaize); +} diff --git a/lib/rust/api/aiscript/play.dart b/lib/rust/api/aiscript/play.dart new file mode 100644 index 00000000..4c8c96da --- /dev/null +++ b/lib/rust/api/aiscript/play.dart @@ -0,0 +1,30 @@ +// This file is automatically generated, so please do not edit it. +// Generated by `flutter_rust_bridge`@ 2.0.0-dev.39. + +// ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import + +import '../../frb_generated.dart'; +import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart'; + +// These functions are ignored because they are not marked as `pub`: `register` + +class AsPlayLib { + final String thisId; + final String thisUrl; + + const AsPlayLib({ + required this.thisId, + required this.thisUrl, + }); + + @override + int get hashCode => thisId.hashCode ^ thisUrl.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is AsPlayLib && + runtimeType == other.runtimeType && + thisId == other.thisId && + thisUrl == other.thisUrl; +} diff --git a/lib/rust/api/aiscript/ui.dart b/lib/rust/api/aiscript/ui.dart new file mode 100644 index 00000000..3110cd74 --- /dev/null +++ b/lib/rust/api/aiscript/ui.dart @@ -0,0 +1,558 @@ +// This file is automatically generated, so please do not edit it. +// Generated by `flutter_rust_bridge`@ 2.0.0-dev.39. + +// ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import + +import '../../frb_generated.dart'; +import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart'; +import 'package:freezed_annotation/freezed_annotation.dart' hide protected; +part 'ui.freezed.dart'; + +// These functions are ignored because they are not marked as `pub`: `create_component_instance`, `register`, `update`, `update`, `update`, `update`, `update`, `update`, `update`, `update`, `update`, `update`, `update`, `update`, `update`, `update`, `update` + +// Rust type: RustOpaqueMoi> +abstract class AsUiButtonCallback implements RustOpaqueInterface { + Future call(); +} + +// Rust type: RustOpaqueMoi> +abstract class AsUiLib implements RustOpaqueInterface { + factory AsUiLib( + {required FutureOr Function(String, AsUiComponent) onUpdate}) => + RustLib.instance.api.crateApiAiscriptUiAsUiLibNew(onUpdate: onUpdate); +} + +// Rust type: RustOpaqueMoi> +abstract class AsUiMfmCallback implements RustOpaqueInterface { + Future call({required String value}); +} + +// Rust type: RustOpaqueMoi> +abstract class AsUiNumberCallback implements RustOpaqueInterface { + Future call({required double value}); +} + +// Rust type: RustOpaqueMoi> +abstract class AsUiSelectCallback implements RustOpaqueInterface { + Future call({required String value}); +} + +// Rust type: RustOpaqueMoi> +abstract class AsUiSwitchCallback implements RustOpaqueInterface { + Future call({required bool value}); +} + +// Rust type: RustOpaqueMoi> +abstract class AsUiTextInputCallback implements RustOpaqueInterface { + Future call({required String value}); +} + +// Rust type: RustOpaqueMoi> +abstract class AsUiTextareaCallback implements RustOpaqueInterface { + Future call({required String value}); +} + +class AsUiButton { + final String? text; + final AsUiButtonCallback? onClick; + final bool? primary; + final bool? rounded; + final bool? disabled; + + const AsUiButton({ + this.text, + this.onClick, + this.primary, + this.rounded, + this.disabled, + }); + + @override + int get hashCode => + text.hashCode ^ + onClick.hashCode ^ + primary.hashCode ^ + rounded.hashCode ^ + disabled.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is AsUiButton && + runtimeType == other.runtimeType && + text == other.text && + onClick == other.onClick && + primary == other.primary && + rounded == other.rounded && + disabled == other.disabled; +} + +class AsUiButtons { + final List? buttons; + + const AsUiButtons({ + this.buttons, + }); + + @override + int get hashCode => buttons.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is AsUiButtons && + runtimeType == other.runtimeType && + buttons == other.buttons; +} + +@freezed +sealed class AsUiComponent with _$AsUiComponent { + const AsUiComponent._(); + + const factory AsUiComponent.root( + AsUiRoot field0, + ) = AsUiComponent_Root; + const factory AsUiComponent.container( + AsUiContainer field0, + ) = AsUiComponent_Container; + const factory AsUiComponent.text( + AsUiText field0, + ) = AsUiComponent_Text; + const factory AsUiComponent.mfm( + AsUiMfm field0, + ) = AsUiComponent_Mfm; + const factory AsUiComponent.button( + AsUiButton field0, + ) = AsUiComponent_Button; + const factory AsUiComponent.buttons( + AsUiButtons field0, + ) = AsUiComponent_Buttons; + const factory AsUiComponent.toggleSwitch( + AsUiSwitch field0, + ) = AsUiComponent_ToggleSwitch; + const factory AsUiComponent.textarea( + AsUiTextarea field0, + ) = AsUiComponent_Textarea; + const factory AsUiComponent.textInput( + AsUiTextInput field0, + ) = AsUiComponent_TextInput; + const factory AsUiComponent.numberInput( + AsUiNumberInput field0, + ) = AsUiComponent_NumberInput; + const factory AsUiComponent.select( + AsUiSelect field0, + ) = AsUiComponent_Select; + const factory AsUiComponent.folder( + AsUiFolder field0, + ) = AsUiComponent_Folder; + const factory AsUiComponent.postFormButton( + AsUiPostFormButton field0, + ) = AsUiComponent_PostFormButton; + const factory AsUiComponent.postForm( + AsUiPostForm field0, + ) = AsUiComponent_PostForm; +} + +class AsUiContainer { + final List? children; + final String? align; + final String? bgColor; + final String? fgColor; + final String? font; + final double? borderWidth; + final String? borderColor; + final double? padding; + final bool? rounded; + final bool? hidden; + + const AsUiContainer({ + this.children, + this.align, + this.bgColor, + this.fgColor, + this.font, + this.borderWidth, + this.borderColor, + this.padding, + this.rounded, + this.hidden, + }); + + @override + int get hashCode => + children.hashCode ^ + align.hashCode ^ + bgColor.hashCode ^ + fgColor.hashCode ^ + font.hashCode ^ + borderWidth.hashCode ^ + borderColor.hashCode ^ + padding.hashCode ^ + rounded.hashCode ^ + hidden.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is AsUiContainer && + runtimeType == other.runtimeType && + children == other.children && + align == other.align && + bgColor == other.bgColor && + fgColor == other.fgColor && + font == other.font && + borderWidth == other.borderWidth && + borderColor == other.borderColor && + padding == other.padding && + rounded == other.rounded && + hidden == other.hidden; +} + +class AsUiFolder { + final List? children; + final String? title; + final bool? opened; + + const AsUiFolder({ + this.children, + this.title, + this.opened, + }); + + @override + int get hashCode => children.hashCode ^ title.hashCode ^ opened.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is AsUiFolder && + runtimeType == other.runtimeType && + children == other.children && + title == other.title && + opened == other.opened; +} + +class AsUiMfm { + final String? text; + final double? size; + final bool? bold; + final String? color; + final String? font; + final AsUiMfmCallback? onClickEv; + + const AsUiMfm({ + this.text, + this.size, + this.bold, + this.color, + this.font, + this.onClickEv, + }); + + @override + int get hashCode => + text.hashCode ^ + size.hashCode ^ + bold.hashCode ^ + color.hashCode ^ + font.hashCode ^ + onClickEv.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is AsUiMfm && + runtimeType == other.runtimeType && + text == other.text && + size == other.size && + bold == other.bold && + color == other.color && + font == other.font && + onClickEv == other.onClickEv; +} + +class AsUiNumberInput { + final AsUiNumberCallback? onInput; + final double? defaultValue; + final String? label; + final String? caption; + + const AsUiNumberInput({ + this.onInput, + this.defaultValue, + this.label, + this.caption, + }); + + @override + int get hashCode => + onInput.hashCode ^ + defaultValue.hashCode ^ + label.hashCode ^ + caption.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is AsUiNumberInput && + runtimeType == other.runtimeType && + onInput == other.onInput && + defaultValue == other.defaultValue && + label == other.label && + caption == other.caption; +} + +class AsUiPostForm { + final PostFormPropsForAsUi? form; + + const AsUiPostForm({ + this.form, + }); + + @override + int get hashCode => form.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is AsUiPostForm && + runtimeType == other.runtimeType && + form == other.form; +} + +class AsUiPostFormButton { + final String? text; + final bool? primary; + final bool? rounded; + final PostFormPropsForAsUi? form; + + const AsUiPostFormButton({ + this.text, + this.primary, + this.rounded, + this.form, + }); + + @override + int get hashCode => + text.hashCode ^ primary.hashCode ^ rounded.hashCode ^ form.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is AsUiPostFormButton && + runtimeType == other.runtimeType && + text == other.text && + primary == other.primary && + rounded == other.rounded && + form == other.form; +} + +class AsUiRoot { + final List children; + + const AsUiRoot({ + required this.children, + }); + + @override + int get hashCode => children.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is AsUiRoot && + runtimeType == other.runtimeType && + children == other.children; +} + +class AsUiSelect { + final List<(String, String)>? items; + final AsUiSelectCallback? onChange; + final String? defaultValue; + final String? label; + final String? caption; + + const AsUiSelect({ + this.items, + this.onChange, + this.defaultValue, + this.label, + this.caption, + }); + + @override + int get hashCode => + items.hashCode ^ + onChange.hashCode ^ + defaultValue.hashCode ^ + label.hashCode ^ + caption.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is AsUiSelect && + runtimeType == other.runtimeType && + items == other.items && + onChange == other.onChange && + defaultValue == other.defaultValue && + label == other.label && + caption == other.caption; +} + +class AsUiSwitch { + final AsUiSwitchCallback? onChange; + final bool? defaultValue; + final String? label; + final String? caption; + + const AsUiSwitch({ + this.onChange, + this.defaultValue, + this.label, + this.caption, + }); + + @override + int get hashCode => + onChange.hashCode ^ + defaultValue.hashCode ^ + label.hashCode ^ + caption.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is AsUiSwitch && + runtimeType == other.runtimeType && + onChange == other.onChange && + defaultValue == other.defaultValue && + label == other.label && + caption == other.caption; +} + +class AsUiText { + final String? text; + final double? size; + final bool? bold; + final String? color; + final String? font; + + const AsUiText({ + this.text, + this.size, + this.bold, + this.color, + this.font, + }); + + @override + int get hashCode => + text.hashCode ^ + size.hashCode ^ + bold.hashCode ^ + color.hashCode ^ + font.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is AsUiText && + runtimeType == other.runtimeType && + text == other.text && + size == other.size && + bold == other.bold && + color == other.color && + font == other.font; +} + +class AsUiTextInput { + final AsUiTextInputCallback? onInput; + final String? defaultValue; + final String? label; + final String? caption; + + const AsUiTextInput({ + this.onInput, + this.defaultValue, + this.label, + this.caption, + }); + + @override + int get hashCode => + onInput.hashCode ^ + defaultValue.hashCode ^ + label.hashCode ^ + caption.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is AsUiTextInput && + runtimeType == other.runtimeType && + onInput == other.onInput && + defaultValue == other.defaultValue && + label == other.label && + caption == other.caption; +} + +class AsUiTextarea { + final AsUiTextareaCallback? onInput; + final String? defaultValue; + final String? label; + final String? caption; + + const AsUiTextarea({ + this.onInput, + this.defaultValue, + this.label, + this.caption, + }); + + @override + int get hashCode => + onInput.hashCode ^ + defaultValue.hashCode ^ + label.hashCode ^ + caption.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is AsUiTextarea && + runtimeType == other.runtimeType && + onInput == other.onInput && + defaultValue == other.defaultValue && + label == other.label && + caption == other.caption; +} + +class PostFormPropsForAsUi { + final String text; + final String? cw; + final String? visibility; + final bool? localOnly; + + const PostFormPropsForAsUi({ + required this.text, + this.cw, + this.visibility, + this.localOnly, + }); + + @override + int get hashCode => + text.hashCode ^ cw.hashCode ^ visibility.hashCode ^ localOnly.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is PostFormPropsForAsUi && + runtimeType == other.runtimeType && + text == other.text && + cw == other.cw && + visibility == other.visibility && + localOnly == other.localOnly; +} diff --git a/lib/rust/api/aiscript/ui.freezed.dart b/lib/rust/api/aiscript/ui.freezed.dart new file mode 100644 index 00000000..9601eb68 --- /dev/null +++ b/lib/rust/api/aiscript/ui.freezed.dart @@ -0,0 +1,3110 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'ui.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +final _privateConstructorUsedError = UnsupportedError( + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); + +/// @nodoc +mixin _$AsUiComponent { + Object get field0 => throw _privateConstructorUsedError; + @optionalTypeArgs + TResult when({ + required TResult Function(AsUiRoot field0) root, + required TResult Function(AsUiContainer field0) container, + required TResult Function(AsUiText field0) text, + required TResult Function(AsUiMfm field0) mfm, + required TResult Function(AsUiButton field0) button, + required TResult Function(AsUiButtons field0) buttons, + required TResult Function(AsUiSwitch field0) toggleSwitch, + required TResult Function(AsUiTextarea field0) textarea, + required TResult Function(AsUiTextInput field0) textInput, + required TResult Function(AsUiNumberInput field0) numberInput, + required TResult Function(AsUiSelect field0) select, + required TResult Function(AsUiFolder field0) folder, + required TResult Function(AsUiPostFormButton field0) postFormButton, + required TResult Function(AsUiPostForm field0) postForm, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(AsUiRoot field0)? root, + TResult? Function(AsUiContainer field0)? container, + TResult? Function(AsUiText field0)? text, + TResult? Function(AsUiMfm field0)? mfm, + TResult? Function(AsUiButton field0)? button, + TResult? Function(AsUiButtons field0)? buttons, + TResult? Function(AsUiSwitch field0)? toggleSwitch, + TResult? Function(AsUiTextarea field0)? textarea, + TResult? Function(AsUiTextInput field0)? textInput, + TResult? Function(AsUiNumberInput field0)? numberInput, + TResult? Function(AsUiSelect field0)? select, + TResult? Function(AsUiFolder field0)? folder, + TResult? Function(AsUiPostFormButton field0)? postFormButton, + TResult? Function(AsUiPostForm field0)? postForm, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(AsUiRoot field0)? root, + TResult Function(AsUiContainer field0)? container, + TResult Function(AsUiText field0)? text, + TResult Function(AsUiMfm field0)? mfm, + TResult Function(AsUiButton field0)? button, + TResult Function(AsUiButtons field0)? buttons, + TResult Function(AsUiSwitch field0)? toggleSwitch, + TResult Function(AsUiTextarea field0)? textarea, + TResult Function(AsUiTextInput field0)? textInput, + TResult Function(AsUiNumberInput field0)? numberInput, + TResult Function(AsUiSelect field0)? select, + TResult Function(AsUiFolder field0)? folder, + TResult Function(AsUiPostFormButton field0)? postFormButton, + TResult Function(AsUiPostForm field0)? postForm, + required TResult orElse(), + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult map({ + required TResult Function(AsUiComponent_Root value) root, + required TResult Function(AsUiComponent_Container value) container, + required TResult Function(AsUiComponent_Text value) text, + required TResult Function(AsUiComponent_Mfm value) mfm, + required TResult Function(AsUiComponent_Button value) button, + required TResult Function(AsUiComponent_Buttons value) buttons, + required TResult Function(AsUiComponent_ToggleSwitch value) toggleSwitch, + required TResult Function(AsUiComponent_Textarea value) textarea, + required TResult Function(AsUiComponent_TextInput value) textInput, + required TResult Function(AsUiComponent_NumberInput value) numberInput, + required TResult Function(AsUiComponent_Select value) select, + required TResult Function(AsUiComponent_Folder value) folder, + required TResult Function(AsUiComponent_PostFormButton value) + postFormButton, + required TResult Function(AsUiComponent_PostForm value) postForm, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(AsUiComponent_Root value)? root, + TResult? Function(AsUiComponent_Container value)? container, + TResult? Function(AsUiComponent_Text value)? text, + TResult? Function(AsUiComponent_Mfm value)? mfm, + TResult? Function(AsUiComponent_Button value)? button, + TResult? Function(AsUiComponent_Buttons value)? buttons, + TResult? Function(AsUiComponent_ToggleSwitch value)? toggleSwitch, + TResult? Function(AsUiComponent_Textarea value)? textarea, + TResult? Function(AsUiComponent_TextInput value)? textInput, + TResult? Function(AsUiComponent_NumberInput value)? numberInput, + TResult? Function(AsUiComponent_Select value)? select, + TResult? Function(AsUiComponent_Folder value)? folder, + TResult? Function(AsUiComponent_PostFormButton value)? postFormButton, + TResult? Function(AsUiComponent_PostForm value)? postForm, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult maybeMap({ + TResult Function(AsUiComponent_Root value)? root, + TResult Function(AsUiComponent_Container value)? container, + TResult Function(AsUiComponent_Text value)? text, + TResult Function(AsUiComponent_Mfm value)? mfm, + TResult Function(AsUiComponent_Button value)? button, + TResult Function(AsUiComponent_Buttons value)? buttons, + TResult Function(AsUiComponent_ToggleSwitch value)? toggleSwitch, + TResult Function(AsUiComponent_Textarea value)? textarea, + TResult Function(AsUiComponent_TextInput value)? textInput, + TResult Function(AsUiComponent_NumberInput value)? numberInput, + TResult Function(AsUiComponent_Select value)? select, + TResult Function(AsUiComponent_Folder value)? folder, + TResult Function(AsUiComponent_PostFormButton value)? postFormButton, + TResult Function(AsUiComponent_PostForm value)? postForm, + required TResult orElse(), + }) => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $AsUiComponentCopyWith<$Res> { + factory $AsUiComponentCopyWith( + AsUiComponent value, $Res Function(AsUiComponent) then) = + _$AsUiComponentCopyWithImpl<$Res, AsUiComponent>; +} + +/// @nodoc +class _$AsUiComponentCopyWithImpl<$Res, $Val extends AsUiComponent> + implements $AsUiComponentCopyWith<$Res> { + _$AsUiComponentCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; +} + +/// @nodoc +abstract class _$$AsUiComponent_RootImplCopyWith<$Res> { + factory _$$AsUiComponent_RootImplCopyWith(_$AsUiComponent_RootImpl value, + $Res Function(_$AsUiComponent_RootImpl) then) = + __$$AsUiComponent_RootImplCopyWithImpl<$Res>; + @useResult + $Res call({AsUiRoot field0}); +} + +/// @nodoc +class __$$AsUiComponent_RootImplCopyWithImpl<$Res> + extends _$AsUiComponentCopyWithImpl<$Res, _$AsUiComponent_RootImpl> + implements _$$AsUiComponent_RootImplCopyWith<$Res> { + __$$AsUiComponent_RootImplCopyWithImpl(_$AsUiComponent_RootImpl _value, + $Res Function(_$AsUiComponent_RootImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? field0 = null, + }) { + return _then(_$AsUiComponent_RootImpl( + null == field0 + ? _value.field0 + : field0 // ignore: cast_nullable_to_non_nullable + as AsUiRoot, + )); + } +} + +/// @nodoc + +class _$AsUiComponent_RootImpl extends AsUiComponent_Root { + const _$AsUiComponent_RootImpl(this.field0) : super._(); + + @override + final AsUiRoot field0; + + @override + String toString() { + return 'AsUiComponent.root(field0: $field0)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$AsUiComponent_RootImpl && + (identical(other.field0, field0) || other.field0 == field0)); + } + + @override + int get hashCode => Object.hash(runtimeType, field0); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$AsUiComponent_RootImplCopyWith<_$AsUiComponent_RootImpl> get copyWith => + __$$AsUiComponent_RootImplCopyWithImpl<_$AsUiComponent_RootImpl>( + this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(AsUiRoot field0) root, + required TResult Function(AsUiContainer field0) container, + required TResult Function(AsUiText field0) text, + required TResult Function(AsUiMfm field0) mfm, + required TResult Function(AsUiButton field0) button, + required TResult Function(AsUiButtons field0) buttons, + required TResult Function(AsUiSwitch field0) toggleSwitch, + required TResult Function(AsUiTextarea field0) textarea, + required TResult Function(AsUiTextInput field0) textInput, + required TResult Function(AsUiNumberInput field0) numberInput, + required TResult Function(AsUiSelect field0) select, + required TResult Function(AsUiFolder field0) folder, + required TResult Function(AsUiPostFormButton field0) postFormButton, + required TResult Function(AsUiPostForm field0) postForm, + }) { + return root(field0); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(AsUiRoot field0)? root, + TResult? Function(AsUiContainer field0)? container, + TResult? Function(AsUiText field0)? text, + TResult? Function(AsUiMfm field0)? mfm, + TResult? Function(AsUiButton field0)? button, + TResult? Function(AsUiButtons field0)? buttons, + TResult? Function(AsUiSwitch field0)? toggleSwitch, + TResult? Function(AsUiTextarea field0)? textarea, + TResult? Function(AsUiTextInput field0)? textInput, + TResult? Function(AsUiNumberInput field0)? numberInput, + TResult? Function(AsUiSelect field0)? select, + TResult? Function(AsUiFolder field0)? folder, + TResult? Function(AsUiPostFormButton field0)? postFormButton, + TResult? Function(AsUiPostForm field0)? postForm, + }) { + return root?.call(field0); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(AsUiRoot field0)? root, + TResult Function(AsUiContainer field0)? container, + TResult Function(AsUiText field0)? text, + TResult Function(AsUiMfm field0)? mfm, + TResult Function(AsUiButton field0)? button, + TResult Function(AsUiButtons field0)? buttons, + TResult Function(AsUiSwitch field0)? toggleSwitch, + TResult Function(AsUiTextarea field0)? textarea, + TResult Function(AsUiTextInput field0)? textInput, + TResult Function(AsUiNumberInput field0)? numberInput, + TResult Function(AsUiSelect field0)? select, + TResult Function(AsUiFolder field0)? folder, + TResult Function(AsUiPostFormButton field0)? postFormButton, + TResult Function(AsUiPostForm field0)? postForm, + required TResult orElse(), + }) { + if (root != null) { + return root(field0); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(AsUiComponent_Root value) root, + required TResult Function(AsUiComponent_Container value) container, + required TResult Function(AsUiComponent_Text value) text, + required TResult Function(AsUiComponent_Mfm value) mfm, + required TResult Function(AsUiComponent_Button value) button, + required TResult Function(AsUiComponent_Buttons value) buttons, + required TResult Function(AsUiComponent_ToggleSwitch value) toggleSwitch, + required TResult Function(AsUiComponent_Textarea value) textarea, + required TResult Function(AsUiComponent_TextInput value) textInput, + required TResult Function(AsUiComponent_NumberInput value) numberInput, + required TResult Function(AsUiComponent_Select value) select, + required TResult Function(AsUiComponent_Folder value) folder, + required TResult Function(AsUiComponent_PostFormButton value) + postFormButton, + required TResult Function(AsUiComponent_PostForm value) postForm, + }) { + return root(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(AsUiComponent_Root value)? root, + TResult? Function(AsUiComponent_Container value)? container, + TResult? Function(AsUiComponent_Text value)? text, + TResult? Function(AsUiComponent_Mfm value)? mfm, + TResult? Function(AsUiComponent_Button value)? button, + TResult? Function(AsUiComponent_Buttons value)? buttons, + TResult? Function(AsUiComponent_ToggleSwitch value)? toggleSwitch, + TResult? Function(AsUiComponent_Textarea value)? textarea, + TResult? Function(AsUiComponent_TextInput value)? textInput, + TResult? Function(AsUiComponent_NumberInput value)? numberInput, + TResult? Function(AsUiComponent_Select value)? select, + TResult? Function(AsUiComponent_Folder value)? folder, + TResult? Function(AsUiComponent_PostFormButton value)? postFormButton, + TResult? Function(AsUiComponent_PostForm value)? postForm, + }) { + return root?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(AsUiComponent_Root value)? root, + TResult Function(AsUiComponent_Container value)? container, + TResult Function(AsUiComponent_Text value)? text, + TResult Function(AsUiComponent_Mfm value)? mfm, + TResult Function(AsUiComponent_Button value)? button, + TResult Function(AsUiComponent_Buttons value)? buttons, + TResult Function(AsUiComponent_ToggleSwitch value)? toggleSwitch, + TResult Function(AsUiComponent_Textarea value)? textarea, + TResult Function(AsUiComponent_TextInput value)? textInput, + TResult Function(AsUiComponent_NumberInput value)? numberInput, + TResult Function(AsUiComponent_Select value)? select, + TResult Function(AsUiComponent_Folder value)? folder, + TResult Function(AsUiComponent_PostFormButton value)? postFormButton, + TResult Function(AsUiComponent_PostForm value)? postForm, + required TResult orElse(), + }) { + if (root != null) { + return root(this); + } + return orElse(); + } +} + +abstract class AsUiComponent_Root extends AsUiComponent { + const factory AsUiComponent_Root(final AsUiRoot field0) = + _$AsUiComponent_RootImpl; + const AsUiComponent_Root._() : super._(); + + @override + AsUiRoot get field0; + @JsonKey(ignore: true) + _$$AsUiComponent_RootImplCopyWith<_$AsUiComponent_RootImpl> get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$AsUiComponent_ContainerImplCopyWith<$Res> { + factory _$$AsUiComponent_ContainerImplCopyWith( + _$AsUiComponent_ContainerImpl value, + $Res Function(_$AsUiComponent_ContainerImpl) then) = + __$$AsUiComponent_ContainerImplCopyWithImpl<$Res>; + @useResult + $Res call({AsUiContainer field0}); +} + +/// @nodoc +class __$$AsUiComponent_ContainerImplCopyWithImpl<$Res> + extends _$AsUiComponentCopyWithImpl<$Res, _$AsUiComponent_ContainerImpl> + implements _$$AsUiComponent_ContainerImplCopyWith<$Res> { + __$$AsUiComponent_ContainerImplCopyWithImpl( + _$AsUiComponent_ContainerImpl _value, + $Res Function(_$AsUiComponent_ContainerImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? field0 = null, + }) { + return _then(_$AsUiComponent_ContainerImpl( + null == field0 + ? _value.field0 + : field0 // ignore: cast_nullable_to_non_nullable + as AsUiContainer, + )); + } +} + +/// @nodoc + +class _$AsUiComponent_ContainerImpl extends AsUiComponent_Container { + const _$AsUiComponent_ContainerImpl(this.field0) : super._(); + + @override + final AsUiContainer field0; + + @override + String toString() { + return 'AsUiComponent.container(field0: $field0)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$AsUiComponent_ContainerImpl && + (identical(other.field0, field0) || other.field0 == field0)); + } + + @override + int get hashCode => Object.hash(runtimeType, field0); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$AsUiComponent_ContainerImplCopyWith<_$AsUiComponent_ContainerImpl> + get copyWith => __$$AsUiComponent_ContainerImplCopyWithImpl< + _$AsUiComponent_ContainerImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(AsUiRoot field0) root, + required TResult Function(AsUiContainer field0) container, + required TResult Function(AsUiText field0) text, + required TResult Function(AsUiMfm field0) mfm, + required TResult Function(AsUiButton field0) button, + required TResult Function(AsUiButtons field0) buttons, + required TResult Function(AsUiSwitch field0) toggleSwitch, + required TResult Function(AsUiTextarea field0) textarea, + required TResult Function(AsUiTextInput field0) textInput, + required TResult Function(AsUiNumberInput field0) numberInput, + required TResult Function(AsUiSelect field0) select, + required TResult Function(AsUiFolder field0) folder, + required TResult Function(AsUiPostFormButton field0) postFormButton, + required TResult Function(AsUiPostForm field0) postForm, + }) { + return container(field0); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(AsUiRoot field0)? root, + TResult? Function(AsUiContainer field0)? container, + TResult? Function(AsUiText field0)? text, + TResult? Function(AsUiMfm field0)? mfm, + TResult? Function(AsUiButton field0)? button, + TResult? Function(AsUiButtons field0)? buttons, + TResult? Function(AsUiSwitch field0)? toggleSwitch, + TResult? Function(AsUiTextarea field0)? textarea, + TResult? Function(AsUiTextInput field0)? textInput, + TResult? Function(AsUiNumberInput field0)? numberInput, + TResult? Function(AsUiSelect field0)? select, + TResult? Function(AsUiFolder field0)? folder, + TResult? Function(AsUiPostFormButton field0)? postFormButton, + TResult? Function(AsUiPostForm field0)? postForm, + }) { + return container?.call(field0); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(AsUiRoot field0)? root, + TResult Function(AsUiContainer field0)? container, + TResult Function(AsUiText field0)? text, + TResult Function(AsUiMfm field0)? mfm, + TResult Function(AsUiButton field0)? button, + TResult Function(AsUiButtons field0)? buttons, + TResult Function(AsUiSwitch field0)? toggleSwitch, + TResult Function(AsUiTextarea field0)? textarea, + TResult Function(AsUiTextInput field0)? textInput, + TResult Function(AsUiNumberInput field0)? numberInput, + TResult Function(AsUiSelect field0)? select, + TResult Function(AsUiFolder field0)? folder, + TResult Function(AsUiPostFormButton field0)? postFormButton, + TResult Function(AsUiPostForm field0)? postForm, + required TResult orElse(), + }) { + if (container != null) { + return container(field0); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(AsUiComponent_Root value) root, + required TResult Function(AsUiComponent_Container value) container, + required TResult Function(AsUiComponent_Text value) text, + required TResult Function(AsUiComponent_Mfm value) mfm, + required TResult Function(AsUiComponent_Button value) button, + required TResult Function(AsUiComponent_Buttons value) buttons, + required TResult Function(AsUiComponent_ToggleSwitch value) toggleSwitch, + required TResult Function(AsUiComponent_Textarea value) textarea, + required TResult Function(AsUiComponent_TextInput value) textInput, + required TResult Function(AsUiComponent_NumberInput value) numberInput, + required TResult Function(AsUiComponent_Select value) select, + required TResult Function(AsUiComponent_Folder value) folder, + required TResult Function(AsUiComponent_PostFormButton value) + postFormButton, + required TResult Function(AsUiComponent_PostForm value) postForm, + }) { + return container(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(AsUiComponent_Root value)? root, + TResult? Function(AsUiComponent_Container value)? container, + TResult? Function(AsUiComponent_Text value)? text, + TResult? Function(AsUiComponent_Mfm value)? mfm, + TResult? Function(AsUiComponent_Button value)? button, + TResult? Function(AsUiComponent_Buttons value)? buttons, + TResult? Function(AsUiComponent_ToggleSwitch value)? toggleSwitch, + TResult? Function(AsUiComponent_Textarea value)? textarea, + TResult? Function(AsUiComponent_TextInput value)? textInput, + TResult? Function(AsUiComponent_NumberInput value)? numberInput, + TResult? Function(AsUiComponent_Select value)? select, + TResult? Function(AsUiComponent_Folder value)? folder, + TResult? Function(AsUiComponent_PostFormButton value)? postFormButton, + TResult? Function(AsUiComponent_PostForm value)? postForm, + }) { + return container?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(AsUiComponent_Root value)? root, + TResult Function(AsUiComponent_Container value)? container, + TResult Function(AsUiComponent_Text value)? text, + TResult Function(AsUiComponent_Mfm value)? mfm, + TResult Function(AsUiComponent_Button value)? button, + TResult Function(AsUiComponent_Buttons value)? buttons, + TResult Function(AsUiComponent_ToggleSwitch value)? toggleSwitch, + TResult Function(AsUiComponent_Textarea value)? textarea, + TResult Function(AsUiComponent_TextInput value)? textInput, + TResult Function(AsUiComponent_NumberInput value)? numberInput, + TResult Function(AsUiComponent_Select value)? select, + TResult Function(AsUiComponent_Folder value)? folder, + TResult Function(AsUiComponent_PostFormButton value)? postFormButton, + TResult Function(AsUiComponent_PostForm value)? postForm, + required TResult orElse(), + }) { + if (container != null) { + return container(this); + } + return orElse(); + } +} + +abstract class AsUiComponent_Container extends AsUiComponent { + const factory AsUiComponent_Container(final AsUiContainer field0) = + _$AsUiComponent_ContainerImpl; + const AsUiComponent_Container._() : super._(); + + @override + AsUiContainer get field0; + @JsonKey(ignore: true) + _$$AsUiComponent_ContainerImplCopyWith<_$AsUiComponent_ContainerImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$AsUiComponent_TextImplCopyWith<$Res> { + factory _$$AsUiComponent_TextImplCopyWith(_$AsUiComponent_TextImpl value, + $Res Function(_$AsUiComponent_TextImpl) then) = + __$$AsUiComponent_TextImplCopyWithImpl<$Res>; + @useResult + $Res call({AsUiText field0}); +} + +/// @nodoc +class __$$AsUiComponent_TextImplCopyWithImpl<$Res> + extends _$AsUiComponentCopyWithImpl<$Res, _$AsUiComponent_TextImpl> + implements _$$AsUiComponent_TextImplCopyWith<$Res> { + __$$AsUiComponent_TextImplCopyWithImpl(_$AsUiComponent_TextImpl _value, + $Res Function(_$AsUiComponent_TextImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? field0 = null, + }) { + return _then(_$AsUiComponent_TextImpl( + null == field0 + ? _value.field0 + : field0 // ignore: cast_nullable_to_non_nullable + as AsUiText, + )); + } +} + +/// @nodoc + +class _$AsUiComponent_TextImpl extends AsUiComponent_Text { + const _$AsUiComponent_TextImpl(this.field0) : super._(); + + @override + final AsUiText field0; + + @override + String toString() { + return 'AsUiComponent.text(field0: $field0)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$AsUiComponent_TextImpl && + (identical(other.field0, field0) || other.field0 == field0)); + } + + @override + int get hashCode => Object.hash(runtimeType, field0); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$AsUiComponent_TextImplCopyWith<_$AsUiComponent_TextImpl> get copyWith => + __$$AsUiComponent_TextImplCopyWithImpl<_$AsUiComponent_TextImpl>( + this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(AsUiRoot field0) root, + required TResult Function(AsUiContainer field0) container, + required TResult Function(AsUiText field0) text, + required TResult Function(AsUiMfm field0) mfm, + required TResult Function(AsUiButton field0) button, + required TResult Function(AsUiButtons field0) buttons, + required TResult Function(AsUiSwitch field0) toggleSwitch, + required TResult Function(AsUiTextarea field0) textarea, + required TResult Function(AsUiTextInput field0) textInput, + required TResult Function(AsUiNumberInput field0) numberInput, + required TResult Function(AsUiSelect field0) select, + required TResult Function(AsUiFolder field0) folder, + required TResult Function(AsUiPostFormButton field0) postFormButton, + required TResult Function(AsUiPostForm field0) postForm, + }) { + return text(field0); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(AsUiRoot field0)? root, + TResult? Function(AsUiContainer field0)? container, + TResult? Function(AsUiText field0)? text, + TResult? Function(AsUiMfm field0)? mfm, + TResult? Function(AsUiButton field0)? button, + TResult? Function(AsUiButtons field0)? buttons, + TResult? Function(AsUiSwitch field0)? toggleSwitch, + TResult? Function(AsUiTextarea field0)? textarea, + TResult? Function(AsUiTextInput field0)? textInput, + TResult? Function(AsUiNumberInput field0)? numberInput, + TResult? Function(AsUiSelect field0)? select, + TResult? Function(AsUiFolder field0)? folder, + TResult? Function(AsUiPostFormButton field0)? postFormButton, + TResult? Function(AsUiPostForm field0)? postForm, + }) { + return text?.call(field0); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(AsUiRoot field0)? root, + TResult Function(AsUiContainer field0)? container, + TResult Function(AsUiText field0)? text, + TResult Function(AsUiMfm field0)? mfm, + TResult Function(AsUiButton field0)? button, + TResult Function(AsUiButtons field0)? buttons, + TResult Function(AsUiSwitch field0)? toggleSwitch, + TResult Function(AsUiTextarea field0)? textarea, + TResult Function(AsUiTextInput field0)? textInput, + TResult Function(AsUiNumberInput field0)? numberInput, + TResult Function(AsUiSelect field0)? select, + TResult Function(AsUiFolder field0)? folder, + TResult Function(AsUiPostFormButton field0)? postFormButton, + TResult Function(AsUiPostForm field0)? postForm, + required TResult orElse(), + }) { + if (text != null) { + return text(field0); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(AsUiComponent_Root value) root, + required TResult Function(AsUiComponent_Container value) container, + required TResult Function(AsUiComponent_Text value) text, + required TResult Function(AsUiComponent_Mfm value) mfm, + required TResult Function(AsUiComponent_Button value) button, + required TResult Function(AsUiComponent_Buttons value) buttons, + required TResult Function(AsUiComponent_ToggleSwitch value) toggleSwitch, + required TResult Function(AsUiComponent_Textarea value) textarea, + required TResult Function(AsUiComponent_TextInput value) textInput, + required TResult Function(AsUiComponent_NumberInput value) numberInput, + required TResult Function(AsUiComponent_Select value) select, + required TResult Function(AsUiComponent_Folder value) folder, + required TResult Function(AsUiComponent_PostFormButton value) + postFormButton, + required TResult Function(AsUiComponent_PostForm value) postForm, + }) { + return text(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(AsUiComponent_Root value)? root, + TResult? Function(AsUiComponent_Container value)? container, + TResult? Function(AsUiComponent_Text value)? text, + TResult? Function(AsUiComponent_Mfm value)? mfm, + TResult? Function(AsUiComponent_Button value)? button, + TResult? Function(AsUiComponent_Buttons value)? buttons, + TResult? Function(AsUiComponent_ToggleSwitch value)? toggleSwitch, + TResult? Function(AsUiComponent_Textarea value)? textarea, + TResult? Function(AsUiComponent_TextInput value)? textInput, + TResult? Function(AsUiComponent_NumberInput value)? numberInput, + TResult? Function(AsUiComponent_Select value)? select, + TResult? Function(AsUiComponent_Folder value)? folder, + TResult? Function(AsUiComponent_PostFormButton value)? postFormButton, + TResult? Function(AsUiComponent_PostForm value)? postForm, + }) { + return text?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(AsUiComponent_Root value)? root, + TResult Function(AsUiComponent_Container value)? container, + TResult Function(AsUiComponent_Text value)? text, + TResult Function(AsUiComponent_Mfm value)? mfm, + TResult Function(AsUiComponent_Button value)? button, + TResult Function(AsUiComponent_Buttons value)? buttons, + TResult Function(AsUiComponent_ToggleSwitch value)? toggleSwitch, + TResult Function(AsUiComponent_Textarea value)? textarea, + TResult Function(AsUiComponent_TextInput value)? textInput, + TResult Function(AsUiComponent_NumberInput value)? numberInput, + TResult Function(AsUiComponent_Select value)? select, + TResult Function(AsUiComponent_Folder value)? folder, + TResult Function(AsUiComponent_PostFormButton value)? postFormButton, + TResult Function(AsUiComponent_PostForm value)? postForm, + required TResult orElse(), + }) { + if (text != null) { + return text(this); + } + return orElse(); + } +} + +abstract class AsUiComponent_Text extends AsUiComponent { + const factory AsUiComponent_Text(final AsUiText field0) = + _$AsUiComponent_TextImpl; + const AsUiComponent_Text._() : super._(); + + @override + AsUiText get field0; + @JsonKey(ignore: true) + _$$AsUiComponent_TextImplCopyWith<_$AsUiComponent_TextImpl> get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$AsUiComponent_MfmImplCopyWith<$Res> { + factory _$$AsUiComponent_MfmImplCopyWith(_$AsUiComponent_MfmImpl value, + $Res Function(_$AsUiComponent_MfmImpl) then) = + __$$AsUiComponent_MfmImplCopyWithImpl<$Res>; + @useResult + $Res call({AsUiMfm field0}); +} + +/// @nodoc +class __$$AsUiComponent_MfmImplCopyWithImpl<$Res> + extends _$AsUiComponentCopyWithImpl<$Res, _$AsUiComponent_MfmImpl> + implements _$$AsUiComponent_MfmImplCopyWith<$Res> { + __$$AsUiComponent_MfmImplCopyWithImpl(_$AsUiComponent_MfmImpl _value, + $Res Function(_$AsUiComponent_MfmImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? field0 = null, + }) { + return _then(_$AsUiComponent_MfmImpl( + null == field0 + ? _value.field0 + : field0 // ignore: cast_nullable_to_non_nullable + as AsUiMfm, + )); + } +} + +/// @nodoc + +class _$AsUiComponent_MfmImpl extends AsUiComponent_Mfm { + const _$AsUiComponent_MfmImpl(this.field0) : super._(); + + @override + final AsUiMfm field0; + + @override + String toString() { + return 'AsUiComponent.mfm(field0: $field0)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$AsUiComponent_MfmImpl && + (identical(other.field0, field0) || other.field0 == field0)); + } + + @override + int get hashCode => Object.hash(runtimeType, field0); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$AsUiComponent_MfmImplCopyWith<_$AsUiComponent_MfmImpl> get copyWith => + __$$AsUiComponent_MfmImplCopyWithImpl<_$AsUiComponent_MfmImpl>( + this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(AsUiRoot field0) root, + required TResult Function(AsUiContainer field0) container, + required TResult Function(AsUiText field0) text, + required TResult Function(AsUiMfm field0) mfm, + required TResult Function(AsUiButton field0) button, + required TResult Function(AsUiButtons field0) buttons, + required TResult Function(AsUiSwitch field0) toggleSwitch, + required TResult Function(AsUiTextarea field0) textarea, + required TResult Function(AsUiTextInput field0) textInput, + required TResult Function(AsUiNumberInput field0) numberInput, + required TResult Function(AsUiSelect field0) select, + required TResult Function(AsUiFolder field0) folder, + required TResult Function(AsUiPostFormButton field0) postFormButton, + required TResult Function(AsUiPostForm field0) postForm, + }) { + return mfm(field0); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(AsUiRoot field0)? root, + TResult? Function(AsUiContainer field0)? container, + TResult? Function(AsUiText field0)? text, + TResult? Function(AsUiMfm field0)? mfm, + TResult? Function(AsUiButton field0)? button, + TResult? Function(AsUiButtons field0)? buttons, + TResult? Function(AsUiSwitch field0)? toggleSwitch, + TResult? Function(AsUiTextarea field0)? textarea, + TResult? Function(AsUiTextInput field0)? textInput, + TResult? Function(AsUiNumberInput field0)? numberInput, + TResult? Function(AsUiSelect field0)? select, + TResult? Function(AsUiFolder field0)? folder, + TResult? Function(AsUiPostFormButton field0)? postFormButton, + TResult? Function(AsUiPostForm field0)? postForm, + }) { + return mfm?.call(field0); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(AsUiRoot field0)? root, + TResult Function(AsUiContainer field0)? container, + TResult Function(AsUiText field0)? text, + TResult Function(AsUiMfm field0)? mfm, + TResult Function(AsUiButton field0)? button, + TResult Function(AsUiButtons field0)? buttons, + TResult Function(AsUiSwitch field0)? toggleSwitch, + TResult Function(AsUiTextarea field0)? textarea, + TResult Function(AsUiTextInput field0)? textInput, + TResult Function(AsUiNumberInput field0)? numberInput, + TResult Function(AsUiSelect field0)? select, + TResult Function(AsUiFolder field0)? folder, + TResult Function(AsUiPostFormButton field0)? postFormButton, + TResult Function(AsUiPostForm field0)? postForm, + required TResult orElse(), + }) { + if (mfm != null) { + return mfm(field0); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(AsUiComponent_Root value) root, + required TResult Function(AsUiComponent_Container value) container, + required TResult Function(AsUiComponent_Text value) text, + required TResult Function(AsUiComponent_Mfm value) mfm, + required TResult Function(AsUiComponent_Button value) button, + required TResult Function(AsUiComponent_Buttons value) buttons, + required TResult Function(AsUiComponent_ToggleSwitch value) toggleSwitch, + required TResult Function(AsUiComponent_Textarea value) textarea, + required TResult Function(AsUiComponent_TextInput value) textInput, + required TResult Function(AsUiComponent_NumberInput value) numberInput, + required TResult Function(AsUiComponent_Select value) select, + required TResult Function(AsUiComponent_Folder value) folder, + required TResult Function(AsUiComponent_PostFormButton value) + postFormButton, + required TResult Function(AsUiComponent_PostForm value) postForm, + }) { + return mfm(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(AsUiComponent_Root value)? root, + TResult? Function(AsUiComponent_Container value)? container, + TResult? Function(AsUiComponent_Text value)? text, + TResult? Function(AsUiComponent_Mfm value)? mfm, + TResult? Function(AsUiComponent_Button value)? button, + TResult? Function(AsUiComponent_Buttons value)? buttons, + TResult? Function(AsUiComponent_ToggleSwitch value)? toggleSwitch, + TResult? Function(AsUiComponent_Textarea value)? textarea, + TResult? Function(AsUiComponent_TextInput value)? textInput, + TResult? Function(AsUiComponent_NumberInput value)? numberInput, + TResult? Function(AsUiComponent_Select value)? select, + TResult? Function(AsUiComponent_Folder value)? folder, + TResult? Function(AsUiComponent_PostFormButton value)? postFormButton, + TResult? Function(AsUiComponent_PostForm value)? postForm, + }) { + return mfm?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(AsUiComponent_Root value)? root, + TResult Function(AsUiComponent_Container value)? container, + TResult Function(AsUiComponent_Text value)? text, + TResult Function(AsUiComponent_Mfm value)? mfm, + TResult Function(AsUiComponent_Button value)? button, + TResult Function(AsUiComponent_Buttons value)? buttons, + TResult Function(AsUiComponent_ToggleSwitch value)? toggleSwitch, + TResult Function(AsUiComponent_Textarea value)? textarea, + TResult Function(AsUiComponent_TextInput value)? textInput, + TResult Function(AsUiComponent_NumberInput value)? numberInput, + TResult Function(AsUiComponent_Select value)? select, + TResult Function(AsUiComponent_Folder value)? folder, + TResult Function(AsUiComponent_PostFormButton value)? postFormButton, + TResult Function(AsUiComponent_PostForm value)? postForm, + required TResult orElse(), + }) { + if (mfm != null) { + return mfm(this); + } + return orElse(); + } +} + +abstract class AsUiComponent_Mfm extends AsUiComponent { + const factory AsUiComponent_Mfm(final AsUiMfm field0) = + _$AsUiComponent_MfmImpl; + const AsUiComponent_Mfm._() : super._(); + + @override + AsUiMfm get field0; + @JsonKey(ignore: true) + _$$AsUiComponent_MfmImplCopyWith<_$AsUiComponent_MfmImpl> get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$AsUiComponent_ButtonImplCopyWith<$Res> { + factory _$$AsUiComponent_ButtonImplCopyWith(_$AsUiComponent_ButtonImpl value, + $Res Function(_$AsUiComponent_ButtonImpl) then) = + __$$AsUiComponent_ButtonImplCopyWithImpl<$Res>; + @useResult + $Res call({AsUiButton field0}); +} + +/// @nodoc +class __$$AsUiComponent_ButtonImplCopyWithImpl<$Res> + extends _$AsUiComponentCopyWithImpl<$Res, _$AsUiComponent_ButtonImpl> + implements _$$AsUiComponent_ButtonImplCopyWith<$Res> { + __$$AsUiComponent_ButtonImplCopyWithImpl(_$AsUiComponent_ButtonImpl _value, + $Res Function(_$AsUiComponent_ButtonImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? field0 = null, + }) { + return _then(_$AsUiComponent_ButtonImpl( + null == field0 + ? _value.field0 + : field0 // ignore: cast_nullable_to_non_nullable + as AsUiButton, + )); + } +} + +/// @nodoc + +class _$AsUiComponent_ButtonImpl extends AsUiComponent_Button { + const _$AsUiComponent_ButtonImpl(this.field0) : super._(); + + @override + final AsUiButton field0; + + @override + String toString() { + return 'AsUiComponent.button(field0: $field0)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$AsUiComponent_ButtonImpl && + (identical(other.field0, field0) || other.field0 == field0)); + } + + @override + int get hashCode => Object.hash(runtimeType, field0); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$AsUiComponent_ButtonImplCopyWith<_$AsUiComponent_ButtonImpl> + get copyWith => + __$$AsUiComponent_ButtonImplCopyWithImpl<_$AsUiComponent_ButtonImpl>( + this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(AsUiRoot field0) root, + required TResult Function(AsUiContainer field0) container, + required TResult Function(AsUiText field0) text, + required TResult Function(AsUiMfm field0) mfm, + required TResult Function(AsUiButton field0) button, + required TResult Function(AsUiButtons field0) buttons, + required TResult Function(AsUiSwitch field0) toggleSwitch, + required TResult Function(AsUiTextarea field0) textarea, + required TResult Function(AsUiTextInput field0) textInput, + required TResult Function(AsUiNumberInput field0) numberInput, + required TResult Function(AsUiSelect field0) select, + required TResult Function(AsUiFolder field0) folder, + required TResult Function(AsUiPostFormButton field0) postFormButton, + required TResult Function(AsUiPostForm field0) postForm, + }) { + return button(field0); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(AsUiRoot field0)? root, + TResult? Function(AsUiContainer field0)? container, + TResult? Function(AsUiText field0)? text, + TResult? Function(AsUiMfm field0)? mfm, + TResult? Function(AsUiButton field0)? button, + TResult? Function(AsUiButtons field0)? buttons, + TResult? Function(AsUiSwitch field0)? toggleSwitch, + TResult? Function(AsUiTextarea field0)? textarea, + TResult? Function(AsUiTextInput field0)? textInput, + TResult? Function(AsUiNumberInput field0)? numberInput, + TResult? Function(AsUiSelect field0)? select, + TResult? Function(AsUiFolder field0)? folder, + TResult? Function(AsUiPostFormButton field0)? postFormButton, + TResult? Function(AsUiPostForm field0)? postForm, + }) { + return button?.call(field0); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(AsUiRoot field0)? root, + TResult Function(AsUiContainer field0)? container, + TResult Function(AsUiText field0)? text, + TResult Function(AsUiMfm field0)? mfm, + TResult Function(AsUiButton field0)? button, + TResult Function(AsUiButtons field0)? buttons, + TResult Function(AsUiSwitch field0)? toggleSwitch, + TResult Function(AsUiTextarea field0)? textarea, + TResult Function(AsUiTextInput field0)? textInput, + TResult Function(AsUiNumberInput field0)? numberInput, + TResult Function(AsUiSelect field0)? select, + TResult Function(AsUiFolder field0)? folder, + TResult Function(AsUiPostFormButton field0)? postFormButton, + TResult Function(AsUiPostForm field0)? postForm, + required TResult orElse(), + }) { + if (button != null) { + return button(field0); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(AsUiComponent_Root value) root, + required TResult Function(AsUiComponent_Container value) container, + required TResult Function(AsUiComponent_Text value) text, + required TResult Function(AsUiComponent_Mfm value) mfm, + required TResult Function(AsUiComponent_Button value) button, + required TResult Function(AsUiComponent_Buttons value) buttons, + required TResult Function(AsUiComponent_ToggleSwitch value) toggleSwitch, + required TResult Function(AsUiComponent_Textarea value) textarea, + required TResult Function(AsUiComponent_TextInput value) textInput, + required TResult Function(AsUiComponent_NumberInput value) numberInput, + required TResult Function(AsUiComponent_Select value) select, + required TResult Function(AsUiComponent_Folder value) folder, + required TResult Function(AsUiComponent_PostFormButton value) + postFormButton, + required TResult Function(AsUiComponent_PostForm value) postForm, + }) { + return button(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(AsUiComponent_Root value)? root, + TResult? Function(AsUiComponent_Container value)? container, + TResult? Function(AsUiComponent_Text value)? text, + TResult? Function(AsUiComponent_Mfm value)? mfm, + TResult? Function(AsUiComponent_Button value)? button, + TResult? Function(AsUiComponent_Buttons value)? buttons, + TResult? Function(AsUiComponent_ToggleSwitch value)? toggleSwitch, + TResult? Function(AsUiComponent_Textarea value)? textarea, + TResult? Function(AsUiComponent_TextInput value)? textInput, + TResult? Function(AsUiComponent_NumberInput value)? numberInput, + TResult? Function(AsUiComponent_Select value)? select, + TResult? Function(AsUiComponent_Folder value)? folder, + TResult? Function(AsUiComponent_PostFormButton value)? postFormButton, + TResult? Function(AsUiComponent_PostForm value)? postForm, + }) { + return button?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(AsUiComponent_Root value)? root, + TResult Function(AsUiComponent_Container value)? container, + TResult Function(AsUiComponent_Text value)? text, + TResult Function(AsUiComponent_Mfm value)? mfm, + TResult Function(AsUiComponent_Button value)? button, + TResult Function(AsUiComponent_Buttons value)? buttons, + TResult Function(AsUiComponent_ToggleSwitch value)? toggleSwitch, + TResult Function(AsUiComponent_Textarea value)? textarea, + TResult Function(AsUiComponent_TextInput value)? textInput, + TResult Function(AsUiComponent_NumberInput value)? numberInput, + TResult Function(AsUiComponent_Select value)? select, + TResult Function(AsUiComponent_Folder value)? folder, + TResult Function(AsUiComponent_PostFormButton value)? postFormButton, + TResult Function(AsUiComponent_PostForm value)? postForm, + required TResult orElse(), + }) { + if (button != null) { + return button(this); + } + return orElse(); + } +} + +abstract class AsUiComponent_Button extends AsUiComponent { + const factory AsUiComponent_Button(final AsUiButton field0) = + _$AsUiComponent_ButtonImpl; + const AsUiComponent_Button._() : super._(); + + @override + AsUiButton get field0; + @JsonKey(ignore: true) + _$$AsUiComponent_ButtonImplCopyWith<_$AsUiComponent_ButtonImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$AsUiComponent_ButtonsImplCopyWith<$Res> { + factory _$$AsUiComponent_ButtonsImplCopyWith( + _$AsUiComponent_ButtonsImpl value, + $Res Function(_$AsUiComponent_ButtonsImpl) then) = + __$$AsUiComponent_ButtonsImplCopyWithImpl<$Res>; + @useResult + $Res call({AsUiButtons field0}); +} + +/// @nodoc +class __$$AsUiComponent_ButtonsImplCopyWithImpl<$Res> + extends _$AsUiComponentCopyWithImpl<$Res, _$AsUiComponent_ButtonsImpl> + implements _$$AsUiComponent_ButtonsImplCopyWith<$Res> { + __$$AsUiComponent_ButtonsImplCopyWithImpl(_$AsUiComponent_ButtonsImpl _value, + $Res Function(_$AsUiComponent_ButtonsImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? field0 = null, + }) { + return _then(_$AsUiComponent_ButtonsImpl( + null == field0 + ? _value.field0 + : field0 // ignore: cast_nullable_to_non_nullable + as AsUiButtons, + )); + } +} + +/// @nodoc + +class _$AsUiComponent_ButtonsImpl extends AsUiComponent_Buttons { + const _$AsUiComponent_ButtonsImpl(this.field0) : super._(); + + @override + final AsUiButtons field0; + + @override + String toString() { + return 'AsUiComponent.buttons(field0: $field0)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$AsUiComponent_ButtonsImpl && + (identical(other.field0, field0) || other.field0 == field0)); + } + + @override + int get hashCode => Object.hash(runtimeType, field0); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$AsUiComponent_ButtonsImplCopyWith<_$AsUiComponent_ButtonsImpl> + get copyWith => __$$AsUiComponent_ButtonsImplCopyWithImpl< + _$AsUiComponent_ButtonsImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(AsUiRoot field0) root, + required TResult Function(AsUiContainer field0) container, + required TResult Function(AsUiText field0) text, + required TResult Function(AsUiMfm field0) mfm, + required TResult Function(AsUiButton field0) button, + required TResult Function(AsUiButtons field0) buttons, + required TResult Function(AsUiSwitch field0) toggleSwitch, + required TResult Function(AsUiTextarea field0) textarea, + required TResult Function(AsUiTextInput field0) textInput, + required TResult Function(AsUiNumberInput field0) numberInput, + required TResult Function(AsUiSelect field0) select, + required TResult Function(AsUiFolder field0) folder, + required TResult Function(AsUiPostFormButton field0) postFormButton, + required TResult Function(AsUiPostForm field0) postForm, + }) { + return buttons(field0); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(AsUiRoot field0)? root, + TResult? Function(AsUiContainer field0)? container, + TResult? Function(AsUiText field0)? text, + TResult? Function(AsUiMfm field0)? mfm, + TResult? Function(AsUiButton field0)? button, + TResult? Function(AsUiButtons field0)? buttons, + TResult? Function(AsUiSwitch field0)? toggleSwitch, + TResult? Function(AsUiTextarea field0)? textarea, + TResult? Function(AsUiTextInput field0)? textInput, + TResult? Function(AsUiNumberInput field0)? numberInput, + TResult? Function(AsUiSelect field0)? select, + TResult? Function(AsUiFolder field0)? folder, + TResult? Function(AsUiPostFormButton field0)? postFormButton, + TResult? Function(AsUiPostForm field0)? postForm, + }) { + return buttons?.call(field0); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(AsUiRoot field0)? root, + TResult Function(AsUiContainer field0)? container, + TResult Function(AsUiText field0)? text, + TResult Function(AsUiMfm field0)? mfm, + TResult Function(AsUiButton field0)? button, + TResult Function(AsUiButtons field0)? buttons, + TResult Function(AsUiSwitch field0)? toggleSwitch, + TResult Function(AsUiTextarea field0)? textarea, + TResult Function(AsUiTextInput field0)? textInput, + TResult Function(AsUiNumberInput field0)? numberInput, + TResult Function(AsUiSelect field0)? select, + TResult Function(AsUiFolder field0)? folder, + TResult Function(AsUiPostFormButton field0)? postFormButton, + TResult Function(AsUiPostForm field0)? postForm, + required TResult orElse(), + }) { + if (buttons != null) { + return buttons(field0); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(AsUiComponent_Root value) root, + required TResult Function(AsUiComponent_Container value) container, + required TResult Function(AsUiComponent_Text value) text, + required TResult Function(AsUiComponent_Mfm value) mfm, + required TResult Function(AsUiComponent_Button value) button, + required TResult Function(AsUiComponent_Buttons value) buttons, + required TResult Function(AsUiComponent_ToggleSwitch value) toggleSwitch, + required TResult Function(AsUiComponent_Textarea value) textarea, + required TResult Function(AsUiComponent_TextInput value) textInput, + required TResult Function(AsUiComponent_NumberInput value) numberInput, + required TResult Function(AsUiComponent_Select value) select, + required TResult Function(AsUiComponent_Folder value) folder, + required TResult Function(AsUiComponent_PostFormButton value) + postFormButton, + required TResult Function(AsUiComponent_PostForm value) postForm, + }) { + return buttons(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(AsUiComponent_Root value)? root, + TResult? Function(AsUiComponent_Container value)? container, + TResult? Function(AsUiComponent_Text value)? text, + TResult? Function(AsUiComponent_Mfm value)? mfm, + TResult? Function(AsUiComponent_Button value)? button, + TResult? Function(AsUiComponent_Buttons value)? buttons, + TResult? Function(AsUiComponent_ToggleSwitch value)? toggleSwitch, + TResult? Function(AsUiComponent_Textarea value)? textarea, + TResult? Function(AsUiComponent_TextInput value)? textInput, + TResult? Function(AsUiComponent_NumberInput value)? numberInput, + TResult? Function(AsUiComponent_Select value)? select, + TResult? Function(AsUiComponent_Folder value)? folder, + TResult? Function(AsUiComponent_PostFormButton value)? postFormButton, + TResult? Function(AsUiComponent_PostForm value)? postForm, + }) { + return buttons?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(AsUiComponent_Root value)? root, + TResult Function(AsUiComponent_Container value)? container, + TResult Function(AsUiComponent_Text value)? text, + TResult Function(AsUiComponent_Mfm value)? mfm, + TResult Function(AsUiComponent_Button value)? button, + TResult Function(AsUiComponent_Buttons value)? buttons, + TResult Function(AsUiComponent_ToggleSwitch value)? toggleSwitch, + TResult Function(AsUiComponent_Textarea value)? textarea, + TResult Function(AsUiComponent_TextInput value)? textInput, + TResult Function(AsUiComponent_NumberInput value)? numberInput, + TResult Function(AsUiComponent_Select value)? select, + TResult Function(AsUiComponent_Folder value)? folder, + TResult Function(AsUiComponent_PostFormButton value)? postFormButton, + TResult Function(AsUiComponent_PostForm value)? postForm, + required TResult orElse(), + }) { + if (buttons != null) { + return buttons(this); + } + return orElse(); + } +} + +abstract class AsUiComponent_Buttons extends AsUiComponent { + const factory AsUiComponent_Buttons(final AsUiButtons field0) = + _$AsUiComponent_ButtonsImpl; + const AsUiComponent_Buttons._() : super._(); + + @override + AsUiButtons get field0; + @JsonKey(ignore: true) + _$$AsUiComponent_ButtonsImplCopyWith<_$AsUiComponent_ButtonsImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$AsUiComponent_ToggleSwitchImplCopyWith<$Res> { + factory _$$AsUiComponent_ToggleSwitchImplCopyWith( + _$AsUiComponent_ToggleSwitchImpl value, + $Res Function(_$AsUiComponent_ToggleSwitchImpl) then) = + __$$AsUiComponent_ToggleSwitchImplCopyWithImpl<$Res>; + @useResult + $Res call({AsUiSwitch field0}); +} + +/// @nodoc +class __$$AsUiComponent_ToggleSwitchImplCopyWithImpl<$Res> + extends _$AsUiComponentCopyWithImpl<$Res, _$AsUiComponent_ToggleSwitchImpl> + implements _$$AsUiComponent_ToggleSwitchImplCopyWith<$Res> { + __$$AsUiComponent_ToggleSwitchImplCopyWithImpl( + _$AsUiComponent_ToggleSwitchImpl _value, + $Res Function(_$AsUiComponent_ToggleSwitchImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? field0 = null, + }) { + return _then(_$AsUiComponent_ToggleSwitchImpl( + null == field0 + ? _value.field0 + : field0 // ignore: cast_nullable_to_non_nullable + as AsUiSwitch, + )); + } +} + +/// @nodoc + +class _$AsUiComponent_ToggleSwitchImpl extends AsUiComponent_ToggleSwitch { + const _$AsUiComponent_ToggleSwitchImpl(this.field0) : super._(); + + @override + final AsUiSwitch field0; + + @override + String toString() { + return 'AsUiComponent.toggleSwitch(field0: $field0)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$AsUiComponent_ToggleSwitchImpl && + (identical(other.field0, field0) || other.field0 == field0)); + } + + @override + int get hashCode => Object.hash(runtimeType, field0); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$AsUiComponent_ToggleSwitchImplCopyWith<_$AsUiComponent_ToggleSwitchImpl> + get copyWith => __$$AsUiComponent_ToggleSwitchImplCopyWithImpl< + _$AsUiComponent_ToggleSwitchImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(AsUiRoot field0) root, + required TResult Function(AsUiContainer field0) container, + required TResult Function(AsUiText field0) text, + required TResult Function(AsUiMfm field0) mfm, + required TResult Function(AsUiButton field0) button, + required TResult Function(AsUiButtons field0) buttons, + required TResult Function(AsUiSwitch field0) toggleSwitch, + required TResult Function(AsUiTextarea field0) textarea, + required TResult Function(AsUiTextInput field0) textInput, + required TResult Function(AsUiNumberInput field0) numberInput, + required TResult Function(AsUiSelect field0) select, + required TResult Function(AsUiFolder field0) folder, + required TResult Function(AsUiPostFormButton field0) postFormButton, + required TResult Function(AsUiPostForm field0) postForm, + }) { + return toggleSwitch(field0); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(AsUiRoot field0)? root, + TResult? Function(AsUiContainer field0)? container, + TResult? Function(AsUiText field0)? text, + TResult? Function(AsUiMfm field0)? mfm, + TResult? Function(AsUiButton field0)? button, + TResult? Function(AsUiButtons field0)? buttons, + TResult? Function(AsUiSwitch field0)? toggleSwitch, + TResult? Function(AsUiTextarea field0)? textarea, + TResult? Function(AsUiTextInput field0)? textInput, + TResult? Function(AsUiNumberInput field0)? numberInput, + TResult? Function(AsUiSelect field0)? select, + TResult? Function(AsUiFolder field0)? folder, + TResult? Function(AsUiPostFormButton field0)? postFormButton, + TResult? Function(AsUiPostForm field0)? postForm, + }) { + return toggleSwitch?.call(field0); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(AsUiRoot field0)? root, + TResult Function(AsUiContainer field0)? container, + TResult Function(AsUiText field0)? text, + TResult Function(AsUiMfm field0)? mfm, + TResult Function(AsUiButton field0)? button, + TResult Function(AsUiButtons field0)? buttons, + TResult Function(AsUiSwitch field0)? toggleSwitch, + TResult Function(AsUiTextarea field0)? textarea, + TResult Function(AsUiTextInput field0)? textInput, + TResult Function(AsUiNumberInput field0)? numberInput, + TResult Function(AsUiSelect field0)? select, + TResult Function(AsUiFolder field0)? folder, + TResult Function(AsUiPostFormButton field0)? postFormButton, + TResult Function(AsUiPostForm field0)? postForm, + required TResult orElse(), + }) { + if (toggleSwitch != null) { + return toggleSwitch(field0); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(AsUiComponent_Root value) root, + required TResult Function(AsUiComponent_Container value) container, + required TResult Function(AsUiComponent_Text value) text, + required TResult Function(AsUiComponent_Mfm value) mfm, + required TResult Function(AsUiComponent_Button value) button, + required TResult Function(AsUiComponent_Buttons value) buttons, + required TResult Function(AsUiComponent_ToggleSwitch value) toggleSwitch, + required TResult Function(AsUiComponent_Textarea value) textarea, + required TResult Function(AsUiComponent_TextInput value) textInput, + required TResult Function(AsUiComponent_NumberInput value) numberInput, + required TResult Function(AsUiComponent_Select value) select, + required TResult Function(AsUiComponent_Folder value) folder, + required TResult Function(AsUiComponent_PostFormButton value) + postFormButton, + required TResult Function(AsUiComponent_PostForm value) postForm, + }) { + return toggleSwitch(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(AsUiComponent_Root value)? root, + TResult? Function(AsUiComponent_Container value)? container, + TResult? Function(AsUiComponent_Text value)? text, + TResult? Function(AsUiComponent_Mfm value)? mfm, + TResult? Function(AsUiComponent_Button value)? button, + TResult? Function(AsUiComponent_Buttons value)? buttons, + TResult? Function(AsUiComponent_ToggleSwitch value)? toggleSwitch, + TResult? Function(AsUiComponent_Textarea value)? textarea, + TResult? Function(AsUiComponent_TextInput value)? textInput, + TResult? Function(AsUiComponent_NumberInput value)? numberInput, + TResult? Function(AsUiComponent_Select value)? select, + TResult? Function(AsUiComponent_Folder value)? folder, + TResult? Function(AsUiComponent_PostFormButton value)? postFormButton, + TResult? Function(AsUiComponent_PostForm value)? postForm, + }) { + return toggleSwitch?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(AsUiComponent_Root value)? root, + TResult Function(AsUiComponent_Container value)? container, + TResult Function(AsUiComponent_Text value)? text, + TResult Function(AsUiComponent_Mfm value)? mfm, + TResult Function(AsUiComponent_Button value)? button, + TResult Function(AsUiComponent_Buttons value)? buttons, + TResult Function(AsUiComponent_ToggleSwitch value)? toggleSwitch, + TResult Function(AsUiComponent_Textarea value)? textarea, + TResult Function(AsUiComponent_TextInput value)? textInput, + TResult Function(AsUiComponent_NumberInput value)? numberInput, + TResult Function(AsUiComponent_Select value)? select, + TResult Function(AsUiComponent_Folder value)? folder, + TResult Function(AsUiComponent_PostFormButton value)? postFormButton, + TResult Function(AsUiComponent_PostForm value)? postForm, + required TResult orElse(), + }) { + if (toggleSwitch != null) { + return toggleSwitch(this); + } + return orElse(); + } +} + +abstract class AsUiComponent_ToggleSwitch extends AsUiComponent { + const factory AsUiComponent_ToggleSwitch(final AsUiSwitch field0) = + _$AsUiComponent_ToggleSwitchImpl; + const AsUiComponent_ToggleSwitch._() : super._(); + + @override + AsUiSwitch get field0; + @JsonKey(ignore: true) + _$$AsUiComponent_ToggleSwitchImplCopyWith<_$AsUiComponent_ToggleSwitchImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$AsUiComponent_TextareaImplCopyWith<$Res> { + factory _$$AsUiComponent_TextareaImplCopyWith( + _$AsUiComponent_TextareaImpl value, + $Res Function(_$AsUiComponent_TextareaImpl) then) = + __$$AsUiComponent_TextareaImplCopyWithImpl<$Res>; + @useResult + $Res call({AsUiTextarea field0}); +} + +/// @nodoc +class __$$AsUiComponent_TextareaImplCopyWithImpl<$Res> + extends _$AsUiComponentCopyWithImpl<$Res, _$AsUiComponent_TextareaImpl> + implements _$$AsUiComponent_TextareaImplCopyWith<$Res> { + __$$AsUiComponent_TextareaImplCopyWithImpl( + _$AsUiComponent_TextareaImpl _value, + $Res Function(_$AsUiComponent_TextareaImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? field0 = null, + }) { + return _then(_$AsUiComponent_TextareaImpl( + null == field0 + ? _value.field0 + : field0 // ignore: cast_nullable_to_non_nullable + as AsUiTextarea, + )); + } +} + +/// @nodoc + +class _$AsUiComponent_TextareaImpl extends AsUiComponent_Textarea { + const _$AsUiComponent_TextareaImpl(this.field0) : super._(); + + @override + final AsUiTextarea field0; + + @override + String toString() { + return 'AsUiComponent.textarea(field0: $field0)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$AsUiComponent_TextareaImpl && + (identical(other.field0, field0) || other.field0 == field0)); + } + + @override + int get hashCode => Object.hash(runtimeType, field0); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$AsUiComponent_TextareaImplCopyWith<_$AsUiComponent_TextareaImpl> + get copyWith => __$$AsUiComponent_TextareaImplCopyWithImpl< + _$AsUiComponent_TextareaImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(AsUiRoot field0) root, + required TResult Function(AsUiContainer field0) container, + required TResult Function(AsUiText field0) text, + required TResult Function(AsUiMfm field0) mfm, + required TResult Function(AsUiButton field0) button, + required TResult Function(AsUiButtons field0) buttons, + required TResult Function(AsUiSwitch field0) toggleSwitch, + required TResult Function(AsUiTextarea field0) textarea, + required TResult Function(AsUiTextInput field0) textInput, + required TResult Function(AsUiNumberInput field0) numberInput, + required TResult Function(AsUiSelect field0) select, + required TResult Function(AsUiFolder field0) folder, + required TResult Function(AsUiPostFormButton field0) postFormButton, + required TResult Function(AsUiPostForm field0) postForm, + }) { + return textarea(field0); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(AsUiRoot field0)? root, + TResult? Function(AsUiContainer field0)? container, + TResult? Function(AsUiText field0)? text, + TResult? Function(AsUiMfm field0)? mfm, + TResult? Function(AsUiButton field0)? button, + TResult? Function(AsUiButtons field0)? buttons, + TResult? Function(AsUiSwitch field0)? toggleSwitch, + TResult? Function(AsUiTextarea field0)? textarea, + TResult? Function(AsUiTextInput field0)? textInput, + TResult? Function(AsUiNumberInput field0)? numberInput, + TResult? Function(AsUiSelect field0)? select, + TResult? Function(AsUiFolder field0)? folder, + TResult? Function(AsUiPostFormButton field0)? postFormButton, + TResult? Function(AsUiPostForm field0)? postForm, + }) { + return textarea?.call(field0); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(AsUiRoot field0)? root, + TResult Function(AsUiContainer field0)? container, + TResult Function(AsUiText field0)? text, + TResult Function(AsUiMfm field0)? mfm, + TResult Function(AsUiButton field0)? button, + TResult Function(AsUiButtons field0)? buttons, + TResult Function(AsUiSwitch field0)? toggleSwitch, + TResult Function(AsUiTextarea field0)? textarea, + TResult Function(AsUiTextInput field0)? textInput, + TResult Function(AsUiNumberInput field0)? numberInput, + TResult Function(AsUiSelect field0)? select, + TResult Function(AsUiFolder field0)? folder, + TResult Function(AsUiPostFormButton field0)? postFormButton, + TResult Function(AsUiPostForm field0)? postForm, + required TResult orElse(), + }) { + if (textarea != null) { + return textarea(field0); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(AsUiComponent_Root value) root, + required TResult Function(AsUiComponent_Container value) container, + required TResult Function(AsUiComponent_Text value) text, + required TResult Function(AsUiComponent_Mfm value) mfm, + required TResult Function(AsUiComponent_Button value) button, + required TResult Function(AsUiComponent_Buttons value) buttons, + required TResult Function(AsUiComponent_ToggleSwitch value) toggleSwitch, + required TResult Function(AsUiComponent_Textarea value) textarea, + required TResult Function(AsUiComponent_TextInput value) textInput, + required TResult Function(AsUiComponent_NumberInput value) numberInput, + required TResult Function(AsUiComponent_Select value) select, + required TResult Function(AsUiComponent_Folder value) folder, + required TResult Function(AsUiComponent_PostFormButton value) + postFormButton, + required TResult Function(AsUiComponent_PostForm value) postForm, + }) { + return textarea(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(AsUiComponent_Root value)? root, + TResult? Function(AsUiComponent_Container value)? container, + TResult? Function(AsUiComponent_Text value)? text, + TResult? Function(AsUiComponent_Mfm value)? mfm, + TResult? Function(AsUiComponent_Button value)? button, + TResult? Function(AsUiComponent_Buttons value)? buttons, + TResult? Function(AsUiComponent_ToggleSwitch value)? toggleSwitch, + TResult? Function(AsUiComponent_Textarea value)? textarea, + TResult? Function(AsUiComponent_TextInput value)? textInput, + TResult? Function(AsUiComponent_NumberInput value)? numberInput, + TResult? Function(AsUiComponent_Select value)? select, + TResult? Function(AsUiComponent_Folder value)? folder, + TResult? Function(AsUiComponent_PostFormButton value)? postFormButton, + TResult? Function(AsUiComponent_PostForm value)? postForm, + }) { + return textarea?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(AsUiComponent_Root value)? root, + TResult Function(AsUiComponent_Container value)? container, + TResult Function(AsUiComponent_Text value)? text, + TResult Function(AsUiComponent_Mfm value)? mfm, + TResult Function(AsUiComponent_Button value)? button, + TResult Function(AsUiComponent_Buttons value)? buttons, + TResult Function(AsUiComponent_ToggleSwitch value)? toggleSwitch, + TResult Function(AsUiComponent_Textarea value)? textarea, + TResult Function(AsUiComponent_TextInput value)? textInput, + TResult Function(AsUiComponent_NumberInput value)? numberInput, + TResult Function(AsUiComponent_Select value)? select, + TResult Function(AsUiComponent_Folder value)? folder, + TResult Function(AsUiComponent_PostFormButton value)? postFormButton, + TResult Function(AsUiComponent_PostForm value)? postForm, + required TResult orElse(), + }) { + if (textarea != null) { + return textarea(this); + } + return orElse(); + } +} + +abstract class AsUiComponent_Textarea extends AsUiComponent { + const factory AsUiComponent_Textarea(final AsUiTextarea field0) = + _$AsUiComponent_TextareaImpl; + const AsUiComponent_Textarea._() : super._(); + + @override + AsUiTextarea get field0; + @JsonKey(ignore: true) + _$$AsUiComponent_TextareaImplCopyWith<_$AsUiComponent_TextareaImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$AsUiComponent_TextInputImplCopyWith<$Res> { + factory _$$AsUiComponent_TextInputImplCopyWith( + _$AsUiComponent_TextInputImpl value, + $Res Function(_$AsUiComponent_TextInputImpl) then) = + __$$AsUiComponent_TextInputImplCopyWithImpl<$Res>; + @useResult + $Res call({AsUiTextInput field0}); +} + +/// @nodoc +class __$$AsUiComponent_TextInputImplCopyWithImpl<$Res> + extends _$AsUiComponentCopyWithImpl<$Res, _$AsUiComponent_TextInputImpl> + implements _$$AsUiComponent_TextInputImplCopyWith<$Res> { + __$$AsUiComponent_TextInputImplCopyWithImpl( + _$AsUiComponent_TextInputImpl _value, + $Res Function(_$AsUiComponent_TextInputImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? field0 = null, + }) { + return _then(_$AsUiComponent_TextInputImpl( + null == field0 + ? _value.field0 + : field0 // ignore: cast_nullable_to_non_nullable + as AsUiTextInput, + )); + } +} + +/// @nodoc + +class _$AsUiComponent_TextInputImpl extends AsUiComponent_TextInput { + const _$AsUiComponent_TextInputImpl(this.field0) : super._(); + + @override + final AsUiTextInput field0; + + @override + String toString() { + return 'AsUiComponent.textInput(field0: $field0)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$AsUiComponent_TextInputImpl && + (identical(other.field0, field0) || other.field0 == field0)); + } + + @override + int get hashCode => Object.hash(runtimeType, field0); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$AsUiComponent_TextInputImplCopyWith<_$AsUiComponent_TextInputImpl> + get copyWith => __$$AsUiComponent_TextInputImplCopyWithImpl< + _$AsUiComponent_TextInputImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(AsUiRoot field0) root, + required TResult Function(AsUiContainer field0) container, + required TResult Function(AsUiText field0) text, + required TResult Function(AsUiMfm field0) mfm, + required TResult Function(AsUiButton field0) button, + required TResult Function(AsUiButtons field0) buttons, + required TResult Function(AsUiSwitch field0) toggleSwitch, + required TResult Function(AsUiTextarea field0) textarea, + required TResult Function(AsUiTextInput field0) textInput, + required TResult Function(AsUiNumberInput field0) numberInput, + required TResult Function(AsUiSelect field0) select, + required TResult Function(AsUiFolder field0) folder, + required TResult Function(AsUiPostFormButton field0) postFormButton, + required TResult Function(AsUiPostForm field0) postForm, + }) { + return textInput(field0); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(AsUiRoot field0)? root, + TResult? Function(AsUiContainer field0)? container, + TResult? Function(AsUiText field0)? text, + TResult? Function(AsUiMfm field0)? mfm, + TResult? Function(AsUiButton field0)? button, + TResult? Function(AsUiButtons field0)? buttons, + TResult? Function(AsUiSwitch field0)? toggleSwitch, + TResult? Function(AsUiTextarea field0)? textarea, + TResult? Function(AsUiTextInput field0)? textInput, + TResult? Function(AsUiNumberInput field0)? numberInput, + TResult? Function(AsUiSelect field0)? select, + TResult? Function(AsUiFolder field0)? folder, + TResult? Function(AsUiPostFormButton field0)? postFormButton, + TResult? Function(AsUiPostForm field0)? postForm, + }) { + return textInput?.call(field0); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(AsUiRoot field0)? root, + TResult Function(AsUiContainer field0)? container, + TResult Function(AsUiText field0)? text, + TResult Function(AsUiMfm field0)? mfm, + TResult Function(AsUiButton field0)? button, + TResult Function(AsUiButtons field0)? buttons, + TResult Function(AsUiSwitch field0)? toggleSwitch, + TResult Function(AsUiTextarea field0)? textarea, + TResult Function(AsUiTextInput field0)? textInput, + TResult Function(AsUiNumberInput field0)? numberInput, + TResult Function(AsUiSelect field0)? select, + TResult Function(AsUiFolder field0)? folder, + TResult Function(AsUiPostFormButton field0)? postFormButton, + TResult Function(AsUiPostForm field0)? postForm, + required TResult orElse(), + }) { + if (textInput != null) { + return textInput(field0); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(AsUiComponent_Root value) root, + required TResult Function(AsUiComponent_Container value) container, + required TResult Function(AsUiComponent_Text value) text, + required TResult Function(AsUiComponent_Mfm value) mfm, + required TResult Function(AsUiComponent_Button value) button, + required TResult Function(AsUiComponent_Buttons value) buttons, + required TResult Function(AsUiComponent_ToggleSwitch value) toggleSwitch, + required TResult Function(AsUiComponent_Textarea value) textarea, + required TResult Function(AsUiComponent_TextInput value) textInput, + required TResult Function(AsUiComponent_NumberInput value) numberInput, + required TResult Function(AsUiComponent_Select value) select, + required TResult Function(AsUiComponent_Folder value) folder, + required TResult Function(AsUiComponent_PostFormButton value) + postFormButton, + required TResult Function(AsUiComponent_PostForm value) postForm, + }) { + return textInput(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(AsUiComponent_Root value)? root, + TResult? Function(AsUiComponent_Container value)? container, + TResult? Function(AsUiComponent_Text value)? text, + TResult? Function(AsUiComponent_Mfm value)? mfm, + TResult? Function(AsUiComponent_Button value)? button, + TResult? Function(AsUiComponent_Buttons value)? buttons, + TResult? Function(AsUiComponent_ToggleSwitch value)? toggleSwitch, + TResult? Function(AsUiComponent_Textarea value)? textarea, + TResult? Function(AsUiComponent_TextInput value)? textInput, + TResult? Function(AsUiComponent_NumberInput value)? numberInput, + TResult? Function(AsUiComponent_Select value)? select, + TResult? Function(AsUiComponent_Folder value)? folder, + TResult? Function(AsUiComponent_PostFormButton value)? postFormButton, + TResult? Function(AsUiComponent_PostForm value)? postForm, + }) { + return textInput?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(AsUiComponent_Root value)? root, + TResult Function(AsUiComponent_Container value)? container, + TResult Function(AsUiComponent_Text value)? text, + TResult Function(AsUiComponent_Mfm value)? mfm, + TResult Function(AsUiComponent_Button value)? button, + TResult Function(AsUiComponent_Buttons value)? buttons, + TResult Function(AsUiComponent_ToggleSwitch value)? toggleSwitch, + TResult Function(AsUiComponent_Textarea value)? textarea, + TResult Function(AsUiComponent_TextInput value)? textInput, + TResult Function(AsUiComponent_NumberInput value)? numberInput, + TResult Function(AsUiComponent_Select value)? select, + TResult Function(AsUiComponent_Folder value)? folder, + TResult Function(AsUiComponent_PostFormButton value)? postFormButton, + TResult Function(AsUiComponent_PostForm value)? postForm, + required TResult orElse(), + }) { + if (textInput != null) { + return textInput(this); + } + return orElse(); + } +} + +abstract class AsUiComponent_TextInput extends AsUiComponent { + const factory AsUiComponent_TextInput(final AsUiTextInput field0) = + _$AsUiComponent_TextInputImpl; + const AsUiComponent_TextInput._() : super._(); + + @override + AsUiTextInput get field0; + @JsonKey(ignore: true) + _$$AsUiComponent_TextInputImplCopyWith<_$AsUiComponent_TextInputImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$AsUiComponent_NumberInputImplCopyWith<$Res> { + factory _$$AsUiComponent_NumberInputImplCopyWith( + _$AsUiComponent_NumberInputImpl value, + $Res Function(_$AsUiComponent_NumberInputImpl) then) = + __$$AsUiComponent_NumberInputImplCopyWithImpl<$Res>; + @useResult + $Res call({AsUiNumberInput field0}); +} + +/// @nodoc +class __$$AsUiComponent_NumberInputImplCopyWithImpl<$Res> + extends _$AsUiComponentCopyWithImpl<$Res, _$AsUiComponent_NumberInputImpl> + implements _$$AsUiComponent_NumberInputImplCopyWith<$Res> { + __$$AsUiComponent_NumberInputImplCopyWithImpl( + _$AsUiComponent_NumberInputImpl _value, + $Res Function(_$AsUiComponent_NumberInputImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? field0 = null, + }) { + return _then(_$AsUiComponent_NumberInputImpl( + null == field0 + ? _value.field0 + : field0 // ignore: cast_nullable_to_non_nullable + as AsUiNumberInput, + )); + } +} + +/// @nodoc + +class _$AsUiComponent_NumberInputImpl extends AsUiComponent_NumberInput { + const _$AsUiComponent_NumberInputImpl(this.field0) : super._(); + + @override + final AsUiNumberInput field0; + + @override + String toString() { + return 'AsUiComponent.numberInput(field0: $field0)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$AsUiComponent_NumberInputImpl && + (identical(other.field0, field0) || other.field0 == field0)); + } + + @override + int get hashCode => Object.hash(runtimeType, field0); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$AsUiComponent_NumberInputImplCopyWith<_$AsUiComponent_NumberInputImpl> + get copyWith => __$$AsUiComponent_NumberInputImplCopyWithImpl< + _$AsUiComponent_NumberInputImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(AsUiRoot field0) root, + required TResult Function(AsUiContainer field0) container, + required TResult Function(AsUiText field0) text, + required TResult Function(AsUiMfm field0) mfm, + required TResult Function(AsUiButton field0) button, + required TResult Function(AsUiButtons field0) buttons, + required TResult Function(AsUiSwitch field0) toggleSwitch, + required TResult Function(AsUiTextarea field0) textarea, + required TResult Function(AsUiTextInput field0) textInput, + required TResult Function(AsUiNumberInput field0) numberInput, + required TResult Function(AsUiSelect field0) select, + required TResult Function(AsUiFolder field0) folder, + required TResult Function(AsUiPostFormButton field0) postFormButton, + required TResult Function(AsUiPostForm field0) postForm, + }) { + return numberInput(field0); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(AsUiRoot field0)? root, + TResult? Function(AsUiContainer field0)? container, + TResult? Function(AsUiText field0)? text, + TResult? Function(AsUiMfm field0)? mfm, + TResult? Function(AsUiButton field0)? button, + TResult? Function(AsUiButtons field0)? buttons, + TResult? Function(AsUiSwitch field0)? toggleSwitch, + TResult? Function(AsUiTextarea field0)? textarea, + TResult? Function(AsUiTextInput field0)? textInput, + TResult? Function(AsUiNumberInput field0)? numberInput, + TResult? Function(AsUiSelect field0)? select, + TResult? Function(AsUiFolder field0)? folder, + TResult? Function(AsUiPostFormButton field0)? postFormButton, + TResult? Function(AsUiPostForm field0)? postForm, + }) { + return numberInput?.call(field0); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(AsUiRoot field0)? root, + TResult Function(AsUiContainer field0)? container, + TResult Function(AsUiText field0)? text, + TResult Function(AsUiMfm field0)? mfm, + TResult Function(AsUiButton field0)? button, + TResult Function(AsUiButtons field0)? buttons, + TResult Function(AsUiSwitch field0)? toggleSwitch, + TResult Function(AsUiTextarea field0)? textarea, + TResult Function(AsUiTextInput field0)? textInput, + TResult Function(AsUiNumberInput field0)? numberInput, + TResult Function(AsUiSelect field0)? select, + TResult Function(AsUiFolder field0)? folder, + TResult Function(AsUiPostFormButton field0)? postFormButton, + TResult Function(AsUiPostForm field0)? postForm, + required TResult orElse(), + }) { + if (numberInput != null) { + return numberInput(field0); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(AsUiComponent_Root value) root, + required TResult Function(AsUiComponent_Container value) container, + required TResult Function(AsUiComponent_Text value) text, + required TResult Function(AsUiComponent_Mfm value) mfm, + required TResult Function(AsUiComponent_Button value) button, + required TResult Function(AsUiComponent_Buttons value) buttons, + required TResult Function(AsUiComponent_ToggleSwitch value) toggleSwitch, + required TResult Function(AsUiComponent_Textarea value) textarea, + required TResult Function(AsUiComponent_TextInput value) textInput, + required TResult Function(AsUiComponent_NumberInput value) numberInput, + required TResult Function(AsUiComponent_Select value) select, + required TResult Function(AsUiComponent_Folder value) folder, + required TResult Function(AsUiComponent_PostFormButton value) + postFormButton, + required TResult Function(AsUiComponent_PostForm value) postForm, + }) { + return numberInput(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(AsUiComponent_Root value)? root, + TResult? Function(AsUiComponent_Container value)? container, + TResult? Function(AsUiComponent_Text value)? text, + TResult? Function(AsUiComponent_Mfm value)? mfm, + TResult? Function(AsUiComponent_Button value)? button, + TResult? Function(AsUiComponent_Buttons value)? buttons, + TResult? Function(AsUiComponent_ToggleSwitch value)? toggleSwitch, + TResult? Function(AsUiComponent_Textarea value)? textarea, + TResult? Function(AsUiComponent_TextInput value)? textInput, + TResult? Function(AsUiComponent_NumberInput value)? numberInput, + TResult? Function(AsUiComponent_Select value)? select, + TResult? Function(AsUiComponent_Folder value)? folder, + TResult? Function(AsUiComponent_PostFormButton value)? postFormButton, + TResult? Function(AsUiComponent_PostForm value)? postForm, + }) { + return numberInput?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(AsUiComponent_Root value)? root, + TResult Function(AsUiComponent_Container value)? container, + TResult Function(AsUiComponent_Text value)? text, + TResult Function(AsUiComponent_Mfm value)? mfm, + TResult Function(AsUiComponent_Button value)? button, + TResult Function(AsUiComponent_Buttons value)? buttons, + TResult Function(AsUiComponent_ToggleSwitch value)? toggleSwitch, + TResult Function(AsUiComponent_Textarea value)? textarea, + TResult Function(AsUiComponent_TextInput value)? textInput, + TResult Function(AsUiComponent_NumberInput value)? numberInput, + TResult Function(AsUiComponent_Select value)? select, + TResult Function(AsUiComponent_Folder value)? folder, + TResult Function(AsUiComponent_PostFormButton value)? postFormButton, + TResult Function(AsUiComponent_PostForm value)? postForm, + required TResult orElse(), + }) { + if (numberInput != null) { + return numberInput(this); + } + return orElse(); + } +} + +abstract class AsUiComponent_NumberInput extends AsUiComponent { + const factory AsUiComponent_NumberInput(final AsUiNumberInput field0) = + _$AsUiComponent_NumberInputImpl; + const AsUiComponent_NumberInput._() : super._(); + + @override + AsUiNumberInput get field0; + @JsonKey(ignore: true) + _$$AsUiComponent_NumberInputImplCopyWith<_$AsUiComponent_NumberInputImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$AsUiComponent_SelectImplCopyWith<$Res> { + factory _$$AsUiComponent_SelectImplCopyWith(_$AsUiComponent_SelectImpl value, + $Res Function(_$AsUiComponent_SelectImpl) then) = + __$$AsUiComponent_SelectImplCopyWithImpl<$Res>; + @useResult + $Res call({AsUiSelect field0}); +} + +/// @nodoc +class __$$AsUiComponent_SelectImplCopyWithImpl<$Res> + extends _$AsUiComponentCopyWithImpl<$Res, _$AsUiComponent_SelectImpl> + implements _$$AsUiComponent_SelectImplCopyWith<$Res> { + __$$AsUiComponent_SelectImplCopyWithImpl(_$AsUiComponent_SelectImpl _value, + $Res Function(_$AsUiComponent_SelectImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? field0 = null, + }) { + return _then(_$AsUiComponent_SelectImpl( + null == field0 + ? _value.field0 + : field0 // ignore: cast_nullable_to_non_nullable + as AsUiSelect, + )); + } +} + +/// @nodoc + +class _$AsUiComponent_SelectImpl extends AsUiComponent_Select { + const _$AsUiComponent_SelectImpl(this.field0) : super._(); + + @override + final AsUiSelect field0; + + @override + String toString() { + return 'AsUiComponent.select(field0: $field0)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$AsUiComponent_SelectImpl && + (identical(other.field0, field0) || other.field0 == field0)); + } + + @override + int get hashCode => Object.hash(runtimeType, field0); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$AsUiComponent_SelectImplCopyWith<_$AsUiComponent_SelectImpl> + get copyWith => + __$$AsUiComponent_SelectImplCopyWithImpl<_$AsUiComponent_SelectImpl>( + this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(AsUiRoot field0) root, + required TResult Function(AsUiContainer field0) container, + required TResult Function(AsUiText field0) text, + required TResult Function(AsUiMfm field0) mfm, + required TResult Function(AsUiButton field0) button, + required TResult Function(AsUiButtons field0) buttons, + required TResult Function(AsUiSwitch field0) toggleSwitch, + required TResult Function(AsUiTextarea field0) textarea, + required TResult Function(AsUiTextInput field0) textInput, + required TResult Function(AsUiNumberInput field0) numberInput, + required TResult Function(AsUiSelect field0) select, + required TResult Function(AsUiFolder field0) folder, + required TResult Function(AsUiPostFormButton field0) postFormButton, + required TResult Function(AsUiPostForm field0) postForm, + }) { + return select(field0); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(AsUiRoot field0)? root, + TResult? Function(AsUiContainer field0)? container, + TResult? Function(AsUiText field0)? text, + TResult? Function(AsUiMfm field0)? mfm, + TResult? Function(AsUiButton field0)? button, + TResult? Function(AsUiButtons field0)? buttons, + TResult? Function(AsUiSwitch field0)? toggleSwitch, + TResult? Function(AsUiTextarea field0)? textarea, + TResult? Function(AsUiTextInput field0)? textInput, + TResult? Function(AsUiNumberInput field0)? numberInput, + TResult? Function(AsUiSelect field0)? select, + TResult? Function(AsUiFolder field0)? folder, + TResult? Function(AsUiPostFormButton field0)? postFormButton, + TResult? Function(AsUiPostForm field0)? postForm, + }) { + return select?.call(field0); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(AsUiRoot field0)? root, + TResult Function(AsUiContainer field0)? container, + TResult Function(AsUiText field0)? text, + TResult Function(AsUiMfm field0)? mfm, + TResult Function(AsUiButton field0)? button, + TResult Function(AsUiButtons field0)? buttons, + TResult Function(AsUiSwitch field0)? toggleSwitch, + TResult Function(AsUiTextarea field0)? textarea, + TResult Function(AsUiTextInput field0)? textInput, + TResult Function(AsUiNumberInput field0)? numberInput, + TResult Function(AsUiSelect field0)? select, + TResult Function(AsUiFolder field0)? folder, + TResult Function(AsUiPostFormButton field0)? postFormButton, + TResult Function(AsUiPostForm field0)? postForm, + required TResult orElse(), + }) { + if (select != null) { + return select(field0); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(AsUiComponent_Root value) root, + required TResult Function(AsUiComponent_Container value) container, + required TResult Function(AsUiComponent_Text value) text, + required TResult Function(AsUiComponent_Mfm value) mfm, + required TResult Function(AsUiComponent_Button value) button, + required TResult Function(AsUiComponent_Buttons value) buttons, + required TResult Function(AsUiComponent_ToggleSwitch value) toggleSwitch, + required TResult Function(AsUiComponent_Textarea value) textarea, + required TResult Function(AsUiComponent_TextInput value) textInput, + required TResult Function(AsUiComponent_NumberInput value) numberInput, + required TResult Function(AsUiComponent_Select value) select, + required TResult Function(AsUiComponent_Folder value) folder, + required TResult Function(AsUiComponent_PostFormButton value) + postFormButton, + required TResult Function(AsUiComponent_PostForm value) postForm, + }) { + return select(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(AsUiComponent_Root value)? root, + TResult? Function(AsUiComponent_Container value)? container, + TResult? Function(AsUiComponent_Text value)? text, + TResult? Function(AsUiComponent_Mfm value)? mfm, + TResult? Function(AsUiComponent_Button value)? button, + TResult? Function(AsUiComponent_Buttons value)? buttons, + TResult? Function(AsUiComponent_ToggleSwitch value)? toggleSwitch, + TResult? Function(AsUiComponent_Textarea value)? textarea, + TResult? Function(AsUiComponent_TextInput value)? textInput, + TResult? Function(AsUiComponent_NumberInput value)? numberInput, + TResult? Function(AsUiComponent_Select value)? select, + TResult? Function(AsUiComponent_Folder value)? folder, + TResult? Function(AsUiComponent_PostFormButton value)? postFormButton, + TResult? Function(AsUiComponent_PostForm value)? postForm, + }) { + return select?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(AsUiComponent_Root value)? root, + TResult Function(AsUiComponent_Container value)? container, + TResult Function(AsUiComponent_Text value)? text, + TResult Function(AsUiComponent_Mfm value)? mfm, + TResult Function(AsUiComponent_Button value)? button, + TResult Function(AsUiComponent_Buttons value)? buttons, + TResult Function(AsUiComponent_ToggleSwitch value)? toggleSwitch, + TResult Function(AsUiComponent_Textarea value)? textarea, + TResult Function(AsUiComponent_TextInput value)? textInput, + TResult Function(AsUiComponent_NumberInput value)? numberInput, + TResult Function(AsUiComponent_Select value)? select, + TResult Function(AsUiComponent_Folder value)? folder, + TResult Function(AsUiComponent_PostFormButton value)? postFormButton, + TResult Function(AsUiComponent_PostForm value)? postForm, + required TResult orElse(), + }) { + if (select != null) { + return select(this); + } + return orElse(); + } +} + +abstract class AsUiComponent_Select extends AsUiComponent { + const factory AsUiComponent_Select(final AsUiSelect field0) = + _$AsUiComponent_SelectImpl; + const AsUiComponent_Select._() : super._(); + + @override + AsUiSelect get field0; + @JsonKey(ignore: true) + _$$AsUiComponent_SelectImplCopyWith<_$AsUiComponent_SelectImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$AsUiComponent_FolderImplCopyWith<$Res> { + factory _$$AsUiComponent_FolderImplCopyWith(_$AsUiComponent_FolderImpl value, + $Res Function(_$AsUiComponent_FolderImpl) then) = + __$$AsUiComponent_FolderImplCopyWithImpl<$Res>; + @useResult + $Res call({AsUiFolder field0}); +} + +/// @nodoc +class __$$AsUiComponent_FolderImplCopyWithImpl<$Res> + extends _$AsUiComponentCopyWithImpl<$Res, _$AsUiComponent_FolderImpl> + implements _$$AsUiComponent_FolderImplCopyWith<$Res> { + __$$AsUiComponent_FolderImplCopyWithImpl(_$AsUiComponent_FolderImpl _value, + $Res Function(_$AsUiComponent_FolderImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? field0 = null, + }) { + return _then(_$AsUiComponent_FolderImpl( + null == field0 + ? _value.field0 + : field0 // ignore: cast_nullable_to_non_nullable + as AsUiFolder, + )); + } +} + +/// @nodoc + +class _$AsUiComponent_FolderImpl extends AsUiComponent_Folder { + const _$AsUiComponent_FolderImpl(this.field0) : super._(); + + @override + final AsUiFolder field0; + + @override + String toString() { + return 'AsUiComponent.folder(field0: $field0)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$AsUiComponent_FolderImpl && + (identical(other.field0, field0) || other.field0 == field0)); + } + + @override + int get hashCode => Object.hash(runtimeType, field0); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$AsUiComponent_FolderImplCopyWith<_$AsUiComponent_FolderImpl> + get copyWith => + __$$AsUiComponent_FolderImplCopyWithImpl<_$AsUiComponent_FolderImpl>( + this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(AsUiRoot field0) root, + required TResult Function(AsUiContainer field0) container, + required TResult Function(AsUiText field0) text, + required TResult Function(AsUiMfm field0) mfm, + required TResult Function(AsUiButton field0) button, + required TResult Function(AsUiButtons field0) buttons, + required TResult Function(AsUiSwitch field0) toggleSwitch, + required TResult Function(AsUiTextarea field0) textarea, + required TResult Function(AsUiTextInput field0) textInput, + required TResult Function(AsUiNumberInput field0) numberInput, + required TResult Function(AsUiSelect field0) select, + required TResult Function(AsUiFolder field0) folder, + required TResult Function(AsUiPostFormButton field0) postFormButton, + required TResult Function(AsUiPostForm field0) postForm, + }) { + return folder(field0); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(AsUiRoot field0)? root, + TResult? Function(AsUiContainer field0)? container, + TResult? Function(AsUiText field0)? text, + TResult? Function(AsUiMfm field0)? mfm, + TResult? Function(AsUiButton field0)? button, + TResult? Function(AsUiButtons field0)? buttons, + TResult? Function(AsUiSwitch field0)? toggleSwitch, + TResult? Function(AsUiTextarea field0)? textarea, + TResult? Function(AsUiTextInput field0)? textInput, + TResult? Function(AsUiNumberInput field0)? numberInput, + TResult? Function(AsUiSelect field0)? select, + TResult? Function(AsUiFolder field0)? folder, + TResult? Function(AsUiPostFormButton field0)? postFormButton, + TResult? Function(AsUiPostForm field0)? postForm, + }) { + return folder?.call(field0); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(AsUiRoot field0)? root, + TResult Function(AsUiContainer field0)? container, + TResult Function(AsUiText field0)? text, + TResult Function(AsUiMfm field0)? mfm, + TResult Function(AsUiButton field0)? button, + TResult Function(AsUiButtons field0)? buttons, + TResult Function(AsUiSwitch field0)? toggleSwitch, + TResult Function(AsUiTextarea field0)? textarea, + TResult Function(AsUiTextInput field0)? textInput, + TResult Function(AsUiNumberInput field0)? numberInput, + TResult Function(AsUiSelect field0)? select, + TResult Function(AsUiFolder field0)? folder, + TResult Function(AsUiPostFormButton field0)? postFormButton, + TResult Function(AsUiPostForm field0)? postForm, + required TResult orElse(), + }) { + if (folder != null) { + return folder(field0); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(AsUiComponent_Root value) root, + required TResult Function(AsUiComponent_Container value) container, + required TResult Function(AsUiComponent_Text value) text, + required TResult Function(AsUiComponent_Mfm value) mfm, + required TResult Function(AsUiComponent_Button value) button, + required TResult Function(AsUiComponent_Buttons value) buttons, + required TResult Function(AsUiComponent_ToggleSwitch value) toggleSwitch, + required TResult Function(AsUiComponent_Textarea value) textarea, + required TResult Function(AsUiComponent_TextInput value) textInput, + required TResult Function(AsUiComponent_NumberInput value) numberInput, + required TResult Function(AsUiComponent_Select value) select, + required TResult Function(AsUiComponent_Folder value) folder, + required TResult Function(AsUiComponent_PostFormButton value) + postFormButton, + required TResult Function(AsUiComponent_PostForm value) postForm, + }) { + return folder(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(AsUiComponent_Root value)? root, + TResult? Function(AsUiComponent_Container value)? container, + TResult? Function(AsUiComponent_Text value)? text, + TResult? Function(AsUiComponent_Mfm value)? mfm, + TResult? Function(AsUiComponent_Button value)? button, + TResult? Function(AsUiComponent_Buttons value)? buttons, + TResult? Function(AsUiComponent_ToggleSwitch value)? toggleSwitch, + TResult? Function(AsUiComponent_Textarea value)? textarea, + TResult? Function(AsUiComponent_TextInput value)? textInput, + TResult? Function(AsUiComponent_NumberInput value)? numberInput, + TResult? Function(AsUiComponent_Select value)? select, + TResult? Function(AsUiComponent_Folder value)? folder, + TResult? Function(AsUiComponent_PostFormButton value)? postFormButton, + TResult? Function(AsUiComponent_PostForm value)? postForm, + }) { + return folder?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(AsUiComponent_Root value)? root, + TResult Function(AsUiComponent_Container value)? container, + TResult Function(AsUiComponent_Text value)? text, + TResult Function(AsUiComponent_Mfm value)? mfm, + TResult Function(AsUiComponent_Button value)? button, + TResult Function(AsUiComponent_Buttons value)? buttons, + TResult Function(AsUiComponent_ToggleSwitch value)? toggleSwitch, + TResult Function(AsUiComponent_Textarea value)? textarea, + TResult Function(AsUiComponent_TextInput value)? textInput, + TResult Function(AsUiComponent_NumberInput value)? numberInput, + TResult Function(AsUiComponent_Select value)? select, + TResult Function(AsUiComponent_Folder value)? folder, + TResult Function(AsUiComponent_PostFormButton value)? postFormButton, + TResult Function(AsUiComponent_PostForm value)? postForm, + required TResult orElse(), + }) { + if (folder != null) { + return folder(this); + } + return orElse(); + } +} + +abstract class AsUiComponent_Folder extends AsUiComponent { + const factory AsUiComponent_Folder(final AsUiFolder field0) = + _$AsUiComponent_FolderImpl; + const AsUiComponent_Folder._() : super._(); + + @override + AsUiFolder get field0; + @JsonKey(ignore: true) + _$$AsUiComponent_FolderImplCopyWith<_$AsUiComponent_FolderImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$AsUiComponent_PostFormButtonImplCopyWith<$Res> { + factory _$$AsUiComponent_PostFormButtonImplCopyWith( + _$AsUiComponent_PostFormButtonImpl value, + $Res Function(_$AsUiComponent_PostFormButtonImpl) then) = + __$$AsUiComponent_PostFormButtonImplCopyWithImpl<$Res>; + @useResult + $Res call({AsUiPostFormButton field0}); +} + +/// @nodoc +class __$$AsUiComponent_PostFormButtonImplCopyWithImpl<$Res> + extends _$AsUiComponentCopyWithImpl<$Res, + _$AsUiComponent_PostFormButtonImpl> + implements _$$AsUiComponent_PostFormButtonImplCopyWith<$Res> { + __$$AsUiComponent_PostFormButtonImplCopyWithImpl( + _$AsUiComponent_PostFormButtonImpl _value, + $Res Function(_$AsUiComponent_PostFormButtonImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? field0 = null, + }) { + return _then(_$AsUiComponent_PostFormButtonImpl( + null == field0 + ? _value.field0 + : field0 // ignore: cast_nullable_to_non_nullable + as AsUiPostFormButton, + )); + } +} + +/// @nodoc + +class _$AsUiComponent_PostFormButtonImpl extends AsUiComponent_PostFormButton { + const _$AsUiComponent_PostFormButtonImpl(this.field0) : super._(); + + @override + final AsUiPostFormButton field0; + + @override + String toString() { + return 'AsUiComponent.postFormButton(field0: $field0)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$AsUiComponent_PostFormButtonImpl && + (identical(other.field0, field0) || other.field0 == field0)); + } + + @override + int get hashCode => Object.hash(runtimeType, field0); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$AsUiComponent_PostFormButtonImplCopyWith< + _$AsUiComponent_PostFormButtonImpl> + get copyWith => __$$AsUiComponent_PostFormButtonImplCopyWithImpl< + _$AsUiComponent_PostFormButtonImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(AsUiRoot field0) root, + required TResult Function(AsUiContainer field0) container, + required TResult Function(AsUiText field0) text, + required TResult Function(AsUiMfm field0) mfm, + required TResult Function(AsUiButton field0) button, + required TResult Function(AsUiButtons field0) buttons, + required TResult Function(AsUiSwitch field0) toggleSwitch, + required TResult Function(AsUiTextarea field0) textarea, + required TResult Function(AsUiTextInput field0) textInput, + required TResult Function(AsUiNumberInput field0) numberInput, + required TResult Function(AsUiSelect field0) select, + required TResult Function(AsUiFolder field0) folder, + required TResult Function(AsUiPostFormButton field0) postFormButton, + required TResult Function(AsUiPostForm field0) postForm, + }) { + return postFormButton(field0); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(AsUiRoot field0)? root, + TResult? Function(AsUiContainer field0)? container, + TResult? Function(AsUiText field0)? text, + TResult? Function(AsUiMfm field0)? mfm, + TResult? Function(AsUiButton field0)? button, + TResult? Function(AsUiButtons field0)? buttons, + TResult? Function(AsUiSwitch field0)? toggleSwitch, + TResult? Function(AsUiTextarea field0)? textarea, + TResult? Function(AsUiTextInput field0)? textInput, + TResult? Function(AsUiNumberInput field0)? numberInput, + TResult? Function(AsUiSelect field0)? select, + TResult? Function(AsUiFolder field0)? folder, + TResult? Function(AsUiPostFormButton field0)? postFormButton, + TResult? Function(AsUiPostForm field0)? postForm, + }) { + return postFormButton?.call(field0); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(AsUiRoot field0)? root, + TResult Function(AsUiContainer field0)? container, + TResult Function(AsUiText field0)? text, + TResult Function(AsUiMfm field0)? mfm, + TResult Function(AsUiButton field0)? button, + TResult Function(AsUiButtons field0)? buttons, + TResult Function(AsUiSwitch field0)? toggleSwitch, + TResult Function(AsUiTextarea field0)? textarea, + TResult Function(AsUiTextInput field0)? textInput, + TResult Function(AsUiNumberInput field0)? numberInput, + TResult Function(AsUiSelect field0)? select, + TResult Function(AsUiFolder field0)? folder, + TResult Function(AsUiPostFormButton field0)? postFormButton, + TResult Function(AsUiPostForm field0)? postForm, + required TResult orElse(), + }) { + if (postFormButton != null) { + return postFormButton(field0); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(AsUiComponent_Root value) root, + required TResult Function(AsUiComponent_Container value) container, + required TResult Function(AsUiComponent_Text value) text, + required TResult Function(AsUiComponent_Mfm value) mfm, + required TResult Function(AsUiComponent_Button value) button, + required TResult Function(AsUiComponent_Buttons value) buttons, + required TResult Function(AsUiComponent_ToggleSwitch value) toggleSwitch, + required TResult Function(AsUiComponent_Textarea value) textarea, + required TResult Function(AsUiComponent_TextInput value) textInput, + required TResult Function(AsUiComponent_NumberInput value) numberInput, + required TResult Function(AsUiComponent_Select value) select, + required TResult Function(AsUiComponent_Folder value) folder, + required TResult Function(AsUiComponent_PostFormButton value) + postFormButton, + required TResult Function(AsUiComponent_PostForm value) postForm, + }) { + return postFormButton(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(AsUiComponent_Root value)? root, + TResult? Function(AsUiComponent_Container value)? container, + TResult? Function(AsUiComponent_Text value)? text, + TResult? Function(AsUiComponent_Mfm value)? mfm, + TResult? Function(AsUiComponent_Button value)? button, + TResult? Function(AsUiComponent_Buttons value)? buttons, + TResult? Function(AsUiComponent_ToggleSwitch value)? toggleSwitch, + TResult? Function(AsUiComponent_Textarea value)? textarea, + TResult? Function(AsUiComponent_TextInput value)? textInput, + TResult? Function(AsUiComponent_NumberInput value)? numberInput, + TResult? Function(AsUiComponent_Select value)? select, + TResult? Function(AsUiComponent_Folder value)? folder, + TResult? Function(AsUiComponent_PostFormButton value)? postFormButton, + TResult? Function(AsUiComponent_PostForm value)? postForm, + }) { + return postFormButton?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(AsUiComponent_Root value)? root, + TResult Function(AsUiComponent_Container value)? container, + TResult Function(AsUiComponent_Text value)? text, + TResult Function(AsUiComponent_Mfm value)? mfm, + TResult Function(AsUiComponent_Button value)? button, + TResult Function(AsUiComponent_Buttons value)? buttons, + TResult Function(AsUiComponent_ToggleSwitch value)? toggleSwitch, + TResult Function(AsUiComponent_Textarea value)? textarea, + TResult Function(AsUiComponent_TextInput value)? textInput, + TResult Function(AsUiComponent_NumberInput value)? numberInput, + TResult Function(AsUiComponent_Select value)? select, + TResult Function(AsUiComponent_Folder value)? folder, + TResult Function(AsUiComponent_PostFormButton value)? postFormButton, + TResult Function(AsUiComponent_PostForm value)? postForm, + required TResult orElse(), + }) { + if (postFormButton != null) { + return postFormButton(this); + } + return orElse(); + } +} + +abstract class AsUiComponent_PostFormButton extends AsUiComponent { + const factory AsUiComponent_PostFormButton(final AsUiPostFormButton field0) = + _$AsUiComponent_PostFormButtonImpl; + const AsUiComponent_PostFormButton._() : super._(); + + @override + AsUiPostFormButton get field0; + @JsonKey(ignore: true) + _$$AsUiComponent_PostFormButtonImplCopyWith< + _$AsUiComponent_PostFormButtonImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$AsUiComponent_PostFormImplCopyWith<$Res> { + factory _$$AsUiComponent_PostFormImplCopyWith( + _$AsUiComponent_PostFormImpl value, + $Res Function(_$AsUiComponent_PostFormImpl) then) = + __$$AsUiComponent_PostFormImplCopyWithImpl<$Res>; + @useResult + $Res call({AsUiPostForm field0}); +} + +/// @nodoc +class __$$AsUiComponent_PostFormImplCopyWithImpl<$Res> + extends _$AsUiComponentCopyWithImpl<$Res, _$AsUiComponent_PostFormImpl> + implements _$$AsUiComponent_PostFormImplCopyWith<$Res> { + __$$AsUiComponent_PostFormImplCopyWithImpl( + _$AsUiComponent_PostFormImpl _value, + $Res Function(_$AsUiComponent_PostFormImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? field0 = null, + }) { + return _then(_$AsUiComponent_PostFormImpl( + null == field0 + ? _value.field0 + : field0 // ignore: cast_nullable_to_non_nullable + as AsUiPostForm, + )); + } +} + +/// @nodoc + +class _$AsUiComponent_PostFormImpl extends AsUiComponent_PostForm { + const _$AsUiComponent_PostFormImpl(this.field0) : super._(); + + @override + final AsUiPostForm field0; + + @override + String toString() { + return 'AsUiComponent.postForm(field0: $field0)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$AsUiComponent_PostFormImpl && + (identical(other.field0, field0) || other.field0 == field0)); + } + + @override + int get hashCode => Object.hash(runtimeType, field0); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$AsUiComponent_PostFormImplCopyWith<_$AsUiComponent_PostFormImpl> + get copyWith => __$$AsUiComponent_PostFormImplCopyWithImpl< + _$AsUiComponent_PostFormImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(AsUiRoot field0) root, + required TResult Function(AsUiContainer field0) container, + required TResult Function(AsUiText field0) text, + required TResult Function(AsUiMfm field0) mfm, + required TResult Function(AsUiButton field0) button, + required TResult Function(AsUiButtons field0) buttons, + required TResult Function(AsUiSwitch field0) toggleSwitch, + required TResult Function(AsUiTextarea field0) textarea, + required TResult Function(AsUiTextInput field0) textInput, + required TResult Function(AsUiNumberInput field0) numberInput, + required TResult Function(AsUiSelect field0) select, + required TResult Function(AsUiFolder field0) folder, + required TResult Function(AsUiPostFormButton field0) postFormButton, + required TResult Function(AsUiPostForm field0) postForm, + }) { + return postForm(field0); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(AsUiRoot field0)? root, + TResult? Function(AsUiContainer field0)? container, + TResult? Function(AsUiText field0)? text, + TResult? Function(AsUiMfm field0)? mfm, + TResult? Function(AsUiButton field0)? button, + TResult? Function(AsUiButtons field0)? buttons, + TResult? Function(AsUiSwitch field0)? toggleSwitch, + TResult? Function(AsUiTextarea field0)? textarea, + TResult? Function(AsUiTextInput field0)? textInput, + TResult? Function(AsUiNumberInput field0)? numberInput, + TResult? Function(AsUiSelect field0)? select, + TResult? Function(AsUiFolder field0)? folder, + TResult? Function(AsUiPostFormButton field0)? postFormButton, + TResult? Function(AsUiPostForm field0)? postForm, + }) { + return postForm?.call(field0); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(AsUiRoot field0)? root, + TResult Function(AsUiContainer field0)? container, + TResult Function(AsUiText field0)? text, + TResult Function(AsUiMfm field0)? mfm, + TResult Function(AsUiButton field0)? button, + TResult Function(AsUiButtons field0)? buttons, + TResult Function(AsUiSwitch field0)? toggleSwitch, + TResult Function(AsUiTextarea field0)? textarea, + TResult Function(AsUiTextInput field0)? textInput, + TResult Function(AsUiNumberInput field0)? numberInput, + TResult Function(AsUiSelect field0)? select, + TResult Function(AsUiFolder field0)? folder, + TResult Function(AsUiPostFormButton field0)? postFormButton, + TResult Function(AsUiPostForm field0)? postForm, + required TResult orElse(), + }) { + if (postForm != null) { + return postForm(field0); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(AsUiComponent_Root value) root, + required TResult Function(AsUiComponent_Container value) container, + required TResult Function(AsUiComponent_Text value) text, + required TResult Function(AsUiComponent_Mfm value) mfm, + required TResult Function(AsUiComponent_Button value) button, + required TResult Function(AsUiComponent_Buttons value) buttons, + required TResult Function(AsUiComponent_ToggleSwitch value) toggleSwitch, + required TResult Function(AsUiComponent_Textarea value) textarea, + required TResult Function(AsUiComponent_TextInput value) textInput, + required TResult Function(AsUiComponent_NumberInput value) numberInput, + required TResult Function(AsUiComponent_Select value) select, + required TResult Function(AsUiComponent_Folder value) folder, + required TResult Function(AsUiComponent_PostFormButton value) + postFormButton, + required TResult Function(AsUiComponent_PostForm value) postForm, + }) { + return postForm(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(AsUiComponent_Root value)? root, + TResult? Function(AsUiComponent_Container value)? container, + TResult? Function(AsUiComponent_Text value)? text, + TResult? Function(AsUiComponent_Mfm value)? mfm, + TResult? Function(AsUiComponent_Button value)? button, + TResult? Function(AsUiComponent_Buttons value)? buttons, + TResult? Function(AsUiComponent_ToggleSwitch value)? toggleSwitch, + TResult? Function(AsUiComponent_Textarea value)? textarea, + TResult? Function(AsUiComponent_TextInput value)? textInput, + TResult? Function(AsUiComponent_NumberInput value)? numberInput, + TResult? Function(AsUiComponent_Select value)? select, + TResult? Function(AsUiComponent_Folder value)? folder, + TResult? Function(AsUiComponent_PostFormButton value)? postFormButton, + TResult? Function(AsUiComponent_PostForm value)? postForm, + }) { + return postForm?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(AsUiComponent_Root value)? root, + TResult Function(AsUiComponent_Container value)? container, + TResult Function(AsUiComponent_Text value)? text, + TResult Function(AsUiComponent_Mfm value)? mfm, + TResult Function(AsUiComponent_Button value)? button, + TResult Function(AsUiComponent_Buttons value)? buttons, + TResult Function(AsUiComponent_ToggleSwitch value)? toggleSwitch, + TResult Function(AsUiComponent_Textarea value)? textarea, + TResult Function(AsUiComponent_TextInput value)? textInput, + TResult Function(AsUiComponent_NumberInput value)? numberInput, + TResult Function(AsUiComponent_Select value)? select, + TResult Function(AsUiComponent_Folder value)? folder, + TResult Function(AsUiComponent_PostFormButton value)? postFormButton, + TResult Function(AsUiComponent_PostForm value)? postForm, + required TResult orElse(), + }) { + if (postForm != null) { + return postForm(this); + } + return orElse(); + } +} + +abstract class AsUiComponent_PostForm extends AsUiComponent { + const factory AsUiComponent_PostForm(final AsUiPostForm field0) = + _$AsUiComponent_PostFormImpl; + const AsUiComponent_PostForm._() : super._(); + + @override + AsUiPostForm get field0; + @JsonKey(ignore: true) + _$$AsUiComponent_PostFormImplCopyWith<_$AsUiComponent_PostFormImpl> + get copyWith => throw _privateConstructorUsedError; +} diff --git a/lib/rust/api/init.dart b/lib/rust/api/init.dart new file mode 100644 index 00000000..0e5b8e4f --- /dev/null +++ b/lib/rust/api/init.dart @@ -0,0 +1,7 @@ +// This file is automatically generated, so please do not edit it. +// Generated by `flutter_rust_bridge`@ 2.0.0-dev.37. + +// ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import + +import '../frb_generated.dart'; +import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart'; diff --git a/lib/rust/frb_generated.dart b/lib/rust/frb_generated.dart new file mode 100644 index 00000000..5e41d07d --- /dev/null +++ b/lib/rust/frb_generated.dart @@ -0,0 +1,4346 @@ +// This file is automatically generated, so please do not edit it. +// Generated by `flutter_rust_bridge`@ 2.0.0-dev.39. + +// ignore_for_file: unused_import, unused_element, unnecessary_import, duplicate_ignore, invalid_use_of_internal_member, annotate_overrides, non_constant_identifier_names, curly_braces_in_flow_control_structures, prefer_const_literals_to_create_immutables, unused_field + +import 'api/aiscript.dart'; +import 'api/aiscript/api.dart'; +import 'api/aiscript/play.dart'; +import 'api/aiscript/ui.dart'; +import 'dart:async'; +import 'dart:convert'; +import 'frb_generated.dart'; +import 'frb_generated.io.dart' if (dart.library.html) 'frb_generated.web.dart'; +import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart'; + +/// Main entrypoint of the Rust API +class RustLib extends BaseEntrypoint { + @internal + static final instance = RustLib._(); + + RustLib._(); + + /// Initialize flutter_rust_bridge + static Future init({ + RustLibApi? api, + BaseHandler? handler, + ExternalLibrary? externalLibrary, + }) async { + await instance.initImpl( + api: api, + handler: handler, + externalLibrary: externalLibrary, + ); + } + + /// Dispose flutter_rust_bridge + /// + /// The call to this function is optional, since flutter_rust_bridge (and everything else) + /// is automatically disposed when the app stops. + static void dispose() => instance.disposeImpl(); + + @override + ApiImplConstructor get apiImplConstructor => + RustLibApiImpl.new; + + @override + WireConstructor get wireConstructor => + RustLibWire.fromExternalLibrary; + + @override + Future executeRustInitializers() async {} + + @override + ExternalLibraryLoaderConfig get defaultExternalLibraryLoaderConfig => + kDefaultExternalLibraryLoaderConfig; + + @override + String get codegenVersion => '2.0.0-dev.39'; + + @override + int get rustContentHash => -463493403; + + static const kDefaultExternalLibraryLoaderConfig = + ExternalLibraryLoaderConfig( + stem: 'rust_lib_aria', + ioDirectory: 'rust/target/release/', + webPrefix: 'pkg/', + ); +} + +abstract class RustLibApi extends BaseApi { + Future crateApiAiscriptAiScriptAbort({required AiScript that}); + + Future crateApiAiscriptAiScriptExec( + {required AiScript that, required String input}); + + Future crateApiAiscriptAiScriptNew( + {required FutureOr Function(String) read, + required FutureOr Function(String) write, + AsApiLib? api, + AsUiLib? ui, + AsPlayLib? play}); + + AsApiLib crateApiAiscriptApiAsApiLibNew( + {String? userId, + String? userName, + String? userUsername, + required String customEmojis, + required String locale, + required String serverUrl, + required FutureOr Function(String, String, String) dialog, + required FutureOr Function(String, String, String) confirm, + String? token, + required FutureOr<(String, String?)> Function(String, String, String?) + api, + required FutureOr Function(String, String) save, + required FutureOr Function(String) load, + required String url, + required FutureOr Function(String) nyaize}); + + Future crateApiAiscriptUiAsUiButtonCallbackCall( + {required AsUiButtonCallback that}); + + AsUiLib crateApiAiscriptUiAsUiLibNew( + {required FutureOr Function(String, AsUiComponent) onUpdate}); + + Future crateApiAiscriptUiAsUiMfmCallbackCall( + {required AsUiMfmCallback that, required String value}); + + Future crateApiAiscriptUiAsUiNumberCallbackCall( + {required AsUiNumberCallback that, required double value}); + + Future crateApiAiscriptUiAsUiSelectCallbackCall( + {required AsUiSelectCallback that, required String value}); + + Future crateApiAiscriptUiAsUiSwitchCallbackCall( + {required AsUiSwitchCallback that, required bool value}); + + Future crateApiAiscriptUiAsUiTextInputCallbackCall( + {required AsUiTextInputCallback that, required String value}); + + Future crateApiAiscriptUiAsUiTextareaCallbackCall( + {required AsUiTextareaCallback that, required String value}); + + RustArcIncrementStrongCountFnType + get rust_arc_increment_strong_count_AiScript; + + RustArcDecrementStrongCountFnType + get rust_arc_decrement_strong_count_AiScript; + + CrossPlatformFinalizerArg get rust_arc_decrement_strong_count_AiScriptPtr; + + RustArcIncrementStrongCountFnType + get rust_arc_increment_strong_count_AsApiLib; + + RustArcDecrementStrongCountFnType + get rust_arc_decrement_strong_count_AsApiLib; + + CrossPlatformFinalizerArg get rust_arc_decrement_strong_count_AsApiLibPtr; + + RustArcIncrementStrongCountFnType + get rust_arc_increment_strong_count_AsUiButtonCallback; + + RustArcDecrementStrongCountFnType + get rust_arc_decrement_strong_count_AsUiButtonCallback; + + CrossPlatformFinalizerArg + get rust_arc_decrement_strong_count_AsUiButtonCallbackPtr; + + RustArcIncrementStrongCountFnType get rust_arc_increment_strong_count_AsUiLib; + + RustArcDecrementStrongCountFnType get rust_arc_decrement_strong_count_AsUiLib; + + CrossPlatformFinalizerArg get rust_arc_decrement_strong_count_AsUiLibPtr; + + RustArcIncrementStrongCountFnType + get rust_arc_increment_strong_count_AsUiMfmCallback; + + RustArcDecrementStrongCountFnType + get rust_arc_decrement_strong_count_AsUiMfmCallback; + + CrossPlatformFinalizerArg + get rust_arc_decrement_strong_count_AsUiMfmCallbackPtr; + + RustArcIncrementStrongCountFnType + get rust_arc_increment_strong_count_AsUiNumberCallback; + + RustArcDecrementStrongCountFnType + get rust_arc_decrement_strong_count_AsUiNumberCallback; + + CrossPlatformFinalizerArg + get rust_arc_decrement_strong_count_AsUiNumberCallbackPtr; + + RustArcIncrementStrongCountFnType + get rust_arc_increment_strong_count_AsUiSelectCallback; + + RustArcDecrementStrongCountFnType + get rust_arc_decrement_strong_count_AsUiSelectCallback; + + CrossPlatformFinalizerArg + get rust_arc_decrement_strong_count_AsUiSelectCallbackPtr; + + RustArcIncrementStrongCountFnType + get rust_arc_increment_strong_count_AsUiSwitchCallback; + + RustArcDecrementStrongCountFnType + get rust_arc_decrement_strong_count_AsUiSwitchCallback; + + CrossPlatformFinalizerArg + get rust_arc_decrement_strong_count_AsUiSwitchCallbackPtr; + + RustArcIncrementStrongCountFnType + get rust_arc_increment_strong_count_AsUiTextInputCallback; + + RustArcDecrementStrongCountFnType + get rust_arc_decrement_strong_count_AsUiTextInputCallback; + + CrossPlatformFinalizerArg + get rust_arc_decrement_strong_count_AsUiTextInputCallbackPtr; + + RustArcIncrementStrongCountFnType + get rust_arc_increment_strong_count_AsUiTextareaCallback; + + RustArcDecrementStrongCountFnType + get rust_arc_decrement_strong_count_AsUiTextareaCallback; + + CrossPlatformFinalizerArg + get rust_arc_decrement_strong_count_AsUiTextareaCallbackPtr; +} + +class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { + RustLibApiImpl({ + required super.handler, + required super.wire, + required super.generalizedFrbRustBinding, + required super.portManager, + }); + + @override + Future crateApiAiscriptAiScriptAbort({required AiScript that}) { + return handler.executeNormal(NormalTask( + callFfi: (port_) { + final serializer = SseSerializer(generalizedFrbRustBinding); + sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAiScript( + that, serializer); + pdeCallFfi(generalizedFrbRustBinding, serializer, + funcId: 1, port: port_); + }, + codec: SseCodec( + decodeSuccessData: sse_decode_unit, + decodeErrorData: null, + ), + constMeta: kCrateApiAiscriptAiScriptAbortConstMeta, + argValues: [that], + apiImpl: this, + )); + } + + TaskConstMeta get kCrateApiAiscriptAiScriptAbortConstMeta => + const TaskConstMeta( + debugName: "AiScript_abort", + argNames: ["that"], + ); + + @override + Future crateApiAiscriptAiScriptExec( + {required AiScript that, required String input}) { + return handler.executeNormal(NormalTask( + callFfi: (port_) { + final serializer = SseSerializer(generalizedFrbRustBinding); + sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAiScript( + that, serializer); + sse_encode_String(input, serializer); + pdeCallFfi(generalizedFrbRustBinding, serializer, + funcId: 2, port: port_); + }, + codec: SseCodec( + decodeSuccessData: sse_decode_unit, + decodeErrorData: sse_decode_String, + ), + constMeta: kCrateApiAiscriptAiScriptExecConstMeta, + argValues: [that, input], + apiImpl: this, + )); + } + + TaskConstMeta get kCrateApiAiscriptAiScriptExecConstMeta => + const TaskConstMeta( + debugName: "AiScript_exec", + argNames: ["that", "input"], + ); + + @override + Future crateApiAiscriptAiScriptNew( + {required FutureOr Function(String) read, + required FutureOr Function(String) write, + AsApiLib? api, + AsUiLib? ui, + AsPlayLib? play}) { + return handler.executeNormal(NormalTask( + callFfi: (port_) { + final serializer = SseSerializer(generalizedFrbRustBinding); + sse_encode_DartFn_Inputs_String_Output_String_AnyhowException( + read, serializer); + sse_encode_DartFn_Inputs_String_Output_unit_AnyhowException( + write, serializer); + sse_encode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsApiLib( + api, serializer); + sse_encode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiLib( + ui, serializer); + sse_encode_opt_box_autoadd_as_play_lib(play, serializer); + pdeCallFfi(generalizedFrbRustBinding, serializer, + funcId: 3, port: port_); + }, + codec: SseCodec( + decodeSuccessData: + sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAiScript, + decodeErrorData: null, + ), + constMeta: kCrateApiAiscriptAiScriptNewConstMeta, + argValues: [read, write, api, ui, play], + apiImpl: this, + )); + } + + TaskConstMeta get kCrateApiAiscriptAiScriptNewConstMeta => + const TaskConstMeta( + debugName: "AiScript_new", + argNames: ["read", "write", "api", "ui", "play"], + ); + + @override + AsApiLib crateApiAiscriptApiAsApiLibNew( + {String? userId, + String? userName, + String? userUsername, + required String customEmojis, + required String locale, + required String serverUrl, + required FutureOr Function(String, String, String) dialog, + required FutureOr Function(String, String, String) confirm, + String? token, + required FutureOr<(String, String?)> Function(String, String, String?) + api, + required FutureOr Function(String, String) save, + required FutureOr Function(String) load, + required String url, + required FutureOr Function(String) nyaize}) { + return handler.executeSync(SyncTask( + callFfi: () { + final serializer = SseSerializer(generalizedFrbRustBinding); + sse_encode_opt_String(userId, serializer); + sse_encode_opt_String(userName, serializer); + sse_encode_opt_String(userUsername, serializer); + sse_encode_String(customEmojis, serializer); + sse_encode_String(locale, serializer); + sse_encode_String(serverUrl, serializer); + sse_encode_DartFn_Inputs_String_String_String_Output_unit_AnyhowException( + dialog, serializer); + sse_encode_DartFn_Inputs_String_String_String_Output_bool_AnyhowException( + confirm, serializer); + sse_encode_opt_String(token, serializer); + sse_encode_DartFn_Inputs_String_String_opt_String_Output_record_string_opt_string_AnyhowException( + api, serializer); + sse_encode_DartFn_Inputs_String_String_Output_unit_AnyhowException( + save, serializer); + sse_encode_DartFn_Inputs_String_Output_String_AnyhowException( + load, serializer); + sse_encode_String(url, serializer); + sse_encode_DartFn_Inputs_String_Output_String_AnyhowException( + nyaize, serializer); + return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 4)!; + }, + codec: SseCodec( + decodeSuccessData: + sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsApiLib, + decodeErrorData: null, + ), + constMeta: kCrateApiAiscriptApiAsApiLibNewConstMeta, + argValues: [ + userId, + userName, + userUsername, + customEmojis, + locale, + serverUrl, + dialog, + confirm, + token, + api, + save, + load, + url, + nyaize + ], + apiImpl: this, + )); + } + + TaskConstMeta get kCrateApiAiscriptApiAsApiLibNewConstMeta => + const TaskConstMeta( + debugName: "AsApiLib_new", + argNames: [ + "userId", + "userName", + "userUsername", + "customEmojis", + "locale", + "serverUrl", + "dialog", + "confirm", + "token", + "api", + "save", + "load", + "url", + "nyaize" + ], + ); + + @override + Future crateApiAiscriptUiAsUiButtonCallbackCall( + {required AsUiButtonCallback that}) { + return handler.executeNormal(NormalTask( + callFfi: (port_) { + final serializer = SseSerializer(generalizedFrbRustBinding); + sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiButtonCallback( + that, serializer); + pdeCallFfi(generalizedFrbRustBinding, serializer, + funcId: 5, port: port_); + }, + codec: SseCodec( + decodeSuccessData: sse_decode_unit, + decodeErrorData: sse_decode_String, + ), + constMeta: kCrateApiAiscriptUiAsUiButtonCallbackCallConstMeta, + argValues: [that], + apiImpl: this, + )); + } + + TaskConstMeta get kCrateApiAiscriptUiAsUiButtonCallbackCallConstMeta => + const TaskConstMeta( + debugName: "AsUiButtonCallback_call", + argNames: ["that"], + ); + + @override + AsUiLib crateApiAiscriptUiAsUiLibNew( + {required FutureOr Function(String, AsUiComponent) onUpdate}) { + return handler.executeSync(SyncTask( + callFfi: () { + final serializer = SseSerializer(generalizedFrbRustBinding); + sse_encode_DartFn_Inputs_String_as_ui_component_Output_unit_AnyhowException( + onUpdate, serializer); + return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 6)!; + }, + codec: SseCodec( + decodeSuccessData: + sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiLib, + decodeErrorData: null, + ), + constMeta: kCrateApiAiscriptUiAsUiLibNewConstMeta, + argValues: [onUpdate], + apiImpl: this, + )); + } + + TaskConstMeta get kCrateApiAiscriptUiAsUiLibNewConstMeta => + const TaskConstMeta( + debugName: "AsUiLib_new", + argNames: ["onUpdate"], + ); + + @override + Future crateApiAiscriptUiAsUiMfmCallbackCall( + {required AsUiMfmCallback that, required String value}) { + return handler.executeNormal(NormalTask( + callFfi: (port_) { + final serializer = SseSerializer(generalizedFrbRustBinding); + sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiMfmCallback( + that, serializer); + sse_encode_String(value, serializer); + pdeCallFfi(generalizedFrbRustBinding, serializer, + funcId: 7, port: port_); + }, + codec: SseCodec( + decodeSuccessData: sse_decode_unit, + decodeErrorData: sse_decode_String, + ), + constMeta: kCrateApiAiscriptUiAsUiMfmCallbackCallConstMeta, + argValues: [that, value], + apiImpl: this, + )); + } + + TaskConstMeta get kCrateApiAiscriptUiAsUiMfmCallbackCallConstMeta => + const TaskConstMeta( + debugName: "AsUiMfmCallback_call", + argNames: ["that", "value"], + ); + + @override + Future crateApiAiscriptUiAsUiNumberCallbackCall( + {required AsUiNumberCallback that, required double value}) { + return handler.executeNormal(NormalTask( + callFfi: (port_) { + final serializer = SseSerializer(generalizedFrbRustBinding); + sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiNumberCallback( + that, serializer); + sse_encode_f_64(value, serializer); + pdeCallFfi(generalizedFrbRustBinding, serializer, + funcId: 8, port: port_); + }, + codec: SseCodec( + decodeSuccessData: sse_decode_unit, + decodeErrorData: sse_decode_String, + ), + constMeta: kCrateApiAiscriptUiAsUiNumberCallbackCallConstMeta, + argValues: [that, value], + apiImpl: this, + )); + } + + TaskConstMeta get kCrateApiAiscriptUiAsUiNumberCallbackCallConstMeta => + const TaskConstMeta( + debugName: "AsUiNumberCallback_call", + argNames: ["that", "value"], + ); + + @override + Future crateApiAiscriptUiAsUiSelectCallbackCall( + {required AsUiSelectCallback that, required String value}) { + return handler.executeNormal(NormalTask( + callFfi: (port_) { + final serializer = SseSerializer(generalizedFrbRustBinding); + sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSelectCallback( + that, serializer); + sse_encode_String(value, serializer); + pdeCallFfi(generalizedFrbRustBinding, serializer, + funcId: 9, port: port_); + }, + codec: SseCodec( + decodeSuccessData: sse_decode_unit, + decodeErrorData: sse_decode_String, + ), + constMeta: kCrateApiAiscriptUiAsUiSelectCallbackCallConstMeta, + argValues: [that, value], + apiImpl: this, + )); + } + + TaskConstMeta get kCrateApiAiscriptUiAsUiSelectCallbackCallConstMeta => + const TaskConstMeta( + debugName: "AsUiSelectCallback_call", + argNames: ["that", "value"], + ); + + @override + Future crateApiAiscriptUiAsUiSwitchCallbackCall( + {required AsUiSwitchCallback that, required bool value}) { + return handler.executeNormal(NormalTask( + callFfi: (port_) { + final serializer = SseSerializer(generalizedFrbRustBinding); + sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSwitchCallback( + that, serializer); + sse_encode_bool(value, serializer); + pdeCallFfi(generalizedFrbRustBinding, serializer, + funcId: 10, port: port_); + }, + codec: SseCodec( + decodeSuccessData: sse_decode_unit, + decodeErrorData: sse_decode_String, + ), + constMeta: kCrateApiAiscriptUiAsUiSwitchCallbackCallConstMeta, + argValues: [that, value], + apiImpl: this, + )); + } + + TaskConstMeta get kCrateApiAiscriptUiAsUiSwitchCallbackCallConstMeta => + const TaskConstMeta( + debugName: "AsUiSwitchCallback_call", + argNames: ["that", "value"], + ); + + @override + Future crateApiAiscriptUiAsUiTextInputCallbackCall( + {required AsUiTextInputCallback that, required String value}) { + return handler.executeNormal(NormalTask( + callFfi: (port_) { + final serializer = SseSerializer(generalizedFrbRustBinding); + sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextInputCallback( + that, serializer); + sse_encode_String(value, serializer); + pdeCallFfi(generalizedFrbRustBinding, serializer, + funcId: 11, port: port_); + }, + codec: SseCodec( + decodeSuccessData: sse_decode_unit, + decodeErrorData: sse_decode_String, + ), + constMeta: kCrateApiAiscriptUiAsUiTextInputCallbackCallConstMeta, + argValues: [that, value], + apiImpl: this, + )); + } + + TaskConstMeta get kCrateApiAiscriptUiAsUiTextInputCallbackCallConstMeta => + const TaskConstMeta( + debugName: "AsUiTextInputCallback_call", + argNames: ["that", "value"], + ); + + @override + Future crateApiAiscriptUiAsUiTextareaCallbackCall( + {required AsUiTextareaCallback that, required String value}) { + return handler.executeNormal(NormalTask( + callFfi: (port_) { + final serializer = SseSerializer(generalizedFrbRustBinding); + sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextareaCallback( + that, serializer); + sse_encode_String(value, serializer); + pdeCallFfi(generalizedFrbRustBinding, serializer, + funcId: 12, port: port_); + }, + codec: SseCodec( + decodeSuccessData: sse_decode_unit, + decodeErrorData: sse_decode_String, + ), + constMeta: kCrateApiAiscriptUiAsUiTextareaCallbackCallConstMeta, + argValues: [that, value], + apiImpl: this, + )); + } + + TaskConstMeta get kCrateApiAiscriptUiAsUiTextareaCallbackCallConstMeta => + const TaskConstMeta( + debugName: "AsUiTextareaCallback_call", + argNames: ["that", "value"], + ); + + Future Function(int, dynamic) + encode_DartFn_Inputs_String_Output_String_AnyhowException( + FutureOr Function(String) raw) { + return (callId, rawArg0) async { + final arg0 = dco_decode_String(rawArg0); + + Box? rawOutput; + Box? rawError; + try { + rawOutput = Box(await raw(arg0)); + } catch (e, s) { + rawError = Box(AnyhowException("$e\n\n$s")); + } + + final serializer = SseSerializer(generalizedFrbRustBinding); + assert((rawOutput != null) ^ (rawError != null)); + if (rawOutput != null) { + serializer.buffer.putUint8(0); + sse_encode_String(rawOutput.value, serializer); + } else { + serializer.buffer.putUint8(1); + sse_encode_AnyhowException(rawError!.value, serializer); + } + final output = serializer.intoRaw(); + + generalizedFrbRustBinding.dartFnDeliverOutput( + callId: callId, + ptr: output.ptr, + rustVecLen: output.rustVecLen, + dataLen: output.dataLen); + }; + } + + Future Function(int, dynamic) + encode_DartFn_Inputs_String_Output_unit_AnyhowException( + FutureOr Function(String) raw) { + return (callId, rawArg0) async { + final arg0 = dco_decode_String(rawArg0); + + Box? rawOutput; + Box? rawError; + try { + rawOutput = Box(await raw(arg0)); + } catch (e, s) { + rawError = Box(AnyhowException("$e\n\n$s")); + } + + final serializer = SseSerializer(generalizedFrbRustBinding); + assert((rawOutput != null) ^ (rawError != null)); + if (rawOutput != null) { + serializer.buffer.putUint8(0); + sse_encode_unit(rawOutput.value, serializer); + } else { + serializer.buffer.putUint8(1); + sse_encode_AnyhowException(rawError!.value, serializer); + } + final output = serializer.intoRaw(); + + generalizedFrbRustBinding.dartFnDeliverOutput( + callId: callId, + ptr: output.ptr, + rustVecLen: output.rustVecLen, + dataLen: output.dataLen); + }; + } + + Future Function(int, dynamic, dynamic) + encode_DartFn_Inputs_String_String_Output_unit_AnyhowException( + FutureOr Function(String, String) raw) { + return (callId, rawArg0, rawArg1) async { + final arg0 = dco_decode_String(rawArg0); + final arg1 = dco_decode_String(rawArg1); + + Box? rawOutput; + Box? rawError; + try { + rawOutput = Box(await raw(arg0, arg1)); + } catch (e, s) { + rawError = Box(AnyhowException("$e\n\n$s")); + } + + final serializer = SseSerializer(generalizedFrbRustBinding); + assert((rawOutput != null) ^ (rawError != null)); + if (rawOutput != null) { + serializer.buffer.putUint8(0); + sse_encode_unit(rawOutput.value, serializer); + } else { + serializer.buffer.putUint8(1); + sse_encode_AnyhowException(rawError!.value, serializer); + } + final output = serializer.intoRaw(); + + generalizedFrbRustBinding.dartFnDeliverOutput( + callId: callId, + ptr: output.ptr, + rustVecLen: output.rustVecLen, + dataLen: output.dataLen); + }; + } + + Future Function(int, dynamic, dynamic, dynamic) + encode_DartFn_Inputs_String_String_String_Output_bool_AnyhowException( + FutureOr Function(String, String, String) raw) { + return (callId, rawArg0, rawArg1, rawArg2) async { + final arg0 = dco_decode_String(rawArg0); + final arg1 = dco_decode_String(rawArg1); + final arg2 = dco_decode_String(rawArg2); + + Box? rawOutput; + Box? rawError; + try { + rawOutput = Box(await raw(arg0, arg1, arg2)); + } catch (e, s) { + rawError = Box(AnyhowException("$e\n\n$s")); + } + + final serializer = SseSerializer(generalizedFrbRustBinding); + assert((rawOutput != null) ^ (rawError != null)); + if (rawOutput != null) { + serializer.buffer.putUint8(0); + sse_encode_bool(rawOutput.value, serializer); + } else { + serializer.buffer.putUint8(1); + sse_encode_AnyhowException(rawError!.value, serializer); + } + final output = serializer.intoRaw(); + + generalizedFrbRustBinding.dartFnDeliverOutput( + callId: callId, + ptr: output.ptr, + rustVecLen: output.rustVecLen, + dataLen: output.dataLen); + }; + } + + Future Function(int, dynamic, dynamic, dynamic) + encode_DartFn_Inputs_String_String_String_Output_unit_AnyhowException( + FutureOr Function(String, String, String) raw) { + return (callId, rawArg0, rawArg1, rawArg2) async { + final arg0 = dco_decode_String(rawArg0); + final arg1 = dco_decode_String(rawArg1); + final arg2 = dco_decode_String(rawArg2); + + Box? rawOutput; + Box? rawError; + try { + rawOutput = Box(await raw(arg0, arg1, arg2)); + } catch (e, s) { + rawError = Box(AnyhowException("$e\n\n$s")); + } + + final serializer = SseSerializer(generalizedFrbRustBinding); + assert((rawOutput != null) ^ (rawError != null)); + if (rawOutput != null) { + serializer.buffer.putUint8(0); + sse_encode_unit(rawOutput.value, serializer); + } else { + serializer.buffer.putUint8(1); + sse_encode_AnyhowException(rawError!.value, serializer); + } + final output = serializer.intoRaw(); + + generalizedFrbRustBinding.dartFnDeliverOutput( + callId: callId, + ptr: output.ptr, + rustVecLen: output.rustVecLen, + dataLen: output.dataLen); + }; + } + + Future Function(int, dynamic, dynamic, dynamic) + encode_DartFn_Inputs_String_String_opt_String_Output_record_string_opt_string_AnyhowException( + FutureOr<(String, String?)> Function(String, String, String?) raw) { + return (callId, rawArg0, rawArg1, rawArg2) async { + final arg0 = dco_decode_String(rawArg0); + final arg1 = dco_decode_String(rawArg1); + final arg2 = dco_decode_opt_String(rawArg2); + + Box<(String, String?)>? rawOutput; + Box? rawError; + try { + rawOutput = Box(await raw(arg0, arg1, arg2)); + } catch (e, s) { + rawError = Box(AnyhowException("$e\n\n$s")); + } + + final serializer = SseSerializer(generalizedFrbRustBinding); + assert((rawOutput != null) ^ (rawError != null)); + if (rawOutput != null) { + serializer.buffer.putUint8(0); + sse_encode_record_string_opt_string(rawOutput.value, serializer); + } else { + serializer.buffer.putUint8(1); + sse_encode_AnyhowException(rawError!.value, serializer); + } + final output = serializer.intoRaw(); + + generalizedFrbRustBinding.dartFnDeliverOutput( + callId: callId, + ptr: output.ptr, + rustVecLen: output.rustVecLen, + dataLen: output.dataLen); + }; + } + + Future Function(int, dynamic, dynamic) + encode_DartFn_Inputs_String_as_ui_component_Output_unit_AnyhowException( + FutureOr Function(String, AsUiComponent) raw) { + return (callId, rawArg0, rawArg1) async { + final arg0 = dco_decode_String(rawArg0); + final arg1 = dco_decode_as_ui_component(rawArg1); + + Box? rawOutput; + Box? rawError; + try { + rawOutput = Box(await raw(arg0, arg1)); + } catch (e, s) { + rawError = Box(AnyhowException("$e\n\n$s")); + } + + final serializer = SseSerializer(generalizedFrbRustBinding); + assert((rawOutput != null) ^ (rawError != null)); + if (rawOutput != null) { + serializer.buffer.putUint8(0); + sse_encode_unit(rawOutput.value, serializer); + } else { + serializer.buffer.putUint8(1); + sse_encode_AnyhowException(rawError!.value, serializer); + } + final output = serializer.intoRaw(); + + generalizedFrbRustBinding.dartFnDeliverOutput( + callId: callId, + ptr: output.ptr, + rustVecLen: output.rustVecLen, + dataLen: output.dataLen); + }; + } + + RustArcIncrementStrongCountFnType + get rust_arc_increment_strong_count_AiScript => wire + .rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAiScript; + + RustArcDecrementStrongCountFnType + get rust_arc_decrement_strong_count_AiScript => wire + .rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAiScript; + + RustArcIncrementStrongCountFnType + get rust_arc_increment_strong_count_AsApiLib => wire + .rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsApiLib; + + RustArcDecrementStrongCountFnType + get rust_arc_decrement_strong_count_AsApiLib => wire + .rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsApiLib; + + RustArcIncrementStrongCountFnType + get rust_arc_increment_strong_count_AsUiButtonCallback => wire + .rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiButtonCallback; + + RustArcDecrementStrongCountFnType + get rust_arc_decrement_strong_count_AsUiButtonCallback => wire + .rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiButtonCallback; + + RustArcIncrementStrongCountFnType + get rust_arc_increment_strong_count_AsUiLib => wire + .rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiLib; + + RustArcDecrementStrongCountFnType + get rust_arc_decrement_strong_count_AsUiLib => wire + .rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiLib; + + RustArcIncrementStrongCountFnType + get rust_arc_increment_strong_count_AsUiMfmCallback => wire + .rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiMfmCallback; + + RustArcDecrementStrongCountFnType + get rust_arc_decrement_strong_count_AsUiMfmCallback => wire + .rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiMfmCallback; + + RustArcIncrementStrongCountFnType + get rust_arc_increment_strong_count_AsUiNumberCallback => wire + .rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiNumberCallback; + + RustArcDecrementStrongCountFnType + get rust_arc_decrement_strong_count_AsUiNumberCallback => wire + .rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiNumberCallback; + + RustArcIncrementStrongCountFnType + get rust_arc_increment_strong_count_AsUiSelectCallback => wire + .rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSelectCallback; + + RustArcDecrementStrongCountFnType + get rust_arc_decrement_strong_count_AsUiSelectCallback => wire + .rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSelectCallback; + + RustArcIncrementStrongCountFnType + get rust_arc_increment_strong_count_AsUiSwitchCallback => wire + .rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSwitchCallback; + + RustArcDecrementStrongCountFnType + get rust_arc_decrement_strong_count_AsUiSwitchCallback => wire + .rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSwitchCallback; + + RustArcIncrementStrongCountFnType + get rust_arc_increment_strong_count_AsUiTextInputCallback => wire + .rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextInputCallback; + + RustArcDecrementStrongCountFnType + get rust_arc_decrement_strong_count_AsUiTextInputCallback => wire + .rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextInputCallback; + + RustArcIncrementStrongCountFnType + get rust_arc_increment_strong_count_AsUiTextareaCallback => wire + .rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextareaCallback; + + RustArcDecrementStrongCountFnType + get rust_arc_decrement_strong_count_AsUiTextareaCallback => wire + .rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextareaCallback; + + @protected + AnyhowException dco_decode_AnyhowException(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return AnyhowException(raw as String); + } + + @protected + AiScript + dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAiScript( + dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return AiScriptImpl.frbInternalDcoDecode(raw as List); + } + + @protected + AsApiLib + dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsApiLib( + dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return AsApiLibImpl.frbInternalDcoDecode(raw as List); + } + + @protected + AsUiButtonCallback + dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiButtonCallback( + dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return AsUiButtonCallbackImpl.frbInternalDcoDecode(raw as List); + } + + @protected + AsUiLib + dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiLib( + dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return AsUiLibImpl.frbInternalDcoDecode(raw as List); + } + + @protected + AsUiMfmCallback + dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiMfmCallback( + dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return AsUiMfmCallbackImpl.frbInternalDcoDecode(raw as List); + } + + @protected + AsUiNumberCallback + dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiNumberCallback( + dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return AsUiNumberCallbackImpl.frbInternalDcoDecode(raw as List); + } + + @protected + AsUiSelectCallback + dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSelectCallback( + dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return AsUiSelectCallbackImpl.frbInternalDcoDecode(raw as List); + } + + @protected + AsUiSwitchCallback + dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSwitchCallback( + dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return AsUiSwitchCallbackImpl.frbInternalDcoDecode(raw as List); + } + + @protected + AsUiTextInputCallback + dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextInputCallback( + dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return AsUiTextInputCallbackImpl.frbInternalDcoDecode(raw as List); + } + + @protected + AsUiTextareaCallback + dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextareaCallback( + dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return AsUiTextareaCallbackImpl.frbInternalDcoDecode(raw as List); + } + + @protected + AiScript + dco_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAiScript( + dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return AiScriptImpl.frbInternalDcoDecode(raw as List); + } + + @protected + AsUiButtonCallback + dco_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiButtonCallback( + dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return AsUiButtonCallbackImpl.frbInternalDcoDecode(raw as List); + } + + @protected + AsUiMfmCallback + dco_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiMfmCallback( + dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return AsUiMfmCallbackImpl.frbInternalDcoDecode(raw as List); + } + + @protected + AsUiNumberCallback + dco_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiNumberCallback( + dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return AsUiNumberCallbackImpl.frbInternalDcoDecode(raw as List); + } + + @protected + AsUiSelectCallback + dco_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSelectCallback( + dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return AsUiSelectCallbackImpl.frbInternalDcoDecode(raw as List); + } + + @protected + AsUiSwitchCallback + dco_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSwitchCallback( + dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return AsUiSwitchCallbackImpl.frbInternalDcoDecode(raw as List); + } + + @protected + AsUiTextInputCallback + dco_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextInputCallback( + dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return AsUiTextInputCallbackImpl.frbInternalDcoDecode(raw as List); + } + + @protected + AsUiTextareaCallback + dco_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextareaCallback( + dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return AsUiTextareaCallbackImpl.frbInternalDcoDecode(raw as List); + } + + @protected + FutureOr Function(String) + dco_decode_DartFn_Inputs_String_Output_String_AnyhowException( + dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + throw UnimplementedError(''); + } + + @protected + FutureOr Function(String) + dco_decode_DartFn_Inputs_String_Output_unit_AnyhowException(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + throw UnimplementedError(''); + } + + @protected + FutureOr Function(String, String) + dco_decode_DartFn_Inputs_String_String_Output_unit_AnyhowException( + dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + throw UnimplementedError(''); + } + + @protected + FutureOr Function(String, String, String) + dco_decode_DartFn_Inputs_String_String_String_Output_bool_AnyhowException( + dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + throw UnimplementedError(''); + } + + @protected + FutureOr Function(String, String, String) + dco_decode_DartFn_Inputs_String_String_String_Output_unit_AnyhowException( + dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + throw UnimplementedError(''); + } + + @protected + FutureOr<(String, String?)> Function(String, String, String?) + dco_decode_DartFn_Inputs_String_String_opt_String_Output_record_string_opt_string_AnyhowException( + dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + throw UnimplementedError(''); + } + + @protected + FutureOr Function(String, AsUiComponent) + dco_decode_DartFn_Inputs_String_as_ui_component_Output_unit_AnyhowException( + dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + throw UnimplementedError(''); + } + + @protected + Object dco_decode_DartOpaque(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return decodeDartOpaque(raw, generalizedFrbRustBinding); + } + + @protected + AiScript + dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAiScript( + dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return AiScriptImpl.frbInternalDcoDecode(raw as List); + } + + @protected + AsApiLib + dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsApiLib( + dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return AsApiLibImpl.frbInternalDcoDecode(raw as List); + } + + @protected + AsUiButtonCallback + dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiButtonCallback( + dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return AsUiButtonCallbackImpl.frbInternalDcoDecode(raw as List); + } + + @protected + AsUiLib + dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiLib( + dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return AsUiLibImpl.frbInternalDcoDecode(raw as List); + } + + @protected + AsUiMfmCallback + dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiMfmCallback( + dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return AsUiMfmCallbackImpl.frbInternalDcoDecode(raw as List); + } + + @protected + AsUiNumberCallback + dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiNumberCallback( + dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return AsUiNumberCallbackImpl.frbInternalDcoDecode(raw as List); + } + + @protected + AsUiSelectCallback + dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSelectCallback( + dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return AsUiSelectCallbackImpl.frbInternalDcoDecode(raw as List); + } + + @protected + AsUiSwitchCallback + dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSwitchCallback( + dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return AsUiSwitchCallbackImpl.frbInternalDcoDecode(raw as List); + } + + @protected + AsUiTextInputCallback + dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextInputCallback( + dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return AsUiTextInputCallbackImpl.frbInternalDcoDecode(raw as List); + } + + @protected + AsUiTextareaCallback + dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextareaCallback( + dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return AsUiTextareaCallbackImpl.frbInternalDcoDecode(raw as List); + } + + @protected + String dco_decode_String(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return raw as String; + } + + @protected + AsPlayLib dco_decode_as_play_lib(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + final arr = raw as List; + if (arr.length != 2) + throw Exception('unexpected arr length: expect 2 but see ${arr.length}'); + return AsPlayLib( + thisId: dco_decode_String(arr[0]), + thisUrl: dco_decode_String(arr[1]), + ); + } + + @protected + AsUiButton dco_decode_as_ui_button(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + final arr = raw as List; + if (arr.length != 5) + throw Exception('unexpected arr length: expect 5 but see ${arr.length}'); + return AsUiButton( + text: dco_decode_opt_String(arr[0]), + onClick: + dco_decode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiButtonCallback( + arr[1]), + primary: dco_decode_opt_box_autoadd_bool(arr[2]), + rounded: dco_decode_opt_box_autoadd_bool(arr[3]), + disabled: dco_decode_opt_box_autoadd_bool(arr[4]), + ); + } + + @protected + AsUiButtons dco_decode_as_ui_buttons(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + final arr = raw as List; + if (arr.length != 1) + throw Exception('unexpected arr length: expect 1 but see ${arr.length}'); + return AsUiButtons( + buttons: dco_decode_opt_list_as_ui_button(arr[0]), + ); + } + + @protected + AsUiComponent dco_decode_as_ui_component(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + switch (raw[0]) { + case 0: + return AsUiComponent_Root( + dco_decode_box_autoadd_as_ui_root(raw[1]), + ); + case 1: + return AsUiComponent_Container( + dco_decode_box_autoadd_as_ui_container(raw[1]), + ); + case 2: + return AsUiComponent_Text( + dco_decode_box_autoadd_as_ui_text(raw[1]), + ); + case 3: + return AsUiComponent_Mfm( + dco_decode_box_autoadd_as_ui_mfm(raw[1]), + ); + case 4: + return AsUiComponent_Button( + dco_decode_box_autoadd_as_ui_button(raw[1]), + ); + case 5: + return AsUiComponent_Buttons( + dco_decode_box_autoadd_as_ui_buttons(raw[1]), + ); + case 6: + return AsUiComponent_ToggleSwitch( + dco_decode_box_autoadd_as_ui_switch(raw[1]), + ); + case 7: + return AsUiComponent_Textarea( + dco_decode_box_autoadd_as_ui_textarea(raw[1]), + ); + case 8: + return AsUiComponent_TextInput( + dco_decode_box_autoadd_as_ui_text_input(raw[1]), + ); + case 9: + return AsUiComponent_NumberInput( + dco_decode_box_autoadd_as_ui_number_input(raw[1]), + ); + case 10: + return AsUiComponent_Select( + dco_decode_box_autoadd_as_ui_select(raw[1]), + ); + case 11: + return AsUiComponent_Folder( + dco_decode_box_autoadd_as_ui_folder(raw[1]), + ); + case 12: + return AsUiComponent_PostFormButton( + dco_decode_box_autoadd_as_ui_post_form_button(raw[1]), + ); + case 13: + return AsUiComponent_PostForm( + dco_decode_box_autoadd_as_ui_post_form(raw[1]), + ); + default: + throw Exception("unreachable"); + } + } + + @protected + AsUiContainer dco_decode_as_ui_container(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + final arr = raw as List; + if (arr.length != 10) + throw Exception('unexpected arr length: expect 10 but see ${arr.length}'); + return AsUiContainer( + children: dco_decode_opt_list_String(arr[0]), + align: dco_decode_opt_String(arr[1]), + bgColor: dco_decode_opt_String(arr[2]), + fgColor: dco_decode_opt_String(arr[3]), + font: dco_decode_opt_String(arr[4]), + borderWidth: dco_decode_opt_box_autoadd_f_64(arr[5]), + borderColor: dco_decode_opt_String(arr[6]), + padding: dco_decode_opt_box_autoadd_f_64(arr[7]), + rounded: dco_decode_opt_box_autoadd_bool(arr[8]), + hidden: dco_decode_opt_box_autoadd_bool(arr[9]), + ); + } + + @protected + AsUiFolder dco_decode_as_ui_folder(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + final arr = raw as List; + if (arr.length != 3) + throw Exception('unexpected arr length: expect 3 but see ${arr.length}'); + return AsUiFolder( + children: dco_decode_opt_list_String(arr[0]), + title: dco_decode_opt_String(arr[1]), + opened: dco_decode_opt_box_autoadd_bool(arr[2]), + ); + } + + @protected + AsUiMfm dco_decode_as_ui_mfm(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + final arr = raw as List; + if (arr.length != 6) + throw Exception('unexpected arr length: expect 6 but see ${arr.length}'); + return AsUiMfm( + text: dco_decode_opt_String(arr[0]), + size: dco_decode_opt_box_autoadd_f_64(arr[1]), + bold: dco_decode_opt_box_autoadd_bool(arr[2]), + color: dco_decode_opt_String(arr[3]), + font: dco_decode_opt_String(arr[4]), + onClickEv: + dco_decode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiMfmCallback( + arr[5]), + ); + } + + @protected + AsUiNumberInput dco_decode_as_ui_number_input(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + final arr = raw as List; + if (arr.length != 4) + throw Exception('unexpected arr length: expect 4 but see ${arr.length}'); + return AsUiNumberInput( + onInput: + dco_decode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiNumberCallback( + arr[0]), + defaultValue: dco_decode_opt_box_autoadd_f_64(arr[1]), + label: dco_decode_opt_String(arr[2]), + caption: dco_decode_opt_String(arr[3]), + ); + } + + @protected + AsUiPostForm dco_decode_as_ui_post_form(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + final arr = raw as List; + if (arr.length != 1) + throw Exception('unexpected arr length: expect 1 but see ${arr.length}'); + return AsUiPostForm( + form: dco_decode_opt_box_autoadd_post_form_props_for_as_ui(arr[0]), + ); + } + + @protected + AsUiPostFormButton dco_decode_as_ui_post_form_button(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + final arr = raw as List; + if (arr.length != 4) + throw Exception('unexpected arr length: expect 4 but see ${arr.length}'); + return AsUiPostFormButton( + text: dco_decode_opt_String(arr[0]), + primary: dco_decode_opt_box_autoadd_bool(arr[1]), + rounded: dco_decode_opt_box_autoadd_bool(arr[2]), + form: dco_decode_opt_box_autoadd_post_form_props_for_as_ui(arr[3]), + ); + } + + @protected + AsUiRoot dco_decode_as_ui_root(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + final arr = raw as List; + if (arr.length != 1) + throw Exception('unexpected arr length: expect 1 but see ${arr.length}'); + return AsUiRoot( + children: dco_decode_list_String(arr[0]), + ); + } + + @protected + AsUiSelect dco_decode_as_ui_select(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + final arr = raw as List; + if (arr.length != 5) + throw Exception('unexpected arr length: expect 5 but see ${arr.length}'); + return AsUiSelect( + items: dco_decode_opt_list_record_string_string(arr[0]), + onChange: + dco_decode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSelectCallback( + arr[1]), + defaultValue: dco_decode_opt_String(arr[2]), + label: dco_decode_opt_String(arr[3]), + caption: dco_decode_opt_String(arr[4]), + ); + } + + @protected + AsUiSwitch dco_decode_as_ui_switch(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + final arr = raw as List; + if (arr.length != 4) + throw Exception('unexpected arr length: expect 4 but see ${arr.length}'); + return AsUiSwitch( + onChange: + dco_decode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSwitchCallback( + arr[0]), + defaultValue: dco_decode_opt_box_autoadd_bool(arr[1]), + label: dco_decode_opt_String(arr[2]), + caption: dco_decode_opt_String(arr[3]), + ); + } + + @protected + AsUiText dco_decode_as_ui_text(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + final arr = raw as List; + if (arr.length != 5) + throw Exception('unexpected arr length: expect 5 but see ${arr.length}'); + return AsUiText( + text: dco_decode_opt_String(arr[0]), + size: dco_decode_opt_box_autoadd_f_64(arr[1]), + bold: dco_decode_opt_box_autoadd_bool(arr[2]), + color: dco_decode_opt_String(arr[3]), + font: dco_decode_opt_String(arr[4]), + ); + } + + @protected + AsUiTextInput dco_decode_as_ui_text_input(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + final arr = raw as List; + if (arr.length != 4) + throw Exception('unexpected arr length: expect 4 but see ${arr.length}'); + return AsUiTextInput( + onInput: + dco_decode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextInputCallback( + arr[0]), + defaultValue: dco_decode_opt_String(arr[1]), + label: dco_decode_opt_String(arr[2]), + caption: dco_decode_opt_String(arr[3]), + ); + } + + @protected + AsUiTextarea dco_decode_as_ui_textarea(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + final arr = raw as List; + if (arr.length != 4) + throw Exception('unexpected arr length: expect 4 but see ${arr.length}'); + return AsUiTextarea( + onInput: + dco_decode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextareaCallback( + arr[0]), + defaultValue: dco_decode_opt_String(arr[1]), + label: dco_decode_opt_String(arr[2]), + caption: dco_decode_opt_String(arr[3]), + ); + } + + @protected + bool dco_decode_bool(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return raw as bool; + } + + @protected + AsApiLib + dco_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsApiLib( + dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsApiLib( + raw); + } + + @protected + AsUiButtonCallback + dco_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiButtonCallback( + dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiButtonCallback( + raw); + } + + @protected + AsUiLib + dco_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiLib( + dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiLib( + raw); + } + + @protected + AsUiMfmCallback + dco_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiMfmCallback( + dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiMfmCallback( + raw); + } + + @protected + AsUiNumberCallback + dco_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiNumberCallback( + dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiNumberCallback( + raw); + } + + @protected + AsUiSelectCallback + dco_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSelectCallback( + dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSelectCallback( + raw); + } + + @protected + AsUiSwitchCallback + dco_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSwitchCallback( + dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSwitchCallback( + raw); + } + + @protected + AsUiTextInputCallback + dco_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextInputCallback( + dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextInputCallback( + raw); + } + + @protected + AsUiTextareaCallback + dco_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextareaCallback( + dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextareaCallback( + raw); + } + + @protected + AsPlayLib dco_decode_box_autoadd_as_play_lib(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return dco_decode_as_play_lib(raw); + } + + @protected + AsUiButton dco_decode_box_autoadd_as_ui_button(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return dco_decode_as_ui_button(raw); + } + + @protected + AsUiButtons dco_decode_box_autoadd_as_ui_buttons(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return dco_decode_as_ui_buttons(raw); + } + + @protected + AsUiContainer dco_decode_box_autoadd_as_ui_container(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return dco_decode_as_ui_container(raw); + } + + @protected + AsUiFolder dco_decode_box_autoadd_as_ui_folder(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return dco_decode_as_ui_folder(raw); + } + + @protected + AsUiMfm dco_decode_box_autoadd_as_ui_mfm(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return dco_decode_as_ui_mfm(raw); + } + + @protected + AsUiNumberInput dco_decode_box_autoadd_as_ui_number_input(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return dco_decode_as_ui_number_input(raw); + } + + @protected + AsUiPostForm dco_decode_box_autoadd_as_ui_post_form(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return dco_decode_as_ui_post_form(raw); + } + + @protected + AsUiPostFormButton dco_decode_box_autoadd_as_ui_post_form_button( + dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return dco_decode_as_ui_post_form_button(raw); + } + + @protected + AsUiRoot dco_decode_box_autoadd_as_ui_root(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return dco_decode_as_ui_root(raw); + } + + @protected + AsUiSelect dco_decode_box_autoadd_as_ui_select(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return dco_decode_as_ui_select(raw); + } + + @protected + AsUiSwitch dco_decode_box_autoadd_as_ui_switch(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return dco_decode_as_ui_switch(raw); + } + + @protected + AsUiText dco_decode_box_autoadd_as_ui_text(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return dco_decode_as_ui_text(raw); + } + + @protected + AsUiTextInput dco_decode_box_autoadd_as_ui_text_input(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return dco_decode_as_ui_text_input(raw); + } + + @protected + AsUiTextarea dco_decode_box_autoadd_as_ui_textarea(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return dco_decode_as_ui_textarea(raw); + } + + @protected + bool dco_decode_box_autoadd_bool(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return raw as bool; + } + + @protected + double dco_decode_box_autoadd_f_64(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return raw as double; + } + + @protected + PostFormPropsForAsUi dco_decode_box_autoadd_post_form_props_for_as_ui( + dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return dco_decode_post_form_props_for_as_ui(raw); + } + + @protected + double dco_decode_f_64(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return raw as double; + } + + @protected + List dco_decode_list_String(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return (raw as List).map(dco_decode_String).toList(); + } + + @protected + List dco_decode_list_as_ui_button(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return (raw as List).map(dco_decode_as_ui_button).toList(); + } + + @protected + Uint8List dco_decode_list_prim_u_8_strict(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return raw as Uint8List; + } + + @protected + List<(String, String)> dco_decode_list_record_string_string(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return (raw as List).map(dco_decode_record_string_string).toList(); + } + + @protected + String? dco_decode_opt_String(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return raw == null ? null : dco_decode_String(raw); + } + + @protected + AsApiLib? + dco_decode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsApiLib( + dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return raw == null + ? null + : dco_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsApiLib( + raw); + } + + @protected + AsUiButtonCallback? + dco_decode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiButtonCallback( + dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return raw == null + ? null + : dco_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiButtonCallback( + raw); + } + + @protected + AsUiLib? + dco_decode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiLib( + dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return raw == null + ? null + : dco_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiLib( + raw); + } + + @protected + AsUiMfmCallback? + dco_decode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiMfmCallback( + dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return raw == null + ? null + : dco_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiMfmCallback( + raw); + } + + @protected + AsUiNumberCallback? + dco_decode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiNumberCallback( + dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return raw == null + ? null + : dco_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiNumberCallback( + raw); + } + + @protected + AsUiSelectCallback? + dco_decode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSelectCallback( + dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return raw == null + ? null + : dco_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSelectCallback( + raw); + } + + @protected + AsUiSwitchCallback? + dco_decode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSwitchCallback( + dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return raw == null + ? null + : dco_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSwitchCallback( + raw); + } + + @protected + AsUiTextInputCallback? + dco_decode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextInputCallback( + dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return raw == null + ? null + : dco_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextInputCallback( + raw); + } + + @protected + AsUiTextareaCallback? + dco_decode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextareaCallback( + dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return raw == null + ? null + : dco_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextareaCallback( + raw); + } + + @protected + AsPlayLib? dco_decode_opt_box_autoadd_as_play_lib(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return raw == null ? null : dco_decode_box_autoadd_as_play_lib(raw); + } + + @protected + bool? dco_decode_opt_box_autoadd_bool(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return raw == null ? null : dco_decode_box_autoadd_bool(raw); + } + + @protected + double? dco_decode_opt_box_autoadd_f_64(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return raw == null ? null : dco_decode_box_autoadd_f_64(raw); + } + + @protected + PostFormPropsForAsUi? dco_decode_opt_box_autoadd_post_form_props_for_as_ui( + dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return raw == null + ? null + : dco_decode_box_autoadd_post_form_props_for_as_ui(raw); + } + + @protected + List? dco_decode_opt_list_String(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return raw == null ? null : dco_decode_list_String(raw); + } + + @protected + List? dco_decode_opt_list_as_ui_button(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return raw == null ? null : dco_decode_list_as_ui_button(raw); + } + + @protected + List<(String, String)>? dco_decode_opt_list_record_string_string( + dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return raw == null ? null : dco_decode_list_record_string_string(raw); + } + + @protected + PostFormPropsForAsUi dco_decode_post_form_props_for_as_ui(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + final arr = raw as List; + if (arr.length != 4) + throw Exception('unexpected arr length: expect 4 but see ${arr.length}'); + return PostFormPropsForAsUi( + text: dco_decode_String(arr[0]), + cw: dco_decode_opt_String(arr[1]), + visibility: dco_decode_opt_String(arr[2]), + localOnly: dco_decode_opt_box_autoadd_bool(arr[3]), + ); + } + + @protected + (String, String?) dco_decode_record_string_opt_string(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + final arr = raw as List; + if (arr.length != 2) { + throw Exception('Expected 2 elements, got ${arr.length}'); + } + return ( + dco_decode_String(arr[0]), + dco_decode_opt_String(arr[1]), + ); + } + + @protected + (String, String) dco_decode_record_string_string(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + final arr = raw as List; + if (arr.length != 2) { + throw Exception('Expected 2 elements, got ${arr.length}'); + } + return ( + dco_decode_String(arr[0]), + dco_decode_String(arr[1]), + ); + } + + @protected + int dco_decode_u_8(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return raw as int; + } + + @protected + void dco_decode_unit(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return; + } + + @protected + BigInt dco_decode_usize(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return dcoDecodeU64(raw); + } + + @protected + AnyhowException sse_decode_AnyhowException(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + var inner = sse_decode_String(deserializer); + return AnyhowException(inner); + } + + @protected + AiScript + sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAiScript( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return AiScriptImpl.frbInternalSseDecode( + sse_decode_usize(deserializer), sse_decode_i_32(deserializer)); + } + + @protected + AsApiLib + sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsApiLib( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return AsApiLibImpl.frbInternalSseDecode( + sse_decode_usize(deserializer), sse_decode_i_32(deserializer)); + } + + @protected + AsUiButtonCallback + sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiButtonCallback( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return AsUiButtonCallbackImpl.frbInternalSseDecode( + sse_decode_usize(deserializer), sse_decode_i_32(deserializer)); + } + + @protected + AsUiLib + sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiLib( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return AsUiLibImpl.frbInternalSseDecode( + sse_decode_usize(deserializer), sse_decode_i_32(deserializer)); + } + + @protected + AsUiMfmCallback + sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiMfmCallback( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return AsUiMfmCallbackImpl.frbInternalSseDecode( + sse_decode_usize(deserializer), sse_decode_i_32(deserializer)); + } + + @protected + AsUiNumberCallback + sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiNumberCallback( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return AsUiNumberCallbackImpl.frbInternalSseDecode( + sse_decode_usize(deserializer), sse_decode_i_32(deserializer)); + } + + @protected + AsUiSelectCallback + sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSelectCallback( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return AsUiSelectCallbackImpl.frbInternalSseDecode( + sse_decode_usize(deserializer), sse_decode_i_32(deserializer)); + } + + @protected + AsUiSwitchCallback + sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSwitchCallback( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return AsUiSwitchCallbackImpl.frbInternalSseDecode( + sse_decode_usize(deserializer), sse_decode_i_32(deserializer)); + } + + @protected + AsUiTextInputCallback + sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextInputCallback( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return AsUiTextInputCallbackImpl.frbInternalSseDecode( + sse_decode_usize(deserializer), sse_decode_i_32(deserializer)); + } + + @protected + AsUiTextareaCallback + sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextareaCallback( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return AsUiTextareaCallbackImpl.frbInternalSseDecode( + sse_decode_usize(deserializer), sse_decode_i_32(deserializer)); + } + + @protected + AiScript + sse_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAiScript( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return AiScriptImpl.frbInternalSseDecode( + sse_decode_usize(deserializer), sse_decode_i_32(deserializer)); + } + + @protected + AsUiButtonCallback + sse_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiButtonCallback( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return AsUiButtonCallbackImpl.frbInternalSseDecode( + sse_decode_usize(deserializer), sse_decode_i_32(deserializer)); + } + + @protected + AsUiMfmCallback + sse_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiMfmCallback( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return AsUiMfmCallbackImpl.frbInternalSseDecode( + sse_decode_usize(deserializer), sse_decode_i_32(deserializer)); + } + + @protected + AsUiNumberCallback + sse_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiNumberCallback( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return AsUiNumberCallbackImpl.frbInternalSseDecode( + sse_decode_usize(deserializer), sse_decode_i_32(deserializer)); + } + + @protected + AsUiSelectCallback + sse_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSelectCallback( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return AsUiSelectCallbackImpl.frbInternalSseDecode( + sse_decode_usize(deserializer), sse_decode_i_32(deserializer)); + } + + @protected + AsUiSwitchCallback + sse_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSwitchCallback( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return AsUiSwitchCallbackImpl.frbInternalSseDecode( + sse_decode_usize(deserializer), sse_decode_i_32(deserializer)); + } + + @protected + AsUiTextInputCallback + sse_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextInputCallback( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return AsUiTextInputCallbackImpl.frbInternalSseDecode( + sse_decode_usize(deserializer), sse_decode_i_32(deserializer)); + } + + @protected + AsUiTextareaCallback + sse_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextareaCallback( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return AsUiTextareaCallbackImpl.frbInternalSseDecode( + sse_decode_usize(deserializer), sse_decode_i_32(deserializer)); + } + + @protected + Object sse_decode_DartOpaque(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + var inner = sse_decode_usize(deserializer); + return decodeDartOpaque(inner, generalizedFrbRustBinding); + } + + @protected + AiScript + sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAiScript( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return AiScriptImpl.frbInternalSseDecode( + sse_decode_usize(deserializer), sse_decode_i_32(deserializer)); + } + + @protected + AsApiLib + sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsApiLib( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return AsApiLibImpl.frbInternalSseDecode( + sse_decode_usize(deserializer), sse_decode_i_32(deserializer)); + } + + @protected + AsUiButtonCallback + sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiButtonCallback( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return AsUiButtonCallbackImpl.frbInternalSseDecode( + sse_decode_usize(deserializer), sse_decode_i_32(deserializer)); + } + + @protected + AsUiLib + sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiLib( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return AsUiLibImpl.frbInternalSseDecode( + sse_decode_usize(deserializer), sse_decode_i_32(deserializer)); + } + + @protected + AsUiMfmCallback + sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiMfmCallback( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return AsUiMfmCallbackImpl.frbInternalSseDecode( + sse_decode_usize(deserializer), sse_decode_i_32(deserializer)); + } + + @protected + AsUiNumberCallback + sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiNumberCallback( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return AsUiNumberCallbackImpl.frbInternalSseDecode( + sse_decode_usize(deserializer), sse_decode_i_32(deserializer)); + } + + @protected + AsUiSelectCallback + sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSelectCallback( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return AsUiSelectCallbackImpl.frbInternalSseDecode( + sse_decode_usize(deserializer), sse_decode_i_32(deserializer)); + } + + @protected + AsUiSwitchCallback + sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSwitchCallback( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return AsUiSwitchCallbackImpl.frbInternalSseDecode( + sse_decode_usize(deserializer), sse_decode_i_32(deserializer)); + } + + @protected + AsUiTextInputCallback + sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextInputCallback( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return AsUiTextInputCallbackImpl.frbInternalSseDecode( + sse_decode_usize(deserializer), sse_decode_i_32(deserializer)); + } + + @protected + AsUiTextareaCallback + sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextareaCallback( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return AsUiTextareaCallbackImpl.frbInternalSseDecode( + sse_decode_usize(deserializer), sse_decode_i_32(deserializer)); + } + + @protected + String sse_decode_String(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + var inner = sse_decode_list_prim_u_8_strict(deserializer); + return utf8.decoder.convert(inner); + } + + @protected + AsPlayLib sse_decode_as_play_lib(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + var var_thisId = sse_decode_String(deserializer); + var var_thisUrl = sse_decode_String(deserializer); + return AsPlayLib(thisId: var_thisId, thisUrl: var_thisUrl); + } + + @protected + AsUiButton sse_decode_as_ui_button(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + var var_text = sse_decode_opt_String(deserializer); + var var_onClick = + sse_decode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiButtonCallback( + deserializer); + var var_primary = sse_decode_opt_box_autoadd_bool(deserializer); + var var_rounded = sse_decode_opt_box_autoadd_bool(deserializer); + var var_disabled = sse_decode_opt_box_autoadd_bool(deserializer); + return AsUiButton( + text: var_text, + onClick: var_onClick, + primary: var_primary, + rounded: var_rounded, + disabled: var_disabled); + } + + @protected + AsUiButtons sse_decode_as_ui_buttons(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + var var_buttons = sse_decode_opt_list_as_ui_button(deserializer); + return AsUiButtons(buttons: var_buttons); + } + + @protected + AsUiComponent sse_decode_as_ui_component(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + + var tag_ = sse_decode_i_32(deserializer); + switch (tag_) { + case 0: + var var_field0 = sse_decode_box_autoadd_as_ui_root(deserializer); + return AsUiComponent_Root(var_field0); + case 1: + var var_field0 = sse_decode_box_autoadd_as_ui_container(deserializer); + return AsUiComponent_Container(var_field0); + case 2: + var var_field0 = sse_decode_box_autoadd_as_ui_text(deserializer); + return AsUiComponent_Text(var_field0); + case 3: + var var_field0 = sse_decode_box_autoadd_as_ui_mfm(deserializer); + return AsUiComponent_Mfm(var_field0); + case 4: + var var_field0 = sse_decode_box_autoadd_as_ui_button(deserializer); + return AsUiComponent_Button(var_field0); + case 5: + var var_field0 = sse_decode_box_autoadd_as_ui_buttons(deserializer); + return AsUiComponent_Buttons(var_field0); + case 6: + var var_field0 = sse_decode_box_autoadd_as_ui_switch(deserializer); + return AsUiComponent_ToggleSwitch(var_field0); + case 7: + var var_field0 = sse_decode_box_autoadd_as_ui_textarea(deserializer); + return AsUiComponent_Textarea(var_field0); + case 8: + var var_field0 = sse_decode_box_autoadd_as_ui_text_input(deserializer); + return AsUiComponent_TextInput(var_field0); + case 9: + var var_field0 = + sse_decode_box_autoadd_as_ui_number_input(deserializer); + return AsUiComponent_NumberInput(var_field0); + case 10: + var var_field0 = sse_decode_box_autoadd_as_ui_select(deserializer); + return AsUiComponent_Select(var_field0); + case 11: + var var_field0 = sse_decode_box_autoadd_as_ui_folder(deserializer); + return AsUiComponent_Folder(var_field0); + case 12: + var var_field0 = + sse_decode_box_autoadd_as_ui_post_form_button(deserializer); + return AsUiComponent_PostFormButton(var_field0); + case 13: + var var_field0 = sse_decode_box_autoadd_as_ui_post_form(deserializer); + return AsUiComponent_PostForm(var_field0); + default: + throw UnimplementedError(''); + } + } + + @protected + AsUiContainer sse_decode_as_ui_container(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + var var_children = sse_decode_opt_list_String(deserializer); + var var_align = sse_decode_opt_String(deserializer); + var var_bgColor = sse_decode_opt_String(deserializer); + var var_fgColor = sse_decode_opt_String(deserializer); + var var_font = sse_decode_opt_String(deserializer); + var var_borderWidth = sse_decode_opt_box_autoadd_f_64(deserializer); + var var_borderColor = sse_decode_opt_String(deserializer); + var var_padding = sse_decode_opt_box_autoadd_f_64(deserializer); + var var_rounded = sse_decode_opt_box_autoadd_bool(deserializer); + var var_hidden = sse_decode_opt_box_autoadd_bool(deserializer); + return AsUiContainer( + children: var_children, + align: var_align, + bgColor: var_bgColor, + fgColor: var_fgColor, + font: var_font, + borderWidth: var_borderWidth, + borderColor: var_borderColor, + padding: var_padding, + rounded: var_rounded, + hidden: var_hidden); + } + + @protected + AsUiFolder sse_decode_as_ui_folder(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + var var_children = sse_decode_opt_list_String(deserializer); + var var_title = sse_decode_opt_String(deserializer); + var var_opened = sse_decode_opt_box_autoadd_bool(deserializer); + return AsUiFolder( + children: var_children, title: var_title, opened: var_opened); + } + + @protected + AsUiMfm sse_decode_as_ui_mfm(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + var var_text = sse_decode_opt_String(deserializer); + var var_size = sse_decode_opt_box_autoadd_f_64(deserializer); + var var_bold = sse_decode_opt_box_autoadd_bool(deserializer); + var var_color = sse_decode_opt_String(deserializer); + var var_font = sse_decode_opt_String(deserializer); + var var_onClickEv = + sse_decode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiMfmCallback( + deserializer); + return AsUiMfm( + text: var_text, + size: var_size, + bold: var_bold, + color: var_color, + font: var_font, + onClickEv: var_onClickEv); + } + + @protected + AsUiNumberInput sse_decode_as_ui_number_input(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + var var_onInput = + sse_decode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiNumberCallback( + deserializer); + var var_defaultValue = sse_decode_opt_box_autoadd_f_64(deserializer); + var var_label = sse_decode_opt_String(deserializer); + var var_caption = sse_decode_opt_String(deserializer); + return AsUiNumberInput( + onInput: var_onInput, + defaultValue: var_defaultValue, + label: var_label, + caption: var_caption); + } + + @protected + AsUiPostForm sse_decode_as_ui_post_form(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + var var_form = + sse_decode_opt_box_autoadd_post_form_props_for_as_ui(deserializer); + return AsUiPostForm(form: var_form); + } + + @protected + AsUiPostFormButton sse_decode_as_ui_post_form_button( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + var var_text = sse_decode_opt_String(deserializer); + var var_primary = sse_decode_opt_box_autoadd_bool(deserializer); + var var_rounded = sse_decode_opt_box_autoadd_bool(deserializer); + var var_form = + sse_decode_opt_box_autoadd_post_form_props_for_as_ui(deserializer); + return AsUiPostFormButton( + text: var_text, + primary: var_primary, + rounded: var_rounded, + form: var_form); + } + + @protected + AsUiRoot sse_decode_as_ui_root(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + var var_children = sse_decode_list_String(deserializer); + return AsUiRoot(children: var_children); + } + + @protected + AsUiSelect sse_decode_as_ui_select(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + var var_items = sse_decode_opt_list_record_string_string(deserializer); + var var_onChange = + sse_decode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSelectCallback( + deserializer); + var var_defaultValue = sse_decode_opt_String(deserializer); + var var_label = sse_decode_opt_String(deserializer); + var var_caption = sse_decode_opt_String(deserializer); + return AsUiSelect( + items: var_items, + onChange: var_onChange, + defaultValue: var_defaultValue, + label: var_label, + caption: var_caption); + } + + @protected + AsUiSwitch sse_decode_as_ui_switch(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + var var_onChange = + sse_decode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSwitchCallback( + deserializer); + var var_defaultValue = sse_decode_opt_box_autoadd_bool(deserializer); + var var_label = sse_decode_opt_String(deserializer); + var var_caption = sse_decode_opt_String(deserializer); + return AsUiSwitch( + onChange: var_onChange, + defaultValue: var_defaultValue, + label: var_label, + caption: var_caption); + } + + @protected + AsUiText sse_decode_as_ui_text(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + var var_text = sse_decode_opt_String(deserializer); + var var_size = sse_decode_opt_box_autoadd_f_64(deserializer); + var var_bold = sse_decode_opt_box_autoadd_bool(deserializer); + var var_color = sse_decode_opt_String(deserializer); + var var_font = sse_decode_opt_String(deserializer); + return AsUiText( + text: var_text, + size: var_size, + bold: var_bold, + color: var_color, + font: var_font); + } + + @protected + AsUiTextInput sse_decode_as_ui_text_input(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + var var_onInput = + sse_decode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextInputCallback( + deserializer); + var var_defaultValue = sse_decode_opt_String(deserializer); + var var_label = sse_decode_opt_String(deserializer); + var var_caption = sse_decode_opt_String(deserializer); + return AsUiTextInput( + onInput: var_onInput, + defaultValue: var_defaultValue, + label: var_label, + caption: var_caption); + } + + @protected + AsUiTextarea sse_decode_as_ui_textarea(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + var var_onInput = + sse_decode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextareaCallback( + deserializer); + var var_defaultValue = sse_decode_opt_String(deserializer); + var var_label = sse_decode_opt_String(deserializer); + var var_caption = sse_decode_opt_String(deserializer); + return AsUiTextarea( + onInput: var_onInput, + defaultValue: var_defaultValue, + label: var_label, + caption: var_caption); + } + + @protected + bool sse_decode_bool(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return deserializer.buffer.getUint8() != 0; + } + + @protected + AsApiLib + sse_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsApiLib( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return (sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsApiLib( + deserializer)); + } + + @protected + AsUiButtonCallback + sse_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiButtonCallback( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return (sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiButtonCallback( + deserializer)); + } + + @protected + AsUiLib + sse_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiLib( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return (sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiLib( + deserializer)); + } + + @protected + AsUiMfmCallback + sse_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiMfmCallback( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return (sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiMfmCallback( + deserializer)); + } + + @protected + AsUiNumberCallback + sse_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiNumberCallback( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return (sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiNumberCallback( + deserializer)); + } + + @protected + AsUiSelectCallback + sse_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSelectCallback( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return (sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSelectCallback( + deserializer)); + } + + @protected + AsUiSwitchCallback + sse_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSwitchCallback( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return (sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSwitchCallback( + deserializer)); + } + + @protected + AsUiTextInputCallback + sse_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextInputCallback( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return (sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextInputCallback( + deserializer)); + } + + @protected + AsUiTextareaCallback + sse_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextareaCallback( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return (sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextareaCallback( + deserializer)); + } + + @protected + AsPlayLib sse_decode_box_autoadd_as_play_lib(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return (sse_decode_as_play_lib(deserializer)); + } + + @protected + AsUiButton sse_decode_box_autoadd_as_ui_button(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return (sse_decode_as_ui_button(deserializer)); + } + + @protected + AsUiButtons sse_decode_box_autoadd_as_ui_buttons( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return (sse_decode_as_ui_buttons(deserializer)); + } + + @protected + AsUiContainer sse_decode_box_autoadd_as_ui_container( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return (sse_decode_as_ui_container(deserializer)); + } + + @protected + AsUiFolder sse_decode_box_autoadd_as_ui_folder(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return (sse_decode_as_ui_folder(deserializer)); + } + + @protected + AsUiMfm sse_decode_box_autoadd_as_ui_mfm(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return (sse_decode_as_ui_mfm(deserializer)); + } + + @protected + AsUiNumberInput sse_decode_box_autoadd_as_ui_number_input( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return (sse_decode_as_ui_number_input(deserializer)); + } + + @protected + AsUiPostForm sse_decode_box_autoadd_as_ui_post_form( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return (sse_decode_as_ui_post_form(deserializer)); + } + + @protected + AsUiPostFormButton sse_decode_box_autoadd_as_ui_post_form_button( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return (sse_decode_as_ui_post_form_button(deserializer)); + } + + @protected + AsUiRoot sse_decode_box_autoadd_as_ui_root(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return (sse_decode_as_ui_root(deserializer)); + } + + @protected + AsUiSelect sse_decode_box_autoadd_as_ui_select(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return (sse_decode_as_ui_select(deserializer)); + } + + @protected + AsUiSwitch sse_decode_box_autoadd_as_ui_switch(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return (sse_decode_as_ui_switch(deserializer)); + } + + @protected + AsUiText sse_decode_box_autoadd_as_ui_text(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return (sse_decode_as_ui_text(deserializer)); + } + + @protected + AsUiTextInput sse_decode_box_autoadd_as_ui_text_input( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return (sse_decode_as_ui_text_input(deserializer)); + } + + @protected + AsUiTextarea sse_decode_box_autoadd_as_ui_textarea( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return (sse_decode_as_ui_textarea(deserializer)); + } + + @protected + bool sse_decode_box_autoadd_bool(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return (sse_decode_bool(deserializer)); + } + + @protected + double sse_decode_box_autoadd_f_64(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return (sse_decode_f_64(deserializer)); + } + + @protected + PostFormPropsForAsUi sse_decode_box_autoadd_post_form_props_for_as_ui( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return (sse_decode_post_form_props_for_as_ui(deserializer)); + } + + @protected + double sse_decode_f_64(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return deserializer.buffer.getFloat64(); + } + + @protected + List sse_decode_list_String(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + + var len_ = sse_decode_i_32(deserializer); + var ans_ = []; + for (var idx_ = 0; idx_ < len_; ++idx_) { + ans_.add(sse_decode_String(deserializer)); + } + return ans_; + } + + @protected + List sse_decode_list_as_ui_button(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + + var len_ = sse_decode_i_32(deserializer); + var ans_ = []; + for (var idx_ = 0; idx_ < len_; ++idx_) { + ans_.add(sse_decode_as_ui_button(deserializer)); + } + return ans_; + } + + @protected + Uint8List sse_decode_list_prim_u_8_strict(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + var len_ = sse_decode_i_32(deserializer); + return deserializer.buffer.getUint8List(len_); + } + + @protected + List<(String, String)> sse_decode_list_record_string_string( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + + var len_ = sse_decode_i_32(deserializer); + var ans_ = <(String, String)>[]; + for (var idx_ = 0; idx_ < len_; ++idx_) { + ans_.add(sse_decode_record_string_string(deserializer)); + } + return ans_; + } + + @protected + String? sse_decode_opt_String(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + + if (sse_decode_bool(deserializer)) { + return (sse_decode_String(deserializer)); + } else { + return null; + } + } + + @protected + AsApiLib? + sse_decode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsApiLib( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + + if (sse_decode_bool(deserializer)) { + return (sse_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsApiLib( + deserializer)); + } else { + return null; + } + } + + @protected + AsUiButtonCallback? + sse_decode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiButtonCallback( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + + if (sse_decode_bool(deserializer)) { + return (sse_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiButtonCallback( + deserializer)); + } else { + return null; + } + } + + @protected + AsUiLib? + sse_decode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiLib( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + + if (sse_decode_bool(deserializer)) { + return (sse_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiLib( + deserializer)); + } else { + return null; + } + } + + @protected + AsUiMfmCallback? + sse_decode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiMfmCallback( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + + if (sse_decode_bool(deserializer)) { + return (sse_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiMfmCallback( + deserializer)); + } else { + return null; + } + } + + @protected + AsUiNumberCallback? + sse_decode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiNumberCallback( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + + if (sse_decode_bool(deserializer)) { + return (sse_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiNumberCallback( + deserializer)); + } else { + return null; + } + } + + @protected + AsUiSelectCallback? + sse_decode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSelectCallback( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + + if (sse_decode_bool(deserializer)) { + return (sse_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSelectCallback( + deserializer)); + } else { + return null; + } + } + + @protected + AsUiSwitchCallback? + sse_decode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSwitchCallback( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + + if (sse_decode_bool(deserializer)) { + return (sse_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSwitchCallback( + deserializer)); + } else { + return null; + } + } + + @protected + AsUiTextInputCallback? + sse_decode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextInputCallback( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + + if (sse_decode_bool(deserializer)) { + return (sse_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextInputCallback( + deserializer)); + } else { + return null; + } + } + + @protected + AsUiTextareaCallback? + sse_decode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextareaCallback( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + + if (sse_decode_bool(deserializer)) { + return (sse_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextareaCallback( + deserializer)); + } else { + return null; + } + } + + @protected + AsPlayLib? sse_decode_opt_box_autoadd_as_play_lib( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + + if (sse_decode_bool(deserializer)) { + return (sse_decode_box_autoadd_as_play_lib(deserializer)); + } else { + return null; + } + } + + @protected + bool? sse_decode_opt_box_autoadd_bool(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + + if (sse_decode_bool(deserializer)) { + return (sse_decode_box_autoadd_bool(deserializer)); + } else { + return null; + } + } + + @protected + double? sse_decode_opt_box_autoadd_f_64(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + + if (sse_decode_bool(deserializer)) { + return (sse_decode_box_autoadd_f_64(deserializer)); + } else { + return null; + } + } + + @protected + PostFormPropsForAsUi? sse_decode_opt_box_autoadd_post_form_props_for_as_ui( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + + if (sse_decode_bool(deserializer)) { + return (sse_decode_box_autoadd_post_form_props_for_as_ui(deserializer)); + } else { + return null; + } + } + + @protected + List? sse_decode_opt_list_String(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + + if (sse_decode_bool(deserializer)) { + return (sse_decode_list_String(deserializer)); + } else { + return null; + } + } + + @protected + List? sse_decode_opt_list_as_ui_button( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + + if (sse_decode_bool(deserializer)) { + return (sse_decode_list_as_ui_button(deserializer)); + } else { + return null; + } + } + + @protected + List<(String, String)>? sse_decode_opt_list_record_string_string( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + + if (sse_decode_bool(deserializer)) { + return (sse_decode_list_record_string_string(deserializer)); + } else { + return null; + } + } + + @protected + PostFormPropsForAsUi sse_decode_post_form_props_for_as_ui( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + var var_text = sse_decode_String(deserializer); + var var_cw = sse_decode_opt_String(deserializer); + var var_visibility = sse_decode_opt_String(deserializer); + var var_localOnly = sse_decode_opt_box_autoadd_bool(deserializer); + return PostFormPropsForAsUi( + text: var_text, + cw: var_cw, + visibility: var_visibility, + localOnly: var_localOnly); + } + + @protected + (String, String?) sse_decode_record_string_opt_string( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + var var_field0 = sse_decode_String(deserializer); + var var_field1 = sse_decode_opt_String(deserializer); + return (var_field0, var_field1); + } + + @protected + (String, String) sse_decode_record_string_string( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + var var_field0 = sse_decode_String(deserializer); + var var_field1 = sse_decode_String(deserializer); + return (var_field0, var_field1); + } + + @protected + int sse_decode_u_8(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return deserializer.buffer.getUint8(); + } + + @protected + void sse_decode_unit(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + } + + @protected + BigInt sse_decode_usize(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return deserializer.buffer.getBigUint64(); + } + + @protected + int sse_decode_i_32(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return deserializer.buffer.getInt32(); + } + + @protected + void sse_encode_AnyhowException( + AnyhowException self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_String(self.message, serializer); + } + + @protected + void + sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAiScript( + AiScript self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_usize( + (self as AiScriptImpl).frbInternalSseEncode(move: true), serializer); + } + + @protected + void + sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsApiLib( + AsApiLib self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_usize( + (self as AsApiLibImpl).frbInternalSseEncode(move: true), serializer); + } + + @protected + void + sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiButtonCallback( + AsUiButtonCallback self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_usize( + (self as AsUiButtonCallbackImpl).frbInternalSseEncode(move: true), + serializer); + } + + @protected + void + sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiLib( + AsUiLib self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_usize( + (self as AsUiLibImpl).frbInternalSseEncode(move: true), serializer); + } + + @protected + void + sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiMfmCallback( + AsUiMfmCallback self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_usize( + (self as AsUiMfmCallbackImpl).frbInternalSseEncode(move: true), + serializer); + } + + @protected + void + sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiNumberCallback( + AsUiNumberCallback self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_usize( + (self as AsUiNumberCallbackImpl).frbInternalSseEncode(move: true), + serializer); + } + + @protected + void + sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSelectCallback( + AsUiSelectCallback self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_usize( + (self as AsUiSelectCallbackImpl).frbInternalSseEncode(move: true), + serializer); + } + + @protected + void + sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSwitchCallback( + AsUiSwitchCallback self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_usize( + (self as AsUiSwitchCallbackImpl).frbInternalSseEncode(move: true), + serializer); + } + + @protected + void + sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextInputCallback( + AsUiTextInputCallback self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_usize( + (self as AsUiTextInputCallbackImpl).frbInternalSseEncode(move: true), + serializer); + } + + @protected + void + sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextareaCallback( + AsUiTextareaCallback self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_usize( + (self as AsUiTextareaCallbackImpl).frbInternalSseEncode(move: true), + serializer); + } + + @protected + void + sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAiScript( + AiScript self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_usize( + (self as AiScriptImpl).frbInternalSseEncode(move: false), serializer); + } + + @protected + void + sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiButtonCallback( + AsUiButtonCallback self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_usize( + (self as AsUiButtonCallbackImpl).frbInternalSseEncode(move: false), + serializer); + } + + @protected + void + sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiMfmCallback( + AsUiMfmCallback self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_usize( + (self as AsUiMfmCallbackImpl).frbInternalSseEncode(move: false), + serializer); + } + + @protected + void + sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiNumberCallback( + AsUiNumberCallback self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_usize( + (self as AsUiNumberCallbackImpl).frbInternalSseEncode(move: false), + serializer); + } + + @protected + void + sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSelectCallback( + AsUiSelectCallback self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_usize( + (self as AsUiSelectCallbackImpl).frbInternalSseEncode(move: false), + serializer); + } + + @protected + void + sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSwitchCallback( + AsUiSwitchCallback self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_usize( + (self as AsUiSwitchCallbackImpl).frbInternalSseEncode(move: false), + serializer); + } + + @protected + void + sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextInputCallback( + AsUiTextInputCallback self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_usize( + (self as AsUiTextInputCallbackImpl).frbInternalSseEncode(move: false), + serializer); + } + + @protected + void + sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextareaCallback( + AsUiTextareaCallback self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_usize( + (self as AsUiTextareaCallbackImpl).frbInternalSseEncode(move: false), + serializer); + } + + @protected + void sse_encode_DartFn_Inputs_String_Output_String_AnyhowException( + FutureOr Function(String) self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_DartOpaque( + encode_DartFn_Inputs_String_Output_String_AnyhowException(self), + serializer); + } + + @protected + void sse_encode_DartFn_Inputs_String_Output_unit_AnyhowException( + FutureOr Function(String) self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_DartOpaque( + encode_DartFn_Inputs_String_Output_unit_AnyhowException(self), + serializer); + } + + @protected + void sse_encode_DartFn_Inputs_String_String_Output_unit_AnyhowException( + FutureOr Function(String, String) self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_DartOpaque( + encode_DartFn_Inputs_String_String_Output_unit_AnyhowException(self), + serializer); + } + + @protected + void + sse_encode_DartFn_Inputs_String_String_String_Output_bool_AnyhowException( + FutureOr Function(String, String, String) self, + SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_DartOpaque( + encode_DartFn_Inputs_String_String_String_Output_bool_AnyhowException( + self), + serializer); + } + + @protected + void + sse_encode_DartFn_Inputs_String_String_String_Output_unit_AnyhowException( + FutureOr Function(String, String, String) self, + SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_DartOpaque( + encode_DartFn_Inputs_String_String_String_Output_unit_AnyhowException( + self), + serializer); + } + + @protected + void + sse_encode_DartFn_Inputs_String_String_opt_String_Output_record_string_opt_string_AnyhowException( + FutureOr<(String, String?)> Function(String, String, String?) self, + SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_DartOpaque( + encode_DartFn_Inputs_String_String_opt_String_Output_record_string_opt_string_AnyhowException( + self), + serializer); + } + + @protected + void + sse_encode_DartFn_Inputs_String_as_ui_component_Output_unit_AnyhowException( + FutureOr Function(String, AsUiComponent) self, + SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_DartOpaque( + encode_DartFn_Inputs_String_as_ui_component_Output_unit_AnyhowException( + self), + serializer); + } + + @protected + void sse_encode_DartOpaque(Object self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_usize( + BigInt.from(PlatformPointerUtil.ptrToInt(encodeDartOpaque( + self, portManager.dartHandlerPort, generalizedFrbRustBinding))) + .toUnsigned(64), + serializer); + } + + @protected + void + sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAiScript( + AiScript self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_usize( + (self as AiScriptImpl).frbInternalSseEncode(move: null), serializer); + } + + @protected + void + sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsApiLib( + AsApiLib self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_usize( + (self as AsApiLibImpl).frbInternalSseEncode(move: null), serializer); + } + + @protected + void + sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiButtonCallback( + AsUiButtonCallback self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_usize( + (self as AsUiButtonCallbackImpl).frbInternalSseEncode(move: null), + serializer); + } + + @protected + void + sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiLib( + AsUiLib self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_usize( + (self as AsUiLibImpl).frbInternalSseEncode(move: null), serializer); + } + + @protected + void + sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiMfmCallback( + AsUiMfmCallback self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_usize( + (self as AsUiMfmCallbackImpl).frbInternalSseEncode(move: null), + serializer); + } + + @protected + void + sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiNumberCallback( + AsUiNumberCallback self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_usize( + (self as AsUiNumberCallbackImpl).frbInternalSseEncode(move: null), + serializer); + } + + @protected + void + sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSelectCallback( + AsUiSelectCallback self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_usize( + (self as AsUiSelectCallbackImpl).frbInternalSseEncode(move: null), + serializer); + } + + @protected + void + sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSwitchCallback( + AsUiSwitchCallback self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_usize( + (self as AsUiSwitchCallbackImpl).frbInternalSseEncode(move: null), + serializer); + } + + @protected + void + sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextInputCallback( + AsUiTextInputCallback self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_usize( + (self as AsUiTextInputCallbackImpl).frbInternalSseEncode(move: null), + serializer); + } + + @protected + void + sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextareaCallback( + AsUiTextareaCallback self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_usize( + (self as AsUiTextareaCallbackImpl).frbInternalSseEncode(move: null), + serializer); + } + + @protected + void sse_encode_String(String self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_list_prim_u_8_strict(utf8.encoder.convert(self), serializer); + } + + @protected + void sse_encode_as_play_lib(AsPlayLib self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_String(self.thisId, serializer); + sse_encode_String(self.thisUrl, serializer); + } + + @protected + void sse_encode_as_ui_button(AsUiButton self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_opt_String(self.text, serializer); + sse_encode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiButtonCallback( + self.onClick, serializer); + sse_encode_opt_box_autoadd_bool(self.primary, serializer); + sse_encode_opt_box_autoadd_bool(self.rounded, serializer); + sse_encode_opt_box_autoadd_bool(self.disabled, serializer); + } + + @protected + void sse_encode_as_ui_buttons(AsUiButtons self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_opt_list_as_ui_button(self.buttons, serializer); + } + + @protected + void sse_encode_as_ui_component( + AsUiComponent self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + switch (self) { + case AsUiComponent_Root(field0: final field0): + sse_encode_i_32(0, serializer); + sse_encode_box_autoadd_as_ui_root(field0, serializer); + case AsUiComponent_Container(field0: final field0): + sse_encode_i_32(1, serializer); + sse_encode_box_autoadd_as_ui_container(field0, serializer); + case AsUiComponent_Text(field0: final field0): + sse_encode_i_32(2, serializer); + sse_encode_box_autoadd_as_ui_text(field0, serializer); + case AsUiComponent_Mfm(field0: final field0): + sse_encode_i_32(3, serializer); + sse_encode_box_autoadd_as_ui_mfm(field0, serializer); + case AsUiComponent_Button(field0: final field0): + sse_encode_i_32(4, serializer); + sse_encode_box_autoadd_as_ui_button(field0, serializer); + case AsUiComponent_Buttons(field0: final field0): + sse_encode_i_32(5, serializer); + sse_encode_box_autoadd_as_ui_buttons(field0, serializer); + case AsUiComponent_ToggleSwitch(field0: final field0): + sse_encode_i_32(6, serializer); + sse_encode_box_autoadd_as_ui_switch(field0, serializer); + case AsUiComponent_Textarea(field0: final field0): + sse_encode_i_32(7, serializer); + sse_encode_box_autoadd_as_ui_textarea(field0, serializer); + case AsUiComponent_TextInput(field0: final field0): + sse_encode_i_32(8, serializer); + sse_encode_box_autoadd_as_ui_text_input(field0, serializer); + case AsUiComponent_NumberInput(field0: final field0): + sse_encode_i_32(9, serializer); + sse_encode_box_autoadd_as_ui_number_input(field0, serializer); + case AsUiComponent_Select(field0: final field0): + sse_encode_i_32(10, serializer); + sse_encode_box_autoadd_as_ui_select(field0, serializer); + case AsUiComponent_Folder(field0: final field0): + sse_encode_i_32(11, serializer); + sse_encode_box_autoadd_as_ui_folder(field0, serializer); + case AsUiComponent_PostFormButton(field0: final field0): + sse_encode_i_32(12, serializer); + sse_encode_box_autoadd_as_ui_post_form_button(field0, serializer); + case AsUiComponent_PostForm(field0: final field0): + sse_encode_i_32(13, serializer); + sse_encode_box_autoadd_as_ui_post_form(field0, serializer); + default: + throw UnimplementedError(''); + } + } + + @protected + void sse_encode_as_ui_container( + AsUiContainer self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_opt_list_String(self.children, serializer); + sse_encode_opt_String(self.align, serializer); + sse_encode_opt_String(self.bgColor, serializer); + sse_encode_opt_String(self.fgColor, serializer); + sse_encode_opt_String(self.font, serializer); + sse_encode_opt_box_autoadd_f_64(self.borderWidth, serializer); + sse_encode_opt_String(self.borderColor, serializer); + sse_encode_opt_box_autoadd_f_64(self.padding, serializer); + sse_encode_opt_box_autoadd_bool(self.rounded, serializer); + sse_encode_opt_box_autoadd_bool(self.hidden, serializer); + } + + @protected + void sse_encode_as_ui_folder(AsUiFolder self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_opt_list_String(self.children, serializer); + sse_encode_opt_String(self.title, serializer); + sse_encode_opt_box_autoadd_bool(self.opened, serializer); + } + + @protected + void sse_encode_as_ui_mfm(AsUiMfm self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_opt_String(self.text, serializer); + sse_encode_opt_box_autoadd_f_64(self.size, serializer); + sse_encode_opt_box_autoadd_bool(self.bold, serializer); + sse_encode_opt_String(self.color, serializer); + sse_encode_opt_String(self.font, serializer); + sse_encode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiMfmCallback( + self.onClickEv, serializer); + } + + @protected + void sse_encode_as_ui_number_input( + AsUiNumberInput self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiNumberCallback( + self.onInput, serializer); + sse_encode_opt_box_autoadd_f_64(self.defaultValue, serializer); + sse_encode_opt_String(self.label, serializer); + sse_encode_opt_String(self.caption, serializer); + } + + @protected + void sse_encode_as_ui_post_form(AsUiPostForm self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_opt_box_autoadd_post_form_props_for_as_ui(self.form, serializer); + } + + @protected + void sse_encode_as_ui_post_form_button( + AsUiPostFormButton self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_opt_String(self.text, serializer); + sse_encode_opt_box_autoadd_bool(self.primary, serializer); + sse_encode_opt_box_autoadd_bool(self.rounded, serializer); + sse_encode_opt_box_autoadd_post_form_props_for_as_ui(self.form, serializer); + } + + @protected + void sse_encode_as_ui_root(AsUiRoot self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_list_String(self.children, serializer); + } + + @protected + void sse_encode_as_ui_select(AsUiSelect self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_opt_list_record_string_string(self.items, serializer); + sse_encode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSelectCallback( + self.onChange, serializer); + sse_encode_opt_String(self.defaultValue, serializer); + sse_encode_opt_String(self.label, serializer); + sse_encode_opt_String(self.caption, serializer); + } + + @protected + void sse_encode_as_ui_switch(AsUiSwitch self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSwitchCallback( + self.onChange, serializer); + sse_encode_opt_box_autoadd_bool(self.defaultValue, serializer); + sse_encode_opt_String(self.label, serializer); + sse_encode_opt_String(self.caption, serializer); + } + + @protected + void sse_encode_as_ui_text(AsUiText self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_opt_String(self.text, serializer); + sse_encode_opt_box_autoadd_f_64(self.size, serializer); + sse_encode_opt_box_autoadd_bool(self.bold, serializer); + sse_encode_opt_String(self.color, serializer); + sse_encode_opt_String(self.font, serializer); + } + + @protected + void sse_encode_as_ui_text_input( + AsUiTextInput self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextInputCallback( + self.onInput, serializer); + sse_encode_opt_String(self.defaultValue, serializer); + sse_encode_opt_String(self.label, serializer); + sse_encode_opt_String(self.caption, serializer); + } + + @protected + void sse_encode_as_ui_textarea(AsUiTextarea self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextareaCallback( + self.onInput, serializer); + sse_encode_opt_String(self.defaultValue, serializer); + sse_encode_opt_String(self.label, serializer); + sse_encode_opt_String(self.caption, serializer); + } + + @protected + void sse_encode_bool(bool self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + serializer.buffer.putUint8(self ? 1 : 0); + } + + @protected + void + sse_encode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsApiLib( + AsApiLib self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsApiLib( + self, serializer); + } + + @protected + void + sse_encode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiButtonCallback( + AsUiButtonCallback self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiButtonCallback( + self, serializer); + } + + @protected + void + sse_encode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiLib( + AsUiLib self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiLib( + self, serializer); + } + + @protected + void + sse_encode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiMfmCallback( + AsUiMfmCallback self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiMfmCallback( + self, serializer); + } + + @protected + void + sse_encode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiNumberCallback( + AsUiNumberCallback self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiNumberCallback( + self, serializer); + } + + @protected + void + sse_encode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSelectCallback( + AsUiSelectCallback self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSelectCallback( + self, serializer); + } + + @protected + void + sse_encode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSwitchCallback( + AsUiSwitchCallback self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSwitchCallback( + self, serializer); + } + + @protected + void + sse_encode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextInputCallback( + AsUiTextInputCallback self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextInputCallback( + self, serializer); + } + + @protected + void + sse_encode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextareaCallback( + AsUiTextareaCallback self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextareaCallback( + self, serializer); + } + + @protected + void sse_encode_box_autoadd_as_play_lib( + AsPlayLib self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_as_play_lib(self, serializer); + } + + @protected + void sse_encode_box_autoadd_as_ui_button( + AsUiButton self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_as_ui_button(self, serializer); + } + + @protected + void sse_encode_box_autoadd_as_ui_buttons( + AsUiButtons self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_as_ui_buttons(self, serializer); + } + + @protected + void sse_encode_box_autoadd_as_ui_container( + AsUiContainer self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_as_ui_container(self, serializer); + } + + @protected + void sse_encode_box_autoadd_as_ui_folder( + AsUiFolder self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_as_ui_folder(self, serializer); + } + + @protected + void sse_encode_box_autoadd_as_ui_mfm( + AsUiMfm self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_as_ui_mfm(self, serializer); + } + + @protected + void sse_encode_box_autoadd_as_ui_number_input( + AsUiNumberInput self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_as_ui_number_input(self, serializer); + } + + @protected + void sse_encode_box_autoadd_as_ui_post_form( + AsUiPostForm self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_as_ui_post_form(self, serializer); + } + + @protected + void sse_encode_box_autoadd_as_ui_post_form_button( + AsUiPostFormButton self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_as_ui_post_form_button(self, serializer); + } + + @protected + void sse_encode_box_autoadd_as_ui_root( + AsUiRoot self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_as_ui_root(self, serializer); + } + + @protected + void sse_encode_box_autoadd_as_ui_select( + AsUiSelect self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_as_ui_select(self, serializer); + } + + @protected + void sse_encode_box_autoadd_as_ui_switch( + AsUiSwitch self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_as_ui_switch(self, serializer); + } + + @protected + void sse_encode_box_autoadd_as_ui_text( + AsUiText self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_as_ui_text(self, serializer); + } + + @protected + void sse_encode_box_autoadd_as_ui_text_input( + AsUiTextInput self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_as_ui_text_input(self, serializer); + } + + @protected + void sse_encode_box_autoadd_as_ui_textarea( + AsUiTextarea self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_as_ui_textarea(self, serializer); + } + + @protected + void sse_encode_box_autoadd_bool(bool self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_bool(self, serializer); + } + + @protected + void sse_encode_box_autoadd_f_64(double self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_f_64(self, serializer); + } + + @protected + void sse_encode_box_autoadd_post_form_props_for_as_ui( + PostFormPropsForAsUi self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_post_form_props_for_as_ui(self, serializer); + } + + @protected + void sse_encode_f_64(double self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + serializer.buffer.putFloat64(self); + } + + @protected + void sse_encode_list_String(List self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_i_32(self.length, serializer); + for (final item in self) { + sse_encode_String(item, serializer); + } + } + + @protected + void sse_encode_list_as_ui_button( + List self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_i_32(self.length, serializer); + for (final item in self) { + sse_encode_as_ui_button(item, serializer); + } + } + + @protected + void sse_encode_list_prim_u_8_strict( + Uint8List self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_i_32(self.length, serializer); + serializer.buffer.putUint8List(self); + } + + @protected + void sse_encode_list_record_string_string( + List<(String, String)> self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_i_32(self.length, serializer); + for (final item in self) { + sse_encode_record_string_string(item, serializer); + } + } + + @protected + void sse_encode_opt_String(String? self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + + sse_encode_bool(self != null, serializer); + if (self != null) { + sse_encode_String(self, serializer); + } + } + + @protected + void + sse_encode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsApiLib( + AsApiLib? self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + + sse_encode_bool(self != null, serializer); + if (self != null) { + sse_encode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsApiLib( + self, serializer); + } + } + + @protected + void + sse_encode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiButtonCallback( + AsUiButtonCallback? self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + + sse_encode_bool(self != null, serializer); + if (self != null) { + sse_encode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiButtonCallback( + self, serializer); + } + } + + @protected + void + sse_encode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiLib( + AsUiLib? self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + + sse_encode_bool(self != null, serializer); + if (self != null) { + sse_encode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiLib( + self, serializer); + } + } + + @protected + void + sse_encode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiMfmCallback( + AsUiMfmCallback? self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + + sse_encode_bool(self != null, serializer); + if (self != null) { + sse_encode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiMfmCallback( + self, serializer); + } + } + + @protected + void + sse_encode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiNumberCallback( + AsUiNumberCallback? self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + + sse_encode_bool(self != null, serializer); + if (self != null) { + sse_encode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiNumberCallback( + self, serializer); + } + } + + @protected + void + sse_encode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSelectCallback( + AsUiSelectCallback? self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + + sse_encode_bool(self != null, serializer); + if (self != null) { + sse_encode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSelectCallback( + self, serializer); + } + } + + @protected + void + sse_encode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSwitchCallback( + AsUiSwitchCallback? self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + + sse_encode_bool(self != null, serializer); + if (self != null) { + sse_encode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSwitchCallback( + self, serializer); + } + } + + @protected + void + sse_encode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextInputCallback( + AsUiTextInputCallback? self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + + sse_encode_bool(self != null, serializer); + if (self != null) { + sse_encode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextInputCallback( + self, serializer); + } + } + + @protected + void + sse_encode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextareaCallback( + AsUiTextareaCallback? self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + + sse_encode_bool(self != null, serializer); + if (self != null) { + sse_encode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextareaCallback( + self, serializer); + } + } + + @protected + void sse_encode_opt_box_autoadd_as_play_lib( + AsPlayLib? self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + + sse_encode_bool(self != null, serializer); + if (self != null) { + sse_encode_box_autoadd_as_play_lib(self, serializer); + } + } + + @protected + void sse_encode_opt_box_autoadd_bool(bool? self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + + sse_encode_bool(self != null, serializer); + if (self != null) { + sse_encode_box_autoadd_bool(self, serializer); + } + } + + @protected + void sse_encode_opt_box_autoadd_f_64(double? self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + + sse_encode_bool(self != null, serializer); + if (self != null) { + sse_encode_box_autoadd_f_64(self, serializer); + } + } + + @protected + void sse_encode_opt_box_autoadd_post_form_props_for_as_ui( + PostFormPropsForAsUi? self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + + sse_encode_bool(self != null, serializer); + if (self != null) { + sse_encode_box_autoadd_post_form_props_for_as_ui(self, serializer); + } + } + + @protected + void sse_encode_opt_list_String( + List? self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + + sse_encode_bool(self != null, serializer); + if (self != null) { + sse_encode_list_String(self, serializer); + } + } + + @protected + void sse_encode_opt_list_as_ui_button( + List? self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + + sse_encode_bool(self != null, serializer); + if (self != null) { + sse_encode_list_as_ui_button(self, serializer); + } + } + + @protected + void sse_encode_opt_list_record_string_string( + List<(String, String)>? self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + + sse_encode_bool(self != null, serializer); + if (self != null) { + sse_encode_list_record_string_string(self, serializer); + } + } + + @protected + void sse_encode_post_form_props_for_as_ui( + PostFormPropsForAsUi self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_String(self.text, serializer); + sse_encode_opt_String(self.cw, serializer); + sse_encode_opt_String(self.visibility, serializer); + sse_encode_opt_box_autoadd_bool(self.localOnly, serializer); + } + + @protected + void sse_encode_record_string_opt_string( + (String, String?) self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_String(self.$1, serializer); + sse_encode_opt_String(self.$2, serializer); + } + + @protected + void sse_encode_record_string_string( + (String, String) self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_String(self.$1, serializer); + sse_encode_String(self.$2, serializer); + } + + @protected + void sse_encode_u_8(int self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + serializer.buffer.putUint8(self); + } + + @protected + void sse_encode_unit(void self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + } + + @protected + void sse_encode_usize(BigInt self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + serializer.buffer.putBigUint64(self); + } + + @protected + void sse_encode_i_32(int self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + serializer.buffer.putInt32(self); + } +} + +@sealed +class AiScriptImpl extends RustOpaque implements AiScript { + // Not to be used by end users + AiScriptImpl.frbInternalDcoDecode(List wire) + : super.frbInternalDcoDecode(wire, _kStaticData); + + // Not to be used by end users + AiScriptImpl.frbInternalSseDecode(BigInt ptr, int externalSizeOnNative) + : super.frbInternalSseDecode(ptr, externalSizeOnNative, _kStaticData); + + static final _kStaticData = RustArcStaticData( + rustArcIncrementStrongCount: + RustLib.instance.api.rust_arc_increment_strong_count_AiScript, + rustArcDecrementStrongCount: + RustLib.instance.api.rust_arc_decrement_strong_count_AiScript, + rustArcDecrementStrongCountPtr: + RustLib.instance.api.rust_arc_decrement_strong_count_AiScriptPtr, + ); + + Future abort() => RustLib.instance.api.crateApiAiscriptAiScriptAbort( + that: this, + ); + + Future exec({required String input}) => RustLib.instance.api + .crateApiAiscriptAiScriptExec(that: this, input: input); +} + +@sealed +class AsApiLibImpl extends RustOpaque implements AsApiLib { + // Not to be used by end users + AsApiLibImpl.frbInternalDcoDecode(List wire) + : super.frbInternalDcoDecode(wire, _kStaticData); + + // Not to be used by end users + AsApiLibImpl.frbInternalSseDecode(BigInt ptr, int externalSizeOnNative) + : super.frbInternalSseDecode(ptr, externalSizeOnNative, _kStaticData); + + static final _kStaticData = RustArcStaticData( + rustArcIncrementStrongCount: + RustLib.instance.api.rust_arc_increment_strong_count_AsApiLib, + rustArcDecrementStrongCount: + RustLib.instance.api.rust_arc_decrement_strong_count_AsApiLib, + rustArcDecrementStrongCountPtr: + RustLib.instance.api.rust_arc_decrement_strong_count_AsApiLibPtr, + ); +} + +@sealed +class AsUiButtonCallbackImpl extends RustOpaque implements AsUiButtonCallback { + // Not to be used by end users + AsUiButtonCallbackImpl.frbInternalDcoDecode(List wire) + : super.frbInternalDcoDecode(wire, _kStaticData); + + // Not to be used by end users + AsUiButtonCallbackImpl.frbInternalSseDecode( + BigInt ptr, int externalSizeOnNative) + : super.frbInternalSseDecode(ptr, externalSizeOnNative, _kStaticData); + + static final _kStaticData = RustArcStaticData( + rustArcIncrementStrongCount: + RustLib.instance.api.rust_arc_increment_strong_count_AsUiButtonCallback, + rustArcDecrementStrongCount: + RustLib.instance.api.rust_arc_decrement_strong_count_AsUiButtonCallback, + rustArcDecrementStrongCountPtr: RustLib + .instance.api.rust_arc_decrement_strong_count_AsUiButtonCallbackPtr, + ); + + Future call() => + RustLib.instance.api.crateApiAiscriptUiAsUiButtonCallbackCall( + that: this, + ); +} + +@sealed +class AsUiLibImpl extends RustOpaque implements AsUiLib { + // Not to be used by end users + AsUiLibImpl.frbInternalDcoDecode(List wire) + : super.frbInternalDcoDecode(wire, _kStaticData); + + // Not to be used by end users + AsUiLibImpl.frbInternalSseDecode(BigInt ptr, int externalSizeOnNative) + : super.frbInternalSseDecode(ptr, externalSizeOnNative, _kStaticData); + + static final _kStaticData = RustArcStaticData( + rustArcIncrementStrongCount: + RustLib.instance.api.rust_arc_increment_strong_count_AsUiLib, + rustArcDecrementStrongCount: + RustLib.instance.api.rust_arc_decrement_strong_count_AsUiLib, + rustArcDecrementStrongCountPtr: + RustLib.instance.api.rust_arc_decrement_strong_count_AsUiLibPtr, + ); +} + +@sealed +class AsUiMfmCallbackImpl extends RustOpaque implements AsUiMfmCallback { + // Not to be used by end users + AsUiMfmCallbackImpl.frbInternalDcoDecode(List wire) + : super.frbInternalDcoDecode(wire, _kStaticData); + + // Not to be used by end users + AsUiMfmCallbackImpl.frbInternalSseDecode(BigInt ptr, int externalSizeOnNative) + : super.frbInternalSseDecode(ptr, externalSizeOnNative, _kStaticData); + + static final _kStaticData = RustArcStaticData( + rustArcIncrementStrongCount: + RustLib.instance.api.rust_arc_increment_strong_count_AsUiMfmCallback, + rustArcDecrementStrongCount: + RustLib.instance.api.rust_arc_decrement_strong_count_AsUiMfmCallback, + rustArcDecrementStrongCountPtr: + RustLib.instance.api.rust_arc_decrement_strong_count_AsUiMfmCallbackPtr, + ); + + Future call({required String value}) => RustLib.instance.api + .crateApiAiscriptUiAsUiMfmCallbackCall(that: this, value: value); +} + +@sealed +class AsUiNumberCallbackImpl extends RustOpaque implements AsUiNumberCallback { + // Not to be used by end users + AsUiNumberCallbackImpl.frbInternalDcoDecode(List wire) + : super.frbInternalDcoDecode(wire, _kStaticData); + + // Not to be used by end users + AsUiNumberCallbackImpl.frbInternalSseDecode( + BigInt ptr, int externalSizeOnNative) + : super.frbInternalSseDecode(ptr, externalSizeOnNative, _kStaticData); + + static final _kStaticData = RustArcStaticData( + rustArcIncrementStrongCount: + RustLib.instance.api.rust_arc_increment_strong_count_AsUiNumberCallback, + rustArcDecrementStrongCount: + RustLib.instance.api.rust_arc_decrement_strong_count_AsUiNumberCallback, + rustArcDecrementStrongCountPtr: RustLib + .instance.api.rust_arc_decrement_strong_count_AsUiNumberCallbackPtr, + ); + + Future call({required double value}) => RustLib.instance.api + .crateApiAiscriptUiAsUiNumberCallbackCall(that: this, value: value); +} + +@sealed +class AsUiSelectCallbackImpl extends RustOpaque implements AsUiSelectCallback { + // Not to be used by end users + AsUiSelectCallbackImpl.frbInternalDcoDecode(List wire) + : super.frbInternalDcoDecode(wire, _kStaticData); + + // Not to be used by end users + AsUiSelectCallbackImpl.frbInternalSseDecode( + BigInt ptr, int externalSizeOnNative) + : super.frbInternalSseDecode(ptr, externalSizeOnNative, _kStaticData); + + static final _kStaticData = RustArcStaticData( + rustArcIncrementStrongCount: + RustLib.instance.api.rust_arc_increment_strong_count_AsUiSelectCallback, + rustArcDecrementStrongCount: + RustLib.instance.api.rust_arc_decrement_strong_count_AsUiSelectCallback, + rustArcDecrementStrongCountPtr: RustLib + .instance.api.rust_arc_decrement_strong_count_AsUiSelectCallbackPtr, + ); + + Future call({required String value}) => RustLib.instance.api + .crateApiAiscriptUiAsUiSelectCallbackCall(that: this, value: value); +} + +@sealed +class AsUiSwitchCallbackImpl extends RustOpaque implements AsUiSwitchCallback { + // Not to be used by end users + AsUiSwitchCallbackImpl.frbInternalDcoDecode(List wire) + : super.frbInternalDcoDecode(wire, _kStaticData); + + // Not to be used by end users + AsUiSwitchCallbackImpl.frbInternalSseDecode( + BigInt ptr, int externalSizeOnNative) + : super.frbInternalSseDecode(ptr, externalSizeOnNative, _kStaticData); + + static final _kStaticData = RustArcStaticData( + rustArcIncrementStrongCount: + RustLib.instance.api.rust_arc_increment_strong_count_AsUiSwitchCallback, + rustArcDecrementStrongCount: + RustLib.instance.api.rust_arc_decrement_strong_count_AsUiSwitchCallback, + rustArcDecrementStrongCountPtr: RustLib + .instance.api.rust_arc_decrement_strong_count_AsUiSwitchCallbackPtr, + ); + + Future call({required bool value}) => RustLib.instance.api + .crateApiAiscriptUiAsUiSwitchCallbackCall(that: this, value: value); +} + +@sealed +class AsUiTextInputCallbackImpl extends RustOpaque + implements AsUiTextInputCallback { + // Not to be used by end users + AsUiTextInputCallbackImpl.frbInternalDcoDecode(List wire) + : super.frbInternalDcoDecode(wire, _kStaticData); + + // Not to be used by end users + AsUiTextInputCallbackImpl.frbInternalSseDecode( + BigInt ptr, int externalSizeOnNative) + : super.frbInternalSseDecode(ptr, externalSizeOnNative, _kStaticData); + + static final _kStaticData = RustArcStaticData( + rustArcIncrementStrongCount: RustLib + .instance.api.rust_arc_increment_strong_count_AsUiTextInputCallback, + rustArcDecrementStrongCount: RustLib + .instance.api.rust_arc_decrement_strong_count_AsUiTextInputCallback, + rustArcDecrementStrongCountPtr: RustLib + .instance.api.rust_arc_decrement_strong_count_AsUiTextInputCallbackPtr, + ); + + Future call({required String value}) => RustLib.instance.api + .crateApiAiscriptUiAsUiTextInputCallbackCall(that: this, value: value); +} + +@sealed +class AsUiTextareaCallbackImpl extends RustOpaque + implements AsUiTextareaCallback { + // Not to be used by end users + AsUiTextareaCallbackImpl.frbInternalDcoDecode(List wire) + : super.frbInternalDcoDecode(wire, _kStaticData); + + // Not to be used by end users + AsUiTextareaCallbackImpl.frbInternalSseDecode( + BigInt ptr, int externalSizeOnNative) + : super.frbInternalSseDecode(ptr, externalSizeOnNative, _kStaticData); + + static final _kStaticData = RustArcStaticData( + rustArcIncrementStrongCount: RustLib + .instance.api.rust_arc_increment_strong_count_AsUiTextareaCallback, + rustArcDecrementStrongCount: RustLib + .instance.api.rust_arc_decrement_strong_count_AsUiTextareaCallback, + rustArcDecrementStrongCountPtr: RustLib + .instance.api.rust_arc_decrement_strong_count_AsUiTextareaCallbackPtr, + ); + + Future call({required String value}) => RustLib.instance.api + .crateApiAiscriptUiAsUiTextareaCallbackCall(that: this, value: value); +} diff --git a/lib/rust/frb_generated.io.dart b/lib/rust/frb_generated.io.dart new file mode 100644 index 00000000..9890ef1e --- /dev/null +++ b/lib/rust/frb_generated.io.dart @@ -0,0 +1,1722 @@ +// This file is automatically generated, so please do not edit it. +// Generated by `flutter_rust_bridge`@ 2.0.0-dev.39. + +// ignore_for_file: unused_import, unused_element, unnecessary_import, duplicate_ignore, invalid_use_of_internal_member, annotate_overrides, non_constant_identifier_names, curly_braces_in_flow_control_structures, prefer_const_literals_to_create_immutables, unused_field + +import 'api/aiscript.dart'; +import 'api/aiscript/api.dart'; +import 'api/aiscript/play.dart'; +import 'api/aiscript/ui.dart'; +import 'dart:async'; +import 'dart:convert'; +import 'dart:ffi' as ffi; +import 'frb_generated.dart'; +import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated_io.dart'; + +abstract class RustLibApiImplPlatform extends BaseApiImpl { + RustLibApiImplPlatform({ + required super.handler, + required super.wire, + required super.generalizedFrbRustBinding, + required super.portManager, + }); + + CrossPlatformFinalizerArg get rust_arc_decrement_strong_count_AiScriptPtr => wire + ._rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAiScriptPtr; + + CrossPlatformFinalizerArg get rust_arc_decrement_strong_count_AsApiLibPtr => wire + ._rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsApiLibPtr; + + CrossPlatformFinalizerArg + get rust_arc_decrement_strong_count_AsUiButtonCallbackPtr => wire + ._rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiButtonCallbackPtr; + + CrossPlatformFinalizerArg get rust_arc_decrement_strong_count_AsUiLibPtr => wire + ._rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiLibPtr; + + CrossPlatformFinalizerArg + get rust_arc_decrement_strong_count_AsUiMfmCallbackPtr => wire + ._rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiMfmCallbackPtr; + + CrossPlatformFinalizerArg + get rust_arc_decrement_strong_count_AsUiNumberCallbackPtr => wire + ._rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiNumberCallbackPtr; + + CrossPlatformFinalizerArg + get rust_arc_decrement_strong_count_AsUiSelectCallbackPtr => wire + ._rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSelectCallbackPtr; + + CrossPlatformFinalizerArg + get rust_arc_decrement_strong_count_AsUiSwitchCallbackPtr => wire + ._rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSwitchCallbackPtr; + + CrossPlatformFinalizerArg + get rust_arc_decrement_strong_count_AsUiTextInputCallbackPtr => wire + ._rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextInputCallbackPtr; + + CrossPlatformFinalizerArg + get rust_arc_decrement_strong_count_AsUiTextareaCallbackPtr => wire + ._rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextareaCallbackPtr; + + @protected + AnyhowException dco_decode_AnyhowException(dynamic raw); + + @protected + AiScript + dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAiScript( + dynamic raw); + + @protected + AsApiLib + dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsApiLib( + dynamic raw); + + @protected + AsUiButtonCallback + dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiButtonCallback( + dynamic raw); + + @protected + AsUiLib + dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiLib( + dynamic raw); + + @protected + AsUiMfmCallback + dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiMfmCallback( + dynamic raw); + + @protected + AsUiNumberCallback + dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiNumberCallback( + dynamic raw); + + @protected + AsUiSelectCallback + dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSelectCallback( + dynamic raw); + + @protected + AsUiSwitchCallback + dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSwitchCallback( + dynamic raw); + + @protected + AsUiTextInputCallback + dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextInputCallback( + dynamic raw); + + @protected + AsUiTextareaCallback + dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextareaCallback( + dynamic raw); + + @protected + AiScript + dco_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAiScript( + dynamic raw); + + @protected + AsUiButtonCallback + dco_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiButtonCallback( + dynamic raw); + + @protected + AsUiMfmCallback + dco_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiMfmCallback( + dynamic raw); + + @protected + AsUiNumberCallback + dco_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiNumberCallback( + dynamic raw); + + @protected + AsUiSelectCallback + dco_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSelectCallback( + dynamic raw); + + @protected + AsUiSwitchCallback + dco_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSwitchCallback( + dynamic raw); + + @protected + AsUiTextInputCallback + dco_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextInputCallback( + dynamic raw); + + @protected + AsUiTextareaCallback + dco_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextareaCallback( + dynamic raw); + + @protected + FutureOr Function(String) + dco_decode_DartFn_Inputs_String_Output_String_AnyhowException( + dynamic raw); + + @protected + FutureOr Function(String) + dco_decode_DartFn_Inputs_String_Output_unit_AnyhowException(dynamic raw); + + @protected + FutureOr Function(String, String) + dco_decode_DartFn_Inputs_String_String_Output_unit_AnyhowException( + dynamic raw); + + @protected + FutureOr Function(String, String, String) + dco_decode_DartFn_Inputs_String_String_String_Output_bool_AnyhowException( + dynamic raw); + + @protected + FutureOr Function(String, String, String) + dco_decode_DartFn_Inputs_String_String_String_Output_unit_AnyhowException( + dynamic raw); + + @protected + FutureOr<(String, String?)> Function(String, String, String?) + dco_decode_DartFn_Inputs_String_String_opt_String_Output_record_string_opt_string_AnyhowException( + dynamic raw); + + @protected + FutureOr Function(String, AsUiComponent) + dco_decode_DartFn_Inputs_String_as_ui_component_Output_unit_AnyhowException( + dynamic raw); + + @protected + Object dco_decode_DartOpaque(dynamic raw); + + @protected + AiScript + dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAiScript( + dynamic raw); + + @protected + AsApiLib + dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsApiLib( + dynamic raw); + + @protected + AsUiButtonCallback + dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiButtonCallback( + dynamic raw); + + @protected + AsUiLib + dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiLib( + dynamic raw); + + @protected + AsUiMfmCallback + dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiMfmCallback( + dynamic raw); + + @protected + AsUiNumberCallback + dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiNumberCallback( + dynamic raw); + + @protected + AsUiSelectCallback + dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSelectCallback( + dynamic raw); + + @protected + AsUiSwitchCallback + dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSwitchCallback( + dynamic raw); + + @protected + AsUiTextInputCallback + dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextInputCallback( + dynamic raw); + + @protected + AsUiTextareaCallback + dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextareaCallback( + dynamic raw); + + @protected + String dco_decode_String(dynamic raw); + + @protected + AsPlayLib dco_decode_as_play_lib(dynamic raw); + + @protected + AsUiButton dco_decode_as_ui_button(dynamic raw); + + @protected + AsUiButtons dco_decode_as_ui_buttons(dynamic raw); + + @protected + AsUiComponent dco_decode_as_ui_component(dynamic raw); + + @protected + AsUiContainer dco_decode_as_ui_container(dynamic raw); + + @protected + AsUiFolder dco_decode_as_ui_folder(dynamic raw); + + @protected + AsUiMfm dco_decode_as_ui_mfm(dynamic raw); + + @protected + AsUiNumberInput dco_decode_as_ui_number_input(dynamic raw); + + @protected + AsUiPostForm dco_decode_as_ui_post_form(dynamic raw); + + @protected + AsUiPostFormButton dco_decode_as_ui_post_form_button(dynamic raw); + + @protected + AsUiRoot dco_decode_as_ui_root(dynamic raw); + + @protected + AsUiSelect dco_decode_as_ui_select(dynamic raw); + + @protected + AsUiSwitch dco_decode_as_ui_switch(dynamic raw); + + @protected + AsUiText dco_decode_as_ui_text(dynamic raw); + + @protected + AsUiTextInput dco_decode_as_ui_text_input(dynamic raw); + + @protected + AsUiTextarea dco_decode_as_ui_textarea(dynamic raw); + + @protected + bool dco_decode_bool(dynamic raw); + + @protected + AsApiLib + dco_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsApiLib( + dynamic raw); + + @protected + AsUiButtonCallback + dco_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiButtonCallback( + dynamic raw); + + @protected + AsUiLib + dco_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiLib( + dynamic raw); + + @protected + AsUiMfmCallback + dco_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiMfmCallback( + dynamic raw); + + @protected + AsUiNumberCallback + dco_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiNumberCallback( + dynamic raw); + + @protected + AsUiSelectCallback + dco_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSelectCallback( + dynamic raw); + + @protected + AsUiSwitchCallback + dco_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSwitchCallback( + dynamic raw); + + @protected + AsUiTextInputCallback + dco_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextInputCallback( + dynamic raw); + + @protected + AsUiTextareaCallback + dco_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextareaCallback( + dynamic raw); + + @protected + AsPlayLib dco_decode_box_autoadd_as_play_lib(dynamic raw); + + @protected + AsUiButton dco_decode_box_autoadd_as_ui_button(dynamic raw); + + @protected + AsUiButtons dco_decode_box_autoadd_as_ui_buttons(dynamic raw); + + @protected + AsUiContainer dco_decode_box_autoadd_as_ui_container(dynamic raw); + + @protected + AsUiFolder dco_decode_box_autoadd_as_ui_folder(dynamic raw); + + @protected + AsUiMfm dco_decode_box_autoadd_as_ui_mfm(dynamic raw); + + @protected + AsUiNumberInput dco_decode_box_autoadd_as_ui_number_input(dynamic raw); + + @protected + AsUiPostForm dco_decode_box_autoadd_as_ui_post_form(dynamic raw); + + @protected + AsUiPostFormButton dco_decode_box_autoadd_as_ui_post_form_button(dynamic raw); + + @protected + AsUiRoot dco_decode_box_autoadd_as_ui_root(dynamic raw); + + @protected + AsUiSelect dco_decode_box_autoadd_as_ui_select(dynamic raw); + + @protected + AsUiSwitch dco_decode_box_autoadd_as_ui_switch(dynamic raw); + + @protected + AsUiText dco_decode_box_autoadd_as_ui_text(dynamic raw); + + @protected + AsUiTextInput dco_decode_box_autoadd_as_ui_text_input(dynamic raw); + + @protected + AsUiTextarea dco_decode_box_autoadd_as_ui_textarea(dynamic raw); + + @protected + bool dco_decode_box_autoadd_bool(dynamic raw); + + @protected + double dco_decode_box_autoadd_f_64(dynamic raw); + + @protected + PostFormPropsForAsUi dco_decode_box_autoadd_post_form_props_for_as_ui( + dynamic raw); + + @protected + double dco_decode_f_64(dynamic raw); + + @protected + List dco_decode_list_String(dynamic raw); + + @protected + List dco_decode_list_as_ui_button(dynamic raw); + + @protected + Uint8List dco_decode_list_prim_u_8_strict(dynamic raw); + + @protected + List<(String, String)> dco_decode_list_record_string_string(dynamic raw); + + @protected + String? dco_decode_opt_String(dynamic raw); + + @protected + AsApiLib? + dco_decode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsApiLib( + dynamic raw); + + @protected + AsUiButtonCallback? + dco_decode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiButtonCallback( + dynamic raw); + + @protected + AsUiLib? + dco_decode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiLib( + dynamic raw); + + @protected + AsUiMfmCallback? + dco_decode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiMfmCallback( + dynamic raw); + + @protected + AsUiNumberCallback? + dco_decode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiNumberCallback( + dynamic raw); + + @protected + AsUiSelectCallback? + dco_decode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSelectCallback( + dynamic raw); + + @protected + AsUiSwitchCallback? + dco_decode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSwitchCallback( + dynamic raw); + + @protected + AsUiTextInputCallback? + dco_decode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextInputCallback( + dynamic raw); + + @protected + AsUiTextareaCallback? + dco_decode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextareaCallback( + dynamic raw); + + @protected + AsPlayLib? dco_decode_opt_box_autoadd_as_play_lib(dynamic raw); + + @protected + bool? dco_decode_opt_box_autoadd_bool(dynamic raw); + + @protected + double? dco_decode_opt_box_autoadd_f_64(dynamic raw); + + @protected + PostFormPropsForAsUi? dco_decode_opt_box_autoadd_post_form_props_for_as_ui( + dynamic raw); + + @protected + List? dco_decode_opt_list_String(dynamic raw); + + @protected + List? dco_decode_opt_list_as_ui_button(dynamic raw); + + @protected + List<(String, String)>? dco_decode_opt_list_record_string_string(dynamic raw); + + @protected + PostFormPropsForAsUi dco_decode_post_form_props_for_as_ui(dynamic raw); + + @protected + (String, String?) dco_decode_record_string_opt_string(dynamic raw); + + @protected + (String, String) dco_decode_record_string_string(dynamic raw); + + @protected + int dco_decode_u_8(dynamic raw); + + @protected + void dco_decode_unit(dynamic raw); + + @protected + BigInt dco_decode_usize(dynamic raw); + + @protected + AnyhowException sse_decode_AnyhowException(SseDeserializer deserializer); + + @protected + AiScript + sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAiScript( + SseDeserializer deserializer); + + @protected + AsApiLib + sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsApiLib( + SseDeserializer deserializer); + + @protected + AsUiButtonCallback + sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiButtonCallback( + SseDeserializer deserializer); + + @protected + AsUiLib + sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiLib( + SseDeserializer deserializer); + + @protected + AsUiMfmCallback + sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiMfmCallback( + SseDeserializer deserializer); + + @protected + AsUiNumberCallback + sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiNumberCallback( + SseDeserializer deserializer); + + @protected + AsUiSelectCallback + sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSelectCallback( + SseDeserializer deserializer); + + @protected + AsUiSwitchCallback + sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSwitchCallback( + SseDeserializer deserializer); + + @protected + AsUiTextInputCallback + sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextInputCallback( + SseDeserializer deserializer); + + @protected + AsUiTextareaCallback + sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextareaCallback( + SseDeserializer deserializer); + + @protected + AiScript + sse_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAiScript( + SseDeserializer deserializer); + + @protected + AsUiButtonCallback + sse_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiButtonCallback( + SseDeserializer deserializer); + + @protected + AsUiMfmCallback + sse_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiMfmCallback( + SseDeserializer deserializer); + + @protected + AsUiNumberCallback + sse_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiNumberCallback( + SseDeserializer deserializer); + + @protected + AsUiSelectCallback + sse_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSelectCallback( + SseDeserializer deserializer); + + @protected + AsUiSwitchCallback + sse_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSwitchCallback( + SseDeserializer deserializer); + + @protected + AsUiTextInputCallback + sse_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextInputCallback( + SseDeserializer deserializer); + + @protected + AsUiTextareaCallback + sse_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextareaCallback( + SseDeserializer deserializer); + + @protected + Object sse_decode_DartOpaque(SseDeserializer deserializer); + + @protected + AiScript + sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAiScript( + SseDeserializer deserializer); + + @protected + AsApiLib + sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsApiLib( + SseDeserializer deserializer); + + @protected + AsUiButtonCallback + sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiButtonCallback( + SseDeserializer deserializer); + + @protected + AsUiLib + sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiLib( + SseDeserializer deserializer); + + @protected + AsUiMfmCallback + sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiMfmCallback( + SseDeserializer deserializer); + + @protected + AsUiNumberCallback + sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiNumberCallback( + SseDeserializer deserializer); + + @protected + AsUiSelectCallback + sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSelectCallback( + SseDeserializer deserializer); + + @protected + AsUiSwitchCallback + sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSwitchCallback( + SseDeserializer deserializer); + + @protected + AsUiTextInputCallback + sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextInputCallback( + SseDeserializer deserializer); + + @protected + AsUiTextareaCallback + sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextareaCallback( + SseDeserializer deserializer); + + @protected + String sse_decode_String(SseDeserializer deserializer); + + @protected + AsPlayLib sse_decode_as_play_lib(SseDeserializer deserializer); + + @protected + AsUiButton sse_decode_as_ui_button(SseDeserializer deserializer); + + @protected + AsUiButtons sse_decode_as_ui_buttons(SseDeserializer deserializer); + + @protected + AsUiComponent sse_decode_as_ui_component(SseDeserializer deserializer); + + @protected + AsUiContainer sse_decode_as_ui_container(SseDeserializer deserializer); + + @protected + AsUiFolder sse_decode_as_ui_folder(SseDeserializer deserializer); + + @protected + AsUiMfm sse_decode_as_ui_mfm(SseDeserializer deserializer); + + @protected + AsUiNumberInput sse_decode_as_ui_number_input(SseDeserializer deserializer); + + @protected + AsUiPostForm sse_decode_as_ui_post_form(SseDeserializer deserializer); + + @protected + AsUiPostFormButton sse_decode_as_ui_post_form_button( + SseDeserializer deserializer); + + @protected + AsUiRoot sse_decode_as_ui_root(SseDeserializer deserializer); + + @protected + AsUiSelect sse_decode_as_ui_select(SseDeserializer deserializer); + + @protected + AsUiSwitch sse_decode_as_ui_switch(SseDeserializer deserializer); + + @protected + AsUiText sse_decode_as_ui_text(SseDeserializer deserializer); + + @protected + AsUiTextInput sse_decode_as_ui_text_input(SseDeserializer deserializer); + + @protected + AsUiTextarea sse_decode_as_ui_textarea(SseDeserializer deserializer); + + @protected + bool sse_decode_bool(SseDeserializer deserializer); + + @protected + AsApiLib + sse_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsApiLib( + SseDeserializer deserializer); + + @protected + AsUiButtonCallback + sse_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiButtonCallback( + SseDeserializer deserializer); + + @protected + AsUiLib + sse_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiLib( + SseDeserializer deserializer); + + @protected + AsUiMfmCallback + sse_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiMfmCallback( + SseDeserializer deserializer); + + @protected + AsUiNumberCallback + sse_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiNumberCallback( + SseDeserializer deserializer); + + @protected + AsUiSelectCallback + sse_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSelectCallback( + SseDeserializer deserializer); + + @protected + AsUiSwitchCallback + sse_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSwitchCallback( + SseDeserializer deserializer); + + @protected + AsUiTextInputCallback + sse_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextInputCallback( + SseDeserializer deserializer); + + @protected + AsUiTextareaCallback + sse_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextareaCallback( + SseDeserializer deserializer); + + @protected + AsPlayLib sse_decode_box_autoadd_as_play_lib(SseDeserializer deserializer); + + @protected + AsUiButton sse_decode_box_autoadd_as_ui_button(SseDeserializer deserializer); + + @protected + AsUiButtons sse_decode_box_autoadd_as_ui_buttons( + SseDeserializer deserializer); + + @protected + AsUiContainer sse_decode_box_autoadd_as_ui_container( + SseDeserializer deserializer); + + @protected + AsUiFolder sse_decode_box_autoadd_as_ui_folder(SseDeserializer deserializer); + + @protected + AsUiMfm sse_decode_box_autoadd_as_ui_mfm(SseDeserializer deserializer); + + @protected + AsUiNumberInput sse_decode_box_autoadd_as_ui_number_input( + SseDeserializer deserializer); + + @protected + AsUiPostForm sse_decode_box_autoadd_as_ui_post_form( + SseDeserializer deserializer); + + @protected + AsUiPostFormButton sse_decode_box_autoadd_as_ui_post_form_button( + SseDeserializer deserializer); + + @protected + AsUiRoot sse_decode_box_autoadd_as_ui_root(SseDeserializer deserializer); + + @protected + AsUiSelect sse_decode_box_autoadd_as_ui_select(SseDeserializer deserializer); + + @protected + AsUiSwitch sse_decode_box_autoadd_as_ui_switch(SseDeserializer deserializer); + + @protected + AsUiText sse_decode_box_autoadd_as_ui_text(SseDeserializer deserializer); + + @protected + AsUiTextInput sse_decode_box_autoadd_as_ui_text_input( + SseDeserializer deserializer); + + @protected + AsUiTextarea sse_decode_box_autoadd_as_ui_textarea( + SseDeserializer deserializer); + + @protected + bool sse_decode_box_autoadd_bool(SseDeserializer deserializer); + + @protected + double sse_decode_box_autoadd_f_64(SseDeserializer deserializer); + + @protected + PostFormPropsForAsUi sse_decode_box_autoadd_post_form_props_for_as_ui( + SseDeserializer deserializer); + + @protected + double sse_decode_f_64(SseDeserializer deserializer); + + @protected + List sse_decode_list_String(SseDeserializer deserializer); + + @protected + List sse_decode_list_as_ui_button(SseDeserializer deserializer); + + @protected + Uint8List sse_decode_list_prim_u_8_strict(SseDeserializer deserializer); + + @protected + List<(String, String)> sse_decode_list_record_string_string( + SseDeserializer deserializer); + + @protected + String? sse_decode_opt_String(SseDeserializer deserializer); + + @protected + AsApiLib? + sse_decode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsApiLib( + SseDeserializer deserializer); + + @protected + AsUiButtonCallback? + sse_decode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiButtonCallback( + SseDeserializer deserializer); + + @protected + AsUiLib? + sse_decode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiLib( + SseDeserializer deserializer); + + @protected + AsUiMfmCallback? + sse_decode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiMfmCallback( + SseDeserializer deserializer); + + @protected + AsUiNumberCallback? + sse_decode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiNumberCallback( + SseDeserializer deserializer); + + @protected + AsUiSelectCallback? + sse_decode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSelectCallback( + SseDeserializer deserializer); + + @protected + AsUiSwitchCallback? + sse_decode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSwitchCallback( + SseDeserializer deserializer); + + @protected + AsUiTextInputCallback? + sse_decode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextInputCallback( + SseDeserializer deserializer); + + @protected + AsUiTextareaCallback? + sse_decode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextareaCallback( + SseDeserializer deserializer); + + @protected + AsPlayLib? sse_decode_opt_box_autoadd_as_play_lib( + SseDeserializer deserializer); + + @protected + bool? sse_decode_opt_box_autoadd_bool(SseDeserializer deserializer); + + @protected + double? sse_decode_opt_box_autoadd_f_64(SseDeserializer deserializer); + + @protected + PostFormPropsForAsUi? sse_decode_opt_box_autoadd_post_form_props_for_as_ui( + SseDeserializer deserializer); + + @protected + List? sse_decode_opt_list_String(SseDeserializer deserializer); + + @protected + List? sse_decode_opt_list_as_ui_button( + SseDeserializer deserializer); + + @protected + List<(String, String)>? sse_decode_opt_list_record_string_string( + SseDeserializer deserializer); + + @protected + PostFormPropsForAsUi sse_decode_post_form_props_for_as_ui( + SseDeserializer deserializer); + + @protected + (String, String?) sse_decode_record_string_opt_string( + SseDeserializer deserializer); + + @protected + (String, String) sse_decode_record_string_string( + SseDeserializer deserializer); + + @protected + int sse_decode_u_8(SseDeserializer deserializer); + + @protected + void sse_decode_unit(SseDeserializer deserializer); + + @protected + BigInt sse_decode_usize(SseDeserializer deserializer); + + @protected + int sse_decode_i_32(SseDeserializer deserializer); + + @protected + void sse_encode_AnyhowException( + AnyhowException self, SseSerializer serializer); + + @protected + void + sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAiScript( + AiScript self, SseSerializer serializer); + + @protected + void + sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsApiLib( + AsApiLib self, SseSerializer serializer); + + @protected + void + sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiButtonCallback( + AsUiButtonCallback self, SseSerializer serializer); + + @protected + void + sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiLib( + AsUiLib self, SseSerializer serializer); + + @protected + void + sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiMfmCallback( + AsUiMfmCallback self, SseSerializer serializer); + + @protected + void + sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiNumberCallback( + AsUiNumberCallback self, SseSerializer serializer); + + @protected + void + sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSelectCallback( + AsUiSelectCallback self, SseSerializer serializer); + + @protected + void + sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSwitchCallback( + AsUiSwitchCallback self, SseSerializer serializer); + + @protected + void + sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextInputCallback( + AsUiTextInputCallback self, SseSerializer serializer); + + @protected + void + sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextareaCallback( + AsUiTextareaCallback self, SseSerializer serializer); + + @protected + void + sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAiScript( + AiScript self, SseSerializer serializer); + + @protected + void + sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiButtonCallback( + AsUiButtonCallback self, SseSerializer serializer); + + @protected + void + sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiMfmCallback( + AsUiMfmCallback self, SseSerializer serializer); + + @protected + void + sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiNumberCallback( + AsUiNumberCallback self, SseSerializer serializer); + + @protected + void + sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSelectCallback( + AsUiSelectCallback self, SseSerializer serializer); + + @protected + void + sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSwitchCallback( + AsUiSwitchCallback self, SseSerializer serializer); + + @protected + void + sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextInputCallback( + AsUiTextInputCallback self, SseSerializer serializer); + + @protected + void + sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextareaCallback( + AsUiTextareaCallback self, SseSerializer serializer); + + @protected + void sse_encode_DartFn_Inputs_String_Output_String_AnyhowException( + FutureOr Function(String) self, SseSerializer serializer); + + @protected + void sse_encode_DartFn_Inputs_String_Output_unit_AnyhowException( + FutureOr Function(String) self, SseSerializer serializer); + + @protected + void sse_encode_DartFn_Inputs_String_String_Output_unit_AnyhowException( + FutureOr Function(String, String) self, SseSerializer serializer); + + @protected + void + sse_encode_DartFn_Inputs_String_String_String_Output_bool_AnyhowException( + FutureOr Function(String, String, String) self, + SseSerializer serializer); + + @protected + void + sse_encode_DartFn_Inputs_String_String_String_Output_unit_AnyhowException( + FutureOr Function(String, String, String) self, + SseSerializer serializer); + + @protected + void + sse_encode_DartFn_Inputs_String_String_opt_String_Output_record_string_opt_string_AnyhowException( + FutureOr<(String, String?)> Function(String, String, String?) self, + SseSerializer serializer); + + @protected + void + sse_encode_DartFn_Inputs_String_as_ui_component_Output_unit_AnyhowException( + FutureOr Function(String, AsUiComponent) self, + SseSerializer serializer); + + @protected + void sse_encode_DartOpaque(Object self, SseSerializer serializer); + + @protected + void + sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAiScript( + AiScript self, SseSerializer serializer); + + @protected + void + sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsApiLib( + AsApiLib self, SseSerializer serializer); + + @protected + void + sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiButtonCallback( + AsUiButtonCallback self, SseSerializer serializer); + + @protected + void + sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiLib( + AsUiLib self, SseSerializer serializer); + + @protected + void + sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiMfmCallback( + AsUiMfmCallback self, SseSerializer serializer); + + @protected + void + sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiNumberCallback( + AsUiNumberCallback self, SseSerializer serializer); + + @protected + void + sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSelectCallback( + AsUiSelectCallback self, SseSerializer serializer); + + @protected + void + sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSwitchCallback( + AsUiSwitchCallback self, SseSerializer serializer); + + @protected + void + sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextInputCallback( + AsUiTextInputCallback self, SseSerializer serializer); + + @protected + void + sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextareaCallback( + AsUiTextareaCallback self, SseSerializer serializer); + + @protected + void sse_encode_String(String self, SseSerializer serializer); + + @protected + void sse_encode_as_play_lib(AsPlayLib self, SseSerializer serializer); + + @protected + void sse_encode_as_ui_button(AsUiButton self, SseSerializer serializer); + + @protected + void sse_encode_as_ui_buttons(AsUiButtons self, SseSerializer serializer); + + @protected + void sse_encode_as_ui_component(AsUiComponent self, SseSerializer serializer); + + @protected + void sse_encode_as_ui_container(AsUiContainer self, SseSerializer serializer); + + @protected + void sse_encode_as_ui_folder(AsUiFolder self, SseSerializer serializer); + + @protected + void sse_encode_as_ui_mfm(AsUiMfm self, SseSerializer serializer); + + @protected + void sse_encode_as_ui_number_input( + AsUiNumberInput self, SseSerializer serializer); + + @protected + void sse_encode_as_ui_post_form(AsUiPostForm self, SseSerializer serializer); + + @protected + void sse_encode_as_ui_post_form_button( + AsUiPostFormButton self, SseSerializer serializer); + + @protected + void sse_encode_as_ui_root(AsUiRoot self, SseSerializer serializer); + + @protected + void sse_encode_as_ui_select(AsUiSelect self, SseSerializer serializer); + + @protected + void sse_encode_as_ui_switch(AsUiSwitch self, SseSerializer serializer); + + @protected + void sse_encode_as_ui_text(AsUiText self, SseSerializer serializer); + + @protected + void sse_encode_as_ui_text_input( + AsUiTextInput self, SseSerializer serializer); + + @protected + void sse_encode_as_ui_textarea(AsUiTextarea self, SseSerializer serializer); + + @protected + void sse_encode_bool(bool self, SseSerializer serializer); + + @protected + void + sse_encode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsApiLib( + AsApiLib self, SseSerializer serializer); + + @protected + void + sse_encode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiButtonCallback( + AsUiButtonCallback self, SseSerializer serializer); + + @protected + void + sse_encode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiLib( + AsUiLib self, SseSerializer serializer); + + @protected + void + sse_encode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiMfmCallback( + AsUiMfmCallback self, SseSerializer serializer); + + @protected + void + sse_encode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiNumberCallback( + AsUiNumberCallback self, SseSerializer serializer); + + @protected + void + sse_encode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSelectCallback( + AsUiSelectCallback self, SseSerializer serializer); + + @protected + void + sse_encode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSwitchCallback( + AsUiSwitchCallback self, SseSerializer serializer); + + @protected + void + sse_encode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextInputCallback( + AsUiTextInputCallback self, SseSerializer serializer); + + @protected + void + sse_encode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextareaCallback( + AsUiTextareaCallback self, SseSerializer serializer); + + @protected + void sse_encode_box_autoadd_as_play_lib( + AsPlayLib self, SseSerializer serializer); + + @protected + void sse_encode_box_autoadd_as_ui_button( + AsUiButton self, SseSerializer serializer); + + @protected + void sse_encode_box_autoadd_as_ui_buttons( + AsUiButtons self, SseSerializer serializer); + + @protected + void sse_encode_box_autoadd_as_ui_container( + AsUiContainer self, SseSerializer serializer); + + @protected + void sse_encode_box_autoadd_as_ui_folder( + AsUiFolder self, SseSerializer serializer); + + @protected + void sse_encode_box_autoadd_as_ui_mfm(AsUiMfm self, SseSerializer serializer); + + @protected + void sse_encode_box_autoadd_as_ui_number_input( + AsUiNumberInput self, SseSerializer serializer); + + @protected + void sse_encode_box_autoadd_as_ui_post_form( + AsUiPostForm self, SseSerializer serializer); + + @protected + void sse_encode_box_autoadd_as_ui_post_form_button( + AsUiPostFormButton self, SseSerializer serializer); + + @protected + void sse_encode_box_autoadd_as_ui_root( + AsUiRoot self, SseSerializer serializer); + + @protected + void sse_encode_box_autoadd_as_ui_select( + AsUiSelect self, SseSerializer serializer); + + @protected + void sse_encode_box_autoadd_as_ui_switch( + AsUiSwitch self, SseSerializer serializer); + + @protected + void sse_encode_box_autoadd_as_ui_text( + AsUiText self, SseSerializer serializer); + + @protected + void sse_encode_box_autoadd_as_ui_text_input( + AsUiTextInput self, SseSerializer serializer); + + @protected + void sse_encode_box_autoadd_as_ui_textarea( + AsUiTextarea self, SseSerializer serializer); + + @protected + void sse_encode_box_autoadd_bool(bool self, SseSerializer serializer); + + @protected + void sse_encode_box_autoadd_f_64(double self, SseSerializer serializer); + + @protected + void sse_encode_box_autoadd_post_form_props_for_as_ui( + PostFormPropsForAsUi self, SseSerializer serializer); + + @protected + void sse_encode_f_64(double self, SseSerializer serializer); + + @protected + void sse_encode_list_String(List self, SseSerializer serializer); + + @protected + void sse_encode_list_as_ui_button( + List self, SseSerializer serializer); + + @protected + void sse_encode_list_prim_u_8_strict( + Uint8List self, SseSerializer serializer); + + @protected + void sse_encode_list_record_string_string( + List<(String, String)> self, SseSerializer serializer); + + @protected + void sse_encode_opt_String(String? self, SseSerializer serializer); + + @protected + void + sse_encode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsApiLib( + AsApiLib? self, SseSerializer serializer); + + @protected + void + sse_encode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiButtonCallback( + AsUiButtonCallback? self, SseSerializer serializer); + + @protected + void + sse_encode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiLib( + AsUiLib? self, SseSerializer serializer); + + @protected + void + sse_encode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiMfmCallback( + AsUiMfmCallback? self, SseSerializer serializer); + + @protected + void + sse_encode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiNumberCallback( + AsUiNumberCallback? self, SseSerializer serializer); + + @protected + void + sse_encode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSelectCallback( + AsUiSelectCallback? self, SseSerializer serializer); + + @protected + void + sse_encode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSwitchCallback( + AsUiSwitchCallback? self, SseSerializer serializer); + + @protected + void + sse_encode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextInputCallback( + AsUiTextInputCallback? self, SseSerializer serializer); + + @protected + void + sse_encode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextareaCallback( + AsUiTextareaCallback? self, SseSerializer serializer); + + @protected + void sse_encode_opt_box_autoadd_as_play_lib( + AsPlayLib? self, SseSerializer serializer); + + @protected + void sse_encode_opt_box_autoadd_bool(bool? self, SseSerializer serializer); + + @protected + void sse_encode_opt_box_autoadd_f_64(double? self, SseSerializer serializer); + + @protected + void sse_encode_opt_box_autoadd_post_form_props_for_as_ui( + PostFormPropsForAsUi? self, SseSerializer serializer); + + @protected + void sse_encode_opt_list_String(List? self, SseSerializer serializer); + + @protected + void sse_encode_opt_list_as_ui_button( + List? self, SseSerializer serializer); + + @protected + void sse_encode_opt_list_record_string_string( + List<(String, String)>? self, SseSerializer serializer); + + @protected + void sse_encode_post_form_props_for_as_ui( + PostFormPropsForAsUi self, SseSerializer serializer); + + @protected + void sse_encode_record_string_opt_string( + (String, String?) self, SseSerializer serializer); + + @protected + void sse_encode_record_string_string( + (String, String) self, SseSerializer serializer); + + @protected + void sse_encode_u_8(int self, SseSerializer serializer); + + @protected + void sse_encode_unit(void self, SseSerializer serializer); + + @protected + void sse_encode_usize(BigInt self, SseSerializer serializer); + + @protected + void sse_encode_i_32(int self, SseSerializer serializer); +} + +// Section: wire_class + +class RustLibWire implements BaseWire { + factory RustLibWire.fromExternalLibrary(ExternalLibrary lib) => + RustLibWire(lib.ffiDynamicLibrary); + + /// Holds the symbol lookup function. + final ffi.Pointer Function(String symbolName) + _lookup; + + /// The symbols are looked up in [dynamicLibrary]. + RustLibWire(ffi.DynamicLibrary dynamicLibrary) + : _lookup = dynamicLibrary.lookup; + + void + rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAiScript( + ffi.Pointer ptr, + ) { + return _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAiScript( + ptr, + ); + } + + late final _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAiScriptPtr = + _lookup)>>( + 'frbgen_aria_rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAiScript'); + late final _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAiScript = + _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAiScriptPtr + .asFunction)>(); + + void + rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAiScript( + ffi.Pointer ptr, + ) { + return _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAiScript( + ptr, + ); + } + + late final _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAiScriptPtr = + _lookup)>>( + 'frbgen_aria_rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAiScript'); + late final _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAiScript = + _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAiScriptPtr + .asFunction)>(); + + void + rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsApiLib( + ffi.Pointer ptr, + ) { + return _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsApiLib( + ptr, + ); + } + + late final _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsApiLibPtr = + _lookup)>>( + 'frbgen_aria_rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsApiLib'); + late final _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsApiLib = + _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsApiLibPtr + .asFunction)>(); + + void + rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsApiLib( + ffi.Pointer ptr, + ) { + return _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsApiLib( + ptr, + ); + } + + late final _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsApiLibPtr = + _lookup)>>( + 'frbgen_aria_rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsApiLib'); + late final _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsApiLib = + _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsApiLibPtr + .asFunction)>(); + + void + rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiButtonCallback( + ffi.Pointer ptr, + ) { + return _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiButtonCallback( + ptr, + ); + } + + late final _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiButtonCallbackPtr = + _lookup)>>( + 'frbgen_aria_rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiButtonCallback'); + late final _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiButtonCallback = + _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiButtonCallbackPtr + .asFunction)>(); + + void + rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiButtonCallback( + ffi.Pointer ptr, + ) { + return _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiButtonCallback( + ptr, + ); + } + + late final _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiButtonCallbackPtr = + _lookup)>>( + 'frbgen_aria_rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiButtonCallback'); + late final _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiButtonCallback = + _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiButtonCallbackPtr + .asFunction)>(); + + void + rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiLib( + ffi.Pointer ptr, + ) { + return _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiLib( + ptr, + ); + } + + late final _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiLibPtr = + _lookup)>>( + 'frbgen_aria_rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiLib'); + late final _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiLib = + _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiLibPtr + .asFunction)>(); + + void + rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiLib( + ffi.Pointer ptr, + ) { + return _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiLib( + ptr, + ); + } + + late final _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiLibPtr = + _lookup)>>( + 'frbgen_aria_rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiLib'); + late final _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiLib = + _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiLibPtr + .asFunction)>(); + + void + rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiMfmCallback( + ffi.Pointer ptr, + ) { + return _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiMfmCallback( + ptr, + ); + } + + late final _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiMfmCallbackPtr = + _lookup)>>( + 'frbgen_aria_rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiMfmCallback'); + late final _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiMfmCallback = + _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiMfmCallbackPtr + .asFunction)>(); + + void + rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiMfmCallback( + ffi.Pointer ptr, + ) { + return _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiMfmCallback( + ptr, + ); + } + + late final _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiMfmCallbackPtr = + _lookup)>>( + 'frbgen_aria_rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiMfmCallback'); + late final _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiMfmCallback = + _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiMfmCallbackPtr + .asFunction)>(); + + void + rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiNumberCallback( + ffi.Pointer ptr, + ) { + return _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiNumberCallback( + ptr, + ); + } + + late final _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiNumberCallbackPtr = + _lookup)>>( + 'frbgen_aria_rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiNumberCallback'); + late final _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiNumberCallback = + _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiNumberCallbackPtr + .asFunction)>(); + + void + rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiNumberCallback( + ffi.Pointer ptr, + ) { + return _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiNumberCallback( + ptr, + ); + } + + late final _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiNumberCallbackPtr = + _lookup)>>( + 'frbgen_aria_rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiNumberCallback'); + late final _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiNumberCallback = + _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiNumberCallbackPtr + .asFunction)>(); + + void + rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSelectCallback( + ffi.Pointer ptr, + ) { + return _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSelectCallback( + ptr, + ); + } + + late final _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSelectCallbackPtr = + _lookup)>>( + 'frbgen_aria_rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSelectCallback'); + late final _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSelectCallback = + _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSelectCallbackPtr + .asFunction)>(); + + void + rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSelectCallback( + ffi.Pointer ptr, + ) { + return _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSelectCallback( + ptr, + ); + } + + late final _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSelectCallbackPtr = + _lookup)>>( + 'frbgen_aria_rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSelectCallback'); + late final _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSelectCallback = + _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSelectCallbackPtr + .asFunction)>(); + + void + rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSwitchCallback( + ffi.Pointer ptr, + ) { + return _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSwitchCallback( + ptr, + ); + } + + late final _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSwitchCallbackPtr = + _lookup)>>( + 'frbgen_aria_rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSwitchCallback'); + late final _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSwitchCallback = + _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSwitchCallbackPtr + .asFunction)>(); + + void + rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSwitchCallback( + ffi.Pointer ptr, + ) { + return _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSwitchCallback( + ptr, + ); + } + + late final _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSwitchCallbackPtr = + _lookup)>>( + 'frbgen_aria_rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSwitchCallback'); + late final _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSwitchCallback = + _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSwitchCallbackPtr + .asFunction)>(); + + void + rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextInputCallback( + ffi.Pointer ptr, + ) { + return _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextInputCallback( + ptr, + ); + } + + late final _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextInputCallbackPtr = + _lookup)>>( + 'frbgen_aria_rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextInputCallback'); + late final _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextInputCallback = + _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextInputCallbackPtr + .asFunction)>(); + + void + rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextInputCallback( + ffi.Pointer ptr, + ) { + return _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextInputCallback( + ptr, + ); + } + + late final _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextInputCallbackPtr = + _lookup)>>( + 'frbgen_aria_rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextInputCallback'); + late final _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextInputCallback = + _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextInputCallbackPtr + .asFunction)>(); + + void + rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextareaCallback( + ffi.Pointer ptr, + ) { + return _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextareaCallback( + ptr, + ); + } + + late final _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextareaCallbackPtr = + _lookup)>>( + 'frbgen_aria_rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextareaCallback'); + late final _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextareaCallback = + _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextareaCallbackPtr + .asFunction)>(); + + void + rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextareaCallback( + ffi.Pointer ptr, + ) { + return _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextareaCallback( + ptr, + ); + } + + late final _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextareaCallbackPtr = + _lookup)>>( + 'frbgen_aria_rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextareaCallback'); + late final _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextareaCallback = + _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextareaCallbackPtr + .asFunction)>(); +} diff --git a/lib/rust/frb_generated.web.dart b/lib/rust/frb_generated.web.dart new file mode 100644 index 00000000..68146a2b --- /dev/null +++ b/lib/rust/frb_generated.web.dart @@ -0,0 +1,1602 @@ +// This file is automatically generated, so please do not edit it. +// Generated by `flutter_rust_bridge`@ 2.0.0-dev.39. + +// ignore_for_file: unused_import, unused_element, unnecessary_import, duplicate_ignore, invalid_use_of_internal_member, annotate_overrides, non_constant_identifier_names, curly_braces_in_flow_control_structures, prefer_const_literals_to_create_immutables, unused_field + +// Static analysis wrongly picks the IO variant, thus ignore this +// ignore_for_file: argument_type_not_assignable + +import 'api/aiscript.dart'; +import 'api/aiscript/api.dart'; +import 'api/aiscript/play.dart'; +import 'api/aiscript/ui.dart'; +import 'dart:async'; +import 'dart:convert'; +import 'frb_generated.dart'; +import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated_web.dart'; + +abstract class RustLibApiImplPlatform extends BaseApiImpl { + RustLibApiImplPlatform({ + required super.handler, + required super.wire, + required super.generalizedFrbRustBinding, + required super.portManager, + }); + + CrossPlatformFinalizerArg get rust_arc_decrement_strong_count_AiScriptPtr => wire + .rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAiScript; + + CrossPlatformFinalizerArg get rust_arc_decrement_strong_count_AsApiLibPtr => wire + .rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsApiLib; + + CrossPlatformFinalizerArg + get rust_arc_decrement_strong_count_AsUiButtonCallbackPtr => wire + .rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiButtonCallback; + + CrossPlatformFinalizerArg get rust_arc_decrement_strong_count_AsUiLibPtr => wire + .rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiLib; + + CrossPlatformFinalizerArg + get rust_arc_decrement_strong_count_AsUiMfmCallbackPtr => wire + .rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiMfmCallback; + + CrossPlatformFinalizerArg + get rust_arc_decrement_strong_count_AsUiNumberCallbackPtr => wire + .rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiNumberCallback; + + CrossPlatformFinalizerArg + get rust_arc_decrement_strong_count_AsUiSelectCallbackPtr => wire + .rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSelectCallback; + + CrossPlatformFinalizerArg + get rust_arc_decrement_strong_count_AsUiSwitchCallbackPtr => wire + .rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSwitchCallback; + + CrossPlatformFinalizerArg + get rust_arc_decrement_strong_count_AsUiTextInputCallbackPtr => wire + .rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextInputCallback; + + CrossPlatformFinalizerArg + get rust_arc_decrement_strong_count_AsUiTextareaCallbackPtr => wire + .rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextareaCallback; + + @protected + AnyhowException dco_decode_AnyhowException(dynamic raw); + + @protected + AiScript + dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAiScript( + dynamic raw); + + @protected + AsApiLib + dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsApiLib( + dynamic raw); + + @protected + AsUiButtonCallback + dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiButtonCallback( + dynamic raw); + + @protected + AsUiLib + dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiLib( + dynamic raw); + + @protected + AsUiMfmCallback + dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiMfmCallback( + dynamic raw); + + @protected + AsUiNumberCallback + dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiNumberCallback( + dynamic raw); + + @protected + AsUiSelectCallback + dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSelectCallback( + dynamic raw); + + @protected + AsUiSwitchCallback + dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSwitchCallback( + dynamic raw); + + @protected + AsUiTextInputCallback + dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextInputCallback( + dynamic raw); + + @protected + AsUiTextareaCallback + dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextareaCallback( + dynamic raw); + + @protected + AiScript + dco_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAiScript( + dynamic raw); + + @protected + AsUiButtonCallback + dco_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiButtonCallback( + dynamic raw); + + @protected + AsUiMfmCallback + dco_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiMfmCallback( + dynamic raw); + + @protected + AsUiNumberCallback + dco_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiNumberCallback( + dynamic raw); + + @protected + AsUiSelectCallback + dco_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSelectCallback( + dynamic raw); + + @protected + AsUiSwitchCallback + dco_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSwitchCallback( + dynamic raw); + + @protected + AsUiTextInputCallback + dco_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextInputCallback( + dynamic raw); + + @protected + AsUiTextareaCallback + dco_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextareaCallback( + dynamic raw); + + @protected + FutureOr Function(String) + dco_decode_DartFn_Inputs_String_Output_String_AnyhowException( + dynamic raw); + + @protected + FutureOr Function(String) + dco_decode_DartFn_Inputs_String_Output_unit_AnyhowException(dynamic raw); + + @protected + FutureOr Function(String, String) + dco_decode_DartFn_Inputs_String_String_Output_unit_AnyhowException( + dynamic raw); + + @protected + FutureOr Function(String, String, String) + dco_decode_DartFn_Inputs_String_String_String_Output_bool_AnyhowException( + dynamic raw); + + @protected + FutureOr Function(String, String, String) + dco_decode_DartFn_Inputs_String_String_String_Output_unit_AnyhowException( + dynamic raw); + + @protected + FutureOr<(String, String?)> Function(String, String, String?) + dco_decode_DartFn_Inputs_String_String_opt_String_Output_record_string_opt_string_AnyhowException( + dynamic raw); + + @protected + FutureOr Function(String, AsUiComponent) + dco_decode_DartFn_Inputs_String_as_ui_component_Output_unit_AnyhowException( + dynamic raw); + + @protected + Object dco_decode_DartOpaque(dynamic raw); + + @protected + AiScript + dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAiScript( + dynamic raw); + + @protected + AsApiLib + dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsApiLib( + dynamic raw); + + @protected + AsUiButtonCallback + dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiButtonCallback( + dynamic raw); + + @protected + AsUiLib + dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiLib( + dynamic raw); + + @protected + AsUiMfmCallback + dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiMfmCallback( + dynamic raw); + + @protected + AsUiNumberCallback + dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiNumberCallback( + dynamic raw); + + @protected + AsUiSelectCallback + dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSelectCallback( + dynamic raw); + + @protected + AsUiSwitchCallback + dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSwitchCallback( + dynamic raw); + + @protected + AsUiTextInputCallback + dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextInputCallback( + dynamic raw); + + @protected + AsUiTextareaCallback + dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextareaCallback( + dynamic raw); + + @protected + String dco_decode_String(dynamic raw); + + @protected + AsPlayLib dco_decode_as_play_lib(dynamic raw); + + @protected + AsUiButton dco_decode_as_ui_button(dynamic raw); + + @protected + AsUiButtons dco_decode_as_ui_buttons(dynamic raw); + + @protected + AsUiComponent dco_decode_as_ui_component(dynamic raw); + + @protected + AsUiContainer dco_decode_as_ui_container(dynamic raw); + + @protected + AsUiFolder dco_decode_as_ui_folder(dynamic raw); + + @protected + AsUiMfm dco_decode_as_ui_mfm(dynamic raw); + + @protected + AsUiNumberInput dco_decode_as_ui_number_input(dynamic raw); + + @protected + AsUiPostForm dco_decode_as_ui_post_form(dynamic raw); + + @protected + AsUiPostFormButton dco_decode_as_ui_post_form_button(dynamic raw); + + @protected + AsUiRoot dco_decode_as_ui_root(dynamic raw); + + @protected + AsUiSelect dco_decode_as_ui_select(dynamic raw); + + @protected + AsUiSwitch dco_decode_as_ui_switch(dynamic raw); + + @protected + AsUiText dco_decode_as_ui_text(dynamic raw); + + @protected + AsUiTextInput dco_decode_as_ui_text_input(dynamic raw); + + @protected + AsUiTextarea dco_decode_as_ui_textarea(dynamic raw); + + @protected + bool dco_decode_bool(dynamic raw); + + @protected + AsApiLib + dco_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsApiLib( + dynamic raw); + + @protected + AsUiButtonCallback + dco_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiButtonCallback( + dynamic raw); + + @protected + AsUiLib + dco_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiLib( + dynamic raw); + + @protected + AsUiMfmCallback + dco_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiMfmCallback( + dynamic raw); + + @protected + AsUiNumberCallback + dco_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiNumberCallback( + dynamic raw); + + @protected + AsUiSelectCallback + dco_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSelectCallback( + dynamic raw); + + @protected + AsUiSwitchCallback + dco_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSwitchCallback( + dynamic raw); + + @protected + AsUiTextInputCallback + dco_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextInputCallback( + dynamic raw); + + @protected + AsUiTextareaCallback + dco_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextareaCallback( + dynamic raw); + + @protected + AsPlayLib dco_decode_box_autoadd_as_play_lib(dynamic raw); + + @protected + AsUiButton dco_decode_box_autoadd_as_ui_button(dynamic raw); + + @protected + AsUiButtons dco_decode_box_autoadd_as_ui_buttons(dynamic raw); + + @protected + AsUiContainer dco_decode_box_autoadd_as_ui_container(dynamic raw); + + @protected + AsUiFolder dco_decode_box_autoadd_as_ui_folder(dynamic raw); + + @protected + AsUiMfm dco_decode_box_autoadd_as_ui_mfm(dynamic raw); + + @protected + AsUiNumberInput dco_decode_box_autoadd_as_ui_number_input(dynamic raw); + + @protected + AsUiPostForm dco_decode_box_autoadd_as_ui_post_form(dynamic raw); + + @protected + AsUiPostFormButton dco_decode_box_autoadd_as_ui_post_form_button(dynamic raw); + + @protected + AsUiRoot dco_decode_box_autoadd_as_ui_root(dynamic raw); + + @protected + AsUiSelect dco_decode_box_autoadd_as_ui_select(dynamic raw); + + @protected + AsUiSwitch dco_decode_box_autoadd_as_ui_switch(dynamic raw); + + @protected + AsUiText dco_decode_box_autoadd_as_ui_text(dynamic raw); + + @protected + AsUiTextInput dco_decode_box_autoadd_as_ui_text_input(dynamic raw); + + @protected + AsUiTextarea dco_decode_box_autoadd_as_ui_textarea(dynamic raw); + + @protected + bool dco_decode_box_autoadd_bool(dynamic raw); + + @protected + double dco_decode_box_autoadd_f_64(dynamic raw); + + @protected + PostFormPropsForAsUi dco_decode_box_autoadd_post_form_props_for_as_ui( + dynamic raw); + + @protected + double dco_decode_f_64(dynamic raw); + + @protected + List dco_decode_list_String(dynamic raw); + + @protected + List dco_decode_list_as_ui_button(dynamic raw); + + @protected + Uint8List dco_decode_list_prim_u_8_strict(dynamic raw); + + @protected + List<(String, String)> dco_decode_list_record_string_string(dynamic raw); + + @protected + String? dco_decode_opt_String(dynamic raw); + + @protected + AsApiLib? + dco_decode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsApiLib( + dynamic raw); + + @protected + AsUiButtonCallback? + dco_decode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiButtonCallback( + dynamic raw); + + @protected + AsUiLib? + dco_decode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiLib( + dynamic raw); + + @protected + AsUiMfmCallback? + dco_decode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiMfmCallback( + dynamic raw); + + @protected + AsUiNumberCallback? + dco_decode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiNumberCallback( + dynamic raw); + + @protected + AsUiSelectCallback? + dco_decode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSelectCallback( + dynamic raw); + + @protected + AsUiSwitchCallback? + dco_decode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSwitchCallback( + dynamic raw); + + @protected + AsUiTextInputCallback? + dco_decode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextInputCallback( + dynamic raw); + + @protected + AsUiTextareaCallback? + dco_decode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextareaCallback( + dynamic raw); + + @protected + AsPlayLib? dco_decode_opt_box_autoadd_as_play_lib(dynamic raw); + + @protected + bool? dco_decode_opt_box_autoadd_bool(dynamic raw); + + @protected + double? dco_decode_opt_box_autoadd_f_64(dynamic raw); + + @protected + PostFormPropsForAsUi? dco_decode_opt_box_autoadd_post_form_props_for_as_ui( + dynamic raw); + + @protected + List? dco_decode_opt_list_String(dynamic raw); + + @protected + List? dco_decode_opt_list_as_ui_button(dynamic raw); + + @protected + List<(String, String)>? dco_decode_opt_list_record_string_string(dynamic raw); + + @protected + PostFormPropsForAsUi dco_decode_post_form_props_for_as_ui(dynamic raw); + + @protected + (String, String?) dco_decode_record_string_opt_string(dynamic raw); + + @protected + (String, String) dco_decode_record_string_string(dynamic raw); + + @protected + int dco_decode_u_8(dynamic raw); + + @protected + void dco_decode_unit(dynamic raw); + + @protected + BigInt dco_decode_usize(dynamic raw); + + @protected + AnyhowException sse_decode_AnyhowException(SseDeserializer deserializer); + + @protected + AiScript + sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAiScript( + SseDeserializer deserializer); + + @protected + AsApiLib + sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsApiLib( + SseDeserializer deserializer); + + @protected + AsUiButtonCallback + sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiButtonCallback( + SseDeserializer deserializer); + + @protected + AsUiLib + sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiLib( + SseDeserializer deserializer); + + @protected + AsUiMfmCallback + sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiMfmCallback( + SseDeserializer deserializer); + + @protected + AsUiNumberCallback + sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiNumberCallback( + SseDeserializer deserializer); + + @protected + AsUiSelectCallback + sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSelectCallback( + SseDeserializer deserializer); + + @protected + AsUiSwitchCallback + sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSwitchCallback( + SseDeserializer deserializer); + + @protected + AsUiTextInputCallback + sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextInputCallback( + SseDeserializer deserializer); + + @protected + AsUiTextareaCallback + sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextareaCallback( + SseDeserializer deserializer); + + @protected + AiScript + sse_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAiScript( + SseDeserializer deserializer); + + @protected + AsUiButtonCallback + sse_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiButtonCallback( + SseDeserializer deserializer); + + @protected + AsUiMfmCallback + sse_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiMfmCallback( + SseDeserializer deserializer); + + @protected + AsUiNumberCallback + sse_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiNumberCallback( + SseDeserializer deserializer); + + @protected + AsUiSelectCallback + sse_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSelectCallback( + SseDeserializer deserializer); + + @protected + AsUiSwitchCallback + sse_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSwitchCallback( + SseDeserializer deserializer); + + @protected + AsUiTextInputCallback + sse_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextInputCallback( + SseDeserializer deserializer); + + @protected + AsUiTextareaCallback + sse_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextareaCallback( + SseDeserializer deserializer); + + @protected + Object sse_decode_DartOpaque(SseDeserializer deserializer); + + @protected + AiScript + sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAiScript( + SseDeserializer deserializer); + + @protected + AsApiLib + sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsApiLib( + SseDeserializer deserializer); + + @protected + AsUiButtonCallback + sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiButtonCallback( + SseDeserializer deserializer); + + @protected + AsUiLib + sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiLib( + SseDeserializer deserializer); + + @protected + AsUiMfmCallback + sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiMfmCallback( + SseDeserializer deserializer); + + @protected + AsUiNumberCallback + sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiNumberCallback( + SseDeserializer deserializer); + + @protected + AsUiSelectCallback + sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSelectCallback( + SseDeserializer deserializer); + + @protected + AsUiSwitchCallback + sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSwitchCallback( + SseDeserializer deserializer); + + @protected + AsUiTextInputCallback + sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextInputCallback( + SseDeserializer deserializer); + + @protected + AsUiTextareaCallback + sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextareaCallback( + SseDeserializer deserializer); + + @protected + String sse_decode_String(SseDeserializer deserializer); + + @protected + AsPlayLib sse_decode_as_play_lib(SseDeserializer deserializer); + + @protected + AsUiButton sse_decode_as_ui_button(SseDeserializer deserializer); + + @protected + AsUiButtons sse_decode_as_ui_buttons(SseDeserializer deserializer); + + @protected + AsUiComponent sse_decode_as_ui_component(SseDeserializer deserializer); + + @protected + AsUiContainer sse_decode_as_ui_container(SseDeserializer deserializer); + + @protected + AsUiFolder sse_decode_as_ui_folder(SseDeserializer deserializer); + + @protected + AsUiMfm sse_decode_as_ui_mfm(SseDeserializer deserializer); + + @protected + AsUiNumberInput sse_decode_as_ui_number_input(SseDeserializer deserializer); + + @protected + AsUiPostForm sse_decode_as_ui_post_form(SseDeserializer deserializer); + + @protected + AsUiPostFormButton sse_decode_as_ui_post_form_button( + SseDeserializer deserializer); + + @protected + AsUiRoot sse_decode_as_ui_root(SseDeserializer deserializer); + + @protected + AsUiSelect sse_decode_as_ui_select(SseDeserializer deserializer); + + @protected + AsUiSwitch sse_decode_as_ui_switch(SseDeserializer deserializer); + + @protected + AsUiText sse_decode_as_ui_text(SseDeserializer deserializer); + + @protected + AsUiTextInput sse_decode_as_ui_text_input(SseDeserializer deserializer); + + @protected + AsUiTextarea sse_decode_as_ui_textarea(SseDeserializer deserializer); + + @protected + bool sse_decode_bool(SseDeserializer deserializer); + + @protected + AsApiLib + sse_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsApiLib( + SseDeserializer deserializer); + + @protected + AsUiButtonCallback + sse_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiButtonCallback( + SseDeserializer deserializer); + + @protected + AsUiLib + sse_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiLib( + SseDeserializer deserializer); + + @protected + AsUiMfmCallback + sse_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiMfmCallback( + SseDeserializer deserializer); + + @protected + AsUiNumberCallback + sse_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiNumberCallback( + SseDeserializer deserializer); + + @protected + AsUiSelectCallback + sse_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSelectCallback( + SseDeserializer deserializer); + + @protected + AsUiSwitchCallback + sse_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSwitchCallback( + SseDeserializer deserializer); + + @protected + AsUiTextInputCallback + sse_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextInputCallback( + SseDeserializer deserializer); + + @protected + AsUiTextareaCallback + sse_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextareaCallback( + SseDeserializer deserializer); + + @protected + AsPlayLib sse_decode_box_autoadd_as_play_lib(SseDeserializer deserializer); + + @protected + AsUiButton sse_decode_box_autoadd_as_ui_button(SseDeserializer deserializer); + + @protected + AsUiButtons sse_decode_box_autoadd_as_ui_buttons( + SseDeserializer deserializer); + + @protected + AsUiContainer sse_decode_box_autoadd_as_ui_container( + SseDeserializer deserializer); + + @protected + AsUiFolder sse_decode_box_autoadd_as_ui_folder(SseDeserializer deserializer); + + @protected + AsUiMfm sse_decode_box_autoadd_as_ui_mfm(SseDeserializer deserializer); + + @protected + AsUiNumberInput sse_decode_box_autoadd_as_ui_number_input( + SseDeserializer deserializer); + + @protected + AsUiPostForm sse_decode_box_autoadd_as_ui_post_form( + SseDeserializer deserializer); + + @protected + AsUiPostFormButton sse_decode_box_autoadd_as_ui_post_form_button( + SseDeserializer deserializer); + + @protected + AsUiRoot sse_decode_box_autoadd_as_ui_root(SseDeserializer deserializer); + + @protected + AsUiSelect sse_decode_box_autoadd_as_ui_select(SseDeserializer deserializer); + + @protected + AsUiSwitch sse_decode_box_autoadd_as_ui_switch(SseDeserializer deserializer); + + @protected + AsUiText sse_decode_box_autoadd_as_ui_text(SseDeserializer deserializer); + + @protected + AsUiTextInput sse_decode_box_autoadd_as_ui_text_input( + SseDeserializer deserializer); + + @protected + AsUiTextarea sse_decode_box_autoadd_as_ui_textarea( + SseDeserializer deserializer); + + @protected + bool sse_decode_box_autoadd_bool(SseDeserializer deserializer); + + @protected + double sse_decode_box_autoadd_f_64(SseDeserializer deserializer); + + @protected + PostFormPropsForAsUi sse_decode_box_autoadd_post_form_props_for_as_ui( + SseDeserializer deserializer); + + @protected + double sse_decode_f_64(SseDeserializer deserializer); + + @protected + List sse_decode_list_String(SseDeserializer deserializer); + + @protected + List sse_decode_list_as_ui_button(SseDeserializer deserializer); + + @protected + Uint8List sse_decode_list_prim_u_8_strict(SseDeserializer deserializer); + + @protected + List<(String, String)> sse_decode_list_record_string_string( + SseDeserializer deserializer); + + @protected + String? sse_decode_opt_String(SseDeserializer deserializer); + + @protected + AsApiLib? + sse_decode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsApiLib( + SseDeserializer deserializer); + + @protected + AsUiButtonCallback? + sse_decode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiButtonCallback( + SseDeserializer deserializer); + + @protected + AsUiLib? + sse_decode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiLib( + SseDeserializer deserializer); + + @protected + AsUiMfmCallback? + sse_decode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiMfmCallback( + SseDeserializer deserializer); + + @protected + AsUiNumberCallback? + sse_decode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiNumberCallback( + SseDeserializer deserializer); + + @protected + AsUiSelectCallback? + sse_decode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSelectCallback( + SseDeserializer deserializer); + + @protected + AsUiSwitchCallback? + sse_decode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSwitchCallback( + SseDeserializer deserializer); + + @protected + AsUiTextInputCallback? + sse_decode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextInputCallback( + SseDeserializer deserializer); + + @protected + AsUiTextareaCallback? + sse_decode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextareaCallback( + SseDeserializer deserializer); + + @protected + AsPlayLib? sse_decode_opt_box_autoadd_as_play_lib( + SseDeserializer deserializer); + + @protected + bool? sse_decode_opt_box_autoadd_bool(SseDeserializer deserializer); + + @protected + double? sse_decode_opt_box_autoadd_f_64(SseDeserializer deserializer); + + @protected + PostFormPropsForAsUi? sse_decode_opt_box_autoadd_post_form_props_for_as_ui( + SseDeserializer deserializer); + + @protected + List? sse_decode_opt_list_String(SseDeserializer deserializer); + + @protected + List? sse_decode_opt_list_as_ui_button( + SseDeserializer deserializer); + + @protected + List<(String, String)>? sse_decode_opt_list_record_string_string( + SseDeserializer deserializer); + + @protected + PostFormPropsForAsUi sse_decode_post_form_props_for_as_ui( + SseDeserializer deserializer); + + @protected + (String, String?) sse_decode_record_string_opt_string( + SseDeserializer deserializer); + + @protected + (String, String) sse_decode_record_string_string( + SseDeserializer deserializer); + + @protected + int sse_decode_u_8(SseDeserializer deserializer); + + @protected + void sse_decode_unit(SseDeserializer deserializer); + + @protected + BigInt sse_decode_usize(SseDeserializer deserializer); + + @protected + int sse_decode_i_32(SseDeserializer deserializer); + + @protected + void sse_encode_AnyhowException( + AnyhowException self, SseSerializer serializer); + + @protected + void + sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAiScript( + AiScript self, SseSerializer serializer); + + @protected + void + sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsApiLib( + AsApiLib self, SseSerializer serializer); + + @protected + void + sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiButtonCallback( + AsUiButtonCallback self, SseSerializer serializer); + + @protected + void + sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiLib( + AsUiLib self, SseSerializer serializer); + + @protected + void + sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiMfmCallback( + AsUiMfmCallback self, SseSerializer serializer); + + @protected + void + sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiNumberCallback( + AsUiNumberCallback self, SseSerializer serializer); + + @protected + void + sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSelectCallback( + AsUiSelectCallback self, SseSerializer serializer); + + @protected + void + sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSwitchCallback( + AsUiSwitchCallback self, SseSerializer serializer); + + @protected + void + sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextInputCallback( + AsUiTextInputCallback self, SseSerializer serializer); + + @protected + void + sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextareaCallback( + AsUiTextareaCallback self, SseSerializer serializer); + + @protected + void + sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAiScript( + AiScript self, SseSerializer serializer); + + @protected + void + sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiButtonCallback( + AsUiButtonCallback self, SseSerializer serializer); + + @protected + void + sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiMfmCallback( + AsUiMfmCallback self, SseSerializer serializer); + + @protected + void + sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiNumberCallback( + AsUiNumberCallback self, SseSerializer serializer); + + @protected + void + sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSelectCallback( + AsUiSelectCallback self, SseSerializer serializer); + + @protected + void + sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSwitchCallback( + AsUiSwitchCallback self, SseSerializer serializer); + + @protected + void + sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextInputCallback( + AsUiTextInputCallback self, SseSerializer serializer); + + @protected + void + sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextareaCallback( + AsUiTextareaCallback self, SseSerializer serializer); + + @protected + void sse_encode_DartFn_Inputs_String_Output_String_AnyhowException( + FutureOr Function(String) self, SseSerializer serializer); + + @protected + void sse_encode_DartFn_Inputs_String_Output_unit_AnyhowException( + FutureOr Function(String) self, SseSerializer serializer); + + @protected + void sse_encode_DartFn_Inputs_String_String_Output_unit_AnyhowException( + FutureOr Function(String, String) self, SseSerializer serializer); + + @protected + void + sse_encode_DartFn_Inputs_String_String_String_Output_bool_AnyhowException( + FutureOr Function(String, String, String) self, + SseSerializer serializer); + + @protected + void + sse_encode_DartFn_Inputs_String_String_String_Output_unit_AnyhowException( + FutureOr Function(String, String, String) self, + SseSerializer serializer); + + @protected + void + sse_encode_DartFn_Inputs_String_String_opt_String_Output_record_string_opt_string_AnyhowException( + FutureOr<(String, String?)> Function(String, String, String?) self, + SseSerializer serializer); + + @protected + void + sse_encode_DartFn_Inputs_String_as_ui_component_Output_unit_AnyhowException( + FutureOr Function(String, AsUiComponent) self, + SseSerializer serializer); + + @protected + void sse_encode_DartOpaque(Object self, SseSerializer serializer); + + @protected + void + sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAiScript( + AiScript self, SseSerializer serializer); + + @protected + void + sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsApiLib( + AsApiLib self, SseSerializer serializer); + + @protected + void + sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiButtonCallback( + AsUiButtonCallback self, SseSerializer serializer); + + @protected + void + sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiLib( + AsUiLib self, SseSerializer serializer); + + @protected + void + sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiMfmCallback( + AsUiMfmCallback self, SseSerializer serializer); + + @protected + void + sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiNumberCallback( + AsUiNumberCallback self, SseSerializer serializer); + + @protected + void + sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSelectCallback( + AsUiSelectCallback self, SseSerializer serializer); + + @protected + void + sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSwitchCallback( + AsUiSwitchCallback self, SseSerializer serializer); + + @protected + void + sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextInputCallback( + AsUiTextInputCallback self, SseSerializer serializer); + + @protected + void + sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextareaCallback( + AsUiTextareaCallback self, SseSerializer serializer); + + @protected + void sse_encode_String(String self, SseSerializer serializer); + + @protected + void sse_encode_as_play_lib(AsPlayLib self, SseSerializer serializer); + + @protected + void sse_encode_as_ui_button(AsUiButton self, SseSerializer serializer); + + @protected + void sse_encode_as_ui_buttons(AsUiButtons self, SseSerializer serializer); + + @protected + void sse_encode_as_ui_component(AsUiComponent self, SseSerializer serializer); + + @protected + void sse_encode_as_ui_container(AsUiContainer self, SseSerializer serializer); + + @protected + void sse_encode_as_ui_folder(AsUiFolder self, SseSerializer serializer); + + @protected + void sse_encode_as_ui_mfm(AsUiMfm self, SseSerializer serializer); + + @protected + void sse_encode_as_ui_number_input( + AsUiNumberInput self, SseSerializer serializer); + + @protected + void sse_encode_as_ui_post_form(AsUiPostForm self, SseSerializer serializer); + + @protected + void sse_encode_as_ui_post_form_button( + AsUiPostFormButton self, SseSerializer serializer); + + @protected + void sse_encode_as_ui_root(AsUiRoot self, SseSerializer serializer); + + @protected + void sse_encode_as_ui_select(AsUiSelect self, SseSerializer serializer); + + @protected + void sse_encode_as_ui_switch(AsUiSwitch self, SseSerializer serializer); + + @protected + void sse_encode_as_ui_text(AsUiText self, SseSerializer serializer); + + @protected + void sse_encode_as_ui_text_input( + AsUiTextInput self, SseSerializer serializer); + + @protected + void sse_encode_as_ui_textarea(AsUiTextarea self, SseSerializer serializer); + + @protected + void sse_encode_bool(bool self, SseSerializer serializer); + + @protected + void + sse_encode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsApiLib( + AsApiLib self, SseSerializer serializer); + + @protected + void + sse_encode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiButtonCallback( + AsUiButtonCallback self, SseSerializer serializer); + + @protected + void + sse_encode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiLib( + AsUiLib self, SseSerializer serializer); + + @protected + void + sse_encode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiMfmCallback( + AsUiMfmCallback self, SseSerializer serializer); + + @protected + void + sse_encode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiNumberCallback( + AsUiNumberCallback self, SseSerializer serializer); + + @protected + void + sse_encode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSelectCallback( + AsUiSelectCallback self, SseSerializer serializer); + + @protected + void + sse_encode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSwitchCallback( + AsUiSwitchCallback self, SseSerializer serializer); + + @protected + void + sse_encode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextInputCallback( + AsUiTextInputCallback self, SseSerializer serializer); + + @protected + void + sse_encode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextareaCallback( + AsUiTextareaCallback self, SseSerializer serializer); + + @protected + void sse_encode_box_autoadd_as_play_lib( + AsPlayLib self, SseSerializer serializer); + + @protected + void sse_encode_box_autoadd_as_ui_button( + AsUiButton self, SseSerializer serializer); + + @protected + void sse_encode_box_autoadd_as_ui_buttons( + AsUiButtons self, SseSerializer serializer); + + @protected + void sse_encode_box_autoadd_as_ui_container( + AsUiContainer self, SseSerializer serializer); + + @protected + void sse_encode_box_autoadd_as_ui_folder( + AsUiFolder self, SseSerializer serializer); + + @protected + void sse_encode_box_autoadd_as_ui_mfm(AsUiMfm self, SseSerializer serializer); + + @protected + void sse_encode_box_autoadd_as_ui_number_input( + AsUiNumberInput self, SseSerializer serializer); + + @protected + void sse_encode_box_autoadd_as_ui_post_form( + AsUiPostForm self, SseSerializer serializer); + + @protected + void sse_encode_box_autoadd_as_ui_post_form_button( + AsUiPostFormButton self, SseSerializer serializer); + + @protected + void sse_encode_box_autoadd_as_ui_root( + AsUiRoot self, SseSerializer serializer); + + @protected + void sse_encode_box_autoadd_as_ui_select( + AsUiSelect self, SseSerializer serializer); + + @protected + void sse_encode_box_autoadd_as_ui_switch( + AsUiSwitch self, SseSerializer serializer); + + @protected + void sse_encode_box_autoadd_as_ui_text( + AsUiText self, SseSerializer serializer); + + @protected + void sse_encode_box_autoadd_as_ui_text_input( + AsUiTextInput self, SseSerializer serializer); + + @protected + void sse_encode_box_autoadd_as_ui_textarea( + AsUiTextarea self, SseSerializer serializer); + + @protected + void sse_encode_box_autoadd_bool(bool self, SseSerializer serializer); + + @protected + void sse_encode_box_autoadd_f_64(double self, SseSerializer serializer); + + @protected + void sse_encode_box_autoadd_post_form_props_for_as_ui( + PostFormPropsForAsUi self, SseSerializer serializer); + + @protected + void sse_encode_f_64(double self, SseSerializer serializer); + + @protected + void sse_encode_list_String(List self, SseSerializer serializer); + + @protected + void sse_encode_list_as_ui_button( + List self, SseSerializer serializer); + + @protected + void sse_encode_list_prim_u_8_strict( + Uint8List self, SseSerializer serializer); + + @protected + void sse_encode_list_record_string_string( + List<(String, String)> self, SseSerializer serializer); + + @protected + void sse_encode_opt_String(String? self, SseSerializer serializer); + + @protected + void + sse_encode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsApiLib( + AsApiLib? self, SseSerializer serializer); + + @protected + void + sse_encode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiButtonCallback( + AsUiButtonCallback? self, SseSerializer serializer); + + @protected + void + sse_encode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiLib( + AsUiLib? self, SseSerializer serializer); + + @protected + void + sse_encode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiMfmCallback( + AsUiMfmCallback? self, SseSerializer serializer); + + @protected + void + sse_encode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiNumberCallback( + AsUiNumberCallback? self, SseSerializer serializer); + + @protected + void + sse_encode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSelectCallback( + AsUiSelectCallback? self, SseSerializer serializer); + + @protected + void + sse_encode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSwitchCallback( + AsUiSwitchCallback? self, SseSerializer serializer); + + @protected + void + sse_encode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextInputCallback( + AsUiTextInputCallback? self, SseSerializer serializer); + + @protected + void + sse_encode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextareaCallback( + AsUiTextareaCallback? self, SseSerializer serializer); + + @protected + void sse_encode_opt_box_autoadd_as_play_lib( + AsPlayLib? self, SseSerializer serializer); + + @protected + void sse_encode_opt_box_autoadd_bool(bool? self, SseSerializer serializer); + + @protected + void sse_encode_opt_box_autoadd_f_64(double? self, SseSerializer serializer); + + @protected + void sse_encode_opt_box_autoadd_post_form_props_for_as_ui( + PostFormPropsForAsUi? self, SseSerializer serializer); + + @protected + void sse_encode_opt_list_String(List? self, SseSerializer serializer); + + @protected + void sse_encode_opt_list_as_ui_button( + List? self, SseSerializer serializer); + + @protected + void sse_encode_opt_list_record_string_string( + List<(String, String)>? self, SseSerializer serializer); + + @protected + void sse_encode_post_form_props_for_as_ui( + PostFormPropsForAsUi self, SseSerializer serializer); + + @protected + void sse_encode_record_string_opt_string( + (String, String?) self, SseSerializer serializer); + + @protected + void sse_encode_record_string_string( + (String, String) self, SseSerializer serializer); + + @protected + void sse_encode_u_8(int self, SseSerializer serializer); + + @protected + void sse_encode_unit(void self, SseSerializer serializer); + + @protected + void sse_encode_usize(BigInt self, SseSerializer serializer); + + @protected + void sse_encode_i_32(int self, SseSerializer serializer); +} + +// Section: wire_class + +class RustLibWire implements BaseWire { + RustLibWire.fromExternalLibrary(ExternalLibrary lib); + + void rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAiScript( + int ptr) => + wasmModule + .rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAiScript( + ptr); + + void rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAiScript( + int ptr) => + wasmModule + .rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAiScript( + ptr); + + void rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsApiLib( + int ptr) => + wasmModule + .rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsApiLib( + ptr); + + void rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsApiLib( + int ptr) => + wasmModule + .rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsApiLib( + ptr); + + void rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiButtonCallback( + int ptr) => + wasmModule + .rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiButtonCallback( + ptr); + + void rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiButtonCallback( + int ptr) => + wasmModule + .rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiButtonCallback( + ptr); + + void rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiLib( + int ptr) => + wasmModule + .rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiLib( + ptr); + + void rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiLib( + int ptr) => + wasmModule + .rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiLib( + ptr); + + void rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiMfmCallback( + int ptr) => + wasmModule + .rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiMfmCallback( + ptr); + + void rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiMfmCallback( + int ptr) => + wasmModule + .rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiMfmCallback( + ptr); + + void rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiNumberCallback( + int ptr) => + wasmModule + .rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiNumberCallback( + ptr); + + void rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiNumberCallback( + int ptr) => + wasmModule + .rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiNumberCallback( + ptr); + + void rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSelectCallback( + int ptr) => + wasmModule + .rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSelectCallback( + ptr); + + void rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSelectCallback( + int ptr) => + wasmModule + .rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSelectCallback( + ptr); + + void rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSwitchCallback( + int ptr) => + wasmModule + .rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSwitchCallback( + ptr); + + void rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSwitchCallback( + int ptr) => + wasmModule + .rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSwitchCallback( + ptr); + + void rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextInputCallback( + int ptr) => + wasmModule + .rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextInputCallback( + ptr); + + void rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextInputCallback( + int ptr) => + wasmModule + .rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextInputCallback( + ptr); + + void rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextareaCallback( + int ptr) => + wasmModule + .rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextareaCallback( + ptr); + + void rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextareaCallback( + int ptr) => + wasmModule + .rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextareaCallback( + ptr); +} + +@JS('wasm_bindgen') +external RustLibWasmModule get wasmModule; + +@JS() +@anonymous +extension type RustLibWasmModule._(JSObject _) implements JSObject { + external void + rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAiScript( + int ptr); + + external void + rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAiScript( + int ptr); + + external void + rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsApiLib( + int ptr); + + external void + rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsApiLib( + int ptr); + + external void + rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiButtonCallback( + int ptr); + + external void + rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiButtonCallback( + int ptr); + + external void + rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiLib( + int ptr); + + external void + rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiLib( + int ptr); + + external void + rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiMfmCallback( + int ptr); + + external void + rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiMfmCallback( + int ptr); + + external void + rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiNumberCallback( + int ptr); + + external void + rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiNumberCallback( + int ptr); + + external void + rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSelectCallback( + int ptr); + + external void + rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSelectCallback( + int ptr); + + external void + rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSwitchCallback( + int ptr); + + external void + rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSwitchCallback( + int ptr); + + external void + rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextInputCallback( + int ptr); + + external void + rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextInputCallback( + int ptr); + + external void + rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextareaCallback( + int ptr); + + external void + rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextareaCallback( + int ptr); +} diff --git a/lib/util/future_with_dialog.dart b/lib/util/future_with_dialog.dart index 436da451..964bbade 100644 --- a/lib/util/future_with_dialog.dart +++ b/lib/util/future_with_dialog.dart @@ -44,12 +44,10 @@ Future futureWithDialog( } catch (e, st) { if (!context.mounted) return null; context.pop(); - await showDialog( - context: context, - builder: (context) => ErrorMessageDialog( - error: e, - stackTrace: st, - ), + await showErrorMessageDialog( + context, + error: e, + stackTrace: st, ); return null; } diff --git a/lib/util/navigate.dart b/lib/util/navigate.dart index 347571b2..4dfd66c4 100644 --- a/lib/util/navigate.dart +++ b/lib/util/navigate.dart @@ -13,6 +13,7 @@ Future navigate(WidgetRef ref, Account account, String link) async { 'clips' || 'gallery' || 'notes' || + 'play' || 'pages' || 'tags' || 'users') { diff --git a/lib/view/dialog/error_message_dialog.dart b/lib/view/dialog/error_message_dialog.dart index 42156623..acd87651 100644 --- a/lib/view/dialog/error_message_dialog.dart +++ b/lib/view/dialog/error_message_dialog.dart @@ -4,6 +4,20 @@ import 'package:go_router/go_router.dart'; import '../../i18n/strings.g.dart'; import '../widget/error_message.dart'; +Future showErrorMessageDialog( + BuildContext context, { + Object? error, + StackTrace? stackTrace, +}) async { + await showDialog( + context: context, + builder: (context) => ErrorMessageDialog( + error: error, + stackTrace: stackTrace, + ), + ); +} + class ErrorMessageDialog extends StatelessWidget { const ErrorMessageDialog({ super.key, diff --git a/lib/view/dialog/user_select_dialog.dart b/lib/view/dialog/user_select_dialog.dart index ee9d0ce6..87f850c5 100644 --- a/lib/view/dialog/user_select_dialog.dart +++ b/lib/view/dialog/user_select_dialog.dart @@ -11,7 +11,7 @@ import '../../provider/api/i_notifier_provider.dart'; import '../../provider/api/search_users_by_username_provider.dart'; import '../../provider/recently_used_users_notifier_provider.dart'; import '../widget/error_message.dart'; -import '../widget/user_tile.dart'; +import '../widget/user_preview.dart'; Future selectUser( BuildContext context, @@ -108,7 +108,7 @@ class UserSelectDialog extends HookConsumerWidget { child: switch (users) { null => recentlyUsedUsers.isNotEmpty ? ListView.separated( - itemBuilder: (context, index) => UserTile( + itemBuilder: (context, index) => UserPreview( account: account, user: recentlyUsedUsers[index], onTap: () => context.pop(recentlyUsedUsers[index]), @@ -122,7 +122,7 @@ class UserSelectDialog extends HookConsumerWidget { : ListView.separated( itemBuilder: (context, index) => includeSelf || users[index].id != i?.id - ? UserTile( + ? UserPreview( account: account, user: users[index], onTap: () { diff --git a/lib/view/page/gallery/gallery_post_page.dart b/lib/view/page/gallery/gallery_post_page.dart index 87890d1f..aae56fdd 100644 --- a/lib/view/page/gallery/gallery_post_page.dart +++ b/lib/view/page/gallery/gallery_post_page.dart @@ -22,7 +22,7 @@ import '../../widget/image_widget.dart'; import '../../widget/like_button.dart'; import '../../widget/mfm.dart'; import '../../widget/time_widget.dart'; -import '../../widget/user_tile.dart'; +import '../../widget/user_preview.dart'; class GalleryPostPage extends ConsumerWidget { const GalleryPostPage({ @@ -194,7 +194,7 @@ class GalleryPostPage extends ConsumerWidget { ), ), const Divider(), - UserTile( + UserPreview( account: account, user: post.user, avatarSize: 50.0, @@ -255,7 +255,10 @@ class GalleryPostPage extends ConsumerWidget { ), Padding( padding: const EdgeInsets.symmetric(vertical: 8.0), - child: AdWidget(account: account), + child: ClipRRect( + borderRadius: BorderRadius.circular(8.0), + child: AdWidget(account: account), + ), ), Builder( builder: (context) => ExpansionTile( diff --git a/lib/view/page/page/page_page.dart b/lib/view/page/page/page_page.dart index 30c14a6e..360ebcba 100644 --- a/lib/view/page/page/page_page.dart +++ b/lib/view/page/page/page_page.dart @@ -28,7 +28,7 @@ import '../../widget/page_preview.dart'; import '../../widget/time_widget.dart'; import '../../widget/url_preview.dart'; import '../../widget/user_avatar.dart'; -import '../../widget/user_tile.dart'; +import '../../widget/user_preview.dart'; import '../../widget/username_widget.dart'; class PagePage extends ConsumerWidget { @@ -349,7 +349,7 @@ class PagePage extends ConsumerWidget { ), Material( color: Theme.of(context).colorScheme.surface, - child: UserTile( + child: UserPreview( account: account, user: page.user, avatarSize: 50.0, @@ -427,7 +427,10 @@ class PagePage extends ConsumerWidget { color: Theme.of(context).colorScheme.surface, ), ), - AdWidget(account: account), + ClipRRect( + borderRadius: BorderRadius.circular(8.0), + child: AdWidget(account: account), + ), Builder( builder: (context) => ExpansionTile( leading: const Icon(Icons.schedule), diff --git a/lib/view/page/play/play_edit_page.dart b/lib/view/page/play/play_edit_page.dart new file mode 100644 index 00000000..14bb623d --- /dev/null +++ b/lib/view/page/play/play_edit_page.dart @@ -0,0 +1,193 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_hooks/flutter_hooks.dart'; +import 'package:go_router/go_router.dart'; +import 'package:hooks_riverpod/hooks_riverpod.dart'; +import 'package:misskey_dart/misskey_dart.dart' hide Clip; + +import '../../../constant/shortcuts.dart'; +import '../../../i18n/strings.g.dart'; +import '../../../model/account.dart'; +import '../../../provider/api/misskey_provider.dart'; +import '../../../provider/api/play_notifier_provider.dart'; +import '../../../util/future_with_dialog.dart'; +import '../../dialog/confirmation_dialog.dart'; + +class PlayEditPage extends HookConsumerWidget { + const PlayEditPage({ + super.key, + required this.account, + this.playId, + }); + + final Account account; + final String? playId; + + @override + Widget build(BuildContext context, WidgetRef ref) { + final play = playId != null + ? ref.watch(playNotifierProvider(account, playId!)).valueOrNull + : null; + final title = useState(play?.title); + final summary = useState(play?.summary); + final script = useState(play?.script); + final public = useState(true); + final titleController = useTextEditingController(text: play?.title); + final summaryController = useTextEditingController(text: play?.summary); + final scriptController = useTextEditingController(text: play?.script); + useEffect( + () { + titleController.addListener(() => title.value = titleController.text); + summaryController + .addListener(() => summary.value = summaryController.text); + scriptController + .addListener(() => script.value = scriptController.text); + return; + }, + [], + ); + + return Scaffold( + appBar: AppBar( + title: Text( + playId == null + ? t.misskey.play_.new_ + : '${t.misskey.play_.edit}: ${play?.title ?? ''}', + ), + actions: playId != null + ? [ + PopupMenuButton( + itemBuilder: (context) => [ + PopupMenuItem( + onTap: () async { + final confirmed = await confirm( + context, + message: + t.misskey.deleteAreYouSure(x: play?.title ?? ''), + ); + if (!context.mounted) return; + if (confirmed) { + await futureWithDialog( + context, + ref + .read(misskeyProvider(account)) + .flash + .delete(FlashDeleteRequest(flashId: playId!)), + ); + if (!context.mounted) return; + await context.push('/$account/play'); + } + }, + child: Text( + t.misskey.delete, + style: TextStyle( + color: Theme.of(context).colorScheme.error, + ), + ), + ), + ], + ), + ] + : null, + ), + body: Center( + child: SizedBox( + width: 800.0, + height: double.infinity, + child: ListView( + children: [ + ListTile( + title: Shortcuts( + shortcuts: disablingTextShortcuts, + child: TextField( + controller: titleController, + decoration: + InputDecoration(labelText: t.misskey.play_.title), + textInputAction: TextInputAction.next, + ), + ), + ), + ListTile( + title: Shortcuts( + shortcuts: disablingTextShortcuts, + child: TextField( + controller: summaryController, + decoration: InputDecoration( + labelText: t.misskey.play_.summary, + alignLabelWithHint: true, + ), + textInputAction: TextInputAction.next, + minLines: 3, + maxLines: 10, + ), + ), + ), + ListTile( + title: Shortcuts( + shortcuts: disablingTextShortcuts, + child: TextField( + controller: scriptController, + decoration: InputDecoration( + labelText: t.misskey.play_.script, + alignLabelWithHint: true, + ), + style: const TextStyle(fontFamily: 'monospace'), + minLines: 10, + maxLines: null, + ), + ), + ), + SwitchListTile( + title: Text(t.misskey.visibility), + subtitle: Text(t.misskey.play_.visibilityDescription), + value: public.value, + onChanged: (value) => public.value = value, + ), + ], + ), + ), + ), + floatingActionButton: FloatingActionButton( + tooltip: t.misskey.save, + onPressed: () async { + if (playId == null) { + final result = await futureWithDialog( + context, + ref.read(misskeyProvider(account)).flash.create( + FlashCreateRequest( + title: title.value ?? 'New Play', + summary: summary.value ?? '', + script: script.value ?? '', + permissions: [], + visibility: public.value + ? FlashVisibility.public + : FlashVisibility.private, + ), + ), + ); + if (!context.mounted) return; + if (result != null) { + context.pop(); + } + } else { + await futureWithDialog( + context, + ref + .read(playNotifierProvider(account, playId!).notifier) + .updatePlay( + title: title.value ?? 'New Play', + summary: summary.value ?? '', + script: script.value ?? '', + visibility: public.value + ? FlashVisibility.public + : FlashVisibility.private, + ), + ); + if (!context.mounted) return; + context.pop(); + } + }, + child: const Icon(Icons.save), + ), + ); + } +} diff --git a/lib/view/page/play/play_page.dart b/lib/view/page/play/play_page.dart new file mode 100644 index 00000000..39ac2908 --- /dev/null +++ b/lib/view/page/play/play_page.dart @@ -0,0 +1,227 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_hooks/flutter_hooks.dart'; +import 'package:go_router/go_router.dart'; +import 'package:hooks_riverpod/hooks_riverpod.dart'; +import 'package:share_plus/share_plus.dart'; +import 'package:url_launcher/url_launcher.dart'; + +import '../../../i18n/strings.g.dart'; +import '../../../model/account.dart'; +import '../../../provider/api/play_notifier_provider.dart'; +import '../../../provider/api/post_notifier_provider.dart'; +import '../../../provider/misskey_colors_provider.dart'; +import '../../../util/copy_text.dart'; +import '../../widget/ad_widget.dart'; +import '../../widget/error_message.dart'; +import '../../widget/follow_button.dart'; +import '../../widget/mfm/code.dart'; +import '../../widget/play_widget.dart'; +import '../../widget/time_widget.dart'; +import '../../widget/user_preview.dart'; + +class PlayPage extends HookConsumerWidget { + const PlayPage({ + super.key, + required this.account, + required this.playId, + }); + + final Account account; + final String playId; + + @override + Widget build(BuildContext context, WidgetRef ref) { + final account = useState(this.account); + final play = ref.watch(playNotifierProvider(this.account, playId)); + final url = Uri.https(this.account.host, 'play/$playId'); + final colors = + ref.watch(misskeyColorsProvider(Theme.of(context).brightness)); + + return Scaffold( + appBar: AppBar( + title: Text(play.valueOrNull?.title ?? 'Play'), + actions: [ + PopupMenuButton( + itemBuilder: (context) => [ + if (!account.value.isGuest) + PopupMenuItem( + onTap: () { + ref + .read( + postNotifierProvider(account.value).notifier, + ) + .setText('${play.valueOrNull?.title} $url'); + context.push('/${account.value}/post'); + }, + child: Text(t.misskey.shareWithNote), + ), + PopupMenuItem( + onTap: () => copyToClipboard(context, url.toString()), + child: Text(t.misskey.copyLink), + ), + PopupMenuItem( + onTap: () => launchUrl( + url, + mode: LaunchMode.externalApplication, + ), + child: Text(t.aria.openInBrowser), + ), + PopupMenuItem( + onTap: () => Share.share('${play.valueOrNull?.title} $url'), + child: Text(t.misskey.share), + ), + if (!account.value.isGuest && + play.valueOrNull?.user.username == account.value.username) + PopupMenuItem( + onTap: () => + context.push('/${account.value}/play/$playId/edit'), + child: Text(t.misskey.edit), + ), + ], + ), + ], + ), + body: switch (play) { + AsyncValue(valueOrNull: final play?) => Center( + child: Container( + width: 700.0, + height: double.infinity, + margin: const EdgeInsets.symmetric(horizontal: 8.0), + child: ListView( + children: [ + PlayWidget( + account: account.value, + host: this.account.host, + play: play, + onAccountChanged: (acct) { + if (acct.host == this.account.host && + acct.username != this.account.username) { + context.push('/$acct/play/$playId'); + } else { + account.value = acct; + } + }, + ), + Card( + margin: const EdgeInsets.symmetric(vertical: 8.0), + elevation: 0.0, + color: colors.panel, + clipBehavior: Clip.hardEdge, + child: ExpansionTile( + leading: const Icon(Icons.code), + title: Text(t.misskey.play_.viewSource), + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: SizedBox( + width: double.infinity, + child: Code(code: play.script), + ), + ), + ], + ), + ), + Card( + margin: const EdgeInsets.symmetric(vertical: 8.0), + elevation: 0.0, + color: colors.panel, + clipBehavior: Clip.hardEdge, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + UserPreview( + account: this.account, + user: play.user, + avatarSize: 50.0, + trailing: this.account == account.value + ? FollowButton( + account: this.account, + userId: play.userId, + ) + : null, + onTap: () => context.push( + this.account == account.value + ? '/${this.account}/users/${play.userId}' + : '/${account.value}/@${play.user.username}@${this.account.host}', + ), + ), + const Divider(), + DefaultTextStyle.merge( + style: TextStyle( + color: Theme.of(context) + .colorScheme + .onSurface + .withOpacity(0.75), + ), + child: Text.rich( + TextSpan( + children: [ + TextSpan(text: '${t.misskey.createdAt}: '), + WidgetSpan( + alignment: PlaceholderAlignment.middle, + child: TimeWidget( + time: play.createdAt, + detailed: true, + ), + ), + ], + ), + ), + ), + if (play.updatedAt != play.createdAt) + DefaultTextStyle.merge( + style: TextStyle( + color: Theme.of(context) + .colorScheme + .onSurface + .withOpacity(0.75), + ), + child: Text.rich( + TextSpan( + children: [ + TextSpan(text: '${t.misskey.updatedAt}: '), + WidgetSpan( + alignment: PlaceholderAlignment.middle, + child: TimeWidget( + time: play.updatedAt, + detailed: true, + ), + ), + ], + ), + ), + ), + ], + ), + ), + ), + Padding( + padding: const EdgeInsets.symmetric(vertical: 8.0), + child: ClipRRect( + borderRadius: BorderRadius.circular(8.0), + child: AdWidget(account: this.account), + ), + ), + ], + ), + ), + ), + AsyncValue(:final error?, :final stackTrace) => + ErrorMessage(error: error, stackTrace: stackTrace), + _ => const Center(child: CircularProgressIndicator()), + }, + floatingActionButton: !account.value.isGuest && + this.account == account.value && + play.valueOrNull?.user.username == account.value.username + ? FloatingActionButton( + tooltip: t.misskey.edit, + onPressed: () => + context.push('/${this.account}/play/$playId/edit'), + child: const Icon(Icons.edit), + ) + : null, + ); + } +} diff --git a/lib/view/page/play/plays_featured.dart b/lib/view/page/play/plays_featured.dart index dae9b843..ef1adc28 100644 --- a/lib/view/page/play/plays_featured.dart +++ b/lib/view/page/play/plays_featured.dart @@ -1,6 +1,6 @@ import 'package:flutter/material.dart'; +import 'package:go_router/go_router.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; -import 'package:url_launcher/url_launcher.dart'; import '../../../i18n/strings.g.dart'; import '../../../model/account.dart'; @@ -48,10 +48,8 @@ class PlaysFeatured extends ConsumerWidget { (play) => PlayPreview( account: account, play: play, - onTap: () => launchUrl( - Uri.https(account.host, 'play/${play.id}'), - mode: LaunchMode.externalApplication, - ), + onTap: () => + context.push('/$account/play/${play.id}'), ), ), ), diff --git a/lib/view/page/play/plays_liked.dart b/lib/view/page/play/plays_liked.dart index 9bdf275f..4bb4e7e1 100644 --- a/lib/view/page/play/plays_liked.dart +++ b/lib/view/page/play/plays_liked.dart @@ -1,6 +1,6 @@ import 'package:flutter/material.dart'; +import 'package:go_router/go_router.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; -import 'package:url_launcher/url_launcher.dart'; import '../../../i18n/strings.g.dart'; import '../../../model/account.dart'; @@ -22,10 +22,7 @@ class PlaysLiked extends ConsumerWidget { itemBuilder: (context, like) => PlayPreview( account: account, play: like.flash, - onTap: () => launchUrl( - Uri.https(account.host, 'play/${like.flash.id}'), - mode: LaunchMode.externalApplication, - ), + onTap: () => context.push('/$account/play/${like.flash.id}'), ), onRefresh: () => ref.refresh(likedPlaysNotifierProvider(account).future), loadMore: (skipError) => ref diff --git a/lib/view/page/play/plays_my.dart b/lib/view/page/play/plays_my.dart index aee2c901..05d36ed4 100644 --- a/lib/view/page/play/plays_my.dart +++ b/lib/view/page/play/plays_my.dart @@ -1,6 +1,6 @@ import 'package:flutter/material.dart'; +import 'package:go_router/go_router.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; -import 'package:url_launcher/url_launcher.dart'; import '../../../i18n/strings.g.dart'; import '../../../model/account.dart'; @@ -22,10 +22,7 @@ class PlaysMy extends ConsumerWidget { itemBuilder: (context, play) => PlayPreview( account: account, play: play, - onTap: () => launchUrl( - Uri.https(account.host, 'play/${play.id}'), - mode: LaunchMode.externalApplication, - ), + onTap: () => context.push('/$account/play/${play.id}'), ), onRefresh: () => ref.refresh(playsNotifierProvider(account).future), loadMore: (skipError) => ref diff --git a/lib/view/page/play/plays_page.dart b/lib/view/page/play/plays_page.dart index 51cc6816..2b979400 100644 --- a/lib/view/page/play/plays_page.dart +++ b/lib/view/page/play/plays_page.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:go_router/go_router.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; import '../../../i18n/strings.g.dart'; @@ -38,6 +39,13 @@ class PlaysPage extends ConsumerWidget { ], ], ), + floatingActionButton: !account.isGuest + ? FloatingActionButton( + tooltip: t.misskey.play_.new_, + onPressed: () => context.push('/$account/play/new'), + child: const Icon(Icons.add), + ) + : null, ), ); } diff --git a/lib/view/page/settings/accounts_page.dart b/lib/view/page/settings/accounts_page.dart index d86ccad6..ba92707b 100644 --- a/lib/view/page/settings/accounts_page.dart +++ b/lib/view/page/settings/accounts_page.dart @@ -6,11 +6,9 @@ import 'package:hooks_riverpod/hooks_riverpod.dart'; import '../../../i18n/strings.g.dart'; import '../../../provider/accounts_notifier_provider.dart'; -import '../../../provider/api/i_notifier_provider.dart'; +import '../../widget/account_preview.dart'; import '../../widget/general_settings_scaffold.dart'; import '../../widget/reorderable_drag_start_listener_wrapper.dart'; -import '../../widget/user_avatar.dart'; -import '../../widget/username_widget.dart'; class AccountsPage extends HookConsumerWidget { const AccountsPage({super.key}); @@ -27,7 +25,6 @@ class AccountsPage extends HookConsumerWidget { itemBuilder: (context, index) { if (index < accounts.length) { final account = accounts[index]; - final i = ref.watch(iNotifierProvider(account)).valueOrNull; return ReorderableDragStartListenerWrapper( key: ValueKey(index), index: index, @@ -35,15 +32,10 @@ class AccountsPage extends HookConsumerWidget { color: Theme.of(context).colorScheme.surface, elevation: 0.0, clipBehavior: Clip.hardEdge, - child: ListTile( - leading: i != null - ? UserAvatar(account: account, user: i, size: 40.0) - : null, - title: i != null - ? UsernameWidget(account: account, user: i) - : null, - subtitle: Text(account.toString()), + child: AccountPreview( + account: account, trailing: const Icon(Icons.drag_handle), + avatarSize: 40.0, onTap: () => context.push('/settings/accounts/$account'), ), diff --git a/lib/view/page/settings/emoji_picker_page.dart b/lib/view/page/settings/emoji_picker_page.dart index 2cc0fd78..2a76aeb0 100644 --- a/lib/view/page/settings/emoji_picker_page.dart +++ b/lib/view/page/settings/emoji_picker_page.dart @@ -9,11 +9,10 @@ import '../../../constant/default_pinned_emojis.dart'; import '../../../i18n/strings.g.dart'; import '../../../model/general_settings.dart'; import '../../../provider/accounts_notifier_provider.dart'; -import '../../../provider/api/i_notifier_provider.dart'; import '../../../provider/general_settings_notifier_provider.dart'; +import '../../widget/account_preview.dart'; import '../../widget/general_settings_scaffold.dart'; import '../../widget/unicode_emoji.dart'; -import '../../widget/user_tile.dart'; class EmojiPickerPage extends HookConsumerWidget { const EmojiPickerPage({super.key}); @@ -50,25 +49,14 @@ class EmojiPickerPage extends HookConsumerWidget { ), ...ListTile.divideTiles( context: context, - tiles: accounts.map((account) { - final i = ref.watch(iNotifierProvider(account)).valueOrNull; - if (i != null) { - return UserTile( - account: account, - user: i, - onTap: () => context.push( - '/settings/accounts/$account/emoji-picker', - ), - ); - } else { - return ListTile( - subtitle: Text(account.toString()), - onTap: () => context.push( - '/settings/accounts/$account/emoji-picker', - ), - ); - } - }), + tiles: accounts.map( + (account) => AccountPreview( + account: account, + onTap: () => context.push( + '/settings/accounts/$account/emoji-picker', + ), + ), + ), ), Container( height: 8.0, diff --git a/lib/view/page/settings/import_export_page.dart b/lib/view/page/settings/import_export_page.dart index 8138be4a..aa97bc6e 100644 --- a/lib/view/page/settings/import_export_page.dart +++ b/lib/view/page/settings/import_export_page.dart @@ -3,6 +3,7 @@ import 'dart:convert'; import 'package:collection/collection.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; +import 'package:go_router/go_router.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; import 'package:json5/json5.dart'; import 'package:misskey_dart/misskey_dart.dart'; @@ -13,6 +14,7 @@ import '../../../model/account.dart'; import '../../../model/aria_backup.dart'; import '../../../provider/account_settings_notifier_provider.dart'; import '../../../provider/accounts_notifier_provider.dart'; +import '../../../provider/aiscript_storage_notifier_provider.dart'; import '../../../provider/api/drive_files_notifier_provider.dart'; import '../../../provider/api/misskey_provider.dart'; import '../../../provider/cache_manager_provider.dart'; @@ -25,8 +27,8 @@ import '../../../util/format_datetime.dart'; import '../../../util/future_with_dialog.dart'; import '../../dialog/confirmation_dialog.dart'; import '../../dialog/message_dialog.dart'; -import '../../dialog/radio_dialog.dart'; import '../../dialog/text_field_dialog.dart'; +import '../../widget/account_preview.dart'; import '../../widget/general_settings_scaffold.dart'; import '../drive_page.dart'; @@ -49,10 +51,14 @@ class ImportExportPage extends ConsumerWidget { }, generalSettings: ref.read(generalSettingsNotifierProvider), themes: ref.read(misskeyThemeCodesNotifierProvider), + aiscriptStorage: { + for (final account in accounts) + '$account': ref.read(aiscriptStorageNotifierProvider(account)), + }, ); } - Future _import(WidgetRef ref, AriaBackup backup) async { + Future _import(WidgetRef ref, AriaBackup backup) async { if (backup case AriaBackup(:final timelineTabs?)) { await ref .read(timelineTabsNotifierProvider.notifier) @@ -74,17 +80,34 @@ class ImportExportPage extends ConsumerWidget { if (backup case AriaBackup(:final themes?)) { await ref.read(misskeyThemeCodesNotifierProvider.notifier).import(themes); } + if (backup case AriaBackup(:final aiscriptStorage?)) { + for (final e in aiscriptStorage.entries) { + final account = Account.fromString(e.key); + await ref + .read(aiscriptStorageNotifierProvider(account).notifier) + .import(e.value); + } + } + return true; } Future _selectAccount( BuildContext context, List accounts, ) async { - return showRadioDialog( - context, - title: Text(t.misskey.selectAccount), - values: accounts, - itemBuilder: (context, account) => Text(account.toString()), + return showDialog( + context: context, + builder: (context) => SimpleDialog( + title: Text(t.misskey.selectAccount), + children: accounts + .map( + (account) => AccountPreview( + account: account, + onTap: () => context.pop(account), + ), + ) + .toList(), + ), ); } @@ -124,8 +147,15 @@ class ImportExportPage extends ConsumerWidget { .systemTempDirectory .createTemp(); final tempFile = tempDirectory.childFile('aria.json'); - await tempFile - .writeAsString(jsonEncode(await _export(ref))); + if (!context.mounted) return; + final data = + await futureWithDialog(context, _export(ref)); + if (data == null) return; + if (!context.mounted) return; + await futureWithDialog( + context, + tempFile.writeAsString(jsonEncode(data)), + ); if (!context.mounted) return; await futureWithDialog( context, @@ -147,7 +177,7 @@ class ImportExportPage extends ConsumerWidget { leading: const Icon(Icons.copy), title: Text(t.misskey.copy), onTap: () async { - final data = await _export(ref); + final data = await futureWithDialog(context, _export(ref)); if (!context.mounted) return; copyToClipboard(context, jsonEncode(data)); }, @@ -226,7 +256,11 @@ class ImportExportPage extends ConsumerWidget { ); if (!context.mounted) return; if (confirmed) { - await _import(ref, backup); + final result = await futureWithDialog( + context, + _import(ref, backup), + ); + if (result == null) return; if (!context.mounted) return; await showMessageDialog( context, @@ -264,7 +298,11 @@ class ImportExportPage extends ConsumerWidget { ); if (!context.mounted) return; if (confirmed) { - await _import(ref, backup); + final result = await futureWithDialog( + context, + _import(ref, backup), + ); + if (result == null) return; if (!context.mounted) return; await showMessageDialog( context, diff --git a/lib/view/page/share_page.dart b/lib/view/page/share_page.dart index daea9a66..0d6e2e37 100644 --- a/lib/view/page/share_page.dart +++ b/lib/view/page/share_page.dart @@ -4,10 +4,8 @@ import 'package:hooks_riverpod/hooks_riverpod.dart'; import '../../i18n/strings.g.dart'; import '../../provider/accounts_notifier_provider.dart'; -import '../../provider/api/i_notifier_provider.dart'; import '../../provider/share_notifier_provider.dart'; -import '../widget/user_avatar.dart'; -import '../widget/username_widget.dart'; +import '../widget/account_preview.dart'; class SharePage extends ConsumerWidget { const SharePage({super.key}); @@ -24,14 +22,10 @@ class SharePage extends ConsumerWidget { body: ListView.builder( itemBuilder: (context, index) { final account = accounts[index]; - final i = ref.watch(iNotifierProvider(account)).valueOrNull; - return ListTile( - leading: i != null - ? UserAvatar(account: account, user: i, size: 40.0) - : null, - title: i != null ? UsernameWidget(account: account, user: i) : null, - subtitle: Text(account.toString()), + return AccountPreview( + account: account, trailing: const Icon(Icons.navigate_next), + avatarSize: 40.0, onTap: () async { await ref.read(shareNotifierProvider.notifier).share(account); if (!context.mounted) return; diff --git a/lib/view/page/user/user_list_page.dart b/lib/view/page/user/user_list_page.dart index cecad37e..5eec0e0c 100644 --- a/lib/view/page/user/user_list_page.dart +++ b/lib/view/page/user/user_list_page.dart @@ -12,7 +12,7 @@ import '../../../util/future_with_dialog.dart'; import '../../dialog/text_field_dialog.dart'; import '../../widget/error_message.dart'; import '../../widget/like_button.dart'; -import '../../widget/user_tile.dart'; +import '../../widget/user_preview.dart'; class UserListPage extends HookConsumerWidget { const UserListPage({ @@ -62,7 +62,7 @@ class UserListPage extends HookConsumerWidget { ...ListTile.divideTiles( context: context, tiles: users.map( - (user) => UserTile( + (user) => UserPreview( account: account, user: user, onTap: () => diff --git a/lib/view/page/user/user_plays.dart b/lib/view/page/user/user_plays.dart index c69d6a85..219880f4 100644 --- a/lib/view/page/user/user_plays.dart +++ b/lib/view/page/user/user_plays.dart @@ -1,6 +1,6 @@ import 'package:flutter/material.dart'; +import 'package:go_router/go_router.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; -import 'package:url_launcher/url_launcher.dart'; import '../../../i18n/strings.g.dart'; import '../../../model/account.dart'; @@ -27,10 +27,7 @@ class UserPlays extends ConsumerWidget { itemBuilder: (context, play) => PlayPreview( account: account, play: play, - onTap: () => launchUrl( - Uri.https(account.host, 'play/${play.id}'), - mode: LaunchMode.externalApplication, - ), + onTap: () => context.push('/$account/play/${play.id}'), ), onRefresh: () => ref.refresh( userPlaysNotifierProvider(account, userId).future, diff --git a/lib/view/widget/account_preview.dart b/lib/view/widget/account_preview.dart new file mode 100644 index 00000000..4fba2852 --- /dev/null +++ b/lib/view/widget/account_preview.dart @@ -0,0 +1,40 @@ +import 'package:flutter/material.dart'; +import 'package:hooks_riverpod/hooks_riverpod.dart'; + +import '../../i18n/strings.g.dart'; +import '../../model/account.dart'; +import '../../provider/api/i_notifier_provider.dart'; +import 'user_avatar.dart'; +import 'username_widget.dart'; + +class AccountPreview extends ConsumerWidget { + const AccountPreview({ + super.key, + required this.account, + this.trailing, + this.avatarSize = 32.0, + this.onTap, + }); + + final Account account; + final Widget? trailing; + final double avatarSize; + final void Function()? onTap; + + @override + Widget build(BuildContext context, WidgetRef ref) { + final i = ref.watch(iNotifierProvider(account)).valueOrNull; + + return ListTile( + leading: i != null + ? UserAvatar(account: account, user: i, size: avatarSize) + : Icon(Icons.person, size: avatarSize), + title: i != null + ? UsernameWidget(account: account, user: i) + : Text(account.username ?? t.aria.guest), + subtitle: Text(account.toString()), + trailing: trailing, + onTap: onTap, + ); + } +} diff --git a/lib/view/widget/as_ui_widget.dart b/lib/view/widget/as_ui_widget.dart new file mode 100644 index 00000000..d897355e --- /dev/null +++ b/lib/view/widget/as_ui_widget.dart @@ -0,0 +1,701 @@ +import 'package:collection/collection.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter_hooks/flutter_hooks.dart'; +import 'package:go_router/go_router.dart'; +import 'package:hooks_riverpod/hooks_riverpod.dart'; +import 'package:misskey_dart/misskey_dart.dart'; + +import '../../model/account.dart'; +import '../../provider/api/post_notifier_provider.dart'; +import '../../provider/misskey_colors_provider.dart'; +import '../../rust/api/aiscript/ui.dart'; +import '../../util/safe_parse_color.dart'; +import 'mfm.dart'; +import 'post_form.dart'; + +class AsUiWidget extends HookConsumerWidget { + const AsUiWidget({ + super.key, + required this.account, + required this.host, + required this.componentId, + required this.components, + }); + + final Account account; + final String host; + final String componentId; + final Map components; + + @override + Widget build(BuildContext context, WidgetRef ref) { + final component = components[componentId]; + + if (component == null) { + return const SizedBox.shrink(); + } + return component.when( + root: (component) => Theme( + data: Theme.of(context).copyWith( + inputDecorationTheme: InputDecorationTheme( + enabledBorder: OutlineInputBorder( + borderSide: BorderSide( + color: Theme.of(context).colorScheme.outlineVariant, + ), + borderRadius: BorderRadius.circular(6.0), + ), + focusedBorder: OutlineInputBorder( + borderSide: BorderSide( + color: Theme.of(context).colorScheme.primary, + ), + borderRadius: BorderRadius.circular(6.0), + ), + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(6.0), + ), + filled: true, + fillColor: Theme.of(context).colorScheme.surface, + helperStyle: TextStyle( + color: Theme.of(context).colorScheme.onSurface.withOpacity(0.75), + ), + isDense: true, + ), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + ...component.children + .where((id) { + final child = components[id]; + final hidden = child?.whenOrNull( + container: (container) => container.hidden, + ) ?? + false; + return !hidden; + }) + .mapIndexed( + (index, id) => [ + if (index > 0) const SizedBox(height: 12.0), + AsUiWidget( + account: account, + host: host, + componentId: id, + components: components, + ), + ], + ) + .flattened, + ], + ), + ), + container: (component) { + final AsUiContainer( + :children, + :align, + :bgColor, + :fgColor, + :font, + :borderWidth, + :borderColor, + :padding, + :rounded, + ) = component; + return DefaultTextStyle.merge( + style: TextStyle( + color: safeParseColor(fgColor), + fontFamily: font, + ), + textAlign: switch (align) { + 'left' => TextAlign.left, + 'center' => TextAlign.center, + 'right' => TextAlign.right, + _ => null, + }, + child: Container( + padding: padding != null ? EdgeInsets.all(padding) : null, + decoration: BoxDecoration( + color: safeParseColor(bgColor), + border: borderWidth != null && borderWidth > 0.0 + ? Border.all( + color: safeParseColor(borderColor) ?? + Theme.of(context).colorScheme.outlineVariant, + width: borderWidth, + ) + : null, + borderRadius: + rounded ?? false ? BorderRadius.circular(8.0) : null, + ), + child: Column( + crossAxisAlignment: switch (align) { + 'left' => CrossAxisAlignment.start, + 'center' => CrossAxisAlignment.center, + 'right' => CrossAxisAlignment.end, + _ => CrossAxisAlignment.start, + }, + children: [ + ...?children + ?.where((id) { + final child = components[id]; + final hidden = child?.whenOrNull( + container: (container) => container.hidden, + ) ?? + false; + return !hidden; + }) + .mapIndexed( + (index, id) => [ + if (index > 0) const SizedBox(height: 12.0), + AsUiWidget( + account: account, + host: host, + componentId: id, + components: components, + ), + ], + ) + .flattened, + ], + ), + ), + ); + }, + text: (component) { + final AsUiText( + :text, + :size, + :bold, + :color, + :font, + ) = component; + return Text( + text ?? '', + style: DefaultTextStyle.of(context) + .style + .apply(fontSizeFactor: size ?? 1.0) + .merge( + TextStyle( + color: safeParseColor(color), + fontWeight: bold ?? false ? FontWeight.bold : null, + fontFamily: font, + ), + ), + ); + }, + mfm: (component) { + final AsUiMfm( + :text, + :size, + :bold, + :color, + :font, + :onClickEv, + ) = component; + return Mfm( + account: account.host == host ? account : Account(host: host), + text: text, + style: DefaultTextStyle.of(context) + .style + .apply(fontSizeFactor: size ?? 1.0) + .merge( + TextStyle( + color: safeParseColor(color), + fontWeight: bold ?? false ? FontWeight.bold : null, + fontFamily: font, + ), + ), + onClickEv: onClickEv != null + ? (clickEv) => onClickEv.call(value: clickEv) + : null, + ); + }, + button: (component) { + final AsUiButton( + :text, + :onClick, + :primary, + :rounded, + :disabled, + ) = component; + return Align( + alignment: switch (DefaultTextStyle.of(context).textAlign) { + TextAlign.left => Alignment.centerLeft, + TextAlign.center => Alignment.center, + TextAlign.right => Alignment.centerRight, + _ => Alignment.centerLeft + }, + child: _Button( + text: text, + onTap: onClick?.call, + primary: primary, + rounded: rounded, + disabled: disabled, + ), + ); + }, + buttons: (component) => Wrap( + spacing: 8.0, + runSpacing: 8.0, + children: [ + ...?component.buttons?.map( + (button) => _Button( + text: button.text, + onTap: button.onClick?.call, + primary: button.primary, + rounded: button.rounded, + disabled: button.disabled, + ), + ), + ], + ), + toggleSwitch: (component) { + final AsUiSwitch( + :onChange, + :defaultValue, + :label, + :caption, + ) = component; + final value = useState(defaultValue); + return SwitchListTile( + value: value.value ?? false, + title: label != null ? Text(label) : null, + subtitle: caption != null + ? Text( + caption, + style: TextStyle( + color: Theme.of(context) + .colorScheme + .onSurface + .withOpacity(0.75), + ), + ) + : null, + onChanged: onChange != null + ? (v) { + value.value = v; + onChange.call(value: v); + } + : null, + controlAffinity: ListTileControlAffinity.leading, + dense: true, + ); + }, + textarea: (component) { + final AsUiTextarea( + :onInput, + :defaultValue, + :label, + :caption, + ) = component; + final controller = useTextEditingController(text: defaultValue); + return TextField( + controller: controller, + decoration: InputDecoration( + labelText: label, + helperText: caption, + ), + onChanged: + onInput != null ? (value) => onInput.call(value: value) : null, + minLines: 6, + maxLines: 6, + ); + }, + textInput: (component) { + final AsUiTextInput( + :onInput, + :defaultValue, + :label, + :caption, + ) = component; + final controller = useTextEditingController(text: defaultValue); + return TextField( + controller: controller, + decoration: InputDecoration( + labelText: label, + helperText: caption, + ), + onChanged: + onInput != null ? (value) => onInput.call(value: value) : null, + ); + }, + numberInput: (component) { + final AsUiNumberInput( + :onInput, + :defaultValue, + :label, + :caption, + ) = component; + final controller = useTextEditingController( + text: defaultValue != null + ? defaultValue == defaultValue.toInt() + ? defaultValue.toInt().toString() + : defaultValue.toString() + : null, + ); + return TextField( + controller: controller, + decoration: InputDecoration( + labelText: label, + helperText: caption, + isDense: true, + suffix: Row( + mainAxisSize: MainAxisSize.min, + children: [ + IconButton( + style: IconButton.styleFrom( + minimumSize: Size.zero, + padding: const EdgeInsets.all(2.0), + iconSize: 16.0, + tapTargetSize: MaterialTapTargetSize.shrinkWrap, + ), + onPressed: () { + if (controller.text.isEmpty) { + controller.text = '-1'; + if (onInput != null) { + onInput.call(value: -1); + } + return; + } + final i = int.tryParse(controller.text); + if (i != null) { + controller.text = (i - 1).toString(); + if (onInput != null) { + onInput.call(value: i - 1); + } + } + }, + icon: const Icon(Icons.remove), + ), + const SizedBox(width: 4.0), + IconButton( + style: IconButton.styleFrom( + minimumSize: Size.zero, + padding: const EdgeInsets.all(2.0), + iconSize: 16.0, + tapTargetSize: MaterialTapTargetSize.shrinkWrap, + ), + onPressed: () { + if (controller.text.isEmpty) { + controller.text = '1'; + if (onInput != null) { + onInput.call(value: 1); + } + return; + } + final i = int.tryParse(controller.text); + if (i != null) { + controller.text = (i + 1).toString(); + if (onInput != null) { + onInput.call(value: i + 1); + } + } + }, + icon: const Icon(Icons.add), + ), + ], + ), + ), + keyboardType: TextInputType.number, + inputFormatters: [ + TextInputFormatter.withFunction((oldValue, newValue) { + if (newValue.text.isEmpty || + double.tryParse(newValue.text) != null) { + return newValue; + } else { + return oldValue; + } + }), + ], + onChanged: onInput != null + ? (value) async { + final v = double.tryParse(value); + if (v != null) { + await onInput.call(value: v); + } + } + : null, + ); + }, + select: (component) { + final AsUiSelect( + :items, + :onChange, + :defaultValue, + :label, + :caption, + ) = component; + final value = useState( + defaultValue != null && + (items?.map((item) => item.$2).contains(defaultValue) ?? + false) + ? defaultValue + : null, + ); + return DropdownButtonFormField( + decoration: InputDecoration( + labelText: label, + helperText: caption, + ), + items: items + ?.map( + (item) => DropdownMenuItem( + value: item.$2, + child: Text(item.$1), + ), + ) + .toList(), + value: value.value, + onChanged: (v) async { + value.value = v; + if (v != null) { + await onChange?.call(value: v); + } + }, + isExpanded: true, + ); + }, + folder: (component) { + final AsUiFolder( + :children, + :title, + :opened, + ) = component; + return _Folder( + title: title, + opened: opened, + children: children + ?.where((id) { + final child = components[id]; + final hidden = child?.whenOrNull( + container: (container) => container.hidden, + ) ?? + false; + return !hidden; + }) + .map( + (id) => AsUiWidget( + account: account, + host: host, + componentId: id, + components: components, + ), + ) + .toList(), + ); + }, + postFormButton: (component) { + final AsUiPostFormButton( + :text, + :primary, + :rounded, + :form, + ) = component; + return Align( + alignment: switch (DefaultTextStyle.of(context).textAlign) { + TextAlign.left => Alignment.centerLeft, + TextAlign.center => Alignment.center, + TextAlign.right => Alignment.centerRight, + _ => Alignment.centerLeft + }, + child: _Button( + text: text, + primary: primary, + rounded: rounded, + onTap: !account.isGuest + ? () { + if (form?.text case final text?) { + ref + .read(postNotifierProvider(account).notifier) + .setText(text); + } + if (form?.cw case final cw?) { + ref + .read(postNotifierProvider(account).notifier) + .setCw(cw); + } + switch (form?.visibility) { + case 'public': + ref + .read(postNotifierProvider(account).notifier) + .setVisibility(NoteVisibility.public); + case 'home': + ref + .read(postNotifierProvider(account).notifier) + .setVisibility(NoteVisibility.home); + case 'followers': + ref + .read(postNotifierProvider(account).notifier) + .setVisibility(NoteVisibility.followers); + case 'specified': + ref + .read(postNotifierProvider(account).notifier) + .setVisibility(NoteVisibility.specified); + } + if (form?.localOnly case final localOnly?) { + ref + .read(postNotifierProvider(account).notifier) + .setLocalOnly(localOnly); + } + context.push('/$account/post'); + } + : null, + ), + ); + }, + postForm: (component) { + final AsUiPostForm( + :form, + ) = component; + useEffect( + () { + Future(() { + if (form?.text case final text?) { + ref.read(postNotifierProvider(account).notifier).setText(text); + } + if (form?.cw case final cw?) { + ref.read(postNotifierProvider(account).notifier).setCw(cw); + } + switch (form?.visibility) { + case 'public': + ref + .read(postNotifierProvider(account).notifier) + .setVisibility(NoteVisibility.public); + case 'home': + ref + .read(postNotifierProvider(account).notifier) + .setVisibility(NoteVisibility.home); + case 'followers': + ref + .read(postNotifierProvider(account).notifier) + .setVisibility(NoteVisibility.followers); + case 'specified': + ref + .read(postNotifierProvider(account).notifier) + .setVisibility(NoteVisibility.specified); + } + if (form?.localOnly case final localOnly?) { + ref + .read(postNotifierProvider(account).notifier) + .setLocalOnly(localOnly); + } + }); + return; + }, + [form], + ); + final colors = + ref.watch(misskeyColorsProvider(Theme.of(context).brightness)); + return Card( + color: colors.bg, + margin: EdgeInsets.zero, + elevation: 0.0, + child: PostForm( + account: account, + onExpand: (account) => context.push('/$account/post'), + showPostButton: true, + maxLines: 6, + ), + ); + }, + ); + } +} + +class _Button extends ConsumerWidget { + const _Button({ + this.text, + this.onTap, + this.primary, + this.rounded, + this.disabled, + }); + + final String? text; + final void Function()? onTap; + final bool? primary; + final bool? rounded; + final bool? disabled; + + @override + Widget build(BuildContext context, WidgetRef ref) { + final colors = + ref.watch(misskeyColorsProvider(Theme.of(context).brightness)); + + return ElevatedButton( + style: ElevatedButton.styleFrom( + backgroundColor: primary ?? false ? colors.accent : colors.buttonBg, + foregroundColor: primary ?? false + ? colors.fgOnAccent + : DefaultTextStyle.of(context).style.color, + elevation: 0.0, + shape: rounded ?? false + ? const StadiumBorder() + : RoundedRectangleBorder( + borderRadius: BorderRadius.circular(5.0), + ), + padding: const EdgeInsets.symmetric(vertical: 7.0, horizontal: 14.0), + minimumSize: const Size(100.0, 40.0), + ), + onPressed: !(disabled ?? false) ? onTap : null, + child: Text(text ?? ''), + ); + } +} + +class _Folder extends ConsumerWidget { + const _Folder({ + this.title, + this.opened, + this.children, + }); + + final String? title; + final bool? opened; + final List? children; + + @override + Widget build(BuildContext context, WidgetRef ref) { + final colors = + ref.watch(misskeyColorsProvider(Theme.of(context).brightness)); + final style = DefaultTextStyle.of(context).style; + + return ExpansionTile( + title: Text(title ?? ''), + initiallyExpanded: opened ?? true, + collapsedBackgroundColor: colors.buttonBg, + backgroundColor: colors.buttonBg, + textColor: style.color, + collapsedTextColor: style.color, + iconColor: colors.fg, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(6.0), + ), + collapsedShape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(6.0), + ), + dense: true, + children: [ + Material( + color: colors.bg, + child: Container( + width: double.infinity, + padding: const EdgeInsets.all(16.0), + child: DefaultTextStyle.merge( + style: style, + child: Column( + crossAxisAlignment: switch ( + DefaultTextStyle.of(context).textAlign) { + TextAlign.left => CrossAxisAlignment.start, + TextAlign.center => CrossAxisAlignment.center, + TextAlign.right => CrossAxisAlignment.end, + _ => CrossAxisAlignment.start, + }, + children: children ?? [], + ), + ), + ), + ), + ], + ); + } +} diff --git a/lib/view/widget/mfm.dart b/lib/view/widget/mfm.dart index 6fdbc921..627e6318 100644 --- a/lib/view/widget/mfm.dart +++ b/lib/view/widget/mfm.dart @@ -26,6 +26,7 @@ List buildMfm( bool nyaize = false, void Function(String emoji)? onTapEmoji, void Function(String link)? onLinkTap, + void Function(String clickEv)? onClickEv, TextAlign? textAlign, TextOverflow? overflow, int? maxLines, @@ -84,6 +85,7 @@ List buildMfm( builder: (context) => UrlSheet(url: url), ), onHashtagTap: (hashtag) => ref.context.push('/$account/tags/$hashtag'), + onClickEv: onClickEv, shouldNyaize: nyaize && (author?.isCat ?? false), useAdvanced: useAdvanced, useAnimation: useAnimation, @@ -114,6 +116,7 @@ class Mfm extends HookConsumerWidget { this.nyaize = false, this.selectable = false, this.onTapEmoji, + this.onClickEv, this.textAlign, this.overflow, this.maxLines, @@ -129,6 +132,7 @@ class Mfm extends HookConsumerWidget { final bool nyaize; final bool selectable; final void Function(String emoji)? onTapEmoji; + final void Function(String clickEv)? onClickEv; final TextAlign? textAlign; final TextOverflow? overflow; final int? maxLines; @@ -149,6 +153,7 @@ class Mfm extends HookConsumerWidget { emojis: emojis, author: author, onLinkTap: (link) => navigate(ref, account, link), + onClickEv: onClickEv, textAlign: textAlign, overflow: overflow, maxLines: maxLines, diff --git a/lib/view/widget/mfm/mfm_builder.dart b/lib/view/widget/mfm/mfm_builder.dart index 3f09b312..04c475a1 100644 --- a/lib/view/widget/mfm/mfm_builder.dart +++ b/lib/view/widget/mfm/mfm_builder.dart @@ -59,6 +59,7 @@ class MfmBuilder { this.onLinkTap, this.onLinkLongPress, this.onHashtagTap, + this.onClickEv, this.shouldNyaize = false, this.useAdvanced = true, this.useAnimation = false, @@ -88,6 +89,7 @@ class MfmBuilder { final void Function(String url)? onLinkTap; final void Function(String url)? onLinkLongPress; final void Function(String hashtag)? onHashtagTap; + final void Function(String clickEv)? onClickEv; final bool shouldNyaize; final bool useAdvanced; final bool useAnimation; @@ -801,6 +803,26 @@ class MfmBuilder { ), ), ); + case 'clickable': + final span = TextSpan(children: build(children)); + final clickEv = args['ev'] as String?; + return WidgetSpan( + alignment: children.any(_containsNewLine) + ? PlaceholderAlignment.bottom + : PlaceholderAlignment.baseline, + baseline: TextBaseline.alphabetic, + child: InkWell( + onTap: clickEv != null && onClickEv != null + ? () => onClickEv?.call(clickEv) + : null, + child: Text.rich( + span, + textAlign: align, + overflow: overflow, + maxLines: maxLines, + ), + ), + ); default: return TextSpan( children: [ diff --git a/lib/view/widget/note_sheet.dart b/lib/view/widget/note_sheet.dart index 9a9de1b5..8c7ecb5c 100644 --- a/lib/view/widget/note_sheet.dart +++ b/lib/view/widget/note_sheet.dart @@ -25,11 +25,10 @@ import '../../util/future_with_dialog.dart'; import '../dialog/clip_dialog.dart'; import '../dialog/confirmation_dialog.dart'; import '../dialog/text_field_dialog.dart'; +import 'account_preview.dart'; import 'note_fallback_widget.dart'; import 'translated_note_sheet.dart'; -import 'user_avatar.dart'; import 'user_sheet.dart'; -import 'username_widget.dart'; class NoteSheet extends ConsumerWidget { const NoteSheet({ @@ -138,25 +137,16 @@ class NoteSheet extends ConsumerWidget { context: context, builder: (context) => SimpleDialog( title: Text(t.aria.openInAnotherAccount), - children: switchCandidateAccounts.map((account) { - final i = - ref.watch(iNotifierProvider(account)).valueOrNull; - return ListTile( - leading: i != null - ? UserAvatar( - account: account, - user: i, - size: 50.0, - ) - : null, - title: i != null - ? UsernameWidget(account: account, user: i) - : null, - subtitle: Text(account.toString()), - trailing: const Icon(Icons.navigate_next), - onTap: () => context.pop(account), - ); - }).toList(), + children: switchCandidateAccounts + .map( + (account) => AccountPreview( + account: account, + trailing: const Icon(Icons.navigate_next), + avatarSize: 40.0, + onTap: () => context.pop(account), + ), + ) + .toList(), ), ); if (destination == null) { diff --git a/lib/view/widget/play_preview.dart b/lib/view/widget/play_preview.dart index e09f7db7..fcb6c790 100644 --- a/lib/view/widget/play_preview.dart +++ b/lib/view/widget/play_preview.dart @@ -25,16 +25,17 @@ class PlayPreview extends StatelessWidget { subtitle: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Padding( - padding: const EdgeInsets.symmetric(vertical: 2.0), - child: Mfm( - account: account, - text: play.summary, - simple: true, - overflow: TextOverflow.ellipsis, - maxLines: 1, + if (play.summary.isNotEmpty) + Padding( + padding: const EdgeInsets.symmetric(vertical: 2.0), + child: Mfm( + account: account, + text: play.summary, + simple: true, + overflow: TextOverflow.ellipsis, + maxLines: 1, + ), ), - ), Padding( padding: const EdgeInsets.symmetric(vertical: 2.0), child: Row( diff --git a/lib/view/widget/play_widget.dart b/lib/view/widget/play_widget.dart new file mode 100644 index 00000000..e1346271 --- /dev/null +++ b/lib/view/widget/play_widget.dart @@ -0,0 +1,541 @@ +import 'dart:convert'; + +import 'package:flutter/material.dart'; +import 'package:flutter_hooks/flutter_hooks.dart'; +import 'package:go_router/go_router.dart'; +import 'package:hooks_riverpod/hooks_riverpod.dart'; +import 'package:intl/intl.dart'; +import 'package:misskey_dart/misskey_dart.dart' hide Clip; +import 'package:share_plus/share_plus.dart'; +import 'package:url_launcher/url_launcher.dart'; + +import '../../i18n/strings.g.dart'; +import '../../model/account.dart'; +import '../../provider/accounts_notifier_provider.dart'; +import '../../provider/aiscript_storage_notifier_provider.dart'; +import '../../provider/api/i_notifier_provider.dart'; +import '../../provider/api/play_notifier_provider.dart'; +import '../../provider/api/post_notifier_provider.dart'; +import '../../provider/dio_provider.dart'; +import '../../provider/emojis_notifier_provider.dart'; +import '../../provider/misskey_colors_provider.dart'; +import '../../provider/token_provider.dart'; +import '../../rust/api/aiscript.dart'; +import '../../rust/api/aiscript/api.dart'; +import '../../rust/api/aiscript/play.dart'; +import '../../rust/api/aiscript/ui.dart'; +import '../../util/copy_text.dart'; +import '../../util/future_with_dialog.dart'; +import '../../util/nyaize.dart'; +import '../dialog/error_message_dialog.dart'; +import '../dialog/text_field_dialog.dart'; +import 'account_preview.dart'; +import 'as_ui_widget.dart'; +import 'like_button.dart'; +import 'mfm.dart'; +import 'user_avatar.dart'; + +class PlayWidget extends HookConsumerWidget { + const PlayWidget({ + super.key, + required this.account, + required this.host, + required this.play, + this.onAccountChanged, + }); + + final Account account; + final String host; + final Flash play; + final void Function(Account account)? onAccountChanged; + + @override + Widget build(BuildContext context, WidgetRef ref) { + final i = ref.watch(iNotifierProvider(account)).valueOrNull; + final url = Uri.https(host, 'play/${play.id}'); + final started = useState(false); + final aiscript = useState(null); + final components = useState({}); + final locale = Localizations.localeOf(context).toLanguageTag(); + final colors = + ref.watch(misskeyColorsProvider(Theme.of(context).brightness)); + + return AnimatedSwitcher( + duration: Durations.medium1, + child: started.value + ? Column( + children: [ + Card( + margin: const EdgeInsets.symmetric(vertical: 8.0), + elevation: 0.0, + color: colors.panel, + child: Container( + width: double.infinity, + padding: const EdgeInsets.all(32.0), + child: AsUiWidget( + account: account, + host: host, + componentId: '___root___', + components: components.value, + ), + ), + ), + Card( + margin: const EdgeInsets.symmetric(vertical: 8.0), + elevation: 0.0, + color: colors.panel, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + children: [ + IconButton( + tooltip: t.misskey.reload, + onPressed: () async { + await aiscript.value?.abort(); + started.value = false; + }, + icon: const Icon(Icons.refresh), + ), + Row( + children: [ + LikeButton( + isLiked: play.isLiked, + likedCount: play.likedCount ?? 0, + onTap: !account.isGuest && account.host == host + ? () => futureWithDialog( + context, + play.isLiked + ? ref + .read( + playNotifierProvider( + account, + play.id, + ).notifier, + ) + .unlike() + : ref + .read( + playNotifierProvider( + account, + play.id, + ).notifier, + ) + .like(), + ) + : null, + ), + const Spacer(), + if (!account.isGuest) + IconButton( + tooltip: t.misskey.shareWithNote, + onPressed: () { + ref + .read( + postNotifierProvider(account).notifier, + ) + .setText( + '${play.title} $url', + ); + context.push('/$account/post'); + }, + icon: const Icon(Icons.repeat_rounded), + ), + IconButton( + tooltip: t.misskey.copyLink, + onPressed: () => + copyToClipboard(context, url.toString()), + icon: const Icon(Icons.link), + ), + IconButton( + tooltip: t.aria.openInBrowser, + onPressed: () => launchUrl( + url, + mode: LaunchMode.externalApplication, + ), + icon: const Icon(Icons.open_in_browser), + ), + IconButton( + tooltip: t.misskey.share, + onPressed: () => + Share.share('${play.title} $url'), + icon: const Icon(Icons.share), + ), + ], + ), + ], + ), + ), + ), + ], + ) + : Card( + margin: const EdgeInsets.symmetric(vertical: 8.0), + elevation: 0.0, + color: colors.panel, + child: Column( + children: [ + Align( + alignment: Alignment.topRight, + child: Padding( + padding: const EdgeInsets.only(top: 12.0, right: 12.0), + child: IconButton( + tooltip: t.misskey.switchAccount, + onPressed: () async { + final accounts = ref.read(accountsNotifierProvider); + final destination = + await showModalBottomSheet( + context: ref.context, + builder: (context) => ListView.separated( + itemBuilder: (context, index) { + final account = index == 0 + ? Account(host: host) + : accounts[index - 1]; + return AccountPreview( + account: account, + trailing: const Icon(Icons.navigate_next), + avatarSize: 40.0, + onTap: () => context.pop(account), + ); + }, + separatorBuilder: (_, __) => + const Divider(height: 0.0), + itemCount: accounts.length + 1, + ), + clipBehavior: Clip.hardEdge, + ); + if (destination != null && destination != account) { + onAccountChanged?.call(destination); + } + }, + icon: i != null + ? UserAvatar(account: account, user: i, size: 32.0) + : const Icon(Icons.person, size: 32.0), + ), + ), + ), + Container( + width: double.infinity, + padding: const EdgeInsets.only( + left: 32.0, + right: 32.0, + bottom: 32.0, + ), + child: Column( + children: [ + Text( + play.title, + style: DefaultTextStyle.of(context) + .style + .apply(fontSizeFactor: 1.4) + .copyWith( + fontWeight: FontWeight.bold, + ), + ), + const SizedBox(height: 16.0), + Mfm( + account: account, + text: play.summary, + style: DefaultTextStyle.of(context) + .style + .apply(fontSizeFactor: 1.1), + ), + const SizedBox(height: 16.0), + ElevatedButton( + style: ElevatedButton.styleFrom( + backgroundColor: Colors.transparent, + padding: EdgeInsets.zero, + minimumSize: Size.zero, + tapTargetSize: MaterialTapTargetSize.shrinkWrap, + ), + autofocus: true, + onPressed: () async { + await aiscript.value?.abort(); + final i = await ref + .read(iNotifierProvider(account).future); + final emojis = await ref.read( + emojisNotifierProvider(account.host).future, + ); + components.value = {}; + try { + aiscript.value = await AiScript.newInstance( + read: (prompt) async { + final result = await showTextFieldDialog( + context, + title: Text(prompt), + ); + return result ?? ''; + }, + write: (_) {}, + api: AsApiLib( + userId: i?.id, + userName: i?.name, + userUsername: i?.username, + customEmojis: + jsonEncode(emojis.values.toList()), + locale: locale, + serverUrl: 'https://${account.host}', + dialog: (title, text, type) => showDialog( + context: context, + builder: (context) => _Dialog( + account: account, + title: title, + text: text, + type: type, + ), + ), + confirm: (title, text, type) async { + final result = await showDialog( + context: context, + builder: (context) => _Dialog( + account: account, + title: title, + text: text, + type: type, + showCancelButton: true, + ), + ); + return result ?? false; + }, + token: ref.read(tokenProvider(account)), + api: (ep, param, token) async { + final json = jsonDecode(param); + final dio = ref.read(dioProvider); + final misskey = Misskey( + dio: dio, + host: account.host, + token: token, + ); + try { + final response = await misskey.apiService + .post( + ep, + json is Map + ? json + : {}, + excludeRemoveNullPredicate: (_, __) => + true, + ); + return ( + jsonEncode(response), + null, + ); + } on MisskeyException catch (e) { + if (account.host != host) { + final misskey = Misskey( + dio: dio, + host: host, + ); + try { + final response = await misskey + .apiService + .post( + ep, + json is Map + ? json + : {}, + excludeRemoveNullPredicate: + (_, __) => true, + ); + return ( + jsonEncode(response), + null, + ); + } catch (e) { + return ('', e.toString()); + } + } + return ('', e.toString()); + } catch (e) { + return ('', e.toString()); + } + }, + save: (key, value) => ref + .read( + aiscriptStorageNotifierProvider(account) + .notifier, + ) + .save('${play.id}:$key', value), + load: (key) => + ref + .read( + aiscriptStorageNotifierProvider( + account, + ).notifier, + ) + .load('${play.id}:$key') ?? + '', + url: url.toString(), + nyaize: nyaize, + ), + ui: AsUiLib( + onUpdate: (id, component) => + components.value = { + ...components.value, + id: component, + }, + ), + play: AsPlayLib( + thisId: play.id, + thisUrl: url.toString(), + ), + ); + started.value = true; + await aiscript.value?.exec(input: play.script); + } catch (e, st) { + await aiscript.value?.abort(); + if (!context.mounted) return; + await showErrorMessageDialog( + context, + error: e, + stackTrace: st, + ); + } + }, + child: Ink( + decoration: BoxDecoration( + gradient: LinearGradient( + colors: [ + colors.buttonGradateA, + colors.buttonGradateB, + ], + ), + borderRadius: BorderRadius.circular(16.0), + ), + child: Padding( + padding: const EdgeInsets.symmetric( + vertical: 8.0, + horizontal: 32.0, + ), + child: Text( + 'Play', + style: TextStyle( + color: colors.fgOnAccent, + fontWeight: FontWeight.bold, + ), + ), + ), + ), + ), + if (play.likedCount case final likedCount?) ...[ + const SizedBox(height: 16.0), + Tooltip( + message: t.misskey.numberOfLikes, + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + const Icon(Icons.favorite_border), + const SizedBox(width: 8.0), + Text(NumberFormat().format(likedCount)), + ], + ), + ), + ], + ], + ), + ), + ], + ), + ), + ); + } +} + +class _Dialog extends ConsumerWidget { + const _Dialog({ + required this.account, + this.title, + this.text, + this.type, + this.showCancelButton = false, + }); + + final Account account; + final String? title; + final String? text; + final String? type; + final bool showCancelButton; + + @override + Widget build(BuildContext context, WidgetRef ref) { + final colors = + ref.watch(misskeyColorsProvider(Theme.of(context).brightness)); + + return AlertDialog( + icon: IconTheme( + data: const IconThemeData(size: 32.0), + child: switch (type) { + 'success' => Icon(Icons.check, color: colors.success), + 'error' => Icon(Icons.cancel_outlined, color: colors.error), + 'warning' => Icon(Icons.warning_amber_rounded, color: colors.warn), + 'info' => const Icon(Icons.info_outline, color: Color(0xff55c4dd)), + 'question' => const Icon(Icons.help_outline), + 'waiting' => const Center( + child: Padding( + padding: EdgeInsets.all(4.0), + child: SizedBox( + width: 24.0, + height: 24.0, + child: CircularProgressIndicator(), + ), + ), + ), + _ => const Icon(Icons.info_outline, color: Color(0xff55c4dd)), + }, + ), + iconPadding: const EdgeInsets.only( + top: 32.0, + left: 32.0, + bottom: 4.0, + right: 32.0, + ), + title: title != null ? Text(title ?? '') : null, + titlePadding: const EdgeInsets.symmetric(vertical: 4.0, horizontal: 32.0), + titleTextStyle: DefaultTextStyle.of(context) + .style + .apply(fontSizeFactor: 1.1) + .copyWith( + fontWeight: FontWeight.bold, + ), + content: Mfm( + account: account, + text: text, + textAlign: TextAlign.center, + ), + contentPadding: + const EdgeInsets.symmetric(vertical: 4.0, horizontal: 32.0), + actions: showCancelButton + ? [ + ElevatedButton( + style: ElevatedButton.styleFrom( + minimumSize: const Size(100.0, 40.0), + padding: const EdgeInsets.all(8.0), + ), + onPressed: () => context.pop(true), + child: Text(t.misskey.ok), + ), + OutlinedButton( + style: ElevatedButton.styleFrom( + minimumSize: const Size(100.0, 40.0), + padding: const EdgeInsets.all(8.0), + ), + onPressed: () => context.pop(false), + child: Text(t.misskey.cancel), + ), + ] + : [ + ElevatedButton( + onPressed: () => context.pop(), + child: Text(t.misskey.gotIt), + ), + ], + actionsPadding: const EdgeInsets.only( + top: 12.0, + left: 32.0, + bottom: 32.0, + right: 32.0, + ), + actionsAlignment: MainAxisAlignment.center, + scrollable: true, + ); + } +} diff --git a/lib/view/widget/post_form.dart b/lib/view/widget/post_form.dart index a31c9d01..0ff8e4d9 100644 --- a/lib/view/widget/post_form.dart +++ b/lib/view/widget/post_form.dart @@ -34,6 +34,7 @@ import '../../util/future_with_dialog.dart'; import '../dialog/post_confirmation_dialog.dart'; import '../dialog/user_select_dialog.dart'; import '../page/channel/channels_page.dart'; +import 'account_preview.dart'; import 'emoji_picker.dart'; import 'file_picker_sheet.dart'; import 'mention_widget.dart'; @@ -46,7 +47,6 @@ import 'post_form_attaches.dart'; import 'reaction_acceptance_icon.dart'; import 'reaction_acceptance_widget.dart'; import 'user_avatar.dart'; -import 'username_widget.dart'; class PostForm extends HookConsumerWidget { const PostForm({ @@ -131,17 +131,11 @@ class PostForm extends HookConsumerWidget { context: ref.context, builder: (context) => ListView.separated( itemBuilder: (context, index) { - final user = - ref.watch(iNotifierProvider(accounts[index])).valueOrNull; - return ListTile( - leading: user != null - ? UserAvatar(account: accounts[index], user: user, size: 50.0) - : null, - title: user != null - ? UsernameWidget(account: accounts[index], user: user) - : null, - subtitle: Text(accounts[index].toString()), + final account = accounts[index]; + return AccountPreview( + account: account, trailing: const Icon(Icons.navigate_next), + avatarSize: 40.0, onTap: () => context.pop(accounts[index]), ); }, diff --git a/lib/view/widget/reaction_users_sheet.dart b/lib/view/widget/reaction_users_sheet.dart index b4bc92cc..7f4c1fd4 100644 --- a/lib/view/widget/reaction_users_sheet.dart +++ b/lib/view/widget/reaction_users_sheet.dart @@ -9,7 +9,7 @@ import '../../provider/note_provider.dart'; import 'emoji_sheet.dart'; import 'emoji_widget.dart'; import 'paginated_list_view.dart'; -import 'user_tile.dart'; +import 'user_preview.dart'; class ReactionUsersSheet extends ConsumerWidget { const ReactionUsersSheet({ @@ -66,7 +66,7 @@ class ReactionUsersSheet extends ConsumerWidget { child: PaginatedListView( controller: scrollController, paginationState: reactions, - itemBuilder: (context, reaction) => UserTile( + itemBuilder: (context, reaction) => UserPreview( account: account, user: reaction.user, avatarSize: 50.0, diff --git a/lib/view/widget/renote_users_sheet.dart b/lib/view/widget/renote_users_sheet.dart index 3a7b7431..2f981a77 100644 --- a/lib/view/widget/renote_users_sheet.dart +++ b/lib/view/widget/renote_users_sheet.dart @@ -6,7 +6,7 @@ import '../../i18n/strings.g.dart'; import '../../model/account.dart'; import '../../provider/api/renotes_notifier_provider.dart'; import 'paginated_list_view.dart'; -import 'user_tile.dart'; +import 'user_preview.dart'; class RenoteUsersSheet extends ConsumerWidget { const RenoteUsersSheet({ @@ -39,7 +39,7 @@ class RenoteUsersSheet extends ConsumerWidget { child: PaginatedListView( controller: scrollController, paginationState: renotes, - itemBuilder: (context, note) => UserTile( + itemBuilder: (context, note) => UserPreview( account: account, user: note.user, onTap: () => context.push('/$account/users/${note.userId}'), diff --git a/lib/view/widget/streaming_error_icon.dart b/lib/view/widget/streaming_error_icon.dart index 5e1f68ba..462710bf 100644 --- a/lib/view/widget/streaming_error_icon.dart +++ b/lib/view/widget/streaming_error_icon.dart @@ -24,12 +24,10 @@ class StreamingErrorIcon extends HookConsumerWidget { delay.value *= 2; }), builder: (_, __) => IconButton( - onPressed: () => showDialog( - context: context, - builder: (context) => ErrorMessageDialog( - error: message.error, - stackTrace: message.stackTrace, - ), + onPressed: () => showErrorMessageDialog( + context, + error: message.error, + stackTrace: message.stackTrace, ), icon: const Icon(Icons.error), ), diff --git a/lib/view/widget/user_tile.dart b/lib/view/widget/user_preview.dart similarity index 92% rename from lib/view/widget/user_tile.dart rename to lib/view/widget/user_preview.dart index fa61f20e..3a406d2b 100644 --- a/lib/view/widget/user_tile.dart +++ b/lib/view/widget/user_preview.dart @@ -6,8 +6,8 @@ import 'acct_widget.dart'; import 'user_avatar.dart'; import 'username_widget.dart'; -class UserTile extends StatelessWidget { - const UserTile({ +class UserPreview extends StatelessWidget { + const UserPreview({ super.key, required this.account, required this.user, diff --git a/lib/view/widget/user_sheet.dart b/lib/view/widget/user_sheet.dart index c51b88ee..94fc522d 100644 --- a/lib/view/widget/user_sheet.dart +++ b/lib/view/widget/user_sheet.dart @@ -20,8 +20,7 @@ import '../dialog/antenna_dialog.dart'; import '../dialog/confirmation_dialog.dart'; import '../dialog/list_dialog.dart'; import '../dialog/text_field_dialog.dart'; -import 'user_avatar.dart'; -import 'username_widget.dart'; +import 'account_preview.dart'; class UserSheet extends ConsumerWidget { const UserSheet({ @@ -145,25 +144,16 @@ class UserSheet extends ConsumerWidget { context: context, builder: (context) => SimpleDialog( title: Text(t.aria.openInAnotherAccount), - children: switchCandidateAccounts.map((account) { - final i = - ref.watch(iNotifierProvider(account)).valueOrNull; - return ListTile( - leading: i != null - ? UserAvatar( - account: account, - user: i, - size: 50.0, - ) - : null, - title: i != null - ? UsernameWidget(account: account, user: i) - : null, - subtitle: Text(account.toString()), - trailing: const Icon(Icons.navigate_next), - onTap: () => context.pop(account), - ); - }).toList(), + children: switchCandidateAccounts + .map( + (account) => AccountPreview( + account: account, + trailing: const Icon(Icons.navigate_next), + avatarSize: 40.0, + onTap: () => context.pop(account), + ), + ) + .toList(), ), ); if (destination == null) return; diff --git a/linux/flutter/generated_plugins.cmake b/linux/flutter/generated_plugins.cmake index 65240e99..93469df2 100644 --- a/linux/flutter/generated_plugins.cmake +++ b/linux/flutter/generated_plugins.cmake @@ -8,6 +8,7 @@ list(APPEND FLUTTER_PLUGIN_LIST ) list(APPEND FLUTTER_FFI_PLUGIN_LIST + rust_lib_aria ) set(PLUGIN_BUNDLED_LIBRARIES) diff --git a/pubspec.lock b/pubspec.lock index 5c9a93f3..a08b890a 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -113,6 +113,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.4.1" + build_cli_annotations: + dependency: transitive + description: + name: build_cli_annotations + sha256: b59d2769769efd6c9ff6d4c4cede0be115a566afc591705c2040b707534b1172 + url: "https://pub.dev" + source: hosted + version: "2.1.0" build_config: dependency: transitive description: @@ -752,6 +760,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.5.1" + flutter_rust_bridge: + dependency: "direct main" + description: + name: flutter_rust_bridge + sha256: ee0d9798156ba523ca24bfb690efd15614f823685df270447c480dd5923d9a0b + url: "https://pub.dev" + source: hosted + version: "2.0.0-dev.39" flutter_secure_storage: dependency: "direct main" description: @@ -1233,8 +1249,8 @@ packages: dependency: "direct main" description: path: "." - ref: a335adc75d10583727f90601c62533f35c15f654 - resolved-ref: a335adc75d10583727f90601c62533f35c15f654 + ref: e8e6658212d878ce384c479c8e5a98f00cd584af + resolved-ref: e8e6658212d878ce384c479c8e5a98f00cd584af url: "https://github.com/poppingmoon/misskey_dart" source: git version: "1.0.0" @@ -1518,6 +1534,13 @@ packages: url: "https://pub.dev" source: hosted version: "2.3.10" + rust_lib_aria: + dependency: "direct main" + description: + path: rust_builder + relative: true + source: path + version: "0.0.1" rxdart: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index a5ae0f34..20034e11 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -36,6 +36,7 @@ dependencies: flutter_localizations: sdk: flutter flutter_math_fork: ^0.7.2 + flutter_rust_bridge: 2.0.0-dev.39 flutter_secure_storage: ^9.2.2 flutter_svg: ^2.0.10+1 fluttertoast: ^8.2.6 @@ -62,7 +63,7 @@ dependencies: misskey_dart: git: url: https://github.com/poppingmoon/misskey_dart - ref: a335adc75d10583727f90601c62533f35c15f654 + ref: e8e6658212d878ce384c479c8e5a98f00cd584af multi_split_view: ^3.1.0 package_info_plus: ^8.0.0 photo_view: ^0.15.0 @@ -71,6 +72,8 @@ dependencies: reorderable_grid: ^1.0.10 reorderables: ^0.6.0 riverpod_annotation: ^2.3.5 + rust_lib_aria: + path: rust_builder share_plus: ^9.0.0 shared_preferences: ^2.2.3 slang: ^3.31.0 diff --git a/rust/.gitignore b/rust/.gitignore new file mode 100644 index 00000000..ea8c4bf7 --- /dev/null +++ b/rust/.gitignore @@ -0,0 +1 @@ +/target diff --git a/rust/Cargo.lock b/rust/Cargo.lock new file mode 100644 index 00000000..63330f7c --- /dev/null +++ b/rust/Cargo.lock @@ -0,0 +1,1010 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "addr2line" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" + +[[package]] +name = "aho-corasick" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" +dependencies = [ + "memchr", +] + +[[package]] +name = "aiscript" +version = "0.1.0" +source = "git+https://github.com/poppingmoon/aiscript-rs?rev=2fcca58c795077e7f161bdb4aeeab7803e28477d#2fcca58c795077e7f161bdb4aeeab7803e28477d" +dependencies = [ + "chrono", + "futures", + "indexmap", + "peg", + "percent-encoding", + "rand", + "regex", + "serde", + "serde_json", + "thiserror", + "tokio", + "unicode-segmentation", + "uuid", +] + +[[package]] +name = "allo-isolate" +version = "0.1.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97b6d794345b06592d0ebeed8e477e41b71e5a0a49df4fc0e4184d5938b99509" +dependencies = [ + "anyhow", + "atomic", + "backtrace", +] + +[[package]] +name = "android-tzdata" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" + +[[package]] +name = "android_log-sys" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ecc8056bf6ab9892dcd53216c83d1597487d7dacac16c8df6b877d127df9937" + +[[package]] +name = "android_logger" +version = "0.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c494134f746c14dc653a35a4ea5aca24ac368529da5370ecf41fe0341c35772f" +dependencies = [ + "android_log-sys", + "env_logger", + "log", + "once_cell", +] + +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + +[[package]] +name = "anyhow" +version = "1.0.75" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" + +[[package]] +name = "atomic" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c59bdb34bc650a32731b31bd8f0829cc15d24a708ee31559e0bb34f2bc320cba" + +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + +[[package]] +name = "backtrace" +version = "0.3.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" +dependencies = [ + "addr2line", + "cc", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", +] + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "build-target" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "832133bbabbbaa9fbdba793456a2827627a7d2b8fb96032fa1e7666d7895832b" + +[[package]] +name = "bumpalo" +version = "3.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" + +[[package]] +name = "bytemuck" +version = "1.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "374d28ec25809ee0e23827c2ab573d729e293f281dfe393500e7ad618baa61c6" + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "cc" +version = "1.0.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" +dependencies = [ + "libc", +] + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "chrono" +version = "0.4.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" +dependencies = [ + "android-tzdata", + "iana-time-zone", + "js-sys", + "num-traits", + "wasm-bindgen", + "windows-targets", +] + +[[package]] +name = "console_error_panic_hook" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a06aeb73f470f66dcdbf7223caeebb85984942f22f1adb2a088cf9668146bbbc" +dependencies = [ + "cfg-if", + "wasm-bindgen", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "dart-sys-fork" +version = "4.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "933dafff26172b719bb9695dd3715a1e7792f62dcdc8a5d4c740db7e0fedee8b" +dependencies = [ + "cc", +] + +[[package]] +name = "dashmap" +version = "4.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e77a43b28d0668df09411cb0bc9a8c2adc40f9a048afe863e05fd43251e8e39c" +dependencies = [ + "cfg-if", + "num_cpus", +] + +[[package]] +name = "delegate-attr" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51aac4c99b2e6775164b412ea33ae8441b2fde2dbf05a20bc0052a63d08c475b" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", +] + +[[package]] +name = "env_logger" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95b3f3e67048839cb0d0781f445682a35113da7121f7c949db0e2be96a4fbece" +dependencies = [ + "log", + "regex", +] + +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + +[[package]] +name = "flutter_rust_bridge" +version = "2.0.0-dev.39" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92c9a3d358c2df51ac5ab05440334a63d7e2ce3229ca05d285769498bfe7fb8d" +dependencies = [ + "allo-isolate", + "android_logger", + "anyhow", + "build-target", + "bytemuck", + "byteorder", + "console_error_panic_hook", + "dart-sys-fork", + "delegate-attr", + "flutter_rust_bridge_macros", + "futures", + "js-sys", + "lazy_static", + "oslog", + "threadpool", + "tokio", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + +[[package]] +name = "flutter_rust_bridge_macros" +version = "2.0.0-dev.39" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c73c8b391f3c0aed00493871aee6541c03d117d553fa5c121f126dfbbad5157" +dependencies = [ + "hex", + "md-5", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "futures" +version = "0.3.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da0290714b38af9b4a7b094b8a37086d1b4e61f2df9122c3cad2577669145335" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff4dd66668b557604244583e3e1e1eada8c5c2e96a6d0d6653ede395b78bbacb" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb1d22c66e66d9d72e1758f0bd7d4fd0bee04cad842ee34587d68c07e45d088c" + +[[package]] +name = "futures-executor" +version = "0.3.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f4fb8693db0cf099eadcca0efe2a5a22e4550f98ed16aba6c48700da29597bc" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8bf34a163b5c4c52d0478a4d757da8fb65cabef42ba90515efee0f6f9fa45aaa" + +[[package]] +name = "futures-macro" +version = "0.3.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "futures-sink" +version = "0.3.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e36d3378ee38c2a36ad710c5d30c2911d752cb941c00c72dbabfb786a7970817" + +[[package]] +name = "futures-task" +version = "0.3.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "efd193069b0ddadc69c46389b740bbccdd97203899b48d09c5f7969591d6bae2" + +[[package]] +name = "futures-util" +version = "0.3.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a19526d624e703a3179b3d322efec918b6246ea0fa51d41124525f00f1cc8104" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "slab", +] + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94b22e06ecb0110981051723910cbf0b5f5e09a2062dd7663334ee79a9d1286c" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "gimli" +version = "0.28.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" + +[[package]] +name = "hashbrown" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" + +[[package]] +name = "hermit-abi" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "iana-time-zone" +version = "0.1.60" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + +[[package]] +name = "indexmap" +version = "2.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" +dependencies = [ + "equivalent", + "hashbrown", +] + +[[package]] +name = "itoa" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" + +[[package]] +name = "js-sys" +version = "0.3.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" +dependencies = [ + "wasm-bindgen", +] + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "libc" +version = "0.2.150" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c" + +[[package]] +name = "log" +version = "0.4.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" + +[[package]] +name = "md-5" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d89e7ee0cfbedfc4da3340218492196241d89eefb6dab27de5df917a6d2e78cf" +dependencies = [ + "cfg-if", + "digest", +] + +[[package]] +name = "memchr" +version = "2.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" + +[[package]] +name = "miniz_oxide" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +dependencies = [ + "adler", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "num_cpus" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" +dependencies = [ + "hermit-abi", + "libc", +] + +[[package]] +name = "object" +version = "0.32.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" +dependencies = [ + "memchr", +] + +[[package]] +name = "once_cell" +version = "1.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" + +[[package]] +name = "oslog" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8343ce955f18e7e68c0207dd0ea776ec453035685395ababd2ea651c569728b3" +dependencies = [ + "cc", + "dashmap", + "log", +] + +[[package]] +name = "peg" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a625d12ad770914cbf7eff6f9314c3ef803bfe364a1b20bc36ddf56673e71e5" +dependencies = [ + "peg-macros", + "peg-runtime", +] + +[[package]] +name = "peg-macros" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f241d42067ed3ab6a4fece1db720838e1418f36d868585a27931f95d6bc03582" +dependencies = [ + "peg-runtime", + "proc-macro2", + "quote", +] + +[[package]] +name = "peg-runtime" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3aeb8f54c078314c2065ee649a7241f46b9d8e418e1a9581ba0546657d7aa3a" + +[[package]] +name = "percent-encoding" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" + +[[package]] +name = "pin-project-lite" +version = "0.2.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "ppv-lite86" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" + +[[package]] +name = "proc-macro2" +version = "1.0.85" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22244ce15aa966053a896d1accb3a6e68469b97c7f33f284b99f0d576879fc23" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom", +] + +[[package]] +name = "regex" +version = "1.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b91213439dad192326a0d7c6ee3955910425f441d7038e0d6933b0aec5c4517f" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" + +[[package]] +name = "rust_lib_aria" +version = "0.1.0" +dependencies = [ + "aiscript", + "flutter_rust_bridge", + "futures", + "indexmap", + "serde_json", + "uuid", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" + +[[package]] +name = "ryu" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" + +[[package]] +name = "serde" +version = "1.0.203" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.203" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.117" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "455182ea6142b14f93f4bc5320a2b31c1f266b66a4a5c858b013302a5d8cbfc3" +dependencies = [ + "indexmap", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "slab" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" +dependencies = [ + "autocfg", +] + +[[package]] +name = "syn" +version = "2.0.66" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c42f3f41a2de00b01c0aaad383c5a45241efc8b2d1eda5661812fda5f3cdcff5" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "thiserror" +version = "1.0.61" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.61" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "threadpool" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d050e60b33d41c19108b32cea32164033a9013fe3b46cbd4457559bfbf77afaa" +dependencies = [ + "num_cpus", +] + +[[package]] +name = "tokio" +version = "1.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0c014766411e834f7af5b8f4cf46257aab4036ca95e9d2c144a10f59ad6f5b9" +dependencies = [ + "backtrace", + "num_cpus", + "pin-project-lite", +] + +[[package]] +name = "typenum" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" + +[[package]] +name = "unicode-ident" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + +[[package]] +name = "unicode-segmentation" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202" + +[[package]] +name = "uuid" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a183cf7feeba97b4dd1c0d46788634f6221d87fa961b305bed08c851829efcc0" +dependencies = [ + "getrandom", +] + +[[package]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "wasm-bindgen" +version = "0.2.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" +dependencies = [ + "cfg-if", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" +dependencies = [ + "bumpalo", + "log", + "once_cell", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76bc14366121efc8dbb487ab05bcc9d346b3b5ec0eaa76e46594cabbe51762c0" +dependencies = [ + "cfg-if", + "js-sys", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" + +[[package]] +name = "web-sys" +version = "0.3.66" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50c24a44ec86bb68fbecd1b3efed7e85ea5621b39b35ef2766b66cd984f8010f" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "windows-core" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" diff --git a/rust/Cargo.toml b/rust/Cargo.toml new file mode 100644 index 00000000..29dbc2c3 --- /dev/null +++ b/rust/Cargo.toml @@ -0,0 +1,15 @@ +[package] +name = "rust_lib_aria" +version = "0.1.0" +edition = "2021" + +[lib] +crate-type = ["cdylib", "staticlib"] + +[dependencies] +aiscript = { git = "https://github.com/poppingmoon/aiscript-rs", rev = "2fcca58c795077e7f161bdb4aeeab7803e28477d" } +flutter_rust_bridge = "=2.0.0-dev.39" +futures = "0.3" +indexmap = "2.2" +serde_json = { version = "1.0", features = ["preserve_order"] } +uuid = { version = "1.8", features = ["v4"] } diff --git a/rust/src/api/aiscript.rs b/rust/src/api/aiscript.rs new file mode 100644 index 00000000..ba01230d --- /dev/null +++ b/rust/src/api/aiscript.rs @@ -0,0 +1,73 @@ +use std::{collections::HashMap, sync::Arc}; + +use aiscript::values::{Value, V}; +use flutter_rust_bridge::DartFnFuture; +use futures::FutureExt; + +pub mod api; +pub mod play; +pub mod ui; + +pub struct AiScript { + pub(crate) parser: aiscript::Parser, + pub(crate) interpreter: aiscript::Interpreter, +} + +impl AiScript { + pub async fn new( + read: impl Fn(String) -> DartFnFuture + Sync + Send + 'static, + write: impl Fn(String) -> DartFnFuture<()> + Sync + Send + 'static, + api: Option, + ui: Option, + play: Option, + ) -> Self { + let parser = aiscript::Parser::default(); + let mut consts = HashMap::new(); + if let Some(api) = api { + api.register(&mut consts); + } + if let Some(ui) = ui { + ui.register(&mut consts).await; + } + if let Some(play) = play { + play.register(&mut consts); + } + let in_ = Arc::new(read); + let out = Arc::new(write); + let interpreter = aiscript::Interpreter::new( + consts, + Some(move |input| in_(input)), + Some(move |value: Value| { + let out = out.clone(); + async move { + let text = match *value.value { + V::Num(value) => value.to_string(), + V::Str(value) => value, + value => value.to_string(), + }; + out(text).await; + } + .boxed() + }), + None:: _>, + None, + ); + AiScript { + parser, + interpreter, + } + } + + pub async fn exec(&self, input: &str) -> Result<(), String> { + let script = self.parser.parse(input).map_err(|err| err.to_string())?; + self.interpreter + .exec(script) + .await + .map_err(|err| err.to_string())?; + Ok(()) + } + + pub fn abort(&self) { + self.interpreter.abort(); + } +} diff --git a/rust/src/api/aiscript/api.rs b/rust/src/api/aiscript/api.rs new file mode 100644 index 00000000..f95f82b3 --- /dev/null +++ b/rust/src/api/aiscript/api.rs @@ -0,0 +1,304 @@ +use std::{collections::HashMap, sync::Arc}; + +use aiscript::{ + errors::AiScriptError, + utils, + values::{Value, V}, +}; +use flutter_rust_bridge::{frb, DartFnFuture}; +use futures::FutureExt; + +pub type DialogCallback = + dyn Fn(String, String, String) -> DartFnFuture<()> + Sync + Send + 'static; + +pub type ConfirmCallback = + dyn Fn(String, String, String) -> DartFnFuture + Sync + Send + 'static; + +pub type ApiCallback = dyn Fn(String, String, Option) -> DartFnFuture<(String, Option)> + + Sync + + Send + + 'static; + +pub struct AsApiLib { + user_id: Option, + user_name: Option, + user_username: Option, + custom_emojis: String, + locale: String, + server_url: String, + dialog: Arc, + confirm: Arc, + token: Option, + api: Arc, + save: Arc DartFnFuture<()> + Sync + Send + 'static>, + load: Arc DartFnFuture + Sync + Send + 'static>, + url: String, + nyaize: Arc DartFnFuture + Sync + Send + 'static>, +} + +impl AsApiLib { + #[frb(sync)] + #[allow(clippy::too_many_arguments)] + pub fn new( + user_id: Option, + user_name: Option, + user_username: Option, + custom_emojis: String, + locale: String, + server_url: String, + dialog: impl Fn(String, String, String) -> DartFnFuture<()> + Sync + Send + 'static, + confirm: impl Fn(String, String, String) -> DartFnFuture + Sync + Send + 'static, + token: Option, + api: impl Fn(String, String, Option) -> DartFnFuture<(String, Option)> + + Sync + + Send + + 'static, + save: impl Fn(String, String) -> DartFnFuture<()> + Sync + Send + 'static, + load: impl Fn(String) -> DartFnFuture + Sync + Send + 'static, + url: String, + nyaize: impl Fn(String) -> DartFnFuture + Sync + Send + 'static, + ) -> Self { + AsApiLib { + user_id, + user_name, + user_username, + custom_emojis, + locale, + server_url, + dialog: Arc::new(dialog), + confirm: Arc::new(confirm), + token, + api: Arc::new(api), + save: Arc::new(save), + load: Arc::new(load), + url, + nyaize: Arc::new(nyaize), + } + } + + pub(crate) fn register(&self, consts: &mut HashMap) { + consts.insert( + "USER_ID".to_string(), + self.user_id.as_ref().map_or_else(Value::null, Value::str), + ); + + consts.insert( + "USER_NAME".to_string(), + self.user_name.as_ref().map_or_else(Value::null, Value::str), + ); + + consts.insert( + "USER_USERNAME".to_string(), + self.user_username + .as_ref() + .map_or_else(Value::null, Value::str), + ); + + consts.insert( + "CUSTOM_EMOJIS".to_string(), + serde_json::from_str(&self.custom_emojis).map_or_else(|_| Value::arr([]), Value::new), + ); + + consts.insert("LOCALE".to_string(), Value::str(&self.locale)); + + consts.insert("SERVER_URL".to_string(), Value::str(&self.server_url)); + + consts.insert( + "Mk:dialog".to_string(), + Value::fn_native({ + let dialog = self.dialog.clone(); + move |args, _| { + let dialog = dialog.clone(); + async move { + let mut args = args.into_iter(); + let title = args + .next() + .and_then(|value| { + if let V::Str(value) = *value.value { + Some(value) + } else { + None + } + }) + .unwrap_or_default(); + let text = args + .next() + .and_then(|value| { + if let V::Str(value) = *value.value { + Some(value) + } else { + None + } + }) + .unwrap_or_default(); + let type_ = args + .next() + .and_then(|value| { + if let V::Str(value) = *value.value { + Some(value) + } else { + None + } + }) + .unwrap_or("info".to_string()); + dialog(title, text, type_).await; + Ok(Value::null()) + } + .boxed() + } + }), + ); + + consts.insert( + "Mk:confirm".to_string(), + Value::fn_native({ + let confirm = self.confirm.clone(); + move |args, _| { + let confirm = confirm.clone(); + async move { + let mut args = args.into_iter(); + let title = args + .next() + .and_then(|value| { + if let V::Str(value) = *value.value { + Some(value) + } else { + None + } + }) + .unwrap_or_default(); + let text = args + .next() + .and_then(|value| { + if let V::Str(value) = *value.value { + Some(value) + } else { + None + } + }) + .unwrap_or_default(); + let type_ = args + .next() + .and_then(|value| { + if let V::Str(value) = *value.value { + Some(value) + } else { + None + } + }) + .unwrap_or("info".to_string()); + let result = confirm(title, text, type_).await; + Ok(Value::bool(result)) + } + .boxed() + } + }), + ); + + consts.insert( + "Mk:api".to_string(), + Value::fn_native({ + let api = self.api.clone(); + let token = self.token.clone(); + move |args, _| { + let api = api.clone(); + let token = token.clone(); + async move { + let mut args = args.into_iter(); + let ep = String::try_from(args.next().unwrap_or_default())?; + if ep.contains("://") { + Err(AiScriptError::Internal("invalid endpoint".to_string()))? + } + let param = utils::expect_any(args.next())?; + let token = args + .next() + .map(String::try_from) + .map_or(Ok(None), |r| r.map(Some))? + .or(token); + let result = api( + ep, + serde_json::to_string(¶m.value) + .map_err(|err| AiScriptError::Internal(err.to_string()))?, + token, + ) + .await; + if let Some(err) = &result.1 { + Err(AiScriptError::Internal(err.to_string()))? + } + let value = Value::new(serde_json::from_str(&result.0).unwrap_or_default()); + Ok(value) + } + .boxed() + } + }), + ); + + consts.insert( + "Mk:save".to_string(), + Value::fn_native({ + let save = self.save.clone(); + move |args, _| { + let save = save.clone(); + async move { + let mut args = args.into_iter(); + let key = String::try_from(args.next().unwrap_or_default())?; + let value = utils::expect_any(args.next())?; + save( + key, + serde_json::to_string(&value.value) + .map_err(|err| AiScriptError::Internal(err.to_string()))?, + ) + .await; + Ok(Value::null()) + } + .boxed() + } + }), + ); + + consts.insert( + "Mk:load".to_string(), + Value::fn_native({ + let load = self.load.clone(); + move |args, _| { + let load = load.clone(); + async move { + let mut args = args.into_iter(); + let key = String::try_from(args.next().unwrap_or_default())?; + let value = load(key).await; + let value = Value::new(serde_json::from_str(&value).unwrap_or_default()); + Ok(value) + } + .boxed() + } + }), + ); + + consts.insert( + "Mk:url".to_string(), + Value::fn_native({ + let url = self.url.clone(); + move |_, _| { + let url = url.clone(); + async move { Ok(Value::str(url)) }.boxed() + } + }), + ); + + consts.insert( + "Mk:nyaize".to_string(), + Value::fn_native({ + let nyaize = self.nyaize.clone(); + move |args, _| { + let nyaize = nyaize.clone(); + async move { + let mut args = args.into_iter(); + let text = String::try_from(args.next().unwrap_or_default())?; + Ok(Value::str(nyaize(text).await)) + } + .boxed() + } + }), + ); + } +} diff --git a/rust/src/api/aiscript/play.rs b/rust/src/api/aiscript/play.rs new file mode 100644 index 00000000..c6082ea1 --- /dev/null +++ b/rust/src/api/aiscript/play.rs @@ -0,0 +1,16 @@ +use std::collections::HashMap; + +use aiscript::values::Value; + +pub struct AsPlayLib { + pub this_id: String, + pub this_url: String, +} + +impl AsPlayLib { + pub(crate) fn register(&self, consts: &mut HashMap) { + consts.insert("THIS_ID".to_string(), Value::str(&self.this_id)); + + consts.insert("THIS_URL".to_string(), Value::str(&self.this_url)); + } +} diff --git a/rust/src/api/aiscript/ui.rs b/rust/src/api/aiscript/ui.rs new file mode 100644 index 00000000..cc3c25e4 --- /dev/null +++ b/rust/src/api/aiscript/ui.rs @@ -0,0 +1,1795 @@ +use std::{collections::HashMap, ops::Deref, sync::Arc}; + +use aiscript::{ + errors::AiScriptError, + values::{VArr, VFn, VObj, Value, V}, + Interpreter, +}; +use flutter_rust_bridge::{frb, DartFnFuture}; +pub use futures::future::BoxFuture; +use futures::{lock::Mutex, FutureExt}; +use indexmap::IndexMap; +use uuid::Uuid; + +#[derive(Clone)] +pub struct AsUiRoot { + pub children: Vec, +} + +impl TryFrom for AsUiRoot { + type Error = AiScriptError; + + fn try_from(value: Value) -> Result { + let def = VObj::try_from(value)?; + let def = def.read().unwrap(); + + let children = >::try_from(def.get("children").cloned().unwrap_or_default())?; + let mut ids = Vec::new(); + for value in children { + let value = >::try_from(value)?; + if let Some(Value { value, .. }) = value.get("id") { + if let V::Str(id) = value.deref() { + ids.push(id.clone()); + } + } + } + + Ok(AsUiRoot { children: ids }) + } +} + +impl AsUiRoot { + fn update(&mut self, updates: Self) { + let AsUiRoot { children } = updates; + self.children = children; + } +} + +#[derive(Clone)] +pub struct AsUiContainer { + pub children: Option>, + pub align: Option, + pub bg_color: Option, + pub fg_color: Option, + pub font: Option, + pub border_width: Option, + pub border_color: Option, + pub padding: Option, + pub rounded: Option, + pub hidden: Option, +} + +impl TryFrom for AsUiContainer { + type Error = AiScriptError; + + fn try_from(value: Value) -> Result { + let def = VObj::try_from(value)?; + let def = def.read().unwrap(); + + let children = def + .get("children") + .cloned() + .map(>::try_from) + .map_or(Ok(None), |r| r.map(Some))? + .map(|children| { + let mut ids = Vec::new(); + for value in children { + let value = >::try_from(value)?; + if let Some(Value { value, .. }) = value.get("id") { + if let V::Str(id) = value.deref() { + ids.push(id.clone()); + } + } + } + Ok::, AiScriptError>(ids) + }) + .map_or(Ok(None), |r| r.map(Some))?; + let align = def + .get("align") + .cloned() + .map(String::try_from) + .map_or(Ok(None), |r| r.map(Some))?; + let bg_color = def + .get("bgColor") + .cloned() + .map(String::try_from) + .map_or(Ok(None), |r| r.map(Some))?; + let fg_color = def + .get("fgColor") + .cloned() + .map(String::try_from) + .map_or(Ok(None), |r| r.map(Some))?; + let font = def + .get("font") + .cloned() + .map(String::try_from) + .map_or(Ok(None), |r| r.map(Some))?; + let border_width = def + .get("borderWidth") + .cloned() + .map(f64::try_from) + .map_or(Ok(None), |r| r.map(Some))?; + let border_color = def + .get("borderColor") + .cloned() + .map(String::try_from) + .map_or(Ok(None), |r| r.map(Some))?; + let padding = def + .get("padding") + .cloned() + .map(f64::try_from) + .map_or(Ok(None), |r| r.map(Some))?; + let rounded = def + .get("rounded") + .cloned() + .map(bool::try_from) + .map_or(Ok(None), |r| r.map(Some))?; + let hidden = def + .get("hidden") + .cloned() + .map(bool::try_from) + .map_or(Ok(None), |r| r.map(Some))?; + + Ok(AsUiContainer { + children, + align, + bg_color, + fg_color, + font, + border_width, + border_color, + padding, + rounded, + hidden, + }) + } +} + +impl AsUiContainer { + fn update(&mut self, updates: Self) { + let AsUiContainer { + children, + align, + bg_color, + fg_color, + font, + border_width, + border_color, + padding, + rounded, + hidden, + } = updates; + if children.is_some() { + self.children = children; + } + if align.is_some() { + self.align = align; + } + if bg_color.is_some() { + self.bg_color = bg_color; + } + if fg_color.is_some() { + self.fg_color = fg_color; + } + if font.is_some() { + self.font = font; + } + if border_width.is_some() { + self.border_width = border_width; + } + if border_color.is_some() { + self.border_color = border_color; + } + if padding.is_some() { + self.padding = padding; + } + if rounded.is_some() { + self.rounded = rounded; + } + if hidden.is_some() { + self.hidden = hidden; + } + } +} + +#[derive(Clone)] +pub struct AsUiText { + pub text: Option, + pub size: Option, + pub bold: Option, + pub color: Option, + pub font: Option, +} + +impl TryFrom for AsUiText { + type Error = AiScriptError; + + fn try_from(value: Value) -> Result { + let def = VObj::try_from(value)?; + let def = def.read().unwrap(); + + let text = def + .get("text") + .cloned() + .map(String::try_from) + .map_or(Ok(None), |r| r.map(Some))?; + let size = def + .get("size") + .cloned() + .map(f64::try_from) + .map_or(Ok(None), |r| r.map(Some))?; + let bold = def + .get("bold") + .cloned() + .map(bool::try_from) + .map_or(Ok(None), |r| r.map(Some))?; + let color = def + .get("color") + .cloned() + .map(String::try_from) + .map_or(Ok(None), |r| r.map(Some))?; + let font = def + .get("font") + .cloned() + .map(String::try_from) + .map_or(Ok(None), |r| r.map(Some))?; + + Ok(AsUiText { + text, + size, + bold, + color, + font, + }) + } +} + +impl AsUiText { + fn update(&mut self, updates: Self) { + let AsUiText { + text, + size, + bold, + color, + font, + } = updates; + if text.is_some() { + self.text = text; + } + if size.is_some() { + self.size = size; + } + if bold.is_some() { + self.bold = bold; + } + if color.is_some() { + self.color = color; + } + if font.is_some() { + self.font = font; + } + } +} + +#[derive(Clone)] +pub struct AsUiMfmCallback( + Arc BoxFuture<'static, Result<(), String>> + Sync + Send + 'static>, +); + +impl AsUiMfmCallback { + pub async fn call(&self, value: String) -> Result<(), String> { + self.0(value).await + } +} + +#[derive(Clone)] +pub struct AsUiMfm { + pub text: Option, + pub size: Option, + pub bold: Option, + pub color: Option, + pub font: Option, + pub on_click_ev: Option, +} + +impl TryFrom<(Value, &Interpreter)> for AsUiMfm { + type Error = AiScriptError; + + fn try_from((value, interpreter): (Value, &Interpreter)) -> Result { + let def = VObj::try_from(value)?; + let def = def.read().unwrap(); + + let text = def + .get("text") + .cloned() + .map(String::try_from) + .map_or(Ok(None), |r| r.map(Some))?; + let size = def + .get("size") + .cloned() + .map(f64::try_from) + .map_or(Ok(None), |r| r.map(Some))?; + let bold = def + .get("bold") + .cloned() + .map(bool::try_from) + .map_or(Ok(None), |r| r.map(Some))?; + let color = def + .get("color") + .cloned() + .map(String::try_from) + .map_or(Ok(None), |r| r.map(Some))?; + let font = def + .get("font") + .cloned() + .map(String::try_from) + .map_or(Ok(None), |r| r.map(Some))?; + let on_click_ev = def + .get("onClickEv") + .cloned() + .map(VFn::try_from) + .map_or(Ok(None), |r| r.map(Some))? + .map(|on_click_ev| { + AsUiMfmCallback(Arc::new({ + let interpreter = interpreter.clone(); + move |v| { + let interpreter = interpreter.clone(); + let on_click_ev = on_click_ev.clone(); + async move { + interpreter + .exec_fn(on_click_ev, [Value::str(v)]) + .await + .map_err(|err| err.to_string())?; + Ok(()) + } + .boxed() + } + })) + }); + + Ok(AsUiMfm { + text, + size, + bold, + color, + font, + on_click_ev, + }) + } +} + +impl AsUiMfm { + fn update(&mut self, updates: Self) { + let AsUiMfm { + text, + size, + bold, + color, + font, + on_click_ev, + } = updates; + if text.is_some() { + self.text = text; + } + if size.is_some() { + self.size = size; + } + if bold.is_some() { + self.bold = bold; + } + if color.is_some() { + self.color = color; + } + if font.is_some() { + self.font = font; + } + if on_click_ev.is_some() { + self.on_click_ev = on_click_ev; + } + } +} + +#[derive(Clone)] +pub struct AsUiButtonCallback( + Arc BoxFuture<'static, Result<(), String>> + Sync + Send + 'static>, +); + +impl AsUiButtonCallback { + pub async fn call(&self) -> Result<(), String> { + self.0().await + } +} + +#[derive(Clone)] +pub struct AsUiButton { + pub text: Option, + pub on_click: Option, + pub primary: Option, + pub rounded: Option, + pub disabled: Option, +} + +impl TryFrom<(Value, &Interpreter)> for AsUiButton { + type Error = AiScriptError; + + fn try_from((value, interpreter): (Value, &Interpreter)) -> Result { + let def = VObj::try_from(value)?; + let def = def.read().unwrap(); + + let text = def + .get("text") + .cloned() + .map(String::try_from) + .map_or(Ok(None), |r| r.map(Some))?; + let on_click = def + .get("onClick") + .cloned() + .map(VFn::try_from) + .map_or(Ok(None), |r| r.map(Some))? + .map(|on_click| { + AsUiButtonCallback(Arc::new({ + let interpreter = interpreter.clone(); + move || { + let interpreter = interpreter.clone(); + let on_click = on_click.clone(); + async move { + interpreter + .exec_fn(on_click, []) + .await + .map_err(|err| err.to_string())?; + Ok(()) + } + .boxed() + } + })) + }); + let primary = def + .get("primary") + .cloned() + .map(bool::try_from) + .map_or(Ok(None), |r| r.map(Some))?; + let rounded = def + .get("rounded") + .cloned() + .map(bool::try_from) + .map_or(Ok(None), |r| r.map(Some))?; + let disabled = def + .get("disabled") + .cloned() + .map(bool::try_from) + .map_or(Ok(None), |r| r.map(Some))?; + + Ok(AsUiButton { + text, + on_click, + primary, + rounded, + disabled, + }) + } +} + +impl AsUiButton { + fn update(&mut self, updates: Self) { + let AsUiButton { + text, + on_click, + primary, + rounded, + disabled, + } = updates; + if text.is_some() { + self.text = text; + } + if on_click.is_some() { + self.on_click = on_click; + } + if primary.is_some() { + self.primary = primary; + } + if rounded.is_some() { + self.rounded = rounded; + } + if disabled.is_some() { + self.disabled = disabled; + } + } +} + +#[derive(Clone)] +pub struct AsUiButtons { + pub buttons: Option>, +} + +impl TryFrom<(Value, &Interpreter)> for AsUiButtons { + type Error = AiScriptError; + + fn try_from((value, interpreter): (Value, &Interpreter)) -> Result { + let def = VObj::try_from(value)?; + let def = def.read().unwrap(); + + let buttons = def + .get("buttons") + .cloned() + .map(>::try_from) + .map_or(Ok(None), |r| r.map(Some))? + .map(|buttons| { + buttons + .into_iter() + .map(|button| AsUiButton::try_from((button, interpreter))) + .collect::, AiScriptError>>() + }) + .map_or(Ok(None), |r| r.map(Some))?; + + Ok(AsUiButtons { buttons }) + } +} + +impl AsUiButtons { + fn update(&mut self, updates: Self) { + let AsUiButtons { buttons } = updates; + if buttons.is_some() { + self.buttons = buttons; + } + } +} + +#[derive(Clone)] +pub struct AsUiSwitchCallback( + Arc BoxFuture<'static, Result<(), String>> + Sync + Send + 'static>, +); + +impl AsUiSwitchCallback { + pub async fn call(&self, value: bool) -> Result<(), String> { + self.0(value).await + } +} + +#[derive(Clone)] +pub struct AsUiSwitch { + pub on_change: Option, + pub default_value: Option, + pub label: Option, + pub caption: Option, +} + +impl TryFrom<(Value, &Interpreter)> for AsUiSwitch { + type Error = AiScriptError; + + fn try_from((value, interpreter): (Value, &Interpreter)) -> Result { + let def = VObj::try_from(value)?; + let def = def.read().unwrap(); + + let on_change = def + .get("onChange") + .cloned() + .map(VFn::try_from) + .map_or(Ok(None), |r| r.map(Some))? + .map(|on_change| { + AsUiSwitchCallback(Arc::new({ + let interpreter = interpreter.clone(); + move |v| { + let interpreter = interpreter.clone(); + let on_change = on_change.clone(); + async move { + interpreter + .exec_fn(on_change, [Value::bool(v)]) + .await + .map_err(|err| err.to_string())?; + Ok(()) + } + .boxed() + } + })) + }); + let default = def + .get("default") + .cloned() + .map(bool::try_from) + .map_or(Ok(None), |r| r.map(Some))?; + let label = def + .get("label") + .cloned() + .map(String::try_from) + .map_or(Ok(None), |r| r.map(Some))?; + let caption = def + .get("caption") + .cloned() + .map(String::try_from) + .map_or(Ok(None), |r| r.map(Some))?; + + Ok(AsUiSwitch { + on_change, + default_value: default, + label, + caption, + }) + } +} + +impl AsUiSwitch { + fn update(&mut self, updates: Self) { + let AsUiSwitch { + on_change, + default_value, + label, + caption, + } = updates; + if on_change.is_some() { + self.on_change = on_change; + } + if default_value.is_some() { + self.default_value = default_value; + } + if label.is_some() { + self.label = label; + } + if caption.is_some() { + self.caption = caption; + } + } +} + +#[derive(Clone)] +pub struct AsUiTextareaCallback( + Arc BoxFuture<'static, Result<(), String>> + Sync + Send + 'static>, +); + +impl AsUiTextareaCallback { + pub async fn call(&self, value: String) -> Result<(), String> { + self.0(value).await + } +} + +#[derive(Clone)] +pub struct AsUiTextarea { + pub on_input: Option, + pub default_value: Option, + pub label: Option, + pub caption: Option, +} + +impl TryFrom<(Value, &Interpreter)> for AsUiTextarea { + type Error = AiScriptError; + + fn try_from((value, interpreter): (Value, &Interpreter)) -> Result { + let def = VObj::try_from(value)?; + let def = def.read().unwrap(); + + let on_input = def + .get("onInput") + .cloned() + .map(VFn::try_from) + .map_or(Ok(None), |r| r.map(Some))? + .map(|on_input| { + AsUiTextareaCallback(Arc::new({ + let interpreter = interpreter.clone(); + move |v| { + let interpreter = interpreter.clone(); + let on_input = on_input.clone(); + async move { + interpreter + .exec_fn(on_input, [Value::str(v)]) + .await + .map_err(|err| err.to_string())?; + Ok(()) + } + .boxed() + } + })) + }); + let default = def + .get("default") + .cloned() + .map(String::try_from) + .map_or(Ok(None), |r| r.map(Some))?; + let label = def + .get("label") + .cloned() + .map(String::try_from) + .map_or(Ok(None), |r| r.map(Some))?; + let caption = def + .get("caption") + .cloned() + .map(String::try_from) + .map_or(Ok(None), |r| r.map(Some))?; + + Ok(AsUiTextarea { + on_input, + default_value: default, + label, + caption, + }) + } +} + +impl AsUiTextarea { + fn update(&mut self, updates: Self) { + let AsUiTextarea { + on_input, + default_value, + label, + caption, + } = updates; + if on_input.is_some() { + self.on_input = on_input; + } + if default_value.is_some() { + self.default_value = default_value; + } + if label.is_some() { + self.label = label; + } + if caption.is_some() { + self.caption = caption; + } + } +} + +#[derive(Clone)] +pub struct AsUiTextInputCallback( + Arc BoxFuture<'static, Result<(), String>> + Sync + Send + 'static>, +); + +impl AsUiTextInputCallback { + pub async fn call(&self, value: String) -> Result<(), String> { + self.0(value).await + } +} + +#[derive(Clone)] +pub struct AsUiTextInput { + pub on_input: Option, + pub default_value: Option, + pub label: Option, + pub caption: Option, +} + +impl TryFrom<(Value, &Interpreter)> for AsUiTextInput { + type Error = AiScriptError; + + fn try_from((value, interpreter): (Value, &Interpreter)) -> Result { + let def = VObj::try_from(value)?; + let def = def.read().unwrap(); + + let on_input = def + .get("onInput") + .cloned() + .map(VFn::try_from) + .map_or(Ok(None), |r| r.map(Some))? + .map(|on_input| { + AsUiTextInputCallback(Arc::new({ + let interpreter = interpreter.clone(); + move |v| { + let interpreter = interpreter.clone(); + let on_input = on_input.clone(); + async move { + interpreter + .exec_fn(on_input, [Value::str(v)]) + .await + .map_err(|err| err.to_string())?; + Ok(()) + } + .boxed() + } + })) + }); + let default = def + .get("default") + .cloned() + .map(String::try_from) + .map_or(Ok(None), |r| r.map(Some))?; + let label = def + .get("label") + .cloned() + .map(String::try_from) + .map_or(Ok(None), |r| r.map(Some))?; + let caption = def + .get("caption") + .cloned() + .map(String::try_from) + .map_or(Ok(None), |r| r.map(Some))?; + + Ok(AsUiTextInput { + on_input, + default_value: default, + label, + caption, + }) + } +} + +impl AsUiTextInput { + fn update(&mut self, updates: Self) { + let AsUiTextInput { + on_input, + default_value, + label, + caption, + } = updates; + if on_input.is_some() { + self.on_input = on_input; + } + if default_value.is_some() { + self.default_value = default_value; + } + if label.is_some() { + self.label = label; + } + if caption.is_some() { + self.caption = caption; + } + } +} + +#[derive(Clone)] +pub struct AsUiNumberCallback( + Arc BoxFuture<'static, Result<(), String>> + Sync + Send + 'static>, +); + +impl AsUiNumberCallback { + pub async fn call(&self, value: f64) -> Result<(), String> { + self.0(value).await + } +} + +#[derive(Clone)] +pub struct AsUiNumberInput { + pub on_input: Option, + pub default_value: Option, + pub label: Option, + pub caption: Option, +} + +impl TryFrom<(Value, &Interpreter)> for AsUiNumberInput { + type Error = AiScriptError; + + fn try_from((value, interpreter): (Value, &Interpreter)) -> Result { + let def = VObj::try_from(value)?; + let def = def.read().unwrap(); + + let on_input = def + .get("onInput") + .cloned() + .map(VFn::try_from) + .map_or(Ok(None), |r| r.map(Some))? + .map(|on_input| { + AsUiNumberCallback(Arc::new({ + let interpreter = interpreter.clone(); + move |v| { + let interpreter = interpreter.clone(); + let on_input = on_input.clone(); + async move { + interpreter + .exec_fn(on_input, [Value::num(v)]) + .await + .map_err(|err| err.to_string())?; + Ok(()) + } + .boxed() + } + })) + }); + let default = def + .get("default") + .cloned() + .map(f64::try_from) + .map_or(Ok(None), |r| r.map(Some))?; + let label = def + .get("label") + .cloned() + .map(String::try_from) + .map_or(Ok(None), |r| r.map(Some))?; + let caption = def + .get("caption") + .cloned() + .map(String::try_from) + .map_or(Ok(None), |r| r.map(Some))?; + + Ok(AsUiNumberInput { + on_input, + default_value: default, + label, + caption, + }) + } +} + +impl AsUiNumberInput { + fn update(&mut self, updates: Self) { + let AsUiNumberInput { + on_input, + default_value, + label, + caption, + } = updates; + if on_input.is_some() { + self.on_input = on_input; + } + if default_value.is_some() { + self.default_value = default_value; + } + if label.is_some() { + self.label = label; + } + if caption.is_some() { + self.caption = caption; + } + } +} + +#[derive(Clone)] +pub struct AsUiSelectCallback( + Arc BoxFuture<'static, Result<(), String>> + Sync + Send + 'static>, +); + +impl AsUiSelectCallback { + pub async fn call(&self, value: String) -> Result<(), String> { + self.0(value).await + } +} + +#[derive(Clone)] +pub struct AsUiSelect { + pub items: Option>, + pub on_change: Option, + pub default_value: Option, + pub label: Option, + pub caption: Option, +} + +impl TryFrom<(Value, &Interpreter)> for AsUiSelect { + type Error = AiScriptError; + + fn try_from((value, interpreter): (Value, &Interpreter)) -> Result { + let def = VObj::try_from(value)?; + let def = def.read().unwrap(); + + let items = def + .get("items") + .cloned() + .map(>::try_from) + .map_or(Ok(None), |r| r.map(Some))? + .map(|items| { + items + .into_iter() + .map(|item| { + let item = VObj::try_from(item)?; + let item = item.read().unwrap(); + let text = item.get("text"); + let text = String::try_from(text.cloned().unwrap_or_default())?; + let value = item.get("value"); + let value = value + .cloned() + .map(String::try_from) + .map_or(Ok(None), |r| r.map(Some))?; + Ok((text.clone(), value.unwrap_or(text))) + }) + .collect::, AiScriptError>>() + }) + .map_or(Ok(None), |r| r.map(Some))?; + let on_change = def + .get("onChange") + .cloned() + .map(VFn::try_from) + .map_or(Ok(None), |r| r.map(Some))? + .map(|on_change| { + AsUiSelectCallback(Arc::new({ + let interpreter = interpreter.clone(); + move |v| { + let interpreter = interpreter.clone(); + let on_change = on_change.clone(); + async move { + interpreter + .exec_fn(on_change, [Value::str(v)]) + .await + .map_err(|err| err.to_string())?; + Ok(()) + } + .boxed() + } + })) + }); + let default = def + .get("default") + .cloned() + .map(String::try_from) + .map_or(Ok(None), |r| r.map(Some))?; + let label = def + .get("label") + .cloned() + .map(String::try_from) + .map_or(Ok(None), |r| r.map(Some))?; + let caption = def + .get("caption") + .cloned() + .map(String::try_from) + .map_or(Ok(None), |r| r.map(Some))?; + + Ok(AsUiSelect { + items, + on_change, + default_value: default, + label, + caption, + }) + } +} + +impl AsUiSelect { + fn update(&mut self, updates: Self) { + let AsUiSelect { + items, + on_change, + default_value, + label, + caption, + } = updates; + if items.is_some() { + self.items = items; + } + if on_change.is_some() { + self.on_change = on_change; + } + if default_value.is_some() { + self.default_value = default_value; + } + if label.is_some() { + self.label = label; + } + if caption.is_some() { + self.caption = caption; + } + } +} + +#[derive(Clone)] +pub struct AsUiFolder { + pub children: Option>, + pub title: Option, + pub opened: Option, +} + +impl TryFrom for AsUiFolder { + type Error = AiScriptError; + + fn try_from(value: Value) -> Result { + let def = VObj::try_from(value)?; + let def = def.read().unwrap(); + + let children = def.get("children"); + let children = children + .cloned() + .map(>::try_from) + .map_or(Ok(None), |r| r.map(Some))? + .map(|children| { + let mut ids = Vec::new(); + for value in children { + let value = VObj::try_from(value)?; + let value = value.read().unwrap(); + if let Some(Value { value, .. }) = value.get("id") { + if let V::Str(id) = value.deref() { + ids.push(id.clone()); + } + } + } + Ok::, AiScriptError>(ids) + }) + .map_or(Ok(None), |r| r.map(Some))?; + let title = def.get("title"); + let title = title + .cloned() + .map(String::try_from) + .map_or(Ok(None), |r| r.map(Some))?; + let opened = def.get("opened"); + let opened = opened + .cloned() + .map(bool::try_from) + .map_or(Ok(None), |r| r.map(Some))?; + + Ok(AsUiFolder { + children, + title, + opened, + }) + } +} + +impl AsUiFolder { + fn update(&mut self, updates: Self) { + let AsUiFolder { + children, + title, + opened, + } = updates; + if children.is_some() { + self.children = children; + } + if title.is_some() { + self.title = title; + } + if opened.is_some() { + self.opened = opened; + } + } +} + +#[derive(Clone)] +pub struct PostFormPropsForAsUi { + pub text: String, + pub cw: Option, + pub visibility: Option, + pub local_only: Option, +} + +impl TryFrom for PostFormPropsForAsUi { + type Error = AiScriptError; + + fn try_from(value: Value) -> Result { + let form = VObj::try_from(value)?; + let form = form.read().unwrap(); + + let text = form.get("text"); + let text = String::try_from(text.cloned().unwrap_or_default())?; + let cw = form.get("cw"); + let cw = cw + .cloned() + .map(String::try_from) + .map_or(Ok(None), |r| r.map(Some))?; + let visibility = form.get("visibility"); + let visibility = visibility + .cloned() + .map(String::try_from) + .map_or(Ok(None), |r| r.map(Some))?; + let local_only = form.get("local_only"); + let local_only = local_only + .cloned() + .map(bool::try_from) + .map_or(Ok(None), |r| r.map(Some))?; + + Ok(PostFormPropsForAsUi { + text, + cw, + visibility, + local_only, + }) + } +} + +#[derive(Clone)] +pub struct AsUiPostFormButton { + pub text: Option, + pub primary: Option, + pub rounded: Option, + pub form: Option, +} + +impl TryFrom for AsUiPostFormButton { + type Error = AiScriptError; + + fn try_from(value: Value) -> Result { + let def = VObj::try_from(value)?; + let def = def.read().unwrap(); + + let text = def.get("text"); + let text = text + .cloned() + .map(String::try_from) + .map_or(Ok(None), |r| r.map(Some))?; + let primary = def.get("primary"); + let primary = primary + .cloned() + .map(bool::try_from) + .map_or(Ok(None), |r| r.map(Some))?; + let rounded = def.get("rounded"); + let rounded = rounded + .cloned() + .map(bool::try_from) + .map_or(Ok(None), |r| r.map(Some))?; + let form = def.get("form"); + let form = form + .map(|form| PostFormPropsForAsUi::try_from(form.clone())) + .map_or(Ok(None), |r| r.map(Some))?; + + Ok(AsUiPostFormButton { + text, + primary, + rounded, + form, + }) + } +} + +impl AsUiPostFormButton { + fn update(&mut self, updates: Self) { + let AsUiPostFormButton { + text, + primary, + rounded, + form, + } = updates; + if text.is_some() { + self.text = text; + } + if primary.is_some() { + self.primary = primary; + } + if rounded.is_some() { + self.rounded = rounded; + } + if form.is_some() { + self.form = form; + } + } +} + +#[derive(Clone)] +pub struct AsUiPostForm { + pub form: Option, +} + +impl TryFrom for AsUiPostForm { + type Error = AiScriptError; + + fn try_from(value: Value) -> Result { + let def = VObj::try_from(value)?; + let def = def.read().unwrap(); + + let form = def.get("form"); + let form = form + .map(|form| PostFormPropsForAsUi::try_from(form.clone())) + .map_or(Ok(None), |r| r.map(Some))?; + + Ok(AsUiPostForm { form }) + } +} + +impl AsUiPostForm { + fn update(&mut self, updates: Self) { + let AsUiPostForm { form } = updates; + if form.is_some() { + self.form = form; + } + } +} + +#[derive(Clone)] +pub enum AsUiComponent { + Root(AsUiRoot), + Container(AsUiContainer), + Text(AsUiText), + Mfm(AsUiMfm), + Button(AsUiButton), + Buttons(AsUiButtons), + ToggleSwitch(AsUiSwitch), + Textarea(AsUiTextarea), + TextInput(AsUiTextInput), + NumberInput(AsUiNumberInput), + Select(AsUiSelect), + Folder(AsUiFolder), + PostFormButton(AsUiPostFormButton), + PostForm(AsUiPostForm), +} + +impl AsUiComponent { + fn update(&mut self, updates: AsUiComponent) { + match (self, updates) { + (AsUiComponent::Root(component), AsUiComponent::Root(updates)) => { + component.update(updates) + } + (AsUiComponent::Container(component), AsUiComponent::Container(updates)) => { + component.update(updates) + } + (AsUiComponent::Text(component), AsUiComponent::Text(updates)) => { + component.update(updates) + } + (AsUiComponent::Mfm(component), AsUiComponent::Mfm(updates)) => { + component.update(updates) + } + (AsUiComponent::Button(component), AsUiComponent::Button(updates)) => { + component.update(updates) + } + (AsUiComponent::Buttons(component), AsUiComponent::Buttons(updates)) => { + component.update(updates) + } + (AsUiComponent::ToggleSwitch(component), AsUiComponent::ToggleSwitch(updates)) => { + component.update(updates) + } + (AsUiComponent::Textarea(component), AsUiComponent::Textarea(updates)) => { + component.update(updates) + } + (AsUiComponent::TextInput(component), AsUiComponent::TextInput(updates)) => { + component.update(updates) + } + (AsUiComponent::NumberInput(component), AsUiComponent::NumberInput(updates)) => { + component.update(updates) + } + (AsUiComponent::Select(component), AsUiComponent::Select(updates)) => { + component.update(updates) + } + (AsUiComponent::Folder(component), AsUiComponent::Folder(updates)) => { + component.update(updates) + } + (AsUiComponent::PostFormButton(component), AsUiComponent::PostFormButton(updates)) => { + component.update(updates) + } + (AsUiComponent::PostForm(component), AsUiComponent::PostForm(updates)) => { + component.update(updates) + } + _ => (), + } + } +} + +#[derive(Clone)] +pub struct AsUiLib { + on_update: Arc DartFnFuture<()> + Sync + Send + 'static>, + components: Arc>>, + instances: Arc>>, +} + +impl AsUiLib { + #[frb(sync)] + pub fn new( + on_update: impl Fn(String, AsUiComponent) -> DartFnFuture<()> + Sync + Send + 'static, + ) -> Self { + AsUiLib { + on_update: Arc::new(on_update), + components: Arc::new(Mutex::new(HashMap::new())), + instances: Arc::new(Mutex::new(HashMap::new())), + } + } + + async fn create_component_instance( + &self, + def: Value, + id: Option, + get_options: impl Fn(Value) -> Result + + Sync + + Send + + Clone + + 'static, + ) -> Result { + let id = id + .map(String::try_from) + .map_or(Ok(None), |r| r.map(Some))? + .unwrap_or_else(|| Uuid::new_v4().to_string()); + let component = get_options(def)?; + self.components + .lock() + .await + .insert(id.clone(), component.clone()); + let instance = Value::obj([ + ("id", Value::str(&id)), + ( + "update", + Value::fn_native({ + let id = id.clone(); + let components = self.components.clone(); + let on_update = self.on_update.clone(); + move |args, _| { + let id = id.clone(); + let components = components.clone(); + let on_update = on_update.clone(); + let get_options = get_options.clone(); + async move { + let def = args.first().cloned().unwrap_or_else(Value::null); + let updates = get_options(def)?; + let mut components = components.lock().await; + let component = match components.get_mut(&id) { + Some(component) => { + component.update(updates); + component.clone() + } + None => { + components.insert(id.clone(), updates.clone()); + updates + } + }; + on_update(id, component).await; + Ok(Value::null()) + } + .boxed() + } + }), + ), + ]); + self.instances + .lock() + .await + .insert(id.clone(), instance.clone()); + (self.on_update)(id, component).await; + Ok(instance) + } + + pub(crate) async fn register(&self, consts: &mut HashMap) { + let root_id = "___root___"; + let root_instance = self + .create_component_instance( + Value::obj([("children", Value::arr([]))]), + Some(Value::str(root_id)), + |value| Ok(AsUiComponent::Root(AsUiRoot::try_from(value)?)), + ) + .await + .unwrap(); + + consts.insert("Ui:root".to_string(), root_instance); + + consts.insert( + "Ui:patch".to_string(), + Value::fn_native(|args, _| { + async move { + let mut args = args.into_iter(); + String::try_from(args.next().unwrap_or_default())?; + VArr::try_from(args.next().unwrap_or_default())?; + // Not implemented + Ok(Value::null()) + } + .boxed() + }), + ); + + consts.insert( + "Ui:get".to_string(), + Value::fn_native({ + let instances = self.instances.clone(); + move |args, _| { + let instances = instances.clone(); + async move { + let mut args = args.into_iter(); + let id = String::try_from(args.next().unwrap_or_default())?; + let instance = instances.lock().await.get(&id).cloned(); + Ok(instance.unwrap_or_else(Value::null)) + } + .boxed() + } + }), + ); + + consts.insert( + "Ui:render".to_string(), + Value::fn_native({ + let components = self.components.clone(); + let on_update = self.on_update.clone(); + move |args, _| { + let components = components.clone(); + let on_update = on_update.clone(); + async move { + let mut args = args.into_iter(); + let children = >::try_from(args.next().unwrap_or_default())?; + let mut ids = Vec::new(); + for value in children { + let value = VObj::try_from(value)?; + let value = value.read().unwrap(); + if let Some(Value { value, .. }) = value.get("id") { + if let V::Str(id) = value.deref() { + ids.push(id.clone()); + } + } + } + let component = AsUiComponent::Root(AsUiRoot { children: ids }); + components + .lock() + .await + .insert(root_id.to_string(), component.clone()); + on_update(root_id.to_string(), component).await; + Ok(Value::null()) + } + .boxed() + } + }), + ); + + consts.insert( + "Ui:C:container".to_string(), + Value::fn_native({ + let ui = self.clone(); + move |args, _| { + let ui = ui.clone(); + async move { + let mut args = args.into_iter(); + ui.create_component_instance( + args.next().unwrap_or_default(), + args.next(), + |value| Ok(AsUiComponent::Container(AsUiContainer::try_from(value)?)), + ) + .await + } + .boxed() + } + }), + ); + + consts.insert( + "Ui:C:text".to_string(), + Value::fn_native({ + let ui = self.clone(); + move |args, _| { + let ui = ui.clone(); + async move { + let mut args = args.into_iter(); + ui.create_component_instance( + args.next().unwrap_or_default(), + args.next(), + |value| Ok(AsUiComponent::Text(AsUiText::try_from(value)?)), + ) + .await + } + .boxed() + } + }), + ); + + consts.insert( + "Ui:C:mfm".to_string(), + Value::fn_native({ + let ui = self.clone(); + move |args, interpreter| { + let interpreter = interpreter.clone(); + let ui = ui.clone(); + async move { + let mut args = args.into_iter(); + ui.create_component_instance( + args.next().unwrap_or_default(), + args.next(), + move |value| { + Ok(AsUiComponent::Mfm(AsUiMfm::try_from(( + value, + &interpreter, + ))?)) + }, + ) + .await + } + .boxed() + } + }), + ); + + consts.insert( + "Ui:C:textarea".to_string(), + Value::fn_native({ + let ui = self.clone(); + move |args, interpreter| { + let interpreter = interpreter.clone(); + let ui = ui.clone(); + async move { + let mut args = args.into_iter(); + ui.create_component_instance( + args.next().unwrap_or_default(), + args.next(), + move |value| { + Ok(AsUiComponent::Textarea(AsUiTextarea::try_from(( + value, + &interpreter, + ))?)) + }, + ) + .await + } + .boxed() + } + }), + ); + + consts.insert( + "Ui:C:textInput".to_string(), + Value::fn_native({ + let ui = self.clone(); + move |args, interpreter| { + let interpreter = interpreter.clone(); + let ui = ui.clone(); + async move { + let mut args = args.into_iter(); + ui.create_component_instance( + args.next().unwrap_or_default(), + args.next(), + move |value| { + Ok(AsUiComponent::TextInput(AsUiTextInput::try_from(( + value, + &interpreter, + ))?)) + }, + ) + .await + } + .boxed() + } + }), + ); + + consts.insert( + "Ui:C:numberInput".to_string(), + Value::fn_native({ + let ui = self.clone(); + move |args, interpreter| { + let interpreter = interpreter.clone(); + let ui = ui.clone(); + async move { + let mut args = args.into_iter(); + ui.create_component_instance( + args.next().unwrap_or_default(), + args.next(), + move |value| { + Ok(AsUiComponent::NumberInput(AsUiNumberInput::try_from(( + value, + &interpreter, + ))?)) + }, + ) + .await + } + .boxed() + } + }), + ); + + consts.insert( + "Ui:C:button".to_string(), + Value::fn_native({ + let ui = self.clone(); + move |args, interpreter| { + let interpreter = interpreter.clone(); + let ui = ui.clone(); + async move { + let mut args = args.into_iter(); + ui.create_component_instance( + args.next().unwrap_or_default(), + args.next(), + move |value| { + Ok(AsUiComponent::Button(AsUiButton::try_from(( + value, + &interpreter, + ))?)) + }, + ) + .await + } + .boxed() + } + }), + ); + + consts.insert( + "Ui:C:buttons".to_string(), + Value::fn_native({ + let ui = self.clone(); + move |args, interpreter| { + let interpreter = interpreter.clone(); + let ui = ui.clone(); + async move { + let mut args = args.into_iter(); + ui.create_component_instance( + args.next().unwrap_or_default(), + args.next(), + move |value| { + Ok(AsUiComponent::Buttons(AsUiButtons::try_from(( + value, + &interpreter, + ))?)) + }, + ) + .await + } + .boxed() + } + }), + ); + + consts.insert( + "Ui:C:switch".to_string(), + Value::fn_native({ + let ui = self.clone(); + move |args, interpreter| { + let interpreter = interpreter.clone(); + let ui = ui.clone(); + async move { + let mut args = args.into_iter(); + ui.create_component_instance( + args.next().unwrap_or_default(), + args.next(), + move |value| { + Ok(AsUiComponent::ToggleSwitch(AsUiSwitch::try_from(( + value, + &interpreter, + ))?)) + }, + ) + .await + } + .boxed() + } + }), + ); + + consts.insert( + "Ui:C:select".to_string(), + Value::fn_native({ + let ui = self.clone(); + move |args, interpreter| { + let interpreter = interpreter.clone(); + let ui = ui.clone(); + async move { + let mut args = args.into_iter(); + ui.create_component_instance( + args.next().unwrap_or_default(), + args.next(), + move |value| { + Ok(AsUiComponent::Select(AsUiSelect::try_from(( + value, + &interpreter, + ))?)) + }, + ) + .await + } + .boxed() + } + }), + ); + + consts.insert( + "Ui:C:folder".to_string(), + Value::fn_native({ + let ui = self.clone(); + move |args, _| { + let ui = ui.clone(); + async move { + let mut args = args.into_iter(); + ui.create_component_instance( + args.next().unwrap_or_default(), + args.next(), + |value| Ok(AsUiComponent::Folder(AsUiFolder::try_from(value)?)), + ) + .await + } + .boxed() + } + }), + ); + + consts.insert( + "Ui:C:postFormButton".to_string(), + Value::fn_native({ + let ui = self.clone(); + move |args, _| { + let ui = ui.clone(); + async move { + let mut args = args.into_iter(); + ui.create_component_instance( + args.next().unwrap_or_default(), + args.next(), + |value| { + Ok(AsUiComponent::PostFormButton(AsUiPostFormButton::try_from( + value, + )?)) + }, + ) + .await + } + .boxed() + } + }), + ); + + consts.insert( + "Ui:C:postForm".to_string(), + Value::fn_native({ + let ui = self.clone(); + move |args, _| { + let ui = ui.clone(); + async move { + let mut args = args.into_iter(); + ui.create_component_instance( + args.next().unwrap_or_default(), + args.next(), + |value| Ok(AsUiComponent::PostForm(AsUiPostForm::try_from(value)?)), + ) + .await + } + .boxed() + } + }), + ); + } +} diff --git a/rust/src/api/mod.rs b/rust/src/api/mod.rs new file mode 100644 index 00000000..94953a9b --- /dev/null +++ b/rust/src/api/mod.rs @@ -0,0 +1 @@ +pub mod aiscript; diff --git a/rust/src/frb_generated.io.rs b/rust/src/frb_generated.io.rs new file mode 100644 index 00000000..bb78c9cc --- /dev/null +++ b/rust/src/frb_generated.io.rs @@ -0,0 +1,156 @@ +// This file is automatically generated, so please do not edit it. +// Generated by `flutter_rust_bridge`@ 2.0.0-dev.39. + +// Section: imports + +use super::*; +use crate::api::aiscript::api::*; +use crate::api::aiscript::ui::*; +use crate::api::aiscript::*; +use flutter_rust_bridge::for_generated::byteorder::{NativeEndian, ReadBytesExt, WriteBytesExt}; +use flutter_rust_bridge::for_generated::{transform_result_dco, Lockable}; +use flutter_rust_bridge::{Handler, IntoIntoDart}; + +// Section: boilerplate + +flutter_rust_bridge::frb_generated_boilerplate_io!(); + +#[no_mangle] +pub extern "C" fn frbgen_aria_rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAiScript( + ptr: *const std::ffi::c_void, +) { + MoiArc::>::increment_strong_count(ptr as _); +} + +#[no_mangle] +pub extern "C" fn frbgen_aria_rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAiScript( + ptr: *const std::ffi::c_void, +) { + MoiArc::>::decrement_strong_count(ptr as _); +} + +#[no_mangle] +pub extern "C" fn frbgen_aria_rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsApiLib( + ptr: *const std::ffi::c_void, +) { + MoiArc::>::increment_strong_count(ptr as _); +} + +#[no_mangle] +pub extern "C" fn frbgen_aria_rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsApiLib( + ptr: *const std::ffi::c_void, +) { + MoiArc::>::decrement_strong_count(ptr as _); +} + +#[no_mangle] +pub extern "C" fn frbgen_aria_rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiButtonCallback( + ptr: *const std::ffi::c_void, +) { + MoiArc::>::increment_strong_count(ptr as _); +} + +#[no_mangle] +pub extern "C" fn frbgen_aria_rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiButtonCallback( + ptr: *const std::ffi::c_void, +) { + MoiArc::>::decrement_strong_count(ptr as _); +} + +#[no_mangle] +pub extern "C" fn frbgen_aria_rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiLib( + ptr: *const std::ffi::c_void, +) { + MoiArc::>::increment_strong_count(ptr as _); +} + +#[no_mangle] +pub extern "C" fn frbgen_aria_rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiLib( + ptr: *const std::ffi::c_void, +) { + MoiArc::>::decrement_strong_count(ptr as _); +} + +#[no_mangle] +pub extern "C" fn frbgen_aria_rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiMfmCallback( + ptr: *const std::ffi::c_void, +) { + MoiArc::>::increment_strong_count(ptr as _); +} + +#[no_mangle] +pub extern "C" fn frbgen_aria_rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiMfmCallback( + ptr: *const std::ffi::c_void, +) { + MoiArc::>::decrement_strong_count(ptr as _); +} + +#[no_mangle] +pub extern "C" fn frbgen_aria_rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiNumberCallback( + ptr: *const std::ffi::c_void, +) { + MoiArc::>::increment_strong_count(ptr as _); +} + +#[no_mangle] +pub extern "C" fn frbgen_aria_rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiNumberCallback( + ptr: *const std::ffi::c_void, +) { + MoiArc::>::decrement_strong_count(ptr as _); +} + +#[no_mangle] +pub extern "C" fn frbgen_aria_rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSelectCallback( + ptr: *const std::ffi::c_void, +) { + MoiArc::>::increment_strong_count(ptr as _); +} + +#[no_mangle] +pub extern "C" fn frbgen_aria_rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSelectCallback( + ptr: *const std::ffi::c_void, +) { + MoiArc::>::decrement_strong_count(ptr as _); +} + +#[no_mangle] +pub extern "C" fn frbgen_aria_rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSwitchCallback( + ptr: *const std::ffi::c_void, +) { + MoiArc::>::increment_strong_count(ptr as _); +} + +#[no_mangle] +pub extern "C" fn frbgen_aria_rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSwitchCallback( + ptr: *const std::ffi::c_void, +) { + MoiArc::>::decrement_strong_count(ptr as _); +} + +#[no_mangle] +pub extern "C" fn frbgen_aria_rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextInputCallback( + ptr: *const std::ffi::c_void, +) { + MoiArc::>::increment_strong_count(ptr as _); +} + +#[no_mangle] +pub extern "C" fn frbgen_aria_rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextInputCallback( + ptr: *const std::ffi::c_void, +) { + MoiArc::>::decrement_strong_count(ptr as _); +} + +#[no_mangle] +pub extern "C" fn frbgen_aria_rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextareaCallback( + ptr: *const std::ffi::c_void, +) { + MoiArc::>::increment_strong_count(ptr as _); +} + +#[no_mangle] +pub extern "C" fn frbgen_aria_rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextareaCallback( + ptr: *const std::ffi::c_void, +) { + MoiArc::>::decrement_strong_count(ptr as _); +} diff --git a/rust/src/frb_generated.rs b/rust/src/frb_generated.rs new file mode 100644 index 00000000..88860c04 --- /dev/null +++ b/rust/src/frb_generated.rs @@ -0,0 +1,3197 @@ +// This file is automatically generated, so please do not edit it. +// Generated by `flutter_rust_bridge`@ 2.0.0-dev.39. + +#![allow( + non_camel_case_types, + unused, + non_snake_case, + clippy::needless_return, + clippy::redundant_closure_call, + clippy::redundant_closure, + clippy::useless_conversion, + clippy::unit_arg, + clippy::unused_unit, + clippy::double_parens, + clippy::let_and_return, + clippy::too_many_arguments, + clippy::match_single_binding, + clippy::clone_on_copy, + clippy::let_unit_value +)] + +// Section: imports + +use crate::api::aiscript::api::*; +use crate::api::aiscript::ui::*; +use crate::api::aiscript::*; +use flutter_rust_bridge::for_generated::byteorder::{NativeEndian, ReadBytesExt, WriteBytesExt}; +use flutter_rust_bridge::for_generated::{transform_result_dco, Lockable}; +use flutter_rust_bridge::{Handler, IntoIntoDart}; + +// Section: boilerplate + +flutter_rust_bridge::frb_generated_boilerplate!( + default_stream_sink_codec = SseCodec, + default_rust_opaque = RustOpaqueMoi, + default_rust_auto_opaque = RustAutoOpaqueMoi, +); +pub(crate) const FLUTTER_RUST_BRIDGE_CODEGEN_VERSION: &str = "2.0.0-dev.39"; +pub(crate) const FLUTTER_RUST_BRIDGE_CODEGEN_CONTENT_HASH: i32 = -463493403; + +// Section: executor + +flutter_rust_bridge::frb_generated_default_handler!(); + +// Section: wire_funcs + +fn wire__crate__api__aiscript__AiScript_abort_impl( + port_: flutter_rust_bridge::for_generated::MessagePort, + ptr_: flutter_rust_bridge::for_generated::PlatformGeneralizedUint8ListPtr, + rust_vec_len_: i32, + data_len_: i32, +) { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_normal::( + flutter_rust_bridge::for_generated::TaskInfo { + debug_name: "AiScript_abort", + port: Some(port_), + mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal, + }, + move || { + let message = unsafe { + flutter_rust_bridge::for_generated::Dart2RustMessageSse::from_wire( + ptr_, + rust_vec_len_, + data_len_, + ) + }; + let mut deserializer = + flutter_rust_bridge::for_generated::SseDeserializer::new(message); + let api_that = , + >>::sse_decode(&mut deserializer); + deserializer.end(); + move |context| { + transform_result_sse((move || { + let mut api_that_decoded = None; + let decode_indices_ = + flutter_rust_bridge::for_generated::lockable_compute_decode_order(vec![ + flutter_rust_bridge::for_generated::LockableOrderInfo::new( + &api_that, 0, false, + ), + ]); + for i in decode_indices_ { + match i { + 0 => api_that_decoded = Some(api_that.lockable_decode_sync_ref()), + _ => unreachable!(), + } + } + let api_that = &*api_that_decoded.unwrap(); + Result::<_, ()>::Ok({ + crate::api::aiscript::AiScript::abort(api_that); + }) + })()) + } + }, + ) +} +fn wire__crate__api__aiscript__AiScript_exec_impl( + port_: flutter_rust_bridge::for_generated::MessagePort, + ptr_: flutter_rust_bridge::for_generated::PlatformGeneralizedUint8ListPtr, + rust_vec_len_: i32, + data_len_: i32, +) { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_async::( + flutter_rust_bridge::for_generated::TaskInfo { + debug_name: "AiScript_exec", + port: Some(port_), + mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal, + }, + move || { + let message = unsafe { + flutter_rust_bridge::for_generated::Dart2RustMessageSse::from_wire( + ptr_, + rust_vec_len_, + data_len_, + ) + }; + let mut deserializer = + flutter_rust_bridge::for_generated::SseDeserializer::new(message); + let api_that = , + >>::sse_decode(&mut deserializer); + let api_input = ::sse_decode(&mut deserializer); + deserializer.end(); + move |context| async move { + transform_result_sse( + (move || async move { + let mut api_that_decoded = None; + let decode_indices_ = + flutter_rust_bridge::for_generated::lockable_compute_decode_order( + vec![flutter_rust_bridge::for_generated::LockableOrderInfo::new( + &api_that, 0, false, + )], + ); + for i in decode_indices_ { + match i { + 0 => { + api_that_decoded = + Some(api_that.lockable_decode_async_ref().await) + } + _ => unreachable!(), + } + } + let api_that = &*api_that_decoded.unwrap(); + crate::api::aiscript::AiScript::exec(api_that, &api_input).await + })() + .await, + ) + } + }, + ) +} +fn wire__crate__api__aiscript__AiScript_new_impl( + port_: flutter_rust_bridge::for_generated::MessagePort, + ptr_: flutter_rust_bridge::for_generated::PlatformGeneralizedUint8ListPtr, + rust_vec_len_: i32, + data_len_: i32, +) { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_async::( + flutter_rust_bridge::for_generated::TaskInfo { + debug_name: "AiScript_new", + port: Some(port_), + mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal, + }, + move || { + let message = unsafe { + flutter_rust_bridge::for_generated::Dart2RustMessageSse::from_wire( + ptr_, + rust_vec_len_, + data_len_, + ) + }; + let mut deserializer = + flutter_rust_bridge::for_generated::SseDeserializer::new(message); + let api_read = decode_DartFn_Inputs_String_Output_String_AnyhowException( + ::sse_decode(&mut deserializer), + ); + let api_write = decode_DartFn_Inputs_String_Output_unit_AnyhowException( + ::sse_decode(&mut deserializer), + ); + let api_api = >::sse_decode(&mut deserializer); + let api_ui = >::sse_decode(&mut deserializer); + let api_play = + >::sse_decode(&mut deserializer); + deserializer.end(); + move |context| async move { + transform_result_sse( + (move || async move { + Result::<_, ()>::Ok( + crate::api::aiscript::AiScript::new( + api_read, api_write, api_api, api_ui, api_play, + ) + .await, + ) + })() + .await, + ) + } + }, + ) +} +fn wire__crate__api__aiscript__api__AsApiLib_new_impl( + ptr_: flutter_rust_bridge::for_generated::PlatformGeneralizedUint8ListPtr, + rust_vec_len_: i32, + data_len_: i32, +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartSse { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_sync::(flutter_rust_bridge::for_generated::TaskInfo{ debug_name: "AsApiLib_new", port: None, mode: flutter_rust_bridge::for_generated::FfiCallMode::Sync }, move || { + let message = unsafe { flutter_rust_bridge::for_generated::Dart2RustMessageSse::from_wire(ptr_, rust_vec_len_, data_len_) }; + let mut deserializer = flutter_rust_bridge::for_generated::SseDeserializer::new(message); + let api_user_id = >::sse_decode(&mut deserializer); +let api_user_name = >::sse_decode(&mut deserializer); +let api_user_username = >::sse_decode(&mut deserializer); +let api_custom_emojis = ::sse_decode(&mut deserializer); +let api_locale = ::sse_decode(&mut deserializer); +let api_server_url = ::sse_decode(&mut deserializer); +let api_dialog = decode_DartFn_Inputs_String_String_String_Output_unit_AnyhowException(::sse_decode(&mut deserializer)); +let api_confirm = decode_DartFn_Inputs_String_String_String_Output_bool_AnyhowException(::sse_decode(&mut deserializer)); +let api_token = >::sse_decode(&mut deserializer); +let api_api = decode_DartFn_Inputs_String_String_opt_String_Output_record_string_opt_string_AnyhowException(::sse_decode(&mut deserializer)); +let api_save = decode_DartFn_Inputs_String_String_Output_unit_AnyhowException(::sse_decode(&mut deserializer)); +let api_load = decode_DartFn_Inputs_String_Output_String_AnyhowException(::sse_decode(&mut deserializer)); +let api_url = ::sse_decode(&mut deserializer); +let api_nyaize = decode_DartFn_Inputs_String_Output_String_AnyhowException(::sse_decode(&mut deserializer));deserializer.end(); + transform_result_sse((move || { + Result::<_,()>::Ok(crate::api::aiscript::api::AsApiLib::new(api_user_id, api_user_name, api_user_username, api_custom_emojis, api_locale, api_server_url, api_dialog, api_confirm, api_token, api_api, api_save, api_load, api_url, api_nyaize)) + })()) }) +} +fn wire__crate__api__aiscript__ui__AsUiButtonCallback_call_impl( + port_: flutter_rust_bridge::for_generated::MessagePort, + ptr_: flutter_rust_bridge::for_generated::PlatformGeneralizedUint8ListPtr, + rust_vec_len_: i32, + data_len_: i32, +) { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_async::( + flutter_rust_bridge::for_generated::TaskInfo { + debug_name: "AsUiButtonCallback_call", + port: Some(port_), + mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal, + }, + move || { + let message = unsafe { + flutter_rust_bridge::for_generated::Dart2RustMessageSse::from_wire( + ptr_, + rust_vec_len_, + data_len_, + ) + }; + let mut deserializer = + flutter_rust_bridge::for_generated::SseDeserializer::new(message); + let api_that = , + >>::sse_decode(&mut deserializer); + deserializer.end(); + move |context| async move { + transform_result_sse( + (move || async move { + let mut api_that_decoded = None; + let decode_indices_ = + flutter_rust_bridge::for_generated::lockable_compute_decode_order( + vec![flutter_rust_bridge::for_generated::LockableOrderInfo::new( + &api_that, 0, false, + )], + ); + for i in decode_indices_ { + match i { + 0 => { + api_that_decoded = + Some(api_that.lockable_decode_async_ref().await) + } + _ => unreachable!(), + } + } + let api_that = &*api_that_decoded.unwrap(); + crate::api::aiscript::ui::AsUiButtonCallback::call(api_that).await + })() + .await, + ) + } + }, + ) +} +fn wire__crate__api__aiscript__ui__AsUiLib_new_impl( + ptr_: flutter_rust_bridge::for_generated::PlatformGeneralizedUint8ListPtr, + rust_vec_len_: i32, + data_len_: i32, +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartSse { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_sync::( + flutter_rust_bridge::for_generated::TaskInfo { + debug_name: "AsUiLib_new", + port: None, + mode: flutter_rust_bridge::for_generated::FfiCallMode::Sync, + }, + move || { + let message = unsafe { + flutter_rust_bridge::for_generated::Dart2RustMessageSse::from_wire( + ptr_, + rust_vec_len_, + data_len_, + ) + }; + let mut deserializer = + flutter_rust_bridge::for_generated::SseDeserializer::new(message); + let api_on_update = + decode_DartFn_Inputs_String_as_ui_component_Output_unit_AnyhowException( + ::sse_decode(&mut deserializer), + ); + deserializer.end(); + transform_result_sse((move || { + Result::<_, ()>::Ok(crate::api::aiscript::ui::AsUiLib::new(api_on_update)) + })()) + }, + ) +} +fn wire__crate__api__aiscript__ui__AsUiMfmCallback_call_impl( + port_: flutter_rust_bridge::for_generated::MessagePort, + ptr_: flutter_rust_bridge::for_generated::PlatformGeneralizedUint8ListPtr, + rust_vec_len_: i32, + data_len_: i32, +) { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_async::( + flutter_rust_bridge::for_generated::TaskInfo { + debug_name: "AsUiMfmCallback_call", + port: Some(port_), + mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal, + }, + move || { + let message = unsafe { + flutter_rust_bridge::for_generated::Dart2RustMessageSse::from_wire( + ptr_, + rust_vec_len_, + data_len_, + ) + }; + let mut deserializer = + flutter_rust_bridge::for_generated::SseDeserializer::new(message); + let api_that = , + >>::sse_decode(&mut deserializer); + let api_value = ::sse_decode(&mut deserializer); + deserializer.end(); + move |context| async move { + transform_result_sse( + (move || async move { + let mut api_that_decoded = None; + let decode_indices_ = + flutter_rust_bridge::for_generated::lockable_compute_decode_order( + vec![flutter_rust_bridge::for_generated::LockableOrderInfo::new( + &api_that, 0, false, + )], + ); + for i in decode_indices_ { + match i { + 0 => { + api_that_decoded = + Some(api_that.lockable_decode_async_ref().await) + } + _ => unreachable!(), + } + } + let api_that = &*api_that_decoded.unwrap(); + crate::api::aiscript::ui::AsUiMfmCallback::call(api_that, api_value).await + })() + .await, + ) + } + }, + ) +} +fn wire__crate__api__aiscript__ui__AsUiNumberCallback_call_impl( + port_: flutter_rust_bridge::for_generated::MessagePort, + ptr_: flutter_rust_bridge::for_generated::PlatformGeneralizedUint8ListPtr, + rust_vec_len_: i32, + data_len_: i32, +) { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_async::( + flutter_rust_bridge::for_generated::TaskInfo { + debug_name: "AsUiNumberCallback_call", + port: Some(port_), + mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal, + }, + move || { + let message = unsafe { + flutter_rust_bridge::for_generated::Dart2RustMessageSse::from_wire( + ptr_, + rust_vec_len_, + data_len_, + ) + }; + let mut deserializer = + flutter_rust_bridge::for_generated::SseDeserializer::new(message); + let api_that = , + >>::sse_decode(&mut deserializer); + let api_value = ::sse_decode(&mut deserializer); + deserializer.end(); + move |context| async move { + transform_result_sse( + (move || async move { + let mut api_that_decoded = None; + let decode_indices_ = + flutter_rust_bridge::for_generated::lockable_compute_decode_order( + vec![flutter_rust_bridge::for_generated::LockableOrderInfo::new( + &api_that, 0, false, + )], + ); + for i in decode_indices_ { + match i { + 0 => { + api_that_decoded = + Some(api_that.lockable_decode_async_ref().await) + } + _ => unreachable!(), + } + } + let api_that = &*api_that_decoded.unwrap(); + crate::api::aiscript::ui::AsUiNumberCallback::call(api_that, api_value) + .await + })() + .await, + ) + } + }, + ) +} +fn wire__crate__api__aiscript__ui__AsUiSelectCallback_call_impl( + port_: flutter_rust_bridge::for_generated::MessagePort, + ptr_: flutter_rust_bridge::for_generated::PlatformGeneralizedUint8ListPtr, + rust_vec_len_: i32, + data_len_: i32, +) { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_async::( + flutter_rust_bridge::for_generated::TaskInfo { + debug_name: "AsUiSelectCallback_call", + port: Some(port_), + mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal, + }, + move || { + let message = unsafe { + flutter_rust_bridge::for_generated::Dart2RustMessageSse::from_wire( + ptr_, + rust_vec_len_, + data_len_, + ) + }; + let mut deserializer = + flutter_rust_bridge::for_generated::SseDeserializer::new(message); + let api_that = , + >>::sse_decode(&mut deserializer); + let api_value = ::sse_decode(&mut deserializer); + deserializer.end(); + move |context| async move { + transform_result_sse( + (move || async move { + let mut api_that_decoded = None; + let decode_indices_ = + flutter_rust_bridge::for_generated::lockable_compute_decode_order( + vec![flutter_rust_bridge::for_generated::LockableOrderInfo::new( + &api_that, 0, false, + )], + ); + for i in decode_indices_ { + match i { + 0 => { + api_that_decoded = + Some(api_that.lockable_decode_async_ref().await) + } + _ => unreachable!(), + } + } + let api_that = &*api_that_decoded.unwrap(); + crate::api::aiscript::ui::AsUiSelectCallback::call(api_that, api_value) + .await + })() + .await, + ) + } + }, + ) +} +fn wire__crate__api__aiscript__ui__AsUiSwitchCallback_call_impl( + port_: flutter_rust_bridge::for_generated::MessagePort, + ptr_: flutter_rust_bridge::for_generated::PlatformGeneralizedUint8ListPtr, + rust_vec_len_: i32, + data_len_: i32, +) { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_async::( + flutter_rust_bridge::for_generated::TaskInfo { + debug_name: "AsUiSwitchCallback_call", + port: Some(port_), + mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal, + }, + move || { + let message = unsafe { + flutter_rust_bridge::for_generated::Dart2RustMessageSse::from_wire( + ptr_, + rust_vec_len_, + data_len_, + ) + }; + let mut deserializer = + flutter_rust_bridge::for_generated::SseDeserializer::new(message); + let api_that = , + >>::sse_decode(&mut deserializer); + let api_value = ::sse_decode(&mut deserializer); + deserializer.end(); + move |context| async move { + transform_result_sse( + (move || async move { + let mut api_that_decoded = None; + let decode_indices_ = + flutter_rust_bridge::for_generated::lockable_compute_decode_order( + vec![flutter_rust_bridge::for_generated::LockableOrderInfo::new( + &api_that, 0, false, + )], + ); + for i in decode_indices_ { + match i { + 0 => { + api_that_decoded = + Some(api_that.lockable_decode_async_ref().await) + } + _ => unreachable!(), + } + } + let api_that = &*api_that_decoded.unwrap(); + crate::api::aiscript::ui::AsUiSwitchCallback::call(api_that, api_value) + .await + })() + .await, + ) + } + }, + ) +} +fn wire__crate__api__aiscript__ui__AsUiTextInputCallback_call_impl( + port_: flutter_rust_bridge::for_generated::MessagePort, + ptr_: flutter_rust_bridge::for_generated::PlatformGeneralizedUint8ListPtr, + rust_vec_len_: i32, + data_len_: i32, +) { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_async::( + flutter_rust_bridge::for_generated::TaskInfo { + debug_name: "AsUiTextInputCallback_call", + port: Some(port_), + mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal, + }, + move || { + let message = unsafe { + flutter_rust_bridge::for_generated::Dart2RustMessageSse::from_wire( + ptr_, + rust_vec_len_, + data_len_, + ) + }; + let mut deserializer = + flutter_rust_bridge::for_generated::SseDeserializer::new(message); + let api_that = , + >>::sse_decode(&mut deserializer); + let api_value = ::sse_decode(&mut deserializer); + deserializer.end(); + move |context| async move { + transform_result_sse( + (move || async move { + let mut api_that_decoded = None; + let decode_indices_ = + flutter_rust_bridge::for_generated::lockable_compute_decode_order( + vec![flutter_rust_bridge::for_generated::LockableOrderInfo::new( + &api_that, 0, false, + )], + ); + for i in decode_indices_ { + match i { + 0 => { + api_that_decoded = + Some(api_that.lockable_decode_async_ref().await) + } + _ => unreachable!(), + } + } + let api_that = &*api_that_decoded.unwrap(); + crate::api::aiscript::ui::AsUiTextInputCallback::call(api_that, api_value) + .await + })() + .await, + ) + } + }, + ) +} +fn wire__crate__api__aiscript__ui__AsUiTextareaCallback_call_impl( + port_: flutter_rust_bridge::for_generated::MessagePort, + ptr_: flutter_rust_bridge::for_generated::PlatformGeneralizedUint8ListPtr, + rust_vec_len_: i32, + data_len_: i32, +) { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_async::( + flutter_rust_bridge::for_generated::TaskInfo { + debug_name: "AsUiTextareaCallback_call", + port: Some(port_), + mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal, + }, + move || { + let message = unsafe { + flutter_rust_bridge::for_generated::Dart2RustMessageSse::from_wire( + ptr_, + rust_vec_len_, + data_len_, + ) + }; + let mut deserializer = + flutter_rust_bridge::for_generated::SseDeserializer::new(message); + let api_that = , + >>::sse_decode(&mut deserializer); + let api_value = ::sse_decode(&mut deserializer); + deserializer.end(); + move |context| async move { + transform_result_sse( + (move || async move { + let mut api_that_decoded = None; + let decode_indices_ = + flutter_rust_bridge::for_generated::lockable_compute_decode_order( + vec![flutter_rust_bridge::for_generated::LockableOrderInfo::new( + &api_that, 0, false, + )], + ); + for i in decode_indices_ { + match i { + 0 => { + api_that_decoded = + Some(api_that.lockable_decode_async_ref().await) + } + _ => unreachable!(), + } + } + let api_that = &*api_that_decoded.unwrap(); + crate::api::aiscript::ui::AsUiTextareaCallback::call(api_that, api_value) + .await + })() + .await, + ) + } + }, + ) +} + +// Section: related_funcs + +fn decode_DartFn_Inputs_String_Output_String_AnyhowException( + dart_opaque: flutter_rust_bridge::DartOpaque, +) -> impl Fn(String) -> flutter_rust_bridge::DartFnFuture { + use flutter_rust_bridge::IntoDart; + + async fn body(dart_opaque: flutter_rust_bridge::DartOpaque, arg0: String) -> String { + let args = vec![arg0.into_into_dart().into_dart()]; + let message = FLUTTER_RUST_BRIDGE_HANDLER + .dart_fn_invoke(dart_opaque, args) + .await; + + let mut deserializer = flutter_rust_bridge::for_generated::SseDeserializer::new(message); + let action = deserializer.cursor.read_u8().unwrap(); + let ans = match action { + 0 => std::result::Result::Ok(::sse_decode(&mut deserializer)), + 1 => std::result::Result::Err( + ::sse_decode(&mut deserializer), + ), + _ => unreachable!(), + }; + deserializer.end(); + let ans = ans.expect("Dart throws exception but Rust side assume it is not failable"); + ans + } + + move |arg0: String| { + flutter_rust_bridge::for_generated::convert_into_dart_fn_future(body( + dart_opaque.clone(), + arg0, + )) + } +} +fn decode_DartFn_Inputs_String_Output_unit_AnyhowException( + dart_opaque: flutter_rust_bridge::DartOpaque, +) -> impl Fn(String) -> flutter_rust_bridge::DartFnFuture<()> { + use flutter_rust_bridge::IntoDart; + + async fn body(dart_opaque: flutter_rust_bridge::DartOpaque, arg0: String) -> () { + let args = vec![arg0.into_into_dart().into_dart()]; + let message = FLUTTER_RUST_BRIDGE_HANDLER + .dart_fn_invoke(dart_opaque, args) + .await; + + let mut deserializer = flutter_rust_bridge::for_generated::SseDeserializer::new(message); + let action = deserializer.cursor.read_u8().unwrap(); + let ans = match action { + 0 => std::result::Result::Ok(<()>::sse_decode(&mut deserializer)), + 1 => std::result::Result::Err( + ::sse_decode(&mut deserializer), + ), + _ => unreachable!(), + }; + deserializer.end(); + let ans = ans.expect("Dart throws exception but Rust side assume it is not failable"); + ans + } + + move |arg0: String| { + flutter_rust_bridge::for_generated::convert_into_dart_fn_future(body( + dart_opaque.clone(), + arg0, + )) + } +} +fn decode_DartFn_Inputs_String_String_Output_unit_AnyhowException( + dart_opaque: flutter_rust_bridge::DartOpaque, +) -> impl Fn(String, String) -> flutter_rust_bridge::DartFnFuture<()> { + use flutter_rust_bridge::IntoDart; + + async fn body(dart_opaque: flutter_rust_bridge::DartOpaque, arg0: String, arg1: String) -> () { + let args = vec![ + arg0.into_into_dart().into_dart(), + arg1.into_into_dart().into_dart(), + ]; + let message = FLUTTER_RUST_BRIDGE_HANDLER + .dart_fn_invoke(dart_opaque, args) + .await; + + let mut deserializer = flutter_rust_bridge::for_generated::SseDeserializer::new(message); + let action = deserializer.cursor.read_u8().unwrap(); + let ans = match action { + 0 => std::result::Result::Ok(<()>::sse_decode(&mut deserializer)), + 1 => std::result::Result::Err( + ::sse_decode(&mut deserializer), + ), + _ => unreachable!(), + }; + deserializer.end(); + let ans = ans.expect("Dart throws exception but Rust side assume it is not failable"); + ans + } + + move |arg0: String, arg1: String| { + flutter_rust_bridge::for_generated::convert_into_dart_fn_future(body( + dart_opaque.clone(), + arg0, + arg1, + )) + } +} +fn decode_DartFn_Inputs_String_String_String_Output_bool_AnyhowException( + dart_opaque: flutter_rust_bridge::DartOpaque, +) -> impl Fn(String, String, String) -> flutter_rust_bridge::DartFnFuture { + use flutter_rust_bridge::IntoDart; + + async fn body( + dart_opaque: flutter_rust_bridge::DartOpaque, + arg0: String, + arg1: String, + arg2: String, + ) -> bool { + let args = vec![ + arg0.into_into_dart().into_dart(), + arg1.into_into_dart().into_dart(), + arg2.into_into_dart().into_dart(), + ]; + let message = FLUTTER_RUST_BRIDGE_HANDLER + .dart_fn_invoke(dart_opaque, args) + .await; + + let mut deserializer = flutter_rust_bridge::for_generated::SseDeserializer::new(message); + let action = deserializer.cursor.read_u8().unwrap(); + let ans = match action { + 0 => std::result::Result::Ok(::sse_decode(&mut deserializer)), + 1 => std::result::Result::Err( + ::sse_decode(&mut deserializer), + ), + _ => unreachable!(), + }; + deserializer.end(); + let ans = ans.expect("Dart throws exception but Rust side assume it is not failable"); + ans + } + + move |arg0: String, arg1: String, arg2: String| { + flutter_rust_bridge::for_generated::convert_into_dart_fn_future(body( + dart_opaque.clone(), + arg0, + arg1, + arg2, + )) + } +} +fn decode_DartFn_Inputs_String_String_String_Output_unit_AnyhowException( + dart_opaque: flutter_rust_bridge::DartOpaque, +) -> impl Fn(String, String, String) -> flutter_rust_bridge::DartFnFuture<()> { + use flutter_rust_bridge::IntoDart; + + async fn body( + dart_opaque: flutter_rust_bridge::DartOpaque, + arg0: String, + arg1: String, + arg2: String, + ) -> () { + let args = vec![ + arg0.into_into_dart().into_dart(), + arg1.into_into_dart().into_dart(), + arg2.into_into_dart().into_dart(), + ]; + let message = FLUTTER_RUST_BRIDGE_HANDLER + .dart_fn_invoke(dart_opaque, args) + .await; + + let mut deserializer = flutter_rust_bridge::for_generated::SseDeserializer::new(message); + let action = deserializer.cursor.read_u8().unwrap(); + let ans = match action { + 0 => std::result::Result::Ok(<()>::sse_decode(&mut deserializer)), + 1 => std::result::Result::Err( + ::sse_decode(&mut deserializer), + ), + _ => unreachable!(), + }; + deserializer.end(); + let ans = ans.expect("Dart throws exception but Rust side assume it is not failable"); + ans + } + + move |arg0: String, arg1: String, arg2: String| { + flutter_rust_bridge::for_generated::convert_into_dart_fn_future(body( + dart_opaque.clone(), + arg0, + arg1, + arg2, + )) + } +} +fn decode_DartFn_Inputs_String_String_opt_String_Output_record_string_opt_string_AnyhowException( + dart_opaque: flutter_rust_bridge::DartOpaque, +) -> impl Fn(String, String, Option) -> flutter_rust_bridge::DartFnFuture<(String, Option)> +{ + use flutter_rust_bridge::IntoDart; + + async fn body( + dart_opaque: flutter_rust_bridge::DartOpaque, + arg0: String, + arg1: String, + arg2: Option, + ) -> (String, Option) { + let args = vec![ + arg0.into_into_dart().into_dart(), + arg1.into_into_dart().into_dart(), + arg2.into_into_dart().into_dart(), + ]; + let message = FLUTTER_RUST_BRIDGE_HANDLER + .dart_fn_invoke(dart_opaque, args) + .await; + + let mut deserializer = flutter_rust_bridge::for_generated::SseDeserializer::new(message); + let action = deserializer.cursor.read_u8().unwrap(); + let ans = match action { + 0 => std::result::Result::Ok(<(String, Option)>::sse_decode(&mut deserializer)), + 1 => std::result::Result::Err( + ::sse_decode(&mut deserializer), + ), + _ => unreachable!(), + }; + deserializer.end(); + let ans = ans.expect("Dart throws exception but Rust side assume it is not failable"); + ans + } + + move |arg0: String, arg1: String, arg2: Option| { + flutter_rust_bridge::for_generated::convert_into_dart_fn_future(body( + dart_opaque.clone(), + arg0, + arg1, + arg2, + )) + } +} +fn decode_DartFn_Inputs_String_as_ui_component_Output_unit_AnyhowException( + dart_opaque: flutter_rust_bridge::DartOpaque, +) -> impl Fn(String, crate::api::aiscript::ui::AsUiComponent) -> flutter_rust_bridge::DartFnFuture<()> +{ + use flutter_rust_bridge::IntoDart; + + async fn body( + dart_opaque: flutter_rust_bridge::DartOpaque, + arg0: String, + arg1: crate::api::aiscript::ui::AsUiComponent, + ) -> () { + let args = vec![ + arg0.into_into_dart().into_dart(), + arg1.into_into_dart().into_dart(), + ]; + let message = FLUTTER_RUST_BRIDGE_HANDLER + .dart_fn_invoke(dart_opaque, args) + .await; + + let mut deserializer = flutter_rust_bridge::for_generated::SseDeserializer::new(message); + let action = deserializer.cursor.read_u8().unwrap(); + let ans = match action { + 0 => std::result::Result::Ok(<()>::sse_decode(&mut deserializer)), + 1 => std::result::Result::Err( + ::sse_decode(&mut deserializer), + ), + _ => unreachable!(), + }; + deserializer.end(); + let ans = ans.expect("Dart throws exception but Rust side assume it is not failable"); + ans + } + + move |arg0: String, arg1: crate::api::aiscript::ui::AsUiComponent| { + flutter_rust_bridge::for_generated::convert_into_dart_fn_future(body( + dart_opaque.clone(), + arg0, + arg1, + )) + } +} +flutter_rust_bridge::frb_generated_moi_arc_impl_value!( + flutter_rust_bridge::for_generated::RustAutoOpaqueInner +); +flutter_rust_bridge::frb_generated_moi_arc_impl_value!( + flutter_rust_bridge::for_generated::RustAutoOpaqueInner +); +flutter_rust_bridge::frb_generated_moi_arc_impl_value!( + flutter_rust_bridge::for_generated::RustAutoOpaqueInner +); +flutter_rust_bridge::frb_generated_moi_arc_impl_value!( + flutter_rust_bridge::for_generated::RustAutoOpaqueInner +); +flutter_rust_bridge::frb_generated_moi_arc_impl_value!( + flutter_rust_bridge::for_generated::RustAutoOpaqueInner +); +flutter_rust_bridge::frb_generated_moi_arc_impl_value!( + flutter_rust_bridge::for_generated::RustAutoOpaqueInner +); +flutter_rust_bridge::frb_generated_moi_arc_impl_value!( + flutter_rust_bridge::for_generated::RustAutoOpaqueInner +); +flutter_rust_bridge::frb_generated_moi_arc_impl_value!( + flutter_rust_bridge::for_generated::RustAutoOpaqueInner +); +flutter_rust_bridge::frb_generated_moi_arc_impl_value!( + flutter_rust_bridge::for_generated::RustAutoOpaqueInner +); +flutter_rust_bridge::frb_generated_moi_arc_impl_value!( + flutter_rust_bridge::for_generated::RustAutoOpaqueInner +); + +// Section: dart2rust + +impl SseDecode for flutter_rust_bridge::for_generated::anyhow::Error { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + let mut inner = ::sse_decode(deserializer); + return flutter_rust_bridge::for_generated::anyhow::anyhow!("{}", inner); + } +} + +impl SseDecode for AiScript { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + let mut inner = , + >>::sse_decode(deserializer); + return flutter_rust_bridge::for_generated::rust_auto_opaque_decode_owned(inner); + } +} + +impl SseDecode for AsApiLib { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + let mut inner = , + >>::sse_decode(deserializer); + return flutter_rust_bridge::for_generated::rust_auto_opaque_decode_owned(inner); + } +} + +impl SseDecode for AsUiButtonCallback { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + let mut inner = , + >>::sse_decode(deserializer); + return flutter_rust_bridge::for_generated::rust_auto_opaque_decode_owned(inner); + } +} + +impl SseDecode for AsUiLib { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + let mut inner = , + >>::sse_decode(deserializer); + return flutter_rust_bridge::for_generated::rust_auto_opaque_decode_owned(inner); + } +} + +impl SseDecode for AsUiMfmCallback { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + let mut inner = , + >>::sse_decode(deserializer); + return flutter_rust_bridge::for_generated::rust_auto_opaque_decode_owned(inner); + } +} + +impl SseDecode for AsUiNumberCallback { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + let mut inner = , + >>::sse_decode(deserializer); + return flutter_rust_bridge::for_generated::rust_auto_opaque_decode_owned(inner); + } +} + +impl SseDecode for AsUiSelectCallback { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + let mut inner = , + >>::sse_decode(deserializer); + return flutter_rust_bridge::for_generated::rust_auto_opaque_decode_owned(inner); + } +} + +impl SseDecode for AsUiSwitchCallback { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + let mut inner = , + >>::sse_decode(deserializer); + return flutter_rust_bridge::for_generated::rust_auto_opaque_decode_owned(inner); + } +} + +impl SseDecode for AsUiTextInputCallback { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + let mut inner = , + >>::sse_decode(deserializer); + return flutter_rust_bridge::for_generated::rust_auto_opaque_decode_owned(inner); + } +} + +impl SseDecode for AsUiTextareaCallback { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + let mut inner = , + >>::sse_decode(deserializer); + return flutter_rust_bridge::for_generated::rust_auto_opaque_decode_owned(inner); + } +} + +impl SseDecode for flutter_rust_bridge::DartOpaque { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + let mut inner = ::sse_decode(deserializer); + return unsafe { flutter_rust_bridge::for_generated::sse_decode_dart_opaque(inner) }; + } +} + +impl SseDecode + for RustOpaqueMoi> +{ + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + let mut inner = ::sse_decode(deserializer); + return decode_rust_opaque_moi(inner); + } +} + +impl SseDecode + for RustOpaqueMoi> +{ + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + let mut inner = ::sse_decode(deserializer); + return decode_rust_opaque_moi(inner); + } +} + +impl SseDecode + for RustOpaqueMoi> +{ + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + let mut inner = ::sse_decode(deserializer); + return decode_rust_opaque_moi(inner); + } +} + +impl SseDecode for RustOpaqueMoi> { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + let mut inner = ::sse_decode(deserializer); + return decode_rust_opaque_moi(inner); + } +} + +impl SseDecode + for RustOpaqueMoi> +{ + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + let mut inner = ::sse_decode(deserializer); + return decode_rust_opaque_moi(inner); + } +} + +impl SseDecode + for RustOpaqueMoi> +{ + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + let mut inner = ::sse_decode(deserializer); + return decode_rust_opaque_moi(inner); + } +} + +impl SseDecode + for RustOpaqueMoi> +{ + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + let mut inner = ::sse_decode(deserializer); + return decode_rust_opaque_moi(inner); + } +} + +impl SseDecode + for RustOpaqueMoi> +{ + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + let mut inner = ::sse_decode(deserializer); + return decode_rust_opaque_moi(inner); + } +} + +impl SseDecode + for RustOpaqueMoi< + flutter_rust_bridge::for_generated::RustAutoOpaqueInner, + > +{ + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + let mut inner = ::sse_decode(deserializer); + return decode_rust_opaque_moi(inner); + } +} + +impl SseDecode + for RustOpaqueMoi> +{ + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + let mut inner = ::sse_decode(deserializer); + return decode_rust_opaque_moi(inner); + } +} + +impl SseDecode for String { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + let mut inner = >::sse_decode(deserializer); + return String::from_utf8(inner).unwrap(); + } +} + +impl SseDecode for crate::api::aiscript::play::AsPlayLib { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + let mut var_thisId = ::sse_decode(deserializer); + let mut var_thisUrl = ::sse_decode(deserializer); + return crate::api::aiscript::play::AsPlayLib { + this_id: var_thisId, + this_url: var_thisUrl, + }; + } +} + +impl SseDecode for crate::api::aiscript::ui::AsUiButton { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + let mut var_text = >::sse_decode(deserializer); + let mut var_onClick = >::sse_decode(deserializer); + let mut var_primary = >::sse_decode(deserializer); + let mut var_rounded = >::sse_decode(deserializer); + let mut var_disabled = >::sse_decode(deserializer); + return crate::api::aiscript::ui::AsUiButton { + text: var_text, + on_click: var_onClick, + primary: var_primary, + rounded: var_rounded, + disabled: var_disabled, + }; + } +} + +impl SseDecode for crate::api::aiscript::ui::AsUiButtons { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + let mut var_buttons = + >>::sse_decode(deserializer); + return crate::api::aiscript::ui::AsUiButtons { + buttons: var_buttons, + }; + } +} + +impl SseDecode for crate::api::aiscript::ui::AsUiComponent { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + let mut tag_ = ::sse_decode(deserializer); + match tag_ { + 0 => { + let mut var_field0 = ::sse_decode(deserializer); + return crate::api::aiscript::ui::AsUiComponent::Root(var_field0); + } + 1 => { + let mut var_field0 = + ::sse_decode(deserializer); + return crate::api::aiscript::ui::AsUiComponent::Container(var_field0); + } + 2 => { + let mut var_field0 = ::sse_decode(deserializer); + return crate::api::aiscript::ui::AsUiComponent::Text(var_field0); + } + 3 => { + let mut var_field0 = ::sse_decode(deserializer); + return crate::api::aiscript::ui::AsUiComponent::Mfm(var_field0); + } + 4 => { + let mut var_field0 = + ::sse_decode(deserializer); + return crate::api::aiscript::ui::AsUiComponent::Button(var_field0); + } + 5 => { + let mut var_field0 = + ::sse_decode(deserializer); + return crate::api::aiscript::ui::AsUiComponent::Buttons(var_field0); + } + 6 => { + let mut var_field0 = + ::sse_decode(deserializer); + return crate::api::aiscript::ui::AsUiComponent::ToggleSwitch(var_field0); + } + 7 => { + let mut var_field0 = + ::sse_decode(deserializer); + return crate::api::aiscript::ui::AsUiComponent::Textarea(var_field0); + } + 8 => { + let mut var_field0 = + ::sse_decode(deserializer); + return crate::api::aiscript::ui::AsUiComponent::TextInput(var_field0); + } + 9 => { + let mut var_field0 = + ::sse_decode(deserializer); + return crate::api::aiscript::ui::AsUiComponent::NumberInput(var_field0); + } + 10 => { + let mut var_field0 = + ::sse_decode(deserializer); + return crate::api::aiscript::ui::AsUiComponent::Select(var_field0); + } + 11 => { + let mut var_field0 = + ::sse_decode(deserializer); + return crate::api::aiscript::ui::AsUiComponent::Folder(var_field0); + } + 12 => { + let mut var_field0 = + ::sse_decode(deserializer); + return crate::api::aiscript::ui::AsUiComponent::PostFormButton(var_field0); + } + 13 => { + let mut var_field0 = + ::sse_decode(deserializer); + return crate::api::aiscript::ui::AsUiComponent::PostForm(var_field0); + } + _ => { + unimplemented!(""); + } + } + } +} + +impl SseDecode for crate::api::aiscript::ui::AsUiContainer { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + let mut var_children = >>::sse_decode(deserializer); + let mut var_align = >::sse_decode(deserializer); + let mut var_bgColor = >::sse_decode(deserializer); + let mut var_fgColor = >::sse_decode(deserializer); + let mut var_font = >::sse_decode(deserializer); + let mut var_borderWidth = >::sse_decode(deserializer); + let mut var_borderColor = >::sse_decode(deserializer); + let mut var_padding = >::sse_decode(deserializer); + let mut var_rounded = >::sse_decode(deserializer); + let mut var_hidden = >::sse_decode(deserializer); + return crate::api::aiscript::ui::AsUiContainer { + children: var_children, + align: var_align, + bg_color: var_bgColor, + fg_color: var_fgColor, + font: var_font, + border_width: var_borderWidth, + border_color: var_borderColor, + padding: var_padding, + rounded: var_rounded, + hidden: var_hidden, + }; + } +} + +impl SseDecode for crate::api::aiscript::ui::AsUiFolder { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + let mut var_children = >>::sse_decode(deserializer); + let mut var_title = >::sse_decode(deserializer); + let mut var_opened = >::sse_decode(deserializer); + return crate::api::aiscript::ui::AsUiFolder { + children: var_children, + title: var_title, + opened: var_opened, + }; + } +} + +impl SseDecode for crate::api::aiscript::ui::AsUiMfm { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + let mut var_text = >::sse_decode(deserializer); + let mut var_size = >::sse_decode(deserializer); + let mut var_bold = >::sse_decode(deserializer); + let mut var_color = >::sse_decode(deserializer); + let mut var_font = >::sse_decode(deserializer); + let mut var_onClickEv = >::sse_decode(deserializer); + return crate::api::aiscript::ui::AsUiMfm { + text: var_text, + size: var_size, + bold: var_bold, + color: var_color, + font: var_font, + on_click_ev: var_onClickEv, + }; + } +} + +impl SseDecode for crate::api::aiscript::ui::AsUiNumberInput { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + let mut var_onInput = >::sse_decode(deserializer); + let mut var_defaultValue = >::sse_decode(deserializer); + let mut var_label = >::sse_decode(deserializer); + let mut var_caption = >::sse_decode(deserializer); + return crate::api::aiscript::ui::AsUiNumberInput { + on_input: var_onInput, + default_value: var_defaultValue, + label: var_label, + caption: var_caption, + }; + } +} + +impl SseDecode for crate::api::aiscript::ui::AsUiPostForm { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + let mut var_form = + >::sse_decode(deserializer); + return crate::api::aiscript::ui::AsUiPostForm { form: var_form }; + } +} + +impl SseDecode for crate::api::aiscript::ui::AsUiPostFormButton { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + let mut var_text = >::sse_decode(deserializer); + let mut var_primary = >::sse_decode(deserializer); + let mut var_rounded = >::sse_decode(deserializer); + let mut var_form = + >::sse_decode(deserializer); + return crate::api::aiscript::ui::AsUiPostFormButton { + text: var_text, + primary: var_primary, + rounded: var_rounded, + form: var_form, + }; + } +} + +impl SseDecode for crate::api::aiscript::ui::AsUiRoot { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + let mut var_children = >::sse_decode(deserializer); + return crate::api::aiscript::ui::AsUiRoot { + children: var_children, + }; + } +} + +impl SseDecode for crate::api::aiscript::ui::AsUiSelect { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + let mut var_items = >>::sse_decode(deserializer); + let mut var_onChange = >::sse_decode(deserializer); + let mut var_defaultValue = >::sse_decode(deserializer); + let mut var_label = >::sse_decode(deserializer); + let mut var_caption = >::sse_decode(deserializer); + return crate::api::aiscript::ui::AsUiSelect { + items: var_items, + on_change: var_onChange, + default_value: var_defaultValue, + label: var_label, + caption: var_caption, + }; + } +} + +impl SseDecode for crate::api::aiscript::ui::AsUiSwitch { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + let mut var_onChange = >::sse_decode(deserializer); + let mut var_defaultValue = >::sse_decode(deserializer); + let mut var_label = >::sse_decode(deserializer); + let mut var_caption = >::sse_decode(deserializer); + return crate::api::aiscript::ui::AsUiSwitch { + on_change: var_onChange, + default_value: var_defaultValue, + label: var_label, + caption: var_caption, + }; + } +} + +impl SseDecode for crate::api::aiscript::ui::AsUiText { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + let mut var_text = >::sse_decode(deserializer); + let mut var_size = >::sse_decode(deserializer); + let mut var_bold = >::sse_decode(deserializer); + let mut var_color = >::sse_decode(deserializer); + let mut var_font = >::sse_decode(deserializer); + return crate::api::aiscript::ui::AsUiText { + text: var_text, + size: var_size, + bold: var_bold, + color: var_color, + font: var_font, + }; + } +} + +impl SseDecode for crate::api::aiscript::ui::AsUiTextInput { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + let mut var_onInput = >::sse_decode(deserializer); + let mut var_defaultValue = >::sse_decode(deserializer); + let mut var_label = >::sse_decode(deserializer); + let mut var_caption = >::sse_decode(deserializer); + return crate::api::aiscript::ui::AsUiTextInput { + on_input: var_onInput, + default_value: var_defaultValue, + label: var_label, + caption: var_caption, + }; + } +} + +impl SseDecode for crate::api::aiscript::ui::AsUiTextarea { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + let mut var_onInput = >::sse_decode(deserializer); + let mut var_defaultValue = >::sse_decode(deserializer); + let mut var_label = >::sse_decode(deserializer); + let mut var_caption = >::sse_decode(deserializer); + return crate::api::aiscript::ui::AsUiTextarea { + on_input: var_onInput, + default_value: var_defaultValue, + label: var_label, + caption: var_caption, + }; + } +} + +impl SseDecode for bool { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + deserializer.cursor.read_u8().unwrap() != 0 + } +} + +impl SseDecode for f64 { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + deserializer.cursor.read_f64::().unwrap() + } +} + +impl SseDecode for Vec { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + let mut len_ = ::sse_decode(deserializer); + let mut ans_ = vec![]; + for idx_ in 0..len_ { + ans_.push(::sse_decode(deserializer)); + } + return ans_; + } +} + +impl SseDecode for Vec { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + let mut len_ = ::sse_decode(deserializer); + let mut ans_ = vec![]; + for idx_ in 0..len_ { + ans_.push(::sse_decode( + deserializer, + )); + } + return ans_; + } +} + +impl SseDecode for Vec { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + let mut len_ = ::sse_decode(deserializer); + let mut ans_ = vec![]; + for idx_ in 0..len_ { + ans_.push(::sse_decode(deserializer)); + } + return ans_; + } +} + +impl SseDecode for Vec<(String, String)> { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + let mut len_ = ::sse_decode(deserializer); + let mut ans_ = vec![]; + for idx_ in 0..len_ { + ans_.push(<(String, String)>::sse_decode(deserializer)); + } + return ans_; + } +} + +impl SseDecode for Option { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + if (::sse_decode(deserializer)) { + return Some(::sse_decode(deserializer)); + } else { + return None; + } + } +} + +impl SseDecode for Option { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + if (::sse_decode(deserializer)) { + return Some(::sse_decode(deserializer)); + } else { + return None; + } + } +} + +impl SseDecode for Option { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + if (::sse_decode(deserializer)) { + return Some(::sse_decode(deserializer)); + } else { + return None; + } + } +} + +impl SseDecode for Option { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + if (::sse_decode(deserializer)) { + return Some(::sse_decode(deserializer)); + } else { + return None; + } + } +} + +impl SseDecode for Option { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + if (::sse_decode(deserializer)) { + return Some(::sse_decode(deserializer)); + } else { + return None; + } + } +} + +impl SseDecode for Option { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + if (::sse_decode(deserializer)) { + return Some(::sse_decode(deserializer)); + } else { + return None; + } + } +} + +impl SseDecode for Option { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + if (::sse_decode(deserializer)) { + return Some(::sse_decode(deserializer)); + } else { + return None; + } + } +} + +impl SseDecode for Option { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + if (::sse_decode(deserializer)) { + return Some(::sse_decode(deserializer)); + } else { + return None; + } + } +} + +impl SseDecode for Option { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + if (::sse_decode(deserializer)) { + return Some(::sse_decode(deserializer)); + } else { + return None; + } + } +} + +impl SseDecode for Option { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + if (::sse_decode(deserializer)) { + return Some(::sse_decode(deserializer)); + } else { + return None; + } + } +} + +impl SseDecode for Option { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + if (::sse_decode(deserializer)) { + return Some(::sse_decode( + deserializer, + )); + } else { + return None; + } + } +} + +impl SseDecode for Option { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + if (::sse_decode(deserializer)) { + return Some(::sse_decode(deserializer)); + } else { + return None; + } + } +} + +impl SseDecode for Option { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + if (::sse_decode(deserializer)) { + return Some(::sse_decode(deserializer)); + } else { + return None; + } + } +} + +impl SseDecode for Option { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + if (::sse_decode(deserializer)) { + return Some( + ::sse_decode(deserializer), + ); + } else { + return None; + } + } +} + +impl SseDecode for Option> { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + if (::sse_decode(deserializer)) { + return Some(>::sse_decode(deserializer)); + } else { + return None; + } + } +} + +impl SseDecode for Option> { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + if (::sse_decode(deserializer)) { + return Some(>::sse_decode( + deserializer, + )); + } else { + return None; + } + } +} + +impl SseDecode for Option> { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + if (::sse_decode(deserializer)) { + return Some(>::sse_decode(deserializer)); + } else { + return None; + } + } +} + +impl SseDecode for crate::api::aiscript::ui::PostFormPropsForAsUi { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + let mut var_text = ::sse_decode(deserializer); + let mut var_cw = >::sse_decode(deserializer); + let mut var_visibility = >::sse_decode(deserializer); + let mut var_localOnly = >::sse_decode(deserializer); + return crate::api::aiscript::ui::PostFormPropsForAsUi { + text: var_text, + cw: var_cw, + visibility: var_visibility, + local_only: var_localOnly, + }; + } +} + +impl SseDecode for (String, Option) { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + let mut var_field0 = ::sse_decode(deserializer); + let mut var_field1 = >::sse_decode(deserializer); + return (var_field0, var_field1); + } +} + +impl SseDecode for (String, String) { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + let mut var_field0 = ::sse_decode(deserializer); + let mut var_field1 = ::sse_decode(deserializer); + return (var_field0, var_field1); + } +} + +impl SseDecode for u8 { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + deserializer.cursor.read_u8().unwrap() + } +} + +impl SseDecode for () { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {} +} + +impl SseDecode for usize { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + deserializer.cursor.read_u64::().unwrap() as _ + } +} + +impl SseDecode for i32 { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + deserializer.cursor.read_i32::().unwrap() + } +} + +fn pde_ffi_dispatcher_primary_impl( + func_id: i32, + port: flutter_rust_bridge::for_generated::MessagePort, + ptr: flutter_rust_bridge::for_generated::PlatformGeneralizedUint8ListPtr, + rust_vec_len: i32, + data_len: i32, +) { + // Codec=Pde (Serialization + dispatch), see doc to use other codecs + match func_id { + 1 => wire__crate__api__aiscript__AiScript_abort_impl(port, ptr, rust_vec_len, data_len), + 2 => wire__crate__api__aiscript__AiScript_exec_impl(port, ptr, rust_vec_len, data_len), + 3 => wire__crate__api__aiscript__AiScript_new_impl(port, ptr, rust_vec_len, data_len), + 5 => wire__crate__api__aiscript__ui__AsUiButtonCallback_call_impl( + port, + ptr, + rust_vec_len, + data_len, + ), + 7 => wire__crate__api__aiscript__ui__AsUiMfmCallback_call_impl( + port, + ptr, + rust_vec_len, + data_len, + ), + 8 => wire__crate__api__aiscript__ui__AsUiNumberCallback_call_impl( + port, + ptr, + rust_vec_len, + data_len, + ), + 9 => wire__crate__api__aiscript__ui__AsUiSelectCallback_call_impl( + port, + ptr, + rust_vec_len, + data_len, + ), + 10 => wire__crate__api__aiscript__ui__AsUiSwitchCallback_call_impl( + port, + ptr, + rust_vec_len, + data_len, + ), + 11 => wire__crate__api__aiscript__ui__AsUiTextInputCallback_call_impl( + port, + ptr, + rust_vec_len, + data_len, + ), + 12 => wire__crate__api__aiscript__ui__AsUiTextareaCallback_call_impl( + port, + ptr, + rust_vec_len, + data_len, + ), + _ => unreachable!(), + } +} + +fn pde_ffi_dispatcher_sync_impl( + func_id: i32, + ptr: flutter_rust_bridge::for_generated::PlatformGeneralizedUint8ListPtr, + rust_vec_len: i32, + data_len: i32, +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartSse { + // Codec=Pde (Serialization + dispatch), see doc to use other codecs + match func_id { + 4 => wire__crate__api__aiscript__api__AsApiLib_new_impl(ptr, rust_vec_len, data_len), + 6 => wire__crate__api__aiscript__ui__AsUiLib_new_impl(ptr, rust_vec_len, data_len), + _ => unreachable!(), + } +} + +// Section: rust2dart + +// Codec=Dco (DartCObject based), see doc to use other codecs +impl flutter_rust_bridge::IntoDart for FrbWrapper { + fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi { + flutter_rust_bridge::for_generated::rust_auto_opaque_encode::<_, MoiArc<_>>(self.0) + .into_dart() + } +} +impl flutter_rust_bridge::for_generated::IntoDartExceptPrimitive for FrbWrapper {} + +impl flutter_rust_bridge::IntoIntoDart> for AiScript { + fn into_into_dart(self) -> FrbWrapper { + self.into() + } +} + +// Codec=Dco (DartCObject based), see doc to use other codecs +impl flutter_rust_bridge::IntoDart for FrbWrapper { + fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi { + flutter_rust_bridge::for_generated::rust_auto_opaque_encode::<_, MoiArc<_>>(self.0) + .into_dart() + } +} +impl flutter_rust_bridge::for_generated::IntoDartExceptPrimitive for FrbWrapper {} + +impl flutter_rust_bridge::IntoIntoDart> for AsApiLib { + fn into_into_dart(self) -> FrbWrapper { + self.into() + } +} + +// Codec=Dco (DartCObject based), see doc to use other codecs +impl flutter_rust_bridge::IntoDart for FrbWrapper { + fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi { + flutter_rust_bridge::for_generated::rust_auto_opaque_encode::<_, MoiArc<_>>(self.0) + .into_dart() + } +} +impl flutter_rust_bridge::for_generated::IntoDartExceptPrimitive + for FrbWrapper +{ +} + +impl flutter_rust_bridge::IntoIntoDart> for AsUiButtonCallback { + fn into_into_dart(self) -> FrbWrapper { + self.into() + } +} + +// Codec=Dco (DartCObject based), see doc to use other codecs +impl flutter_rust_bridge::IntoDart for FrbWrapper { + fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi { + flutter_rust_bridge::for_generated::rust_auto_opaque_encode::<_, MoiArc<_>>(self.0) + .into_dart() + } +} +impl flutter_rust_bridge::for_generated::IntoDartExceptPrimitive for FrbWrapper {} + +impl flutter_rust_bridge::IntoIntoDart> for AsUiLib { + fn into_into_dart(self) -> FrbWrapper { + self.into() + } +} + +// Codec=Dco (DartCObject based), see doc to use other codecs +impl flutter_rust_bridge::IntoDart for FrbWrapper { + fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi { + flutter_rust_bridge::for_generated::rust_auto_opaque_encode::<_, MoiArc<_>>(self.0) + .into_dart() + } +} +impl flutter_rust_bridge::for_generated::IntoDartExceptPrimitive for FrbWrapper {} + +impl flutter_rust_bridge::IntoIntoDart> for AsUiMfmCallback { + fn into_into_dart(self) -> FrbWrapper { + self.into() + } +} + +// Codec=Dco (DartCObject based), see doc to use other codecs +impl flutter_rust_bridge::IntoDart for FrbWrapper { + fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi { + flutter_rust_bridge::for_generated::rust_auto_opaque_encode::<_, MoiArc<_>>(self.0) + .into_dart() + } +} +impl flutter_rust_bridge::for_generated::IntoDartExceptPrimitive + for FrbWrapper +{ +} + +impl flutter_rust_bridge::IntoIntoDart> for AsUiNumberCallback { + fn into_into_dart(self) -> FrbWrapper { + self.into() + } +} + +// Codec=Dco (DartCObject based), see doc to use other codecs +impl flutter_rust_bridge::IntoDart for FrbWrapper { + fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi { + flutter_rust_bridge::for_generated::rust_auto_opaque_encode::<_, MoiArc<_>>(self.0) + .into_dart() + } +} +impl flutter_rust_bridge::for_generated::IntoDartExceptPrimitive + for FrbWrapper +{ +} + +impl flutter_rust_bridge::IntoIntoDart> for AsUiSelectCallback { + fn into_into_dart(self) -> FrbWrapper { + self.into() + } +} + +// Codec=Dco (DartCObject based), see doc to use other codecs +impl flutter_rust_bridge::IntoDart for FrbWrapper { + fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi { + flutter_rust_bridge::for_generated::rust_auto_opaque_encode::<_, MoiArc<_>>(self.0) + .into_dart() + } +} +impl flutter_rust_bridge::for_generated::IntoDartExceptPrimitive + for FrbWrapper +{ +} + +impl flutter_rust_bridge::IntoIntoDart> for AsUiSwitchCallback { + fn into_into_dart(self) -> FrbWrapper { + self.into() + } +} + +// Codec=Dco (DartCObject based), see doc to use other codecs +impl flutter_rust_bridge::IntoDart for FrbWrapper { + fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi { + flutter_rust_bridge::for_generated::rust_auto_opaque_encode::<_, MoiArc<_>>(self.0) + .into_dart() + } +} +impl flutter_rust_bridge::for_generated::IntoDartExceptPrimitive + for FrbWrapper +{ +} + +impl flutter_rust_bridge::IntoIntoDart> + for AsUiTextInputCallback +{ + fn into_into_dart(self) -> FrbWrapper { + self.into() + } +} + +// Codec=Dco (DartCObject based), see doc to use other codecs +impl flutter_rust_bridge::IntoDart for FrbWrapper { + fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi { + flutter_rust_bridge::for_generated::rust_auto_opaque_encode::<_, MoiArc<_>>(self.0) + .into_dart() + } +} +impl flutter_rust_bridge::for_generated::IntoDartExceptPrimitive + for FrbWrapper +{ +} + +impl flutter_rust_bridge::IntoIntoDart> for AsUiTextareaCallback { + fn into_into_dart(self) -> FrbWrapper { + self.into() + } +} + +// Codec=Dco (DartCObject based), see doc to use other codecs +impl flutter_rust_bridge::IntoDart for crate::api::aiscript::play::AsPlayLib { + fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi { + [ + self.this_id.into_into_dart().into_dart(), + self.this_url.into_into_dart().into_dart(), + ] + .into_dart() + } +} +impl flutter_rust_bridge::for_generated::IntoDartExceptPrimitive + for crate::api::aiscript::play::AsPlayLib +{ +} +impl flutter_rust_bridge::IntoIntoDart + for crate::api::aiscript::play::AsPlayLib +{ + fn into_into_dart(self) -> crate::api::aiscript::play::AsPlayLib { + self + } +} +// Codec=Dco (DartCObject based), see doc to use other codecs +impl flutter_rust_bridge::IntoDart for crate::api::aiscript::ui::AsUiButton { + fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi { + [ + self.text.into_into_dart().into_dart(), + self.on_click.into_into_dart().into_dart(), + self.primary.into_into_dart().into_dart(), + self.rounded.into_into_dart().into_dart(), + self.disabled.into_into_dart().into_dart(), + ] + .into_dart() + } +} +impl flutter_rust_bridge::for_generated::IntoDartExceptPrimitive + for crate::api::aiscript::ui::AsUiButton +{ +} +impl flutter_rust_bridge::IntoIntoDart + for crate::api::aiscript::ui::AsUiButton +{ + fn into_into_dart(self) -> crate::api::aiscript::ui::AsUiButton { + self + } +} +// Codec=Dco (DartCObject based), see doc to use other codecs +impl flutter_rust_bridge::IntoDart for crate::api::aiscript::ui::AsUiButtons { + fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi { + [self.buttons.into_into_dart().into_dart()].into_dart() + } +} +impl flutter_rust_bridge::for_generated::IntoDartExceptPrimitive + for crate::api::aiscript::ui::AsUiButtons +{ +} +impl flutter_rust_bridge::IntoIntoDart + for crate::api::aiscript::ui::AsUiButtons +{ + fn into_into_dart(self) -> crate::api::aiscript::ui::AsUiButtons { + self + } +} +// Codec=Dco (DartCObject based), see doc to use other codecs +impl flutter_rust_bridge::IntoDart for crate::api::aiscript::ui::AsUiComponent { + fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi { + match self { + crate::api::aiscript::ui::AsUiComponent::Root(field0) => { + [0.into_dart(), field0.into_into_dart().into_dart()].into_dart() + } + crate::api::aiscript::ui::AsUiComponent::Container(field0) => { + [1.into_dart(), field0.into_into_dart().into_dart()].into_dart() + } + crate::api::aiscript::ui::AsUiComponent::Text(field0) => { + [2.into_dart(), field0.into_into_dart().into_dart()].into_dart() + } + crate::api::aiscript::ui::AsUiComponent::Mfm(field0) => { + [3.into_dart(), field0.into_into_dart().into_dart()].into_dart() + } + crate::api::aiscript::ui::AsUiComponent::Button(field0) => { + [4.into_dart(), field0.into_into_dart().into_dart()].into_dart() + } + crate::api::aiscript::ui::AsUiComponent::Buttons(field0) => { + [5.into_dart(), field0.into_into_dart().into_dart()].into_dart() + } + crate::api::aiscript::ui::AsUiComponent::ToggleSwitch(field0) => { + [6.into_dart(), field0.into_into_dart().into_dart()].into_dart() + } + crate::api::aiscript::ui::AsUiComponent::Textarea(field0) => { + [7.into_dart(), field0.into_into_dart().into_dart()].into_dart() + } + crate::api::aiscript::ui::AsUiComponent::TextInput(field0) => { + [8.into_dart(), field0.into_into_dart().into_dart()].into_dart() + } + crate::api::aiscript::ui::AsUiComponent::NumberInput(field0) => { + [9.into_dart(), field0.into_into_dart().into_dart()].into_dart() + } + crate::api::aiscript::ui::AsUiComponent::Select(field0) => { + [10.into_dart(), field0.into_into_dart().into_dart()].into_dart() + } + crate::api::aiscript::ui::AsUiComponent::Folder(field0) => { + [11.into_dart(), field0.into_into_dart().into_dart()].into_dart() + } + crate::api::aiscript::ui::AsUiComponent::PostFormButton(field0) => { + [12.into_dart(), field0.into_into_dart().into_dart()].into_dart() + } + crate::api::aiscript::ui::AsUiComponent::PostForm(field0) => { + [13.into_dart(), field0.into_into_dart().into_dart()].into_dart() + } + _ => { + unimplemented!(""); + } + } + } +} +impl flutter_rust_bridge::for_generated::IntoDartExceptPrimitive + for crate::api::aiscript::ui::AsUiComponent +{ +} +impl flutter_rust_bridge::IntoIntoDart + for crate::api::aiscript::ui::AsUiComponent +{ + fn into_into_dart(self) -> crate::api::aiscript::ui::AsUiComponent { + self + } +} +// Codec=Dco (DartCObject based), see doc to use other codecs +impl flutter_rust_bridge::IntoDart for crate::api::aiscript::ui::AsUiContainer { + fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi { + [ + self.children.into_into_dart().into_dart(), + self.align.into_into_dart().into_dart(), + self.bg_color.into_into_dart().into_dart(), + self.fg_color.into_into_dart().into_dart(), + self.font.into_into_dart().into_dart(), + self.border_width.into_into_dart().into_dart(), + self.border_color.into_into_dart().into_dart(), + self.padding.into_into_dart().into_dart(), + self.rounded.into_into_dart().into_dart(), + self.hidden.into_into_dart().into_dart(), + ] + .into_dart() + } +} +impl flutter_rust_bridge::for_generated::IntoDartExceptPrimitive + for crate::api::aiscript::ui::AsUiContainer +{ +} +impl flutter_rust_bridge::IntoIntoDart + for crate::api::aiscript::ui::AsUiContainer +{ + fn into_into_dart(self) -> crate::api::aiscript::ui::AsUiContainer { + self + } +} +// Codec=Dco (DartCObject based), see doc to use other codecs +impl flutter_rust_bridge::IntoDart for crate::api::aiscript::ui::AsUiFolder { + fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi { + [ + self.children.into_into_dart().into_dart(), + self.title.into_into_dart().into_dart(), + self.opened.into_into_dart().into_dart(), + ] + .into_dart() + } +} +impl flutter_rust_bridge::for_generated::IntoDartExceptPrimitive + for crate::api::aiscript::ui::AsUiFolder +{ +} +impl flutter_rust_bridge::IntoIntoDart + for crate::api::aiscript::ui::AsUiFolder +{ + fn into_into_dart(self) -> crate::api::aiscript::ui::AsUiFolder { + self + } +} +// Codec=Dco (DartCObject based), see doc to use other codecs +impl flutter_rust_bridge::IntoDart for crate::api::aiscript::ui::AsUiMfm { + fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi { + [ + self.text.into_into_dart().into_dart(), + self.size.into_into_dart().into_dart(), + self.bold.into_into_dart().into_dart(), + self.color.into_into_dart().into_dart(), + self.font.into_into_dart().into_dart(), + self.on_click_ev.into_into_dart().into_dart(), + ] + .into_dart() + } +} +impl flutter_rust_bridge::for_generated::IntoDartExceptPrimitive + for crate::api::aiscript::ui::AsUiMfm +{ +} +impl flutter_rust_bridge::IntoIntoDart + for crate::api::aiscript::ui::AsUiMfm +{ + fn into_into_dart(self) -> crate::api::aiscript::ui::AsUiMfm { + self + } +} +// Codec=Dco (DartCObject based), see doc to use other codecs +impl flutter_rust_bridge::IntoDart for crate::api::aiscript::ui::AsUiNumberInput { + fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi { + [ + self.on_input.into_into_dart().into_dart(), + self.default_value.into_into_dart().into_dart(), + self.label.into_into_dart().into_dart(), + self.caption.into_into_dart().into_dart(), + ] + .into_dart() + } +} +impl flutter_rust_bridge::for_generated::IntoDartExceptPrimitive + for crate::api::aiscript::ui::AsUiNumberInput +{ +} +impl flutter_rust_bridge::IntoIntoDart + for crate::api::aiscript::ui::AsUiNumberInput +{ + fn into_into_dart(self) -> crate::api::aiscript::ui::AsUiNumberInput { + self + } +} +// Codec=Dco (DartCObject based), see doc to use other codecs +impl flutter_rust_bridge::IntoDart for crate::api::aiscript::ui::AsUiPostForm { + fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi { + [self.form.into_into_dart().into_dart()].into_dart() + } +} +impl flutter_rust_bridge::for_generated::IntoDartExceptPrimitive + for crate::api::aiscript::ui::AsUiPostForm +{ +} +impl flutter_rust_bridge::IntoIntoDart + for crate::api::aiscript::ui::AsUiPostForm +{ + fn into_into_dart(self) -> crate::api::aiscript::ui::AsUiPostForm { + self + } +} +// Codec=Dco (DartCObject based), see doc to use other codecs +impl flutter_rust_bridge::IntoDart for crate::api::aiscript::ui::AsUiPostFormButton { + fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi { + [ + self.text.into_into_dart().into_dart(), + self.primary.into_into_dart().into_dart(), + self.rounded.into_into_dart().into_dart(), + self.form.into_into_dart().into_dart(), + ] + .into_dart() + } +} +impl flutter_rust_bridge::for_generated::IntoDartExceptPrimitive + for crate::api::aiscript::ui::AsUiPostFormButton +{ +} +impl flutter_rust_bridge::IntoIntoDart + for crate::api::aiscript::ui::AsUiPostFormButton +{ + fn into_into_dart(self) -> crate::api::aiscript::ui::AsUiPostFormButton { + self + } +} +// Codec=Dco (DartCObject based), see doc to use other codecs +impl flutter_rust_bridge::IntoDart for crate::api::aiscript::ui::AsUiRoot { + fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi { + [self.children.into_into_dart().into_dart()].into_dart() + } +} +impl flutter_rust_bridge::for_generated::IntoDartExceptPrimitive + for crate::api::aiscript::ui::AsUiRoot +{ +} +impl flutter_rust_bridge::IntoIntoDart + for crate::api::aiscript::ui::AsUiRoot +{ + fn into_into_dart(self) -> crate::api::aiscript::ui::AsUiRoot { + self + } +} +// Codec=Dco (DartCObject based), see doc to use other codecs +impl flutter_rust_bridge::IntoDart for crate::api::aiscript::ui::AsUiSelect { + fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi { + [ + self.items.into_into_dart().into_dart(), + self.on_change.into_into_dart().into_dart(), + self.default_value.into_into_dart().into_dart(), + self.label.into_into_dart().into_dart(), + self.caption.into_into_dart().into_dart(), + ] + .into_dart() + } +} +impl flutter_rust_bridge::for_generated::IntoDartExceptPrimitive + for crate::api::aiscript::ui::AsUiSelect +{ +} +impl flutter_rust_bridge::IntoIntoDart + for crate::api::aiscript::ui::AsUiSelect +{ + fn into_into_dart(self) -> crate::api::aiscript::ui::AsUiSelect { + self + } +} +// Codec=Dco (DartCObject based), see doc to use other codecs +impl flutter_rust_bridge::IntoDart for crate::api::aiscript::ui::AsUiSwitch { + fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi { + [ + self.on_change.into_into_dart().into_dart(), + self.default_value.into_into_dart().into_dart(), + self.label.into_into_dart().into_dart(), + self.caption.into_into_dart().into_dart(), + ] + .into_dart() + } +} +impl flutter_rust_bridge::for_generated::IntoDartExceptPrimitive + for crate::api::aiscript::ui::AsUiSwitch +{ +} +impl flutter_rust_bridge::IntoIntoDart + for crate::api::aiscript::ui::AsUiSwitch +{ + fn into_into_dart(self) -> crate::api::aiscript::ui::AsUiSwitch { + self + } +} +// Codec=Dco (DartCObject based), see doc to use other codecs +impl flutter_rust_bridge::IntoDart for crate::api::aiscript::ui::AsUiText { + fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi { + [ + self.text.into_into_dart().into_dart(), + self.size.into_into_dart().into_dart(), + self.bold.into_into_dart().into_dart(), + self.color.into_into_dart().into_dart(), + self.font.into_into_dart().into_dart(), + ] + .into_dart() + } +} +impl flutter_rust_bridge::for_generated::IntoDartExceptPrimitive + for crate::api::aiscript::ui::AsUiText +{ +} +impl flutter_rust_bridge::IntoIntoDart + for crate::api::aiscript::ui::AsUiText +{ + fn into_into_dart(self) -> crate::api::aiscript::ui::AsUiText { + self + } +} +// Codec=Dco (DartCObject based), see doc to use other codecs +impl flutter_rust_bridge::IntoDart for crate::api::aiscript::ui::AsUiTextInput { + fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi { + [ + self.on_input.into_into_dart().into_dart(), + self.default_value.into_into_dart().into_dart(), + self.label.into_into_dart().into_dart(), + self.caption.into_into_dart().into_dart(), + ] + .into_dart() + } +} +impl flutter_rust_bridge::for_generated::IntoDartExceptPrimitive + for crate::api::aiscript::ui::AsUiTextInput +{ +} +impl flutter_rust_bridge::IntoIntoDart + for crate::api::aiscript::ui::AsUiTextInput +{ + fn into_into_dart(self) -> crate::api::aiscript::ui::AsUiTextInput { + self + } +} +// Codec=Dco (DartCObject based), see doc to use other codecs +impl flutter_rust_bridge::IntoDart for crate::api::aiscript::ui::AsUiTextarea { + fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi { + [ + self.on_input.into_into_dart().into_dart(), + self.default_value.into_into_dart().into_dart(), + self.label.into_into_dart().into_dart(), + self.caption.into_into_dart().into_dart(), + ] + .into_dart() + } +} +impl flutter_rust_bridge::for_generated::IntoDartExceptPrimitive + for crate::api::aiscript::ui::AsUiTextarea +{ +} +impl flutter_rust_bridge::IntoIntoDart + for crate::api::aiscript::ui::AsUiTextarea +{ + fn into_into_dart(self) -> crate::api::aiscript::ui::AsUiTextarea { + self + } +} +// Codec=Dco (DartCObject based), see doc to use other codecs +impl flutter_rust_bridge::IntoDart for crate::api::aiscript::ui::PostFormPropsForAsUi { + fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi { + [ + self.text.into_into_dart().into_dart(), + self.cw.into_into_dart().into_dart(), + self.visibility.into_into_dart().into_dart(), + self.local_only.into_into_dart().into_dart(), + ] + .into_dart() + } +} +impl flutter_rust_bridge::for_generated::IntoDartExceptPrimitive + for crate::api::aiscript::ui::PostFormPropsForAsUi +{ +} +impl flutter_rust_bridge::IntoIntoDart + for crate::api::aiscript::ui::PostFormPropsForAsUi +{ + fn into_into_dart(self) -> crate::api::aiscript::ui::PostFormPropsForAsUi { + self + } +} + +impl SseEncode for flutter_rust_bridge::for_generated::anyhow::Error { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + ::sse_encode(format!("{:?}", self), serializer); + } +} + +impl SseEncode for AiScript { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + >>::sse_encode(flutter_rust_bridge::for_generated::rust_auto_opaque_encode::<_, MoiArc<_>>(self), serializer); + } +} + +impl SseEncode for AsApiLib { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + >>::sse_encode(flutter_rust_bridge::for_generated::rust_auto_opaque_encode::<_, MoiArc<_>>(self), serializer); + } +} + +impl SseEncode for AsUiButtonCallback { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + >>::sse_encode(flutter_rust_bridge::for_generated::rust_auto_opaque_encode::<_, MoiArc<_>>(self), serializer); + } +} + +impl SseEncode for AsUiLib { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + >>::sse_encode(flutter_rust_bridge::for_generated::rust_auto_opaque_encode::<_, MoiArc<_>>(self), serializer); + } +} + +impl SseEncode for AsUiMfmCallback { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + >>::sse_encode(flutter_rust_bridge::for_generated::rust_auto_opaque_encode::<_, MoiArc<_>>(self), serializer); + } +} + +impl SseEncode for AsUiNumberCallback { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + >>::sse_encode(flutter_rust_bridge::for_generated::rust_auto_opaque_encode::<_, MoiArc<_>>(self), serializer); + } +} + +impl SseEncode for AsUiSelectCallback { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + >>::sse_encode(flutter_rust_bridge::for_generated::rust_auto_opaque_encode::<_, MoiArc<_>>(self), serializer); + } +} + +impl SseEncode for AsUiSwitchCallback { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + >>::sse_encode(flutter_rust_bridge::for_generated::rust_auto_opaque_encode::<_, MoiArc<_>>(self), serializer); + } +} + +impl SseEncode for AsUiTextInputCallback { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + , + >>::sse_encode( + flutter_rust_bridge::for_generated::rust_auto_opaque_encode::<_, MoiArc<_>>(self), + serializer, + ); + } +} + +impl SseEncode for AsUiTextareaCallback { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + , + >>::sse_encode( + flutter_rust_bridge::for_generated::rust_auto_opaque_encode::<_, MoiArc<_>>(self), + serializer, + ); + } +} + +impl SseEncode for flutter_rust_bridge::DartOpaque { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + ::sse_encode(self.encode(), serializer); + } +} + +impl SseEncode + for RustOpaqueMoi> +{ + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + let (ptr, size) = self.sse_encode_raw(); + ::sse_encode(ptr, serializer); + ::sse_encode(size, serializer); + } +} + +impl SseEncode + for RustOpaqueMoi> +{ + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + let (ptr, size) = self.sse_encode_raw(); + ::sse_encode(ptr, serializer); + ::sse_encode(size, serializer); + } +} + +impl SseEncode + for RustOpaqueMoi> +{ + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + let (ptr, size) = self.sse_encode_raw(); + ::sse_encode(ptr, serializer); + ::sse_encode(size, serializer); + } +} + +impl SseEncode for RustOpaqueMoi> { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + let (ptr, size) = self.sse_encode_raw(); + ::sse_encode(ptr, serializer); + ::sse_encode(size, serializer); + } +} + +impl SseEncode + for RustOpaqueMoi> +{ + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + let (ptr, size) = self.sse_encode_raw(); + ::sse_encode(ptr, serializer); + ::sse_encode(size, serializer); + } +} + +impl SseEncode + for RustOpaqueMoi> +{ + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + let (ptr, size) = self.sse_encode_raw(); + ::sse_encode(ptr, serializer); + ::sse_encode(size, serializer); + } +} + +impl SseEncode + for RustOpaqueMoi> +{ + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + let (ptr, size) = self.sse_encode_raw(); + ::sse_encode(ptr, serializer); + ::sse_encode(size, serializer); + } +} + +impl SseEncode + for RustOpaqueMoi> +{ + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + let (ptr, size) = self.sse_encode_raw(); + ::sse_encode(ptr, serializer); + ::sse_encode(size, serializer); + } +} + +impl SseEncode + for RustOpaqueMoi< + flutter_rust_bridge::for_generated::RustAutoOpaqueInner, + > +{ + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + let (ptr, size) = self.sse_encode_raw(); + ::sse_encode(ptr, serializer); + ::sse_encode(size, serializer); + } +} + +impl SseEncode + for RustOpaqueMoi> +{ + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + let (ptr, size) = self.sse_encode_raw(); + ::sse_encode(ptr, serializer); + ::sse_encode(size, serializer); + } +} + +impl SseEncode for String { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + >::sse_encode(self.into_bytes(), serializer); + } +} + +impl SseEncode for crate::api::aiscript::play::AsPlayLib { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + ::sse_encode(self.this_id, serializer); + ::sse_encode(self.this_url, serializer); + } +} + +impl SseEncode for crate::api::aiscript::ui::AsUiButton { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + >::sse_encode(self.text, serializer); + >::sse_encode(self.on_click, serializer); + >::sse_encode(self.primary, serializer); + >::sse_encode(self.rounded, serializer); + >::sse_encode(self.disabled, serializer); + } +} + +impl SseEncode for crate::api::aiscript::ui::AsUiButtons { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + >>::sse_encode(self.buttons, serializer); + } +} + +impl SseEncode for crate::api::aiscript::ui::AsUiComponent { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + match self { + crate::api::aiscript::ui::AsUiComponent::Root(field0) => { + ::sse_encode(0, serializer); + ::sse_encode(field0, serializer); + } + crate::api::aiscript::ui::AsUiComponent::Container(field0) => { + ::sse_encode(1, serializer); + ::sse_encode(field0, serializer); + } + crate::api::aiscript::ui::AsUiComponent::Text(field0) => { + ::sse_encode(2, serializer); + ::sse_encode(field0, serializer); + } + crate::api::aiscript::ui::AsUiComponent::Mfm(field0) => { + ::sse_encode(3, serializer); + ::sse_encode(field0, serializer); + } + crate::api::aiscript::ui::AsUiComponent::Button(field0) => { + ::sse_encode(4, serializer); + ::sse_encode(field0, serializer); + } + crate::api::aiscript::ui::AsUiComponent::Buttons(field0) => { + ::sse_encode(5, serializer); + ::sse_encode(field0, serializer); + } + crate::api::aiscript::ui::AsUiComponent::ToggleSwitch(field0) => { + ::sse_encode(6, serializer); + ::sse_encode(field0, serializer); + } + crate::api::aiscript::ui::AsUiComponent::Textarea(field0) => { + ::sse_encode(7, serializer); + ::sse_encode(field0, serializer); + } + crate::api::aiscript::ui::AsUiComponent::TextInput(field0) => { + ::sse_encode(8, serializer); + ::sse_encode(field0, serializer); + } + crate::api::aiscript::ui::AsUiComponent::NumberInput(field0) => { + ::sse_encode(9, serializer); + ::sse_encode(field0, serializer); + } + crate::api::aiscript::ui::AsUiComponent::Select(field0) => { + ::sse_encode(10, serializer); + ::sse_encode(field0, serializer); + } + crate::api::aiscript::ui::AsUiComponent::Folder(field0) => { + ::sse_encode(11, serializer); + ::sse_encode(field0, serializer); + } + crate::api::aiscript::ui::AsUiComponent::PostFormButton(field0) => { + ::sse_encode(12, serializer); + ::sse_encode(field0, serializer); + } + crate::api::aiscript::ui::AsUiComponent::PostForm(field0) => { + ::sse_encode(13, serializer); + ::sse_encode(field0, serializer); + } + _ => { + unimplemented!(""); + } + } + } +} + +impl SseEncode for crate::api::aiscript::ui::AsUiContainer { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + >>::sse_encode(self.children, serializer); + >::sse_encode(self.align, serializer); + >::sse_encode(self.bg_color, serializer); + >::sse_encode(self.fg_color, serializer); + >::sse_encode(self.font, serializer); + >::sse_encode(self.border_width, serializer); + >::sse_encode(self.border_color, serializer); + >::sse_encode(self.padding, serializer); + >::sse_encode(self.rounded, serializer); + >::sse_encode(self.hidden, serializer); + } +} + +impl SseEncode for crate::api::aiscript::ui::AsUiFolder { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + >>::sse_encode(self.children, serializer); + >::sse_encode(self.title, serializer); + >::sse_encode(self.opened, serializer); + } +} + +impl SseEncode for crate::api::aiscript::ui::AsUiMfm { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + >::sse_encode(self.text, serializer); + >::sse_encode(self.size, serializer); + >::sse_encode(self.bold, serializer); + >::sse_encode(self.color, serializer); + >::sse_encode(self.font, serializer); + >::sse_encode(self.on_click_ev, serializer); + } +} + +impl SseEncode for crate::api::aiscript::ui::AsUiNumberInput { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + >::sse_encode(self.on_input, serializer); + >::sse_encode(self.default_value, serializer); + >::sse_encode(self.label, serializer); + >::sse_encode(self.caption, serializer); + } +} + +impl SseEncode for crate::api::aiscript::ui::AsUiPostForm { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + >::sse_encode(self.form, serializer); + } +} + +impl SseEncode for crate::api::aiscript::ui::AsUiPostFormButton { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + >::sse_encode(self.text, serializer); + >::sse_encode(self.primary, serializer); + >::sse_encode(self.rounded, serializer); + >::sse_encode(self.form, serializer); + } +} + +impl SseEncode for crate::api::aiscript::ui::AsUiRoot { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + >::sse_encode(self.children, serializer); + } +} + +impl SseEncode for crate::api::aiscript::ui::AsUiSelect { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + >>::sse_encode(self.items, serializer); + >::sse_encode(self.on_change, serializer); + >::sse_encode(self.default_value, serializer); + >::sse_encode(self.label, serializer); + >::sse_encode(self.caption, serializer); + } +} + +impl SseEncode for crate::api::aiscript::ui::AsUiSwitch { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + >::sse_encode(self.on_change, serializer); + >::sse_encode(self.default_value, serializer); + >::sse_encode(self.label, serializer); + >::sse_encode(self.caption, serializer); + } +} + +impl SseEncode for crate::api::aiscript::ui::AsUiText { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + >::sse_encode(self.text, serializer); + >::sse_encode(self.size, serializer); + >::sse_encode(self.bold, serializer); + >::sse_encode(self.color, serializer); + >::sse_encode(self.font, serializer); + } +} + +impl SseEncode for crate::api::aiscript::ui::AsUiTextInput { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + >::sse_encode(self.on_input, serializer); + >::sse_encode(self.default_value, serializer); + >::sse_encode(self.label, serializer); + >::sse_encode(self.caption, serializer); + } +} + +impl SseEncode for crate::api::aiscript::ui::AsUiTextarea { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + >::sse_encode(self.on_input, serializer); + >::sse_encode(self.default_value, serializer); + >::sse_encode(self.label, serializer); + >::sse_encode(self.caption, serializer); + } +} + +impl SseEncode for bool { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + serializer.cursor.write_u8(self as _).unwrap(); + } +} + +impl SseEncode for f64 { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + serializer.cursor.write_f64::(self).unwrap(); + } +} + +impl SseEncode for Vec { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + ::sse_encode(self.len() as _, serializer); + for item in self { + ::sse_encode(item, serializer); + } + } +} + +impl SseEncode for Vec { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + ::sse_encode(self.len() as _, serializer); + for item in self { + ::sse_encode(item, serializer); + } + } +} + +impl SseEncode for Vec { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + ::sse_encode(self.len() as _, serializer); + for item in self { + ::sse_encode(item, serializer); + } + } +} + +impl SseEncode for Vec<(String, String)> { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + ::sse_encode(self.len() as _, serializer); + for item in self { + <(String, String)>::sse_encode(item, serializer); + } + } +} + +impl SseEncode for Option { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + ::sse_encode(self.is_some(), serializer); + if let Some(value) = self { + ::sse_encode(value, serializer); + } + } +} + +impl SseEncode for Option { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + ::sse_encode(self.is_some(), serializer); + if let Some(value) = self { + ::sse_encode(value, serializer); + } + } +} + +impl SseEncode for Option { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + ::sse_encode(self.is_some(), serializer); + if let Some(value) = self { + ::sse_encode(value, serializer); + } + } +} + +impl SseEncode for Option { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + ::sse_encode(self.is_some(), serializer); + if let Some(value) = self { + ::sse_encode(value, serializer); + } + } +} + +impl SseEncode for Option { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + ::sse_encode(self.is_some(), serializer); + if let Some(value) = self { + ::sse_encode(value, serializer); + } + } +} + +impl SseEncode for Option { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + ::sse_encode(self.is_some(), serializer); + if let Some(value) = self { + ::sse_encode(value, serializer); + } + } +} + +impl SseEncode for Option { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + ::sse_encode(self.is_some(), serializer); + if let Some(value) = self { + ::sse_encode(value, serializer); + } + } +} + +impl SseEncode for Option { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + ::sse_encode(self.is_some(), serializer); + if let Some(value) = self { + ::sse_encode(value, serializer); + } + } +} + +impl SseEncode for Option { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + ::sse_encode(self.is_some(), serializer); + if let Some(value) = self { + ::sse_encode(value, serializer); + } + } +} + +impl SseEncode for Option { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + ::sse_encode(self.is_some(), serializer); + if let Some(value) = self { + ::sse_encode(value, serializer); + } + } +} + +impl SseEncode for Option { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + ::sse_encode(self.is_some(), serializer); + if let Some(value) = self { + ::sse_encode(value, serializer); + } + } +} + +impl SseEncode for Option { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + ::sse_encode(self.is_some(), serializer); + if let Some(value) = self { + ::sse_encode(value, serializer); + } + } +} + +impl SseEncode for Option { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + ::sse_encode(self.is_some(), serializer); + if let Some(value) = self { + ::sse_encode(value, serializer); + } + } +} + +impl SseEncode for Option { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + ::sse_encode(self.is_some(), serializer); + if let Some(value) = self { + ::sse_encode(value, serializer); + } + } +} + +impl SseEncode for Option> { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + ::sse_encode(self.is_some(), serializer); + if let Some(value) = self { + >::sse_encode(value, serializer); + } + } +} + +impl SseEncode for Option> { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + ::sse_encode(self.is_some(), serializer); + if let Some(value) = self { + >::sse_encode(value, serializer); + } + } +} + +impl SseEncode for Option> { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + ::sse_encode(self.is_some(), serializer); + if let Some(value) = self { + >::sse_encode(value, serializer); + } + } +} + +impl SseEncode for crate::api::aiscript::ui::PostFormPropsForAsUi { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + ::sse_encode(self.text, serializer); + >::sse_encode(self.cw, serializer); + >::sse_encode(self.visibility, serializer); + >::sse_encode(self.local_only, serializer); + } +} + +impl SseEncode for (String, Option) { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + ::sse_encode(self.0, serializer); + >::sse_encode(self.1, serializer); + } +} + +impl SseEncode for (String, String) { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + ::sse_encode(self.0, serializer); + ::sse_encode(self.1, serializer); + } +} + +impl SseEncode for u8 { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + serializer.cursor.write_u8(self).unwrap(); + } +} + +impl SseEncode for () { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {} +} + +impl SseEncode for usize { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + serializer + .cursor + .write_u64::(self as _) + .unwrap(); + } +} + +impl SseEncode for i32 { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + serializer.cursor.write_i32::(self).unwrap(); + } +} + +#[cfg(not(target_family = "wasm"))] +#[path = "frb_generated.io.rs"] +mod io; +#[cfg(not(target_family = "wasm"))] +pub use io::*; + +/// cbindgen:ignore +#[cfg(target_family = "wasm")] +#[path = "frb_generated.web.rs"] +mod web; +#[cfg(target_family = "wasm")] +pub use web::*; diff --git a/rust/src/frb_generated.web.rs b/rust/src/frb_generated.web.rs new file mode 100644 index 00000000..8783cf06 --- /dev/null +++ b/rust/src/frb_generated.web.rs @@ -0,0 +1,158 @@ +// This file is automatically generated, so please do not edit it. +// Generated by `flutter_rust_bridge`@ 2.0.0-dev.39. + +// Section: imports + +use super::*; +use crate::api::aiscript::api::*; +use crate::api::aiscript::ui::*; +use crate::api::aiscript::*; +use flutter_rust_bridge::for_generated::byteorder::{NativeEndian, ReadBytesExt, WriteBytesExt}; +use flutter_rust_bridge::for_generated::wasm_bindgen; +use flutter_rust_bridge::for_generated::wasm_bindgen::prelude::*; +use flutter_rust_bridge::for_generated::{transform_result_dco, Lockable}; +use flutter_rust_bridge::{Handler, IntoIntoDart}; + +// Section: boilerplate + +flutter_rust_bridge::frb_generated_boilerplate_web!(); + +#[wasm_bindgen] +pub fn rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAiScript( + ptr: *const std::ffi::c_void, +) { + MoiArc::>::increment_strong_count(ptr as _); +} + +#[wasm_bindgen] +pub fn rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAiScript( + ptr: *const std::ffi::c_void, +) { + MoiArc::>::decrement_strong_count(ptr as _); +} + +#[wasm_bindgen] +pub fn rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsApiLib( + ptr: *const std::ffi::c_void, +) { + MoiArc::>::increment_strong_count(ptr as _); +} + +#[wasm_bindgen] +pub fn rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsApiLib( + ptr: *const std::ffi::c_void, +) { + MoiArc::>::decrement_strong_count(ptr as _); +} + +#[wasm_bindgen] +pub fn rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiButtonCallback( + ptr: *const std::ffi::c_void, +) { + MoiArc::>::increment_strong_count(ptr as _); +} + +#[wasm_bindgen] +pub fn rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiButtonCallback( + ptr: *const std::ffi::c_void, +) { + MoiArc::>::decrement_strong_count(ptr as _); +} + +#[wasm_bindgen] +pub fn rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiLib( + ptr: *const std::ffi::c_void, +) { + MoiArc::>::increment_strong_count(ptr as _); +} + +#[wasm_bindgen] +pub fn rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiLib( + ptr: *const std::ffi::c_void, +) { + MoiArc::>::decrement_strong_count(ptr as _); +} + +#[wasm_bindgen] +pub fn rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiMfmCallback( + ptr: *const std::ffi::c_void, +) { + MoiArc::>::increment_strong_count(ptr as _); +} + +#[wasm_bindgen] +pub fn rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiMfmCallback( + ptr: *const std::ffi::c_void, +) { + MoiArc::>::decrement_strong_count(ptr as _); +} + +#[wasm_bindgen] +pub fn rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiNumberCallback( + ptr: *const std::ffi::c_void, +) { + MoiArc::>::increment_strong_count(ptr as _); +} + +#[wasm_bindgen] +pub fn rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiNumberCallback( + ptr: *const std::ffi::c_void, +) { + MoiArc::>::decrement_strong_count(ptr as _); +} + +#[wasm_bindgen] +pub fn rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSelectCallback( + ptr: *const std::ffi::c_void, +) { + MoiArc::>::increment_strong_count(ptr as _); +} + +#[wasm_bindgen] +pub fn rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSelectCallback( + ptr: *const std::ffi::c_void, +) { + MoiArc::>::decrement_strong_count(ptr as _); +} + +#[wasm_bindgen] +pub fn rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSwitchCallback( + ptr: *const std::ffi::c_void, +) { + MoiArc::>::increment_strong_count(ptr as _); +} + +#[wasm_bindgen] +pub fn rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiSwitchCallback( + ptr: *const std::ffi::c_void, +) { + MoiArc::>::decrement_strong_count(ptr as _); +} + +#[wasm_bindgen] +pub fn rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextInputCallback( + ptr: *const std::ffi::c_void, +) { + MoiArc::>::increment_strong_count(ptr as _); +} + +#[wasm_bindgen] +pub fn rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextInputCallback( + ptr: *const std::ffi::c_void, +) { + MoiArc::>::decrement_strong_count(ptr as _); +} + +#[wasm_bindgen] +pub fn rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextareaCallback( + ptr: *const std::ffi::c_void, +) { + MoiArc::>::increment_strong_count(ptr as _); +} + +#[wasm_bindgen] +pub fn rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAsUiTextareaCallback( + ptr: *const std::ffi::c_void, +) { + MoiArc::>::decrement_strong_count(ptr as _); +} diff --git a/rust/src/lib.rs b/rust/src/lib.rs new file mode 100644 index 00000000..93606027 --- /dev/null +++ b/rust/src/lib.rs @@ -0,0 +1,2 @@ +pub mod api; +mod frb_generated; /* AUTO INJECTED BY flutter_rust_bridge. This line may not be accurate, and you can change it according to your needs. */ diff --git a/rust_builder/.gitignore b/rust_builder/.gitignore new file mode 100644 index 00000000..ac5aa989 --- /dev/null +++ b/rust_builder/.gitignore @@ -0,0 +1,29 @@ +# Miscellaneous +*.class +*.log +*.pyc +*.swp +.DS_Store +.atom/ +.buildlog/ +.history +.svn/ +migrate_working_dir/ + +# IntelliJ related +*.iml +*.ipr +*.iws +.idea/ + +# The .vscode folder contains launch configuration and tasks you configure in +# VS Code which you may wish to be included in version control, so this line +# is commented out by default. +#.vscode/ + +# Flutter/Dart/Pub related +# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock. +/pubspec.lock +**/doc/api/ +.dart_tool/ +build/ diff --git a/rust_builder/README.md b/rust_builder/README.md new file mode 100644 index 00000000..922615f9 --- /dev/null +++ b/rust_builder/README.md @@ -0,0 +1 @@ +Please ignore this folder, which is just glue to build Rust with Flutter. \ No newline at end of file diff --git a/rust_builder/android/.gitignore b/rust_builder/android/.gitignore new file mode 100644 index 00000000..161bdcda --- /dev/null +++ b/rust_builder/android/.gitignore @@ -0,0 +1,9 @@ +*.iml +.gradle +/local.properties +/.idea/workspace.xml +/.idea/libraries +.DS_Store +/build +/captures +.cxx diff --git a/rust_builder/android/build.gradle b/rust_builder/android/build.gradle new file mode 100644 index 00000000..a6ca9f41 --- /dev/null +++ b/rust_builder/android/build.gradle @@ -0,0 +1,56 @@ +// The Android Gradle Plugin builds the native code with the Android NDK. + +group 'com.flutter_rust_bridge.rust_lib_aria' +version '1.0' + +buildscript { + repositories { + google() + mavenCentral() + } + + dependencies { + // The Android Gradle Plugin knows how to build native code with the NDK. + classpath 'com.android.tools.build:gradle:7.3.0' + } +} + +rootProject.allprojects { + repositories { + google() + mavenCentral() + } +} + +apply plugin: 'com.android.library' + +android { + if (project.android.hasProperty("namespace")) { + namespace 'com.flutter_rust_bridge.rust_lib_aria' + } + + // Bumping the plugin compileSdkVersion requires all clients of this plugin + // to bump the version in their app. + compileSdkVersion 33 + + // Use the NDK version + // declared in /android/app/build.gradle file of the Flutter project. + // Replace it with a version number if this plugin requires a specfic NDK version. + // (e.g. ndkVersion "23.1.7779620") + ndkVersion android.ndkVersion + + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + + defaultConfig { + minSdkVersion 19 + } +} + +apply from: "../cargokit/gradle/plugin.gradle" +cargokit { + manifestDir = "../../rust" + libname = "rust_lib_aria" +} diff --git a/rust_builder/android/settings.gradle b/rust_builder/android/settings.gradle new file mode 100644 index 00000000..b777baa5 --- /dev/null +++ b/rust_builder/android/settings.gradle @@ -0,0 +1 @@ +rootProject.name = 'rust_lib_aria' diff --git a/rust_builder/android/src/main/AndroidManifest.xml b/rust_builder/android/src/main/AndroidManifest.xml new file mode 100644 index 00000000..34a85bdb --- /dev/null +++ b/rust_builder/android/src/main/AndroidManifest.xml @@ -0,0 +1,3 @@ + + diff --git a/rust_builder/cargokit/.gitignore b/rust_builder/cargokit/.gitignore new file mode 100644 index 00000000..cf7bb868 --- /dev/null +++ b/rust_builder/cargokit/.gitignore @@ -0,0 +1,4 @@ +target +.dart_tool +*.iml +!pubspec.lock diff --git a/rust_builder/cargokit/LICENSE b/rust_builder/cargokit/LICENSE new file mode 100644 index 00000000..d33a5fea --- /dev/null +++ b/rust_builder/cargokit/LICENSE @@ -0,0 +1,42 @@ +/// This is copied from Cargokit (which is the official way to use it currently) +/// Details: https://fzyzcjy.github.io/flutter_rust_bridge/manual/integrate/builtin + +Copyright 2022 Matej Knopp + +================================================================================ + +MIT LICENSE + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS +OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +================================================================================ + +APACHE LICENSE, VERSION 2.0 + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + diff --git a/rust_builder/cargokit/README b/rust_builder/cargokit/README new file mode 100644 index 00000000..398474db --- /dev/null +++ b/rust_builder/cargokit/README @@ -0,0 +1,11 @@ +/// This is copied from Cargokit (which is the official way to use it currently) +/// Details: https://fzyzcjy.github.io/flutter_rust_bridge/manual/integrate/builtin + +Experimental repository to provide glue for seamlessly integrating cargo build +with flutter plugins and packages. + +See https://matejknopp.com/post/flutter_plugin_in_rust_with_no_prebuilt_binaries/ +for a tutorial on how to use Cargokit. + +Example plugin available at https://github.com/irondash/hello_rust_ffi_plugin. + diff --git a/rust_builder/cargokit/build_pod.sh b/rust_builder/cargokit/build_pod.sh new file mode 100644 index 00000000..ed0e0d98 --- /dev/null +++ b/rust_builder/cargokit/build_pod.sh @@ -0,0 +1,58 @@ +#!/bin/sh +set -e + +BASEDIR=$(dirname "$0") + +# Workaround for https://github.com/dart-lang/pub/issues/4010 +BASEDIR=$(cd "$BASEDIR" ; pwd -P) + +# Remove XCode SDK from path. Otherwise this breaks tool compilation when building iOS project +NEW_PATH=`echo $PATH | tr ":" "\n" | grep -v "Contents/Developer/" | tr "\n" ":"` + +export PATH=${NEW_PATH%?} # remove trailing : + +env + +# Platform name (macosx, iphoneos, iphonesimulator) +export CARGOKIT_DARWIN_PLATFORM_NAME=$PLATFORM_NAME + +# Arctive architectures (arm64, armv7, x86_64), space separated. +export CARGOKIT_DARWIN_ARCHS=$ARCHS + +# Current build configuration (Debug, Release) +export CARGOKIT_CONFIGURATION=$CONFIGURATION + +# Path to directory containing Cargo.toml. +export CARGOKIT_MANIFEST_DIR=$PODS_TARGET_SRCROOT/$1 + +# Temporary directory for build artifacts. +export CARGOKIT_TARGET_TEMP_DIR=$TARGET_TEMP_DIR + +# Output directory for final artifacts. +export CARGOKIT_OUTPUT_DIR=$PODS_CONFIGURATION_BUILD_DIR/$PRODUCT_NAME + +# Directory to store built tool artifacts. +export CARGOKIT_TOOL_TEMP_DIR=$TARGET_TEMP_DIR/build_tool + +# Directory inside root project. Not necessarily the top level directory of root project. +export CARGOKIT_ROOT_PROJECT_DIR=$SRCROOT + +FLUTTER_EXPORT_BUILD_ENVIRONMENT=( + "$PODS_ROOT/../Flutter/ephemeral/flutter_export_environment.sh" # macOS + "$PODS_ROOT/../Flutter/flutter_export_environment.sh" # iOS +) + +for path in "${FLUTTER_EXPORT_BUILD_ENVIRONMENT[@]}" +do + if [[ -f "$path" ]]; then + source "$path" + fi +done + +sh "$BASEDIR/run_build_tool.sh" build-pod "$@" + +# Make a symlink from built framework to phony file, which will be used as input to +# build script. This should force rebuild (podspec currently doesn't support alwaysOutOfDate +# attribute on custom build phase) +ln -fs "$OBJROOT/XCBuildData/build.db" "${BUILT_PRODUCTS_DIR}/cargokit_phony" +ln -fs "${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}" "${BUILT_PRODUCTS_DIR}/cargokit_phony_out" diff --git a/rust_builder/cargokit/build_tool/README.md b/rust_builder/cargokit/build_tool/README.md new file mode 100644 index 00000000..a878c279 --- /dev/null +++ b/rust_builder/cargokit/build_tool/README.md @@ -0,0 +1,5 @@ +/// This is copied from Cargokit (which is the official way to use it currently) +/// Details: https://fzyzcjy.github.io/flutter_rust_bridge/manual/integrate/builtin + +A sample command-line application with an entrypoint in `bin/`, library code +in `lib/`, and example unit test in `test/`. diff --git a/rust_builder/cargokit/build_tool/analysis_options.yaml b/rust_builder/cargokit/build_tool/analysis_options.yaml new file mode 100644 index 00000000..0e16a8b0 --- /dev/null +++ b/rust_builder/cargokit/build_tool/analysis_options.yaml @@ -0,0 +1,34 @@ +# This is copied from Cargokit (which is the official way to use it currently) +# Details: https://fzyzcjy.github.io/flutter_rust_bridge/manual/integrate/builtin + +# This file configures the static analysis results for your project (errors, +# warnings, and lints). +# +# This enables the 'recommended' set of lints from `package:lints`. +# This set helps identify many issues that may lead to problems when running +# or consuming Dart code, and enforces writing Dart using a single, idiomatic +# style and format. +# +# If you want a smaller set of lints you can change this to specify +# 'package:lints/core.yaml'. These are just the most critical lints +# (the recommended set includes the core lints). +# The core lints are also what is used by pub.dev for scoring packages. + +include: package:lints/recommended.yaml + +# Uncomment the following section to specify additional rules. + +linter: + rules: + - prefer_relative_imports + - directives_ordering + +# analyzer: +# exclude: +# - path/to/excluded/files/** + +# For more information about the core and recommended set of lints, see +# https://dart.dev/go/core-lints + +# For additional information about configuring this file, see +# https://dart.dev/guides/language/analysis-options diff --git a/rust_builder/cargokit/build_tool/bin/build_tool.dart b/rust_builder/cargokit/build_tool/bin/build_tool.dart new file mode 100644 index 00000000..268eb524 --- /dev/null +++ b/rust_builder/cargokit/build_tool/bin/build_tool.dart @@ -0,0 +1,8 @@ +/// This is copied from Cargokit (which is the official way to use it currently) +/// Details: https://fzyzcjy.github.io/flutter_rust_bridge/manual/integrate/builtin + +import 'package:build_tool/build_tool.dart' as build_tool; + +void main(List arguments) { + build_tool.runMain(arguments); +} diff --git a/rust_builder/cargokit/build_tool/lib/build_tool.dart b/rust_builder/cargokit/build_tool/lib/build_tool.dart new file mode 100644 index 00000000..7c1bb750 --- /dev/null +++ b/rust_builder/cargokit/build_tool/lib/build_tool.dart @@ -0,0 +1,8 @@ +/// This is copied from Cargokit (which is the official way to use it currently) +/// Details: https://fzyzcjy.github.io/flutter_rust_bridge/manual/integrate/builtin + +import 'src/build_tool.dart' as build_tool; + +Future runMain(List args) async { + return build_tool.runMain(args); +} diff --git a/rust_builder/cargokit/build_tool/lib/src/android_environment.dart b/rust_builder/cargokit/build_tool/lib/src/android_environment.dart new file mode 100644 index 00000000..15fc9eed --- /dev/null +++ b/rust_builder/cargokit/build_tool/lib/src/android_environment.dart @@ -0,0 +1,195 @@ +/// This is copied from Cargokit (which is the official way to use it currently) +/// Details: https://fzyzcjy.github.io/flutter_rust_bridge/manual/integrate/builtin + +import 'dart:io'; +import 'dart:isolate'; +import 'dart:math' as math; + +import 'package:collection/collection.dart'; +import 'package:path/path.dart' as path; +import 'package:version/version.dart'; + +import 'target.dart'; +import 'util.dart'; + +class AndroidEnvironment { + AndroidEnvironment({ + required this.sdkPath, + required this.ndkVersion, + required this.minSdkVersion, + required this.targetTempDir, + required this.target, + }); + + static void clangLinkerWrapper(List args) { + final clang = Platform.environment['_CARGOKIT_NDK_LINK_CLANG']; + if (clang == null) { + throw Exception( + "cargo-ndk rustc linker: didn't find _CARGOKIT_NDK_LINK_CLANG env var"); + } + final target = Platform.environment['_CARGOKIT_NDK_LINK_TARGET']; + if (target == null) { + throw Exception( + "cargo-ndk rustc linker: didn't find _CARGOKIT_NDK_LINK_TARGET env var"); + } + + runCommand(clang, [ + target, + ...args, + ]); + } + + /// Full path to Android SDK. + final String sdkPath; + + /// Full version of Android NDK. + final String ndkVersion; + + /// Minimum supported SDK version. + final int minSdkVersion; + + /// Target directory for build artifacts. + final String targetTempDir; + + /// Target being built. + final Target target; + + bool ndkIsInstalled() { + final ndkPath = path.join(sdkPath, 'ndk', ndkVersion); + final ndkPackageXml = File(path.join(ndkPath, 'package.xml')); + return ndkPackageXml.existsSync(); + } + + void installNdk({ + required String javaHome, + }) { + final sdkManagerExtension = Platform.isWindows ? '.bat' : ''; + final sdkManager = path.join( + sdkPath, + 'cmdline-tools', + 'latest', + 'bin', + 'sdkmanager$sdkManagerExtension', + ); + + log.info('Installing NDK $ndkVersion'); + runCommand(sdkManager, [ + '--install', + 'ndk;$ndkVersion', + ], environment: { + 'JAVA_HOME': javaHome, + }); + } + + Future> buildEnvironment() async { + final hostArch = Platform.isMacOS + ? "darwin-x86_64" + : (Platform.isLinux ? "linux-x86_64" : "windows-x86_64"); + + final ndkPath = path.join(sdkPath, 'ndk', ndkVersion); + final toolchainPath = path.join( + ndkPath, + 'toolchains', + 'llvm', + 'prebuilt', + hostArch, + 'bin', + ); + + final minSdkVersion = + math.max(target.androidMinSdkVersion!, this.minSdkVersion); + + final exe = Platform.isWindows ? '.exe' : ''; + + final arKey = 'AR_${target.rust}'; + final arValue = ['${target.rust}-ar', 'llvm-ar', 'llvm-ar.exe'] + .map((e) => path.join(toolchainPath, e)) + .firstWhereOrNull((element) => File(element).existsSync()); + if (arValue == null) { + throw Exception('Failed to find ar for $target in $toolchainPath'); + } + + final targetArg = '--target=${target.rust}$minSdkVersion'; + + final ccKey = 'CC_${target.rust}'; + final ccValue = path.join(toolchainPath, 'clang$exe'); + final cfFlagsKey = 'CFLAGS_${target.rust}'; + final cFlagsValue = targetArg; + + final cxxKey = 'CXX_${target.rust}'; + final cxxValue = path.join(toolchainPath, 'clang++$exe'); + final cxxFlagsKey = 'CXXFLAGS_${target.rust}'; + final cxxFlagsValue = targetArg; + + final linkerKey = + 'cargo_target_${target.rust.replaceAll('-', '_')}_linker'.toUpperCase(); + + final ranlibKey = 'RANLIB_${target.rust}'; + final ranlibValue = path.join(toolchainPath, 'llvm-ranlib$exe'); + + final ndkVersionParsed = Version.parse(ndkVersion); + final rustFlagsKey = 'CARGO_ENCODED_RUSTFLAGS'; + final rustFlagsValue = _libGccWorkaround(targetTempDir, ndkVersionParsed); + + final runRustTool = + Platform.isWindows ? 'run_build_tool.cmd' : 'run_build_tool.sh'; + + final packagePath = (await Isolate.resolvePackageUri( + Uri.parse('package:build_tool/buildtool.dart')))! + .toFilePath(); + final selfPath = path.canonicalize(path.join( + packagePath, + '..', + '..', + '..', + runRustTool, + )); + + // Make sure that run_build_tool is working properly even initially launched directly + // through dart run. + final toolTempDir = + Platform.environment['CARGOKIT_TOOL_TEMP_DIR'] ?? targetTempDir; + + return { + arKey: arValue, + ccKey: ccValue, + cfFlagsKey: cFlagsValue, + cxxKey: cxxValue, + cxxFlagsKey: cxxFlagsValue, + ranlibKey: ranlibValue, + rustFlagsKey: rustFlagsValue, + linkerKey: selfPath, + // Recognized by main() so we know when we're acting as a wrapper + '_CARGOKIT_NDK_LINK_TARGET': targetArg, + '_CARGOKIT_NDK_LINK_CLANG': ccValue, + 'CARGOKIT_TOOL_TEMP_DIR': toolTempDir, + }; + } + + // Workaround for libgcc missing in NDK23, inspired by cargo-ndk + String _libGccWorkaround(String buildDir, Version ndkVersion) { + final workaroundDir = path.join( + buildDir, + 'cargokit', + 'libgcc_workaround', + '${ndkVersion.major}', + ); + Directory(workaroundDir).createSync(recursive: true); + if (ndkVersion.major >= 23) { + File(path.join(workaroundDir, 'libgcc.a')) + .writeAsStringSync('INPUT(-lunwind)'); + } else { + // Other way around, untested, forward libgcc.a from libunwind once Rust + // gets updated for NDK23+. + File(path.join(workaroundDir, 'libunwind.a')) + .writeAsStringSync('INPUT(-lgcc)'); + } + + var rustFlags = Platform.environment['CARGO_ENCODED_RUSTFLAGS'] ?? ''; + if (rustFlags.isNotEmpty) { + rustFlags = '$rustFlags\x1f'; + } + rustFlags = '$rustFlags-L\x1f$workaroundDir'; + return rustFlags; + } +} diff --git a/rust_builder/cargokit/build_tool/lib/src/artifacts_provider.dart b/rust_builder/cargokit/build_tool/lib/src/artifacts_provider.dart new file mode 100644 index 00000000..e608cece --- /dev/null +++ b/rust_builder/cargokit/build_tool/lib/src/artifacts_provider.dart @@ -0,0 +1,266 @@ +/// This is copied from Cargokit (which is the official way to use it currently) +/// Details: https://fzyzcjy.github.io/flutter_rust_bridge/manual/integrate/builtin + +import 'dart:io'; + +import 'package:ed25519_edwards/ed25519_edwards.dart'; +import 'package:http/http.dart'; +import 'package:logging/logging.dart'; +import 'package:path/path.dart' as path; + +import 'builder.dart'; +import 'crate_hash.dart'; +import 'options.dart'; +import 'precompile_binaries.dart'; +import 'rustup.dart'; +import 'target.dart'; + +class Artifact { + /// File system location of the artifact. + final String path; + + /// Actual file name that the artifact should have in destination folder. + final String finalFileName; + + AritifactType get type { + if (finalFileName.endsWith('.dll') || + finalFileName.endsWith('.dll.lib') || + finalFileName.endsWith('.pdb') || + finalFileName.endsWith('.so') || + finalFileName.endsWith('.dylib')) { + return AritifactType.dylib; + } else if (finalFileName.endsWith('.lib') || finalFileName.endsWith('.a')) { + return AritifactType.staticlib; + } else { + throw Exception('Unknown artifact type for $finalFileName'); + } + } + + Artifact({ + required this.path, + required this.finalFileName, + }); +} + +final _log = Logger('artifacts_provider'); + +class ArtifactProvider { + ArtifactProvider({ + required this.environment, + required this.userOptions, + }); + + final BuildEnvironment environment; + final CargokitUserOptions userOptions; + + Future>> getArtifacts(List targets) async { + final result = await _getPrecompiledArtifacts(targets); + + final pendingTargets = List.of(targets); + pendingTargets.removeWhere((element) => result.containsKey(element)); + + if (pendingTargets.isEmpty) { + return result; + } + + final rustup = Rustup(); + for (final target in targets) { + final builder = RustBuilder(target: target, environment: environment); + builder.prepare(rustup); + _log.info('Building ${environment.crateInfo.packageName} for $target'); + final targetDir = await builder.build(); + // For local build accept both static and dynamic libraries. + final artifactNames = { + ...getArtifactNames( + target: target, + libraryName: environment.crateInfo.packageName, + aritifactType: AritifactType.dylib, + remote: false, + ), + ...getArtifactNames( + target: target, + libraryName: environment.crateInfo.packageName, + aritifactType: AritifactType.staticlib, + remote: false, + ) + }; + final artifacts = artifactNames + .map((artifactName) => Artifact( + path: path.join(targetDir, artifactName), + finalFileName: artifactName, + )) + .where((element) => File(element.path).existsSync()) + .toList(); + result[target] = artifacts; + } + return result; + } + + Future>> _getPrecompiledArtifacts( + List targets) async { + if (userOptions.usePrecompiledBinaries == false) { + _log.info('Precompiled binaries are disabled'); + return {}; + } + if (environment.crateOptions.precompiledBinaries == null) { + _log.fine('Precompiled binaries not enabled for this crate'); + return {}; + } + + final start = Stopwatch()..start(); + final crateHash = CrateHash.compute(environment.manifestDir, + tempStorage: environment.targetTempDir); + _log.fine( + 'Computed crate hash $crateHash in ${start.elapsedMilliseconds}ms'); + + final downloadedArtifactsDir = + path.join(environment.targetTempDir, 'precompiled', crateHash); + Directory(downloadedArtifactsDir).createSync(recursive: true); + + final res = >{}; + + for (final target in targets) { + final requiredArtifacts = getArtifactNames( + target: target, + libraryName: environment.crateInfo.packageName, + remote: true, + ); + final artifactsForTarget = []; + + for (final artifact in requiredArtifacts) { + final fileName = PrecompileBinaries.fileName(target, artifact); + final downloadedPath = path.join(downloadedArtifactsDir, fileName); + if (!File(downloadedPath).existsSync()) { + final signatureFileName = + PrecompileBinaries.signatureFileName(target, artifact); + await _tryDownloadArtifacts( + crateHash: crateHash, + fileName: fileName, + signatureFileName: signatureFileName, + finalPath: downloadedPath, + ); + } + if (File(downloadedPath).existsSync()) { + artifactsForTarget.add(Artifact( + path: downloadedPath, + finalFileName: artifact, + )); + } else { + break; + } + } + + // Only provide complete set of artifacts. + if (artifactsForTarget.length == requiredArtifacts.length) { + _log.fine('Found precompiled artifacts for $target'); + res[target] = artifactsForTarget; + } + } + + return res; + } + + static Future _get(Uri url, {Map? headers}) async { + int attempt = 0; + const maxAttempts = 10; + while (true) { + try { + return await get(url, headers: headers); + } on SocketException catch (e) { + // Try to detect reset by peer error and retry. + if (attempt++ < maxAttempts && + (e.osError?.errorCode == 54 || e.osError?.errorCode == 10054)) { + _log.severe( + 'Failed to download $url: $e, attempt $attempt of $maxAttempts, will retry...'); + await Future.delayed(Duration(seconds: 1)); + continue; + } else { + rethrow; + } + } + } + } + + Future _tryDownloadArtifacts({ + required String crateHash, + required String fileName, + required String signatureFileName, + required String finalPath, + }) async { + final precompiledBinaries = environment.crateOptions.precompiledBinaries!; + final prefix = precompiledBinaries.uriPrefix; + final url = Uri.parse('$prefix$crateHash/$fileName'); + final signatureUrl = Uri.parse('$prefix$crateHash/$signatureFileName'); + _log.fine('Downloading signature from $signatureUrl'); + final signature = await _get(signatureUrl); + if (signature.statusCode == 404) { + _log.warning( + 'Precompiled binaries not available for crate hash $crateHash ($fileName)'); + return; + } + if (signature.statusCode != 200) { + _log.severe( + 'Failed to download signature $signatureUrl: status ${signature.statusCode}'); + return; + } + _log.fine('Downloading binary from $url'); + final res = await _get(url); + if (res.statusCode != 200) { + _log.severe('Failed to download binary $url: status ${res.statusCode}'); + return; + } + if (verify( + precompiledBinaries.publicKey, res.bodyBytes, signature.bodyBytes)) { + File(finalPath).writeAsBytesSync(res.bodyBytes); + } else { + _log.shout('Signature verification failed! Ignoring binary.'); + } + } +} + +enum AritifactType { + staticlib, + dylib, +} + +AritifactType artifactTypeForTarget(Target target) { + if (target.darwinPlatform != null) { + return AritifactType.staticlib; + } else { + return AritifactType.dylib; + } +} + +List getArtifactNames({ + required Target target, + required String libraryName, + required bool remote, + AritifactType? aritifactType, +}) { + aritifactType ??= artifactTypeForTarget(target); + if (target.darwinArch != null) { + if (aritifactType == AritifactType.staticlib) { + return ['lib$libraryName.a']; + } else { + return ['lib$libraryName.dylib']; + } + } else if (target.rust.contains('-windows-')) { + if (aritifactType == AritifactType.staticlib) { + return ['$libraryName.lib']; + } else { + return [ + '$libraryName.dll', + '$libraryName.dll.lib', + if (!remote) '$libraryName.pdb' + ]; + } + } else if (target.rust.contains('-linux-')) { + if (aritifactType == AritifactType.staticlib) { + return ['lib$libraryName.a']; + } else { + return ['lib$libraryName.so']; + } + } else { + throw Exception("Unsupported target: ${target.rust}"); + } +} diff --git a/rust_builder/cargokit/build_tool/lib/src/build_cmake.dart b/rust_builder/cargokit/build_tool/lib/src/build_cmake.dart new file mode 100644 index 00000000..6f3b2a4e --- /dev/null +++ b/rust_builder/cargokit/build_tool/lib/src/build_cmake.dart @@ -0,0 +1,40 @@ +/// This is copied from Cargokit (which is the official way to use it currently) +/// Details: https://fzyzcjy.github.io/flutter_rust_bridge/manual/integrate/builtin + +import 'dart:io'; + +import 'package:path/path.dart' as path; + +import 'artifacts_provider.dart'; +import 'builder.dart'; +import 'environment.dart'; +import 'options.dart'; +import 'target.dart'; + +class BuildCMake { + final CargokitUserOptions userOptions; + + BuildCMake({required this.userOptions}); + + Future build() async { + final targetPlatform = Environment.targetPlatform; + final target = Target.forFlutterName(Environment.targetPlatform); + if (target == null) { + throw Exception("Unknown target platform: $targetPlatform"); + } + + final environment = BuildEnvironment.fromEnvironment(isAndroid: false); + final provider = + ArtifactProvider(environment: environment, userOptions: userOptions); + final artifacts = await provider.getArtifacts([target]); + + final libs = artifacts[target]!; + + for (final lib in libs) { + if (lib.type == AritifactType.dylib) { + File(lib.path) + .copySync(path.join(Environment.outputDir, lib.finalFileName)); + } + } + } +} diff --git a/rust_builder/cargokit/build_tool/lib/src/build_gradle.dart b/rust_builder/cargokit/build_tool/lib/src/build_gradle.dart new file mode 100644 index 00000000..7e61fcbb --- /dev/null +++ b/rust_builder/cargokit/build_tool/lib/src/build_gradle.dart @@ -0,0 +1,49 @@ +/// This is copied from Cargokit (which is the official way to use it currently) +/// Details: https://fzyzcjy.github.io/flutter_rust_bridge/manual/integrate/builtin + +import 'dart:io'; + +import 'package:logging/logging.dart'; +import 'package:path/path.dart' as path; + +import 'artifacts_provider.dart'; +import 'builder.dart'; +import 'environment.dart'; +import 'options.dart'; +import 'target.dart'; + +final log = Logger('build_gradle'); + +class BuildGradle { + BuildGradle({required this.userOptions}); + + final CargokitUserOptions userOptions; + + Future build() async { + final targets = Environment.targetPlatforms.map((arch) { + final target = Target.forFlutterName(arch); + if (target == null) { + throw Exception( + "Unknown darwin target or platform: $arch, ${Environment.darwinPlatformName}"); + } + return target; + }).toList(); + + final environment = BuildEnvironment.fromEnvironment(isAndroid: true); + final provider = + ArtifactProvider(environment: environment, userOptions: userOptions); + final artifacts = await provider.getArtifacts(targets); + + for (final target in targets) { + final libs = artifacts[target]!; + final outputDir = path.join(Environment.outputDir, target.android!); + Directory(outputDir).createSync(recursive: true); + + for (final lib in libs) { + if (lib.type == AritifactType.dylib) { + File(lib.path).copySync(path.join(outputDir, lib.finalFileName)); + } + } + } + } +} diff --git a/rust_builder/cargokit/build_tool/lib/src/build_pod.dart b/rust_builder/cargokit/build_tool/lib/src/build_pod.dart new file mode 100644 index 00000000..8a9c0db5 --- /dev/null +++ b/rust_builder/cargokit/build_tool/lib/src/build_pod.dart @@ -0,0 +1,89 @@ +/// This is copied from Cargokit (which is the official way to use it currently) +/// Details: https://fzyzcjy.github.io/flutter_rust_bridge/manual/integrate/builtin + +import 'dart:io'; + +import 'package:path/path.dart' as path; + +import 'artifacts_provider.dart'; +import 'builder.dart'; +import 'environment.dart'; +import 'options.dart'; +import 'target.dart'; +import 'util.dart'; + +class BuildPod { + BuildPod({required this.userOptions}); + + final CargokitUserOptions userOptions; + + Future build() async { + final targets = Environment.darwinArchs.map((arch) { + final target = Target.forDarwin( + platformName: Environment.darwinPlatformName, darwinAarch: arch); + if (target == null) { + throw Exception( + "Unknown darwin target or platform: $arch, ${Environment.darwinPlatformName}"); + } + return target; + }).toList(); + + final environment = BuildEnvironment.fromEnvironment(isAndroid: false); + final provider = + ArtifactProvider(environment: environment, userOptions: userOptions); + final artifacts = await provider.getArtifacts(targets); + + void performLipo(String targetFile, Iterable sourceFiles) { + runCommand("lipo", [ + '-create', + ...sourceFiles, + '-output', + targetFile, + ]); + } + + final outputDir = Environment.outputDir; + + Directory(outputDir).createSync(recursive: true); + + final staticLibs = artifacts.values + .expand((element) => element) + .where((element) => element.type == AritifactType.staticlib) + .toList(); + final dynamicLibs = artifacts.values + .expand((element) => element) + .where((element) => element.type == AritifactType.dylib) + .toList(); + + final libName = environment.crateInfo.packageName; + + // If there is static lib, use it and link it with pod + if (staticLibs.isNotEmpty) { + final finalTargetFile = path.join(outputDir, "lib$libName.a"); + performLipo(finalTargetFile, staticLibs.map((e) => e.path)); + } else { + // Otherwise try to replace bundle dylib with our dylib + final bundlePaths = [ + '$libName.framework/Versions/A/$libName', + '$libName.framework/$libName', + ]; + + for (final bundlePath in bundlePaths) { + final targetFile = path.join(outputDir, bundlePath); + if (File(targetFile).existsSync()) { + performLipo(targetFile, dynamicLibs.map((e) => e.path)); + + // Replace absolute id with @rpath one so that it works properly + // when moved to Frameworks. + runCommand("install_name_tool", [ + '-id', + '@rpath/$bundlePath', + targetFile, + ]); + return; + } + } + throw Exception('Unable to find bundle for dynamic library'); + } + } +} diff --git a/rust_builder/cargokit/build_tool/lib/src/build_tool.dart b/rust_builder/cargokit/build_tool/lib/src/build_tool.dart new file mode 100644 index 00000000..c8f36981 --- /dev/null +++ b/rust_builder/cargokit/build_tool/lib/src/build_tool.dart @@ -0,0 +1,271 @@ +/// This is copied from Cargokit (which is the official way to use it currently) +/// Details: https://fzyzcjy.github.io/flutter_rust_bridge/manual/integrate/builtin + +import 'dart:io'; + +import 'package:args/command_runner.dart'; +import 'package:ed25519_edwards/ed25519_edwards.dart'; +import 'package:github/github.dart'; +import 'package:hex/hex.dart'; +import 'package:logging/logging.dart'; + +import 'android_environment.dart'; +import 'build_cmake.dart'; +import 'build_gradle.dart'; +import 'build_pod.dart'; +import 'logging.dart'; +import 'options.dart'; +import 'precompile_binaries.dart'; +import 'target.dart'; +import 'util.dart'; +import 'verify_binaries.dart'; + +final log = Logger('build_tool'); + +abstract class BuildCommand extends Command { + Future runBuildCommand(CargokitUserOptions options); + + @override + Future run() async { + final options = CargokitUserOptions.load(); + + if (options.verboseLogging || + Platform.environment['CARGOKIT_VERBOSE'] == '1') { + enableVerboseLogging(); + } + + await runBuildCommand(options); + } +} + +class BuildPodCommand extends BuildCommand { + @override + final name = 'build-pod'; + + @override + final description = 'Build cocoa pod library'; + + @override + Future runBuildCommand(CargokitUserOptions options) async { + final build = BuildPod(userOptions: options); + await build.build(); + } +} + +class BuildGradleCommand extends BuildCommand { + @override + final name = 'build-gradle'; + + @override + final description = 'Build android library'; + + @override + Future runBuildCommand(CargokitUserOptions options) async { + final build = BuildGradle(userOptions: options); + await build.build(); + } +} + +class BuildCMakeCommand extends BuildCommand { + @override + final name = 'build-cmake'; + + @override + final description = 'Build CMake library'; + + @override + Future runBuildCommand(CargokitUserOptions options) async { + final build = BuildCMake(userOptions: options); + await build.build(); + } +} + +class GenKeyCommand extends Command { + @override + final name = 'gen-key'; + + @override + final description = 'Generate key pair for signing precompiled binaries'; + + @override + void run() { + final kp = generateKey(); + final private = HEX.encode(kp.privateKey.bytes); + final public = HEX.encode(kp.publicKey.bytes); + print("Private Key: $private"); + print("Public Key: $public"); + } +} + +class PrecompileBinariesCommand extends Command { + PrecompileBinariesCommand() { + argParser + ..addOption( + 'repository', + mandatory: true, + help: 'Github repository slug in format owner/name', + ) + ..addOption( + 'manifest-dir', + mandatory: true, + help: 'Directory containing Cargo.toml', + ) + ..addMultiOption('target', + help: 'Rust target triple of artifact to build.\n' + 'Can be specified multiple times or omitted in which case\n' + 'all targets for current platform will be built.') + ..addOption( + 'android-sdk-location', + help: 'Location of Android SDK (if available)', + ) + ..addOption( + 'android-ndk-version', + help: 'Android NDK version (if available)', + ) + ..addOption( + 'android-min-sdk-version', + help: 'Android minimum rquired version (if available)', + ) + ..addOption( + 'temp-dir', + help: 'Directory to store temporary build artifacts', + ) + ..addFlag( + "verbose", + abbr: "v", + defaultsTo: false, + help: "Enable verbose logging", + ); + } + + @override + final name = 'precompile-binaries'; + + @override + final description = 'Prebuild and upload binaries\n' + 'Private key must be passed through PRIVATE_KEY environment variable. ' + 'Use gen_key through generate priave key.\n' + 'Github token must be passed as GITHUB_TOKEN environment variable.\n'; + + @override + Future run() async { + final verbose = argResults!['verbose'] as bool; + if (verbose) { + enableVerboseLogging(); + } + + final privateKeyString = Platform.environment['PRIVATE_KEY']; + if (privateKeyString == null) { + throw ArgumentError('Missing PRIVATE_KEY environment variable'); + } + final githubToken = Platform.environment['GITHUB_TOKEN']; + if (githubToken == null) { + throw ArgumentError('Missing GITHUB_TOKEN environment variable'); + } + final privateKey = HEX.decode(privateKeyString); + if (privateKey.length != 64) { + throw ArgumentError('Private key must be 64 bytes long'); + } + final manifestDir = argResults!['manifest-dir'] as String; + if (!Directory(manifestDir).existsSync()) { + throw ArgumentError('Manifest directory does not exist: $manifestDir'); + } + String? androidMinSdkVersionString = + argResults!['android-min-sdk-version'] as String?; + int? androidMinSdkVersion; + if (androidMinSdkVersionString != null) { + androidMinSdkVersion = int.tryParse(androidMinSdkVersionString); + if (androidMinSdkVersion == null) { + throw ArgumentError( + 'Invalid android-min-sdk-version: $androidMinSdkVersionString'); + } + } + final targetStrigns = argResults!['target'] as List; + final targets = targetStrigns.map((target) { + final res = Target.forRustTriple(target); + if (res == null) { + throw ArgumentError('Invalid target: $target'); + } + return res; + }).toList(growable: false); + final precompileBinaries = PrecompileBinaries( + privateKey: PrivateKey(privateKey), + githubToken: githubToken, + manifestDir: manifestDir, + repositorySlug: RepositorySlug.full(argResults!['repository'] as String), + targets: targets, + androidSdkLocation: argResults!['android-sdk-location'] as String?, + androidNdkVersion: argResults!['android-ndk-version'] as String?, + androidMinSdkVersion: androidMinSdkVersion, + tempDir: argResults!['temp-dir'] as String?, + ); + + await precompileBinaries.run(); + } +} + +class VerifyBinariesCommand extends Command { + VerifyBinariesCommand() { + argParser.addOption( + 'manifest-dir', + mandatory: true, + help: 'Directory containing Cargo.toml', + ); + } + + @override + final name = "verify-binaries"; + + @override + final description = 'Verifies published binaries\n' + 'Checks whether there is a binary published for each targets\n' + 'and checks the signature.'; + + @override + Future run() async { + final manifestDir = argResults!['manifest-dir'] as String; + final verifyBinaries = VerifyBinaries( + manifestDir: manifestDir, + ); + await verifyBinaries.run(); + } +} + +Future runMain(List args) async { + try { + // Init logging before options are loaded + initLogging(); + + if (Platform.environment['_CARGOKIT_NDK_LINK_TARGET'] != null) { + return AndroidEnvironment.clangLinkerWrapper(args); + } + + final runner = CommandRunner('build_tool', 'Cargokit built_tool') + ..addCommand(BuildPodCommand()) + ..addCommand(BuildGradleCommand()) + ..addCommand(BuildCMakeCommand()) + ..addCommand(GenKeyCommand()) + ..addCommand(PrecompileBinariesCommand()) + ..addCommand(VerifyBinariesCommand()); + + await runner.run(args); + } on ArgumentError catch (e) { + stderr.writeln(e.toString()); + exit(1); + } catch (e, s) { + log.severe(kDoubleSeparator); + log.severe('Cargokit BuildTool failed with error:'); + log.severe(kSeparator); + log.severe(e); + // This tells user to install Rust, there's no need to pollute the log with + // stack trace. + if (e is! RustupNotFoundException) { + log.severe(kSeparator); + log.severe(s); + log.severe(kSeparator); + log.severe('BuildTool arguments: $args'); + } + log.severe(kDoubleSeparator); + exit(1); + } +} diff --git a/rust_builder/cargokit/build_tool/lib/src/builder.dart b/rust_builder/cargokit/build_tool/lib/src/builder.dart new file mode 100644 index 00000000..84c46e4f --- /dev/null +++ b/rust_builder/cargokit/build_tool/lib/src/builder.dart @@ -0,0 +1,198 @@ +/// This is copied from Cargokit (which is the official way to use it currently) +/// Details: https://fzyzcjy.github.io/flutter_rust_bridge/manual/integrate/builtin + +import 'package:collection/collection.dart'; +import 'package:logging/logging.dart'; +import 'package:path/path.dart' as path; + +import 'android_environment.dart'; +import 'cargo.dart'; +import 'environment.dart'; +import 'options.dart'; +import 'rustup.dart'; +import 'target.dart'; +import 'util.dart'; + +final _log = Logger('builder'); + +enum BuildConfiguration { + debug, + release, + profile, +} + +extension on BuildConfiguration { + bool get isDebug => this == BuildConfiguration.debug; + String get rustName => switch (this) { + BuildConfiguration.debug => 'debug', + BuildConfiguration.release => 'release', + BuildConfiguration.profile => 'release', + }; +} + +class BuildException implements Exception { + final String message; + + BuildException(this.message); + + @override + String toString() { + return 'BuildException: $message'; + } +} + +class BuildEnvironment { + final BuildConfiguration configuration; + final CargokitCrateOptions crateOptions; + final String targetTempDir; + final String manifestDir; + final CrateInfo crateInfo; + + final bool isAndroid; + final String? androidSdkPath; + final String? androidNdkVersion; + final int? androidMinSdkVersion; + final String? javaHome; + + BuildEnvironment({ + required this.configuration, + required this.crateOptions, + required this.targetTempDir, + required this.manifestDir, + required this.crateInfo, + required this.isAndroid, + this.androidSdkPath, + this.androidNdkVersion, + this.androidMinSdkVersion, + this.javaHome, + }); + + static BuildConfiguration parseBuildConfiguration(String value) { + // XCode configuration adds the flavor to configuration name. + final firstSegment = value.split('-').first; + final buildConfiguration = BuildConfiguration.values.firstWhereOrNull( + (e) => e.name == firstSegment, + ); + if (buildConfiguration == null) { + _log.warning('Unknown build configuraiton $value, will assume release'); + return BuildConfiguration.release; + } + return buildConfiguration; + } + + static BuildEnvironment fromEnvironment({ + required bool isAndroid, + }) { + final buildConfiguration = + parseBuildConfiguration(Environment.configuration); + final manifestDir = Environment.manifestDir; + final crateOptions = CargokitCrateOptions.load( + manifestDir: manifestDir, + ); + final crateInfo = CrateInfo.load(manifestDir); + return BuildEnvironment( + configuration: buildConfiguration, + crateOptions: crateOptions, + targetTempDir: Environment.targetTempDir, + manifestDir: manifestDir, + crateInfo: crateInfo, + isAndroid: isAndroid, + androidSdkPath: isAndroid ? Environment.sdkPath : null, + androidNdkVersion: isAndroid ? Environment.ndkVersion : null, + androidMinSdkVersion: + isAndroid ? int.parse(Environment.minSdkVersion) : null, + javaHome: isAndroid ? Environment.javaHome : null, + ); + } +} + +class RustBuilder { + final Target target; + final BuildEnvironment environment; + + RustBuilder({ + required this.target, + required this.environment, + }); + + void prepare( + Rustup rustup, + ) { + final toolchain = _toolchain; + if (rustup.installedTargets(toolchain) == null) { + rustup.installToolchain(toolchain); + } + if (toolchain == 'nightly') { + rustup.installRustSrcForNightly(); + } + if (!rustup.installedTargets(toolchain)!.contains(target.rust)) { + rustup.installTarget(target.rust, toolchain: toolchain); + } + } + + CargoBuildOptions? get _buildOptions => + environment.crateOptions.cargo[environment.configuration]; + + String get _toolchain => _buildOptions?.toolchain.name ?? 'stable'; + + /// Returns the path of directory containing build artifacts. + Future build() async { + final extraArgs = _buildOptions?.flags ?? []; + final manifestPath = path.join(environment.manifestDir, 'Cargo.toml'); + runCommand( + 'rustup', + [ + 'run', + _toolchain, + 'cargo', + 'build', + ...extraArgs, + '--manifest-path', + manifestPath, + '-p', + environment.crateInfo.packageName, + if (!environment.configuration.isDebug) '--release', + '--target', + target.rust, + '--target-dir', + environment.targetTempDir, + ], + environment: await _buildEnvironment(), + ); + return path.join( + environment.targetTempDir, + target.rust, + environment.configuration.rustName, + ); + } + + Future> _buildEnvironment() async { + if (target.android == null) { + return {}; + } else { + final sdkPath = environment.androidSdkPath; + final ndkVersion = environment.androidNdkVersion; + final minSdkVersion = environment.androidMinSdkVersion; + if (sdkPath == null) { + throw BuildException('androidSdkPath is not set'); + } + if (ndkVersion == null) { + throw BuildException('androidNdkVersion is not set'); + } + if (minSdkVersion == null) { + throw BuildException('androidMinSdkVersion is not set'); + } + final env = AndroidEnvironment( + sdkPath: sdkPath, + ndkVersion: ndkVersion, + minSdkVersion: minSdkVersion, + targetTempDir: environment.targetTempDir, + target: target, + ); + if (!env.ndkIsInstalled() && environment.javaHome != null) { + env.installNdk(javaHome: environment.javaHome!); + } + return env.buildEnvironment(); + } + } +} diff --git a/rust_builder/cargokit/build_tool/lib/src/cargo.dart b/rust_builder/cargokit/build_tool/lib/src/cargo.dart new file mode 100644 index 00000000..0d8958ff --- /dev/null +++ b/rust_builder/cargokit/build_tool/lib/src/cargo.dart @@ -0,0 +1,48 @@ +/// This is copied from Cargokit (which is the official way to use it currently) +/// Details: https://fzyzcjy.github.io/flutter_rust_bridge/manual/integrate/builtin + +import 'dart:io'; + +import 'package:path/path.dart' as path; +import 'package:toml/toml.dart'; + +class ManifestException { + ManifestException(this.message, {required this.fileName}); + + final String? fileName; + final String message; + + @override + String toString() { + if (fileName != null) { + return 'Failed to parse package manifest at $fileName: $message'; + } else { + return 'Failed to parse package manifest: $message'; + } + } +} + +class CrateInfo { + CrateInfo({required this.packageName}); + + final String packageName; + + static CrateInfo parseManifest(String manifest, {final String? fileName}) { + final toml = TomlDocument.parse(manifest); + final package = toml.toMap()['package']; + if (package == null) { + throw ManifestException('Missing package section', fileName: fileName); + } + final name = package['name']; + if (name == null) { + throw ManifestException('Missing package name', fileName: fileName); + } + return CrateInfo(packageName: name); + } + + static CrateInfo load(String manifestDir) { + final manifestFile = File(path.join(manifestDir, 'Cargo.toml')); + final manifest = manifestFile.readAsStringSync(); + return parseManifest(manifest, fileName: manifestFile.path); + } +} diff --git a/rust_builder/cargokit/build_tool/lib/src/crate_hash.dart b/rust_builder/cargokit/build_tool/lib/src/crate_hash.dart new file mode 100644 index 00000000..0c4d88d1 --- /dev/null +++ b/rust_builder/cargokit/build_tool/lib/src/crate_hash.dart @@ -0,0 +1,124 @@ +/// This is copied from Cargokit (which is the official way to use it currently) +/// Details: https://fzyzcjy.github.io/flutter_rust_bridge/manual/integrate/builtin + +import 'dart:convert'; +import 'dart:io'; +import 'dart:typed_data'; + +import 'package:collection/collection.dart'; +import 'package:convert/convert.dart'; +import 'package:crypto/crypto.dart'; +import 'package:path/path.dart' as path; + +class CrateHash { + /// Computes a hash uniquely identifying crate content. This takes into account + /// content all all .rs files inside the src directory, as well as Cargo.toml, + /// Cargo.lock, build.rs and cargokit.yaml. + /// + /// If [tempStorage] is provided, computed hash is stored in a file in that directory + /// and reused on subsequent calls if the crate content hasn't changed. + static String compute(String manifestDir, {String? tempStorage}) { + return CrateHash._( + manifestDir: manifestDir, + tempStorage: tempStorage, + )._compute(); + } + + CrateHash._({ + required this.manifestDir, + required this.tempStorage, + }); + + String _compute() { + final files = getFiles(); + final tempStorage = this.tempStorage; + if (tempStorage != null) { + final quickHash = _computeQuickHash(files); + final quickHashFolder = Directory(path.join(tempStorage, 'crate_hash')); + quickHashFolder.createSync(recursive: true); + final quickHashFile = File(path.join(quickHashFolder.path, quickHash)); + if (quickHashFile.existsSync()) { + return quickHashFile.readAsStringSync(); + } + final hash = _computeHash(files); + quickHashFile.writeAsStringSync(hash); + return hash; + } else { + return _computeHash(files); + } + } + + /// Computes a quick hash based on files stat (without reading contents). This + /// is used to cache the real hash, which is slower to compute since it involves + /// reading every single file. + String _computeQuickHash(List files) { + final output = AccumulatorSink(); + final input = sha256.startChunkedConversion(output); + + final data = ByteData(8); + for (final file in files) { + input.add(utf8.encode(file.path)); + final stat = file.statSync(); + data.setUint64(0, stat.size); + input.add(data.buffer.asUint8List()); + data.setUint64(0, stat.modified.millisecondsSinceEpoch); + input.add(data.buffer.asUint8List()); + } + + input.close(); + return base64Url.encode(output.events.single.bytes); + } + + String _computeHash(List files) { + final output = AccumulatorSink(); + final input = sha256.startChunkedConversion(output); + + void addTextFile(File file) { + // text Files are hashed by lines in case we're dealing with github checkout + // that auto-converts line endings. + final splitter = LineSplitter(); + if (file.existsSync()) { + final data = file.readAsStringSync(); + final lines = splitter.convert(data); + for (final line in lines) { + input.add(utf8.encode(line)); + } + } + } + + for (final file in files) { + addTextFile(file); + } + + input.close(); + final res = output.events.single; + + // Truncate to 128bits. + final hash = res.bytes.sublist(0, 16); + return hex.encode(hash); + } + + List getFiles() { + final src = Directory(path.join(manifestDir, 'src')); + final files = src + .listSync(recursive: true, followLinks: false) + .whereType() + .toList(); + files.sortBy((element) => element.path); + void addFile(String relative) { + final file = File(path.join(manifestDir, relative)); + if (file.existsSync()) { + files.add(file); + } + } + + addFile('Cargo.toml'); + addFile('Cargo.lock'); + addFile('build.rs'); + addFile('cargokit.yaml'); + return files; + } + + final String manifestDir; + final String? tempStorage; +} diff --git a/rust_builder/cargokit/build_tool/lib/src/environment.dart b/rust_builder/cargokit/build_tool/lib/src/environment.dart new file mode 100644 index 00000000..996483a1 --- /dev/null +++ b/rust_builder/cargokit/build_tool/lib/src/environment.dart @@ -0,0 +1,68 @@ +/// This is copied from Cargokit (which is the official way to use it currently) +/// Details: https://fzyzcjy.github.io/flutter_rust_bridge/manual/integrate/builtin + +import 'dart:io'; + +extension on String { + String resolveSymlink() => File(this).resolveSymbolicLinksSync(); +} + +class Environment { + /// Current build configuration (debug or release). + static String get configuration => + _getEnv("CARGOKIT_CONFIGURATION").toLowerCase(); + + static bool get isDebug => configuration == 'debug'; + static bool get isRelease => configuration == 'release'; + + /// Temporary directory where Rust build artifacts are placed. + static String get targetTempDir => _getEnv("CARGOKIT_TARGET_TEMP_DIR"); + + /// Final output directory where the build artifacts are placed. + static String get outputDir => _getEnvPath('CARGOKIT_OUTPUT_DIR'); + + /// Path to the crate manifest (containing Cargo.toml). + static String get manifestDir => _getEnvPath('CARGOKIT_MANIFEST_DIR'); + + /// Directory inside root project. Not necessarily root folder. Symlinks are + /// not resolved on purpose. + static String get rootProjectDir => _getEnv('CARGOKIT_ROOT_PROJECT_DIR'); + + // Pod + + /// Platform name (macosx, iphoneos, iphonesimulator). + static String get darwinPlatformName => + _getEnv("CARGOKIT_DARWIN_PLATFORM_NAME"); + + /// List of architectures to build for (arm64, armv7, x86_64). + static List get darwinArchs => + _getEnv("CARGOKIT_DARWIN_ARCHS").split(' '); + + // Gradle + static String get minSdkVersion => _getEnv("CARGOKIT_MIN_SDK_VERSION"); + static String get ndkVersion => _getEnv("CARGOKIT_NDK_VERSION"); + static String get sdkPath => _getEnvPath("CARGOKIT_SDK_DIR"); + static String get javaHome => _getEnvPath("CARGOKIT_JAVA_HOME"); + static List get targetPlatforms => + _getEnv("CARGOKIT_TARGET_PLATFORMS").split(','); + + // CMAKE + static String get targetPlatform => _getEnv("CARGOKIT_TARGET_PLATFORM"); + + static String _getEnv(String key) { + final res = Platform.environment[key]; + if (res == null) { + throw Exception("Missing environment variable $key"); + } + return res; + } + + static String _getEnvPath(String key) { + final res = _getEnv(key); + if (Directory(res).existsSync()) { + return res.resolveSymlink(); + } else { + return res; + } + } +} diff --git a/rust_builder/cargokit/build_tool/lib/src/logging.dart b/rust_builder/cargokit/build_tool/lib/src/logging.dart new file mode 100644 index 00000000..5edd4fd1 --- /dev/null +++ b/rust_builder/cargokit/build_tool/lib/src/logging.dart @@ -0,0 +1,52 @@ +/// This is copied from Cargokit (which is the official way to use it currently) +/// Details: https://fzyzcjy.github.io/flutter_rust_bridge/manual/integrate/builtin + +import 'dart:io'; + +import 'package:logging/logging.dart'; + +const String kSeparator = "--"; +const String kDoubleSeparator = "=="; + +bool _lastMessageWasSeparator = false; + +void _log(LogRecord rec) { + final prefix = '${rec.level.name}: '; + final out = rec.level == Level.SEVERE ? stderr : stdout; + if (rec.message == kSeparator) { + if (!_lastMessageWasSeparator) { + out.write(prefix); + out.writeln('-' * 80); + _lastMessageWasSeparator = true; + } + return; + } else if (rec.message == kDoubleSeparator) { + out.write(prefix); + out.writeln('=' * 80); + _lastMessageWasSeparator = true; + return; + } + out.write(prefix); + out.writeln(rec.message); + _lastMessageWasSeparator = false; +} + +void initLogging() { + Logger.root.level = Level.INFO; + Logger.root.onRecord.listen((LogRecord rec) { + final lines = rec.message.split('\n'); + for (final line in lines) { + if (line.isNotEmpty || lines.length == 1 || line != lines.last) { + _log(LogRecord( + rec.level, + line, + rec.loggerName, + )); + } + } + }); +} + +void enableVerboseLogging() { + Logger.root.level = Level.ALL; +} diff --git a/rust_builder/cargokit/build_tool/lib/src/options.dart b/rust_builder/cargokit/build_tool/lib/src/options.dart new file mode 100644 index 00000000..22aef1d3 --- /dev/null +++ b/rust_builder/cargokit/build_tool/lib/src/options.dart @@ -0,0 +1,309 @@ +/// This is copied from Cargokit (which is the official way to use it currently) +/// Details: https://fzyzcjy.github.io/flutter_rust_bridge/manual/integrate/builtin + +import 'dart:io'; + +import 'package:collection/collection.dart'; +import 'package:ed25519_edwards/ed25519_edwards.dart'; +import 'package:hex/hex.dart'; +import 'package:logging/logging.dart'; +import 'package:path/path.dart' as path; +import 'package:source_span/source_span.dart'; +import 'package:yaml/yaml.dart'; + +import 'builder.dart'; +import 'environment.dart'; +import 'rustup.dart'; + +final _log = Logger('options'); + +/// A class for exceptions that have source span information attached. +class SourceSpanException implements Exception { + // This is a getter so that subclasses can override it. + /// A message describing the exception. + String get message => _message; + final String _message; + + // This is a getter so that subclasses can override it. + /// The span associated with this exception. + /// + /// This may be `null` if the source location can't be determined. + SourceSpan? get span => _span; + final SourceSpan? _span; + + SourceSpanException(this._message, this._span); + + /// Returns a string representation of `this`. + /// + /// [color] may either be a [String], a [bool], or `null`. If it's a string, + /// it indicates an ANSI terminal color escape that should be used to + /// highlight the span's text. If it's `true`, it indicates that the text + /// should be highlighted using the default color. If it's `false` or `null`, + /// it indicates that the text shouldn't be highlighted. + @override + String toString({Object? color}) { + if (span == null) return message; + return 'Error on ${span!.message(message, color: color)}'; + } +} + +enum Toolchain { + stable, + beta, + nightly, +} + +class CargoBuildOptions { + final Toolchain toolchain; + final List flags; + + CargoBuildOptions({ + required this.toolchain, + required this.flags, + }); + + static Toolchain _toolchainFromNode(YamlNode node) { + if (node case YamlScalar(value: String name)) { + final toolchain = + Toolchain.values.firstWhereOrNull((element) => element.name == name); + if (toolchain != null) { + return toolchain; + } + } + throw SourceSpanException( + 'Unknown toolchain. Must be one of ${Toolchain.values.map((e) => e.name)}.', + node.span); + } + + static CargoBuildOptions parse(YamlNode node) { + if (node is! YamlMap) { + throw SourceSpanException('Cargo options must be a map', node.span); + } + Toolchain toolchain = Toolchain.stable; + List flags = []; + for (final MapEntry(:key, :value) in node.nodes.entries) { + if (key case YamlScalar(value: 'toolchain')) { + toolchain = _toolchainFromNode(value); + } else if (key case YamlScalar(value: 'extra_flags')) { + if (value case YamlList(nodes: List list)) { + if (list.every((element) { + if (element case YamlScalar(value: String _)) { + return true; + } + return false; + })) { + flags = list.map((e) => e.value as String).toList(); + continue; + } + } + throw SourceSpanException( + 'Extra flags must be a list of strings', value.span); + } else { + throw SourceSpanException( + 'Unknown cargo option type. Must be "toolchain" or "extra_flags".', + key.span); + } + } + return CargoBuildOptions(toolchain: toolchain, flags: flags); + } +} + +extension on YamlMap { + /// Map that extracts keys so that we can do map case check on them. + Map get valueMap => + nodes.map((key, value) => MapEntry(key.value, value)); +} + +class PrecompiledBinaries { + final String uriPrefix; + final PublicKey publicKey; + + PrecompiledBinaries({ + required this.uriPrefix, + required this.publicKey, + }); + + static PublicKey _publicKeyFromHex(String key, SourceSpan? span) { + final bytes = HEX.decode(key); + if (bytes.length != 32) { + throw SourceSpanException( + 'Invalid public key. Must be 32 bytes long.', span); + } + return PublicKey(bytes); + } + + static PrecompiledBinaries parse(YamlNode node) { + if (node case YamlMap(valueMap: Map map)) { + if (map + case { + 'url_prefix': YamlNode urlPrefixNode, + 'public_key': YamlNode publicKeyNode, + }) { + final urlPrefix = switch (urlPrefixNode) { + YamlScalar(value: String urlPrefix) => urlPrefix, + _ => throw SourceSpanException( + 'Invalid URL prefix value.', urlPrefixNode.span), + }; + final publicKey = switch (publicKeyNode) { + YamlScalar(value: String publicKey) => + _publicKeyFromHex(publicKey, publicKeyNode.span), + _ => throw SourceSpanException( + 'Invalid public key value.', publicKeyNode.span), + }; + return PrecompiledBinaries( + uriPrefix: urlPrefix, + publicKey: publicKey, + ); + } + } + throw SourceSpanException( + 'Invalid precompiled binaries value. ' + 'Expected Map with "url_prefix" and "public_key".', + node.span); + } +} + +/// Cargokit options specified for Rust crate. +class CargokitCrateOptions { + CargokitCrateOptions({ + this.cargo = const {}, + this.precompiledBinaries, + }); + + final Map cargo; + final PrecompiledBinaries? precompiledBinaries; + + static CargokitCrateOptions parse(YamlNode node) { + if (node is! YamlMap) { + throw SourceSpanException('Cargokit options must be a map', node.span); + } + final options = {}; + PrecompiledBinaries? precompiledBinaries; + + for (final entry in node.nodes.entries) { + if (entry + case MapEntry( + key: YamlScalar(value: 'cargo'), + value: YamlNode node, + )) { + if (node is! YamlMap) { + throw SourceSpanException('Cargo options must be a map', node.span); + } + for (final MapEntry(:YamlNode key, :value) in node.nodes.entries) { + if (key case YamlScalar(value: String name)) { + final configuration = BuildConfiguration.values + .firstWhereOrNull((element) => element.name == name); + if (configuration != null) { + options[configuration] = CargoBuildOptions.parse(value); + continue; + } + } + throw SourceSpanException( + 'Unknown build configuration. Must be one of ${BuildConfiguration.values.map((e) => e.name)}.', + key.span); + } + } else if (entry.key case YamlScalar(value: 'precompiled_binaries')) { + precompiledBinaries = PrecompiledBinaries.parse(entry.value); + } else { + throw SourceSpanException( + 'Unknown cargokit option type. Must be "cargo" or "precompiled_binaries".', + entry.key.span); + } + } + return CargokitCrateOptions( + cargo: options, + precompiledBinaries: precompiledBinaries, + ); + } + + static CargokitCrateOptions load({ + required String manifestDir, + }) { + final uri = Uri.file(path.join(manifestDir, "cargokit.yaml")); + final file = File.fromUri(uri); + if (file.existsSync()) { + final contents = loadYamlNode(file.readAsStringSync(), sourceUrl: uri); + return parse(contents); + } else { + return CargokitCrateOptions(); + } + } +} + +class CargokitUserOptions { + // When Rustup is installed always build locally unless user opts into + // using precompiled binaries. + static bool defaultUsePrecompiledBinaries() { + return Rustup.executablePath() == null; + } + + CargokitUserOptions({ + required this.usePrecompiledBinaries, + required this.verboseLogging, + }); + + CargokitUserOptions._() + : usePrecompiledBinaries = defaultUsePrecompiledBinaries(), + verboseLogging = false; + + static CargokitUserOptions parse(YamlNode node) { + if (node is! YamlMap) { + throw SourceSpanException('Cargokit options must be a map', node.span); + } + bool usePrecompiledBinaries = defaultUsePrecompiledBinaries(); + bool verboseLogging = false; + + for (final entry in node.nodes.entries) { + if (entry.key case YamlScalar(value: 'use_precompiled_binaries')) { + if (entry.value case YamlScalar(value: bool value)) { + usePrecompiledBinaries = value; + continue; + } + throw SourceSpanException( + 'Invalid value for "use_precompiled_binaries". Must be a boolean.', + entry.value.span); + } else if (entry.key case YamlScalar(value: 'verbose_logging')) { + if (entry.value case YamlScalar(value: bool value)) { + verboseLogging = value; + continue; + } + throw SourceSpanException( + 'Invalid value for "verbose_logging". Must be a boolean.', + entry.value.span); + } else { + throw SourceSpanException( + 'Unknown cargokit option type. Must be "use_precompiled_binaries" or "verbose_logging".', + entry.key.span); + } + } + return CargokitUserOptions( + usePrecompiledBinaries: usePrecompiledBinaries, + verboseLogging: verboseLogging, + ); + } + + static CargokitUserOptions load() { + String fileName = "cargokit_options.yaml"; + var userProjectDir = Directory(Environment.rootProjectDir); + + while (userProjectDir.parent.path != userProjectDir.path) { + final configFile = File(path.join(userProjectDir.path, fileName)); + if (configFile.existsSync()) { + final contents = loadYamlNode( + configFile.readAsStringSync(), + sourceUrl: configFile.uri, + ); + final res = parse(contents); + if (res.verboseLogging) { + _log.info('Found user options file at ${configFile.path}'); + } + return res; + } + userProjectDir = userProjectDir.parent; + } + return CargokitUserOptions._(); + } + + final bool usePrecompiledBinaries; + final bool verboseLogging; +} diff --git a/rust_builder/cargokit/build_tool/lib/src/precompile_binaries.dart b/rust_builder/cargokit/build_tool/lib/src/precompile_binaries.dart new file mode 100644 index 00000000..c27f4195 --- /dev/null +++ b/rust_builder/cargokit/build_tool/lib/src/precompile_binaries.dart @@ -0,0 +1,202 @@ +/// This is copied from Cargokit (which is the official way to use it currently) +/// Details: https://fzyzcjy.github.io/flutter_rust_bridge/manual/integrate/builtin + +import 'dart:io'; + +import 'package:ed25519_edwards/ed25519_edwards.dart'; +import 'package:github/github.dart'; +import 'package:logging/logging.dart'; +import 'package:path/path.dart' as path; + +import 'artifacts_provider.dart'; +import 'builder.dart'; +import 'cargo.dart'; +import 'crate_hash.dart'; +import 'options.dart'; +import 'rustup.dart'; +import 'target.dart'; + +final _log = Logger('precompile_binaries'); + +class PrecompileBinaries { + PrecompileBinaries({ + required this.privateKey, + required this.githubToken, + required this.repositorySlug, + required this.manifestDir, + required this.targets, + this.androidSdkLocation, + this.androidNdkVersion, + this.androidMinSdkVersion, + this.tempDir, + }); + + final PrivateKey privateKey; + final String githubToken; + final RepositorySlug repositorySlug; + final String manifestDir; + final List targets; + final String? androidSdkLocation; + final String? androidNdkVersion; + final int? androidMinSdkVersion; + final String? tempDir; + + static String fileName(Target target, String name) { + return '${target.rust}_$name'; + } + + static String signatureFileName(Target target, String name) { + return '${target.rust}_$name.sig'; + } + + Future run() async { + final crateInfo = CrateInfo.load(manifestDir); + + final targets = List.of(this.targets); + if (targets.isEmpty) { + targets.addAll([ + ...Target.buildableTargets(), + if (androidSdkLocation != null) ...Target.androidTargets(), + ]); + } + + _log.info('Precompiling binaries for $targets'); + + final hash = CrateHash.compute(manifestDir); + _log.info('Computed crate hash: $hash'); + + final String tagName = 'precompiled_$hash'; + + final github = GitHub(auth: Authentication.withToken(githubToken)); + final repo = github.repositories; + final release = await _getOrCreateRelease( + repo: repo, + tagName: tagName, + packageName: crateInfo.packageName, + hash: hash, + ); + + final tempDir = this.tempDir != null + ? Directory(this.tempDir!) + : Directory.systemTemp.createTempSync('precompiled_'); + + tempDir.createSync(recursive: true); + + final crateOptions = CargokitCrateOptions.load( + manifestDir: manifestDir, + ); + + final buildEnvironment = BuildEnvironment( + configuration: BuildConfiguration.release, + crateOptions: crateOptions, + targetTempDir: tempDir.path, + manifestDir: manifestDir, + crateInfo: crateInfo, + isAndroid: androidSdkLocation != null, + androidSdkPath: androidSdkLocation, + androidNdkVersion: androidNdkVersion, + androidMinSdkVersion: androidMinSdkVersion, + ); + + final rustup = Rustup(); + + for (final target in targets) { + final artifactNames = getArtifactNames( + target: target, + libraryName: crateInfo.packageName, + remote: true, + ); + + if (artifactNames.every((name) { + final fileName = PrecompileBinaries.fileName(target, name); + return (release.assets ?? []).any((e) => e.name == fileName); + })) { + _log.info("All artifacts for $target already exist - skipping"); + continue; + } + + _log.info('Building for $target'); + + final builder = + RustBuilder(target: target, environment: buildEnvironment); + builder.prepare(rustup); + final res = await builder.build(); + + final assets = []; + for (final name in artifactNames) { + final file = File(path.join(res, name)); + if (!file.existsSync()) { + throw Exception('Missing artifact: ${file.path}'); + } + + final data = file.readAsBytesSync(); + final create = CreateReleaseAsset( + name: PrecompileBinaries.fileName(target, name), + contentType: "application/octet-stream", + assetData: data, + ); + final signature = sign(privateKey, data); + final signatureCreate = CreateReleaseAsset( + name: signatureFileName(target, name), + contentType: "application/octet-stream", + assetData: signature, + ); + bool verified = verify(public(privateKey), data, signature); + if (!verified) { + throw Exception('Signature verification failed'); + } + assets.add(create); + assets.add(signatureCreate); + } + _log.info('Uploading assets: ${assets.map((e) => e.name)}'); + for (final asset in assets) { + // This seems to be failing on CI so do it one by one + int retryCount = 0; + while (true) { + try { + await repo.uploadReleaseAssets(release, [asset]); + break; + } on Exception catch (e) { + if (retryCount == 10) { + rethrow; + } + ++retryCount; + _log.shout( + 'Upload failed (attempt $retryCount, will retry): ${e.toString()}'); + await Future.delayed(Duration(seconds: 2)); + } + } + } + } + + _log.info('Cleaning up'); + tempDir.deleteSync(recursive: true); + } + + Future _getOrCreateRelease({ + required RepositoriesService repo, + required String tagName, + required String packageName, + required String hash, + }) async { + Release release; + try { + _log.info('Fetching release $tagName'); + release = await repo.getReleaseByTagName(repositorySlug, tagName); + } on ReleaseNotFound { + _log.info('Release not found - creating release $tagName'); + release = await repo.createRelease( + repositorySlug, + CreateRelease.from( + tagName: tagName, + name: 'Precompiled binaries ${hash.substring(0, 8)}', + targetCommitish: null, + isDraft: false, + isPrerelease: false, + body: 'Precompiled binaries for crate $packageName, ' + 'crate hash $hash.', + )); + } + return release; + } +} diff --git a/rust_builder/cargokit/build_tool/lib/src/rustup.dart b/rust_builder/cargokit/build_tool/lib/src/rustup.dart new file mode 100644 index 00000000..0ac8d086 --- /dev/null +++ b/rust_builder/cargokit/build_tool/lib/src/rustup.dart @@ -0,0 +1,136 @@ +/// This is copied from Cargokit (which is the official way to use it currently) +/// Details: https://fzyzcjy.github.io/flutter_rust_bridge/manual/integrate/builtin + +import 'dart:io'; + +import 'package:collection/collection.dart'; +import 'package:path/path.dart' as path; + +import 'util.dart'; + +class _Toolchain { + _Toolchain( + this.name, + this.targets, + ); + + final String name; + final List targets; +} + +class Rustup { + List? installedTargets(String toolchain) { + final targets = _installedTargets(toolchain); + return targets != null ? List.unmodifiable(targets) : null; + } + + void installToolchain(String toolchain) { + log.info("Installing Rust toolchain: $toolchain"); + runCommand("rustup", ['toolchain', 'install', toolchain]); + _installedToolchains + .add(_Toolchain(toolchain, _getInstalledTargets(toolchain))); + } + + void installTarget( + String target, { + required String toolchain, + }) { + log.info("Installing Rust target: $target"); + runCommand("rustup", [ + 'target', + 'add', + '--toolchain', + toolchain, + target, + ]); + _installedTargets(toolchain)?.add(target); + } + + final List<_Toolchain> _installedToolchains; + + Rustup() : _installedToolchains = _getInstalledToolchains(); + + List? _installedTargets(String toolchain) => _installedToolchains + .firstWhereOrNull( + (e) => e.name == toolchain || e.name.startsWith('$toolchain-')) + ?.targets; + + static List<_Toolchain> _getInstalledToolchains() { + String extractToolchainName(String line) { + // ignore (default) after toolchain name + final parts = line.split(' '); + return parts[0]; + } + + final res = runCommand("rustup", ['toolchain', 'list']); + + // To list all non-custom toolchains, we need to filter out lines that + // don't start with "stable", "beta", or "nightly". + Pattern nonCustom = RegExp(r"^(stable|beta|nightly)"); + final lines = res.stdout + .toString() + .split('\n') + .where((e) => e.isNotEmpty && e.startsWith(nonCustom)) + .map(extractToolchainName) + .toList(growable: true); + + return lines + .map( + (name) => _Toolchain( + name, + _getInstalledTargets(name), + ), + ) + .toList(growable: true); + } + + static List _getInstalledTargets(String toolchain) { + final res = runCommand("rustup", [ + 'target', + 'list', + '--toolchain', + toolchain, + '--installed', + ]); + final lines = res.stdout + .toString() + .split('\n') + .where((e) => e.isNotEmpty) + .toList(growable: true); + return lines; + } + + bool _didInstallRustSrcForNightly = false; + + void installRustSrcForNightly() { + if (_didInstallRustSrcForNightly) { + return; + } + // Useful for -Z build-std + runCommand( + "rustup", + ['component', 'add', 'rust-src', '--toolchain', 'nightly'], + ); + _didInstallRustSrcForNightly = true; + } + + static String? executablePath() { + final envPath = Platform.environment['PATH']; + final envPathSeparator = Platform.isWindows ? ';' : ':'; + final home = Platform.isWindows + ? Platform.environment['USERPROFILE'] + : Platform.environment['HOME']; + final paths = [ + if (home != null) path.join(home, '.cargo', 'bin'), + if (envPath != null) ...envPath.split(envPathSeparator), + ]; + for (final p in paths) { + final rustup = Platform.isWindows ? 'rustup.exe' : 'rustup'; + final rustupPath = path.join(p, rustup); + if (File(rustupPath).existsSync()) { + return rustupPath; + } + } + return null; + } +} diff --git a/rust_builder/cargokit/build_tool/lib/src/target.dart b/rust_builder/cargokit/build_tool/lib/src/target.dart new file mode 100644 index 00000000..6fbc58b6 --- /dev/null +++ b/rust_builder/cargokit/build_tool/lib/src/target.dart @@ -0,0 +1,140 @@ +/// This is copied from Cargokit (which is the official way to use it currently) +/// Details: https://fzyzcjy.github.io/flutter_rust_bridge/manual/integrate/builtin + +import 'dart:io'; + +import 'package:collection/collection.dart'; + +import 'util.dart'; + +class Target { + Target({ + required this.rust, + this.flutter, + this.android, + this.androidMinSdkVersion, + this.darwinPlatform, + this.darwinArch, + }); + + static final all = [ + Target( + rust: 'armv7-linux-androideabi', + flutter: 'android-arm', + android: 'armeabi-v7a', + androidMinSdkVersion: 16, + ), + Target( + rust: 'aarch64-linux-android', + flutter: 'android-arm64', + android: 'arm64-v8a', + androidMinSdkVersion: 21, + ), + Target( + rust: 'i686-linux-android', + flutter: 'android-x86', + android: 'x86', + androidMinSdkVersion: 16, + ), + Target( + rust: 'x86_64-linux-android', + flutter: 'android-x64', + android: 'x86_64', + androidMinSdkVersion: 21, + ), + Target( + rust: 'x86_64-pc-windows-msvc', + flutter: 'windows-x64', + ), + Target( + rust: 'x86_64-unknown-linux-gnu', + flutter: 'linux-x64', + ), + Target( + rust: 'aarch64-unknown-linux-gnu', + flutter: 'linux-arm64', + ), + Target( + rust: 'x86_64-apple-darwin', + darwinPlatform: 'macosx', + darwinArch: 'x86_64', + ), + Target( + rust: 'aarch64-apple-darwin', + darwinPlatform: 'macosx', + darwinArch: 'arm64', + ), + Target( + rust: 'aarch64-apple-ios', + darwinPlatform: 'iphoneos', + darwinArch: 'arm64', + ), + Target( + rust: 'aarch64-apple-ios-sim', + darwinPlatform: 'iphonesimulator', + darwinArch: 'arm64', + ), + Target( + rust: 'x86_64-apple-ios', + darwinPlatform: 'iphonesimulator', + darwinArch: 'x86_64', + ), + ]; + + static Target? forFlutterName(String flutterName) { + return all.firstWhereOrNull((element) => element.flutter == flutterName); + } + + static Target? forDarwin({ + required String platformName, + required String darwinAarch, + }) { + return all.firstWhereOrNull((element) => // + element.darwinPlatform == platformName && + element.darwinArch == darwinAarch); + } + + static Target? forRustTriple(String triple) { + return all.firstWhereOrNull((element) => element.rust == triple); + } + + static List androidTargets() { + return all + .where((element) => element.android != null) + .toList(growable: false); + } + + /// Returns buildable targets on current host platform ignoring Android targets. + static List buildableTargets() { + if (Platform.isLinux) { + // Right now we don't support cross-compiling on Linux. So we just return + // the host target. + final arch = runCommand('arch', []).stdout as String; + if (arch.trim() == 'aarch64') { + return [Target.forRustTriple('aarch64-unknown-linux-gnu')!]; + } else { + return [Target.forRustTriple('x86_64-unknown-linux-gnu')!]; + } + } + return all.where((target) { + if (Platform.isWindows) { + return target.rust.contains('-windows-'); + } else if (Platform.isMacOS) { + return target.darwinPlatform != null; + } + return false; + }).toList(growable: false); + } + + @override + String toString() { + return rust; + } + + final String? flutter; + final String rust; + final String? android; + final int? androidMinSdkVersion; + final String? darwinPlatform; + final String? darwinArch; +} diff --git a/rust_builder/cargokit/build_tool/lib/src/util.dart b/rust_builder/cargokit/build_tool/lib/src/util.dart new file mode 100644 index 00000000..8bb6a872 --- /dev/null +++ b/rust_builder/cargokit/build_tool/lib/src/util.dart @@ -0,0 +1,172 @@ +/// This is copied from Cargokit (which is the official way to use it currently) +/// Details: https://fzyzcjy.github.io/flutter_rust_bridge/manual/integrate/builtin + +import 'dart:convert'; +import 'dart:io'; + +import 'package:logging/logging.dart'; +import 'package:path/path.dart' as path; + +import 'logging.dart'; +import 'rustup.dart'; + +final log = Logger("process"); + +class CommandFailedException implements Exception { + final String executable; + final List arguments; + final ProcessResult result; + + CommandFailedException({ + required this.executable, + required this.arguments, + required this.result, + }); + + @override + String toString() { + final stdout = result.stdout.toString().trim(); + final stderr = result.stderr.toString().trim(); + return [ + "External Command: $executable ${arguments.map((e) => '"$e"').join(' ')}", + "Returned Exit Code: ${result.exitCode}", + kSeparator, + "STDOUT:", + if (stdout.isNotEmpty) stdout, + kSeparator, + "STDERR:", + if (stderr.isNotEmpty) stderr, + ].join('\n'); + } +} + +class TestRunCommandArgs { + final String executable; + final List arguments; + final String? workingDirectory; + final Map? environment; + final bool includeParentEnvironment; + final bool runInShell; + final Encoding? stdoutEncoding; + final Encoding? stderrEncoding; + + TestRunCommandArgs({ + required this.executable, + required this.arguments, + this.workingDirectory, + this.environment, + this.includeParentEnvironment = true, + this.runInShell = false, + this.stdoutEncoding, + this.stderrEncoding, + }); +} + +class TestRunCommandResult { + TestRunCommandResult({ + this.pid = 1, + this.exitCode = 0, + this.stdout = '', + this.stderr = '', + }); + + final int pid; + final int exitCode; + final String stdout; + final String stderr; +} + +TestRunCommandResult Function(TestRunCommandArgs args)? testRunCommandOverride; + +ProcessResult runCommand( + String executable, + List arguments, { + String? workingDirectory, + Map? environment, + bool includeParentEnvironment = true, + bool runInShell = false, + Encoding? stdoutEncoding = systemEncoding, + Encoding? stderrEncoding = systemEncoding, +}) { + if (testRunCommandOverride != null) { + final result = testRunCommandOverride!(TestRunCommandArgs( + executable: executable, + arguments: arguments, + workingDirectory: workingDirectory, + environment: environment, + includeParentEnvironment: includeParentEnvironment, + runInShell: runInShell, + stdoutEncoding: stdoutEncoding, + stderrEncoding: stderrEncoding, + )); + return ProcessResult( + result.pid, + result.exitCode, + result.stdout, + result.stderr, + ); + } + log.finer('Running command $executable ${arguments.join(' ')}'); + final res = Process.runSync( + _resolveExecutable(executable), + arguments, + workingDirectory: workingDirectory, + environment: environment, + includeParentEnvironment: includeParentEnvironment, + runInShell: runInShell, + stderrEncoding: stderrEncoding, + stdoutEncoding: stdoutEncoding, + ); + if (res.exitCode != 0) { + throw CommandFailedException( + executable: executable, + arguments: arguments, + result: res, + ); + } else { + return res; + } +} + +class RustupNotFoundException implements Exception { + @override + String toString() { + return [ + ' ', + 'rustup not found in PATH.', + ' ', + 'Maybe you need to install Rust? It only takes a minute:', + ' ', + if (Platform.isWindows) 'https://www.rust-lang.org/tools/install', + if (hasHomebrewRustInPath()) ...[ + '\$ brew unlink rust # Unlink homebrew Rust from PATH', + ], + if (!Platform.isWindows) + "\$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh", + ' ', + ].join('\n'); + } + + static bool hasHomebrewRustInPath() { + if (!Platform.isMacOS) { + return false; + } + final envPath = Platform.environment['PATH'] ?? ''; + final paths = envPath.split(':'); + return paths.any((p) { + return p.contains('homebrew') && File(path.join(p, 'rustc')).existsSync(); + }); + } +} + +String _resolveExecutable(String executable) { + if (executable == 'rustup') { + final resolved = Rustup.executablePath(); + if (resolved != null) { + return resolved; + } + throw RustupNotFoundException(); + } else { + return executable; + } +} diff --git a/rust_builder/cargokit/build_tool/lib/src/verify_binaries.dart b/rust_builder/cargokit/build_tool/lib/src/verify_binaries.dart new file mode 100644 index 00000000..2366b57b --- /dev/null +++ b/rust_builder/cargokit/build_tool/lib/src/verify_binaries.dart @@ -0,0 +1,84 @@ +/// This is copied from Cargokit (which is the official way to use it currently) +/// Details: https://fzyzcjy.github.io/flutter_rust_bridge/manual/integrate/builtin + +import 'dart:io'; + +import 'package:ed25519_edwards/ed25519_edwards.dart'; +import 'package:http/http.dart'; + +import 'artifacts_provider.dart'; +import 'cargo.dart'; +import 'crate_hash.dart'; +import 'options.dart'; +import 'precompile_binaries.dart'; +import 'target.dart'; + +class VerifyBinaries { + VerifyBinaries({ + required this.manifestDir, + }); + + final String manifestDir; + + Future run() async { + final crateInfo = CrateInfo.load(manifestDir); + + final config = CargokitCrateOptions.load(manifestDir: manifestDir); + final precompiledBinaries = config.precompiledBinaries; + if (precompiledBinaries == null) { + stdout.writeln('Crate does not support precompiled binaries.'); + } else { + final crateHash = CrateHash.compute(manifestDir); + stdout.writeln('Crate hash: $crateHash'); + + for (final target in Target.all) { + final message = 'Checking ${target.rust}...'; + stdout.write(message.padRight(40)); + stdout.flush(); + + final artifacts = getArtifactNames( + target: target, + libraryName: crateInfo.packageName, + remote: true, + ); + + final prefix = precompiledBinaries.uriPrefix; + + bool ok = true; + + for (final artifact in artifacts) { + final fileName = PrecompileBinaries.fileName(target, artifact); + final signatureFileName = + PrecompileBinaries.signatureFileName(target, artifact); + + final url = Uri.parse('$prefix$crateHash/$fileName'); + final signatureUrl = + Uri.parse('$prefix$crateHash/$signatureFileName'); + + final signature = await get(signatureUrl); + if (signature.statusCode != 200) { + stdout.writeln('MISSING'); + ok = false; + break; + } + final asset = await get(url); + if (asset.statusCode != 200) { + stdout.writeln('MISSING'); + ok = false; + break; + } + + if (!verify(precompiledBinaries.publicKey, asset.bodyBytes, + signature.bodyBytes)) { + stdout.writeln('INVALID SIGNATURE'); + ok = false; + } + } + + if (ok) { + stdout.writeln('OK'); + } + } + } + } +} diff --git a/rust_builder/cargokit/build_tool/pubspec.lock b/rust_builder/cargokit/build_tool/pubspec.lock new file mode 100644 index 00000000..343bdd36 --- /dev/null +++ b/rust_builder/cargokit/build_tool/pubspec.lock @@ -0,0 +1,453 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + _fe_analyzer_shared: + dependency: transitive + description: + name: _fe_analyzer_shared + sha256: eb376e9acf6938204f90eb3b1f00b578640d3188b4c8a8ec054f9f479af8d051 + url: "https://pub.dev" + source: hosted + version: "64.0.0" + adaptive_number: + dependency: transitive + description: + name: adaptive_number + sha256: "3a567544e9b5c9c803006f51140ad544aedc79604fd4f3f2c1380003f97c1d77" + url: "https://pub.dev" + source: hosted + version: "1.0.0" + analyzer: + dependency: transitive + description: + name: analyzer + sha256: "69f54f967773f6c26c7dcb13e93d7ccee8b17a641689da39e878d5cf13b06893" + url: "https://pub.dev" + source: hosted + version: "6.2.0" + args: + dependency: "direct main" + description: + name: args + sha256: eef6c46b622e0494a36c5a12d10d77fb4e855501a91c1b9ef9339326e58f0596 + url: "https://pub.dev" + source: hosted + version: "2.4.2" + async: + dependency: transitive + description: + name: async + sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" + url: "https://pub.dev" + source: hosted + version: "2.11.0" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" + url: "https://pub.dev" + source: hosted + version: "2.1.1" + collection: + dependency: "direct main" + description: + name: collection + sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a + url: "https://pub.dev" + source: hosted + version: "1.18.0" + convert: + dependency: "direct main" + description: + name: convert + sha256: "0f08b14755d163f6e2134cb58222dd25ea2a2ee8a195e53983d57c075324d592" + url: "https://pub.dev" + source: hosted + version: "3.1.1" + coverage: + dependency: transitive + description: + name: coverage + sha256: "2fb815080e44a09b85e0f2ca8a820b15053982b2e714b59267719e8a9ff17097" + url: "https://pub.dev" + source: hosted + version: "1.6.3" + crypto: + dependency: "direct main" + description: + name: crypto + sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab + url: "https://pub.dev" + source: hosted + version: "3.0.3" + ed25519_edwards: + dependency: "direct main" + description: + name: ed25519_edwards + sha256: "6ce0112d131327ec6d42beede1e5dfd526069b18ad45dcf654f15074ad9276cd" + url: "https://pub.dev" + source: hosted + version: "0.3.1" + file: + dependency: transitive + description: + name: file + sha256: "1b92bec4fc2a72f59a8e15af5f52cd441e4a7860b49499d69dfa817af20e925d" + url: "https://pub.dev" + source: hosted + version: "6.1.4" + fixnum: + dependency: transitive + description: + name: fixnum + sha256: "25517a4deb0c03aa0f32fd12db525856438902d9c16536311e76cdc57b31d7d1" + url: "https://pub.dev" + source: hosted + version: "1.1.0" + frontend_server_client: + dependency: transitive + description: + name: frontend_server_client + sha256: "408e3ca148b31c20282ad6f37ebfa6f4bdc8fede5b74bc2f08d9d92b55db3612" + url: "https://pub.dev" + source: hosted + version: "3.2.0" + github: + dependency: "direct main" + description: + name: github + sha256: "9966bc13bf612342e916b0a343e95e5f046c88f602a14476440e9b75d2295411" + url: "https://pub.dev" + source: hosted + version: "9.17.0" + glob: + dependency: transitive + description: + name: glob + sha256: "0e7014b3b7d4dac1ca4d6114f82bf1782ee86745b9b42a92c9289c23d8a0ab63" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + hex: + dependency: "direct main" + description: + name: hex + sha256: "4e7cd54e4b59ba026432a6be2dd9d96e4c5205725194997193bf871703b82c4a" + url: "https://pub.dev" + source: hosted + version: "0.2.0" + http: + dependency: "direct main" + description: + name: http + sha256: "759d1a329847dd0f39226c688d3e06a6b8679668e350e2891a6474f8b4bb8525" + url: "https://pub.dev" + source: hosted + version: "1.1.0" + http_multi_server: + dependency: transitive + description: + name: http_multi_server + sha256: "97486f20f9c2f7be8f514851703d0119c3596d14ea63227af6f7a481ef2b2f8b" + url: "https://pub.dev" + source: hosted + version: "3.2.1" + http_parser: + dependency: transitive + description: + name: http_parser + sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b" + url: "https://pub.dev" + source: hosted + version: "4.0.2" + io: + dependency: transitive + description: + name: io + sha256: "2ec25704aba361659e10e3e5f5d672068d332fc8ac516421d483a11e5cbd061e" + url: "https://pub.dev" + source: hosted + version: "1.0.4" + js: + dependency: transitive + description: + name: js + sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3 + url: "https://pub.dev" + source: hosted + version: "0.6.7" + json_annotation: + dependency: transitive + description: + name: json_annotation + sha256: b10a7b2ff83d83c777edba3c6a0f97045ddadd56c944e1a23a3fdf43a1bf4467 + url: "https://pub.dev" + source: hosted + version: "4.8.1" + lints: + dependency: "direct dev" + description: + name: lints + sha256: "0a217c6c989d21039f1498c3ed9f3ed71b354e69873f13a8dfc3c9fe76f1b452" + url: "https://pub.dev" + source: hosted + version: "2.1.1" + logging: + dependency: "direct main" + description: + name: logging + sha256: "623a88c9594aa774443aa3eb2d41807a48486b5613e67599fb4c41c0ad47c340" + url: "https://pub.dev" + source: hosted + version: "1.2.0" + matcher: + dependency: transitive + description: + name: matcher + sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e" + url: "https://pub.dev" + source: hosted + version: "0.12.16" + meta: + dependency: transitive + description: + name: meta + sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3" + url: "https://pub.dev" + source: hosted + version: "1.9.1" + mime: + dependency: transitive + description: + name: mime + sha256: e4ff8e8564c03f255408decd16e7899da1733852a9110a58fe6d1b817684a63e + url: "https://pub.dev" + source: hosted + version: "1.0.4" + node_preamble: + dependency: transitive + description: + name: node_preamble + sha256: "6e7eac89047ab8a8d26cf16127b5ed26de65209847630400f9aefd7cd5c730db" + url: "https://pub.dev" + source: hosted + version: "2.0.2" + package_config: + dependency: transitive + description: + name: package_config + sha256: "1c5b77ccc91e4823a5af61ee74e6b972db1ef98c2ff5a18d3161c982a55448bd" + url: "https://pub.dev" + source: hosted + version: "2.1.0" + path: + dependency: "direct main" + description: + name: path + sha256: "2ad4cddff7f5cc0e2d13069f2a3f7a73ca18f66abd6f5ecf215219cdb3638edb" + url: "https://pub.dev" + source: hosted + version: "1.8.0" + petitparser: + dependency: transitive + description: + name: petitparser + sha256: cb3798bef7fc021ac45b308f4b51208a152792445cce0448c9a4ba5879dd8750 + url: "https://pub.dev" + source: hosted + version: "5.4.0" + pool: + dependency: transitive + description: + name: pool + sha256: "20fe868b6314b322ea036ba325e6fc0711a22948856475e2c2b6306e8ab39c2a" + url: "https://pub.dev" + source: hosted + version: "1.5.1" + pub_semver: + dependency: transitive + description: + name: pub_semver + sha256: "40d3ab1bbd474c4c2328c91e3a7df8c6dd629b79ece4c4bd04bee496a224fb0c" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + shelf: + dependency: transitive + description: + name: shelf + sha256: ad29c505aee705f41a4d8963641f91ac4cee3c8fad5947e033390a7bd8180fa4 + url: "https://pub.dev" + source: hosted + version: "1.4.1" + shelf_packages_handler: + dependency: transitive + description: + name: shelf_packages_handler + sha256: "89f967eca29607c933ba9571d838be31d67f53f6e4ee15147d5dc2934fee1b1e" + url: "https://pub.dev" + source: hosted + version: "3.0.2" + shelf_static: + dependency: transitive + description: + name: shelf_static + sha256: a41d3f53c4adf0f57480578c1d61d90342cd617de7fc8077b1304643c2d85c1e + url: "https://pub.dev" + source: hosted + version: "1.1.2" + shelf_web_socket: + dependency: transitive + description: + name: shelf_web_socket + sha256: "9ca081be41c60190ebcb4766b2486a7d50261db7bd0f5d9615f2d653637a84c1" + url: "https://pub.dev" + source: hosted + version: "1.0.4" + source_map_stack_trace: + dependency: transitive + description: + name: source_map_stack_trace + sha256: "84cf769ad83aa6bb61e0aa5a18e53aea683395f196a6f39c4c881fb90ed4f7ae" + url: "https://pub.dev" + source: hosted + version: "2.1.1" + source_maps: + dependency: transitive + description: + name: source_maps + sha256: "708b3f6b97248e5781f493b765c3337db11c5d2c81c3094f10904bfa8004c703" + url: "https://pub.dev" + source: hosted + version: "0.10.12" + source_span: + dependency: "direct main" + description: + name: source_span + sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" + url: "https://pub.dev" + source: hosted + version: "1.10.0" + stack_trace: + dependency: transitive + description: + name: stack_trace + sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" + url: "https://pub.dev" + source: hosted + version: "1.11.1" + stream_channel: + dependency: transitive + description: + name: stream_channel + sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 + url: "https://pub.dev" + source: hosted + version: "2.1.2" + string_scanner: + dependency: transitive + description: + name: string_scanner + sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" + url: "https://pub.dev" + source: hosted + version: "1.2.0" + term_glyph: + dependency: transitive + description: + name: term_glyph + sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 + url: "https://pub.dev" + source: hosted + version: "1.2.1" + test: + dependency: "direct dev" + description: + name: test + sha256: "9b0dd8e36af4a5b1569029949d50a52cb2a2a2fdaa20cebb96e6603b9ae241f9" + url: "https://pub.dev" + source: hosted + version: "1.24.6" + test_api: + dependency: transitive + description: + name: test_api + sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b" + url: "https://pub.dev" + source: hosted + version: "0.6.1" + test_core: + dependency: transitive + description: + name: test_core + sha256: "4bef837e56375537055fdbbbf6dd458b1859881f4c7e6da936158f77d61ab265" + url: "https://pub.dev" + source: hosted + version: "0.5.6" + toml: + dependency: "direct main" + description: + name: toml + sha256: "157c5dca5160fced243f3ce984117f729c788bb5e475504f3dbcda881accee44" + url: "https://pub.dev" + source: hosted + version: "0.14.0" + typed_data: + dependency: transitive + description: + name: typed_data + sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c + url: "https://pub.dev" + source: hosted + version: "1.3.2" + version: + dependency: "direct main" + description: + name: version + sha256: "2307e23a45b43f96469eeab946208ed63293e8afca9c28cd8b5241ff31c55f55" + url: "https://pub.dev" + source: hosted + version: "3.0.0" + vm_service: + dependency: transitive + description: + name: vm_service + sha256: "0fae432c85c4ea880b33b497d32824b97795b04cdaa74d270219572a1f50268d" + url: "https://pub.dev" + source: hosted + version: "11.9.0" + watcher: + dependency: transitive + description: + name: watcher + sha256: "3d2ad6751b3c16cf07c7fca317a1413b3f26530319181b37e3b9039b84fc01d8" + url: "https://pub.dev" + source: hosted + version: "1.1.0" + web_socket_channel: + dependency: transitive + description: + name: web_socket_channel + sha256: d88238e5eac9a42bb43ca4e721edba3c08c6354d4a53063afaa568516217621b + url: "https://pub.dev" + source: hosted + version: "2.4.0" + webkit_inspection_protocol: + dependency: transitive + description: + name: webkit_inspection_protocol + sha256: "67d3a8b6c79e1987d19d848b0892e582dbb0c66c57cc1fef58a177dd2aa2823d" + url: "https://pub.dev" + source: hosted + version: "1.2.0" + yaml: + dependency: "direct main" + description: + name: yaml + sha256: "75769501ea3489fca56601ff33454fe45507ea3bfb014161abc3b43ae25989d5" + url: "https://pub.dev" + source: hosted + version: "3.1.2" +sdks: + dart: ">=3.0.0 <4.0.0" diff --git a/rust_builder/cargokit/build_tool/pubspec.yaml b/rust_builder/cargokit/build_tool/pubspec.yaml new file mode 100644 index 00000000..18c61e33 --- /dev/null +++ b/rust_builder/cargokit/build_tool/pubspec.yaml @@ -0,0 +1,33 @@ +# This is copied from Cargokit (which is the official way to use it currently) +# Details: https://fzyzcjy.github.io/flutter_rust_bridge/manual/integrate/builtin + +name: build_tool +description: Cargokit build_tool. Facilitates the build of Rust crate during Flutter application build. +publish_to: none +version: 1.0.0 + +environment: + sdk: ">=3.0.0 <4.0.0" + +# Add regular dependencies here. +dependencies: + # these are pinned on purpose because the bundle_tool_runner doesn't have + # pubspec.lock. See run_build_tool.sh + logging: 1.2.0 + path: 1.8.0 + version: 3.0.0 + collection: 1.18.0 + ed25519_edwards: 0.3.1 + hex: 0.2.0 + yaml: 3.1.2 + source_span: 1.10.0 + github: 9.17.0 + args: 2.4.2 + crypto: 3.0.3 + convert: 3.1.1 + http: 1.1.0 + toml: 0.14.0 + +dev_dependencies: + lints: ^2.1.0 + test: ^1.24.0 diff --git a/rust_builder/cargokit/cmake/cargokit.cmake b/rust_builder/cargokit/cmake/cargokit.cmake new file mode 100644 index 00000000..ddd05df9 --- /dev/null +++ b/rust_builder/cargokit/cmake/cargokit.cmake @@ -0,0 +1,99 @@ +SET(cargokit_cmake_root "${CMAKE_CURRENT_LIST_DIR}/..") + +# Workaround for https://github.com/dart-lang/pub/issues/4010 +get_filename_component(cargokit_cmake_root "${cargokit_cmake_root}" REALPATH) + +if(WIN32) + # REALPATH does not properly resolve symlinks on windows :-/ + execute_process(COMMAND powershell -ExecutionPolicy Bypass -File "${CMAKE_CURRENT_LIST_DIR}/resolve_symlinks.ps1" "${cargokit_cmake_root}" OUTPUT_VARIABLE cargokit_cmake_root OUTPUT_STRIP_TRAILING_WHITESPACE) +endif() + +# Arguments +# - target: CMAKE target to which rust library is linked +# - manifest_dir: relative path from current folder to directory containing cargo manifest +# - lib_name: cargo package name +# - any_symbol_name: name of any exported symbol from the library. +# used on windows to force linking with library. +function(apply_cargokit target manifest_dir lib_name any_symbol_name) + + set(CARGOKIT_LIB_NAME "${lib_name}") + set(CARGOKIT_LIB_FULL_NAME "${CMAKE_SHARED_MODULE_PREFIX}${CARGOKIT_LIB_NAME}${CMAKE_SHARED_MODULE_SUFFIX}") + if (CMAKE_CONFIGURATION_TYPES) + set(CARGOKIT_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/$") + set(OUTPUT_LIB "${CMAKE_CURRENT_BINARY_DIR}/$/${CARGOKIT_LIB_FULL_NAME}") + else() + set(CARGOKIT_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}") + set(OUTPUT_LIB "${CMAKE_CURRENT_BINARY_DIR}/${CARGOKIT_LIB_FULL_NAME}") + endif() + set(CARGOKIT_TEMP_DIR "${CMAKE_CURRENT_BINARY_DIR}/cargokit_build") + + if (FLUTTER_TARGET_PLATFORM) + set(CARGOKIT_TARGET_PLATFORM "${FLUTTER_TARGET_PLATFORM}") + else() + set(CARGOKIT_TARGET_PLATFORM "windows-x64") + endif() + + set(CARGOKIT_ENV + "CARGOKIT_CMAKE=${CMAKE_COMMAND}" + "CARGOKIT_CONFIGURATION=$" + "CARGOKIT_MANIFEST_DIR=${CMAKE_CURRENT_SOURCE_DIR}/${manifest_dir}" + "CARGOKIT_TARGET_TEMP_DIR=${CARGOKIT_TEMP_DIR}" + "CARGOKIT_OUTPUT_DIR=${CARGOKIT_OUTPUT_DIR}" + "CARGOKIT_TARGET_PLATFORM=${CARGOKIT_TARGET_PLATFORM}" + "CARGOKIT_TOOL_TEMP_DIR=${CARGOKIT_TEMP_DIR}/tool" + "CARGOKIT_ROOT_PROJECT_DIR=${CMAKE_SOURCE_DIR}" + ) + + if (WIN32) + set(SCRIPT_EXTENSION ".cmd") + set(IMPORT_LIB_EXTENSION ".lib") + else() + set(SCRIPT_EXTENSION ".sh") + set(IMPORT_LIB_EXTENSION "") + execute_process(COMMAND chmod +x "${cargokit_cmake_root}/run_build_tool${SCRIPT_EXTENSION}") + endif() + + # Using generators in custom command is only supported in CMake 3.20+ + if (CMAKE_CONFIGURATION_TYPES AND ${CMAKE_VERSION} VERSION_LESS "3.20.0") + foreach(CONFIG IN LISTS CMAKE_CONFIGURATION_TYPES) + add_custom_command( + OUTPUT + "${CMAKE_CURRENT_BINARY_DIR}/${CONFIG}/${CARGOKIT_LIB_FULL_NAME}" + "${CMAKE_CURRENT_BINARY_DIR}/_phony_" + COMMAND ${CMAKE_COMMAND} -E env ${CARGOKIT_ENV} + "${cargokit_cmake_root}/run_build_tool${SCRIPT_EXTENSION}" build-cmake + VERBATIM + ) + endforeach() + else() + add_custom_command( + OUTPUT + ${OUTPUT_LIB} + "${CMAKE_CURRENT_BINARY_DIR}/_phony_" + COMMAND ${CMAKE_COMMAND} -E env ${CARGOKIT_ENV} + "${cargokit_cmake_root}/run_build_tool${SCRIPT_EXTENSION}" build-cmake + VERBATIM + ) + endif() + + + set_source_files_properties("${CMAKE_CURRENT_BINARY_DIR}/_phony_" PROPERTIES SYMBOLIC TRUE) + + if (TARGET ${target}) + # If we have actual cmake target provided create target and make existing + # target depend on it + add_custom_target("${target}_cargokit" DEPENDS ${OUTPUT_LIB}) + add_dependencies("${target}" "${target}_cargokit") + target_link_libraries("${target}" PRIVATE "${OUTPUT_LIB}${IMPORT_LIB_EXTENSION}") + if(WIN32) + target_link_options(${target} PRIVATE "/INCLUDE:${any_symbol_name}") + endif() + else() + # Otherwise (FFI) just use ALL to force building always + add_custom_target("${target}_cargokit" ALL DEPENDS ${OUTPUT_LIB}) + endif() + + # Allow adding the output library to plugin bundled libraries + set("${target}_cargokit_lib" ${OUTPUT_LIB} PARENT_SCOPE) + +endfunction() diff --git a/rust_builder/cargokit/cmake/resolve_symlinks.ps1 b/rust_builder/cargokit/cmake/resolve_symlinks.ps1 new file mode 100644 index 00000000..3d10d283 --- /dev/null +++ b/rust_builder/cargokit/cmake/resolve_symlinks.ps1 @@ -0,0 +1,27 @@ +function Resolve-Symlinks { + [CmdletBinding()] + [OutputType([string])] + param( + [Parameter(Position = 0, Mandatory, ValueFromPipeline, ValueFromPipelineByPropertyName)] + [string] $Path + ) + + [string] $separator = '/' + [string[]] $parts = $Path.Split($separator) + + [string] $realPath = '' + foreach ($part in $parts) { + if ($realPath -and !$realPath.EndsWith($separator)) { + $realPath += $separator + } + $realPath += $part + $item = Get-Item $realPath + if ($item.Target) { + $realPath = $item.Target.Replace('\', '/') + } + } + $realPath +} + +$path=Resolve-Symlinks -Path $args[0] +Write-Host $path diff --git a/rust_builder/cargokit/gradle/plugin.gradle b/rust_builder/cargokit/gradle/plugin.gradle new file mode 100644 index 00000000..2fc1d705 --- /dev/null +++ b/rust_builder/cargokit/gradle/plugin.gradle @@ -0,0 +1,175 @@ +/// This is copied from Cargokit (which is the official way to use it currently) +/// Details: https://fzyzcjy.github.io/flutter_rust_bridge/manual/integrate/builtin + +import java.nio.file.Paths +import org.apache.tools.ant.taskdefs.condition.Os + +CargoKitPlugin.file = buildscript.sourceFile + +apply plugin: CargoKitPlugin + +class CargoKitExtension { + String manifestDir; // Relative path to folder containing Cargo.toml + String libname; // Library name within Cargo.toml. Must be a cdylib +} + +abstract class CargoKitBuildTask extends DefaultTask { + + @Input + String buildMode + + @Input + String buildDir + + @Input + String outputDir + + @Input + String ndkVersion + + @Input + String sdkDirectory + + @Input + int compileSdkVersion; + + @Input + int minSdkVersion; + + @Input + String pluginFile + + @Input + List targetPlatforms + + @TaskAction + def build() { + if (project.cargokit.manifestDir == null) { + throw new GradleException("Property 'manifestDir' must be set on cargokit extension"); + } + + if (project.cargokit.libname == null) { + throw new GradleException("Property 'libname' must be set on cargokit extension"); + } + + def executableName = Os.isFamily(Os.FAMILY_WINDOWS) ? "run_build_tool.cmd" : "run_build_tool.sh" + def path = Paths.get(new File(pluginFile).parent, "..", executableName); + + def manifestDir = Paths.get(project.buildscript.sourceFile.parent, project.cargokit.manifestDir) + + def rootProjectDir = project.rootProject.projectDir + + if (!Os.isFamily(Os.FAMILY_WINDOWS)) { + project.exec { + commandLine 'chmod', '+x', path + } + } + + project.exec { + executable path + args "build-gradle" + environment "CARGOKIT_ROOT_PROJECT_DIR", rootProjectDir + environment "CARGOKIT_TOOL_TEMP_DIR", "${buildDir}/build_tool" + environment "CARGOKIT_MANIFEST_DIR", manifestDir + environment "CARGOKIT_CONFIGURATION", buildMode + environment "CARGOKIT_TARGET_TEMP_DIR", buildDir + environment "CARGOKIT_OUTPUT_DIR", outputDir + environment "CARGOKIT_NDK_VERSION", ndkVersion + environment "CARGOKIT_SDK_DIR", sdkDirectory + environment "CARGOKIT_COMPILE_SDK_VERSION", compileSdkVersion + environment "CARGOKIT_MIN_SDK_VERSION", minSdkVersion + environment "CARGOKIT_TARGET_PLATFORMS", targetPlatforms.join(",") + environment "CARGOKIT_JAVA_HOME", System.properties['java.home'] + } + } +} + +class CargoKitPlugin implements Plugin { + + static String file; + + private Plugin findFlutterPlugin(Project rootProject) { + _findFlutterPlugin(rootProject.childProjects) + } + + private Plugin _findFlutterPlugin(Map projects) { + for (project in projects) { + for (plugin in project.value.getPlugins()) { + if (plugin.class.name == "FlutterPlugin") { + return plugin; + } + } + def plugin = _findFlutterPlugin(project.value.childProjects); + if (plugin != null) { + return plugin; + } + } + return null; + } + + @Override + void apply(Project project) { + def plugin = findFlutterPlugin(project.rootProject); + + project.extensions.create("cargokit", CargoKitExtension) + + if (plugin == null) { + print("Flutter plugin not found, CargoKit plugin will not be applied.") + return; + } + + def cargoBuildDir = "${project.buildDir}/build" + + plugin.project.android.applicationVariants.all { variant -> + + final buildType = variant.buildType.name + + def cargoOutputDir = "${project.buildDir}/jniLibs/${buildType}"; + def jniLibs = project.android.sourceSets.maybeCreate(buildType).jniLibs; + jniLibs.srcDir(new File(cargoOutputDir)) + + def platforms = plugin.getTargetPlatforms().collect() + + // Same thing addFlutterDependencies does in flutter.gradle + if (buildType == "debug") { + platforms.add("android-x86") + platforms.add("android-x64") + } + + // The task name depends on plugin properties, which are not available + // at this point + project.getGradle().afterProject { + def taskName = "cargokitCargoBuild${project.cargokit.libname.capitalize()}${buildType.capitalize()}"; + + if (project.tasks.findByName(taskName)) { + return + } + + if (plugin.project.android.ndkVersion == null) { + throw new GradleException("Please set 'android.ndkVersion' in 'app/build.gradle'.") + } + + def task = project.tasks.create(taskName, CargoKitBuildTask.class) { + buildMode = variant.buildType.name + buildDir = cargoBuildDir + outputDir = cargoOutputDir + ndkVersion = plugin.project.android.ndkVersion + sdkDirectory = plugin.project.android.sdkDirectory + minSdkVersion = plugin.project.android.defaultConfig.minSdkVersion.apiLevel as int + compileSdkVersion = plugin.project.android.compileSdkVersion.substring(8) as int + targetPlatforms = platforms + pluginFile = CargoKitPlugin.file + } + def onTask = { newTask -> + if (newTask.name == "merge${buildType.capitalize()}NativeLibs") { + newTask.dependsOn task + // Fix gradle 7.4.2 not picking up JNI library changes + newTask.outputs.upToDateWhen { false } + } + } + project.tasks.each onTask + project.tasks.whenTaskAdded onTask + } + } + } +} diff --git a/rust_builder/cargokit/run_build_tool.cmd b/rust_builder/cargokit/run_build_tool.cmd new file mode 100644 index 00000000..c45d0aa8 --- /dev/null +++ b/rust_builder/cargokit/run_build_tool.cmd @@ -0,0 +1,91 @@ +@echo off +setlocal + +setlocal ENABLEDELAYEDEXPANSION + +SET BASEDIR=%~dp0 + +if not exist "%CARGOKIT_TOOL_TEMP_DIR%" ( + mkdir "%CARGOKIT_TOOL_TEMP_DIR%" +) +cd /D "%CARGOKIT_TOOL_TEMP_DIR%" + +SET BUILD_TOOL_PKG_DIR=%BASEDIR%build_tool +SET DART=%FLUTTER_ROOT%\bin\cache\dart-sdk\bin\dart + +set BUILD_TOOL_PKG_DIR_POSIX=%BUILD_TOOL_PKG_DIR:\=/% + +( + echo name: build_tool_runner + echo version: 1.0.0 + echo publish_to: none + echo. + echo environment: + echo sdk: '^>=3.0.0 ^<4.0.0' + echo. + echo dependencies: + echo build_tool: + echo path: %BUILD_TOOL_PKG_DIR_POSIX% +) >pubspec.yaml + +if not exist bin ( + mkdir bin +) + +( + echo import 'package:build_tool/build_tool.dart' as build_tool; + echo void main^(List^ args^) ^{ + echo build_tool.runMain^(args^); + echo ^} +) >bin\build_tool_runner.dart + +SET PRECOMPILED=bin\build_tool_runner.dill + +REM To detect changes in package we compare output of DIR /s (recursive) +set PREV_PACKAGE_INFO=.dart_tool\package_info.prev +set CUR_PACKAGE_INFO=.dart_tool\package_info.cur + +DIR "%BUILD_TOOL_PKG_DIR%" /s > "%CUR_PACKAGE_INFO%_orig" + +REM Last line in dir output is free space on harddrive. That is bound to +REM change between invocation so we need to remove it +( + Set "Line=" + For /F "UseBackQ Delims=" %%A In ("%CUR_PACKAGE_INFO%_orig") Do ( + SetLocal EnableDelayedExpansion + If Defined Line Echo !Line! + EndLocal + Set "Line=%%A") +) >"%CUR_PACKAGE_INFO%" +DEL "%CUR_PACKAGE_INFO%_orig" + +REM Compare current directory listing with previous +FC /B "%CUR_PACKAGE_INFO%" "%PREV_PACKAGE_INFO%" > nul 2>&1 + +If %ERRORLEVEL% neq 0 ( + REM Changed - copy current to previous and remove precompiled kernel + if exist "%PREV_PACKAGE_INFO%" ( + DEL "%PREV_PACKAGE_INFO%" + ) + MOVE /Y "%CUR_PACKAGE_INFO%" "%PREV_PACKAGE_INFO%" + if exist "%PRECOMPILED%" ( + DEL "%PRECOMPILED%" + ) +) + +REM There is no CUR_PACKAGE_INFO it was renamed in previous step to %PREV_PACKAGE_INFO% +REM which means we need to do pub get and precompile +if not exist "%PRECOMPILED%" ( + echo Running pub get in "%cd%" + "%DART%" pub get --no-precompile + "%DART%" compile kernel bin/build_tool_runner.dart +) + +"%DART%" "%PRECOMPILED%" %* + +REM 253 means invalid snapshot version. +If %ERRORLEVEL% equ 253 ( + "%DART%" pub get --no-precompile + "%DART%" compile kernel bin/build_tool_runner.dart + "%DART%" "%PRECOMPILED%" %* +) diff --git a/rust_builder/cargokit/run_build_tool.sh b/rust_builder/cargokit/run_build_tool.sh new file mode 100644 index 00000000..6e594a23 --- /dev/null +++ b/rust_builder/cargokit/run_build_tool.sh @@ -0,0 +1,94 @@ +#!/usr/bin/env bash + +set -e + +BASEDIR=$(dirname "$0") + +mkdir -p "$CARGOKIT_TOOL_TEMP_DIR" + +cd "$CARGOKIT_TOOL_TEMP_DIR" + +# Write a very simple bin package in temp folder that depends on build_tool package +# from Cargokit. This is done to ensure that we don't pollute Cargokit folder +# with .dart_tool contents. + +BUILD_TOOL_PKG_DIR="$BASEDIR/build_tool" + +if [[ -z $FLUTTER_ROOT ]]; then # not defined + DART=dart +else + DART="$FLUTTER_ROOT/bin/cache/dart-sdk/bin/dart" +fi + +cat << EOF > "pubspec.yaml" +name: build_tool_runner +version: 1.0.0 +publish_to: none + +environment: + sdk: '>=3.0.0 <4.0.0' + +dependencies: + build_tool: + path: "$BUILD_TOOL_PKG_DIR" +EOF + +mkdir -p "bin" + +cat << EOF > "bin/build_tool_runner.dart" +import 'package:build_tool/build_tool.dart' as build_tool; +void main(List args) { + build_tool.runMain(args); +} +EOF + +# Create alias for `shasum` if it does not exist and `sha1sum` exists +if ! [ -x "$(command -v shasum)" ] && [ -x "$(command -v sha1sum)" ]; then + shopt -s expand_aliases + alias shasum="sha1sum" +fi + +# Dart run will not cache any package that has a path dependency, which +# is the case for our build_tool_runner. So instead we precompile the package +# ourselves. +# To invalidate the cached kernel we use the hash of ls -LR of the build_tool +# package directory. This should be good enough, as the build_tool package +# itself is not meant to have any path dependencies. + +if [[ "$OSTYPE" == "darwin"* ]]; then + PACKAGE_HASH=$(ls -lTR "$BUILD_TOOL_PKG_DIR" | shasum) +else + PACKAGE_HASH=$(ls -lR --full-time "$BUILD_TOOL_PKG_DIR" | shasum) +fi + +PACKAGE_HASH_FILE=".package_hash" + +if [ -f "$PACKAGE_HASH_FILE" ]; then + EXISTING_HASH=$(cat "$PACKAGE_HASH_FILE") + if [ "$PACKAGE_HASH" != "$EXISTING_HASH" ]; then + rm "$PACKAGE_HASH_FILE" + fi +fi + +# Run pub get if needed. +if [ ! -f "$PACKAGE_HASH_FILE" ]; then + "$DART" pub get --no-precompile + "$DART" compile kernel bin/build_tool_runner.dart + echo "$PACKAGE_HASH" > "$PACKAGE_HASH_FILE" +fi + +set +e + +"$DART" bin/build_tool_runner.dill "$@" + +exit_code=$? + +# 253 means invalid snapshot version. +if [ $exit_code == 253 ]; then + "$DART" pub get --no-precompile + "$DART" compile kernel bin/build_tool_runner.dart + "$DART" bin/build_tool_runner.dill "$@" + exit_code=$? +fi + +exit $exit_code diff --git a/rust_builder/ios/Classes/dummy_file.c b/rust_builder/ios/Classes/dummy_file.c new file mode 100644 index 00000000..e06dab99 --- /dev/null +++ b/rust_builder/ios/Classes/dummy_file.c @@ -0,0 +1 @@ +// This is an empty file to force CocoaPods to create a framework. diff --git a/rust_builder/ios/rust_lib_aria.podspec b/rust_builder/ios/rust_lib_aria.podspec new file mode 100644 index 00000000..fa7964e3 --- /dev/null +++ b/rust_builder/ios/rust_lib_aria.podspec @@ -0,0 +1,45 @@ +# +# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html. +# Run `pod lib lint rust_lib_aria.podspec` to validate before publishing. +# +Pod::Spec.new do |s| + s.name = 'rust_lib_aria' + s.version = '0.0.1' + s.summary = 'A new Flutter FFI plugin project.' + s.description = <<-DESC +A new Flutter FFI plugin project. + DESC + s.homepage = 'http://example.com' + s.license = { :file => '../LICENSE' } + s.author = { 'Your Company' => 'email@example.com' } + + # This will ensure the source files in Classes/ are included in the native + # builds of apps using this FFI plugin. Podspec does not support relative + # paths, so Classes contains a forwarder C file that relatively imports + # `../src/*` so that the C sources can be shared among all target platforms. + s.source = { :path => '.' } + s.source_files = 'Classes/**/*' + s.dependency 'Flutter' + s.platform = :ios, '11.0' + + # Flutter.framework does not contain a i386 slice. + s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386' } + s.swift_version = '5.0' + + s.script_phase = { + :name => 'Build Rust library', + # First argument is relative path to the `rust` folder, second is name of rust library + :script => 'sh "$PODS_TARGET_SRCROOT/../cargokit/build_pod.sh" ../../rust rust_lib_aria', + :execution_position => :before_compile, + :input_files => ['${BUILT_PRODUCTS_DIR}/cargokit_phony'], + # Let XCode know that the static library referenced in -force_load below is + # created by this build step. + :output_files => ["${BUILT_PRODUCTS_DIR}/librust_lib_aria.a"], + } + s.pod_target_xcconfig = { + 'DEFINES_MODULE' => 'YES', + # Flutter.framework does not contain a i386 slice. + 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386', + 'OTHER_LDFLAGS' => '-force_load ${BUILT_PRODUCTS_DIR}/librust_lib_aria.a', + } +end \ No newline at end of file diff --git a/rust_builder/linux/CMakeLists.txt b/rust_builder/linux/CMakeLists.txt new file mode 100644 index 00000000..86619305 --- /dev/null +++ b/rust_builder/linux/CMakeLists.txt @@ -0,0 +1,19 @@ +# The Flutter tooling requires that developers have CMake 3.10 or later +# installed. You should not increase this version, as doing so will cause +# the plugin to fail to compile for some customers of the plugin. +cmake_minimum_required(VERSION 3.10) + +# Project-level configuration. +set(PROJECT_NAME "rust_lib_aria") +project(${PROJECT_NAME} LANGUAGES CXX) + +include("../cargokit/cmake/cargokit.cmake") +apply_cargokit(${PROJECT_NAME} ../../rust rust_lib_aria "") + +# List of absolute paths to libraries that should be bundled with the plugin. +# This list could contain prebuilt libraries, or libraries created by an +# external build triggered from this build file. +set(rust_lib_aria_bundled_libraries + "${${PROJECT_NAME}_cargokit_lib}" + PARENT_SCOPE +) diff --git a/rust_builder/macos/Classes/dummy_file.c b/rust_builder/macos/Classes/dummy_file.c new file mode 100644 index 00000000..e06dab99 --- /dev/null +++ b/rust_builder/macos/Classes/dummy_file.c @@ -0,0 +1 @@ +// This is an empty file to force CocoaPods to create a framework. diff --git a/rust_builder/macos/rust_lib_aria.podspec b/rust_builder/macos/rust_lib_aria.podspec new file mode 100644 index 00000000..2dfb2b1c --- /dev/null +++ b/rust_builder/macos/rust_lib_aria.podspec @@ -0,0 +1,44 @@ +# +# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html. +# Run `pod lib lint rust_lib_aria.podspec` to validate before publishing. +# +Pod::Spec.new do |s| + s.name = 'rust_lib_aria' + s.version = '0.0.1' + s.summary = 'A new Flutter FFI plugin project.' + s.description = <<-DESC +A new Flutter FFI plugin project. + DESC + s.homepage = 'http://example.com' + s.license = { :file => '../LICENSE' } + s.author = { 'Your Company' => 'email@example.com' } + + # This will ensure the source files in Classes/ are included in the native + # builds of apps using this FFI plugin. Podspec does not support relative + # paths, so Classes contains a forwarder C file that relatively imports + # `../src/*` so that the C sources can be shared among all target platforms. + s.source = { :path => '.' } + s.source_files = 'Classes/**/*' + s.dependency 'FlutterMacOS' + + s.platform = :osx, '10.11' + s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' } + s.swift_version = '5.0' + + s.script_phase = { + :name => 'Build Rust library', + # First argument is relative path to the `rust` folder, second is name of rust library + :script => 'sh "$PODS_TARGET_SRCROOT/../cargokit/build_pod.sh" ../../rust rust_lib_aria', + :execution_position => :before_compile, + :input_files => ['${BUILT_PRODUCTS_DIR}/cargokit_phony'], + # Let XCode know that the static library referenced in -force_load below is + # created by this build step. + :output_files => ["${BUILT_PRODUCTS_DIR}/librust_lib_aria.a"], + } + s.pod_target_xcconfig = { + 'DEFINES_MODULE' => 'YES', + # Flutter.framework does not contain a i386 slice. + 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386', + 'OTHER_LDFLAGS' => '-force_load ${BUILT_PRODUCTS_DIR}/librust_lib_aria.a', + } +end \ No newline at end of file diff --git a/rust_builder/pubspec.yaml b/rust_builder/pubspec.yaml new file mode 100644 index 00000000..eb5c0be4 --- /dev/null +++ b/rust_builder/pubspec.yaml @@ -0,0 +1,34 @@ +name: rust_lib_aria +description: "Utility to build Rust code" +version: 0.0.1 +publish_to: none + +environment: + sdk: '>=3.3.0 <4.0.0' + flutter: '>=3.3.0' + +dependencies: + flutter: + sdk: flutter + plugin_platform_interface: ^2.0.2 + +dev_dependencies: + ffi: ^2.0.2 + ffigen: ^11.0.0 + flutter_test: + sdk: flutter + flutter_lints: ^2.0.0 + +flutter: + plugin: + platforms: + android: + ffiPlugin: true + ios: + ffiPlugin: true + linux: + ffiPlugin: true + macos: + ffiPlugin: true + windows: + ffiPlugin: true diff --git a/rust_builder/windows/.gitignore b/rust_builder/windows/.gitignore new file mode 100644 index 00000000..b3eb2be1 --- /dev/null +++ b/rust_builder/windows/.gitignore @@ -0,0 +1,17 @@ +flutter/ + +# Visual Studio user-specific files. +*.suo +*.user +*.userosscache +*.sln.docstates + +# Visual Studio build-related files. +x64/ +x86/ + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ diff --git a/rust_builder/windows/CMakeLists.txt b/rust_builder/windows/CMakeLists.txt new file mode 100644 index 00000000..f4d07587 --- /dev/null +++ b/rust_builder/windows/CMakeLists.txt @@ -0,0 +1,20 @@ +# The Flutter tooling requires that developers have a version of Visual Studio +# installed that includes CMake 3.14 or later. You should not increase this +# version, as doing so will cause the plugin to fail to compile for some +# customers of the plugin. +cmake_minimum_required(VERSION 3.14) + +# Project-level configuration. +set(PROJECT_NAME "rust_lib_aria") +project(${PROJECT_NAME} LANGUAGES CXX) + +include("../cargokit/cmake/cargokit.cmake") +apply_cargokit(${PROJECT_NAME} ../../../../../../rust rust_lib_aria "") + +# List of absolute paths to libraries that should be bundled with the plugin. +# This list could contain prebuilt libraries, or libraries created by an +# external build triggered from this build file. +set(rust_lib_aria_bundled_libraries + "${${PROJECT_NAME}_cargokit_lib}" + PARENT_SCOPE +) diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake index 6271f1e5..e8a5f0e3 100644 --- a/windows/flutter/generated_plugins.cmake +++ b/windows/flutter/generated_plugins.cmake @@ -11,6 +11,7 @@ list(APPEND FLUTTER_PLUGIN_LIST ) list(APPEND FLUTTER_FFI_PLUGIN_LIST + rust_lib_aria ) set(PLUGIN_BUNDLED_LIBRARIES)