cognova 0.2.12 → 0.2.13
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/.output/nitro.json +1 -1
- package/.output/public/_nuxt/{DwY7rCd_.js → -HePz7lp.js} +2 -2
- package/.output/public/_nuxt/{CY-cjAwJ.js → 4ALIM-zZ.js} +1 -1
- package/.output/public/_nuxt/{DXdwpJ-I.js → 5sUbkh_6.js} +2 -2
- package/.output/public/_nuxt/{_cy8R3nk.js → 6bB8Ev7a.js} +1 -1
- package/.output/public/_nuxt/{1zUTf4AP.js → 7rT1DCe2.js} +1 -1
- package/.output/public/_nuxt/{vIOxcXKR.js → 9O1MXkck.js} +1 -1
- package/.output/public/_nuxt/{7oCGSglN.js → 9kAKMaPC.js} +1 -1
- package/.output/public/_nuxt/{CVqlefTY.js → B-DMcEU9.js} +1 -1
- package/.output/public/_nuxt/{BS2ZNXI1.js → B0nzD8Sk.js} +1 -1
- package/.output/public/_nuxt/B2PqR2Vu.js +1 -0
- package/.output/public/_nuxt/{Db4KMnt8.js → B2wI_pYg.js} +1 -1
- package/.output/public/_nuxt/{zq-a1TeT.js → B5FuOh7E.js} +1 -1
- package/.output/public/_nuxt/B6om4MW2.js +1 -0
- package/.output/public/_nuxt/{Dya5oK8u.js → B7ikW4eF.js} +1 -1
- package/.output/public/_nuxt/{BYHCP8x7.js → B8DFEjxA.js} +1 -1
- package/.output/public/_nuxt/{6boMs_nF.js → B9kWNcU7.js} +1 -1
- package/.output/public/_nuxt/BAZ8sewA.js +1 -0
- package/.output/public/_nuxt/{BXuWCWsJ.js → BCPwL4ma.js} +1 -1
- package/.output/public/_nuxt/{DY3uK7wM.js → BCrlmHh_.js} +1 -1
- package/.output/public/_nuxt/{BR8bKz8h.js → BD-AFJWW.js} +1 -1
- package/.output/public/_nuxt/{BtHQ1T0f.js → BGcQMReV.js} +1 -1
- package/.output/public/_nuxt/{BDyn4ApB.js → BL1mkqgd.js} +3 -3
- package/.output/public/_nuxt/BNJJSRKh.js +1 -0
- package/.output/public/_nuxt/{D8lwrAYS.js → BNeeERBt.js} +1 -1
- package/.output/public/_nuxt/{CVFwOzbl.js → BSJb5amZ.js} +1 -1
- package/.output/public/_nuxt/{CEnSeCqn.js → BSsaE9Db.js} +1 -1
- package/.output/public/_nuxt/{DzA58_Lm.js → BVO3XpHT.js} +1 -1
- package/.output/public/_nuxt/{CuxrHsu-.js → BWuL2CzO.js} +1 -1
- package/.output/public/_nuxt/{0yk-pS3R.js → B_9zJTqe.js} +1 -1
- package/.output/public/_nuxt/{DcJbYLTp.js → B_Lr1vlV.js} +1 -1
- package/.output/public/_nuxt/{CZoEPC_Q.js → Bc8bTnkd.js} +3 -3
- package/.output/public/_nuxt/{BKXg-alD.js → BghuwIGa.js} +1 -1
- package/.output/public/_nuxt/{PP_4ebzl.js → BjsKx597.js} +1 -1
- package/.output/public/_nuxt/{DuvzM-P1.js → Bl0qBhCG.js} +1 -1
- package/.output/public/_nuxt/{B_wilgcd.js → Bl43dkDq.js} +1 -1
- package/.output/public/_nuxt/{JbHa4oXq.js → BnMTFF5R.js} +1 -1
- package/.output/public/_nuxt/{CY-QVcA5.js → BrX-PnSK.js} +2 -2
- package/.output/public/_nuxt/{DYbZBZet.js → BtV7oNn3.js} +1 -1
- package/.output/public/_nuxt/{apYB9dr5.js → BvFYnRMR.js} +1 -1
- package/.output/public/_nuxt/{x6FRJ5ac.js → BvTUBUNN.js} +1 -1
- package/.output/public/_nuxt/{wO6z2ugJ.js → ByLsRRoQ.js} +1 -1
- package/.output/public/_nuxt/{DC4idAGt.js → C1LcEMwB.js} +1 -1
- package/.output/public/_nuxt/{YX8avsvq.js → C2IiXp9N.js} +2 -2
- package/.output/public/_nuxt/{fbyIeNkc.js → C6OSRpRd.js} +1 -1
- package/.output/public/_nuxt/{3jQMk_5H.js → C796kFT9.js} +1 -1
- package/.output/public/_nuxt/{DEd2xVbS.js → C7m9zGMG.js} +1 -1
- package/.output/public/_nuxt/C8AtdrMH.js +1 -0
- package/.output/public/_nuxt/CAWbHTgy.js +1 -0
- package/.output/public/_nuxt/{ixlNW2So.js → CFmvNggn.js} +1 -1
- package/.output/public/_nuxt/{gTrVszwd.js → CGplHfmR.js} +1 -1
- package/.output/public/_nuxt/CJPrV25_.js +1 -0
- package/.output/public/_nuxt/{U1MWjQMi.js → CKKEWapF.js} +1 -1
- package/.output/public/_nuxt/{C6qKcgOY.js → CLkkdThv.js} +22 -22
- package/.output/public/_nuxt/CNjv28J2.js +1 -0
- package/.output/public/_nuxt/{BLnYhy_t.js → CRRw0Thu.js} +1 -1
- package/.output/public/_nuxt/{10_wwHSz.js → CT8s4rqa.js} +1 -1
- package/.output/public/_nuxt/{C27WoGNZ.js → CZSOrxUy.js} +1 -1
- package/.output/public/_nuxt/{DNP5E1bC.js → CaNEL9JC.js} +5 -5
- package/.output/public/_nuxt/{DhuOKJda.js → CbTLg9oX.js} +1 -1
- package/.output/public/_nuxt/CfCXpVn5.js +1 -0
- package/.output/public/_nuxt/{C9WIgRRL.js → ChmNlvWR.js} +1 -1
- package/.output/public/_nuxt/{t8aDAkZ5.js → CiNxIhaq.js} +1 -1
- package/.output/public/_nuxt/{E3rXPwU8.js → Ck0QYdxe.js} +1 -1
- package/.output/public/_nuxt/{DUVzIl3o.js → Ckb0pu4-.js} +1 -1
- package/.output/public/_nuxt/{vScW1Zgm.js → CkwPRs1D.js} +1 -1
- package/.output/public/_nuxt/CmEJg8C6.js +2 -0
- package/.output/public/_nuxt/{CTCcEJU3.js → CmL_vMJD.js} +1 -1
- package/.output/public/_nuxt/{Bciqk4dX.js → Cq8zPxkT.js} +1 -1
- package/.output/public/_nuxt/{D8M722pn.js → CseYuM6E.js} +1 -1
- package/.output/public/_nuxt/{D0ifH682.js → CxRnB4NC.js} +1 -1
- package/.output/public/_nuxt/{CVdCqaby.js → D0zMyG8n.js} +1 -1
- package/.output/public/_nuxt/{DhI5cA_n.js → D12qPplu.js} +1 -1
- package/.output/public/_nuxt/{Beom-INj.js → D1XYB283.js} +1 -1
- package/.output/public/_nuxt/{BUghTae1.js → D2NxqyzW.js} +1 -1
- package/.output/public/_nuxt/{CZRnNmU8.js → D5xyrvFu.js} +1 -1
- package/.output/public/_nuxt/{2dNDtTiv.js → D6tVZcRs.js} +3 -3
- package/.output/public/_nuxt/{EgKnQnf-.js → D7N3EZ-I.js} +1 -1
- package/.output/public/_nuxt/{C5R5QaCA.js → D8iBB0Py.js} +1 -1
- package/.output/public/_nuxt/{XCjS70z4.js → D8oIH8m1.js} +1 -1
- package/.output/public/_nuxt/{BA_pRWwX.js → DB2zZev7.js} +1 -1
- package/.output/public/_nuxt/{Cl-LOSDV.js → DBrOAqkm.js} +1 -1
- package/.output/public/_nuxt/{DO9SFIh1.js → DDXDFweK.js} +1 -1
- package/.output/public/_nuxt/{B93pdGAW.js → DFZkCmLQ.js} +1 -1
- package/.output/public/_nuxt/{CLfF6dSn.js → DFpmIy6J.js} +1 -1
- package/.output/public/_nuxt/{BfcLZ_fC.js → DKZmgHNU.js} +1 -1
- package/.output/public/_nuxt/{CPutXj8l.js → DNcOC5zj.js} +1 -1
- package/.output/public/_nuxt/{BHtY0l0l.js → DQhm-UPG.js} +1 -1
- package/.output/public/_nuxt/{C2FxZbO_.js → DR8tGJhL.js} +1 -1
- package/.output/public/_nuxt/{D4UJwDQJ.js → DVAEVTjy.js} +1 -1
- package/.output/public/_nuxt/{2nOqGUPr.js → DVqrPkCJ.js} +1 -1
- package/.output/public/_nuxt/DWZ9ieYa.js +1 -0
- package/.output/public/_nuxt/{nnQqD5pb.js → DWj6VsZv.js} +1 -1
- package/.output/public/_nuxt/{C2vq6Te8.js → DXJ9PxCv.js} +1 -1
- package/.output/public/_nuxt/{CobqYwkp.js → D_ziPROx.js} +1 -1
- package/.output/public/_nuxt/{GtEM7xVU.js → Da2vwoYG.js} +1 -1
- package/.output/public/_nuxt/{Cc-2ziaZ.js → Ddz3HcBB.js} +1 -1
- package/.output/public/_nuxt/{Di-Nc75e.js → DgYei0bK.js} +1 -1
- package/.output/public/_nuxt/{DQh6I9z9.js → Di_3GV_R.js} +1 -1
- package/.output/public/_nuxt/{ByYh0uRg.js → Djog1f_e.js} +1 -1
- package/.output/public/_nuxt/{C4mwL7SE.js → Dkap2-Pj.js} +2 -2
- package/.output/public/_nuxt/{D5q8SnqE.js → DlJe_sHk.js} +1 -1
- package/.output/public/_nuxt/DlPOQpH_.js +1 -0
- package/.output/public/_nuxt/{DTGenhcA.js → DmYWMtVA.js} +1 -1
- package/.output/public/_nuxt/DmxKU7sH.js +1 -0
- package/.output/public/_nuxt/{DtjjnHnt.js → DowkFZ2V.js} +1 -1
- package/.output/public/_nuxt/{0NJ3PaRM.js → DsodHRrQ.js} +1 -1
- package/.output/public/_nuxt/{Bk6JUtIo.js → DuzpliIL.js} +1 -1
- package/.output/public/_nuxt/DvHS7_h2.js +1 -0
- package/.output/public/_nuxt/DwSY6_2U.js +1 -0
- package/.output/public/_nuxt/{Djs0Tlpa.js → DypJaSm-.js} +1 -1
- package/.output/public/_nuxt/{C71_a1IX.js → DzKaXH6P.js} +1 -1
- package/.output/public/_nuxt/{CBTkrk2M.js → FK-jSuOT.js} +1 -1
- package/.output/public/_nuxt/{ILEvizzp.js → Fc2JsQt4.js} +1 -1
- package/.output/public/_nuxt/{BIXrSYwR.js → IYCBGuRS.js} +1 -1
- package/.output/public/_nuxt/{JX1oqJI9.js → LRO7YHoH.js} +1 -1
- package/.output/public/_nuxt/{Kw0zy3FG.js → NrRzUJNY.js} +1 -1
- package/.output/public/_nuxt/{DJTCT0bl.js → OeVS0Rsb.js} +1 -1
- package/.output/public/_nuxt/{BmOtR1wX.js → OlF0QnKF.js} +1 -1
- package/.output/public/_nuxt/{DTAStixR.js → QuAoqY7t.js} +1 -1
- package/.output/public/_nuxt/{8q5NepGW.js → RlXHkmOd.js} +2 -2
- package/.output/public/_nuxt/{rfGRTJJW.js → TxMdabnL.js} +1 -1
- package/.output/public/_nuxt/{CZVzFlpI.js → WZnvL9Dh.js} +1 -1
- package/.output/public/_nuxt/ZvG7a1W3.js +1 -0
- package/.output/public/_nuxt/{N5XtbYVD.js → aPNZBVrG.js} +1 -1
- package/.output/public/_nuxt/builds/latest.json +1 -1
- package/.output/public/_nuxt/builds/meta/495aca73-bfa5-456e-b96a-f02e009c72d3.json +1 -0
- package/.output/public/_nuxt/entry.C_udkZt9.css +1 -0
- package/.output/public/_nuxt/{D_4LPm1U.js → evY81hM3.js} +1 -1
- package/.output/public/_nuxt/{DzGy77Vr.js → h_bXa-f2.js} +1 -1
- package/.output/public/_nuxt/{D9nmzBAw.js → i6QBzaEi.js} +1 -1
- package/.output/public/_nuxt/{BGgwYWjH.js → iTVKJ1kw.js} +1 -1
- package/.output/public/_nuxt/{Um1vPiAz.js → j92uR3uR.js} +1 -1
- package/.output/public/_nuxt/jdUkeAj_.js +1 -0
- package/.output/public/_nuxt/{BmVLxnDU.js → jeRvcMHU.js} +1 -1
- package/.output/public/_nuxt/{SrncdpaW.js → kuv0zpKq.js} +1 -1
- package/.output/public/_nuxt/{DfF81NlA.js → l3lKQs7b.js} +1 -1
- package/.output/public/_nuxt/{4K03TkGA.js → pdYvpiud.js} +3 -3
- package/.output/public/_nuxt/{C39dQ88F.js → qIgZ7OXa.js} +1 -1
- package/.output/public/_nuxt/{DS2wStH1.js → qcVwZv8e.js} +1 -1
- package/.output/public/_nuxt/{g5MjDvm5.js → ru8fqqWs.js} +1 -1
- package/.output/public/_nuxt/{CQqCBrXj.js → sBzyvWMJ.js} +1 -1
- package/.output/public/_nuxt/{D3AZaldL.js → sgmhgpCS.js} +1 -1
- package/.output/public/_nuxt/{ChcO9s3o.js → y2jv0da-.js} +1 -1
- package/.output/public/_nuxt/{Dn5a-guE.js → yyS4-kAX.js} +1 -1
- package/.output/public/_nuxt/zIoBLBHF.js +1 -0
- package/.output/public/_nuxt/zpazwPgx.js +1 -0
- package/.output/server/chunks/build/{chat-CR3JIVEq.mjs → chat-m4-n9vC6.mjs} +516 -14
- package/.output/server/chunks/build/chat-m4-n9vC6.mjs.map +1 -0
- package/.output/server/chunks/build/client.precomputed.mjs +1 -1
- package/.output/server/chunks/build/server.mjs +1 -1
- package/.output/server/chunks/build/styles.mjs +4 -4
- package/.output/server/chunks/nitro/nitro.mjs +875 -863
- package/.output/server/chunks/routes/_ws/chat.mjs +39 -5
- package/.output/server/chunks/routes/_ws/chat.mjs.map +1 -1
- package/Claude/skills/_lib/api.py +3 -2
- package/app/components/chat/ChatInput.vue +133 -5
- package/app/components/chat/MessageBubble.vue +188 -6
- package/app/composables/useAttachments.ts +196 -0
- package/app/composables/useChat.ts +14 -2
- package/app/pages/chat.vue +4 -2
- package/package.json +1 -1
- package/server/bridge/adapters/imessage.ts +9 -2
- package/server/routes/_ws/chat.ts +61 -7
- package/server/utils/chat-session-manager.ts +20 -2
- package/shared/types/index.ts +27 -1
- package/.output/public/_nuxt/BH0QDWEm.js +0 -1
- package/.output/public/_nuxt/BK8S2ony.js +0 -1
- package/.output/public/_nuxt/BZrSPX0S.js +0 -1
- package/.output/public/_nuxt/BaZwjF8o.js +0 -1
- package/.output/public/_nuxt/BkfI94R8.js +0 -1
- package/.output/public/_nuxt/C3NST0BU.js +0 -1
- package/.output/public/_nuxt/CKxSHyww.js +0 -1
- package/.output/public/_nuxt/CSKJ-Ahh.js +0 -1
- package/.output/public/_nuxt/CWyMCJQH.js +0 -1
- package/.output/public/_nuxt/CYPO5o_C.js +0 -1
- package/.output/public/_nuxt/CqNwHCpo.js +0 -1
- package/.output/public/_nuxt/CwPdIZ9J.js +0 -1
- package/.output/public/_nuxt/D5jZq8b3.js +0 -1
- package/.output/public/_nuxt/DH4YkDAi.js +0 -1
- package/.output/public/_nuxt/DPklr_tJ.js +0 -2
- package/.output/public/_nuxt/DQM4eBdt.js +0 -1
- package/.output/public/_nuxt/DUAAXJ6Q.js +0 -1
- package/.output/public/_nuxt/DmmdPt_5.js +0 -1
- package/.output/public/_nuxt/H6JbrRBU.js +0 -1
- package/.output/public/_nuxt/builds/meta/a892969f-e07d-4f44-8d7e-57a4b7f33d94.json +0 -1
- package/.output/public/_nuxt/entry.NKPfH2kE.css +0 -1
- package/.output/server/chunks/build/chat-CR3JIVEq.mjs.map +0 -1
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import type { ChatImageBlock, ChatImageMediaType, ChatDocumentBlock } from '~~/shared/types'
|
|
2
|
+
|
|
3
|
+
const IMAGE_TYPES: ChatImageMediaType[] = ['image/jpeg', 'image/png', 'image/gif', 'image/webp']
|
|
4
|
+
|
|
5
|
+
const TEXT_MIME_TYPES = new Set([
|
|
6
|
+
'application/json',
|
|
7
|
+
'application/javascript',
|
|
8
|
+
'application/typescript',
|
|
9
|
+
'application/xml',
|
|
10
|
+
'application/x-yaml',
|
|
11
|
+
'application/x-sh',
|
|
12
|
+
'application/sql',
|
|
13
|
+
'application/toml',
|
|
14
|
+
'application/x-httpd-php'
|
|
15
|
+
])
|
|
16
|
+
|
|
17
|
+
const MAX_FILE_SIZE = 20 * 1024 * 1024 // 20MB
|
|
18
|
+
|
|
19
|
+
export interface PendingImageAttachment {
|
|
20
|
+
id: string
|
|
21
|
+
kind: 'image'
|
|
22
|
+
previewUrl: string
|
|
23
|
+
base64: string
|
|
24
|
+
mediaType: ChatImageMediaType
|
|
25
|
+
name: string
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface PendingDocumentAttachment {
|
|
29
|
+
id: string
|
|
30
|
+
kind: 'document'
|
|
31
|
+
data: string
|
|
32
|
+
sourceType: 'base64' | 'text'
|
|
33
|
+
name: string
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export type PendingAttachment = PendingImageAttachment | PendingDocumentAttachment
|
|
37
|
+
|
|
38
|
+
function generateId(): string {
|
|
39
|
+
if (typeof crypto !== 'undefined' && crypto.randomUUID)
|
|
40
|
+
return crypto.randomUUID()
|
|
41
|
+
return Math.random().toString(36).slice(2)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function readFileAsBase64(file: File): Promise<string> {
|
|
45
|
+
return new Promise((resolve, reject) => {
|
|
46
|
+
const reader = new FileReader()
|
|
47
|
+
reader.onload = () => {
|
|
48
|
+
const result = reader.result as string
|
|
49
|
+
const base64 = result.split(',')[1]
|
|
50
|
+
if (base64) resolve(base64)
|
|
51
|
+
else reject(new Error('Failed to read file as base64'))
|
|
52
|
+
}
|
|
53
|
+
reader.onerror = () => reject(reader.error)
|
|
54
|
+
reader.readAsDataURL(file)
|
|
55
|
+
})
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function readFileAsText(file: File): Promise<string> {
|
|
59
|
+
return new Promise((resolve, reject) => {
|
|
60
|
+
const reader = new FileReader()
|
|
61
|
+
reader.onload = () => resolve(reader.result as string)
|
|
62
|
+
reader.onerror = () => reject(reader.error)
|
|
63
|
+
reader.readAsText(file)
|
|
64
|
+
})
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function isImageType(mime: string): mime is ChatImageMediaType {
|
|
68
|
+
return IMAGE_TYPES.includes(mime as ChatImageMediaType)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function isTextType(mime: string): boolean {
|
|
72
|
+
return mime.startsWith('text/') || TEXT_MIME_TYPES.has(mime)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function isPdfType(mime: string): boolean {
|
|
76
|
+
return mime === 'application/pdf'
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export function useAttachments() {
|
|
80
|
+
const attachments = ref<PendingAttachment[]>([])
|
|
81
|
+
const toast = useToast()
|
|
82
|
+
|
|
83
|
+
async function addFiles(files: FileList | File[]) {
|
|
84
|
+
for (const file of Array.from(files)) {
|
|
85
|
+
if (file.size > MAX_FILE_SIZE) {
|
|
86
|
+
toast.add({ title: 'File too large', description: `${file.name} exceeds 20MB limit`, color: 'error' })
|
|
87
|
+
continue
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const mime = file.type || ''
|
|
91
|
+
|
|
92
|
+
try {
|
|
93
|
+
if (isImageType(mime)) {
|
|
94
|
+
const base64 = await readFileAsBase64(file)
|
|
95
|
+
const previewUrl = URL.createObjectURL(file)
|
|
96
|
+
attachments.value.push({
|
|
97
|
+
id: generateId(),
|
|
98
|
+
kind: 'image',
|
|
99
|
+
previewUrl,
|
|
100
|
+
base64,
|
|
101
|
+
mediaType: mime,
|
|
102
|
+
name: file.name
|
|
103
|
+
})
|
|
104
|
+
} else if (isPdfType(mime)) {
|
|
105
|
+
const base64 = await readFileAsBase64(file)
|
|
106
|
+
attachments.value.push({
|
|
107
|
+
id: generateId(),
|
|
108
|
+
kind: 'document',
|
|
109
|
+
data: base64,
|
|
110
|
+
sourceType: 'base64',
|
|
111
|
+
name: file.name
|
|
112
|
+
})
|
|
113
|
+
} else if (isTextType(mime) || isLikelyTextFile(file.name)) {
|
|
114
|
+
const text = await readFileAsText(file)
|
|
115
|
+
attachments.value.push({
|
|
116
|
+
id: generateId(),
|
|
117
|
+
kind: 'document',
|
|
118
|
+
data: text,
|
|
119
|
+
sourceType: 'text',
|
|
120
|
+
name: file.name
|
|
121
|
+
})
|
|
122
|
+
} else {
|
|
123
|
+
toast.add({ title: 'Unsupported file type', description: `${file.name} (${mime || 'unknown type'})`, color: 'error' })
|
|
124
|
+
}
|
|
125
|
+
} catch {
|
|
126
|
+
toast.add({ title: 'Failed to read file', description: file.name, color: 'error' })
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
function removeAttachment(id: string) {
|
|
132
|
+
const idx = attachments.value.findIndex(a => a.id === id)
|
|
133
|
+
if (idx !== -1) {
|
|
134
|
+
const att = attachments.value[idx]!
|
|
135
|
+
if (att.kind === 'image') URL.revokeObjectURL(att.previewUrl)
|
|
136
|
+
attachments.value.splice(idx, 1)
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function clearAttachments() {
|
|
141
|
+
for (const att of attachments.value)
|
|
142
|
+
if (att.kind === 'image') URL.revokeObjectURL(att.previewUrl)
|
|
143
|
+
attachments.value = []
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
function toImageBlocks(): ChatImageBlock[] {
|
|
147
|
+
return attachments.value
|
|
148
|
+
.filter((a): a is PendingImageAttachment => a.kind === 'image')
|
|
149
|
+
.map(att => ({
|
|
150
|
+
type: 'image' as const,
|
|
151
|
+
source: {
|
|
152
|
+
type: 'base64' as const,
|
|
153
|
+
media_type: att.mediaType,
|
|
154
|
+
data: att.base64
|
|
155
|
+
}
|
|
156
|
+
}))
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
function toDocumentBlocks(): ChatDocumentBlock[] {
|
|
160
|
+
return attachments.value
|
|
161
|
+
.filter((a): a is PendingDocumentAttachment => a.kind === 'document')
|
|
162
|
+
.map(att => ({
|
|
163
|
+
type: 'document' as const,
|
|
164
|
+
source: att.sourceType === 'base64'
|
|
165
|
+
? { type: 'base64' as const, media_type: 'application/pdf' as const, data: att.data }
|
|
166
|
+
: { type: 'text' as const, media_type: 'text/plain' as const, data: att.data },
|
|
167
|
+
title: att.name
|
|
168
|
+
}))
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
return {
|
|
172
|
+
attachments: readonly(attachments),
|
|
173
|
+
addFiles,
|
|
174
|
+
removeAttachment,
|
|
175
|
+
clearAttachments,
|
|
176
|
+
toImageBlocks,
|
|
177
|
+
toDocumentBlocks
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/** Fallback for files with empty MIME but recognizable extensions */
|
|
182
|
+
function isLikelyTextFile(name: string): boolean {
|
|
183
|
+
const ext = name.split('.').pop()?.toLowerCase()
|
|
184
|
+
if (!ext) return false
|
|
185
|
+
const textExtensions = new Set([
|
|
186
|
+
'txt', 'md', 'js', 'ts', 'jsx', 'tsx', 'py', 'rb', 'rs', 'go',
|
|
187
|
+
'java', 'c', 'cpp', 'h', 'hpp', 'cs', 'swift', 'kt', 'scala',
|
|
188
|
+
'json', 'yaml', 'yml', 'toml', 'ini', 'cfg', 'conf',
|
|
189
|
+
'xml', 'html', 'htm', 'css', 'scss', 'sass', 'less',
|
|
190
|
+
'sh', 'bash', 'zsh', 'fish', 'ps1', 'bat', 'cmd',
|
|
191
|
+
'sql', 'graphql', 'gql', 'proto',
|
|
192
|
+
'csv', 'tsv', 'log', 'env', 'gitignore', 'dockerignore',
|
|
193
|
+
'vue', 'svelte', 'astro', 'prisma', 'tf', 'r', 'lua', 'dart'
|
|
194
|
+
])
|
|
195
|
+
return textExtensions.has(ext)
|
|
196
|
+
}
|
|
@@ -2,6 +2,8 @@ import type {
|
|
|
2
2
|
ChatConversation,
|
|
3
3
|
ChatMessage,
|
|
4
4
|
ChatContentBlock,
|
|
5
|
+
ChatImageBlock,
|
|
6
|
+
ChatDocumentBlock,
|
|
5
7
|
ChatServerMessage,
|
|
6
8
|
ChatSessionStatus,
|
|
7
9
|
ChatConnectionStatus
|
|
@@ -200,21 +202,31 @@ export function useChat() {
|
|
|
200
202
|
}
|
|
201
203
|
}
|
|
202
204
|
|
|
203
|
-
function sendMessage(message: string) {
|
|
205
|
+
function sendMessage(message: string, attachments?: ChatImageBlock[], documents?: ChatDocumentBlock[]) {
|
|
204
206
|
if (!ws.value || ws.value.readyState !== WebSocket.OPEN) return
|
|
205
207
|
|
|
208
|
+
// Build content blocks for local display
|
|
209
|
+
const content: ChatContentBlock[] = []
|
|
210
|
+
if (attachments?.length)
|
|
211
|
+
for (const img of attachments) content.push(img)
|
|
212
|
+
if (documents?.length)
|
|
213
|
+
for (const doc of documents) content.push(doc)
|
|
214
|
+
if (message) content.push({ type: 'text', text: message })
|
|
215
|
+
|
|
206
216
|
// Add user message locally
|
|
207
217
|
messages.value.push({
|
|
208
218
|
id: generateId(),
|
|
209
219
|
conversationId: activeConversationId.value || '',
|
|
210
220
|
role: 'user',
|
|
211
|
-
content
|
|
221
|
+
content,
|
|
212
222
|
createdAt: new Date()
|
|
213
223
|
})
|
|
214
224
|
|
|
215
225
|
ws.value.send(JSON.stringify({
|
|
216
226
|
type: 'chat:send',
|
|
217
227
|
message,
|
|
228
|
+
attachments: attachments?.length ? attachments : undefined,
|
|
229
|
+
documents: documents?.length ? documents : undefined,
|
|
218
230
|
conversationId: activeConversationId.value
|
|
219
231
|
}))
|
|
220
232
|
}
|
package/app/pages/chat.vue
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
import type { ChatImageBlock, ChatDocumentBlock } from '~~/shared/types'
|
|
3
|
+
|
|
2
4
|
definePageMeta({
|
|
3
5
|
layout: 'dashboard',
|
|
4
6
|
middleware: 'auth'
|
|
@@ -53,8 +55,8 @@ onMounted(() => {
|
|
|
53
55
|
}
|
|
54
56
|
})
|
|
55
57
|
|
|
56
|
-
function handleSend(message: string) {
|
|
57
|
-
sendMessage(message)
|
|
58
|
+
function handleSend(message: string, attachments?: ChatImageBlock[], documents?: ChatDocumentBlock[]) {
|
|
59
|
+
sendMessage(message, attachments, documents)
|
|
58
60
|
nextTick(scrollToBottom)
|
|
59
61
|
}
|
|
60
62
|
|
package/package.json
CHANGED
|
@@ -263,12 +263,19 @@ export class IMessageAdapter implements BridgeAdapter {
|
|
|
263
263
|
}
|
|
264
264
|
|
|
265
265
|
try {
|
|
266
|
+
// Format chatGuid if recipient is a bare phone number or email
|
|
267
|
+
const chatGuid = msg.recipient.includes(';')
|
|
268
|
+
? msg.recipient
|
|
269
|
+
: `iMessage;-;${msg.recipient.startsWith('+') ? msg.recipient : `+${msg.recipient}`}`
|
|
270
|
+
|
|
266
271
|
const resp = await fetch(`${this.bbUrl}/api/v1/message/text?password=${encodeURIComponent(this.bbPassword)}`, {
|
|
267
272
|
method: 'POST',
|
|
268
273
|
headers: { 'Content-Type': 'application/json' },
|
|
269
274
|
body: JSON.stringify({
|
|
270
|
-
chatGuid
|
|
271
|
-
|
|
275
|
+
chatGuid,
|
|
276
|
+
tempGuid: `temp-${randomBytes(16).toString('hex')}`,
|
|
277
|
+
message: msg.text,
|
|
278
|
+
method: 'private-api'
|
|
272
279
|
})
|
|
273
280
|
})
|
|
274
281
|
|
|
@@ -4,7 +4,8 @@ import { chatSessionManager } from '~~/server/utils/chat-session-manager'
|
|
|
4
4
|
import { getDb } from '~~/server/db'
|
|
5
5
|
import * as schema from '~~/server/db/schema'
|
|
6
6
|
import { logTokenUsage } from '~~/server/utils/log-token-usage'
|
|
7
|
-
import type { ChatClientMessage, ChatContentBlock } from '~~/shared/types'
|
|
7
|
+
import type { ChatClientMessage, ChatContentBlock, ChatImageBlock, ChatDocumentBlock } from '~~/shared/types'
|
|
8
|
+
import type { ContentBlockParam } from '@anthropic-ai/sdk/resources/messages/messages'
|
|
8
9
|
|
|
9
10
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10
11
|
function send(peer: any, data: object) {
|
|
@@ -16,6 +17,42 @@ function send(peer: any, data: object) {
|
|
|
16
17
|
}
|
|
17
18
|
}
|
|
18
19
|
|
|
20
|
+
function buildSdkContent(
|
|
21
|
+
message: string,
|
|
22
|
+
attachments?: ChatImageBlock[],
|
|
23
|
+
documents?: ChatDocumentBlock[]
|
|
24
|
+
): string | ContentBlockParam[] {
|
|
25
|
+
if (!attachments?.length && !documents?.length) return message
|
|
26
|
+
|
|
27
|
+
const blocks: ContentBlockParam[] = []
|
|
28
|
+
|
|
29
|
+
if (attachments?.length) {
|
|
30
|
+
for (const img of attachments) {
|
|
31
|
+
blocks.push({
|
|
32
|
+
type: 'image',
|
|
33
|
+
source: {
|
|
34
|
+
type: 'base64',
|
|
35
|
+
media_type: img.source.media_type,
|
|
36
|
+
data: img.source.data
|
|
37
|
+
}
|
|
38
|
+
})
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (documents?.length) {
|
|
43
|
+
for (const doc of documents) {
|
|
44
|
+
blocks.push({
|
|
45
|
+
type: 'document',
|
|
46
|
+
source: doc.source,
|
|
47
|
+
title: doc.title
|
|
48
|
+
})
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (message) blocks.push({ type: 'text', text: message })
|
|
53
|
+
return blocks
|
|
54
|
+
}
|
|
55
|
+
|
|
19
56
|
export default defineWebSocketHandler({
|
|
20
57
|
open(peer) {
|
|
21
58
|
console.log(`[chat] WebSocket opened: ${peer.id}`)
|
|
@@ -28,7 +65,7 @@ export default defineWebSocketHandler({
|
|
|
28
65
|
|
|
29
66
|
switch (msg.type) {
|
|
30
67
|
case 'chat:send':
|
|
31
|
-
handleSend(peer, msg.message, msg.conversationId)
|
|
68
|
+
handleSend(peer, msg.message, msg.conversationId, msg.attachments, msg.documents)
|
|
32
69
|
break
|
|
33
70
|
case 'chat:interrupt':
|
|
34
71
|
handleInterrupt(peer, msg.conversationId)
|
|
@@ -49,8 +86,14 @@ export default defineWebSocketHandler({
|
|
|
49
86
|
}
|
|
50
87
|
})
|
|
51
88
|
|
|
52
|
-
|
|
53
|
-
|
|
89
|
+
async function handleSend(
|
|
90
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
91
|
+
peer: any,
|
|
92
|
+
message: string,
|
|
93
|
+
conversationId?: string,
|
|
94
|
+
attachments?: ChatImageBlock[],
|
|
95
|
+
documents?: ChatDocumentBlock[]
|
|
96
|
+
) {
|
|
54
97
|
const db = getDb()
|
|
55
98
|
|
|
56
99
|
let convId = conversationId
|
|
@@ -61,7 +104,7 @@ async function handleSend(peer: any, message: string, conversationId?: string) {
|
|
|
61
104
|
const [conv] = await db.insert(schema.conversations)
|
|
62
105
|
.values({
|
|
63
106
|
sessionId: randomUUID(),
|
|
64
|
-
title: message.slice(0, 100),
|
|
107
|
+
title: message.slice(0, 100) || 'File attachment',
|
|
65
108
|
status: 'streaming',
|
|
66
109
|
messageCount: 0,
|
|
67
110
|
totalCostUsd: 0
|
|
@@ -93,16 +136,27 @@ async function handleSend(peer: any, message: string, conversationId?: string) {
|
|
|
93
136
|
.where(eq(schema.conversations.id, convId))
|
|
94
137
|
}
|
|
95
138
|
|
|
139
|
+
// Build content blocks for persistence
|
|
140
|
+
const userContent: ChatContentBlock[] = []
|
|
141
|
+
if (attachments?.length)
|
|
142
|
+
for (const img of attachments) userContent.push(img)
|
|
143
|
+
if (documents?.length)
|
|
144
|
+
for (const doc of documents) userContent.push(doc)
|
|
145
|
+
if (message) userContent.push({ type: 'text', text: message })
|
|
146
|
+
|
|
96
147
|
// Persist user message
|
|
97
148
|
await db.insert(schema.conversationMessages).values({
|
|
98
149
|
conversationId: convId,
|
|
99
150
|
role: 'user',
|
|
100
|
-
content: JSON.stringify(
|
|
151
|
+
content: JSON.stringify(userContent),
|
|
101
152
|
source: 'web'
|
|
102
153
|
})
|
|
103
154
|
|
|
155
|
+
// Build prompt for SDK (string for text-only, ContentBlockParam[] for multimodal)
|
|
156
|
+
const prompt = buildSdkContent(message, attachments, documents)
|
|
157
|
+
|
|
104
158
|
// Start SDK streaming (fire-and-forget so WS stays responsive for interrupts)
|
|
105
|
-
const session = chatSessionManager.startSession(convId,
|
|
159
|
+
const session = chatSessionManager.startSession(convId, prompt, resumeSessionId)
|
|
106
160
|
send(peer, { type: 'chat:stream_start', conversationId: convId })
|
|
107
161
|
|
|
108
162
|
streamSDKResponse(peer, session, convId).catch((err) => {
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { query } from '@anthropic-ai/claude-agent-sdk'
|
|
2
|
+
import type { SDKUserMessage } from '@anthropic-ai/claude-agent-sdk'
|
|
3
|
+
import type { ContentBlockParam } from '@anthropic-ai/sdk/resources/messages/messages'
|
|
4
|
+
|
|
5
|
+
export type PromptInput = string | ContentBlockParam[]
|
|
2
6
|
|
|
3
7
|
interface ActiveSession {
|
|
4
8
|
conversationId: string
|
|
@@ -8,15 +12,29 @@ interface ActiveSession {
|
|
|
8
12
|
startedAt: Date
|
|
9
13
|
}
|
|
10
14
|
|
|
15
|
+
async function* createMultimodalPrompt(content: ContentBlockParam[]): AsyncGenerator<SDKUserMessage> {
|
|
16
|
+
yield {
|
|
17
|
+
type: 'user',
|
|
18
|
+
message: { role: 'user', content },
|
|
19
|
+
parent_tool_use_id: null,
|
|
20
|
+
session_id: ''
|
|
21
|
+
} as SDKUserMessage
|
|
22
|
+
}
|
|
23
|
+
|
|
11
24
|
class ChatSessionManager {
|
|
12
25
|
private sessions = new Map<string, ActiveSession>()
|
|
13
26
|
|
|
14
|
-
startSession(conversationId: string, prompt:
|
|
27
|
+
startSession(conversationId: string, prompt: PromptInput, resumeSessionId?: string): ActiveSession {
|
|
15
28
|
// Use the project directory as CWD so the SDK picks up .claude/ (skills, rules, CLAUDE.md)
|
|
16
29
|
// The vault is accessible via VAULT_PATH env var in tools
|
|
17
30
|
const projectDir = process.env.COGNOVA_PROJECT_DIR || process.cwd()
|
|
31
|
+
|
|
32
|
+
const promptArg = typeof prompt === 'string'
|
|
33
|
+
? prompt
|
|
34
|
+
: createMultimodalPrompt(prompt)
|
|
35
|
+
|
|
18
36
|
const conversation = query({
|
|
19
|
-
prompt,
|
|
37
|
+
prompt: promptArg,
|
|
20
38
|
options: {
|
|
21
39
|
cwd: projectDir,
|
|
22
40
|
settingSources: ['user', 'project'],
|
package/shared/types/index.ts
CHANGED
|
@@ -689,7 +689,31 @@ export interface ChatToolResultBlock {
|
|
|
689
689
|
is_error?: boolean
|
|
690
690
|
}
|
|
691
691
|
|
|
692
|
-
export type
|
|
692
|
+
export type ChatImageMediaType = 'image/jpeg' | 'image/png' | 'image/gif' | 'image/webp'
|
|
693
|
+
|
|
694
|
+
export interface ChatImageBlock {
|
|
695
|
+
type: 'image'
|
|
696
|
+
source: {
|
|
697
|
+
type: 'base64'
|
|
698
|
+
media_type: ChatImageMediaType
|
|
699
|
+
data: string
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
export interface ChatDocumentBlock {
|
|
704
|
+
type: 'document'
|
|
705
|
+
source:
|
|
706
|
+
| { type: 'base64', media_type: 'application/pdf', data: string }
|
|
707
|
+
| { type: 'text', media_type: 'text/plain', data: string }
|
|
708
|
+
title?: string
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
export type ChatContentBlock
|
|
712
|
+
= ChatTextBlock
|
|
713
|
+
| ChatImageBlock
|
|
714
|
+
| ChatDocumentBlock
|
|
715
|
+
| ChatToolUseBlock
|
|
716
|
+
| ChatToolResultBlock
|
|
693
717
|
|
|
694
718
|
export type MessageSource = 'web' | 'telegram' | 'discord' | 'imessage' | 'email' | 'google'
|
|
695
719
|
|
|
@@ -724,6 +748,8 @@ export interface ChatConversation {
|
|
|
724
748
|
export interface ChatSendMessage {
|
|
725
749
|
type: 'chat:send'
|
|
726
750
|
message: string
|
|
751
|
+
attachments?: ChatImageBlock[]
|
|
752
|
+
documents?: ChatDocumentBlock[]
|
|
727
753
|
conversationId?: string
|
|
728
754
|
}
|
|
729
755
|
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{_ as J}from"./JbHa4oXq.js";import{_ as X,a as Y}from"./CqNwHCpo.js";import{_ as Z}from"./C3NST0BU.js";import{_ as ee}from"./wO6z2ugJ.js";import{_ as te}from"./XCjS70z4.js";import{_ as oe}from"./BmOtR1wX.js";import{e as u,ah as ae,c as ne,a as re,ag as le,f as S,q as se,G as k,T as l,S as a,C as c,ai as w,R as _,ab as s,Q as U,aj as ce,ak as ie,_ as ue,W as me,ae as y,aV as de,aa as M,a9 as pe,aW as fe}from"./2dNDtTiv.js";import{_ as _e}from"./CuxrHsu-.js";import{_ as ye}from"./DwY7rCd_.js";import{_ as he}from"./D_4LPm1U.js";import{f as ve}from"./CWePHsZr.js";import"./D5jZq8b3.js";import"./DhI5cA_n.js";import"./DEd2xVbS.js";import"./BIXrSYwR.js";import"./DmmdPt_5.js";import"./apYB9dr5.js";import"./H6JbrRBU.js";import"./Db4KMnt8.js";import"./CQqCBrXj.js";import"./DUAAXJ6Q.js";import"./CWyMCJQH.js";import"./DS2wStH1.js";import"./C6Y-ieo6.js";import"./CYPO5o_C.js";import"./D8lwrAYS.js";import"./88opOQSr.js";import"./BS2ZNXI1.js";import"./B93pdGAW.js";import"./BA_pRWwX.js";import"./BZrSPX0S.js";import"./C8ut0f5H.js";function ge(){const m=u([]),d=u(!0),p=u(null),g=ae({query:"",chunkType:"all",limit:50});async function b(i){d.value=!0,p.value=null;const e={...g,...i};try{const o={};e.query&&(o.query=e.query),e.chunkType&&e.chunkType!=="all"&&(o.chunkType=e.chunkType),e.projectPath&&(o.projectPath=e.projectPath),e.limit&&(o.limit=String(e.limit));const f=await $fetch("/api/memory/search",{query:o});return m.value=f.data,f.data}catch(o){throw p.value="Failed to load memories",console.error("Failed to load memories:",o),o}finally{d.value=!1}}async function T(i){try{await $fetch(`/api/memory/${i}`,{method:"DELETE"}),m.value=m.value.filter(e=>e.id!==i)}catch(e){throw console.error("Failed to delete memory:",e),e}}const h=ne(()=>{const i=m.value.reduce((e,o)=>(e[o.chunkType]=(e[o.chunkType]||0)+1,e),{});return{total:m.value.length,byType:i}});return{memories:m,loading:d,error:p,filters:g,stats:h,fetchMemories:b,deleteMemory:T}}const be={class:"contents"},Te={class:"p-4"},xe={key:0,class:"space-y-3"},ke={key:1,class:"flex flex-col items-center justify-center h-64 text-neutral-500"},we=["title"],De={class:"flex items-center gap-2"},$e={class:"w-16 h-1.5 bg-neutral-200 dark:bg-neutral-700 rounded-full overflow-hidden"},Ce={class:"text-xs text-muted"},Se={class:"text-sm text-muted"},Ue={class:"text-sm text-muted"},D="__all__",ct=re({__name:"memories",setup(m){const d=le(),{memories:p,loading:g,filters:b,stats:T,fetchMemories:h,deleteMemory:i}=ge(),e=u(!1),o=u(null),f=u(!1),V=[{value:D,label:"All Types"},{value:"decision",label:"Decisions"},{value:"fact",label:"Facts"},{value:"solution",label:"Solutions"},{value:"pattern",label:"Patterns"},{value:"preference",label:"Preferences"},{value:"summary",label:"Summaries"}],x=u(D),v=u("");S(x,n=>{b.chunkType=n===D?"all":n,h()});const F=fe(()=>{b.query=v.value||void 0,h()},300);S(v,F);function q(n){o.value=n,e.value=!0}async function A(){if(o.value){f.value=!0;try{await i(o.value),d.add({title:"Memory deleted",color:"success"}),e.value=!1}catch{d.add({title:"Failed to delete memory",color:"error"})}finally{f.value=!1,o.value=null}}}function N(n){switch(n){case"decision":return"primary";case"fact":return"info";case"solution":return"success";case"pattern":return"warning";case"preference":return"neutral";case"summary":return"neutral";default:return"neutral"}}function B(n){switch(n){case"decision":return"i-lucide-git-branch";case"fact":return"i-lucide-info";case"solution":return"i-lucide-check-circle";case"pattern":return"i-lucide-repeat";case"preference":return"i-lucide-settings";case"summary":return"i-lucide-file-text";default:return"i-lucide-circle"}}function K(n){return ve(new Date(n),{addSuffix:!0})}const L=[{accessorKey:"chunkType",header:"Type"},{accessorKey:"content",header:"Content"},{accessorKey:"relevanceScore",header:"Relevance"},{accessorKey:"accessCount",header:"Accessed"},{accessorKey:"createdAt",header:"Created"},{accessorKey:"actions",header:""}];function P(n){return[[{label:"Delete",icon:"i-lucide-trash-2",color:"error",onSelect:()=>q(n)}]]}return se(()=>{h()}),(n,r)=>{const $=J,j=Y,E=Z,z=ee,I=te,R=oe,C=ue,Q=me,W=_e,G=ye,O=X,H=he;return _(),k("div",be,[l(O,{id:"memories",grow:""},{header:a(()=>[l(j,{title:"Memories"},{leading:a(()=>[c(T).total>0?(_(),U($,{key:0,color:"neutral",variant:"subtle",class:"ml-2"},{default:a(()=>[M(y(c(T).total),1)]),_:1})):pe("",!0)]),_:1}),l(I,null,{left:a(()=>[l(E,{modelValue:c(x),"onUpdate:modelValue":r[0]||(r[0]=t=>w(x)?x.value=t:null),items:V,"value-key":"value",class:"w-40"},null,8,["modelValue"])]),right:a(()=>[l(z,{modelValue:c(v),"onUpdate:modelValue":r[1]||(r[1]=t=>w(v)?v.value=t:null),placeholder:"Search memories...",icon:"i-lucide-search",class:"w-64"},null,8,["modelValue"])]),_:1})]),body:a(()=>[s("div",Te,[c(g)?(_(),k("div",xe,[(_(),k(ce,null,ie(10,t=>l(R,{key:t,class:"h-12 w-full"})),64))])):c(p).length===0?(_(),k("div",ke,[l(C,{name:"i-lucide-brain",class:"w-12 h-12 mb-4"}),r[4]||(r[4]=s("p",{class:"text-lg font-medium"}," No memories yet ",-1)),r[5]||(r[5]=s("p",{class:"text-sm text-center max-w-md mt-2"}," Memories are automatically extracted from your Claude conversations. They will appear here once extraction hooks are triggered. ",-1))])):(_(),U(G,{key:2,data:c(p),columns:L},{"chunkType-cell":a(({row:t})=>[l($,{color:N(t.original.chunkType),variant:"subtle",size:"sm"},{default:a(()=>[l(C,{name:B(t.original.chunkType),class:"w-3 h-3 mr-1"},null,8,["name"]),M(" "+y(t.original.chunkType),1)]),_:2},1032,["color"])]),"content-cell":a(({row:t})=>[s("span",{class:"text-sm line-clamp-2",title:t.original.content},y(t.original.content),9,we)]),"relevanceScore-cell":a(({row:t})=>[s("div",De,[s("div",$e,[s("div",{class:"h-full bg-primary-500 rounded-full",style:de({width:`${t.original.relevanceScore*100}%`})},null,4)]),s("span",Ce,y((t.original.relevanceScore*100).toFixed(0))+"% ",1)])]),"accessCount-cell":a(({row:t})=>[s("span",Se,y(t.original.accessCount)+"x ",1)]),"createdAt-cell":a(({row:t})=>[s("span",Ue,y(K(t.original.createdAt)),1)]),"actions-cell":a(({row:t})=>[l(W,{items:P(t.original.id)},{default:a(()=>[l(Q,{icon:"i-lucide-more-horizontal",color:"neutral",variant:"ghost",size:"xs"})]),_:1},8,["items"])]),_:1},8,["data"]))])]),_:1}),l(H,{open:c(e),"onUpdate:open":r[2]||(r[2]=t=>w(e)?e.value=t:null),title:"Delete Memory",description:"Are you sure you want to delete this memory? This action cannot be undone.","confirm-label":"Delete","confirm-color":"error",icon:"i-lucide-trash-2",loading:c(f),onConfirm:A,onCancel:r[3]||(r[3]=t=>o.value=null)},null,8,["open","loading"])])}}});export{ct as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{d as a,n as i}from"./2dNDtTiv.js";import{u}from"./BKXg-alD.js";const r=a(()=>{const{isAuthenticated:e,isPending:t}=u();if(!t.value&&!e.value)return i("/login")});export{r as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as y,a_ as m,Q as p,R as f,S as d,a4 as v,V as g,C as e,a3 as O,q as P,a0 as B,T as E,bG as $,bH as q,e as F,bf as A,a9 as M}from"./2dNDtTiv.js";import{i as D}from"./BA_pRWwX.js";import{F as k,u as h,a as R}from"./H6JbrRBU.js";import{u as w}from"./CWyMCJQH.js";import{g as K}from"./DUAAXJ6Q.js";var T=y({__name:"DialogClose",props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:"button"}},setup(i){const l=i;m();const a=D();return(t,s)=>(f(),p(e(O),g(l,{type:t.as==="button"?"button":void 0,onClick:s[0]||(s[0]=c=>e(a).onOpenChange(!1))}),{default:d(()=>[v(t.$slots,"default")]),_:3},16,["type"]))}}),te=T,N=y({__name:"DialogContentImpl",props:{forceMount:{type:Boolean,required:!1},trapFocus:{type:Boolean,required:!1},disableOutsidePointerEvents:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:["escapeKeyDown","pointerDownOutside","focusOutside","interactOutside","openAutoFocus","closeAutoFocus"],setup(i,{emit:l}){const a=i,t=l,s=D(),{forwardRef:c,currentElement:_}=m();return s.titleId||=w(void 0,"reka-dialog-title"),s.descriptionId||=w(void 0,"reka-dialog-description"),P(()=>{s.contentElement=_,B()!==document.body&&(s.triggerElement.value=B())}),(n,r)=>(f(),p(e(k),{"as-child":"",loop:"",trapped:a.trapFocus,onMountAutoFocus:r[5]||(r[5]=o=>t("openAutoFocus",o)),onUnmountAutoFocus:r[6]||(r[6]=o=>t("closeAutoFocus",o))},{default:d(()=>[E(e($),g({id:e(s).contentId,ref:e(c),as:n.as,"as-child":n.asChild,"disable-outside-pointer-events":n.disableOutsidePointerEvents,role:"dialog","aria-describedby":e(s).descriptionId,"aria-labelledby":e(s).titleId,"data-state":e(K)(e(s).open.value)},n.$attrs,{onDismiss:r[0]||(r[0]=o=>e(s).onOpenChange(!1)),onEscapeKeyDown:r[1]||(r[1]=o=>t("escapeKeyDown",o)),onFocusOutside:r[2]||(r[2]=o=>t("focusOutside",o)),onInteractOutside:r[3]||(r[3]=o=>t("interactOutside",o)),onPointerDownOutside:r[4]||(r[4]=o=>t("pointerDownOutside",o))}),{default:d(()=>[v(n.$slots,"default")]),_:3},16,["id","as","as-child","disable-outside-pointer-events","aria-describedby","aria-labelledby","data-state"])]),_:3},8,["trapped"]))}}),I=N,S=y({__name:"DialogContentModal",props:{forceMount:{type:Boolean,required:!1},trapFocus:{type:Boolean,required:!1},disableOutsidePointerEvents:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:["escapeKeyDown","pointerDownOutside","focusOutside","interactOutside","openAutoFocus","closeAutoFocus"],setup(i,{emit:l}){const a=i,t=l,s=D(),c=q(t),{forwardRef:_,currentElement:n}=m();return h(n),(r,o)=>(f(),p(I,g({...a,...e(c)},{ref:e(_),"trap-focus":e(s).open.value,"disable-outside-pointer-events":!0,onCloseAutoFocus:o[0]||(o[0]=u=>{u.defaultPrevented||(u.preventDefault(),e(s).triggerElement.value?.focus())}),onPointerDownOutside:o[1]||(o[1]=u=>{const C=u.detail.originalEvent,b=C.button===0&&C.ctrlKey===!0;(C.button===2||b)&&u.preventDefault()}),onFocusOutside:o[2]||(o[2]=u=>{u.preventDefault()})}),{default:d(()=>[v(r.$slots,"default")]),_:3},16,["trap-focus"]))}}),L=S,V=y({__name:"DialogContentNonModal",props:{forceMount:{type:Boolean,required:!1},trapFocus:{type:Boolean,required:!1},disableOutsidePointerEvents:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:["escapeKeyDown","pointerDownOutside","focusOutside","interactOutside","openAutoFocus","closeAutoFocus"],setup(i,{emit:l}){const a=i,s=q(l);m();const c=D(),_=F(!1),n=F(!1);return(r,o)=>(f(),p(I,g({...a,...e(s)},{"trap-focus":!1,"disable-outside-pointer-events":!1,onCloseAutoFocus:o[0]||(o[0]=u=>{u.defaultPrevented||(_.value||e(c).triggerElement.value?.focus(),u.preventDefault()),_.value=!1,n.value=!1}),onInteractOutside:o[1]||(o[1]=u=>{u.defaultPrevented||(_.value=!0,u.detail.originalEvent.type==="pointerdown"&&(n.value=!0));const C=u.target;e(c).triggerElement.value?.contains(C)&&u.preventDefault(),u.detail.originalEvent.type==="focusin"&&n.value&&u.preventDefault()})}),{default:d(()=>[v(r.$slots,"default")]),_:3},16))}}),H=V,j=y({__name:"DialogContent",props:{forceMount:{type:Boolean,required:!1},disableOutsidePointerEvents:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:["escapeKeyDown","pointerDownOutside","focusOutside","interactOutside","openAutoFocus","closeAutoFocus"],setup(i,{emit:l}){const a=i,t=l,s=D(),c=q(t),{forwardRef:_}=m();return(n,r)=>(f(),p(e(A),{present:n.forceMount||e(s).open.value},{default:d(()=>[e(s).modal.value?(f(),p(L,g({key:0,ref:e(_)},{...a,...e(c),...n.$attrs}),{default:d(()=>[v(n.$slots,"default")]),_:3},16)):(f(),p(H,g({key:1,ref:e(_)},{...a,...e(c),...n.$attrs}),{default:d(()=>[v(n.$slots,"default")]),_:3},16))]),_:3},8,["present"]))}}),oe=j,G=y({__name:"DialogDescription",props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:"p"}},setup(i){const l=i;m();const a=D();return(t,s)=>(f(),p(e(O),g(l,{id:e(a).descriptionId}),{default:d(()=>[v(t.$slots,"default")]),_:3},16,["id"]))}}),se=G,Q=y({__name:"DialogOverlayImpl",props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(i){const l=D();return R(!0),m(),(a,t)=>(f(),p(e(O),{as:a.as,"as-child":a.asChild,"data-state":e(l).open.value?"open":"closed",style:{"pointer-events":"auto"}},{default:d(()=>[v(a.$slots,"default")]),_:3},8,["as","as-child","data-state"]))}}),U=Q,z=y({__name:"DialogOverlay",props:{forceMount:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(i){const l=D(),{forwardRef:a}=m();return(t,s)=>e(l)?.modal.value?(f(),p(e(A),{key:0,present:t.forceMount||e(l).open.value},{default:d(()=>[E(U,g(t.$attrs,{ref:e(a),as:t.as,"as-child":t.asChild}),{default:d(()=>[v(t.$slots,"default")]),_:3},16,["as","as-child"])]),_:3},8,["present"])):M("v-if",!0)}}),ae=z,J=y({__name:"DialogTitle",props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:"h2"}},setup(i){const l=i,a=D();return m(),(t,s)=>(f(),p(e(O),g(l,{id:e(a).titleId}),{default:d(()=>[v(t.$slots,"default")]),_:3},16,["id"]))}}),re=J;export{oe as D,re as a,se as b,te as c,ae as d};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./2dNDtTiv.js";const s=globalThis.setInterval;export{s};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as I,G as i,R as s,ab as n,T as c,W as M,a9 as u,aj as z,ak as q,U as K,Q as h,aa as j,ae as b,al as X,_ as L,bg as Y,an as Z,e as ee,q as te,f as S,c as se,S as g,C as e,k as N}from"./2dNDtTiv.js";import{_ as oe,a as ne}from"./CqNwHCpo.js";import{_ as ae}from"./JbHa4oXq.js";import{u as ie,_ as re,a as le,b as ce}from"./DPklr_tJ.js";import"./D5jZq8b3.js";import"./DhI5cA_n.js";import"./DEd2xVbS.js";import"./YX8avsvq.js";import"./88opOQSr.js";import"./iik6CYzq.js";import"./t8aDAkZ5.js";import"./BHtY0l0l.js";import"./BaZwjF8o.js";const ue={class:"flex flex-col h-full"},de={class:"p-3 border-b border-default"},me={class:"flex-1 overflow-y-auto"},_e={key:0,class:"p-4 text-sm text-dimmed text-center"},fe=["onClick"],pe={class:"flex items-start justify-between gap-2"},ge={class:"flex items-center gap-1.5 truncate text-sm font-medium"},he={class:"flex items-center gap-2 mt-1 text-xs text-dimmed"},ve={key:0},xe={key:1},Ce=I({__name:"ConversationList",props:{conversations:{},activeId:{}},emits:["select","delete","new"],setup(v,{emit:_}){const r=_;function f(p){const l=new Date(p),a=new Date().getTime()-l.getTime();return a<6e4?"just now":a<36e5?`${Math.floor(a/6e4)}m ago`:a<864e5?`${Math.floor(a/36e5)}h ago`:l.toLocaleDateString()}return(p,l)=>{const m=M,a=L;return s(),i("div",ue,[n("div",de,[c(m,{label:"New Chat",icon:"i-lucide-plus",color:"primary",variant:"soft",block:"",onClick:l[0]||(l[0]=t=>r("new"))})]),n("div",me,[v.conversations.length===0?(s(),i("div",_e," No conversations yet ")):u("",!0),(s(!0),i(z,null,q(v.conversations,t=>(s(),i("button",{key:t.id,class:K(["w-full p-3 text-left border-b border-default hover:bg-elevated/50 transition-colors group",{"bg-elevated/50":v.activeId===t.id}]),onClick:x=>r("select",t.id)},[n("div",pe,[n("div",ge,[t.isMain?(s(),h(a,{key:0,name:"i-lucide-pin",class:"size-3.5 text-primary shrink-0"})):u("",!0),j(" "+b(t.title||"Untitled"),1)]),t.isMain?u("",!0):(s(),h(m,{key:0,icon:"i-lucide-trash-2",variant:"ghost",color:"error",size:"xs",class:"opacity-0 group-hover:opacity-100 shrink-0",onClick:X(x=>r("delete",t.id),["stop"])},null,8,["onClick"]))]),n("div",he,[n("span",null,b(f(t.startedAt)),1),t.messageCount?(s(),i("span",ve,b(t.messageCount)+" msgs",1)):u("",!0),t.totalCostUsd>0?(s(),i("span",xe,"$"+b(t.totalCostUsd.toFixed(4)),1)):u("",!0)])],10,fe))),128))])])}}}),be=Object.assign(Ce,{__name:"ChatConversationList"}),ke={class:"flex flex-1 min-w-0"},ye={class:"flex flex-col h-full"},we={key:0,class:"flex flex-col items-center justify-center h-full text-dimmed"},Ve=I({__name:"chat",setup(v){const{connectionStatus:_,sessionStatus:r,activeConversationId:f,messages:p,conversations:l,streamingText:m,streamingToolCalls:a,connect:t,sendMessage:x,interrupt:V,startNewConversation:k,loadConversation:U,loadConversations:R,deleteConversation:F}=ie(),y=Y(),T=Z(),C=ee(null);te(()=>{if(t(),R(),y.query.conversation){const d=y.query.conversation,o=S(_,$=>{$==="connected"&&(o(),U(d),T.replace({query:{}}))},{immediate:!0})}else if(y.query.onboarding){const d=S(_,o=>{o==="connected"&&(d(),k(),x("Hello!"),N(w),T.replace({query:{}}))},{immediate:!0})}});function H(d){x(d),N(w)}function w(){C.value&&(C.value.scrollTop=C.value.scrollHeight)}S(m,()=>N(w));const A=se(()=>f.value?l.value.find(o=>o.id===f.value)?.title||"Chat":"New Chat");return(d,o)=>{const $=be,B=oe,E=ae,G=M,O=ne,P=L,Q=re,W=le,J=ce;return s(),i("div",ke,[c(B,{id:"chat-sidebar","default-size":20,"min-size":15,"max-size":30,collapsible:"",resizable:"",class:"hidden lg:flex"},{default:g(()=>[c($,{conversations:e(l),"active-id":e(f),onSelect:e(U),onDelete:e(F),onNew:e(k)},null,8,["conversations","active-id","onSelect","onDelete","onNew"])]),_:1}),c(B,{id:"chat-main",grow:""},{header:g(()=>[c(O,{title:e(A)},{right:g(()=>[e(r)==="streaming"?(s(),h(E,{key:0,color:"warning",variant:"subtle"},{default:g(()=>[...o[0]||(o[0]=[j(" Streaming ",-1)])]),_:1})):u("",!0),c(G,{icon:"i-lucide-plus",variant:"ghost",color:"neutral",class:"lg:hidden",onClick:e(k)},null,8,["onClick"])]),_:1},8,["title"])]),default:g(()=>[n("div",ye,[n("div",{ref_key:"messagesContainer",ref:C,class:"flex-1 overflow-y-auto p-4 space-y-4"},[e(p).length===0&&e(r)!=="streaming"?(s(),i("div",we,[c(P,{name:"i-lucide-message-square",class:"size-12 mb-4"}),o[1]||(o[1]=n("p",{class:"text-lg font-medium"}," Start a conversation ",-1)),o[2]||(o[2]=n("p",{class:"text-sm mt-1"}," Send a message to start chatting with Claude ",-1))])):u("",!0),(s(!0),i(z,null,q(e(p),D=>(s(),h(Q,{key:D.id,message:D},null,8,["message"]))),128)),e(r)==="streaming"?(s(),h(W,{key:1,text:e(m),"tool-calls":e(a)},null,8,["text","tool-calls"])):u("",!0)],512),c(J,{"session-status":e(r),"connection-status":e(_),onSend:H,onInterrupt:e(V)},null,8,["session-status","connection-status","onInterrupt"])])]),_:1})])}}});export{Ve as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a6 as Ye,a as D,aR as ce,aP as Ve,aQ as Le,e as B,c as j,a8 as Ee,a1 as pe,Q as _,R as o,S as b,a4 as C,a9 as W,C as e,G as R,aj as ae,ak as ve,V as E,f as Be,ab as ye,aM as Qe,O as Me,y as Xe,T as V,al as de,bG as Je,au as Ze,a5 as et,a_ as be,q as le,k as ue,bB as tt,a3 as X,aV as at,aN as _e,aJ as Ke,aO as Pe,bf as lt,bU as it,bo as nt,a0 as rt,a2 as ot,b6 as st,ao as ut,N as dt,aI as ct,aK as pt,aC as re,aT as Oe,aF as ft,av as gt,aw as mt,am as $e,b7 as vt,aG as yt,U as O,_ as me,ax as De,ae as oe,aa as ke,Y as se,bV as ht,bW as Re,aH as bt}from"./2dNDtTiv.js";import{u as _t}from"./BIXrSYwR.js";import{u as St}from"./DmmdPt_5.js";import{a as xt,b as qt,P as Ct,c as It}from"./apYB9dr5.js";import{a as wt,u as Tt,F as kt}from"./H6JbrRBU.js";import{u as zt}from"./Db4KMnt8.js";import{u as We}from"./CQqCBrXj.js";import{f as Fe}from"./DUAAXJ6Q.js";import{u as Ae}from"./CWyMCJQH.js";function Ne(i,s=Number.NEGATIVE_INFINITY,a=Number.POSITIVE_INFINITY){return Math.min(a,Math.max(s,i))}const Bt=[" ","Enter","ArrowUp","ArrowDown"],Pt=[" ","Enter"],U=10;function he(i,s,a){return i===void 0?!1:Array.isArray(i)?i.some(t=>ze(t,s,a)):ze(i,s,a)}function ze(i,s,a){return i===void 0||s===void 0?!1:typeof i=="string"?i===s:typeof a=="function"?a(i,s):typeof a=="string"?i?.[a]===s?.[a]:Ye(i,s)}function At(i){return i==null||i===""||Array.isArray(i)&&i.length===0}const Lt={key:0,value:""},[J,He]=ce("SelectRoot");var Et=D({inheritAttrs:!1,__name:"SelectRoot",props:{open:{type:Boolean,required:!1,default:void 0},defaultOpen:{type:Boolean,required:!1},defaultValue:{type:null,required:!1},modelValue:{type:null,required:!1,default:void 0},by:{type:[String,Function],required:!1},dir:{type:String,required:!1},multiple:{type:Boolean,required:!1},autocomplete:{type:String,required:!1},disabled:{type:Boolean,required:!1},name:{type:String,required:!1},required:{type:Boolean,required:!1}},emits:["update:modelValue","update:open"],setup(i,{emit:s}){const a=i,t=s,{required:r,disabled:u,multiple:m,dir:S}=Ve(a),v=Le(a,"modelValue",t,{defaultValue:a.defaultValue??(m.value?[]:void 0),passive:a.modelValue===void 0,deep:!0}),y=Le(a,"open",t,{defaultValue:a.defaultOpen,passive:a.open===void 0}),k=B(),w=B(),x=B({x:0,y:0}),I=j(()=>m.value&&Array.isArray(v.value)?v.value?.length===0:Ee(v.value));pe({isProvider:!0});const c=_t(S),$=St(k),A=B(new Set),G=j(()=>Array.from(A.value).map(n=>n.value).join(";"));function M(n){if(m.value){const h=Array.isArray(v.value)?[...v.value]:[],d=h.findIndex(f=>ze(f,n,a.by));d===-1?h.push(n):h.splice(d,1),v.value=[...h]}else v.value=n}function P(n){return Array.from(A.value).find(h=>he(n,h.value,a.by))}return He({triggerElement:k,onTriggerChange:n=>{k.value=n},valueElement:w,onValueElementChange:n=>{w.value=n},contentId:"",modelValue:v,onValueChange:M,by:a.by,open:y,multiple:m,required:r,onOpenChange:n=>{y.value=n},dir:c,triggerPointerDownPosRef:x,disabled:u,isEmptyModelValue:I,optionsSet:A,onOptionAdd:n=>{const h=P(n.value);h&&A.value.delete(h),A.value.add(n)},onOptionRemove:n=>{const h=P(n.value);h&&A.value.delete(h)}}),(n,h)=>(o(),_(e(xt),null,{default:b(()=>[C(n.$slots,"default",{modelValue:e(v),open:e(y)}),e($)?(o(),_(Dt,{key:G.value,"aria-hidden":"true",tabindex:"-1",multiple:e(m),required:e(r),name:n.name,autocomplete:n.autocomplete,disabled:e(u),value:e(v)},{default:b(()=>[e(Ee)(e(v))?(o(),R("option",Lt)):W("v-if",!0),(o(!0),R(ae,null,ve(Array.from(A.value),d=>(o(),R("option",E({key:d.value??""},{ref_for:!0},d),null,16))),128))]),_:1},8,["multiple","required","name","autocomplete","disabled","value"])):W("v-if",!0)]),_:3}))}}),Ot=Et,$t=D({__name:"BubbleSelect",props:{autocomplete:{type:String,required:!1},autofocus:{type:Boolean,required:!1},disabled:{type:Boolean,required:!1},form:{type:String,required:!1},multiple:{type:Boolean,required:!1},name:{type:String,required:!1},required:{type:Boolean,required:!1},size:{type:Number,required:!1},value:{type:null,required:!1}},setup(i){const s=i,a=B(),t=J();Be(()=>s.value,(u,m)=>{const S=window.HTMLSelectElement.prototype,y=Object.getOwnPropertyDescriptor(S,"value").set;if(u!==m&&y&&a.value){const k=new Event("change",{bubbles:!0});y.call(a.value,u),a.value.dispatchEvent(k)}});function r(u){t.onValueChange(u.target.value)}return(u,m)=>(o(),_(e(Qe),{"as-child":""},{default:b(()=>[ye("select",E({ref_key:"selectElement",ref:a},s,{onInput:r}),[C(u.$slots,"default")],16)]),_:3}))}}),Dt=$t,Rt=D({__name:"SelectPopperPosition",props:{side:{type:null,required:!1},sideOffset:{type:Number,required:!1},sideFlip:{type:Boolean,required:!1},align:{type:null,required:!1,default:"start"},alignOffset:{type:Number,required:!1},alignFlip:{type:Boolean,required:!1},avoidCollisions:{type:Boolean,required:!1},collisionBoundary:{type:null,required:!1},collisionPadding:{type:[Number,Object],required:!1,default:U},arrowPadding:{type:Number,required:!1},sticky:{type:String,required:!1},hideWhenDetached:{type:Boolean,required:!1},positionStrategy:{type:String,required:!1},updatePositionStrategy:{type:String,required:!1},disableUpdateOnLayoutShift:{type:Boolean,required:!1},prioritizePosition:{type:Boolean,required:!1},reference:{type:null,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(i){const a=Me(i);return(t,r)=>(o(),_(e(qt),E(e(a),{style:{boxSizing:"border-box","--reka-select-content-transform-origin":"var(--reka-popper-transform-origin)","--reka-select-content-available-width":"var(--reka-popper-available-width)","--reka-select-content-available-height":"var(--reka-popper-available-height)","--reka-select-trigger-width":"var(--reka-popper-anchor-width)","--reka-select-trigger-height":"var(--reka-popper-anchor-height)"}}),{default:b(()=>[C(t.$slots,"default")]),_:3},16))}}),Ft=Rt;const je={onViewportChange:()=>{},itemTextRefCallback:()=>{},itemRefCallback:()=>{}},[Se,Ge]=ce("SelectContent");var Nt=D({__name:"SelectContentImpl",props:{position:{type:String,required:!1,default:"item-aligned"},bodyLock:{type:Boolean,required:!1,default:!0},side:{type:null,required:!1},sideOffset:{type:Number,required:!1},sideFlip:{type:Boolean,required:!1},align:{type:null,required:!1,default:"start"},alignOffset:{type:Number,required:!1},alignFlip:{type:Boolean,required:!1},avoidCollisions:{type:Boolean,required:!1},collisionBoundary:{type:null,required:!1},collisionPadding:{type:[Number,Object],required:!1},arrowPadding:{type:Number,required:!1},sticky:{type:String,required:!1},hideWhenDetached:{type:Boolean,required:!1},positionStrategy:{type:String,required:!1},updatePositionStrategy:{type:String,required:!1},disableUpdateOnLayoutShift:{type:Boolean,required:!1},prioritizePosition:{type:Boolean,required:!1},reference:{type:null,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:["closeAutoFocus","escapeKeyDown","pointerDownOutside"],setup(i,{emit:s}){const a=i,t=s,r=J();zt(),wt(a.bodyLock);const{CollectionSlot:u,getItems:m}=pe(),S=B();Tt(S);const{search:v,handleTypeaheadSearch:y}=We(),k=B(),w=B(),x=B(),I=B(!1),c=B(!1),$=B(!1);function A(){w.value&&S.value&&Fe([w.value,S.value])}Be(I,()=>{A()});const{onOpenChange:G,triggerPointerDownPosRef:M}=r;Xe(d=>{if(!S.value)return;let f={x:0,y:0};const q=z=>{f={x:Math.abs(Math.round(z.pageX)-(M.value?.x??0)),y:Math.abs(Math.round(z.pageY)-(M.value?.y??0))}},T=z=>{z.pointerType!=="touch"&&(f.x<=10&&f.y<=10?z.preventDefault():S.value?.contains(z.target)||G(!1),document.removeEventListener("pointermove",q),M.value=null)};M.value!==null&&(document.addEventListener("pointermove",q),document.addEventListener("pointerup",T,{capture:!0,once:!0})),d(()=>{document.removeEventListener("pointermove",q),document.removeEventListener("pointerup",T,{capture:!0})})});function P(d){const f=d.ctrlKey||d.altKey||d.metaKey;if(d.key==="Tab"&&d.preventDefault(),!f&&d.key.length===1&&y(d.key,m()),["ArrowUp","ArrowDown","Home","End"].includes(d.key)){let T=[...m().map(z=>z.ref)];if(["ArrowUp","End"].includes(d.key)&&(T=T.slice().reverse()),["ArrowUp","ArrowDown"].includes(d.key)){const z=d.target,Q=T.indexOf(z);T=T.slice(Q+1)}setTimeout(()=>Fe(T)),d.preventDefault()}}const n=j(()=>a.position==="popper"?a:{}),h=Me(n.value);return Ge({content:S,viewport:k,onViewportChange:d=>{k.value=d},itemRefCallback:(d,f,q)=>{const T=!c.value&&!q,z=he(r.modelValue.value,f,r.by);if(r.multiple.value){if($.value)return;(z||T)&&(w.value=d,z&&($.value=!0))}else(z||T)&&(w.value=d);T&&(c.value=!0)},selectedItem:w,selectedItemText:x,onItemLeave:()=>{S.value?.focus()},itemTextRefCallback:(d,f,q)=>{const T=!c.value&&!q;(he(r.modelValue.value,f,r.by)||T)&&(x.value=d)},focusSelectedItem:A,position:a.position,isPositioned:I,searchRef:v}),(d,f)=>(o(),_(e(u),null,{default:b(()=>[V(e(kt),{"as-child":"",onMountAutoFocus:f[6]||(f[6]=de(()=>{},["prevent"])),onUnmountAutoFocus:f[7]||(f[7]=q=>{t("closeAutoFocus",q),!q.defaultPrevented&&(e(r).triggerElement.value?.focus({preventScroll:!0}),q.preventDefault())})},{default:b(()=>[V(e(Je),{"as-child":"","disable-outside-pointer-events":"",onFocusOutside:f[2]||(f[2]=de(()=>{},["prevent"])),onDismiss:f[3]||(f[3]=q=>e(r).onOpenChange(!1)),onEscapeKeyDown:f[4]||(f[4]=q=>t("escapeKeyDown",q)),onPointerDownOutside:f[5]||(f[5]=q=>t("pointerDownOutside",q))},{default:b(()=>[(o(),_(Ze(d.position==="popper"?Ft:Wt),E({...d.$attrs,...e(h)},{id:e(r).contentId,ref:q=>{const T=e(et)(q);T?.hasAttribute("data-reka-popper-content-wrapper")?S.value=T.firstElementChild:S.value=T},role:"listbox","data-state":e(r).open.value?"open":"closed",dir:e(r).dir.value,style:{display:"flex",flexDirection:"column",outline:"none"},onContextmenu:f[0]||(f[0]=de(()=>{},["prevent"])),onPlaced:f[1]||(f[1]=q=>I.value=!0),onKeydown:P}),{default:b(()=>[C(d.$slots,"default")]),_:3},16,["id","data-state","dir","onKeydown"]))]),_:3})]),_:3})]),_:3}))}}),Vt=Nt;const[Ta,Mt]=ce("SelectItemAlignedPosition");var Kt=D({inheritAttrs:!1,__name:"SelectItemAlignedPosition",props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:["placed"],setup(i,{emit:s}){const a=i,t=s,{getItems:r}=pe(),u=J(),m=Se(),S=B(!1),v=B(!0),y=B(),{forwardRef:k,currentElement:w}=be(),{viewport:x,selectedItem:I,selectedItemText:c,focusSelectedItem:$}=m;function A(){if(u.triggerElement.value&&u.valueElement.value&&y.value&&w.value&&x?.value&&I?.value&&c?.value){const P=u.triggerElement.value.getBoundingClientRect(),n=w.value.getBoundingClientRect(),h=u.valueElement.value.getBoundingClientRect(),d=c.value.getBoundingClientRect();if(u.dir.value!=="rtl"){const K=d.left-n.left,l=h.left-K,N=P.left-l,Y=P.width+N,Ie=Math.max(Y,n.width),we=window.innerWidth-U,Te=Ne(l,U,Math.max(U,we-Ie));y.value.style.minWidth=`${Y}px`,y.value.style.left=`${Te}px`}else{const K=n.right-d.right,l=window.innerWidth-h.right-K,N=window.innerWidth-P.right-l,Y=P.width+N,Ie=Math.max(Y,n.width),we=window.innerWidth-U,Te=Ne(l,U,Math.max(U,we-Ie));y.value.style.minWidth=`${Y}px`,y.value.style.right=`${Te}px`}const f=r().map(K=>K.ref),q=window.innerHeight-U*2,T=x.value.scrollHeight,z=window.getComputedStyle(w.value),Q=Number.parseInt(z.borderTopWidth,10),fe=Number.parseInt(z.paddingTop,10),p=Number.parseInt(z.borderBottomWidth,10),ge=Number.parseInt(z.paddingBottom,10),ie=Q+fe+T+ge+p,xe=Math.min(I.value.offsetHeight*5,ie),ee=window.getComputedStyle(x.value),qe=Number.parseInt(ee.paddingTop,10),Ce=Number.parseInt(ee.paddingBottom,10),te=P.top+P.height/2-U,L=q-te,g=I.value.offsetHeight/2,H=I.value.offsetTop+g,F=Q+fe+H,ne=ie-F;if(F<=te){const K=I.value===f[f.length-1];y.value.style.bottom="0px";const l=w.value.clientHeight-x.value.offsetTop-x.value.offsetHeight,N=Math.max(L,g+(K?Ce:0)+l+p),Y=F+N;y.value.style.height=`${Y}px`}else{const K=I.value===f[0];y.value.style.top="0px";const N=Math.max(te,Q+x.value.offsetTop+(K?qe:0)+g)+ne;y.value.style.height=`${N}px`,x.value.scrollTop=F-te+x.value.offsetTop}y.value.style.margin=`${U}px 0`,y.value.style.minHeight=`${xe}px`,y.value.style.maxHeight=`${q}px`,t("placed"),requestAnimationFrame(()=>S.value=!0)}}const G=B("");le(async()=>{await ue(),A(),w.value&&(G.value=window.getComputedStyle(w.value).zIndex)});function M(P){P&&v.value===!0&&(A(),$?.(),v.value=!1)}return tt(u.triggerElement,()=>{A()}),Mt({contentWrapper:y,shouldExpandOnScrollRef:S,onScrollButtonChange:M}),(P,n)=>(o(),R("div",{ref_key:"contentWrapperElement",ref:y,style:at({display:"flex",flexDirection:"column",position:"fixed",zIndex:G.value})},[V(e(X),E({ref:e(k),style:{boxSizing:"border-box",maxHeight:"100%"}},{...P.$attrs,...a}),{default:b(()=>[C(P.$slots,"default")]),_:3},16)],4))}}),Wt=Kt,Ht=D({__name:"SelectArrow",props:{width:{type:Number,required:!1,default:10},height:{type:Number,required:!1,default:5},rounded:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:"svg"}},setup(i){const s=i,a=J(),t=Se(je);return(r,u)=>e(a).open.value&&e(t).position==="popper"?(o(),_(e(Ct),_e(E({key:0},s)),{default:b(()=>[C(r.$slots,"default")]),_:3},16)):W("v-if",!0)}}),jt=Ht,Gt=D({inheritAttrs:!1,__name:"SelectProvider",props:{context:{type:Object,required:!0}},setup(i){return He(i.context),Ge(je),(a,t)=>C(a.$slots,"default")}}),Ut=Gt;const Yt={key:1};var Qt=D({inheritAttrs:!1,__name:"SelectContent",props:{forceMount:{type:Boolean,required:!1},position:{type:String,required:!1},bodyLock:{type:Boolean,required:!1},side:{type:null,required:!1},sideOffset:{type:Number,required:!1},sideFlip:{type:Boolean,required:!1},align:{type:null,required:!1},alignOffset:{type:Number,required:!1},alignFlip:{type:Boolean,required:!1},avoidCollisions:{type:Boolean,required:!1},collisionBoundary:{type:null,required:!1},collisionPadding:{type:[Number,Object],required:!1},arrowPadding:{type:Number,required:!1},sticky:{type:String,required:!1},hideWhenDetached:{type:Boolean,required:!1},positionStrategy:{type:String,required:!1},updatePositionStrategy:{type:String,required:!1},disableUpdateOnLayoutShift:{type:Boolean,required:!1},prioritizePosition:{type:Boolean,required:!1},reference:{type:null,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:["closeAutoFocus","escapeKeyDown","pointerDownOutside"],setup(i,{emit:s}){const a=i,r=Ke(a,s),u=J(),m=B();le(()=>{m.value=new DocumentFragment});const S=B(),v=j(()=>a.forceMount||u.open.value),y=B(v.value);return Be(v,()=>{setTimeout(()=>y.value=v.value)}),(k,w)=>v.value||y.value||S.value?.present?(o(),_(e(lt),{key:0,ref_key:"presenceRef",ref:S,present:v.value},{default:b(()=>[V(Vt,_e(Pe({...e(r),...k.$attrs})),{default:b(()=>[C(k.$slots,"default")]),_:3},16)]),_:3},8,["present"])):m.value?(o(),R("div",Yt,[(o(),_(it,{to:m.value},[V(Ut,{context:e(u)},{default:b(()=>[C(k.$slots,"default")]),_:3},8,["context"])],8,["to"]))])):W("v-if",!0)}}),Xt=Qt;const[Jt,Zt]=ce("SelectGroup");var ea=D({__name:"SelectGroup",props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(i){const s=i,a=Ae(void 0,"reka-select-group");return Zt({id:a}),(t,r)=>(o(),_(e(X),E({role:"group"},s,{"aria-labelledby":e(a)}),{default:b(()=>[C(t.$slots,"default")]),_:3},16,["aria-labelledby"]))}}),ta=ea;const[Ue,aa]=ce("SelectItem");var la=D({__name:"SelectItem",props:{value:{type:null,required:!0},disabled:{type:Boolean,required:!1},textValue:{type:String,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:["select"],setup(i,{emit:s}){const a=i,t=s,{disabled:r}=Ve(a),u=J(),m=Se(),{forwardRef:S,currentElement:v}=be(),{CollectionItem:y}=pe(),k=j(()=>he(u.modelValue?.value,a.value,u.by)),w=B(!1),x=B(a.textValue??""),I=Ae(void 0,"reka-select-item-text"),c="select.select";async function $(n){if(n.defaultPrevented)return;const h={originalEvent:n,value:a.value};nt(c,A,h)}async function A(n){await ue(),t("select",n),!n.defaultPrevented&&(r.value||(u.onValueChange(a.value),u.multiple.value||u.onOpenChange(!1)))}async function G(n){await ue(),!n.defaultPrevented&&(r.value?m.onItemLeave?.():n.currentTarget?.focus({preventScroll:!0}))}async function M(n){await ue(),!n.defaultPrevented&&n.currentTarget===rt()&&m.onItemLeave?.()}async function P(n){await ue(),!(n.defaultPrevented||m.searchRef?.value!==""&&n.key===" ")&&(Pt.includes(n.key)&&$(n),n.key===" "&&n.preventDefault())}if(a.value==="")throw new Error("A <SelectItem /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return le(()=>{v.value&&m.itemRefCallback(v.value,a.value,a.disabled)}),aa({value:a.value,disabled:r,textId:I,isSelected:k,onItemTextChange:n=>{x.value=((x.value||n?.textContent)??"").trim()}}),(n,h)=>(o(),_(e(y),{value:{textValue:x.value}},{default:b(()=>[V(e(X),{ref:e(S),role:"option","aria-labelledby":e(I),"data-highlighted":w.value?"":void 0,"aria-selected":k.value,"data-state":k.value?"checked":"unchecked","aria-disabled":e(r)||void 0,"data-disabled":e(r)?"":void 0,tabindex:e(r)?void 0:-1,as:n.as,"as-child":n.asChild,onFocus:h[0]||(h[0]=d=>w.value=!0),onBlur:h[1]||(h[1]=d=>w.value=!1),onPointerup:$,onPointerdown:h[2]||(h[2]=d=>{d.currentTarget.focus({preventScroll:!0})}),onTouchend:h[3]||(h[3]=de(()=>{},["prevent","stop"])),onPointermove:G,onPointerleave:M,onKeydown:P},{default:b(()=>[C(n.$slots,"default")]),_:3},8,["aria-labelledby","data-highlighted","aria-selected","data-state","aria-disabled","data-disabled","tabindex","as","as-child"])]),_:3},8,["value"]))}}),ia=la,na=D({__name:"SelectItemIndicator",props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:"span"}},setup(i){const s=i,a=Ue();return(t,r)=>e(a).isSelected.value?(o(),_(e(X),E({key:0,"aria-hidden":"true"},s),{default:b(()=>[C(t.$slots,"default")]),_:3},16)):W("v-if",!0)}}),ra=na,oa=D({inheritAttrs:!1,__name:"SelectItemText",props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:"span"}},setup(i){const s=i,a=J(),t=Se(),r=Ue(),{forwardRef:u,currentElement:m}=be(),S=j(()=>({value:r.value,disabled:r.disabled.value,textContent:m.value?.textContent??r.value?.toString()??""}));return le(()=>{m.value&&(r.onItemTextChange(m.value),t.itemTextRefCallback(m.value,r.value,r.disabled.value),a.onOptionAdd(S.value))}),ot(()=>{a.onOptionRemove(S.value)}),(v,y)=>(o(),_(e(X),E({id:e(r).textId,ref:e(u)},{...s,...v.$attrs}),{default:b(()=>[C(v.$slots,"default")]),_:3},16,["id"]))}}),sa=oa,ua=D({__name:"SelectLabel",props:{for:{type:String,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:"div"}},setup(i){const s=i,a=Jt({id:""});return(t,r)=>(o(),_(e(X),E(s,{id:e(a).id}),{default:b(()=>[C(t.$slots,"default")]),_:3},16,["id"]))}}),da=ua,ca=D({__name:"SelectPortal",props:{to:{type:null,required:!1},disabled:{type:Boolean,required:!1},defer:{type:Boolean,required:!1},forceMount:{type:Boolean,required:!1}},setup(i){const s=i;return(a,t)=>(o(),_(e(st),_e(Pe(s)),{default:b(()=>[C(a.$slots,"default")]),_:3},16))}}),pa=ca,fa=D({__name:"SelectSeparator",props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(i){const s=i;return(a,t)=>(o(),_(e(X),E({"aria-hidden":"true"},s),{default:b(()=>[C(a.$slots,"default")]),_:3},16))}}),ga=fa,ma=D({__name:"SelectTrigger",props:{disabled:{type:Boolean,required:!1},reference:{type:null,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:"button"}},setup(i){const s=i,a=J(),{forwardRef:t,currentElement:r}=be(),u=j(()=>a.disabled?.value||s.disabled);a.contentId||=Ae(void 0,"reka-select-content"),le(()=>{a.onTriggerChange(r.value)});const{getItems:m}=pe(),{search:S,handleTypeaheadSearch:v,resetTypeahead:y}=We();function k(){u.value||(a.onOpenChange(!0),y())}function w(x){k(),a.triggerPointerDownPosRef.value={x:Math.round(x.pageX),y:Math.round(x.pageY)}}return(x,I)=>(o(),_(e(It),{"as-child":"",reference:x.reference},{default:b(()=>[V(e(X),{ref:e(t),role:"combobox",type:x.as==="button"?"button":void 0,"aria-controls":e(a).contentId,"aria-expanded":e(a).open.value||!1,"aria-required":e(a).required?.value,"aria-autocomplete":"none",disabled:u.value,dir:e(a)?.dir.value,"data-state":e(a)?.open.value?"open":"closed","data-disabled":u.value?"":void 0,"data-placeholder":e(At)(e(a).modelValue?.value)?"":void 0,"as-child":x.asChild,as:x.as,onClick:I[0]||(I[0]=c=>{c?.currentTarget?.focus()}),onPointerdown:I[1]||(I[1]=c=>{if(c.pointerType==="touch")return c.preventDefault();const $=c.target;$.hasPointerCapture(c.pointerId)&&$.releasePointerCapture(c.pointerId),c.button===0&&c.ctrlKey===!1&&(w(c),c.preventDefault())}),onPointerup:I[2]||(I[2]=de(c=>{c.pointerType==="touch"&&w(c)},["prevent"])),onKeydown:I[3]||(I[3]=c=>{const $=e(S)!=="";!(c.ctrlKey||c.altKey||c.metaKey)&&c.key.length===1&&$&&c.key===" "||(e(v)(c.key,e(m)()),e(Bt).includes(c.key)&&(k(),c.preventDefault()))})},{default:b(()=>[C(x.$slots,"default")]),_:3},8,["type","aria-controls","aria-expanded","aria-required","disabled","dir","data-state","data-disabled","data-placeholder","as-child","as"])]),_:3},8,["reference"]))}}),va=ma;const ya={slots:{base:["relative group rounded-md inline-flex items-center focus:outline-none disabled:cursor-not-allowed disabled:opacity-75","transition-colors"],leading:"absolute inset-y-0 start-0 flex items-center",leadingIcon:"shrink-0 text-dimmed",leadingAvatar:"shrink-0",leadingAvatarSize:"",trailing:"absolute inset-y-0 end-0 flex items-center",trailingIcon:"shrink-0 text-dimmed",value:"truncate pointer-events-none",placeholder:"truncate text-dimmed",arrow:"fill-default",content:"max-h-60 w-(--reka-select-trigger-width) bg-default shadow-lg rounded-md ring ring-default overflow-hidden data-[state=open]:animate-[scale-in_100ms_ease-out] data-[state=closed]:animate-[scale-out_100ms_ease-in] origin-(--reka-select-content-transform-origin) pointer-events-auto flex flex-col",viewport:"relative divide-y divide-default scroll-py-1 overflow-y-auto flex-1",group:"p-1 isolate",empty:"text-center text-muted",label:"font-semibold text-highlighted",separator:"-mx-1 my-1 h-px bg-border",item:["group relative w-full flex items-start select-none outline-none before:absolute before:z-[-1] before:inset-px before:rounded-md data-disabled:cursor-not-allowed data-disabled:opacity-75 text-default data-highlighted:not-data-disabled:text-highlighted data-highlighted:not-data-disabled:before:bg-elevated/50","transition-colors before:transition-colors"],itemLeadingIcon:["shrink-0 text-dimmed group-data-highlighted:not-group-data-disabled:text-default","transition-colors"],itemLeadingAvatar:"shrink-0",itemLeadingAvatarSize:"",itemLeadingChip:"shrink-0",itemLeadingChipSize:"",itemTrailing:"ms-auto inline-flex gap-1.5 items-center",itemTrailingIcon:"shrink-0",itemWrapper:"flex-1 flex flex-col min-w-0",itemLabel:"truncate",itemDescription:"truncate text-muted"},variants:{fieldGroup:{horizontal:"not-only:first:rounded-e-none not-only:last:rounded-s-none not-last:not-first:rounded-none focus-visible:z-[1]",vertical:"not-only:first:rounded-b-none not-only:last:rounded-t-none not-last:not-first:rounded-none focus-visible:z-[1]"},size:{xs:{base:"px-2 py-1 text-xs gap-1",leading:"ps-2",trailing:"pe-2",leadingIcon:"size-4",leadingAvatarSize:"3xs",trailingIcon:"size-4",label:"p-1 text-[10px]/3 gap-1",item:"p-1 text-xs gap-1",itemLeadingIcon:"size-4",itemLeadingAvatarSize:"3xs",itemLeadingChip:"size-4",itemLeadingChipSize:"sm",itemTrailingIcon:"size-4",empty:"p-1 text-xs"},sm:{base:"px-2.5 py-1.5 text-xs gap-1.5",leading:"ps-2.5",trailing:"pe-2.5",leadingIcon:"size-4",leadingAvatarSize:"3xs",trailingIcon:"size-4",label:"p-1.5 text-[10px]/3 gap-1.5",item:"p-1.5 text-xs gap-1.5",itemLeadingIcon:"size-4",itemLeadingAvatarSize:"3xs",itemLeadingChip:"size-4",itemLeadingChipSize:"sm",itemTrailingIcon:"size-4",empty:"p-1.5 text-xs"},md:{base:"px-2.5 py-1.5 text-sm gap-1.5",leading:"ps-2.5",trailing:"pe-2.5",leadingIcon:"size-5",leadingAvatarSize:"2xs",trailingIcon:"size-5",label:"p-1.5 text-xs gap-1.5",item:"p-1.5 text-sm gap-1.5",itemLeadingIcon:"size-5",itemLeadingAvatarSize:"2xs",itemLeadingChip:"size-5",itemLeadingChipSize:"md",itemTrailingIcon:"size-5",empty:"p-1.5 text-sm"},lg:{base:"px-3 py-2 text-sm gap-2",leading:"ps-3",trailing:"pe-3",leadingIcon:"size-5",leadingAvatarSize:"2xs",trailingIcon:"size-5",label:"p-2 text-xs gap-2",item:"p-2 text-sm gap-2",itemLeadingIcon:"size-5",itemLeadingAvatarSize:"2xs",itemLeadingChip:"size-5",itemLeadingChipSize:"md",itemTrailingIcon:"size-5",empty:"p-2 text-sm"},xl:{base:"px-3 py-2 text-base gap-2",leading:"ps-3",trailing:"pe-3",leadingIcon:"size-6",leadingAvatarSize:"xs",trailingIcon:"size-6",label:"p-2 text-sm gap-2",item:"p-2 text-base gap-2",itemLeadingIcon:"size-6",itemLeadingAvatarSize:"xs",itemLeadingChip:"size-6",itemLeadingChipSize:"lg",itemTrailingIcon:"size-6",empty:"p-2 text-base"}},variant:{outline:"text-highlighted bg-default ring ring-inset ring-accented",soft:"text-highlighted bg-elevated/50 hover:bg-elevated focus:bg-elevated disabled:bg-elevated/50",subtle:"text-highlighted bg-elevated ring ring-inset ring-accented",ghost:"text-highlighted bg-transparent hover:bg-elevated focus:bg-elevated disabled:bg-transparent dark:disabled:bg-transparent",none:"text-highlighted bg-transparent"},color:{primary:"",secondary:"",success:"",info:"",warning:"",error:"",neutral:""},leading:{true:""},trailing:{true:""},loading:{true:""},highlight:{true:""},type:{file:"file:me-1.5 file:font-medium file:text-muted file:outline-none"}},compoundVariants:[{color:"primary",variant:["outline","subtle"],class:"focus:ring-2 focus:ring-inset focus:ring-primary"},{color:"secondary",variant:["outline","subtle"],class:"focus:ring-2 focus:ring-inset focus:ring-secondary"},{color:"success",variant:["outline","subtle"],class:"focus:ring-2 focus:ring-inset focus:ring-success"},{color:"info",variant:["outline","subtle"],class:"focus:ring-2 focus:ring-inset focus:ring-info"},{color:"warning",variant:["outline","subtle"],class:"focus:ring-2 focus:ring-inset focus:ring-warning"},{color:"error",variant:["outline","subtle"],class:"focus:ring-2 focus:ring-inset focus:ring-error"},{color:"primary",highlight:!0,class:"ring ring-inset ring-primary"},{color:"secondary",highlight:!0,class:"ring ring-inset ring-secondary"},{color:"success",highlight:!0,class:"ring ring-inset ring-success"},{color:"info",highlight:!0,class:"ring ring-inset ring-info"},{color:"warning",highlight:!0,class:"ring ring-inset ring-warning"},{color:"error",highlight:!0,class:"ring ring-inset ring-error"},{color:"neutral",variant:["outline","subtle"],class:"focus:ring-2 focus:ring-inset focus:ring-inverted"},{color:"neutral",highlight:!0,class:"ring ring-inset ring-inverted"},{leading:!0,size:"xs",class:"ps-7"},{leading:!0,size:"sm",class:"ps-8"},{leading:!0,size:"md",class:"ps-9"},{leading:!0,size:"lg",class:"ps-10"},{leading:!0,size:"xl",class:"ps-11"},{trailing:!0,size:"xs",class:"pe-7"},{trailing:!0,size:"sm",class:"pe-8"},{trailing:!0,size:"md",class:"pe-9"},{trailing:!0,size:"lg",class:"pe-10"},{trailing:!0,size:"xl",class:"pe-11"},{loading:!0,leading:!0,class:{leadingIcon:"animate-spin"}},{loading:!0,leading:!1,trailing:!0,class:{trailingIcon:"animate-spin"}}],defaultVariants:{size:"md",color:"primary",variant:"outline"}},ka=Object.assign({inheritAttrs:!1},{__name:"USelect",props:{id:{type:String,required:!1},placeholder:{type:String,required:!1},color:{type:null,required:!1},variant:{type:null,required:!1},size:{type:null,required:!1},trailingIcon:{type:null,required:!1},selectedIcon:{type:null,required:!1},content:{type:Object,required:!1},arrow:{type:[Boolean,Object],required:!1},portal:{type:[Boolean,String],required:!1,skipCheck:!0,default:!0},valueKey:{type:null,required:!1,default:"value"},labelKey:{type:null,required:!1,default:"label"},descriptionKey:{type:null,required:!1,default:"description"},items:{type:null,required:!1},defaultValue:{type:null,required:!1},modelValue:{type:null,required:!1},modelModifiers:{type:Object,required:!1},multiple:{type:Boolean,required:!1},highlight:{type:Boolean,required:!1},autofocus:{type:Boolean,required:!1},autofocusDelay:{type:Number,required:!1,default:0},class:{type:null,required:!1},ui:{type:null,required:!1},open:{type:Boolean,required:!1},defaultOpen:{type:Boolean,required:!1},autocomplete:{type:String,required:!1},disabled:{type:Boolean,required:!1},name:{type:String,required:!1},required:{type:Boolean,required:!1},icon:{type:null,required:!1},avatar:{type:Object,required:!1},leading:{type:Boolean,required:!1},leadingIcon:{type:null,required:!1},trailing:{type:Boolean,required:!1},loading:{type:Boolean,required:!1},loadingIcon:{type:null,required:!1}},emits:["update:open","change","blur","focus","update:modelValue"],setup(i,{expose:s,emit:a}){const t=i,r=a,u=ut(),m=dt(),S=Ke(ct(t,"open","defaultOpen","disabled","autocomplete","required","multiple"),r),v=pt(re(()=>t.portal)),y=re(()=>Oe(t.content,{side:"bottom",sideOffset:8,collisionPadding:8,position:"popper"})),k=re(()=>t.arrow),{emitFormChange:w,emitFormInput:x,emitFormBlur:I,emitFormFocus:c,size:$,color:A,id:G,name:M,highlight:P,disabled:n,ariaAttrs:h}=ft(t),{orientation:d,size:f}=gt(t),{isLeading:q,isTrailing:T,leadingIconName:z,trailingIconName:Q}=mt(re(()=>Oe(t,{trailingIcon:m.ui.icons.chevronDown}))),fe=j(()=>f.value||$.value),p=j(()=>$e({extend:$e(ya),...m.ui?.select||{}})({color:A.value,variant:t.variant,size:fe?.value,loading:t.loading,highlight:P.value,leading:q.value||!!t.avatar||!!u.leading,trailing:T.value||!!u.trailing,fieldGroup:d.value})),ge=j(()=>t.items?.length?vt(t.items)?t.items:[t.items]:[]),ie=j(()=>ge.value.flatMap(g=>g));function xe(g){if(t.multiple&&Array.isArray(g)){const H=g.map(F=>Re(ie.value,F,{labelKey:t.labelKey,valueKey:t.valueKey})).filter(F=>F!=null&&F!=="");return H.length>0?H.join(", "):void 0}return Re(ie.value,g,{labelKey:t.labelKey,valueKey:t.valueKey})}const ee=yt("triggerRef");function qe(){t.autofocus&&ee.value?.$el?.focus({focusVisible:!0})}le(()=>{setTimeout(()=>{qe()},t.autofocusDelay)});function Ce(g){t.modelModifiers?.trim&&(g=g?.trim()??null),t.modelModifiers?.number&&(g=bt(g)),t.modelModifiers?.nullable&&(g??=null),t.modelModifiers?.optional&&(g??=void 0);const H=new Event("change",{target:{value:g}});r("change",H),w(),x()}function te(g){if(g){const H=new FocusEvent("focus");r("focus",H),c()}else{const H=new FocusEvent("blur");r("blur",H),I()}}function L(g){return typeof g=="object"&&g!==null}return s({triggerRef:re(()=>ee.value?.$el)}),(g,H)=>(o(),_(e(Ot),E({name:e(M)},e(S),{autocomplete:i.autocomplete,disabled:e(n),"default-value":i.defaultValue,"model-value":i.modelValue,"onUpdate:modelValue":Ce,"onUpdate:open":te}),{default:b(({modelValue:F,open:ne})=>[V(e(va),E({id:e(G),ref_key:"triggerRef",ref:ee,"data-slot":"base",class:p.value.base({class:[t.ui?.base,t.class]})},{...g.$attrs,...e(h)}),{default:b(()=>[e(q)||i.avatar||u.leading?(o(),R("span",{key:0,"data-slot":"leading",class:O(p.value.leading({class:t.ui?.leading}))},[C(g.$slots,"leading",{modelValue:F,open:ne,ui:p.value},()=>[e(q)&&e(z)?(o(),_(me,{key:0,name:e(z),"data-slot":"leadingIcon",class:O(p.value.leadingIcon({class:t.ui?.leadingIcon}))},null,8,["name","class"])):i.avatar?(o(),_(De,E({key:1,size:t.ui?.itemLeadingAvatarSize||p.value.itemLeadingAvatarSize()},i.avatar,{"data-slot":"itemLeadingAvatar",class:p.value.itemLeadingAvatar({class:t.ui?.itemLeadingAvatar})}),null,16,["size","class"])):W("",!0)])],2)):W("",!0),C(g.$slots,"default",{modelValue:F,open:ne,ui:p.value},()=>[(o(!0),R(ae,null,ve([xe(F)],Z=>(o(),R(ae,{key:Z},[Z!=null?(o(),R("span",{key:0,"data-slot":"value",class:O(p.value.value({class:t.ui?.value}))},oe(Z),3)):(o(),R("span",{key:1,"data-slot":"placeholder",class:O(p.value.placeholder({class:t.ui?.placeholder}))},oe(i.placeholder??" "),3))],64))),128))]),e(T)||u.trailing?(o(),R("span",{key:1,"data-slot":"trailing",class:O(p.value.trailing({class:t.ui?.trailing}))},[C(g.$slots,"trailing",{modelValue:F,open:ne,ui:p.value},()=>[e(Q)?(o(),_(me,{key:0,name:e(Q),"data-slot":"trailingIcon",class:O(p.value.trailingIcon({class:t.ui?.trailingIcon}))},null,8,["name","class"])):W("",!0)])],2)):W("",!0)]),_:2},1040,["id","class"]),V(e(pa),_e(Pe(e(v))),{default:b(()=>[V(e(Xt),E({"data-slot":"content",class:p.value.content({class:t.ui?.content})},y.value),{default:b(()=>[C(g.$slots,"content-top"),ye("div",{role:"presentation","data-slot":"viewport",class:O(p.value.viewport({class:t.ui?.viewport}))},[(o(!0),R(ae,null,ve(ge.value,(Z,K)=>(o(),_(e(ta),{key:`group-${K}`,"data-slot":"group",class:O(p.value.group({class:t.ui?.group}))},{default:b(()=>[(o(!0),R(ae,null,ve(Z,(l,N)=>(o(),R(ae,{key:`group-${K}-${N}`},[L(l)&&l.type==="label"?(o(),_(e(da),{key:0,"data-slot":"label",class:O(p.value.label({class:[t.ui?.label,l.ui?.label,l.class]}))},{default:b(()=>[ke(oe(e(se)(l,t.labelKey)),1)]),_:2},1032,["class"])):L(l)&&l.type==="separator"?(o(),_(e(ga),{key:1,"data-slot":"separator",class:O(p.value.separator({class:[t.ui?.separator,l.ui?.separator,l.class]}))},null,8,["class"])):(o(),_(e(ia),{key:2,"data-slot":"item",class:O(p.value.item({class:[t.ui?.item,L(l)&&l.ui?.item,L(l)&&l.class]})),disabled:L(l)&&l.disabled,value:L(l)?e(se)(l,t.valueKey):l,onSelect:Y=>L(l)&&l.onSelect?.(Y)},{default:b(()=>[C(g.$slots,"item",{item:l,index:N,ui:p.value},()=>[C(g.$slots,"item-leading",{item:l,index:N,ui:p.value},()=>[L(l)&&l.icon?(o(),_(me,{key:0,name:l.icon,"data-slot":"itemLeadingIcon",class:O(p.value.itemLeadingIcon({class:[t.ui?.itemLeadingIcon,l.ui?.itemLeadingIcon]}))},null,8,["name","class"])):L(l)&&l.avatar?(o(),_(De,E({key:1,size:l.ui?.itemLeadingAvatarSize||t.ui?.itemLeadingAvatarSize||p.value.itemLeadingAvatarSize()},{ref_for:!0},l.avatar,{"data-slot":"itemLeadingAvatar",class:p.value.itemLeadingAvatar({class:[t.ui?.itemLeadingAvatar,l.ui?.itemLeadingAvatar]})}),null,16,["size","class"])):L(l)&&l.chip?(o(),_(ht,E({key:2,size:l.ui?.itemLeadingChipSize||t.ui?.itemLeadingChipSize||p.value.itemLeadingChipSize(),inset:"",standalone:""},{ref_for:!0},l.chip,{"data-slot":"itemLeadingChip",class:p.value.itemLeadingChip({class:[t.ui?.itemLeadingChip,l.ui?.itemLeadingChip]})}),null,16,["size","class"])):W("",!0)]),ye("span",{"data-slot":"itemWrapper",class:O(p.value.itemWrapper({class:[t.ui?.itemWrapper,L(l)&&l.ui?.itemWrapper]}))},[V(e(sa),{"data-slot":"itemLabel",class:O(p.value.itemLabel({class:[t.ui?.itemLabel,L(l)&&l.ui?.itemLabel]}))},{default:b(()=>[C(g.$slots,"item-label",{item:l,index:N},()=>[ke(oe(L(l)?e(se)(l,t.labelKey):l),1)])]),_:2},1032,["class"]),L(l)&&(e(se)(l,t.descriptionKey)||u["item-description"])?(o(),R("span",{key:0,"data-slot":"itemDescription",class:O(p.value.itemDescription({class:[t.ui?.itemDescription,L(l)&&l.ui?.itemDescription]}))},[C(g.$slots,"item-description",{item:l,index:N},()=>[ke(oe(e(se)(l,t.descriptionKey)),1)])],2)):W("",!0)],2),ye("span",{"data-slot":"itemTrailing",class:O(p.value.itemTrailing({class:[t.ui?.itemTrailing,L(l)&&l.ui?.itemTrailing]}))},[C(g.$slots,"item-trailing",{item:l,index:N,ui:p.value}),V(e(ra),{"as-child":""},{default:b(()=>[V(me,{name:i.selectedIcon||e(m).ui.icons.check,"data-slot":"itemTrailingIcon",class:O(p.value.itemTrailingIcon({class:[t.ui?.itemTrailingIcon,L(l)&&l.ui?.itemTrailingIcon]}))},null,8,["name","class"])]),_:2},1024)],2)])]),_:2},1032,["class","disabled","value","onSelect"]))],64))),128))]),_:2},1032,["class"]))),128))],2),C(g.$slots,"content-bottom"),i.arrow?(o(),_(e(jt),E({key:0},k.value,{"data-slot":"arrow",class:p.value.arrow({class:t.ui?.arrow})}),null,16,["class"])):W("",!0)]),_:3},16,["class"])]),_:3},16)]),_:3},16,["name","autocomplete","disabled","default-value","model-value"]))}});export{ka as _};
|