1(function() { 2 try { 3 var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}; 4 e.SENTRY_RELEASE = { id: "b96dc26" }; 5 var n = new e.Error().stack; 6 n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "08aa54c4-6225-4a53-b5d0-3b37cde020da", e._sentryDebugIdIdentifier = "sentry-dbid-08aa54c4-6225-4a53-b5d0-3b37cde020da"); 7 } catch (e) {} 8})(); 9import { a as __toESM, n as __esmMin } from "./rolldown-runtime-sLwMD6dS.js"; 10import { i as require_compiler_runtime, t as require_jsx_runtime } from "./jsx-runtime-CHSMGLHp.js"; 11import { t as require_react } from "./react-CrLPhuc5.js"; 12import { t as require_react_dom } from "./react-dom-BBovoEwf.js"; 13import { n as init_icon, t as Icon } from "./icon-BNzYbsdJ.js"; 14//#region node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/sonner/dist/index.mjs 15function __insertCSS(code) { 16 if (!code || typeof document == "undefined") return; 17 let head = document.head || document.getElementsByTagName("head")[0]; 18 let style = document.createElement("style"); 19 style.type = "text/css"; 20 head.appendChild(style); 21 style.styleSheet ? style.styleSheet.cssText = code : style.appendChild(document.createTextNode(code)); 22} 23function isAction(action) { 24 return action.label !== void 0; 25} 26function cn(...classes) { 27 return classes.filter(Boolean).join(" "); 28} 29function getDefaultSwipeDirections(position) { 30 const [y, x] = position.split("-"); 31 const directions = []; 32 if (y) directions.push(y); 33 if (x) directions.push(x); 34 return directions; 35} 36function getDocumentDirection() { 37 if (typeof window === "undefined") return "ltr"; 38 if (typeof document === "undefined") return "ltr"; 39 const dirAttribute = document.documentElement.getAttribute("dir"); 40 if (dirAttribute === "auto" || !dirAttribute) return window.getComputedStyle(document.documentElement).direction; 41 return dirAttribute; 42} 43function assignOffset(defaultOffset, mobileOffset) { 44 const styles = {}; 45 [defaultOffset, mobileOffset].forEach((offset, index) => { 46 const isMobile = index === 1; 47 const prefix = isMobile ? "--mobile-offset" : "--offset"; 48 const defaultValue = isMobile ? MOBILE_VIEWPORT_OFFSET : VIEWPORT_OFFSET; 49 function assignAll(offset) { 50 [ 51 "top", 52 "right", 53 "bottom", 54 "left" 55 ].forEach((key) => { 56 styles[`${prefix}-${key}`] = typeof offset === "number" ? `${offset}px` : offset; 57 }); 58 } 59 if (typeof offset === "number" || typeof offset === "string") assignAll(offset); 60 else if (typeof offset === "object") [ 61 "top", 62 "right", 63 "bottom", 64 "left" 65 ].forEach((key) => { 66 if (offset[key] === void 0) styles[`${prefix}-${key}`] = defaultValue; 67 else styles[`${prefix}-${key}`] = typeof offset[key] === "number" ? `${offset[key]}px` : offset[key]; 68 }); 69 else assignAll(defaultValue); 70 }); 71 return styles; 72} 73var import_react, import_react_dom, getAsset, bars, Loader, SuccessIcon, WarningIcon, InfoIcon, ErrorIcon, CloseIcon, useIsDocumentHidden, toastsCounter, MAX_HISTORY_SIZE, getToastId, Observer, ToastState, toastFunction, isHttpResponse, basicToast, getHistory, getToasts, toast$1, VISIBLE_TOASTS_AMOUNT, VIEWPORT_OFFSET, MOBILE_VIEWPORT_OFFSET, TOAST_LIFETIME, TOAST_WIDTH, GAP, SWIPE_THRESHOLD, TIME_BEFORE_UNMOUNT, Toast, Toaster$1; 74function init_dist() { 75 return (init_dist = __esmMin((() => { 76 import_react = /* @__PURE__ */ __toESM(require_react(), 1); 77 import_react_dom = /* @__PURE__ */ __toESM(require_react_dom(), 1); 78 getAsset = (type) => { 79 switch (type) { 80 case "success": return SuccessIcon; 81 case "info": return InfoIcon; 82 case "warning": return WarningIcon; 83 case "error": return ErrorIcon; 84 default: return null; 85 } 86 }; 87 bars = Array(12).fill(0); 88 Loader = ({ visible, className }) => { 89 return /*#__PURE__*/ import_react.createElement("div", { 90 className: ["sonner-loading-wrapper", className].filter(Boolean).join(" "), 91 "data-visible": visible 92 }, /*#__PURE__*/ import_react.createElement("div", { className: "sonner-spinner" }, bars.map((_, i) => /*#__PURE__*/ import_react.createElement("div", { 93 className: "sonner-loading-bar", 94 key: `spinner-bar-${i}` 95 })))); 96 }; 97 SuccessIcon = /*#__PURE__*/ import_react.createElement("svg", { 98 xmlns: "http://www.w3.org/2000/svg", 99 viewBox: "0 0 20 20", 100 fill: "currentColor", 101 height: "20", 102 width: "20", 103 "aria-hidden": "true" 104 }, /*#__PURE__*/ import_react.createElement("path", { 105 fillRule: "evenodd", 106 d: "M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z", 107 clipRule: "evenodd" 108 })); 109 WarningIcon = /*#__PURE__*/ import_react.createElement("svg", { 110 xmlns: "http://www.w3.org/2000/svg", 111 viewBox: "0 0 24 24", 112 fill: "currentColor", 113 height: "20", 114 width: "20", 115 "aria-hidden": "true" 116 }, /*#__PURE__*/ import_react.createElement("path", { 117 fillRule: "evenodd", 118 d: "M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z", 119 clipRule: "evenodd" 120 })); 121 InfoIcon = /*#__PURE__*/ import_react.createElement("svg", { 122 xmlns: "http://www.w3.org/2000/svg", 123 viewBox: "0 0 20 20", 124 fill: "currentColor", 125 height: "20", 126 width: "20", 127 "aria-hidden": "true" 128 }, /*#__PURE__*/ import_react.createElement("path", { 129 fillRule: "evenodd", 130 d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z", 131 clipRule: "evenodd" 132 })); 133 ErrorIcon = /*#__PURE__*/ import_react.createElement("svg", { 134 xmlns: "http://www.w3.org/2000/svg", 135 viewBox: "0 0 20 20", 136 fill: "currentColor", 137 height: "20", 138 width: "20", 139 "aria-hidden": "true" 140 }, /*#__PURE__*/ import_react.createElement("path", { 141 fillRule: "evenodd", 142 d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z", 143 clipRule: "evenodd" 144 })); 145 CloseIcon = /*#__PURE__*/ import_react.createElement("svg", { 146 xmlns: "http://www.w3.org/2000/svg", 147 width: "12", 148 height: "12", 149 viewBox: "0 0 24 24", 150 fill: "none", 151 stroke: "currentColor", 152 strokeWidth: "1.5", 153 strokeLinecap: "round", 154 strokeLinejoin: "round", 155 "aria-hidden": "true" 156 }, /*#__PURE__*/ import_react.createElement("line", { 157 x1: "18", 158 y1: "6", 159 x2: "6", 160 y2: "18" 161 }), /*#__PURE__*/ import_react.createElement("line", { 162 x1: "6", 163 y1: "6", 164 x2: "18", 165 y2: "18" 166 })); 167 useIsDocumentHidden = () => { 168 const [isDocumentHidden, setIsDocumentHidden] = import_react.useState(document.hidden); 169 import_react.useEffect(() => { 170 const callback = () => { 171 setIsDocumentHidden(document.hidden); 172 }; 173 document.addEventListener("visibilitychange", callback); 174 return () => document.removeEventListener("visibilitychange", callback); 175 }, []); 176 return isDocumentHidden; 177 }; 178 toastsCounter = 1; 179 MAX_HISTORY_SIZE = 100; 180 getToastId = (data) => { 181 var _data_id; 182 return typeof (data == null ? void 0 : data.id) === "number" || (data == null ? void 0 : (_data_id = data.id) == null ? void 0 : _data_id.length) > 0 ? data.id : toastsCounter++; 183 }; 184 Observer = class { 185 constructor() { 186 this.subscribe = (subscriber) => { 187 this.subscribers.push(subscriber);
188 this.getActiveToasts().forEach((toast) => subscriber(toast)); 189 return () => { 190 const index = this.subscribers.indexOf(subscriber); 191 this.subscribers.splice(index, 1); 192 }; 193 }; 194 this.publish = (data) => { 195 this.subscribers.forEach((subscriber) => subscriber(data)); 196 }; 197 this.addToast = (data) => { 198 this.publish(data); 199 this.toasts = [...this.toasts, data]; 200 this.trimHistory(); 201 }; 202 this.trimHistory = () => { 203 let toRemove = this.toasts.length - MAX_HISTORY_SIZE; 204 if (toRemove <= 0) return; 205 this.toasts = this.toasts.filter((toast) => { 206 if (toRemove > 0 && this.dismissedToasts.has(toast.id)) { 207 this.dismissedToasts.delete(toast.id); 208 toRemove--; 209 return false; 210 } 211 return true; 212 }); 213 }; 214 this.create = (data) => { 215 const { message, ...rest } = data; 216 const id = getToastId(data); 217 const pendingDismissal = this.pendingDismissals.get(id); 218 if (pendingDismissal !== void 0) { 219 cancelAnimationFrame(pendingDismissal); 220 this.pendingDismissals.delete(id); 221 this.dismissedToasts.delete(id); 222 } 223 const wasDismissed = this.dismissedToasts.has(id); 224 const dismissible = data.dismissible === void 0 ? true : data.dismissible; 225 if (wasDismissed) { 226 this.dismissedToasts.delete(id); 227 this.toasts = this.toasts.filter((toast) => toast.id !== id); 228 } 229 if (wasDismissed ? void 0 : this.toasts.find((toast) => { 230 return toast.id === id; 231 })) this.toasts = this.toasts.map((toast) => { 232 if (toast.id === id) { 233 this.publish({ 234 ...toast, 235 ...data, 236 id, 237 title: message 238 }); 239 return { 240 ...toast, 241 ...data, 242 id, 243 dismissible, 244 title: message 245 }; 246 } 247 return toast; 248 }); 249 else this.addToast({ 250 title: message, 251 ...rest, 252 dismissible, 253 id 254 }); 255 return id; 256 }; 257 this.dismiss = (id) => { 258 if (id === void 0 || id === null) {
259 this.getActiveToasts().forEach((toast) => { 260 this.dismissedToasts.add(toast.id); 261 this.subscribers.forEach((subscriber) => subscriber({ 262 id: toast.id, 263 dismiss: true 264 })); 265 }); 266 return id; 267 } 268 this.dismissedToasts.add(id); 269 const alreadyPending = this.pendingDismissals.get(id); 270 if (alreadyPending !== void 0) cancelAnimationFrame(alreadyPending); 271 this.pendingDismissals.set(id, requestAnimationFrame(() => { 272 this.pendingDismissals.delete(id); 273 this.subscribers.forEach((subscriber) => subscriber({ 274 id, 275 dismiss: true 276 })); 277 })); 278 return id; 279 }; 280 this.message = (message, data) => { 281 return this.create({ 282 ...data, 283 message, 284 type: void 0 285 }); 286 }; 287 this.error = (message, data) => { 288 return this.create({ 289 ...data, 290 message, 291 type: "error" 292 }); 293 }; 294 this.success = (message, data) => { 295 return this.create({ 296 ...data, 297 type: "success", 298 message 299 }); 300 }; 301 this.info = (message, data) => { 302 return this.create({ 303 ...data, 304 type: "info", 305 message 306 }); 307 }; 308 this.warning = (message, data) => { 309 return this.create({ 310 ...data, 311 type: "warning", 312 message 313 }); 314 }; 315 this.loading = (message, data) => { 316 return this.create({ 317 ...data, 318 type: "loading", 319 message 320 }); 321 }; 322 this.promise = (promise, data) => { 323 if (!data) return; 324 let id = void 0; 325 if (data.loading !== void 0) id = this.create({ 326 ...data, 327 promise, 328 type: "loading", 329 message: data.loading, 330 description: typeof data.description !== "function" ? data.description : void 0 331 }); 332 const p = Promise.resolve(promise instanceof Function ? promise() : promise); 333 let shouldDismiss = id !== void 0; 334 let result; 335 const originalPromise = p.then(async (response) => { 336 result = ["resolve", response]; 337 if (import_react.isValidElement(response)) { 338 shouldDismiss = false; 339 this.create({ 340 id, 341 type: "default", 342 message: response 343 }); 344 } else if (isHttpResponse(response) && !response.ok) { 345 shouldDismiss = false; 346 const promiseData = typeof data.error === "function" ? await data.error(`HTTP error! status: ${response.status}`) : data.error; 347 const description = typeof data.description === "function" ? await data.description(`HTTP error! status: ${response.status}`) : data.description; 348 const toastSettings = typeof promiseData === "object" && !import_react.isValidElement(promiseData) ? promiseData : { message: promiseData }; 349 this.create({ 350 id, 351 type: "error", 352 description, 353 ...toastSettings 354 }); 355 } else if (response instanceof Error) { 356 shouldDismiss = false; 357 const promiseData = typeof data.error === "function" ? await data.error(response) : data.error; 358 const description = typeof data.description === "function" ? await data.description(response) : data.description; 359 const toastSettings = typeof promiseData === "object" && !import_react.isValidElement(promiseData) ? promiseData : { message: promiseData }; 360 this.create({ 361 id, 362 type: "error", 363 description, 364 ...toastSettings 365 }); 366 } else if (data.success !== void 0) { 367 shouldDismiss = false; 368 const promiseData = typeof data.success === "function" ? await data.success(response) : data.success; 369 const description = typeof data.description === "function" ? await data.description(response) : data.description; 370 const toastSettings = typeof promiseData === "object" && !import_react.isValidElement(promiseData) ? promiseData : { message: promiseData }; 371 this.create({ 372 id, 373 type: "success", 374 description, 375 ...toastSettings 376 }); 377 } 378 }).catch(async (error) => { 379 result = ["reject", error]; 380 if (data.error !== void 0) { 381 shouldDismiss = false; 382 const promiseData = typeof data.error === "function" ? await data.error(error) : data.error; 383 const description = typeof data.description === "function" ? await data.description(error) : data.description; 384 const toastSettings = typeof promiseData === "object" && !import_react.isValidElement(promiseData) ? promiseData : { message: promiseData }; 385 this.create({ 386 id, 387 type: "error", 388 description, 389 ...toastSettings 390 }); 391 } 392 }).finally(() => { 393 if (shouldDismiss) { 394 this.dismiss(id); 395 id = void 0; 396 } 397 data.finally == null || data.finally.call(data); 398 }); 399 const unwrap = () => new Promise((resolve, reject) => originalPromise.then(() => result[0] === "reject" ? reject(result[1]) : resolve(result[1])).catch(reject)); 400 if (typeof id !== "string" && typeof id !== "number") return { unwrap }; 401 else return Object.assign(id, { unwrap }); 402 }; 403 this.custom = (jsx, data) => { 404 const id = getToastId(data); 405 this.create({ 406 ...data, 407 jsx: jsx(id), 408 id, 409 type: void 0 410 }); 411 return id; 412 }; 413 this.getActiveToasts = () => { 414 return this.toasts.filter((toast) => !this.dismissedToasts.has(toast.id)); 415 }; 416 this.subscribers = []; 417 this.toasts = []; 418 this.dismissedToasts = /* @__PURE__ */ new Set(); 419 this.pendingDismissals = /* @__PURE__ */ new Map(); 420 } 421 }; 422 ToastState = new Observer(); 423 toastFunction = (message, data) => { 424 return ToastState.message(message, data); 425 }; 426 isHttpResponse = (data) => { 427 return data && typeof data === "object" && "ok" in data && typeof data.ok === "boolean" && "status" in data && typeof data.status === "
427number"; 428 }; 429 basicToast = toastFunction; 430 getHistory = () => ToastState.toasts; 431 getToasts = () => ToastState.getActiveToasts(); 432 toast$1 = Object.assign(basicToast, { 433 success: ToastState.success, 434 info: ToastState.info, 435 warning: ToastState.warning, 436 error: ToastState.error, 437 custom: ToastState.custom, 438 message: ToastState.message, 439 promise: ToastState.promise, 440 dismiss: ToastState.dismiss, 441 loading: ToastState.loading 442 }, { 443 getHistory, 444 getToasts 445 }); 446 __insertCSS("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);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;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px;flex:1;min-width:0}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;
446left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--normal-text);background:var(--normal-bg);border:1px solid var(--normal-border);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}
446[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{-webkit-user-select:none;user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);
446--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}"); 447 VISIBLE_TOASTS_AMOUNT = 3; 448 VIEWPORT_OFFSET = "24px"; 449 MOBILE_VIEWPORT_OFFSET = "16px"; 450 TOAST_LIFETIME = 4e3; 451 TOAST_WIDTH = 356; 452 GAP = 14; 453 SWIPE_THRESHOLD = 45; 454 TIME_BEFORE_UNMOUNT = 200; 455 Toast = (props) => { 456 var _toast_classNames, _toast_classNames1, _toast_classNames2, _toast_classNames3, _toast_classNames4, _toast_classNames5, _toast_classNames6, _toast_classNames7, _toast_classNames8; 457 const { invert: ToasterInvert, toast, unstyled, interacting, setHeights, visibleToasts, heights, index, toasts, expanded, removeToast, defaultRichColors, closeButton: closeButtonFromToaster, style, cancelButtonStyle, actionButtonStyle, className = "", descriptionClassName = "", duration: durationFromToaster, position, gap, expandByDefault, classNames, icons, closeButtonAriaLabel = "Close toast" } = props; 458 const [swipeDirection, setSwipeDirection] = import_react.useState(null); 459 const [swipeOutDirection, setSwipeOutDirection] = import_react.useState(null); 460 const [mounted, setMounted] = import_react.useState(false); 461 const [removed, setRemoved] = import_react.useState(false); 462 const [swiping, setSwiping] = import_react.useState(false); 463 const [swipeOut, setSwipeOut] = import_react.useState(false); 464 const [isSwiped, setIsSwiped] = import_react.useState(false); 465 const [offsetBeforeRemove, setOffsetBeforeRemove] = import_react.useState(0); 466 const [initialHeight, setInitialHeight] = import_react.useState(0); 467 const remainingTime = import_react.useRef(toast.duration || durationFromToaster || TOAST_LIFETIME); 468 const dragStartTime = import_react.useRef(null); 469 const toastRef = import_react.useRef(null); 470 const isFront = index === 0; 471 const isVisible = index + 1 <= visibleToasts; 472 const toastType = toast.type; 473 const toastTypeKey = toastType != null ? toastType : "default";
474 const dismissible = toast.dismissible !== false; 475 const toastClassname = toast.className || ""; 476 const toastDescriptionClassname = toast.descriptionClassName || ""; 477 const heightIndex = import_react.useMemo(() => heights.findIndex((height) => height.toastId === toast.id) || 0, [heights, toast.id]); 478 const closeButton = import_react.useMemo(() => { 479 var _toast_closeButton; 480 return (_toast_closeButton = toast.closeButton) != null ? _toast_closeButton : closeButtonFromToaster; 481 }, [toast.closeButton, closeButtonFromToaster]); 482 const duration = import_react.useMemo(() => toast.duration || durationFromToaster || TOAST_LIFETIME, [toast.duration, durationFromToaster]); 483 const closeTimerStartTimeRef = import_react.useRef(0); 484 const offset = import_react.useRef(0); 485 const lastCloseTimerStartTimeRef = import_react.useRef(0); 486 const pointerStartRef = import_react.useRef(null); 487 const [y, x] = position.split("-"); 488 const toastsHeightBefore = import_react.useMemo(() => { 489 return heights.reduce((prev, curr, reducerIndex) => { 490 if (reducerIndex >= heightIndex) return prev; 491 return prev + curr.height; 492 }, 0); 493 }, [heights, heightIndex]); 494 const isDocumentHidden = useIsDocumentHidden(); 495 const swipeDirections = import_react.useMemo(() => { 496 var _props_swipeDirections; 497 return (_props_swipeDirections = props.swipeDirections) != null ? _props_swipeDirections : getDefaultSwipeDirections(position); 498 }, [props.swipeDirections, position]); 499 const invert = toast.invert || ToasterInvert; 500 const disabled = toastType === "loading"; 501 offset.current = import_react.useMemo(() => heightIndex * gap + toastsHeightBefore, [heightIndex, toastsHeightBefore]); 502 import_react.useEffect(() => { 503 remainingTime.current = duration; 504 }, [duration]); 505 import_react.useEffect(() => { 506 setMounted(true); 507 }, []); 508 import_react.useEffect(() => { 509 const toastNode = toastRef.current; 510 if (toastNode) { 511 const height = toastNode.getBoundingClientRect().height; 512 setInitialHeight(height); 513 setHeights((h) => [{ 514 toastId: toast.id, 515 height, 516 position: toast.position 517 }, ...h]); 518 return () => setHeights((h) => h.filter((height) => height.toastId !== toast.id)); 519 } 520 }, [setHeights, toast.id]); 521 import_react.useLayoutEffect(() => { 522 if (!mounted) return; 523 const toastNode = toastRef.current; 524 const originalHeight = toastNode.style.height; 525 toastNode.style.height = "auto"; 526 const newHeight = toastNode.getBoundingClientRect().height; 527 toastNode.style.height = originalHeight; 528 setInitialHeight(newHeight); 529 setHeights((heights) => { 530 if (!heights.find((height) => height.toastId === toast.id)) return [{ 531 toastId: toast.id, 532 height: newHeight, 533 position: toast.position 534 }, ...heights]; 535 else return heights.map((height) => height.toastId === toast.id ? { 536 ...height, 537 height: newHeight 538 } : height); 539 }); 540 }, [ 541 mounted, 542 toast.title, 543 toast.description, 544 setHeights, 545 toast.id, 546 toast.jsx, 547 toast.action, 548 toast.cancel 549 ]); 550 const deleteToast = import_react.useCallback(() => { 551 setRemoved(true); 552 setOffsetBeforeRemove(offset.current); 553 setHeights((h) => h.filter((height) => height.toastId !== toast.id)); 554 setTimeout(() => { 555 removeToast(toast); 556 }, TIME_BEFORE_UNMOUNT); 557 }, [ 558 toast, 559 removeToast, 560 setHeights, 561 offset 562 ]); 563 import_react.useEffect(() => { 564 if (toast.promise && toastType === "loading" || toast.duration === Infinity || toast.type === "loading") return; 565 let timeoutId; 566 const pauseTimer = () => { 567 if (lastCloseTimerStartTimeRef.current < closeTimerStartTimeRef.current) { 568 const elapsedTime = (/* @__PURE__ */ new Date()).getTime() - closeTimerStartTimeRef.current; 569 remainingTime.current = remainingTime.current - elapsedTime; 570 } 571 lastCloseTimerStartTimeRef.current = (/* @__PURE__ */ new Date()).getTime(); 572 }; 573 const startTimer = () => { 574 if (remainingTime.current === Infinity) return; 575 closeTimerStartTimeRef.current = (/* @__PURE__ */ new Date()).getTime(); 576 timeoutId = setTimeout(() => { 577 toast.onAutoClose == null || toast.onAutoClose.call(toast, toast); 578 deleteToast(); 579 }, remainingTime.current); 580 }; 581 if (expanded || interacting || isDocumentHidden) pauseTimer(); 582 else startTimer(); 583 return () => clearTimeout(timeoutId); 584 }, [ 585 expanded, 586 interacting, 587 toast, 588 toastType, 589 isDocumentHidden, 590 deleteToast 591 ]); 592 import_react.useEffect(() => { 593 if (toast.delete) { 594 deleteToast(); 595 toast.onDismiss == null || toast.onDismiss.call(toast, toast); 596 } 597 }, [deleteToast, toast.delete]); 598 function getLoadingIcon() { 599 var _toast_classNames; 600 if (icons == null ? void 0 : icons.loading) { 601 var _toast_classNames1; 602 return /*#__PURE__*/ import_react.createElement("div", { 603 className: cn(classNames == null ? void 0 : classNames.loader, toast == null ? void 0 : (_toast_classNames1 = toast.classNames) == null ? void 0 : _toast_classNames1.loader, "sonner-loader"), 604 "data-visible": toastType === "loading" 605 }, icons.loading); 606 } 607 return /*#__PURE__*/ import_react.createElement(Loader, { 608 className: cn(classNames == null ? void 0 : classNames.loader, toast == null ? void 0 : (_toast_classNames = toast.classNames) == null ? void 0 : _toast_classNames.loader), 609 visible: toastType === "loading" 610 }); 611 } 612 const icon = toast.icon || (icons == null ? void 0 : icons[toastType]) || getAsset(toastType); 613 var _toast_richColors, _icons_close; 614 return /*#__PURE__*/ import_react.createElement("li", { 615 tabIndex: 0, 616 ref: toastRef, 617 className: cn(className, toastClassname, classNames == null ? void 0 : classNames.toast, toast == null ? void 0 : (_toast_classNames = toast.classNames) == null ? void 0 : _toast_classNames.toast, classNames == null ? void 0 : classNames[toastTypeKey], toast == null ? void 0 : (_toast_classNames1 = toast.classNames) == null ? void 0 : _toast_classNames1[toastTypeKey]), 618 "data-sonner-toast": "", 619 "data-rich-colors": (_toast_richColors = toast.richColors) != null ? _toast_richColors : defaultRichColors, 620 "data-styled": !Boolean(toast.jsx || toast.unstyled || unstyled), 621 "data-mounted": mounted, 622 "data-promise": Boolean(toast.promise), 623 "data-swiped": isSwiped, 624 "data-removed": removed, 625 "data-visible": isVisible, 626 "data-y-position": y, 627 "data-x-position": x, 628 "data-index": index, 629 "data-front": isFront, 630 "data-swiping": swiping, 631 "data-dismissible": dismissible, 632 "data-type": toastType, 633 "data-invert": invert, 634 "data-swipe-out": swipeOut, 635 "data-swipe-direction": swipeOutDirection, 636 "data-expanded": Boolean(expanded || expandByDefault && mounted), 637 "data-testid": toast.testId, 638 style: { 639 "--index": index, 640 "--toasts-before": index, 641 "--z-index": toasts.length - index, 642 "--offset": `${removed ? offsetBeforeRemove : offset.current}px`, 643 "--initial-height": expandByDefault ? "auto" : `${initialHeight}px`, 644 ...style, 645 ...toast.style 646 }, 647 onDragEnd: () => { 648 setSwiping(false); 649 setSwipeDirection(null); 650 pointerStartRef.current = null; 651 }, 652 onPointerDown: (event) => { 653 if (event.button === 2) return; 654 if (disabled || !dismissible) return; 655 dragStartTime.current = /* @__PURE__ */ new Date(); 656 setOffsetBeforeRemove(offset.current); 657 event.target.setPointerCapture(event.pointerId); 658 if (event.target.tagName === "BUTTON") return; 659 setSwiping(true); 660 pointerStartRef.current = { 661 x: event.clientX, 662 y: event.clientY 663 }; 664 }, 665 onPointerUp: () => { 666 var _toastRef_current, _toastRef_current1, _dragStartTime_current; 667 if (swipeOut || !dismissible) return; 668 pointerStartRef.current = null; 669 const swipeAmountX = Number(((_toastRef_current = toastRef.current) == null ? void 0 : _toastRef_current.style.getPropertyValue("--swipe-amount-x").replace("px", "")) || 0); 670 const swipeAmountY = Number(((_toastRef_current1 = toastRef.current) == null ? void 0 : _toastRef_current1.style.getPropertyValue("--swipe-amount-y").replace("px", "")) || 0); 671 const timeTaken = (/* @__PURE__ */ new Date()).getTime() - ((_dragStartTime_current = dragStartTime.current) == null ? void 0 : _dragStartTime_current.getTime()); 672 const swipeAmount = swipeDirection === "x" ? swipeAmountX : swipeAmountY; 673 const velocity = Math.abs(swipeAmount) / timeTaken; 674 if ((swipeDirection === "x" ? swipeDirections.includes(swipeAmountX > 0 ? "right" : "left") : swipeDirections.includes(swipeAmountY > 0 ? "bottom" : "top")) && (Math.abs(swipeAmount) >= SWIPE_THRESHOLD || velocity > .11)) { 675 setOffsetBeforeRemove(offset.current); 676 toast.onDismiss == null || toast.onDismiss.call(toast, toast); 677 if (swipeDirection === "x") setSwipeOutDirection(swipeAmountX > 0 ? "right" : "left"); 678 else setSwipeOutDirection(swipeAmountY > 0 ? "down" : "up"); 679 deleteToast(); 680 setSwipeOut(true); 681 return; 682 } else { 683 var _toastRef_current2, _toastRef_current3; 684 (_toastRef_current2 = toastRef.current) == null || _toastRef_current2.style.setProperty("--swipe-amount-x", `0px`); 685 (_toastRef_current3 = toastRef.current) == null || _toastRef_current3.style.setProperty("--swipe-amount-y", `0px`); 686 } 687 setIsSwiped(false); 688 setSwiping(false); 689 setSwipeDirection(null); 690 }, 691 onPointerMove: (event) => { 692 var _window_getSelection, _toastRef_current, _toastRef_current1; 693 if (!pointerStartRef.current || !dismissible) return; 694 if (((_window_getSelection = window.getSelection()) == null ? void 0 : _window_getSelection.toString().length) > 0) return; 695 const yDelta = event.clientY - pointerStartRef.current.y; 696 const xDelta = event.clientX - pointerStartRef.current.x; 697 if (!swipeDirection && (Math.abs(xDelta) > 1 || Math.abs(yDelta) > 1)) setSwipeDirection(Math.abs(xDelta) > Math.abs(yDelta) ? "x" : "y"); 698 let swipeAmount = { 699 x: 0, 700 y: 0 701 }; 702 const getDampening = (delta) => { 703 return 1 / (1.5 + Math.abs(delta) / 20); 704 }; 705 if (swipeDirection === "y") { 706 if (swipeDirections.includes("top") || swipeDirections.includes("bottom")) { 707 if (swipeDirections.includes("top") && yDelta < 0 || swipeDirections.includes("bottom") && yDelta > 0) swipeAmount.y = yDelta; 708 else { 709 const dampenedDelta = yDelta * getDampening(yDelta); 710 swipeAmount.y = Math.abs(dampenedDelta) < Math.abs(yDelta) ? dampenedDelta : yDelta; 711 } 712 } 713 } else if (swipeDirection === "x") { 714 if (swipeDirections.includes("left") || swipeDirections.includes("right")) { 715 if (swipeDirections.includes("left") && xDelta < 0 || swipeDirections.includes("right") && xDelta > 0) swipeAmount.x = xDelta; 716 else { 717 const dampenedDelta = xDelta * getDampening(xDelta); 718 swipeAmount.x = Math.abs(dampenedDelta) < Math.abs(xDelta) ? dampenedDelta : xDelta; 719 } 720 } 721 } 722 if (Math.abs(swipeAmount.x) > 0 || Math.abs(swipeAmount.y) > 0) setIsSwiped(true); 723 (_toastRef_current = toastRef.current) == null || _toastRef_current.style.setProperty("--swipe-amount-x", `${swipeAmount.x}px`); 724 (_toastRef_current1 = toastRef.current) == null || _toastRef_current1.style.setProperty("--swipe-amount-y", `${swipeAmount.y}px`); 725 } 726 }, closeButton && !toast.jsx && toastType !== "loading" ? /*#__PURE__*/ import_react.createElement("button", { 727 "aria-label": closeButtonAriaLabel, 728 "data-disabled": disabled, 729 "data-close-button": true, 730 onClick: disabled || !dismissible ? () => {} : () => { 731 deleteToast(); 732 toast.onDismiss == null || toast.onDismiss.call(toast, toast); 733 }, 734 className: cn(classNames == null ? void 0 : classNames.closeButton, toast == null ? void 0 : (_toast_classNames2 = toast.classNames) == null ? void 0 : _toast_classNames2.closeButton) 735 }, (_icons_close = icons == null ? void 0 : icons.close) != null ? _icons_close : CloseIcon) : null, (toastType || toast.icon || toast.promise) && toast.icon !== null && ((icons == null ? void 0 : icons[toastType]) !== null || toast.icon) ? /*#__PURE__*/ import_react.createElement("div", { 736 "data-icon": "", 737 className: cn(classNames == null ? void 0 : classNames.icon, toast == null ? void 0 : (_toast_classNames3 = toast.classNames) == null ? void 0 : _toast_classNames3.icon) 738 }, toastType === "loading" ? toast.icon || getLoadingIcon() : toast.promise ? getLoadingIcon() : null, toastType !== "loading" ? icon : null) : null, /*#__PURE__*/ import_react.createElement("div", { 739 "data-content": "",
740 className: cn(classNames == null ? void 0 : classNames.content, toast == null ? void 0 : (_toast_classNames4 = toast.classNames) == null ? void 0 : _toast_classNames4.content) 741 }, /*#__PURE__*/ import_react.createElement("div", { 742 "data-title": "", 743 className: cn(classNames == null ? void 0 : classNames.title, toast == null ? void 0 : (_toast_classNames5 = toast.classNames) == null ? void 0 : _toast_classNames5.title) 744 }, toast.jsx ? toast.jsx : typeof toast.title === "function" ? toast.title() : toast.title), toast.description ? /*#__PURE__*/ import_react.createElement("div", { 745 "data-description": "", 746 className: cn(descriptionClassName, toastDescriptionClassname, classNames == null ? void 0 : classNames.description, toast == null ? void 0 : (_toast_classNames6 = toast.classNames) == null ? void 0 : _toast_classNames6.description) 747 }, typeof toast.description === "function" ? toast.description() : toast.description) : null), /*#__PURE__*/ import_react.isValidElement(toast.cancel) ? toast.cancel : toast.cancel && isAction(toast.cancel) ? /*#__PURE__*/ import_react.createElement("button", { 748 "data-button": true, 749 "data-cancel": true, 750 style: toast.cancelButtonStyle || cancelButtonStyle, 751 onClick: (event) => { 752 if (!isAction(toast.cancel)) return; 753 if (!dismissible) return; 754 toast.cancel.onClick == null || toast.cancel.onClick.call(toast.cancel, event); 755 deleteToast(); 756 }, 757 className: cn(classNames == null ? void 0 : classNames.cancelButton, toast == null ? void 0 : (_toast_classNames7 = toast.classNames) == null ? void 0 : _toast_classNames7.cancelButton) 758 }, toast.cancel.label) : null, /*#__PURE__*/ import_react.isValidElement(toast.action) ? toast.action : toast.action && isAction(toast.action) ? /*#__PURE__*/ import_react.createElement("button", { 759 "data-button": true, 760 "data-action": true, 761 style: toast.actionButtonStyle || actionButtonStyle, 762 onClick: (event) => { 763 if (!isAction(toast.action)) return; 764 toast.action.onClick == null || toast.action.onClick.call(toast.action, event); 765 if (event.defaultPrevented) return; 766 deleteToast(); 767 }, 768 className: cn(classNames == null ? void 0 : classNames.actionButton, toast == null ? void 0 : (_toast_classNames8 = toast.classNames) == null ? void 0 : _toast_classNames8.actionButton) 769 }, toast.action.label) : null); 770 }; 771 Toaster$1 = /*#__PURE__*/ import_react.forwardRef(function Toaster(props, ref) { 772 const { id, invert, position = "bottom-right", hotkey = ["altKey", "KeyT"], expand, closeButton, className, offset, mobileOffset, theme = "light", richColors, duration, style, visibleToasts = VISIBLE_TOASTS_AMOUNT, toastOptions, dir = getDocumentDirection(), gap = GAP, icons, customAriaLabel, containerAriaLabel = "Notifications" } = props; 773 const [toasts, setToasts] = import_react.useState([]); 774 const filteredToasts = import_react.useMemo(() => { 775 if (id) return toasts.filter((toast) => toast.toasterId === id); 776 return toasts.filter((toast) => !toast.toasterId); 777 }, [toasts, id]); 778 const possiblePositions = import_react.useMemo(() => { 779 return Array.from(new Set([position].concat(filteredToasts.filter((toast) => toast.position).map((toast) => toast.position)))); 780 }, [filteredToasts, position]); 781 const [heights, setHeights] = import_react.useState([]); 782 const [expanded, setExpanded] = import_react.useState(false); 783 const [interacting, setInteracting] = import_react.useState(false); 784 const [actualTheme, setActualTheme] = import_react.useState(theme !== "system" ? theme : typeof window !== "undefined" ? window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light" : "light"); 785 const listRef = import_react.useRef(null); 786 const hotkeyLabel = hotkey.join("+").replace(/Key/g, "").replace(/Digit/g, ""); 787 const lastFocusedElementRef = import_react.useRef(null); 788 const isFocusWithinRef = import_react.useRef(false); 789 const removeToast = import_react.useCallback((toastToRemove) => { 790 setToasts((toasts) => { 791 var _toasts_find; 792 if (!((_toasts_find = toasts.find((toast) => toast.id === toastToRemove.id)) == null ? void 0 : _toasts_find.delete)) ToastState.dismiss(toastToRemove.id); 793 return toasts.filter(({ id }) => id !== toastToRemove.id); 794 }); 795 }, []); 796 import_react.useEffect(() => { 797 return ToastState.subscribe((toast) => { 798 if (toast.dismiss) { 799 requestAnimationFrame(() => { 800 setToasts((toasts) => toasts.map((t) => t.id === toast.id ? { 801 ...t, 802 delete: true 803 } : t)); 804 }); 805 return; 806 } 807 setTimeout(() => { 808 import_react_dom.flushSync(() => { 809 setToasts((toasts) => { 810 const indexOfExistingToast = toasts.findIndex((t) => t.id === toast.id); 811 if (indexOfExistingToast !== -1) return [ 812 ...toasts.slice(0, indexOfExistingToast), 813 { 814 ...toasts[indexOfExistingToast], 815 ...toast 816 },
817 ...toasts.slice(indexOfExistingToast + 1) 818 ]; 819 return [toast, ...toasts]; 820 }); 821 }); 822 }); 823 }); 824 }, []); 825 import_react.useEffect(() => { 826 if (theme !== "system") { 827 setActualTheme(theme); 828 return; 829 } 830 if (theme === "system") { 831 if (window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches) setActualTheme("dark"); 832 else setActualTheme("light"); 833 } 834 if (typeof window === "undefined") return; 835 const darkMediaQuery = window.matchMedia("(prefers-color-scheme: dark)"); 836 try { 837 darkMediaQuery.addEventListener("change", ({ matches }) => { 838 if (matches) setActualTheme("dark"); 839 else setActualTheme("light"); 840 }); 841 } catch (error) { 842 darkMediaQuery.addListener(({ matches }) => { 843 try { 844 if (matches) setActualTheme("dark"); 845 else setActualTheme("light"); 846 } catch (e) { 847 console.error(e); 848 } 849 }); 850 } 851 }, [theme]); 852 import_react.useEffect(() => { 853 if (toasts.length <= 1) setExpanded(false); 854 }, [toasts]); 855 import_react.useEffect(() => { 856 const handleKeyDown = (event) => { 857 var _listRef_current; 858 if (hotkey.length > 0 && hotkey.every((key) => event[key] || event.code === key)) { 859 var _listRef_current1; 860 setExpanded(true); 861 (_listRef_current1 = listRef.current) == null || _listRef_current1.focus(); 862 } 863 if (event.code === "Escape" && (document.activeElement === listRef.current || ((_listRef_current = listRef.current) == null ? void 0 : _listRef_current.contains(document.activeElement)))) setExpanded(false); 864 }; 865 document.addEventListener("keydown", handleKeyDown); 866 return () => document.removeEventListener("keydown", handleKeyDown); 867 }, [hotkey]); 868 import_react.useEffect(() => { 869 if (listRef.current) return () => { 870 if (lastFocusedElementRef.current) { 871 lastFocusedElementRef.current.focus({ preventScroll: true }); 872 lastFocusedElementRef.current = null; 873 isFocusWithinRef.current = false; 874 } 875 }; 876 }, [listRef.current]); 877 return /*#__PURE__*/ import_react.createElement("section", { 878 ref, 879 "aria-label": customAriaLabel != null ? customAriaLabel : `${containerAriaLabel} ${hotkeyLabel}`, 880 tabIndex: -1, 881 "aria-live": "polite", 882 "aria-relevant": "additions text", 883 "aria-atomic": "false", 884 suppressHydrationWarning: true, 885 "data-react-aria-top-layer": true 886 }, possiblePositions.map((position, index) => { 887 var _heights_; 888 const [y, x] = position.split("-"); 889 if (!filteredToasts.length) return null; 890 return /*#__PURE__*/ import_react.createElement("ol", { 891 key: position, 892 dir: dir === "auto" ? getDocumentDirection() : dir, 893 tabIndex: -1, 894 ref: listRef, 895 className, 896 "data-sonner-toaster": true, 897 "data-sonner-theme": actualTheme, 898 "data-y-position": y, 899 "data-x-position": x, 900 style: { 901 "--front-toast-height": `${((_heights_ = heights[0]) == null ? void 0 : _heights_.height) || 0}px`, 902 "--width": `${TOAST_WIDTH}px`, 903 "--gap": `${gap}px`, 904 ...style, 905 ...assignOffset(offset, mobileOffset) 906 }, 907 onBlur: (event) => { 908 if (isFocusWithinRef.current && !event.currentTarget.contains(event.relatedTarget)) { 909 isFocusWithinRef.current = false; 910 if (lastFocusedElementRef.current) { 911 lastFocusedElementRef.current.focus({ preventScroll: true }); 912 lastFocusedElementRef.current = null; 913 } 914 } 915 }, 916 onFocus: (event) => { 917 if (event.target instanceof HTMLElement && event.target.dataset.dismissible === "false") return; 918 if (!isFocusWithinRef.current) { 919 isFocusWithinRef.current = true; 920 lastFocusedElementRef.current = event.relatedTarget; 921 } 922 }, 923 onMouseEnter: () => setExpanded(true), 924 onMouseMove: () => setExpanded(true), 925 onMouseLeave: () => { 926 if (!interacting) setExpanded(false); 927 }, 928 onDragEnd: () => setExpanded(false), 929 onPointerDown: (event) => { 930 if (event.target instanceof HTMLElement && event.target.dataset.dismissible === "fal
930se") return; 931 setInteracting(true); 932 }, 933 onPointerUp: () => setInteracting(false) 934 }, filteredToasts.filter((toast) => !toast.position && index === 0 || toast.position === position).map((toast, index) => { 935 var _toastOptions_duration, _toastOptions_closeButton; 936 return /*#__PURE__*/ import_react.createElement(Toast, { 937 key: toast.id, 938 icons, 939 index, 940 toast, 941 defaultRichColors: richColors, 942 duration: (_toastOptions_duration = toastOptions == null ? void 0 : toastOptions.duration) != null ? _toastOptions_duration : duration, 943 className: toastOptions == null ? void 0 : toastOptions.className, 944 descriptionClassName: toastOptions == null ? void 0 : toastOptions.descriptionClassName, 945 invert, 946 visibleToasts, 947 closeButton: (_toastOptions_closeButton = toastOptions == null ? void 0 : toastOptions.closeButton) != null ? _toastOptions_closeButton : closeButton, 948 interacting, 949 position, 950 style: toastOptions == null ? void 0 : toastOptions.style, 951 unstyled: toastOptions == null ? void 0 : toastOptions.unstyled, 952 classNames: toastOptions == null ? void 0 : toastOptions.classNames, 953 cancelButtonStyle: toastOptions == null ? void 0 : toastOptions.cancelButtonStyle, 954 actionButtonStyle: toastOptions == null ? void 0 : toastOptions.actionButtonStyle, 955 closeButtonAriaLabel: toastOptions == null ? void 0 : toastOptions.closeButtonAriaLabel, 956 removeToast, 957 toasts: filteredToasts.filter((t) => t.position == toast.position), 958 heights: heights.filter((h) => h.position == toast.position), 959 setHeights, 960 expandByDefault: expand, 961 gap, 962 expanded, 963 swipeDirections: props.swipeDirections 964 }); 965 })); 966 })); 967 }); 968 })))(); 969} 970//#endregion 971//#region app/frontend/react/ui/toast.tsx 972function Toaster() { 973 const $ = (0, import_compiler_runtime.c)(1); 974 let t0; 975 if ($[0] === Symbol.for("react.memo_cache_sentinel")) { 976 t0 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Toaster$1, { 977 position: "bottom-center", 978 duration: DURATION_MS, 979 closeButton: true, 980 toastOptions: { 981 unstyled: true, 982 classNames: { toast: "h-toast__item" } 983 }, 984 icons: { 985 success: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, { 986 icon: "check", 987 size: "md" 988 }), 989 error: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, { 990 icon: "circle-xmark", 991 size: "md" 992 }), 993 warning: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, { 994 icon: "exclamation-triangle", 995 size: "md" 996 }), 997 loading: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, { 998 icon: "spinner-third", 999 loading: true, 1000 size: "md" 1001 }) 1002 } 1003 }); 1004 $[0] = t0; 1005 } else t0 = $[0]; 1006 return t0; 1007} 1008var import_compiler_runtime, import_jsx_runtime, DURATION_MS, toast; 1009function init_toast() { 1010 return (init_toast = __esmMin((() => { 1011 import_compiler_runtime = require_compiler_runtime(); 1012 init_dist(); 1013 init_icon(); 1014 import_jsx_runtime = require_jsx_runtime(); 1015 DURATION_MS = 1e4; 1016 toast = { 1017 success: (message, options) => toast$1.success(message, options), 1018 danger: (message, options) => toast$1.error(message, options), 1019 warning: (message, options) => toast$1.warning(message, options), 1020 loading: (message, options) => toast$1.loading(message, options), 1021 dismiss: (id) => toast$1.dismiss(id), 1022 clear: () => toast$1.dismiss(), 1023 _reset: () => toast$1.dismiss() 1024 }; 1025 })))(); 1026} 1027//#endregion 1028export { init_toast as n, toast as r, Toaster as t };
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.