diff --git a/.gitignore b/.gitignore index 21d1524..36b3fbc 100644 --- a/.gitignore +++ b/.gitignore @@ -27,7 +27,5 @@ error_tracker-*.tar /assets/node_modules -/priv/static/app.js -/priv/static/app.css dev.local.exs diff --git a/lib/error_tracker/web/components/layouts.ex b/lib/error_tracker/web/components/layouts.ex index a7aaeb8..94bdb12 100644 --- a/lib/error_tracker/web/components/layouts.ex +++ b/lib/error_tracker/web/components/layouts.ex @@ -4,18 +4,18 @@ defmodule ErrorTracker.Web.Layouts do alias ErrorTracker.Web.Layouts.Navbar - @css_path :code.priv_dir(:error_tracker) |> Path.join("static/app.css") - @js_path :code.priv_dir(:error_tracker) |> Path.join("static/app.js") + @default_socket_config %{path: "/live", transport: :websocket} - @default_docket_config %{path: "/live", transport: :websocket} + @css :code.priv_dir(:error_tracker) |> Path.join("static/app.css") |> File.read!() + @js :code.priv_dir(:error_tracker) |> Path.join("static/app.js") |> File.read!() embed_templates "layouts/*" - def get_content(:css), do: File.read!(@css_path) - def get_content(:js), do: File.read!(@js_path) + def get_content(:css), do: @css + def get_content(:js), do: @js def get_socket_config(key) do - default = Map.get(@default_docket_config, key) + default = Map.get(@default_socket_config, key) config = Application.get_env(:error_tracker, :live_view_socket, []) Keyword.get(config, key, default) end diff --git a/priv/static/app.css b/priv/static/app.css new file mode 100644 index 0000000..22235f8 --- /dev/null +++ b/priv/static/app.css @@ -0,0 +1,1410 @@ +/* +! tailwindcss v3.4.3 | MIT License | https://tailwindcss.com +*/ + +/* +1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4) +2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116) +*/ + +*, +::before, +::after { + box-sizing: border-box; + /* 1 */ + border-width: 0; + /* 2 */ + border-style: solid; + /* 2 */ + border-color: #e5e7eb; + /* 2 */ +} + +::before, +::after { + --tw-content: ''; +} + +/* +1. Use a consistent sensible line-height in all browsers. +2. Prevent adjustments of font size after orientation changes in iOS. +3. Use a more readable tab size. +4. Use the user's configured `sans` font-family by default. +5. Use the user's configured `sans` font-feature-settings by default. +6. Use the user's configured `sans` font-variation-settings by default. +7. Disable tap highlights on iOS +*/ + +html, +:host { + line-height: 1.5; + /* 1 */ + -webkit-text-size-adjust: 100%; + /* 2 */ + -moz-tab-size: 4; + /* 3 */ + -o-tab-size: 4; + tab-size: 4; + /* 3 */ + font-family: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; + /* 4 */ + font-feature-settings: normal; + /* 5 */ + font-variation-settings: normal; + /* 6 */ + -webkit-tap-highlight-color: transparent; + /* 7 */ +} + +/* +1. Remove the margin in all browsers. +2. Inherit line-height from `html` so users can set them as a class directly on the `html` element. +*/ + +body { + margin: 0; + /* 1 */ + line-height: inherit; + /* 2 */ +} + +/* +1. Add the correct height in Firefox. +2. Correct the inheritance of border color in Firefox. (https://bugzilla.mozilla.org/show_bug.cgi?id=190655) +3. Ensure horizontal rules are visible by default. +*/ + +hr { + height: 0; + /* 1 */ + color: inherit; + /* 2 */ + border-top-width: 1px; + /* 3 */ +} + +/* +Add the correct text decoration in Chrome, Edge, and Safari. +*/ + +abbr:where([title]) { + -webkit-text-decoration: underline dotted; + text-decoration: underline dotted; +} + +/* +Remove the default font size and weight for headings. +*/ + +h1, +h2, +h3, +h4, +h5, +h6 { + font-size: inherit; + font-weight: inherit; +} + +/* +Reset links to optimize for opt-in styling instead of opt-out. +*/ + +a { + color: inherit; + text-decoration: inherit; +} + +/* +Add the correct font weight in Edge and Safari. +*/ + +b, +strong { + font-weight: bolder; +} + +/* +1. Use the user's configured `mono` font-family by default. +2. Use the user's configured `mono` font-feature-settings by default. +3. Use the user's configured `mono` font-variation-settings by default. +4. Correct the odd `em` font sizing in all browsers. +*/ + +code, +kbd, +samp, +pre { + font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; + /* 1 */ + font-feature-settings: normal; + /* 2 */ + font-variation-settings: normal; + /* 3 */ + font-size: 1em; + /* 4 */ +} + +/* +Add the correct font size in all browsers. +*/ + +small { + font-size: 80%; +} + +/* +Prevent `sub` and `sup` elements from affecting the line height in all browsers. +*/ + +sub, +sup { + font-size: 75%; + line-height: 0; + position: relative; + vertical-align: baseline; +} + +sub { + bottom: -0.25em; +} + +sup { + top: -0.5em; +} + +/* +1. Remove text indentation from table contents in Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=999088, https://bugs.webkit.org/show_bug.cgi?id=201297) +2. Correct table border color inheritance in all Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=935729, https://bugs.webkit.org/show_bug.cgi?id=195016) +3. Remove gaps between table borders by default. +*/ + +table { + text-indent: 0; + /* 1 */ + border-color: inherit; + /* 2 */ + border-collapse: collapse; + /* 3 */ +} + +/* +1. Change the font styles in all browsers. +2. Remove the margin in Firefox and Safari. +3. Remove default padding in all browsers. +*/ + +button, +input, +optgroup, +select, +textarea { + font-family: inherit; + /* 1 */ + font-feature-settings: inherit; + /* 1 */ + font-variation-settings: inherit; + /* 1 */ + font-size: 100%; + /* 1 */ + font-weight: inherit; + /* 1 */ + line-height: inherit; + /* 1 */ + letter-spacing: inherit; + /* 1 */ + color: inherit; + /* 1 */ + margin: 0; + /* 2 */ + padding: 0; + /* 3 */ +} + +/* +Remove the inheritance of text transform in Edge and Firefox. +*/ + +button, +select { + text-transform: none; +} + +/* +1. Correct the inability to style clickable types in iOS and Safari. +2. Remove default button styles. +*/ + +button, +input:where([type='button']), +input:where([type='reset']), +input:where([type='submit']) { + -webkit-appearance: button; + /* 1 */ + background-color: transparent; + /* 2 */ + background-image: none; + /* 2 */ +} + +/* +Use the modern Firefox focus style for all focusable elements. +*/ + +:-moz-focusring { + outline: auto; +} + +/* +Remove the additional `:invalid` styles in Firefox. (https://github.com/mozilla/gecko-dev/blob/2f9eacd9d3d995c937b4251a5557d95d494c9be1/layout/style/res/forms.css#L728-L737) +*/ + +:-moz-ui-invalid { + box-shadow: none; +} + +/* +Add the correct vertical alignment in Chrome and Firefox. +*/ + +progress { + vertical-align: baseline; +} + +/* +Correct the cursor style of increment and decrement buttons in Safari. +*/ + +::-webkit-inner-spin-button, +::-webkit-outer-spin-button { + height: auto; +} + +/* +1. Correct the odd appearance in Chrome and Safari. +2. Correct the outline style in Safari. +*/ + +[type='search'] { + -webkit-appearance: textfield; + /* 1 */ + outline-offset: -2px; + /* 2 */ +} + +/* +Remove the inner padding in Chrome and Safari on macOS. +*/ + +::-webkit-search-decoration { + -webkit-appearance: none; +} + +/* +1. Correct the inability to style clickable types in iOS and Safari. +2. Change font properties to `inherit` in Safari. +*/ + +::-webkit-file-upload-button { + -webkit-appearance: button; + /* 1 */ + font: inherit; + /* 2 */ +} + +/* +Add the correct display in Chrome and Safari. +*/ + +summary { + display: list-item; +} + +/* +Removes the default spacing and border for appropriate elements. +*/ + +blockquote, +dl, +dd, +h1, +h2, +h3, +h4, +h5, +h6, +hr, +figure, +p, +pre { + margin: 0; +} + +fieldset { + margin: 0; + padding: 0; +} + +legend { + padding: 0; +} + +ol, +ul, +menu { + list-style: none; + margin: 0; + padding: 0; +} + +/* +Reset default styling for dialogs. +*/ + +dialog { + padding: 0; +} + +/* +Prevent resizing textareas horizontally by default. +*/ + +textarea { + resize: vertical; +} + +/* +1. Reset the default placeholder opacity in Firefox. (https://github.com/tailwindlabs/tailwindcss/issues/3300) +2. Set the default placeholder color to the user's configured gray 400 color. +*/ + +input::-moz-placeholder, textarea::-moz-placeholder { + opacity: 1; + /* 1 */ + color: #9ca3af; + /* 2 */ +} + +input::placeholder, +textarea::placeholder { + opacity: 1; + /* 1 */ + color: #9ca3af; + /* 2 */ +} + +/* +Set the default cursor for buttons. +*/ + +button, +[role="button"] { + cursor: pointer; +} + +/* +Make sure disabled buttons don't get the pointer cursor. +*/ + +:disabled { + cursor: default; +} + +/* +1. Make replaced elements `display: block` by default. (https://github.com/mozdevs/cssremedy/issues/14) +2. Add `vertical-align: middle` to align replaced elements more sensibly by default. (https://github.com/jensimmons/cssremedy/issues/14#issuecomment-634934210) + This can trigger a poorly considered lint error in some tools but is included by design. +*/ + +img, +svg, +video, +canvas, +audio, +iframe, +embed, +object { + display: block; + /* 1 */ + vertical-align: middle; + /* 2 */ +} + +/* +Constrain images and videos to the parent width and preserve their intrinsic aspect ratio. (https://github.com/mozdevs/cssremedy/issues/14) +*/ + +img, +video { + max-width: 100%; + height: auto; +} + +/* Make elements with the HTML hidden attribute stay hidden by default */ + +[hidden] { + display: none; +} + +[type='text'],[type='email'],[type='url'],[type='password'],[type='number'],[type='date'],[type='datetime-local'],[type='month'],[type='search'],[type='tel'],[type='time'],[type='week'],[multiple],textarea,select { + -webkit-appearance: none; + -moz-appearance: none; + appearance: none; + background-color: #fff; + border-color: #6b7280; + border-width: 1px; + border-radius: 0px; + padding-top: 0.5rem; + padding-right: 0.75rem; + padding-bottom: 0.5rem; + padding-left: 0.75rem; + font-size: 1rem; + line-height: 1.5rem; + --tw-shadow: 0 0 #0000; +} + +[type='text']:focus, [type='email']:focus, [type='url']:focus, [type='password']:focus, [type='number']:focus, [type='date']:focus, [type='datetime-local']:focus, [type='month']:focus, [type='search']:focus, [type='tel']:focus, [type='time']:focus, [type='week']:focus, [multiple]:focus, textarea:focus, select:focus { + outline: 2px solid transparent; + outline-offset: 2px; + --tw-ring-inset: var(--tw-empty,/*!*/ /*!*/); + --tw-ring-offset-width: 0px; + --tw-ring-offset-color: #fff; + --tw-ring-color: #2563eb; + --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color); + --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color); + box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow); + border-color: #2563eb; +} + +input::-moz-placeholder, textarea::-moz-placeholder { + color: #6b7280; + opacity: 1; +} + +input::placeholder,textarea::placeholder { + color: #6b7280; + opacity: 1; +} + +::-webkit-datetime-edit-fields-wrapper { + padding: 0; +} + +::-webkit-date-and-time-value { + min-height: 1.5em; +} + +::-webkit-datetime-edit,::-webkit-datetime-edit-year-field,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute-field,::-webkit-datetime-edit-second-field,::-webkit-datetime-edit-millisecond-field,::-webkit-datetime-edit-meridiem-field { + padding-top: 0; + padding-bottom: 0; +} + +select { + background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e"); + background-position: right 0.5rem center; + background-repeat: no-repeat; + background-size: 1.5em 1.5em; + padding-right: 2.5rem; + -webkit-print-color-adjust: exact; + print-color-adjust: exact; +} + +[multiple] { + background-image: initial; + background-position: initial; + background-repeat: unset; + background-size: initial; + padding-right: 0.75rem; + -webkit-print-color-adjust: unset; + print-color-adjust: unset; +} + +[type='checkbox'],[type='radio'] { + -webkit-appearance: none; + -moz-appearance: none; + appearance: none; + padding: 0; + -webkit-print-color-adjust: exact; + print-color-adjust: exact; + display: inline-block; + vertical-align: middle; + background-origin: border-box; + -webkit-user-select: none; + -moz-user-select: none; + user-select: none; + flex-shrink: 0; + height: 1rem; + width: 1rem; + color: #2563eb; + background-color: #fff; + border-color: #6b7280; + border-width: 1px; + --tw-shadow: 0 0 #0000; +} + +[type='checkbox'] { + border-radius: 0px; +} + +[type='radio'] { + border-radius: 100%; +} + +[type='checkbox']:focus,[type='radio']:focus { + outline: 2px solid transparent; + outline-offset: 2px; + --tw-ring-inset: var(--tw-empty,/*!*/ /*!*/); + --tw-ring-offset-width: 2px; + --tw-ring-offset-color: #fff; + --tw-ring-color: #2563eb; + --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color); + --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color); + box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow); +} + +[type='checkbox']:checked,[type='radio']:checked { + border-color: transparent; + background-color: currentColor; + background-size: 100% 100%; + background-position: center; + background-repeat: no-repeat; +} + +[type='checkbox']:checked { + background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3e%3c/svg%3e"); +} + +[type='radio']:checked { + background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3ccircle cx='8' cy='8' r='3'/%3e%3c/svg%3e"); +} + +[type='checkbox']:checked:hover,[type='checkbox']:checked:focus,[type='radio']:checked:hover,[type='radio']:checked:focus { + border-color: transparent; + background-color: currentColor; +} + +[type='checkbox']:indeterminate { + background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 16 16'%3e%3cpath stroke='white' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M4 8h8'/%3e%3c/svg%3e"); + border-color: transparent; + background-color: currentColor; + background-size: 100% 100%; + background-position: center; + background-repeat: no-repeat; +} + +[type='checkbox']:indeterminate:hover,[type='checkbox']:indeterminate:focus { + border-color: transparent; + background-color: currentColor; +} + +[type='file'] { + background: unset; + border-color: inherit; + border-width: 0; + border-radius: 0; + padding: 0; + font-size: unset; + line-height: inherit; +} + +[type='file']:focus { + outline: 1px solid ButtonText; + outline: 1px auto -webkit-focus-ring-color; +} + +*, ::before, ::after { + --tw-border-spacing-x: 0; + --tw-border-spacing-y: 0; + --tw-translate-x: 0; + --tw-translate-y: 0; + --tw-rotate: 0; + --tw-skew-x: 0; + --tw-skew-y: 0; + --tw-scale-x: 1; + --tw-scale-y: 1; + --tw-pan-x: ; + --tw-pan-y: ; + --tw-pinch-zoom: ; + --tw-scroll-snap-strictness: proximity; + --tw-gradient-from-position: ; + --tw-gradient-via-position: ; + --tw-gradient-to-position: ; + --tw-ordinal: ; + --tw-slashed-zero: ; + --tw-numeric-figure: ; + --tw-numeric-spacing: ; + --tw-numeric-fraction: ; + --tw-ring-inset: ; + --tw-ring-offset-width: 0px; + --tw-ring-offset-color: #fff; + --tw-ring-color: rgb(59 130 246 / 0.5); + --tw-ring-offset-shadow: 0 0 #0000; + --tw-ring-shadow: 0 0 #0000; + --tw-shadow: 0 0 #0000; + --tw-shadow-colored: 0 0 #0000; + --tw-blur: ; + --tw-brightness: ; + --tw-contrast: ; + --tw-grayscale: ; + --tw-hue-rotate: ; + --tw-invert: ; + --tw-saturate: ; + --tw-sepia: ; + --tw-drop-shadow: ; + --tw-backdrop-blur: ; + --tw-backdrop-brightness: ; + --tw-backdrop-contrast: ; + --tw-backdrop-grayscale: ; + --tw-backdrop-hue-rotate: ; + --tw-backdrop-invert: ; + --tw-backdrop-opacity: ; + --tw-backdrop-saturate: ; + --tw-backdrop-sepia: ; + --tw-contain-size: ; + --tw-contain-layout: ; + --tw-contain-paint: ; + --tw-contain-style: ; +} + +::backdrop { + --tw-border-spacing-x: 0; + --tw-border-spacing-y: 0; + --tw-translate-x: 0; + --tw-translate-y: 0; + --tw-rotate: 0; + --tw-skew-x: 0; + --tw-skew-y: 0; + --tw-scale-x: 1; + --tw-scale-y: 1; + --tw-pan-x: ; + --tw-pan-y: ; + --tw-pinch-zoom: ; + --tw-scroll-snap-strictness: proximity; + --tw-gradient-from-position: ; + --tw-gradient-via-position: ; + --tw-gradient-to-position: ; + --tw-ordinal: ; + --tw-slashed-zero: ; + --tw-numeric-figure: ; + --tw-numeric-spacing: ; + --tw-numeric-fraction: ; + --tw-ring-inset: ; + --tw-ring-offset-width: 0px; + --tw-ring-offset-color: #fff; + --tw-ring-color: rgb(59 130 246 / 0.5); + --tw-ring-offset-shadow: 0 0 #0000; + --tw-ring-shadow: 0 0 #0000; + --tw-shadow: 0 0 #0000; + --tw-shadow-colored: 0 0 #0000; + --tw-blur: ; + --tw-brightness: ; + --tw-contrast: ; + --tw-grayscale: ; + --tw-hue-rotate: ; + --tw-invert: ; + --tw-saturate: ; + --tw-sepia: ; + --tw-drop-shadow: ; + --tw-backdrop-blur: ; + --tw-backdrop-brightness: ; + --tw-backdrop-contrast: ; + --tw-backdrop-grayscale: ; + --tw-backdrop-hue-rotate: ; + --tw-backdrop-invert: ; + --tw-backdrop-opacity: ; + --tw-backdrop-saturate: ; + --tw-backdrop-sepia: ; + --tw-contain-size: ; + --tw-contain-layout: ; + --tw-contain-paint: ; + --tw-contain-style: ; +} + +.container { + width: 100%; +} + +@media (min-width: 640px) { + .container { + max-width: 640px; + } +} + +@media (min-width: 768px) { + .container { + max-width: 768px; + } +} + +@media (min-width: 1024px) { + .container { + max-width: 1024px; + } +} + +@media (min-width: 1280px) { + .container { + max-width: 1280px; + } +} + +@media (min-width: 1536px) { + .container { + max-width: 1536px; + } +} + +.sr-only { + position: absolute; + width: 1px; + height: 1px; + padding: 0; + margin: -1px; + overflow: hidden; + clip: rect(0, 0, 0, 0); + white-space: nowrap; + border-width: 0; +} + +.relative { + position: relative; +} + +.mx-auto { + margin-left: auto; + margin-right: auto; +} + +.my-1 { + margin-top: 0.25rem; + margin-bottom: 0.25rem; +} + +.my-6 { + margin-top: 1.5rem; + margin-bottom: 1.5rem; +} + +.mb-1 { + margin-bottom: 0.25rem; +} + +.mb-2 { + margin-bottom: 0.5rem; +} + +.mb-3 { + margin-bottom: 0.75rem; +} + +.mb-4 { + margin-bottom: 1rem; +} + +.me-2 { + margin-inline-end: 0.5rem; +} + +.ml-2 { + margin-left: 0.5rem; +} + +.mr-2 { + margin-right: 0.5rem; +} + +.mt-1 { + margin-top: 0.25rem; +} + +.mt-10 { + margin-top: 2.5rem; +} + +.mt-4 { + margin-top: 1rem; +} + +.mt-6 { + margin-top: 1.5rem; +} + +.block { + display: block; +} + +.inline-block { + display: inline-block; +} + +.flex { + display: flex; +} + +.inline-flex { + display: inline-flex; +} + +.table { + display: table; +} + +.grid { + display: grid; +} + +.hidden { + display: none; +} + +.h-10 { + height: 2.5rem; +} + +.h-5 { + height: 1.25rem; +} + +.w-10 { + width: 2.5rem; +} + +.w-28 { + width: 7rem; +} + +.w-32 { + width: 8rem; +} + +.w-5 { + width: 1.25rem; +} + +.w-72 { + width: 18rem; +} + +.w-full { + width: 100%; +} + +.table-fixed { + table-layout: fixed; +} + +.grid-cols-1 { + grid-template-columns: repeat(1, minmax(0, 1fr)); +} + +.grid-cols-4 { + grid-template-columns: repeat(4, minmax(0, 1fr)); +} + +.flex-col { + flex-direction: column; +} + +.flex-wrap { + flex-wrap: wrap; +} + +.items-center { + align-items: center; +} + +.justify-end { + justify-content: flex-end; +} + +.justify-center { + justify-content: center; +} + +.justify-between { + justify-content: space-between; +} + +.gap-2 { + gap: 0.5rem; +} + +.space-y-8 > :not([hidden]) ~ :not([hidden]) { + --tw-space-y-reverse: 0; + margin-top: calc(2rem * calc(1 - var(--tw-space-y-reverse))); + margin-bottom: calc(2rem * var(--tw-space-y-reverse)); +} + +.self-center { + align-self: center; +} + +.overflow-auto { + overflow: auto; +} + +.overflow-hidden { + overflow: hidden; +} + +.overflow-x-auto { + overflow-x: auto; +} + +.text-ellipsis { + text-overflow: ellipsis; +} + +.whitespace-nowrap { + white-space: nowrap; +} + +.rounded { + border-radius: 0.25rem; +} + +.rounded-lg { + border-radius: 0.5rem; +} + +.border { + border-width: 1px; +} + +.border-b { + border-bottom-width: 1px; +} + +.border-gray-200 { + --tw-border-opacity: 1; + border-color: rgb(229 231 235 / var(--tw-border-opacity)); +} + +.border-gray-600 { + --tw-border-opacity: 1; + border-color: rgb(75 85 99 / var(--tw-border-opacity)); +} + +.border-gray-700 { + --tw-border-opacity: 1; + border-color: rgb(55 65 81 / var(--tw-border-opacity)); +} + +.bg-blue-900 { + --tw-bg-opacity: 1; + background-color: rgb(30 58 138 / var(--tw-bg-opacity)); +} + +.bg-gray-50 { + --tw-bg-opacity: 1; + background-color: rgb(249 250 251 / var(--tw-bg-opacity)); +} + +.bg-gray-600 { + --tw-bg-opacity: 1; + background-color: rgb(75 85 99 / var(--tw-bg-opacity)); +} + +.bg-gray-700 { + --tw-bg-opacity: 1; + background-color: rgb(55 65 81 / var(--tw-bg-opacity)); +} + +.bg-gray-800 { + --tw-bg-opacity: 1; + background-color: rgb(31 41 55 / var(--tw-bg-opacity)); +} + +.bg-green-900 { + --tw-bg-opacity: 1; + background-color: rgb(20 83 45 / var(--tw-bg-opacity)); +} + +.bg-indigo-900 { + --tw-bg-opacity: 1; + background-color: rgb(49 46 129 / var(--tw-bg-opacity)); +} + +.bg-pink-900 { + --tw-bg-opacity: 1; + background-color: rgb(131 24 67 / var(--tw-bg-opacity)); +} + +.bg-purple-900 { + --tw-bg-opacity: 1; + background-color: rgb(88 28 135 / var(--tw-bg-opacity)); +} + +.bg-red-900 { + --tw-bg-opacity: 1; + background-color: rgb(127 29 29 / var(--tw-bg-opacity)); +} + +.bg-yellow-900 { + --tw-bg-opacity: 1; + background-color: rgb(113 63 18 / var(--tw-bg-opacity)); +} + +.bg-zinc-600 { + --tw-bg-opacity: 1; + background-color: rgb(82 82 91 / var(--tw-bg-opacity)); +} + +.p-2 { + padding: 0.5rem; +} + +.p-4 { + padding: 1rem; +} + +.px-2 { + padding-left: 0.5rem; + padding-right: 0.5rem; +} + +.px-2\.5 { + padding-left: 0.625rem; + padding-right: 0.625rem; +} + +.px-3 { + padding-left: 0.75rem; + padding-right: 0.75rem; +} + +.px-4 { + padding-left: 1rem; + padding-right: 1rem; +} + +.py-1 { + padding-top: 0.25rem; + padding-bottom: 0.25rem; +} + +.py-1\.5 { + padding-top: 0.375rem; + padding-bottom: 0.375rem; +} + +.py-2 { + padding-top: 0.5rem; + padding-bottom: 0.5rem; +} + +.py-3 { + padding-top: 0.75rem; + padding-bottom: 0.75rem; +} + +.py-4 { + padding-top: 1rem; + padding-bottom: 1rem; +} + +.py-8 { + padding-top: 2rem; + padding-bottom: 2rem; +} + +.py-\[11\.5px\] { + padding-top: 11.5px; + padding-bottom: 11.5px; +} + +.pr-2 { + padding-right: 0.5rem; +} + +.text-left { + text-align: left; +} + +.text-center { + text-align: center; +} + +.align-top { + vertical-align: top; +} + +.text-2xl { + font-size: 1.5rem; + line-height: 2rem; +} + +.text-base { + font-size: 1rem; + line-height: 1.5rem; +} + +.text-sm { + font-size: 0.875rem; + line-height: 1.25rem; +} + +.text-xs { + font-size: 0.75rem; + line-height: 1rem; +} + +.font-bold { + font-weight: 700; +} + +.font-extralight { + font-weight: 200; +} + +.font-medium { + font-weight: 500; +} + +.font-normal { + font-weight: 400; +} + +.font-semibold { + font-weight: 600; +} + +.uppercase { + text-transform: uppercase; +} + +.leading-6 { + line-height: 1.5rem; +} + +.text-black { + --tw-text-opacity: 1; + color: rgb(0 0 0 / var(--tw-text-opacity)); +} + +.text-blue-300 { + --tw-text-opacity: 1; + color: rgb(147 197 253 / var(--tw-text-opacity)); +} + +.text-gray-300 { + --tw-text-opacity: 1; + color: rgb(209 213 219 / var(--tw-text-opacity)); +} + +.text-gray-400 { + --tw-text-opacity: 1; + color: rgb(156 163 175 / var(--tw-text-opacity)); +} + +.text-gray-500 { + --tw-text-opacity: 1; + color: rgb(107 114 128 / var(--tw-text-opacity)); +} + +.text-gray-700 { + --tw-text-opacity: 1; + color: rgb(55 65 81 / var(--tw-text-opacity)); +} + +.text-gray-900 { + --tw-text-opacity: 1; + color: rgb(17 24 39 / var(--tw-text-opacity)); +} + +.text-green-300 { + --tw-text-opacity: 1; + color: rgb(134 239 172 / var(--tw-text-opacity)); +} + +.text-indigo-300 { + --tw-text-opacity: 1; + color: rgb(165 180 252 / var(--tw-text-opacity)); +} + +.text-pink-300 { + --tw-text-opacity: 1; + color: rgb(249 168 212 / var(--tw-text-opacity)); +} + +.text-purple-300 { + --tw-text-opacity: 1; + color: rgb(216 180 254 / var(--tw-text-opacity)); +} + +.text-red-300 { + --tw-text-opacity: 1; + color: rgb(252 165 165 / var(--tw-text-opacity)); +} + +.text-white { + --tw-text-opacity: 1; + color: rgb(255 255 255 / var(--tw-text-opacity)); +} + +.text-yellow-300 { + --tw-text-opacity: 1; + color: rgb(253 224 71 / var(--tw-text-opacity)); +} + +.shadow-md { + --tw-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1); + --tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color); + box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow); +} + +.filter { + filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow); +} + +.hover\:bg-gray-600:hover { + --tw-bg-opacity: 1; + background-color: rgb(75 85 99 / var(--tw-bg-opacity)); +} + +.hover\:bg-gray-700:hover { + --tw-bg-opacity: 1; + background-color: rgb(55 65 81 / var(--tw-bg-opacity)); +} + +.hover\:bg-zinc-400:hover { + --tw-bg-opacity: 1; + background-color: rgb(161 161 170 / var(--tw-bg-opacity)); +} + +.hover\:text-white:hover { + --tw-text-opacity: 1; + color: rgb(255 255 255 / var(--tw-text-opacity)); +} + +.focus\:outline-none:focus { + outline: 2px solid transparent; + outline-offset: 2px; +} + +.focus\:ring-2:focus { + --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color); + --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color); + box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000); +} + +.focus\:ring-gray-500:focus { + --tw-ring-opacity: 1; + --tw-ring-color: rgb(107 114 128 / var(--tw-ring-opacity)); +} + +.active\:text-white\/80:active { + color: rgb(255 255 255 / 0.8); +} + +.phx-submit-loading\:opacity-75.phx-submit-loading { + opacity: 0.75; +} + +.phx-submit-loading .phx-submit-loading\:opacity-75 { + opacity: 0.75; +} + +@media (min-width: 640px) { + .sm\:rounded-lg { + border-radius: 0.5rem; + } +} + +@media (min-width: 768px) { + .md\:col-span-3 { + grid-column: span 3 / span 3; + } + + .md\:mt-0 { + margin-top: 0px; + } + + .md\:block { + display: block; + } + + .md\:hidden { + display: none; + } + + .md\:w-auto { + width: auto; + } + + .md\:grid-cols-4 { + grid-template-columns: repeat(4, minmax(0, 1fr)); + } + + .md\:flex-row { + flex-direction: row; + } + + .md\:space-x-3 > :not([hidden]) ~ :not([hidden]) { + --tw-space-x-reverse: 0; + margin-right: calc(0.75rem * var(--tw-space-x-reverse)); + margin-left: calc(0.75rem * calc(1 - var(--tw-space-x-reverse))); + } + + .md\:space-x-8 > :not([hidden]) ~ :not([hidden]) { + --tw-space-x-reverse: 0; + margin-right: calc(2rem * var(--tw-space-x-reverse)); + margin-left: calc(2rem * calc(1 - var(--tw-space-x-reverse))); + } + + .md\:border-0 { + border-width: 0px; + } + + .md\:border-r-2 { + border-right-width: 2px; + } + + .md\:border-gray-500 { + --tw-border-opacity: 1; + border-color: rgb(107 114 128 / var(--tw-border-opacity)); + } + + .md\:bg-gray-800 { + --tw-bg-opacity: 1; + background-color: rgb(31 41 55 / var(--tw-bg-opacity)); + } + + .md\:p-0 { + padding: 0px; + } + + .md\:pl-0 { + padding-left: 0px; + } + + .md\:hover\:bg-transparent:hover { + background-color: transparent; + } + + .md\:hover\:text-blue-500:hover { + --tw-text-opacity: 1; + color: rgb(59 130 246 / var(--tw-text-opacity)); + } +} + +.rtl\:space-x-reverse:where([dir="rtl"], [dir="rtl"] *) > :not([hidden]) ~ :not([hidden]) { + --tw-space-x-reverse: 1; +} + +.rtl\:text-right:where([dir="rtl"], [dir="rtl"] *) { + text-align: right; +} + +@media (prefers-color-scheme: dark) { + .dark\:bg-gray-600 { + --tw-bg-opacity: 1; + background-color: rgb(75 85 99 / var(--tw-bg-opacity)); + } + + .dark\:text-gray-400 { + --tw-text-opacity: 1; + color: rgb(156 163 175 / var(--tw-text-opacity)); + } +} + diff --git a/priv/static/app.js b/priv/static/app.js new file mode 100644 index 0000000..c1f8744 --- /dev/null +++ b/priv/static/app.js @@ -0,0 +1,14 @@ +var G5=Object.create;var{defineProperty:I1,getPrototypeOf:j5,getOwnPropertyNames:K5}=Object;var B5=Object.prototype.hasOwnProperty;var M5=(Q,Z,$)=>{$=Q!=null?G5(j5(Q)):{};const Y=Z||!Q||!Q.__esModule?I1($,"default",{value:Q,enumerable:!0}):$;for(let z of K5(Q))if(!B5.call(Y,z))I1(Y,z,{get:()=>Q[z],enumerable:!0});return Y};var U5=(Q,Z)=>()=>(Z||Q((Z={exports:{}}).exports,Z),Z.exports);var J5=U5((z5,i0)=>{(function(Q,Z){function $(){Y.width=Q.innerWidth,Y.height=5*j.barThickness;var U=Y.getContext("2d");U.shadowBlur=j.shadowBlur,U.shadowColor=j.shadowColor;var V,X=U.createLinearGradient(0,0,Y.width,0);for(V in j.barColors)X.addColorStop(V,j.barColors[V]);U.lineWidth=j.barThickness,U.beginPath(),U.moveTo(0,j.barThickness/2),U.lineTo(Math.ceil(z*Y.width),j.barThickness/2),U.strokeStyle=X,U.stroke()}var Y,z,J,W=null,q=null,G=null,j={autoRun:!0,barThickness:3,barColors:{0:"rgba(26, 188, 156, .9)",".25":"rgba(52, 152, 219, .9)",".50":"rgba(241, 196, 15, .9)",".75":"rgba(230, 126, 34, .9)","1.0":"rgba(211, 84, 0, .9)"},shadowBlur:10,shadowColor:"rgba(0, 0, 0, .6)",className:null},B={config:function(U){for(var V in U)j.hasOwnProperty(V)&&(j[V]=U[V])},show:function(U){var V,X;J||(U?G=G||setTimeout(()=>B.show(),U):(J=!0,q!==null&&Q.cancelAnimationFrame(q),Y||((X=(Y=Z.createElement("canvas")).style).position="fixed",X.top=X.left=X.right=X.margin=X.padding=0,X.zIndex=100001,X.display="none",j.className&&Y.classList.add(j.className),V="resize",U=$,(X=Q).addEventListener?X.addEventListener(V,U,!1):X.attachEvent?X.attachEvent("on"+V,U):X["on"+V]=U),Y.parentElement||Z.body.appendChild(Y),Y.style.opacity=1,Y.style.display="block",B.progress(0),j.autoRun&&function L(){W=Q.requestAnimationFrame(L),B.progress("+"+0.05*Math.pow(1-Math.sqrt(z),2))}()))},progress:function(U){return U===void 0||(typeof U=="string"&&(U=(0<=U.indexOf("+")||0<=U.indexOf("-")?z:0)+parseFloat(U)),z=1{if(typeof Q==="function")return Q;else return function(){return Q}},V5=typeof self!=="undefined"?self:null,V0=typeof window!=="undefined"?window:null,q0=V5||V0||q0,X5="2.0.0",p={connecting:0,open:1,closing:2,closed:3},L5=1e4,F5=1000,_={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},n={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave"},l0={longpoll:"longpoll",websocket:"websocket"},D5={complete:4},S0=class{constructor(Q,Z,$,Y){this.channel=Q,this.event=Z,this.payload=$||function(){return{}},this.receivedResp=null,this.timeout=Y,this.timeoutTimer=null,this.recHooks=[],this.sent=!1}resend(Q){this.timeout=Q,this.reset(),this.send()}send(){if(this.hasReceived("timeout"))return;this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload(),ref:this.ref,join_ref:this.channel.joinRef()})}receive(Q,Z){if(this.hasReceived(Q))Z(this.receivedResp.response);return this.recHooks.push({status:Q,callback:Z}),this}reset(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=!1}matchReceive({status:Q,response:Z,_ref:$}){this.recHooks.filter((Y)=>Y.status===Q).forEach((Y)=>Y.callback(Z))}cancelRefEvent(){if(!this.refEvent)return;this.channel.off(this.refEvent)}cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=null}startTimeout(){if(this.timeoutTimer)this.cancelTimeout();this.ref=this.channel.socket.makeRef(),this.refEvent=this.channel.replyEventName(this.ref),this.channel.on(this.refEvent,(Q)=>{this.cancelRefEvent(),this.cancelTimeout(),this.receivedResp=Q,this.matchReceive(Q)}),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}hasReceived(Q){return this.receivedResp&&this.receivedResp.status===Q}trigger(Q,Z){this.channel.trigger(this.refEvent,{status:Q,response:Z})}},H1=class{constructor(Q,Z){this.callback=Q,this.timerCalc=Z,this.timer=null,this.tries=0}reset(){this.tries=0,clearTimeout(this.timer)}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}},I5=class{constructor(Q,Z,$){this.state=_.closed,this.topic=Q,this.params=X0(Z||{}),this.socket=$,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new S0(this,n.join,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new H1(()=>{if(this.socket.isConnected())this.rejoin()},this.socket.rejoinAfterMs),this.stateChangeRefs.push(this.socket.onError(()=>this.rejoinTimer.reset())),this.stateChangeRefs.push(this.socket.onOpen(()=>{if(this.rejoinTimer.reset(),this.isErrored())this.rejoin()})),this.joinPush.receive("ok",()=>{this.state=_.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach((Y)=>Y.send()),this.pushBuffer=[]}),this.joinPush.receive("error",()=>{if(this.state=_.errored,this.socket.isConnected())this.rejoinTimer.scheduleTimeout()}),this.onClose(()=>{if(this.rejoinTimer.reset(),this.socket.hasLogger())this.socket.log("channel",`close ${this.topic} ${this.joinRef()}`);this.state=_.closed,this.socket.remove(this)}),this.onError((Y)=>{if(this.socket.hasLogger())this.socket.log("channel",`error ${this.topic}`,Y);if(this.isJoining())this.joinPush.reset();if(this.state=_.errored,this.socket.isConnected())this.rejoinTimer.scheduleTimeout()}),this.joinPush.receive("timeout",()=>{if(this.socket.hasLogger())this.socket.log("channel",`timeout ${this.topic} (${this.joinRef()})`,this.joinPush.timeout);if(new S0(this,n.leave,X0({}),this.timeout).send(),this.state=_.errored,this.joinPush.reset(),this.socket.isConnected())this.rejoinTimer.scheduleTimeout()}),this.on(n.reply,(Y,z)=>{this.trigger(this.replyEventName(z),Y)})}join(Q=this.timeout){if(this.joinedOnce)throw new Error("tried to join multiple times. 'join' can only be called a single time per channel instance");else return this.timeout=Q,this.joinedOnce=!0,this.rejoin(),this.joinPush}onClose(Q){this.on(n.close,Q)}onError(Q){return this.on(n.error,(Z)=>Q(Z))}on(Q,Z){let $=this.bindingRef++;return this.bindings.push({event:Q,ref:$,callback:Z}),$}off(Q,Z){this.bindings=this.bindings.filter(($)=>{return!($.event===Q&&(typeof Z==="undefined"||Z===$.ref))})}canPush(){return this.socket.isConnected()&&this.isJoined()}push(Q,Z,$=this.timeout){if(Z=Z||{},!this.joinedOnce)throw new Error(`tried to push '${Q}' to '${this.topic}' before joining. Use channel.join() before pushing events`);let Y=new S0(this,Q,function(){return Z},$);if(this.canPush())Y.send();else Y.startTimeout(),this.pushBuffer.push(Y);return Y}leave(Q=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=_.leaving;let Z=()=>{if(this.socket.hasLogger())this.socket.log("channel",`leave ${this.topic}`);this.trigger(n.close,"leave")},$=new S0(this,n.leave,X0({}),Q);if($.receive("ok",()=>Z()).receive("timeout",()=>Z()),$.send(),!this.canPush())$.trigger("ok",{});return $}onMessage(Q,Z,$){return Z}isMember(Q,Z,$,Y){if(this.topic!==Q)return!1;if(Y&&Y!==this.joinRef()){if(this.socket.hasLogger())this.socket.log("channel","dropping outdated message",{topic:Q,event:Z,payload:$,joinRef:Y});return!1}else return!0}joinRef(){return this.joinPush.ref}rejoin(Q=this.timeout){if(this.isLeaving())return;this.socket.leaveOpenTopic(this.topic),this.state=_.joining,this.joinPush.resend(Q)}trigger(Q,Z,$,Y){let z=this.onMessage(Q,Z,$,Y);if(Z&&!z)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");let J=this.bindings.filter((W)=>W.event===Q);for(let W=0;W{let q=this.parseJSON(Q.responseText);W&&W(q)},J)Q.ontimeout=J;return Q.onprogress=()=>{},Q.send(Y),Q}static xhrRequest(Q,Z,$,Y,z,J,W,q){if(Q.open(Z,$,!0),Q.timeout=J,Q.setRequestHeader("Content-Type",Y),Q.onerror=()=>q&&q(null),Q.onreadystatechange=()=>{if(Q.readyState===D5.complete&&q){let G=this.parseJSON(Q.responseText);q(G)}},W)Q.ontimeout=W;return Q.send(z),Q}static parseJSON(Q){if(!Q||Q==="")return null;try{return JSON.parse(Q)}catch(Z){return console&&console.log("failed to parse JSON response",Q),null}}static serialize(Q,Z){let $=[];for(var Y in Q){if(!Object.prototype.hasOwnProperty.call(Q,Y))continue;let z=Z?`${Z}[${Y}]`:Y,J=Q[Y];if(typeof J==="object")$.push(this.serialize(J,z));else $.push(encodeURIComponent(z)+"="+encodeURIComponent(J))}return $.join("&")}static appendParams(Q,Z){if(Object.keys(Z).length===0)return Q;let $=Q.match(/\?/)?"&":"?";return`${Q}${$}${this.serialize(Z)}`}},H5=(Q)=>{let Z="",$=new Uint8Array(Q),Y=$.byteLength;for(let z=0;zthis.poll(),0)}normalizeEndpoint(Q){return Q.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+l0.websocket),"$1/"+l0.longpoll)}endpointURL(){return T0.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(Q,Z,$){this.close(Q,Z,$),this.readyState=p.connecting}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return this.readyState===p.open||this.readyState===p.connecting}poll(){this.ajax("GET","application/json",null,()=>this.ontimeout(),(Q)=>{if(Q){var{status:Z,token:$,messages:Y}=Q;this.token=$}else Z=0;switch(Z){case 200:Y.forEach((z)=>{setTimeout(()=>this.onmessage({data:z}),0)}),this.poll();break;case 204:this.poll();break;case 410:this.readyState=p.open,this.onopen({}),this.poll();break;case 403:this.onerror(403),this.close(1008,"forbidden",!1);break;case 0:case 500:this.onerror(500),this.closeAndRetry(1011,"internal server error",500);break;default:throw new Error(`unhandled poll status ${Z}`)}})}send(Q){if(typeof Q!=="string")Q=H5(Q);if(this.currentBatch)this.currentBatch.push(Q);else if(this.awaitingBatchAck)this.batchBuffer.push(Q);else this.currentBatch=[Q],this.currentBatchTimer=setTimeout(()=>{this.batchSend(this.currentBatch),this.currentBatch=null},0)}batchSend(Q){this.awaitingBatchAck=!0,this.ajax("POST","application/x-ndjson",Q.join("\n"),()=>this.onerror("timeout"),(Z)=>{if(this.awaitingBatchAck=!1,!Z||Z.status!==200)this.onerror(Z&&Z.status),this.closeAndRetry(1011,"internal server error",!1);else if(this.batchBuffer.length>0)this.batchSend(this.batchBuffer),this.batchBuffer=[]})}close(Q,Z,$){for(let z of this.reqs)z.abort();this.readyState=p.closed;let Y=Object.assign({code:1000,reason:void 0,wasClean:!0},{code:Q,reason:Z,wasClean:$});if(this.batchBuffer=[],clearTimeout(this.currentBatchTimer),this.currentBatchTimer=null,typeof CloseEvent!=="undefined")this.onclose(new CloseEvent("close",Y));else this.onclose(Y)}ajax(Q,Z,$,Y,z){let J,W=()=>{this.reqs.delete(J),Y()};J=T0.request(Q,this.endpointURL(),Z,$,this.timeout,W,(q)=>{if(this.reqs.delete(J),this.isActive())z(q)}),this.reqs.add(J)}};var y0={HEADER_LENGTH:1,META_LENGTH:4,KINDS:{push:0,reply:1,broadcast:2},encode(Q,Z){if(Q.payload.constructor===ArrayBuffer)return Z(this.binaryEncode(Q));else{let $=[Q.join_ref,Q.ref,Q.topic,Q.event,Q.payload];return Z(JSON.stringify($))}},decode(Q,Z){if(Q.constructor===ArrayBuffer)return Z(this.binaryDecode(Q));else{let[$,Y,z,J,W]=JSON.parse(Q);return Z({join_ref:$,ref:Y,topic:z,event:J,payload:W})}},binaryEncode(Q){let{join_ref:Z,ref:$,event:Y,topic:z,payload:J}=Q,W=this.META_LENGTH+Z.length+$.length+z.length+Y.length,q=new ArrayBuffer(this.HEADER_LENGTH+W),G=new DataView(q),j=0;G.setUint8(j++,this.KINDS.push),G.setUint8(j++,Z.length),G.setUint8(j++,$.length),G.setUint8(j++,z.length),G.setUint8(j++,Y.length),Array.from(Z,(U)=>G.setUint8(j++,U.charCodeAt(0))),Array.from($,(U)=>G.setUint8(j++,U.charCodeAt(0))),Array.from(z,(U)=>G.setUint8(j++,U.charCodeAt(0))),Array.from(Y,(U)=>G.setUint8(j++,U.charCodeAt(0)));var B=new Uint8Array(q.byteLength+J.byteLength);return B.set(new Uint8Array(q),0),B.set(new Uint8Array(J),q.byteLength),B.buffer},binaryDecode(Q){let Z=new DataView(Q),$=Z.getUint8(0),Y=new TextDecoder;switch($){case this.KINDS.push:return this.decodePush(Q,Z,Y);case this.KINDS.reply:return this.decodeReply(Q,Z,Y);case this.KINDS.broadcast:return this.decodeBroadcast(Q,Z,Y)}},decodePush(Q,Z,$){let Y=Z.getUint8(1),z=Z.getUint8(2),J=Z.getUint8(3),W=this.HEADER_LENGTH+this.META_LENGTH-1,q=$.decode(Q.slice(W,W+Y));W=W+Y;let G=$.decode(Q.slice(W,W+z));W=W+z;let j=$.decode(Q.slice(W,W+J));W=W+J;let B=Q.slice(W,Q.byteLength);return{join_ref:q,ref:null,topic:G,event:j,payload:B}},decodeReply(Q,Z,$){let Y=Z.getUint8(1),z=Z.getUint8(2),J=Z.getUint8(3),W=Z.getUint8(4),q=this.HEADER_LENGTH+this.META_LENGTH,G=$.decode(Q.slice(q,q+Y));q=q+Y;let j=$.decode(Q.slice(q,q+z));q=q+z;let B=$.decode(Q.slice(q,q+J));q=q+J;let U=$.decode(Q.slice(q,q+W));q=q+W;let V=Q.slice(q,Q.byteLength),X={status:U,response:V};return{join_ref:G,ref:j,topic:B,event:n.reply,payload:X}},decodeBroadcast(Q,Z,$){let Y=Z.getUint8(1),z=Z.getUint8(2),J=this.HEADER_LENGTH+2,W=$.decode(Q.slice(J,J+Y));J=J+Y;let q=$.decode(Q.slice(J,J+z));J=J+z;let G=Q.slice(J,Q.byteLength);return{join_ref:null,ref:null,topic:W,event:q,payload:G}}},x1=class{constructor(Q,Z={}){if(this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.timeout=Z.timeout||L5,this.transport=Z.transport||q0.WebSocket||z0,this.primaryPassedHealthCheck=!1,this.longPollFallbackMs=Z.longPollFallbackMs,this.fallbackTimer=null,this.sessionStore=Z.sessionStorage||q0.sessionStorage,this.establishedConnections=0,this.defaultEncoder=y0.encode.bind(y0),this.defaultDecoder=y0.decode.bind(y0),this.closeWasClean=!1,this.binaryType=Z.binaryType||"arraybuffer",this.connectClock=1,this.transport!==z0)this.encode=Z.encode||this.defaultEncoder,this.decode=Z.decode||this.defaultDecoder;else this.encode=this.defaultEncoder,this.decode=this.defaultDecoder;let $=null;if(V0&&V0.addEventListener)V0.addEventListener("pagehide",(Y)=>{if(this.conn)this.disconnect(),$=this.connectClock}),V0.addEventListener("pageshow",(Y)=>{if($===this.connectClock)$=null,this.connect()});if(this.heartbeatIntervalMs=Z.heartbeatIntervalMs||30000,this.rejoinAfterMs=(Y)=>{if(Z.rejoinAfterMs)return Z.rejoinAfterMs(Y);else return[1000,2000,5000][Y-1]||1e4},this.reconnectAfterMs=(Y)=>{if(Z.reconnectAfterMs)return Z.reconnectAfterMs(Y);else return[10,50,100,150,200,250,500,1000,2000][Y-1]||5000},this.logger=Z.logger||null,!this.logger&&Z.debug)this.logger=(Y,z,J)=>{console.log(`${Y}: ${z}`,J)};this.longpollerTimeout=Z.longpollerTimeout||20000,this.params=X0(Z.params||{}),this.endPoint=`${Q}/${l0.websocket}`,this.vsn=Z.vsn||X5,this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new H1(()=>{this.teardown(()=>this.connect())},this.reconnectAfterMs)}getLongPollTransport(){return z0}replaceTransport(Q){if(this.connectClock++,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.conn)this.conn.close(),this.conn=null;this.transport=Q}protocol(){return location.protocol.match(/^https/)?"wss":"ws"}endPointURL(){let Q=T0.appendParams(T0.appendParams(this.endPoint,this.params()),{vsn:this.vsn});if(Q.charAt(0)!=="/")return Q;if(Q.charAt(1)==="/")return`${this.protocol()}:${Q}`;return`${this.protocol()}://${location.host}${Q}`}disconnect(Q,Z,$){this.connectClock++,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.teardown(Q,Z,$)}connect(Q){if(Q)console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=X0(Q);if(this.conn)return;if(this.longPollFallbackMs&&this.transport!==z0)this.connectWithFallback(z0,this.longPollFallbackMs);else this.transportConnect()}log(Q,Z,$){this.logger&&this.logger(Q,Z,$)}hasLogger(){return this.logger!==null}onOpen(Q){let Z=this.makeRef();return this.stateChangeCallbacks.open.push([Z,Q]),Z}onClose(Q){let Z=this.makeRef();return this.stateChangeCallbacks.close.push([Z,Q]),Z}onError(Q){let Z=this.makeRef();return this.stateChangeCallbacks.error.push([Z,Q]),Z}onMessage(Q){let Z=this.makeRef();return this.stateChangeCallbacks.message.push([Z,Q]),Z}ping(Q){if(!this.isConnected())return!1;let Z=this.makeRef(),$=Date.now();this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:Z});let Y=this.onMessage((z)=>{if(z.ref===Z)this.off([Y]),Q(Date.now()-$)});return!0}transportConnect(){this.connectClock++,this.closeWasClean=!1,this.conn=new this.transport(this.endPointURL()),this.conn.binaryType=this.binaryType,this.conn.timeout=this.longpollerTimeout,this.conn.onopen=()=>this.onConnOpen(),this.conn.onerror=(Q)=>this.onConnError(Q),this.conn.onmessage=(Q)=>this.onConnMessage(Q),this.conn.onclose=(Q)=>this.onConnClose(Q)}getSession(Q){return this.sessionStore&&this.sessionStore.getItem(Q)}storeSession(Q,Z){this.sessionStore&&this.sessionStore.setItem(Q,Z)}connectWithFallback(Q,Z=2500){clearTimeout(this.fallbackTimer);let $=!1,Y=!0,z,J,W=(q)=>{this.log("transport",`falling back to ${Q.name}...`,q),this.off([z,J]),Y=!1,this.replaceTransport(Q),this.transportConnect()};if(this.getSession(`phx:fallback:${Q.name}`))return W("memorized");this.fallbackTimer=setTimeout(W,Z),J=this.onError((q)=>{if(this.log("transport","error",q),Y&&!$)clearTimeout(this.fallbackTimer),W(q)}),this.onOpen(()=>{if($=!0,!Y){if(!this.primaryPassedHealthCheck)this.storeSession(`phx:fallback:${Q.name}`,"true");return this.log("transport",`established ${Q.name} fallback`)}clearTimeout(this.fallbackTimer),this.fallbackTimer=setTimeout(W,Z),this.ping((q)=>{this.log("transport","connected to primary after",q),this.primaryPassedHealthCheck=!0,clearTimeout(this.fallbackTimer)})}),this.transportConnect()}clearHeartbeats(){clearTimeout(this.heartbeatTimer),clearTimeout(this.heartbeatTimeoutTimer)}onConnOpen(){if(this.hasLogger())this.log("transport",`${this.transport.name} connected to ${this.endPointURL()}`);this.closeWasClean=!1,this.establishedConnections++,this.flushSendBuffer(),this.reconnectTimer.reset(),this.resetHeartbeat(),this.stateChangeCallbacks.open.forEach(([,Q])=>Q())}heartbeatTimeout(){if(this.pendingHeartbeatRef){if(this.pendingHeartbeatRef=null,this.hasLogger())this.log("transport","heartbeat timeout. Attempting to re-establish connection");this.triggerChanError(),this.closeWasClean=!1,this.teardown(()=>this.reconnectTimer.scheduleTimeout(),F5,"heartbeat timeout")}}resetHeartbeat(){if(this.conn&&this.conn.skipHeartbeat)return;this.pendingHeartbeatRef=null,this.clearHeartbeats(),this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs)}teardown(Q,Z,$){if(!this.conn)return Q&&Q();this.waitForBufferDone(()=>{if(this.conn)if(Z)this.conn.close(Z,$||"");else this.conn.close();this.waitForSocketClosed(()=>{if(this.conn)this.conn.onopen=function(){},this.conn.onerror=function(){},this.conn.onmessage=function(){},this.conn.onclose=function(){},this.conn=null;Q&&Q()})})}waitForBufferDone(Q,Z=1){if(Z===5||!this.conn||!this.conn.bufferedAmount){Q();return}setTimeout(()=>{this.waitForBufferDone(Q,Z+1)},150*Z)}waitForSocketClosed(Q,Z=1){if(Z===5||!this.conn||this.conn.readyState===p.closed){Q();return}setTimeout(()=>{this.waitForSocketClosed(Q,Z+1)},150*Z)}onConnClose(Q){let Z=Q&&Q.code;if(this.hasLogger())this.log("transport","close",Q);if(this.triggerChanError(),this.clearHeartbeats(),!this.closeWasClean&&Z!==1000)this.reconnectTimer.scheduleTimeout();this.stateChangeCallbacks.close.forEach(([,$])=>$(Q))}onConnError(Q){if(this.hasLogger())this.log("transport",Q);let Z=this.transport,$=this.establishedConnections;if(this.stateChangeCallbacks.error.forEach(([,Y])=>{Y(Q,Z,$)}),Z===this.transport||$>0)this.triggerChanError()}triggerChanError(){this.channels.forEach((Q)=>{if(!(Q.isErrored()||Q.isLeaving()||Q.isClosed()))Q.trigger(n.error)})}connectionState(){switch(this.conn&&this.conn.readyState){case p.connecting:return"connecting";case p.open:return"open";case p.closing:return"closing";default:return"closed"}}isConnected(){return this.connectionState()==="open"}remove(Q){this.off(Q.stateChangeRefs),this.channels=this.channels.filter((Z)=>Z!==Q)}off(Q){for(let Z in this.stateChangeCallbacks)this.stateChangeCallbacks[Z]=this.stateChangeCallbacks[Z].filter(([$])=>{return Q.indexOf($)===-1})}channel(Q,Z={}){let $=new I5(Q,Z,this);return this.channels.push($),$}push(Q){if(this.hasLogger()){let{topic:Z,event:$,payload:Y,ref:z,join_ref:J}=Q;this.log("push",`${Z} ${$} (${J}, ${z})`,Y)}if(this.isConnected())this.encode(Q,(Z)=>this.conn.send(Z));else this.sendBuffer.push(()=>this.encode(Q,(Z)=>this.conn.send(Z)))}makeRef(){let Q=this.ref+1;if(Q===this.ref)this.ref=0;else this.ref=Q;return this.ref.toString()}sendHeartbeat(){if(this.pendingHeartbeatRef&&!this.isConnected())return;this.pendingHeartbeatRef=this.makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef}),this.heartbeatTimeoutTimer=setTimeout(()=>this.heartbeatTimeout(),this.heartbeatIntervalMs)}flushSendBuffer(){if(this.isConnected()&&this.sendBuffer.length>0)this.sendBuffer.forEach((Q)=>Q()),this.sendBuffer=[]}onConnMessage(Q){this.decode(Q.data,(Z)=>{let{topic:$,event:Y,payload:z,ref:J,join_ref:W}=Z;if(J&&J===this.pendingHeartbeatRef)this.clearHeartbeats(),this.pendingHeartbeatRef=null,this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs);if(this.hasLogger())this.log("receive",`${z.status||""} ${$} ${Y} ${J&&"("+J+")"||""}`,z);for(let q=0;q$.topic===Q&&($.isJoined()||$.isJoining()));if(Z){if(this.hasLogger())this.log("transport",`leaving duplicate topic "${Q}"`);Z.leave()}}};var p5=function(){let Q=new Set,Z=document.querySelectorAll("*[id]");for(let $=0,Y=Z.length;$=0;G--)if(Y=$[G],z=Y.name,J=Y.namespaceURI,W=Y.value,J){if(z=Y.localName||z,q=Q.getAttributeNS(J,z),q!==W){if(Y.prefix==="xmlns")z=Y.name;Q.setAttributeNS(J,z,W)}}else if(q=Q.getAttribute(z),q!==W)Q.setAttribute(z,W);var j=Q.attributes;for(var B=j.length-1;B>=0;B--)if(Y=j[B],z=Y.name,J=Y.namespaceURI,J){if(z=Y.localName||z,!Z.hasAttributeNS(J,z))Q.removeAttributeNS(J,z)}else if(!Z.hasAttribute(z))Q.removeAttribute(z)},$9=function(Q){var Z=N.createElement("template");return Z.innerHTML=Q,Z.content.childNodes[0]},Y9=function(Q){if(!v0)v0=N.createRange(),v0.selectNode(N.body);var Z=v0.createContextualFragment(Q);return Z.childNodes[0]},z9=function(Q){var Z=N.createElement("body");return Z.innerHTML=Q,Z.childNodes[0]},J9=function(Q){if(Q=Q.trim(),Q9)return $9(Q);else if(Z9)return Y9(Q);return z9(Q)},h0=function(Q,Z){var $=Q.nodeName,Y=Z.nodeName,z,J;if($===Y)return!0;if(z=$.charCodeAt(0),J=Y.charCodeAt(0),z<=90&&J>=97)return $===Y.toUpperCase();else if(J<=90&&z>=97)return Y===$.toUpperCase();else return!1},W9=function(Q,Z){return!Z||Z===e5?N.createElement(Q):N.createElementNS(Z,Q)},q9=function(Q,Z){var $=Q.firstChild;while($){var Y=$.nextSibling;Z.appendChild($),$=Y}return Z},q1=function(Q,Z,$){if(Q[$]!==Z[$])if(Q[$]=Z[$],Q[$])Q.setAttribute($,"");else Q.removeAttribute($)},e=function(){},G9=function(Q){if(Q)return Q.getAttribute&&Q.getAttribute("id")||Q.id},j9=function(Q){return function Z($,Y,z){if(!z)z={};if(typeof Y==="string")if($.nodeName==="#document"||$.nodeName==="HTML"||$.nodeName==="BODY"){var J=Y;Y=N.createElement("html"),Y.innerHTML=J}else Y=J9(Y);else if(Y.nodeType===p1)Y=Y.firstElementChild;var W=z.getNodeKey||G9,q=z.onBeforeNodeAdded||e,G=z.onNodeAdded||e,j=z.onBeforeElUpdated||e,B=z.onElUpdated||e,U=z.onBeforeNodeDiscarded||e,V=z.onNodeDiscarded||e,X=z.onBeforeElChildrenUpdated||e,L=z.skipFromChildren||e,H=z.addChild||function(I,F){return I.appendChild(F)},P=z.childrenOnly===!0,y=Object.create(null),g=[];function E(I){g.push(I)}function C(I,F){if(I.nodeType===x0){var R=I.firstChild;while(R){var x=void 0;if(F&&(x=W(R)))E(x);else if(V(R),R.firstChild)C(R,F);R=R.nextSibling}}}function Y0(I,F,R){if(U(I)===!1)return;if(F)F.removeChild(I);V(I),C(I,R)}function S(I){if(I.nodeType===x0||I.nodeType===p1){var F=I.firstChild;while(F){var R=W(F);if(R)y[R]=F;S(F),F=F.nextSibling}}}S($);function d(I){G(I);var F=I.firstChild;while(F){var R=F.nextSibling,x=W(F);if(x){var A=y[x];if(A&&h0(F,A))F.parentNode.replaceChild(A,F),D(A,F);else d(F)}else d(F);F=R}}function M(I,F,R){while(F){var x=F.nextSibling;if(R=W(F))E(R);else Y0(F,I,!0);F=x}}function D(I,F,R){var x=W(F);if(x)delete y[x];if(!R){if(j(I,F)===!1)return;if(Q(I,F),B(I),X(I,F)===!1)return}if(I.nodeName!=="TEXTAREA")k(I,F);else f1.TEXTAREA(I,F)}function k(I,F){var R=L(I,F),x=F.firstChild,A=I.firstChild,J0,i,W0,w0,l;Q:while(x){w0=x.nextSibling,J0=W(x);while(!R&&A){if(W0=A.nextSibling,x.isSameNode&&x.isSameNode(A)){x=w0,A=W0;continue Q}i=W(A);var P0=A.nodeType,t=void 0;if(P0===x.nodeType){if(P0===x0){if(J0){if(J0!==i)if(l=y[J0])if(W0===l)t=!1;else{if(I.insertBefore(l,A),i)E(i);else Y0(A,I,!0);A=l,i=W(A)}else t=!1}else if(i)t=!1;if(t=t!==!1&&h0(A,x),t)D(A,x)}else if(P0===m1||P0==c1){if(t=!0,A.nodeValue!==x.nodeValue)A.nodeValue=x.nodeValue}}if(t){x=w0,A=W0;continue Q}if(i)E(i);else Y0(A,I,!0);A=W0}if(J0&&(l=y[J0])&&h0(l,x)){if(!R)H(I,l);D(l,x)}else{var o0=q(x);if(o0!==!1){if(o0)x=o0;if(x.actualize)x=x.actualize(I.ownerDocument||N);H(I,x),d(x)}}x=w0,A=W0}M(I,A,i);var D1=f1[I.nodeName];if(D1)D1(I,F)}var O=$,f=O.nodeType,F1=Y.nodeType;if(!P){if(f===x0)if(F1===x0){if(!h0($,Y))V($),O=q9($,W9(Y.nodeName,Y.namespaceURI))}else O=Y;else if(f===m1||f===c1)if(F1===f){if(O.nodeValue!==Y.nodeValue)O.nodeValue=Y.nodeValue;return O}else O=Y}if(O===Y)V($);else{if(Y.isSameNode&&Y.isSameNode(O))return;if(D(O,Y,P),g)for(var a0=0,q5=g.length;a0this.error(Q)),this.uploadChannel.join().receive("ok",(Q)=>this.readNextChunk()).receive("error",(Q)=>this.error(Q))}isDone(){return this.offset>=this.entry.file.size}readNextChunk(){let Q=new window.FileReader,Z=this.entry.file.slice(this.offset,this.chunkSize+this.offset);Q.onload=($)=>{if($.target.error===null)this.offset+=$.target.result.byteLength,this.pushChunk($.target.result);else return h("Read error: "+$.target.error)},Q.readAsArrayBuffer(Z)}pushChunk(Q){if(!this.uploadChannel.isJoined())return;this.uploadChannel.push("chunk",Q).receive("ok",()=>{if(this.entry.progress(this.offset/this.entry.file.size*100),!this.isDone())this.chunkTimer=setTimeout(()=>this.readNextChunk(),this.liveSocket.getLatencySim()||0)}).receive("error",({reason:Z})=>this.error(Z))}},h=(Q,Z)=>console.error&&console.error(Q,Z),a=(Q)=>{let Z=typeof Q;return Z==="number"||Z==="string"&&/^(0|[1-9]\d*)$/.test(Q)},m5=(Q,Z,$,Y)=>{if(Q.liveSocket.isDebugEnabled())console.log(`${Q.id} ${Z}: ${$} - `,Y)},W1=(Q)=>typeof Q==="function"?Q:function(){return Q},p0=(Q)=>{return JSON.parse(JSON.stringify(Q))},R0=(Q,Z,$)=>{do{if(Q.matches(`[${Z}]`)&&!Q.disabled)return Q;Q=Q.parentElement||Q.parentNode}while(Q!==null&&Q.nodeType===1&&!($&&$.isSameNode(Q)||Q.matches(U0)));return null},j0=(Q)=>{return Q!==null&&typeof Q==="object"&&!(Q instanceof Array)},c5=(Q,Z)=>JSON.stringify(Q)===JSON.stringify(Z),_1=(Q)=>{for(let Z in Q)return!1;return!0},Z0=(Q,Z)=>Q&&Z(Q),s5=function(Q,Z,$,Y){Q.forEach((z)=>{new f5(z,$.config.chunk_size,Y).upload()})},e1={canPushState(){return typeof history.pushState!=="undefined"},dropLocal(Q,Z,$){return Q.removeItem(this.localKey(Z,$))},updateLocal(Q,Z,$,Y,z){let J=this.getLocal(Q,Z,$),W=this.localKey(Z,$),q=J===null?Y:z(J);return Q.setItem(W,JSON.stringify(q)),q},getLocal(Q,Z,$){return JSON.parse(Q.getItem(this.localKey(Z,$)))},updateCurrentState(Q){if(!this.canPushState())return;history.replaceState(Q(history.state||{}),"",window.location.href)},pushState(Q,Z,$){if(this.canPushState()){if($!==window.location.href){if(Z.type=="redirect"&&Z.scroll){let z=history.state||{};z.scroll=Z.scroll,history.replaceState(z,"",window.location.href)}delete Z.scroll,history[Q+"State"](Z,"",$||null);let Y=this.getHashTargetEl(window.location.hash);if(Y)Y.scrollIntoView();else if(Z.type==="redirect")window.scroll(0,0)}}else this.redirect($)},setCookie(Q,Z){document.cookie=`${Q}=${Z}`},getCookie(Q){return document.cookie.replace(new RegExp(`(?:(?:^|.*;s*)${Q}s*=s*([^;]*).*\$)|^.*\$`),"$1")},redirect(Q,Z){if(Z)e1.setCookie("__phoenix_flash__",Z+"; max-age=60000; path=/");window.location=Q},localKey(Q,Z){return`${Q}-${Z}`},getHashTargetEl(Q){let Z=Q.toString().substring(1);if(Z==="")return;return document.getElementById(Z)||document.querySelector(`a[name="${Z}"]`)}},s=e1,d5={focusMain(){let Q=document.querySelector("main h1, main, h1");if(Q){let Z=Q.tabIndex;Q.tabIndex=-1,Q.focus(),Q.tabIndex=Z}},anyOf(Q,Z){return Z.find(($)=>Q instanceof $)},isFocusable(Q,Z){return Q instanceof HTMLAnchorElement&&Q.rel!=="ignore"||Q instanceof HTMLAreaElement&&Q.href!==void 0||!Q.disabled&&this.anyOf(Q,[HTMLInputElement,HTMLSelectElement,HTMLTextAreaElement,HTMLButtonElement])||Q instanceof HTMLIFrameElement||(Q.tabIndex>0||!Z&&Q.getAttribute("tabindex")!==null&&Q.getAttribute("aria-hidden")!=="true")},attemptFocus(Q,Z){if(this.isFocusable(Q,Z))try{Q.focus()}catch($){}return!!document.activeElement&&document.activeElement.isSameNode(Q)},focusFirstInteractive(Q){let Z=Q.firstElementChild;while(Z){if(this.attemptFocus(Z,!0)||this.focusFirstInteractive(Z,!0))return!0;Z=Z.nextElementSibling}},focusFirst(Q){let Z=Q.firstElementChild;while(Z){if(this.attemptFocus(Z)||this.focusFirst(Z))return!0;Z=Z.nextElementSibling}},focusLast(Q){let Z=Q.lastElementChild;while(Z){if(this.attemptFocus(Z)||this.focusLast(Z))return!0;Z=Z.previousElementSibling}}},B0=d5,_0=null,v1=200,i5={exec(Q,Z,$,Y,z){let[J,W]=z||[null,{callback:z&&z.callback}];(Z.charAt(0)==="["?JSON.parse(Z):[[J,W]]).forEach(([G,j])=>{if(G===J&&W.data)j.data=Object.assign(j.data||{},W.data),j.callback=j.callback||W.callback;this.filterToEls(Y,j).forEach((B)=>{this[`exec_${G}`](Q,Z,$,Y,B,j)})})},isVisible(Q){return!!(Q.offsetWidth||Q.offsetHeight||Q.getClientRects().length>0)},isInViewport(Q){const Z=Q.getBoundingClientRect(),$=window.innerHeight||document.documentElement.clientHeight,Y=window.innerWidth||document.documentElement.clientWidth;return Z.right>0&&Z.bottom>0&&Z.left{let j=G.getAttribute(J);if(!j)throw new Error(`expected ${J} to contain JS command on "${W}"`);$.liveSocket.execJS(G,j,Q)})},exec_dispatch(Q,Z,$,Y,z,{to:J,event:W,detail:q,bubbles:G}){q=q||{},q.dispatcher=Y,K.dispatchEvent(z,W,{detail:q,bubbles:G})},exec_push(Q,Z,$,Y,z,J){let{event:W,data:q,target:G,page_loading:j,loading:B,value:U,dispatcher:V,callback:X}=J,L={loading:B,value:U,target:G,page_loading:!!j},H=Q==="change"&&V?V:Y,P=G||H.getAttribute($.binding("target"))||H;$.withinTargets(P,(y,g)=>{if(!y.isConnected())return;if(Q==="change"){let{newCid:E,_target:C}=J;if(C=C||(K.isFormInput(Y)?Y.name:void 0),C)L._target=C;y.pushInput(Y,g,E,W||Z,L,X)}else if(Q==="submit"){let{submitter:E}=J;y.submitForm(Y,g,W||Z,E,L,X)}else y.pushEvent(Q,Y,g,W||Z,q,L,X)})},exec_navigate(Q,Z,$,Y,z,{href:J,replace:W}){$.liveSocket.historyRedirect(J,W?"replace":"push")},exec_patch(Q,Z,$,Y,z,{href:J,replace:W}){$.liveSocket.pushHistoryPatch(J,W?"replace":"push",Y)},exec_focus(Q,Z,$,Y,z){window.requestAnimationFrame(()=>B0.attemptFocus(z))},exec_focus_first(Q,Z,$,Y,z){window.requestAnimationFrame(()=>B0.focusFirstInteractive(z)||B0.focusFirst(z))},exec_push_focus(Q,Z,$,Y,z){window.requestAnimationFrame(()=>_0=z||Y)},exec_pop_focus(Q,Z,$,Y,z){window.requestAnimationFrame(()=>{if(_0)_0.focus();_0=null})},exec_add_class(Q,Z,$,Y,z,{names:J,transition:W,time:q}){this.addOrRemoveClasses(z,J,[],W,q,$)},exec_remove_class(Q,Z,$,Y,z,{names:J,transition:W,time:q}){this.addOrRemoveClasses(z,[],J,W,q,$)},exec_toggle_class(Q,Z,$,Y,z,{to:J,names:W,transition:q,time:G}){this.toggleClasses(z,W,q,$)},exec_toggle_attr(Q,Z,$,Y,z,{attr:[J,W,q]}){if(z.hasAttribute(J))if(q!==void 0)if(z.getAttribute(J)===W)this.setOrRemoveAttrs(z,[[J,q]],[]);else this.setOrRemoveAttrs(z,[[J,W]],[]);else this.setOrRemoveAttrs(z,[],[J]);else this.setOrRemoveAttrs(z,[[J,W]],[])},exec_transition(Q,Z,$,Y,z,{time:J,transition:W}){this.addOrRemoveClasses(z,[],[],W,J,$)},exec_toggle(Q,Z,$,Y,z,{display:J,ins:W,outs:q,time:G}){this.toggle(Q,$,z,J,W,q,G)},exec_show(Q,Z,$,Y,z,{display:J,transition:W,time:q}){this.show(Q,$,z,J,W,q)},exec_hide(Q,Z,$,Y,z,{display:J,transition:W,time:q}){this.hide(Q,$,z,J,W,q)},exec_set_attr(Q,Z,$,Y,z,{attr:[J,W]}){this.setOrRemoveAttrs(z,[[J,W]],[])},exec_remove_attr(Q,Z,$,Y,z,{attr:J}){this.setOrRemoveAttrs(z,[],[J])},show(Q,Z,$,Y,z,J){if(!this.isVisible($))this.toggle(Q,Z,$,Y,z,null,J)},hide(Q,Z,$,Y,z,J){if(this.isVisible($))this.toggle(Q,Z,$,Y,null,z,J)},toggle(Q,Z,$,Y,z,J,W){W=W||v1;let[q,G,j]=z||[[],[],[]],[B,U,V]=J||[[],[],[]];if(q.length>0||B.length>0)if(this.isVisible($)){let X=()=>{this.addOrRemoveClasses($,U,q.concat(G).concat(j)),window.requestAnimationFrame(()=>{this.addOrRemoveClasses($,B,[]),window.requestAnimationFrame(()=>this.addOrRemoveClasses($,V,U))})};$.dispatchEvent(new Event("phx:hide-start")),Z.transition(W,X,()=>{this.addOrRemoveClasses($,[],B.concat(V)),K.putSticky($,"toggle",(L)=>L.style.display="none"),$.dispatchEvent(new Event("phx:hide-end"))})}else{if(Q==="remove")return;let X=()=>{this.addOrRemoveClasses($,G,B.concat(U).concat(V));let L=Y||this.defaultDisplay($);K.putSticky($,"toggle",(H)=>H.style.display=L),window.requestAnimationFrame(()=>{this.addOrRemoveClasses($,q,[]),window.requestAnimationFrame(()=>this.addOrRemoveClasses($,j,G))})};$.dispatchEvent(new Event("phx:show-start")),Z.transition(W,X,()=>{this.addOrRemoveClasses($,[],q.concat(j)),$.dispatchEvent(new Event("phx:show-end"))})}else if(this.isVisible($))window.requestAnimationFrame(()=>{$.dispatchEvent(new Event("phx:hide-start")),K.putSticky($,"toggle",(X)=>X.style.display="none"),$.dispatchEvent(new Event("phx:hide-end"))});else window.requestAnimationFrame(()=>{$.dispatchEvent(new Event("phx:show-start"));let X=Y||this.defaultDisplay($);K.putSticky($,"toggle",(L)=>L.style.display=X),$.dispatchEvent(new Event("phx:show-end"))})},toggleClasses(Q,Z,$,Y,z){window.requestAnimationFrame(()=>{let[J,W]=K.getSticky(Q,"classes",[[],[]]),q=Z.filter((j)=>J.indexOf(j)<0&&!Q.classList.contains(j)),G=Z.filter((j)=>W.indexOf(j)<0&&Q.classList.contains(j));this.addOrRemoveClasses(Q,q,G,$,Y,z)})},addOrRemoveClasses(Q,Z,$,Y,z,J){z=z||v1;let[W,q,G]=Y||[[],[],[]];if(W.length>0){let j=()=>{this.addOrRemoveClasses(Q,q,[].concat(W).concat(G)),window.requestAnimationFrame(()=>{this.addOrRemoveClasses(Q,W,[]),window.requestAnimationFrame(()=>this.addOrRemoveClasses(Q,G,q))})},B=()=>this.addOrRemoveClasses(Q,Z.concat(G),$.concat(W).concat(q));return J.transition(z,j,B)}window.requestAnimationFrame(()=>{let[j,B]=K.getSticky(Q,"classes",[[],[]]),U=Z.filter((H)=>j.indexOf(H)<0&&!Q.classList.contains(H)),V=$.filter((H)=>B.indexOf(H)<0&&Q.classList.contains(H)),X=j.filter((H)=>$.indexOf(H)<0).concat(U),L=B.filter((H)=>Z.indexOf(H)<0).concat(V);K.putSticky(Q,"classes",(H)=>{return H.classList.remove(...L),H.classList.add(...X),[X,L]})})},setOrRemoveAttrs(Q,Z,$){let[Y,z]=K.getSticky(Q,"attrs",[[],[]]),J=Z.map(([G,j])=>G).concat($),W=Y.filter(([G,j])=>!J.includes(G)).concat(Z),q=z.filter((G)=>!J.includes(G)).concat($);K.putSticky(Q,"attrs",(G)=>{return q.forEach((j)=>G.removeAttribute(j)),W.forEach(([j,B])=>G.setAttribute(j,B)),[W,q]})},hasAllClasses(Q,Z){return Z.every(($)=>Q.classList.contains($))},isToggledOut(Q,Z){return!this.isVisible(Q)||this.hasAllClasses(Q,Z)},filterToEls(Q,{to:Z}){return Z?K.all(document,Z):[Q]},defaultDisplay(Q){return{tr:"table-row",td:"table-cell"}[Q.tagName.toLowerCase()]||"block"}},T=i5,u={byId(Q){return document.getElementById(Q)||h(`no id found for ${Q}`)},removeClass(Q,Z){if(Q.classList.remove(Z),Q.classList.length===0)Q.removeAttribute("class")},all(Q,Z,$){if(!Q)return[];let Y=Array.from(Q.querySelectorAll(Z));return $?Y.forEach($):Y},childNodeLength(Q){let Z=document.createElement("template");return Z.innerHTML=Q,Z.content.childElementCount},isUploadInput(Q){return Q.type==="file"&&Q.getAttribute(o)!==null},isAutoUpload(Q){return Q.hasAttribute("data-phx-auto-upload")},findUploadInputs(Q){const Z=Q.id,$=this.all(document,`input[type="file"][${o}][form="${Z}"]`);return this.all(Q,`input[type="file"][${o}]`).concat($)},findComponentNodeList(Q,Z){return this.filterWithinSameLiveView(this.all(Q,`[${r}="${Z}"]`),Q)},isPhxDestroyed(Q){return Q.id&&u.private(Q,"destroyed")?!0:!1},wantsNewTab(Q){let Z=Q.ctrlKey||Q.shiftKey||Q.metaKey||Q.button&&Q.button===1,$=Q.target instanceof HTMLAnchorElement&&Q.target.hasAttribute("download"),Y=Q.target.hasAttribute("target")&&Q.target.getAttribute("target").toLowerCase()==="_blank";return Z||Y||$},isUnloadableFormSubmit(Q){if(Q.target&&Q.target.getAttribute("method")==="dialog"||Q.submitter&&Q.submitter.getAttribute("formmethod")==="dialog")return!1;else return!Q.defaultPrevented&&!this.wantsNewTab(Q)},isNewPageClick(Q,Z){let $=Q.target instanceof HTMLAnchorElement?Q.target.getAttribute("href"):null,Y;if(Q.defaultPrevented||$===null||this.wantsNewTab(Q))return!1;if($.startsWith("mailto:")||$.startsWith("tel:"))return!1;if(Q.target.isContentEditable)return!1;try{Y=new URL($)}catch(z){try{Y=new URL($,Z)}catch(J){return!0}}if(Y.host===Z.host&&Y.protocol===Z.protocol){if(Y.pathname===Z.pathname&&Y.search===Z.search)return Y.hash===""&&!Y.href.endsWith("#")}return Y.protocol.startsWith("http")},markPhxChildDestroyed(Q){if(this.isPhxChild(Q))Q.setAttribute($0,"");this.putPrivate(Q,"destroyed",!0)},findPhxChildrenInFragment(Q,Z){let $=document.createElement("template");return $.innerHTML=Q,this.findPhxChildren($.content,Z)},isIgnored(Q,Z){return(Q.getAttribute(Z)||Q.getAttribute("data-phx-update"))==="ignore"},isPhxUpdate(Q,Z,$){return Q.getAttribute&&$.indexOf(Q.getAttribute(Z))>=0},findPhxSticky(Q){return this.all(Q,`[${S1}]`)},findPhxChildren(Q,Z){return this.all(Q,`${U0}[${K0}="${Z}"]`)},findExistingParentCIDs(Q,Z){let $=new Set,Y=new Set;return Z.forEach((z)=>{this.filterWithinSameLiveView(this.all(Q,`[${r}="${z}"]`),Q).forEach((J)=>{$.add(z),this.all(J,`[${r}]`).map((W)=>parseInt(W.getAttribute(r))).forEach((W)=>Y.add(W))})}),Y.forEach((z)=>$.delete(z)),$},filterWithinSameLiveView(Q,Z){if(Z.querySelector(U0))return Q.filter(($)=>this.withinSameLiveView($,Z));else return Q},withinSameLiveView(Q,Z){while(Q=Q.parentNode){if(Q.isSameNode(Z))return!0;if(Q.getAttribute($0)!==null)return!1}},private(Q,Z){return Q[m]&&Q[m][Z]},deletePrivate(Q,Z){Q[m]&&delete Q[m][Z]},putPrivate(Q,Z,$){if(!Q[m])Q[m]={};Q[m][Z]=$},updatePrivate(Q,Z,$,Y){let z=this.private(Q,Z);if(z===void 0)this.putPrivate(Q,Z,Y($));else this.putPrivate(Q,Z,Y(z))},copyPrivates(Q,Z){if(Z[m])Q[m]=Z[m]},putTitle(Q){let Z=document.querySelector("title");if(Z){let{prefix:$,suffix:Y}=Z.dataset;document.title=`${$||""}${Q}${Y||""}`}else document.title=Q},debounce(Q,Z,$,Y,z,J,W,q){let G=Q.getAttribute($),j=Q.getAttribute(z);if(G==="")G=Y;if(j==="")j=J;let B=G||j;switch(B){case null:return q();case"blur":if(this.once(Q,"debounce-blur"))Q.addEventListener("blur",()=>q());return;default:let U=parseInt(B),V=()=>j?this.deletePrivate(Q,I0):q(),X=this.incCycle(Q,D0,V);if(isNaN(U))return h(`invalid throttle/debounce value: ${B}`);if(j){let H=!1;if(Z.type==="keydown"){let P=this.private(Q,b1);this.putPrivate(Q,b1,Z.key),H=P!==Z.key}if(!H&&this.private(Q,I0))return!1;else{q();const P=setTimeout(()=>{if(W())this.triggerCycle(Q,D0)},U);this.putPrivate(Q,I0,P)}}else setTimeout(()=>{if(W())this.triggerCycle(Q,D0,X)},U);let L=Q.form;if(L&&this.once(L,"bind-debounce"))L.addEventListener("submit",()=>{Array.from(new FormData(L).entries(),([H])=>{let P=L.querySelector(`[name="${H}"]`);this.incCycle(P,D0),this.deletePrivate(P,I0)})});if(this.once(Q,"bind-debounce"))Q.addEventListener("blur",()=>{clearTimeout(this.private(Q,I0)),this.triggerCycle(Q,D0)})}},triggerCycle(Q,Z,$){let[Y,z]=this.private(Q,Z);if(!$)$=Y;if($===Y)this.incCycle(Q,Z),z()},once(Q,Z){if(this.private(Q,Z)===!0)return!1;return this.putPrivate(Q,Z,!0),!0},incCycle(Q,Z,$=function(){}){let[Y]=this.private(Q,Z)||[0,$];return Y++,this.putPrivate(Q,Z,[Y,$]),Y},maybeAddPrivateHooks(Q,Z,$){if(Q.hasAttribute&&(Q.hasAttribute(Z)||Q.hasAttribute($)))Q.setAttribute("data-phx-hook","Phoenix.InfiniteScroll")},isFeedbackContainer(Q,Z){return Q.hasAttribute&&Q.hasAttribute(Z)},maybeHideFeedback(Q,Z,$,Y){const z={};Z.forEach((J)=>{if(!Q.contains(J))return;const W=J.getAttribute($);if(!W){T.addOrRemoveClasses(J,[],[b0]);return}if(z[W]===!0){this.hideFeedback(J);return}if(z[W]=this.shouldHideFeedback(Q,W,Y),z[W]===!0)this.hideFeedback(J)})},hideFeedback(Q){T.addOrRemoveClasses(Q,[b0],[])},shouldHideFeedback(Q,Z,$){const Y=`[name="${Z}"], + [name="${Z}[]"], + [${$}="${Z}"]`;let z=!1;return u.all(Q,Y,(J)=>{if(this.private(J,B1)||this.private(J,s0))z=!0}),!z},feedbackSelector(Q,Z,$){let Y=`[${Z}="${Q.name}"], + [${Z}="${Q.name.replace(/\[\]$/,"")}"]`;if(Q.getAttribute($))Y+=`,[${Z}="${Q.getAttribute($)}"]`;return Y},resetForm(Q,Z,$){Array.from(Q.elements).forEach((Y)=>{let z=this.feedbackSelector(Y,Z,$);this.deletePrivate(Y,B1),this.deletePrivate(Y,s0),this.all(document,z,(J)=>{T.addOrRemoveClasses(J,[b0],[])})})},showError(Q,Z,$){if(Q.name){let Y=this.feedbackSelector(Q,Z,$);this.all(document,Y,(z)=>{T.addOrRemoveClasses(z,[],[b0])})}},isPhxChild(Q){return Q.getAttribute&&Q.getAttribute(K0)},isPhxSticky(Q){return Q.getAttribute&&Q.getAttribute(S1)!==null},isChildOfAny(Q,Z){return!!Z.find(($)=>$.contains(Q))},firstPhxChild(Q){return this.isPhxChild(Q)?Q:this.all(Q,`[${K0}]`)[0]},dispatchEvent(Q,Z,$={}){let Y=!0;if(Q.nodeName==="INPUT"&&Q.type==="file"&&Z==="click")Y=!1;let W={bubbles:$.bubbles===void 0?Y:!!$.bubbles,cancelable:!0,detail:$.detail||{}},q=Z==="click"?new MouseEvent("click",W):new CustomEvent(Z,W);Q.dispatchEvent(q)},cloneNode(Q,Z){if(typeof Z==="undefined")return Q.cloneNode(!0);else{let $=Q.cloneNode(!1);return $.innerHTML=Z,$}},mergeAttrs(Q,Z,$={}){let Y=new Set($.exclude||[]),z=$.isIgnored,J=Z.attributes;for(let q=J.length-1;q>=0;q--){let G=J[q].name;if(!Y.has(G)){const j=Z.getAttribute(G);if(Q.getAttribute(G)!==j&&(!z||z&&G.startsWith("data-")))Q.setAttribute(G,j)}else if(G==="value"&&Q.value===Z.value)Q.setAttribute("value",Z.getAttribute(G))}let W=Q.attributes;for(let q=W.length-1;q>=0;q--){let G=W[q].name;if(z){if(G.startsWith("data-")&&!Z.hasAttribute(G)&&![v,Q0].includes(G))Q.removeAttribute(G)}else if(!Z.hasAttribute(G))Q.removeAttribute(G)}},mergeFocusedInput(Q,Z){if(!(Q instanceof HTMLSelectElement))u.mergeAttrs(Q,Z,{exclude:["value"]});if(Z.readOnly)Q.setAttribute("readonly",!0);else Q.removeAttribute("readonly")},hasSelectionRange(Q){return Q.setSelectionRange&&(Q.type==="text"||Q.type==="textarea")},restoreFocus(Q,Z,$){if(Q instanceof HTMLSelectElement)Q.focus();if(!u.isTextualInput(Q))return;let Y=Q.matches(":focus");if(Q.readOnly)Q.blur();if(!Y)Q.focus();if(this.hasSelectionRange(Q))Q.setSelectionRange(Z,$)},isFormInput(Q){return/^(?:input|select|textarea)$/i.test(Q.tagName)&&Q.type!=="button"},syncAttrsToProps(Q){if(Q instanceof HTMLInputElement&&t1.indexOf(Q.type.toLocaleLowerCase())>=0)Q.checked=Q.getAttribute("checked")!==null},isTextualInput(Q){return T5.indexOf(Q.type)>=0},isNowTriggerFormExternal(Q,Z){return Q.getAttribute&&Q.getAttribute(Z)!==null},syncPendingRef(Q,Z,$){let Y=Q.getAttribute(v);if(Y===null)return!0;let z=Q.getAttribute(Q0);if(u.isFormInput(Q)||Q.getAttribute($)!==null){if(u.isUploadInput(Q))u.mergeAttrs(Q,Z,{isIgnored:!0});return u.putPrivate(Q,v,Z),!1}else return a1.forEach((J)=>{Q.classList.contains(J)&&Z.classList.add(J)}),Z.setAttribute(v,Y),Z.setAttribute(Q0,z),!0},cleanChildNodes(Q,Z){if(u.isPhxUpdate(Q,Z,["append","prepend"])){let $=[];Q.childNodes.forEach((Y)=>{if(!Y.id){if(!(Y.nodeType===Node.TEXT_NODE&&Y.nodeValue.trim()===""))h(`only HTML element tags with an id are allowed inside containers with phx-update. + +removing illegal node: "${(Y.outerHTML||Y.nodeValue).trim()}" + +`);$.push(Y)}}),$.forEach((Y)=>Y.remove())}},replaceRootContainer(Q,Z,$){let Y=new Set(["id",$0,A0,V1,M0]);if(Q.tagName.toLowerCase()===Z.toLowerCase())return Array.from(Q.attributes).filter((z)=>!Y.has(z.name.toLowerCase())).forEach((z)=>Q.removeAttribute(z.name)),Object.keys($).filter((z)=>!Y.has(z.toLowerCase())).forEach((z)=>Q.setAttribute(z,$[z])),Q;else{let z=document.createElement(Z);return Object.keys($).forEach((J)=>z.setAttribute(J,$[J])),Y.forEach((J)=>z.setAttribute(J,Q.getAttribute(J))),z.innerHTML=Q.innerHTML,Q.replaceWith(z),z}},getSticky(Q,Z,$){let Y=(u.private(Q,"sticky")||[]).find(([z])=>Z===z);if(Y){let[z,J,W]=Y;return W}else return typeof $==="function"?$():$},deleteSticky(Q,Z){this.updatePrivate(Q,"sticky",[],($)=>{return $.filter(([Y,z])=>Y!==Z)})},putSticky(Q,Z,$){let Y=$(Q);this.updatePrivate(Q,"sticky",[],(z)=>{let J=z.findIndex(([W])=>Z===W);if(J>=0)z[J]=[Z,$,Y];else z.push([Z,$,Y]);return z})},applyStickyOperations(Q){let Z=u.private(Q,"sticky");if(!Z)return;Z.forEach(([$,Y,z])=>this.putSticky(Q,$,Y))}},K=u,H0=class{static isActive(Q,Z){let $=Z._phxRef===void 0,z=Q.getAttribute(G1).split(",").indexOf(w.genFileRef(Z))>=0;return Z.size>0&&($||z)}static isPreflighted(Q,Z){return Q.getAttribute(U1).split(",").indexOf(w.genFileRef(Z))>=0&&this.isActive(Q,Z)}static isPreflightInProgress(Q){return Q._preflightInProgress===!0}static markPreflightInProgress(Q){Q._preflightInProgress=!0}constructor(Q,Z,$,Y){this.ref=w.genFileRef(Z),this.fileEl=Q,this.file=Z,this.view=$,this.meta=null,this._isCancelled=!1,this._isDone=!1,this._progress=0,this._lastProgressSent=-1,this._onDone=function(){},this._onElUpdated=this.onElUpdated.bind(this),this.fileEl.addEventListener(f0,this._onElUpdated),this.autoUpload=Y}metadata(){return this.meta}progress(Q){if(this._progress=Math.floor(Q),this._progress>this._lastProgressSent)if(this._progress>=100)this._progress=100,this._lastProgressSent=100,this._isDone=!0,this.view.pushFileProgress(this.fileEl,this.ref,100,()=>{w.untrackFile(this.fileEl,this.file),this._onDone()});else this._lastProgressSent=this._progress,this.view.pushFileProgress(this.fileEl,this.ref,this._progress)}isCancelled(){return this._isCancelled}cancel(){this.file._preflightInProgress=!1,this._isCancelled=!0,this._isDone=!0,this._onDone()}isDone(){return this._isDone}error(Q="failed"){if(this.fileEl.removeEventListener(f0,this._onElUpdated),this.view.pushFileProgress(this.fileEl,this.ref,{error:Q}),!this.isAutoUpload())w.clearFiles(this.fileEl)}isAutoUpload(){return this.autoUpload}onDone(Q){this._onDone=()=>{this.fileEl.removeEventListener(f0,this._onElUpdated),Q()}}onElUpdated(){if(this.fileEl.getAttribute(G1).split(",").indexOf(this.ref)===-1)w.untrackFile(this.fileEl,this.file),this.cancel()}toPreflightPayload(){return{last_modified:this.file.lastModified,name:this.file.name,relative_path:this.file.webkitRelativePath,size:this.file.size,type:this.file.type,ref:this.ref,meta:typeof this.file.meta==="function"?this.file.meta():void 0}}uploader(Q){if(this.meta.uploader){let Z=Q[this.meta.uploader]||h(`no uploader configured for ${this.meta.uploader}`);return{name:this.meta.uploader,callback:Z}}else return{name:"channel",callback:s5}}zipPostFlight(Q){if(this.meta=Q.entries[this.ref],!this.meta)h(`no preflight upload response returned with ref ${this.ref}`,{input:this.fileEl,response:Q})}},n5=0,w=class{static genFileRef(Q){let Z=Q._phxRef;if(Z!==void 0)return Z;else return Q._phxRef=(n5++).toString(),Q._phxRef}static getEntryDataURL(Q,Z,$){let Y=this.activeFiles(Q).find((z)=>this.genFileRef(z)===Z);$(URL.createObjectURL(Y))}static hasUploadsInProgress(Q){let Z=0;return K.findUploadInputs(Q).forEach(($)=>{if($.getAttribute(U1)!==$.getAttribute(S5))Z++}),Z>0}static serializeUploads(Q){let Z=this.activeFiles(Q),$={};return Z.forEach((Y)=>{let z={path:Q.name},J=Q.getAttribute(o);if($[J]=$[J]||[],z.ref=this.genFileRef(Y),z.last_modified=Y.lastModified,z.name=Y.name||z.ref,z.relative_path=Y.webkitRelativePath,z.type=Y.type,z.size=Y.size,typeof Y.meta==="function")z.meta=Y.meta();$[J].push(z)}),$}static clearFiles(Q){Q.value=null,Q.removeAttribute(o),K.putPrivate(Q,"files",[])}static untrackFile(Q,Z){K.putPrivate(Q,"files",K.private(Q,"files").filter(($)=>!Object.is($,Z)))}static trackFiles(Q,Z,$){if(Q.getAttribute("multiple")!==null){let Y=Z.filter((z)=>!this.activeFiles(Q).find((J)=>Object.is(J,z)));K.updatePrivate(Q,"files",[],(z)=>z.concat(Y)),Q.value=null}else{if($&&$.files.length>0)Q.files=$.files;K.putPrivate(Q,"files",Z)}}static activeFileInputs(Q){let Z=K.findUploadInputs(Q);return Array.from(Z).filter(($)=>$.files&&this.activeFiles($).length>0)}static activeFiles(Q){return(K.private(Q,"files")||[]).filter((Z)=>H0.isActive(Q,Z))}static inputsAwaitingPreflight(Q){let Z=K.findUploadInputs(Q);return Array.from(Z).filter(($)=>this.filesAwaitingPreflight($).length>0)}static filesAwaitingPreflight(Q){return this.activeFiles(Q).filter((Z)=>!H0.isPreflighted(Q,Z)&&!H0.isPreflightInProgress(Z))}static markPreflightInProgress(Q){Q.forEach((Z)=>H0.markPreflightInProgress(Z.file))}constructor(Q,Z,$){this.autoUpload=K.isAutoUpload(Q),this.view=Z,this.onComplete=$,this._entries=Array.from(w.filesAwaitingPreflight(Q)||[]).map((Y)=>new H0(Q,Y,Z,this.autoUpload)),w.markPreflightInProgress(this._entries),this.numEntriesInProgress=this._entries.length}isAutoUpload(){return this.autoUpload}entries(){return this._entries}initAdapterUpload(Q,Z,$){this._entries=this._entries.map((z)=>{if(z.isCancelled()){if(this.numEntriesInProgress--,this.numEntriesInProgress===0)this.onComplete()}else z.zipPostFlight(Q),z.onDone(()=>{if(this.numEntriesInProgress--,this.numEntriesInProgress===0)this.onComplete()});return z});let Y=this._entries.reduce((z,J)=>{if(!J.meta)return z;let{name:W,callback:q}=J.uploader($.uploaders);return z[W]=z[W]||{callback:q,entries:[]},z[W].entries.push(J),z},{});for(let z in Y){let{callback:J,entries:W}=Y[z];J(W,Z,Q,$)}}},Q5={LiveFileUpload:{activeRefs(){return this.el.getAttribute(G1)},preflightedRefs(){return this.el.getAttribute(U1)},mounted(){this.preflightedWas=this.preflightedRefs()},updated(){let Q=this.preflightedRefs();if(this.preflightedWas!==Q){if(this.preflightedWas=Q,Q==="")this.__view.cancelSubmit(this.el.form)}if(this.activeRefs()==="")this.el.value=null;this.el.dispatchEvent(new CustomEvent(f0))}},LiveImgPreview:{mounted(){this.ref=this.el.getAttribute("data-phx-entry-ref"),this.inputEl=document.getElementById(this.el.getAttribute(o)),w.getEntryDataURL(this.inputEl,this.ref,(Q)=>{this.url=Q,this.el.src=Q})},destroyed(){URL.revokeObjectURL(this.url)}},FocusWrap:{mounted(){if(this.focusStart=this.el.firstElementChild,this.focusEnd=this.el.lastElementChild,this.focusStart.addEventListener("focus",()=>B0.focusLast(this.el)),this.focusEnd.addEventListener("focus",()=>B0.focusFirst(this.el)),this.el.addEventListener("phx:show-end",()=>this.el.focus()),window.getComputedStyle(this.el).display!=="none")B0.focusFirst(this.el)}}},Z5=(Q)=>{if(["scroll","auto"].indexOf(getComputedStyle(Q).overflowY)>=0)return Q;if(document.documentElement===Q)return null;return Z5(Q.parentElement)},h1=(Q)=>{if(Q)return Q.scrollTop;else return document.documentElement.scrollTop||document.body.scrollTop},X1=(Q)=>{if(Q)return Q.getBoundingClientRect().bottom;else return window.innerHeight||document.documentElement.clientHeight},L1=(Q)=>{if(Q)return Q.getBoundingClientRect().top;else return 0},a5=(Q,Z)=>{let $=Q.getBoundingClientRect();return $.top>=L1(Z)&&$.left>=0&&$.top<=X1(Z)},r5=(Q,Z)=>{let $=Q.getBoundingClientRect();return $.right>=L1(Z)&&$.left>=0&&$.bottom<=X1(Z)},E1=(Q,Z)=>{let $=Q.getBoundingClientRect();return $.top>=L1(Z)&&$.left>=0&&$.top<=X1(Z)};Q5.InfiniteScroll={mounted(){this.scrollContainer=Z5(this.el);let Q=h1(this.scrollContainer),Z=!1,$=500,Y=null,z=this.throttle($,(q,G)=>{Y=()=>!0,this.liveSocket.execJSHookPush(this.el,q,{id:G.id,_overran:!0},()=>{Y=null})}),J=this.throttle($,(q,G)=>{Y=()=>G.scrollIntoView({block:"start"}),this.liveSocket.execJSHookPush(this.el,q,{id:G.id},()=>{Y=null,window.requestAnimationFrame(()=>{if(!E1(G,this.scrollContainer))G.scrollIntoView({block:"start"})})})}),W=this.throttle($,(q,G)=>{Y=()=>G.scrollIntoView({block:"end"}),this.liveSocket.execJSHookPush(this.el,q,{id:G.id},()=>{Y=null,window.requestAnimationFrame(()=>{if(!E1(G,this.scrollContainer))G.scrollIntoView({block:"end"})})})});if(this.onScroll=(q)=>{let G=h1(this.scrollContainer);if(Y)return Q=G,Y();let j=this.el.getBoundingClientRect(),B=this.el.getAttribute(this.liveSocket.binding("viewport-top")),U=this.el.getAttribute(this.liveSocket.binding("viewport-bottom")),V=this.el.lastElementChild,X=this.el.firstElementChild,L=GQ;if(L&&B&&!Z&&j.top>=0)Z=!0,z(B,X);else if(H&&Z&&j.top<=0)Z=!1;if(B&&L&&a5(X,this.scrollContainer))J(B,X);else if(U&&H&&r5(V,this.scrollContainer))W(U,V);Q=G},this.scrollContainer)this.scrollContainer.addEventListener("scroll",this.onScroll);else window.addEventListener("scroll",this.onScroll)},destroyed(){if(this.scrollContainer)this.scrollContainer.removeEventListener("scroll",this.onScroll);else window.removeEventListener("scroll",this.onScroll)},throttle(Q,Z){let $=0,Y;return(...z)=>{let J=Date.now(),W=Q-(J-$);if(W<=0||W>Q){if(Y)clearTimeout(Y),Y=null;$=J,Z(...z)}else if(!Y)Y=setTimeout(()=>{$=Date.now(),Y=null,Z(...z)},W)}}};var o5=Q5,l5=class{constructor(Q,Z,$){let Y=new Set,z=new Set([...Z.children].map((W)=>W.id)),J=[];Array.from(Q.children).forEach((W)=>{if(W.id){if(Y.add(W.id),z.has(W.id)){let q=W.previousElementSibling&&W.previousElementSibling.id;J.push({elementId:W.id,previousElementId:q})}}}),this.containerId=Z.id,this.updateType=$,this.elementsToModify=J,this.elementIdsToAdd=[...z].filter((W)=>!Y.has(W))}perform(){let Q=K.byId(this.containerId);if(this.elementsToModify.forEach((Z)=>{if(Z.previousElementId)Z0(document.getElementById(Z.previousElementId),($)=>{Z0(document.getElementById(Z.elementId),(Y)=>{if(!(Y.previousElementSibling&&Y.previousElementSibling.id==$.id))$.insertAdjacentElement("afterend",Y)})});else Z0(document.getElementById(Z.elementId),($)=>{if($.previousElementSibling!=null)Q.insertAdjacentElement("afterbegin",$)})}),this.updateType=="prepend")this.elementIdsToAdd.reverse().forEach((Z)=>{Z0(document.getElementById(Z),($)=>Q.insertAdjacentElement("afterbegin",$))})}},u1=11,v0,e5="http://www.w3.org/1999/xhtml",N=typeof document==="undefined"?void 0:document,Q9=!!N&&"content"in N.createElement("template"),Z9=!!N&&N.createRange&&"createContextualFragment"in N.createRange(),f1={OPTION:function(Q,Z){var $=Q.parentNode;if($){var Y=$.nodeName.toUpperCase();if(Y==="OPTGROUP")$=$.parentNode,Y=$&&$.nodeName.toUpperCase();if(Y==="SELECT"&&!$.hasAttribute("multiple")){if(Q.hasAttribute("selected")&&!Z.selected)Q.setAttribute("selected","selected"),Q.removeAttribute("selected");$.selectedIndex=-1}}q1(Q,Z,"selected")},INPUT:function(Q,Z){if(q1(Q,Z,"checked"),q1(Q,Z,"disabled"),Q.value!==Z.value)Q.value=Z.value;if(!Z.hasAttribute("value"))Q.removeAttribute("value")},TEXTAREA:function(Q,Z){var $=Z.value;if(Q.value!==$)Q.value=$;var Y=Q.firstChild;if(Y){var z=Y.nodeValue;if(z==$||!$&&z==Q.placeholder)return;Y.nodeValue=$}},SELECT:function(Q,Z){if(!Z.hasAttribute("multiple")){var $=-1,Y=0,z=Q.firstChild,J,W;while(z)if(W=z.nodeName&&z.nodeName.toUpperCase(),W==="OPTGROUP")J=z,z=J.firstChild;else{if(W==="OPTION"){if(z.hasAttribute("selected")){$=Y;break}Y++}if(z=z.nextSibling,!z&&J)z=J.nextSibling,J=null}Q.selectedIndex=$}}},x0=1,p1=11,m1=3,c1=8,K9=j9(t5),s1=K9,E0=class{static patchEl(Q,Z,$){s1(Q,Z,{childrenOnly:!1,onBeforeElUpdated:(Y,z)=>{if($&&$.isSameNode(Y)&&K.isFormInput(Y))return K.mergeFocusedInput(Y,z),!1}})}constructor(Q,Z,$,Y,z,J){this.view=Q,this.liveSocket=Q.liveSocket,this.container=Z,this.id=$,this.rootID=Q.root.id,this.html=Y,this.streams=z,this.streamInserts={},this.streamComponentRestore={},this.targetCID=J,this.cidPatch=a(this.targetCID),this.pendingRemoves=[],this.phxRemove=this.liveSocket.binding("remove"),this.callbacks={beforeadded:[],beforeupdated:[],beforephxChildAdded:[],afteradded:[],afterupdated:[],afterdiscarded:[],afterphxChildAdded:[],aftertransitionsDiscarded:[]}}before(Q,Z){this.callbacks[`before${Q}`].push(Z)}after(Q,Z){this.callbacks[`after${Q}`].push(Z)}trackBefore(Q,...Z){this.callbacks[`before${Q}`].forEach(($)=>$(...Z))}trackAfter(Q,...Z){this.callbacks[`after${Q}`].forEach(($)=>$(...Z))}markPrunableContentForRemoval(){let Q=this.liveSocket.binding(d0);K.all(this.container,`[${Q}=append] > *, [${Q}=prepend] > *`,(Z)=>{Z.setAttribute(A1,"")})}perform(Q){let{view:Z,liveSocket:$,container:Y,html:z}=this,J=this.isCIDPatch()?this.targetCIDContainer(z):Y;if(this.isCIDPatch()&&!J)return;let W=$.getActiveElement(),{selectionStart:q,selectionEnd:G}=W&&K.hasSelectionRange(W)?W:{},j=$.binding(d0),B=$.binding(m0),U=$.binding(c0),V=$.binding(M1),X=$.binding(j1),L=$.binding(K1),H=$.binding(y5),P=[],y=[],g=[],E=[],C=null;function Y0(S,d){s1(S,d,{childrenOnly:S.getAttribute(r)===null,getNodeKey:(M)=>{if(K.isPhxDestroyed(M))return null;if(Q)return M.id;return M.id||M.getAttribute&&M.getAttribute(l1)},skipFromChildren:(M)=>{return M.getAttribute(j)===Z1},addChild:(M,D)=>{let{ref:k,streamAt:O}=this.getStreamInsert(D);if(k===void 0)return M.appendChild(D);if(this.setStreamRef(D,k),O===0)M.insertAdjacentElement("afterbegin",D);else if(O===-1)M.appendChild(D);else if(O>0){let f=Array.from(M.children)[O];M.insertBefore(D,f)}},onBeforeNodeAdded:(M)=>{K.maybeAddPrivateHooks(M,X,L),this.trackBefore("added",M);let D=M;if(!Q&&this.streamComponentRestore[M.id])D=this.streamComponentRestore[M.id],delete this.streamComponentRestore[M.id],Y0.bind(this)(D,M);return D},onNodeAdded:(M)=>{if(M.getAttribute)this.maybeReOrderStream(M,!0);if(K.isFeedbackContainer(M,B))y.push(M);if(M instanceof HTMLImageElement&&M.srcset)M.srcset=M.srcset;else if(M instanceof HTMLVideoElement&&M.autoplay)M.play();if(K.isNowTriggerFormExternal(M,H))C=M;if(K.isPhxChild(M)&&Z.ownsElement(M)||K.isPhxSticky(M)&&Z.ownsElement(M.parentNode))this.trackAfter("phxChildAdded",M);P.push(M)},onNodeDiscarded:(M)=>this.onNodeDiscarded(M),onBeforeNodeDiscarded:(M)=>{if(M.getAttribute&&M.getAttribute(A1)!==null)return!0;if(M.parentElement!==null&&M.id&&K.isPhxUpdate(M.parentElement,j,[Z1,"append","prepend"]))return!1;if(this.maybePendingRemove(M))return!1;if(this.skipCIDSibling(M))return!1;return!0},onElUpdated:(M)=>{if(K.isNowTriggerFormExternal(M,H))C=M;g.push(M),this.maybeReOrderStream(M,!1)},onBeforeElUpdated:(M,D)=>{if(K.maybeAddPrivateHooks(D,X,L),K.isFeedbackContainer(M,B)||K.isFeedbackContainer(D,B))y.push(M),y.push(D);if(K.cleanChildNodes(D,j),this.skipCIDSibling(D))return this.maybeReOrderStream(M),!1;if(K.isPhxSticky(M))return!1;if(K.isIgnored(M,j)||M.form&&M.form.isSameNode(C))return this.trackBefore("updated",M,D),K.mergeAttrs(M,D,{isIgnored:!0}),g.push(M),K.applyStickyOperations(M),!1;if(M.type==="number"&&(M.validity&&M.validity.badInput))return!1;if(!K.syncPendingRef(M,D,V)){if(K.isUploadInput(M))this.trackBefore("updated",M,D),g.push(M);return K.applyStickyOperations(M),!1}if(K.isPhxChild(D)){let f=M.getAttribute($0);if(K.mergeAttrs(M,D,{exclude:[A0]}),f!=="")M.setAttribute($0,f);return M.setAttribute(M0,this.rootID),K.applyStickyOperations(M),!1}K.copyPrivates(D,M);let k=W&&M.isSameNode(W)&&K.isFormInput(M),O=k&&this.isChangedSelect(M,D);if(k&&M.type!=="hidden"&&!O)return this.trackBefore("updated",M,D),K.mergeFocusedInput(M,D),K.syncAttrsToProps(M),g.push(M),K.applyStickyOperations(M),!1;else{if(O)M.blur();if(K.isPhxUpdate(D,j,["append","prepend"]))E.push(new l5(M,D,D.getAttribute(j)));return K.syncAttrsToProps(D),K.applyStickyOperations(D),this.trackBefore("updated",M,D),!0}}})}if(this.trackBefore("added",Y),this.trackBefore("updated",Y,Y),$.time("morphdom",()=>{if(this.streams.forEach(([S,d,M,D])=>{if(d.forEach(([k,O,f])=>{this.streamInserts[k]={ref:S,streamAt:O,limit:f,reset:D}}),D!==void 0)K.all(Y,`[${$1}="${S}"]`,(k)=>{this.removeStreamChildElement(k)});M.forEach((k)=>{let O=Y.querySelector(`[id="${k}"]`);if(O)this.removeStreamChildElement(O)})}),Q)K.all(this.container,`[${j}=${Z1}]`,(S)=>{this.liveSocket.owner(S,(d)=>{if(d===this.view)Array.from(S.children).forEach((M)=>{this.removeStreamChildElement(M)})})});Y0.bind(this)(J,z)}),$.isDebugEnabled())p5();if(E.length>0)$.time("post-morph append/prepend restoration",()=>{E.forEach((S)=>S.perform())});if(K.maybeHideFeedback(J,y,B,U),$.silenceEvents(()=>K.restoreFocus(W,q,G)),K.dispatchEvent(document,"phx:update"),P.forEach((S)=>this.trackAfter("added",S)),g.forEach((S)=>this.trackAfter("updated",S)),this.transitionPendingRemoves(),C)$.unload(),Object.getPrototypeOf(C).submit.call(C);return!0}onNodeDiscarded(Q){if(K.isPhxChild(Q)||K.isPhxSticky(Q))this.liveSocket.destroyViewByEl(Q);this.trackAfter("discarded",Q)}maybePendingRemove(Q){if(Q.getAttribute&&Q.getAttribute(this.phxRemove)!==null)return this.pendingRemoves.push(Q),!0;else return!1}removeStreamChildElement(Q){if(this.streamInserts[Q.id])this.streamComponentRestore[Q.id]=Q,Q.remove();else if(!this.maybePendingRemove(Q))Q.remove(),this.onNodeDiscarded(Q)}getStreamInsert(Q){return(Q.id?this.streamInserts[Q.id]:{})||{}}setStreamRef(Q,Z){K.putSticky(Q,$1,($)=>$.setAttribute($1,Z))}maybeReOrderStream(Q,Z){let{ref:$,streamAt:Y,reset:z}=this.getStreamInsert(Q);if(Y===void 0)return;if(this.setStreamRef(Q,$),!z&&!Z)return;if(!Q.parentElement)return;if(Y===0)Q.parentElement.insertBefore(Q,Q.parentElement.firstElementChild);else if(Y>0){let J=Array.from(Q.parentElement.children),W=J.indexOf(Q);if(Y>=J.length-1)Q.parentElement.appendChild(Q);else{let q=J[Y];if(W>Y)Q.parentElement.insertBefore(Q,q);else Q.parentElement.insertBefore(Q,q.nextElementSibling)}}this.maybeLimitStream(Q)}maybeLimitStream(Q){let{limit:Z}=this.getStreamInsert(Q),$=Z!==null&&Array.from(Q.parentElement.children);if(Z&&Z<0&&$.length>Z*-1)$.slice(0,$.length+Z).forEach((Y)=>this.removeStreamChildElement(Y));else if(Z&&Z>=0&&$.length>Z)$.slice(Z).forEach((Y)=>this.removeStreamChildElement(Y))}transitionPendingRemoves(){let{pendingRemoves:Q,liveSocket:Z}=this;if(Q.length>0)Z.transitionRemoves(Q),Z.requestDOMUpdate(()=>{Q.forEach(($)=>{let Y=K.firstPhxChild($);if(Y)Z.destroyViewByEl(Y);$.remove()}),this.trackAfter("transitionsDiscarded",Q)})}isChangedSelect(Q,Z){if(!(Q instanceof HTMLSelectElement)||Q.multiple)return!1;if(Q.options.length!==Z.options.length)return!0;let $=Q.selectedOptions[0],Y=Z.selectedOptions[0];if($&&$.hasAttribute("selected"))Y.setAttribute("selected",$.getAttribute("selected"));return!Q.isEqualNode(Z)}isCIDPatch(){return this.cidPatch}skipCIDSibling(Q){return Q.nodeType===Node.ELEMENT_NODE&&Q.hasAttribute(o1)}targetCIDContainer(Q){if(!this.isCIDPatch())return;let[Z,...$]=K.findComponentNodeList(this.container,this.targetCID);if($.length===0&&K.childNodeLength(Q)===1)return Z;else return Z&&Z.parentNode}indexOf(Q,Z){return Array.from(Q.children).indexOf(Z)}},B9=new Set(["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"]),M9=new Set(["'",'"']),d1=(Q,Z,$)=>{let Y=0,z=!1,J,W,q,G,j,B,U=Q.match(/^(\s*(?:\s*)*)<([^\s\/>]+)/);if(U===null)throw new Error(`malformed html ${Q}`);Y=U[0].length,J=U[1],q=U[2],G=Y;for(Y;Y")break;if(Q.charAt(Y)==="="){let L=Q.slice(Y-3,Y)===" id";Y++;let H=Q.charAt(Y);if(M9.has(H)){let P=Y;Y++;for(Y;Y=J.length+q.length){let L=Q.charAt(V);if(z)if(L==="-"&&Q.slice(V-3,V)===""&&Q.slice(V-2,V)==="--")z=!0,V-=3;else if(L===">")break;else V-=1}W=Q.slice(V+1,Q.length);let X=Object.keys(Z).map((L)=>Z[L]===!0?L:`${L}="${Z[L]}"`).join(" ");if($){let L=j?` id="${j}"`:"";if(B9.has(q))B=`<${q}${L}${X===""?"":" "}${X}/>`;else B=`<${q}${L}${X===""?"":" "}${X}>`}else{let L=Q.slice(G,V+1);B=`<${q}${X===""?"":" "}${X}${L}`}return[B,J,W]},i1=class{static extract(Q){let{[C1]:Z,[g1]:$,[N1]:Y}=Q;return delete Q[C1],delete Q[g1],delete Q[N1],{diff:Q,title:Y,reply:Z||null,events:$||[]}}constructor(Q,Z){this.viewId=Q,this.rendered={},this.magicId=0,this.mergeDiff(Z)}parentViewId(){return this.viewId}toString(Q){let[Z,$]=this.recursiveToString(this.rendered,this.rendered[b],Q,!0,{});return[Z,$]}recursiveToString(Q,Z=Q[b],$,Y,z){$=$?new Set($):null;let J={buffer:"",components:Z,onlyCids:$,streams:new Set};return this.toOutputBuffer(Q,null,J,Y,z),[J.buffer,J.streams]}componentCIDs(Q){return Object.keys(Q[b]||{}).map((Z)=>parseInt(Z))}isComponentOnlyDiff(Q){if(!Q[b])return!1;return Object.keys(Q).length===1}getComponent(Q,Z){return Q[b][Z]}resetRender(Q){if(this.rendered[b][Q])this.rendered[b][Q].reset=!0}mergeDiff(Q){let Z=Q[b],$={};if(delete Q[b],this.rendered=this.mutableMerge(this.rendered,Q),this.rendered[b]=this.rendered[b]||{},Z){let Y=this.rendered[b];for(let z in Z)Z[z]=this.cachedFindComponent(z,Z[z],Y,Z,$);for(let z in Z)Y[z]=Z[z];Q[b]=Z}}cachedFindComponent(Q,Z,$,Y,z){if(z[Q])return z[Q];else{let J,W,q=Z[c];if(a(q)){let G;if(q>0)G=this.cachedFindComponent(q,Y[q],$,Y,z);else G=$[-q];W=G[c],J=this.cloneMerge(G,Z,!0),J[c]=W}else J=Z[c]!==void 0||$[Q]===void 0?Z:this.cloneMerge($[Q],Z,!1);return z[Q]=J,J}}mutableMerge(Q,Z){if(Z[c]!==void 0)return Z;else return this.doMutableMerge(Q,Z),Q}doMutableMerge(Q,Z){for(let $ in Z){let Y=Z[$],z=Q[$];if(j0(Y)&&Y[c]===void 0&&j0(z))this.doMutableMerge(z,Y);else Q[$]=Y}if(Q[J1])Q.newRender=!0}cloneMerge(Q,Z,$){let Y={...Q,...Z};for(let z in Y){let J=Z[z],W=Q[z];if(j0(J)&&J[c]===void 0&&j0(W))Y[z]=this.cloneMerge(W,J,$);else if(J===void 0&&j0(W))Y[z]=this.cloneMerge(W,{},$)}if($)delete Y.magicId,delete Y.newRender;else if(Q[J1])Y.newRender=!0;return Y}componentToString(Q){let[Z,$]=this.recursiveCIDToString(this.rendered[b],Q,null),[Y,z,J]=d1(Z,{});return[Y,$]}pruneCIDs(Q){Q.forEach((Z)=>delete this.rendered[b][Z])}get(){return this.rendered}isNewFingerprint(Q={}){return!!Q[c]}templateStatic(Q,Z){if(typeof Q==="number")return Z[Q];else return Q}nextMagicID(){return this.magicId++,`m${this.magicId}-${this.parentViewId()}`}toOutputBuffer(Q,Z,$,Y,z={}){if(Q[k0])return this.comprehensionToBuffer(Q,Z,$);let{[c]:J}=Q;J=this.templateStatic(J,Z);let W=Q[J1],q=$.buffer;if(W)$.buffer="";if(Y&&W&&!Q.magicId)Q.newRender=!0,Q.magicId=this.nextMagicID();$.buffer+=J[0];for(let G=1;G0||G.length>0||j))delete Q[k1],Q[k0]=[],$.streams.add(J)}dynamicToBuffer(Q,Z,$,Y){if(typeof Q==="number"){let[z,J]=this.recursiveCIDToString($.components,Q,$.onlyCids);$.buffer+=z,$.streams=new Set([...$.streams,...J])}else if(j0(Q))this.toOutputBuffer(Q,Z,$,Y,{});else $.buffer+=Q}recursiveCIDToString(Q,Z,$){let Y=Q[Z]||h(`no component for CID ${Z}`,Q),z={[r]:Z},J=$&&!$.has(Z);Y.newRender=!J,Y.magicId=`c${Z}-${this.parentViewId()}`;let W=!Y.reset,[q,G]=this.recursiveToString(Y,Q,$,W,z);return delete Y.reset,[q,G]}},U9=1,O0=class{static makeID(){return U9++}static elementID(Q){return Q.phxHookId}constructor(Q,Z,$){this.__view=Q,this.liveSocket=Q.liveSocket,this.__callbacks=$,this.__listeners=new Set,this.__isDisconnected=!1,this.el=Z,this.el.phxHookId=this.constructor.makeID();for(let Y in this.__callbacks)this[Y]=this.__callbacks[Y]}__mounted(){this.mounted&&this.mounted()}__updated(){this.updated&&this.updated()}__beforeUpdate(){this.beforeUpdate&&this.beforeUpdate()}__destroyed(){this.destroyed&&this.destroyed()}__reconnected(){if(this.__isDisconnected)this.__isDisconnected=!1,this.reconnected&&this.reconnected()}__disconnected(){this.__isDisconnected=!0,this.disconnected&&this.disconnected()}pushEvent(Q,Z={},$=function(){}){return this.__view.pushHookEvent(this.el,null,Q,Z,$)}pushEventTo(Q,Z,$={},Y=function(){}){return this.__view.withinTargets(Q,(z,J)=>{return z.pushHookEvent(this.el,J,Z,$,Y)})}handleEvent(Q,Z){let $=(Y,z)=>z?Q:Z(Y.detail);return window.addEventListener(`phx:${Q}`,$),this.__listeners.add($),$}removeHandleEvent(Q){let Z=Q(null,!0);window.removeEventListener(`phx:${Z}`,Q),this.__listeners.delete(Q)}upload(Q,Z){return this.__view.dispatchUploads(null,Q,Z)}uploadTo(Q,Z,$){return this.__view.withinTargets(Q,(Y,z)=>{Y.dispatchUploads(z,Z,$)})}__cleanup__(){this.__listeners.forEach((Q)=>this.removeHandleEvent(Q))}},u0=(Q,Z,$=[])=>{const{submitter:Y,...z}=Z;let J;if(Y&&Y.name){const j=document.createElement("input");j.type="hidden";const B=Y.getAttribute("form");if(B)j.setAttribute("form",B);j.name=Y.name,j.value=Y.value,Y.parentElement.insertBefore(j,Y),J=j}const W=new FormData(Q),q=[];W.forEach((j,B,U)=>{if(j instanceof File)q.push(B)}),q.forEach((j)=>W.delete(j));const G=new URLSearchParams;for(let[j,B]of W.entries())if($.length===0||$.indexOf(j)>=0)G.append(j,B);if(Y&&J)Y.parentElement.removeChild(J);for(let j in z)G.append(j,z[j]);return G.toString()},$5=class{constructor(Q,Z,$,Y,z){this.isDead=!1,this.liveSocket=Z,this.flash=Y,this.parent=$,this.root=$?$.root:this,this.el=Q,this.id=this.el.id,this.ref=0,this.childJoins=0,this.loaderTimer=null,this.pendingDiffs=[],this.pendingForms=new Set,this.redirect=!1,this.href=null,this.joinCount=this.parent?this.parent.joinCount-1:0,this.joinPending=!0,this.destroyed=!1,this.joinCallback=function(J){J&&J()},this.stopCallback=function(){},this.pendingJoinOps=this.parent?null:[],this.viewHooks={},this.formSubmits=[],this.children=this.parent?null:{},this.root.children[this.id]={},this.channel=this.liveSocket.channel(`lv:${this.id}`,()=>{let J=this.href&&this.expandURL(this.href);return{redirect:this.redirect?J:void 0,url:this.redirect?void 0:J||void 0,params:this.connectParams(z),session:this.getSession(),static:this.getStatic(),flash:this.flash}})}setHref(Q){this.href=Q}setRedirect(Q){this.redirect=!0,this.href=Q}isMain(){return this.el.hasAttribute(V1)}connectParams(Q){let Z=this.liveSocket.params(this.el),$=K.all(document,`[${this.binding(w5)}]`).map((Y)=>Y.src||Y.href).filter((Y)=>typeof Y==="string");if($.length>0)Z._track_static=$;return Z._mounts=this.joinCount,Z._live_referer=Q,Z}isConnected(){return this.channel.canPush()}getSession(){return this.el.getAttribute($0)}getStatic(){let Q=this.el.getAttribute(A0);return Q===""?null:Q}destroy(Q=function(){}){if(this.destroyAllChildren(),this.destroyed=!0,delete this.root.children[this.id],this.parent)delete this.root.children[this.parent.id][this.id];clearTimeout(this.loaderTimer);let Z=()=>{Q();for(let $ in this.viewHooks)this.destroyHook(this.viewHooks[$])};K.markPhxChildDestroyed(this.el),this.log("destroyed",()=>["the child has been removed from the parent"]),this.channel.leave().receive("ok",Z).receive("error",Z).receive("timeout",Z)}setContainerClasses(...Q){this.el.classList.remove(w1,L0,g0,P1,e0),this.el.classList.add(...Q)}showLoader(Q){if(clearTimeout(this.loaderTimer),Q)this.loaderTimer=setTimeout(()=>this.showLoader(),Q);else{for(let Z in this.viewHooks)this.viewHooks[Z].__disconnected();this.setContainerClasses(L0)}}execAll(Q){K.all(this.el,`[${Q}]`,(Z)=>this.liveSocket.execJS(Z,Z.getAttribute(Q)))}hideLoader(){clearTimeout(this.loaderTimer),this.setContainerClasses(w1),this.execAll(this.binding("connected"))}triggerReconnected(){for(let Q in this.viewHooks)this.viewHooks[Q].__reconnected()}log(Q,Z){this.liveSocket.log(this,Q,Z)}transition(Q,Z,$=function(){}){this.liveSocket.transition(Q,Z,$)}withinTargets(Q,Z){if(Q instanceof HTMLElement||Q instanceof SVGElement)return this.liveSocket.owner(Q,($)=>Z($,Q));if(a(Q))if(K.findComponentNodeList(this.el,Q).length===0)h(`no component found matching phx-target of ${Q}`);else Z(this,parseInt(Q));else{let $=Array.from(document.querySelectorAll(Q));if($.length===0)h(`nothing found matching the phx-target selector "${Q}"`);$.forEach((Y)=>this.liveSocket.owner(Y,(z)=>Z(z,Y)))}}applyDiff(Q,Z,$){this.log(Q,()=>["",p0(Z)]);let{diff:Y,reply:z,events:J,title:W}=i1.extract(Z);if($({diff:Y,reply:z,events:J}),W)window.requestAnimationFrame(()=>K.putTitle(W))}onJoin(Q){let{rendered:Z,container:$}=Q;if($){let[Y,z]=$;this.el=K.replaceRootContainer(this.el,Y,z)}this.childJoins=0,this.joinPending=!0,this.flash=null,s.dropLocal(this.liveSocket.localStorage,window.location.pathname,n1),this.applyDiff("mount",Z,({diff:Y,events:z})=>{this.rendered=new i1(this.id,Y);let[J,W]=this.renderContainer(null,"join");this.dropPendingRefs();let q=this.formsForRecovery(J).filter(([G,j,B])=>{return!this.pendingForms.has(G.id)});if(this.joinCount++,q.length>0)q.forEach(([G,j,B],U)=>{this.pendingForms.add(G.id),this.pushFormRecovery(G,B,(V)=>{if(this.pendingForms.delete(G.id),U===q.length-1)this.onJoinComplete(V,J,W,z)})});else this.onJoinComplete(Q,J,W,z)})}dropPendingRefs(){K.all(document,`[${Q0}="${this.id}"][${v}]`,(Q)=>{Q.removeAttribute(v),Q.removeAttribute(Q0)})}onJoinComplete({live_patch:Q},Z,$,Y){if(this.pendingForms.clear(),this.joinCount>1||this.parent&&!this.parent.isJoinPending())return this.applyJoinPatch(Q,Z,$,Y);if(K.findPhxChildrenInFragment(Z,this.id).filter((J)=>{let W=J.id&&this.el.querySelector(`[id="${J.id}"]`),q=W&&W.getAttribute(A0);if(q)J.setAttribute(A0,q);if(W)W.setAttribute(M0,this.root.id);return this.joinChild(J)}).length===0)if(this.parent)this.root.pendingJoinOps.push([this,()=>this.applyJoinPatch(Q,Z,$,Y)]),this.parent.ackJoin(this);else this.onAllChildJoinsComplete(),this.applyJoinPatch(Q,Z,$,Y);else this.root.pendingJoinOps.push([this,()=>this.applyJoinPatch(Q,Z,$,Y)])}attachTrueDocEl(){this.el=K.byId(this.id),this.el.setAttribute(M0,this.root.id)}execNewMounted(){let Q=this.binding(j1),Z=this.binding(K1);K.all(this.el,`[${Q}], [${Z}]`,($)=>{K.maybeAddPrivateHooks($,Q,Z),this.maybeAddNewHook($)}),K.all(this.el,`[${this.binding(F0)}], [data-phx-${F0}]`,($)=>{this.maybeAddNewHook($)}),K.all(this.el,`[${this.binding(T1)}]`,($)=>this.maybeMounted($))}applyJoinPatch(Q,Z,$,Y){this.attachTrueDocEl();let z=new E0(this,this.el,this.id,Z,$,null);if(z.markPrunableContentForRemoval(),this.performPatch(z,!1,!0),this.joinNewChildren(),this.execNewMounted(),this.joinPending=!1,this.liveSocket.dispatchEvents(Y),this.applyPendingUpdates(),Q){let{kind:J,to:W}=Q;this.liveSocket.historyPatch(W,J)}if(this.hideLoader(),this.joinCount>1)this.triggerReconnected();this.stopCallback()}triggerBeforeUpdateHook(Q,Z){this.liveSocket.triggerDOM("onBeforeElUpdated",[Q,Z]);let $=this.getHook(Q),Y=$&&K.isIgnored(Q,this.binding(d0));if($&&!Q.isEqualNode(Z)&&!(Y&&c5(Q.dataset,Z.dataset)))return $.__beforeUpdate(),$}maybeMounted(Q){let Z=Q.getAttribute(this.binding(T1)),$=Z&&K.private(Q,"mounted");if(Z&&!$)this.liveSocket.execJS(Q,Z),K.putPrivate(Q,"mounted",!0)}maybeAddNewHook(Q,Z){let $=this.addHook(Q);if($)$.__mounted()}performPatch(Q,Z,$=!1){let Y=[],z=!1,J=new Set;return Q.after("added",(W)=>{this.liveSocket.triggerDOM("onNodeAdded",[W]);let q=this.binding(j1),G=this.binding(K1);if(K.maybeAddPrivateHooks(W,q,G),this.maybeAddNewHook(W),W.getAttribute)this.maybeMounted(W)}),Q.after("phxChildAdded",(W)=>{if(K.isPhxSticky(W))this.liveSocket.joinRootViews();else z=!0}),Q.before("updated",(W,q)=>{if(this.triggerBeforeUpdateHook(W,q))J.add(W.id)}),Q.after("updated",(W)=>{if(J.has(W.id))this.getHook(W).__updated()}),Q.after("discarded",(W)=>{if(W.nodeType===Node.ELEMENT_NODE)Y.push(W)}),Q.after("transitionsDiscarded",(W)=>this.afterElementsRemoved(W,Z)),Q.perform($),this.afterElementsRemoved(Y,Z),z}afterElementsRemoved(Q,Z){let $=[];if(Q.forEach((Y)=>{let z=K.all(Y,`[${r}]`),J=K.all(Y,`[${this.binding(F0)}]`);z.concat(Y).forEach((W)=>{let q=this.componentID(W);if(a(q)&&$.indexOf(q)===-1)$.push(q)}),J.concat(Y).forEach((W)=>{let q=this.getHook(W);q&&this.destroyHook(q)})}),Z)this.maybePushComponentsDestroyed($)}joinNewChildren(){K.findPhxChildren(this.el,this.id).forEach((Q)=>this.joinChild(Q))}getChildById(Q){return this.root.children[this.id][Q]}getDescendentByEl(Q){if(Q.id===this.id)return this;else return this.children[Q.getAttribute(K0)][Q.id]}destroyDescendent(Q){for(let Z in this.root.children)for(let $ in this.root.children[Z])if($===Q)return this.root.children[Z][$].destroy()}joinChild(Q){if(!this.getChildById(Q.id)){let $=new $5(Q,this.liveSocket,this);return this.root.children[this.id][$.id]=$,$.join(),this.childJoins++,!0}}isJoinPending(){return this.joinPending}ackJoin(Q){if(this.childJoins--,this.childJoins===0)if(this.parent)this.parent.ackJoin(this);else this.onAllChildJoinsComplete()}onAllChildJoinsComplete(){this.joinCallback(()=>{this.pendingJoinOps.forEach(([Q,Z])=>{if(!Q.isDestroyed())Z()}),this.pendingJoinOps=[]})}update(Q,Z){if(this.isJoinPending()||this.liveSocket.hasPendingLink()&&this.root.isMain())return this.pendingDiffs.push({diff:Q,events:Z});this.rendered.mergeDiff(Q);let $=!1;if(this.rendered.isComponentOnlyDiff(Q))this.liveSocket.time("component patch complete",()=>{K.findExistingParentCIDs(this.el,this.rendered.componentCIDs(Q)).forEach((z)=>{if(this.componentPatch(this.rendered.getComponent(Q,z),z))$=!0})});else if(!_1(Q))this.liveSocket.time("full patch complete",()=>{let[Y,z]=this.renderContainer(Q,"update"),J=new E0(this,this.el,this.id,Y,z,null);$=this.performPatch(J,!0)});if(this.liveSocket.dispatchEvents(Z),$)this.joinNewChildren()}renderContainer(Q,Z){return this.liveSocket.time(`toString diff (${Z})`,()=>{let $=this.el.tagName,Y=Q?this.rendered.componentCIDs(Q):null,[z,J]=this.rendered.toString(Y);return[`<${$}>${z}`,J]})}componentPatch(Q,Z){if(_1(Q))return!1;let[$,Y]=this.rendered.componentToString(Z),z=new E0(this,this.el,this.id,$,Y,Z);return this.performPatch(z,!0)}getHook(Q){return this.viewHooks[O0.elementID(Q)]}addHook(Q){if(O0.elementID(Q)||!Q.getAttribute)return;let Z=Q.getAttribute(`data-phx-${F0}`)||Q.getAttribute(this.binding(F0));if(Z&&!this.ownsElement(Q))return;let $=this.liveSocket.getHookCallbacks(Z);if($){if(!Q.id)h(`no DOM ID for hook "${Z}". Hooks require a unique ID on each element.`,Q);let Y=new O0(this,Q,$);return this.viewHooks[O0.elementID(Y.el)]=Y,Y}else if(Z!==null)h(`unknown hook found for "${Z}"`,Q)}destroyHook(Q){Q.__destroyed(),Q.__cleanup__(),delete this.viewHooks[O0.elementID(Q.el)]}applyPendingUpdates(){this.pendingDiffs.forEach(({diff:Q,events:Z})=>this.update(Q,Z)),this.pendingDiffs=[],this.eachChild((Q)=>Q.applyPendingUpdates())}eachChild(Q){let Z=this.root.children[this.id]||{};for(let $ in Z)Q(this.getChildById($))}onChannel(Q,Z){this.liveSocket.onChannel(this.channel,Q,($)=>{if(this.isJoinPending())this.root.pendingJoinOps.push([this,()=>Z($)]);else this.liveSocket.requestDOMUpdate(()=>Z($))})}bindChannel(){this.liveSocket.onChannel(this.channel,"diff",(Q)=>{this.liveSocket.requestDOMUpdate(()=>{this.applyDiff("update",Q,({diff:Z,events:$})=>this.update(Z,$))})}),this.onChannel("redirect",({to:Q,flash:Z})=>this.onRedirect({to:Q,flash:Z})),this.onChannel("live_patch",(Q)=>this.onLivePatch(Q)),this.onChannel("live_redirect",(Q)=>this.onLiveRedirect(Q)),this.channel.onError((Q)=>this.onError(Q)),this.channel.onClose((Q)=>this.onClose(Q))}destroyAllChildren(){this.eachChild((Q)=>Q.destroy())}onLiveRedirect(Q){let{to:Z,kind:$,flash:Y}=Q,z=this.expandURL(Z);this.liveSocket.historyRedirect(z,$,Y)}onLivePatch(Q){let{to:Z,kind:$}=Q;this.href=this.expandURL(Z),this.liveSocket.historyPatch(Z,$)}expandURL(Q){return Q.startsWith("/")?`${window.location.protocol}//${window.location.host}${Q}`:Q}onRedirect({to:Q,flash:Z}){this.liveSocket.redirect(Q,Z)}isDestroyed(){return this.destroyed}joinDead(){this.isDead=!0}join(Q){if(this.showLoader(this.liveSocket.loaderTimeout),this.bindChannel(),this.isMain())this.stopCallback=this.liveSocket.withPageLoading({to:this.href,kind:"initial"});this.joinCallback=(Z)=>{Z=Z||function(){},Q?Q(this.joinCount,Z):Z()},this.liveSocket.wrapPush(this,{timeout:!1},()=>{return this.channel.join().receive("ok",(Z)=>{if(!this.isDestroyed())this.liveSocket.requestDOMUpdate(()=>this.onJoin(Z))}).receive("error",(Z)=>!this.isDestroyed()&&this.onJoinError(Z)).receive("timeout",()=>!this.isDestroyed()&&this.onJoinError({reason:"timeout"}))})}onJoinError(Q){if(Q.reason==="reload"){if(this.log("error",()=>[`failed mount with ${Q.status}. Falling back to page request`,Q]),this.isMain())this.onRedirect({to:this.href});return}else if(Q.reason==="unauthorized"||Q.reason==="stale"){if(this.log("error",()=>["unauthorized live_redirect. Falling back to page request",Q]),this.isMain())this.onRedirect({to:this.href});return}if(Q.redirect||Q.live_redirect)this.joinPending=!1,this.channel.leave();if(Q.redirect)return this.onRedirect(Q.redirect);if(Q.live_redirect)return this.onLiveRedirect(Q.live_redirect);if(this.displayError([L0,g0,e0]),this.log("error",()=>["unable to join",Q]),this.liveSocket.isConnected())this.liveSocket.reloadWithJitter(this)}onClose(Q){if(this.isDestroyed())return;if(this.liveSocket.hasPendingLink()&&Q!=="leave")return this.liveSocket.reloadWithJitter(this);if(this.destroyAllChildren(),this.liveSocket.dropActiveElement(this),document.activeElement)document.activeElement.blur();if(this.liveSocket.isUnloaded())this.showLoader(_5)}onError(Q){if(this.onClose(Q),this.liveSocket.isConnected())this.log("error",()=>["view crashed",Q]);if(!this.liveSocket.isUnloaded())if(this.liveSocket.isConnected())this.displayError([L0,g0,e0]);else this.displayError([L0,g0,P1])}displayError(Q){if(this.isMain())K.dispatchEvent(window,"phx:page-loading-start",{detail:{to:this.href,kind:"error"}});this.showLoader(),this.setContainerClasses(...Q),this.execAll(this.binding("disconnected"))}pushWithReply(Q,Z,$,Y=function(){}){if(!this.isConnected())return;let[z,[J],W]=Q?Q():[null,[],{}],q=function(){};if(W.page_loading||J&&J.getAttribute(this.binding(R1))!==null)q=this.liveSocket.withPageLoading({kind:"element",target:J});if(typeof $.cid!=="number")delete $.cid;return this.liveSocket.wrapPush(this,{timeout:!0},()=>{return this.channel.push(Z,$,h5).receive("ok",(G)=>{let j=(B)=>{if(G.redirect)this.onRedirect(G.redirect);if(G.live_patch)this.onLivePatch(G.live_patch);if(G.live_redirect)this.onLiveRedirect(G.live_redirect);q(),Y(G,B)};if(G.diff)this.liveSocket.requestDOMUpdate(()=>{this.applyDiff("update",G.diff,({diff:B,reply:U,events:V})=>{if(z!==null)this.undoRefs(z);this.update(B,V),j(U)})});else{if(z!==null)this.undoRefs(z);j(null)}})})}undoRefs(Q){if(!this.isConnected())return;K.all(document,`[${Q0}="${this.id}"][${v}="${Q}"]`,(Z)=>{let $=Z.getAttribute(G0),Y=Z.getAttribute(Q1);if(Z.removeAttribute(v),Z.removeAttribute(Q0),Y!==null)Z.readOnly=Y==="true"?!0:!1,Z.removeAttribute(Q1);if($!==null)Z.disabled=$==="true"?!0:!1,Z.removeAttribute(G0);a1.forEach((W)=>K.removeClass(Z,W));let z=Z.getAttribute(C0);if(z!==null)Z.innerText=z,Z.removeAttribute(C0);let J=K.private(Z,v);if(J){let W=this.triggerBeforeUpdateHook(Z,J);if(E0.patchEl(Z,J,this.liveSocket.getActiveElement()),W)W.__updated();K.deletePrivate(Z,v)}})}putRef(Q,Z,$={}){let Y=this.ref++,z=this.binding(M1);if($.loading)Q=Q.concat(K.all(document,$.loading));return Q.forEach((J)=>{J.classList.add(`phx-${Z}-loading`),J.setAttribute(v,Y),J.setAttribute(Q0,this.el.id);let W=J.getAttribute(z);if(W!==null){if(!J.getAttribute(C0))J.setAttribute(C0,J.innerText);if(W!=="")J.innerText=W;J.setAttribute(G0,J.getAttribute(G0)||J.disabled),J.setAttribute("disabled","")}}),[Y,Q,$]}componentID(Q){let Z=Q.getAttribute&&Q.getAttribute(r);return Z?parseInt(Z):null}targetComponentID(Q,Z,$={}){if(a(Z))return Z;let Y=$.target||Q.getAttribute(this.binding("target"));if(a(Y))return parseInt(Y);else if(Z&&(Y!==null||$.target))return this.closestComponentID(Z);else return null}closestComponentID(Q){if(a(Q))return Q;else if(Q)return Z0(Q.closest(`[${r}]`),(Z)=>this.ownsElement(Z)&&this.componentID(Z));else return null}pushHookEvent(Q,Z,$,Y,z){if(!this.isConnected())return this.log("hook",()=>["unable to push hook event. LiveView not connected",$,Y]),!1;let[J,W,q]=this.putRef([Q],"hook");return this.pushWithReply(()=>[J,W,q],"event",{type:"hook",event:$,value:Y,cid:this.closestComponentID(Z)},(G,j)=>z(j,J)),J}extractMeta(Q,Z,$){let Y=this.binding("value-");for(let z=0;z=0&&!Q.checked)delete Z.value}if($){if(!Z)Z={};for(let z in $)Z[z]=$[z]}return Z}pushEvent(Q,Z,$,Y,z,J={},W){this.pushWithReply(()=>this.putRef([Z],Q,J),"event",{type:Q,event:Y,value:this.extractMeta(Z,z,J.value),cid:this.targetComponentID(Z,$,J)},(q,G)=>W&&W(G))}pushFileProgress(Q,Z,$,Y=function(){}){this.liveSocket.withinOwners(Q.form,(z,J)=>{z.pushWithReply(null,"progress",{event:Q.getAttribute(z.binding(N5)),ref:Q.getAttribute(o),entry_ref:Z,progress:$,cid:z.targetComponentID(Q.form,J)},Y)})}pushInput(Q,Z,$,Y,z,J){let W,q=a($)?$:this.targetComponentID(Q.form,Z,z),G=()=>this.putRef([Q,Q.form],"change",z),j,B=this.extractMeta(Q.form);if(Q instanceof HTMLButtonElement)B.submitter=Q;if(Q.getAttribute(this.binding("change")))j=u0(Q.form,{_target:z._target,...B},[Q.name]);else j=u0(Q.form,{_target:z._target,...B});if(K.isUploadInput(Q)&&Q.files&&Q.files.length>0)w.trackFiles(Q,Array.from(Q.files));W=w.serializeUploads(Q);let U={type:"form",event:Y,value:j,uploads:W,cid:q};this.pushWithReply(G,"event",U,(V)=>{if(K.showError(Q,this.liveSocket.binding(m0),this.liveSocket.binding(c0)),K.isUploadInput(Q)&&K.isAutoUpload(Q)){if(w.filesAwaitingPreflight(Q).length>0){let[X,L]=G();this.uploadFiles(Q.form,Z,X,q,(H)=>{J&&J(V),this.triggerAwaitingSubmit(Q.form),this.undoRefs(X)})}}else J&&J(V)})}triggerAwaitingSubmit(Q){let Z=this.getScheduledSubmit(Q);if(Z){let[$,Y,z,J]=Z;this.cancelSubmit(Q),J()}}getScheduledSubmit(Q){return this.formSubmits.find(([Z,$,Y,z])=>Z.isSameNode(Q))}scheduleSubmit(Q,Z,$,Y){if(this.getScheduledSubmit(Q))return!0;this.formSubmits.push([Q,Z,$,Y])}cancelSubmit(Q){this.formSubmits=this.formSubmits.filter(([Z,$,Y])=>{if(Z.isSameNode(Q))return this.undoRefs($),!1;else return!0})}disableForm(Q,Z={}){let $=(B)=>{return!(R0(B,`${this.binding(d0)}=ignore`,B.form)||R0(B,"data-phx-update=ignore",B.form))},Y=(B)=>{return B.hasAttribute(this.binding(M1))},z=(B)=>B.tagName=="BUTTON",J=(B)=>["INPUT","TEXTAREA","SELECT"].includes(B.tagName),W=Array.from(Q.elements),q=W.filter(Y),G=W.filter(z).filter($),j=W.filter(J).filter($);return G.forEach((B)=>{B.setAttribute(G0,B.disabled),B.disabled=!0}),j.forEach((B)=>{if(B.setAttribute(Q1,B.readOnly),B.readOnly=!0,B.files)B.setAttribute(G0,B.disabled),B.disabled=!0}),Q.setAttribute(this.binding(R1),""),this.putRef([Q].concat(q).concat(G).concat(j),"submit",Z)}pushFormSubmit(Q,Z,$,Y,z,J){let W=()=>this.disableForm(Q,z),q=this.targetComponentID(Q,Z);if(w.hasUploadsInProgress(Q)){let[G,j]=W(),B=()=>this.pushFormSubmit(Q,Z,$,Y,z,J);return this.scheduleSubmit(Q,G,z,B)}else if(w.inputsAwaitingPreflight(Q).length>0){let[G,j]=W(),B=()=>[G,j,z];this.uploadFiles(Q,Z,G,q,(U)=>{if(w.inputsAwaitingPreflight(Q).length>0)return this.undoRefs(G);let V=this.extractMeta(Q),X=u0(Q,{submitter:Y,...V});this.pushWithReply(B,"event",{type:"form",event:$,value:X,cid:q},J)})}else if(!(Q.hasAttribute(v)&&Q.classList.contains("phx-submit-loading"))){let G=this.extractMeta(Q),j=u0(Q,{submitter:Y,...G});this.pushWithReply(W,"event",{type:"form",event:$,value:j,cid:q},J)}}uploadFiles(Q,Z,$,Y,z){let J=this.joinCount,W=w.activeFileInputs(Q),q=W.length;W.forEach((G)=>{let j=new w(G,this,()=>{if(q--,q===0)z()}),B=j.entries().map((V)=>V.toPreflightPayload());if(B.length===0){q--;return}let U={ref:G.getAttribute(o),entries:B,cid:this.targetComponentID(G.form,Z)};this.log("upload",()=>["sending preflight request",U]),this.pushWithReply(null,"allow_upload",U,(V)=>{if(this.log("upload",()=>["got preflight response",V]),j.entries().forEach((X)=>{if(V.entries&&!V.entries[X.ref])this.handleFailedEntryPreflight(X.ref,"failed preflight",j)}),V.error||Object.keys(V.entries).length===0)this.undoRefs($),(V.error||[]).map(([L,H])=>{this.handleFailedEntryPreflight(L,H,j)});else{let X=(L)=>{this.channel.onError(()=>{if(this.joinCount===J)L()})};j.initAdapterUpload(V,X,this.liveSocket)}})})}handleFailedEntryPreflight(Q,Z,$){if($.isAutoUpload()){let Y=$.entries().find((z)=>z.ref===Q.toString());if(Y)Y.cancel()}else $.entries().map((Y)=>Y.cancel());this.log("upload",()=>[`error for entry ${Q}`,Z])}dispatchUploads(Q,Z,$){let Y=this.targetCtxElement(Q)||this.el,z=K.findUploadInputs(Y).filter((J)=>J.name===Z);if(z.length===0)h(`no live file inputs found matching the name "${Z}"`);else if(z.length>1)h(`duplicate live file inputs found matching the name "${Z}"`);else K.dispatchEvent(z[0],r1,{detail:{files:$}})}targetCtxElement(Q){if(a(Q)){let[Z]=K.findComponentNodeList(this.el,Q);return Z}else if(Q)return Q;else return null}pushFormRecovery(Q,Z,$){this.liveSocket.withinOwners(Q,(Y,z)=>{let J=this.binding("change"),W=Array.from(Q.elements).filter((j)=>K.isFormInput(j)&&j.name&&!j.hasAttribute(J));if(W.length===0)return;W.forEach((j)=>j.hasAttribute(o)&&w.clearFiles(j));let q=W.find((j)=>j.type!=="hidden")||W[0],G=Q.getAttribute(this.binding(y1))||Q.getAttribute(this.binding("change"));T.exec("change",G,Y,q,["push",{_target:q.name,newCid:Z,callback:$}])})}pushLinkPatch(Q,Z,$){let Y=this.liveSocket.setPendingLink(Q),z=Z?()=>this.putRef([Z],"click"):null,J=()=>this.liveSocket.redirect(window.location.href),W=Q.startsWith("/")?`${location.protocol}//${location.host}${Q}`:Q,q=this.pushWithReply(z,"live_patch",{url:W},(G)=>{this.liveSocket.requestDOMUpdate(()=>{if(G.link_redirect)this.liveSocket.replaceMain(Q,null,$,Y);else{if(this.liveSocket.commitPendingLink(Y))this.href=Q;this.applyPendingUpdates(),$&&$(Y)}})});if(q)q.receive("timeout",J);else J()}formsForRecovery(Q){if(this.joinCount===0)return[];let Z=this.binding("change"),$=document.createElement("template");return $.innerHTML=Q,K.all(this.el,`form[${Z}]`).filter((Y)=>Y.id&&this.ownsElement(Y)).filter((Y)=>Y.elements.length>0).filter((Y)=>Y.getAttribute(this.binding(y1))!=="ignore").map((Y)=>{const z=CSS.escape(Y.getAttribute(Z));let J=$.content.querySelector(`form[id="${Y.id}"][${Z}="${z}"]`);if(J)return[Y,J,this.targetComponentID(J)];else return[Y,Y,this.targetComponentID(Y)]}).filter(([Y,z,J])=>z)}maybePushComponentsDestroyed(Q){let Z=Q.filter(($)=>{return K.findComponentNodeList(this.el,$).length===0});if(Z.length>0)Z.forEach(($)=>this.rendered.resetRender($)),this.pushWithReply(null,"cids_will_destroy",{cids:Z},()=>{let $=Z.filter((Y)=>{return K.findComponentNodeList(this.el,Y).length===0});if($.length>0)this.pushWithReply(null,"cids_destroyed",{cids:$},(Y)=>{this.rendered.pruneCIDs(Y.cids)})})}ownsElement(Q){let Z=Q.closest(U0);return Q.getAttribute(K0)===this.id||Z&&Z.id===this.id||!Z&&this.isDead}submitForm(Q,Z,$,Y,z={}){K.putPrivate(Q,s0,!0);const J=this.liveSocket.binding(m0),W=this.liveSocket.binding(c0),q=Array.from(Q.elements);q.forEach((G)=>K.putPrivate(G,s0,!0)),this.liveSocket.blurActiveElement(this),this.pushFormSubmit(Q,Z,$,Y,z,()=>{q.forEach((G)=>K.showError(G,J,W)),this.liveSocket.restorePreviouslyActiveFocus()})}binding(Q){return this.liveSocket.binding(Q)}},Y5=class{constructor(Q,Z,$={}){if(this.unloaded=!1,!Z||Z.constructor.name==="Object")throw new Error(` + a phoenix Socket must be provided as the second argument to the LiveSocket constructor. For example: + + import {Socket} from "phoenix" + import {LiveSocket} from "phoenix_live_view" + let liveSocket = new LiveSocket("/live", Socket, {...}) + `);this.socket=new Z(Q,$),this.bindingPrefix=$.bindingPrefix||v5,this.opts=$,this.params=W1($.params||{}),this.viewLogger=$.viewLogger,this.metadataCallbacks=$.metadata||{},this.defaults=Object.assign(p0(E5),$.defaults||{}),this.activeElement=null,this.prevActive=null,this.silenced=!1,this.main=null,this.outgoingMainEl=null,this.clickStartedAtTarget=null,this.linkRef=1,this.roots={},this.href=window.location.href,this.pendingLink=null,this.currentLocation=p0(window.location),this.hooks=$.hooks||{},this.uploaders=$.uploaders||{},this.loaderTimeout=$.loaderTimeout||k5,this.reloadWithJitterTimer=null,this.maxReloads=$.maxReloads||x5,this.reloadJitterMin=$.reloadJitterMin||O5,this.reloadJitterMax=$.reloadJitterMax||A5,this.failsafeJitter=$.failsafeJitter||R5,this.localStorage=$.localStorage||window.localStorage,this.sessionStorage=$.sessionStorage||window.sessionStorage,this.boundTopLevelEvents=!1,this.domCallbacks=Object.assign({onNodeAdded:W1(),onBeforeElUpdated:W1()},$.dom||{}),this.transitions=new V9,window.addEventListener("pagehide",(Y)=>{this.unloaded=!0}),this.socket.onOpen(()=>{if(this.isUnloaded())window.location.reload()})}isProfileEnabled(){return this.sessionStorage.getItem(Y1)==="true"}isDebugEnabled(){return this.sessionStorage.getItem(N0)==="true"}isDebugDisabled(){return this.sessionStorage.getItem(N0)==="false"}enableDebug(){this.sessionStorage.setItem(N0,"true")}enableProfiling(){this.sessionStorage.setItem(Y1,"true")}disableDebug(){this.sessionStorage.setItem(N0,"false")}disableProfiling(){this.sessionStorage.removeItem(Y1)}enableLatencySim(Q){this.enableDebug(),console.log("latency simulator enabled for the duration of this browser session. Call disableLatencySim() to disable"),this.sessionStorage.setItem(z1,Q)}disableLatencySim(){this.sessionStorage.removeItem(z1)}getLatencySim(){let Q=this.sessionStorage.getItem(z1);return Q?parseInt(Q):null}getSocket(){return this.socket}connect(){if(window.location.hostname==="localhost"&&!this.isDebugDisabled())this.enableDebug();let Q=()=>{if(this.joinRootViews())this.bindTopLevelEvents(),this.socket.connect();else if(this.main)this.socket.connect();else this.bindTopLevelEvents({dead:!0});this.joinDeadView()};if(["complete","loaded","interactive"].indexOf(document.readyState)>=0)Q();else document.addEventListener("DOMContentLoaded",()=>Q())}disconnect(Q){clearTimeout(this.reloadWithJitterTimer),this.socket.disconnect(Q)}replaceTransport(Q){clearTimeout(this.reloadWithJitterTimer),this.socket.replaceTransport(Q),this.connect()}execJS(Q,Z,$=null){this.owner(Q,(Y)=>T.exec($,Z,Y,Q))}execJSHookPush(Q,Z,$,Y){this.withinOwners(Q,(z)=>{T.exec("hook",Z,z,Q,["push",{data:$,callback:Y}])})}unload(){if(this.unloaded)return;if(this.main&&this.isConnected())this.log(this.main,"socket",()=>["disconnect for page nav"]);this.unloaded=!0,this.destroyAllViews(),this.disconnect()}triggerDOM(Q,Z){this.domCallbacks[Q](...Z)}time(Q,Z){if(!this.isProfileEnabled()||!console.time)return Z();console.time(Q);let $=Z();return console.timeEnd(Q),$}log(Q,Z,$){if(this.viewLogger){let[Y,z]=$();this.viewLogger(Q,Z,Y,z)}else if(this.isDebugEnabled()){let[Y,z]=$();m5(Q,Z,Y,z)}}requestDOMUpdate(Q){this.transitions.after(Q)}transition(Q,Z,$=function(){}){this.transitions.addTransition(Q,Z,$)}onChannel(Q,Z,$){Q.on(Z,(Y)=>{let z=this.getLatencySim();if(!z)$(Y);else setTimeout(()=>$(Y),z)})}wrapPush(Q,Z,$){let Y=this.getLatencySim(),z=Q.joinCount;if(!Y)if(this.isConnected()&&Z.timeout)return $().receive("timeout",()=>{if(Q.joinCount===z&&!Q.isDestroyed())this.reloadWithJitter(Q,()=>{this.log(Q,"timeout",()=>["received timeout while communicating with server. Falling back to hard refresh for recovery"])})});else return $();let J={receives:[],receive(W,q){this.receives.push([W,q])}};return setTimeout(()=>{if(Q.isDestroyed())return;J.receives.reduce((W,[q,G])=>W.receive(q,G),$())},Y),J}reloadWithJitter(Q,Z){clearTimeout(this.reloadWithJitterTimer),this.disconnect();let $=this.reloadJitterMin,Y=this.reloadJitterMax,z=Math.floor(Math.random()*(Y-$+1))+$,J=s.updateLocal(this.localStorage,window.location.pathname,n1,0,(W)=>W+1);if(J>this.maxReloads)z=this.failsafeJitter;this.reloadWithJitterTimer=setTimeout(()=>{if(Q.isDestroyed()||Q.isConnected())return;if(Q.destroy(),Z?Z():this.log(Q,"join",()=>[`encountered ${J} consecutive reloads`]),J>this.maxReloads)this.log(Q,"join",()=>[`exceeded ${this.maxReloads} consecutive reloads. Entering failsafe mode`]);if(this.hasPendingLink())window.location=this.pendingLink;else window.location.reload()},z)}getHookCallbacks(Q){return Q&&Q.startsWith("Phoenix.")?o5[Q.split(".")[1]]:this.hooks[Q]}isUnloaded(){return this.unloaded}isConnected(){return this.socket.isConnected()}getBindingPrefix(){return this.bindingPrefix}binding(Q){return`${this.getBindingPrefix()}${Q}`}channel(Q,Z){return this.socket.channel(Q,Z)}joinDeadView(){let Q=document.body;if(Q&&!this.isPhxView(Q)&&!this.isPhxView(document.firstElementChild)){let Z=this.newRootView(Q);if(Z.setHref(this.getHref()),Z.joinDead(),!this.main)this.main=Z;window.requestAnimationFrame(()=>Z.execNewMounted())}}joinRootViews(){let Q=!1;return K.all(document,`${U0}:not([${K0}])`,(Z)=>{if(!this.getRootById(Z.id)){let $=this.newRootView(Z);if($.setHref(this.getHref()),$.join(),Z.hasAttribute(V1))this.main=$}Q=!0}),Q}redirect(Q,Z){this.unload(),s.redirect(Q,Z)}replaceMain(Q,Z,$=null,Y=this.setPendingLink(Q)){let z=this.currentLocation.href;this.outgoingMainEl=this.outgoingMainEl||this.main.el;let J=K.cloneNode(this.outgoingMainEl,"");this.main.showLoader(this.loaderTimeout),this.main.destroy(),this.main=this.newRootView(J,Z,z),this.main.setRedirect(Q),this.transitionRemoves(null,!0),this.main.join((W,q)=>{if(W===1&&this.commitPendingLink(Y))this.requestDOMUpdate(()=>{K.findPhxSticky(document).forEach((G)=>J.appendChild(G)),this.outgoingMainEl.replaceWith(J),this.outgoingMainEl=null,$&&$(Y),q()})})}transitionRemoves(Q,Z){let $=this.binding("remove");if(Q=Q||K.all(document,`[${$}]`),Z){const Y=K.findPhxSticky(document)||[];Q=Q.filter((z)=>!K.isChildOfAny(z,Y))}Q.forEach((Y)=>{this.execJS(Y,Y.getAttribute($),"remove")})}isPhxView(Q){return Q.getAttribute&&Q.getAttribute($0)!==null}newRootView(Q,Z,$){let Y=new $5(Q,this,null,Z,$);return this.roots[Y.id]=Y,Y}owner(Q,Z){let $=Z0(Q.closest(U0),(Y)=>this.getViewByEl(Y))||this.main;if($)Z($)}withinOwners(Q,Z){this.owner(Q,($)=>Z($,Q))}getViewByEl(Q){let Z=Q.getAttribute(M0);return Z0(this.getRootById(Z),($)=>$.getDescendentByEl(Q))}getRootById(Q){return this.roots[Q]}destroyAllViews(){for(let Q in this.roots)this.roots[Q].destroy(),delete this.roots[Q];this.main=null}destroyViewByEl(Q){let Z=this.getRootById(Q.getAttribute(M0));if(Z&&Z.id===Q.id)Z.destroy(),delete this.roots[Z.id];else if(Z)Z.destroyDescendent(Q.id)}setActiveElement(Q){if(this.activeElement===Q)return;this.activeElement=Q;let Z=()=>{if(Q===this.activeElement)this.activeElement=null;Q.removeEventListener("mouseup",this),Q.removeEventListener("touchend",this)};Q.addEventListener("mouseup",Z),Q.addEventListener("touchend",Z)}getActiveElement(){if(document.activeElement===document.body)return this.activeElement||document.activeElement;else return document.activeElement||document.body}dropActiveElement(Q){if(this.prevActive&&Q.ownsElement(this.prevActive))this.prevActive=null}restorePreviouslyActiveFocus(){if(this.prevActive&&this.prevActive!==document.body)this.prevActive.focus()}blurActiveElement(){if(this.prevActive=this.getActiveElement(),this.prevActive!==document.body)this.prevActive.blur()}bindTopLevelEvents({dead:Q}={}){if(this.boundTopLevelEvents)return;if(this.boundTopLevelEvents=!0,this.socket.onClose((Z)=>{if(Z&&Z.code===1000&&this.main)return this.reloadWithJitter(this.main)}),document.body.addEventListener("click",function(){}),window.addEventListener("pageshow",(Z)=>{if(Z.persisted)this.getSocket().disconnect(),this.withPageLoading({to:window.location.href,kind:"redirect"}),window.location.reload()},!0),!Q)this.bindNav();if(this.bindClicks(),!Q)this.bindForms();this.bind({keyup:"keyup",keydown:"keydown"},(Z,$,Y,z,J,W)=>{let q=z.getAttribute(this.binding(C5)),G=Z.key&&Z.key.toLowerCase();if(q&&q.toLowerCase()!==G)return;let j={key:Z.key,...this.eventMeta($,Z,z)};T.exec($,J,Y,z,["push",{data:j}])}),this.bind({blur:"focusout",focus:"focusin"},(Z,$,Y,z,J,W)=>{if(!W){let q={key:Z.key,...this.eventMeta($,Z,z)};T.exec($,J,Y,z,["push",{data:q}])}}),this.bind({blur:"blur",focus:"focus"},(Z,$,Y,z,J,W)=>{if(W==="window"){let q=this.eventMeta($,Z,z);T.exec($,J,Y,z,["push",{data:q}])}}),window.addEventListener("dragover",(Z)=>Z.preventDefault()),window.addEventListener("drop",(Z)=>{Z.preventDefault();let $=Z0(R0(Z.target,this.binding(O1)),(J)=>{return J.getAttribute(this.binding(O1))}),Y=$&&document.getElementById($),z=Array.from(Z.dataTransfer.files||[]);if(!Y||Y.disabled||z.length===0||!(Y.files instanceof FileList))return;w.trackFiles(Y,z,Z.dataTransfer),Y.dispatchEvent(new Event("input",{bubbles:!0}))}),this.on(r1,(Z)=>{let $=Z.target;if(!K.isUploadInput($))return;let Y=Array.from(Z.detail.files||[]).filter((z)=>z instanceof File||z instanceof Blob);w.trackFiles($,Y),$.dispatchEvent(new Event("input",{bubbles:!0}))})}eventMeta(Q,Z,$){let Y=this.metadataCallbacks[Q];return Y?Y(Z,$):{}}setPendingLink(Q){return this.linkRef++,this.pendingLink=Q,this.linkRef}commitPendingLink(Q){if(this.linkRef!==Q)return!1;else return this.href=this.pendingLink,this.pendingLink=null,!0}getHref(){return this.href}hasPendingLink(){return!!this.pendingLink}bind(Q,Z){for(let $ in Q){let Y=Q[$];this.on(Y,(z)=>{let J=this.binding($),W=this.binding(`window-${$}`),q=z.target.getAttribute&&z.target.getAttribute(J);if(q)this.debounce(z.target,z,Y,()=>{this.withinOwners(z.target,(G)=>{Z(z,$,G,z.target,q,null)})});else K.all(document,`[${W}]`,(G)=>{let j=G.getAttribute(W);this.debounce(G,z,Y,()=>{this.withinOwners(G,(B)=>{Z(z,$,B,G,j,"window")})})})})}}bindClicks(){window.addEventListener("mousedown",(Q)=>this.clickStartedAtTarget=Q.target),this.bindClick("click","click",!1),this.bindClick("mousedown","capture-click",!0)}bindClick(Q,Z,$){let Y=this.binding(Z);window.addEventListener(Q,(z)=>{let J=null;if($)J=z.target.matches(`[${Y}]`)?z.target:z.target.querySelector(`[${Y}]`);else{if(z.detail===0)this.clickStartedAtTarget=z.target;let q=this.clickStartedAtTarget||z.target;J=R0(q,Y),this.dispatchClickAway(z,q),this.clickStartedAtTarget=null}let W=J&&J.getAttribute(Y);if(!W){if(!$&&K.isNewPageClick(z,window.location))this.unload();return}if(J.getAttribute("href")==="#")z.preventDefault();if(J.hasAttribute(v))return;this.debounce(J,z,"click",()=>{this.withinOwners(J,(q)=>{T.exec("click",W,q,J,["push",{data:this.eventMeta("click",z,J)}])})})},$)}dispatchClickAway(Q,Z){let $=this.binding("click-away");K.all(document,`[${$}]`,(Y)=>{if(!(Y.isSameNode(Z)||Y.contains(Z)))this.withinOwners(Y,(z)=>{let J=Y.getAttribute($);if(T.isVisible(Y)&&T.isInViewport(Y))T.exec("click",J,z,Y,["push",{data:this.eventMeta("click",Q,Q.target)}])})})}bindNav(){if(!s.canPushState())return;if(history.scrollRestoration)history.scrollRestoration="manual";let Q=null;window.addEventListener("scroll",(Z)=>{clearTimeout(Q),Q=setTimeout(()=>{s.updateCurrentState(($)=>Object.assign($,{scroll:window.scrollY}))},100)}),window.addEventListener("popstate",(Z)=>{if(!this.registerNewLocation(window.location))return;let{type:$,id:Y,root:z,scroll:J}=Z.state||{},W=window.location.href;K.dispatchEvent(window,"phx:navigate",{detail:{href:W,patch:$==="patch",pop:!0}}),this.requestDOMUpdate(()=>{if(this.main.isConnected()&&($==="patch"&&Y===this.main.id))this.main.pushLinkPatch(W,null,()=>{this.maybeScroll(J)});else this.replaceMain(W,null,()=>{if(z)this.replaceRootHistory();this.maybeScroll(J)})})},!1),window.addEventListener("click",(Z)=>{let $=R0(Z.target,t0),Y=$&&$.getAttribute(t0);if(!Y||!this.isConnected()||!this.main||K.wantsNewTab(Z))return;let z=$.href instanceof SVGAnimatedString?$.href.baseVal:$.href,J=$.getAttribute(P5);if(Z.preventDefault(),Z.stopImmediatePropagation(),this.pendingLink===z)return;this.requestDOMUpdate(()=>{if(Y==="patch")this.pushHistoryPatch(z,J,$);else if(Y==="redirect")this.historyRedirect(z,J);else throw new Error(`expected ${t0} to be "patch" or "redirect", got: ${Y}`);let W=$.getAttribute(this.binding("click"));if(W)this.requestDOMUpdate(()=>this.execJS($,W,"click"))})},!1)}maybeScroll(Q){if(typeof Q==="number")requestAnimationFrame(()=>{window.scrollTo(0,Q)})}dispatchEvent(Q,Z={}){K.dispatchEvent(window,`phx:${Q}`,{detail:Z})}dispatchEvents(Q){Q.forEach(([Z,$])=>this.dispatchEvent(Z,$))}withPageLoading(Q,Z){K.dispatchEvent(window,"phx:page-loading-start",{detail:Q});let $=()=>K.dispatchEvent(window,"phx:page-loading-stop",{detail:Q});return Z?Z($):$}pushHistoryPatch(Q,Z,$){if(!this.isConnected()||!this.main.isMain())return s.redirect(Q);this.withPageLoading({to:Q,kind:"patch"},(Y)=>{this.main.pushLinkPatch(Q,$,(z)=>{this.historyPatch(Q,Z,z),Y()})})}historyPatch(Q,Z,$=this.setPendingLink(Q)){if(!this.commitPendingLink($))return;s.pushState(Z,{type:"patch",id:this.main.id},Q),K.dispatchEvent(window,"phx:navigate",{detail:{patch:!0,href:Q,pop:!1}}),this.registerNewLocation(window.location)}historyRedirect(Q,Z,$){if(!this.isConnected()||!this.main.isMain())return s.redirect(Q,$);if(/^\/$|^\/[^\/]+.*$/.test(Q)){let{protocol:z,host:J}=window.location;Q=`${z}//${J}${Q}`}let Y=window.scrollY;this.withPageLoading({to:Q,kind:"redirect"},(z)=>{this.replaceMain(Q,$,(J)=>{if(J===this.linkRef)s.pushState(Z,{type:"redirect",id:this.main.id,scroll:Y},Q),K.dispatchEvent(window,"phx:navigate",{detail:{href:Q,patch:!1,pop:!1}}),this.registerNewLocation(window.location);z()})})}replaceRootHistory(){s.pushState("replace",{root:!0,type:"patch",id:this.main.id})}registerNewLocation(Q){let{pathname:Z,search:$}=this.currentLocation;if(Z+$===Q.pathname+Q.search)return!1;else return this.currentLocation=p0(Q),!0}bindForms(){let Q=0,Z=!1;this.on("submit",($)=>{let Y=$.target.getAttribute(this.binding("submit")),z=$.target.getAttribute(this.binding("change"));if(!Z&&z&&!Y)Z=!0,$.preventDefault(),this.withinOwners($.target,(J)=>{J.disableForm($.target),window.requestAnimationFrame(()=>{if(K.isUnloadableFormSubmit($))this.unload();$.target.submit()})})},!0),this.on("submit",($)=>{let Y=$.target.getAttribute(this.binding("submit"));if(!Y){if(K.isUnloadableFormSubmit($))this.unload();return}$.preventDefault(),$.target.disabled=!0,this.withinOwners($.target,(z)=>{T.exec("submit",Y,z,$.target,["push",{submitter:$.submitter}])})},!1);for(let $ of["change","input"])this.on($,(Y)=>{let z=this.binding("change"),J=Y.target,W=J.getAttribute(z),q=J.form&&J.form.getAttribute(z),G=W||q;if(!G)return;if(J.type==="number"&&J.validity&&J.validity.badInput)return;let j=W?J:J.form,B=Q;Q++;let{at:U,type:V}=K.private(J,"prev-iteration")||{};if(U===B-1&&$==="change"&&V==="input")return;K.putPrivate(J,"prev-iteration",{at:B,type:$}),this.debounce(J,Y,$,()=>{this.withinOwners(j,(X)=>{if(K.putPrivate(J,B1,!0),!K.isTextualInput(J))this.setActiveElement(J);T.exec("change",G,X,J,["push",{_target:Y.target.name,dispatcher:j}])})})},!1);this.on("reset",($)=>{let Y=$.target;K.resetForm(Y,this.binding(m0),this.binding(c0));let z=Array.from(Y.elements).find((J)=>J.type==="reset");if(z)window.requestAnimationFrame(()=>{z.dispatchEvent(new Event("input",{bubbles:!0,cancelable:!1}))})})}debounce(Q,Z,$,Y){if($==="blur"||$==="focusout")return Y();let z=this.binding(b5),J=this.binding(g5),W=this.defaults.debounce.toString(),q=this.defaults.throttle.toString();this.withinOwners(Q,(G)=>{let j=()=>!G.isDestroyed()&&document.body.contains(Q);K.debounce(Q,Z,z,W,J,q,j,()=>{Y()})})}silenceEvents(Q){this.silenced=!0,Q(),this.silenced=!1}on(Q,Z){window.addEventListener(Q,($)=>{if(!this.silenced)Z($)})}},V9=class{constructor(){this.transitions=new Set,this.pendingOps=[]}reset(){this.transitions.forEach((Q)=>{clearTimeout(Q),this.transitions.delete(Q)}),this.flushPendingOps()}after(Q){if(this.size()===0)Q();else this.pushPendingOp(Q)}addTransition(Q,Z,$){Z();let Y=setTimeout(()=>{this.transitions.delete(Y),$(),this.flushPendingOps()},Q);this.transitions.add(Y)}pushPendingOp(Q){this.pendingOps.push(Q)}size(){return this.transitions.size}flushPendingOps(){if(this.size()>0)return;let Q=this.pendingOps.shift();if(Q)Q(),this.flushPendingOps()}};var n0=M5(J5(),1),X9=document.querySelector("meta[name='csrf-token']").getAttribute("content"),L9=document.querySelector("meta[name='socket-path']").getAttribute("content"),F9=document.querySelector("meta[name='socket-transport']").getAttribute("content"),D9=F9=="longpoll"?z0:WebSocket,W5=new Y5(L9,x1,{transport:D9,params:{_csrf_token:X9}});n0.default.config({barColors:{0:"#29d"},shadowColor:"rgba(0, 0, 0, .3)"});window.addEventListener("phx:page-loading-start",(Q)=>n0.default.show(300));window.addEventListener("phx:page-loading-stop",(Q)=>n0.default.hide());W5.connect();window.liveSocket=W5;