ai-ax 0.10.0 → 0.11.0

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.
@@ -26,6 +26,7 @@ interface Item {
26
26
  color?: string;
27
27
  desc?: string;
28
28
  top?: boolean;
29
+ disabled?: boolean;
29
30
  }
30
31
  interface Point {
31
32
  x: number;
@@ -159,6 +160,37 @@ type Ghost = ReturnType<typeof createGhost>;
159
160
  declare const createGrab: (id: string, zone: string, ghost: Ghost, over: Over, done: (drop: string) => void) => (el: Element | null) => undefined;
160
161
  type Grab = ReturnType<typeof createGrab>;
161
162
  //#endregion
163
+ //#region src/client/ui/shell/atoms/chips.d.ts
164
+ interface ChipDef {
165
+ id: string;
166
+ label: string;
167
+ fixed?: boolean;
168
+ }
169
+ interface ChipsProps {
170
+ chips: ChipDef[];
171
+ values: Record<string, string>;
172
+ menus: Record<string, Item[]>;
173
+ menu: string;
174
+ flip: (id: string) => (e: any) => void;
175
+ pick: (chip: string, value: string) => (m: Item) => void;
176
+ clear: (chip: string) => (e: any) => void;
177
+ lead?: ReactNode;
178
+ view?: {
179
+ items: {
180
+ id: string;
181
+ icon: string;
182
+ }[];
183
+ value: string;
184
+ pick: (id: string) => void;
185
+ };
186
+ search?: {
187
+ value: string;
188
+ set: (value: string) => void;
189
+ placeholder: string;
190
+ };
191
+ }
192
+ declare const Chips: ({ chips, values, menus, menu, flip, pick, clear, lead, view, search }: ChipsProps) => import("react").JSX.Element;
193
+ //#endregion
162
194
  //#region src/client/ui/shell/atoms/band.d.ts
163
195
  interface CardItem extends Item {
164
196
  menu?: boolean;
@@ -192,6 +224,8 @@ interface MainHeadProps {
192
224
  open: () => void;
193
225
  title: ReactNode;
194
226
  back?: () => void;
227
+ undo?: () => void;
228
+ redo?: () => void;
195
229
  expand?: {
196
230
  label: string;
197
231
  icon: string;
@@ -201,13 +235,13 @@ interface MainHeadProps {
201
235
  actions: ReactNode;
202
236
  }
203
237
  declare const SpHead: ({ icon, color, label, home, actions, drawer }: SpHeadProps) => import("react").JSX.Element;
204
- declare const MainHead: ({ bar, open, title, back, expand, actions }: MainHeadProps) => import("react").JSX.Element;
205
238
  declare const HeadBtn: ({ icon, size, click, children }: {
206
239
  icon: string;
207
240
  size?: number;
208
241
  click: (e: any) => void;
209
242
  children?: ReactNode;
210
243
  }) => import("react").JSX.Element;
244
+ declare const MainHead: ({ bar, open, title, back, undo, redo, expand, actions }: MainHeadProps) => import("react").JSX.Element;
211
245
  declare const SpBtn: ({ icon, size, click, children }: {
212
246
  icon: string;
213
247
  size?: number;
@@ -216,6 +250,184 @@ declare const SpBtn: ({ icon, size, click, children }: {
216
250
  }) => import("react").JSX.Element;
217
251
  declare const MoreIcon: string;
218
252
  //#endregion
253
+ //#region src/client/ui/drive/types.d.ts
254
+ interface Obj {
255
+ path: string;
256
+ size: number;
257
+ date: string;
258
+ kind?: string;
259
+ etag?: string;
260
+ }
261
+ interface Entry {
262
+ id: string;
263
+ name: string;
264
+ kind: string;
265
+ owner: string;
266
+ date: string;
267
+ iso: string;
268
+ size: string;
269
+ bytes: number;
270
+ parent: string;
271
+ pinned?: boolean;
272
+ trashed?: boolean;
273
+ }
274
+ interface DriveConfig {
275
+ base: string;
276
+ trash: string;
277
+ editors: string[];
278
+ self: string;
279
+ }
280
+ //#endregion
281
+ //#region src/client/ui/shell/atoms/list.d.ts
282
+ interface ListProps {
283
+ rows: Entry[];
284
+ kinds: Record<string, {
285
+ icon: string;
286
+ color: string;
287
+ }>;
288
+ menu: string;
289
+ point: Point | null;
290
+ flip: (id: string) => (e: any) => void;
291
+ context: (id: string) => (e: any) => void;
292
+ open: (e: Entry) => (ev: any) => void;
293
+ pick: (e: Entry) => (m: Item) => void;
294
+ drag: (id: string, zone?: string) => any;
295
+ }
296
+ declare const emptyLabel = "ファイルがありません";
297
+ declare const Tile: ({ e, kinds }: {
298
+ e: Entry;
299
+ kinds: ListProps['kinds'];
300
+ }) => import("react").JSX.Element;
301
+ declare const FileList: ({ rows, kinds, menu, point, flip, context, open, pick, drag }: ListProps) => import("react").JSX.Element;
302
+ //#endregion
303
+ //#region src/client/ui/shell/clicks.d.ts
304
+ declare const openDrawer: (e: any) => void;
305
+ declare const closeDrawer: () => void;
306
+ declare const atPoint: (e: any) => void;
307
+ declare const noPoint: () => void;
308
+ //#endregion
309
+ //#region src/client/ui/shell/shell.d.ts
310
+ interface ShellNames {
311
+ menu: string;
312
+ setMenu: string;
313
+ open: string;
314
+ }
315
+ interface Intent {
316
+ name: string;
317
+ input?: object;
318
+ }
319
+ interface ShellInput {
320
+ names?: Partial<ShellNames>;
321
+ onClose?: () => void;
322
+ create?: string;
323
+ createId?: string;
324
+ intents?: Record<string, Intent>;
325
+ insert?: (m: Item) => void;
326
+ fallback?: (m: Item) => Intent | undefined;
327
+ onPage?: (m: Item) => boolean;
328
+ }
329
+ declare const createShell: (ai: any, input?: ShellInput) => {
330
+ closeShell: () => void;
331
+ press: (e: any) => void;
332
+ flip: (id: string) => (e: any) => void;
333
+ context: (id: string) => (e: any) => void;
334
+ foldTree: (path: string) => (e: any) => void;
335
+ treeClick: (path: string) => () => void;
336
+ goMode: (mode: string) => () => void;
337
+ openFile: (e: Entry) => (ev: any) => undefined;
338
+ pickFile: (e: Entry) => () => void;
339
+ askName: (current: string) => string | null;
340
+ pickHome: (m: Item) => undefined;
341
+ pickRow: (e: Entry) => (m: Item) => undefined;
342
+ pickStorage: (m: Item) => undefined;
343
+ pickInsert: (m: Item) => void;
344
+ pickCard: (c: Item & {
345
+ menu?: boolean;
346
+ }) => (e: any) => void;
347
+ pickPage: (m: Item) => undefined;
348
+ flipSetting: (id: string) => undefined;
349
+ pickChip: (chip: string, value: string) => (m: Item) => void;
350
+ clearChip: (chip: string) => (e: any) => void;
351
+ openDrawer: typeof openDrawer;
352
+ grab: (id: string, zone?: string) => (el: Element | null) => undefined;
353
+ drop: (el: Element | null) => void;
354
+ target: () => string;
355
+ isFolderMode: () => boolean;
356
+ };
357
+ type Shell = ReturnType<typeof createShell>;
358
+ //#endregion
359
+ //#region src/client/ui/shell/types.d.ts
360
+ interface NavLink {
361
+ id: string;
362
+ icon: string;
363
+ label: string;
364
+ tree?: string;
365
+ drop?: string;
366
+ from?: string;
367
+ menu?: string;
368
+ }
369
+ interface Kind {
370
+ icon: string;
371
+ color: string;
372
+ }
373
+ interface Expand {
374
+ label: string;
375
+ icon: string;
376
+ on: boolean;
377
+ click: () => void;
378
+ }
379
+ interface ShellSpec {
380
+ ai: any;
381
+ shell: Shell;
382
+ brand: {
383
+ icon: string;
384
+ color: string;
385
+ label: string;
386
+ };
387
+ kinds: Record<string, Kind>;
388
+ links: NavLink[];
389
+ service: string;
390
+ file: string;
391
+ fallback: () => string;
392
+ bandCards: Item[];
393
+ bandModes?: string[];
394
+ bandLabel: string;
395
+ titles: Record<string, string>;
396
+ helpLines: string[];
397
+ user: ReactNode;
398
+ popup: () => ReactNode;
399
+ leaf: () => ReactNode;
400
+ editor: () => ReactNode;
401
+ title: () => ReactNode;
402
+ cover?: () => ReactNode;
403
+ expand?: () => Expand;
404
+ history?: boolean;
405
+ extra?: () => ReactNode;
406
+ }
407
+ //#endregion
408
+ //#region src/client/ui/shell/atoms/layout.d.ts
409
+ declare const Layout: ({ spec, close, children }: {
410
+ spec: ShellSpec;
411
+ close?: () => void;
412
+ children?: ReactNode;
413
+ }) => import("react").JSX.Element;
414
+ declare const ItemsPopup: ({ items, pick }: {
415
+ items: any[];
416
+ pick: (m: any) => void;
417
+ }) => import("react").JSX.Element;
418
+ //#endregion
419
+ //#region src/client/ui/shell/atoms/links.d.ts
420
+ declare const TreeMore: ({ spec, e, zone }: {
421
+ spec: ShellSpec;
422
+ e: Entry;
423
+ zone?: string;
424
+ }) => import("react").JSX.Element;
425
+ declare const SideBar: ({ spec, drawer, upgrade }: {
426
+ spec: ShellSpec;
427
+ drawer: boolean;
428
+ upgrade: () => void;
429
+ }) => import("react").JSX.Element;
430
+ //#endregion
219
431
  //#region src/client/ui/shell/atoms/main.d.ts
220
432
  interface AppProps {
221
433
  drawer: boolean;
@@ -230,6 +442,21 @@ declare const Main: ({ drop, from, children }: {
230
442
  children: ReactNode;
231
443
  }) => import("react").JSX.Element;
232
444
  //#endregion
445
+ //#region src/client/ui/shell/atoms/page.d.ts
446
+ interface SettingsProps {
447
+ value: Record<string, boolean>;
448
+ flip: (id: string) => void;
449
+ }
450
+ declare const SettingsPage: ({ value, flip }: SettingsProps) => import("react").JSX.Element;
451
+ declare const HelpPage: ({ lines }: {
452
+ lines: string[];
453
+ }) => import("react").JSX.Element;
454
+ declare const ShortcutsPage: () => import("react").JSX.Element;
455
+ declare const Pages: ({ mode, lines, value, flip }: {
456
+ mode: string;
457
+ lines: string[];
458
+ } & SettingsProps) => import("react").JSX.Element | null;
459
+ //#endregion
233
460
  //#region src/client/ui/shell/atoms/row.d.ts
234
461
  interface RowProps {
235
462
  depth?: number;
@@ -248,12 +475,22 @@ interface RowProps {
248
475
  dragRef?: any;
249
476
  children?: ReactNode;
250
477
  }
478
+ interface RowBtnProps {
479
+ icon: string;
480
+ size?: number;
481
+ cls?: string;
482
+ click: (e: any) => void;
483
+ children?: ReactNode;
484
+ }
251
485
  declare const rowCls: (on: boolean) => string;
252
486
  declare const Fold: ({ open, turn }: {
253
487
  open?: boolean;
254
488
  turn?: (e: any) => void;
255
489
  }) => import("react").JSX.Element;
256
490
  declare const Row: ({ depth, on, open, turn, icon, color, label, drop, mark, from, click, dclick, rclick, dragRef, children }: RowProps) => import("react").JSX.Element;
491
+ declare const RowBtn: ({ icon, size, cls, click, children }: RowBtnProps) => import("react").JSX.Element;
492
+ declare const Caret: (props: Omit<RowBtnProps, 'icon'>) => import("react").JSX.Element;
493
+ declare const More: (props: Omit<RowBtnProps, 'icon'>) => import("react").JSX.Element;
257
494
  //#endregion
258
495
  //#region src/client/ui/shell/atoms/side.d.ts
259
496
  interface BrandProps {
@@ -279,33 +516,6 @@ declare const Brand: ({ icon, color, label, click }: BrandProps) => import("reac
279
516
  declare const Storage_: ({ storage, upgrade, menu, more }: Pick<SideProps, 'storage' | 'upgrade' | 'menu' | 'more'>) => import("react").JSX.Element;
280
517
  declare const Side: ({ brand, bar, drawer, fold, close, press, storage, upgrade, menu, more, children }: SideProps) => import("react").JSX.Element;
281
518
  //#endregion
282
- //#region src/client/ui/drive/types.d.ts
283
- interface Obj {
284
- path: string;
285
- size: number;
286
- date: string;
287
- kind?: string;
288
- etag?: string;
289
- }
290
- interface Entry {
291
- id: string;
292
- name: string;
293
- kind: string;
294
- owner: string;
295
- date: string;
296
- iso: string;
297
- size: string;
298
- bytes: number;
299
- parent: string;
300
- pinned?: boolean;
301
- trashed?: boolean;
302
- }
303
- interface DriveConfig {
304
- base: string;
305
- trash: string;
306
- editors: string[];
307
- }
308
- //#endregion
309
519
  //#region src/client/ui/shell/atoms/tree.d.ts
310
520
  interface TreeProps {
311
521
  files: Entry[];
@@ -319,6 +529,7 @@ interface TreeProps {
319
529
  }>;
320
530
  fold: (id: string) => (e: any) => void;
321
531
  enter: (id: string) => (e: any) => void;
532
+ file?: (e: Entry) => (ev: any) => void;
322
533
  open: (e: Entry) => (ev: any) => void;
323
534
  menu: (e: Entry) => ReactNode;
324
535
  rclick: (e: Entry) => (ev: any) => void;
@@ -339,22 +550,43 @@ declare const isDrawerOpen: () => boolean;
339
550
  declare const useDrawer: () => boolean;
340
551
  declare const usePoint: () => Point | null;
341
552
  //#endregion
342
- //#region src/client/ui/shell/clicks.d.ts
343
- declare const openDrawer: (e: any) => void;
344
- declare const closeDrawer: () => void;
345
- declare const atPoint: (e: any) => void;
346
- declare const noPoint: () => void;
347
- //#endregion
348
553
  //#region src/client/ui/shell/const.d.ts
349
554
  declare const storageName = "STORAGE";
350
555
  declare const upgradeLabel = "アップグレード";
351
556
  declare const upgradeUrl = "https://stripe.com";
352
557
  declare const emptyTrashAsk = "ゴミ箱を空にしますか?中のアイテムは完全に削除されます";
558
+ declare const folderAsk = "新しいフォルダ";
559
+ declare const folderDefault = "無題のフォルダ";
560
+ declare const renameAsk = "名前を変更";
561
+ declare const rootTitle = "All files";
562
+ declare const unpinLabel = "ピン留めを解除";
353
563
  declare const storageMenu: Item[];
354
564
  declare const pageMenu: Item[];
355
565
  declare const spMenu: Item[];
356
566
  declare const bandIcon: string;
357
567
  declare const moreItems: (on: boolean, label: string, items: Item[]) => Item[];
568
+ declare const homeMenu: Item[];
569
+ declare const treeFolderMenu: Item[];
570
+ declare const treeFileMenu: Item[];
571
+ declare const trashMenu: Item[];
572
+ declare const pinLabel: (e: Entry) => (m: Item) => Item;
573
+ declare const treeMenuOf: (e: Entry) => Item[];
574
+ interface LeafInput {
575
+ extra?: Item[];
576
+ pinned?: boolean;
577
+ copy?: boolean;
578
+ pin?: boolean;
579
+ }
580
+ declare const leafMenu: ({ extra, pinned, copy, pin }?: LeafInput) => Item[];
581
+ declare const settingRows: Item[];
582
+ declare const shortcutRows: {
583
+ keys: string;
584
+ label: string;
585
+ }[];
586
+ declare const pageTitles: Record<string, string>;
587
+ declare const pageModes: string[];
588
+ declare const infoOf: (e: Entry) => string;
589
+ declare const titleOf: (folder: string) => string;
358
590
  //#endregion
359
591
  //#region src/client/ui/shell/icons.d.ts
360
592
  declare const icons: {
@@ -401,6 +633,11 @@ declare const configure$1: (next: Partial<DriveConfig>) => undefined;
401
633
  //#endregion
402
634
  //#region src/client/ui/drive/client.d.ts
403
635
  declare const url: (path: string) => string;
636
+ declare const openPath: () => string;
637
+ declare const editorUrl: (kind: string, id: string) => string;
638
+ declare const openEntry: ({ id }: {
639
+ id: string;
640
+ }, ai: any) => string;
404
641
  declare const r2: {
405
642
  list(prefix?: string): Promise<Obj[]>;
406
643
  get(path: string): Promise<Response>;
@@ -435,6 +672,7 @@ declare const crumbSegs: (path: string) => {
435
672
  name: string;
436
673
  path: string;
437
674
  }[];
675
+ declare const modeRows: (files: Entry[], mode: string, folder: string, service: string) => Entry[];
438
676
  declare const usedOf: (files: Entry[]) => number;
439
677
  //#endregion
440
678
  //#region src/client/ui/drive/acts.d.ts
@@ -462,6 +700,60 @@ declare const renameFile: ({ id, name }: {
462
700
  }, ai: any) => Promise<string>;
463
701
  declare const emptyTrash: (_input: any, ai: any) => Promise<string>;
464
702
  declare const usedBytes: (ai: any) => number;
703
+ declare const createFile: ({ kind, name, parent }: {
704
+ kind: string;
705
+ name?: string;
706
+ parent?: string;
707
+ }, ai: any) => Promise<Entry>;
708
+ declare const togglePin: ({ id }: {
709
+ id: string;
710
+ }, ai: any) => string;
711
+ //#endregion
712
+ //#region src/client/ui/drive/pick.d.ts
713
+ interface Uploaded {
714
+ folder: string;
715
+ count: number;
716
+ }
717
+ declare const uploadFiles: ({ parent }: {
718
+ parent?: string;
719
+ }, ai: any) => Promise<string>;
720
+ declare const uploadFolder: ({ parent }: {
721
+ parent?: string;
722
+ }, ai: any) => Promise<Uploaded | string>;
723
+ declare const downloadFile: ({ id }: {
724
+ id: string;
725
+ }, ai: any) => Promise<string>;
726
+ //#endregion
727
+ //#region src/client/ui/drive/intent.d.ts
728
+ declare const gotoFile: (path: string, name?: string, input?: any) => void;
729
+ declare const runIntent: (ai: any) => Promise<string>;
730
+ //#endregion
731
+ //#region src/client/ui/drive/boot.d.ts
732
+ interface BootInput {
733
+ lobby: string;
734
+ wire?: (file: string) => void;
735
+ synced?: () => Promise<any> | void;
736
+ }
737
+ interface BootRoute {
738
+ file: string;
739
+ room?: string;
740
+ path?: string;
741
+ synced: () => Promise<void>;
742
+ }
743
+ declare const bootShell: (ai: any, { lobby, wire, synced }: BootInput) => BootRoute;
744
+ //#endregion
745
+ //#region src/client/ui/drive/route.d.ts
746
+ interface Route {
747
+ path: string;
748
+ mode: string;
749
+ folder: boolean;
750
+ query: boolean;
751
+ }
752
+ declare const readRoute: () => Route;
753
+ declare const fileOf: (route: Route) => string;
754
+ declare const applyRoute: (ai: any, route: Route) => undefined;
755
+ declare const urlOf: (ai: any, file: string) => string;
756
+ declare const watchUrl: (ai: any, file: string) => void;
465
757
  //#endregion
466
758
  //#region src/client/ui/chat/client.d.ts
467
759
  declare const AiChatButton: () => import("react").JSX.Element;
@@ -653,4 +945,4 @@ declare const models: {
653
945
  desc: string;
654
946
  }[];
655
947
  //#endregion
656
- export { AiChat, AiChatButton, AppProps, Band, BandProps, Brand, BrandProps, CardItem, Cards, type ChatCommand, type ChatConfig, type ChatHello, type ChatMsg, type ChatPrompt, type ChatTool, type Command, type CommandConfig, type DragState, type DriveConfig, DriveTree, Drop, type DropState, type Dropped, type Entry, Fold, Frame, GB, type Grab, type Habit, HeadBtn, type History, type HistoryConfig, type HistoryStore, type HistoryTalk, Icon, type Item, KB, MB, Main, MainHead, MainHeadProps, MoreIcon, type Obj, type Over, type PlaceInput, type Placed, type Point, Pop, Row, RowProps, SP_BREAK, type Service, Side, SideProps, type Skip, Slot, SpBtn, SpHead, SpHeadProps, type Storage, Storage_, Strip, TreeProps, ago, ancestors, atPoint, band, bandIcon, blue, config as chatConfig, closeChat, closeDrawer, configure as configureChat, configure$1 as configureDrive, createCommands, createFileDrag, createFileDrop, createHistory, createOver, crumbSegs, dragEvent, drawerAtom, config$1 as driveConfig, dropEvent, edge, emptyTrash, emptyTrashAsk, entryOf, extOf, fill, folderRows, freeName, grid, icons, idOf, ink, isChatBusy, isDrawerOpen, isFolder, kindOf, kindRows, line, markdown, mirrorFile, mkdirp, models, moreItems, moveFile, mute, noPoint, openChat, openDrawer, pageMenu, pale, parentOf, pathname, place, pointAtom, prev, quota, r2, recentRows, removeFile, renameFile, restoreChat, restoreFile, rowCls, runChat, saveFile, side, sizeOf, spMenu, stamp, stop, storageMenu, storageName, storageRows, storeFiles, syncFiles, toMsg, toggleChat, trashRows, treeOf, unique, upgradeLabel, upgradeUrl, uploadAlert, uploadMax, url, usageOf, useChatBusy, useDrawer, usePoint, usedBytes, usedOf, vec2 };
948
+ export { AiChat, AiChatButton, AppProps, Band, BandProps, type BootInput, type BootRoute, Brand, BrandProps, CardItem, Cards, Caret, type ChatCommand, type ChatConfig, type ChatHello, type ChatMsg, type ChatPrompt, type ChatTool, ChipDef, Chips, ChipsProps, type Command, type CommandConfig, type DragState, type DriveConfig, DriveTree, Drop, type DropState, type Dropped, type Entry, type Expand, FileList, Fold, Frame, GB, type Grab, type Habit, HeadBtn, HelpPage, type History, type HistoryConfig, type HistoryStore, type HistoryTalk, Icon, Intent, type Item, ItemsPopup, KB, type Kind, Layout, LeafInput, ListProps, MB, Main, MainHead, MainHeadProps, More, MoreIcon, type NavLink, type Obj, type Over, Pages, type PlaceInput, type Placed, type Point, Pop, type Route, Row, RowBtn, RowBtnProps, RowProps, SP_BREAK, type Service, SettingsPage, SettingsProps, Shell, ShellInput, ShellNames, type ShellSpec, ShortcutsPage, Side, SideBar, SideProps, type Skip, Slot, SpBtn, SpHead, SpHeadProps, type Storage, Storage_, Strip, Tile, TreeMore, TreeProps, type Uploaded, ago, ancestors, applyRoute, atPoint, band, bandIcon, blue, bootShell, config as chatConfig, closeChat, closeDrawer, configure as configureChat, configure$1 as configureDrive, createCommands, createFile, createFileDrag, createFileDrop, createHistory, createOver, createShell, crumbSegs, downloadFile, dragEvent, drawerAtom, config$1 as driveConfig, dropEvent, edge, editorUrl, emptyLabel, emptyTrash, emptyTrashAsk, entryOf, extOf, fileOf, fill, folderAsk, folderDefault, folderRows, freeName, gotoFile, grid, homeMenu, icons, idOf, infoOf, ink, isChatBusy, isDrawerOpen, isFolder, kindOf, kindRows, leafMenu, line, markdown, mirrorFile, mkdirp, modeRows, models, moreItems, moveFile, mute, noPoint, openChat, openDrawer, openEntry, openPath, pageMenu, pageModes, pageTitles, pale, parentOf, pathname, pinLabel, place, pointAtom, prev, quota, r2, readRoute, recentRows, removeFile, renameAsk, renameFile, restoreChat, restoreFile, rootTitle, rowCls, runChat, runIntent, saveFile, settingRows, shortcutRows, side, sizeOf, spMenu, stamp, stop, storageMenu, storageName, storageRows, storeFiles, syncFiles, titleOf, toMsg, toggleChat, togglePin, trashMenu, trashRows, treeFileMenu, treeFolderMenu, treeMenuOf, treeOf, unique, unpinLabel, upgradeLabel, upgradeUrl, uploadAlert, uploadFiles, uploadFolder, uploadMax, url, urlOf, usageOf, useChatBusy, useDrawer, usePoint, usedBytes, usedOf, vec2, watchUrl };
package/dist/client/ui.js CHANGED
@@ -1,7 +1,7 @@
1
- import{atom as e,setAtom as t,useAtomValue as n}from"./react.js";import{useEffect as r,useLayoutEffect as i,useRef as a,useState as o}from"react";import{Fragment as s,jsx as c,jsxs as l}from"react/jsx-runtime";import u from"@material-symbols/svg-400/outlined/add.svg?raw";import d from"@material-symbols/svg-400/outlined/arrow_back.svg?raw";import f from"@material-symbols/svg-400/outlined/arrow_drop_down.svg?raw";import p,{default as m}from"@material-symbols/svg-400/outlined/check.svg?raw";import h from"@material-symbols/svg-400/outlined/chevron_right.svg?raw";import g,{default as ee}from"@material-symbols/svg-400/outlined/close.svg?raw";import te from"@material-symbols/svg-400/outlined/cloud.svg?raw";import ne from"@material-symbols/svg-400/outlined/delete.svg?raw";import re from"@material-symbols/svg-400/outlined/folder.svg?raw";import ie from"@material-symbols/svg-400/outlined/home.svg?raw";import ae from"@material-symbols/svg-400/outlined/keep.svg?raw";import oe from"@material-symbols/svg-400/outlined/keep-fill.svg?raw";import se from"@material-symbols/svg-400/outlined/left_panel_close.svg?raw";import ce from"@material-symbols/svg-400/outlined/left_panel_open.svg?raw";import le from"@material-symbols/svg-400/outlined/menu.svg?raw";import ue from"@material-symbols/svg-400/outlined/more_vert.svg?raw";import de from"@material-symbols/svg-400/outlined/redo.svg?raw";import fe from"@material-symbols/svg-400/outlined/schedule.svg?raw";import pe,{default as me}from"@material-symbols/svg-400/outlined/search.svg?raw";import he from"@material-symbols/svg-400/outlined/settings.svg?raw";import ge from"@material-symbols/svg-400/outlined/help.svg?raw";import _e from"@material-symbols/svg-400/outlined/keyboard.svg?raw";import ve from"@material-symbols/svg-400/outlined/sync.svg?raw";import ye from"@material-symbols/svg-400/outlined/undo.svg?raw";import be from"@material-symbols/svg-400/outlined/unfold_more.svg?raw";import xe from"@material-symbols/svg-400/outlined/visibility_off.svg?raw";import Se from"@material-symbols/svg-400/outlined/create_new_folder.svg?raw";import Ce from"@material-symbols/svg-400/outlined/upload_file.svg?raw";import we from"@material-symbols/svg-400/outlined/drive_folder_upload.svg?raw";import Te from"@material-symbols/svg-400/outlined/edit.svg?raw";import Ee from"@material-symbols/svg-400/outlined/download.svg?raw";import De from"@material-symbols/svg-400/outlined/info.svg?raw";import Oe from"@material-symbols/svg-400/outlined/open_in_new.svg?raw";import ke from"@material-symbols/svg-400/outlined/restore_from_trash.svg?raw";import Ae from"@material-symbols/svg-400/outlined/description.svg?raw";import je from"@material-symbols/svg-400/outlined/support_agent.svg?raw";import Me from"@material-symbols/svg-400/outlined/drag_indicator.svg?raw";import Ne from"@material-symbols/svg-400/outlined/mic.svg?raw";import Pe from"@material-symbols/svg-400/outlined/send.svg?raw";import Fe from"@material-symbols/svg-400/outlined/stop_circle.svg?raw";import Ie from"@material-symbols/svg-400/outlined/graphic_eq.svg?raw";import Le from"@material-symbols/svg-400/outlined/attach_file_add.svg?raw";import Re from"@material-symbols/svg-400/outlined/keyboard_arrow_down.svg?raw";import ze from"@material-symbols/svg-400/outlined/more_horiz.svg?raw";import Be from"markdown-it";const _=({name:e,size:t=20,color:n,className:r=``})=>c(`span`,{className:`inline-block shrink-0 [&>svg]:h-full [&>svg]:w-full [&>svg]:fill-current ${r}`,style:{width:t,height:t,color:n},dangerouslySetInnerHTML:{__html:e}}),Ve=e=>e.stopPropagation(),He=e=>e.preventDefault(),Ue=({show:e,children:t})=>e?c(s,{children:t}):null,We=(e,t,n={})=>{let{align:r=`right`,point:i=null,gap:a=4,margin:o=8}=n,s=e?.getBoundingClientRect(),c=t?.getBoundingClientRect(),l=i?{left:i.x,right:i.x,top:i.y,bottom:i.y}:s;if(!l||!c)return null;let u=window.innerWidth,d=window.innerHeight,f=Math.min(c.height,d-o*2),p=i||r===`left`?l.left:l.right-c.width,m=Math.min(Math.max(o,p),Math.max(o,u-c.width-o)),h=l.bottom+a;return{x:m,y:h+f>d-o?Math.max(o,l.top-f-a):h,h:f}},Ge=({m:e,value:t,check:n})=>l(s,{children:[l(`span`,{className:`flex min-w-0 flex-1 flex-col items-start`,children:[c(`span`,{className:`truncate`,children:e.label}),c(`span`,{className:`truncate text-[12px] text-mute`,children:e.desc})]}),t===e.id&&c(_,{name:n,size:18,color:`#4185f4`})]}),Ke=({m:e,value:t,check:n})=>l(s,{children:[t===e.id&&c(_,{name:n,size:18}),t!==e.id&&e.icon&&c(_,{name:e.icon,size:18,color:e.color,className:e.color?``:`text-mute`}),t!==e.id&&!e.icon&&c(`span`,{className:`w-[18px] shrink-0`}),c(`span`,{className:`truncate`,children:e.label})]}),qe=({cls:e=``,items:t=[],value:n,pick:r,style:i,check:a=``,children:o})=>c(`div`,{className:`absolute z-50 rounded-xl border border-line bg-white py-2 shadow-[0_8px_24px_rgba(0,0,0,0.12)] ${e}`,style:i,onClick:Ve,children:o??t.map(e=>c(`div`,{className:e.top?`mt-2 border-t border-line pt-2`:``,children:c(`button`,{onClick:()=>r?.(e),className:`flex w-full items-center gap-3 px-4 text-left hover:bg-pale ${e.desc?`py-2`:`h-11`}`,children:e.desc?c(Ge,{m:e,value:n,check:a}):c(Ke,{m:e,value:n,check:a})})},e.id))}),Je=({items:e,value:t,pick:n,align:r=`right`,cls:u=`w-72`,point:d,check:f,children:p})=>{let m=a(null),h=a(null),[g,ee]=o(null);return i(()=>ee(We(m.current?.parentElement,h.current?.firstElementChild,{align:r,point:d})),[]),l(s,{children:[c(`span`,{ref:m,className:`absolute h-0 w-0`}),c(`div`,{ref:h,className:`fixed z-50`,style:g?{left:g.x,top:g.y}:{left:0,top:0,visibility:`hidden`},children:c(qe,{cls:`left-0 top-0 overflow-y-auto ${u}`,style:{maxHeight:g?.h??window.innerHeight-16},items:e,value:t,pick:n,check:f,children:p})})]})},Ye=`#1f1f21`,Xe=`#8b8b8b`,Ze=`#ececec`,Qe=`#d9d9d9`,$e=`#fafafa`,et=`#f1f1f1`,tt=`#202020`,nt=`#4185f4`,v={row:36,indent:20,slot:20,icon:20,gap:8,brand:22,width:233},rt={card:200,suggest:264},it=15360,at=104857600,ot=`ファイルサイズが大きすぎます (上限 100 MB)`,st=768,ct=1073741824,lt=1048576,ut=1024,dt=e=>String(e).padStart(2,`0`),ft=e=>{let t=new Date(e),n=new Date;return t.toDateString()===n.toDateString()?`${t.getHours()}:${dt(t.getMinutes())}`:t.getFullYear()===n.getFullYear()?`${t.getMonth()+1}月${t.getDate()}日`:`${t.getFullYear()}/${dt(t.getMonth()+1)}/${dt(t.getDate())}`},pt=e=>e>=1048576?`${(e/lt).toFixed(1)} MB`:e>=1024?`${Math.round(e/ut)} KB`:`${e} B`,mt=e=>e>=1073741824?`${(e/ct).toFixed(2)} GB`:`${Math.round(e/lt)} MB`,ht=e=>{let t=Math.max(0,(Date.now()-new Date(e).getTime())/1e3);return t<60?`たった今`:t<3600?`${Math.floor(t/60)} 分前`:t<86400?`${Math.floor(t/3600)} 時間前`:`${Math.floor(t/86400)} 日前`},gt=(e,t)=>{if(!t.has(e))return e;let n=e.lastIndexOf(`.`),r=n>0?e.slice(0,n):e,i=n>0?e.slice(n):``,a=1;for(;t.has(`${r}(${a})${i}`);)a++;return`${r}(${a})${i}`},_t={position:`fixed`,left:`0`,top:`0`,zIndex:`60`,overflow:`hidden`,pointerEvents:`none`,background:`#fff`,transition:`width 0.16s ease, height 0.16s ease, left 0.16s ease, top 0.16s ease`},vt={width:`100%`,height:`100%`},yt={width:`264px`,height:`62px`,borderRadius:`12px`,boxShadow:`0 8px 24px rgba(0, 0, 0, 0.12)`},bt={display:`flex`,alignItems:`center`,padding:`12px`,border:`1px solid ${Qe}`,borderRadius:`12px`,background:`#fff`},y=(e,t)=>Object.assign(e.style,t),xt=()=>{let e=null,t=0,n=0;return{start(r,i,a){if(!r||e)return;let o=r.getBoundingClientRect(),s=r.cloneNode(!0);t=i??o.left,n=a??o.top,e=document.createElement(`div`),y(e,_t),y(s,vt),e.appendChild(s),e.style.left=`${o.left}px`,e.style.top=`${o.top}px`,e.style.width=`${o.width}px`,e.style.height=`${o.height}px`,document.body.appendChild(e),requestAnimationFrame(()=>{e&&(y(e,yt),y(s,bt),s.querySelectorAll(`[data-ghost-hide]`).forEach(e=>y(e,{display:`none`})),e.style.left=`${t}px`,e.style.top=`${n}px`)})},move(r,i){e&&(e.style.transform=`translate(${r-t}px, ${i-n}px)`)},end(){e?.remove(),e=null}}},St=(e,t)=>{let n=e.getAttribute(`data-drop-from`);return n===null||n.split(` `).includes(t)},Ct=(e,t,n,r)=>{let i=document.elementFromPoint(e,t),a=i?.closest(`[data-drop]`),o=a?.getAttribute(`data-drop`);return!i||!a||typeof o!=`string`||!St(a,n)||r(i,o)?null:a},wt=e=>{let t=e.closest(`[data-drop-scope]`)??document,n=Array.from(t.querySelectorAll(`[data-drop-mark="${CSS.escape(e.getAttribute(`data-drop`))}"]`));return n.length>0?n:e.hasAttribute(`data-drop-scope`)?[]:[e]},Tt=[`outline-2`,`-outline-offset-2`,`rounded-lg`,`outline-ink`],Et=()=>{let e=``,t=()=>!1,n=null,r=[];return{begin(n,r=()=>!1){e=n,t=r},move(i,a){let o=Ct(i,a,e,t);o!==n&&(r.forEach(e=>e.classList.remove(...Tt)),n=o,r=o?wt(o):[],r.forEach(e=>e.classList.add(...Tt)))},read(){return n?.getAttribute(`data-drop`)??null},end(){r.forEach(e=>e.classList.remove(...Tt)),r=[],n=null}}},Dt=typeof Float32Array<`u`?Float32Array:Array,b=(e=0,t=0,n=new Dt(2))=>(n[0]=e,n[1]=t,n),Ot=(e,t,n=b())=>(n[0]=e[0]+t[0],n[1]=e[1]+t[1],n),kt=(e,t,n=b())=>(n[0]=e[0]-t[0],n[1]=e[1]-t[1],n),At=(e,t=b())=>(t[0]=e[0],t[1]=e[1],t),x=typeof window<`u`&&!!window.document&&!!window.document.createElement,jt=()=>x&&`ontouchstart`in window,Mt=()=>jt()||x&&window.navigator.maxTouchPoints>1,Nt=()=>x&&`onpointerdown`in window,Pt=()=>x&&`exitPointerLock`in window.document,Ft=()=>{try{return`constructor`in GestureEvent}catch{return!1}},S={isBrowser:x,get gesture(){return S._gesture??=Ft()},get touch(){return S._touch??=jt()},get touchscreen(){return S._touchscreen??=Mt()},get pointer(){return S._pointer??=Nt()},get pointerLock(){return S._pointerLock??=Pt()}},It=(e=!1)=>e&&S.pointerLock?`mouse`:S.pointer?`pointer`:S.touch?`touch`:`mouse`,Lt=(e,t,n)=>{if(t!==`touch`)return b(e.clientX,e.clientY,n);let[r]=e.changedTouches;return b(r.clientX,r.clientY,n)},Rt={touch:{start:`touchstart`,move:`touchmove`,end:`touchend`,up:`touchcancel`},pointer:{start:`pointerdown`,move:`pointermove`,end:`pointerup`,up:`pointercancel`},mouse:{start:`mousedown`,move:`mousemove`,end:`mouseup`,up:`mousecancel`}};let C=null;const zt=(e,t=()=>!0)=>{let n=()=>{b(0,0,r.value),b(0,0,r._value),b(0,0,r.delta),b(0,0,r.movement)},r={_active:!1,active:!1,pointerId:null,device:It(),_value:b(0,0),value:b(0,0),delta:b(0,0),offset:b(0,0),movement:b(0,0),target:null,event:null,memo:{},isDragStart:!1,isDragging:!1,isDragEnd:!1,drag:()=>{let t=r._active;r.isDragStart=r.active&&!t,r.isDragging=r.active&&t,r.isDragEnd=!r.active&&t,e?.(),r._active=r.active},dragStart:e=>{r.active||C&&C!==r||t(e)&&(e.stopPropagation(),C=r,r.pointerId=e.pointerId??null,r.event=e,r._active=!1,r.active=!0,n(),Lt(e,r.device,r.value),r.target.setPointerCapture&&`pointerId`in e&&r.target.setPointerCapture(e.pointerId),r.drag(r))},dragging:e=>{r.event=e,!(r.active&&r.pointerId!==null&&e.pointerId!==r.pointerId)&&(r.active&&e.cancelable&&e.preventDefault(),r.active&&e.stopPropagation(),At(r.value,r._value),Lt(e,r.device,r.value),r.active&&(kt(r.value,r._value,r.delta),Ot(r.offset,r.delta,r.offset),Ot(r.movement,r.delta,r.movement)),r.drag(r))},dragEnd:e=>{r.active&&r.pointerId!==null&&e.pointerId!==r.pointerId||(C===r&&(C=null),r.event=e,r.active=!1,n(),r.pointerId=null,r.target.releasePointerCapture&&`pointerId`in e&&r.target.releasePointerCapture(e.pointerId),r.drag(r))},mount:e=>{r.target=e;let{start:t,move:n,end:i,up:a}=Rt[r.device];e.addEventListener(t,r.dragStart),e.addEventListener(n,r.dragging,{passive:!1}),e.addEventListener(i,r.dragEnd),e.addEventListener(a,r.dragEnd)},clean:()=>{let e=r.target;if(!e)return;let{start:t,move:n,end:i,up:a}=Rt[r.device];e.removeEventListener(t,r.dragStart),e.removeEventListener(n,r.dragging),e.removeEventListener(i,r.dragEnd),e.removeEventListener(a,r.dragEnd),C===r&&(C=null)},ref:e=>{e?r.mount(e):r.clean(null)}};return r},Bt=[`select-none`,`cursor-grabbing`],Vt=e=>{e.preventDefault(),e.stopPropagation()},Ht=(e,t,n,r,i)=>{let a=()=>{u.memo.moved=!0,navigator.vibrate?.(15),document.body.classList.add(...Bt),n.start(u.target,u.value[0],u.value[1]),r.begin(t,(t,n)=>u.target.contains(t)||n===e||n.startsWith(`${e}/`))},o=()=>{clearTimeout(u.memo.timer),u.memo.moved=!1,u.memo.touch=u.event?.pointerType===`touch`,u.memo.touch&&(u.memo.timer=setTimeout(()=>{u.active&&a()},300))},s=()=>{let e=Math.hypot(u.movement[0],u.movement[1])>8;if(u.memo.touch&&!u.memo.moved){e&&clearTimeout(u.memo.timer);return}!u.memo.moved&&!e||(u.memo.moved||a(),n.move(u.value[0],u.value[1]),r.move(u.value[0],u.value[1]))},c=()=>{let e=u.memo.moved?r.read():null;r.end(),n.end(),document.body.classList.remove(...Bt),u.memo.moved&&(window.addEventListener(`click`,Vt,{capture:!0,once:!0}),setTimeout(()=>window.removeEventListener(`click`,Vt,{capture:!0}),0)),e!==null&&i(e)},l=e=>{if(u.active){if(e.type===`contextmenu`&&u.memo.touch)return Vt(e);u.memo.moved&&e.preventDefault()}},u=zt(()=>{u.isDragStart&&o(),u.isDragging&&s(),u.isDragEnd&&c()},e=>e.button===0&&!e.target?.closest?.(`button, a, input, label`));return e=>{if(!e){clearTimeout(u.memo.timer),u.clean();return}u.mount(e),e.addEventListener(`contextmenu`,l),e.addEventListener(`touchmove`,l,{passive:!1})}},Ut=e=>{let t=xt(),n=Et(),r=new Map;return(i,a=``)=>{let o=`${a}:${i}`;return r.has(o)||r.set(o,Ht(i,a,t,n,t=>e(i,t))),r.get(o)}},Wt={start:`dragenter`,move:`dragover`,leave:`dragleave`,end:`drop`},Gt=(e,t=()=>!0)=>{let n={_active:!1,active:!1,depth:0,value:b(0,0),target:null,event:null,memo:{},isDropStart:!1,isDropping:!1,isDropEnd:!1,drop:()=>{let t=n._active;n.isDropStart=n.active&&!t,n.isDropping=n.active&&t,n.isDropEnd=!n.active&&t,e?.(),n._active=n.active},dropStart:e=>{n.depth++,!n.active&&t(e)&&(e.preventDefault(),n.event=e,n._active=!1,n.active=!0,b(e.clientX,e.clientY,n.value),n.drop(n))},dropping:e=>{n.active&&(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=`copy`),n.event=e,b(e.clientX,e.clientY,n.value),n.drop(n))},dropLeave:e=>{n.depth>0&&n.depth--,!(n.depth>0||!n.active)&&(n.event=e,n.active=!1,n.drop(n))},dropEnd:e=>{n.depth=0,n.active&&(e.preventDefault(),n.event=e,n.active=!1,b(e.clientX,e.clientY,n.value),n.drop(n))},mount:e=>{n.target=e;let{start:t,move:r,leave:i,end:a}=Wt;e.addEventListener(t,n.dropStart),e.addEventListener(r,n.dropping),e.addEventListener(i,n.dropLeave),e.addEventListener(a,n.dropEnd)},clean:()=>{let e=n.target;if(!e)return;let{start:t,move:r,leave:i,end:a}=Wt;e.removeEventListener(t,n.dropStart),e.removeEventListener(r,n.dropping),e.removeEventListener(i,n.dropLeave),e.removeEventListener(a,n.dropEnd),n.depth=0,n.active=!1},ref:e=>{if(e)return void n.mount(e);n.clean()}};return n},Kt=e=>!!e.dataTransfer?.types.includes(`Files`),qt=e=>new Promise(t=>e.readEntries(t)),Jt=async e=>{let t=e.createReader(),n=[],r=await qt(t);for(;r.length>0;)n.push(...r),r=await qt(t);return n},Yt=e=>new Promise(t=>e.file(t)),Xt=async(e,t,n)=>{let r=t===``?e.name:`${t}/${e.name}`;if(e.isFile)return void n.push({path:r,file:await Yt(e)});n.push({path:r,file:null});for(let t of await Jt(e))await Xt(t,r,n)},Zt=async e=>{let t=Array.from(e?.items??[]).map(e=>e.webkitGetAsEntry()).filter(e=>!!e),n=[];for(let e of t)await Xt(e,``,n);return n},Qt=(e,t,n=()=>!0)=>{let r=Et(),i=()=>r.begin(e,()=>!n()),a=()=>r.move(s.value[0],s.value[1]),o=()=>{let e=s.event.type===`drop`?r.read():null;r.end(),e!==null&&Zt(s.event.dataTransfer).then(n=>t(n,e))},s=Gt(()=>{s.isDropStart&&i(),s.isDropping&&a(),s.isDropEnd&&o()},Kt);return s.ref},w={add:u,arrowBack:d,arrowDropDown:f,check:p,chevronRight:h,closeIcon:g,cloud:te,deleteIcon:ne,folder:re,home:ie,keep:ae,keepFill:oe,leftPanelClose:se,leftPanelOpen:ce,menuIcon:le,moreVert:ue,redoIcon:de,schedule:fe,searchIcon:pe,settings:he,help:ge,keyboard:_e,sync:ve,undoIcon:ye,unfoldMore:be,visibilityOff:xe,createNewFolder:Se,uploadFile:Ce,driveFolderUpload:we,edit:Te,download:Ee,info:De,openInNew:Oe,restoreFromTrash:ke,description:Ae},$t=({count:e,min:t,cls:n=``,children:r})=>c(`div`,{className:`grid gap-4 overflow-x-auto ${n}`,style:{gridTemplateColumns:`repeat(${e}, minmax(${t}px, 1fr))`},children:r}),en=({c:e,click:t})=>l(`button`,{onClick:t,className:`relative flex h-full w-full cursor-pointer flex-col items-start rounded-xl border border-edge bg-white p-3 text-left hover:bg-pale`,children:[c(`span`,{className:`flex h-[30px] w-[30px] items-center justify-center rounded-md bg-band`,children:c(_,{name:e.icon??``,size:18,color:e.color})}),c(_,{name:w.add,size:16,className:`absolute right-3 top-3 text-mute`}),c(`span`,{className:`mt-2 w-full truncate text-[14px] leading-[17px]`,children:e.label})]}),tn=({c:e,click:t})=>l(`button`,{onClick:t,className:`flex h-12 w-full cursor-pointer items-center gap-3 rounded-xl border border-edge bg-white px-4 text-left hover:bg-pale`,children:[c(_,{name:e.icon??``,size:18,color:e.color}),c(`span`,{className:`truncate`,children:e.label}),c(_,{name:w.add,size:16,className:`ml-auto shrink-0 text-mute`})]}),nn=({cards:e,click:t,popup:n,count:r=4})=>l(s,{children:[c($t,{count:r,min:rt.card,cls:`hidden md:grid`,children:e.map(e=>l(`div`,{className:`relative`,children:[c(en,{c:e,click:t(e)}),n(e)]},e.id))}),c(`div`,{className:`flex flex-col gap-2 md:hidden`,children:e.map(e=>l(`div`,{className:`relative`,children:[c(tn,{c:e,click:t(e)}),n(e)]},e.id))})]}),rn=e=>c(`section`,{className:`relative shrink-0 px-4 pt-3 md:pl-7 md:pr-9`,children:c(nn,{...e})}),an=`flex h-9 w-9 shrink-0 items-center justify-center rounded-full text-mute hover:bg-band hover:text-ink`,on=`flex h-8 w-8 shrink-0 cursor-pointer items-center justify-center rounded-full text-mute hover:bg-band hover:text-ink`,sn=({icon:e,color:t,label:n,home:r,actions:i,drawer:a})=>l(`header`,{className:`fixed inset-x-0 top-0 z-20 flex h-14 items-center gap-1 bg-white pl-4 pr-3 md:hidden`,children:[l(`button`,{onClick:r,className:`flex min-w-0 flex-1 cursor-pointer items-center gap-3`,children:[c(_,{name:e,size:24,color:t}),c(`span`,{className:`truncate text-sm font-bold`,children:n})]}),l(`div`,{className:`ml-auto flex shrink-0 items-center gap-1`,children:[i,c(`button`,{onClick:a,className:an,children:c(_,{name:w.menuIcon,size:22})})]})]}),cn=({bar:e,open:t,title:n,back:r,expand:i,actions:a})=>l(`div`,{className:`mt-2.5 flex h-8 shrink-0 items-center gap-2 px-4 md:pl-7 md:pr-9`,children:[!e&&c(`button`,{onClick:t,className:`${on} hidden md:flex`,children:c(_,{name:w.leftPanelOpen,size:20})}),!r&&c(`h1`,{className:`min-w-0 truncate font-bold`,children:n}),r&&l(`button`,{onClick:r,className:`flex min-w-0 cursor-pointer items-center gap-2 font-bold`,children:[c(_,{name:w.arrowBack,size:20,className:`text-mute`}),c(`span`,{className:`truncate`,children:n})]}),l(`div`,{className:`relative ml-auto flex shrink-0 items-center gap-1`,children:[i&&l(`button`,{onClick:i.click,className:`flex h-8 cursor-pointer items-center gap-1 rounded-lg px-2 hover:bg-band ${i.on?`text-ink`:`text-mute`}`,children:[c(`span`,{className:`hidden md:inline`,children:i.label}),c(_,{name:i.icon||w.unfoldMore,size:18})]}),a]})]}),ln=({icon:e,size:t=20,click:n,children:r})=>l(`span`,{className:`relative hidden md:flex`,children:[c(`button`,{onClick:n,className:on,children:c(_,{name:e,size:t})}),r]}),un=({icon:e,size:t=20,click:n,children:r})=>l(`span`,{className:`relative flex`,children:[c(`button`,{onClick:n,className:an,children:c(_,{name:e,size:t})}),r]}),dn=w.moreVert,fn=({drawer:e,close:t,dropRef:n,children:r})=>l(`div`,{ref:n,onClick:t,className:`flex h-dvh overflow-hidden bg-white font-medium text-ink`,children:[e&&c(`div`,{className:`fixed inset-0 z-30 bg-black/30 md:hidden`,onClick:t}),r]}),pn=({drop:e,from:t,children:n})=>c(`main`,{"data-drop":e,"data-drop-from":t,"data-drop-scope":``,className:`flex min-w-0 flex-1 flex-col overflow-y-auto pt-14 md:pt-0`,children:n}),mn=e=>`flex w-full cursor-pointer items-center rounded-lg text-left text-[14px] text-mute ${e?`bg-band`:`hover:bg-band`}`,hn=({open:e,turn:t})=>t?c(`button`,{onClick:t,className:`flex shrink-0 items-center justify-center`,style:{width:v.slot,height:v.slot},children:c(_,{name:w.chevronRight,size:v.slot,className:e?`rotate-90`:``})}):c(`span`,{className:`shrink-0`,style:{width:v.slot}}),gn=({depth:e=0,on:t=!1,open:n,turn:r,icon:i,color:a,label:o,drop:s,mark:u,from:d,click:f,dclick:p,rclick:m,dragRef:h,children:g})=>l(`div`,{ref:h,"data-drop":s,"data-drop-mark":u,"data-drop-from":d,onClick:e=>(f?.(e),r?.(e)),onDoubleClick:p,onContextMenu:m,className:mn(t),style:{height:v.row,paddingLeft:e*v.indent},children:[c(hn,{open:n,turn:r}),c(_,{name:i,size:v.icon,color:a}),c(`span`,{className:`min-w-0 flex-1 truncate ${t?`text-ink`:``}`,style:{marginLeft:v.gap},children:o}),g]}),_n=`STORAGE`,vn=`アップグレード`,yn=`https://stripe.com`,bn=`ゴミ箱を空にしますか?中のアイテムは完全に削除されます`,xn=[{id:`manage`,icon:w.cloud,label:`保存容量を管理`},{id:`empty`,icon:w.deleteIcon,label:`ゴミ箱を空にする`},{id:`refresh`,icon:w.sync,label:`使用状況を更新`}],Sn=[{id:`undo`,icon:w.undoIcon,label:`直前の操作を元に戻す`},{id:`redo`,icon:w.redoIcon,label:`最後に元に戻した操作をやり直す`},{id:`settings`,icon:w.settings,label:`設定`,top:!0},{id:`help`,icon:w.help,label:`ヘルプ`},{id:`shortcuts`,icon:w.keyboard,label:`キーボードショートカット`}],Cn=Sn.slice(2).map(e=>({...e,top:!1})),wn=w.visibilityOff,Tn=(e,t,n)=>[{id:`band`,icon:wn,label:e?`すべての${t}を非表示`:`すべての${t}を表示`},...n.map((e,t)=>t===0?{...e,top:!0}:e)],En=`flex h-9 w-9 shrink-0 items-center justify-center rounded-full text-mute hover:bg-band hover:text-ink`,Dn=({icon:e,color:t,label:n,click:r})=>l(`button`,{onClick:r,className:`flex min-w-0 flex-1 cursor-pointer items-center gap-3`,children:[c(_,{name:e,size:24,color:t}),c(`span`,{className:`truncate text-sm font-bold`,children:n})]}),On=({storage:e,upgrade:t,menu:n,more:r})=>l(`div`,{className:`relative shrink-0 border-t border-line px-4 pb-4 pt-3`,children:[l(`div`,{className:`flex h-6 items-center gap-2 text-mute`,children:[c(_,{name:w.cloud,size:18}),c(`span`,{className:`tracking-wider`,children:_n}),l(`span`,{className:`relative ml-auto flex`,children:[c(`button`,{onClick:r,className:`flex h-6 w-6 items-center justify-center rounded-full text-mute hover:bg-band`,children:c(_,{name:w.moreVert,size:16})}),n]})]}),c(`div`,{className:`mt-1.5 h-2 overflow-hidden rounded-full bg-line`,children:c(`div`,{className:`h-full rounded-full bg-fill`,style:{width:`${Math.min(100,e.used/e.total*100)}%`}})}),c(`p`,{className:`mt-1.5`,children:e.text}),c(`button`,{onClick:t,className:`mt-2.5 h-9 w-full cursor-pointer rounded-full border border-ink font-bold hover:bg-band`,children:vn})]}),kn=({brand:e,bar:t,drawer:n,fold:r,close:i,press:a,storage:o,upgrade:s,menu:u,more:d,children:f})=>l(`nav`,{"data-drop-scope":``,onClick:a,className:`fixed inset-y-0 left-0 z-40 flex shrink-0 flex-col border-r border-line bg-pale transition-transform md:static md:translate-x-0 ${n?`translate-x-0`:`-translate-x-full`} ${t?``:`md:hidden`}`,style:{width:v.width},children:[l(`div`,{className:`flex h-15 shrink-0 items-center gap-1 pr-2 text-[14px]`,style:{paddingLeft:v.brand},children:[c(Dn,{...e}),c(`button`,{onClick:r,className:`${En} hidden md:flex`,children:c(_,{name:w.leftPanelClose,size:20})}),c(`button`,{onClick:i,className:`${En} md:hidden`,children:c(_,{name:w.leftPanelClose,size:20})})]}),c(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-2 pb-4`,children:f}),c(On,{storage:o,upgrade:s,menu:u,more:d})]}),T={base:`/api/v1/storage`,trash:`.trash`,editors:[]},An=e=>void Object.assign(T,e),E=e=>e.kind.startsWith(`folder`),jn=(e,t)=>e.name.localeCompare(t.name),Mn=(e,t)=>t.iso.localeCompare(e.iso),Nn=(e,t)=>{let n=e.filter(e=>e.parent===t&&!e.trashed);return[...n.filter(E).sort(jn),...n.filter(e=>!E(e)).sort(jn)]},Pn=(e,t)=>e.filter(e=>!e.trashed&&e.kind===t).sort(Mn),Fn=e=>e.filter(e=>!e.trashed&&!E(e)).sort(Mn).slice(0,12),In=e=>e.filter(e=>e.trashed),Ln=e=>e.filter(e=>!e.trashed&&!E(e)).sort((e,t)=>t.bytes-e.bytes),Rn=(e,t)=>e.filter(e=>!e.trashed&&e.parent===t),zn=e=>{let t=e.split(`/`).filter(Boolean);return t.map((e,n)=>({name:n===0&&e===T.trash?`ゴミ箱`:e,path:t.slice(0,n+1).join(`/`)}))},Bn=e=>e.filter(e=>!E(e)).reduce((e,t)=>e+t.bytes,0),Vn=e=>{let{files:t,parent:n,depth:r,expand:i,active:a,kinds:o,fold:u,enter:d,open:f,menu:p,rclick:m,drag:h}=e;return c(s,{children:Nn(t,n).map(t=>{let n=(o[t.kind]??o.file).icon;return E(t)?l(`div`,{children:[c(gn,{depth:r,on:a===t.id,open:i.includes(t.id),turn:u(t.id),icon:o.folder.icon,label:t.name,drop:t.id,mark:t.id,click:d(t.id),rclick:m(t),dragRef:h(t.id,`tree`),children:p(t)}),i.includes(t.id)&&c(Vn,{...e,parent:t.id,depth:r+1})]},t.id):c(gn,{depth:r,icon:n,label:t.name,drop:t.parent,click:d(t.parent),dclick:f(t),rclick:m(t),dragRef:h(t.id,`tree`),children:p(t)},t.id)})})},D=e(!1),O=e(null),Hn=()=>D.value,Un=()=>n(D),Wn=()=>n(O),Gn=e=>{e.stopPropagation(),t(D,!0)},Kn=()=>t(D,!1),qn=e=>t(O,{x:e.clientX,y:e.clientY}),Jn=()=>t(O,null),Yn=e=>e.split(`/`).map(encodeURIComponent).join(`/`),Xn=(e,t)=>e.then(e=>e.ok?e.json():t).catch(()=>t),k=e=>`${T.base}/${Yn(e)}`,A={list(e=``){return Xn(fetch(`${T.base}?prefix=${encodeURIComponent(e)}`),[])},get(e){return fetch(k(e))},put(e,t,n={}){let r=`?kind=${encodeURIComponent(n.kind??``)}&site=${encodeURIComponent(n.site??``)}`;return Xn(fetch(k(e)+r,{method:`POST`,headers:n.type?{"Content-Type":n.type}:void 0,body:t}),{path:e,size:0,date:new Date().toISOString()})},move(e,t){return fetch(`${k(e)}?to=${encodeURIComponent(t)}`,{method:`PUT`})},remove(e){return fetch(k(e),{method:`DELETE`})}},j=(e,t)=>t===``?e:`${t}/${e}`,Zn=e=>e.split(`/`).slice(0,-1).join(`/`),Qn=e=>e.path.endsWith(`/`)?e.path.slice(0,-1):e.path,$n=e=>e.split(`/`).slice(0,-1).map((e,t,n)=>n.slice(0,t+1).join(`/`)).filter(e=>e!==T.trash),er=e=>e.includes(`.`)?(e.split(`.`).pop()??``).toLowerCase():``,tr=e=>{let t=er(e);return t===`pdf`?`pdf`:t===`mp4`||t===`mov`||t===`webm`?`mp4`:t===`jpg`||t===`jpeg`||t===`png`||t===`gif`?`jpg`:t===`xlsx`||t===`xls`||t===`csv`?`xlsx`:`file`},nr=(e,t)=>{let n=Qn(e),r=n.startsWith(`${T.trash}/`),i=r?n.slice(T.trash.length+1):n,a=i.split(`/`).pop(),o=e.kind??t?.kind??(e.path.endsWith(`/`)?`folder`:tr(a)),s=o.startsWith(`folder`)?`—`:pt(e.size);return{owner:`自分`,...t,id:n,name:a,kind:o,date:ft(e.date),iso:e.date,size:s,bytes:e.size,parent:Zn(i),trashed:r}},M=(e,t,n,r=!1)=>gt(e,new Set(t.filter(e=>e.parent===n&&!!e.trashed===r).map(e=>e.name))),N=e=>e.scan(`files/`),rr=(e,t)=>{let n=nr(t,e[`files/${Qn(t)}`]);return e[`files/${n.id}`]=n,$n(n.id).forEach(n=>{e[`files/${n}`]||(e[`files/${n}`]=nr({path:`${n}/`,size:0,date:t.date}))}),n},ir=async(e,t,n,r,i,a)=>{let o=M(n.replace(/^\.+/,``)||`無題のファイル`,N(e),r),s=j(o,r),c={path:t.startsWith(`folder`)?`${s}/`:s,size:i?.size??0,date:new Date().toISOString(),kind:t};return rr(e,c),rr(e,await A.put(c.path,i,{kind:t,site:a,type:i?.type}))},P=async(e,t,n=``)=>{let r=n;for(let n of t.split(`/`).filter(Boolean)){let t=e[`files/${j(n,r)}`];r=t?.kind.startsWith(`folder`)?t.id:(await ir(e,`folder`,n,r,``)).id}return r},ar=async(e,t,n)=>{for(let{path:r,file:i}of t){let t=r.split(`/`).filter(Boolean),a=t.pop(),o=await P(e,t.join(`/`),n);i||await P(e,a,o),i&&await ir(e,tr(a),a,o,i)}},or=async(e,t)=>{let n=await A.list(),r=new Set;for(let e of n){let n=rr(t,e);r.add(n.id),$n(n.id).forEach(e=>r.add(e))}N(t).forEach(e=>!r.has(e.id)&&delete t[`files/${e.id}`]);let i=n.reduce((e,t)=>e+t.size,0);return t.storage={used:i/1048576,total:it,text:`15 GB 中 ${mt(i)} を使用`},`synced ${n.length} objects`},sr=async({id:e,dir:t},n)=>{let r=n[`files/${e}`];if(!r||r.trashed)return`not found: ${e}`;if(r.parent===t)return`already in ${t===``?`root`:t}`;if(r.kind.startsWith(`folder`)&&(t===e||t.startsWith(`${e}/`)))return`cannot move ${r.name} into itself`;let i=M(r.name,N(n),t),a=j(i,t);return await A.move(e,a),delete n[`files/${e}`],n[`files/${a}`]={...r,id:a,name:i,parent:t},N(n).forEach(t=>{if(!t.id.startsWith(`${e}/`))return;delete n[`files/${t.id}`];let r={...t,id:a+t.id.slice(e.length),parent:a+t.parent.slice(e.length)};n[`files/${r.id}`]=r}),`moved ${i} to ${t===``?`root`:t}`},cr=async({id:e},t)=>{let n=t[`files/${e}`];if(!n)return`not found: ${e}`;if(n.trashed)return delete t[`files/${e}`],N(t).forEach(n=>n.id.startsWith(`${e}/`)&&delete t[`files/${n.id}`]),await A.remove(e),`deleted ${n.name}`;let r=M(n.name,N(t),n.parent,!0),i=j(r,n.parent);return await A.move(e,`${T.trash}/${i}`),delete t[`files/${e}`],t[`files/${T.trash}/${i}`]={...n,id:`${T.trash}/${i}`,name:r,trashed:!0},N(t).forEach(n=>{if(!n.id.startsWith(`${e}/`))return;delete t[`files/${n.id}`];let r={...n,id:`${T.trash}/${i}${n.id.slice(e.length)}`,parent:i+n.parent.slice(e.length),trashed:!0};t[`files/${r.id}`]=r}),`trashed ${n.name}`},lr=async({id:e},t)=>{let n=t[`files/${e}`];if(!n?.trashed)return`not trashed: ${e}`;let r=await P(t,n.parent),i=M(n.name,N(t),r),a=j(i,r);await A.move(e,a),delete t[`files/${e}`];let o={...n,id:a,name:i,parent:r};return delete o.trashed,t[`files/${a}`]=o,`restored ${i}`},ur=async({id:e,name:t},n)=>{let r=n[`files/${e}`];if(!r)return`not found: ${e}`;let i=t.replace(/^\.+/,``)||r.name,a=M(i,N(n),r.parent),o=j(a,r.parent);return await A.move(e,o),delete n[`files/${e}`],n[`files/${o}`]={...r,id:o,name:a},N(n).forEach(t=>{if(!t.id.startsWith(`${e}/`))return;delete n[`files/${t.id}`];let r={...t,id:o+t.id.slice(e.length),parent:o+t.parent.slice(e.length)};n[`files/${r.id}`]=r}),`renamed to ${a}`},dr=async(e,t)=>{let n=N(t).filter(e=>e.trashed);n.forEach(e=>delete t[`files/${e.id}`]);let r=await A.list(`${T.trash}/`);return await Promise.all(r.map(e=>A.remove(e.path))),`emptied ${n.length} items`},fr=e=>Bn(N(e)),F={ask:`Ask me anything...`,brand:`Claude`,voice:`音声モード`,file:`ファイル`},I=[{id:`claude-fable-5`,label:`Fable 5`,desc:`最も困難な課題に`},{id:`claude-opus-5`,label:`Opus 5`,desc:`複雑なタスク向け`},{id:`claude-sonnet-5`,label:`Sonnet 5`,desc:`日常のタスクに最適`},{id:`claude-haiku-4-5`,label:`Haiku 4.5`,desc:`素早い回答に最適`}],L={w:376,left:12,top:12,bottom:16,minH:180},R=e(``),z={send:async()=>``,stream:{parse:()=>[],send:async()=>[]},icon:``,path:``,headers:{},hello:()=>({greet:``,title:``,desc:``,prompts:[]}),commands:()=>[],hints:()=>[],menu:{useOpen:()=>n(R),flip:e=>n=>{n.stopPropagation(),t(R,R.value===e?``:e)},close:()=>t(R,``)}},pr=e=>void Object.assign(z,e),mr=(e,t=20,n=6)=>{let r=a(null);return i(()=>{let e=r.current;if(!e)return;e.style.height=`${t}px`;let i=Math.max(1,Math.round(e.scrollHeight/t));e.style.height=`${Math.min(i,n)*t}px`},[e]),r},hr=(()=>{let e=new Be({linkify:!0,breaks:!0}),t=t=>e.render(t);return{render:t,plain:e=>{let n=document.createElement(`div`);return n.innerHTML=t(e),n.textContent?.trim()??``}}})(),B=e(!1),V=e([]),H=e(``),U=e([0,0]),gr=e(I[0].id),W=e(!1),G=e(!1),_r=()=>W.value,vr=()=>n(W),K=e(!1);let q=null;const yr=()=>{let e=window.SpeechRecognition??window.webkitSpeechRecognition;if(!e)return null;let n=new e;return n.lang=`ja-JP`,n.continuous=!0,n.interimResults=!1,n.onresult=e=>{let n=``;for(let t=e.resultIndex;t<e.results.length;t++)e.results[t].isFinal&&(n+=e.results[t][0].transcript);n!==``&&t(H,H.value+n)},n.onend=()=>t(K,!1),n},br=()=>{if(K.value)return void q?.stop();q??=yr(),q&&(q.start(),t(K,!0))};let J=[0,0,28,28];const xr=(e,t,n)=>Math.min(Math.max(e,t),Math.max(t,n)),Sr=()=>{let[e,t]=U.value,n=Y.target.getBoundingClientRect();J=[n.left-e,n.top-t,n.width,n.height]},Cr=()=>{let e=xr(Y.offset[0],-J[0],window.innerWidth-J[2]-J[0]),n=xr(Y.offset[1],-J[1],window.innerHeight-J[3]-J[1]);b(e,n,Y.offset),t(U,[e,n])},Y=zt(()=>{Y.isDragStart&&Sr(),Cr()}),wr=()=>{b(0,0,Y.offset),t(U,[0,0])},Tr=()=>{let e=Y.target;!e||!e.isConnected||(Sr(),Cr())},Er=()=>{r(()=>(Tr(),window.addEventListener(`resize`,Tr),()=>window.removeEventListener(`resize`,Tr)),[])},Dr=e=>`calc(max(${L.left}px, 100vw - ${L.w+L.left}px) + ${e}px)`,Or=e=>L.top+e,kr=e=>`max(${L.minH}px, min(calc(100dvh - ${L.top+L.left}px), calc(100dvh - ${L.top+L.bottom+e}px)))`,X=e(null),Z=e(0),Ar=(e,t)=>{if(t)return t;if(!e.startsWith(`/`))return[];let n=e.slice(1).trim().toLowerCase();return z.commands().filter(e=>e.name.toLowerCase().startsWith(n))},jr=()=>{t(X,null),t(Z,0)},Q=async e=>{t(H,``),jr();let n=await e.run();Array.isArray(n)&&t(X,n)},Mr=e=>{if(!e.startsWith(`/`))return;let t=e.slice(1).trim().toLowerCase();return z.commands().find(e=>e.name.toLowerCase()===t)??Ar(e,null)[0]},Nr=e=>{if(e.nativeEvent?.isComposing)return!1;let n=Ar(H.value,X.value);if(n.length===0)return!1;let r=Z.value%n.length;return e.key===`ArrowDown`?(e.preventDefault(),t(Z,(r+1)%n.length),!0):e.key===`ArrowUp`?(e.preventDefault(),t(Z,(r-1+n.length)%n.length),!0):e.key===`Escape`?(e.preventDefault(),t(H,``),jr(),!0):e.key===`Enter`&&(e.preventDefault(),Q(n[r]),!0)},Pr=(()=>{let e=e=>e.replace(/[^0-9A-Za-zぁ-んァ-ヴー一-龠々\s]/g,` `).replace(/\s+/g,` `).trim(),t=e=>{let t=document.createElement(`div`);return t.innerHTML=hr.render(e),t.querySelectorAll(`pre`).forEach(e=>e.remove()),t.textContent??``};return{lines:n=>t(n).split(`
2
- `).map(e).filter(e=>e!==``)}})();let $=0,Fr=[];const Ir=[`Kyoko`,`O-Ren`,`Nanami`,`Ayumi`,`Haruka`,`Sayaka`,`Samantha`,`Zira`,`Aria`,`Jenny`,`Ava`,`Sonia`,`Google 日本語`,`Google US English`],Lr=[`Otoya`,`Ichiro`,`Keita`,`David`,`Mark`,`Guy`,`Alex`,`Daniel`,`Fred`,`Andrew`,`Brian`],Rr=()=>Fr=speechSynthesis.getVoices(),zr=e=>{Fr.length===0&&Rr();let t=Fr.filter(t=>t.lang.replace(`_`,`-`).startsWith(e.slice(0,2)));return t.find(e=>Ir.some(t=>e.name.includes(t)))??t.find(e=>!Lr.some(t=>e.name.includes(t)))??t[0]??null},Br=e=>{(e.match(/[A-Za-z][0-9A-Za-z]*(?: (?:[0-9]+ )*[A-Za-z][0-9A-Za-z]*)*|(?:(?![A-Za-z]).)+/g)??[]).forEach(e=>{if(e.trim()===``)return;let t=new SpeechSynthesisUtterance(e);t.lang=/^[A-Za-z]/.test(e)?`en-US`:`ja-JP`,t.voice=zr(t.lang),speechSynthesis.speak(t)})};speechSynthesis.addEventListener(`voiceschanged`,Rr);const Vr=e=>{if(!G.value)return;let t=e.split(`
1
+ import{atom as e,setAtom as t,useAtomValue as n,useClient as r}from"./react.js";import{useEffect as i,useLayoutEffect as a,useRef as o,useState as s}from"react";import{Fragment as c,jsx as l,jsxs as u}from"react/jsx-runtime";import d from"@material-symbols/svg-400/outlined/add.svg?raw";import f from"@material-symbols/svg-400/outlined/arrow_back.svg?raw";import p from"@material-symbols/svg-400/outlined/arrow_drop_down.svg?raw";import m,{default as h}from"@material-symbols/svg-400/outlined/check.svg?raw";import g from"@material-symbols/svg-400/outlined/chevron_right.svg?raw";import _,{default as ee}from"@material-symbols/svg-400/outlined/close.svg?raw";import te from"@material-symbols/svg-400/outlined/cloud.svg?raw";import ne from"@material-symbols/svg-400/outlined/delete.svg?raw";import re from"@material-symbols/svg-400/outlined/folder.svg?raw";import ie from"@material-symbols/svg-400/outlined/home.svg?raw";import ae from"@material-symbols/svg-400/outlined/keep.svg?raw";import oe from"@material-symbols/svg-400/outlined/keep-fill.svg?raw";import se from"@material-symbols/svg-400/outlined/left_panel_close.svg?raw";import ce from"@material-symbols/svg-400/outlined/left_panel_open.svg?raw";import le from"@material-symbols/svg-400/outlined/menu.svg?raw";import ue from"@material-symbols/svg-400/outlined/more_vert.svg?raw";import de from"@material-symbols/svg-400/outlined/redo.svg?raw";import fe from"@material-symbols/svg-400/outlined/schedule.svg?raw";import pe,{default as me}from"@material-symbols/svg-400/outlined/search.svg?raw";import he from"@material-symbols/svg-400/outlined/settings.svg?raw";import ge from"@material-symbols/svg-400/outlined/help.svg?raw";import _e from"@material-symbols/svg-400/outlined/keyboard.svg?raw";import ve from"@material-symbols/svg-400/outlined/sync.svg?raw";import ye from"@material-symbols/svg-400/outlined/undo.svg?raw";import be from"@material-symbols/svg-400/outlined/unfold_more.svg?raw";import xe from"@material-symbols/svg-400/outlined/visibility_off.svg?raw";import Se from"@material-symbols/svg-400/outlined/create_new_folder.svg?raw";import Ce from"@material-symbols/svg-400/outlined/upload_file.svg?raw";import we from"@material-symbols/svg-400/outlined/drive_folder_upload.svg?raw";import Te from"@material-symbols/svg-400/outlined/edit.svg?raw";import Ee from"@material-symbols/svg-400/outlined/download.svg?raw";import De from"@material-symbols/svg-400/outlined/info.svg?raw";import Oe from"@material-symbols/svg-400/outlined/open_in_new.svg?raw";import ke from"@material-symbols/svg-400/outlined/restore_from_trash.svg?raw";import Ae from"@material-symbols/svg-400/outlined/description.svg?raw";import je from"@material-symbols/svg-400/outlined/support_agent.svg?raw";import Me from"@material-symbols/svg-400/outlined/drag_indicator.svg?raw";import Ne from"@material-symbols/svg-400/outlined/mic.svg?raw";import Pe from"@material-symbols/svg-400/outlined/send.svg?raw";import Fe from"@material-symbols/svg-400/outlined/stop_circle.svg?raw";import Ie from"@material-symbols/svg-400/outlined/graphic_eq.svg?raw";import Le from"@material-symbols/svg-400/outlined/attach_file_add.svg?raw";import Re from"@material-symbols/svg-400/outlined/keyboard_arrow_down.svg?raw";import ze from"@material-symbols/svg-400/outlined/more_horiz.svg?raw";import Be from"markdown-it";const v=({name:e,size:t=20,color:n,className:r=``})=>l(`span`,{className:`inline-block shrink-0 [&>svg]:h-full [&>svg]:w-full [&>svg]:fill-current ${r}`,style:{width:t,height:t,color:n},dangerouslySetInnerHTML:{__html:e}}),y=e=>e.stopPropagation(),Ve=e=>e.preventDefault(),He=({show:e,children:t})=>e?l(c,{children:t}):null,Ue=(e,t,n={})=>{let{align:r=`right`,point:i=null,gap:a=4,margin:o=8}=n,s=e?.getBoundingClientRect(),c=t?.getBoundingClientRect(),l=i?{left:i.x,right:i.x,top:i.y,bottom:i.y}:s;if(!l||!c)return null;let u=window.innerWidth,d=window.innerHeight,f=Math.min(c.height,d-o*2),p=i||r===`left`?l.left:l.right-c.width,m=Math.min(Math.max(o,p),Math.max(o,u-c.width-o)),h=l.bottom+a;return{x:m,y:h+f>d-o?Math.max(o,l.top-f-a):h,h:f}},We=({m:e,value:t,check:n})=>u(c,{children:[u(`span`,{className:`flex min-w-0 flex-1 flex-col items-start`,children:[l(`span`,{className:`truncate`,children:e.label}),l(`span`,{className:`truncate text-[12px] text-mute`,children:e.desc})]}),t===e.id&&l(v,{name:n,size:18,color:`#4185f4`})]}),Ge=({m:e,value:t,check:n})=>u(c,{children:[t===e.id&&l(v,{name:n,size:18}),t!==e.id&&e.icon&&l(v,{name:e.icon,size:18,color:e.color,className:e.color?``:`text-mute`}),t!==e.id&&!e.icon&&l(`span`,{className:`w-[18px] shrink-0`}),l(`span`,{className:`truncate`,children:e.label})]}),Ke=({cls:e=``,items:t=[],value:n,pick:r,style:i,check:a=``,children:o})=>l(`div`,{className:`absolute z-50 rounded-xl border border-line bg-white py-2 shadow-[0_8px_24px_rgba(0,0,0,0.12)] ${e}`,style:i,onClick:y,children:o??t.map(e=>l(`div`,{className:e.top?`mt-2 border-t border-line pt-2`:``,children:l(`button`,{disabled:e.disabled,onClick:()=>r?.(e),className:`flex w-full items-center gap-3 px-4 text-left hover:bg-pale disabled:pointer-events-none disabled:opacity-40 ${e.desc?`py-2`:`h-11`}`,children:e.desc?l(We,{m:e,value:n,check:a}):l(Ge,{m:e,value:n,check:a})})},e.id))}),b=({items:e,value:t,pick:n,align:r=`right`,cls:i=`w-72`,point:d,check:f,children:p})=>{let m=o(null),h=o(null),[g,_]=s(null);return a(()=>_(Ue(m.current?.parentElement,h.current?.firstElementChild,{align:r,point:d})),[]),u(c,{children:[l(`span`,{ref:m,className:`absolute h-0 w-0`}),l(`div`,{ref:h,className:`fixed z-50`,style:g?{left:g.x,top:g.y}:{left:0,top:0,visibility:`hidden`},children:l(Ke,{cls:`left-0 top-0 overflow-y-auto ${i}`,style:{maxHeight:g?.h??window.innerHeight-16},items:e,value:t,pick:n,check:f,children:p})})]})},qe=`#1f1f21`,Je=`#8b8b8b`,Ye=`#ececec`,Xe=`#d9d9d9`,Ze=`#fafafa`,Qe=`#f1f1f1`,$e=`#202020`,et=`#4185f4`,x={row:36,indent:20,slot:20,icon:20,gap:8,brand:22,width:233},tt={card:200,suggest:264},nt=15360,rt=104857600,it=`ファイルサイズが大きすぎます (上限 100 MB)`,at=768,ot=1073741824,st=1048576,ct=1024,lt=e=>String(e).padStart(2,`0`),ut=e=>{let t=new Date(e),n=new Date;return t.toDateString()===n.toDateString()?`${t.getHours()}:${lt(t.getMinutes())}`:t.getFullYear()===n.getFullYear()?`${t.getMonth()+1}月${t.getDate()}日`:`${t.getFullYear()}/${lt(t.getMonth()+1)}/${lt(t.getDate())}`},dt=e=>e>=1048576?`${(e/st).toFixed(1)} MB`:e>=1024?`${Math.round(e/ct)} KB`:`${e} B`,ft=e=>e>=1073741824?`${(e/ot).toFixed(2)} GB`:`${Math.round(e/st)} MB`,pt=e=>{let t=Math.max(0,(Date.now()-new Date(e).getTime())/1e3);return t<60?`たった今`:t<3600?`${Math.floor(t/60)} 分前`:t<86400?`${Math.floor(t/3600)} 時間前`:`${Math.floor(t/86400)} 日前`},mt=(e,t)=>{if(!t.has(e))return e;let n=e.lastIndexOf(`.`),r=n>0?e.slice(0,n):e,i=n>0?e.slice(n):``,a=1;for(;t.has(`${r}(${a})${i}`);)a++;return`${r}(${a})${i}`},ht={position:`fixed`,left:`0`,top:`0`,zIndex:`60`,overflow:`hidden`,pointerEvents:`none`,background:`#fff`,transition:`width 0.16s ease, height 0.16s ease, left 0.16s ease, top 0.16s ease`},gt={width:`100%`,height:`100%`},_t={width:`264px`,height:`62px`,borderRadius:`12px`,boxShadow:`0 8px 24px rgba(0, 0, 0, 0.12)`},vt={display:`flex`,alignItems:`center`,padding:`12px`,border:`1px solid ${Xe}`,borderRadius:`12px`,background:`#fff`},S=(e,t)=>Object.assign(e.style,t),yt=()=>{let e=null,t=0,n=0;return{start(r,i,a){if(!r||e)return;let o=r.getBoundingClientRect(),s=r.cloneNode(!0);t=i??o.left,n=a??o.top,e=document.createElement(`div`),S(e,ht),S(s,gt),e.appendChild(s),e.style.left=`${o.left}px`,e.style.top=`${o.top}px`,e.style.width=`${o.width}px`,e.style.height=`${o.height}px`,document.body.appendChild(e),requestAnimationFrame(()=>{e&&(S(e,_t),S(s,vt),s.querySelectorAll(`[data-ghost-hide]`).forEach(e=>S(e,{display:`none`})),e.style.left=`${t}px`,e.style.top=`${n}px`)})},move(r,i){e&&(e.style.transform=`translate(${r-t}px, ${i-n}px)`)},end(){e?.remove(),e=null}}},bt=(e,t)=>{let n=e.getAttribute(`data-drop-from`);return n===null||n.split(` `).includes(t)},xt=(e,t,n,r)=>{let i=document.elementFromPoint(e,t),a=i?.closest(`[data-drop]`),o=a?.getAttribute(`data-drop`);return!i||!a||typeof o!=`string`||!bt(a,n)||r(i,o)?null:a},St=e=>{let t=e.closest(`[data-drop-scope]`)??document,n=Array.from(t.querySelectorAll(`[data-drop-mark="${CSS.escape(e.getAttribute(`data-drop`))}"]`));return n.length>0?n:e.hasAttribute(`data-drop-scope`)?[]:[e]},Ct=[`outline-2`,`-outline-offset-2`,`rounded-lg`,`outline-ink`],wt=()=>{let e=``,t=()=>!1,n=null,r=[];return{begin(n,r=()=>!1){e=n,t=r},move(i,a){let o=xt(i,a,e,t);o!==n&&(r.forEach(e=>e.classList.remove(...Ct)),n=o,r=o?St(o):[],r.forEach(e=>e.classList.add(...Ct)))},read(){return n?.getAttribute(`data-drop`)??null},end(){r.forEach(e=>e.classList.remove(...Ct)),r=[],n=null}}},Tt=typeof Float32Array<`u`?Float32Array:Array,C=(e=0,t=0,n=new Tt(2))=>(n[0]=e,n[1]=t,n),Et=(e,t,n=C())=>(n[0]=e[0]+t[0],n[1]=e[1]+t[1],n),Dt=(e,t,n=C())=>(n[0]=e[0]-t[0],n[1]=e[1]-t[1],n),Ot=(e,t=C())=>(t[0]=e[0],t[1]=e[1],t),w=typeof window<`u`&&!!window.document&&!!window.document.createElement,kt=()=>w&&`ontouchstart`in window,At=()=>kt()||w&&window.navigator.maxTouchPoints>1,jt=()=>w&&`onpointerdown`in window,Mt=()=>w&&`exitPointerLock`in window.document,Nt=()=>{try{return`constructor`in GestureEvent}catch{return!1}},T={isBrowser:w,get gesture(){return T._gesture??=Nt()},get touch(){return T._touch??=kt()},get touchscreen(){return T._touchscreen??=At()},get pointer(){return T._pointer??=jt()},get pointerLock(){return T._pointerLock??=Mt()}},Pt=(e=!1)=>e&&T.pointerLock?`mouse`:T.pointer?`pointer`:T.touch?`touch`:`mouse`,Ft=(e,t,n)=>{if(t!==`touch`)return C(e.clientX,e.clientY,n);let[r]=e.changedTouches;return C(r.clientX,r.clientY,n)},It={touch:{start:`touchstart`,move:`touchmove`,end:`touchend`,up:`touchcancel`},pointer:{start:`pointerdown`,move:`pointermove`,end:`pointerup`,up:`pointercancel`},mouse:{start:`mousedown`,move:`mousemove`,end:`mouseup`,up:`mousecancel`}};let E=null;const Lt=(e,t=()=>!0)=>{let n=()=>{C(0,0,r.value),C(0,0,r._value),C(0,0,r.delta),C(0,0,r.movement)},r={_active:!1,active:!1,pointerId:null,device:Pt(),_value:C(0,0),value:C(0,0),delta:C(0,0),offset:C(0,0),movement:C(0,0),target:null,event:null,memo:{},isDragStart:!1,isDragging:!1,isDragEnd:!1,drag:()=>{let t=r._active;r.isDragStart=r.active&&!t,r.isDragging=r.active&&t,r.isDragEnd=!r.active&&t,e?.(),r._active=r.active},dragStart:e=>{r.active||E&&E!==r||t(e)&&(e.stopPropagation(),E=r,r.pointerId=e.pointerId??null,r.event=e,r._active=!1,r.active=!0,n(),Ft(e,r.device,r.value),r.target.setPointerCapture&&`pointerId`in e&&r.target.setPointerCapture(e.pointerId),r.drag(r))},dragging:e=>{r.event=e,!(r.active&&r.pointerId!==null&&e.pointerId!==r.pointerId)&&(r.active&&e.cancelable&&e.preventDefault(),r.active&&e.stopPropagation(),Ot(r.value,r._value),Ft(e,r.device,r.value),r.active&&(Dt(r.value,r._value,r.delta),Et(r.offset,r.delta,r.offset),Et(r.movement,r.delta,r.movement)),r.drag(r))},dragEnd:e=>{r.active&&r.pointerId!==null&&e.pointerId!==r.pointerId||(E===r&&(E=null),r.event=e,r.active=!1,n(),r.pointerId=null,r.target.releasePointerCapture&&`pointerId`in e&&r.target.releasePointerCapture(e.pointerId),r.drag(r))},mount:e=>{r.target=e;let{start:t,move:n,end:i,up:a}=It[r.device];e.addEventListener(t,r.dragStart),e.addEventListener(n,r.dragging,{passive:!1}),e.addEventListener(i,r.dragEnd),e.addEventListener(a,r.dragEnd)},clean:()=>{let e=r.target;if(!e)return;let{start:t,move:n,end:i,up:a}=It[r.device];e.removeEventListener(t,r.dragStart),e.removeEventListener(n,r.dragging),e.removeEventListener(i,r.dragEnd),e.removeEventListener(a,r.dragEnd),E===r&&(E=null)},ref:e=>{e?r.mount(e):r.clean(null)}};return r},Rt=[`select-none`,`cursor-grabbing`],zt=e=>{e.preventDefault(),e.stopPropagation()},Bt=(e,t,n,r,i)=>{let a=()=>{u.memo.moved=!0,navigator.vibrate?.(15),document.body.classList.add(...Rt),n.start(u.target,u.value[0],u.value[1]),r.begin(t,(t,n)=>u.target.contains(t)||n===e||n.startsWith(`${e}/`))},o=()=>{clearTimeout(u.memo.timer),u.memo.moved=!1,u.memo.touch=u.event?.pointerType===`touch`,u.memo.touch&&(u.memo.timer=setTimeout(()=>{u.active&&a()},300))},s=()=>{let e=Math.hypot(u.movement[0],u.movement[1])>8;if(u.memo.touch&&!u.memo.moved){e&&clearTimeout(u.memo.timer);return}!u.memo.moved&&!e||(u.memo.moved||a(),n.move(u.value[0],u.value[1]),r.move(u.value[0],u.value[1]))},c=()=>{let e=u.memo.moved?r.read():null;r.end(),n.end(),document.body.classList.remove(...Rt),u.memo.moved&&(window.addEventListener(`click`,zt,{capture:!0,once:!0}),setTimeout(()=>window.removeEventListener(`click`,zt,{capture:!0}),0)),e!==null&&i(e)},l=e=>{if(u.active){if(e.type===`contextmenu`&&u.memo.touch)return zt(e);u.memo.moved&&e.preventDefault()}},u=Lt(()=>{u.isDragStart&&o(),u.isDragging&&s(),u.isDragEnd&&c()},e=>e.button===0&&!e.target?.closest?.(`button, a, input, label`));return e=>{if(!e){clearTimeout(u.memo.timer),u.clean();return}u.mount(e),e.addEventListener(`contextmenu`,l),e.addEventListener(`touchmove`,l,{passive:!1})}},Vt=e=>{let t=yt(),n=wt(),r=new Map;return(i,a=``)=>{let o=`${a}:${i}`;return r.has(o)||r.set(o,Bt(i,a,t,n,t=>e(i,t))),r.get(o)}},Ht={start:`dragenter`,move:`dragover`,leave:`dragleave`,end:`drop`},Ut=(e,t=()=>!0)=>{let n={_active:!1,active:!1,depth:0,value:C(0,0),target:null,event:null,memo:{},isDropStart:!1,isDropping:!1,isDropEnd:!1,drop:()=>{let t=n._active;n.isDropStart=n.active&&!t,n.isDropping=n.active&&t,n.isDropEnd=!n.active&&t,e?.(),n._active=n.active},dropStart:e=>{n.depth++,!n.active&&t(e)&&(e.preventDefault(),n.event=e,n._active=!1,n.active=!0,C(e.clientX,e.clientY,n.value),n.drop(n))},dropping:e=>{n.active&&(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=`copy`),n.event=e,C(e.clientX,e.clientY,n.value),n.drop(n))},dropLeave:e=>{n.depth>0&&n.depth--,!(n.depth>0||!n.active)&&(n.event=e,n.active=!1,n.drop(n))},dropEnd:e=>{n.depth=0,n.active&&(e.preventDefault(),n.event=e,n.active=!1,C(e.clientX,e.clientY,n.value),n.drop(n))},mount:e=>{n.target=e;let{start:t,move:r,leave:i,end:a}=Ht;e.addEventListener(t,n.dropStart),e.addEventListener(r,n.dropping),e.addEventListener(i,n.dropLeave),e.addEventListener(a,n.dropEnd)},clean:()=>{let e=n.target;if(!e)return;let{start:t,move:r,leave:i,end:a}=Ht;e.removeEventListener(t,n.dropStart),e.removeEventListener(r,n.dropping),e.removeEventListener(i,n.dropLeave),e.removeEventListener(a,n.dropEnd),n.depth=0,n.active=!1},ref:e=>{if(e)return void n.mount(e);n.clean()}};return n},Wt=e=>!!e.dataTransfer?.types.includes(`Files`),Gt=e=>new Promise(t=>e.readEntries(t)),Kt=async e=>{let t=e.createReader(),n=[],r=await Gt(t);for(;r.length>0;)n.push(...r),r=await Gt(t);return n},qt=e=>new Promise(t=>e.file(t)),Jt=async(e,t,n)=>{let r=t===``?e.name:`${t}/${e.name}`;if(e.isFile)return void n.push({path:r,file:await qt(e)});n.push({path:r,file:null});for(let t of await Kt(e))await Jt(t,r,n)},Yt=async e=>{let t=Array.from(e?.items??[]).map(e=>e.webkitGetAsEntry()).filter(e=>!!e),n=[];for(let e of t)await Jt(e,``,n);return n},Xt=(e,t,n=()=>!0)=>{let r=wt(),i=()=>r.begin(e,()=>!n()),a=()=>r.move(s.value[0],s.value[1]),o=()=>{let e=s.event.type===`drop`?r.read():null;r.end(),e!==null&&Yt(s.event.dataTransfer).then(n=>t(n,e))},s=Ut(()=>{s.isDropStart&&i(),s.isDropping&&a(),s.isDropEnd&&o()},Wt);return s.ref},D={add:d,arrowBack:f,arrowDropDown:p,check:m,chevronRight:g,closeIcon:_,cloud:te,deleteIcon:ne,folder:re,home:ie,keep:ae,keepFill:oe,leftPanelClose:se,leftPanelOpen:ce,menuIcon:le,moreVert:ue,redoIcon:de,schedule:fe,searchIcon:pe,settings:he,help:ge,keyboard:_e,sync:ve,undoIcon:ye,unfoldMore:be,visibilityOff:xe,createNewFolder:Se,uploadFile:Ce,driveFolderUpload:we,edit:Te,download:Ee,info:De,openInNew:Oe,restoreFromTrash:ke,description:Ae},Zt=({cls:e,search:t})=>u(`label`,{className:`h-8 items-center gap-2 rounded-lg border border-edge px-2 ${e}`,children:[l(v,{name:D.searchIcon,size:18,className:`text-mute`}),l(`input`,{value:t.value,onChange:e=>t.set(e.target.value),placeholder:t.placeholder,className:`min-w-0 flex-1 bg-transparent outline-none placeholder:text-xs placeholder:text-mute`})]}),Qt=({view:e})=>l(`div`,{className:`ml-auto flex h-8 shrink-0 overflow-hidden rounded-full border border-edge`,children:e.items.map((t,n)=>u(`button`,{onClick:()=>e.pick(t.id),className:`flex w-14 cursor-pointer items-center justify-center gap-1 ${n>0?`border-l border-edge`:``} ${e.value===t.id?`bg-band text-ink`:`text-mute hover:bg-pale`}`,children:[e.value===t.id&&l(v,{name:D.check,size:14}),l(v,{name:t.icon,size:18})]},t.id))}),$t=({chips:e,values:t,menus:n,menu:r,flip:i,pick:a,clear:o,lead:s,view:c,search:d})=>u(`div`,{className:`shrink-0 pt-3`,children:[d&&l(Zt,{cls:`flex md:hidden`,search:d}),u(`div`,{className:`mt-3 flex flex-wrap items-center gap-2 md:mt-0`,children:[s,e.map(e=>{let s=t[e.id]??``,c=n[e.id]??[],d=s===``?e.label:c.find(e=>e.id===s)?.label??s,f=s===``||e.fixed;return u(`div`,{className:`relative flex items-center`,children:[u(`button`,{onClick:i(e.id),className:`flex h-8 cursor-pointer items-center gap-1 rounded-lg px-3 text-[12px] ${f?`border border-edge text-mute hover:bg-pale`:`bg-band text-ink`}`,children:[d,l(v,{name:D.arrowDropDown,size:18})]}),!f&&l(`button`,{onClick:o(e.id),className:`ml-1 flex h-6 w-6 cursor-pointer items-center justify-center rounded-full text-mute hover:bg-band`,children:l(v,{name:D.closeIcon,size:16})}),r===e.id&&l(b,{align:`left`,cls:`w-56`,items:c,value:s,pick:a(e.id,s),check:D.check})]},e.id)}),c&&l(Qt,{view:c}),d&&l(Zt,{cls:`ml-auto hidden w-64 md:flex`,search:d})]})]}),en=({count:e,min:t,cls:n=``,children:r})=>l(`div`,{className:`grid gap-4 overflow-x-auto ${n}`,style:{gridTemplateColumns:`repeat(${e}, minmax(${t}px, 1fr))`},children:r}),tn=({c:e,click:t})=>u(`button`,{onClick:t,className:`relative flex h-full w-full cursor-pointer flex-col items-start rounded-xl border border-edge bg-white p-3 text-left hover:bg-pale`,children:[l(`span`,{className:`flex h-[30px] w-[30px] items-center justify-center rounded-md bg-band`,children:l(v,{name:e.icon??``,size:18,color:e.color})}),l(v,{name:D.add,size:16,className:`absolute right-3 top-3 text-mute`}),l(`span`,{className:`mt-2 w-full truncate text-[14px] leading-[17px]`,children:e.label})]}),nn=({c:e,click:t})=>u(`button`,{onClick:t,className:`flex h-12 w-full cursor-pointer items-center gap-3 rounded-xl border border-edge bg-white px-4 text-left hover:bg-pale`,children:[l(v,{name:e.icon??``,size:18,color:e.color}),l(`span`,{className:`truncate`,children:e.label}),l(v,{name:D.add,size:16,className:`ml-auto shrink-0 text-mute`})]}),rn=({cards:e,click:t,popup:n,count:r=4})=>u(c,{children:[l(en,{count:r,min:tt.card,cls:`hidden md:grid`,children:e.map(e=>u(`div`,{className:`relative`,children:[l(tn,{c:e,click:t(e)}),n(e)]},e.id))}),l(`div`,{className:`flex flex-col gap-2 md:hidden`,children:e.map(e=>u(`div`,{className:`relative`,children:[l(nn,{c:e,click:t(e)}),n(e)]},e.id))})]}),an=e=>l(`section`,{className:`relative shrink-0 px-4 pt-3 md:pl-7 md:pr-9`,children:l(rn,{...e})}),on=`flex h-9 w-9 shrink-0 items-center justify-center rounded-full text-mute hover:bg-band hover:text-ink`,sn=`flex h-8 w-8 shrink-0 cursor-pointer items-center justify-center rounded-full text-mute hover:bg-band hover:text-ink`,cn=({icon:e,color:t,label:n,home:r,actions:i,drawer:a})=>u(`header`,{className:`fixed inset-x-0 top-0 z-20 flex h-14 items-center gap-1 bg-white pl-4 pr-3 md:hidden`,children:[u(`button`,{onClick:r,className:`flex min-w-0 flex-1 cursor-pointer items-center gap-3`,children:[l(v,{name:e,size:24,color:t}),l(`span`,{className:`truncate text-sm font-bold`,children:n})]}),u(`div`,{className:`ml-auto flex shrink-0 items-center gap-1`,children:[i,l(`button`,{onClick:a,className:on,children:l(v,{name:D.menuIcon,size:22})})]})]}),ln=({icon:e,size:t=20,click:n,children:r})=>u(`span`,{className:`relative hidden md:flex`,children:[l(`button`,{onClick:n,className:sn,children:l(v,{name:e,size:t})}),r]}),un=({bar:e,open:t,title:n,back:r,undo:i,redo:a,expand:o,actions:s})=>u(`div`,{className:`mt-2.5 flex h-8 shrink-0 items-center gap-2 px-4 md:pl-7 md:pr-9`,children:[!e&&l(`button`,{onClick:t,className:`${sn} hidden md:flex`,children:l(v,{name:D.leftPanelOpen,size:20})}),!r&&l(`h1`,{className:`min-w-0 truncate font-bold`,children:n}),r&&u(`button`,{onClick:r,className:`flex min-w-0 cursor-pointer items-center gap-2 font-bold`,children:[l(v,{name:D.arrowBack,size:20,className:`text-mute`}),l(`span`,{className:`truncate`,children:n})]}),u(`div`,{className:`relative ml-auto flex shrink-0 items-center gap-1`,children:[i&&l(ln,{icon:D.undoIcon,click:i}),a&&l(ln,{icon:D.redoIcon,click:a}),o&&u(`button`,{onClick:o.click,className:`flex h-8 cursor-pointer items-center gap-1 rounded-lg px-2 hover:bg-band ${o.on?`text-ink`:`text-mute`}`,children:[l(`span`,{className:`hidden md:inline`,children:o.label}),l(v,{name:o.icon||D.unfoldMore,size:18})]}),s]})]}),dn=({icon:e,size:t=20,click:n,children:r})=>u(`span`,{className:`relative flex`,children:[l(`button`,{onClick:n,className:on,children:l(v,{name:e,size:t})}),r]}),fn=D.moreVert,pn=e=>`flex w-full cursor-pointer items-center rounded-lg text-left text-[14px] text-mute ${e?`bg-band`:`hover:bg-band`}`,mn=({open:e,turn:t})=>t?l(`button`,{onClick:t,className:`flex shrink-0 items-center justify-center`,style:{width:x.slot,height:x.slot},children:l(v,{name:D.chevronRight,size:x.slot,className:e?`rotate-90`:``})}):l(`span`,{className:`shrink-0`,style:{width:x.slot}}),O=({depth:e=0,on:t=!1,open:n,turn:r,icon:i,color:a,label:o,drop:s,mark:c,from:d,click:f,dclick:p,rclick:m,dragRef:h,children:g})=>u(`div`,{ref:h,"data-drop":s,"data-drop-mark":c,"data-drop-from":d,onClick:e=>(f?.(e),r?.(e)),onDoubleClick:p,onContextMenu:m,className:pn(t),style:{height:x.row,paddingLeft:e*x.indent},children:[l(mn,{open:n,turn:r}),l(v,{name:i,size:x.icon,color:a}),l(`span`,{className:`min-w-0 flex-1 truncate ${t?`text-ink`:``}`,style:{marginLeft:x.gap},children:o}),g]}),hn=({icon:e,size:t=16,cls:n=`hidden md:flex`,click:r,children:i})=>u(`span`,{"data-ghost-hide":``,className:`relative shrink-0 ${n}`,children:[l(`button`,{onClick:r,className:`flex h-8 w-8 cursor-pointer items-center justify-center rounded-full hover:bg-line`,children:l(v,{name:e,size:t})}),i]}),gn=e=>l(hn,{icon:D.arrowDropDown,size:18,...e}),_n=e=>l(hn,{icon:D.moreVert,size:16,...e}),vn=`STORAGE`,yn=`アップグレード`,bn=`https://stripe.com`,xn=`ゴミ箱を空にしますか?中のアイテムは完全に削除されます`,Sn=`新しいフォルダ`,Cn=`無題のフォルダ`,wn=`名前を変更`,Tn=`All files`,En=`ピン留めを解除`,Dn=[{id:`manage`,icon:D.cloud,label:`保存容量を管理`},{id:`empty`,icon:D.deleteIcon,label:`ゴミ箱を空にする`},{id:`refresh`,icon:D.sync,label:`使用状況を更新`}],On=[{id:`undo`,icon:D.undoIcon,label:`直前の操作を元に戻す`},{id:`redo`,icon:D.redoIcon,label:`最後に元に戻した操作をやり直す`},{id:`settings`,icon:D.settings,label:`設定`,top:!0},{id:`help`,icon:D.help,label:`ヘルプ`},{id:`shortcuts`,icon:D.keyboard,label:`キーボードショートカット`}],kn=On,An=D.visibilityOff,jn=(e,t,n)=>[{id:`band`,icon:An,label:e?`すべての${t}を非表示`:`すべての${t}を表示`},...n.map((e,t)=>t===0?{...e,top:!0}:e)],Mn=[{id:`folder`,icon:D.createNewFolder,label:`新しいフォルダ`},{id:`upload`,icon:D.uploadFile,label:`ファイルのアップロード`,top:!0},{id:`upload-folder`,icon:D.driveFolderUpload,label:`フォルダのアップロード`}],Nn=[{id:`rename`,icon:D.edit,label:`名前を変更`},{id:`folder`,icon:D.createNewFolder,label:`新しいフォルダ`},{id:`upload`,icon:D.uploadFile,label:`ファイルのアップロード`,top:!0},{id:`upload-folder`,icon:D.driveFolderUpload,label:`フォルダのアップロード`},{id:`info`,icon:D.info,label:`フォルダ情報`,top:!0},{id:`remove`,icon:D.deleteIcon,label:`ゴミ箱に移動`}],Pn=[{id:`rename`,icon:D.edit,label:`名前を変更`},{id:`download`,icon:D.download,label:`ダウンロード`},{id:`info`,icon:D.info,label:`ファイル情報`,top:!0},{id:`remove`,icon:D.deleteIcon,label:`ゴミ箱に移動`},{id:`pin`,icon:D.keep,label:`ピン留めする`}],Fn=[{id:`purge`,icon:D.deleteIcon,label:`完全に削除`},{id:`restore`,icon:D.restoreFromTrash,label:`復元`}],In=e=>t=>t.id===`pin`&&e.pinned?{...t,label:En}:t,Ln=e=>e.trashed?Fn:e.kind.startsWith(`folder`)?Nn:Pn.map(In(e)),Rn=({extra:e=[],pinned:t=!1,copy:n=!0,pin:r=!0}={})=>[{id:`rename`,icon:D.edit,label:`名前を変更`},...n?[{id:`copy`,icon:D.description,label:`コピーを作成`}]:[],...e,...r?[{id:`pin`,icon:t?D.keepFill:D.keep,label:t?En:`ピン留めする`}]:[],{id:`remove`,icon:D.deleteIcon,label:`ゴミ箱に移動`,top:!0}],zn=[{id:`band`,label:`テンプレートを表示`},{id:`bar`,label:`left bar を表示`}],Bn=[{keys:`↑ ↓`,label:`一覧の行を移動`},{keys:`Enter`,label:`ファイルを開く`},{keys:`Mod + Z`,label:`元に戻す`},{keys:`Mod + Shift + Z`,label:`やり直す`},{keys:`Delete`,label:`ゴミ箱に移動`}],k={settings:`設定`,help:`ヘルプ`,shortcuts:`キーボードショートカット`},Vn=Object.keys(k),Hn=e=>`${e.name}\n場所: /${e.parent}\n種類: ${e.kind}\nサイズ: ${e.size}\n更新: ${e.date}`,Un=e=>e===``?Tn:e.split(`/`).pop()??`All files`,Wn=`ファイルがありません`,Gn=e=>e.kind.startsWith(`folder`)&&!e.trashed?e.id:void 0,Kn=({e,kinds:t})=>{let n=t[e.kind]??t.file;return l(`span`,{className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-band`,children:l(v,{name:n.icon,size:20,color:n.color})})},qn=({rows:e,kinds:t,menu:n,point:r,flip:i,context:a,open:o,pick:s,drag:c})=>e.length===0?l(`p`,{className:`px-4 pt-8 text-mute md:px-7`,children:Wn}):l(`div`,{className:`flex flex-1 flex-col px-4 pb-10 md:pl-7 md:pr-9`,children:l(`div`,{className:`mt-3`,children:e.map(e=>u(`div`,{ref:e.trashed?void 0:c(e.id,`list`),"data-drop":Gn(e),"data-drop-mark":Gn(e),onDoubleClick:o(e),onContextMenu:a(`row:${e.id}`),className:`flex cursor-pointer items-center gap-3 border-b border-line py-3 pl-2.5 pr-1 hover:bg-pale`,children:[l(Kn,{e,kinds:t}),u(`span`,{className:`flex min-w-0 flex-1 items-center gap-1 truncate text-[14px]`,children:[e.name,e.pinned&&l(v,{name:D.keepFill,size:14,className:`shrink-0 text-mute`})]}),l(`span`,{className:`hidden shrink-0 text-mute md:inline`,children:e.size}),l(`span`,{className:`hidden shrink-0 text-mute md:inline`,children:e.date}),l(_n,{cls:`flex`,click:i(`row:${e.id}`),children:n===`row:${e.id}`&&l(b,{point:r,items:Ln(e),pick:s(e),check:D.check})})]},e.id))})}),Jn={ask:`Ask me anything...`,brand:`Claude`,voice:`音声モード`,file:`ファイル`},A=[{id:`claude-fable-5`,label:`Fable 5`,desc:`最も困難な課題に`},{id:`claude-opus-5`,label:`Opus 5`,desc:`複雑なタスク向け`},{id:`claude-sonnet-5`,label:`Sonnet 5`,desc:`日常のタスクに最適`},{id:`claude-haiku-4-5`,label:`Haiku 4.5`,desc:`素早い回答に最適`}],j={w:376,left:12,top:12,bottom:16,minH:180},M=e(``),N={send:async()=>``,stream:{parse:()=>[],send:async()=>[]},icon:``,path:``,headers:{},hello:()=>({greet:``,title:``,desc:``,prompts:[]}),commands:()=>[],hints:()=>[],menu:{useOpen:()=>n(M),flip:e=>n=>{n.stopPropagation(),t(M,M.value===e?``:e)},close:()=>t(M,``)}},Yn=e=>void Object.assign(N,e),Xn=(e,t=20,n=6)=>{let r=o(null);return a(()=>{let e=r.current;if(!e)return;e.style.height=`${t}px`;let i=Math.max(1,Math.round(e.scrollHeight/t));e.style.height=`${Math.min(i,n)*t}px`},[e]),r},Zn=(()=>{let e=new Be({linkify:!0,breaks:!0}),t=t=>e.render(t);return{render:t,plain:e=>{let n=document.createElement(`div`);return n.innerHTML=t(e),n.textContent?.trim()??``}}})(),P=e(!1),F=e([]),I=e(``),Qn=e([0,0]),$n=e(A[0].id),L=e(!1),R=e(!1),er=()=>L.value,tr=()=>n(L),nr=e(!1);let rr=null;const ir=()=>{let e=window.SpeechRecognition??window.webkitSpeechRecognition;if(!e)return null;let n=new e;return n.lang=`ja-JP`,n.continuous=!0,n.interimResults=!1,n.onresult=e=>{let n=``;for(let t=e.resultIndex;t<e.results.length;t++)e.results[t].isFinal&&(n+=e.results[t][0].transcript);n!==``&&t(I,I.value+n)},n.onend=()=>t(nr,!1),n},ar=()=>{if(nr.value)return void rr?.stop();rr??=ir(),rr&&(rr.start(),t(nr,!0))};let z=[0,0,28,28];const or=(e,t,n)=>Math.min(Math.max(e,t),Math.max(t,n)),sr=()=>{let[e,t]=Qn.value,n=B.target.getBoundingClientRect();z=[n.left-e,n.top-t,n.width,n.height]},cr=()=>{let e=or(B.offset[0],-z[0],window.innerWidth-z[2]-z[0]),n=or(B.offset[1],-z[1],window.innerHeight-z[3]-z[1]);C(e,n,B.offset),t(Qn,[e,n])},B=Lt(()=>{B.isDragStart&&sr(),cr()}),lr=()=>{C(0,0,B.offset),t(Qn,[0,0])},ur=()=>{let e=B.target;!e||!e.isConnected||(sr(),cr())},dr=()=>{i(()=>(ur(),window.addEventListener(`resize`,ur),()=>window.removeEventListener(`resize`,ur)),[])},fr=e=>`calc(max(${j.left}px, 100vw - ${j.w+j.left}px) + ${e}px)`,pr=e=>j.top+e,mr=e=>`max(${j.minH}px, min(calc(100dvh - ${j.top+j.left}px), calc(100dvh - ${j.top+j.bottom+e}px)))`,hr=e(null),V=e(0),gr=(e,t)=>{if(t)return t;if(!e.startsWith(`/`))return[];let n=e.slice(1).trim().toLowerCase();return N.commands().filter(e=>e.name.toLowerCase().startsWith(n))},_r=()=>{t(hr,null),t(V,0)},H=async e=>{t(I,``),_r();let n=await e.run();Array.isArray(n)&&t(hr,n)},vr=e=>{if(!e.startsWith(`/`))return;let t=e.slice(1).trim().toLowerCase();return N.commands().find(e=>e.name.toLowerCase()===t)??gr(e,null)[0]},yr=e=>{if(e.nativeEvent?.isComposing)return!1;let n=gr(I.value,hr.value);if(n.length===0)return!1;let r=V.value%n.length;return e.key===`ArrowDown`?(e.preventDefault(),t(V,(r+1)%n.length),!0):e.key===`ArrowUp`?(e.preventDefault(),t(V,(r-1+n.length)%n.length),!0):e.key===`Escape`?(e.preventDefault(),t(I,``),_r(),!0):e.key===`Enter`&&(e.preventDefault(),H(n[r]),!0)},br=(()=>{let e=e=>e.replace(/[^0-9A-Za-zぁ-んァ-ヴー一-龠々\s]/g,` `).replace(/\s+/g,` `).trim(),t=e=>{let t=document.createElement(`div`);return t.innerHTML=Zn.render(e),t.querySelectorAll(`pre`).forEach(e=>e.remove()),t.textContent??``};return{lines:n=>t(n).split(`
2
+ `).map(e).filter(e=>e!==``)}})();let U=0,xr=[];const Sr=[`Kyoko`,`O-Ren`,`Nanami`,`Ayumi`,`Haruka`,`Sayaka`,`Samantha`,`Zira`,`Aria`,`Jenny`,`Ava`,`Sonia`,`Google 日本語`,`Google US English`],Cr=[`Otoya`,`Ichiro`,`Keita`,`David`,`Mark`,`Guy`,`Alex`,`Daniel`,`Fred`,`Andrew`,`Brian`],wr=()=>xr=speechSynthesis.getVoices(),Tr=e=>{xr.length===0&&wr();let t=xr.filter(t=>t.lang.replace(`_`,`-`).startsWith(e.slice(0,2)));return t.find(e=>Sr.some(t=>e.name.includes(t)))??t.find(e=>!Cr.some(t=>e.name.includes(t)))??t[0]??null},Er=e=>{(e.match(/[A-Za-z][0-9A-Za-z]*(?: (?:[0-9]+ )*[A-Za-z][0-9A-Za-z]*)*|(?:(?![A-Za-z]).)+/g)??[]).forEach(e=>{if(e.trim()===``)return;let t=new SpeechSynthesisUtterance(e);t.lang=/^[A-Za-z]/.test(e)?`en-US`:`ja-JP`,t.voice=Tr(t.lang),speechSynthesis.speak(t)})};speechSynthesis.addEventListener(`voiceschanged`,wr);const Dr=e=>{if(!R.value)return;let t=e.split(`
3
3
  `).slice(0,-1).join(`
4
- `),n=Pr.lines(t);n.slice($).forEach(Br),$=n.length},Hr=e=>{G.value&&Pr.lines(e).slice($).forEach(Br),$=0},Ur=()=>{$=0,speechSynthesis.cancel()},Wr=()=>t(B,!0),Gr=()=>{wr(),Ur(),jr(),t(B,!1)},Kr=()=>{if(B.value)return Gr();Wr()},qr=e=>{jr(),t(H,e.target.value)},Jr=()=>{let e=H.value.trim();if(e===``||W.value)return;let n=Mr(e);if(n)return void Q(n);t(H,``),z.send({prompt:e})},Yr=e=>{Nr(e)||e.key!==`Enter`||e.nativeEvent?.isComposing||e.shiftKey||(e.preventDefault(),Jr())},Xr=e=>()=>{let t=Mr(e);if(t)return void Q(t);z.send({prompt:e})},Zr=()=>{G.value&&Ur(),t(G,!G.value)},Qr=e=>{z.menu.close(),t(gr,e.id)},$r=()=>l(`div`,{className:`flex shrink-0 items-start justify-between px-2`,children:[c(_,{name:je,size:50,className:`text-mute`}),l(`div`,{className:`flex items-center gap-2`,children:[c(`button`,{ref:Y.ref,className:`flex h-7 w-7 cursor-grab touch-none select-none items-center justify-center rounded-full text-mute hover:bg-band hover:text-ink active:cursor-grabbing`,children:c(_,{name:Me,size:20})}),c(`button`,{onClick:Gr,className:`flex h-7 w-7 cursor-pointer items-center justify-center rounded-full text-mute hover:bg-band hover:text-ink`,children:c(_,{name:ee,size:20})})]})]}),ei=()=>{let e=z.hello();return l(`div`,{className:`flex h-full flex-col items-center justify-center px-3 text-center`,children:[c(_,{name:je,size:56,className:`mb-5 text-mute`}),c(`p`,{className:`text-mute`,children:e.greet}),c(`p`,{className:`mt-1 font-bold leading-[26px]`,children:e.title}),c(`p`,{className:`mt-3 text-mute`,children:e.desc}),c(`div`,{className:`-mx-6 mt-6 flex flex-wrap justify-center gap-1.5`,children:e.prompts.map(e=>l(`button`,{onClick:Xr(e.prompt??e.label),className:`flex cursor-pointer items-center gap-1 whitespace-nowrap rounded-full border border-edge bg-white px-2.5 py-1 text-[12px] leading-[16px] hover:bg-pale`,children:[e.icon&&c(_,{name:e.icon,size:14,color:e.color}),e.label]},e.label))})]})},ti=({t:e})=>l(`div`,{className:`-mt-4 ml-3 flex max-w-full items-center rounded-lg border border-edge bg-band p-2`,children:[e.icon&&c(_,{name:e.icon,size:16}),c(`span`,{className:`mx-2 truncate text-[12px]`,children:e.label}),c(`button`,{className:`hidden ml-1 flex h-5 w-5 shrink-0 cursor-pointer items-center justify-center rounded-full text-mute hover:bg-line`,children:c(_,{name:ze,size:16})})]}),ni=({m:e})=>l(`div`,{className:`mr-7 flex flex-col items-start ${e.tools?.length?`mb-6`:``}`,children:[c(`div`,{className:`chat-md w-full rounded-xl border border-edge bg-white p-3 ${e.tools?.length?`pb-5`:``}`,dangerouslySetInnerHTML:{__html:hr.render(e.text)}}),e.tools?.map((e,t)=>c(ti,{t:e},t))]}),ri=({m:e})=>c(`div`,{className:`ml-7 min-w-0 whitespace-pre-wrap [overflow-wrap:anywhere] rounded-2xl border border-edge bg-band p-3`,children:e.text}),ii=()=>c(`div`,{className:`flex w-fit items-center rounded-lg border border-edge bg-white px-2 py-1 text-mute`,children:c(_,{name:ze,size:20,className:`animate-pulse`})}),ai=()=>{let e=n(V),t=n(W),i=a(null);return r(()=>void i.current?.scrollTo(0,9e9),[e]),c(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:l(`div`,{ref:i,className:`flex h-full flex-col gap-5 overflow-y-auto px-2 pb-4 pt-10 text-[14px] leading-[22px]`,children:[e.length===0&&c(ei,{}),e.map((e,t)=>e.role===`user`?c(ri,{m:e},t):c(ni,{m:e},t)),t&&e[e.length-1]?.role===`user`&&c(ii,{})]})})},oi=()=>{let e=n(H);return n(K)?c(`button`,{onClick:br,className:`flex h-5 w-5 shrink-0 cursor-pointer items-center justify-center text-[#EA4335]`,children:c(_,{name:Fe,size:20})}):e.trim()===``?c(`button`,{onClick:br,className:`flex h-5 w-5 shrink-0 cursor-pointer items-center justify-center text-mute hover:text-ink`,children:c(_,{name:Ne,size:20})}):c(`button`,{onClick:Jr,className:`flex h-5 w-5 shrink-0 cursor-pointer items-center justify-center text-ink hover:text-[#4185F4]`,children:c(_,{name:Pe,size:20})})},si=()=>{let e=n(H),t=n(X),r=n(Z),i=Ar(e,t);return i.length===0?null:c(`div`,{className:`absolute inset-x-0 bottom-full z-10 mb-2 max-h-56 overflow-y-auto rounded-xl border border-edge bg-white py-1 shadow-[0_8px_24px_rgba(0,0,0,0.12)]`,children:i.map((e,n)=>l(`button`,{onClick:()=>void Q(e),className:`flex w-full cursor-pointer items-center gap-3 px-3 py-1.5 text-left text-[12px] leading-[16px] ${n===r%i.length?`bg-band`:`hover:bg-pale`}`,children:[c(`span`,{className:`shrink-0 font-bold`,children:t?e.label??e.name:`/${e.name}`}),c(`span`,{className:`min-w-0 flex-1 truncate text-right text-mute`,children:e.desc})]},`${e.name}-${n}`))})},ci=()=>{let e=n(V),t=n(W)?[]:z.hints(e);return t.length===0?null:c(`div`,{className:`flex shrink-0 flex-wrap justify-end gap-1.5 pb-2`,children:t.map(e=>c(`button`,{onClick:()=>void Q(e),className:`cursor-pointer rounded-full border border-edge bg-white px-2.5 py-1 text-[12px] leading-[16px] hover:bg-pale`,children:e.label??e.name},e.name))})},li=()=>{let e=n(H),t=n(gr),r=n(G),i=z.menu.useOpen(),a=mr(e),o=I.find(e=>e.id===t)??I[0];return l(`div`,{className:`relative shrink-0 rounded-xl border border-edge`,children:[c(si,{}),l(`label`,{className:`flex items-start gap-2 px-3 pb-7 pt-3`,children:[c(_,{name:me,size:20,className:`text-mute`}),c(`textarea`,{ref:a,rows:1,value:e,onChange:qr,onKeyDown:Yr,placeholder:F.ask,className:`min-w-0 flex-1 resize-none overflow-y-auto bg-transparent text-[14px] leading-[20px] outline-none placeholder:text-mute`}),c(oi,{})]}),l(`div`,{className:`flex h-9 items-center border-t border-line px-3 text-[12px]`,children:[l(`span`,{className:`relative flex`,children:[l(`button`,{onClick:z.menu.flip(`chat-model`),className:`flex cursor-pointer items-center gap-1`,children:[F.brand,` `,o.label,c(_,{name:Re,size:16,className:`text-mute`})]}),i===`chat-model`&&c(Je,{align:`left`,cls:`w-64`,items:I,value:t,pick:Qr,check:m})]}),l(`div`,{className:`ml-auto flex items-center gap-3`,children:[l(`button`,{onClick:Zr,className:`flex cursor-pointer items-center gap-1 ${r?`text-[#4185F4]`:``}`,children:[c(_,{name:Ie,size:18}),F.voice]}),l(`button`,{className:`flex cursor-pointer items-center gap-1`,children:[c(_,{name:Le,size:18}),F.file]})]})]})]})},ui=()=>c(`button`,{onClick:Kr,className:`flex h-8 w-8 shrink-0 cursor-pointer items-center justify-center rounded-full text-mute hover:bg-band hover:text-ink`,children:c(_,{name:je,size:22})}),di=()=>{Er();let[e,t]=n(U);return l(`div`,{className:`fixed z-50 flex w-[376px] max-w-[calc(100vw-24px)] flex-col rounded-2xl border border-line bg-white p-3 text-ink shadow-[0_8px_24px_rgba(0,0,0,0.12)]`,style:{left:Dr(e),top:Or(t),height:kr(t)},children:[c($r,{}),c(ai,{}),c(ci,{}),c(li,{})]})},fi=()=>n(B)?c(di,{}):null,pi=e=>({role:`agent`,text:e.text,tools:e.tools.map(e=>({icon:z.icon,label:`${e.server?`${e.server} - `:``}${e.name} (MCP)`}))}),mi=e=>t(V,e.flatMap(e=>[{role:`user`,text:e.prompt},pi({text:e.reply,tools:e.tools.map(e=>({server:``,name:e}))})])),hi=e=>e.map(e=>e.tools.length?`${e.text}\n`:e.text).join(`
5
- `),gi=async e=>{if(W.value)return`busy: previous chat is still running`;let n=[...V.value,{role:`user`,text:e}];Ur(),t(V,n),t(W,!0);let r=await z.stream.send({prompt:e,path:z.path,model:gr.value,headers:z.headers},e=>{t(V,[...n,...e.items.map(pi)]),Vr(hi(e.items))});return Hr(hi(r)),t(W,!1),`chat sent: ${e}`},_i=e=>{let t=[],n=``,r=[],i=()=>Math.floor(new Date().getHours()/6),a=r=>{let a=i(),o=n,s=t.find(e=>e.name===r&&e.part===a&&e.after===o);s&&(s.count+=1),s||t.push({name:r,part:a,after:o,count:1}),n=r,e.store.save({name:r,part:a,after:o})},o=e=>t.reduce((t,r)=>r.name===e?t+r.count*(r.part===i()?2:1)*(r.after===n?2:1):t,0),s=e=>[...e].sort((e,t)=>o(t.name)-o(e.name)),c=()=>(r.length===0&&(r=e.deck.map(e=>({...e,run:()=>(a(e.name),e.run())}))),s(r));return{commands:c,hello:()=>{let t=c(),n=t.filter(t=>e.starters().includes(t.name)),r=[...new Set([...e.pinned(),...n.map(e=>e.name)])].flatMap(e=>t.filter(t=>t.name===e));return{...e.greet,prompts:r.map(e=>({label:e.label??e.name,prompt:`/${e.name}`}))}},hints:t=>e.hinted(t).flatMap(e=>c().filter(t=>t.name===e)),prime:async()=>{t=await e.store.list()}}},vi=(e,t)=>e.map((n,r)=>{let i=e[r+1]?.seq??1/0;return{...n,names:t.filter(e=>e.seq>n.seq&&e.seq<i).map(e=>e.name)}}),yi=e=>e.replace(/\s+/g,` `).trim().slice(0,40),bi=e=>{let t=Math.max(0,(Date.now()-new Date(e).getTime())/1e3);return t<60?`たった今`:t<3600?`${Math.floor(t/60)} 分前`:t<86400?`${Math.floor(t/3600)} 時間前`:`${Math.floor(t/86400)} 日前`},xi=e=>{let t=crypto.randomUUID(),n=0,r=[],i=()=>{t=crypto.randomUUID(),n=0,r=[],e.show([])},a=async()=>(await e.store.list()).map(e=>({...e,when:bi(e.updatedAt)})),o=async i=>{let a=await e.store.load(i),o=vi(a.talks,a.tools).map(e=>({prompt:e.prompt,reply:e.reply,tools:e.names}));t=i,n=[...a.talks,...a.tools].reduce((e,t)=>Math.max(e,t.seq),0),r=o.flatMap(e=>[{role:`user`,content:e.prompt},{role:`assistant`,content:e.reply}]),e.show(o)},s=(i,a,o=``)=>{let s=a.filter(e=>!e.error),c=s.map(e=>e.text).filter(e=>e!==``).join(`
4
+ `),n=br.lines(t);n.slice(U).forEach(Er),U=n.length},Or=e=>{R.value&&br.lines(e).slice(U).forEach(Er),U=0},kr=()=>{U=0,speechSynthesis.cancel()},Ar=()=>t(P,!0),jr=()=>{lr(),kr(),_r(),t(P,!1)},Mr=()=>{if(P.value)return jr();Ar()},Nr=e=>{_r(),t(I,e.target.value)},Pr=()=>{let e=I.value.trim();if(e===``||L.value)return;let n=vr(e);if(n)return void H(n);t(I,``),N.send({prompt:e})},Fr=e=>{yr(e)||e.key!==`Enter`||e.nativeEvent?.isComposing||e.shiftKey||(e.preventDefault(),Pr())},Ir=e=>()=>{let t=vr(e);if(t)return void H(t);N.send({prompt:e})},Lr=()=>{R.value&&kr(),t(R,!R.value)},Rr=e=>{N.menu.close(),t($n,e.id)},zr=()=>u(`div`,{className:`flex shrink-0 items-start justify-between px-2`,children:[l(v,{name:je,size:50,className:`text-mute`}),u(`div`,{className:`flex items-center gap-2`,children:[l(`button`,{ref:B.ref,className:`flex h-7 w-7 cursor-grab touch-none select-none items-center justify-center rounded-full text-mute hover:bg-band hover:text-ink active:cursor-grabbing`,children:l(v,{name:Me,size:20})}),l(`button`,{onClick:jr,className:`flex h-7 w-7 cursor-pointer items-center justify-center rounded-full text-mute hover:bg-band hover:text-ink`,children:l(v,{name:ee,size:20})})]})]}),Br=()=>{let e=N.hello();return u(`div`,{className:`flex h-full flex-col items-center justify-center px-3 text-center`,children:[l(v,{name:je,size:56,className:`mb-5 text-mute`}),l(`p`,{className:`text-mute`,children:e.greet}),l(`p`,{className:`mt-1 font-bold leading-[26px]`,children:e.title}),l(`p`,{className:`mt-3 text-mute`,children:e.desc}),l(`div`,{className:`-mx-6 mt-6 flex flex-wrap justify-center gap-1.5`,children:e.prompts.map(e=>u(`button`,{onClick:Ir(e.prompt??e.label),className:`flex cursor-pointer items-center gap-1 whitespace-nowrap rounded-full border border-edge bg-white px-2.5 py-1 text-[12px] leading-[16px] hover:bg-pale`,children:[e.icon&&l(v,{name:e.icon,size:14,color:e.color}),e.label]},e.label))})]})},Vr=({t:e})=>u(`div`,{className:`-mt-4 ml-3 flex max-w-full items-center rounded-lg border border-edge bg-band p-2`,children:[e.icon&&l(v,{name:e.icon,size:16}),l(`span`,{className:`mx-2 truncate text-[12px]`,children:e.label}),l(`button`,{className:`hidden ml-1 flex h-5 w-5 shrink-0 cursor-pointer items-center justify-center rounded-full text-mute hover:bg-line`,children:l(v,{name:ze,size:16})})]}),Hr=({m:e})=>u(`div`,{className:`mr-7 flex flex-col items-start ${e.tools?.length?`mb-6`:``}`,children:[l(`div`,{className:`chat-md w-full rounded-xl border border-edge bg-white p-3 ${e.tools?.length?`pb-5`:``}`,dangerouslySetInnerHTML:{__html:Zn.render(e.text)}}),e.tools?.map((e,t)=>l(Vr,{t:e},t))]}),Ur=({m:e})=>l(`div`,{className:`ml-7 min-w-0 whitespace-pre-wrap [overflow-wrap:anywhere] rounded-2xl border border-edge bg-band p-3`,children:e.text}),Wr=()=>l(`div`,{className:`flex w-fit items-center rounded-lg border border-edge bg-white px-2 py-1 text-mute`,children:l(v,{name:ze,size:20,className:`animate-pulse`})}),Gr=()=>{let e=n(F),t=n(L),r=o(null);return i(()=>void r.current?.scrollTo(0,9e9),[e]),l(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:u(`div`,{ref:r,className:`flex h-full flex-col gap-5 overflow-y-auto px-2 pb-4 pt-10 text-[14px] leading-[22px]`,children:[e.length===0&&l(Br,{}),e.map((e,t)=>e.role===`user`?l(Ur,{m:e},t):l(Hr,{m:e},t)),t&&e[e.length-1]?.role===`user`&&l(Wr,{})]})})},Kr=()=>{let e=n(I);return n(nr)?l(`button`,{onClick:ar,className:`flex h-5 w-5 shrink-0 cursor-pointer items-center justify-center text-[#EA4335]`,children:l(v,{name:Fe,size:20})}):e.trim()===``?l(`button`,{onClick:ar,className:`flex h-5 w-5 shrink-0 cursor-pointer items-center justify-center text-mute hover:text-ink`,children:l(v,{name:Ne,size:20})}):l(`button`,{onClick:Pr,className:`flex h-5 w-5 shrink-0 cursor-pointer items-center justify-center text-ink hover:text-[#4185F4]`,children:l(v,{name:Pe,size:20})})},qr=()=>{let e=n(I),t=n(hr),r=n(V),i=gr(e,t);return i.length===0?null:l(`div`,{className:`absolute inset-x-0 bottom-full z-10 mb-2 max-h-56 overflow-y-auto rounded-xl border border-edge bg-white py-1 shadow-[0_8px_24px_rgba(0,0,0,0.12)]`,children:i.map((e,n)=>u(`button`,{onClick:()=>void H(e),className:`flex w-full cursor-pointer items-center gap-3 px-3 py-1.5 text-left text-[12px] leading-[16px] ${n===r%i.length?`bg-band`:`hover:bg-pale`}`,children:[l(`span`,{className:`shrink-0 font-bold`,children:t?e.label??e.name:`/${e.name}`}),l(`span`,{className:`min-w-0 flex-1 truncate text-right text-mute`,children:e.desc})]},`${e.name}-${n}`))})},Jr=()=>{let e=n(F),t=n(L)?[]:N.hints(e);return t.length===0?null:l(`div`,{className:`flex shrink-0 flex-wrap justify-end gap-1.5 pb-2`,children:t.map(e=>l(`button`,{onClick:()=>void H(e),className:`cursor-pointer rounded-full border border-edge bg-white px-2.5 py-1 text-[12px] leading-[16px] hover:bg-pale`,children:e.label??e.name},e.name))})},Yr=()=>{let e=n(I),t=n($n),r=n(R),i=N.menu.useOpen(),a=Xn(e),o=A.find(e=>e.id===t)??A[0];return u(`div`,{className:`relative shrink-0 rounded-xl border border-edge`,children:[l(qr,{}),u(`label`,{className:`flex items-start gap-2 px-3 pb-7 pt-3`,children:[l(v,{name:me,size:20,className:`text-mute`}),l(`textarea`,{ref:a,rows:1,value:e,onChange:Nr,onKeyDown:Fr,placeholder:Jn.ask,className:`min-w-0 flex-1 resize-none overflow-y-auto bg-transparent text-[14px] leading-[20px] outline-none placeholder:text-mute`}),l(Kr,{})]}),u(`div`,{className:`flex h-9 items-center border-t border-line px-3 text-[12px]`,children:[u(`span`,{className:`relative flex`,children:[u(`button`,{onClick:N.menu.flip(`chat-model`),className:`flex cursor-pointer items-center gap-1`,children:[Jn.brand,` `,o.label,l(v,{name:Re,size:16,className:`text-mute`})]}),i===`chat-model`&&l(b,{align:`left`,cls:`w-64`,items:A,value:t,pick:Rr,check:h})]}),u(`div`,{className:`ml-auto flex items-center gap-3`,children:[u(`button`,{onClick:Lr,className:`flex cursor-pointer items-center gap-1 ${r?`text-[#4185F4]`:``}`,children:[l(v,{name:Ie,size:18}),Jn.voice]}),u(`button`,{className:`flex cursor-pointer items-center gap-1`,children:[l(v,{name:Le,size:18}),Jn.file]})]})]})]})},Xr=()=>l(`button`,{onClick:Mr,className:`flex h-8 w-8 shrink-0 cursor-pointer items-center justify-center rounded-full text-mute hover:bg-band hover:text-ink`,children:l(v,{name:je,size:22})}),Zr=()=>{dr();let[e,t]=n(Qn);return u(`div`,{className:`fixed z-50 flex w-[376px] max-w-[calc(100vw-24px)] flex-col rounded-2xl border border-line bg-white p-3 text-ink shadow-[0_8px_24px_rgba(0,0,0,0.12)]`,style:{left:fr(e),top:pr(t),height:mr(t)},children:[l(zr,{}),l(Gr,{}),l(Jr,{}),l(Yr,{})]})},Qr=()=>n(P)?l(Zr,{}):null,$r=({drawer:e,close:t,dropRef:n,children:r})=>u(`div`,{ref:n,onClick:t,className:`flex h-dvh overflow-hidden bg-white font-medium text-ink`,children:[e&&l(`div`,{className:`fixed inset-0 z-30 bg-black/30 md:hidden`,onClick:t}),r]}),ei=({drop:e,from:t,children:n})=>l(`main`,{"data-drop":e,"data-drop-from":t,"data-drop-scope":``,className:`flex min-w-0 flex-1 flex-col overflow-y-auto pt-14 md:pt-0`,children:n}),ti=({title:e,children:t})=>u(`div`,{className:`flex flex-1 flex-col gap-4 px-4 pb-10 pt-6 md:pl-7 md:pr-9`,children:[l(`h2`,{className:`font-bold`,children:e}),t]}),ni=({value:e,flip:t})=>l(ti,{title:k.settings,children:zn.map(n=>u(`button`,{onClick:()=>t(n.id),className:`flex h-11 w-full max-w-xl cursor-pointer items-center justify-between rounded-xl border border-edge px-4 hover:bg-pale`,children:[l(`span`,{children:n.label}),l(`span`,{className:`flex h-[18px] w-[18px] items-center justify-center rounded-md border ${e[n.id]?`border-ink bg-ink text-white`:`border-edge bg-white`}`,children:e[n.id]&&l(v,{name:D.check,size:14})})]},n.id))}),ri=({lines:e})=>l(ti,{title:k.help,children:e.map(e=>l(`p`,{className:`max-w-2xl leading-7 text-mute`,children:e},e))}),ii=()=>l(ti,{title:k.shortcuts,children:Bn.map(e=>u(`div`,{className:`flex h-11 max-w-xl items-center justify-between border-b border-line`,children:[l(`span`,{className:`text-mute`,children:e.label}),l(`span`,{className:`rounded-md bg-band px-2 py-1 text-[12px]`,children:e.keys})]},e.keys))}),ai=({mode:e,lines:t,value:n,flip:r})=>e===`settings`?l(ni,{value:n,flip:r}):e===`help`?l(ri,{lines:t}):e===`shortcuts`?l(ii,{}):null,oi=`flex h-9 w-9 shrink-0 items-center justify-center rounded-full text-mute hover:bg-band hover:text-ink`,si=({icon:e,color:t,label:n,click:r})=>u(`button`,{onClick:r,className:`flex min-w-0 flex-1 cursor-pointer items-center gap-3`,children:[l(v,{name:e,size:24,color:t}),l(`span`,{className:`truncate text-sm font-bold`,children:n})]}),ci=({storage:e,upgrade:t,menu:n,more:r})=>u(`div`,{className:`relative shrink-0 border-t border-line px-4 pb-4 pt-3`,children:[u(`div`,{className:`flex h-6 items-center gap-2 text-mute`,children:[l(v,{name:D.cloud,size:18}),l(`span`,{className:`tracking-wider`,children:vn}),u(`span`,{className:`relative ml-auto flex`,children:[l(`button`,{onClick:r,className:`flex h-6 w-6 items-center justify-center rounded-full text-mute hover:bg-band`,children:l(v,{name:D.moreVert,size:16})}),n]})]}),l(`div`,{className:`mt-1.5 h-2 overflow-hidden rounded-full bg-line`,children:l(`div`,{className:`h-full rounded-full bg-fill`,style:{width:`${Math.min(100,e.used/e.total*100)}%`}})}),l(`p`,{className:`mt-1.5`,children:e.text}),l(`button`,{onClick:t,className:`mt-2.5 h-9 w-full cursor-pointer rounded-full border border-ink font-bold hover:bg-band`,children:yn})]}),li=({brand:e,bar:t,drawer:n,fold:r,close:i,press:a,storage:o,upgrade:s,menu:c,more:d,children:f})=>u(`nav`,{"data-drop-scope":``,onClick:a,className:`fixed inset-y-0 left-0 z-40 flex shrink-0 flex-col border-r border-line bg-pale transition-transform md:static md:translate-x-0 ${n?`translate-x-0`:`-translate-x-full`} ${t?``:`md:hidden`}`,style:{width:x.width},children:[u(`div`,{className:`flex h-15 shrink-0 items-center gap-1 pr-2 text-[14px]`,style:{paddingLeft:x.brand},children:[l(si,{...e}),l(`button`,{onClick:r,className:`${oi} hidden md:flex`,children:l(v,{name:D.leftPanelClose,size:20})}),l(`button`,{onClick:i,className:`${oi} md:hidden`,children:l(v,{name:D.leftPanelClose,size:20})})]}),l(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-2 pb-4`,children:f}),l(ci,{storage:o,upgrade:s,menu:c,more:d})]}),W={base:`/api/v1/storage`,trash:`.trash`,editors:[],self:``},ui=e=>void Object.assign(W,e),G=e=>e.kind.startsWith(`folder`),di=(e,t)=>e.name.localeCompare(t.name),fi=(e,t)=>t.iso.localeCompare(e.iso),pi=(e,t)=>{let n=e.filter(e=>e.parent===t&&!e.trashed);return[...n.filter(G).sort(di),...n.filter(e=>!G(e)).sort(di)]},mi=(e,t)=>e.filter(e=>!e.trashed&&e.kind===t).sort(fi),hi=e=>e.filter(e=>!e.trashed&&!G(e)).sort(fi).slice(0,12),gi=e=>e.filter(e=>e.trashed),_i=e=>e.filter(e=>!e.trashed&&!G(e)).sort((e,t)=>t.bytes-e.bytes),vi=(e,t)=>e.filter(e=>!e.trashed&&e.parent===t),yi=e=>{let t=e.split(`/`).filter(Boolean);return t.map((e,n)=>({name:n===0&&e===W.trash?`ゴミ箱`:e,path:t.slice(0,n+1).join(`/`)}))},bi=(e,t,n,r)=>t===`trash`?gi(e):t===`recent`?hi(e):t===`storage`?_i(e):t===r?mi(e,r):vi(e,n),xi=e=>e.filter(e=>!G(e)).reduce((e,t)=>e+t.bytes,0),Si=e=>{let{files:t,parent:n,depth:r,expand:i,active:a,kinds:o,fold:s,enter:d,file:f,open:p,menu:m,rclick:h,drag:g}=e;return l(c,{children:pi(t,n).map(t=>{let n=(o[t.kind]??o.file).icon;return G(t)?u(`div`,{children:[l(O,{depth:r,on:a===t.id,open:i.includes(t.id),turn:s(t.id),icon:o.folder.icon,label:t.name,drop:t.id,mark:t.id,click:d(t.id),rclick:h(t),dragRef:g(t.id,`tree`),children:m(t)}),i.includes(t.id)&&l(Si,{...e,parent:t.id,depth:r+1})]},t.id):l(O,{depth:r,icon:n,label:t.name,drop:t.parent,click:f?f(t):d(t.parent),dclick:p(t),rclick:h(t),dragRef:g(t.id,`tree`),children:m(t)},t.id)})})},K=e(!1),Ci=e(null),wi=()=>K.value,Ti=()=>n(K),Ei=()=>n(Ci),Di=e=>e.split(`/`).filter(Boolean).map(encodeURIComponent).join(`/`),Oi=(e,t=``,n={})=>{let r=t?`?do=${encodeURIComponent(t)}&arg=${encodeURIComponent(JSON.stringify(n))}`:``;location.href=`/${Di(e)}${r}`},ki=async e=>{let t=new URLSearchParams(location.search),n=t.get(`do`)??``;if(n===``)return``;let r=JSON.parse(t.get(`arg`)||`{}`);return history.replaceState(null,``,location.pathname+location.hash),typeof e[n]==`function`?(await e[n](r),n):`unknown intent: ${n}`},Ai=(e,t)=>e.name.localeCompare(t.name),ji=({spec:e,e:t,zone:n=`tree`})=>{let{shellMenu:i}=r(e.ai),a=Ei();return l(_n,{click:e.shell.flip(`${n}:${t.id}`),children:i===`${n}:${t.id}`&&l(b,{point:a,items:Ln(t),pick:e.shell.pickRow(t),check:D.check})})},Mi=({spec:e,id:t})=>{let{shellMenu:n}=r(e.ai);return u(gn,{click:e.shell.flip(t),children:[n===t&&t===`root`&&l(b,{items:Mn,pick:e.shell.pickHome,check:D.check}),n===t&&t!==`root`&&e.popup()]})},Ni=({spec:e})=>{let{mode:t,expand:n}=r(e.ai),i=e.ai.scan(`files/`).filter(t=>!t.trashed&&t.kind===e.service).sort(Ai),a=n.includes(`.open`),o=t=>t.id===e.file;return u(c,{children:[e.file===``&&u(`div`,{children:[l(O,{depth:1,on:t===`edit`,open:a,turn:e.shell.foldTree(`.open`),icon:e.kinds.folder.icon,label:e.fallback(),click:e.shell.goMode(`edit`)}),a&&e.leaf()]}),i.map(n=>u(`div`,{children:[l(O,{depth:1,on:t===`edit`&&o(n),open:o(n)&&a,turn:o(n)?e.shell.foldTree(`.open`):void 0,icon:e.kinds.folder.icon,label:n.name,click:o(n)?e.shell.goMode(`edit`):()=>Oi(n.id),dclick:e.shell.openFile(n),rclick:e.shell.context(`${e.service}:${n.id}`),dragRef:e.shell.grab(n.id,`tree`),children:l(ji,{spec:e,e:n,zone:e.service})}),o(n)&&a&&e.leaf()]},n.id))]})},Pi=({spec:e})=>{let{mode:t,folder:n,expand:i}=r(e.ai),a=e.ai.scan(`files/`),o=e.shell;return l(c,{children:e.links.map(r=>u(`div`,{children:[l(O,{on:r.id===``?t===``&&n===``:t===r.id,open:!!r.tree&&i.includes(r.tree),turn:r.tree?o.foldTree(r.tree):void 0,icon:r.icon,label:r.label,drop:r.drop,mark:r.drop,from:r.from,click:r.id===``?o.treeClick(``):o.goMode(r.id),children:r.menu&&l(Mi,{spec:e,id:r.menu})}),r.tree===`.home`&&i.includes(r.tree)&&l(Si,{files:a,parent:``,depth:1,expand:i,active:t===``?n:``,kinds:e.kinds,fold:o.foldTree,enter:o.treeClick,file:o.pickFile,open:o.openFile,rclick:e=>o.context(`tree:${e.id}`),menu:t=>l(ji,{spec:e,e:t}),drag:o.grab}),r.tree&&r.tree!==`.home`&&i.includes(r.tree)&&l(Ni,{spec:e})]},r.id))})},Fi=({spec:e,drawer:t,upgrade:n})=>{let{bar:i,storage:a,shellMenu:o}=r(e.ai),s=e.shell;return l(li,{brand:{...e.brand,click:s.treeClick(``)},bar:i,drawer:t,fold:()=>void e.ai.toggle_bar(),close:s.closeShell,press:s.press,storage:a,upgrade:n,more:s.flip(`storage`),menu:o===`storage`?l(b,{items:Dn,pick:s.pickStorage,check:D.check}):null,children:l(Pi,{spec:e})})},Ii=()=>window.open(bn,`_blank`),Li=({spec:e})=>{let{shellMenu:t,band:n}=r(e.ai);return u(c,{children:[e.extra?.(),l(ln,{icon:fn,click:e.shell.flip(`more`),children:t===`more`&&l(b,{cls:`w-80`,items:jn(n,e.bandLabel,On),pick:e.shell.pickPage,check:D.check})}),l(`span`,{className:`hidden md:flex`,children:l(Xr,{})}),l(`span`,{className:`hidden md:flex`,children:e.user})]})},Ri=({spec:e})=>{let{mode:t,folder:n}=r(e.ai);return t===`edit`?l(c,{children:e.title()}):t===``?l(c,{children:Un(n)}):l(c,{children:e.titles[t]??k[t]??Un(``)})},zi=({spec:e})=>{let{bar:t}=r(e.ai),n=e.history?{undo:()=>void e.ai.undo({}),redo:()=>void e.ai.redo({})}:{};return l(un,{bar:t,open:()=>void e.ai.toggle_bar(),title:l(Ri,{spec:e}),...n,expand:e.expand?.(),actions:l(Li,{spec:e})})},Bi=({spec:e})=>{let{shellMenu:t,band:n}=r(e.ai);return l(cn,{...e.brand,home:e.shell.treeClick(``),drawer:e.shell.openDrawer,actions:u(c,{children:[l(Xr,{}),l(dn,{icon:fn,click:e.shell.flip(`sp-more`),children:t===`sp-more`&&l(b,{items:jn(n,e.bandLabel,kn),pick:e.shell.pickPage,check:D.check})}),e.user]})})},Vi=({spec:e})=>{let{band:t,mode:n,shellMenu:i}=r(e.ai);return!t||!(e.bandModes??[`edit`,``,e.service]).includes(n)?null:l(an,{cards:e.bandCards,click:e.shell.pickCard,popup:t=>t.id===`new`&&i===`create`?e.popup():null})},Hi=({spec:e})=>{let{mode:t,folder:n,shellMenu:i}=r(e.ai),a=Ei(),o=e.shell;return l(qn,{rows:bi(e.ai.scan(`files/`),t,n,e.service),kinds:e.kinds,menu:i,point:a,flip:o.flip,context:o.context,open:o.openFile,pick:o.pickRow,drag:o.grab})},Ui=({spec:e})=>{let{mode:t,folder:n,band:i,bar:a}=r(e.ai),o=e.cover?.();if(o)return l(ei,{children:o});let s=Vn.includes(t);return u(ei,{drop:t===``?n:void 0,from:`tree os`,children:[l(zi,{spec:e}),s&&l(ai,{mode:t,lines:e.helpLines,value:{band:i,bar:a},flip:e.shell.flipSetting}),!s&&l(Vi,{spec:e}),t===`edit`&&e.editor(),!s&&t!==`edit`&&l(Hi,{spec:e})]})},Wi=({spec:e,close:t,children:n})=>{let r=Ti();return u($r,{drawer:r,close:t??e.shell.closeShell,dropRef:e.shell.drop,children:[l(Bi,{spec:e}),l(Fi,{spec:e,drawer:r,upgrade:Ii}),l(Ui,{spec:e}),l(Qr,{}),n]})},Gi=({items:e,pick:t})=>l(b,{align:`left`,items:e,pick:t,check:D.check}),Ki=e=>{e.stopPropagation(),t(K,!0)},qi=()=>t(K,!1),Ji=e=>t(Ci,{x:e.clientX,y:e.clientY}),Yi=()=>t(Ci,null),Xi=e=>e.split(`/`).filter(Boolean).map(encodeURIComponent).join(`/`),Zi=(e,t)=>e.then(e=>e.ok?e.json():t).catch(()=>t),q=e=>`${W.base}/${Xi(e)}`,Qi=()=>location.pathname.split(`/`).filter(Boolean).map(decodeURIComponent).join(`/`),$i=(e,t)=>{if(e===W.self)return`${location.origin}/${Xi(t)}`;let n=location.host.replace(RegExp(`^${W.self}(?=[.-])`),e);return`${n===location.host?`https://${e}.glre.dev`:`https://${n}`}/${Xi(t)}`},ea=({id:e},t)=>{let n=t[`files/${e}`];return n?n.kind.startsWith(`folder`)?`folder cannot be opened: ${e}`:(window.open(W.editors.includes(n.kind)?$i(n.kind,e):q(e),`_blank`),`opened ${n.name} in new tab`):`not found: ${e}`},J={list(e=``){return Zi(fetch(`${W.base}?prefix=${encodeURIComponent(e)}`),[])},get(e){return fetch(q(e))},put(e,t,n={}){let r=`?kind=${encodeURIComponent(n.kind??``)}&site=${encodeURIComponent(n.site??``)}`;return Zi(fetch(q(e)+r,{method:`POST`,headers:n.type?{"Content-Type":n.type}:void 0,body:t}),{path:e,size:0,date:new Date().toISOString()})},move(e,t){return fetch(`${q(e)}?to=${encodeURIComponent(t)}`,{method:`PUT`})},remove(e){return fetch(q(e),{method:`DELETE`})}},Y=(e,t)=>t===``?e:`${t}/${e}`,ta=e=>e.split(`/`).slice(0,-1).join(`/`),na=e=>e.path.endsWith(`/`)?e.path.slice(0,-1):e.path,ra=e=>e.split(`/`).slice(0,-1).map((e,t,n)=>n.slice(0,t+1).join(`/`)).filter(e=>e!==W.trash),ia=e=>e.includes(`.`)?(e.split(`.`).pop()??``).toLowerCase():``,aa=e=>{let t=ia(e);return t===`pdf`?`pdf`:t===`mp4`||t===`mov`||t===`webm`?`mp4`:t===`jpg`||t===`jpeg`||t===`png`||t===`gif`?`jpg`:t===`xlsx`||t===`xls`||t===`csv`?`xlsx`:`file`},oa=(e,t)=>{let n=na(e),r=n.startsWith(`${W.trash}/`),i=r?n.slice(W.trash.length+1):n,a=i.split(`/`).pop(),o=e.kind??t?.kind??(e.path.endsWith(`/`)?`folder`:aa(a)),s=o.startsWith(`folder`)?`—`:dt(e.size);return{owner:`自分`,...t,id:n,name:a,kind:o,date:ut(e.date),iso:e.date,size:s,bytes:e.size,parent:ta(i),trashed:r}},X=(e,t,n,r=!1)=>mt(e,new Set(t.filter(e=>e.parent===n&&!!e.trashed===r).map(e=>e.name))),Z=e=>e.scan(`files/`),Q=(e,t)=>{let n=oa(t,e[`files/${na(t)}`]);return e[`files/${n.id}`]=n,ra(n.id).forEach(n=>{e[`files/${n}`]||(e[`files/${n}`]=oa({path:`${n}/`,size:0,date:t.date}))}),n},sa=async(e,t,n,r,i,a)=>{let o=X(n.replace(/^\.+/,``)||`無題のファイル`,Z(e),r),s=Y(o,r),c={path:t.startsWith(`folder`)?`${s}/`:s,size:i?.size??0,date:new Date().toISOString(),kind:t};return Q(e,c),Q(e,await J.put(c.path,i,{kind:t,site:a,type:i?.type}))},ca=async(e,t,n=``)=>{let r=n;for(let n of t.split(`/`).filter(Boolean)){let t=e[`files/${Y(n,r)}`];r=t?.kind.startsWith(`folder`)?t.id:(await sa(e,`folder`,n,r,``)).id}return r},$=async(e,t,n)=>{for(let{path:r,file:i}of t){let t=r.split(`/`).filter(Boolean),a=t.pop(),o=await ca(e,t.join(`/`),n);i||await ca(e,a,o),i&&await sa(e,aa(a),a,o,i)}},la=async(e,t)=>{let n=await J.list(),r=new Set;for(let e of n){let n=Q(t,e);r.add(n.id),ra(n.id).forEach(e=>r.add(e))}Z(t).forEach(e=>!r.has(e.id)&&delete t[`files/${e.id}`]);let i=n.reduce((e,t)=>e+t.size,0);return t.storage={used:i/1048576,total:nt,text:`15 GB 中 ${ft(i)} を使用`},`synced ${n.length} objects`},ua=async({id:e,dir:t},n)=>{let r=n[`files/${e}`];if(!r||r.trashed)return`not found: ${e}`;if(r.parent===t)return`already in ${t===``?`root`:t}`;if(r.kind.startsWith(`folder`)&&(t===e||t.startsWith(`${e}/`)))return`cannot move ${r.name} into itself`;let i=X(r.name,Z(n),t),a=Y(i,t);return await J.move(e,a),delete n[`files/${e}`],n[`files/${a}`]={...r,id:a,name:i,parent:t},Z(n).forEach(t=>{if(!t.id.startsWith(`${e}/`))return;delete n[`files/${t.id}`];let r={...t,id:a+t.id.slice(e.length),parent:a+t.parent.slice(e.length)};n[`files/${r.id}`]=r}),`moved ${i} to ${t===``?`root`:t}`},da=async({id:e},t)=>{let n=t[`files/${e}`];if(!n)return`not found: ${e}`;if(n.trashed)return delete t[`files/${e}`],Z(t).forEach(n=>n.id.startsWith(`${e}/`)&&delete t[`files/${n.id}`]),await J.remove(e),`deleted ${n.name}`;let r=X(n.name,Z(t),n.parent,!0),i=Y(r,n.parent);return await J.move(e,`${W.trash}/${i}`),delete t[`files/${e}`],t[`files/${W.trash}/${i}`]={...n,id:`${W.trash}/${i}`,name:r,trashed:!0},Z(t).forEach(n=>{if(!n.id.startsWith(`${e}/`))return;delete t[`files/${n.id}`];let r={...n,id:`${W.trash}/${i}${n.id.slice(e.length)}`,parent:i+n.parent.slice(e.length),trashed:!0};t[`files/${r.id}`]=r}),`trashed ${n.name}`},fa=async({id:e},t)=>{let n=t[`files/${e}`];if(!n?.trashed)return`not trashed: ${e}`;let r=await ca(t,n.parent),i=X(n.name,Z(t),r),a=Y(i,r);await J.move(e,a),delete t[`files/${e}`];let o={...n,id:a,name:i,parent:r};return delete o.trashed,t[`files/${a}`]=o,`restored ${i}`},pa=async({id:e,name:t},n)=>{let r=n[`files/${e}`];if(!r)return`not found: ${e}`;let i=t.replace(/^\.+/,``)||r.name,a=X(i,Z(n),r.parent),o=Y(a,r.parent);return await J.move(e,o),delete n[`files/${e}`],n[`files/${o}`]={...r,id:o,name:a},Z(n).forEach(t=>{if(!t.id.startsWith(`${e}/`))return;delete n[`files/${t.id}`];let r={...t,id:o+t.id.slice(e.length),parent:o+t.parent.slice(e.length)};n[`files/${r.id}`]=r}),`renamed to ${a}`},ma=async(e,t)=>{let n=Z(t).filter(e=>e.trashed);n.forEach(e=>delete t[`files/${e.id}`]);let r=await J.list(`${W.trash}/`);return await Promise.all(r.map(e=>J.remove(e.path))),`emptied ${n.length} items`},ha=e=>xi(Z(e)),ga=({kind:e,name:t,parent:n},r)=>{let i=n??(r.mode===``?r.folder:``);return sa(r,e,t??`無題のファイル`,i,``,W.editors.includes(e)?crypto.randomUUID():void 0)},_a=({id:e},t)=>{let n=t[`files/${e}`];return n?(t[`files/${e}`]={...n,pinned:!n.pinned},`${n.name} pinned: ${!n.pinned}`):`not found: ${e}`},va={menu:`shellMenu`,setMenu:`set_shell_menu`,open:`open_entry`},ya=e=>!!e.target?.closest?.(`button, a, input, label`),ba=(e,t={})=>{let n={...va,...t.names},r=()=>e[n.menu],i=t=>e[n.setMenu]({id:t}),a=()=>e.mode===``&&e.folder!==``,o=()=>a()?e.folder:``,s=()=>{r()!==``&&i(``),wi()&&qi(),t.onClose?.()},c=e=>{y(e),r()!==``&&i(``),t.onClose?.()},l=e=>n=>{y(n),Yi(),t.onClose?.(),i(r()===e?``:e)},u=e=>t=>{t.preventDefault(),y(t),Ji(t),i(e)},d=t=>n=>{y(n),e.toggle_tree({path:t})},f=t=>()=>{s(),e.open_folder({path:t})},p=t=>()=>{s(),e.set_mode({mode:t})},m=t=>r=>{if(!(ya(r)||t.trashed)){if(t.kind.startsWith(`folder`))return void e.open_folder({path:t.id});e[n.open]({id:t.id})}},h=t=>()=>{if(s(),t.kind===W.self)return Oi(t.id);e.open_folder({path:t.parent})},g=e=>window.prompt(wn,e),_=async(t,n)=>{let r=window.prompt(Sn,Cn);if(!r)return;let i=await e.create_file({kind:`folder`,name:r,parent:t});n&&e.open_folder({path:i.id})},ee=async(t,n)=>{await e.upload_file({parent:t}),n&&!a()&&e.open_folder({path:``})},te=async(t,n)=>{let r=await e.upload_folder({parent:t});n&&typeof r==`object`&&e.open_folder({path:r.folder})},ne=e=>{if(s(),e.id===`folder`)return void _(o(),!0);if(e.id===`upload`)return void ee(o(),!0);if(e.id===`upload-folder`)return void te(o(),!0)},re=t=>r=>{if(s(),r.id===`open`)return void e[n.open]({id:t.id});if(r.id===`rename`)return void ie(t);if(r.id===`folder`)return void _(t.id,!1);if(r.id===`upload`)return void ee(t.id,!1);if(r.id===`upload-folder`)return void te(t.id,!1);if(r.id===`download`)return void e.download_file({id:t.id});if(r.id===`info`)return void window.alert(Hn(t));if(r.id===`pin`)return void e.toggle_pin({id:t.id});if(r.id===`remove`||r.id===`purge`)return void e.remove_file({id:t.id});if(r.id===`restore`)return void e.restore_file({id:t.id})},ie=t=>{let n=window.prompt(wn,t.name);n&&e.rename_file({id:t.id,name:n})},ae=t=>{if(s(),t.id===`manage`)return void e.set_mode({mode:`storage`});if(t.id===`empty`)return void e.empty_trash({});if(t.id===`refresh`)return void e.sync_files({})},oe=n=>{if(s(),!t.create)return t.insert?.(n);if(n.id===t.createId)return void e[t.create]({parent:o()});if(e.mode===`edit`)return t.insert?.(n);let r=t.intents?.[n.id]??t.fallback?.(n);e[t.create]({parent:o(),then:r?.name,input:r?.input})},se=e=>t=>{if(e.menu||e.id===`new`)return l(`create`)(t);oe(e)},ce=n=>{if(s(),!t.onPage?.(n)){if(n.id===`band`)return void e.toggle_band();if(n.id===`undo`)return void e.undo({});if(n.id===`redo`)return void e.redo({});e.set_mode({mode:n.id})}},le=t=>t===`band`?void e.toggle_band():void e.toggle_bar(),ue=(t,n)=>r=>{s(),e.set_chip({chip:t,value:r.id===n?``:r.id})},de=t=>n=>{y(n),e.set_chip({chip:t,value:``})},fe=Vt((t,n)=>{if(!t.startsWith(`${W.trash}/`)){if(n===W.trash)return void e.remove_file({id:t});e.move_file({id:t,dir:n})}}),pe=Xt(`os`,async(t,n)=>{if(t.some(e=>(e.file?.size??0)>104857600))return void window.alert(it);await $(e,t,n),e.sync_files({})},()=>e.mode!==`trash`);return{closeShell:s,press:c,flip:l,context:u,foldTree:d,treeClick:f,goMode:p,openFile:m,pickFile:h,askName:g,pickHome:ne,pickRow:re,pickStorage:ae,pickInsert:oe,pickCard:se,pickPage:ce,flipSetting:le,pickChip:ue,clearChip:de,openDrawer:Ki,grab:fe,drop:pe,target:o,isFolderMode:a}},xa=e=>new Promise(t=>{let n=document.createElement(`input`);n.type=`file`,n.multiple=!0,n.webkitdirectory=e,n.oncancel=()=>t([]),n.onchange=()=>t(Array.from(n.files??[])),n.click()}),Sa=(e,t)=>{let n=document.createElement(`a`);n.href=q(e),n.download=t,document.body.appendChild(n),n.click(),n.remove()},Ca=e=>new Promise(t=>setTimeout(t,e)),wa=async({parent:e=``},t)=>{let n=await xa(!1);return n.length===0?`upload canceled`:(await $(t,n.map(e=>({path:e.name,file:e})),e),`uploaded ${n.map(e=>e.name).join(`, `)} into ${e===``?`root`:e}`)},Ta=async({parent:e=``},t)=>{let n=await xa(!0);if(n.length===0)return`upload canceled`;let r=n.map(e=>({path:e.webkitRelativePath||e.name,file:e}));await $(t,r,e);let i=r[0].path.split(`/`);return{folder:i.length>1?Y(i[0],e):e,count:n.length}},Ea=async({id:e},t)=>{let n=t[`files/${e}`];if(e!==``&&!n)return`not found: ${e}`;if(n&&!n.kind.startsWith(`folder`))return Sa(n.id,n.name),`downloaded ${n.name}`;let r=t.scan(`files/`).filter(t=>(e===``||t.id.startsWith(`${e}/`))&&!t.kind.startsWith(`folder`)&&!t.trashed);for(let e of r)Sa(e.id,e.name),await Ca(300);return`downloaded ${r.length} files`},Da=e=>e.split(`/`).filter(Boolean).map(encodeURIComponent).join(`/`),Oa=()=>{let e=new URLSearchParams(location.search),t=Qi(),n=t!==``&&location.pathname.endsWith(`/`),r=e.get(`q`)??``;return{path:t,mode:r===`home`?``:r,folder:n,query:e.has(`q`)}},ka=e=>e.folder?``:e.path,Aa=(e,t)=>{if(t.folder)return void e.open_folder({path:t.path});if(t.query)return void e.set_mode({mode:t.mode})},ja=(e,t)=>e.mode===`edit`?`/${Da(t)}`:e.mode===``?e.folder===``?`/?q=home`:`/${Da(e.folder)}/`:`/?q=${encodeURIComponent(e.mode)}`,Ma=(e,t)=>{let n=``;e.data().observe(()=>{let r=ja(e,t);r!==n&&(n=r,location.pathname+location.search!==r&&history.pushState(null,``,r+location.hash))}),window.addEventListener(`popstate`,()=>Aa(e,Oa()))},Na=(e,{lobby:t,wire:n,synced:r})=>{let i=Oa(),a=ka(i),o=async()=>{await e.sync_files({}),Aa(e,i),await r?.(),ki(e)};return n?.(a),Ma(e,a),a===``?{file:a,room:t,synced:o}:{file:a,path:a,synced:o}},Pa=e=>({role:`agent`,text:e.text,tools:e.tools.map(e=>({icon:N.icon,label:`${e.server?`${e.server} - `:``}${e.name} (MCP)`}))}),Fa=e=>t(F,e.flatMap(e=>[{role:`user`,text:e.prompt},Pa({text:e.reply,tools:e.tools.map(e=>({server:``,name:e}))})])),Ia=e=>e.map(e=>e.tools.length?`${e.text}\n`:e.text).join(`
5
+ `),La=async e=>{if(L.value)return`busy: previous chat is still running`;let n=[...F.value,{role:`user`,text:e}];kr(),t(F,n),t(L,!0);let r=await N.stream.send({prompt:e,path:N.path,model:$n.value,headers:N.headers},e=>{t(F,[...n,...e.items.map(Pa)]),Dr(Ia(e.items))});return Or(Ia(r)),t(L,!1),`chat sent: ${e}`},Ra=e=>{let t=[],n=``,r=[],i=()=>Math.floor(new Date().getHours()/6),a=r=>{let a=i(),o=n,s=t.find(e=>e.name===r&&e.part===a&&e.after===o);s&&(s.count+=1),s||t.push({name:r,part:a,after:o,count:1}),n=r,e.store.save({name:r,part:a,after:o})},o=e=>t.reduce((t,r)=>r.name===e?t+r.count*(r.part===i()?2:1)*(r.after===n?2:1):t,0),s=e=>[...e].sort((e,t)=>o(t.name)-o(e.name)),c=()=>(r.length===0&&(r=e.deck.map(e=>({...e,run:()=>(a(e.name),e.run())}))),s(r));return{commands:c,hello:()=>{let t=c(),n=t.filter(t=>e.starters().includes(t.name)),r=[...new Set([...e.pinned(),...n.map(e=>e.name)])].flatMap(e=>t.filter(t=>t.name===e));return{...e.greet,prompts:r.map(e=>({label:e.label??e.name,prompt:`/${e.name}`}))}},hints:t=>e.hinted(t).flatMap(e=>c().filter(t=>t.name===e)),prime:async()=>{t=await e.store.list()}}},za=(e,t)=>e.map((n,r)=>{let i=e[r+1]?.seq??1/0;return{...n,names:t.filter(e=>e.seq>n.seq&&e.seq<i).map(e=>e.name)}}),Ba=e=>e.replace(/\s+/g,` `).trim().slice(0,40),Va=e=>{let t=Math.max(0,(Date.now()-new Date(e).getTime())/1e3);return t<60?`たった今`:t<3600?`${Math.floor(t/60)} 分前`:t<86400?`${Math.floor(t/3600)} 時間前`:`${Math.floor(t/86400)} 日前`},Ha=e=>{let t=crypto.randomUUID(),n=0,r=[],i=()=>{t=crypto.randomUUID(),n=0,r=[],e.show([])},a=async()=>(await e.store.list()).map(e=>({...e,when:Va(e.updatedAt)})),o=async i=>{let a=await e.store.load(i),o=za(a.talks,a.tools).map(e=>({prompt:e.prompt,reply:e.reply,tools:e.names}));t=i,n=[...a.talks,...a.tools].reduce((e,t)=>Math.max(e,t.seq),0),r=o.flatMap(e=>[{role:`user`,content:e.prompt},{role:`assistant`,content:e.reply}]),e.show(o)},s=(i,a,o=``)=>{let s=a.filter(e=>!e.error),c=s.map(e=>e.text).filter(e=>e!==``).join(`
6
6
 
7
- `);if(c===``)return;let l=s.flatMap(e=>e.tools.map(e=>e.name));r=[...r,{role:`user`,content:i},{role:`assistant`,content:c}];let u=n+1;n=u+l.length,e.store.save(t,{title:yi(i),seq:u,prompt:i,reply:c,model:o,tools:l.map((e,t)=>({seq:u+1+t,name:e}))})};return{wrap:e=>({...e,send:async(t,n)=>{let i=await e.send({...t,messages:r.slice(-40)},n);return s(t.prompt,i,t.model),i}}),reset:i,load:o,list:a}};export{fi as AiChat,ui as AiChatButton,rn as Band,Dn as Brand,nn as Cards,Vn as DriveTree,Je as Drop,hn as Fold,fn as Frame,ct as GB,ln as HeadBtn,_ as Icon,ut as KB,lt as MB,pn as Main,cn as MainHead,dn as MoreIcon,qe as Pop,gn as Row,st as SP_BREAK,kn as Side,Ue as Slot,un as SpBtn,sn as SpHead,On as Storage_,$t as Strip,ht as ago,$n as ancestors,qn as atPoint,et as band,wn as bandIcon,nt as blue,z as chatConfig,Gr as closeChat,Kn as closeDrawer,pr as configureChat,An as configureDrive,_i as createCommands,Ut as createFileDrag,Qt as createFileDrop,xi as createHistory,Et as createOver,zn as crumbSegs,zt as dragEvent,D as drawerAtom,T as driveConfig,Gt as dropEvent,Qe as edge,dr as emptyTrash,bn as emptyTrashAsk,nr as entryOf,er as extOf,tt as fill,Rn as folderRows,M as freeName,rt as grid,w as icons,Qn as idOf,Ye as ink,_r as isChatBusy,Hn as isDrawerOpen,E as isFolder,tr as kindOf,Pn as kindRows,Ze as line,hr as markdown,rr as mirrorFile,P as mkdirp,I as models,Tn as moreItems,sr as moveFile,Xe as mute,Jn as noPoint,Wr as openChat,Gn as openDrawer,Sn as pageMenu,$e as pale,Zn as parentOf,j as pathname,We as place,O as pointAtom,He as prev,it as quota,A as r2,Fn as recentRows,cr as removeFile,ur as renameFile,mi as restoreChat,lr as restoreFile,mn as rowCls,gi as runChat,ir as saveFile,v as side,pt as sizeOf,Cn as spMenu,ft as stamp,Ve as stop,xn as storageMenu,_n as storageName,Ln as storageRows,ar as storeFiles,or as syncFiles,pi as toMsg,Kr as toggleChat,In as trashRows,Nn as treeOf,gt as unique,vn as upgradeLabel,yn as upgradeUrl,ot as uploadAlert,at as uploadMax,k as url,mt as usageOf,vr as useChatBusy,Un as useDrawer,Wn as usePoint,fr as usedBytes,Bn as usedOf,b as vec2};
7
+ `);if(c===``)return;let l=s.flatMap(e=>e.tools.map(e=>e.name));r=[...r,{role:`user`,content:i},{role:`assistant`,content:c}];let u=n+1;n=u+l.length,e.store.save(t,{title:Ba(i),seq:u,prompt:i,reply:c,model:o,tools:l.map((e,t)=>({seq:u+1+t,name:e}))})};return{wrap:e=>({...e,send:async(t,n)=>{let i=await e.send({...t,messages:r.slice(-40)},n);return s(t.prompt,i,t.model),i}}),reset:i,load:o,list:a}};export{Qr as AiChat,Xr as AiChatButton,an as Band,si as Brand,rn as Cards,gn as Caret,$t as Chips,Si as DriveTree,b as Drop,qn as FileList,mn as Fold,$r as Frame,ot as GB,ln as HeadBtn,ri as HelpPage,v as Icon,Gi as ItemsPopup,ct as KB,Wi as Layout,st as MB,ei as Main,un as MainHead,_n as More,fn as MoreIcon,ai as Pages,Ke as Pop,O as Row,hn as RowBtn,at as SP_BREAK,ni as SettingsPage,ii as ShortcutsPage,li as Side,Fi as SideBar,He as Slot,dn as SpBtn,cn as SpHead,ci as Storage_,en as Strip,Kn as Tile,ji as TreeMore,pt as ago,ra as ancestors,Aa as applyRoute,Ji as atPoint,Qe as band,An as bandIcon,et as blue,Na as bootShell,N as chatConfig,jr as closeChat,qi as closeDrawer,Yn as configureChat,ui as configureDrive,Ra as createCommands,ga as createFile,Vt as createFileDrag,Xt as createFileDrop,Ha as createHistory,wt as createOver,ba as createShell,yi as crumbSegs,Ea as downloadFile,Lt as dragEvent,K as drawerAtom,W as driveConfig,Ut as dropEvent,Xe as edge,$i as editorUrl,Wn as emptyLabel,ma as emptyTrash,xn as emptyTrashAsk,oa as entryOf,ia as extOf,ka as fileOf,$e as fill,Sn as folderAsk,Cn as folderDefault,vi as folderRows,X as freeName,Oi as gotoFile,tt as grid,Mn as homeMenu,D as icons,na as idOf,Hn as infoOf,qe as ink,er as isChatBusy,wi as isDrawerOpen,G as isFolder,aa as kindOf,mi as kindRows,Rn as leafMenu,Ye as line,Zn as markdown,Q as mirrorFile,ca as mkdirp,bi as modeRows,A as models,jn as moreItems,ua as moveFile,Je as mute,Yi as noPoint,Ar as openChat,Ki as openDrawer,ea as openEntry,Qi as openPath,On as pageMenu,Vn as pageModes,k as pageTitles,Ze as pale,ta as parentOf,Y as pathname,In as pinLabel,Ue as place,Ci as pointAtom,Ve as prev,nt as quota,J as r2,Oa as readRoute,hi as recentRows,da as removeFile,wn as renameAsk,pa as renameFile,Fa as restoreChat,fa as restoreFile,Tn as rootTitle,pn as rowCls,La as runChat,ki as runIntent,sa as saveFile,zn as settingRows,Bn as shortcutRows,x as side,dt as sizeOf,kn as spMenu,ut as stamp,y as stop,Dn as storageMenu,vn as storageName,_i as storageRows,$ as storeFiles,la as syncFiles,Un as titleOf,Pa as toMsg,Mr as toggleChat,_a as togglePin,Fn as trashMenu,gi as trashRows,Pn as treeFileMenu,Nn as treeFolderMenu,Ln as treeMenuOf,pi as treeOf,mt as unique,En as unpinLabel,yn as upgradeLabel,bn as upgradeUrl,it as uploadAlert,wa as uploadFiles,Ta as uploadFolder,rt as uploadMax,q as url,ja as urlOf,ft as usageOf,tr as useChatBusy,Ti as useDrawer,Ei as usePoint,ha as usedBytes,xi as usedOf,C as vec2,Ma as watchUrl};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ai-ax",
3
3
  "author": "tseijp",
4
- "version": "0.10.0",
4
+ "version": "0.11.0",
5
5
  "license": "MIT",
6
6
  "description": "AI Agent Experience (AI/AX) library for Hono + Cloudflare. One act surface for both human UI/UX and LLM MCP tools, with authentication, authorization, realtime sync and Claude API relay.",
7
7
  "keywords": [