@alook/app 0.0.152 → 0.0.154
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.
- package/bundled/email-worker/index.js +3 -1
- package/bundled/web/.open-next/.build/durable-objects/queue.js +5 -5
- package/bundled/web/.open-next/assets/BUILD_ID +1 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/05rel1qxsdla_.js +1 -0
- package/bundled/web/.open-next/assets/_next/static/chunks/1kv8cbo2a0i1u.js +1 -0
- package/bundled/web/.open-next/assets/_next/static/chunks/1kyxgrz4-k-zk.js +1 -0
- package/bundled/web/.open-next/assets/_next/static/chunks/{3etgdoxwljis1.js → 1t4d0nzeertbz.js} +3 -3
- package/bundled/web/.open-next/assets/_next/static/chunks/{2hfr1gmcibrqg.js → 1t737wp5td9r0.js} +1 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/2b9pa48plclqj.js +1 -0
- package/bundled/web/.open-next/assets/_next/static/chunks/2ee9_kh3zud82.js +1 -0
- package/bundled/web/.open-next/assets/_next/static/chunks/2jt0ahlmoskt4.js +1 -0
- package/bundled/web/.open-next/assets/_next/static/chunks/2tjh96xedn3lu.js +63 -0
- package/bundled/web/.open-next/assets/_next/static/chunks/3--ysm-rpa5ob.js +1 -0
- package/bundled/web/.open-next/assets/_next/static/chunks/3_flisy516wkv.js +1 -0
- package/bundled/web/.open-next/assets/_next/static/chunks/3e6r6yc39pztk.js +2 -0
- package/bundled/web/.open-next/assets/_next/static/chunks/3ll8ge14thcn_.js +1 -0
- package/bundled/web/.open-next/assets/_next/static/chunks/3u2ya8vzp1c71.js +1 -0
- package/bundled/web/.open-next/assets/_next/static/chunks/42342bxqlu0f7.js +1 -0
- package/bundled/web/.open-next/cache/{tZVfWmKSY7w1xF14qAb42 → qigxeWlGT_9_D5qWF8F9X}/_global-error.cache +1 -1
- package/bundled/web/.open-next/cache/{tZVfWmKSY7w1xF14qAb42 → qigxeWlGT_9_D5qWF8F9X}/_not-found.cache +1 -1
- package/bundled/web/.open-next/cache/qigxeWlGT_9_D5qWF8F9X/community/me/bots.cache +1 -0
- package/bundled/web/.open-next/cache/qigxeWlGT_9_D5qWF8F9X/community/me/machines.cache +1 -0
- package/bundled/web/.open-next/cache/qigxeWlGT_9_D5qWF8F9X/community/me.cache +1 -0
- package/bundled/web/.open-next/cache/{tZVfWmKSY7w1xF14qAb42 → qigxeWlGT_9_D5qWF8F9X}/community/preview.cache +1 -1
- package/bundled/web/.open-next/cache/{tZVfWmKSY7w1xF14qAb42 → qigxeWlGT_9_D5qWF8F9X}/community.cache +1 -1
- package/bundled/web/.open-next/cache/{tZVfWmKSY7w1xF14qAb42 → qigxeWlGT_9_D5qWF8F9X}/device.cache +1 -1
- package/bundled/web/.open-next/cache/{tZVfWmKSY7w1xF14qAb42 → qigxeWlGT_9_D5qWF8F9X}/privacy.cache +1 -1
- package/bundled/web/.open-next/cache/{tZVfWmKSY7w1xF14qAb42 → qigxeWlGT_9_D5qWF8F9X}/sitemap.xml.cache +1 -1
- package/bundled/web/.open-next/cloudflare/cache-assets-manifest.sql +1 -1
- package/bundled/web/.open-next/cloudflare/init.js +1 -1
- package/bundled/web/.open-next/dynamodb-provider/dynamodb-cache.json +1 -1
- package/bundled/web/.open-next/middleware/handler.mjs +4 -4
- package/bundled/web/.open-next/server-functions/default/src/web/.next/BUILD_ID +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/build-manifest.json +3 -3
- package/bundled/web/.open-next/server-functions/default/src/web/.next/prerender-manifest.json +3 -3
- package/bundled/web/.open-next/server-functions/default/src/web/.next/required-server-files.json +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/invite/[token]/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/studio/new/page_client-reference-manifest.js +1 -1
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/agents/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/calendar/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/flags/page_client-reference-manifest.js +1 -1
- 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
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/home/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/issues/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/runtimes/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/settings/page_client-reference-manifest.js +1 -1
- 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
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/traces/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/unread/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/workspaces/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(auth)/sign-in/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/community/channels/[serverId]/[channelId]/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/community/channels/[serverId]/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/community/channels/[serverId]/settings/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/community/invite/[token]/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/community/me/[dmId]/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/community/me/bots/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/community/me/machines/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/community/me/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/community/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/community/preview/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/device/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/privacy/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/templates/[id]/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/templates/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[turbopack]_runtime.js +36 -36
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_1_dhx4p._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_1ge300u._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_20o75d0._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/{[root-of-the-server]__1oiyvwe._.js → [root-of-the-server]__0-3fo13._.js} +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/{[root-of-the-server]__0o5bxat._.js → [root-of-the-server]__02lti39._.js} +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/{[root-of-the-server]__040fyn3._.js → [root-of-the-server]__08vq8pm._.js} +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/{[root-of-the-server]__04pxrz5._.js → [root-of-the-server]__0_2qrsu._.js} +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/{[root-of-the-server]__16l63mz._.js → [root-of-the-server]__0_a4to_._.js} +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/{[root-of-the-server]__0ymnehp._.js → [root-of-the-server]__0_rx5fo._.js} +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/{[root-of-the-server]__0nh19ia._.js → [root-of-the-server]__0_t2y0o._.js} +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/{[root-of-the-server]__1v_-hs4._.js → [root-of-the-server]__0avu0rw._.js} +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/{[root-of-the-server]__1wei18j._.js → [root-of-the-server]__0pqc2r_._.js} +2 -2
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/{[root-of-the-server]__1xvglbp._.js → [root-of-the-server]__0xbzzvs._.js} +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/{[root-of-the-server]__1tq74r0._.js → [root-of-the-server]__0xlvktw._.js} +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/[root-of-the-server]__0yiejq6._.js +3 -0
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/{[root-of-the-server]__0k5pvh9._.js → [root-of-the-server]__0zbv02p._.js} +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/{[root-of-the-server]__158oora._.js → [root-of-the-server]__11nm2yt._.js} +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/{[root-of-the-server]__1-swanp._.js → [root-of-the-server]__13v39j3._.js} +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/{[root-of-the-server]__0iumdq_._.js → [root-of-the-server]__170fci7._.js} +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/{[root-of-the-server]__1mp2nz1._.js → [root-of-the-server]__1an777y._.js} +2 -2
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/{[root-of-the-server]__1nclupn._.js → [root-of-the-server]__1b8g-kq._.js} +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/{[root-of-the-server]__14-q4q8._.js → [root-of-the-server]__1c1yh37._.js} +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/{[root-of-the-server]__0w212yf._.js → [root-of-the-server]__1d--k9n._.js} +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/{[root-of-the-server]__1khj-hl._.js → [root-of-the-server]__1dv15fs._.js} +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/{[root-of-the-server]__0k3aai5._.js → [root-of-the-server]__1koabdq._.js} +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/{[root-of-the-server]__0t4ltzi._.js → [root-of-the-server]__1swfkhi._.js} +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/{[root-of-the-server]__0zh8vme._.js → [root-of-the-server]__1u58tat._.js} +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/{[root-of-the-server]__1q_pfsh._.js → [root-of-the-server]__1x49fl7._.js} +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/{[root-of-the-server]__1vk26nd._.js → [root-of-the-server]__1xwz2e-._.js} +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/{[root-of-the-server]__0eajbpq._.js → [root-of-the-server]__20_qwfi._.js} +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/[turbopack]_runtime.js +36 -36
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/{_1_26hjj._.js → _0_ldmff._.js} +2 -2
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_0a9e1sh._.js +65 -0
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_0d2n_-3._.js +3 -0
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/{_0e299an._.js → _0n5q9kp._.js} +2 -2
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_0sc142i._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_0u1f2xw._.js +3 -0
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_0xcyjs-._.js +3 -0
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_10o51gr._.js +3 -0
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_12ymire._.js +3 -0
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/{_1wx0z09._.js → _1ew__s1._.js} +2 -2
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/src_shared_src_0w9s66q._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/src_web_src_1dr1pul._.js +1 -1
- 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
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/src_web_src_app_community_channels_[serverId]_[channelId]_page_tsx_10gja3t._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/src_web_src_hooks_community_mutations_00mez6z._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/middleware-build-manifest.js +3 -3
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/middleware-manifest.json +5 -5
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/server-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/server-reference-manifest.json +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/handler.mjs +121 -121
- package/bundled/web/.open-next/server-functions/default/src/web/handler.mjs.meta.json +454 -454
- package/bundled/web/.open-next/server-functions/default/src/web/index.mjs +4 -4
- package/bundled/ws-do/index.js +3 -1
- package/package.json +1 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/099a6pkd25_6c.js +0 -2
- package/bundled/web/.open-next/assets/_next/static/chunks/0cje8sxciw2bw.js +0 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/0e15-uvagvtoq.js +0 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/1bextmtm3d9_z.js +0 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/1e240j5v6a29o.js +0 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/1r60swwlk6bsi.js +0 -63
- package/bundled/web/.open-next/assets/_next/static/chunks/27xsd9yii2-bt.js +0 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/2vmt-oe13wn02.js +0 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/2xxoim6gb2hyv.js +0 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/3b_6ov7wl0l5b.js +0 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/3d-rbh9rp6cn4.js +0 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/3qa4ihpategpq.js +0 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/3wgh3u8c3z_ip.js +0 -1
- package/bundled/web/.open-next/cache/tZVfWmKSY7w1xF14qAb42/community/me/bots.cache +0 -1
- package/bundled/web/.open-next/cache/tZVfWmKSY7w1xF14qAb42/community/me/machines.cache +0 -1
- package/bundled/web/.open-next/cache/tZVfWmKSY7w1xF14qAb42/community/me.cache +0 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/[root-of-the-server]__0wekc86._.js +0 -3
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_013_jiv._.js +0 -3
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_05grdwx._.js +0 -3
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_0uzvb65._.js +0 -65
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_0z_7maj._.js +0 -3
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_12xn47o._.js +0 -3
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_1yq9nv0._.js +0 -3
- /package/bundled/web/.open-next/assets/_next/static/{tZVfWmKSY7w1xF14qAb42 → qigxeWlGT_9_D5qWF8F9X}/_buildManifest.js +0 -0
- /package/bundled/web/.open-next/assets/_next/static/{tZVfWmKSY7w1xF14qAb42 → qigxeWlGT_9_D5qWF8F9X}/_clientMiddlewareManifest.js +0 -0
- /package/bundled/web/.open-next/assets/_next/static/{tZVfWmKSY7w1xF14qAb42 → qigxeWlGT_9_D5qWF8F9X}/_ssgManifest.js +0 -0
- /package/bundled/web/.open-next/cache/{tZVfWmKSY7w1xF14qAb42 → qigxeWlGT_9_D5qWF8F9X}/robots.txt.cache +0 -0
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
module.exports=[99850,a=>{"use strict";var b=a.i(708343),c=a.i(487154),d=a.i(586889);let e=Object.freeze([]),f=Object.freeze([]),g=Object.freeze([]);a.s(["useAuditLog",0,function(a,e=!0){let g=!!a&&e,h=(0,b.useQuery)({queryKey:g?d.communityKeys.auditLog(a):d.communityKeys.auditLog("__none__"),queryFn:g?async()=>({entries:(await (0,c.apiFetch)(`/api/community/servers/${a}/audit-log`)).entries.map(a=>({actor:a.actor?.name??"System",action:a.log.action.replace(/_/g," "),target:a.log.targetType,createdAt:a.log.createdAt}))}):()=>Promise.reject(Error("disabled")),enabled:g});return{...h,entries:h.data?.entries??f}},"useInvites",0,function(a,f=!0){let g=!!a&&f,h=(0,b.useQuery)({queryKey:g?d.communityKeys.invites(a):d.communityKeys.invites("__none__"),queryFn:g?async()=>({invites:(await (0,c.apiFetch)(`/api/community/servers/${a}/invites`)).invites.map(a=>({code:a.token,uses:a.uses,maxUses:a.maxUses,expiresAt:a.expiresAt,by:a.creatorName??"Unknown",creatorId:a.creatorId}))}):()=>Promise.reject(Error("disabled")),enabled:g});return{...h,invites:h.data?.invites??e}},"usePresence",0,function(a){let e=!!a,f=(0,b.useQuery)({queryKey:e?d.communityKeys.presence(a):d.communityKeys.presence("__none__"),queryFn:e?()=>(0,c.apiFetch)(`/api/community/servers/${a}/presence`):()=>Promise.reject(Error("disabled")),enabled:e});return{...f,online:f.data?.online??g}}])},939624,a=>a.a(async(b,c)=>{try{var d=a.i(229073),e=a.i(226058),f=a.i(670209),g=a.i(364870),h=a.i(780956),i=a.i(487154),j=a.i(586889),k=a.i(432340),l=a.i(586220),m=a.i(6968),n=a.i(475713),o=a.i(109397),p=a.i(122519),q=a.i(587362),r=a.i(131731),s=a.i(166281);a.i(974936);var t=a.i(519116),u=a.i(425712),v=a.i(437253),w=a.i(669991),x=a.i(208847),y=a.i(258365),z=a.i(81213),A=a.i(99850),B=a.i(606617),C=a.i(491443);a.i(735042);var D=a.i(964831),E=a.i(91883),F=a.i(15841),G=a.i(192378),H=a.i(584861),I=b([o]);[o]=I.then?(await I)():I,a.s(["default",0,function({children:a}){let b=(0,f.useParams)(),c=(0,f.useSearchParams)(),I=decodeURIComponent(b.serverId),J=!!b.channelId,K=(0,f.useRouter)(),L=(0,l.useBreakpoint)(),M=(0,g.useQueryClient)(),N=(0,w.useCurrentUser)(),{server:O}=(0,x.useServer)(I),P=(0,y.useServerMembers)(I),Q=(0,B.useOnlineUserIds)(),R=(0,B.useCommunityWsStore)(a=>a.userStatuses),S=(0,e.useMemo)(()=>P.members.map(a=>{let b=R.get(a.userId);return{...a,status:(0,u.resolveRowPresence)(a,Q,N.id),statusEmoji:b?b.emoji:a.statusEmoji,statusText:b?b.text:a.statusText}}),[P.members,Q,N.id,R]),T=P.members.find(a=>a.userId===N.id),U=(0,t.canManageServer)(T?.role),{invites:V,isLoading:W}=(0,A.useInvites)(I,!0),{entries:X,isLoading:Y}=(0,A.useAuditLog)(I,U),{online:Z}=(0,A.usePresence)(I),$=(0,C.useNotificationSettings)(),_=$.server[I]??"Only @mentions",aa=$.channel,ab=(0,v.useCurrentChannelId)(),ac=(0,v.useCurrentChannelMeta)(),ad=(0,D.useCreateChannel)(),ae=(0,D.useDeleteChannel)(),af=(0,D.useMoveChannel)(),ag=(0,D.useCreateCategory)(),ah=(0,D.useUpdateCategory)(),ai=(0,D.useDeleteCategory)(),aj=(0,D.useReorderCategories)(),ak=(0,D.useReorderChannels)(),al=(0,E.useDeleteServer)(),am=(0,E.useUpdateServer)(),an=(0,E.useUploadServerIcon)(),ao=(0,F.useSetServerNotifLevel)(),ap=(0,G.useSetMemberRole)(),aq=(0,G.useKickMember)(),ar=(0,H.useRevokeInvite)();(0,e.useEffect)(()=>{v.useCommunityStore.getState().setCurrentServerId(I)},[I]);let as=(0,x.useServers)(),at=(0,e.useRef)(!1);(0,e.useEffect)(()=>{at.current||!as.isFetched||as.isFetching||as.servers.some(a=>a.id===I)||(at.current=!0,(0,z.consumeVoluntaryLeave)(I)||(0,h.toast)("You're no longer in this server"),K.replace((0,z.pickPostEjectDestination)(as.servers,I)))},[I,as.isFetched,as.isFetching,as.servers,K]),(0,e.useEffect)(()=>{at.current=!1},[I]),(0,e.useEffect)(()=>{B.useCommunityWsStore.getState().hydratePresence(Z)},[Z]);let[au,av]=(0,e.useState)(()=>J?"messages":"nav"),[aw,ax]=(0,e.useState)(!1),[ay,az]=(0,e.useState)("overview"),[aA,aB]=(0,e.useState)(!1),[aC,aD]=(0,e.useState)(null);(0,e.useEffect)(()=>{ax(!1),az("overview"),aB(!1)},[I]),(0,e.useEffect)(()=>{"1"===c.get("settings")&&ax(!0),"1"===c.get("invite")&&aB(!0)},[c]),(0,e.useEffect)(()=>{let a="1"===c.get("settings"),d="1"===c.get("invite");!a&&!d||!J&&O&&O.categories.some(a=>a.channels.length>0)||K.replace(J?`/community/channels/${I}/${b.channelId}`:`/community/channels/${I}`)},[c,I,K,J,O,b.channelId]);let aE=O?.categories??[],aF=(0,m.useChannelTree)(aE),aG=(0,e.useCallback)(()=>{av("nav"),K.push("/community/me")},[K]),aH=(0,e.useCallback)(()=>{av("nav")},[]),aI=(0,e.useCallback)(a=>{K.push(`/community/channels/${I}/${a}`),aF.markRead(a),M.setQueryData(j.communityKeys.server(I),b=>(0,n.patchChannelUnread)(b,a,!1)),"mobile"===L&&av("messages")},[K,I,aF,L,M]),aJ=(0,e.useCallback)(a=>{a&&az(a),ax(!0)},[]),aK=(0,e.useCallback)(()=>{(0,h.toast)("Only admins can create channels in a private category")},[]),aL=(0,e.useMemo)(()=>Object.fromEntries(Object.entries(aa).map(([a,b])=>[a,"Nothing"===b])),[aa]),aM=(0,e.useCallback)((a,b,c)=>{ad.
|
|
1
|
+
module.exports=[99850,a=>{"use strict";var b=a.i(708343),c=a.i(487154),d=a.i(586889);let e=Object.freeze([]),f=Object.freeze([]),g=Object.freeze([]);a.s(["useAuditLog",0,function(a,e=!0){let g=!!a&&e,h=(0,b.useQuery)({queryKey:g?d.communityKeys.auditLog(a):d.communityKeys.auditLog("__none__"),queryFn:g?async()=>({entries:(await (0,c.apiFetch)(`/api/community/servers/${a}/audit-log`)).entries.map(a=>({actor:a.actor?.name??"System",action:a.log.action.replace(/_/g," "),target:a.log.targetType,createdAt:a.log.createdAt}))}):()=>Promise.reject(Error("disabled")),enabled:g});return{...h,entries:h.data?.entries??f}},"useInvites",0,function(a,f=!0){let g=!!a&&f,h=(0,b.useQuery)({queryKey:g?d.communityKeys.invites(a):d.communityKeys.invites("__none__"),queryFn:g?async()=>({invites:(await (0,c.apiFetch)(`/api/community/servers/${a}/invites`)).invites.map(a=>({code:a.token,uses:a.uses,maxUses:a.maxUses,expiresAt:a.expiresAt,by:a.creatorName??"Unknown",creatorId:a.creatorId}))}):()=>Promise.reject(Error("disabled")),enabled:g});return{...h,invites:h.data?.invites??e}},"usePresence",0,function(a){let e=!!a,f=(0,b.useQuery)({queryKey:e?d.communityKeys.presence(a):d.communityKeys.presence("__none__"),queryFn:e?()=>(0,c.apiFetch)(`/api/community/servers/${a}/presence`):()=>Promise.reject(Error("disabled")),enabled:e});return{...f,online:f.data?.online??g}}])},939624,a=>a.a(async(b,c)=>{try{var d=a.i(229073),e=a.i(226058),f=a.i(670209),g=a.i(364870),h=a.i(780956),i=a.i(487154),j=a.i(586889),k=a.i(432340),l=a.i(586220),m=a.i(6968),n=a.i(475713),o=a.i(109397),p=a.i(122519),q=a.i(587362),r=a.i(131731),s=a.i(166281);a.i(974936);var t=a.i(519116),u=a.i(425712),v=a.i(437253),w=a.i(669991),x=a.i(208847),y=a.i(258365),z=a.i(81213),A=a.i(99850),B=a.i(606617),C=a.i(491443);a.i(735042);var D=a.i(964831),E=a.i(91883),F=a.i(15841),G=a.i(192378),H=a.i(584861),I=b([o]);[o]=I.then?(await I)():I,a.s(["default",0,function({children:a}){let b=(0,f.useParams)(),c=(0,f.useSearchParams)(),I=decodeURIComponent(b.serverId),J=!!b.channelId,K=(0,f.useRouter)(),L=(0,l.useBreakpoint)(),M=(0,g.useQueryClient)(),N=(0,w.useCurrentUser)(),{server:O}=(0,x.useServer)(I),P=(0,y.useServerMembers)(I),Q=(0,B.useOnlineUserIds)(),R=(0,B.useCommunityWsStore)(a=>a.userStatuses),S=(0,e.useMemo)(()=>P.members.map(a=>{let b=R.get(a.userId);return{...a,status:(0,u.resolveRowPresence)(a,Q,N.id),statusEmoji:b?b.emoji:a.statusEmoji,statusText:b?b.text:a.statusText}}),[P.members,Q,N.id,R]),T=P.members.find(a=>a.userId===N.id),U=(0,t.canManageServer)(T?.role),{invites:V,isLoading:W}=(0,A.useInvites)(I,!0),{entries:X,isLoading:Y}=(0,A.useAuditLog)(I,U),{online:Z}=(0,A.usePresence)(I),$=(0,C.useNotificationSettings)(),_=$.server[I]??"Only @mentions",aa=$.channel,ab=(0,v.useCurrentChannelId)(),ac=(0,v.useCurrentChannelMeta)(),ad=(0,D.useCreateChannel)(),ae=(0,D.useDeleteChannel)(),af=(0,D.useMoveChannel)(),ag=(0,D.useCreateCategory)(),ah=(0,D.useUpdateCategory)(),ai=(0,D.useDeleteCategory)(),aj=(0,D.useReorderCategories)(),ak=(0,D.useReorderChannels)(),al=(0,E.useDeleteServer)(),am=(0,E.useUpdateServer)(),an=(0,E.useUploadServerIcon)(),ao=(0,F.useSetServerNotifLevel)(),ap=(0,G.useSetMemberRole)(),aq=(0,G.useKickMember)(),ar=(0,H.useRevokeInvite)();(0,e.useEffect)(()=>{v.useCommunityStore.getState().setCurrentServerId(I)},[I]);let as=(0,x.useServers)(),at=(0,e.useRef)(!1);(0,e.useEffect)(()=>{at.current||!as.isFetched||as.isFetching||as.servers.some(a=>a.id===I)||(at.current=!0,(0,z.consumeVoluntaryLeave)(I)||(0,h.toast)("You're no longer in this server"),K.replace((0,z.pickPostEjectDestination)(as.servers,I)))},[I,as.isFetched,as.isFetching,as.servers,K]),(0,e.useEffect)(()=>{at.current=!1},[I]),(0,e.useEffect)(()=>{B.useCommunityWsStore.getState().hydratePresence(Z)},[Z]);let[au,av]=(0,e.useState)(()=>J?"messages":"nav"),[aw,ax]=(0,e.useState)(!1),[ay,az]=(0,e.useState)("overview"),[aA,aB]=(0,e.useState)(!1),[aC,aD]=(0,e.useState)(null);(0,e.useEffect)(()=>{ax(!1),az("overview"),aB(!1)},[I]),(0,e.useEffect)(()=>{"1"===c.get("settings")&&ax(!0),"1"===c.get("invite")&&aB(!0)},[c]),(0,e.useEffect)(()=>{let a="1"===c.get("settings"),d="1"===c.get("invite");!a&&!d||!J&&O&&O.categories.some(a=>a.channels.length>0)||K.replace(J?`/community/channels/${I}/${b.channelId}`:`/community/channels/${I}`)},[c,I,K,J,O,b.channelId]);let aE=O?.categories??[],aF=(0,m.useChannelTree)(aE),aG=(0,e.useCallback)(()=>{av("nav"),K.push("/community/me")},[K]),aH=(0,e.useCallback)(()=>{av("nav")},[]),aI=(0,e.useCallback)(a=>{K.push(`/community/channels/${I}/${a}`),aF.markRead(a),M.setQueryData(j.communityKeys.server(I),b=>(0,n.patchChannelUnread)(b,a,!1)),"mobile"===L&&av("messages")},[K,I,aF,L,M]),aJ=(0,e.useCallback)(a=>{a&&az(a),ax(!0)},[]),aK=(0,e.useCallback)(()=>{(0,h.toast)("Only admins can create channels in a private category")},[]),aL=(0,e.useMemo)(()=>Object.fromEntries(Object.entries(aa).map(([a,b])=>[a,"Nothing"===b])),[aa]),aM=(0,e.useCallback)(async(a,b,c)=>{try{return(await ad.mutateAsync({serverId:I,categoryId:a,name:b,type:c})).channel.id}catch(a){return(0,i.toastApiError)(a,"Failed to create channel"),null}},[ad,I]),aN=(0,e.useCallback)((a,b)=>{ag.mutate({serverId:I,name:a,private:b?.private},{onError:a=>(0,i.toastApiError)(a,"Failed to create category")})},[ag,I]),aO=(0,e.useCallback)(async(a,b)=>{try{await (0,i.apiFetch)(`/api/community/channels/${a}`,{method:"PATCH",body:JSON.stringify({name:b})})}catch(a){(0,i.toastApiError)(a,"Failed to rename channel")}},[]),aP=(0,e.useCallback)(a=>{ae.mutate({serverId:I,channelId:a},{onError:a=>(0,i.toastApiError)(a,"Failed to delete channel")})},[ae,I]),aQ=(0,e.useCallback)(a=>{ai.mutate({serverId:I,categoryId:a},{onError:a=>(0,i.toastApiError)(a,"Failed to delete category")})},[ai,I]),aR=(0,e.useCallback)((a,b)=>{ah.mutate({serverId:I,categoryId:a,name:b.name},{onError:a=>(0,i.toastApiError)(a,"Failed to update category")})},[ah,I]),aS=(0,e.useCallback)(a=>{aj.mutate({serverId:I,categoryIds:a},{onError:a=>(0,i.toastApiError)(a,"Failed to save category order")})},[aj,I]),aT=(0,e.useCallback)(a=>{ak.mutate({serverId:I,channelIds:a},{onError:a=>(0,i.toastApiError)(a,"Failed to save channel order")})},[ak,I]),aU=(0,e.useCallback)((a,b)=>{af.mutate({serverId:I,channelId:a,categoryId:b},{onError:a=>(0,i.toastApiError)(a,"Failed to move channel")})},[af,I]),aV=(0,e.useCallback)(()=>{(0,h.toast)("Can't move a channel between public and private categories")},[]),aW=(0,e.useMemo)(()=>({tree:aF,serverName:O?.name??"",serverIcon:O?.icon??null,activeChannel:ac?.parentChannelId??ab??"",isAdmin:U,currentUserId:N.id,loading:!O,setActiveChannel:aI,onOpenSettings:U?aJ:void 0,onBlockedCreate:aK,mutedChannels:aL,onCreateChannel:aM,onCreateCategory:aN,onRenameChannel:aO,onDeleteChannel:aP,onDeleteCategory:aQ,onUpdateCategory:aR,onReorderCategories:aS,onReorderChannels:aT,onMoveChannel:aU,onBlockedMove:aV,serverId:I,invitePopoverOpen:aA,onInvitePopoverOpenChange:aB}),[aF,O,ac?.parentChannelId,ab,U,N.id,aI,aJ,aK,aL,aM,aN,aO,aP,aQ,aR,aS,aT,aU,aV,I,aA]),aX=()=>{ax(!1),az("overview")},aY=(0,e.useCallback)((a={})=>(0,d.jsx)(p.ChannelSidebar,{...aW,...a}),[aW]),aZ=(0,d.jsx)(k.Dialog,{open:aw,onOpenChange:a=>{a||aX()},children:(0,d.jsx)(k.DialogContent,{className:"flex h-[calc(100vh-4rem)] max-h-180 w-[calc(100vw-4rem)] sm:max-w-4xl flex-col gap-0 overflow-hidden rounded-xl p-0",showCloseButton:!1,children:(0,d.jsx)(q.ServerSettings,{section:ay,setSection:az,onClose:aX,serverName:O?.name??"",serverDescription:O?.description??"",serverIcon:O?.icon??null,members:S,membersLoading:P.loading,membersLoadingMore:P.loadingMore,membersHasMore:P.hasMore,membersTotal:P.total,onLoadMoreMembers:P.loadMore,onSearchMembers:P.searchMembers,invites:V,invitesLoading:W,auditLog:X,auditLogLoading:Y,onKickMember:a=>{aq.mutate({serverId:I,memberId:a},{onSuccess:()=>(0,h.toast)("Member kicked"),onError:a=>(0,i.toastApiError)(a,"Failed to kick member")})},onSetRole:(a,b)=>{ap.mutate({serverId:I,memberId:a,role:b},{onSuccess:()=>(0,h.toast)("Role updated"),onError:a=>(0,i.toastApiError)(a,"Failed to update role")})},onRevokeInvite:a=>ar.mutate({serverId:I,code:a},{onSuccess:()=>(0,h.toast)("Invite revoked"),onError:a=>(0,i.toastApiError)(a,"Failed to revoke invite")}),onCopyInvite:a=>{navigator.clipboard?.writeText(`${window.location.origin}/community/invite/${a}`),(0,h.toast)("Invite copied")},onDeleteServer:async()=>{aX(),al.mutate({serverId:I},{onSuccess:()=>{(0,h.toast)("Server deleted"),v.useCommunityStore.getState().setCurrentServerId(null),K.push("/community/me")},onError:a=>(0,i.toastApiError)(a,"Failed to delete server")})},onUploadIcon:()=>{let a=document.createElement("input");a.type="file",a.accept="image/png,image/jpeg,image/webp",a.onchange=()=>{let b=a.files?.[0];if(!b)return;let c=(0,s.validateIconSourceFile)(b);c.ok?aD({src:URL.createObjectURL(b),fileName:b.name}):(0,h.toast)(c.error)},a.click()},onUpdateServer:(a,b)=>am.mutate({serverId:I,name:a,description:b},{onSuccess:()=>(0,h.toast)("Server updated"),onError:a=>(0,i.toastApiError)(a,"Failed to update server")}),notifLevel:_,onSetNotifLevel:a=>ao.mutate({serverId:I,level:a},{onError:a=>(0,i.toastApiError)(a,"Failed to update notification level")}),onOpenProfile:(a,b,c,d)=>{v.useCommunityStore.getState().uiHandlers.openProfile?.(a,b,c,d)}})})}),a$=aC&&(0,d.jsx)(r.ImageCropDialog,{imageSrc:aC.src,originalFileName:aC.fileName,maskShape:"square",onCropped:a=>{an.mutate({serverId:I,file:a},{onSuccess:()=>(0,h.toast)("Server icon updated"),onError:a=>(0,i.toastApiError)(a,"Failed to upload icon")}),URL.revokeObjectURL(aC.src),aD(null)},onCancel:()=>{URL.revokeObjectURL(aC.src),aD(null)}});return(0,d.jsx)(o.ShellFrame,{view:"server",activeServerId:I,mobileZone:au,setMobileZone:av,sidebar:aY,extraDialogs:(0,d.jsxs)(d.Fragment,{children:[aZ,a$]}),goHome:aG,goServer:aH,children:a})}]),c()}catch(a){c(a)}},!1)];
|
|
2
2
|
|
|
3
3
|
//# sourceMappingURL=src_web_src_1dr1pul._.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
module.exports=[597047,a=>a.a(async(b,c)=>{try{var d=a.i(229073),e=a.i(226058),f=a.i(780956),g=a.i(670209),h=a.i(506180),i=a.i(454607);a.i(4338);var j=a.i(514746),k=a.i(732254),l=a.i(334235),m=a.i(76592),n=a.i(25668),o=a.i(390248),p=a.i(946621),q=b([i]);[i]=q.then?(await q)():q,a.s(["GeneralTab",0,function(){let{workspaceId:a,slug:b}=(0,h.useWorkspace)(),c=(0,i.useSession)(),q=(0,g.useRouter)(),[r,s]=(0,e.useState)(""),[t,u]=(0,e.useState)(!0),[v,w]=(0,e.useState)(""),[x,y]=(0,e.useState)(""),[z,A]=(0,e.useState)(""),[B,C]=(0,e.useState)(""),[D,E]=(0,e.useState)(!1),[F,G]=(0,e.useState)({}),[H,I]=(0,e.useState)(""),[J,K]=(0,e.useState)(!1),L=(0,e.useCallback)(async()=>{u(!0);try{let b=c.data?.user?.id,[d,e]=await Promise.all([(0,j.listMembers)(a),(0,j.listWorkspaces)()]),f=d.find(a=>a.user_id===b);s(f?.role??"");let g=e.find(b=>b.id===a);g&&(w(g.name),y(g.slug),A(g.name),C(g.slug))}catch(a){f.toast.error(a instanceof Error?a.message:"Failed to load workspace info")}finally{u(!1)}},[a,c.data?.user?.id]);(0,e.useEffect)(()=>{c.data&&L()},[L,c.data]);let M=v!==z||x!==B,N=async()=>{let c=(0,o.validateWorkspaceForm)({name:v,slug:x});if(G(c),!(0,o.hasWorkspaceFormErrors)(c)){E(!0);try{let c=await (0,j.updateWorkspace)(a,{name:v.trim(),slug:x.trim()});(0,p.trackSettingsUpdated)({setting_tab:"general"}),A(c.name),C(c.slug),f.toast.success("Workspace updated"),c.slug!==b&&q.replace(`/w/${c.slug}/settings`)}catch(a){f.toast.error(a instanceof Error?a.message:"Failed to update workspace")}finally{E(!1)}}},O=async()=>{if(H===z){K(!0);try{await (0,j.deleteWorkspace)(a,z),f.toast.success("Workspace deleted"),q.replace("/workspaces")}catch(a){f.toast.error(a instanceof Error?a.message:"Failed to delete workspace")}finally{K(!1)}}};return t?(0,d.jsxs)("div",{className:"space-y-4",children:[(0,d.jsx)(n.Skeleton,{className:"h-4 w-32"}),(0,d.jsx)(n.Skeleton,{className:"h-10 w-full"}),(0,d.jsx)(n.Skeleton,{className:"h-10 w-full"})]}):"owner"!==r?(0,d.jsx)("p",{className:"text-sm text-muted-foreground",children:"Only workspace owners can edit workspace settings."}):(0,d.jsxs)("div",{className:"space-y-10",children:[(0,d.jsxs)("section",{className:"space-y-4",children:[(0,d.jsx)("h2",{className:"text-sm font-medium",children:"Workspace"}),(0,d.jsxs)("div",{className:"space-y-3",children:[(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsx)(m.Label,{htmlFor:"workspace-name",children:"Name"}),(0,d.jsx)(l.Input,{id:"workspace-name",value:v,onChange:a=>{let b=a.target.value;w(b),F.name&&b.trim()&&G(a=>({...a,name:void 0}))},placeholder:"Workspace name","aria-invalid":!!F.name,"aria-describedby":F.name?"workspace-name-error":void 0}),F.name&&(0,d.jsx)("p",{id:"workspace-name-error",className:"text-xs text-destructive",children:F.name})]}),(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsx)(m.Label,{htmlFor:"workspace-slug",children:"Slug"}),(0,d.jsx)(l.Input,{id:"workspace-slug",value:x,onChange:a=>{let b=a.target.value;y(b),F.slug&&b.trim()&&G(a=>({...a,slug:void 0}))},placeholder:"workspace-slug","aria-invalid":!!F.slug,"aria-describedby":F.slug?"workspace-slug-error":void 0}),F.slug&&(0,d.jsx)("p",{id:"workspace-slug-error",className:"text-xs text-destructive",children:F.slug}),(0,d.jsxs)("p",{className:"text-xs text-muted-foreground/70",children:["Used in URLs: /w/",x,"/"]})]})]}),(0,d.jsx)(k.Button,{size:"sm",onClick:N,disabled:!M||D,children:D?"Saving…":"Save"})]}),(0,d.jsxs)("section",{className:"space-y-4",children:[(0,d.jsx)("h2",{className:"text-sm font-medium text-destructive",children:"Danger Zone"}),(0,d.jsxs)("div",{className:"rounded-md border border-destructive/30 p-4 space-y-3",children:[(0,d.jsx)("p",{className:"text-sm text-muted-foreground",children:"Deleting this workspace is permanent and cannot be undone. All agents, conversations, and data will be lost."}),(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsxs)(m.Label,{htmlFor:"delete-confirm",className:"text-xs",children:["Type ",(0,d.jsx)("span",{className:"font-medium text-foreground",children:z})," to confirm"]}),(0,d.jsx)(l.Input,{id:"delete-confirm",value:H,onChange:a=>I(a.target.value),placeholder:z})]}),(0,d.jsx)(k.Button,{size:"sm",variant:"destructive",onClick:O,disabled:H!==z||J,children:J?"Deleting…":"Delete Workspace"})]})]})]})}]),c()}catch(a){c(a)}},!1),53909,a=>{"use strict";var b=a.i(229073),c=a.i(226058),d=a.i(780956),e=a.i(506180);a.i(4338);var f=a.i(514746),g=a.i(889624),h=a.i(25668),i=a.i(75118);function j({ratio:a,size:c=16,stroke:d=1.5}){let e=(c-d)/2,f=2*Math.PI*e,g=(a<=0?0:a>=1?1:Math.log1p(99*a)/Math.log(100))*f;return(0,b.jsxs)("svg",{width:c,height:c,className:"shrink-0 -rotate-90","aria-hidden":!0,children:[(0,b.jsx)("circle",{cx:c/2,cy:c/2,r:e,fill:"none",stroke:"currentColor",strokeWidth:d,className:"text-border"}),(0,b.jsx)("circle",{cx:c/2,cy:c/2,r:e,fill:"none",stroke:"currentColor",strokeWidth:d,strokeDasharray:`${g} ${f-g}`,strokeLinecap:"round",className:(0,i.cn)("transition-all duration-300",a>.9?"text-destructive/70":a>.7?"text-yellow-500/50":"text-muted-foreground/30")})]})}a.s(["InstructionTab",0,function(){let{workspaceId:a}=(0,e.useWorkspace)(),[i,k]=(0,c.useState)(""),[l,m]=(0,c.useState)(""),[n,o]=(0,c.useState)(!0),p=(0,c.useRef)(i);(0,c.useEffect)(()=>{p.current=i},[i]);let q=(0,c.useRef)(l);(0,c.useEffect)(()=>{q.current=l},[l]);let r=(0,c.useRef)(null),s=(0,c.useRef)(!1),t=(0,c.useCallback)(async()=>{o(!0);try{let b=await (0,f.getMemberMe)(a);k(b.global_instruction),m(b.global_instruction)}catch(a){d.toast.error(a instanceof Error?a.message:"Failed to load settings")}finally{o(!1)}},[a]);(0,c.useEffect)(()=>{t()},[t]);let u=(0,c.useRef)(()=>{}),v=(0,c.useCallback)(async()=>{if(s.current)return;let b=p.current;if(b!==q.current){s.current=!0;try{let c=await (0,f.updateMemberMe)(a,b);m(c.global_instruction)}catch(a){d.toast.error(a instanceof Error?a.message:"Failed to save")}finally{s.current=!1,p.current!==q.current&&u.current()}}},[a]),w=(0,c.useCallback)(()=>{r.current&&clearTimeout(r.current),r.current=setTimeout(v,500)},[v]);(0,c.useEffect)(()=>{u.current=w},[w]);let x=(0,c.useCallback)(a=>{k(a),w()},[w]);(0,c.useEffect)(()=>{let b=()=>{if(r.current&&clearTimeout(r.current),p.current!==q.current){let b=new URLSearchParams({workspace_id:a});fetch(`/api/members/me?${b}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({global_instruction:p.current}),keepalive:!0})}};return window.addEventListener("beforeunload",b),()=>window.removeEventListener("beforeunload",b)},[a]),(0,c.useEffect)(()=>()=>{if(r.current&&clearTimeout(r.current),p.current!==q.current){let b=new URLSearchParams({workspace_id:a});fetch(`/api/members/me?${b}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({global_instruction:p.current}),keepalive:!0})}},[a]);let y=i.length/5e4;return n?(0,b.jsxs)("div",{className:"px-6 py-6 space-y-4",children:[(0,b.jsx)(h.Skeleton,{className:"h-4 w-48"}),(0,b.jsx)(h.Skeleton,{className:"h-40 w-full"})]}):(0,b.jsxs)("div",{className:"flex flex-col h-full",children:[(0,b.jsx)("div",{className:"flex-1 px-6 pt-4 pb-4",children:(0,b.jsx)(g.MarkdownEditor,{value:i,onChange:x,placeholder:"Write instructions that every agent you own will follow...",minHeight:"calc(100vh - 240px)",contentType:"markdown",variant:"seamless"})}),(0,b.jsxs)("div",{className:"flex items-center gap-2 px-6 py-3",children:[(0,b.jsx)(j,{ratio:y}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:"This instruction is prepended to every agent's individual instruction."})]})]})}])},616131,a=>a.a(async(b,c)=>{try{var d=a.i(229073),e=a.i(226058),f=a.i(780956),g=a.i(447284),h=a.i(464687),i=a.i(179291),j=a.i(500331),k=a.i(506180),l=a.i(454607);a.i(4338);var m=a.i(514746),n=a.i(732254),o=a.i(25668),p=a.i(525132),q=a.i(75118),r=a.i(946621),s=a.i(377447),t=b([l]);function u(a){return`${window.location.origin}/invite/${a}`}[l]=t.then?(await t)():t,a.s(["MembersTab",0,function(){let{workspaceId:a}=(0,k.useWorkspace)(),b=(0,l.useSession)(),c=b.data?.user?.id,[t,v]=(0,e.useState)([]),[w,x]=(0,e.useState)([]),[y,z]=(0,e.useState)(!0),[A,B]=(0,e.useState)(!1),C=t.find(a=>a.user_id===c)?.role==="owner",D=(0,e.useCallback)(async()=>{z(!0);try{let[b,c]=await Promise.all([(0,m.listMembers)(a),(0,m.listInvites)(a).catch(()=>[])]);v(b),x(c)}catch(a){f.toast.error(a instanceof Error?a.message:"Failed to load members")}finally{z(!1)}},[a]);(0,e.useEffect)(()=>{D()},[D]);let E=async()=>{B(!0);try{let b=await (0,m.createInvite)(a);(0,r.trackTeamMemberInvited)({workspace_id:a}),x(a=>[...a,b]);let c=u(b.token);await navigator.clipboard.writeText(c),f.toast.success("Invite link copied to clipboard")}catch(a){f.toast.error(a instanceof Error?a.message:"Failed to generate invite")}finally{B(!1)}},F=async a=>{let b=u(a);try{await navigator.clipboard.writeText(b),f.toast.success("Invite link copied")}catch{f.toast.error("Failed to copy link")}},G=async b=>{try{await (0,m.revokeInvite)(a,b),x(a=>a.filter(a=>a.id!==b)),f.toast.success("Invite revoked")}catch(a){f.toast.error(a instanceof Error?a.message:"Failed to revoke invite")}},H=async b=>{try{await (0,m.removeMember)(a,b),v(a=>a.filter(a=>a.id!==b)),f.toast.success("Member removed")}catch(a){f.toast.error(a instanceof Error?a.message:"Failed to remove member")}};return y?(0,d.jsxs)("div",{className:"space-y-4",children:[(0,d.jsx)(o.Skeleton,{className:"h-4 w-24"}),(0,d.jsx)(o.Skeleton,{className:"h-10 w-full"}),(0,d.jsx)(o.Skeleton,{className:"h-10 w-full"}),(0,d.jsx)(o.Skeleton,{className:"h-4 w-24 mt-6"}),(0,d.jsx)(o.Skeleton,{className:"h-10 w-full"}),(0,d.jsx)(o.Skeleton,{className:"h-10 w-full"})]}):(0,d.jsxs)("div",{className:"space-y-8",children:[C&&(0,d.jsxs)("section",{className:"space-y-3",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsx)("h2",{className:"text-sm font-medium",children:"Pending Invites"}),(0,d.jsxs)(n.Button,{size:"sm",variant:"outline",onClick:E,disabled:A,children:[(0,d.jsx)(i.Plus,{className:"size-3.5 mr-1"}),A?"Generating…":"Generate invite link"]})]}),0===w.length?(0,d.jsx)("p",{className:"text-xs text-muted-foreground py-2",children:"No active invite links. Generate one to invite someone to this workspace."}):(0,d.jsx)("div",{className:"space-y-2",children:w.map(a=>{let b=new Date(a.expires_at),c=b<new Date;return(0,d.jsxs)("div",{className:"flex items-center justify-between rounded-md border border-border/50 px-3 py-2 text-xs",children:[(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsxs)("p",{className:(0,q.cn)("font-mono truncate",c&&"text-muted-foreground line-through"),children:["/invite/",a.token.slice(0,12),"…"]}),(0,d.jsx)("p",{className:(0,q.cn)("text-muted-foreground/70 mt-1",c&&"text-destructive/70"),children:c?"Expired":`Expires ${b.toLocaleDateString()}`})]}),(0,d.jsxs)("div",{className:"flex items-center gap-1 ml-2 shrink-0",children:[!c&&(0,d.jsxs)(p.Tooltip,{children:[(0,d.jsx)(p.TooltipTrigger,{render:(0,d.jsx)(n.Button,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0",onClick:()=>F(a.token)}),children:(0,d.jsx)(g.Copy,{className:"size-3.5"})}),(0,d.jsx)(p.TooltipContent,{children:"Copy invite link"})]}),(0,d.jsxs)(p.Tooltip,{children:[(0,d.jsx)(p.TooltipTrigger,{render:(0,d.jsx)(n.Button,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0 text-destructive hover:text-destructive",onClick:()=>G(a.id)}),children:(0,d.jsx)(h.Trash2,{className:"size-3.5"})}),(0,d.jsx)(p.TooltipContent,{children:"Revoke invite"})]})]})]},a.id)})})]}),(0,d.jsxs)("section",{className:"space-y-3",children:[(0,d.jsx)("h2",{className:"text-sm font-medium",children:"Members"}),(0,d.jsx)("div",{className:"space-y-2",children:t.map(a=>{let b=a.user_id===c,e=(0,s.displayName)(a).split(" ").map(a=>a[0]).join("").slice(0,2).toUpperCase();return(0,d.jsxs)("div",{className:"flex items-center gap-3 rounded-md border border-border/50 px-3 py-2",children:[(0,d.jsx)("div",{className:"size-7 rounded-full bg-muted flex items-center justify-center text-xs font-medium text-muted-foreground shrink-0 overflow-hidden",children:a.image?(0,d.jsx)("img",{src:a.image,alt:a.name,className:"size-full object-cover"}):e}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsxs)("p",{className:"text-sm font-medium truncate leading-tight",children:[(0,s.displayName)(a),b&&(0,d.jsx)("span",{className:"ml-2 text-xs text-muted-foreground font-normal",children:"(you)"})]}),a.name&&(0,d.jsx)("p",{className:"text-xs text-muted-foreground truncate",children:a.email})]}),(0,d.jsx)("span",{className:(0,q.cn)("text-xs px-2 py-1 rounded shrink-0","owner"===a.role?"bg-primary/10 text-primary":"bg-muted text-muted-foreground"),children:a.role}),C&&!b&&(0,d.jsxs)(p.Tooltip,{children:[(0,d.jsx)(p.TooltipTrigger,{render:(0,d.jsx)(n.Button,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0 text-muted-foreground hover:text-destructive shrink-0",onClick:()=>H(a.id)}),children:(0,d.jsx)(j.UserMinus,{className:"size-3.5"})}),(0,d.jsx)(p.TooltipContent,{children:"Remove member"})]})]},a.id)})})]})]})}]),c()}catch(a){c(a)}},!1),93590,a=>{"use strict";var b=a.i(229073),c=a.i(226058),d=a.i(780956),e=a.i(951687),f=a.i(973111),g=a.i(626806);a.s(["NotificationTab",0,function(){let[a,h]=(0,c.useState)(!1),[i,j]=(0,c.useState)([...g.NOTIFICATION_EVENTS]),[k,l]=(0,c.useState)(!0),[m,n]=(0,c.useState)(!1);(0,c.useEffect)(()=>{l((0,g.isNotificationSupported)()),h((0,g.getNotificationEnabled)()),j((0,g.getNotificationEvents)()),(0,g.isNotificationSupported)()&&n("denied"===Notification.permission)},[]);let o=async a=>{if(!a){h(!1),(0,g.setNotificationEnabled)(!1);return}await (0,g.requestNotificationPermission)()?(h(!0),(0,g.setNotificationEnabled)(!0)):(n(!0),d.toast.error("Notification permission denied. Please enable it in browser settings."))};return k?(0,b.jsx)("div",{className:"space-y-6",children:(0,b.jsxs)("section",{className:"space-y-4",children:[(0,b.jsx)("h2",{className:"text-sm font-medium",children:"Browser Notifications"}),(0,b.jsxs)("div",{className:"space-y-3",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between",children:[(0,b.jsxs)("div",{className:"space-y-1",children:[(0,b.jsx)("p",{className:"text-sm",children:"Enable notifications"}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:"Get notified when tasks finish while the tab is in the background"})]}),(0,b.jsx)(f.Switch,{checked:a,onCheckedChange:o,disabled:m&&!a})]}),m&&!a&&(0,b.jsx)("p",{className:"text-xs text-destructive",children:"Notification permission was denied. Please allow it in your browser settings."}),a&&(0,b.jsxs)("div",{className:"space-y-2 pl-0.5",children:[(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:"Notify me when:"}),g.NOTIFICATION_EVENTS.map(a=>(0,b.jsxs)("label",{className:"flex items-center gap-2 text-sm cursor-pointer select-none",children:[(0,b.jsx)(e.Checkbox,{checked:i.includes(a),onCheckedChange:()=>{j(b=>{let c=b.includes(a)?b.filter(b=>b!==a):[...b,a];return(0,g.setNotificationEvents)(c),c})}}),g.NOTIFICATION_EVENT_LABELS[a]]},a))]})]})]})}):(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:"Your browser does not support notifications."})}])},390946,a=>{"use strict";var b=a.i(229073),c=a.i(226058);let d=(0,a.i(815624).default)("sparkles",[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]]),e="alook-cloud-code-monster-pet-preset-v1",f="alook-cloud-code-monster-pet-preset-changed",g=new Map([{id:"pet-02",name:"Pocket Bell Bot",group:"Inspired Mascots",feature:"bell",shape:"gadget-buddy"},{id:"pet-03",name:"Spark Bolt Pal",group:"Inspired Mascots",feature:"bolt",shape:"electric-mascot"},{id:"pet-04",name:"Star Puff",group:"Inspired Mascots",feature:"star",shape:"star-puff"},{id:"pet-05",name:"Leaf Bud",group:"Inspired Mascots",feature:"leaf",shape:"leaf-bud-shape"},{id:"pet-06",name:"Tiny Flame",group:"Inspired Mascots",feature:"flame",shape:"ember-scout"},{id:"pet-07",name:"Shell Fin",group:"Inspired Mascots",feature:"fins",shape:"shell-sprout"},{id:"pet-08",name:"Block Builder",group:"Inspired Mascots",feature:"visor",shape:"block-builder-shape"},{id:"pet-09",name:"Block Hiss",group:"Inspired Mascots",feature:"mask",shape:"block-hiss-shape"},{id:"pet-10",name:"Block Walker",group:"Inspired Mascots",feature:"visor",shape:"block-walker-shape"},{id:"pet-11",name:"Mushroom Pal",group:"Inspired Mascots",feature:"mushroom",shape:"mushroom-pal-shape"},{id:"pet-12",name:"Blue Spin",group:"Inspired Mascots",feature:"spin",shape:"blue-spinner"},{id:"pet-13",name:"Arcade Chomp",group:"Inspired Mascots",feature:"chomp",shape:"arcade-chomper"},{id:"pet-14",name:"Peek Ghost",group:"Inspired Mascots",feature:"ghost",shape:"peek-ghost-shape"},{id:"pet-15",name:"Red Cap Jumper",group:"Inspired Mascots",feature:"cap",shape:"cap-jumper"},{id:"pet-16",name:"Honey Cub",group:"Inspired Mascots",feature:"ears",shape:"honey-cub-shape"},{id:"pet-17",name:"Ribbon Cat",group:"Inspired Mascots",feature:"bow",shape:"ribbon-cat-shape"},{id:"pet-18",name:"Cozy Hood Bunny",group:"Inspired Mascots",feature:"hood",shape:"cozy-hood-bunny-shape"},{id:"pet-19",name:"Imp Hood",group:"Inspired Mascots",feature:"mask",shape:"imp-hood-shape"},{id:"pet-20",name:"Forest Neighbor",group:"Inspired Mascots",feature:"ears",shape:"forest-neighbor-shape"},{id:"pet-21",name:"Dust Puff",group:"Inspired Mascots",feature:"soot",shape:"dust-puff-shape"},{id:"pet-22",name:"Straw Voyager",group:"Inspired Mascots",feature:"straw",shape:"straw-voyager-shape"},{id:"pet-23",name:"Leaf Runner",group:"Inspired Mascots",feature:"ninja",shape:"leaf-runner-shape"},{id:"pet-24",name:"Energy Pearl",group:"Inspired Mascots",feature:"pearl",shape:"energy-pearl-shape"},{id:"pet-25",name:"Moon Wand",group:"Inspired Mascots",feature:"wand",shape:"moon-wand-shape"},{id:"pet-26",name:"Mecha Guard",group:"Inspired Mascots",feature:"mecha",shape:"mecha-guard-shape"},{id:"pet-27",name:"Teardrop Slime",group:"Inspired Mascots",feature:"slime",shape:"teardrop-slime-shape"},{id:"pet-28",name:"Ink Runner",group:"Inspired Mascots",feature:"ink",shape:"ink-runner-shape"},{id:"pet-29",name:"Little Beagle",group:"Inspired Mascots",feature:"ears",shape:"little-beagle-shape"},{id:"pet-30",name:"Tiny Antler",group:"Inspired Mascots",feature:"horns",shape:"tiny-antler-shape"}].map(a=>[a.id,a])),h=[{id:"pet-01",name:"Claude Pixel",group:"Codex",feature:"square",bodyTop:"#e0845f",body:"#d87352",bodyDark:"#cf684a",bodyLight:"#e88d68",bodySideLight:"#df7d5a",bodySideDark:"#c86347",accent:"#d7654a",accessory:"#f1bc62",eye:"#12100f",highlight:"#f6e7d7"},{id:"pet-02",name:"Blue Pocket Bot",group:"Gadget Buddy",feature:"bell",bodyTop:"#4aa8d8",body:"#2f8fc4",bodyDark:"#2674a4",bodyLight:"#68bce5",bodySideLight:"#48a8d5",bodySideDark:"#1f6591",accent:"#d84e4a",accessory:"#f4c94f",eye:"#10141a",highlight:"#f7fbff",facePatch:"#f6fbff",cheek:"#d84e4a"},{id:"pet-03",name:"Spark Arcade Pal",group:"Electric Mascot",feature:"bolt",bodyTop:"#f2d45a",body:"#e6bd37",bodyDark:"#c89a2a",bodyLight:"#ffe37a",bodySideLight:"#f0cc4c",bodySideDark:"#b58724",accent:"#2f2520",accessory:"#df5145",eye:"#17120e",highlight:"#fff7c7",cheek:"#e94d43"},{id:"pet-04",name:"Pink Star Puff",group:"Star Puff",feature:"star",bodyTop:"#eba0b7",body:"#df7fa0",bodyDark:"#c76589",bodyLight:"#f2b6c8",bodySideLight:"#e993ac",bodySideDark:"#b95778",accent:"#c84d64",accessory:"#f0d862",eye:"#171016",highlight:"#fff0f6",cheek:"#e75c7a"},{id:"pet-05",name:"Leaf Sprite",group:"Forest Starter",feature:"leaf",bodyTop:"#76aa7b",body:"#5f9666",bodyDark:"#4d7c54",bodyLight:"#91bd8f",bodySideLight:"#72a875",bodySideDark:"#426d49",accent:"#2f6f46",accessory:"#d6e78a",eye:"#11160f",highlight:"#f0f8e4",facePatch:"#dceec2"},{id:"pet-06",name:"Ember Starter",group:"Fire Buddy",feature:"flame",bodyTop:"#df8755",body:"#ce6b3f",bodyDark:"#af5333",bodyLight:"#ee9d6b",bodySideLight:"#dd7b4c",bodySideDark:"#9a482c",accent:"#8d3d2f",accessory:"#f3c34b",eye:"#17100c",highlight:"#ffe8d4",cheek:"#e45842"},{id:"pet-07",name:"Ripple Buddy",group:"Water Buddy",feature:"fins",bodyTop:"#82b5d6",body:"#629dcc",bodyDark:"#4f82ad",bodyLight:"#9bc8e5",bodySideLight:"#73add6",bodySideDark:"#44749b",accent:"#5f6f8d",accessory:"#ead59a",eye:"#10151b",highlight:"#eff8ff",facePatch:"#d9eef8"},{id:"pet-08",name:"Moon Alley Cat",group:"Moon Cat",feature:"moon",bodyTop:"#4f4b69",body:"#3f3a59",bodyDark:"#332f49",bodyLight:"#67607e",bodySideLight:"#554f6d",bodySideDark:"#2b283e",accent:"#e5c85c",accessory:"#d66f91",eye:"#f5e8a7",highlight:"#fff6c8",cheek:"#cf6d8f"},{id:"pet-09",name:"Spore Runner",group:"Mushroom Runner",feature:"mushroom",bodyTop:"#e0524f",body:"#f0dcc6",bodyDark:"#d7c0aa",bodyLight:"#f7ead9",bodySideLight:"#f1dfcb",bodySideDark:"#c7aa95",accent:"#b83736",accessory:"#ffffff",eye:"#17120f",highlight:"#fff8ea"},{id:"pet-10",name:"Dash Quill",group:"Speed Mascot",feature:"spin",bodyTop:"#4e83d0",body:"#356dbd",bodyDark:"#2a579b",bodyLight:"#6896de",bodySideLight:"#477dd0",bodySideDark:"#244c88",accent:"#f2c45b",accessory:"#f2ece1",eye:"#10131a",highlight:"#eef4ff",facePatch:"#ead3b9"},{id:"pet-11",name:"Lemon Chomper",group:"Arcade Chomper",feature:"chomp",bodyTop:"#f0ce45",body:"#e5ba2f",bodyDark:"#c89924",bodyLight:"#ffe26c",bodySideLight:"#efc73f",bodySideDark:"#b18520",accent:"#1f1b18",accessory:"#f2845f",eye:"#15110d",highlight:"#fff2b6"},{id:"pet-12",name:"Lantern Ghost",group:"Round Ghost",feature:"ghost",bodyTop:"#d9dff0",body:"#c4cee6",bodyDark:"#aab6d2",bodyLight:"#edf2ff",bodySideLight:"#d3dced",bodySideDark:"#9aa8c6",accent:"#6d7da8",accessory:"#e77c9c",eye:"#151926",highlight:"#ffffff"},{id:"pet-13",name:"Red Cap Jumper",group:"Platform Pal",feature:"cap",bodyTop:"#d84f45",body:"#c5a17d",bodyDark:"#a98263",bodyLight:"#e0ba94",bodySideLight:"#d3ad86",bodySideDark:"#936f54",accent:"#2c4f99",accessory:"#f6e9d1",eye:"#16110d",highlight:"#fff2df"},{id:"pet-14",name:"Honey Cub",group:"Classic Toy",feature:"ears",bodyTop:"#e4b25a",body:"#d0993e",bodyDark:"#ad7d30",bodyLight:"#efc46d",bodySideLight:"#dba84d",bodySideDark:"#996d2a",accent:"#b54d3f",accessory:"#f4d991",eye:"#17110d",highlight:"#fff0c8",facePatch:"#f2d083"},{id:"pet-15",name:"Ribbon Puff",group:"Bow Buddy",feature:"bow",bodyTop:"#f2f0e8",body:"#e3ded4",bodyDark:"#c9c2b7",bodyLight:"#ffffff",bodySideLight:"#eee9df",bodySideDark:"#bab2a7",accent:"#d84b5b",accessory:"#f3cc56",eye:"#15110f",highlight:"#ffffff",cheek:"#df6d80"},{id:"pet-16",name:"Cozy Hood Cub",group:"Hooded Mascot",feature:"hood",bodyTop:"#ef9eba",body:"#e681a4",bodyDark:"#c96789",bodyLight:"#f5b6ca",bodySideLight:"#ee94b2",bodySideDark:"#b85878",accent:"#f0d6de",accessory:"#f3d66b",eye:"#171017",highlight:"#fff0f6",facePatch:"#fff6f2"},{id:"pet-17",name:"Masked Beetle",group:"Bug Hero",feature:"mask",bodyTop:"#6e617d",body:"#554761",bodyDark:"#41374b",bodyLight:"#837491",bodySideLight:"#655570",bodySideDark:"#382f41",accent:"#cf6f8e",accessory:"#f0d46a",eye:"#f7edf4",highlight:"#fff7ff",facePatch:"#ece0ea"},{id:"pet-18",name:"Round Forest Pal",group:"Forest Neighbor",feature:"ears",bodyTop:"#8c8d7d",body:"#74766a",bodyDark:"#606257",bodyLight:"#a0a293",bodySideLight:"#838578",bodySideDark:"#55574d",accent:"#d9d3b8",accessory:"#c6d68c",eye:"#121411",highlight:"#efead8",facePatch:"#dad4ba"},{id:"pet-19",name:"Dust Puff",group:"Tiny Soot",feature:"soot",bodyTop:"#34343a",body:"#25262c",bodyDark:"#1d1e24",bodyLight:"#4a4b52",bodySideLight:"#383941",bodySideDark:"#171820",accent:"#6c6f7a",accessory:"#f0f0d8",eye:"#f7f7e8",highlight:"#ffffff"},{id:"pet-20",name:"Straw Field Pal",group:"Harvest Buddy",feature:"straw",bodyTop:"#d96a50",body:"#c65342",bodyDark:"#a74336",bodyLight:"#e47d64",bodySideLight:"#d0614d",bodySideDark:"#933a30",accent:"#2f5f93",accessory:"#e8c866",eye:"#15100d",highlight:"#ffe6d9"},{id:"pet-21",name:"Shadow Ninja Bean",group:"Ninja Mascot",feature:"ninja",bodyTop:"#e7a04d",body:"#d88432",bodyDark:"#b96c27",bodyLight:"#efb464",bodySideLight:"#df943e",bodySideDark:"#a25d22",accent:"#2d415c",accessory:"#ded5c6",eye:"#15100c",highlight:"#ffe7c8",facePatch:"#f3c78d"},{id:"pet-22",name:"Pearl Quest Cub",group:"Pearl Hero",feature:"pearl",bodyTop:"#e3a54e",body:"#ce8438",bodyDark:"#ac682e",bodyLight:"#efbc68",bodySideLight:"#db9345",bodySideDark:"#985a28",accent:"#476ca6",accessory:"#f0d464",eye:"#15100c",highlight:"#ffe8c4"},{id:"pet-23",name:"Wand Starling",group:"Magic Mascot",feature:"wand",bodyTop:"#f0a6c4",body:"#df87ad",bodyDark:"#c26b92",bodyLight:"#f5bad2",bodySideLight:"#e99ab9",bodySideDark:"#ad5d82",accent:"#d8b34a",accessory:"#e9d7ff",eye:"#171017",highlight:"#fff0f7",cheek:"#e76791"},{id:"pet-24",name:"Mecha Bean",group:"Tiny Mecha",feature:"mecha",bodyTop:"#d7dbe2",body:"#bdc3ce",bodyDark:"#9ea6b3",bodyLight:"#edf0f5",bodySideLight:"#cbd1da",bodySideDark:"#8d96a5",accent:"#d44d4a",accessory:"#f0c748",eye:"#151923",highlight:"#ffffff"},{id:"pet-25",name:"Bubble Slimelet",group:"Slime Buddy",feature:"slime",bodyTop:"#79b8e8",body:"#5aa0d8",bodyDark:"#4384ba",bodyLight:"#96cdf0",bodySideLight:"#70b3e3",bodySideDark:"#3975a6",accent:"#2a658f",accessory:"#f3f7ff",eye:"#101722",highlight:"#f5fbff"},{id:"pet-26",name:"Ink Courier",group:"Ink Runner",feature:"ink",bodyTop:"#75c8bb",body:"#54afa2",bodyDark:"#3f9188",bodyLight:"#90d9ce",bodySideLight:"#67c1b5",bodySideDark:"#377f77",accent:"#d7668f",accessory:"#e4f2ef",eye:"#101716",highlight:"#effffb"},{id:"pet-27",name:"Drum Marcher",group:"Rhythm Pal",feature:"drum",bodyTop:"#ef7f5f",body:"#df6349",bodyDark:"#bd4d3b",bodyLight:"#f39a7b",bodySideLight:"#e77358",bodySideDark:"#a84434",accent:"#4f78b6",accessory:"#f3e4c6",eye:"#15100d",highlight:"#fff0e4"},{id:"pet-28",name:"Sprout Forestling",group:"Sprout Buddy",feature:"sprout",bodyTop:"#a58f5d",body:"#8f7548",bodyDark:"#755f3a",bodyLight:"#b9a26e",bodySideLight:"#9b8354",bodySideDark:"#655233",accent:"#5d8b56",accessory:"#dfc86e",eye:"#15110c",highlight:"#f8ecc0",facePatch:"#d8be71"},{id:"pet-29",name:"Frost Star Pup",group:"Ice Pal",feature:"star",bodyTop:"#8aa7d8",body:"#6e91c8",bodyDark:"#5877aa",bodyLight:"#a1bce5",bodySideLight:"#7f9fd3",bodySideDark:"#4e6898",accent:"#f0cf5b",accessory:"#f3edf5",eye:"#10151c",highlight:"#eff5ff",cheek:"#d66d86"},{id:"pet-30",name:"Tiny Quest Cub",group:"Quest Mascot",feature:"bow",bodyTop:"#efa2c8",body:"#df84b2",bodyDark:"#c46999",bodyLight:"#f5b9d5",bodySideLight:"#eb96c2",bodySideDark:"#ad5a86",accent:"#cf4d78",accessory:"#f0d66a",eye:"#171016",highlight:"#fff0f8",cheek:"#df688f"}].map(a=>({...a,...g.get(a.id)}));function i(a){return h.find(b=>b.id===a)??h[0]}function j(){if("u"<typeof localStorage)return h[0].id;try{return i(localStorage.getItem(e)).id}catch{return h[0].id}}var k=a.i(535510);let l=(0,c.lazy)(()=>a.A(76574).then(a=>({default:a.MonsterDirectPixelCharacter})));function m({activityId:a,preset:c,reacting:d,shaken:e,fainted:f=!1,eyeOffset:g={x:0,y:0}}){let h=(0,k.getCloudCodeMonsterExpression)(a,d,e,f);return"fainted"===h?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("rect",{x:"43",y:"39",width:"5",height:"5",fill:c.eye}),(0,b.jsx)("rect",{x:"49",y:"45",width:"5",height:"5",fill:c.eye}),(0,b.jsx)("rect",{x:"43",y:"51",width:"5",height:"5",fill:c.eye}),(0,b.jsx)("rect",{x:"49",y:"39",width:"5",height:"5",fill:c.eye}),(0,b.jsx)("rect",{x:"43",y:"45",width:"5",height:"5",fill:c.eye}),(0,b.jsx)("rect",{x:"76",y:"39",width:"5",height:"5",fill:c.eye}),(0,b.jsx)("rect",{x:"82",y:"45",width:"5",height:"5",fill:c.eye}),(0,b.jsx)("rect",{x:"76",y:"51",width:"5",height:"5",fill:c.eye}),(0,b.jsx)("rect",{x:"82",y:"39",width:"5",height:"5",fill:c.eye}),(0,b.jsx)("rect",{x:"76",y:"45",width:"5",height:"5",fill:c.eye}),(0,b.jsx)("rect",{x:"58",y:"64",width:"14",height:"4",fill:c.eye})]}):"shaken"===h?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("rect",{x:"45",y:"40",width:"5",height:"5",fill:c.eye}),(0,b.jsx)("rect",{x:"50",y:"45",width:"5",height:"5",fill:c.eye}),(0,b.jsx)("rect",{x:"45",y:"50",width:"5",height:"5",fill:c.eye}),(0,b.jsx)("rect",{x:"82",y:"40",width:"5",height:"5",fill:c.eye}),(0,b.jsx)("rect",{x:"77",y:"45",width:"5",height:"5",fill:c.eye}),(0,b.jsx)("rect",{x:"82",y:"50",width:"5",height:"5",fill:c.eye}),(0,b.jsx)("rect",{x:"62",y:"61",width:"6",height:"4",fill:c.eye})]}):"shocked"===h?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("g",{className:"cloud-code-monster-pet-eyes-track",transform:`translate(${g.x} ${g.y})`,children:[(0,b.jsx)("rect",{className:"cloud-code-monster-pet-eye-blink",x:"44",y:"39",width:"12",height:"13",fill:c.eye}),(0,b.jsx)("rect",{className:"cloud-code-monster-pet-eye-blink",x:"76",y:"39",width:"12",height:"13",fill:c.eye}),(0,b.jsxs)("g",{transform:`translate(${.45*g.x} ${.45*g.y})`,children:[(0,b.jsx)("rect",{x:"47",y:"42",width:"4",height:"4",fill:c.highlight}),(0,b.jsx)("rect",{x:"79",y:"42",width:"4",height:"4",fill:c.highlight})]})]}),(0,b.jsx)("rect",{x:"60",y:"60",width:"10",height:"12",fill:c.eye}),(0,b.jsx)("rect",{x:"62",y:"62",width:"6",height:"3",fill:"#332520"})]}):"sleeping"===h?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("rect",{x:"45",y:"46",width:"11",height:"4",fill:c.eye}),(0,b.jsx)("rect",{x:"76",y:"46",width:"11",height:"4",fill:c.eye})]}):(0,b.jsxs)("g",{className:"cloud-code-monster-pet-eyes-track",transform:`translate(${g.x} ${g.y})`,children:[(0,b.jsx)("rect",{className:"cloud-code-monster-pet-eye-blink",x:"44",y:"42",width:"11",height:"12",fill:c.eye}),(0,b.jsx)("rect",{className:"cloud-code-monster-pet-eye-blink",x:"77",y:"42",width:"11",height:"12",fill:c.eye}),(0,b.jsxs)("g",{transform:`translate(${.55*g.x} ${.55*g.y})`,children:[(0,b.jsx)("rect",{x:"46",y:"44",width:"4",height:"4",fill:"#2c2521"}),(0,b.jsx)("rect",{x:"79",y:"44",width:"4",height:"4",fill:"#2c2521"})]})]})}function n({preset:a}){let{feature:c}=a;return"horns"===c?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("rect",{x:"29",y:"20",width:"10",height:"8",fill:a.accent}),(0,b.jsx)("rect",{x:"91",y:"20",width:"10",height:"8",fill:a.accent}),(0,b.jsx)("rect",{x:"34",y:"16",width:"7",height:"7",fill:a.accessory}),(0,b.jsx)("rect",{x:"88",y:"16",width:"7",height:"7",fill:a.accessory})]}):"ears"===c?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("rect",{x:"18",y:"38",width:"10",height:"18",fill:a.bodyDark}),(0,b.jsx)("rect",{x:"100",y:"38",width:"10",height:"18",fill:a.bodyDark}),(0,b.jsx)("rect",{x:"21",y:"42",width:"5",height:"8",fill:a.bodyLight}),(0,b.jsx)("rect",{x:"102",y:"42",width:"5",height:"8",fill:a.bodyLight})]}):"visor"===c?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("rect",{x:"41",y:"36",width:"47",height:"5",fill:a.accent}),(0,b.jsx)("rect",{x:"45",y:"38",width:"39",height:"3",fill:a.highlight})]}):"antenna"===c?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("rect",{x:"62",y:"15",width:"5",height:"13",fill:a.accent}),(0,b.jsx)("rect",{x:"58",y:"10",width:"13",height:"6",fill:a.accessory})]}):"crown"===c?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("rect",{x:"43",y:"18",width:"8",height:"10",fill:a.accessory}),(0,b.jsx)("rect",{x:"60",y:"14",width:"8",height:"14",fill:a.accessory}),(0,b.jsx)("rect",{x:"77",y:"18",width:"8",height:"10",fill:a.accessory}),(0,b.jsx)("rect",{x:"42",y:"26",width:"44",height:"5",fill:a.accent})]}):"bell"===c?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("rect",{x:"22",y:"42",width:"8",height:"14",fill:a.bodyDark}),(0,b.jsx)("rect",{x:"98",y:"42",width:"8",height:"14",fill:a.bodyDark}),(0,b.jsx)("rect",{x:"59",y:"21",width:"11",height:"7",fill:a.accent})]}):"bolt"===c?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("rect",{x:"29",y:"20",width:"8",height:"17",fill:a.accent}),(0,b.jsx)("rect",{x:"91",y:"20",width:"8",height:"17",fill:a.accent}),(0,b.jsx)("rect",{x:"33",y:"32",width:"8",height:"9",fill:a.bodyTop}),(0,b.jsx)("rect",{x:"87",y:"32",width:"8",height:"9",fill:a.bodyTop})]}):"star"===c?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("rect",{x:"60",y:"13",width:"8",height:"24",fill:a.accessory}),(0,b.jsx)("rect",{x:"52",y:"21",width:"24",height:"8",fill:a.accessory}),(0,b.jsx)("rect",{x:"56",y:"17",width:"16",height:"16",fill:a.accessory})]}):"leaf"===c||"sprout"===c?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("rect",{x:"61",y:"15",width:"6",height:"18",fill:a.accent}),(0,b.jsx)("rect",{x:"49",y:"18",width:"16",height:"10",fill:a.accent}),(0,b.jsx)("rect",{x:"66",y:"18",width:"16",height:"10",fill:a.bodyLight})]}):"flame"===c?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("rect",{x:"58",y:"9",width:"12",height:"20",fill:a.accessory}),(0,b.jsx)("rect",{x:"52",y:"18",width:"9",height:"14",fill:a.accent}),(0,b.jsx)("rect",{x:"69",y:"17",width:"8",height:"15",fill:a.bodyLight})]}):"fins"===c?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("rect",{x:"18",y:"45",width:"10",height:"18",fill:a.accent}),(0,b.jsx)("rect",{x:"100",y:"45",width:"10",height:"18",fill:a.accent}),(0,b.jsx)("rect",{x:"55",y:"18",width:"18",height:"10",fill:a.accessory})]}):"moon"===c?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("rect",{x:"57",y:"14",width:"18",height:"18",fill:a.accessory}),(0,b.jsx)("rect",{x:"64",y:"12",width:"15",height:"19",fill:a.bodyTop}),(0,b.jsx)("rect",{x:"24",y:"37",width:"7",height:"18",fill:a.bodyDark}),(0,b.jsx)("rect",{x:"97",y:"37",width:"7",height:"18",fill:a.bodyDark})]}):"mushroom"===c?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("rect",{x:"31",y:"18",width:"66",height:"22",fill:a.bodyTop}),(0,b.jsx)("rect",{x:"42",y:"13",width:"44",height:"11",fill:a.bodyTop}),(0,b.jsx)("rect",{x:"45",y:"22",width:"9",height:"8",fill:a.accessory}),(0,b.jsx)("rect",{x:"73",y:"20",width:"10",height:"8",fill:a.accessory})]}):"spin"===c?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("rect",{x:"47",y:"17",width:"34",height:"9",fill:a.bodyLight}),(0,b.jsx)("rect",{x:"37",y:"24",width:"14",height:"8",fill:a.bodyLight}),(0,b.jsx)("rect",{x:"78",y:"24",width:"13",height:"8",fill:a.bodyLight}),(0,b.jsx)("rect",{x:"29",y:"31",width:"11",height:"7",fill:a.bodyLight})]}):"chomp"===c?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("rect",{x:"88",y:"48",width:"14",height:"8",fill:a.highlight}),(0,b.jsx)("rect",{x:"88",y:"60",width:"14",height:"8",fill:a.highlight})]}):"ghost"===c||"slime"===c?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("rect",{x:"44",y:"19",width:"40",height:"12",fill:a.bodyLight}),(0,b.jsx)("rect",{x:"36",y:"27",width:"56",height:"10",fill:a.bodyLight})]}):"cap"===c||"straw"===c?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("rect",{x:"34",y:"18",width:"58",height:"12",fill:"straw"===c?a.accessory:a.bodyTop}),(0,b.jsx)("rect",{x:"45",y:"12",width:"36",height:"10",fill:"straw"===c?a.accessory:a.bodyTop}),(0,b.jsx)("rect",{x:"58",y:"22",width:"14",height:"5",fill:"straw"===c?a.accent:a.accessory})]}):"bow"===c||"hood"===c?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("rect",{x:"76",y:"17",width:"13",height:"13",fill:a.accent}),(0,b.jsx)("rect",{x:"91",y:"17",width:"13",height:"13",fill:a.accent}),(0,b.jsx)("rect",{x:"88",y:"21",width:"7",height:"7",fill:a.accessory})]}):"mask"===c||"ninja"===c?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("rect",{x:"35",y:"25",width:"58",height:"8",fill:a.accent}),(0,b.jsx)("rect",{x:"48",y:"18",width:"12",height:"10",fill:a.accent}),(0,b.jsx)("rect",{x:"69",y:"18",width:"12",height:"10",fill:a.accent})]}):"soot"===c?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("rect",{x:"27",y:"25",width:"8",height:"8",fill:a.bodyLight}),(0,b.jsx)("rect",{x:"92",y:"23",width:"9",height:"9",fill:a.bodyLight}),(0,b.jsx)("rect",{x:"61",y:"12",width:"7",height:"7",fill:a.bodyLight})]}):"pearl"===c||"wand"===c?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("rect",{x:"58",y:"12",width:"13",height:"13",fill:a.accessory}),(0,b.jsx)("rect",{x:"61",y:"7",width:"7",height:"7",fill:a.accent}),(0,b.jsx)("rect",{x:"73",y:"17",width:"9",height:"9",fill:a.accent})]}):"mecha"===c?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("rect",{x:"29",y:"24",width:"12",height:"13",fill:a.accent}),(0,b.jsx)("rect",{x:"87",y:"24",width:"12",height:"13",fill:a.accent}),(0,b.jsx)("rect",{x:"51",y:"18",width:"27",height:"9",fill:a.accessory})]}):"ink"===c?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("rect",{x:"35",y:"19",width:"12",height:"16",fill:a.accent}),(0,b.jsx)("rect",{x:"56",y:"14",width:"14",height:"20",fill:a.accent}),(0,b.jsx)("rect",{x:"80",y:"19",width:"12",height:"16",fill:a.accent})]}):"drum"===c?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("rect",{x:"31",y:"27",width:"66",height:"7",fill:a.accent}),(0,b.jsx)("rect",{x:"41",y:"18",width:"46",height:"10",fill:a.accessory})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("rect",{x:"38",y:"30",width:"10",height:"4",fill:a.bodyLight}),(0,b.jsx)("rect",{x:"80",y:"30",width:"10",height:"4",fill:a.bodyDark})]})}function o({preset:a}){let c=a.feature;return(0,b.jsxs)(b.Fragment,{children:[a.facePatch?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("rect",{x:"40",y:"39",width:"48",height:"34",fill:a.facePatch}),(0,b.jsx)("rect",{x:"46",y:"73",width:"36",height:"10",fill:a.facePatch})]}):null,"bell"===c?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("rect",{x:"50",y:"74",width:"28",height:"6",fill:a.accent}),(0,b.jsx)("rect",{x:"58",y:"80",width:"13",height:"11",fill:a.accessory}),(0,b.jsx)("rect",{x:"61",y:"84",width:"7",height:"3",fill:a.eye})]}):null,"bolt"===c?(0,b.jsx)("rect",{x:"89",y:"76",width:"13",height:"8",fill:a.accent}):null,"chomp"===c?(0,b.jsx)("rect",{x:"72",y:"56",width:"22",height:"16",fill:a.highlight}):null,"ghost"===c?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("rect",{x:"28",y:"91",width:"12",height:"8",fill:a.bodyLight}),(0,b.jsx)("rect",{x:"52",y:"91",width:"12",height:"8",fill:a.bodyLight}),(0,b.jsx)("rect",{x:"76",y:"91",width:"12",height:"8",fill:a.bodyLight})]}):null,"drum"===c?(0,b.jsx)("rect",{x:"31",y:"55",width:"66",height:"8",fill:a.accessory}):null,"mecha"===c?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("rect",{x:"41",y:"35",width:"45",height:"6",fill:a.accent}),(0,b.jsx)("rect",{x:"57",y:"58",width:"14",height:"9",fill:a.accessory})]}):null,a.cheek?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("rect",{x:"36",y:"58",width:"8",height:"7",fill:a.cheek}),(0,b.jsx)("rect",{x:"86",y:"58",width:"8",height:"7",fill:a.cheek})]}):null]})}function p({preset:a,activityId:d,animated:e=!1,reacting:f=!1,shaken:g=!1,fainted:h=!1,eyeOffset:i}){return"monster"!==(a.shape??"monster")?(0,b.jsx)("g",{className:e?"cloud-code-monster-pet-character":void 0,children:(0,b.jsx)(c.Suspense,{fallback:null,children:(0,b.jsx)(l,{activityId:d,preset:a,reacting:f,shaken:g,fainted:h,eyeOffset:i})})}):(0,b.jsxs)("g",{className:e?"cloud-code-monster-pet-character":void 0,children:[(0,b.jsx)(n,{preset:a}),(0,b.jsx)("rect",{x:"32",y:"22",width:"64",height:"12",fill:a.bodyTop}),(0,b.jsx)("rect",{x:"24",y:"34",width:"80",height:"17",fill:a.bodyTop}),(0,b.jsx)("rect",{x:"16",y:"51",width:"12",height:"24",fill:a.body}),(0,b.jsx)("rect",{x:"24",y:"51",width:"80",height:"41",fill:a.body}),(0,b.jsx)("rect",{x:"100",y:"51",width:"12",height:"24",fill:a.body}),(0,b.jsx)("rect",{x:"16",y:"63",width:"12",height:"12",fill:a.bodyDark}),(0,b.jsx)("rect",{x:"30",y:"86",width:"68",height:"10",fill:a.bodyDark}),(0,b.jsx)("rect",{x:"34",y:"34",width:"60",height:"6",fill:a.bodyLight}),(0,b.jsx)("rect",{x:"24",y:"51",width:"9",height:"35",fill:a.bodySideLight}),(0,b.jsx)("rect",{x:"95",y:"51",width:"9",height:"35",fill:a.bodySideDark}),(0,b.jsx)(o,{preset:a}),(0,b.jsx)(m,{activityId:d,preset:a,reacting:f,shaken:g,fainted:h,eyeOffset:i}),(0,b.jsx)("rect",{x:"36",y:"69",width:"8",height:"8",fill:a.bodyLight}),(0,b.jsx)("rect",{x:"84",y:"69",width:"8",height:"8",fill:a.bodySideDark}),(0,b.jsx)("rect",{className:"cloud-code-monster-pet-left-foot",x:"29",y:"96",width:"12",height:"22",fill:a.body}),(0,b.jsx)("rect",{className:"cloud-code-monster-pet-left-foot",x:"52",y:"96",width:"12",height:"22",fill:a.body}),(0,b.jsx)("rect",{className:"cloud-code-monster-pet-right-foot",x:"76",y:"96",width:"12",height:"22",fill:a.bodyDark}),(0,b.jsx)("rect",{className:"cloud-code-monster-pet-right-foot",x:"96",y:"96",width:"12",height:"22",fill:a.bodyDark})]})}function q({preset:a,className:c}){return(0,b.jsxs)("svg",{className:c,viewBox:"0 0 128 128",role:"img","aria-label":`${a.name} pixel PET preset`,shapeRendering:"crispEdges",children:[(0,b.jsx)("rect",{x:"31",y:"116",width:"66",height:"5",fill:"rgba(45,40,36,.12)"}),(0,b.jsx)("rect",{x:"40",y:"121",width:"48",height:"3",fill:"rgba(45,40,36,.07)"}),(0,b.jsx)(p,{preset:a,activityId:null})]})}var r=a.i(76592),s=a.i(973111),t=a.i(272818),u=a.i(75118);a.s(["PetTab",0,function(){let[a,g]=(0,c.useState)(!1),[k,l]=(0,c.useState)(h[0].id),m=i(k);return(0,c.useEffect)(()=>{g((0,t.readHomePetSettings)().enabled),l(j());let a=a=>{let b=a.detail?.presetId;l(b?i(b).id:j())};return window.addEventListener(f,a),()=>{window.removeEventListener(f,a)}},[]),(0,b.jsxs)("div",{className:"space-y-8",children:[(0,b.jsxs)("section",{className:"space-y-4",children:[(0,b.jsx)("h2",{className:"text-sm font-medium",children:"Pet"}),(0,b.jsx)("div",{className:"space-y-4",children:(0,b.jsxs)("div",{className:"flex items-center justify-between gap-4",children:[(0,b.jsxs)("div",{className:"space-y-1",children:[(0,b.jsx)(r.Label,{htmlFor:"pet-enabled",className:"text-sm",children:"Enable pet"}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:"Off by default. Turn it on when you want the workspace companion."})]}),(0,b.jsx)(s.Switch,{id:"pet-enabled",checked:a,onCheckedChange:a=>{g(a),(0,t.writeHomePetSettings)({enabled:a})}})]})})]}),a?(0,b.jsxs)("section",{className:"space-y-4",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("h2",{className:"text-sm font-medium",children:"Preset"}),(0,b.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:m.name})]}),(0,b.jsx)("div",{className:"grid size-14 place-items-center rounded-md bg-card ring-1 ring-border/60",children:(0,b.jsx)(q,{preset:m,className:"size-11"})})]}),(0,b.jsx)("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-3",children:h.map(a=>{let c=a.id===m.id;return(0,b.jsxs)("button",{type:"button","aria-pressed":c,onClick:()=>{l(function(a){let b=i(a);if("u">typeof localStorage)try{localStorage.setItem(e,b.id)}catch{}return b.id}(a.id))},className:(0,u.cn)("group grid h-28 min-w-0 grid-rows-[1fr_auto] rounded-md border bg-card/60 p-2 text-left transition-all hover:border-foreground/20 hover:bg-accent/55 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/70",c?"border-primary/50 bg-accent text-foreground":"border-border/50 text-muted-foreground"),children:[(0,b.jsx)("div",{className:"grid place-items-center rounded bg-background/70 ring-1 ring-border/35",children:(0,b.jsx)(q,{preset:a,className:"size-14 transition-transform duration-200 group-hover:scale-105"})}),(0,b.jsxs)("div",{className:"mt-2 flex min-w-0 items-center justify-between gap-1 text-[10px] leading-none",children:[(0,b.jsx)("span",{className:"truncate font-medium text-foreground",children:a.name}),c?(0,b.jsx)(d,{className:"size-3 shrink-0 text-primary"}):(0,b.jsx)("span",{className:"shrink-0 text-muted-foreground",children:a.id.replace("pet-","#")})]})]},a.id)})})]}):null]})}],390946)},617168,a=>{"use strict";var b=a.i(229073),c=a.i(226058),d=a.i(752792),e=a.i(506180),f=a.i(25668);a.i(4338);var g=a.i(514746),h=a.i(439882),i=a.i(464830),j=a.i(967543),k=a.i(933338),l=a.i(101979),m=a.i(147479),n=a.i(661585);let o=(0,a.i(815624).default)("zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);function p({icon:a,label:c,value:d,sub:e}){return(0,b.jsx)(h.Card,{size:"sm",children:(0,b.jsxs)(h.CardContent,{className:"flex items-center gap-3",children:[(0,b.jsx)("div",{className:"flex size-9 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary",children:(0,b.jsx)(a,{className:"size-4"})}),(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between gap-1",children:[(0,b.jsx)("p",{className:"text-2xl font-semibold leading-none tracking-tight",children:d}),e&&(0,b.jsx)(i.Badge,{variant:"secondary",className:"text-[10px] px-2 h-4 font-normal",children:e})]}),(0,b.jsx)("p",{className:"mt-1 text-xs text-muted-foreground truncate",children:c})]})]})})}function q({agents:a,runtimes:c,activeTaskCounts:d,overview:e}){let f=new Map;for(let a of c){let b=a.daemon_id??a.id;f.set(b,f.get(b)||"online"===a.status)}let g=f.size,h=[...f.values()].filter(Boolean).length,i=Object.values(d).reduce((a,b)=>a+b,0),r=a.filter(a=>{let b=c.find(b=>b.id===a.runtime_id);return b?.status==="online"}).length;return(0,b.jsxs)("div",{className:"grid gap-3 grid-cols-2 sm:grid-cols-6",children:[(0,b.jsx)(p,{icon:n.Monitor,label:"Machines",value:`${h}/${g}`,sub:"online"}),(0,b.jsx)(p,{icon:j.Bot,label:"Agents",value:a.length,sub:`${r} online`}),(0,b.jsx)(p,{icon:m.Users,label:"Members",value:e.members.length,sub:e.pending_invites>0?`${e.pending_invites} pending`:void 0}),(0,b.jsx)(p,{icon:o,label:"Active Tasks",value:i,sub:e.task_stats.queued>0?`${e.task_stats.queued} queued`:void 0}),(0,b.jsx)(p,{icon:l.Send,label:"Emails Sent",value:e.email_stats.outbound,sub:`${e.email_stats.unread} unread`}),(0,b.jsx)(p,{icon:k.Mail,label:"Custom Emails",value:e.email_accounts.length})]})}function r({overview:a}){let{completed:c,failed:d,cancelled:e,queued:f,stale:g}=a.task_stats,i=c+d,j=i>0?(d/i*100).toFixed(1):"0";return(0,b.jsxs)(h.Card,{children:[(0,b.jsx)(h.CardHeader,{children:(0,b.jsx)(h.CardTitle,{children:"Task Health (Today)"})}),(0,b.jsx)(h.CardContent,{children:(0,b.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,b.jsx)(s,{label:"Completed",value:c}),(0,b.jsx)(s,{label:"Failed",value:d,className:d>0?"text-destructive":void 0}),(0,b.jsx)(s,{label:"Cancelled",value:e}),(0,b.jsx)(s,{label:"Failure Rate",value:`${j}%`,className:Number(j)>10?"text-destructive":void 0}),(0,b.jsx)(s,{label:"Queue Backlog",value:f,className:f>10?"text-amber-500":void 0}),(0,b.jsx)(s,{label:"Stale Tasks",value:g,className:g>0?"text-destructive":void 0})]})})]})}function s({label:a,value:c,className:d}){return(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:`text-xl font-semibold ${d??""}`,children:c}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:a})]})}var t=a.i(525132);function u({overview:a,agents:c}){let{inbound:d,outbound:e,unread:f,rejected:g}=a.email_stats,i=new Map(c.map(a=>[a.id,a.name]));return(0,b.jsxs)(h.Card,{children:[(0,b.jsx)(h.CardHeader,{children:(0,b.jsx)(h.CardTitle,{children:"Email Summary"})}),(0,b.jsxs)(h.CardContent,{className:"space-y-4",children:[(0,b.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"text-xl font-semibold",children:d}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:"Received"})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"text-xl font-semibold",children:e}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:"Sent"})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:`text-xl font-semibold ${f>0?"text-primary":""}`,children:f}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:"Unread"})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:`text-xl font-semibold ${g>0?"text-amber-500":""}`,children:g}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:"Untrust"})]})]}),a.email_accounts.length>0&&(0,b.jsxs)("div",{className:"space-y-2 pt-2 border-t border-border/50",children:[(0,b.jsx)("p",{className:"text-xs font-medium text-muted-foreground",children:"Custom Mailboxes"}),a.email_accounts.map(a=>(0,b.jsxs)("div",{className:"flex items-center justify-between gap-2 text-xs",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,b.jsxs)(t.Tooltip,{children:[(0,b.jsx)(t.TooltipTrigger,{render:(0,b.jsx)("span",{className:`size-1.5 shrink-0 rounded-full ${"active"===a.status?"bg-emerald-500":"bg-destructive"}`})}),(0,b.jsx)(t.TooltipContent,{side:"top",children:"active"===a.status?"Active":`Error: ${a.error_message||"inactive"}`})]}),(0,b.jsx)("span",{className:"truncate",children:a.email_address})]}),(0,b.jsx)("span",{className:"text-muted-foreground shrink-0",children:i.get(a.agent_id)??"—"})]},a.id))]})]})]})}var v=a.i(670209),w=a.i(445067);function x({runtimes:a,agents:c}){let d=(0,v.useRouter)(),{slug:f}=(0,e.useWorkspace)(),g=new Map;for(let b of a){let a=b.daemon_id??b.id;g.has(a)||g.set(a,{runtimes:[],deviceInfo:b.device_info??""}),g.get(a).runtimes.push(b)}let j=[...g.entries()];return 0===j.length?(0,b.jsxs)(h.Card,{children:[(0,b.jsxs)(h.CardHeader,{children:[(0,b.jsx)(h.CardTitle,{children:"Machines"}),(0,b.jsx)(h.CardAction,{children:(0,b.jsx)("button",{type:"button",onClick:()=>d.push(`/w/${f}/runtimes`),className:"text-muted-foreground hover:text-foreground transition-colors cursor-pointer",children:(0,b.jsx)(w.ArrowUpRight,{className:"size-4"})})})]}),(0,b.jsx)(h.CardContent,{children:(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:"No machines connected."})})]}):(0,b.jsxs)(h.Card,{children:[(0,b.jsx)(h.CardHeader,{children:(0,b.jsx)(h.CardTitle,{children:"Machines"})}),(0,b.jsx)(h.CardContent,{className:"space-y-3",children:j.map(([a,d])=>{let e=d.runtimes.some(a=>"online"===a.status),f=d.runtimes.map(a=>a.last_seen_at).filter(Boolean).sort().reverse()[0],g=c.filter(a=>d.runtimes.some(b=>b.id===a.runtime_id)),h=d.runtimes.some(a=>a.pending_update_version),j=d.runtimes.find(a=>a.pending_update_version)?.pending_update_version;return(0,b.jsxs)("div",{className:"flex items-start gap-3 text-xs",children:[(0,b.jsxs)(t.Tooltip,{children:[(0,b.jsx)(t.TooltipTrigger,{render:(0,b.jsx)("span",{className:`mt-1 size-2 shrink-0 rounded-full ${e?"bg-emerald-500":"bg-muted-foreground/30"}`})}),(0,b.jsx)(t.TooltipContent,{side:"top",children:e?"Online":"Offline"})]}),(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)("span",{className:"font-medium truncate",children:d.deviceInfo||a.slice(0,12)}),h&&(0,b.jsxs)(t.Tooltip,{children:[(0,b.jsx)(t.TooltipTrigger,{render:(0,b.jsx)("span",{children:(0,b.jsx)(i.Badge,{variant:"outline",className:"text-[10px] px-2 py-0 text-amber-500 border-amber-500/30",children:"update"})})}),(0,b.jsxs)(t.TooltipContent,{side:"top",children:["Pending update to v",j]})]})]}),(0,b.jsxs)("div",{className:"text-muted-foreground mt-1",children:[g.length>0?g.map(a=>a.name).join(", "):"No agents"," · ",function(a){if(!a)return"never";let b=Math.floor((Date.now()-new Date(a).getTime())/1e3);if(b<60)return`${b}s ago`;let c=Math.floor(b/60);if(c<60)return`${c}m ago`;let d=Math.floor(c/60);return d<24?`${d}h ago`:`${Math.floor(d/24)}d ago`}(f??null)]})]})]},a)})})]})}var y=a.i(377447),z=a.i(66957);function A({overview:a}){let c=(0,v.useRouter)(),{slug:d}=(0,e.useWorkspace)(),{members:f,pending_invites:g}=a;return(0,b.jsxs)(h.Card,{children:[(0,b.jsxs)(h.CardHeader,{children:[(0,b.jsx)(h.CardAction,{children:(0,b.jsx)("button",{type:"button",onClick:()=>c.push(`/w/${d}/settings`),className:"text-muted-foreground hover:text-foreground transition-colors cursor-pointer",children:(0,b.jsx)(w.ArrowUpRight,{className:"size-4"})})}),(0,b.jsxs)(h.CardTitle,{children:["Team",g>0&&(0,b.jsxs)("span",{className:"ml-2 text-xs text-muted-foreground font-normal",children:["(",g," pending invite",g>1?"s":"",")"]})]})]}),(0,b.jsx)(h.CardContent,{className:"p-0",children:(0,b.jsx)("div",{className:"divide-y divide-border/50",children:[...f].sort((a,b)=>"owner"===a.role?-1:+("owner"===b.role)).map(a=>(0,b.jsxs)("div",{className:"flex items-center gap-3 px-4 py-2",children:[a.image?(0,b.jsx)("img",{src:a.image,alt:a.name,className:"size-7 rounded-full shrink-0"}):(0,b.jsx)("div",{className:"flex size-7 shrink-0 items-center justify-center rounded-full bg-secondary text-xs font-medium",children:(0,z.avatarInitial)((0,y.displayName)(a))}),(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,b.jsx)("span",{className:"text-sm font-medium truncate block",children:(0,y.displayName)(a)}),a.name&&(0,b.jsx)("span",{className:"text-xs text-muted-foreground truncate block",children:a.email})]}),(0,b.jsx)(i.Badge,{variant:"owner"===a.role?"default":"secondary",className:"text-[10px] px-2 py-0 shrink-0",children:a.role})]},a.id))})})]})}a.s(["UsagesTab",0,function(){let{agents:a,runtimes:h,loading:i,activeTaskCounts:j}=(0,d.useAgentContext)(),{workspaceId:k}=(0,e.useWorkspace)(),[l,m]=(0,c.useState)(null),[n,o]=(0,c.useState)(!1);return((0,c.useEffect)(()=>{if(i)return;let a=!1;return o(!0),(0,g.getWorkspaceOverview)(k).then(b=>{a||m(b)}).catch(()=>{}).finally(()=>{a||o(!1)}),()=>{a=!0}},[i,k]),n||!l)?(0,b.jsxs)("div",{className:"space-y-4",children:[(0,b.jsx)(f.Skeleton,{className:"h-44 rounded-xl"}),(0,b.jsx)(f.Skeleton,{className:"h-44 rounded-xl"}),(0,b.jsx)(f.Skeleton,{className:"h-44 rounded-xl"}),(0,b.jsx)(f.Skeleton,{className:"h-44 rounded-xl"})]}):(0,b.jsxs)("div",{className:"space-y-4",children:[(0,b.jsx)(q,{agents:a,runtimes:h,activeTaskCounts:j,overview:l}),(0,b.jsxs)("div",{className:"grid gap-4 lg:grid-cols-2",children:[(0,b.jsx)(r,{overview:l}),(0,b.jsx)(u,{overview:l,agents:a})]}),(0,b.jsxs)("div",{className:"grid gap-4 lg:grid-cols-2",children:[(0,b.jsx)(x,{runtimes:h,agents:a}),(0,b.jsx)(A,{overview:l})]})]})}],617168)},294526,a=>a.a(async(b,c)=>{try{var d=a.i(229073),e=a.i(226058),f=a.i(654461),g=a.i(75118),h=a.i(597047),i=a.i(53909),j=a.i(616131),k=a.i(93590),l=a.i(390946),m=a.i(617168),n=b([h,j]);[h,j]=n.then?(await n)():n;let o=[{id:"general",label:"General"},{id:"pet",label:"Pet"},{id:"instruction",label:"Global Instruction"},{id:"notifications",label:"Notifications"},{id:"members",label:"Members"},{id:"usages",label:"Usages"}];a.s(["default",0,function(){let[a,b]=(0,e.useState)("general");return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"flex items-center justify-between border-b border-border/50 px-3 sm:px-4 py-2 gap-3",children:(0,d.jsx)("div",{className:"flex items-center gap-3 min-w-0",children:(0,d.jsx)("h1",{className:"text-sm font-medium",children:"Settings"})})}),(0,d.jsxs)("div",{className:"flex flex-1 min-h-0",children:[(0,d.jsxs)("nav",{className:"w-48 shrink-0 border-r border-border/50 py-3 px-2 hidden sm:flex sm:flex-col",children:[(0,d.jsx)("div",{className:"flex-1",children:o.map(c=>(0,d.jsx)("button",{onClick:()=>b(c.id),className:(0,g.cn)("w-full rounded-md px-2 py-2 text-left text-sm transition-colors",a===c.id?"bg-accent text-foreground font-medium":"text-muted-foreground hover:bg-accent/50 hover:text-foreground"),children:c.label},c.id))}),(0,d.jsxs)("div",{className:"px-2 pt-3 border-t border-border/50 text-[11px] text-muted-foreground/60",children:["v","0.0.152"]})]}),(0,d.jsxs)("div",{className:"flex-1 min-w-0 flex flex-col",children:[(0,d.jsx)("div",{className:"px-4 pt-2 sm:hidden",children:(0,d.jsx)(f.Tabs,{className:"items-center",value:a,onValueChange:a=>b(a),children:(0,d.jsx)(f.TabsList,{className:"h-auto gap-1",children:o.map(a=>(0,d.jsx)(f.TabsTrigger,{value:a.id,children:a.label},a.id))})})}),(0,d.jsx)("div",{className:(0,g.cn)("flex-1 overflow-y-auto thin-scrollbar","instruction"!==a&&"px-4 py-4"),children:"instruction"===a?(0,d.jsx)(i.InstructionTab,{}):"usages"===a?(0,d.jsx)(m.UsagesTab,{}):(0,d.jsxs)("div",{className:"mx-auto max-w-md",children:["general"===a&&(0,d.jsx)(h.GeneralTab,{}),"pet"===a&&(0,d.jsx)(l.PetTab,{}),"notifications"===a&&(0,d.jsx)(k.NotificationTab,{}),"members"===a&&(0,d.jsx)(j.MembersTab,{})]})}),(0,d.jsxs)("div",{className:"px-4 py-2 text-[11px] text-muted-foreground/60 sm:hidden",children:["v","0.0.152"]})]})]})]})}]),c()}catch(a){c(a)}},!1)];
|
|
1
|
+
module.exports=[597047,a=>a.a(async(b,c)=>{try{var d=a.i(229073),e=a.i(226058),f=a.i(780956),g=a.i(670209),h=a.i(506180),i=a.i(454607);a.i(4338);var j=a.i(514746),k=a.i(732254),l=a.i(334235),m=a.i(76592),n=a.i(25668),o=a.i(390248),p=a.i(946621),q=b([i]);[i]=q.then?(await q)():q,a.s(["GeneralTab",0,function(){let{workspaceId:a,slug:b}=(0,h.useWorkspace)(),c=(0,i.useSession)(),q=(0,g.useRouter)(),[r,s]=(0,e.useState)(""),[t,u]=(0,e.useState)(!0),[v,w]=(0,e.useState)(""),[x,y]=(0,e.useState)(""),[z,A]=(0,e.useState)(""),[B,C]=(0,e.useState)(""),[D,E]=(0,e.useState)(!1),[F,G]=(0,e.useState)({}),[H,I]=(0,e.useState)(""),[J,K]=(0,e.useState)(!1),L=(0,e.useCallback)(async()=>{u(!0);try{let b=c.data?.user?.id,[d,e]=await Promise.all([(0,j.listMembers)(a),(0,j.listWorkspaces)()]),f=d.find(a=>a.user_id===b);s(f?.role??"");let g=e.find(b=>b.id===a);g&&(w(g.name),y(g.slug),A(g.name),C(g.slug))}catch(a){f.toast.error(a instanceof Error?a.message:"Failed to load workspace info")}finally{u(!1)}},[a,c.data?.user?.id]);(0,e.useEffect)(()=>{c.data&&L()},[L,c.data]);let M=v!==z||x!==B,N=async()=>{let c=(0,o.validateWorkspaceForm)({name:v,slug:x});if(G(c),!(0,o.hasWorkspaceFormErrors)(c)){E(!0);try{let c=await (0,j.updateWorkspace)(a,{name:v.trim(),slug:x.trim()});(0,p.trackSettingsUpdated)({setting_tab:"general"}),A(c.name),C(c.slug),f.toast.success("Workspace updated"),c.slug!==b&&q.replace(`/w/${c.slug}/settings`)}catch(a){f.toast.error(a instanceof Error?a.message:"Failed to update workspace")}finally{E(!1)}}},O=async()=>{if(H===z){K(!0);try{await (0,j.deleteWorkspace)(a,z),f.toast.success("Workspace deleted"),q.replace("/workspaces")}catch(a){f.toast.error(a instanceof Error?a.message:"Failed to delete workspace")}finally{K(!1)}}};return t?(0,d.jsxs)("div",{className:"space-y-4",children:[(0,d.jsx)(n.Skeleton,{className:"h-4 w-32"}),(0,d.jsx)(n.Skeleton,{className:"h-10 w-full"}),(0,d.jsx)(n.Skeleton,{className:"h-10 w-full"})]}):"owner"!==r?(0,d.jsx)("p",{className:"text-sm text-muted-foreground",children:"Only workspace owners can edit workspace settings."}):(0,d.jsxs)("div",{className:"space-y-10",children:[(0,d.jsxs)("section",{className:"space-y-4",children:[(0,d.jsx)("h2",{className:"text-sm font-medium",children:"Workspace"}),(0,d.jsxs)("div",{className:"space-y-3",children:[(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsx)(m.Label,{htmlFor:"workspace-name",children:"Name"}),(0,d.jsx)(l.Input,{id:"workspace-name",value:v,onChange:a=>{let b=a.target.value;w(b),F.name&&b.trim()&&G(a=>({...a,name:void 0}))},placeholder:"Workspace name","aria-invalid":!!F.name,"aria-describedby":F.name?"workspace-name-error":void 0}),F.name&&(0,d.jsx)("p",{id:"workspace-name-error",className:"text-xs text-destructive",children:F.name})]}),(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsx)(m.Label,{htmlFor:"workspace-slug",children:"Slug"}),(0,d.jsx)(l.Input,{id:"workspace-slug",value:x,onChange:a=>{let b=a.target.value;y(b),F.slug&&b.trim()&&G(a=>({...a,slug:void 0}))},placeholder:"workspace-slug","aria-invalid":!!F.slug,"aria-describedby":F.slug?"workspace-slug-error":void 0}),F.slug&&(0,d.jsx)("p",{id:"workspace-slug-error",className:"text-xs text-destructive",children:F.slug}),(0,d.jsxs)("p",{className:"text-xs text-muted-foreground/70",children:["Used in URLs: /w/",x,"/"]})]})]}),(0,d.jsx)(k.Button,{size:"sm",onClick:N,disabled:!M||D,children:D?"Saving…":"Save"})]}),(0,d.jsxs)("section",{className:"space-y-4",children:[(0,d.jsx)("h2",{className:"text-sm font-medium text-destructive",children:"Danger Zone"}),(0,d.jsxs)("div",{className:"rounded-md border border-destructive/30 p-4 space-y-3",children:[(0,d.jsx)("p",{className:"text-sm text-muted-foreground",children:"Deleting this workspace is permanent and cannot be undone. All agents, conversations, and data will be lost."}),(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsxs)(m.Label,{htmlFor:"delete-confirm",className:"text-xs",children:["Type ",(0,d.jsx)("span",{className:"font-medium text-foreground",children:z})," to confirm"]}),(0,d.jsx)(l.Input,{id:"delete-confirm",value:H,onChange:a=>I(a.target.value),placeholder:z})]}),(0,d.jsx)(k.Button,{size:"sm",variant:"destructive",onClick:O,disabled:H!==z||J,children:J?"Deleting…":"Delete Workspace"})]})]})]})}]),c()}catch(a){c(a)}},!1),53909,a=>{"use strict";var b=a.i(229073),c=a.i(226058),d=a.i(780956),e=a.i(506180);a.i(4338);var f=a.i(514746),g=a.i(889624),h=a.i(25668),i=a.i(75118);function j({ratio:a,size:c=16,stroke:d=1.5}){let e=(c-d)/2,f=2*Math.PI*e,g=(a<=0?0:a>=1?1:Math.log1p(99*a)/Math.log(100))*f;return(0,b.jsxs)("svg",{width:c,height:c,className:"shrink-0 -rotate-90","aria-hidden":!0,children:[(0,b.jsx)("circle",{cx:c/2,cy:c/2,r:e,fill:"none",stroke:"currentColor",strokeWidth:d,className:"text-border"}),(0,b.jsx)("circle",{cx:c/2,cy:c/2,r:e,fill:"none",stroke:"currentColor",strokeWidth:d,strokeDasharray:`${g} ${f-g}`,strokeLinecap:"round",className:(0,i.cn)("transition-all duration-300",a>.9?"text-destructive/70":a>.7?"text-yellow-500/50":"text-muted-foreground/30")})]})}a.s(["InstructionTab",0,function(){let{workspaceId:a}=(0,e.useWorkspace)(),[i,k]=(0,c.useState)(""),[l,m]=(0,c.useState)(""),[n,o]=(0,c.useState)(!0),p=(0,c.useRef)(i);(0,c.useEffect)(()=>{p.current=i},[i]);let q=(0,c.useRef)(l);(0,c.useEffect)(()=>{q.current=l},[l]);let r=(0,c.useRef)(null),s=(0,c.useRef)(!1),t=(0,c.useCallback)(async()=>{o(!0);try{let b=await (0,f.getMemberMe)(a);k(b.global_instruction),m(b.global_instruction)}catch(a){d.toast.error(a instanceof Error?a.message:"Failed to load settings")}finally{o(!1)}},[a]);(0,c.useEffect)(()=>{t()},[t]);let u=(0,c.useRef)(()=>{}),v=(0,c.useCallback)(async()=>{if(s.current)return;let b=p.current;if(b!==q.current){s.current=!0;try{let c=await (0,f.updateMemberMe)(a,b);m(c.global_instruction)}catch(a){d.toast.error(a instanceof Error?a.message:"Failed to save")}finally{s.current=!1,p.current!==q.current&&u.current()}}},[a]),w=(0,c.useCallback)(()=>{r.current&&clearTimeout(r.current),r.current=setTimeout(v,500)},[v]);(0,c.useEffect)(()=>{u.current=w},[w]);let x=(0,c.useCallback)(a=>{k(a),w()},[w]);(0,c.useEffect)(()=>{let b=()=>{if(r.current&&clearTimeout(r.current),p.current!==q.current){let b=new URLSearchParams({workspace_id:a});fetch(`/api/members/me?${b}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({global_instruction:p.current}),keepalive:!0})}};return window.addEventListener("beforeunload",b),()=>window.removeEventListener("beforeunload",b)},[a]),(0,c.useEffect)(()=>()=>{if(r.current&&clearTimeout(r.current),p.current!==q.current){let b=new URLSearchParams({workspace_id:a});fetch(`/api/members/me?${b}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({global_instruction:p.current}),keepalive:!0})}},[a]);let y=i.length/5e4;return n?(0,b.jsxs)("div",{className:"px-6 py-6 space-y-4",children:[(0,b.jsx)(h.Skeleton,{className:"h-4 w-48"}),(0,b.jsx)(h.Skeleton,{className:"h-40 w-full"})]}):(0,b.jsxs)("div",{className:"flex flex-col h-full",children:[(0,b.jsx)("div",{className:"flex-1 px-6 pt-4 pb-4",children:(0,b.jsx)(g.MarkdownEditor,{value:i,onChange:x,placeholder:"Write instructions that every agent you own will follow...",minHeight:"calc(100vh - 240px)",contentType:"markdown",variant:"seamless"})}),(0,b.jsxs)("div",{className:"flex items-center gap-2 px-6 py-3",children:[(0,b.jsx)(j,{ratio:y}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:"This instruction is prepended to every agent's individual instruction."})]})]})}])},616131,a=>a.a(async(b,c)=>{try{var d=a.i(229073),e=a.i(226058),f=a.i(780956),g=a.i(447284),h=a.i(464687),i=a.i(179291),j=a.i(500331),k=a.i(506180),l=a.i(454607);a.i(4338);var m=a.i(514746),n=a.i(732254),o=a.i(25668),p=a.i(525132),q=a.i(75118),r=a.i(946621),s=a.i(377447),t=b([l]);function u(a){return`${window.location.origin}/invite/${a}`}[l]=t.then?(await t)():t,a.s(["MembersTab",0,function(){let{workspaceId:a}=(0,k.useWorkspace)(),b=(0,l.useSession)(),c=b.data?.user?.id,[t,v]=(0,e.useState)([]),[w,x]=(0,e.useState)([]),[y,z]=(0,e.useState)(!0),[A,B]=(0,e.useState)(!1),C=t.find(a=>a.user_id===c)?.role==="owner",D=(0,e.useCallback)(async()=>{z(!0);try{let[b,c]=await Promise.all([(0,m.listMembers)(a),(0,m.listInvites)(a).catch(()=>[])]);v(b),x(c)}catch(a){f.toast.error(a instanceof Error?a.message:"Failed to load members")}finally{z(!1)}},[a]);(0,e.useEffect)(()=>{D()},[D]);let E=async()=>{B(!0);try{let b=await (0,m.createInvite)(a);(0,r.trackTeamMemberInvited)({workspace_id:a}),x(a=>[...a,b]);let c=u(b.token);await navigator.clipboard.writeText(c),f.toast.success("Invite link copied to clipboard")}catch(a){f.toast.error(a instanceof Error?a.message:"Failed to generate invite")}finally{B(!1)}},F=async a=>{let b=u(a);try{await navigator.clipboard.writeText(b),f.toast.success("Invite link copied")}catch{f.toast.error("Failed to copy link")}},G=async b=>{try{await (0,m.revokeInvite)(a,b),x(a=>a.filter(a=>a.id!==b)),f.toast.success("Invite revoked")}catch(a){f.toast.error(a instanceof Error?a.message:"Failed to revoke invite")}},H=async b=>{try{await (0,m.removeMember)(a,b),v(a=>a.filter(a=>a.id!==b)),f.toast.success("Member removed")}catch(a){f.toast.error(a instanceof Error?a.message:"Failed to remove member")}};return y?(0,d.jsxs)("div",{className:"space-y-4",children:[(0,d.jsx)(o.Skeleton,{className:"h-4 w-24"}),(0,d.jsx)(o.Skeleton,{className:"h-10 w-full"}),(0,d.jsx)(o.Skeleton,{className:"h-10 w-full"}),(0,d.jsx)(o.Skeleton,{className:"h-4 w-24 mt-6"}),(0,d.jsx)(o.Skeleton,{className:"h-10 w-full"}),(0,d.jsx)(o.Skeleton,{className:"h-10 w-full"})]}):(0,d.jsxs)("div",{className:"space-y-8",children:[C&&(0,d.jsxs)("section",{className:"space-y-3",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsx)("h2",{className:"text-sm font-medium",children:"Pending Invites"}),(0,d.jsxs)(n.Button,{size:"sm",variant:"outline",onClick:E,disabled:A,children:[(0,d.jsx)(i.Plus,{className:"size-3.5 mr-1"}),A?"Generating…":"Generate invite link"]})]}),0===w.length?(0,d.jsx)("p",{className:"text-xs text-muted-foreground py-2",children:"No active invite links. Generate one to invite someone to this workspace."}):(0,d.jsx)("div",{className:"space-y-2",children:w.map(a=>{let b=new Date(a.expires_at),c=b<new Date;return(0,d.jsxs)("div",{className:"flex items-center justify-between rounded-md border border-border/50 px-3 py-2 text-xs",children:[(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsxs)("p",{className:(0,q.cn)("font-mono truncate",c&&"text-muted-foreground line-through"),children:["/invite/",a.token.slice(0,12),"…"]}),(0,d.jsx)("p",{className:(0,q.cn)("text-muted-foreground/70 mt-1",c&&"text-destructive/70"),children:c?"Expired":`Expires ${b.toLocaleDateString()}`})]}),(0,d.jsxs)("div",{className:"flex items-center gap-1 ml-2 shrink-0",children:[!c&&(0,d.jsxs)(p.Tooltip,{children:[(0,d.jsx)(p.TooltipTrigger,{render:(0,d.jsx)(n.Button,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0",onClick:()=>F(a.token)}),children:(0,d.jsx)(g.Copy,{className:"size-3.5"})}),(0,d.jsx)(p.TooltipContent,{children:"Copy invite link"})]}),(0,d.jsxs)(p.Tooltip,{children:[(0,d.jsx)(p.TooltipTrigger,{render:(0,d.jsx)(n.Button,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0 text-destructive hover:text-destructive",onClick:()=>G(a.id)}),children:(0,d.jsx)(h.Trash2,{className:"size-3.5"})}),(0,d.jsx)(p.TooltipContent,{children:"Revoke invite"})]})]})]},a.id)})})]}),(0,d.jsxs)("section",{className:"space-y-3",children:[(0,d.jsx)("h2",{className:"text-sm font-medium",children:"Members"}),(0,d.jsx)("div",{className:"space-y-2",children:t.map(a=>{let b=a.user_id===c,e=(0,s.displayName)(a).split(" ").map(a=>a[0]).join("").slice(0,2).toUpperCase();return(0,d.jsxs)("div",{className:"flex items-center gap-3 rounded-md border border-border/50 px-3 py-2",children:[(0,d.jsx)("div",{className:"size-7 rounded-full bg-muted flex items-center justify-center text-xs font-medium text-muted-foreground shrink-0 overflow-hidden",children:a.image?(0,d.jsx)("img",{src:a.image,alt:a.name,className:"size-full object-cover"}):e}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsxs)("p",{className:"text-sm font-medium truncate leading-tight",children:[(0,s.displayName)(a),b&&(0,d.jsx)("span",{className:"ml-2 text-xs text-muted-foreground font-normal",children:"(you)"})]}),a.name&&(0,d.jsx)("p",{className:"text-xs text-muted-foreground truncate",children:a.email})]}),(0,d.jsx)("span",{className:(0,q.cn)("text-xs px-2 py-1 rounded shrink-0","owner"===a.role?"bg-primary/10 text-primary":"bg-muted text-muted-foreground"),children:a.role}),C&&!b&&(0,d.jsxs)(p.Tooltip,{children:[(0,d.jsx)(p.TooltipTrigger,{render:(0,d.jsx)(n.Button,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0 text-muted-foreground hover:text-destructive shrink-0",onClick:()=>H(a.id)}),children:(0,d.jsx)(j.UserMinus,{className:"size-3.5"})}),(0,d.jsx)(p.TooltipContent,{children:"Remove member"})]})]},a.id)})})]})]})}]),c()}catch(a){c(a)}},!1),93590,a=>{"use strict";var b=a.i(229073),c=a.i(226058),d=a.i(780956),e=a.i(951687),f=a.i(973111),g=a.i(626806);a.s(["NotificationTab",0,function(){let[a,h]=(0,c.useState)(!1),[i,j]=(0,c.useState)([...g.NOTIFICATION_EVENTS]),[k,l]=(0,c.useState)(!0),[m,n]=(0,c.useState)(!1);(0,c.useEffect)(()=>{l((0,g.isNotificationSupported)()),h((0,g.getNotificationEnabled)()),j((0,g.getNotificationEvents)()),(0,g.isNotificationSupported)()&&n("denied"===Notification.permission)},[]);let o=async a=>{if(!a){h(!1),(0,g.setNotificationEnabled)(!1);return}await (0,g.requestNotificationPermission)()?(h(!0),(0,g.setNotificationEnabled)(!0)):(n(!0),d.toast.error("Notification permission denied. Please enable it in browser settings."))};return k?(0,b.jsx)("div",{className:"space-y-6",children:(0,b.jsxs)("section",{className:"space-y-4",children:[(0,b.jsx)("h2",{className:"text-sm font-medium",children:"Browser Notifications"}),(0,b.jsxs)("div",{className:"space-y-3",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between",children:[(0,b.jsxs)("div",{className:"space-y-1",children:[(0,b.jsx)("p",{className:"text-sm",children:"Enable notifications"}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:"Get notified when tasks finish while the tab is in the background"})]}),(0,b.jsx)(f.Switch,{checked:a,onCheckedChange:o,disabled:m&&!a})]}),m&&!a&&(0,b.jsx)("p",{className:"text-xs text-destructive",children:"Notification permission was denied. Please allow it in your browser settings."}),a&&(0,b.jsxs)("div",{className:"space-y-2 pl-0.5",children:[(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:"Notify me when:"}),g.NOTIFICATION_EVENTS.map(a=>(0,b.jsxs)("label",{className:"flex items-center gap-2 text-sm cursor-pointer select-none",children:[(0,b.jsx)(e.Checkbox,{checked:i.includes(a),onCheckedChange:()=>{j(b=>{let c=b.includes(a)?b.filter(b=>b!==a):[...b,a];return(0,g.setNotificationEvents)(c),c})}}),g.NOTIFICATION_EVENT_LABELS[a]]},a))]})]})]})}):(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:"Your browser does not support notifications."})}])},390946,a=>{"use strict";var b=a.i(229073),c=a.i(226058);let d=(0,a.i(815624).default)("sparkles",[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]]),e="alook-cloud-code-monster-pet-preset-v1",f="alook-cloud-code-monster-pet-preset-changed",g=new Map([{id:"pet-02",name:"Pocket Bell Bot",group:"Inspired Mascots",feature:"bell",shape:"gadget-buddy"},{id:"pet-03",name:"Spark Bolt Pal",group:"Inspired Mascots",feature:"bolt",shape:"electric-mascot"},{id:"pet-04",name:"Star Puff",group:"Inspired Mascots",feature:"star",shape:"star-puff"},{id:"pet-05",name:"Leaf Bud",group:"Inspired Mascots",feature:"leaf",shape:"leaf-bud-shape"},{id:"pet-06",name:"Tiny Flame",group:"Inspired Mascots",feature:"flame",shape:"ember-scout"},{id:"pet-07",name:"Shell Fin",group:"Inspired Mascots",feature:"fins",shape:"shell-sprout"},{id:"pet-08",name:"Block Builder",group:"Inspired Mascots",feature:"visor",shape:"block-builder-shape"},{id:"pet-09",name:"Block Hiss",group:"Inspired Mascots",feature:"mask",shape:"block-hiss-shape"},{id:"pet-10",name:"Block Walker",group:"Inspired Mascots",feature:"visor",shape:"block-walker-shape"},{id:"pet-11",name:"Mushroom Pal",group:"Inspired Mascots",feature:"mushroom",shape:"mushroom-pal-shape"},{id:"pet-12",name:"Blue Spin",group:"Inspired Mascots",feature:"spin",shape:"blue-spinner"},{id:"pet-13",name:"Arcade Chomp",group:"Inspired Mascots",feature:"chomp",shape:"arcade-chomper"},{id:"pet-14",name:"Peek Ghost",group:"Inspired Mascots",feature:"ghost",shape:"peek-ghost-shape"},{id:"pet-15",name:"Red Cap Jumper",group:"Inspired Mascots",feature:"cap",shape:"cap-jumper"},{id:"pet-16",name:"Honey Cub",group:"Inspired Mascots",feature:"ears",shape:"honey-cub-shape"},{id:"pet-17",name:"Ribbon Cat",group:"Inspired Mascots",feature:"bow",shape:"ribbon-cat-shape"},{id:"pet-18",name:"Cozy Hood Bunny",group:"Inspired Mascots",feature:"hood",shape:"cozy-hood-bunny-shape"},{id:"pet-19",name:"Imp Hood",group:"Inspired Mascots",feature:"mask",shape:"imp-hood-shape"},{id:"pet-20",name:"Forest Neighbor",group:"Inspired Mascots",feature:"ears",shape:"forest-neighbor-shape"},{id:"pet-21",name:"Dust Puff",group:"Inspired Mascots",feature:"soot",shape:"dust-puff-shape"},{id:"pet-22",name:"Straw Voyager",group:"Inspired Mascots",feature:"straw",shape:"straw-voyager-shape"},{id:"pet-23",name:"Leaf Runner",group:"Inspired Mascots",feature:"ninja",shape:"leaf-runner-shape"},{id:"pet-24",name:"Energy Pearl",group:"Inspired Mascots",feature:"pearl",shape:"energy-pearl-shape"},{id:"pet-25",name:"Moon Wand",group:"Inspired Mascots",feature:"wand",shape:"moon-wand-shape"},{id:"pet-26",name:"Mecha Guard",group:"Inspired Mascots",feature:"mecha",shape:"mecha-guard-shape"},{id:"pet-27",name:"Teardrop Slime",group:"Inspired Mascots",feature:"slime",shape:"teardrop-slime-shape"},{id:"pet-28",name:"Ink Runner",group:"Inspired Mascots",feature:"ink",shape:"ink-runner-shape"},{id:"pet-29",name:"Little Beagle",group:"Inspired Mascots",feature:"ears",shape:"little-beagle-shape"},{id:"pet-30",name:"Tiny Antler",group:"Inspired Mascots",feature:"horns",shape:"tiny-antler-shape"}].map(a=>[a.id,a])),h=[{id:"pet-01",name:"Claude Pixel",group:"Codex",feature:"square",bodyTop:"#e0845f",body:"#d87352",bodyDark:"#cf684a",bodyLight:"#e88d68",bodySideLight:"#df7d5a",bodySideDark:"#c86347",accent:"#d7654a",accessory:"#f1bc62",eye:"#12100f",highlight:"#f6e7d7"},{id:"pet-02",name:"Blue Pocket Bot",group:"Gadget Buddy",feature:"bell",bodyTop:"#4aa8d8",body:"#2f8fc4",bodyDark:"#2674a4",bodyLight:"#68bce5",bodySideLight:"#48a8d5",bodySideDark:"#1f6591",accent:"#d84e4a",accessory:"#f4c94f",eye:"#10141a",highlight:"#f7fbff",facePatch:"#f6fbff",cheek:"#d84e4a"},{id:"pet-03",name:"Spark Arcade Pal",group:"Electric Mascot",feature:"bolt",bodyTop:"#f2d45a",body:"#e6bd37",bodyDark:"#c89a2a",bodyLight:"#ffe37a",bodySideLight:"#f0cc4c",bodySideDark:"#b58724",accent:"#2f2520",accessory:"#df5145",eye:"#17120e",highlight:"#fff7c7",cheek:"#e94d43"},{id:"pet-04",name:"Pink Star Puff",group:"Star Puff",feature:"star",bodyTop:"#eba0b7",body:"#df7fa0",bodyDark:"#c76589",bodyLight:"#f2b6c8",bodySideLight:"#e993ac",bodySideDark:"#b95778",accent:"#c84d64",accessory:"#f0d862",eye:"#171016",highlight:"#fff0f6",cheek:"#e75c7a"},{id:"pet-05",name:"Leaf Sprite",group:"Forest Starter",feature:"leaf",bodyTop:"#76aa7b",body:"#5f9666",bodyDark:"#4d7c54",bodyLight:"#91bd8f",bodySideLight:"#72a875",bodySideDark:"#426d49",accent:"#2f6f46",accessory:"#d6e78a",eye:"#11160f",highlight:"#f0f8e4",facePatch:"#dceec2"},{id:"pet-06",name:"Ember Starter",group:"Fire Buddy",feature:"flame",bodyTop:"#df8755",body:"#ce6b3f",bodyDark:"#af5333",bodyLight:"#ee9d6b",bodySideLight:"#dd7b4c",bodySideDark:"#9a482c",accent:"#8d3d2f",accessory:"#f3c34b",eye:"#17100c",highlight:"#ffe8d4",cheek:"#e45842"},{id:"pet-07",name:"Ripple Buddy",group:"Water Buddy",feature:"fins",bodyTop:"#82b5d6",body:"#629dcc",bodyDark:"#4f82ad",bodyLight:"#9bc8e5",bodySideLight:"#73add6",bodySideDark:"#44749b",accent:"#5f6f8d",accessory:"#ead59a",eye:"#10151b",highlight:"#eff8ff",facePatch:"#d9eef8"},{id:"pet-08",name:"Moon Alley Cat",group:"Moon Cat",feature:"moon",bodyTop:"#4f4b69",body:"#3f3a59",bodyDark:"#332f49",bodyLight:"#67607e",bodySideLight:"#554f6d",bodySideDark:"#2b283e",accent:"#e5c85c",accessory:"#d66f91",eye:"#f5e8a7",highlight:"#fff6c8",cheek:"#cf6d8f"},{id:"pet-09",name:"Spore Runner",group:"Mushroom Runner",feature:"mushroom",bodyTop:"#e0524f",body:"#f0dcc6",bodyDark:"#d7c0aa",bodyLight:"#f7ead9",bodySideLight:"#f1dfcb",bodySideDark:"#c7aa95",accent:"#b83736",accessory:"#ffffff",eye:"#17120f",highlight:"#fff8ea"},{id:"pet-10",name:"Dash Quill",group:"Speed Mascot",feature:"spin",bodyTop:"#4e83d0",body:"#356dbd",bodyDark:"#2a579b",bodyLight:"#6896de",bodySideLight:"#477dd0",bodySideDark:"#244c88",accent:"#f2c45b",accessory:"#f2ece1",eye:"#10131a",highlight:"#eef4ff",facePatch:"#ead3b9"},{id:"pet-11",name:"Lemon Chomper",group:"Arcade Chomper",feature:"chomp",bodyTop:"#f0ce45",body:"#e5ba2f",bodyDark:"#c89924",bodyLight:"#ffe26c",bodySideLight:"#efc73f",bodySideDark:"#b18520",accent:"#1f1b18",accessory:"#f2845f",eye:"#15110d",highlight:"#fff2b6"},{id:"pet-12",name:"Lantern Ghost",group:"Round Ghost",feature:"ghost",bodyTop:"#d9dff0",body:"#c4cee6",bodyDark:"#aab6d2",bodyLight:"#edf2ff",bodySideLight:"#d3dced",bodySideDark:"#9aa8c6",accent:"#6d7da8",accessory:"#e77c9c",eye:"#151926",highlight:"#ffffff"},{id:"pet-13",name:"Red Cap Jumper",group:"Platform Pal",feature:"cap",bodyTop:"#d84f45",body:"#c5a17d",bodyDark:"#a98263",bodyLight:"#e0ba94",bodySideLight:"#d3ad86",bodySideDark:"#936f54",accent:"#2c4f99",accessory:"#f6e9d1",eye:"#16110d",highlight:"#fff2df"},{id:"pet-14",name:"Honey Cub",group:"Classic Toy",feature:"ears",bodyTop:"#e4b25a",body:"#d0993e",bodyDark:"#ad7d30",bodyLight:"#efc46d",bodySideLight:"#dba84d",bodySideDark:"#996d2a",accent:"#b54d3f",accessory:"#f4d991",eye:"#17110d",highlight:"#fff0c8",facePatch:"#f2d083"},{id:"pet-15",name:"Ribbon Puff",group:"Bow Buddy",feature:"bow",bodyTop:"#f2f0e8",body:"#e3ded4",bodyDark:"#c9c2b7",bodyLight:"#ffffff",bodySideLight:"#eee9df",bodySideDark:"#bab2a7",accent:"#d84b5b",accessory:"#f3cc56",eye:"#15110f",highlight:"#ffffff",cheek:"#df6d80"},{id:"pet-16",name:"Cozy Hood Cub",group:"Hooded Mascot",feature:"hood",bodyTop:"#ef9eba",body:"#e681a4",bodyDark:"#c96789",bodyLight:"#f5b6ca",bodySideLight:"#ee94b2",bodySideDark:"#b85878",accent:"#f0d6de",accessory:"#f3d66b",eye:"#171017",highlight:"#fff0f6",facePatch:"#fff6f2"},{id:"pet-17",name:"Masked Beetle",group:"Bug Hero",feature:"mask",bodyTop:"#6e617d",body:"#554761",bodyDark:"#41374b",bodyLight:"#837491",bodySideLight:"#655570",bodySideDark:"#382f41",accent:"#cf6f8e",accessory:"#f0d46a",eye:"#f7edf4",highlight:"#fff7ff",facePatch:"#ece0ea"},{id:"pet-18",name:"Round Forest Pal",group:"Forest Neighbor",feature:"ears",bodyTop:"#8c8d7d",body:"#74766a",bodyDark:"#606257",bodyLight:"#a0a293",bodySideLight:"#838578",bodySideDark:"#55574d",accent:"#d9d3b8",accessory:"#c6d68c",eye:"#121411",highlight:"#efead8",facePatch:"#dad4ba"},{id:"pet-19",name:"Dust Puff",group:"Tiny Soot",feature:"soot",bodyTop:"#34343a",body:"#25262c",bodyDark:"#1d1e24",bodyLight:"#4a4b52",bodySideLight:"#383941",bodySideDark:"#171820",accent:"#6c6f7a",accessory:"#f0f0d8",eye:"#f7f7e8",highlight:"#ffffff"},{id:"pet-20",name:"Straw Field Pal",group:"Harvest Buddy",feature:"straw",bodyTop:"#d96a50",body:"#c65342",bodyDark:"#a74336",bodyLight:"#e47d64",bodySideLight:"#d0614d",bodySideDark:"#933a30",accent:"#2f5f93",accessory:"#e8c866",eye:"#15100d",highlight:"#ffe6d9"},{id:"pet-21",name:"Shadow Ninja Bean",group:"Ninja Mascot",feature:"ninja",bodyTop:"#e7a04d",body:"#d88432",bodyDark:"#b96c27",bodyLight:"#efb464",bodySideLight:"#df943e",bodySideDark:"#a25d22",accent:"#2d415c",accessory:"#ded5c6",eye:"#15100c",highlight:"#ffe7c8",facePatch:"#f3c78d"},{id:"pet-22",name:"Pearl Quest Cub",group:"Pearl Hero",feature:"pearl",bodyTop:"#e3a54e",body:"#ce8438",bodyDark:"#ac682e",bodyLight:"#efbc68",bodySideLight:"#db9345",bodySideDark:"#985a28",accent:"#476ca6",accessory:"#f0d464",eye:"#15100c",highlight:"#ffe8c4"},{id:"pet-23",name:"Wand Starling",group:"Magic Mascot",feature:"wand",bodyTop:"#f0a6c4",body:"#df87ad",bodyDark:"#c26b92",bodyLight:"#f5bad2",bodySideLight:"#e99ab9",bodySideDark:"#ad5d82",accent:"#d8b34a",accessory:"#e9d7ff",eye:"#171017",highlight:"#fff0f7",cheek:"#e76791"},{id:"pet-24",name:"Mecha Bean",group:"Tiny Mecha",feature:"mecha",bodyTop:"#d7dbe2",body:"#bdc3ce",bodyDark:"#9ea6b3",bodyLight:"#edf0f5",bodySideLight:"#cbd1da",bodySideDark:"#8d96a5",accent:"#d44d4a",accessory:"#f0c748",eye:"#151923",highlight:"#ffffff"},{id:"pet-25",name:"Bubble Slimelet",group:"Slime Buddy",feature:"slime",bodyTop:"#79b8e8",body:"#5aa0d8",bodyDark:"#4384ba",bodyLight:"#96cdf0",bodySideLight:"#70b3e3",bodySideDark:"#3975a6",accent:"#2a658f",accessory:"#f3f7ff",eye:"#101722",highlight:"#f5fbff"},{id:"pet-26",name:"Ink Courier",group:"Ink Runner",feature:"ink",bodyTop:"#75c8bb",body:"#54afa2",bodyDark:"#3f9188",bodyLight:"#90d9ce",bodySideLight:"#67c1b5",bodySideDark:"#377f77",accent:"#d7668f",accessory:"#e4f2ef",eye:"#101716",highlight:"#effffb"},{id:"pet-27",name:"Drum Marcher",group:"Rhythm Pal",feature:"drum",bodyTop:"#ef7f5f",body:"#df6349",bodyDark:"#bd4d3b",bodyLight:"#f39a7b",bodySideLight:"#e77358",bodySideDark:"#a84434",accent:"#4f78b6",accessory:"#f3e4c6",eye:"#15100d",highlight:"#fff0e4"},{id:"pet-28",name:"Sprout Forestling",group:"Sprout Buddy",feature:"sprout",bodyTop:"#a58f5d",body:"#8f7548",bodyDark:"#755f3a",bodyLight:"#b9a26e",bodySideLight:"#9b8354",bodySideDark:"#655233",accent:"#5d8b56",accessory:"#dfc86e",eye:"#15110c",highlight:"#f8ecc0",facePatch:"#d8be71"},{id:"pet-29",name:"Frost Star Pup",group:"Ice Pal",feature:"star",bodyTop:"#8aa7d8",body:"#6e91c8",bodyDark:"#5877aa",bodyLight:"#a1bce5",bodySideLight:"#7f9fd3",bodySideDark:"#4e6898",accent:"#f0cf5b",accessory:"#f3edf5",eye:"#10151c",highlight:"#eff5ff",cheek:"#d66d86"},{id:"pet-30",name:"Tiny Quest Cub",group:"Quest Mascot",feature:"bow",bodyTop:"#efa2c8",body:"#df84b2",bodyDark:"#c46999",bodyLight:"#f5b9d5",bodySideLight:"#eb96c2",bodySideDark:"#ad5a86",accent:"#cf4d78",accessory:"#f0d66a",eye:"#171016",highlight:"#fff0f8",cheek:"#df688f"}].map(a=>({...a,...g.get(a.id)}));function i(a){return h.find(b=>b.id===a)??h[0]}function j(){if("u"<typeof localStorage)return h[0].id;try{return i(localStorage.getItem(e)).id}catch{return h[0].id}}var k=a.i(535510);let l=(0,c.lazy)(()=>a.A(76574).then(a=>({default:a.MonsterDirectPixelCharacter})));function m({activityId:a,preset:c,reacting:d,shaken:e,fainted:f=!1,eyeOffset:g={x:0,y:0}}){let h=(0,k.getCloudCodeMonsterExpression)(a,d,e,f);return"fainted"===h?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("rect",{x:"43",y:"39",width:"5",height:"5",fill:c.eye}),(0,b.jsx)("rect",{x:"49",y:"45",width:"5",height:"5",fill:c.eye}),(0,b.jsx)("rect",{x:"43",y:"51",width:"5",height:"5",fill:c.eye}),(0,b.jsx)("rect",{x:"49",y:"39",width:"5",height:"5",fill:c.eye}),(0,b.jsx)("rect",{x:"43",y:"45",width:"5",height:"5",fill:c.eye}),(0,b.jsx)("rect",{x:"76",y:"39",width:"5",height:"5",fill:c.eye}),(0,b.jsx)("rect",{x:"82",y:"45",width:"5",height:"5",fill:c.eye}),(0,b.jsx)("rect",{x:"76",y:"51",width:"5",height:"5",fill:c.eye}),(0,b.jsx)("rect",{x:"82",y:"39",width:"5",height:"5",fill:c.eye}),(0,b.jsx)("rect",{x:"76",y:"45",width:"5",height:"5",fill:c.eye}),(0,b.jsx)("rect",{x:"58",y:"64",width:"14",height:"4",fill:c.eye})]}):"shaken"===h?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("rect",{x:"45",y:"40",width:"5",height:"5",fill:c.eye}),(0,b.jsx)("rect",{x:"50",y:"45",width:"5",height:"5",fill:c.eye}),(0,b.jsx)("rect",{x:"45",y:"50",width:"5",height:"5",fill:c.eye}),(0,b.jsx)("rect",{x:"82",y:"40",width:"5",height:"5",fill:c.eye}),(0,b.jsx)("rect",{x:"77",y:"45",width:"5",height:"5",fill:c.eye}),(0,b.jsx)("rect",{x:"82",y:"50",width:"5",height:"5",fill:c.eye}),(0,b.jsx)("rect",{x:"62",y:"61",width:"6",height:"4",fill:c.eye})]}):"shocked"===h?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("g",{className:"cloud-code-monster-pet-eyes-track",transform:`translate(${g.x} ${g.y})`,children:[(0,b.jsx)("rect",{className:"cloud-code-monster-pet-eye-blink",x:"44",y:"39",width:"12",height:"13",fill:c.eye}),(0,b.jsx)("rect",{className:"cloud-code-monster-pet-eye-blink",x:"76",y:"39",width:"12",height:"13",fill:c.eye}),(0,b.jsxs)("g",{transform:`translate(${.45*g.x} ${.45*g.y})`,children:[(0,b.jsx)("rect",{x:"47",y:"42",width:"4",height:"4",fill:c.highlight}),(0,b.jsx)("rect",{x:"79",y:"42",width:"4",height:"4",fill:c.highlight})]})]}),(0,b.jsx)("rect",{x:"60",y:"60",width:"10",height:"12",fill:c.eye}),(0,b.jsx)("rect",{x:"62",y:"62",width:"6",height:"3",fill:"#332520"})]}):"sleeping"===h?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("rect",{x:"45",y:"46",width:"11",height:"4",fill:c.eye}),(0,b.jsx)("rect",{x:"76",y:"46",width:"11",height:"4",fill:c.eye})]}):(0,b.jsxs)("g",{className:"cloud-code-monster-pet-eyes-track",transform:`translate(${g.x} ${g.y})`,children:[(0,b.jsx)("rect",{className:"cloud-code-monster-pet-eye-blink",x:"44",y:"42",width:"11",height:"12",fill:c.eye}),(0,b.jsx)("rect",{className:"cloud-code-monster-pet-eye-blink",x:"77",y:"42",width:"11",height:"12",fill:c.eye}),(0,b.jsxs)("g",{transform:`translate(${.55*g.x} ${.55*g.y})`,children:[(0,b.jsx)("rect",{x:"46",y:"44",width:"4",height:"4",fill:"#2c2521"}),(0,b.jsx)("rect",{x:"79",y:"44",width:"4",height:"4",fill:"#2c2521"})]})]})}function n({preset:a}){let{feature:c}=a;return"horns"===c?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("rect",{x:"29",y:"20",width:"10",height:"8",fill:a.accent}),(0,b.jsx)("rect",{x:"91",y:"20",width:"10",height:"8",fill:a.accent}),(0,b.jsx)("rect",{x:"34",y:"16",width:"7",height:"7",fill:a.accessory}),(0,b.jsx)("rect",{x:"88",y:"16",width:"7",height:"7",fill:a.accessory})]}):"ears"===c?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("rect",{x:"18",y:"38",width:"10",height:"18",fill:a.bodyDark}),(0,b.jsx)("rect",{x:"100",y:"38",width:"10",height:"18",fill:a.bodyDark}),(0,b.jsx)("rect",{x:"21",y:"42",width:"5",height:"8",fill:a.bodyLight}),(0,b.jsx)("rect",{x:"102",y:"42",width:"5",height:"8",fill:a.bodyLight})]}):"visor"===c?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("rect",{x:"41",y:"36",width:"47",height:"5",fill:a.accent}),(0,b.jsx)("rect",{x:"45",y:"38",width:"39",height:"3",fill:a.highlight})]}):"antenna"===c?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("rect",{x:"62",y:"15",width:"5",height:"13",fill:a.accent}),(0,b.jsx)("rect",{x:"58",y:"10",width:"13",height:"6",fill:a.accessory})]}):"crown"===c?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("rect",{x:"43",y:"18",width:"8",height:"10",fill:a.accessory}),(0,b.jsx)("rect",{x:"60",y:"14",width:"8",height:"14",fill:a.accessory}),(0,b.jsx)("rect",{x:"77",y:"18",width:"8",height:"10",fill:a.accessory}),(0,b.jsx)("rect",{x:"42",y:"26",width:"44",height:"5",fill:a.accent})]}):"bell"===c?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("rect",{x:"22",y:"42",width:"8",height:"14",fill:a.bodyDark}),(0,b.jsx)("rect",{x:"98",y:"42",width:"8",height:"14",fill:a.bodyDark}),(0,b.jsx)("rect",{x:"59",y:"21",width:"11",height:"7",fill:a.accent})]}):"bolt"===c?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("rect",{x:"29",y:"20",width:"8",height:"17",fill:a.accent}),(0,b.jsx)("rect",{x:"91",y:"20",width:"8",height:"17",fill:a.accent}),(0,b.jsx)("rect",{x:"33",y:"32",width:"8",height:"9",fill:a.bodyTop}),(0,b.jsx)("rect",{x:"87",y:"32",width:"8",height:"9",fill:a.bodyTop})]}):"star"===c?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("rect",{x:"60",y:"13",width:"8",height:"24",fill:a.accessory}),(0,b.jsx)("rect",{x:"52",y:"21",width:"24",height:"8",fill:a.accessory}),(0,b.jsx)("rect",{x:"56",y:"17",width:"16",height:"16",fill:a.accessory})]}):"leaf"===c||"sprout"===c?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("rect",{x:"61",y:"15",width:"6",height:"18",fill:a.accent}),(0,b.jsx)("rect",{x:"49",y:"18",width:"16",height:"10",fill:a.accent}),(0,b.jsx)("rect",{x:"66",y:"18",width:"16",height:"10",fill:a.bodyLight})]}):"flame"===c?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("rect",{x:"58",y:"9",width:"12",height:"20",fill:a.accessory}),(0,b.jsx)("rect",{x:"52",y:"18",width:"9",height:"14",fill:a.accent}),(0,b.jsx)("rect",{x:"69",y:"17",width:"8",height:"15",fill:a.bodyLight})]}):"fins"===c?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("rect",{x:"18",y:"45",width:"10",height:"18",fill:a.accent}),(0,b.jsx)("rect",{x:"100",y:"45",width:"10",height:"18",fill:a.accent}),(0,b.jsx)("rect",{x:"55",y:"18",width:"18",height:"10",fill:a.accessory})]}):"moon"===c?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("rect",{x:"57",y:"14",width:"18",height:"18",fill:a.accessory}),(0,b.jsx)("rect",{x:"64",y:"12",width:"15",height:"19",fill:a.bodyTop}),(0,b.jsx)("rect",{x:"24",y:"37",width:"7",height:"18",fill:a.bodyDark}),(0,b.jsx)("rect",{x:"97",y:"37",width:"7",height:"18",fill:a.bodyDark})]}):"mushroom"===c?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("rect",{x:"31",y:"18",width:"66",height:"22",fill:a.bodyTop}),(0,b.jsx)("rect",{x:"42",y:"13",width:"44",height:"11",fill:a.bodyTop}),(0,b.jsx)("rect",{x:"45",y:"22",width:"9",height:"8",fill:a.accessory}),(0,b.jsx)("rect",{x:"73",y:"20",width:"10",height:"8",fill:a.accessory})]}):"spin"===c?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("rect",{x:"47",y:"17",width:"34",height:"9",fill:a.bodyLight}),(0,b.jsx)("rect",{x:"37",y:"24",width:"14",height:"8",fill:a.bodyLight}),(0,b.jsx)("rect",{x:"78",y:"24",width:"13",height:"8",fill:a.bodyLight}),(0,b.jsx)("rect",{x:"29",y:"31",width:"11",height:"7",fill:a.bodyLight})]}):"chomp"===c?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("rect",{x:"88",y:"48",width:"14",height:"8",fill:a.highlight}),(0,b.jsx)("rect",{x:"88",y:"60",width:"14",height:"8",fill:a.highlight})]}):"ghost"===c||"slime"===c?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("rect",{x:"44",y:"19",width:"40",height:"12",fill:a.bodyLight}),(0,b.jsx)("rect",{x:"36",y:"27",width:"56",height:"10",fill:a.bodyLight})]}):"cap"===c||"straw"===c?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("rect",{x:"34",y:"18",width:"58",height:"12",fill:"straw"===c?a.accessory:a.bodyTop}),(0,b.jsx)("rect",{x:"45",y:"12",width:"36",height:"10",fill:"straw"===c?a.accessory:a.bodyTop}),(0,b.jsx)("rect",{x:"58",y:"22",width:"14",height:"5",fill:"straw"===c?a.accent:a.accessory})]}):"bow"===c||"hood"===c?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("rect",{x:"76",y:"17",width:"13",height:"13",fill:a.accent}),(0,b.jsx)("rect",{x:"91",y:"17",width:"13",height:"13",fill:a.accent}),(0,b.jsx)("rect",{x:"88",y:"21",width:"7",height:"7",fill:a.accessory})]}):"mask"===c||"ninja"===c?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("rect",{x:"35",y:"25",width:"58",height:"8",fill:a.accent}),(0,b.jsx)("rect",{x:"48",y:"18",width:"12",height:"10",fill:a.accent}),(0,b.jsx)("rect",{x:"69",y:"18",width:"12",height:"10",fill:a.accent})]}):"soot"===c?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("rect",{x:"27",y:"25",width:"8",height:"8",fill:a.bodyLight}),(0,b.jsx)("rect",{x:"92",y:"23",width:"9",height:"9",fill:a.bodyLight}),(0,b.jsx)("rect",{x:"61",y:"12",width:"7",height:"7",fill:a.bodyLight})]}):"pearl"===c||"wand"===c?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("rect",{x:"58",y:"12",width:"13",height:"13",fill:a.accessory}),(0,b.jsx)("rect",{x:"61",y:"7",width:"7",height:"7",fill:a.accent}),(0,b.jsx)("rect",{x:"73",y:"17",width:"9",height:"9",fill:a.accent})]}):"mecha"===c?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("rect",{x:"29",y:"24",width:"12",height:"13",fill:a.accent}),(0,b.jsx)("rect",{x:"87",y:"24",width:"12",height:"13",fill:a.accent}),(0,b.jsx)("rect",{x:"51",y:"18",width:"27",height:"9",fill:a.accessory})]}):"ink"===c?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("rect",{x:"35",y:"19",width:"12",height:"16",fill:a.accent}),(0,b.jsx)("rect",{x:"56",y:"14",width:"14",height:"20",fill:a.accent}),(0,b.jsx)("rect",{x:"80",y:"19",width:"12",height:"16",fill:a.accent})]}):"drum"===c?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("rect",{x:"31",y:"27",width:"66",height:"7",fill:a.accent}),(0,b.jsx)("rect",{x:"41",y:"18",width:"46",height:"10",fill:a.accessory})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("rect",{x:"38",y:"30",width:"10",height:"4",fill:a.bodyLight}),(0,b.jsx)("rect",{x:"80",y:"30",width:"10",height:"4",fill:a.bodyDark})]})}function o({preset:a}){let c=a.feature;return(0,b.jsxs)(b.Fragment,{children:[a.facePatch?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("rect",{x:"40",y:"39",width:"48",height:"34",fill:a.facePatch}),(0,b.jsx)("rect",{x:"46",y:"73",width:"36",height:"10",fill:a.facePatch})]}):null,"bell"===c?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("rect",{x:"50",y:"74",width:"28",height:"6",fill:a.accent}),(0,b.jsx)("rect",{x:"58",y:"80",width:"13",height:"11",fill:a.accessory}),(0,b.jsx)("rect",{x:"61",y:"84",width:"7",height:"3",fill:a.eye})]}):null,"bolt"===c?(0,b.jsx)("rect",{x:"89",y:"76",width:"13",height:"8",fill:a.accent}):null,"chomp"===c?(0,b.jsx)("rect",{x:"72",y:"56",width:"22",height:"16",fill:a.highlight}):null,"ghost"===c?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("rect",{x:"28",y:"91",width:"12",height:"8",fill:a.bodyLight}),(0,b.jsx)("rect",{x:"52",y:"91",width:"12",height:"8",fill:a.bodyLight}),(0,b.jsx)("rect",{x:"76",y:"91",width:"12",height:"8",fill:a.bodyLight})]}):null,"drum"===c?(0,b.jsx)("rect",{x:"31",y:"55",width:"66",height:"8",fill:a.accessory}):null,"mecha"===c?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("rect",{x:"41",y:"35",width:"45",height:"6",fill:a.accent}),(0,b.jsx)("rect",{x:"57",y:"58",width:"14",height:"9",fill:a.accessory})]}):null,a.cheek?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("rect",{x:"36",y:"58",width:"8",height:"7",fill:a.cheek}),(0,b.jsx)("rect",{x:"86",y:"58",width:"8",height:"7",fill:a.cheek})]}):null]})}function p({preset:a,activityId:d,animated:e=!1,reacting:f=!1,shaken:g=!1,fainted:h=!1,eyeOffset:i}){return"monster"!==(a.shape??"monster")?(0,b.jsx)("g",{className:e?"cloud-code-monster-pet-character":void 0,children:(0,b.jsx)(c.Suspense,{fallback:null,children:(0,b.jsx)(l,{activityId:d,preset:a,reacting:f,shaken:g,fainted:h,eyeOffset:i})})}):(0,b.jsxs)("g",{className:e?"cloud-code-monster-pet-character":void 0,children:[(0,b.jsx)(n,{preset:a}),(0,b.jsx)("rect",{x:"32",y:"22",width:"64",height:"12",fill:a.bodyTop}),(0,b.jsx)("rect",{x:"24",y:"34",width:"80",height:"17",fill:a.bodyTop}),(0,b.jsx)("rect",{x:"16",y:"51",width:"12",height:"24",fill:a.body}),(0,b.jsx)("rect",{x:"24",y:"51",width:"80",height:"41",fill:a.body}),(0,b.jsx)("rect",{x:"100",y:"51",width:"12",height:"24",fill:a.body}),(0,b.jsx)("rect",{x:"16",y:"63",width:"12",height:"12",fill:a.bodyDark}),(0,b.jsx)("rect",{x:"30",y:"86",width:"68",height:"10",fill:a.bodyDark}),(0,b.jsx)("rect",{x:"34",y:"34",width:"60",height:"6",fill:a.bodyLight}),(0,b.jsx)("rect",{x:"24",y:"51",width:"9",height:"35",fill:a.bodySideLight}),(0,b.jsx)("rect",{x:"95",y:"51",width:"9",height:"35",fill:a.bodySideDark}),(0,b.jsx)(o,{preset:a}),(0,b.jsx)(m,{activityId:d,preset:a,reacting:f,shaken:g,fainted:h,eyeOffset:i}),(0,b.jsx)("rect",{x:"36",y:"69",width:"8",height:"8",fill:a.bodyLight}),(0,b.jsx)("rect",{x:"84",y:"69",width:"8",height:"8",fill:a.bodySideDark}),(0,b.jsx)("rect",{className:"cloud-code-monster-pet-left-foot",x:"29",y:"96",width:"12",height:"22",fill:a.body}),(0,b.jsx)("rect",{className:"cloud-code-monster-pet-left-foot",x:"52",y:"96",width:"12",height:"22",fill:a.body}),(0,b.jsx)("rect",{className:"cloud-code-monster-pet-right-foot",x:"76",y:"96",width:"12",height:"22",fill:a.bodyDark}),(0,b.jsx)("rect",{className:"cloud-code-monster-pet-right-foot",x:"96",y:"96",width:"12",height:"22",fill:a.bodyDark})]})}function q({preset:a,className:c}){return(0,b.jsxs)("svg",{className:c,viewBox:"0 0 128 128",role:"img","aria-label":`${a.name} pixel PET preset`,shapeRendering:"crispEdges",children:[(0,b.jsx)("rect",{x:"31",y:"116",width:"66",height:"5",fill:"rgba(45,40,36,.12)"}),(0,b.jsx)("rect",{x:"40",y:"121",width:"48",height:"3",fill:"rgba(45,40,36,.07)"}),(0,b.jsx)(p,{preset:a,activityId:null})]})}var r=a.i(76592),s=a.i(973111),t=a.i(272818),u=a.i(75118);a.s(["PetTab",0,function(){let[a,g]=(0,c.useState)(!1),[k,l]=(0,c.useState)(h[0].id),m=i(k);return(0,c.useEffect)(()=>{g((0,t.readHomePetSettings)().enabled),l(j());let a=a=>{let b=a.detail?.presetId;l(b?i(b).id:j())};return window.addEventListener(f,a),()=>{window.removeEventListener(f,a)}},[]),(0,b.jsxs)("div",{className:"space-y-8",children:[(0,b.jsxs)("section",{className:"space-y-4",children:[(0,b.jsx)("h2",{className:"text-sm font-medium",children:"Pet"}),(0,b.jsx)("div",{className:"space-y-4",children:(0,b.jsxs)("div",{className:"flex items-center justify-between gap-4",children:[(0,b.jsxs)("div",{className:"space-y-1",children:[(0,b.jsx)(r.Label,{htmlFor:"pet-enabled",className:"text-sm",children:"Enable pet"}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:"Off by default. Turn it on when you want the workspace companion."})]}),(0,b.jsx)(s.Switch,{id:"pet-enabled",checked:a,onCheckedChange:a=>{g(a),(0,t.writeHomePetSettings)({enabled:a})}})]})})]}),a?(0,b.jsxs)("section",{className:"space-y-4",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("h2",{className:"text-sm font-medium",children:"Preset"}),(0,b.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:m.name})]}),(0,b.jsx)("div",{className:"grid size-14 place-items-center rounded-md bg-card ring-1 ring-border/60",children:(0,b.jsx)(q,{preset:m,className:"size-11"})})]}),(0,b.jsx)("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-3",children:h.map(a=>{let c=a.id===m.id;return(0,b.jsxs)("button",{type:"button","aria-pressed":c,onClick:()=>{l(function(a){let b=i(a);if("u">typeof localStorage)try{localStorage.setItem(e,b.id)}catch{}return b.id}(a.id))},className:(0,u.cn)("group grid h-28 min-w-0 grid-rows-[1fr_auto] rounded-md border bg-card/60 p-2 text-left transition-all hover:border-foreground/20 hover:bg-accent/55 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/70",c?"border-primary/50 bg-accent text-foreground":"border-border/50 text-muted-foreground"),children:[(0,b.jsx)("div",{className:"grid place-items-center rounded bg-background/70 ring-1 ring-border/35",children:(0,b.jsx)(q,{preset:a,className:"size-14 transition-transform duration-200 group-hover:scale-105"})}),(0,b.jsxs)("div",{className:"mt-2 flex min-w-0 items-center justify-between gap-1 text-[10px] leading-none",children:[(0,b.jsx)("span",{className:"truncate font-medium text-foreground",children:a.name}),c?(0,b.jsx)(d,{className:"size-3 shrink-0 text-primary"}):(0,b.jsx)("span",{className:"shrink-0 text-muted-foreground",children:a.id.replace("pet-","#")})]})]},a.id)})})]}):null]})}],390946)},617168,a=>{"use strict";var b=a.i(229073),c=a.i(226058),d=a.i(752792),e=a.i(506180),f=a.i(25668);a.i(4338);var g=a.i(514746),h=a.i(439882),i=a.i(464830),j=a.i(967543),k=a.i(933338),l=a.i(101979),m=a.i(147479),n=a.i(661585);let o=(0,a.i(815624).default)("zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);function p({icon:a,label:c,value:d,sub:e}){return(0,b.jsx)(h.Card,{size:"sm",children:(0,b.jsxs)(h.CardContent,{className:"flex items-center gap-3",children:[(0,b.jsx)("div",{className:"flex size-9 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary",children:(0,b.jsx)(a,{className:"size-4"})}),(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between gap-1",children:[(0,b.jsx)("p",{className:"text-2xl font-semibold leading-none tracking-tight",children:d}),e&&(0,b.jsx)(i.Badge,{variant:"secondary",className:"text-[10px] px-2 h-4 font-normal",children:e})]}),(0,b.jsx)("p",{className:"mt-1 text-xs text-muted-foreground truncate",children:c})]})]})})}function q({agents:a,runtimes:c,activeTaskCounts:d,overview:e}){let f=new Map;for(let a of c){let b=a.daemon_id??a.id;f.set(b,f.get(b)||"online"===a.status)}let g=f.size,h=[...f.values()].filter(Boolean).length,i=Object.values(d).reduce((a,b)=>a+b,0),r=a.filter(a=>{let b=c.find(b=>b.id===a.runtime_id);return b?.status==="online"}).length;return(0,b.jsxs)("div",{className:"grid gap-3 grid-cols-2 sm:grid-cols-6",children:[(0,b.jsx)(p,{icon:n.Monitor,label:"Machines",value:`${h}/${g}`,sub:"online"}),(0,b.jsx)(p,{icon:j.Bot,label:"Agents",value:a.length,sub:`${r} online`}),(0,b.jsx)(p,{icon:m.Users,label:"Members",value:e.members.length,sub:e.pending_invites>0?`${e.pending_invites} pending`:void 0}),(0,b.jsx)(p,{icon:o,label:"Active Tasks",value:i,sub:e.task_stats.queued>0?`${e.task_stats.queued} queued`:void 0}),(0,b.jsx)(p,{icon:l.Send,label:"Emails Sent",value:e.email_stats.outbound,sub:`${e.email_stats.unread} unread`}),(0,b.jsx)(p,{icon:k.Mail,label:"Custom Emails",value:e.email_accounts.length})]})}function r({overview:a}){let{completed:c,failed:d,cancelled:e,queued:f,stale:g}=a.task_stats,i=c+d,j=i>0?(d/i*100).toFixed(1):"0";return(0,b.jsxs)(h.Card,{children:[(0,b.jsx)(h.CardHeader,{children:(0,b.jsx)(h.CardTitle,{children:"Task Health (Today)"})}),(0,b.jsx)(h.CardContent,{children:(0,b.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,b.jsx)(s,{label:"Completed",value:c}),(0,b.jsx)(s,{label:"Failed",value:d,className:d>0?"text-destructive":void 0}),(0,b.jsx)(s,{label:"Cancelled",value:e}),(0,b.jsx)(s,{label:"Failure Rate",value:`${j}%`,className:Number(j)>10?"text-destructive":void 0}),(0,b.jsx)(s,{label:"Queue Backlog",value:f,className:f>10?"text-amber-500":void 0}),(0,b.jsx)(s,{label:"Stale Tasks",value:g,className:g>0?"text-destructive":void 0})]})})]})}function s({label:a,value:c,className:d}){return(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:`text-xl font-semibold ${d??""}`,children:c}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:a})]})}var t=a.i(525132);function u({overview:a,agents:c}){let{inbound:d,outbound:e,unread:f,rejected:g}=a.email_stats,i=new Map(c.map(a=>[a.id,a.name]));return(0,b.jsxs)(h.Card,{children:[(0,b.jsx)(h.CardHeader,{children:(0,b.jsx)(h.CardTitle,{children:"Email Summary"})}),(0,b.jsxs)(h.CardContent,{className:"space-y-4",children:[(0,b.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"text-xl font-semibold",children:d}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:"Received"})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"text-xl font-semibold",children:e}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:"Sent"})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:`text-xl font-semibold ${f>0?"text-primary":""}`,children:f}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:"Unread"})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:`text-xl font-semibold ${g>0?"text-amber-500":""}`,children:g}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:"Untrust"})]})]}),a.email_accounts.length>0&&(0,b.jsxs)("div",{className:"space-y-2 pt-2 border-t border-border/50",children:[(0,b.jsx)("p",{className:"text-xs font-medium text-muted-foreground",children:"Custom Mailboxes"}),a.email_accounts.map(a=>(0,b.jsxs)("div",{className:"flex items-center justify-between gap-2 text-xs",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,b.jsxs)(t.Tooltip,{children:[(0,b.jsx)(t.TooltipTrigger,{render:(0,b.jsx)("span",{className:`size-1.5 shrink-0 rounded-full ${"active"===a.status?"bg-emerald-500":"bg-destructive"}`})}),(0,b.jsx)(t.TooltipContent,{side:"top",children:"active"===a.status?"Active":`Error: ${a.error_message||"inactive"}`})]}),(0,b.jsx)("span",{className:"truncate",children:a.email_address})]}),(0,b.jsx)("span",{className:"text-muted-foreground shrink-0",children:i.get(a.agent_id)??"—"})]},a.id))]})]})]})}var v=a.i(670209),w=a.i(445067);function x({runtimes:a,agents:c}){let d=(0,v.useRouter)(),{slug:f}=(0,e.useWorkspace)(),g=new Map;for(let b of a){let a=b.daemon_id??b.id;g.has(a)||g.set(a,{runtimes:[],deviceInfo:b.device_info??""}),g.get(a).runtimes.push(b)}let j=[...g.entries()];return 0===j.length?(0,b.jsxs)(h.Card,{children:[(0,b.jsxs)(h.CardHeader,{children:[(0,b.jsx)(h.CardTitle,{children:"Machines"}),(0,b.jsx)(h.CardAction,{children:(0,b.jsx)("button",{type:"button",onClick:()=>d.push(`/w/${f}/runtimes`),className:"text-muted-foreground hover:text-foreground transition-colors cursor-pointer",children:(0,b.jsx)(w.ArrowUpRight,{className:"size-4"})})})]}),(0,b.jsx)(h.CardContent,{children:(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:"No machines connected."})})]}):(0,b.jsxs)(h.Card,{children:[(0,b.jsx)(h.CardHeader,{children:(0,b.jsx)(h.CardTitle,{children:"Machines"})}),(0,b.jsx)(h.CardContent,{className:"space-y-3",children:j.map(([a,d])=>{let e=d.runtimes.some(a=>"online"===a.status),f=d.runtimes.map(a=>a.last_seen_at).filter(Boolean).sort().reverse()[0],g=c.filter(a=>d.runtimes.some(b=>b.id===a.runtime_id)),h=d.runtimes.some(a=>a.pending_update_version),j=d.runtimes.find(a=>a.pending_update_version)?.pending_update_version;return(0,b.jsxs)("div",{className:"flex items-start gap-3 text-xs",children:[(0,b.jsxs)(t.Tooltip,{children:[(0,b.jsx)(t.TooltipTrigger,{render:(0,b.jsx)("span",{className:`mt-1 size-2 shrink-0 rounded-full ${e?"bg-emerald-500":"bg-muted-foreground/30"}`})}),(0,b.jsx)(t.TooltipContent,{side:"top",children:e?"Online":"Offline"})]}),(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)("span",{className:"font-medium truncate",children:d.deviceInfo||a.slice(0,12)}),h&&(0,b.jsxs)(t.Tooltip,{children:[(0,b.jsx)(t.TooltipTrigger,{render:(0,b.jsx)("span",{children:(0,b.jsx)(i.Badge,{variant:"outline",className:"text-[10px] px-2 py-0 text-amber-500 border-amber-500/30",children:"update"})})}),(0,b.jsxs)(t.TooltipContent,{side:"top",children:["Pending update to v",j]})]})]}),(0,b.jsxs)("div",{className:"text-muted-foreground mt-1",children:[g.length>0?g.map(a=>a.name).join(", "):"No agents"," · ",function(a){if(!a)return"never";let b=Math.floor((Date.now()-new Date(a).getTime())/1e3);if(b<60)return`${b}s ago`;let c=Math.floor(b/60);if(c<60)return`${c}m ago`;let d=Math.floor(c/60);return d<24?`${d}h ago`:`${Math.floor(d/24)}d ago`}(f??null)]})]})]},a)})})]})}var y=a.i(377447),z=a.i(66957);function A({overview:a}){let c=(0,v.useRouter)(),{slug:d}=(0,e.useWorkspace)(),{members:f,pending_invites:g}=a;return(0,b.jsxs)(h.Card,{children:[(0,b.jsxs)(h.CardHeader,{children:[(0,b.jsx)(h.CardAction,{children:(0,b.jsx)("button",{type:"button",onClick:()=>c.push(`/w/${d}/settings`),className:"text-muted-foreground hover:text-foreground transition-colors cursor-pointer",children:(0,b.jsx)(w.ArrowUpRight,{className:"size-4"})})}),(0,b.jsxs)(h.CardTitle,{children:["Team",g>0&&(0,b.jsxs)("span",{className:"ml-2 text-xs text-muted-foreground font-normal",children:["(",g," pending invite",g>1?"s":"",")"]})]})]}),(0,b.jsx)(h.CardContent,{className:"p-0",children:(0,b.jsx)("div",{className:"divide-y divide-border/50",children:[...f].sort((a,b)=>"owner"===a.role?-1:+("owner"===b.role)).map(a=>(0,b.jsxs)("div",{className:"flex items-center gap-3 px-4 py-2",children:[a.image?(0,b.jsx)("img",{src:a.image,alt:a.name,className:"size-7 rounded-full shrink-0"}):(0,b.jsx)("div",{className:"flex size-7 shrink-0 items-center justify-center rounded-full bg-secondary text-xs font-medium",children:(0,z.avatarInitial)((0,y.displayName)(a))}),(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,b.jsx)("span",{className:"text-sm font-medium truncate block",children:(0,y.displayName)(a)}),a.name&&(0,b.jsx)("span",{className:"text-xs text-muted-foreground truncate block",children:a.email})]}),(0,b.jsx)(i.Badge,{variant:"owner"===a.role?"default":"secondary",className:"text-[10px] px-2 py-0 shrink-0",children:a.role})]},a.id))})})]})}a.s(["UsagesTab",0,function(){let{agents:a,runtimes:h,loading:i,activeTaskCounts:j}=(0,d.useAgentContext)(),{workspaceId:k}=(0,e.useWorkspace)(),[l,m]=(0,c.useState)(null),[n,o]=(0,c.useState)(!1);return((0,c.useEffect)(()=>{if(i)return;let a=!1;return o(!0),(0,g.getWorkspaceOverview)(k).then(b=>{a||m(b)}).catch(()=>{}).finally(()=>{a||o(!1)}),()=>{a=!0}},[i,k]),n||!l)?(0,b.jsxs)("div",{className:"space-y-4",children:[(0,b.jsx)(f.Skeleton,{className:"h-44 rounded-xl"}),(0,b.jsx)(f.Skeleton,{className:"h-44 rounded-xl"}),(0,b.jsx)(f.Skeleton,{className:"h-44 rounded-xl"}),(0,b.jsx)(f.Skeleton,{className:"h-44 rounded-xl"})]}):(0,b.jsxs)("div",{className:"space-y-4",children:[(0,b.jsx)(q,{agents:a,runtimes:h,activeTaskCounts:j,overview:l}),(0,b.jsxs)("div",{className:"grid gap-4 lg:grid-cols-2",children:[(0,b.jsx)(r,{overview:l}),(0,b.jsx)(u,{overview:l,agents:a})]}),(0,b.jsxs)("div",{className:"grid gap-4 lg:grid-cols-2",children:[(0,b.jsx)(x,{runtimes:h,agents:a}),(0,b.jsx)(A,{overview:l})]})]})}],617168)},294526,a=>a.a(async(b,c)=>{try{var d=a.i(229073),e=a.i(226058),f=a.i(654461),g=a.i(75118),h=a.i(597047),i=a.i(53909),j=a.i(616131),k=a.i(93590),l=a.i(390946),m=a.i(617168),n=b([h,j]);[h,j]=n.then?(await n)():n;let o=[{id:"general",label:"General"},{id:"pet",label:"Pet"},{id:"instruction",label:"Global Instruction"},{id:"notifications",label:"Notifications"},{id:"members",label:"Members"},{id:"usages",label:"Usages"}];a.s(["default",0,function(){let[a,b]=(0,e.useState)("general");return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"flex items-center justify-between border-b border-border/50 px-3 sm:px-4 py-2 gap-3",children:(0,d.jsx)("div",{className:"flex items-center gap-3 min-w-0",children:(0,d.jsx)("h1",{className:"text-sm font-medium",children:"Settings"})})}),(0,d.jsxs)("div",{className:"flex flex-1 min-h-0",children:[(0,d.jsxs)("nav",{className:"w-48 shrink-0 border-r border-border/50 py-3 px-2 hidden sm:flex sm:flex-col",children:[(0,d.jsx)("div",{className:"flex-1",children:o.map(c=>(0,d.jsx)("button",{onClick:()=>b(c.id),className:(0,g.cn)("w-full rounded-md px-2 py-2 text-left text-sm transition-colors",a===c.id?"bg-accent text-foreground font-medium":"text-muted-foreground hover:bg-accent/50 hover:text-foreground"),children:c.label},c.id))}),(0,d.jsxs)("div",{className:"px-2 pt-3 border-t border-border/50 text-[11px] text-muted-foreground/60",children:["v","0.0.154"]})]}),(0,d.jsxs)("div",{className:"flex-1 min-w-0 flex flex-col",children:[(0,d.jsx)("div",{className:"px-4 pt-2 sm:hidden",children:(0,d.jsx)(f.Tabs,{className:"items-center",value:a,onValueChange:a=>b(a),children:(0,d.jsx)(f.TabsList,{className:"h-auto gap-1",children:o.map(a=>(0,d.jsx)(f.TabsTrigger,{value:a.id,children:a.label},a.id))})})}),(0,d.jsx)("div",{className:(0,g.cn)("flex-1 overflow-y-auto thin-scrollbar","instruction"!==a&&"px-4 py-4"),children:"instruction"===a?(0,d.jsx)(i.InstructionTab,{}):"usages"===a?(0,d.jsx)(m.UsagesTab,{}):(0,d.jsxs)("div",{className:"mx-auto max-w-md",children:["general"===a&&(0,d.jsx)(h.GeneralTab,{}),"pet"===a&&(0,d.jsx)(l.PetTab,{}),"notifications"===a&&(0,d.jsx)(k.NotificationTab,{}),"members"===a&&(0,d.jsx)(j.MembersTab,{})]})}),(0,d.jsxs)("div",{className:"px-4 py-2 text-[11px] text-muted-foreground/60 sm:hidden",children:["v","0.0.154"]})]})]})]})}]),c()}catch(a){c(a)}},!1)];
|
|
2
2
|
|
|
3
3
|
//# sourceMappingURL=src_web_src_app_%28app%29_w_%5Bslug%5D_settings_0ag2edj._.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
module.exports=[415694,a=>{"use strict";var b=a.i(229073),c=a.i(226058),d=a.i(670209),e=a.i(780956),f=a.i(487154),g=a.i(586220),h=a.i(686963),i=a.i(32006),j=a.i(633088),k=a.i(194102),l=a.i(466199),m=a.i(256944),n=a.i(17615),o=a.i(74720),p=a.i(445067),q=a.i(131033),r=a.i(785320),s=a.i(246661),t=a.i(561238),u=a.i(25668),v=a.i(881025),w=a.i(66957),x=a.i(708343),y=a.i(586889);function z({parentMessageId:a,onOpenProfile:c,onPreviewImage:d,onDownloadFile:e,onJump:g}){let h,i,{message:j,isLoading:k,isError:l}=(h=!!a,{...i=(0,x.useQuery)({queryKey:h?y.communityKeys.message(a):y.communityKeys.message("__none__"),queryFn:h?()=>(0,f.apiFetch)(`/api/community/messages/${a}`):()=>Promise.reject(Error("disabled")),enabled:h,staleTime:3e4}),message:i.data??null});if(k)return(0,b.jsx)(A,{});if(l||!j)return(0,b.jsxs)("div",{children:[(0,b.jsxs)("div",{className:"mb-2 flex items-center gap-2 text-xs font-medium text-muted-foreground",children:[(0,b.jsx)(m.MessagesSquare,{className:"size-3.5"}),(0,b.jsx)("span",{children:"Thread started from a message"})]}),(0,b.jsx)("p",{className:"text-sm italic text-muted-foreground",children:"Original message is unavailable."})]});let u=j.authorAvatar||(0,w.avatarInitial)(j.authorName);return(0,b.jsxs)("div",{className:"group relative",children:[(0,b.jsxs)("div",{className:"mb-2 flex items-center gap-2 text-xs font-medium text-muted-foreground",children:[(0,b.jsx)(m.MessagesSquare,{className:"size-3.5"}),(0,b.jsx)("span",{children:"Thread started from"})]}),g&&(0,b.jsxs)("button",{type:"button",onClick:g,className:"absolute right-0 top-0 flex h-7 items-center gap-1 rounded-md px-2 text-xs font-medium text-muted-foreground opacity-0 transition-opacity hover:bg-accent hover:text-foreground focus-visible:opacity-100 focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none group-hover:opacity-100","aria-label":"Jump to message",title:"Jump to message",children:[(0,b.jsx)(p.ArrowUpRight,{className:"size-3.5"}),"Jump"]}),(0,b.jsxs)("div",{className:"flex gap-3",children:[(0,b.jsx)("button",{onClick:a=>c?.(j.authorName,a,void 0,j.authorId),className:"shrink-0 self-start",children:(0,b.jsx)(q.Avatar,{label:u,seed:j.authorId,size:40})}),(0,b.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,b.jsxs)("div",{className:"flex items-baseline gap-2",children:[(0,b.jsx)("button",{onClick:a=>c?.(j.authorName,a,void 0,j.authorId),className:"text-[15px] font-semibold hover:underline",children:j.authorName}),(0,b.jsx)("span",{className:"text-xs text-muted-foreground",suppressHydrationWarning:!0,children:(0,t.formatMessageTime)(j.createdAt)})]}),j.content&&(0,b.jsx)(r.MessageBody,{text:j.content,onOpenProfile:c}),j.attachments&&j.attachments.length>0&&(0,b.jsx)("div",{className:"mt-2 flex flex-col gap-2 pb-2",children:j.attachments.map((a,c)=>"image"===a.kind?(0,b.jsx)("button",{onClick:()=>d?.(a.url),className:"block w-fit max-w-[320px] overflow-hidden rounded-lg border border-border transition-colors hover:border-primary/40",children:(0,b.jsx)("img",{src:a.url,alt:a.name,className:"max-h-50 max-w-[320px] rounded-lg object-contain",style:{aspectRatio:(0,s.attachmentAspectRatio)(a.width,a.height)}})},c):(0,b.jsxs)("button",{onClick:()=>e?.(a.url),className:"flex w-full max-w-[320px] items-center gap-3 rounded-lg border border-border bg-card p-2 text-left transition-colors hover:bg-accent",children:[(0,b.jsx)(n.FileText,{className:"size-7 shrink-0 text-muted-foreground"}),(0,b.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,b.jsx)("div",{className:"truncate text-sm font-medium text-primary",children:a.name}),"size"in a&&a.size&&(0,b.jsx)("div",{className:"text-xs text-muted-foreground",children:a.size})]}),(0,b.jsx)(o.Download,{className:"size-4 shrink-0 text-muted-foreground"})]},c))}),j.reactions&&j.reactions.length>0&&(0,b.jsx)("div",{className:"mt-2 flex flex-wrap gap-1",children:j.reactions.map((a,c)=>(0,b.jsxs)("span",{className:["flex h-6 items-center gap-1 rounded-full px-2 text-sm",a.me?"border border-primary/50 bg-accent":"bg-secondary"].join(" "),children:[(0,b.jsx)("span",{children:a.emoji}),(0,b.jsx)(v.NumberTicker,{value:a.count,className:"text-xs text-muted-foreground"})]},c))})]})]})]})}function A(){return(0,b.jsxs)("div",{children:[(0,b.jsx)(u.Skeleton,{className:"mb-2 h-3 w-32 rounded"}),(0,b.jsxs)("div",{className:"flex gap-3",children:[(0,b.jsx)(u.Skeleton,{className:"size-10 shrink-0 rounded-full"}),(0,b.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-2 pt-0.5",children:[(0,b.jsx)(u.Skeleton,{className:"h-4 w-32 rounded"}),(0,b.jsx)(u.Skeleton,{className:"h-3.5 w-full max-w-80 rounded"}),(0,b.jsx)(u.Skeleton,{className:"h-3.5 w-48 rounded"})]})]})]})}var B=a.i(379764);a.i(897046);var C=a.i(519116);a.i(974936);var D=a.i(425712),E=a.i(377447),F=a.i(437253),G=a.i(669991),H=a.i(208847),I=a.i(258365),J=a.i(128824),K=a.i(981498),L=a.i(364870);let M=Object.freeze([]);var N=a.i(333552),O=a.i(412118),P=a.i(267017),Q=a.i(491443),R=a.i(606617);a.i(735042);var S=a.i(705021),T=a.i(192378),U=a.i(15841),V=a.i(333701),W=a.i(510828);function X(){let a,m,n,o,p,q=(0,d.useParams)(),r=(0,d.useRouter)(),s=(0,d.useSearchParams)(),t=decodeURIComponent(q.serverId),u=q.channelId,[v]=(0,c.useState)(()=>s.get("msg")),A=(0,g.useBreakpoint)(),X=(0,G.useCurrentUser)(),Y=(0,F.useUiHandlers)(),Z=(0,F.useCurrentChannelId)(),$=(0,F.useCurrentChannelMeta)(),{server:_}=(0,H.useServer)(t),aa=(0,I.useServerMembers)(t),ab=(0,R.useOnlineUserIds)(),ac=(0,R.useCommunityWsStore)(a=>a.userStatuses),ad=(0,c.useMemo)(()=>aa.members.map(a=>{let b=ac.get(a.userId);return{...a,status:(0,D.resolveRowPresence)(a,ab,X.id),statusEmoji:b?b.emoji:a.statusEmoji,statusText:b?b.text:a.statusText}}),[aa.members,ab,X.id,ac]),ae=(0,c.useMemo)(()=>(_?.categories?.flatMap(a=>a.channels)??[]).find(a=>a.id===u)??null,[_,u]),af=(0,C.isForum)(ae?.type),ag=!ae&&!!_?.categories,ah=ag&&!!$?.parentMessageId,[ai,aj]=(0,c.useState)(""),[ak,al]=(0,c.useState)(!1),am=(0,c.useMemo)(()=>{let a=_?.categories??[],b=ag?$?.parentChannelId??u:u,c=a.find(a=>a.channels.some(a=>a.id===b));return!!c?.private},[_,ag,$,u]),an=(0,J.useChannelMembers)(u,am&&!ah),ao=function(a,b=!0){let c=(0,x.useQuery)({queryKey:y.communityKeys.threadParticipants(a),queryFn:()=>(0,f.apiFetch)(`/api/community/channels/${encodeURIComponent(a)}/participants`),enabled:b&&!!a});return{...c,participants:c.data?.participants??M}}(u,ah),ap=(a=(0,L.useQueryClient)(),(0,K.useMutation)({mutationFn:a=>(0,f.apiFetch)(`/api/community/channels/${encodeURIComponent(u)}/participants/${encodeURIComponent(a)}`,{method:"DELETE"}),onSuccess:()=>{a.invalidateQueries({queryKey:y.communityKeys.threadParticipants(u)})}})),aq=(m=(0,L.useQueryClient)(),(0,K.useMutation)({mutationFn:a=>(0,f.apiFetch)(`/api/community/channels/${encodeURIComponent(u)}/participants`,{method:"POST",body:JSON.stringify({userId:a})}),onSuccess:()=>{m.invalidateQueries({queryKey:y.communityKeys.threadParticipants(u)})}})),ar=(0,J.useAddableMembers)(u,am&&!ah),as=(0,J.useAddChannelMember)(u),at=(0,J.useRemoveChannelMember)(u),au=ah?$?.parentChannelId??null:null,av=(0,J.useChannelMembers)(au??"",!!au),aw=(0,c.useMemo)(()=>{let a=ai.trim().toLowerCase(),b=a=>{let b=ac.get(a.userId);return{id:a.userId,userId:a.userId,name:a.name,discriminator:a.discriminator,avatar:a.avatar,sub:"",role:"member",status:(0,D.resolveRowPresence)(a,ab,X.id),statusEmoji:b?b.emoji:a.statusEmoji??null,statusText:b?b.text:a.statusText??"",isCreator:a.isCreator,source:a.source}},c=(b,c)=>!a||b.toLowerCase().includes(a)||(c??"").toLowerCase().includes(a);if(ah){let a=$?.creatorId;return ao.participants.filter(a=>c(a.name??"",a.discriminator)).map(c=>b({userId:c.userId,name:(0,E.displayName)(c),discriminator:c.discriminator??void 0,avatar:c.avatar,isCreator:c.userId===a}))}return am?an.members.filter(a=>c(a.name,a.discriminator)).map(a=>b(a)):ad},[ah,ao.participants,$,am,ad,an.members,ai,ab,X.id,ac]),ax=(0,c.useMemo)(()=>am?(ah?av.members:an.members).filter(a=>a.userId!==X.id).map(a=>{let b=ac.get(a.userId);return{...a,status:(0,D.resolveRowPresence)(a,ab,X.id),statusEmoji:b?b.emoji:a.statusEmoji,statusText:b?b.text:a.statusText}}):ad.filter(a=>a.userId!==X.id),[am,ah,ad,an.members,av.members,ab,X.id,ac]),ay=(0,c.useMemo)(()=>(_?.categories?.flatMap(a=>a.channels)??[]).map(a=>({id:a.id,name:a.name,serverId:t,serverName:_?.name??""})),[_,t]),{snapshot:az,isFetching:aA}=(n=(0,x.useQuery)({queryKey:u?y.communityKeys.channelReadStateSnapshot(u):["community","channel","__none__","read-state-snapshot"],queryFn:async()=>(0,f.apiFetch)(`/api/community/channels/${u}/read-state`),enabled:!!u,staleTime:1/0,gcTime:0,refetchOnMount:"always",refetchOnWindowFocus:!1,refetchOnReconnect:!1,retry:1}),o=(0,c.useRef)(null),(p=(0,c.useRef)(u)).current!==u&&(o.current=null,p.current=u),(0,c.useEffect)(()=>{null===o.current&&n.data&&(o.current=n.data)},[n.data]),{snapshot:o.current??n.data??null,isFetching:n.isFetching}),{messages:aB,isLoading:aC,hasMoreOlder:aD,hasMoreNewer:aE,isFetchingOlder:aF,isFetchingNewer:aG,fetchOlder:aH,fetchNewer:aI,jumpToPresent:aJ,latestSeq:aK}=(0,N.useMessages)(u,{lastReadMessageId:aA?void 0:az?.lastReadMessageId??null,anchorMessageId:v}),{newDividerBefore:aL,anchorFound:aM}=(0,c.useMemo)(()=>{if(!az)return{newDividerBefore:void 0,anchorFound:!1};let a=az.lastReadMessageId;if(!a){for(let a of aB)if(a.authorId!==X.id)return{newDividerBefore:a.id,anchorFound:!0};return{newDividerBefore:void 0,anchorFound:!0}}let b=aB.findIndex(b=>b.id===a);if(-1===b)return{newDividerBefore:void 0,anchorFound:!1};for(let a=b+1;a<aB.length;a++)if(aB[a].authorId!==X.id)return{newDividerBefore:aB[a].id,anchorFound:!0};return{newDividerBefore:void 0,anchorFound:!0}},[aB,az,X.id]),[aN,aO]=(0,c.useState)(null);!function({channelId:a,messages:b,scrollRootEl:d}){let e=(0,G.useCurrentUser)().id,f=(0,O.useAdvanceChannelWatermark)(),g=(0,c.useRef)(null);(0,c.useEffect)(()=>{g.current=null},[a]);let h=(0,c.useRef)(b),i=(0,c.useRef)(f);(0,c.useEffect)(()=>{h.current=b,i.current=f}),(0,c.useEffect)(()=>{if(!a||!d||"u"<typeof IntersectionObserver)return;let b=new IntersectionObserver(b=>{for(let c of b){if(!c.isIntersecting||c.intersectionRatio<.2)continue;let b=c.target.dataset.msgId;if(!b)continue;let d=h.current.find(a=>a.id===b);if(!d||!d.createdAt||d.authorId&&d.authorId===e)continue;let f=g.current;(!f||d.createdAt>f.createdAt||d.createdAt===f.createdAt&&b>f.id)&&(g.current={createdAt:d.createdAt,id:b},i.current(a,b))}},{root:d,threshold:.2});d.querySelectorAll("[data-msg-id]").forEach(a=>b.observe(a));let c=null;return"u">typeof MutationObserver&&(c=new MutationObserver(a=>{for(let c of a)c.addedNodes.forEach(a=>{1!==a.nodeType||(a.matches?.("[data-msg-id]")&&b.observe(a),a.querySelectorAll?.("[data-msg-id]").forEach(a=>b.observe(a)))})})).observe(d,{childList:!0,subtree:!0}),()=>{b.disconnect(),c?.disconnect()}},[a,b,d,e]),(0,c.useEffect)(()=>()=>{(0,O.flushPendingReads)()},[a])}({channelId:u,messages:aB,scrollRootEl:aN}),function({channelId:a,isChildChannel:b,snapshotReady:d}){let e=(0,L.useQueryClient)(),g=(0,c.useRef)(null);(0,c.useEffect)(()=>{if(!a||!d||g.current===a)return;g.current=a;let c=b?`/api/community/threads/${a}/read`:`/api/community/channels/${a}/read`;(0,f.apiFetch)(c,{method:"PUT"}).then(()=>{e.invalidateQueries({queryKey:y.communityKeys.inbox()}),e.invalidateQueries({queryKey:y.communityKeys.servers()})}).catch(()=>{})},[a,b,d,e])}({channelId:u,isChildChannel:ag,snapshotReady:!aA});let aP=(0,c.useMemo)(()=>{let a=aK-(az?.lastReadSeq??0);return a>0?a:0},[aK,az]),{threads:aQ,isLoading:aR}=(0,P.useThreads)(u),{posts:aS,isLoading:aT}=(0,P.useForumPosts)(u,af),{pins:aU,isLoading:aV}=(0,P.usePins)(u),aW=(0,Q.useNotificationSettings)().channel,aX=(0,F.useCommunityStore)(a=>a.typingUsers),aY=(0,O.useSendMessage)(),aZ=(0,O.useToggleReactionApi)(),a$=(0,O.usePinMessage)(),a_=(0,O.useUnpinMessage)(),a0=(0,O.useCreateThread)(),a1=(0,S.useCreateForumPost)(),a2=(0,T.useSetMemberRole)(),a3=(0,T.useKickMember)(),a4=(0,U.useSetChannelNotif)(),a5=(0,V.useUploadFile)(),a6=(0,c.useCallback)(()=>{Y.goBackMobile?.()},[Y]);(0,c.useEffect)(()=>(F.useCommunityStore.getState().setCurrentChannelId(u),()=>{F.useCommunityStore.getState().setCurrentChannelId(null)}),[u]),(0,c.useEffect)(()=>{if(u)return(0,W.communityWsSubscribe)({channelId:u}),ag?(0,f.apiFetch)(`/api/community/threads/${u}`).then(a=>F.useCommunityStore.getState().setCurrentChannelMeta({name:a.name,parentChannelId:a.parentChannelId,parentMessageId:a.parentMessageId,creatorId:a.creatorId})).catch(a=>{F.useCommunityStore.getState().setCurrentChannelMeta(null),(0,f.toastApiError)(a,"Failed to load thread")}):F.useCommunityStore.getState().setCurrentChannelMeta(null),()=>{(0,W.communityWsUnsubscribe)()}},[u,ag]);let[a7,a8]=(0,c.useState)(null),[a9,ba]=(0,c.useState)(null),[bb,bc]=(0,c.useState)(null),[bd,be]=(0,c.useState)(""),[bf,bg]=(0,c.useState)([]),[bh,bi]=(0,c.useState)(v);(0,c.useEffect)(()=>{v&&r.replace(`/community/channels/${q.serverId}/${u}`,{scroll:!1})},[]),(0,c.useEffect)(()=>{if(bh){if(aB.some(a=>a.id===bh)){let a=setTimeout(()=>bi(a=>a===bh?null:a),1600);return()=>clearTimeout(a)}aC||aF||aG||bi(a=>a===bh?null:a)}},[bh,aB,aC,aF,aG]),(0,c.useEffect)(()=>{ba(null),a8(null),be(""),bg([]),bc(null),aj(""),al(!1)},[u]);let bj=(0,c.useCallback)(async a=>{if(be(a),!a.trim())return void bg([]);try{let b=new URLSearchParams({q:a});b&&b.set("channelId",u);let c=await (0,f.apiFetch)(`/api/community/search?${b}`);bg(c.results.map(a=>({id:a.message.id,type:"chat",authorName:a.author.name,authorAvatar:a.author.image??(0,w.avatarInitial)(a.author.name),content:a.message.content,createdAt:a.message.createdAt})))}catch(a){bg([]),(0,f.toastApiError)(a,"Search failed")}},[u]),bk=(0,c.useMemo)(()=>{if(bb)return bb;if(ae)return ae.name;if($?.name)return $.name;let a=aS.find(a=>a.id===u);if(a)return a.name;let b=aQ.find(a=>a.id===u);return b?b.name:"channel"},[bb,ae,aS,aQ,$,u]),bl=(0,c.useMemo)(()=>new Set(aU.map(a=>a.id)),[aU]),bm=a=>a8(b=>b===a?null:a),bn=a=>{r.push(`/community/channels/${q.serverId}/${a}`)},bo=(a,b,c,d)=>{Y.openProfile?.(a,b,c,d)},bp=(0,c.useCallback)(async(a,b)=>{try{return await aY.mutateAsync({channelId:u,content:a,replyToId:b?.replyToId,mentionType:b?.mentionType,attachments:b?.attachments,author:{id:X.id,name:X.name,avatar:X.avatar}})}catch{return null}},[aY,u,X.id,X.name,X.avatar]),bq={onToggleReaction:(a,b)=>aZ({channelId:u,messageId:a,emoji:b,userId:X.id}),onReact:(a,b)=>aZ({channelId:u,messageId:a,emoji:b,userId:X.id}),onReply:a=>{let b=aB.find(b=>b.id===a);b&&ba({id:b.id,authorName:b.authorName??"",text:b.content??""})},onPin:a=>{bl.has(a)?a_.mutate({channelId:u,messageId:a},{onSuccess:()=>(0,e.toast)("Message unpinned"),onError:a=>(0,f.toastApiError)(a,"Failed to unpin message")}):(a$.mutate({channelId:u,messageId:a},{onSuccess:()=>(0,e.toast)("Message pinned"),onError:a=>(0,f.toastApiError)(a,"Failed to pin message")}),a8("pinned"))},onCreateThread:async a=>{let b=aB.find(b=>b.id===a),c=(b?.content??bk).split(/\s+/).slice(0,6).join(" ").slice(0,60)||bk;try{let b=await a0.mutateAsync({channelId:u,messageId:a,name:c});r.push(`/community/channels/${q.serverId}/${b.id}`)}catch(a){(0,f.toastApiError)(a,"Failed to create thread")}},onCopy:a=>{let b=aB.find(b=>b.id===a);b?.content&&(navigator.clipboard?.writeText(b.content),(0,e.toast)("Copied to clipboard"))},onRetry:a=>{let b=aB.find(b=>b.id===a);b?.content&&bp(b.content)},onPreviewImage:a=>{Y.previewImage?.(a)},onDownloadFile:a=>{let b=document.createElement("a");b.href=a,b.download=a.split("/").pop()??"file",b.click()}},br={...bq,onCreateThread:void 0},bs=(0,c.useMemo)(()=>(0,E.makeUserNameResolver)(ad),[ad]),bt=async(a,b,c)=>{if(!a&&!b?.length)return;let d=[];if(b?.length){let a=await Promise.all(b.map(a=>a5.mutateAsync({target:{channelId:u},file:a.file}).catch(a=>((0,f.toastApiError)(a,"Failed to attach file"),null))));d=(0,V.zipUploadResultsWithDimensions)(a,b)}bp(a||"",{replyToId:a9?.id,mentionType:c,attachments:d.length>0?d:void 0}),(0,W.communityWsResetTypingThrottle)({channelId:u}),ba(null)},bu=()=>{(0,W.communityWsSendTyping)({channelId:u})},bv=ad.find(a=>a.userId===X.id)?.role,bw=ag?$?.creatorId:ae?.creatorId,bx=!!bw&&bw===X.id,by=ah||am&&!af,bz=ah||am,bA=bz&&!af?{viewerUserId:X.id,viewerIsCreator:bx,onLeave:a=>(ah?ap:at).mutate(a,{onError:a=>(0,f.toastApiError)(a,"Failed to leave")}),onRemove:a=>(ah?ap:at).mutate(a,{onError:a=>(0,f.toastApiError)(a,"Failed to remove")})}:void 0,bB={onOpenThread:bn,members:aw,membersLoading:ah?ao.isLoading:am?an.isLoading:aa.loading,membersLoadingMore:!bz&&aa.loadingMore,membersHasMore:!bz&&aa.hasMore,onLoadMoreMembers:bz?void 0:aa.loadMore,onSearchMembers:bz?aj:aa.searchMembers,onAddMember:by?()=>al(!0):void 0,manageContext:bA,pinned:aU,pinnedLoading:aV,searchResults:bf,threads:aQ,threadsLoading:aR,searchQuery:bd,myRole:bv,onSearch:bj,onSetRole:(a,b)=>{a2.mutate({serverId:t,memberId:a,role:b},{onSuccess:()=>(0,e.toast)("Role updated"),onError:a=>(0,f.toastApiError)(a,"Failed to update role")})},onKickMember:a=>{a3.mutate({serverId:t,memberId:a},{onSuccess:()=>(0,e.toast)("Member kicked"),onError:a=>(0,f.toastApiError)(a,"Failed to kick member")})},onJumpToMessage:a=>{bi(a),setTimeout(()=>bi(null),100)}},bC=(()=>{if(!ak)return null;if(ah){let a=new Set(ao.participants.map(a=>a.userId)),c=av.members.filter(b=>!a.has(b.userId)&&b.userId!==X.id).map(a=>({userId:a.userId,name:a.name??null,avatar:a.avatar}));return(0,b.jsx)(B.AddMembersDialog,{title:`Add participants to /${$?.name??bk}`,subtitle:"Added people are notified of new replies. Anyone with access can already read the thread.",candidates:c,addPending:aq.isPending,onAdd:async a=>{await aq.mutateAsync(a)},onClose:()=>al(!1)})}let a=ar.members.map(a=>({userId:a.userId,name:a.name??null,avatar:a.avatar}));return(0,b.jsx)(B.AddMembersDialog,{title:`Add members to /${bk}`,subtitle:"Added members can see and post in this channel.",candidates:a,addPending:as.isPending,onAdd:async a=>{await as.mutateAsync(a)},onClose:()=>al(!1)})})(),bD=!ae&&!!_?.categories,bE=af?aT:aC;if(!(Z===u&&!bE&&(!bD||null!==$)))return af?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(h.ChannelHeaderSkeleton,{onBack:"mobile"===A?a6:void 0}),(0,b.jsx)("main",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:(0,b.jsx)(k.ForumViewSkeleton,{})})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(h.ChannelHeaderSkeleton,{onBack:"mobile"===A?a6:void 0}),(0,b.jsxs)("main",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:[(0,b.jsx)(i.MessageList,{channel:"",messages:[],loading:!0,onOpenThread:()=>{}},u),(0,b.jsx)(j.ComposerSkeleton,{})]})]});if(ag){let a=$?.parentChannelId,c=$?.parentMessageId??null,d=_?.categories?.flatMap(a=>a.channels)??[],e=a?d.find(b=>b.id===a):null,g=e?.name??"channel",k=c?(0,b.jsx)(z,{parentMessageId:c,onOpenProfile:bo,onPreviewImage:a=>Y.previewImage?.(a),onDownloadFile:a=>{let b=document.createElement("a");b.href=a,b.download=a.split("/").pop()??"file",b.click()},onJump:a?()=>r.push(`/community/channels/${q.serverId}/${a}?msg=${c}`):void 0}):void 0;return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(h.ChannelHeader,{channel:g,forum:(0,C.isForum)(e?.type),rightPanel:a7,onToggle:bm,onBack:"mobile"===A?()=>r.back():void 0,server:"mobile"===A&&_?{id:_.id,name:_.name,icon:_.icon}:void 0,tools:{threads:!1},breadcrumb:{label:bk,onNavigateBack:()=>{a?r.push(`/community/channels/${q.serverId}/${a}`):r.back()},onRename:(0,C.canManageServer)(bv)?async a=>{try{await (0,f.apiFetch)(`/api/community/channels/${u}`,{method:"PATCH",body:JSON.stringify({name:a})}),bc(a)}catch(a){(0,f.toastApiError)(a,"Failed to rename")}}:void 0}}),(0,b.jsxs)("main",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:[(0,b.jsx)(i.MessageList,{channel:bk,messages:aB,loading:aC,pinnedIds:bl,typingUsers:aX.map(a=>bs(a)),onOpenThread:()=>{},...br,onOpenProfile:bo,resolveUserName:bs,scrollToMessageId:bh,hero:k,viewerUserId:X.id,hasMore:aD,isFetchingOlder:aF,onLoadOlder:aH,hasMoreNewer:aE,isFetchingNewer:aG,onLoadNewer:aI,onJumpToPresent:aJ,unreadCount:aP},u),(0,b.jsx)(j.Composer,{channel:bk,context:"thread",members:ax,onSearchMembers:aa.searchMembers,channelRefCandidates:ay,onSend:bt,onTyping:bu,replyingTo:a9?.authorName,onCancelReply:()=>ba(null),autoFocus:"mobile"!==A})]}),a7&&(0,b.jsx)(l.CommunityPanelSheet,{open:!0,onOpenChange:a=>{a||a8(null)},kind:a7,...bB,onOpenProfile:bo}),bC]})}if(af){let a=(_?.categories.flatMap(a=>a.channels)??[]).find(a=>a.id===u),c=a?.tags??[],d=(0,C.canManageServer)(bv);return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(h.ChannelHeader,{channel:bk,forum:!0,rightPanel:a7,onToggle:bm,notifLevel:aW[u]??"Use Server Default",onSetNotifLevel:a=>a4.mutate({channelId:u,level:a},{onError:a=>(0,f.toastApiError)(a,"Failed to update notification level")}),onBack:"mobile"===A?a6:void 0,server:"mobile"===A&&_?{id:_.id,name:_.name,icon:_.icon}:void 0,tools:{threads:!1,pinned:!1}}),(0,b.jsx)("main",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:(0,b.jsx)(k.ForumView,{posts:aS,tags:c,loading:aT,onOpenPost:bn,onCreatePost:a=>{a1.mutate({channelId:u,...a},{onError:a=>(0,f.toastApiError)(a,"Failed to create post")})},canManageTags:d,onTagsChanged:d?a=>{(0,f.apiFetch)(`/api/community/channels/${u}`,{method:"PATCH",body:JSON.stringify({forumTags:JSON.stringify(a)})}).catch(a=>(0,f.toastApiError)(a,"Failed to save tags"))}:void 0})}),a7&&(0,b.jsx)(l.CommunityPanelSheet,{open:!0,onOpenChange:a=>{a||a8(null)},kind:a7,...bB,onOpenProfile:bo}),bC]})}return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(h.ChannelHeader,{channel:bk,rightPanel:a7,onToggle:bm,notifLevel:aW[u]??"Use Server Default",onSetNotifLevel:a=>a4.mutate({channelId:u,level:a},{onError:a=>(0,f.toastApiError)(a,"Failed to update notification level")}),onBack:"mobile"===A?a6:void 0,server:"mobile"===A&&_?{id:_.id,name:_.name,icon:_.icon}:void 0}),(0,b.jsxs)("main",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:[(0,b.jsx)(i.MessageList,{channel:bk,messages:aB,loading:aC,pinnedIds:bl,newDividerBefore:aL,typingUsers:aX.map(a=>bs(a)),onOpenThread:bn,...bq,onOpenProfile:bo,resolveUserName:bs,scrollToMessageId:bh,onScrollRoot:aO,viewerUserId:X.id,initialScrollReady:!aA&&aM,hasMore:aD,isFetchingOlder:aF,onLoadOlder:aH,hasMoreNewer:aE,isFetchingNewer:aG,onLoadNewer:aI,onJumpToPresent:aJ,unreadCount:aP},u),(0,b.jsx)(j.Composer,{channel:bk,context:"channel",members:ax,onSearchMembers:aa.searchMembers,channelRefCandidates:ay,onSend:bt,onTyping:bu,replyingTo:a9?.authorName,onCancelReply:()=>ba(null),autoFocus:"mobile"!==A})]}),a7&&(0,b.jsx)(l.CommunityPanelSheet,{open:!0,onOpenChange:a=>{a||a8(null)},kind:a7,...bB,onOpenProfile:bo}),bC]})}a.s(["default",0,function(){let a=(0,d.useParams)(),c=`${a.serverId}/${a.channelId}`;return(0,b.jsx)(X,{},c)}],415694)}];
|
|
1
|
+
module.exports=[415694,a=>{"use strict";var b=a.i(229073),c=a.i(226058),d=a.i(670209),e=a.i(780956),f=a.i(487154),g=a.i(446827),h=a.i(586220),i=a.i(686963),j=a.i(32006),k=a.i(633088),l=a.i(194102),m=a.i(466199),n=a.i(256944),o=a.i(17615),p=a.i(74720),q=a.i(445067),r=a.i(131033),s=a.i(785320),t=a.i(246661),u=a.i(561238),v=a.i(25668),w=a.i(881025),x=a.i(66957),y=a.i(708343),z=a.i(586889);function A({parentMessageId:a,onOpenProfile:c,onPreviewImage:d,onDownloadFile:e,onJump:g}){let h,i,{message:j,isLoading:k,isError:l}=(h=!!a,{...i=(0,y.useQuery)({queryKey:h?z.communityKeys.message(a):z.communityKeys.message("__none__"),queryFn:h?()=>(0,f.apiFetch)(`/api/community/messages/${a}`):()=>Promise.reject(Error("disabled")),enabled:h,staleTime:3e4}),message:i.data??null});if(k)return(0,b.jsx)(B,{});if(l||!j)return(0,b.jsxs)("div",{children:[(0,b.jsxs)("div",{className:"mb-2 flex items-center gap-2 text-xs font-medium text-muted-foreground",children:[(0,b.jsx)(n.MessagesSquare,{className:"size-3.5"}),(0,b.jsx)("span",{children:"Thread started from a message"})]}),(0,b.jsx)("p",{className:"text-sm italic text-muted-foreground",children:"Original message is unavailable."})]});let m=j.authorAvatar||(0,x.avatarInitial)(j.authorName);return(0,b.jsxs)("div",{className:"group relative",children:[(0,b.jsxs)("div",{className:"mb-2 flex items-center gap-2 text-xs font-medium text-muted-foreground",children:[(0,b.jsx)(n.MessagesSquare,{className:"size-3.5"}),(0,b.jsx)("span",{children:"Thread started from"})]}),g&&(0,b.jsxs)("button",{type:"button",onClick:g,className:"absolute right-0 top-0 flex h-7 items-center gap-1 rounded-md px-2 text-xs font-medium text-muted-foreground opacity-0 transition-opacity hover:bg-accent hover:text-foreground focus-visible:opacity-100 focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none group-hover:opacity-100","aria-label":"Jump to message",title:"Jump to message",children:[(0,b.jsx)(q.ArrowUpRight,{className:"size-3.5"}),"Jump"]}),(0,b.jsxs)("div",{className:"flex gap-3",children:[(0,b.jsx)("button",{onClick:a=>c?.(j.authorName,a,void 0,j.authorId),className:"shrink-0 self-start",children:(0,b.jsx)(r.Avatar,{label:m,seed:j.authorId,size:40})}),(0,b.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,b.jsxs)("div",{className:"flex items-baseline gap-2",children:[(0,b.jsx)("button",{onClick:a=>c?.(j.authorName,a,void 0,j.authorId),className:"text-[15px] font-semibold hover:underline",children:j.authorName}),(0,b.jsx)("span",{className:"text-xs text-muted-foreground",suppressHydrationWarning:!0,children:(0,u.formatMessageTime)(j.createdAt)})]}),j.content&&(0,b.jsx)(s.MessageBody,{text:j.content,onOpenProfile:c}),j.attachments&&j.attachments.length>0&&(0,b.jsx)("div",{className:"mt-2 flex flex-col gap-2 pb-2",children:j.attachments.map((a,c)=>"image"===a.kind?(0,b.jsx)("button",{onClick:()=>d?.(a.url),className:"block w-fit max-w-[320px] overflow-hidden rounded-lg border border-border transition-colors hover:border-primary/40",children:(0,b.jsx)("img",{src:a.url,alt:a.name,className:"max-h-50 max-w-[320px] rounded-lg object-contain",style:{aspectRatio:(0,t.attachmentAspectRatio)(a.width,a.height)}})},c):(0,b.jsxs)("button",{onClick:()=>e?.(a.url),className:"flex w-full max-w-[320px] items-center gap-3 rounded-lg border border-border bg-card p-2 text-left transition-colors hover:bg-accent",children:[(0,b.jsx)(o.FileText,{className:"size-7 shrink-0 text-muted-foreground"}),(0,b.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,b.jsx)("div",{className:"truncate text-sm font-medium text-primary",children:a.name}),"size"in a&&a.size&&(0,b.jsx)("div",{className:"text-xs text-muted-foreground",children:a.size})]}),(0,b.jsx)(p.Download,{className:"size-4 shrink-0 text-muted-foreground"})]},c))}),j.reactions&&j.reactions.length>0&&(0,b.jsx)("div",{className:"mt-2 flex flex-wrap gap-1",children:j.reactions.map((a,c)=>(0,b.jsxs)("span",{className:["flex h-6 items-center gap-1 rounded-full px-2 text-sm",a.me?"border border-primary/50 bg-accent":"bg-secondary"].join(" "),children:[(0,b.jsx)("span",{children:a.emoji}),(0,b.jsx)(w.NumberTicker,{value:a.count,className:"text-xs text-muted-foreground"})]},c))})]})]})]})}function B(){return(0,b.jsxs)("div",{children:[(0,b.jsx)(v.Skeleton,{className:"mb-2 h-3 w-32 rounded"}),(0,b.jsxs)("div",{className:"flex gap-3",children:[(0,b.jsx)(v.Skeleton,{className:"size-10 shrink-0 rounded-full"}),(0,b.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-2 pt-0.5",children:[(0,b.jsx)(v.Skeleton,{className:"h-4 w-32 rounded"}),(0,b.jsx)(v.Skeleton,{className:"h-3.5 w-full max-w-80 rounded"}),(0,b.jsx)(v.Skeleton,{className:"h-3.5 w-48 rounded"})]})]})]})}var C=a.i(379764);a.i(897046);var D=a.i(519116);a.i(974936);var E=a.i(425712),F=a.i(377447),G=a.i(437253),H=a.i(669991),I=a.i(208847),J=a.i(258365),K=a.i(128824),L=a.i(981498),M=a.i(364870);let N=Object.freeze([]);var O=a.i(333552),P=a.i(412118),Q=a.i(267017),R=a.i(491443),S=a.i(606617);a.i(735042);var T=a.i(705021),U=a.i(192378),V=a.i(15841),W=a.i(333701),X=a.i(510828);function Y(){let a,n,o,p,q,r=(0,d.useParams)(),s=(0,d.useRouter)(),t=(0,d.useSearchParams)(),u=decodeURIComponent(r.serverId),v=r.channelId,[w]=(0,c.useState)(()=>t.get("msg")),B=(0,h.useBreakpoint)(),Y=(0,H.useCurrentUser)(),Z=(0,G.useUiHandlers)(),$=(0,G.useCurrentChannelId)(),_=(0,G.useCurrentChannelMeta)(),{server:aa}=(0,I.useServer)(u),ab=(0,J.useServerMembers)(u),ac=(0,S.useOnlineUserIds)(),ad=(0,S.useCommunityWsStore)(a=>a.userStatuses),ae=(0,c.useMemo)(()=>ab.members.map(a=>{let b=ad.get(a.userId);return{...a,status:(0,E.resolveRowPresence)(a,ac,Y.id),statusEmoji:b?b.emoji:a.statusEmoji,statusText:b?b.text:a.statusText}}),[ab.members,ac,Y.id,ad]),af=(0,c.useMemo)(()=>(aa?.categories?.flatMap(a=>a.channels)??[]).find(a=>a.id===v)??null,[aa,v]),ag=(0,D.isForum)(af?.type),ah=!af&&!!aa?.categories,ai=ah&&!!_?.parentMessageId,[aj,ak]=(0,c.useState)(""),[al,am]=(0,c.useState)(!1),an=(0,c.useMemo)(()=>{let a=aa?.categories??[],b=ah?_?.parentChannelId??v:v,c=a.find(a=>a.channels.some(a=>a.id===b));return!!c?.private},[aa,ah,_,v]),ao=(0,K.useChannelMembers)(v,an&&!ai),ap=function(a,b=!0){let c=(0,y.useQuery)({queryKey:z.communityKeys.threadParticipants(a),queryFn:()=>(0,f.apiFetch)(`/api/community/channels/${encodeURIComponent(a)}/participants`),enabled:b&&!!a});return{...c,participants:c.data?.participants??N}}(v,ai),aq=(a=(0,M.useQueryClient)(),(0,L.useMutation)({mutationFn:a=>(0,f.apiFetch)(`/api/community/channels/${encodeURIComponent(v)}/participants/${encodeURIComponent(a)}`,{method:"DELETE"}),onSuccess:()=>{a.invalidateQueries({queryKey:z.communityKeys.threadParticipants(v)})}})),ar=(n=(0,M.useQueryClient)(),(0,L.useMutation)({mutationFn:a=>(0,f.apiFetch)(`/api/community/channels/${encodeURIComponent(v)}/participants`,{method:"POST",body:JSON.stringify({userId:a})}),onSuccess:()=>{n.invalidateQueries({queryKey:z.communityKeys.threadParticipants(v)})}})),as=(0,K.useAddableMembers)(v,an&&!ai),at=(0,K.useAddChannelMember)(v),au=(0,K.useRemoveChannelMember)(v),av=ai?_?.parentChannelId??null:null,aw=(0,K.useChannelMembers)(av??"",!!av),ax=(0,c.useMemo)(()=>{let a=aj.trim().toLowerCase(),b=a=>{let b=ad.get(a.userId);return{id:a.userId,userId:a.userId,name:a.name,discriminator:a.discriminator,avatar:a.avatar,sub:"",role:"member",status:(0,E.resolveRowPresence)(a,ac,Y.id),statusEmoji:b?b.emoji:a.statusEmoji??null,statusText:b?b.text:a.statusText??"",isCreator:a.isCreator,source:a.source}},c=(b,c)=>!a||b.toLowerCase().includes(a)||(c??"").toLowerCase().includes(a);if(ai){let a=_?.creatorId;return ap.participants.filter(a=>c(a.name??"",a.discriminator)).map(c=>b({userId:c.userId,name:(0,F.displayName)(c),discriminator:c.discriminator??void 0,avatar:c.avatar,isCreator:c.userId===a}))}return an?ao.members.filter(a=>c(a.name,a.discriminator)).map(a=>b(a)):ae},[ai,ap.participants,_,an,ae,ao.members,aj,ac,Y.id,ad]),ay=(0,c.useMemo)(()=>an?(ai?aw.members:ao.members).filter(a=>a.userId!==Y.id).map(a=>{let b=ad.get(a.userId);return{...a,status:(0,E.resolveRowPresence)(a,ac,Y.id),statusEmoji:b?b.emoji:a.statusEmoji,statusText:b?b.text:a.statusText}}):ae.filter(a=>a.userId!==Y.id),[an,ai,ae,ao.members,aw.members,ac,Y.id,ad]),az=(0,c.useMemo)(()=>(aa?.categories?.flatMap(a=>a.channels)??[]).map(a=>({id:a.id,name:a.name,serverId:u,serverName:aa?.name??""})),[aa,u]),{snapshot:aA,isFetching:aB}=(o=(0,y.useQuery)({queryKey:v?z.communityKeys.channelReadStateSnapshot(v):["community","channel","__none__","read-state-snapshot"],queryFn:async()=>(0,f.apiFetch)(`/api/community/channels/${v}/read-state`),enabled:!!v,staleTime:1/0,gcTime:0,refetchOnMount:"always",refetchOnWindowFocus:!1,refetchOnReconnect:!1,retry:1}),p=(0,c.useRef)(null),(q=(0,c.useRef)(v)).current!==v&&(p.current=null,q.current=v),(0,c.useEffect)(()=>{null===p.current&&o.data&&(p.current=o.data)},[o.data]),{snapshot:p.current??o.data??null,isFetching:o.isFetching}),{messages:aC,isLoading:aD,hasMoreOlder:aE,hasMoreNewer:aF,isFetchingOlder:aG,isFetchingNewer:aH,fetchOlder:aI,fetchNewer:aJ,jumpToPresent:aK,latestSeq:aL}=(0,O.useMessages)(v,{lastReadMessageId:aB?void 0:aA?.lastReadMessageId??null,anchorMessageId:w}),{newDividerBefore:aM,anchorFound:aN}=(0,c.useMemo)(()=>{if(!aA)return{newDividerBefore:void 0,anchorFound:!1};let a=aA.lastReadMessageId;if(!a){for(let a of aC)if(a.authorId!==Y.id)return{newDividerBefore:a.id,anchorFound:!0};return{newDividerBefore:void 0,anchorFound:!0}}let b=aC.findIndex(b=>b.id===a);if(-1===b)return{newDividerBefore:void 0,anchorFound:!1};for(let a=b+1;a<aC.length;a++)if(aC[a].authorId!==Y.id)return{newDividerBefore:aC[a].id,anchorFound:!0};return{newDividerBefore:void 0,anchorFound:!0}},[aC,aA,Y.id]),[aO,aP]=(0,c.useState)(null);!function({channelId:a,messages:b,scrollRootEl:d}){let e=(0,H.useCurrentUser)().id,f=(0,P.useAdvanceChannelWatermark)(),g=(0,c.useRef)(null);(0,c.useEffect)(()=>{g.current=null},[a]);let h=(0,c.useRef)(b),i=(0,c.useRef)(f);(0,c.useEffect)(()=>{h.current=b,i.current=f}),(0,c.useEffect)(()=>{if(!a||!d||"u"<typeof IntersectionObserver)return;let b=new IntersectionObserver(b=>{for(let c of b){if(!c.isIntersecting||c.intersectionRatio<.2)continue;let b=c.target.dataset.msgId;if(!b)continue;let d=h.current.find(a=>a.id===b);if(!d||!d.createdAt||d.authorId&&d.authorId===e)continue;let f=g.current;(!f||d.createdAt>f.createdAt||d.createdAt===f.createdAt&&b>f.id)&&(g.current={createdAt:d.createdAt,id:b},i.current(a,b))}},{root:d,threshold:.2});d.querySelectorAll("[data-msg-id]").forEach(a=>b.observe(a));let c=null;return"u">typeof MutationObserver&&(c=new MutationObserver(a=>{for(let c of a)c.addedNodes.forEach(a=>{1!==a.nodeType||(a.matches?.("[data-msg-id]")&&b.observe(a),a.querySelectorAll?.("[data-msg-id]").forEach(a=>b.observe(a)))})})).observe(d,{childList:!0,subtree:!0}),()=>{b.disconnect(),c?.disconnect()}},[a,b,d,e]),(0,c.useEffect)(()=>()=>{(0,P.flushPendingReads)()},[a])}({channelId:v,messages:aC,scrollRootEl:aO}),function({channelId:a,isChildChannel:b,snapshotReady:d}){let e=(0,M.useQueryClient)(),g=(0,c.useRef)(null);(0,c.useEffect)(()=>{if(!a||!d||g.current===a)return;g.current=a;let c=b?`/api/community/threads/${a}/read`:`/api/community/channels/${a}/read`;(0,f.apiFetch)(c,{method:"PUT"}).then(()=>{e.invalidateQueries({queryKey:z.communityKeys.inbox()}),e.invalidateQueries({queryKey:z.communityKeys.servers()})}).catch(()=>{})},[a,b,d,e])}({channelId:v,isChildChannel:ah,snapshotReady:!aB});let aQ=(0,c.useMemo)(()=>{let a=aL-(aA?.lastReadSeq??0);return a>0?a:0},[aL,aA]),{threads:aR,isLoading:aS}=(0,Q.useThreads)(v),{posts:aT,isLoading:aU}=(0,Q.useForumPosts)(v,ag),{pins:aV,isLoading:aW}=(0,Q.usePins)(v),aX=(0,R.useNotificationSettings)().channel,aY=(0,G.useCommunityStore)(a=>a.typingUsers),aZ=(0,P.useSendMessage)(),a$=(0,P.useToggleReactionApi)(),a_=(0,P.usePinMessage)(),a0=(0,P.useUnpinMessage)(),a1=(0,P.useCreateThread)(),a2=(0,T.useCreateForumPost)(),a3=(0,U.useSetMemberRole)(),a4=(0,U.useKickMember)(),a5=(0,V.useSetChannelNotif)(),a6=(0,W.useUploadFile)(),a7=(0,c.useCallback)(()=>{Z.goBackMobile?.()},[Z]);(0,c.useEffect)(()=>(G.useCommunityStore.getState().setCurrentChannelId(v),()=>{G.useCommunityStore.getState().setCurrentChannelId(null)}),[v]),(0,c.useEffect)(()=>{if(v)return(0,X.communityWsSubscribe)({channelId:v}),ah?(0,f.apiFetch)(`/api/community/threads/${v}`).then(a=>G.useCommunityStore.getState().setCurrentChannelMeta({name:a.name,parentChannelId:a.parentChannelId,parentMessageId:a.parentMessageId,creatorId:a.creatorId})).catch(a=>{(G.useCommunityStore.getState().setCurrentChannelMeta(null),a instanceof g.ApiError&&404===a.status)?s.replace(`/community/channels/${r.serverId}`):(0,f.toastApiError)(a,"Failed to load thread")}):G.useCommunityStore.getState().setCurrentChannelMeta(null),()=>{(0,X.communityWsUnsubscribe)()}},[v,ah,r.serverId,s]);let[a8,a9]=(0,c.useState)(null),[ba,bb]=(0,c.useState)(null),[bc,bd]=(0,c.useState)(null),[be,bf]=(0,c.useState)(""),[bg,bh]=(0,c.useState)([]),[bi,bj]=(0,c.useState)(w);(0,c.useEffect)(()=>{w&&s.replace(`/community/channels/${r.serverId}/${v}`,{scroll:!1})},[]),(0,c.useEffect)(()=>{if(bi){if(aC.some(a=>a.id===bi)){let a=setTimeout(()=>bj(a=>a===bi?null:a),1600);return()=>clearTimeout(a)}aD||aG||aH||bj(a=>a===bi?null:a)}},[bi,aC,aD,aG,aH]),(0,c.useEffect)(()=>{bb(null),a9(null),bf(""),bh([]),bd(null),ak(""),am(!1)},[v]);let bk=(0,c.useCallback)(async a=>{if(bf(a),!a.trim())return void bh([]);try{let b=new URLSearchParams({q:a});b&&b.set("channelId",v);let c=await (0,f.apiFetch)(`/api/community/search?${b}`);bh(c.results.map(a=>({id:a.message.id,type:"chat",authorName:a.author.name,authorAvatar:a.author.image??(0,x.avatarInitial)(a.author.name),content:a.message.content,createdAt:a.message.createdAt})))}catch(a){bh([]),(0,f.toastApiError)(a,"Search failed")}},[v]),bl=(0,c.useMemo)(()=>{if(bc)return bc;if(af)return af.name;if(_?.name)return _.name;let a=aT.find(a=>a.id===v);if(a)return a.name;let b=aR.find(a=>a.id===v);return b?b.name:"channel"},[bc,af,aT,aR,_,v]),bm=(0,c.useMemo)(()=>new Set(aV.map(a=>a.id)),[aV]),bn=a=>a9(b=>b===a?null:a),bo=a=>{s.push(`/community/channels/${r.serverId}/${a}`)},bp=(a,b,c,d)=>{Z.openProfile?.(a,b,c,d)},bq=(0,c.useCallback)(async(a,b)=>{try{return await aZ.mutateAsync({channelId:v,content:a,replyToId:b?.replyToId,mentionType:b?.mentionType,attachments:b?.attachments,author:{id:Y.id,name:Y.name,avatar:Y.avatar}})}catch{return null}},[aZ,v,Y.id,Y.name,Y.avatar]),br={onToggleReaction:(a,b)=>a$({channelId:v,messageId:a,emoji:b,userId:Y.id}),onReact:(a,b)=>a$({channelId:v,messageId:a,emoji:b,userId:Y.id}),onReply:a=>{let b=aC.find(b=>b.id===a);b&&bb({id:b.id,authorName:b.authorName??"",text:b.content??""})},onPin:a=>{bm.has(a)?a0.mutate({channelId:v,messageId:a},{onSuccess:()=>(0,e.toast)("Message unpinned"),onError:a=>(0,f.toastApiError)(a,"Failed to unpin message")}):(a_.mutate({channelId:v,messageId:a},{onSuccess:()=>(0,e.toast)("Message pinned"),onError:a=>(0,f.toastApiError)(a,"Failed to pin message")}),a9("pinned"))},onCreateThread:async a=>{let b=aC.find(b=>b.id===a),c=(b?.content??bl).split(/\s+/).slice(0,6).join(" ").slice(0,60)||bl;try{let b=await a1.mutateAsync({channelId:v,messageId:a,name:c});s.push(`/community/channels/${r.serverId}/${b.id}`)}catch(a){(0,f.toastApiError)(a,"Failed to create thread")}},onCopy:a=>{let b=aC.find(b=>b.id===a);b?.content&&(navigator.clipboard?.writeText(b.content),(0,e.toast)("Copied to clipboard"))},onRetry:a=>{let b=aC.find(b=>b.id===a);b?.content&&bq(b.content)},onPreviewImage:a=>{Z.previewImage?.(a)},onDownloadFile:a=>{let b=document.createElement("a");b.href=a,b.download=a.split("/").pop()??"file",b.click()}},bs={...br,onCreateThread:void 0},bt=(0,c.useMemo)(()=>(0,F.makeUserNameResolver)(ae),[ae]),bu=async(a,b,c)=>{if(!a&&!b?.length)return;let d=[];if(b?.length){let a=await Promise.all(b.map(a=>a6.mutateAsync({target:{channelId:v},file:a.file}).catch(a=>((0,f.toastApiError)(a,"Failed to attach file"),null))));d=(0,W.zipUploadResultsWithDimensions)(a,b)}bq(a||"",{replyToId:ba?.id,mentionType:c,attachments:d.length>0?d:void 0}),(0,X.communityWsResetTypingThrottle)({channelId:v}),bb(null)},bv=()=>{(0,X.communityWsSendTyping)({channelId:v})},bw=async a=>{try{let b=await a2.mutateAsync({channelId:v,...a});bo(b.post.id)}catch(a){(0,f.toastApiError)(a,"Failed to create post")}},bx=ae.find(a=>a.userId===Y.id)?.role,by=ah?_?.creatorId:af?.creatorId,bz=!!by&&by===Y.id,bA=ai||an&&!ag,bB=ai||an,bC=bB&&!ag?{viewerUserId:Y.id,viewerIsCreator:bz,onLeave:a=>(ai?aq:au).mutate(a,{onError:a=>(0,f.toastApiError)(a,"Failed to leave")}),onRemove:a=>(ai?aq:au).mutate(a,{onError:a=>(0,f.toastApiError)(a,"Failed to remove")})}:void 0,bD={onOpenThread:bo,members:ax,membersLoading:ai?ap.isLoading:an?ao.isLoading:ab.loading,membersLoadingMore:!bB&&ab.loadingMore,membersHasMore:!bB&&ab.hasMore,onLoadMoreMembers:bB?void 0:ab.loadMore,onSearchMembers:bB?ak:ab.searchMembers,onAddMember:bA?()=>am(!0):void 0,manageContext:bC,pinned:aV,pinnedLoading:aW,searchResults:bg,threads:aR,threadsLoading:aS,searchQuery:be,myRole:bx,onSearch:bk,onSetRole:(a,b)=>{a3.mutate({serverId:u,memberId:a,role:b},{onSuccess:()=>(0,e.toast)("Role updated"),onError:a=>(0,f.toastApiError)(a,"Failed to update role")})},onKickMember:a=>{a4.mutate({serverId:u,memberId:a},{onSuccess:()=>(0,e.toast)("Member kicked"),onError:a=>(0,f.toastApiError)(a,"Failed to kick member")})},onJumpToMessage:a=>{bj(a),setTimeout(()=>bj(null),100)}},bE=(()=>{if(!al)return null;if(ai){let a=new Set(ap.participants.map(a=>a.userId)),c=aw.members.filter(b=>!a.has(b.userId)&&b.userId!==Y.id).map(a=>({userId:a.userId,name:a.name??null,avatar:a.avatar}));return(0,b.jsx)(C.AddMembersDialog,{title:`Add participants to /${_?.name??bl}`,subtitle:"Added people are notified of new replies. Anyone with access can already read the thread.",candidates:c,addPending:ar.isPending,onAdd:async a=>{await ar.mutateAsync(a)},onClose:()=>am(!1)})}let a=as.members.map(a=>({userId:a.userId,name:a.name??null,avatar:a.avatar}));return(0,b.jsx)(C.AddMembersDialog,{title:`Add members to /${bl}`,subtitle:"Added members can see and post in this channel.",candidates:a,addPending:at.isPending,onAdd:async a=>{await at.mutateAsync(a)},onClose:()=>am(!1)})})(),bF=!af&&!!aa?.categories,bG=ag?aU:aD;if(!($===v&&!bG&&(!bF||null!==_)))return ag?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(i.ChannelHeaderSkeleton,{onBack:"mobile"===B?a7:void 0}),(0,b.jsx)("main",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:(0,b.jsx)(l.ForumViewSkeleton,{})})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(i.ChannelHeaderSkeleton,{onBack:"mobile"===B?a7:void 0}),(0,b.jsxs)("main",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:[(0,b.jsx)(j.MessageList,{channel:"",messages:[],loading:!0,onOpenThread:()=>{}},v),(0,b.jsx)(k.ComposerSkeleton,{})]})]});if(ah){let a=_?.parentChannelId,c=_?.parentMessageId??null,d=aa?.categories?.flatMap(a=>a.channels)??[],e=a?d.find(b=>b.id===a):null,g=e?.name??"channel",h=c?(0,b.jsx)(A,{parentMessageId:c,onOpenProfile:bp,onPreviewImage:a=>Z.previewImage?.(a),onDownloadFile:a=>{let b=document.createElement("a");b.href=a,b.download=a.split("/").pop()??"file",b.click()},onJump:a?()=>s.push(`/community/channels/${r.serverId}/${a}?msg=${c}`):void 0}):void 0;return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(i.ChannelHeader,{channel:g,forum:(0,D.isForum)(e?.type),rightPanel:a8,onToggle:bn,onBack:"mobile"===B?()=>s.back():void 0,server:"mobile"===B&&aa?{id:aa.id,name:aa.name,icon:aa.icon}:void 0,tools:{threads:!1},breadcrumb:{label:bl,onNavigateBack:()=>{a?s.push(`/community/channels/${r.serverId}/${a}`):s.back()},onRename:(0,D.canManageServer)(bx)?async a=>{try{await (0,f.apiFetch)(`/api/community/channels/${v}`,{method:"PATCH",body:JSON.stringify({name:a})}),bd(a)}catch(a){(0,f.toastApiError)(a,"Failed to rename")}}:void 0}}),(0,b.jsxs)("main",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:[(0,b.jsx)(j.MessageList,{channel:bl,messages:aC,loading:aD,pinnedIds:bm,typingUsers:aY.map(a=>bt(a)),onOpenThread:()=>{},...bs,onOpenProfile:bp,resolveUserName:bt,scrollToMessageId:bi,hero:h,viewerUserId:Y.id,hasMore:aE,isFetchingOlder:aG,onLoadOlder:aI,hasMoreNewer:aF,isFetchingNewer:aH,onLoadNewer:aJ,onJumpToPresent:aK,unreadCount:aQ},v),(0,b.jsx)(k.Composer,{channel:bl,context:"thread",members:ay,onSearchMembers:ab.searchMembers,channelRefCandidates:az,onSend:bu,onTyping:bv,replyingTo:ba?.authorName,onCancelReply:()=>bb(null),autoFocus:"mobile"!==B})]}),a8&&(0,b.jsx)(m.CommunityPanelSheet,{open:!0,onOpenChange:a=>{a||a9(null)},kind:a8,...bD,onOpenProfile:bp}),bE]})}if(ag){let a=(aa?.categories.flatMap(a=>a.channels)??[]).find(a=>a.id===v),c=a?.tags??[],d=(0,D.canManageServer)(bx);return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(i.ChannelHeader,{channel:bl,forum:!0,rightPanel:a8,onToggle:bn,notifLevel:aX[v]??"Use Server Default",onSetNotifLevel:a=>a5.mutate({channelId:v,level:a},{onError:a=>(0,f.toastApiError)(a,"Failed to update notification level")}),onBack:"mobile"===B?a7:void 0,server:"mobile"===B&&aa?{id:aa.id,name:aa.name,icon:aa.icon}:void 0,tools:{threads:!1,pinned:!1}}),(0,b.jsx)("main",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:(0,b.jsx)(l.ForumView,{posts:aT,tags:c,loading:aU,onOpenPost:bo,onCreatePost:bw,canManageTags:d,onTagsChanged:d?a=>{(0,f.apiFetch)(`/api/community/channels/${v}`,{method:"PATCH",body:JSON.stringify({forumTags:JSON.stringify(a)})}).catch(a=>(0,f.toastApiError)(a,"Failed to save tags"))}:void 0})}),a8&&(0,b.jsx)(m.CommunityPanelSheet,{open:!0,onOpenChange:a=>{a||a9(null)},kind:a8,...bD,onOpenProfile:bp}),bE]})}return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(i.ChannelHeader,{channel:bl,rightPanel:a8,onToggle:bn,notifLevel:aX[v]??"Use Server Default",onSetNotifLevel:a=>a5.mutate({channelId:v,level:a},{onError:a=>(0,f.toastApiError)(a,"Failed to update notification level")}),onBack:"mobile"===B?a7:void 0,server:"mobile"===B&&aa?{id:aa.id,name:aa.name,icon:aa.icon}:void 0}),(0,b.jsxs)("main",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:[(0,b.jsx)(j.MessageList,{channel:bl,messages:aC,loading:aD,pinnedIds:bm,newDividerBefore:aM,typingUsers:aY.map(a=>bt(a)),onOpenThread:bo,...br,onOpenProfile:bp,resolveUserName:bt,scrollToMessageId:bi,onScrollRoot:aP,viewerUserId:Y.id,initialScrollReady:!aB&&aN,hasMore:aE,isFetchingOlder:aG,onLoadOlder:aI,hasMoreNewer:aF,isFetchingNewer:aH,onLoadNewer:aJ,onJumpToPresent:aK,unreadCount:aQ},v),(0,b.jsx)(k.Composer,{channel:bl,context:"channel",members:ay,onSearchMembers:ab.searchMembers,channelRefCandidates:az,onSend:bu,onTyping:bv,replyingTo:ba?.authorName,onCancelReply:()=>bb(null),autoFocus:"mobile"!==B})]}),a8&&(0,b.jsx)(m.CommunityPanelSheet,{open:!0,onOpenChange:a=>{a||a9(null)},kind:a8,...bD,onOpenProfile:bp}),bE]})}a.s(["default",0,function(){let a=(0,d.useParams)(),c=`${a.serverId}/${a.channelId}`;return(0,b.jsx)(Y,{},c)}],415694)}];
|
|
2
2
|
|
|
3
3
|
//# sourceMappingURL=src_web_src_app_community_channels_%5BserverId%5D_%5BchannelId%5D_page_tsx_10gja3t._.js.map
|