diff --git a/.gitignore b/.gitignore
index 5232aba..5b0d4e6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,6 +10,8 @@
# Where third-party dependencies like ExDoc output generated docs.
/doc/
+node_modules
+
# Ignore .fetch files in case you like to edit your project deps locally.
/.fetch
@@ -22,4 +24,4 @@ erl_crash.dump
# Ignore package tarball (built via "mix hex.build").
ash_admin-*.tar
-.DS_Store
\ No newline at end of file
+.DS_Store
diff --git a/assets/js/app.js b/assets/js/app.js
index d2ff19c..5bc6134 100644
--- a/assets/js/app.js
+++ b/assets/js/app.js
@@ -128,6 +128,15 @@ Hooks.Actor = {
this.handleEvent("toggle_actor_paused", (payload) => {
document.cookie = "actor_paused" + "=" + payload.actor_paused + ";path=/";
});
+
+ this.pushEvent("set_actor_from_session", {
+ actor_resource: document.cookie.actor_resource,
+ actor_primary_key: document.cookie.actor_primary_key,
+ actor_action: document.cookie.actor_action,
+ actor_api: document.cookie.actor_api,
+ actor_authorizing: document.cookie.actor_authorizing,
+ actor_paused: document.cookie.actor_paused
+ })
},
};
diff --git a/lib/ash_admin/pages/page_live.ex b/lib/ash_admin/pages/page_live.ex
index 2a94440..c180388 100644
--- a/lib/ash_admin/pages/page_live.ex
+++ b/lib/ash_admin/pages/page_live.ex
@@ -306,6 +306,19 @@ defmodule AshAdmin.PageLive do
|> push_event("clear_actor", %{})}
end
+ def handle_event("set_actor_from_session", payload, socket) do
+ assigns =
+ payload
+ |> Map.take(
+ ~w[actor_resource actor_primary_key actor_action actor_api actor_authorizing actor_paused]
+ )
+ |> Enum.map(fn {key, value} ->
+ {String.to_existing_atom(key), value}
+ end)
+
+ {:noreply, assign(socket, assigns)}
+ end
+
def handle_event(
"set_actor",
%{"resource" => resource, "api" => api, "pkey" => primary_key},
diff --git a/priv/static/assets/app-161d914bba3ef8912bae46d62332075a.css b/priv/static/assets/app-161d914bba3ef8912bae46d62332075a.css
new file mode 100644
index 0000000..c68de13
--- /dev/null
+++ b/priv/static/assets/app-161d914bba3ef8912bae46d62332075a.css
@@ -0,0 +1 @@
+/*! tailwindcss v3.3.2 | MIT License | https://tailwindcss.com*/*,:after,:before{border:0 solid #e5e7eb;box-sizing:border-box}:after,:before{--tw-content:""}html{-webkit-text-size-adjust:100%;font-feature-settings:normal;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-variation-settings:normal;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4}body{line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:initial}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{color:inherit;font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button;background-color:initial;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:initial}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{color:#9ca3af;opacity:1}input::placeholder,textarea::placeholder{color:#9ca3af;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]{display:none}[multiple],[type=date],[type=datetime-local],[type=email],[type=month],[type=number],[type=password],[type=search],[type=tel],[type=text],[type=time],[type=url],[type=week],select,textarea{--tw-shadow:0 0 #0000;-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:#fff;border-color:#6b7280;border-radius:0;border-width:1px;font-size:1rem;line-height:1.5rem;padding:.5rem .75rem}[multiple]:focus,[type=date]:focus,[type=datetime-local]:focus,[type=email]:focus,[type=month]:focus,[type=number]:focus,[type=password]:focus,[type=search]:focus,[type=tel]:focus,[type=text]:focus,[type=time]:focus,[type=url]:focus,[type=week]:focus,select:focus,textarea:focus{--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);border-color:#2563eb;box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);outline:2px solid #0000;outline-offset:2px}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-day-field,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-meridiem-field,::-webkit-datetime-edit-millisecond-field,::-webkit-datetime-edit-minute-field,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-second-field,::-webkit-datetime-edit-year-field{padding-bottom:0;padding-top:0}select{background-image:url("data:image/svg+xml;charset=utf-8,%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 8 4 4 4-4'/%3E%3C/svg%3E");background-position:right .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:none;background-position:0 0;background-repeat:unset;background-size:initial;padding-right:.75rem;-webkit-print-color-adjust:unset;print-color-adjust:unset}[type=checkbox],[type=radio]{--tw-shadow:0 0 #0000;-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:#fff;background-origin:border-box;border-color:#6b7280;border-width:1px;color:#2563eb;display:inline-block;flex-shrink:0;height:1rem;padding:0;-webkit-print-color-adjust:exact;print-color-adjust:exact;-webkit-user-select:none;-moz-user-select:none;user-select:none;vertical-align:middle;width:1rem}[type=checkbox]{border-radius:0}[type=radio]{border-radius:100%}[type=checkbox]:focus,[type=radio]:focus{--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);outline:2px solid #0000;outline-offset:2px}[type=checkbox]:checked,[type=radio]:checked{background-color:currentColor;background-position:50%;background-repeat:no-repeat;background-size:100% 100%;border-color:#0000}[type=checkbox]:checked{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23fff' viewBox='0 0 16 16'%3E%3Cpath d='M12.207 4.793a1 1 0 0 1 0 1.414l-5 5a1 1 0 0 1-1.414 0l-2-2a1 1 0 0 1 1.414-1.414L6.5 9.086l4.293-4.293a1 1 0 0 1 1.414 0z'/%3E%3C/svg%3E")}[type=radio]:checked{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23fff' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='3'/%3E%3C/svg%3E")}[type=checkbox]:checked:focus,[type=checkbox]:checked:hover,[type=checkbox]:indeterminate,[type=radio]:checked:focus,[type=radio]:checked:hover{background-color:currentColor;border-color:#0000}[type=checkbox]:indeterminate{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 16 16'%3E%3Cpath stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M4 8h8'/%3E%3C/svg%3E");background-position:50%;background-repeat:no-repeat;background-size:100% 100%}[type=checkbox]:indeterminate:focus,[type=checkbox]:indeterminate:hover{background-color:currentColor;border-color:#0000}[type=file]{background:unset;border-color:inherit;border-radius:0;border-width:0;font-size:unset;line-height:inherit;padding:0}[type=file]:focus{outline:1px solid ButtonText;outline:1px auto -webkit-focus-ring-color}*,::backdrop,:after,:before{--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:#3b82f680;--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: }.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}}.hero-arrow-left-solid{--hero-arrow-left-solid:url('data:image/svg+xml;utf8,');-webkit-mask:var(--hero-arrow-left-solid);mask:var(--hero-arrow-left-solid);-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.hero-arrow-left-solid,.hero-arrow-path{background-color:currentColor;display:inline-block;height:1.25rem;vertical-align:middle;width:1.25rem}.hero-arrow-path{--hero-arrow-path:url('data:image/svg+xml;utf8,');-webkit-mask:var(--hero-arrow-path);mask:var(--hero-arrow-path);-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.hero-check{--hero-check:url('data:image/svg+xml;utf8,');-webkit-mask:var(--hero-check);mask:var(--hero-check);-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.hero-check,.hero-exclamation-circle-mini{background-color:currentColor;display:inline-block;height:1.25rem;vertical-align:middle;width:1.25rem}.hero-exclamation-circle-mini{--hero-exclamation-circle-mini:url('data:image/svg+xml;utf8,');-webkit-mask:var(--hero-exclamation-circle-mini);mask:var(--hero-exclamation-circle-mini);-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.hero-information-circle-mini{--hero-information-circle-mini:url('data:image/svg+xml;utf8,');-webkit-mask:var(--hero-information-circle-mini);mask:var(--hero-information-circle-mini);-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.hero-information-circle-mini,.hero-information-circle-solid{background-color:currentColor;display:inline-block;height:1.25rem;vertical-align:middle;width:1.25rem}.hero-information-circle-solid{--hero-information-circle-solid:url('data:image/svg+xml;utf8,');-webkit-mask:var(--hero-information-circle-solid);mask:var(--hero-information-circle-solid);-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.hero-key{--hero-key:url('data:image/svg+xml;utf8,');-webkit-mask:var(--hero-key);mask:var(--hero-key);-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.hero-key,.hero-key-solid{background-color:currentColor;display:inline-block;height:1.25rem;vertical-align:middle;width:1.25rem}.hero-key-solid{--hero-key-solid:url('data:image/svg+xml;utf8,');-webkit-mask:var(--hero-key-solid);mask:var(--hero-key-solid);-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.hero-magnifying-glass-circle{--hero-magnifying-glass-circle:url('data:image/svg+xml;utf8,');-webkit-mask:var(--hero-magnifying-glass-circle);mask:var(--hero-magnifying-glass-circle);-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.hero-magnifying-glass-circle,.hero-minus{background-color:currentColor;display:inline-block;height:1.25rem;vertical-align:middle;width:1.25rem}.hero-minus{--hero-minus:url('data:image/svg+xml;utf8,');-webkit-mask:var(--hero-minus);mask:var(--hero-minus);-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.hero-pencil-solid{--hero-pencil-solid:url('data:image/svg+xml;utf8,');-webkit-mask:var(--hero-pencil-solid);mask:var(--hero-pencil-solid);-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.hero-pencil-solid,.hero-plus{background-color:currentColor;display:inline-block;height:1.25rem;vertical-align:middle;width:1.25rem}.hero-plus{--hero-plus:url('data:image/svg+xml;utf8,');-webkit-mask:var(--hero-plus);mask:var(--hero-plus);-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.hero-x-circle-solid{--hero-x-circle-solid:url('data:image/svg+xml;utf8,');-webkit-mask:var(--hero-x-circle-solid);mask:var(--hero-x-circle-solid);-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.hero-x-circle-solid,.hero-x-mark{background-color:currentColor;display:inline-block;height:1.25rem;vertical-align:middle;width:1.25rem}.hero-x-mark{--hero-x-mark:url('data:image/svg+xml;utf8,');-webkit-mask:var(--hero-x-mark);mask:var(--hero-x-mark);-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.hero-x-mark-solid{--hero-x-mark-solid:url('data:image/svg+xml;utf8,');background-color:currentColor;display:inline-block;height:1.25rem;-webkit-mask:var(--hero-x-mark-solid);mask:var(--hero-x-mark-solid);-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;vertical-align:middle;width:1.25rem}.sr-only{clip:rect(0,0,0,0);border-width:0;height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.inset-0{inset:0}.-inset-y-px{bottom:-1px;top:-1px}.-left-4{left:-1rem}.-right-4{right:-1rem}.left-0{left:0}.right-0{right:0}.right-1{right:.25rem}.right-2{right:.5rem}.right-5{right:1.25rem}.top-1{top:.25rem}.top-2{top:.5rem}.top-6{top:1.5rem}.z-0{z-index:0}.z-10{z-index:10}.z-50{z-index:50}.col-span-2{grid-column:span 2/span 2}.col-span-3{grid-column:span 3/span 3}.col-span-6{grid-column:span 6/span 6}.col-span-full{grid-column:1/-1}.float-right{float:right}.-m-3{margin:-.75rem}.m-2{margin:.5rem}.m-5{margin:1.25rem}.-my-4{margin-bottom:-1rem;margin-top:-1rem}.mx-12{margin-left:3rem;margin-right:3rem}.mx-24{margin-left:6rem;margin-right:6rem}.mx-auto{margin-left:auto;margin-right:auto}.my-4{margin-bottom:1rem;margin-top:1rem}.-mr-1{margin-right:-.25rem}.-mr-2{margin-right:-.5rem}.mb-10{margin-bottom:2.5rem}.mb-2{margin-bottom:.5rem}.mb-4{margin-bottom:1rem}.ml-1{margin-left:.25rem}.ml-10{margin-left:2.5rem}.ml-12{margin-left:3rem}.ml-2{margin-left:.5rem}.ml-3{margin-left:.75rem}.ml-4{margin-left:1rem}.mr-1{margin-right:.25rem}.mr-4{margin-right:1rem}.mr-5{margin-right:1.25rem}.mt-0{margin-top:0}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-10{margin-top:2.5rem}.mt-11{margin-top:2.75rem}.mt-14{margin-top:3.5rem}.mt-16{margin-top:4rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-5{margin-top:1.25rem}.block{display:block}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.h-16{height:4rem}.h-3{height:.75rem}.h-4{height:1rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-full{height:100%}.h-max{height:-moz-max-content;height:max-content}.h-screen{height:100vh}.min-h-\[6rem\]{min-height:6rem}.min-h-full{min-height:100%}.min-h-screen{min-height:100vh}.w-1\/4{width:25%}.w-14{width:3.5rem}.w-3{width:.75rem}.w-4{width:1rem}.w-5{width:1.25rem}.w-5\/6{width:83.333333%}.w-56{width:14rem}.w-6{width:1.5rem}.w-80{width:20rem}.w-\[40rem\]{width:40rem}.w-full{width:100%}.max-w-3xl{max-width:48rem}.max-w-none{max-width:none}.max-w-sm{max-width:24rem}.flex-1{flex:1 1 0%}.flex-none{flex:none}.flex-shrink-0{flex-shrink:0}.table-auto{table-layout:auto}.origin-top-right{transform-origin:top right}.-translate-y-3{--tw-translate-y:-0.75rem}.-translate-y-3,.translate-y-0{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-0{--tw-translate-y:0px}.translate-y-4{--tw-translate-y:1rem}.transform,.translate-y-4{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes spin{to{transform:rotate(1turn)}}.animate-spin{animation:spin 1s linear infinite}.resize-y{resize:vertical}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.content-center{align-content:center}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.justify-items-center{justify-items:center}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.-space-x-px>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(-1px*(1 - var(--tw-space-x-reverse)));margin-right:calc(-1px*var(--tw-space-x-reverse))}.space-x-1>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(.25rem*(1 - var(--tw-space-x-reverse)));margin-right:calc(.25rem*var(--tw-space-x-reverse))}.space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(2rem*var(--tw-space-y-reverse));margin-top:calc(2rem*(1 - var(--tw-space-y-reverse)))}.divide-y>:not([hidden])~:not([hidden]){--tw-divide-y-reverse:0;border-bottom-width:calc(1px*var(--tw-divide-y-reverse));border-top-width:calc(1px*(1 - var(--tw-divide-y-reverse)))}.divide-gray-100>:not([hidden])~:not([hidden]){--tw-divide-opacity:1;border-color:rgb(243 244 246/var(--tw-divide-opacity))}.divide-zinc-100>:not([hidden])~:not([hidden]){--tw-divide-opacity:1;border-color:rgb(244 244 245/var(--tw-divide-opacity))}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-scroll{overflow:scroll}.overflow-y-auto{overflow-y:auto}.whitespace-nowrap{white-space:nowrap}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:1rem}.rounded-lg{border-radius:.5rem}.rounded-md{border-radius:.375rem}.rounded-l-md{border-bottom-left-radius:.375rem;border-top-left-radius:.375rem}.rounded-r-md{border-bottom-right-radius:.375rem;border-top-right-radius:.375rem}.rounded-t{border-top-left-radius:.25rem;border-top-right-radius:.25rem}.rounded-t-lg{border-top-left-radius:.5rem;border-top-right-radius:.5rem}.border{border-width:1px}.border-b-2{border-bottom-width:2px}.border-t{border-top-width:1px}.border-gray-200{--tw-border-opacity:1;border-color:rgb(229 231 235/var(--tw-border-opacity))}.border-gray-300{--tw-border-opacity:1;border-color:rgb(209 213 219/var(--tw-border-opacity))}.border-gray-600{--tw-border-opacity:1;border-color:rgb(75 85 99/var(--tw-border-opacity))}.border-rose-400{--tw-border-opacity:1;border-color:rgb(251 113 133/var(--tw-border-opacity))}.border-transparent{border-color:#0000}.border-zinc-200{--tw-border-opacity:1;border-color:rgb(228 228 231/var(--tw-border-opacity))}.border-zinc-300{--tw-border-opacity:1;border-color:rgb(212 212 216/var(--tw-border-opacity))}.bg-emerald-50{--tw-bg-opacity:1;background-color:rgb(236 253 245/var(--tw-bg-opacity))}.bg-gray-200{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity))}.bg-gray-300{--tw-bg-opacity:1;background-color:rgb(209 213 219/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-indigo-600{--tw-bg-opacity:1;background-color:rgb(79 70 229/var(--tw-bg-opacity))}.bg-rose-50{--tw-bg-opacity:1;background-color:rgb(255 241 242/var(--tw-bg-opacity))}.bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}.bg-zinc-50\/90{background-color:#fafafae6}.bg-zinc-900{--tw-bg-opacity:1;background-color:rgb(24 24 27/var(--tw-bg-opacity))}.fill-cyan-900{fill:#164e63}.fill-rose-900{fill:#881337}.p-0{padding:0}.p-14{padding:3.5rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.py-1{padding-bottom:.25rem;padding-top:.25rem}.py-2{padding-bottom:.5rem;padding-top:.5rem}.py-3{padding-bottom:.75rem;padding-top:.75rem}.py-4{padding-bottom:1rem;padding-top:1rem}.py-5{padding-bottom:1.25rem;padding-top:1.25rem}.py-8{padding-bottom:2rem;padding-top:2rem}.pb-20{padding-bottom:5rem}.pb-3{padding-bottom:.75rem}.pb-4{padding-bottom:1rem}.pl-2{padding-left:.5rem}.pl-4{padding-left:1rem}.pr-2{padding-right:.5rem}.pr-4{padding-right:1rem}.pr-6{padding-right:1.5rem}.pt-2{padding-top:.5rem}.pt-4{padding-top:1rem}.text-left{text-align:left}.text-right{text-align:right}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xs{font-size:.75rem;line-height:1rem}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.capitalize{text-transform:capitalize}.italic{font-style:italic}.leading-5{line-height:1.25rem}.leading-6{line-height:1.5rem}.leading-8{line-height:2rem}.text-black{--tw-text-opacity:1;color:rgb(0 0 0/var(--tw-text-opacity))}.text-emerald-800{--tw-text-opacity:1;color:rgb(6 95 70/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-600{--tw-text-opacity:1;color:rgb(75 85 99/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-red-500{--tw-text-opacity:1;color:rgb(239 68 68/var(--tw-text-opacity))}.text-rose-600{--tw-text-opacity:1;color:rgb(225 29 72/var(--tw-text-opacity))}.text-rose-900{--tw-text-opacity:1;color:rgb(136 19 55/var(--tw-text-opacity))}.text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}.text-zinc-500{--tw-text-opacity:1;color:rgb(113 113 122/var(--tw-text-opacity))}.text-zinc-600{--tw-text-opacity:1;color:rgb(82 82 91/var(--tw-text-opacity))}.text-zinc-700{--tw-text-opacity:1;color:rgb(63 63 70/var(--tw-text-opacity))}.text-zinc-800{--tw-text-opacity:1;color:rgb(39 39 42/var(--tw-text-opacity))}.text-zinc-900{--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity))}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-20{opacity:.2}.opacity-40{opacity:.4}.shadow-lg{--tw-shadow:0 10px 15px -3px #0000001a,0 4px 6px -4px #0000001a;--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color)}.shadow-lg,.shadow-md{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px #0000001a,0 2px 4px -2px #0000001a;--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color),0 2px 4px -2px var(--tw-shadow-color)}.shadow-sm{--tw-shadow:0 1px 2px 0 #0000000d;--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.shadow-zinc-700\/10{--tw-shadow-color:#3f3f461a;--tw-shadow:var(--tw-shadow-colored)}.outline{outline-style:solid}.ring-1{--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,0 0 #0000)}.ring-black{--tw-ring-opacity:1;--tw-ring-color:rgb(0 0 0/var(--tw-ring-opacity))}.ring-emerald-500{--tw-ring-opacity:1;--tw-ring-color:rgb(16 185 129/var(--tw-ring-opacity))}.ring-rose-500{--tw-ring-opacity:1;--tw-ring-color:rgb(244 63 94/var(--tw-ring-opacity))}.ring-zinc-700\/10{--tw-ring-color:#3f3f461a}.ring-opacity-5{--tw-ring-opacity:0.05}.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)}.transition{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-all{transition-duration:.15s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1)}.duration-150,.transition-opacity{transition-duration:.15s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.ease-in{transition-timing-function:cubic-bezier(.4,0,1,1)}.ease-out{transition-timing-function:cubic-bezier(0,0,.2,1)}.hover\:cursor-pointer:hover{cursor:pointer}.hover\:bg-gray-100:hover{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity))}.hover\:bg-gray-200:hover{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity))}.hover\:bg-gray-300:hover{--tw-bg-opacity:1;background-color:rgb(209 213 219/var(--tw-bg-opacity))}.hover\:bg-gray-400:hover{--tw-bg-opacity:1;background-color:rgb(156 163 175/var(--tw-bg-opacity))}.hover\:bg-gray-50:hover{--tw-bg-opacity:1;background-color:rgb(249 250 251/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-gray-900:hover{--tw-bg-opacity:1;background-color:rgb(17 24 39/var(--tw-bg-opacity))}.hover\:bg-indigo-700:hover{--tw-bg-opacity:1;background-color:rgb(67 56 202/var(--tw-bg-opacity))}.hover\:bg-zinc-50:hover{--tw-bg-opacity:1;background-color:rgb(250 250 250/var(--tw-bg-opacity))}.hover\:bg-zinc-700:hover{--tw-bg-opacity:1;background-color:rgb(63 63 70/var(--tw-bg-opacity))}.hover\:text-blue-400:hover{--tw-text-opacity:1;color:rgb(96 165 250/var(--tw-text-opacity))}.hover\:text-gray-500:hover{--tw-text-opacity:1;color:rgb(107 114 128/var(--tw-text-opacity))}.hover\:text-gray-900:hover{--tw-text-opacity:1;color:rgb(17 24 39/var(--tw-text-opacity))}.hover\:text-white:hover{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}.hover\:text-zinc-700:hover{--tw-text-opacity:1;color:rgb(63 63 70/var(--tw-text-opacity))}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-40:hover{opacity:.4}.focus\:border-indigo-500:focus{--tw-border-opacity:1;border-color:rgb(99 102 241/var(--tw-border-opacity))}.focus\:border-rose-400:focus{--tw-border-opacity:1;border-color:rgb(251 113 133/var(--tw-border-opacity))}.focus\:border-zinc-400:focus{--tw-border-opacity:1;border-color:rgb(161 161 170/var(--tw-border-opacity))}.focus\:bg-gray-700:focus{--tw-bg-opacity:1;background-color:rgb(55 65 81/var(--tw-bg-opacity))}.focus\:text-white:focus{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}.focus\:outline-none:focus{outline:2px solid #0000;outline-offset:2px}.focus\:ring-0: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(var(--tw-ring-offset-width)) var(--tw-ring-color)}.focus\:ring-0:focus,.focus\:ring-2:focus{box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.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)}.focus\:ring-indigo-500:focus{--tw-ring-opacity:1;--tw-ring-color:rgb(99 102 241/var(--tw-ring-opacity))}.focus\:ring-offset-2:focus{--tw-ring-offset-width:2px}.focus\:ring-offset-gray-100:focus{--tw-ring-offset-color:#f3f4f6}.active\:text-white\/80:active{color:#fffc}.group:hover .group-hover\:bg-zinc-50{--tw-bg-opacity:1;background-color:rgb(250 250 250/var(--tw-bg-opacity))}.group:hover .group-hover\:opacity-70{opacity:.7}.phx-no-feedback.phx-no-feedback\:hidden{display:none}.phx-no-feedback.phx-no-feedback\:border-zinc-300{--tw-border-opacity:1;border-color:rgb(212 212 216/var(--tw-border-opacity))}.phx-no-feedback.phx-no-feedback\:focus\:border-zinc-400:focus{--tw-border-opacity:1;border-color:rgb(161 161 170/var(--tw-border-opacity))}.phx-no-feedback .phx-no-feedback\:hidden{display:none}.phx-no-feedback .phx-no-feedback\:border-zinc-300{--tw-border-opacity:1;border-color:rgb(212 212 216/var(--tw-border-opacity))}.phx-no-feedback .phx-no-feedback\:focus\:border-zinc-400:focus{--tw-border-opacity:1;border-color:rgb(161 161 170/var(--tw-border-opacity))}.phx-submit-loading .phx-submit-loading\:opacity-75,.phx-submit-loading.phx-submit-loading\:opacity-75{opacity:.75}@media (min-width:640px){.sm\:col-span-2{grid-column:span 2/span 2}.sm\:col-span-3{grid-column:span 3/span 3}.sm\:col-span-full{grid-column:1/-1}.sm\:mt-0{margin-top:0}.sm\:block{display:block}.sm\:flex{display:flex}.sm\:hidden{display:none}.sm\:w-96{width:24rem}.sm\:w-full{width:100%}.sm\:flex-1{flex:1 1 0%}.sm\:translate-y-0{--tw-translate-y:0px}.sm\:scale-100,.sm\:translate-y-0{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.sm\:scale-100{--tw-scale-x:1;--tw-scale-y:1}.sm\:scale-95{--tw-scale-x:.95;--tw-scale-y:.95;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.sm\:items-center{align-items:center}.sm\:justify-between{justify-content:space-between}.sm\:gap-8{gap:2rem}.sm\:overflow-visible{overflow:visible}.sm\:rounded-md{border-radius:.375rem}.sm\:rounded-l-xl{border-bottom-left-radius:.75rem;border-top-left-radius:.75rem}.sm\:rounded-r-xl{border-bottom-right-radius:.75rem;border-top-right-radius:.75rem}.sm\:p-6{padding:1.5rem}.sm\:px-0{padding-left:0;padding-right:0}.sm\:px-3{padding-left:.75rem;padding-right:.75rem}.sm\:px-6{padding-left:1.5rem;padding-right:1.5rem}.sm\:text-sm{font-size:.875rem;line-height:1.25rem}.sm\:leading-6{line-height:1.5rem}}@media (min-width:768px){.md\:col-span-2{grid-column:span 2/span 2}.md\:mx-16{margin-left:4rem;margin-right:4rem}.md\:mx-4{margin-left:1rem;margin-right:1rem}.md\:mt-0{margin-top:0}.md\:mt-10{margin-top:2.5rem}.md\:block{display:block}.md\:grid{display:grid}.md\:hidden{display:none}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:gap-6{gap:1.5rem}.md\:pt-10{padding-top:2.5rem}}@media (min-width:1024px){.lg\:px-8{padding-left:2rem;padding-right:2rem}.lg\:py-8{padding-bottom:2rem;padding-top:2rem}}
\ No newline at end of file
diff --git a/priv/static/assets/app-161d914bba3ef8912bae46d62332075a.css.gz b/priv/static/assets/app-161d914bba3ef8912bae46d62332075a.css.gz
new file mode 100644
index 0000000..3e30294
Binary files /dev/null and b/priv/static/assets/app-161d914bba3ef8912bae46d62332075a.css.gz differ
diff --git a/priv/static/assets/app-c9fc8078e7bd6db471c3dfa3fcebe839.js b/priv/static/assets/app-c9fc8078e7bd6db471c3dfa3fcebe839.js
new file mode 100644
index 0000000..0ffdc33
--- /dev/null
+++ b/priv/static/assets/app-c9fc8078e7bd6db471c3dfa3fcebe839.js
@@ -0,0 +1,23 @@
+(()=>{var Jt=Object.create;var Oe=Object.defineProperty;var Vt=Object.getOwnPropertyDescriptor;var Xt=Object.getOwnPropertyNames,nt=Object.getOwnPropertySymbols,zt=Object.getPrototypeOf,rt=Object.prototype.hasOwnProperty,Wt=Object.prototype.propertyIsEnumerable;var st=(e,t,i)=>t in e?Oe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,te=(e,t)=>{for(var i in t||(t={}))rt.call(t,i)&&st(e,i,t[i]);if(nt)for(var i of nt(t))Wt.call(t,i)&&st(e,i,t[i]);return e};var qt=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Kt=(e,t,i,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Xt(t))!rt.call(e,s)&&s!==i&&Oe(e,s,{get:()=>t[s],enumerable:!(n=Vt(t,s))||n.enumerable});return e};var Gt=(e,t,i)=>(i=e!=null?Jt(zt(e)):{},Kt(t||!e||!e.__esModule?Oe(i,"default",{value:e,enumerable:!0}):i,e));var dt=qt((lt,Se)=>{(function(e,t){"use strict";(function(){for(var u=0,m=["ms","moz","webkit","o"],g=0;gv.show(),u)}else s=!0,o!==null&&e.cancelAnimationFrame(o),i||p(),i.style.opacity=1,i.style.display="block",v.progress(0),d.autoRun&&function m(){r=e.requestAnimationFrame(m),v.progress("+"+.05*Math.pow(1-Math.sqrt(n),2))}()},progress:function(u){return typeof u=="undefined"||(typeof u=="string"&&(u=(u.indexOf("+")>=0||u.indexOf("-")>=0?n:0)+parseFloat(u)),n=u>1?1:u,f()),n},hide:function(){clearTimeout(a),a=null,s&&(s=!1,r!=null&&(e.cancelAnimationFrame(r),r=null),function u(){if(v.progress("+.1")>=1&&(i.style.opacity-=.05,i.style.opacity<=.05)){i.style.display="none",o=null;return}o=e.requestAnimationFrame(u)}())}};typeof Se=="object"&&typeof Se.exports=="object"?Se.exports=v:typeof define=="function"&&define.amd?define(function(){return v}):this.topbar=v}).call(lt,window,document)});(function(){var e=t();function t(){if(typeof window.CustomEvent=="function")return window.CustomEvent;function s(r,o){o=o||{bubbles:!1,cancelable:!1,detail:void 0};var a=document.createEvent("CustomEvent");return a.initCustomEvent(r,o.bubbles,o.cancelable,o.detail),a}return s.prototype=window.Event.prototype,s}function i(s,r){var o=document.createElement("input");return o.type="hidden",o.name=s,o.value=r,o}function n(s,r){var o=s.getAttribute("data-to"),a=i("_method",s.getAttribute("data-method")),h=i("_csrf_token",s.getAttribute("data-csrf")),d=document.createElement("form"),f=s.getAttribute("target");d.method=s.getAttribute("data-method")==="get"?"get":"post",d.action=o,d.style.display="hidden",f?d.target=f:r&&(d.target="_blank"),d.appendChild(h),d.appendChild(a),document.body.appendChild(d),d.submit()}window.addEventListener("click",function(s){var r=s.target;if(!s.defaultPrevented)for(;r&&r.getAttribute;){var o=new e("phoenix.link.click",{bubbles:!0,cancelable:!0});if(!r.dispatchEvent(o))return s.preventDefault(),s.stopImmediatePropagation(),!1;if(r.getAttribute("data-method"))return n(r,s.metaKey||s.shiftKey),s.preventDefault(),!1;r=r.parentNode}},!1),window.addEventListener("phoenix.link.click",function(s){var r=s.target.getAttribute("data-confirm");r&&!window.confirm(r)&&s.preventDefault()},!1)})();var ne=e=>typeof e=="function"?e:function(){return e},Yt=typeof self!="undefined"?self:null,ie=typeof window!="undefined"?window:null,ke=Yt||ie||void 0,Qt="2.0.0",N={connecting:0,open:1,closing:2,closed:3},Zt=1e4,ei=1e3,P={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},$={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave"},Ne={longpoll:"longpoll",websocket:"websocket"},ti={complete:4},be=class{constructor(e,t,i,n){this.channel=e,this.event=t,this.payload=i||function(){return{}},this.receivedResp=null,this.timeout=n,this.timeoutTimer=null,this.recHooks=[],this.sent=!1}resend(e){this.timeout=e,this.reset(),this.send()}send(){this.hasReceived("timeout")||(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(e,t){return this.hasReceived(e)&&t(this.receivedResp.response),this.recHooks.push({status:e,callback:t}),this}reset(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=!1}matchReceive({status:e,response:t,_ref:i}){this.recHooks.filter(n=>n.status===e).forEach(n=>n.callback(t))}cancelRefEvent(){this.refEvent&&this.channel.off(this.refEvent)}cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=null}startTimeout(){this.timeoutTimer&&this.cancelTimeout(),this.ref=this.channel.socket.makeRef(),this.refEvent=this.channel.replyEventName(this.ref),this.channel.on(this.refEvent,e=>{this.cancelRefEvent(),this.cancelTimeout(),this.receivedResp=e,this.matchReceive(e)}),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}trigger(e,t){this.channel.trigger(this.refEvent,{status:e,response:t})}},at=class{constructor(e,t){this.callback=e,this.timerCalc=t,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))}},ii=class{constructor(e,t,i){this.state=P.closed,this.topic=e,this.params=ne(t||{}),this.socket=i,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new be(this,$.join,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new at(()=>{this.socket.isConnected()&&this.rejoin()},this.socket.rejoinAfterMs),this.stateChangeRefs.push(this.socket.onError(()=>this.rejoinTimer.reset())),this.stateChangeRefs.push(this.socket.onOpen(()=>{this.rejoinTimer.reset(),this.isErrored()&&this.rejoin()})),this.joinPush.receive("ok",()=>{this.state=P.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(n=>n.send()),this.pushBuffer=[]}),this.joinPush.receive("error",()=>{this.state=P.errored,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.onClose(()=>{this.rejoinTimer.reset(),this.socket.hasLogger()&&this.socket.log("channel",`close ${this.topic} ${this.joinRef()}`),this.state=P.closed,this.socket.remove(this)}),this.onError(n=>{this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,n),this.isJoining()&&this.joinPush.reset(),this.state=P.errored,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.joinPush.receive("timeout",()=>{this.socket.hasLogger()&&this.socket.log("channel",`timeout ${this.topic} (${this.joinRef()})`,this.joinPush.timeout),new be(this,$.leave,ne({}),this.timeout).send(),this.state=P.errored,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on($.reply,(n,s)=>{this.trigger(this.replyEventName(s),n)})}join(e=this.timeout){if(this.joinedOnce)throw new Error("tried to join multiple times. 'join' can only be called a single time per channel instance");return this.timeout=e,this.joinedOnce=!0,this.rejoin(),this.joinPush}onClose(e){this.on($.close,e)}onError(e){return this.on($.error,t=>e(t))}on(e,t){let i=this.bindingRef++;return this.bindings.push({event:e,ref:i,callback:t}),i}off(e,t){this.bindings=this.bindings.filter(i=>!(i.event===e&&(typeof t=="undefined"||t===i.ref)))}canPush(){return this.socket.isConnected()&&this.isJoined()}push(e,t,i=this.timeout){if(t=t||{},!this.joinedOnce)throw new Error(`tried to push '${e}' to '${this.topic}' before joining. Use channel.join() before pushing events`);let n=new be(this,e,function(){return t},i);return this.canPush()?n.send():(n.startTimeout(),this.pushBuffer.push(n)),n}leave(e=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=P.leaving;let t=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger($.close,"leave")},i=new be(this,$.leave,ne({}),e);return i.receive("ok",()=>t()).receive("timeout",()=>t()),i.send(),this.canPush()||i.trigger("ok",{}),i}onMessage(e,t,i){return t}isMember(e,t,i,n){return this.topic!==e?!1:n&&n!==this.joinRef()?(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:e,event:t,payload:i,joinRef:n}),!1):!0}joinRef(){return this.joinPush.ref}rejoin(e=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=P.joining,this.joinPush.resend(e))}trigger(e,t,i,n){let s=this.onMessage(e,t,i,n);if(t&&!s)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");let r=this.bindings.filter(o=>o.event===e);for(let o=0;o{let a=this.parseJSON(e.responseText);o&&o(a)},r&&(e.ontimeout=r),e.onprogress=()=>{},e.send(n)}static xhrRequest(e,t,i,n,s,r,o,a){e.open(t,i,!0),e.timeout=r,e.setRequestHeader("Content-Type",n),e.onerror=()=>{a&&a(null)},e.onreadystatechange=()=>{if(e.readyState===ti.complete&&a){let h=this.parseJSON(e.responseText);a(h)}},o&&(e.ontimeout=o),e.send(s)}static parseJSON(e){if(!e||e==="")return null;try{return JSON.parse(e)}catch(t){return console&&console.log("failed to parse JSON response",e),null}}static serialize(e,t){let i=[];for(var n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;let s=t?`${t}[${n}]`:n,r=e[n];typeof r=="object"?i.push(this.serialize(r,s)):i.push(encodeURIComponent(s)+"="+encodeURIComponent(r))}return i.join("&")}static appendParams(e,t){if(Object.keys(t).length===0)return e;let i=e.match(/\?/)?"&":"?";return`${e}${i}${this.serialize(t)}`}},ot=class{constructor(e){this.endPoint=null,this.token=null,this.skipHeartbeat=!0,this.onopen=function(){},this.onerror=function(){},this.onmessage=function(){},this.onclose=function(){},this.pollEndpoint=this.normalizeEndpoint(e),this.readyState=N.connecting,this.poll()}normalizeEndpoint(e){return e.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+Ne.websocket),"$1/"+Ne.longpoll)}endpointURL(){return se.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(){this.close(),this.readyState=N.connecting}ontimeout(){this.onerror("timeout"),this.closeAndRetry()}poll(){(this.readyState===N.open||this.readyState===N.connecting)&&se.request("GET",this.endpointURL(),"application/json",null,this.timeout,this.ontimeout.bind(this),e=>{if(e){var{status:t,token:i,messages:n}=e;this.token=i}else t=0;switch(t){case 200:n.forEach(s=>{setTimeout(()=>{this.onmessage({data:s})},0)}),this.poll();break;case 204:this.poll();break;case 410:this.readyState=N.open,this.onopen(),this.poll();break;case 403:this.onerror(),this.close();break;case 0:case 500:this.onerror(),this.closeAndRetry();break;default:throw new Error(`unhandled poll status ${t}`)}})}send(e){se.request("POST",this.endpointURL(),"application/json",e,this.timeout,this.onerror.bind(this,"timeout"),t=>{(!t||t.status!==200)&&(this.onerror(t&&t.status),this.closeAndRetry())})}close(e,t){this.readyState=N.closed,this.onclose()}};var ye={HEADER_LENGTH:1,META_LENGTH:4,KINDS:{push:0,reply:1,broadcast:2},encode(e,t){if(e.payload.constructor===ArrayBuffer)return t(this.binaryEncode(e));{let i=[e.join_ref,e.ref,e.topic,e.event,e.payload];return t(JSON.stringify(i))}},decode(e,t){if(e.constructor===ArrayBuffer)return t(this.binaryDecode(e));{let[i,n,s,r,o]=JSON.parse(e);return t({join_ref:i,ref:n,topic:s,event:r,payload:o})}},binaryEncode(e){let{join_ref:t,ref:i,event:n,topic:s,payload:r}=e,o=this.META_LENGTH+t.length+i.length+s.length+n.length,a=new ArrayBuffer(this.HEADER_LENGTH+o),h=new DataView(a),d=0;h.setUint8(d++,this.KINDS.push),h.setUint8(d++,t.length),h.setUint8(d++,i.length),h.setUint8(d++,s.length),h.setUint8(d++,n.length),Array.from(t,p=>h.setUint8(d++,p.charCodeAt(0))),Array.from(i,p=>h.setUint8(d++,p.charCodeAt(0))),Array.from(s,p=>h.setUint8(d++,p.charCodeAt(0))),Array.from(n,p=>h.setUint8(d++,p.charCodeAt(0)));var f=new Uint8Array(a.byteLength+r.byteLength);return f.set(new Uint8Array(a),0),f.set(new Uint8Array(r),a.byteLength),f.buffer},binaryDecode(e){let t=new DataView(e),i=t.getUint8(0),n=new TextDecoder;switch(i){case this.KINDS.push:return this.decodePush(e,t,n);case this.KINDS.reply:return this.decodeReply(e,t,n);case this.KINDS.broadcast:return this.decodeBroadcast(e,t,n)}},decodePush(e,t,i){let n=t.getUint8(1),s=t.getUint8(2),r=t.getUint8(3),o=this.HEADER_LENGTH+this.META_LENGTH-1,a=i.decode(e.slice(o,o+n));o=o+n;let h=i.decode(e.slice(o,o+s));o=o+s;let d=i.decode(e.slice(o,o+r));o=o+r;let f=e.slice(o,e.byteLength);return{join_ref:a,ref:null,topic:h,event:d,payload:f}},decodeReply(e,t,i){let n=t.getUint8(1),s=t.getUint8(2),r=t.getUint8(3),o=t.getUint8(4),a=this.HEADER_LENGTH+this.META_LENGTH,h=i.decode(e.slice(a,a+n));a=a+n;let d=i.decode(e.slice(a,a+s));a=a+s;let f=i.decode(e.slice(a,a+r));a=a+r;let p=i.decode(e.slice(a,a+o));a=a+o;let v=e.slice(a,e.byteLength),u={status:p,response:v};return{join_ref:h,ref:d,topic:f,event:$.reply,payload:u}},decodeBroadcast(e,t,i){let n=t.getUint8(1),s=t.getUint8(2),r=this.HEADER_LENGTH+2,o=i.decode(e.slice(r,r+n));r=r+n;let a=i.decode(e.slice(r,r+s));r=r+s;let h=e.slice(r,e.byteLength);return{join_ref:null,ref:null,topic:o,event:a,payload:h}}},ht=class{constructor(e,t={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.timeout=t.timeout||Zt,this.transport=t.transport||ke.WebSocket||ot,this.establishedConnections=0,this.defaultEncoder=ye.encode.bind(ye),this.defaultDecoder=ye.decode.bind(ye),this.closeWasClean=!1,this.binaryType=t.binaryType||"arraybuffer",this.connectClock=1,this.transport!==ot?(this.encode=t.encode||this.defaultEncoder,this.decode=t.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let i=null;ie&&ie.addEventListener&&(ie.addEventListener("pagehide",n=>{this.conn&&(this.disconnect(),i=this.connectClock)}),ie.addEventListener("pageshow",n=>{i===this.connectClock&&(i=null,this.connect())})),this.heartbeatIntervalMs=t.heartbeatIntervalMs||3e4,this.rejoinAfterMs=n=>t.rejoinAfterMs?t.rejoinAfterMs(n):[1e3,2e3,5e3][n-1]||1e4,this.reconnectAfterMs=n=>t.reconnectAfterMs?t.reconnectAfterMs(n):[10,50,100,150,200,250,500,1e3,2e3][n-1]||5e3,this.logger=t.logger||null,this.longpollerTimeout=t.longpollerTimeout||2e4,this.params=ne(t.params||{}),this.endPoint=`${e}/${Ne.websocket}`,this.vsn=t.vsn||Qt,this.heartbeatTimer=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new at(()=>{this.teardown(()=>this.connect())},this.reconnectAfterMs)}replaceTransport(e){this.disconnect(),this.transport=e}protocol(){return location.protocol.match(/^https/)?"wss":"ws"}endPointURL(){let e=se.appendParams(se.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return e.charAt(0)!=="/"?e:e.charAt(1)==="/"?`${this.protocol()}:${e}`:`${this.protocol()}://${location.host}${e}`}disconnect(e,t,i){this.connectClock++,this.closeWasClean=!0,this.reconnectTimer.reset(),this.teardown(e,t,i)}connect(e){this.connectClock++,e&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=ne(e)),!this.conn&&(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=t=>this.onConnError(t),this.conn.onmessage=t=>this.onConnMessage(t),this.conn.onclose=t=>this.onConnClose(t))}log(e,t,i){this.logger(e,t,i)}hasLogger(){return this.logger!==null}onOpen(e){let t=this.makeRef();return this.stateChangeCallbacks.open.push([t,e]),t}onClose(e){let t=this.makeRef();return this.stateChangeCallbacks.close.push([t,e]),t}onError(e){let t=this.makeRef();return this.stateChangeCallbacks.error.push([t,e]),t}onMessage(e){let t=this.makeRef();return this.stateChangeCallbacks.message.push([t,e]),t}onConnOpen(){this.hasLogger()&&this.log("transport",`connected to ${this.endPointURL()}`),this.closeWasClean=!1,this.establishedConnections++,this.flushSendBuffer(),this.reconnectTimer.reset(),this.resetHeartbeat(),this.stateChangeCallbacks.open.forEach(([,e])=>e())}heartbeatTimeout(){this.pendingHeartbeatRef&&(this.pendingHeartbeatRef=null,this.hasLogger()&&this.log("transport","heartbeat timeout. Attempting to re-establish connection"),this.abnormalClose("heartbeat timeout"))}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,clearTimeout(this.heartbeatTimer),setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}teardown(e,t,i){if(!this.conn)return e&&e();this.waitForBufferDone(()=>{this.conn&&(t?this.conn.close(t,i||""):this.conn.close()),this.waitForSocketClosed(()=>{this.conn&&(this.conn.onclose=function(){},this.conn=null),e&&e()})})}waitForBufferDone(e,t=1){if(t===5||!this.conn||!this.conn.bufferedAmount){e();return}setTimeout(()=>{this.waitForBufferDone(e,t+1)},150*t)}waitForSocketClosed(e,t=1){if(t===5||!this.conn||this.conn.readyState===N.closed){e();return}setTimeout(()=>{this.waitForSocketClosed(e,t+1)},150*t)}onConnClose(e){let t=e&&e.code;this.hasLogger()&&this.log("transport","close",e),this.triggerChanError(),clearTimeout(this.heartbeatTimer),!this.closeWasClean&&t!==1e3&&this.reconnectTimer.scheduleTimeout(),this.stateChangeCallbacks.close.forEach(([,i])=>i(e))}onConnError(e){this.hasLogger()&&this.log("transport",e);let t=this.transport,i=this.establishedConnections;this.stateChangeCallbacks.error.forEach(([,n])=>{n(e,t,i)}),(t===this.transport||i>0)&&this.triggerChanError()}triggerChanError(){this.channels.forEach(e=>{e.isErrored()||e.isLeaving()||e.isClosed()||e.trigger($.error)})}connectionState(){switch(this.conn&&this.conn.readyState){case N.connecting:return"connecting";case N.open:return"open";case N.closing:return"closing";default:return"closed"}}isConnected(){return this.connectionState()==="open"}remove(e){this.off(e.stateChangeRefs),this.channels=this.channels.filter(t=>t.joinRef()!==e.joinRef())}off(e){for(let t in this.stateChangeCallbacks)this.stateChangeCallbacks[t]=this.stateChangeCallbacks[t].filter(([i])=>e.indexOf(i)===-1)}channel(e,t={}){let i=new ii(e,t,this);return this.channels.push(i),i}push(e){if(this.hasLogger()){let{topic:t,event:i,payload:n,ref:s,join_ref:r}=e;this.log("push",`${t} ${i} (${r}, ${s})`,n)}this.isConnected()?this.encode(e,t=>this.conn.send(t)):this.sendBuffer.push(()=>this.encode(e,t=>this.conn.send(t)))}makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}sendHeartbeat(){this.pendingHeartbeatRef&&!this.isConnected()||(this.pendingHeartbeatRef=this.makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef}),this.heartbeatTimer=setTimeout(()=>this.heartbeatTimeout(),this.heartbeatIntervalMs))}abnormalClose(e){this.closeWasClean=!1,this.isConnected()&&this.conn.close(ei,e)}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}onConnMessage(e){this.decode(e.data,t=>{let{topic:i,event:n,payload:s,ref:r,join_ref:o}=t;r&&r===this.pendingHeartbeatRef&&(clearTimeout(this.heartbeatTimer),this.pendingHeartbeatRef=null,setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs)),this.hasLogger()&&this.log("receive",`${s.status||""} ${i} ${n} ${r&&"("+r+")"||""}`,s);for(let a=0;ai.topic===e&&(i.isJoined()||i.isJoining()));t&&(this.hasLogger()&&this.log("transport",`leaving duplicate topic "${e}"`),t.leave())}};var Le=Gt(dt());var xt="consecutive-reloads",ni=10,si=1e3,ri=3e3,oi=3e4,It=["phx-click-loading","phx-change-loading","phx-submit-loading","phx-keydown-loading","phx-keyup-loading","phx-blur-loading","phx-focus-loading"],L="data-phx-component",He="data-phx-link",ai="track-static",hi="data-phx-link-state",j="data-phx-ref",G="data-phx-ref-src",Dt="track-uploads",Y="data-phx-upload-ref",Qe="data-phx-preflighted-refs",li="data-phx-done-refs",ct="drop-target",ze="data-phx-active-refs",We="phx:live-file:updated",qe="data-phx-skip",ut="data-phx-prune",ft="page-loading",pt="phx-connected",Me="phx-loading",gt="phx-no-feedback",mt="phx-error",Z="data-phx-parent-id",Ze="data-phx-main",ce="data-phx-root-id",di="trigger-action",Ke="feedback-for",Ot="phx-has-focused",ci=["text","textarea","number","email","password","search","tel","url","date","time","datetime-local","color","range"],Nt=["checkbox","radio"],Ht="phx-has-submitted",W="data-phx-session",ee=`[${W}]`,vt="data-phx-sticky",le="data-phx-static",Ue="data-phx-readonly",Ae="data-phx-disabled",Ge="disable-with",Ee="data-phx-disable-with-restore",we="hook",ui="debounce",fi="throttle",Ye="update",pi="key",H="phxPrivate",bt="auto-recover",je="phx:live-socket:debug",$e="phx:live-socket:profiling",Fe="phx:live-socket:latency-sim",gi="progress",mi=1,vi=200,bi="phx-",yi=3e4,re="debounce-trigger",Ce="throttled",yt="debounce-prev-key",ki={debounce:300,throttle:300},kt="d",M="s",R="c",St="e",At="r",Et="t",Si="p",Ai=class{constructor(e,t,i){this.liveSocket=i,this.entry=e,this.offset=0,this.chunkSize=t,this.chunkTimer=null,this.uploadChannel=i.channel(`lvu:${e.ref}`,{token:e.metadata()})}error(e){clearTimeout(this.chunkTimer),this.uploadChannel.leave(),this.entry.error(e)}upload(){this.uploadChannel.onError(e=>this.error(e)),this.uploadChannel.join().receive("ok",e=>this.readNextChunk()).receive("error",e=>this.error(e))}isDone(){return this.offset>=this.entry.file.size}readNextChunk(){let e=new window.FileReader,t=this.entry.file.slice(this.offset,this.chunkSize+this.offset);e.onload=i=>{if(i.target.error===null)this.offset+=i.target.result.byteLength,this.pushChunk(i.target.result);else return _("Read error: "+i.target.error)},e.readAsArrayBuffer(t)}pushChunk(e){this.uploadChannel.isJoined()&&this.uploadChannel.push("chunk",e).receive("ok",()=>{this.entry.progress(this.offset/this.entry.file.size*100),this.isDone()||(this.chunkTimer=setTimeout(()=>this.readNextChunk(),this.liveSocket.getLatencySim()||0))})}},_=(e,t)=>console.error&&console.error(e,t),z=e=>{let t=typeof e;return t==="number"||t==="string"&&/^(0|[1-9]\d*)$/.test(e)};function Ei(){let e=new Set,t=document.querySelectorAll("*[id]");for(let i=0,n=t.length;i{e.liveSocket.isDebugEnabled()&&console.log(`${e.id} ${t}: ${i} - `,n)},Be=e=>typeof e=="function"?e:function(){return e},Re=e=>JSON.parse(JSON.stringify(e)),de=(e,t,i)=>{do{if(e.matches(`[${t}]`))return e;e=e.parentElement||e.parentNode}while(e!==null&&e.nodeType===1&&!(i&&i.isSameNode(e)||e.matches(ee)));return null},oe=e=>e!==null&&typeof e=="object"&&!(e instanceof Array),Ci=(e,t)=>JSON.stringify(e)===JSON.stringify(t),wt=e=>{for(let t in e)return!1;return!0},F=(e,t)=>e&&t(e),_i=function(e,t,i,n){e.forEach(s=>{new Ai(s,i.config.chunk_size,n).upload()})},Mt={canPushState(){return typeof history.pushState!="undefined"},dropLocal(e,t,i){return e.removeItem(this.localKey(t,i))},updateLocal(e,t,i,n,s){let r=this.getLocal(e,t,i),o=this.localKey(t,i),a=r===null?n:s(r);return e.setItem(o,JSON.stringify(a)),a},getLocal(e,t,i){return JSON.parse(e.getItem(this.localKey(t,i)))},updateCurrentState(e){this.canPushState()&&history.replaceState(e(history.state||{}),"",window.location.href)},pushState(e,t,i){if(this.canPushState()){if(i!==window.location.href){if(t.type=="redirect"&&t.scroll){let s=history.state||{};s.scroll=t.scroll,history.replaceState(s,"",window.location.href)}delete t.scroll,history[e+"State"](t,"",i||null);let n=this.getHashTargetEl(window.location.hash);n?n.scrollIntoView():t.type==="redirect"&&window.scroll(0,0)}}else this.redirect(i)},setCookie(e,t){document.cookie=`${e}=${t}`},getCookie(e){return document.cookie.replace(new RegExp(`(?:(?:^|.*;s*)${e}s*=s*([^;]*).*$)|^.*$`),"$1")},redirect(e,t){t&&Mt.setCookie("__phoenix_flash__",t+"; max-age=60000; path=/"),window.location=e},localKey(e,t){return`${e}-${t}`},getHashTargetEl(e){let t=e.toString().substring(1);if(t!=="")return document.getElementById(t)||document.querySelector(`a[name="${t}"]`)}},X=Mt,O={byId(e){return document.getElementById(e)||_(`no id found for ${e}`)},removeClass(e,t){e.classList.remove(t),e.classList.length===0&&e.removeAttribute("class")},all(e,t,i){if(!e)return[];let n=Array.from(e.querySelectorAll(t));return i?n.forEach(i):n},childNodeLength(e){let t=document.createElement("template");return t.innerHTML=e,t.content.childElementCount},isUploadInput(e){return e.type==="file"&&e.getAttribute(Y)!==null},findUploadInputs(e){return this.all(e,`input[type="file"][${Y}]`)},findComponentNodeList(e,t){return this.filterWithinSameLiveView(this.all(e,`[${L}="${t}"]`),e)},isPhxDestroyed(e){return!!(e.id&&O.private(e,"destroyed"))},markPhxChildDestroyed(e){this.isPhxChild(e)&&e.setAttribute(W,""),this.putPrivate(e,"destroyed",!0)},findPhxChildrenInFragment(e,t){let i=document.createElement("template");return i.innerHTML=e,this.findPhxChildren(i.content,t)},isIgnored(e,t){return(e.getAttribute(t)||e.getAttribute("data-phx-update"))==="ignore"},isPhxUpdate(e,t,i){return e.getAttribute&&i.indexOf(e.getAttribute(t))>=0},findPhxSticky(e){return this.all(e,`[${vt}]`)},findPhxChildren(e,t){return this.all(e,`${ee}[${Z}="${t}"]`)},findParentCIDs(e,t){let i=new Set(t);return t.reduce((n,s)=>{let r=`[${L}="${s}"] [${L}]`;return this.filterWithinSameLiveView(this.all(e,r),e).map(o=>parseInt(o.getAttribute(L))).forEach(o=>n.delete(o)),n},i)},filterWithinSameLiveView(e,t){return t.querySelector(ee)?e.filter(i=>this.withinSameLiveView(i,t)):e},withinSameLiveView(e,t){for(;e=e.parentNode;){if(e.isSameNode(t))return!0;if(e.getAttribute(W)!==null)return!1}},private(e,t){return e[H]&&e[H][t]},deletePrivate(e,t){e[H]&&delete e[H][t]},putPrivate(e,t,i){e[H]||(e[H]={}),e[H][t]=i},updatePrivate(e,t,i,n){let s=this.private(e,t);s===void 0?this.putPrivate(e,t,n(i)):this.putPrivate(e,t,n(s))},copyPrivates(e,t){t[H]&&(e[H]=t[H])},putTitle(e){let t=document.querySelector("title"),{prefix:i,suffix:n}=t.dataset;document.title=`${i||""}${e}${n||""}`},debounce(e,t,i,n,s,r,o){let a=e.getAttribute(i),h=e.getAttribute(s);a===""&&(a=n),h===""&&(h=r);let d=a||h;switch(d){case null:return o();case"blur":this.once(e,"debounce-blur")&&e.addEventListener("blur",()=>o());return;default:let f=parseInt(d),p=()=>h?this.deletePrivate(e,Ce):o(),v=this.incCycle(e,re,p);if(isNaN(f))return _(`invalid throttle/debounce value: ${d}`);if(h){let m=!1;if(t.type==="keydown"){let g=this.private(e,yt);this.putPrivate(e,yt,t.key),m=g!==t.key}if(!m&&this.private(e,Ce))return!1;o(),this.putPrivate(e,Ce,!0),setTimeout(()=>this.triggerCycle(e,re),f)}else setTimeout(()=>this.triggerCycle(e,re,v),f);let u=e.form;u&&this.once(u,"bind-debounce")&&u.addEventListener("submit",()=>{Array.from(new FormData(u).entries(),([m])=>{let g=u.querySelector(`[name="${m}"]`);this.incCycle(g,re),this.deletePrivate(g,Ce)})}),this.once(e,"bind-debounce")&&e.addEventListener("blur",()=>this.triggerCycle(e,re))}},triggerCycle(e,t,i){let[n,s]=this.private(e,t);i||(i=n),i===n&&(this.incCycle(e,t),s())},once(e,t){return this.private(e,t)===!0?!1:(this.putPrivate(e,t,!0),!0)},incCycle(e,t,i=function(){}){let[n]=this.private(e,t)||[0,i];return n++,this.putPrivate(e,t,[n,i]),n},discardError(e,t,i){let n=t.getAttribute&&t.getAttribute(i),s=n&&e.querySelector(`[id="${n}"], [name="${n}"]`);s&&(this.private(s,Ot)||this.private(s.form,Ht)||t.classList.add(gt))},showError(e,t){(e.id||e.name)&&this.all(e.form,`[${t}="${e.id}"], [${t}="${e.name}"]`,i=>{this.removeClass(i,gt)})},isPhxChild(e){return e.getAttribute&&e.getAttribute(Z)},isPhxSticky(e){return e.getAttribute&&e.getAttribute(vt)!==null},firstPhxChild(e){return this.isPhxChild(e)?e:this.all(e,`[${Z}]`)[0]},dispatchEvent(e,t,i={}){let n=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:i});e.dispatchEvent(n)},cloneNode(e,t){if(typeof t=="undefined")return e.cloneNode(!0);{let i=e.cloneNode(!1);return i.innerHTML=t,i}},mergeAttrs(e,t,i={}){let n=i.exclude||[],s=i.isIgnored,r=t.attributes;for(let a=r.length-1;a>=0;a--){let h=r[a].name;n.indexOf(h)<0&&e.setAttribute(h,t.getAttribute(h))}let o=e.attributes;for(let a=o.length-1;a>=0;a--){let h=o[a].name;s?h.startsWith("data-")&&!t.hasAttribute(h)&&e.removeAttribute(h):t.hasAttribute(h)||e.removeAttribute(h)}},mergeFocusedInput(e,t){e instanceof HTMLSelectElement||O.mergeAttrs(e,t,{except:["value"]}),t.readOnly?e.setAttribute("readonly",!0):e.removeAttribute("readonly")},hasSelectionRange(e){return e.setSelectionRange&&(e.type==="text"||e.type==="textarea")},restoreFocus(e,t,i){if(!O.isTextualInput(e))return;let n=e.matches(":focus");e.readOnly&&e.blur(),n||e.focus(),this.hasSelectionRange(e)&&e.setSelectionRange(t,i)},isFormInput(e){return/^(?:input|select|textarea)$/i.test(e.tagName)&&e.type!=="button"},syncAttrsToProps(e){e instanceof HTMLInputElement&&Nt.indexOf(e.type.toLocaleLowerCase())>=0&&(e.checked=e.getAttribute("checked")!==null)},isTextualInput(e){return ci.indexOf(e.type)>=0},isNowTriggerFormExternal(e,t){return e.getAttribute&&e.getAttribute(t)!==null},syncPendingRef(e,t,i){let n=e.getAttribute(j);if(n===null)return!0;let s=e.getAttribute(G);return O.isFormInput(e)||e.getAttribute(i)!==null?(O.isUploadInput(e)&&O.mergeAttrs(e,t,{isIgnored:!0}),O.putPrivate(e,j,t),!1):(It.forEach(r=>{e.classList.contains(r)&&t.classList.add(r)}),t.setAttribute(j,n),t.setAttribute(G,s),!0)},cleanChildNodes(e,t){if(O.isPhxUpdate(e,t,["append","prepend"])){let i=[];e.childNodes.forEach(n=>{n.id||(n.nodeType===Node.TEXT_NODE&&n.nodeValue.trim()===""||_(`only HTML element tags with an id are allowed inside containers with phx-update.
+
+removing illegal node: "${(n.outerHTML||n.nodeValue).trim()}"
+
+`),i.push(n))}),i.forEach(n=>n.remove())}},replaceRootContainer(e,t,i){let n=new Set(["id",W,le,Ze,ce]);if(e.tagName.toLowerCase()===t.toLowerCase())return Array.from(e.attributes).filter(s=>!n.has(s.name.toLowerCase())).forEach(s=>e.removeAttribute(s.name)),Object.keys(i).filter(s=>!n.has(s.toLowerCase())).forEach(s=>e.setAttribute(s,i[s])),e;{let s=document.createElement(t);return Object.keys(i).forEach(r=>s.setAttribute(r,i[r])),n.forEach(r=>s.setAttribute(r,e.getAttribute(r))),s.innerHTML=e.innerHTML,e.replaceWith(s),s}},getSticky(e,t,i){let n=(O.private(e,"sticky")||[]).find(([s])=>t===s);if(n){let[s,r,o]=n;return o}else return typeof i=="function"?i():i},deleteSticky(e,t){this.updatePrivate(e,"sticky",[],i=>i.filter(([n,s])=>n!==t))},putSticky(e,t,i){let n=i(e);this.updatePrivate(e,"sticky",[],s=>{let r=s.findIndex(([o])=>t===o);return r>=0?s[r]=[t,i,n]:s.push([t,i,n]),s})},applyStickyOperations(e){let t=O.private(e,"sticky");t&&t.forEach(([i,n,s])=>this.putSticky(e,i,n))}},l=O,Je=class{static isActive(e,t){let i=t._phxRef===void 0,s=e.getAttribute(ze).split(",").indexOf(C.genFileRef(t))>=0;return t.size>0&&(i||s)}static isPreflighted(e,t){return e.getAttribute(Qe).split(",").indexOf(C.genFileRef(t))>=0&&this.isActive(e,t)}constructor(e,t,i){this.ref=C.genFileRef(t),this.fileEl=e,this.file=t,this.view=i,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(We,this._onElUpdated)}metadata(){return this.meta}progress(e){this._progress=Math.floor(e),this._progress>this._lastProgressSent&&(this._progress>=100?(this._progress=100,this._lastProgressSent=100,this._isDone=!0,this.view.pushFileProgress(this.fileEl,this.ref,100,()=>{C.untrackFile(this.fileEl,this.file),this._onDone()})):(this._lastProgressSent=this._progress,this.view.pushFileProgress(this.fileEl,this.ref,this._progress)))}cancel(){this._isCancelled=!0,this._isDone=!0,this._onDone()}isDone(){return this._isDone}error(e="failed"){this.view.pushFileProgress(this.fileEl,this.ref,{error:e}),C.clearFiles(this.fileEl)}onDone(e){this._onDone=()=>{this.fileEl.removeEventListener(We,this._onElUpdated),e()}}onElUpdated(){this.fileEl.getAttribute(ze).split(",").indexOf(this.ref)===-1&&this.cancel()}toPreflightPayload(){return{last_modified:this.file.lastModified,name:this.file.name,size:this.file.size,type:this.file.type,ref:this.ref}}uploader(e){if(this.meta.uploader){let t=e[this.meta.uploader]||_(`no uploader configured for ${this.meta.uploader}`);return{name:this.meta.uploader,callback:t}}else return{name:"channel",callback:_i}}zipPostFlight(e){this.meta=e.entries[this.ref],this.meta||_(`no preflight upload response returned with ref ${this.ref}`,{input:this.fileEl,response:e})}},Ti=0,C=class{static genFileRef(e){let t=e._phxRef;return t!==void 0?t:(e._phxRef=(Ti++).toString(),e._phxRef)}static getEntryDataURL(e,t,i){let n=this.activeFiles(e).find(s=>this.genFileRef(s)===t);i(URL.createObjectURL(n))}static hasUploadsInProgress(e){let t=0;return l.findUploadInputs(e).forEach(i=>{i.getAttribute(Qe)!==i.getAttribute(li)&&t++}),t>0}static serializeUploads(e){let t=this.activeFiles(e),i={};return t.forEach(n=>{let s={path:e.name},r=e.getAttribute(Y);i[r]=i[r]||[],s.ref=this.genFileRef(n),s.name=n.name||s.ref,s.type=n.type,s.size=n.size,i[r].push(s)}),i}static clearFiles(e){e.value=null,e.removeAttribute(Y),l.putPrivate(e,"files",[])}static untrackFile(e,t){l.putPrivate(e,"files",l.private(e,"files").filter(i=>!Object.is(i,t)))}static trackFiles(e,t){if(e.getAttribute("multiple")!==null){let i=t.filter(n=>!this.activeFiles(e).find(s=>Object.is(s,n)));l.putPrivate(e,"files",this.activeFiles(e).concat(i)),e.value=null}else l.putPrivate(e,"files",t)}static activeFileInputs(e){let t=l.findUploadInputs(e);return Array.from(t).filter(i=>i.files&&this.activeFiles(i).length>0)}static activeFiles(e){return(l.private(e,"files")||[]).filter(t=>Je.isActive(e,t))}static inputsAwaitingPreflight(e){let t=l.findUploadInputs(e);return Array.from(t).filter(i=>this.filesAwaitingPreflight(i).length>0)}static filesAwaitingPreflight(e){return this.activeFiles(e).filter(t=>!Je.isPreflighted(e,t))}constructor(e,t,i){this.view=t,this.onComplete=i,this._entries=Array.from(C.filesAwaitingPreflight(e)||[]).map(n=>new Je(e,n,t)),this.numEntriesInProgress=this._entries.length}entries(){return this._entries}initAdapterUpload(e,t,i){this._entries=this._entries.map(s=>(s.zipPostFlight(e),s.onDone(()=>{this.numEntriesInProgress--,this.numEntriesInProgress===0&&this.onComplete()}),s));let n=this._entries.reduce((s,r)=>{let{name:o,callback:a}=r.uploader(i.uploaders);return s[o]=s[o]||{callback:a,entries:[]},s[o].entries.push(r),s},{});for(let s in n){let{callback:r,entries:o}=n[s];r(o,t,e,i)}}},Pi={LiveFileUpload:{activeRefs(){return this.el.getAttribute(ze)},preflightedRefs(){return this.el.getAttribute(Qe)},mounted(){this.preflightedWas=this.preflightedRefs()},updated(){let e=this.preflightedRefs();this.preflightedWas!==e&&(this.preflightedWas=e,e===""&&this.__view.cancelSubmit(this.el.form)),this.activeRefs()===""&&(this.el.value=null),this.el.dispatchEvent(new CustomEvent(We))}},LiveImgPreview:{mounted(){this.ref=this.el.getAttribute("data-phx-entry-ref"),this.inputEl=document.getElementById(this.el.getAttribute(Y)),C.getEntryDataURL(this.inputEl,this.ref,e=>{this.url=e,this.el.src=e})},destroyed(){URL.revokeObjectURL(this.url)}}},Ri=Pi,Li=class{constructor(e,t,i){let n=new Set,s=new Set([...t.children].map(o=>o.id)),r=[];Array.from(e.children).forEach(o=>{if(o.id&&(n.add(o.id),s.has(o.id))){let a=o.previousElementSibling&&o.previousElementSibling.id;r.push({elementId:o.id,previousElementId:a})}}),this.containerId=t.id,this.updateType=i,this.elementsToModify=r,this.elementIdsToAdd=[...s].filter(o=>!n.has(o))}perform(){let e=l.byId(this.containerId);this.elementsToModify.forEach(t=>{t.previousElementId?F(document.getElementById(t.previousElementId),i=>{F(document.getElementById(t.elementId),n=>{n.previousElementSibling&&n.previousElementSibling.id==i.id||i.insertAdjacentElement("afterend",n)})}):F(document.getElementById(t.elementId),i=>{i.previousElementSibling==null||e.insertAdjacentElement("afterbegin",i)})}),this.updateType=="prepend"&&this.elementIdsToAdd.reverse().forEach(t=>{F(document.getElementById(t),i=>e.insertAdjacentElement("afterbegin",i))})}},Ct=11;function xi(e,t){var i=t.attributes,n,s,r,o,a;if(!(t.nodeType===Ct||e.nodeType===Ct)){for(var h=i.length-1;h>=0;h--)n=i[h],s=n.name,r=n.namespaceURI,o=n.value,r?(s=n.localName||s,a=e.getAttributeNS(r,s),a!==o&&(n.prefix==="xmlns"&&(s=n.name),e.setAttributeNS(r,s,o))):(a=e.getAttribute(s),a!==o&&e.setAttribute(s,o));for(var d=e.attributes,f=d.length-1;f>=0;f--)n=d[f],s=n.name,r=n.namespaceURI,r?(s=n.localName||s,t.hasAttributeNS(r,s)||e.removeAttributeNS(r,s)):t.hasAttribute(s)||e.removeAttribute(s)}}var _e,Ii="http://www.w3.org/1999/xhtml",T=typeof document=="undefined"?void 0:document,Di=!!T&&"content"in T.createElement("template"),Oi=!!T&&T.createRange&&"createContextualFragment"in T.createRange();function Ni(e){var t=T.createElement("template");return t.innerHTML=e,t.content.childNodes[0]}function Hi(e){_e||(_e=T.createRange(),_e.selectNode(T.body));var t=_e.createContextualFragment(e);return t.childNodes[0]}function Mi(e){var t=T.createElement("body");return t.innerHTML=e,t.childNodes[0]}function Ui(e){return e=e.trim(),Di?Ni(e):Oi?Hi(e):Mi(e)}function Te(e,t){var i=e.nodeName,n=t.nodeName,s,r;return i===n?!0:(s=i.charCodeAt(0),r=n.charCodeAt(0),s<=90&&r>=97?i===n.toUpperCase():r<=90&&s>=97?n===i.toUpperCase():!1)}function ji(e,t){return!t||t===Ii?T.createElement(e):T.createElementNS(t,e)}function $i(e,t){for(var i=e.firstChild;i;){var n=i.nextSibling;t.appendChild(i),i=n}return t}function Ve(e,t,i){e[i]!==t[i]&&(e[i]=t[i],e[i]?e.setAttribute(i,""):e.removeAttribute(i))}var _t={OPTION:function(e,t){var i=e.parentNode;if(i){var n=i.nodeName.toUpperCase();n==="OPTGROUP"&&(i=i.parentNode,n=i&&i.nodeName.toUpperCase()),n==="SELECT"&&!i.hasAttribute("multiple")&&(e.hasAttribute("selected")&&!t.selected&&(e.setAttribute("selected","selected"),e.removeAttribute("selected")),i.selectedIndex=-1)}Ve(e,t,"selected")},INPUT:function(e,t){Ve(e,t,"checked"),Ve(e,t,"disabled"),e.value!==t.value&&(e.value=t.value),t.hasAttribute("value")||e.removeAttribute("value")},TEXTAREA:function(e,t){var i=t.value;e.value!==i&&(e.value=i);var n=e.firstChild;if(n){var s=n.nodeValue;if(s==i||!i&&s==e.placeholder)return;n.nodeValue=i}},SELECT:function(e,t){if(!t.hasAttribute("multiple")){for(var i=-1,n=0,s=e.firstChild,r,o;s;)if(o=s.nodeName&&s.nodeName.toUpperCase(),o==="OPTGROUP")r=s,s=r.firstChild;else{if(o==="OPTION"){if(s.hasAttribute("selected")){i=n;break}n++}s=s.nextSibling,!s&&r&&(s=r.nextSibling,r=null)}e.selectedIndex=i}}},ae=1,Fi=11,Tt=3,Pt=8;function K(){}function Bi(e){if(e)return e.getAttribute&&e.getAttribute("id")||e.id}function Ji(e){return function(i,n,s){if(s||(s={}),typeof n=="string")if(i.nodeName==="#document"||i.nodeName==="HTML"||i.nodeName==="BODY"){var r=n;n=T.createElement("html"),n.innerHTML=r}else n=Ui(n);var o=s.getNodeKey||Bi,a=s.onBeforeNodeAdded||K,h=s.onNodeAdded||K,d=s.onBeforeElUpdated||K,f=s.onElUpdated||K,p=s.onBeforeNodeDiscarded||K,v=s.onNodeDiscarded||K,u=s.onBeforeElChildrenUpdated||K,m=s.childrenOnly===!0,g=Object.create(null),E=[];function x(k){E.push(k)}function I(k,y){if(k.nodeType===ae)for(var b=k.firstChild;b;){var S=void 0;y&&(S=o(b))?x(S):(v(b),b.firstChild&&I(b,y)),b=b.nextSibling}}function c(k,y,b){p(k)!==!1&&(y&&y.removeChild(k),v(k),I(k,b))}function A(k){if(k.nodeType===ae||k.nodeType===Fi)for(var y=k.firstChild;y;){var b=o(y);b&&(g[b]=y),A(y),y=y.nextSibling}}A(i);function ue(k){h(k);for(var y=k.firstChild;y;){var b=y.nextSibling,S=o(y);if(S){var D=g[S];D&&Te(y,D)?(y.parentNode.replaceChild(D,y),pe(D,y)):ue(y)}else ue(y);y=b}}function fe(k,y,b){for(;y;){var S=y.nextSibling;(b=o(y))?x(b):c(y,k,!0),y=S}}function pe(k,y,b){var S=o(y);S&&delete g[S],!(!b&&(d(k,y)===!1||(e(k,y),f(k),u(k,y)===!1)))&&(k.nodeName!=="TEXTAREA"?Ft(k,y):_t.TEXTAREA(k,y))}function Ft(k,y){var b=y.firstChild,S=k.firstChild,D,B,Q,me,J;e:for(;b;){for(me=b.nextSibling,D=o(b);S;){if(Q=S.nextSibling,b.isSameNode&&b.isSameNode(S)){b=me,S=Q;continue e}B=o(S);var ve=S.nodeType,V=void 0;if(ve===b.nodeType&&(ve===ae?(D?D!==B&&((J=g[D])?Q===J?V=!1:(k.insertBefore(J,S),B?x(B):c(S,k,!0),S=J):V=!1):B&&(V=!1),V=V!==!1&&Te(S,b),V&&pe(S,b)):(ve===Tt||ve==Pt)&&(V=!0,S.nodeValue!==b.nodeValue&&(S.nodeValue=b.nodeValue))),V){b=me,S=Q;continue e}B?x(B):c(S,k,!0),S=Q}if(D&&(J=g[D])&&Te(J,b))k.appendChild(J),pe(J,b);else{var De=a(b);De!==!1&&(De&&(b=De),b.actualize&&(b=b.actualize(k.ownerDocument||T)),k.appendChild(b),ue(b))}b=me,S=Q}fe(k,S,B);var it=_t[k.nodeName];it&&it(k,y)}var w=i,ge=w.nodeType,tt=n.nodeType;if(!m){if(ge===ae)tt===ae?Te(i,n)||(v(i),w=$i(i,ji(n.nodeName,n.namespaceURI))):w=n;else if(ge===Tt||ge===Pt){if(tt===ge)return w.nodeValue!==n.nodeValue&&(w.nodeValue=n.nodeValue),w;w=n}}if(w===n)v(i);else{if(n.isSameNode&&n.isSameNode(w))return;if(pe(w,n,m),E)for(var xe=0,Bt=E.length;xe{if(i&&i.isSameNode(n)&&l.isFormInput(n))return l.mergeFocusedInput(n,s),!1}})}constructor(e,t,i,n,s){this.view=e,this.liveSocket=e.liveSocket,this.container=t,this.id=i,this.rootID=e.root.id,this.html=n,this.targetCID=s,this.cidPatch=z(this.targetCID),this.callbacks={beforeadded:[],beforeupdated:[],beforephxChildAdded:[],afteradded:[],afterupdated:[],afterdiscarded:[],afterphxChildAdded:[],aftertransitionsDiscarded:[]}}before(e,t){this.callbacks[`before${e}`].push(t)}after(e,t){this.callbacks[`after${e}`].push(t)}trackBefore(e,...t){this.callbacks[`before${e}`].forEach(i=>i(...t))}trackAfter(e,...t){this.callbacks[`after${e}`].forEach(i=>i(...t))}markPrunableContentForRemoval(){l.all(this.container,"[phx-update=append] > *, [phx-update=prepend] > *",e=>{e.setAttribute(ut,"")})}perform(){let{view:e,liveSocket:t,container:i,html:n}=this,s=this.isCIDPatch()?this.targetCIDContainer(n):i;if(this.isCIDPatch()&&!s)return;let r=t.getActiveElement(),{selectionStart:o,selectionEnd:a}=r&&l.hasSelectionRange(r)?r:{},h=t.binding(Ye),d=t.binding(Ke),f=t.binding(Ge),p=t.binding(di),v=t.binding("remove"),u=[],m=[],g=[],E=[],x=null,I=t.time("premorph container prep",()=>this.buildDiffHTML(i,n,h,s));return this.trackBefore("added",i),this.trackBefore("updated",i,i),t.time("morphdom",()=>{Rt(s,I,{childrenOnly:s.getAttribute(L)===null,getNodeKey:c=>l.isPhxDestroyed(c)?null:c.id,onBeforeNodeAdded:c=>(this.trackBefore("added",c),c),onNodeAdded:c=>{c instanceof HTMLImageElement&&c.srcset?c.srcset=c.srcset:c instanceof HTMLVideoElement&&c.autoplay&&c.play(),l.isNowTriggerFormExternal(c,p)&&(x=c),l.discardError(s,c,d),(l.isPhxChild(c)&&e.ownsElement(c)||l.isPhxSticky(c)&&e.ownsElement(c.parentNode))&&this.trackAfter("phxChildAdded",c),u.push(c)},onNodeDiscarded:c=>{(l.isPhxChild(c)||l.isPhxSticky(c))&&t.destroyViewByEl(c),this.trackAfter("discarded",c)},onBeforeNodeDiscarded:c=>c.getAttribute&&c.getAttribute(ut)!==null?!0:c.parentNode!==null&&l.isPhxUpdate(c.parentNode,h,["append","prepend"])&&c.id?!1:c.getAttribute&&c.getAttribute(v)?(E.push(c),!1):!this.skipCIDSibling(c),onElUpdated:c=>{l.isNowTriggerFormExternal(c,p)&&(x=c),m.push(c)},onBeforeElUpdated:(c,A)=>{if(l.cleanChildNodes(A,h),this.skipCIDSibling(A)||l.isPhxSticky(c))return!1;if(l.isIgnored(c,h))return this.trackBefore("updated",c,A),l.mergeAttrs(c,A,{isIgnored:!0}),m.push(c),l.applyStickyOperations(c),!1;if(c.type==="number"&&c.validity&&c.validity.badInput)return!1;if(!l.syncPendingRef(c,A,f))return l.isUploadInput(c)&&(this.trackBefore("updated",c,A),m.push(c)),l.applyStickyOperations(c),!1;if(l.isPhxChild(A)){let fe=c.getAttribute(W);return l.mergeAttrs(c,A,{exclude:[le]}),fe!==""&&c.setAttribute(W,fe),c.setAttribute(ce,this.rootID),l.applyStickyOperations(c),!1}return l.copyPrivates(A,c),l.discardError(s,A,d),r&&c.isSameNode(r)&&l.isFormInput(c)?(this.trackBefore("updated",c,A),l.mergeFocusedInput(c,A),l.syncAttrsToProps(c),m.push(c),l.applyStickyOperations(c),!1):(l.isPhxUpdate(A,h,["append","prepend"])&&g.push(new Li(c,A,A.getAttribute(h))),l.syncAttrsToProps(A),l.applyStickyOperations(A),this.trackBefore("updated",c,A),!0)}})}),t.isDebugEnabled()&&Ei(),g.length>0&&t.time("post-morph append/prepend restoration",()=>{g.forEach(c=>c.perform())}),t.silenceEvents(()=>l.restoreFocus(r,o,a)),l.dispatchEvent(document,"phx:update"),u.forEach(c=>this.trackAfter("added",c)),m.forEach(c=>this.trackAfter("updated",c)),E.length>0&&(t.transitionRemoves(E),t.requestDOMUpdate(()=>{E.forEach(c=>{let A=l.firstPhxChild(c);A&&t.destroyViewByEl(A),c.remove()}),this.trackAfter("transitionsDiscarded",E)})),x&&(t.disconnect(),x.submit()),!0}isCIDPatch(){return this.cidPatch}skipCIDSibling(e){return e.nodeType===Node.ELEMENT_NODE&&e.getAttribute(qe)!==null}targetCIDContainer(e){if(!this.isCIDPatch())return;let[t,...i]=l.findComponentNodeList(this.container,this.targetCID);return i.length===0&&l.childNodeLength(e)===1?t:t&&t.parentNode}buildDiffHTML(e,t,i,n){let s=this.isCIDPatch(),r=s&&n.getAttribute(L)===this.targetCID.toString();if(!s||r)return t;{let o=null,a=document.createElement("template");o=l.cloneNode(n);let[h,...d]=l.findComponentNodeList(o,this.targetCID);return a.innerHTML=t,d.forEach(f=>f.remove()),Array.from(o.childNodes).forEach(f=>{f.id&&f.nodeType===Node.ELEMENT_NODE&&f.getAttribute(L)!==this.targetCID.toString()&&(f.setAttribute(qe,""),f.innerHTML="")}),Array.from(a.content.childNodes).forEach(f=>o.insertBefore(f,h)),h.remove(),o.outerHTML}}},Lt=class{static extract(e){let{[At]:t,[St]:i,[Et]:n}=e;return delete e[At],delete e[St],delete e[Et],{diff:e,title:n,reply:t||null,events:i||[]}}constructor(e,t){this.viewId=e,this.rendered={},this.mergeDiff(t)}parentViewId(){return this.viewId}toString(e){return this.recursiveToString(this.rendered,this.rendered[R],e)}recursiveToString(e,t=e[R],i){i=i?new Set(i):null;let n={buffer:"",components:t,onlyCids:i};return this.toOutputBuffer(e,null,n),n.buffer}componentCIDs(e){return Object.keys(e[R]||{}).map(t=>parseInt(t))}isComponentOnlyDiff(e){return e[R]?Object.keys(e).length===1:!1}getComponent(e,t){return e[R][t]}mergeDiff(e){let t=e[R],i={};if(delete e[R],this.rendered=this.mutableMerge(this.rendered,e),this.rendered[R]=this.rendered[R]||{},t){let n=this.rendered[R];for(let s in t)t[s]=this.cachedFindComponent(s,t[s],n,t,i);for(let s in t)n[s]=t[s];e[R]=t}}cachedFindComponent(e,t,i,n,s){if(s[e])return s[e];{let r,o,a=t[M];if(z(a)){let h;a>0?h=this.cachedFindComponent(a,n[a],i,n,s):h=i[-a],o=h[M],r=this.cloneMerge(h,t),r[M]=o}else r=t[M]!==void 0?t:this.cloneMerge(i[e]||{},t);return s[e]=r,r}}mutableMerge(e,t){return t[M]!==void 0?t:(this.doMutableMerge(e,t),e)}doMutableMerge(e,t){for(let i in t){let n=t[i],s=e[i];oe(n)&&n[M]===void 0&&oe(s)?this.doMutableMerge(s,n):e[i]=n}}cloneMerge(e,t){let i=te(te({},e),t);for(let n in i){let s=t[n],r=e[n];oe(s)&&s[M]===void 0&&oe(r)&&(i[n]=this.cloneMerge(r,s))}return i}componentToString(e){return this.recursiveCIDToString(this.rendered[R],e)}pruneCIDs(e){e.forEach(t=>delete this.rendered[R][t])}get(){return this.rendered}isNewFingerprint(e={}){return!!e[M]}templateStatic(e,t){return typeof e=="number"?t[e]:e}toOutputBuffer(e,t,i){if(e[kt])return this.comprehensionToBuffer(e,t,i);let{[M]:n}=e;n=this.templateStatic(n,t),i.buffer+=n[0];for(let s=1;sp.nodeType===Node.ELEMENT_NODE?p.getAttribute(L)?[d,!0]:(p.setAttribute(L,t),p.id||(p.id=`${this.parentViewId()}-${t}-${v}`),o&&(p.setAttribute(qe,""),p.innerHTML=""),[!0,f]):p.nodeValue.trim()!==""?(_(`only HTML element tags are allowed at the root of components.
+
+got: "${p.nodeValue.trim()}"
+
+within:
+`,s.innerHTML.trim()),p.replaceWith(this.createSpan(p.nodeValue,t)),[!0,f]):(p.remove(),[d,f]),[!1,!1]);return!a&&!h?(_(`expected at least one HTML element tag inside a component, but the component is empty:
+`,s.innerHTML.trim()),this.createSpan("",t).outerHTML):(!a&&h&&_("expected at least one HTML element tag directly inside a component, but only subcomponents were found. A component must render at least one HTML tag directly inside itself.",s.innerHTML.trim()),s.innerHTML)}createSpan(e,t){let i=document.createElement("span");return i.innerText=e,i.setAttribute(L,t),i}},Xi=1,he=class{static makeID(){return Xi++}static elementID(e){return e.phxHookId}constructor(e,t,i){this.__view=e,this.__liveSocket=e.liveSocket,this.__callbacks=i,this.__listeners=new Set,this.__isDisconnected=!1,this.el=t,this.el.phxHookId=this.constructor.makeID();for(let n in this.__callbacks)this[n]=this.__callbacks[n]}__mounted(){this.mounted&&this.mounted()}__updated(){this.updated&&this.updated()}__beforeUpdate(){this.beforeUpdate&&this.beforeUpdate()}__destroyed(){this.destroyed&&this.destroyed()}__reconnected(){this.__isDisconnected&&(this.__isDisconnected=!1,this.reconnected&&this.reconnected())}__disconnected(){this.__isDisconnected=!0,this.disconnected&&this.disconnected()}pushEvent(e,t={},i=function(){}){return this.__view.pushHookEvent(null,e,t,i)}pushEventTo(e,t,i={},n=function(){}){return this.__view.withinTargets(e,(s,r)=>s.pushHookEvent(r,t,i,n))}handleEvent(e,t){let i=(n,s)=>s?e:t(n.detail);return window.addEventListener(`phx:${e}`,i),this.__listeners.add(i),i}removeHandleEvent(e){let t=e(null,!0);window.removeEventListener(`phx:${t}`,e),this.__listeners.delete(e)}upload(e,t){return this.__view.dispatchUploads(e,t)}uploadTo(e,t,i){return this.__view.withinTargets(e,n=>n.dispatchUploads(t,i))}__cleanup__(){this.__listeners.forEach(e=>this.removeHandleEvent(e))}},zi={exec(e,t,i,n,s){let[r,o]=s||[null,{}];(t.charAt(0)==="["?JSON.parse(t):[[r,o]]).forEach(([h,d])=>{h===r&&o.data&&(d.data=Object.assign(d.data||{},o.data)),this.filterToEls(n,d).forEach(f=>{this[`exec_${h}`](e,t,i,n,f,d)})})},isVisible(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length>0)},exec_dispatch(e,t,i,n,s,{to:r,event:o,detail:a}){l.dispatchEvent(s,o,a)},exec_push(e,t,i,n,s,r){let{event:o,data:a,target:h,page_loading:d,loading:f,value:p}=r,v={loading:f,value:p,target:h,page_loading:!!d},u=e==="change"?n.form:n,m=h||u.getAttribute(i.binding("target"))||u;i.withinTargets(m,(g,E)=>{if(e==="change"){let{newCid:x,_target:I,callback:c}=r;I&&(v._target=I),g.pushInput(n,E,x,o||t,v,c)}else e==="submit"?g.submitForm(n,E,o||t,v):g.pushEvent(e,n,E,o||t,a,v)})},exec_add_class(e,t,i,n,s,{names:r,transition:o,time:a}){this.addOrRemoveClasses(s,r,[],o,a,i)},exec_remove_class(e,t,i,n,s,{names:r,transition:o,time:a}){this.addOrRemoveClasses(s,[],r,o,a,i)},exec_transition(e,t,i,n,s,{time:r,transition:o}){let[a,h,d]=o,f=()=>this.addOrRemoveClasses(s,a.concat(h),[]),p=()=>this.addOrRemoveClasses(s,d,a.concat(h));i.transition(r,f,p)},exec_toggle(e,t,i,n,s,{display:r,ins:o,outs:a,time:h}){this.toggle(e,i,s,r,o,a,h)},exec_show(e,t,i,n,s,{display:r,transition:o,time:a}){this.show(e,i,s,r,o,a)},exec_hide(e,t,i,n,s,{display:r,transition:o,time:a}){this.hide(e,i,s,r,o,a)},exec_set_attr(e,t,i,n,s,{attr:[r,o]}){this.setOrRemoveAttrs(s,[[r,o]],[])},exec_remove_attr(e,t,i,n,s,{attr:r}){this.setOrRemoveAttrs(s,[],[r])},show(e,t,i,n,s,r){this.isVisible(i)||this.toggle(e,t,i,n,s,null,r)},hide(e,t,i,n,s,r){this.isVisible(i)&&this.toggle(e,t,i,n,null,s,r)},toggle(e,t,i,n,s,r,o){let[a,h,d]=s||[[],[],[]],[f,p,v]=r||[[],[],[]];if(a.length>0||f.length>0)if(this.isVisible(i)){let u=()=>{this.addOrRemoveClasses(i,p,a.concat(h).concat(d)),window.requestAnimationFrame(()=>{this.addOrRemoveClasses(i,f,[]),window.requestAnimationFrame(()=>this.addOrRemoveClasses(i,v,p))})};i.dispatchEvent(new Event("phx:hide-start")),t.transition(o,u,()=>{this.addOrRemoveClasses(i,[],f.concat(v)),l.putSticky(i,"toggle",m=>m.style.display="none"),i.dispatchEvent(new Event("phx:hide-end"))})}else{if(e==="remove")return;let u=()=>{this.addOrRemoveClasses(i,h,f.concat(p).concat(v)),l.putSticky(i,"toggle",m=>m.style.display=n||"block"),window.requestAnimationFrame(()=>{this.addOrRemoveClasses(i,a,[]),window.requestAnimationFrame(()=>this.addOrRemoveClasses(i,d,h))})};i.dispatchEvent(new Event("phx:show-start")),t.transition(o,u,()=>{this.addOrRemoveClasses(i,[],a.concat(d)),i.dispatchEvent(new Event("phx:show-end"))})}else this.isVisible(i)?window.requestAnimationFrame(()=>{i.dispatchEvent(new Event("phx:hide-start")),l.putSticky(i,"toggle",u=>u.style.display="none"),i.dispatchEvent(new Event("phx:hide-end"))}):window.requestAnimationFrame(()=>{i.dispatchEvent(new Event("phx:show-start")),l.putSticky(i,"toggle",u=>u.style.display=n||"block"),i.dispatchEvent(new Event("phx:show-end"))})},addOrRemoveClasses(e,t,i,n,s,r){let[o,a,h]=n||[[],[],[]];if(o.length>0){let d=()=>this.addOrRemoveClasses(e,a.concat(o),[]),f=()=>this.addOrRemoveClasses(e,t.concat(h),i.concat(o).concat(a));return r.transition(s,d,f)}window.requestAnimationFrame(()=>{let[d,f]=l.getSticky(e,"classes",[[],[]]),p=t.filter(g=>d.indexOf(g)<0&&!e.classList.contains(g)),v=i.filter(g=>f.indexOf(g)<0&&e.classList.contains(g)),u=d.filter(g=>i.indexOf(g)<0).concat(p),m=f.filter(g=>t.indexOf(g)<0).concat(v);l.putSticky(e,"classes",g=>(g.classList.remove(...m),g.classList.add(...u),[u,m]))})},setOrRemoveAttrs(e,t,i){let[n,s]=l.getSticky(e,"attrs",[[],[]]),r=t.filter(([d,f])=>!this.hasSet(n,d)&&!e.attributes.getNamedItem(d)),o=i.filter(d=>s.indexOf(d)<0&&e.attributes.getNamedItem(d)),a=n.filter(([d,f])=>i.indexOf(d)<0).concat(r),h=s.filter(d=>!this.hasSet(t,d)).concat(o);l.putSticky(e,"attrs",d=>(h.forEach(f=>d.removeAttribute(f)),a.forEach(([f,p])=>d.setAttribute(f,p)),[a,h]))},hasSet(e,t){return e.find(([i,n])=>i===t)},hasAllClasses(e,t){return t.every(i=>e.classList.contains(i))},isToggledOut(e,t){return!this.isVisible(e)||this.hasAllClasses(e,t)},filterToEls(e,{to:t}){return t?l.all(document,t):[e]}},U=zi,Xe=(e,t={})=>{let i=new FormData(e),n=[];i.forEach((r,o,a)=>{r instanceof File&&n.push(o)}),n.forEach(r=>i.delete(r));let s=new URLSearchParams;for(let[r,o]of i.entries())s.append(r,o);for(let r in t)s.append(r,t[r]);return s.toString()},Ut=class{constructor(e,t,i,n){this.liveSocket=t,this.flash=n,this.parent=i,this.root=i?i.root:this,this.el=e,this.id=this.el.id,this.ref=0,this.childJoins=0,this.loaderTimer=null,this.pendingDiffs=[],this.pruningCIDs=[],this.redirect=!1,this.href=null,this.joinCount=this.parent?this.parent.joinCount-1:0,this.joinPending=!0,this.destroyed=!1,this.joinCallback=function(s){s&&s()},this.stopCallback=function(){},this.pendingJoinOps=this.parent?null:[],this.viewHooks={},this.uploaders={},this.formSubmits=[],this.children=this.parent?null:{},this.root.children[this.id]={},this.channel=this.liveSocket.channel(`lv:${this.id}`,()=>({redirect:this.redirect?this.href:void 0,url:this.redirect?void 0:this.href||void 0,params:this.connectParams(),session:this.getSession(),static:this.getStatic(),flash:this.flash})),this.showLoader(this.liveSocket.loaderTimeout),this.bindChannel()}setHref(e){this.href=e}setRedirect(e){this.redirect=!0,this.href=e}isMain(){return this.el.getAttribute(Ze)!==null}connectParams(){let e=this.liveSocket.params(this.el),t=l.all(document,`[${this.binding(ai)}]`).map(i=>i.src||i.href).filter(i=>typeof i=="string");return t.length>0&&(e._track_static=t),e._mounts=this.joinCount,e}isConnected(){return this.channel.canPush()}getSession(){return this.el.getAttribute(W)}getStatic(){let e=this.el.getAttribute(le);return e===""?null:e}destroy(e=function(){}){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 t=()=>{e();for(let i in this.viewHooks)this.destroyHook(this.viewHooks[i])};l.markPhxChildDestroyed(this.el),this.log("destroyed",()=>["the child has been removed from the parent"]),this.channel.leave().receive("ok",t).receive("error",t).receive("timeout",t)}setContainerClasses(...e){this.el.classList.remove(pt,Me,mt),this.el.classList.add(...e)}showLoader(e){if(clearTimeout(this.loaderTimer),e)this.loaderTimer=setTimeout(()=>this.showLoader(),e);else{for(let t in this.viewHooks)this.viewHooks[t].__disconnected();this.setContainerClasses(Me)}}hideLoader(){clearTimeout(this.loaderTimer),this.setContainerClasses(pt)}triggerReconnected(){for(let e in this.viewHooks)this.viewHooks[e].__reconnected()}log(e,t){this.liveSocket.log(this,e,t)}transition(e,t,i=function(){}){this.liveSocket.transition(e,t,i)}withinTargets(e,t){if(e instanceof HTMLElement||e instanceof SVGElement)return this.liveSocket.owner(e,i=>t(i,e));if(z(e))l.findComponentNodeList(this.el,e).length===0?_(`no component found matching phx-target of ${e}`):t(this,parseInt(e));else{let i=Array.from(document.querySelectorAll(e));i.length===0&&_(`nothing found matching the phx-target selector "${e}"`),i.forEach(n=>this.liveSocket.owner(n,s=>t(s,n)))}}applyDiff(e,t,i){this.log(e,()=>["",Re(t)]);let{diff:n,reply:s,events:r,title:o}=Lt.extract(t);return o&&l.putTitle(o),i({diff:n,reply:s,events:r}),s}onJoin(e){let{rendered:t,container:i}=e;if(i){let[n,s]=i;this.el=l.replaceRootContainer(this.el,n,s)}this.childJoins=0,this.joinPending=!0,this.flash=null,X.dropLocal(this.liveSocket.localStorage,window.location.pathname,xt),this.applyDiff("mount",t,({diff:n,events:s})=>{this.rendered=new Lt(this.id,n);let r=this.renderContainer(null,"join");this.dropPendingRefs();let o=this.formsForRecovery(r);this.joinCount++,o.length>0?o.forEach(([a,h,d],f)=>{this.pushFormRecovery(a,d,p=>{f===o.length-1&&this.onJoinComplete(p,r,s)})}):this.onJoinComplete(e,r,s)})}dropPendingRefs(){l.all(document,`[${G}="${this.id}"][${j}]`,e=>{e.removeAttribute(j),e.removeAttribute(G)})}onJoinComplete({live_patch:e},t,i){if(this.joinCount>1||this.parent&&!this.parent.isJoinPending())return this.applyJoinPatch(e,t,i);l.findPhxChildrenInFragment(t,this.id).filter(s=>{let r=s.id&&this.el.querySelector(`[id="${s.id}"]`),o=r&&r.getAttribute(le);return o&&s.setAttribute(le,o),this.joinChild(s)}).length===0?this.parent?(this.root.pendingJoinOps.push([this,()=>this.applyJoinPatch(e,t,i)]),this.parent.ackJoin(this)):(this.onAllChildJoinsComplete(),this.applyJoinPatch(e,t,i)):this.root.pendingJoinOps.push([this,()=>this.applyJoinPatch(e,t,i)])}attachTrueDocEl(){this.el=l.byId(this.id),this.el.setAttribute(ce,this.root.id)}applyJoinPatch(e,t,i){this.attachTrueDocEl();let n=new Pe(this,this.el,this.id,t,null);if(n.markPrunableContentForRemoval(),this.performPatch(n,!1),this.joinNewChildren(),l.all(this.el,`[${this.binding(we)}], [data-phx-${we}]`,s=>{let r=this.addHook(s);r&&r.__mounted()}),this.joinPending=!1,this.liveSocket.dispatchEvents(i),this.applyPendingUpdates(),e){let{kind:s,to:r}=e;this.liveSocket.historyPatch(r,s)}this.hideLoader(),this.joinCount>1&&this.triggerReconnected(),this.stopCallback()}triggerBeforeUpdateHook(e,t){this.liveSocket.triggerDOM("onBeforeElUpdated",[e,t]);let i=this.getHook(e),n=i&&l.isIgnored(e,this.binding(Ye));if(i&&!e.isEqualNode(t)&&!(n&&Ci(e.dataset,t.dataset)))return i.__beforeUpdate(),i}performPatch(e,t){let i=[],n=!1,s=new Set;return e.after("added",r=>{this.liveSocket.triggerDOM("onNodeAdded",[r]);let o=this.addHook(r);o&&o.__mounted()}),e.after("phxChildAdded",r=>{l.isPhxSticky(r)?this.liveSocket.joinRootViews():n=!0}),e.before("updated",(r,o)=>{this.triggerBeforeUpdateHook(r,o)&&s.add(r.id)}),e.after("updated",r=>{s.has(r.id)&&this.getHook(r).__updated()}),e.after("discarded",r=>{r.nodeType===Node.ELEMENT_NODE&&i.push(r)}),e.after("transitionsDiscarded",r=>this.afterElementsRemoved(r,t)),e.perform(),this.afterElementsRemoved(i,t),n}afterElementsRemoved(e,t){let i=[];e.forEach(n=>{l.all(n,`[${L}]`).concat(n).forEach(r=>{let o=this.componentID(r);z(o)&&i.indexOf(o)===-1&&i.push(o);let a=this.getHook(r);a&&this.destroyHook(a)})}),t&&this.maybePushComponentsDestroyed(i)}joinNewChildren(){l.findPhxChildren(this.el,this.id).forEach(e=>this.joinChild(e))}getChildById(e){return this.root.children[this.id][e]}getDescendentByEl(e){return e.id===this.id?this:this.children[e.getAttribute(Z)][e.id]}destroyDescendent(e){for(let t in this.root.children)for(let i in this.root.children[t])if(i===e)return this.root.children[t][i].destroy()}joinChild(e){if(!this.getChildById(e.id)){let i=new Ut(e,this.liveSocket,this);return this.root.children[this.id][i.id]=i,i.join(),this.childJoins++,!0}}isJoinPending(){return this.joinPending}ackJoin(e){this.childJoins--,this.childJoins===0&&(this.parent?this.parent.ackJoin(this):this.onAllChildJoinsComplete())}onAllChildJoinsComplete(){this.joinCallback(()=>{this.pendingJoinOps.forEach(([e,t])=>{e.isDestroyed()||t()}),this.pendingJoinOps=[]})}update(e,t){if(this.isJoinPending()||this.liveSocket.hasPendingLink())return this.pendingDiffs.push({diff:e,events:t});this.rendered.mergeDiff(e);let i=!1;this.rendered.isComponentOnlyDiff(e)?this.liveSocket.time("component patch complete",()=>{l.findParentCIDs(this.el,this.rendered.componentCIDs(e)).forEach(s=>{this.componentPatch(this.rendered.getComponent(e,s),s)&&(i=!0)})}):wt(e)||this.liveSocket.time("full patch complete",()=>{let n=this.renderContainer(e,"update"),s=new Pe(this,this.el,this.id,n,null);i=this.performPatch(s,!0)}),this.liveSocket.dispatchEvents(t),i&&this.joinNewChildren()}renderContainer(e,t){return this.liveSocket.time(`toString diff (${t})`,()=>{let i=this.el.tagName,n=e?this.rendered.componentCIDs(e).concat(this.pruningCIDs):null,s=this.rendered.toString(n);return`<${i}>${s}${i}>`})}componentPatch(e,t){if(wt(e))return!1;let i=this.rendered.componentToString(t),n=new Pe(this,this.el,this.id,i,t);return this.performPatch(n,!0)}getHook(e){return this.viewHooks[he.elementID(e)]}addHook(e){if(he.elementID(e)||!e.getAttribute)return;let t=e.getAttribute(`data-phx-${we}`)||e.getAttribute(this.binding(we));if(t&&!this.ownsElement(e))return;let i=this.liveSocket.getHookCallbacks(t);if(i){e.id||_(`no DOM ID for hook "${t}". Hooks require a unique ID on each element.`,e);let n=new he(this,e,i);return this.viewHooks[he.elementID(n.el)]=n,n}else t!==null&&_(`unknown hook found for "${t}"`,e)}destroyHook(e){e.__destroyed(),e.__cleanup__(),delete this.viewHooks[he.elementID(e.el)]}applyPendingUpdates(){this.pendingDiffs.forEach(({diff:e,events:t})=>this.update(e,t)),this.pendingDiffs=[]}onChannel(e,t){this.liveSocket.onChannel(this.channel,e,i=>{this.isJoinPending()?this.root.pendingJoinOps.push([this,()=>t(i)]):this.liveSocket.requestDOMUpdate(()=>t(i))})}bindChannel(){this.liveSocket.onChannel(this.channel,"diff",e=>{this.liveSocket.requestDOMUpdate(()=>{this.applyDiff("update",e,({diff:t,events:i})=>this.update(t,i))})}),this.onChannel("redirect",({to:e,flash:t})=>this.onRedirect({to:e,flash:t})),this.onChannel("live_patch",e=>this.onLivePatch(e)),this.onChannel("live_redirect",e=>this.onLiveRedirect(e)),this.channel.onError(e=>this.onError(e)),this.channel.onClose(e=>this.onClose(e))}destroyAllChildren(){for(let e in this.root.children[this.id])this.getChildById(e).destroy()}onLiveRedirect(e){let{to:t,kind:i,flash:n}=e,s=this.expandURL(t);this.liveSocket.historyRedirect(s,i,n)}onLivePatch(e){let{to:t,kind:i}=e;this.href=this.expandURL(t),this.liveSocket.historyPatch(t,i)}expandURL(e){return e.startsWith("/")?`${window.location.protocol}//${window.location.host}${e}`:e}onRedirect({to:e,flash:t}){this.liveSocket.redirect(e,t)}isDestroyed(){return this.destroyed}join(e){this.isMain()&&(this.stopCallback=this.liveSocket.withPageLoading({to:this.href,kind:"initial"})),this.joinCallback=t=>{t=t||function(){},e?e(this.joinCount,t):t()},this.liveSocket.wrapPush(this,{timeout:!1},()=>this.channel.join().receive("ok",t=>{this.isDestroyed()||this.liveSocket.requestDOMUpdate(()=>this.onJoin(t))}).receive("error",t=>!this.isDestroyed()&&this.onJoinError(t)).receive("timeout",()=>!this.isDestroyed()&&this.onJoinError({reason:"timeout"})))}onJoinError(e){return e.reason==="unauthorized"||e.reason==="stale"?(this.log("error",()=>["unauthorized live_redirect. Falling back to page request",e]),this.onRedirect({to:this.href})):((e.redirect||e.live_redirect)&&(this.joinPending=!1,this.channel.leave()),e.redirect?this.onRedirect(e.redirect):e.live_redirect?this.onLiveRedirect(e.live_redirect):(this.log("error",()=>["unable to join",e]),this.liveSocket.reloadWithJitter(this)))}onClose(e){if(!this.isDestroyed()){if(this.isJoinPending()&&document.visibilityState!=="hidden"||this.liveSocket.hasPendingLink()&&e!=="leave")return this.liveSocket.reloadWithJitter(this);this.destroyAllChildren(),this.liveSocket.dropActiveElement(this),document.activeElement&&document.activeElement.blur(),this.liveSocket.isUnloaded()&&this.showLoader(vi)}}onError(e){this.onClose(e),this.log("error",()=>["view crashed",e]),this.liveSocket.isUnloaded()||this.displayError()}displayError(){this.isMain()&&l.dispatchEvent(window,"phx:page-loading-start",{to:this.href,kind:"error"}),this.showLoader(),this.setContainerClasses(Me,mt)}pushWithReply(e,t,i,n=function(){}){if(!this.isConnected())return;let[s,[r],o]=e?e():[null,[],{}],a=function(){};return(o.page_loading||r&&r.getAttribute(this.binding(ft))!==null)&&(a=this.liveSocket.withPageLoading({kind:"element",target:r})),typeof i.cid!="number"&&delete i.cid,this.liveSocket.wrapPush(this,{timeout:!0},()=>this.channel.push(t,i,yi).receive("ok",h=>{s!==null&&this.undoRefs(s);let d=f=>{h.redirect&&this.onRedirect(h.redirect),h.live_patch&&this.onLivePatch(h.live_patch),h.live_redirect&&this.onLiveRedirect(h.live_redirect),a(),n(h,f)};h.diff?this.liveSocket.requestDOMUpdate(()=>{let f=this.applyDiff("update",h.diff,({diff:p,events:v})=>{this.update(p,v)});d(f)}):d(null)}))}undoRefs(e){l.all(document,`[${G}="${this.id}"][${j}="${e}"]`,t=>{let i=t.getAttribute(Ae);t.removeAttribute(j),t.removeAttribute(G),t.getAttribute(Ue)!==null&&(t.readOnly=!1,t.removeAttribute(Ue)),i!==null&&(t.disabled=i==="true",t.removeAttribute(Ae)),It.forEach(r=>l.removeClass(t,r));let n=t.getAttribute(Ee);n!==null&&(t.innerText=n,t.removeAttribute(Ee));let s=l.private(t,j);if(s){let r=this.triggerBeforeUpdateHook(t,s);Pe.patchEl(t,s,this.liveSocket.getActiveElement()),r&&r.__updated(),l.deletePrivate(t,j)}})}putRef(e,t,i={}){let n=this.ref++,s=this.binding(Ge);return i.loading&&(e=e.concat(l.all(document,i.loading))),e.forEach(r=>{r.classList.add(`phx-${t}-loading`),r.setAttribute(j,n),r.setAttribute(G,this.el.id);let o=r.getAttribute(s);o!==null&&(r.getAttribute(Ee)||r.setAttribute(Ee,r.innerText),o!==""&&(r.innerText=o),r.setAttribute("disabled",""))}),[n,e,i]}componentID(e){let t=e.getAttribute&&e.getAttribute(L);return t?parseInt(t):null}targetComponentID(e,t,i={}){if(z(t))return t;let n=e.getAttribute(this.binding("target"));return z(n)?parseInt(n):t&&(n!==null||i.target)?this.closestComponentID(t):null}closestComponentID(e){return z(e)?e:e?F(e.closest(`[${L}]`),t=>this.ownsElement(t)&&this.componentID(t)):null}pushHookEvent(e,t,i,n){if(!this.isConnected())return this.log("hook",()=>["unable to push hook event. LiveView not connected",t,i]),!1;let[s,r,o]=this.putRef([],"hook");return this.pushWithReply(()=>[s,r,o],"event",{type:"hook",event:t,value:i,cid:this.closestComponentID(e)},(a,h)=>n(h,s)),s}extractMeta(e,t,i){let n=this.binding("value-");for(let s=0;s=0&&!e.checked&&delete t.value),i){t||(t={});for(let s in i)t[s]=i[s]}return t}pushEvent(e,t,i,n,s,r={}){this.pushWithReply(()=>this.putRef([t],e,r),"event",{type:e,event:n,value:this.extractMeta(t,s,r.value),cid:this.targetComponentID(t,i,r)})}pushFileProgress(e,t,i,n=function(){}){this.liveSocket.withinOwners(e.form,(s,r)=>{s.pushWithReply(null,"progress",{event:e.getAttribute(s.binding(gi)),ref:e.getAttribute(Y),entry_ref:t,progress:i,cid:s.targetComponentID(e.form,r)},n)})}pushInput(e,t,i,n,s,r){let o,a=z(i)?i:this.targetComponentID(e.form,t),h=()=>this.putRef([e,e.form],"change",s),d=Xe(e.form,{_target:s._target});l.isUploadInput(e)&&e.files&&e.files.length>0&&C.trackFiles(e,Array.from(e.files)),o=C.serializeUploads(e);let f={type:"form",event:n,value:d,uploads:o,cid:a};this.pushWithReply(h,"event",f,p=>{if(l.showError(e,this.liveSocket.binding(Ke)),l.isUploadInput(e)&&e.getAttribute("data-phx-auto-upload")!==null){if(C.filesAwaitingPreflight(e).length>0){let[v,u]=h();this.uploadFiles(e.form,t,v,a,m=>{r&&r(p),this.triggerAwaitingSubmit(e.form)})}}else r&&r(p)})}triggerAwaitingSubmit(e){let t=this.getScheduledSubmit(e);if(t){let[i,n,s,r]=t;this.cancelSubmit(e),r()}}getScheduledSubmit(e){return this.formSubmits.find(([t,i,n,s])=>t.isSameNode(e))}scheduleSubmit(e,t,i,n){if(this.getScheduledSubmit(e))return!0;this.formSubmits.push([e,t,i,n])}cancelSubmit(e){this.formSubmits=this.formSubmits.filter(([t,i,n])=>t.isSameNode(e)?(this.undoRefs(i),!1):!0)}pushFormSubmit(e,t,i,n,s){let r=p=>!(de(p,`${this.binding(Ye)}=ignore`,p.form)||de(p,"data-phx-update=ignore",p.form)),o=p=>p.hasAttribute(this.binding(Ge)),a=p=>p.tagName=="BUTTON",h=p=>["INPUT","TEXTAREA","SELECT"].includes(p.tagName),d=()=>{let p=Array.from(e.elements),v=p.filter(o),u=p.filter(a).filter(r),m=p.filter(h).filter(r);return u.forEach(g=>{g.setAttribute(Ae,g.disabled),g.disabled=!0}),m.forEach(g=>{g.setAttribute(Ue,g.readOnly),g.readOnly=!0,g.files&&(g.setAttribute(Ae,g.disabled),g.disabled=!0)}),e.setAttribute(this.binding(ft),""),this.putRef([e].concat(v).concat(u).concat(m),"submit",n)},f=this.targetComponentID(e,t);if(C.hasUploadsInProgress(e)){let[p,v]=d(),u=()=>this.pushFormSubmit(e,t,i,n,s);return this.scheduleSubmit(e,p,n,u)}else if(C.inputsAwaitingPreflight(e).length>0){let[p,v]=d(),u=()=>[p,v,n];this.uploadFiles(e,t,p,f,m=>{let g=Xe(e,{});this.pushWithReply(u,"event",{type:"form",event:i,value:g,cid:f},s)})}else{let p=Xe(e);this.pushWithReply(d,"event",{type:"form",event:i,value:p,cid:f},s)}}uploadFiles(e,t,i,n,s){let r=this.joinCount,o=C.activeFileInputs(e),a=o.length;o.forEach(h=>{let d=new C(h,this,()=>{a--,a===0&&s()});this.uploaders[h]=d;let f=d.entries().map(v=>v.toPreflightPayload()),p={ref:h.getAttribute(Y),entries:f,cid:this.targetComponentID(h.form,t)};this.log("upload",()=>["sending preflight request",p]),this.pushWithReply(null,"allow_upload",p,v=>{if(this.log("upload",()=>["got preflight response",v]),v.error){this.undoRefs(i);let[u,m]=v.error;this.log("upload",()=>[`error for entry ${u}`,m])}else{let u=m=>{this.channel.onError(()=>{this.joinCount===r&&m()})};d.initAdapterUpload(v,u,this.liveSocket)}})})}dispatchUploads(e,t){let i=l.findUploadInputs(this.el).filter(n=>n.name===e);i.length===0?_(`no live file inputs found matching the name "${e}"`):i.length>1?_(`duplicate live file inputs found matching the name "${e}"`):l.dispatchEvent(i[0],Dt,{files:t})}pushFormRecovery(e,t,i){this.liveSocket.withinOwners(e,(n,s)=>{let r=e.elements[0],o=e.getAttribute(this.binding(bt))||e.getAttribute(this.binding("change"));U.exec("change",o,n,r,["push",{_target:r.name,newCid:t,callback:i}])})}pushLinkPatch(e,t,i){let n=this.liveSocket.setPendingLink(e),s=t?()=>this.putRef([t],"click"):null,r=()=>this.liveSocket.redirect(window.location.href),o=this.pushWithReply(s,"live_patch",{url:e},a=>{this.liveSocket.requestDOMUpdate(()=>{a.link_redirect?this.liveSocket.replaceMain(e,null,i,n):(this.liveSocket.commitPendingLink(n)&&(this.href=e),this.applyPendingUpdates(),i&&i(n))})});o?o.receive("timeout",r):r()}formsForRecovery(e){if(this.joinCount===0)return[];let t=this.binding("change"),i=document.createElement("template");return i.innerHTML=e,l.all(this.el,`form[${t}]`).filter(n=>n.id&&this.ownsElement(n)).filter(n=>n.elements.length>0).filter(n=>n.getAttribute(this.binding(bt))!=="ignore").map(n=>{let s=i.content.querySelector(`form[id="${n.id}"][${t}="${n.getAttribute(t)}"]`);return s?[n,s,this.targetComponentID(s)]:[n,null,null]}).filter(([n,s,r])=>s)}maybePushComponentsDestroyed(e){let t=e.filter(i=>l.findComponentNodeList(this.el,i).length===0);t.length>0&&(this.pruningCIDs.push(...t),this.pushWithReply(null,"cids_will_destroy",{cids:t},()=>{this.pruningCIDs=this.pruningCIDs.filter(n=>t.indexOf(n)!==-1);let i=t.filter(n=>l.findComponentNodeList(this.el,n).length===0);i.length>0&&this.pushWithReply(null,"cids_destroyed",{cids:i},n=>{this.rendered.pruneCIDs(n.cids)})}))}ownsElement(e){return e.getAttribute(Z)===this.id||F(e.closest(ee),t=>t.id)===this.id}submitForm(e,t,i,n={}){l.putPrivate(e,Ht,!0);let s=this.liveSocket.binding(Ke),r=Array.from(e.elements);this.liveSocket.blurActiveElement(this),this.pushFormSubmit(e,t,i,n,()=>{r.forEach(o=>l.showError(o,s)),this.liveSocket.restorePreviouslyActiveFocus()})}binding(e){return this.liveSocket.binding(e)}},jt=class{constructor(e,t,i={}){if(this.unloaded=!1,!t||t.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 t(e,i),this.bindingPrefix=i.bindingPrefix||bi,this.opts=i,this.params=Be(i.params||{}),this.viewLogger=i.viewLogger,this.metadataCallbacks=i.metadata||{},this.defaults=Object.assign(Re(ki),i.defaults||{}),this.activeElement=null,this.prevActive=null,this.silenced=!1,this.main=null,this.linkRef=1,this.clickRef=1,this.roots={},this.href=window.location.href,this.pendingLink=null,this.currentLocation=Re(window.location),this.hooks=i.hooks||{},this.uploaders=i.uploaders||{},this.loaderTimeout=i.loaderTimeout||mi,this.maxReloads=i.maxReloads||ni,this.reloadJitterMin=i.reloadJitterMin||si,this.reloadJitterMax=i.reloadJitterMax||ri,this.failsafeJitter=i.failsafeJitter||oi,this.localStorage=i.localStorage||window.localStorage,this.sessionStorage=i.sessionStorage||window.sessionStorage,this.boundTopLevelEvents=!1,this.domCallbacks=Object.assign({onNodeAdded:Be(),onBeforeElUpdated:Be()},i.dom||{}),this.transitions=new Wi,window.addEventListener("pagehide",n=>{this.unloaded=!0}),this.socket.onOpen(()=>{this.isUnloaded()&&window.location.reload()})}isProfileEnabled(){return this.sessionStorage.getItem($e)==="true"}isDebugEnabled(){return this.sessionStorage.getItem(je)==="true"}enableDebug(){this.sessionStorage.setItem(je,"true")}enableProfiling(){this.sessionStorage.setItem($e,"true")}disableDebug(){this.sessionStorage.removeItem(je)}disableProfiling(){this.sessionStorage.removeItem($e)}enableLatencySim(e){this.enableDebug(),console.log("latency simulator enabled for the duration of this browser session. Call disableLatencySim() to disable"),this.sessionStorage.setItem(Fe,e)}disableLatencySim(){this.sessionStorage.removeItem(Fe)}getLatencySim(){let e=this.sessionStorage.getItem(Fe);return e?parseInt(e):null}getSocket(){return this.socket}connect(){let e=()=>{this.joinRootViews()&&(this.bindTopLevelEvents(),this.socket.connect())};["complete","loaded","interactive"].indexOf(document.readyState)>=0?e():document.addEventListener("DOMContentLoaded",()=>e())}disconnect(e){this.socket.disconnect(e)}execJS(e,t,i=null){this.owner(e,n=>U.exec(i,t,n,e))}triggerDOM(e,t){this.domCallbacks[e](...t)}time(e,t){if(!this.isProfileEnabled()||!console.time)return t();console.time(e);let i=t();return console.timeEnd(e),i}log(e,t,i){if(this.viewLogger){let[n,s]=i();this.viewLogger(e,t,n,s)}else if(this.isDebugEnabled()){let[n,s]=i();wi(e,t,n,s)}}requestDOMUpdate(e){this.transitions.after(e)}transition(e,t,i=function(){}){this.transitions.addTransition(e,t,i)}onChannel(e,t,i){e.on(t,n=>{let s=this.getLatencySim();s?(console.log(`simulating ${s}ms of latency from server to client`),setTimeout(()=>i(n),s)):i(n)})}wrapPush(e,t,i){let n=this.getLatencySim(),s=e.joinCount;if(!n)return t.timeout?i().receive("timeout",()=>{e.joinCount===s&&!e.isDestroyed()&&this.reloadWithJitter(e,()=>{this.log(e,"timeout",()=>["received timeout while communicating with server. Falling back to hard refresh for recovery"])})}):i();console.log(`simulating ${n}ms of latency from client to server`);let r={receives:[],receive(o,a){this.receives.push([o,a])}};return setTimeout(()=>{e.isDestroyed()||r.receives.reduce((o,[a,h])=>o.receive(a,h),i())},n),r}reloadWithJitter(e,t){e.destroy(),this.disconnect();let i=this.reloadJitterMin,n=this.reloadJitterMax,s=Math.floor(Math.random()*(n-i+1))+i,r=X.updateLocal(this.localStorage,window.location.pathname,xt,0,o=>o+1);t?t():this.log(e,"join",()=>[`encountered ${r} consecutive reloads`]),r>this.maxReloads&&(this.log(e,"join",()=>[`exceeded ${this.maxReloads} consecutive reloads. Entering failsafe mode`]),s=this.failsafeJitter),setTimeout(()=>{this.hasPendingLink()?window.location=this.pendingLink:window.location.reload()},s)}getHookCallbacks(e){return e&&e.startsWith("Phoenix.")?Ri[e.split(".")[1]]:this.hooks[e]}isUnloaded(){return this.unloaded}isConnected(){return this.socket.isConnected()}getBindingPrefix(){return this.bindingPrefix}binding(e){return`${this.getBindingPrefix()}${e}`}channel(e,t){return this.socket.channel(e,t)}joinRootViews(){let e=!1;return l.all(document,`${ee}:not([${Z}])`,t=>{if(!this.getRootById(t.id)){let i=this.newRootView(t);i.setHref(this.getHref()),i.join(),t.getAttribute(Ze)&&(this.main=i)}e=!0}),e}redirect(e,t){this.disconnect(),X.redirect(e,t)}replaceMain(e,t,i=null,n=this.setPendingLink(e)){let s=this.main.el,r=l.cloneNode(s,"");this.main.showLoader(this.loaderTimeout),this.main.destroy(),this.main=this.newRootView(r,t),this.main.setRedirect(e),this.transitionRemoves(),this.main.join((o,a)=>{o===1&&this.commitPendingLink(n)&&this.requestDOMUpdate(()=>{l.findPhxSticky(document).forEach(h=>r.appendChild(h)),s.replaceWith(r),i&&i(),a()})})}transitionRemoves(e){let t=this.binding("remove");e=e||l.all(document,`[${t}]`),e.forEach(i=>{document.body.contains(i)&&this.execJS(i,i.getAttribute(t),"remove")})}isPhxView(e){return e.getAttribute&&e.getAttribute(W)!==null}newRootView(e,t){let i=new Ut(e,this,null,t);return this.roots[i.id]=i,i}owner(e,t){let i=F(e.closest(ee),n=>this.getViewByEl(n))||this.main;i&&t(i)}withinOwners(e,t){this.owner(e,i=>t(i,e))}getViewByEl(e){let t=e.getAttribute(ce);return F(this.getRootById(t),i=>i.getDescendentByEl(e))}getRootById(e){return this.roots[e]}destroyAllViews(){for(let e in this.roots)this.roots[e].destroy(),delete this.roots[e]}destroyViewByEl(e){let t=this.getRootById(e.getAttribute(ce));t&&t.id===e.id?(t.destroy(),delete this.roots[t.id]):t&&t.destroyDescendent(e.id)}setActiveElement(e){if(this.activeElement===e)return;this.activeElement=e;let t=()=>{e===this.activeElement&&(this.activeElement=null),e.removeEventListener("mouseup",this),e.removeEventListener("touchend",this)};e.addEventListener("mouseup",t),e.addEventListener("touchend",t)}getActiveElement(){return document.activeElement===document.body?this.activeElement||document.activeElement:document.activeElement||document.body}dropActiveElement(e){this.prevActive&&e.ownsElement(this.prevActive)&&(this.prevActive=null)}restorePreviouslyActiveFocus(){this.prevActive&&this.prevActive!==document.body&&this.prevActive.focus()}blurActiveElement(){this.prevActive=this.getActiveElement(),this.prevActive!==document.body&&this.prevActive.blur()}bindTopLevelEvents(){this.boundTopLevelEvents||(this.boundTopLevelEvents=!0,this.socket.onClose(e=>{e.code===1e3&&this.main&&this.reloadWithJitter(this.main)}),document.body.addEventListener("click",function(){}),window.addEventListener("pageshow",e=>{e.persisted&&(this.getSocket().disconnect(),this.withPageLoading({to:window.location.href,kind:"redirect"}),window.location.reload())},!0),this.bindNav(),this.bindClicks(),this.bindForms(),this.bind({keyup:"keyup",keydown:"keydown"},(e,t,i,n,s,r)=>{let o=n.getAttribute(this.binding(pi)),a=e.key&&e.key.toLowerCase();if(o&&o.toLowerCase()!==a)return;let h=te({key:e.key},this.eventMeta(t,e,n));U.exec(t,s,i,n,["push",{data:h}])}),this.bind({blur:"focusout",focus:"focusin"},(e,t,i,n,s,r)=>{if(!r){let o=te({key:e.key},this.eventMeta(t,e,n));U.exec(t,s,i,n,["push",{data:o}])}}),this.bind({blur:"blur",focus:"focus"},(e,t,i,n,s,r,o)=>{if(o==="window"){let a=this.eventMeta(t,e,n);U.exec(t,r,i,n,["push",{data:a}])}}),window.addEventListener("dragover",e=>e.preventDefault()),window.addEventListener("drop",e=>{e.preventDefault();let t=F(de(e.target,this.binding(ct)),s=>s.getAttribute(this.binding(ct))),i=t&&document.getElementById(t),n=Array.from(e.dataTransfer.files||[]);!i||i.disabled||n.length===0||!(i.files instanceof FileList)||(C.trackFiles(i,n),i.dispatchEvent(new Event("input",{bubbles:!0})))}),this.on(Dt,e=>{let t=e.target;if(!l.isUploadInput(t))return;let i=Array.from(e.detail.files||[]).filter(n=>n instanceof File||n instanceof Blob);C.trackFiles(t,i),t.dispatchEvent(new Event("input",{bubbles:!0}))}))}eventMeta(e,t,i){let n=this.metadataCallbacks[e];return n?n(t,i):{}}setPendingLink(e){return this.linkRef++,this.pendingLink=e,this.linkRef}commitPendingLink(e){return this.linkRef!==e?!1:(this.href=this.pendingLink,this.pendingLink=null,!0)}getHref(){return this.href}hasPendingLink(){return!!this.pendingLink}bind(e,t){for(let i in e){let n=e[i];this.on(n,s=>{let r=this.binding(i),o=this.binding(`window-${i}`),a=s.target.getAttribute&&s.target.getAttribute(r);a?this.debounce(s.target,s,()=>{this.withinOwners(s.target,h=>{t(s,i,h,s.target,a,null)})}):l.all(document,`[${o}]`,h=>{let d=h.getAttribute(o);this.debounce(h,s,()=>{this.withinOwners(h,f=>{t(s,i,f,h,d,"window")})})})})}}bindClicks(){this.bindClick("click","click",!1),this.bindClick("mousedown","capture-click",!0)}bindClick(e,t,i){let n=this.binding(t);window.addEventListener(e,s=>{if(!this.isConnected())return;this.clickRef++;let r=this.clickRef,o=null;i?o=s.target.matches(`[${n}]`)?s.target:s.target.querySelector(`[${n}]`):(o=de(s.target,n),this.dispatchClickAway(s,r));let a=o&&o.getAttribute(n);a&&(o.getAttribute("href")==="#"&&s.preventDefault(),this.debounce(o,s,()=>{this.withinOwners(o,h=>{U.exec("click",a,h,o,["push",{data:this.eventMeta("click",s,o)}])})}))},i)}dispatchClickAway(e,t){let i=this.binding("click-away"),n=this.binding("click");l.all(document,`[${i}]`,s=>{s.isSameNode(e.target)||s.contains(e.target)||this.withinOwners(e.target,r=>{let o=s.getAttribute(i);if(U.isVisible(s)){let a=e.target.closest(`[${n}]`)||e.target;U.exec("click",o,r,s,["push",{data:this.eventMeta("click",e,e.target)}])}})})}bindNav(){if(!X.canPushState())return;history.scrollRestoration&&(history.scrollRestoration="manual");let e=null;window.addEventListener("scroll",t=>{clearTimeout(e),e=setTimeout(()=>{X.updateCurrentState(i=>Object.assign(i,{scroll:window.scrollY}))},100)}),window.addEventListener("popstate",t=>{if(!this.registerNewLocation(window.location))return;let{type:i,id:n,root:s,scroll:r}=t.state||{},o=window.location.href;this.requestDOMUpdate(()=>{this.main.isConnected()&&i==="patch"&&n===this.main.id?this.main.pushLinkPatch(o,null):this.replaceMain(o,null,()=>{s&&this.replaceRootHistory(),typeof r=="number"&&setTimeout(()=>{window.scrollTo(0,r)},0)})})},!1),window.addEventListener("click",t=>{let i=de(t.target,He),n=i&&i.getAttribute(He),s=t.metaKey||t.ctrlKey||t.button===1;if(!n||!this.isConnected()||!this.main||s)return;let r=i.href,o=i.getAttribute(hi);t.preventDefault(),this.pendingLink!==r&&this.requestDOMUpdate(()=>{if(n==="patch")this.pushHistoryPatch(r,o,i);else if(n==="redirect")this.historyRedirect(r,o);else throw new Error(`expected ${He} to be "patch" or "redirect", got: ${n}`)})},!1)}dispatchEvent(e,t={}){l.dispatchEvent(window,`phx:${e}`,t)}dispatchEvents(e){e.forEach(([t,i])=>this.dispatchEvent(t,i))}withPageLoading(e,t){l.dispatchEvent(window,"phx:page-loading-start",e);let i=()=>l.dispatchEvent(window,"phx:page-loading-stop",e);return t?t(i):i}pushHistoryPatch(e,t,i){this.withPageLoading({to:e,kind:"patch"},n=>{this.main.pushLinkPatch(e,i,s=>{this.historyPatch(e,t,s),n()})})}historyPatch(e,t,i=this.setPendingLink(e)){this.commitPendingLink(i)&&(X.pushState(t,{type:"patch",id:this.main.id},e),this.registerNewLocation(window.location))}historyRedirect(e,t,i){let n=window.scrollY;this.withPageLoading({to:e,kind:"redirect"},s=>{this.replaceMain(e,i,()=>{X.pushState(t,{type:"redirect",id:this.main.id,scroll:n},e),this.registerNewLocation(window.location),s()})})}replaceRootHistory(){X.pushState("replace",{root:!0,type:"patch",id:this.main.id})}registerNewLocation(e){let{pathname:t,search:i}=this.currentLocation;return t+i===e.pathname+e.search?!1:(this.currentLocation=Re(e),!0)}bindForms(){let e=0;this.on("submit",t=>{let i=t.target.getAttribute(this.binding("submit"));i&&(t.preventDefault(),t.target.disabled=!0,this.withinOwners(t.target,n=>{U.exec("submit",i,n,t.target,["push",{}])}))},!1);for(let t of["change","input"])this.on(t,i=>{let n=i.target,s=n.form&&n.form.getAttribute(this.binding("change"));if(!s||n.type==="number"&&n.validity&&n.validity.badInput)return;let r=e;e++;let{at:o,type:a}=l.private(n,"prev-iteration")||{};o===r-1&&t!==a||(l.putPrivate(n,"prev-iteration",{at:r,type:t}),this.debounce(n,i,()=>{this.withinOwners(n.form,h=>{l.putPrivate(n,Ot,!0),l.isTextualInput(n)||this.setActiveElement(n),U.exec("change",s,h,n,["push",{_target:i.target.name}])})}))},!1)}debounce(e,t,i){let n=this.binding(ui),s=this.binding(fi),r=this.defaults.debounce.toString(),o=this.defaults.throttle.toString();l.debounce(e,t,n,r,s,o,i)}silenceEvents(e){this.silenced=!0,e(),this.silenced=!1}on(e,t){window.addEventListener(e,i=>{this.silenced||t(i)})}},Wi=class{constructor(){this.transitions=new Set,this.pendingOps=[],this.reset()}reset(){this.transitions.forEach(e=>{cancelTimeout(e),this.transitions.delete(e)}),this.flushPendingOps()}after(e){this.size()===0?e():this.pushPendingOp(e)}addTransition(e,t,i){t();let n=setTimeout(()=>{this.transitions.delete(n),i(),this.size()===0&&this.flushPendingOps()},e);this.transitions.add(n)}pushPendingOp(e){this.pendingOps.push(e)}size(){return this.transitions.size}flushPendingOps(){this.pendingOps.forEach(e=>e()),this.pendingOps=[]}};var qi=document.querySelector("html").getAttribute("phx-socket")||"/live",Ki=document.querySelector("meta[name='csrf-token']").getAttribute("content"),q={},$t={};q.JsonEditor={mounted(){let e=this.el.getAttribute("data-input-id"),t=this;this.editor=new JSONEditor(this.el,{onChangeText:i=>{let n=document.getElementById(e);try{JSON.parse(i),n.value=i,n.dispatchEvent(new Event("change",{bubbles:!0}))}catch(s){}},onChange:()=>{try{let i=document.getElementById(e);json=t.editor.get(),i.value=JSON.stringify(json),i.dispatchEvent(new Event("change",{bubbles:!0}))}catch(i){}},onModeChange:i=>{t.mode=i},modes:["text","tree"]},JSON.parse(document.getElementById(e).value)),$t[this.el.id]=this.editor}};q.JsonEditorSource={updated(){try{let e=$t[this.el.getAttribute("data-editor-id")];e.getMode()==="tree"?e.update(JSON.parse(this.el.value)):e.get()!==JSON.parse(this.el.value)&&e.setText(this.el.value)}catch(e){}}};q.JsonView={updated(){let e=JSON.parse(this.el.getAttribute("data-json"));this.editor=new JSONEditor(this.el,{mode:"preview"},e)},mounted(){let e=JSON.parse(this.el.getAttribute("data-json"));this.editor=new JSONEditor(this.el,{mode:"preview"},e)}};var Gi=e=>new EasyMDE({element:e,initialValue:e.getAttribute("value")});q.MarkdownEditor={mounted(){let e=this.el.getAttribute("data-target-id"),t=document.getElementById(e),i=Gi(t);i.codemirror.on("change",()=>{t.value=i.value(),t.dispatchEvent(new Event("change",{bubbles:!0}))})}};q.Actor={mounted(){this.handleEvent("set_actor",e=>{document.cookie="actor_resource="+e.resource+";path=/",document.cookie="actor_primary_key="+e.primary_key+";path=/",document.cookie="actor_action="+e.action+";path=/",document.cookie="actor_api="+e.api+";path=/"}),this.handleEvent("clear_actor",()=>{document.cookie="actor_resource=;path=/",document.cookie="actor_primary_key=;path=/",document.cookie="actor_action;path=/",document.cookie="actor_api=;path=/",document.cookie="actor_authorizing=false;path=/",document.cookie="actor_paused=true;path=/"}),this.handleEvent("toggle_authorizing",e=>{document.cookie="actor_authorizing="+e.authorizing+";path=/"}),this.handleEvent("toggle_actor_paused",e=>{document.cookie="actor_paused="+e.actor_paused+";path=/"}),this.pushEvent("set_actor_from_session",{actor_resource:document.cookie.actor_resource,actor_primary_key:document.cookie.actor_primary_key,actor_action:document.cookie.actor_action,actor_api:document.cookie.actor_api,actor_authorizing:document.cookie.actor_authorizing,actor_paused:document.cookie.actor_paused})}};q.Tenant={mounted(){this.handleEvent("set_tenant",e=>{document.cookie="tenant="+e.tenant+";path=/"}),this.handleEvent("clear_tenant",()=>{document.cookie="tenant=;path=/"})}};q.MaintainAttrs={attrs(){return this.el.getAttribute("data-attrs").split(", ")},beforeUpdate(){this.prevAttrs=this.attrs().map(e=>[e,this.el.getAttribute(e)])},updated(){this.prevAttrs.forEach(([e,t])=>this.el.setAttribute(e,t))}};var et=new jt(qi,ht,{params:{_csrf_token:Ki},hooks:q,dom:{onBeforeElUpdated(e,t){e._x_dataStack&&window.Alpine.clone(e,t)}}});Le.default.config({barColors:{0:"#29d"},shadowColor:"rgba(0, 0, 0, .3)"});window.addEventListener("phx:page-loading-start",e=>Le.default.show(300));window.addEventListener("phx:page-loading-stop",e=>Le.default.hide());et.connect()>>et.enableDebug();window.liveSocket=et;})();
+/**
+ * @license MIT
+ * topbar 2.0.0, 2023-02-04
+ * https://buunguyen.github.io/topbar
+ * Copyright (c) 2021 Buu Nguyen
+ */
diff --git a/priv/static/assets/app-c9fc8078e7bd6db471c3dfa3fcebe839.js.gz b/priv/static/assets/app-c9fc8078e7bd6db471c3dfa3fcebe839.js.gz
new file mode 100644
index 0000000..64af25a
Binary files /dev/null and b/priv/static/assets/app-c9fc8078e7bd6db471c3dfa3fcebe839.js.gz differ
diff --git a/priv/static/assets/app.css b/priv/static/assets/app.css
index 2dee839..c68de13 100644
--- a/priv/static/assets/app.css
+++ b/priv/static/assets/app.css
@@ -1,2328 +1 @@
-/*
-! tailwindcss v3.3.2 | 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.
-*/
-
-html {
- 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, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", 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 */
-}
-
-/*
-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. 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-size: 1em;
- /* 2 */
-}
-
-/*
-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-size: 100%;
- /* 1 */
- font-weight: inherit;
- /* 1 */
- line-height: 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,
-[type='button'],
-[type='reset'],
-[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;
-}
-
-/*
-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: ;
-}
-
-::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: ;
-}
-
-.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;
- }
-}
-
-.hero-arrow-left-solid {
- --hero-arrow-left-solid: url('data:image/svg+xml;utf8,');
- -webkit-mask: var(--hero-arrow-left-solid);
- mask: var(--hero-arrow-left-solid);
- -webkit-mask-repeat: no-repeat;
- mask-repeat: no-repeat;
- background-color: currentColor;
- vertical-align: middle;
- display: inline-block;
- width: 1.25rem;
- height: 1.25rem;
-}
-
-.hero-arrow-path {
- --hero-arrow-path: url('data:image/svg+xml;utf8,');
- -webkit-mask: var(--hero-arrow-path);
- mask: var(--hero-arrow-path);
- -webkit-mask-repeat: no-repeat;
- mask-repeat: no-repeat;
- background-color: currentColor;
- vertical-align: middle;
- display: inline-block;
- width: 1.25rem;
- height: 1.25rem;
-}
-
-.hero-check {
- --hero-check: url('data:image/svg+xml;utf8,');
- -webkit-mask: var(--hero-check);
- mask: var(--hero-check);
- -webkit-mask-repeat: no-repeat;
- mask-repeat: no-repeat;
- background-color: currentColor;
- vertical-align: middle;
- display: inline-block;
- width: 1.25rem;
- height: 1.25rem;
-}
-
-.hero-exclamation-circle-mini {
- --hero-exclamation-circle-mini: url('data:image/svg+xml;utf8,');
- -webkit-mask: var(--hero-exclamation-circle-mini);
- mask: var(--hero-exclamation-circle-mini);
- -webkit-mask-repeat: no-repeat;
- mask-repeat: no-repeat;
- background-color: currentColor;
- vertical-align: middle;
- display: inline-block;
- width: 1.25rem;
- height: 1.25rem;
-}
-
-.hero-information-circle-mini {
- --hero-information-circle-mini: url('data:image/svg+xml;utf8,');
- -webkit-mask: var(--hero-information-circle-mini);
- mask: var(--hero-information-circle-mini);
- -webkit-mask-repeat: no-repeat;
- mask-repeat: no-repeat;
- background-color: currentColor;
- vertical-align: middle;
- display: inline-block;
- width: 1.25rem;
- height: 1.25rem;
-}
-
-.hero-information-circle-solid {
- --hero-information-circle-solid: url('data:image/svg+xml;utf8,');
- -webkit-mask: var(--hero-information-circle-solid);
- mask: var(--hero-information-circle-solid);
- -webkit-mask-repeat: no-repeat;
- mask-repeat: no-repeat;
- background-color: currentColor;
- vertical-align: middle;
- display: inline-block;
- width: 1.25rem;
- height: 1.25rem;
-}
-
-.hero-key {
- --hero-key: url('data:image/svg+xml;utf8,');
- -webkit-mask: var(--hero-key);
- mask: var(--hero-key);
- -webkit-mask-repeat: no-repeat;
- mask-repeat: no-repeat;
- background-color: currentColor;
- vertical-align: middle;
- display: inline-block;
- width: 1.25rem;
- height: 1.25rem;
-}
-
-.hero-key-solid {
- --hero-key-solid: url('data:image/svg+xml;utf8,');
- -webkit-mask: var(--hero-key-solid);
- mask: var(--hero-key-solid);
- -webkit-mask-repeat: no-repeat;
- mask-repeat: no-repeat;
- background-color: currentColor;
- vertical-align: middle;
- display: inline-block;
- width: 1.25rem;
- height: 1.25rem;
-}
-
-.hero-magnifying-glass-circle {
- --hero-magnifying-glass-circle: url('data:image/svg+xml;utf8,');
- -webkit-mask: var(--hero-magnifying-glass-circle);
- mask: var(--hero-magnifying-glass-circle);
- -webkit-mask-repeat: no-repeat;
- mask-repeat: no-repeat;
- background-color: currentColor;
- vertical-align: middle;
- display: inline-block;
- width: 1.25rem;
- height: 1.25rem;
-}
-
-.hero-minus {
- --hero-minus: url('data:image/svg+xml;utf8,');
- -webkit-mask: var(--hero-minus);
- mask: var(--hero-minus);
- -webkit-mask-repeat: no-repeat;
- mask-repeat: no-repeat;
- background-color: currentColor;
- vertical-align: middle;
- display: inline-block;
- width: 1.25rem;
- height: 1.25rem;
-}
-
-.hero-pencil-solid {
- --hero-pencil-solid: url('data:image/svg+xml;utf8,');
- -webkit-mask: var(--hero-pencil-solid);
- mask: var(--hero-pencil-solid);
- -webkit-mask-repeat: no-repeat;
- mask-repeat: no-repeat;
- background-color: currentColor;
- vertical-align: middle;
- display: inline-block;
- width: 1.25rem;
- height: 1.25rem;
-}
-
-.hero-plus {
- --hero-plus: url('data:image/svg+xml;utf8,');
- -webkit-mask: var(--hero-plus);
- mask: var(--hero-plus);
- -webkit-mask-repeat: no-repeat;
- mask-repeat: no-repeat;
- background-color: currentColor;
- vertical-align: middle;
- display: inline-block;
- width: 1.25rem;
- height: 1.25rem;
-}
-
-.hero-x-circle-solid {
- --hero-x-circle-solid: url('data:image/svg+xml;utf8,');
- -webkit-mask: var(--hero-x-circle-solid);
- mask: var(--hero-x-circle-solid);
- -webkit-mask-repeat: no-repeat;
- mask-repeat: no-repeat;
- background-color: currentColor;
- vertical-align: middle;
- display: inline-block;
- width: 1.25rem;
- height: 1.25rem;
-}
-
-.hero-x-mark {
- --hero-x-mark: url('data:image/svg+xml;utf8,');
- -webkit-mask: var(--hero-x-mark);
- mask: var(--hero-x-mark);
- -webkit-mask-repeat: no-repeat;
- mask-repeat: no-repeat;
- background-color: currentColor;
- vertical-align: middle;
- display: inline-block;
- width: 1.25rem;
- height: 1.25rem;
-}
-
-.hero-x-mark-solid {
- --hero-x-mark-solid: url('data:image/svg+xml;utf8,');
- -webkit-mask: var(--hero-x-mark-solid);
- mask: var(--hero-x-mark-solid);
- -webkit-mask-repeat: no-repeat;
- mask-repeat: no-repeat;
- background-color: currentColor;
- vertical-align: middle;
- display: inline-block;
- width: 1.25rem;
- height: 1.25rem;
-}
-
-.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;
-}
-
-.static {
- position: static;
-}
-
-.fixed {
- position: fixed;
-}
-
-.absolute {
- position: absolute;
-}
-
-.relative {
- position: relative;
-}
-
-.inset-0 {
- inset: 0px;
-}
-
-.-inset-y-px {
- top: -1px;
- bottom: -1px;
-}
-
-.-left-4 {
- left: -1rem;
-}
-
-.-right-4 {
- right: -1rem;
-}
-
-.left-0 {
- left: 0px;
-}
-
-.right-0 {
- right: 0px;
-}
-
-.right-1 {
- right: 0.25rem;
-}
-
-.right-2 {
- right: 0.5rem;
-}
-
-.right-5 {
- right: 1.25rem;
-}
-
-.top-1 {
- top: 0.25rem;
-}
-
-.top-2 {
- top: 0.5rem;
-}
-
-.top-6 {
- top: 1.5rem;
-}
-
-.z-0 {
- z-index: 0;
-}
-
-.z-10 {
- z-index: 10;
-}
-
-.z-50 {
- z-index: 50;
-}
-
-.col-span-2 {
- grid-column: span 2 / span 2;
-}
-
-.col-span-3 {
- grid-column: span 3 / span 3;
-}
-
-.col-span-6 {
- grid-column: span 6 / span 6;
-}
-
-.col-span-full {
- grid-column: 1 / -1;
-}
-
-.float-right {
- float: right;
-}
-
-.-m-3 {
- margin: -0.75rem;
-}
-
-.m-2 {
- margin: 0.5rem;
-}
-
-.m-5 {
- margin: 1.25rem;
-}
-
-.-my-4 {
- margin-top: -1rem;
- margin-bottom: -1rem;
-}
-
-.mx-12 {
- margin-left: 3rem;
- margin-right: 3rem;
-}
-
-.mx-24 {
- margin-left: 6rem;
- margin-right: 6rem;
-}
-
-.mx-auto {
- margin-left: auto;
- margin-right: auto;
-}
-
-.my-4 {
- margin-top: 1rem;
- margin-bottom: 1rem;
-}
-
-.-mr-1 {
- margin-right: -0.25rem;
-}
-
-.-mr-2 {
- margin-right: -0.5rem;
-}
-
-.mb-10 {
- margin-bottom: 2.5rem;
-}
-
-.mb-2 {
- margin-bottom: 0.5rem;
-}
-
-.mb-4 {
- margin-bottom: 1rem;
-}
-
-.ml-1 {
- margin-left: 0.25rem;
-}
-
-.ml-10 {
- margin-left: 2.5rem;
-}
-
-.ml-12 {
- margin-left: 3rem;
-}
-
-.ml-2 {
- margin-left: 0.5rem;
-}
-
-.ml-3 {
- margin-left: 0.75rem;
-}
-
-.ml-4 {
- margin-left: 1rem;
-}
-
-.mr-1 {
- margin-right: 0.25rem;
-}
-
-.mr-4 {
- margin-right: 1rem;
-}
-
-.mr-5 {
- margin-right: 1.25rem;
-}
-
-.mt-0 {
- margin-top: 0px;
-}
-
-.mt-0\.5 {
- margin-top: 0.125rem;
-}
-
-.mt-1 {
- margin-top: 0.25rem;
-}
-
-.mt-10 {
- margin-top: 2.5rem;
-}
-
-.mt-11 {
- margin-top: 2.75rem;
-}
-
-.mt-14 {
- margin-top: 3.5rem;
-}
-
-.mt-16 {
- margin-top: 4rem;
-}
-
-.mt-2 {
- margin-top: 0.5rem;
-}
-
-.mt-3 {
- margin-top: 0.75rem;
-}
-
-.mt-4 {
- margin-top: 1rem;
-}
-
-.mt-5 {
- margin-top: 1.25rem;
-}
-
-.block {
- display: block;
-}
-
-.flex {
- display: flex;
-}
-
-.inline-flex {
- display: inline-flex;
-}
-
-.table {
- display: table;
-}
-
-.grid {
- display: grid;
-}
-
-.hidden {
- display: none;
-}
-
-.h-16 {
- height: 4rem;
-}
-
-.h-3 {
- height: 0.75rem;
-}
-
-.h-4 {
- height: 1rem;
-}
-
-.h-5 {
- height: 1.25rem;
-}
-
-.h-6 {
- height: 1.5rem;
-}
-
-.h-full {
- height: 100%;
-}
-
-.h-max {
- height: -moz-max-content;
- height: max-content;
-}
-
-.h-screen {
- height: 100vh;
-}
-
-.min-h-\[6rem\] {
- min-height: 6rem;
-}
-
-.min-h-full {
- min-height: 100%;
-}
-
-.min-h-screen {
- min-height: 100vh;
-}
-
-.w-1\/4 {
- width: 25%;
-}
-
-.w-14 {
- width: 3.5rem;
-}
-
-.w-3 {
- width: 0.75rem;
-}
-
-.w-4 {
- width: 1rem;
-}
-
-.w-5 {
- width: 1.25rem;
-}
-
-.w-5\/6 {
- width: 83.333333%;
-}
-
-.w-56 {
- width: 14rem;
-}
-
-.w-6 {
- width: 1.5rem;
-}
-
-.w-80 {
- width: 20rem;
-}
-
-.w-\[40rem\] {
- width: 40rem;
-}
-
-.w-full {
- width: 100%;
-}
-
-.max-w-3xl {
- max-width: 48rem;
-}
-
-.max-w-none {
- max-width: none;
-}
-
-.max-w-sm {
- max-width: 24rem;
-}
-
-.flex-1 {
- flex: 1 1 0%;
-}
-
-.flex-none {
- flex: none;
-}
-
-.flex-shrink-0 {
- flex-shrink: 0;
-}
-
-.table-auto {
- table-layout: auto;
-}
-
-.origin-top-right {
- transform-origin: top right;
-}
-
-.-translate-y-3 {
- --tw-translate-y: -0.75rem;
- transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
-}
-
-.translate-y-0 {
- --tw-translate-y: 0px;
- transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
-}
-
-.translate-y-4 {
- --tw-translate-y: 1rem;
- transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
-}
-
-.transform {
- transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
-}
-
-@keyframes spin {
- to {
- transform: rotate(360deg);
- }
-}
-
-.animate-spin {
- animation: spin 1s linear infinite;
-}
-
-.resize-y {
- resize: vertical;
-}
-
-.grid-cols-1 {
- grid-template-columns: repeat(1, minmax(0, 1fr));
-}
-
-.grid-cols-6 {
- grid-template-columns: repeat(6, minmax(0, 1fr));
-}
-
-.content-center {
- align-content: center;
-}
-
-.items-center {
- align-items: center;
-}
-
-.justify-center {
- justify-content: center;
-}
-
-.justify-between {
- justify-content: space-between;
-}
-
-.justify-items-center {
- justify-items: center;
-}
-
-.gap-1 {
- gap: 0.25rem;
-}
-
-.gap-1\.5 {
- gap: 0.375rem;
-}
-
-.gap-3 {
- gap: 0.75rem;
-}
-
-.gap-4 {
- gap: 1rem;
-}
-
-.gap-6 {
- gap: 1.5rem;
-}
-
-.-space-x-px > :not([hidden]) ~ :not([hidden]) {
- --tw-space-x-reverse: 0;
- margin-right: calc(-1px * var(--tw-space-x-reverse));
- margin-left: calc(-1px * calc(1 - var(--tw-space-x-reverse)));
-}
-
-.space-x-1 > :not([hidden]) ~ :not([hidden]) {
- --tw-space-x-reverse: 0;
- margin-right: calc(0.25rem * var(--tw-space-x-reverse));
- margin-left: calc(0.25rem * calc(1 - var(--tw-space-x-reverse)));
-}
-
-.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));
-}
-
-.divide-y > :not([hidden]) ~ :not([hidden]) {
- --tw-divide-y-reverse: 0;
- border-top-width: calc(1px * calc(1 - var(--tw-divide-y-reverse)));
- border-bottom-width: calc(1px * var(--tw-divide-y-reverse));
-}
-
-.divide-gray-100 > :not([hidden]) ~ :not([hidden]) {
- --tw-divide-opacity: 1;
- border-color: rgb(243 244 246 / var(--tw-divide-opacity));
-}
-
-.divide-zinc-100 > :not([hidden]) ~ :not([hidden]) {
- --tw-divide-opacity: 1;
- border-color: rgb(244 244 245 / var(--tw-divide-opacity));
-}
-
-.overflow-auto {
- overflow: auto;
-}
-
-.overflow-hidden {
- overflow: hidden;
-}
-
-.overflow-scroll {
- overflow: scroll;
-}
-
-.overflow-y-auto {
- overflow-y: auto;
-}
-
-.whitespace-nowrap {
- white-space: nowrap;
-}
-
-.rounded {
- border-radius: 0.25rem;
-}
-
-.rounded-2xl {
- border-radius: 1rem;
-}
-
-.rounded-lg {
- border-radius: 0.5rem;
-}
-
-.rounded-md {
- border-radius: 0.375rem;
-}
-
-.rounded-l-md {
- border-top-left-radius: 0.375rem;
- border-bottom-left-radius: 0.375rem;
-}
-
-.rounded-r-md {
- border-top-right-radius: 0.375rem;
- border-bottom-right-radius: 0.375rem;
-}
-
-.rounded-t {
- border-top-left-radius: 0.25rem;
- border-top-right-radius: 0.25rem;
-}
-
-.rounded-t-lg {
- border-top-left-radius: 0.5rem;
- border-top-right-radius: 0.5rem;
-}
-
-.border {
- border-width: 1px;
-}
-
-.border-b-2 {
- border-bottom-width: 2px;
-}
-
-.border-t {
- border-top-width: 1px;
-}
-
-.border-gray-200 {
- --tw-border-opacity: 1;
- border-color: rgb(229 231 235 / var(--tw-border-opacity));
-}
-
-.border-gray-300 {
- --tw-border-opacity: 1;
- border-color: rgb(209 213 219 / var(--tw-border-opacity));
-}
-
-.border-gray-600 {
- --tw-border-opacity: 1;
- border-color: rgb(75 85 99 / var(--tw-border-opacity));
-}
-
-.border-rose-400 {
- --tw-border-opacity: 1;
- border-color: rgb(251 113 133 / var(--tw-border-opacity));
-}
-
-.border-transparent {
- border-color: transparent;
-}
-
-.border-zinc-200 {
- --tw-border-opacity: 1;
- border-color: rgb(228 228 231 / var(--tw-border-opacity));
-}
-
-.border-zinc-300 {
- --tw-border-opacity: 1;
- border-color: rgb(212 212 216 / var(--tw-border-opacity));
-}
-
-.bg-emerald-50 {
- --tw-bg-opacity: 1;
- background-color: rgb(236 253 245 / var(--tw-bg-opacity));
-}
-
-.bg-gray-200 {
- --tw-bg-opacity: 1;
- background-color: rgb(229 231 235 / var(--tw-bg-opacity));
-}
-
-.bg-gray-300 {
- --tw-bg-opacity: 1;
- background-color: rgb(209 213 219 / 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-indigo-600 {
- --tw-bg-opacity: 1;
- background-color: rgb(79 70 229 / var(--tw-bg-opacity));
-}
-
-.bg-rose-50 {
- --tw-bg-opacity: 1;
- background-color: rgb(255 241 242 / var(--tw-bg-opacity));
-}
-
-.bg-white {
- --tw-bg-opacity: 1;
- background-color: rgb(255 255 255 / var(--tw-bg-opacity));
-}
-
-.bg-zinc-50\/90 {
- background-color: rgb(250 250 250 / 0.9);
-}
-
-.bg-zinc-900 {
- --tw-bg-opacity: 1;
- background-color: rgb(24 24 27 / var(--tw-bg-opacity));
-}
-
-.fill-cyan-900 {
- fill: #164e63;
-}
-
-.fill-rose-900 {
- fill: #881337;
-}
-
-.p-0 {
- padding: 0px;
-}
-
-.p-14 {
- padding: 3.5rem;
-}
-
-.p-2 {
- padding: 0.5rem;
-}
-
-.p-3 {
- padding: 0.75rem;
-}
-
-.p-4 {
- padding: 1rem;
-}
-
-.px-2 {
- padding-left: 0.5rem;
- padding-right: 0.5rem;
-}
-
-.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-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-5 {
- padding-top: 1.25rem;
- padding-bottom: 1.25rem;
-}
-
-.py-8 {
- padding-top: 2rem;
- padding-bottom: 2rem;
-}
-
-.pb-20 {
- padding-bottom: 5rem;
-}
-
-.pb-3 {
- padding-bottom: 0.75rem;
-}
-
-.pb-4 {
- padding-bottom: 1rem;
-}
-
-.pl-2 {
- padding-left: 0.5rem;
-}
-
-.pl-4 {
- padding-left: 1rem;
-}
-
-.pr-2 {
- padding-right: 0.5rem;
-}
-
-.pr-4 {
- padding-right: 1rem;
-}
-
-.pr-6 {
- padding-right: 1.5rem;
-}
-
-.pt-2 {
- padding-top: 0.5rem;
-}
-
-.pt-4 {
- padding-top: 1rem;
-}
-
-.text-left {
- text-align: left;
-}
-
-.text-right {
- text-align: right;
-}
-
-.text-3xl {
- font-size: 1.875rem;
- line-height: 2.25rem;
-}
-
-.text-base {
- font-size: 1rem;
- line-height: 1.5rem;
-}
-
-.text-lg {
- font-size: 1.125rem;
- line-height: 1.75rem;
-}
-
-.text-sm {
- font-size: 0.875rem;
- line-height: 1.25rem;
-}
-
-.text-xs {
- font-size: 0.75rem;
- line-height: 1rem;
-}
-
-.font-medium {
- font-weight: 500;
-}
-
-.font-normal {
- font-weight: 400;
-}
-
-.font-semibold {
- font-weight: 600;
-}
-
-.capitalize {
- text-transform: capitalize;
-}
-
-.italic {
- font-style: italic;
-}
-
-.leading-5 {
- line-height: 1.25rem;
-}
-
-.leading-6 {
- line-height: 1.5rem;
-}
-
-.leading-8 {
- line-height: 2rem;
-}
-
-.text-black {
- --tw-text-opacity: 1;
- color: rgb(0 0 0 / var(--tw-text-opacity));
-}
-
-.text-emerald-800 {
- --tw-text-opacity: 1;
- color: rgb(6 95 70 / 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-600 {
- --tw-text-opacity: 1;
- color: rgb(75 85 99 / 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-red-500 {
- --tw-text-opacity: 1;
- color: rgb(239 68 68 / var(--tw-text-opacity));
-}
-
-.text-rose-600 {
- --tw-text-opacity: 1;
- color: rgb(225 29 72 / var(--tw-text-opacity));
-}
-
-.text-rose-900 {
- --tw-text-opacity: 1;
- color: rgb(136 19 55 / var(--tw-text-opacity));
-}
-
-.text-white {
- --tw-text-opacity: 1;
- color: rgb(255 255 255 / var(--tw-text-opacity));
-}
-
-.text-zinc-500 {
- --tw-text-opacity: 1;
- color: rgb(113 113 122 / var(--tw-text-opacity));
-}
-
-.text-zinc-600 {
- --tw-text-opacity: 1;
- color: rgb(82 82 91 / var(--tw-text-opacity));
-}
-
-.text-zinc-700 {
- --tw-text-opacity: 1;
- color: rgb(63 63 70 / var(--tw-text-opacity));
-}
-
-.text-zinc-800 {
- --tw-text-opacity: 1;
- color: rgb(39 39 42 / var(--tw-text-opacity));
-}
-
-.text-zinc-900 {
- --tw-text-opacity: 1;
- color: rgb(24 24 27 / var(--tw-text-opacity));
-}
-
-.opacity-0 {
- opacity: 0;
-}
-
-.opacity-100 {
- opacity: 1;
-}
-
-.opacity-20 {
- opacity: 0.2;
-}
-
-.opacity-40 {
- opacity: 0.4;
-}
-
-.shadow-lg {
- --tw-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
- --tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);
- box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
-}
-
-.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);
-}
-
-.shadow-sm {
- --tw-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
- --tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);
- box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
-}
-
-.shadow-zinc-700\/10 {
- --tw-shadow-color: rgb(63 63 70 / 0.1);
- --tw-shadow: var(--tw-shadow-colored);
-}
-
-.outline {
- outline-style: solid;
-}
-
-.ring-1 {
- --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, 0 0 #0000);
-}
-
-.ring-black {
- --tw-ring-opacity: 1;
- --tw-ring-color: rgb(0 0 0 / var(--tw-ring-opacity));
-}
-
-.ring-emerald-500 {
- --tw-ring-opacity: 1;
- --tw-ring-color: rgb(16 185 129 / var(--tw-ring-opacity));
-}
-
-.ring-rose-500 {
- --tw-ring-opacity: 1;
- --tw-ring-color: rgb(244 63 94 / var(--tw-ring-opacity));
-}
-
-.ring-zinc-700\/10 {
- --tw-ring-color: rgb(63 63 70 / 0.1);
-}
-
-.ring-opacity-5 {
- --tw-ring-opacity: 0.05;
-}
-
-.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);
-}
-
-.transition {
- transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, -webkit-backdrop-filter;
- transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;
- transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter, -webkit-backdrop-filter;
- transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
- transition-duration: 150ms;
-}
-
-.transition-all {
- transition-property: all;
- transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
- transition-duration: 150ms;
-}
-
-.transition-opacity {
- transition-property: opacity;
- transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
- transition-duration: 150ms;
-}
-
-.duration-150 {
- transition-duration: 150ms;
-}
-
-.duration-200 {
- transition-duration: 200ms;
-}
-
-.duration-300 {
- transition-duration: 300ms;
-}
-
-.ease-in {
- transition-timing-function: cubic-bezier(0.4, 0, 1, 1);
-}
-
-.ease-out {
- transition-timing-function: cubic-bezier(0, 0, 0.2, 1);
-}
-
-.hover\:cursor-pointer:hover {
- cursor: pointer;
-}
-
-.hover\:bg-gray-100:hover {
- --tw-bg-opacity: 1;
- background-color: rgb(243 244 246 / var(--tw-bg-opacity));
-}
-
-.hover\:bg-gray-200:hover {
- --tw-bg-opacity: 1;
- background-color: rgb(229 231 235 / var(--tw-bg-opacity));
-}
-
-.hover\:bg-gray-300:hover {
- --tw-bg-opacity: 1;
- background-color: rgb(209 213 219 / var(--tw-bg-opacity));
-}
-
-.hover\:bg-gray-400:hover {
- --tw-bg-opacity: 1;
- background-color: rgb(156 163 175 / var(--tw-bg-opacity));
-}
-
-.hover\:bg-gray-50:hover {
- --tw-bg-opacity: 1;
- background-color: rgb(249 250 251 / 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-gray-900:hover {
- --tw-bg-opacity: 1;
- background-color: rgb(17 24 39 / var(--tw-bg-opacity));
-}
-
-.hover\:bg-indigo-700:hover {
- --tw-bg-opacity: 1;
- background-color: rgb(67 56 202 / var(--tw-bg-opacity));
-}
-
-.hover\:bg-zinc-50:hover {
- --tw-bg-opacity: 1;
- background-color: rgb(250 250 250 / var(--tw-bg-opacity));
-}
-
-.hover\:bg-zinc-700:hover {
- --tw-bg-opacity: 1;
- background-color: rgb(63 63 70 / var(--tw-bg-opacity));
-}
-
-.hover\:text-blue-400:hover {
- --tw-text-opacity: 1;
- color: rgb(96 165 250 / var(--tw-text-opacity));
-}
-
-.hover\:text-gray-500:hover {
- --tw-text-opacity: 1;
- color: rgb(107 114 128 / var(--tw-text-opacity));
-}
-
-.hover\:text-gray-900:hover {
- --tw-text-opacity: 1;
- color: rgb(17 24 39 / var(--tw-text-opacity));
-}
-
-.hover\:text-white:hover {
- --tw-text-opacity: 1;
- color: rgb(255 255 255 / var(--tw-text-opacity));
-}
-
-.hover\:text-zinc-700:hover {
- --tw-text-opacity: 1;
- color: rgb(63 63 70 / var(--tw-text-opacity));
-}
-
-.hover\:underline:hover {
- text-decoration-line: underline;
-}
-
-.hover\:opacity-40:hover {
- opacity: 0.4;
-}
-
-.focus\:border-indigo-500:focus {
- --tw-border-opacity: 1;
- border-color: rgb(99 102 241 / var(--tw-border-opacity));
-}
-
-.focus\:border-rose-400:focus {
- --tw-border-opacity: 1;
- border-color: rgb(251 113 133 / var(--tw-border-opacity));
-}
-
-.focus\:border-zinc-400:focus {
- --tw-border-opacity: 1;
- border-color: rgb(161 161 170 / var(--tw-border-opacity));
-}
-
-.focus\:bg-gray-700:focus {
- --tw-bg-opacity: 1;
- background-color: rgb(55 65 81 / var(--tw-bg-opacity));
-}
-
-.focus\:text-white:focus {
- --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-0: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(0px + 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-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-indigo-500:focus {
- --tw-ring-opacity: 1;
- --tw-ring-color: rgb(99 102 241 / var(--tw-ring-opacity));
-}
-
-.focus\:ring-offset-2:focus {
- --tw-ring-offset-width: 2px;
-}
-
-.focus\:ring-offset-gray-100:focus {
- --tw-ring-offset-color: #f3f4f6;
-}
-
-.active\:text-white\/80:active {
- color: rgb(255 255 255 / 0.8);
-}
-
-.group:hover .group-hover\:bg-zinc-50 {
- --tw-bg-opacity: 1;
- background-color: rgb(250 250 250 / var(--tw-bg-opacity));
-}
-
-.group:hover .group-hover\:opacity-70 {
- opacity: 0.7;
-}
-
-.phx-no-feedback.phx-no-feedback\:hidden {
- display: none;
-}
-
-.phx-no-feedback.phx-no-feedback\:border-zinc-300 {
- --tw-border-opacity: 1;
- border-color: rgb(212 212 216 / var(--tw-border-opacity));
-}
-
-.phx-no-feedback.phx-no-feedback\:focus\:border-zinc-400:focus {
- --tw-border-opacity: 1;
- border-color: rgb(161 161 170 / var(--tw-border-opacity));
-}
-
-.phx-no-feedback .phx-no-feedback\:hidden {
- display: none;
-}
-
-.phx-no-feedback .phx-no-feedback\:border-zinc-300 {
- --tw-border-opacity: 1;
- border-color: rgb(212 212 216 / var(--tw-border-opacity));
-}
-
-.phx-no-feedback .phx-no-feedback\:focus\:border-zinc-400:focus {
- --tw-border-opacity: 1;
- border-color: rgb(161 161 170 / var(--tw-border-opacity));
-}
-
-.phx-submit-loading.phx-submit-loading\:opacity-75 {
- opacity: 0.75;
-}
-
-.phx-submit-loading .phx-submit-loading\:opacity-75 {
- opacity: 0.75;
-}
-
-@media (min-width: 640px) {
- .sm\:col-span-2 {
- grid-column: span 2 / span 2;
- }
-
- .sm\:col-span-3 {
- grid-column: span 3 / span 3;
- }
-
- .sm\:col-span-full {
- grid-column: 1 / -1;
- }
-
- .sm\:mt-0 {
- margin-top: 0px;
- }
-
- .sm\:block {
- display: block;
- }
-
- .sm\:flex {
- display: flex;
- }
-
- .sm\:hidden {
- display: none;
- }
-
- .sm\:w-96 {
- width: 24rem;
- }
-
- .sm\:w-full {
- width: 100%;
- }
-
- .sm\:flex-1 {
- flex: 1 1 0%;
- }
-
- .sm\:translate-y-0 {
- --tw-translate-y: 0px;
- transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
- }
-
- .sm\:scale-100 {
- --tw-scale-x: 1;
- --tw-scale-y: 1;
- transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
- }
-
- .sm\:scale-95 {
- --tw-scale-x: .95;
- --tw-scale-y: .95;
- transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
- }
-
- .sm\:items-center {
- align-items: center;
- }
-
- .sm\:justify-between {
- justify-content: space-between;
- }
-
- .sm\:gap-8 {
- gap: 2rem;
- }
-
- .sm\:overflow-visible {
- overflow: visible;
- }
-
- .sm\:rounded-md {
- border-radius: 0.375rem;
- }
-
- .sm\:rounded-l-xl {
- border-top-left-radius: 0.75rem;
- border-bottom-left-radius: 0.75rem;
- }
-
- .sm\:rounded-r-xl {
- border-top-right-radius: 0.75rem;
- border-bottom-right-radius: 0.75rem;
- }
-
- .sm\:p-6 {
- padding: 1.5rem;
- }
-
- .sm\:px-0 {
- padding-left: 0px;
- padding-right: 0px;
- }
-
- .sm\:px-3 {
- padding-left: 0.75rem;
- padding-right: 0.75rem;
- }
-
- .sm\:px-6 {
- padding-left: 1.5rem;
- padding-right: 1.5rem;
- }
-
- .sm\:text-sm {
- font-size: 0.875rem;
- line-height: 1.25rem;
- }
-
- .sm\:leading-6 {
- line-height: 1.5rem;
- }
-}
-
-@media (min-width: 768px) {
- .md\:col-span-2 {
- grid-column: span 2 / span 2;
- }
-
- .md\:mx-16 {
- margin-left: 4rem;
- margin-right: 4rem;
- }
-
- .md\:mx-4 {
- margin-left: 1rem;
- margin-right: 1rem;
- }
-
- .md\:mt-0 {
- margin-top: 0px;
- }
-
- .md\:mt-10 {
- margin-top: 2.5rem;
- }
-
- .md\:block {
- display: block;
- }
-
- .md\:grid {
- display: grid;
- }
-
- .md\:hidden {
- display: none;
- }
-
- .md\:grid-cols-3 {
- grid-template-columns: repeat(3, minmax(0, 1fr));
- }
-
- .md\:gap-6 {
- gap: 1.5rem;
- }
-
- .md\:pt-10 {
- padding-top: 2.5rem;
- }
-}
-
-@media (min-width: 1024px) {
- .lg\:px-8 {
- padding-left: 2rem;
- padding-right: 2rem;
- }
-
- .lg\:py-8 {
- padding-top: 2rem;
- padding-bottom: 2rem;
- }
-}
-
+/*! tailwindcss v3.3.2 | MIT License | https://tailwindcss.com*/*,:after,:before{border:0 solid #e5e7eb;box-sizing:border-box}:after,:before{--tw-content:""}html{-webkit-text-size-adjust:100%;font-feature-settings:normal;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-variation-settings:normal;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4}body{line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:initial}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{color:inherit;font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button;background-color:initial;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:initial}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{color:#9ca3af;opacity:1}input::placeholder,textarea::placeholder{color:#9ca3af;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]{display:none}[multiple],[type=date],[type=datetime-local],[type=email],[type=month],[type=number],[type=password],[type=search],[type=tel],[type=text],[type=time],[type=url],[type=week],select,textarea{--tw-shadow:0 0 #0000;-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:#fff;border-color:#6b7280;border-radius:0;border-width:1px;font-size:1rem;line-height:1.5rem;padding:.5rem .75rem}[multiple]:focus,[type=date]:focus,[type=datetime-local]:focus,[type=email]:focus,[type=month]:focus,[type=number]:focus,[type=password]:focus,[type=search]:focus,[type=tel]:focus,[type=text]:focus,[type=time]:focus,[type=url]:focus,[type=week]:focus,select:focus,textarea:focus{--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);border-color:#2563eb;box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);outline:2px solid #0000;outline-offset:2px}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-day-field,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-meridiem-field,::-webkit-datetime-edit-millisecond-field,::-webkit-datetime-edit-minute-field,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-second-field,::-webkit-datetime-edit-year-field{padding-bottom:0;padding-top:0}select{background-image:url("data:image/svg+xml;charset=utf-8,%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 8 4 4 4-4'/%3E%3C/svg%3E");background-position:right .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:none;background-position:0 0;background-repeat:unset;background-size:initial;padding-right:.75rem;-webkit-print-color-adjust:unset;print-color-adjust:unset}[type=checkbox],[type=radio]{--tw-shadow:0 0 #0000;-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:#fff;background-origin:border-box;border-color:#6b7280;border-width:1px;color:#2563eb;display:inline-block;flex-shrink:0;height:1rem;padding:0;-webkit-print-color-adjust:exact;print-color-adjust:exact;-webkit-user-select:none;-moz-user-select:none;user-select:none;vertical-align:middle;width:1rem}[type=checkbox]{border-radius:0}[type=radio]{border-radius:100%}[type=checkbox]:focus,[type=radio]:focus{--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);outline:2px solid #0000;outline-offset:2px}[type=checkbox]:checked,[type=radio]:checked{background-color:currentColor;background-position:50%;background-repeat:no-repeat;background-size:100% 100%;border-color:#0000}[type=checkbox]:checked{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23fff' viewBox='0 0 16 16'%3E%3Cpath d='M12.207 4.793a1 1 0 0 1 0 1.414l-5 5a1 1 0 0 1-1.414 0l-2-2a1 1 0 0 1 1.414-1.414L6.5 9.086l4.293-4.293a1 1 0 0 1 1.414 0z'/%3E%3C/svg%3E")}[type=radio]:checked{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23fff' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='3'/%3E%3C/svg%3E")}[type=checkbox]:checked:focus,[type=checkbox]:checked:hover,[type=checkbox]:indeterminate,[type=radio]:checked:focus,[type=radio]:checked:hover{background-color:currentColor;border-color:#0000}[type=checkbox]:indeterminate{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 16 16'%3E%3Cpath stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M4 8h8'/%3E%3C/svg%3E");background-position:50%;background-repeat:no-repeat;background-size:100% 100%}[type=checkbox]:indeterminate:focus,[type=checkbox]:indeterminate:hover{background-color:currentColor;border-color:#0000}[type=file]{background:unset;border-color:inherit;border-radius:0;border-width:0;font-size:unset;line-height:inherit;padding:0}[type=file]:focus{outline:1px solid ButtonText;outline:1px auto -webkit-focus-ring-color}*,::backdrop,:after,:before{--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:#3b82f680;--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: }.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}}.hero-arrow-left-solid{--hero-arrow-left-solid:url('data:image/svg+xml;utf8,');-webkit-mask:var(--hero-arrow-left-solid);mask:var(--hero-arrow-left-solid);-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.hero-arrow-left-solid,.hero-arrow-path{background-color:currentColor;display:inline-block;height:1.25rem;vertical-align:middle;width:1.25rem}.hero-arrow-path{--hero-arrow-path:url('data:image/svg+xml;utf8,');-webkit-mask:var(--hero-arrow-path);mask:var(--hero-arrow-path);-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.hero-check{--hero-check:url('data:image/svg+xml;utf8,');-webkit-mask:var(--hero-check);mask:var(--hero-check);-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.hero-check,.hero-exclamation-circle-mini{background-color:currentColor;display:inline-block;height:1.25rem;vertical-align:middle;width:1.25rem}.hero-exclamation-circle-mini{--hero-exclamation-circle-mini:url('data:image/svg+xml;utf8,');-webkit-mask:var(--hero-exclamation-circle-mini);mask:var(--hero-exclamation-circle-mini);-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.hero-information-circle-mini{--hero-information-circle-mini:url('data:image/svg+xml;utf8,');-webkit-mask:var(--hero-information-circle-mini);mask:var(--hero-information-circle-mini);-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.hero-information-circle-mini,.hero-information-circle-solid{background-color:currentColor;display:inline-block;height:1.25rem;vertical-align:middle;width:1.25rem}.hero-information-circle-solid{--hero-information-circle-solid:url('data:image/svg+xml;utf8,');-webkit-mask:var(--hero-information-circle-solid);mask:var(--hero-information-circle-solid);-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.hero-key{--hero-key:url('data:image/svg+xml;utf8,');-webkit-mask:var(--hero-key);mask:var(--hero-key);-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.hero-key,.hero-key-solid{background-color:currentColor;display:inline-block;height:1.25rem;vertical-align:middle;width:1.25rem}.hero-key-solid{--hero-key-solid:url('data:image/svg+xml;utf8,');-webkit-mask:var(--hero-key-solid);mask:var(--hero-key-solid);-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.hero-magnifying-glass-circle{--hero-magnifying-glass-circle:url('data:image/svg+xml;utf8,');-webkit-mask:var(--hero-magnifying-glass-circle);mask:var(--hero-magnifying-glass-circle);-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.hero-magnifying-glass-circle,.hero-minus{background-color:currentColor;display:inline-block;height:1.25rem;vertical-align:middle;width:1.25rem}.hero-minus{--hero-minus:url('data:image/svg+xml;utf8,');-webkit-mask:var(--hero-minus);mask:var(--hero-minus);-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.hero-pencil-solid{--hero-pencil-solid:url('data:image/svg+xml;utf8,');-webkit-mask:var(--hero-pencil-solid);mask:var(--hero-pencil-solid);-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.hero-pencil-solid,.hero-plus{background-color:currentColor;display:inline-block;height:1.25rem;vertical-align:middle;width:1.25rem}.hero-plus{--hero-plus:url('data:image/svg+xml;utf8,');-webkit-mask:var(--hero-plus);mask:var(--hero-plus);-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.hero-x-circle-solid{--hero-x-circle-solid:url('data:image/svg+xml;utf8,');-webkit-mask:var(--hero-x-circle-solid);mask:var(--hero-x-circle-solid);-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.hero-x-circle-solid,.hero-x-mark{background-color:currentColor;display:inline-block;height:1.25rem;vertical-align:middle;width:1.25rem}.hero-x-mark{--hero-x-mark:url('data:image/svg+xml;utf8,');-webkit-mask:var(--hero-x-mark);mask:var(--hero-x-mark);-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.hero-x-mark-solid{--hero-x-mark-solid:url('data:image/svg+xml;utf8,');background-color:currentColor;display:inline-block;height:1.25rem;-webkit-mask:var(--hero-x-mark-solid);mask:var(--hero-x-mark-solid);-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;vertical-align:middle;width:1.25rem}.sr-only{clip:rect(0,0,0,0);border-width:0;height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.inset-0{inset:0}.-inset-y-px{bottom:-1px;top:-1px}.-left-4{left:-1rem}.-right-4{right:-1rem}.left-0{left:0}.right-0{right:0}.right-1{right:.25rem}.right-2{right:.5rem}.right-5{right:1.25rem}.top-1{top:.25rem}.top-2{top:.5rem}.top-6{top:1.5rem}.z-0{z-index:0}.z-10{z-index:10}.z-50{z-index:50}.col-span-2{grid-column:span 2/span 2}.col-span-3{grid-column:span 3/span 3}.col-span-6{grid-column:span 6/span 6}.col-span-full{grid-column:1/-1}.float-right{float:right}.-m-3{margin:-.75rem}.m-2{margin:.5rem}.m-5{margin:1.25rem}.-my-4{margin-bottom:-1rem;margin-top:-1rem}.mx-12{margin-left:3rem;margin-right:3rem}.mx-24{margin-left:6rem;margin-right:6rem}.mx-auto{margin-left:auto;margin-right:auto}.my-4{margin-bottom:1rem;margin-top:1rem}.-mr-1{margin-right:-.25rem}.-mr-2{margin-right:-.5rem}.mb-10{margin-bottom:2.5rem}.mb-2{margin-bottom:.5rem}.mb-4{margin-bottom:1rem}.ml-1{margin-left:.25rem}.ml-10{margin-left:2.5rem}.ml-12{margin-left:3rem}.ml-2{margin-left:.5rem}.ml-3{margin-left:.75rem}.ml-4{margin-left:1rem}.mr-1{margin-right:.25rem}.mr-4{margin-right:1rem}.mr-5{margin-right:1.25rem}.mt-0{margin-top:0}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-10{margin-top:2.5rem}.mt-11{margin-top:2.75rem}.mt-14{margin-top:3.5rem}.mt-16{margin-top:4rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-5{margin-top:1.25rem}.block{display:block}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.h-16{height:4rem}.h-3{height:.75rem}.h-4{height:1rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-full{height:100%}.h-max{height:-moz-max-content;height:max-content}.h-screen{height:100vh}.min-h-\[6rem\]{min-height:6rem}.min-h-full{min-height:100%}.min-h-screen{min-height:100vh}.w-1\/4{width:25%}.w-14{width:3.5rem}.w-3{width:.75rem}.w-4{width:1rem}.w-5{width:1.25rem}.w-5\/6{width:83.333333%}.w-56{width:14rem}.w-6{width:1.5rem}.w-80{width:20rem}.w-\[40rem\]{width:40rem}.w-full{width:100%}.max-w-3xl{max-width:48rem}.max-w-none{max-width:none}.max-w-sm{max-width:24rem}.flex-1{flex:1 1 0%}.flex-none{flex:none}.flex-shrink-0{flex-shrink:0}.table-auto{table-layout:auto}.origin-top-right{transform-origin:top right}.-translate-y-3{--tw-translate-y:-0.75rem}.-translate-y-3,.translate-y-0{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-0{--tw-translate-y:0px}.translate-y-4{--tw-translate-y:1rem}.transform,.translate-y-4{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes spin{to{transform:rotate(1turn)}}.animate-spin{animation:spin 1s linear infinite}.resize-y{resize:vertical}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.content-center{align-content:center}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.justify-items-center{justify-items:center}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.-space-x-px>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(-1px*(1 - var(--tw-space-x-reverse)));margin-right:calc(-1px*var(--tw-space-x-reverse))}.space-x-1>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(.25rem*(1 - var(--tw-space-x-reverse)));margin-right:calc(.25rem*var(--tw-space-x-reverse))}.space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(2rem*var(--tw-space-y-reverse));margin-top:calc(2rem*(1 - var(--tw-space-y-reverse)))}.divide-y>:not([hidden])~:not([hidden]){--tw-divide-y-reverse:0;border-bottom-width:calc(1px*var(--tw-divide-y-reverse));border-top-width:calc(1px*(1 - var(--tw-divide-y-reverse)))}.divide-gray-100>:not([hidden])~:not([hidden]){--tw-divide-opacity:1;border-color:rgb(243 244 246/var(--tw-divide-opacity))}.divide-zinc-100>:not([hidden])~:not([hidden]){--tw-divide-opacity:1;border-color:rgb(244 244 245/var(--tw-divide-opacity))}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-scroll{overflow:scroll}.overflow-y-auto{overflow-y:auto}.whitespace-nowrap{white-space:nowrap}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:1rem}.rounded-lg{border-radius:.5rem}.rounded-md{border-radius:.375rem}.rounded-l-md{border-bottom-left-radius:.375rem;border-top-left-radius:.375rem}.rounded-r-md{border-bottom-right-radius:.375rem;border-top-right-radius:.375rem}.rounded-t{border-top-left-radius:.25rem;border-top-right-radius:.25rem}.rounded-t-lg{border-top-left-radius:.5rem;border-top-right-radius:.5rem}.border{border-width:1px}.border-b-2{border-bottom-width:2px}.border-t{border-top-width:1px}.border-gray-200{--tw-border-opacity:1;border-color:rgb(229 231 235/var(--tw-border-opacity))}.border-gray-300{--tw-border-opacity:1;border-color:rgb(209 213 219/var(--tw-border-opacity))}.border-gray-600{--tw-border-opacity:1;border-color:rgb(75 85 99/var(--tw-border-opacity))}.border-rose-400{--tw-border-opacity:1;border-color:rgb(251 113 133/var(--tw-border-opacity))}.border-transparent{border-color:#0000}.border-zinc-200{--tw-border-opacity:1;border-color:rgb(228 228 231/var(--tw-border-opacity))}.border-zinc-300{--tw-border-opacity:1;border-color:rgb(212 212 216/var(--tw-border-opacity))}.bg-emerald-50{--tw-bg-opacity:1;background-color:rgb(236 253 245/var(--tw-bg-opacity))}.bg-gray-200{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity))}.bg-gray-300{--tw-bg-opacity:1;background-color:rgb(209 213 219/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-indigo-600{--tw-bg-opacity:1;background-color:rgb(79 70 229/var(--tw-bg-opacity))}.bg-rose-50{--tw-bg-opacity:1;background-color:rgb(255 241 242/var(--tw-bg-opacity))}.bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}.bg-zinc-50\/90{background-color:#fafafae6}.bg-zinc-900{--tw-bg-opacity:1;background-color:rgb(24 24 27/var(--tw-bg-opacity))}.fill-cyan-900{fill:#164e63}.fill-rose-900{fill:#881337}.p-0{padding:0}.p-14{padding:3.5rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.py-1{padding-bottom:.25rem;padding-top:.25rem}.py-2{padding-bottom:.5rem;padding-top:.5rem}.py-3{padding-bottom:.75rem;padding-top:.75rem}.py-4{padding-bottom:1rem;padding-top:1rem}.py-5{padding-bottom:1.25rem;padding-top:1.25rem}.py-8{padding-bottom:2rem;padding-top:2rem}.pb-20{padding-bottom:5rem}.pb-3{padding-bottom:.75rem}.pb-4{padding-bottom:1rem}.pl-2{padding-left:.5rem}.pl-4{padding-left:1rem}.pr-2{padding-right:.5rem}.pr-4{padding-right:1rem}.pr-6{padding-right:1.5rem}.pt-2{padding-top:.5rem}.pt-4{padding-top:1rem}.text-left{text-align:left}.text-right{text-align:right}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xs{font-size:.75rem;line-height:1rem}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.capitalize{text-transform:capitalize}.italic{font-style:italic}.leading-5{line-height:1.25rem}.leading-6{line-height:1.5rem}.leading-8{line-height:2rem}.text-black{--tw-text-opacity:1;color:rgb(0 0 0/var(--tw-text-opacity))}.text-emerald-800{--tw-text-opacity:1;color:rgb(6 95 70/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-600{--tw-text-opacity:1;color:rgb(75 85 99/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-red-500{--tw-text-opacity:1;color:rgb(239 68 68/var(--tw-text-opacity))}.text-rose-600{--tw-text-opacity:1;color:rgb(225 29 72/var(--tw-text-opacity))}.text-rose-900{--tw-text-opacity:1;color:rgb(136 19 55/var(--tw-text-opacity))}.text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}.text-zinc-500{--tw-text-opacity:1;color:rgb(113 113 122/var(--tw-text-opacity))}.text-zinc-600{--tw-text-opacity:1;color:rgb(82 82 91/var(--tw-text-opacity))}.text-zinc-700{--tw-text-opacity:1;color:rgb(63 63 70/var(--tw-text-opacity))}.text-zinc-800{--tw-text-opacity:1;color:rgb(39 39 42/var(--tw-text-opacity))}.text-zinc-900{--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity))}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-20{opacity:.2}.opacity-40{opacity:.4}.shadow-lg{--tw-shadow:0 10px 15px -3px #0000001a,0 4px 6px -4px #0000001a;--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color)}.shadow-lg,.shadow-md{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px #0000001a,0 2px 4px -2px #0000001a;--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color),0 2px 4px -2px var(--tw-shadow-color)}.shadow-sm{--tw-shadow:0 1px 2px 0 #0000000d;--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.shadow-zinc-700\/10{--tw-shadow-color:#3f3f461a;--tw-shadow:var(--tw-shadow-colored)}.outline{outline-style:solid}.ring-1{--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,0 0 #0000)}.ring-black{--tw-ring-opacity:1;--tw-ring-color:rgb(0 0 0/var(--tw-ring-opacity))}.ring-emerald-500{--tw-ring-opacity:1;--tw-ring-color:rgb(16 185 129/var(--tw-ring-opacity))}.ring-rose-500{--tw-ring-opacity:1;--tw-ring-color:rgb(244 63 94/var(--tw-ring-opacity))}.ring-zinc-700\/10{--tw-ring-color:#3f3f461a}.ring-opacity-5{--tw-ring-opacity:0.05}.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)}.transition{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-all{transition-duration:.15s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1)}.duration-150,.transition-opacity{transition-duration:.15s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.ease-in{transition-timing-function:cubic-bezier(.4,0,1,1)}.ease-out{transition-timing-function:cubic-bezier(0,0,.2,1)}.hover\:cursor-pointer:hover{cursor:pointer}.hover\:bg-gray-100:hover{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity))}.hover\:bg-gray-200:hover{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity))}.hover\:bg-gray-300:hover{--tw-bg-opacity:1;background-color:rgb(209 213 219/var(--tw-bg-opacity))}.hover\:bg-gray-400:hover{--tw-bg-opacity:1;background-color:rgb(156 163 175/var(--tw-bg-opacity))}.hover\:bg-gray-50:hover{--tw-bg-opacity:1;background-color:rgb(249 250 251/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-gray-900:hover{--tw-bg-opacity:1;background-color:rgb(17 24 39/var(--tw-bg-opacity))}.hover\:bg-indigo-700:hover{--tw-bg-opacity:1;background-color:rgb(67 56 202/var(--tw-bg-opacity))}.hover\:bg-zinc-50:hover{--tw-bg-opacity:1;background-color:rgb(250 250 250/var(--tw-bg-opacity))}.hover\:bg-zinc-700:hover{--tw-bg-opacity:1;background-color:rgb(63 63 70/var(--tw-bg-opacity))}.hover\:text-blue-400:hover{--tw-text-opacity:1;color:rgb(96 165 250/var(--tw-text-opacity))}.hover\:text-gray-500:hover{--tw-text-opacity:1;color:rgb(107 114 128/var(--tw-text-opacity))}.hover\:text-gray-900:hover{--tw-text-opacity:1;color:rgb(17 24 39/var(--tw-text-opacity))}.hover\:text-white:hover{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}.hover\:text-zinc-700:hover{--tw-text-opacity:1;color:rgb(63 63 70/var(--tw-text-opacity))}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-40:hover{opacity:.4}.focus\:border-indigo-500:focus{--tw-border-opacity:1;border-color:rgb(99 102 241/var(--tw-border-opacity))}.focus\:border-rose-400:focus{--tw-border-opacity:1;border-color:rgb(251 113 133/var(--tw-border-opacity))}.focus\:border-zinc-400:focus{--tw-border-opacity:1;border-color:rgb(161 161 170/var(--tw-border-opacity))}.focus\:bg-gray-700:focus{--tw-bg-opacity:1;background-color:rgb(55 65 81/var(--tw-bg-opacity))}.focus\:text-white:focus{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}.focus\:outline-none:focus{outline:2px solid #0000;outline-offset:2px}.focus\:ring-0: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(var(--tw-ring-offset-width)) var(--tw-ring-color)}.focus\:ring-0:focus,.focus\:ring-2:focus{box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.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)}.focus\:ring-indigo-500:focus{--tw-ring-opacity:1;--tw-ring-color:rgb(99 102 241/var(--tw-ring-opacity))}.focus\:ring-offset-2:focus{--tw-ring-offset-width:2px}.focus\:ring-offset-gray-100:focus{--tw-ring-offset-color:#f3f4f6}.active\:text-white\/80:active{color:#fffc}.group:hover .group-hover\:bg-zinc-50{--tw-bg-opacity:1;background-color:rgb(250 250 250/var(--tw-bg-opacity))}.group:hover .group-hover\:opacity-70{opacity:.7}.phx-no-feedback.phx-no-feedback\:hidden{display:none}.phx-no-feedback.phx-no-feedback\:border-zinc-300{--tw-border-opacity:1;border-color:rgb(212 212 216/var(--tw-border-opacity))}.phx-no-feedback.phx-no-feedback\:focus\:border-zinc-400:focus{--tw-border-opacity:1;border-color:rgb(161 161 170/var(--tw-border-opacity))}.phx-no-feedback .phx-no-feedback\:hidden{display:none}.phx-no-feedback .phx-no-feedback\:border-zinc-300{--tw-border-opacity:1;border-color:rgb(212 212 216/var(--tw-border-opacity))}.phx-no-feedback .phx-no-feedback\:focus\:border-zinc-400:focus{--tw-border-opacity:1;border-color:rgb(161 161 170/var(--tw-border-opacity))}.phx-submit-loading .phx-submit-loading\:opacity-75,.phx-submit-loading.phx-submit-loading\:opacity-75{opacity:.75}@media (min-width:640px){.sm\:col-span-2{grid-column:span 2/span 2}.sm\:col-span-3{grid-column:span 3/span 3}.sm\:col-span-full{grid-column:1/-1}.sm\:mt-0{margin-top:0}.sm\:block{display:block}.sm\:flex{display:flex}.sm\:hidden{display:none}.sm\:w-96{width:24rem}.sm\:w-full{width:100%}.sm\:flex-1{flex:1 1 0%}.sm\:translate-y-0{--tw-translate-y:0px}.sm\:scale-100,.sm\:translate-y-0{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.sm\:scale-100{--tw-scale-x:1;--tw-scale-y:1}.sm\:scale-95{--tw-scale-x:.95;--tw-scale-y:.95;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.sm\:items-center{align-items:center}.sm\:justify-between{justify-content:space-between}.sm\:gap-8{gap:2rem}.sm\:overflow-visible{overflow:visible}.sm\:rounded-md{border-radius:.375rem}.sm\:rounded-l-xl{border-bottom-left-radius:.75rem;border-top-left-radius:.75rem}.sm\:rounded-r-xl{border-bottom-right-radius:.75rem;border-top-right-radius:.75rem}.sm\:p-6{padding:1.5rem}.sm\:px-0{padding-left:0;padding-right:0}.sm\:px-3{padding-left:.75rem;padding-right:.75rem}.sm\:px-6{padding-left:1.5rem;padding-right:1.5rem}.sm\:text-sm{font-size:.875rem;line-height:1.25rem}.sm\:leading-6{line-height:1.5rem}}@media (min-width:768px){.md\:col-span-2{grid-column:span 2/span 2}.md\:mx-16{margin-left:4rem;margin-right:4rem}.md\:mx-4{margin-left:1rem;margin-right:1rem}.md\:mt-0{margin-top:0}.md\:mt-10{margin-top:2.5rem}.md\:block{display:block}.md\:grid{display:grid}.md\:hidden{display:none}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:gap-6{gap:1.5rem}.md\:pt-10{padding-top:2.5rem}}@media (min-width:1024px){.lg\:px-8{padding-left:2rem;padding-right:2rem}.lg\:py-8{padding-bottom:2rem;padding-top:2rem}}
\ No newline at end of file
diff --git a/priv/static/assets/app.css.gz b/priv/static/assets/app.css.gz
new file mode 100644
index 0000000..3e30294
Binary files /dev/null and b/priv/static/assets/app.css.gz differ
diff --git a/priv/static/assets/app.js b/priv/static/assets/app.js
index 60c169c..0ffdc33 100644
--- a/priv/static/assets/app.js
+++ b/priv/static/assets/app.js
@@ -1,5887 +1,20 @@
-(() => {
- var __create = Object.create;
- var __defProp = Object.defineProperty;
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
- var __getOwnPropNames = Object.getOwnPropertyNames;
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
- var __getProtoOf = Object.getPrototypeOf;
- var __hasOwnProp = Object.prototype.hasOwnProperty;
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
- var __spreadValues = (a, b) => {
- for (var prop in b || (b = {}))
- if (__hasOwnProp.call(b, prop))
- __defNormalProp(a, prop, b[prop]);
- if (__getOwnPropSymbols)
- for (var prop of __getOwnPropSymbols(b)) {
- if (__propIsEnum.call(b, prop))
- __defNormalProp(a, prop, b[prop]);
- }
- return a;
- };
- var __objRest = (source, exclude) => {
- var target = {};
- for (var prop in source)
- if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
- target[prop] = source[prop];
- if (source != null && __getOwnPropSymbols)
- for (var prop of __getOwnPropSymbols(source)) {
- if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
- target[prop] = source[prop];
- }
- return target;
- };
- var __commonJS = (cb, mod) => function __require() {
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
- };
- var __copyProps = (to, from, except, desc) => {
- if (from && typeof from === "object" || typeof from === "function") {
- for (let key of __getOwnPropNames(from))
- if (!__hasOwnProp.call(to, key) && key !== except)
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
- }
- return to;
- };
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
- // If the importer is in node compatibility mode or this is not an ESM
- // file that has been converted to a CommonJS file using a Babel-
- // compatible transform (i.e. "__esModule" has not been set), then set
- // "default" to the CommonJS "module.exports" for node compatibility.
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
- mod
- ));
+(()=>{var Jt=Object.create;var Oe=Object.defineProperty;var Vt=Object.getOwnPropertyDescriptor;var Xt=Object.getOwnPropertyNames,nt=Object.getOwnPropertySymbols,zt=Object.getPrototypeOf,rt=Object.prototype.hasOwnProperty,Wt=Object.prototype.propertyIsEnumerable;var st=(e,t,i)=>t in e?Oe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,te=(e,t)=>{for(var i in t||(t={}))rt.call(t,i)&&st(e,i,t[i]);if(nt)for(var i of nt(t))Wt.call(t,i)&&st(e,i,t[i]);return e};var qt=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Kt=(e,t,i,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Xt(t))!rt.call(e,s)&&s!==i&&Oe(e,s,{get:()=>t[s],enumerable:!(n=Vt(t,s))||n.enumerable});return e};var Gt=(e,t,i)=>(i=e!=null?Jt(zt(e)):{},Kt(t||!e||!e.__esModule?Oe(i,"default",{value:e,enumerable:!0}):i,e));var dt=qt((lt,Se)=>{(function(e,t){"use strict";(function(){for(var u=0,m=["ms","moz","webkit","o"],g=0;gv.show(),u)}else s=!0,o!==null&&e.cancelAnimationFrame(o),i||p(),i.style.opacity=1,i.style.display="block",v.progress(0),d.autoRun&&function m(){r=e.requestAnimationFrame(m),v.progress("+"+.05*Math.pow(1-Math.sqrt(n),2))}()},progress:function(u){return typeof u=="undefined"||(typeof u=="string"&&(u=(u.indexOf("+")>=0||u.indexOf("-")>=0?n:0)+parseFloat(u)),n=u>1?1:u,f()),n},hide:function(){clearTimeout(a),a=null,s&&(s=!1,r!=null&&(e.cancelAnimationFrame(r),r=null),function u(){if(v.progress("+.1")>=1&&(i.style.opacity-=.05,i.style.opacity<=.05)){i.style.display="none",o=null;return}o=e.requestAnimationFrame(u)}())}};typeof Se=="object"&&typeof Se.exports=="object"?Se.exports=v:typeof define=="function"&&define.amd?define(function(){return v}):this.topbar=v}).call(lt,window,document)});(function(){var e=t();function t(){if(typeof window.CustomEvent=="function")return window.CustomEvent;function s(r,o){o=o||{bubbles:!1,cancelable:!1,detail:void 0};var a=document.createEvent("CustomEvent");return a.initCustomEvent(r,o.bubbles,o.cancelable,o.detail),a}return s.prototype=window.Event.prototype,s}function i(s,r){var o=document.createElement("input");return o.type="hidden",o.name=s,o.value=r,o}function n(s,r){var o=s.getAttribute("data-to"),a=i("_method",s.getAttribute("data-method")),h=i("_csrf_token",s.getAttribute("data-csrf")),d=document.createElement("form"),f=s.getAttribute("target");d.method=s.getAttribute("data-method")==="get"?"get":"post",d.action=o,d.style.display="hidden",f?d.target=f:r&&(d.target="_blank"),d.appendChild(h),d.appendChild(a),document.body.appendChild(d),d.submit()}window.addEventListener("click",function(s){var r=s.target;if(!s.defaultPrevented)for(;r&&r.getAttribute;){var o=new e("phoenix.link.click",{bubbles:!0,cancelable:!0});if(!r.dispatchEvent(o))return s.preventDefault(),s.stopImmediatePropagation(),!1;if(r.getAttribute("data-method"))return n(r,s.metaKey||s.shiftKey),s.preventDefault(),!1;r=r.parentNode}},!1),window.addEventListener("phoenix.link.click",function(s){var r=s.target.getAttribute("data-confirm");r&&!window.confirm(r)&&s.preventDefault()},!1)})();var ne=e=>typeof e=="function"?e:function(){return e},Yt=typeof self!="undefined"?self:null,ie=typeof window!="undefined"?window:null,ke=Yt||ie||void 0,Qt="2.0.0",N={connecting:0,open:1,closing:2,closed:3},Zt=1e4,ei=1e3,P={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},$={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave"},Ne={longpoll:"longpoll",websocket:"websocket"},ti={complete:4},be=class{constructor(e,t,i,n){this.channel=e,this.event=t,this.payload=i||function(){return{}},this.receivedResp=null,this.timeout=n,this.timeoutTimer=null,this.recHooks=[],this.sent=!1}resend(e){this.timeout=e,this.reset(),this.send()}send(){this.hasReceived("timeout")||(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(e,t){return this.hasReceived(e)&&t(this.receivedResp.response),this.recHooks.push({status:e,callback:t}),this}reset(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=!1}matchReceive({status:e,response:t,_ref:i}){this.recHooks.filter(n=>n.status===e).forEach(n=>n.callback(t))}cancelRefEvent(){this.refEvent&&this.channel.off(this.refEvent)}cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=null}startTimeout(){this.timeoutTimer&&this.cancelTimeout(),this.ref=this.channel.socket.makeRef(),this.refEvent=this.channel.replyEventName(this.ref),this.channel.on(this.refEvent,e=>{this.cancelRefEvent(),this.cancelTimeout(),this.receivedResp=e,this.matchReceive(e)}),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}trigger(e,t){this.channel.trigger(this.refEvent,{status:e,response:t})}},at=class{constructor(e,t){this.callback=e,this.timerCalc=t,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))}},ii=class{constructor(e,t,i){this.state=P.closed,this.topic=e,this.params=ne(t||{}),this.socket=i,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new be(this,$.join,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new at(()=>{this.socket.isConnected()&&this.rejoin()},this.socket.rejoinAfterMs),this.stateChangeRefs.push(this.socket.onError(()=>this.rejoinTimer.reset())),this.stateChangeRefs.push(this.socket.onOpen(()=>{this.rejoinTimer.reset(),this.isErrored()&&this.rejoin()})),this.joinPush.receive("ok",()=>{this.state=P.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(n=>n.send()),this.pushBuffer=[]}),this.joinPush.receive("error",()=>{this.state=P.errored,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.onClose(()=>{this.rejoinTimer.reset(),this.socket.hasLogger()&&this.socket.log("channel",`close ${this.topic} ${this.joinRef()}`),this.state=P.closed,this.socket.remove(this)}),this.onError(n=>{this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,n),this.isJoining()&&this.joinPush.reset(),this.state=P.errored,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.joinPush.receive("timeout",()=>{this.socket.hasLogger()&&this.socket.log("channel",`timeout ${this.topic} (${this.joinRef()})`,this.joinPush.timeout),new be(this,$.leave,ne({}),this.timeout).send(),this.state=P.errored,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on($.reply,(n,s)=>{this.trigger(this.replyEventName(s),n)})}join(e=this.timeout){if(this.joinedOnce)throw new Error("tried to join multiple times. 'join' can only be called a single time per channel instance");return this.timeout=e,this.joinedOnce=!0,this.rejoin(),this.joinPush}onClose(e){this.on($.close,e)}onError(e){return this.on($.error,t=>e(t))}on(e,t){let i=this.bindingRef++;return this.bindings.push({event:e,ref:i,callback:t}),i}off(e,t){this.bindings=this.bindings.filter(i=>!(i.event===e&&(typeof t=="undefined"||t===i.ref)))}canPush(){return this.socket.isConnected()&&this.isJoined()}push(e,t,i=this.timeout){if(t=t||{},!this.joinedOnce)throw new Error(`tried to push '${e}' to '${this.topic}' before joining. Use channel.join() before pushing events`);let n=new be(this,e,function(){return t},i);return this.canPush()?n.send():(n.startTimeout(),this.pushBuffer.push(n)),n}leave(e=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=P.leaving;let t=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger($.close,"leave")},i=new be(this,$.leave,ne({}),e);return i.receive("ok",()=>t()).receive("timeout",()=>t()),i.send(),this.canPush()||i.trigger("ok",{}),i}onMessage(e,t,i){return t}isMember(e,t,i,n){return this.topic!==e?!1:n&&n!==this.joinRef()?(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:e,event:t,payload:i,joinRef:n}),!1):!0}joinRef(){return this.joinPush.ref}rejoin(e=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=P.joining,this.joinPush.resend(e))}trigger(e,t,i,n){let s=this.onMessage(e,t,i,n);if(t&&!s)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");let r=this.bindings.filter(o=>o.event===e);for(let o=0;o{let a=this.parseJSON(e.responseText);o&&o(a)},r&&(e.ontimeout=r),e.onprogress=()=>{},e.send(n)}static xhrRequest(e,t,i,n,s,r,o,a){e.open(t,i,!0),e.timeout=r,e.setRequestHeader("Content-Type",n),e.onerror=()=>{a&&a(null)},e.onreadystatechange=()=>{if(e.readyState===ti.complete&&a){let h=this.parseJSON(e.responseText);a(h)}},o&&(e.ontimeout=o),e.send(s)}static parseJSON(e){if(!e||e==="")return null;try{return JSON.parse(e)}catch(t){return console&&console.log("failed to parse JSON response",e),null}}static serialize(e,t){let i=[];for(var n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;let s=t?`${t}[${n}]`:n,r=e[n];typeof r=="object"?i.push(this.serialize(r,s)):i.push(encodeURIComponent(s)+"="+encodeURIComponent(r))}return i.join("&")}static appendParams(e,t){if(Object.keys(t).length===0)return e;let i=e.match(/\?/)?"&":"?";return`${e}${i}${this.serialize(t)}`}},ot=class{constructor(e){this.endPoint=null,this.token=null,this.skipHeartbeat=!0,this.onopen=function(){},this.onerror=function(){},this.onmessage=function(){},this.onclose=function(){},this.pollEndpoint=this.normalizeEndpoint(e),this.readyState=N.connecting,this.poll()}normalizeEndpoint(e){return e.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+Ne.websocket),"$1/"+Ne.longpoll)}endpointURL(){return se.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(){this.close(),this.readyState=N.connecting}ontimeout(){this.onerror("timeout"),this.closeAndRetry()}poll(){(this.readyState===N.open||this.readyState===N.connecting)&&se.request("GET",this.endpointURL(),"application/json",null,this.timeout,this.ontimeout.bind(this),e=>{if(e){var{status:t,token:i,messages:n}=e;this.token=i}else t=0;switch(t){case 200:n.forEach(s=>{setTimeout(()=>{this.onmessage({data:s})},0)}),this.poll();break;case 204:this.poll();break;case 410:this.readyState=N.open,this.onopen(),this.poll();break;case 403:this.onerror(),this.close();break;case 0:case 500:this.onerror(),this.closeAndRetry();break;default:throw new Error(`unhandled poll status ${t}`)}})}send(e){se.request("POST",this.endpointURL(),"application/json",e,this.timeout,this.onerror.bind(this,"timeout"),t=>{(!t||t.status!==200)&&(this.onerror(t&&t.status),this.closeAndRetry())})}close(e,t){this.readyState=N.closed,this.onclose()}};var ye={HEADER_LENGTH:1,META_LENGTH:4,KINDS:{push:0,reply:1,broadcast:2},encode(e,t){if(e.payload.constructor===ArrayBuffer)return t(this.binaryEncode(e));{let i=[e.join_ref,e.ref,e.topic,e.event,e.payload];return t(JSON.stringify(i))}},decode(e,t){if(e.constructor===ArrayBuffer)return t(this.binaryDecode(e));{let[i,n,s,r,o]=JSON.parse(e);return t({join_ref:i,ref:n,topic:s,event:r,payload:o})}},binaryEncode(e){let{join_ref:t,ref:i,event:n,topic:s,payload:r}=e,o=this.META_LENGTH+t.length+i.length+s.length+n.length,a=new ArrayBuffer(this.HEADER_LENGTH+o),h=new DataView(a),d=0;h.setUint8(d++,this.KINDS.push),h.setUint8(d++,t.length),h.setUint8(d++,i.length),h.setUint8(d++,s.length),h.setUint8(d++,n.length),Array.from(t,p=>h.setUint8(d++,p.charCodeAt(0))),Array.from(i,p=>h.setUint8(d++,p.charCodeAt(0))),Array.from(s,p=>h.setUint8(d++,p.charCodeAt(0))),Array.from(n,p=>h.setUint8(d++,p.charCodeAt(0)));var f=new Uint8Array(a.byteLength+r.byteLength);return f.set(new Uint8Array(a),0),f.set(new Uint8Array(r),a.byteLength),f.buffer},binaryDecode(e){let t=new DataView(e),i=t.getUint8(0),n=new TextDecoder;switch(i){case this.KINDS.push:return this.decodePush(e,t,n);case this.KINDS.reply:return this.decodeReply(e,t,n);case this.KINDS.broadcast:return this.decodeBroadcast(e,t,n)}},decodePush(e,t,i){let n=t.getUint8(1),s=t.getUint8(2),r=t.getUint8(3),o=this.HEADER_LENGTH+this.META_LENGTH-1,a=i.decode(e.slice(o,o+n));o=o+n;let h=i.decode(e.slice(o,o+s));o=o+s;let d=i.decode(e.slice(o,o+r));o=o+r;let f=e.slice(o,e.byteLength);return{join_ref:a,ref:null,topic:h,event:d,payload:f}},decodeReply(e,t,i){let n=t.getUint8(1),s=t.getUint8(2),r=t.getUint8(3),o=t.getUint8(4),a=this.HEADER_LENGTH+this.META_LENGTH,h=i.decode(e.slice(a,a+n));a=a+n;let d=i.decode(e.slice(a,a+s));a=a+s;let f=i.decode(e.slice(a,a+r));a=a+r;let p=i.decode(e.slice(a,a+o));a=a+o;let v=e.slice(a,e.byteLength),u={status:p,response:v};return{join_ref:h,ref:d,topic:f,event:$.reply,payload:u}},decodeBroadcast(e,t,i){let n=t.getUint8(1),s=t.getUint8(2),r=this.HEADER_LENGTH+2,o=i.decode(e.slice(r,r+n));r=r+n;let a=i.decode(e.slice(r,r+s));r=r+s;let h=e.slice(r,e.byteLength);return{join_ref:null,ref:null,topic:o,event:a,payload:h}}},ht=class{constructor(e,t={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.timeout=t.timeout||Zt,this.transport=t.transport||ke.WebSocket||ot,this.establishedConnections=0,this.defaultEncoder=ye.encode.bind(ye),this.defaultDecoder=ye.decode.bind(ye),this.closeWasClean=!1,this.binaryType=t.binaryType||"arraybuffer",this.connectClock=1,this.transport!==ot?(this.encode=t.encode||this.defaultEncoder,this.decode=t.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let i=null;ie&&ie.addEventListener&&(ie.addEventListener("pagehide",n=>{this.conn&&(this.disconnect(),i=this.connectClock)}),ie.addEventListener("pageshow",n=>{i===this.connectClock&&(i=null,this.connect())})),this.heartbeatIntervalMs=t.heartbeatIntervalMs||3e4,this.rejoinAfterMs=n=>t.rejoinAfterMs?t.rejoinAfterMs(n):[1e3,2e3,5e3][n-1]||1e4,this.reconnectAfterMs=n=>t.reconnectAfterMs?t.reconnectAfterMs(n):[10,50,100,150,200,250,500,1e3,2e3][n-1]||5e3,this.logger=t.logger||null,this.longpollerTimeout=t.longpollerTimeout||2e4,this.params=ne(t.params||{}),this.endPoint=`${e}/${Ne.websocket}`,this.vsn=t.vsn||Qt,this.heartbeatTimer=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new at(()=>{this.teardown(()=>this.connect())},this.reconnectAfterMs)}replaceTransport(e){this.disconnect(),this.transport=e}protocol(){return location.protocol.match(/^https/)?"wss":"ws"}endPointURL(){let e=se.appendParams(se.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return e.charAt(0)!=="/"?e:e.charAt(1)==="/"?`${this.protocol()}:${e}`:`${this.protocol()}://${location.host}${e}`}disconnect(e,t,i){this.connectClock++,this.closeWasClean=!0,this.reconnectTimer.reset(),this.teardown(e,t,i)}connect(e){this.connectClock++,e&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=ne(e)),!this.conn&&(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=t=>this.onConnError(t),this.conn.onmessage=t=>this.onConnMessage(t),this.conn.onclose=t=>this.onConnClose(t))}log(e,t,i){this.logger(e,t,i)}hasLogger(){return this.logger!==null}onOpen(e){let t=this.makeRef();return this.stateChangeCallbacks.open.push([t,e]),t}onClose(e){let t=this.makeRef();return this.stateChangeCallbacks.close.push([t,e]),t}onError(e){let t=this.makeRef();return this.stateChangeCallbacks.error.push([t,e]),t}onMessage(e){let t=this.makeRef();return this.stateChangeCallbacks.message.push([t,e]),t}onConnOpen(){this.hasLogger()&&this.log("transport",`connected to ${this.endPointURL()}`),this.closeWasClean=!1,this.establishedConnections++,this.flushSendBuffer(),this.reconnectTimer.reset(),this.resetHeartbeat(),this.stateChangeCallbacks.open.forEach(([,e])=>e())}heartbeatTimeout(){this.pendingHeartbeatRef&&(this.pendingHeartbeatRef=null,this.hasLogger()&&this.log("transport","heartbeat timeout. Attempting to re-establish connection"),this.abnormalClose("heartbeat timeout"))}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,clearTimeout(this.heartbeatTimer),setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}teardown(e,t,i){if(!this.conn)return e&&e();this.waitForBufferDone(()=>{this.conn&&(t?this.conn.close(t,i||""):this.conn.close()),this.waitForSocketClosed(()=>{this.conn&&(this.conn.onclose=function(){},this.conn=null),e&&e()})})}waitForBufferDone(e,t=1){if(t===5||!this.conn||!this.conn.bufferedAmount){e();return}setTimeout(()=>{this.waitForBufferDone(e,t+1)},150*t)}waitForSocketClosed(e,t=1){if(t===5||!this.conn||this.conn.readyState===N.closed){e();return}setTimeout(()=>{this.waitForSocketClosed(e,t+1)},150*t)}onConnClose(e){let t=e&&e.code;this.hasLogger()&&this.log("transport","close",e),this.triggerChanError(),clearTimeout(this.heartbeatTimer),!this.closeWasClean&&t!==1e3&&this.reconnectTimer.scheduleTimeout(),this.stateChangeCallbacks.close.forEach(([,i])=>i(e))}onConnError(e){this.hasLogger()&&this.log("transport",e);let t=this.transport,i=this.establishedConnections;this.stateChangeCallbacks.error.forEach(([,n])=>{n(e,t,i)}),(t===this.transport||i>0)&&this.triggerChanError()}triggerChanError(){this.channels.forEach(e=>{e.isErrored()||e.isLeaving()||e.isClosed()||e.trigger($.error)})}connectionState(){switch(this.conn&&this.conn.readyState){case N.connecting:return"connecting";case N.open:return"open";case N.closing:return"closing";default:return"closed"}}isConnected(){return this.connectionState()==="open"}remove(e){this.off(e.stateChangeRefs),this.channels=this.channels.filter(t=>t.joinRef()!==e.joinRef())}off(e){for(let t in this.stateChangeCallbacks)this.stateChangeCallbacks[t]=this.stateChangeCallbacks[t].filter(([i])=>e.indexOf(i)===-1)}channel(e,t={}){let i=new ii(e,t,this);return this.channels.push(i),i}push(e){if(this.hasLogger()){let{topic:t,event:i,payload:n,ref:s,join_ref:r}=e;this.log("push",`${t} ${i} (${r}, ${s})`,n)}this.isConnected()?this.encode(e,t=>this.conn.send(t)):this.sendBuffer.push(()=>this.encode(e,t=>this.conn.send(t)))}makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}sendHeartbeat(){this.pendingHeartbeatRef&&!this.isConnected()||(this.pendingHeartbeatRef=this.makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef}),this.heartbeatTimer=setTimeout(()=>this.heartbeatTimeout(),this.heartbeatIntervalMs))}abnormalClose(e){this.closeWasClean=!1,this.isConnected()&&this.conn.close(ei,e)}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}onConnMessage(e){this.decode(e.data,t=>{let{topic:i,event:n,payload:s,ref:r,join_ref:o}=t;r&&r===this.pendingHeartbeatRef&&(clearTimeout(this.heartbeatTimer),this.pendingHeartbeatRef=null,setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs)),this.hasLogger()&&this.log("receive",`${s.status||""} ${i} ${n} ${r&&"("+r+")"||""}`,s);for(let a=0;ai.topic===e&&(i.isJoined()||i.isJoining()));t&&(this.hasLogger()&&this.log("transport",`leaving duplicate topic "${e}"`),t.leave())}};var Le=Gt(dt());var xt="consecutive-reloads",ni=10,si=1e3,ri=3e3,oi=3e4,It=["phx-click-loading","phx-change-loading","phx-submit-loading","phx-keydown-loading","phx-keyup-loading","phx-blur-loading","phx-focus-loading"],L="data-phx-component",He="data-phx-link",ai="track-static",hi="data-phx-link-state",j="data-phx-ref",G="data-phx-ref-src",Dt="track-uploads",Y="data-phx-upload-ref",Qe="data-phx-preflighted-refs",li="data-phx-done-refs",ct="drop-target",ze="data-phx-active-refs",We="phx:live-file:updated",qe="data-phx-skip",ut="data-phx-prune",ft="page-loading",pt="phx-connected",Me="phx-loading",gt="phx-no-feedback",mt="phx-error",Z="data-phx-parent-id",Ze="data-phx-main",ce="data-phx-root-id",di="trigger-action",Ke="feedback-for",Ot="phx-has-focused",ci=["text","textarea","number","email","password","search","tel","url","date","time","datetime-local","color","range"],Nt=["checkbox","radio"],Ht="phx-has-submitted",W="data-phx-session",ee=`[${W}]`,vt="data-phx-sticky",le="data-phx-static",Ue="data-phx-readonly",Ae="data-phx-disabled",Ge="disable-with",Ee="data-phx-disable-with-restore",we="hook",ui="debounce",fi="throttle",Ye="update",pi="key",H="phxPrivate",bt="auto-recover",je="phx:live-socket:debug",$e="phx:live-socket:profiling",Fe="phx:live-socket:latency-sim",gi="progress",mi=1,vi=200,bi="phx-",yi=3e4,re="debounce-trigger",Ce="throttled",yt="debounce-prev-key",ki={debounce:300,throttle:300},kt="d",M="s",R="c",St="e",At="r",Et="t",Si="p",Ai=class{constructor(e,t,i){this.liveSocket=i,this.entry=e,this.offset=0,this.chunkSize=t,this.chunkTimer=null,this.uploadChannel=i.channel(`lvu:${e.ref}`,{token:e.metadata()})}error(e){clearTimeout(this.chunkTimer),this.uploadChannel.leave(),this.entry.error(e)}upload(){this.uploadChannel.onError(e=>this.error(e)),this.uploadChannel.join().receive("ok",e=>this.readNextChunk()).receive("error",e=>this.error(e))}isDone(){return this.offset>=this.entry.file.size}readNextChunk(){let e=new window.FileReader,t=this.entry.file.slice(this.offset,this.chunkSize+this.offset);e.onload=i=>{if(i.target.error===null)this.offset+=i.target.result.byteLength,this.pushChunk(i.target.result);else return _("Read error: "+i.target.error)},e.readAsArrayBuffer(t)}pushChunk(e){this.uploadChannel.isJoined()&&this.uploadChannel.push("chunk",e).receive("ok",()=>{this.entry.progress(this.offset/this.entry.file.size*100),this.isDone()||(this.chunkTimer=setTimeout(()=>this.readNextChunk(),this.liveSocket.getLatencySim()||0))})}},_=(e,t)=>console.error&&console.error(e,t),z=e=>{let t=typeof e;return t==="number"||t==="string"&&/^(0|[1-9]\d*)$/.test(e)};function Ei(){let e=new Set,t=document.querySelectorAll("*[id]");for(let i=0,n=t.length;i{e.liveSocket.isDebugEnabled()&&console.log(`${e.id} ${t}: ${i} - `,n)},Be=e=>typeof e=="function"?e:function(){return e},Re=e=>JSON.parse(JSON.stringify(e)),de=(e,t,i)=>{do{if(e.matches(`[${t}]`))return e;e=e.parentElement||e.parentNode}while(e!==null&&e.nodeType===1&&!(i&&i.isSameNode(e)||e.matches(ee)));return null},oe=e=>e!==null&&typeof e=="object"&&!(e instanceof Array),Ci=(e,t)=>JSON.stringify(e)===JSON.stringify(t),wt=e=>{for(let t in e)return!1;return!0},F=(e,t)=>e&&t(e),_i=function(e,t,i,n){e.forEach(s=>{new Ai(s,i.config.chunk_size,n).upload()})},Mt={canPushState(){return typeof history.pushState!="undefined"},dropLocal(e,t,i){return e.removeItem(this.localKey(t,i))},updateLocal(e,t,i,n,s){let r=this.getLocal(e,t,i),o=this.localKey(t,i),a=r===null?n:s(r);return e.setItem(o,JSON.stringify(a)),a},getLocal(e,t,i){return JSON.parse(e.getItem(this.localKey(t,i)))},updateCurrentState(e){this.canPushState()&&history.replaceState(e(history.state||{}),"",window.location.href)},pushState(e,t,i){if(this.canPushState()){if(i!==window.location.href){if(t.type=="redirect"&&t.scroll){let s=history.state||{};s.scroll=t.scroll,history.replaceState(s,"",window.location.href)}delete t.scroll,history[e+"State"](t,"",i||null);let n=this.getHashTargetEl(window.location.hash);n?n.scrollIntoView():t.type==="redirect"&&window.scroll(0,0)}}else this.redirect(i)},setCookie(e,t){document.cookie=`${e}=${t}`},getCookie(e){return document.cookie.replace(new RegExp(`(?:(?:^|.*;s*)${e}s*=s*([^;]*).*$)|^.*$`),"$1")},redirect(e,t){t&&Mt.setCookie("__phoenix_flash__",t+"; max-age=60000; path=/"),window.location=e},localKey(e,t){return`${e}-${t}`},getHashTargetEl(e){let t=e.toString().substring(1);if(t!=="")return document.getElementById(t)||document.querySelector(`a[name="${t}"]`)}},X=Mt,O={byId(e){return document.getElementById(e)||_(`no id found for ${e}`)},removeClass(e,t){e.classList.remove(t),e.classList.length===0&&e.removeAttribute("class")},all(e,t,i){if(!e)return[];let n=Array.from(e.querySelectorAll(t));return i?n.forEach(i):n},childNodeLength(e){let t=document.createElement("template");return t.innerHTML=e,t.content.childElementCount},isUploadInput(e){return e.type==="file"&&e.getAttribute(Y)!==null},findUploadInputs(e){return this.all(e,`input[type="file"][${Y}]`)},findComponentNodeList(e,t){return this.filterWithinSameLiveView(this.all(e,`[${L}="${t}"]`),e)},isPhxDestroyed(e){return!!(e.id&&O.private(e,"destroyed"))},markPhxChildDestroyed(e){this.isPhxChild(e)&&e.setAttribute(W,""),this.putPrivate(e,"destroyed",!0)},findPhxChildrenInFragment(e,t){let i=document.createElement("template");return i.innerHTML=e,this.findPhxChildren(i.content,t)},isIgnored(e,t){return(e.getAttribute(t)||e.getAttribute("data-phx-update"))==="ignore"},isPhxUpdate(e,t,i){return e.getAttribute&&i.indexOf(e.getAttribute(t))>=0},findPhxSticky(e){return this.all(e,`[${vt}]`)},findPhxChildren(e,t){return this.all(e,`${ee}[${Z}="${t}"]`)},findParentCIDs(e,t){let i=new Set(t);return t.reduce((n,s)=>{let r=`[${L}="${s}"] [${L}]`;return this.filterWithinSameLiveView(this.all(e,r),e).map(o=>parseInt(o.getAttribute(L))).forEach(o=>n.delete(o)),n},i)},filterWithinSameLiveView(e,t){return t.querySelector(ee)?e.filter(i=>this.withinSameLiveView(i,t)):e},withinSameLiveView(e,t){for(;e=e.parentNode;){if(e.isSameNode(t))return!0;if(e.getAttribute(W)!==null)return!1}},private(e,t){return e[H]&&e[H][t]},deletePrivate(e,t){e[H]&&delete e[H][t]},putPrivate(e,t,i){e[H]||(e[H]={}),e[H][t]=i},updatePrivate(e,t,i,n){let s=this.private(e,t);s===void 0?this.putPrivate(e,t,n(i)):this.putPrivate(e,t,n(s))},copyPrivates(e,t){t[H]&&(e[H]=t[H])},putTitle(e){let t=document.querySelector("title"),{prefix:i,suffix:n}=t.dataset;document.title=`${i||""}${e}${n||""}`},debounce(e,t,i,n,s,r,o){let a=e.getAttribute(i),h=e.getAttribute(s);a===""&&(a=n),h===""&&(h=r);let d=a||h;switch(d){case null:return o();case"blur":this.once(e,"debounce-blur")&&e.addEventListener("blur",()=>o());return;default:let f=parseInt(d),p=()=>h?this.deletePrivate(e,Ce):o(),v=this.incCycle(e,re,p);if(isNaN(f))return _(`invalid throttle/debounce value: ${d}`);if(h){let m=!1;if(t.type==="keydown"){let g=this.private(e,yt);this.putPrivate(e,yt,t.key),m=g!==t.key}if(!m&&this.private(e,Ce))return!1;o(),this.putPrivate(e,Ce,!0),setTimeout(()=>this.triggerCycle(e,re),f)}else setTimeout(()=>this.triggerCycle(e,re,v),f);let u=e.form;u&&this.once(u,"bind-debounce")&&u.addEventListener("submit",()=>{Array.from(new FormData(u).entries(),([m])=>{let g=u.querySelector(`[name="${m}"]`);this.incCycle(g,re),this.deletePrivate(g,Ce)})}),this.once(e,"bind-debounce")&&e.addEventListener("blur",()=>this.triggerCycle(e,re))}},triggerCycle(e,t,i){let[n,s]=this.private(e,t);i||(i=n),i===n&&(this.incCycle(e,t),s())},once(e,t){return this.private(e,t)===!0?!1:(this.putPrivate(e,t,!0),!0)},incCycle(e,t,i=function(){}){let[n]=this.private(e,t)||[0,i];return n++,this.putPrivate(e,t,[n,i]),n},discardError(e,t,i){let n=t.getAttribute&&t.getAttribute(i),s=n&&e.querySelector(`[id="${n}"], [name="${n}"]`);s&&(this.private(s,Ot)||this.private(s.form,Ht)||t.classList.add(gt))},showError(e,t){(e.id||e.name)&&this.all(e.form,`[${t}="${e.id}"], [${t}="${e.name}"]`,i=>{this.removeClass(i,gt)})},isPhxChild(e){return e.getAttribute&&e.getAttribute(Z)},isPhxSticky(e){return e.getAttribute&&e.getAttribute(vt)!==null},firstPhxChild(e){return this.isPhxChild(e)?e:this.all(e,`[${Z}]`)[0]},dispatchEvent(e,t,i={}){let n=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:i});e.dispatchEvent(n)},cloneNode(e,t){if(typeof t=="undefined")return e.cloneNode(!0);{let i=e.cloneNode(!1);return i.innerHTML=t,i}},mergeAttrs(e,t,i={}){let n=i.exclude||[],s=i.isIgnored,r=t.attributes;for(let a=r.length-1;a>=0;a--){let h=r[a].name;n.indexOf(h)<0&&e.setAttribute(h,t.getAttribute(h))}let o=e.attributes;for(let a=o.length-1;a>=0;a--){let h=o[a].name;s?h.startsWith("data-")&&!t.hasAttribute(h)&&e.removeAttribute(h):t.hasAttribute(h)||e.removeAttribute(h)}},mergeFocusedInput(e,t){e instanceof HTMLSelectElement||O.mergeAttrs(e,t,{except:["value"]}),t.readOnly?e.setAttribute("readonly",!0):e.removeAttribute("readonly")},hasSelectionRange(e){return e.setSelectionRange&&(e.type==="text"||e.type==="textarea")},restoreFocus(e,t,i){if(!O.isTextualInput(e))return;let n=e.matches(":focus");e.readOnly&&e.blur(),n||e.focus(),this.hasSelectionRange(e)&&e.setSelectionRange(t,i)},isFormInput(e){return/^(?:input|select|textarea)$/i.test(e.tagName)&&e.type!=="button"},syncAttrsToProps(e){e instanceof HTMLInputElement&&Nt.indexOf(e.type.toLocaleLowerCase())>=0&&(e.checked=e.getAttribute("checked")!==null)},isTextualInput(e){return ci.indexOf(e.type)>=0},isNowTriggerFormExternal(e,t){return e.getAttribute&&e.getAttribute(t)!==null},syncPendingRef(e,t,i){let n=e.getAttribute(j);if(n===null)return!0;let s=e.getAttribute(G);return O.isFormInput(e)||e.getAttribute(i)!==null?(O.isUploadInput(e)&&O.mergeAttrs(e,t,{isIgnored:!0}),O.putPrivate(e,j,t),!1):(It.forEach(r=>{e.classList.contains(r)&&t.classList.add(r)}),t.setAttribute(j,n),t.setAttribute(G,s),!0)},cleanChildNodes(e,t){if(O.isPhxUpdate(e,t,["append","prepend"])){let i=[];e.childNodes.forEach(n=>{n.id||(n.nodeType===Node.TEXT_NODE&&n.nodeValue.trim()===""||_(`only HTML element tags with an id are allowed inside containers with phx-update.
- // vendor/topbar.js
- var require_topbar = __commonJS({
- "vendor/topbar.js"(exports, module) {
- (function(window2, document2) {
- "use strict";
- (function() {
- var lastTime = 0;
- var vendors = ["ms", "moz", "webkit", "o"];
- for (var x = 0; x < vendors.length && !window2.requestAnimationFrame; ++x) {
- window2.requestAnimationFrame = window2[vendors[x] + "RequestAnimationFrame"];
- window2.cancelAnimationFrame = window2[vendors[x] + "CancelAnimationFrame"] || window2[vendors[x] + "CancelRequestAnimationFrame"];
- }
- if (!window2.requestAnimationFrame)
- window2.requestAnimationFrame = function(callback, element) {
- var currTime = (/* @__PURE__ */ new Date()).getTime();
- var timeToCall = Math.max(0, 16 - (currTime - lastTime));
- var id = window2.setTimeout(function() {
- callback(currTime + timeToCall);
- }, timeToCall);
- lastTime = currTime + timeToCall;
- return id;
- };
- if (!window2.cancelAnimationFrame)
- window2.cancelAnimationFrame = function(id) {
- clearTimeout(id);
- };
- })();
- var canvas, currentProgress, showing, progressTimerId = null, fadeTimerId = null, delayTimerId = null, addEvent = function(elem, type, handler) {
- if (elem.addEventListener)
- elem.addEventListener(type, handler, false);
- else if (elem.attachEvent)
- elem.attachEvent("on" + type, handler);
- else
- elem["on" + type] = handler;
- }, options = {
- autoRun: true,
- 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
- }, repaint = function() {
- canvas.width = window2.innerWidth;
- canvas.height = options.barThickness * 5;
- var ctx = canvas.getContext("2d");
- ctx.shadowBlur = options.shadowBlur;
- ctx.shadowColor = options.shadowColor;
- var lineGradient = ctx.createLinearGradient(0, 0, canvas.width, 0);
- for (var stop in options.barColors)
- lineGradient.addColorStop(stop, options.barColors[stop]);
- ctx.lineWidth = options.barThickness;
- ctx.beginPath();
- ctx.moveTo(0, options.barThickness / 2);
- ctx.lineTo(
- Math.ceil(currentProgress * canvas.width),
- options.barThickness / 2
- );
- ctx.strokeStyle = lineGradient;
- ctx.stroke();
- }, createCanvas = function() {
- canvas = document2.createElement("canvas");
- var style = canvas.style;
- style.position = "fixed";
- style.top = style.left = style.right = style.margin = style.padding = 0;
- style.zIndex = 100001;
- style.display = "none";
- if (options.className)
- canvas.classList.add(options.className);
- document2.body.appendChild(canvas);
- addEvent(window2, "resize", repaint);
- }, topbar2 = {
- config: function(opts) {
- for (var key in opts)
- if (options.hasOwnProperty(key))
- options[key] = opts[key];
- },
- show: function(delay) {
- if (showing)
- return;
- if (delay) {
- if (delayTimerId)
- return;
- delayTimerId = setTimeout(() => topbar2.show(), delay);
- } else {
- showing = true;
- if (fadeTimerId !== null)
- window2.cancelAnimationFrame(fadeTimerId);
- if (!canvas)
- createCanvas();
- canvas.style.opacity = 1;
- canvas.style.display = "block";
- topbar2.progress(0);
- if (options.autoRun) {
- (function loop() {
- progressTimerId = window2.requestAnimationFrame(loop);
- topbar2.progress(
- "+" + 0.05 * Math.pow(1 - Math.sqrt(currentProgress), 2)
- );
- })();
- }
- }
- },
- progress: function(to) {
- if (typeof to === "undefined")
- return currentProgress;
- if (typeof to === "string") {
- to = (to.indexOf("+") >= 0 || to.indexOf("-") >= 0 ? currentProgress : 0) + parseFloat(to);
- }
- currentProgress = to > 1 ? 1 : to;
- repaint();
- return currentProgress;
- },
- hide: function() {
- clearTimeout(delayTimerId);
- delayTimerId = null;
- if (!showing)
- return;
- showing = false;
- if (progressTimerId != null) {
- window2.cancelAnimationFrame(progressTimerId);
- progressTimerId = null;
- }
- (function loop() {
- if (topbar2.progress("+.1") >= 1) {
- canvas.style.opacity -= 0.05;
- if (canvas.style.opacity <= 0.05) {
- canvas.style.display = "none";
- fadeTimerId = null;
- return;
- }
- }
- fadeTimerId = window2.requestAnimationFrame(loop);
- })();
- }
- };
- if (typeof module === "object" && typeof module.exports === "object") {
- module.exports = topbar2;
- } else if (typeof define === "function" && define.amd) {
- define(function() {
- return topbar2;
- });
- } else {
- this.topbar = topbar2;
- }
- }).call(exports, window, document);
- }
- });
+removing illegal node: "${(n.outerHTML||n.nodeValue).trim()}"
- // ../deps/phoenix_html/priv/static/phoenix_html.js
- (function() {
- var PolyfillEvent = eventConstructor();
- function eventConstructor() {
- if (typeof window.CustomEvent === "function")
- return window.CustomEvent;
- function CustomEvent2(event, params) {
- params = params || { bubbles: false, cancelable: false, detail: void 0 };
- var evt = document.createEvent("CustomEvent");
- evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);
- return evt;
- }
- CustomEvent2.prototype = window.Event.prototype;
- return CustomEvent2;
- }
- function buildHiddenInput(name, value) {
- var input = document.createElement("input");
- input.type = "hidden";
- input.name = name;
- input.value = value;
- return input;
- }
- function handleClick(element, targetModifierKey) {
- var to = element.getAttribute("data-to"), method = buildHiddenInput("_method", element.getAttribute("data-method")), csrf = buildHiddenInput("_csrf_token", element.getAttribute("data-csrf")), form = document.createElement("form"), submit = document.createElement("input"), target = element.getAttribute("target");
- form.method = element.getAttribute("data-method") === "get" ? "get" : "post";
- form.action = to;
- form.style.display = "none";
- if (target)
- form.target = target;
- else if (targetModifierKey)
- form.target = "_blank";
- form.appendChild(csrf);
- form.appendChild(method);
- document.body.appendChild(form);
- submit.type = "submit";
- form.appendChild(submit);
- submit.click();
- }
- window.addEventListener("click", function(e) {
- var element = e.target;
- if (e.defaultPrevented)
- return;
- while (element && element.getAttribute) {
- var phoenixLinkEvent = new PolyfillEvent("phoenix.link.click", {
- "bubbles": true,
- "cancelable": true
- });
- if (!element.dispatchEvent(phoenixLinkEvent)) {
- e.preventDefault();
- e.stopImmediatePropagation();
- return false;
- }
- if (element.getAttribute("data-method")) {
- handleClick(element, e.metaKey || e.shiftKey);
- e.preventDefault();
- return false;
- } else {
- element = element.parentNode;
- }
- }
- }, false);
- window.addEventListener("phoenix.link.click", function(e) {
- var message = e.target.getAttribute("data-confirm");
- if (message && !window.confirm(message)) {
- e.preventDefault();
- }
- }, false);
- })();
+`),i.push(n))}),i.forEach(n=>n.remove())}},replaceRootContainer(e,t,i){let n=new Set(["id",W,le,Ze,ce]);if(e.tagName.toLowerCase()===t.toLowerCase())return Array.from(e.attributes).filter(s=>!n.has(s.name.toLowerCase())).forEach(s=>e.removeAttribute(s.name)),Object.keys(i).filter(s=>!n.has(s.toLowerCase())).forEach(s=>e.setAttribute(s,i[s])),e;{let s=document.createElement(t);return Object.keys(i).forEach(r=>s.setAttribute(r,i[r])),n.forEach(r=>s.setAttribute(r,e.getAttribute(r))),s.innerHTML=e.innerHTML,e.replaceWith(s),s}},getSticky(e,t,i){let n=(O.private(e,"sticky")||[]).find(([s])=>t===s);if(n){let[s,r,o]=n;return o}else return typeof i=="function"?i():i},deleteSticky(e,t){this.updatePrivate(e,"sticky",[],i=>i.filter(([n,s])=>n!==t))},putSticky(e,t,i){let n=i(e);this.updatePrivate(e,"sticky",[],s=>{let r=s.findIndex(([o])=>t===o);return r>=0?s[r]=[t,i,n]:s.push([t,i,n]),s})},applyStickyOperations(e){let t=O.private(e,"sticky");t&&t.forEach(([i,n,s])=>this.putSticky(e,i,n))}},l=O,Je=class{static isActive(e,t){let i=t._phxRef===void 0,s=e.getAttribute(ze).split(",").indexOf(C.genFileRef(t))>=0;return t.size>0&&(i||s)}static isPreflighted(e,t){return e.getAttribute(Qe).split(",").indexOf(C.genFileRef(t))>=0&&this.isActive(e,t)}constructor(e,t,i){this.ref=C.genFileRef(t),this.fileEl=e,this.file=t,this.view=i,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(We,this._onElUpdated)}metadata(){return this.meta}progress(e){this._progress=Math.floor(e),this._progress>this._lastProgressSent&&(this._progress>=100?(this._progress=100,this._lastProgressSent=100,this._isDone=!0,this.view.pushFileProgress(this.fileEl,this.ref,100,()=>{C.untrackFile(this.fileEl,this.file),this._onDone()})):(this._lastProgressSent=this._progress,this.view.pushFileProgress(this.fileEl,this.ref,this._progress)))}cancel(){this._isCancelled=!0,this._isDone=!0,this._onDone()}isDone(){return this._isDone}error(e="failed"){this.view.pushFileProgress(this.fileEl,this.ref,{error:e}),C.clearFiles(this.fileEl)}onDone(e){this._onDone=()=>{this.fileEl.removeEventListener(We,this._onElUpdated),e()}}onElUpdated(){this.fileEl.getAttribute(ze).split(",").indexOf(this.ref)===-1&&this.cancel()}toPreflightPayload(){return{last_modified:this.file.lastModified,name:this.file.name,size:this.file.size,type:this.file.type,ref:this.ref}}uploader(e){if(this.meta.uploader){let t=e[this.meta.uploader]||_(`no uploader configured for ${this.meta.uploader}`);return{name:this.meta.uploader,callback:t}}else return{name:"channel",callback:_i}}zipPostFlight(e){this.meta=e.entries[this.ref],this.meta||_(`no preflight upload response returned with ref ${this.ref}`,{input:this.fileEl,response:e})}},Ti=0,C=class{static genFileRef(e){let t=e._phxRef;return t!==void 0?t:(e._phxRef=(Ti++).toString(),e._phxRef)}static getEntryDataURL(e,t,i){let n=this.activeFiles(e).find(s=>this.genFileRef(s)===t);i(URL.createObjectURL(n))}static hasUploadsInProgress(e){let t=0;return l.findUploadInputs(e).forEach(i=>{i.getAttribute(Qe)!==i.getAttribute(li)&&t++}),t>0}static serializeUploads(e){let t=this.activeFiles(e),i={};return t.forEach(n=>{let s={path:e.name},r=e.getAttribute(Y);i[r]=i[r]||[],s.ref=this.genFileRef(n),s.name=n.name||s.ref,s.type=n.type,s.size=n.size,i[r].push(s)}),i}static clearFiles(e){e.value=null,e.removeAttribute(Y),l.putPrivate(e,"files",[])}static untrackFile(e,t){l.putPrivate(e,"files",l.private(e,"files").filter(i=>!Object.is(i,t)))}static trackFiles(e,t){if(e.getAttribute("multiple")!==null){let i=t.filter(n=>!this.activeFiles(e).find(s=>Object.is(s,n)));l.putPrivate(e,"files",this.activeFiles(e).concat(i)),e.value=null}else l.putPrivate(e,"files",t)}static activeFileInputs(e){let t=l.findUploadInputs(e);return Array.from(t).filter(i=>i.files&&this.activeFiles(i).length>0)}static activeFiles(e){return(l.private(e,"files")||[]).filter(t=>Je.isActive(e,t))}static inputsAwaitingPreflight(e){let t=l.findUploadInputs(e);return Array.from(t).filter(i=>this.filesAwaitingPreflight(i).length>0)}static filesAwaitingPreflight(e){return this.activeFiles(e).filter(t=>!Je.isPreflighted(e,t))}constructor(e,t,i){this.view=t,this.onComplete=i,this._entries=Array.from(C.filesAwaitingPreflight(e)||[]).map(n=>new Je(e,n,t)),this.numEntriesInProgress=this._entries.length}entries(){return this._entries}initAdapterUpload(e,t,i){this._entries=this._entries.map(s=>(s.zipPostFlight(e),s.onDone(()=>{this.numEntriesInProgress--,this.numEntriesInProgress===0&&this.onComplete()}),s));let n=this._entries.reduce((s,r)=>{let{name:o,callback:a}=r.uploader(i.uploaders);return s[o]=s[o]||{callback:a,entries:[]},s[o].entries.push(r),s},{});for(let s in n){let{callback:r,entries:o}=n[s];r(o,t,e,i)}}},Pi={LiveFileUpload:{activeRefs(){return this.el.getAttribute(ze)},preflightedRefs(){return this.el.getAttribute(Qe)},mounted(){this.preflightedWas=this.preflightedRefs()},updated(){let e=this.preflightedRefs();this.preflightedWas!==e&&(this.preflightedWas=e,e===""&&this.__view.cancelSubmit(this.el.form)),this.activeRefs()===""&&(this.el.value=null),this.el.dispatchEvent(new CustomEvent(We))}},LiveImgPreview:{mounted(){this.ref=this.el.getAttribute("data-phx-entry-ref"),this.inputEl=document.getElementById(this.el.getAttribute(Y)),C.getEntryDataURL(this.inputEl,this.ref,e=>{this.url=e,this.el.src=e})},destroyed(){URL.revokeObjectURL(this.url)}}},Ri=Pi,Li=class{constructor(e,t,i){let n=new Set,s=new Set([...t.children].map(o=>o.id)),r=[];Array.from(e.children).forEach(o=>{if(o.id&&(n.add(o.id),s.has(o.id))){let a=o.previousElementSibling&&o.previousElementSibling.id;r.push({elementId:o.id,previousElementId:a})}}),this.containerId=t.id,this.updateType=i,this.elementsToModify=r,this.elementIdsToAdd=[...s].filter(o=>!n.has(o))}perform(){let e=l.byId(this.containerId);this.elementsToModify.forEach(t=>{t.previousElementId?F(document.getElementById(t.previousElementId),i=>{F(document.getElementById(t.elementId),n=>{n.previousElementSibling&&n.previousElementSibling.id==i.id||i.insertAdjacentElement("afterend",n)})}):F(document.getElementById(t.elementId),i=>{i.previousElementSibling==null||e.insertAdjacentElement("afterbegin",i)})}),this.updateType=="prepend"&&this.elementIdsToAdd.reverse().forEach(t=>{F(document.getElementById(t),i=>e.insertAdjacentElement("afterbegin",i))})}},Ct=11;function xi(e,t){var i=t.attributes,n,s,r,o,a;if(!(t.nodeType===Ct||e.nodeType===Ct)){for(var h=i.length-1;h>=0;h--)n=i[h],s=n.name,r=n.namespaceURI,o=n.value,r?(s=n.localName||s,a=e.getAttributeNS(r,s),a!==o&&(n.prefix==="xmlns"&&(s=n.name),e.setAttributeNS(r,s,o))):(a=e.getAttribute(s),a!==o&&e.setAttribute(s,o));for(var d=e.attributes,f=d.length-1;f>=0;f--)n=d[f],s=n.name,r=n.namespaceURI,r?(s=n.localName||s,t.hasAttributeNS(r,s)||e.removeAttributeNS(r,s)):t.hasAttribute(s)||e.removeAttribute(s)}}var _e,Ii="http://www.w3.org/1999/xhtml",T=typeof document=="undefined"?void 0:document,Di=!!T&&"content"in T.createElement("template"),Oi=!!T&&T.createRange&&"createContextualFragment"in T.createRange();function Ni(e){var t=T.createElement("template");return t.innerHTML=e,t.content.childNodes[0]}function Hi(e){_e||(_e=T.createRange(),_e.selectNode(T.body));var t=_e.createContextualFragment(e);return t.childNodes[0]}function Mi(e){var t=T.createElement("body");return t.innerHTML=e,t.childNodes[0]}function Ui(e){return e=e.trim(),Di?Ni(e):Oi?Hi(e):Mi(e)}function Te(e,t){var i=e.nodeName,n=t.nodeName,s,r;return i===n?!0:(s=i.charCodeAt(0),r=n.charCodeAt(0),s<=90&&r>=97?i===n.toUpperCase():r<=90&&s>=97?n===i.toUpperCase():!1)}function ji(e,t){return!t||t===Ii?T.createElement(e):T.createElementNS(t,e)}function $i(e,t){for(var i=e.firstChild;i;){var n=i.nextSibling;t.appendChild(i),i=n}return t}function Ve(e,t,i){e[i]!==t[i]&&(e[i]=t[i],e[i]?e.setAttribute(i,""):e.removeAttribute(i))}var _t={OPTION:function(e,t){var i=e.parentNode;if(i){var n=i.nodeName.toUpperCase();n==="OPTGROUP"&&(i=i.parentNode,n=i&&i.nodeName.toUpperCase()),n==="SELECT"&&!i.hasAttribute("multiple")&&(e.hasAttribute("selected")&&!t.selected&&(e.setAttribute("selected","selected"),e.removeAttribute("selected")),i.selectedIndex=-1)}Ve(e,t,"selected")},INPUT:function(e,t){Ve(e,t,"checked"),Ve(e,t,"disabled"),e.value!==t.value&&(e.value=t.value),t.hasAttribute("value")||e.removeAttribute("value")},TEXTAREA:function(e,t){var i=t.value;e.value!==i&&(e.value=i);var n=e.firstChild;if(n){var s=n.nodeValue;if(s==i||!i&&s==e.placeholder)return;n.nodeValue=i}},SELECT:function(e,t){if(!t.hasAttribute("multiple")){for(var i=-1,n=0,s=e.firstChild,r,o;s;)if(o=s.nodeName&&s.nodeName.toUpperCase(),o==="OPTGROUP")r=s,s=r.firstChild;else{if(o==="OPTION"){if(s.hasAttribute("selected")){i=n;break}n++}s=s.nextSibling,!s&&r&&(s=r.nextSibling,r=null)}e.selectedIndex=i}}},ae=1,Fi=11,Tt=3,Pt=8;function K(){}function Bi(e){if(e)return e.getAttribute&&e.getAttribute("id")||e.id}function Ji(e){return function(i,n,s){if(s||(s={}),typeof n=="string")if(i.nodeName==="#document"||i.nodeName==="HTML"||i.nodeName==="BODY"){var r=n;n=T.createElement("html"),n.innerHTML=r}else n=Ui(n);var o=s.getNodeKey||Bi,a=s.onBeforeNodeAdded||K,h=s.onNodeAdded||K,d=s.onBeforeElUpdated||K,f=s.onElUpdated||K,p=s.onBeforeNodeDiscarded||K,v=s.onNodeDiscarded||K,u=s.onBeforeElChildrenUpdated||K,m=s.childrenOnly===!0,g=Object.create(null),E=[];function x(k){E.push(k)}function I(k,y){if(k.nodeType===ae)for(var b=k.firstChild;b;){var S=void 0;y&&(S=o(b))?x(S):(v(b),b.firstChild&&I(b,y)),b=b.nextSibling}}function c(k,y,b){p(k)!==!1&&(y&&y.removeChild(k),v(k),I(k,b))}function A(k){if(k.nodeType===ae||k.nodeType===Fi)for(var y=k.firstChild;y;){var b=o(y);b&&(g[b]=y),A(y),y=y.nextSibling}}A(i);function ue(k){h(k);for(var y=k.firstChild;y;){var b=y.nextSibling,S=o(y);if(S){var D=g[S];D&&Te(y,D)?(y.parentNode.replaceChild(D,y),pe(D,y)):ue(y)}else ue(y);y=b}}function fe(k,y,b){for(;y;){var S=y.nextSibling;(b=o(y))?x(b):c(y,k,!0),y=S}}function pe(k,y,b){var S=o(y);S&&delete g[S],!(!b&&(d(k,y)===!1||(e(k,y),f(k),u(k,y)===!1)))&&(k.nodeName!=="TEXTAREA"?Ft(k,y):_t.TEXTAREA(k,y))}function Ft(k,y){var b=y.firstChild,S=k.firstChild,D,B,Q,me,J;e:for(;b;){for(me=b.nextSibling,D=o(b);S;){if(Q=S.nextSibling,b.isSameNode&&b.isSameNode(S)){b=me,S=Q;continue e}B=o(S);var ve=S.nodeType,V=void 0;if(ve===b.nodeType&&(ve===ae?(D?D!==B&&((J=g[D])?Q===J?V=!1:(k.insertBefore(J,S),B?x(B):c(S,k,!0),S=J):V=!1):B&&(V=!1),V=V!==!1&&Te(S,b),V&&pe(S,b)):(ve===Tt||ve==Pt)&&(V=!0,S.nodeValue!==b.nodeValue&&(S.nodeValue=b.nodeValue))),V){b=me,S=Q;continue e}B?x(B):c(S,k,!0),S=Q}if(D&&(J=g[D])&&Te(J,b))k.appendChild(J),pe(J,b);else{var De=a(b);De!==!1&&(De&&(b=De),b.actualize&&(b=b.actualize(k.ownerDocument||T)),k.appendChild(b),ue(b))}b=me,S=Q}fe(k,S,B);var it=_t[k.nodeName];it&&it(k,y)}var w=i,ge=w.nodeType,tt=n.nodeType;if(!m){if(ge===ae)tt===ae?Te(i,n)||(v(i),w=$i(i,ji(n.nodeName,n.namespaceURI))):w=n;else if(ge===Tt||ge===Pt){if(tt===ge)return w.nodeValue!==n.nodeValue&&(w.nodeValue=n.nodeValue),w;w=n}}if(w===n)v(i);else{if(n.isSameNode&&n.isSameNode(w))return;if(pe(w,n,m),E)for(var xe=0,Bt=E.length;xe{if(i&&i.isSameNode(n)&&l.isFormInput(n))return l.mergeFocusedInput(n,s),!1}})}constructor(e,t,i,n,s){this.view=e,this.liveSocket=e.liveSocket,this.container=t,this.id=i,this.rootID=e.root.id,this.html=n,this.targetCID=s,this.cidPatch=z(this.targetCID),this.callbacks={beforeadded:[],beforeupdated:[],beforephxChildAdded:[],afteradded:[],afterupdated:[],afterdiscarded:[],afterphxChildAdded:[],aftertransitionsDiscarded:[]}}before(e,t){this.callbacks[`before${e}`].push(t)}after(e,t){this.callbacks[`after${e}`].push(t)}trackBefore(e,...t){this.callbacks[`before${e}`].forEach(i=>i(...t))}trackAfter(e,...t){this.callbacks[`after${e}`].forEach(i=>i(...t))}markPrunableContentForRemoval(){l.all(this.container,"[phx-update=append] > *, [phx-update=prepend] > *",e=>{e.setAttribute(ut,"")})}perform(){let{view:e,liveSocket:t,container:i,html:n}=this,s=this.isCIDPatch()?this.targetCIDContainer(n):i;if(this.isCIDPatch()&&!s)return;let r=t.getActiveElement(),{selectionStart:o,selectionEnd:a}=r&&l.hasSelectionRange(r)?r:{},h=t.binding(Ye),d=t.binding(Ke),f=t.binding(Ge),p=t.binding(di),v=t.binding("remove"),u=[],m=[],g=[],E=[],x=null,I=t.time("premorph container prep",()=>this.buildDiffHTML(i,n,h,s));return this.trackBefore("added",i),this.trackBefore("updated",i,i),t.time("morphdom",()=>{Rt(s,I,{childrenOnly:s.getAttribute(L)===null,getNodeKey:c=>l.isPhxDestroyed(c)?null:c.id,onBeforeNodeAdded:c=>(this.trackBefore("added",c),c),onNodeAdded:c=>{c instanceof HTMLImageElement&&c.srcset?c.srcset=c.srcset:c instanceof HTMLVideoElement&&c.autoplay&&c.play(),l.isNowTriggerFormExternal(c,p)&&(x=c),l.discardError(s,c,d),(l.isPhxChild(c)&&e.ownsElement(c)||l.isPhxSticky(c)&&e.ownsElement(c.parentNode))&&this.trackAfter("phxChildAdded",c),u.push(c)},onNodeDiscarded:c=>{(l.isPhxChild(c)||l.isPhxSticky(c))&&t.destroyViewByEl(c),this.trackAfter("discarded",c)},onBeforeNodeDiscarded:c=>c.getAttribute&&c.getAttribute(ut)!==null?!0:c.parentNode!==null&&l.isPhxUpdate(c.parentNode,h,["append","prepend"])&&c.id?!1:c.getAttribute&&c.getAttribute(v)?(E.push(c),!1):!this.skipCIDSibling(c),onElUpdated:c=>{l.isNowTriggerFormExternal(c,p)&&(x=c),m.push(c)},onBeforeElUpdated:(c,A)=>{if(l.cleanChildNodes(A,h),this.skipCIDSibling(A)||l.isPhxSticky(c))return!1;if(l.isIgnored(c,h))return this.trackBefore("updated",c,A),l.mergeAttrs(c,A,{isIgnored:!0}),m.push(c),l.applyStickyOperations(c),!1;if(c.type==="number"&&c.validity&&c.validity.badInput)return!1;if(!l.syncPendingRef(c,A,f))return l.isUploadInput(c)&&(this.trackBefore("updated",c,A),m.push(c)),l.applyStickyOperations(c),!1;if(l.isPhxChild(A)){let fe=c.getAttribute(W);return l.mergeAttrs(c,A,{exclude:[le]}),fe!==""&&c.setAttribute(W,fe),c.setAttribute(ce,this.rootID),l.applyStickyOperations(c),!1}return l.copyPrivates(A,c),l.discardError(s,A,d),r&&c.isSameNode(r)&&l.isFormInput(c)?(this.trackBefore("updated",c,A),l.mergeFocusedInput(c,A),l.syncAttrsToProps(c),m.push(c),l.applyStickyOperations(c),!1):(l.isPhxUpdate(A,h,["append","prepend"])&&g.push(new Li(c,A,A.getAttribute(h))),l.syncAttrsToProps(A),l.applyStickyOperations(A),this.trackBefore("updated",c,A),!0)}})}),t.isDebugEnabled()&&Ei(),g.length>0&&t.time("post-morph append/prepend restoration",()=>{g.forEach(c=>c.perform())}),t.silenceEvents(()=>l.restoreFocus(r,o,a)),l.dispatchEvent(document,"phx:update"),u.forEach(c=>this.trackAfter("added",c)),m.forEach(c=>this.trackAfter("updated",c)),E.length>0&&(t.transitionRemoves(E),t.requestDOMUpdate(()=>{E.forEach(c=>{let A=l.firstPhxChild(c);A&&t.destroyViewByEl(A),c.remove()}),this.trackAfter("transitionsDiscarded",E)})),x&&(t.disconnect(),x.submit()),!0}isCIDPatch(){return this.cidPatch}skipCIDSibling(e){return e.nodeType===Node.ELEMENT_NODE&&e.getAttribute(qe)!==null}targetCIDContainer(e){if(!this.isCIDPatch())return;let[t,...i]=l.findComponentNodeList(this.container,this.targetCID);return i.length===0&&l.childNodeLength(e)===1?t:t&&t.parentNode}buildDiffHTML(e,t,i,n){let s=this.isCIDPatch(),r=s&&n.getAttribute(L)===this.targetCID.toString();if(!s||r)return t;{let o=null,a=document.createElement("template");o=l.cloneNode(n);let[h,...d]=l.findComponentNodeList(o,this.targetCID);return a.innerHTML=t,d.forEach(f=>f.remove()),Array.from(o.childNodes).forEach(f=>{f.id&&f.nodeType===Node.ELEMENT_NODE&&f.getAttribute(L)!==this.targetCID.toString()&&(f.setAttribute(qe,""),f.innerHTML="")}),Array.from(a.content.childNodes).forEach(f=>o.insertBefore(f,h)),h.remove(),o.outerHTML}}},Lt=class{static extract(e){let{[At]:t,[St]:i,[Et]:n}=e;return delete e[At],delete e[St],delete e[Et],{diff:e,title:n,reply:t||null,events:i||[]}}constructor(e,t){this.viewId=e,this.rendered={},this.mergeDiff(t)}parentViewId(){return this.viewId}toString(e){return this.recursiveToString(this.rendered,this.rendered[R],e)}recursiveToString(e,t=e[R],i){i=i?new Set(i):null;let n={buffer:"",components:t,onlyCids:i};return this.toOutputBuffer(e,null,n),n.buffer}componentCIDs(e){return Object.keys(e[R]||{}).map(t=>parseInt(t))}isComponentOnlyDiff(e){return e[R]?Object.keys(e).length===1:!1}getComponent(e,t){return e[R][t]}mergeDiff(e){let t=e[R],i={};if(delete e[R],this.rendered=this.mutableMerge(this.rendered,e),this.rendered[R]=this.rendered[R]||{},t){let n=this.rendered[R];for(let s in t)t[s]=this.cachedFindComponent(s,t[s],n,t,i);for(let s in t)n[s]=t[s];e[R]=t}}cachedFindComponent(e,t,i,n,s){if(s[e])return s[e];{let r,o,a=t[M];if(z(a)){let h;a>0?h=this.cachedFindComponent(a,n[a],i,n,s):h=i[-a],o=h[M],r=this.cloneMerge(h,t),r[M]=o}else r=t[M]!==void 0?t:this.cloneMerge(i[e]||{},t);return s[e]=r,r}}mutableMerge(e,t){return t[M]!==void 0?t:(this.doMutableMerge(e,t),e)}doMutableMerge(e,t){for(let i in t){let n=t[i],s=e[i];oe(n)&&n[M]===void 0&&oe(s)?this.doMutableMerge(s,n):e[i]=n}}cloneMerge(e,t){let i=te(te({},e),t);for(let n in i){let s=t[n],r=e[n];oe(s)&&s[M]===void 0&&oe(r)&&(i[n]=this.cloneMerge(r,s))}return i}componentToString(e){return this.recursiveCIDToString(this.rendered[R],e)}pruneCIDs(e){e.forEach(t=>delete this.rendered[R][t])}get(){return this.rendered}isNewFingerprint(e={}){return!!e[M]}templateStatic(e,t){return typeof e=="number"?t[e]:e}toOutputBuffer(e,t,i){if(e[kt])return this.comprehensionToBuffer(e,t,i);let{[M]:n}=e;n=this.templateStatic(n,t),i.buffer+=n[0];for(let s=1;sp.nodeType===Node.ELEMENT_NODE?p.getAttribute(L)?[d,!0]:(p.setAttribute(L,t),p.id||(p.id=`${this.parentViewId()}-${t}-${v}`),o&&(p.setAttribute(qe,""),p.innerHTML=""),[!0,f]):p.nodeValue.trim()!==""?(_(`only HTML element tags are allowed at the root of components.
- // ../deps/phoenix/priv/static/phoenix.mjs
- var closure = (value) => {
- if (typeof value === "function") {
- return value;
- } else {
- let closure22 = function() {
- return value;
- };
- return closure22;
- }
- };
- var globalSelf = typeof self !== "undefined" ? self : null;
- var phxWindow = typeof window !== "undefined" ? window : null;
- var global = globalSelf || phxWindow || global;
- var DEFAULT_VSN = "2.0.0";
- var SOCKET_STATES = { connecting: 0, open: 1, closing: 2, closed: 3 };
- var DEFAULT_TIMEOUT = 1e4;
- var WS_CLOSE_NORMAL = 1e3;
- var CHANNEL_STATES = {
- closed: "closed",
- errored: "errored",
- joined: "joined",
- joining: "joining",
- leaving: "leaving"
- };
- var CHANNEL_EVENTS = {
- close: "phx_close",
- error: "phx_error",
- join: "phx_join",
- reply: "phx_reply",
- leave: "phx_leave"
- };
- var TRANSPORTS = {
- longpoll: "longpoll",
- websocket: "websocket"
- };
- var XHR_STATES = {
- complete: 4
- };
- var Push = class {
- constructor(channel, event, payload, timeout) {
- this.channel = channel;
- this.event = event;
- this.payload = payload || function() {
- return {};
- };
- this.receivedResp = null;
- this.timeout = timeout;
- this.timeoutTimer = null;
- this.recHooks = [];
- this.sent = false;
- }
- resend(timeout) {
- this.timeout = timeout;
- this.reset();
- this.send();
- }
- send() {
- if (this.hasReceived("timeout")) {
- return;
- }
- this.startTimeout();
- this.sent = true;
- this.channel.socket.push({
- topic: this.channel.topic,
- event: this.event,
- payload: this.payload(),
- ref: this.ref,
- join_ref: this.channel.joinRef()
- });
- }
- receive(status, callback) {
- if (this.hasReceived(status)) {
- callback(this.receivedResp.response);
- }
- this.recHooks.push({ status, callback });
- return this;
- }
- reset() {
- this.cancelRefEvent();
- this.ref = null;
- this.refEvent = null;
- this.receivedResp = null;
- this.sent = false;
- }
- matchReceive({ status, response, _ref }) {
- this.recHooks.filter((h) => h.status === status).forEach((h) => h.callback(response));
- }
- 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, (payload) => {
- this.cancelRefEvent();
- this.cancelTimeout();
- this.receivedResp = payload;
- this.matchReceive(payload);
- });
- this.timeoutTimer = setTimeout(() => {
- this.trigger("timeout", {});
- }, this.timeout);
- }
- hasReceived(status) {
- return this.receivedResp && this.receivedResp.status === status;
- }
- trigger(status, response) {
- this.channel.trigger(this.refEvent, { status, response });
- }
- };
- var Timer = class {
- constructor(callback, timerCalc) {
- this.callback = callback;
- this.timerCalc = timerCalc;
- 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));
- }
- };
- var Channel = class {
- constructor(topic, params, socket) {
- this.state = CHANNEL_STATES.closed;
- this.topic = topic;
- this.params = closure(params || {});
- this.socket = socket;
- this.bindings = [];
- this.bindingRef = 0;
- this.timeout = this.socket.timeout;
- this.joinedOnce = false;
- this.joinPush = new Push(this, CHANNEL_EVENTS.join, this.params, this.timeout);
- this.pushBuffer = [];
- this.stateChangeRefs = [];
- this.rejoinTimer = new Timer(() => {
- if (this.socket.isConnected()) {
- this.rejoin();
- }
- }, this.socket.rejoinAfterMs);
- this.stateChangeRefs.push(this.socket.onError(() => this.rejoinTimer.reset()));
- this.stateChangeRefs.push(this.socket.onOpen(() => {
- this.rejoinTimer.reset();
- if (this.isErrored()) {
- this.rejoin();
- }
- }));
- this.joinPush.receive("ok", () => {
- this.state = CHANNEL_STATES.joined;
- this.rejoinTimer.reset();
- this.pushBuffer.forEach((pushEvent) => pushEvent.send());
- this.pushBuffer = [];
- });
- this.joinPush.receive("error", () => {
- this.state = CHANNEL_STATES.errored;
- if (this.socket.isConnected()) {
- this.rejoinTimer.scheduleTimeout();
- }
- });
- this.onClose(() => {
- this.rejoinTimer.reset();
- if (this.socket.hasLogger())
- this.socket.log("channel", `close ${this.topic} ${this.joinRef()}`);
- this.state = CHANNEL_STATES.closed;
- this.socket.remove(this);
- });
- this.onError((reason) => {
- if (this.socket.hasLogger())
- this.socket.log("channel", `error ${this.topic}`, reason);
- if (this.isJoining()) {
- this.joinPush.reset();
- }
- this.state = CHANNEL_STATES.errored;
- if (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);
- let leavePush = new Push(this, CHANNEL_EVENTS.leave, closure({}), this.timeout);
- leavePush.send();
- this.state = CHANNEL_STATES.errored;
- this.joinPush.reset();
- if (this.socket.isConnected()) {
- this.rejoinTimer.scheduleTimeout();
- }
- });
- this.on(CHANNEL_EVENTS.reply, (payload, ref) => {
- this.trigger(this.replyEventName(ref), payload);
- });
- }
- join(timeout = 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 {
- this.timeout = timeout;
- this.joinedOnce = true;
- this.rejoin();
- return this.joinPush;
- }
- }
- onClose(callback) {
- this.on(CHANNEL_EVENTS.close, callback);
- }
- onError(callback) {
- return this.on(CHANNEL_EVENTS.error, (reason) => callback(reason));
- }
- on(event, callback) {
- let ref = this.bindingRef++;
- this.bindings.push({ event, ref, callback });
- return ref;
- }
- off(event, ref) {
- this.bindings = this.bindings.filter((bind) => {
- return !(bind.event === event && (typeof ref === "undefined" || ref === bind.ref));
- });
- }
- canPush() {
- return this.socket.isConnected() && this.isJoined();
- }
- push(event, payload, timeout = this.timeout) {
- payload = payload || {};
- if (!this.joinedOnce) {
- throw new Error(`tried to push '${event}' to '${this.topic}' before joining. Use channel.join() before pushing events`);
- }
- let pushEvent = new Push(this, event, function() {
- return payload;
- }, timeout);
- if (this.canPush()) {
- pushEvent.send();
- } else {
- pushEvent.startTimeout();
- this.pushBuffer.push(pushEvent);
- }
- return pushEvent;
- }
- leave(timeout = this.timeout) {
- this.rejoinTimer.reset();
- this.joinPush.cancelTimeout();
- this.state = CHANNEL_STATES.leaving;
- let onClose = () => {
- if (this.socket.hasLogger())
- this.socket.log("channel", `leave ${this.topic}`);
- this.trigger(CHANNEL_EVENTS.close, "leave");
- };
- let leavePush = new Push(this, CHANNEL_EVENTS.leave, closure({}), timeout);
- leavePush.receive("ok", () => onClose()).receive("timeout", () => onClose());
- leavePush.send();
- if (!this.canPush()) {
- leavePush.trigger("ok", {});
- }
- return leavePush;
- }
- onMessage(_event, payload, _ref) {
- return payload;
- }
- isMember(topic, event, payload, joinRef) {
- if (this.topic !== topic) {
- return false;
- }
- if (joinRef && joinRef !== this.joinRef()) {
- if (this.socket.hasLogger())
- this.socket.log("channel", "dropping outdated message", { topic, event, payload, joinRef });
- return false;
- } else {
- return true;
- }
- }
- joinRef() {
- return this.joinPush.ref;
- }
- rejoin(timeout = this.timeout) {
- if (this.isLeaving()) {
- return;
- }
- this.socket.leaveOpenTopic(this.topic);
- this.state = CHANNEL_STATES.joining;
- this.joinPush.resend(timeout);
- }
- trigger(event, payload, ref, joinRef) {
- let handledPayload = this.onMessage(event, payload, ref, joinRef);
- if (payload && !handledPayload) {
- throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");
- }
- let eventBindings = this.bindings.filter((bind) => bind.event === event);
- for (let i = 0; i < eventBindings.length; i++) {
- let bind = eventBindings[i];
- bind.callback(handledPayload, ref, joinRef || this.joinRef());
- }
- }
- replyEventName(ref) {
- return `chan_reply_${ref}`;
- }
- isClosed() {
- return this.state === CHANNEL_STATES.closed;
- }
- isErrored() {
- return this.state === CHANNEL_STATES.errored;
- }
- isJoined() {
- return this.state === CHANNEL_STATES.joined;
- }
- isJoining() {
- return this.state === CHANNEL_STATES.joining;
- }
- isLeaving() {
- return this.state === CHANNEL_STATES.leaving;
- }
- };
- var Ajax = class {
- static request(method, endPoint, accept, body, timeout, ontimeout, callback) {
- if (global.XDomainRequest) {
- let req = new global.XDomainRequest();
- return this.xdomainRequest(req, method, endPoint, body, timeout, ontimeout, callback);
- } else {
- let req = new global.XMLHttpRequest();
- return this.xhrRequest(req, method, endPoint, accept, body, timeout, ontimeout, callback);
- }
- }
- static xdomainRequest(req, method, endPoint, body, timeout, ontimeout, callback) {
- req.timeout = timeout;
- req.open(method, endPoint);
- req.onload = () => {
- let response = this.parseJSON(req.responseText);
- callback && callback(response);
- };
- if (ontimeout) {
- req.ontimeout = ontimeout;
- }
- req.onprogress = () => {
- };
- req.send(body);
- return req;
- }
- static xhrRequest(req, method, endPoint, accept, body, timeout, ontimeout, callback) {
- req.open(method, endPoint, true);
- req.timeout = timeout;
- req.setRequestHeader("Content-Type", accept);
- req.onerror = () => callback && callback(null);
- req.onreadystatechange = () => {
- if (req.readyState === XHR_STATES.complete && callback) {
- let response = this.parseJSON(req.responseText);
- callback(response);
- }
- };
- if (ontimeout) {
- req.ontimeout = ontimeout;
- }
- req.send(body);
- return req;
- }
- static parseJSON(resp) {
- if (!resp || resp === "") {
- return null;
- }
- try {
- return JSON.parse(resp);
- } catch (e) {
- console && console.log("failed to parse JSON response", resp);
- return null;
- }
- }
- static serialize(obj, parentKey) {
- let queryStr = [];
- for (var key in obj) {
- if (!Object.prototype.hasOwnProperty.call(obj, key)) {
- continue;
- }
- let paramKey = parentKey ? `${parentKey}[${key}]` : key;
- let paramVal = obj[key];
- if (typeof paramVal === "object") {
- queryStr.push(this.serialize(paramVal, paramKey));
- } else {
- queryStr.push(encodeURIComponent(paramKey) + "=" + encodeURIComponent(paramVal));
- }
- }
- return queryStr.join("&");
- }
- static appendParams(url, params) {
- if (Object.keys(params).length === 0) {
- return url;
- }
- let prefix = url.match(/\?/) ? "&" : "?";
- return `${url}${prefix}${this.serialize(params)}`;
- }
- };
- var arrayBufferToBase64 = (buffer) => {
- let binary = "";
- let bytes = new Uint8Array(buffer);
- let len = bytes.byteLength;
- for (let i = 0; i < len; i++) {
- binary += String.fromCharCode(bytes[i]);
- }
- return btoa(binary);
- };
- var LongPoll = class {
- constructor(endPoint) {
- this.endPoint = null;
- this.token = null;
- this.skipHeartbeat = true;
- this.reqs = /* @__PURE__ */ new Set();
- this.awaitingBatchAck = false;
- this.currentBatch = null;
- this.currentBatchTimer = null;
- this.batchBuffer = [];
- this.onopen = function() {
- };
- this.onerror = function() {
- };
- this.onmessage = function() {
- };
- this.onclose = function() {
- };
- this.pollEndpoint = this.normalizeEndpoint(endPoint);
- this.readyState = SOCKET_STATES.connecting;
- this.poll();
- }
- normalizeEndpoint(endPoint) {
- return endPoint.replace("ws://", "http://").replace("wss://", "https://").replace(new RegExp("(.*)/" + TRANSPORTS.websocket), "$1/" + TRANSPORTS.longpoll);
- }
- endpointURL() {
- return Ajax.appendParams(this.pollEndpoint, { token: this.token });
- }
- closeAndRetry(code, reason, wasClean) {
- this.close(code, reason, wasClean);
- this.readyState = SOCKET_STATES.connecting;
- }
- ontimeout() {
- this.onerror("timeout");
- this.closeAndRetry(1005, "timeout", false);
- }
- isActive() {
- return this.readyState === SOCKET_STATES.open || this.readyState === SOCKET_STATES.connecting;
- }
- poll() {
- this.ajax("GET", "application/json", null, () => this.ontimeout(), (resp) => {
- if (resp) {
- var { status, token, messages } = resp;
- this.token = token;
- } else {
- status = 0;
- }
- switch (status) {
- case 200:
- messages.forEach((msg) => {
- setTimeout(() => this.onmessage({ data: msg }), 0);
- });
- this.poll();
- break;
- case 204:
- this.poll();
- break;
- case 410:
- this.readyState = SOCKET_STATES.open;
- this.onopen({});
- this.poll();
- break;
- case 403:
- this.onerror(403);
- this.close(1008, "forbidden", false);
- break;
- case 0:
- case 500:
- this.onerror(500);
- this.closeAndRetry(1011, "internal server error", 500);
- break;
- default:
- throw new Error(`unhandled poll status ${status}`);
- }
- });
- }
- send(body) {
- if (typeof body !== "string") {
- body = arrayBufferToBase64(body);
- }
- if (this.currentBatch) {
- this.currentBatch.push(body);
- } else if (this.awaitingBatchAck) {
- this.batchBuffer.push(body);
- } else {
- this.currentBatch = [body];
- this.currentBatchTimer = setTimeout(() => {
- this.batchSend(this.currentBatch);
- this.currentBatch = null;
- }, 0);
- }
- }
- batchSend(messages) {
- this.awaitingBatchAck = true;
- this.ajax("POST", "application/x-ndjson", messages.join("\n"), () => this.onerror("timeout"), (resp) => {
- this.awaitingBatchAck = false;
- if (!resp || resp.status !== 200) {
- this.onerror(resp && resp.status);
- this.closeAndRetry(1011, "internal server error", false);
- } else if (this.batchBuffer.length > 0) {
- this.batchSend(this.batchBuffer);
- this.batchBuffer = [];
- }
- });
- }
- close(code, reason, wasClean) {
- for (let req of this.reqs) {
- req.abort();
- }
- this.readyState = SOCKET_STATES.closed;
- let opts = Object.assign({ code: 1e3, reason: void 0, wasClean: true }, { code, reason, wasClean });
- this.batchBuffer = [];
- clearTimeout(this.currentBatchTimer);
- this.currentBatchTimer = null;
- if (typeof CloseEvent !== "undefined") {
- this.onclose(new CloseEvent("close", opts));
- } else {
- this.onclose(opts);
- }
- }
- ajax(method, contentType, body, onCallerTimeout, callback) {
- let req;
- let ontimeout = () => {
- this.reqs.delete(req);
- onCallerTimeout();
- };
- req = Ajax.request(method, this.endpointURL(), contentType, body, this.timeout, ontimeout, (resp) => {
- this.reqs.delete(req);
- if (this.isActive()) {
- callback(resp);
- }
- });
- this.reqs.add(req);
- }
- };
- var serializer_default = {
- HEADER_LENGTH: 1,
- META_LENGTH: 4,
- KINDS: { push: 0, reply: 1, broadcast: 2 },
- encode(msg, callback) {
- if (msg.payload.constructor === ArrayBuffer) {
- return callback(this.binaryEncode(msg));
- } else {
- let payload = [msg.join_ref, msg.ref, msg.topic, msg.event, msg.payload];
- return callback(JSON.stringify(payload));
- }
- },
- decode(rawPayload, callback) {
- if (rawPayload.constructor === ArrayBuffer) {
- return callback(this.binaryDecode(rawPayload));
- } else {
- let [join_ref, ref, topic, event, payload] = JSON.parse(rawPayload);
- return callback({ join_ref, ref, topic, event, payload });
- }
- },
- binaryEncode(message) {
- let { join_ref, ref, event, topic, payload } = message;
- let metaLength = this.META_LENGTH + join_ref.length + ref.length + topic.length + event.length;
- let header = new ArrayBuffer(this.HEADER_LENGTH + metaLength);
- let view = new DataView(header);
- let offset = 0;
- view.setUint8(offset++, this.KINDS.push);
- view.setUint8(offset++, join_ref.length);
- view.setUint8(offset++, ref.length);
- view.setUint8(offset++, topic.length);
- view.setUint8(offset++, event.length);
- Array.from(join_ref, (char) => view.setUint8(offset++, char.charCodeAt(0)));
- Array.from(ref, (char) => view.setUint8(offset++, char.charCodeAt(0)));
- Array.from(topic, (char) => view.setUint8(offset++, char.charCodeAt(0)));
- Array.from(event, (char) => view.setUint8(offset++, char.charCodeAt(0)));
- var combined = new Uint8Array(header.byteLength + payload.byteLength);
- combined.set(new Uint8Array(header), 0);
- combined.set(new Uint8Array(payload), header.byteLength);
- return combined.buffer;
- },
- binaryDecode(buffer) {
- let view = new DataView(buffer);
- let kind = view.getUint8(0);
- let decoder = new TextDecoder();
- switch (kind) {
- case this.KINDS.push:
- return this.decodePush(buffer, view, decoder);
- case this.KINDS.reply:
- return this.decodeReply(buffer, view, decoder);
- case this.KINDS.broadcast:
- return this.decodeBroadcast(buffer, view, decoder);
- }
- },
- decodePush(buffer, view, decoder) {
- let joinRefSize = view.getUint8(1);
- let topicSize = view.getUint8(2);
- let eventSize = view.getUint8(3);
- let offset = this.HEADER_LENGTH + this.META_LENGTH - 1;
- let joinRef = decoder.decode(buffer.slice(offset, offset + joinRefSize));
- offset = offset + joinRefSize;
- let topic = decoder.decode(buffer.slice(offset, offset + topicSize));
- offset = offset + topicSize;
- let event = decoder.decode(buffer.slice(offset, offset + eventSize));
- offset = offset + eventSize;
- let data = buffer.slice(offset, buffer.byteLength);
- return { join_ref: joinRef, ref: null, topic, event, payload: data };
- },
- decodeReply(buffer, view, decoder) {
- let joinRefSize = view.getUint8(1);
- let refSize = view.getUint8(2);
- let topicSize = view.getUint8(3);
- let eventSize = view.getUint8(4);
- let offset = this.HEADER_LENGTH + this.META_LENGTH;
- let joinRef = decoder.decode(buffer.slice(offset, offset + joinRefSize));
- offset = offset + joinRefSize;
- let ref = decoder.decode(buffer.slice(offset, offset + refSize));
- offset = offset + refSize;
- let topic = decoder.decode(buffer.slice(offset, offset + topicSize));
- offset = offset + topicSize;
- let event = decoder.decode(buffer.slice(offset, offset + eventSize));
- offset = offset + eventSize;
- let data = buffer.slice(offset, buffer.byteLength);
- let payload = { status: event, response: data };
- return { join_ref: joinRef, ref, topic, event: CHANNEL_EVENTS.reply, payload };
- },
- decodeBroadcast(buffer, view, decoder) {
- let topicSize = view.getUint8(1);
- let eventSize = view.getUint8(2);
- let offset = this.HEADER_LENGTH + 2;
- let topic = decoder.decode(buffer.slice(offset, offset + topicSize));
- offset = offset + topicSize;
- let event = decoder.decode(buffer.slice(offset, offset + eventSize));
- offset = offset + eventSize;
- let data = buffer.slice(offset, buffer.byteLength);
- return { join_ref: null, ref: null, topic, event, payload: data };
- }
- };
- var Socket = class {
- constructor(endPoint, opts = {}) {
- this.stateChangeCallbacks = { open: [], close: [], error: [], message: [] };
- this.channels = [];
- this.sendBuffer = [];
- this.ref = 0;
- this.timeout = opts.timeout || DEFAULT_TIMEOUT;
- this.transport = opts.transport || global.WebSocket || LongPoll;
- this.establishedConnections = 0;
- this.defaultEncoder = serializer_default.encode.bind(serializer_default);
- this.defaultDecoder = serializer_default.decode.bind(serializer_default);
- this.closeWasClean = false;
- this.binaryType = opts.binaryType || "arraybuffer";
- this.connectClock = 1;
- if (this.transport !== LongPoll) {
- this.encode = opts.encode || this.defaultEncoder;
- this.decode = opts.decode || this.defaultDecoder;
- } else {
- this.encode = this.defaultEncoder;
- this.decode = this.defaultDecoder;
- }
- let awaitingConnectionOnPageShow = null;
- if (phxWindow && phxWindow.addEventListener) {
- phxWindow.addEventListener("pagehide", (_e) => {
- if (this.conn) {
- this.disconnect();
- awaitingConnectionOnPageShow = this.connectClock;
- }
- });
- phxWindow.addEventListener("pageshow", (_e) => {
- if (awaitingConnectionOnPageShow === this.connectClock) {
- awaitingConnectionOnPageShow = null;
- this.connect();
- }
- });
- }
- this.heartbeatIntervalMs = opts.heartbeatIntervalMs || 3e4;
- this.rejoinAfterMs = (tries) => {
- if (opts.rejoinAfterMs) {
- return opts.rejoinAfterMs(tries);
- } else {
- return [1e3, 2e3, 5e3][tries - 1] || 1e4;
- }
- };
- this.reconnectAfterMs = (tries) => {
- if (opts.reconnectAfterMs) {
- return opts.reconnectAfterMs(tries);
- } else {
- return [10, 50, 100, 150, 200, 250, 500, 1e3, 2e3][tries - 1] || 5e3;
- }
- };
- this.logger = opts.logger || null;
- this.longpollerTimeout = opts.longpollerTimeout || 2e4;
- this.params = closure(opts.params || {});
- this.endPoint = `${endPoint}/${TRANSPORTS.websocket}`;
- this.vsn = opts.vsn || DEFAULT_VSN;
- this.heartbeatTimeoutTimer = null;
- this.heartbeatTimer = null;
- this.pendingHeartbeatRef = null;
- this.reconnectTimer = new Timer(() => {
- this.teardown(() => this.connect());
- }, this.reconnectAfterMs);
- }
- getLongPollTransport() {
- return LongPoll;
- }
- replaceTransport(newTransport) {
- this.connectClock++;
- this.closeWasClean = true;
- this.reconnectTimer.reset();
- this.sendBuffer = [];
- if (this.conn) {
- this.conn.close();
- this.conn = null;
- }
- this.transport = newTransport;
- }
- protocol() {
- return location.protocol.match(/^https/) ? "wss" : "ws";
- }
- endPointURL() {
- let uri = Ajax.appendParams(Ajax.appendParams(this.endPoint, this.params()), { vsn: this.vsn });
- if (uri.charAt(0) !== "/") {
- return uri;
- }
- if (uri.charAt(1) === "/") {
- return `${this.protocol()}:${uri}`;
- }
- return `${this.protocol()}://${location.host}${uri}`;
- }
- disconnect(callback, code, reason) {
- this.connectClock++;
- this.closeWasClean = true;
- this.reconnectTimer.reset();
- this.teardown(callback, code, reason);
- }
- connect(params) {
- if (params) {
- console && console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor");
- this.params = closure(params);
- }
- if (this.conn) {
- return;
- }
- this.connectClock++;
- this.closeWasClean = false;
- 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 = (error) => this.onConnError(error);
- this.conn.onmessage = (event) => this.onConnMessage(event);
- this.conn.onclose = (event) => this.onConnClose(event);
- }
- log(kind, msg, data) {
- this.logger(kind, msg, data);
- }
- hasLogger() {
- return this.logger !== null;
- }
- onOpen(callback) {
- let ref = this.makeRef();
- this.stateChangeCallbacks.open.push([ref, callback]);
- return ref;
- }
- onClose(callback) {
- let ref = this.makeRef();
- this.stateChangeCallbacks.close.push([ref, callback]);
- return ref;
- }
- onError(callback) {
- let ref = this.makeRef();
- this.stateChangeCallbacks.error.push([ref, callback]);
- return ref;
- }
- onMessage(callback) {
- let ref = this.makeRef();
- this.stateChangeCallbacks.message.push([ref, callback]);
- return ref;
- }
- ping(callback) {
- if (!this.isConnected()) {
- return false;
- }
- let ref = this.makeRef();
- let startTime = Date.now();
- this.push({ topic: "phoenix", event: "heartbeat", payload: {}, ref });
- let onMsgRef = this.onMessage((msg) => {
- if (msg.ref === ref) {
- this.off([onMsgRef]);
- callback(Date.now() - startTime);
- }
- });
- return true;
- }
- clearHeartbeats() {
- clearTimeout(this.heartbeatTimer);
- clearTimeout(this.heartbeatTimeoutTimer);
- }
- onConnOpen() {
- if (this.hasLogger())
- this.log("transport", `connected to ${this.endPointURL()}`);
- this.closeWasClean = false;
- this.establishedConnections++;
- this.flushSendBuffer();
- this.reconnectTimer.reset();
- this.resetHeartbeat();
- this.stateChangeCallbacks.open.forEach(([, callback]) => callback());
- }
- heartbeatTimeout() {
- if (this.pendingHeartbeatRef) {
- this.pendingHeartbeatRef = null;
- if (this.hasLogger()) {
- this.log("transport", "heartbeat timeout. Attempting to re-establish connection");
- }
- this.triggerChanError();
- this.closeWasClean = false;
- this.teardown(() => this.reconnectTimer.scheduleTimeout(), WS_CLOSE_NORMAL, "heartbeat timeout");
- }
- }
- resetHeartbeat() {
- if (this.conn && this.conn.skipHeartbeat) {
- return;
- }
- this.pendingHeartbeatRef = null;
- this.clearHeartbeats();
- this.heartbeatTimer = setTimeout(() => this.sendHeartbeat(), this.heartbeatIntervalMs);
- }
- teardown(callback, code, reason) {
- if (!this.conn) {
- return callback && callback();
- }
- this.waitForBufferDone(() => {
- if (this.conn) {
- if (code) {
- this.conn.close(code, reason || "");
- } 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;
- }
- callback && callback();
- });
- });
- }
- waitForBufferDone(callback, tries = 1) {
- if (tries === 5 || !this.conn || !this.conn.bufferedAmount) {
- callback();
- return;
- }
- setTimeout(() => {
- this.waitForBufferDone(callback, tries + 1);
- }, 150 * tries);
- }
- waitForSocketClosed(callback, tries = 1) {
- if (tries === 5 || !this.conn || this.conn.readyState === SOCKET_STATES.closed) {
- callback();
- return;
- }
- setTimeout(() => {
- this.waitForSocketClosed(callback, tries + 1);
- }, 150 * tries);
- }
- onConnClose(event) {
- let closeCode = event && event.code;
- if (this.hasLogger())
- this.log("transport", "close", event);
- this.triggerChanError();
- this.clearHeartbeats();
- if (!this.closeWasClean && closeCode !== 1e3) {
- this.reconnectTimer.scheduleTimeout();
- }
- this.stateChangeCallbacks.close.forEach(([, callback]) => callback(event));
- }
- onConnError(error) {
- if (this.hasLogger())
- this.log("transport", error);
- let transportBefore = this.transport;
- let establishedBefore = this.establishedConnections;
- this.stateChangeCallbacks.error.forEach(([, callback]) => {
- callback(error, transportBefore, establishedBefore);
- });
- if (transportBefore === this.transport || establishedBefore > 0) {
- this.triggerChanError();
- }
- }
- triggerChanError() {
- this.channels.forEach((channel) => {
- if (!(channel.isErrored() || channel.isLeaving() || channel.isClosed())) {
- channel.trigger(CHANNEL_EVENTS.error);
- }
- });
- }
- connectionState() {
- switch (this.conn && this.conn.readyState) {
- case SOCKET_STATES.connecting:
- return "connecting";
- case SOCKET_STATES.open:
- return "open";
- case SOCKET_STATES.closing:
- return "closing";
- default:
- return "closed";
- }
- }
- isConnected() {
- return this.connectionState() === "open";
- }
- remove(channel) {
- this.off(channel.stateChangeRefs);
- this.channels = this.channels.filter((c) => c.joinRef() !== channel.joinRef());
- }
- off(refs) {
- for (let key in this.stateChangeCallbacks) {
- this.stateChangeCallbacks[key] = this.stateChangeCallbacks[key].filter(([ref]) => {
- return refs.indexOf(ref) === -1;
- });
- }
- }
- channel(topic, chanParams = {}) {
- let chan = new Channel(topic, chanParams, this);
- this.channels.push(chan);
- return chan;
- }
- push(data) {
- if (this.hasLogger()) {
- let { topic, event, payload, ref, join_ref } = data;
- this.log("push", `${topic} ${event} (${join_ref}, ${ref})`, payload);
- }
- if (this.isConnected()) {
- this.encode(data, (result) => this.conn.send(result));
- } else {
- this.sendBuffer.push(() => this.encode(data, (result) => this.conn.send(result)));
- }
- }
- makeRef() {
- let newRef = this.ref + 1;
- if (newRef === this.ref) {
- this.ref = 0;
- } else {
- this.ref = newRef;
- }
- 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((callback) => callback());
- this.sendBuffer = [];
- }
- }
- onConnMessage(rawMessage) {
- this.decode(rawMessage.data, (msg) => {
- let { topic, event, payload, ref, join_ref } = msg;
- if (ref && ref === this.pendingHeartbeatRef) {
- this.clearHeartbeats();
- this.pendingHeartbeatRef = null;
- this.heartbeatTimer = setTimeout(() => this.sendHeartbeat(), this.heartbeatIntervalMs);
- }
- if (this.hasLogger())
- this.log("receive", `${payload.status || ""} ${topic} ${event} ${ref && "(" + ref + ")" || ""}`, payload);
- for (let i = 0; i < this.channels.length; i++) {
- const channel = this.channels[i];
- if (!channel.isMember(topic, event, payload, join_ref)) {
- continue;
- }
- channel.trigger(event, payload, ref, join_ref);
- }
- for (let i = 0; i < this.stateChangeCallbacks.message.length; i++) {
- let [, callback] = this.stateChangeCallbacks.message[i];
- callback(msg);
- }
- });
- }
- leaveOpenTopic(topic) {
- let dupChannel = this.channels.find((c) => c.topic === topic && (c.isJoined() || c.isJoining()));
- if (dupChannel) {
- if (this.hasLogger())
- this.log("transport", `leaving duplicate topic "${topic}"`);
- dupChannel.leave();
- }
- }
- };
-
- // js/app.js
- var import_topbar = __toESM(require_topbar());
-
- // ../deps/phoenix_live_view/priv/static/phoenix_live_view.esm.js
- var CONSECUTIVE_RELOADS = "consecutive-reloads";
- var MAX_RELOADS = 10;
- var RELOAD_JITTER_MIN = 5e3;
- var RELOAD_JITTER_MAX = 1e4;
- var FAILSAFE_JITTER = 3e4;
- var PHX_EVENT_CLASSES = [
- "phx-click-loading",
- "phx-change-loading",
- "phx-submit-loading",
- "phx-keydown-loading",
- "phx-keyup-loading",
- "phx-blur-loading",
- "phx-focus-loading"
- ];
- var PHX_COMPONENT = "data-phx-component";
- var PHX_LIVE_LINK = "data-phx-link";
- var PHX_TRACK_STATIC = "track-static";
- var PHX_LINK_STATE = "data-phx-link-state";
- var PHX_REF = "data-phx-ref";
- var PHX_REF_SRC = "data-phx-ref-src";
- var PHX_TRACK_UPLOADS = "track-uploads";
- var PHX_UPLOAD_REF = "data-phx-upload-ref";
- var PHX_PREFLIGHTED_REFS = "data-phx-preflighted-refs";
- var PHX_DONE_REFS = "data-phx-done-refs";
- var PHX_DROP_TARGET = "drop-target";
- var PHX_ACTIVE_ENTRY_REFS = "data-phx-active-refs";
- var PHX_LIVE_FILE_UPDATED = "phx:live-file:updated";
- var PHX_SKIP = "data-phx-skip";
- var PHX_PRUNE = "data-phx-prune";
- var PHX_PAGE_LOADING = "page-loading";
- var PHX_CONNECTED_CLASS = "phx-connected";
- var PHX_LOADING_CLASS = "phx-loading";
- var PHX_NO_FEEDBACK_CLASS = "phx-no-feedback";
- var PHX_ERROR_CLASS = "phx-error";
- var PHX_CLIENT_ERROR_CLASS = "phx-client-error";
- var PHX_SERVER_ERROR_CLASS = "phx-server-error";
- var PHX_PARENT_ID = "data-phx-parent-id";
- var PHX_MAIN = "data-phx-main";
- var PHX_ROOT_ID = "data-phx-root-id";
- var PHX_VIEWPORT_TOP = "viewport-top";
- var PHX_VIEWPORT_BOTTOM = "viewport-bottom";
- var PHX_TRIGGER_ACTION = "trigger-action";
- var PHX_FEEDBACK_FOR = "feedback-for";
- var PHX_HAS_FOCUSED = "phx-has-focused";
- var FOCUSABLE_INPUTS = ["text", "textarea", "number", "email", "password", "search", "tel", "url", "date", "time", "datetime-local", "color", "range"];
- var CHECKABLE_INPUTS = ["checkbox", "radio"];
- var PHX_HAS_SUBMITTED = "phx-has-submitted";
- var PHX_SESSION = "data-phx-session";
- var PHX_VIEW_SELECTOR = `[${PHX_SESSION}]`;
- var PHX_STICKY = "data-phx-sticky";
- var PHX_STATIC = "data-phx-static";
- var PHX_READONLY = "data-phx-readonly";
- var PHX_DISABLED = "data-phx-disabled";
- var PHX_DISABLE_WITH = "disable-with";
- var PHX_DISABLE_WITH_RESTORE = "data-phx-disable-with-restore";
- var PHX_HOOK = "hook";
- var PHX_DEBOUNCE = "debounce";
- var PHX_THROTTLE = "throttle";
- var PHX_UPDATE = "update";
- var PHX_STREAM = "stream";
- var PHX_STREAM_REF = "data-phx-stream";
- var PHX_KEY = "key";
- var PHX_PRIVATE = "phxPrivate";
- var PHX_AUTO_RECOVER = "auto-recover";
- var PHX_LV_DEBUG = "phx:live-socket:debug";
- var PHX_LV_PROFILE = "phx:live-socket:profiling";
- var PHX_LV_LATENCY_SIM = "phx:live-socket:latency-sim";
- var PHX_PROGRESS = "progress";
- var PHX_MOUNTED = "mounted";
- var LOADER_TIMEOUT = 1;
- var BEFORE_UNLOAD_LOADER_TIMEOUT = 200;
- var BINDING_PREFIX = "phx-";
- var PUSH_TIMEOUT = 3e4;
- var DEBOUNCE_TRIGGER = "debounce-trigger";
- var THROTTLED = "throttled";
- var DEBOUNCE_PREV_KEY = "debounce-prev-key";
- var DEFAULTS = {
- debounce: 300,
- throttle: 300
- };
- var DYNAMICS = "d";
- var STATIC = "s";
- var COMPONENTS = "c";
- var EVENTS = "e";
- var REPLY = "r";
- var TITLE = "t";
- var TEMPLATES = "p";
- var STREAM = "stream";
- var EntryUploader = class {
- constructor(entry, chunkSize, liveSocket2) {
- this.liveSocket = liveSocket2;
- this.entry = entry;
- this.offset = 0;
- this.chunkSize = chunkSize;
- this.chunkTimer = null;
- this.errored = false;
- this.uploadChannel = liveSocket2.channel(`lvu:${entry.ref}`, { token: entry.metadata() });
- }
- error(reason) {
- if (this.errored) {
- return;
- }
- this.errored = true;
- clearTimeout(this.chunkTimer);
- this.entry.error(reason);
- }
- upload() {
- this.uploadChannel.onError((reason) => this.error(reason));
- this.uploadChannel.join().receive("ok", (_data) => this.readNextChunk()).receive("error", (reason) => this.error(reason));
- }
- isDone() {
- return this.offset >= this.entry.file.size;
- }
- readNextChunk() {
- let reader = new window.FileReader();
- let blob = this.entry.file.slice(this.offset, this.chunkSize + this.offset);
- reader.onload = (e) => {
- if (e.target.error === null) {
- this.offset += e.target.result.byteLength;
- this.pushChunk(e.target.result);
- } else {
- return logError("Read error: " + e.target.error);
- }
- };
- reader.readAsArrayBuffer(blob);
- }
- pushChunk(chunk) {
- if (!this.uploadChannel.isJoined()) {
- return;
- }
- this.uploadChannel.push("chunk", chunk).receive("ok", () => {
- this.entry.progress(this.offset / this.entry.file.size * 100);
- if (!this.isDone()) {
- this.chunkTimer = setTimeout(() => this.readNextChunk(), this.liveSocket.getLatencySim() || 0);
- }
- }).receive("error", ({ reason }) => this.error(reason));
- }
- };
- var logError = (msg, obj) => console.error && console.error(msg, obj);
- var isCid = (cid) => {
- let type = typeof cid;
- return type === "number" || type === "string" && /^(0|[1-9]\d*)$/.test(cid);
- };
- function detectDuplicateIds() {
- let ids = /* @__PURE__ */ new Set();
- let elems = document.querySelectorAll("*[id]");
- for (let i = 0, len = elems.length; i < len; i++) {
- if (ids.has(elems[i].id)) {
- console.error(`Multiple IDs detected: ${elems[i].id}. Ensure unique element ids.`);
- } else {
- ids.add(elems[i].id);
- }
- }
- }
- var debug = (view, kind, msg, obj) => {
- if (view.liveSocket.isDebugEnabled()) {
- console.log(`${view.id} ${kind}: ${msg} - `, obj);
- }
- };
- var closure2 = (val) => typeof val === "function" ? val : function() {
- return val;
- };
- var clone = (obj) => {
- return JSON.parse(JSON.stringify(obj));
- };
- var closestPhxBinding = (el, binding, borderEl) => {
- do {
- if (el.matches(`[${binding}]`) && !el.disabled) {
- return el;
- }
- el = el.parentElement || el.parentNode;
- } while (el !== null && el.nodeType === 1 && !(borderEl && borderEl.isSameNode(el) || el.matches(PHX_VIEW_SELECTOR)));
- return null;
- };
- var isObject = (obj) => {
- return obj !== null && typeof obj === "object" && !(obj instanceof Array);
- };
- var isEqualObj = (obj1, obj2) => JSON.stringify(obj1) === JSON.stringify(obj2);
- var isEmpty = (obj) => {
- for (let x in obj) {
- return false;
- }
- return true;
- };
- var maybe = (el, callback) => el && callback(el);
- var channelUploader = function(entries, onError, resp, liveSocket2) {
- entries.forEach((entry) => {
- let entryUploader = new EntryUploader(entry, resp.config.chunk_size, liveSocket2);
- entryUploader.upload();
- });
- };
- var Browser = {
- canPushState() {
- return typeof history.pushState !== "undefined";
- },
- dropLocal(localStorage, namespace, subkey) {
- return localStorage.removeItem(this.localKey(namespace, subkey));
- },
- updateLocal(localStorage, namespace, subkey, initial, func) {
- let current = this.getLocal(localStorage, namespace, subkey);
- let key = this.localKey(namespace, subkey);
- let newVal = current === null ? initial : func(current);
- localStorage.setItem(key, JSON.stringify(newVal));
- return newVal;
- },
- getLocal(localStorage, namespace, subkey) {
- return JSON.parse(localStorage.getItem(this.localKey(namespace, subkey)));
- },
- updateCurrentState(callback) {
- if (!this.canPushState()) {
- return;
- }
- history.replaceState(callback(history.state || {}), "", window.location.href);
- },
- pushState(kind, meta, to) {
- if (this.canPushState()) {
- if (to !== window.location.href) {
- if (meta.type == "redirect" && meta.scroll) {
- let currentState = history.state || {};
- currentState.scroll = meta.scroll;
- history.replaceState(currentState, "", window.location.href);
- }
- delete meta.scroll;
- history[kind + "State"](meta, "", to || null);
- let hashEl = this.getHashTargetEl(window.location.hash);
- if (hashEl) {
- hashEl.scrollIntoView();
- } else if (meta.type === "redirect") {
- window.scroll(0, 0);
- }
- }
- } else {
- this.redirect(to);
- }
- },
- setCookie(name, value) {
- document.cookie = `${name}=${value}`;
- },
- getCookie(name) {
- return document.cookie.replace(new RegExp(`(?:(?:^|.*;s*)${name}s*=s*([^;]*).*$)|^.*$`), "$1");
- },
- redirect(toURL, flash) {
- if (flash) {
- Browser.setCookie("__phoenix_flash__", flash + "; max-age=60000; path=/");
- }
- window.location = toURL;
- },
- localKey(namespace, subkey) {
- return `${namespace}-${subkey}`;
- },
- getHashTargetEl(maybeHash) {
- let hash = maybeHash.toString().substring(1);
- if (hash === "") {
- return;
- }
- return document.getElementById(hash) || document.querySelector(`a[name="${hash}"]`);
- }
- };
- var browser_default = Browser;
- var DOM = {
- byId(id) {
- return document.getElementById(id) || logError(`no id found for ${id}`);
- },
- removeClass(el, className) {
- el.classList.remove(className);
- if (el.classList.length === 0) {
- el.removeAttribute("class");
- }
- },
- all(node, query, callback) {
- if (!node) {
- return [];
- }
- let array = Array.from(node.querySelectorAll(query));
- return callback ? array.forEach(callback) : array;
- },
- childNodeLength(html) {
- let template = document.createElement("template");
- template.innerHTML = html;
- return template.content.childElementCount;
- },
- isUploadInput(el) {
- return el.type === "file" && el.getAttribute(PHX_UPLOAD_REF) !== null;
- },
- findUploadInputs(node) {
- return this.all(node, `input[type="file"][${PHX_UPLOAD_REF}]`);
- },
- findComponentNodeList(node, cid) {
- return this.filterWithinSameLiveView(this.all(node, `[${PHX_COMPONENT}="${cid}"]`), node);
- },
- isPhxDestroyed(node) {
- return node.id && DOM.private(node, "destroyed") ? true : false;
- },
- wantsNewTab(e) {
- let wantsNewTab = e.ctrlKey || e.shiftKey || e.metaKey || e.button && e.button === 1;
- let isDownload = e.target instanceof HTMLAnchorElement && e.target.hasAttribute("download");
- let isTargetBlank = e.target.hasAttribute("target") && e.target.getAttribute("target").toLowerCase() === "_blank";
- return wantsNewTab || isTargetBlank || isDownload;
- },
- isUnloadableFormSubmit(e) {
- return !e.defaultPrevented && !this.wantsNewTab(e);
- },
- isNewPageClick(e, currentLocation) {
- let href = e.target instanceof HTMLAnchorElement ? e.target.getAttribute("href") : null;
- let url;
- if (e.defaultPrevented || href === null || this.wantsNewTab(e)) {
- return false;
- }
- if (href.startsWith("mailto:") || href.startsWith("tel:")) {
- return false;
- }
- try {
- url = new URL(href);
- } catch (e2) {
- try {
- url = new URL(href, currentLocation);
- } catch (e3) {
- return true;
- }
- }
- if (url.host === currentLocation.host && url.protocol === currentLocation.protocol) {
- if (url.pathname === currentLocation.pathname && url.search === currentLocation.search) {
- return url.hash === "" && !url.href.endsWith("#");
- }
- }
- return url.protocol.startsWith("http");
- },
- markPhxChildDestroyed(el) {
- if (this.isPhxChild(el)) {
- el.setAttribute(PHX_SESSION, "");
- }
- this.putPrivate(el, "destroyed", true);
- },
- findPhxChildrenInFragment(html, parentId) {
- let template = document.createElement("template");
- template.innerHTML = html;
- return this.findPhxChildren(template.content, parentId);
- },
- isIgnored(el, phxUpdate) {
- return (el.getAttribute(phxUpdate) || el.getAttribute("data-phx-update")) === "ignore";
- },
- isPhxUpdate(el, phxUpdate, updateTypes) {
- return el.getAttribute && updateTypes.indexOf(el.getAttribute(phxUpdate)) >= 0;
- },
- findPhxSticky(el) {
- return this.all(el, `[${PHX_STICKY}]`);
- },
- findPhxChildren(el, parentId) {
- return this.all(el, `${PHX_VIEW_SELECTOR}[${PHX_PARENT_ID}="${parentId}"]`);
- },
- findParentCIDs(node, cids) {
- let initial = new Set(cids);
- let parentCids = cids.reduce((acc, cid) => {
- let selector = `[${PHX_COMPONENT}="${cid}"] [${PHX_COMPONENT}]`;
- this.filterWithinSameLiveView(this.all(node, selector), node).map((el) => parseInt(el.getAttribute(PHX_COMPONENT))).forEach((childCID) => acc.delete(childCID));
- return acc;
- }, initial);
- return parentCids.size === 0 ? new Set(cids) : parentCids;
- },
- filterWithinSameLiveView(nodes, parent) {
- if (parent.querySelector(PHX_VIEW_SELECTOR)) {
- return nodes.filter((el) => this.withinSameLiveView(el, parent));
- } else {
- return nodes;
- }
- },
- withinSameLiveView(node, parent) {
- while (node = node.parentNode) {
- if (node.isSameNode(parent)) {
- return true;
- }
- if (node.getAttribute(PHX_SESSION) !== null) {
- return false;
- }
- }
- },
- private(el, key) {
- return el[PHX_PRIVATE] && el[PHX_PRIVATE][key];
- },
- deletePrivate(el, key) {
- el[PHX_PRIVATE] && delete el[PHX_PRIVATE][key];
- },
- putPrivate(el, key, value) {
- if (!el[PHX_PRIVATE]) {
- el[PHX_PRIVATE] = {};
- }
- el[PHX_PRIVATE][key] = value;
- },
- updatePrivate(el, key, defaultVal, updateFunc) {
- let existing = this.private(el, key);
- if (existing === void 0) {
- this.putPrivate(el, key, updateFunc(defaultVal));
- } else {
- this.putPrivate(el, key, updateFunc(existing));
- }
- },
- copyPrivates(target, source) {
- if (source[PHX_PRIVATE]) {
- target[PHX_PRIVATE] = source[PHX_PRIVATE];
- }
- },
- putTitle(str) {
- let titleEl = document.querySelector("title");
- if (titleEl) {
- let { prefix, suffix } = titleEl.dataset;
- document.title = `${prefix || ""}${str}${suffix || ""}`;
- } else {
- document.title = str;
- }
- },
- debounce(el, event, phxDebounce, defaultDebounce, phxThrottle, defaultThrottle, asyncFilter, callback) {
- let debounce = el.getAttribute(phxDebounce);
- let throttle = el.getAttribute(phxThrottle);
- if (debounce === "") {
- debounce = defaultDebounce;
- }
- if (throttle === "") {
- throttle = defaultThrottle;
- }
- let value = debounce || throttle;
- switch (value) {
- case null:
- return callback();
- case "blur":
- if (this.once(el, "debounce-blur")) {
- el.addEventListener("blur", () => callback());
- }
- return;
- default:
- let timeout = parseInt(value);
- let trigger = () => throttle ? this.deletePrivate(el, THROTTLED) : callback();
- let currentCycle = this.incCycle(el, DEBOUNCE_TRIGGER, trigger);
- if (isNaN(timeout)) {
- return logError(`invalid throttle/debounce value: ${value}`);
- }
- if (throttle) {
- let newKeyDown = false;
- if (event.type === "keydown") {
- let prevKey = this.private(el, DEBOUNCE_PREV_KEY);
- this.putPrivate(el, DEBOUNCE_PREV_KEY, event.key);
- newKeyDown = prevKey !== event.key;
- }
- if (!newKeyDown && this.private(el, THROTTLED)) {
- return false;
- } else {
- callback();
- this.putPrivate(el, THROTTLED, true);
- setTimeout(() => {
- if (asyncFilter()) {
- this.triggerCycle(el, DEBOUNCE_TRIGGER);
- }
- }, timeout);
- }
- } else {
- setTimeout(() => {
- if (asyncFilter()) {
- this.triggerCycle(el, DEBOUNCE_TRIGGER, currentCycle);
- }
- }, timeout);
- }
- let form = el.form;
- if (form && this.once(form, "bind-debounce")) {
- form.addEventListener("submit", () => {
- Array.from(new FormData(form).entries(), ([name]) => {
- let input = form.querySelector(`[name="${name}"]`);
- this.incCycle(input, DEBOUNCE_TRIGGER);
- this.deletePrivate(input, THROTTLED);
- });
- });
- }
- if (this.once(el, "bind-debounce")) {
- el.addEventListener("blur", () => this.triggerCycle(el, DEBOUNCE_TRIGGER));
- }
- }
- },
- triggerCycle(el, key, currentCycle) {
- let [cycle, trigger] = this.private(el, key);
- if (!currentCycle) {
- currentCycle = cycle;
- }
- if (currentCycle === cycle) {
- this.incCycle(el, key);
- trigger();
- }
- },
- once(el, key) {
- if (this.private(el, key) === true) {
- return false;
- }
- this.putPrivate(el, key, true);
- return true;
- },
- incCycle(el, key, trigger = function() {
- }) {
- let [currentCycle] = this.private(el, key) || [0, trigger];
- currentCycle++;
- this.putPrivate(el, key, [currentCycle, trigger]);
- return currentCycle;
- },
- maybeAddPrivateHooks(el, phxViewportTop, phxViewportBottom) {
- if (el.hasAttribute && (el.hasAttribute(phxViewportTop) || el.hasAttribute(phxViewportBottom))) {
- el.setAttribute("data-phx-hook", "Phoenix.InfiniteScroll");
- }
- },
- maybeHideFeedback(container, input, phxFeedbackFor) {
- if (!(this.private(input, PHX_HAS_FOCUSED) || this.private(input, PHX_HAS_SUBMITTED))) {
- let feedbacks = [input.name];
- if (input.name.endsWith("[]")) {
- feedbacks.push(input.name.slice(0, -2));
- }
- let selector = feedbacks.map((f) => `[${phxFeedbackFor}="${f}"]`).join(", ");
- DOM.all(container, selector, (el) => el.classList.add(PHX_NO_FEEDBACK_CLASS));
- }
- },
- resetForm(form, phxFeedbackFor) {
- Array.from(form.elements).forEach((input) => {
- let query = `[${phxFeedbackFor}="${input.id}"],
- [${phxFeedbackFor}="${input.name}"],
- [${phxFeedbackFor}="${input.name.replace(/\[\]$/, "")}"]`;
- this.deletePrivate(input, PHX_HAS_FOCUSED);
- this.deletePrivate(input, PHX_HAS_SUBMITTED);
- this.all(document, query, (feedbackEl) => {
- feedbackEl.classList.add(PHX_NO_FEEDBACK_CLASS);
- });
- });
- },
- showError(inputEl, phxFeedbackFor) {
- if (inputEl.id || inputEl.name) {
- this.all(inputEl.form, `[${phxFeedbackFor}="${inputEl.id}"], [${phxFeedbackFor}="${inputEl.name}"]`, (el) => {
- this.removeClass(el, PHX_NO_FEEDBACK_CLASS);
- });
- }
- },
- isPhxChild(node) {
- return node.getAttribute && node.getAttribute(PHX_PARENT_ID);
- },
- isPhxSticky(node) {
- return node.getAttribute && node.getAttribute(PHX_STICKY) !== null;
- },
- firstPhxChild(el) {
- return this.isPhxChild(el) ? el : this.all(el, `[${PHX_PARENT_ID}]`)[0];
- },
- dispatchEvent(target, name, opts = {}) {
- let bubbles = opts.bubbles === void 0 ? true : !!opts.bubbles;
- let eventOpts = { bubbles, cancelable: true, detail: opts.detail || {} };
- let event = name === "click" ? new MouseEvent("click", eventOpts) : new CustomEvent(name, eventOpts);
- target.dispatchEvent(event);
- },
- cloneNode(node, html) {
- if (typeof html === "undefined") {
- return node.cloneNode(true);
- } else {
- let cloned = node.cloneNode(false);
- cloned.innerHTML = html;
- return cloned;
- }
- },
- mergeAttrs(target, source, opts = {}) {
- let exclude = opts.exclude || [];
- let isIgnored = opts.isIgnored;
- let sourceAttrs = source.attributes;
- for (let i = sourceAttrs.length - 1; i >= 0; i--) {
- let name = sourceAttrs[i].name;
- if (exclude.indexOf(name) < 0) {
- target.setAttribute(name, source.getAttribute(name));
- }
- }
- let targetAttrs = target.attributes;
- for (let i = targetAttrs.length - 1; i >= 0; i--) {
- let name = targetAttrs[i].name;
- if (isIgnored) {
- if (name.startsWith("data-") && !source.hasAttribute(name)) {
- target.removeAttribute(name);
- }
- } else {
- if (!source.hasAttribute(name)) {
- target.removeAttribute(name);
- }
- }
- }
- },
- mergeFocusedInput(target, source) {
- if (!(target instanceof HTMLSelectElement)) {
- DOM.mergeAttrs(target, source, { exclude: ["value"] });
- }
- if (source.readOnly) {
- target.setAttribute("readonly", true);
- } else {
- target.removeAttribute("readonly");
- }
- },
- hasSelectionRange(el) {
- return el.setSelectionRange && (el.type === "text" || el.type === "textarea");
- },
- restoreFocus(focused, selectionStart, selectionEnd) {
- if (!DOM.isTextualInput(focused)) {
- return;
- }
- let wasFocused = focused.matches(":focus");
- if (focused.readOnly) {
- focused.blur();
- }
- if (!wasFocused) {
- focused.focus();
- }
- if (this.hasSelectionRange(focused)) {
- focused.setSelectionRange(selectionStart, selectionEnd);
- }
- },
- isFormInput(el) {
- return /^(?:input|select|textarea)$/i.test(el.tagName) && el.type !== "button";
- },
- syncAttrsToProps(el) {
- if (el instanceof HTMLInputElement && CHECKABLE_INPUTS.indexOf(el.type.toLocaleLowerCase()) >= 0) {
- el.checked = el.getAttribute("checked") !== null;
- }
- },
- isTextualInput(el) {
- return FOCUSABLE_INPUTS.indexOf(el.type) >= 0;
- },
- isNowTriggerFormExternal(el, phxTriggerExternal) {
- return el.getAttribute && el.getAttribute(phxTriggerExternal) !== null;
- },
- syncPendingRef(fromEl, toEl, disableWith) {
- let ref = fromEl.getAttribute(PHX_REF);
- if (ref === null) {
- return true;
- }
- let refSrc = fromEl.getAttribute(PHX_REF_SRC);
- if (DOM.isFormInput(fromEl) || fromEl.getAttribute(disableWith) !== null) {
- if (DOM.isUploadInput(fromEl)) {
- DOM.mergeAttrs(fromEl, toEl, { isIgnored: true });
- }
- DOM.putPrivate(fromEl, PHX_REF, toEl);
- return false;
- } else {
- PHX_EVENT_CLASSES.forEach((className) => {
- fromEl.classList.contains(className) && toEl.classList.add(className);
- });
- toEl.setAttribute(PHX_REF, ref);
- toEl.setAttribute(PHX_REF_SRC, refSrc);
- return true;
- }
- },
- cleanChildNodes(container, phxUpdate) {
- if (DOM.isPhxUpdate(container, phxUpdate, ["append", "prepend"])) {
- let toRemove = [];
- container.childNodes.forEach((childNode) => {
- if (!childNode.id) {
- let isEmptyTextNode = childNode.nodeType === Node.TEXT_NODE && childNode.nodeValue.trim() === "";
- if (!isEmptyTextNode) {
- logError(`only HTML element tags with an id are allowed inside containers with phx-update.
-
-removing illegal node: "${(childNode.outerHTML || childNode.nodeValue).trim()}"
-
-`);
- }
- toRemove.push(childNode);
- }
- });
- toRemove.forEach((childNode) => childNode.remove());
- }
- },
- replaceRootContainer(container, tagName, attrs) {
- let retainedAttrs = /* @__PURE__ */ new Set(["id", PHX_SESSION, PHX_STATIC, PHX_MAIN, PHX_ROOT_ID]);
- if (container.tagName.toLowerCase() === tagName.toLowerCase()) {
- Array.from(container.attributes).filter((attr) => !retainedAttrs.has(attr.name.toLowerCase())).forEach((attr) => container.removeAttribute(attr.name));
- Object.keys(attrs).filter((name) => !retainedAttrs.has(name.toLowerCase())).forEach((attr) => container.setAttribute(attr, attrs[attr]));
- return container;
- } else {
- let newContainer = document.createElement(tagName);
- Object.keys(attrs).forEach((attr) => newContainer.setAttribute(attr, attrs[attr]));
- retainedAttrs.forEach((attr) => newContainer.setAttribute(attr, container.getAttribute(attr)));
- newContainer.innerHTML = container.innerHTML;
- container.replaceWith(newContainer);
- return newContainer;
- }
- },
- getSticky(el, name, defaultVal) {
- let op = (DOM.private(el, "sticky") || []).find(([existingName]) => name === existingName);
- if (op) {
- let [_name, _op, stashedResult] = op;
- return stashedResult;
- } else {
- return typeof defaultVal === "function" ? defaultVal() : defaultVal;
- }
- },
- deleteSticky(el, name) {
- this.updatePrivate(el, "sticky", [], (ops) => {
- return ops.filter(([existingName, _]) => existingName !== name);
- });
- },
- putSticky(el, name, op) {
- let stashedResult = op(el);
- this.updatePrivate(el, "sticky", [], (ops) => {
- let existingIndex = ops.findIndex(([existingName]) => name === existingName);
- if (existingIndex >= 0) {
- ops[existingIndex] = [name, op, stashedResult];
- } else {
- ops.push([name, op, stashedResult]);
- }
- return ops;
- });
- },
- applyStickyOperations(el) {
- let ops = DOM.private(el, "sticky");
- if (!ops) {
- return;
- }
- ops.forEach(([name, op, _stashed]) => this.putSticky(el, name, op));
- }
- };
- var dom_default = DOM;
- var UploadEntry = class {
- static isActive(fileEl, file) {
- let isNew = file._phxRef === void 0;
- let activeRefs = fileEl.getAttribute(PHX_ACTIVE_ENTRY_REFS).split(",");
- let isActive = activeRefs.indexOf(LiveUploader.genFileRef(file)) >= 0;
- return file.size > 0 && (isNew || isActive);
- }
- static isPreflighted(fileEl, file) {
- let preflightedRefs = fileEl.getAttribute(PHX_PREFLIGHTED_REFS).split(",");
- let isPreflighted = preflightedRefs.indexOf(LiveUploader.genFileRef(file)) >= 0;
- return isPreflighted && this.isActive(fileEl, file);
- }
- constructor(fileEl, file, view) {
- this.ref = LiveUploader.genFileRef(file);
- this.fileEl = fileEl;
- this.file = file;
- this.view = view;
- this.meta = null;
- this._isCancelled = false;
- this._isDone = false;
- this._progress = 0;
- this._lastProgressSent = -1;
- this._onDone = function() {
- };
- this._onElUpdated = this.onElUpdated.bind(this);
- this.fileEl.addEventListener(PHX_LIVE_FILE_UPDATED, this._onElUpdated);
- }
- metadata() {
- return this.meta;
- }
- progress(progress) {
- this._progress = Math.floor(progress);
- if (this._progress > this._lastProgressSent) {
- if (this._progress >= 100) {
- this._progress = 100;
- this._lastProgressSent = 100;
- this._isDone = true;
- this.view.pushFileProgress(this.fileEl, this.ref, 100, () => {
- LiveUploader.untrackFile(this.fileEl, this.file);
- this._onDone();
- });
- } else {
- this._lastProgressSent = this._progress;
- this.view.pushFileProgress(this.fileEl, this.ref, this._progress);
- }
- }
- }
- cancel() {
- this._isCancelled = true;
- this._isDone = true;
- this._onDone();
- }
- isDone() {
- return this._isDone;
- }
- error(reason = "failed") {
- this.fileEl.removeEventListener(PHX_LIVE_FILE_UPDATED, this._onElUpdated);
- this.view.pushFileProgress(this.fileEl, this.ref, { error: reason });
- LiveUploader.clearFiles(this.fileEl);
- }
- onDone(callback) {
- this._onDone = () => {
- this.fileEl.removeEventListener(PHX_LIVE_FILE_UPDATED, this._onElUpdated);
- callback();
- };
- }
- onElUpdated() {
- let activeRefs = this.fileEl.getAttribute(PHX_ACTIVE_ENTRY_REFS).split(",");
- if (activeRefs.indexOf(this.ref) === -1) {
- 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
- };
- }
- uploader(uploaders) {
- if (this.meta.uploader) {
- let callback = uploaders[this.meta.uploader] || logError(`no uploader configured for ${this.meta.uploader}`);
- return { name: this.meta.uploader, callback };
- } else {
- return { name: "channel", callback: channelUploader };
- }
- }
- zipPostFlight(resp) {
- this.meta = resp.entries[this.ref];
- if (!this.meta) {
- logError(`no preflight upload response returned with ref ${this.ref}`, { input: this.fileEl, response: resp });
- }
- }
- };
- var liveUploaderFileRef = 0;
- var LiveUploader = class {
- static genFileRef(file) {
- let ref = file._phxRef;
- if (ref !== void 0) {
- return ref;
- } else {
- file._phxRef = (liveUploaderFileRef++).toString();
- return file._phxRef;
- }
- }
- static getEntryDataURL(inputEl, ref, callback) {
- let file = this.activeFiles(inputEl).find((file2) => this.genFileRef(file2) === ref);
- callback(URL.createObjectURL(file));
- }
- static hasUploadsInProgress(formEl) {
- let active = 0;
- dom_default.findUploadInputs(formEl).forEach((input) => {
- if (input.getAttribute(PHX_PREFLIGHTED_REFS) !== input.getAttribute(PHX_DONE_REFS)) {
- active++;
- }
- });
- return active > 0;
- }
- static serializeUploads(inputEl) {
- let files = this.activeFiles(inputEl);
- let fileData = {};
- files.forEach((file) => {
- let entry = { path: inputEl.name };
- let uploadRef = inputEl.getAttribute(PHX_UPLOAD_REF);
- fileData[uploadRef] = fileData[uploadRef] || [];
- entry.ref = this.genFileRef(file);
- entry.last_modified = file.lastModified;
- entry.name = file.name || entry.ref;
- entry.relative_path = file.webkitRelativePath;
- entry.type = file.type;
- entry.size = file.size;
- fileData[uploadRef].push(entry);
- });
- return fileData;
- }
- static clearFiles(inputEl) {
- inputEl.value = null;
- inputEl.removeAttribute(PHX_UPLOAD_REF);
- dom_default.putPrivate(inputEl, "files", []);
- }
- static untrackFile(inputEl, file) {
- dom_default.putPrivate(inputEl, "files", dom_default.private(inputEl, "files").filter((f) => !Object.is(f, file)));
- }
- static trackFiles(inputEl, files, dataTransfer) {
- if (inputEl.getAttribute("multiple") !== null) {
- let newFiles = files.filter((file) => !this.activeFiles(inputEl).find((f) => Object.is(f, file)));
- dom_default.putPrivate(inputEl, "files", this.activeFiles(inputEl).concat(newFiles));
- inputEl.value = null;
- } else {
- if (dataTransfer && dataTransfer.files.length > 0) {
- inputEl.files = dataTransfer.files;
- }
- dom_default.putPrivate(inputEl, "files", files);
- }
- }
- static activeFileInputs(formEl) {
- let fileInputs = dom_default.findUploadInputs(formEl);
- return Array.from(fileInputs).filter((el) => el.files && this.activeFiles(el).length > 0);
- }
- static activeFiles(input) {
- return (dom_default.private(input, "files") || []).filter((f) => UploadEntry.isActive(input, f));
- }
- static inputsAwaitingPreflight(formEl) {
- let fileInputs = dom_default.findUploadInputs(formEl);
- return Array.from(fileInputs).filter((input) => this.filesAwaitingPreflight(input).length > 0);
- }
- static filesAwaitingPreflight(input) {
- return this.activeFiles(input).filter((f) => !UploadEntry.isPreflighted(input, f));
- }
- constructor(inputEl, view, onComplete) {
- this.view = view;
- this.onComplete = onComplete;
- this._entries = Array.from(LiveUploader.filesAwaitingPreflight(inputEl) || []).map((file) => new UploadEntry(inputEl, file, view));
- this.numEntriesInProgress = this._entries.length;
- }
- entries() {
- return this._entries;
- }
- initAdapterUpload(resp, onError, liveSocket2) {
- this._entries = this._entries.map((entry) => {
- entry.zipPostFlight(resp);
- entry.onDone(() => {
- this.numEntriesInProgress--;
- if (this.numEntriesInProgress === 0) {
- this.onComplete();
- }
- });
- return entry;
- });
- let groupedEntries = this._entries.reduce((acc, entry) => {
- let { name, callback } = entry.uploader(liveSocket2.uploaders);
- acc[name] = acc[name] || { callback, entries: [] };
- acc[name].entries.push(entry);
- return acc;
- }, {});
- for (let name in groupedEntries) {
- let { callback, entries } = groupedEntries[name];
- callback(entries, onError, resp, liveSocket2);
- }
- }
- };
- var ARIA = {
- focusMain() {
- let target = document.querySelector("main h1, main, h1");
- if (target) {
- let origTabIndex = target.tabIndex;
- target.tabIndex = -1;
- target.focus();
- target.tabIndex = origTabIndex;
- }
- },
- anyOf(instance, classes) {
- return classes.find((name) => instance instanceof name);
- },
- isFocusable(el, interactiveOnly) {
- return el instanceof HTMLAnchorElement && el.rel !== "ignore" || el instanceof HTMLAreaElement && el.href !== void 0 || !el.disabled && this.anyOf(el, [HTMLInputElement, HTMLSelectElement, HTMLTextAreaElement, HTMLButtonElement]) || el instanceof HTMLIFrameElement || (el.tabIndex > 0 || !interactiveOnly && el.tabIndex === 0 && el.getAttribute("tabindex") !== null && el.getAttribute("aria-hidden") !== "true");
- },
- attemptFocus(el, interactiveOnly) {
- if (this.isFocusable(el, interactiveOnly)) {
- try {
- el.focus();
- } catch (e) {
- }
- }
- return !!document.activeElement && document.activeElement.isSameNode(el);
- },
- focusFirstInteractive(el) {
- let child = el.firstElementChild;
- while (child) {
- if (this.attemptFocus(child, true) || this.focusFirstInteractive(child, true)) {
- return true;
- }
- child = child.nextElementSibling;
- }
- },
- focusFirst(el) {
- let child = el.firstElementChild;
- while (child) {
- if (this.attemptFocus(child) || this.focusFirst(child)) {
- return true;
- }
- child = child.nextElementSibling;
- }
- },
- focusLast(el) {
- let child = el.lastElementChild;
- while (child) {
- if (this.attemptFocus(child) || this.focusLast(child)) {
- return true;
- }
- child = child.previousElementSibling;
- }
- }
- };
- var aria_default = ARIA;
- var Hooks = {
- LiveFileUpload: {
- activeRefs() {
- return this.el.getAttribute(PHX_ACTIVE_ENTRY_REFS);
- },
- preflightedRefs() {
- return this.el.getAttribute(PHX_PREFLIGHTED_REFS);
- },
- mounted() {
- this.preflightedWas = this.preflightedRefs();
- },
- updated() {
- let newPreflights = this.preflightedRefs();
- if (this.preflightedWas !== newPreflights) {
- this.preflightedWas = newPreflights;
- if (newPreflights === "") {
- this.__view.cancelSubmit(this.el.form);
- }
- }
- if (this.activeRefs() === "") {
- this.el.value = null;
- }
- this.el.dispatchEvent(new CustomEvent(PHX_LIVE_FILE_UPDATED));
- }
- },
- LiveImgPreview: {
- mounted() {
- this.ref = this.el.getAttribute("data-phx-entry-ref");
- this.inputEl = document.getElementById(this.el.getAttribute(PHX_UPLOAD_REF));
- LiveUploader.getEntryDataURL(this.inputEl, this.ref, (url) => {
- this.url = url;
- this.el.src = url;
- });
- },
- destroyed() {
- URL.revokeObjectURL(this.url);
- }
- },
- FocusWrap: {
- mounted() {
- this.focusStart = this.el.firstElementChild;
- this.focusEnd = this.el.lastElementChild;
- this.focusStart.addEventListener("focus", () => aria_default.focusLast(this.el));
- this.focusEnd.addEventListener("focus", () => aria_default.focusFirst(this.el));
- this.el.addEventListener("phx:show-end", () => this.el.focus());
- if (window.getComputedStyle(this.el).display !== "none") {
- aria_default.focusFirst(this.el);
- }
- }
- }
- };
- var scrollTop = () => document.documentElement.scrollTop || document.body.scrollTop;
- var winHeight = () => window.innerHeight || document.documentElement.clientHeight;
- var isAtViewportTop = (el) => {
- let rect = el.getBoundingClientRect();
- return rect.top >= 0 && rect.left >= 0 && rect.top <= winHeight();
- };
- var isAtViewportBottom = (el) => {
- let rect = el.getBoundingClientRect();
- return rect.right >= 0 && rect.left >= 0 && rect.bottom <= winHeight();
- };
- var isWithinViewport = (el) => {
- let rect = el.getBoundingClientRect();
- return rect.top >= 0 && rect.left >= 0 && rect.top <= winHeight();
- };
- Hooks.InfiniteScroll = {
- mounted() {
- let scrollBefore = scrollTop();
- let topOverran = false;
- let throttleInterval = 500;
- let pendingOp = null;
- let onTopOverrun = this.throttle(throttleInterval, (topEvent, firstChild) => {
- pendingOp = () => true;
- this.liveSocket.execJSHookPush(this.el, topEvent, { id: firstChild.id, _overran: true }, () => {
- pendingOp = null;
- });
- });
- let onFirstChildAtTop = this.throttle(throttleInterval, (topEvent, firstChild) => {
- pendingOp = () => firstChild.scrollIntoView({ block: "start" });
- this.liveSocket.execJSHookPush(this.el, topEvent, { id: firstChild.id }, () => {
- pendingOp = null;
- if (!isWithinViewport(firstChild)) {
- firstChild.scrollIntoView({ block: "start" });
- }
- });
- });
- let onLastChildAtBottom = this.throttle(throttleInterval, (bottomEvent, lastChild) => {
- pendingOp = () => lastChild.scrollIntoView({ block: "end" });
- this.liveSocket.execJSHookPush(this.el, bottomEvent, { id: lastChild.id }, () => {
- pendingOp = null;
- if (!isWithinViewport(lastChild)) {
- lastChild.scrollIntoView({ block: "end" });
- }
- });
- });
- this.onScroll = (e) => {
- let scrollNow = scrollTop();
- if (pendingOp) {
- scrollBefore = scrollNow;
- return pendingOp();
- }
- let rect = this.el.getBoundingClientRect();
- let topEvent = this.el.getAttribute(this.liveSocket.binding("viewport-top"));
- let bottomEvent = this.el.getAttribute(this.liveSocket.binding("viewport-bottom"));
- let lastChild = this.el.lastElementChild;
- let firstChild = this.el.firstElementChild;
- let isScrollingUp = scrollNow < scrollBefore;
- let isScrollingDown = scrollNow > scrollBefore;
- if (isScrollingUp && topEvent && !topOverran && rect.top >= 0) {
- topOverran = true;
- onTopOverrun(topEvent, firstChild);
- } else if (isScrollingDown && topOverran && rect.top <= 0) {
- topOverran = false;
- }
- if (topEvent && isScrollingUp && isAtViewportTop(firstChild)) {
- onFirstChildAtTop(topEvent, firstChild);
- } else if (bottomEvent && isScrollingDown && isAtViewportBottom(lastChild)) {
- onLastChildAtBottom(bottomEvent, lastChild);
- }
- scrollBefore = scrollNow;
- };
- window.addEventListener("scroll", this.onScroll);
- },
- destroyed() {
- window.removeEventListener("scroll", this.onScroll);
- },
- throttle(interval, callback) {
- let lastCallAt = 0;
- let timer;
- return (...args) => {
- let now = Date.now();
- let remainingTime = interval - (now - lastCallAt);
- if (remainingTime <= 0 || remainingTime > interval) {
- if (timer) {
- clearTimeout(timer);
- timer = null;
- }
- lastCallAt = now;
- callback(...args);
- } else if (!timer) {
- timer = setTimeout(() => {
- lastCallAt = Date.now();
- timer = null;
- callback(...args);
- }, remainingTime);
- }
- };
- }
- };
- var hooks_default = Hooks;
- var DOMPostMorphRestorer = class {
- constructor(containerBefore, containerAfter, updateType) {
- let idsBefore = /* @__PURE__ */ new Set();
- let idsAfter = new Set([...containerAfter.children].map((child) => child.id));
- let elementsToModify = [];
- Array.from(containerBefore.children).forEach((child) => {
- if (child.id) {
- idsBefore.add(child.id);
- if (idsAfter.has(child.id)) {
- let previousElementId = child.previousElementSibling && child.previousElementSibling.id;
- elementsToModify.push({ elementId: child.id, previousElementId });
- }
- }
- });
- this.containerId = containerAfter.id;
- this.updateType = updateType;
- this.elementsToModify = elementsToModify;
- this.elementIdsToAdd = [...idsAfter].filter((id) => !idsBefore.has(id));
- }
- perform() {
- let container = dom_default.byId(this.containerId);
- this.elementsToModify.forEach((elementToModify) => {
- if (elementToModify.previousElementId) {
- maybe(document.getElementById(elementToModify.previousElementId), (previousElem) => {
- maybe(document.getElementById(elementToModify.elementId), (elem) => {
- let isInRightPlace = elem.previousElementSibling && elem.previousElementSibling.id == previousElem.id;
- if (!isInRightPlace) {
- previousElem.insertAdjacentElement("afterend", elem);
- }
- });
- });
- } else {
- maybe(document.getElementById(elementToModify.elementId), (elem) => {
- let isInRightPlace = elem.previousElementSibling == null;
- if (!isInRightPlace) {
- container.insertAdjacentElement("afterbegin", elem);
- }
- });
- }
- });
- if (this.updateType == "prepend") {
- this.elementIdsToAdd.reverse().forEach((elemId) => {
- maybe(document.getElementById(elemId), (elem) => container.insertAdjacentElement("afterbegin", elem));
- });
- }
- }
- };
- var DOCUMENT_FRAGMENT_NODE = 11;
- function morphAttrs(fromNode, toNode) {
- var toNodeAttrs = toNode.attributes;
- var attr;
- var attrName;
- var attrNamespaceURI;
- var attrValue;
- var fromValue;
- if (toNode.nodeType === DOCUMENT_FRAGMENT_NODE || fromNode.nodeType === DOCUMENT_FRAGMENT_NODE) {
- return;
- }
- for (var i = toNodeAttrs.length - 1; i >= 0; i--) {
- attr = toNodeAttrs[i];
- attrName = attr.name;
- attrNamespaceURI = attr.namespaceURI;
- attrValue = attr.value;
- if (attrNamespaceURI) {
- attrName = attr.localName || attrName;
- fromValue = fromNode.getAttributeNS(attrNamespaceURI, attrName);
- if (fromValue !== attrValue) {
- if (attr.prefix === "xmlns") {
- attrName = attr.name;
- }
- fromNode.setAttributeNS(attrNamespaceURI, attrName, attrValue);
- }
- } else {
- fromValue = fromNode.getAttribute(attrName);
- if (fromValue !== attrValue) {
- fromNode.setAttribute(attrName, attrValue);
- }
- }
- }
- var fromNodeAttrs = fromNode.attributes;
- for (var d = fromNodeAttrs.length - 1; d >= 0; d--) {
- attr = fromNodeAttrs[d];
- attrName = attr.name;
- attrNamespaceURI = attr.namespaceURI;
- if (attrNamespaceURI) {
- attrName = attr.localName || attrName;
- if (!toNode.hasAttributeNS(attrNamespaceURI, attrName)) {
- fromNode.removeAttributeNS(attrNamespaceURI, attrName);
- }
- } else {
- if (!toNode.hasAttribute(attrName)) {
- fromNode.removeAttribute(attrName);
- }
- }
- }
- }
- var range;
- var NS_XHTML = "http://www.w3.org/1999/xhtml";
- var doc = typeof document === "undefined" ? void 0 : document;
- var HAS_TEMPLATE_SUPPORT = !!doc && "content" in doc.createElement("template");
- var HAS_RANGE_SUPPORT = !!doc && doc.createRange && "createContextualFragment" in doc.createRange();
- function createFragmentFromTemplate(str) {
- var template = doc.createElement("template");
- template.innerHTML = str;
- return template.content.childNodes[0];
- }
- function createFragmentFromRange(str) {
- if (!range) {
- range = doc.createRange();
- range.selectNode(doc.body);
- }
- var fragment = range.createContextualFragment(str);
- return fragment.childNodes[0];
- }
- function createFragmentFromWrap(str) {
- var fragment = doc.createElement("body");
- fragment.innerHTML = str;
- return fragment.childNodes[0];
- }
- function toElement(str) {
- str = str.trim();
- if (HAS_TEMPLATE_SUPPORT) {
- return createFragmentFromTemplate(str);
- } else if (HAS_RANGE_SUPPORT) {
- return createFragmentFromRange(str);
- }
- return createFragmentFromWrap(str);
- }
- function compareNodeNames(fromEl, toEl) {
- var fromNodeName = fromEl.nodeName;
- var toNodeName = toEl.nodeName;
- var fromCodeStart, toCodeStart;
- if (fromNodeName === toNodeName) {
- return true;
- }
- fromCodeStart = fromNodeName.charCodeAt(0);
- toCodeStart = toNodeName.charCodeAt(0);
- if (fromCodeStart <= 90 && toCodeStart >= 97) {
- return fromNodeName === toNodeName.toUpperCase();
- } else if (toCodeStart <= 90 && fromCodeStart >= 97) {
- return toNodeName === fromNodeName.toUpperCase();
- } else {
- return false;
- }
- }
- function createElementNS(name, namespaceURI) {
- return !namespaceURI || namespaceURI === NS_XHTML ? doc.createElement(name) : doc.createElementNS(namespaceURI, name);
- }
- function moveChildren(fromEl, toEl) {
- var curChild = fromEl.firstChild;
- while (curChild) {
- var nextChild = curChild.nextSibling;
- toEl.appendChild(curChild);
- curChild = nextChild;
- }
- return toEl;
- }
- function syncBooleanAttrProp(fromEl, toEl, name) {
- if (fromEl[name] !== toEl[name]) {
- fromEl[name] = toEl[name];
- if (fromEl[name]) {
- fromEl.setAttribute(name, "");
- } else {
- fromEl.removeAttribute(name);
- }
- }
- }
- var specialElHandlers = {
- OPTION: function(fromEl, toEl) {
- var parentNode = fromEl.parentNode;
- if (parentNode) {
- var parentName = parentNode.nodeName.toUpperCase();
- if (parentName === "OPTGROUP") {
- parentNode = parentNode.parentNode;
- parentName = parentNode && parentNode.nodeName.toUpperCase();
- }
- if (parentName === "SELECT" && !parentNode.hasAttribute("multiple")) {
- if (fromEl.hasAttribute("selected") && !toEl.selected) {
- fromEl.setAttribute("selected", "selected");
- fromEl.removeAttribute("selected");
- }
- parentNode.selectedIndex = -1;
- }
- }
- syncBooleanAttrProp(fromEl, toEl, "selected");
- },
- INPUT: function(fromEl, toEl) {
- syncBooleanAttrProp(fromEl, toEl, "checked");
- syncBooleanAttrProp(fromEl, toEl, "disabled");
- if (fromEl.value !== toEl.value) {
- fromEl.value = toEl.value;
- }
- if (!toEl.hasAttribute("value")) {
- fromEl.removeAttribute("value");
- }
- },
- TEXTAREA: function(fromEl, toEl) {
- var newValue = toEl.value;
- if (fromEl.value !== newValue) {
- fromEl.value = newValue;
- }
- var firstChild = fromEl.firstChild;
- if (firstChild) {
- var oldValue = firstChild.nodeValue;
- if (oldValue == newValue || !newValue && oldValue == fromEl.placeholder) {
- return;
- }
- firstChild.nodeValue = newValue;
- }
- },
- SELECT: function(fromEl, toEl) {
- if (!toEl.hasAttribute("multiple")) {
- var selectedIndex = -1;
- var i = 0;
- var curChild = fromEl.firstChild;
- var optgroup;
- var nodeName;
- while (curChild) {
- nodeName = curChild.nodeName && curChild.nodeName.toUpperCase();
- if (nodeName === "OPTGROUP") {
- optgroup = curChild;
- curChild = optgroup.firstChild;
- } else {
- if (nodeName === "OPTION") {
- if (curChild.hasAttribute("selected")) {
- selectedIndex = i;
- break;
- }
- i++;
- }
- curChild = curChild.nextSibling;
- if (!curChild && optgroup) {
- curChild = optgroup.nextSibling;
- optgroup = null;
- }
- }
- }
- fromEl.selectedIndex = selectedIndex;
- }
- }
- };
- var ELEMENT_NODE = 1;
- var DOCUMENT_FRAGMENT_NODE$1 = 11;
- var TEXT_NODE = 3;
- var COMMENT_NODE = 8;
- function noop() {
- }
- function defaultGetNodeKey(node) {
- if (node) {
- return node.getAttribute && node.getAttribute("id") || node.id;
- }
- }
- function morphdomFactory(morphAttrs2) {
- return function morphdom2(fromNode, toNode, options) {
- if (!options) {
- options = {};
- }
- if (typeof toNode === "string") {
- if (fromNode.nodeName === "#document" || fromNode.nodeName === "HTML" || fromNode.nodeName === "BODY") {
- var toNodeHtml = toNode;
- toNode = doc.createElement("html");
- toNode.innerHTML = toNodeHtml;
- } else {
- toNode = toElement(toNode);
- }
- } else if (toNode.nodeType === DOCUMENT_FRAGMENT_NODE$1) {
- toNode = toNode.firstElementChild;
- }
- var getNodeKey = options.getNodeKey || defaultGetNodeKey;
- var onBeforeNodeAdded = options.onBeforeNodeAdded || noop;
- var onNodeAdded = options.onNodeAdded || noop;
- var onBeforeElUpdated = options.onBeforeElUpdated || noop;
- var onElUpdated = options.onElUpdated || noop;
- var onBeforeNodeDiscarded = options.onBeforeNodeDiscarded || noop;
- var onNodeDiscarded = options.onNodeDiscarded || noop;
- var onBeforeElChildrenUpdated = options.onBeforeElChildrenUpdated || noop;
- var skipFromChildren = options.skipFromChildren || noop;
- var addChild = options.addChild || function(parent, child) {
- return parent.appendChild(child);
- };
- var childrenOnly = options.childrenOnly === true;
- var fromNodesLookup = /* @__PURE__ */ Object.create(null);
- var keyedRemovalList = [];
- function addKeyedRemoval(key) {
- keyedRemovalList.push(key);
- }
- function walkDiscardedChildNodes(node, skipKeyedNodes) {
- if (node.nodeType === ELEMENT_NODE) {
- var curChild = node.firstChild;
- while (curChild) {
- var key = void 0;
- if (skipKeyedNodes && (key = getNodeKey(curChild))) {
- addKeyedRemoval(key);
- } else {
- onNodeDiscarded(curChild);
- if (curChild.firstChild) {
- walkDiscardedChildNodes(curChild, skipKeyedNodes);
- }
- }
- curChild = curChild.nextSibling;
- }
- }
- }
- function removeNode(node, parentNode, skipKeyedNodes) {
- if (onBeforeNodeDiscarded(node) === false) {
- return;
- }
- if (parentNode) {
- parentNode.removeChild(node);
- }
- onNodeDiscarded(node);
- walkDiscardedChildNodes(node, skipKeyedNodes);
- }
- function indexTree(node) {
- if (node.nodeType === ELEMENT_NODE || node.nodeType === DOCUMENT_FRAGMENT_NODE$1) {
- var curChild = node.firstChild;
- while (curChild) {
- var key = getNodeKey(curChild);
- if (key) {
- fromNodesLookup[key] = curChild;
- }
- indexTree(curChild);
- curChild = curChild.nextSibling;
- }
- }
- }
- indexTree(fromNode);
- function handleNodeAdded(el) {
- onNodeAdded(el);
- var curChild = el.firstChild;
- while (curChild) {
- var nextSibling = curChild.nextSibling;
- var key = getNodeKey(curChild);
- if (key) {
- var unmatchedFromEl = fromNodesLookup[key];
- if (unmatchedFromEl && compareNodeNames(curChild, unmatchedFromEl)) {
- curChild.parentNode.replaceChild(unmatchedFromEl, curChild);
- morphEl(unmatchedFromEl, curChild);
- } else {
- handleNodeAdded(curChild);
- }
- } else {
- handleNodeAdded(curChild);
- }
- curChild = nextSibling;
- }
- }
- function cleanupFromEl(fromEl, curFromNodeChild, curFromNodeKey) {
- while (curFromNodeChild) {
- var fromNextSibling = curFromNodeChild.nextSibling;
- if (curFromNodeKey = getNodeKey(curFromNodeChild)) {
- addKeyedRemoval(curFromNodeKey);
- } else {
- removeNode(curFromNodeChild, fromEl, true);
- }
- curFromNodeChild = fromNextSibling;
- }
- }
- function morphEl(fromEl, toEl, childrenOnly2) {
- var toElKey = getNodeKey(toEl);
- if (toElKey) {
- delete fromNodesLookup[toElKey];
- }
- if (!childrenOnly2) {
- if (onBeforeElUpdated(fromEl, toEl) === false) {
- return;
- }
- morphAttrs2(fromEl, toEl);
- onElUpdated(fromEl);
- if (onBeforeElChildrenUpdated(fromEl, toEl) === false) {
- return;
- }
- }
- if (fromEl.nodeName !== "TEXTAREA") {
- morphChildren(fromEl, toEl);
- } else {
- specialElHandlers.TEXTAREA(fromEl, toEl);
- }
- }
- function morphChildren(fromEl, toEl) {
- var skipFrom = skipFromChildren(fromEl);
- var curToNodeChild = toEl.firstChild;
- var curFromNodeChild = fromEl.firstChild;
- var curToNodeKey;
- var curFromNodeKey;
- var fromNextSibling;
- var toNextSibling;
- var matchingFromEl;
- outer:
- while (curToNodeChild) {
- toNextSibling = curToNodeChild.nextSibling;
- curToNodeKey = getNodeKey(curToNodeChild);
- while (!skipFrom && curFromNodeChild) {
- fromNextSibling = curFromNodeChild.nextSibling;
- if (curToNodeChild.isSameNode && curToNodeChild.isSameNode(curFromNodeChild)) {
- curToNodeChild = toNextSibling;
- curFromNodeChild = fromNextSibling;
- continue outer;
- }
- curFromNodeKey = getNodeKey(curFromNodeChild);
- var curFromNodeType = curFromNodeChild.nodeType;
- var isCompatible = void 0;
- if (curFromNodeType === curToNodeChild.nodeType) {
- if (curFromNodeType === ELEMENT_NODE) {
- if (curToNodeKey) {
- if (curToNodeKey !== curFromNodeKey) {
- if (matchingFromEl = fromNodesLookup[curToNodeKey]) {
- if (fromNextSibling === matchingFromEl) {
- isCompatible = false;
- } else {
- fromEl.insertBefore(matchingFromEl, curFromNodeChild);
- if (curFromNodeKey) {
- addKeyedRemoval(curFromNodeKey);
- } else {
- removeNode(curFromNodeChild, fromEl, true);
- }
- curFromNodeChild = matchingFromEl;
- }
- } else {
- isCompatible = false;
- }
- }
- } else if (curFromNodeKey) {
- isCompatible = false;
- }
- isCompatible = isCompatible !== false && compareNodeNames(curFromNodeChild, curToNodeChild);
- if (isCompatible) {
- morphEl(curFromNodeChild, curToNodeChild);
- }
- } else if (curFromNodeType === TEXT_NODE || curFromNodeType == COMMENT_NODE) {
- isCompatible = true;
- if (curFromNodeChild.nodeValue !== curToNodeChild.nodeValue) {
- curFromNodeChild.nodeValue = curToNodeChild.nodeValue;
- }
- }
- }
- if (isCompatible) {
- curToNodeChild = toNextSibling;
- curFromNodeChild = fromNextSibling;
- continue outer;
- }
- if (curFromNodeKey) {
- addKeyedRemoval(curFromNodeKey);
- } else {
- removeNode(curFromNodeChild, fromEl, true);
- }
- curFromNodeChild = fromNextSibling;
- }
- if (curToNodeKey && (matchingFromEl = fromNodesLookup[curToNodeKey]) && compareNodeNames(matchingFromEl, curToNodeChild)) {
- if (!skipFrom) {
- addChild(fromEl, matchingFromEl);
- }
- morphEl(matchingFromEl, curToNodeChild);
- } else {
- var onBeforeNodeAddedResult = onBeforeNodeAdded(curToNodeChild);
- if (onBeforeNodeAddedResult !== false) {
- if (onBeforeNodeAddedResult) {
- curToNodeChild = onBeforeNodeAddedResult;
- }
- if (curToNodeChild.actualize) {
- curToNodeChild = curToNodeChild.actualize(fromEl.ownerDocument || doc);
- }
- addChild(fromEl, curToNodeChild);
- handleNodeAdded(curToNodeChild);
- }
- }
- curToNodeChild = toNextSibling;
- curFromNodeChild = fromNextSibling;
- }
- cleanupFromEl(fromEl, curFromNodeChild, curFromNodeKey);
- var specialElHandler = specialElHandlers[fromEl.nodeName];
- if (specialElHandler) {
- specialElHandler(fromEl, toEl);
- }
- }
- var morphedNode = fromNode;
- var morphedNodeType = morphedNode.nodeType;
- var toNodeType = toNode.nodeType;
- if (!childrenOnly) {
- if (morphedNodeType === ELEMENT_NODE) {
- if (toNodeType === ELEMENT_NODE) {
- if (!compareNodeNames(fromNode, toNode)) {
- onNodeDiscarded(fromNode);
- morphedNode = moveChildren(fromNode, createElementNS(toNode.nodeName, toNode.namespaceURI));
- }
- } else {
- morphedNode = toNode;
- }
- } else if (morphedNodeType === TEXT_NODE || morphedNodeType === COMMENT_NODE) {
- if (toNodeType === morphedNodeType) {
- if (morphedNode.nodeValue !== toNode.nodeValue) {
- morphedNode.nodeValue = toNode.nodeValue;
- }
- return morphedNode;
- } else {
- morphedNode = toNode;
- }
- }
- }
- if (morphedNode === toNode) {
- onNodeDiscarded(fromNode);
- } else {
- if (toNode.isSameNode && toNode.isSameNode(morphedNode)) {
- return;
- }
- morphEl(morphedNode, toNode, childrenOnly);
- if (keyedRemovalList) {
- for (var i = 0, len = keyedRemovalList.length; i < len; i++) {
- var elToRemove = fromNodesLookup[keyedRemovalList[i]];
- if (elToRemove) {
- removeNode(elToRemove, elToRemove.parentNode, false);
- }
- }
- }
- }
- if (!childrenOnly && morphedNode !== fromNode && fromNode.parentNode) {
- if (morphedNode.actualize) {
- morphedNode = morphedNode.actualize(fromNode.ownerDocument || doc);
- }
- fromNode.parentNode.replaceChild(morphedNode, fromNode);
- }
- return morphedNode;
- };
- }
- var morphdom = morphdomFactory(morphAttrs);
- var morphdom_esm_default = morphdom;
- var DOMPatch = class {
- static patchEl(fromEl, toEl, activeElement) {
- morphdom_esm_default(fromEl, toEl, {
- childrenOnly: false,
- onBeforeElUpdated: (fromEl2, toEl2) => {
- if (activeElement && activeElement.isSameNode(fromEl2) && dom_default.isFormInput(fromEl2)) {
- dom_default.mergeFocusedInput(fromEl2, toEl2);
- return false;
- }
- }
- });
- }
- constructor(view, container, id, html, streams, targetCID) {
- this.view = view;
- this.liveSocket = view.liveSocket;
- this.container = container;
- this.id = id;
- this.rootID = view.root.id;
- this.html = html;
- this.streams = streams;
- this.streamInserts = {};
- this.targetCID = targetCID;
- this.cidPatch = isCid(this.targetCID);
- this.pendingRemoves = [];
- this.phxRemove = this.liveSocket.binding("remove");
- this.callbacks = {
- beforeadded: [],
- beforeupdated: [],
- beforephxChildAdded: [],
- afteradded: [],
- afterupdated: [],
- afterdiscarded: [],
- afterphxChildAdded: [],
- aftertransitionsDiscarded: []
- };
- }
- before(kind, callback) {
- this.callbacks[`before${kind}`].push(callback);
- }
- after(kind, callback) {
- this.callbacks[`after${kind}`].push(callback);
- }
- trackBefore(kind, ...args) {
- this.callbacks[`before${kind}`].forEach((callback) => callback(...args));
- }
- trackAfter(kind, ...args) {
- this.callbacks[`after${kind}`].forEach((callback) => callback(...args));
- }
- markPrunableContentForRemoval() {
- let phxUpdate = this.liveSocket.binding(PHX_UPDATE);
- dom_default.all(this.container, `[${phxUpdate}=${PHX_STREAM}]`, (el) => el.innerHTML = "");
- dom_default.all(this.container, `[${phxUpdate}=append] > *, [${phxUpdate}=prepend] > *`, (el) => {
- el.setAttribute(PHX_PRUNE, "");
- });
- }
- perform() {
- let { view, liveSocket: liveSocket2, container, html } = this;
- let targetContainer = this.isCIDPatch() ? this.targetCIDContainer(html) : container;
- if (this.isCIDPatch() && !targetContainer) {
- return;
- }
- let focused = liveSocket2.getActiveElement();
- let { selectionStart, selectionEnd } = focused && dom_default.hasSelectionRange(focused) ? focused : {};
- let phxUpdate = liveSocket2.binding(PHX_UPDATE);
- let phxFeedbackFor = liveSocket2.binding(PHX_FEEDBACK_FOR);
- let disableWith = liveSocket2.binding(PHX_DISABLE_WITH);
- let phxViewportTop = liveSocket2.binding(PHX_VIEWPORT_TOP);
- let phxViewportBottom = liveSocket2.binding(PHX_VIEWPORT_BOTTOM);
- let phxTriggerExternal = liveSocket2.binding(PHX_TRIGGER_ACTION);
- let added = [];
- let trackedInputs = [];
- let updates = [];
- let appendPrependUpdates = [];
- let externalFormTriggered = null;
- let diffHTML = liveSocket2.time("premorph container prep", () => {
- return this.buildDiffHTML(container, html, phxUpdate, targetContainer);
- });
- this.trackBefore("added", container);
- this.trackBefore("updated", container, container);
- liveSocket2.time("morphdom", () => {
- this.streams.forEach(([ref, inserts, deleteIds, reset]) => {
- Object.entries(inserts).forEach(([key, [streamAt, limit]]) => {
- this.streamInserts[key] = { ref, streamAt, limit };
- });
- if (reset !== void 0) {
- dom_default.all(container, `[${PHX_STREAM_REF}="${ref}"]`, (child) => {
- this.removeStreamChildElement(child);
- });
- }
- deleteIds.forEach((id) => {
- let child = container.querySelector(`[id="${id}"]`);
- if (child) {
- this.removeStreamChildElement(child);
- }
- });
- });
- morphdom_esm_default(targetContainer, diffHTML, {
- childrenOnly: targetContainer.getAttribute(PHX_COMPONENT) === null,
- getNodeKey: (node) => {
- return dom_default.isPhxDestroyed(node) ? null : node.id;
- },
- skipFromChildren: (from) => {
- return from.getAttribute(phxUpdate) === PHX_STREAM;
- },
- addChild: (parent, child) => {
- let { ref, streamAt, limit } = this.getStreamInsert(child);
- if (ref === void 0) {
- return parent.appendChild(child);
- }
- dom_default.putSticky(child, PHX_STREAM_REF, (el) => el.setAttribute(PHX_STREAM_REF, ref));
- if (streamAt === 0) {
- parent.insertAdjacentElement("afterbegin", child);
- } else if (streamAt === -1) {
- parent.appendChild(child);
- } else if (streamAt > 0) {
- let sibling = Array.from(parent.children)[streamAt];
- parent.insertBefore(child, sibling);
- }
- let children = limit !== null && Array.from(parent.children);
- let childrenToRemove = [];
- if (limit && limit < 0 && children.length > limit * -1) {
- childrenToRemove = children.slice(0, children.length + limit);
- } else if (limit && limit >= 0 && children.length > limit) {
- childrenToRemove = children.slice(limit);
- }
- childrenToRemove.forEach((removeChild) => {
- if (!this.streamInserts[removeChild.id]) {
- this.removeStreamChildElement(removeChild);
- }
- });
- },
- onBeforeNodeAdded: (el) => {
- dom_default.maybeAddPrivateHooks(el, phxViewportTop, phxViewportBottom);
- this.trackBefore("added", el);
- return el;
- },
- onNodeAdded: (el) => {
- if (el.getAttribute) {
- this.maybeReOrderStream(el);
- }
- if (el instanceof HTMLImageElement && el.srcset) {
- el.srcset = el.srcset;
- } else if (el instanceof HTMLVideoElement && el.autoplay) {
- el.play();
- }
- if (dom_default.isNowTriggerFormExternal(el, phxTriggerExternal)) {
- externalFormTriggered = el;
- }
- if (el.getAttribute && el.getAttribute("name") && dom_default.isFormInput(el)) {
- trackedInputs.push(el);
- }
- if (dom_default.isPhxChild(el) && view.ownsElement(el) || dom_default.isPhxSticky(el) && view.ownsElement(el.parentNode)) {
- this.trackAfter("phxChildAdded", el);
- }
- added.push(el);
- },
- onNodeDiscarded: (el) => this.onNodeDiscarded(el),
- onBeforeNodeDiscarded: (el) => {
- if (el.getAttribute && el.getAttribute(PHX_PRUNE) !== null) {
- return true;
- }
- if (el.parentElement !== null && el.id && dom_default.isPhxUpdate(el.parentElement, phxUpdate, [PHX_STREAM, "append", "prepend"])) {
- return false;
- }
- if (this.maybePendingRemove(el)) {
- return false;
- }
- if (this.skipCIDSibling(el)) {
- return false;
- }
- return true;
- },
- onElUpdated: (el) => {
- if (dom_default.isNowTriggerFormExternal(el, phxTriggerExternal)) {
- externalFormTriggered = el;
- }
- updates.push(el);
- this.maybeReOrderStream(el);
- },
- onBeforeElUpdated: (fromEl, toEl) => {
- dom_default.maybeAddPrivateHooks(toEl, phxViewportTop, phxViewportBottom);
- dom_default.cleanChildNodes(toEl, phxUpdate);
- if (this.skipCIDSibling(toEl)) {
- return false;
- }
- if (dom_default.isPhxSticky(fromEl)) {
- return false;
- }
- if (dom_default.isIgnored(fromEl, phxUpdate) || fromEl.form && fromEl.form.isSameNode(externalFormTriggered)) {
- this.trackBefore("updated", fromEl, toEl);
- dom_default.mergeAttrs(fromEl, toEl, { isIgnored: true });
- updates.push(fromEl);
- dom_default.applyStickyOperations(fromEl);
- return false;
- }
- if (fromEl.type === "number" && (fromEl.validity && fromEl.validity.badInput)) {
- return false;
- }
- if (!dom_default.syncPendingRef(fromEl, toEl, disableWith)) {
- if (dom_default.isUploadInput(fromEl)) {
- this.trackBefore("updated", fromEl, toEl);
- updates.push(fromEl);
- }
- dom_default.applyStickyOperations(fromEl);
- return false;
- }
- if (dom_default.isPhxChild(toEl)) {
- let prevSession = fromEl.getAttribute(PHX_SESSION);
- dom_default.mergeAttrs(fromEl, toEl, { exclude: [PHX_STATIC] });
- if (prevSession !== "") {
- fromEl.setAttribute(PHX_SESSION, prevSession);
- }
- fromEl.setAttribute(PHX_ROOT_ID, this.rootID);
- dom_default.applyStickyOperations(fromEl);
- return false;
- }
- dom_default.copyPrivates(toEl, fromEl);
- let isFocusedFormEl = focused && fromEl.isSameNode(focused) && dom_default.isFormInput(fromEl);
- if (isFocusedFormEl && fromEl.type !== "hidden") {
- this.trackBefore("updated", fromEl, toEl);
- dom_default.mergeFocusedInput(fromEl, toEl);
- dom_default.syncAttrsToProps(fromEl);
- updates.push(fromEl);
- dom_default.applyStickyOperations(fromEl);
- trackedInputs.push(fromEl);
- return false;
- } else {
- if (dom_default.isPhxUpdate(toEl, phxUpdate, ["append", "prepend"])) {
- appendPrependUpdates.push(new DOMPostMorphRestorer(fromEl, toEl, toEl.getAttribute(phxUpdate)));
- }
- dom_default.syncAttrsToProps(toEl);
- dom_default.applyStickyOperations(toEl);
- if (toEl.getAttribute("name") && dom_default.isFormInput(toEl)) {
- trackedInputs.push(toEl);
- }
- this.trackBefore("updated", fromEl, toEl);
- return true;
- }
- }
- });
- });
- if (liveSocket2.isDebugEnabled()) {
- detectDuplicateIds();
- }
- if (appendPrependUpdates.length > 0) {
- liveSocket2.time("post-morph append/prepend restoration", () => {
- appendPrependUpdates.forEach((update) => update.perform());
- });
- }
- trackedInputs.forEach((input) => {
- dom_default.maybeHideFeedback(targetContainer, input, phxFeedbackFor);
- });
- liveSocket2.silenceEvents(() => dom_default.restoreFocus(focused, selectionStart, selectionEnd));
- dom_default.dispatchEvent(document, "phx:update");
- added.forEach((el) => this.trackAfter("added", el));
- updates.forEach((el) => this.trackAfter("updated", el));
- this.transitionPendingRemoves();
- if (externalFormTriggered) {
- liveSocket2.unload();
- externalFormTriggered.submit();
- }
- return true;
- }
- onNodeDiscarded(el) {
- if (dom_default.isPhxChild(el) || dom_default.isPhxSticky(el)) {
- this.liveSocket.destroyViewByEl(el);
- }
- this.trackAfter("discarded", el);
- }
- maybePendingRemove(node) {
- if (node.getAttribute && node.getAttribute(this.phxRemove) !== null) {
- this.pendingRemoves.push(node);
- return true;
- } else {
- return false;
- }
- }
- removeStreamChildElement(child) {
- if (!this.maybePendingRemove(child)) {
- child.remove();
- this.onNodeDiscarded(child);
- }
- }
- getStreamInsert(el) {
- let insert = el.id ? this.streamInserts[el.id] : {};
- return insert || {};
- }
- maybeReOrderStream(el) {
- let { ref, streamAt, limit } = this.getStreamInsert(el);
- if (streamAt === void 0) {
- return;
- }
- dom_default.putSticky(el, PHX_STREAM_REF, (el2) => el2.setAttribute(PHX_STREAM_REF, ref));
- if (streamAt === 0) {
- el.parentElement.insertBefore(el, el.parentElement.firstElementChild);
- } else if (streamAt > 0) {
- let children = Array.from(el.parentElement.children);
- let oldIndex = children.indexOf(el);
- if (streamAt >= children.length - 1) {
- el.parentElement.appendChild(el);
- } else {
- let sibling = children[streamAt];
- if (oldIndex > streamAt) {
- el.parentElement.insertBefore(el, sibling);
- } else {
- el.parentElement.insertBefore(el, sibling.nextElementSibling);
- }
- }
- }
- }
- transitionPendingRemoves() {
- let { pendingRemoves, liveSocket: liveSocket2 } = this;
- if (pendingRemoves.length > 0) {
- liveSocket2.transitionRemoves(pendingRemoves);
- liveSocket2.requestDOMUpdate(() => {
- pendingRemoves.forEach((el) => {
- let child = dom_default.firstPhxChild(el);
- if (child) {
- liveSocket2.destroyViewByEl(child);
- }
- el.remove();
- });
- this.trackAfter("transitionsDiscarded", pendingRemoves);
- });
- }
- }
- isCIDPatch() {
- return this.cidPatch;
- }
- skipCIDSibling(el) {
- return el.nodeType === Node.ELEMENT_NODE && el.getAttribute(PHX_SKIP) !== null;
- }
- targetCIDContainer(html) {
- if (!this.isCIDPatch()) {
- return;
- }
- let [first, ...rest] = dom_default.findComponentNodeList(this.container, this.targetCID);
- if (rest.length === 0 && dom_default.childNodeLength(html) === 1) {
- return first;
- } else {
- return first && first.parentNode;
- }
- }
- buildDiffHTML(container, html, phxUpdate, targetContainer) {
- let isCIDPatch = this.isCIDPatch();
- let isCIDWithSingleRoot = isCIDPatch && targetContainer.getAttribute(PHX_COMPONENT) === this.targetCID.toString();
- if (!isCIDPatch || isCIDWithSingleRoot) {
- return html;
- } else {
- let diffContainer = null;
- let template = document.createElement("template");
- diffContainer = dom_default.cloneNode(targetContainer);
- let [firstComponent, ...rest] = dom_default.findComponentNodeList(diffContainer, this.targetCID);
- template.innerHTML = html;
- rest.forEach((el) => el.remove());
- Array.from(diffContainer.childNodes).forEach((child) => {
- if (child.id && child.nodeType === Node.ELEMENT_NODE && child.getAttribute(PHX_COMPONENT) !== this.targetCID.toString()) {
- child.setAttribute(PHX_SKIP, "");
- child.innerHTML = "";
- }
- });
- Array.from(template.content.childNodes).forEach((el) => diffContainer.insertBefore(el, firstComponent));
- firstComponent.remove();
- return diffContainer.outerHTML;
- }
- }
- indexOf(parent, child) {
- return Array.from(parent.children).indexOf(child);
- }
- };
- var Rendered = class {
- static extract(diff) {
- let { [REPLY]: reply, [EVENTS]: events, [TITLE]: title } = diff;
- delete diff[REPLY];
- delete diff[EVENTS];
- delete diff[TITLE];
- return { diff, title, reply: reply || null, events: events || [] };
- }
- constructor(viewId, rendered) {
- this.viewId = viewId;
- this.rendered = {};
- this.mergeDiff(rendered);
- }
- parentViewId() {
- return this.viewId;
- }
- toString(onlyCids) {
- let [str, streams] = this.recursiveToString(this.rendered, this.rendered[COMPONENTS], onlyCids);
- return [str, streams];
- }
- recursiveToString(rendered, components = rendered[COMPONENTS], onlyCids) {
- onlyCids = onlyCids ? new Set(onlyCids) : null;
- let output = { buffer: "", components, onlyCids, streams: /* @__PURE__ */ new Set() };
- this.toOutputBuffer(rendered, null, output);
- return [output.buffer, output.streams];
- }
- componentCIDs(diff) {
- return Object.keys(diff[COMPONENTS] || {}).map((i) => parseInt(i));
- }
- isComponentOnlyDiff(diff) {
- if (!diff[COMPONENTS]) {
- return false;
- }
- return Object.keys(diff).length === 1;
- }
- getComponent(diff, cid) {
- return diff[COMPONENTS][cid];
- }
- mergeDiff(diff) {
- let newc = diff[COMPONENTS];
- let cache = {};
- delete diff[COMPONENTS];
- this.rendered = this.mutableMerge(this.rendered, diff);
- this.rendered[COMPONENTS] = this.rendered[COMPONENTS] || {};
- if (newc) {
- let oldc = this.rendered[COMPONENTS];
- for (let cid in newc) {
- newc[cid] = this.cachedFindComponent(cid, newc[cid], oldc, newc, cache);
- }
- for (let cid in newc) {
- oldc[cid] = newc[cid];
- }
- diff[COMPONENTS] = newc;
- }
- }
- cachedFindComponent(cid, cdiff, oldc, newc, cache) {
- if (cache[cid]) {
- return cache[cid];
- } else {
- let ndiff, stat, scid = cdiff[STATIC];
- if (isCid(scid)) {
- let tdiff;
- if (scid > 0) {
- tdiff = this.cachedFindComponent(scid, newc[scid], oldc, newc, cache);
- } else {
- tdiff = oldc[-scid];
- }
- stat = tdiff[STATIC];
- ndiff = this.cloneMerge(tdiff, cdiff);
- ndiff[STATIC] = stat;
- } else {
- ndiff = cdiff[STATIC] !== void 0 ? cdiff : this.cloneMerge(oldc[cid] || {}, cdiff);
- }
- cache[cid] = ndiff;
- return ndiff;
- }
- }
- mutableMerge(target, source) {
- if (source[STATIC] !== void 0) {
- return source;
- } else {
- this.doMutableMerge(target, source);
- return target;
- }
- }
- doMutableMerge(target, source) {
- for (let key in source) {
- let val = source[key];
- let targetVal = target[key];
- let isObjVal = isObject(val);
- if (isObjVal && val[STATIC] === void 0 && isObject(targetVal)) {
- this.doMutableMerge(targetVal, val);
- } else {
- target[key] = val;
- }
- }
- }
- cloneMerge(target, source) {
- let merged = __spreadValues(__spreadValues({}, target), source);
- for (let key in merged) {
- let val = source[key];
- let targetVal = target[key];
- if (isObject(val) && val[STATIC] === void 0 && isObject(targetVal)) {
- merged[key] = this.cloneMerge(targetVal, val);
- }
- }
- return merged;
- }
- componentToString(cid) {
- let [str, streams] = this.recursiveCIDToString(this.rendered[COMPONENTS], cid);
- return [str, streams];
- }
- pruneCIDs(cids) {
- cids.forEach((cid) => delete this.rendered[COMPONENTS][cid]);
- }
- get() {
- return this.rendered;
- }
- isNewFingerprint(diff = {}) {
- return !!diff[STATIC];
- }
- templateStatic(part, templates) {
- if (typeof part === "number") {
- return templates[part];
- } else {
- return part;
- }
- }
- toOutputBuffer(rendered, templates, output) {
- if (rendered[DYNAMICS]) {
- return this.comprehensionToBuffer(rendered, templates, output);
- }
- let { [STATIC]: statics } = rendered;
- statics = this.templateStatic(statics, templates);
- output.buffer += statics[0];
- for (let i = 1; i < statics.length; i++) {
- this.dynamicToBuffer(rendered[i - 1], templates, output);
- output.buffer += statics[i];
- }
- }
- comprehensionToBuffer(rendered, templates, output) {
- let { [DYNAMICS]: dynamics, [STATIC]: statics, [STREAM]: stream } = rendered;
- let [_ref, _inserts, deleteIds, reset] = stream || [null, {}, [], null];
- statics = this.templateStatic(statics, templates);
- let compTemplates = templates || rendered[TEMPLATES];
- for (let d = 0; d < dynamics.length; d++) {
- let dynamic = dynamics[d];
- output.buffer += statics[0];
- for (let i = 1; i < statics.length; i++) {
- this.dynamicToBuffer(dynamic[i - 1], compTemplates, output);
- output.buffer += statics[i];
- }
- }
- if (stream !== void 0 && (rendered[DYNAMICS].length > 0 || deleteIds.length > 0 || reset)) {
- delete rendered[STREAM];
- output.streams.add(stream);
- }
- }
- dynamicToBuffer(rendered, templates, output) {
- if (typeof rendered === "number") {
- let [str, streams] = this.recursiveCIDToString(output.components, rendered, output.onlyCids);
- output.buffer += str;
- output.streams = /* @__PURE__ */ new Set([...output.streams, ...streams]);
- } else if (isObject(rendered)) {
- this.toOutputBuffer(rendered, templates, output);
- } else {
- output.buffer += rendered;
- }
- }
- recursiveCIDToString(components, cid, onlyCids) {
- let component = components[cid] || logError(`no component for CID ${cid}`, components);
- let template = document.createElement("template");
- let [html, streams] = this.recursiveToString(component, components, onlyCids);
- template.innerHTML = html;
- let container = template.content;
- let skip = onlyCids && !onlyCids.has(cid);
- let [hasChildNodes, hasChildComponents] = Array.from(container.childNodes).reduce(([hasNodes, hasComponents], child, i) => {
- if (child.nodeType === Node.ELEMENT_NODE) {
- if (child.getAttribute(PHX_COMPONENT)) {
- return [hasNodes, true];
- }
- child.setAttribute(PHX_COMPONENT, cid);
- if (!child.id) {
- child.id = `${this.parentViewId()}-${cid}-${i}`;
- }
- if (skip) {
- child.setAttribute(PHX_SKIP, "");
- child.innerHTML = "";
- }
- return [true, hasComponents];
- } else {
- if (child.nodeValue.trim() !== "") {
- logError(`only HTML element tags are allowed at the root of components.
-
-got: "${child.nodeValue.trim()}"
+got: "${p.nodeValue.trim()}"
within:
-`, template.innerHTML.trim());
- child.replaceWith(this.createSpan(child.nodeValue, cid));
- return [true, hasComponents];
- } else {
- child.remove();
- return [hasNodes, hasComponents];
- }
- }
- }, [false, false]);
- if (!hasChildNodes && !hasChildComponents) {
- logError("expected at least one HTML element tag inside a component, but the component is empty:\n", template.innerHTML.trim());
- return [this.createSpan("", cid).outerHTML, streams];
- } else if (!hasChildNodes && hasChildComponents) {
- logError("expected at least one HTML element tag directly inside a component, but only subcomponents were found. A component must render at least one HTML tag directly inside itself.", template.innerHTML.trim());
- return [template.innerHTML, streams];
- } else {
- return [template.innerHTML, streams];
- }
- }
- createSpan(text, cid) {
- let span = document.createElement("span");
- span.innerText = text;
- span.setAttribute(PHX_COMPONENT, cid);
- return span;
- }
- };
- var viewHookID = 1;
- var ViewHook = class {
- static makeID() {
- return viewHookID++;
- }
- static elementID(el) {
- return el.phxHookId;
- }
- constructor(view, el, callbacks) {
- this.__view = view;
- this.liveSocket = view.liveSocket;
- this.__callbacks = callbacks;
- this.__listeners = /* @__PURE__ */ new Set();
- this.__isDisconnected = false;
- this.el = el;
- this.el.phxHookId = this.constructor.makeID();
- for (let key in this.__callbacks) {
- this[key] = this.__callbacks[key];
- }
- }
- __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 = false;
- this.reconnected && this.reconnected();
- }
- }
- __disconnected() {
- this.__isDisconnected = true;
- this.disconnected && this.disconnected();
- }
- pushEvent(event, payload = {}, onReply = function() {
- }) {
- return this.__view.pushHookEvent(this.el, null, event, payload, onReply);
- }
- pushEventTo(phxTarget, event, payload = {}, onReply = function() {
- }) {
- return this.__view.withinTargets(phxTarget, (view, targetCtx) => {
- return view.pushHookEvent(this.el, targetCtx, event, payload, onReply);
- });
- }
- handleEvent(event, callback) {
- let callbackRef = (customEvent, bypass) => bypass ? event : callback(customEvent.detail);
- window.addEventListener(`phx:${event}`, callbackRef);
- this.__listeners.add(callbackRef);
- return callbackRef;
- }
- removeHandleEvent(callbackRef) {
- let event = callbackRef(null, true);
- window.removeEventListener(`phx:${event}`, callbackRef);
- this.__listeners.delete(callbackRef);
- }
- upload(name, files) {
- return this.__view.dispatchUploads(name, files);
- }
- uploadTo(phxTarget, name, files) {
- return this.__view.withinTargets(phxTarget, (view) => view.dispatchUploads(name, files));
- }
- __cleanup__() {
- this.__listeners.forEach((callbackRef) => this.removeHandleEvent(callbackRef));
- }
- };
- var focusStack = null;
- var JS = {
- exec(eventType, phxEvent, view, sourceEl, defaults) {
- let [defaultKind, defaultArgs] = defaults || [null, { callback: defaults && defaults.callback }];
- let commands = phxEvent.charAt(0) === "[" ? JSON.parse(phxEvent) : [[defaultKind, defaultArgs]];
- commands.forEach(([kind, args]) => {
- if (kind === defaultKind && defaultArgs.data) {
- args.data = Object.assign(args.data || {}, defaultArgs.data);
- args.callback = args.callback || defaultArgs.callback;
- }
- this.filterToEls(sourceEl, args).forEach((el) => {
- this[`exec_${kind}`](eventType, phxEvent, view, sourceEl, el, args);
- });
- });
- },
- isVisible(el) {
- return !!(el.offsetWidth || el.offsetHeight || el.getClientRects().length > 0);
- },
- exec_exec(eventType, phxEvent, view, sourceEl, el, [attr, to]) {
- let nodes = to ? dom_default.all(document, to) : [sourceEl];
- nodes.forEach((node) => {
- let encodedJS = node.getAttribute(attr);
- if (!encodedJS) {
- throw new Error(`expected ${attr} to contain JS command on "${to}"`);
- }
- view.liveSocket.execJS(node, encodedJS, eventType);
- });
- },
- exec_dispatch(eventType, phxEvent, view, sourceEl, el, { to, event, detail, bubbles }) {
- detail = detail || {};
- detail.dispatcher = sourceEl;
- dom_default.dispatchEvent(el, event, { detail, bubbles });
- },
- exec_push(eventType, phxEvent, view, sourceEl, el, args) {
- if (!view.isConnected()) {
- return;
- }
- let { event, data, target, page_loading, loading, value, dispatcher, callback } = args;
- let pushOpts = { loading, value, target, page_loading: !!page_loading };
- let targetSrc = eventType === "change" && dispatcher ? dispatcher : sourceEl;
- let phxTarget = target || targetSrc.getAttribute(view.binding("target")) || targetSrc;
- view.withinTargets(phxTarget, (targetView, targetCtx) => {
- if (eventType === "change") {
- let { newCid, _target } = args;
- _target = _target || (dom_default.isFormInput(sourceEl) ? sourceEl.name : void 0);
- if (_target) {
- pushOpts._target = _target;
- }
- targetView.pushInput(sourceEl, targetCtx, newCid, event || phxEvent, pushOpts, callback);
- } else if (eventType === "submit") {
- let { submitter } = args;
- targetView.submitForm(sourceEl, targetCtx, event || phxEvent, submitter, pushOpts, callback);
- } else {
- targetView.pushEvent(eventType, sourceEl, targetCtx, event || phxEvent, data, pushOpts, callback);
- }
- });
- },
- exec_navigate(eventType, phxEvent, view, sourceEl, el, { href, replace }) {
- view.liveSocket.historyRedirect(href, replace ? "replace" : "push");
- },
- exec_patch(eventType, phxEvent, view, sourceEl, el, { href, replace }) {
- view.liveSocket.pushHistoryPatch(href, replace ? "replace" : "push", sourceEl);
- },
- exec_focus(eventType, phxEvent, view, sourceEl, el) {
- window.requestAnimationFrame(() => aria_default.attemptFocus(el));
- },
- exec_focus_first(eventType, phxEvent, view, sourceEl, el) {
- window.requestAnimationFrame(() => aria_default.focusFirstInteractive(el) || aria_default.focusFirst(el));
- },
- exec_push_focus(eventType, phxEvent, view, sourceEl, el) {
- window.requestAnimationFrame(() => focusStack = el || sourceEl);
- },
- exec_pop_focus(eventType, phxEvent, view, sourceEl, el) {
- window.requestAnimationFrame(() => {
- if (focusStack) {
- focusStack.focus();
- }
- focusStack = null;
- });
- },
- exec_add_class(eventType, phxEvent, view, sourceEl, el, { names, transition, time }) {
- this.addOrRemoveClasses(el, names, [], transition, time, view);
- },
- exec_remove_class(eventType, phxEvent, view, sourceEl, el, { names, transition, time }) {
- this.addOrRemoveClasses(el, [], names, transition, time, view);
- },
- exec_transition(eventType, phxEvent, view, sourceEl, el, { time, transition }) {
- this.addOrRemoveClasses(el, [], [], transition, time, view);
- },
- exec_toggle(eventType, phxEvent, view, sourceEl, el, { display, ins, outs, time }) {
- this.toggle(eventType, view, el, display, ins, outs, time);
- },
- exec_show(eventType, phxEvent, view, sourceEl, el, { display, transition, time }) {
- this.show(eventType, view, el, display, transition, time);
- },
- exec_hide(eventType, phxEvent, view, sourceEl, el, { display, transition, time }) {
- this.hide(eventType, view, el, display, transition, time);
- },
- exec_set_attr(eventType, phxEvent, view, sourceEl, el, { attr: [attr, val] }) {
- this.setOrRemoveAttrs(el, [[attr, val]], []);
- },
- exec_remove_attr(eventType, phxEvent, view, sourceEl, el, { attr }) {
- this.setOrRemoveAttrs(el, [], [attr]);
- },
- show(eventType, view, el, display, transition, time) {
- if (!this.isVisible(el)) {
- this.toggle(eventType, view, el, display, transition, null, time);
- }
- },
- hide(eventType, view, el, display, transition, time) {
- if (this.isVisible(el)) {
- this.toggle(eventType, view, el, display, null, transition, time);
- }
- },
- toggle(eventType, view, el, display, ins, outs, time) {
- let [inClasses, inStartClasses, inEndClasses] = ins || [[], [], []];
- let [outClasses, outStartClasses, outEndClasses] = outs || [[], [], []];
- if (inClasses.length > 0 || outClasses.length > 0) {
- if (this.isVisible(el)) {
- let onStart = () => {
- this.addOrRemoveClasses(el, outStartClasses, inClasses.concat(inStartClasses).concat(inEndClasses));
- window.requestAnimationFrame(() => {
- this.addOrRemoveClasses(el, outClasses, []);
- window.requestAnimationFrame(() => this.addOrRemoveClasses(el, outEndClasses, outStartClasses));
- });
- };
- el.dispatchEvent(new Event("phx:hide-start"));
- view.transition(time, onStart, () => {
- this.addOrRemoveClasses(el, [], outClasses.concat(outEndClasses));
- dom_default.putSticky(el, "toggle", (currentEl) => currentEl.style.display = "none");
- el.dispatchEvent(new Event("phx:hide-end"));
- });
- } else {
- if (eventType === "remove") {
- return;
- }
- let onStart = () => {
- this.addOrRemoveClasses(el, inStartClasses, outClasses.concat(outStartClasses).concat(outEndClasses));
- let stickyDisplay = display || this.defaultDisplay(el);
- dom_default.putSticky(el, "toggle", (currentEl) => currentEl.style.display = stickyDisplay);
- window.requestAnimationFrame(() => {
- this.addOrRemoveClasses(el, inClasses, []);
- window.requestAnimationFrame(() => this.addOrRemoveClasses(el, inEndClasses, inStartClasses));
- });
- };
- el.dispatchEvent(new Event("phx:show-start"));
- view.transition(time, onStart, () => {
- this.addOrRemoveClasses(el, [], inClasses.concat(inEndClasses));
- el.dispatchEvent(new Event("phx:show-end"));
- });
- }
- } else {
- if (this.isVisible(el)) {
- window.requestAnimationFrame(() => {
- el.dispatchEvent(new Event("phx:hide-start"));
- dom_default.putSticky(el, "toggle", (currentEl) => currentEl.style.display = "none");
- el.dispatchEvent(new Event("phx:hide-end"));
- });
- } else {
- window.requestAnimationFrame(() => {
- el.dispatchEvent(new Event("phx:show-start"));
- let stickyDisplay = display || this.defaultDisplay(el);
- dom_default.putSticky(el, "toggle", (currentEl) => currentEl.style.display = stickyDisplay);
- el.dispatchEvent(new Event("phx:show-end"));
- });
- }
- }
- },
- addOrRemoveClasses(el, adds, removes, transition, time, view) {
- let [transition_run, transition_start, transition_end] = transition || [[], [], []];
- if (transition_run.length > 0) {
- let onStart = () => this.addOrRemoveClasses(el, transition_start.concat(transition_run), []);
- let onDone = () => this.addOrRemoveClasses(el, adds.concat(transition_end), removes.concat(transition_run).concat(transition_start));
- return view.transition(time, onStart, onDone);
- }
- window.requestAnimationFrame(() => {
- let [prevAdds, prevRemoves] = dom_default.getSticky(el, "classes", [[], []]);
- let keepAdds = adds.filter((name) => prevAdds.indexOf(name) < 0 && !el.classList.contains(name));
- let keepRemoves = removes.filter((name) => prevRemoves.indexOf(name) < 0 && el.classList.contains(name));
- let newAdds = prevAdds.filter((name) => removes.indexOf(name) < 0).concat(keepAdds);
- let newRemoves = prevRemoves.filter((name) => adds.indexOf(name) < 0).concat(keepRemoves);
- dom_default.putSticky(el, "classes", (currentEl) => {
- currentEl.classList.remove(...newRemoves);
- currentEl.classList.add(...newAdds);
- return [newAdds, newRemoves];
- });
- });
- },
- setOrRemoveAttrs(el, sets, removes) {
- let [prevSets, prevRemoves] = dom_default.getSticky(el, "attrs", [[], []]);
- let alteredAttrs = sets.map(([attr, _val]) => attr).concat(removes);
- let newSets = prevSets.filter(([attr, _val]) => !alteredAttrs.includes(attr)).concat(sets);
- let newRemoves = prevRemoves.filter((attr) => !alteredAttrs.includes(attr)).concat(removes);
- dom_default.putSticky(el, "attrs", (currentEl) => {
- newRemoves.forEach((attr) => currentEl.removeAttribute(attr));
- newSets.forEach(([attr, val]) => currentEl.setAttribute(attr, val));
- return [newSets, newRemoves];
- });
- },
- hasAllClasses(el, classes) {
- return classes.every((name) => el.classList.contains(name));
- },
- isToggledOut(el, outClasses) {
- return !this.isVisible(el) || this.hasAllClasses(el, outClasses);
- },
- filterToEls(sourceEl, { to }) {
- return to ? dom_default.all(document, to) : [sourceEl];
- },
- defaultDisplay(el) {
- return { tr: "table-row", td: "table-cell" }[el.tagName.toLowerCase()] || "block";
- }
- };
- var js_default = JS;
- var serializeForm = (form, metadata, onlyNames = []) => {
- let _a = metadata, { submitter } = _a, meta = __objRest(_a, ["submitter"]);
- let formData = new FormData(form);
- if (submitter && submitter.hasAttribute("name") && submitter.form && submitter.form === form) {
- formData.append(submitter.name, submitter.value);
- }
- let toRemove = [];
- formData.forEach((val, key, _index) => {
- if (val instanceof File) {
- toRemove.push(key);
- }
- });
- toRemove.forEach((key) => formData.delete(key));
- let params = new URLSearchParams();
- for (let [key, val] of formData.entries()) {
- if (onlyNames.length === 0 || onlyNames.indexOf(key) >= 0) {
- params.append(key, val);
- }
- }
- for (let metaKey in meta) {
- params.append(metaKey, meta[metaKey]);
- }
- return params.toString();
- };
- var View = class {
- constructor(el, liveSocket2, parentView, flash, liveReferer) {
- this.isDead = false;
- this.liveSocket = liveSocket2;
- this.flash = flash;
- this.parent = parentView;
- this.root = parentView ? parentView.root : this;
- this.el = el;
- this.id = this.el.id;
- this.ref = 0;
- this.childJoins = 0;
- this.loaderTimer = null;
- this.pendingDiffs = [];
- this.pruningCIDs = [];
- this.redirect = false;
- this.href = null;
- this.joinCount = this.parent ? this.parent.joinCount - 1 : 0;
- this.joinPending = true;
- this.destroyed = false;
- this.joinCallback = function(onDone) {
- onDone && onDone();
- };
- this.stopCallback = function() {
- };
- this.pendingJoinOps = this.parent ? null : [];
- this.viewHooks = {};
- this.uploaders = {};
- this.formSubmits = [];
- this.children = this.parent ? null : {};
- this.root.children[this.id] = {};
- this.channel = this.liveSocket.channel(`lv:${this.id}`, () => {
- return {
- redirect: this.redirect ? this.href : void 0,
- url: this.redirect ? void 0 : this.href || void 0,
- params: this.connectParams(liveReferer),
- session: this.getSession(),
- static: this.getStatic(),
- flash: this.flash
- };
- });
- }
- setHref(href) {
- this.href = href;
- }
- setRedirect(href) {
- this.redirect = true;
- this.href = href;
- }
- isMain() {
- return this.el.hasAttribute(PHX_MAIN);
- }
- connectParams(liveReferer) {
- let params = this.liveSocket.params(this.el);
- let manifest = dom_default.all(document, `[${this.binding(PHX_TRACK_STATIC)}]`).map((node) => node.src || node.href).filter((url) => typeof url === "string");
- if (manifest.length > 0) {
- params["_track_static"] = manifest;
- }
- params["_mounts"] = this.joinCount;
- params["_live_referer"] = liveReferer;
- return params;
- }
- isConnected() {
- return this.channel.canPush();
- }
- getSession() {
- return this.el.getAttribute(PHX_SESSION);
- }
- getStatic() {
- let val = this.el.getAttribute(PHX_STATIC);
- return val === "" ? null : val;
- }
- destroy(callback = function() {
- }) {
- this.destroyAllChildren();
- this.destroyed = true;
- delete this.root.children[this.id];
- if (this.parent) {
- delete this.root.children[this.parent.id][this.id];
- }
- clearTimeout(this.loaderTimer);
- let onFinished = () => {
- callback();
- for (let id in this.viewHooks) {
- this.destroyHook(this.viewHooks[id]);
- }
- };
- dom_default.markPhxChildDestroyed(this.el);
- this.log("destroyed", () => ["the child has been removed from the parent"]);
- this.channel.leave().receive("ok", onFinished).receive("error", onFinished).receive("timeout", onFinished);
- }
- setContainerClasses(...classes) {
- this.el.classList.remove(PHX_CONNECTED_CLASS, PHX_LOADING_CLASS, PHX_ERROR_CLASS, PHX_CLIENT_ERROR_CLASS, PHX_SERVER_ERROR_CLASS);
- this.el.classList.add(...classes);
- }
- showLoader(timeout) {
- clearTimeout(this.loaderTimer);
- if (timeout) {
- this.loaderTimer = setTimeout(() => this.showLoader(), timeout);
- } else {
- for (let id in this.viewHooks) {
- this.viewHooks[id].__disconnected();
- }
- this.setContainerClasses(PHX_LOADING_CLASS);
- }
- }
- execAll(binding) {
- dom_default.all(this.el, `[${binding}]`, (el) => this.liveSocket.execJS(el, el.getAttribute(binding)));
- }
- hideLoader() {
- clearTimeout(this.loaderTimer);
- this.setContainerClasses(PHX_CONNECTED_CLASS);
- this.execAll(this.binding("connected"));
- }
- triggerReconnected() {
- for (let id in this.viewHooks) {
- this.viewHooks[id].__reconnected();
- }
- }
- log(kind, msgCallback) {
- this.liveSocket.log(this, kind, msgCallback);
- }
- transition(time, onStart, onDone = function() {
- }) {
- this.liveSocket.transition(time, onStart, onDone);
- }
- withinTargets(phxTarget, callback) {
- if (phxTarget instanceof HTMLElement || phxTarget instanceof SVGElement) {
- return this.liveSocket.owner(phxTarget, (view) => callback(view, phxTarget));
- }
- if (isCid(phxTarget)) {
- let targets = dom_default.findComponentNodeList(this.el, phxTarget);
- if (targets.length === 0) {
- logError(`no component found matching phx-target of ${phxTarget}`);
- } else {
- callback(this, parseInt(phxTarget));
- }
- } else {
- let targets = Array.from(document.querySelectorAll(phxTarget));
- if (targets.length === 0) {
- logError(`nothing found matching the phx-target selector "${phxTarget}"`);
- }
- targets.forEach((target) => this.liveSocket.owner(target, (view) => callback(view, target)));
- }
- }
- applyDiff(type, rawDiff, callback) {
- this.log(type, () => ["", clone(rawDiff)]);
- let { diff, reply, events, title } = Rendered.extract(rawDiff);
- callback({ diff, reply, events });
- if (title) {
- window.requestAnimationFrame(() => dom_default.putTitle(title));
- }
- }
- onJoin(resp) {
- let { rendered, container } = resp;
- if (container) {
- let [tag, attrs] = container;
- this.el = dom_default.replaceRootContainer(this.el, tag, attrs);
- }
- this.childJoins = 0;
- this.joinPending = true;
- this.flash = null;
- browser_default.dropLocal(this.liveSocket.localStorage, window.location.pathname, CONSECUTIVE_RELOADS);
- this.applyDiff("mount", rendered, ({ diff, events }) => {
- this.rendered = new Rendered(this.id, diff);
- let [html, streams] = this.renderContainer(null, "join");
- this.dropPendingRefs();
- let forms = this.formsForRecovery(html);
- this.joinCount++;
- if (forms.length > 0) {
- forms.forEach(([form, newForm, newCid], i) => {
- this.pushFormRecovery(form, newCid, (resp2) => {
- if (i === forms.length - 1) {
- this.onJoinComplete(resp2, html, streams, events);
- }
- });
- });
- } else {
- this.onJoinComplete(resp, html, streams, events);
- }
- });
- }
- dropPendingRefs() {
- dom_default.all(document, `[${PHX_REF_SRC}="${this.id}"][${PHX_REF}]`, (el) => {
- el.removeAttribute(PHX_REF);
- el.removeAttribute(PHX_REF_SRC);
- });
- }
- onJoinComplete({ live_patch }, html, streams, events) {
- if (this.joinCount > 1 || this.parent && !this.parent.isJoinPending()) {
- return this.applyJoinPatch(live_patch, html, streams, events);
- }
- let newChildren = dom_default.findPhxChildrenInFragment(html, this.id).filter((toEl) => {
- let fromEl = toEl.id && this.el.querySelector(`[id="${toEl.id}"]`);
- let phxStatic = fromEl && fromEl.getAttribute(PHX_STATIC);
- if (phxStatic) {
- toEl.setAttribute(PHX_STATIC, phxStatic);
- }
- return this.joinChild(toEl);
- });
- if (newChildren.length === 0) {
- if (this.parent) {
- this.root.pendingJoinOps.push([this, () => this.applyJoinPatch(live_patch, html, streams, events)]);
- this.parent.ackJoin(this);
- } else {
- this.onAllChildJoinsComplete();
- this.applyJoinPatch(live_patch, html, streams, events);
- }
- } else {
- this.root.pendingJoinOps.push([this, () => this.applyJoinPatch(live_patch, html, streams, events)]);
- }
- }
- attachTrueDocEl() {
- this.el = dom_default.byId(this.id);
- this.el.setAttribute(PHX_ROOT_ID, this.root.id);
- }
- execNewMounted() {
- let phxViewportTop = this.binding(PHX_VIEWPORT_TOP);
- let phxViewportBottom = this.binding(PHX_VIEWPORT_BOTTOM);
- dom_default.all(this.el, `[${phxViewportTop}], [${phxViewportBottom}]`, (hookEl) => {
- dom_default.maybeAddPrivateHooks(hookEl, phxViewportTop, phxViewportBottom);
- this.maybeAddNewHook(hookEl);
- });
- dom_default.all(this.el, `[${this.binding(PHX_HOOK)}], [data-phx-${PHX_HOOK}]`, (hookEl) => {
- this.maybeAddNewHook(hookEl);
- });
- dom_default.all(this.el, `[${this.binding(PHX_MOUNTED)}]`, (el) => this.maybeMounted(el));
- }
- applyJoinPatch(live_patch, html, streams, events) {
- this.attachTrueDocEl();
- let patch = new DOMPatch(this, this.el, this.id, html, streams, null);
- patch.markPrunableContentForRemoval();
- this.performPatch(patch, false);
- this.joinNewChildren();
- this.execNewMounted();
- this.joinPending = false;
- this.liveSocket.dispatchEvents(events);
- this.applyPendingUpdates();
- if (live_patch) {
- let { kind, to } = live_patch;
- this.liveSocket.historyPatch(to, kind);
- }
- this.hideLoader();
- if (this.joinCount > 1) {
- this.triggerReconnected();
- }
- this.stopCallback();
- }
- triggerBeforeUpdateHook(fromEl, toEl) {
- this.liveSocket.triggerDOM("onBeforeElUpdated", [fromEl, toEl]);
- let hook = this.getHook(fromEl);
- let isIgnored = hook && dom_default.isIgnored(fromEl, this.binding(PHX_UPDATE));
- if (hook && !fromEl.isEqualNode(toEl) && !(isIgnored && isEqualObj(fromEl.dataset, toEl.dataset))) {
- hook.__beforeUpdate();
- return hook;
- }
- }
- maybeMounted(el) {
- let phxMounted = el.getAttribute(this.binding(PHX_MOUNTED));
- let hasBeenInvoked = phxMounted && dom_default.private(el, "mounted");
- if (phxMounted && !hasBeenInvoked) {
- this.liveSocket.execJS(el, phxMounted);
- dom_default.putPrivate(el, "mounted", true);
- }
- }
- maybeAddNewHook(el, force) {
- let newHook = this.addHook(el);
- if (newHook) {
- newHook.__mounted();
- }
- }
- performPatch(patch, pruneCids) {
- let removedEls = [];
- let phxChildrenAdded = false;
- let updatedHookIds = /* @__PURE__ */ new Set();
- patch.after("added", (el) => {
- this.liveSocket.triggerDOM("onNodeAdded", [el]);
- this.maybeAddNewHook(el);
- if (el.getAttribute) {
- this.maybeMounted(el);
- }
- });
- patch.after("phxChildAdded", (el) => {
- if (dom_default.isPhxSticky(el)) {
- this.liveSocket.joinRootViews();
- } else {
- phxChildrenAdded = true;
- }
- });
- patch.before("updated", (fromEl, toEl) => {
- let hook = this.triggerBeforeUpdateHook(fromEl, toEl);
- if (hook) {
- updatedHookIds.add(fromEl.id);
- }
- });
- patch.after("updated", (el) => {
- if (updatedHookIds.has(el.id)) {
- this.getHook(el).__updated();
- }
- });
- patch.after("discarded", (el) => {
- if (el.nodeType === Node.ELEMENT_NODE) {
- removedEls.push(el);
- }
- });
- patch.after("transitionsDiscarded", (els) => this.afterElementsRemoved(els, pruneCids));
- patch.perform();
- this.afterElementsRemoved(removedEls, pruneCids);
- return phxChildrenAdded;
- }
- afterElementsRemoved(elements, pruneCids) {
- let destroyedCIDs = [];
- elements.forEach((parent) => {
- let components = dom_default.all(parent, `[${PHX_COMPONENT}]`);
- let hooks = dom_default.all(parent, `[${this.binding(PHX_HOOK)}]`);
- components.concat(parent).forEach((el) => {
- let cid = this.componentID(el);
- if (isCid(cid) && destroyedCIDs.indexOf(cid) === -1) {
- destroyedCIDs.push(cid);
- }
- });
- hooks.concat(parent).forEach((hookEl) => {
- let hook = this.getHook(hookEl);
- hook && this.destroyHook(hook);
- });
- });
- if (pruneCids) {
- this.maybePushComponentsDestroyed(destroyedCIDs);
- }
- }
- joinNewChildren() {
- dom_default.findPhxChildren(this.el, this.id).forEach((el) => this.joinChild(el));
- }
- getChildById(id) {
- return this.root.children[this.id][id];
- }
- getDescendentByEl(el) {
- if (el.id === this.id) {
- return this;
- } else {
- return this.children[el.getAttribute(PHX_PARENT_ID)][el.id];
- }
- }
- destroyDescendent(id) {
- for (let parentId in this.root.children) {
- for (let childId in this.root.children[parentId]) {
- if (childId === id) {
- return this.root.children[parentId][childId].destroy();
- }
- }
- }
- }
- joinChild(el) {
- let child = this.getChildById(el.id);
- if (!child) {
- let view = new View(el, this.liveSocket, this);
- this.root.children[this.id][view.id] = view;
- view.join();
- this.childJoins++;
- return true;
- }
- }
- isJoinPending() {
- return this.joinPending;
- }
- ackJoin(_child) {
- this.childJoins--;
- if (this.childJoins === 0) {
- if (this.parent) {
- this.parent.ackJoin(this);
- } else {
- this.onAllChildJoinsComplete();
- }
- }
- }
- onAllChildJoinsComplete() {
- this.joinCallback(() => {
- this.pendingJoinOps.forEach(([view, op]) => {
- if (!view.isDestroyed()) {
- op();
- }
- });
- this.pendingJoinOps = [];
- });
- }
- update(diff, events) {
- if (this.isJoinPending() || this.liveSocket.hasPendingLink() && this.root.isMain()) {
- return this.pendingDiffs.push({ diff, events });
- }
- this.rendered.mergeDiff(diff);
- let phxChildrenAdded = false;
- if (this.rendered.isComponentOnlyDiff(diff)) {
- this.liveSocket.time("component patch complete", () => {
- let parentCids = dom_default.findParentCIDs(this.el, this.rendered.componentCIDs(diff));
- parentCids.forEach((parentCID) => {
- if (this.componentPatch(this.rendered.getComponent(diff, parentCID), parentCID)) {
- phxChildrenAdded = true;
- }
- });
- });
- } else if (!isEmpty(diff)) {
- this.liveSocket.time("full patch complete", () => {
- let [html, streams] = this.renderContainer(diff, "update");
- let patch = new DOMPatch(this, this.el, this.id, html, streams, null);
- phxChildrenAdded = this.performPatch(patch, true);
- });
- }
- this.liveSocket.dispatchEvents(events);
- if (phxChildrenAdded) {
- this.joinNewChildren();
- }
- }
- renderContainer(diff, kind) {
- return this.liveSocket.time(`toString diff (${kind})`, () => {
- let tag = this.el.tagName;
- let cids = diff ? this.rendered.componentCIDs(diff).concat(this.pruningCIDs) : null;
- let [html, streams] = this.rendered.toString(cids);
- return [`<${tag}>${html}${tag}>`, streams];
- });
- }
- componentPatch(diff, cid) {
- if (isEmpty(diff))
- return false;
- let [html, streams] = this.rendered.componentToString(cid);
- let patch = new DOMPatch(this, this.el, this.id, html, streams, cid);
- let childrenAdded = this.performPatch(patch, true);
- return childrenAdded;
- }
- getHook(el) {
- return this.viewHooks[ViewHook.elementID(el)];
- }
- addHook(el) {
- if (ViewHook.elementID(el) || !el.getAttribute) {
- return;
- }
- let hookName = el.getAttribute(`data-phx-${PHX_HOOK}`) || el.getAttribute(this.binding(PHX_HOOK));
- if (hookName && !this.ownsElement(el)) {
- return;
- }
- let callbacks = this.liveSocket.getHookCallbacks(hookName);
- if (callbacks) {
- if (!el.id) {
- logError(`no DOM ID for hook "${hookName}". Hooks require a unique ID on each element.`, el);
- }
- let hook = new ViewHook(this, el, callbacks);
- this.viewHooks[ViewHook.elementID(hook.el)] = hook;
- return hook;
- } else if (hookName !== null) {
- logError(`unknown hook found for "${hookName}"`, el);
- }
- }
- destroyHook(hook) {
- hook.__destroyed();
- hook.__cleanup__();
- delete this.viewHooks[ViewHook.elementID(hook.el)];
- }
- applyPendingUpdates() {
- this.pendingDiffs.forEach(({ diff, events }) => this.update(diff, events));
- this.pendingDiffs = [];
- this.eachChild((child) => child.applyPendingUpdates());
- }
- eachChild(callback) {
- let children = this.root.children[this.id] || {};
- for (let id in children) {
- callback(this.getChildById(id));
- }
- }
- onChannel(event, cb) {
- this.liveSocket.onChannel(this.channel, event, (resp) => {
- if (this.isJoinPending()) {
- this.root.pendingJoinOps.push([this, () => cb(resp)]);
- } else {
- this.liveSocket.requestDOMUpdate(() => cb(resp));
- }
- });
- }
- bindChannel() {
- this.liveSocket.onChannel(this.channel, "diff", (rawDiff) => {
- this.liveSocket.requestDOMUpdate(() => {
- this.applyDiff("update", rawDiff, ({ diff, events }) => this.update(diff, events));
- });
- });
- this.onChannel("redirect", ({ to, flash }) => this.onRedirect({ to, flash }));
- this.onChannel("live_patch", (redir) => this.onLivePatch(redir));
- this.onChannel("live_redirect", (redir) => this.onLiveRedirect(redir));
- this.channel.onError((reason) => this.onError(reason));
- this.channel.onClose((reason) => this.onClose(reason));
- }
- destroyAllChildren() {
- this.eachChild((child) => child.destroy());
- }
- onLiveRedirect(redir) {
- let { to, kind, flash } = redir;
- let url = this.expandURL(to);
- this.liveSocket.historyRedirect(url, kind, flash);
- }
- onLivePatch(redir) {
- let { to, kind } = redir;
- this.href = this.expandURL(to);
- this.liveSocket.historyPatch(to, kind);
- }
- expandURL(to) {
- return to.startsWith("/") ? `${window.location.protocol}//${window.location.host}${to}` : to;
- }
- onRedirect({ to, flash }) {
- this.liveSocket.redirect(to, flash);
- }
- isDestroyed() {
- return this.destroyed;
- }
- joinDead() {
- this.isDead = true;
- }
- join(callback) {
- this.showLoader(this.liveSocket.loaderTimeout);
- this.bindChannel();
- if (this.isMain()) {
- this.stopCallback = this.liveSocket.withPageLoading({ to: this.href, kind: "initial" });
- }
- this.joinCallback = (onDone) => {
- onDone = onDone || function() {
- };
- callback ? callback(this.joinCount, onDone) : onDone();
- };
- this.liveSocket.wrapPush(this, { timeout: false }, () => {
- return this.channel.join().receive("ok", (data) => {
- if (!this.isDestroyed()) {
- this.liveSocket.requestDOMUpdate(() => this.onJoin(data));
- }
- }).receive("error", (resp) => !this.isDestroyed() && this.onJoinError(resp)).receive("timeout", () => !this.isDestroyed() && this.onJoinError({ reason: "timeout" }));
- });
- }
- onJoinError(resp) {
- if (resp.reason === "reload") {
- this.log("error", () => [`failed mount with ${resp.status}. Falling back to page request`, resp]);
- return this.onRedirect({ to: this.href });
- } else if (resp.reason === "unauthorized" || resp.reason === "stale") {
- this.log("error", () => ["unauthorized live_redirect. Falling back to page request", resp]);
- return this.onRedirect({ to: this.href });
- }
- if (resp.redirect || resp.live_redirect) {
- this.joinPending = false;
- this.channel.leave();
- }
- if (resp.redirect) {
- return this.onRedirect(resp.redirect);
- }
- if (resp.live_redirect) {
- return this.onLiveRedirect(resp.live_redirect);
- }
- this.displayError([PHX_LOADING_CLASS, PHX_ERROR_CLASS, PHX_SERVER_ERROR_CLASS]);
- this.log("error", () => ["unable to join", resp]);
- if (this.liveSocket.isConnected()) {
- this.liveSocket.reloadWithJitter(this);
- }
- }
- onClose(reason) {
- if (this.isDestroyed()) {
- return;
- }
- if (this.liveSocket.hasPendingLink() && reason !== "leave") {
- return this.liveSocket.reloadWithJitter(this);
- }
- this.destroyAllChildren();
- this.liveSocket.dropActiveElement(this);
- if (document.activeElement) {
- document.activeElement.blur();
- }
- if (this.liveSocket.isUnloaded()) {
- this.showLoader(BEFORE_UNLOAD_LOADER_TIMEOUT);
- }
- }
- onError(reason) {
- this.onClose(reason);
- if (this.liveSocket.isConnected()) {
- this.log("error", () => ["view crashed", reason]);
- }
- if (!this.liveSocket.isUnloaded()) {
- if (this.liveSocket.isConnected()) {
- this.displayError([PHX_LOADING_CLASS, PHX_ERROR_CLASS, PHX_SERVER_ERROR_CLASS]);
- } else {
- this.displayError([PHX_LOADING_CLASS, PHX_ERROR_CLASS, PHX_CLIENT_ERROR_CLASS]);
- }
- }
- }
- displayError(classes) {
- if (this.isMain()) {
- dom_default.dispatchEvent(window, "phx:page-loading-start", { detail: { to: this.href, kind: "error" } });
- }
- this.showLoader();
- this.setContainerClasses(...classes);
- this.execAll(this.binding("disconnected"));
- }
- pushWithReply(refGenerator, event, payload, onReply = function() {
- }) {
- if (!this.isConnected()) {
- return;
- }
- let [ref, [el], opts] = refGenerator ? refGenerator() : [null, [], {}];
- let onLoadingDone = function() {
- };
- if (opts.page_loading || el && el.getAttribute(this.binding(PHX_PAGE_LOADING)) !== null) {
- onLoadingDone = this.liveSocket.withPageLoading({ kind: "element", target: el });
- }
- if (typeof payload.cid !== "number") {
- delete payload.cid;
- }
- return this.liveSocket.wrapPush(this, { timeout: true }, () => {
- return this.channel.push(event, payload, PUSH_TIMEOUT).receive("ok", (resp) => {
- let finish = (hookReply) => {
- if (resp.redirect) {
- this.onRedirect(resp.redirect);
- }
- if (resp.live_patch) {
- this.onLivePatch(resp.live_patch);
- }
- if (resp.live_redirect) {
- this.onLiveRedirect(resp.live_redirect);
- }
- onLoadingDone();
- onReply(resp, hookReply);
- };
- if (resp.diff) {
- this.liveSocket.requestDOMUpdate(() => {
- this.applyDiff("update", resp.diff, ({ diff, reply, events }) => {
- if (ref !== null) {
- this.undoRefs(ref);
- }
- this.update(diff, events);
- finish(reply);
- });
- });
- } else {
- if (ref !== null) {
- this.undoRefs(ref);
- }
- finish(null);
- }
- });
- });
- }
- undoRefs(ref) {
- if (!this.isConnected()) {
- return;
- }
- dom_default.all(document, `[${PHX_REF_SRC}="${this.id}"][${PHX_REF}="${ref}"]`, (el) => {
- let disabledVal = el.getAttribute(PHX_DISABLED);
- el.removeAttribute(PHX_REF);
- el.removeAttribute(PHX_REF_SRC);
- if (el.getAttribute(PHX_READONLY) !== null) {
- el.readOnly = false;
- el.removeAttribute(PHX_READONLY);
- }
- if (disabledVal !== null) {
- el.disabled = disabledVal === "true" ? true : false;
- el.removeAttribute(PHX_DISABLED);
- }
- PHX_EVENT_CLASSES.forEach((className) => dom_default.removeClass(el, className));
- let disableRestore = el.getAttribute(PHX_DISABLE_WITH_RESTORE);
- if (disableRestore !== null) {
- el.innerText = disableRestore;
- el.removeAttribute(PHX_DISABLE_WITH_RESTORE);
- }
- let toEl = dom_default.private(el, PHX_REF);
- if (toEl) {
- let hook = this.triggerBeforeUpdateHook(el, toEl);
- DOMPatch.patchEl(el, toEl, this.liveSocket.getActiveElement());
- if (hook) {
- hook.__updated();
- }
- dom_default.deletePrivate(el, PHX_REF);
- }
- });
- }
- putRef(elements, event, opts = {}) {
- let newRef = this.ref++;
- let disableWith = this.binding(PHX_DISABLE_WITH);
- if (opts.loading) {
- elements = elements.concat(dom_default.all(document, opts.loading));
- }
- elements.forEach((el) => {
- el.classList.add(`phx-${event}-loading`);
- el.setAttribute(PHX_REF, newRef);
- el.setAttribute(PHX_REF_SRC, this.el.id);
- let disableText = el.getAttribute(disableWith);
- if (disableText !== null) {
- if (!el.getAttribute(PHX_DISABLE_WITH_RESTORE)) {
- el.setAttribute(PHX_DISABLE_WITH_RESTORE, el.innerText);
- }
- if (disableText !== "") {
- el.innerText = disableText;
- }
- el.setAttribute("disabled", "");
- }
- });
- return [newRef, elements, opts];
- }
- componentID(el) {
- let cid = el.getAttribute && el.getAttribute(PHX_COMPONENT);
- return cid ? parseInt(cid) : null;
- }
- targetComponentID(target, targetCtx, opts = {}) {
- if (isCid(targetCtx)) {
- return targetCtx;
- }
- let cidOrSelector = target.getAttribute(this.binding("target"));
- if (isCid(cidOrSelector)) {
- return parseInt(cidOrSelector);
- } else if (targetCtx && (cidOrSelector !== null || opts.target)) {
- return this.closestComponentID(targetCtx);
- } else {
- return null;
- }
- }
- closestComponentID(targetCtx) {
- if (isCid(targetCtx)) {
- return targetCtx;
- } else if (targetCtx) {
- return maybe(targetCtx.closest(`[${PHX_COMPONENT}]`), (el) => this.ownsElement(el) && this.componentID(el));
- } else {
- return null;
- }
- }
- pushHookEvent(el, targetCtx, event, payload, onReply) {
- if (!this.isConnected()) {
- this.log("hook", () => ["unable to push hook event. LiveView not connected", event, payload]);
- return false;
- }
- let [ref, els, opts] = this.putRef([el], "hook");
- this.pushWithReply(() => [ref, els, opts], "event", {
- type: "hook",
- event,
- value: payload,
- cid: this.closestComponentID(targetCtx)
- }, (resp, reply) => onReply(reply, ref));
- return ref;
- }
- extractMeta(el, meta, value) {
- let prefix = this.binding("value-");
- for (let i = 0; i < el.attributes.length; i++) {
- if (!meta) {
- meta = {};
- }
- let name = el.attributes[i].name;
- if (name.startsWith(prefix)) {
- meta[name.replace(prefix, "")] = el.getAttribute(name);
- }
- }
- if (el.value !== void 0 && !(el instanceof HTMLFormElement)) {
- if (!meta) {
- meta = {};
- }
- meta.value = el.value;
- if (el.tagName === "INPUT" && CHECKABLE_INPUTS.indexOf(el.type) >= 0 && !el.checked) {
- delete meta.value;
- }
- }
- if (value) {
- if (!meta) {
- meta = {};
- }
- for (let key in value) {
- meta[key] = value[key];
- }
- }
- return meta;
- }
- pushEvent(type, el, targetCtx, phxEvent, meta, opts = {}, onReply) {
- this.pushWithReply(() => this.putRef([el], type, opts), "event", {
- type,
- event: phxEvent,
- value: this.extractMeta(el, meta, opts.value),
- cid: this.targetComponentID(el, targetCtx, opts)
- }, (resp, reply) => onReply && onReply(reply));
- }
- pushFileProgress(fileEl, entryRef, progress, onReply = function() {
- }) {
- this.liveSocket.withinOwners(fileEl.form, (view, targetCtx) => {
- view.pushWithReply(null, "progress", {
- event: fileEl.getAttribute(view.binding(PHX_PROGRESS)),
- ref: fileEl.getAttribute(PHX_UPLOAD_REF),
- entry_ref: entryRef,
- progress,
- cid: view.targetComponentID(fileEl.form, targetCtx)
- }, onReply);
- });
- }
- pushInput(inputEl, targetCtx, forceCid, phxEvent, opts, callback) {
- let uploads;
- let cid = isCid(forceCid) ? forceCid : this.targetComponentID(inputEl.form, targetCtx);
- let refGenerator = () => this.putRef([inputEl, inputEl.form], "change", opts);
- let formData;
- let meta = this.extractMeta(inputEl.form);
- if (inputEl.getAttribute(this.binding("change"))) {
- formData = serializeForm(inputEl.form, __spreadValues({ _target: opts._target }, meta), [inputEl.name]);
- } else {
- formData = serializeForm(inputEl.form, __spreadValues({ _target: opts._target }, meta));
- }
- if (dom_default.isUploadInput(inputEl) && inputEl.files && inputEl.files.length > 0) {
- LiveUploader.trackFiles(inputEl, Array.from(inputEl.files));
- }
- uploads = LiveUploader.serializeUploads(inputEl);
- let event = {
- type: "form",
- event: phxEvent,
- value: formData,
- uploads,
- cid
- };
- this.pushWithReply(refGenerator, "event", event, (resp) => {
- dom_default.showError(inputEl, this.liveSocket.binding(PHX_FEEDBACK_FOR));
- if (dom_default.isUploadInput(inputEl) && inputEl.getAttribute("data-phx-auto-upload") !== null) {
- if (LiveUploader.filesAwaitingPreflight(inputEl).length > 0) {
- let [ref, _els] = refGenerator();
- this.uploadFiles(inputEl.form, targetCtx, ref, cid, (_uploads) => {
- callback && callback(resp);
- this.triggerAwaitingSubmit(inputEl.form);
- });
- }
- } else {
- callback && callback(resp);
- }
- });
- }
- triggerAwaitingSubmit(formEl) {
- let awaitingSubmit = this.getScheduledSubmit(formEl);
- if (awaitingSubmit) {
- let [_el, _ref, _opts, callback] = awaitingSubmit;
- this.cancelSubmit(formEl);
- callback();
- }
- }
- getScheduledSubmit(formEl) {
- return this.formSubmits.find(([el, _ref, _opts, _callback]) => el.isSameNode(formEl));
- }
- scheduleSubmit(formEl, ref, opts, callback) {
- if (this.getScheduledSubmit(formEl)) {
- return true;
- }
- this.formSubmits.push([formEl, ref, opts, callback]);
- }
- cancelSubmit(formEl) {
- this.formSubmits = this.formSubmits.filter(([el, ref, _callback]) => {
- if (el.isSameNode(formEl)) {
- this.undoRefs(ref);
- return false;
- } else {
- return true;
- }
- });
- }
- disableForm(formEl, opts = {}) {
- let filterIgnored = (el) => {
- let userIgnored = closestPhxBinding(el, `${this.binding(PHX_UPDATE)}=ignore`, el.form);
- return !(userIgnored || closestPhxBinding(el, "data-phx-update=ignore", el.form));
- };
- let filterDisables = (el) => {
- return el.hasAttribute(this.binding(PHX_DISABLE_WITH));
- };
- let filterButton = (el) => el.tagName == "BUTTON";
- let filterInput = (el) => ["INPUT", "TEXTAREA", "SELECT"].includes(el.tagName);
- let formElements = Array.from(formEl.elements);
- let disables = formElements.filter(filterDisables);
- let buttons = formElements.filter(filterButton).filter(filterIgnored);
- let inputs = formElements.filter(filterInput).filter(filterIgnored);
- buttons.forEach((button) => {
- button.setAttribute(PHX_DISABLED, button.disabled);
- button.disabled = true;
- });
- inputs.forEach((input) => {
- input.setAttribute(PHX_READONLY, input.readOnly);
- input.readOnly = true;
- if (input.files) {
- input.setAttribute(PHX_DISABLED, input.disabled);
- input.disabled = true;
- }
- });
- formEl.setAttribute(this.binding(PHX_PAGE_LOADING), "");
- return this.putRef([formEl].concat(disables).concat(buttons).concat(inputs), "submit", opts);
- }
- pushFormSubmit(formEl, targetCtx, phxEvent, submitter, opts, onReply) {
- let refGenerator = () => this.disableForm(formEl, opts);
- let cid = this.targetComponentID(formEl, targetCtx);
- if (LiveUploader.hasUploadsInProgress(formEl)) {
- let [ref, _els] = refGenerator();
- let push = () => this.pushFormSubmit(formEl, submitter, targetCtx, phxEvent, opts, onReply);
- return this.scheduleSubmit(formEl, ref, opts, push);
- } else if (LiveUploader.inputsAwaitingPreflight(formEl).length > 0) {
- let [ref, els] = refGenerator();
- let proxyRefGen = () => [ref, els, opts];
- this.uploadFiles(formEl, targetCtx, ref, cid, (_uploads) => {
- let meta = this.extractMeta(formEl);
- let formData = serializeForm(formEl, __spreadValues({ submitter }, meta));
- this.pushWithReply(proxyRefGen, "event", {
- type: "form",
- event: phxEvent,
- value: formData,
- cid
- }, onReply);
- });
- } else if (!(formEl.hasAttribute(PHX_REF) && formEl.classList.contains("phx-submit-loading"))) {
- let meta = this.extractMeta(formEl);
- let formData = serializeForm(formEl, __spreadValues({ submitter }, meta));
- this.pushWithReply(refGenerator, "event", {
- type: "form",
- event: phxEvent,
- value: formData,
- cid
- }, onReply);
- }
- }
- uploadFiles(formEl, targetCtx, ref, cid, onComplete) {
- let joinCountAtUpload = this.joinCount;
- let inputEls = LiveUploader.activeFileInputs(formEl);
- let numFileInputsInProgress = inputEls.length;
- inputEls.forEach((inputEl) => {
- let uploader = new LiveUploader(inputEl, this, () => {
- numFileInputsInProgress--;
- if (numFileInputsInProgress === 0) {
- onComplete();
- }
- });
- this.uploaders[inputEl] = uploader;
- let entries = uploader.entries().map((entry) => entry.toPreflightPayload());
- let payload = {
- ref: inputEl.getAttribute(PHX_UPLOAD_REF),
- entries,
- cid: this.targetComponentID(inputEl.form, targetCtx)
- };
- this.log("upload", () => ["sending preflight request", payload]);
- this.pushWithReply(null, "allow_upload", payload, (resp) => {
- this.log("upload", () => ["got preflight response", resp]);
- if (resp.error) {
- this.undoRefs(ref);
- let [entry_ref, reason] = resp.error;
- this.log("upload", () => [`error for entry ${entry_ref}`, reason]);
- } else {
- let onError = (callback) => {
- this.channel.onError(() => {
- if (this.joinCount === joinCountAtUpload) {
- callback();
- }
- });
- };
- uploader.initAdapterUpload(resp, onError, this.liveSocket);
- }
- });
- });
- }
- dispatchUploads(name, filesOrBlobs) {
- let inputs = dom_default.findUploadInputs(this.el).filter((el) => el.name === name);
- if (inputs.length === 0) {
- logError(`no live file inputs found matching the name "${name}"`);
- } else if (inputs.length > 1) {
- logError(`duplicate live file inputs found matching the name "${name}"`);
- } else {
- dom_default.dispatchEvent(inputs[0], PHX_TRACK_UPLOADS, { detail: { files: filesOrBlobs } });
- }
- }
- pushFormRecovery(form, newCid, callback) {
- this.liveSocket.withinOwners(form, (view, targetCtx) => {
- let phxChange = this.binding("change");
- let inputs = Array.from(form.elements).filter((el) => dom_default.isFormInput(el) && el.name && !el.hasAttribute(phxChange));
- if (inputs.length === 0) {
- return;
- }
- let input = inputs.find((el) => el.type !== "hidden") || input[0];
- let phxEvent = form.getAttribute(this.binding(PHX_AUTO_RECOVER)) || form.getAttribute(this.binding("change"));
- js_default.exec("change", phxEvent, view, input, ["push", { _target: input.name, newCid, callback }]);
- });
- }
- pushLinkPatch(href, targetEl, callback) {
- let linkRef = this.liveSocket.setPendingLink(href);
- let refGen = targetEl ? () => this.putRef([targetEl], "click") : null;
- let fallback = () => this.liveSocket.redirect(window.location.href);
- let url = href.startsWith("/") ? `${location.protocol}//${location.host}${href}` : href;
- let push = this.pushWithReply(refGen, "live_patch", { url }, (resp) => {
- this.liveSocket.requestDOMUpdate(() => {
- if (resp.link_redirect) {
- this.liveSocket.replaceMain(href, null, callback, linkRef);
- } else {
- if (this.liveSocket.commitPendingLink(linkRef)) {
- this.href = href;
- }
- this.applyPendingUpdates();
- callback && callback(linkRef);
- }
- });
- });
- if (push) {
- push.receive("timeout", fallback);
- } else {
- fallback();
- }
- }
- formsForRecovery(html) {
- if (this.joinCount === 0) {
- return [];
- }
- let phxChange = this.binding("change");
- let template = document.createElement("template");
- template.innerHTML = html;
- return dom_default.all(this.el, `form[${phxChange}]`).filter((form) => form.id && this.ownsElement(form)).filter((form) => form.elements.length > 0).filter((form) => form.getAttribute(this.binding(PHX_AUTO_RECOVER)) !== "ignore").map((form) => {
- let newForm = template.content.querySelector(`form[id="${form.id}"][${phxChange}="${form.getAttribute(phxChange)}"]`);
- if (newForm) {
- return [form, newForm, this.targetComponentID(newForm)];
- } else {
- return [form, form, this.targetComponentID(form)];
- }
- }).filter(([form, newForm, newCid]) => newForm);
- }
- maybePushComponentsDestroyed(destroyedCIDs) {
- let willDestroyCIDs = destroyedCIDs.filter((cid) => {
- return dom_default.findComponentNodeList(this.el, cid).length === 0;
- });
- if (willDestroyCIDs.length > 0) {
- this.pruningCIDs.push(...willDestroyCIDs);
- this.pushWithReply(null, "cids_will_destroy", { cids: willDestroyCIDs }, () => {
- this.pruningCIDs = this.pruningCIDs.filter((cid) => willDestroyCIDs.indexOf(cid) !== -1);
- let completelyDestroyCIDs = willDestroyCIDs.filter((cid) => {
- return dom_default.findComponentNodeList(this.el, cid).length === 0;
- });
- if (completelyDestroyCIDs.length > 0) {
- this.pushWithReply(null, "cids_destroyed", { cids: completelyDestroyCIDs }, (resp) => {
- this.rendered.pruneCIDs(resp.cids);
- });
- }
- });
- }
- }
- ownsElement(el) {
- let parentViewEl = el.closest(PHX_VIEW_SELECTOR);
- return el.getAttribute(PHX_PARENT_ID) === this.id || parentViewEl && parentViewEl.id === this.id || !parentViewEl && this.isDead;
- }
- submitForm(form, targetCtx, phxEvent, submitter, opts = {}) {
- dom_default.putPrivate(form, PHX_HAS_SUBMITTED, true);
- let phxFeedback = this.liveSocket.binding(PHX_FEEDBACK_FOR);
- let inputs = Array.from(form.elements);
- inputs.forEach((input) => dom_default.putPrivate(input, PHX_HAS_SUBMITTED, true));
- this.liveSocket.blurActiveElement(this);
- this.pushFormSubmit(form, targetCtx, phxEvent, submitter, opts, () => {
- inputs.forEach((input) => dom_default.showError(input, phxFeedback));
- this.liveSocket.restorePreviouslyActiveFocus();
- });
- }
- binding(kind) {
- return this.liveSocket.binding(kind);
- }
- };
- var LiveSocket = class {
- constructor(url, phxSocket, opts = {}) {
- this.unloaded = false;
- if (!phxSocket || phxSocket.constructor.name === "Object") {
- throw new Error(`
+`,s.innerHTML.trim()),p.replaceWith(this.createSpan(p.nodeValue,t)),[!0,f]):(p.remove(),[d,f]),[!1,!1]);return!a&&!h?(_(`expected at least one HTML element tag inside a component, but the component is empty:
+`,s.innerHTML.trim()),this.createSpan("",t).outerHTML):(!a&&h&&_("expected at least one HTML element tag directly inside a component, but only subcomponents were found. A component must render at least one HTML tag directly inside itself.",s.innerHTML.trim()),s.innerHTML)}createSpan(e,t){let i=document.createElement("span");return i.innerText=e,i.setAttribute(L,t),i}},Xi=1,he=class{static makeID(){return Xi++}static elementID(e){return e.phxHookId}constructor(e,t,i){this.__view=e,this.__liveSocket=e.liveSocket,this.__callbacks=i,this.__listeners=new Set,this.__isDisconnected=!1,this.el=t,this.el.phxHookId=this.constructor.makeID();for(let n in this.__callbacks)this[n]=this.__callbacks[n]}__mounted(){this.mounted&&this.mounted()}__updated(){this.updated&&this.updated()}__beforeUpdate(){this.beforeUpdate&&this.beforeUpdate()}__destroyed(){this.destroyed&&this.destroyed()}__reconnected(){this.__isDisconnected&&(this.__isDisconnected=!1,this.reconnected&&this.reconnected())}__disconnected(){this.__isDisconnected=!0,this.disconnected&&this.disconnected()}pushEvent(e,t={},i=function(){}){return this.__view.pushHookEvent(null,e,t,i)}pushEventTo(e,t,i={},n=function(){}){return this.__view.withinTargets(e,(s,r)=>s.pushHookEvent(r,t,i,n))}handleEvent(e,t){let i=(n,s)=>s?e:t(n.detail);return window.addEventListener(`phx:${e}`,i),this.__listeners.add(i),i}removeHandleEvent(e){let t=e(null,!0);window.removeEventListener(`phx:${t}`,e),this.__listeners.delete(e)}upload(e,t){return this.__view.dispatchUploads(e,t)}uploadTo(e,t,i){return this.__view.withinTargets(e,n=>n.dispatchUploads(t,i))}__cleanup__(){this.__listeners.forEach(e=>this.removeHandleEvent(e))}},zi={exec(e,t,i,n,s){let[r,o]=s||[null,{}];(t.charAt(0)==="["?JSON.parse(t):[[r,o]]).forEach(([h,d])=>{h===r&&o.data&&(d.data=Object.assign(d.data||{},o.data)),this.filterToEls(n,d).forEach(f=>{this[`exec_${h}`](e,t,i,n,f,d)})})},isVisible(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length>0)},exec_dispatch(e,t,i,n,s,{to:r,event:o,detail:a}){l.dispatchEvent(s,o,a)},exec_push(e,t,i,n,s,r){let{event:o,data:a,target:h,page_loading:d,loading:f,value:p}=r,v={loading:f,value:p,target:h,page_loading:!!d},u=e==="change"?n.form:n,m=h||u.getAttribute(i.binding("target"))||u;i.withinTargets(m,(g,E)=>{if(e==="change"){let{newCid:x,_target:I,callback:c}=r;I&&(v._target=I),g.pushInput(n,E,x,o||t,v,c)}else e==="submit"?g.submitForm(n,E,o||t,v):g.pushEvent(e,n,E,o||t,a,v)})},exec_add_class(e,t,i,n,s,{names:r,transition:o,time:a}){this.addOrRemoveClasses(s,r,[],o,a,i)},exec_remove_class(e,t,i,n,s,{names:r,transition:o,time:a}){this.addOrRemoveClasses(s,[],r,o,a,i)},exec_transition(e,t,i,n,s,{time:r,transition:o}){let[a,h,d]=o,f=()=>this.addOrRemoveClasses(s,a.concat(h),[]),p=()=>this.addOrRemoveClasses(s,d,a.concat(h));i.transition(r,f,p)},exec_toggle(e,t,i,n,s,{display:r,ins:o,outs:a,time:h}){this.toggle(e,i,s,r,o,a,h)},exec_show(e,t,i,n,s,{display:r,transition:o,time:a}){this.show(e,i,s,r,o,a)},exec_hide(e,t,i,n,s,{display:r,transition:o,time:a}){this.hide(e,i,s,r,o,a)},exec_set_attr(e,t,i,n,s,{attr:[r,o]}){this.setOrRemoveAttrs(s,[[r,o]],[])},exec_remove_attr(e,t,i,n,s,{attr:r}){this.setOrRemoveAttrs(s,[],[r])},show(e,t,i,n,s,r){this.isVisible(i)||this.toggle(e,t,i,n,s,null,r)},hide(e,t,i,n,s,r){this.isVisible(i)&&this.toggle(e,t,i,n,null,s,r)},toggle(e,t,i,n,s,r,o){let[a,h,d]=s||[[],[],[]],[f,p,v]=r||[[],[],[]];if(a.length>0||f.length>0)if(this.isVisible(i)){let u=()=>{this.addOrRemoveClasses(i,p,a.concat(h).concat(d)),window.requestAnimationFrame(()=>{this.addOrRemoveClasses(i,f,[]),window.requestAnimationFrame(()=>this.addOrRemoveClasses(i,v,p))})};i.dispatchEvent(new Event("phx:hide-start")),t.transition(o,u,()=>{this.addOrRemoveClasses(i,[],f.concat(v)),l.putSticky(i,"toggle",m=>m.style.display="none"),i.dispatchEvent(new Event("phx:hide-end"))})}else{if(e==="remove")return;let u=()=>{this.addOrRemoveClasses(i,h,f.concat(p).concat(v)),l.putSticky(i,"toggle",m=>m.style.display=n||"block"),window.requestAnimationFrame(()=>{this.addOrRemoveClasses(i,a,[]),window.requestAnimationFrame(()=>this.addOrRemoveClasses(i,d,h))})};i.dispatchEvent(new Event("phx:show-start")),t.transition(o,u,()=>{this.addOrRemoveClasses(i,[],a.concat(d)),i.dispatchEvent(new Event("phx:show-end"))})}else this.isVisible(i)?window.requestAnimationFrame(()=>{i.dispatchEvent(new Event("phx:hide-start")),l.putSticky(i,"toggle",u=>u.style.display="none"),i.dispatchEvent(new Event("phx:hide-end"))}):window.requestAnimationFrame(()=>{i.dispatchEvent(new Event("phx:show-start")),l.putSticky(i,"toggle",u=>u.style.display=n||"block"),i.dispatchEvent(new Event("phx:show-end"))})},addOrRemoveClasses(e,t,i,n,s,r){let[o,a,h]=n||[[],[],[]];if(o.length>0){let d=()=>this.addOrRemoveClasses(e,a.concat(o),[]),f=()=>this.addOrRemoveClasses(e,t.concat(h),i.concat(o).concat(a));return r.transition(s,d,f)}window.requestAnimationFrame(()=>{let[d,f]=l.getSticky(e,"classes",[[],[]]),p=t.filter(g=>d.indexOf(g)<0&&!e.classList.contains(g)),v=i.filter(g=>f.indexOf(g)<0&&e.classList.contains(g)),u=d.filter(g=>i.indexOf(g)<0).concat(p),m=f.filter(g=>t.indexOf(g)<0).concat(v);l.putSticky(e,"classes",g=>(g.classList.remove(...m),g.classList.add(...u),[u,m]))})},setOrRemoveAttrs(e,t,i){let[n,s]=l.getSticky(e,"attrs",[[],[]]),r=t.filter(([d,f])=>!this.hasSet(n,d)&&!e.attributes.getNamedItem(d)),o=i.filter(d=>s.indexOf(d)<0&&e.attributes.getNamedItem(d)),a=n.filter(([d,f])=>i.indexOf(d)<0).concat(r),h=s.filter(d=>!this.hasSet(t,d)).concat(o);l.putSticky(e,"attrs",d=>(h.forEach(f=>d.removeAttribute(f)),a.forEach(([f,p])=>d.setAttribute(f,p)),[a,h]))},hasSet(e,t){return e.find(([i,n])=>i===t)},hasAllClasses(e,t){return t.every(i=>e.classList.contains(i))},isToggledOut(e,t){return!this.isVisible(e)||this.hasAllClasses(e,t)},filterToEls(e,{to:t}){return t?l.all(document,t):[e]}},U=zi,Xe=(e,t={})=>{let i=new FormData(e),n=[];i.forEach((r,o,a)=>{r instanceof File&&n.push(o)}),n.forEach(r=>i.delete(r));let s=new URLSearchParams;for(let[r,o]of i.entries())s.append(r,o);for(let r in t)s.append(r,t[r]);return s.toString()},Ut=class{constructor(e,t,i,n){this.liveSocket=t,this.flash=n,this.parent=i,this.root=i?i.root:this,this.el=e,this.id=this.el.id,this.ref=0,this.childJoins=0,this.loaderTimer=null,this.pendingDiffs=[],this.pruningCIDs=[],this.redirect=!1,this.href=null,this.joinCount=this.parent?this.parent.joinCount-1:0,this.joinPending=!0,this.destroyed=!1,this.joinCallback=function(s){s&&s()},this.stopCallback=function(){},this.pendingJoinOps=this.parent?null:[],this.viewHooks={},this.uploaders={},this.formSubmits=[],this.children=this.parent?null:{},this.root.children[this.id]={},this.channel=this.liveSocket.channel(`lv:${this.id}`,()=>({redirect:this.redirect?this.href:void 0,url:this.redirect?void 0:this.href||void 0,params:this.connectParams(),session:this.getSession(),static:this.getStatic(),flash:this.flash})),this.showLoader(this.liveSocket.loaderTimeout),this.bindChannel()}setHref(e){this.href=e}setRedirect(e){this.redirect=!0,this.href=e}isMain(){return this.el.getAttribute(Ze)!==null}connectParams(){let e=this.liveSocket.params(this.el),t=l.all(document,`[${this.binding(ai)}]`).map(i=>i.src||i.href).filter(i=>typeof i=="string");return t.length>0&&(e._track_static=t),e._mounts=this.joinCount,e}isConnected(){return this.channel.canPush()}getSession(){return this.el.getAttribute(W)}getStatic(){let e=this.el.getAttribute(le);return e===""?null:e}destroy(e=function(){}){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 t=()=>{e();for(let i in this.viewHooks)this.destroyHook(this.viewHooks[i])};l.markPhxChildDestroyed(this.el),this.log("destroyed",()=>["the child has been removed from the parent"]),this.channel.leave().receive("ok",t).receive("error",t).receive("timeout",t)}setContainerClasses(...e){this.el.classList.remove(pt,Me,mt),this.el.classList.add(...e)}showLoader(e){if(clearTimeout(this.loaderTimer),e)this.loaderTimer=setTimeout(()=>this.showLoader(),e);else{for(let t in this.viewHooks)this.viewHooks[t].__disconnected();this.setContainerClasses(Me)}}hideLoader(){clearTimeout(this.loaderTimer),this.setContainerClasses(pt)}triggerReconnected(){for(let e in this.viewHooks)this.viewHooks[e].__reconnected()}log(e,t){this.liveSocket.log(this,e,t)}transition(e,t,i=function(){}){this.liveSocket.transition(e,t,i)}withinTargets(e,t){if(e instanceof HTMLElement||e instanceof SVGElement)return this.liveSocket.owner(e,i=>t(i,e));if(z(e))l.findComponentNodeList(this.el,e).length===0?_(`no component found matching phx-target of ${e}`):t(this,parseInt(e));else{let i=Array.from(document.querySelectorAll(e));i.length===0&&_(`nothing found matching the phx-target selector "${e}"`),i.forEach(n=>this.liveSocket.owner(n,s=>t(s,n)))}}applyDiff(e,t,i){this.log(e,()=>["",Re(t)]);let{diff:n,reply:s,events:r,title:o}=Lt.extract(t);return o&&l.putTitle(o),i({diff:n,reply:s,events:r}),s}onJoin(e){let{rendered:t,container:i}=e;if(i){let[n,s]=i;this.el=l.replaceRootContainer(this.el,n,s)}this.childJoins=0,this.joinPending=!0,this.flash=null,X.dropLocal(this.liveSocket.localStorage,window.location.pathname,xt),this.applyDiff("mount",t,({diff:n,events:s})=>{this.rendered=new Lt(this.id,n);let r=this.renderContainer(null,"join");this.dropPendingRefs();let o=this.formsForRecovery(r);this.joinCount++,o.length>0?o.forEach(([a,h,d],f)=>{this.pushFormRecovery(a,d,p=>{f===o.length-1&&this.onJoinComplete(p,r,s)})}):this.onJoinComplete(e,r,s)})}dropPendingRefs(){l.all(document,`[${G}="${this.id}"][${j}]`,e=>{e.removeAttribute(j),e.removeAttribute(G)})}onJoinComplete({live_patch:e},t,i){if(this.joinCount>1||this.parent&&!this.parent.isJoinPending())return this.applyJoinPatch(e,t,i);l.findPhxChildrenInFragment(t,this.id).filter(s=>{let r=s.id&&this.el.querySelector(`[id="${s.id}"]`),o=r&&r.getAttribute(le);return o&&s.setAttribute(le,o),this.joinChild(s)}).length===0?this.parent?(this.root.pendingJoinOps.push([this,()=>this.applyJoinPatch(e,t,i)]),this.parent.ackJoin(this)):(this.onAllChildJoinsComplete(),this.applyJoinPatch(e,t,i)):this.root.pendingJoinOps.push([this,()=>this.applyJoinPatch(e,t,i)])}attachTrueDocEl(){this.el=l.byId(this.id),this.el.setAttribute(ce,this.root.id)}applyJoinPatch(e,t,i){this.attachTrueDocEl();let n=new Pe(this,this.el,this.id,t,null);if(n.markPrunableContentForRemoval(),this.performPatch(n,!1),this.joinNewChildren(),l.all(this.el,`[${this.binding(we)}], [data-phx-${we}]`,s=>{let r=this.addHook(s);r&&r.__mounted()}),this.joinPending=!1,this.liveSocket.dispatchEvents(i),this.applyPendingUpdates(),e){let{kind:s,to:r}=e;this.liveSocket.historyPatch(r,s)}this.hideLoader(),this.joinCount>1&&this.triggerReconnected(),this.stopCallback()}triggerBeforeUpdateHook(e,t){this.liveSocket.triggerDOM("onBeforeElUpdated",[e,t]);let i=this.getHook(e),n=i&&l.isIgnored(e,this.binding(Ye));if(i&&!e.isEqualNode(t)&&!(n&&Ci(e.dataset,t.dataset)))return i.__beforeUpdate(),i}performPatch(e,t){let i=[],n=!1,s=new Set;return e.after("added",r=>{this.liveSocket.triggerDOM("onNodeAdded",[r]);let o=this.addHook(r);o&&o.__mounted()}),e.after("phxChildAdded",r=>{l.isPhxSticky(r)?this.liveSocket.joinRootViews():n=!0}),e.before("updated",(r,o)=>{this.triggerBeforeUpdateHook(r,o)&&s.add(r.id)}),e.after("updated",r=>{s.has(r.id)&&this.getHook(r).__updated()}),e.after("discarded",r=>{r.nodeType===Node.ELEMENT_NODE&&i.push(r)}),e.after("transitionsDiscarded",r=>this.afterElementsRemoved(r,t)),e.perform(),this.afterElementsRemoved(i,t),n}afterElementsRemoved(e,t){let i=[];e.forEach(n=>{l.all(n,`[${L}]`).concat(n).forEach(r=>{let o=this.componentID(r);z(o)&&i.indexOf(o)===-1&&i.push(o);let a=this.getHook(r);a&&this.destroyHook(a)})}),t&&this.maybePushComponentsDestroyed(i)}joinNewChildren(){l.findPhxChildren(this.el,this.id).forEach(e=>this.joinChild(e))}getChildById(e){return this.root.children[this.id][e]}getDescendentByEl(e){return e.id===this.id?this:this.children[e.getAttribute(Z)][e.id]}destroyDescendent(e){for(let t in this.root.children)for(let i in this.root.children[t])if(i===e)return this.root.children[t][i].destroy()}joinChild(e){if(!this.getChildById(e.id)){let i=new Ut(e,this.liveSocket,this);return this.root.children[this.id][i.id]=i,i.join(),this.childJoins++,!0}}isJoinPending(){return this.joinPending}ackJoin(e){this.childJoins--,this.childJoins===0&&(this.parent?this.parent.ackJoin(this):this.onAllChildJoinsComplete())}onAllChildJoinsComplete(){this.joinCallback(()=>{this.pendingJoinOps.forEach(([e,t])=>{e.isDestroyed()||t()}),this.pendingJoinOps=[]})}update(e,t){if(this.isJoinPending()||this.liveSocket.hasPendingLink())return this.pendingDiffs.push({diff:e,events:t});this.rendered.mergeDiff(e);let i=!1;this.rendered.isComponentOnlyDiff(e)?this.liveSocket.time("component patch complete",()=>{l.findParentCIDs(this.el,this.rendered.componentCIDs(e)).forEach(s=>{this.componentPatch(this.rendered.getComponent(e,s),s)&&(i=!0)})}):wt(e)||this.liveSocket.time("full patch complete",()=>{let n=this.renderContainer(e,"update"),s=new Pe(this,this.el,this.id,n,null);i=this.performPatch(s,!0)}),this.liveSocket.dispatchEvents(t),i&&this.joinNewChildren()}renderContainer(e,t){return this.liveSocket.time(`toString diff (${t})`,()=>{let i=this.el.tagName,n=e?this.rendered.componentCIDs(e).concat(this.pruningCIDs):null,s=this.rendered.toString(n);return`<${i}>${s}${i}>`})}componentPatch(e,t){if(wt(e))return!1;let i=this.rendered.componentToString(t),n=new Pe(this,this.el,this.id,i,t);return this.performPatch(n,!0)}getHook(e){return this.viewHooks[he.elementID(e)]}addHook(e){if(he.elementID(e)||!e.getAttribute)return;let t=e.getAttribute(`data-phx-${we}`)||e.getAttribute(this.binding(we));if(t&&!this.ownsElement(e))return;let i=this.liveSocket.getHookCallbacks(t);if(i){e.id||_(`no DOM ID for hook "${t}". Hooks require a unique ID on each element.`,e);let n=new he(this,e,i);return this.viewHooks[he.elementID(n.el)]=n,n}else t!==null&&_(`unknown hook found for "${t}"`,e)}destroyHook(e){e.__destroyed(),e.__cleanup__(),delete this.viewHooks[he.elementID(e.el)]}applyPendingUpdates(){this.pendingDiffs.forEach(({diff:e,events:t})=>this.update(e,t)),this.pendingDiffs=[]}onChannel(e,t){this.liveSocket.onChannel(this.channel,e,i=>{this.isJoinPending()?this.root.pendingJoinOps.push([this,()=>t(i)]):this.liveSocket.requestDOMUpdate(()=>t(i))})}bindChannel(){this.liveSocket.onChannel(this.channel,"diff",e=>{this.liveSocket.requestDOMUpdate(()=>{this.applyDiff("update",e,({diff:t,events:i})=>this.update(t,i))})}),this.onChannel("redirect",({to:e,flash:t})=>this.onRedirect({to:e,flash:t})),this.onChannel("live_patch",e=>this.onLivePatch(e)),this.onChannel("live_redirect",e=>this.onLiveRedirect(e)),this.channel.onError(e=>this.onError(e)),this.channel.onClose(e=>this.onClose(e))}destroyAllChildren(){for(let e in this.root.children[this.id])this.getChildById(e).destroy()}onLiveRedirect(e){let{to:t,kind:i,flash:n}=e,s=this.expandURL(t);this.liveSocket.historyRedirect(s,i,n)}onLivePatch(e){let{to:t,kind:i}=e;this.href=this.expandURL(t),this.liveSocket.historyPatch(t,i)}expandURL(e){return e.startsWith("/")?`${window.location.protocol}//${window.location.host}${e}`:e}onRedirect({to:e,flash:t}){this.liveSocket.redirect(e,t)}isDestroyed(){return this.destroyed}join(e){this.isMain()&&(this.stopCallback=this.liveSocket.withPageLoading({to:this.href,kind:"initial"})),this.joinCallback=t=>{t=t||function(){},e?e(this.joinCount,t):t()},this.liveSocket.wrapPush(this,{timeout:!1},()=>this.channel.join().receive("ok",t=>{this.isDestroyed()||this.liveSocket.requestDOMUpdate(()=>this.onJoin(t))}).receive("error",t=>!this.isDestroyed()&&this.onJoinError(t)).receive("timeout",()=>!this.isDestroyed()&&this.onJoinError({reason:"timeout"})))}onJoinError(e){return e.reason==="unauthorized"||e.reason==="stale"?(this.log("error",()=>["unauthorized live_redirect. Falling back to page request",e]),this.onRedirect({to:this.href})):((e.redirect||e.live_redirect)&&(this.joinPending=!1,this.channel.leave()),e.redirect?this.onRedirect(e.redirect):e.live_redirect?this.onLiveRedirect(e.live_redirect):(this.log("error",()=>["unable to join",e]),this.liveSocket.reloadWithJitter(this)))}onClose(e){if(!this.isDestroyed()){if(this.isJoinPending()&&document.visibilityState!=="hidden"||this.liveSocket.hasPendingLink()&&e!=="leave")return this.liveSocket.reloadWithJitter(this);this.destroyAllChildren(),this.liveSocket.dropActiveElement(this),document.activeElement&&document.activeElement.blur(),this.liveSocket.isUnloaded()&&this.showLoader(vi)}}onError(e){this.onClose(e),this.log("error",()=>["view crashed",e]),this.liveSocket.isUnloaded()||this.displayError()}displayError(){this.isMain()&&l.dispatchEvent(window,"phx:page-loading-start",{to:this.href,kind:"error"}),this.showLoader(),this.setContainerClasses(Me,mt)}pushWithReply(e,t,i,n=function(){}){if(!this.isConnected())return;let[s,[r],o]=e?e():[null,[],{}],a=function(){};return(o.page_loading||r&&r.getAttribute(this.binding(ft))!==null)&&(a=this.liveSocket.withPageLoading({kind:"element",target:r})),typeof i.cid!="number"&&delete i.cid,this.liveSocket.wrapPush(this,{timeout:!0},()=>this.channel.push(t,i,yi).receive("ok",h=>{s!==null&&this.undoRefs(s);let d=f=>{h.redirect&&this.onRedirect(h.redirect),h.live_patch&&this.onLivePatch(h.live_patch),h.live_redirect&&this.onLiveRedirect(h.live_redirect),a(),n(h,f)};h.diff?this.liveSocket.requestDOMUpdate(()=>{let f=this.applyDiff("update",h.diff,({diff:p,events:v})=>{this.update(p,v)});d(f)}):d(null)}))}undoRefs(e){l.all(document,`[${G}="${this.id}"][${j}="${e}"]`,t=>{let i=t.getAttribute(Ae);t.removeAttribute(j),t.removeAttribute(G),t.getAttribute(Ue)!==null&&(t.readOnly=!1,t.removeAttribute(Ue)),i!==null&&(t.disabled=i==="true",t.removeAttribute(Ae)),It.forEach(r=>l.removeClass(t,r));let n=t.getAttribute(Ee);n!==null&&(t.innerText=n,t.removeAttribute(Ee));let s=l.private(t,j);if(s){let r=this.triggerBeforeUpdateHook(t,s);Pe.patchEl(t,s,this.liveSocket.getActiveElement()),r&&r.__updated(),l.deletePrivate(t,j)}})}putRef(e,t,i={}){let n=this.ref++,s=this.binding(Ge);return i.loading&&(e=e.concat(l.all(document,i.loading))),e.forEach(r=>{r.classList.add(`phx-${t}-loading`),r.setAttribute(j,n),r.setAttribute(G,this.el.id);let o=r.getAttribute(s);o!==null&&(r.getAttribute(Ee)||r.setAttribute(Ee,r.innerText),o!==""&&(r.innerText=o),r.setAttribute("disabled",""))}),[n,e,i]}componentID(e){let t=e.getAttribute&&e.getAttribute(L);return t?parseInt(t):null}targetComponentID(e,t,i={}){if(z(t))return t;let n=e.getAttribute(this.binding("target"));return z(n)?parseInt(n):t&&(n!==null||i.target)?this.closestComponentID(t):null}closestComponentID(e){return z(e)?e:e?F(e.closest(`[${L}]`),t=>this.ownsElement(t)&&this.componentID(t)):null}pushHookEvent(e,t,i,n){if(!this.isConnected())return this.log("hook",()=>["unable to push hook event. LiveView not connected",t,i]),!1;let[s,r,o]=this.putRef([],"hook");return this.pushWithReply(()=>[s,r,o],"event",{type:"hook",event:t,value:i,cid:this.closestComponentID(e)},(a,h)=>n(h,s)),s}extractMeta(e,t,i){let n=this.binding("value-");for(let s=0;s=0&&!e.checked&&delete t.value),i){t||(t={});for(let s in i)t[s]=i[s]}return t}pushEvent(e,t,i,n,s,r={}){this.pushWithReply(()=>this.putRef([t],e,r),"event",{type:e,event:n,value:this.extractMeta(t,s,r.value),cid:this.targetComponentID(t,i,r)})}pushFileProgress(e,t,i,n=function(){}){this.liveSocket.withinOwners(e.form,(s,r)=>{s.pushWithReply(null,"progress",{event:e.getAttribute(s.binding(gi)),ref:e.getAttribute(Y),entry_ref:t,progress:i,cid:s.targetComponentID(e.form,r)},n)})}pushInput(e,t,i,n,s,r){let o,a=z(i)?i:this.targetComponentID(e.form,t),h=()=>this.putRef([e,e.form],"change",s),d=Xe(e.form,{_target:s._target});l.isUploadInput(e)&&e.files&&e.files.length>0&&C.trackFiles(e,Array.from(e.files)),o=C.serializeUploads(e);let f={type:"form",event:n,value:d,uploads:o,cid:a};this.pushWithReply(h,"event",f,p=>{if(l.showError(e,this.liveSocket.binding(Ke)),l.isUploadInput(e)&&e.getAttribute("data-phx-auto-upload")!==null){if(C.filesAwaitingPreflight(e).length>0){let[v,u]=h();this.uploadFiles(e.form,t,v,a,m=>{r&&r(p),this.triggerAwaitingSubmit(e.form)})}}else r&&r(p)})}triggerAwaitingSubmit(e){let t=this.getScheduledSubmit(e);if(t){let[i,n,s,r]=t;this.cancelSubmit(e),r()}}getScheduledSubmit(e){return this.formSubmits.find(([t,i,n,s])=>t.isSameNode(e))}scheduleSubmit(e,t,i,n){if(this.getScheduledSubmit(e))return!0;this.formSubmits.push([e,t,i,n])}cancelSubmit(e){this.formSubmits=this.formSubmits.filter(([t,i,n])=>t.isSameNode(e)?(this.undoRefs(i),!1):!0)}pushFormSubmit(e,t,i,n,s){let r=p=>!(de(p,`${this.binding(Ye)}=ignore`,p.form)||de(p,"data-phx-update=ignore",p.form)),o=p=>p.hasAttribute(this.binding(Ge)),a=p=>p.tagName=="BUTTON",h=p=>["INPUT","TEXTAREA","SELECT"].includes(p.tagName),d=()=>{let p=Array.from(e.elements),v=p.filter(o),u=p.filter(a).filter(r),m=p.filter(h).filter(r);return u.forEach(g=>{g.setAttribute(Ae,g.disabled),g.disabled=!0}),m.forEach(g=>{g.setAttribute(Ue,g.readOnly),g.readOnly=!0,g.files&&(g.setAttribute(Ae,g.disabled),g.disabled=!0)}),e.setAttribute(this.binding(ft),""),this.putRef([e].concat(v).concat(u).concat(m),"submit",n)},f=this.targetComponentID(e,t);if(C.hasUploadsInProgress(e)){let[p,v]=d(),u=()=>this.pushFormSubmit(e,t,i,n,s);return this.scheduleSubmit(e,p,n,u)}else if(C.inputsAwaitingPreflight(e).length>0){let[p,v]=d(),u=()=>[p,v,n];this.uploadFiles(e,t,p,f,m=>{let g=Xe(e,{});this.pushWithReply(u,"event",{type:"form",event:i,value:g,cid:f},s)})}else{let p=Xe(e);this.pushWithReply(d,"event",{type:"form",event:i,value:p,cid:f},s)}}uploadFiles(e,t,i,n,s){let r=this.joinCount,o=C.activeFileInputs(e),a=o.length;o.forEach(h=>{let d=new C(h,this,()=>{a--,a===0&&s()});this.uploaders[h]=d;let f=d.entries().map(v=>v.toPreflightPayload()),p={ref:h.getAttribute(Y),entries:f,cid:this.targetComponentID(h.form,t)};this.log("upload",()=>["sending preflight request",p]),this.pushWithReply(null,"allow_upload",p,v=>{if(this.log("upload",()=>["got preflight response",v]),v.error){this.undoRefs(i);let[u,m]=v.error;this.log("upload",()=>[`error for entry ${u}`,m])}else{let u=m=>{this.channel.onError(()=>{this.joinCount===r&&m()})};d.initAdapterUpload(v,u,this.liveSocket)}})})}dispatchUploads(e,t){let i=l.findUploadInputs(this.el).filter(n=>n.name===e);i.length===0?_(`no live file inputs found matching the name "${e}"`):i.length>1?_(`duplicate live file inputs found matching the name "${e}"`):l.dispatchEvent(i[0],Dt,{files:t})}pushFormRecovery(e,t,i){this.liveSocket.withinOwners(e,(n,s)=>{let r=e.elements[0],o=e.getAttribute(this.binding(bt))||e.getAttribute(this.binding("change"));U.exec("change",o,n,r,["push",{_target:r.name,newCid:t,callback:i}])})}pushLinkPatch(e,t,i){let n=this.liveSocket.setPendingLink(e),s=t?()=>this.putRef([t],"click"):null,r=()=>this.liveSocket.redirect(window.location.href),o=this.pushWithReply(s,"live_patch",{url:e},a=>{this.liveSocket.requestDOMUpdate(()=>{a.link_redirect?this.liveSocket.replaceMain(e,null,i,n):(this.liveSocket.commitPendingLink(n)&&(this.href=e),this.applyPendingUpdates(),i&&i(n))})});o?o.receive("timeout",r):r()}formsForRecovery(e){if(this.joinCount===0)return[];let t=this.binding("change"),i=document.createElement("template");return i.innerHTML=e,l.all(this.el,`form[${t}]`).filter(n=>n.id&&this.ownsElement(n)).filter(n=>n.elements.length>0).filter(n=>n.getAttribute(this.binding(bt))!=="ignore").map(n=>{let s=i.content.querySelector(`form[id="${n.id}"][${t}="${n.getAttribute(t)}"]`);return s?[n,s,this.targetComponentID(s)]:[n,null,null]}).filter(([n,s,r])=>s)}maybePushComponentsDestroyed(e){let t=e.filter(i=>l.findComponentNodeList(this.el,i).length===0);t.length>0&&(this.pruningCIDs.push(...t),this.pushWithReply(null,"cids_will_destroy",{cids:t},()=>{this.pruningCIDs=this.pruningCIDs.filter(n=>t.indexOf(n)!==-1);let i=t.filter(n=>l.findComponentNodeList(this.el,n).length===0);i.length>0&&this.pushWithReply(null,"cids_destroyed",{cids:i},n=>{this.rendered.pruneCIDs(n.cids)})}))}ownsElement(e){return e.getAttribute(Z)===this.id||F(e.closest(ee),t=>t.id)===this.id}submitForm(e,t,i,n={}){l.putPrivate(e,Ht,!0);let s=this.liveSocket.binding(Ke),r=Array.from(e.elements);this.liveSocket.blurActiveElement(this),this.pushFormSubmit(e,t,i,n,()=>{r.forEach(o=>l.showError(o,s)),this.liveSocket.restorePreviouslyActiveFocus()})}binding(e){return this.liveSocket.binding(e)}},jt=class{constructor(e,t,i={}){if(this.unloaded=!1,!t||t.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 phxSocket(url, opts);
- this.bindingPrefix = opts.bindingPrefix || BINDING_PREFIX;
- this.opts = opts;
- this.params = closure2(opts.params || {});
- this.viewLogger = opts.viewLogger;
- this.metadataCallbacks = opts.metadata || {};
- this.defaults = Object.assign(clone(DEFAULTS), opts.defaults || {});
- this.activeElement = null;
- this.prevActive = null;
- this.silenced = false;
- this.main = null;
- this.outgoingMainEl = null;
- this.clickStartedAtTarget = null;
- this.linkRef = 1;
- this.roots = {};
- this.href = window.location.href;
- this.pendingLink = null;
- this.currentLocation = clone(window.location);
- this.hooks = opts.hooks || {};
- this.uploaders = opts.uploaders || {};
- this.loaderTimeout = opts.loaderTimeout || LOADER_TIMEOUT;
- this.reloadWithJitterTimer = null;
- this.maxReloads = opts.maxReloads || MAX_RELOADS;
- this.reloadJitterMin = opts.reloadJitterMin || RELOAD_JITTER_MIN;
- this.reloadJitterMax = opts.reloadJitterMax || RELOAD_JITTER_MAX;
- this.failsafeJitter = opts.failsafeJitter || FAILSAFE_JITTER;
- this.localStorage = opts.localStorage || window.localStorage;
- this.sessionStorage = opts.sessionStorage || window.sessionStorage;
- this.boundTopLevelEvents = false;
- this.domCallbacks = Object.assign({ onNodeAdded: closure2(), onBeforeElUpdated: closure2() }, opts.dom || {});
- this.transitions = new TransitionSet();
- window.addEventListener("pagehide", (_e) => {
- this.unloaded = true;
- });
- this.socket.onOpen(() => {
- if (this.isUnloaded()) {
- window.location.reload();
- }
- });
- }
- isProfileEnabled() {
- return this.sessionStorage.getItem(PHX_LV_PROFILE) === "true";
- }
- isDebugEnabled() {
- return this.sessionStorage.getItem(PHX_LV_DEBUG) === "true";
- }
- isDebugDisabled() {
- return this.sessionStorage.getItem(PHX_LV_DEBUG) === "false";
- }
- enableDebug() {
- this.sessionStorage.setItem(PHX_LV_DEBUG, "true");
- }
- enableProfiling() {
- this.sessionStorage.setItem(PHX_LV_PROFILE, "true");
- }
- disableDebug() {
- this.sessionStorage.setItem(PHX_LV_DEBUG, "false");
- }
- disableProfiling() {
- this.sessionStorage.removeItem(PHX_LV_PROFILE);
- }
- enableLatencySim(upperBoundMs) {
- this.enableDebug();
- console.log("latency simulator enabled for the duration of this browser session. Call disableLatencySim() to disable");
- this.sessionStorage.setItem(PHX_LV_LATENCY_SIM, upperBoundMs);
- }
- disableLatencySim() {
- this.sessionStorage.removeItem(PHX_LV_LATENCY_SIM);
- }
- getLatencySim() {
- let str = this.sessionStorage.getItem(PHX_LV_LATENCY_SIM);
- return str ? parseInt(str) : null;
- }
- getSocket() {
- return this.socket;
- }
- connect() {
- if (window.location.hostname === "localhost" && !this.isDebugDisabled()) {
- this.enableDebug();
- }
- let doConnect = () => {
- if (this.joinRootViews()) {
- this.bindTopLevelEvents();
- this.socket.connect();
- } else if (this.main) {
- this.socket.connect();
- } else {
- this.bindTopLevelEvents({ dead: true });
- }
- this.joinDeadView();
- };
- if (["complete", "loaded", "interactive"].indexOf(document.readyState) >= 0) {
- doConnect();
- } else {
- document.addEventListener("DOMContentLoaded", () => doConnect());
- }
- }
- disconnect(callback) {
- clearTimeout(this.reloadWithJitterTimer);
- this.socket.disconnect(callback);
- }
- replaceTransport(transport) {
- clearTimeout(this.reloadWithJitterTimer);
- this.socket.replaceTransport(transport);
- this.connect();
- }
- execJS(el, encodedJS, eventType = null) {
- this.owner(el, (view) => js_default.exec(eventType, encodedJS, view, el));
- }
- execJSHookPush(el, phxEvent, data, callback) {
- this.withinOwners(el, (view) => {
- js_default.exec("hook", phxEvent, view, el, ["push", { data, callback }]);
- });
- }
- unload() {
- if (this.unloaded) {
- return;
- }
- if (this.main && this.isConnected()) {
- this.log(this.main, "socket", () => ["disconnect for page nav"]);
- }
- this.unloaded = true;
- this.destroyAllViews();
- this.disconnect();
- }
- triggerDOM(kind, args) {
- this.domCallbacks[kind](...args);
- }
- time(name, func) {
- if (!this.isProfileEnabled() || !console.time) {
- return func();
- }
- console.time(name);
- let result = func();
- console.timeEnd(name);
- return result;
- }
- log(view, kind, msgCallback) {
- if (this.viewLogger) {
- let [msg, obj] = msgCallback();
- this.viewLogger(view, kind, msg, obj);
- } else if (this.isDebugEnabled()) {
- let [msg, obj] = msgCallback();
- debug(view, kind, msg, obj);
- }
- }
- requestDOMUpdate(callback) {
- this.transitions.after(callback);
- }
- transition(time, onStart, onDone = function() {
- }) {
- this.transitions.addTransition(time, onStart, onDone);
- }
- onChannel(channel, event, cb) {
- channel.on(event, (data) => {
- let latency = this.getLatencySim();
- if (!latency) {
- cb(data);
- } else {
- setTimeout(() => cb(data), latency);
- }
- });
- }
- wrapPush(view, opts, push) {
- let latency = this.getLatencySim();
- let oldJoinCount = view.joinCount;
- if (!latency) {
- if (this.isConnected() && opts.timeout) {
- return push().receive("timeout", () => {
- if (view.joinCount === oldJoinCount && !view.isDestroyed()) {
- this.reloadWithJitter(view, () => {
- this.log(view, "timeout", () => ["received timeout while communicating with server. Falling back to hard refresh for recovery"]);
- });
- }
- });
- } else {
- return push();
- }
- }
- let fakePush = {
- receives: [],
- receive(kind, cb) {
- this.receives.push([kind, cb]);
- }
- };
- setTimeout(() => {
- if (view.isDestroyed()) {
- return;
- }
- fakePush.receives.reduce((acc, [kind, cb]) => acc.receive(kind, cb), push());
- }, latency);
- return fakePush;
- }
- reloadWithJitter(view, log) {
- clearTimeout(this.reloadWithJitterTimer);
- this.disconnect();
- let minMs = this.reloadJitterMin;
- let maxMs = this.reloadJitterMax;
- let afterMs = Math.floor(Math.random() * (maxMs - minMs + 1)) + minMs;
- let tries = browser_default.updateLocal(this.localStorage, window.location.pathname, CONSECUTIVE_RELOADS, 0, (count) => count + 1);
- if (tries > this.maxReloads) {
- afterMs = this.failsafeJitter;
- }
- this.reloadWithJitterTimer = setTimeout(() => {
- if (view.isDestroyed() || view.isConnected()) {
- return;
- }
- view.destroy();
- log ? log() : this.log(view, "join", () => [`encountered ${tries} consecutive reloads`]);
- if (tries > this.maxReloads) {
- this.log(view, "join", () => [`exceeded ${this.maxReloads} consecutive reloads. Entering failsafe mode`]);
- }
- if (this.hasPendingLink()) {
- window.location = this.pendingLink;
- } else {
- window.location.reload();
- }
- }, afterMs);
- }
- getHookCallbacks(name) {
- return name && name.startsWith("Phoenix.") ? hooks_default[name.split(".")[1]] : this.hooks[name];
- }
- isUnloaded() {
- return this.unloaded;
- }
- isConnected() {
- return this.socket.isConnected();
- }
- getBindingPrefix() {
- return this.bindingPrefix;
- }
- binding(kind) {
- return `${this.getBindingPrefix()}${kind}`;
- }
- channel(topic, params) {
- return this.socket.channel(topic, params);
- }
- joinDeadView() {
- let body = document.body;
- if (body && !this.isPhxView(body) && !this.isPhxView(document.firstElementChild)) {
- let view = this.newRootView(body);
- view.setHref(this.getHref());
- view.joinDead();
- if (!this.main) {
- this.main = view;
- }
- window.requestAnimationFrame(() => view.execNewMounted());
- }
- }
- joinRootViews() {
- let rootsFound = false;
- dom_default.all(document, `${PHX_VIEW_SELECTOR}:not([${PHX_PARENT_ID}])`, (rootEl) => {
- if (!this.getRootById(rootEl.id)) {
- let view = this.newRootView(rootEl);
- view.setHref(this.getHref());
- view.join();
- if (rootEl.hasAttribute(PHX_MAIN)) {
- this.main = view;
- }
- }
- rootsFound = true;
- });
- return rootsFound;
- }
- redirect(to, flash) {
- this.unload();
- browser_default.redirect(to, flash);
- }
- replaceMain(href, flash, callback = null, linkRef = this.setPendingLink(href)) {
- let liveReferer = this.currentLocation.href;
- this.outgoingMainEl = this.outgoingMainEl || this.main.el;
- let newMainEl = dom_default.cloneNode(this.outgoingMainEl, "");
- this.main.showLoader(this.loaderTimeout);
- this.main.destroy();
- this.main = this.newRootView(newMainEl, flash, liveReferer);
- this.main.setRedirect(href);
- this.transitionRemoves();
- this.main.join((joinCount, onDone) => {
- if (joinCount === 1 && this.commitPendingLink(linkRef)) {
- this.requestDOMUpdate(() => {
- dom_default.findPhxSticky(document).forEach((el) => newMainEl.appendChild(el));
- this.outgoingMainEl.replaceWith(newMainEl);
- this.outgoingMainEl = null;
- callback && requestAnimationFrame(() => callback(linkRef));
- onDone();
- });
- }
- });
- }
- transitionRemoves(elements) {
- let removeAttr = this.binding("remove");
- elements = elements || dom_default.all(document, `[${removeAttr}]`);
- elements.forEach((el) => {
- this.execJS(el, el.getAttribute(removeAttr), "remove");
- });
- }
- isPhxView(el) {
- return el.getAttribute && el.getAttribute(PHX_SESSION) !== null;
- }
- newRootView(el, flash, liveReferer) {
- let view = new View(el, this, null, flash, liveReferer);
- this.roots[view.id] = view;
- return view;
- }
- owner(childEl, callback) {
- let view = maybe(childEl.closest(PHX_VIEW_SELECTOR), (el) => this.getViewByEl(el)) || this.main;
- if (view) {
- callback(view);
- }
- }
- withinOwners(childEl, callback) {
- this.owner(childEl, (view) => callback(view, childEl));
- }
- getViewByEl(el) {
- let rootId = el.getAttribute(PHX_ROOT_ID);
- return maybe(this.getRootById(rootId), (root) => root.getDescendentByEl(el));
- }
- getRootById(id) {
- return this.roots[id];
- }
- destroyAllViews() {
- for (let id in this.roots) {
- this.roots[id].destroy();
- delete this.roots[id];
- }
- this.main = null;
- }
- destroyViewByEl(el) {
- let root = this.getRootById(el.getAttribute(PHX_ROOT_ID));
- if (root && root.id === el.id) {
- root.destroy();
- delete this.roots[root.id];
- } else if (root) {
- root.destroyDescendent(el.id);
- }
- }
- setActiveElement(target) {
- if (this.activeElement === target) {
- return;
- }
- this.activeElement = target;
- let cancel = () => {
- if (target === this.activeElement) {
- this.activeElement = null;
- }
- target.removeEventListener("mouseup", this);
- target.removeEventListener("touchend", this);
- };
- target.addEventListener("mouseup", cancel);
- target.addEventListener("touchend", cancel);
- }
- getActiveElement() {
- if (document.activeElement === document.body) {
- return this.activeElement || document.activeElement;
- } else {
- return document.activeElement || document.body;
- }
- }
- dropActiveElement(view) {
- if (this.prevActive && view.ownsElement(this.prevActive)) {
- this.prevActive = null;
- }
- }
- restorePreviouslyActiveFocus() {
- if (this.prevActive && this.prevActive !== document.body) {
- this.prevActive.focus();
- }
- }
- blurActiveElement() {
- this.prevActive = this.getActiveElement();
- if (this.prevActive !== document.body) {
- this.prevActive.blur();
- }
- }
- bindTopLevelEvents({ dead } = {}) {
- if (this.boundTopLevelEvents) {
- return;
- }
- this.boundTopLevelEvents = true;
- this.socket.onClose((event) => {
- if (event && event.code === 1e3 && this.main) {
- return this.reloadWithJitter(this.main);
- }
- });
- document.body.addEventListener("click", function() {
- });
- window.addEventListener("pageshow", (e) => {
- if (e.persisted) {
- this.getSocket().disconnect();
- this.withPageLoading({ to: window.location.href, kind: "redirect" });
- window.location.reload();
- }
- }, true);
- if (!dead) {
- this.bindNav();
- }
- this.bindClicks();
- if (!dead) {
- this.bindForms();
- }
- this.bind({ keyup: "keyup", keydown: "keydown" }, (e, type, view, targetEl, phxEvent, eventTarget) => {
- let matchKey = targetEl.getAttribute(this.binding(PHX_KEY));
- let pressedKey = e.key && e.key.toLowerCase();
- if (matchKey && matchKey.toLowerCase() !== pressedKey) {
- return;
- }
- let data = __spreadValues({ key: e.key }, this.eventMeta(type, e, targetEl));
- js_default.exec(type, phxEvent, view, targetEl, ["push", { data }]);
- });
- this.bind({ blur: "focusout", focus: "focusin" }, (e, type, view, targetEl, phxEvent, eventTarget) => {
- if (!eventTarget) {
- let data = __spreadValues({ key: e.key }, this.eventMeta(type, e, targetEl));
- js_default.exec(type, phxEvent, view, targetEl, ["push", { data }]);
- }
- });
- this.bind({ blur: "blur", focus: "focus" }, (e, type, view, targetEl, targetCtx, phxEvent, phxTarget) => {
- if (phxTarget === "window") {
- let data = this.eventMeta(type, e, targetEl);
- js_default.exec(type, phxEvent, view, targetEl, ["push", { data }]);
- }
- });
- window.addEventListener("dragover", (e) => e.preventDefault());
- window.addEventListener("drop", (e) => {
- e.preventDefault();
- let dropTargetId = maybe(closestPhxBinding(e.target, this.binding(PHX_DROP_TARGET)), (trueTarget) => {
- return trueTarget.getAttribute(this.binding(PHX_DROP_TARGET));
- });
- let dropTarget = dropTargetId && document.getElementById(dropTargetId);
- let files = Array.from(e.dataTransfer.files || []);
- if (!dropTarget || dropTarget.disabled || files.length === 0 || !(dropTarget.files instanceof FileList)) {
- return;
- }
- LiveUploader.trackFiles(dropTarget, files, e.dataTransfer);
- dropTarget.dispatchEvent(new Event("input", { bubbles: true }));
- });
- this.on(PHX_TRACK_UPLOADS, (e) => {
- let uploadTarget = e.target;
- if (!dom_default.isUploadInput(uploadTarget)) {
- return;
- }
- let files = Array.from(e.detail.files || []).filter((f) => f instanceof File || f instanceof Blob);
- LiveUploader.trackFiles(uploadTarget, files);
- uploadTarget.dispatchEvent(new Event("input", { bubbles: true }));
- });
- }
- eventMeta(eventName, e, targetEl) {
- let callback = this.metadataCallbacks[eventName];
- return callback ? callback(e, targetEl) : {};
- }
- setPendingLink(href) {
- this.linkRef++;
- this.pendingLink = href;
- return this.linkRef;
- }
- commitPendingLink(linkRef) {
- if (this.linkRef !== linkRef) {
- return false;
- } else {
- this.href = this.pendingLink;
- this.pendingLink = null;
- return true;
- }
- }
- getHref() {
- return this.href;
- }
- hasPendingLink() {
- return !!this.pendingLink;
- }
- bind(events, callback) {
- for (let event in events) {
- let browserEventName = events[event];
- this.on(browserEventName, (e) => {
- let binding = this.binding(event);
- let windowBinding = this.binding(`window-${event}`);
- let targetPhxEvent = e.target.getAttribute && e.target.getAttribute(binding);
- if (targetPhxEvent) {
- this.debounce(e.target, e, browserEventName, () => {
- this.withinOwners(e.target, (view) => {
- callback(e, event, view, e.target, targetPhxEvent, null);
- });
- });
- } else {
- dom_default.all(document, `[${windowBinding}]`, (el) => {
- let phxEvent = el.getAttribute(windowBinding);
- this.debounce(el, e, browserEventName, () => {
- this.withinOwners(el, (view) => {
- callback(e, event, view, el, phxEvent, "window");
- });
- });
- });
- }
- });
- }
- }
- bindClicks() {
- window.addEventListener("click", (e) => this.clickStartedAtTarget = e.target);
- this.bindClick("click", "click", false);
- this.bindClick("mousedown", "capture-click", true);
- }
- bindClick(eventName, bindingName, capture) {
- let click = this.binding(bindingName);
- window.addEventListener(eventName, (e) => {
- let target = null;
- if (capture) {
- target = e.target.matches(`[${click}]`) ? e.target : e.target.querySelector(`[${click}]`);
- } else {
- let clickStartedAtTarget = this.clickStartedAtTarget || e.target;
- target = closestPhxBinding(clickStartedAtTarget, click);
- this.dispatchClickAway(e, clickStartedAtTarget);
- this.clickStartedAtTarget = null;
- }
- let phxEvent = target && target.getAttribute(click);
- if (!phxEvent) {
- if (!capture && dom_default.isNewPageClick(e, window.location)) {
- this.unload();
- }
- return;
- }
- if (target.getAttribute("href") === "#") {
- e.preventDefault();
- }
- if (target.hasAttribute(PHX_REF)) {
- return;
- }
- this.debounce(target, e, "click", () => {
- this.withinOwners(target, (view) => {
- js_default.exec("click", phxEvent, view, target, ["push", { data: this.eventMeta("click", e, target) }]);
- });
- });
- }, capture);
- }
- dispatchClickAway(e, clickStartedAt) {
- let phxClickAway = this.binding("click-away");
- dom_default.all(document, `[${phxClickAway}]`, (el) => {
- if (!(el.isSameNode(clickStartedAt) || el.contains(clickStartedAt))) {
- this.withinOwners(e.target, (view) => {
- let phxEvent = el.getAttribute(phxClickAway);
- if (js_default.isVisible(el)) {
- js_default.exec("click", phxEvent, view, el, ["push", { data: this.eventMeta("click", e, e.target) }]);
- }
- });
- }
- });
- }
- bindNav() {
- if (!browser_default.canPushState()) {
- return;
- }
- if (history.scrollRestoration) {
- history.scrollRestoration = "manual";
- }
- let scrollTimer = null;
- window.addEventListener("scroll", (_e) => {
- clearTimeout(scrollTimer);
- scrollTimer = setTimeout(() => {
- browser_default.updateCurrentState((state) => Object.assign(state, { scroll: window.scrollY }));
- }, 100);
- });
- window.addEventListener("popstate", (event) => {
- if (!this.registerNewLocation(window.location)) {
- return;
- }
- let { type, id, root, scroll } = event.state || {};
- let href = window.location.href;
- dom_default.dispatchEvent(window, "phx:navigate", { detail: { href, patch: type === "patch", pop: true } });
- this.requestDOMUpdate(() => {
- if (this.main.isConnected() && (type === "patch" && id === this.main.id)) {
- this.main.pushLinkPatch(href, null, () => {
- this.maybeScroll(scroll);
- });
- } else {
- this.replaceMain(href, null, () => {
- if (root) {
- this.replaceRootHistory();
- }
- this.maybeScroll(scroll);
- });
- }
- });
- }, false);
- window.addEventListener("click", (e) => {
- let target = closestPhxBinding(e.target, PHX_LIVE_LINK);
- let type = target && target.getAttribute(PHX_LIVE_LINK);
- if (!type || !this.isConnected() || !this.main || dom_default.wantsNewTab(e)) {
- return;
- }
- let href = target.href;
- let linkState = target.getAttribute(PHX_LINK_STATE);
- e.preventDefault();
- e.stopImmediatePropagation();
- if (this.pendingLink === href) {
- return;
- }
- this.requestDOMUpdate(() => {
- if (type === "patch") {
- this.pushHistoryPatch(href, linkState, target);
- } else if (type === "redirect") {
- this.historyRedirect(href, linkState);
- } else {
- throw new Error(`expected ${PHX_LIVE_LINK} to be "patch" or "redirect", got: ${type}`);
- }
- let phxClick = target.getAttribute(this.binding("click"));
- if (phxClick) {
- this.requestDOMUpdate(() => this.execJS(target, phxClick, "click"));
- }
- });
- }, false);
- }
- maybeScroll(scroll) {
- if (typeof scroll === "number") {
- requestAnimationFrame(() => {
- window.scrollTo(0, scroll);
- });
- }
- }
- dispatchEvent(event, payload = {}) {
- dom_default.dispatchEvent(window, `phx:${event}`, { detail: payload });
- }
- dispatchEvents(events) {
- events.forEach(([event, payload]) => this.dispatchEvent(event, payload));
- }
- withPageLoading(info, callback) {
- dom_default.dispatchEvent(window, "phx:page-loading-start", { detail: info });
- let done = () => dom_default.dispatchEvent(window, "phx:page-loading-stop", { detail: info });
- return callback ? callback(done) : done;
- }
- pushHistoryPatch(href, linkState, targetEl) {
- if (!this.isConnected()) {
- return browser_default.redirect(href);
- }
- this.withPageLoading({ to: href, kind: "patch" }, (done) => {
- this.main.pushLinkPatch(href, targetEl, (linkRef) => {
- this.historyPatch(href, linkState, linkRef);
- done();
- });
- });
- }
- historyPatch(href, linkState, linkRef = this.setPendingLink(href)) {
- if (!this.commitPendingLink(linkRef)) {
- return;
- }
- browser_default.pushState(linkState, { type: "patch", id: this.main.id }, href);
- dom_default.dispatchEvent(window, "phx:navigate", { detail: { patch: true, href, pop: false } });
- this.registerNewLocation(window.location);
- }
- historyRedirect(href, linkState, flash) {
- if (!this.isConnected()) {
- return browser_default.redirect(href, flash);
- }
- if (/^\/$|^\/[^\/]+.*$/.test(href)) {
- let { protocol, host } = window.location;
- href = `${protocol}//${host}${href}`;
- }
- let scroll = window.scrollY;
- this.withPageLoading({ to: href, kind: "redirect" }, (done) => {
- this.replaceMain(href, flash, (linkRef) => {
- if (linkRef === this.linkRef) {
- browser_default.pushState(linkState, { type: "redirect", id: this.main.id, scroll }, href);
- dom_default.dispatchEvent(window, "phx:navigate", { detail: { href, patch: false, pop: false } });
- this.registerNewLocation(window.location);
- }
- done();
- });
- });
- }
- replaceRootHistory() {
- browser_default.pushState("replace", { root: true, type: "patch", id: this.main.id });
- }
- registerNewLocation(newLocation) {
- let { pathname, search } = this.currentLocation;
- if (pathname + search === newLocation.pathname + newLocation.search) {
- return false;
- } else {
- this.currentLocation = clone(newLocation);
- return true;
- }
- }
- bindForms() {
- let iterations = 0;
- let externalFormSubmitted = false;
- this.on("submit", (e) => {
- let phxSubmit = e.target.getAttribute(this.binding("submit"));
- let phxChange = e.target.getAttribute(this.binding("change"));
- if (!externalFormSubmitted && phxChange && !phxSubmit) {
- externalFormSubmitted = true;
- e.preventDefault();
- this.withinOwners(e.target, (view) => {
- view.disableForm(e.target);
- window.requestAnimationFrame(() => {
- if (dom_default.isUnloadableFormSubmit(e)) {
- this.unload();
- }
- e.target.submit();
- });
- });
- }
- }, true);
- this.on("submit", (e) => {
- let phxEvent = e.target.getAttribute(this.binding("submit"));
- if (!phxEvent) {
- if (dom_default.isUnloadableFormSubmit(e)) {
- this.unload();
- }
- return;
- }
- e.preventDefault();
- e.target.disabled = true;
- this.withinOwners(e.target, (view) => {
- js_default.exec("submit", phxEvent, view, e.target, ["push", { submitter: e.submitter }]);
- });
- }, false);
- for (let type of ["change", "input"]) {
- this.on(type, (e) => {
- let phxChange = this.binding("change");
- let input = e.target;
- let inputEvent = input.getAttribute(phxChange);
- let formEvent = input.form && input.form.getAttribute(phxChange);
- let phxEvent = inputEvent || formEvent;
- if (!phxEvent) {
- return;
- }
- if (input.type === "number" && input.validity && input.validity.badInput) {
- return;
- }
- let dispatcher = inputEvent ? input : input.form;
- let currentIterations = iterations;
- iterations++;
- let { at, type: lastType } = dom_default.private(input, "prev-iteration") || {};
- if (at === currentIterations - 1 && type !== lastType) {
- return;
- }
- dom_default.putPrivate(input, "prev-iteration", { at: currentIterations, type });
- this.debounce(input, e, type, () => {
- this.withinOwners(dispatcher, (view) => {
- dom_default.putPrivate(input, PHX_HAS_FOCUSED, true);
- if (!dom_default.isTextualInput(input)) {
- this.setActiveElement(input);
- }
- js_default.exec("change", phxEvent, view, input, ["push", { _target: e.target.name, dispatcher }]);
- });
- });
- }, false);
- }
- this.on("reset", (e) => {
- let form = e.target;
- dom_default.resetForm(form, this.binding(PHX_FEEDBACK_FOR));
- let input = Array.from(form.elements).find((el) => el.type === "reset");
- window.requestAnimationFrame(() => {
- input.dispatchEvent(new Event("input", { bubbles: true, cancelable: false }));
- });
- });
- }
- debounce(el, event, eventType, callback) {
- if (eventType === "blur" || eventType === "focusout") {
- return callback();
- }
- let phxDebounce = this.binding(PHX_DEBOUNCE);
- let phxThrottle = this.binding(PHX_THROTTLE);
- let defaultDebounce = this.defaults.debounce.toString();
- let defaultThrottle = this.defaults.throttle.toString();
- this.withinOwners(el, (view) => {
- let asyncFilter = () => !view.isDestroyed() && document.body.contains(el);
- dom_default.debounce(el, event, phxDebounce, defaultDebounce, phxThrottle, defaultThrottle, asyncFilter, () => {
- callback();
- });
- });
- }
- silenceEvents(callback) {
- this.silenced = true;
- callback();
- this.silenced = false;
- }
- on(event, callback) {
- window.addEventListener(event, (e) => {
- if (!this.silenced) {
- callback(e);
- }
- });
- }
- };
- var TransitionSet = class {
- constructor() {
- this.transitions = /* @__PURE__ */ new Set();
- this.pendingOps = [];
- }
- reset() {
- this.transitions.forEach((timer) => {
- clearTimeout(timer);
- this.transitions.delete(timer);
- });
- this.flushPendingOps();
- }
- after(callback) {
- if (this.size() === 0) {
- callback();
- } else {
- this.pushPendingOp(callback);
- }
- }
- addTransition(time, onStart, onDone) {
- onStart();
- let timer = setTimeout(() => {
- this.transitions.delete(timer);
- onDone();
- this.flushPendingOps();
- }, time);
- this.transitions.add(timer);
- }
- pushPendingOp(op) {
- this.pendingOps.push(op);
- }
- size() {
- return this.transitions.size;
- }
- flushPendingOps() {
- if (this.size() > 0) {
- return;
- }
- let op = this.pendingOps.shift();
- if (op) {
- op();
- this.flushPendingOps();
- }
- }
- };
-
- // js/app.js
- var socketPath = document.querySelector("html").getAttribute("phx-socket") || "/live";
- var csrfToken = document.querySelector("meta[name='csrf-token']").getAttribute("content");
- var Hooks2 = {};
- var editors = {};
- Hooks2.JsonEditor = {
- mounted() {
- const inputId = this.el.getAttribute("data-input-id");
- const hook = this;
- this.editor = new JSONEditor(
- this.el,
- {
- onChangeText: (json2) => {
- const target = document.getElementById(inputId);
- try {
- JSON.parse(json2);
- target.value = json2;
- target.dispatchEvent(new Event("change", { bubbles: true }));
- } catch (_e) {
- }
- },
- onChange: () => {
- try {
- const target = document.getElementById(inputId);
- json = hook.editor.get();
- target.value = JSON.stringify(json);
- target.dispatchEvent(new Event("change", { bubbles: true }));
- } catch (_e) {
- }
- },
- onModeChange: (newMode) => {
- hook.mode = newMode;
- },
- modes: ["text", "tree"]
- },
- JSON.parse(document.getElementById(inputId).value)
- );
- editors[this.el.id] = this.editor;
- }
- };
- Hooks2.JsonEditorSource = {
- updated() {
- try {
- let editor = editors[this.el.getAttribute("data-editor-id")];
- if (editor.getMode() === "tree") {
- editor.update(JSON.parse(this.el.value));
- } else {
- if (editor.get() !== JSON.parse(this.el.value)) {
- editor.setText(this.el.value);
- } else {
- }
- }
- } catch (_e) {
- }
- }
- };
- Hooks2.JsonView = {
- updated() {
- const json2 = JSON.parse(this.el.getAttribute("data-json"));
- this.editor = new JSONEditor(
- this.el,
- {
- mode: "preview"
- },
- json2
- );
- },
- mounted() {
- const json2 = JSON.parse(this.el.getAttribute("data-json"));
- this.editor = new JSONEditor(
- this.el,
- {
- mode: "preview"
- },
- json2
- );
- }
- };
- var init = (element) => new EasyMDE({
- element,
- initialValue: element.getAttribute("value")
- });
- Hooks2.MarkdownEditor = {
- mounted() {
- const id = this.el.getAttribute("data-target-id");
- const el = document.getElementById(id);
- const easyMDE = init(el);
- easyMDE.codemirror.on("change", () => {
- el.value = easyMDE.value();
- el.dispatchEvent(new Event("change", { bubbles: true }));
- });
- }
- };
- Hooks2.Actor = {
- mounted() {
- this.handleEvent("set_actor", (payload) => {
- document.cookie = "actor_resource=" + payload.resource + ";path=/";
- document.cookie = "actor_primary_key=" + payload.primary_key + ";path=/";
- document.cookie = "actor_action=" + payload.action + ";path=/";
- document.cookie = "actor_api=" + payload.api + ";path=/";
- });
- this.handleEvent("clear_actor", () => {
- document.cookie = "actor_resource=;path=/";
- document.cookie = "actor_primary_key=;path=/";
- document.cookie = "actor_action;path=/";
- document.cookie = "actor_api=;path=/";
- document.cookie = "actor_authorizing=false;path=/";
- document.cookie = "actor_paused=true;path=/";
- });
- this.handleEvent("toggle_authorizing", (payload) => {
- document.cookie = "actor_authorizing=" + payload.authorizing + ";path=/";
- });
- this.handleEvent("toggle_actor_paused", (payload) => {
- document.cookie = "actor_paused=" + payload.actor_paused + ";path=/";
- });
- }
- };
- Hooks2.Tenant = {
- mounted() {
- this.handleEvent("set_tenant", (payload) => {
- document.cookie = "tenant=" + payload.tenant + ";path=/";
- });
- this.handleEvent("clear_tenant", () => {
- document.cookie = "tenant=;path=/";
- });
- }
- };
- Hooks2.MaintainAttrs = {
- attrs() {
- return this.el.getAttribute("data-attrs").split(", ");
- },
- beforeUpdate() {
- this.prevAttrs = this.attrs().map((name) => [
- name,
- this.el.getAttribute(name)
- ]);
- },
- updated() {
- this.prevAttrs.forEach(([name, val]) => this.el.setAttribute(name, val));
- }
- };
- var liveSocket = new LiveSocket(socketPath, Socket, {
- params: { _csrf_token: csrfToken },
- hooks: Hooks2,
- dom: {
- onBeforeElUpdated(from, to) {
- if (from._x_dataStack) {
- window.Alpine.clone(from, to);
- }
- }
- }
- });
- import_topbar.default.config({ barColors: { 0: "#29d" }, shadowColor: "rgba(0, 0, 0, .3)" });
- window.addEventListener("phx:page-loading-start", (_info) => import_topbar.default.show(300));
- window.addEventListener("phx:page-loading-stop", (_info) => import_topbar.default.hide());
- liveSocket.connect() >> // expose liveSocket on window for web console debug logs and latency simulation:
- liveSocket.enableDebug();
- window.liveSocket = liveSocket;
-})();
+ `);this.socket=new t(e,i),this.bindingPrefix=i.bindingPrefix||bi,this.opts=i,this.params=Be(i.params||{}),this.viewLogger=i.viewLogger,this.metadataCallbacks=i.metadata||{},this.defaults=Object.assign(Re(ki),i.defaults||{}),this.activeElement=null,this.prevActive=null,this.silenced=!1,this.main=null,this.linkRef=1,this.clickRef=1,this.roots={},this.href=window.location.href,this.pendingLink=null,this.currentLocation=Re(window.location),this.hooks=i.hooks||{},this.uploaders=i.uploaders||{},this.loaderTimeout=i.loaderTimeout||mi,this.maxReloads=i.maxReloads||ni,this.reloadJitterMin=i.reloadJitterMin||si,this.reloadJitterMax=i.reloadJitterMax||ri,this.failsafeJitter=i.failsafeJitter||oi,this.localStorage=i.localStorage||window.localStorage,this.sessionStorage=i.sessionStorage||window.sessionStorage,this.boundTopLevelEvents=!1,this.domCallbacks=Object.assign({onNodeAdded:Be(),onBeforeElUpdated:Be()},i.dom||{}),this.transitions=new Wi,window.addEventListener("pagehide",n=>{this.unloaded=!0}),this.socket.onOpen(()=>{this.isUnloaded()&&window.location.reload()})}isProfileEnabled(){return this.sessionStorage.getItem($e)==="true"}isDebugEnabled(){return this.sessionStorage.getItem(je)==="true"}enableDebug(){this.sessionStorage.setItem(je,"true")}enableProfiling(){this.sessionStorage.setItem($e,"true")}disableDebug(){this.sessionStorage.removeItem(je)}disableProfiling(){this.sessionStorage.removeItem($e)}enableLatencySim(e){this.enableDebug(),console.log("latency simulator enabled for the duration of this browser session. Call disableLatencySim() to disable"),this.sessionStorage.setItem(Fe,e)}disableLatencySim(){this.sessionStorage.removeItem(Fe)}getLatencySim(){let e=this.sessionStorage.getItem(Fe);return e?parseInt(e):null}getSocket(){return this.socket}connect(){let e=()=>{this.joinRootViews()&&(this.bindTopLevelEvents(),this.socket.connect())};["complete","loaded","interactive"].indexOf(document.readyState)>=0?e():document.addEventListener("DOMContentLoaded",()=>e())}disconnect(e){this.socket.disconnect(e)}execJS(e,t,i=null){this.owner(e,n=>U.exec(i,t,n,e))}triggerDOM(e,t){this.domCallbacks[e](...t)}time(e,t){if(!this.isProfileEnabled()||!console.time)return t();console.time(e);let i=t();return console.timeEnd(e),i}log(e,t,i){if(this.viewLogger){let[n,s]=i();this.viewLogger(e,t,n,s)}else if(this.isDebugEnabled()){let[n,s]=i();wi(e,t,n,s)}}requestDOMUpdate(e){this.transitions.after(e)}transition(e,t,i=function(){}){this.transitions.addTransition(e,t,i)}onChannel(e,t,i){e.on(t,n=>{let s=this.getLatencySim();s?(console.log(`simulating ${s}ms of latency from server to client`),setTimeout(()=>i(n),s)):i(n)})}wrapPush(e,t,i){let n=this.getLatencySim(),s=e.joinCount;if(!n)return t.timeout?i().receive("timeout",()=>{e.joinCount===s&&!e.isDestroyed()&&this.reloadWithJitter(e,()=>{this.log(e,"timeout",()=>["received timeout while communicating with server. Falling back to hard refresh for recovery"])})}):i();console.log(`simulating ${n}ms of latency from client to server`);let r={receives:[],receive(o,a){this.receives.push([o,a])}};return setTimeout(()=>{e.isDestroyed()||r.receives.reduce((o,[a,h])=>o.receive(a,h),i())},n),r}reloadWithJitter(e,t){e.destroy(),this.disconnect();let i=this.reloadJitterMin,n=this.reloadJitterMax,s=Math.floor(Math.random()*(n-i+1))+i,r=X.updateLocal(this.localStorage,window.location.pathname,xt,0,o=>o+1);t?t():this.log(e,"join",()=>[`encountered ${r} consecutive reloads`]),r>this.maxReloads&&(this.log(e,"join",()=>[`exceeded ${this.maxReloads} consecutive reloads. Entering failsafe mode`]),s=this.failsafeJitter),setTimeout(()=>{this.hasPendingLink()?window.location=this.pendingLink:window.location.reload()},s)}getHookCallbacks(e){return e&&e.startsWith("Phoenix.")?Ri[e.split(".")[1]]:this.hooks[e]}isUnloaded(){return this.unloaded}isConnected(){return this.socket.isConnected()}getBindingPrefix(){return this.bindingPrefix}binding(e){return`${this.getBindingPrefix()}${e}`}channel(e,t){return this.socket.channel(e,t)}joinRootViews(){let e=!1;return l.all(document,`${ee}:not([${Z}])`,t=>{if(!this.getRootById(t.id)){let i=this.newRootView(t);i.setHref(this.getHref()),i.join(),t.getAttribute(Ze)&&(this.main=i)}e=!0}),e}redirect(e,t){this.disconnect(),X.redirect(e,t)}replaceMain(e,t,i=null,n=this.setPendingLink(e)){let s=this.main.el,r=l.cloneNode(s,"");this.main.showLoader(this.loaderTimeout),this.main.destroy(),this.main=this.newRootView(r,t),this.main.setRedirect(e),this.transitionRemoves(),this.main.join((o,a)=>{o===1&&this.commitPendingLink(n)&&this.requestDOMUpdate(()=>{l.findPhxSticky(document).forEach(h=>r.appendChild(h)),s.replaceWith(r),i&&i(),a()})})}transitionRemoves(e){let t=this.binding("remove");e=e||l.all(document,`[${t}]`),e.forEach(i=>{document.body.contains(i)&&this.execJS(i,i.getAttribute(t),"remove")})}isPhxView(e){return e.getAttribute&&e.getAttribute(W)!==null}newRootView(e,t){let i=new Ut(e,this,null,t);return this.roots[i.id]=i,i}owner(e,t){let i=F(e.closest(ee),n=>this.getViewByEl(n))||this.main;i&&t(i)}withinOwners(e,t){this.owner(e,i=>t(i,e))}getViewByEl(e){let t=e.getAttribute(ce);return F(this.getRootById(t),i=>i.getDescendentByEl(e))}getRootById(e){return this.roots[e]}destroyAllViews(){for(let e in this.roots)this.roots[e].destroy(),delete this.roots[e]}destroyViewByEl(e){let t=this.getRootById(e.getAttribute(ce));t&&t.id===e.id?(t.destroy(),delete this.roots[t.id]):t&&t.destroyDescendent(e.id)}setActiveElement(e){if(this.activeElement===e)return;this.activeElement=e;let t=()=>{e===this.activeElement&&(this.activeElement=null),e.removeEventListener("mouseup",this),e.removeEventListener("touchend",this)};e.addEventListener("mouseup",t),e.addEventListener("touchend",t)}getActiveElement(){return document.activeElement===document.body?this.activeElement||document.activeElement:document.activeElement||document.body}dropActiveElement(e){this.prevActive&&e.ownsElement(this.prevActive)&&(this.prevActive=null)}restorePreviouslyActiveFocus(){this.prevActive&&this.prevActive!==document.body&&this.prevActive.focus()}blurActiveElement(){this.prevActive=this.getActiveElement(),this.prevActive!==document.body&&this.prevActive.blur()}bindTopLevelEvents(){this.boundTopLevelEvents||(this.boundTopLevelEvents=!0,this.socket.onClose(e=>{e.code===1e3&&this.main&&this.reloadWithJitter(this.main)}),document.body.addEventListener("click",function(){}),window.addEventListener("pageshow",e=>{e.persisted&&(this.getSocket().disconnect(),this.withPageLoading({to:window.location.href,kind:"redirect"}),window.location.reload())},!0),this.bindNav(),this.bindClicks(),this.bindForms(),this.bind({keyup:"keyup",keydown:"keydown"},(e,t,i,n,s,r)=>{let o=n.getAttribute(this.binding(pi)),a=e.key&&e.key.toLowerCase();if(o&&o.toLowerCase()!==a)return;let h=te({key:e.key},this.eventMeta(t,e,n));U.exec(t,s,i,n,["push",{data:h}])}),this.bind({blur:"focusout",focus:"focusin"},(e,t,i,n,s,r)=>{if(!r){let o=te({key:e.key},this.eventMeta(t,e,n));U.exec(t,s,i,n,["push",{data:o}])}}),this.bind({blur:"blur",focus:"focus"},(e,t,i,n,s,r,o)=>{if(o==="window"){let a=this.eventMeta(t,e,n);U.exec(t,r,i,n,["push",{data:a}])}}),window.addEventListener("dragover",e=>e.preventDefault()),window.addEventListener("drop",e=>{e.preventDefault();let t=F(de(e.target,this.binding(ct)),s=>s.getAttribute(this.binding(ct))),i=t&&document.getElementById(t),n=Array.from(e.dataTransfer.files||[]);!i||i.disabled||n.length===0||!(i.files instanceof FileList)||(C.trackFiles(i,n),i.dispatchEvent(new Event("input",{bubbles:!0})))}),this.on(Dt,e=>{let t=e.target;if(!l.isUploadInput(t))return;let i=Array.from(e.detail.files||[]).filter(n=>n instanceof File||n instanceof Blob);C.trackFiles(t,i),t.dispatchEvent(new Event("input",{bubbles:!0}))}))}eventMeta(e,t,i){let n=this.metadataCallbacks[e];return n?n(t,i):{}}setPendingLink(e){return this.linkRef++,this.pendingLink=e,this.linkRef}commitPendingLink(e){return this.linkRef!==e?!1:(this.href=this.pendingLink,this.pendingLink=null,!0)}getHref(){return this.href}hasPendingLink(){return!!this.pendingLink}bind(e,t){for(let i in e){let n=e[i];this.on(n,s=>{let r=this.binding(i),o=this.binding(`window-${i}`),a=s.target.getAttribute&&s.target.getAttribute(r);a?this.debounce(s.target,s,()=>{this.withinOwners(s.target,h=>{t(s,i,h,s.target,a,null)})}):l.all(document,`[${o}]`,h=>{let d=h.getAttribute(o);this.debounce(h,s,()=>{this.withinOwners(h,f=>{t(s,i,f,h,d,"window")})})})})}}bindClicks(){this.bindClick("click","click",!1),this.bindClick("mousedown","capture-click",!0)}bindClick(e,t,i){let n=this.binding(t);window.addEventListener(e,s=>{if(!this.isConnected())return;this.clickRef++;let r=this.clickRef,o=null;i?o=s.target.matches(`[${n}]`)?s.target:s.target.querySelector(`[${n}]`):(o=de(s.target,n),this.dispatchClickAway(s,r));let a=o&&o.getAttribute(n);a&&(o.getAttribute("href")==="#"&&s.preventDefault(),this.debounce(o,s,()=>{this.withinOwners(o,h=>{U.exec("click",a,h,o,["push",{data:this.eventMeta("click",s,o)}])})}))},i)}dispatchClickAway(e,t){let i=this.binding("click-away"),n=this.binding("click");l.all(document,`[${i}]`,s=>{s.isSameNode(e.target)||s.contains(e.target)||this.withinOwners(e.target,r=>{let o=s.getAttribute(i);if(U.isVisible(s)){let a=e.target.closest(`[${n}]`)||e.target;U.exec("click",o,r,s,["push",{data:this.eventMeta("click",e,e.target)}])}})})}bindNav(){if(!X.canPushState())return;history.scrollRestoration&&(history.scrollRestoration="manual");let e=null;window.addEventListener("scroll",t=>{clearTimeout(e),e=setTimeout(()=>{X.updateCurrentState(i=>Object.assign(i,{scroll:window.scrollY}))},100)}),window.addEventListener("popstate",t=>{if(!this.registerNewLocation(window.location))return;let{type:i,id:n,root:s,scroll:r}=t.state||{},o=window.location.href;this.requestDOMUpdate(()=>{this.main.isConnected()&&i==="patch"&&n===this.main.id?this.main.pushLinkPatch(o,null):this.replaceMain(o,null,()=>{s&&this.replaceRootHistory(),typeof r=="number"&&setTimeout(()=>{window.scrollTo(0,r)},0)})})},!1),window.addEventListener("click",t=>{let i=de(t.target,He),n=i&&i.getAttribute(He),s=t.metaKey||t.ctrlKey||t.button===1;if(!n||!this.isConnected()||!this.main||s)return;let r=i.href,o=i.getAttribute(hi);t.preventDefault(),this.pendingLink!==r&&this.requestDOMUpdate(()=>{if(n==="patch")this.pushHistoryPatch(r,o,i);else if(n==="redirect")this.historyRedirect(r,o);else throw new Error(`expected ${He} to be "patch" or "redirect", got: ${n}`)})},!1)}dispatchEvent(e,t={}){l.dispatchEvent(window,`phx:${e}`,t)}dispatchEvents(e){e.forEach(([t,i])=>this.dispatchEvent(t,i))}withPageLoading(e,t){l.dispatchEvent(window,"phx:page-loading-start",e);let i=()=>l.dispatchEvent(window,"phx:page-loading-stop",e);return t?t(i):i}pushHistoryPatch(e,t,i){this.withPageLoading({to:e,kind:"patch"},n=>{this.main.pushLinkPatch(e,i,s=>{this.historyPatch(e,t,s),n()})})}historyPatch(e,t,i=this.setPendingLink(e)){this.commitPendingLink(i)&&(X.pushState(t,{type:"patch",id:this.main.id},e),this.registerNewLocation(window.location))}historyRedirect(e,t,i){let n=window.scrollY;this.withPageLoading({to:e,kind:"redirect"},s=>{this.replaceMain(e,i,()=>{X.pushState(t,{type:"redirect",id:this.main.id,scroll:n},e),this.registerNewLocation(window.location),s()})})}replaceRootHistory(){X.pushState("replace",{root:!0,type:"patch",id:this.main.id})}registerNewLocation(e){let{pathname:t,search:i}=this.currentLocation;return t+i===e.pathname+e.search?!1:(this.currentLocation=Re(e),!0)}bindForms(){let e=0;this.on("submit",t=>{let i=t.target.getAttribute(this.binding("submit"));i&&(t.preventDefault(),t.target.disabled=!0,this.withinOwners(t.target,n=>{U.exec("submit",i,n,t.target,["push",{}])}))},!1);for(let t of["change","input"])this.on(t,i=>{let n=i.target,s=n.form&&n.form.getAttribute(this.binding("change"));if(!s||n.type==="number"&&n.validity&&n.validity.badInput)return;let r=e;e++;let{at:o,type:a}=l.private(n,"prev-iteration")||{};o===r-1&&t!==a||(l.putPrivate(n,"prev-iteration",{at:r,type:t}),this.debounce(n,i,()=>{this.withinOwners(n.form,h=>{l.putPrivate(n,Ot,!0),l.isTextualInput(n)||this.setActiveElement(n),U.exec("change",s,h,n,["push",{_target:i.target.name}])})}))},!1)}debounce(e,t,i){let n=this.binding(ui),s=this.binding(fi),r=this.defaults.debounce.toString(),o=this.defaults.throttle.toString();l.debounce(e,t,n,r,s,o,i)}silenceEvents(e){this.silenced=!0,e(),this.silenced=!1}on(e,t){window.addEventListener(e,i=>{this.silenced||t(i)})}},Wi=class{constructor(){this.transitions=new Set,this.pendingOps=[],this.reset()}reset(){this.transitions.forEach(e=>{cancelTimeout(e),this.transitions.delete(e)}),this.flushPendingOps()}after(e){this.size()===0?e():this.pushPendingOp(e)}addTransition(e,t,i){t();let n=setTimeout(()=>{this.transitions.delete(n),i(),this.size()===0&&this.flushPendingOps()},e);this.transitions.add(n)}pushPendingOp(e){this.pendingOps.push(e)}size(){return this.transitions.size}flushPendingOps(){this.pendingOps.forEach(e=>e()),this.pendingOps=[]}};var qi=document.querySelector("html").getAttribute("phx-socket")||"/live",Ki=document.querySelector("meta[name='csrf-token']").getAttribute("content"),q={},$t={};q.JsonEditor={mounted(){let e=this.el.getAttribute("data-input-id"),t=this;this.editor=new JSONEditor(this.el,{onChangeText:i=>{let n=document.getElementById(e);try{JSON.parse(i),n.value=i,n.dispatchEvent(new Event("change",{bubbles:!0}))}catch(s){}},onChange:()=>{try{let i=document.getElementById(e);json=t.editor.get(),i.value=JSON.stringify(json),i.dispatchEvent(new Event("change",{bubbles:!0}))}catch(i){}},onModeChange:i=>{t.mode=i},modes:["text","tree"]},JSON.parse(document.getElementById(e).value)),$t[this.el.id]=this.editor}};q.JsonEditorSource={updated(){try{let e=$t[this.el.getAttribute("data-editor-id")];e.getMode()==="tree"?e.update(JSON.parse(this.el.value)):e.get()!==JSON.parse(this.el.value)&&e.setText(this.el.value)}catch(e){}}};q.JsonView={updated(){let e=JSON.parse(this.el.getAttribute("data-json"));this.editor=new JSONEditor(this.el,{mode:"preview"},e)},mounted(){let e=JSON.parse(this.el.getAttribute("data-json"));this.editor=new JSONEditor(this.el,{mode:"preview"},e)}};var Gi=e=>new EasyMDE({element:e,initialValue:e.getAttribute("value")});q.MarkdownEditor={mounted(){let e=this.el.getAttribute("data-target-id"),t=document.getElementById(e),i=Gi(t);i.codemirror.on("change",()=>{t.value=i.value(),t.dispatchEvent(new Event("change",{bubbles:!0}))})}};q.Actor={mounted(){this.handleEvent("set_actor",e=>{document.cookie="actor_resource="+e.resource+";path=/",document.cookie="actor_primary_key="+e.primary_key+";path=/",document.cookie="actor_action="+e.action+";path=/",document.cookie="actor_api="+e.api+";path=/"}),this.handleEvent("clear_actor",()=>{document.cookie="actor_resource=;path=/",document.cookie="actor_primary_key=;path=/",document.cookie="actor_action;path=/",document.cookie="actor_api=;path=/",document.cookie="actor_authorizing=false;path=/",document.cookie="actor_paused=true;path=/"}),this.handleEvent("toggle_authorizing",e=>{document.cookie="actor_authorizing="+e.authorizing+";path=/"}),this.handleEvent("toggle_actor_paused",e=>{document.cookie="actor_paused="+e.actor_paused+";path=/"}),this.pushEvent("set_actor_from_session",{actor_resource:document.cookie.actor_resource,actor_primary_key:document.cookie.actor_primary_key,actor_action:document.cookie.actor_action,actor_api:document.cookie.actor_api,actor_authorizing:document.cookie.actor_authorizing,actor_paused:document.cookie.actor_paused})}};q.Tenant={mounted(){this.handleEvent("set_tenant",e=>{document.cookie="tenant="+e.tenant+";path=/"}),this.handleEvent("clear_tenant",()=>{document.cookie="tenant=;path=/"})}};q.MaintainAttrs={attrs(){return this.el.getAttribute("data-attrs").split(", ")},beforeUpdate(){this.prevAttrs=this.attrs().map(e=>[e,this.el.getAttribute(e)])},updated(){this.prevAttrs.forEach(([e,t])=>this.el.setAttribute(e,t))}};var et=new jt(qi,ht,{params:{_csrf_token:Ki},hooks:q,dom:{onBeforeElUpdated(e,t){e._x_dataStack&&window.Alpine.clone(e,t)}}});Le.default.config({barColors:{0:"#29d"},shadowColor:"rgba(0, 0, 0, .3)"});window.addEventListener("phx:page-loading-start",e=>Le.default.show(300));window.addEventListener("phx:page-loading-stop",e=>Le.default.hide());et.connect()>>et.enableDebug();window.liveSocket=et;})();
/**
* @license MIT
* topbar 2.0.0, 2023-02-04
diff --git a/priv/static/assets/app.js.gz b/priv/static/assets/app.js.gz
new file mode 100644
index 0000000..64af25a
Binary files /dev/null and b/priv/static/assets/app.js.gz differ
diff --git a/priv/static/cache_manifest.json b/priv/static/cache_manifest.json
new file mode 100644
index 0000000..3589327
--- /dev/null
+++ b/priv/static/cache_manifest.json
@@ -0,0 +1,6 @@
+{
+ "!comment!":"This file was auto-generated by `mix phx.digest`. Remove it and all generated artefacts with `mix phx.digest.clean --all`",
+ "version":1,
+ "latest":{"assets/app.css":"assets/app-161d914bba3ef8912bae46d62332075a.css","assets/app.js":"assets/app-c9fc8078e7bd6db471c3dfa3fcebe839.js"},
+ "digests":{"assets/app-161d914bba3ef8912bae46d62332075a.css":{"size":35588,"sha512":"UD0fP1n3WDpLGBt/Z/B2CpSpg8DUFlcIM3LV86qlBW28sgXzM2nOogI6tFmH6IclRlq2VBl+O5Pc+TKkBgHTcg==","digest":"161d914bba3ef8912bae46d62332075a","logical_path":"assets/app.css","mtime":63858229399},"assets/app-c9fc8078e7bd6db471c3dfa3fcebe839.js":{"size":92526,"sha512":"GzSgXYTWePK9QG0akmOU5Xv0o+H0UvSGvNo3jKMKI8m/iPH/+S7Of2p1q/bvc722pqyZB8rHCBv3hFNCZtrMcQ==","digest":"c9fc8078e7bd6db471c3dfa3fcebe839","logical_path":"assets/app.js","mtime":63858229399}}
+}