1/** 2 * @purpose Shared runtime bootstrap for sandboxed app iframes (warm + cold) 3 * @relatedFiles ../../src/features/apps/runtime/iframe-runtime-config.ts, ../../src/features/apps/runtime/sdk-bridge.ts, ./iframe.html 4 */ 5 6(function () { 7 "use strict"; 8 9 var runtimeBaseUrl = "/apps-runtime"; 10 // Falls back to the unhashed path for a runtime cached from before the 11 // bridge was hashed; the parent overrides it with the current hashed name. 12 var sdkBridgeFilename = "sdk-bridge.js"; 13 var tailwindFilename = "tailwind.js"; 14 var coreFilename = "core.js"; 15 var uiBaseFilename = "ui-base.js"; 16 var expectedOrigin = ""; 17 var replayControl = null; 18 var replayScriptLoading = false; 19 20 window.__PARENT_ORIGIN__ = "*"; 21 22 // The document's color-scheme must explicitly match the embedder's (the 23 // host page sets one on <html>): Chromium paints an opaque white canvas 24 // behind a cross-origin iframe whose used color-scheme differs from its 25 // embedder, which silently defeats a transparent surface. 26 function applyColorScheme(darkMode) { 27 document.documentElement.style.colorScheme = darkMode ? "dark" : "light"; 28 } 29 30 // Apply dark mode and surface transparency immediately from URL hash to 31 // prevent flash. Hash format: #dark=1 or #dark=0&transparent=1 32 // Body starts with opacity:0 in CSS, we add theme-ready after applying dark mode 33 (function applyInitialDarkMode() { 34 var hash = window.location.hash; 35 var darkMode = !!(hash && hash.indexOf("dark=1") !== -1); 36 if (darkMode) { 37 document.body.classList.add("dark"); 38 } 39 applyColorScheme(darkMode); 40 if (hash && hash.indexOf("transparent=1") !== -1) { 41 document.body.classList.add("transparent-surface"); 42 } 43 // Show body now that theme is applied 44 document.body.classList.add("theme-ready"); 45 })(); 46 47 function withDefault(mod) { 48 if (mod && !mod.default) { 49 return Object.assign({}, mod, { default: mod }); 50 } 51 return mod; 52 } 53 54 // Require shim for esbuild externals 55 window.require = function (moduleName) { 56 var moduleMap = { 57 react: function () { 58 return withDefault(window.React); 59 }, 60 "react-dom": function () { 61 return withDefault(window.ReactDOM); 62 }, 63 "react-dom/client": function () { 64 return withDefault(window.ReactDOM); 65 }, 66 "react/jsx-runtime": function () { 67 return window.__jsxRuntime; 68 }, 69 "react/jsx-dev-runtime": function () { 70 return window.__jsxRuntime; 71 }, 72 "lucide-react": function () { 73 return withDefault(window.lucide); 74 }, 75 }; 76 var globalNames = { 77 react: "window.React", 78 "react-dom": "window.ReactDOM", 79 "react-dom/client": "window.ReactDOM", 80 "react/jsx-runtime": "window.__jsxRuntime", 81 "react/jsx-dev-runtime": "window.__jsxRuntime", 82 "lucide-react": "window.lucide", 83 }; 84 if (moduleMap[moduleName]) { 85 var mod = moduleMap[moduleName](); 86 if (mod) return mod; 87 var globalName = globalNames[moduleName] || "unknown global"; 88 throw new Error( 89 'Module "' + 90 moduleName + 91 '" not found: ' + 92 globalName + 93 " is undefined. Ensure core.js loads before other bundles." 94 ); 95 } 96 throw new Error( 97 "Module not found: " + 98 moduleName + 99 ". Expected one of: " + 100 Object.keys(moduleMap).join(", ") 101 ); 102 }; 103 var require = window.require; 104 105 function applyDarkMode(darkMode) { 106 if (darkMode) { 107 document.body.classList.add("dark"); 108 } else { 109 document.body.classList.remove("dark"); 110 } 111 applyColorScheme(darkMode); 112 } 113 114 function applyTransparentSurface(transparent) { 115 if (transparent) { 116 document.body.classList.add("transparent-surface"); 117 } else { 118 document.body.classList.remove("transparent-surface"); 119 } 120 } 121 122 // Host-computed faux backdrop for transparent surfaces (see 123 // body.transparent-surface::before in iframe-base.css). 124 function applySurfaceBackdrop(value) { 125 if (typeof value === "string" && value) { 126 document.body.style.setProperty("--host-surface-backdrop", value); 127 } else { 128 document.body.style.removeProperty("--host-surface-backdrop"); 129 } 130 } 131 132 function updateRuntimeConfig(nextConfig, eventOrigin) { 133 if (!nextConfig) return; 134 if (nextConfig.runtimeBaseUrl) runtimeBaseUrl = nextConfig.runtimeBaseUrl; 135 if (nextConfig.tailwindFilename) 136 tailwindFilename = nextConfig.tailwindFilename; 137 if (nextConfig.coreFilename) coreFilename = nextConfig.coreFilename; 138 if (nextConfig.uiBaseFilename) uiBaseFilename = nextConfig.uiBaseFilename; 139 if (nextConfig.sdkBridgeFilename) 140 sdkBridgeFilename = nextConfig.sdkBridgeFilename; 141 if (typeof nextConfig.darkMode === "boolean") { 142 applyDarkMode(nextConfig.darkMode); 143 } 144 if (typeof nextConfig.transparentSurface === "boolean") { 145 applyTransparentSurface(nextConfig.transparentSurface); 146 } 147 148 var resolvedOrigin = 149 nextConfig.parentOrigin || eventOrigin || expectedOrigin || "*"; 150 expectedOrigin = resolvedOrigin; 151 window.__PARENT_ORIGIN__ = resolvedOrigin; 152 } 153 154 function isTrustedEvent(event) { 155 if (event.source !== window.parent) return false;
156 if (!expectedOrigin || expectedOrigin === "*") return true; 157 return event.origin === expectedOrigin; 158 } 159 160 function runOverlayDismissFallbackHooks() { 161 var hookNames = ["__closeOverlays", "closeOverlays"]; 162 163 for (var i = 0; i < hookNames.length; i += 1) { 164 var hook = window[hookNames[i]]; 165 if (typeof hook !== "function") { 166 continue; 167 } 168 169 try { 170 hook(); 171 } catch (err) { 172 void err; 173 } 174 } 175 176 try { 177 window.dispatchEvent(new CustomEvent("__closeOverlays")); 178 } catch (err) { 179 void err; 180 } 181 } 182 183 window.dismissIframeOverlaysFallback = runOverlayDismissFallbackHooks; 184 185 function dismissIframeOverlays() { 186 try { 187 var root = document.body || document.documentElement; 188 if (root && typeof window.PointerEvent === "function") { 189 root.dispatchEvent( 190 new PointerEvent("pointerdown", { 191 bubbles: true, 192 cancelable: true, 193 composed: true, 194 pointerType: "mouse", 195 button: 0, 196 buttons: 1, 197 }) 198 ); 199 } 200 201 var escapeEventInit = { 202 key: "Escape", 203 code: "Escape", 204 bubbles: true, 205 cancelable: true, 206 }; 207 document.dispatchEvent(new KeyboardEvent("keydown", escapeEventInit)); 208 document.dispatchEvent(new KeyboardEvent("keyup", escapeEventInit)); 209 210 // Synthetic events are always emitted with isTrusted === false, so overlay 211 // libraries that guard on trusted user input may ignore them. Fire a small 212 // best-effort fallback hook for runtime authors that opt into explicit close 213 // handlers instead of relying only on pointer or keyboard dismissal. 214 runOverlayDismissFallbackHooks(); 215 } catch (err) { 216 void err; 217 } 218 } 219 220 // Clicking outside an iframe won't emit pointer events inside its document. 221 // Dismiss overlays on blur to match "outside click closes" user expectations. 222 window.addEventListener("blur", function () { 223 dismissIframeOverlays(); 224 }); 225 226 function isCaptureShortcut(event) { 227 return ( 228 event.key === "Enter" && 229 event.shiftKey && 230 (event.metaKey || event.ctrlKey) 231 ); 232 } 233 234 function isEditableTarget(target) { 235 if (!(target instanceof Element)) return false; 236 if (target.isContentEditable) return true; 237 238 var tagName = target.tagName; 239 if (tagName === "TEXTAREA") return true; 240 if (tagName !== "INPUT") return false; 241 242 var typeAttr = target.getAttribute("type"); 243 var inputType = 244 typeof typeAttr === "string" ? typeAttr.toLowerCase() : "text"; 245 return ![ 246 "button", 247 "checkbox", 248 "color", 249 "file", 250 "hidden", 251 "image", 252 "radio", 253 "range", 254 "reset", 255 "submit", 256 ].includes(inputType); 257 } 258 259 window.addEventListener("keydown", function (event) { 260 if (!event.isTrusted || event.defaultPrevented) return; 261 if (!isCaptureShortcut(event)) return; 262 if (isEditableTarget(event.target)) return; 263 264 event.preventDefault(); 265 var targetOrigin = window.__PARENT_ORIGIN__ || "*"; 266 window.parent.postMessage({ type: "app-capture-shortcut" }, targetOrigin); 267 }); 268 269 // Console interception 270 (function () { 271 var originalConsole = { 272 log: console.log.bind(console), 273 warn: console.warn.bind(console), 274 error: console.error.bind(console), 275 info: console.info.bind(console), 276 }; 277 278 function stringify(arg) { 279 if (arg === undefined) return "undefined"; 280 if (arg === null) return "null"; 281 if (typeof arg === "bigint") return arg.toString() + "n"; 282 if (typeof arg === "function") return "[Function]"; 283 if (arg instanceof Error) return arg.stack || arg.message || String(arg); 284 if (typeof arg === "object") { 285 try { 286 var seen = new WeakSet(); 287 return JSON.stringify( 288 arg, 289 function (key, value) { 290 if (typeof value === "object" && value !== null) { 291 if (seen.has(value)) return "[Circular]"; 292 seen.add(value); 293 } 294 if (typeof value === "function") return "[Function]"; 295 return value; 296 }, 297 2 298 ); 299 } catch (e) { 300 try { 301 return Object.prototype.toString.call(arg); 302 } catch (e2) { 303 return "[Object]"; 304 } 305 } 306 } 307 return String(arg); 308 } 309 310 ["log", "warn", "error", "info"].forEach(function (method) { 311 console[method] = function () { 312 originalConsole[method].apply(console, arguments); 313 var args = Array.prototype.slice.call(arguments).map(stringify); 314 var targetOrigin = window.__PARENT_ORIGIN__; 315 window.parent.postMessage( 316 { 317 type: "console", 318 level: method, 319 args: args, 320 timestamp: Date.now(), 321 }, 322 targetOrigin 323 ); 324 }; 325 }); 326 327 function postToParent(message) { 328 window.parent.postMessage(message, window.__PARENT_ORIGIN__); 329 } 330 331 function postRuntimeLog(level, text) { 332 postToParent({ 333 type: "console", 334 level: level, 335 args: [text], 336 timestamp: Date.now(), 337 }); 338 } 339
340 // Two different things arrive on the window "error" channel, and only one 341 // of them means the app is broken: 342 // 343 // - failures: uncaught exceptions the app cannot recover from. These 344 // become `sdk-error`, which puts the app into a visible error state and 345 // offers the user a way out. 346 // - advisories: events the platform reports through the same channel to 347 // say it deferred or declined work that has no consequence for the app. 348 // These belong in the app log, where an author debugging a layout can 349 // still find them, and nowhere near the user's error state. 350 // 351 // The distinction has to be made here, at the boundary. Everything 352 // downstream - the app log, the error surface, "fix with AI" - trusts 353 // `sdk-error` to mean something is actually wrong, so a channel that raises 354 // advisories teaches people to ignore real failures. 355 // 356 // The only advisories browsers currently deliver this way are the 357 // ResizeObserver delivery notices. They fire when an observer callback 358 // changes layout, so the browser finishes the rest on the next frame - 359 // ordinary behavior for resizable panels and charts while the app is being 360 // resized. Their message text is the only signal the platform exposes; 361 // Sentry classifies the identical strings the same way. 362 // 363 // Matched as an exact prefix: the browser delivers these messages bare, 364 // while an app-thrown error mentioning the same words arrives prefixed 365 // ("Uncaught Error: ...") and must still raise a real failure. 366 var BROWSER_ADVISORY_MESSAGES = [ 367 "ResizeObserver loop limit exceeded", 368 "ResizeObserver loop completed with undelivered notifications", 369 ]; 370 371 function isBrowserAdvisory(message) { 372 for (var i = 0; i < BROWSER_ADVISORY_MESSAGES.length; i += 1) { 373 if (message.indexOf(BROWSER_ADVISORY_MESSAGES[i]) === 0) { 374 return true; 375 } 376 } 377 return false; 378 } 379 380 function reportRuntimeFailure(text, stack) { 381 postRuntimeLog("error", text); 382 postToParent({ 383 type: "sdk-error", 384 error: stack ? { message: text, stack: stack } : { message: text }, 385 }); 386 } 387 388 window.addEventListener("error", function (event) { 389 var message = typeof event.message === "string" ? event.message : ""; 390 var errorMsg = 391 message + 392 (event.filename ? " at " + event.filename + ":" + event.lineno : ""); 393 if (isBrowserAdvisory(message)) { 394 postRuntimeLog("warn", errorMsg); 395 return; 396 } 397 var stack = 398 event.error && typeof event.error.stack === "string" 399 ? event.error.stack 400 : undefined; 401 reportRuntimeFailure(errorMsg, stack); 402 }); 403 404 window.addEventListener("unhandledrejection", function (event) { 405 var reason = event.reason;
406 var message = reason instanceof Error ? reason.message : String(reason); 407 var stack = 408 reason instanceof Error && typeof reason.stack === "string" 409 ? reason.stack 410 : undefined; 411 reportRuntimeFailure("Unhandled Promise Rejection: " + message, stack); 412 }); 413 })(); 414 415 var inlineBaseScripts = null; 416 417 function runInlineScript(label, source) { 418 if (typeof source !== "string" || source.length === 0) { 419 throw new Error("Missing inline runtime script: " + label); 420 } 421 (0, eval)(source); 422 } 423 424 function loadSdkBridge(renderMode) { 425 window.__sdkContext = window.__sdkContext || { 426 appId: null, 427 appName: null, 428 userId: null, 429 userName: null, 430 }; 431 if (renderMode === "website") { 432 return loadScript(runtimeBaseUrl + "/website-bridge.js"); 433 } 434 if (inlineBaseScripts && inlineBaseScripts.sdkBridge) { 435 return Promise.resolve().then(function () { 436 runInlineScript("sdkBridge", inlineBaseScripts.sdkBridge); 437 }); 438 } 439 return loadScript(runtimeBaseUrl + "/" + sdkBridgeFilename); 440 } 441 442 // Host display-state listeners (dark mode, faux surface backdrop) 443 window.addEventListener("message", function (event) { 444 if (!isTrustedEvent(event)) return; 445 if (event.data && event.data.type === "snow-replay-control") { 446 if ( 447 !window.__SDK_SESSION_TOKEN__ || 448 event.data.sessionToken !== window.__SDK_SESSION_TOKEN__ 449 ) return; 450 replayControl = event.data; 451 if (window.__SNOW_REPLAY_CONTROL__) { 452 window.__SNOW_REPLAY_CONTROL__(replayControl); 453 } else if ( 454 replayControl.epoch && 455 typeof replayControl.scriptUrl === "string" && 456 replayControl.scriptUrl.indexOf(runtimeBaseUrl + "/replay-recorder.") === 0 && 457 !replayScriptLoading 458 ) { 459 replayScriptLoading = true; 460 loadScript(replayControl.scriptUrl).then(function () { 461 if (window.__SNOW_REPLAY_CONTROL__) { 462 window.__SNOW_REPLAY_CONTROL__(replayControl); 463 } 464 }).catch(function () { 465 replayScriptLoading = false; 466 }); 467 } 468 return; 469 } 470 if (event.data && event.data.type === "set-dark-mode") { 471 applyDarkMode(!!event.data.darkMode); 472 } 473 if (event.data && event.data.type === "set-surface-backdrop") { 474 applySurfaceBackdrop(event.data.surfaceBackdrop); 475 } 476 }); 477 478 function showError(title, message) { 479 var rootEl = document.getElementById("root"); 480 rootEl.replaceChildren(); 481 482 var container = document.createElement("div"); 483 container.className = "app-error-container"; 484 485 var titleEl = document.createElement("div"); 486 titleEl.className = "app-error-title"; 487 titleEl.textContent = title; 488 489 var messageEl = document.createElement("pre"); 490 messageEl.className = "app-error-message"; 491 messageEl.textContent = message; 492 493 container.appendChild(titleEl); 494 container.appendChild(messageEl); 495 rootEl.appendChild(container); 496 } 497 498 function reportError(message, stack) { 499 var targetOrigin = window.__PARENT_ORIGIN__; 500 window.parent.postMessage( 501 { 502 type: "sdk-error", 503 error: { message: message || "Unknown error", stack: stack }, 504 }, 505 targetOrigin 506 ); 507 } 508 509 function reportStep(step) { 510 var targetOrigin = window.__PARENT_ORIGIN__; 511 window.parent.postMessage( 512 { type: "loading-step", step: step }, 513 targetOrigin 514 ); 515 } 516 517 function loadScript(src) { 518 return new Promise(function (resolve, reject) { 519 var script = document.createElement("script"); 520 script.src = src; 521 script.onload = function () { 522 resolve(); 523 }; 524 script.onerror = function () { 525 reject(new Error("Failed to load script: " + src)); 526 }; 527 document.head.appendChild(script); 528 }); 529 } 530 531 var TAILWIND_INPUT = `@import "tailwindcss"; 532 533/* 534 * Pre-generate overlay enter/exit utilities at the initial compile. 535 * 536 * @tailwindcss/browser compiles utilities lazily: a class's CSS is only 537 * emitted once that class first appears in the DOM, and the rebuild runs 538 * asynchronously via a MutationObserver. The drawer/dialog/sheet enter 539 * animation is a CSS transition/animation that needs its rule present at 540 * the exact frame Base UI flips data-starting-style -> open. On the very 541 * first open these classes have never been in the DOM, so the rule does 542 * not exist yet and the surface snaps in with no animation; every later 543 * open is fine because the rule was generated on that first appearance. 544 * Safelisting the classes here forces them into the startup stylesheet so 545 * the first open animates like the rest. 546 */ 547@source inline("transition ease-in-out transition-opacity will-change-transform backdrop-blur-xs bg-black/25"); 548@source inline("duration-100 duration-300 duration-420 duration-500"); 549@source inline("data-open:animate-in data-closed:animate-out data-closed:fill-mode-forwards data-open:fade-in-0 data-closed:fade-out-0 data-open:zoom-in-95 data-closed:zoom-out-95");
550@source inline("data-open:slide-in-from-top data-closed:slide-out-to-top data-open:slide-in-from-bottom data-closed:slide-out-to-bottom data-open:slide-in-from-left data-closed:slide-out-to-left data-open:slide-in-from-right data-closed:slide-out-to-right"); 551@source inline("data-starting-style:opacity-0 data-ending-style:opacity-0 data-ending-style:pointer-events-none data-swiping:duration-0 data-swiping:[transition:none] ease-[cubic-bezier(0.32,0.72,0,1)] data-ending-style:duration-[calc(var(--drawer-swipe-strength)*360ms)] opacity-[calc(1-max(var(--drawer-swipe-progress,0),var(--drawer-nested-swipe-progress,0)))]"); 552@source inline("[transition:transform_420ms_cubic-bezier(0.32,0.72,0,1)] transform-[translate3d(0,var(--drawer-swipe-movement-y),0)] data-swiping:select-none data-swiping:duration-0 data-swiping:[transition:none] data-starting-style:transform-[translate3d(0,100%,0)] data-ending-style:transform-[translate3d(0,100%,0)] data-ending-style:duration-[calc(var(--drawer-swipe-strength)*360ms)]"); 553 554@custom-variant dark (&:where(.dark, .dark *)); 555 556@layer base { 557 *, ::before, ::after, ::backdrop, ::file-selector-button { 558 border-color: var(--border); 559 } 560} 561 562@theme inline { 563 --color-background: var(--background); 564 --color-foreground: var(--foreground); 565 --color-card: var(--card); 566 --color-card-foreground: var(--card-foreground); 567 --color-popover: var(--popover); 568 --color-popover-foreground: var(--popover-foreground); 569 --color-primary: var(--primary); 570 --color-primary-foreground: var(--primary-foreground); 571 --color-secondary: var(--secondary); 572 --color-secondary-foreground: var(--secondary-foreground); 573 --color-muted: var(--muted); 574 --color-muted-foreground: var(--muted-foreground); 575 --color-accent: var(--accent); 576 --color-accent-foreground: var(--accent-foreground); 577 --color-destructive: var(--destructive); 578 --color-destructive-foreground: var(--destructive-foreground); 579 --color-success: var(--success); 580 --color-success-muted: var(--success-muted); 581 --color-success-soft: var(--success-soft); 582 --color-success-soft-hover: var(--success-soft-hover); 583 --color-success-outline: var(--success-outline); 584 --color-success-solid: var(--success-solid); 585 --color-success-solid-hover: var(--success-solid-hover); 586 --color-on-success: var(--on-success); 587 --color-warning: var(--warning); 588 --color-warning-muted: var(--warning-muted); 589 --color-warning-soft: var(--warning-soft); 590 --color-warning-soft-hover: var(--warning-soft-hover); 591 --color-warning-outline: var(--warning-outline); 592 --color-warning-solid: var(--warning-solid); 593 --color-warning-solid-hover: var(--warning-solid-hover); 594 --color-on-warning: var(--on-warning); 595 --color-error: var(--error); 596 --color-error-muted: var(--error-muted); 597 --color-error-soft: var(--error-soft); 598 --color-error-soft-hover: var(--error-soft-hover); 599 --color-error-outline: var(--error-outline); 600 --color-error-solid: var(--error-solid); 601 --color-error-solid-hover: var(--error-solid-hover); 602 --color-on-error: var(--on-error); 603 --color-info: var(--info); 604 --color-info-muted: var(--info-muted); 605 --color-info-soft: var(--info-soft); 606 --color-info-soft-hover: var(--info-soft-hover); 607 --color-info-outline: var(--info-outline); 608 --color-info-solid: var(--info-solid); 609 --color-info-solid-hover: var(--info-solid-hover); 610 --color-on-info: var(--on-info); 611 --color-border: var(--border); 612 --color-input: var(--input); 613 --color-ring: var(--ring); 614 --color-surface: var(--surface); 615 --color-surface-raised: var(--surface-raised); 616 --color-surface-overlay: var(--surface-overlay); 617 --color-chart-1: var(--chart-1); 618 --color-chart-2: var(--chart-2); 619 --color-chart-3: var(--chart-3); 620 --color-chart-4: var(--chart-4); 621 --color-chart-5: var(--chart-5); 622 --color-sidebar: var(--sidebar); 623 --color-sidebar-foreground: var(--sidebar-foreground); 624 --color-sidebar-primary: var(--sidebar-primary); 625 --color-sidebar-primary-foreground: var(--sidebar-primary-foreground); 626 --color-sidebar-accent: var(--sidebar-accent); 627 --color-sidebar-accent-foreground: var(--sidebar-accent-foreground); 628 --color-sidebar-border: var(--sidebar-border); 629 --color-sidebar-ring: var(--sidebar-ring); 630 --color-form-control: var(--form-control-bg); 631 --color-form-control-hover: var(--form-control-bg-hover); 632 --color-dropdown: var(--dropdown-bg); 633 --color-dropdown-item-hover: var(--popover-item-hover); 634 635 --font-sans: var(--font-sans); 636 --font-mono: var(--font-mono); 637 --font-serif: var(--font-serif); 638 639 --radius-none: 0; 640 --radius-sm: 0.25rem; 641 --radius-md: 0.5rem; 642 --radius-lg: 0.75rem; 643 --radius-xl: 1rem; 644 --radius-2xl: 1.25rem; 645 --radius-3xl: 1.5rem; 646 --radius-full: 9999px; 647 --radius: var(--radius-md); 648
649 --shadow-2xs: var(--shadow-2xs); 650 --shadow-xs: var(--shadow-xs); 651 --shadow-sm: var(--shadow-sm); 652 --shadow: var(--shadow); 653 --shadow-md: var(--shadow-md); 654 --shadow-lg: var(--shadow-lg); 655 --shadow-xl: var(--shadow-xl); 656 --shadow-2xl: var(--shadow-2xl); 657 658 --tracking-tighter: calc(var(--tracking-normal) - 0.05em); 659 --tracking-tight: calc(var(--tracking-normal) - 0.025em); 660 --tracking-wide: calc(var(--tracking-normal) + 0.025em); 661 --tracking-wider: calc(var(--tracking-normal) + 0.05em); 662 --tracking-widest: calc(var(--tracking-normal) + 0.1em); 663 664 --animation-delay-0: 0ms; 665 --animation-delay-75: 75ms; 666 --animation-delay-100: 100ms; 667 --animation-delay-150: 150ms; 668 --animation-delay-200: 200ms; 669 --animation-delay-300: 300ms; 670 --animation-delay-500: 500ms; 671 --animation-delay-700: 700ms; 672 --animation-delay-1000: 1000ms; 673 674 --animation-duration-0: 0ms; 675 --animation-duration-75: 75ms; 676 --animation-duration-100: 100ms; 677 --animation-duration-150: 150ms; 678 --animation-duration-200: 200ms; 679 --animation-duration-300: 300ms; 680 --animation-duration-500: 500ms; 681 --animation-duration-700: 700ms; 682 --animation-duration-1000: 1000ms; 683 684 --animation-opacity-0: 0; 685 --animation-opacity-5: 0.05; 686 --animation-opacity-10: 0.1; 687 --animation-opacity-20: 0.2; 688 --animation-opacity-25: 0.25; 689 --animation-opacity-30: 0.3; 690 --animation-opacity-40: 0.4; 691 --animation-opacity-50: 0.5; 692 --animation-opacity-60: 0.6; 693 --animation-opacity-70: 0.7; 694 --animation-opacity-75: 0.75; 695 --animation-opacity-80: 0.8; 696 --animation-opacity-90: 0.9; 697 --animation-opacity-95: 0.95; 698 --animation-opacity-100: 1; 699 700 --animation-translate-0: 0px; 701 --animation-translate-1: calc(var(--spacing) * 1); 702 --animation-translate-2: calc(var(--spacing) * 2); 703 --animation-translate-3: calc(var(--spacing) * 3); 704 --animation-translate-4: calc(var(--spacing) * 4); 705 --animation-translate-5: calc(var(--spacing) * 5); 706 --animation-translate-6: calc(var(--spacing) * 6); 707 --animation-translate-8: calc(var(--spacing) * 8); 708 --animation-translate-10: calc(var(--spacing) * 10); 709 --animation-translate-12: calc(var(--spacing) * 12); 710 --animation-translate-16: calc(var(--spacing) * 16); 711 --animation-translate-20: calc(var(--spacing) * 20); 712 --animation-translate-24: calc(var(--spacing) * 24); 713 --animation-translate-28: calc(var(--spacing) * 28); 714 --animation-translate-32: calc(var(--spacing) * 32); 715 --animation-translate-36: calc(var(--spacing) * 36); 716 --animation-translate-40: calc(var(--spacing) * 40); 717 --animation-translate-44: calc(var(--spacing) * 44); 718 --animation-translate-48: calc(var(--spacing) * 48); 719 --animation-translate-52: calc(var(--spacing) * 52); 720 --animation-translate-56: calc(var(--spacing) * 56); 721 --animation-translate-60: calc(var(--spacing) * 60); 722 --animation-translate-64: calc(var(--spacing) * 64); 723 --animation-translate-72: calc(var(--spacing) * 72); 724 --animation-translate-80: calc(var(--spacing) * 80); 725 --animation-translate-96: calc(var(--spacing) * 96); 726 --animation-translate-1_2: 50%; 727 --animation-translate-1_3: 33.333333%; 728 --animation-translate-2_3: 66.666667%; 729 --animation-translate-1_4: 25%; 730 --animation-translate-3_4: 75%; 731 --animation-translate-full: 100%; 732 733 --animation-scale-0: 0; 734 --animation-scale-50: 0.5; 735 --animation-scale-75: 0.75; 736 --animation-scale-90: 0.9; 737 --animation-scale-95: 0.95; 738 --animation-scale-100: 1; 739 --animation-scale-105: 1.05; 740 --animation-scale-110: 1.1; 741 --animation-scale-125: 1.25; 742 --animation-scale-150: 1.5; 743 744 --animation-rotate-0: 0deg; 745 --animation-rotate-1: 1deg; 746 --animation-rotate-2: 2deg; 747 --animation-rotate-3: 3deg; 748 --animation-rotate-6: 6deg; 749 --animation-rotate-12: 12deg; 750 --animation-rotate-45: 45deg; 751 --animation-rotate-90: 90deg; 752 --animation-rotate-180: 180deg; 753 754 --animation-repeat-0: 0; 755 --animation-repeat-1: 1; 756 --animation-repeat-infinite: infinite; 757 758 --animation-ease-linear: linear; 759 --animation-ease-in: cubic-bezier(0.4, 0, 1, 1); 760 --animation-ease-out: cubic-bezier(0, 0, 0.2, 1); 761 --animation-ease-in-out: cubic-bezier(0.4, 0, 0.2, 1); 762 763 --animation-fill-mode-none: none; 764 --animation-fill-mode-forwards: forwards; 765 --animation-fill-mode-backwards: backwards; 766 --animation-fill-mode-both: both; 767 768 --animation-direction-normal: normal; 769 --animation-direction-reverse: reverse; 770 --animation-direction-alternate: alternate; 771 --animation-direction-alternate-reverse: alternate-reverse; 772} 773 774body { 775 letter-spacing: var(--tracking-normal); 776} 777 778@keyframes enter { 779 from { 780 opacity: var(--tw-enter-opacity, 1); 781 transform: translate3d(var(--tw-enter-translate-x, 0), var(--tw-enter-translate-y, 0), 0) 782 scale3d(var(--tw-enter-scale, 1), var(--tw-enter-scale, 1), var(--tw-enter-scale, 1)) 783 rotate(var(--tw-enter-rotate, 0)); 784 } 785} 786 787@keyframes exit { 788 to { 789 opacity: var(--tw-exit-opacity, 1); 790 transform: translate3d(var(--tw-exit-translate-x, 0), var(--tw-exit-translate-y, 0), 0) 791 scale3d(var(--tw-exit-scale, 1), var(--tw-exit-scale, 1), var(--tw-exit-scale, 1)) 792 rotate(var(--tw-exit-rotate, 0)); 793 } 794} 795 796@utility animate-in { 797 animation-name: enter; 798 animation-duration: 150ms; 799 --tw-enter-opacity: initial; 800 --tw-enter-scale: initial; 801 --tw-enter-rotate: initial; 802 --tw-enter-translate-x: initial; 803 --tw-enter-translate-y: initial; 804} 805 806@utility animate-out { 807 animation-name: exit; 808 animation-duration: 150ms; 809 animation-fill-mode: forwards; 810 --tw-exit-opacity: initial; 811 --tw-exit-scale: initial; 812 --tw-exit-rotate: initial; 813 --tw-exit-translate-x: initial; 814 --tw-exit-translate-y: initial; 815} 816 817@utility fade-in { 818 --tw-enter-opacity: 0; 819} 820 821@utility fade-out { 822 --tw-exit-opacity: 0; 823} 824 825@utility fade-in-* { 826 --tw-enter-opacity: --value(--animation-opacity-*); 827} 828 829@utility fade-out-* { 830 --tw-exit-opacity: --value(--animation-opacity-*); 831} 832 833@utility zoom-in { 834 --tw-enter-scale: 0; 835} 836 837@utility zoom-out { 838 --tw-exit-scale: 0; 839} 840 841@utility zoom-in-* { 842 --tw-enter-scale: --value(--animation-scale-*); 843} 844 845@utility zoom-out-* { 846 --tw-exit-scale: --value(--animation-scale-*); 847} 848 849@utility spin-in { 850 --tw-enter-rotate: 30deg; 851} 852 853@utility spin-out { 854 --tw-exit-rotate: 30deg; 855} 856 857@utility spin-in-* { 858 --tw-enter-rotate: --value(--animation-rotate-*); 859} 860 861@utility spin-out-* { 862 --tw-exit-rotate: --value(--animation-rotate-*); 863} 864 865@utility slide-in-from-top { 866 --tw-enter-translate-y: -100%; 867} 868 869@utility slide-in-from-bottom { 870 --tw-enter-translate-y: 100%; 871} 872 873@utility slide-in-from-left { 874 --tw-enter-translate-x: -100%; 875} 876 877@utility slide-in-from-right { 878 --tw-enter-translate-x: 100%; 879} 880 881@utility slide-in-from-top-* { 882 --tw-enter-translate-y: calc(-1 * --value(--animation-translate-*)); 883} 884 885@utility slide-in-from-bottom-* { 886 --tw-enter-translate-y: --value(--animation-translate-*); 887} 888 889@utility slide-in-from-left-* { 890 --tw-enter-translate-x: calc(-1 * --value(--animation-translate-*)); 891} 892 893@utility slide-in-from-right-* { 894 --tw-enter-translate-x: --value(--animation-translate-*); 895} 896 897@utility slide-out-to-top { 898 --tw-exit-translate-y: -100%; 899} 900 901@utility slide-out-to-bottom { 902 --tw-exit-translate-y: 100%; 903} 904 905@utility slide-out-to-left { 906 --tw-exit-translate-x: -100%; 907} 908 909@utility slide-out-to-right { 910 --tw-exit-translate-x: 100%; 911} 912 913@utility slide-out-to-top-* { 914 --tw-exit-translate-y: calc(-1 * --value(--animation-translate-*)); 915} 916 917@utility slide-out-to-bottom-* { 918 --tw-exit-translate-y: --value(--animation-translate-*); 919} 920 921@utility slide-out-to-left-* { 922 --tw-exit-translate-x: calc(-1 * --value(--animation-translate-*)); 923} 924 925@utility slide-out-to-right-* { 926 --tw-exit-translate-x: --value(--animation-translate-*); 927} 928 929@utility duration-* { 930 animation-duration: --value(--animation-duration-*); 931} 932 933@utility delay-* { 934 animation-delay: --value(--animation-delay-*); 935} 936 937@utility ease-* { 938 animation-timing-function: --value(--animation-ease-*); 939} 940 941@utility fill-mode-* {
942 animation-fill-mode: --value(--animation-fill-mode-*); 943} 944 945@utility direction-* { 946 animation-direction: --value(--animation-direction-*); 947} 948 949@utility repeat-* { 950 animation-iteration-count: --value(--animation-repeat-*); 951} 952 953@utility running { 954 animation-play-state: running; 955} 956 957@utility paused { 958 animation-play-state: paused; 959}`; 960 961 function ensureTailwindInput() { 962 if (document.querySelector('style[type="text/tailwindcss"]')) { 963 return; 964 } 965 var style = document.createElement("style"); 966 style.type = "text/tailwindcss"; 967 style.textContent = TAILWIND_INPUT; 968 document.head.appendChild(style); 969 } 970 971 function injectBaseIcons() { 972 var existingLucide = window.lucide; 973 if (existingLucide) { 974 var existingX = Object.getOwnPropertyDescriptor(existingLucide, "X"); 975 if ( 976 (existingX && !existingX.writable && !existingX.set) || 977 !Object.isExtensible(existingLucide) 978 ) { 979 return; 980 } 981 } 982 window.lucide = window.lucide || {}; 983 984 window.lucide.X = function X(props) { 985 return React.createElement( 986 "svg", 987 Object.assign( 988 { 989 xmlns: "http://www.w3.org/2000/svg", 990 width: 24, 991 height: 24,
992 viewBox: "0 0 24 24", 993 fill: "none", 994 stroke: "currentColor", 995 strokeWidth: 2, 996 strokeLinecap: "round", 997 strokeLinejoin: "round", 998 }, 999 props 1000 ), 1001 React.createElement("path", { d: "M18 6 6 18" }), 1002 React.createElement("path", { d: "m6 6 12 12" }) 1003 ); 1004 }; 1005 1006 window.lucide.Check = function Check(props) { 1007 return React.createElement( 1008 "svg", 1009 Object.assign( 1010 { 1011 xmlns: "http://www.w3.org/2000/svg", 1012 width: 24, 1013 height: 24, 1014 viewBox: "0 0 24 24", 1015 fill: "none", 1016 stroke: "currentColor", 1017 strokeWidth: 2, 1018 strokeLinecap: "round", 1019 strokeLinejoin: "round", 1020 }, 1021 props 1022 ), 1023 React.createElement("path", { d: "M20 6 9 17l-5-5" }) 1024 ); 1025 }; 1026 1027 window.lucide.ChevronDown = function ChevronDown(props) { 1028 return React.createElement( 1029 "svg", 1030 Object.assign( 1031 { 1032 xmlns: "http://www.w3.org/2000/svg", 1033 width: 24, 1034 height: 24,
1035 viewBox: "0 0 24 24", 1036 fill: "none", 1037 stroke: "currentColor", 1038 strokeWidth: 2, 1039 strokeLinecap: "round", 1040 strokeLinejoin: "round", 1041 }, 1042 props 1043 ), 1044 React.createElement("path", { d: "m6 9 6 6 6-6" }) 1045 ); 1046 }; 1047 1048 window.lucide.ChevronUp = function ChevronUp(props) { 1049 return React.createElement( 1050 "svg", 1051 Object.assign( 1052 { 1053 xmlns: "http://www.w3.org/2000/svg", 1054 width: 24, 1055 height: 24, 1056 viewBox: "0 0 24 24", 1057 fill: "none", 1058 stroke: "currentColor", 1059 strokeWidth: 2, 1060 strokeLinecap: "round", 1061 strokeLinejoin: "round", 1062 }, 1063 props 1064 ), 1065 React.createElement("path", { d: "m18 15-6-6-6 6" }) 1066 ); 1067 }; 1068 1069 window.lucide.ChevronLeft = function ChevronLeft(props) { 1070 return React.createElement( 1071 "svg", 1072 Object.assign( 1073 { 1074 xmlns: "http://www.w3.org/2000/svg", 1075 width: 24, 1076 height: 24,
1077 viewBox: "0 0 24 24", 1078 fill: "none", 1079 stroke: "currentColor", 1080 strokeWidth: 2, 1081 strokeLinecap: "round", 1082 strokeLinejoin: "round", 1083 }, 1084 props 1085 ), 1086 React.createElement("path", { d: "m15 18-6-6 6-6" }) 1087 ); 1088 }; 1089 1090 window.lucide.ChevronRight = function ChevronRight(props) { 1091 return React.createElement( 1092 "svg", 1093 Object.assign( 1094 { 1095 xmlns: "http://www.w3.org/2000/svg", 1096 width: 24, 1097 height: 24, 1098 viewBox: "0 0 24 24", 1099 fill: "none", 1100 stroke: "currentColor", 1101 strokeWidth: 2, 1102 strokeLinecap: "round", 1103 strokeLinejoin: "round", 1104 }, 1105 props 1106 ), 1107 React.createElement("path", { d: "m9 18 6-6-6-6" }) 1108 ); 1109 }; 1110 1111 window.lucide.Circle = function Circle(props) { 1112 return React.createElement( 1113 "svg", 1114 Object.assign( 1115 { 1116 xmlns: "http://www.w3.org/2000/svg", 1117 width: 24, 1118 height: 24,
1119 viewBox: "0 0 24 24", 1120 fill: "none", 1121 stroke: "currentColor", 1122 strokeWidth: 2, 1123 strokeLinecap: "round", 1124 strokeLinejoin: "round", 1125 }, 1126 props 1127 ), 1128 React.createElement("circle", { cx: "12", cy: "12", r: "10" }) 1129 ); 1130 }; 1131 1132 window.lucide.MoreHorizontal = function MoreHorizontal(props) { 1133 return React.createElement( 1134 "svg", 1135 Object.assign( 1136 { 1137 xmlns: "http://www.w3.org/2000/svg", 1138 width: 24, 1139 height: 24, 1140 viewBox: "0 0 24 24", 1141 fill: "none", 1142 stroke: "currentColor", 1143 strokeWidth: 2, 1144 strokeLinecap: "round", 1145 strokeLinejoin: "round", 1146 }, 1147 props 1148 ), 1149 React.createElement("circle", { cx: "12", cy: "12", r: "1" }), 1150 React.createElement("circle", { cx: "19", cy: "12", r: "1" }), 1151 React.createElement("circle", { cx: "5", cy: "12", r: "1" }) 1152 ); 1153 }; 1154 1155 window.lucide.Search = function Search(props) { 1156 return React.createElement( 1157 "svg", 1158 Object.assign( 1159 { 1160 xmlns: "http://www.w3.org/2000/svg", 1161 width: 24, 1162 height: 24,
1163 viewBox: "0 0 24 24", 1164 fill: "none", 1165 stroke: "currentColor", 1166 strokeWidth: 2, 1167 strokeLinecap: "round", 1168 strokeLinejoin: "round", 1169 }, 1170 props 1171 ), 1172 React.createElement("circle", { cx: "11", cy: "11", r: "8" }), 1173 React.createElement("path", { d: "m21 21-4.3-4.3" }) 1174 ); 1175 }; 1176 1177 window.lucide.ArrowLeft = function ArrowLeft(props) { 1178 return React.createElement( 1179 "svg", 1180 Object.assign( 1181 { 1182 xmlns: "http://www.w3.org/2000/svg", 1183 width: 24, 1184 height: 24, 1185 viewBox: "0 0 24 24", 1186 fill: "none", 1187 stroke: "currentColor", 1188 strokeWidth: 2, 1189 strokeLinecap: "round", 1190 strokeLinejoin: "round", 1191 }, 1192 props 1193 ), 1194 React.createElement("path", { d: "m12 19-7-7 7-7" }), 1195 React.createElement("path", { d: "M19 12H5" }) 1196 ); 1197 }; 1198 1199 window.lucide.ArrowRight = function ArrowRight(props) { 1200 return React.createElement( 1201 "svg", 1202 Object.assign( 1203 { 1204 xmlns: "http://www.w3.org/2000/svg", 1205 width: 24, 1206 height: 24,
1207 viewBox: "0 0 24 24", 1208 fill: "none", 1209 stroke: "currentColor", 1210 strokeWidth: 2, 1211 strokeLinecap: "round", 1212 strokeLinejoin: "round", 1213 }, 1214 props 1215 ), 1216 React.createElement("path", { d: "M5 12h14" }), 1217 React.createElement("path", { d: "m12 5 7 7-7 7" }) 1218 ); 1219 }; 1220 1221 window.lucide.Calendar = function Calendar(props) { 1222 return React.createElement( 1223 "svg", 1224 Object.assign( 1225 { 1226 xmlns: "http://www.w3.org/2000/svg", 1227 width: 24, 1228 height: 24, 1229 viewBox: "0 0 24 24", 1230 fill: "none", 1231 stroke: "currentColor", 1232 strokeWidth: 2, 1233 strokeLinecap: "round", 1234 strokeLinejoin: "round", 1235 }, 1236 props 1237 ), 1238 React.createElement("path", { 1239 d: "M8 2v4", 1240 }), 1241 React.createElement("path", { 1242 d: "M16 2v4", 1243 }), 1244 React.createElement("rect", { 1245 width: "18", 1246 height: "18", 1247 x: "3", 1248 y: "4", 1249 rx: "2", 1250 }), 1251 React.createElement("path", { 1252 d: "M3 10h18", 1253 }) 1254 ); 1255 }; 1256 1257 window.lucide.CircleCheck = function CircleCheck(props) { 1258 return React.createElement( 1259 "svg", 1260 Object.assign( 1261 { 1262 xmlns: "http://www.w3.org/2000/svg", 1263 width: 24, 1264 height: 24,
1265 viewBox: "0 0 24 24", 1266 fill: "none", 1267 stroke: "currentColor", 1268 strokeWidth: 2, 1269 strokeLinecap: "round", 1270 strokeLinejoin: "round", 1271 }, 1272 props 1273 ), 1274 React.createElement("circle", { cx: "12", cy: "12", r: "10" }), 1275 React.createElement("path", { d: "m9 12 2 2 4-4" }) 1276 ); 1277 }; 1278 1279 window.lucide.Info = function Info(props) { 1280 return React.createElement( 1281 "svg", 1282 Object.assign( 1283 { 1284 xmlns: "http://www.w3.org/2000/svg", 1285 width: 24, 1286 height: 24, 1287 viewBox: "0 0 24 24", 1288 fill: "none", 1289 stroke: "currentColor", 1290 strokeWidth: 2, 1291 strokeLinecap: "round", 1292 strokeLinejoin: "round", 1293 }, 1294 props 1295 ), 1296 React.createElement("circle", { cx: "12", cy: "12", r: "10" }), 1297 React.createElement("path", { d: "M12 16v-4" }), 1298 React.createElement("path", { d: "M12 8h.01" }) 1299 ); 1300 }; 1301 1302 window.lucide.TriangleAlert = function TriangleAlert(props) { 1303 return React.createElement( 1304 "svg", 1305 Object.assign( 1306 { 1307 xmlns: "http://www.w3.org/2000/svg", 1308 width: 24, 1309 height: 24,
1310 viewBox: "0 0 24 24", 1311 fill: "none", 1312 stroke: "currentColor", 1313 strokeWidth: 2, 1314 strokeLinecap: "round", 1315 strokeLinejoin: "round", 1316 }, 1317 props 1318 ), 1319 React.createElement("path", { 1320 d: "m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3", 1321 }), 1322 React.createElement("path", { d: "M12 9v4" }), 1323 React.createElement("path", { d: "M12 17h.01" }) 1324 ); 1325 }; 1326 1327 window.lucide.OctagonX = function OctagonX(props) { 1328 return React.createElement( 1329 "svg", 1330 Object.assign( 1331 { 1332 xmlns: "http://www.w3.org/2000/svg", 1333 width: 24, 1334 height: 24, 1335 viewBox: "0 0 24 24", 1336 fill: "none", 1337 stroke: "currentColor", 1338 strokeWidth: 2, 1339 strokeLinecap: "round", 1340 strokeLinejoin: "round", 1341 }, 1342 props 1343 ), 1344 React.createElement("path", { d: "m15 9-6 6" }), 1345 React.createElement("path", { 1346 d: "M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z", 1347 }), 1348 React.createElement("path", { d: "m9 9 6 6" }) 1349 ); 1350 }; 1351 1352 window.lucide.Minus = function Minus(props) { 1353 return React.createElement( 1354 "svg", 1355 Object.assign( 1356 { 1357 xmlns: "http://www.w3.org/2000/svg", 1358 width: 24, 1359 height: 24,
1360 viewBox: "0 0 24 24", 1361 fill: "none", 1362 stroke: "currentColor", 1363 strokeWidth: 2, 1364 strokeLinecap: "round", 1365 strokeLinejoin: "round", 1366 }, 1367 props 1368 ), 1369 React.createElement("path", { d: "M5 12h14" }) 1370 ); 1371 }; 1372 1373 window.lucide.Dot = function Dot(props) { 1374 return React.createElement( 1375 "svg", 1376 Object.assign( 1377 { 1378 xmlns: "http://www.w3.org/2000/svg", 1379 width: 24, 1380 height: 24, 1381 viewBox: "0 0 24 24", 1382 fill: "none", 1383 stroke: "currentColor", 1384 strokeWidth: 2, 1385 strokeLinecap: "round", 1386 strokeLinejoin: "round", 1387 }, 1388 props 1389 ), 1390 React.createElement("circle", { cx: "12.1", cy: "12.1", r: "1" }) 1391 ); 1392 }; 1393 1394 window.lucide.GripVertical = function GripVertical(props) { 1395 return React.createElement( 1396 "svg", 1397 Object.assign( 1398 { 1399 xmlns: "http://www.w3.org/2000/svg", 1400 width: 24, 1401 height: 24,
1402 viewBox: "0 0 24 24", 1403 fill: "none", 1404 stroke: "currentColor", 1405 strokeWidth: 2, 1406 strokeLinecap: "round", 1407 strokeLinejoin: "round", 1408 }, 1409 props 1410 ), 1411 React.createElement("circle", { cx: "9", cy: "12", r: "1" }), 1412 React.createElement("circle", { cx: "9", cy: "5", r: "1" }), 1413 React.createElement("circle", { cx: "9", cy: "19", r: "1" }), 1414 React.createElement("circle", { cx: "15", cy: "12", r: "1" }), 1415 React.createElement("circle", { cx: "15", cy: "5", r: "1" }), 1416 React.createElement("circle", { cx: "15", cy: "19", r: "1" }) 1417 ); 1418 }; 1419 1420 window.lucide.PanelLeft = function PanelLeft(props) { 1421 return React.createElement( 1422 "svg", 1423 Object.assign( 1424 { 1425 xmlns: "http://www.w3.org/2000/svg", 1426 width: 24, 1427 height: 24, 1428 viewBox: "0 0 24 24", 1429 fill: "none", 1430 stroke: "currentColor", 1431 strokeWidth: 2, 1432 strokeLinecap: "round", 1433 strokeLinejoin: "round", 1434 }, 1435 props 1436 ), 1437 React.createElement("rect", { 1438 width: "18", 1439 height: "18", 1440 x: "3", 1441 y: "3", 1442 rx: "2", 1443 }), 1444 React.createElement("path", { d: "M9 3v18" }) 1445 ); 1446 }; 1447 1448 window.lucide.LoaderCircle = function LoaderCircle(props) { 1449 return React.createElement( 1450 "svg", 1451 Object.assign( 1452 { 1453 xmlns: "http://www.w3.org/2000/svg", 1454 width: 24, 1455 height: 24,
1456 viewBox: "0 0 24 24", 1457 fill: "none", 1458 stroke: "currentColor", 1459 strokeWidth: 2, 1460 strokeLinecap: "round", 1461 strokeLinejoin: "round", 1462 }, 1463 props 1464 ), 1465 React.createElement("path", { d: "M21 12a9 9 0 1 1-6.219-8.56" }) 1466 ); 1467 }; 1468 1469 window.lucide.CheckIcon = window.lucide.Check; 1470 window.lucide.ChevronUpIcon = window.lucide.ChevronUp; 1471 window.lucide.ChevronDownIcon = window.lucide.ChevronDown; 1472 window.lucide.ChevronLeftIcon = window.lucide.ChevronLeft; 1473 window.lucide.ChevronRightIcon = window.lucide.ChevronRight; 1474 window.lucide.CalendarIcon = window.lucide.Calendar; 1475 window.lucide.CircleIcon = window.lucide.Circle; 1476 window.lucide.CircleCheckIcon = window.lucide.CircleCheck; 1477 window.lucide.InfoIcon = window.lucide.Info; 1478 window.lucide.Loader2Icon = window.lucide.LoaderCircle; 1479 window.lucide.MinusIcon = window.lucide.Minus; 1480 window.lucide.MoreHorizontalIcon = window.lucide.MoreHorizontal; 1481 window.lucide.OctagonXIcon = window.lucide.OctagonX; 1482 window.lucide.PanelLeftIcon = window.lucide.PanelLeft; 1483 window.lucide.SearchIcon = window.lucide.Search; 1484 window.lucide.TriangleAlertIcon = window.lucide.TriangleAlert; 1485 window.lucide.XIcon = window.lucide.X; 1486 } 1487 1488 function attachSubComponents() { 1489 if (typeof window.__attachSubComponents === "function") { 1490 window.__attachSubComponents(); 1491 } 1492 if (window.ui) { 1493 Object.keys(window.ui).forEach(function (key) { 1494 if (/^[A-Z]/.test(key) && typeof window[key] === "undefined") { 1495 window[key] = window.ui[key]; 1496 } 1497 }); 1498 } 1499 } 1500 1501 function getErrorBoundary() { 1502 function ErrorBoundary(props) { 1503 React.Component.call(this, props); 1504 this.state = { hasError: false }; 1505 } 1506 ErrorBoundary.prototype = Object.create(React.Component.prototype); 1507 ErrorBoundary.prototype.constructor = ErrorBoundary; 1508 ErrorBoundary.getDerivedStateFromError = function () { 1509 return { hasError: true }; 1510 }; 1511 ErrorBoundary.prototype.componentDidCatch = function (error, errorInfo) { 1512 console.error("[App Error]", error, errorInfo); 1513 reportError(error.message, error.stack); 1514 }; 1515 ErrorBoundary.prototype.render = function () { 1516 if (this.state.hasError) { 1517 return null; 1518 } 1519 return this.props.children; 1520 }; 1521 return ErrorBoundary; 1522 } 1523 1524 function initApp(appCode, packageDeclarations, iconCode, renderMode) { 1525 try { 1526 if (typeof React === "undefined") { 1527 throw new Error("React not loaded. Runtime may have failed to load."); 1528 } 1529 if (typeof ReactDOM === "undefined") { 1530 throw new Error( 1531 "ReactDOM not loaded. Runtime may have failed to load." 1532 ); 1533 } 1534 1535 if (renderMode === "widget") { 1536 document.body.classList.add("widget-mode"); 1537 var widgetRoot = document.getElementById("root"); 1538 if (widgetRoot) { 1539 widgetRoot.style.minHeight = "0"; 1540 } 1541 document.body.style.minHeight = "0"; 1542 } 1543 1544 injectBaseIcons(); 1545 if (iconCode) { 1546 (0, eval)(iconCode); 1547 } 1548 1549 attachSubComponents(); 1550 1551 window.App = undefined; 1552 var fullCode = 1553 (packageDeclarations || "") + 1554 "\n" + 1555 appCode + 1556 '\nwindow.App = typeof App !== "undefined" ? App : window.App;'; 1557 (0, eval)(fullCode); 1558 1559 if (renderMode === "widget") { 1560 return; 1561 } 1562 1563 var AppComponent = window.App; 1564 if (!AppComponent) { 1565 throw new Error( 1566 'No App component found. Make sure your code defines a function named "App".' 1567 ); 1568 } 1569 1570 reportStep("Mounting components..."); 1571 var rootEl = document.getElementById("root"); 1572 rootEl.replaceChildren(); 1573 1574 var appContainer = document.createElement("div"); 1575 appContainer.id = "app-container"; 1576 rootEl.appendChild(appContainer); 1577 1578 var root = ReactDOM.createRoot(appContainer); 1579 var ErrorBoundary = getErrorBoundary(); 1580 root.render( 1581 React.createElement( 1582 ErrorBoundary, 1583 null, 1584 React.createElement(AppComponent) 1585 ) 1586 ); 1587 1588 if (!window.__hasPrefetch) { 1589 var targetOrigin = window.__PARENT_ORIGIN__; 1590 window.parent.postMessage({ type: "app-ready" }, targetOrigin); 1591 } else { 1592 reportStep("Fetching data..."); 1593 } 1594 } catch (error) { 1595 console.error("[Runtime] Failed to initialize app:", error); 1596 showError("Failed to initialize app", error.message || String(error)); 1597 reportError(error.message || String(error), error.stack); 1598 } 1599 } 1600 1601 var baseScriptsPromise = null; 1602 var initReceived = false;
1603 var anchorNavigationInstalled = false; 1604 1605 function installAnchorNavigation(renderMode) { 1606 if (anchorNavigationInstalled) return; 1607 anchorNavigationInstalled = true; 1608 1609 // Every surface runs at an internal runtime URL, so raw anchors cannot use 1610 // that document URL as their navigation base. Route website-local links 1611 // through the website router and send external links through the same 1612 // browser capability used by sdk.openExternal. 1613 document.addEventListener( 1614 "click", 1615 function (event) { 1616 if (event.defaultPrevented) return; 1617 if (event.button !== undefined && event.button !== 0) return; 1618 var anchor = event.target; 1619 while (anchor && anchor.tagName !== "A") { 1620 anchor = anchor.parentElement; 1621 } 1622 if (!anchor) return; 1623 if (anchor.hasAttribute("download")) return; 1624 var rawHref = anchor.getAttribute("href"); 1625 if (!rawHref || rawHref.charAt(0) === "#") return; 1626 1627 var target = 1628 anchor.getAttribute("target") === "_blank" || 1629 event.metaKey || 1630 event.ctrlKey || 1631 event.shiftKey 1632 ? "new-tab" 1633 : "current-tab"; 1634 1635 var isRelative = 1636 rawHref.indexOf("//") !== 0 && 1637 !/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(rawHref); 1638 if (renderMode === "website" && target === "current-tab") { 1639 var websiteRouteTarget = isRelative ? rawHref : null; 1640 if ( 1641 websiteRouteTarget && 1642 window.website && 1643 window.website.route && 1644 typeof window.website.route.path === "string" 1645 ) { 1646 try { 1647 var resolvedWebsiteRoute = new URL( 1648 websiteRouteTarget, 1649 "https://website.invalid" + window.website.route.path 1650 ); 1651 websiteRouteTarget = 1652 resolvedWebsiteRoute.pathname + 1653 resolvedWebsiteRoute.search + 1654 resolvedWebsiteRoute.hash; 1655 } catch (_) { 1656 websiteRouteTarget = null; 1657 } 1658 } 1659 if ( 1660 !websiteRouteTarget && 1661 window.__websiteContext && 1662 typeof window.__websiteContext.slug === "string" 1663 ) { 1664 try { 1665 var absoluteLink = new URL(rawHref); 1666 var parentUrl = new URL(window.__PARENT_ORIGIN__); 1667 var websitePrefix = 1668 "/s/" + encodeURIComponent(window.__websiteContext.slug); 1669 if ( 1670 absoluteLink.origin === parentUrl.origin && 1671 (absoluteLink.pathname === websitePrefix || 1672 absoluteLink.pathname.indexOf(websitePrefix + "/") === 0) 1673 ) { 1674 websiteRouteTarget = 1675 (absoluteLink.pathname.slice(websitePrefix.length) || "/") + 1676 absoluteLink.search + 1677 absoluteLink.hash; 1678 } 1679 } catch (_) { 1680 websiteRouteTarget = null; 1681 } 1682 } 1683 if ( 1684 websiteRouteTarget && 1685 window.website && 1686 typeof window.website.navigate === "function" 1687 ) { 1688 event.preventDefault(); 1689 window.website.navigate(websiteRouteTarget); 1690 return; 1691 } 1692 } 1693 1694 var href; 1695 try { 1696 var baseUrl = window.__PARENT_ORIGIN__; 1697 if ( 1698 renderMode === "website" && 1699 isRelative && 1700 window.__websiteContext && 1701 typeof window.__websiteContext.slug === "string" 1702 ) { 1703 var currentWebsitePath = 1704 window.website && window.website.route 1705 ? window.website.route.path 1706 : "/"; 1707 baseUrl = 1708 window.__PARENT_ORIGIN__ + 1709 "/s/" + 1710 encodeURIComponent(window.__websiteContext.slug) + 1711 currentWebsitePath; 1712 } 1713 href = new URL(rawHref, baseUrl).href; 1714 } catch (_) { 1715 return; 1716 } 1717 if (href.indexOf("http://") !== 0 && href.indexOf("https://") !== 0) 1718 return; 1719 if (!window.sdk || typeof window.sdk.openExternal !== "function") 1720 return; 1721 event.preventDefault(); 1722 window.sdk.openExternal(href, { target: target }).catch(function (error) { 1723 console.error(error); 1724 }); 1725 }, 1726 false 1727 ); 1728 } 1729 1730 function loadBaseScripts(renderMode) { 1731 if (baseScriptsPromise) return baseScriptsPromise; 1732 reportStep("Loading Tailwind + React..."); 1733 var loadTailwindAndCore; 1734 if (inlineBaseScripts) { 1735 // Legacy path for already-installed PWAs whose cached shell still sends 1736 // script text; removable once those shells have revalidated. 1737 loadTailwindAndCore = Promise.resolve().then(function () { 1738 ensureTailwindInput(); 1739 runInlineScript("tailwind", inlineBaseScripts.tailwind); 1740 runInlineScript("core", inlineBaseScripts.core); 1741 }); 1742 } else { 1743 ensureTailwindInput(); 1744 loadTailwindAndCore = Promise.all([ 1745 loadScript(runtimeBaseUrl + "/" + tailwindFilename), 1746 loadScript(runtimeBaseUrl + "/" + coreFilename), 1747 ]); 1748 } 1749 baseScriptsPromise = loadTailwindAndCore 1750 .then(function () { 1751 reportStep("Loading UI components..."); 1752 if (inlineBaseScripts) { 1753 runInlineScript("uiBase", inlineBaseScripts.uiBase); 1754 return; 1755 } 1756 return loadScript(runtimeBaseUrl + "/" + uiBaseFilename); 1757 }) 1758 .then(function () { 1759 return loadSdkBridge(renderMode); 1760 }) 1761 .then(function () { 1762 injectBaseIcons(); 1763 }); 1764 return baseScriptsPromise; 1765 } 1766 1767 function loadBundles(bundleUrls, bundleNames) { 1768 if (!bundleUrls || bundleUrls.length === 0) { 1769 return Promise.resolve(); 1770 } 1771 reportStep("Loading bundles (" + bundleNames + ")..."); 1772 return Promise.all( 1773 bundleUrls.map(function (url) { 1774 return loadScript(url); 1775 }) 1776 ); 1777 } 1778 1779 function sendRuntimeMessage(type, payload) { 1780 var targetOrigin = window.__PARENT_ORIGIN__ || "*"; 1781 var message = payload 1782 ? Object.assign({ type: type }, payload) 1783 : { type: type }; 1784 window.parent.postMessage(message, targetOrigin); 1785 } 1786 1787 // Clicking inside the iframe doesn't bubble to the host document, so the host can't 1788 // auto-dismiss its own popovers/menus. Emit a signal on pointerdown so the host can close them. 1789 document.addEventListener( 1790 "pointerdown", 1791 function (event) { 1792 if (event && event.isTrusted === false) return; 1793 sendRuntimeMessage("dismiss-host-overlays"); 1794 }, 1795 true 1796 ); 1797 1798 function getRuntimeConfigFromMessage(data) { 1799 return data && data.runtime ? data.runtime : data; 1800 } 1801 1802 function handleInitializeRuntime(data, eventOrigin) { 1803 var runtimeConfig = getRuntimeConfigFromMessage(data); 1804 updateRuntimeConfig(runtimeConfig, eventOrigin); 1805 inlineBaseScripts = data && data.baseScripts ? data.baseScripts : null; 1806 1807 loadBaseScripts() 1808 .then(function () { 1809 sendRuntimeMessage("warm-shell-ready"); 1810 }) 1811 .catch(function (error) { 1812 sendRuntimeMessage("warm-shell-error", { 1813 message: error.message || "Failed to load warm shell scripts", 1814 }); 1815 }); 1816 } 1817 1818 function handleInitializeApp(data, eventOrigin) { 1819 if (initReceived) return; 1820 initReceived = true; 1821 1822 try { 1823 var runtimeConfig = getRuntimeConfigFromMessage(data); 1824 updateRuntimeConfig(runtimeConfig, eventOrigin); 1825 inlineBaseScripts = data && data.baseScripts ? data.baseScripts : null; 1826 1827 if (data && data.context) { 1828 window.__sdkContext = data.context; 1829 } 1830 if (data && typeof data.sessionToken === "string") { 1831 window.__SDK_SESSION_TOKEN__ = data.sessionToken; 1832 window.parent.postMessage({ 1833 type: "snow-replay-ready", 1834 sessionToken: data.sessionToken, 1835 }, expectedOrigin); 1836 } 1837 window.__hasPrefetch = !!(data && data.hasPrefetch); 1838 document.title = 1839 data && 1840 data.context && 1841 typeof data.context.appName === "string" && 1842 data.context.appName.trim() 1843 ? data.context.appName 1844 : "SnowChat App"; 1845 1846 var renderMode = (data && data.renderMode) || "app"; 1847 if (renderMode === "website") { 1848 if (data && data.website) { 1849 window.__websiteContext = data.website; 1850 } 1851 } 1852 installAnchorNavigation(renderMode); 1853 var initPromise = loadBaseScripts(renderMode); 1854 1855 initPromise = initPromise.then(function () { 1856 if ( 1857 data && 1858 data.bundleScripts && 1859 Object.keys(data.bundleScripts).length > 0 1860 ) { 1861 reportStep("Loading bundles..."); 1862 for (var bundleName in data.bundleScripts) { 1863 if ( 1864 Object.prototype.hasOwnProperty.call( 1865 data.bundleScripts, 1866 bundleName 1867 ) 1868 ) { 1869 (0, eval)(data.bundleScripts[bundleName]); 1870 } 1871 } 1872 return; 1873 } 1874 1875 if ( 1876 data && 1877 Array.isArray(data.bundleUrls) && 1878 data.bundleUrls.length > 0 1879 ) { 1880 return loadBundles(data.bundleUrls, data.bundleNames || "(bundles)"); 1881 } 1882 }); 1883 1884 initPromise 1885 .then(function () { 1886 sendRuntimeMessage("iframe-runtime-ready"); 1887 reportStep( 1888 renderMode === "widget" 1889 ? "Executing widget code..." 1890 : renderMode === "website" 1891 ? "Executing website code..." 1892 : "Executing app code..." 1893 ); 1894 if (!data || typeof data.code !== "string") { 1895 throw new Error("No app code provided"); 1896 } 1897 initApp(data.code, data.packageDeclarations, data.icons, renderMode); 1898 }) 1899 .catch(function (error) { 1900 showError( 1901 "Failed to Load", 1902 error.message || "Could not load required scripts." 1903 ); 1904 reportError(error.message || "Script load failed", error.stack); 1905 }); 1906 } catch (error) { 1907 console.error("[IframeRuntime] Error during initialization:", error); 1908 reportError(error.message, error.stack); 1909 showError("App Error", error.message); 1910 } 1911 } 1912 1913 window.addEventListener("message", function (event) { 1914 if (!isTrustedEvent(event)) return; 1915 if (!event.data || typeof event.data.type !== "string") return; 1916 1917 if (event.data.type === "dismiss-iframe-overlays") {
1918 dismissIframeOverlays(); 1919 return; 1920 } 1921 if (event.data.type === "initialize-runtime") { 1922 handleInitializeRuntime(event.data, event.origin); 1923 return; 1924 } 1925 if (event.data.type === "initialize-app") { 1926 handleInitializeApp(event.data, event.origin); 1927 } 1928 }); 1929 1930})();
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.