1import { p as prop, e as init, i as if_block, b as set_class } from './i18n-CGlVUOvE.js'; 2import { M as push, N as first_child, S as sibling, Z as get, $ as set, ae as derived_safe_equal, y as deep_read_state, w as untrack, a as append, a4 as text, t as template_effect, X as set_text, Q as child, O as pop, a0 as mutable_source, P as flushSync, R as from_html, T as reset, a5 as next } from './index-Bq2njFOY.js'; 3import { h as html } from './html-Bwif0JPw.js'; 4import { B as BaseForm } from './BaseForm-BF0VUPNl.js'; 5import { T as Textbox } from './Textbox-BXTb2K73.js'; 6import './StreamingBar.svelte_svelte_type_style_lang-DWGn5tT_.js'; 7import { B as Block } from './Block-DNK-JdLJ.js'; 8import './MarkdownCode.svelte_svelte_type_style_lang-B29zDiob.js'; 9import './ScrollFade.svelte_svelte_type_style_lang-D0JPkGar.js'; 10/* empty css */ 11import { B as Button } from './Button-By21KHDn.js'; 12import { B as BaseColumn } from './Index.svelte_svelte_type_style_lang-B7TVXWMD.js'; 13import './actions-CgRQ2lHA.js'; 14import './input-CXpCw23l.js'; 15import './BlockTitle-Bcj082QO.js'; 16import './Info-CfqzbVCN.js'; 17import './MarkdownCode-BYKuypS7.js'; 18import './Check-BKMHx_DF.js'; 19import './Copy-BQlJe6-D.js'; 20import './Send-CFiHLThw.js'; 21import './Square-kMgNk9Wy.js'; 22import './IconButtonWrapper-DAsvkfJg.js'; 23import './snippet-BG7qkY_1.js'; 24import './prism-python-NrKIQnfs.js'; 25import './Image-XuMqTTwB.js'; 26import './misc-D8a4ZbMA.js'; 27/* empty css */ 28/* empty css */ 29import './index-1GCmrSlD.js'; 30import './Clear-C8Tfa7QP.js'; 31 32var root_3 = from_html(`<p class="auth svelte-14xt79u"><!></p>`); 33var root_4 = from_html(`<p class="auth svelte-14xt79u"> </p>`); 34var root_5 = from_html(`<p class="creds svelte-14xt79u"> </p>`); 35var root_6 = from_html(`<!> <!>`, 1); 36var root_2 = from_html(`<h2 class="svelte-14xt79u"> </h2> <!> <!> <!> <!> <!>`, 1); 37var root_1 = from_html(`<div><!></div>`); 38 39function Login($$anchor, $$props) { 40 push($$props, false); 41 42 let root = prop($$props, 'root', 12); 43 let auth_message = prop($$props, 'auth_message', 12); 44 let app_mode = prop($$props, 'app_mode', 12); 45 let space_id = prop($$props, 'space_id', 12); 46 let i18n = prop($$props, 'i18n', 12); 47 let username = mutable_source(""); 48 let password = mutable_source(""); 49 let incorrect_credentials = mutable_source(false); 50 51 const submit = async () => { 52 const formData = new FormData(); 53 54 formData.append("username", get(username)); 55 formData.append("password", get(password)); 56 57 // Use URL constructor to properly join paths and avoid double slashes 58 const login_url = new URL("login", root().endsWith("/") ? root() : root() + "/").href; 59 60 let response = await fetch(login_url, { method: "POST", body: formData }); 61 62 if (response.status === 400) { 63 set(incorrect_credentials, true); 64 set(username, ""); 65 set(password, ""); 66 } else if (response.status == 200) { 67 location.reload(); 68 } 69 }; 70 71 var $$exports = { 72 get root() { 73 return root(); 74 }, 75 76 set root($$value) { 77 root($$value); 78 flushSync(); 79 }, 80 81 get auth_message() { 82 return auth_message(); 83 }, 84 85 set auth_message($$value) { 86 auth_message($$value); 87 flushSync(); 88 }, 89 90 get app_mode() { 91 return app_mode(); 92 }, 93 94 set app_mode($$value) { 95 app_mode($$value); 96 flushSync(); 97 }, 98 99 get space_id() { 100 return space_id(); 101 }, 102 103 set space_id($$value) { 104 space_id($$value); 105 flushSync(); 106 }, 107 108 get i18n() { 109 return i18n(); 110 }, 111 112 set i18n($$value) { 113 i18n($$value); 114 flushSync(); 115 } 116 }; 117 118 init(); 119 120 var div = root_1(); 121 let classes; 122 var node = child(div); 123 124 BaseColumn(node, { 125 variant: 'panel', 126 min_width: 480, 127 children: ($$anchor, $$slotProps) => { 128 var fragment = root_2(); 129 var h2 = first_child(fragment); 130 var text$1 = child(h2, true); 131 132 reset(h2); 133 134 var node_1 = sibling(h2, 2); 135 136 { 137 var consequent = ($$anchor) => { 138 var p = root_3(); 139 var node_2 = child(p); 140 141 html(node_2, auth_message); 142 reset(p); 143 append($$anchor, p); 144 }; 145 146 if_block(node_1, ($$render) => { 147 if (auth_message()) $$render(consequent); 148 }); 149 } 150 151 var node_3 = sibling(node_1, 2); 152 153 { 154 var consequent_1 = ($$anchor) => { 155 var p_1 = root_4(); 156 var text_1 = child(p_1, true); 157 158 reset(p_1); 159 160 template_effect(($0) => set_text(text_1, $0), [ 161 () => (
162 deep_read_state(i18n()), 163 untrack(() => i18n()("login.enable_cookies")) 164 ) 165 ]); 166 167 append($$anchor, p_1); 168 }; 169 170 if_block(node_3, ($$render) => { 171 if (space_id()) $$render(consequent_1); 172 }); 173 } 174 175 var node_4 = sibling(node_3, 2); 176 177 { 178 var consequent_2 = ($$anchor) => { 179 var p_2 = root_5(); 180 var text_2 = child(p_2, true); 181 182 reset(p_2); 183 184 template_effect(($0) => set_text(text_2, $0), [ 185 () => ( 186 deep_read_state(i18n()), 187 untrack(() => i18n()("login.incorrect_credentials")) 188 ) 189 ]); 190 191 append($$anchor, p_2); 192 }; 193 194 if_block(node_4, ($$render) => { 195 if (get(incorrect_credentials)) $$render(consequent_2); 196 }); 197 } 198 199 var node_5 = sibling(node_4, 2); 200 201 BaseForm(node_5, { 202 children: ($$anchor, $$slotProps) => { 203 var fragment_1 = root_6(); 204 var node_6 = first_child(fragment_1); 205 206 Block(node_6, { 207 children: ($$anchor, $$slotProps) => { 208 { 209 let $0 = derived_safe_equal(() => ( 210 deep_read_state(i18n()), 211 untrack(() => i18n()("login.username")) 212 )); 213 214 Textbox($$anchor, { 215 get label() { 216 return get($0); 217 }, 218 lines: 1, 219 show_label: true, 220 max_lines: 1, 221 onsubmit: submit, 222 get value() { 223 return get(username); 224 }, 225 226 set value($$value) { 227 set(username, $$value); 228 }, 229 $$legacy: true 230 }); 231 } 232 }, 233 $$slots: { default: true } 234 }); 235 236 var node_7 = sibling(node_6, 2); 237 238 Block(node_7, { 239 children: ($$anchor, $$slotProps) => { 240 { 241 let $0 = derived_safe_equal(() => ( 242 deep_read_state(i18n()), 243 untrack(() => i18n()("login.password")) 244 )); 245 246 Textbox($$anchor, { 247 get label() { 248 return get($0); 249 }, 250 lines: 1, 251 show_label: true, 252 max_lines: 1, 253 type: 'password', 254 onsubmit: submit, 255 get value() { 256 return get(password); 257 }, 258 259 set value($$value) { 260 set(password, $$value); 261 }, 262 $$legacy: true 263 }); 264 } 265 }, 266 $$slots: { default: true } 267 }); 268 269 append($$anchor, fragment_1); 270 }, 271 $$slots: { default: true } 272 }); 273 274 var node_8 = sibling(node_5, 2); 275 276 Button(node_8, { 277 size: 'lg', 278 variant: 'primary', 279 onclick: submit, 280 children: ($$anchor, $$slotProps) => { 281 next(); 282 283 var text_3 = text(); 284 285 template_effect(($0) => set_text(text_3, $0), [ 286 () => ( 287 deep_read_state(i18n()), 288 untrack(() => i18n()("login.login")) 289 ) 290 ]); 291 292 append($$anchor, text_3); 293 }, 294 $$slots: { default: true } 295 }); 296 297 template_effect(($0) => set_text(text$1, $0), [ 298 () => ( 299 deep_read_state(i18n()), 300 untrack(() => i18n()("login.login")) 301 ) 302 ]); 303 304 append($$anchor, fragment); 305 }, 306 $$slots: { default: true } 307 }); 308 309 reset(div); 310 template_effect(() => classes = set_class(div, 1, 'wrap svelte-14xt79u', null, classes, { 'min-h-screen': app_mode() })); 311 append($$anchor, div); 312 313 return pop($$exports); 314} 315 316export { Login as default }; 317//# sourceMappingURL=Login-DgfcN0FC.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.