@r_masseater/masseater-utils 0.13.0 → 0.14.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.
- package/dist/{client-DX2jXirb.mjs → client-BSzBrLkG.mjs} +4 -4
- package/dist/{client-DX2jXirb.mjs.map → client-BSzBrLkG.mjs.map} +1 -1
- package/dist/desktop-shell/media-notes.mjs +9 -3
- package/dist/desktop-shell/media-notes.mjs.map +1 -1
- package/dist/desktop-shell/release-cli.mjs +3 -4
- package/dist/desktop-shell/release-cli.mjs.map +1 -1
- package/dist/{headers-Bpv9DhNS.mjs → headers-B6rDlN_n.mjs} +4 -4
- package/dist/headers-B6rDlN_n.mjs.map +1 -0
- package/dist/model-server/process.mjs +12 -9
- package/dist/model-server/process.mjs.map +1 -1
- package/dist/model-server.mjs +1 -1
- package/dist/{node-main-BrhzkUvP.mjs → node-main-Cx8sevy0.mjs} +5 -2
- package/dist/{node-main-BrhzkUvP.mjs.map → node-main-Cx8sevy0.mjs.map} +1 -1
- package/dist/node-main.mjs +2 -2
- package/dist/plugin-kit.mjs +4 -4
- package/dist/plugin-kit.mjs.map +1 -1
- package/dist/{receive-o3h4RxCi.mjs → receive-DmWBDte9.mjs} +21 -3
- package/dist/receive-DmWBDte9.mjs.map +1 -0
- package/dist/{run-main-Chtieg-p.mjs → run-main-CfugYs_u.mjs} +9 -6
- package/dist/{run-main-Chtieg-p.mjs.map → run-main-CfugYs_u.mjs.map} +1 -1
- package/dist/security-headers/http.mjs +1 -1
- package/dist/security-headers/response.mjs +1 -1
- package/dist/security-headers/static.mjs +1 -1
- package/dist/security-headers/vite.mjs +1 -1
- package/dist/security-headers.mjs +1 -1
- package/dist/{static-page-headers-muClDOhu.mjs → static-page-headers-gBsEgnqj.mjs} +2 -2
- package/dist/{static-page-headers-muClDOhu.mjs.map → static-page-headers-gBsEgnqj.mjs.map} +1 -1
- package/dist/{usage-meter-B196tKiM.mjs → usage-meter-ifuOWUth.mjs} +3 -3
- package/dist/usage-meter-ifuOWUth.mjs.map +1 -0
- package/dist/usage-meter.mjs +1 -1
- package/dist/vitest-otlp/setup.mjs +1 -2
- package/dist/vitest-otlp/setup.mjs.map +1 -1
- package/dist/workers-tracing/browser-logs.mjs +1 -1
- package/dist/workers-tracing/browser-spans.mjs +1 -1
- package/package.json +1 -1
- package/skills/add-scroll-chip-row/SKILL.md +1 -1
- package/skills/assert-exported-telemetry/SKILL.md +1 -1
- package/skills/build-tauri-app/SKILL.md +1 -1
- package/skills/find-cache-folder/SKILL.md +1 -1
- package/skills/import-custom-format/SKILL.md +1 -1
- package/skills/name-stack-resources/SKILL.md +1 -1
- package/skills/read-hook-input/SKILL.md +1 -1
- package/skills/read-node-ecosystem/SKILL.md +1 -1
- package/skills/run-effect-main/SKILL.md +1 -1
- package/skills/share-types-with-rust/SKILL.md +1 -1
- package/skills/trace-workers/SKILL.md +1 -1
- package/skills/use-model-server/SKILL.md +1 -1
- package/skills/write-actions-steps/SKILL.md +1 -1
- package/dist/headers-Bpv9DhNS.mjs.map +0 -1
- package/dist/receive-o3h4RxCi.mjs.map +0 -1
- package/dist/usage-meter-B196tKiM.mjs.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Array, Effect, Fiber, Match, MutableRef, Option, Predicate, Record, Schedule, Schema, Stream, String as String$1, pipe } from "effect";
|
|
1
|
+
import { Array, Effect, Fiber, Match, MutableRef, Number as Number$1, Option, Predicate, Record, Schedule, Schema, Stream, String as String$1, pipe } from "effect";
|
|
2
2
|
import { AsyncResult, Atom, AtomRegistry } from "effect/reactivity";
|
|
3
3
|
import { Check, Copy, ExternalLink, FolderOpen, LoaderCircle } from "lucide-react";
|
|
4
4
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -581,7 +581,10 @@ const NONE$1 = 0;
|
|
|
581
581
|
const FULL$1 = 1;
|
|
582
582
|
const percent = (seconds, duration) => {
|
|
583
583
|
if (duration <= NONE$1) return NONE$1;
|
|
584
|
-
return
|
|
584
|
+
return Number$1.clamp(seconds / duration, {
|
|
585
|
+
minimum: NONE$1,
|
|
586
|
+
maximum: FULL$1
|
|
587
|
+
}) * WHOLE;
|
|
585
588
|
};
|
|
586
589
|
const SpanRect = ({ from, to, duration, lane, className }) => /* @__PURE__ */ jsx("rect", {
|
|
587
590
|
x: `${percent(from, duration)}%`,
|
|
@@ -665,7 +668,10 @@ const NONE = 0;
|
|
|
665
668
|
const FULL = 1;
|
|
666
669
|
const secondsAt = ({ element, duration }, x) => {
|
|
667
670
|
const { left, width } = element.getBoundingClientRect();
|
|
668
|
-
return
|
|
671
|
+
return Number$1.clamp((x - left) / Math.max(width, FULL), {
|
|
672
|
+
minimum: NONE,
|
|
673
|
+
maximum: FULL
|
|
674
|
+
}) * duration;
|
|
669
675
|
};
|
|
670
676
|
const down = (scrubbing, event) => {
|
|
671
677
|
scrubbing.element.setPointerCapture(event.pointerId);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"media-notes.mjs","names":["START","Str","Arr","START","removed","Arr","KEY","Arr","WHOLE","Arr","NONE","FULL","Arr","Rec","Str","listen"],"sources":["../../src/entities/media/model/media.ts","../../src/shared/config/sites.ts","../../src/shared/lib/clock.ts","../../src/entities/media/ui/media-meta.tsx","../../src/shared/api/media-notes/media.ts","../../src/shared/api/media-notes/settled.ts","../../src/shared/lib/runtime.ts","../../src/features/connect-mcp/model/access.ts","../../src/features/connect-mcp/ui/copy-mcp-command.tsx","../../src/features/open-media/model/open.ts","../../src/features/open-media/model/use-file-drop.ts","../../src/features/open-media/ui/choose-file.tsx","../../src/features/open-media/ui/refusal.tsx","../../src/features/open-media/ui/open-bar.tsx","../../src/features/play-media/lib/file.ts","../../src/features/play-media/lib/niconico.ts","../../src/shared/lib/player.ts","../../src/features/play-media/lib/soundcloud.ts","../../src/features/play-media/lib/youtube.ts","../../src/features/play-media/lib/mount.ts","../../src/features/play-media/model/player.ts","../../src/shared/lib/keys.ts","../../src/features/play-media/model/use-play-key.ts","../../src/features/play-media/ui/key-hints.tsx","../../src/features/play-media/ui/media-player.tsx","../../src/features/select-range/model/range.ts","../../src/features/select-range/ui/range-readout.tsx","../../src/features/select-range/ui/ruler.tsx","../../src/features/select-range/ui/lanes.ts","../../src/features/select-range/ui/span-rect.tsx","../../src/features/select-range/ui/range-layer.tsx","../../src/features/select-range/ui/spans-layer.tsx","../../src/features/select-range/ui/track.tsx","../../src/features/select-range/ui/use-scrub.ts","../../src/features/select-range/ui/timeline.tsx","../../src/features/select-range/ui/use-range-key.ts","../../src/widgets/media-stage/ui/media-stage.tsx","../../src/widgets/media-stage/model/use-jump.ts","../../src/app/desktop-media-notes-model-save-range.ts","../../src/shared/lib/use-submit.ts","../../src/shared/lib/use-following.ts"],"sourcesContent":["import { Match, Option } from \"effect\";\nimport { Atom } from \"effect/reactivity\";\n\nimport type { Opened, Source } from \"#/shared/api/media-notes/index.ts\";\n\n/** @internal */\nexport const openedAtom = Atom.make(Option.none<Opened>()).pipe(Atom.keepAlive);\n\nexport const keyOf = ({ site, id }: Source): string => `${site}:${id}`;\n\nexport const pageOf = ({ site, id }: Source): Option.Option<string> =>\n Match.value(site).pipe(\n Match.when(\"youtube\", () => Option.some(`https://www.youtube.com/watch?v=${id}`)),\n Match.when(\"niconico\", () => Option.some(`https://www.nicovideo.jp/watch/${id}`)),\n Match.when(\"soundcloud\", () => Option.some(`https://soundcloud.com/${id}`)),\n Match.when(\"file\", () => Option.none()),\n Match.exhaustive,\n );\n","import type { Site } from \"#/shared/api/media-notes/index.ts\";\n\nexport const SITE_NAMES: Readonly<Record<Site, string>> = {\n youtube: \"YouTube\",\n niconico: \"ニコニコ\",\n soundcloud: \"SoundCloud\",\n file: \"ファイル\",\n};\n","import { String as Str } from \"effect\";\n\nconst SECONDS_PER_MINUTE = 60;\nconst START = 0;\nconst CLOCK_DIGITS = 2;\nconst TENTHS = 10;\nconst TENTH_DIGITS = 1;\n\nconst whole = (seconds: number): number => Math.max(Math.floor(seconds), START);\n\nexport const clock = (seconds: number): string => {\n const total = whole(seconds);\n const minutes = Math.floor(total / SECONDS_PER_MINUTE);\n return `${minutes}:${Str.padStart(CLOCK_DIGITS, \"0\")(String(total % SECONDS_PER_MINUTE))}`;\n};\n\nexport const preciseClock = (seconds: number): string => {\n const tenths = Math.floor(Math.max(seconds, START) * TENTHS) % TENTHS;\n return `${clock(seconds)}.${Str.padStart(TENTH_DIGITS, \"0\")(String(tenths))}`;\n};\n","import { Option } from \"effect\";\nimport { ExternalLink } from \"lucide-react\";\nimport type { ReactNode } from \"react\";\n\nimport { pageOf } from \"#/entities/media/model/media.ts\";\nimport type { Media } from \"#/shared/api/media-notes/index.ts\";\nimport { SITE_NAMES } from \"#/shared/config/index.ts\";\nimport { clock } from \"#/shared/lib/clock.ts\";\n\nconst PageLink = ({ media }: Readonly<{ media: Media }>): ReactNode =>\n Option.match(pageOf(media.source), {\n onNone: () => false,\n onSome: (page) => (\n <a\n href={page}\n target=\"_blank\"\n rel=\"noreferrer\"\n aria-label=\"元のページ\"\n className=\"text-muted-foreground hover:text-foreground self-center\"\n >\n <ExternalLink className=\"size-4\" />\n </a>\n ),\n });\n\nexport const MediaMeta = ({\n media,\n duration,\n}: Readonly<{ media: Media; duration: number }>): ReactNode => (\n <header className=\"flex min-w-0 items-baseline gap-3\">\n <span className=\"text-muted-foreground text-xs\">{SITE_NAMES[media.source.site]}</span>\n <h1 className=\"min-w-0 truncate text-base font-semibold\">{media.title}</h1>\n <span className=\"text-muted-foreground truncate text-sm\">{media.artist}</span>\n <span className=\"text-muted-foreground ml-auto font-mono text-xs tabular-nums\">\n {clock(duration)}\n </span>\n <PageLink media={media} />\n </header>\n);\n","import { invoke } from \"@tauri-apps/api/core\";\nimport { Effect, Option, Schema } from \"effect\";\n\nimport { McpAccessSchema, OpenedSchema } from \"#/shared/api/media-notes/media-protocol.ts\";\nimport type { McpAccess, Opened } from \"#/shared/api/media-notes/media-protocol.ts\";\n\nconst taggedError = Schema.TaggedError;\n\nexport class ApiFailed extends taggedError<ApiFailed, { readonly brand: unique symbol }>()(\n \"ApiFailed\",\n { message: Schema.String },\n) {}\n\nconst RefusalSchema = Schema.Struct({ message: Schema.String });\n\nconst failed = (cause: unknown): ApiFailed =>\n ApiFailed.make({\n message: Option.match(Schema.decodeUnknownOption(RefusalSchema)(cause), {\n onNone: () => String(cause),\n onSome: ({ message }) => message,\n }),\n });\n\ntype Decode<Value> = (input: unknown) => Effect.Effect<Value, Schema.SchemaError>;\n\nconst called = <Value>(\n decode: Decode<Value>,\n command: string,\n input: Readonly<Record<string, unknown>>,\n): Effect.Effect<Value, ApiFailed> =>\n Effect.tryPromise({ try: () => invoke<unknown>(command, input), catch: failed }).pipe(\n Effect.flatMap(decode),\n Effect.catchTag(\"SchemaError\", (cause) => cause.pipe(failed, Effect.fail)),\n );\n\nconst decodeOpened = Schema.decodeUnknownEffect(OpenedSchema);\n\nconst decodeChosen = Schema.decodeUnknownEffect(Schema.NullOr(OpenedSchema));\n\nconst decodeAccess = Schema.decodeUnknownEffect(McpAccessSchema);\n\nexport const openLink = (link: string): Effect.Effect<Opened, ApiFailed> =>\n called(decodeOpened, \"open_link\", { link });\n\nexport const openFile = (path: string): Effect.Effect<Opened, ApiFailed> =>\n called(decodeOpened, \"open_file\", { path });\n\nexport const chooseFile: Effect.Effect<Option.Option<Opened>, ApiFailed> = Effect.suspend(() =>\n called(decodeChosen, \"choose_file\", {}),\n).pipe(Effect.map(Option.fromNullishOr));\n\nexport const mcpAccess: Effect.Effect<McpAccess, ApiFailed> = Effect.suspend(() =>\n called(decodeAccess, \"mcp_access\", {}),\n);\n","import type { Schema } from \"effect\";\nimport { Effect } from \"effect\";\n\nimport { ApiFailed } from \"#/shared/api/media-notes/media.ts\";\n\nexport type Settled<Value> =\n | Readonly<{ status: \"ok\"; data: Value }>\n | Readonly<{ status: \"error\"; error: Readonly<{ message: string }> }>;\n\nconst thrown = (cause: unknown): ApiFailed => ApiFailed.make({ message: String(cause) });\n\nexport const settled = <Value>(\n run: () => Promise<Settled<Value>>,\n): Effect.Effect<Value, ApiFailed> =>\n Effect.tryPromise({ try: run, catch: thrown }).pipe(\n Effect.flatMap((answer) => {\n if (answer.status === \"ok\") {\n return Effect.succeed(answer.data);\n }\n return Effect.fail(ApiFailed.make({ message: answer.error.message }));\n }),\n );\n\nexport type Decode<Value> = (input: unknown) => Effect.Effect<Value, Schema.SchemaError>;\n\nexport const settledAs =\n <Value>(decode: Decode<Value>) =>\n (run: () => Promise<Settled<unknown>>): Effect.Effect<Value, ApiFailed> =>\n Effect.suspend(() => settled(run)).pipe(\n Effect.flatMap(decode),\n Effect.catchTag(\"SchemaError\", (cause) => cause.pipe(thrown, Effect.fail)),\n );\n","import { KeyValueStore } from \"effect/persistence\";\nimport { Atom } from \"effect/reactivity\";\n\n/** @internal */\nexport const runtime = Atom.runtime(KeyValueStore.layerStorage(() => globalThis.localStorage));\n","import { Effect } from \"effect\";\n\nimport { mcpAccess } from \"#/shared/api/media-notes/index.ts\";\nimport type { McpAccess } from \"#/shared/api/media-notes/index.ts\";\nimport { runtime } from \"#/shared/lib/runtime.ts\";\n\nconst commandOf = (name: string, { url, token }: McpAccess): string =>\n `claude mcp add --transport http ${name} ${url} --header \"Authorization: Bearer ${token}\"`;\n\n/** @internal */\nexport const copyAtom = runtime.fn((name: string) =>\n mcpAccess.pipe(\n Effect.flatMap((access) =>\n Effect.promise(() => navigator.clipboard.writeText(commandOf(name, access))),\n ),\n ),\n);\n","import { useAtom } from \"@effect/atom-react\";\nimport { AsyncResult } from \"effect/reactivity\";\nimport { Check, Copy } from \"lucide-react\";\nimport { useCallback } from \"react\";\nimport type { ReactNode } from \"react\";\n\nimport { copyAtom } from \"#/features/connect-mcp/model/access.ts\";\nimport { Button } from \"#/shared/ui/button.tsx\";\n\nconst LABEL = \"MCP\";\nconst HINT = \"Claude Code に追加するコマンドをコピー\";\nconst COPIED = \"コピーしました\";\nconst FAILED = \"コピーできませんでした\";\nconst SILENT = \"\";\n\nconst iconOf = (done: boolean): ReactNode => {\n if (done) {\n return <Check aria-hidden=\"true\" />;\n }\n return <Copy aria-hidden=\"true\" />;\n};\n\nconst statusOf = (done: boolean, failed: boolean): string => {\n if (done) {\n return COPIED;\n }\n if (failed) {\n return FAILED;\n }\n return SILENT;\n};\n\nexport const CopyMcpCommand = ({ name }: Readonly<{ name: string }>): ReactNode => {\n const [copied, copy] = useAtom(copyAtom);\n const click = useCallback(() => {\n copy(name);\n }, [copy, name]);\n return (\n <>\n <Button variant=\"outline\" title={HINT} onClick={click}>\n {iconOf(AsyncResult.isSuccess(copied))}\n {LABEL}\n </Button>\n <output className=\"sr-only\">\n {statusOf(AsyncResult.isSuccess(copied), AsyncResult.isFailure(copied))}\n </output>\n </>\n );\n};\n","import { Effect, Option } from \"effect\";\nimport { Atom, AtomRegistry } from \"effect/reactivity\";\n\nimport { openedAtom } from \"#/entities/media/index.ts\";\nimport { chooseFile, openFile, openLink } from \"#/shared/api/media-notes/index.ts\";\nimport type { Opened } from \"#/shared/api/media-notes/index.ts\";\nimport { runtime } from \"#/shared/lib/runtime.ts\";\n\n/** @internal */\nexport const linkAtom = Atom.make(\"\").pipe(Atom.keepAlive);\n\nconst shown = (\n opened: Option.Option<Opened>,\n): Effect.Effect<void, never, AtomRegistry.AtomRegistry> =>\n AtomRegistry.AtomRegistry.pipe(\n Effect.flatMap((registry) =>\n Effect.sync(() => {\n if (Option.isSome(opened)) {\n registry.set(openedAtom, opened);\n }\n }),\n ),\n );\n\n/** @internal */\nexport const openLinkAtom = runtime.fn((link: string) =>\n openLink(link).pipe(Effect.asSome, Effect.flatMap(shown)),\n);\n\n/** @internal */\nexport const openFileAtom = runtime.fn((path: string) =>\n openFile(path).pipe(Effect.asSome, Effect.flatMap(shown)),\n);\n\n/** @internal */\nexport const chooseFileAtom = runtime.fn(() => chooseFile.pipe(Effect.flatMap(shown)));\n","import { useAtomSet } from \"@effect/atom-react\";\nimport { getCurrentWebview } from \"@tauri-apps/api/webview\";\nimport { Array as Arr, Effect, Fiber, Option } from \"effect\";\nimport { constVoid } from \"effect/Function\";\nimport { useEffect } from \"react\";\n\nimport { openFileAtom } from \"#/features/open-media/model/open.ts\";\n\nconst listening = (open: (path: string) => void): Effect.Effect<never> =>\n Effect.acquireRelease(\n Effect.promise(() =>\n getCurrentWebview().onDragDropEvent(({ payload }) => {\n if (payload.type === \"drop\") {\n Option.map(Arr.head(payload.paths), open);\n }\n }),\n ),\n (stop) => Effect.sync(stop),\n ).pipe(Effect.andThen(Effect.never), Effect.scoped);\n\nexport const useFileDrop = (enabled: boolean): void => {\n const open = useAtomSet(openFileAtom);\n useEffect(() => {\n if (!enabled) {\n return constVoid;\n }\n const fiber = Effect.runFork(listening(open));\n return (): void => {\n fiber.pipe(Fiber.interrupt, Effect.runFork);\n };\n }, [enabled, open]);\n};\n","import { useAtom } from \"@effect/atom-react\";\nimport { FolderOpen } from \"lucide-react\";\nimport { useCallback } from \"react\";\nimport type { ReactNode } from \"react\";\n\nimport { chooseFileAtom } from \"#/features/open-media/model/open.ts\";\nimport { Button } from \"#/shared/ui/button.tsx\";\n\nconst CHOOSE = \"ファイルを開く\";\n\nexport const ChooseFile = (): ReactNode => {\n const [chosen, choose] = useAtom(chooseFileAtom);\n const click = useCallback(() => {\n choose();\n }, [choose]);\n return (\n <Button type=\"button\" variant=\"outline\" disabled={chosen.waiting} onClick={click}>\n <FolderOpen aria-hidden=\"true\" />\n {CHOOSE}\n </Button>\n );\n};\n","import { useAtomValue } from \"@effect/atom-react\";\nimport { Option } from \"effect\";\nimport { AsyncResult } from \"effect/reactivity\";\nimport type { ReactNode } from \"react\";\n\nimport { chooseFileAtom, openFileAtom, openLinkAtom } from \"#/features/open-media/model/open.ts\";\n\nexport const Refusal = ({ id }: Readonly<{ id: string }>): ReactNode => {\n const link = useAtomValue(openLinkAtom).pipe(AsyncResult.error);\n const file = useAtomValue(openFileAtom).pipe(AsyncResult.error);\n const chosen = useAtomValue(chooseFileAtom).pipe(AsyncResult.error);\n return Option.match(Option.firstSomeOf([link, file, chosen]), {\n onNone: () => false,\n onSome: ({ message }) => (\n <p id={id} role=\"alert\" className=\"text-destructive basis-full text-xs\">\n {message}\n </p>\n ),\n });\n};\n","import { useAtom } from \"@effect/atom-react\";\nimport { Option } from \"effect\";\nimport { AsyncResult } from \"effect/reactivity\";\nimport { LoaderCircle } from \"lucide-react\";\nimport { useCallback, useId } from \"react\";\nimport type { ChangeEvent, ReactNode, SubmitEvent } from \"react\";\n\nimport { linkAtom, openLinkAtom } from \"#/features/open-media/model/open.ts\";\nimport { useFileDrop } from \"#/features/open-media/model/use-file-drop.ts\";\nimport { ChooseFile } from \"#/features/open-media/ui/choose-file.tsx\";\nimport { Refusal } from \"#/features/open-media/ui/refusal.tsx\";\nimport { Button } from \"#/shared/ui/button.tsx\";\n\nconst OPEN = \"開く\";\n\nexport const OpenBar = ({\n files,\n label,\n}: Readonly<{ files: boolean; label: string }>): ReactNode => {\n const [link, setLink] = useAtom(linkAtom);\n const [opened, open] = useAtom(openLinkAtom);\n const refusalId = useId();\n const failed = AsyncResult.isFailure(opened);\n useFileDrop(files);\n const submit = useCallback(\n (event: SubmitEvent<HTMLFormElement>) => {\n event.preventDefault();\n open(link);\n },\n [open, link],\n );\n const change = useCallback(\n (event: ChangeEvent<HTMLInputElement>) => {\n setLink(event.currentTarget.value);\n },\n [setLink],\n );\n return (\n <form className=\"flex flex-wrap gap-2\" onSubmit={submit}>\n <input\n type=\"url\"\n value={link}\n aria-label={label}\n aria-invalid={failed}\n aria-describedby={Option.getOrUndefined(Option.liftPredicate(refusalId, () => failed))}\n placeholder=\"https://\"\n className=\"border-input bg-background focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:border-destructive h-9 min-w-0 flex-1 rounded-md border px-3 font-mono text-sm outline-none focus-visible:ring-3\"\n onChange={change}\n />\n <Button type=\"submit\" disabled={opened.waiting}>\n {opened.waiting && <LoaderCircle className=\"animate-spin\" />}\n {OPEN}\n </Button>\n {files && <ChooseFile />}\n <Refusal id={refusalId} />\n </form>\n );\n};\n","import { convertFileSrc } from \"@tauri-apps/api/core\";\nimport { Effect } from \"effect\";\nimport type { Scope } from \"effect\";\nimport { constVoid } from \"effect/Function\";\n\nimport type { Mount, Player } from \"#/shared/lib/player.ts\";\n\nconst START = 0;\n\nconst seconds = (value: number): number => {\n if (Number.isFinite(value)) {\n return value;\n }\n return START;\n};\n\nconst placed = ({ stage, opened }: Mount): Effect.Effect<HTMLVideoElement> =>\n Effect.sync(() => {\n const video = document.createElement(\"video\");\n video.src = convertFileSrc(opened.location);\n video.preload = \"auto\";\n video.playsInline = true;\n stage.replaceChildren(video);\n return video;\n });\n\nconst removed = ({ stage }: Mount): Effect.Effect<void> =>\n Effect.sync(() => {\n stage.replaceChildren();\n });\n\nexport const mountFile = (mount: Mount): Effect.Effect<Player, never, Scope.Scope> =>\n Effect.acquireRelease(placed(mount), () => removed(mount)).pipe(\n Effect.map((video) => ({\n time: () => ({ current: seconds(video.currentTime), duration: seconds(video.duration) }),\n seek: (to: number): void => {\n video.currentTime = to;\n },\n toggle: (): void => {\n if (video.paused) {\n Effect.tryPromise({ try: () => video.play(), catch: constVoid }).pipe(\n Effect.ignore,\n Effect.runFork,\n );\n return;\n }\n video.pause();\n },\n })),\n );\n","import { Effect, MutableRef } from \"effect\";\nimport type { Scope } from \"effect\";\nimport { createNiconicoEngine } from \"niconico-embed-player\";\n\nimport type { Mount, Player } from \"#/shared/lib/player.ts\";\n\nexport const mountNiconico = ({\n stage,\n opened,\n}: Mount): Effect.Effect<Player, never, Scope.Scope> => {\n const playing = MutableRef.make(false);\n const stopped = (): void => {\n MutableRef.set(playing, false);\n };\n const created = Effect.sync(() =>\n createNiconicoEngine(\n stage,\n { videoId: opened.media.source.id, title: \"niconico\" },\n {\n onPlaying: () => {\n MutableRef.set(playing, true);\n },\n onPaused: stopped,\n onEnded: stopped,\n },\n ),\n );\n return Effect.acquireRelease(created, (engine) =>\n Effect.sync(() => {\n engine.destroy();\n }),\n ).pipe(\n Effect.map((engine) => ({\n time: () => engine.time(),\n seek: (seconds: number): void => {\n engine.seek(seconds);\n },\n toggle: (): void => {\n if (MutableRef.get(playing)) {\n engine.pause();\n return;\n }\n engine.play();\n },\n })),\n );\n};\n","import type { Opened } from \"#/shared/api/media-notes/index.ts\";\n\nexport type Position = Readonly<{ current: number; duration: number }>;\n\nexport type Player = Readonly<{\n time: () => Position;\n seek: (seconds: number) => void;\n toggle: () => void;\n}>;\n\nexport type Mount = Readonly<{ stage: HTMLElement; opened: Opened }>;\n\nexport const STILL: Position = { current: 0, duration: 0 };\n","import { Effect, MutableRef, Option } from \"effect\";\nimport type { Scope } from \"effect\";\n\nimport { pageOf } from \"#/entities/media/index.ts\";\nimport type { Opened } from \"#/shared/api/media-notes/index.ts\";\nimport { STILL } from \"#/shared/lib/player.ts\";\nimport type { Mount, Player } from \"#/shared/lib/player.ts\";\n\ntype Progress = Readonly<{ currentPosition: number }>;\n\ntype Widget = Readonly<{\n bind: (event: string, listener: (progress: Progress) => void) => void;\n getDuration: (callback: (milliseconds: number) => void) => void;\n seekTo: (milliseconds: number) => void;\n toggle: () => void;\n}>;\n\ntype WidgetApi = Readonly<{\n Widget: ((element: HTMLElement) => Widget) &\n Readonly<{ Events: Readonly<{ READY: string; PLAY_PROGRESS: string }> }>;\n}>;\n\ndeclare global {\n const SC: WidgetApi;\n}\n\nconst MILLISECONDS = 1000;\n\nconst widgetUrl = ({ media, location }: Opened): string =>\n `https://w.soundcloud.com/player/?${new URLSearchParams({\n url: Option.getOrElse(pageOf(media.source), () => location),\n visual: \"true\",\n auto_play: \"false\",\n show_comments: \"false\",\n }).toString()}`;\n\nconst framed = ({ stage, opened }: Mount): Effect.Effect<HTMLIFrameElement> =>\n Effect.sync(() => {\n const iframe = document.createElement(\"iframe\");\n iframe.src = widgetUrl(opened);\n iframe.allow = \"autoplay\";\n iframe.title = \"SoundCloud\";\n stage.replaceChildren(iframe);\n return iframe;\n });\n\nconst cleared = ({ stage }: Mount): Effect.Effect<void> =>\n Effect.sync(() => {\n stage.replaceChildren();\n });\n\nconst ready = ({ frame }: Readonly<{ frame: HTMLElement }>): Effect.Effect<Player> =>\n Effect.callback((resume) => {\n const widget = SC.Widget(frame);\n const position = MutableRef.make(STILL);\n widget.bind(SC.Widget.Events.PLAY_PROGRESS, ({ currentPosition }) => {\n MutableRef.update(position, (now) => ({ ...now, current: currentPosition / MILLISECONDS }));\n });\n widget.bind(SC.Widget.Events.READY, () => {\n widget.getDuration((milliseconds) => {\n MutableRef.update(position, (now) => ({ ...now, duration: milliseconds / MILLISECONDS }));\n resume(\n Effect.succeed({\n time: () => MutableRef.get(position),\n seek: (seconds: number) => {\n widget.seekTo(seconds * MILLISECONDS);\n MutableRef.update(position, (now) => ({ ...now, current: seconds }));\n },\n toggle: () => {\n widget.toggle();\n },\n }),\n );\n });\n });\n });\n\nexport const mountSoundcloud = (mount: Mount): Effect.Effect<Player, never, Scope.Scope> =>\n Effect.acquireRelease(framed(mount), () => cleared(mount)).pipe(\n Effect.flatMap((frame) => ready({ frame })),\n );\n","import { Effect, Option, Predicate, pipe } from \"effect\";\nimport type { Scope } from \"effect\";\n\nimport type { Mount, Player } from \"#/shared/lib/player.ts\";\n\nconst LOADED = 1;\n\nconst isCallback = (value: unknown): value is () => void => Predicate.isFunction(value);\n\nconst apiReady = (): boolean =>\n \"YT\" in globalThis &&\n pipe(\n Option.liftPredicate(YT, Predicate.hasProperty(\"loaded\")),\n Option.exists(({ loaded }) => loaded === LOADED),\n );\n\nconst whenApiReady: Effect.Effect<void> = Effect.callback((resume) => {\n if (apiReady()) {\n resume(Effect.void);\n return;\n }\n const previous: unknown = pipe(\n Option.liftPredicate(globalThis, Predicate.hasProperty(\"onYouTubeIframeAPIReady\")),\n Option.map((found) => found.onYouTubeIframeAPIReady),\n Option.getOrUndefined,\n );\n Reflect.set(globalThis, \"onYouTubeIframeAPIReady\", () => {\n if (isCallback(previous)) {\n previous();\n }\n resume(Effect.void);\n });\n});\n\ntype Embedded = Readonly<{ player: Readonly<YT.Player>; host: HTMLElement }>;\n\nconst removed = ({ player, host }: Embedded): Effect.Effect<void> =>\n Effect.sync(() => {\n player.destroy();\n host.remove();\n });\n\nconst created = (mount: Mount): Effect.Effect<Embedded> =>\n Effect.callback((resume) => {\n const host = document.createElement(\"div\");\n mount.stage.replaceChildren(host);\n const player = new YT.Player(host, {\n videoId: mount.opened.media.source.id,\n width: \"100%\",\n height: \"100%\",\n events: {\n onReady: (): void => {\n resume(Effect.succeed({ player, host }));\n },\n },\n });\n return removed({ player, host });\n });\n\nconst owned = (mount: Mount): Effect.Effect<Embedded, never, Scope.Scope> =>\n Effect.acquireRelease(created(mount), removed);\n\nexport const mountYoutube = (mount: Mount): Effect.Effect<Player, never, Scope.Scope> =>\n whenApiReady.pipe(\n Effect.andThen(owned(mount)),\n Effect.map(({ player }) => ({\n time: () => ({ current: player.getCurrentTime(), duration: player.getDuration() }),\n seek: (seconds: number): void => {\n player.seekTo(seconds, true);\n },\n toggle: (): void => {\n if (player.getPlayerState() === YT.PlayerState.PLAYING) {\n player.pauseVideo();\n return;\n }\n player.playVideo();\n },\n })),\n );\n","import { Match } from \"effect\";\nimport type { Effect, Scope } from \"effect\";\n\nimport { mountFile } from \"#/features/play-media/lib/file.ts\";\nimport { mountNiconico } from \"#/features/play-media/lib/niconico.ts\";\nimport { mountSoundcloud } from \"#/features/play-media/lib/soundcloud.ts\";\nimport { mountYoutube } from \"#/features/play-media/lib/youtube.ts\";\nimport type { Mount, Player } from \"#/shared/lib/player.ts\";\n\nexport const mountPlayer = (mount: Mount): Effect.Effect<Player, never, Scope.Scope> =>\n Match.value(mount.opened.media.source.site).pipe(\n Match.when(\"youtube\", () => mountYoutube(mount)),\n Match.when(\"niconico\", () => mountNiconico(mount)),\n Match.when(\"soundcloud\", () => mountSoundcloud(mount)),\n Match.when(\"file\", () => mountFile(mount)),\n Match.exhaustive,\n );\n","import { useAtomValue } from \"@effect/atom-react\";\nimport { Effect, Option, Schedule, Stream, pipe } from \"effect\";\nimport { AsyncResult, Atom } from \"effect/reactivity\";\n\nimport { openedAtom } from \"#/entities/media/index.ts\";\nimport { mountPlayer } from \"#/features/play-media/lib/mount.ts\";\nimport { STILL } from \"#/shared/lib/player.ts\";\nimport type { Player, Position } from \"#/shared/lib/player.ts\";\n\nconst TICK = \"200 millis\";\n\n/** @internal */\nexport const stageAtom = Atom.make(Option.none<HTMLElement>());\n\n/** @internal */\nexport const playerAtom = Atom.make(\n Effect.fnUntraced(function* player(get) {\n const stage = yield* Effect.fromOption(get(stageAtom));\n const opened = yield* Effect.fromOption(get(openedAtom));\n return yield* mountPlayer({ stage, opened });\n }),\n);\n\nconst positionAtom = Atom.make((get) =>\n pipe(\n get.result(playerAtom),\n Effect.map((player) =>\n Stream.fromEffectSchedule(\n Effect.sync(() => player.time()),\n Schedule.spaced(TICK),\n ),\n ),\n Stream.unwrap,\n ),\n);\n\nexport const usePlayer = (): Option.Option<Player> =>\n useAtomValue(playerAtom).pipe(AsyncResult.value);\n\nexport const usePosition = (): Position =>\n AsyncResult.getOrElse(useAtomValue(positionAtom), () => STILL);\n","import { Array as Arr, pipe } from \"effect\";\n\nconst FIELD = \"input, textarea, select, button, [contenteditable]\";\n\nconst MODIFIERS = [\"ctrlKey\", \"metaKey\", \"altKey\", \"isComposing\"] as const;\n\nconst inField = ({ target }: KeyboardEvent): boolean =>\n target instanceof Element && target.closest(FIELD) !== null;\n\nexport const ignoredKey = (event: KeyboardEvent): boolean =>\n pipe(\n MODIFIERS,\n Arr.some((key) => event[key]),\n ) || inField(event);\n","import { Option } from \"effect\";\nimport { useEffect } from \"react\";\n\nimport { ignoredKey } from \"#/shared/lib/keys.ts\";\nimport type { Player } from \"#/shared/lib/player.ts\";\n\nconst KEY = \" \";\n\nexport const usePlayKey = (player: Option.Option<Player>): void => {\n useEffect(() => {\n const onKey = (event: KeyboardEvent): void => {\n if (event.key !== KEY || ignoredKey(event) || Option.isNone(player)) {\n return;\n }\n event.preventDefault();\n player.value.toggle();\n };\n globalThis.addEventListener(\"keydown\", onKey);\n return (): void => {\n globalThis.removeEventListener(\"keydown\", onKey);\n };\n }, [player]);\n};\n","import { Array as Arr, pipe } from \"effect\";\nimport type { ReactNode } from \"react\";\n\nexport type Hint = Readonly<{ key: string; meaning: string }>;\n\nconst HINTS: readonly Hint[] = [\n { key: \"M\", meaning: \"始点・終点\" },\n { key: \"Space\", meaning: \"再生・一時停止\" },\n];\n\nexport const KeyHints = ({ hints }: Readonly<{ hints: readonly Hint[] }>): ReactNode => (\n <p className=\"text-muted-foreground flex flex-wrap items-center gap-x-4 gap-y-1 text-xs\">\n {pipe(\n [...HINTS, ...hints],\n Arr.map(({ key, meaning }) => (\n <span key={key} className=\"flex items-center gap-2\">\n <kbd className=\"border-input rounded border px-1.5 font-mono\">{key}</kbd>\n {meaning}\n </span>\n )),\n )}\n </p>\n);\n","import { useAtomSet, useAtomValue } from \"@effect/atom-react\";\nimport { Option } from \"effect\";\nimport { useCallback } from \"react\";\nimport type { ReactNode } from \"react\";\n\nimport { keyOf, openedAtom } from \"#/entities/media/index.ts\";\nimport { stageAtom, usePlayer } from \"#/features/play-media/model/player.ts\";\n\nconst FRAME =\n \"size-full [&>iframe]:size-full [&>iframe]:border-0 [&>video]:size-full [&>video]:object-contain\";\n\nconst Stage = (): ReactNode => {\n const setStage = useAtomSet(stageAtom);\n usePlayer();\n const attach = useCallback(\n (stage: HTMLElement | null): (() => void) => {\n setStage(Option.fromNullishOr(stage));\n return () => {\n setStage(Option.none());\n };\n },\n [setStage],\n );\n return (\n <div className=\"size-full\">\n <div ref={attach} className={FRAME} />\n </div>\n );\n};\n\nexport const MediaPlayer = (): ReactNode =>\n Option.match(useAtomValue(openedAtom), {\n onNone: () => false,\n onSome: ({ media, location }) => (\n <div className=\"aspect-video w-full overflow-hidden rounded-md bg-black\">\n <Stage key={`${keyOf(media.source)}:${location}`} />\n </div>\n ),\n });\n","import { Option } from \"effect\";\nimport { Atom } from \"effect/reactivity\";\n\nimport { openedAtom } from \"#/entities/media/index.ts\";\n\nexport type Range = Readonly<{ from: number; to: number }>;\n\nexport type Tone = \"plain\" | \"warn\" | \"faint\" | \"guess\" | \"guess-warn\";\n\nexport type Span = Readonly<{ key: string; from: number; to: number; tone: Tone }>;\n\n/** @internal */\nexport const perMedia = <Value>(initial: Value): Atom.Writable<Value> =>\n Atom.writable(\n (get) => {\n get(openedAtom);\n return initial;\n },\n (context, value: Value) => {\n context.setSelf(value);\n },\n ).pipe(Atom.keepAlive);\n\n/** @internal */\nexport const rangeAtom = perMedia(Option.none<Range>());\n\n/** @internal */\nexport const anchorAtom = perMedia(Option.none<number>());\n\nexport const spanOf = ([one, other]: readonly [number, number]): Range => ({\n from: Math.min(one, other),\n to: Math.max(one, other),\n});\n","import { useAtomValue } from \"@effect/atom-react\";\nimport { Option } from \"effect\";\nimport type { ReactNode } from \"react\";\n\nimport { rangeAtom } from \"#/features/select-range/model/range.ts\";\nimport { preciseClock } from \"#/shared/lib/clock.ts\";\n\nconst DIGITS = 1;\nconst EMPTY = \"–\";\n\nexport const RangeReadout = (): ReactNode =>\n Option.match(useAtomValue(rangeAtom), {\n onNone: () => <p className=\"text-muted-foreground font-mono text-sm tabular-nums\">{EMPTY}</p>,\n onSome: ({ from, to }) => (\n <p className=\"flex items-baseline justify-between font-mono text-sm tabular-nums\">\n <span>{`${preciseClock(from)}–${preciseClock(to)}`}</span>\n <span className=\"text-muted-foreground text-xs\">{`${(to - from).toFixed(DIGITS)} 秒`}</span>\n </p>\n ),\n });\n","import { Array as Arr, pipe } from \"effect\";\nimport type { ReactNode } from \"react\";\n\nimport { clock } from \"#/shared/lib/clock.ts\";\n\nconst WHOLE = 100;\nconst SHORT_SONG = 600;\nconst SHORT_STEP = 30;\nconst LONG_STEP = 60;\nconst FIRST = 0;\n\nconst stepFor = (duration: number): number => {\n if (duration <= SHORT_SONG) {\n return SHORT_STEP;\n }\n return LONG_STEP;\n};\n\nexport const Ruler = ({ duration }: Readonly<{ duration: number }>): ReactNode => {\n if (duration <= FIRST) {\n return false;\n }\n const step = stepFor(duration);\n const ticks = pipe(\n Arr.range(FIRST, Math.floor(duration / step)),\n Arr.map((index) => index * step),\n );\n return (\n <svg className=\"h-4 w-full overflow-visible\" aria-hidden>\n {pipe(\n ticks,\n Arr.map((seconds) => (\n <text\n key={seconds}\n x={`${(seconds / duration) * WHOLE}%`}\n y=\"75%\"\n className=\"fill-muted-foreground font-mono text-xs tabular-nums\"\n >\n {clock(seconds)}\n </text>\n )),\n )}\n </svg>\n );\n};\n","export const MARK_LANE = { y: \"0%\", height: \"22%\" };\nexport const PLAY_LANE = { y: \"30%\", height: \"70%\" };\nexport const WHOLE_LANE = { y: \"0%\", height: \"100%\" };\nexport const HEAD = 0.25;\n","import type { ReactNode } from \"react\";\n\nconst WHOLE = 100;\nconst NONE = 0;\nconst FULL = 1;\n\nconst percent = (seconds: number, duration: number): number => {\n if (duration <= NONE) {\n return NONE;\n }\n return Math.min(Math.max(seconds / duration, NONE), FULL) * WHOLE;\n};\n\nexport const SpanRect = ({\n from,\n to,\n duration,\n lane,\n className,\n}: Readonly<{\n from: number;\n to: number;\n duration: number;\n lane: Readonly<{ y: string; height: string }>;\n className: string;\n}>): ReactNode => (\n <rect\n x={`${percent(from, duration)}%`}\n width={`${Math.max(percent(to, duration) - percent(from, duration), NONE)}%`}\n y={lane.y}\n height={lane.height}\n className={className}\n />\n);\n","import { useAtomValue } from \"@effect/atom-react\";\nimport { Option } from \"effect\";\nimport type { ReactNode } from \"react\";\n\nimport { rangeAtom } from \"#/features/select-range/model/range.ts\";\nimport { HEAD, WHOLE_LANE } from \"#/features/select-range/ui/lanes.ts\";\nimport { SpanRect } from \"#/features/select-range/ui/span-rect.tsx\";\n\nexport const RangeLayer = ({ duration }: Readonly<{ duration: number }>): ReactNode =>\n Option.match(useAtomValue(rangeAtom), {\n onNone: () => false,\n onSome: ({ from, to }) => (\n <SpanRect\n from={from}\n to={Math.max(to, from + HEAD)}\n duration={duration}\n lane={WHOLE_LANE}\n className=\"fill-primary/15 stroke-primary\"\n />\n ),\n });\n","import { Array as Arr, pipe } from \"effect\";\nimport type { ReactNode } from \"react\";\n\nimport type { Span, Tone } from \"#/features/select-range/model/range.ts\";\nimport { MARK_LANE, PLAY_LANE } from \"#/features/select-range/ui/lanes.ts\";\nimport { SpanRect } from \"#/features/select-range/ui/span-rect.tsx\";\n\ntype Lane = Readonly<{ y: string; height: string }>;\n\nconst GUESS = \"fill-none [stroke-dasharray:4_3] stroke-[1.5]\";\n\nconst LOOK: Readonly<Record<Tone, Readonly<{ lane: Lane; className: string }>>> = {\n plain: { lane: MARK_LANE, className: \"fill-foreground/70\" },\n warn: { lane: MARK_LANE, className: \"fill-destructive/70\" },\n faint: { lane: MARK_LANE, className: \"fill-muted-foreground/30\" },\n guess: { lane: PLAY_LANE, className: `${GUESS} stroke-foreground` },\n \"guess-warn\": { lane: PLAY_LANE, className: `${GUESS} stroke-destructive` },\n};\n\nexport const SpansLayer = ({\n spans,\n duration,\n}: Readonly<{ spans: readonly Span[]; duration: number }>): ReactNode =>\n pipe(\n spans,\n Arr.map((span) => (\n <SpanRect\n key={span.key}\n from={span.from}\n to={span.to}\n duration={duration}\n lane={LOOK[span.tone].lane}\n className={LOOK[span.tone].className}\n />\n )),\n );\n","import type { ReactNode } from \"react\";\n\nimport type { Span } from \"#/features/select-range/model/range.ts\";\nimport { HEAD, PLAY_LANE, WHOLE_LANE } from \"#/features/select-range/ui/lanes.ts\";\nimport { RangeLayer } from \"#/features/select-range/ui/range-layer.tsx\";\nimport { SpanRect } from \"#/features/select-range/ui/span-rect.tsx\";\nimport { SpansLayer } from \"#/features/select-range/ui/spans-layer.tsx\";\nimport type { Position } from \"#/shared/lib/player.ts\";\n\nconst START = 0;\n\nexport const Track = ({\n position,\n spans,\n}: Readonly<{ position: Position; spans: readonly Span[] }>): ReactNode => (\n <svg className=\"size-full overflow-visible\" aria-hidden>\n <SpanRect\n from={START}\n to={position.duration}\n duration={position.duration}\n lane={PLAY_LANE}\n className=\"fill-muted\"\n />\n <SpansLayer spans={spans} duration={position.duration} />\n <RangeLayer duration={position.duration} />\n <SpanRect\n from={position.current}\n to={position.current + HEAD}\n duration={position.duration}\n lane={WHOLE_LANE}\n className=\"fill-foreground\"\n />\n </svg>\n);\n","import { useAtomSet } from \"@effect/atom-react\";\nimport { MutableRef, Option, Record as Rec, pipe } from \"effect\";\nimport { constVoid } from \"effect/Function\";\nimport { useCallback, useMemo } from \"react\";\n\nimport { rangeAtom, spanOf } from \"#/features/select-range/model/range.ts\";\nimport type { Range } from \"#/features/select-range/model/range.ts\";\n\nconst DRAG_PIXELS = 4;\nconst NONE = 0;\nconst FULL = 1;\n\ntype Press = Readonly<{ seconds: number; x: number; dragged: boolean }>;\n\ntype Scrubbing = Readonly<{\n element: HTMLDivElement;\n duration: number;\n seek: (seconds: number) => void;\n select: (range: Range) => void;\n pressed: () => Option.Option<Press>;\n press: (next: Option.Option<Press>) => void;\n}>;\n\nconst secondsAt = ({ element, duration }: Scrubbing, x: number): number => {\n const { left, width } = element.getBoundingClientRect();\n return Math.min(Math.max((x - left) / Math.max(width, FULL), NONE), FULL) * duration;\n};\n\nconst down = (scrubbing: Scrubbing, event: PointerEvent): void => {\n scrubbing.element.setPointerCapture(event.pointerId);\n scrubbing.press(\n Option.some({\n seconds: secondsAt(scrubbing, event.clientX),\n x: event.clientX,\n dragged: false,\n }),\n );\n};\n\nconst move = (scrubbing: Scrubbing, event: PointerEvent): void => {\n const press = scrubbing.pressed();\n if (Option.isNone(press)) {\n return;\n }\n const { seconds, x, dragged } = press.value;\n if (dragged || Math.abs(event.clientX - x) >= DRAG_PIXELS) {\n scrubbing.press(Option.some({ seconds, x, dragged: true }));\n scrubbing.select(spanOf([seconds, secondsAt(scrubbing, event.clientX)]));\n }\n};\n\nconst up = (scrubbing: Scrubbing, event: PointerEvent): void => {\n const press = scrubbing.pressed();\n if (Option.isSome(press) && !press.value.dragged) {\n scrubbing.seek(secondsAt(scrubbing, event.clientX));\n }\n scrubbing.press(Option.none());\n};\n\nconst POINTER_HANDLERS = {\n pointerdown: down,\n pointermove: move,\n pointerup: up,\n} as const;\n\nconst listen = (scrubbing: Scrubbing): (() => void) => {\n const bound = pipe(\n POINTER_HANDLERS,\n Rec.map((handle) => (event: PointerEvent): void => {\n handle(scrubbing, event);\n }),\n );\n const entries = Rec.toEntries(bound);\n for (const [type, listener] of entries) {\n scrubbing.element.addEventListener(type, listener);\n }\n return (): void => {\n for (const [type, listener] of entries) {\n scrubbing.element.removeEventListener(type, listener);\n }\n };\n};\n\nexport const useScrub = ({\n duration,\n seek,\n}: Readonly<{ duration: number; seek: (seconds: number) => void }>): ((\n element: HTMLDivElement | null,\n) => () => void) => {\n const setRange = useAtomSet(rangeAtom);\n const press = useMemo(() => MutableRef.make(Option.none<Press>()), []);\n return useCallback(\n (element: HTMLDivElement | null): (() => void) =>\n Option.match(Option.fromNullishOr(element), {\n onNone: () => constVoid,\n onSome: (found) =>\n listen({\n element: found,\n duration,\n seek,\n pressed: () => MutableRef.get(press),\n press: (next) => {\n MutableRef.set(press, next);\n },\n select: (range) => {\n setRange(Option.some(range));\n },\n }),\n }),\n [duration, seek, setRange, press],\n );\n};\n","import type { ReactNode } from \"react\";\n\nimport type { Span } from \"#/features/select-range/model/range.ts\";\nimport { Ruler } from \"#/features/select-range/ui/ruler.tsx\";\nimport { Track } from \"#/features/select-range/ui/track.tsx\";\nimport { useScrub } from \"#/features/select-range/ui/use-scrub.ts\";\nimport type { Position } from \"#/shared/lib/player.ts\";\n\nexport const Timeline = ({\n position,\n spans,\n seek,\n}: Readonly<{\n position: Position;\n spans: readonly Span[];\n seek: (seconds: number) => void;\n}>): ReactNode => {\n const attach = useScrub({ duration: position.duration, seek });\n return (\n <div className=\"grid gap-1\">\n <div ref={attach} className=\"h-16 cursor-crosshair touch-pan-y select-none\">\n <Track position={position} spans={spans} />\n </div>\n <Ruler duration={position.duration} />\n </div>\n );\n};\n","import { useAtomSet, useAtomValue } from \"@effect/atom-react\";\nimport { Option, String as Str } from \"effect\";\nimport { useEffect } from \"react\";\n\nimport { anchorAtom, rangeAtom, spanOf } from \"#/features/select-range/model/range.ts\";\nimport { ignoredKey } from \"#/shared/lib/keys.ts\";\nimport type { Player } from \"#/shared/lib/player.ts\";\n\nconst KEY = \"m\";\n\nexport const useRangeKey = (player: Option.Option<Player>): void => {\n const anchor = useAtomValue(anchorAtom);\n const setAnchor = useAtomSet(anchorAtom);\n const setRange = useAtomSet(rangeAtom);\n useEffect(() => {\n const mark = (now: number): void => {\n Option.match(anchor, {\n onNone: () => {\n setAnchor(Option.some(now));\n setRange(Option.some({ from: now, to: now }));\n },\n onSome: (start) => {\n setAnchor(Option.none());\n setRange(Option.some(spanOf([start, now])));\n },\n });\n };\n const onKey = (event: KeyboardEvent): void => {\n if (Str.toLowerCase(event.key) !== KEY || ignoredKey(event)) {\n return;\n }\n if (Option.isSome(player)) {\n mark(player.value.time().current);\n }\n };\n globalThis.addEventListener(\"keydown\", onKey);\n return (): void => {\n globalThis.removeEventListener(\"keydown\", onKey);\n };\n }, [player, anchor, setAnchor, setRange]);\n};\n","import { Option } from \"effect\";\nimport { useCallback } from \"react\";\nimport type { ReactNode } from \"react\";\n\nimport { MediaMeta } from \"#/entities/media/index.ts\";\nimport {\n KeyHints,\n MediaPlayer,\n usePlayKey,\n usePlayer,\n usePosition,\n} from \"#/features/play-media/index.ts\";\nimport type { Hint } from \"#/features/play-media/index.ts\";\nimport { Timeline, useRangeKey } from \"#/features/select-range/index.ts\";\nimport type { Span } from \"#/features/select-range/index.ts\";\nimport type { Media } from \"#/shared/api/media-notes/index.ts\";\n\nexport const MediaStage = ({\n media,\n spans,\n hints,\n}: Readonly<{ media: Media; spans: readonly Span[]; hints: readonly Hint[] }>): ReactNode => {\n const player = usePlayer();\n const position = usePosition();\n useRangeKey(player);\n usePlayKey(player);\n const seek = useCallback(\n (seconds: number) => {\n if (Option.isSome(player)) {\n player.value.seek(seconds);\n }\n },\n [player],\n );\n return (\n <section className=\"grid content-start gap-3 lg:col-span-2\">\n <MediaMeta media={media} duration={position.duration} />\n <MediaPlayer />\n <Timeline position={position} spans={spans} seek={seek} />\n <KeyHints hints={hints} />\n </section>\n );\n};\n","import { useAtomSet } from \"@effect/atom-react\";\nimport { Option } from \"effect\";\nimport { useCallback } from \"react\";\n\nimport { usePlayer } from \"#/features/play-media/index.ts\";\nimport { rangeAtom } from \"#/features/select-range/index.ts\";\nimport type { Range } from \"#/features/select-range/index.ts\";\n\nexport const useJump = (): ((range: Range) => void) => {\n const player = usePlayer();\n const setRange = useAtomSet(rangeAtom);\n return useCallback(\n ({ from, to }: Range) => {\n setRange(Option.some({ from, to }));\n if (Option.isSome(player)) {\n player.value.seek(from);\n }\n },\n [player, setRange],\n );\n};\n","import { Effect, Option } from \"effect\";\nimport type { Cause } from \"effect\";\nimport { AtomRegistry } from \"effect/reactivity\";\n\nimport { openedAtom } from \"#/entities/media/index.ts\";\nimport { anchorAtom, rangeAtom } from \"#/features/select-range/index.ts\";\nimport type { Range } from \"#/features/select-range/index.ts\";\nimport type { Opened } from \"#/shared/api/media-notes/index.ts\";\n\nexport type Post<Failure> = (opened: Opened, range: Range) => Effect.Effect<void, Failure>;\n\n/** @internal */\nexport const savedRange = <Failure>(\n post: Post<Failure>,\n): Effect.Effect<\n AtomRegistry.AtomRegistry,\n Failure | Cause.NoSuchElementError,\n AtomRegistry.AtomRegistry\n> =>\n Effect.gen(function* saving() {\n const registry = yield* AtomRegistry.AtomRegistry;\n const opened = yield* Effect.fromOption(registry.get(openedAtom));\n const range = yield* Effect.fromOption(registry.get(rangeAtom));\n yield* post(opened, range);\n registry.set(rangeAtom, Option.none());\n registry.set(anchorAtom, Option.none());\n return registry;\n });\n","import { useAtom } from \"@effect/atom-react\";\nimport type { Atom } from \"effect/reactivity\";\nimport { useCallback } from \"react\";\nimport type { SubmitEvent } from \"react\";\n\n/** @internal */\nexport const useSubmit = <Failure>(\n save: Readonly<Atom.AtomResultFn<void, void, Failure>>,\n): Readonly<{ waiting: boolean; submit: (event: SubmitEvent<HTMLFormElement>) => void }> => {\n const [saved, run] = useAtom(save);\n const submit = useCallback(\n (event: SubmitEvent<HTMLFormElement>) => {\n event.preventDefault();\n run();\n },\n [run],\n );\n return { waiting: saved.waiting, submit };\n};\n","import { listen } from \"@tauri-apps/api/event\";\nimport { Effect, Fiber } from \"effect\";\nimport { useEffect } from \"react\";\n\nexport type Following = Readonly<{ event: string; refresh: () => void }>;\n\nconst following = ({ event, refresh }: Following): Effect.Effect<never> =>\n Effect.acquireRelease(\n Effect.promise(() => listen(event, refresh)),\n (stop) => Effect.sync(stop),\n ).pipe(Effect.andThen(Effect.never), Effect.scoped);\n\nexport const useFollowing = ({ event, refresh }: Following): void => {\n useEffect(() => {\n const fiber = Effect.runFork(following({ event, refresh }));\n return (): void => {\n fiber.pipe(Fiber.interrupt, Effect.runFork);\n };\n }, [event, refresh]);\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAMA,MAAa,aAAa,KAAK,KAAK,OAAO,KAAa,CAAC,CAAC,CAAC,KAAK,KAAK,SAAS;AAE9E,MAAa,SAAS,EAAE,MAAM,SAAyB,GAAG,KAAK,GAAG;AAElE,MAAa,UAAU,EAAE,MAAM,SAC7B,MAAM,MAAM,IAAI,CAAC,CAAC,KAChB,MAAM,KAAK,iBAAiB,OAAO,KAAK,mCAAmC,IAAI,CAAC,GAChF,MAAM,KAAK,kBAAkB,OAAO,KAAK,kCAAkC,IAAI,CAAC,GAChF,MAAM,KAAK,oBAAoB,OAAO,KAAK,0BAA0B,IAAI,CAAC,GAC1E,MAAM,KAAK,cAAc,OAAO,KAAK,CAAC,GACtC,MAAM,UACR;;ACfF,MAAa,aAA6C;CACxD,SAAS;CACT,UAAU;CACV,YAAY;CACZ,MAAM;AACR;;ACLA,MAAM,qBAAqB;AAC3B,MAAMA,UAAQ;AACd,MAAM,eAAe;AACrB,MAAM,SAAS;AACf,M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OAAO,aACJ,EAAE,MAAM,SAAgB;EACvB,SAAS,OAAO,KAAK;GAAE;GAAM;EAAG,CAAC,CAAC;EAClC,IAAI,OAAO,OAAO,MAAM,GACtB,OAAO,MAAM,KAAK,IAAI;CAE1B,GACA,CAAC,QAAQ,QAAQ,CACnB;AACF;;;ACRA,MAAa,cACX,SAMA,OAAO,IAAI,UAAU,SAAS;CAC5B,MAAM,WAAW,OAAO,aAAa;CAGrC,OAAO,KAAK,OAFU,OAAO,WAAW,SAAS,IAAI,UAAU,CAAC,GAE5C,OADC,OAAO,WAAW,SAAS,IAAI,SAAS,CAAC,CACrC;CACzB,SAAS,IAAI,WAAW,OAAO,KAAK,CAAC;CACrC,SAAS,IAAI,YAAY,OAAO,KAAK,CAAC;CACtC,OAAO;AACT,CAAC;;;ACrBH,MAAa,aACX,SAC0F;CAC1F,MAAM,CAAC,OAAO,OAAO,QAAQ,IAAI;CACjC,MAAM,SAAS,aACZ,UAAwC;EACvC,MAAM,eAAe;EACrB,IAAI;CACN,GACA,CAAC,GAAG,CACN;CACA,OAAO;EAAE,SAAS,MAAM;EAAS;CAAO;AAC1C;;ACZA,MAAM,aAAa,EAAE,OAAO,cAC1B,OAAO,eACL,OAAO,cAAcC,SAAO,OAAO,OAAO,CAAC,IAC1C,SAAS,OAAO,KAAK,IAAI,CAC5B,CAAC,CAAC,KAAK,OAAO,QAAQ,OAAO,KAAK,GAAG,OAAO,MAAM;AAEpD,MAAa,gBAAgB,EAAE,OAAO,cAA+B;CACnE,gBAAgB;EACd,MAAM,QAAQ,OAAO,QAAQ,UAAU;GAAE;GAAO;EAAQ,CAAC,CAAC;EAC1D,aAAmB;GACjB,MAAM,KAAK,MAAM,WAAW,OAAO,OAAO;EAC5C;CACF,GAAG,CAAC,OAAO,OAAO,CAAC;AACrB"}
|
|
1
|
+
{"version":3,"file":"media-notes.mjs","names":["START","Str","Arr","START","removed","Arr","KEY","Arr","WHOLE","Arr","NONE","FULL","Num","Arr","Num","Rec","Str","listen"],"sources":["../../src/entities/media/model/media.ts","../../src/shared/config/sites.ts","../../src/shared/lib/clock.ts","../../src/entities/media/ui/media-meta.tsx","../../src/shared/api/media-notes/media.ts","../../src/shared/api/media-notes/settled.ts","../../src/shared/lib/runtime.ts","../../src/features/connect-mcp/model/access.ts","../../src/features/connect-mcp/ui/copy-mcp-command.tsx","../../src/features/open-media/model/open.ts","../../src/features/open-media/model/use-file-drop.ts","../../src/features/open-media/ui/choose-file.tsx","../../src/features/open-media/ui/refusal.tsx","../../src/features/open-media/ui/open-bar.tsx","../../src/features/play-media/lib/file.ts","../../src/features/play-media/lib/niconico.ts","../../src/shared/lib/player.ts","../../src/features/play-media/lib/soundcloud.ts","../../src/features/play-media/lib/youtube.ts","../../src/features/play-media/lib/mount.ts","../../src/features/play-media/model/player.ts","../../src/shared/lib/keys.ts","../../src/features/play-media/model/use-play-key.ts","../../src/features/play-media/ui/key-hints.tsx","../../src/features/play-media/ui/media-player.tsx","../../src/features/select-range/model/range.ts","../../src/features/select-range/ui/range-readout.tsx","../../src/features/select-range/ui/ruler.tsx","../../src/features/select-range/ui/lanes.ts","../../src/features/select-range/ui/span-rect.tsx","../../src/features/select-range/ui/range-layer.tsx","../../src/features/select-range/ui/spans-layer.tsx","../../src/features/select-range/ui/track.tsx","../../src/features/select-range/ui/use-scrub.ts","../../src/features/select-range/ui/timeline.tsx","../../src/features/select-range/ui/use-range-key.ts","../../src/widgets/media-stage/ui/media-stage.tsx","../../src/widgets/media-stage/model/use-jump.ts","../../src/app/desktop-media-notes-model-save-range.ts","../../src/shared/lib/use-submit.ts","../../src/shared/lib/use-following.ts"],"sourcesContent":["import { Match, Option } from \"effect\";\nimport { Atom } from \"effect/reactivity\";\n\nimport type { Opened, Source } from \"#/shared/api/media-notes/index.ts\";\n\n/** @internal */\nexport const openedAtom = Atom.make(Option.none<Opened>()).pipe(Atom.keepAlive);\n\nexport const keyOf = ({ site, id }: Source): string => `${site}:${id}`;\n\nexport const pageOf = ({ site, id }: Source): Option.Option<string> =>\n Match.value(site).pipe(\n Match.when(\"youtube\", () => Option.some(`https://www.youtube.com/watch?v=${id}`)),\n Match.when(\"niconico\", () => Option.some(`https://www.nicovideo.jp/watch/${id}`)),\n Match.when(\"soundcloud\", () => Option.some(`https://soundcloud.com/${id}`)),\n Match.when(\"file\", () => Option.none()),\n Match.exhaustive,\n );\n","import type { Site } from \"#/shared/api/media-notes/index.ts\";\n\nexport const SITE_NAMES: Readonly<Record<Site, string>> = {\n youtube: \"YouTube\",\n niconico: \"ニコニコ\",\n soundcloud: \"SoundCloud\",\n file: \"ファイル\",\n};\n","import { String as Str } from \"effect\";\n\nconst SECONDS_PER_MINUTE = 60;\nconst START = 0;\nconst CLOCK_DIGITS = 2;\nconst TENTHS = 10;\nconst TENTH_DIGITS = 1;\n\nconst whole = (seconds: number): number => Math.max(Math.floor(seconds), START);\n\nexport const clock = (seconds: number): string => {\n const total = whole(seconds);\n const minutes = Math.floor(total / SECONDS_PER_MINUTE);\n return `${minutes}:${Str.padStart(CLOCK_DIGITS, \"0\")(String(total % SECONDS_PER_MINUTE))}`;\n};\n\nexport const preciseClock = (seconds: number): string => {\n const tenths = Math.floor(Math.max(seconds, START) * TENTHS) % TENTHS;\n return `${clock(seconds)}.${Str.padStart(TENTH_DIGITS, \"0\")(String(tenths))}`;\n};\n","import { Option } from \"effect\";\nimport { ExternalLink } from \"lucide-react\";\nimport type { ReactNode } from \"react\";\n\nimport { pageOf } from \"#/entities/media/model/media.ts\";\nimport type { Media } from \"#/shared/api/media-notes/index.ts\";\nimport { SITE_NAMES } from \"#/shared/config/index.ts\";\nimport { clock } from \"#/shared/lib/clock.ts\";\n\nconst PageLink = ({ media }: Readonly<{ media: Media }>): ReactNode =>\n Option.match(pageOf(media.source), {\n onNone: () => false,\n onSome: (page) => (\n <a\n href={page}\n target=\"_blank\"\n rel=\"noreferrer\"\n aria-label=\"元のページ\"\n className=\"text-muted-foreground hover:text-foreground self-center\"\n >\n <ExternalLink className=\"size-4\" />\n </a>\n ),\n });\n\nexport const MediaMeta = ({\n media,\n duration,\n}: Readonly<{ media: Media; duration: number }>): ReactNode => (\n <header className=\"flex min-w-0 items-baseline gap-3\">\n <span className=\"text-muted-foreground text-xs\">{SITE_NAMES[media.source.site]}</span>\n <h1 className=\"min-w-0 truncate text-base font-semibold\">{media.title}</h1>\n <span className=\"text-muted-foreground truncate text-sm\">{media.artist}</span>\n <span className=\"text-muted-foreground ml-auto font-mono text-xs tabular-nums\">\n {clock(duration)}\n </span>\n <PageLink media={media} />\n </header>\n);\n","import { invoke } from \"@tauri-apps/api/core\";\nimport { Effect, Option, Schema } from \"effect\";\n\nimport { McpAccessSchema, OpenedSchema } from \"#/shared/api/media-notes/media-protocol.ts\";\nimport type { McpAccess, Opened } from \"#/shared/api/media-notes/media-protocol.ts\";\n\nconst taggedError = Schema.TaggedError;\n\nexport class ApiFailed extends taggedError<ApiFailed, { readonly brand: unique symbol }>()(\n \"ApiFailed\",\n { message: Schema.String },\n) {}\n\nconst RefusalSchema = Schema.Struct({ message: Schema.String });\n\nconst failed = (cause: unknown): ApiFailed =>\n ApiFailed.make({\n message: Option.match(Schema.decodeUnknownOption(RefusalSchema)(cause), {\n onNone: () => String(cause),\n onSome: ({ message }) => message,\n }),\n });\n\ntype Decode<Value> = (input: unknown) => Effect.Effect<Value, Schema.SchemaError>;\n\nconst called = <Value>(\n decode: Decode<Value>,\n command: string,\n input: Readonly<Record<string, unknown>>,\n): Effect.Effect<Value, ApiFailed> =>\n Effect.tryPromise({ try: () => invoke<unknown>(command, input), catch: failed }).pipe(\n Effect.flatMap(decode),\n Effect.catchTag(\"SchemaError\", (cause) => cause.pipe(failed, Effect.fail)),\n );\n\nconst decodeOpened = Schema.decodeUnknownEffect(OpenedSchema);\n\nconst decodeChosen = Schema.decodeUnknownEffect(Schema.NullOr(OpenedSchema));\n\nconst decodeAccess = Schema.decodeUnknownEffect(McpAccessSchema);\n\nexport const openLink = (link: string): Effect.Effect<Opened, ApiFailed> =>\n called(decodeOpened, \"open_link\", { link });\n\nexport const openFile = (path: string): Effect.Effect<Opened, ApiFailed> =>\n called(decodeOpened, \"open_file\", { path });\n\nexport const chooseFile: Effect.Effect<Option.Option<Opened>, ApiFailed> = Effect.suspend(() =>\n called(decodeChosen, \"choose_file\", {}),\n).pipe(Effect.map(Option.fromNullishOr));\n\nexport const mcpAccess: Effect.Effect<McpAccess, ApiFailed> = Effect.suspend(() =>\n called(decodeAccess, \"mcp_access\", {}),\n);\n","import type { Schema } from \"effect\";\nimport { Effect } from \"effect\";\n\nimport { ApiFailed } from \"#/shared/api/media-notes/media.ts\";\n\nexport type Settled<Value> =\n | Readonly<{ status: \"ok\"; data: Value }>\n | Readonly<{ status: \"error\"; error: Readonly<{ message: string }> }>;\n\nconst thrown = (cause: unknown): ApiFailed => ApiFailed.make({ message: String(cause) });\n\nexport const settled = <Value>(\n run: () => Promise<Settled<Value>>,\n): Effect.Effect<Value, ApiFailed> =>\n Effect.tryPromise({ try: run, catch: thrown }).pipe(\n Effect.flatMap((answer) => {\n if (answer.status === \"ok\") {\n return Effect.succeed(answer.data);\n }\n return Effect.fail(ApiFailed.make({ message: answer.error.message }));\n }),\n );\n\nexport type Decode<Value> = (input: unknown) => Effect.Effect<Value, Schema.SchemaError>;\n\nexport const settledAs =\n <Value>(decode: Decode<Value>) =>\n (run: () => Promise<Settled<unknown>>): Effect.Effect<Value, ApiFailed> =>\n Effect.suspend(() => settled(run)).pipe(\n Effect.flatMap(decode),\n Effect.catchTag(\"SchemaError\", (cause) => cause.pipe(thrown, Effect.fail)),\n );\n","import { KeyValueStore } from \"effect/persistence\";\nimport { Atom } from \"effect/reactivity\";\n\n/** @internal */\nexport const runtime = Atom.runtime(KeyValueStore.layerStorage(() => globalThis.localStorage));\n","import { Effect } from \"effect\";\n\nimport { mcpAccess } from \"#/shared/api/media-notes/index.ts\";\nimport type { McpAccess } from \"#/shared/api/media-notes/index.ts\";\nimport { runtime } from \"#/shared/lib/runtime.ts\";\n\nconst commandOf = (name: string, { url, token }: McpAccess): string =>\n `claude mcp add --transport http ${name} ${url} --header \"Authorization: Bearer ${token}\"`;\n\n/** @internal */\nexport const copyAtom = runtime.fn((name: string) =>\n mcpAccess.pipe(\n Effect.flatMap((access) =>\n Effect.promise(() => navigator.clipboard.writeText(commandOf(name, access))),\n ),\n ),\n);\n","import { useAtom } from \"@effect/atom-react\";\nimport { AsyncResult } from \"effect/reactivity\";\nimport { Check, Copy } from \"lucide-react\";\nimport { useCallback } from \"react\";\nimport type { ReactNode } from \"react\";\n\nimport { copyAtom } from \"#/features/connect-mcp/model/access.ts\";\nimport { Button } from \"#/shared/ui/button.tsx\";\n\nconst LABEL = \"MCP\";\nconst HINT = \"Claude Code に追加するコマンドをコピー\";\nconst COPIED = \"コピーしました\";\nconst FAILED = \"コピーできませんでした\";\nconst SILENT = \"\";\n\nconst iconOf = (done: boolean): ReactNode => {\n if (done) {\n return <Check aria-hidden=\"true\" />;\n }\n return <Copy aria-hidden=\"true\" />;\n};\n\nconst statusOf = (done: boolean, failed: boolean): string => {\n if (done) {\n return COPIED;\n }\n if (failed) {\n return FAILED;\n }\n return SILENT;\n};\n\nexport const CopyMcpCommand = ({ name }: Readonly<{ name: string }>): ReactNode => {\n const [copied, copy] = useAtom(copyAtom);\n const click = useCallback(() => {\n copy(name);\n }, [copy, name]);\n return (\n <>\n <Button variant=\"outline\" title={HINT} onClick={click}>\n {iconOf(AsyncResult.isSuccess(copied))}\n {LABEL}\n </Button>\n <output className=\"sr-only\">\n {statusOf(AsyncResult.isSuccess(copied), AsyncResult.isFailure(copied))}\n </output>\n </>\n );\n};\n","import { Effect, Option } from \"effect\";\nimport { Atom, AtomRegistry } from \"effect/reactivity\";\n\nimport { openedAtom } from \"#/entities/media/index.ts\";\nimport { chooseFile, openFile, openLink } from \"#/shared/api/media-notes/index.ts\";\nimport type { Opened } from \"#/shared/api/media-notes/index.ts\";\nimport { runtime } from \"#/shared/lib/runtime.ts\";\n\n/** @internal */\nexport const linkAtom = Atom.make(\"\").pipe(Atom.keepAlive);\n\nconst shown = (\n opened: Option.Option<Opened>,\n): Effect.Effect<void, never, AtomRegistry.AtomRegistry> =>\n AtomRegistry.AtomRegistry.pipe(\n Effect.flatMap((registry) =>\n Effect.sync(() => {\n if (Option.isSome(opened)) {\n registry.set(openedAtom, opened);\n }\n }),\n ),\n );\n\n/** @internal */\nexport const openLinkAtom = runtime.fn((link: string) =>\n openLink(link).pipe(Effect.asSome, Effect.flatMap(shown)),\n);\n\n/** @internal */\nexport const openFileAtom = runtime.fn((path: string) =>\n openFile(path).pipe(Effect.asSome, Effect.flatMap(shown)),\n);\n\n/** @internal */\nexport const chooseFileAtom = runtime.fn(() => chooseFile.pipe(Effect.flatMap(shown)));\n","import { useAtomSet } from \"@effect/atom-react\";\nimport { getCurrentWebview } from \"@tauri-apps/api/webview\";\nimport { Array as Arr, Effect, Fiber, Option } from \"effect\";\nimport { constVoid } from \"effect/Function\";\nimport { useEffect } from \"react\";\n\nimport { openFileAtom } from \"#/features/open-media/model/open.ts\";\n\nconst listening = (open: (path: string) => void): Effect.Effect<never> =>\n Effect.acquireRelease(\n Effect.promise(() =>\n getCurrentWebview().onDragDropEvent(({ payload }) => {\n if (payload.type === \"drop\") {\n Option.map(Arr.head(payload.paths), open);\n }\n }),\n ),\n (stop) => Effect.sync(stop),\n ).pipe(Effect.andThen(Effect.never), Effect.scoped);\n\nexport const useFileDrop = (enabled: boolean): void => {\n const open = useAtomSet(openFileAtom);\n useEffect(() => {\n if (!enabled) {\n return constVoid;\n }\n const fiber = Effect.runFork(listening(open));\n return (): void => {\n fiber.pipe(Fiber.interrupt, Effect.runFork);\n };\n }, [enabled, open]);\n};\n","import { useAtom } from \"@effect/atom-react\";\nimport { FolderOpen } from \"lucide-react\";\nimport { useCallback } from \"react\";\nimport type { ReactNode } from \"react\";\n\nimport { chooseFileAtom } from \"#/features/open-media/model/open.ts\";\nimport { Button } from \"#/shared/ui/button.tsx\";\n\nconst CHOOSE = \"ファイルを開く\";\n\nexport const ChooseFile = (): ReactNode => {\n const [chosen, choose] = useAtom(chooseFileAtom);\n const click = useCallback(() => {\n choose();\n }, [choose]);\n return (\n <Button type=\"button\" variant=\"outline\" disabled={chosen.waiting} onClick={click}>\n <FolderOpen aria-hidden=\"true\" />\n {CHOOSE}\n </Button>\n );\n};\n","import { useAtomValue } from \"@effect/atom-react\";\nimport { Option } from \"effect\";\nimport { AsyncResult } from \"effect/reactivity\";\nimport type { ReactNode } from \"react\";\n\nimport { chooseFileAtom, openFileAtom, openLinkAtom } from \"#/features/open-media/model/open.ts\";\n\nexport const Refusal = ({ id }: Readonly<{ id: string }>): ReactNode => {\n const link = useAtomValue(openLinkAtom).pipe(AsyncResult.error);\n const file = useAtomValue(openFileAtom).pipe(AsyncResult.error);\n const chosen = useAtomValue(chooseFileAtom).pipe(AsyncResult.error);\n return Option.match(Option.firstSomeOf([link, file, chosen]), {\n onNone: () => false,\n onSome: ({ message }) => (\n <p id={id} role=\"alert\" className=\"text-destructive basis-full text-xs\">\n {message}\n </p>\n ),\n });\n};\n","import { useAtom } from \"@effect/atom-react\";\nimport { Option } from \"effect\";\nimport { AsyncResult } from \"effect/reactivity\";\nimport { LoaderCircle } from \"lucide-react\";\nimport { useCallback, useId } from \"react\";\nimport type { ChangeEvent, ReactNode, SubmitEvent } from \"react\";\n\nimport { linkAtom, openLinkAtom } from \"#/features/open-media/model/open.ts\";\nimport { useFileDrop } from \"#/features/open-media/model/use-file-drop.ts\";\nimport { ChooseFile } from \"#/features/open-media/ui/choose-file.tsx\";\nimport { Refusal } from \"#/features/open-media/ui/refusal.tsx\";\nimport { Button } from \"#/shared/ui/button.tsx\";\n\nconst OPEN = \"開く\";\n\nexport const OpenBar = ({\n files,\n label,\n}: Readonly<{ files: boolean; label: string }>): ReactNode => {\n const [link, setLink] = useAtom(linkAtom);\n const [opened, open] = useAtom(openLinkAtom);\n const refusalId = useId();\n const failed = AsyncResult.isFailure(opened);\n useFileDrop(files);\n const submit = useCallback(\n (event: SubmitEvent<HTMLFormElement>) => {\n event.preventDefault();\n open(link);\n },\n [open, link],\n );\n const change = useCallback(\n (event: ChangeEvent<HTMLInputElement>) => {\n setLink(event.currentTarget.value);\n },\n [setLink],\n );\n return (\n <form className=\"flex flex-wrap gap-2\" onSubmit={submit}>\n <input\n type=\"url\"\n value={link}\n aria-label={label}\n aria-invalid={failed}\n aria-describedby={Option.getOrUndefined(Option.liftPredicate(refusalId, () => failed))}\n placeholder=\"https://\"\n className=\"border-input bg-background focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:border-destructive h-9 min-w-0 flex-1 rounded-md border px-3 font-mono text-sm outline-none focus-visible:ring-3\"\n onChange={change}\n />\n <Button type=\"submit\" disabled={opened.waiting}>\n {opened.waiting && <LoaderCircle className=\"animate-spin\" />}\n {OPEN}\n </Button>\n {files && <ChooseFile />}\n <Refusal id={refusalId} />\n </form>\n );\n};\n","import { convertFileSrc } from \"@tauri-apps/api/core\";\nimport { Effect } from \"effect\";\nimport type { Scope } from \"effect\";\nimport { constVoid } from \"effect/Function\";\n\nimport type { Mount, Player } from \"#/shared/lib/player.ts\";\n\nconst START = 0;\n\nconst seconds = (value: number): number => {\n if (Number.isFinite(value)) {\n return value;\n }\n return START;\n};\n\nconst placed = ({ stage, opened }: Mount): Effect.Effect<HTMLVideoElement> =>\n Effect.sync(() => {\n const video = document.createElement(\"video\");\n video.src = convertFileSrc(opened.location);\n video.preload = \"auto\";\n video.playsInline = true;\n stage.replaceChildren(video);\n return video;\n });\n\nconst removed = ({ stage }: Mount): Effect.Effect<void> =>\n Effect.sync(() => {\n stage.replaceChildren();\n });\n\nexport const mountFile = (mount: Mount): Effect.Effect<Player, never, Scope.Scope> =>\n Effect.acquireRelease(placed(mount), () => removed(mount)).pipe(\n Effect.map((video) => ({\n time: () => ({ current: seconds(video.currentTime), duration: seconds(video.duration) }),\n seek: (to: number): void => {\n video.currentTime = to;\n },\n toggle: (): void => {\n if (video.paused) {\n Effect.tryPromise({ try: () => video.play(), catch: constVoid }).pipe(\n Effect.ignore,\n Effect.runFork,\n );\n return;\n }\n video.pause();\n },\n })),\n );\n","import { Effect, MutableRef } from \"effect\";\nimport type { Scope } from \"effect\";\nimport { createNiconicoEngine } from \"niconico-embed-player\";\n\nimport type { Mount, Player } from \"#/shared/lib/player.ts\";\n\nexport const mountNiconico = ({\n stage,\n opened,\n}: Mount): Effect.Effect<Player, never, Scope.Scope> => {\n const playing = MutableRef.make(false);\n const stopped = (): void => {\n MutableRef.set(playing, false);\n };\n const created = Effect.sync(() =>\n createNiconicoEngine(\n stage,\n { videoId: opened.media.source.id, title: \"niconico\" },\n {\n onPlaying: () => {\n MutableRef.set(playing, true);\n },\n onPaused: stopped,\n onEnded: stopped,\n },\n ),\n );\n return Effect.acquireRelease(created, (engine) =>\n Effect.sync(() => {\n engine.destroy();\n }),\n ).pipe(\n Effect.map((engine) => ({\n time: () => engine.time(),\n seek: (seconds: number): void => {\n engine.seek(seconds);\n },\n toggle: (): void => {\n if (MutableRef.get(playing)) {\n engine.pause();\n return;\n }\n engine.play();\n },\n })),\n );\n};\n","import type { Opened } from \"#/shared/api/media-notes/index.ts\";\n\nexport type Position = Readonly<{ current: number; duration: number }>;\n\nexport type Player = Readonly<{\n time: () => Position;\n seek: (seconds: number) => void;\n toggle: () => void;\n}>;\n\nexport type Mount = Readonly<{ stage: HTMLElement; opened: Opened }>;\n\nexport const STILL: Position = { current: 0, duration: 0 };\n","import { Effect, MutableRef, Option } from \"effect\";\nimport type { Scope } from \"effect\";\n\nimport { pageOf } from \"#/entities/media/index.ts\";\nimport type { Opened } from \"#/shared/api/media-notes/index.ts\";\nimport { STILL } from \"#/shared/lib/player.ts\";\nimport type { Mount, Player } from \"#/shared/lib/player.ts\";\n\ntype Progress = Readonly<{ currentPosition: number }>;\n\ntype Widget = Readonly<{\n bind: (event: string, listener: (progress: Progress) => void) => void;\n getDuration: (callback: (milliseconds: number) => void) => void;\n seekTo: (milliseconds: number) => void;\n toggle: () => void;\n}>;\n\ntype WidgetApi = Readonly<{\n Widget: ((element: HTMLElement) => Widget) &\n Readonly<{ Events: Readonly<{ READY: string; PLAY_PROGRESS: string }> }>;\n}>;\n\ndeclare global {\n const SC: WidgetApi;\n}\n\nconst MILLISECONDS = 1000;\n\nconst widgetUrl = ({ media, location }: Opened): string =>\n `https://w.soundcloud.com/player/?${new URLSearchParams({\n url: Option.getOrElse(pageOf(media.source), () => location),\n visual: \"true\",\n auto_play: \"false\",\n show_comments: \"false\",\n }).toString()}`;\n\nconst framed = ({ stage, opened }: Mount): Effect.Effect<HTMLIFrameElement> =>\n Effect.sync(() => {\n const iframe = document.createElement(\"iframe\");\n iframe.src = widgetUrl(opened);\n iframe.allow = \"autoplay\";\n iframe.title = \"SoundCloud\";\n stage.replaceChildren(iframe);\n return iframe;\n });\n\nconst cleared = ({ stage }: Mount): Effect.Effect<void> =>\n Effect.sync(() => {\n stage.replaceChildren();\n });\n\nconst ready = ({ frame }: Readonly<{ frame: HTMLElement }>): Effect.Effect<Player> =>\n Effect.callback((resume) => {\n const widget = SC.Widget(frame);\n const position = MutableRef.make(STILL);\n widget.bind(SC.Widget.Events.PLAY_PROGRESS, ({ currentPosition }) => {\n MutableRef.update(position, (now) => ({ ...now, current: currentPosition / MILLISECONDS }));\n });\n widget.bind(SC.Widget.Events.READY, () => {\n widget.getDuration((milliseconds) => {\n MutableRef.update(position, (now) => ({ ...now, duration: milliseconds / MILLISECONDS }));\n resume(\n Effect.succeed({\n time: () => MutableRef.get(position),\n seek: (seconds: number) => {\n widget.seekTo(seconds * MILLISECONDS);\n MutableRef.update(position, (now) => ({ ...now, current: seconds }));\n },\n toggle: () => {\n widget.toggle();\n },\n }),\n );\n });\n });\n });\n\nexport const mountSoundcloud = (mount: Mount): Effect.Effect<Player, never, Scope.Scope> =>\n Effect.acquireRelease(framed(mount), () => cleared(mount)).pipe(\n Effect.flatMap((frame) => ready({ frame })),\n );\n","import { Effect, Option, Predicate, pipe } from \"effect\";\nimport type { Scope } from \"effect\";\n\nimport type { Mount, Player } from \"#/shared/lib/player.ts\";\n\nconst LOADED = 1;\n\nconst isCallback = (value: unknown): value is () => void => Predicate.isFunction(value);\n\nconst apiReady = (): boolean =>\n \"YT\" in globalThis &&\n pipe(\n Option.liftPredicate(YT, Predicate.hasProperty(\"loaded\")),\n Option.exists(({ loaded }) => loaded === LOADED),\n );\n\nconst whenApiReady: Effect.Effect<void> = Effect.callback((resume) => {\n if (apiReady()) {\n resume(Effect.void);\n return;\n }\n const previous: unknown = pipe(\n Option.liftPredicate(globalThis, Predicate.hasProperty(\"onYouTubeIframeAPIReady\")),\n Option.map((found) => found.onYouTubeIframeAPIReady),\n Option.getOrUndefined,\n );\n Reflect.set(globalThis, \"onYouTubeIframeAPIReady\", () => {\n if (isCallback(previous)) {\n previous();\n }\n resume(Effect.void);\n });\n});\n\ntype Embedded = Readonly<{ player: Readonly<YT.Player>; host: HTMLElement }>;\n\nconst removed = ({ player, host }: Embedded): Effect.Effect<void> =>\n Effect.sync(() => {\n player.destroy();\n host.remove();\n });\n\nconst created = (mount: Mount): Effect.Effect<Embedded> =>\n Effect.callback((resume) => {\n const host = document.createElement(\"div\");\n mount.stage.replaceChildren(host);\n const player = new YT.Player(host, {\n videoId: mount.opened.media.source.id,\n width: \"100%\",\n height: \"100%\",\n events: {\n onReady: (): void => {\n resume(Effect.succeed({ player, host }));\n },\n },\n });\n return removed({ player, host });\n });\n\nconst owned = (mount: Mount): Effect.Effect<Embedded, never, Scope.Scope> =>\n Effect.acquireRelease(created(mount), removed);\n\nexport const mountYoutube = (mount: Mount): Effect.Effect<Player, never, Scope.Scope> =>\n whenApiReady.pipe(\n Effect.andThen(owned(mount)),\n Effect.map(({ player }) => ({\n time: () => ({ current: player.getCurrentTime(), duration: player.getDuration() }),\n seek: (seconds: number): void => {\n player.seekTo(seconds, true);\n },\n toggle: (): void => {\n if (player.getPlayerState() === YT.PlayerState.PLAYING) {\n player.pauseVideo();\n return;\n }\n player.playVideo();\n },\n })),\n );\n","import { Match } from \"effect\";\nimport type { Effect, Scope } from \"effect\";\n\nimport { mountFile } from \"#/features/play-media/lib/file.ts\";\nimport { mountNiconico } from \"#/features/play-media/lib/niconico.ts\";\nimport { mountSoundcloud } from \"#/features/play-media/lib/soundcloud.ts\";\nimport { mountYoutube } from \"#/features/play-media/lib/youtube.ts\";\nimport type { Mount, Player } from \"#/shared/lib/player.ts\";\n\nexport const mountPlayer = (mount: Mount): Effect.Effect<Player, never, Scope.Scope> =>\n Match.value(mount.opened.media.source.site).pipe(\n Match.when(\"youtube\", () => mountYoutube(mount)),\n Match.when(\"niconico\", () => mountNiconico(mount)),\n Match.when(\"soundcloud\", () => mountSoundcloud(mount)),\n Match.when(\"file\", () => mountFile(mount)),\n Match.exhaustive,\n );\n","import { useAtomValue } from \"@effect/atom-react\";\nimport { Effect, Option, Schedule, Stream, pipe } from \"effect\";\nimport { AsyncResult, Atom } from \"effect/reactivity\";\n\nimport { openedAtom } from \"#/entities/media/index.ts\";\nimport { mountPlayer } from \"#/features/play-media/lib/mount.ts\";\nimport { STILL } from \"#/shared/lib/player.ts\";\nimport type { Player, Position } from \"#/shared/lib/player.ts\";\n\nconst TICK = \"200 millis\";\n\n/** @internal */\nexport const stageAtom = Atom.make(Option.none<HTMLElement>());\n\n/** @internal */\nexport const playerAtom = Atom.make(\n Effect.fnUntraced(function* player(get) {\n const stage = yield* Effect.fromOption(get(stageAtom));\n const opened = yield* Effect.fromOption(get(openedAtom));\n return yield* mountPlayer({ stage, opened });\n }),\n);\n\nconst positionAtom = Atom.make((get) =>\n pipe(\n get.result(playerAtom),\n Effect.map((player) =>\n Stream.fromEffectSchedule(\n Effect.sync(() => player.time()),\n Schedule.spaced(TICK),\n ),\n ),\n Stream.unwrap,\n ),\n);\n\nexport const usePlayer = (): Option.Option<Player> =>\n useAtomValue(playerAtom).pipe(AsyncResult.value);\n\nexport const usePosition = (): Position =>\n AsyncResult.getOrElse(useAtomValue(positionAtom), () => STILL);\n","import { Array as Arr, pipe } from \"effect\";\n\nconst FIELD = \"input, textarea, select, button, [contenteditable]\";\n\nconst MODIFIERS = [\"ctrlKey\", \"metaKey\", \"altKey\", \"isComposing\"] as const;\n\nconst inField = ({ target }: KeyboardEvent): boolean =>\n target instanceof Element && target.closest(FIELD) !== null;\n\nexport const ignoredKey = (event: KeyboardEvent): boolean =>\n pipe(\n MODIFIERS,\n Arr.some((key) => event[key]),\n ) || inField(event);\n","import { Option } from \"effect\";\nimport { useEffect } from \"react\";\n\nimport { ignoredKey } from \"#/shared/lib/keys.ts\";\nimport type { Player } from \"#/shared/lib/player.ts\";\n\nconst KEY = \" \";\n\nexport const usePlayKey = (player: Option.Option<Player>): void => {\n useEffect(() => {\n const onKey = (event: KeyboardEvent): void => {\n if (event.key !== KEY || ignoredKey(event) || Option.isNone(player)) {\n return;\n }\n event.preventDefault();\n player.value.toggle();\n };\n globalThis.addEventListener(\"keydown\", onKey);\n return (): void => {\n globalThis.removeEventListener(\"keydown\", onKey);\n };\n }, [player]);\n};\n","import { Array as Arr, pipe } from \"effect\";\nimport type { ReactNode } from \"react\";\n\nexport type Hint = Readonly<{ key: string; meaning: string }>;\n\nconst HINTS: readonly Hint[] = [\n { key: \"M\", meaning: \"始点・終点\" },\n { key: \"Space\", meaning: \"再生・一時停止\" },\n];\n\nexport const KeyHints = ({ hints }: Readonly<{ hints: readonly Hint[] }>): ReactNode => (\n <p className=\"text-muted-foreground flex flex-wrap items-center gap-x-4 gap-y-1 text-xs\">\n {pipe(\n [...HINTS, ...hints],\n Arr.map(({ key, meaning }) => (\n <span key={key} className=\"flex items-center gap-2\">\n <kbd className=\"border-input rounded border px-1.5 font-mono\">{key}</kbd>\n {meaning}\n </span>\n )),\n )}\n </p>\n);\n","import { useAtomSet, useAtomValue } from \"@effect/atom-react\";\nimport { Option } from \"effect\";\nimport { useCallback } from \"react\";\nimport type { ReactNode } from \"react\";\n\nimport { keyOf, openedAtom } from \"#/entities/media/index.ts\";\nimport { stageAtom, usePlayer } from \"#/features/play-media/model/player.ts\";\n\nconst FRAME =\n \"size-full [&>iframe]:size-full [&>iframe]:border-0 [&>video]:size-full [&>video]:object-contain\";\n\nconst Stage = (): ReactNode => {\n const setStage = useAtomSet(stageAtom);\n usePlayer();\n const attach = useCallback(\n (stage: HTMLElement | null): (() => void) => {\n setStage(Option.fromNullishOr(stage));\n return () => {\n setStage(Option.none());\n };\n },\n [setStage],\n );\n return (\n <div className=\"size-full\">\n <div ref={attach} className={FRAME} />\n </div>\n );\n};\n\nexport const MediaPlayer = (): ReactNode =>\n Option.match(useAtomValue(openedAtom), {\n onNone: () => false,\n onSome: ({ media, location }) => (\n <div className=\"aspect-video w-full overflow-hidden rounded-md bg-black\">\n <Stage key={`${keyOf(media.source)}:${location}`} />\n </div>\n ),\n });\n","import { Option } from \"effect\";\nimport { Atom } from \"effect/reactivity\";\n\nimport { openedAtom } from \"#/entities/media/index.ts\";\n\nexport type Range = Readonly<{ from: number; to: number }>;\n\nexport type Tone = \"plain\" | \"warn\" | \"faint\" | \"guess\" | \"guess-warn\";\n\nexport type Span = Readonly<{ key: string; from: number; to: number; tone: Tone }>;\n\n/** @internal */\nexport const perMedia = <Value>(initial: Value): Atom.Writable<Value> =>\n Atom.writable(\n (get) => {\n get(openedAtom);\n return initial;\n },\n (context, value: Value) => {\n context.setSelf(value);\n },\n ).pipe(Atom.keepAlive);\n\n/** @internal */\nexport const rangeAtom = perMedia(Option.none<Range>());\n\n/** @internal */\nexport const anchorAtom = perMedia(Option.none<number>());\n\nexport const spanOf = ([one, other]: readonly [number, number]): Range => ({\n from: Math.min(one, other),\n to: Math.max(one, other),\n});\n","import { useAtomValue } from \"@effect/atom-react\";\nimport { Option } from \"effect\";\nimport type { ReactNode } from \"react\";\n\nimport { rangeAtom } from \"#/features/select-range/model/range.ts\";\nimport { preciseClock } from \"#/shared/lib/clock.ts\";\n\nconst DIGITS = 1;\nconst EMPTY = \"–\";\n\nexport const RangeReadout = (): ReactNode =>\n Option.match(useAtomValue(rangeAtom), {\n onNone: () => <p className=\"text-muted-foreground font-mono text-sm tabular-nums\">{EMPTY}</p>,\n onSome: ({ from, to }) => (\n <p className=\"flex items-baseline justify-between font-mono text-sm tabular-nums\">\n <span>{`${preciseClock(from)}–${preciseClock(to)}`}</span>\n <span className=\"text-muted-foreground text-xs\">{`${(to - from).toFixed(DIGITS)} 秒`}</span>\n </p>\n ),\n });\n","import { Array as Arr, pipe } from \"effect\";\nimport type { ReactNode } from \"react\";\n\nimport { clock } from \"#/shared/lib/clock.ts\";\n\nconst WHOLE = 100;\nconst SHORT_SONG = 600;\nconst SHORT_STEP = 30;\nconst LONG_STEP = 60;\nconst FIRST = 0;\n\nconst stepFor = (duration: number): number => {\n if (duration <= SHORT_SONG) {\n return SHORT_STEP;\n }\n return LONG_STEP;\n};\n\nexport const Ruler = ({ duration }: Readonly<{ duration: number }>): ReactNode => {\n if (duration <= FIRST) {\n return false;\n }\n const step = stepFor(duration);\n const ticks = pipe(\n Arr.range(FIRST, Math.floor(duration / step)),\n Arr.map((index) => index * step),\n );\n return (\n <svg className=\"h-4 w-full overflow-visible\" aria-hidden>\n {pipe(\n ticks,\n Arr.map((seconds) => (\n <text\n key={seconds}\n x={`${(seconds / duration) * WHOLE}%`}\n y=\"75%\"\n className=\"fill-muted-foreground font-mono text-xs tabular-nums\"\n >\n {clock(seconds)}\n </text>\n )),\n )}\n </svg>\n );\n};\n","export const MARK_LANE = { y: \"0%\", height: \"22%\" };\nexport const PLAY_LANE = { y: \"30%\", height: \"70%\" };\nexport const WHOLE_LANE = { y: \"0%\", height: \"100%\" };\nexport const HEAD = 0.25;\n","import { Number as Num } from \"effect\";\nimport type { ReactNode } from \"react\";\n\nconst WHOLE = 100;\nconst NONE = 0;\nconst FULL = 1;\n\nconst percent = (seconds: number, duration: number): number => {\n if (duration <= NONE) {\n return NONE;\n }\n return Num.clamp(seconds / duration, { minimum: NONE, maximum: FULL }) * WHOLE;\n};\n\nexport const SpanRect = ({\n from,\n to,\n duration,\n lane,\n className,\n}: Readonly<{\n from: number;\n to: number;\n duration: number;\n lane: Readonly<{ y: string; height: string }>;\n className: string;\n}>): ReactNode => (\n <rect\n x={`${percent(from, duration)}%`}\n width={`${Math.max(percent(to, duration) - percent(from, duration), NONE)}%`}\n y={lane.y}\n height={lane.height}\n className={className}\n />\n);\n","import { useAtomValue } from \"@effect/atom-react\";\nimport { Option } from \"effect\";\nimport type { ReactNode } from \"react\";\n\nimport { rangeAtom } from \"#/features/select-range/model/range.ts\";\nimport { HEAD, WHOLE_LANE } from \"#/features/select-range/ui/lanes.ts\";\nimport { SpanRect } from \"#/features/select-range/ui/span-rect.tsx\";\n\nexport const RangeLayer = ({ duration }: Readonly<{ duration: number }>): ReactNode =>\n Option.match(useAtomValue(rangeAtom), {\n onNone: () => false,\n onSome: ({ from, to }) => (\n <SpanRect\n from={from}\n to={Math.max(to, from + HEAD)}\n duration={duration}\n lane={WHOLE_LANE}\n className=\"fill-primary/15 stroke-primary\"\n />\n ),\n });\n","import { Array as Arr, pipe } from \"effect\";\nimport type { ReactNode } from \"react\";\n\nimport type { Span, Tone } from \"#/features/select-range/model/range.ts\";\nimport { MARK_LANE, PLAY_LANE } from \"#/features/select-range/ui/lanes.ts\";\nimport { SpanRect } from \"#/features/select-range/ui/span-rect.tsx\";\n\ntype Lane = Readonly<{ y: string; height: string }>;\n\nconst GUESS = \"fill-none [stroke-dasharray:4_3] stroke-[1.5]\";\n\nconst LOOK: Readonly<Record<Tone, Readonly<{ lane: Lane; className: string }>>> = {\n plain: { lane: MARK_LANE, className: \"fill-foreground/70\" },\n warn: { lane: MARK_LANE, className: \"fill-destructive/70\" },\n faint: { lane: MARK_LANE, className: \"fill-muted-foreground/30\" },\n guess: { lane: PLAY_LANE, className: `${GUESS} stroke-foreground` },\n \"guess-warn\": { lane: PLAY_LANE, className: `${GUESS} stroke-destructive` },\n};\n\nexport const SpansLayer = ({\n spans,\n duration,\n}: Readonly<{ spans: readonly Span[]; duration: number }>): ReactNode =>\n pipe(\n spans,\n Arr.map((span) => (\n <SpanRect\n key={span.key}\n from={span.from}\n to={span.to}\n duration={duration}\n lane={LOOK[span.tone].lane}\n className={LOOK[span.tone].className}\n />\n )),\n );\n","import type { ReactNode } from \"react\";\n\nimport type { Span } from \"#/features/select-range/model/range.ts\";\nimport { HEAD, PLAY_LANE, WHOLE_LANE } from \"#/features/select-range/ui/lanes.ts\";\nimport { RangeLayer } from \"#/features/select-range/ui/range-layer.tsx\";\nimport { SpanRect } from \"#/features/select-range/ui/span-rect.tsx\";\nimport { SpansLayer } from \"#/features/select-range/ui/spans-layer.tsx\";\nimport type { Position } from \"#/shared/lib/player.ts\";\n\nconst START = 0;\n\nexport const Track = ({\n position,\n spans,\n}: Readonly<{ position: Position; spans: readonly Span[] }>): ReactNode => (\n <svg className=\"size-full overflow-visible\" aria-hidden>\n <SpanRect\n from={START}\n to={position.duration}\n duration={position.duration}\n lane={PLAY_LANE}\n className=\"fill-muted\"\n />\n <SpansLayer spans={spans} duration={position.duration} />\n <RangeLayer duration={position.duration} />\n <SpanRect\n from={position.current}\n to={position.current + HEAD}\n duration={position.duration}\n lane={WHOLE_LANE}\n className=\"fill-foreground\"\n />\n </svg>\n);\n","import { useAtomSet } from \"@effect/atom-react\";\nimport { MutableRef, Number as Num, Option, Record as Rec, pipe } from \"effect\";\nimport { constVoid } from \"effect/Function\";\nimport { useCallback, useMemo } from \"react\";\n\nimport { rangeAtom, spanOf } from \"#/features/select-range/model/range.ts\";\nimport type { Range } from \"#/features/select-range/model/range.ts\";\n\nconst DRAG_PIXELS = 4;\nconst NONE = 0;\nconst FULL = 1;\n\ntype Press = Readonly<{ seconds: number; x: number; dragged: boolean }>;\n\ntype Scrubbing = Readonly<{\n element: HTMLDivElement;\n duration: number;\n seek: (seconds: number) => void;\n select: (range: Range) => void;\n pressed: () => Option.Option<Press>;\n press: (next: Option.Option<Press>) => void;\n}>;\n\nconst secondsAt = ({ element, duration }: Scrubbing, x: number): number => {\n const { left, width } = element.getBoundingClientRect();\n return Num.clamp((x - left) / Math.max(width, FULL), { minimum: NONE, maximum: FULL }) * duration;\n};\n\nconst down = (scrubbing: Scrubbing, event: PointerEvent): void => {\n scrubbing.element.setPointerCapture(event.pointerId);\n scrubbing.press(\n Option.some({\n seconds: secondsAt(scrubbing, event.clientX),\n x: event.clientX,\n dragged: false,\n }),\n );\n};\n\nconst move = (scrubbing: Scrubbing, event: PointerEvent): void => {\n const press = scrubbing.pressed();\n if (Option.isNone(press)) {\n return;\n }\n const { seconds, x, dragged } = press.value;\n if (dragged || Math.abs(event.clientX - x) >= DRAG_PIXELS) {\n scrubbing.press(Option.some({ seconds, x, dragged: true }));\n scrubbing.select(spanOf([seconds, secondsAt(scrubbing, event.clientX)]));\n }\n};\n\nconst up = (scrubbing: Scrubbing, event: PointerEvent): void => {\n const press = scrubbing.pressed();\n if (Option.isSome(press) && !press.value.dragged) {\n scrubbing.seek(secondsAt(scrubbing, event.clientX));\n }\n scrubbing.press(Option.none());\n};\n\nconst POINTER_HANDLERS = {\n pointerdown: down,\n pointermove: move,\n pointerup: up,\n} as const;\n\nconst listen = (scrubbing: Scrubbing): (() => void) => {\n const bound = pipe(\n POINTER_HANDLERS,\n Rec.map((handle) => (event: PointerEvent): void => {\n handle(scrubbing, event);\n }),\n );\n const entries = Rec.toEntries(bound);\n for (const [type, listener] of entries) {\n scrubbing.element.addEventListener(type, listener);\n }\n return (): void => {\n for (const [type, listener] of entries) {\n scrubbing.element.removeEventListener(type, listener);\n }\n };\n};\n\nexport const useScrub = ({\n duration,\n seek,\n}: Readonly<{ duration: number; seek: (seconds: number) => void }>): ((\n element: HTMLDivElement | null,\n) => () => void) => {\n const setRange = useAtomSet(rangeAtom);\n const press = useMemo(() => MutableRef.make(Option.none<Press>()), []);\n return useCallback(\n (element: HTMLDivElement | null): (() => void) =>\n Option.match(Option.fromNullishOr(element), {\n onNone: () => constVoid,\n onSome: (found) =>\n listen({\n element: found,\n duration,\n seek,\n pressed: () => MutableRef.get(press),\n press: (next) => {\n MutableRef.set(press, next);\n },\n select: (range) => {\n setRange(Option.some(range));\n },\n }),\n }),\n [duration, seek, setRange, press],\n );\n};\n","import type { ReactNode } from \"react\";\n\nimport type { Span } from \"#/features/select-range/model/range.ts\";\nimport { Ruler } from \"#/features/select-range/ui/ruler.tsx\";\nimport { Track } from \"#/features/select-range/ui/track.tsx\";\nimport { useScrub } from \"#/features/select-range/ui/use-scrub.ts\";\nimport type { Position } from \"#/shared/lib/player.ts\";\n\nexport const Timeline = ({\n position,\n spans,\n seek,\n}: Readonly<{\n position: Position;\n spans: readonly Span[];\n seek: (seconds: number) => void;\n}>): ReactNode => {\n const attach = useScrub({ duration: position.duration, seek });\n return (\n <div className=\"grid gap-1\">\n <div ref={attach} className=\"h-16 cursor-crosshair touch-pan-y select-none\">\n <Track position={position} spans={spans} />\n </div>\n <Ruler duration={position.duration} />\n </div>\n );\n};\n","import { useAtomSet, useAtomValue } from \"@effect/atom-react\";\nimport { Option, String as Str } from \"effect\";\nimport { useEffect } from \"react\";\n\nimport { anchorAtom, rangeAtom, spanOf } from \"#/features/select-range/model/range.ts\";\nimport { ignoredKey } from \"#/shared/lib/keys.ts\";\nimport type { Player } from \"#/shared/lib/player.ts\";\n\nconst KEY = \"m\";\n\nexport const useRangeKey = (player: Option.Option<Player>): void => {\n const anchor = useAtomValue(anchorAtom);\n const setAnchor = useAtomSet(anchorAtom);\n const setRange = useAtomSet(rangeAtom);\n useEffect(() => {\n const mark = (now: number): void => {\n Option.match(anchor, {\n onNone: () => {\n setAnchor(Option.some(now));\n setRange(Option.some({ from: now, to: now }));\n },\n onSome: (start) => {\n setAnchor(Option.none());\n setRange(Option.some(spanOf([start, now])));\n },\n });\n };\n const onKey = (event: KeyboardEvent): void => {\n if (Str.toLowerCase(event.key) !== KEY || ignoredKey(event)) {\n return;\n }\n if (Option.isSome(player)) {\n mark(player.value.time().current);\n }\n };\n globalThis.addEventListener(\"keydown\", onKey);\n return (): void => {\n globalThis.removeEventListener(\"keydown\", onKey);\n };\n }, [player, anchor, setAnchor, setRange]);\n};\n","import { Option } from \"effect\";\nimport { useCallback } from \"react\";\nimport type { ReactNode } from \"react\";\n\nimport { MediaMeta } from \"#/entities/media/index.ts\";\nimport {\n KeyHints,\n MediaPlayer,\n usePlayKey,\n usePlayer,\n usePosition,\n} from \"#/features/play-media/index.ts\";\nimport type { Hint } from \"#/features/play-media/index.ts\";\nimport { Timeline, useRangeKey } from \"#/features/select-range/index.ts\";\nimport type { Span } from \"#/features/select-range/index.ts\";\nimport type { Media } from \"#/shared/api/media-notes/index.ts\";\n\nexport const MediaStage = ({\n media,\n spans,\n hints,\n}: Readonly<{ media: Media; spans: readonly Span[]; hints: readonly Hint[] }>): ReactNode => {\n const player = usePlayer();\n const position = usePosition();\n useRangeKey(player);\n usePlayKey(player);\n const seek = useCallback(\n (seconds: number) => {\n if (Option.isSome(player)) {\n player.value.seek(seconds);\n }\n },\n [player],\n );\n return (\n <section className=\"grid content-start gap-3 lg:col-span-2\">\n <MediaMeta media={media} duration={position.duration} />\n <MediaPlayer />\n <Timeline position={position} spans={spans} seek={seek} />\n <KeyHints hints={hints} />\n </section>\n );\n};\n","import { useAtomSet } from \"@effect/atom-react\";\nimport { Option } from \"effect\";\nimport { useCallback } from \"react\";\n\nimport { usePlayer } from \"#/features/play-media/index.ts\";\nimport { rangeAtom } from \"#/features/select-range/index.ts\";\nimport type { Range } from \"#/features/select-range/index.ts\";\n\nexport const useJump = (): ((range: Range) => void) => {\n const player = usePlayer();\n const setRange = useAtomSet(rangeAtom);\n return useCallback(\n ({ from, to }: Range) => {\n setRange(Option.some({ from, to }));\n if (Option.isSome(player)) {\n player.value.seek(from);\n }\n },\n [player, setRange],\n );\n};\n","import { Effect, Option } from \"effect\";\nimport type { Cause } from \"effect\";\nimport { AtomRegistry } from \"effect/reactivity\";\n\nimport { openedAtom } from \"#/entities/media/index.ts\";\nimport { anchorAtom, rangeAtom } from \"#/features/select-range/index.ts\";\nimport type { Range } from \"#/features/select-range/index.ts\";\nimport type { Opened } from \"#/shared/api/media-notes/index.ts\";\n\nexport type Post<Failure> = (opened: Opened, range: Range) => Effect.Effect<void, Failure>;\n\n/** @internal */\nexport const savedRange = <Failure>(\n post: Post<Failure>,\n): Effect.Effect<\n AtomRegistry.AtomRegistry,\n Failure | Cause.NoSuchElementError,\n AtomRegistry.AtomRegistry\n> =>\n Effect.gen(function* saving() {\n const registry = yield* AtomRegistry.AtomRegistry;\n const opened = yield* Effect.fromOption(registry.get(openedAtom));\n const range = yield* Effect.fromOption(registry.get(rangeAtom));\n yield* post(opened, range);\n registry.set(rangeAtom, Option.none());\n registry.set(anchorAtom, Option.none());\n return registry;\n });\n","import { useAtom } from \"@effect/atom-react\";\nimport type { Atom } from \"effect/reactivity\";\nimport { useCallback } from \"react\";\nimport type { SubmitEvent } from \"react\";\n\n/** @internal */\nexport const useSubmit = <Failure>(\n save: Readonly<Atom.AtomResultFn<void, void, Failure>>,\n): Readonly<{ waiting: boolean; submit: (event: SubmitEvent<HTMLFormElement>) => void }> => {\n const [saved, run] = useAtom(save);\n const submit = useCallback(\n (event: SubmitEvent<HTMLFormElement>) => {\n event.preventDefault();\n run();\n },\n [run],\n );\n return { waiting: saved.waiting, submit };\n};\n","import { listen } from \"@tauri-apps/api/event\";\nimport { Effect, Fiber } from \"effect\";\nimport { useEffect } from \"react\";\n\nexport type Following = Readonly<{ event: string; refresh: () => void }>;\n\nconst following = ({ event, refresh }: Following): Effect.Effect<never> =>\n Effect.acquireRelease(\n Effect.promise(() => listen(event, refresh)),\n (stop) => Effect.sync(stop),\n ).pipe(Effect.andThen(Effect.never), Effect.scoped);\n\nexport const useFollowing = ({ event, refresh }: Following): void => {\n useEffect(() => {\n const fiber = Effect.runFork(following({ event, refresh }));\n return (): void => {\n fiber.pipe(Fiber.interrupt, Effect.runFork);\n };\n }, [event, refresh]);\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAMA,MAAa,aAAa,KAA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ACN;CACA,OAAO;EAAE,SAAS,MAAM;EAAS;CAAO;AAC1C;;ACZA,MAAM,aAAa,EAAE,OAAO,cAC1B,OAAO,eACL,OAAO,cAAcC,SAAO,OAAO,OAAO,CAAC,IAC1C,SAAS,OAAO,KAAK,IAAI,CAC5B,CAAC,CAAC,KAAK,OAAO,QAAQ,OAAO,KAAK,GAAG,OAAO,MAAM;AAEpD,MAAa,gBAAgB,EAAE,OAAO,cAA+B;CACnE,gBAAgB;EACd,MAAM,QAAQ,OAAO,QAAQ,UAAU;GAAE;GAAO;EAAQ,CAAC,CAAC;EAC1D,aAAmB;GACjB,MAAM,KAAK,MAAM,WAAW,OAAO,OAAO;EAC5C;CACF,GAAG,CAAC,OAAO,OAAO,CAAC;AACrB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Array, Config, DateTime, Effect, FileSystem, Option, Path, Record, Schema, String, pipe } from "effect";
|
|
2
2
|
import { Argument, Command } from "effect/cli";
|
|
3
|
-
import { t as runMain } from "../run-main-
|
|
3
|
+
import { t as runMain } from "../run-main-CfugYs_u.mjs";
|
|
4
4
|
import { a as succeeds, i as outputOf, r as mustSucceed } from "../process-l69KvwcT.mjs";
|
|
5
5
|
// src/features/publish-updates/model/manifest.ts
|
|
6
6
|
const Manifest$1 = Schema.fromJsonString(Schema.Struct({
|
|
@@ -279,12 +279,11 @@ const bundleCollectCommand = Command.make("bundle-collect", { kinds: Argument.St
|
|
|
279
279
|
discard: true
|
|
280
280
|
});
|
|
281
281
|
}));
|
|
282
|
-
|
|
282
|
+
Command.make("desktop-release").pipe(Command.withSubcommands([
|
|
283
283
|
bundleCollectCommand,
|
|
284
284
|
Command.make("updater-feed", {}, () => updaterFeed),
|
|
285
285
|
Command.make("updater-key", {}, () => updaterKey)
|
|
286
|
-
]));
|
|
287
|
-
runMain("desktop-release")(Command.run(release, { version: "0.0.0" }));
|
|
286
|
+
])).pipe(Command.run({ version: "0.0.0" }), runMain("desktop-release"));
|
|
288
287
|
export {};
|
|
289
288
|
|
|
290
289
|
//# sourceMappingURL=release-cli.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"release-cli.mjs","names":["Manifest","ASSETS","SIGNATURE","Arr","Str","Rec","Str","Arr","Rec","Arr","Str"],"sources":["../../src/features/publish-updates/model/manifest.ts","../../src/features/publish-updates/model/feed.ts","../../src/features/publish-updates/model/key.ts","../../src/app/desktop-release-cli.ts"],"sourcesContent":["import { Effect, FileSystem, Schema } from \"effect\";\n\nconst Manifest = Schema.fromJsonString(\n Schema.Struct({ name: Schema.String, version: Schema.String }),\n);\n\n/** @internal */\nexport const manifest = Effect.gen(function* manifest() {\n const fileSystem = yield* FileSystem.FileSystem;\n const text = yield* fileSystem.readFileString(\"package.json\");\n return yield* Schema.decodeEffect(Manifest)(text);\n});\n\n/** @internal */\nexport const feedOf = (name: string): string => `${name}-updater`;\n\n/** @internal */\nexport const environmentOf = (name: string): string => `${name}-release`;\n","import {\n Array as Arr,\n Config,\n DateTime,\n Effect,\n FileSystem,\n Option,\n Path,\n Record as Rec,\n Schema,\n String as Str,\n pipe,\n} from \"effect\";\n\nimport { feedOf, manifest } from \"#/features/publish-updates/model/manifest.ts\";\nimport { outputOf, succeeds } from \"#/shared/lib/process.ts\";\n\nconst ASSETS = \"release-assets\";\nconst LATEST = \"latest.json\";\nconst SIGNATURE = \".sig\";\nconst START = 0;\n\nconst TARGETS: readonly (readonly [suffix: string, platform: string])[] = [\n [\"_x64-setup.exe\", \"windows-x86_64\"],\n [\"_aarch64.app.tar.gz\", \"darwin-aarch64\"],\n [\"_amd64.AppImage\", \"linux-x86_64\"],\n];\n\nconst Platform = Schema.Struct({ url: Schema.String, signature: Schema.String });\n\nconst LatestJson = Schema.fromJsonString(\n Schema.Struct({\n version: Schema.String,\n notes: Schema.String,\n pub_date: Schema.String,\n platforms: Schema.Record(Schema.String, Platform),\n }),\n);\n\n/** @internal */\nexport const platformOf = (file: string): Option.Option<string> =>\n pipe(\n TARGETS,\n Arr.findFirst(([suffix]) => Str.endsWith(suffix)(file)),\n Option.map(([, platform]) => platform),\n );\n\nconst signed = Effect.gen(function* signed() {\n const fileSystem = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const files = yield* fileSystem.readDirectory(ASSETS, { recursive: true });\n const signatures = pipe(files, Arr.filter(Str.endsWith(SIGNATURE)));\n return pipe(\n signatures,\n Arr.map((signature) => path.join(ASSETS, Str.slice(START, -SIGNATURE.length)(signature))),\n );\n});\n\nconst entryOf = Effect.fn(\"updaterFeed.entryOf\")(function* entryOf(file: string, download: string) {\n const fileSystem = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const signature = yield* fileSystem.readFileString(`${file}${SIGNATURE}`);\n return Option.map(\n platformOf(file),\n (platform) => [platform, { url: `${download}/${path.basename(file)}`, signature }] as const,\n );\n});\n\nconst latestFor = Effect.fn(\"updaterFeed.latestFor\")(function* latestFor(\n tag: string,\n version: string,\n) {\n const repository = yield* Config.String(\"GITHUB_REPOSITORY\");\n const download = `https://github.com/${repository}/releases/download/${tag}`;\n const files = yield* signed;\n const entries = yield* Effect.forEach(files, (file) => entryOf(file, download), {\n concurrency: 1,\n });\n const platforms = Rec.fromEntries(Arr.getSomes(entries));\n if (Rec.isEmptyRecord(platforms)) {\n return yield* Effect.die(`${ASSETS} has no signed installer`);\n }\n const now = yield* DateTime.now;\n return yield* Schema.encodeEffect(LatestJson)({\n version,\n notes: \"\",\n pub_date: DateTime.formatIso(now),\n platforms,\n });\n});\n\nconst ensureFeed = Effect.fn(\"updaterFeed.ensureFeed\")(function* ensureFeed(\n feed: string,\n title: string,\n) {\n const repository = yield* Config.String(\"GITHUB_REPOSITORY\");\n const sha = yield* Config.String(\"GITHUB_SHA\");\n const view = [\"release\", \"view\", feed, \"--repo\", repository];\n if (yield* succeeds({ command: \"gh\", args: view })) {\n return;\n }\n yield* outputOf({\n command: \"gh\",\n args: [\n \"release\",\n \"create\",\n feed,\n \"--repo\",\n repository,\n \"--target\",\n sha,\n \"--latest=false\",\n \"--title\",\n title,\n \"--notes\",\n \"\",\n ],\n });\n});\n\nconst writeLatest = Effect.fn(\"updaterFeed.writeLatest\")(function* writeLatest(\n tag: string,\n version: string,\n) {\n const fileSystem = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const latest = yield* latestFor(tag, version);\n const file = path.join(ASSETS, LATEST);\n yield* fileSystem.writeFileString(file, latest);\n return file;\n});\n\n/** @internal */\nexport const updaterFeed = Effect.gen(function* updaterFeed() {\n const repository = yield* Config.String(\"GITHUB_REPOSITORY\");\n const tag = yield* Config.String(\"RELEASE_TAG\");\n const { name, version } = yield* manifest;\n const file = yield* writeLatest(tag, version);\n const feed = feedOf(name);\n yield* ensureFeed(feed, `${name} updates`);\n yield* outputOf({\n command: \"gh\",\n args: [\"release\", \"upload\", feed, file, \"--repo\", repository, \"--clobber\"],\n });\n});\n","import {\n Array as Arr,\n Config,\n Effect,\n FileSystem,\n Option,\n Path,\n String as Str,\n pipe,\n} from \"effect\";\n\nimport { environmentOf, manifest } from \"#/features/publish-updates/model/manifest.ts\";\nimport { mustSucceed, outputOf } from \"#/shared/lib/process.ts\";\n\nconst SECRET = \"TAURI_SIGNING_PRIVATE_KEY\";\nconst KEY = \"updater.key\";\nconst PUBLIC = \".pub\";\nconst SECRETS_FILE = \"secrets.env\";\n\nconst hasKey = Effect.fn(\"updaterKey.hasKey\")(function* hasKey(environment: string) {\n const present = yield* outputOf({\n command: \"gh\",\n args: [\"api\", `${environment}/secrets`, \"--jq\", \".secrets[].name\"],\n });\n return pipe(present, Str.split(\"\\n\"), Arr.contains(SECRET));\n});\n\nconst generate = Effect.gen(function* generate() {\n const fileSystem = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const directory = yield* fileSystem.makeTempDirectoryScoped();\n const key = path.join(directory, KEY);\n yield* mustSucceed({ command: \"tauri\", args: [\"signer\", \"generate\", \"--ci\", \"-w\", key] });\n const privateKey = yield* fileSystem.readFileString(key);\n const publicKey = yield* fileSystem.readFileString(`${key}${PUBLIC}`);\n return { privateKey, publicKey: Str.trim(publicKey) };\n});\n\nconst store = Effect.fn(\"updaterKey.store\")(function* store(\n repository: string,\n environment: string,\n) {\n const { privateKey, publicKey } = yield* generate;\n const fileSystem = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const directory = yield* fileSystem.makeTempDirectoryScoped();\n const secrets = path.join(directory, SECRETS_FILE);\n yield* fileSystem.writeFileString(secrets, `${SECRET}=\"${Str.trim(privateKey)}\"\\n`);\n yield* outputOf({\n command: \"gh\",\n args: [\"secret\", \"set\", \"--env-file\", secrets, \"--env\", environment, \"--repo\", repository],\n });\n return publicKey;\n});\n\nconst report = Effect.fn(\"updaterKey.report\")(function* report(name: string, publicKey: string) {\n const fileSystem = yield* FileSystem.FileSystem;\n yield* Effect.log(`${name} updater public key: ${publicKey}`);\n const summary = yield* Config.String(\"GITHUB_STEP_SUMMARY\");\n yield* fileSystem.writeFileString(summary, `${name}: \\`${publicKey}\\`\\n`, { flag: \"a\" });\n});\n\nconst ensureKey = Effect.fn(\"updaterKey.ensureKey\")(function* ensureKey(name: string) {\n const repository = yield* Config.String(\"GITHUB_REPOSITORY\");\n const environment = environmentOf(name);\n const api = `repos/${repository}/environments/${environment}`;\n yield* outputOf({ command: \"gh\", args: [\"api\", \"-X\", \"PUT\", api] });\n if (yield* hasKey(api)) {\n return Option.none();\n }\n const publicKey = yield* store(repository, environment);\n return Option.some(publicKey);\n});\n\n/** @internal */\nexport const updaterKey = Effect.gen(function* updaterKey() {\n const { name } = yield* manifest;\n const created = yield* ensureKey(name);\n return yield* Option.match(created, {\n onNone: () =>\n Effect.log(`${environmentOf(name)} already has ${SECRET}; installed apps trust it`),\n onSome: (publicKey) => report(name, publicKey),\n });\n}).pipe(Effect.scoped);\n","import {\n Array as Arr,\n Effect,\n FileSystem,\n Option,\n Path,\n Record as Rec,\n Schema,\n String as Str,\n pipe,\n} from \"effect\";\nimport { Argument, Command } from \"effect/cli\";\n\nimport { runMain } from \"#/app/node-main.ts\";\nimport { updaterFeed, updaterKey } from \"#/features/publish-updates/index.ts\";\nimport { outputOf } from \"#/shared/lib/process.ts\";\n\nconst ASSETS = \"release-assets\";\n\nconst AT_LEAST_ONE = 1;\n\nconst SEPARATOR = \"_\";\n\nconst SIGNATURE = \".sig\";\n\nconst Manifest = Schema.Struct({ name: Schema.String });\n\nconst EXTENSIONS: Readonly<Record<string, string>> = {\n appimage: \".AppImage\",\n deb: \".deb\",\n dmg: \".dmg\",\n msi: \".msi\",\n nsis: \".exe\",\n rpm: \".rpm\",\n};\n\nconst extensionOf = (kind: string): Effect.Effect<string> =>\n pipe(\n Rec.get(EXTENSIONS, kind),\n Option.match({\n onNone: () => Effect.die(`${kind} is not a Tauri bundle kind that ships one file`),\n onSome: Effect.succeed,\n }),\n );\n\nconst bundled = Effect.fn(\"collect.bundled\")(function* bundled(from: string, extension: string) {\n const fileSystem = yield* FileSystem.FileSystem;\n const names = yield* fileSystem.readDirectory(from);\n const files = pipe(\n names,\n Arr.filter(\n (name) => Str.endsWith(extension)(name) || Str.endsWith(`${extension}${SIGNATURE}`)(name),\n ),\n );\n if (!Arr.isReadonlyArrayNonEmpty(files)) {\n return yield* Effect.die(`${from} has no ${extension}`);\n }\n return files;\n});\n\nconst packageName = Effect.fn(\"collect.package\")(function* packageName() {\n const fileSystem = yield* FileSystem.FileSystem;\n const text = yield* fileSystem.readFileString(\"package.json\");\n const manifest = yield* Schema.decodeEffect(Schema.fromJsonString(Manifest))(text);\n return manifest.name;\n});\n\nconst assetName = (name: string, file: string): string =>\n pipe(\n Str.indexOf(SEPARATOR)(file),\n Option.match({\n onNone: () => file,\n onSome: (index) => `${name}${Str.slice(index)(file)}`,\n }),\n );\n\nconst collectKind = Effect.fn(\"collect.kind\")(function* collectKind(\n bundle: string,\n kind: string,\n name: string,\n) {\n const fileSystem = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const extension = yield* extensionOf(kind);\n const from = path.join(bundle, kind);\n const files = yield* bundled(from, extension);\n const to = path.join(ASSETS, kind);\n yield* fileSystem.makeDirectory(to, { recursive: true });\n yield* Effect.forEach(\n files,\n (file) => fileSystem.copyFile(path.join(from, file), path.join(to, assetName(name, file))),\n { concurrency: 1, discard: true },\n );\n});\n\nconst bundleCollectCommand = Command.make(\n \"bundle-collect\",\n { kinds: Argument.String(\"kind\").pipe(Argument.atLeast(AT_LEAST_ONE)) },\n ({ kinds }) =>\n Effect.gen(function* collect() {\n const path = yield* Path.Path;\n const root = yield* outputOf({ command: \"git\", args: [\"rev-parse\", \"--show-toplevel\"] });\n const bundle = path.join(root, \"target\", \"release\", \"bundle\");\n const name = yield* packageName();\n yield* Effect.forEach(kinds, (kind) => collectKind(bundle, kind, name), {\n concurrency: 1,\n discard: true,\n });\n }),\n);\n\nconst release = Command.make(\"desktop-release\").pipe(\n Command.withSubcommands([\n bundleCollectCommand,\n Command.make(\"updater-feed\", {}, () => updaterFeed),\n Command.make(\"updater-key\", {}, () => updaterKey),\n ]),\n);\n\nrunMain(\"desktop-release\")(Command.run(release, { version: \"0.0.0\" }));\n"],"mappings":";;;;;AAEA,MAAMA,aAAW,OAAO,eACtB,OAAO,OAAO;CAAE,MAAM,OAAO;CAAQ,SAAS,OAAO;AAAO,CAAC,CAC/D;;AAGA,MAAa,WAAW,OAAO,IAAI,UAAU,WAAW;CAEtD,MAAM,OAAO,QAAO,OADM,WAAW,WAAA,CACN,eAAe,cAAc;CAC5D,OAAO,OAAO,OAAO,aAAaA,UAAQ,CAAC,CAAC,IAAI;AAClD,CAAC;;AAGD,MAAa,UAAU,SAAyB,GAAG,KAAK;;AAGxD,MAAa,iBAAiB,SAAyB,GAAG,KAAK;;ACA/D,MAAMC,WAAS;AACf,MAAM,SAAS;AACf,MAAMC,cAAY;AAClB,MAAM,QAAQ;AAEd,MAAM,UAAoE;CACxE,CAAC,kBAAkB,gBAAgB;CACnC,CAAC,uBAAuB,gBAAgB;CACxC,CAAC,mBAAmB,cAAc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AC,CAAC,QAAQ,IAAI,SAAS,EAAE,SAAS,QAAQ,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"release-cli.mjs","names":["Manifest","ASSETS","SIGNATURE","Arr","Str","Rec","Str","Arr","Rec","Arr","Str"],"sources":["../../src/features/publish-updates/model/manifest.ts","../../src/features/publish-updates/model/feed.ts","../../src/features/publish-updates/model/key.ts","../../src/app/desktop-release-cli.ts"],"sourcesContent":["import { Effect, FileSystem, Schema } from \"effect\";\n\nconst Manifest = Schema.fromJsonString(\n Schema.Struct({ name: Schema.String, version: Schema.String }),\n);\n\n/** @internal */\nexport const manifest = Effect.gen(function* manifest() {\n const fileSystem = yield* FileSystem.FileSystem;\n const text = yield* fileSystem.readFileString(\"package.json\");\n return yield* Schema.decodeEffect(Manifest)(text);\n});\n\n/** @internal */\nexport const feedOf = (name: string): string => `${name}-updater`;\n\n/** @internal */\nexport const environmentOf = (name: string): string => `${name}-release`;\n","import {\n Array as Arr,\n Config,\n DateTime,\n Effect,\n FileSystem,\n Option,\n Path,\n Record as Rec,\n Schema,\n String as Str,\n pipe,\n} from \"effect\";\n\nimport { feedOf, manifest } from \"#/features/publish-updates/model/manifest.ts\";\nimport { outputOf, succeeds } from \"#/shared/lib/process.ts\";\n\nconst ASSETS = \"release-assets\";\nconst LATEST = \"latest.json\";\nconst SIGNATURE = \".sig\";\nconst START = 0;\n\nconst TARGETS: readonly (readonly [suffix: string, platform: string])[] = [\n [\"_x64-setup.exe\", \"windows-x86_64\"],\n [\"_aarch64.app.tar.gz\", \"darwin-aarch64\"],\n [\"_amd64.AppImage\", \"linux-x86_64\"],\n];\n\nconst Platform = Schema.Struct({ url: Schema.String, signature: Schema.String });\n\nconst LatestJson = Schema.fromJsonString(\n Schema.Struct({\n version: Schema.String,\n notes: Schema.String,\n pub_date: Schema.String,\n platforms: Schema.Record(Schema.String, Platform),\n }),\n);\n\n/** @internal */\nexport const platformOf = (file: string): Option.Option<string> =>\n pipe(\n TARGETS,\n Arr.findFirst(([suffix]) => Str.endsWith(suffix)(file)),\n Option.map(([, platform]) => platform),\n );\n\nconst signed = Effect.gen(function* signed() {\n const fileSystem = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const files = yield* fileSystem.readDirectory(ASSETS, { recursive: true });\n const signatures = pipe(files, Arr.filter(Str.endsWith(SIGNATURE)));\n return pipe(\n signatures,\n Arr.map((signature) => path.join(ASSETS, Str.slice(START, -SIGNATURE.length)(signature))),\n );\n});\n\nconst entryOf = Effect.fn(\"updaterFeed.entryOf\")(function* entryOf(file: string, download: string) {\n const fileSystem = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const signature = yield* fileSystem.readFileString(`${file}${SIGNATURE}`);\n return Option.map(\n platformOf(file),\n (platform) => [platform, { url: `${download}/${path.basename(file)}`, signature }] as const,\n );\n});\n\nconst latestFor = Effect.fn(\"updaterFeed.latestFor\")(function* latestFor(\n tag: string,\n version: string,\n) {\n const repository = yield* Config.String(\"GITHUB_REPOSITORY\");\n const download = `https://github.com/${repository}/releases/download/${tag}`;\n const files = yield* signed;\n const entries = yield* Effect.forEach(files, (file) => entryOf(file, download), {\n concurrency: 1,\n });\n const platforms = Rec.fromEntries(Arr.getSomes(entries));\n if (Rec.isEmptyRecord(platforms)) {\n return yield* Effect.die(`${ASSETS} has no signed installer`);\n }\n const now = yield* DateTime.now;\n return yield* Schema.encodeEffect(LatestJson)({\n version,\n notes: \"\",\n pub_date: DateTime.formatIso(now),\n platforms,\n });\n});\n\nconst ensureFeed = Effect.fn(\"updaterFeed.ensureFeed\")(function* ensureFeed(\n feed: string,\n title: string,\n) {\n const repository = yield* Config.String(\"GITHUB_REPOSITORY\");\n const sha = yield* Config.String(\"GITHUB_SHA\");\n const view = [\"release\", \"view\", feed, \"--repo\", repository];\n if (yield* succeeds({ command: \"gh\", args: view })) {\n return;\n }\n yield* outputOf({\n command: \"gh\",\n args: [\n \"release\",\n \"create\",\n feed,\n \"--repo\",\n repository,\n \"--target\",\n sha,\n \"--latest=false\",\n \"--title\",\n title,\n \"--notes\",\n \"\",\n ],\n });\n});\n\nconst writeLatest = Effect.fn(\"updaterFeed.writeLatest\")(function* writeLatest(\n tag: string,\n version: string,\n) {\n const fileSystem = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const latest = yield* latestFor(tag, version);\n const file = path.join(ASSETS, LATEST);\n yield* fileSystem.writeFileString(file, latest);\n return file;\n});\n\n/** @internal */\nexport const updaterFeed = Effect.gen(function* updaterFeed() {\n const repository = yield* Config.String(\"GITHUB_REPOSITORY\");\n const tag = yield* Config.String(\"RELEASE_TAG\");\n const { name, version } = yield* manifest;\n const file = yield* writeLatest(tag, version);\n const feed = feedOf(name);\n yield* ensureFeed(feed, `${name} updates`);\n yield* outputOf({\n command: \"gh\",\n args: [\"release\", \"upload\", feed, file, \"--repo\", repository, \"--clobber\"],\n });\n});\n","import {\n Array as Arr,\n Config,\n Effect,\n FileSystem,\n Option,\n Path,\n String as Str,\n pipe,\n} from \"effect\";\n\nimport { environmentOf, manifest } from \"#/features/publish-updates/model/manifest.ts\";\nimport { mustSucceed, outputOf } from \"#/shared/lib/process.ts\";\n\nconst SECRET = \"TAURI_SIGNING_PRIVATE_KEY\";\nconst KEY = \"updater.key\";\nconst PUBLIC = \".pub\";\nconst SECRETS_FILE = \"secrets.env\";\n\nconst hasKey = Effect.fn(\"updaterKey.hasKey\")(function* hasKey(environment: string) {\n const present = yield* outputOf({\n command: \"gh\",\n args: [\"api\", `${environment}/secrets`, \"--jq\", \".secrets[].name\"],\n });\n return pipe(present, Str.split(\"\\n\"), Arr.contains(SECRET));\n});\n\nconst generate = Effect.gen(function* generate() {\n const fileSystem = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const directory = yield* fileSystem.makeTempDirectoryScoped();\n const key = path.join(directory, KEY);\n yield* mustSucceed({ command: \"tauri\", args: [\"signer\", \"generate\", \"--ci\", \"-w\", key] });\n const privateKey = yield* fileSystem.readFileString(key);\n const publicKey = yield* fileSystem.readFileString(`${key}${PUBLIC}`);\n return { privateKey, publicKey: Str.trim(publicKey) };\n});\n\nconst store = Effect.fn(\"updaterKey.store\")(function* store(\n repository: string,\n environment: string,\n) {\n const { privateKey, publicKey } = yield* generate;\n const fileSystem = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const directory = yield* fileSystem.makeTempDirectoryScoped();\n const secrets = path.join(directory, SECRETS_FILE);\n yield* fileSystem.writeFileString(secrets, `${SECRET}=\"${Str.trim(privateKey)}\"\\n`);\n yield* outputOf({\n command: \"gh\",\n args: [\"secret\", \"set\", \"--env-file\", secrets, \"--env\", environment, \"--repo\", repository],\n });\n return publicKey;\n});\n\nconst report = Effect.fn(\"updaterKey.report\")(function* report(name: string, publicKey: string) {\n const fileSystem = yield* FileSystem.FileSystem;\n yield* Effect.log(`${name} updater public key: ${publicKey}`);\n const summary = yield* Config.String(\"GITHUB_STEP_SUMMARY\");\n yield* fileSystem.writeFileString(summary, `${name}: \\`${publicKey}\\`\\n`, { flag: \"a\" });\n});\n\nconst ensureKey = Effect.fn(\"updaterKey.ensureKey\")(function* ensureKey(name: string) {\n const repository = yield* Config.String(\"GITHUB_REPOSITORY\");\n const environment = environmentOf(name);\n const api = `repos/${repository}/environments/${environment}`;\n yield* outputOf({ command: \"gh\", args: [\"api\", \"-X\", \"PUT\", api] });\n if (yield* hasKey(api)) {\n return Option.none();\n }\n const publicKey = yield* store(repository, environment);\n return Option.some(publicKey);\n});\n\n/** @internal */\nexport const updaterKey = Effect.gen(function* updaterKey() {\n const { name } = yield* manifest;\n const created = yield* ensureKey(name);\n return yield* Option.match(created, {\n onNone: () =>\n Effect.log(`${environmentOf(name)} already has ${SECRET}; installed apps trust it`),\n onSome: (publicKey) => report(name, publicKey),\n });\n}).pipe(Effect.scoped);\n","import {\n Array as Arr,\n Effect,\n FileSystem,\n Option,\n Path,\n Record as Rec,\n Schema,\n String as Str,\n pipe,\n} from \"effect\";\nimport { Argument, Command } from \"effect/cli\";\n\nimport { runMain } from \"#/app/node-main.ts\";\nimport { updaterFeed, updaterKey } from \"#/features/publish-updates/index.ts\";\nimport { outputOf } from \"#/shared/lib/process.ts\";\n\nconst ASSETS = \"release-assets\";\n\nconst AT_LEAST_ONE = 1;\n\nconst SEPARATOR = \"_\";\n\nconst SIGNATURE = \".sig\";\n\nconst Manifest = Schema.Struct({ name: Schema.String });\n\nconst EXTENSIONS: Readonly<Record<string, string>> = {\n appimage: \".AppImage\",\n deb: \".deb\",\n dmg: \".dmg\",\n msi: \".msi\",\n nsis: \".exe\",\n rpm: \".rpm\",\n};\n\nconst extensionOf = (kind: string): Effect.Effect<string> =>\n pipe(\n Rec.get(EXTENSIONS, kind),\n Option.match({\n onNone: () => Effect.die(`${kind} is not a Tauri bundle kind that ships one file`),\n onSome: Effect.succeed,\n }),\n );\n\nconst bundled = Effect.fn(\"collect.bundled\")(function* bundled(from: string, extension: string) {\n const fileSystem = yield* FileSystem.FileSystem;\n const names = yield* fileSystem.readDirectory(from);\n const files = pipe(\n names,\n Arr.filter(\n (name) => Str.endsWith(extension)(name) || Str.endsWith(`${extension}${SIGNATURE}`)(name),\n ),\n );\n if (!Arr.isReadonlyArrayNonEmpty(files)) {\n return yield* Effect.die(`${from} has no ${extension}`);\n }\n return files;\n});\n\nconst packageName = Effect.fn(\"collect.package\")(function* packageName() {\n const fileSystem = yield* FileSystem.FileSystem;\n const text = yield* fileSystem.readFileString(\"package.json\");\n const manifest = yield* Schema.decodeEffect(Schema.fromJsonString(Manifest))(text);\n return manifest.name;\n});\n\nconst assetName = (name: string, file: string): string =>\n pipe(\n Str.indexOf(SEPARATOR)(file),\n Option.match({\n onNone: () => file,\n onSome: (index) => `${name}${Str.slice(index)(file)}`,\n }),\n );\n\nconst collectKind = Effect.fn(\"collect.kind\")(function* collectKind(\n bundle: string,\n kind: string,\n name: string,\n) {\n const fileSystem = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const extension = yield* extensionOf(kind);\n const from = path.join(bundle, kind);\n const files = yield* bundled(from, extension);\n const to = path.join(ASSETS, kind);\n yield* fileSystem.makeDirectory(to, { recursive: true });\n yield* Effect.forEach(\n files,\n (file) => fileSystem.copyFile(path.join(from, file), path.join(to, assetName(name, file))),\n { concurrency: 1, discard: true },\n );\n});\n\nconst bundleCollectCommand = Command.make(\n \"bundle-collect\",\n { kinds: Argument.String(\"kind\").pipe(Argument.atLeast(AT_LEAST_ONE)) },\n ({ kinds }) =>\n Effect.gen(function* collect() {\n const path = yield* Path.Path;\n const root = yield* outputOf({ command: \"git\", args: [\"rev-parse\", \"--show-toplevel\"] });\n const bundle = path.join(root, \"target\", \"release\", \"bundle\");\n const name = yield* packageName();\n yield* Effect.forEach(kinds, (kind) => collectKind(bundle, kind, name), {\n concurrency: 1,\n discard: true,\n });\n }),\n);\n\nconst release = Command.make(\"desktop-release\").pipe(\n Command.withSubcommands([\n bundleCollectCommand,\n Command.make(\"updater-feed\", {}, () => updaterFeed),\n Command.make(\"updater-key\", {}, () => updaterKey),\n ]),\n);\n\nrelease.pipe(Command.run({ version: \"0.0.0\" }), runMain(\"desktop-release\"));\n"],"mappings":";;;;;AAEA,MAAMA,aAAW,OAAO,eACtB,OAAO,OAAO;CAAE,MAAM,OAAO;CAAQ,SAAS,OAAO;AAAO,CAAC,CAC/D;;AAGA,MAAa,WAAW,OAAO,IAAI,UAAU,WAAW;CAEtD,MAAM,OAAO,QAAO,OADM,WAAW,WAAA,CACN,eAAe,cAAc;CAC5D,OAAO,OAAO,OAAO,aAAaA,UAAQ,CAAC,CAAC,IAAI;AAClD,CAAC;;AAGD,MAAa,UAAU,SAAyB,GAAG,KAAK;;AAGxD,MAAa,iBAAiB,SAAyB,GAAG,KAAK;;ACA/D,MAAMC,WAAS;AACf,MAAM,SAAS;AACf,MAAMC,cAAY;AAClB,MAAM,QAAQ;AAEd,MAAM,UAAoE;CACxE,CAAC,kBAAkB,gBAAgB;CACnC,CAAC,uBAAuB,gBAAgB;CACxC,CAAC,mBAAmB,cAAc;AACpC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AS,QAAQ,CAAC,GAAG,QAAQ,iBAAiB,CAAC"}
|
|
@@ -37,9 +37,9 @@ const SERVER_RESPONSE_HEADERS = {
|
|
|
37
37
|
OBJECT_SOURCE_NONE
|
|
38
38
|
], Array.join("; "))
|
|
39
39
|
};
|
|
40
|
-
const workerDirective = (worker) =>
|
|
41
|
-
const frameDirective = (frame) =>
|
|
42
|
-
const fontDirective = (font) =>
|
|
40
|
+
const workerDirective = (worker) => Option.fromNullishOr(worker).pipe(Option.map((sources) => pipe(["worker-src 'self'", ...sources], Array.join(" "))), Array.fromOption);
|
|
41
|
+
const frameDirective = (frame) => Option.fromNullishOr(frame).pipe(Option.map((sources) => pipe(["frame-src", ...sources], Array.join(" "))), Array.fromOption);
|
|
42
|
+
const fontDirective = (font) => Option.fromNullishOr(font).pipe(Option.map((sources) => pipe(["font-src 'self'", ...sources], Array.join(" "))), Array.fromOption);
|
|
43
43
|
const contentSecurityPolicy = ({ script, style, worker, font, frame, image = [], styleAttr = false, report = false }) => pipe([
|
|
44
44
|
"default-src 'self'",
|
|
45
45
|
pipe([
|
|
@@ -112,4 +112,4 @@ const assetHeaders = ({ page, base = "" }) => pipe([
|
|
|
112
112
|
], Array.join("\n"));
|
|
113
113
|
export { SECURITY_HEADERS_EMBEDDING as a, SPECULATION_RULES_FILE as c, contentSecurityPolicy as d, serverPageHeaders as f, SECURITY_HEADERS_CREDENTIALLESS as i, STATIC_PAGE_HEADERS as l, EMBEDDED_VIDEO_SOURCES as n, SERVER_PAGE_HEADERS as o, SECURITY_HEADERS as r, SERVER_RESPONSE_HEADERS as s, ASSET_CACHE_CONTROL as t, assetHeaders as u };
|
|
114
114
|
|
|
115
|
-
//# sourceMappingURL=headers-
|
|
115
|
+
//# sourceMappingURL=headers-B6rDlN_n.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"headers-B6rDlN_n.mjs","names":["Arr","Rec"],"sources":["../src/entities/policy/model/headers.ts"],"sourcesContent":["import { Array as Arr, Option, Record as Rec, pipe } from \"effect\";\n\nimport { WEB_ANALYTICS_REPORT_ORIGIN, WEB_ANALYTICS_SCRIPT_ORIGIN } from \"#/shared/config/index.ts\";\n\nconst SECURITY_HEADERS_BASE = {\n \"Strict-Transport-Security\": \"max-age=31536000; includeSubDomains\",\n \"X-Content-Type-Options\": \"nosniff\",\n \"X-Frame-Options\": \"DENY\",\n \"Referrer-Policy\": \"strict-origin-when-cross-origin\",\n \"Permissions-Policy\": \"camera=(), geolocation=(), microphone=(), payment=(), usb=()\",\n} as const;\n\nexport const SECURITY_HEADERS = {\n ...SECURITY_HEADERS_BASE,\n \"Cross-Origin-Opener-Policy\": \"same-origin\",\n \"Cross-Origin-Embedder-Policy\": \"require-corp\",\n \"Cross-Origin-Resource-Policy\": \"same-origin\",\n} as const;\n\nexport const SECURITY_HEADERS_CREDENTIALLESS = {\n ...SECURITY_HEADERS,\n \"Cross-Origin-Embedder-Policy\": \"credentialless\",\n} as const;\n\nexport const SECURITY_HEADERS_EMBEDDING = {\n ...SECURITY_HEADERS_BASE,\n \"Cross-Origin-Opener-Policy\": \"same-origin\",\n \"Cross-Origin-Resource-Policy\": \"same-origin\",\n} as const;\n\nexport const ASSET_CACHE_CONTROL = \"public, max-age=31536000, immutable\";\n\nconst OBJECT_SOURCE_NONE = \"object-src 'none'\";\n\nconst BASE_URI_NONE = \"base-uri 'none'\";\n\nconst FRAME_ANCESTORS_NONE = \"frame-ancestors 'none'\";\n\nconst REPORT_ENDPOINT = \"default\";\n\nconst REPORT_TO = `report-to ${REPORT_ENDPOINT}`;\n\nexport const SERVER_RESPONSE_HEADERS = {\n ...SECURITY_HEADERS_BASE,\n \"Content-Security-Policy\": pipe(\n [FRAME_ANCESTORS_NONE, BASE_URI_NONE, OBJECT_SOURCE_NONE],\n Arr.join(\"; \"),\n ),\n} as const;\n\nconst workerDirective = (worker: readonly string[] | undefined): readonly string[] =>\n Option.fromNullishOr(worker).pipe(\n Option.map((sources) => pipe([\"worker-src 'self'\", ...sources], Arr.join(\" \"))),\n Arr.fromOption,\n );\n\nconst frameDirective = (frame: readonly string[] | undefined): readonly string[] =>\n Option.fromNullishOr(frame).pipe(\n Option.map((sources) => pipe([\"frame-src\", ...sources], Arr.join(\" \"))),\n Arr.fromOption,\n );\n\nconst fontDirective = (font: readonly string[] | undefined): readonly string[] =>\n Option.fromNullishOr(font).pipe(\n Option.map((sources) => pipe([\"font-src 'self'\", ...sources], Arr.join(\" \"))),\n Arr.fromOption,\n );\n\nexport const contentSecurityPolicy = ({\n script,\n style,\n worker,\n font,\n frame,\n image = [],\n styleAttr = false,\n report = false,\n}: Readonly<{\n script: readonly string[];\n style: readonly string[];\n worker?: readonly string[];\n font?: readonly string[];\n frame?: readonly string[];\n image?: readonly string[];\n styleAttr?: boolean;\n report?: boolean;\n}>): string =>\n pipe(\n [\n \"default-src 'self'\",\n pipe([\"script-src 'self'\", WEB_ANALYTICS_SCRIPT_ORIGIN, ...script], Arr.join(\" \")),\n pipe([\"style-src 'self'\", ...style], Arr.join(\" \")),\n ...Arr.fromOption(Option.liftPredicate(\"style-src-attr 'unsafe-inline'\", () => styleAttr)),\n ...workerDirective(worker),\n ...fontDirective(font),\n ...frameDirective(frame),\n pipe([\"img-src 'self' data:\", ...image], Arr.join(\" \")),\n `connect-src 'self' ${WEB_ANALYTICS_REPORT_ORIGIN}`,\n OBJECT_SOURCE_NONE,\n BASE_URI_NONE,\n \"form-action 'self'\",\n FRAME_ANCESTORS_NONE,\n ...Arr.fromOption(Option.liftPredicate(REPORT_TO, () => report)),\n ],\n Arr.join(\"; \"),\n );\n\nexport const STATIC_PAGE_HEADERS = {\n ...SECURITY_HEADERS,\n \"Content-Security-Policy\": contentSecurityPolicy({\n script: [\"'wasm-unsafe-eval'\"],\n style: [],\n worker: [\"blob:\"],\n }),\n} as const;\n\nexport interface PageSources {\n readonly image?: readonly string[];\n readonly frame?: readonly string[];\n readonly script?: readonly string[];\n readonly font?: readonly string[];\n readonly report?: string;\n readonly speculationRules?: string;\n}\n\nconst isolationOf = (frame: readonly string[] | undefined): Readonly<Record<string, string>> =>\n Option.match(Option.fromNullishOr(frame), {\n onNone: () => SECURITY_HEADERS_CREDENTIALLESS,\n onSome: () => SECURITY_HEADERS_EMBEDDING,\n });\n\nconst reportingOf = (report: string | undefined): Readonly<Record<string, string>> =>\n Option.match(Option.fromNullishOr(report), {\n onNone: () => ({}),\n onSome: (url) => ({ \"Reporting-Endpoints\": `${REPORT_ENDPOINT}=\"${url}\"` }),\n });\n\nconst speculationOf = (url: string | undefined): Readonly<Record<string, string>> =>\n Option.match(Option.fromNullishOr(url), {\n onNone: () => ({}),\n onSome: (rules) => ({ \"Speculation-Rules\": `\"${rules}\"` }),\n });\n\nexport const serverPageHeaders = ({\n image = [],\n script = [],\n frame,\n font,\n report,\n speculationRules,\n}: PageSources): Readonly<Record<string, string>> => ({\n ...isolationOf(frame),\n ...reportingOf(report),\n ...speculationOf(speculationRules),\n \"Content-Security-Policy\": contentSecurityPolicy({\n script,\n style: [],\n image: [\"blob:\", ...image],\n styleAttr: true,\n report: Option.isSome(Option.fromNullishOr(report)),\n ...Rec.getSomes({ frame: Option.fromNullishOr(frame), font: Option.fromNullishOr(font) }),\n }),\n});\n\nexport const SERVER_PAGE_HEADERS = serverPageHeaders({});\n\nexport const EMBEDDED_VIDEO_SOURCES = {\n image: [\"https://i.ytimg.com\", \"https://nicovideo.cdn.nimg.jp\"],\n frame: [\"https://embed.nicovideo.jp\", \"https://www.youtube-nocookie.com\"],\n font: [\"data:\"],\n} as const satisfies PageSources;\n\nexport const SPECULATION_RULES_FILE = \"_speculation-rules\";\n\nexport const assetHeaders = ({\n page,\n base = \"\",\n}: Readonly<{ page: Readonly<Record<string, string>>; base?: string }>): string =>\n pipe(\n [\n `${base}/*`,\n ...pipe(\n Rec.toEntries(page),\n Arr.map(([name, value]) => ` ${name}: ${value}`),\n ),\n `${base}/assets/*`,\n ` Cache-Control: ${ASSET_CACHE_CONTROL}`,\n \"\",\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