roda-project 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. checksums.yaml +7 -0
  2. data/bin/console +11 -0
  3. data/bin/roda-project +6 -0
  4. data/bin/roda-project.rb +9 -0
  5. data/bin/setup +8 -0
  6. data/lib/roda/project/cli.rb +134 -0
  7. data/lib/roda/project/context.rb +136 -0
  8. data/lib/roda/project/helpers/ids.rb +15 -0
  9. data/lib/roda/project/helpers/input.rb +20 -0
  10. data/lib/roda/project/helpers/template.rb +37 -0
  11. data/lib/roda/project/version.rb +7 -0
  12. data/lib/roda/project.rb +54 -0
  13. data/lib/roda/templates/base/app/app.rb.erb +87 -0
  14. data/lib/roda/templates/base/scaffold/AGENTS.md +9 -0
  15. data/lib/roda/templates/base/scaffold/Gemfile.erb +51 -0
  16. data/lib/roda/templates/base/scaffold/Guardfile +25 -0
  17. data/lib/roda/templates/base/scaffold/README.md +29 -0
  18. data/lib/roda/templates/base/scaffold/Rakefile.erb +209 -0
  19. data/lib/roda/templates/base/scaffold/app/config/config.rb.erb +25 -0
  20. data/lib/roda/templates/base/scaffold/app/config/locales/en.yml +273 -0
  21. data/lib/roda/templates/base/scaffold/app/config/locales/foo/en.yml +2 -0
  22. data/lib/roda/templates/base/scaffold/app/config/locales/foo/pt-br.yml +2 -0
  23. data/lib/roda/templates/base/scaffold/app/config/locales/pt-br.yml +244 -0
  24. data/lib/roda/templates/base/scaffold/app/config/providers/logger.rb +9 -0
  25. data/lib/roda/templates/base/scaffold/app/config/providers/mailer.rb +11 -0
  26. data/lib/roda/templates/base/scaffold/app/routes/foo.rb.erb +7 -0
  27. data/lib/roda/templates/base/scaffold/boot.rb.erb +35 -0
  28. data/lib/roda/templates/base/scaffold/config.ru.erb +13 -0
  29. data/lib/roda/templates/base/scaffold/public/css/app.css +1 -0
  30. data/lib/roda/templates/base/scaffold/public/exception_page.css +16 -0
  31. data/lib/roda/templates/base/scaffold/public/images/roda-project.png +0 -0
  32. data/lib/roda/templates/base/scaffold/public/js/app.js +27 -0
  33. data/lib/roda/templates/database/app/config/providers/db/conn.rb +15 -0
  34. data/lib/roda/templates/database/db/seeds.rb +1 -0
  35. data/lib/roda/templates/front-end/app/assets/css/app.css +20 -0
  36. data/lib/roda/templates/front-end/app/assets/js/app.js +7 -0
  37. data/lib/roda/templates/front-end/app/assets/js/some/foo.js +5 -0
  38. data/lib/roda/templates/front-end/app/views/foo/bar.erb +1 -0
  39. data/lib/roda/templates/front-end/app/views/foo/html.rb +6 -0
  40. data/lib/roda/templates/front-end/app/views/html.rb +22 -0
  41. data/lib/roda/templates/front-end/app/views/index.erb +1 -0
  42. data/lib/roda/templates/front-end/app/views/layout.erb +13 -0
  43. data/lib/roda/templates/front-end/esbuild.js +39 -0
  44. data/lib/roda/templates/front-end/package.json +20 -0
  45. data/lib/roda/templates/rodauth/app/models/account.rb +2 -0
  46. data/lib/roda/templates/rodauth/app/views/create-account.erb +9 -0
  47. data/lib/roda/templates/rodauth/db/migrations/001_add_rodauth.rb +71 -0
  48. data/lib/roda/templates/tests/minitest/spec/app/app_spec.rb.erb +15 -0
  49. data/lib/roda/templates/tests/minitest/spec/app/routes/foo_spec.rb +8 -0
  50. data/lib/roda/templates/tests/minitest/spec/app/routes/test_branch_spec.rb +4 -0
  51. data/lib/roda/templates/tests/minitest/spec/app/views/html_spec.rb +0 -0
  52. data/lib/roda/templates/tests/minitest/spec/spec_helper.rb.erb +33 -0
  53. data/lib/roda/templates/tests/rspec/spec/app/app_spec.rb.erb +15 -0
  54. data/lib/roda/templates/tests/rspec/spec/app/routes/foo_spec.rb +8 -0
  55. data/lib/roda/templates/tests/rspec/spec/app/routes/test_branch_spec.rb +4 -0
  56. data/lib/roda/templates/tests/rspec/spec/app/views/html_spec.rb +0 -0
  57. data/lib/roda/templates/tests/rspec/spec/spec_helper.rb.erb +19 -0
  58. metadata +142 -0
@@ -0,0 +1,244 @@
1
+ hello:
2
+ message: Olá mundo
3
+ rodauth:
4
+ #account_expiration_error_flash: Não é possível acessar essa conta, pois ela expirou
5
+ #active_sessions_error_flash: Essa sessão foi encerrada
6
+ #add_recovery_codes_button: Adicionar autenticação por códigos de recuperação
7
+ #add_recovery_codes_error_flash: Não foi possível adicionar os códigos de recuperação
8
+ #add_recovery_codes_heading: "<h2>Adicionar mais Códigos de Recuperação</h2>"
9
+ #add_recovery_codes_page_title: Autenticação por Códigos de Recuperação
10
+ #already_an_account_with_this_login_message: já existe uma conta com esse login
11
+ #attempt_to_create_unverified_account_error_flash: A conta que você tentou criar está aguardando verificação
12
+ #attempt_to_login_to_unverified_account_error_flash: A conta que você tentou acessar está aguardando verificação
13
+ #change_login_button: Alterar Login
14
+ #change_login_error_flash: Houve um erro ao alterar seu login
15
+ #change_login_needs_verification_notice_flash: Foi enviado um link por email para você verificar a alteração de login
16
+ #change_login_notice_flash: Seu login foi alterado
17
+ #change_login_page_title: Alterar Login
18
+ #change_password_button: Alterar senha
19
+ #change_password_error_flash: Houve um erro ao alterar sua senha
20
+ #change_password_notice_flash: Sua senha foi alterada
21
+ #change_password_page_title: Alterar senha
22
+ #close_account_button: Fechar conta
23
+ #close_account_error_flash: Houve um erro ao fechar sua conta
24
+ #close_account_notice_flash: Sua conta foi fechada
25
+ #close_account_page_title: Fechar conta
26
+ #confirm_password_button: Confirmar senha
27
+ #confirm_password_error_flash: Houve um erro ao confirmar sua senha
28
+ #confirm_password_link_text: Digite a senha
29
+ #confirm_password_notice_flash: A senha foi confirmada
30
+ #confirm_password_page_title: Confirme a senha
31
+ #contains_null_byte_message: contém um byte nulo
32
+ create_account_button: Criar conta
33
+ #create_account_error_flash: Houve um erro ao criar sua conta
34
+ #create_account_link_text: Criar uma nova conta
35
+ #create_account_notice_flash: Sua conta foi criada
36
+ #create_account_page_title: Criar conta
37
+ #email_auth_email_recently_sent_error_flash: Recentemente foi enviado um link por email para você fazer login
38
+ #email_auth_email_sent_notice_flash: Um email com um link para fazer login em sua conta foi enviado
39
+ #email_auth_email_subject: Link de Login
40
+ #email_auth_error_flash: Houve um erro ao fazer login
41
+ #email_auth_page_title: Login
42
+ #email_auth_request_button: Enviar Link de Login por Email
43
+ #email_auth_request_error_flash: Houve um erro ao solicitar um link de autenticação por email
44
+ #email_subject_prefix: ''
45
+ #expired_jwt_access_token_message: token de acesso JWT expirado
46
+ #global_logout_label: Encerrar todas as sessões ativas?
47
+ #input_field_label_suffix: ''
48
+ #invalid_jwt_format_error_message: Formato JWT inválido ou claim no Authorization header
49
+ #invalid_password_message: senha inválida
50
+ #invalid_recovery_code_error_flash: Erro ao autenticar através do código de recuperação
51
+ #invalid_recovery_code_message: Código de recuperação inválido
52
+ #json_non_post_error_message: método não-POST usado na API JSON
53
+ #json_not_accepted_error_message: Accept Header não suportado. Você deve aceitar "application/json" ou um tipo de conteúdo compatível
54
+ #jwt_refresh_invalid_token_message: token JWT refresh inválido
55
+ #jwt_refresh_without_access_token_message: sem token JWT de acesso disponibilizado durante o refresh
56
+ #login_button: Login
57
+ #login_confirm_label: Confirmar %{login_label}
58
+ #login_does_not_meet_requirements_message: login inválido, não atende aos requisitos
59
+ #login_error_flash: Houve um erro ao fazer login
60
+ #login_form_footer_links_heading: <h2 class="rodauth-login-form-footer-links-heading">Outras opções</h2>
61
+ #login_label: Login
62
+ #login_lockout_error_flash: Essa conta está bloqueada no momento e não pode ser acessada
63
+ #login_not_valid_email_message: não é um endereço de e-mail válido
64
+ #login_notice_flash: Login realizado com sucesso
65
+ #login_page_title: Login
66
+ #login_too_long_message: máximo %{login_maximum_length} caracteres
67
+ #login_too_short_message: mínimo %{login_minimum_length} caracteres
68
+ #logins_do_not_match_message: os logins não conferem
69
+ #logout_button: Encerrar sessão
70
+ #logout_notice_flash: Sua sessão foi encerrada
71
+ #logout_page_title: Encerrar sessão
72
+ #multi_phase_login_page_title: Login
73
+ #need_password_notice_flash: Login reconhecido, por favor digite sua senha
74
+ #new_password_label: Nova senha
75
+ #no_current_sms_code_error_flash: Nenhum código SMS configurado para essa conta
76
+ #no_matching_email_auth_key_error_flash: 'Houve um erro ao fazer login: chave de autenticação de email inválida'
77
+ #no_matching_login_message: sem login correspondente
78
+ #no_matching_reset_password_key_error_flash: 'Houve um erro ao redefinir sua senha: chave de redefinição inválida ou expirada'
79
+ #no_matching_unlock_account_key_error_flash: 'Houve um erro ao desbloquear sua conta: chave de desbloqueio inválida ou expirada'
80
+ #no_matching_verify_account_key_error_flash: 'Houve um erro ao verificar sua conta: chave de verificação de conta inválida'
81
+ #no_matching_verify_login_change_key_error_flash: 'Houve um erro ao verificar a alteração de login: chave de verificação para alteração de login inválida'
82
+ #non_json_request_error_message: Apenas requisições no formato JSON são permitidas
83
+ #otp_already_setup_error_flash: Você já configurou autenticação TOTP
84
+ #otp_auth_button: Autenticar utilizando TOTP
85
+ #otp_auth_error_flash: Erro ao fazer login através de autenticação TOTP
86
+ #otp_auth_form_footer: ''
87
+ #otp_auth_label: Código de Autenticação
88
+ #otp_auth_link_text: Autenticar utilizando TOTP
89
+ #otp_auth_page_title: Digite o código de autenticação
90
+ #otp_disable_button: Desativar Autenticação TOTP
91
+ #otp_disable_error_flash: Erro ao desativar autenticação TOTP
92
+ #otp_disable_link_text: Desativar Autenticação TOTP
93
+ #otp_disable_notice_flash: Autenticação TOTP foi desativada
94
+ #otp_invalid_auth_code_message: Código de autenticação inválido
95
+ #otp_invalid_secret_message: segredo inválido
96
+ #otp_lockout_error_flash: Código de autenticação TOTP foi bloqueado devido a várias tentativas falhadas
97
+ #otp_provisioning_uri_label: URL de Provisionamento
98
+ #otp_secret_label: Segredo
99
+ #otp_setup_button: Configurar Autenticação TOTP
100
+ #otp_setup_error_flash: Erro ao configurar autenticação TOTP
101
+ #otp_setup_link_text: Configurar Autenticação TOTP
102
+ #otp_setup_notice_flash: Autenticação TOTP está configurada
103
+ #otp_setup_page_title: Configurar Autenticação TOTP
104
+ #password_authentication_required_error_flash: Você precisa confirmar sua senha para continuar
105
+ #password_changed_email_subject: Senha alterada
106
+ #password_confirm_label: Confirmar %{password_label}
107
+ #password_does_not_meet_requirements_message: senha inválida, não atende aos requisitos
108
+ #password_expiration_error_flash: Sua senha expirou e precisa ser alterada
109
+ #password_in_dictionary_message: é uma palavra comum
110
+ #password_invalid_pattern_message: inclui uma sequência de caracteres comum
111
+ #password_is_one_of_the_most_common_message: é uma das senhas mais comuns
112
+ #password_label: Senha
113
+ #password_not_changeable_yet_error_flash: Sua senha ainda não pode ser alterada
114
+ #password_not_enough_character_groups_message: não inclui letras maiúsculas, letras minúsculas e números
115
+ #password_same_as_previous_password_message: igual à senha anterior
116
+ #password_too_many_repeating_characters_message: contém muitos caracteres repetidos sucessivamente
117
+ #password_too_short_message: mínimo %{password_minimum_length} caracteres
118
+ #passwords_do_not_match_message: as senhas não conferem
119
+ #recovery_auth_button: Autenticar por Código de Recuperação
120
+ #recovery_auth_link_text: Autenticar utilizando Código de Recuperação
121
+ #recovery_auth_page_title: Digite o Código de Recuperação
122
+ #recovery_codes_added_notice_flash: Foram adicionados mais Códigos de Recuperação
123
+ #recovery_codes_label: Código de Recuperação
124
+ #recovery_codes_link_text: Ver Códigos de Recuperação de Autenticação
125
+ #recovery_codes_page_title: Ver Códigos de Recuperação de Autenticação
126
+ #remember_button: Alterar configurações de "Lembrar-me"
127
+ #remember_disable_label: Desativar "Lembrar-me"
128
+ #remember_error_flash: Houve um erro ao atualizar sua configuração de "Lembrar-me"
129
+ #remember_forget_label: Não me lembrar
130
+ #remember_notice_flash: Sua configuração de "Lembrar-me" foi atualizada
131
+ #remember_page_title: Alterar configuração de "Lembrar-me"
132
+ #remember_remember_label: Lembrar-me
133
+ #require_login_error_flash: Por favor, faça login para continuar
134
+ #resend_verify_account_page_title: Reenviar Email de Verificação
135
+ #reset_password_button: Redefinir senha
136
+ #reset_password_email_recently_sent_error_flash: Recentemente foi enviado um email com um link para redefinir sua senha
137
+ #reset_password_email_sent_notice_flash: Um email com um link para redefinir sua senha foi enviado
138
+ #reset_password_email_subject: Redefinir senha
139
+ #reset_password_error_flash: Houve um erro ao redefinir sua senha
140
+ #reset_password_explanatory_text: "<p>Se você esqueceu sua senha, pode solicitar uma redefinição:</p>"
141
+ #reset_password_notice_flash: Sua senha foi redefinida
142
+ #reset_password_page_title: Redefinir senha
143
+ #reset_password_request_button: Solicitar redefinição de senha
144
+ #reset_password_request_error_flash: Houve um erro ao solicitar a redefinição de senha
145
+ #reset_password_request_link_text: Esqueceu sua senha?
146
+ #reset_password_request_page_title: Solicitar Redefinição de Senha
147
+ #same_as_current_login_message: igual ao login atual
148
+ #same_as_existing_password_message: senha inválida, igual à senha atual
149
+ #session_expiration_error_flash: Essa sessão expirou, por favor faça login novamente
150
+ #single_session_error_flash: Essa sessão foi encerrada porque outra sessão ficou ativa
151
+ #sms_already_setup_error_flash: Autenticação SMS já foi configurada
152
+ #sms_auth_button: Autenticar com código SMS
153
+ #sms_auth_link_text: Autenticar com código SMS
154
+ #sms_auth_page_title: Autenticar através de código SMS
155
+ #sms_code_label: Código SMS
156
+ #sms_confirm_button: Confirme o número para SMS de Backup
157
+ #sms_confirm_notice_flash: Autenticação SMS foi configurada
158
+ #sms_confirm_page_title: Confirme o número para SMS de Backup
159
+ #sms_disable_button: Desativar Autenticação de Backup por SMS
160
+ #sms_disable_error_flash: Erro ao desativar autenticação por SMS
161
+ #sms_disable_link_text: Desativar Autenticação por SMS
162
+ #sms_disable_notice_flash: Autenticação por SMS foi desativada
163
+ #sms_disable_page_title: Desativar Autenticação de Backup por SMS
164
+ #sms_invalid_code_error_flash: Erro ao autenticar com código SMS
165
+ #sms_invalid_code_message: código SMS inválido
166
+ #sms_invalid_confirmation_code_error_flash: Código de confirmação SMS inválido ou desatualizado, você deverá configurar autenticação SMS novamente
167
+ #sms_invalid_phone_message: número de telefone para SMS inválido
168
+ #sms_lockout_error_flash: Autenticação SMS foi bloqueada
169
+ #sms_needs_confirmation_error_flash: Autenticação SMS necessita de confirmação
170
+ #sms_not_setup_error_flash: Autenticação SMS ainda não foi configurada
171
+ #sms_phone_label: Número de Telefone
172
+ #sms_request_button: Enviar código SMS
173
+ #sms_request_notice_flash: Código de autenticação SMS foi enviado
174
+ #sms_request_page_title: Enviar código SMS
175
+ #sms_setup_button: Configurar número SMS de Backup
176
+ #sms_setup_error_flash: Erro ao configurar autenticação através de SMS
177
+ #sms_setup_link_text: Configurar Autenticação SMS de Backup
178
+ #sms_setup_page_title: Configurar número SMS de Backup
179
+ #two_factor_already_authenticated_error_flash: Você já foi autenticado através de autenticação multifator
180
+ #two_factor_auth_notice_flash: Você foi autenticado através de autenticação multifator
181
+ #two_factor_auth_page_title: Autenticar utilizando um fator adicional
182
+ #two_factor_disable_button: Remover todos os métodos de Autenticação Multifator
183
+ #two_factor_disable_error_flash: Não foi possível remover todos os métodos de autenticação multifator
184
+ #two_factor_disable_link_text: Remover todos os métodos de Autenticação Multifator
185
+ #two_factor_disable_notice_flash: Todos os métodos de Autenticação Multifator foram desativados
186
+ #two_factor_disable_page_title: Remover todos os métodos de Autenticação Multifator
187
+ #two_factor_manage_page_title: Gerenciar Autenticação Multifator
188
+ #two_factor_need_authentication_error_flash: Você precisa autenticar-se através de um fator adicional antes de continuar
189
+ #two_factor_not_setup_error_flash: Essa conta não foi configurada para autenticação multifator
190
+ #two_factor_remove_heading: "<h2>Remover Autenticação Multifator</h2>"
191
+ #two_factor_setup_heading: "<h2>Configurar Autenticação Multifator</h2>"
192
+ #unlock_account_button: Desbloquear Conta
193
+ #unlock_account_email_recently_sent_error_flash: Recentemente foi enviado um email com um link para desbloquear a conta
194
+ #unlock_account_email_subject: Desbloquear Conta
195
+ #unlock_account_error_flash: Houve um erro ao desbloquear sua conta
196
+ #unlock_account_explanatory_text: "<p>Essa conta está atualmente bloqueada. Você pode desbloquear a conta:</p>"
197
+ #unlock_account_notice_flash: Sua conta foi desbloqueada
198
+ #unlock_account_page_title: Desbloquear Conta
199
+ #unlock_account_request_button: Solicitar desbloqueio de conta
200
+ #unlock_account_request_explanatory_text: "<p>Essa conta está atualmente bloqueada. Você pode solicitar que a conta seja desbloqueada:</p>"
201
+ #unlock_account_request_notice_flash: Um email com um link para desbloquear a conta foi enviado
202
+ #unlock_account_request_page_title: Solicitar desbloqueio de conta
203
+ #unverified_account_message: conta não verificada, por favor verifique sua conta antes de fazer login
204
+ #unverified_change_login_error_flash: Por favor verifique essa conta antes de alterar o login
205
+ #verify_account_button: Verificar Conta
206
+ #verify_account_email_recently_sent_error_flash: Já foi enviado um email com um link para verificar sua conta recentemente
207
+ #verify_account_email_sent_notice_flash: Um email com um link para verificar sua conta foi enviado
208
+ #verify_account_email_subject: Verificar Conta
209
+ #verify_account_error_flash: Não foi possível verificar a conta
210
+ #verify_account_notice_flash: Sua conta foi verificada
211
+ #verify_account_page_title: Verificar Conta
212
+ #verify_account_resend_button: Reenviar email de verificação
213
+ #verify_account_resend_error_flash: Não foi possível reenviar o email de verificação de conta
214
+ #verify_account_resend_explanatory_text: "<p>Se você não possui mais o email para verificar a conta, pode solicitar que seja reenviado:</p>"
215
+ #verify_account_resend_link_text: Reenviar informação de verificação de conta
216
+ #verify_login_change_button: Verificar Alteração de Login
217
+ #verify_login_change_duplicate_account_error_flash: Não foi possível proceder à alteração de login porque já existe uma conta com o novo login
218
+ #verify_login_change_email_subject: Verificar Alteração de Login
219
+ #verify_login_change_error_flash: Não foi possível verificar a alteração de login
220
+ #verify_login_change_notice_flash: Sua alteração de login foi verificada
221
+ #verify_login_change_page_title: Verificar Alteração de Login
222
+ #view_recovery_codes_button: Ver códigos de recuperação para autenticação
223
+ #view_recovery_codes_error_flash: Não foi possível visualizar os códigos de recuperação
224
+ #webauthn_auth_button: Autenticar com WebAuthn
225
+ #webauthn_auth_error_flash: Erro ao autenticar com WebAuthn
226
+ #webauthn_auth_link_text: Autenticar com WebAuthn
227
+ #webauthn_auth_page_title: Autenticar com WebAuthn
228
+ #webauthn_duplicate_webauthn_id_message: tentativa de adicionar um ID webauthn duplicado
229
+ #webauthn_invalid_auth_param_message: parâmetro de autenticação webauthn inválido
230
+ #webauthn_invalid_remove_param_message: você deve selecionar um autenticador webauthn válido para remover
231
+ #webauthn_invalid_setup_param_message: parâmetro de configuração webauthn inválido
232
+ #webauthn_invalid_sign_count_message: credencial webauthn tem um sign count inválido
233
+ #webauthn_login_error_flash: Houve um erro ao autenticar utilizando WebAuthn
234
+ #webauthn_not_setup_error_flash: Essa conta não foi configurada para autenticação WebAuthn
235
+ #webauthn_remove_button: Remover Autenticador WebAuthn
236
+ #webauthn_remove_error_flash: Erro ao remover autenticador WebAuthn
237
+ #webauthn_remove_link_text: Remover autenticador WebAuthn
238
+ #webauthn_remove_notice_flash: O autenticador WebAuthn foi removido
239
+ #webauthn_remove_page_title: Remover Autenticador WebAuthn
240
+ #webauthn_setup_button: Configurar Autenticação WebAuthn
241
+ #webauthn_setup_error_flash: Erro ao configurar autenticação WebAuthn
242
+ #webauthn_setup_link_text: Configurar Autenticação WebAuthn
243
+ #webauthn_setup_notice_flash: Autenticação WebAuthn está agora configurada
244
+ #webauthn_setup_page_title: Configurar Autenticação WebAuthn
@@ -0,0 +1,9 @@
1
+ module Providers
2
+ module Logger
3
+ def self.boot
4
+ @logger = ::Logger.new($stdout)
5
+ end
6
+
7
+ def self.get = @logger
8
+ end
9
+ end
@@ -0,0 +1,11 @@
1
+ module Providers
2
+ module Mailer
3
+ def self.boot
4
+ ::Mail.defaults do
5
+ if Config.not_production?
6
+ delivery_method :logger
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,7 @@
1
+ class <%= context.const_project_name %>
2
+ branch "foo" do |r|
3
+ r.get "bar" do
4
+ <%= context.foo_bar_example %>
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,35 @@
1
+ require "bundler/setup"
2
+ Bundler.require
3
+
4
+ # require 'byebug' if ENV['RACK_ENV'] != 'production'
5
+
6
+ # Config file loads
7
+ loader = Zeitwerk::Loader.new
8
+ loader.push_dir("#{__dir__}/app")
9
+ loader.collapse("#{__dir__}/lib")
10
+ loader.collapse("#{__dir__}/app/services")
11
+ loader.collapse("#{__dir__}/app/config")<% if context.database %>
12
+ loader.inflector.inflect("db" => "DB")
13
+ loader.collapse("#{__dir__}/app/models")<% end %>
14
+
15
+ # [
16
+ # 'config',
17
+ # 'models',
18
+ # 'services',
19
+ # 'callbacks',
20
+ # 'actions'
21
+ # ].each do |path|
22
+ # loader.push_dir("#{__dir__}/app/#{path}")
23
+ # end
24
+ loader.setup
25
+ require "debug" if Config.not_production?
26
+
27
+ Oj.mimic_JSON
28
+
29
+ # Providers<% if context.database %>
30
+ Providers::DB::Conn.boot<% end %>
31
+ Providers::Mailer.boot
32
+ Providers::Logger.boot
33
+
34
+ # Consts<% if context.database %>
35
+ DB = Providers::DB::Conn.get<% end %>
@@ -0,0 +1,13 @@
1
+ require_relative "boot"
2
+
3
+ if Config.not_production?
4
+ require "rack-livereload"
5
+ require "guard/livereload"
6
+ use Rack::LiveReload
7
+ end
8
+
9
+ # Rack::Attack.throttle('signup/ip', limit: 3, period: 15.minutes) do |req|
10
+ # req.ip if req.path == '/signup'
11
+ # end
12
+ use Rack::Static, urls: ["/public"]
13
+ run <%= context.const_project_name %>
@@ -0,0 +1 @@
1
+ body{background:#000;color:#fff;margin:1em 2em;font-family:monospace}a{color:#ef4348;margin-right:1em}img{width:25%;margin-bottom:1em}.navbar{margin-bottom:1em}
@@ -0,0 +1,16 @@
1
+ body {
2
+ background-color: #191b1c;
3
+ color: white;
4
+ padding: 1em;
5
+ font-family: monospace;
6
+ }
7
+
8
+ a {
9
+ color: #ef4348;
10
+ }
11
+
12
+ .context {
13
+ background-color: #212121;
14
+ padding: 0.5em;
15
+ margin: 0.5em 0em 0.5em;
16
+ }
@@ -0,0 +1,27 @@
1
+ (()=>{(function(){if(window.Reflect===void 0||window.customElements===void 0||window.customElements.polyfillWrapFlushCallback)return;let s=HTMLElement,e={HTMLElement:function(){return Reflect.construct(s,[],this.constructor)}};window.HTMLElement=e.HTMLElement,HTMLElement.prototype=s.prototype,HTMLElement.prototype.constructor=HTMLElement,Object.setPrototypeOf(HTMLElement,s)})();(function(s){if(typeof s.requestSubmit=="function")return;s.requestSubmit=function(i){i?(e(i,this),i.click()):(i=document.createElement("input"),i.type="submit",i.hidden=!0,this.appendChild(i),i.click(),this.removeChild(i))};function e(i,r){i instanceof HTMLElement||t(TypeError,"parameter 1 is not of type 'HTMLElement'"),i.type=="submit"||t(TypeError,"The specified element is not a submit button"),i.form==r||t(DOMException,"The specified element is not owned by this form element","NotFoundError")}function t(i,r,n){throw new i("Failed to execute 'requestSubmit' on 'HTMLFormElement': "+r+".",n)}})(HTMLFormElement.prototype);var Pe=new WeakMap;function We(s){let e=s instanceof Element?s:s instanceof Node?s.parentElement:null,t=e?e.closest("input, button"):null;return t?.type=="submit"?t:null}function Ue(s){let e=We(s.target);e&&e.form&&Pe.set(e.form,e)}(function(){if("submitter"in Event.prototype)return;let s=window.Event.prototype;if("SubmitEvent"in window&&/Apple Computer/.test(navigator.vendor))s=window.SubmitEvent.prototype;else if("SubmitEvent"in window)return;addEventListener("click",Ue,!0),Object.defineProperty(s,"submitter",{get(){if(this.type=="submit"&&this.target instanceof HTMLFormElement)return Pe.get(this.target)}})})();var E;(function(s){s.eager="eager",s.lazy="lazy"})(E||(E={}));var g=class s extends HTMLElement{static get observedAttributes(){return["disabled","complete","loading","src"]}constructor(){super(),this.loaded=Promise.resolve(),this.delegate=new s.delegateConstructor(this)}connectedCallback(){this.delegate.connect()}disconnectedCallback(){this.delegate.disconnect()}reload(){return this.delegate.sourceURLReloaded()}attributeChangedCallback(e){e=="loading"?this.delegate.loadingStyleChanged():e=="complete"?this.delegate.completeChanged():e=="src"?this.delegate.sourceURLChanged():this.delegate.disabledChanged()}get src(){return this.getAttribute("src")}set src(e){e?this.setAttribute("src",e):this.removeAttribute("src")}get loading(){return je(this.getAttribute("loading")||"")}set loading(e){e?this.setAttribute("loading",e):this.removeAttribute("loading")}get disabled(){return this.hasAttribute("disabled")}set disabled(e){e?this.setAttribute("disabled",""):this.removeAttribute("disabled")}get autoscroll(){return this.hasAttribute("autoscroll")}set autoscroll(e){e?this.setAttribute("autoscroll",""):this.removeAttribute("autoscroll")}get complete(){return!this.delegate.isLoading}get isActive(){return this.ownerDocument===document&&!this.isPreview}get isPreview(){var e,t;return(t=(e=this.ownerDocument)===null||e===void 0?void 0:e.documentElement)===null||t===void 0?void 0:t.hasAttribute("data-turbo-preview")}};function je(s){switch(s.toLowerCase()){case"lazy":return E.lazy;default:return E.eager}}function c(s){return new URL(s.toString(),document.baseURI)}function y(s){let e;if(s.hash)return s.hash.slice(1);if(e=s.href.match(/#(.*)$/))return e[1]}function Le(s,e){let t=e?.getAttribute("formaction")||s.getAttribute("action")||s.action;return c(t)}function $e(s){return(Ye(s).match(/\.[^.]*$/)||[])[0]||""}function ze(s){return!!$e(s).match(/^(?:|\.(?:htm|html|xhtml|php))$/)}function Ke(s,e){let t=Je(e);return s.href===c(t).href||s.href.startsWith(t)}function C(s,e){return Ke(s,e)&&ze(s)}function G(s){let e=y(s);return e!=null?s.href.slice(0,-(e.length+1)):s.href}function D(s){return G(s)}function Qe(s,e){return c(s).href==c(e).href}function Xe(s){return s.pathname.split("/").slice(1)}function Ye(s){return Xe(s).slice(-1)[0]}function Je(s){return Ge(s.origin+s.pathname)}function Ge(s){return s.endsWith("/")?s:s+"/"}var k=class{constructor(e){this.response=e}get succeeded(){return this.response.ok}get failed(){return!this.succeeded}get clientError(){return this.statusCode>=400&&this.statusCode<=499}get serverError(){return this.statusCode>=500&&this.statusCode<=599}get redirected(){return this.response.redirected}get location(){return c(this.response.url)}get isHTML(){return this.contentType&&this.contentType.match(/^(?:text\/([^\s;,]+\b)?html|application\/xhtml\+xml)\b/)}get statusCode(){return this.response.status}get contentType(){return this.header("Content-Type")}get responseText(){return this.response.clone().text()}get responseHTML(){return this.isHTML?this.response.clone().text():Promise.resolve(void 0)}header(e){return this.response.headers.get(e)}};function F(s){if(s.getAttribute("data-turbo-eval")=="false")return s;{let e=document.createElement("script"),t=V("csp-nonce");return t&&(e.nonce=t),e.textContent=s.textContent,e.async=!1,Ze(e,s),e}}function Ze(s,e){for(let{name:t,value:i}of e.attributes)s.setAttribute(t,i)}function et(s){let e=document.createElement("template");return e.innerHTML=s,e.content}function l(s,{target:e,cancelable:t,detail:i}={}){let r=new CustomEvent(s,{cancelable:t,bubbles:!0,composed:!0,detail:i});return e&&e.isConnected?e.dispatchEvent(r):document.documentElement.dispatchEvent(r),r}function x(){return new Promise(s=>requestAnimationFrame(()=>s()))}function tt(){return new Promise(s=>setTimeout(()=>s(),0))}function st(){return Promise.resolve()}function ke(s=""){return new DOMParser().parseFromString(s,"text/html")}function Fe(s,...e){let t=it(s,e).replace(/^\n/,"").split(`
2
+ `),i=t[0].match(/^\s+/),r=i?i[0].length:0;return t.map(n=>n.slice(r)).join(`
3
+ `)}function it(s,e){return s.reduce((t,i,r)=>{let n=e[r]==null?"":e[r];return t+i+n},"")}function A(){return Array.from({length:36}).map((s,e)=>e==8||e==13||e==18||e==23?"-":e==14?"4":e==19?(Math.floor(Math.random()*4)+8).toString(16):Math.floor(Math.random()*15).toString(16)).join("")}function _(s,...e){for(let t of e.map(i=>i?.getAttribute(s)))if(typeof t=="string")return t;return null}function rt(s,...e){return e.some(t=>t&&t.hasAttribute(s))}function Z(...s){for(let e of s)e.localName=="turbo-frame"&&e.setAttribute("busy",""),e.setAttribute("aria-busy","true")}function ee(...s){for(let e of s)e.localName=="turbo-frame"&&e.removeAttribute("busy"),e.removeAttribute("aria-busy")}function nt(s,e=2e3){return new Promise(t=>{let i=()=>{s.removeEventListener("error",i),s.removeEventListener("load",i),t()};s.addEventListener("load",i,{once:!0}),s.addEventListener("error",i,{once:!0}),setTimeout(t,e)})}function Me(s){switch(s){case"replace":return history.replaceState;case"advance":case"restore":return history.pushState}}function ot(s){return s=="advance"||s=="replace"||s=="restore"}function Y(...s){let e=_("data-turbo-action",...s);return ot(e)?e:null}function Ie(s){return document.querySelector(`meta[name="${s}"]`)}function V(s){let e=Ie(s);return e&&e.content}function at(s,e){let t=Ie(s);return t||(t=document.createElement("meta"),t.setAttribute("name",s),document.head.appendChild(t)),t.setAttribute("content",e),t}function W(s,e){var t;if(s instanceof Element)return s.closest(e)||W(s.assignedSlot||((t=s.getRootNode())===null||t===void 0?void 0:t.host),e)}var d;(function(s){s[s.get=0]="get",s[s.post=1]="post",s[s.put=2]="put",s[s.patch=3]="patch",s[s.delete=4]="delete"})(d||(d={}));function lt(s){switch(s.toLowerCase()){case"get":return d.get;case"post":return d.post;case"put":return d.put;case"patch":return d.patch;case"delete":return d.delete}}var M=class{constructor(e,t,i,r=new URLSearchParams,n=null){this.abortController=new AbortController,this.resolveRequestPromise=o=>{},this.delegate=e,this.method=t,this.headers=this.defaultHeaders,this.body=r,this.url=i,this.target=n}get location(){return this.url}get params(){return this.url.searchParams}get entries(){return this.body?Array.from(this.body.entries()):[]}cancel(){this.abortController.abort()}async perform(){let{fetchOptions:e}=this;this.delegate.prepareRequest(this),await this.allowRequestToBeIntercepted(e);try{this.delegate.requestStarted(this);let t=await fetch(this.url.href,e);return await this.receive(t)}catch(t){if(t.name!=="AbortError")throw this.willDelegateErrorHandling(t)&&this.delegate.requestErrored(this,t),t}finally{this.delegate.requestFinished(this)}}async receive(e){let t=new k(e);return l("turbo:before-fetch-response",{cancelable:!0,detail:{fetchResponse:t},target:this.target}).defaultPrevented?this.delegate.requestPreventedHandlingResponse(this,t):t.succeeded?this.delegate.requestSucceededWithResponse(this,t):this.delegate.requestFailedWithResponse(this,t),t}get fetchOptions(){var e;return{method:d[this.method].toUpperCase(),credentials:"same-origin",headers:this.headers,redirect:"follow",body:this.isSafe?null:this.body,signal:this.abortSignal,referrer:(e=this.delegate.referrer)===null||e===void 0?void 0:e.href}}get defaultHeaders(){return{Accept:"text/html, application/xhtml+xml"}}get isSafe(){return this.method===d.get}get abortSignal(){return this.abortController.signal}acceptResponseType(e){this.headers.Accept=[e,this.headers.Accept].join(", ")}async allowRequestToBeIntercepted(e){let t=new Promise(r=>this.resolveRequestPromise=r);l("turbo:before-fetch-request",{cancelable:!0,detail:{fetchOptions:e,url:this.url,resume:this.resolveRequestPromise},target:this.target}).defaultPrevented&&await t}willDelegateErrorHandling(e){return!l("turbo:fetch-request-error",{target:this.target,cancelable:!0,detail:{request:this,error:e}}).defaultPrevented}},te=class{constructor(e,t){this.started=!1,this.intersect=i=>{let r=i.slice(-1)[0];r?.isIntersecting&&this.delegate.elementAppearedInViewport(this.element)},this.delegate=e,this.element=t,this.intersectionObserver=new IntersectionObserver(this.intersect)}start(){this.started||(this.started=!0,this.intersectionObserver.observe(this.element))}stop(){this.started&&(this.started=!1,this.intersectionObserver.unobserve(this.element))}},v=class{static wrap(e){return typeof e=="string"?new this(et(e)):e}constructor(e){this.fragment=ct(e)}};v.contentType="text/vnd.turbo-stream.html";function ct(s){for(let e of s.querySelectorAll("turbo-stream")){let t=document.importNode(e,!0);for(let i of t.templateElement.content.querySelectorAll("script"))i.replaceWith(F(i));e.replaceWith(t)}return s}var b;(function(s){s[s.initialized=0]="initialized",s[s.requesting=1]="requesting",s[s.waiting=2]="waiting",s[s.receiving=3]="receiving",s[s.stopping=4]="stopping",s[s.stopped=5]="stopped"})(b||(b={}));var w;(function(s){s.urlEncoded="application/x-www-form-urlencoded",s.multipart="multipart/form-data",s.plain="text/plain"})(w||(w={}));function ht(s){switch(s.toLowerCase()){case w.multipart:return w.multipart;case w.plain:return w.plain;default:return w.urlEncoded}}var I=class s{static confirmMethod(e,t,i){return Promise.resolve(confirm(e))}constructor(e,t,i,r=!1){this.state=b.initialized,this.delegate=e,this.formElement=t,this.submitter=i,this.formData=dt(t,i),this.location=c(this.action),this.method==d.get&&pt(this.location,[...this.body.entries()]),this.fetchRequest=new M(this,this.method,this.location,this.body,this.formElement),this.mustRedirect=r}get method(){var e;let t=((e=this.submitter)===null||e===void 0?void 0:e.getAttribute("formmethod"))||this.formElement.getAttribute("method")||"";return lt(t.toLowerCase())||d.get}get action(){var e;let t=typeof this.formElement.action=="string"?this.formElement.action:null;return!((e=this.submitter)===null||e===void 0)&&e.hasAttribute("formaction")?this.submitter.getAttribute("formaction")||"":this.formElement.getAttribute("action")||t||""}get body(){return this.enctype==w.urlEncoded||this.method==d.get?new URLSearchParams(this.stringFormData):this.formData}get enctype(){var e;return ht(((e=this.submitter)===null||e===void 0?void 0:e.getAttribute("formenctype"))||this.formElement.enctype)}get isSafe(){return this.fetchRequest.isSafe}get stringFormData(){return[...this.formData].reduce((e,[t,i])=>e.concat(typeof i=="string"?[[t,i]]:[]),[])}async start(){let{initialized:e,requesting:t}=b,i=_("data-turbo-confirm",this.submitter,this.formElement);if(!(typeof i=="string"&&!await s.confirmMethod(i,this.formElement,this.submitter))&&this.state==e)return this.state=t,this.fetchRequest.perform()}stop(){let{stopping:e,stopped:t}=b;if(this.state!=e&&this.state!=t)return this.state=e,this.fetchRequest.cancel(),!0}prepareRequest(e){if(!e.isSafe){let t=ut(V("csrf-param"))||V("csrf-token");t&&(e.headers["X-CSRF-Token"]=t)}this.requestAcceptsTurboStreamResponse(e)&&e.acceptResponseType(v.contentType)}requestStarted(e){var t;this.state=b.waiting,(t=this.submitter)===null||t===void 0||t.setAttribute("disabled",""),this.setSubmitsWith(),l("turbo:submit-start",{target:this.formElement,detail:{formSubmission:this}}),this.delegate.formSubmissionStarted(this)}requestPreventedHandlingResponse(e,t){this.result={success:t.succeeded,fetchResponse:t}}requestSucceededWithResponse(e,t){if(t.clientError||t.serverError)this.delegate.formSubmissionFailedWithResponse(this,t);else if(this.requestMustRedirect(e)&&mt(t)){let i=new Error("Form responses must redirect to another location");this.delegate.formSubmissionErrored(this,i)}else this.state=b.receiving,this.result={success:!0,fetchResponse:t},this.delegate.formSubmissionSucceededWithResponse(this,t)}requestFailedWithResponse(e,t){this.result={success:!1,fetchResponse:t},this.delegate.formSubmissionFailedWithResponse(this,t)}requestErrored(e,t){this.result={success:!1,error:t},this.delegate.formSubmissionErrored(this,t)}requestFinished(e){var t;this.state=b.stopped,(t=this.submitter)===null||t===void 0||t.removeAttribute("disabled"),this.resetSubmitterText(),l("turbo:submit-end",{target:this.formElement,detail:Object.assign({formSubmission:this},this.result)}),this.delegate.formSubmissionFinished(this)}setSubmitsWith(){if(!(!this.submitter||!this.submitsWith)){if(this.submitter.matches("button"))this.originalSubmitText=this.submitter.innerHTML,this.submitter.innerHTML=this.submitsWith;else if(this.submitter.matches("input")){let e=this.submitter;this.originalSubmitText=e.value,e.value=this.submitsWith}}}resetSubmitterText(){if(!(!this.submitter||!this.originalSubmitText)){if(this.submitter.matches("button"))this.submitter.innerHTML=this.originalSubmitText;else if(this.submitter.matches("input")){let e=this.submitter;e.value=this.originalSubmitText}}}requestMustRedirect(e){return!e.isSafe&&this.mustRedirect}requestAcceptsTurboStreamResponse(e){return!e.isSafe||rt("data-turbo-stream",this.submitter,this.formElement)}get submitsWith(){var e;return(e=this.submitter)===null||e===void 0?void 0:e.getAttribute("data-turbo-submits-with")}};function dt(s,e){let t=new FormData(s),i=e?.getAttribute("name"),r=e?.getAttribute("value");return i&&t.append(i,r||""),t}function ut(s){if(s!=null){let t=(document.cookie?document.cookie.split("; "):[]).find(i=>i.startsWith(s));if(t){let i=t.split("=").slice(1).join("=");return i?decodeURIComponent(i):void 0}}}function mt(s){return s.statusCode==200&&!s.redirected}function pt(s,e){let t=new URLSearchParams;for(let[i,r]of e)r instanceof File||t.append(i,r);return s.search=t.toString(),s}var P=class{constructor(e){this.element=e}get activeElement(){return this.element.ownerDocument.activeElement}get children(){return[...this.element.children]}hasAnchor(e){return this.getElementForAnchor(e)!=null}getElementForAnchor(e){return e?this.element.querySelector(`[id='${e}'], a[name='${e}']`):null}get isConnected(){return this.element.isConnected}get firstAutofocusableElement(){let e="[inert], :disabled, [hidden], details:not([open]), dialog:not([open])";for(let t of this.element.querySelectorAll("[autofocus]"))if(t.closest(e)==null)return t;return null}get permanentElements(){return qe(this.element)}getPermanentElementById(e){return He(this.element,e)}getPermanentElementMapForSnapshot(e){let t={};for(let i of this.permanentElements){let{id:r}=i,n=e.getPermanentElementById(r);n&&(t[r]=[i,n])}return t}};function He(s,e){return s.querySelector(`#${e}[data-turbo-permanent]`)}function qe(s){return s.querySelectorAll("[id][data-turbo-permanent]")}var H=class{constructor(e,t){this.started=!1,this.submitCaptured=()=>{this.eventTarget.removeEventListener("submit",this.submitBubbled,!1),this.eventTarget.addEventListener("submit",this.submitBubbled,!1)},this.submitBubbled=i=>{if(!i.defaultPrevented){let r=i.target instanceof HTMLFormElement?i.target:void 0,n=i.submitter||void 0;r&&ft(r,n)&&gt(r,n)&&this.delegate.willSubmitForm(r,n)&&(i.preventDefault(),i.stopImmediatePropagation(),this.delegate.formSubmitted(r,n))}},this.delegate=e,this.eventTarget=t}start(){this.started||(this.eventTarget.addEventListener("submit",this.submitCaptured,!0),this.started=!0)}stop(){this.started&&(this.eventTarget.removeEventListener("submit",this.submitCaptured,!0),this.started=!1)}};function ft(s,e){return(e?.getAttribute("formmethod")||s.getAttribute("method"))!="dialog"}function gt(s,e){if(e?.hasAttribute("formtarget")||s.hasAttribute("target")){let t=e?.getAttribute("formtarget")||s.target;for(let i of document.getElementsByName(t))if(i instanceof HTMLIFrameElement)return!1;return!0}else return!0}var U=class{constructor(e,t){this.resolveRenderPromise=i=>{},this.resolveInterceptionPromise=i=>{},this.delegate=e,this.element=t}scrollToAnchor(e){let t=this.snapshot.getElementForAnchor(e);t?(this.scrollToElement(t),this.focusElement(t)):this.scrollToPosition({x:0,y:0})}scrollToAnchorFromLocation(e){this.scrollToAnchor(y(e))}scrollToElement(e){e.scrollIntoView()}focusElement(e){e instanceof HTMLElement&&(e.hasAttribute("tabindex")?e.focus():(e.setAttribute("tabindex","-1"),e.focus(),e.removeAttribute("tabindex")))}scrollToPosition({x:e,y:t}){this.scrollRoot.scrollTo(e,t)}scrollToTop(){this.scrollToPosition({x:0,y:0})}get scrollRoot(){return window}async render(e){let{isPreview:t,shouldRender:i,newSnapshot:r}=e;if(i)try{this.renderPromise=new Promise(u=>this.resolveRenderPromise=u),this.renderer=e,await this.prepareToRenderSnapshot(e);let n=new Promise(u=>this.resolveInterceptionPromise=u),o={resume:this.resolveInterceptionPromise,render:this.renderer.renderElement};this.delegate.allowsImmediateRender(r,o)||await n,await this.renderSnapshot(e),this.delegate.viewRenderedSnapshot(r,t),this.delegate.preloadOnLoadLinksForView(this.element),this.finishRenderingSnapshot(e)}finally{delete this.renderer,this.resolveRenderPromise(void 0),delete this.renderPromise}else this.invalidate(e.reloadReason)}invalidate(e){this.delegate.viewInvalidated(e)}async prepareToRenderSnapshot(e){this.markAsPreview(e.isPreview),await e.prepareToRender()}markAsPreview(e){e?this.element.setAttribute("data-turbo-preview",""):this.element.removeAttribute("data-turbo-preview")}async renderSnapshot(e){await e.render()}finishRenderingSnapshot(e){e.finishRendering()}},se=class extends U{missing(){this.element.innerHTML='<strong class="turbo-frame-error">Content missing</strong>'}get snapshot(){return new P(this.element)}},j=class{constructor(e,t){this.clickBubbled=i=>{this.respondsToEventTarget(i.target)?this.clickEvent=i:delete this.clickEvent},this.linkClicked=i=>{this.clickEvent&&this.respondsToEventTarget(i.target)&&i.target instanceof Element&&this.delegate.shouldInterceptLinkClick(i.target,i.detail.url,i.detail.originalEvent)&&(this.clickEvent.preventDefault(),i.preventDefault(),this.delegate.linkClickIntercepted(i.target,i.detail.url,i.detail.originalEvent)),delete this.clickEvent},this.willVisit=i=>{delete this.clickEvent},this.delegate=e,this.element=t}start(){this.element.addEventListener("click",this.clickBubbled),document.addEventListener("turbo:click",this.linkClicked),document.addEventListener("turbo:before-visit",this.willVisit)}stop(){this.element.removeEventListener("click",this.clickBubbled),document.removeEventListener("turbo:click",this.linkClicked),document.removeEventListener("turbo:before-visit",this.willVisit)}respondsToEventTarget(e){let t=e instanceof Element?e:e instanceof Node?e.parentElement:null;return t&&t.closest("turbo-frame, html")==this.element}},$=class{constructor(e,t){this.started=!1,this.clickCaptured=()=>{this.eventTarget.removeEventListener("click",this.clickBubbled,!1),this.eventTarget.addEventListener("click",this.clickBubbled,!1)},this.clickBubbled=i=>{if(i instanceof MouseEvent&&this.clickEventIsSignificant(i)){let r=i.composedPath&&i.composedPath()[0]||i.target,n=this.findLinkFromClickTarget(r);if(n&&vt(n)){let o=this.getLocationForLink(n);this.delegate.willFollowLinkToLocation(n,o,i)&&(i.preventDefault(),this.delegate.followedLinkToLocation(n,o))}}},this.delegate=e,this.eventTarget=t}start(){this.started||(this.eventTarget.addEventListener("click",this.clickCaptured,!0),this.started=!0)}stop(){this.started&&(this.eventTarget.removeEventListener("click",this.clickCaptured,!0),this.started=!1)}clickEventIsSignificant(e){return!(e.target&&e.target.isContentEditable||e.defaultPrevented||e.which>1||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)}findLinkFromClickTarget(e){return W(e,"a[href]:not([target^=_]):not([download])")}getLocationForLink(e){return c(e.getAttribute("href")||"")}};function vt(s){if(s.hasAttribute("target")){for(let e of document.getElementsByName(s.target))if(e instanceof HTMLIFrameElement)return!1;return!0}else return!0}var z=class{constructor(e,t){this.delegate=e,this.linkInterceptor=new $(this,t)}start(){this.linkInterceptor.start()}stop(){this.linkInterceptor.stop()}willFollowLinkToLocation(e,t,i){return this.delegate.willSubmitFormLinkToLocation(e,t,i)&&e.hasAttribute("data-turbo-method")}followedLinkToLocation(e,t){let i=document.createElement("form"),r="hidden";for(let[T,O]of t.searchParams)i.append(Object.assign(document.createElement("input"),{type:r,name:T,value:O}));let n=Object.assign(t,{search:""});i.setAttribute("data-turbo","true"),i.setAttribute("action",n.href),i.setAttribute("hidden","");let o=e.getAttribute("data-turbo-method");o&&i.setAttribute("method",o);let h=e.getAttribute("data-turbo-frame");h&&i.setAttribute("data-turbo-frame",h);let u=Y(e);u&&i.setAttribute("data-turbo-action",u);let L=e.getAttribute("data-turbo-confirm");L&&i.setAttribute("data-turbo-confirm",L),e.hasAttribute("data-turbo-stream")&&i.setAttribute("data-turbo-stream",""),this.delegate.submittedFormLinkToLocation(e,t,i),document.body.appendChild(i),i.addEventListener("turbo:submit-end",()=>i.remove(),{once:!0}),requestAnimationFrame(()=>i.requestSubmit())}},K=class{static async preservingPermanentElements(e,t,i){let r=new this(e,t);r.enter(),await i(),r.leave()}constructor(e,t){this.delegate=e,this.permanentElementMap=t}enter(){for(let e in this.permanentElementMap){let[t,i]=this.permanentElementMap[e];this.delegate.enteringBardo(t,i),this.replaceNewPermanentElementWithPlaceholder(i)}}leave(){for(let e in this.permanentElementMap){let[t]=this.permanentElementMap[e];this.replaceCurrentPermanentElementWithClone(t),this.replacePlaceholderWithPermanentElement(t),this.delegate.leavingBardo(t)}}replaceNewPermanentElementWithPlaceholder(e){let t=bt(e);e.replaceWith(t)}replaceCurrentPermanentElementWithClone(e){let t=e.cloneNode(!0);e.replaceWith(t)}replacePlaceholderWithPermanentElement(e){let t=this.getPlaceholderById(e.id);t?.replaceWith(e)}getPlaceholderById(e){return this.placeholders.find(t=>t.content==e)}get placeholders(){return[...document.querySelectorAll("meta[name=turbo-permanent-placeholder][content]")]}};function bt(s){let e=document.createElement("meta");return e.setAttribute("name","turbo-permanent-placeholder"),e.setAttribute("content",s.id),e}var q=class{constructor(e,t,i,r,n=!0){this.activeElement=null,this.currentSnapshot=e,this.newSnapshot=t,this.isPreview=r,this.willRender=n,this.renderElement=i,this.promise=new Promise((o,h)=>this.resolvingFunctions={resolve:o,reject:h})}get shouldRender(){return!0}get reloadReason(){}prepareToRender(){}finishRendering(){this.resolvingFunctions&&(this.resolvingFunctions.resolve(),delete this.resolvingFunctions)}async preservingPermanentElements(e){await K.preservingPermanentElements(this,this.permanentElementMap,e)}focusFirstAutofocusableElement(){let e=this.connectedSnapshot.firstAutofocusableElement;wt(e)&&e.focus()}enteringBardo(e){this.activeElement||e.contains(this.currentSnapshot.activeElement)&&(this.activeElement=this.currentSnapshot.activeElement)}leavingBardo(e){e.contains(this.activeElement)&&this.activeElement instanceof HTMLElement&&(this.activeElement.focus(),this.activeElement=null)}get connectedSnapshot(){return this.newSnapshot.isConnected?this.newSnapshot:this.currentSnapshot}get currentElement(){return this.currentSnapshot.element}get newElement(){return this.newSnapshot.element}get permanentElementMap(){return this.currentSnapshot.getPermanentElementMapForSnapshot(this.newSnapshot)}};function wt(s){return s&&typeof s.focus=="function"}var B=class extends q{static renderElement(e,t){var i;let r=document.createRange();r.selectNodeContents(e),r.deleteContents();let n=t,o=(i=n.ownerDocument)===null||i===void 0?void 0:i.createRange();o&&(o.selectNodeContents(n),e.appendChild(o.extractContents()))}constructor(e,t,i,r,n,o=!0){super(t,i,r,n,o),this.delegate=e}get shouldRender(){return!0}async render(){await x(),this.preservingPermanentElements(()=>{this.loadFrameElement()}),this.scrollFrameIntoView(),await x(),this.focusFirstAutofocusableElement(),await x(),this.activateScriptElements()}loadFrameElement(){this.delegate.willRenderFrame(this.currentElement,this.newElement),this.renderElement(this.currentElement,this.newElement)}scrollFrameIntoView(){if(this.currentElement.autoscroll||this.newElement.autoscroll){let e=this.currentElement.firstElementChild,t=Et(this.currentElement.getAttribute("data-autoscroll-block"),"end"),i=St(this.currentElement.getAttribute("data-autoscroll-behavior"),"auto");if(e)return e.scrollIntoView({block:t,behavior:i}),!0}return!1}activateScriptElements(){for(let e of this.newScriptElements){let t=F(e);e.replaceWith(t)}}get newScriptElements(){return this.currentElement.querySelectorAll("script")}};function Et(s,e){return s=="end"||s=="start"||s=="center"||s=="nearest"?s:e}function St(s,e){return s=="auto"||s=="smooth"?s:e}var Q=class s{static get defaultCSS(){return Fe`
4
+ .turbo-progress-bar {
5
+ position: fixed;
6
+ display: block;
7
+ top: 0;
8
+ left: 0;
9
+ height: 3px;
10
+ background: #0076ff;
11
+ z-index: 2147483647;
12
+ transition:
13
+ width ${s.animationDuration}ms ease-out,
14
+ opacity ${s.animationDuration/2}ms ${s.animationDuration/2}ms ease-in;
15
+ transform: translate3d(0, 0, 0);
16
+ }
17
+ `}constructor(){this.hiding=!1,this.value=0,this.visible=!1,this.trickle=()=>{this.setValue(this.value+Math.random()/100)},this.stylesheetElement=this.createStylesheetElement(),this.progressElement=this.createProgressElement(),this.installStylesheetElement(),this.setValue(0)}show(){this.visible||(this.visible=!0,this.installProgressElement(),this.startTrickling())}hide(){this.visible&&!this.hiding&&(this.hiding=!0,this.fadeProgressElement(()=>{this.uninstallProgressElement(),this.stopTrickling(),this.visible=!1,this.hiding=!1}))}setValue(e){this.value=e,this.refresh()}installStylesheetElement(){document.head.insertBefore(this.stylesheetElement,document.head.firstChild)}installProgressElement(){this.progressElement.style.width="0",this.progressElement.style.opacity="1",document.documentElement.insertBefore(this.progressElement,document.body),this.refresh()}fadeProgressElement(e){this.progressElement.style.opacity="0",setTimeout(e,s.animationDuration*1.5)}uninstallProgressElement(){this.progressElement.parentNode&&document.documentElement.removeChild(this.progressElement)}startTrickling(){this.trickleInterval||(this.trickleInterval=window.setInterval(this.trickle,s.animationDuration))}stopTrickling(){window.clearInterval(this.trickleInterval),delete this.trickleInterval}refresh(){requestAnimationFrame(()=>{this.progressElement.style.width=`${10+this.value*90}%`})}createStylesheetElement(){let e=document.createElement("style");return e.type="text/css",e.textContent=s.defaultCSS,this.cspNonce&&(e.nonce=this.cspNonce),e}createProgressElement(){let e=document.createElement("div");return e.className="turbo-progress-bar",e}get cspNonce(){return V("csp-nonce")}};Q.animationDuration=300;var ie=class extends P{constructor(){super(...arguments),this.detailsByOuterHTML=this.children.filter(e=>!Rt(e)).map(e=>Pt(e)).reduce((e,t)=>{let{outerHTML:i}=t,r=i in e?e[i]:{type:yt(t),tracked:Lt(t),elements:[]};return Object.assign(Object.assign({},e),{[i]:Object.assign(Object.assign({},r),{elements:[...r.elements,t]})})},{})}get trackedElementSignature(){return Object.keys(this.detailsByOuterHTML).filter(e=>this.detailsByOuterHTML[e].tracked).join("")}getScriptElementsNotInSnapshot(e){return this.getElementsMatchingTypeNotInSnapshot("script",e)}getStylesheetElementsNotInSnapshot(e){return this.getElementsMatchingTypeNotInSnapshot("stylesheet",e)}getElementsMatchingTypeNotInSnapshot(e,t){return Object.keys(this.detailsByOuterHTML).filter(i=>!(i in t.detailsByOuterHTML)).map(i=>this.detailsByOuterHTML[i]).filter(({type:i})=>i==e).map(({elements:[i]})=>i)}get provisionalElements(){return Object.keys(this.detailsByOuterHTML).reduce((e,t)=>{let{type:i,tracked:r,elements:n}=this.detailsByOuterHTML[t];return i==null&&!r?[...e,...n]:n.length>1?[...e,...n.slice(1)]:e},[])}getMetaValue(e){let t=this.findMetaElementByName(e);return t?t.getAttribute("content"):null}findMetaElementByName(e){return Object.keys(this.detailsByOuterHTML).reduce((t,i)=>{let{elements:[r]}=this.detailsByOuterHTML[i];return At(r,e)?r:t},void 0)}};function yt(s){if(Tt(s))return"script";if(Ct(s))return"stylesheet"}function Lt(s){return s.getAttribute("data-turbo-track")=="reload"}function Tt(s){return s.localName=="script"}function Rt(s){return s.localName=="noscript"}function Ct(s){let e=s.localName;return e=="style"||e=="link"&&s.getAttribute("rel")=="stylesheet"}function At(s,e){return s.localName=="meta"&&s.getAttribute("name")==e}function Pt(s){return s.hasAttribute("nonce")&&s.setAttribute("nonce",""),s}var p=class s extends P{static fromHTMLString(e=""){return this.fromDocument(ke(e))}static fromElement(e){return this.fromDocument(e.ownerDocument)}static fromDocument({head:e,body:t}){return new this(t,new ie(e))}constructor(e,t){super(e),this.headSnapshot=t}clone(){let e=this.element.cloneNode(!0),t=this.element.querySelectorAll("select"),i=e.querySelectorAll("select");for(let[r,n]of t.entries()){let o=i[r];for(let h of o.selectedOptions)h.selected=!1;for(let h of n.selectedOptions)o.options[h.index].selected=!0}for(let r of e.querySelectorAll('input[type="password"]'))r.value="";return new s(e,this.headSnapshot)}get headElement(){return this.headSnapshot.element}get rootLocation(){var e;let t=(e=this.getSetting("root"))!==null&&e!==void 0?e:"/";return c(t)}get cacheControlValue(){return this.getSetting("cache-control")}get isPreviewable(){return this.cacheControlValue!="no-preview"}get isCacheable(){return this.cacheControlValue!="no-cache"}get isVisitable(){return this.getSetting("visit-control")!="reload"}getSetting(e){return this.headSnapshot.getMetaValue(`turbo-${e}`)}},R;(function(s){s.visitStart="visitStart",s.requestStart="requestStart",s.requestEnd="requestEnd",s.visitEnd="visitEnd"})(R||(R={}));var m;(function(s){s.initialized="initialized",s.started="started",s.canceled="canceled",s.failed="failed",s.completed="completed"})(m||(m={}));var kt={action:"advance",historyChanged:!1,visitCachedSnapshot:()=>{},willRender:!0,updateHistory:!0,shouldCacheSnapshot:!0,acceptsStreamResponse:!1},S;(function(s){s[s.networkFailure=0]="networkFailure",s[s.timeoutFailure=-1]="timeoutFailure",s[s.contentTypeMismatch=-2]="contentTypeMismatch"})(S||(S={}));var re=class{constructor(e,t,i,r={}){this.identifier=A(),this.timingMetrics={},this.followedRedirect=!1,this.historyChanged=!1,this.scrolled=!1,this.shouldCacheSnapshot=!0,this.acceptsStreamResponse=!1,this.snapshotCached=!1,this.state=m.initialized,this.delegate=e,this.location=t,this.restorationIdentifier=i||A();let{action:n,historyChanged:o,referrer:h,snapshot:u,snapshotHTML:L,response:J,visitCachedSnapshot:T,willRender:O,updateHistory:xe,shouldCacheSnapshot:_e,acceptsStreamResponse:Ve}=Object.assign(Object.assign({},kt),r);this.action=n,this.historyChanged=o,this.referrer=h,this.snapshot=u,this.snapshotHTML=L,this.response=J,this.isSamePage=this.delegate.locationWithActionIsSamePage(this.location,this.action),this.visitCachedSnapshot=T,this.willRender=O,this.updateHistory=xe,this.scrolled=!O,this.shouldCacheSnapshot=_e,this.acceptsStreamResponse=Ve}get adapter(){return this.delegate.adapter}get view(){return this.delegate.view}get history(){return this.delegate.history}get restorationData(){return this.history.getRestorationDataForIdentifier(this.restorationIdentifier)}get silent(){return this.isSamePage}start(){this.state==m.initialized&&(this.recordTimingMetric(R.visitStart),this.state=m.started,this.adapter.visitStarted(this),this.delegate.visitStarted(this))}cancel(){this.state==m.started&&(this.request&&this.request.cancel(),this.cancelRender(),this.state=m.canceled)}complete(){this.state==m.started&&(this.recordTimingMetric(R.visitEnd),this.state=m.completed,this.followRedirect(),this.followedRedirect||(this.adapter.visitCompleted(this),this.delegate.visitCompleted(this)))}fail(){this.state==m.started&&(this.state=m.failed,this.adapter.visitFailed(this))}changeHistory(){var e;if(!this.historyChanged&&this.updateHistory){let t=this.location.href===((e=this.referrer)===null||e===void 0?void 0:e.href)?"replace":this.action,i=Me(t);this.history.update(i,this.location,this.restorationIdentifier),this.historyChanged=!0}}issueRequest(){this.hasPreloadedResponse()?this.simulateRequest():this.shouldIssueRequest()&&!this.request&&(this.request=new M(this,d.get,this.location),this.request.perform())}simulateRequest(){this.response&&(this.startRequest(),this.recordResponse(),this.finishRequest())}startRequest(){this.recordTimingMetric(R.requestStart),this.adapter.visitRequestStarted(this)}recordResponse(e=this.response){if(this.response=e,e){let{statusCode:t}=e;Te(t)?this.adapter.visitRequestCompleted(this):this.adapter.visitRequestFailedWithStatusCode(this,t)}}finishRequest(){this.recordTimingMetric(R.requestEnd),this.adapter.visitRequestFinished(this)}loadResponse(){if(this.response){let{statusCode:e,responseHTML:t}=this.response;this.render(async()=>{this.shouldCacheSnapshot&&this.cacheSnapshot(),this.view.renderPromise&&await this.view.renderPromise,Te(e)&&t!=null?(await this.view.renderPage(p.fromHTMLString(t),!1,this.willRender,this),this.performScroll(),this.adapter.visitRendered(this),this.complete()):(await this.view.renderError(p.fromHTMLString(t),this),this.adapter.visitRendered(this),this.fail())})}}getCachedSnapshot(){let e=this.view.getCachedSnapshotForLocation(this.location)||this.getPreloadedSnapshot();if(e&&(!y(this.location)||e.hasAnchor(y(this.location)))&&(this.action=="restore"||e.isPreviewable))return e}getPreloadedSnapshot(){if(this.snapshotHTML)return p.fromHTMLString(this.snapshotHTML)}hasCachedSnapshot(){return this.getCachedSnapshot()!=null}loadCachedSnapshot(){let e=this.getCachedSnapshot();if(e){let t=this.shouldIssueRequest();this.render(async()=>{this.cacheSnapshot(),this.isSamePage?this.adapter.visitRendered(this):(this.view.renderPromise&&await this.view.renderPromise,await this.view.renderPage(e,t,this.willRender,this),this.performScroll(),this.adapter.visitRendered(this),t||this.complete())})}}followRedirect(){var e;this.redirectedToLocation&&!this.followedRedirect&&(!((e=this.response)===null||e===void 0)&&e.redirected)&&(this.adapter.visitProposedToLocation(this.redirectedToLocation,{action:"replace",response:this.response,shouldCacheSnapshot:!1,willRender:!1}),this.followedRedirect=!0)}goToSamePageAnchor(){this.isSamePage&&this.render(async()=>{this.cacheSnapshot(),this.performScroll(),this.changeHistory(),this.adapter.visitRendered(this)})}prepareRequest(e){this.acceptsStreamResponse&&e.acceptResponseType(v.contentType)}requestStarted(){this.startRequest()}requestPreventedHandlingResponse(e,t){}async requestSucceededWithResponse(e,t){let i=await t.responseHTML,{redirected:r,statusCode:n}=t;i==null?this.recordResponse({statusCode:S.contentTypeMismatch,redirected:r}):(this.redirectedToLocation=t.redirected?t.location:void 0,this.recordResponse({statusCode:n,responseHTML:i,redirected:r}))}async requestFailedWithResponse(e,t){let i=await t.responseHTML,{redirected:r,statusCode:n}=t;i==null?this.recordResponse({statusCode:S.contentTypeMismatch,redirected:r}):this.recordResponse({statusCode:n,responseHTML:i,redirected:r})}requestErrored(e,t){this.recordResponse({statusCode:S.networkFailure,redirected:!1})}requestFinished(){this.finishRequest()}performScroll(){!this.scrolled&&!this.view.forceReloaded&&(this.action=="restore"?this.scrollToRestoredPosition()||this.scrollToAnchor()||this.view.scrollToTop():this.scrollToAnchor()||this.view.scrollToTop(),this.isSamePage&&this.delegate.visitScrolledToSamePageLocation(this.view.lastRenderedLocation,this.location),this.scrolled=!0)}scrollToRestoredPosition(){let{scrollPosition:e}=this.restorationData;if(e)return this.view.scrollToPosition(e),!0}scrollToAnchor(){let e=y(this.location);if(e!=null)return this.view.scrollToAnchor(e),!0}recordTimingMetric(e){this.timingMetrics[e]=new Date().getTime()}getTimingMetrics(){return Object.assign({},this.timingMetrics)}getHistoryMethodForAction(e){switch(e){case"replace":return history.replaceState;case"advance":case"restore":return history.pushState}}hasPreloadedResponse(){return typeof this.response=="object"}shouldIssueRequest(){return this.isSamePage?!1:this.action=="restore"?!this.hasCachedSnapshot():this.willRender}cacheSnapshot(){this.snapshotCached||(this.view.cacheSnapshot(this.snapshot).then(e=>e&&this.visitCachedSnapshot(e)),this.snapshotCached=!0)}async render(e){this.cancelRender(),await new Promise(t=>{this.frame=requestAnimationFrame(()=>t())}),await e(),delete this.frame}cancelRender(){this.frame&&(cancelAnimationFrame(this.frame),delete this.frame)}};function Te(s){return s>=200&&s<300}var ne=class{constructor(e){this.progressBar=new Q,this.showProgressBar=()=>{this.progressBar.show()},this.session=e}visitProposedToLocation(e,t){this.navigator.startVisit(e,t?.restorationIdentifier||A(),t)}visitStarted(e){this.location=e.location,e.loadCachedSnapshot(),e.issueRequest(),e.goToSamePageAnchor()}visitRequestStarted(e){this.progressBar.setValue(0),e.hasCachedSnapshot()||e.action!="restore"?this.showVisitProgressBarAfterDelay():this.showProgressBar()}visitRequestCompleted(e){e.loadResponse()}visitRequestFailedWithStatusCode(e,t){switch(t){case S.networkFailure:case S.timeoutFailure:case S.contentTypeMismatch:return this.reload({reason:"request_failed",context:{statusCode:t}});default:return e.loadResponse()}}visitRequestFinished(e){this.progressBar.setValue(1),this.hideVisitProgressBar()}visitCompleted(e){}pageInvalidated(e){this.reload(e)}visitFailed(e){}visitRendered(e){}formSubmissionStarted(e){this.progressBar.setValue(0),this.showFormProgressBarAfterDelay()}formSubmissionFinished(e){this.progressBar.setValue(1),this.hideFormProgressBar()}showVisitProgressBarAfterDelay(){this.visitProgressBarTimeout=window.setTimeout(this.showProgressBar,this.session.progressBarDelay)}hideVisitProgressBar(){this.progressBar.hide(),this.visitProgressBarTimeout!=null&&(window.clearTimeout(this.visitProgressBarTimeout),delete this.visitProgressBarTimeout)}showFormProgressBarAfterDelay(){this.formProgressBarTimeout==null&&(this.formProgressBarTimeout=window.setTimeout(this.showProgressBar,this.session.progressBarDelay))}hideFormProgressBar(){this.progressBar.hide(),this.formProgressBarTimeout!=null&&(window.clearTimeout(this.formProgressBarTimeout),delete this.formProgressBarTimeout)}reload(e){var t;l("turbo:reload",{detail:e}),window.location.href=((t=this.location)===null||t===void 0?void 0:t.toString())||window.location.href}get navigator(){return this.session.navigator}},oe=class{constructor(){this.selector="[data-turbo-temporary]",this.deprecatedSelector="[data-turbo-cache=false]",this.started=!1,this.removeTemporaryElements=e=>{for(let t of this.temporaryElements)t.remove()}}start(){this.started||(this.started=!0,addEventListener("turbo:before-cache",this.removeTemporaryElements,!1))}stop(){this.started&&(this.started=!1,removeEventListener("turbo:before-cache",this.removeTemporaryElements,!1))}get temporaryElements(){return[...document.querySelectorAll(this.selector),...this.temporaryElementsWithDeprecation]}get temporaryElementsWithDeprecation(){let e=document.querySelectorAll(this.deprecatedSelector);return e.length&&console.warn(`The ${this.deprecatedSelector} selector is deprecated and will be removed in a future version. Use ${this.selector} instead.`),[...e]}},ae=class{constructor(e,t){this.session=e,this.element=t,this.linkInterceptor=new j(this,t),this.formSubmitObserver=new H(this,t)}start(){this.linkInterceptor.start(),this.formSubmitObserver.start()}stop(){this.linkInterceptor.stop(),this.formSubmitObserver.stop()}shouldInterceptLinkClick(e,t,i){return this.shouldRedirect(e)}linkClickIntercepted(e,t,i){let r=this.findFrameElement(e);r&&r.delegate.linkClickIntercepted(e,t,i)}willSubmitForm(e,t){return e.closest("turbo-frame")==null&&this.shouldSubmit(e,t)&&this.shouldRedirect(e,t)}formSubmitted(e,t){let i=this.findFrameElement(e,t);i&&i.delegate.formSubmitted(e,t)}shouldSubmit(e,t){var i;let r=Le(e,t),n=this.element.ownerDocument.querySelector('meta[name="turbo-root"]'),o=c((i=n?.content)!==null&&i!==void 0?i:"/");return this.shouldRedirect(e,t)&&C(r,o)}shouldRedirect(e,t){if(e instanceof HTMLFormElement?this.session.submissionIsNavigatable(e,t):this.session.elementIsNavigatable(e)){let r=this.findFrameElement(e,t);return r?r!=e.closest("turbo-frame"):!1}else return!1}findFrameElement(e,t){let i=t?.getAttribute("data-turbo-frame")||e.getAttribute("data-turbo-frame");if(i&&i!="_top"){let r=this.element.querySelector(`#${i}:not([disabled])`);if(r instanceof g)return r}}},le=class{constructor(e){this.restorationIdentifier=A(),this.restorationData={},this.started=!1,this.pageLoaded=!1,this.onPopState=t=>{if(this.shouldHandlePopState()){let{turbo:i}=t.state||{};if(i){this.location=new URL(window.location.href);let{restorationIdentifier:r}=i;this.restorationIdentifier=r,this.delegate.historyPoppedToLocationWithRestorationIdentifier(this.location,r)}}},this.onPageLoad=async t=>{await st(),this.pageLoaded=!0},this.delegate=e}start(){this.started||(addEventListener("popstate",this.onPopState,!1),addEventListener("load",this.onPageLoad,!1),this.started=!0,this.replace(new URL(window.location.href)))}stop(){this.started&&(removeEventListener("popstate",this.onPopState,!1),removeEventListener("load",this.onPageLoad,!1),this.started=!1)}push(e,t){this.update(history.pushState,e,t)}replace(e,t){this.update(history.replaceState,e,t)}update(e,t,i=A()){let r={turbo:{restorationIdentifier:i}};e.call(history,r,"",t.href),this.location=t,this.restorationIdentifier=i}getRestorationDataForIdentifier(e){return this.restorationData[e]||{}}updateRestorationData(e){let{restorationIdentifier:t}=this,i=this.restorationData[t];this.restorationData[t]=Object.assign(Object.assign({},i),e)}assumeControlOfScrollRestoration(){var e;this.previousScrollRestoration||(this.previousScrollRestoration=(e=history.scrollRestoration)!==null&&e!==void 0?e:"auto",history.scrollRestoration="manual")}relinquishControlOfScrollRestoration(){this.previousScrollRestoration&&(history.scrollRestoration=this.previousScrollRestoration,delete this.previousScrollRestoration)}shouldHandlePopState(){return this.pageIsLoaded()}pageIsLoaded(){return this.pageLoaded||document.readyState=="complete"}},ce=class{constructor(e){this.delegate=e}proposeVisit(e,t={}){this.delegate.allowsVisitingLocationWithAction(e,t.action)&&(C(e,this.view.snapshot.rootLocation)?this.delegate.visitProposedToLocation(e,t):window.location.href=e.toString())}startVisit(e,t,i={}){this.stop(),this.currentVisit=new re(this,c(e),t,Object.assign({referrer:this.location},i)),this.currentVisit.start()}submitForm(e,t){this.stop(),this.formSubmission=new I(this,e,t,!0),this.formSubmission.start()}stop(){this.formSubmission&&(this.formSubmission.stop(),delete this.formSubmission),this.currentVisit&&(this.currentVisit.cancel(),delete this.currentVisit)}get adapter(){return this.delegate.adapter}get view(){return this.delegate.view}get history(){return this.delegate.history}formSubmissionStarted(e){typeof this.adapter.formSubmissionStarted=="function"&&this.adapter.formSubmissionStarted(e)}async formSubmissionSucceededWithResponse(e,t){if(e==this.formSubmission){let i=await t.responseHTML;if(i){let r=e.isSafe;r||this.view.clearSnapshotCache();let{statusCode:n,redirected:o}=t,u={action:this.getActionForFormSubmission(e),shouldCacheSnapshot:r,response:{statusCode:n,responseHTML:i,redirected:o}};this.proposeVisit(t.location,u)}}}async formSubmissionFailedWithResponse(e,t){let i=await t.responseHTML;if(i){let r=p.fromHTMLString(i);t.serverError?await this.view.renderError(r,this.currentVisit):await this.view.renderPage(r,!1,!0,this.currentVisit),this.view.scrollToTop(),this.view.clearSnapshotCache()}}formSubmissionErrored(e,t){console.error(t)}formSubmissionFinished(e){typeof this.adapter.formSubmissionFinished=="function"&&this.adapter.formSubmissionFinished(e)}visitStarted(e){this.delegate.visitStarted(e)}visitCompleted(e){this.delegate.visitCompleted(e)}locationWithActionIsSamePage(e,t){let i=y(e),r=y(this.view.lastRenderedLocation),n=t==="restore"&&typeof i>"u";return t!=="replace"&&G(e)===G(this.view.lastRenderedLocation)&&(n||i!=null&&i!==r)}visitScrolledToSamePageLocation(e,t){this.delegate.visitScrolledToSamePageLocation(e,t)}get location(){return this.history.location}get restorationIdentifier(){return this.history.restorationIdentifier}getActionForFormSubmission({submitter:e,formElement:t}){return Y(e,t)||"advance"}},f;(function(s){s[s.initial=0]="initial",s[s.loading=1]="loading",s[s.interactive=2]="interactive",s[s.complete=3]="complete"})(f||(f={}));var he=class{constructor(e){this.stage=f.initial,this.started=!1,this.interpretReadyState=()=>{let{readyState:t}=this;t=="interactive"?this.pageIsInteractive():t=="complete"&&this.pageIsComplete()},this.pageWillUnload=()=>{this.delegate.pageWillUnload()},this.delegate=e}start(){this.started||(this.stage==f.initial&&(this.stage=f.loading),document.addEventListener("readystatechange",this.interpretReadyState,!1),addEventListener("pagehide",this.pageWillUnload,!1),this.started=!0)}stop(){this.started&&(document.removeEventListener("readystatechange",this.interpretReadyState,!1),removeEventListener("pagehide",this.pageWillUnload,!1),this.started=!1)}pageIsInteractive(){this.stage==f.loading&&(this.stage=f.interactive,this.delegate.pageBecameInteractive())}pageIsComplete(){this.pageIsInteractive(),this.stage==f.interactive&&(this.stage=f.complete,this.delegate.pageLoaded())}get readyState(){return document.readyState}},de=class{constructor(e){this.started=!1,this.onScroll=()=>{this.updatePosition({x:window.pageXOffset,y:window.pageYOffset})},this.delegate=e}start(){this.started||(addEventListener("scroll",this.onScroll,!1),this.onScroll(),this.started=!0)}stop(){this.started&&(removeEventListener("scroll",this.onScroll,!1),this.started=!1)}updatePosition(e){this.delegate.scrollPositionChanged(e)}},ue=class{render({fragment:e}){K.preservingPermanentElements(this,Ft(e),()=>document.documentElement.appendChild(e))}enteringBardo(e,t){t.replaceWith(e.cloneNode(!0))}leavingBardo(){}};function Ft(s){let e=qe(document.documentElement),t={};for(let i of e){let{id:r}=i;for(let n of s.querySelectorAll("turbo-stream")){let o=He(n.templateElement.content,r);o&&(t[r]=[i,o])}}return t}var me=class{constructor(e){this.sources=new Set,this.started=!1,this.inspectFetchResponse=t=>{let i=Mt(t);i&&It(i)&&(t.preventDefault(),this.receiveMessageResponse(i))},this.receiveMessageEvent=t=>{this.started&&typeof t.data=="string"&&this.receiveMessageHTML(t.data)},this.delegate=e}start(){this.started||(this.started=!0,addEventListener("turbo:before-fetch-response",this.inspectFetchResponse,!1))}stop(){this.started&&(this.started=!1,removeEventListener("turbo:before-fetch-response",this.inspectFetchResponse,!1))}connectStreamSource(e){this.streamSourceIsConnected(e)||(this.sources.add(e),e.addEventListener("message",this.receiveMessageEvent,!1))}disconnectStreamSource(e){this.streamSourceIsConnected(e)&&(this.sources.delete(e),e.removeEventListener("message",this.receiveMessageEvent,!1))}streamSourceIsConnected(e){return this.sources.has(e)}async receiveMessageResponse(e){let t=await e.responseHTML;t&&this.receiveMessageHTML(t)}receiveMessageHTML(e){this.delegate.receivedMessageFromStream(v.wrap(e))}};function Mt(s){var e;let t=(e=s.detail)===null||e===void 0?void 0:e.fetchResponse;if(t instanceof k)return t}function It(s){var e;return((e=s.contentType)!==null&&e!==void 0?e:"").startsWith(v.contentType)}var X=class extends q{static renderElement(e,t){let{documentElement:i,body:r}=document;i.replaceChild(t,r)}async render(){this.replaceHeadAndBody(),this.activateScriptElements()}replaceHeadAndBody(){let{documentElement:e,head:t}=document;e.replaceChild(this.newHead,t),this.renderElement(this.currentElement,this.newElement)}activateScriptElements(){for(let e of this.scriptElements){let t=e.parentNode;if(t){let i=F(e);t.replaceChild(i,e)}}}get newHead(){return this.newSnapshot.headSnapshot.element}get scriptElements(){return document.documentElement.querySelectorAll("script")}},N=class extends q{static renderElement(e,t){document.body&&t instanceof HTMLBodyElement?document.body.replaceWith(t):document.documentElement.appendChild(t)}get shouldRender(){return this.newSnapshot.isVisitable&&this.trackedElementsAreIdentical}get reloadReason(){if(!this.newSnapshot.isVisitable)return{reason:"turbo_visit_control_is_reload"};if(!this.trackedElementsAreIdentical)return{reason:"tracked_element_mismatch"}}async prepareToRender(){await this.mergeHead()}async render(){this.willRender&&await this.replaceBody()}finishRendering(){super.finishRendering(),this.isPreview||this.focusFirstAutofocusableElement()}get currentHeadSnapshot(){return this.currentSnapshot.headSnapshot}get newHeadSnapshot(){return this.newSnapshot.headSnapshot}get newElement(){return this.newSnapshot.element}async mergeHead(){let e=this.mergeProvisionalElements(),t=this.copyNewHeadStylesheetElements();this.copyNewHeadScriptElements(),await e,await t}async replaceBody(){await this.preservingPermanentElements(async()=>{this.activateNewBody(),await this.assignNewBody()})}get trackedElementsAreIdentical(){return this.currentHeadSnapshot.trackedElementSignature==this.newHeadSnapshot.trackedElementSignature}async copyNewHeadStylesheetElements(){let e=[];for(let t of this.newHeadStylesheetElements)e.push(nt(t)),document.head.appendChild(t);await Promise.all(e)}copyNewHeadScriptElements(){for(let e of this.newHeadScriptElements)document.head.appendChild(F(e))}async mergeProvisionalElements(){let e=[...this.newHeadProvisionalElements];for(let t of this.currentHeadProvisionalElements)this.isCurrentElementInElementList(t,e)||document.head.removeChild(t);for(let t of e)document.head.appendChild(t)}isCurrentElementInElementList(e,t){for(let[i,r]of t.entries()){if(e.tagName=="TITLE"){if(r.tagName!="TITLE")continue;if(e.innerHTML==r.innerHTML)return t.splice(i,1),!0}if(r.isEqualNode(e))return t.splice(i,1),!0}return!1}removeCurrentHeadProvisionalElements(){for(let e of this.currentHeadProvisionalElements)document.head.removeChild(e)}copyNewHeadProvisionalElements(){for(let e of this.newHeadProvisionalElements)document.head.appendChild(e)}activateNewBody(){document.adoptNode(this.newElement),this.activateNewBodyScriptElements()}activateNewBodyScriptElements(){for(let e of this.newBodyScriptElements){let t=F(e);e.replaceWith(t)}}async assignNewBody(){await this.renderElement(this.currentElement,this.newElement)}get newHeadStylesheetElements(){return this.newHeadSnapshot.getStylesheetElementsNotInSnapshot(this.currentHeadSnapshot)}get newHeadScriptElements(){return this.newHeadSnapshot.getScriptElementsNotInSnapshot(this.currentHeadSnapshot)}get currentHeadProvisionalElements(){return this.currentHeadSnapshot.provisionalElements}get newHeadProvisionalElements(){return this.newHeadSnapshot.provisionalElements}get newBodyScriptElements(){return this.newElement.querySelectorAll("script")}},pe=class{constructor(e){this.keys=[],this.snapshots={},this.size=e}has(e){return D(e)in this.snapshots}get(e){if(this.has(e)){let t=this.read(e);return this.touch(e),t}}put(e,t){return this.write(e,t),this.touch(e),t}clear(){this.snapshots={}}read(e){return this.snapshots[D(e)]}write(e,t){this.snapshots[D(e)]=t}touch(e){let t=D(e),i=this.keys.indexOf(t);i>-1&&this.keys.splice(i,1),this.keys.unshift(t),this.trim()}trim(){for(let e of this.keys.splice(this.size))delete this.snapshots[e]}},fe=class extends U{constructor(){super(...arguments),this.snapshotCache=new pe(10),this.lastRenderedLocation=new URL(location.href),this.forceReloaded=!1}renderPage(e,t=!1,i=!0,r){let n=new N(this.snapshot,e,N.renderElement,t,i);return n.shouldRender?r?.changeHistory():this.forceReloaded=!0,this.render(n)}renderError(e,t){t?.changeHistory();let i=new X(this.snapshot,e,X.renderElement,!1);return this.render(i)}clearSnapshotCache(){this.snapshotCache.clear()}async cacheSnapshot(e=this.snapshot){if(e.isCacheable){this.delegate.viewWillCacheSnapshot();let{lastRenderedLocation:t}=this;await tt();let i=e.clone();return this.snapshotCache.put(t,i),i}}getCachedSnapshotForLocation(e){return this.snapshotCache.get(e)}get snapshot(){return p.fromElement(this.element)}},ge=class{constructor(e){this.selector="a[data-turbo-preload]",this.delegate=e}get snapshotCache(){return this.delegate.navigator.view.snapshotCache}start(){if(document.readyState==="loading")return document.addEventListener("DOMContentLoaded",()=>{this.preloadOnLoadLinksForView(document.body)});this.preloadOnLoadLinksForView(document.body)}preloadOnLoadLinksForView(e){for(let t of e.querySelectorAll(this.selector))this.preloadURL(t)}async preloadURL(e){let t=new URL(e.href);if(!this.snapshotCache.has(t))try{let r=await(await fetch(t.toString(),{headers:{"VND.PREFETCH":"true",Accept:"text/html"}})).text(),n=p.fromHTMLString(r);this.snapshotCache.put(t,n)}catch{}}},ve=class{constructor(){this.navigator=new ce(this),this.history=new le(this),this.preloader=new ge(this),this.view=new fe(this,document.documentElement),this.adapter=new ne(this),this.pageObserver=new he(this),this.cacheObserver=new oe,this.linkClickObserver=new $(this,window),this.formSubmitObserver=new H(this,document),this.scrollObserver=new de(this),this.streamObserver=new me(this),this.formLinkClickObserver=new z(this,document.documentElement),this.frameRedirector=new ae(this,document.documentElement),this.streamMessageRenderer=new ue,this.drive=!0,this.enabled=!0,this.progressBarDelay=500,this.started=!1,this.formMode="on"}start(){this.started||(this.pageObserver.start(),this.cacheObserver.start(),this.formLinkClickObserver.start(),this.linkClickObserver.start(),this.formSubmitObserver.start(),this.scrollObserver.start(),this.streamObserver.start(),this.frameRedirector.start(),this.history.start(),this.preloader.start(),this.started=!0,this.enabled=!0)}disable(){this.enabled=!1}stop(){this.started&&(this.pageObserver.stop(),this.cacheObserver.stop(),this.formLinkClickObserver.stop(),this.linkClickObserver.stop(),this.formSubmitObserver.stop(),this.scrollObserver.stop(),this.streamObserver.stop(),this.frameRedirector.stop(),this.history.stop(),this.started=!1)}registerAdapter(e){this.adapter=e}visit(e,t={}){let i=t.frame?document.getElementById(t.frame):null;i instanceof g?(i.src=e.toString(),i.loaded):this.navigator.proposeVisit(c(e),t)}connectStreamSource(e){this.streamObserver.connectStreamSource(e)}disconnectStreamSource(e){this.streamObserver.disconnectStreamSource(e)}renderStreamMessage(e){this.streamMessageRenderer.render(v.wrap(e))}clearCache(){this.view.clearSnapshotCache()}setProgressBarDelay(e){this.progressBarDelay=e}setFormMode(e){this.formMode=e}get location(){return this.history.location}get restorationIdentifier(){return this.history.restorationIdentifier}historyPoppedToLocationWithRestorationIdentifier(e,t){this.enabled?this.navigator.startVisit(e,t,{action:"restore",historyChanged:!0}):this.adapter.pageInvalidated({reason:"turbo_disabled"})}scrollPositionChanged(e){this.history.updateRestorationData({scrollPosition:e})}willSubmitFormLinkToLocation(e,t){return this.elementIsNavigatable(e)&&C(t,this.snapshot.rootLocation)}submittedFormLinkToLocation(){}willFollowLinkToLocation(e,t,i){return this.elementIsNavigatable(e)&&C(t,this.snapshot.rootLocation)&&this.applicationAllowsFollowingLinkToLocation(e,t,i)}followedLinkToLocation(e,t){let i=this.getActionForLink(e),r=e.hasAttribute("data-turbo-stream");this.visit(t.href,{action:i,acceptsStreamResponse:r})}allowsVisitingLocationWithAction(e,t){return this.locationWithActionIsSamePage(e,t)||this.applicationAllowsVisitingLocation(e)}visitProposedToLocation(e,t){Re(e),this.adapter.visitProposedToLocation(e,t)}visitStarted(e){e.acceptsStreamResponse||Z(document.documentElement),Re(e.location),e.silent||this.notifyApplicationAfterVisitingLocation(e.location,e.action)}visitCompleted(e){ee(document.documentElement),this.notifyApplicationAfterPageLoad(e.getTimingMetrics())}locationWithActionIsSamePage(e,t){return this.navigator.locationWithActionIsSamePage(e,t)}visitScrolledToSamePageLocation(e,t){this.notifyApplicationAfterVisitingSamePageLocation(e,t)}willSubmitForm(e,t){let i=Le(e,t);return this.submissionIsNavigatable(e,t)&&C(c(i),this.snapshot.rootLocation)}formSubmitted(e,t){this.navigator.submitForm(e,t)}pageBecameInteractive(){this.view.lastRenderedLocation=this.location,this.notifyApplicationAfterPageLoad()}pageLoaded(){this.history.assumeControlOfScrollRestoration()}pageWillUnload(){this.history.relinquishControlOfScrollRestoration()}receivedMessageFromStream(e){this.renderStreamMessage(e)}viewWillCacheSnapshot(){var e;!((e=this.navigator.currentVisit)===null||e===void 0)&&e.silent||this.notifyApplicationBeforeCachingSnapshot()}allowsImmediateRender({element:e},t){let i=this.notifyApplicationBeforeRender(e,t),{defaultPrevented:r,detail:{render:n}}=i;return this.view.renderer&&n&&(this.view.renderer.renderElement=n),!r}viewRenderedSnapshot(e,t){this.view.lastRenderedLocation=this.history.location,this.notifyApplicationAfterRender()}preloadOnLoadLinksForView(e){this.preloader.preloadOnLoadLinksForView(e)}viewInvalidated(e){this.adapter.pageInvalidated(e)}frameLoaded(e){this.notifyApplicationAfterFrameLoad(e)}frameRendered(e,t){this.notifyApplicationAfterFrameRender(e,t)}applicationAllowsFollowingLinkToLocation(e,t,i){return!this.notifyApplicationAfterClickingLinkToLocation(e,t,i).defaultPrevented}applicationAllowsVisitingLocation(e){return!this.notifyApplicationBeforeVisitingLocation(e).defaultPrevented}notifyApplicationAfterClickingLinkToLocation(e,t,i){return l("turbo:click",{target:e,detail:{url:t.href,originalEvent:i},cancelable:!0})}notifyApplicationBeforeVisitingLocation(e){return l("turbo:before-visit",{detail:{url:e.href},cancelable:!0})}notifyApplicationAfterVisitingLocation(e,t){return l("turbo:visit",{detail:{url:e.href,action:t}})}notifyApplicationBeforeCachingSnapshot(){return l("turbo:before-cache")}notifyApplicationBeforeRender(e,t){return l("turbo:before-render",{detail:Object.assign({newBody:e},t),cancelable:!0})}notifyApplicationAfterRender(){return l("turbo:render")}notifyApplicationAfterPageLoad(e={}){return l("turbo:load",{detail:{url:this.location.href,timing:e}})}notifyApplicationAfterVisitingSamePageLocation(e,t){dispatchEvent(new HashChangeEvent("hashchange",{oldURL:e.toString(),newURL:t.toString()}))}notifyApplicationAfterFrameLoad(e){return l("turbo:frame-load",{target:e})}notifyApplicationAfterFrameRender(e,t){return l("turbo:frame-render",{detail:{fetchResponse:e},target:t,cancelable:!0})}submissionIsNavigatable(e,t){if(this.formMode=="off")return!1;{let i=t?this.elementIsNavigatable(t):!0;return this.formMode=="optin"?i&&e.closest('[data-turbo="true"]')!=null:i&&this.elementIsNavigatable(e)}}elementIsNavigatable(e){let t=W(e,"[data-turbo]"),i=W(e,"turbo-frame");return this.drive||i?t?t.getAttribute("data-turbo")!="false":!0:t?t.getAttribute("data-turbo")=="true":!1}getActionForLink(e){return Y(e)||"advance"}get snapshot(){return this.view.snapshot}};function Re(s){Object.defineProperties(s,Ht)}var Ht={absoluteURL:{get(){return this.toString()}}},be=class{constructor(e){this.session=e}clear(){this.session.clearCache()}resetCacheControl(){this.setCacheControl("")}exemptPageFromCache(){this.setCacheControl("no-cache")}exemptPageFromPreview(){this.setCacheControl("no-preview")}setCacheControl(e){at("turbo-cache-control",e)}},Be={after(){this.targetElements.forEach(s=>{var e;return(e=s.parentElement)===null||e===void 0?void 0:e.insertBefore(this.templateContent,s.nextSibling)})},append(){this.removeDuplicateTargetChildren(),this.targetElements.forEach(s=>s.append(this.templateContent))},before(){this.targetElements.forEach(s=>{var e;return(e=s.parentElement)===null||e===void 0?void 0:e.insertBefore(this.templateContent,s)})},prepend(){this.removeDuplicateTargetChildren(),this.targetElements.forEach(s=>s.prepend(this.templateContent))},remove(){this.targetElements.forEach(s=>s.remove())},replace(){this.targetElements.forEach(s=>s.replaceWith(this.templateContent))},update(){this.targetElements.forEach(s=>{s.innerHTML="",s.append(this.templateContent)})}},a=new ve,qt=new be(a),{navigator:Bt}=a;function Ne(){a.start()}function Nt(s){a.registerAdapter(s)}function Ot(s,e){a.visit(s,e)}function Oe(s){a.connectStreamSource(s)}function De(s){a.disconnectStreamSource(s)}function Dt(s){a.renderStreamMessage(s)}function xt(){console.warn("Please replace `Turbo.clearCache()` with `Turbo.cache.clear()`. The top-level function is deprecated and will be removed in a future version of Turbo.`"),a.clearCache()}function _t(s){a.setProgressBarDelay(s)}function Vt(s){I.confirmMethod=s}function Wt(s){a.setFormMode(s)}var Ut=Object.freeze({__proto__:null,navigator:Bt,session:a,cache:qt,PageRenderer:N,PageSnapshot:p,FrameRenderer:B,start:Ne,registerAdapter:Nt,visit:Ot,connectStreamSource:Oe,disconnectStreamSource:De,renderStreamMessage:Dt,clearCache:xt,setProgressBarDelay:_t,setConfirmMethod:Vt,setFormMode:Wt,StreamActions:Be}),we=class extends Error{},Ee=class{constructor(e){this.fetchResponseLoaded=t=>{},this.currentFetchRequest=null,this.resolveVisitPromise=()=>{},this.connected=!1,this.hasBeenLoaded=!1,this.ignoredAttributes=new Set,this.action=null,this.visitCachedSnapshot=({element:t})=>{let i=t.querySelector("#"+this.element.id);i&&this.previousFrameElement&&i.replaceChildren(...this.previousFrameElement.children),delete this.previousFrameElement},this.element=e,this.view=new se(this,this.element),this.appearanceObserver=new te(this,this.element),this.formLinkClickObserver=new z(this,this.element),this.linkInterceptor=new j(this,this.element),this.restorationIdentifier=A(),this.formSubmitObserver=new H(this,this.element)}connect(){this.connected||(this.connected=!0,this.loadingStyle==E.lazy?this.appearanceObserver.start():this.loadSourceURL(),this.formLinkClickObserver.start(),this.linkInterceptor.start(),this.formSubmitObserver.start())}disconnect(){this.connected&&(this.connected=!1,this.appearanceObserver.stop(),this.formLinkClickObserver.stop(),this.linkInterceptor.stop(),this.formSubmitObserver.stop())}disabledChanged(){this.loadingStyle==E.eager&&this.loadSourceURL()}sourceURLChanged(){this.isIgnoringChangesTo("src")||(this.element.isConnected&&(this.complete=!1),(this.loadingStyle==E.eager||this.hasBeenLoaded)&&this.loadSourceURL())}sourceURLReloaded(){let{src:e}=this.element;return this.ignoringChangesToAttribute("complete",()=>{this.element.removeAttribute("complete")}),this.element.src=null,this.element.src=e,this.element.loaded}completeChanged(){this.isIgnoringChangesTo("complete")||this.loadSourceURL()}loadingStyleChanged(){this.loadingStyle==E.lazy?this.appearanceObserver.start():(this.appearanceObserver.stop(),this.loadSourceURL())}async loadSourceURL(){this.enabled&&this.isActive&&!this.complete&&this.sourceURL&&(this.element.loaded=this.visit(c(this.sourceURL)),this.appearanceObserver.stop(),await this.element.loaded,this.hasBeenLoaded=!0)}async loadResponse(e){(e.redirected||e.succeeded&&e.isHTML)&&(this.sourceURL=e.response.url);try{let t=await e.responseHTML;if(t){let i=ke(t);p.fromDocument(i).isVisitable?await this.loadFrameResponse(e,i):await this.handleUnvisitableFrameResponse(e)}}finally{this.fetchResponseLoaded=()=>{}}}elementAppearedInViewport(e){this.proposeVisitIfNavigatedWithAction(e,e),this.loadSourceURL()}willSubmitFormLinkToLocation(e){return this.shouldInterceptNavigation(e)}submittedFormLinkToLocation(e,t,i){let r=this.findFrameElement(e);r&&i.setAttribute("data-turbo-frame",r.id)}shouldInterceptLinkClick(e,t,i){return this.shouldInterceptNavigation(e)}linkClickIntercepted(e,t){this.navigateFrame(e,t)}willSubmitForm(e,t){return e.closest("turbo-frame")==this.element&&this.shouldInterceptNavigation(e,t)}formSubmitted(e,t){this.formSubmission&&this.formSubmission.stop(),this.formSubmission=new I(this,e,t);let{fetchRequest:i}=this.formSubmission;this.prepareRequest(i),this.formSubmission.start()}prepareRequest(e){var t;e.headers["Turbo-Frame"]=this.id,!((t=this.currentNavigationElement)===null||t===void 0)&&t.hasAttribute("data-turbo-stream")&&e.acceptResponseType(v.contentType)}requestStarted(e){Z(this.element)}requestPreventedHandlingResponse(e,t){this.resolveVisitPromise()}async requestSucceededWithResponse(e,t){await this.loadResponse(t),this.resolveVisitPromise()}async requestFailedWithResponse(e,t){await this.loadResponse(t),this.resolveVisitPromise()}requestErrored(e,t){console.error(t),this.resolveVisitPromise()}requestFinished(e){ee(this.element)}formSubmissionStarted({formElement:e}){Z(e,this.findFrameElement(e))}formSubmissionSucceededWithResponse(e,t){let i=this.findFrameElement(e.formElement,e.submitter);i.delegate.proposeVisitIfNavigatedWithAction(i,e.formElement,e.submitter),i.delegate.loadResponse(t),e.isSafe||a.clearCache()}formSubmissionFailedWithResponse(e,t){this.element.delegate.loadResponse(t),a.clearCache()}formSubmissionErrored(e,t){console.error(t)}formSubmissionFinished({formElement:e}){ee(e,this.findFrameElement(e))}allowsImmediateRender({element:e},t){let i=l("turbo:before-frame-render",{target:this.element,detail:Object.assign({newFrame:e},t),cancelable:!0}),{defaultPrevented:r,detail:{render:n}}=i;return this.view.renderer&&n&&(this.view.renderer.renderElement=n),!r}viewRenderedSnapshot(e,t){}preloadOnLoadLinksForView(e){a.preloadOnLoadLinksForView(e)}viewInvalidated(){}willRenderFrame(e,t){this.previousFrameElement=e.cloneNode(!0)}async loadFrameResponse(e,t){let i=await this.extractForeignFrameElement(t.body);if(i){let r=new P(i),n=new B(this,this.view.snapshot,r,B.renderElement,!1,!1);this.view.renderPromise&&await this.view.renderPromise,this.changeHistory(),await this.view.render(n),this.complete=!0,a.frameRendered(e,this.element),a.frameLoaded(this.element),this.fetchResponseLoaded(e)}else this.willHandleFrameMissingFromResponse(e)&&this.handleFrameMissingFromResponse(e)}async visit(e){var t;let i=new M(this,d.get,e,new URLSearchParams,this.element);return(t=this.currentFetchRequest)===null||t===void 0||t.cancel(),this.currentFetchRequest=i,new Promise(r=>{this.resolveVisitPromise=()=>{this.resolveVisitPromise=()=>{},this.currentFetchRequest=null,r()},i.perform()})}navigateFrame(e,t,i){let r=this.findFrameElement(e,i);r.delegate.proposeVisitIfNavigatedWithAction(r,e,i),this.withCurrentNavigationElement(e,()=>{r.src=t})}proposeVisitIfNavigatedWithAction(e,t,i){if(this.action=Y(i,t,e),this.action){let r=p.fromElement(e).clone(),{visitCachedSnapshot:n}=e.delegate;e.delegate.fetchResponseLoaded=o=>{if(e.src){let{statusCode:h,redirected:u}=o,L=e.ownerDocument.documentElement.outerHTML,T={response:{statusCode:h,redirected:u,responseHTML:L},visitCachedSnapshot:n,willRender:!1,updateHistory:!1,restorationIdentifier:this.restorationIdentifier,snapshot:r};this.action&&(T.action=this.action),a.visit(e.src,T)}}}}changeHistory(){if(this.action){let e=Me(this.action);a.history.update(e,c(this.element.src||""),this.restorationIdentifier)}}async handleUnvisitableFrameResponse(e){console.warn(`The response (${e.statusCode}) from <turbo-frame id="${this.element.id}"> is performing a full page visit due to turbo-visit-control.`),await this.visitResponse(e.response)}willHandleFrameMissingFromResponse(e){this.element.setAttribute("complete","");let t=e.response,i=async(n,o={})=>{n instanceof Response?this.visitResponse(n):a.visit(n,o)};return!l("turbo:frame-missing",{target:this.element,detail:{response:t,visit:i},cancelable:!0}).defaultPrevented}handleFrameMissingFromResponse(e){this.view.missing(),this.throwFrameMissingError(e)}throwFrameMissingError(e){let t=`The response (${e.statusCode}) did not contain the expected <turbo-frame id="${this.element.id}"> and will be ignored. To perform a full page visit instead, set turbo-visit-control to reload.`;throw new we(t)}async visitResponse(e){let t=new k(e),i=await t.responseHTML,{location:r,redirected:n,statusCode:o}=t;return a.visit(r,{response:{redirected:n,statusCode:o,responseHTML:i}})}findFrameElement(e,t){var i;let r=_("data-turbo-frame",t,e)||this.element.getAttribute("target");return(i=Ce(r))!==null&&i!==void 0?i:this.element}async extractForeignFrameElement(e){let t,i=CSS.escape(this.id);try{if(t=Ae(e.querySelector(`turbo-frame#${i}`),this.sourceURL),t)return t;if(t=Ae(e.querySelector(`turbo-frame[src][recurse~=${i}]`),this.sourceURL),t)return await t.loaded,await this.extractForeignFrameElement(t)}catch(r){return console.error(r),new g}return null}formActionIsVisitable(e,t){let i=Le(e,t);return C(c(i),this.rootLocation)}shouldInterceptNavigation(e,t){let i=_("data-turbo-frame",t,e)||this.element.getAttribute("target");if(e instanceof HTMLFormElement&&!this.formActionIsVisitable(e,t)||!this.enabled||i=="_top")return!1;if(i){let r=Ce(i);if(r)return!r.disabled}return!(!a.elementIsNavigatable(e)||t&&!a.elementIsNavigatable(t))}get id(){return this.element.id}get enabled(){return!this.element.disabled}get sourceURL(){if(this.element.src)return this.element.src}set sourceURL(e){this.ignoringChangesToAttribute("src",()=>{this.element.src=e??null})}get loadingStyle(){return this.element.loading}get isLoading(){return this.formSubmission!==void 0||this.resolveVisitPromise()!==void 0}get complete(){return this.element.hasAttribute("complete")}set complete(e){this.ignoringChangesToAttribute("complete",()=>{e?this.element.setAttribute("complete",""):this.element.removeAttribute("complete")})}get isActive(){return this.element.isActive&&this.connected}get rootLocation(){var e;let t=this.element.ownerDocument.querySelector('meta[name="turbo-root"]'),i=(e=t?.content)!==null&&e!==void 0?e:"/";return c(i)}isIgnoringChangesTo(e){return this.ignoredAttributes.has(e)}ignoringChangesToAttribute(e,t){this.ignoredAttributes.add(e),t(),this.ignoredAttributes.delete(e)}withCurrentNavigationElement(e,t){this.currentNavigationElement=e,t(),delete this.currentNavigationElement}};function Ce(s){if(s!=null){let e=document.getElementById(s);if(e instanceof g)return e}}function Ae(s,e){if(s){let t=s.getAttribute("src");if(t!=null&&e!=null&&Qe(t,e))throw new Error(`Matching <turbo-frame id="${s.id}"> element has a source URL which references itself`);if(s.ownerDocument!==document&&(s=document.importNode(s,!0)),s instanceof g)return s.connectedCallback(),s.disconnectedCallback(),s}}var Se=class s extends HTMLElement{static async renderElement(e){await e.performAction()}async connectedCallback(){try{await this.render()}catch(e){console.error(e)}finally{this.disconnect()}}async render(){var e;return(e=this.renderPromise)!==null&&e!==void 0?e:this.renderPromise=(async()=>{let t=this.beforeRenderEvent;this.dispatchEvent(t)&&(await x(),await t.detail.render(this))})()}disconnect(){try{this.remove()}catch{}}removeDuplicateTargetChildren(){this.duplicateChildren.forEach(e=>e.remove())}get duplicateChildren(){var e;let t=this.targetElements.flatMap(r=>[...r.children]).filter(r=>!!r.id),i=[...((e=this.templateContent)===null||e===void 0?void 0:e.children)||[]].filter(r=>!!r.id).map(r=>r.id);return t.filter(r=>i.includes(r.id))}get performAction(){if(this.action){let e=Be[this.action];if(e)return e;this.raise("unknown action")}this.raise("action attribute is missing")}get targetElements(){if(this.target)return this.targetElementsById;if(this.targets)return this.targetElementsByQuery;this.raise("target or targets attribute is missing")}get templateContent(){return this.templateElement.content.cloneNode(!0)}get templateElement(){if(this.firstElementChild===null){let e=this.ownerDocument.createElement("template");return this.appendChild(e),e}else if(this.firstElementChild instanceof HTMLTemplateElement)return this.firstElementChild;this.raise("first child element must be a <template> element")}get action(){return this.getAttribute("action")}get target(){return this.getAttribute("target")}get targets(){return this.getAttribute("targets")}raise(e){throw new Error(`${this.description}: ${e}`)}get description(){var e,t;return(t=((e=this.outerHTML.match(/<[^>]+>/))!==null&&e!==void 0?e:[])[0])!==null&&t!==void 0?t:"<turbo-stream>"}get beforeRenderEvent(){return new CustomEvent("turbo:before-stream-render",{bubbles:!0,cancelable:!0,detail:{newStream:this,render:s.renderElement}})}get targetElementsById(){var e;let t=(e=this.ownerDocument)===null||e===void 0?void 0:e.getElementById(this.target);return t!==null?[t]:[]}get targetElementsByQuery(){var e;let t=(e=this.ownerDocument)===null||e===void 0?void 0:e.querySelectorAll(this.targets);return t.length!==0?Array.prototype.slice.call(t):[]}},ye=class extends HTMLElement{constructor(){super(...arguments),this.streamSource=null}connectedCallback(){this.streamSource=this.src.match(/^ws{1,2}:/)?new WebSocket(this.src):new EventSource(this.src),Oe(this.streamSource)}disconnectedCallback(){this.streamSource&&De(this.streamSource)}get src(){return this.getAttribute("src")||""}};g.delegateConstructor=Ee;customElements.get("turbo-frame")===void 0&&customElements.define("turbo-frame",g);customElements.get("turbo-stream")===void 0&&customElements.define("turbo-stream",Se);customElements.get("turbo-stream-source")===void 0&&customElements.define("turbo-stream-source",ye);(()=>{let s=document.currentScript;if(s&&!s.hasAttribute("data-turbo-suppress-warning"))for(s=s.parentElement;s;){if(s==document.body)return console.warn(Fe`
18
+ You are loading Turbo from a <script> element inside the <body> element. This is probably not what you meant to do!
19
+
20
+ Load your application’s JavaScript bundle inside the <head> element instead. <script> elements in <body> are evaluated with each page change.
21
+
22
+ For more information, see: https://turbo.hotwired.dev/handbook/building#working-with-script-elements
23
+
24
+ ——
25
+ Suppress this warning by adding a "data-turbo-suppress-warning" attribute to: %s
26
+ `,s.outerHTML);s=s.parentElement}})();window.Turbo=Ut;Ne();})();
27
+ //# sourceMappingURL=app.min.js.map
@@ -0,0 +1,15 @@
1
+ module Providers
2
+ module DB
3
+ class Conn
4
+ def self.boot
5
+ # @conn = Sequel.connect("jdbc:sqlite:db/#{Config.get[:environment]}.db")
6
+ # @conn = Sequel.connect("sqlite://db/#{Config.get[:environment]}.db")
7
+ @conn = Sequel.connect(Config.get[:db][:url])
8
+
9
+ Sequel::Model.plugin :timestamps, update_on_create: true
10
+ end
11
+
12
+ def self.get = @conn
13
+ end
14
+ end
15
+ end
@@ -0,0 +1 @@
1
+ require_relative "../boot"
@@ -0,0 +1,20 @@
1
+ body {
2
+ background: black;
3
+ color: white;
4
+ margin: 1em 2em;
5
+ font-family: monospace;
6
+ }
7
+
8
+ a {
9
+ color: #ef4348;
10
+ margin-right: 1em;
11
+ }
12
+
13
+ img {
14
+ width: 25%;
15
+ margin-bottom: 1em;
16
+ }
17
+
18
+ .navbar {
19
+ margin-bottom: 1em;
20
+ }
@@ -0,0 +1,7 @@
1
+ import * as Turbo from "@hotwired/turbo"
2
+ import foo from "./some/foo"
3
+
4
+ // For stimulus js (first run yarn add @hotwired/stimulus)
5
+ //
6
+ // import { Application } from "@hotwired/stimulus"
7
+ // window.Stimulus = Application.start()
@@ -0,0 +1,5 @@
1
+ const foo = () => {
2
+ console.log('foo');
3
+ }
4
+
5
+ export default foo
@@ -0,0 +1 @@
1
+ <h1>foo/bar</h1>
@@ -0,0 +1,6 @@
1
+ module Views
2
+ module Foo
3
+ class Html
4
+ end
5
+ end
6
+ end