Walrus blob · mainnet
On-chain registration not yet visible.
The aggregator served this blob, but we couldn't locate a matching BlobRegistered event in our scan window. It may not be certified yet, or live further back than we paged.
Lifecycle data is unavailable until the blob registration is visible on-chain.
import { c as R, R as m, I as k, J as C, K as f, r as h, j as e, W as j, e as S } from "./index-CeMnqBop.js";
import { B as D } from "./BackToHome-CrY6H5R9.js";
import { P as v } from "./plus-BGWgGpya.js";
import { C as w } from "./calendar-gPOPf2W1.js";
import { T as E } from "./tag-BV48nm7u.js";
import { T } from "./trash-2-XZz4bnYZ.js";
import { C as P } from "./chevron-right-DgqGwI-L.js";
/**
* @license lucide-react v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
const O = R("ChartPie", [["path", { d: "M21 12c.552 0 1.005-.449.95-.998a10 10 0 0 0-8.953-8.951c-.55-.055-.998.398-.998.95v8a1 1 0 0 0 1 1z", key: "pzmjnu" }], ["path", { d: "M21.21 15.89A10 10 0 1 1 8 2.83", key: "k2fpak" }]]);
function I(r, t, o) {
let d, p;
typeof r == "function" ? (d = t || [], p = o) : (d = [], p = t);
const l = m.useRef({ hasResult: false, result: p, error: null }), [g, x] = m.useReducer((a) => a + 1, 0), b = m.useMemo(() => {
const a = typeof r == "function" ? r() : r;
if (!a || typeof a.subscribe != "function") throw r === a ? new TypeError("Given argument to useObservable() was neither a valid observable nor a function.") : new TypeError("Observable factory given to useObservable() did not return a valid observable.");
if (!l.current.hasResult && typeof window < "u" && (typeof a.hasValue != "function" || a.hasValue())) if (typeof a.getValue == "function") l.current.result = a.getValue(), l.current.hasResult = true;
else {
const n = a.subscribe((i) => {
l.current.result = i, l.current.hasResult = true;
});
typeof n == "function" ? n() : n.unsubscribe();
}
return a;
}, d);
if (m.useDebugValue(l.current.result), m.useEffect(() => {
const a = b.subscribe((n) => {
const { current: i } = l;
(i.error !== null || i.result !== n) && (i.error = null, i.result = n, i.hasResult = true, x());
}, (n) => {
const { current: i } = l;
i.error !== n && (i.error = n, x());
});
return typeof a == "function" ? a : a.unsubscribe.bind(a);
}, d), l.current.error) throw l.current.error;
return l.current.result;
}
function A(r, t, o) {
return I(() => k.liveQuery(r), t || [], o);
}
typeof FinalizationRegistry < "u" && new FinalizationRegistry((r) => {
const t = k.DexieYProvider;
t && t.release(r);
});
Reflect.get(C, "use");
async function B(r) {
await f().expenses.put(r);
}
async function V() {
const r = localStorage.getItem("expenses");
if (r) try {
const t = JSON.parse(r);
t.length > 0 && (await f().expenses.bulkPut(t), localStorage.removeItem("expenses"));
} catch (t) {
console.error("Failed to migrate expenses from localStorage", t);
}
return f().expenses.orderBy("date").reverse().toArray();
}
async function J(r) {
await f().expenses.delete(r);
}
function M(r) {
return r.reduce((t, o) => (t[o.category] = (t[o.category] || 0) + o.amount, t), {});
}
const N = ["\u98DF\u8CBB", "\u4EA4\u901A\u8CBB", "\u5149\u71B1\u8CBB", "\u30A8\u30F3\u30BF\u30E1", "\u30B7\u30E7\u30C3\u30D4\u30F3\u30B0", "\u305D\u306E\u4ED6"];
function H() {
const r = A(() => V(), []), [t, o] = h.useState(""), [d, p] = h.useState(N[0]), [l, g] = h.useState(""), [x, b] = h.useState((/* @__PURE__ */ new Date()).toISOString().split("T")[0]), a = (s) => new Intl.NumberFormat("ja-JP", { style: "currency", currency: "JPY" }).format(s), n = async (s) => {
if (s.preventDefault(), !t || isNaN(Number(t))) return;
const c = { id: Date.now().toString(), date: x, amount: Number(t), category: d, description: l };
await B(c), o(""), g("");
}, i = async (s) => {
confirm("\u3053\u306E\u652F\u51FA\u8A18\u9332\u3092\u524A\u9664\u3057\u307E\u3059\u304B\uFF1F") && await J(s);
}, u = r || [], z = M(u), y = u.reduce((s, c) => s + c.amount, 0);
return e.jsxs("div", { className: "max-w-6xl mx-auto space-y-8 animate-in fade-in slide-in-from-bottom-4 duration-700 relative pt-16 pb-20", children: [e.jsx(D, { className: "text-zinc-800 dark:text-zinc-200" }), e.jsxs("header", { className: "text-center space-y-2", children: [e.jsx("div", { className: "inline-flex items-center justify-center w-16 h-16 rounded-2xl bg-purple-500/10 text-purple-500 mb-4", children: e.jsx(j, { size: 32 }) }), e.jsx("h1", { className: "text-4xl font-black tracking-tight", children: "\u652F\u51FA\u30DE\u30CD\u30FC\u30B8\u30E3\u30FC" }), e.jsx("p", { className: "opacity-60 text-lg", children: "\u8CC7\u7523\u3092\u5B88\u308B\u305F\u3081\u306E\u7B2C\u4E00\u6B69\u3002\u3059\u3079\u3066\u306E\u30C7\u30FC\u30BF\u306F\u6697\u53F7\u5316\u3055\u308C\u540C\u671F\u3055\u308C\u307E\u3059\u3002" })] }), e.jsxs("div", { className: "grid grid-cols-1 lg:grid-cols-12 gap-8", children: [e.jsx("div", { className: "lg:col-span-4 space-y-6", children: e.jsxs("section", { className: "glass p-8 rounded-3xl border border-white/10 shadow-2xl relative overflow-hidden group", children: [e.jsx("div", { className: "absolute top-0 right-0 w-32 h-32 bg-purple-500/5 rounded-full -mr-16 -mt-16 blur-3xl group-hover:bg-purple-500/10 transition-colors duration-500" }), e.jsxs("h2", { className: "text-xl font-bold mb-6 flex items-center gap-2", children: [e.jsx(v, { size: 20, className: "text-purple-500" }), "\u65B0\u898F\u652F\u51FA\u3092\u8A18\u9332"] }), e.jsxs("form", { onSubmit: n, className: "space-y-5", children: [e.jsxs("div", { className: "space-y-1.5", children: [e.jsxs("label", { className: "text-xs font-bold uppercase tracking-wider opacity-50 flex items-center gap-1.5", children: [e.jsx(w, { size: 12 }), " \u65E5\u4ED8"] }), e.jsx("input", { type: "date", value: x, onChange: (s) => b(s.target.value), className: "w-full px-4 py-3 bg-white/5 border border-white/10 rounded-xl focus:ring-2 focus:ring-purple-500/50 outline-none transition-all", required: true })] }), e.jsxs("div", { className: "space-y-1.5", children: [e.jsxs("label", { className: "text-xs font-bold uppercase tracking-wider opacity-50 flex items-center gap-1.5", children: [e.jsx(E, { size: 12 }), " \u30AB\u30C6\u30B4\u30EA\u30FC"] }), e.jsx("select", { value: d, onChange: (s) => p(s.target.value), className: "w-full px-4 py-3 bg-white/5 border border-white/10 rounded-xl focus:ring-2 focus:ring-purple-500/50 outline-none transition-all appearance-none cursor-pointer", children: N.map((s) => e.jsx("option", { value: s, className: "bg-zinc-900", children: s }, s)) })] }), e.jsxs("div", { className: "space-y-1.5", children: [e.jsxs("label", { className: "text-xs font-bold uppercase tracking-wider opacity-50 flex items-center gap-1.5", children: [e.jsx(S, { size: 12 }), " \u8A73\u7D30"] }), e.jsx("input", { type: "text", value: l, onChange: (s) => g(s.target.value), className: "w-full px-4 py-3 bg-white/5 border border-white/10 rounded-xl focus:ring-2 focus:ring-purple-500/50 outline-none transition-all", placeholder: "\u4F8B\uFF1A\u30B9\u30FC\u30D1\u30FC\u3067\u306E\u8CB7\u3044\u7269", required: true })] }), e.jsxs("div", { className: "space-y-1.5", children: [e.jsxs("label", { className: "text-xs font-bold uppercase tracking-wider opacity-50 flex items-center gap-1.5", children: [e.jsx("span", { className: "text-purple-500", children: "\xA5" }), " \u91D1\u984D"] }), e.jsx("input", { type: "number", value: t, onChange: (s) => o(s.target.value), className: "w-full px-4 py-4 bg-purple-500/5 border border-purple-500/20 rounded-xl text-2xl font-bold focus:ring-2 focus:ring-purple-500 outline-none transition-all placeholder:opacity-20", placeholder: "0", required: true })] }), e.jsxs("button", { type: "submit", className: "w-full py-4 px-6 bg-purple-600 hover:bg-purple-500 text-white font-bold rounded-xl shadow-lg shadow-purple-500/20 transition-all active:scale-[0.98] mt-4 flex items-center justify-center gap-2", children: [e.jsx(v, { size: 20 }), "\u8A18\u9332\u3059\u308B"] })] })] }) }), e.jsxs("div", { className: "lg:col-span-8 space-y-6", children: [e.jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-6", children: [e.jsxs("div", { className: "glass p-8 rounded-3xl border border-white/10 shadow-xl bg-gradient-to-br from-purple-500/10 to-transparent", children: [e.jsx("div", { className: "text-sm font-bold uppercase tracking-widest opacity-50 mb-2", children: "\u7DCF\u652F\u51FA\u984D" }), e.jsx("div", { className: "text-5xl font-black text-purple-500 tracking-tighter", children: a(y) })] }), e.jsxs("div", { className: "glass p-8 rounded-3xl border border-white/10 shadow-xl", children: [e.jsxs("h3", { className: "text-sm font-bold uppercase tracking-widest opacity-50 mb-4 flex items-center gap-2", children: [e.jsx(O, { size: 16 }), " \u30AB\u30C6\u30B4\u30EA\u30FC\u5225\u5185\u8A33"] }), e.jsxs("div", { className: "space-y-4", children: [Object.entries(z).sort(([, s], [, c]) => c - s).slice(0, 3).map(([s, c]) => e.jsxs("div", { className: "space-y-1", children: [e.jsxs("div", { className: "flex justify-between items-center text-sm", children: [e.jsx("span", { className: "font-bold", children: s }), e.jsx("span", { className: "opacity-80", children: a(c) })] }), e.jsx("div", { className: "w-full h-1.5 bg-white/5 rounded-full overflow-hidden", children: e.jsx("div", { className: "h-full bg-purple-500 rounded-full", style: { width: `${c / y * 100}%` } }) })] }, s)), u.length === 0 && e.jsx("div", { className: "text-sm opacity-30 italic py-2 text-center", children: "\u30C7\u30FC\u30BF\u304C\u3042\u308A\u307E\u305B\u3093" })] })] })] }), e.jsxs("div", { className: "glass rounded-3xl border border-white/10 shadow-xl overflow-hidden", children: [e.jsxs("div", { className: "p-6 border-b border-white/10 flex justify-between items-center", children: [e.jsx("h3", { className: "font-bold text-xl", children: "\u652F\u51FA\u5C65\u6B74" }), e.jsxs("span", { className: "text-xs bg-white/5 px-3 py-1 rounded-full opacity-60", children: ["\u5168 ", u.length, " \u4EF6"] })] }), e.jsx("div", { className: "divide-y divide-white/5 max-h-[600px] overflow-y-auto", children: u.length === 0 ? e.jsxs("div", { className: "text-center py-20 opacity-30 flex flex-col items-center gap-4", children: [e.jsx(j, { size: 48, strokeWidth: 1 }), e.jsx("p", { children: "\u307E\u3060\u8A18\u9332\u304C\u3042\u308A\u307E\u305B\u3093" })] }) : u.map((s) => e.jsxs("div", { className: "flex items-center justify-between p-5 hover:bg-white/5 transition-colors group", children: [e.jsxs("div", { className: "flex items-center gap-4", children: [e.jsx("div", { className: "w-12 h-12 rounded-xl bg-white/5 flex items-center justify-center font-bold text-purple-500 border border-white/10", children: s.category[0] }), e.jsxs("div", { children: [e.jsx("div", { className: "font-bold text-lg", children: s.description }), e.jsxs("div", { className: "text-xs flex items-center gap-2 opacity-50 mt-1", children: [e.jsx(w, { size: 12 }), " ", s.date, e.jsx("span", { className: "w-1 h-1 bg-white/20 rounded-full" }), s.category] })] })] }), e.jsxs("div", { className: "flex items-center gap-6", children: [e.jsx("div", { className: "text-right", children: e.jsx("div", { className: "font-black text-xl", children: a(s.amount) }) }), e.jsx("button", { onClick: () => i(s.id), className: "p-3 text-red-400/50 hover:text-red-400 hover:bg-red-400/10 rounded-xl transition-all opacity-0 group-hover:opacity-100", "aria-label": "Delete", children: e.jsx(T, { size: 20 }) }), e.jsx(P, { size: 18, className: "opacity-10 group-hover:opacity-30 transition-opacity" })] })] }, s.id)) })] })] })] })] });
}
export {
H as default
};