@alook/app 0.1.34 → 0.1.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/bundled/web/.open-next/.build/durable-objects/queue.js +5 -5
  2. package/bundled/web/.open-next/assets/BUILD_ID +1 -1
  3. package/bundled/web/.open-next/assets/_next/static/chunks/0xk3goeel2v01.js +5 -0
  4. package/bundled/web/.open-next/assets/_next/static/chunks/0y253sbff4i0b.js +20 -0
  5. package/bundled/web/.open-next/assets/_next/static/chunks/1f_v2q_s63hoh.js +1 -0
  6. package/bundled/web/.open-next/assets/_next/static/chunks/{3dt849e0jwtu9.js → 1qn5hcu4pid1i.js} +1 -1
  7. package/bundled/web/.open-next/assets/_next/static/chunks/{0uwa452_gtwuc.js → 2sds_4pfwxfef.js} +1 -1
  8. package/bundled/web/.open-next/assets/_next/static/chunks/{3qq-56a5hmhjv.js → 30ia458y2m-z9.js} +1 -1
  9. package/bundled/web/.open-next/assets/_next/static/chunks/{2eysjnlp6hn65.js → 3gbp8j1j9xqt5.js} +1 -1
  10. package/bundled/web/.open-next/cache/{JPtCnLnN72EaJMxDUPROm → cF14NSMWpDLveF91ebqUj}/_global-error.cache +1 -1
  11. package/bundled/web/.open-next/cache/{JPtCnLnN72EaJMxDUPROm → cF14NSMWpDLveF91ebqUj}/_not-found.cache +1 -1
  12. package/bundled/web/.open-next/cache/{JPtCnLnN72EaJMxDUPROm → cF14NSMWpDLveF91ebqUj}/c/me/bots.cache +1 -1
  13. package/bundled/web/.open-next/cache/{JPtCnLnN72EaJMxDUPROm → cF14NSMWpDLveF91ebqUj}/c/me/friends.cache +1 -1
  14. package/bundled/web/.open-next/cache/{JPtCnLnN72EaJMxDUPROm → cF14NSMWpDLveF91ebqUj}/c/me/machines.cache +1 -1
  15. package/bundled/web/.open-next/cache/{JPtCnLnN72EaJMxDUPROm → cF14NSMWpDLveF91ebqUj}/c/me.cache +1 -1
  16. package/bundled/web/.open-next/cache/{JPtCnLnN72EaJMxDUPROm → cF14NSMWpDLveF91ebqUj}/c/onboarding-preview.cache +1 -1
  17. package/bundled/web/.open-next/cache/{JPtCnLnN72EaJMxDUPROm → cF14NSMWpDLveF91ebqUj}/c.cache +1 -1
  18. package/bundled/web/.open-next/cache/{JPtCnLnN72EaJMxDUPROm → cF14NSMWpDLveF91ebqUj}/device.cache +1 -1
  19. package/bundled/web/.open-next/cache/{JPtCnLnN72EaJMxDUPROm → cF14NSMWpDLveF91ebqUj}/onboarding-preview.cache +1 -1
  20. package/bundled/web/.open-next/cache/{JPtCnLnN72EaJMxDUPROm → cF14NSMWpDLveF91ebqUj}/privacy.cache +1 -1
  21. package/bundled/web/.open-next/cloudflare/cache-assets-manifest.sql +1 -1
  22. package/bundled/web/.open-next/cloudflare/init.js +1 -1
  23. package/bundled/web/.open-next/dynamodb-provider/dynamodb-cache.json +1 -1
  24. package/bundled/web/.open-next/middleware/handler.mjs +4 -4
  25. package/bundled/web/.open-next/server-functions/default/src/web/.next/BUILD_ID +1 -1
  26. package/bundled/web/.open-next/server-functions/default/src/web/.next/build-manifest.json +3 -3
  27. package/bundled/web/.open-next/server-functions/default/src/web/.next/prerender-manifest.json +3 -3
  28. package/bundled/web/.open-next/server-functions/default/src/web/.next/required-server-files.json +2 -2
  29. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/invite/[token]/page_client-reference-manifest.js +1 -1
  30. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/studio/new/page_client-reference-manifest.js +1 -1
  31. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/agents/[id]/activity/page_client-reference-manifest.js +1 -1
  32. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/agents/[id]/chat/[convId]/page_client-reference-manifest.js +1 -1
  33. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/agents/[id]/chat/page_client-reference-manifest.js +1 -1
  34. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/agents/[id]/email/page_client-reference-manifest.js +1 -1
  35. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/agents/[id]/files/page_client-reference-manifest.js +1 -1
  36. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/agents/[id]/meetings/page_client-reference-manifest.js +1 -1
  37. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/agents/[id]/page_client-reference-manifest.js +1 -1
  38. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/agents/new/page_client-reference-manifest.js +1 -1
  39. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/agents/page_client-reference-manifest.js +1 -1
  40. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/calendar/page_client-reference-manifest.js +1 -1
  41. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/flags/page_client-reference-manifest.js +1 -1
  42. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/help/email-setup/page_client-reference-manifest.js +1 -1
  43. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/home/page_client-reference-manifest.js +1 -1
  44. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/issues/page_client-reference-manifest.js +1 -1
  45. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/page_client-reference-manifest.js +1 -1
  46. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/runtimes/page_client-reference-manifest.js +1 -1
  47. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/settings/page_client-reference-manifest.js +1 -1
  48. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/traces/[traceId]/page_client-reference-manifest.js +1 -1
  49. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/traces/page_client-reference-manifest.js +1 -1
  50. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/unread/page_client-reference-manifest.js +1 -1
  51. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/workspaces/page_client-reference-manifest.js +1 -1
  52. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(auth)/sign-in/page_client-reference-manifest.js +1 -1
  53. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/c/channels/[serverId]/[channelId]/page_client-reference-manifest.js +1 -1
  54. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/c/channels/[serverId]/page_client-reference-manifest.js +1 -1
  55. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/c/channels/[serverId]/settings/page_client-reference-manifest.js +1 -1
  56. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/c/invite/[token]/page_client-reference-manifest.js +1 -1
  57. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/c/me/[dmId]/page_client-reference-manifest.js +1 -1
  58. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/c/me/bots/page_client-reference-manifest.js +1 -1
  59. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/c/me/friends/page_client-reference-manifest.js +1 -1
  60. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/c/me/machines/page_client-reference-manifest.js +1 -1
  61. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/c/me/page_client-reference-manifest.js +1 -1
  62. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/c/onboarding-preview/page_client-reference-manifest.js +1 -1
  63. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/c/page_client-reference-manifest.js +1 -1
  64. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/[root-of-the-server]__1exc8lx._.js +1 -1
  65. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_06ly4t9._.js +1 -1
  66. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_1dpddg5._.js +1 -1
  67. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_1n-91sn._.js +1 -1
  68. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/src_web_src_0-2rpii._.js +1 -1
  69. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/src_web_src_0tk6041._.js +1 -1
  70. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/src_web_src_app_(app)_w_[slug]_settings_0ag2edj._.js +1 -1
  71. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/middleware-build-manifest.js +3 -3
  72. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/middleware-manifest.json +5 -5
  73. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/server-reference-manifest.js +1 -1
  74. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/server-reference-manifest.json +1 -1
  75. package/bundled/web/.open-next/server-functions/default/src/web/handler.mjs +9 -9
  76. package/bundled/web/.open-next/server-functions/default/src/web/handler.mjs.meta.json +37 -37
  77. package/bundled/web/.open-next/server-functions/default/src/web/index.mjs +4 -4
  78. package/package.json +1 -1
  79. package/bundled/web/.open-next/assets/_next/static/chunks/0mu9kud4850o1.js +0 -5
  80. package/bundled/web/.open-next/assets/_next/static/chunks/2tl7jjpykd3mi.js +0 -1
  81. package/bundled/web/.open-next/assets/_next/static/chunks/41xwnd9igyovr.js +0 -20
  82. /package/bundled/web/.open-next/assets/_next/static/{JPtCnLnN72EaJMxDUPROm → cF14NSMWpDLveF91ebqUj}/_buildManifest.js +0 -0
  83. /package/bundled/web/.open-next/assets/_next/static/{JPtCnLnN72EaJMxDUPROm → cF14NSMWpDLveF91ebqUj}/_clientMiddlewareManifest.js +0 -0
  84. /package/bundled/web/.open-next/assets/_next/static/{JPtCnLnN72EaJMxDUPROm → cF14NSMWpDLveF91ebqUj}/_ssgManifest.js +0 -0
  85. /package/bundled/web/.open-next/cache/{JPtCnLnN72EaJMxDUPROm → cF14NSMWpDLveF91ebqUj}/favicon.ico.cache +0 -0
  86. /package/bundled/web/.open-next/cache/{JPtCnLnN72EaJMxDUPROm → cF14NSMWpDLveF91ebqUj}/robots.txt.cache +0 -0
@@ -156,7 +156,7 @@ var DOQueueHandler = class extends DurableObject {
156
156
  method: "HEAD",
157
157
  headers: {
158
158
  // This is defined during build
159
- "x-prerender-revalidate": "5044611aa212a877b099a14dc43a9400",
159
+ "x-prerender-revalidate": "7debab0d6146ccf8a22cdbe8b4c6fc10",
160
160
  "x-isr": "1"
161
161
  },
162
162
  // This one is kind of problematic, it will always show the wall time of the revalidation to `this.revalidationTimeout`
@@ -180,7 +180,7 @@ var DOQueueHandler = class extends DurableObject {
180
180
  "INSERT OR REPLACE INTO sync (id, lastSuccess, buildId) VALUES (?, unixepoch(), ?)",
181
181
  // We cannot use the deduplication id because it's not unique per route - every time a route is revalidated, the deduplication id is different.
182
182
  `${host}${url}`,
183
- "JPtCnLnN72EaJMxDUPROm"
183
+ "cF14NSMWpDLveF91ebqUj"
184
184
  );
185
185
  }
186
186
  this.routeInFailedState.delete(msg.MessageDeduplicationId);
@@ -232,7 +232,7 @@ var DOQueueHandler = class extends DurableObject {
232
232
  }
233
233
  this.routeInFailedState.set(msg.MessageDeduplicationId, updatedFailedState);
234
234
  if (!this.disableSQLite) {
235
- this.sql.exec("INSERT OR REPLACE INTO failed_state (id, data, buildId) VALUES (?, ?, ?)", msg.MessageDeduplicationId, JSON.stringify(updatedFailedState), "JPtCnLnN72EaJMxDUPROm");
235
+ this.sql.exec("INSERT OR REPLACE INTO failed_state (id, data, buildId) VALUES (?, ?, ?)", msg.MessageDeduplicationId, JSON.stringify(updatedFailedState), "cF14NSMWpDLveF91ebqUj");
236
236
  }
237
237
  await this.addAlarm();
238
238
  }
@@ -256,8 +256,8 @@ var DOQueueHandler = class extends DurableObject {
256
256
  return;
257
257
  this.sql.exec("CREATE TABLE IF NOT EXISTS failed_state (id TEXT PRIMARY KEY, data TEXT, buildId TEXT)");
258
258
  this.sql.exec("CREATE TABLE IF NOT EXISTS sync (id TEXT PRIMARY KEY, lastSuccess INTEGER, buildId TEXT)");
259
- this.sql.exec("DELETE FROM failed_state WHERE buildId != ?", "JPtCnLnN72EaJMxDUPROm");
260
- this.sql.exec("DELETE FROM sync WHERE buildId != ?", "JPtCnLnN72EaJMxDUPROm");
259
+ this.sql.exec("DELETE FROM failed_state WHERE buildId != ?", "cF14NSMWpDLveF91ebqUj");
260
+ this.sql.exec("DELETE FROM sync WHERE buildId != ?", "cF14NSMWpDLveF91ebqUj");
261
261
  const failedStateCursor = this.sql.exec("SELECT * FROM failed_state");
262
262
  for (const row of failedStateCursor) {
263
263
  this.routeInFailedState.set(row.id, JSON.parse(row.data));
@@ -1 +1 @@
1
- JPtCnLnN72EaJMxDUPROm
1
+ cF14NSMWpDLveF91ebqUj
@@ -0,0 +1,5 @@
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,888598,983036,605686,42308,264921,720182,959784,677495,680714,442827,124526,175931,85888,e=>{"use strict";let t,n;var r,i=e.i(274570),s=e.i(927299),l=e.i(318151),a=e.i(344431),o=e.i(243807),c=e.i(492346);function d(e,t,n){let r,i=n.initialDeps??[],s=!0;function l(){let l=e();return(l.length!==i.length||l.some((e,t)=>i[t]!==e))&&(i=l,r=t(...l),(null==n?void 0:n.onChange)&&!(s&&n.skipInitialOnChange)&&n.onChange(r),s=!1),r}return l.updateDeps=e=>{i=e},l}function u(e,t){if(void 0!==e)return e;throw Error(`Unexpected undefined${t?`: ${t}`:""}`)}let h=()=>{if(void 0!==t)return t;if("u"<typeof navigator)return t=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return t=!0;let e=navigator.maxTouchPoints;return t="MacIntel"===navigator.platform&&void 0!==e&&e>0},m=e=>{let{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},f=e=>e,g=e=>{let t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1)-t+1,r=Array(n);for(let e=0;e<n;e++)r[e]=t+e;return r},p=(e,t)=>{let n=e.scrollElement;if(!n)return;let r=e.targetWindow;if(!r)return;let i=e=>{let{width:n,height:r}=e;t({width:Math.round(n),height:Math.round(r)})};if(i(m(n)),!r.ResizeObserver)return()=>{};let s=new r.ResizeObserver(t=>{let r=()=>{let e=t[0];if(null==e?void 0:e.borderBoxSize){let t=e.borderBoxSize[0];if(t)return void i({width:t.inlineSize,height:t.blockSize})}i(m(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r()});return s.observe(n,{box:"border-box"}),()=>{s.unobserve(n)}},x={passive:!0},v="u"<typeof window||"onscrollend"in window,b=(e,t)=>((e,t,n)=>{var r,i;let s,l=e.scrollElement;if(!l)return;let a=e.targetWindow;if(!a)return;let o=e.options.useScrollendEvent&&v,c=0,d=o?null:(r=()=>t(c,!1),i=e.options.isScrollingResetDelay,Object.assign(function(...e){a.clearTimeout(s),s=a.setTimeout(()=>r.apply(this,e),i)},{cancel:()=>{a.clearTimeout(s)}})),u=e=>()=>{c=n(l),null==d||d(),t(c,e)},h=u(!0),m=u(!1);return l.addEventListener("scroll",h,x),o&&l.addEventListener("scrollend",m,x),()=>{l.removeEventListener("scroll",h),o&&l.removeEventListener("scrollend",m),null==d||d.cancel()}})(e,t,t=>{let{horizontal:n,isRtl:r}=e.options;return n?t.scrollLeft*(r&&-1||1):t.scrollTop}),y=(e,t,n)=>{if(n.options.useCachedMeasurements){let t=n.indexFromElement(e),r=n.options.getItemKey(t);return n.itemSizeCache.get(r)??n.options.estimateSize(t)}if(null==t?void 0:t.borderBoxSize){let e=t.borderBoxSize[0];if(e)return Math.round(e[n.options.horizontal?"inlineSize":"blockSize"])}if(!t){let t=n.indexFromElement(e),r=n.options.getItemKey(t),i=n.itemSizeCache.get(r);if(void 0!==i)return i}return e[n.options.horizontal?"offsetWidth":"offsetHeight"]},w=(e,{adjustments:t=0,behavior:n},r)=>{var i,s;null==(s=null==(i=r.scrollElement)?void 0:i.scrollTo)||s.call(i,{[r.options.horizontal?"left":"top"]:e+t,behavior:n})};class S{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var e,t,n;return(null==(n=null==(t=null==(e=this.targetWindow)?void 0:e.performance)?void 0:t.now)?void 0:n.call(t))??Date.now()},this.observer=(()=>{let e=null,t=()=>e||(this.targetWindow&&this.targetWindow.ResizeObserver?e=new this.targetWindow.ResizeObserver(e=>{e.forEach(e=>{let t=()=>{let t=e.target,n=this.indexFromElement(t);if(!t.isConnected){for(let[e,n]of(this.observer.unobserve(t),this.elementsCache))if(n===t){this.elementsCache.delete(e);break}return}this.isIndexInRange(n)&&this.shouldMeasureDuringScroll(n)&&this.resizeItem(n,this.options.measureElement(t,e,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(t):t()})}):null);return{disconnect:()=>{var n;null==(n=t())||n.disconnect(),e=null},observe:e=>{var n;return null==(n=t())?void 0:n.observe(e,{box:"border-box"})},unobserve:e=>{var n;return null==(n=t())?void 0:n.unobserve(e)}}})(),this.range=null,this.setOptions=e=>{var t,n;let r={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:f,rangeExtractor:g,onChange:()=>{},measureElement:y,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,anchorTo:"start",followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",useCachedMeasurements:!1};for(let t in e){let n=e[t];void 0!==n&&(r[t]=n)}let i=this.options,s=null,l=null,a=!1;if(void 0!==i&&i.enabled&&r.enabled&&"end"===r.anchorTo&&null!==this.scrollElement){let e=i.count,o=r.count,c=this.getMeasurements(),d=e>0?(null==(t=c[0])?void 0:t.key)??i.getItemKey(0):null,u=e>0?(null==(n=c[e-1])?void 0:n.key)??i.getItemKey(e-1):null;if(o!==e||e>0&&o>0&&(r.getItemKey(0)!==d||r.getItemKey(o-1)!==u)){a=!0;let t=e>0?this.getVirtualItemForOffset(this.getScrollOffset())??c[0]:null;t&&(s=[t.key,this.getScrollOffset()-t.start]);let n=!0===r.followOnAppend?"auto":r.followOnAppend||null;n&&o>e&&this.isAtEnd(i.scrollEndThreshold)&&(0===e||r.getItemKey(o-1)!==u)&&(l=n)}}this.options=r,a&&(this.pendingMin=0,this.itemSizeCacheVersion++);let o=!1,c=0;if(s&&null!==this.scrollOffset){let[e,t]=s,n=this.getMeasurements(),{count:r,getItemKey:i}=this.options,l=0;for(;l<r&&i(l)!==e;)l++;if(l<r){let e=n[l];if(e){let n=Math.max(0,e.start+t);n!==this.scrollOffset&&(c=n-this.scrollOffset,this.scrollOffset=n,o=!0)}}}(o||l)&&(this.pendingScrollAnchor=[o?s[0]:null,o?s[1]:0,l,c])},this.notify=e=>{var t,n;null==(n=(t=this.options).onChange)||n.call(t,this,e)},this.maybeNotify=d(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),e=>{this.notify(e)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(e=>e()),this.unsubs=[],this.observer.disconnect(),null!=this.rafId&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.isScrolling=!1,this.scrollDirection=null,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var e;let t=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==t){if(this.cleanup(),!t)return void this.maybeNotify();if(this.scrollElement=t,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=(null==(e=this.scrollElement)?void 0:e.window)??null,this.elementsCache.forEach(e=>{this.observer.observe(e)}),this.unsubs.push(this.options.observeElementRect(this,e=>{this.scrollRect=e,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(e,t)=>{if(t&&null===this._intendedScrollOffset&&e===this.scrollOffset)return;null!==this._intendedScrollOffset&&1.5>Math.abs(e-this._intendedScrollOffset)&&(e=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0;let n=this.getScrollOffset();this.scrollDirection=t?n===e?this.scrollDirection:n<e?"forward":"backward":null,this.scrollOffset=e,this.isScrolling=t,this._flushIosDeferredIfReady(),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),"addEventListener"in this.scrollElement){let e=this.scrollElement,t=()=>{this._iosTouching=!0,this._iosJustTouchEnded=!1,null!==this._iosTouchEndTimerId&&null!=this.targetWindow&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},n=()=>{this._iosTouching=!1,h()&&null!=this.targetWindow&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};e.addEventListener("touchstart",t,x),e.addEventListener("touchend",n,x),this.unsubs.push(()=>{e.removeEventListener("touchstart",t),e.removeEventListener("touchend",n),null!==this._iosTouchEndTimerId&&null!=this.targetWindow&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}let n=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,n&&this.scrollElement&&this.options.enabled){let[e,t,r,i]=n;null===e||r||(h()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?0!==i&&(this._iosDeferredAdjustment+=i):this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})),r&&this.scrollToEnd({behavior:r})}},this._flushIosDeferredIfReady=()=>{if(0===this._iosDeferredAdjustment||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;let e=this.getScrollOffset(),t=this.getMaxScrollOffset();if(e<0||e>t)return;if(this._iosDeferredAdjustment<0&&e>=t-1){this._iosDeferredAdjustment=0;return}let n=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(e,{adjustments:this.scrollAdjustments+=n,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??("function"==typeof this.options.initialOffset?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getMeasurementOptions=d(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode,this.options.gap],(e,t,n,r,i,s,l,a)=>(void 0!==this.prevLanes&&this.prevLanes!==s&&(this.lanesChangedFlag=!0),this.prevLanes=s,this.pendingMin=null,{count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:s,laneAssignmentMode:l,gap:a}),{key:!1}),this.isIndexInRange=e=>e>=0&&e<this.options.count,this.getMeasurements=d(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:s,laneAssignmentMode:l,gap:a},o)=>{let c=this.itemSizeCache;if(!i)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>e)for(let t of this.laneAssignments.keys())t>=e&&this.laneAssignments.delete(t);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),0!==this.measurementsCache.length||this.lanesSettling||(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(e=>{this.itemSizeCache.set(e.key,e.size)}));let d=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===e&&(this.lanesSettling=!1),1===s){var u;let i,s=2*e,l=this._flatMeasurements;if(!l||l.length<s){let e=new Float64Array(s);l&&d>0&&e.set(l.subarray(0,2*d)),l=e,this._flatMeasurements=l}if(0===d)i=t+n;else{let e=d-1;i=l[2*e]+l[2*e+1]+a}for(let t=d;t<e;t++){let e=r(t),n=c.get(e),s="number"==typeof n?n:this.options.estimateSize(t);l[2*t]=i,l[2*t+1]=s,i+=s+a}let o=(u=l,new Proxy(Array(e),{get(t,n,i){if("string"==typeof n){let i=n.charCodeAt(0);if(i>=48&&i<=57){let i=+n;if(Number.isInteger(i)&&i>=0&&i<e){let e=t[i];if(!e){let n=u[2*i];e=t[i]={index:i,key:r(i),start:n,size:u[2*i+1],end:n+u[2*i+1],lane:0}}return e}}if("length"===n)return e}return Reflect.get(t,n,i)}}));return this.measurementsCache=o,o}let h=this.measurementsCache.slice(0,d),m=Array(s).fill(void 0),f=new Float64Array(s),g=0;for(let e=0;e<d;e++){let t=h[e];t&&(void 0===m[t.lane]&&g++,m[t.lane]=e,f[t.lane]=t.end)}for(let i=d;i<e;i++){let e,o,d=r(i),u=this.laneAssignments.get(i),p="estimate"===l||c.has(d);if(void 0!==u&&this.options.lanes>1){let r=m[e=u],i=void 0!==r?h[r]:void 0;o=i?i.end+a:t+n}else if(g===s){let t=0,n=f[0],r=m[0];for(let e=1;e<s;e++){let i=f[e];(i<n||i===n&&m[e]<r)&&(t=e,n=i,r=m[e])}e=t,o=n+a,p&&this.laneAssignments.set(i,e)}else e=i%this.options.lanes,o=t+n,p&&this.laneAssignments.set(i,e);let x=c.get(d),v="number"==typeof x?x:this.options.estimateSize(i),b=o+v;h[i]={index:i,start:o,size:v,end:b,key:d,lane:e},void 0===m[e]&&g++,m[e]=i,f[e]=b}return this.measurementsCache=h,h},{key:!1,debug:()=>this.options.debug}),this.calculateRange=d(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(e,t,n,r)=>0===e.length||0===t?(this.range=null,null):(this.range=function(e,t,n,r,i){let s=e.length-1;if(e.length<=r)return{startIndex:0,endIndex:s};if(1===r&&null!==i){let e=function(e,t,n){let r=0;for(;r<=t;){let i=(r+t)/2|0,s=e[2*i];if(s<n)r=i+1;else{if(!(s>n))return i;t=i-1}}return r>0?r-1:0}(i,s,n),r=e,l=n+t;for(;r<s&&i[2*r]+i[2*r+1]<l;)r++;return{startIndex:e,endIndex:r}}let l=E(0,s,t=>e[t].start,n),a=l;if(1===r)for(;a<s&&e[a].end<n+t;)a++;else if(r>1){let i=Array(r).fill(0);for(;a<s&&i.some(e=>e<n+t);){let t=e[a];i[t.lane]=t.end,a++}let o=Array(r).fill(n+t);for(;l>=0&&o.some(e=>e>=n);){let t=e[l];o[t.lane]=t.start,l--}l=Math.max(0,l-l%r),a=Math.min(s,a+(r-1-a%r))}return{startIndex:l,endIndex:a}}(e,t,n,r,1===r&&null!=this._flatMeasurements?this._flatMeasurements:null),this.range),{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=d(()=>{let e=null,t=null,n=this.calculateRange();return n&&(e=n.startIndex,t=n.endIndex),this.maybeNotify.updateDeps([this.isScrolling,e,t]),[this.options.rangeExtractor,this.options.overscan,this.options.count,e,t]},(e,t,n,r,i)=>null===r||null===i?[]:e({startIndex:r,endIndex:i,overscan:t,count:n}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=e=>{let t=this.options.indexAttribute,n=e.getAttribute(t);return n?parseInt(n,10):(console.warn(`Missing attribute name '${t}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=e=>{var t;if(!this.scrollState||"smooth"!==this.scrollState.behavior)return!0;let n=this.scrollState.index??(null==(t=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))?void 0:t.index);if(void 0!==n&&this.range){let t=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),r=Math.max(0,n-t),i=Math.min(this.options.count-1,n+t);return e>=r&&e<=i}return!0},this.measureElement=e=>{if(!e)return void this.elementsCache.forEach((e,t)=>{e.isConnected||(this.observer.unobserve(e),this.elementsCache.delete(t))});let t=this.indexFromElement(e);if(!this.isIndexInRange(t))return;let n=this.options.getItemKey(t),r=this.elementsCache.get(n);r!==e&&(r&&this.observer.unobserve(r),this.observer.observe(e),this.elementsCache.set(n,e)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(t)&&this.resizeItem(t,this.options.measureElement(e,void 0,this))},this.resizeItem=(e,t)=>{var n,r;let i,s,l;if(!this.isIndexInRange(e))return;let a=this._flatMeasurements;if(1===this.options.lanes&&null!==a)l=this.options.getItemKey(e),s=a[2*e],i=a[2*e+1];else{let t=this.measurementsCache[e];if(!t)return;l=t.key,s=t.start,i=t.size}let o=this.itemSizeCache.get(l)??i,c=t-o;if(0!==c){let a="end"===this.options.anchorTo&&(null==(n=this.scrollState)?void 0:n.behavior)!=="smooth"&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,d=a?this.getTotalSize():0,u=this.getScrollOffset()+this.scrollAdjustments,h=this.itemSizeCache.has(l)?s+o<=u&&"backward"!==this.scrollDirection:s<u,m=(null==(r=this.scrollState)?void 0:r.behavior)!=="smooth"&&(void 0!==this.shouldAdjustScrollPositionOnItemSizeChange?this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[e]??{index:e,key:l,start:s,size:i,end:s+i,lane:0},c,this):h);(null===this.pendingMin||e<this.pendingMin)&&(this.pendingMin=e),this.itemSizeCache.set(l,t),this.itemSizeCacheVersion++;let f=!1;a?f=this.applyScrollAdjustment(this.getTotalSize()-d):m&&(f=this.applyScrollAdjustment(c)),this.notify(f)}},this.getVirtualItems=d(()=>[this.getVirtualIndexes(),this.getMeasurements()],(e,t)=>{let n=[];for(let r=0,i=e.length;r<i;r++){let i=t[e[r]];n.push(i)}return n},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=e=>{let t=this.getMeasurements();if(0===t.length)return;let n=this._flatMeasurements,r=1===this.options.lanes&&null!=n,i=E(0,t.length-1,r?e=>n[2*e]:e=>u(t[e]).start,e);return u(t[i])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{let e=this.scrollElement.document.documentElement;return this.options.horizontal?e.scrollWidth-this.scrollElement.innerWidth:e.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(e=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=e,this.getOffsetForAlignment=(e,t,n=0)=>{if(!this.scrollElement)return 0;let r=this.getSize(),i=this.getScrollOffset();return"auto"===t&&(t=e>=i+r?"end":"start"),"center"===t?e+=(n-r)/2:"end"===t&&(e-=r),Math.max(Math.min(this.getMaxScrollOffset(),e),0)},this.getOffsetForIndex=(e,t="auto")=>{e=Math.max(0,Math.min(e,this.options.count-1));let n=this.getSize(),r=this.getScrollOffset(),i=this.measurementsCache[e];if(!i)return;if("auto"===t)if(i.end>=r+n-this.options.scrollPaddingEnd)t="end";else{if(!(i.start<=r+this.options.scrollPaddingStart))return[r,t];t="start"}if("end"===t&&e===this.options.count-1)return[this.getMaxScrollOffset(),t];let s="end"===t?i.end+this.options.scrollPaddingEnd:i.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(s,t,i.size),t]},this.scrollToOffset=(e,{align:t="start",behavior:n="auto"}={})=>{this._iosDeferredAdjustment=0;let r=this.getOffsetForAlignment(e,t),i=this.now();this.scrollState={index:null,align:t,behavior:n,startedAt:i,lastTargetOffset:r,stableFrames:0},this._scrollToOffset(r,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollToIndex=(e,{align:t="auto",behavior:n="auto"}={})=>{this._iosDeferredAdjustment=0,e=Math.max(0,Math.min(e,this.options.count-1));let r=this.getOffsetForIndex(e,t);if(!r)return;let[i,s]=r,l=this.now();this.scrollState={index:e,align:s,behavior:n,startedAt:l,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollBy=(e,{behavior:t="auto"}={})=>{let n=this.getScrollOffset()+e,r=this.now();this.scrollState={index:null,align:"start",behavior:t,startedAt:r,lastTargetOffset:n,stableFrames:0},this._scrollToOffset(n,{adjustments:void 0,behavior:t}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:e="auto"}={})=>{this.options.count>0?this.scrollToIndex(this.options.count-1,{align:"end",behavior:e}):this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:e})},this.getTotalSize=()=>{var e;let t,n=this.getMeasurements();if(0===n.length)t=this.options.paddingStart;else if(1===this.options.lanes){let r=n.length-1,i=this._flatMeasurements;t=null!=i?i[2*r]+i[2*r+1]:(null==(e=n[r])?void 0:e.end)??0}else{let e=Array(this.options.lanes).fill(null),r=n.length-1;for(;r>=0&&e.some(e=>null===e);){let t=n[r];null===e[t.lane]&&(e[t.lane]=t.end),r--}t=Math.max(...e.filter(e=>null!==e))}return Math.max(t-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{let e=[];if(0===this.itemSizeCache.size)return e;for(let t of this.getMeasurements())t&&this.itemSizeCache.has(t.key)&&e.push({index:t.index,key:t.key,start:t.start,size:t.size,end:t.end,lane:t.lane});return e},this._scrollToOffset=(e,{adjustments:t,behavior:n})=>{this._intendedScrollOffset=e+(t??0),this.options.scrollToFn(e,{behavior:n,adjustments:t},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(e)}applyScrollAdjustment(e,t){return 0!==e&&(h()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?(this._iosDeferredAdjustment+=e,!1):(this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=e,behavior:t}),null!==this.scrollOffset&&(this.scrollOffset+=this.scrollAdjustments,this.scrollOffset<0&&(this.scrollOffset=0),this.scrollAdjustments=0),!0))}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}null==this.rafId&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}let e=null!=this.scrollState.index?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,t=e?e[0]:this.scrollState.lastTargetOffset,n=t!==this.scrollState.lastTargetOffset;if(!n&&1.01>Math.abs(t-this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=1){this.getScrollOffset()!==t&&this._scrollToOffset(t,{adjustments:void 0,behavior:"auto"}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,n){let e=this.getSize()||600,n=Math.abs(t-this.getScrollOffset()),r="smooth"===this.scrollState.behavior&&n>e;this.scrollState.lastTargetOffset=t,r||(this.scrollState.behavior="auto"),this._scrollToOffset(t,{adjustments:void 0,behavior:r?"smooth":"auto"})}this.scheduleScrollReconcile()}}let E=(e,t,n,r)=>{for(;e<=t;){let i=(e+t)/2|0,s=n(i);if(s<r)e=i+1;else{if(!(s>r))return i;t=i-1}}return e>0?e-1:0},C="u">typeof document?l.useLayoutEffect:l.useEffect;function j(e){return function({useFlushSync:e=!0,directDomUpdates:t=!1,directDomUpdatesMode:n="transform",...r}){let i=l.useReducer(e=>e+1,0)[1],s=l.useRef({enabled:t,mode:n,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});s.current.enabled=t,s.current.mode=n;let a=e=>{let t=s.current;if(!t.enabled||!t.container)return;let n=e.getTotalSize();if(n!==t.lastSize){t.lastSize=n;let r=e.options.horizontal?"width":"height";t.container.style[r]=`${n}px`}},c=e=>{let t=s.current;if(!t.enabled||!t.container)return;a(e);let n=!!e.options.horizontal,r="transform"===t.mode,i=n?"left":"top",l=e.options.scrollMargin;for(let s of e.getVirtualItems()){let a=s.start-l,o=e.elementsCache.get(s.key);o&&t.lastPositions.get(o)!==a&&(t.lastPositions.set(o,a),r?o.style.transform=n?`translate3d(${a}px, 0, 0)`:`translate3d(0, ${a}px, 0)`:o.style[i]=`${a}px`)}},d={...r,onChange:(t,n)=>{var l;let a=s.current,d=!0;if(a.enabled){c(t);let e=t.range,n=a.prevRange;(d=!n||n.isScrolling!==t.isScrolling||n.startIndex!==(null==e?void 0:e.startIndex)||n.endIndex!==(null==e?void 0:e.endIndex))&&(a.prevRange=e?{startIndex:e.startIndex,endIndex:e.endIndex,isScrolling:t.isScrolling}:null)}d&&(e&&n?(0,o.flushSync)(i):i()),null==(l=r.onChange)||l.call(r,t,n)}},[u]=l.useState(()=>{let e=new S(d);return Object.assign(e,{containerRef:t=>{let n=s.current;if(n.container=t,n.lastSize=null,t&&n.enabled){let r=e.getTotalSize();n.lastSize=r;let i=e.options.horizontal?"width":"height";t.style[i]=`${r}px`}}})});return u.setOptions(d),C(()=>u._didMount(),[]),C(()=>(a(u),u._willUpdate())),C(()=>{c(u)}),u}({observeElementRect:p,observeElementOffset:b,scrollToFn:w,...e})}e.s(["useVirtualizer",0,j],983036);let k={useFlushSync:!1,directDomUpdates:!0};function I(e,t){for(let n=0;n<e.length;n++){let r=e[n];if("message"===r.kind&&r.m.id===t)return n}return null}function T({scrollRef:e,hasMore:t,isFetching:n,onLoad:r,edge:i}){let s=(0,l.useRef)(null),a=(0,l.useRef)({onLoad:r,hasMore:t,isFetching:n}),o=(0,l.useRef)(!1),c=(0,l.useRef)(!1),d=(0,l.useRef)(n);return(0,l.useEffect)(()=>{a.current={onLoad:r,hasMore:t,isFetching:n}}),(0,l.useEffect)(()=>{let e=d.current;if(d.current=n,!t){c.current=!1,o.current=!1;return}e&&!n&&c.current&&o.current&&r&&(c.current=!1,r())},[t,n,r]),(0,l.useEffect)(()=>{let t=s.current,n=e.current;if(!t||!n)return;let r=new IntersectionObserver(e=>{let t=a.current;for(let n of e)if(o.current=n.isIntersecting,n.isIntersecting&&t.onLoad&&t.hasMore){t.isFetching?c.current=!0:t.onLoad();break}},{root:n,rootMargin:"200px"}),l=n.scrollTop,d=()=>{let e=n.scrollTop,t="start"===i?e<l:e>l;l=e;let r="start"===i?e<=200:n.scrollHeight-n.clientHeight-e<=200,s=a.current;t&&r&&o.current&&s.hasMore&&s.isFetching&&(c.current=!0)};return r.observe(t),n.addEventListener("scroll",d,{passive:!0}),()=>{c.current=!1,o.current=!1,n.removeEventListener("scroll",d),r.disconnect()}},[i,t,e]),s}e.s(["COMMUNITY_VIRTUALIZER_REACT_OPTIONS",0,k],605686),e.s(["useVirtualCursorSentinel",0,T],42308);var R=e.i(853049),N=e.i(434433),M=e.i(381153);function A({label:e}){return(0,i.jsxs)("div",{className:"my-2 flex items-center gap-2",children:[(0,i.jsx)(N.Separator,{className:"flex-1"}),(0,i.jsx)("span",{className:"text-xs text-muted-foreground",suppressHydrationWarning:!0,children:e}),(0,i.jsx)(N.Separator,{className:"flex-1"})]})}function O({dateLabel:e}){return(0,i.jsxs)("div",{"data-new-divider":!0,"data-testid":M.tid.newDivider,className:"relative my-1 flex items-center gap-2",children:[(0,i.jsx)(N.Separator,{className:"flex-1 bg-destructive/60"}),e&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("span",{className:"text-xs font-semibold text-destructive",suppressHydrationWarning:!0,children:e}),(0,i.jsx)(N.Separator,{className:"flex-1 bg-destructive/60"})]}),(0,i.jsx)("span",{className:"pointer-events-none absolute right-0 top-1/2 -translate-y-1/2 rounded-sm bg-destructive px-1.5 py-0.5 text-xs font-semibold text-white",style:{WebkitTextStroke:"0.4px currentColor"},children:"New"})]})}e.s(["DateDivider",0,A,"NewDivider",0,O],264921);var z=e.i(830028);let D=(0,l.memo)(function(e){let{m:t,viewerUserId:n,hoverCapable:r,pinned:s,highlighted:a,onOpenThread:o,onOpenProfile:c,onToggleReactionId:d,onReactId:u,onReplyId:h,mentionText:m,onInsertMentionText:f,onPinId:g,onMarkId:p,onCreateThreadId:x,onCopyId:v,onEditId:b,onRetryId:y,onDismissId:w,onJumpToId:S,onPreviewImage:E,onPreviewAttachment:C,resolveUserName:j,onImageLoad:k,selectMode:I,selected:T,onToggleSelectId:R,onEnterSelectId:N,onShareSingleId:M}=e,A=t.id,O=t.replyTo?.id,D=(0,l.useCallback)(e=>d?.(A,e),[d,A]),L=(0,l.useCallback)(e=>u?.(A,e),[u,A]),P=(0,l.useCallback)(()=>h?.(A),[h,A]),$=(0,l.useCallback)(()=>{m&&f?.(m)},[m,f]),_=(0,l.useCallback)(()=>g?.(A),[g,A]),F=(0,l.useCallback)(()=>p?.(A),[p,A]),H=(0,l.useCallback)(()=>x?.(A),[x,A]),W=(0,l.useCallback)(()=>v?.(A),[v,A]),B=(0,l.useCallback)(()=>b?.(A),[b,A]),U=(0,l.useCallback)(()=>y?.(A),[y,A]),q=(0,l.useCallback)(()=>w?.(A),[w,A]),V=(0,l.useCallback)(()=>{O&&S?.(O)},[S,O]),K=(0,l.useCallback)(()=>R?.(A),[R,A]),J=(0,l.useCallback)(()=>N?.(A),[N,A]),X=(0,l.useCallback)(()=>M?.(A),[M,A]);return(0,i.jsx)(z.Message,{m:t,viewerUserId:n,hoverCapable:r,pinned:s,highlighted:a,onOpenThread:o,onOpenProfile:c,onJumpReply:S&&O?V:void 0,onToggleReaction:d?D:void 0,onReact:u?L:void 0,onReply:h?P:void 0,onMentionAuthor:m&&f?$:void 0,onPin:g?_:void 0,onMark:p?F:void 0,onCreateThread:x?H:void 0,onCopy:v?W:void 0,onEdit:b?B:void 0,onRetry:y?U:void 0,onDismiss:w?q:void 0,onPreviewImage:E,onPreviewAttachment:C,resolveUserName:j,onImageLoad:k,selectMode:I,selected:T,onToggleSelect:R?K:void 0,onEnterSelect:N?J:void 0,onShareSingle:M?X:void 0})});e.s(["MessageRow",0,D],720182);var L=e.i(728886),P=e.i(323086),$=e.i(975995),_=e.i(270911),F=e.i(93952),H=e.i(186339),W=e.i(334240),B=e.i(329686),U=e.i(613349),q=e.i(853574);function V({typingNames:e,scrollCount:t,scrollMode:n,onScroll:r,selectMode:s,selectedCount:l,onCancelSelection:a,onShareSelection:o}){var c;let d=e.length>0,u=t>0,h="selection"===(c=s?{mode:"selection"}:{mode:"normal",left:d,center:u}).mode||c.center?"centered":c.left?"left-only":"empty";return"empty"===h?null:(0,i.jsx)("div",{"data-testid":M.tid.composerAccessoryRail,"data-selection":s?"active":"inactive","data-layout":h,className:"pointer-events-none absolute inset-x-0 bottom-2 z-20 px-2 sm:bottom-4 sm:px-4",children:(0,i.jsx)("div",{className:(0,U.cn)("grid w-full items-end gap-1 sm:gap-2","centered"===h&&"grid-cols-[minmax(0,1fr)_minmax(0,max-content)_minmax(0,1fr)]","left-only"===h&&"grid-cols-[minmax(0,1fr)]"),children:s?(0,i.jsxs)(i.Fragment,{children:[d&&(0,i.jsx)(K,{names:e},"left"),(0,i.jsx)("div",{className:"col-start-2 min-w-0 max-w-full justify-self-center",children:(0,i.jsx)(J,{selectedCount:l,onCancel:a,onShare:o})},"center")]}):(0,i.jsxs)(i.Fragment,{children:[d&&(0,i.jsx)("div",{className:"col-start-1 min-w-0 max-w-full",children:(0,i.jsx)(q.TypingIndicator,{names:e,className:"w-fit max-w-full"})},"left"),u&&(0,i.jsx)("div",{className:"col-start-2 min-w-0 max-w-full justify-self-center",children:(0,i.jsx)(X,{count:t,mode:n,onClick:r})},"center")]})})})}function K({names:e}){let t=(0,l.useRef)(null),n=(0,l.useRef)(null),r=(0,l.useMemo)(()=>JSON.stringify(e),[e]),[s,a]=(0,l.useState)({key:"",fits:!1}),o=s.key===r,c=o&&s.fits;return(0,l.useLayoutEffect)(()=>{let e=t.current,i=n.current;if(!e||!i)return;let s=()=>{var t,n;let s=(t=e.getBoundingClientRect().width,n=i.getBoundingClientRect().width,t>0&&n>0&&n<=t);a(e=>e.key===r&&e.fits===s?e:{key:r,fits:s})};if(s(),"u"<typeof ResizeObserver)return;let l=new ResizeObserver(s);return l.observe(e),l.observe(i),()=>l.disconnect()},[r]),(0,i.jsx)("div",{ref:t,"data-selection-typing-fit":o?c?"visible":"hidden":"pending",className:"relative col-start-1 min-w-0 max-w-full",children:(0,i.jsx)("div",{ref:n,"aria-hidden":!c,className:(0,U.cn)("w-max max-w-none",c?"relative":"invisible absolute bottom-0 left-0"),children:(0,i.jsx)(q.TypingIndicator,{names:e})})})}function J({selectedCount:e,onCancel:t,onShare:n}){return(0,i.jsxs)("div",{"data-testid":M.tid.messageSelectionToolbar,className:"pointer-events-auto flex h-10 w-fit min-w-0 max-w-full items-center gap-1 rounded-full border border-border/60 bg-card p-1 shadow-(--e2) sm:h-auto",children:[(0,i.jsxs)("span",{className:"min-w-0 flex-1 truncate px-1 text-xs text-muted-foreground sm:px-2 sm:text-sm",children:[e," selected"]}),(0,i.jsxs)(B.Tooltip,{children:[(0,i.jsxs)(B.TooltipTrigger,{render:(0,i.jsx)(H.Button,{size:"sm",variant:"ghost",onClick:t,"aria-label":"Cancel message selection",className:"relative h-8 w-11 shrink-0 rounded-lg px-0 text-foreground after:absolute after:-inset-y-1.5 after:inset-x-0 after:content-[''] sm:h-7 sm:w-auto sm:px-2 sm:after:hidden"}),children:[(0,i.jsx)(F.X,{className:"text-foreground"})," ",(0,i.jsx)("span",{className:"hidden text-foreground sm:inline",children:"Cancel"})]}),(0,i.jsx)(B.TooltipContent,{children:"Cancel selection"})]}),(0,i.jsxs)(H.Button,{size:"sm",disabled:0===e,onClick:n,"aria-label":`Share ${e} selected messages as image`,className:"relative h-8 shrink-0 rounded-lg px-2 after:absolute after:-inset-y-1.5 after:inset-x-0 after:content-[''] sm:h-7 sm:after:hidden",children:[(0,i.jsx)(_.ImageIcon,{}),(0,i.jsx)("span",{className:"sm:hidden",children:"Share"}),(0,i.jsx)("span",{className:"hidden sm:inline",children:"Share image"})]})]})}function X({count:e,mode:t,onClick:n}){if(e<=0)return null;let r="jump"===t?`Jump to present, ${e} unread below`:`Scroll to bottom, ${e} more below`;return(0,i.jsxs)("button",{type:"button","data-testid":M.tid.scrollToPresent,onClick:n,"aria-label":r,className:"pointer-events-auto flex h-8 items-center gap-1.5 justify-self-center rounded-full border border-border bg-background/90 pl-2 pr-3 text-xs font-medium text-foreground shadow-(--e1) backdrop-blur-sm transition-colors hover:bg-accent focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50",children:[(0,i.jsx)($.ArrowDown,{className:"size-3.5 text-muted-foreground"}),(0,i.jsx)(W.NumberTicker,{value:e})]})}var Y=e.i(667274);let G=(n=0,()=>(n+=1,`u${`0000${(1679616*Math.random()|0).toString(36)}`.slice(-4)}${n}`));function Q(e){let t=[];for(let n=0,r=e.length;n<r;n++)t.push(e[n]);return t}let Z=null;function ee(e={}){return Z||(Z=e.includeStyleProperties?e.includeStyleProperties:Q(window.getComputedStyle(document.documentElement)))}function et(e,t){let n=(e.ownerDocument.defaultView||window).getComputedStyle(e).getPropertyValue(t);return n?parseFloat(n.replace("px","")):0}function en(e,t={}){let n,r,i,s;return{width:t.width||(n=et(e,"border-left-width"),r=et(e,"border-right-width"),e.clientWidth+n+r),height:t.height||(i=et(e,"border-top-width"),s=et(e,"border-bottom-width"),e.clientHeight+i+s)}}function er(e){return new Promise((t,n)=>{let r=new Image;r.onload=()=>{r.decode().then(()=>{requestAnimationFrame(()=>t(r))})},r.onerror=n,r.crossOrigin="anonymous",r.decoding="async",r.src=e})}async function ei(e){return Promise.resolve().then(()=>new XMLSerializer().serializeToString(e)).then(encodeURIComponent).then(e=>`data:image/svg+xml;charset=utf-8,${e}`)}async function es(e,t,n){let r="http://www.w3.org/2000/svg",i=document.createElementNS(r,"svg"),s=document.createElementNS(r,"foreignObject");return i.setAttribute("width",`${t}`),i.setAttribute("height",`${n}`),i.setAttribute("viewBox",`0 0 ${t} ${n}`),s.setAttribute("width","100%"),s.setAttribute("height","100%"),s.setAttribute("x","0"),s.setAttribute("y","0"),s.setAttribute("externalResourcesRequired","true"),i.appendChild(s),s.appendChild(e),ei(i)}let el=(e,t)=>{if(e instanceof t)return!0;let n=Object.getPrototypeOf(e);return null!==n&&(n.constructor.name===t.name||el(n,t))};function ea(e,t,n,r){let i,s,l,a=window.getComputedStyle(e,n),o=a.getPropertyValue("content");if(""===o||"none"===o)return;let c=G();try{t.className=`${t.className} ${c}`}catch(e){return}let d=document.createElement("style");d.appendChild((i=`.${c}:${n}`,l=a.cssText?(s=a.getPropertyValue("content"),`${a.cssText} content: '${s.replace(/'|"/g,"")}';`):ee(r).map(e=>{let t=a.getPropertyValue(e),n=a.getPropertyPriority(e);return`${e}: ${t}${n?" !important":""};`}).join(" "),document.createTextNode(`${i}{${l}}`))),t.appendChild(d)}let eo="application/font-woff",ec="image/jpeg",ed={woff:eo,woff2:eo,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:ec,jpeg:ec,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function eu(e){let t;return ed[((t=/\.([^./]*?)$/g.exec(e))?t[1]:"").toLowerCase()]||""}function eh(e){return -1!==e.search(/^(data:)/)}function em(e,t){return`data:${t};base64,${e}`}async function ef(e,t,n){let r=await fetch(e,t);if(404===r.status)throw Error(`Resource "${r.url}" not found`);let i=await r.blob();return new Promise((e,t)=>{let s=new FileReader;s.onerror=t,s.onloadend=()=>{try{e(n({res:r,result:s.result}))}catch(e){t(e)}},s.readAsDataURL(i)})}let eg={};async function ep(e,t,n){var r,i,s;let l,a,o=(r=e,i=t,s=n.includeQueryParams,a=r.replace(/\?.*/,""),s&&(a=r),/ttf|otf|eot|woff2?/i.test(a)&&(a=a.replace(/.*\//,"")),i?`[${i}]${a}`:a);if(null!=eg[o])return eg[o];n.cacheBust&&(e+=(/\?/.test(e)?"&":"?")+new Date().getTime());try{let r=await ef(e,n.fetchRequestInit,({res:e,result:n})=>(t||(t=e.headers.get("Content-Type")||""),n.split(/,/)[1]));l=em(r,t)}catch(r){l=n.imagePlaceholder||"";let t=`Failed to fetch resource: ${e}`;r&&(t="string"==typeof r?r:r.message),t&&console.warn(t)}return eg[o]=l,l}async function ex(e){let t=e.toDataURL();return"data:,"===t?e.cloneNode(!1):er(t)}async function ev(e,t){if(e.currentSrc){let t=document.createElement("canvas"),n=t.getContext("2d");return t.width=e.clientWidth,t.height=e.clientHeight,null==n||n.drawImage(e,0,0,t.width,t.height),er(t.toDataURL())}let n=e.poster,r=eu(n);return er(await ep(n,r,t))}async function eb(e,t){var n;try{if(null==(n=null==e?void 0:e.contentDocument)?void 0:n.body)return await eC(e.contentDocument.body,t,!0)}catch(e){}return e.cloneNode(!1)}async function ey(e,t){return el(e,HTMLCanvasElement)?ex(e):el(e,HTMLVideoElement)?ev(e,t):el(e,HTMLIFrameElement)?eb(e,t):e.cloneNode(ew(e))}let ew=e=>null!=e.tagName&&"SVG"===e.tagName.toUpperCase();async function eS(e,t,n){var r,i;if(ew(t))return t;let s=[];return 0===(s=null!=e.tagName&&"SLOT"===e.tagName.toUpperCase()&&e.assignedNodes?Q(e.assignedNodes()):el(e,HTMLIFrameElement)&&(null==(r=e.contentDocument)?void 0:r.body)?Q(e.contentDocument.body.childNodes):Q((null!=(i=e.shadowRoot)?i:e).childNodes)).length||el(e,HTMLVideoElement)||await s.reduce((e,r)=>e.then(()=>eC(r,n)).then(e=>{e&&t.appendChild(e)}),Promise.resolve()),t}async function eE(e,t){let n=e.querySelectorAll?e.querySelectorAll("use"):[];if(0===n.length)return e;let r={};for(let i=0;i<n.length;i++){let s=n[i].getAttribute("xlink:href");if(s){let n=e.querySelector(s),i=document.querySelector(s);n||!i||r[s]||(r[s]=await eC(i,t,!0))}}let i=Object.values(r);if(i.length){let t="http://www.w3.org/1999/xhtml",n=document.createElementNS(t,"svg");n.setAttribute("xmlns",t),n.style.position="absolute",n.style.width="0",n.style.height="0",n.style.overflow="hidden",n.style.display="none";let r=document.createElementNS(t,"defs");n.appendChild(r);for(let e=0;e<i.length;e++)r.appendChild(i[e]);e.appendChild(n)}return e}async function eC(e,t,n){return n||!t.filter||t.filter(e)?Promise.resolve(e).then(e=>ey(e,t)).then(n=>eS(e,n,t)).then(n=>(function(e,t,n){if(el(t,Element)&&(!function(e,t,n){let r=t.style;if(!r)return;let i=window.getComputedStyle(e);i.cssText?(r.cssText=i.cssText,r.transformOrigin=i.transformOrigin):ee(n).forEach(n=>{let s=i.getPropertyValue(n);if("font-size"===n&&s.endsWith("px")){let e=Math.floor(parseFloat(s.substring(0,s.length-2)))-.1;s=`${e}px`}el(e,HTMLIFrameElement)&&"display"===n&&"inline"===s&&(s="block"),"d"===n&&t.getAttribute("d")&&(s=`path(${t.getAttribute("d")})`),r.setProperty(n,s,i.getPropertyPriority(n))})}(e,t,n),ea(e,t,":before",n),ea(e,t,":after",n),el(e,HTMLTextAreaElement)&&(t.innerHTML=e.value),el(e,HTMLInputElement)&&t.setAttribute("value",e.value),el(e,HTMLSelectElement))){let n=Array.from(t.children).find(t=>e.value===t.getAttribute("value"));n&&n.setAttribute("selected","")}return t})(e,n,t)).then(e=>eE(e,t)):null}let ej=/url\((['"]?)([^'"]+?)\1\)/g,ek=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,eI=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;async function eT(e,t,n,r,i){try{let s,l,a=n?function(e,t){if(e.match(/^[a-z]+:\/\//i))return e;if(e.match(/^\/\//))return window.location.protocol+e;if(e.match(/^[a-z]+:/i))return e;let n=document.implementation.createHTMLDocument(),r=n.createElement("base"),i=n.createElement("a");return n.head.appendChild(r),n.body.appendChild(i),t&&(r.href=t),i.href=e,i.href}(t,n):t,o=eu(t);if(i){let e=await i(a);s=em(e,o)}else s=await ep(a,o,r);return e.replace((l=t.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1"),RegExp(`(url\\(['"]?)(${l})(['"]?\\))`,"g")),`$1${s}$3`)}catch(e){}return e}function eR(e){return -1!==e.search(ej)}async function eN(e,t,n){let r;if(!eR(e))return e;let i=function(e,{preferredFontFormat:t}){return t?e.replace(eI,e=>{for(;;){let[n,,r]=ek.exec(e)||[];if(!r)return"";if(r===t)return`src: ${n};`}}):e}(e,n);return(r=[],i.replace(ej,(e,t,n)=>(r.push(n),e)),r.filter(e=>!eh(e))).reduce((e,r)=>e.then(e=>eT(e,r,t,n)),Promise.resolve(i))}async function eM(e,t,n){var r;let i=null==(r=t.style)?void 0:r.getPropertyValue(e);if(i){let r=await eN(i,null,n);return t.style.setProperty(e,r,t.style.getPropertyPriority(e)),!0}return!1}async function eA(e,t){await eM("background",e,t)||await eM("background-image",e,t),await eM("mask",e,t)||await eM("-webkit-mask",e,t)||await eM("mask-image",e,t)||await eM("-webkit-mask-image",e,t)}async function eO(e,t){let n=el(e,HTMLImageElement);if(!(n&&!eh(e.src))&&!(el(e,SVGImageElement)&&!eh(e.href.baseVal)))return;let r=n?e.src:e.href.baseVal,i=await ep(r,eu(r),t);await new Promise((r,s)=>{e.onload=r,e.onerror=t.onImageErrorHandler?(...e)=>{try{r(t.onImageErrorHandler(...e))}catch(e){s(e)}}:s,e.decode&&(e.decode=r),"lazy"===e.loading&&(e.loading="eager"),n?(e.srcset="",e.src=i):e.href.baseVal=i})}async function ez(e,t){let n=Q(e.childNodes).map(e=>eD(e,t));await Promise.all(n).then(()=>e)}async function eD(e,t){el(e,Element)&&(await eA(e,t),await eO(e,t),await ez(e,t))}let eL={};async function eP(e){let t=eL[e];if(null!=t)return t;let n=await fetch(e);return t={url:e,cssText:await n.text()},eL[e]=t,t}async function e$(e,t){let n=e.cssText,r=/url\(["']?([^"')]+)["']?\)/g;return Promise.all((n.match(/url\([^)]+\)/g)||[]).map(async i=>{let s=i.replace(r,"$1");return s.startsWith("https://")||(s=new URL(s,e.url).href),ef(s,t.fetchRequestInit,({result:e})=>(n=n.replace(i,`url(${e})`),[i,e]))})).then(()=>n)}function e_(e){if(null==e)return[];let t=[],n=e.replace(/(\/\*[\s\S]*?\*\/)/gi,""),r=RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})","gi");for(;;){let e=r.exec(n);if(null===e)break;t.push(e[0])}n=n.replace(r,"");let i=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,s=RegExp("((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})","gi");for(;;){let e=i.exec(n);if(null===e){if(null===(e=s.exec(n)))break;i.lastIndex=s.lastIndex}else s.lastIndex=i.lastIndex;t.push(e[0])}return t}async function eF(e,t){let n=[],r=[];return e.forEach(n=>{if("cssRules"in n)try{Q(n.cssRules||[]).forEach((e,i)=>{if(e.type===CSSRule.IMPORT_RULE){let s=i+1,l=e.href,a=eP(l).then(e=>e$(e,t)).then(e=>e_(e).forEach(e=>{try{n.insertRule(e,e.startsWith("@import")?s+=1:n.cssRules.length)}catch(t){console.error("Error inserting rule from remote css",{rule:e,error:t})}})).catch(e=>{console.error("Error loading remote css",e.toString())});r.push(a)}})}catch(s){let i=e.find(e=>null==e.href)||document.styleSheets[0];null!=n.href&&r.push(eP(n.href).then(e=>e$(e,t)).then(e=>e_(e).forEach(e=>{i.insertRule(e,i.cssRules.length)})).catch(e=>{console.error("Error loading remote stylesheet",e)})),console.error("Error inlining remote css file",s)}}),Promise.all(r).then(()=>(e.forEach(e=>{if("cssRules"in e)try{Q(e.cssRules||[]).forEach(e=>{n.push(e)})}catch(t){console.error(`Error while reading CSS rules from ${e.href}`,t)}}),n))}async function eH(e,t){if(null==e.ownerDocument)throw Error("Provided element is not within a Document");let n=Q(e.ownerDocument.styleSheets);return(await eF(n,t)).filter(e=>e.type===CSSRule.FONT_FACE_RULE).filter(e=>eR(e.style.getPropertyValue("src")))}function eW(e){return e.trim().replace(/["']/g,"")}async function eB(e,t){let n,r=await eH(e,t),i=(n=new Set,!function e(t){(t.style.fontFamily||getComputedStyle(t).fontFamily).split(",").forEach(e=>{n.add(eW(e))}),Array.from(t.children).forEach(t=>{t instanceof HTMLElement&&e(t)})}(e),n);return(await Promise.all(r.filter(e=>i.has(eW(e.style.fontFamily))).map(e=>{let n=e.parentStyleSheet?e.parentStyleSheet.href:null;return eN(e.cssText,n,t)}))).join("\n")}async function eU(e,t){let n=null!=t.fontEmbedCSS?t.fontEmbedCSS:t.skipFonts?null:await eB(e,t);if(n){let t=document.createElement("style"),r=document.createTextNode(n);t.appendChild(r),e.firstChild?e.insertBefore(t,e.firstChild):e.appendChild(t)}}async function eq(e,t={}){let{width:n,height:r}=en(e,t),i=await eC(e,t,!0);return await eU(i,t),await eD(i,t),!function(e,t){let{style:n}=e;t.backgroundColor&&(n.backgroundColor=t.backgroundColor),t.width&&(n.width=`${t.width}px`),t.height&&(n.height=`${t.height}px`);let r=t.style;null!=r&&Object.keys(r).forEach(e=>{n[e]=r[e]})}(i,t),await es(i,n,r)}async function eV(e,t={}){let{width:n,height:r}=en(e,t),i=await eq(e,t),s=await er(i),l=document.createElement("canvas"),a=l.getContext("2d"),o=t.pixelRatio||function(){let e,t;try{t=c.default}catch(e){}let n=t&&t.env?t.env.devicePixelRatio:null;return n&&Number.isNaN(e=parseInt(n,10))&&(e=1),e||window.devicePixelRatio||1}(),d=t.canvasWidth||n,u=t.canvasHeight||r;return l.width=d*o,l.height=u*o,!t.skipAutoScale&&(l.width>16384||l.height>16384)&&(l.width>16384&&l.height>16384?l.width>l.height?(l.height*=16384/l.width,l.width=16384):(l.width*=16384/l.height,l.height=16384):l.width>16384?(l.height*=16384/l.width,l.width=16384):(l.width*=16384/l.height,l.height=16384)),l.style.width=`${d}`,l.style.height=`${u}`,t.backgroundColor&&(a.fillStyle=t.backgroundColor,a.fillRect(0,0,l.width,l.height)),a.drawImage(s,0,0,l.width,l.height),l}async function eK(e,t={}){let n=await eV(e,t);return await function(e,t={}){return new Promise(e.toBlob?n=>{e.toBlob(n,t.type?t.type:"image/png",t.quality?t.quality:1)}:n=>{let r=window.atob(e.toDataURL(t.type?t.type:void 0,t.quality?t.quality:void 0).split(",")[1]),i=r.length,s=new Uint8Array(i);for(let e=0;e<i;e+=1)s[e]=r.charCodeAt(e);n(new Blob([s],{type:t.type?t.type:"image/png"}))})}(n)}var eJ=e.i(998808),eX=e.i(673660),eY=e.i(853068),eG=e.i(176726);let eQ=(0,e.i(494916).default)("highlighter",[["path",{d:"m9 11-6 6v3h9l3-3",key:"1a3l36"}],["path",{d:"m22 12-4.6 4.6a2 2 0 0 1-2.8 0l-5.2-5.2a2 2 0 0 1 0-2.8L14 4",key:"14a9rk"}]]);var eZ=e.i(221614);"function"==typeof SuppressedError&&SuppressedError;async function e0(e,t={},n){return window.__TAURI_INTERNALS__.invoke(e,t,n)}new WeakMap,new WeakMap,new WeakMap,new WeakMap;class e1{get rid(){var e=this,t=r;!1;if("function"==typeof t||!t.has(e))throw TypeError("Cannot read private member from an object whose class did not declare it");return t.get(e)}constructor(e){r.set(this,void 0),function(e,t,n){!1;!1;if("function"==typeof t||!t.has(e))throw TypeError("Cannot write private member to an object whose class did not declare it");t.set(e,n)}(this,r,e)}async close(){return e0("plugin:resources|close",{rid:this.rid})}}r=new WeakMap;class e2 extends e1{constructor(e){super(e)}static async new(e,t,n){return e0("plugin:image|new",{rgba:e3(e),width:t,height:n}).then(e=>new e2(e))}static async fromBytes(e){return e0("plugin:image|from_bytes",{bytes:e3(e)}).then(e=>new e2(e))}static async fromPath(e){return e0("plugin:image|from_path",{path:e}).then(e=>new e2(e))}async rgba(){return e0("plugin:image|rgba",{rid:this.rid}).then(e=>new Uint8Array(e))}async size(){return e0("plugin:image|size",{rid:this.rid})}}function e3(e){return null==e?null:"string"==typeof e?e:e instanceof e2?e.rid:e}async function e4(e){await e0("plugin:clipboard-manager|write_image",{image:e3(e)})}e.i(954194);var e8=e.i(824863),e6=e.i(275130),e5=e.i(779646),e7=e.i(531342),e9=e.i(655041),te=e.i(562080);let tt="data-hl";var tn=e.i(519534),tr=e.i(71977),ti=e.i(351777);class ts extends Error{stage;timedOut;constructor(e,t=!1,n){super(`Share-card render ${t?"timed out":"failed"} during ${e}`),this.stage=e,this.timedOut=t,this.name="ShareCardRenderError",this.cause=n}}class tl extends Error{constructor(){super("A share-card image did not finish loading in time"),this.name="ShareCardImageTimeoutError"}}class ta extends Error{constructor(){super("Share-card image pixels are not readable"),this.name="ShareImageSnapshotError"}}function to(){return new DOMException("Share-card render aborted","AbortError")}function tc(e){return e.hasAttribute("data-avatar-photo-state")||"identity"===e.getAttribute("data-remote-image-kind")}function td(e){return"failed"===e.getAttribute("data-avatar-photo-state")||"identity"===e.getAttribute("data-remote-image-kind")&&"error"===e.getAttribute("data-remote-image-state")}function tu(e){return"content"===e.getAttribute("data-remote-image-kind")&&"error"===e.getAttribute("data-remote-image-state")}async function th(e,t,n){let r=t=>{if(tc(e))return"fallback";throw t};if(n?.aborted)throw to();if(td(e))return"fallback";if(tu(e))throw new ta;if(!e.complete){let i=await new Promise(r=>{let i=!1,s=t=>{i||(i=!0,e.removeEventListener("load",l),e.removeEventListener("error",a),n?.removeEventListener("abort",o),clearTimeout(c),r(t))},l=()=>s("loaded"),a=()=>s("error"),o=()=>s("aborted"),c=setTimeout(()=>s("timeout"),Math.max(0,t-Date.now()));e.addEventListener("load",l,{once:!0}),e.addEventListener("error",a,{once:!0}),n?.addEventListener("abort",o,{once:!0}),e.complete?s(e.naturalWidth>0?"loaded":"error"):n?.aborted&&s("aborted")});if("aborted"===i)throw to();if("timeout"===i)return r(new tl);if("error"===i)return r(new ta)}if(td(e))return"fallback";if(tu(e))throw new ta;if(e.naturalWidth<=0||e.naturalHeight<=0)return r(new ta);if(e.decode){let r=await new Promise(r=>{let i=!1,s=e=>{i||(i=!0,n?.removeEventListener("abort",l),clearTimeout(a),r(e))},l=()=>s("aborted"),a=setTimeout(()=>s("timeout"),Math.max(0,t-Date.now()));n?.addEventListener("abort",l,{once:!0}),Promise.resolve().then(()=>e.decode()).then(()=>s("decoded"),()=>s("failed")),n?.aborted&&s("aborted")});if("aborted"===r)throw to();if(td(e))return"fallback";if(tu(e))throw new ta;if("decoded"!==r&&tc(e))return"fallback"}return"snapshot"}function tm(){return"function"!=typeof requestAnimationFrame?Promise.resolve():new Promise(e=>requestAnimationFrame(()=>e()))}async function tf(e,t=tm,n=5e3,r){let i=Date.now()+n,s=await Promise.all([...e.querySelectorAll("img")].map(async e=>({image:e,mode:await th(e,i,r)})));if(r?.aborted||(await t(),r?.aborted))throw to();return s.map(e=>{var t,n;if(tc(e.image)&&!("identity"===(t=e.image).getAttribute("data-remote-image-kind")?"ready"===t.getAttribute("data-remote-image-state"):"ready"===t.getAttribute("data-avatar-photo-state")))return{...e,mode:"fallback"};if("content"===(n=e.image).getAttribute("data-remote-image-kind")&&"ready"!==n.getAttribute("data-remote-image-state"))throw new ta;return e})}function tg(e){let t=e.getBoundingClientRect();if(t.width<=0||t.height<=0)return null;let n=(()=>{let n=document.createElement("canvas");n.width=Math.max(1,Math.round(2*t.width)),n.height=Math.max(1,Math.round(2*t.height));var r=t.width,i=t.height;for(let t of(n.className=e.className,n.style.cssText=e.style.cssText,[...e.attributes]))(t.name.startsWith("data-")||t.name.startsWith("aria-"))&&n.setAttribute(t.name,t.value);return n.style.width=`${r}px`,n.style.height=`${i}px`,n})();try{return!function(e,t,n){if(e.naturalWidth<=0||e.naturalHeight<=0)throw new ta;let r=t.getContext("2d");if(!r)throw new ta;let i=e.naturalWidth,s=e.naturalHeight,l=t.width,a=t.height,o=Math.min(l/i,a/s),c=Math.max(l/i,a/s),d="contain"===n?o:"cover"===n?c:"none"===n?2:"scale-down"===n?Math.min(2,o):null;if(null===d)return r.drawImage(e,0,0,l,a);let u=i*d,h=s*d;r.drawImage(e,(l-u)/2,(a-h)/2,u,h)}(e,n,getComputedStyle(e).objectFit),n.toDataURL(),n}catch{throw new ta}}async function tp(e,t=tg,n=tf,r=tm,i){let s=await n(e,void 0,void 0,i),l=[],a=!1,o=()=>{if(!a)for(let{image:e,replacement:t}of(a=!0,l.reverse()))t.parentNode&&t.replaceWith(e)};try{for(let{image:e,mode:n}of s){if(!e.parentNode)continue;if("fallback"===n){let t=document.createElement("span");t.hidden=!0,e.replaceWith(t),l.push({image:e,replacement:t});continue}let r=t(e);r&&(e.replaceWith(r),l.push({image:e,replacement:r}))}if(i?.aborted||(await r(),i?.aborted))throw to();return o}catch(e){throw o(),e}}function tx(e,t){return tp(e,tg,tf,tm,t)}async function tv(){let e=getComputedStyle(document.documentElement).getPropertyValue("--font-caveat").trim();document.fonts?.load&&e&&await document.fonts.load(`16px ${e}`),await document.fonts?.ready}async function tb(e,t=tx,n=eK,r={}){let i,s=r.timeoutMs??15e3,l=r.loadFonts??tv,a="snapshot",o=null,c=!1,d=!1,u=!1,h=null,m=e=>{a=e,r.onStage?.(e)},f=()=>{c=!0,o&&!d&&(m("cleanup"),d=!0,o())};m("snapshot");let g=new Promise((e,t)=>{i=t}),p=e=>{if(!u){u=!0,h=e;try{f(),i(e)}catch(e){h=new ts("cleanup",!1,e),i(h)}}},x=setTimeout(()=>p(new ts(a,!0)),s),v=()=>p(to());r.signal?.aborted?v():r.signal?.addEventListener("abort",v,{once:!0});let b=async()=>{try{if(o=await t(e,r.signal),c&&f(),h)throw h;m("fonts");try{await l()}catch{}if(h)throw h;m("rasterize");let i=await n(e,{pixelRatio:2,fetchRequestInit:{credentials:"same-origin"},backgroundColor:getComputedStyle(e).getPropertyValue("--card")?.trim()||void 0});if(h)throw h;if(!i)throw Error("Rasterizer returned no image");return i}catch(e){if(e instanceof ts)throw e;throw new ts(a,!1,e)}finally{try{f()}catch(e){throw new ts("cleanup",!1,e)}}};try{return await Promise.race([b(),g])}finally{clearTimeout(x),r.signal?.removeEventListener("abort",v)}}async function ty(e){(0,e8.isTauri)()&&(0,e8.isDesktop)()?await e4(await e.arrayBuffer()):await navigator.clipboard.write([new ClipboardItem({"image/png":e})])}async function tw(e,t,n=e=>{let n=URL.createObjectURL(e);try{let e=document.createElement("a");e.href=n,e.download=t,e.click()}finally{URL.revokeObjectURL(n)}}){await n(e)}function tS({m:e,open:t,onClose:n}){let r=(0,l.useMemo)(()=>Array.isArray(e)?e:[e],[e]),s=(0,tr.useProfilesByUserId)(),o=(0,l.useRef)(null),c=(0,l.useRef)(new Map),d=(0,l.useRef)({generation:0,active:null}),u=(0,l.useRef)(null),[h,m]=(0,l.useState)(null),[f,g]=(0,l.useState)(!1),[p,x]=(0,l.useState)(!1),v=(0,l.useCallback)(()=>[...c.current.values()].some(e=>e&&null!==e.querySelector(`mark[${tt}]`)),[]),b=(0,l.useCallback)(e=>{let t=c.current.get(e);if(!t)return;let n=window.getSelection?.();if(!n||n.isCollapsed||0===n.rangeCount)return;let r=n.getRangeAt(0);if(!t.contains(r.commonAncestorContainer))return;let i=function(e,t){if(t.collapsed)return 0;let n=function(e){let t=(e.ownerDocument??document).createTreeWalker(e,NodeFilter.SHOW_TEXT,{acceptNode:e=>e.data.length?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}),n=[],r=t.nextNode();for(;r;)n.push(r),r=t.nextNode();return n}(e);if(0===n.length)return 0;let r=function(e){let t=-1,n=-1;for(let r=0;r<e.length;r++)e[r].covered&&(-1===t&&(t=r),n=r);if(-1===t)return[];let r=e[t].startOffset??0,i=e[n].endOffset??e[n].length;return function(e,t){let{startIdx:n,startOffset:r,endIdx:i,endOffset:s}=t;if(n>i)return[];let l=[];for(let t=n;t<=i;t++){let a=e[t];if(!a||a.insideMark)continue;let o=t===n?r:0,c=t===i?s:a.length,d=Math.max(0,Math.min(o,a.length)),u=Math.max(0,Math.min(c,a.length));u>d&&l.push({idx:t,sliceStart:d,sliceEnd:u})}return l}(e,{startIdx:t,startOffset:r,endIdx:n,endOffset:i})}(n.map(e=>{let n="function"==typeof t.intersectsNode?t.intersectsNode(e):0===t.comparePoint(e,0)||0===t.comparePoint(e,e.data.length);return{length:e.data.length,insideMark:function(e){let t=e.parentNode,n=e.ownerDocument?.body??null;for(;t&&t!==n;){if(1===t.nodeType&&t.hasAttribute?.(tt))return!0;t=t.parentNode}return!1}(e),covered:n,...e===t.startContainer?{startOffset:t.startOffset}:{},...e===t.endContainer?{endOffset:t.endOffset}:{}}}));for(let e=r.length-1;e>=0;e--){let t=r[e];!function(e,t,n){let r=e;n<r.data.length&&r.splitText(n),t>0&&(r=r.splitText(t));let i=(r.ownerDocument??document).createElement("mark");i.setAttribute(tt,""),i.className="share-hl",r.parentNode?.replaceChild(i,r),i.appendChild(r)}(n[t.idx],t.sliceStart,t.sliceEnd)}return r.length}(t,r);n.removeAllRanges(),i>0&&x(v())},[v]),y=(0,l.useCallback)(()=>{for(let e of c.current.values())e&&(e.querySelectorAll(`mark[${tt}]`).forEach(e=>{let t=e.parentNode;if(t){for(;e.firstChild;)t.insertBefore(e.firstChild,e);t.removeChild(e)}}),e.normalize());x(!1)},[]),w=(0,l.useCallback)(()=>{let e=d.current;e.generation+=1,e.active?.controller.abort(),e.active=null,null!==u.current&&(window.clearTimeout(u.current),u.current=null)},[]);(0,l.useEffect)(()=>{t||w()},[w,t]),(0,l.useEffect)(()=>()=>w(),[w]);let S=(0,l.useCallback)(e=>{let t=d.current;if(t.active)return t.active.promise;let n=t.generation+1,i=new AbortController,l={id:n,controller:i,promise:Promise.resolve()};t.generation=n,t.active=l,null!==u.current&&(window.clearTimeout(u.current),u.current=null),g(!1),m(e);let a=r[0]?.authorId,c=a?(0,ti.readCommunityProfile)(s.get(a),a):null,h=`alook-message-${c?.name??"share"}.png`,f=()=>d.current.generation===n&&!i.signal.aborted;return l.promise=(async()=>{try{let t=o.current;if(!t)throw new ts("rasterize");let n=await tb(t,void 0,void 0,{signal:i.signal});if(!f()||("copy"===e?await ty(n):await tw(n,h),!f()))return;"copy"===e?(g(!0),eJ.toast.success("Image copied to clipboard"),u.current=window.setTimeout(()=>{f()&&(u.current=null,g(!1))},1600)):eJ.toast.success("Image downloaded")}catch(t){if(!f())return;eJ.toast.error(function(e){if(!(e instanceof ts))return null;let t={snapshot:"preparing images",fonts:"loading fonts",rasterize:"rendering the image",cleanup:"restoring the preview"}[e.stage];return e.timedOut?`Couldn't generate image — ${t} took too long`:`Couldn't generate image — ${t} failed`}(t)??("copy"===e?"Couldn't copy image — try Download instead":"Couldn't generate image"))}finally{if(d.current.active?.id!==n)return;d.current.active=null,i.signal.aborted||m(null)}})(),l.promise},[r,s]),E=(0,l.useCallback)(()=>{w(),m(null),g(!1),n()},[w,n]),C=(0,l.useCallback)(()=>S("copy"),[S]),j=(0,l.useCallback)(()=>S("download"),[S]);return(0,i.jsx)(e5.Dialog,{open:t,onOpenChange:e=>!e&&E(),children:(0,i.jsxs)(e5.DialogContent,{className:"w-180 max-w-[calc(100vw-2rem)] sm:max-w-[calc(100vw-2rem)] gap-0 p-0",children:[(0,i.jsx)(e5.DialogHeader,{className:"px-5 pt-5 pb-3",children:(0,i.jsx)(e5.DialogTitle,{children:r.length>1?`Share ${r.length} messages`:"Share message"})}),(0,i.jsx)("div",{className:"max-h-[60vh] overflow-y-auto bg-muted/40 px-6 py-6",children:(0,i.jsxs)("div",{ref:o,"data-share-card":!0,className:"rounded-xl bg-card p-5 shadow-(--e1)",children:[r.map(e=>{let t=e.authorId?(0,ti.readCommunityProfile)(s.get(e.authorId),e.authorId):null,n=e.replyTo?.authorId?(0,ti.readCommunityProfile)(s.get(e.replyTo.authorId),e.replyTo.authorId):null,r=(0,tn.displayReplyContent)(e.content??"",e.replyTo);return(0,i.jsxs)("div",{className:e.grouped?"mt-0.5":"mt-3 first:mt-0",children:[e.replyTo&&(0,i.jsxs)("div",{"data-testid":`message-share-reply-${e.id}`,className:"mb-1 ml-13 flex min-w-0 max-w-[calc(100%-3.25rem)] items-center gap-2 text-[13px] text-muted-foreground",children:[(0,i.jsx)("div",{className:"h-2 w-4 shrink-0 rounded-tl-md border-l-2 border-t-2 border-border"}),e.replyTo.deleted?(0,i.jsx)("span",{className:"italic",children:"Original message was deleted"}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)("span",{className:"shrink-0 font-medium text-foreground/80",children:["@",n?.name??e.replyTo.authorName]}),(0,i.jsx)("span",{className:"min-w-0 truncate",children:(0,e6.stripInlineMarkup)(e.replyTo.text)})]})]}),(0,i.jsxs)("div",{className:"flex gap-3",children:[e.grouped?(0,i.jsx)("div",{className:"w-10 shrink-0","aria-hidden":!0}):(0,i.jsx)(e7.Avatar,{label:t?.name??e.authorName??"Unknown",src:t?.avatar,seed:e.authorId,size:40}),(0,i.jsxs)("div",{className:"min-w-0 flex-1",children:[!e.grouped&&(0,i.jsxs)("div",{className:"mb-0.5 flex items-baseline gap-2",children:[(0,i.jsx)("span",{className:"min-w-0 max-w-full truncate text-[15px] font-semibold",style:{color:e.color??"var(--foreground)"},children:t?.name??e.authorName}),(0,i.jsx)("span",{"data-share-timestamp":!0,className:"shrink-0 text-xs text-muted-foreground",suppressHydrationWarning:!0,children:(0,a.formatMessageTime)(e.createdAt)})]}),r&&(0,i.jsx)("div",{ref:t=>{c.current.set(e.id,t)},onMouseUp:()=>b(e.id),className:"max-h-164 overflow-hidden line-clamp-32 [&_mark[data-hl]]:rounded-xs [&_mark[data-hl]]:bg-[rgba(255,208,92,0.5)] [&_mark[data-hl]]:p-[0_1px] [&_mark[data-hl]]:[box-decoration-break:clone] [&_mark[data-hl]]:[-webkit-box-decoration-break:clone] [&_mark[data-hl]]:text-inherit",children:(0,i.jsx)(e9.MessageBody,{text:r,perspective:"neutral"})}),e.attachments?.some(e=>"image"===e.kind)&&(0,i.jsx)("div",{"data-testid":`message-share-images-${e.id}`,className:"mt-2 flex flex-col gap-2",children:e.attachments.map((t,n)=>"image"===t.kind&&(0,i.jsx)("div",{className:"w-fit max-w-full overflow-hidden rounded-lg border border-border",children:(0,i.jsx)("img",{"data-testid":M.tid.messageShareImage(e.id,n),src:t.url,alt:t.name,width:t.width,height:t.height,loading:"eager",className:"block h-auto w-auto max-h-75 max-w-full rounded-lg object-contain",style:{aspectRatio:(0,te.attachmentAspectRatio)(t.width,t.height)}})},`${t.name}-${n}`))}),e.reactions&&e.reactions.length>0&&(0,i.jsx)("div",{"data-testid":`message-share-reactions-${e.id}`,className:"mt-2 flex flex-wrap gap-1",children:e.reactions.map(e=>(0,i.jsxs)("span",{className:["flex h-6 items-center gap-1 rounded-md px-2 text-sm",e.me?"border border-primary/50 bg-accent":"bg-secondary"].join(" "),children:[(0,i.jsx)("span",{children:e.emoji}),(0,i.jsx)("span",{className:"text-xs text-muted-foreground",children:e.count})]},e.emoji))})]})]})]},e.id)}),(0,i.jsxs)("div",{className:"mt-4 flex items-center gap-1.5 border-t border-border/50 pt-3",children:[(0,i.jsx)(Y.default,{src:"/alook.svg",alt:"",width:16,height:16}),(0,i.jsx)("span",{className:"text-sm font-bold tracking-tight text-muted-foreground",style:{fontFamily:"var(--font-brand)"},children:"Alook"})]})]})}),(0,i.jsxs)("div",{className:"flex items-center justify-between gap-2 px-5 pt-3 pb-5",children:[(0,i.jsx)("div",{children:p&&(0,i.jsxs)(H.Button,{variant:"ghost",size:"sm",onClick:y,disabled:null!==h,children:[(0,i.jsx)(eQ,{}),"Reset highlight"]})}),(0,i.jsxs)("div",{className:"flex gap-2",children:[(0,i.jsxs)(H.Button,{variant:"ghost",size:"sm",onClick:j,disabled:null!==h,children:["download"===h?(0,i.jsx)(eZ.Loader2,{className:"animate-spin"}):(0,i.jsx)(eG.Download,{}),"Download"]}),(0,i.jsxs)(H.Button,{size:"sm","data-testid":M.tid.messageShareCopy,onClick:C,disabled:null!==h,children:["copy"===h?(0,i.jsx)(eZ.Loader2,{className:"animate-spin"}):f?(0,i.jsx)(eX.Check,{}):(0,i.jsx)(eY.Copy,{}),f?"Copied":"Copy image"]})]})]})]})})}function tE(e,t,n){return(0,i.jsxs)("div",{className:"relative flex min-h-0 flex-1 flex-col",children:[t.shareOpen&&t.selectedMessages.length>0&&(0,i.jsx)(tS,{m:t.selectedMessages,open:t.shareOpen,onClose:t.closeShare}),(0,i.jsxs)("div",{"data-message-scroller-boundary":!0,className:"relative min-h-0 flex-1",children:[!t.isLoading&&(0,i.jsx)(V,{typingNames:e.typingUsers??[],scrollCount:t.pillCount,scrollMode:t.pillMode,onScroll:t.pillOnClick,selectMode:t.selectMode,selectedCount:t.selectedIds.size,onCancelSelection:t.exitSelect,onShareSelection:()=>t.setShareOpen(!0)}),(0,i.jsx)("div",{ref:t.scrollRef,"data-testid":M.tid.messageScroller,className:"h-full overflow-x-clip overflow-y-auto thin-scrollbar",children:(0,i.jsx)("div",{"data-message-list-content":!0,className:"flex min-h-full flex-col justify-end px-4 pb-14 pt-8 sm:pb-18",children:t.isLoading?(0,i.jsx)(tC,{variant:e.variant}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("div",{ref:t.heroRef,className:"mb-6",children:e.hasMore?(0,i.jsx)("div",{ref:t.topSentinelRef,className:"flex h-8 items-center justify-center text-xs text-muted-foreground",children:e.isFetchingOlder?"Loading older messages…":""}):e.hero??(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("div",{className:"mb-2 grid size-12 place-items-center rounded-full bg-muted/60",children:(0,i.jsx)(P.ChannelIcon,{className:"text-xl text-muted-foreground"})}),(0,i.jsx)("h2",{className:"text-xl font-semibold leading-tight",children:e.channel}),(0,i.jsx)("p",{className:"mt-2 text-sm text-muted-foreground",children:"Beginning of the channel. Say hello, share what you're working on, or drop a link."})]})}),n(),e.hasMoreNewer&&(0,i.jsx)("div",{ref:t.bottomSentinelRef,className:"mt-6 flex h-8 items-center justify-center text-xs text-muted-foreground",children:e.isFetchingNewer?"Loading newer messages…":""})]})})})]})]})}function tC({variant:e}){return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("div",{className:"mb-6",children:"dm"===e?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(L.Skeleton,{className:"mb-3 size-16 rounded-full"}),(0,i.jsx)(L.Skeleton,{className:"h-8 w-48 rounded"}),(0,i.jsx)(L.Skeleton,{className:"mt-2 h-5 w-72 rounded"})]}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(L.Skeleton,{className:"mb-2 size-12 rounded-full"}),(0,i.jsx)(L.Skeleton,{className:"h-7 w-40 rounded"}),(0,i.jsx)(L.Skeleton,{className:"mt-2 h-5 w-80 max-w-full rounded"})]})}),(0,i.jsx)("div",{className:"flex flex-col gap-3",children:[[220,140],[180],[260,90,200],[120,240],[200]].map((e,t)=>(0,i.jsxs)("div",{className:"flex gap-3 pt-1.5",children:[(0,i.jsx)(L.Skeleton,{className:"size-10 shrink-0 rounded-full"}),(0,i.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-2",children:[(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.jsx)(L.Skeleton,{className:"h-4 w-24 rounded"}),(0,i.jsx)(L.Skeleton,{className:"h-3 w-14 rounded"})]}),e.map((e,t)=>(0,i.jsx)(L.Skeleton,{className:"h-3.5 rounded",style:{width:e}},t))]})]},t))})]})}function tj({items:e,virtualizer:t,itemKey:n,renderItem:r}){return(0,i.jsx)("div",{ref:t.containerRef,style:{position:"relative",width:"100%"},children:t.getVirtualItems().map(s=>{let l=e[s.index];return(0,i.jsx)("div",{"data-index":s.index,ref:t.measureElement,style:{position:"absolute",top:0,left:0,width:"100%"},children:r(l,s.index)},n(l))})})}function tk({variant:e="channel",initialScrollReady:t=!0,...n}){let r=(0,R.useHoverCapable)(),s={...n,variant:e,initialScrollReady:t,hoverCapable:r},o=function({messages:e,loading:t,newDividerBefore:n,scrollToMessageId:r,initialScrollReady:i,hasMore:s,hasMoreNewer:o,isFetchingOlder:c,isFetchingNewer:d,onLoadOlder:u,onLoadNewer:h,onJumpToPresent:m,presentVersion:f,unreadCount:g,viewerUserId:p,hero:x,onScrollRoot:v,onScrollTargetConsumed:b}){let[y,w]=(0,l.useState)(null),S=(0,l.useMemo)(()=>(function(e,t,n=!1){let r=[],i=null,s=!1;for(let l of e){let e=i?(0,a.dateKey)(i.createdAt):"",o=(0,a.dateKey)(l.createdAt),c=!!(o&&o!==e),d=l.id===t;c&&d?r.push({kind:"new-divider",key:"new-divider",dateLabel:(0,a.formatDateLabel)(l.createdAt)}):(c&&r.push({kind:"date-divider",label:(0,a.formatDateLabel)(l.createdAt),key:`date:${o}`}),d&&r.push({kind:"new-divider",key:"new-divider"}));let u=!s&&n&&"chat"===l.type||!!(i&&"chat"===l.type&&!l.replyTo&&!c&&i.authorName===l.authorName&&i.createdAt&&l.createdAt&&new Date(l.createdAt).getTime()-new Date(i.createdAt).getTime()<42e4);r.push({kind:"message",m:{...l,grouped:u},key:function(e){let t=e.clientNonce;return!e.authorId||!t||t.startsWith("srv:")?`msg:id:${e.id}`:`msg:client:${JSON.stringify([e.authorId,t])}`}(l)}),s=!0,i=l}return r})(e,n,!!s),[e,n,s]),E=!!r&&e.some(e=>e.id===r),C=r?E:i,[R,N]=(0,l.useState)(!1),[M,A]=(0,l.useState)(()=>new Set),[O,z]=(0,l.useState)(!1),D=(0,l.useCallback)(e=>{N(!0),A(new Set([e]))},[]),L=(0,l.useCallback)(e=>{A(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),P=(0,l.useCallback)(()=>{N(!1),A(new Set)},[]),$=(0,l.useMemo)(()=>{if(0===M.size)return[];let e=S.flatMap(e=>"message"===e.kind&&M.has(e.m.id)?[e.m]:[]),t=null;return e.map(e=>{let n=!!(t&&!e.replyTo&&(t.authorId&&e.authorId?t.authorId===e.authorId:t.authorName===e.authorName)&&t.createdAt&&e.createdAt&&new Date(e.createdAt).getTime()-new Date(t.createdAt).getTime()<42e4);return t=e,{...e,grouped:n}})},[S,M]),_=(0,l.useRef)(null),[F,H]=(0,l.useState)(0),[W,B]=(0,l.useState)(!1),U=!!t&&0===e.length;(0,l.useEffect)(()=>{let e=_.current;if(!e)return;let t=new ResizeObserver(t=>{H(t[0]?.borderBoxSize?.[0]?.blockSize??e.offsetHeight),B(!0)});return t.observe(e),H(e.offsetHeight),B(!0),()=>t.disconnect()},[U,s,x]);let{scrollRef:q,virtualizer:V,belowCount:K,scrollToBottom:J,jumpTo:X,onImageLoad:Y}=function({items:e,newDividerBefore:t,initialScrollReady:n,hasMoreNewer:r,presentVersion:i,viewerUserId:s,heroHeight:a,heroMeasured:o}){let c=(0,l.useRef)(null),d=(0,l.useRef)({didInitialScroll:!1,didDividerConverge:!1,lastTailId:null}),u=function(e){let t=[];for(let n of e)"message"===n.kind&&t.push({id:n.m.id,authorId:n.m.authorId});return t}(e),h=u[u.length-1]?.id??null,m=(0,l.useRef)(!0),f=(0,l.useRef)(!0),g=(0,l.useRef)(!1),p=(0,l.useRef)(0),x=(0,l.useRef)(0),v=(0,l.useRef)(new WeakMap),b=(0,l.useRef)(!1),y=f.current&&!g.current?"end":"start",w=j({...k,count:e.length,getScrollElement:()=>c.current,estimateSize:t=>(function(e){var t;if("date-divider"===e.kind)return 32;if("new-divider"===e.kind)return e.dateLabel?32:24;let n=e.m,r=24+((t=n.content)?Math.min(20*Math.max(1,Math.ceil(t.length/55)),400):0)+function(e){if(!e.attachments?.length)return 0;let t=0;for(let n of e.attachments)"image"===n.kind&&(t+=n.width&&n.height?Math.min(300,Math.round(320*n.height/n.width)):200);return t}(n);return n.replyTo&&(r+=28),n.embeds?.length&&(r+=120*n.embeds.length),n.reactions?.length&&(r+=32),n.thread&&(r+=36),r})(e[t]),measureElement:e=>{let t=Math.ceil(Math.max(e.getBoundingClientRect().height,e.scrollHeight)),n=v.current.get(e);return v.current.set(e,t),void 0===n||n===t||!f.current||g.current||b.current||(b.current=!0,queueMicrotask(()=>{if(e.isConnected&&!g.current){let e=c.current;e&&(e.scrollTop=e.scrollHeight)}e.ownerDocument.defaultView?.requestAnimationFrame(()=>{if(b.current=!1,e.isConnected&&!g.current){let e=c.current;e&&(e.scrollTop=e.scrollHeight)}})})),t},getItemKey:t=>e[t].key,anchorTo:"end",followOnAppend:!1,scrollEndThreshold:100,scrollMargin:a,overscan:8});w.shouldAdjustScrollPositionOnItemSizeChange=(e,t,n)=>(function(e,t,n=!1){let r=(t.scrollOffset??0)+t.scrollAdjustments,i=!t.itemSizeCache.has(e.key);return(!i||!n&&"backward"!==t.scrollDirection)&&(i?e.start<r:e.end<=r)})(e,n,g.current),w.options.anchorTo=y,(0,l.useLayoutEffect)(()=>{let e=c.current;if(!e)return;p.current=e.clientHeight,x.current=e.scrollTop,f.current=1>=Math.max(0,e.scrollHeight-e.clientHeight-e.scrollTop);let t=()=>{let t=e.scrollTop,n=w.isAtEnd(100),r=m.current&&!n;m.current=n,n?(g.current=!1,w.options.anchorTo="end"):(r||t<x.current-1)&&(g.current=!0,w.options.anchorTo="start"),e.clientHeight===p.current&&(Math.max(0,e.scrollHeight-e.clientHeight-t)>1||t<x.current-1?f.current=!1:t>x.current&&(f.current=!0),x.current=t),w.options.anchorTo=f.current&&!g.current?"end":"start"},n=e=>{e.deltaY<0&&(f.current=!1,g.current=!0,w.options.anchorTo="start")},r=e=>{["ArrowUp","PageUp","Home"].includes(e.key)&&(f.current=!1,g.current=!0,w.options.anchorTo="start")};return e.addEventListener("scroll",t,{passive:!0}),e.addEventListener("wheel",n,{passive:!0}),e.addEventListener("keydown",r),()=>{e.removeEventListener("scroll",t),e.removeEventListener("wheel",n),e.removeEventListener("keydown",r)}},[w]),(0,l.useLayoutEffect)(()=>{let{action:i,nextState:l}=function(e){let{state:t,messages:n,newDividerBefore:r,initialScrollReady:i,heroMeasured:s,hasMoreNewer:l,viewerUserId:a,isAtEnd:o,userScrolledAway:c}=e,d=n[n.length-1]?.id??null,u=n.length,h={didInitialScroll:t.didInitialScroll,didDividerConverge:t.didDividerConverge,lastTailId:d};if(0===u)return{action:{type:"none"},nextState:{...h,didInitialScroll:!1,didDividerConverge:!1}};if(!t.didInitialScroll)return s&&c?{action:{type:"none"},nextState:{...h,didInitialScroll:!0,didDividerConverge:!0}}:s&&i?{action:{type:"mount",newDividerBefore:r},nextState:{...h,didInitialScroll:!0,didDividerConverge:!0}}:s&&!l?{action:{type:"scrollToEnd"},nextState:{...h,didInitialScroll:!0,didDividerConverge:!1}}:{action:{type:"none"},nextState:{...h,didInitialScroll:!1}};let m=null!==t.lastTailId&&t.lastTailId!==d;if(!t.didDividerConverge&&!m)return i&&s?r&&o&&!c?{action:{type:"mount",newDividerBefore:r},nextState:{...h,didDividerConverge:!0}}:{action:{type:"none"},nextState:{...h,didDividerConverge:!0}}:{action:{type:"none"},nextState:h};if(m){let e={...h,didDividerConverge:!0},t=n[n.length-1];return a&&t?.authorId===a||!l&&o&&!c?{action:{type:"scrollToEnd"},nextState:e}:{action:{type:"none"},nextState:e}}return{action:{type:"none"},nextState:h}}({state:d.current,messages:u,newDividerBefore:t,initialScrollReady:n,heroMeasured:o,hasMoreNewer:r,viewerUserId:s,isAtEnd:m.current,userScrolledAway:g.current});switch(d.current=l,i.type){case"mount":{let t=i.newDividerBefore?function(e,t){let n=I(e,t);if(null===n)return null;let r=e.findIndex(e=>"new-divider"===e.kind);return -1!==r?r:n}(e,i.newDividerBefore):null;null!==t?w.scrollToIndex(t,{align:"center"}):(f.current=!0,w.options.anchorTo="end",w.scrollToEnd());return}case"scrollToEnd":f.current=!0,w.options.anchorTo="end",w.scrollToEnd();return;case"none":return}},[e,t,n,o,r,s,w]);let S=(0,l.useRef)(0);(0,l.useLayoutEffect)(()=>{i&&h&&!r&&S.current!==i&&(S.current=i,d.current={didInitialScroll:!0,didDividerConverge:!0,lastTailId:h},m.current=!0,f.current=!0,g.current=!1,w.options.anchorTo="end",w.scrollToEnd())},[r,i,h,w]);let E=(0,l.useRef)(a);(0,l.useLayoutEffect)(()=>{let e=c.current;if(!e)return;let t=a-E.current;E.current=a,0!==t&&(e.scrollTop+=t)},[a]),(0,l.useLayoutEffect)(()=>{let e=c.current;if(!e)return;p.current=e.clientHeight,x.current=e.scrollTop;let t=new ResizeObserver(()=>{let t=p.current,n=e.clientHeight;if(n===t)return;let r=f.current;p.current=n,x.current=e.scrollTop,r&&!g.current&&(f.current=!0,w.options.anchorTo="end",w.scrollToEnd())});return t.observe(e),()=>t.disconnect()},[w]);let C=w.range?.endIndex??-1,T=w.isAtEnd(100)?0:function(e,t){let n=0;for(let r=t+1;r<e.length;r++)"message"===e[r].kind&&n++;return n}(e,C),R=(0,l.useCallback)(()=>{g.current=!1,m.current=!0,f.current=!0,w.options.anchorTo="end",w.scrollToEnd({behavior:"smooth"})},[w]),N=(0,l.useCallback)(()=>{f.current&&!g.current&&(f.current=!0,w.options.anchorTo="end",w.scrollToEnd())},[w]),M=(0,l.useCallback)((t,n="smooth")=>{let r=I(e,t);null!==r&&w.scrollToIndex(r,{align:"center",behavior:n})},[e,w]);return{scrollRef:c,virtualizer:w,belowCount:T,scrollToBottom:R,jumpTo:M,onImageLoad:N}}({items:S,newDividerBefore:n,initialScrollReady:C,hasMoreNewer:o,presentVersion:f,viewerUserId:p,heroHeight:F,heroMeasured:W});(0,l.useLayoutEffect)(()=>{let e=q.current;if(!e||!R||0===M.size)return;let t=0,n=0,r=0,i=()=>{t=window.requestAnimationFrame(()=>{n+=1;let t=e.parentElement?.querySelector('[data-selection="active"]'),s=Array.from(e.querySelectorAll("[data-msg-id]")).filter(e=>M.has(e.dataset.msgId??""));if(t&&s.length>0){let n=t.getBoundingClientRect().top,i=Math.max(...s.map(e=>e.getBoundingClientRect().bottom))+8-n;i>1?(e.scrollTop+=i,r=0):r+=1}else r=0;r<2&&n<120&&i()})};return i(),()=>window.cancelAnimationFrame(t)},[R,M,q]),(0,l.useEffect)(()=>{if(v)return v(q.current),()=>v(null)},[v,q]);let G=T({scrollRef:q,hasMore:s,isFetching:c,onLoad:u,edge:"start"}),Q=T({scrollRef:q,hasMore:o,isFetching:d,onLoad:h,edge:"end"}),Z=(0,l.useRef)(null),ee=(0,l.useRef)(null),et=(0,l.useCallback)((e,t="smooth")=>{null!==Z.current&&clearTimeout(Z.current),null!==ee.current&&window.cancelAnimationFrame(ee.current),w(e),X(e,t);let n=0,r=()=>{ee.current=null;let t=window.setTimeout(()=>{w(t=>t===e?null:t),Z.current===t&&(Z.current=null)},1600);Z.current=t},i=()=>{let t=q.current,s=t?Array.from(t.querySelectorAll("[data-msg-id]")).find(t=>t.dataset.msgId===e):void 0;if(t&&s){let e=t.getBoundingClientRect(),n=s.getBoundingClientRect();if(n.bottom>e.top&&n.top<e.bottom)return void r()}(n+=1)>=120?r():ee.current=window.requestAnimationFrame(i)};ee.current=window.requestAnimationFrame(i)},[X,q]);(0,l.useEffect)(()=>()=>{null!==Z.current&&clearTimeout(Z.current),null!==ee.current&&window.cancelAnimationFrame(ee.current)},[]);let en=(0,l.useRef)(null);(0,l.useEffect)(()=>{if(!r){en.current=null;return}en.current===r||E&&W&&(en.current=r,et(r,"auto"),b?.(r))},[r,E,W,et,b]);let er=!!o,ei=(0,l.useCallback)(()=>{z(!1),P()},[P]);return{items:S,isLoading:U,jumped:y,selectMode:R,selectedIds:M,selectedMessages:$,shareOpen:O,setShareOpen:z,exitSelect:P,closeShare:ei,onEnterSelectId:D,onToggleSelectId:L,heroRef:_,scrollRef:q,virtualizer:V,topSentinelRef:G,bottomSentinelRef:Q,onImageLoad:Y,jumpTo:et,pillCount:er?(g??K)||0:K,pillMode:er?"jump":"scroll",pillOnClick:er?m??J:J}}(s);return tE(s,o,()=>(0,i.jsx)(tj,{items:o.items,virtualizer:o.virtualizer,itemKey:e=>e.key,renderItem:e=>(0,i.jsxs)(i.Fragment,{children:["date-divider"===e.kind&&(0,i.jsx)(A,{label:e.label}),"new-divider"===e.kind&&(0,i.jsx)(O,{dateLabel:e.dateLabel}),"message"===e.kind&&(0,i.jsx)("div",{"data-msg-id":e.m.id,"data-testid":M.tid.message(e.m.id),children:(0,i.jsx)(D,{m:e.m,hoverCapable:s.hoverCapable,viewerUserId:s.viewerUserId,pinned:s.pinnedIds?.has(e.m.id),highlighted:o.jumped===e.m.id,onOpenThread:s.onOpenThread,onOpenProfile:s.onOpenProfile,onToggleReactionId:s.onToggleReaction,onReactId:s.onReact,onReplyId:s.onReply,mentionText:e.m.authorId?s.resolveAuthorMentionText?.(e.m.authorId)??void 0:void 0,onInsertMentionText:s.onInsertMentionText,onPinId:s.onPin,onMarkId:s.onMark,onCreateThreadId:s.onCreateThread,onCopyId:s.onCopy,onEditId:e.m.authorId===s.viewerUserId?s.onEdit:void 0,onRetryId:s.onRetry,onDismissId:s.onDismiss,onJumpToId:o.jumpTo,onPreviewImage:s.onPreviewImage,onPreviewAttachment:s.onPreviewAttachment,resolveUserName:s.resolveUserName,onImageLoad:o.onImageLoad,selectMode:o.selectMode,selected:o.selectedIds.has(e.m.id),onToggleSelectId:o.onToggleSelectId,onEnterSelectId:o.onEnterSelectId})})]})}))}e.s(["MessageShareDialog",0,tS],959784),e.s(["MessageListSkeleton",0,function({variant:e="channel"}){return(0,i.jsx)("div",{"aria-busy":"true","data-message-list-skeleton":!0,className:"relative flex min-h-0 flex-1 flex-col",children:(0,i.jsx)("div",{"data-message-scroller-boundary":!0,className:"relative min-h-0 flex-1",children:(0,i.jsx)("div",{"data-testid":M.tid.messageScroller,className:"h-full overflow-x-clip overflow-y-auto thin-scrollbar",children:(0,i.jsx)("div",{"data-message-list-content":!0,className:"flex min-h-full flex-col justify-end px-4 pb-14 pt-8 sm:pb-18",children:(0,i.jsx)(tC,{variant:e})})})})})},"renderMessageListView",0,tE],677495),e.s(["VirtualRows",0,tj],680714),e.s(["MessageList",0,tk],442827);var tI=e.i(957355),tT=e.i(262602),tT=tT,tR=e.i(922484),tN=e.i(300802),tM=e.i(271763),tA=e.i(715783),tO=e.i(177417),tz=e.i(874321),tD=e.i(111092),tL=e.i(686988);function tP(e){let t=e.editor?.view;return t?()=>{let n=e.editor?.state?.selection?.head??e.editor?.state?.selection?.to??e.range?.to;if(void 0===n)return e.clientRect?.()??null;try{return function(e){let{top:t,bottom:n,left:r,right:i}=e;return{top:t,bottom:n,left:r,right:i,x:r,y:t,width:Math.max(0,i-r),height:Math.max(0,n-t),toJSON:()=>({top:t,bottom:n,left:r,right:i})}}(t.coordsAtPos(n))}catch{return e.clientRect?.()??null}}:e.clientRect??null}function t$(e){return{id:e.id,label:e.name,serverId:e.serverId,serverName:e.serverName,serverDiscriminator:e.serverDiscriminator}}let t_={items:[],selectedIndex:0,command:null,getRect:null};function tF(e,t){let n=t.toLowerCase(),r=[],i=[];for(let t of e){let e=t.name.toLowerCase();!n||e.startsWith(n)?r.push(t):e.includes(n)&&i.push(t)}return[...r,...i].slice(0,8)}let tH=tz.default.extend({name:"channelRef",addAttributes(){return{...this.parent?.(),serverId:{default:null},serverName:{default:null},serverDiscriminator:{default:null}}}});function tW(e){let{candidatesRef:t,popupRef:n,onIntentRef:r,setPopup:i,queryRef:s}=e,l=!1;return tH.configure({HTMLAttributes:{class:"channel-ref-highlight"},renderText:({node:e})=>{let{serverId:t,serverName:n,serverDiscriminator:r,id:i,label:s}=e.attrs,l=n&&r?(0,tL.formatHandle)(n,r):t,a=s||i;return l?a?`/${l}/${a}`:`/${l}`:a?`/${a}`:""},renderHTML:({options:e,node:t})=>["span",e.HTMLAttributes,`/${t.attrs.label??t.attrs.id}`],suggestion:{char:"/",pluginKey:new tD.PluginKey("channelRefSuggestion"),items:({query:e})=>(l||(l=!0,r?.current?.()),s&&(s.current=e),tF(t.current,e)),render:()=>({onStart:e=>{i({items:e.items??[],query:e.query??"",selectedIndex:0,command:e.command,getRect:tP(e)})},onUpdate:e=>{i(t=>({items:e.items??[],query:e.query??"",selectedIndex:t.selectedIndex<(e.items?.length??0)?t.selectedIndex:0,command:e.command,getRect:tP(e)}))},onKeyDown:({event:e})=>{if(e.isComposing)return!1;let t=n.current;if(0===t.items.length)return!1;if("ArrowDown"===e.key)return e.preventDefault(),i({...t,selectedIndex:(t.selectedIndex+1)%t.items.length}),!0;if("ArrowUp"===e.key)return e.preventDefault(),i({...t,selectedIndex:(t.selectedIndex-1+t.items.length)%t.items.length}),!0;if("Enter"===e.key||"Tab"===e.key){e.preventDefault();let n=t.items[t.selectedIndex];return n&&t.command&&t.command(t$(n)),i(t_),!0}return"Escape"===e.key&&(i(t_),!0)},onExit:()=>{l=!1,i(t_)}})}})}function tB(e){if(!e)return;let t=e.querySelector('[aria-selected="true"]');t&&(e.scrollTop=function(e,t,n,r){if(n<e+4)return Math.max(0,n-4);let i=n+r;return i>e+t-4?i-t+4:e}(e.scrollTop,e.clientHeight,t.offsetTop,t.offsetHeight))}function tU({state:e,presentation:t}){let n=(0,l.useRef)(null),{items:r,selectedIndex:s,command:a,getRect:c}=e,d=(0,tO.useAnchoredPopover)(c,null!==a);if((0,l.useEffect)(()=>{tB(n.current)},[s,d]),!d||!a)return null;let u=r.findIndex(e=>"member"===e.kind),h=r.some(e=>"member"!==e.kind)&&u>0;return(0,o.createPortal)((0,i.jsx)("div",{"data-testid":M.tid.mentionPopup,className:"fixed z-100 w-64 rounded-lg border border-border bg-popover p-1 text-popover-foreground shadow-(--e2)",style:(0,tO.anchoredPopoverStyle)(d.rect,d.viewport,256,240),children:(0,i.jsxs)("div",{ref:n,className:"relative overflow-x-hidden overflow-y-auto thin-scrollbar",style:{maxHeight:"var(--anchored-popover-max-height)"},children:[r.map((e,t)=>(0,i.jsx)(tX,{item:e,selected:t===s,showMembersHeader:h&&t===u,onSelect:()=>a({id:e.id,label:e.label})},`${e.kind}:${e.id}`)),"ready"!==t.status&&(0,i.jsx)(tq,{status:t.status,hasItems:r.length>0})]})}),document.body)}function tq({status:e,hasItems:t}){return(0,i.jsx)("div",{"data-testid":M.tid.mentionStatus,"data-state":e,className:"px-2 py-2 text-xs text-muted-foreground",children:"error"===e?"Couldn’t load members":"empty"===e?"No matching members":"loading-more"===e&&t?"Loading more…":"Loading members…"})}function tV({state:e,presentation:t}){let n=(0,l.useRef)(null),{items:r,selectedIndex:s,command:a,getRect:c}=e,d=null!==a&&(r.length>0||void 0!==t),u=(0,tO.useAnchoredPopover)(c,d);if((0,l.useEffect)(()=>{tB(n.current)},[s,u]),!u||!d||!a)return null;let h=r.some(e=>e.serverId!==r[0]?.serverId);return(0,o.createPortal)((0,i.jsx)("div",{"data-testid":M.tid.channelRefPopup,className:"fixed z-100 w-64 rounded-lg border border-border bg-popover p-1 text-popover-foreground shadow-(--e2)",style:(0,tO.anchoredPopoverStyle)(u.rect,u.viewport,256,240),children:(0,i.jsxs)("div",{ref:n,className:"relative overflow-x-hidden overflow-y-auto thin-scrollbar",style:{maxHeight:"var(--anchored-popover-max-height)"},children:[r.map((e,t)=>(0,i.jsx)(tJ,{item:e,selected:t===s,showServerPrefix:h,onSelect:()=>a(t$(e))},e.id)),t&&"ready"!==t.status&&(0,i.jsx)(tK,{status:t.status})]})}),document.body)}function tK({status:e}){return(0,i.jsx)("div",{"data-testid":M.tid.channelRefStatus,"data-state":e,className:"px-2 py-2 text-xs text-muted-foreground",children:"error"===e?"Couldn’t load channels":"empty"===e?"No matching channels":"Loading channels…"})}function tJ({item:e,selected:t,showServerPrefix:n,onSelect:r}){return(0,i.jsxs)("button",{type:"button",role:"option","data-testid":M.tid.channelRefOption(e.id),"aria-selected":t,title:n?`${e.serverName} / ${e.name}`:e.name,className:["flex w-full min-w-0 items-center gap-2 rounded-md px-2 py-2 text-left text-sm transition-colors",t?"bg-accent":"hover:bg-accent/50"].join(" "),onMouseDown:e=>{e.preventDefault(),r()},children:[(0,i.jsx)("span",{"data-suggestion-icon":!0,className:"inline-flex shrink-0",children:(0,i.jsx)(P.ChannelIcon,{className:"size-3.5 text-muted-foreground"})}),(0,i.jsxs)("span",{"data-suggestion-label":!0,className:"min-w-0 flex-1 truncate font-medium",children:[n&&(0,i.jsxs)("span",{className:"text-muted-foreground",children:[e.serverName," / "]}),e.name]})]})}function tX({item:e,selected:t,showMembersHeader:n,onSelect:r}){return(0,i.jsxs)(i.Fragment,{children:[n&&(0,i.jsx)("div",{className:"-mx-1 mt-1 border-t border-border/60 px-2 pt-2 pb-1 text-xs font-semibold text-muted-foreground",children:"Members"}),(0,i.jsxs)("button",{type:"button",role:"option","data-testid":M.tid.mentionOption(e.id),"aria-selected":t,title:"member"===e.kind?`${e.name}#${e.discriminator}`:`@${e.label}`,className:["flex w-full min-w-0 items-center gap-2 rounded-md px-2 py-2 text-left text-sm transition-colors",t?"bg-accent":"hover:bg-accent/50"].join(" "),onMouseDown:e=>{e.preventDefault(),r()},children:["member"===e.kind?(0,i.jsx)("span",{"data-suggestion-icon":!0,className:"shrink-0",children:(0,i.jsx)(e7.Avatar,{label:e.avatar,seed:e.userId,size:24,presence:e.status,ringColor:"var(--popover)"})}):(0,i.jsx)("span",{"data-suggestion-icon":!0,className:"grid size-6 shrink-0 place-items-center rounded-full bg-primary/15 text-primary",children:(0,i.jsx)(tA.Users,{className:"size-3.5"})}),"member"===e.kind?(0,i.jsxs)("span",{className:"flex min-w-0 flex-1 items-baseline font-medium",children:[(0,i.jsx)("span",{"data-suggestion-label":!0,className:"min-w-0 truncate",children:e.name}),(0,i.jsxs)("span",{"data-suggestion-discriminator":!0,className:"ml-1 shrink-0 text-xs font-normal tracking-wide text-muted-foreground",children:["#",e.discriminator]})]}):(0,i.jsxs)("span",{"data-suggestion-label":!0,className:"min-w-0 flex-1 truncate font-medium",children:["@",e.label]}),"member"!==e.kind&&(0,i.jsx)("span",{className:"ml-auto shrink-0 text-xs text-muted-foreground",children:"Notify everyone"})]})]})}function tY(e){return(0,i.jsx)("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",focusable:"false",...e,children:(0,i.jsx)("path",{d:"M12.8147 12.1969L5.28344 13.4521C5.10705 13.4815 4.95979 13.6029 4.89723 13.7704L2.29933 20.7278C2.05066 21.3673 2.72008 21.9773 3.33375 21.6705L21.3337 12.6705C21.8865 12.3941 21.8865 11.6052 21.3337 11.3288L3.33375 2.32885C2.72008 2.02201 2.05066 2.63206 2.29933 3.2715L4.89723 10.2289C4.95979 10.3964 5.10705 10.5178 5.28344 10.5472L12.8147 11.8024C12.9236 11.8205 12.9972 11.9236 12.9791 12.0325C12.965 12.1168 12.899 12.1829 12.8147 12.1969Z",fill:"currentColor"})})}function tG({isForumThreadBody:e,dragging:t,onDragEnter:n,onDragLeave:r,onDragOver:s,onDrop:l,mentionPopup:a,mentionPresentation:o,channelRefPopup:c,channelRefPresentation:d,replyingTo:u,onCancelReply:h,pendingFiles:m,removePendingFile:f,fileInputRef:g,onFileSelect:p,editor:x,hideAttach:v,hideEmoji:b,showSend:y,sendDisabled:w,onSend:S,onUploadFile:E,onEmojiPick:C}){let j=u?(0,e6.stripInlineMarkup)(u.text).replace(/\s+/g," ").trim():null;return(0,i.jsxs)("div",{className:e?"relative":"relative px-3 pb-3 pt-0",onDragEnter:n,onDragLeave:r,onDragOver:s,onDrop:l,children:[(0,i.jsx)(tU,{state:a,presentation:o}),(0,i.jsx)(tV,{state:c,presentation:d}),u&&(0,i.jsxs)("div",{className:"flex items-center gap-2 rounded-t-xl border border-b-0 border-border/40 bg-muted/60 px-4 py-2 text-xs text-muted-foreground",children:[(0,i.jsxs)("div",{"data-slot":"composer-reply-preview",className:"min-w-0 flex-1 truncate",children:["Replying to"," ",(0,i.jsx)("span",{className:"font-medium text-foreground",children:u.authorName}),(0,i.jsx)("span",{"aria-hidden":"true",children:" · "}),(0,i.jsx)("span",{className:"text-foreground/70",children:j})]}),(0,i.jsx)("button",{onClick:h,className:"ml-auto grid size-4 shrink-0 place-items-center rounded-full hover:bg-foreground/10 hover:text-foreground","aria-label":"Cancel reply",children:(0,i.jsx)(F.X,{className:"size-3.5"})})]}),m.length>0&&(0,i.jsx)("div",{className:`flex flex-wrap gap-2 border-x border-b border-border/40 bg-muted/40 px-4 py-2 ${u?"":"rounded-t-xl border-t"}`,children:m.map((e,t)=>{let n=e.file.type.startsWith("image/");return(0,i.jsxs)("div",{className:"group relative flex items-center gap-2 rounded-md border border-border bg-background px-3 py-2 text-xs",children:[n?(0,i.jsx)(_.ImageIcon,{className:"size-3.5 text-muted-foreground"}):(0,i.jsx)(tT.default,{className:"size-3.5 text-muted-foreground"}),(0,i.jsx)("span",{className:"max-w-30 truncate text-foreground",children:e.file.name}),(0,i.jsx)("button",{onClick:()=>f(t),className:"grid size-4 shrink-0 place-items-center rounded-full hover:bg-destructive/10 hover:text-destructive","aria-label":"Remove file",children:(0,i.jsx)(F.X,{className:"size-3"})})]},t)})}),(0,i.jsxs)("div",{className:`relative ${e?"bg-transparent ring-0":"bg-muted shadow-(--e1) ring-1 ring-border/40 transition-shadow focus-within:ring-2 focus-within:ring-ring/60"} ${u||m.length>0?"rounded-b-xl":"rounded-xl"}`,children:[t&&(0,i.jsx)("div",{className:`pointer-events-none absolute inset-0 z-10 grid place-items-center border-2 border-dashed border-ring bg-background/80 ${u||m.length>0?"rounded-b-xl":"rounded-xl"}`,children:(0,i.jsx)("p",{className:"text-sm font-medium text-muted-foreground",children:"Drop files here"})}),(0,i.jsx)("input",{"data-testid":M.tid.composerFileInput,ref:g,type:"file",multiple:!0,onChange:p,className:"hidden"}),(0,i.jsx)("div",{className:`chat-composer relative py-3 ${e?"px-2":y?"pl-12 pr-24":"px-12"}`,"data-testid":M.tid.composerInput,children:(0,i.jsx)(tI.EditorContent,{editor:x,className:`${e?"max-h-60":"max-h-40"} overflow-y-auto thin-scrollbar text-base chat-input-line-height outline-none`})}),!v&&(0,i.jsx)("button",{type:"button","data-testid":M.tid.composerAttach,className:"absolute left-2 bottom-2 grid size-8 place-items-center rounded-full text-muted-foreground hover:bg-accent hover:text-foreground","aria-label":"Add file",onClick:E,children:(0,i.jsx)(tR.PlusCircle,{className:"size-5"})}),!b&&(0,i.jsx)(tM.EmojiPickerPopover,{side:"top",align:"end",onPick:C,children:(0,i.jsx)("button",{className:`absolute bottom-2 grid size-8 place-items-center rounded-full text-muted-foreground hover:bg-accent hover:text-foreground aria-expanded:bg-accent aria-expanded:text-foreground ${y?"right-12":"right-2"}`,"aria-label":"Emoji picker",children:(0,i.jsx)(tN.Smile,{className:"size-5"})})}),y&&(0,i.jsx)("button",{type:"button","data-testid":M.tid.composerSend,className:"absolute right-2 bottom-2 grid size-8 place-items-center rounded-[8px] bg-primary text-primary-foreground enabled:hover:bg-primary/90 enabled:active:bg-primary/80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:bg-transparent disabled:text-muted-foreground","aria-label":"Send message",disabled:w,onClick:S,children:(0,i.jsx)(tY,{className:"size-5"})})]})]})}function tQ(){return(0,i.jsx)("div",{className:"relative px-3 pb-3 pt-0",children:(0,i.jsxs)("div",{className:"relative rounded-xl bg-muted py-3 pl-12 pr-24 shadow-(--e1) ring-1 ring-border/40 sm:px-12",children:[(0,i.jsx)(L.Skeleton,{className:"h-6 w-2/5 rounded"}),(0,i.jsx)(L.Skeleton,{className:"absolute left-2 bottom-2 size-8 rounded-full"}),(0,i.jsx)(L.Skeleton,{className:"absolute right-12 bottom-2 size-8 rounded-full sm:right-2"}),(0,i.jsx)(L.Skeleton,{className:"absolute right-2 bottom-2 size-8 rounded-full sm:hidden"})]})})}e.s(["EMPTY_CHANNEL_REF_STATE",0,t_,"buildCommunityChannelRefExtension",0,tW,"rankChannelRefItems",0,tF,"toChannelRefCandidate",0,function(e,t){return{id:t.id,name:t.name,serverId:e.id,serverName:e.name,serverDiscriminator:e.discriminator}},"toChannelRefCommandProps",0,t$],124526),e.s(["ComposerSkeleton",0,tQ,"ComposerView",0,tG],175931);var tZ=e.i(263106),t0=e.i(258060),t1=e.i(908967),t2=e.i(184526);function t3(e){return`c-composer-draft:${e}`}function t4(e){try{localStorage.removeItem(t3(e))}catch{}}let t8=["everyone"],t6=t8.map(e=>({kind:e,id:e,label:e}));function t5(e,t,n){if("dm"===t)return[];let r=n.toLowerCase(),i=t6.filter(e=>!r||e.label.startsWith(r)),s=[],l=[];for(let t of e){if(!t.discriminator){"u">typeof console&&console.warn(`rankMentionItems: skipping member ${t.id} with no discriminator`);continue}let e=t.name.toLowerCase(),n={kind:"member",id:t.id,userId:t.userId,label:`${t.name}#${t.discriminator}`,name:t.name,discriminator:t.discriminator,avatar:t.avatar,status:t.status};!r||e.startsWith(r)?s.push(n):e.includes(r)&&l.push(n)}return[...i,...s,...l]}let t7={items:[],query:"",selectedIndex:0,command:null,getRect:null},t9=/(?:\r\n?|\n){2,}/;var ne=e.i(148005),nt=e.i(807827),nn=e.i(635408),nr=e.i(867823);let ni=/^([1-9]\d*)\.\s$/,ns=nt.OrderedList.extend({addInputRules(){var e;return[(e=this.type,(0,nr.wrappingInputRule)({find:ni,type:e,getAttributes:e=>({start:Number(e[1])}),joinPredicate:(e,t)=>(!t.attrs.type||"1"===t.attrs.type)&&t.childCount+t.attrs.start===Number(e[1])}))]}});function nl(e,t){return e.replaceAll("\n",`
2
+ ${" ".repeat(t)}`)}function na(e,t){return(0,nr.getText)(e,{blockSeparator:"\n\n",textSerializers:t})}let no=/[\p{L}\p{N}_-]/u;function nc(e){let{from:t,to:n}=e.selection,r=e.doc.textBetween(Math.max(0,t-2),t,"\n","\n"),i=e.doc.textBetween(n,Math.min(e.doc.content.size,n+2),"\n","\n"),s=Array.from(r).at(-1),l=Array.from(i)[0];return{leading:!!s&&no.test(s),trailing:void 0===l||no.test(l)}}function nd(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n].id!==t[n].id||e[n].name!==t[n].name||e[n].serverId!==t[n].serverId||e[n].serverName!==t[n].serverName||e[n].serverDiscriminator!==t[n].serverDiscriminator)return!1;return!0}let nu=(0,l.forwardRef)(function(e,t){let n=function({channel:e,context:t,members:n,mentionCandidates:r,channelRefCandidates:i=[],channelRefCandidateSource:s,onChannelRefIntent:a,sendContract:o,onAcceptSend:c,onDeferredSubmit:d,onTyping:u,replyingTo:h,onCancelReply:m,autoFocus:f=!1,mode:g="chat",placeholder:p,hideEmoji:x=!1,hideAttach:v=!1,onDirty:b,draftKey:y},w){let S="forumThreadBody"===g,E=(0,R.useHoverCapable)(),C=(0,l.useRef)(E),[j,k]=(0,l.useState)(!1),[I,T]=(0,l.useState)(!1);(0,l.useLayoutEffect)(()=>{C.current=E},[E]);let{pendingFiles:N,setPendingFiles:M,transferPendingFiles:A,awaitPendingFiles:O,addPendingFiles:z,fileInputRef:D,handleFileSelect:L,removePendingFile:P,dragging:$,handleDragEnter:_,handleDragLeave:F,handleDragOver:H,handleDrop:W}=(0,t2.useFileAttachments)({maxFileSize:t1.MAX_ATTACHMENT_SIZE_BYTES,maxFiles:t1.MAX_ATTACHMENTS_PER_MESSAGE,thumbnailPolicy:"community",draftSessionScope:S?void 0:y}),B=(0,l.useRef)(N),U=(0,l.useRef)(1);(0,l.useLayoutEffect)(()=>{B.current=N},[N]);let q=(0,l.useRef)(null),V=(0,l.useRef)(()=>{}),K=(0,l.useRef)(null),J=(0,l.useRef)(null),X=(0,l.useRef)(0),Y=(0,l.useRef)(y),G=(0,l.useRef)(null),Q=(0,l.useRef)(0);(0,l.useLayoutEffect)(()=>{let n=`${t}\u0000${e}\u0000${y??""}`;G.current!==n&&(G.current=n,Q.current++,U.current=1),Y.current=y},[e,t,y]),(0,l.useLayoutEffect)(()=>()=>{X.current++},[]);let Z=(0,l.useRef)(!1),ee=p??("channel"===t?`Message /${e}`:`Message ${e}`),et=(0,l.useRef)(ee),en=(0,l.useCallback)(()=>et.current,[]),er=function({members:e,context:t,mentionCandidates:n,channelRefCandidates:r,channelRefCandidateSource:i,onChannelRefIntent:s}){let[a,o]=(0,l.useState)(t7),c=(0,l.useRef)(a);(0,l.useEffect)(()=>{c.current=a},[a]);let[d,u]=(0,l.useState)(t_),h=(0,l.useRef)(d);(0,l.useEffect)(()=>{h.current=d},[d]);let m=(0,l.useRef)(e),f=(0,l.useRef)(t),g=(0,l.useRef)(n?.search),p=(0,l.useRef)("");(0,l.useEffect)(()=>{m.current=e},[e]),(0,l.useLayoutEffect)(()=>{let e=g.current;"dm"===t&&p.current&&e?.(""),g.current=n?.search},[t,n?.search]),(0,l.useLayoutEffect)(()=>{f.current=t,"dm"===t&&(p.current="",c.current=t7,o(t7))},[t]);let[x]=(0,l.useState)(()=>(function(e){let{membersRef:t,contextRef:n,popupRef:r,setPopup:i,onSearchMembersRef:s,queryRef:l}=e;return tz.default.configure({HTMLAttributes:{class:"mention-highlight"},renderText:({node:e})=>`@${e.attrs.label??e.attrs.id}`,renderHTML:({options:e,node:t})=>["span",e.HTMLAttributes,`@${(t.attrs.label??t.attrs.id??"").replace(/#\d{4,}$/,"")}`],suggestion:{char:"@",allow:()=>"dm"!==n.current,items:({query:e})=>"dm"===n.current?[]:(l&&(l.current=e),s?.current?.(e),t5(e&&s?.current?[]:t.current,n.current,e)),render:()=>({onStart:e=>{"dm"!==n.current&&i({items:e.items??[],query:l?.current??e.query??"",selectedIndex:0,command:e.command,getRect:tP(e)})},onUpdate:e=>{"dm"!==n.current&&i(t=>({items:e.items??[],query:l?.current??e.query??"",selectedIndex:t.selectedIndex<(e.items?.length??0)?t.selectedIndex:0,command:e.command,getRect:tP(e)}))},onKeyDown:({event:e})=>{if("dm"===n.current||e.isComposing)return!1;let t=r.current;if(0===t.items.length)return!1;if("ArrowDown"===e.key)return e.preventDefault(),i({...t,selectedIndex:(t.selectedIndex+1)%t.items.length}),!0;if("ArrowUp"===e.key)return e.preventDefault(),i({...t,selectedIndex:(t.selectedIndex-1+t.items.length)%t.items.length}),!0;if("Enter"===e.key||"Tab"===e.key){e.preventDefault();let n=t.items[t.selectedIndex];return n&&t.command&&t.command({id:n.id,label:n.label}),s?.current?.(""),i(t7),!0}return"Escape"===e.key&&(s?.current?.(""),i(t7),!0)},onExit:()=>{"dm"!==n.current&&(s?.current?.(""),i(t7))}})}})})({membersRef:m,contextRef:f,popupRef:c,setPopup:o,onSearchMembersRef:g,queryRef:p})),v=(0,l.useRef)(r),b=(0,l.useRef)(s),y=(0,l.useRef)("");(0,l.useEffect)(()=>{v.current=r},[r]);let w=!i||!d.command||nd(d.items,tF(r,d.query??"")),S=i?{status:i.failed?"error":i.loading||!w?"loading":d.items.length>0?"ready":"empty"}:void 0;(0,l.useEffect)(()=>{b.current=s},[s]);let[E]=(0,l.useState)(()=>tW({candidatesRef:v,popupRef:h,onIntentRef:b,setPopup:u,queryRef:y}));(0,l.useEffect)(()=>{if("dm"===t)return;let r=c.current;if(!r.command)return;let i=p.current,s=t5(i&&n&&(n.searchQuery!==i||"ready"!==n.searchStatus&&"loading-more"!==n.searchStatus&&"empty"!==n.searchStatus)?[]:e,t,i);!function(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(r.kind!==i.kind||r.id!==i.id||r.label!==i.label||"member"===r.kind&&"member"===i.kind&&(r.avatar!==i.avatar||r.status!==i.status))return!1}return!0}(r.items,s)&&o({...r,items:s,selectedIndex:r.selectedIndex<s.length?r.selectedIndex:0})},[t,e,n]),(0,l.useEffect)(()=>{let e=c.current;!e.command||e.query.trim()||!n?.hasMore||n.loading||n.loadingMore||n.failed||n.loadMore()},[n,a.command,a.query]);let C=(()=>{if(!n)return{status:a.items.length>0?"ready":"empty"};let e=a.query;return e?n.searchQuery!==e||"loading"===n.searchStatus||"idle"===n.searchStatus?{status:"loading"}:"error"===n.searchStatus?{status:"error"}:"loading-more"===n.searchStatus?{status:"loading-more"}:{status:a.items.length>0?"ready":"empty"}:n.failed?{status:"error"}:n.loading?{status:"loading"}:n.loadingMore||n.hasMore?{status:"loading-more"}:{status:a.items.length>0?"ready":"empty"}})();return(0,l.useEffect)(()=>{let e=h.current;if(!e.command)return;let t=tF(r,y.current);nd(e.items,t)||u({...e,items:t,selectedIndex:e.selectedIndex<t.length?e.selectedIndex:0})},[r]),{mentionPopup:a,mentionPresentation:C,mentionPopupRef:c,mentionExtension:x,channelRefPopup:d,channelRefPresentation:S,channelRefPopupRef:h,channelRefExtension:E,resetPopups:()=>{n?.search(""),o(t7),u(t_)}}}({members:n,context:t,mentionCandidates:r,channelRefCandidates:i,channelRefCandidateSource:s,onChannelRefIntent:a}),ei=(0,tI.useEditor)({immediatelyRender:!1,extensions:[nn.default.configure({heading:!1,horizontalRule:!1,codeBlock:!1,code:!1,blockquote:!1,bold:!1,italic:!1,strike:!1,bulletList:!1,orderedList:!1,listItem:!S&&{},listKeymap:!S&&{},trailingNode:!!S&&{}}),...S?[]:[ns],tZ.default.configure({placeholder:en}),er.mentionExtension,er.channelRefExtension],editorProps:{attributes:{class:"outline-none",enterkeyhint:S||!E?"enter":"send"},handleKeyDown:(e,t)=>(function(e,t,n){if(!n.isForumThreadBody&&!t.isComposing&&!t.altKey&&!t.shiftKey&&(t.ctrlKey||t.metaKey)&&"z"===t.key.toLowerCase()&&n.undoInputRule()&&(t.preventDefault(),1))return!0;let r=function(e,t){if(t.mentionOpen||t.channelRefOpen)return!1;if(t.isForumThreadBody){if("Enter"!==e.key||!e.shiftKey||e.isComposing)return!1}else if("Enter"!==e.key||e.shiftKey||e.isComposing||!t.hoverCapable)return!1;return e.preventDefault(),t.send(),!0}(t,n);return r||n.mentionOpen||n.channelRefOpen||t.isComposing?r:!n.isForumThreadBody&&n.hoverCapable&&"Enter"===t.key&&t.shiftKey&&(n.splitListItem()||n.liftEmptyBlock())?(t.preventDefault(),!0):function(e,t){if("Enter"!==t.key||!t.shiftKey||t.isComposing)return!1;let{state:n}=e,{selection:r}=n;if(!r.empty)return!1;let{$from:i}=r;if(!i.parent.isTextblock||i.parentOffset!==i.parent.content.size||i.nodeBefore?.type.name!=="hardBreak")return!1;let s=i.pos-1,l=n.tr.delete(s,i.pos);return!!(0,ne.canSplit)(l.doc,s)&&((l=l.split(s)).setSelection(tD.Selection.near(l.doc.resolve(s+1),1)),t.preventDefault(),e.dispatch(l.scrollIntoView()),!0)}(e,t)})(e,t,{hoverCapable:C.current,channelRefOpen:er.channelRefPopupRef.current.items.length>0&&null!==er.channelRefPopupRef.current.command,isForumThreadBody:S,mentionOpen:er.mentionPopupRef.current.items.length>0&&null!==er.mentionPopupRef.current.command,send:()=>V.current(),liftEmptyBlock:()=>K.current?.commands.liftEmptyBlock()??!1,splitListItem:()=>K.current?.commands.splitListItem("listItem")??!1,undoInputRule:()=>K.current?.commands.undoInputRule()??!1}),handlePaste:(e,t,n)=>{var r;let i=function(e){if(!e)return[];let t=[];for(let n=0;n<e.length;n++){if("file"!==e[n].kind)continue;let r=e[n].getAsFile();r&&t.push(r)}return t}(t.clipboardData?.items);if(i.length>0)return t.preventDefault(),z(i),!0;let s=t.clipboardData?.getData("text/plain"),l=function(e,t,n=1){if(!e||e.length<=1e3)return null;let r=new Set(t),i=Math.max(1,n);for(;r.has(`copy-${i}.md`);)i++;return{file:new File([e],`copy-${i}.md`,{type:"text/markdown"}),nextIndex:i+1}}(s,B.current.map(({file:e})=>e.name),U.current);return l?(t.preventDefault(),U.current=l.nextIndex,z([l.file]),!0):(r=t.clipboardData?.getData("text/html"),!!s&&!r&&(e.dispatch(e.state.tr.replaceSelection(n).scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0))},clipboardTextParser:(e,t)=>{let n=function(e,t){let n,r=t.createElement("div");for(let i of(""===(n=e.replace(/\r\n?/g,"\n").replace(/^\n+|\n+$/g,""))?[]:n.split(t9)).map(e=>e.split("\n"))){let e=t.createElement("p");i.forEach((n,r)=>{r>0&&e.appendChild(t.createElement("br")),n&&e.appendChild(t.createTextNode(n))}),r.appendChild(e)}return r}(e,document);return t0.DOMParser.fromSchema(t.doc.type.schema).parseSlice(n,{preserveWhitespace:!0,context:t})}},onUpdate:({editor:e})=>{if(k(!e.isEmpty),Z.current)return;u&&!q.current&&(u(),q.current=setTimeout(()=>{q.current=null},3e3)),eo();let t=Y.current;t&&!S&&function(e,t){let n=t3(e);try{null==t?localStorage.removeItem(n):localStorage.setItem(n,JSON.stringify(t))}catch{}}(t,e.isEmpty?null:e.getJSON())}});(0,l.useLayoutEffect)(()=>(K.current=ei,()=>{K.current===ei&&(K.current=null)}),[ei]);let es=S||!E?"enter":"send";(0,l.useLayoutEffect)(()=>{ei?.view?.dom?.setAttribute("enterkeyhint",es)},[ei,es]),(0,l.useLayoutEffect)(()=>{et.current===ee||(et.current=ee,ei&&ei.view?.dispatch(ei.state.tr))},[ei,ee]),(0,l.useEffect)(()=>{if(!ei||S||!y)return;let e=function(e){try{let t=localStorage.getItem(t3(e));if(!t)return null;return JSON.parse(t)}catch{return null}}(y);if(e){Z.current=!0;try{ei.commands.setContent(e,{emitUpdate:!1,errorOnInvalidContent:!0}),k(!ei.isEmpty)}catch{t4(y)}finally{Z.current=!1}}},[ei,y]);let el=(0,l.useRef)(!1),ea=(0,l.useRef)(b);(0,l.useEffect)(()=>{ea.current=b},[b]);let eo=()=>{if(!ei)return;let e=!ei.isEmpty||N.length>0;e!==el.current&&(el.current=e,ea.current?.(e))};(0,l.useEffect)(()=>{eo()},[N,ei]);let ec=()=>{if(!ei||J.current)return;let e=Q.current,t=X.current;J.current=Promise.resolve(),T(!0);let n=(async()=>{let n,r,i=await O();if(X.current!==t||Q.current!==e||ei.isEmpty&&0===i.length)return;let s=ei.isEmpty?"":(n=(0,nr.getTextSerializersFromSchema)(ei.schema),r=[],ei.state.doc.forEach(e=>{r.push("orderedList"===e.type.name?function e(t,n,r){let i=[],s="number"==typeof t.attrs.start?t.attrs.start:1;return t.forEach((t,l,a)=>{var o;let c,d,u,h;i.push((o=s+a,d=n+(c=`${o}. `).length,u=`${" ".repeat(n)}${c}`,h=!1,t.forEach(t=>{if("orderedList"===t.type.name){u+=`
3
+ ${e(t,d,r)}`,h=!0;return}let n=na(t,r);if(h){let e;u+=`
4
+
5
+ ${e=" ".repeat(d),`${e}${nl(n,d)}`}`}else u+=nl(n,d);h=!0}),u))}),i.join("\n")}(e,0,n):na(e,n))}),r.join("\n\n")).trim(),l=function(e){if(!e)return;let t=/[\p{L}\p{N}_-]/u;for(let n of t8){let r=0;for(;r<e.length;){let i=e.indexOf("@"+n,r);if(-1===i)break;let s=i>0?e[i-1]:void 0,l=e[i+1+n.length],a=void 0===s||!t.test(s),o=void 0===l||!t.test(l);if(a&&o)return n;r=i+1}}}(s),a=function(e){if(0!==e.length)return e.map(e=>({file:e.file,thumbnailBlob:e.thumbnailBlob??void 0,previewObjectUrl:e.thumbnailUrl??void 0,width:e.width,height:e.height}))}([...i]);if("accepted"===o){if(!c?.(s,a,l))return}else await d?.(s,a,l);if(S)return;let u="accepted"===o;u&&q.current&&clearTimeout(q.current),u&&(q.current=null),Z.current=u;try{ei.commands.clearContent()}finally{Z.current=!1}k(!1),Y.current&&t4(Y.current),A(),U.current=1,er.resetPopups()})();J.current=n,n.then(()=>{J.current===n&&(J.current=null,T(!1))},()=>{J.current===n&&(J.current=null,T(!1))})};(0,l.useLayoutEffect)(()=>{V.current=ec}),(0,l.useImperativeHandle)(w,()=>({focusEditor:()=>{ei?.commands.focus("end")},insertTextAtCaret:e=>{if(!ei||!e)return;let t={type:"text",text:function(e,t){if(!e)return e;let n=t.leading&&!/^\s/u.test(e)?" ":"",r=t.trailing&&!/\s$/u.test(e)?" ":"";return`${n}${e}${r}`}(e,nc(ei.state))};ei.chain().focus().insertContent(t).run()},insertMentionAtCaret:e=>{let t;ei&&e.id&&e.label&&ei.chain().focus().insertContent([...(t=nc(ei.state)).leading?[{type:"text",text:" "}]:[],{type:"mention",attrs:e},...t.trailing?[{type:"text",text:" "}]:[]]).run()},submitNow:()=>{ec()},resetAfterSubmit:()=>{ei&&(ei.commands.clearContent(),k(!1),M([]),U.current=1,er.resetPopups())},isEmpty:()=>!ei||ei.isEmpty&&0===N.length,openFilePicker:()=>{D.current?.click()}})),(0,l.useEffect)(()=>{f&&ei&&!S&&ei.commands.focus("end")},[f,ei,e,S]);let ed=(0,l.useRef)(h);return(0,l.useEffect)(()=>{let e=ed.current!==h;ed.current=h,e&&h&&ei&&!S&&ei.commands.focus("end")},[h,ei,S]),{isForumThreadBody:S,dragging:$,onDragEnter:_,onDragLeave:F,onDragOver:H,onDrop:e=>{W(e),ei?.commands.focus()},mentionPopup:er.mentionPopup,mentionPresentation:er.mentionPresentation,channelRefPopup:er.channelRefPopup,channelRefPresentation:er.channelRefPresentation,replyingTo:h,onCancelReply:m,pendingFiles:N,removePendingFile:P,fileInputRef:D,onFileSelect:L,editor:ei,hideAttach:v,hideEmoji:x,showSend:!S&&!E,sendDisabled:I||!j&&0===N.length,onSend:ec,onUploadFile:()=>{D.current?.click()},onEmojiPick:e=>{ei?.chain().focus().insertContent(e).run()}}}(e,t);return(0,i.jsx)(tG,{...n})});e.s(["Composer",0,nu],85888),e.s(["DmLoadingFrame",0,function({reserveBackSlot:e=!1}){return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(s.DmHeaderSkeleton,{onBack:e?()=>{}:void 0}),(0,i.jsxs)("main",{className:"flex min-h-0 min-w-0 flex-1 flex-col","aria-busy":"true","aria-label":"Loading direct message",children:[(0,i.jsx)(tk,{channel:"",messages:[],loading:!0,onOpenThread:()=>{},variant:"dm"}),(0,i.jsx)(tQ,{})]})]})}],888598)}]);
@@ -0,0 +1,20 @@
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,32586,e=>{"use strict";let t=(0,e.i(494916).default)("minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);e.s(["default",0,t])},150801,e=>{"use strict";var t=e.i(274570),a=e.i(318151),i=e.i(735642),n=e.i(23055),r=e.i(577992),l=e.i(381153),s=e.i(186339),o=e.i(934351),u=e.i(410763),c=e.i(903477),d=e.i(182149);function g({email:e,error:a,onChange:i}){return(0,t.jsxs)(u.Field,{"data-invalid":!!a,children:[(0,t.jsx)(u.FieldLabel,{htmlFor:"email",children:"Email"}),(0,t.jsx)(c.Input,{id:"email",type:"email",placeholder:"you@example.com",value:e,onChange:i,"aria-invalid":!!a,"aria-describedby":a?"sign-in-email-error":void 0,required:!0,autoFocus:!0}),a&&(0,t.jsx)(u.FieldError,{id:"sign-in-email-error",children:a})]})}function p({code:e,error:a,loading:i,onChange:n}){return(0,t.jsx)(u.Field,{"data-invalid":!!a,children:(0,t.jsxs)("div",{"data-slot":"sign-in-otp-field",className:"mx-auto flex w-fit! flex-col items-center gap-2",children:[(0,t.jsx)(d.InputOTP,{maxLength:6,value:e,onChange:n,disabled:i,"aria-label":"Verification code","aria-invalid":!!a,"aria-describedby":a?"sign-in-otp-error":void 0,autoFocus:!0,children:(0,t.jsxs)(d.InputOTPGroup,{children:[(0,t.jsx)(d.InputOTPSlot,{index:0}),(0,t.jsx)(d.InputOTPSlot,{index:1}),(0,t.jsx)(d.InputOTPSlot,{index:2}),(0,t.jsx)(d.InputOTPSlot,{index:3}),(0,t.jsx)(d.InputOTPSlot,{index:4}),(0,t.jsx)(d.InputOTPSlot,{index:5})]})}),a&&(0,t.jsx)(u.FieldError,{id:"sign-in-otp-error",className:"w-full text-center",children:a})]})})}e.i(954194);var m=e.i(824863),h=e.i(568294),M=e.i(71561);let f=a.forwardRef(function({title:e="Google",color:a="currentColor",size:i=24,...n},r){return"default"===a&&(a="#4285F4"),(0,t.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:i,height:i,fill:a,viewBox:"0 0 24 24",ref:r,...n,children:[(0,t.jsx)("title",{children:e}),(0,t.jsx)("path",{d:"M12.48 10.92v3.28h7.84c-.24 1.84-.853 3.187-1.787 4.133-1.147 1.147-2.933 2.4-6.053 2.4-4.827 0-8.6-3.893-8.6-8.72s3.773-8.72 8.6-8.72c2.6 0 4.507 1.027 5.907 2.347l2.307-2.307C18.747 1.44 16.133 0 12.48 0 5.867 0 .307 5.387.307 12s5.56 12 12.173 12c3.573 0 6.267-1.173 8.373-3.36 2.16-2.16 2.84-5.213 2.84-7.667 0-.76-.053-1.467-.173-2.053H12.48z"})]})});var x=e.i(667274),N=e.i(88723),v=e.i(552731),j=e.i(395207);let w=N.nativeOauthProofSchema.extend({candidateId:v.z.string(),code:v.z.string().nullable(),status:v.z.string().nullable(),wasDispatched:v.z.boolean()}).strict();async function T(e,t){return fetch(e,{method:void 0===t?"GET":"POST",credentials:"same-origin",cache:"no-store",headers:void 0===t?void 0:{"Content-Type":"application/json"},body:void 0===t?void 0:JSON.stringify(t),signal:AbortSignal.timeout(15e3)})}let D={invoke:m.tauriInvoke,async listen(e){let t=window.__TAURI__,a=t?.core?.Channel;if(!a)throw Error("native_bridge_unavailable");let i=new a;i.onmessage=e;let n=await (0,m.tauriInvoke)("native_oauth_listen",{channel:i});return()=>{(0,m.tauriInvoke)("native_oauth_unlisten",{registrationId:n}).catch(()=>{})}},async post(e,t){let a=await T(`/api/auth/native/${e}`,t);return{ok:a.ok,data:await a.json()}},async hasSession(){let e=await T("/api/auth/get-session?disableCookieCache=true"),t=v.z.object({session:v.z.object({id:v.z.string()}).passthrough().nullable()}).passthrough().safeParse(await e.json());return e.ok&&t.success&&null!==t.data.session},navigate(e){window.location.assign(e)}},I={start_failed:"Couldn't open sign-in. Try again.",expired:"This sign-in attempt expired. Try again.",denied:"Sign-in was cancelled in your browser. You can try again.",invalid_callback:"That sign-in link wasn't valid. Waiting for your browser to finish.",retry_required:"Couldn't confirm sign-in. Try again to start a new attempt.",unavailable:"Sign-in is unavailable. Try again or use email.",apple_update_required:"Update Alook to continue with Apple. GitHub, Google, and email still work."};function b({postLoginUrl:e,appleEnabled:i=!1}){let r=(0,a.useRef)(null),[l,o]=(0,a.useState)(null),c=(0,a.useRef)("github");(0,a.useEffect)(()=>{let e,t,a,i,n,l,s,u,c,d,g,p,M,f,x,T,I;if(!(0,m.isTauri)())return;let b=(a={phase:"initializing",attempt:null},i=0,n=!1,l=!1,s=!1,u=!1,c=!1,d=Promise.resolve(),g=e=>{a=e,n||(M(e.attempt),o(e))},p=e=>!n&&i===e,M=e=>{clearTimeout(t),e&&(t=setTimeout(()=>{n||a.attempt?.attemptId!==e.attemptId||(i+=1,g({phase:"error",message:"expired",attempt:null}),D.invoke("native_oauth_snapshot").catch(()=>{}))},Math.max(0,e.expiresAt-Date.now())))},f=async()=>j.nativeOauthSnapshotSchema.nullable().parse(await D.invoke("native_oauth_snapshot")),x=async(e,t)=>{await D.invoke("native_oauth_finish",{attemptId:e,candidateId:t})},T=async()=>{try{return await D.hasSession()}catch{return!1}},I=async(e=!1)=>{if(n||!l)return;if(s){u=!0,c||=e;return}s=!0;let t=i,r=e;try{do{r||=c,c=!1,u=!1;let e=w.nullable().parse(await D.invoke("native_oauth_pending_exchange"));if(!p(t))return;if(!e){let e=a.attempt;if(!r||!e?.waiting)return;let i=await f();if(!p(t))return;if(i&&i.attemptId!==e.attemptId)return void g({phase:i.waiting?"waiting":"idle",attempt:i});let n=await T();if(!p(t))return;n?D.navigate(e.redirectPath):g({phase:"error",message:"retry_required",attempt:i});return}r=!1;let i=await f();if(!p(t))return;if(!i||i.attemptId!==e.attemptId)continue;let{attemptId:n,state:l,verifier:s,candidateId:o}=e,d={attemptId:n,state:l,verifier:s};if(e.wasDispatched&&e.code){if(await T()){if(!p(t))return;await x(n,o),p(t)&&D.navigate(i.redirectPath)}else p(t)&&g({phase:"error",message:"retry_required",attempt:i});return}g({phase:e.code?"exchanging":"checking_status",attempt:i});try{if(e.code){let a=N.nativeOauthExchangeSchema.parse({...d,code:e.code}),r=await D.post("exchange",a);if(!p(t))return;let l=v.z.object({redirectPath:v.z.string().refine(h.isSafeRedirectPath)}).strict().safeParse(r.data);if(r.ok&&l.success){let e=await T();if(!p(t))return;if(!e)return void g({phase:"error",message:"retry_required",attempt:i});await x(n,o),p(t)&&D.navigate(l.data.redirectPath);return}if(!v.z.object({error:v.z.literal("invalid_handoff")}).strict().safeParse(r.data).success)throw Error("exchange_unconfirmed");if(await D.invoke("native_oauth_reject_candidate",{attemptId:n,candidateId:o}),!p(t))return;g({phase:"waiting",message:"invalid_callback",attempt:i}),u=!0;continue}let a=await D.post("status",d);if(!p(t))return;let r=v.z.object({status:v.z.enum(["pending","opened","ready","exchanging","consumed","failed","cancelled","replaced","expired","unknown"]),failure:v.z.string().optional()}).strict().parse(a.data);if(!a.ok)throw Error("status_unavailable");if(["failed","cancelled","replaced","expired","unknown","consumed"].includes(r.status)){let e="consumed"===r.status&&await T();if(!p(t)||(await x(n,o),!p(t)))return;M(null),e?D.navigate(i.redirectPath):g({phase:"error",message:"access_denied"===r.failure?"denied":"retry_required",attempt:null});return}if(await D.invoke("native_oauth_reject_candidate",{attemptId:n,candidateId:o}),!p(t))return;g({phase:"waiting",message:"invalid_callback",attempt:i}),u=!0}catch{let a=!!e.code&&await T();if(!p(t))return;a?(await x(n,o),p(t)&&D.navigate(i.redirectPath)):g({phase:"error",message:"retry_required",attempt:i});return}}while(u&&p(t))}catch{p(t)&&g({phase:"error",message:"unavailable",attempt:a.attempt})}finally{if(s=!1,u&&!n){let e=c;u=!1,c=!1,I(e)}}},{async connect(){g({phase:"initializing",attempt:null});try{let t=await D.listen(()=>{I(!0)});if(n)return void t();e=t;let a=await f();if(n)return;l=!0,g({phase:a?.waiting?"waiting":"idle",attempt:a}),await I()}catch(e){n||g("store_unavailable"===e?{phase:"error",message:"unavailable",attempt:null}:{phase:"unsupported",attempt:null})}},start(e,t){if(n||!l||!(0,h.isSafeRedirectPath)(t))return Promise.resolve();let r=++i;g({phase:"preparing",attempt:a.attempt});let s=async()=>{let a;if(p(r))try{let i=N.nativeOauthRegistrationSchema.parse(await D.invoke("native_oauth_prepare",{provider:e,redirectPath:t}));if(a=i.attemptId,!p(r))return;let n=await f();if(!p(r))return;g({phase:"preparing",attempt:n});let l=await D.post("attempt",i);if(!p(r))return;let s=v.z.object({startUrl:v.z.string()}).strict().parse(l.data);if(!l.ok)throw Error("registration_failed");if(await D.invoke("native_oauth_open_start",{attemptId:a,startUrl:s.startUrl}),!p(r))return;let o=await f();if(!p(r))return;g({phase:"waiting",attempt:o}),I()}catch(n){if(!p(r))return;if(a){let e=await D.invoke("native_oauth_cancel",{attemptId:a}).catch(()=>null);e&&await D.post("cancel",N.nativeOauthProofSchema.parse(e)).catch(()=>{})}let t="string"==typeof n?n:n instanceof Error?n.message:"",i="apple"!==e||a||"invalid_request"!==t?"start_failed":"apple_update_required";p(r)&&(M(null),g({phase:"error",message:i,attempt:null}))}};return d=d.then(s,s)},async cancel(){let e=++i,t=a.attempt;try{let t=await D.invoke("native_oauth_cancel");p(e)&&(M(null),g({phase:"idle",attempt:null})),t&&await D.post("cancel",N.nativeOauthProofSchema.parse(t)).catch(()=>{})}catch{p(e)&&g({phase:"error",message:"unavailable",attempt:t})}},dispose(){n=!0,i+=1,clearTimeout(t),e?.()}});return r.current=b,b.connect(),()=>{b.dispose(),r.current===b&&(r.current=null)}},[]);let d=t=>{(c.current=t,(0,m.isTauri)())?r.current&&r.current.start(t,(0,h.safeRedirectPath)(e)):n.signIn.social({provider:t,callbackURL:e})},g=l?.phase==="initializing"||l?.phase==="preparing"||l?.phase==="exchanging"||l?.phase==="checking_status",p=l?.phase==="unsupported",T=l?.message==="apple_update_required",y=p?"Update Alook to use social sign-in. You can still use email.":l?.message?I[l.message]:l?.phase==="preparing"?"Opening sign-in in your browser…":l?.phase==="exchanging"||l?.phase==="checking_status"?"Confirming sign-in…":l?.phase==="waiting"?"Finish signing in in your browser.":void 0;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(u.Field,{className:"grid grid-cols-2 gap-4",children:[(0,t.jsx)(s.Button,{size:"lg",type:"button",disabled:g||p,className:"border-0 bg-apple-signin text-base text-apple-signin-foreground hover:bg-apple-signin","data-testid":"native-oauth-github",onClick:()=>d("github"),children:(0,t.jsxs)("span",{className:"inline-flex items-center gap-2","data-testid":"native-oauth-github-content",children:[(0,t.jsx)(M.SiGithub,{className:"size-4","aria-hidden":!0}),(0,t.jsx)("span",{children:"GitHub"})]})}),(0,t.jsx)(s.Button,{size:"lg",type:"button",disabled:g||p,className:"border-0 bg-apple-signin text-base text-apple-signin-foreground hover:bg-apple-signin","data-testid":"native-oauth-google",onClick:()=>d("google"),children:(0,t.jsxs)("span",{className:"inline-flex items-center gap-2","data-testid":"native-oauth-google-content",children:[(0,t.jsx)(f,{className:"size-4","aria-hidden":!0}),(0,t.jsx)("span",{children:"Google"})]})}),i?(0,t.jsx)(s.Button,{type:"button",size:"lg",disabled:g||p||T,className:"col-span-2 min-w-35 border-0 bg-apple-signin text-base text-apple-signin-foreground hover:bg-apple-signin","data-testid":"native-oauth-apple",onClick:()=>d("apple"),children:(0,t.jsxs)("span",{className:"inline-flex items-center gap-2","data-testid":"native-oauth-apple-content",children:[(0,t.jsxs)("span",{className:"grid h-9 place-items-center","aria-hidden":!0,children:[(0,t.jsx)(x.default,{src:"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iMzFweCIgaGVpZ2h0PSI0NHB4IiB2aWV3Qm94PSIwIDAgMzEgNDQiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDYxICg4OTU4MSkgLSBodHRwczovL3NrZXRjaC5jb20gLS0+CiAgICA8dGl0bGU+TGVmdCBXaGl0ZSBMb2dvIE1lZGl1bTwvdGl0bGU+CiAgICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4KICAgIDxnIGlkPSJMZWZ0LVdoaXRlLUxvZ28tTWVkaXVtIiBzdHJva2U9Im5vbmUiIHN0cm9rZS13aWR0aD0iMSIgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj4KICAgICAgICA8cmVjdCBpZD0iUmVjdGFuZ2xlIiBmaWxsPSIjMDAwMDAwIiB4PSIwIiB5PSIwIiB3aWR0aD0iMzEiIGhlaWdodD0iNDQiPjwvcmVjdD4KICAgICAgICA8cGF0aCBkPSJNMTUuNzA5OTQ5MSwxNC44ODQ2MTU0IEMxNi41Njc1NDYxLDE0Ljg4NDYxNTQgMTcuNjQyNTYyLDE0LjMwNDgzMTUgMTguMjgyNzQsMTMuNTMxNzg2NCBDMTguODYyNTIzOCwxMi44MzEyMTQyIDE5LjI4NTI4MjksMTEuODUyODI5IDE5LjI4NTI4MjksMTAuODc0NDQzNyBDMTkuMjg1MjgyOSwxMC43NDE1NzY2IDE5LjI3MzIwNDEsMTAuNjA4NzA5NSAxOS4yNDkwNDY0LDEwLjUgQzE4LjI5NDgxODgsMTAuNTM2MjM2NSAxNy4xNDczMjk5LDExLjE0MDE3OCAxNi40NTg4MzY2LDExLjk0OTQ1OTYgQzE1LjkxNTI4OTMsMTIuNTY1NDggMTUuNDIwMDU3MiwxMy41MzE3ODY0IDE1LjQyMDA1NzIsMTQuNTIyMjUwNSBDMTUuNDIwMDU3MiwxNC42NjcxOTY0IDE1LjQ0NDIxNDksMTQuODEyMTQyNCAxNS40NTYyOTM3LDE0Ljg2MDQ1NzcgQzE1LjUxNjY4NzksMTQuODcyNTM2NiAxNS42MTMzMTg1LDE0Ljg4NDYxNTQgMTUuNzA5OTQ5MSwxNC44ODQ2MTU0IFogTTEyLjY5MDI0MTYsMjkuNSBDMTMuODYxODg4MSwyOS41IDE0LjM4MTI3NzgsMjguNzE0ODc2IDE1Ljg0MjgxNjMsMjguNzE0ODc2IEMxNy4zMjg1MTI0LDI4LjcxNDg3NiAxNy42NTQ2NDA4LDI5LjQ3NTg0MjMgMTguOTU5MTU0NSwyOS40NzU4NDIzIEMyMC4yMzk1MTA1LDI5LjQ3NTg0MjMgMjEuMDk3MTA3NCwyOC4yOTIxMTcgMjEuOTA2Mzg5MSwyNy4xMzI1NDkzIEMyMi44MTIzMDEzLDI1LjgwMzg3NzkgMjMuMTg2NzQ1MSwyNC40OTkzNjQzIDIzLjIxMDkwMjcsMjQuNDM4OTcwMSBDMjMuMTI2MzUwOSwyNC40MTQ4MTI1IDIwLjY3NDM0ODQsMjMuNDEyMjY5NSAyMC42NzQzNDg0LDIwLjU5NzkwMjEgQzIwLjY3NDM0ODQsMTguMTU3OTc4NCAyMi42MDY5NjEyLDE3LjA1ODgwNDggMjIuNzE1NjcwNywxNi45NzQyNTMgQzIxLjQzNTMxNDcsMTUuMTM4MjcwOCAxOS40OTA2MjMsMTUuMDg5OTU1NSAxOC45NTkxNTQ1LDE1LjA4OTk1NTUgQzE3LjUyMTc3MzcsMTUuMDg5OTU1NSAxNi4zNTAxMjcxLDE1Ljk1OTYzMTMgMTUuNjEzMzE4NSwxNS45NTk2MzEzIEMxNC44MTYxMTU3LDE1Ljk1OTYzMTMgMTMuNzY1MjU3NSwxNS4xMzgyNzA4IDEyLjUyMTEzOCwxNS4xMzgyNzA4IEMxMC4xNTM2ODcyLDE1LjEzODI3MDggNy43NSwxNy4wOTUwNDEzIDcuNzUsMjAuNzkxMTYzNCBDNy43NSwyMy4wODYxNDExIDguNjQzODMzNDQsMjUuNTEzOTg2IDkuNzQzMDA2OTksMjcuMDg0MjMzOSBDMTAuNjg1MTU1OCwyOC40MTI5MDUzIDExLjUwNjUxNjIsMjkuNSAxMi42OTAyNDE2LDI5LjUgWiIgaWQ9Iu+jvyIgZmlsbD0iI0ZGRkZGRiIgZmlsbC1ydWxlPSJub256ZXJvIj48L3BhdGg+CiAgICA8L2c+Cjwvc3ZnPg==",alt:"",width:31,height:44,unoptimized:!0,className:"col-start-1 row-start-1 h-9 w-auto dark:hidden","data-testid":"apple-official-left-aligned-logo-white"}),(0,t.jsx)(x.default,{src:"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iMzFweCIgaGVpZ2h0PSI0NHB4IiB2aWV3Qm94PSIwIDAgMzEgNDQiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDYxICg4OTU4MSkgLSBodHRwczovL3NrZXRjaC5jb20gLS0+CiAgICA8dGl0bGU+TGVmdCBCbGFjayBMb2dvIE1lZGl1bTwvdGl0bGU+CiAgICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4KICAgIDxnIGlkPSJMZWZ0LUJsYWNrLUxvZ28tTWVkaXVtIiBzdHJva2U9Im5vbmUiIHN0cm9rZS13aWR0aD0iMSIgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj4KICAgICAgICA8cmVjdCBpZD0iUmVjdGFuZ2xlIiBmaWxsPSIjRkZGRkZGIiB4PSIwIiB5PSIwIiB3aWR0aD0iMzEiIGhlaWdodD0iNDQiPjwvcmVjdD4KICAgICAgICA8cGF0aCBkPSJNMTUuNzA5OTQ5MSwxNC44ODQ2MTU0IEMxNi41Njc1NDYxLDE0Ljg4NDYxNTQgMTcuNjQyNTYyLDE0LjMwNDgzMTUgMTguMjgyNzQsMTMuNTMxNzg2NCBDMTguODYyNTIzOCwxMi44MzEyMTQyIDE5LjI4NTI4MjksMTEuODUyODI5IDE5LjI4NTI4MjksMTAuODc0NDQzNyBDMTkuMjg1MjgyOSwxMC43NDE1NzY2IDE5LjI3MzIwNDEsMTAuNjA4NzA5NSAxOS4yNDkwNDY0LDEwLjUgQzE4LjI5NDgxODgsMTAuNTM2MjM2NSAxNy4xNDczMjk5LDExLjE0MDE3OCAxNi40NTg4MzY2LDExLjk0OTQ1OTYgQzE1LjkxNTI4OTMsMTIuNTY1NDggMTUuNDIwMDU3MiwxMy41MzE3ODY0IDE1LjQyMDA1NzIsMTQuNTIyMjUwNSBDMTUuNDIwMDU3MiwxNC42NjcxOTY0IDE1LjQ0NDIxNDksMTQuODEyMTQyNCAxNS40NTYyOTM3LDE0Ljg2MDQ1NzcgQzE1LjUxNjY4NzksMTQuODcyNTM2NiAxNS42MTMzMTg1LDE0Ljg4NDYxNTQgMTUuNzA5OTQ5MSwxNC44ODQ2MTU0IFogTTEyLjY5MDI0MTYsMjkuNSBDMTMuODYxODg4MSwyOS41IDE0LjM4MTI3NzgsMjguNzE0ODc2IDE1Ljg0MjgxNjMsMjguNzE0ODc2IEMxNy4zMjg1MTI0LDI4LjcxNDg3NiAxNy42NTQ2NDA4LDI5LjQ3NTg0MjMgMTguOTU5MTU0NSwyOS40NzU4NDIzIEMyMC4yMzk1MTA1LDI5LjQ3NTg0MjMgMjEuMDk3MTA3NCwyOC4yOTIxMTcgMjEuOTA2Mzg5MSwyNy4xMzI1NDkzIEMyMi44MTIzMDEzLDI1LjgwMzg3NzkgMjMuMTg2NzQ1MSwyNC40OTkzNjQzIDIzLjIxMDkwMjcsMjQuNDM4OTcwMSBDMjMuMTI2MzUwOSwyNC40MTQ4MTI1IDIwLjY3NDM0ODQsMjMuNDEyMjY5NSAyMC42NzQzNDg0LDIwLjU5NzkwMjEgQzIwLjY3NDM0ODQsMTguMTU3OTc4NCAyMi42MDY5NjEyLDE3LjA1ODgwNDggMjIuNzE1NjcwNywxNi45NzQyNTMgQzIxLjQzNTMxNDcsMTUuMTM4MjcwOCAxOS40OTA2MjMsMTUuMDg5OTU1NSAxOC45NTkxNTQ1LDE1LjA4OTk1NTUgQzE3LjUyMTc3MzcsMTUuMDg5OTU1NSAxNi4zNTAxMjcxLDE1Ljk1OTYzMTMgMTUuNjEzMzE4NSwxNS45NTk2MzEzIEMxNC44MTYxMTU3LDE1Ljk1OTYzMTMgMTMuNzY1MjU3NSwxNS4xMzgyNzA4IDEyLjUyMTEzOCwxNS4xMzgyNzA4IEMxMC4xNTM2ODcyLDE1LjEzODI3MDggNy43NSwxNy4wOTUwNDEzIDcuNzUsMjAuNzkxMTYzNCBDNy43NSwyMy4wODYxNDExIDguNjQzODMzNDQsMjUuNTEzOTg2IDkuNzQzMDA2OTksMjcuMDg0MjMzOSBDMTAuNjg1MTU1OCwyOC40MTI5MDUzIDExLjUwNjUxNjIsMjkuNSAxMi42OTAyNDE2LDI5LjUgWiIgaWQ9Iu+jvyIgZmlsbD0iIzAwMDAwMCIgZmlsbC1ydWxlPSJub256ZXJvIj48L3BhdGg+CiAgICA8L2c+Cjwvc3ZnPg==",alt:"",width:31,height:44,unoptimized:!0,className:"col-start-1 row-start-1 hidden h-9 w-auto dark:block","data-testid":"apple-official-left-aligned-logo-black"})]}),(0,t.jsx)("span",{children:"Continue with Apple"})]})}):null]}),y&&(0,t.jsx)("p",{role:l?.phase==="error"||p?"alert":"status",className:"text-sm text-muted-foreground","data-testid":"native-oauth-status",children:y}),!p&&!T&&l&&(l.attempt||"error"===l.phase||"preparing"===l.phase)&&(0,t.jsxs)("div",{className:"flex gap-2",children:[(l.attempt||"preparing"===l.phase)&&(0,t.jsx)(s.Button,{type:"button",variant:"ghost","data-testid":"native-oauth-cancel",onClick:()=>{r.current?.cancel()},children:"Cancel"}),(0,t.jsx)(s.Button,{type:"button",variant:"outline",disabled:g,"data-testid":"native-oauth-retry",onClick:()=>d(l.attempt?.provider??c.current),children:"Try again"})]})]})}e.i(729997);var y=e.i(479998),z=e.i(643486),S=e.i(726514),E=e.i(364803),k=e.i(39716),C=e.i(582168),O=e.i(509279);function L({postLoginUrl:e,isProd:i,accountDeleted:o,appleEnabled:c}){let[d,m]=(0,a.useState)(""),[h,M]=(0,a.useState)(""),[f,x]=(0,a.useState)(""),[N,v]=(0,a.useState)(!1),[j,w]=(0,a.useState)(""),[T,D]=(0,a.useState)("email"),[I,y]=(0,a.useState)(null);(0,a.useEffect)(()=>{if(null==I)return;let e=setTimeout(()=>{y(e=>null==e||e<=1?null:e-1)},1e3);return()=>clearTimeout(e)},[I]);let z={onError:e=>{if(429===e.response.status){M("");let t=(0,r.parseRetryAfterSeconds)(e.response.headers);null!=t&&y(t)}}};async function S(e){if(e.preventDefault(),null==I){M(""),y(null),v(!0);try{let{error:e}=await n.authClient.emailOtp.sendVerificationOtp({email:d,type:"sign-in",fetchOptions:z});e?429!==e.status&&M(e.message??"Failed to send code"):(M(""),x(""),D("code"))}catch{M("Failed to send code")}v(!1)}}async function E(t){if(w(t),x(""),6===t.length){v(!0);try{let{error:a}=await n.authClient.signIn.emailOtp({email:d,otp:t});if(a)x(a.message??"Invalid code"),w("");else{x(""),window.location.href=e;return}}catch{x("Invalid code"),w("")}v(!1)}}async function k(t){t.preventDefault(),M(""),v(!0);let{error:a}=await n.signIn.email({email:d,password:C.DEV_PASSWORD},{onError:()=>{}});if(a){let{error:e}=await n.signUp.email({name:d.split("@")[0],email:d,password:C.DEV_PASSWORD},{onError:()=>{}});if(e){M(e.message??"Failed to sign in"),v(!1);return}}window.location.href=e}let A=null!=I,U=A?`Too many requests. Try again in ${I}s.`:h,P=N?"Sending...":A?`Wait ${I}s`:"Send Code",Q=i&&"code"===T?"Enter the code we sent you":i?"Enter your email — we’ll send you a verification code":void 0;return(0,t.jsxs)(u.FieldGroup,{children:[o?(0,t.jsxs)("div",{className:"flex gap-3 rounded-xl bg-muted/70 p-4 text-left",role:"status","data-testid":l.tid.accountDeletionComplete,children:[(0,t.jsx)(O.CircleCheck,{className:"mt-0.5 size-5 shrink-0 text-muted-foreground","aria-hidden":!0}),(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"text-sm font-medium",children:"Account deleted"}),(0,t.jsx)("p",{className:"mt-0.5 text-sm text-muted-foreground",children:"Your account and its data were removed."})]})]}):null,(0,t.jsxs)("div",{className:"flex flex-col items-center gap-2 text-center",children:[(0,t.jsx)("h1",{className:"text-2xl font-bold",children:"Sign in"}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:"or create an account to get started"}),Q&&(0,t.jsx)("p",{className:"text-balance text-muted-foreground",children:Q})]}),i?"email"===T?(0,t.jsx)("form",{onSubmit:S,children:(0,t.jsxs)(u.FieldGroup,{children:[(0,t.jsx)(g,{email:d,error:U,onChange:e=>{m(e.target.value),M("")}}),(0,t.jsx)(u.Field,{children:(0,t.jsx)(s.Button,{variant:"outline",size:"lg",type:"submit",disabled:N||A,className:"w-full text-base",children:P})})]})}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("p",{className:"text-sm text-muted-foreground text-center",children:["We sent a code to ",(0,t.jsx)("strong",{children:d})]}),(0,t.jsx)(p,{code:j,error:f,loading:N,onChange:E}),(0,t.jsx)(s.Button,{variant:"ghost",className:"w-full",onClick:()=>{D("email"),w(""),x(""),M("")},children:"Use a different email"})]}):(0,t.jsx)("form",{onSubmit:k,children:(0,t.jsxs)(u.FieldGroup,{children:[(0,t.jsx)(g,{email:d,error:h,onChange:e=>{m(e.target.value),M("")}}),(0,t.jsx)(u.Field,{children:(0,t.jsx)(s.Button,{variant:"outline",size:"lg",type:"submit",disabled:N,className:"w-full text-base",children:N?"Signing in...":"Sign in"})})]})}),(0,t.jsx)(u.FieldSeparator,{className:"*:data-[slot=field-separator-content]:bg-card",children:"Or continue with"}),(0,t.jsx)(b,{postLoginUrl:e,appleEnabled:c})]})}let A=[{scene:"server",label:"The best room for agents and humans",description:"Bring your people and agents together in one shared home."},{scene:"spaces",label:"A room for every part of life",description:"Keep work, life, and play separate—invite the friends and bots who belong."},{scene:"machine",label:"Bring your own agents",description:"Use your own computer and existing agent subscriptions."},{scene:"provider",label:"Persistent identity and memory",description:"Your agents stay themselves, independent of provider."}];function U(){let[e,i]=(0,a.useState)(0),[n,r]=(0,a.useState)(!1),[l,s]=(0,a.useState)(!0),o=A[e];return((0,a.useEffect)(()=>{let e=window.matchMedia("(min-width: 640px)"),t=window.matchMedia("(prefers-reduced-motion: reduce)"),a=()=>{r(e.matches),s(!t.matches)};return a(),e.addEventListener("change",a),t.addEventListener("change",a),()=>{e.removeEventListener("change",a),t.removeEventListener("change",a)}},[]),(0,a.useEffect)(()=>{if(!n||!l)return;let e=window.setTimeout(()=>{i(e=>(e+1)%A.length)},(0,E.sceneDurationMs)(o.scene));return()=>window.clearTimeout(e)},[o.scene,l,n]),n)?(0,t.jsxs)("div",{className:`${k.default.galleryContainer} flex h-full min-h-0 flex-col items-center justify-center p-5 lg:p-7`,children:[(0,t.jsx)("div",{className:`${k.default.galleryFrame} w-full bg-background ring-1 ring-border/60 shadow-lg`,role:"img","aria-label":o.label,children:(0,t.jsx)(S.LandingShellMotion,{scene:o.scene},o.scene)}),(0,t.jsxs)("div",{className:`${k.default.galleryFooter} mt-4`,children:[(0,t.jsxs)("div",{"aria-live":"polite",children:[(0,t.jsxs)("p",{className:"font-mono text-[10px] font-medium uppercase tracking-[0.14em] text-muted-foreground",children:[String(e+1).padStart(2,"0")," / ",String(A.length).padStart(2,"0")]}),(0,t.jsx)("p",{className:"mt-1 text-sm font-medium text-foreground",children:o.label}),(0,t.jsx)("p",{className:"mt-0.5 max-w-lg text-xs leading-relaxed text-muted-foreground",children:o.description})]}),(0,t.jsx)("div",{className:k.default.gallerySwitcher,"aria-label":"Product stories",children:A.map((a,n)=>(0,t.jsx)("button",{onClick:()=>i(n),className:"grid size-8 place-items-center rounded-full focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","aria-label":`Show ${a.label}`,"aria-pressed":n===e,children:(0,t.jsx)("span",{className:"h-1.5 rounded-full transition-all duration-300",style:{width:n===e?16:6,backgroundColor:n===e?"var(--foreground)":"var(--muted-foreground)",opacity:n===e?1:.3}})},a.scene))})]})]}):null}e.s(["default",0,function({isProd:e,appleEnabled:a}){var n;let r=(0,i.useSearchParams)(),l=(n=r.get("redirect"))&&n.startsWith("/")&&!n.startsWith("//")?n:"/c/me",s="1"===r.get("account_deleted");return(0,t.jsxs)("div",{className:"relative flex min-h-svh flex-col items-center justify-center p-6 sm:p-10",children:[(0,t.jsx)(y.GradientBackground,{}),(0,t.jsx)("div",{className:"w-full max-w-sm sm:max-w-6xl",children:(0,t.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,t.jsx)("div",{className:"flex justify-center mb-2",children:(0,t.jsx)(z.Logo,{size:"lg"})}),(0,t.jsx)(o.Card,{className:"overflow-hidden p-0",children:(0,t.jsxs)(o.CardContent,{className:"grid p-0 sm:grid-cols-[minmax(320px,0.82fr)_minmax(0,1.35fr)]",children:[(0,t.jsx)("div",{className:"flex flex-col justify-center p-6 sm:min-h-120 sm:p-8",children:(0,t.jsx)(L,{postLoginUrl:l,isProd:e,accountDeleted:s,appleEnabled:a})}),(0,t.jsx)("div",{className:"relative hidden min-h-120 overflow-hidden bg-muted sm:block",children:(0,t.jsx)(U,{})})]})})]})})]})}],150801)},729997,479998,e=>{"use strict";var t=e.i(708884);e.s([],729997),e.s(["GradientBackground",()=>t.AppBackground],479998)},643486,e=>{"use strict";var t=e.i(274570),a=e.i(848317),i=e.i(667274),n=e.i(613349);let r={sm:{icon:28,text:"text-2xl"},lg:{icon:36,text:"text-4xl"}};e.s(["Logo",0,function({size:e="sm",className:l,iconOnly:s=!1}){let{icon:o,text:u}=r[e],{resolvedTheme:c,setTheme:d}=(0,a.useTheme)();return(0,t.jsxs)("button",{type:"button",onClick:()=>{d("dark"===c?"light":"dark")},"aria-label":"Toggle theme",className:(0,n.cn)("flex items-center gap-2 cursor-pointer select-none transition-opacity hover:opacity-70",l),children:[(0,t.jsx)(i.default,{src:"/alook.svg",alt:"Alook",width:o,height:o}),!s&&(0,t.jsx)("span",{className:(0,n.cn)(u,"font-black tracking-tight"),style:{fontFamily:"var(--font-brand)"},children:"Alook"})]})}])},410763,e=>{"use strict";var t=e.i(274570),a=e.i(318151),i=e.i(294237),n=e.i(613349),r=e.i(473131),l=e.i(434433);let s=(0,i.cva)("group/field flex w-full gap-2 data-[invalid=true]:text-destructive",{variants:{orientation:{vertical:"flex-col *:w-full [&>.sr-only]:w-auto",horizontal:"flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px",responsive:"flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"}},defaultVariants:{orientation:"vertical"}});e.s(["Field",0,function({className:e,orientation:a="vertical",...i}){return(0,t.jsx)("div",{role:"group","data-slot":"field","data-orientation":a,className:(0,n.cn)(s({orientation:a}),e),...i})},"FieldContent",0,function({className:e,...a}){return(0,t.jsx)("div",{"data-slot":"field-content",className:(0,n.cn)("group/field-content flex flex-1 flex-col gap-1 leading-snug",e),...a})},"FieldDescription",0,function({className:e,...a}){return(0,t.jsx)("p",{"data-slot":"field-description",className:(0,n.cn)("text-left text-sm leading-normal font-normal text-muted-foreground group-has-data-horizontal/field:text-balance [[data-variant=legend]+&]:-mt-2","last:mt-0 nth-last-2:-mt-1","[&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary",e),...a})},"FieldError",0,function({className:e,children:i,errors:r,...l}){let s=(0,a.useMemo)(()=>{if(i)return i;if(!r?.length)return null;let e=[...new Map(r.map(e=>[e?.message,e])).values()];return e?.length==1?e[0]?.message:(0,t.jsx)("ul",{className:"ml-4 flex list-disc flex-col gap-1",children:e.map((e,a)=>e?.message&&(0,t.jsx)("li",{children:e.message},a))})},[i,r]);return s?(0,t.jsx)("div",{role:"alert","data-slot":"field-error",className:(0,n.cn)("text-sm font-normal text-destructive",e),...l,children:s}):null},"FieldGroup",0,function({className:e,...a}){return(0,t.jsx)("div",{"data-slot":"field-group",className:(0,n.cn)("group/field-group @container/field-group flex w-full flex-col gap-4 data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4",e),...a})},"FieldLabel",0,function({className:e,...a}){return(0,t.jsx)(r.Label,{"data-slot":"field-label",className:(0,n.cn)("group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-data-checked:border-primary/30 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:rounded-lg has-[>[data-slot=field]]:border *:data-[slot=field]:p-2 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10","has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col",e),...a})},"FieldSeparator",0,function({children:e,className:a,...i}){return(0,t.jsxs)("div",{"data-slot":"field-separator","data-content":!!e,className:(0,n.cn)("relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2",a),...i,children:[(0,t.jsx)(l.Separator,{className:"absolute inset-0 top-1/2"}),e&&(0,t.jsx)("span",{className:"relative mx-auto block w-fit bg-background px-2 text-muted-foreground","data-slot":"field-separator-content",children:e})]})},"FieldSet",0,function({className:e,...a}){return(0,t.jsx)("fieldset",{"data-slot":"field-set",className:(0,n.cn)("flex flex-col gap-4 has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3",e),...a})},"FieldTitle",0,function({className:e,...a}){return(0,t.jsx)("div",{"data-slot":"field-label",className:(0,n.cn)("flex w-fit items-center gap-2 text-sm leading-snug font-medium group-data-[disabled=true]/field:opacity-50",e),...a})}])},182149,e=>{"use strict";var t=e.i(274570),a=e.i(318151),i=Object.defineProperty,n=Object.defineProperties,r=Object.getOwnPropertyDescriptors,l=Object.getOwnPropertySymbols,s=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable,u=(e,t,a)=>t in e?i(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a;function c(e){let t=e.getBoundingClientRect().right,a=e;for(;a;){if("visible"!==getComputedStyle(a).overflowX)return a.getBoundingClientRect().left+a.clientLeft+a.clientWidth-t;a=a.parentElement}return document.documentElement.clientWidth-t}var d=a.createContext({}),g=a.forwardRef((e,t)=>{let i;var g,h,M,f,x,{value:N,onChange:v,maxLength:j,textAlign:w="left",pattern:T,placeholder:D,inputMode:I="numeric",onComplete:b,pushPasswordManagerStrategy:y="increase-width",pasteTransformer:z,containerClassName:S,noScriptCSSFallback:E=m,nonce:k,render:C,children:O}=e,L=((e,t)=>{var a={};for(var i in e)s.call(e,i)&&0>t.indexOf(i)&&(a[i]=e[i]);if(null!=e&&l)for(var i of l(e))0>t.indexOf(i)&&o.call(e,i)&&(a[i]=e[i]);return a})(e,["value","onChange","maxLength","textAlign","pattern","placeholder","inputMode","onComplete","pushPasswordManagerStrategy","pasteTransformer","containerClassName","noScriptCSSFallback","nonce","render","children"]);let[A,U]=a.useState("string"==typeof L.defaultValue?L.defaultValue:""),P=null!=N?N:A,Q=(i=a.useRef(),a.useEffect(()=>{i.current=P}),i.current),B=a.useCallback(e=>{null==v||v(e),U(e)},[v]),_=a.useMemo(()=>T?"string"==typeof T?new RegExp(T):T:null,[T]),G=a.useRef(null),Y=a.useRef(null),R=a.useRef({value:P,onChange:B,isIOS:"u">typeof window&&(null==(h=null==(g=null==window?void 0:window.CSS)?void 0:g.supports)?void 0:h.call(g,"-webkit-touch-callout","none"))}),F=a.useRef({prev:[null==(M=G.current)?void 0:M.selectionStart,null==(f=G.current)?void 0:f.selectionEnd,null==(x=G.current)?void 0:x.selectionDirection]});a.useImperativeHandle(t,()=>G.current,[]),a.useEffect(()=>{let e=G.current,t=Y.current;if(!e||!t)return;function a(){if(document.activeElement!==e){q(null),X(null);return}let t=e.selectionStart,a=e.selectionEnd,i=e.selectionDirection,n=e.maxLength,r=e.value,l=F.current.prev,s=-1,o=-1,u;if(0!==r.length&&null!==t&&null!==a){let i=t===a,c=t===r.length&&r.length<n;if(i&&!c){if(0===t)s=0,o=1,u="forward";else if(t===n)s=t-1,o=t,u="backward";else if(n>1&&r.length>1){let e=0;if(null!==l[0]&&null!==l[1]){u=t<l[1]?"backward":"forward";let a=l[0]===l[1]&&l[0]<n;"backward"!==u||a||(e=-1)}s=e+t,o=e+t+1}}-1!==s&&-1!==o&&s!==o&&e.setSelectionRange(s,o,u)}let c=-1!==s?s:t,d=-1!==o?o:a,g=null!=u?u:i;q(c),X(d),F.current.prev=[c,d,g]}if(R.current.value!==e.value&&R.current.onChange(e.value),F.current.prev=[e.selectionStart,e.selectionEnd,e.selectionDirection],document.addEventListener("selectionchange",a,{capture:!0}),a(),document.activeElement===e&&H(!0),!document.getElementById("input-otp-style")){let e=document.createElement("style");if(e.id="input-otp-style",k&&e.setAttribute("nonce",k),document.head.appendChild(e),e.sheet){let t="background: transparent !important; color: transparent !important; border-color: transparent !important; opacity: 0 !important; box-shadow: none !important; -webkit-box-shadow: none !important; -webkit-text-fill-color: transparent !important;";p(e.sheet,"[data-input-otp]::selection { background: transparent !important; color: transparent !important; }"),p(e.sheet,`[data-input-otp]:autofill { ${t} }`),p(e.sheet,`[data-input-otp]:-webkit-autofill { ${t} }`),p(e.sheet,"@supports (-webkit-touch-callout: none) { [data-input-otp] { letter-spacing: -.6em !important; font-weight: 100 !important; font-stretch: ultra-condensed; font-optical-sizing: none !important; left: -1px !important; right: 1px !important; } }"),p(e.sheet,"[data-input-otp] + * { pointer-events: all !important; }")}}let i=()=>{t&&t.style.setProperty("--root-height",`${e.clientHeight}px`)};i();let n="u"<typeof ResizeObserver?null:new ResizeObserver(i);return null==n||n.observe(e),()=>{document.removeEventListener("selectionchange",a,{capture:!0}),null==n||n.disconnect()}},[]);let[W,Z]=a.useState(!1),[V,H]=a.useState(!1),[J,q]=a.useState(null),[$,X]=a.useState(null);a.useEffect(()=>{var e;let t=[setTimeout(e=()=>{var e,t,a,i;null==(e=G.current)||e.dispatchEvent(new Event("input"));let n=null==(t=G.current)?void 0:t.selectionStart,r=null==(a=G.current)?void 0:a.selectionEnd,l=null==(i=G.current)?void 0:i.selectionDirection;null!==n&&null!==r&&(q(n),X(r),F.current.prev=[n,r,l])},0),setTimeout(e,10),setTimeout(e,50)];return()=>{t.forEach(e=>clearTimeout(e))}},[P,V]),a.useEffect(()=>{void 0!==Q&&P!==Q&&Q.length<j&&P.length===j&&(null==b||b(P))},[j,b,Q,P]);let K=function({containerRef:e,inputRef:t,pushPasswordManagerStrategy:i,isFocused:n}){let[r,l]=a.useState(!1),[s,o]=a.useState(!1),[u,d]=a.useState(!1),g=a.useMemo(()=>"none"!==i&&("increase-width"===i||"experimental-no-flickering"===i)&&r&&s,[r,s,i]),p=a.useCallback(()=>{let a=e.current,n=t.current;if(!a||!n||u||"none"===i)return;let r=a.getBoundingClientRect().left+a.offsetWidth,s=a.getBoundingClientRect().top+a.offsetHeight/2;0===document.querySelectorAll('[data-lastpass-icon-root],com-1password-button,[data-dashlanecreated],[style$="2147483647 !important;"]').length&&document.elementFromPoint(r-18,s)===a||(o(c(a)>=40),l(!0),d(!0))},[e,t,u,i]);return a.useEffect(()=>{let t=e.current;if(!t||"none"===i)return;function a(){o(c(t)>=40)}a();let n=setInterval(a,1e3);return()=>{clearInterval(n)}},[e,i]),a.useEffect(()=>{let e=n||document.activeElement===t.current;if("none"===i||!e)return;let a=setTimeout(p,0),r=setTimeout(p,2e3),l=setTimeout(p,5e3),s=setTimeout(()=>{d(!0)},6e3);return()=>{clearTimeout(a),clearTimeout(r),clearTimeout(l),clearTimeout(s)}},[t,n,i,p]),{hasPWMBadge:r,willPushPWMBadge:g,PWM_BADGE_SPACE_WIDTH:"40px"}}({containerRef:Y,inputRef:G,pushPasswordManagerStrategy:y,isFocused:V}),ee=a.useCallback(e=>{let t=e.currentTarget.value.slice(0,j);t.length>0&&_&&!_.test(t)?e.preventDefault():("string"==typeof Q&&t.length<Q.length&&document.dispatchEvent(new Event("selectionchange")),B(t))},[j,B,Q,_]),et=a.useCallback(()=>{var e;if(G.current){let t=Math.min(G.current.value.length,j-1),a=G.current.value.length;null==(e=G.current)||e.setSelectionRange(t,a),q(t),X(a)}H(!0)},[j]),ea=a.useCallback(e=>{var t,a;let i=G.current;if(!z&&(!R.current.isIOS||!e.clipboardData||!i))return;let n=e.clipboardData.getData("text/plain"),r=z?z(n):n;e.preventDefault();let l=null==(t=G.current)?void 0:t.selectionStart,s=null==(a=G.current)?void 0:a.selectionEnd,o=(l!==s?P.slice(0,l)+r+P.slice(s):P.slice(0,l)+r+P.slice(l)).slice(0,j);if(o.length>0&&_&&!_.test(o))return;i.value=o,B(o);let u=Math.min(o.length,j-1),c=o.length;i.setSelectionRange(u,c),q(u),X(c)},[j,B,z,_,P]),ei=a.useMemo(()=>({position:"relative",cursor:L.disabled?"default":"text",userSelect:"none",WebkitUserSelect:"none",pointerEvents:"none"}),[L.disabled]),en=a.useMemo(()=>({position:"absolute",inset:0,width:K.willPushPWMBadge?`calc(100% + ${K.PWM_BADGE_SPACE_WIDTH})`:"100%",clipPath:K.willPushPWMBadge?`inset(0 ${K.PWM_BADGE_SPACE_WIDTH} 0 0)`:void 0,height:"100%",display:"flex",textAlign:w,opacity:"1",color:"transparent",pointerEvents:"all",background:"transparent",caretColor:"transparent",border:"0 solid transparent",outline:"0 solid transparent",boxShadow:"none",lineHeight:"1",letterSpacing:"-.5em",fontSize:"var(--root-height, 16px)",fontFamily:"monospace",fontVariantNumeric:"tabular-nums"}),[K.PWM_BADGE_SPACE_WIDTH,K.willPushPWMBadge,w]),er=a.useMemo(()=>{var e;return a.createElement("input",n(((e,t)=>{for(var a in t||(t={}))s.call(t,a)&&u(e,a,t[a]);if(l)for(var a of l(t))o.call(t,a)&&u(e,a,t[a]);return e})({autoComplete:L.autoComplete||"one-time-code"},L),r({"data-input-otp":!0,"data-input-otp-placeholder-shown":0===P.length||void 0,"data-input-otp-mss":J,"data-input-otp-mse":$,inputMode:I,pattern:null==_?void 0:_.source,"aria-placeholder":D,style:en,maxLength:j,value:P,ref:G,spellCheck:null!=(e=L.spellCheck)&&e,onPaste:e=>{var t;ea(e),null==(t=L.onPaste)||t.call(L,e)},onChange:ee,onMouseOver:e=>{var t;Z(!0),null==(t=L.onMouseOver)||t.call(L,e)},onMouseLeave:e=>{var t;Z(!1),null==(t=L.onMouseLeave)||t.call(L,e)},onFocus:e=>{var t;et(),null==(t=L.onFocus)||t.call(L,e)},onBlur:e=>{var t;H(!1),null==(t=L.onBlur)||t.call(L,e)}})))},[ee,et,ea,I,en,j,$,J,D,L,null==_?void 0:_.source,P]),el=a.useMemo(()=>({slots:Array.from({length:j}).map((e,t)=>{var a;let i=V&&null!==J&&null!==$&&(J===$&&t===J||t>=J&&t<$),n=void 0!==P[t]?P[t]:null;return{char:n,placeholderChar:void 0!==P[0]?null:null!=(a=null==D?void 0:D[t])?a:null,isActive:i,hasFakeCaret:i&&null===n}}),isFocused:V,isHovering:!L.disabled&&W}),[V,W,j,$,J,D,L.disabled,P]),es=a.useMemo(()=>C?C(el):a.createElement(d.Provider,{value:el},O),[O,el,C]);return a.createElement(a.Fragment,null,null!==E&&a.createElement("noscript",null,a.createElement("style",null,E)),a.createElement("div",{ref:Y,"data-input-otp-container":!0,translate:"no",style:ei,className:S},es,a.createElement("div",{style:{position:"absolute",inset:0,pointerEvents:"none"}},er)))});function p(e,t){try{e.insertRule(t)}catch(e){console.warn("input-otp could not insert CSS rule:",t)}}g.displayName="Input";var m=`
2
+ [data-input-otp] {
3
+ --nojs-bg: white !important;
4
+ --nojs-fg: black !important;
5
+
6
+ background-color: var(--nojs-bg) !important;
7
+ color: var(--nojs-fg) !important;
8
+ caret-color: var(--nojs-fg) !important;
9
+ letter-spacing: .25em !important;
10
+ text-align: center !important;
11
+ border: 1px solid var(--nojs-fg) !important;
12
+ border-radius: 4px !important;
13
+ width: 100% !important;
14
+ }
15
+ @media (prefers-color-scheme: dark) {
16
+ [data-input-otp] {
17
+ --nojs-bg: black !important;
18
+ --nojs-fg: white !important;
19
+ }
20
+ }`,h=e.i(613349);e.i(32586),e.s(["InputOTP",0,function({className:e,containerClassName:a,...i}){return(0,t.jsx)(g,{"data-slot":"input-otp",containerClassName:(0,h.cn)("cn-input-otp flex items-center has-disabled:opacity-50",a),spellCheck:!1,className:(0,h.cn)("disabled:cursor-not-allowed",e),...i})},"InputOTPGroup",0,function({className:e,...a}){return(0,t.jsx)("div",{"data-slot":"input-otp-group",className:(0,h.cn)("flex items-center rounded-lg has-aria-invalid:border-destructive has-aria-invalid:ring-3 has-aria-invalid:ring-destructive/20 dark:has-aria-invalid:ring-destructive/40",e),...a})},"InputOTPSlot",0,function({index:e,className:i,...n}){let r=a.useContext(d),{char:l,hasFakeCaret:s,isActive:o}=r?.slots[e]??{};return(0,t.jsxs)("div",{"data-slot":"input-otp-slot","data-active":o,className:(0,h.cn)("relative flex size-8 items-center justify-center border-y border-r border-input text-sm transition-all outline-none first:rounded-l-lg first:border-l last:rounded-r-lg aria-invalid:border-destructive data-[active=true]:z-10 data-[active=true]:border-ring data-[active=true]:ring-3 data-[active=true]:ring-ring/50 data-[active=true]:aria-invalid:border-destructive data-[active=true]:aria-invalid:ring-destructive/20 dark:bg-input/30 dark:data-[active=true]:aria-invalid:ring-destructive/40",i),...n,children:[l,s&&(0,t.jsx)("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center",children:(0,t.jsx)("div",{className:"h-4 w-px animate-caret-blink bg-foreground duration-1000"})})]})}],182149)},395207,e=>{"use strict";e.i(954194);var t=e.i(568294),a=e.i(88723),i=e.i(552731);let n=i.z.object({attemptId:i.z.string(),provider:a.nativeOauthProviderSchema,redirectPath:i.z.string().refine(t.isSafeRedirectPath),expiresAt:i.z.number(),waiting:i.z.boolean()}).strict();e.s(["nativeOauthSnapshotSchema",0,n])},577992,e=>{"use strict";e.s(["parseRetryAfterSeconds",0,function(e){let t=e.get("X-Retry-After")??e.get("Retry-After");if(!t)return null;let a=Number.parseInt(t,10);return Number.isFinite(a)&&a>0?a:null}])}]);