@vectorize-io/hindsight-control-plane 0.8.0 → 0.8.1
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/package.json +1 -1
- package/standalone/.next/BUILD_ID +1 -1
- package/standalone/.next/build-manifest.json +3 -3
- package/standalone/.next/prerender-manifest.json +3 -3
- package/standalone/.next/server/app/[locale]/banks/[bankId]/page_client-reference-manifest.js +1 -1
- package/standalone/.next/server/app/[locale]/dashboard/page_client-reference-manifest.js +1 -1
- package/standalone/.next/server/app/[locale]/login/page_client-reference-manifest.js +1 -1
- package/standalone/.next/server/app/[locale]/page_client-reference-manifest.js +1 -1
- package/standalone/.next/server/app/_global-error.html +1 -1
- package/standalone/.next/server/app/_global-error.rsc +1 -1
- package/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/standalone/.next/server/app/_not-found.html +1 -1
- package/standalone/.next/server/app/_not-found.rsc +2 -2
- package/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
- package/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
- package/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/standalone/.next/server/app/de/dashboard.html +1 -1
- package/standalone/.next/server/app/de/dashboard.rsc +9 -9
- package/standalone/.next/server/app/de/dashboard.segments/$d$locale/dashboard/__PAGE__.segment.rsc +2 -2
- package/standalone/.next/server/app/de/dashboard.segments/$d$locale/dashboard.segment.rsc +1 -1
- package/standalone/.next/server/app/de/dashboard.segments/$d$locale.segment.rsc +6 -6
- package/standalone/.next/server/app/de/dashboard.segments/_full.segment.rsc +9 -9
- package/standalone/.next/server/app/de/dashboard.segments/_head.segment.rsc +1 -1
- package/standalone/.next/server/app/de/dashboard.segments/_index.segment.rsc +2 -2
- package/standalone/.next/server/app/de/dashboard.segments/_tree.segment.rsc +2 -2
- package/standalone/.next/server/app/de/login.html +1 -1
- package/standalone/.next/server/app/de/login.rsc +9 -9
- package/standalone/.next/server/app/de/login.segments/$d$locale/login/__PAGE__.segment.rsc +2 -2
- package/standalone/.next/server/app/de/login.segments/$d$locale/login.segment.rsc +1 -1
- package/standalone/.next/server/app/de/login.segments/$d$locale.segment.rsc +6 -6
- package/standalone/.next/server/app/de/login.segments/_full.segment.rsc +9 -9
- package/standalone/.next/server/app/de/login.segments/_head.segment.rsc +1 -1
- package/standalone/.next/server/app/de/login.segments/_index.segment.rsc +2 -2
- package/standalone/.next/server/app/de/login.segments/_tree.segment.rsc +2 -2
- package/standalone/.next/server/app/en/dashboard.html +1 -1
- package/standalone/.next/server/app/en/dashboard.rsc +9 -9
- package/standalone/.next/server/app/en/dashboard.segments/$d$locale/dashboard/__PAGE__.segment.rsc +2 -2
- package/standalone/.next/server/app/en/dashboard.segments/$d$locale/dashboard.segment.rsc +1 -1
- package/standalone/.next/server/app/en/dashboard.segments/$d$locale.segment.rsc +6 -6
- package/standalone/.next/server/app/en/dashboard.segments/_full.segment.rsc +9 -9
- package/standalone/.next/server/app/en/dashboard.segments/_head.segment.rsc +1 -1
- package/standalone/.next/server/app/en/dashboard.segments/_index.segment.rsc +2 -2
- package/standalone/.next/server/app/en/dashboard.segments/_tree.segment.rsc +2 -2
- package/standalone/.next/server/app/en/login.html +1 -1
- package/standalone/.next/server/app/en/login.rsc +9 -9
- package/standalone/.next/server/app/en/login.segments/$d$locale/login/__PAGE__.segment.rsc +2 -2
- package/standalone/.next/server/app/en/login.segments/$d$locale/login.segment.rsc +1 -1
- package/standalone/.next/server/app/en/login.segments/$d$locale.segment.rsc +6 -6
- package/standalone/.next/server/app/en/login.segments/_full.segment.rsc +9 -9
- package/standalone/.next/server/app/en/login.segments/_head.segment.rsc +1 -1
- package/standalone/.next/server/app/en/login.segments/_index.segment.rsc +2 -2
- package/standalone/.next/server/app/en/login.segments/_tree.segment.rsc +2 -2
- package/standalone/.next/server/app/es/dashboard.html +1 -1
- package/standalone/.next/server/app/es/dashboard.rsc +9 -9
- package/standalone/.next/server/app/es/dashboard.segments/$d$locale/dashboard/__PAGE__.segment.rsc +2 -2
- package/standalone/.next/server/app/es/dashboard.segments/$d$locale/dashboard.segment.rsc +1 -1
- package/standalone/.next/server/app/es/dashboard.segments/$d$locale.segment.rsc +6 -6
- package/standalone/.next/server/app/es/dashboard.segments/_full.segment.rsc +9 -9
- package/standalone/.next/server/app/es/dashboard.segments/_head.segment.rsc +1 -1
- package/standalone/.next/server/app/es/dashboard.segments/_index.segment.rsc +2 -2
- package/standalone/.next/server/app/es/dashboard.segments/_tree.segment.rsc +2 -2
- package/standalone/.next/server/app/es/login.html +1 -1
- package/standalone/.next/server/app/es/login.rsc +9 -9
- package/standalone/.next/server/app/es/login.segments/$d$locale/login/__PAGE__.segment.rsc +2 -2
- package/standalone/.next/server/app/es/login.segments/$d$locale/login.segment.rsc +1 -1
- package/standalone/.next/server/app/es/login.segments/$d$locale.segment.rsc +6 -6
- package/standalone/.next/server/app/es/login.segments/_full.segment.rsc +9 -9
- package/standalone/.next/server/app/es/login.segments/_head.segment.rsc +1 -1
- package/standalone/.next/server/app/es/login.segments/_index.segment.rsc +2 -2
- package/standalone/.next/server/app/es/login.segments/_tree.segment.rsc +2 -2
- package/standalone/.next/server/app/fr/dashboard.html +1 -1
- package/standalone/.next/server/app/fr/dashboard.rsc +9 -9
- package/standalone/.next/server/app/fr/dashboard.segments/$d$locale/dashboard/__PAGE__.segment.rsc +2 -2
- package/standalone/.next/server/app/fr/dashboard.segments/$d$locale/dashboard.segment.rsc +1 -1
- package/standalone/.next/server/app/fr/dashboard.segments/$d$locale.segment.rsc +6 -6
- package/standalone/.next/server/app/fr/dashboard.segments/_full.segment.rsc +9 -9
- package/standalone/.next/server/app/fr/dashboard.segments/_head.segment.rsc +1 -1
- package/standalone/.next/server/app/fr/dashboard.segments/_index.segment.rsc +2 -2
- package/standalone/.next/server/app/fr/dashboard.segments/_tree.segment.rsc +2 -2
- package/standalone/.next/server/app/fr/login.html +1 -1
- package/standalone/.next/server/app/fr/login.rsc +9 -9
- package/standalone/.next/server/app/fr/login.segments/$d$locale/login/__PAGE__.segment.rsc +2 -2
- package/standalone/.next/server/app/fr/login.segments/$d$locale/login.segment.rsc +1 -1
- package/standalone/.next/server/app/fr/login.segments/$d$locale.segment.rsc +6 -6
- package/standalone/.next/server/app/fr/login.segments/_full.segment.rsc +9 -9
- package/standalone/.next/server/app/fr/login.segments/_head.segment.rsc +1 -1
- package/standalone/.next/server/app/fr/login.segments/_index.segment.rsc +2 -2
- package/standalone/.next/server/app/fr/login.segments/_tree.segment.rsc +2 -2
- package/standalone/.next/server/app/ja/dashboard.html +1 -1
- package/standalone/.next/server/app/ja/dashboard.rsc +9 -9
- package/standalone/.next/server/app/ja/dashboard.segments/$d$locale/dashboard/__PAGE__.segment.rsc +2 -2
- package/standalone/.next/server/app/ja/dashboard.segments/$d$locale/dashboard.segment.rsc +1 -1
- package/standalone/.next/server/app/ja/dashboard.segments/$d$locale.segment.rsc +6 -6
- package/standalone/.next/server/app/ja/dashboard.segments/_full.segment.rsc +9 -9
- package/standalone/.next/server/app/ja/dashboard.segments/_head.segment.rsc +1 -1
- package/standalone/.next/server/app/ja/dashboard.segments/_index.segment.rsc +2 -2
- package/standalone/.next/server/app/ja/dashboard.segments/_tree.segment.rsc +2 -2
- package/standalone/.next/server/app/ja/login.html +1 -1
- package/standalone/.next/server/app/ja/login.rsc +9 -9
- package/standalone/.next/server/app/ja/login.segments/$d$locale/login/__PAGE__.segment.rsc +2 -2
- package/standalone/.next/server/app/ja/login.segments/$d$locale/login.segment.rsc +1 -1
- package/standalone/.next/server/app/ja/login.segments/$d$locale.segment.rsc +6 -6
- package/standalone/.next/server/app/ja/login.segments/_full.segment.rsc +9 -9
- package/standalone/.next/server/app/ja/login.segments/_head.segment.rsc +1 -1
- package/standalone/.next/server/app/ja/login.segments/_index.segment.rsc +2 -2
- package/standalone/.next/server/app/ja/login.segments/_tree.segment.rsc +2 -2
- package/standalone/.next/server/app/ko/dashboard.html +1 -1
- package/standalone/.next/server/app/ko/dashboard.rsc +9 -9
- package/standalone/.next/server/app/ko/dashboard.segments/$d$locale/dashboard/__PAGE__.segment.rsc +2 -2
- package/standalone/.next/server/app/ko/dashboard.segments/$d$locale/dashboard.segment.rsc +1 -1
- package/standalone/.next/server/app/ko/dashboard.segments/$d$locale.segment.rsc +6 -6
- package/standalone/.next/server/app/ko/dashboard.segments/_full.segment.rsc +9 -9
- package/standalone/.next/server/app/ko/dashboard.segments/_head.segment.rsc +1 -1
- package/standalone/.next/server/app/ko/dashboard.segments/_index.segment.rsc +2 -2
- package/standalone/.next/server/app/ko/dashboard.segments/_tree.segment.rsc +2 -2
- package/standalone/.next/server/app/ko/login.html +1 -1
- package/standalone/.next/server/app/ko/login.rsc +9 -9
- package/standalone/.next/server/app/ko/login.segments/$d$locale/login/__PAGE__.segment.rsc +2 -2
- package/standalone/.next/server/app/ko/login.segments/$d$locale/login.segment.rsc +1 -1
- package/standalone/.next/server/app/ko/login.segments/$d$locale.segment.rsc +6 -6
- package/standalone/.next/server/app/ko/login.segments/_full.segment.rsc +9 -9
- package/standalone/.next/server/app/ko/login.segments/_head.segment.rsc +1 -1
- package/standalone/.next/server/app/ko/login.segments/_index.segment.rsc +2 -2
- package/standalone/.next/server/app/ko/login.segments/_tree.segment.rsc +2 -2
- package/standalone/.next/server/app/pt/dashboard.html +1 -1
- package/standalone/.next/server/app/pt/dashboard.rsc +9 -9
- package/standalone/.next/server/app/pt/dashboard.segments/$d$locale/dashboard/__PAGE__.segment.rsc +2 -2
- package/standalone/.next/server/app/pt/dashboard.segments/$d$locale/dashboard.segment.rsc +1 -1
- package/standalone/.next/server/app/pt/dashboard.segments/$d$locale.segment.rsc +6 -6
- package/standalone/.next/server/app/pt/dashboard.segments/_full.segment.rsc +9 -9
- package/standalone/.next/server/app/pt/dashboard.segments/_head.segment.rsc +1 -1
- package/standalone/.next/server/app/pt/dashboard.segments/_index.segment.rsc +2 -2
- package/standalone/.next/server/app/pt/dashboard.segments/_tree.segment.rsc +2 -2
- package/standalone/.next/server/app/pt/login.html +1 -1
- package/standalone/.next/server/app/pt/login.rsc +9 -9
- package/standalone/.next/server/app/pt/login.segments/$d$locale/login/__PAGE__.segment.rsc +2 -2
- package/standalone/.next/server/app/pt/login.segments/$d$locale/login.segment.rsc +1 -1
- package/standalone/.next/server/app/pt/login.segments/$d$locale.segment.rsc +6 -6
- package/standalone/.next/server/app/pt/login.segments/_full.segment.rsc +9 -9
- package/standalone/.next/server/app/pt/login.segments/_head.segment.rsc +1 -1
- package/standalone/.next/server/app/pt/login.segments/_index.segment.rsc +2 -2
- package/standalone/.next/server/app/pt/login.segments/_tree.segment.rsc +2 -2
- package/standalone/.next/server/app/yue-Hant/dashboard.html +1 -1
- package/standalone/.next/server/app/yue-Hant/dashboard.rsc +9 -9
- package/standalone/.next/server/app/yue-Hant/dashboard.segments/$d$locale/dashboard/__PAGE__.segment.rsc +2 -2
- package/standalone/.next/server/app/yue-Hant/dashboard.segments/$d$locale/dashboard.segment.rsc +1 -1
- package/standalone/.next/server/app/yue-Hant/dashboard.segments/$d$locale.segment.rsc +6 -6
- package/standalone/.next/server/app/yue-Hant/dashboard.segments/_full.segment.rsc +9 -9
- package/standalone/.next/server/app/yue-Hant/dashboard.segments/_head.segment.rsc +1 -1
- package/standalone/.next/server/app/yue-Hant/dashboard.segments/_index.segment.rsc +2 -2
- package/standalone/.next/server/app/yue-Hant/dashboard.segments/_tree.segment.rsc +2 -2
- package/standalone/.next/server/app/yue-Hant/login.html +1 -1
- package/standalone/.next/server/app/yue-Hant/login.rsc +9 -9
- package/standalone/.next/server/app/yue-Hant/login.segments/$d$locale/login/__PAGE__.segment.rsc +2 -2
- package/standalone/.next/server/app/yue-Hant/login.segments/$d$locale/login.segment.rsc +1 -1
- package/standalone/.next/server/app/yue-Hant/login.segments/$d$locale.segment.rsc +6 -6
- package/standalone/.next/server/app/yue-Hant/login.segments/_full.segment.rsc +9 -9
- package/standalone/.next/server/app/yue-Hant/login.segments/_head.segment.rsc +1 -1
- package/standalone/.next/server/app/yue-Hant/login.segments/_index.segment.rsc +2 -2
- package/standalone/.next/server/app/yue-Hant/login.segments/_tree.segment.rsc +2 -2
- package/standalone/.next/server/app/zh-CN/dashboard.html +1 -1
- package/standalone/.next/server/app/zh-CN/dashboard.rsc +9 -9
- package/standalone/.next/server/app/zh-CN/dashboard.segments/$d$locale/dashboard/__PAGE__.segment.rsc +2 -2
- package/standalone/.next/server/app/zh-CN/dashboard.segments/$d$locale/dashboard.segment.rsc +1 -1
- package/standalone/.next/server/app/zh-CN/dashboard.segments/$d$locale.segment.rsc +6 -6
- package/standalone/.next/server/app/zh-CN/dashboard.segments/_full.segment.rsc +9 -9
- package/standalone/.next/server/app/zh-CN/dashboard.segments/_head.segment.rsc +1 -1
- package/standalone/.next/server/app/zh-CN/dashboard.segments/_index.segment.rsc +2 -2
- package/standalone/.next/server/app/zh-CN/dashboard.segments/_tree.segment.rsc +2 -2
- package/standalone/.next/server/app/zh-CN/login.html +1 -1
- package/standalone/.next/server/app/zh-CN/login.rsc +9 -9
- package/standalone/.next/server/app/zh-CN/login.segments/$d$locale/login/__PAGE__.segment.rsc +2 -2
- package/standalone/.next/server/app/zh-CN/login.segments/$d$locale/login.segment.rsc +1 -1
- package/standalone/.next/server/app/zh-CN/login.segments/$d$locale.segment.rsc +6 -6
- package/standalone/.next/server/app/zh-CN/login.segments/_full.segment.rsc +9 -9
- package/standalone/.next/server/app/zh-CN/login.segments/_head.segment.rsc +1 -1
- package/standalone/.next/server/app/zh-CN/login.segments/_index.segment.rsc +2 -2
- package/standalone/.next/server/app/zh-CN/login.segments/_tree.segment.rsc +2 -2
- package/standalone/.next/server/app/zh-TW/dashboard.html +1 -1
- package/standalone/.next/server/app/zh-TW/dashboard.rsc +9 -9
- package/standalone/.next/server/app/zh-TW/dashboard.segments/$d$locale/dashboard/__PAGE__.segment.rsc +2 -2
- package/standalone/.next/server/app/zh-TW/dashboard.segments/$d$locale/dashboard.segment.rsc +1 -1
- package/standalone/.next/server/app/zh-TW/dashboard.segments/$d$locale.segment.rsc +6 -6
- package/standalone/.next/server/app/zh-TW/dashboard.segments/_full.segment.rsc +9 -9
- package/standalone/.next/server/app/zh-TW/dashboard.segments/_head.segment.rsc +1 -1
- package/standalone/.next/server/app/zh-TW/dashboard.segments/_index.segment.rsc +2 -2
- package/standalone/.next/server/app/zh-TW/dashboard.segments/_tree.segment.rsc +2 -2
- package/standalone/.next/server/app/zh-TW/login.html +1 -1
- package/standalone/.next/server/app/zh-TW/login.rsc +9 -9
- package/standalone/.next/server/app/zh-TW/login.segments/$d$locale/login/__PAGE__.segment.rsc +2 -2
- package/standalone/.next/server/app/zh-TW/login.segments/$d$locale/login.segment.rsc +1 -1
- package/standalone/.next/server/app/zh-TW/login.segments/$d$locale.segment.rsc +6 -6
- package/standalone/.next/server/app/zh-TW/login.segments/_full.segment.rsc +9 -9
- package/standalone/.next/server/app/zh-TW/login.segments/_head.segment.rsc +1 -1
- package/standalone/.next/server/app/zh-TW/login.segments/_index.segment.rsc +2 -2
- package/standalone/.next/server/app/zh-TW/login.segments/_tree.segment.rsc +2 -2
- package/standalone/.next/server/chunks/hindsight-control-plane_src_0xk6y3c._.js +1 -1
- package/standalone/.next/server/chunks/hindsight-control-plane_src_lib_hindsight-client_ts_0eje3tr._.js +1 -1
- package/standalone/.next/server/chunks/ssr/[root-of-the-server]__0_x23ke._.js +3 -3
- package/standalone/.next/server/chunks/ssr/_0l2o41x._.js +1 -1
- package/standalone/.next/server/chunks/ssr/_0ohntay._.js +1 -1
- package/standalone/.next/server/chunks/ssr/_1ssqeay._.js +1 -1
- package/standalone/.next/server/chunks/ssr/hindsight-control-plane_src_components_bank-selector_tsx_0b8_8lw._.js +2 -2
- package/standalone/.next/server/chunks/ssr/hindsight-control-plane_src_messages_de_json_[json]_cjs_1ch1-23._.js +1 -1
- package/standalone/.next/server/chunks/ssr/hindsight-control-plane_src_messages_en_json_[json]_cjs_08qm708._.js +1 -1
- package/standalone/.next/server/chunks/ssr/hindsight-control-plane_src_messages_es_json_[json]_cjs_05p52ht._.js +1 -1
- package/standalone/.next/server/chunks/ssr/hindsight-control-plane_src_messages_fr_json_[json]_cjs_1vp4nco._.js +1 -1
- package/standalone/.next/server/chunks/ssr/hindsight-control-plane_src_messages_ja_json_[json]_cjs_0mldp7p._.js +1 -1
- package/standalone/.next/server/chunks/ssr/hindsight-control-plane_src_messages_ko_json_[json]_cjs_0epqzja._.js +1 -1
- package/standalone/.next/server/chunks/ssr/hindsight-control-plane_src_messages_pt_json_[json]_cjs_0d_3joa._.js +1 -1
- package/standalone/.next/server/chunks/ssr/hindsight-control-plane_src_messages_yue-Hant_json_[json]_cjs_1i7xoui._.js +1 -1
- package/standalone/.next/server/chunks/ssr/hindsight-control-plane_src_messages_zh-CN_json_[json]_cjs_14wtgi5._.js +1 -1
- package/standalone/.next/server/chunks/ssr/hindsight-control-plane_src_messages_zh-TW_json_[json]_cjs_05oa_ni._.js +1 -1
- package/standalone/.next/server/edge/chunks/[root-of-the-server]__0idnhrz._.js +2 -2
- package/standalone/.next/server/middleware-build-manifest.js +3 -3
- package/standalone/.next/server/middleware-manifest.json +5 -5
- package/standalone/.next/server/pages/404.html +1 -1
- package/standalone/.next/server/pages/500.html +1 -1
- package/standalone/.next/server/server-reference-manifest.js +1 -1
- package/standalone/.next/server/server-reference-manifest.json +1 -1
- package/standalone/.next/static/chunks/16x7s96e_7nzf.js +3 -0
- package/standalone/.next/static/chunks/28t56shiu70y3.css +2 -0
- package/standalone/.next/static/chunks/2fiw5cr18t7wg.js +5 -0
- package/standalone/.next/static/chunks/{2pot5o8bw2ahn.js → 2glbol2hp_ttg.js} +1 -1
- package/standalone/.next/static/chunks/37w_hzg2bcmwe.js +3 -0
- package/standalone/.next/static/chunks/{2whmrc2crakdp.js → 3yi06qp6e0hek.js} +3 -3
- package/standalone/package.json +1 -1
- package/standalone/.next/static/chunks/14jmmb3upx561.js +0 -3
- package/standalone/.next/static/chunks/14khkrj56bsfj.css +0 -2
- package/standalone/.next/static/chunks/17z6q1_yb9kdk.js +0 -3
- package/standalone/.next/static/chunks/3ztbw8s54ctwr.js +0 -5
- /package/standalone/.next/static/{SDvVLb3hxtMQhmZ05lU6q → WNhovd8iAfbSzOLjWZbeD}/_buildManifest.js +0 -0
- /package/standalone/.next/static/{SDvVLb3hxtMQhmZ05lU6q → WNhovd8iAfbSzOLjWZbeD}/_clientMiddlewareManifest.js +0 -0
- /package/standalone/.next/static/{SDvVLb3hxtMQhmZ05lU6q → WNhovd8iAfbSzOLjWZbeD}/_ssgManifest.js +0 -0
|
@@ -4,8 +4,8 @@ You can add a description to the \`${IX}\` by passing a \`${I2}\` component as a
|
|
|
4
4
|
|
|
5
5
|
Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${IX}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
|
|
6
6
|
|
|
7
|
-
For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return C.useEffect(()=>{document.getElementById(a.current?.getAttribute("aria-describedby"))||console.warn(b)},[b,a]),null};let I8=C.forwardRef(({className:a,...b},c)=>(0,B.jsx)(IW,{className:(0,S.cn)("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",a),...b,ref:c}));I8.displayName=IW.displayName;let I9=C.forwardRef(({className:a,...b},c)=>(0,B.jsxs)(IV,{children:[(0,B.jsx)(I8,{}),(0,B.jsx)(I_,{ref:c,className:(0,S.cn)("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",a),...b})]}));I9.displayName=I_.displayName;let Ja=({className:a,...b})=>(0,B.jsx)("div",{className:(0,S.cn)("flex flex-col space-y-2 text-center sm:text-left",a),...b});Ja.displayName="AlertDialogHeader";let Jb=({className:a,...b})=>(0,B.jsx)("div",{className:(0,S.cn)("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",a),...b});Jb.displayName="AlertDialogFooter";let Jc=C.forwardRef(({className:a,...b},c)=>(0,B.jsx)(I1,{ref:c,className:(0,S.cn)("text-lg font-semibold",a),...b}));Jc.displayName=I1.displayName;let Jd=C.forwardRef(({className:a,...b},c)=>(0,B.jsx)(I3,{ref:c,className:(0,S.cn)("text-sm text-muted-foreground",a),...b}));Jd.displayName=I3.displayName;let Je=C.forwardRef(({className:a,...b},c)=>(0,B.jsx)(I4,{ref:c,className:(0,S.cn)((0,W.buttonVariants)(),a),...b}));Je.displayName=I4.displayName;let Jf=C.forwardRef(({className:a,...b},c)=>(0,B.jsx)(I6,{ref:c,className:(0,S.cn)((0,W.buttonVariants)({variant:"outline"}),"mt-2 sm:mt-0",a),...b}));Jf.displayName=I6.displayName;let Jg=(0,K.default)("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]),Jh=(0,K.default)("pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]),Ji=(0,K.default)("ellipsis-vertical",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]]);var Jj=a.i(5784);let Jk=(0,K.default)("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]);var Jl=a.i(73320);function Jm(a){let b=Math.floor((Date.now()-new Date(a).getTime())/1e3);if(b<60)return"just now";let c=Math.floor(b/60);if(c<60)return`${c}m ago`;let d=Math.floor(c/60);if(d<24)return`${d}h ago`;let e=Math.floor(d/24);if(e<30)return`${e}d ago`;let f=Math.floor(e/30);return f<12?`${f}mo ago`:`${Math.floor(f/12)}y ago`}function Jn(a){return a<1024?`${a} B`:a<1048576?`${(a/1024).toFixed(1)} KB`:`${(a/1048576).toFixed(1)} MB`}function Jo({metadata:a}){let b=Object.entries(a);return 0===b.length?(0,B.jsx)("span",{children:"-"}):(0,B.jsxs)("div",{className:"flex flex-wrap gap-1",children:[b.slice(0,3).map(([a,b])=>(0,B.jsxs)("span",{className:"text-xs px-2 py-0.5 rounded-full bg-blue-500/10 text-blue-600 dark:text-blue-400 font-medium",children:[a,"=",String(b)]},a)),b.length>3&&(0,B.jsxs)("span",{className:"text-xs px-2 py-0.5 text-muted-foreground",children:["+",b.length-3]})]})}function Jp({children:a}){return(0,B.jsx)("div",{className:"text-[11px] font-semibold uppercase tracking-[0.08em] text-muted-foreground mb-1",children:a})}function Jq({title:a,icon:b,children:c}){return(0,B.jsxs)("div",{className:"rounded-lg border border-border bg-muted/20 overflow-hidden",children:[(0,B.jsxs)("div",{className:"flex items-center gap-1.5 px-4 py-2 border-b border-border bg-muted/40 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:[b,a]}),(0,B.jsx)("div",{className:"p-4 space-y-4",children:c})]})}function Jr({bankId:a,documentId:b}){let c=(0,E.useTranslations)("documentsView"),[d,e]=(0,C.useState)([]),[f,g]=(0,C.useState)(!1),[h,i]=(0,C.useState)(null);return((0,C.useEffect)(()=>{let c=!1;return(async()=>{try{let d=await V.client.listLLMRequests(a,{document_id:b,group:!0,limit:50});if(c)return;let f=new Map;for(let a of d.items||[]){let b=a.trace_id||a.id;f.has(b)||f.set(b,[]),f.get(b).push(a)}let g=[...f.entries()].map(([a,b])=>({traceId:a,entry:b[0],calls:b.length,tokens:b.reduce((a,b)=>a+(b.total_tokens??0),0),status:b.some(a=>"error"===a.status)?"error":"success",start:b.map(a=>a.started_at).filter(Boolean).sort()[0]??null}));g.sort((a,b)=>(b.start||"").localeCompare(a.start||"")),e(g)}catch{}finally{c||g(!0)}})(),()=>{c=!0}},[a,b]),f&&0!==d.length)?(0,B.jsxs)(Jq,{title:c("retainTracesTitle"),icon:(0,B.jsx)(be,{className:"w-3.5 h-3.5"}),children:[(0,B.jsx)("div",{className:"space-y-1",children:d.map(a=>(0,B.jsxs)("button",{type:"button",onClick:()=>i(a.entry),className:"w-full flex items-center justify-between gap-2 rounded-md px-2 py-1.5 text-sm text-left hover:bg-muted/50",children:[(0,B.jsxs)("span",{className:"inline-flex items-center gap-2 min-w-0",children:[(0,B.jsx)("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${"error"===a.status?"bg-red-500":"bg-green-500"}`}),(0,B.jsx)("span",{className:"font-mono text-xs",children:a.entry.operation||"retain"}),(0,B.jsx)("span",{className:"text-muted-foreground text-xs truncate",children:a.start?new Date(a.start).toLocaleString():""})]}),(0,B.jsx)("span",{className:"text-muted-foreground text-xs font-mono shrink-0",children:c("retainTracesSummary",{calls:a.calls,tokens:a.tokens.toLocaleString()})})]},a.traceId))}),(0,B.jsx)(wh,{bankId:a,entry:h,open:!!h,onOpenChange:a=>!a&&i(null)})]}):null}function Js({label:a,value:b}){return(0,B.jsxs)("div",{children:[(0,B.jsx)(Jp,{children:a}),(0,B.jsx)("div",{className:"text-sm text-foreground",children:b})]})}function Jt({nodesByFactType:a}){let b=(0,E.useTranslations)("dataView"),c=a??{world:0,experience:0,observation:0},d=c.world+c.experience+c.observation,e=[{name:"World",value:c.world,color:"#8b5cf6"},{name:"Experience",value:c.experience,color:"#ec4899"},{name:"Observations",value:c.observation,color:"#6366f1"}];return(0,B.jsxs)("div",{className:"space-y-3",children:[(0,B.jsxs)("div",{className:"flex items-center justify-between",children:[(0,B.jsx)("h4",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-[0.08em]",children:b("memoryComposition")}),(0,B.jsx)("span",{className:"text-xs text-muted-foreground tabular-nums",children:d.toLocaleString()})]}),0===d?(0,B.jsx)("div",{className:"text-xs text-muted-foreground py-2",children:b("noMemoriesYet")}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)("div",{className:"h-1.5 flex w-full rounded-full overflow-hidden bg-muted",children:e.filter(a=>a.value>0).map(a=>(0,B.jsx)("div",{className:"h-full",style:{width:`${a.value/d*100}%`,backgroundColor:a.color},title:`${a.name}: ${a.value.toLocaleString()}`},a.name))}),(0,B.jsx)("div",{className:"grid grid-cols-3 gap-3 text-sm",children:e.map(a=>(0,B.jsxs)("div",{className:"space-y-0.5",children:[(0,B.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,B.jsx)("span",{className:"w-2 h-2 rounded-[2px]",style:{backgroundColor:a.color}}),(0,B.jsx)("span",{className:"text-[11px] uppercase tracking-wider text-muted-foreground font-medium",children:a.name})]}),(0,B.jsxs)("div",{className:"flex items-baseline gap-1.5",children:[(0,B.jsx)("span",{className:"text-base font-semibold tabular-nums",children:a.value.toLocaleString()}),(0,B.jsx)("span",{className:"text-[10px] text-muted-foreground tabular-nums",children:d>0?`${(a.value/d*100).toFixed(0)}%`:"0%"})]})]},a.name))})]})]})}function Ju({chunkFactType:a,setChunkFactType:b}){return(0,B.jsx)("div",{className:"flex items-center gap-1 px-2 py-1.5 border-b border-border bg-muted/30",children:["world","experience","observation"].map(c=>(0,B.jsx)("button",{onClick:()=>b(c),className:`px-2 py-0.5 rounded text-[11px] font-medium transition-colors ${a===c?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:"observation"===c?"Obs":c.charAt(0).toUpperCase()+c.slice(1)},c))})}function Jv({chunk:a}){let[b,c]=(0,C.useState)(!1),[d,e]=(0,C.useState)(!1),[f,g]=(0,C.useState)("world"),h=a.chunk_text??"",i=h.length>150?h.slice(0,150)+"...":h;return(0,B.jsxs)("div",{children:[(0,B.jsxs)("button",{className:"w-full flex items-center gap-3 px-4 py-2 text-left hover:bg-muted/30 transition-colors",onClick:()=>c(!b),children:[(0,B.jsx)(Jj.ChevronDown,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground transition-transform ${b?"":"-rotate-90"}`}),(0,B.jsxs)("span",{className:"text-xs font-mono text-muted-foreground shrink-0",children:["#",a.chunk_index]}),(0,B.jsxs)("span",{className:"text-[11px] text-muted-foreground/60 shrink-0",children:[h.length.toLocaleString()," chars"]}),!b&&(0,B.jsx)("span",{className:"text-xs text-foreground/50 truncate",children:i})]}),b&&(d?(0,B.jsxs)("div",{style:{height:"500px"},className:"flex flex-col border-t border-border",children:[(0,B.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 bg-muted/30 border-b border-border",children:[(0,B.jsx)(Ju,{chunkFactType:f,setChunkFactType:g}),(0,B.jsx)("div",{className:"flex-1"}),(0,B.jsxs)(W.Button,{variant:"ghost",size:"sm",onClick:()=>e(!1),className:"h-6 px-2 text-xs gap-1",children:[(0,B.jsx)(ac,{className:"w-3 h-3"}),"Compact"]})]}),(0,B.jsx)("div",{className:"flex-1 min-h-0",children:(0,B.jsx)(IJ,{factType:f,chunkId:a.chunk_id},`${a.chunk_id}-${f}-full`)})]}):(0,B.jsxs)("div",{className:"grid grid-cols-2 divide-x divide-border",style:{height:"350px"},children:[(0,B.jsx)("div",{className:"overflow-y-auto",children:(0,B.jsx)("pre",{className:"px-4 py-3 text-[11px] leading-5 text-foreground/80 whitespace-pre-wrap font-mono",children:h})}),(0,B.jsxs)("div",{className:"flex flex-col overflow-hidden",children:[(0,B.jsx)(Ju,{chunkFactType:f,setChunkFactType:g}),(0,B.jsx)("div",{className:"flex-1 min-h-0",children:(0,B.jsx)(IJ,{factType:f,chunkId:a.chunk_id,compact:!0,onExpandToggle:()=>e(!0)},`${a.chunk_id}-${f}-compact`)})]})]}))]})}function Jw(){let a=(0,E.useTranslations)("documentsView"),b=(0,E.useTranslations)("common"),c=(0,E.useTranslations)("bank"),{currentBank:d}=(0,H.useBank)(),{features:e}=(0,IL.useFeatures)(),[f,g]=(0,C.useState)([]),[h,i]=(0,C.useState)(!1),[j,k]=(0,C.useState)(""),[l,n]=(0,C.useState)(0),[o,p]=(0,C.useState)(!1),[q,r]=(0,C.useState)(!1),[s,t]=(0,C.useState)(!1),[u,v]=(0,C.useState)(!1),[w,x]=(0,C.useState)(!1),[y,z]=(0,C.useState)(null),[A,D]=(0,C.useState)("skip"),[G,I]=(0,C.useState)(1),J=Math.ceil(l/50),K=(G-1)*50,[L,M]=(0,C.useState)(null),[O,S]=(0,C.useState)(!1),[T,U]=(0,C.useState)(null),[Y,Z]=(0,C.useState)(!1),[$,ab]=(0,C.useState)(""),[ac,ae]=(0,C.useState)(!1),[af,ah]=(0,C.useState)(!1),[ao,ap]=(0,C.useState)(""),[aq,ar]=(0,C.useState)(!1),[as,at]=(0,C.useState)([]),[av,aw]=(0,C.useState)(0),[ax,ay]=(0,C.useState)(!1),[az,aA]=(0,C.useState)(!1),[aB,aC]=(0,C.useState)(!1),[aD,aE]=(0,C.useState)(null),[aF,aG]=(0,C.useState)(null),[aH,aI]=(0,C.useState)(null),aJ=async(a=1)=>{if(d){i(!0);try{let b=await V.client.listDocuments({bank_id:d,q:j,limit:50,offset:(a-1)*50});g(b.items||[]),n(b.total||0)}catch(a){}finally{i(!1)}}},aK=a=>{I(a),aJ(a)},aL=async a=>{if(d){S(!0),M({id:a}),Z(!1),ab(""),ah(!1),ap(""),at([]),aw(0),aA(!1);try{let b=await V.client.getDocument(a,d);M(b)}catch(a){M(null)}finally{S(!1)}}},aM=async a=>{if(d){ay(!0);try{let b=await V.client.listDocumentChunks({document_id:a,bank_id:d,limit:100});at(b.items||[]),aw(b.total||0),aA(!0)}catch(a){}finally{ay(!1)}}},aN=async()=>{if(d&&L){aC(!0);try{let a=await V.client.reprocessDocument(L.id,d);aE({success:!0,message:`Reprocessing started (operation: ${a.operation_id})`})}catch(a){aE({success:!1,message:"Error reprocessing document: "+a.message})}finally{aC(!1)}}},aO=async()=>{if(!d||!aF)return;let b=aF.id;U(b),aG(null);try{let c=await V.client.deleteDocument(b,d);aI({success:!0,message:a("toastDeletedDocumentAndUnits",{count:c.memory_units_deleted})}),L?.id===b&&M(null),aJ(G)}catch(b){console.error("Error deleting document:",b),aI({success:!1,message:a("toastErrorDeletingDocument")+b.message})}finally{U(null)}},aP=()=>{Z(!1),ab("")},aQ=async()=>{if(!d||!L||!ao.trim())return;let a=L.retain_params??{},b={content:ao,document_id:L.id};a.context&&(b.context=a.context),a.event_date&&(b.timestamp=a.event_date),a.metadata&&Object.keys(a.metadata).length>0&&(b.metadata=a.metadata),L.tags&&L.tags.length>0&&(b.tags=L.tags),ar(!0);try{await V.client.retain({bank_id:d,items:[b],async:!1});let a=await V.client.getDocument(L.id,d);M(a),ah(!1),ap(""),aJ(G)}catch(a){console.error("Error updating document content:",a)}finally{ar(!1)}},aR=async()=>{if(!d||!L)return;let a=$.split(",").map(a=>a.trim()).filter(a=>a.length>0);ae(!0);try{await V.client.updateDocument(L.id,d,a),M({...L,tags:a}),g(b=>b.map(b=>b.id===L.id?{...b,tags:a}:b)),Z(!1),ab("")}catch(a){console.error("Error updating document tags:",a)}finally{ae(!1)}};(0,C.useEffect)(()=>{d&&(I(1),aJ(1))},[d]),(0,C.useEffect)(()=>{if(!d)return;let a=setTimeout(()=>{I(1),aJ(1)},300);return()=>clearTimeout(a)},[j]);let aS=async(b,c=!1)=>{if(d&&!o){p(!0);try{var e;let f,g,h=await V.client.exportDocuments(d,b,c),i=b&&1===b.length?`-${b[0]}`:"-documents";e=`${d}${i}.zip`,f=URL.createObjectURL(h),(g=document.createElement("a")).href=f,g.download=e,document.body.appendChild(g),g.click(),g.remove(),URL.revokeObjectURL(f),F.toast.success(a("exportSuccess")),t(!1)}catch{}finally{p(!1)}}},aT=async b=>{if(b&&d){r(!0);try{let{operation_id:c}=await V.client.importDocuments(d,b,A),e=Date.now()+3e5,f=null;for(;Date.now()<e;){let b=await V.client.getOperationStatus(d,c);if("completed"===b.status){f=b.result_metadata??{};break}if("failed"===b.status)return void F.toast.error(b.error_message||a("importFailed"));await new Promise(a=>setTimeout(a,1e3))}if(null===f)return void F.toast.error(a("importTimeout"));F.toast.success(a("importSuccess",{imported:f.documents_imported??0,facts:f.facts_imported??0,skipped:f.documents_skipped??0})),aJ(G),x(!1),z(null)}catch{}finally{r(!1)}}},aU=e?.document_export_api??!1,aV=e?.document_import_api??!1;return(0,B.jsxs)("div",{children:[(0,B.jsxs)("div",{className:"mb-6 flex items-start justify-between gap-4",children:[(0,B.jsxs)("div",{children:[(0,B.jsx)("h1",{className:"text-3xl font-bold mb-2 text-foreground",children:c("documents")}),(0,B.jsx)("p",{className:"text-muted-foreground",children:c("documentsDescription")})]}),(aU||aV)&&(0,B.jsxs)(IN.DropdownMenu,{children:[(0,B.jsx)(IN.DropdownMenuTrigger,{asChild:!0,children:(0,B.jsxs)(W.Button,{variant:"outline",size:"sm",className:"h-8 shrink-0",disabled:!d||o||q,children:[o?a("exporting"):q?a("importing"):a("actionsButton"),(0,B.jsx)(Jj.ChevronDown,{className:"w-4 h-4 ml-1"})]})}),(0,B.jsxs)(IN.DropdownMenuContent,{align:"end",children:[aU&&(0,B.jsxs)(IN.DropdownMenuItem,{onClick:()=>{v(!1),t(!0)},children:[(0,B.jsx)(Jk,{className:"h-4 w-4 mr-2"}),a("exportButton")]}),aV&&(0,B.jsxs)(IN.DropdownMenuItem,{onClick:()=>x(!0),children:[(0,B.jsx)(Jl.Upload,{className:"h-4 w-4 mr-2"}),a("importButton")]})]})]})]}),(0,B.jsx)(bf.Dialog,{open:s,onOpenChange:t,children:(0,B.jsxs)(bf.DialogContent,{children:[(0,B.jsxs)(bf.DialogHeader,{children:[(0,B.jsx)(bf.DialogTitle,{children:a("exportDialogTitle")}),(0,B.jsx)(bf.DialogDescription,{children:a("exportDialogDescription")})]}),(0,B.jsxs)("div",{className:"flex items-start gap-2 py-2",children:[(0,B.jsx)(IM.Checkbox,{id:"export-include-observations",checked:u,onCheckedChange:a=>v(!0===a)}),(0,B.jsxs)("div",{className:"grid gap-1 leading-none",children:[(0,B.jsx)(au,{htmlFor:"export-include-observations",children:a("exportIncludeObservationsLabel")}),(0,B.jsx)("p",{className:"text-xs text-muted-foreground",children:a("exportIncludeObservationsHint")})]})]}),(0,B.jsxs)(bf.DialogFooter,{children:[(0,B.jsx)(W.Button,{variant:"outline",size:"sm",onClick:()=>t(!1),disabled:o,children:b("cancel")}),(0,B.jsxs)(W.Button,{size:"sm",onClick:()=>aS(void 0,u),disabled:o,children:[(0,B.jsx)(Jk,{className:"h-4 w-4 mr-2"}),o?a("exporting"):a("exportButton")]})]})]})}),(0,B.jsx)(bf.Dialog,{open:w,onOpenChange:a=>{x(a),a||z(null)},children:(0,B.jsxs)(bf.DialogContent,{children:[(0,B.jsxs)(bf.DialogHeader,{children:[(0,B.jsx)(bf.DialogTitle,{children:a("importDialogTitle")}),(0,B.jsx)(bf.DialogDescription,{children:a("importDialogDescription")})]}),(0,B.jsxs)("div",{className:"py-2 space-y-4",children:[(0,B.jsx)("input",{type:"file",accept:".zip,application/zip",disabled:q,onChange:a=>z(a.target.files?.[0]??null),className:"block w-full text-sm text-muted-foreground file:mr-3 file:rounded-md file:border-0 file:bg-muted file:px-3 file:py-1.5 file:text-sm file:font-medium hover:file:bg-muted/80"}),(0,B.jsxs)("div",{className:"grid gap-1.5",children:[(0,B.jsx)(au,{htmlFor:"import-on-conflict",children:a("importConflictLabel")}),(0,B.jsxs)(a6.Select,{value:A,onValueChange:a=>D(a),disabled:q,children:[(0,B.jsx)(a6.SelectTrigger,{id:"import-on-conflict",className:"h-8",children:(0,B.jsx)(a6.SelectValue,{})}),(0,B.jsxs)(a6.SelectContent,{children:[(0,B.jsx)(a6.SelectItem,{value:"skip",children:a("importConflictSkip")}),(0,B.jsx)(a6.SelectItem,{value:"replace",children:a("importConflictReplace")}),(0,B.jsx)(a6.SelectItem,{value:"new-id",children:a("importConflictNewId")})]})]})]})]}),(0,B.jsxs)(bf.DialogFooter,{children:[(0,B.jsx)(W.Button,{variant:"outline",size:"sm",onClick:()=>{x(!1),z(null)},disabled:q,children:b("cancel")}),(0,B.jsxs)(W.Button,{size:"sm",onClick:()=>y&&aT(y),disabled:!y||q,children:[(0,B.jsx)(Jl.Upload,{className:"h-4 w-4 mr-2"}),q?a("importing"):a("importButton")]})]})]})}),h?(0,B.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,B.jsxs)("div",{className:"text-center",children:[(0,B.jsx)("div",{className:"text-4xl mb-2",children:"⏳"}),(0,B.jsx)("div",{className:"text-sm text-muted-foreground",children:a("loadingDocuments")})]})}):f.length>0?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)("div",{className:"mb-4 text-sm text-muted-foreground",children:a("totalDocuments",{total:l})}),(0,B.jsxs)("div",{className:"w-full",children:[(0,B.jsx)("div",{className:"px-5 mb-4",children:(0,B.jsx)(X.Input,{type:"text",value:j,onChange:a=>k(a.target.value),placeholder:a("searchPlaceholder"),className:"max-w-2xl"})}),(0,B.jsx)("div",{className:"overflow-x-auto px-5 pb-5",children:(0,B.jsxs)(ai,{children:[(0,B.jsx)(aj,{children:(0,B.jsxs)(al,{children:[(0,B.jsx)(am,{children:a("colDocumentId")}),(0,B.jsx)(am,{children:a("colCreated")}),(0,B.jsx)(am,{children:a("colUpdated")}),(0,B.jsx)(am,{children:a("colTags")}),(0,B.jsx)(am,{children:a("colMetadata")}),(0,B.jsx)(am,{children:a("colSize")}),(0,B.jsx)(am,{children:a("colMemoryUnits")})]})}),(0,B.jsx)(ak,{children:f.length>0?f.map(a=>(0,B.jsxs)(al,{className:`cursor-pointer hover:bg-muted/50 ${L?.id===a.id?"bg-primary/10":""}`,onClick:()=>aL(a.id),children:[(0,B.jsx)(an,{className:"text-card-foreground font-mono text-xs break-all",children:a.id}),(0,B.jsx)(an,{className:"text-card-foreground",title:a.created_at?new Date(a.created_at).toLocaleString():"",children:a.created_at?Jm(a.created_at):"N/A"}),(0,B.jsx)(an,{className:"text-card-foreground",title:a.updated_at?new Date(a.updated_at).toLocaleString():"",children:a.updated_at?Jm(a.updated_at):"N/A"}),(0,B.jsx)(an,{className:"text-card-foreground",children:a.tags&&a.tags.length>0?(0,B.jsxs)("div",{className:"flex flex-wrap gap-1",children:[a.tags.slice(0,3).map((a,b)=>(0,B.jsx)("span",{className:"text-xs px-2 py-0.5 rounded-full bg-amber-500/10 text-amber-600 dark:text-amber-400 font-medium",children:a},b)),a.tags.length>3&&(0,B.jsxs)("span",{className:"text-xs px-2 py-0.5 text-muted-foreground",children:["+",a.tags.length-3]})]}):"-"}),(0,B.jsx)(an,{className:"text-card-foreground",children:a.document_metadata&&Object.keys(a.document_metadata).length>0?(0,B.jsx)(Jo,{metadata:a.document_metadata}):"-"}),(0,B.jsx)(an,{className:"text-card-foreground",children:Jn(a.text_length||0)}),(0,B.jsx)(an,{className:"text-card-foreground",children:a.memory_unit_count})]},a.id)):(0,B.jsx)(al,{children:(0,B.jsx)(an,{colSpan:7,className:"text-center",children:a("clickLoadDocumentsToView")})})})]})}),J>1&&(0,B.jsxs)("div",{className:"flex items-center justify-between mt-3 pt-3 border-t px-5",children:[(0,B.jsxs)("div",{className:"text-xs text-muted-foreground",children:[K+1,"-",Math.min(K+50,l)," of ",l]}),(0,B.jsxs)("div",{className:"flex items-center gap-1",children:[(0,B.jsx)(W.Button,{variant:"outline",size:"sm",onClick:()=>aK(1),disabled:1===G||h,className:"h-7 w-7 p-0",children:(0,B.jsx)(_,{className:"h-3 w-3"})}),(0,B.jsx)(W.Button,{variant:"outline",size:"sm",onClick:()=>aK(G-1),disabled:1===G||h,className:"h-7 w-7 p-0",children:(0,B.jsx)(P,{className:"h-3 w-3"})}),(0,B.jsxs)("span",{className:"text-xs px-2",children:[G," / ",J]}),(0,B.jsx)(W.Button,{variant:"outline",size:"sm",onClick:()=>aK(G+1),disabled:G===J||h,className:"h-7 w-7 p-0",children:(0,B.jsx)(Q.ChevronRight,{className:"h-3 w-3"})}),(0,B.jsx)(W.Button,{variant:"outline",size:"sm",onClick:()=>aK(J),disabled:G===J||h,className:"h-7 w-7 p-0",children:(0,B.jsx)(aa,{className:"h-3 w-3"})})]})]})]})]}):(0,B.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,B.jsxs)("div",{className:"text-center",children:[(0,B.jsx)("div",{className:"text-4xl mb-2",children:"📄"}),(0,B.jsx)("div",{className:"text-sm text-muted-foreground",children:a("noDocumentsFound")})]})}),(0,B.jsx)(bf.Dialog,{open:!!L,onOpenChange:a=>!a&&M(null),children:(0,B.jsxs)(bf.DialogContent,{className:"w-[95vw] max-w-[95vw] h-[92vh] sm:max-w-[95vw] flex flex-col overflow-hidden",children:[(0,B.jsx)(bf.DialogHeader,{className:"pr-10",children:(0,B.jsx)(bf.DialogTitle,{className:"flex items-center gap-2",children:(0,B.jsx)("span",{className:"truncate font-mono text-sm",children:L?.id??"Document"})})}),O?(0,B.jsx)("div",{className:"flex items-center justify-center flex-1",children:(0,B.jsxs)("div",{className:"text-center",children:[(0,B.jsx)("div",{className:"text-4xl mb-2",children:"⏳"}),(0,B.jsx)("div",{className:"text-sm text-muted-foreground",children:a("loadingDocument")})]})}):L?(0,B.jsxs)(bh.Tabs,{defaultValue:"general",className:"flex-1 flex flex-col overflow-hidden",children:[(0,B.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,B.jsxs)(bh.TabsList,{className:"grid grid-cols-3 w-full max-w-md",children:[(0,B.jsxs)(bh.TabsTrigger,{value:"general",className:"flex items-center gap-1.5",children:[(0,B.jsx)(R,{className:"w-3.5 h-3.5"}),"General"]}),(0,B.jsxs)(bh.TabsTrigger,{value:"content",className:"flex items-center gap-1.5",children:[(0,B.jsx)(N.FileText,{className:"w-3.5 h-3.5"}),"Content"]}),(0,B.jsxs)(bh.TabsTrigger,{value:"chunks",className:"flex items-center gap-1.5",onClick:()=>{!az&&L?.id&&aM(L.id)},children:[(0,B.jsx)(bi,{className:"w-3.5 h-3.5"}),"Chunks",az?` (${av})`:""]})]}),(0,B.jsxs)(IN.DropdownMenu,{children:[(0,B.jsx)(IN.DropdownMenuTrigger,{asChild:!0,children:(0,B.jsx)(W.Button,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 shrink-0",disabled:aB,"aria-label":b("actions"),children:(0,B.jsx)(Ji,{className:"h-4 w-4"})})}),(0,B.jsxs)(IN.DropdownMenuContent,{align:"end",children:[(0,B.jsxs)(IN.DropdownMenuItem,{onClick:aN,disabled:aB,children:[(0,B.jsx)(ad,{className:"h-4 w-4 mr-2"}),"Reprocess"]}),aU&&(0,B.jsxs)(IN.DropdownMenuItem,{onClick:()=>aS([L.id]),disabled:o,children:[(0,B.jsx)(Jk,{className:"h-4 w-4 mr-2"}),a("exportButton")]}),(0,B.jsx)(IN.DropdownMenuSeparator,{}),(0,B.jsxs)(IN.DropdownMenuItem,{onClick:()=>{aG({id:L.id,memoryCount:L.memory_unit_count})},className:"text-red-600 focus:text-red-600 dark:text-red-400 dark:focus:text-red-400 focus:bg-red-500/10",children:[(0,B.jsx)(Jg,{className:"h-4 w-4 mr-2"}),a("deleteButton")]})]})]})]}),(0,B.jsxs)("div",{className:"flex-1 overflow-y-auto mt-4",children:[(0,B.jsx)(bh.TabsContent,{value:"content",className:"mt-0",children:void 0!==L.original_text&&(af?(0,B.jsxs)("div",{className:"space-y-2",children:[(0,B.jsx)("div",{className:"flex items-center justify-end mb-2",children:(0,B.jsxs)("div",{className:"flex gap-2",children:[(0,B.jsxs)(W.Button,{size:"sm",onClick:aQ,disabled:aq||!ao.trim(),className:"h-7 px-3 gap-1 text-xs",children:[aq?(0,B.jsx)("span",{className:"animate-spin",children:"⏳"}):(0,B.jsx)(ba.Check,{className:"h-3 w-3"}),a("saveButton")]}),(0,B.jsxs)(W.Button,{variant:"outline",size:"sm",onClick:()=>{ah(!1),ap("")},disabled:aq,className:"h-7 px-3 gap-1 text-xs",children:[(0,B.jsx)(bb.X,{className:"h-3 w-3"}),a("cancelButton")]})]})}),(0,B.jsx)("textarea",{value:ao,onChange:a=>ap(a.target.value),className:"w-full min-h-[400px] max-h-[600px] p-4 bg-muted/50 rounded-lg border border-border text-sm font-mono leading-relaxed text-card-foreground resize-y",autoFocus:!0}),(0,B.jsx)("p",{className:"text-xs text-muted-foreground",children:a("saveHint")})]}):(0,B.jsxs)("div",{className:"rounded-lg border border-border bg-muted/30 overflow-hidden",children:[(0,B.jsxs)("div",{className:"flex items-center justify-between gap-2 px-4 py-2 border-b border-border bg-muted/50 text-xs text-muted-foreground",children:[(0,B.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,B.jsx)(N.FileText,{className:"w-3.5 h-3.5"}),(0,B.jsx)("span",{className:"font-semibold uppercase tracking-wide",children:a("storedContent")}),(0,B.jsxs)("span",{className:"text-muted-foreground/70",children:["·"," ",L.original_text?.length?.toLocaleString()??0," chars"]})]}),(0,B.jsxs)(W.Button,{variant:"ghost",size:"sm",onClick:()=>{ap(L?.original_text??""),ah(!0)},className:"h-6 px-2 gap-1 text-xs",children:[(0,B.jsx)(Jh,{className:"h-3 w-3"}),a("editButton")]})]}),(0,B.jsx)("pre",{className:"p-4 text-[11px] leading-5 text-foreground/80 whitespace-pre-wrap font-mono",children:L.original_text})]}))}),(0,B.jsx)(bh.TabsContent,{value:"general",className:"mt-0",children:(0,B.jsxs)("div",{className:"space-y-4",children:[(0,B.jsxs)(bh.Tabs,{defaultValue:"world",className:"flex flex-col",children:[(0,B.jsxs)(bh.TabsList,{className:"w-fit",children:[(0,B.jsx)(bh.TabsTrigger,{value:"world",children:"World"}),(0,B.jsx)(bh.TabsTrigger,{value:"experience",children:"Experience"}),(0,B.jsx)(bh.TabsTrigger,{value:"observation",children:"Observations"})]}),(0,B.jsxs)("div",{className:"mt-2",children:[(0,B.jsx)(bh.TabsContent,{value:"world",className:"mt-0",children:(0,B.jsx)(IJ,{factType:"world",documentId:L.id,compact:!0})}),(0,B.jsx)(bh.TabsContent,{value:"experience",className:"mt-0",children:(0,B.jsx)(IJ,{factType:"experience",documentId:L.id,compact:!0})}),(0,B.jsx)(bh.TabsContent,{value:"observation",className:"mt-0",children:(0,B.jsx)(IJ,{factType:"observation",documentId:L.id,compact:!0})})]})]}),(0,B.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,B.jsxs)(Jq,{title:"Document",icon:(0,B.jsx)(N.FileText,{className:"w-3.5 h-3.5"}),children:[L.created_at&&(0,B.jsx)(Js,{label:a("labelCreated"),value:new Date(L.created_at).toLocaleString()}),L.updated_at&&(0,B.jsx)(Js,{label:a("labelUpdated"),value:new Date(L.updated_at).toLocaleString()}),L.original_text&&(0,B.jsx)(Js,{label:a("colSize"),value:Jn(new Blob([L.original_text]).size)}),(0,B.jsx)(Js,{label:a("labelTags"),value:Y?(0,B.jsxs)("div",{className:"flex items-center gap-2",children:[(0,B.jsx)(X.Input,{value:$,onChange:a=>ab(a.target.value),placeholder:a("tagsInputPlaceholder"),className:"text-sm h-7 w-64",onKeyDown:a=>{"Enter"===a.key&&aR(),"Escape"===a.key&&aP()},autoFocus:!0}),(0,B.jsx)(W.Button,{size:"sm",onClick:aR,disabled:ac,className:"h-7 w-7 p-0",children:ac?(0,B.jsx)("span",{className:"animate-spin text-xs",children:"⏳"}):(0,B.jsx)(ba.Check,{className:"h-3 w-3"})}),(0,B.jsx)(W.Button,{variant:"outline",size:"sm",onClick:aP,disabled:ac,className:"h-7 w-7 p-0",children:(0,B.jsx)(bb.X,{className:"h-3 w-3"})})]}):(0,B.jsxs)("div",{className:"flex items-center gap-2",children:[L.tags&&L.tags.length>0?(0,B.jsx)("div",{className:"flex flex-wrap gap-1.5",children:L.tags.map((a,b)=>(0,B.jsx)("span",{className:"text-xs px-2 py-0.5 rounded-full bg-amber-500/10 text-amber-600 dark:text-amber-400 font-medium",children:a},b))}):(0,B.jsx)("span",{className:"text-sm text-muted-foreground italic",children:"none"}),(0,B.jsx)(W.Button,{variant:"ghost",size:"sm",onClick:()=>{ab((L?.tags??[]).join(", ")),Z(!0)},className:"h-6 w-6 p-0",children:(0,B.jsx)(Jh,{className:"h-3 w-3"})})]})}),L.retain_params?.context&&(0,B.jsx)(Js,{label:"Context",value:L.retain_params.context}),L.retain_params?.event_date&&(0,B.jsx)(Js,{label:a("labelEventDate"),value:new Date(L.retain_params.event_date).toLocaleString()}),L.retain_params?.metadata&&Object.keys(L.retain_params.metadata).length>0&&(0,B.jsx)(Js,{label:"Metadata",value:(0,B.jsx)(Jo,{metadata:L.retain_params.metadata})})]}),(0,B.jsx)(Jq,{title:a("memoryCompositionTitle"),icon:(0,B.jsx)(ag,{className:"w-3.5 h-3.5"}),children:(0,B.jsx)(Jt,{nodesByFactType:L.nodes_by_fact_type})}),d&&L?.id&&(0,B.jsx)(Jr,{bankId:d,documentId:L.id})]})]})}),(0,B.jsx)(bh.TabsContent,{value:"chunks",className:"mt-0",children:ax?(0,B.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,B.jsxs)("div",{className:"text-center",children:[(0,B.jsx)("div",{className:"text-4xl mb-2",children:"⏳"}),(0,B.jsx)("div",{className:"text-sm text-muted-foreground",children:a("loadingChunks")})]})}):as.length>0?(0,B.jsx)("div",{className:"rounded-lg border border-border overflow-hidden divide-y divide-border",children:as.map(a=>(0,B.jsx)(Jv,{chunk:a},a.chunk_id))}):az?(0,B.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,B.jsxs)("div",{className:"text-center",children:[(0,B.jsx)("div",{className:"text-4xl mb-2",children:"📄"}),(0,B.jsx)("div",{className:"text-sm text-muted-foreground",children:a("noChunksFound")})]})}):(0,B.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,B.jsx)("div",{className:"text-center",children:(0,B.jsx)("div",{className:"text-sm text-muted-foreground",children:a("clickChunksTabToLoad")})})})})]})]}):null]})}),(0,B.jsx)(IU,{open:!!aF,onOpenChange:a=>!a&&aG(null),children:(0,B.jsxs)(I9,{children:[(0,B.jsxs)(Ja,{children:[(0,B.jsx)(Jc,{children:a("deleteDialogTitle")}),(0,B.jsxs)(Jd,{children:[a("deleteDialogDescription")," ",(0,B.jsxs)("span",{className:"font-mono font-semibold",children:['"',aF?.id,'"']}),"?",(0,B.jsx)("br",{}),(0,B.jsx)("br",{}),a("deleteDialogWillDelete")," ",aF?.memoryCount!==void 0?(0,B.jsx)("span",{className:"font-semibold",children:a("deleteDialogMemoryUnits",{count:aF.memoryCount})}):a("deleteDialogAllMemoryUnits")," ",a("deleteDialogExtracted"),(0,B.jsx)("br",{}),(0,B.jsx)("br",{}),(0,B.jsx)("span",{className:"text-destructive font-semibold",children:a("deleteDialogCannotUndo")})]})]}),(0,B.jsxs)(Jb,{children:[(0,B.jsx)(Jf,{children:a("cancelButton")}),(0,B.jsx)(Je,{onClick:aO,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:a("deleteButton")})]})]})}),(0,B.jsx)(IU,{open:!!aH,onOpenChange:a=>!a&&aI(null),children:(0,B.jsxs)(I9,{children:[(0,B.jsxs)(Ja,{children:[(0,B.jsx)(Jc,{children:aH?.success?a("deleteResultSuccessTitle"):a("deleteResultErrorTitle")}),(0,B.jsx)(Jd,{children:aH?.message})]}),(0,B.jsx)(Jb,{children:(0,B.jsx)(Je,{onClick:()=>aI(null),children:a("okButton")})})]})}),(0,B.jsx)(IU,{open:!!aD,onOpenChange:a=>!a&&aE(null),children:(0,B.jsxs)(I9,{children:[(0,B.jsxs)(Ja,{children:[(0,B.jsx)(Jc,{children:aD?.success?"Reprocessing Started":a("deleteResultErrorTitle")}),(0,B.jsx)(Jd,{children:aD?.message})]}),(0,B.jsx)(Jb,{children:(0,B.jsx)(Je,{onClick:()=>aE(null),children:a("okButton")})})]})})]})}function Jx(){let a=(0,E.useTranslations)("entitiesView"),{currentBank:b}=(0,H.useBank)(),[c,d]=(0,C.useState)([]),[e,f]=(0,C.useState)(!1),[g,h]=(0,C.useState)(null),[i,j]=(0,C.useState)(!1),[k,l]=(0,C.useState)("relations"),[n,o]=(0,C.useState)(null),[p,q]=(0,C.useState)(!1),[r,s]=(0,C.useState)(1),[t,u]=(0,C.useState)(0),v=Math.ceil(t/50),w=(r-1)*50,x=async(a=1)=>{if(b){f(!0);try{let c=await V.client.listEntities({bank_id:b,limit:50,offset:(a-1)*50});d(c.items||[]),u(c.total||0)}catch(a){}finally{f(!1)}}},y=async a=>{if(b){j(!0);try{let c=await V.client.getEntity(a,b);h(c)}catch(a){}finally{j(!1)}}},z=a=>{s(a),x(a)},A=(0,C.useCallback)(async()=>{if(b){q(!0);try{let a=await V.client.getEntityGraph({bank_id:b,limit:2e3,min_count:1});o(a)}catch(a){}finally{q(!1)}}},[b]);(0,C.useEffect)(()=>{b&&(s(1),x(1),h(null),o(null))},[b]),(0,C.useEffect)(()=>{"relations"!==k||!b||n||p||A()},[k,b,n,p,A]);let D=(0,C.useMemo)(()=>n?HA(n):{nodes:[],links:[]},[n]),F=(0,C.useMemo)(()=>{let a=new Map;for(let b of D.links){let c="number"==typeof b.weight&&b.weight>0?b.weight:1;a.set(b.source,(a.get(b.source)||0)+c),a.set(b.target,(a.get(b.target)||0)+c)}return a},[D]),G=(0,C.useMemo)(()=>{let a=1;for(let b of F.values())b>a&&(a=b);return a},[F]),I=(0,C.useCallback)(a=>3+11*Math.sqrt((F.get(a.id)||0)/G),[F,G]),J=(0,C.useMemo)(()=>{let a=n?.edges||[];if(!a.length)return null;let b=new Map,c=1/0,d=-1/0;for(let e of a){let a=e.data.lastCooccurred;if(!a)continue;let f=Date.parse(a);if(!Number.isNaN(f)){for(let a of[e.data.source,e.data.target]){let c=b.get(a);(void 0===c||f>c)&&b.set(a,f)}f<c&&(c=f),f>d&&(d=f)}}return Number.isFinite(c)&&Number.isFinite(d)&&d!==c?{times:b,minT:c,maxT:d}:null},[n]),K=(0,C.useCallback)(a=>{if(!J)return .5;let b=J.times.get(a.id);return void 0===b?0:(b-J.minT)/(J.maxT-J.minT)},[J]),L=(0,C.useCallback)(a=>{y(a.id)},[b]),M=b=>b?new Date(b).toLocaleDateString():a("na");return(0,B.jsxs)("div",{children:[(0,B.jsx)("div",{className:"mb-4 flex items-center justify-end",children:(0,B.jsxs)("div",{className:"flex items-center gap-2 bg-muted rounded-lg p-1",children:[(0,B.jsxs)("button",{onClick:()=>l("relations"),className:`px-3 py-1.5 rounded-md text-sm font-medium transition-all flex items-center gap-1.5 ${"relations"===k?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:[(0,B.jsx)(IH,{className:"w-4 h-4"}),a("viewRelations")]}),(0,B.jsxs)("button",{onClick:()=>l("list"),className:`px-3 py-1.5 rounded-md text-sm font-medium transition-all flex items-center gap-1.5 ${"list"===k?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:[(0,B.jsx)(ah,{className:"w-4 h-4"}),a("viewList")]})]})}),"relations"===k&&(0,B.jsx)("div",{className:"border border-border rounded-lg overflow-hidden",children:p?(0,B.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,B.jsxs)("div",{className:"text-center",children:[(0,B.jsx)("div",{className:"text-4xl mb-2",children:"..."}),(0,B.jsx)("div",{className:"text-sm text-muted-foreground",children:a("loadingEntityGraph")})]})}):D.nodes.length>0?(0,B.jsx)(IF,{data:D,height:700,onNodeClick:L,nodeSizeFn:I,nodeHeatFn:J?K:void 0,heatLegendLabel:J?a("heatLegendLabel"):void 0,heatLegendEndpoints:J?[new Date(J.minT).toISOString().slice(0,10),new Date(J.maxT).toISOString().slice(0,10)]:void 0,sizeLegendLabel:a("sizeLegendLabel"),compactLabels:!0}):(0,B.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,B.jsxs)("div",{className:"text-center",children:[(0,B.jsx)("div",{className:"text-sm text-muted-foreground",children:a("noCooccurrences")}),(0,B.jsx)("div",{className:"text-xs text-muted-foreground mt-1",children:a("noCooccurrencesDescription")})]})})}),"list"===k&&(0,B.jsx)("div",{children:e?(0,B.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,B.jsxs)("div",{className:"text-center",children:[(0,B.jsx)("div",{className:"text-4xl mb-2",children:"..."}),(0,B.jsx)("div",{className:"text-sm text-muted-foreground",children:a("loadingEntities")})]})}):c.length>0?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)("div",{className:"mb-4 text-sm text-muted-foreground",children:a("entityCount",{count:t})}),(0,B.jsx)("div",{className:"overflow-x-auto",children:(0,B.jsxs)(ai,{children:[(0,B.jsx)(aj,{children:(0,B.jsxs)(al,{children:[(0,B.jsx)(am,{children:a("colName")}),(0,B.jsx)(am,{children:a("colMentions")}),(0,B.jsx)(am,{children:a("colFirstSeen")}),(0,B.jsx)(am,{children:a("colLastSeen")})]})}),(0,B.jsx)(ak,{children:c.map(a=>(0,B.jsxs)(al,{onClick:()=>y(a.id),className:`cursor-pointer hover:bg-muted/50 ${g?.id===a.id?"bg-primary/10":""}`,children:[(0,B.jsx)(an,{className:"font-medium text-card-foreground",children:a.canonical_name}),(0,B.jsx)(an,{className:"text-card-foreground",children:a.mention_count}),(0,B.jsx)(an,{className:"text-card-foreground",children:M(a.first_seen)}),(0,B.jsx)(an,{className:"text-card-foreground",children:M(a.last_seen)})]},a.id))})]})}),v>1&&(0,B.jsxs)("div",{className:"flex items-center justify-between mt-3 pt-3 border-t",children:[(0,B.jsxs)("div",{className:"text-xs text-muted-foreground",children:[w+1,"-",Math.min(w+50,t)," of ",t]}),(0,B.jsxs)("div",{className:"flex items-center gap-1",children:[(0,B.jsx)(W.Button,{variant:"outline",size:"sm",onClick:()=>z(1),disabled:1===r||e,className:"h-7 w-7 p-0",children:(0,B.jsx)(_,{className:"h-3 w-3"})}),(0,B.jsx)(W.Button,{variant:"outline",size:"sm",onClick:()=>z(r-1),disabled:1===r||e,className:"h-7 w-7 p-0",children:(0,B.jsx)(P,{className:"h-3 w-3"})}),(0,B.jsxs)("span",{className:"text-xs px-2",children:[r," / ",v]}),(0,B.jsx)(W.Button,{variant:"outline",size:"sm",onClick:()=>z(r+1),disabled:r===v||e,className:"h-7 w-7 p-0",children:(0,B.jsx)(Q.ChevronRight,{className:"h-3 w-3"})}),(0,B.jsx)(W.Button,{variant:"outline",size:"sm",onClick:()=>z(v),disabled:r===v||e,className:"h-7 w-7 p-0",children:(0,B.jsx)(aa,{className:"h-3 w-3"})})]})]})]}):(0,B.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,B.jsxs)("div",{className:"text-center",children:[(0,B.jsx)("div",{className:"text-4xl mb-2",children:"..."}),(0,B.jsx)("div",{className:"text-sm text-muted-foreground",children:a("noEntitiesFound")}),(0,B.jsx)("div",{className:"text-xs text-muted-foreground mt-1",children:a("noEntitiesDescription")})]})})}),g&&(0,B.jsx)("div",{className:"fixed right-0 top-0 h-screen w-[420px] bg-card border-l-2 border-primary shadow-2xl z-50 overflow-y-auto animate-in slide-in-from-right duration-300 ease-out",children:(0,B.jsxs)("div",{className:"p-5",children:[(0,B.jsxs)("div",{className:"flex justify-between items-center mb-6 pb-4 border-b border-border",children:[(0,B.jsxs)("div",{children:[(0,B.jsx)("h3",{className:"text-xl font-bold text-card-foreground",children:g.canonical_name}),(0,B.jsx)("p",{className:"text-sm text-muted-foreground mt-1",children:a("entityDetails")})]}),(0,B.jsx)(W.Button,{variant:"ghost",size:"sm",onClick:()=>h(null),className:"h-8 w-8 p-0",children:(0,B.jsx)("span",{className:"text-lg",children:"x"})})]}),(0,B.jsxs)("div",{className:"space-y-5",children:[(0,B.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,B.jsxs)("div",{className:"p-4 bg-muted/50 rounded-lg",children:[(0,B.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:a("mentionsLabel")}),(0,B.jsx)("div",{className:"text-lg font-semibold text-card-foreground",children:g.mention_count})]}),(0,B.jsxs)("div",{className:"p-4 bg-muted/50 rounded-lg",children:[(0,B.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:a("firstSeenLabel")}),(0,B.jsx)("div",{className:"text-sm font-medium text-card-foreground",children:M(g.first_seen)})]})]}),(0,B.jsxs)("div",{className:"p-4 bg-muted/50 rounded-lg",children:[(0,B.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:a("entityIdLabel")}),(0,B.jsx)("code",{className:"text-xs font-mono break-all text-muted-foreground",children:g.id})]})]})]})})]})}let Jy=["world","experience","observation"],Jz={world:{active:"bg-violet-500/15 text-violet-700 border-violet-400 dark:text-violet-300 dark:border-violet-500",inactive:"border-border text-muted-foreground hover:border-violet-300 hover:text-violet-600 dark:hover:text-violet-400",dot:"bg-violet-500"},experience:{active:"bg-pink-500/15 text-pink-700 border-pink-400 dark:text-pink-300 dark:border-pink-500",inactive:"border-border text-muted-foreground hover:border-pink-300 hover:text-pink-600 dark:hover:text-pink-400",dot:"bg-pink-500"},observation:{active:"bg-indigo-500/15 text-indigo-700 border-indigo-400 dark:text-indigo-300 dark:border-indigo-500",inactive:"border-border text-muted-foreground hover:border-indigo-300 hover:text-indigo-600 dark:hover:text-indigo-400",dot:"bg-indigo-500"}};function JA({ft:a,active:b,onToggle:c}){let d=(0,E.useTranslations)("factTypeFilter"),e=Jz[a];return(0,B.jsxs)("button",{type:"button",onClick:c,className:(0,S.cn)("inline-flex items-center gap-1.5 rounded-full border px-3 py-1 text-xs font-medium transition-all",b?e.active:e.inactive),children:[(0,B.jsx)("span",{className:(0,S.cn)("h-1.5 w-1.5 rounded-full",b?e.dot:"bg-muted-foreground/50")}),d(a)]})}function JB({value:a,onChange:b,label:c}){let d=(0,E.useTranslations)("factTypeFilter"),e=c??d("defaultLabel");return(0,B.jsxs)("div",{className:"flex items-center gap-2",children:[e&&(0,B.jsx)("span",{className:"text-sm font-medium text-muted-foreground",children:e}),(0,B.jsx)("div",{className:"flex gap-1.5",children:Jy.map(c=>(0,B.jsx)(JA,{ft:c,active:a.includes(c),onToggle:()=>b(a.includes(c)?a.filter(a=>a!==c):[...a,c])},c))})]})}function JC({value:a,onChange:b}){return(0,B.jsx)("div",{className:"flex flex-wrap gap-1.5",children:Jy.map(c=>(0,B.jsx)(JA,{ft:c,active:a.includes(c),onToggle:()=>b(a.includes(c)?a.filter(a=>a!==c):[...a,c])},c))})}var JD=a.i(97063);let JE=(0,K.default)("brain",[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]]),JF=(0,K.default)("message-square",[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]]),JG=(0,K.default)("shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]),JH=(0,K.default)("play",[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]]);var JI=a.i(6219);"function"==typeof SuppressedError&&SuppressedError;var JJ=function(){var a=document.getSelection();if(!a.rangeCount)return function(){};for(var b=document.activeElement,c=[],d=0;d<a.rangeCount;d++)c.push(a.getRangeAt(d));switch(b.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":b.blur();break;default:b=null}return a.removeAllRanges(),function(){"Caret"===a.type&&a.removeAllRanges(),a.rangeCount||c.forEach(function(b){a.addRange(b)}),b&&b.focus()}},JK={"text/plain":"Text","text/html":"Url",default:"Text"},JL=function(a,b){var c,d,e,f,g,h,i,j,k=!1;b||(b={}),e=b.debug||!1;try{if(g=JJ(),h=document.createRange(),i=document.getSelection(),(j=document.createElement("span")).textContent=a,j.ariaHidden="true",j.style.all="unset",j.style.position="fixed",j.style.top=0,j.style.clip="rect(0, 0, 0, 0)",j.style.whiteSpace="pre",j.style.webkitUserSelect="text",j.style.MozUserSelect="text",j.style.msUserSelect="text",j.style.userSelect="text",j.addEventListener("copy",function(c){if(c.stopPropagation(),b.format)if(c.preventDefault(),void 0===c.clipboardData){e&&console.warn("unable to use e.clipboardData"),e&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var d=JK[b.format]||JK.default;window.clipboardData.setData(d,a)}else c.clipboardData.clearData(),c.clipboardData.setData(b.format,a);b.onCopy&&(c.preventDefault(),b.onCopy(c.clipboardData))}),document.body.appendChild(j),h.selectNodeContents(j),i.addRange(h),!document.execCommand("copy"))throw Error("copy command was unsuccessful");k=!0}catch(g){e&&console.error("unable to copy using execCommand: ",g),e&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(b.format||"text",a),b.onCopy&&b.onCopy(window.clipboardData),k=!0}catch(g){e&&console.error("unable to copy using clipboardData: ",g),e&&console.error("falling back to prompt"),c="message"in b?b.message:"Copy to clipboard: #{key}, Enter",d=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C",f=c.replace(/#{\s*key\s*}/g,d),window.prompt(f,a)}}finally{i&&("function"==typeof i.removeRange?i.removeRange(h):i.removeAllRanges()),j&&document.body.removeChild(j),g()}return k};function JM(a){return"[object Object]"===Object.prototype.toString.call(a)}function JN(a){return Array.isArray(a)?a.length:JM(a)?Object.keys(a).length:0}function JO(a,b,c,d,e,f){if(f&&void 0!==f.collapsed)return!!f.collapsed;if("boolean"==typeof d)return d;if("number"==typeof d&&b>d)return!0;let g=JN(a);if("function"==typeof d){let e=JR(d,[{node:a,depth:b,indexOrName:c,size:g}]);if("boolean"==typeof e)return e}return!!(Array.isArray(a)&&g>e||JM(a)&&g>e)}function JP(a,b,c,d,e,f){if(f&&void 0!==f.collapsed)return!!f.collapsed;if("boolean"==typeof d)return d;if("number"==typeof d&&b>d)return!0;let g=Math.ceil(a.length/100);if("function"==typeof d){let e=JR(d,[{node:a,depth:b,indexOrName:c,size:g}]);if("boolean"==typeof e)return e}return!!(Array.isArray(a)&&g>e||JM(a)&&g>e)}function JQ(a,b,c){return"boolean"==typeof a?a:"number"==typeof a&&!!(b>a)||"collapsed"===a&&!!c||"expanded"===a&&!c}function JR(a,b){try{return a(...b)}catch(a){reportError(a)}}function JS(a){if(!0===a||JM(a)&&!0===a.add)return!0}function JT(a){if(!0===a||JM(a)&&!0===a.edit)return!0}function JU(a){if(!0===a||JM(a)&&!0===a.delete)return!0}function JV(a){return!a||void 0===a.add||!!a.add}function JW(a){return!a||void 0===a.edit||!!a.edit}function JX(a){return!a||void 0===a.delete||!!a.delete}function JY(a){return!a||void 0===a.enableClipboard||!!a.enableClipboard}function JZ(){return(JZ=Object.assign.bind()).apply(this,arguments)}var J$=function(a){return C.createElement("svg",JZ({xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"none",viewBox:"0 0 16 16"},a),l||(l=C.createElement("path",{fill:"currentColor",d:"M12.473 5.806a.666.666 0 0 0-.946 0L8.473 8.86a.667.667 0 0 1-.946 0L4.473 5.806a.667.667 0 1 0-.946.94l3.06 3.06a2 2 0 0 0 2.826 0l3.06-3.06a.667.667 0 0 0 0-.94Z"})))};function J_(){return(J_=Object.assign.bind()).apply(this,arguments)}var J0=function(a){return C.createElement("svg",J_({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},a),n||(n=C.createElement("path",{fill:"currentColor",d:"M17.542 2.5h-4.75a3.963 3.963 0 0 0-3.959 3.958v4.75a3.963 3.963 0 0 0 3.959 3.959h4.75a3.963 3.963 0 0 0 3.958-3.959v-4.75A3.963 3.963 0 0 0 17.542 2.5Zm2.375 8.708a2.378 2.378 0 0 1-2.375 2.375h-4.75a2.378 2.378 0 0 1-2.375-2.375v-4.75a2.378 2.378 0 0 1 2.375-2.375h4.75a2.378 2.378 0 0 1 2.375 2.375v4.75Zm-4.75 6.334a3.963 3.963 0 0 1-3.959 3.958h-4.75A3.963 3.963 0 0 1 2.5 17.542v-4.75a3.963 3.963 0 0 1 3.958-3.959.791.791 0 1 1 0 1.584 2.378 2.378 0 0 0-2.375 2.375v4.75a2.378 2.378 0 0 0 2.375 2.375h4.75a2.378 2.378 0 0 0 2.375-2.375.792.792 0 1 1 1.584 0Z"})))};function J1(){return(J1=Object.assign.bind()).apply(this,arguments)}var J2=function(a){return C.createElement("svg",J1({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},a),o||(o=C.createElement("path",{fill:"currentColor",d:"M17.25 3H6.75A3.755 3.755 0 0 0 3 6.75v10.5A3.754 3.754 0 0 0 6.75 21h10.5A3.754 3.754 0 0 0 21 17.25V6.75A3.755 3.755 0 0 0 17.25 3Zm2.25 14.25a2.25 2.25 0 0 1-2.25 2.25H6.75a2.25 2.25 0 0 1-2.25-2.25V6.75A2.25 2.25 0 0 1 6.75 4.5h10.5a2.25 2.25 0 0 1 2.25 2.25v10.5Z"})),p||(p=C.createElement("path",{fill:"#14C786",d:"M10.312 14.45 7.83 11.906a.625.625 0 0 0-.896 0 .659.659 0 0 0 0 .918l2.481 2.546a1.264 1.264 0 0 0 .896.381 1.237 1.237 0 0 0 .895-.38l5.858-6.011a.658.658 0 0 0 0-.919.625.625 0 0 0-.896 0l-5.857 6.01Z"})))};function J3({node:a,nodeMeta:b}){let{customizeCopy:c,CopyComponent:d,CopiedComponent:e}=(0,C.useContext)(Kn),[f,g]=(0,C.useState)(!1),h=d=>{d.stopPropagation();let e=c(a,b);"string"==typeof e&&e&&function(a){var b,c,d,e;b=this,c=void 0,d=void 0,e=function*(){try{yield navigator.clipboard.writeText(a)}catch(b){JL(a)}},new(d||(d=Promise))(function(a,f){function g(a){try{i(e.next(a))}catch(a){f(a)}}function h(a){try{i(e.throw(a))}catch(a){f(a)}}function i(b){var c;b.done?a(b.value):((c=b.value)instanceof d?c:new d(function(a){a(c)})).then(g,h)}i((e=e.apply(b,c||[])).next())})}(e),g(!0),setTimeout(()=>g(!1),3e3)};return f?"function"==typeof e?(0,B.jsx)(e,{className:"json-view--copy",style:{display:"inline-block"}}):(0,B.jsx)(J2,{className:"json-view--copy",style:{display:"inline-block"}}):"function"==typeof d?(0,B.jsx)(d,{onClick:h,className:"json-view--copy"}):(0,B.jsx)(J0,{onClick:h,className:"json-view--copy"})}function J4({indexOrName:a,value:b,depth:c,deleteHandle:d,editHandle:e,parent:f,parentPath:g}){let{displayArrayIndex:h}=(0,C.useContext)(Kn),i=Array.isArray(f);return(0,B.jsxs)("div",Object.assign({className:"json-view--pair"},{children:[!i||i&&h?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)("span",Object.assign({className:"number"==typeof a?"json-view--index":"json-view--property"},{children:a})),":"," "]}):(0,B.jsx)(B.Fragment,{}),(0,B.jsx)(Kl,{node:b,depth:c+1,deleteHandle:(a,b)=>d(a,b),editHandle:(a,b,c,d)=>e(a,b,c,d),parent:f,indexOrName:a,parentPath:g})]}))}function J5(){return(J5=Object.assign.bind()).apply(this,arguments)}var J6=function(a){return C.createElement("svg",J5({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},a),q||(q=C.createElement("path",{fill:"currentColor",d:"M18.75 6h-2.325a3.757 3.757 0 0 0-3.675-3h-1.5a3.757 3.757 0 0 0-3.675 3H5.25a.75.75 0 0 0 0 1.5H6v9.75A3.754 3.754 0 0 0 9.75 21h4.5A3.754 3.754 0 0 0 18 17.25V7.5h.75a.75.75 0 1 0 0-1.5Zm-7.5-1.5h1.5A2.255 2.255 0 0 1 14.872 6H9.128a2.255 2.255 0 0 1 2.122-1.5Zm5.25 12.75a2.25 2.25 0 0 1-2.25 2.25h-4.5a2.25 2.25 0 0 1-2.25-2.25V7.5h9v9.75Z"})),r||(r=C.createElement("path",{fill:"#DA0000",d:"M10.5 16.5a.75.75 0 0 0 .75-.75v-4.5a.75.75 0 1 0-1.5 0v4.5a.75.75 0 0 0 .75.75ZM13.5 16.5a.75.75 0 0 0 .75-.75v-4.5a.75.75 0 1 0-1.5 0v4.5a.75.75 0 0 0 .75.75Z"})))};function J7(){return(J7=Object.assign.bind()).apply(this,arguments)}var J8=function(a){return C.createElement("svg",J7({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},a),s||(s=C.createElement("path",{fill:"currentColor",d:"M21 6.75v10.5A3.754 3.754 0 0 1 17.25 21H6.75A3.754 3.754 0 0 1 3 17.25V6.75A3.754 3.754 0 0 1 6.75 3h10.5A3.754 3.754 0 0 1 21 6.75Zm-1.5 0c0-1.24-1.01-2.25-2.25-2.25H6.75C5.51 4.5 4.5 5.51 4.5 6.75v10.5c0 1.24 1.01 2.25 2.25 2.25h10.5c1.24 0 2.25-1.01 2.25-2.25V6.75Z"})),t||(t=C.createElement("path",{fill:"#14C786",d:"M15 12.75a.75.75 0 1 0 0-1.5h-2.25V9a.75.75 0 1 0-1.5 0v2.25H9a.75.75 0 1 0 0 1.5h2.25V15a.75.75 0 1 0 1.5 0v-2.25H15Z"})))};function J9(){return(J9=Object.assign.bind()).apply(this,arguments)}var Ka=function(a){return C.createElement("svg",J9({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},a),u||(u=C.createElement("path",{fill:"currentColor",d:"M12 3a9 9 0 1 0 9 9 9.01 9.01 0 0 0-9-9Zm0 16.5a7.5 7.5 0 1 1 7.5-7.5 7.509 7.509 0 0 1-7.5 7.5Z"})),v||(v=C.createElement("path",{fill:"#14C786",d:"m10.85 13.96-1.986-2.036a.5.5 0 0 0-.716 0 .527.527 0 0 0 0 .735l1.985 2.036a1.01 1.01 0 0 0 .717.305.99.99 0 0 0 .716-.305l4.686-4.808a.526.526 0 0 0 0-.735.5.5 0 0 0-.716 0l-4.687 4.809Z"})))};function Kb(){return(Kb=Object.assign.bind()).apply(this,arguments)}var Kc=function(a){return C.createElement("svg",Kb({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},a),w||(w=C.createElement("path",{fill:"#DA0000",d:"M15 9a.75.75 0 0 0-1.06 0L12 10.94 10.06 9A.75.75 0 0 0 9 10.06L10.94 12 9 13.94A.75.75 0 0 0 10.06 15L12 13.06 13.94 15A.75.75 0 0 0 15 13.94L13.06 12 15 10.06A.75.75 0 0 0 15 9Z"})),x||(x=C.createElement("path",{fill:"currentColor",d:"M12 3a9 9 0 1 0 9 9 9.01 9.01 0 0 0-9-9Zm0 16.5a7.5 7.5 0 1 1 7.5-7.5 7.509 7.509 0 0 1-7.5 7.5Z"})))};function Kd({originNode:a,node:b,depth:c,index:d,deleteHandle:e,customOptions:f,startIndex:g,parent:h,parentPath:i}){let{enableClipboard:j,src:k,onEdit:l,onChange:n,forceUpdate:o,displaySize:p,CustomOperation:q}=(0,C.useContext)(Kn),r=[...i,String(d)],[s,t]=(0,C.useState)(!0),u=(0,C.useCallback)((b,d,e)=>{a[b]=d,l&&l({newValue:d,oldValue:e,depth:c,src:k,indexOrName:b,parentType:"array",parentPath:i}),n&&n({type:"edit",depth:c,src:k,indexOrName:b,parentType:"array",parentPath:i}),o()},[b,l,n,o]),v=b=>{a.splice(b,1),e&&e(b,i),o()},w=(0,B.jsxs)(B.Fragment,{children:[!s&&(0,B.jsxs)("span",Object.assign({onClick:()=>t(!0),className:"jv-size-chevron"},{children:[JQ(p,c,s)&&(0,B.jsxs)("span",Object.assign({className:"jv-size"},{children:[JN(b)," Items"]})),(0,B.jsx)(J$,{className:"jv-chevron"})]})),!s&&j&&JY(f)&&(0,B.jsx)(J3,{node:b,nodeMeta:{depth:c,indexOrName:d,parent:h,parentPath:i,currentPath:r}}),"function"==typeof q?(0,B.jsx)(q,{node:b}):null]});return(0,B.jsxs)("div",{children:[(0,B.jsx)("span",{children:"["}),w,s?(0,B.jsxs)("button",Object.assign({onClick:()=>t(!1),className:"jv-button"},{children:[g," ... ",g+b.length-1]})):(0,B.jsx)("div",Object.assign({className:"jv-indent"},{children:b.map((a,e)=>(0,B.jsx)(J4,{indexOrName:e+g,value:a,depth:c,parent:b,deleteHandle:v,editHandle:u,parentPath:i},String(d)+String(e)))})),(0,B.jsx)("span",{children:"]"})]})}function Ke({node:a,depth:b,deleteHandle:c,indexOrName:d,customOptions:e,parent:f,parentPath:g}){let h=void 0!==d?[...g,String(d)]:g,i=[];for(let b=0;b<a.length;b+=100)i.push(a.slice(b,b+100));let{collapsed:j,enableClipboard:k,collapseObjectsAfterLength:l,editable:n,onDelete:o,src:p,onAdd:q,CustomOperation:r,onChange:s,forceUpdate:t,displaySize:u}=(0,C.useContext)(Kn),[v,w]=(0,C.useState)(JP(a,b,d,j,l,e));(0,C.useEffect)(()=>{w(JP(a,b,d,j,l,e))},[j,l]);let[x,y]=(0,C.useState)(!1),[z,A]=(0,C.useState)(!1),D=()=>{a.push(null),q&&q({indexOrName:a.length-1,depth:b,src:p,parentType:"array",parentPath:g}),s&&s({type:"add",indexOrName:a.length-1,depth:b,src:p,parentType:"array",parentPath:g}),t()},E=x||z,F=(0,B.jsxs)(B.Fragment,{children:[!v&&!E&&(0,B.jsxs)("span",Object.assign({onClick:()=>w(!0),className:"jv-size-chevron"},{children:[JQ(u,b,v)&&(0,B.jsxs)("span",Object.assign({className:"jv-size"},{children:[a.length," Items"]})),(0,B.jsx)(J$,{className:"jv-chevron"})]})),E&&(0,B.jsx)(Ka,{className:"json-view--edit",style:{display:"inline-block"},onClick:z?D:()=>{y(!1),c&&c(d,g),o&&o({value:a,depth:b,src:p,indexOrName:d,parentType:"array",parentPath:g}),s&&s({type:"delete",depth:b,src:p,indexOrName:d,parentType:"array",parentPath:g})}}),E&&(0,B.jsx)(Kc,{className:"json-view--edit",style:{display:"inline-block"},onClick:()=>{y(!1),A(!1)}}),!v&&!E&&k&&JY(e)&&(0,B.jsx)(J3,{node:a,nodeMeta:{depth:b,indexOrName:d,parent:f,parentPath:g,currentPath:h}}),!v&&!E&&JS(n)&&JV(e)&&(0,B.jsx)(J8,{className:"json-view--edit",onClick:()=>{D()}}),!v&&!E&&JU(n)&&JX(e)&&c&&(0,B.jsx)(J6,{className:"json-view--edit",onClick:()=>y(!0)}),"function"==typeof r?(0,B.jsx)(r,{node:a}):null]});return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)("span",{children:"["}),F,v?(0,B.jsx)("button",Object.assign({onClick:()=>w(!1),className:"jv-button"},{children:"..."})):(0,B.jsx)("div",Object.assign({className:"jv-indent"},{children:i.map((f,h)=>(0,B.jsx)(Kd,{originNode:a,node:f,depth:b,index:h,startIndex:100*h,deleteHandle:c,customOptions:e,parentPath:g},String(d)+String(h)))})),(0,B.jsx)("span",{children:"]"}),v&&JQ(u,b,v)&&(0,B.jsxs)("span",Object.assign({onClick:()=>w(!1),className:"jv-size"},{children:[a.length," Items"]}))]})}function Kf({node:a,depth:b,indexOrName:c,deleteHandle:d,customOptions:e,parent:f,parentPath:g}){let{collapsed:h,onCollapse:i,enableClipboard:j,ignoreLargeArray:k,collapseObjectsAfterLength:l,editable:n,onDelete:o,src:p,onAdd:q,onEdit:r,onChange:s,forceUpdate:t,displaySize:u,CustomOperation:v}=(0,C.useContext)(Kn),w=void 0!==c?[...g,String(c)]:g;if(!k&&Array.isArray(a)&&a.length>100)return(0,B.jsx)(Ke,{node:a,depth:b,indexOrName:c,deleteHandle:d,customOptions:e,parentPath:w});let x=JM(a),[y,z]=(0,C.useState)(JO(a,b,c,h,l,e)),A=d=>{null==i||i({isCollapsing:!d,node:a,depth:b,indexOrName:c}),z(d)};(0,C.useEffect)(()=>{A(JO(a,b,c,h,l,e))},[h,l]);let D=(0,C.useCallback)((c,d,e)=>{Array.isArray(a)?a[+c]=d:a&&(a[c]=d),r&&r({newValue:d,oldValue:e,depth:b,src:p,indexOrName:c,parentType:x?"object":"array",parentPath:w}),s&&s({type:"edit",depth:b,src:p,indexOrName:c,parentType:x?"object":"array",parentPath:w}),t()},[a,r,s,t]),E=b=>{Array.isArray(a)?a.splice(+b,1):a&&delete a[b],t()},[F,G]=(0,C.useState)(!1),[H,I]=(0,C.useState)(!1),J=(0,C.useRef)(null),K=()=>{var c;if(x){let d=null==(c=J.current)?void 0:c.value;d&&(a[d]=null,J.current&&(J.current.value=""),I(!1),q&&q({indexOrName:d,depth:b,src:p,parentType:"object",parentPath:w}),s&&s({type:"add",indexOrName:d,depth:b,src:p,parentType:"object",parentPath:w}))}else Array.isArray(a)&&(a.push(null),q&&q({indexOrName:a.length-1,depth:b,src:p,parentType:"array",parentPath:w}),s&&s({type:"add",indexOrName:a.length-1,depth:b,src:p,parentType:"array",parentPath:w}));t()},L=F||H,M=()=>{G(!1),I(!1)},N=(0,B.jsxs)(B.Fragment,{children:[!y&&!L&&(0,B.jsxs)("span",Object.assign({onClick:()=>A(!0),className:"jv-size-chevron"},{children:[JQ(u,b,y)&&(0,B.jsxs)("span",Object.assign({className:"jv-size"},{children:[JN(a)," Items"]})),(0,B.jsx)(J$,{className:"jv-chevron"})]})),H&&x&&(0,B.jsx)("input",{className:"json-view--input",placeholder:"property",ref:J,onKeyDown:a=>{"Enter"===a.key?(a.preventDefault(),K()):"Escape"===a.key&&M()}}),L&&(0,B.jsx)(Ka,{className:"json-view--edit",style:{display:"inline-block"},onClick:H?K:()=>{G(!1),d&&d(c,w),o&&o({value:a,depth:b,src:p,indexOrName:c,parentType:x?"object":"array",parentPath:w}),s&&s({type:"delete",depth:b,src:p,indexOrName:c,parentType:x?"object":"array",parentPath:w})}}),L&&(0,B.jsx)(Kc,{className:"json-view--edit",style:{display:"inline-block"},onClick:M}),!y&&!L&&j&&JY(e)&&(0,B.jsx)(J3,{node:a,nodeMeta:{depth:b,indexOrName:c,parent:f,parentPath:g,currentPath:w}}),!y&&!L&&JS(n)&&JV(e)&&(0,B.jsx)(J8,{className:"json-view--edit",onClick:()=>{x?(I(!0),setTimeout(()=>{var a;return null==(a=J.current)?void 0:a.focus()})):K()}}),!y&&!L&&JU(n)&&JX(e)&&d&&(0,B.jsx)(J6,{className:"json-view--edit",onClick:()=>G(!0)}),"function"==typeof v?(0,B.jsx)(v,{node:a}):null]});return Array.isArray(a)?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)("span",{children:"["}),N,y?(0,B.jsx)("button",Object.assign({onClick:()=>A(!1),className:"jv-button"},{children:"..."})):(0,B.jsx)("div",Object.assign({className:"jv-indent"},{children:a.map((d,e)=>(0,B.jsx)(J4,{indexOrName:e,value:d,depth:b,parent:a,deleteHandle:E,editHandle:D,parentPath:w},String(c)+String(e)))})),(0,B.jsx)("span",{children:"]"}),y&&JQ(u,b,y)&&(0,B.jsxs)("span",Object.assign({onClick:()=>A(!1),className:"jv-size"},{children:[JN(a)," Items"]}))]}):x?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)("span",{children:"{"}),N,y?(0,B.jsx)("button",Object.assign({onClick:()=>A(!1),className:"jv-button"},{children:"..."})):(0,B.jsx)("div",Object.assign({className:"jv-indent"},{children:Object.entries(a).map(([d,e])=>(0,B.jsx)(J4,{indexOrName:d,value:e,depth:b,parent:a,deleteHandle:E,editHandle:D,parentPath:w},String(c)+String(d)))})),(0,B.jsx)("span",{children:"}"}),y&&JQ(u,b,y)&&(0,B.jsxs)("span",Object.assign({onClick:()=>A(!1),className:"jv-size"},{children:[JN(a)," Items"]}))]}):(0,B.jsx)("span",{children:String(a)})}let Kg=C.default.forwardRef(({str:a,className:b,ctrlClick:c},d)=>{let{collapseStringMode:e,collapseStringsAfterLength:f,customizeCollapseStringUI:g}=(0,C.useContext)(Kn),[h,i]=(0,C.useState)(!0),j=(0,C.useRef)(null);f=f>0?f:0;let k=a.replace(/\s+/g," "),l="function"==typeof g?g(k,h):"string"==typeof g?g:"...",n=a=>{var b;if((a.ctrlKey||a.metaKey)&&c)c(a);else{let a=window.getSelection();if(a&&a.anchorOffset!==a.focusOffset&&(null==(b=a.anchorNode)?void 0:b.parentElement)===j.current)return;i(!h)}};if(a.length<=f)return(0,B.jsxs)("span",Object.assign({ref:j,className:b,onClick:c},{children:['"',a,'"']}));if("address"===e)return a.length<=10?(0,B.jsxs)("span",Object.assign({ref:j,className:b,onClick:c},{children:['"',a,'"']})):(0,B.jsxs)("span",Object.assign({ref:j,onClick:n,className:b+" cursor-pointer"},{children:['"',h?[k.slice(0,6),l,k.slice(-4)]:a,'"']}));if("directly"===e)return(0,B.jsxs)("span",Object.assign({ref:j,onClick:n,className:b+" cursor-pointer"},{children:['"',h?[k.slice(0,f),l]:a,'"']}));if("word"===e){let c=f,d=f+1,e=k,g=1;for(;;){if(/\W/.test(a[c])){e=a.slice(0,c);break}if(/\W/.test(a[d])){e=a.slice(0,d);break}if(6===g){e=a.slice(0,f);break}g++,c--,d++}return(0,B.jsxs)("span",Object.assign({ref:j,onClick:n,className:b+" cursor-pointer"},{children:['"',h?[e,l]:a,'"']}))}return(0,B.jsxs)("span",Object.assign({ref:j,className:b},{children:['"',a,'"']}))});function Kh(){return(Kh=Object.assign.bind()).apply(this,arguments)}var Ki=function(a){return C.createElement("svg",Kh({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},a),y||(y=C.createElement("path",{fill:"currentColor",d:"M17.25 3H6.75A3.754 3.754 0 0 0 3 6.75v10.5A3.754 3.754 0 0 0 6.75 21h10.5A3.754 3.754 0 0 0 21 17.25V6.75A3.754 3.754 0 0 0 17.25 3Zm2.25 14.25c0 1.24-1.01 2.25-2.25 2.25H6.75c-1.24 0-2.25-1.01-2.25-2.25V6.75c0-1.24 1.01-2.25 2.25-2.25h10.5c1.24 0 2.25 1.01 2.25 2.25v10.5Zm-6.09-9.466-5.031 5.03a2.981 2.981 0 0 0-.879 2.121v1.19c0 .415.336.75.75.75h1.19c.8 0 1.554-.312 2.12-.879l5.03-5.03a2.252 2.252 0 0 0 0-3.182c-.85-.85-2.331-.85-3.18 0Zm-2.91 7.151c-.28.28-.666.44-1.06.44H9v-.44c0-.4.156-.777.44-1.06l3.187-3.188 1.06 1.061-3.187 3.188Zm5.03-5.03-.782.783-1.06-1.061.782-.782a.766.766 0 0 1 1.06 0 .75.75 0 0 1 0 1.06Z"})))};function Kj(){return(Kj=Object.assign.bind()).apply(this,arguments)}var Kk=function(a){return C.createElement("svg",Kj({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},a),z||(z=C.createElement("path",{fill:"currentColor",d:"M6.75 3h5.5v1.5h-5.5C5.51 4.5 4.5 5.51 4.5 6.75v10.5c0 1.24 1.01 2.25 2.25 2.25h10.5c1.24 0 2.25-1.01 2.25-2.25v-5.5H21v5.5A3.754 3.754 0 0 1 17.25 21H6.75A3.754 3.754 0 0 1 3 17.25V6.75A3.754 3.754 0 0 1 6.75 3Z"})),A||(A=C.createElement("path",{fill:"currentColor",d:"M20.013 3h-3.946a.987.987 0 0 0 0 1.973h1.564l-6.342 6.342a1.004 1.004 0 0 0 0 1.396 1.004 1.004 0 0 0 1.396 0l6.342-6.342v1.564a.987.987 0 0 0 1.973 0V3.987A.987.987 0 0 0 20.013 3Z"})))};function Kl({node:a,depth:b,deleteHandle:c,indexOrName:d,parent:e,editHandle:f,parentPath:g}){let h,{collapseStringsAfterLength:i,enableClipboard:j,editable:k,src:l,onDelete:n,onChange:o,customizeNode:p,matchesURL:q,urlRegExp:r,EditComponent:s,DoneComponent:t,CancelComponent:u,CustomOperation:v}=(0,C.useContext)(Kn);if("function"==typeof p&&(h=JR(p,[{node:a,depth:b,indexOrName:d}])),h){if((0,C.isValidElement)(h))return h;else if("function"==typeof h){let c=h;return(0,B.jsx)(c,{node:a,depth:b,indexOrName:d})}}if(Array.isArray(a)||JM(a))return(0,B.jsx)(Kf,{parent:e,node:a,depth:b,indexOrName:d,deleteHandle:c,parentPath:g,customOptions:"object"==typeof h?h:void 0});{var w;let p=typeof a,x=void 0!==d?[...g,String(d)]:g,[y,z]=(0,C.useState)(!1),[A,D]=(0,C.useState)(!1),E=(0,C.useRef)(null),F=()=>{z(!0),setTimeout(()=>{var a,b;null==(a=window.getSelection())||a.selectAllChildren(E.current),null==(b=E.current)||b.focus()})},G=(0,C.useCallback)(()=>{let b=E.current.innerText;try{let c=JSON.parse(b);f&&f(d,c,a,g)}catch(e){let c="string"===p?b.trim().replace(/^\"([\s\S]+?)\"$/,"$1"):b;f&&f(d,c,a,g)}z(!1)},[f,d,a,g,p]),H=()=>{z(!1),D(!1)},I=()=>{D(!1),c&&c(d,g),n&&n({value:a,depth:b,src:l,indexOrName:d,parentType:Array.isArray(e)?"array":"object",parentPath:g}),o&&o({depth:b,src:l,indexOrName:d,parentType:Array.isArray(e)?"array":"object",type:"delete",parentPath:g})},J=(0,C.useCallback)(a=>{"Enter"===a.key?(a.preventDefault(),G()):"Escape"===a.key&&H()},[G]),K=y||A,L=!K&&JT(k)&&JW(h)&&f?a=>{(a.ctrlKey||a.metaKey)&&F()}:void 0,M=(0,B.jsxs)(B.Fragment,{children:[K&&("function"==typeof t?(0,B.jsx)(t,{className:"json-view--edit",style:{display:"inline-block"},onClick:A?I:G}):(0,B.jsx)(Ka,{className:"json-view--edit",style:{display:"inline-block"},onClick:A?I:G})),K&&("function"==typeof u?(0,B.jsx)(u,{className:"json-view--edit",style:{display:"inline-block"},onClick:H}):(0,B.jsx)(Kc,{className:"json-view--edit",style:{display:"inline-block"},onClick:H})),!K&&j&&JY(h)&&(0,B.jsx)(J3,{node:a,nodeMeta:{depth:b,indexOrName:d,parent:e,parentPath:g,currentPath:x}}),!K&&q&&"string"===p&&r.test(a)&&(!(w=h)||void 0===w.matchesURL||!!w.matchesURL)&&(0,B.jsx)("a",Object.assign({href:a,target:"_blank",className:"json-view--link"},{children:(0,B.jsx)(Kk,{})})),!K&&JT(k)&&JW(h)&&f&&("function"==typeof s?(0,B.jsx)(s,{className:"json-view--edit",onClick:F}):(0,B.jsx)(Ki,{className:"json-view--edit",onClick:F})),!K&&JU(k)&&JX(h)&&c&&(0,B.jsx)(J6,{className:"json-view--edit",onClick:()=>D(!0)}),"function"==typeof v?(0,B.jsx)(v,{node:a}):null]}),N="json-view--string";switch(p){case"number":case"bigint":N="json-view--number";break;case"boolean":N="json-view--boolean";break;case"object":N="json-view--null"}"string"==typeof(null==h?void 0:h.className)&&(N+=" "+h.className),A&&(N+=" json-view--deleting");let O=String(a);"bigint"===p&&(O+="n");let P=(0,C.useMemo)(()=>(0,B.jsx)("span",{contentEditable:!0,className:N,dangerouslySetInnerHTML:{__html:"string"===p?`"${O}"`:O},ref:E,onKeyDown:J}),[O,p,J]);return"string"===p?(0,B.jsxs)(B.Fragment,{children:[y?P:a.length>i?(0,B.jsx)(Kg,{str:a,ref:E,className:N,ctrlClick:L}):(0,B.jsxs)("span",Object.assign({className:N,onClick:L},{children:['"',O,'"']})),M]}):(0,B.jsxs)(B.Fragment,{children:[y?P:(0,B.jsx)("span",Object.assign({className:N,onClick:L},{children:O})),M]})}}let Km=/^(((ht|f)tps?):\/\/)?([^!@#$%^&*?.\s-]([^!@#$%^&*?.\s]{0,63}[^!@#$%^&*?.\s])?\.)+[a-z]{2,6}\/?/,Kn=(0,C.createContext)({src:void 0,collapseStringsAfterLength:99,collapseStringMode:"directly",customizeCollapseStringUI:void 0,collapseObjectsAfterLength:20,collapsed:!1,onCollapse:void 0,enableClipboard:!0,editable:!1,onEdit:void 0,onDelete:void 0,onAdd:void 0,onChange:void 0,forceUpdate:()=>{},customizeNode:void 0,customizeCopy:()=>{},displaySize:void 0,displayArrayIndex:!0,matchesURL:!1,urlRegExp:Km,ignoreLargeArray:!1,CopyComponent:void 0,CopiedComponent:void 0,EditComponent:void 0,CancelComponent:void 0,DoneComponent:void 0,CustomOperation:void 0});function Ko({src:a,collapseStringsAfterLength:b=99,collapseStringMode:c="directly",customizeCollapseStringUI:d,collapseObjectsAfterLength:e=99,collapsed:f,onCollapse:g,enableClipboard:h=!0,editable:i=!1,onEdit:j,onDelete:k,onAdd:l,onChange:n,dark:o=!1,theme:p="default",customizeNode:q,customizeCopy:r=a=>(function(a){if("string"==typeof a)return a;try{return JSON.stringify(a,(a,b)=>{switch(typeof b){case"bigint":return String(b)+"n";case"number":case"boolean":case"object":case"string":return b;default:return String(b)}},void 0)}catch(a){return`${a.name}: ${a.message}`||"JSON.stringify failed"}})(a),displaySize:s,displayArrayIndex:t=!0,style:u,className:v,matchesURL:w=!1,urlRegExp:x=Km,ignoreLargeArray:y=!1,CopyComponent:z,CopiedComponent:A,EditComponent:D,CancelComponent:E,DoneComponent:F,CustomOperation:G}){let[H,I]=(0,C.useState)(0),J=(0,C.useCallback)(()=>I(a=>++a),[]),[K,L]=(0,C.useState)(a);return(0,C.useEffect)(()=>L(a),[a]),(0,B.jsx)(Kn.Provider,Object.assign({value:{src:K,collapseStringsAfterLength:b,collapseStringMode:c,customizeCollapseStringUI:d,collapseObjectsAfterLength:e,collapsed:f,onCollapse:g,enableClipboard:h,editable:i,onEdit:j,onDelete:k,onAdd:l,onChange:n,forceUpdate:J,customizeNode:q,customizeCopy:r,displaySize:s,displayArrayIndex:t,matchesURL:w,urlRegExp:x,ignoreLargeArray:y,CopyComponent:z,CopiedComponent:A,EditComponent:D,CancelComponent:E,DoneComponent:F,CustomOperation:G}},{children:(0,B.jsx)("code",Object.assign({className:"json-view"+(o?" dark":"")+(p&&"default"!==p?" json-view_"+p:"")+(v?" "+v:""),style:u},{children:(0,B.jsx)(Kl,{node:K,depth:1,editHandle:(a,b,c,d)=>{L(b),j&&j({newValue:b,oldValue:c,depth:1,src:K,indexOrName:a,parentType:null,parentPath:d}),n&&n({type:"edit",depth:1,src:K,indexOrName:a,parentType:null,parentPath:d})},deleteHandle:(a,b)=>{L(void 0),k&&k({value:K,depth:1,src:K,indexOrName:a,parentType:null,parentPath:b}),n&&n({depth:1,src:K,indexOrName:a,parentType:null,type:"delete",parentPath:b})},parentPath:[]})}))}))}var bc=bc;let Kp=(0,K.default)("zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]),Kq=(0,K.default)("eraser",[["path",{d:"M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21",key:"g5wo59"}],["path",{d:"m5.082 11.09 8.828 8.828",key:"1wx5vj"}]]);function Kr(){}function Ks(){}let Kt=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Ku=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Kv={};function Kw(a,b){return((b||Kv).jsx?Ku:Kt).test(a)}let Kx=/[ \t\n\f\r]/g;function Ky(a){return""===a.replace(Kx,"")}class Kz{constructor(a,b){this.attribute=b,this.property=a}}Kz.prototype.attribute="",Kz.prototype.booleanish=!1,Kz.prototype.boolean=!1,Kz.prototype.commaOrSpaceSeparated=!1,Kz.prototype.commaSeparated=!1,Kz.prototype.defined=!1,Kz.prototype.mustUseProperty=!1,Kz.prototype.number=!1,Kz.prototype.overloadedBoolean=!1,Kz.prototype.property="",Kz.prototype.spaceSeparated=!1,Kz.prototype.space=void 0;let KA=0,KB=KI(),KC=KI(),KD=KI(),KE=KI(),KF=KI(),KG=KI(),KH=KI();function KI(){return 2**++KA}a.s(["boolean",0,KB,"booleanish",0,KC,"commaOrSpaceSeparated",0,KH,"commaSeparated",0,KG,"number",0,KE,"overloadedBoolean",0,KD,"spaceSeparated",0,KF],53427);var KJ=a.i(53427);let KK=Object.keys(KJ);class KL extends Kz{constructor(a,b,c,d){let e=-1;if(super(a,b),function(a,b,c){c&&(a[b]=c)}(this,"space",d),"number"==typeof c)for(;++e<KK.length;){const a=KK[e];!function(a,b,c){c&&(a[b]=c)}(this,KK[e],(c&KJ[a])===KJ[a])}}}function KM(a){return a.toLowerCase()}KL.prototype.defined=!0;let KN=/[A-Z]/g,KO=/-[a-z]/g,KP=/^data[-\w.:]+$/i;function KQ(a){return"-"+a.toLowerCase()}function KR(a){return a.charAt(1).toUpperCase()}let KS={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"};class KT{constructor(a,b,c){this.normal=b,this.property=a,c&&(this.space=c)}}function KU(a,b){let c={},d={};for(let b of a)Object.assign(c,b.property),Object.assign(d,b.normal);return new KT(c,d,b)}function KV(a){let b={},c={};for(let[d,e]of Object.entries(a.properties)){let f=new KL(d,a.transform(a.attributes||{},d),e,a.space);a.mustUseProperty&&a.mustUseProperty.includes(d)&&(f.mustUseProperty=!0),b[d]=f,c[KM(d)]=d,c[KM(f.attribute)]=d}return new KT(b,c,a.space)}KT.prototype.normal={},KT.prototype.property={},KT.prototype.space=void 0;let KW=KV({properties:{ariaActiveDescendant:null,ariaAtomic:KC,ariaAutoComplete:null,ariaBusy:KC,ariaChecked:KC,ariaColCount:KE,ariaColIndex:KE,ariaColSpan:KE,ariaControls:KF,ariaCurrent:null,ariaDescribedBy:KF,ariaDetails:null,ariaDisabled:KC,ariaDropEffect:KF,ariaErrorMessage:null,ariaExpanded:KC,ariaFlowTo:KF,ariaGrabbed:KC,ariaHasPopup:null,ariaHidden:KC,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:KF,ariaLevel:KE,ariaLive:null,ariaModal:KC,ariaMultiLine:KC,ariaMultiSelectable:KC,ariaOrientation:null,ariaOwns:KF,ariaPlaceholder:null,ariaPosInSet:KE,ariaPressed:KC,ariaReadOnly:KC,ariaRelevant:null,ariaRequired:KC,ariaRoleDescription:KF,ariaRowCount:KE,ariaRowIndex:KE,ariaRowSpan:KE,ariaSelected:KC,ariaSetSize:KE,ariaSort:null,ariaValueMax:KE,ariaValueMin:KE,ariaValueNow:KE,ariaValueText:null,role:null},transform:(a,b)=>"role"===b?b:"aria-"+b.slice(4).toLowerCase()});function KX(a,b){return b in a?a[b]:b}function KY(a,b){return KX(a,b.toLowerCase())}let KZ=KV({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:KG,acceptCharset:KF,accessKey:KF,action:null,allow:null,allowFullScreen:KB,allowPaymentRequest:KB,allowUserMedia:KB,alt:null,as:null,async:KB,autoCapitalize:null,autoComplete:KF,autoFocus:KB,autoPlay:KB,blocking:KF,capture:null,charSet:null,checked:KB,cite:null,className:KF,cols:KE,colSpan:null,content:null,contentEditable:KC,controls:KB,controlsList:KF,coords:KE|KG,crossOrigin:null,data:null,dateTime:null,decoding:null,default:KB,defer:KB,dir:null,dirName:null,disabled:KB,download:KD,draggable:KC,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:KB,formTarget:null,headers:KF,height:KE,hidden:KD,high:KE,href:null,hrefLang:null,htmlFor:KF,httpEquiv:KF,id:null,imageSizes:null,imageSrcSet:null,inert:KB,inputMode:null,integrity:null,is:null,isMap:KB,itemId:null,itemProp:KF,itemRef:KF,itemScope:KB,itemType:KF,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:KB,low:KE,manifest:null,max:null,maxLength:KE,media:null,method:null,min:null,minLength:KE,multiple:KB,muted:KB,name:null,nonce:null,noModule:KB,noValidate:KB,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:KB,optimum:KE,pattern:null,ping:KF,placeholder:null,playsInline:KB,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:KB,referrerPolicy:null,rel:KF,required:KB,reversed:KB,rows:KE,rowSpan:KE,sandbox:KF,scope:null,scoped:KB,seamless:KB,selected:KB,shadowRootClonable:KB,shadowRootDelegatesFocus:KB,shadowRootMode:null,shape:null,size:KE,sizes:null,slot:null,span:KE,spellCheck:KC,src:null,srcDoc:null,srcLang:null,srcSet:null,start:KE,step:null,style:null,tabIndex:KE,target:null,title:null,translate:null,type:null,typeMustMatch:KB,useMap:null,value:KC,width:KE,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:KF,axis:null,background:null,bgColor:null,border:KE,borderColor:null,bottomMargin:KE,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:KB,declare:KB,event:null,face:null,frame:null,frameBorder:null,hSpace:KE,leftMargin:KE,link:null,longDesc:null,lowSrc:null,marginHeight:KE,marginWidth:KE,noResize:KB,noHref:KB,noShade:KB,noWrap:KB,object:null,profile:null,prompt:null,rev:null,rightMargin:KE,rules:null,scheme:null,scrolling:KC,standby:null,summary:null,text:null,topMargin:KE,valueType:null,version:null,vAlign:null,vLink:null,vSpace:KE,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:KB,disableRemotePlayback:KB,prefix:null,property:null,results:KE,security:null,unselectable:null},space:"html",transform:KY}),K$=KV({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:KH,accentHeight:KE,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:KE,amplitude:KE,arabicForm:null,ascent:KE,attributeName:null,attributeType:null,azimuth:KE,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:KE,by:null,calcMode:null,capHeight:KE,className:KF,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:KE,diffuseConstant:KE,direction:null,display:null,dur:null,divisor:KE,dominantBaseline:null,download:KB,dx:null,dy:null,edgeMode:null,editable:null,elevation:KE,enableBackground:null,end:null,event:null,exponent:KE,externalResourcesRequired:null,fill:null,fillOpacity:KE,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:KG,g2:KG,glyphName:KG,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:KE,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:KE,horizOriginX:KE,horizOriginY:KE,id:null,ideographic:KE,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:KE,k:KE,k1:KE,k2:KE,k3:KE,k4:KE,kernelMatrix:KH,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:KE,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:KE,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:KE,overlineThickness:KE,paintOrder:null,panose1:null,path:null,pathLength:KE,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:KF,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:KE,pointsAtY:KE,pointsAtZ:KE,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:KH,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:KH,rev:KH,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:KH,requiredFeatures:KH,requiredFonts:KH,requiredFormats:KH,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:KE,specularExponent:KE,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:KE,strikethroughThickness:KE,string:null,stroke:null,strokeDashArray:KH,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:KE,strokeOpacity:KE,strokeWidth:null,style:null,surfaceScale:KE,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:KH,tabIndex:KE,tableValues:null,target:null,targetX:KE,targetY:KE,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:KH,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:KE,underlineThickness:KE,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:KE,values:null,vAlphabetic:KE,vMathematical:KE,vectorEffect:null,vHanging:KE,vIdeographic:KE,version:null,vertAdvY:KE,vertOriginX:KE,vertOriginY:KE,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:KE,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:KX}),K_=KV({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform:(a,b)=>"xlink:"+b.slice(5).toLowerCase()}),K0=KV({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:KY}),K1=KV({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform:(a,b)=>"xml:"+b.slice(3).toLowerCase()}),K2=KU([KW,KZ,K_,K0,K1],"html"),K3=KU([KW,K$,K_,K0,K1],"svg");var K4=a.i(52540);let K5=K7("end"),K6=K7("start");function K7(a){return function(b){let c=b&&b.position&&b.position[a]||{};if("number"==typeof c.line&&c.line>0&&"number"==typeof c.column&&c.column>0)return{line:c.line,column:c.column,offset:"number"==typeof c.offset&&c.offset>-1?c.offset:void 0}}}function K8(a){return a&&"object"==typeof a?"position"in a||"type"in a?La(a.position):"start"in a||"end"in a?La(a):"line"in a||"column"in a?K9(a):"":""}function K9(a){return Lb(a&&a.line)+":"+Lb(a&&a.column)}function La(a){return K9(a&&a.start)+"-"+K9(a&&a.end)}function Lb(a){return a&&"number"==typeof a?a:1}class Lc extends Error{constructor(a,b,c){super(),"string"==typeof b&&(c=b,b=void 0);let d="",e={},f=!1;if(b&&(e="line"in b&&"column"in b||"start"in b&&"end"in b?{place:b}:"type"in b?{ancestors:[b],place:b.position}:{...b}),"string"==typeof a?d=a:!e.cause&&a&&(f=!0,d=a.message,e.cause=a),!e.ruleId&&!e.source&&"string"==typeof c){const a=c.indexOf(":");-1===a?e.ruleId=c:(e.source=c.slice(0,a),e.ruleId=c.slice(a+1))}if(!e.place&&e.ancestors&&e.ancestors){const a=e.ancestors[e.ancestors.length-1];a&&(e.place=a.position)}const g=e.place&&"start"in e.place?e.place.start:e.place;this.ancestors=e.ancestors||void 0,this.cause=e.cause||void 0,this.column=g?g.column:void 0,this.fatal=void 0,this.file="",this.message=d,this.line=g?g.line:void 0,this.name=K8(e.place)||"1:1",this.place=e.place||void 0,this.reason=this.message,this.ruleId=e.ruleId||void 0,this.source=e.source||void 0,this.stack=f&&e.cause&&"string"==typeof e.cause.stack?e.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Lc.prototype.file="",Lc.prototype.name="",Lc.prototype.reason="",Lc.prototype.message="",Lc.prototype.stack="",Lc.prototype.column=void 0,Lc.prototype.line=void 0,Lc.prototype.ancestors=void 0,Lc.prototype.cause=void 0,Lc.prototype.fatal=void 0,Lc.prototype.place=void 0,Lc.prototype.ruleId=void 0,Lc.prototype.source=void 0;let Ld={}.hasOwnProperty,Le=new Map,Lf=/[A-Z]/g,Lg=new Set(["table","tbody","thead","tfoot","tr"]),Lh=new Set(["td","th"]),Li="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Lj(a,b,c){var d,e,f,g,h,i,j,k,l;let n,o,p,q,r,s,t,u,v,w,x;return"element"===b.type?(d=a,e=b,f=c,o=n=d.schema,"svg"===e.tagName.toLowerCase()&&"html"===n.space&&(d.schema=K3),d.ancestors.push(e),p=Ln(d,e.tagName,!1),q=function(a,b){let c,d,e={};for(d in b.properties)if("children"!==d&&Ld.call(b.properties,d)){let f=function(a,b,c){let d=function(a,b){let c=KM(b),d=b,e=Kz;if(c in a.normal)return a.property[a.normal[c]];if(c.length>4&&"data"===c.slice(0,4)&&KP.test(b)){if("-"===b.charAt(4)){let a=b.slice(5).replace(KO,KR);d="data"+a.charAt(0).toUpperCase()+a.slice(1)}else{let a=b.slice(4);if(!KO.test(a)){let c=a.replace(KN,KQ);"-"!==c.charAt(0)&&(c="-"+c),b="data"+c}}e=KL}return new e(d,b)}(a.schema,b);if(!(null==c||"number"==typeof c&&Number.isNaN(c))){var e;let b;if(Array.isArray(c)&&(c=d.commaSeparated?(b={},(""===(e=c)[e.length-1]?[...e,""]:e).join((b.padRight?" ":"")+","+(!1===b.padLeft?"":" ")).trim()):c.join(" ").trim()),"style"===d.property){let b="object"==typeof c?c:function(a,b){try{return(0,K4.default)(b,{reactCompat:!0})}catch(c){if(a.ignoreInvalidStyle)return{};let b=new Lc("Cannot parse `style` attribute",{ancestors:a.ancestors,cause:c,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw b.file=a.filePath||void 0,b.url=Li+"#cannot-parse-style-attribute",b}}(a,String(c));return"css"===a.stylePropertyNameCase&&(b=function(a){let b,c={};for(b in a)Ld.call(a,b)&&(c[function(a){let b=a.replace(Lf,Lp);return"ms-"===b.slice(0,3)&&(b="-"+b),b}(b)]=a[b]);return c}(b)),["style",b]}return["react"===a.elementAttributeNameCase&&d.space?KS[d.property]||d.property:d.attribute,c]}}(a,d,b.properties[d]);if(f){let[d,g]=f;a.tableCellAlignToStyle&&"align"===d&&"string"==typeof g&&Lh.has(b.tagName)?c=g:e[d]=g}}return c&&((e.style||(e.style={}))["css"===a.stylePropertyNameCase?"text-align":"textAlign"]=c),e}(d,e),r=Lm(d,e),Lg.has(e.tagName)&&(r=r.filter(function(a){return"string"!=typeof a||!("object"==typeof a?"text"===a.type&&Ky(a.value):Ky(a))})),Lk(d,q,p,e),Ll(q,r),d.ancestors.pop(),d.schema=n,d.create(e,p,q,f)):"mdxFlowExpression"===b.type||"mdxTextExpression"===b.type?function(a,b){if(b.data&&b.data.estree&&a.evaluater){let c=b.data.estree.body[0];return Kr("ExpressionStatement"===c.type),a.evaluater.evaluateExpression(c.expression)}Lo(a,b.position)}(a,b):"mdxJsxFlowElement"===b.type||"mdxJsxTextElement"===b.type?(g=a,h=b,i=c,t=s=g.schema,"svg"===h.name&&"html"===s.space&&(g.schema=K3),g.ancestors.push(h),u=null===h.name?g.Fragment:Ln(g,h.name,!0),v=function(a,b){let c={};for(let d of b.attributes)if("mdxJsxExpressionAttribute"===d.type)if(d.data&&d.data.estree&&a.evaluater){let b=d.data.estree.body[0];Kr("ExpressionStatement"===b.type);let e=b.expression;Kr("ObjectExpression"===e.type);let f=e.properties[0];Kr("SpreadElement"===f.type),Object.assign(c,a.evaluater.evaluateExpression(f.argument))}else Lo(a,b.position);else{let e,f=d.name;if(d.value&&"object"==typeof d.value)if(d.value.data&&d.value.data.estree&&a.evaluater){let b=d.value.data.estree.body[0];Kr("ExpressionStatement"===b.type),e=a.evaluater.evaluateExpression(b.expression)}else Lo(a,b.position);else e=null===d.value||d.value;c[f]=e}return c}(g,h),w=Lm(g,h),Lk(g,v,u,h),Ll(v,w),g.ancestors.pop(),g.schema=s,g.create(h,u,v,i)):"mdxjsEsm"===b.type?function(a,b){if(b.data&&b.data.estree&&a.evaluater)return a.evaluater.evaluateProgram(b.data.estree);Lo(a,b.position)}(a,b):"root"===b.type?(j=a,k=b,l=c,Ll(x={},Lm(j,k)),j.create(k,j.Fragment,x,l)):"text"===b.type?b.value:void 0}function Lk(a,b,c,d){"string"!=typeof c&&c!==a.Fragment&&a.passNode&&(b.node=d)}function Ll(a,b){if(b.length>0){let c=b.length>1?b:b[0];c&&(a.children=c)}}function Lm(a,b){let c=[],d=-1,e=a.passKeys?new Map:Le;for(;++d<b.children.length;){let f,g=b.children[d];if(a.passKeys){let a="element"===g.type?g.tagName:"mdxJsxFlowElement"===g.type||"mdxJsxTextElement"===g.type?g.name:void 0;if(a){let b=e.get(a)||0;f=a+"-"+b,e.set(a,b+1)}}let h=Lj(a,g,f);void 0!==h&&c.push(h)}return c}function Ln(a,b,c){let d;if(c)if(b.includes(".")){let a,c=b.split("."),e=-1;for(;++e<c.length;){let b=Kw(c[e])?{type:"Identifier",name:c[e]}:{type:"Literal",value:c[e]};a=a?{type:"MemberExpression",object:a,property:b,computed:!!(e&&"Literal"===b.type),optional:!1}:b}Kr(a,"always a result"),d=a}else d=Kw(b)&&!/^[a-z]/.test(b)?{type:"Identifier",name:b}:{type:"Literal",value:b};else d={type:"Literal",value:b};if("Literal"===d.type){let b=d.value;return Ld.call(a.components,b)?a.components[b]:b}if(a.evaluater)return a.evaluater.evaluateExpression(d);Lo(a)}function Lo(a,b){let c=new Lc("Cannot handle MDX estrees without `createEvaluater`",{ancestors:a.ancestors,place:b,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw c.file=a.filePath||void 0,c.url=Li+"#cannot-handle-mdx-estrees-without-createevaluater",c}function Lp(a){return"-"+a.toLowerCase()}let Lq={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},Lr={};function Ls(a,b){let c=b||Lr;return Lt(a,"boolean"!=typeof c.includeImageAlt||c.includeImageAlt,"boolean"!=typeof c.includeHtml||c.includeHtml)}function Lt(a,b,c){var d;if((d=a)&&"object"==typeof d){if("value"in a)return"html"!==a.type||c?a.value:"";if(b&&"alt"in a&&a.alt)return a.alt;if("children"in a)return Lu(a.children,b,c)}return Array.isArray(a)?Lu(a,b,c):""}function Lu(a,b,c){let d=[],e=-1;for(;++e<a.length;)d[e]=Lt(a[e],b,c);return d.join("")}function Lv(a,b,c,d){let e,f=a.length,g=0;if(b=b<0?-b>f?0:f+b:b>f?f:b,c=c>0?c:0,d.length<1e4)(e=Array.from(d)).unshift(b,c),a.splice(...e);else for(c&&a.splice(b,c);g<d.length;)(e=d.slice(g,g+1e4)).unshift(b,0),a.splice(...e),g+=1e4,b+=1e4}function Lw(a,b){return a.length>0?(Lv(a,a.length,0,b),a):b}let Lx={}.hasOwnProperty;function Ly(a){let b={},c=-1;for(;++c<a.length;)!function(a,b){let c;for(c in b){let d,e=(Lx.call(a,c)?a[c]:void 0)||(a[c]={}),f=b[c];if(f)for(d in f){Lx.call(e,d)||(e[d]=[]);let a=f[d];!function(a,b){let c=-1,d=[];for(;++c<b.length;)("after"===b[c].add?a:d).push(b[c]);Lv(a,0,0,d)}(e[d],Array.isArray(a)?a:a?[a]:[])}}}(b,a[c]);return b}function Lz(a){return null!==a&&a<-2}function LA(a){return -2===a||-1===a||32===a}function LB(a){return function(b){return null!==b&&b>-1&&a.test(String.fromCharCode(b))}}function LC(a,b,c,d){let e=d?d-1:1/0,f=0;return function(d){return LA(d)?(a.enter(c),function d(g){return LA(g)&&f++<e?(a.consume(g),d):(a.exit(c),b(g))}(d)):b(d)}}LB(/[A-Za-z]/),LB(/[\dA-Za-z]/),LB(/[#-'*+\--9=?A-Z^-~]/),LB(/\d/),LB(/[\dA-Fa-f]/),LB(/[!-/:-@[-`{-~]/),LB(/\p{P}|\p{S}/u),LB(/\s/);let LD={tokenize:function(a){let b,c=a.attempt(this.parser.constructs.contentInitial,function(b){return null===b?void a.consume(b):(a.enter("lineEnding"),a.consume(b),a.exit("lineEnding"),LC(a,c,"linePrefix"))},function(c){return a.enter("paragraph"),function c(d){let e=a.enter("chunkText",{contentType:"text",previous:b});return b&&(b.next=e),b=e,function b(d){if(null===d){a.exit("chunkText"),a.exit("paragraph"),a.consume(d);return}return Lz(d)?(a.consume(d),a.exit("chunkText"),c):(a.consume(d),b)}(d)}(c)});return c}},LE={tokenize:function(a){let b,c,d,e=this,f=[],g=0;return h;function h(b){if(g<f.length){let c=f[g];return e.containerState=c[1],a.attempt(c[0].continuation,i,j)(b)}return j(b)}function i(a){if(g++,e.containerState._closeFlow){let c;e.containerState._closeFlow=void 0,b&&s();let d=e.events.length,f=d;for(;f--;)if("exit"===e.events[f][0]&&"chunkFlow"===e.events[f][1].type){c=e.events[f][1].end;break}r(g);let h=d;for(;h<e.events.length;)e.events[h][1].end={...c},h++;return Lv(e.events,f+1,0,e.events.slice(d)),e.events.length=h,j(a)}return h(a)}function j(c){if(g===f.length){if(!b)return n(c);if(b.currentConstruct&&b.currentConstruct.concrete)return p(c);e.interrupt=!!(b.currentConstruct&&!b._gfmTableDynamicInterruptHack)}return e.containerState={},a.check(LF,k,l)(c)}function k(a){return b&&s(),r(g),n(a)}function l(a){return e.parser.lazy[e.now().line]=g!==f.length,d=e.now().offset,p(a)}function n(b){return e.containerState={},a.attempt(LF,o,p)(b)}function o(a){return g++,f.push([e.currentConstruct,e.containerState]),n(a)}function p(d){if(null===d){b&&s(),r(0),a.consume(d);return}return b=b||e.parser.flow(e.now()),a.enter("chunkFlow",{_tokenizer:b,contentType:"flow",previous:c}),function b(c){if(null===c){q(a.exit("chunkFlow"),!0),r(0),a.consume(c);return}return Lz(c)?(a.consume(c),q(a.exit("chunkFlow")),g=0,e.interrupt=void 0,h):(a.consume(c),b)}(d)}function q(a,f){let h=e.sliceStream(a);if(f&&h.push(null),a.previous=c,c&&(c.next=a),c=a,b.defineSkip(a.start),b.write(h),e.parser.lazy[a.start.line]){let a,c,f=b.events.length;for(;f--;)if(b.events[f][1].start.offset<d&&(!b.events[f][1].end||b.events[f][1].end.offset>d))return;let h=e.events.length,i=h;for(;i--;)if("exit"===e.events[i][0]&&"chunkFlow"===e.events[i][1].type){if(a){c=e.events[i][1].end;break}a=!0}for(r(g),f=h;f<e.events.length;)e.events[f][1].end={...c},f++;Lv(e.events,i+1,0,e.events.slice(h)),e.events.length=f}}function r(b){let c=f.length;for(;c-- >b;){let b=f[c];e.containerState=b[1],b[0].exit.call(e,a)}f.length=b}function s(){b.write([null]),c=void 0,b=void 0,e.containerState._closeFlow=void 0}}},LF={tokenize:function(a,b,c){return LC(a,a.attempt(this.parser.constructs.document,b,c),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}},LG=LP(/[A-Za-z]/),LH=LP(/[\dA-Za-z]/),LI=LP(/[#-'*+\--9=?A-Z^-~]/),LJ=LP(/\d/),LK=LP(/[\dA-Fa-f]/),LL=LP(/[!-/:-@[-`{-~]/);function LM(a){return null!==a&&a<-2}function LN(a){return null!==a&&(a<0||32===a)}function LO(a){return -2===a||-1===a||32===a}function LP(a){return function(b){return null!==b&&b>-1&&a.test(String.fromCharCode(b))}}function LQ(a,b,c,d){let e=d?d-1:1/0,f=0;return function(d){return LO(d)?(a.enter(c),function d(g){return LO(g)&&f++<e?(a.consume(g),d):(a.exit(c),b(g))}(d)):b(d)}}LP(/\p{P}|\p{S}/u),LP(/\s/);let LR={partial:!0,tokenize:function(a,b,c){return function(b){return LO(b)?LQ(a,d,"linePrefix")(b):d(b)};function d(a){return null===a||LM(a)?b(a):c(a)}}};class LS{constructor(a){this.left=a?[...a]:[],this.right=[]}get(a){if(a<0||a>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+a+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return a<this.left.length?this.left[a]:this.right[this.right.length-a+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(a,b){let c=null==b?1/0:b;return c<this.left.length?this.left.slice(a,c):a>this.left.length?this.right.slice(this.right.length-c+this.left.length,this.right.length-a+this.left.length).reverse():this.left.slice(a).concat(this.right.slice(this.right.length-c+this.left.length).reverse())}splice(a,b,c){this.setCursor(Math.trunc(a));let d=this.right.splice(this.right.length-(b||0),1/0);return c&<(this.left,c),d.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(a){this.setCursor(1/0),this.left.push(a)}pushMany(a){this.setCursor(1/0),LT(this.left,a)}unshift(a){this.setCursor(0),this.right.push(a)}unshiftMany(a){this.setCursor(0),LT(this.right,a.reverse())}setCursor(a){if(a!==this.left.length&&(!(a>this.left.length)||0!==this.right.length)&&(!(a<0)||0!==this.left.length))if(a<this.left.length){let b=this.left.splice(a,1/0);LT(this.right,b.reverse())}else{let b=this.right.splice(this.left.length+this.right.length-a,1/0);LT(this.left,b.reverse())}}}function LT(a,b){let c=0;if(b.length<1e4)a.push(...b);else for(;c<b.length;)a.push(...b.slice(c,c+1e4)),c+=1e4}function LU(a){let b,c,d,e,f,g,h,i={},j=-1,k=new LS(a);for(;++j<k.length;){for(;j in i;)j=i[j];if(b=k.get(j),j&&"chunkFlow"===b[1].type&&"listItemPrefix"===k.get(j-1)[1].type&&((d=0)<(g=b[1]._tokenizer.events).length&&"lineEndingBlank"===g[d][1].type&&(d+=2),d<g.length&&"content"===g[d][1].type))for(;++d<g.length&&"content"!==g[d][1].type;)"chunkText"===g[d][1].type&&(g[d][1]._isInFirstContentOfListItem=!0,d++);if("enter"===b[0])b[1].contentType&&(Object.assign(i,function(a,b){let c,d,e=a.get(b)[1],f=a.get(b)[2],g=b-1,h=[],i=e._tokenizer;!i&&(i=f.parser[e.contentType](e.start),e._contentTypeTextTrailing&&(i._contentTypeTextTrailing=!0));let j=i.events,k=[],l={},n=-1,o=e,p=0,q=0,r=[0];for(;o;){for(;a.get(++g)[1]!==o;);h.push(g),!o._tokenizer&&(c=f.sliceStream(o),o.next||c.push(null),d&&i.defineSkip(o.start),o._isInFirstContentOfListItem&&(i._gfmTasklistFirstContentOfListItem=!0),i.write(c),o._isInFirstContentOfListItem&&(i._gfmTasklistFirstContentOfListItem=void 0)),d=o,o=o.next}for(o=e;++n<j.length;)"exit"===j[n][0]&&"enter"===j[n-1][0]&&j[n][1].type===j[n-1][1].type&&j[n][1].start.line!==j[n][1].end.line&&(q=n+1,r.push(q),o._tokenizer=void 0,o.previous=void 0,o=o.next);for(i.events=[],o?(o._tokenizer=void 0,o.previous=void 0):r.pop(),n=r.length;n--;){let b=j.slice(r[n],r[n+1]),c=h.pop();k.push([c,c+b.length-1]),a.splice(c,2,b)}for(k.reverse(),n=-1;++n<k.length;)l[p+k[n][0]]=p+k[n][1],p+=k[n][1]-k[n][0]-1;return l}(k,j)),j=i[j],h=!0);else if(b[1]._container){for(d=j,c=void 0;d--;)if("lineEnding"===(e=k.get(d))[1].type||"lineEndingBlank"===e[1].type)"enter"===e[0]&&(c&&(k.get(c)[1].type="lineEndingBlank"),e[1].type="lineEnding",c=d);else if("linePrefix"===e[1].type||"listItemIndent"===e[1].type);else break;c&&(b[1].end={...k.get(c)[1].start},(f=k.slice(c,j)).unshift(b),k.splice(c,j-c+1,f))}}return Lv(a,0,1/0,k.slice(0)),!h}let LV={resolve:function(a){return LU(a),a},tokenize:function(a,b){let c;return function(b){return a.enter("content"),c=a.enter("chunkContent",{contentType:"content"}),d(b)};function d(b){return null===b?e(b):LM(b)?a.check(LW,f,e)(b):(a.consume(b),d)}function e(c){return a.exit("chunkContent"),a.exit("content"),b(c)}function f(b){return a.consume(b),a.exit("chunkContent"),c.next=a.enter("chunkContent",{contentType:"content",previous:c}),c=c.next,d}}},LW={partial:!0,tokenize:function(a,b,c){let d=this;return function(b){return a.exit("chunkContent"),a.enter("lineEnding"),a.consume(b),a.exit("lineEnding"),LQ(a,e,"linePrefix")};function e(e){if(null===e||LM(e))return c(e);let f=d.events[d.events.length-1];return!d.parser.constructs.disable.null.includes("codeIndented")&&f&&"linePrefix"===f[1].type&&f[2].sliceSerialize(f[1],!0).length>=4?b(e):a.interrupt(d.parser.constructs.flow,c,b)(e)}}},LX={tokenize:function(a){let b=this,c=a.attempt(LR,function(d){return null===d?void a.consume(d):(a.enter("lineEndingBlank"),a.consume(d),a.exit("lineEndingBlank"),b.currentConstruct=void 0,c)},a.attempt(this.parser.constructs.flowInitial,d,LC(a,a.attempt(this.parser.constructs.flow,d,a.attempt(LV,d)),"linePrefix")));return c;function d(d){return null===d?void a.consume(d):(a.enter("lineEnding"),a.consume(d),a.exit("lineEnding"),b.currentConstruct=void 0,c)}}},LY={resolveAll:L0()},LZ=L_("string"),L$=L_("text");function L_(a){return{resolveAll:L0("text"===a?L1:void 0),tokenize:function(b){let c=this,d=this.parser.constructs[a],e=b.attempt(d,f,g);return f;function f(a){return i(a)?e(a):g(a)}function g(a){return null===a?void b.consume(a):(b.enter("data"),b.consume(a),h)}function h(a){return i(a)?(b.exit("data"),e(a)):(b.consume(a),h)}function i(a){if(null===a)return!0;let b=d[a],e=-1;if(b)for(;++e<b.length;){let a=b[e];if(!a.previous||a.previous.call(c,c.previous))return!0}return!1}}}}function L0(a){return function(b,c){let d,e=-1;for(;++e<=b.length;)void 0===d?b[e]&&"data"===b[e][1].type&&(d=e,e++):b[e]&&"data"===b[e][1].type||(e!==d+2&&(b[d][1].end=b[e-1][1].end,b.splice(d+2,e-d-2),e=d+2),d=void 0);return a?a(b,c):b}}function L1(a,b){let c=0;for(;++c<=a.length;)if((c===a.length||"lineEnding"===a[c][1].type)&&"data"===a[c-1][1].type){let d,e=a[c-1][1],f=b.sliceStream(e),g=f.length,h=-1,i=0;for(;g--;){let a=f[g];if("string"==typeof a){for(h=a.length;32===a.charCodeAt(h-1);)i++,h--;if(h)break;h=-1}else if(-2===a)d=!0,i++;else if(-1===a);else{g++;break}}if(b._contentTypeTextTrailing&&c===a.length&&(i=0),i){let f={type:c===a.length||d||i<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:g?h:e.start._bufferIndex+h,_index:e.start._index+g,line:e.end.line,column:e.end.column-i,offset:e.end.offset-i},end:{...e.end}};e.end={...f.start},e.start.offset===e.end.offset?Object.assign(e,f):(a.splice(c,0,["enter",f,b],["exit",f,b]),c+=2)}c++}return a}L4(/[A-Za-z]/),L4(/[\dA-Za-z]/),L4(/[#-'*+\--9=?A-Z^-~]/),L4(/\d/),L4(/[\dA-Fa-f]/),L4(/[!-/:-@[-`{-~]/);let L2=L4(/\p{P}|\p{S}/u),L3=L4(/\s/);function L4(a){return function(b){return null!==b&&b>-1&&a.test(String.fromCharCode(b))}}function L5(a){return null===a||null!==a&&(a<0||32===a)||L3(a)?1:L2(a)?2:void 0}function L6(a,b,c){let d=[],e=-1;for(;++e<a.length;){let f=a[e].resolveAll;f&&!d.includes(f)&&(b=f(b,c),d.push(f))}return b}let L7={name:"attention",resolveAll:function(a,b){let c,d,e,f,g,h,i,j,k=-1;for(;++k<a.length;)if("enter"===a[k][0]&&"attentionSequence"===a[k][1].type&&a[k][1]._close){for(c=k;c--;)if("exit"===a[c][0]&&"attentionSequence"===a[c][1].type&&a[c][1]._open&&b.sliceSerialize(a[c][1]).charCodeAt(0)===b.sliceSerialize(a[k][1]).charCodeAt(0)){if((a[c][1]._close||a[k][1]._open)&&(a[k][1].end.offset-a[k][1].start.offset)%3&&!((a[c][1].end.offset-a[c][1].start.offset+a[k][1].end.offset-a[k][1].start.offset)%3))continue;h=a[c][1].end.offset-a[c][1].start.offset>1&&a[k][1].end.offset-a[k][1].start.offset>1?2:1;let l={...a[c][1].end},n={...a[k][1].start};L8(l,-h),L8(n,h),f={type:h>1?"strongSequence":"emphasisSequence",start:l,end:{...a[c][1].end}},g={type:h>1?"strongSequence":"emphasisSequence",start:{...a[k][1].start},end:n},e={type:h>1?"strongText":"emphasisText",start:{...a[c][1].end},end:{...a[k][1].start}},d={type:h>1?"strong":"emphasis",start:{...f.start},end:{...g.end}},a[c][1].end={...f.start},a[k][1].start={...g.end},i=[],a[c][1].end.offset-a[c][1].start.offset&&(i=Lw(i,[["enter",a[c][1],b],["exit",a[c][1],b]])),i=Lw(i,[["enter",d,b],["enter",f,b],["exit",f,b],["enter",e,b]]),i=Lw(i,L6(b.parser.constructs.insideSpan.null,a.slice(c+1,k),b)),i=Lw(i,[["exit",e,b],["enter",g,b],["exit",g,b],["exit",d,b]]),a[k][1].end.offset-a[k][1].start.offset?(j=2,i=Lw(i,[["enter",a[k][1],b],["exit",a[k][1],b]])):j=0,Lv(a,c-1,k-c+3,i),k=c+i.length-j-2;break}}for(k=-1;++k<a.length;)"attentionSequence"===a[k][1].type&&(a[k][1].type="data");return a},tokenize:function(a,b){let c,d=this.parser.constructs.attentionMarkers.null,e=this.previous,f=L5(e);return function(g){return c=g,a.enter("attentionSequence"),function g(h){if(h===c)return a.consume(h),g;let i=a.exit("attentionSequence"),j=L5(h),k=!j||2===j&&f||d.includes(h),l=!f||2===f&&j||d.includes(e);return i._open=!!(42===c?k:k&&(f||!l)),i._close=!!(42===c?l:l&&(j||!k)),b(h)}(g)}}};function L8(a,b){a.column+=b,a.offset+=b,a._bufferIndex+=b}let L9={continuation:{tokenize:function(a,b,c){let d=this;return function(b){return LO(b)?LQ(a,e,"linePrefix",d.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(b):e(b)};function e(d){return a.attempt(L9,b,c)(d)}}},exit:function(a){a.exit("blockQuote")},name:"blockQuote",tokenize:function(a,b,c){let d=this;return function(b){if(62===b){let c=d.containerState;return c.open||(a.enter("blockQuote",{_container:!0}),c.open=!0),a.enter("blockQuotePrefix"),a.enter("blockQuoteMarker"),a.consume(b),a.exit("blockQuoteMarker"),e}return c(b)};function e(c){return LO(c)?(a.enter("blockQuotePrefixWhitespace"),a.consume(c),a.exit("blockQuotePrefixWhitespace"),a.exit("blockQuotePrefix"),b):(a.exit("blockQuotePrefix"),b(c))}}},Ma={name:"characterEscape",tokenize:function(a,b,c){return function(b){return a.enter("characterEscape"),a.enter("escapeMarker"),a.consume(b),a.exit("escapeMarker"),d};function d(d){return LL(d)?(a.enter("characterEscapeValue"),a.consume(d),a.exit("characterEscapeValue"),a.exit("characterEscape"),b):c(d)}}},Mb={AElig:"Æ",AMP:"&",Aacute:"Á",Abreve:"Ă",Acirc:"Â",Acy:"А",Afr:"𝔄",Agrave:"À",Alpha:"Α",Amacr:"Ā",And:"⩓",Aogon:"Ą",Aopf:"𝔸",ApplyFunction:"",Aring:"Å",Ascr:"𝒜",Assign:"≔",Atilde:"Ã",Auml:"Ä",Backslash:"∖",Barv:"⫧",Barwed:"⌆",Bcy:"Б",Because:"∵",Bernoullis:"ℬ",Beta:"Β",Bfr:"𝔅",Bopf:"𝔹",Breve:"˘",Bscr:"ℬ",Bumpeq:"≎",CHcy:"Ч",COPY:"©",Cacute:"Ć",Cap:"⋒",CapitalDifferentialD:"ⅅ",Cayleys:"ℭ",Ccaron:"Č",Ccedil:"Ç",Ccirc:"Ĉ",Cconint:"∰",Cdot:"Ċ",Cedilla:"¸",CenterDot:"·",Cfr:"ℭ",Chi:"Χ",CircleDot:"⊙",CircleMinus:"⊖",CirclePlus:"⊕",CircleTimes:"⊗",ClockwiseContourIntegral:"∲",CloseCurlyDoubleQuote:"”",CloseCurlyQuote:"’",Colon:"∷",Colone:"⩴",Congruent:"≡",Conint:"∯",ContourIntegral:"∮",Copf:"ℂ",Coproduct:"∐",CounterClockwiseContourIntegral:"∳",Cross:"⨯",Cscr:"𝒞",Cup:"⋓",CupCap:"≍",DD:"ⅅ",DDotrahd:"⤑",DJcy:"Ђ",DScy:"Ѕ",DZcy:"Џ",Dagger:"‡",Darr:"↡",Dashv:"⫤",Dcaron:"Ď",Dcy:"Д",Del:"∇",Delta:"Δ",Dfr:"𝔇",DiacriticalAcute:"´",DiacriticalDot:"˙",DiacriticalDoubleAcute:"˝",DiacriticalGrave:"`",DiacriticalTilde:"˜",Diamond:"⋄",DifferentialD:"ⅆ",Dopf:"𝔻",Dot:"¨",DotDot:"⃜",DotEqual:"≐",DoubleContourIntegral:"∯",DoubleDot:"¨",DoubleDownArrow:"⇓",DoubleLeftArrow:"⇐",DoubleLeftRightArrow:"⇔",DoubleLeftTee:"⫤",DoubleLongLeftArrow:"⟸",DoubleLongLeftRightArrow:"⟺",DoubleLongRightArrow:"⟹",DoubleRightArrow:"⇒",DoubleRightTee:"⊨",DoubleUpArrow:"⇑",DoubleUpDownArrow:"⇕",DoubleVerticalBar:"∥",DownArrow:"↓",DownArrowBar:"⤓",DownArrowUpArrow:"⇵",DownBreve:"̑",DownLeftRightVector:"⥐",DownLeftTeeVector:"⥞",DownLeftVector:"↽",DownLeftVectorBar:"⥖",DownRightTeeVector:"⥟",DownRightVector:"⇁",DownRightVectorBar:"⥗",DownTee:"⊤",DownTeeArrow:"↧",Downarrow:"⇓",Dscr:"𝒟",Dstrok:"Đ",ENG:"Ŋ",ETH:"Ð",Eacute:"É",Ecaron:"Ě",Ecirc:"Ê",Ecy:"Э",Edot:"Ė",Efr:"𝔈",Egrave:"È",Element:"∈",Emacr:"Ē",EmptySmallSquare:"◻",EmptyVerySmallSquare:"▫",Eogon:"Ę",Eopf:"𝔼",Epsilon:"Ε",Equal:"⩵",EqualTilde:"≂",Equilibrium:"⇌",Escr:"ℰ",Esim:"⩳",Eta:"Η",Euml:"Ë",Exists:"∃",ExponentialE:"ⅇ",Fcy:"Ф",Ffr:"𝔉",FilledSmallSquare:"◼",FilledVerySmallSquare:"▪",Fopf:"𝔽",ForAll:"∀",Fouriertrf:"ℱ",Fscr:"ℱ",GJcy:"Ѓ",GT:">",Gamma:"Γ",Gammad:"Ϝ",Gbreve:"Ğ",Gcedil:"Ģ",Gcirc:"Ĝ",Gcy:"Г",Gdot:"Ġ",Gfr:"𝔊",Gg:"⋙",Gopf:"𝔾",GreaterEqual:"≥",GreaterEqualLess:"⋛",GreaterFullEqual:"≧",GreaterGreater:"⪢",GreaterLess:"≷",GreaterSlantEqual:"⩾",GreaterTilde:"≳",Gscr:"𝒢",Gt:"≫",HARDcy:"Ъ",Hacek:"ˇ",Hat:"^",Hcirc:"Ĥ",Hfr:"ℌ",HilbertSpace:"ℋ",Hopf:"ℍ",HorizontalLine:"─",Hscr:"ℋ",Hstrok:"Ħ",HumpDownHump:"≎",HumpEqual:"≏",IEcy:"Е",IJlig:"IJ",IOcy:"Ё",Iacute:"Í",Icirc:"Î",Icy:"И",Idot:"İ",Ifr:"ℑ",Igrave:"Ì",Im:"ℑ",Imacr:"Ī",ImaginaryI:"ⅈ",Implies:"⇒",Int:"∬",Integral:"∫",Intersection:"⋂",InvisibleComma:"",InvisibleTimes:"",Iogon:"Į",Iopf:"𝕀",Iota:"Ι",Iscr:"ℐ",Itilde:"Ĩ",Iukcy:"І",Iuml:"Ï",Jcirc:"Ĵ",Jcy:"Й",Jfr:"𝔍",Jopf:"𝕁",Jscr:"𝒥",Jsercy:"Ј",Jukcy:"Є",KHcy:"Х",KJcy:"Ќ",Kappa:"Κ",Kcedil:"Ķ",Kcy:"К",Kfr:"𝔎",Kopf:"𝕂",Kscr:"𝒦",LJcy:"Љ",LT:"<",Lacute:"Ĺ",Lambda:"Λ",Lang:"⟪",Laplacetrf:"ℒ",Larr:"↞",Lcaron:"Ľ",Lcedil:"Ļ",Lcy:"Л",LeftAngleBracket:"⟨",LeftArrow:"←",LeftArrowBar:"⇤",LeftArrowRightArrow:"⇆",LeftCeiling:"⌈",LeftDoubleBracket:"⟦",LeftDownTeeVector:"⥡",LeftDownVector:"⇃",LeftDownVectorBar:"⥙",LeftFloor:"⌊",LeftRightArrow:"↔",LeftRightVector:"⥎",LeftTee:"⊣",LeftTeeArrow:"↤",LeftTeeVector:"⥚",LeftTriangle:"⊲",LeftTriangleBar:"⧏",LeftTriangleEqual:"⊴",LeftUpDownVector:"⥑",LeftUpTeeVector:"⥠",LeftUpVector:"↿",LeftUpVectorBar:"⥘",LeftVector:"↼",LeftVectorBar:"⥒",Leftarrow:"⇐",Leftrightarrow:"⇔",LessEqualGreater:"⋚",LessFullEqual:"≦",LessGreater:"≶",LessLess:"⪡",LessSlantEqual:"⩽",LessTilde:"≲",Lfr:"𝔏",Ll:"⋘",Lleftarrow:"⇚",Lmidot:"Ŀ",LongLeftArrow:"⟵",LongLeftRightArrow:"⟷",LongRightArrow:"⟶",Longleftarrow:"⟸",Longleftrightarrow:"⟺",Longrightarrow:"⟹",Lopf:"𝕃",LowerLeftArrow:"↙",LowerRightArrow:"↘",Lscr:"ℒ",Lsh:"↰",Lstrok:"Ł",Lt:"≪",Map:"⤅",Mcy:"М",MediumSpace:" ",Mellintrf:"ℳ",Mfr:"𝔐",MinusPlus:"∓",Mopf:"𝕄",Mscr:"ℳ",Mu:"Μ",NJcy:"Њ",Nacute:"Ń",Ncaron:"Ň",Ncedil:"Ņ",Ncy:"Н",NegativeMediumSpace:"",NegativeThickSpace:"",NegativeThinSpace:"",NegativeVeryThinSpace:"",NestedGreaterGreater:"≫",NestedLessLess:"≪",NewLine:"\n",Nfr:"𝔑",NoBreak:"",NonBreakingSpace:" ",Nopf:"ℕ",Not:"⫬",NotCongruent:"≢",NotCupCap:"≭",NotDoubleVerticalBar:"∦",NotElement:"∉",NotEqual:"≠",NotEqualTilde:"≂̸",NotExists:"∄",NotGreater:"≯",NotGreaterEqual:"≱",NotGreaterFullEqual:"≧̸",NotGreaterGreater:"≫̸",NotGreaterLess:"≹",NotGreaterSlantEqual:"⩾̸",NotGreaterTilde:"≵",NotHumpDownHump:"≎̸",NotHumpEqual:"≏̸",NotLeftTriangle:"⋪",NotLeftTriangleBar:"⧏̸",NotLeftTriangleEqual:"⋬",NotLess:"≮",NotLessEqual:"≰",NotLessGreater:"≸",NotLessLess:"≪̸",NotLessSlantEqual:"⩽̸",NotLessTilde:"≴",NotNestedGreaterGreater:"⪢̸",NotNestedLessLess:"⪡̸",NotPrecedes:"⊀",NotPrecedesEqual:"⪯̸",NotPrecedesSlantEqual:"⋠",NotReverseElement:"∌",NotRightTriangle:"⋫",NotRightTriangleBar:"⧐̸",NotRightTriangleEqual:"⋭",NotSquareSubset:"⊏̸",NotSquareSubsetEqual:"⋢",NotSquareSuperset:"⊐̸",NotSquareSupersetEqual:"⋣",NotSubset:"⊂⃒",NotSubsetEqual:"⊈",NotSucceeds:"⊁",NotSucceedsEqual:"⪰̸",NotSucceedsSlantEqual:"⋡",NotSucceedsTilde:"≿̸",NotSuperset:"⊃⃒",NotSupersetEqual:"⊉",NotTilde:"≁",NotTildeEqual:"≄",NotTildeFullEqual:"≇",NotTildeTilde:"≉",NotVerticalBar:"∤",Nscr:"𝒩",Ntilde:"Ñ",Nu:"Ν",OElig:"Œ",Oacute:"Ó",Ocirc:"Ô",Ocy:"О",Odblac:"Ő",Ofr:"𝔒",Ograve:"Ò",Omacr:"Ō",Omega:"Ω",Omicron:"Ο",Oopf:"𝕆",OpenCurlyDoubleQuote:"“",OpenCurlyQuote:"‘",Or:"⩔",Oscr:"𝒪",Oslash:"Ø",Otilde:"Õ",Otimes:"⨷",Ouml:"Ö",OverBar:"‾",OverBrace:"⏞",OverBracket:"⎴",OverParenthesis:"⏜",PartialD:"∂",Pcy:"П",Pfr:"𝔓",Phi:"Φ",Pi:"Π",PlusMinus:"±",Poincareplane:"ℌ",Popf:"ℙ",Pr:"⪻",Precedes:"≺",PrecedesEqual:"⪯",PrecedesSlantEqual:"≼",PrecedesTilde:"≾",Prime:"″",Product:"∏",Proportion:"∷",Proportional:"∝",Pscr:"𝒫",Psi:"Ψ",QUOT:'"',Qfr:"𝔔",Qopf:"ℚ",Qscr:"𝒬",RBarr:"⤐",REG:"®",Racute:"Ŕ",Rang:"⟫",Rarr:"↠",Rarrtl:"⤖",Rcaron:"Ř",Rcedil:"Ŗ",Rcy:"Р",Re:"ℜ",ReverseElement:"∋",ReverseEquilibrium:"⇋",ReverseUpEquilibrium:"⥯",Rfr:"ℜ",Rho:"Ρ",RightAngleBracket:"⟩",RightArrow:"→",RightArrowBar:"⇥",RightArrowLeftArrow:"⇄",RightCeiling:"⌉",RightDoubleBracket:"⟧",RightDownTeeVector:"⥝",RightDownVector:"⇂",RightDownVectorBar:"⥕",RightFloor:"⌋",RightTee:"⊢",RightTeeArrow:"↦",RightTeeVector:"⥛",RightTriangle:"⊳",RightTriangleBar:"⧐",RightTriangleEqual:"⊵",RightUpDownVector:"⥏",RightUpTeeVector:"⥜",RightUpVector:"↾",RightUpVectorBar:"⥔",RightVector:"⇀",RightVectorBar:"⥓",Rightarrow:"⇒",Ropf:"ℝ",RoundImplies:"⥰",Rrightarrow:"⇛",Rscr:"ℛ",Rsh:"↱",RuleDelayed:"⧴",SHCHcy:"Щ",SHcy:"Ш",SOFTcy:"Ь",Sacute:"Ś",Sc:"⪼",Scaron:"Š",Scedil:"Ş",Scirc:"Ŝ",Scy:"С",Sfr:"𝔖",ShortDownArrow:"↓",ShortLeftArrow:"←",ShortRightArrow:"→",ShortUpArrow:"↑",Sigma:"Σ",SmallCircle:"∘",Sopf:"𝕊",Sqrt:"√",Square:"□",SquareIntersection:"⊓",SquareSubset:"⊏",SquareSubsetEqual:"⊑",SquareSuperset:"⊐",SquareSupersetEqual:"⊒",SquareUnion:"⊔",Sscr:"𝒮",Star:"⋆",Sub:"⋐",Subset:"⋐",SubsetEqual:"⊆",Succeeds:"≻",SucceedsEqual:"⪰",SucceedsSlantEqual:"≽",SucceedsTilde:"≿",SuchThat:"∋",Sum:"∑",Sup:"⋑",Superset:"⊃",SupersetEqual:"⊇",Supset:"⋑",THORN:"Þ",TRADE:"™",TSHcy:"Ћ",TScy:"Ц",Tab:" ",Tau:"Τ",Tcaron:"Ť",Tcedil:"Ţ",Tcy:"Т",Tfr:"𝔗",Therefore:"∴",Theta:"Θ",ThickSpace:" ",ThinSpace:" ",Tilde:"∼",TildeEqual:"≃",TildeFullEqual:"≅",TildeTilde:"≈",Topf:"𝕋",TripleDot:"⃛",Tscr:"𝒯",Tstrok:"Ŧ",Uacute:"Ú",Uarr:"↟",Uarrocir:"⥉",Ubrcy:"Ў",Ubreve:"Ŭ",Ucirc:"Û",Ucy:"У",Udblac:"Ű",Ufr:"𝔘",Ugrave:"Ù",Umacr:"Ū",UnderBar:"_",UnderBrace:"⏟",UnderBracket:"⎵",UnderParenthesis:"⏝",Union:"⋃",UnionPlus:"⊎",Uogon:"Ų",Uopf:"𝕌",UpArrow:"↑",UpArrowBar:"⤒",UpArrowDownArrow:"⇅",UpDownArrow:"↕",UpEquilibrium:"⥮",UpTee:"⊥",UpTeeArrow:"↥",Uparrow:"⇑",Updownarrow:"⇕",UpperLeftArrow:"↖",UpperRightArrow:"↗",Upsi:"ϒ",Upsilon:"Υ",Uring:"Ů",Uscr:"𝒰",Utilde:"Ũ",Uuml:"Ü",VDash:"⊫",Vbar:"⫫",Vcy:"В",Vdash:"⊩",Vdashl:"⫦",Vee:"⋁",Verbar:"‖",Vert:"‖",VerticalBar:"∣",VerticalLine:"|",VerticalSeparator:"❘",VerticalTilde:"≀",VeryThinSpace:" ",Vfr:"𝔙",Vopf:"𝕍",Vscr:"𝒱",Vvdash:"⊪",Wcirc:"Ŵ",Wedge:"⋀",Wfr:"𝔚",Wopf:"𝕎",Wscr:"𝒲",Xfr:"𝔛",Xi:"Ξ",Xopf:"𝕏",Xscr:"𝒳",YAcy:"Я",YIcy:"Ї",YUcy:"Ю",Yacute:"Ý",Ycirc:"Ŷ",Ycy:"Ы",Yfr:"𝔜",Yopf:"𝕐",Yscr:"𝒴",Yuml:"Ÿ",ZHcy:"Ж",Zacute:"Ź",Zcaron:"Ž",Zcy:"З",Zdot:"Ż",ZeroWidthSpace:"",Zeta:"Ζ",Zfr:"ℨ",Zopf:"ℤ",Zscr:"𝒵",aacute:"á",abreve:"ă",ac:"∾",acE:"∾̳",acd:"∿",acirc:"â",acute:"´",acy:"а",aelig:"æ",af:"",afr:"𝔞",agrave:"à",alefsym:"ℵ",aleph:"ℵ",alpha:"α",amacr:"ā",amalg:"⨿",amp:"&",and:"∧",andand:"⩕",andd:"⩜",andslope:"⩘",andv:"⩚",ang:"∠",ange:"⦤",angle:"∠",angmsd:"∡",angmsdaa:"⦨",angmsdab:"⦩",angmsdac:"⦪",angmsdad:"⦫",angmsdae:"⦬",angmsdaf:"⦭",angmsdag:"⦮",angmsdah:"⦯",angrt:"∟",angrtvb:"⊾",angrtvbd:"⦝",angsph:"∢",angst:"Å",angzarr:"⍼",aogon:"ą",aopf:"𝕒",ap:"≈",apE:"⩰",apacir:"⩯",ape:"≊",apid:"≋",apos:"'",approx:"≈",approxeq:"≊",aring:"å",ascr:"𝒶",ast:"*",asymp:"≈",asympeq:"≍",atilde:"ã",auml:"ä",awconint:"∳",awint:"⨑",bNot:"⫭",backcong:"≌",backepsilon:"϶",backprime:"‵",backsim:"∽",backsimeq:"⋍",barvee:"⊽",barwed:"⌅",barwedge:"⌅",bbrk:"⎵",bbrktbrk:"⎶",bcong:"≌",bcy:"б",bdquo:"„",becaus:"∵",because:"∵",bemptyv:"⦰",bepsi:"϶",bernou:"ℬ",beta:"β",beth:"ℶ",between:"≬",bfr:"𝔟",bigcap:"⋂",bigcirc:"◯",bigcup:"⋃",bigodot:"⨀",bigoplus:"⨁",bigotimes:"⨂",bigsqcup:"⨆",bigstar:"★",bigtriangledown:"▽",bigtriangleup:"△",biguplus:"⨄",bigvee:"⋁",bigwedge:"⋀",bkarow:"⤍",blacklozenge:"⧫",blacksquare:"▪",blacktriangle:"▴",blacktriangledown:"▾",blacktriangleleft:"◂",blacktriangleright:"▸",blank:"␣",blk12:"▒",blk14:"░",blk34:"▓",block:"█",bne:"=⃥",bnequiv:"≡⃥",bnot:"⌐",bopf:"𝕓",bot:"⊥",bottom:"⊥",bowtie:"⋈",boxDL:"╗",boxDR:"╔",boxDl:"╖",boxDr:"╓",boxH:"═",boxHD:"╦",boxHU:"╩",boxHd:"╤",boxHu:"╧",boxUL:"╝",boxUR:"╚",boxUl:"╜",boxUr:"╙",boxV:"║",boxVH:"╬",boxVL:"╣",boxVR:"╠",boxVh:"╫",boxVl:"╢",boxVr:"╟",boxbox:"⧉",boxdL:"╕",boxdR:"╒",boxdl:"┐",boxdr:"┌",boxh:"─",boxhD:"╥",boxhU:"╨",boxhd:"┬",boxhu:"┴",boxminus:"⊟",boxplus:"⊞",boxtimes:"⊠",boxuL:"╛",boxuR:"╘",boxul:"┘",boxur:"└",boxv:"│",boxvH:"╪",boxvL:"╡",boxvR:"╞",boxvh:"┼",boxvl:"┤",boxvr:"├",bprime:"‵",breve:"˘",brvbar:"¦",bscr:"𝒷",bsemi:"⁏",bsim:"∽",bsime:"⋍",bsol:"\\",bsolb:"⧅",bsolhsub:"⟈",bull:"•",bullet:"•",bump:"≎",bumpE:"⪮",bumpe:"≏",bumpeq:"≏",cacute:"ć",cap:"∩",capand:"⩄",capbrcup:"⩉",capcap:"⩋",capcup:"⩇",capdot:"⩀",caps:"∩︀",caret:"⁁",caron:"ˇ",ccaps:"⩍",ccaron:"č",ccedil:"ç",ccirc:"ĉ",ccups:"⩌",ccupssm:"⩐",cdot:"ċ",cedil:"¸",cemptyv:"⦲",cent:"¢",centerdot:"·",cfr:"𝔠",chcy:"ч",check:"✓",checkmark:"✓",chi:"χ",cir:"○",cirE:"⧃",circ:"ˆ",circeq:"≗",circlearrowleft:"↺",circlearrowright:"↻",circledR:"®",circledS:"Ⓢ",circledast:"⊛",circledcirc:"⊚",circleddash:"⊝",cire:"≗",cirfnint:"⨐",cirmid:"⫯",cirscir:"⧂",clubs:"♣",clubsuit:"♣",colon:":",colone:"≔",coloneq:"≔",comma:",",commat:"@",comp:"∁",compfn:"∘",complement:"∁",complexes:"ℂ",cong:"≅",congdot:"⩭",conint:"∮",copf:"𝕔",coprod:"∐",copy:"©",copysr:"℗",crarr:"↵",cross:"✗",cscr:"𝒸",csub:"⫏",csube:"⫑",csup:"⫐",csupe:"⫒",ctdot:"⋯",cudarrl:"⤸",cudarrr:"⤵",cuepr:"⋞",cuesc:"⋟",cularr:"↶",cularrp:"⤽",cup:"∪",cupbrcap:"⩈",cupcap:"⩆",cupcup:"⩊",cupdot:"⊍",cupor:"⩅",cups:"∪︀",curarr:"↷",curarrm:"⤼",curlyeqprec:"⋞",curlyeqsucc:"⋟",curlyvee:"⋎",curlywedge:"⋏",curren:"¤",curvearrowleft:"↶",curvearrowright:"↷",cuvee:"⋎",cuwed:"⋏",cwconint:"∲",cwint:"∱",cylcty:"⌭",dArr:"⇓",dHar:"⥥",dagger:"†",daleth:"ℸ",darr:"↓",dash:"‐",dashv:"⊣",dbkarow:"⤏",dblac:"˝",dcaron:"ď",dcy:"д",dd:"ⅆ",ddagger:"‡",ddarr:"⇊",ddotseq:"⩷",deg:"°",delta:"δ",demptyv:"⦱",dfisht:"⥿",dfr:"𝔡",dharl:"⇃",dharr:"⇂",diam:"⋄",diamond:"⋄",diamondsuit:"♦",diams:"♦",die:"¨",digamma:"ϝ",disin:"⋲",div:"÷",divide:"÷",divideontimes:"⋇",divonx:"⋇",djcy:"ђ",dlcorn:"⌞",dlcrop:"⌍",dollar:"$",dopf:"𝕕",dot:"˙",doteq:"≐",doteqdot:"≑",dotminus:"∸",dotplus:"∔",dotsquare:"⊡",doublebarwedge:"⌆",downarrow:"↓",downdownarrows:"⇊",downharpoonleft:"⇃",downharpoonright:"⇂",drbkarow:"⤐",drcorn:"⌟",drcrop:"⌌",dscr:"𝒹",dscy:"ѕ",dsol:"⧶",dstrok:"đ",dtdot:"⋱",dtri:"▿",dtrif:"▾",duarr:"⇵",duhar:"⥯",dwangle:"⦦",dzcy:"џ",dzigrarr:"⟿",eDDot:"⩷",eDot:"≑",eacute:"é",easter:"⩮",ecaron:"ě",ecir:"≖",ecirc:"ê",ecolon:"≕",ecy:"э",edot:"ė",ee:"ⅇ",efDot:"≒",efr:"𝔢",eg:"⪚",egrave:"è",egs:"⪖",egsdot:"⪘",el:"⪙",elinters:"⏧",ell:"ℓ",els:"⪕",elsdot:"⪗",emacr:"ē",empty:"∅",emptyset:"∅",emptyv:"∅",emsp13:" ",emsp14:" ",emsp:" ",eng:"ŋ",ensp:" ",eogon:"ę",eopf:"𝕖",epar:"⋕",eparsl:"⧣",eplus:"⩱",epsi:"ε",epsilon:"ε",epsiv:"ϵ",eqcirc:"≖",eqcolon:"≕",eqsim:"≂",eqslantgtr:"⪖",eqslantless:"⪕",equals:"=",equest:"≟",equiv:"≡",equivDD:"⩸",eqvparsl:"⧥",erDot:"≓",erarr:"⥱",escr:"ℯ",esdot:"≐",esim:"≂",eta:"η",eth:"ð",euml:"ë",euro:"€",excl:"!",exist:"∃",expectation:"ℰ",exponentiale:"ⅇ",fallingdotseq:"≒",fcy:"ф",female:"♀",ffilig:"ffi",fflig:"ff",ffllig:"ffl",ffr:"𝔣",filig:"fi",fjlig:"fj",flat:"♭",fllig:"fl",fltns:"▱",fnof:"ƒ",fopf:"𝕗",forall:"∀",fork:"⋔",forkv:"⫙",fpartint:"⨍",frac12:"½",frac13:"⅓",frac14:"¼",frac15:"⅕",frac16:"⅙",frac18:"⅛",frac23:"⅔",frac25:"⅖",frac34:"¾",frac35:"⅗",frac38:"⅜",frac45:"⅘",frac56:"⅚",frac58:"⅝",frac78:"⅞",frasl:"⁄",frown:"⌢",fscr:"𝒻",gE:"≧",gEl:"⪌",gacute:"ǵ",gamma:"γ",gammad:"ϝ",gap:"⪆",gbreve:"ğ",gcirc:"ĝ",gcy:"г",gdot:"ġ",ge:"≥",gel:"⋛",geq:"≥",geqq:"≧",geqslant:"⩾",ges:"⩾",gescc:"⪩",gesdot:"⪀",gesdoto:"⪂",gesdotol:"⪄",gesl:"⋛︀",gesles:"⪔",gfr:"𝔤",gg:"≫",ggg:"⋙",gimel:"ℷ",gjcy:"ѓ",gl:"≷",glE:"⪒",gla:"⪥",glj:"⪤",gnE:"≩",gnap:"⪊",gnapprox:"⪊",gne:"⪈",gneq:"⪈",gneqq:"≩",gnsim:"⋧",gopf:"𝕘",grave:"`",gscr:"ℊ",gsim:"≳",gsime:"⪎",gsiml:"⪐",gt:">",gtcc:"⪧",gtcir:"⩺",gtdot:"⋗",gtlPar:"⦕",gtquest:"⩼",gtrapprox:"⪆",gtrarr:"⥸",gtrdot:"⋗",gtreqless:"⋛",gtreqqless:"⪌",gtrless:"≷",gtrsim:"≳",gvertneqq:"≩︀",gvnE:"≩︀",hArr:"⇔",hairsp:" ",half:"½",hamilt:"ℋ",hardcy:"ъ",harr:"↔",harrcir:"⥈",harrw:"↭",hbar:"ℏ",hcirc:"ĥ",hearts:"♥",heartsuit:"♥",hellip:"…",hercon:"⊹",hfr:"𝔥",hksearow:"⤥",hkswarow:"⤦",hoarr:"⇿",homtht:"∻",hookleftarrow:"↩",hookrightarrow:"↪",hopf:"𝕙",horbar:"―",hscr:"𝒽",hslash:"ℏ",hstrok:"ħ",hybull:"⁃",hyphen:"‐",iacute:"í",ic:"",icirc:"î",icy:"и",iecy:"е",iexcl:"¡",iff:"⇔",ifr:"𝔦",igrave:"ì",ii:"ⅈ",iiiint:"⨌",iiint:"∭",iinfin:"⧜",iiota:"℩",ijlig:"ij",imacr:"ī",image:"ℑ",imagline:"ℐ",imagpart:"ℑ",imath:"ı",imof:"⊷",imped:"Ƶ",in:"∈",incare:"℅",infin:"∞",infintie:"⧝",inodot:"ı",int:"∫",intcal:"⊺",integers:"ℤ",intercal:"⊺",intlarhk:"⨗",intprod:"⨼",iocy:"ё",iogon:"į",iopf:"𝕚",iota:"ι",iprod:"⨼",iquest:"¿",iscr:"𝒾",isin:"∈",isinE:"⋹",isindot:"⋵",isins:"⋴",isinsv:"⋳",isinv:"∈",it:"",itilde:"ĩ",iukcy:"і",iuml:"ï",jcirc:"ĵ",jcy:"й",jfr:"𝔧",jmath:"ȷ",jopf:"𝕛",jscr:"𝒿",jsercy:"ј",jukcy:"є",kappa:"κ",kappav:"ϰ",kcedil:"ķ",kcy:"к",kfr:"𝔨",kgreen:"ĸ",khcy:"х",kjcy:"ќ",kopf:"𝕜",kscr:"𝓀",lAarr:"⇚",lArr:"⇐",lAtail:"⤛",lBarr:"⤎",lE:"≦",lEg:"⪋",lHar:"⥢",lacute:"ĺ",laemptyv:"⦴",lagran:"ℒ",lambda:"λ",lang:"⟨",langd:"⦑",langle:"⟨",lap:"⪅",laquo:"«",larr:"←",larrb:"⇤",larrbfs:"⤟",larrfs:"⤝",larrhk:"↩",larrlp:"↫",larrpl:"⤹",larrsim:"⥳",larrtl:"↢",lat:"⪫",latail:"⤙",late:"⪭",lates:"⪭︀",lbarr:"⤌",lbbrk:"❲",lbrace:"{",lbrack:"[",lbrke:"⦋",lbrksld:"⦏",lbrkslu:"⦍",lcaron:"ľ",lcedil:"ļ",lceil:"⌈",lcub:"{",lcy:"л",ldca:"⤶",ldquo:"“",ldquor:"„",ldrdhar:"⥧",ldrushar:"⥋",ldsh:"↲",le:"≤",leftarrow:"←",leftarrowtail:"↢",leftharpoondown:"↽",leftharpoonup:"↼",leftleftarrows:"⇇",leftrightarrow:"↔",leftrightarrows:"⇆",leftrightharpoons:"⇋",leftrightsquigarrow:"↭",leftthreetimes:"⋋",leg:"⋚",leq:"≤",leqq:"≦",leqslant:"⩽",les:"⩽",lescc:"⪨",lesdot:"⩿",lesdoto:"⪁",lesdotor:"⪃",lesg:"⋚︀",lesges:"⪓",lessapprox:"⪅",lessdot:"⋖",lesseqgtr:"⋚",lesseqqgtr:"⪋",lessgtr:"≶",lesssim:"≲",lfisht:"⥼",lfloor:"⌊",lfr:"𝔩",lg:"≶",lgE:"⪑",lhard:"↽",lharu:"↼",lharul:"⥪",lhblk:"▄",ljcy:"љ",ll:"≪",llarr:"⇇",llcorner:"⌞",llhard:"⥫",lltri:"◺",lmidot:"ŀ",lmoust:"⎰",lmoustache:"⎰",lnE:"≨",lnap:"⪉",lnapprox:"⪉",lne:"⪇",lneq:"⪇",lneqq:"≨",lnsim:"⋦",loang:"⟬",loarr:"⇽",lobrk:"⟦",longleftarrow:"⟵",longleftrightarrow:"⟷",longmapsto:"⟼",longrightarrow:"⟶",looparrowleft:"↫",looparrowright:"↬",lopar:"⦅",lopf:"𝕝",loplus:"⨭",lotimes:"⨴",lowast:"∗",lowbar:"_",loz:"◊",lozenge:"◊",lozf:"⧫",lpar:"(",lparlt:"⦓",lrarr:"⇆",lrcorner:"⌟",lrhar:"⇋",lrhard:"⥭",lrm:"",lrtri:"⊿",lsaquo:"‹",lscr:"𝓁",lsh:"↰",lsim:"≲",lsime:"⪍",lsimg:"⪏",lsqb:"[",lsquo:"‘",lsquor:"‚",lstrok:"ł",lt:"<",ltcc:"⪦",ltcir:"⩹",ltdot:"⋖",lthree:"⋋",ltimes:"⋉",ltlarr:"⥶",ltquest:"⩻",ltrPar:"⦖",ltri:"◃",ltrie:"⊴",ltrif:"◂",lurdshar:"⥊",luruhar:"⥦",lvertneqq:"≨︀",lvnE:"≨︀",mDDot:"∺",macr:"¯",male:"♂",malt:"✠",maltese:"✠",map:"↦",mapsto:"↦",mapstodown:"↧",mapstoleft:"↤",mapstoup:"↥",marker:"▮",mcomma:"⨩",mcy:"м",mdash:"—",measuredangle:"∡",mfr:"𝔪",mho:"℧",micro:"µ",mid:"∣",midast:"*",midcir:"⫰",middot:"·",minus:"−",minusb:"⊟",minusd:"∸",minusdu:"⨪",mlcp:"⫛",mldr:"…",mnplus:"∓",models:"⊧",mopf:"𝕞",mp:"∓",mscr:"𝓂",mstpos:"∾",mu:"μ",multimap:"⊸",mumap:"⊸",nGg:"⋙̸",nGt:"≫⃒",nGtv:"≫̸",nLeftarrow:"⇍",nLeftrightarrow:"⇎",nLl:"⋘̸",nLt:"≪⃒",nLtv:"≪̸",nRightarrow:"⇏",nVDash:"⊯",nVdash:"⊮",nabla:"∇",nacute:"ń",nang:"∠⃒",nap:"≉",napE:"⩰̸",napid:"≋̸",napos:"ʼn",napprox:"≉",natur:"♮",natural:"♮",naturals:"ℕ",nbsp:" ",nbump:"≎̸",nbumpe:"≏̸",ncap:"⩃",ncaron:"ň",ncedil:"ņ",ncong:"≇",ncongdot:"⩭̸",ncup:"⩂",ncy:"н",ndash:"–",ne:"≠",neArr:"⇗",nearhk:"⤤",nearr:"↗",nearrow:"↗",nedot:"≐̸",nequiv:"≢",nesear:"⤨",nesim:"≂̸",nexist:"∄",nexists:"∄",nfr:"𝔫",ngE:"≧̸",nge:"≱",ngeq:"≱",ngeqq:"≧̸",ngeqslant:"⩾̸",nges:"⩾̸",ngsim:"≵",ngt:"≯",ngtr:"≯",nhArr:"⇎",nharr:"↮",nhpar:"⫲",ni:"∋",nis:"⋼",nisd:"⋺",niv:"∋",njcy:"њ",nlArr:"⇍",nlE:"≦̸",nlarr:"↚",nldr:"‥",nle:"≰",nleftarrow:"↚",nleftrightarrow:"↮",nleq:"≰",nleqq:"≦̸",nleqslant:"⩽̸",nles:"⩽̸",nless:"≮",nlsim:"≴",nlt:"≮",nltri:"⋪",nltrie:"⋬",nmid:"∤",nopf:"𝕟",not:"¬",notin:"∉",notinE:"⋹̸",notindot:"⋵̸",notinva:"∉",notinvb:"⋷",notinvc:"⋶",notni:"∌",notniva:"∌",notnivb:"⋾",notnivc:"⋽",npar:"∦",nparallel:"∦",nparsl:"⫽⃥",npart:"∂̸",npolint:"⨔",npr:"⊀",nprcue:"⋠",npre:"⪯̸",nprec:"⊀",npreceq:"⪯̸",nrArr:"⇏",nrarr:"↛",nrarrc:"⤳̸",nrarrw:"↝̸",nrightarrow:"↛",nrtri:"⋫",nrtrie:"⋭",nsc:"⊁",nsccue:"⋡",nsce:"⪰̸",nscr:"𝓃",nshortmid:"∤",nshortparallel:"∦",nsim:"≁",nsime:"≄",nsimeq:"≄",nsmid:"∤",nspar:"∦",nsqsube:"⋢",nsqsupe:"⋣",nsub:"⊄",nsubE:"⫅̸",nsube:"⊈",nsubset:"⊂⃒",nsubseteq:"⊈",nsubseteqq:"⫅̸",nsucc:"⊁",nsucceq:"⪰̸",nsup:"⊅",nsupE:"⫆̸",nsupe:"⊉",nsupset:"⊃⃒",nsupseteq:"⊉",nsupseteqq:"⫆̸",ntgl:"≹",ntilde:"ñ",ntlg:"≸",ntriangleleft:"⋪",ntrianglelefteq:"⋬",ntriangleright:"⋫",ntrianglerighteq:"⋭",nu:"ν",num:"#",numero:"№",numsp:" ",nvDash:"⊭",nvHarr:"⤄",nvap:"≍⃒",nvdash:"⊬",nvge:"≥⃒",nvgt:">⃒",nvinfin:"⧞",nvlArr:"⤂",nvle:"≤⃒",nvlt:"<⃒",nvltrie:"⊴⃒",nvrArr:"⤃",nvrtrie:"⊵⃒",nvsim:"∼⃒",nwArr:"⇖",nwarhk:"⤣",nwarr:"↖",nwarrow:"↖",nwnear:"⤧",oS:"Ⓢ",oacute:"ó",oast:"⊛",ocir:"⊚",ocirc:"ô",ocy:"о",odash:"⊝",odblac:"ő",odiv:"⨸",odot:"⊙",odsold:"⦼",oelig:"œ",ofcir:"⦿",ofr:"𝔬",ogon:"˛",ograve:"ò",ogt:"⧁",ohbar:"⦵",ohm:"Ω",oint:"∮",olarr:"↺",olcir:"⦾",olcross:"⦻",oline:"‾",olt:"⧀",omacr:"ō",omega:"ω",omicron:"ο",omid:"⦶",ominus:"⊖",oopf:"𝕠",opar:"⦷",operp:"⦹",oplus:"⊕",or:"∨",orarr:"↻",ord:"⩝",order:"ℴ",orderof:"ℴ",ordf:"ª",ordm:"º",origof:"⊶",oror:"⩖",orslope:"⩗",orv:"⩛",oscr:"ℴ",oslash:"ø",osol:"⊘",otilde:"õ",otimes:"⊗",otimesas:"⨶",ouml:"ö",ovbar:"⌽",par:"∥",para:"¶",parallel:"∥",parsim:"⫳",parsl:"⫽",part:"∂",pcy:"п",percnt:"%",period:".",permil:"‰",perp:"⊥",pertenk:"‱",pfr:"𝔭",phi:"φ",phiv:"ϕ",phmmat:"ℳ",phone:"☎",pi:"π",pitchfork:"⋔",piv:"ϖ",planck:"ℏ",planckh:"ℎ",plankv:"ℏ",plus:"+",plusacir:"⨣",plusb:"⊞",pluscir:"⨢",plusdo:"∔",plusdu:"⨥",pluse:"⩲",plusmn:"±",plussim:"⨦",plustwo:"⨧",pm:"±",pointint:"⨕",popf:"𝕡",pound:"£",pr:"≺",prE:"⪳",prap:"⪷",prcue:"≼",pre:"⪯",prec:"≺",precapprox:"⪷",preccurlyeq:"≼",preceq:"⪯",precnapprox:"⪹",precneqq:"⪵",precnsim:"⋨",precsim:"≾",prime:"′",primes:"ℙ",prnE:"⪵",prnap:"⪹",prnsim:"⋨",prod:"∏",profalar:"⌮",profline:"⌒",profsurf:"⌓",prop:"∝",propto:"∝",prsim:"≾",prurel:"⊰",pscr:"𝓅",psi:"ψ",puncsp:" ",qfr:"𝔮",qint:"⨌",qopf:"𝕢",qprime:"⁗",qscr:"𝓆",quaternions:"ℍ",quatint:"⨖",quest:"?",questeq:"≟",quot:'"',rAarr:"⇛",rArr:"⇒",rAtail:"⤜",rBarr:"⤏",rHar:"⥤",race:"∽̱",racute:"ŕ",radic:"√",raemptyv:"⦳",rang:"⟩",rangd:"⦒",range:"⦥",rangle:"⟩",raquo:"»",rarr:"→",rarrap:"⥵",rarrb:"⇥",rarrbfs:"⤠",rarrc:"⤳",rarrfs:"⤞",rarrhk:"↪",rarrlp:"↬",rarrpl:"⥅",rarrsim:"⥴",rarrtl:"↣",rarrw:"↝",ratail:"⤚",ratio:"∶",rationals:"ℚ",rbarr:"⤍",rbbrk:"❳",rbrace:"}",rbrack:"]",rbrke:"⦌",rbrksld:"⦎",rbrkslu:"⦐",rcaron:"ř",rcedil:"ŗ",rceil:"⌉",rcub:"}",rcy:"р",rdca:"⤷",rdldhar:"⥩",rdquo:"”",rdquor:"”",rdsh:"↳",real:"ℜ",realine:"ℛ",realpart:"ℜ",reals:"ℝ",rect:"▭",reg:"®",rfisht:"⥽",rfloor:"⌋",rfr:"𝔯",rhard:"⇁",rharu:"⇀",rharul:"⥬",rho:"ρ",rhov:"ϱ",rightarrow:"→",rightarrowtail:"↣",rightharpoondown:"⇁",rightharpoonup:"⇀",rightleftarrows:"⇄",rightleftharpoons:"⇌",rightrightarrows:"⇉",rightsquigarrow:"↝",rightthreetimes:"⋌",ring:"˚",risingdotseq:"≓",rlarr:"⇄",rlhar:"⇌",rlm:"",rmoust:"⎱",rmoustache:"⎱",rnmid:"⫮",roang:"⟭",roarr:"⇾",robrk:"⟧",ropar:"⦆",ropf:"𝕣",roplus:"⨮",rotimes:"⨵",rpar:")",rpargt:"⦔",rppolint:"⨒",rrarr:"⇉",rsaquo:"›",rscr:"𝓇",rsh:"↱",rsqb:"]",rsquo:"’",rsquor:"’",rthree:"⋌",rtimes:"⋊",rtri:"▹",rtrie:"⊵",rtrif:"▸",rtriltri:"⧎",ruluhar:"⥨",rx:"℞",sacute:"ś",sbquo:"‚",sc:"≻",scE:"⪴",scap:"⪸",scaron:"š",sccue:"≽",sce:"⪰",scedil:"ş",scirc:"ŝ",scnE:"⪶",scnap:"⪺",scnsim:"⋩",scpolint:"⨓",scsim:"≿",scy:"с",sdot:"⋅",sdotb:"⊡",sdote:"⩦",seArr:"⇘",searhk:"⤥",searr:"↘",searrow:"↘",sect:"§",semi:";",seswar:"⤩",setminus:"∖",setmn:"∖",sext:"✶",sfr:"𝔰",sfrown:"⌢",sharp:"♯",shchcy:"щ",shcy:"ш",shortmid:"∣",shortparallel:"∥",shy:"",sigma:"σ",sigmaf:"ς",sigmav:"ς",sim:"∼",simdot:"⩪",sime:"≃",simeq:"≃",simg:"⪞",simgE:"⪠",siml:"⪝",simlE:"⪟",simne:"≆",simplus:"⨤",simrarr:"⥲",slarr:"←",smallsetminus:"∖",smashp:"⨳",smeparsl:"⧤",smid:"∣",smile:"⌣",smt:"⪪",smte:"⪬",smtes:"⪬︀",softcy:"ь",sol:"/",solb:"⧄",solbar:"⌿",sopf:"𝕤",spades:"♠",spadesuit:"♠",spar:"∥",sqcap:"⊓",sqcaps:"⊓︀",sqcup:"⊔",sqcups:"⊔︀",sqsub:"⊏",sqsube:"⊑",sqsubset:"⊏",sqsubseteq:"⊑",sqsup:"⊐",sqsupe:"⊒",sqsupset:"⊐",sqsupseteq:"⊒",squ:"□",square:"□",squarf:"▪",squf:"▪",srarr:"→",sscr:"𝓈",ssetmn:"∖",ssmile:"⌣",sstarf:"⋆",star:"☆",starf:"★",straightepsilon:"ϵ",straightphi:"ϕ",strns:"¯",sub:"⊂",subE:"⫅",subdot:"⪽",sube:"⊆",subedot:"⫃",submult:"⫁",subnE:"⫋",subne:"⊊",subplus:"⪿",subrarr:"⥹",subset:"⊂",subseteq:"⊆",subseteqq:"⫅",subsetneq:"⊊",subsetneqq:"⫋",subsim:"⫇",subsub:"⫕",subsup:"⫓",succ:"≻",succapprox:"⪸",succcurlyeq:"≽",succeq:"⪰",succnapprox:"⪺",succneqq:"⪶",succnsim:"⋩",succsim:"≿",sum:"∑",sung:"♪",sup1:"¹",sup2:"²",sup3:"³",sup:"⊃",supE:"⫆",supdot:"⪾",supdsub:"⫘",supe:"⊇",supedot:"⫄",suphsol:"⟉",suphsub:"⫗",suplarr:"⥻",supmult:"⫂",supnE:"⫌",supne:"⊋",supplus:"⫀",supset:"⊃",supseteq:"⊇",supseteqq:"⫆",supsetneq:"⊋",supsetneqq:"⫌",supsim:"⫈",supsub:"⫔",supsup:"⫖",swArr:"⇙",swarhk:"⤦",swarr:"↙",swarrow:"↙",swnwar:"⤪",szlig:"ß",target:"⌖",tau:"τ",tbrk:"⎴",tcaron:"ť",tcedil:"ţ",tcy:"т",tdot:"⃛",telrec:"⌕",tfr:"𝔱",there4:"∴",therefore:"∴",theta:"θ",thetasym:"ϑ",thetav:"ϑ",thickapprox:"≈",thicksim:"∼",thinsp:" ",thkap:"≈",thksim:"∼",thorn:"þ",tilde:"˜",times:"×",timesb:"⊠",timesbar:"⨱",timesd:"⨰",tint:"∭",toea:"⤨",top:"⊤",topbot:"⌶",topcir:"⫱",topf:"𝕥",topfork:"⫚",tosa:"⤩",tprime:"‴",trade:"™",triangle:"▵",triangledown:"▿",triangleleft:"◃",trianglelefteq:"⊴",triangleq:"≜",triangleright:"▹",trianglerighteq:"⊵",tridot:"◬",trie:"≜",triminus:"⨺",triplus:"⨹",trisb:"⧍",tritime:"⨻",trpezium:"⏢",tscr:"𝓉",tscy:"ц",tshcy:"ћ",tstrok:"ŧ",twixt:"≬",twoheadleftarrow:"↞",twoheadrightarrow:"↠",uArr:"⇑",uHar:"⥣",uacute:"ú",uarr:"↑",ubrcy:"ў",ubreve:"ŭ",ucirc:"û",ucy:"у",udarr:"⇅",udblac:"ű",udhar:"⥮",ufisht:"⥾",ufr:"𝔲",ugrave:"ù",uharl:"↿",uharr:"↾",uhblk:"▀",ulcorn:"⌜",ulcorner:"⌜",ulcrop:"⌏",ultri:"◸",umacr:"ū",uml:"¨",uogon:"ų",uopf:"𝕦",uparrow:"↑",updownarrow:"↕",upharpoonleft:"↿",upharpoonright:"↾",uplus:"⊎",upsi:"υ",upsih:"ϒ",upsilon:"υ",upuparrows:"⇈",urcorn:"⌝",urcorner:"⌝",urcrop:"⌎",uring:"ů",urtri:"◹",uscr:"𝓊",utdot:"⋰",utilde:"ũ",utri:"▵",utrif:"▴",uuarr:"⇈",uuml:"ü",uwangle:"⦧",vArr:"⇕",vBar:"⫨",vBarv:"⫩",vDash:"⊨",vangrt:"⦜",varepsilon:"ϵ",varkappa:"ϰ",varnothing:"∅",varphi:"ϕ",varpi:"ϖ",varpropto:"∝",varr:"↕",varrho:"ϱ",varsigma:"ς",varsubsetneq:"⊊︀",varsubsetneqq:"⫋︀",varsupsetneq:"⊋︀",varsupsetneqq:"⫌︀",vartheta:"ϑ",vartriangleleft:"⊲",vartriangleright:"⊳",vcy:"в",vdash:"⊢",vee:"∨",veebar:"⊻",veeeq:"≚",vellip:"⋮",verbar:"|",vert:"|",vfr:"𝔳",vltri:"⊲",vnsub:"⊂⃒",vnsup:"⊃⃒",vopf:"𝕧",vprop:"∝",vrtri:"⊳",vscr:"𝓋",vsubnE:"⫋︀",vsubne:"⊊︀",vsupnE:"⫌︀",vsupne:"⊋︀",vzigzag:"⦚",wcirc:"ŵ",wedbar:"⩟",wedge:"∧",wedgeq:"≙",weierp:"℘",wfr:"𝔴",wopf:"𝕨",wp:"℘",wr:"≀",wreath:"≀",wscr:"𝓌",xcap:"⋂",xcirc:"◯",xcup:"⋃",xdtri:"▽",xfr:"𝔵",xhArr:"⟺",xharr:"⟷",xi:"ξ",xlArr:"⟸",xlarr:"⟵",xmap:"⟼",xnis:"⋻",xodot:"⨀",xopf:"𝕩",xoplus:"⨁",xotime:"⨂",xrArr:"⟹",xrarr:"⟶",xscr:"𝓍",xsqcup:"⨆",xuplus:"⨄",xutri:"△",xvee:"⋁",xwedge:"⋀",yacute:"ý",yacy:"я",ycirc:"ŷ",ycy:"ы",yen:"¥",yfr:"𝔶",yicy:"ї",yopf:"𝕪",yscr:"𝓎",yucy:"ю",yuml:"ÿ",zacute:"ź",zcaron:"ž",zcy:"з",zdot:"ż",zeetrf:"ℨ",zeta:"ζ",zfr:"𝔷",zhcy:"ж",zigrarr:"⇝",zopf:"𝕫",zscr:"𝓏",zwj:"",zwnj:""},Mc={}.hasOwnProperty;function Md(a){return!!Mc.call(Mb,a)&&Mb[a]}let Me={name:"characterReference",tokenize:function(a,b,c){let d,e,f=this,g=0;return function(b){return a.enter("characterReference"),a.enter("characterReferenceMarker"),a.consume(b),a.exit("characterReferenceMarker"),h};function h(b){return 35===b?(a.enter("characterReferenceMarkerNumeric"),a.consume(b),a.exit("characterReferenceMarkerNumeric"),i):(a.enter("characterReferenceValue"),d=31,e=LH,j(b))}function i(b){return 88===b||120===b?(a.enter("characterReferenceMarkerHexadecimal"),a.consume(b),a.exit("characterReferenceMarkerHexadecimal"),a.enter("characterReferenceValue"),d=6,e=LK,j):(a.enter("characterReferenceValue"),d=7,e=LJ,j(b))}function j(h){if(59===h&&g){let d=a.exit("characterReferenceValue");return e!==LH||Md(f.sliceSerialize(d))?(a.enter("characterReferenceMarker"),a.consume(h),a.exit("characterReferenceMarker"),a.exit("characterReference"),b):c(h)}return e(h)&&g++<d?(a.consume(h),j):c(h)}}},Mf={partial:!0,tokenize:function(a,b,c){let d=this;return function(b){return null===b?c(b):(a.enter("lineEnding"),a.consume(b),a.exit("lineEnding"),e)};function e(a){return d.parser.lazy[d.now().line]?c(a):b(a)}}},Mg={concrete:!0,name:"codeFenced",tokenize:function(a,b,c){let d,e=this,f={partial:!0,tokenize:function(a,b,c){let f=0;return function(b){return a.enter("lineEnding"),a.consume(b),a.exit("lineEnding"),g};function g(b){return a.enter("codeFencedFence"),LO(b)?LQ(a,i,"linePrefix",e.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(b):i(b)}function i(b){return b===d?(a.enter("codeFencedFenceSequence"),function b(e){return e===d?(f++,a.consume(e),b):f>=h?(a.exit("codeFencedFenceSequence"),LO(e)?LQ(a,j,"whitespace")(e):j(e)):c(e)}(b)):c(b)}function j(d){return null===d||LM(d)?(a.exit("codeFencedFence"),b(d)):c(d)}}},g=0,h=0;return function(b){var f;let j;return f=b,g=(j=e.events[e.events.length-1])&&"linePrefix"===j[1].type?j[2].sliceSerialize(j[1],!0).length:0,d=f,a.enter("codeFenced"),a.enter("codeFencedFence"),a.enter("codeFencedFenceSequence"),function b(e){return e===d?(h++,a.consume(e),b):h<3?c(e):(a.exit("codeFencedFenceSequence"),LO(e)?LQ(a,i,"whitespace")(e):i(e))}(f)};function i(f){return null===f||LM(f)?(a.exit("codeFencedFence"),e.interrupt?b(f):a.check(Mf,k,p)(f)):(a.enter("codeFencedFenceInfo"),a.enter("chunkString",{contentType:"string"}),function b(e){return null===e||LM(e)?(a.exit("chunkString"),a.exit("codeFencedFenceInfo"),i(e)):LO(e)?(a.exit("chunkString"),a.exit("codeFencedFenceInfo"),LQ(a,j,"whitespace")(e)):96===e&&e===d?c(e):(a.consume(e),b)}(f))}function j(b){return null===b||LM(b)?i(b):(a.enter("codeFencedFenceMeta"),a.enter("chunkString",{contentType:"string"}),function b(e){return null===e||LM(e)?(a.exit("chunkString"),a.exit("codeFencedFenceMeta"),i(e)):96===e&&e===d?c(e):(a.consume(e),b)}(b))}function k(b){return a.attempt(f,p,l)(b)}function l(b){return a.enter("lineEnding"),a.consume(b),a.exit("lineEnding"),n}function n(b){return g>0&&LO(b)?LQ(a,o,"linePrefix",g+1)(b):o(b)}function o(b){return null===b||LM(b)?a.check(Mf,k,p)(b):(a.enter("codeFlowValue"),function b(c){return null===c||LM(c)?(a.exit("codeFlowValue"),o(c)):(a.consume(c),b)}(b))}function p(c){return a.exit("codeFenced"),b(c)}}},Mh={name:"codeIndented",tokenize:function(a,b,c){let d=this;return function(b){return a.enter("codeIndented"),LQ(a,e,"linePrefix",5)(b)};function e(b){let e=d.events[d.events.length-1];return e&&"linePrefix"===e[1].type&&e[2].sliceSerialize(e[1],!0).length>=4?function b(c){return null===c?f(c):LM(c)?a.attempt(Mi,b,f)(c):(a.enter("codeFlowValue"),function c(d){return null===d||LM(d)?(a.exit("codeFlowValue"),b(d)):(a.consume(d),c)}(c))}(b):c(b)}function f(c){return a.exit("codeIndented"),b(c)}}},Mi={partial:!0,tokenize:function(a,b,c){let d=this;return e;function e(b){return d.parser.lazy[d.now().line]?c(b):LM(b)?(a.enter("lineEnding"),a.consume(b),a.exit("lineEnding"),e):LQ(a,f,"linePrefix",5)(b)}function f(a){let f=d.events[d.events.length-1];return f&&"linePrefix"===f[1].type&&f[2].sliceSerialize(f[1],!0).length>=4?b(a):LM(a)?e(a):c(a)}}};function Mj(a){return null!==a&&(a<32||127===a)}function Mk(a){return function(b){return null!==b&&b>-1&&a.test(String.fromCharCode(b))}}function Ml(a,b,c,d,e,f,g,h,i){let j=i||1/0,k=0;return function(b){return 60===b?(a.enter(d),a.enter(e),a.enter(f),a.consume(b),a.exit(f),l):null===b||32===b||41===b||Mj(b)?c(b):(a.enter(d),a.enter(g),a.enter(h),a.enter("chunkString",{contentType:"string"}),p(b))};function l(c){return 62===c?(a.enter(f),a.consume(c),a.exit(f),a.exit(e),a.exit(d),b):(a.enter(h),a.enter("chunkString",{contentType:"string"}),n(c))}function n(b){return 62===b?(a.exit("chunkString"),a.exit(h),l(b)):null===b||60===b||null!==b&&b<-2?c(b):(a.consume(b),92===b?o:n)}function o(b){return 60===b||62===b||92===b?(a.consume(b),n):n(b)}function p(e){return!k&&(null===e||41===e||null!==e&&(e<0||32===e))?(a.exit("chunkString"),a.exit(h),a.exit(g),a.exit(d),b(e)):k<j&&40===e?(a.consume(e),k++,p):41===e?(a.consume(e),k--,p):null===e||32===e||40===e||Mj(e)?c(e):(a.consume(e),92===e?q:p)}function q(b){return 40===b||41===b||92===b?(a.consume(b),p):p(b)}}function Mm(a){return null!==a&&a<-2}function Mn(a){return function(b){return null!==b&&b>-1&&a.test(String.fromCharCode(b))}}function Mo(a,b,c,d,e,f){let g,h=this,i=0;return function(b){return a.enter(d),a.enter(e),a.consume(b),a.exit(e),a.enter(f),j};function j(l){return i>999||null===l||91===l||93===l&&!g||94===l&&!i&&"_hiddenFootnoteSupport"in h.parser.constructs?c(l):93===l?(a.exit(f),a.enter(e),a.consume(l),a.exit(e),a.exit(d),b):Mm(l)?(a.enter("lineEnding"),a.consume(l),a.exit("lineEnding"),j):(a.enter("chunkString",{contentType:"string"}),k(l))}function k(b){return null===b||91===b||93===b||Mm(b)||i++>999?(a.exit("chunkString"),j(b)):(a.consume(b),g||(g=-2!==b&&-1!==b&&32!==b),92===b?l:k)}function l(b){return 91===b||92===b||93===b?(a.consume(b),i++,k):k(b)}}function Mp(a){return null!==a&&a<-2}function Mq(a){return -2===a||-1===a||32===a}function Mr(a){return function(b){return null!==b&&b>-1&&a.test(String.fromCharCode(b))}}function Ms(a,b,c,d,e,f){let g;return function(b){return 34===b||39===b||40===b?(a.enter(d),a.enter(e),a.consume(b),a.exit(e),g=40===b?41:b,h):c(b)};function h(c){return c===g?(a.enter(e),a.consume(c),a.exit(e),a.exit(d),b):(a.enter(f),i(c))}function i(b){if(b===g)return a.exit(f),h(g);if(null===b)return c(b);if(Mp(b)){var d,e;let c,f;return a.enter("lineEnding"),a.consume(b),a.exit("lineEnding"),d=i,e="linePrefix",c=1/0,f=0,function(b){return Mq(b)?(a.enter(e),function b(g){return Mq(g)&&f++<c?(a.consume(g),b):(a.exit(e),d(g))}(b)):d(b)}}return a.enter("chunkString",{contentType:"string"}),j(b)}function j(b){return b===g||null===b||Mp(b)?(a.exit("chunkString"),i(b)):(a.consume(b),92===b?k:j)}function k(b){return b===g||92===b?(a.consume(b),j):j(b)}}function Mt(a){return -2===a||-1===a||32===a}function Mu(a){return function(b){return null!==b&&b>-1&&a.test(String.fromCharCode(b))}}function Mv(a,b){let c;return function d(e){var f,g;if(null!==e&&e<-2)return a.enter("lineEnding"),a.consume(e),a.exit("lineEnding"),c=!0,d;if(Mt(e)){let b,h;return(f=d,g=c?"linePrefix":"lineSuffix",b=1/0,h=0,function(c){return Mt(c)?(a.enter(g),function c(d){return Mt(d)&&h++<b?(a.consume(d),c):(a.exit(g),f(d))}(c)):f(c)})(e)}return b(e)}}function Mw(a){return a.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}Mk(/[A-Za-z]/),Mk(/[\dA-Za-z]/),Mk(/[#-'*+\--9=?A-Z^-~]/),Mk(/\d/),Mk(/[\dA-Fa-f]/),Mk(/[!-/:-@[-`{-~]/),Mk(/\p{P}|\p{S}/u),Mk(/\s/),Mn(/[A-Za-z]/),Mn(/[\dA-Za-z]/),Mn(/[#-'*+\--9=?A-Z^-~]/),Mn(/\d/),Mn(/[\dA-Fa-f]/),Mn(/[!-/:-@[-`{-~]/),Mn(/\p{P}|\p{S}/u),Mn(/\s/),Mr(/[A-Za-z]/),Mr(/[\dA-Za-z]/),Mr(/[#-'*+\--9=?A-Z^-~]/),Mr(/\d/),Mr(/[\dA-Fa-f]/),Mr(/[!-/:-@[-`{-~]/),Mr(/\p{P}|\p{S}/u),Mr(/\s/),Mu(/[A-Za-z]/),Mu(/[\dA-Za-z]/),Mu(/[#-'*+\--9=?A-Z^-~]/),Mu(/\d/),Mu(/[\dA-Fa-f]/),Mu(/[!-/:-@[-`{-~]/),Mu(/\p{P}|\p{S}/u),Mu(/\s/);let Mx={partial:!0,tokenize:function(a,b,c){return function(b){return LN(b)?Mv(a,d)(b):c(b)};function d(b){return Ms(a,e,c,"definitionTitle","definitionTitleMarker","definitionTitleString")(b)}function e(b){return LO(b)?LQ(a,f,"whitespace")(b):f(b)}function f(a){return null===a||LM(a)?b(a):c(a)}}},My=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Mz=["pre","script","style","textarea"],MA={partial:!0,tokenize:function(a,b,c){return function(d){return a.enter("lineEnding"),a.consume(d),a.exit("lineEnding"),a.attempt(LR,b,c)}}},MB={partial:!0,tokenize:function(a,b,c){let d=this;return function(b){return LM(b)?(a.enter("lineEnding"),a.consume(b),a.exit("lineEnding"),e):c(b)};function e(a){return d.parser.lazy[d.now().line]?c(a):b(a)}}},MC={name:"labelEnd",resolveAll:function(a){let b=-1,c=[];for(;++b<a.length;){let d=a[b][1];if(c.push(a[b]),"labelImage"===d.type||"labelLink"===d.type||"labelEnd"===d.type){let a="labelImage"===d.type?4:2;d.type="data",b+=a}}return a.length!==c.length&&Lv(a,0,a.length,c),a},resolveTo:function(a,b){let c,d,e,f,g=a.length,h=0;for(;g--;)if(c=a[g][1],d){if("link"===c.type||"labelLink"===c.type&&c._inactive)break;"enter"===a[g][0]&&"labelLink"===c.type&&(c._inactive=!0)}else if(e){if("enter"===a[g][0]&&("labelImage"===c.type||"labelLink"===c.type)&&!c._balanced&&(d=g,"labelLink"!==c.type)){h=2;break}}else"labelEnd"===c.type&&(e=g);let i={type:"labelLink"===a[d][1].type?"link":"image",start:{...a[d][1].start},end:{...a[a.length-1][1].end}},j={type:"label",start:{...a[d][1].start},end:{...a[e][1].end}},k={type:"labelText",start:{...a[d+h+2][1].end},end:{...a[e-2][1].start}};return f=Lw(f=[["enter",i,b],["enter",j,b]],a.slice(d+1,d+h+3)),f=Lw(f,[["enter",k,b]]),f=Lw(f,L6(b.parser.constructs.insideSpan.null,a.slice(d+h+4,e-3),b)),f=Lw(f,[["exit",k,b],a[e-2],a[e-1],["exit",j,b]]),f=Lw(f,a.slice(e+1)),f=Lw(f,[["exit",i,b]]),Lv(a,d,a.length,f),a},tokenize:function(a,b,c){let d,e,f=this,g=f.events.length;for(;g--;)if(("labelImage"===f.events[g][1].type||"labelLink"===f.events[g][1].type)&&!f.events[g][1]._balanced){d=f.events[g][1];break}return function(b){return d?d._inactive?k(b):(e=f.parser.defined.includes(Mw(f.sliceSerialize({start:d.end,end:f.now()}))),a.enter("labelEnd"),a.enter("labelMarker"),a.consume(b),a.exit("labelMarker"),a.exit("labelEnd"),h):c(b)};function h(b){return 40===b?a.attempt(MD,j,e?j:k)(b):91===b?a.attempt(ME,j,e?i:k)(b):e?j(b):k(b)}function i(b){return a.attempt(MF,j,k)(b)}function j(a){return b(a)}function k(a){return d._balanced=!0,c(a)}}},MD={tokenize:function(a,b,c){return function(b){return a.enter("resource"),a.enter("resourceMarker"),a.consume(b),a.exit("resourceMarker"),d};function d(b){return LN(b)?Mv(a,e)(b):e(b)}function e(b){return 41===b?j(b):Ml(a,f,g,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(b)}function f(b){return LN(b)?Mv(a,h)(b):j(b)}function g(a){return c(a)}function h(b){return 34===b||39===b||40===b?Ms(a,i,c,"resourceTitle","resourceTitleMarker","resourceTitleString")(b):j(b)}function i(b){return LN(b)?Mv(a,j)(b):j(b)}function j(d){return 41===d?(a.enter("resourceMarker"),a.consume(d),a.exit("resourceMarker"),a.exit("resource"),b):c(d)}}},ME={tokenize:function(a,b,c){let d=this;return function(b){return Mo.call(d,a,e,f,"reference","referenceMarker","referenceString")(b)};function e(a){return d.parser.defined.includes(Mw(d.sliceSerialize(d.events[d.events.length-1][1]).slice(1,-1)))?b(a):c(a)}function f(a){return c(a)}}},MF={tokenize:function(a,b,c){return function(b){return a.enter("reference"),a.enter("referenceMarker"),a.consume(b),a.exit("referenceMarker"),d};function d(d){return 93===d?(a.enter("referenceMarker"),a.consume(d),a.exit("referenceMarker"),a.exit("reference"),b):c(d)}}},MG={name:"labelStartImage",resolveAll:MC.resolveAll,tokenize:function(a,b,c){let d=this;return function(b){return a.enter("labelImage"),a.enter("labelImageMarker"),a.consume(b),a.exit("labelImageMarker"),e};function e(b){return 91===b?(a.enter("labelMarker"),a.consume(b),a.exit("labelMarker"),a.exit("labelImage"),f):c(b)}function f(a){return 94===a&&"_hiddenFootnoteSupport"in d.parser.constructs?c(a):b(a)}}},MH={name:"labelStartLink",resolveAll:MC.resolveAll,tokenize:function(a,b,c){let d=this;return function(b){return a.enter("labelLink"),a.enter("labelMarker"),a.consume(b),a.exit("labelMarker"),a.exit("labelLink"),e};function e(a){return 94===a&&"_hiddenFootnoteSupport"in d.parser.constructs?c(a):b(a)}}},MI={name:"lineEnding",tokenize:function(a,b){return function(c){return a.enter("lineEnding"),a.consume(c),a.exit("lineEnding"),LQ(a,b,"linePrefix")}}},MJ={name:"thematicBreak",tokenize:function(a,b,c){let d,e=0;return function(f){var g;return a.enter("thematicBreak"),d=g=f,function f(g){return g===d?(a.enter("thematicBreakSequence"),function b(c){return c===d?(a.consume(c),e++,b):(a.exit("thematicBreakSequence"),LO(c)?LQ(a,f,"whitespace")(c):f(c))}(g)):e>=3&&(null===g||LM(g))?(a.exit("thematicBreak"),b(g)):c(g)}(g)}}},MK={continuation:{tokenize:function(a,b,c){let d=this;return d.containerState._closeFlow=void 0,a.check(LR,function(c){return d.containerState.furtherBlankLines=d.containerState.furtherBlankLines||d.containerState.initialBlankLine,LQ(a,b,"listItemIndent",d.containerState.size+1)(c)},function(c){return d.containerState.furtherBlankLines||!LO(c)?(d.containerState.furtherBlankLines=void 0,d.containerState.initialBlankLine=void 0,e(c)):(d.containerState.furtherBlankLines=void 0,d.containerState.initialBlankLine=void 0,a.attempt(MM,b,e)(c))});function e(e){return d.containerState._closeFlow=!0,d.interrupt=void 0,LQ(a,a.attempt(MK,b,c),"linePrefix",d.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(e)}}},exit:function(a){a.exit(this.containerState.type)},name:"list",tokenize:function(a,b,c){let d=this,e=d.events[d.events.length-1],f=e&&"linePrefix"===e[1].type?e[2].sliceSerialize(e[1],!0).length:0,g=0;return function(b){let e=d.containerState.type||(42===b||43===b||45===b?"listUnordered":"listOrdered");if("listUnordered"===e?!d.containerState.marker||b===d.containerState.marker:LJ(b)){if(d.containerState.type||(d.containerState.type=e,a.enter(e,{_container:!0})),"listUnordered"===e)return a.enter("listItemPrefix"),42===b||45===b?a.check(MJ,c,h)(b):h(b);if(!d.interrupt||49===b)return a.enter("listItemPrefix"),a.enter("listItemValue"),function b(e){return LJ(e)&&++g<10?(a.consume(e),b):(!d.interrupt||g<2)&&(d.containerState.marker?e===d.containerState.marker:41===e||46===e)?(a.exit("listItemValue"),h(e)):c(e)}(b)}return c(b)};function h(b){return a.enter("listItemMarker"),a.consume(b),a.exit("listItemMarker"),d.containerState.marker=d.containerState.marker||b,a.check(LR,d.interrupt?c:i,a.attempt(ML,k,j))}function i(a){return d.containerState.initialBlankLine=!0,f++,k(a)}function j(b){return LO(b)?(a.enter("listItemPrefixWhitespace"),a.consume(b),a.exit("listItemPrefixWhitespace"),k):c(b)}function k(c){return d.containerState.size=f+d.sliceSerialize(a.exit("listItemPrefix"),!0).length,b(c)}}},ML={partial:!0,tokenize:function(a,b,c){let d=this;return LQ(a,function(a){let e=d.events[d.events.length-1];return!LO(a)&&e&&"listItemPrefixWhitespace"===e[1].type?b(a):c(a)},"listItemPrefixWhitespace",d.parser.constructs.disable.null.includes("codeIndented")?void 0:5)}},MM={partial:!0,tokenize:function(a,b,c){let d=this;return LQ(a,function(a){let e=d.events[d.events.length-1];return e&&"listItemIndent"===e[1].type&&e[2].sliceSerialize(e[1],!0).length===d.containerState.size?b(a):c(a)},"listItemIndent",d.containerState.size+1)}},MN={name:"setextUnderline",resolveTo:function(a,b){let c,d,e,f=a.length;for(;f--;)if("enter"===a[f][0]){if("content"===a[f][1].type){c=f;break}"paragraph"===a[f][1].type&&(d=f)}else"content"===a[f][1].type&&a.splice(f,1),e||"definition"!==a[f][1].type||(e=f);let g={type:"setextHeading",start:{...a[c][1].start},end:{...a[a.length-1][1].end}};return a[d][1].type="setextHeadingText",e?(a.splice(d,0,["enter",g,b]),a.splice(e+1,0,["exit",a[c][1],b]),a[c][1].end={...a[e][1].end}):a[c][1]=g,a.push(["exit",g,b]),a},tokenize:function(a,b,c){let d,e=this;return function(b){var g;let h,i=e.events.length;for(;i--;)if("lineEnding"!==e.events[i][1].type&&"linePrefix"!==e.events[i][1].type&&"content"!==e.events[i][1].type){h="paragraph"===e.events[i][1].type;break}return!e.parser.lazy[e.now().line]&&(e.interrupt||h)?(a.enter("setextHeadingLine"),d=b,g=b,a.enter("setextHeadingLineSequence"),function b(c){return c===d?(a.consume(c),b):(a.exit("setextHeadingLineSequence"),LO(c)?LQ(a,f,"lineSuffix")(c):f(c))}(g)):c(b)};function f(d){return null===d||LM(d)?(a.exit("setextHeadingLine"),b(d)):c(d)}}};a.s(["attentionMarkers",0,{null:[42,95]},"contentInitial",0,{91:{name:"definition",tokenize:function(a,b,c){let d,e=this;return function(b){var d;return a.enter("definition"),d=b,Mo.call(e,a,f,c,"definitionLabel","definitionLabelMarker","definitionLabelString")(d)};function f(b){return(d=Mw(e.sliceSerialize(e.events[e.events.length-1][1]).slice(1,-1)),58===b)?(a.enter("definitionMarker"),a.consume(b),a.exit("definitionMarker"),g):c(b)}function g(b){return LN(b)?Mv(a,h)(b):h(b)}function h(b){return Ml(a,i,c,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(b)}function i(b){return a.attempt(Mx,j,j)(b)}function j(b){return LO(b)?LQ(a,k,"whitespace")(b):k(b)}function k(f){return null===f||LM(f)?(a.exit("definition"),e.parser.defined.push(d),b(f)):c(f)}}}},"disable",0,{null:[]},"document",0,{42:MK,43:MK,45:MK,48:MK,49:MK,50:MK,51:MK,52:MK,53:MK,54:MK,55:MK,56:MK,57:MK,62:L9},"flow",0,{35:{name:"headingAtx",resolve:function(a,b){let c,d,e=a.length-2,f=3;return"whitespace"===a[3][1].type&&(f+=2),e-2>f&&"whitespace"===a[e][1].type&&(e-=2),"atxHeadingSequence"===a[e][1].type&&(f===e-1||e-4>f&&"whitespace"===a[e-2][1].type)&&(e-=f+1===e?2:4),e>f&&(c={type:"atxHeadingText",start:a[f][1].start,end:a[e][1].end},d={type:"chunkText",start:a[f][1].start,end:a[e][1].end,contentType:"text"},Lv(a,f,e-f+1,[["enter",c,b],["enter",d,b],["exit",d,b],["exit",c,b]])),a},tokenize:function(a,b,c){let d=0;return function(e){var f;return a.enter("atxHeading"),f=e,a.enter("atxHeadingSequence"),function e(f){return 35===f&&d++<6?(a.consume(f),e):null===f||LN(f)?(a.exit("atxHeadingSequence"),function c(d){return 35===d?(a.enter("atxHeadingSequence"),function b(d){return 35===d?(a.consume(d),b):(a.exit("atxHeadingSequence"),c(d))}(d)):null===d||LM(d)?(a.exit("atxHeading"),b(d)):LO(d)?LQ(a,c,"whitespace")(d):(a.enter("atxHeadingText"),function b(d){return null===d||35===d||LN(d)?(a.exit("atxHeadingText"),c(d)):(a.consume(d),b)}(d))}(f)):c(f)}(f)}}},42:MJ,45:[MN,MJ],60:{concrete:!0,name:"htmlFlow",resolveTo:function(a){let b=a.length;for(;b--&&("enter"!==a[b][0]||"htmlFlow"!==a[b][1].type););return b>1&&"linePrefix"===a[b-2][1].type&&(a[b][1].start=a[b-2][1].start,a[b+1][1].start=a[b-2][1].start,a.splice(b-2,2)),a},tokenize:function(a,b,c){let d,e,f,g,h,i=this;return function(b){var c;return c=b,a.enter("htmlFlow"),a.enter("htmlFlowData"),a.consume(c),j};function j(g){return 33===g?(a.consume(g),k):47===g?(a.consume(g),e=!0,o):63===g?(a.consume(g),d=3,i.interrupt?b:H):LG(g)?(a.consume(g),f=String.fromCharCode(g),p):c(g)}function k(e){return 45===e?(a.consume(e),d=2,l):91===e?(a.consume(e),d=5,g=0,n):LG(e)?(a.consume(e),d=4,i.interrupt?b:H):c(e)}function l(d){return 45===d?(a.consume(d),i.interrupt?b:H):c(d)}function n(d){let e="CDATA[";return d===e.charCodeAt(g++)?(a.consume(d),g===e.length)?i.interrupt?b:z:n:c(d)}function o(b){return LG(b)?(a.consume(b),f=String.fromCharCode(b),p):c(b)}function p(g){if(null===g||47===g||62===g||LN(g)){let h=47===g,j=f.toLowerCase();return!h&&!e&&Mz.includes(j)?(d=1,i.interrupt?b(g):z(g)):My.includes(f.toLowerCase())?(d=6,h)?(a.consume(g),q):i.interrupt?b(g):z(g):(d=7,i.interrupt&&!i.parser.lazy[i.now().line]?c(g):e?function b(c){return LO(c)?(a.consume(c),b):x(c)}(g):r(g))}return 45===g||LH(g)?(a.consume(g),f+=String.fromCharCode(g),p):c(g)}function q(d){return 62===d?(a.consume(d),i.interrupt?b:z):c(d)}function r(b){return 47===b?(a.consume(b),x):58===b||95===b||LG(b)?(a.consume(b),s):LO(b)?(a.consume(b),r):x(b)}function s(b){return 45===b||46===b||58===b||95===b||LH(b)?(a.consume(b),s):t(b)}function t(b){return 61===b?(a.consume(b),u):LO(b)?(a.consume(b),t):r(b)}function u(b){return null===b||60===b||61===b||62===b||96===b?c(b):34===b||39===b?(a.consume(b),h=b,v):LO(b)?(a.consume(b),u):function b(c){return null===c||34===c||39===c||47===c||60===c||61===c||62===c||96===c||LN(c)?t(c):(a.consume(c),b)}(b)}function v(b){return b===h?(a.consume(b),h=null,w):null===b||LM(b)?c(b):(a.consume(b),v)}function w(a){return 47===a||62===a||LO(a)?r(a):c(a)}function x(b){return 62===b?(a.consume(b),y):c(b)}function y(b){return null===b||LM(b)?z(b):LO(b)?(a.consume(b),y):c(b)}function z(b){return 45===b&&2===d?(a.consume(b),D):60===b&&1===d?(a.consume(b),E):62===b&&4===d?(a.consume(b),I):63===b&&3===d?(a.consume(b),H):93===b&&5===d?(a.consume(b),G):LM(b)&&(6===d||7===d)?(a.exit("htmlFlowData"),a.check(MA,J,A)(b)):null===b||LM(b)?(a.exit("htmlFlowData"),A(b)):(a.consume(b),z)}function A(b){return a.check(MB,B,J)(b)}function B(b){return a.enter("lineEnding"),a.consume(b),a.exit("lineEnding"),C}function C(b){return null===b||LM(b)?A(b):(a.enter("htmlFlowData"),z(b))}function D(b){return 45===b?(a.consume(b),H):z(b)}function E(b){return 47===b?(a.consume(b),f="",F):z(b)}function F(b){if(62===b){let c=f.toLowerCase();return Mz.includes(c)?(a.consume(b),I):z(b)}return LG(b)&&f.length<8?(a.consume(b),f+=String.fromCharCode(b),F):z(b)}function G(b){return 93===b?(a.consume(b),H):z(b)}function H(b){return 62===b?(a.consume(b),I):45===b&&2===d?(a.consume(b),H):z(b)}function I(b){return null===b||LM(b)?(a.exit("htmlFlowData"),J(b)):(a.consume(b),I)}function J(c){return a.exit("htmlFlow"),b(c)}}},61:MN,95:MJ,96:Mg,126:Mg},"flowInitial",0,{[-2]:Mh,[-1]:Mh,32:Mh},"insideSpan",0,{null:[L7,LY]},"string",0,{38:Me,92:Ma},"text",0,{[-5]:MI,[-4]:MI,[-3]:MI,33:MG,38:Me,42:L7,60:[{name:"autolink",tokenize:function(a,b,c){let d=0;return function(b){return a.enter("autolink"),a.enter("autolinkMarker"),a.consume(b),a.exit("autolinkMarker"),a.enter("autolinkProtocol"),e};function e(b){return LG(b)?(a.consume(b),f):64===b?c(b):h(b)}function f(b){return 43===b||45===b||46===b||LH(b)?(d=1,function b(c){return 58===c?(a.consume(c),d=0,g):(43===c||45===c||46===c||LH(c))&&d++<32?(a.consume(c),b):(d=0,h(c))}(b)):h(b)}function g(d){return 62===d?(a.exit("autolinkProtocol"),a.enter("autolinkMarker"),a.consume(d),a.exit("autolinkMarker"),a.exit("autolink"),b):null===d||32===d||60===d||null!==d&&(d<32||127===d)?c(d):(a.consume(d),g)}function h(b){return 64===b?(a.consume(b),i):LI(b)?(a.consume(b),h):c(b)}function i(e){return LH(e)?function e(f){return 46===f?(a.consume(f),d=0,i):62===f?(a.exit("autolinkProtocol").type="autolinkEmail",a.enter("autolinkMarker"),a.consume(f),a.exit("autolinkMarker"),a.exit("autolink"),b):function b(f){if((45===f||LH(f))&&d++<63){let c=45===f?b:e;return a.consume(f),c}return c(f)}(f)}(e):c(e)}}},{name:"htmlText",tokenize:function(a,b,c){let d,e,f,g=this;return function(b){return a.enter("htmlText"),a.enter("htmlTextData"),a.consume(b),h};function h(b){return 33===b?(a.consume(b),i):47===b?(a.consume(b),v):63===b?(a.consume(b),t):LG(b)?(a.consume(b),x):c(b)}function i(b){return 45===b?(a.consume(b),j):91===b?(a.consume(b),e=0,o):LG(b)?(a.consume(b),s):c(b)}function j(b){return 45===b?(a.consume(b),n):c(b)}function k(b){return null===b?c(b):45===b?(a.consume(b),l):LM(b)?(f=k,F(b)):(a.consume(b),k)}function l(b){return 45===b?(a.consume(b),n):k(b)}function n(a){return 62===a?E(a):45===a?l(a):k(a)}function o(b){let d="CDATA[";return b===d.charCodeAt(e++)?(a.consume(b),e===d.length?p:o):c(b)}function p(b){return null===b?c(b):93===b?(a.consume(b),q):LM(b)?(f=p,F(b)):(a.consume(b),p)}function q(b){return 93===b?(a.consume(b),r):p(b)}function r(b){return 62===b?E(b):93===b?(a.consume(b),r):p(b)}function s(b){return null===b||62===b?E(b):LM(b)?(f=s,F(b)):(a.consume(b),s)}function t(b){return null===b?c(b):63===b?(a.consume(b),u):LM(b)?(f=t,F(b)):(a.consume(b),t)}function u(a){return 62===a?E(a):t(a)}function v(b){return LG(b)?(a.consume(b),w):c(b)}function w(b){return 45===b||LH(b)?(a.consume(b),w):function b(c){return LM(c)?(f=b,F(c)):LO(c)?(a.consume(c),b):E(c)}(b)}function x(b){return 45===b||LH(b)?(a.consume(b),x):47===b||62===b||LN(b)?y(b):c(b)}function y(b){return 47===b?(a.consume(b),E):58===b||95===b||LG(b)?(a.consume(b),z):LM(b)?(f=y,F(b)):LO(b)?(a.consume(b),y):E(b)}function z(b){return 45===b||46===b||58===b||95===b||LH(b)?(a.consume(b),z):function b(c){return 61===c?(a.consume(c),A):LM(c)?(f=b,F(c)):LO(c)?(a.consume(c),b):y(c)}(b)}function A(b){return null===b||60===b||61===b||62===b||96===b?c(b):34===b||39===b?(a.consume(b),d=b,B):LM(b)?(f=A,F(b)):LO(b)?(a.consume(b),A):(a.consume(b),C)}function B(b){return b===d?(a.consume(b),d=void 0,D):null===b?c(b):LM(b)?(f=B,F(b)):(a.consume(b),B)}function C(b){return null===b||34===b||39===b||60===b||61===b||96===b?c(b):47===b||62===b||LN(b)?y(b):(a.consume(b),C)}function D(a){return 47===a||62===a||LN(a)?y(a):c(a)}function E(d){return 62===d?(a.consume(d),a.exit("htmlTextData"),a.exit("htmlText"),b):c(d)}function F(b){return a.exit("htmlTextData"),a.enter("lineEnding"),a.consume(b),a.exit("lineEnding"),G}function G(b){return LO(b)?LQ(a,H,"linePrefix",g.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(b):H(b)}function H(b){return a.enter("htmlTextData"),f(b)}}}],91:MH,92:[{name:"hardBreakEscape",tokenize:function(a,b,c){return function(b){return a.enter("hardBreakEscape"),a.consume(b),d};function d(d){return LM(d)?(a.exit("hardBreakEscape"),b(d)):c(d)}}},Ma],93:MC,95:L7,96:{name:"codeText",previous:function(a){return 96!==a||"characterEscape"===this.events[this.events.length-1][1].type},resolve:function(a){let b,c,d=a.length-4,e=3;if(("lineEnding"===a[3][1].type||"space"===a[e][1].type)&&("lineEnding"===a[d][1].type||"space"===a[d][1].type)){for(b=e;++b<d;)if("codeTextData"===a[b][1].type){a[e][1].type="codeTextPadding",a[d][1].type="codeTextPadding",e+=2,d-=2;break}}for(b=e-1,d++;++b<=d;)void 0===c?b!==d&&"lineEnding"!==a[b][1].type&&(c=b):(b===d||"lineEnding"===a[b][1].type)&&(a[c][1].type="codeTextData",b!==c+2&&(a[c][1].end=a[b-1][1].end,a.splice(c+2,b-c-2),d-=b-c-2,b=c+2),c=void 0);return a},tokenize:function(a,b,c){let d,e,f=0;return function(b){return a.enter("codeText"),a.enter("codeTextSequence"),function b(c){return 96===c?(a.consume(c),f++,b):(a.exit("codeTextSequence"),g(c))}(b)};function g(i){return null===i?c(i):32===i?(a.enter("space"),a.consume(i),a.exit("space"),g):96===i?(e=a.enter("codeTextSequence"),d=0,function c(g){return 96===g?(a.consume(g),d++,c):d===f?(a.exit("codeTextSequence"),a.exit("codeText"),b(g)):(e.type="codeTextData",h(g))}(i)):LM(i)?(a.enter("lineEnding"),a.consume(i),a.exit("lineEnding"),g):(a.enter("codeTextData"),h(i))}function h(b){return null===b||32===b||96===b||LM(b)?(a.exit("codeTextData"),g(b)):(a.consume(b),h)}}}}],35856);var MO=a.i(35856);let MP=/[\0\t\n\r]/g;function MQ(a,b){let c=Number.parseInt(a,b);return c<9||11===c||c>13&&c<32||c>126&&c<160||c>55295&&c<57344||c>64975&&c<65008||(65535&c)==65535||(65535&c)==65534||c>1114111?"�":String.fromCodePoint(c)}let MR=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function MS(a,b,c){if(b)return b;if(35===c.charCodeAt(0)){let a=c.charCodeAt(1),b=120===a||88===a;return MQ(c.slice(b?2:1),b?16:10)}return Md(c)||a}let MT={}.hasOwnProperty;function MU(a){return{line:a.line,column:a.column,offset:a.offset}}function MV(a,b){if(a)throw Error("Cannot close `"+a.type+"` ("+K8({start:a.start,end:a.end})+"): a different token (`"+b.type+"`, "+K8({start:b.start,end:b.end})+") is open");throw Error("Cannot close document, a token (`"+b.type+"`, "+K8({start:b.start,end:b.end})+") is still open")}function MW(a){let b=this;b.parser=function(c){var d,e;let f,g,h,i;return"string"!=typeof(d={...b.data("settings"),...a,extensions:b.data("micromarkExtensions")||[],mdastExtensions:b.data("fromMarkdownExtensions")||[]})&&(e=d,d=void 0),(function(a){let b={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:d(s),autolinkProtocol:j,autolinkEmail:j,atxHeading:d(p),blockQuote:d(function(){return{type:"blockquote",children:[]}}),characterEscape:j,characterReference:j,codeFenced:d(o),codeFencedFenceInfo:e,codeFencedFenceMeta:e,codeIndented:d(o,e),codeText:d(function(){return{type:"inlineCode",value:""}},e),codeTextData:j,data:j,codeFlowValue:j,definition:d(function(){return{type:"definition",identifier:"",label:null,title:null,url:""}}),definitionDestinationString:e,definitionLabelString:e,definitionTitleString:e,emphasis:d(function(){return{type:"emphasis",children:[]}}),hardBreakEscape:d(q),hardBreakTrailing:d(q),htmlFlow:d(r,e),htmlFlowData:j,htmlText:d(r,e),htmlTextData:j,image:d(function(){return{type:"image",title:null,url:"",alt:null}}),label:e,link:d(s),listItem:d(function(a){return{type:"listItem",spread:a._spread,checked:null,children:[]}}),listItemValue:function(a){this.data.expectingFirstListItemValue&&(this.stack[this.stack.length-2].start=Number.parseInt(this.sliceSerialize(a),10),this.data.expectingFirstListItemValue=void 0)},listOrdered:d(t,function(){this.data.expectingFirstListItemValue=!0}),listUnordered:d(t),paragraph:d(function(){return{type:"paragraph",children:[]}}),reference:function(){this.data.referenceType="collapsed"},referenceString:e,resourceDestinationString:e,resourceTitleString:e,setextHeading:d(p),strong:d(function(){return{type:"strong",children:[]}}),thematicBreak:d(function(){return{type:"thematicBreak"}})},exit:{atxHeading:g(),atxHeadingSequence:function(a){let b=this.stack[this.stack.length-1];b.depth||(b.depth=this.sliceSerialize(a).length)},autolink:g(),autolinkEmail:function(a){k.call(this,a),this.stack[this.stack.length-1].url="mailto:"+this.sliceSerialize(a)},autolinkProtocol:function(a){k.call(this,a),this.stack[this.stack.length-1].url=this.sliceSerialize(a)},blockQuote:g(),characterEscapeValue:k,characterReferenceMarkerHexadecimal:n,characterReferenceMarkerNumeric:n,characterReferenceValue:function(a){let b,c=this.sliceSerialize(a),d=this.data.characterReferenceType;d?(b=MQ(c,"characterReferenceMarkerNumeric"===d?10:16),this.data.characterReferenceType=void 0):b=Md(c);let e=this.stack[this.stack.length-1];e.value+=b},characterReference:function(a){this.stack.pop().position.end=MU(a.end)},codeFenced:g(function(){let a=this.resume();this.stack[this.stack.length-1].value=a.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}),codeFencedFence:function(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)},codeFencedFenceInfo:function(){let a=this.resume();this.stack[this.stack.length-1].lang=a},codeFencedFenceMeta:function(){let a=this.resume();this.stack[this.stack.length-1].meta=a},codeFlowValue:k,codeIndented:g(function(){let a=this.resume();this.stack[this.stack.length-1].value=a.replace(/(\r?\n|\r)$/g,"")}),codeText:g(function(){let a=this.resume();this.stack[this.stack.length-1].value=a}),codeTextData:k,data:k,definition:g(),definitionDestinationString:function(){let a=this.resume();this.stack[this.stack.length-1].url=a},definitionLabelString:function(a){let b=this.resume(),c=this.stack[this.stack.length-1];c.label=b,c.identifier=Mw(this.sliceSerialize(a)).toLowerCase()},definitionTitleString:function(){let a=this.resume();this.stack[this.stack.length-1].title=a},emphasis:g(),hardBreakEscape:g(l),hardBreakTrailing:g(l),htmlFlow:g(function(){let a=this.resume();this.stack[this.stack.length-1].value=a}),htmlFlowData:k,htmlText:g(function(){let a=this.resume();this.stack[this.stack.length-1].value=a}),htmlTextData:k,image:g(function(){let a=this.stack[this.stack.length-1];if(this.data.inReference){let b=this.data.referenceType||"shortcut";a.type+="Reference",a.referenceType=b,delete a.url,delete a.title}else delete a.identifier,delete a.label;this.data.referenceType=void 0}),label:function(){let a=this.stack[this.stack.length-1],b=this.resume(),c=this.stack[this.stack.length-1];this.data.inReference=!0,"link"===c.type?c.children=a.children:c.alt=b},labelText:function(a){let b=this.sliceSerialize(a),c=this.stack[this.stack.length-2];c.label=b.replace(MR,MS),c.identifier=Mw(b).toLowerCase()},lineEnding:function(a){let c=this.stack[this.stack.length-1];if(this.data.atHardBreak){c.children[c.children.length-1].position.end=MU(a.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&b.canContainEols.includes(c.type)&&(j.call(this,a),k.call(this,a))},link:g(function(){let a=this.stack[this.stack.length-1];if(this.data.inReference){let b=this.data.referenceType||"shortcut";a.type+="Reference",a.referenceType=b,delete a.url,delete a.title}else delete a.identifier,delete a.label;this.data.referenceType=void 0}),listItem:g(),listOrdered:g(),listUnordered:g(),paragraph:g(),referenceString:function(a){let b=this.resume(),c=this.stack[this.stack.length-1];c.label=b,c.identifier=Mw(this.sliceSerialize(a)).toLowerCase(),this.data.referenceType="full"},resourceDestinationString:function(){let a=this.resume();this.stack[this.stack.length-1].url=a},resourceTitleString:function(){let a=this.resume();this.stack[this.stack.length-1].title=a},resource:function(){this.data.inReference=void 0},setextHeading:g(function(){this.data.setextHeadingSlurpLineEnding=void 0}),setextHeadingLineSequence:function(a){this.stack[this.stack.length-1].depth=61===this.sliceSerialize(a).codePointAt(0)?1:2},setextHeadingText:function(){this.data.setextHeadingSlurpLineEnding=!0},strong:g(),thematicBreak:g()}};!function a(b,c){let d=-1;for(;++d<c.length;){let e=c[d];Array.isArray(e)?a(b,e):function(a,b){let c;for(c in b)if(MT.call(b,c))switch(c){case"canContainEols":{let d=b[c];d&&a[c].push(...d);break}case"transforms":{let d=b[c];d&&a[c].push(...d);break}case"enter":case"exit":{let d=b[c];d&&Object.assign(a[c],d)}}}(b,e)}}(b,(a||{}).mdastExtensions||[]);let c={};return function(a){let d={type:"root",children:[]},g={stack:[d],tokenStack:[],config:b,enter:f,exit:h,buffer:e,resume:i,data:c},j=[],k=-1;for(;++k<a.length;)("listOrdered"===a[k][1].type||"listUnordered"===a[k][1].type)&&("enter"===a[k][0]?j.push(k):k=function(a,b,c){let d,e,f,g,h=b-1,i=-1,j=!1;for(;++h<=c;){let b=a[h];switch(b[1].type){case"listUnordered":case"listOrdered":case"blockQuote":"enter"===b[0]?i++:i--,g=void 0;break;case"lineEndingBlank":"enter"===b[0]&&(!d||g||i||f||(f=h),g=void 0);break;case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:g=void 0}if(!i&&"enter"===b[0]&&"listItemPrefix"===b[1].type||-1===i&&"exit"===b[0]&&("listUnordered"===b[1].type||"listOrdered"===b[1].type)){if(d){let g=h;for(e=void 0;g--;){let b=a[g];if("lineEnding"===b[1].type||"lineEndingBlank"===b[1].type){if("exit"===b[0])continue;e&&(a[e][1].type="lineEndingBlank",j=!0),b[1].type="lineEnding",e=g}else if("linePrefix"===b[1].type||"blockQuotePrefix"===b[1].type||"blockQuotePrefixWhitespace"===b[1].type||"blockQuoteMarker"===b[1].type||"listItemIndent"===b[1].type);else break}f&&(!e||f<e)&&(d._spread=!0),d.end=Object.assign({},e?a[e][1].start:b[1].end),a.splice(e||h,0,["exit",d,b[2]]),h++,c++}if("listItemPrefix"===b[1].type){let e={type:"listItem",_spread:!1,start:Object.assign({},b[1].start),end:void 0};d=e,a.splice(h,0,["enter",e,b[2]]),h++,c++,f=void 0,g=!0}}}return a[b][1]._spread=j,c}(a,j.pop(),k));for(k=-1;++k<a.length;){let c=b[a[k][0]];MT.call(c,a[k][1].type)&&c[a[k][1].type].call(Object.assign({sliceSerialize:a[k][2].sliceSerialize},g),a[k][1])}if(g.tokenStack.length>0){let a=g.tokenStack[g.tokenStack.length-1];(a[1]||MV).call(g,void 0,a[0])}for(d.position={start:MU(a.length>0?a[0][1].start:{line:1,column:1,offset:0}),end:MU(a.length>0?a[a.length-2][1].end:{line:1,column:1,offset:0})},k=-1;++k<b.transforms.length;)d=b.transforms[k](d)||d;return d};function d(a,b){return function(c){f.call(this,a(c),c),b&&b.call(this,c)}}function e(){this.stack.push({type:"fragment",children:[]})}function f(a,b,c){this.stack[this.stack.length-1].children.push(a),this.stack.push(a),this.tokenStack.push([b,c||void 0]),a.position={start:MU(b.start),end:void 0}}function g(a){return function(b){a&&a.call(this,b),h.call(this,b)}}function h(a,b){let c=this.stack.pop(),d=this.tokenStack.pop();if(d)d[0].type!==a.type&&(b?b.call(this,a,d[0]):(d[1]||MV).call(this,a,d[0]));else throw Error("Cannot close `"+a.type+"` ("+K8({start:a.start,end:a.end})+"): it’s not open");c.position.end=MU(a.end)}function i(){return Ls(this.stack.pop())}function j(a){let b=this.stack[this.stack.length-1].children,c=b[b.length-1];c&&"text"===c.type||((c={type:"text",value:""}).position={start:MU(a.start),end:void 0},b.push(c)),this.stack.push(c)}function k(a){let b=this.stack.pop();b.value+=this.sliceSerialize(a),b.position.end=MU(a.end)}function l(){this.data.atHardBreak=!0}function n(a){this.data.characterReferenceType=a.type}function o(){return{type:"code",lang:null,meta:null,value:""}}function p(){return{type:"heading",depth:0,children:[]}}function q(){return{type:"break"}}function r(){return{type:"html",value:""}}function s(){return{type:"link",title:null,url:"",children:[]}}function t(a){return{type:"list",ordered:"listOrdered"===a.type,start:null,spread:a._spread,children:[]}}})(e)(function(a){for(;!LU(a););return a}((function(a){let b={constructs:Ly([MO,...(a||{}).extensions||[]]),content:c(LD),defined:[],document:c(LE),flow:c(LX),lazy:{},string:c(LZ),text:c(L$)};return b;function c(a){return function(c){return function(a,b,c){let d={_bufferIndex:-1,_index:0,line:c&&c.line||1,column:c&&c.column||1,offset:c&&c.offset||0},e={},f=[],g=[],h=[],i={attempt:p(function(a,b){q(a,b.from)}),check:p(o),consume:function(a){Lz(a)?(d.line++,d.column=1,d.offset+=-3===a?2:1,r()):-1!==a&&(d.column++,d.offset++),d._bufferIndex<0?d._index++:(d._bufferIndex++,d._bufferIndex===g[d._index].length&&(d._bufferIndex=-1,d._index++)),j.previous=a},enter:function(a,b){let c=b||{};return c.type=a,c.start=n(),j.events.push(["enter",c,j]),h.push(c),c},exit:function(a){let b=h.pop();return b.end=n(),j.events.push(["exit",b,j]),b},interrupt:p(o,{interrupt:!0})},j={code:null,containerState:{},defineSkip:function(a){e[a.line]=a.column,r()},events:[],now:n,parser:a,previous:null,sliceSerialize:function(a,b){return function(a,b){let c,d=-1,e=[];for(;++d<a.length;){let f,g=a[d];if("string"==typeof g)f=g;else switch(g){case -5:f="\r";break;case -4:f="\n";break;case -3:f="\r\n";break;case -2:f=b?" ":" ";break;case -1:if(!b&&c)continue;f=" ";break;default:f=String.fromCharCode(g)}c=-2===g,e.push(f)}return e.join("")}(l(a),b)},sliceStream:l,write:function(a){return(g=Lw(g,a),function(){let a;for(;d._index<g.length;){let c=g[d._index];if("string"==typeof c)for(a=d._index,d._bufferIndex<0&&(d._bufferIndex=0);d._index===a&&d._bufferIndex<c.length;){var b;b=c.charCodeAt(d._bufferIndex),k=k(b)}else k=k(c)}}(),null!==g[g.length-1])?[]:(q(b,0),j.events=L6(f,j.events,j),j.events)}},k=b.tokenize.call(j,i);return b.resolveAll&&f.push(b),j;function l(a){return function(a,b){let c,d=b.start._index,e=b.start._bufferIndex,f=b.end._index,g=b.end._bufferIndex;if(d===f)c=[a[d].slice(e,g)];else{if(c=a.slice(d,f),e>-1){let a=c[0];"string"==typeof a?c[0]=a.slice(e):c.shift()}g>0&&c.push(a[f].slice(0,g))}return c}(g,a)}function n(){let{_bufferIndex:a,_index:b,line:c,column:e,offset:f}=d;return{_bufferIndex:a,_index:b,line:c,column:e,offset:f}}function o(a,b){b.restore()}function p(a,b){return function(c,e,f){var g;let k,l,o,p;return Array.isArray(c)?q(c):"tokenize"in c?q([c]):(g=c,function(a){let b=null!==a&&g[a],c=null!==a&&g.null;return q([...Array.isArray(b)?b:b?[b]:[],...Array.isArray(c)?c:c?[c]:[]])(a)});function q(a){return(k=a,l=0,0===a.length)?f:s(a[l])}function s(a){return function(c){let e,f,g,k,l;return(e=n(),f=j.previous,g=j.currentConstruct,k=j.events.length,l=Array.from(h),p={from:k,restore:function(){d=e,j.previous=f,j.currentConstruct=g,j.events.length=k,h=l,r()}},o=a,a.partial||(j.currentConstruct=a),a.name&&j.parser.constructs.disable.null.includes(a.name))?u(c):a.tokenize.call(b?Object.assign(Object.create(j),b):j,i,t,u)(c)}}function t(b){return a(o,p),e}function u(a){return(p.restore(),++l<k.length)?s(k[l]):f}}}function q(a,b){a.resolveAll&&!f.includes(a)&&f.push(a),a.resolve&&Lv(j.events,b,j.events.length-b,a.resolve(j.events.slice(b),j)),a.resolveTo&&(j.events=a.resolveTo(j.events,j))}function r(){d.line in e&&d.column<2&&(d.column=e[d.line],d.offset+=e[d.line]-1)}}(b,a,c)}}})(e).document().write((g=1,h="",i=!0,function(a,b,c){let d,e,j,k,l,n=[];for(a=h+("string"==typeof a?a.toString():new TextDecoder(b||void 0).decode(a)),j=0,h="",i&&(65279===a.charCodeAt(0)&&j++,i=void 0);j<a.length;){if(MP.lastIndex=j,k=(d=MP.exec(a))&&void 0!==d.index?d.index:a.length,l=a.charCodeAt(k),!d){h=a.slice(j);break}if(10===l&&j===k&&f)n.push(-3),f=void 0;else switch(f&&(n.push(-5),f=void 0),j<k&&(n.push(a.slice(j,k)),g+=k-j),l){case 0:n.push(65533),g++;break;case 9:for(e=4*Math.ceil(g/4),n.push(-2);g++<e;)n.push(-1);break;case 10:n.push(-4),g=1;break;default:f=!0,g=1}j=k+1}return c&&(f&&n.push(-5),h&&n.push(h),n.push(null)),n})(c,d,!0))))}}let MX="object"==typeof self?self:globalThis,MY=a=>{var b;let c,d;return(b=new Map,c=(a,c)=>(b.set(c,a),a),d=e=>{if(b.has(e))return b.get(e);let[f,g]=a[e];switch(f){case 0:case -1:return c(g,e);case 1:{let a=c([],e);for(let b of g)a.push(d(b));return a}case 2:{let a=c({},e);for(let[b,c]of g)a[d(b)]=d(c);return a}case 3:return c(new Date(g),e);case 4:{let{source:a,flags:b}=g;return c(new RegExp(a,b),e)}case 5:{let a=c(new Map,e);for(let[b,c]of g)a.set(d(b),d(c));return a}case 6:{let a=c(new Set,e);for(let b of g)a.add(d(b));return a}case 7:{let{name:a,message:b}=g;return c(new MX[a](b),e)}case 8:return c(BigInt(g),e);case"BigInt":return c(Object(BigInt(g)),e);case"ArrayBuffer":return c(new Uint8Array(g).buffer,g);case"DataView":{let{buffer:a}=new Uint8Array(g);return c(new DataView(a),g)}}return c(new MX[f](g),e)})(0)},{toString:MZ}={},{keys:M$}=Object,M_=a=>{let b=typeof a;if("object"!==b||!a)return[0,b];let c=MZ.call(a).slice(8,-1);switch(c){case"Array":return[1,""];case"Object":return[2,""];case"Date":return[3,""];case"RegExp":return[4,""];case"Map":return[5,""];case"Set":return[6,""];case"DataView":return[1,c]}return c.includes("Array")?[1,c]:c.includes("Error")?[7,c]:[2,c]},M0=([a,b])=>0===a&&("function"===b||"symbol"===b),M1=(a,{json:b,lossy:c}={})=>{var d,e,f;let g,h,i=[];return(d=!(b||c),e=!!b,f=new Map,g=(a,b)=>{let c=i.push(a)-1;return f.set(b,c),c},h=a=>{if(f.has(a))return f.get(a);let[b,c]=M_(a);switch(b){case 0:{let e=a;switch(c){case"bigint":b=8,e=a.toString();break;case"function":case"symbol":if(d)throw TypeError("unable to serialize "+c);e=null;break;case"undefined":return g([-1],a)}return g([b,e],a)}case 1:{if(c){let b=a;return"DataView"===c?b=new Uint8Array(a.buffer):"ArrayBuffer"===c&&(b=new Uint8Array(a)),g([c,[...b]],a)}let d=[],e=g([b,d],a);for(let b of a)d.push(h(b));return e}case 2:{if(c)switch(c){case"BigInt":return g([c,a.toString()],a);case"Boolean":case"Number":case"String":return g([c,a.valueOf()],a)}if(e&&"toJSON"in a)return h(a.toJSON());let f=[],i=g([b,f],a);for(let b of M$(a))(d||!M0(M_(a[b])))&&f.push([h(b),h(a[b])]);return i}case 3:return g([b,a.toISOString()],a);case 4:{let{source:c,flags:d}=a;return g([b,{source:c,flags:d}],a)}case 5:{let c=[],e=g([b,c],a);for(let[b,e]of a)(d||!(M0(M_(b))||M0(M_(e))))&&c.push([h(b),h(e)]);return e}case 6:{let c=[],e=g([b,c],a);for(let b of a)(d||!M0(M_(b)))&&c.push(h(b));return e}}let{message:i}=a;return g([b,{name:c,message:i}],a)})(a),i},M2="function"==typeof structuredClone?(a,b)=>b&&("json"in b||"lossy"in b)?MY(M1(a,b)):structuredClone(a):(a,b)=>MY(M1(a,b));M4(/[A-Za-z]/);let M3=M4(/[\dA-Za-z]/);function M4(a){return function(b){return null!==b&&b>-1&&a.test(String.fromCharCode(b))}}function M5(a){let b=[],c=-1,d=0,e=0;for(;++c<a.length;){let f=a.charCodeAt(c),g="";if(37===f&&M3(a.charCodeAt(c+1))&&M3(a.charCodeAt(c+2)))e=2;else if(f<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(f))||(g=String.fromCharCode(f));else if(f>55295&&f<57344){let b=a.charCodeAt(c+1);f<56320&&b>56319&&b<57344?(g=String.fromCharCode(f,b),e=1):g="�"}else g=String.fromCharCode(f);g&&(b.push(a.slice(d,c),encodeURIComponent(g)),d=c+e+1,g=""),e&&(c+=e,e=0)}return b.join("")+a.slice(d)}function M6(a,b){let c=[{type:"text",value:"↩"}];return b>1&&c.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(b)}]}),c}function M7(a,b){return"Back to reference "+(a+1)+(b>1?"-"+b:"")}M4(/[#-'*+\--9=?A-Z^-~]/),M4(/\d/),M4(/[\dA-Fa-f]/),M4(/[!-/:-@[-`{-~]/),M4(/\p{P}|\p{S}/u),M4(/\s/);let M8=function(a){var b,c;if(null==a)return Na;if("function"==typeof a)return M9(a);if("object"==typeof a){return Array.isArray(a)?function(a){let b=[],c=-1;for(;++c<a.length;)b[c]=M8(a[c]);return M9(function(...a){let c=-1;for(;++c<b.length;)if(b[c].apply(this,a))return!0;return!1})}(a):(b=a,M9(function(a){let c;for(c in b)if(a[c]!==b[c])return!1;return!0}))}if("string"==typeof a){return c=a,M9(function(a){return a&&a.type===c})}throw Error("Expected function, string, or object as test")};function M9(a){return function(b,c,d){return!!(function(a){return null!==a&&"object"==typeof a&&"type"in a}(b)&&a.call(this,b,"number"==typeof c?c:void 0,d||void 0))}}function Na(){return!0}let Nb=[];function Nc(a,b,c,d){let e;"function"==typeof b&&"function"!=typeof c?(d=c,c=b):e=b;let f=M8(e),g=d?-1:1;(function a(e,h,i){let j=e&&"object"==typeof e?e:{};if("string"==typeof j.type){let a="string"==typeof j.tagName?j.tagName:"string"==typeof j.name?j.name:void 0;Object.defineProperty(k,"name",{value:"node (\x1b[33m"+e.type+(a?"<"+a+">":"")+"\x1b[39m)"})}return k;function k(){var j;let k,l,n,o=Nb;if((!b||f(e,h,i[i.length-1]||void 0))&&!1===(o=Array.isArray(j=c(e,i))?j:"number"==typeof j?[!0,j]:null==j?Nb:[j])[0])return o;if("children"in e&&e.children&&e.children&&"skip"!==o[0])for(l=(d?e.children.length:-1)+g,n=i.concat(e);l>-1&&l<e.children.length;){if(!1===(k=a(e.children[l],l,n)())[0])return k;l="number"==typeof k[1]?k[1]:l+g}return o}})(a,void 0,[])()}function Nd(a,b,c,d){let e,f,g;"function"==typeof b&&"function"!=typeof c?(f=void 0,g=b,e=c):(f=b,g=c,e=d),Nc(a,f,function(a,b){let c=b[b.length-1],d=c?c.children.indexOf(a):void 0;return g(a,d,c)},e)}function Ne(a,b){let c=b.referenceType,d="]";if("collapsed"===c?d+="[]":"full"===c&&(d+="["+(b.label||b.identifier)+"]"),"imageReference"===b.type)return[{type:"text",value:"!["+b.alt+d}];let e=a.all(b),f=e[0];f&&"text"===f.type?f.value="["+f.value:e.unshift({type:"text",value:"["});let g=e[e.length-1];return g&&"text"===g.type?g.value+=d:e.push({type:"text",value:d}),e}function Nf(a){let b=a.spread;return null==b?a.children.length>1:b}function Ng(a,b,c){let d=0,e=a.length;if(b){let b=a.codePointAt(d);for(;9===b||32===b;)d++,b=a.codePointAt(d)}if(c){let b=a.codePointAt(e-1);for(;9===b||32===b;)e--,b=a.codePointAt(e-1)}return e>d?a.slice(d,e):""}let Nh={blockquote:function(a,b){let c={type:"element",tagName:"blockquote",properties:{},children:a.wrap(a.all(b),!0)};return a.patch(b,c),a.applyData(b,c)},break:function(a,b){let c={type:"element",tagName:"br",properties:{},children:[]};return a.patch(b,c),[a.applyData(b,c),{type:"text",value:"\n"}]},code:function(a,b){let c=b.value?b.value+"\n":"",d={},e=b.lang?b.lang.split(/\s+/):[];e.length>0&&(d.className=["language-"+e[0]]);let f={type:"element",tagName:"code",properties:d,children:[{type:"text",value:c}]};return b.meta&&(f.data={meta:b.meta}),a.patch(b,f),f={type:"element",tagName:"pre",properties:{},children:[f=a.applyData(b,f)]},a.patch(b,f),f},delete:function(a,b){let c={type:"element",tagName:"del",properties:{},children:a.all(b)};return a.patch(b,c),a.applyData(b,c)},emphasis:function(a,b){let c={type:"element",tagName:"em",properties:{},children:a.all(b)};return a.patch(b,c),a.applyData(b,c)},footnoteReference:function(a,b){let c,d="string"==typeof a.options.clobberPrefix?a.options.clobberPrefix:"user-content-",e=String(b.identifier).toUpperCase(),f=M5(e.toLowerCase()),g=a.footnoteOrder.indexOf(e),h=a.footnoteCounts.get(e);void 0===h?(h=0,a.footnoteOrder.push(e),c=a.footnoteOrder.length):c=g+1,h+=1,a.footnoteCounts.set(e,h);let i={type:"element",tagName:"a",properties:{href:"#"+d+"fn-"+f,id:d+"fnref-"+f+(h>1?"-"+h:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(c)}]};a.patch(b,i);let j={type:"element",tagName:"sup",properties:{},children:[i]};return a.patch(b,j),a.applyData(b,j)},heading:function(a,b){let c={type:"element",tagName:"h"+b.depth,properties:{},children:a.all(b)};return a.patch(b,c),a.applyData(b,c)},html:function(a,b){if(a.options.allowDangerousHtml){let c={type:"raw",value:b.value};return a.patch(b,c),a.applyData(b,c)}},imageReference:function(a,b){let c=String(b.identifier).toUpperCase(),d=a.definitionById.get(c);if(!d)return Ne(a,b);let e={src:M5(d.url||""),alt:b.alt};null!==d.title&&void 0!==d.title&&(e.title=d.title);let f={type:"element",tagName:"img",properties:e,children:[]};return a.patch(b,f),a.applyData(b,f)},image:function(a,b){let c={src:M5(b.url)};null!==b.alt&&void 0!==b.alt&&(c.alt=b.alt),null!==b.title&&void 0!==b.title&&(c.title=b.title);let d={type:"element",tagName:"img",properties:c,children:[]};return a.patch(b,d),a.applyData(b,d)},inlineCode:function(a,b){let c={type:"text",value:b.value.replace(/\r?\n|\r/g," ")};a.patch(b,c);let d={type:"element",tagName:"code",properties:{},children:[c]};return a.patch(b,d),a.applyData(b,d)},linkReference:function(a,b){let c=String(b.identifier).toUpperCase(),d=a.definitionById.get(c);if(!d)return Ne(a,b);let e={href:M5(d.url||"")};null!==d.title&&void 0!==d.title&&(e.title=d.title);let f={type:"element",tagName:"a",properties:e,children:a.all(b)};return a.patch(b,f),a.applyData(b,f)},link:function(a,b){let c={href:M5(b.url)};null!==b.title&&void 0!==b.title&&(c.title=b.title);let d={type:"element",tagName:"a",properties:c,children:a.all(b)};return a.patch(b,d),a.applyData(b,d)},listItem:function(a,b,c){let d=a.all(b),e=c?function(a){let b=!1;if("list"===a.type){b=a.spread||!1;let c=a.children,d=-1;for(;!b&&++d<c.length;)b=Nf(c[d])}return b}(c):Nf(b),f={},g=[];if("boolean"==typeof b.checked){let a,c=d[0];c&&"element"===c.type&&"p"===c.tagName?a=c:(a={type:"element",tagName:"p",properties:{},children:[]},d.unshift(a)),a.children.length>0&&a.children.unshift({type:"text",value:" "}),a.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:b.checked,disabled:!0},children:[]}),f.className=["task-list-item"]}let h=-1;for(;++h<d.length;){let a=d[h];(e||0!==h||"element"!==a.type||"p"!==a.tagName)&&g.push({type:"text",value:"\n"}),"element"!==a.type||"p"!==a.tagName||e?g.push(a):g.push(...a.children)}let i=d[d.length-1];i&&(e||"element"!==i.type||"p"!==i.tagName)&&g.push({type:"text",value:"\n"});let j={type:"element",tagName:"li",properties:f,children:g};return a.patch(b,j),a.applyData(b,j)},list:function(a,b){let c={},d=a.all(b),e=-1;for("number"==typeof b.start&&1!==b.start&&(c.start=b.start);++e<d.length;){let a=d[e];if("element"===a.type&&"li"===a.tagName&&a.properties&&Array.isArray(a.properties.className)&&a.properties.className.includes("task-list-item")){c.className=["contains-task-list"];break}}let f={type:"element",tagName:b.ordered?"ol":"ul",properties:c,children:a.wrap(d,!0)};return a.patch(b,f),a.applyData(b,f)},paragraph:function(a,b){let c={type:"element",tagName:"p",properties:{},children:a.all(b)};return a.patch(b,c),a.applyData(b,c)},root:function(a,b){let c={type:"root",children:a.wrap(a.all(b))};return a.patch(b,c),a.applyData(b,c)},strong:function(a,b){let c={type:"element",tagName:"strong",properties:{},children:a.all(b)};return a.patch(b,c),a.applyData(b,c)},table:function(a,b){let c=a.all(b),d=c.shift(),e=[];if(d){let c={type:"element",tagName:"thead",properties:{},children:a.wrap([d],!0)};a.patch(b.children[0],c),e.push(c)}if(c.length>0){let d={type:"element",tagName:"tbody",properties:{},children:a.wrap(c,!0)},f=K6(b.children[1]),g=K5(b.children[b.children.length-1]);f&&g&&(d.position={start:f,end:g}),e.push(d)}let f={type:"element",tagName:"table",properties:{},children:a.wrap(e,!0)};return a.patch(b,f),a.applyData(b,f)},tableCell:function(a,b){let c={type:"element",tagName:"td",properties:{},children:a.all(b)};return a.patch(b,c),a.applyData(b,c)},tableRow:function(a,b,c){let d=c?c.children:void 0,e=0===(d?d.indexOf(b):1)?"th":"td",f=c&&"table"===c.type?c.align:void 0,g=f?f.length:b.children.length,h=-1,i=[];for(;++h<g;){let c=b.children[h],d={},g=f?f[h]:void 0;g&&(d.align=g);let j={type:"element",tagName:e,properties:d,children:[]};c&&(j.children=a.all(c),a.patch(c,j),j=a.applyData(c,j)),i.push(j)}let j={type:"element",tagName:"tr",properties:{},children:a.wrap(i,!0)};return a.patch(b,j),a.applyData(b,j)},text:function(a,b){let c={type:"text",value:function(a){let b=String(a),c=/\r?\n|\r/g,d=c.exec(b),e=0,f=[];for(;d;)f.push(Ng(b.slice(e,d.index),e>0,!0),d[0]),e=d.index+d[0].length,d=c.exec(b);return f.push(Ng(b.slice(e),e>0,!1)),f.join("")}(String(b.value))};return a.patch(b,c),a.applyData(b,c)},thematicBreak:function(a,b){let c={type:"element",tagName:"hr",properties:{},children:[]};return a.patch(b,c),a.applyData(b,c)},toml:Ni,yaml:Ni,definition:Ni,footnoteDefinition:Ni};function Ni(){}let Nj={}.hasOwnProperty,Nk={};function Nl(a,b){a.position&&(b.position=function(a){let b=K6(a),c=K5(a);if(b&&c)return{start:b,end:c}}(a))}function Nm(a,b){let c=b;if(a&&a.data){let b=a.data.hName,d=a.data.hChildren,e=a.data.hProperties;"string"==typeof b&&("element"===c.type?c.tagName=b:c={type:"element",tagName:b,properties:{},children:"children"in c?c.children:[c]}),"element"===c.type&&e&&Object.assign(c.properties,M2(e)),"children"in c&&c.children&&null!=d&&(c.children=d)}return c}function Nn(a,b){let c=[],d=-1;for(b&&c.push({type:"text",value:"\n"});++d<a.length;)d&&c.push({type:"text",value:"\n"}),c.push(a[d]);return b&&a.length>0&&c.push({type:"text",value:"\n"}),c}function No(a){let b=0,c=a.charCodeAt(b);for(;9===c||32===c;)b++,c=a.charCodeAt(b);return a.slice(b)}function Np(a,b){let c,d,e,f,g=(c=b||Nk,d=new Map,e=new Map,f={all:function(a){let b=[];if("children"in a){let c=a.children,d=-1;for(;++d<c.length;){let e=f.one(c[d],a);if(e){if(d&&"break"===c[d-1].type&&(Array.isArray(e)||"text"!==e.type||(e.value=No(e.value)),!Array.isArray(e)&&"element"===e.type)){let a=e.children[0];a&&"text"===a.type&&(a.value=No(a.value))}Array.isArray(e)?b.push(...e):b.push(e)}}}return b},applyData:Nm,definitionById:d,footnoteById:e,footnoteCounts:new Map,footnoteOrder:[],handlers:{...Nh,...c.handlers},one:function(a,b){let c=a.type,d=f.handlers[c];if(Nj.call(f.handlers,c)&&d)return d(f,a,b);if(f.options.passThrough&&f.options.passThrough.includes(c)){if("children"in a){let{children:b,...c}=a,d=M2(c);return d.children=f.all(a),d}return M2(a)}return(f.options.unknownHandler||function(a,b){let c=b.data||{},d="value"in b&&!(Nj.call(c,"hProperties")||Nj.call(c,"hChildren"))?{type:"text",value:b.value}:{type:"element",tagName:"div",properties:{},children:a.all(b)};return a.patch(b,d),a.applyData(b,d)})(f,a,b)},options:c,patch:Nl,wrap:Nn},Nd(a,function(a){if("definition"===a.type||"footnoteDefinition"===a.type){let b="definition"===a.type?d:e,c=String(a.identifier).toUpperCase();b.has(c)||b.set(c,a)}}),f),h=g.one(a,void 0),i=function(a){let b="string"==typeof a.options.clobberPrefix?a.options.clobberPrefix:"user-content-",c=a.options.footnoteBackContent||M6,d=a.options.footnoteBackLabel||M7,e=a.options.footnoteLabel||"Footnotes",f=a.options.footnoteLabelTagName||"h2",g=a.options.footnoteLabelProperties||{className:["sr-only"]},h=[],i=-1;for(;++i<a.footnoteOrder.length;){let e=a.footnoteById.get(a.footnoteOrder[i]);if(!e)continue;let f=a.all(e),g=String(e.identifier).toUpperCase(),j=M5(g.toLowerCase()),k=0,l=[],n=a.footnoteCounts.get(g);for(;void 0!==n&&++k<=n;){l.length>0&&l.push({type:"text",value:" "});let a="string"==typeof c?c:c(i,k);"string"==typeof a&&(a={type:"text",value:a}),l.push({type:"element",tagName:"a",properties:{href:"#"+b+"fnref-"+j+(k>1?"-"+k:""),dataFootnoteBackref:"",ariaLabel:"string"==typeof d?d:d(i,k),className:["data-footnote-backref"]},children:Array.isArray(a)?a:[a]})}let o=f[f.length-1];if(o&&"element"===o.type&&"p"===o.tagName){let a=o.children[o.children.length-1];a&&"text"===a.type?a.value+=" ":o.children.push({type:"text",value:" "}),o.children.push(...l)}else f.push(...l);let p={type:"element",tagName:"li",properties:{id:b+"fn-"+j},children:a.wrap(f,!0)};a.patch(e,p),h.push(p)}if(0!==h.length)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:f,properties:{...M2(g),id:"footnote-label"},children:[{type:"text",value:e}]},{type:"text",value:"\n"},{type:"element",tagName:"ol",properties:{},children:a.wrap(h,!0)},{type:"text",value:"\n"}]}}(g),j=Array.isArray(h)?{type:"root",children:h}:h||{type:"root",children:[]};return i&&(Kr("children"in j),j.children.push({type:"text",value:"\n"},i)),j}function Nq(a,b){return a&&"run"in a?async function(c,d){let e=Np(c,{file:d,...b});await a.run(e,d)}:function(c,d){return Np(c,{file:d,...a||b})}}function Nr(a){if(a)throw a}var Ns=a.i(97599);function Nt(a){if("object"!=typeof a||null===a)return!1;let b=Object.getPrototypeOf(a);return(null===b||b===Object.prototype||null===Object.getPrototypeOf(b))&&!(Symbol.toStringTag in a)&&!(Symbol.iterator in a)}var Nu=a.i(50227),Nu=Nu,Nv=a.i(59639),Nv=Nv,Nw=a.i(57764),Nw=Nw;function Nx(a){return!!(null!==a&&"object"==typeof a&&"href"in a&&a.href&&"protocol"in a&&a.protocol&&void 0===a.auth)}let Ny=["history","path","basename","stem","extname","dirname"];class Nz{constructor(a){let b,c;b=a?Nx(a)?{path:a}:"string"==typeof a||function(a){return!!(a&&"object"==typeof a&&"byteLength"in a&&"byteOffset"in a)}(a)?{value:a}:a:{},this.cwd="cwd"in b?"":Nv.default.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let d=-1;for(;++d<Ny.length;){const a=Ny[d];a in b&&void 0!==b[a]&&null!==b[a]&&(this[a]="history"===a?[...b[a]]:b[a])}for(c in b)Ny.includes(c)||(this[c]=b[c])}get basename(){return"string"==typeof this.path?Nu.default.basename(this.path):void 0}set basename(a){NB(a,"basename"),NA(a,"basename"),this.path=Nu.default.join(this.dirname||"",a)}get dirname(){return"string"==typeof this.path?Nu.default.dirname(this.path):void 0}set dirname(a){NC(this.basename,"dirname"),this.path=Nu.default.join(a||"",this.basename)}get extname(){return"string"==typeof this.path?Nu.default.extname(this.path):void 0}set extname(a){if(NA(a,"extname"),NC(this.dirname,"extname"),a){if(46!==a.codePointAt(0))throw Error("`extname` must start with `.`");if(a.includes(".",1))throw Error("`extname` cannot contain multiple dots")}this.path=Nu.default.join(this.dirname,this.stem+(a||""))}get path(){return this.history[this.history.length-1]}set path(a){Nx(a)&&(a=(0,Nw.fileURLToPath)(a)),NB(a,"path"),this.path!==a&&this.history.push(a)}get stem(){return"string"==typeof this.path?Nu.default.basename(this.path,this.extname):void 0}set stem(a){NB(a,"stem"),NA(a,"stem"),this.path=Nu.default.join(this.dirname||"",a+(this.extname||""))}fail(a,b,c){let d=this.message(a,b,c);throw d.fatal=!0,d}info(a,b,c){let d=this.message(a,b,c);return d.fatal=void 0,d}message(a,b,c){let d=new Lc(a,b,c);return this.path&&(d.name=this.path+":"+d.name,d.file=this.path),d.fatal=!1,this.messages.push(d),d}toString(a){return void 0===this.value?"":"string"==typeof this.value?this.value:new TextDecoder(a||void 0).decode(this.value)}}function NA(a,b){if(a&&a.includes(Nu.default.sep))throw Error("`"+b+"` cannot be a path: did not expect `"+Nu.default.sep+"`")}function NB(a,b){if(!a)throw Error("`"+b+"` cannot be empty")}function NC(a,b){if(!a)throw Error("Setting `"+b+"` requires `path` to be set too")}let ND=function(a){let b=this.constructor.prototype,c=b[a],d=function(){return c.apply(d,arguments)};return Object.setPrototypeOf(d,b),d},NE={}.hasOwnProperty;class NF extends ND{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=function(){let a=[],b={run:function(...b){let c=-1,d=b.pop();if("function"!=typeof d)throw TypeError("Expected function as last argument, not "+d);!function e(f,...g){let h=a[++c],i=-1;if(f)return void d(f);for(;++i<b.length;)(null===g[i]||void 0===g[i])&&(g[i]=b[i]);b=g,h?(function(a,b){let c;return function(...b){let f,g=a.length>b.length;g&&b.push(d);try{f=a.apply(this,b)}catch(a){if(g&&c)throw a;return d(a)}g||(f&&f.then&&"function"==typeof f.then?f.then(e,d):f instanceof Error?d(f):e(f))};function d(a,...e){c||(c=!0,b(a,...e))}function e(a){d(null,a)}})(h,e)(...g):d(null,...g)}(null,...b)},use:function(c){if("function"!=typeof c)throw TypeError("Expected `middelware` to be a function, not "+c);return a.push(c),b}};return b}()}copy(){let a=new NF,b=-1;for(;++b<this.attachers.length;){let c=this.attachers[b];a.use(...c)}return a.data((0,Ns.default)(!0,{},this.namespace)),a}data(a,b){return"string"==typeof a?2==arguments.length?(NJ("data",this.frozen),this.namespace[a]=b,this):NE.call(this.namespace,a)&&this.namespace[a]||void 0:a?(NJ("data",this.frozen),this.namespace=a,this):this.namespace}freeze(){if(this.frozen)return this;for(;++this.freezeIndex<this.attachers.length;){let[a,...b]=this.attachers[this.freezeIndex];if(!1===b[0])continue;!0===b[0]&&(b[0]=void 0);let c=a.call(this,...b);"function"==typeof c&&this.transformers.use(c)}return this.frozen=!0,this.freezeIndex=1/0,this}parse(a){this.freeze();let b=NM(a),c=this.parser||this.Parser;return NH("parse",c),c(String(b),b)}process(a,b){let c=this;return this.freeze(),NH("process",this.parser||this.Parser),NI("process",this.compiler||this.Compiler),b?d(void 0,b):new Promise(d);function d(d,e){let f=NM(a),g=c.parse(f);function h(a,c){a||!c?e(a):d?d(c):(Kr(b,"`done` is defined if `resolve` is not"),b(void 0,c))}c.run(g,f,function(a,b,d){var e,f;if(a||!b||!d)return h(a);let g=c.stringify(b,d);"string"==typeof(e=g)||(f=e)&&"object"==typeof f&&"byteLength"in f&&"byteOffset"in f?d.value=g:d.result=g,h(a,d)})}}processSync(a){let b,c=!1;return this.freeze(),NH("processSync",this.parser||this.Parser),NI("processSync",this.compiler||this.Compiler),this.process(a,function(a,d){c=!0,Nr(a),b=d}),NL("processSync","process",c),Kr(b,"we either bailed on an error or have a tree"),b}run(a,b,c){NK(a),this.freeze();let d=this.transformers;return c||"function"!=typeof b||(c=b,b=void 0),c?e(void 0,c):new Promise(e);function e(e,f){Kr("function"!=typeof b,"`file` can’t be a `done` anymore, we checked");let g=NM(b);d.run(a,g,function(b,d,g){let h=d||a;b?f(b):e?e(h):(Kr(c,"`done` is defined if `resolve` is not"),c(void 0,h,g))})}}runSync(a,b){let c,d=!1;return this.run(a,b,function(a,b){Nr(a),c=b,d=!0}),NL("runSync","run",d),Kr(c,"we either bailed on an error or have a tree"),c}stringify(a,b){this.freeze();let c=NM(b),d=this.compiler||this.Compiler;return NI("stringify",d),NK(a),d(a,c)}use(a,...b){let c=this.attachers,d=this.namespace;if(NJ("use",this.frozen),null==a);else if("function"==typeof a)g(a,b);else if("object"==typeof a)Array.isArray(a)?f(a):e(a);else throw TypeError("Expected usable value, not `"+a+"`");return this;function e(a){if(!("plugins"in a)&&!("settings"in a))throw Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");f(a.plugins),a.settings&&(d.settings=(0,Ns.default)(!0,d.settings,a.settings))}function f(a){let b=-1;if(null==a);else if(Array.isArray(a))for(;++b<a.length;)!function(a){if("function"==typeof a)g(a,[]);else if("object"==typeof a)if(Array.isArray(a)){let[b,...c]=a;g(b,c)}else e(a);else throw TypeError("Expected usable value, not `"+a+"`")}(a[b]);else throw TypeError("Expected a list of plugins, not `"+a+"`")}function g(a,b){let d=-1,e=-1;for(;++d<c.length;)if(c[d][0]===a){e=d;break}if(-1===e)c.push([a,...b]);else if(b.length>0){let[d,...f]=b,g=c[e][1];Nt(g)&&Nt(d)&&(d=(0,Ns.default)(!0,g,d)),c[e]=[a,d,...f]}}}}let NG=new NF().freeze();function NH(a,b){if("function"!=typeof b)throw TypeError("Cannot `"+a+"` without `parser`")}function NI(a,b){if("function"!=typeof b)throw TypeError("Cannot `"+a+"` without `compiler`")}function NJ(a,b){if(b)throw Error("Cannot call `"+a+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function NK(a){if(!Nt(a)||"string"!=typeof a.type)throw TypeError("Expected node, got `"+a+"`")}function NL(a,b,c){if(!c)throw Error("`"+a+"` finished async. Use `"+b+"` instead")}function NM(a){var b;return(b=a)&&"object"==typeof b&&"message"in b&&"messages"in b?a:new Nz(a)}let NN=[],NO={allowDangerousHtml:!0},NP=/^(https?|ircs?|mailto|xmpp)$/i,NQ=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function NR(a){var b;let c,d,e,f,g,h=(c=(b=a).rehypePlugins||NN,d=b.remarkPlugins||NN,e=b.remarkRehypeOptions?{...b.remarkRehypeOptions,...NO}:NO,NG().use(MW).use(d).use(Nq,e).use(c)),i=(f=a.children||"",g=new Nz,"string"==typeof f?g.value=f:Ks("Unexpected value `"+f+"` for `children` prop, expected `string`"),g);return function(a,b){let c=b.allowedElements,d=b.allowElement,e=b.components,f=b.disallowedElements,g=b.skipHtml,h=b.unwrapDisallowed,i=b.urlTransform||NS;for(let a of NQ)Object.hasOwn(b,a.from)&&Ks("Unexpected `"+a.from+"` prop, "+(a.to?"use `"+a.to+"` instead":"remove it")+" (see <https://github.com/remarkjs/react-markdown/blob/main/changelog.md#"+a.id+"> for more info)");return c&&f&&Ks("Unexpected combined `allowedElements` and `disallowedElements`, expected one or the other"),Nd(a,function(a,b,e){if("raw"===a.type&&e&&"number"==typeof b)return g?e.children.splice(b,1):e.children[b]={type:"text",value:a.value},b;if("element"===a.type){let b;for(b in Lq)if(Object.hasOwn(Lq,b)&&Object.hasOwn(a.properties,b)){let c=a.properties[b],d=Lq[b];(null===d||d.includes(a.tagName))&&(a.properties[b]=i(String(c||""),b,a))}}if("element"===a.type){let g=c?!c.includes(a.tagName):!!f&&f.includes(a.tagName);if(!g&&d&&"number"==typeof b&&(g=!d(a,b,e)),g&&e&&"number"==typeof b)return h&&a.children?e.children.splice(b,1,...a.children):e.children.splice(b,1),b}}),function(a,b){var c,d,e,f;let g;if(!b||void 0===b.Fragment)throw TypeError("Expected `Fragment` in options");let h=b.filePath||void 0;if(b.development){if("function"!=typeof b.jsxDEV)throw TypeError("Expected `jsxDEV` in options when `development: true`");c=h,d=b.jsxDEV,g=function(a,b,e,f){let g=Array.isArray(e.children),h=K6(a);return d(b,e,f,g,{columnNumber:h?h.column-1:void 0,fileName:c,lineNumber:h?h.line:void 0},void 0)}}else{if("function"!=typeof b.jsx)throw TypeError("Expected `jsx` in production options");if("function"!=typeof b.jsxs)throw TypeError("Expected `jsxs` in production options");e=b.jsx,f=b.jsxs,g=function(a,b,c,d){let g=Array.isArray(c.children)?f:e;return d?g(b,c,d):g(b,c)}}let i={Fragment:b.Fragment,ancestors:[],components:b.components||{},create:g,elementAttributeNameCase:b.elementAttributeNameCase||"react",evaluater:b.createEvaluater?b.createEvaluater():void 0,filePath:h,ignoreInvalidStyle:b.ignoreInvalidStyle||!1,passKeys:!1!==b.passKeys,passNode:b.passNode||!1,schema:"svg"===b.space?K3:K2,stylePropertyNameCase:b.stylePropertyNameCase||"dom",tableCellAlignToStyle:!1!==b.tableCellAlignToStyle},j=Lj(i,a,void 0);return j&&"string"!=typeof j?j:i.create(a,i.Fragment,{children:j||void 0},void 0)}(a,{Fragment:B.Fragment,components:e,ignoreInvalidStyle:!0,jsx:B.jsx,jsxs:B.jsxs,passKeys:!0,passNode:!0})}(h.runSync(h.parse(i),i),a)}function NS(a){let b=a.indexOf(":"),c=a.indexOf("?"),d=a.indexOf("#"),e=a.indexOf("/");return -1===b||-1!==e&&b>e||-1!==c&&b>c||-1!==d&&b>d||NP.test(a.slice(0,b))?a:""}function NT(a,b){let c=String(a);if("string"!=typeof b)throw TypeError("Expected character");let d=0,e=c.indexOf(b);for(;-1!==e;)d++,e=c.indexOf(b,e+b.length);return d}NW(/[A-Za-z]/),NW(/[\dA-Za-z]/),NW(/[#-'*+\--9=?A-Z^-~]/),NW(/\d/),NW(/[\dA-Fa-f]/),NW(/[!-/:-@[-`{-~]/);let NU=NW(/\p{P}|\p{S}/u),NV=NW(/\s/);function NW(a){return function(b){return null!==b&&b>-1&&a.test(String.fromCharCode(b))}}let NX="phrasing",NY=["autolink","link","image","label"];function NZ(a){this.enter({type:"link",title:null,url:"",children:[]},a)}function N$(a){this.config.enter.autolinkProtocol.call(this,a)}function N_(a){this.config.exit.autolinkProtocol.call(this,a)}function N0(a){this.config.exit.data.call(this,a);let b=this.stack[this.stack.length-1];Kr("link"===b.type),b.url="http://"+this.sliceSerialize(a)}function N1(a){this.config.exit.autolinkEmail.call(this,a)}function N2(a){this.exit(a)}function N3(a){!function(a,b,c){let d=M8((c||{}).ignore||[]),e=function(a){let b=[];if(!Array.isArray(a))throw TypeError("Expected find and replace tuple or list of tuples");let c=!a[0]||Array.isArray(a[0])?a:[a],d=-1;for(;++d<c.length;){var e;let a=c[d];b.push(["string"==typeof(e=a[0])?RegExp(function(a){if("string"!=typeof a)throw TypeError("Expected a string");return a.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}(e),"g"):e,function(a){return"function"==typeof a?a:function(){return a}}(a[1])])}return b}(b),f=-1;for(;++f<e.length;)Nc(a,"text",g);function g(a,b){let c,g=-1;for(;++g<b.length;){let a=b[g],e=c?c.children:void 0;if(d(a,e?e.indexOf(a):void 0,c))return;c=a}if(c)return function(a,b){let c=b[b.length-1],d=e[f][0],g=e[f][1],h=0,i=c.children.indexOf(a),j=!1,k=[];d.lastIndex=0;let l=d.exec(a.value);for(;l;){let c=l.index,e={index:l.index,input:l.input,stack:[...b,a]},f=g(...l,e);if("string"==typeof f&&(f=f.length>0?{type:"text",value:f}:void 0),!1===f?d.lastIndex=c+1:(h!==c&&k.push({type:"text",value:a.value.slice(h,c)}),Array.isArray(f)?k.push(...f):f&&k.push(f),h=c+l[0].length,j=!0),!d.global)break;l=d.exec(a.value)}return j?(h<a.value.length&&k.push({type:"text",value:a.value.slice(h)}),c.children.splice(i,1,...k)):k=[a],i+k.length}(a,b)}}(a,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,N4],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,N5]],{ignore:["link","linkReference"]})}function N4(a,b,c,d,e){let f,g="";if(!N6(e))return!1;if(/^w/i.test(b)&&(c=b+c,b="",g="http://"),(f=c.split(".")).length<2||f[f.length-1]&&(/_/.test(f[f.length-1])||!/[a-zA-Z\d]/.test(f[f.length-1]))||f[f.length-2]&&(/_/.test(f[f.length-2])||!/[a-zA-Z\d]/.test(f[f.length-2])))return!1;let h=function(a){let b=/[!"&'),.:;<>?\]}]+$/.exec(a);if(!b)return[a,void 0];a=a.slice(0,b.index);let c=b[0],d=c.indexOf(")"),e=NT(a,"("),f=NT(a,")");for(;-1!==d&&e>f;)a+=c.slice(0,d+1),d=(c=c.slice(d+1)).indexOf(")"),f++;return[a,c]}(c+d);if(!h[0])return!1;let i={type:"link",title:null,url:g+b+h[0],children:[{type:"text",value:b+h[0]}]};return h[1]?[i,{type:"text",value:h[1]}]:i}function N5(a,b,c,d){return!(!N6(d,!0)||/[-\d_]$/.test(c))&&{type:"link",title:null,url:"mailto:"+b+"@"+c,children:[{type:"text",value:b+"@"+c}]}}function N6(a,b){let c=a.input.charCodeAt(a.index-1);return(0===a.index||NV(c)||NU(c))&&(!b||47!==c)}function N7(){this.buffer()}function N8(a){this.enter({type:"footnoteReference",identifier:"",label:""},a)}function N9(){this.buffer()}function Oa(a){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},a)}function Ob(a){let b=this.resume(),c=this.stack[this.stack.length-1];Kr("footnoteReference"===c.type),c.identifier=Mw(this.sliceSerialize(a)).toLowerCase(),c.label=b}function Oc(a){this.exit(a)}function Od(a){let b=this.resume(),c=this.stack[this.stack.length-1];Kr("footnoteDefinition"===c.type),c.identifier=Mw(this.sliceSerialize(a)).toLowerCase(),c.label=b}function Oe(a){this.exit(a)}function Of(a,b,c,d){let e=c.createTracker(d),f=e.move("[^"),g=c.enter("footnoteReference"),h=c.enter("reference");return f+=e.move(c.safe(c.associationId(a),{after:"]",before:f})),h(),g(),f+=e.move("]")}function Og(a,b,c){return 0===b?a:Oh(a,b,c)}function Oh(a,b,c){return(c?"":" ")+a}Of.peek=function(){return"["};let Oi=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];function Oj(a){this.enter({type:"delete",children:[]},a)}function Ok(a){this.exit(a)}function Ol(a,b,c,d){let e=c.createTracker(d),f=c.enter("strikethrough"),g=e.move("~~");return g+=c.containerPhrasing(a,{...e.current(),before:g,after:"~"}),g+=e.move("~~"),f(),g}function Om(a){return a.length}function On(a){let b="string"==typeof a?a.codePointAt(0):0;return 67===b||99===b?99:76===b||108===b?108:114*(82===b||114===b)}Ol.peek=function(){return"~"};function Oo(a,b,c){let d=a.value||"",e="`",f=-1;for(;RegExp("(^|[^`])"+e+"([^`]|$)").test(d);)e+="`";for(/[^ \r\n]/.test(d)&&(/^[ \r\n]/.test(d)&&/[ \r\n]$/.test(d)||/^`|`$/.test(d))&&(d=" "+d+" ");++f<c.unsafe.length;){let a,b=c.unsafe[f],e=c.compilePattern(b);if(b.atBreak)for(;a=e.exec(d);){let b=a.index;10===d.charCodeAt(b)&&13===d.charCodeAt(b-1)&&b--,d=d.slice(0,b)+" "+d.slice(a.index+1)}}return e+d+e}Oo.peek=function(){return"`"};M8(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);let Op=function(a,b,c,d){let e=function(a){let b=a.options.listItemIndent||"one";if("tab"!==b&&"one"!==b&&"mixed"!==b)throw Error("Cannot serialize items with `"+b+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return b}(c),f=c.bulletCurrent||function(a){let b=a.options.bullet||"*";if("*"!==b&&"+"!==b&&"-"!==b)throw Error("Cannot serialize items with `"+b+"` for `options.bullet`, expected `*`, `+`, or `-`");return b}(c);b&&"list"===b.type&&b.ordered&&(f=("number"==typeof b.start&&b.start>-1?b.start:1)+(!1===c.options.incrementListMarker?0:b.children.indexOf(a))+f);let g=f.length+1;("tab"===e||"mixed"===e&&(b&&"list"===b.type&&b.spread||a.spread))&&(g=4*Math.ceil(g/4));let h=c.createTracker(d);h.move(f+" ".repeat(g-f.length)),h.shift(g);let i=c.enter("listItem"),j=c.indentLines(c.containerFlow(a,h.current()),function(a,b,c){return b?(c?"":" ".repeat(g))+a:(c?f:f+" ".repeat(g-f.length))+a});return i(),j};function Oq(a){let b=a._align;Kr(b,"expected `_align` on table"),this.enter({type:"table",align:b.map(function(a){return"none"===a?null:a}),children:[]},a),this.data.inTable=!0}function Or(a){this.exit(a),this.data.inTable=void 0}function Os(a){this.enter({type:"tableRow",children:[]},a)}function Ot(a){this.exit(a)}function Ou(a){this.enter({type:"tableCell",children:[]},a)}function Ov(a){let b=this.resume();this.data.inTable&&(b=b.replace(/\\([\\|])/g,Ow));let c=this.stack[this.stack.length-1];Kr("inlineCode"===c.type),c.value=b,this.exit(a)}function Ow(a,b){return"|"===b?b:a}function Ox(a){let b=this.stack[this.stack.length-2];Kr("listItem"===b.type),b.checked="taskListCheckValueChecked"===a.type}function Oy(a){let b=this.stack[this.stack.length-2];if(b&&"listItem"===b.type&&"boolean"==typeof b.checked){let a=this.stack[this.stack.length-1];Kr("paragraph"===a.type);let c=a.children[0];if(c&&"text"===c.type){let d,e=b.children,f=-1;for(;++f<e.length;){let a=e[f];if("paragraph"===a.type){d=a;break}}d===a&&(c.value=c.value.slice(1),0===c.value.length?a.children.shift():a.position&&c.position&&"number"==typeof c.position.start.offset&&(c.position.start.column++,c.position.start.offset++,a.position.start=Object.assign({},c.position.start)))}}this.exit(a)}function Oz(a,b,c,d){let e=a.children[0],f="boolean"==typeof a.checked&&e&&"paragraph"===e.type,g="["+(a.checked?"x":" ")+"] ",h=c.createTracker(d);f&&h.move(g);let i=Op(a,b,c,{...d,...h.current()});return f&&(i=i.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,function(a){return a+g})),i}let OA=OF(/[A-Za-z]/),OB=OF(/[\dA-Za-z]/);function OC(a){return null!==a&&(a<0||32===a)}OF(/[#-'*+\--9=?A-Z^-~]/),OF(/\d/),OF(/[\dA-Fa-f]/),OF(/[!-/:-@[-`{-~]/);let OD=OF(/\p{P}|\p{S}/u),OE=OF(/\s/);function OF(a){return function(b){return null!==b&&b>-1&&a.test(String.fromCharCode(b))}}let OG={tokenize:function(a,b,c){let d=0;return function b(f){return(87===f||119===f)&&d<3?(d++,a.consume(f),b):46===f&&3===d?(a.consume(f),e):c(f)};function e(a){return null===a?c(a):b(a)}},partial:!0},OH={tokenize:function(a,b,c){let d,e,f;return g;function g(b){return 46===b||95===b?a.check(OJ,i,h)(b):null===b||OC(b)||OE(b)||45!==b&&OD(b)?i(b):(f=!0,a.consume(b),g)}function h(b){return 95===b?d=!0:(e=d,d=void 0),a.consume(b),g}function i(a){return e||d||!f?c(a):b(a)}},partial:!0},OI={tokenize:function(a,b){let c=0,d=0;return e;function e(g){return 40===g?(c++,a.consume(g),e):41===g&&d<c?f(g):33===g||34===g||38===g||39===g||41===g||42===g||44===g||46===g||58===g||59===g||60===g||63===g||93===g||95===g||126===g?a.check(OJ,b,f)(g):null===g||OC(g)||OE(g)?b(g):(a.consume(g),e)}function f(b){return 41===b&&d++,a.consume(b),e}},partial:!0},OJ={tokenize:function(a,b,c){return d;function d(g){return 33===g||34===g||39===g||41===g||42===g||44===g||46===g||58===g||59===g||63===g||95===g||126===g?(a.consume(g),d):38===g?(a.consume(g),f):93===g?(a.consume(g),e):60===g||null===g||OC(g)||OE(g)?b(g):c(g)}function e(a){return null===a||40===a||91===a||OC(a)||OE(a)?b(a):d(a)}function f(b){return OA(b)?function b(e){return 59===e?(a.consume(e),d):OA(e)?(a.consume(e),b):c(e)}(b):c(b)}},partial:!0},OK={tokenize:function(a,b,c){return function(b){return a.consume(b),d};function d(a){return OB(a)?c(a):b(a)}},partial:!0},OL={name:"wwwAutolink",tokenize:function(a,b,c){let d=this;return function(b){return 87!==b&&119!==b||!OQ.call(d,d.previous)||OU(d.events)?c(b):(a.enter("literalAutolink"),a.enter("literalAutolinkWww"),a.check(OG,a.attempt(OH,a.attempt(OI,e),c),c)(b))};function e(c){return a.exit("literalAutolinkWww"),a.exit("literalAutolink"),b(c)}},previous:OQ},OM={name:"protocolAutolink",tokenize:function(a,b,c){let d=this,e="",f=!1;return function(b){return(72===b||104===b)&&OR.call(d,d.previous)&&!OU(d.events)?(a.enter("literalAutolink"),a.enter("literalAutolinkHttp"),e+=String.fromCodePoint(b),a.consume(b),g):c(b)};function g(b){if(OA(b)&&e.length<5)return e+=String.fromCodePoint(b),a.consume(b),g;if(58===b){let c=e.toLowerCase();if("http"===c||"https"===c)return a.consume(b),h}return c(b)}function h(b){return 47===b?(a.consume(b),f)?i:(f=!0,h):c(b)}function i(b){return null===b||null!==b&&(b<32||127===b)||OC(b)||OE(b)||OD(b)?c(b):a.attempt(OH,a.attempt(OI,j),c)(b)}function j(c){return a.exit("literalAutolinkHttp"),a.exit("literalAutolink"),b(c)}},previous:OR},ON={name:"emailAutolink",tokenize:function(a,b,c){let d,e,f=this;return function(b){return!OT(b)||!OS.call(f,f.previous)||OU(f.events)?c(b):(a.enter("literalAutolink"),a.enter("literalAutolinkEmail"),function b(d){return OT(d)?(a.consume(d),b):64===d?(a.consume(d),g):c(d)}(b))};function g(b){return 46===b?a.check(OK,i,h)(b):45===b||95===b||OB(b)?(e=!0,a.consume(b),g):i(b)}function h(b){return a.consume(b),d=!0,g}function i(g){return e&&d&&OA(f.previous)?(a.exit("literalAutolinkEmail"),a.exit("literalAutolink"),b(g)):c(g)}},previous:OS},OO={},OP=48;for(;OP<123;)OO[OP]=ON,58==++OP?OP=65:91===OP&&(OP=97);function OQ(a){return null===a||40===a||42===a||95===a||91===a||93===a||126===a||OC(a)}function OR(a){return!OA(a)}function OS(a){return!(47===a||OT(a))}function OT(a){return 43===a||45===a||46===a||95===a||OB(a)}function OU(a){let b=a.length,c=!1;for(;b--;){let d=a[b][1];if(("labelLink"===d.type||"labelImage"===d.type)&&!d._balanced){c=!0;break}if(d._gfmAutolinkLiteralWalkedInto){c=!1;break}}return a.length>0&&!c&&(a[a.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),c}function OV(a){return null!==a&&(a<0||32===a)}function OW(a){return -2===a||-1===a||32===a}function OX(a){return function(b){return null!==b&&b>-1&&a.test(String.fromCharCode(b))}}function OY(a,b,c,d){let e=d?d-1:1/0,f=0;return function(d){return OW(d)?(a.enter(c),function d(g){return OW(g)&&f++<e?(a.consume(g),d):(a.exit(c),b(g))}(d)):b(d)}}OO[43]=ON,OO[45]=ON,OO[46]=ON,OO[95]=ON,OO[72]=[ON,OM],OO[104]=[ON,OM],OO[87]=[ON,OL],OO[119]=[ON,OL],OX(/[A-Za-z]/),OX(/[\dA-Za-z]/),OX(/[#-'*+\--9=?A-Z^-~]/),OX(/\d/),OX(/[\dA-Fa-f]/),OX(/[!-/:-@[-`{-~]/),OX(/\p{P}|\p{S}/u),OX(/\s/);let OZ={tokenize:function(a,b,c){let d=this;return OY(a,function(a){let e=d.events[d.events.length-1];return e&&"gfmFootnoteDefinitionIndent"===e[1].type&&4===e[2].sliceSerialize(e[1],!0).length?b(a):c(a)},"gfmFootnoteDefinitionIndent",5)},partial:!0};function O$(a,b,c){let d,e=this,f=e.events.length,g=e.parser.gfmFootnotes||(e.parser.gfmFootnotes=[]);for(;f--;){let a=e.events[f][1];if("labelImage"===a.type){d=a;break}if("gfmFootnoteCall"===a.type||"labelLink"===a.type||"label"===a.type||"image"===a.type||"link"===a.type)break}return function(f){if(!d||!d._balanced)return c(f);let h=Mw(e.sliceSerialize({start:d.end,end:e.now()}));return 94===h.codePointAt(0)&&g.includes(h.slice(1))?(a.enter("gfmFootnoteCallLabelMarker"),a.consume(f),a.exit("gfmFootnoteCallLabelMarker"),b(f)):c(f)}}function O_(a,b){let c=a.length;for(;c--;)if("labelImage"===a[c][1].type&&"enter"===a[c][0]){a[c][1];break}a[c+1][1].type="data",a[c+3][1].type="gfmFootnoteCallLabelMarker";let d={type:"gfmFootnoteCall",start:Object.assign({},a[c+3][1].start),end:Object.assign({},a[a.length-1][1].end)},e={type:"gfmFootnoteCallMarker",start:Object.assign({},a[c+3][1].end),end:Object.assign({},a[c+3][1].end)};e.end.column++,e.end.offset++,e.end._bufferIndex++;let f={type:"gfmFootnoteCallString",start:Object.assign({},e.end),end:Object.assign({},a[a.length-1][1].start)},g={type:"chunkString",contentType:"string",start:Object.assign({},f.start),end:Object.assign({},f.end)},h=[a[c+1],a[c+2],["enter",d,b],a[c+3],a[c+4],["enter",e,b],["exit",e,b],["enter",f,b],["enter",g,b],["exit",g,b],["exit",f,b],a[a.length-2],a[a.length-1],["exit",d,b]];return a.splice(c,a.length-c+1,...h),a}function O0(a,b,c){let d,e=this,f=e.parser.gfmFootnotes||(e.parser.gfmFootnotes=[]),g=0;return function(b){return a.enter("gfmFootnoteCall"),a.enter("gfmFootnoteCallLabelMarker"),a.consume(b),a.exit("gfmFootnoteCallLabelMarker"),h};function h(b){return 94!==b?c(b):(a.enter("gfmFootnoteCallMarker"),a.consume(b),a.exit("gfmFootnoteCallMarker"),a.enter("gfmFootnoteCallString"),a.enter("chunkString").contentType="string",i)}function i(h){if(g>999||93===h&&!d||null===h||91===h||OV(h))return c(h);if(93===h){a.exit("chunkString");let d=a.exit("gfmFootnoteCallString");return f.includes(Mw(e.sliceSerialize(d)))?(a.enter("gfmFootnoteCallLabelMarker"),a.consume(h),a.exit("gfmFootnoteCallLabelMarker"),a.exit("gfmFootnoteCall"),b):c(h)}return OV(h)||(d=!0),g++,a.consume(h),92===h?j:i}function j(b){return 91===b||92===b||93===b?(a.consume(b),g++,i):i(b)}}function O1(a,b,c){let d,e,f=this,g=f.parser.gfmFootnotes||(f.parser.gfmFootnotes=[]),h=0;return function(b){return a.enter("gfmFootnoteDefinition")._container=!0,a.enter("gfmFootnoteDefinitionLabel"),a.enter("gfmFootnoteDefinitionLabelMarker"),a.consume(b),a.exit("gfmFootnoteDefinitionLabelMarker"),i};function i(b){return 94===b?(a.enter("gfmFootnoteDefinitionMarker"),a.consume(b),a.exit("gfmFootnoteDefinitionMarker"),a.enter("gfmFootnoteDefinitionLabelString"),a.enter("chunkString").contentType="string",j):c(b)}function j(b){if(h>999||93===b&&!e||null===b||91===b||OV(b))return c(b);if(93===b){a.exit("chunkString");let c=a.exit("gfmFootnoteDefinitionLabelString");return d=Mw(f.sliceSerialize(c)),a.enter("gfmFootnoteDefinitionLabelMarker"),a.consume(b),a.exit("gfmFootnoteDefinitionLabelMarker"),a.exit("gfmFootnoteDefinitionLabel"),l}return OV(b)||(e=!0),h++,a.consume(b),92===b?k:j}function k(b){return 91===b||92===b||93===b?(a.consume(b),h++,j):j(b)}function l(b){return 58===b?(a.enter("definitionMarker"),a.consume(b),a.exit("definitionMarker"),g.includes(d)||g.push(d),OY(a,n,"gfmFootnoteDefinitionWhitespace")):c(b)}function n(a){return b(a)}}function O2(a,b,c){return a.check(LR,b,a.attempt(OZ,b,c))}function O3(a){a.exit("gfmFootnoteDefinition")}function O4(a){return null!==a&&a<-2}function O5(a){return null!==a&&(a<0||32===a)}function O6(a){return -2===a||-1===a||32===a}function O7(a){return function(b){return null!==b&&b>-1&&a.test(String.fromCharCode(b))}}function O8(a,b,c,d){let e=d?d-1:1/0,f=0;return function(d){return O6(d)?(a.enter(c),function d(g){return O6(g)&&f++<e?(a.consume(g),d):(a.exit(c),b(g))}(d)):b(d)}}O7(/[A-Za-z]/),O7(/[\dA-Za-z]/),O7(/[#-'*+\--9=?A-Z^-~]/),O7(/\d/),O7(/[\dA-Fa-f]/),O7(/[!-/:-@[-`{-~]/),O7(/\p{P}|\p{S}/u),O7(/\s/);class O9{constructor(){this.map=[]}add(a,b,c){!function(a,b,c,d){let e=0;if(0!==c||0!==d.length){for(;e<a.map.length;){if(a.map[e][0]===b){a.map[e][1]+=c,a.map[e][2].push(...d);return}e+=1}a.map.push([b,c,d])}}(this,a,b,c)}consume(a){if(this.map.sort(function(a,b){return a[0]-b[0]}),0===this.map.length)return;let b=this.map.length,c=[];for(;b>0;)b-=1,c.push(a.slice(this.map[b][0]+this.map[b][1]),this.map[b][2]),a.length=this.map[b][0];c.push(a.slice()),a.length=0;let d=c.pop();for(;d;){for(let b of d)a.push(b);d=c.pop()}this.map.length=0}}function Pa(a,b,c){let d,e=this,f=0,g=0;return function(a){let b=e.events.length-1;for(;b>-1;){let a=e.events[b][1].type;if("lineEnding"===a||"linePrefix"===a)b--;else break}let d=b>-1?e.events[b][1].type:null,f="tableHead"===d||"tableRow"===d?t:h;return f===t&&e.parser.lazy[e.now().line]?c(a):f(a)};function h(b){var c;return a.enter("tableHead"),a.enter("tableRow"),124===(c=b)||(d=!0,g+=1),i(c)}function i(b){return null===b?c(b):O4(b)?g>1?(g=0,e.interrupt=!0,a.exit("tableRow"),a.enter("lineEnding"),a.consume(b),a.exit("lineEnding"),l):c(b):O6(b)?O8(a,i,"whitespace")(b):(g+=1,d&&(d=!1,f+=1),124===b)?(a.enter("tableCellDivider"),a.consume(b),a.exit("tableCellDivider"),d=!0,i):(a.enter("data"),j(b))}function j(b){return null===b||124===b||O5(b)?(a.exit("data"),i(b)):(a.consume(b),92===b?k:j)}function k(b){return 92===b||124===b?(a.consume(b),j):j(b)}function l(b){return(e.interrupt=!1,e.parser.lazy[e.now().line])?c(b):(a.enter("tableDelimiterRow"),d=!1,O6(b))?O8(a,n,"linePrefix",e.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(b):n(b)}function n(b){return 45===b||58===b?p(b):124===b?(d=!0,a.enter("tableCellDivider"),a.consume(b),a.exit("tableCellDivider"),o):c(b)}function o(b){return O6(b)?O8(a,p,"whitespace")(b):p(b)}function p(b){return 58===b?(g+=1,d=!0,a.enter("tableDelimiterMarker"),a.consume(b),a.exit("tableDelimiterMarker"),q):45===b?(g+=1,q(b)):null===b||O4(b)?s(b):c(b)}function q(b){return 45===b?(a.enter("tableDelimiterFiller"),function b(c){return 45===c?(a.consume(c),b):58===c?(d=!0,a.exit("tableDelimiterFiller"),a.enter("tableDelimiterMarker"),a.consume(c),a.exit("tableDelimiterMarker"),r):(a.exit("tableDelimiterFiller"),r(c))}(b)):c(b)}function r(b){return O6(b)?O8(a,s,"whitespace")(b):s(b)}function s(e){if(124===e)return n(e);if(null===e||O4(e))return d&&f===g?(a.exit("tableDelimiterRow"),a.exit("tableHead"),b(e)):c(e);return c(e)}function t(b){return a.enter("tableRow"),u(b)}function u(c){return 124===c?(a.enter("tableCellDivider"),a.consume(c),a.exit("tableCellDivider"),u):null===c||O4(c)?(a.exit("tableRow"),b(c)):O6(c)?O8(a,u,"whitespace")(c):(a.enter("data"),v(c))}function v(b){return null===b||124===b||O5(b)?(a.exit("data"),u(b)):(a.consume(b),92===b?w:v)}function w(b){return 92===b||124===b?(a.consume(b),v):v(b)}}function Pb(a,b){let c,d,e,f=-1,g=!0,h=0,i=[0,0,0,0],j=[0,0,0,0],k=!1,l=0,n=new O9;for(;++f<a.length;){let o=a[f],p=o[1];"enter"===o[0]?"tableHead"===p.type?(k=!1,0!==l&&(Pd(n,b,l,c,d),d=void 0,l=0),c={type:"table",start:Object.assign({},p.start),end:Object.assign({},p.end)},n.add(f,0,[["enter",c,b]])):"tableRow"===p.type||"tableDelimiterRow"===p.type?(g=!0,e=void 0,i=[0,0,0,0],j=[0,f+1,0,0],k&&(k=!1,d={type:"tableBody",start:Object.assign({},p.start),end:Object.assign({},p.end)},n.add(f,0,[["enter",d,b]])),h="tableDelimiterRow"===p.type?2:d?3:1):h&&("data"===p.type||"tableDelimiterMarker"===p.type||"tableDelimiterFiller"===p.type)?(g=!1,0===j[2]&&(0!==i[1]&&(j[0]=j[1],e=Pc(n,b,i,h,void 0,e),i=[0,0,0,0]),j[2]=f)):"tableCellDivider"===p.type&&(g?g=!1:(0!==i[1]&&(j[0]=j[1],e=Pc(n,b,i,h,void 0,e)),j=[(i=j)[1],f,0,0])):"tableHead"===p.type?(k=!0,l=f):"tableRow"===p.type||"tableDelimiterRow"===p.type?(l=f,0!==i[1]?(j[0]=j[1],e=Pc(n,b,i,h,f,e)):0!==j[1]&&(e=Pc(n,b,j,h,f,e)),h=0):h&&("data"===p.type||"tableDelimiterMarker"===p.type||"tableDelimiterFiller"===p.type)&&(j[3]=f)}for(0!==l&&Pd(n,b,l,c,d),n.consume(b.events),f=-1;++f<b.events.length;){let a=b.events[f];"enter"===a[0]&&"table"===a[1].type&&(a[1]._align=function(a,b){let c=!1,d=[];for(;b<a.length;){let e=a[b];if(c){if("enter"===e[0])"tableContent"===e[1].type&&d.push("tableDelimiterMarker"===a[b+1][1].type?"left":"none");else if("tableContent"===e[1].type){if("tableDelimiterMarker"===a[b-1][1].type){let a=d.length-1;d[a]="left"===d[a]?"center":"right"}}else if("tableDelimiterRow"===e[1].type)break}else"enter"===e[0]&&"tableDelimiterRow"===e[1].type&&(c=!0);b+=1}return d}(b.events,f))}return a}function Pc(a,b,c,d,e,f){0!==c[0]&&(f.end=Object.assign({},Pe(b.events,c[0])),a.add(c[0],0,[["exit",f,b]]));let g=Pe(b.events,c[1]);if(f={type:1===d?"tableHeader":2===d?"tableDelimiter":"tableData",start:Object.assign({},g),end:Object.assign({},g)},a.add(c[1],0,[["enter",f,b]]),0!==c[2]){let e=Pe(b.events,c[2]),f=Pe(b.events,c[3]),g={type:"tableContent",start:Object.assign({},e),end:Object.assign({},f)};if(a.add(c[2],0,[["enter",g,b]]),2!==d){let d=b.events[c[2]],e=b.events[c[3]];if(d[1].end=Object.assign({},e[1].end),d[1].type="chunkText",d[1].contentType="text",c[3]>c[2]+1){let b=c[2]+1,d=c[3]-c[2]-1;a.add(b,d,[])}}a.add(c[3]+1,0,[["exit",g,b]])}return void 0!==e&&(f.end=Object.assign({},Pe(b.events,e)),a.add(e,0,[["exit",f,b]]),f=void 0),f}function Pd(a,b,c,d,e){let f=[],g=Pe(b.events,c);e&&(e.end=Object.assign({},g),f.push(["exit",e,b])),d.end=Object.assign({},g),f.push(["exit",d,b]),a.add(c+1,0,f)}function Pe(a,b){let c=a[b],d="enter"===c[0]?"start":"end";return c[1][d]}function Pf(a){return -2===a||-1===a||32===a}function Pg(a){return function(b){return null!==b&&b>-1&&a.test(String.fromCharCode(b))}}Pg(/[A-Za-z]/),Pg(/[\dA-Za-z]/),Pg(/[#-'*+\--9=?A-Z^-~]/),Pg(/\d/),Pg(/[\dA-Fa-f]/),Pg(/[!-/:-@[-`{-~]/),Pg(/\p{P}|\p{S}/u),Pg(/\s/);let Ph={name:"tasklistCheck",tokenize:function(a,b,c){let d=this;return function(b){return null===d.previous&&d._gfmTasklistFirstContentOfListItem?(a.enter("taskListCheck"),a.enter("taskListCheckMarker"),a.consume(b),a.exit("taskListCheckMarker"),e):c(b)};function e(b){return null!==b&&(b<0||32===b)?(a.enter("taskListCheckValueUnchecked"),a.consume(b),a.exit("taskListCheckValueUnchecked"),f):88===b||120===b?(a.enter("taskListCheckValueChecked"),a.consume(b),a.exit("taskListCheckValueChecked"),f):c(b)}function f(b){return 93===b?(a.enter("taskListCheckMarker"),a.consume(b),a.exit("taskListCheckMarker"),a.exit("taskListCheck"),g):c(b)}function g(d){return null!==d&&d<-2?b(d):Pf(d)?a.check({tokenize:Pi},b,c)(d):c(d)}}};function Pi(a,b,c){var d,e;let f,g;return d=function(a){return null===a?c(a):b(a)},e="whitespace",f=1/0,g=0,function(b){return Pf(b)?(a.enter(e),function b(c){return Pf(c)&&g++<f?(a.consume(c),b):(a.exit(e),d(c))}(b)):d(b)}}let Pj={};function Pk(a){let b,c,d,e=a||Pj,f=this.data(),g=f.micromarkExtensions||(f.micromarkExtensions=[]),h=f.fromMarkdownExtensions||(f.fromMarkdownExtensions=[]),i=f.toMarkdownExtensions||(f.toMarkdownExtensions=[]);g.push(Ly([{text:OO},{document:{91:{name:"gfmFootnoteDefinition",tokenize:O1,continuation:{tokenize:O2},exit:O3}},text:{91:{name:"gfmFootnoteCall",tokenize:O0},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:O$,resolveTo:O_}}},(b=(e||{}).singleTilde,c={name:"strikethrough",tokenize:function(a,c,d){let e=this.previous,f=this.events,g=0;return function(h){return 126===e&&"characterEscape"!==f[f.length-1][1].type?d(h):(a.enter("strikethroughSequenceTemporary"),function f(h){let i=L5(e);if(126===h)return g>1?d(h):(a.consume(h),g++,f);if(g<2&&!b)return d(h);let j=a.exit("strikethroughSequenceTemporary"),k=L5(h);return j._open=!k||2===k&&!!i,j._close=!i||2===i&&!!k,c(h)}(h))}},resolveAll:function(a,b){let c=-1;for(;++c<a.length;)if("enter"===a[c][0]&&"strikethroughSequenceTemporary"===a[c][1].type&&a[c][1]._close){let d=c;for(;d--;)if("exit"===a[d][0]&&"strikethroughSequenceTemporary"===a[d][1].type&&a[d][1]._open&&a[c][1].end.offset-a[c][1].start.offset==a[d][1].end.offset-a[d][1].start.offset){a[c][1].type="strikethroughSequence",a[d][1].type="strikethroughSequence";let e={type:"strikethrough",start:Object.assign({},a[d][1].start),end:Object.assign({},a[c][1].end)},f={type:"strikethroughText",start:Object.assign({},a[d][1].end),end:Object.assign({},a[c][1].start)},g=[["enter",e,b],["enter",a[d][1],b],["exit",a[d][1],b],["enter",f,b]],h=b.parser.constructs.insideSpan.null;h&&Lv(g,g.length,0,L6(h,a.slice(d+1,c),b)),Lv(g,g.length,0,[["exit",f,b],["enter",a[c][1],b],["exit",a[c][1],b],["exit",e,b]]),Lv(a,d-1,c-d+3,g),c=d+g.length-2;break}}for(c=-1;++c<a.length;)"strikethroughSequenceTemporary"===a[c][1].type&&(a[c][1].type="data");return a}},null==b&&(b=!0),{text:{126:c},insideSpan:{null:[c]},attentionMarkers:{null:[126]}}),{flow:{null:{name:"table",tokenize:Pa,resolveAll:Pb}}},{text:{91:Ph}}])),h.push([{transforms:[N3],enter:{literalAutolink:NZ,literalAutolinkEmail:N$,literalAutolinkHttp:N$,literalAutolinkWww:N$},exit:{literalAutolink:N2,literalAutolinkEmail:N1,literalAutolinkHttp:N_,literalAutolinkWww:N0}},{enter:{gfmFootnoteCallString:N7,gfmFootnoteCall:N8,gfmFootnoteDefinitionLabelString:N9,gfmFootnoteDefinition:Oa},exit:{gfmFootnoteCallString:Ob,gfmFootnoteCall:Oc,gfmFootnoteDefinitionLabelString:Od,gfmFootnoteDefinition:Oe}},{canContainEols:["delete"],enter:{strikethrough:Oj},exit:{strikethrough:Ok}},{enter:{table:Oq,tableData:Ou,tableHeader:Ou,tableRow:Os},exit:{codeText:Ov,table:Or,tableData:Ot,tableHeader:Ot,tableRow:Ot}},{exit:{taskListCheckValueChecked:Ox,taskListCheckValueUnchecked:Ox,paragraph:Oy}}]),i.push({extensions:[{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:NX,notInConstruct:NY},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:NX,notInConstruct:NY},{character:":",before:"[ps]",after:"\\/",inConstruct:NX,notInConstruct:NY}]},(d=!1,e&&e.firstLineBlank&&(d=!0),{handlers:{footnoteDefinition:function(a,b,c,e){let f=c.createTracker(e),g=f.move("[^"),h=c.enter("footnoteDefinition"),i=c.enter("label");return g+=f.move(c.safe(c.associationId(a),{before:g,after:"]"})),i(),g+=f.move("]:"),a.children&&a.children.length>0&&(f.shift(4),g+=f.move((d?"\n":" ")+c.indentLines(c.containerFlow(a,f.current()),d?Oh:Og))),h(),g},footnoteReference:Of},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]}),{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:Oi}],handlers:{delete:Ol}},function(a){let b=a||{},c=b.tableCellPadding,d=b.tablePipeAlign,e=b.stringLength,f=c?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:"\n",inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:function(a,b,c){let d=Oo(a,b,c);return c.stack.includes("tableCell")&&(d=d.replace(/\|/g,"\\$&")),d},table:function(a,b,c,d){return h(function(a,b,c){let d=a.children,e=-1,f=[],g=b.enter("table");for(;++e<d.length;)f[e]=i(d[e],b,c);return g(),f}(a,c,d),a.align)},tableCell:g,tableRow:function(a,b,c,d){let e=h([i(a,c,d)]);return e.slice(0,e.indexOf("\n"))}}};function g(a,b,c,d){let e=c.enter("tableCell"),g=c.enter("phrasing"),h=c.containerPhrasing(a,{...d,before:f,after:f});return g(),e(),h}function h(a,b){return function(a,b){let c=b||{},d=(c.align||[]).concat(),e=c.stringLength||Om,f=[],g=[],h=[],i=[],j=0,k=-1;for(;++k<a.length;){let b=[],d=[],f=-1;for(a[k].length>j&&(j=a[k].length);++f<a[k].length;){var l;let g=null==(l=a[k][f])?"":String(l);if(!1!==c.alignDelimiters){let a=e(g);d[f]=a,(void 0===i[f]||a>i[f])&&(i[f]=a)}b.push(g)}g[k]=b,h[k]=d}let n=-1;if("object"==typeof d&&"length"in d)for(;++n<j;)f[n]=On(d[n]);else{let a=On(d);for(;++n<j;)f[n]=a}n=-1;let o=[],p=[];for(;++n<j;){let a=f[n],b="",d="";99===a?(b=":",d=":"):108===a?b=":":114===a&&(d=":");let e=!1===c.alignDelimiters?1:Math.max(1,i[n]-b.length-d.length),g=b+"-".repeat(e)+d;!1!==c.alignDelimiters&&((e=b.length+e+d.length)>i[n]&&(i[n]=e),p[n]=e),o[n]=g}g.splice(1,0,o),h.splice(1,0,p),k=-1;let q=[];for(;++k<g.length;){let a=g[k],b=h[k];n=-1;let d=[];for(;++n<j;){let e=a[n]||"",g="",h="";if(!1!==c.alignDelimiters){let a=i[n]-(b[n]||0),c=f[n];114===c?g=" ".repeat(a):99===c?a%2?(g=" ".repeat(a/2+.5),h=" ".repeat(a/2-.5)):h=g=" ".repeat(a/2):h=" ".repeat(a)}!1===c.delimiterStart||n||d.push("|"),!1!==c.padding&&(!1!==c.alignDelimiters||""!==e)&&(!1!==c.delimiterStart||n)&&d.push(" "),!1!==c.alignDelimiters&&d.push(g),d.push(e),!1!==c.alignDelimiters&&d.push(h),!1!==c.padding&&d.push(" "),(!1!==c.delimiterEnd||n!==j-1)&&d.push("|")}q.push(!1===c.delimiterEnd?d.join("").replace(/ +$/,""):d.join(""))}return q.join("\n")}(a,{align:b,alignDelimiters:d,padding:c,stringLength:e})}function i(a,b,c){let d=a.children,e=-1,f=[],h=b.enter("tableRow");for(;++e<d.length;)f[e]=g(d[e],a,b,c);return h(),f}}(e),{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:Oz}}]})}let Pl=/^\s*\|.*\|\s*$/,Pm=/^\s*\|?\s*:?-+:?\s*(\|\s*:?-+:?\s*)+\|?\s*$/;function Pn({children:a,className:b}){return(0,B.jsx)("div",{className:(0,S.cn)("text-[13px] leading-6 text-foreground/90 space-y-2 [&>:first-child]:mt-0",b),children:(0,B.jsx)(NR,{remarkPlugins:[Pk],components:{h1:a=>(0,B.jsx)("div",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground mt-4 mb-1",...a}),h2:a=>(0,B.jsx)("div",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground mt-4 mb-1",...a}),h3:a=>(0,B.jsx)("div",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground mt-3 mb-1",...a}),h4:a=>(0,B.jsx)("div",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground mt-3 mb-1",...a}),p:a=>(0,B.jsx)("p",{className:"my-1.5",...a}),ul:a=>(0,B.jsx)("ul",{className:"list-disc pl-5 my-1.5 space-y-0.5",...a}),ol:a=>(0,B.jsx)("ol",{className:"list-decimal pl-5 my-1.5 space-y-0.5",...a}),li:a=>(0,B.jsx)("li",{className:"leading-6",...a}),strong:a=>(0,B.jsx)("strong",{className:"font-semibold text-foreground",...a}),code:a=>(0,B.jsx)("code",{className:"text-[12px] font-mono bg-muted/70 px-1 py-0.5 rounded",...a}),a:a=>(0,B.jsx)("a",{className:"text-primary underline",...a}),table:a=>(0,B.jsx)("div",{className:"overflow-x-auto my-3 rounded-md border border-border",children:(0,B.jsx)("table",{className:"text-[12px] w-full border-collapse",...a})}),thead:a=>(0,B.jsx)("thead",{className:"bg-muted/60",...a}),th:a=>(0,B.jsx)("th",{className:"text-left font-semibold px-3 py-1.5 border-b border-border whitespace-nowrap",...a}),td:a=>(0,B.jsx)("td",{className:"px-3 py-1.5 border-b border-border/40 align-top [tr:last-child_&]:border-b-0",...a}),hr:a=>(0,B.jsx)("hr",{className:"my-3 border-border/60",...a}),blockquote:a=>(0,B.jsx)("blockquote",{className:"border-l-2 border-border/60 pl-3 my-2 text-muted-foreground italic",...a})},children:function(a){let b=a.split("\n"),c=[],d=0;for(;d<b.length;){let a=b[d],e=b[d+1];if(a&&e&&Pl.test(a)&&Pm.test(e)){for(c.length>0&&""!==c[c.length-1].trim()&&c.push("");d<b.length&&Pl.test(b[d]);)c.push(b[d].replace(/^\s+/,"")),d++;d<b.length&&""!==b[d].trim()&&c.push("");continue}c.push(a),d++}return c.join("\n")}(a)})})}var Po=a.i(28094),bc=bc;function Pp({directiveId:a,onClose:b}){let c,d=(0,E.useTranslations)("directiveDetailModal"),{currentBank:e}=(0,H.useBank)(),[f,g]=(0,C.useState)(null),[h,i]=(0,C.useState)(!1),[j,k]=(0,C.useState)(null);(0,C.useEffect)(()=>{a&&e&&(async()=>{i(!0),k(null),g(null);try{let b=await V.client.getDirective(e,a);g(b)}catch(a){console.error("Error loading directive:",a),k(a.message)}finally{i(!1)}})()},[a,e]);let l=null!==a;return(0,B.jsx)(bf.Dialog,{open:l,onOpenChange:a=>!a&&b(),children:(0,B.jsxs)(bf.DialogContent,{className:"max-w-2xl max-h-[80vh] overflow-hidden flex flex-col p-6",children:[(0,B.jsx)(Po.VisuallyHidden,{children:(0,B.jsx)(bf.DialogTitle,{children:d("title")})}),h?(0,B.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,B.jsx)(bc.default,{className:"w-8 h-8 animate-spin text-muted-foreground"})}):j?(0,B.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,B.jsx)("div",{className:"text-center text-destructive",children:(0,B.jsx)("div",{className:"text-sm",children:d("errorPrefix",{error:j})})})}):f?(0,B.jsxs)("div",{className:"flex-1 overflow-y-auto space-y-6",children:[(0,B.jsxs)("div",{className:"pb-5 border-b border-border",children:[(0,B.jsxs)("div",{className:"flex items-center gap-2",children:[(0,B.jsx)("h3",{className:"text-xl font-bold text-foreground",children:f.name}),!f.is_active&&(0,B.jsx)("span",{className:"px-2 py-0.5 rounded-full bg-red-500/10 text-red-600 dark:text-red-400 text-xs font-medium",children:d("inactive")})]}),(0,B.jsx)("code",{className:"text-xs font-mono text-muted-foreground/70",children:f.id})]}),(0,B.jsxs)("div",{className:"flex gap-8",children:[(0,B.jsxs)("div",{children:[(0,B.jsx)("div",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-1",children:d("created")}),(0,B.jsx)("div",{className:"text-sm text-foreground",children:(c=new Date(f.created_at),`${c.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})} at ${c.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!1})}`)})]}),(0,B.jsxs)("div",{children:[(0,B.jsx)("div",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-1",children:d("priority")}),(0,B.jsx)("div",{className:"text-sm text-foreground",children:f.priority})]})]}),(0,B.jsxs)("div",{children:[(0,B.jsx)("div",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-3",children:d("content")}),(0,B.jsx)("div",{className:"prose prose-base dark:prose-invert max-w-none",children:(0,B.jsx)(NR,{remarkPlugins:[Pk],children:f.content})})]}),f.tags&&f.tags.length>0&&(0,B.jsxs)("div",{children:[(0,B.jsx)("div",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-3",children:d("tags")}),(0,B.jsx)("div",{className:"flex flex-wrap gap-1.5",children:f.tags.map((a,b)=>(0,B.jsx)("span",{className:"px-2 py-0.5 bg-purple-500/10 text-purple-600 dark:text-purple-400 rounded text-xs",children:a},b))})]})]}):null]})})}function Pq(a){let b=new Date(a).getTime(),c=Math.round((Date.now()-b)/1e3);if(60>Math.abs(c))return c>=0?"just now":"in a moment";let d=c,e="second";for(let[a,b]of[[60,"second"],[60,"minute"],[24,"hour"],[7,"day"],[4.345,"week"],[12,"month"],[1/0,"year"]]){if(Math.abs(d)<a)break;d/=a,e=b}return new Intl.RelativeTimeFormat("en",{numeric:"auto"}).format(-Math.round(d),e)}function Pr(a){let b=new Date(a);return`${b.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})} at ${b.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!1})}`}var Ps=a.i(5500);let Pt={light:{body:"#1a1a1a",removedLineBg:"#ffeef0",addedLineBg:"#e6ffec",removedWordBg:"#fdb8c0",removedWordText:"#67060c",addedWordBg:"#acf2bc",addedWordText:"#0a3622"},dark:{body:"#e6edf3",removedLineBg:"#3d1419",addedLineBg:"#0d2818",removedWordBg:"#7d2530",removedWordText:"#ffd0d6",addedWordBg:"#1a4d2c",addedWordText:"#b8e6c1"}};function Pu(a,b){return"directives"===a?{label:b?b("factTypeDirective"):"directive",color:"bg-purple-500/10 text-purple-600 dark:text-purple-400"}:"mental-models"===a?{label:b?b("factTypeMentalModel"):"mental model",color:"bg-indigo-500/10 text-indigo-600 dark:text-indigo-400"}:"world"===a?{label:b?b("factTypeWorld"):"world",color:"bg-blue-500/10 text-blue-600 dark:text-blue-400"}:"experience"===a?{label:b?b("factTypeExperience"):"experience",color:"bg-green-500/10 text-green-600 dark:text-green-400"}:"observation"===a?{label:b?b("factTypeObservation"):"observation",color:"bg-amber-500/10 text-amber-600 dark:text-amber-400"}:{label:a,color:"bg-slate-500/10 text-slate-600 dark:text-slate-400"}}let Pv=["observation","experience","world","directives","mental-models"];function Pw({based_on:a,onViewMemory:b,onViewDirective:c}){let d=(0,E.useTranslations)("mentalModelDetailModal"),e=(0,C.useMemo)(()=>{if(!a)return[];let b=Object.entries(a).map(([a,b])=>({factType:a,facts:b??[]})).filter(a=>a.facts.length>0);return b.sort((a,b)=>{let c=Pv.indexOf(a.factType),d=Pv.indexOf(b.factType);return(-1===c?999:c)-(-1===d?999:d)}),b},[a]);return 0===e.length?(0,B.jsx)("p",{className:"text-sm text-muted-foreground italic",children:d("noBasedOnData")}):(0,B.jsx)("div",{className:"space-y-4",children:e.map(a=>{let e=Pu(a.factType,d);return(0,B.jsxs)("div",{className:"rounded-lg border border-border/60 overflow-hidden",children:[(0,B.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 bg-muted/40 border-b border-border/60",children:[(0,B.jsx)("span",{className:`px-2 py-0.5 rounded text-[10px] font-semibold uppercase tracking-wide ${e.color}`,children:e.label}),(0,B.jsx)("span",{className:"text-xs text-muted-foreground",children:a.facts.length})]}),(0,B.jsx)("ul",{className:"divide-y divide-border/50",children:a.facts.map((e,f)=>{let g="directives"===a.factType&&!!c||"directives"!==a.factType&&"mental-models"!==a.factType&&!!b;return(0,B.jsxs)("li",{className:"group flex items-start gap-3 px-3 py-2 hover:bg-muted/30",children:[(0,B.jsxs)("p",{className:"text-sm text-foreground leading-relaxed flex-1 min-w-0",children:[e.text,e.context&&(0,B.jsx)("span",{className:"block text-xs text-muted-foreground italic mt-0.5",children:e.context})]}),g&&(0,B.jsx)("button",{className:"text-xs text-muted-foreground hover:text-foreground opacity-0 group-hover:opacity-100 transition-opacity shrink-0 mt-0.5",onClick:()=>{"directives"===a.factType?c?.(e.id):b?.(e.id)},children:d("viewArrow")})]},e.id||f)})})]},a.factType)})})}function Px(a){return a.match(/\s+|[A-Za-z0-9_]+|[^\s\w]/g)||[]}function Py(a){return/^\s+$/.test(a)?" ":a}function Pz(a,b,c){let d={backgroundColor:c.removedWordBg,color:c.removedWordText,fontWeight:600,borderRadius:"2px"},e={backgroundColor:c.addedWordBg,color:c.addedWordText,fontWeight:600,borderRadius:"2px"};return a.map((a,c)=>"same"===a.type?(0,B.jsx)("span",{children:a.text},c):(0,B.jsx)("span",{style:"left"===b?d:e,children:a.text},c))}function PA({before:a,after:b}){let c=(0,E.useTranslations)("mentalModelDetailModal"),{theme:d}=(0,Ps.useTheme)(),e=Pt[d],{left:f,right:g}=function(a,b){let c=a.split("\n"),d=b.split("\n"),e=c.length,f=d.length,g=Array.from({length:e+1},()=>Array(f+1).fill(0));for(let a=1;a<=e;a++)for(let b=1;b<=f;b++)g[a][b]=c[a-1]===d[b-1]?g[a-1][b-1]+1:Math.max(g[a-1][b],g[a][b-1]);let h=[],i=e,j=f;for(;i>0||j>0;)i>0&&j>0&&c[i-1]===d[j-1]?(h.push({type:"same",text:c[i-1]}),i--,j--):j>0&&(0===i||g[i][j-1]>=g[i-1][j])?(h.push({type:"added",text:d[j-1]}),j--):(h.push({type:"removed",text:c[i-1]}),i--);h.reverse();let k=[],l=[],n=0;for(;n<h.length;){let a=h[n];if("same"===a.type){k.push({type:"same",spans:[{type:"same",text:a.text}]}),l.push({type:"same",spans:[{type:"same",text:a.text}]}),n++;continue}let b=[],c=[];for(;n<h.length&&"same"!==h[n].type;)"removed"===h[n].type?b.push(h[n].text):c.push(h[n].text),n++;let d=Math.max(b.length,c.length);for(let a=0;a<d;a++){let d=a<b.length?b[a]:null,e=a<c.length?c[a]:null;if(null!==d&&null!==e){let a=function(a,b){let c=Px(a),d=Px(b),e=c.length,f=d.length,g=Array.from({length:e+1},()=>Array(f+1).fill(0));for(let a=1;a<=e;a++)for(let b=1;b<=f;b++)g[a][b]=Py(c[a-1])===Py(d[b-1])?g[a-1][b-1]+1:Math.max(g[a-1][b],g[a][b-1]);let h=[],i=[],j=e,k=f,l=[],n=[];for(;j>0||k>0;)if(j>0&&k>0&&Py(c[j-1])===Py(d[k-1]))l.push({type:"same",text:c[j-1]}),n.push({type:"same",text:d[k-1]}),j--,k--;else if(k>0&&(0===j||g[j][k-1]>=g[j-1][k])){let a=d[k-1];n.push({type:/^\s+$/.test(a)?"same":"added",text:a}),k--}else{let a=c[j-1];l.push({type:/^\s+$/.test(a)?"same":"removed",text:a}),j--}for(;l.length;)h.push(l.pop());for(;n.length;)i.push(n.pop());return{left:h,right:i}}(d,e),b=a.left.some(a=>"same"!==a.type)?"removed":"same",c=a.right.some(a=>"same"!==a.type)?"added":"same";k.push({type:b,spans:a.left}),l.push({type:c,spans:a.right})}else null!==d?(k.push({type:"removed",spans:[{type:"removed",text:d}]}),l.push({type:"same",spans:[{type:"same",text:""}]})):null!==e&&(k.push({type:"same",spans:[{type:"same",text:""}]}),l.push({type:"added",spans:[{type:"added",text:e}]}))}}return{left:k,right:l}}(a,b);return f.some(a=>"same"!==a.type)||g.some(a=>"same"!==a.type)?(0,B.jsxs)("div",{className:"grid grid-cols-2 divide-x divide-border border border-border rounded-md overflow-hidden text-[13px] font-mono",style:{color:e.body},children:[(0,B.jsxs)("div",{children:[(0,B.jsx)("div",{className:"px-3 py-1.5 bg-muted text-foreground font-sans font-semibold text-xs uppercase tracking-wide border-b border-border",children:c("diffBefore")}),f.map((a,b)=>(0,B.jsx)("div",{className:"px-3 py-0.5 whitespace-pre-wrap leading-5 min-h-[1.25rem]",style:"removed"===a.type?{backgroundColor:e.removedLineBg}:void 0,children:Pz(a.spans,"left",e)},b))]}),(0,B.jsxs)("div",{children:[(0,B.jsx)("div",{className:"px-3 py-1.5 bg-muted text-foreground font-sans font-semibold text-xs uppercase tracking-wide border-b border-border",children:c("diffAfter")}),g.map((a,b)=>(0,B.jsx)("div",{className:"px-3 py-0.5 whitespace-pre-wrap leading-5 min-h-[1.25rem]",style:"added"===a.type?{backgroundColor:e.addedLineBg}:void 0,children:Pz(a.spans,"right",e)},b))]})]}):(0,B.jsx)("span",{className:"text-sm text-muted-foreground italic",children:c("unchanged")})}function PB({before:a,after:b,onViewMemory:c,onViewDirective:d}){let e=(0,E.useTranslations)("mentalModelDetailModal"),f=(0,C.useMemo)(()=>{let c=new Set([...Object.keys(a??{}),...Object.keys(b??{})]),d=[];for(let e of c){let c=(a?.[e]??[]).filter(Boolean),f=(b?.[e]??[]).filter(Boolean),g=new Set(c.map(a=>a.id)),h=new Set(f.map(a=>a.id)),i=f.filter(a=>!g.has(a.id)),j=c.filter(a=>!h.has(a.id)),k=f.filter(a=>g.has(a.id));(0!==i.length||0!==j.length||0!==k.length)&&d.push({factType:e,added:i,removed:j,kept:k})}return d.sort((a,b)=>{let c=Pv.indexOf(a.factType),d=Pv.indexOf(b.factType);return(-1===c?999:c)-(-1===d?999:d)}),d},[a,b]);if(0===f.length)return(0,B.jsx)("p",{className:"text-sm text-muted-foreground italic",children:e("noBasedOnData")});let g=(a,b,f)=>(0,B.jsxs)("li",{className:`group flex items-start gap-2 px-3 py-2 ${"added"===f?"bg-green-500/15 dark:bg-green-500/10 border-l-2 border-green-600 dark:border-green-500 text-green-950 dark:text-green-100":"removed"===f?"bg-red-500/15 dark:bg-red-500/10 border-l-2 border-red-600 dark:border-red-500 text-red-950 dark:text-red-200 line-through decoration-red-700/70 dark:decoration-red-400/70":""}`,children:[(0,B.jsx)("span",{className:`font-mono text-sm shrink-0 ${"added"===f?"text-green-700 dark:text-green-400":"removed"===f?"text-red-700 dark:text-red-400":"text-muted-foreground/40"}`,children:"added"===f?"+":"removed"===f?"−":" "}),(0,B.jsxs)("p",{className:"text-sm leading-relaxed flex-1 min-w-0",children:[a.text,a.context&&(0,B.jsx)("span",{className:"block text-xs text-muted-foreground italic mt-0.5 no-underline",children:a.context})]}),("directives"===b&&!!d||"directives"!==b&&"mental-models"!==b&&!!c)&&"removed"!==f&&(0,B.jsx)("button",{className:"text-xs text-muted-foreground hover:text-foreground opacity-0 group-hover:opacity-100 transition-opacity shrink-0 mt-0.5",onClick:()=>{"directives"===b?d(a.id):c(a.id)},children:e("viewArrow")})]},`${f}-${a.id}`);return(0,B.jsx)("div",{className:"space-y-4",children:f.map(a=>{let b=Pu(a.factType,e);return(0,B.jsxs)("div",{className:"rounded-lg border border-border/60 overflow-hidden",children:[(0,B.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 bg-muted/40 border-b border-border/60",children:[(0,B.jsx)("span",{className:`px-2 py-0.5 rounded text-[10px] font-semibold uppercase tracking-wide ${b.color}`,children:b.label}),a.added.length>0&&(0,B.jsxs)("span",{className:"text-xs text-green-600 dark:text-green-400",children:["+",a.added.length]}),a.removed.length>0&&(0,B.jsxs)("span",{className:"text-xs text-red-600 dark:text-red-400",children:["−",a.removed.length]}),a.kept.length>0&&(0,B.jsx)("span",{className:"text-xs text-muted-foreground",children:e("keptCount",{count:a.kept.length})})]}),(0,B.jsxs)("ul",{className:"divide-y divide-border/40",children:[a.added.map(b=>g(b,a.factType,"added")),a.removed.map(b=>g(b,a.factType,"removed")),a.kept.map(b=>g(b,a.factType,"kept"))]})]},a.factType)})})}function PC({history:a,currentContent:b,currentBasedOn:c,onViewMemory:d,onViewDirective:e}){let f=(0,E.useTranslations)("mentalModelDetailModal"),[g,h]=(0,C.useState)(0),i=a[g],j=0===g?b:a[g-1].previous_content??"",k=i.previous_reflect_response?.based_on,l=0===g?c:a[g-1].previous_reflect_response?.based_on,n=i.previous_reflect_response??null;return(0,B.jsxs)("div",{className:"space-y-4",children:[(0,B.jsxs)("div",{className:"flex items-center justify-between",children:[(0,B.jsxs)("span",{className:"text-xs text-muted-foreground",children:[(0,B.jsxs)("span",{className:"font-semibold text-foreground",children:["v",a.length-g]})," →"," ",(0,B.jsxs)("span",{className:"font-semibold text-foreground",children:["v",a.length-g+1,0===g?f("versionCurrent"):""]})," ","· ",f("changedAt",{date:new Date(i.changed_at).toLocaleString()})]}),(0,B.jsxs)("div",{className:"flex items-center gap-1",children:[(0,B.jsx)(W.Button,{variant:"outline",size:"sm",className:"h-7 w-7 p-0",disabled:g===a.length-1,onClick:()=>h(g+1),children:(0,B.jsx)(P,{className:"h-3.5 w-3.5"})}),(0,B.jsx)(W.Button,{variant:"outline",size:"sm",className:"h-7 w-7 p-0",disabled:0===g,onClick:()=>h(g-1),children:(0,B.jsx)(Q.ChevronRight,{className:"h-3.5 w-3.5"})})]})]}),(0,B.jsxs)("div",{children:[(0,B.jsx)(PI,{children:f("contentDiff")}),null!==i.previous_content?(0,B.jsx)(PA,{before:i.previous_content,after:j}):(0,B.jsx)("div",{className:"border border-border rounded-lg p-3",children:(0,B.jsx)("span",{className:"text-sm text-muted-foreground italic",children:f("previousContentNotAvailable")})})]}),(0,B.jsxs)("div",{children:[(0,B.jsx)(PI,{children:f("basedOnDiff")}),n?.based_on?(0,B.jsx)(PB,{before:k,after:l,onViewMemory:d,onViewDirective:e}):(0,B.jsx)("p",{className:"text-sm text-muted-foreground italic",children:f("basedOnNotCaptured")})]})]})}function PD({mentalModelId:a,onClose:b,onEdit:c,onDelete:d,onClear:e,onRefreshed:f,initialTab:g="content"}){let h=(0,E.useTranslations)("mentalModelDetailModal"),{currentBank:i}=(0,H.useBank)(),[j,k]=(0,C.useState)(null),[l,n]=(0,C.useState)(!1),[o,p]=(0,C.useState)(null),[q,r]=(0,C.useState)(g),[s,t]=(0,C.useState)(!1),[u,v]=(0,C.useState)(!1),[w,x]=(0,C.useState)(null),[y,z]=(0,C.useState)(null),[A,D]=(0,C.useState)(null),[G,I]=(0,C.useState)(!1);(0,C.useEffect)(()=>{a&&i&&(async()=>{n(!0),p(null),k(null),D(null),r(g);try{let b=await V.client.getMentalModel(i,a);k(b)}catch(a){console.error("Error loading mental model:",a),p(a.message)}finally{n(!1)}})()},[a,i,g]),(0,C.useEffect)(()=>{"history"===q&&j&&i&&null===A&&(async()=>{I(!0);try{let a=await V.client.getMentalModelHistory(i,j.id);D(a)}catch(a){console.error("Error loading mental model history:",a),D([])}finally{I(!1)}})()},[q,j,i,A]);let J=async()=>{if(i&&j){v(!0);try{let a=await V.client.getMentalModel(i,j.id);k(a),D(null)}catch(a){console.error("Error reloading mental model:",a)}finally{v(!1)}}},K=async()=>{if(!i||!j)return;t(!0);let a=j.last_refreshed_at;try{await V.client.refreshMentalModel(i,j.id);let b=0,c=async()=>{b++;try{let d=await V.client.getMentalModel(i,j.id);if(d.last_refreshed_at!==a){k(d),D(null),f?.(d),t(!1);return}if(b>=120){t(!1),F.toast.error(h("refreshTimeoutTitle"),{description:h("refreshTimeoutDescription")});return}setTimeout(c,1e3)}catch(a){console.error("Error polling mental model:",a),t(!1)}};setTimeout(c,1e3)}catch{t(!1)}},L=null!==a,M=j?.reflect_response?.based_on,O=M?Object.values(M).reduce((a,b)=>a+(b?.length??0),0):0;return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(bf.Dialog,{open:L,onOpenChange:a=>!a&&b(),children:(0,B.jsxs)(bf.DialogContent,{className:"w-[95vw] max-w-[95vw] h-[92vh] sm:max-w-[95vw] flex flex-col overflow-hidden",children:[(0,B.jsx)(bf.DialogHeader,{className:"pr-10",children:(0,B.jsxs)(bf.DialogTitle,{className:"flex items-center gap-2",children:[(0,B.jsx)("span",{className:"truncate",children:j?.name??h("mentalModelFallback")}),j&&(0,B.jsx)(W.Button,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 shrink-0",onClick:J,disabled:u,title:h("reloadData"),children:(0,B.jsx)(ad,{className:`h-3.5 w-3.5 ${u?"animate-spin":""}`})}),j?.trigger?.refresh_after_consolidation&&(0,B.jsxs)("span",{className:"flex items-center gap-1 px-2 py-0.5 rounded-full bg-green-500/10 text-green-600 dark:text-green-400 text-xs font-medium",children:[(0,B.jsx)(Kp,{className:"w-3 h-3"}),h("autoRefresh")]})]})}),l?(0,B.jsx)("div",{className:"flex items-center justify-center flex-1",children:(0,B.jsx)(bc.default,{className:"w-8 h-8 animate-spin text-muted-foreground"})}):o?(0,B.jsx)("div",{className:"flex items-center justify-center flex-1",children:(0,B.jsx)("div",{className:"text-center text-destructive",children:(0,B.jsx)("div",{className:"text-sm",children:h("errorPrefix",{error:o})})})}):j?(0,B.jsxs)(bh.Tabs,{value:q,onValueChange:a=>r(a),className:"flex-1 flex flex-col overflow-hidden",children:[(0,B.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,B.jsxs)(bh.TabsList,{className:"grid grid-cols-3 w-full max-w-md",children:[(0,B.jsxs)(bh.TabsTrigger,{value:"content",className:"flex items-center gap-1.5",children:[(0,B.jsx)(N.FileText,{className:"w-3.5 h-3.5"}),h("tabContent")]}),(0,B.jsxs)(bh.TabsTrigger,{value:"configuration",className:"flex items-center gap-1.5",children:[(0,B.jsx)(R,{className:"w-3.5 h-3.5"}),h("tabConfiguration")]}),(0,B.jsxs)(bh.TabsTrigger,{value:"history",className:"flex items-center gap-1.5",children:[(0,B.jsx)(bd,{className:"w-3.5 h-3.5"}),h("tabHistory")]})]}),(0,B.jsxs)(IN.DropdownMenu,{children:[(0,B.jsx)(IN.DropdownMenuTrigger,{asChild:!0,children:(0,B.jsx)(W.Button,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 shrink-0",disabled:s,"aria-label":h("actionsAriaLabel"),children:(0,B.jsx)(Ji,{className:"h-4 w-4"})})}),(0,B.jsxs)(IN.DropdownMenuContent,{align:"end",children:[c&&(0,B.jsxs)(IN.DropdownMenuItem,{onClick:()=>c(j),children:[(0,B.jsx)(Jh,{className:"h-4 w-4 mr-2"}),h("actionEdit")]}),(0,B.jsxs)(IN.DropdownMenuItem,{onClick:K,disabled:s,children:[(0,B.jsx)(ad,{className:"h-4 w-4 mr-2"}),h("actionRefreshManually")]}),e&&(0,B.jsxs)(IN.DropdownMenuItem,{onClick:()=>e(j),children:[(0,B.jsx)(Kq,{className:"h-4 w-4 mr-2"}),h("actionClearContent")]}),d&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(IN.DropdownMenuSeparator,{}),(0,B.jsxs)(IN.DropdownMenuItem,{onClick:()=>d(j),className:"text-red-600 focus:text-red-600 dark:text-red-400 dark:focus:text-red-400 focus:bg-red-500/10",children:[(0,B.jsx)(Jg,{className:"h-4 w-4 mr-2"}),h("actionDelete")]})]})]})]})]}),(0,B.jsxs)("div",{className:"flex-1 overflow-y-auto mt-4",children:[(0,B.jsxs)(bh.TabsContent,{value:"content",className:"mt-0 space-y-6",children:[(0,B.jsxs)("div",{className:"rounded-lg border border-border bg-muted/30 overflow-hidden",children:[(0,B.jsxs)("div",{className:"flex items-center justify-between gap-2 px-4 py-2 border-b border-border bg-muted/50 text-xs text-muted-foreground",children:[(0,B.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,B.jsx)(N.FileText,{className:"w-3.5 h-3.5"}),(0,B.jsx)("span",{className:"font-semibold uppercase tracking-wide",children:h("storedContent")}),(0,B.jsxs)("span",{className:"text-muted-foreground/70",children:["· ",h("charsCount",{count:j.content.length})]})]}),(0,B.jsxs)("div",{className:"flex items-center gap-2",children:[!0===j.is_stale?(0,B.jsx)("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-semibold uppercase tracking-wide bg-amber-500/15 text-amber-700 dark:text-amber-400",title:h("staleTitle"),children:h("stale")}):!1===j.is_stale?(0,B.jsx)("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-semibold uppercase tracking-wide bg-green-500/15 text-green-700 dark:text-green-400",title:h("inSyncTitle"),children:h("inSync")}):null,(0,B.jsxs)("span",{title:Pr(j.last_refreshed_at),className:"flex items-center gap-1",children:[(0,B.jsx)(ad,{className:"w-3 h-3"}),h("lastRefreshed",{time:Pq(j.last_refreshed_at)})]})]})]}),(0,B.jsx)(Pn,{className:"p-4",children:j.content})]}),(0,B.jsxs)("div",{children:[(0,B.jsx)(PI,{children:O>0?h("basedOnWithCount",{count:O}):h("basedOn")}),j.reflect_response?(0,B.jsx)(Pw,{based_on:M,onViewMemory:a=>x(a),onViewDirective:a=>z(a)}):(0,B.jsx)("p",{className:"text-sm text-muted-foreground",children:h("noSourceData")})]})]}),(0,B.jsx)(bh.TabsContent,{value:"configuration",className:"mt-0",children:(0,B.jsx)(PH,{mentalModel:j})}),(0,B.jsx)(bh.TabsContent,{value:"history",className:"mt-0",children:G?(0,B.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,B.jsx)(bc.default,{className:"w-6 h-6 animate-spin text-muted-foreground"})}):A&&A.length>0?(0,B.jsx)(PC,{history:A,currentContent:j.content,currentBasedOn:M,onViewMemory:a=>x(a),onViewDirective:a=>z(a)}):(0,B.jsx)("p",{className:"text-sm text-muted-foreground italic",children:h("noHistory")})})]})]}):null]})}),w&&(0,B.jsx)(bo,{memoryId:w,onClose:()=>x(null)}),y&&(0,B.jsx)(Pp,{directiveId:y,onClose:()=>z(null)})]})}function PE({label:a,value:b}){return(0,B.jsxs)("div",{children:[(0,B.jsx)(PI,{children:a}),(0,B.jsx)("div",{className:"text-sm text-foreground",children:b})]})}function PF({title:a,icon:b,children:c}){return(0,B.jsxs)("div",{className:"rounded-lg border border-border bg-muted/20 overflow-hidden",children:[(0,B.jsxs)("div",{className:"flex items-center gap-1.5 px-4 py-2 border-b border-border bg-muted/40 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:[b,a]}),(0,B.jsx)("div",{className:"p-4 space-y-4",children:c})]})}function PG({label:a,color:b}){return(0,B.jsx)("span",{className:`px-2 py-0.5 rounded text-xs ${b??"bg-muted text-foreground border border-border/60"}`,children:a})}function PH({mentalModel:a}){let b=(0,E.useTranslations)("mentalModelDetailModal"),c=a.trigger??{refresh_after_consolidation:!1},d=c.fact_types??[],e=c.tag_groups??[],f=c.exclude_mental_model_ids??[];return(0,B.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,B.jsxs)(PF,{title:b("identityTitle"),icon:(0,B.jsx)(N.FileText,{className:"w-3.5 h-3.5"}),children:[(0,B.jsx)(PE,{label:b("labelId"),value:(0,B.jsx)("code",{className:"text-xs font-mono text-muted-foreground break-all",children:a.id})}),(0,B.jsx)(PE,{label:b("labelName"),value:a.name}),a.source_query&&(0,B.jsx)(PE,{label:b("labelSourceQuery"),value:(0,B.jsx)("pre",{className:"text-sm font-mono text-foreground bg-muted/30 border border-border/60 rounded p-2 leading-6 m-0",style:{whiteSpace:"pre-wrap",wordBreak:"break-word",fontFamily:"var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace)"},children:a.source_query})}),(0,B.jsx)(PE,{label:b("labelTags"),value:a.tags?.length>0?(0,B.jsx)("div",{className:"flex flex-wrap gap-1.5",children:a.tags.map(a=>(0,B.jsx)(PG,{label:a,color:"bg-amber-500/10 text-amber-600 dark:text-amber-400"},a))}):(0,B.jsx)("span",{className:"text-muted-foreground italic text-sm",children:b("noTags")})})]}),(0,B.jsxs)(PF,{title:b("timingTitle"),icon:(0,B.jsx)(ad,{className:"w-3.5 h-3.5"}),children:[(0,B.jsx)(PE,{label:b("labelCreated"),value:Pr(a.created_at)}),(0,B.jsx)(PE,{label:b("labelLastRefreshed"),value:(0,B.jsx)("span",{title:Pr(a.last_refreshed_at),children:Pq(a.last_refreshed_at)})}),(0,B.jsx)(PE,{label:b("labelMaxTokens"),value:a.max_tokens.toLocaleString()})]}),(0,B.jsxs)(PF,{title:b("refreshTriggerTitle"),icon:(0,B.jsx)(Kp,{className:"w-3.5 h-3.5"}),children:[(0,B.jsx)(PE,{label:b("labelRefreshMode"),value:"delta"===c.mode?(0,B.jsx)(PG,{label:b("pillDelta"),color:"bg-purple-500/10 text-purple-600 dark:text-purple-400"}):(0,B.jsx)(PG,{label:b("pillFull")})}),(0,B.jsx)(PE,{label:b("labelAutoRefreshAfterConsolidation"),value:c.refresh_after_consolidation?(0,B.jsx)(PG,{label:b("pillEnabled"),color:"bg-green-500/10 text-green-600 dark:text-green-400"}):(0,B.jsx)(PG,{label:b("pillDisabled")})}),(0,B.jsx)(PE,{label:b("labelFactTypes"),value:d.length>0?(0,B.jsx)("div",{className:"flex flex-wrap gap-1.5",children:d.map(a=>{let c=Pu(a,b);return(0,B.jsx)(PG,{label:c.label,color:c.color},a)})}):(0,B.jsx)("span",{className:"text-muted-foreground italic text-sm",children:b("factTypesAll")})}),(0,B.jsx)(PE,{label:b("labelExcludeMentalModels"),value:c.exclude_mental_models?b("valueYes"):b("valueNo")}),f.length>0&&(0,B.jsx)(PE,{label:b("labelExcludedIds"),value:(0,B.jsx)("div",{className:"flex flex-wrap gap-1.5",children:f.map(a=>(0,B.jsx)("code",{className:"text-xs font-mono px-1.5 py-0.5 rounded bg-muted border border-border/60",children:a},a))})})]}),(0,B.jsxs)(PF,{title:b("recallParamsTitle"),icon:(0,B.jsx)(R,{className:"w-3.5 h-3.5"}),children:[(0,B.jsx)(PE,{label:b("labelIncludeChunks"),value:null==c.include_chunks?b("includeChunksDefault"):c.include_chunks?b("valueYes"):b("valueNo")}),(0,B.jsx)(PE,{label:b("labelRecallMaxTokens"),value:null!=c.recall_max_tokens?c.recall_max_tokens.toLocaleString():b("recallMaxTokensDefault")}),(0,B.jsx)(PE,{label:b("labelRecallChunksMaxTokens"),value:null!=c.recall_chunks_max_tokens?c.recall_chunks_max_tokens.toLocaleString():b("recallChunksMaxTokensDefault")}),(0,B.jsx)(PE,{label:b("labelTagsMatch"),value:c.tags_match?(0,B.jsx)(PG,{label:c.tags_match}):b("tagsMatchDefault")})]}),e.length>0&&(0,B.jsx)("div",{className:"md:col-span-2",children:(0,B.jsx)(PF,{title:b("tagGroupsTitle"),icon:(0,B.jsx)(R,{className:"w-3.5 h-3.5"}),children:(0,B.jsx)("pre",{className:"text-xs font-mono bg-muted/40 rounded p-3 overflow-x-auto border border-border/60",children:JSON.stringify(e,null,2)})})})]})}function PI({children:a}){return(0,B.jsx)("div",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-2",children:a})}function PJ(){let a,b,c,d,e,f,g,h,i,j,k,l=(0,E.useTranslations)("thinkView"),{currentBank:n}=(0,H.useBank)(),[o,p]=(0,C.useState)(""),[q,r]=(0,C.useState)("mid"),[s,t]=(0,C.useState)(4096),[u,v]=(0,C.useState)(!0),[w,x]=(0,C.useState)(!0),[y,z]=(0,C.useState)("answer"),[A,D]=(0,C.useState)(null),[F,G]=(0,C.useState)(!1),[I,J]=(0,C.useState)(""),[K,N]=(0,C.useState)("any"),[O,P]=(0,C.useState)([]),[Q,R]=(0,C.useState)(!1),[S,T]=(0,C.useState)(""),[U,Y]=(0,C.useState)(""),[Z,$]=(0,C.useState)(!1),[_,aa]=(0,C.useState)(!1),[ab,ac]=(0,C.useState)(null),[ad,ae]=(0,C.useState)(null),[ag,ah]=(0,C.useState)(null),[ai,aj]=(0,C.useState)(!1),[ak,al]=(0,C.useState)(null),[am,an]=(0,C.useState)(null),[ao,ap]=(0,C.useState)(!1),[aq,ar]=(0,C.useState)(null),[as,at]=(0,C.useState)("world"),au="General Feedback",av=async a=>{if(al(a),an(null),n&&a?.id){ap(!0);try{let b=await V.client.listObservations(n),c=b.items?.find(b=>b.id===a.id);an(c||a)}catch(b){console.error("Failed to load observation:",b),an(a)}finally{ap(!1)}}},aw=async()=>{if(n&&U.trim()){$(!0);try{let a=await V.client.listDirectives(n),b=a.items?.find(a=>a.name===au);if(b){let a=b.content?`${b.content}
|
|
8
|
-
${U.trim()}`:U.trim();await V.client.updateDirective(n,b.id,{content:a})}else await V.client.createDirective(n,{name:au,content:U.trim()});Y(""),aa(!0),setTimeout(()=>aa(!1),3e3)}catch(a){}finally{$(!1)}}},ax=async()=>{if(n&&o){G(!0),z("answer");try{let a=I.split(",").map(a=>a.trim()).filter(a=>a.length>0),b=S.split(",").map(a=>a.trim()).filter(a=>a.length>0),c=await V.client.reflect({bank_id:n,query:o,budget:q,max_tokens:s,include_facts:u,include_tool_calls:w,...a.length>0&&{tags:a,tags_match:K},...O.length>0&&{fact_types:O},...Q&&{exclude_mental_models:!0},...b.length>0&&{exclude_mental_model_ids:b}});D(c)}catch(a){}finally{G(!1)}}};return n?(0,B.jsxs)("div",{className:"space-y-6",children:[(0,B.jsx)(bp.Card,{children:(0,B.jsxs)(bp.CardContent,{className:"pt-6",children:[(0,B.jsxs)("div",{className:"flex gap-3",children:[(0,B.jsxs)("div",{className:"flex-1 relative",children:[(0,B.jsx)(L,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),(0,B.jsx)(X.Input,{type:"text",value:o,onChange:a=>p(a.target.value),placeholder:l("queryPlaceholder"),className:"pl-10 h-12 text-lg",onKeyDown:a=>"Enter"===a.key&&ax()})]}),(0,B.jsx)(W.Button,{onClick:ax,disabled:F||!o,className:"h-12 px-8",children:F?l("reflecting"):l("reflect")})]}),(0,B.jsxs)("div",{className:"flex flex-wrap items-center gap-6 mt-4 pt-4 border-t",children:[(0,B.jsxs)("div",{className:"flex items-center gap-2",children:[(0,B.jsx)("span",{className:"text-sm font-medium text-muted-foreground",children:l("budgetLabel")}),(0,B.jsxs)(a6.Select,{value:q,onValueChange:a=>r(a),children:[(0,B.jsx)(a6.SelectTrigger,{className:"w-24 h-8",children:(0,B.jsx)(a6.SelectValue,{})}),(0,B.jsxs)(a6.SelectContent,{children:[(0,B.jsx)(a6.SelectItem,{value:"low",children:l("budgetLow")}),(0,B.jsx)(a6.SelectItem,{value:"mid",children:l("budgetMid")}),(0,B.jsx)(a6.SelectItem,{value:"high",children:l("budgetHigh")})]})]})]}),(0,B.jsxs)("div",{className:"flex items-center gap-2",children:[(0,B.jsx)("span",{className:"text-sm text-muted-foreground",children:l("tokensLabel")}),(0,B.jsx)(X.Input,{type:"number",value:s,onChange:a=>t(parseInt(a.target.value)||4096),className:"w-24 h-8"})]}),(0,B.jsx)("div",{className:"h-6 w-px bg-border"}),(0,B.jsxs)("div",{className:"flex items-center gap-4",children:[(0,B.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,B.jsx)(IM.Checkbox,{checked:u,onCheckedChange:a=>v(a)}),(0,B.jsx)("span",{className:"text-sm",children:l("includeSource")})]}),(0,B.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,B.jsx)(IM.Checkbox,{checked:w,onCheckedChange:a=>x(a)}),(0,B.jsx)("span",{className:"text-sm",children:l("includeTools")})]})]})]}),(0,B.jsxs)("div",{className:"flex items-center gap-4 mt-4 pt-4 border-t",children:[(0,B.jsx)(a7,{className:"h-4 w-4 text-muted-foreground"}),(0,B.jsx)("div",{className:"flex-1 max-w-md",children:(0,B.jsx)(X.Input,{type:"text",value:I,onChange:a=>J(a.target.value),placeholder:l("tagsPlaceholder"),className:"h-8"})}),(0,B.jsxs)(a6.Select,{value:K,onValueChange:a=>N(a),children:[(0,B.jsx)(a6.SelectTrigger,{className:"w-40 h-8",children:(0,B.jsx)(a6.SelectValue,{})}),(0,B.jsxs)(a6.SelectContent,{children:[(0,B.jsx)(a6.SelectItem,{value:"any",children:l("tagsMatchAny")}),(0,B.jsx)(a6.SelectItem,{value:"all",children:l("tagsMatchAll")}),(0,B.jsx)(a6.SelectItem,{value:"any_strict",children:l("tagsMatchAnyStrict")}),(0,B.jsx)(a6.SelectItem,{value:"all_strict",children:l("tagsMatchAllStrict")})]})]})]}),(0,B.jsxs)("div",{className:"flex flex-wrap items-center gap-6 mt-4 pt-4 border-t",children:[(0,B.jsx)(JB,{value:O,onChange:P}),(0,B.jsx)("div",{className:"h-6 w-px bg-border"}),(0,B.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,B.jsx)(IM.Checkbox,{checked:Q,onCheckedChange:a=>R(a)}),(0,B.jsx)("span",{className:"text-sm",children:l("excludeMentalModels")})]}),(0,B.jsxs)("div",{className:"flex items-center gap-2",children:[(0,B.jsx)("span",{className:"text-sm text-muted-foreground",children:l("excludeIdsLabel")}),(0,B.jsx)(X.Input,{type:"text",value:S,onChange:a=>T(a.target.value),placeholder:l("excludeIdsPlaceholder"),className:"h-8 w-48"})]})]})]})}),F&&(0,B.jsx)(bp.Card,{children:(0,B.jsxs)(bp.CardContent,{className:"flex flex-col items-center justify-center py-16",children:[(0,B.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mb-4"}),(0,B.jsx)("p",{className:"text-muted-foreground",children:l("reflectingOnMemories")})]})}),!F&&A&&(0,B.jsxs)("div",{className:"space-y-4",children:[(0,B.jsxs)("div",{className:"flex items-center gap-6 text-sm",children:[A.usage&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)("div",{className:"flex items-center gap-2",children:[(0,B.jsx)("span",{className:"text-muted-foreground",children:l("inputTokensLabel")}),(0,B.jsx)("span",{className:"font-semibold",children:A.usage.input_tokens?.toLocaleString()})]}),(0,B.jsxs)("div",{className:"flex items-center gap-2",children:[(0,B.jsx)("span",{className:"text-muted-foreground",children:l("outputTokensLabel")}),(0,B.jsx)("span",{className:"font-semibold",children:A.usage.output_tokens?.toLocaleString()})]})]}),A.trace?.tool_calls&&(0,B.jsxs)("div",{className:"flex items-center gap-2",children:[(0,B.jsx)("span",{className:"text-muted-foreground",children:l("toolCallsLabel")}),(0,B.jsx)("span",{className:"font-semibold",children:A.trace.tool_calls.length}),(0,B.jsxs)("span",{className:"text-muted-foreground",children:["(",A.trace.tool_calls.reduce((a,b)=>a+b.duration_ms,0),"ms)"]})]}),A.trace?.llm_calls&&(0,B.jsxs)("div",{className:"flex items-center gap-2",children:[(0,B.jsx)("span",{className:"text-muted-foreground",children:l("llmCallsLabel")}),(0,B.jsx)("span",{className:"font-semibold",children:A.trace.llm_calls.length}),(0,B.jsxs)("span",{className:"text-muted-foreground",children:["(",A.trace.llm_calls.reduce((a,b)=>a+b.duration_ms,0),"ms)"]})]}),(0,B.jsx)("div",{className:"flex-1"}),(0,B.jsx)("div",{className:"flex gap-1 bg-muted p-1 rounded-lg",children:["answer","trace","json"].map(a=>(0,B.jsx)("button",{onClick:()=>z(a),className:`px-3 py-1.5 text-sm font-medium rounded-md transition-colors ${y===a?"bg-background shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:"answer"===a?l("viewAnswer"):"trace"===a?l("viewTrace"):l("viewJson")},a))})]}),"answer"===y&&(0,B.jsxs)("div",{className:"space-y-6",children:[(0,B.jsxs)(bp.Card,{children:[(0,B.jsx)(bp.CardHeader,{children:(0,B.jsx)(bp.CardTitle,{children:l("answerTitle")})}),(0,B.jsx)(bp.CardContent,{children:(0,B.jsx)("div",{className:"prose prose-sm max-w-none dark:prose-invert",children:(0,B.jsx)(NR,{remarkPlugins:[Pk],children:A.text})})})]}),(0,B.jsxs)(bp.Card,{className:"border-blue-200 dark:border-blue-800",children:[(0,B.jsxs)(bp.CardHeader,{className:"py-4",children:[(0,B.jsxs)(bp.CardTitle,{className:"flex items-center gap-2 text-base",children:[(0,B.jsx)(JF,{className:"w-4 h-4"}),l("addDirectiveTitle")]}),(0,B.jsx)(bp.CardDescription,{className:"text-xs",children:l("addDirectiveDescription")})]}),(0,B.jsx)(bp.CardContent,{className:"pt-0",children:_?(0,B.jsxs)("div",{className:"flex items-center gap-2 text-green-600 dark:text-green-400",children:[(0,B.jsx)("span",{className:"text-lg",children:"✓"}),(0,B.jsx)("span",{className:"text-sm font-medium",children:l("directiveSaved",{name:au})})]}):(0,B.jsxs)("div",{className:"flex gap-3",children:[(0,B.jsx)(JI.Textarea,{value:U,onChange:a=>Y(a.target.value),placeholder:l("directivePlaceholder"),className:"flex-1 min-h-[60px] resize-none",onKeyDown:a=>{"Enter"===a.key&&(a.metaKey||a.ctrlKey)&&aw()}}),(0,B.jsx)(W.Button,{onClick:aw,disabled:Z||!U.trim(),className:"self-end",children:Z?l("savingDirective"):l("saveDirective")})]})})]})]}),"trace"===y&&(0,B.jsxs)("div",{className:"space-y-4",children:[A.observations_created&&A.observations_created.length>0&&(0,B.jsxs)(bp.Card,{className:"border-emerald-200 dark:border-emerald-800",children:[(0,B.jsxs)(bp.CardHeader,{className:"bg-emerald-50 dark:bg-emerald-950 py-3",children:[(0,B.jsxs)(bp.CardTitle,{className:"flex items-center gap-2 text-base",children:[(0,B.jsx)(JE,{className:"w-4 h-4 text-emerald-600"}),l("observationsCreatedTitle",{count:A.observations_created.length})]}),(0,B.jsx)(bp.CardDescription,{className:"text-xs",children:l("observationsCreatedDescription")})]}),(0,B.jsx)(bp.CardContent,{className:"pt-4",children:(0,B.jsx)("div",{className:"space-y-2",children:A.observations_created.map((a,b)=>(0,B.jsxs)("div",{className:"p-3 bg-emerald-50 dark:bg-emerald-950/50 rounded-lg border border-emerald-200 dark:border-emerald-800",children:[(0,B.jsx)("div",{className:"font-medium text-sm text-emerald-900 dark:text-emerald-100",children:a.name}),(0,B.jsx)("div",{className:"text-xs text-emerald-700 dark:text-emerald-300 mt-1",children:a.description}),(0,B.jsxs)("div",{className:"text-[10px] text-muted-foreground mt-2 font-mono",children:["ID: ",a.id]})]},b))})})]}),(0,B.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[(0,B.jsxs)(bp.Card,{className:"h-fit",children:[(0,B.jsxs)(bp.CardHeader,{className:"pb-3",children:[(0,B.jsx)(bp.CardTitle,{className:"text-base",children:l("executionTraceTitle")}),(0,B.jsx)(bp.CardDescription,{className:"text-xs",children:l("executionTraceDescription",{iterations:A.iterations||0,iterationsPlural:1!==(A.iterations||0)?"s":"",totalMs:(A.trace?.llm_calls?.reduce((a,b)=>a+b.duration_ms,0)||0)+(A.trace?.tool_calls?.reduce((a,b)=>a+b.duration_ms,0)||0)})})]}),(0,B.jsx)(bp.CardContent,{children:w?A.trace?.llm_calls&&A.trace.llm_calls.length>0||A.trace?.tool_calls&&A.trace.tool_calls.length>0?(0,B.jsx)("div",{className:"max-h-[500px] overflow-y-auto pr-2",children:(a=A.trace?.llm_calls||[],b=A.trace?.tool_calls||[],c=[],a.forEach((d,e)=>{let f=b.filter(a=>a.iteration===e+1),g=e===a.length-1,h=d.scope.includes("final")||g&&0===f.length,i=h?a.length:e+1;c.push({type:"llm",llm:d,iteration:i,isFinal:h}),f.length>0&&c.push({type:"tools",tools:f,iteration:e+1})}),c.map((a,b)=>(0,B.jsxs)("div",{className:"relative",children:[b<c.length-1&&(0,B.jsx)("div",{className:"absolute left-3 top-6 bottom-0 w-0.5 bg-border"}),"llm"===a.type?(0,B.jsxs)("div",{className:"flex items-start gap-3 pb-3",children:[(0,B.jsx)("div",{className:`w-6 h-6 rounded-full flex items-center justify-center flex-shrink-0 ${a.isFinal?"bg-emerald-500/15 text-emerald-600 dark:text-emerald-400":"bg-primary/10 text-primary"}`,children:a.isFinal?(0,B.jsx)(ba.Check,{className:"w-3.5 h-3.5",strokeWidth:2.5}):(0,B.jsx)("span",{className:"text-[10px] font-semibold",children:a.iteration})}),(0,B.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,B.jsxs)("div",{className:"flex items-center justify-between",children:[(0,B.jsx)("span",{className:"font-medium text-sm",children:a.isFinal?l("responseGenerated"):l("agentDecided")}),(0,B.jsxs)("span",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[(0,B.jsx)(af,{className:"w-3 h-3"}),a.llm.duration_ms,"ms"]})]}),(0,B.jsx)("span",{className:"text-xs text-muted-foreground",children:a.isFinal?l("finalAnswer"):l("calledToolsBelow")})]})]}):(0,B.jsxs)("div",{className:"flex items-start gap-3 pb-3",children:[(0,B.jsx)("div",{className:"w-6 h-6 rounded-full flex items-center justify-center bg-blue-500/15 text-blue-600 dark:text-blue-400 flex-shrink-0",children:(0,B.jsx)(JH,{className:"w-3 h-3",fill:"currentColor"})}),(0,B.jsxs)("div",{className:"flex-1 min-w-0 space-y-2",children:[(0,B.jsx)("div",{className:"text-xs text-muted-foreground",children:(a.tools?.length??0)!==1?l("executingToolsPlural",{count:a.tools?.length??0}):l("executingTools",{count:a.tools?.length??0})}),a.tools?.map((a,b)=>(0,B.jsxs)("div",{className:"border border-border rounded-lg overflow-hidden",children:[(0,B.jsxs)("div",{className:"flex items-center justify-between px-3 py-1.5 bg-muted/50",children:[(0,B.jsx)("span",{className:"font-medium text-sm text-foreground",children:a.tool}),(0,B.jsxs)("span",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[(0,B.jsx)(af,{className:"w-3 h-3"}),a.duration_ms,"ms"]})]}),(0,B.jsxs)("div",{className:"p-2 space-y-2",children:[(0,B.jsxs)("div",{children:[(0,B.jsx)("p",{className:"text-[10px] font-semibold text-muted-foreground mb-1",children:l("toolInputLabel")}),(0,B.jsx)("div",{className:"bg-muted p-1.5 rounded text-xs overflow-auto max-h-32",children:(0,B.jsx)(Ko,{src:a.input,collapsed:1,theme:"default"})})]}),a.output&&(0,B.jsxs)("div",{children:[(0,B.jsx)("p",{className:"text-[10px] font-semibold text-muted-foreground mb-1",children:l("toolOutputLabel")}),(0,B.jsx)("div",{className:"bg-muted p-1.5 rounded text-xs overflow-auto max-h-32",children:(0,B.jsx)(Ko,{src:a.output,collapsed:1,theme:"default"})})]})]})]},b))]})]})]},b)))}):(0,B.jsxs)("div",{className:"flex items-start gap-3 p-3 bg-muted border border-border rounded-lg",children:[(0,B.jsx)(JD.Info,{className:"w-4 h-4 text-muted-foreground mt-0.5 flex-shrink-0"}),(0,B.jsxs)("div",{children:[(0,B.jsx)("p",{className:"font-medium text-sm text-foreground",children:l("noOperations")}),(0,B.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:l("noOperationsDescription")})]})]}):(0,B.jsxs)("div",{className:"flex items-start gap-3 p-3 bg-muted border border-border rounded-lg",children:[(0,B.jsx)(JD.Info,{className:"w-4 h-4 text-muted-foreground mt-0.5 flex-shrink-0"}),(0,B.jsxs)("div",{children:[(0,B.jsx)("p",{className:"font-medium text-sm text-foreground",children:l("notIncluded")}),(0,B.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:l("enableIncludeTools")})]})]})})]}),(0,B.jsxs)(bp.Card,{className:"h-fit",children:[(0,B.jsxs)(bp.CardHeader,{className:"pb-3",children:[(0,B.jsx)(bp.CardTitle,{className:"text-base",children:l("basedOnTitle")}),(0,B.jsx)(bp.CardDescription,{className:"text-xs",children:l("basedOnDescription",{count:(A.based_on?.memories?.length||0)+(A.based_on?.observations?.filter(a=>"directive"!==a.subtype)?.length||0)+(A.based_on?.directives?.length||0)})})]}),(0,B.jsx)(bp.CardContent,{children:u?A.based_on?.memories&&A.based_on.memories.length>0||A.based_on?.mental_models&&A.based_on.mental_models.length>0||A.based_on?.directives&&A.based_on.directives.length>0||A.based_on?.observations&&A.based_on.observations.length>0?(e=(d=A.based_on?.memories||[]).filter(a=>"world"===a.type),f=d.filter(a=>"experience"===a.type),g=A.based_on?.mental_models||[],h=(A.based_on?.observations||[]).filter(a=>"directive"!==a.subtype),i=A.based_on?.directives||[],j=[{id:"directives",label:l("tabDirectives"),count:i.length},{id:"mental_models",label:l("tabMentalModels"),count:g.length},{id:"observations",label:l("tabObservations"),count:h.length},{id:"world",label:l("tabWorld"),count:e.length},{id:"experience",label:l("tabExperience"),count:f.length}],k=(()=>{switch(as){case"directives":return i;case"mental_models":return g;case"observations":return h;case"world":return e;case"experience":return f;default:return[]}})(),(0,B.jsxs)("div",{children:[(0,B.jsx)("div",{className:"flex items-center gap-1 bg-muted rounded-lg p-1 mb-4",children:j.map(a=>(0,B.jsxs)("button",{onClick:()=>at(a.id),className:`flex-1 px-3 py-1.5 rounded-md text-sm font-medium transition-all ${as===a.id?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:[a.label," (",a.count,")"]},a.id))}),k.length>0?(0,B.jsx)("div",{className:"max-h-[400px] overflow-y-auto pr-2 space-y-3",children:k.map((a,b)=>{let c,d;return(0,B.jsx)("div",{className:`p-4 bg-muted/50 rounded-lg border border-border/50 ${"directives"!==as?"cursor-pointer hover:bg-muted/80 transition-colors":""}`,onClick:()=>{"directives"!==as&&("observations"===as?av(a):"mental_models"===as?ar(a.id):ac(a.id))},children:"directives"===as?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)("div",{className:"font-medium text-sm",children:a.name}),a.content&&(0,B.jsx)("p",{className:"mt-1 text-xs text-muted-foreground line-clamp-2",children:a.content})]}):"observations"===as?(0,B.jsx)("div",{className:"font-medium text-sm",children:a.name}):"mental_models"===as?(d=(c=a.text?.indexOf(": ")??-1)>0?a.text.slice(0,c):a.id,(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)("div",{className:"font-medium text-sm",children:d}),(0,B.jsx)("code",{className:"text-xs font-mono text-muted-foreground",children:a.id})]})):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)("p",{className:"text-sm text-foreground leading-relaxed",children:a.text}),a.context&&(0,B.jsx)("div",{className:"text-xs text-muted-foreground mt-2",children:a.context})]})},a.id||b)})}):(0,B.jsx)("p",{className:"text-sm text-muted-foreground text-center py-4",children:l("noTabItems",{tab:as})})]})):(0,B.jsxs)("div",{className:"flex items-start gap-3 p-3 bg-amber-50 dark:bg-amber-950 border border-amber-200 dark:border-amber-800 rounded-lg",children:[(0,B.jsx)(JD.Info,{className:"w-4 h-4 text-amber-600 dark:text-amber-400 mt-0.5 flex-shrink-0"}),(0,B.jsxs)("div",{children:[(0,B.jsx)("p",{className:"font-medium text-sm text-amber-900 dark:text-amber-100",children:l("noFactsFound")}),(0,B.jsx)("p",{className:"text-xs text-amber-700 dark:text-amber-300 mt-0.5",children:l("noFactsFoundDescription")})]})]}):(0,B.jsxs)("div",{className:"flex items-start gap-3 p-3 bg-muted border border-border rounded-lg",children:[(0,B.jsx)(JD.Info,{className:"w-4 h-4 text-muted-foreground mt-0.5 flex-shrink-0"}),(0,B.jsxs)("div",{children:[(0,B.jsx)("p",{className:"font-medium text-sm text-foreground",children:l("notIncludedBasedOn")}),(0,B.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:l("enableIncludeSource")})]})]})})]})]})]}),"json"===y&&(0,B.jsxs)(bp.Card,{children:[(0,B.jsx)(bp.CardHeader,{children:(0,B.jsx)(bp.CardTitle,{className:"text-lg",children:l("rawResponseTitle")})}),(0,B.jsx)(bp.CardContent,{children:(0,B.jsx)("div",{className:"bg-muted p-4 rounded-lg overflow-auto max-h-[600px]",children:(0,B.jsx)(Ko,{src:A,collapsed:2,theme:"default"})})})]})]}),!F&&!A&&(0,B.jsx)(bp.Card,{className:"border-dashed",children:(0,B.jsxs)(bp.CardContent,{className:"flex flex-col items-center justify-center py-16",children:[(0,B.jsx)(L,{className:"h-12 w-12 text-muted-foreground mb-4"}),(0,B.jsx)("h3",{className:"text-lg font-semibold mb-2",children:l("readyToReflect")}),(0,B.jsx)("p",{className:"text-muted-foreground text-center max-w-md",children:l("readyToReflectDescription")})]})}),(0,B.jsx)(bo,{memoryId:ab,onClose:()=>ac(null)}),ad&&(0,B.jsx)("div",{className:"fixed right-0 top-0 h-screen w-[420px] bg-card border-l shadow-2xl z-50 overflow-y-auto",children:(0,B.jsxs)("div",{className:"p-6",children:[(0,B.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,B.jsxs)("div",{className:"flex items-center gap-2",children:[(0,B.jsx)(JG,{className:"w-5 h-5"}),(0,B.jsx)("h2",{className:"text-lg font-semibold",children:"Directive"})]}),(0,B.jsx)(W.Button,{variant:"ghost",size:"icon",onClick:()=>{ae(null),ah(null)},children:(0,B.jsx)(bb.X,{className:"w-4 h-4"})})]}),ai?(0,B.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,B.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})}):(0,B.jsxs)("div",{className:"space-y-4",children:[(0,B.jsxs)("div",{children:[(0,B.jsx)("h3",{className:"text-sm font-medium text-muted-foreground",children:"Name"}),(0,B.jsx)("p",{className:"mt-1 font-medium",children:ag?.name||ad.name})]}),ag?.description&&(0,B.jsxs)("div",{children:[(0,B.jsx)("h3",{className:"text-sm font-medium text-muted-foreground",children:"Description"}),(0,B.jsx)("p",{className:"mt-1 text-sm",children:ag.description})]}),ag?.tags&&ag.tags.length>0&&(0,B.jsxs)("div",{children:[(0,B.jsx)("h3",{className:"text-sm font-medium text-muted-foreground mb-1",children:"Tags"}),(0,B.jsx)("div",{className:"flex flex-wrap gap-1",children:ag.tags.map(a=>(0,B.jsxs)("span",{className:"text-xs px-2 py-0.5 rounded bg-muted text-muted-foreground flex items-center gap-1",children:[(0,B.jsx)(a7,{className:"w-2.5 h-2.5"}),a]},a))})]}),(ag?.content||ad.content)&&(0,B.jsxs)("div",{children:[(0,B.jsx)("h3",{className:"text-sm font-medium text-muted-foreground mb-2",children:"Content"}),(0,B.jsx)("div",{className:"p-3 bg-muted rounded-lg",children:(0,B.jsx)("div",{className:"text-sm text-muted-foreground whitespace-pre-wrap",children:ag?.content||ad.content})})]}),(0,B.jsxs)("div",{className:"pt-2 border-t",children:[(0,B.jsx)("h3",{className:"text-sm font-medium text-muted-foreground",children:"ID"}),(0,B.jsx)("p",{className:"mt-1 font-mono text-xs text-muted-foreground",children:ad.id})]})]})]})}),ak&&(0,B.jsx)("div",{className:"fixed right-0 top-0 h-screen w-[420px] bg-card border-l shadow-2xl z-50 overflow-y-auto",children:(0,B.jsxs)("div",{className:"p-6",children:[(0,B.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,B.jsxs)("div",{className:"flex items-center gap-2",children:[(0,B.jsx)(JE,{className:"w-5 h-5"}),(0,B.jsx)("h2",{className:"text-lg font-semibold",children:l("observationPanelTitle")})]}),(0,B.jsx)(W.Button,{variant:"ghost",size:"icon",onClick:()=>{al(null),an(null)},children:(0,B.jsx)(bb.X,{className:"w-4 h-4"})})]}),ao?(0,B.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,B.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})}):(0,B.jsxs)("div",{className:"space-y-4",children:[(0,B.jsxs)("div",{children:[(0,B.jsx)("h3",{className:"text-sm font-medium text-muted-foreground",children:l("observationTextField")}),(0,B.jsx)("div",{className:"mt-1 prose prose-sm max-w-none dark:prose-invert",children:(0,B.jsx)(NR,{remarkPlugins:[Pk],children:am?.text||ak.text})})]}),am?.tags&&am.tags.length>0&&(0,B.jsxs)("div",{children:[(0,B.jsx)("h3",{className:"text-sm font-medium text-muted-foreground mb-1",children:l("observationTagsField")}),(0,B.jsx)("div",{className:"flex flex-wrap gap-1",children:am.tags.map(a=>(0,B.jsxs)("span",{className:"text-xs px-2 py-0.5 rounded bg-muted text-muted-foreground flex items-center gap-1",children:[(0,B.jsx)(a7,{className:"w-2.5 h-2.5"}),a]},a))})]}),am?.source_memories&&am.source_memories.length>0&&(0,B.jsxs)("div",{children:[(0,B.jsx)("h3",{className:"text-sm font-medium text-muted-foreground mb-2",children:l("observationSourceMemoriesField",{count:am.source_memories.length})}),(0,B.jsx)("div",{className:"space-y-2",children:am.source_memories.map((a,b)=>(0,B.jsx)("div",{className:"p-3 bg-muted rounded-lg",children:(0,B.jsx)("div",{className:"text-sm text-muted-foreground whitespace-pre-wrap",children:a.text||("string"==typeof a?a:"")})},b))})]}),(0,B.jsxs)("div",{className:"pt-2 border-t",children:[(0,B.jsx)("h3",{className:"text-sm font-medium text-muted-foreground",children:l("observationIdField")}),(0,B.jsx)("p",{className:"mt-1 font-mono text-xs text-muted-foreground",children:ak.id})]})]})]})}),(0,B.jsx)(PD,{mentalModelId:aq,onClose:()=>ar(null)})]}):(0,B.jsx)(bp.Card,{className:"border-dashed",children:(0,B.jsxs)(bp.CardContent,{className:"flex flex-col items-center justify-center py-16",children:[(0,B.jsx)(M,{className:"h-12 w-12 text-muted-foreground mb-4"}),(0,B.jsx)("h3",{className:"text-xl font-semibold mb-2",children:l("noBankSelected")}),(0,B.jsx)("p",{className:"text-muted-foreground",children:l("noBankSelectedDescription")})]})})}let PK=(0,K.default)("arrow-down",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);function PL(){let a,b,c,d,e,f,g,h,i,j,k,l,n,o,p=(0,E.useTranslations)("searchDebug"),{currentBank:q}=(0,H.useBank)(),[r,s]=(0,C.useState)(""),[t,u]=(0,C.useState)(["world"]),[v,w]=(0,C.useState)("mid"),[x,y]=(0,C.useState)(4096),[z,A]=(0,C.useState)(""),[D,G]=(0,C.useState)(!1),[I,K]=(0,C.useState)(!1),[L,P]=(0,C.useState)(""),[R,S]=(0,C.useState)("any"),[T,U]=(0,C.useState)(null),[Z,$]=(0,C.useState)(null),[_,aa]=(0,C.useState)(null),[ab,ac]=(0,C.useState)(null),[ad,ae]=(0,C.useState)(null),[ag,ah]=(0,C.useState)(!1),[ai,aj]=(0,C.useState)("results"),[ak,al]=(0,C.useState)(null),[am,an]=(0,C.useState)(new Set),[ao,ap]=(0,C.useState)(new Set),aq=a=>{an(b=>{let c=new Set(b);return c.has(a)?c.delete(a):c.add(a),c})},ar=a=>{ap(b=>{let c=new Set(b);return c.has(a)?c.delete(a):c.add(a),c})},as=a=>{let b=a.id||a.node_id;al(T?.find(a=>a.id===b||a.node_id===b)||a)},at=async()=>{if(!q)return void F.toast.error(p("errorSelectBank"));if(r){if(0===t.length)return void F.toast.error(p("errorSelectFactType"));ah(!0);try{let a=L.split(",").map(a=>a.trim()).filter(a=>a.length>0),b={bank_id:q,query:r,types:t,budget:v,max_tokens:x,trace:!0,include:{entities:I?{max_tokens:500}:null,chunks:D?{max_tokens:8192}:null},...z&&{query_timestamp:z},...a.length>0&&{tags:a,tags_match:R}},c=await V.client.recall(b);U(c.results||[]),$(c.entities||null),aa(c.chunks||null),ac(c.observations||null),ae(c.trace||null),aj("results")}catch(a){}finally{ah(!1)}}};return q?(0,B.jsxs)("div",{className:"space-y-6",children:[(0,B.jsx)(bp.Card,{children:(0,B.jsxs)(bp.CardContent,{className:"pt-6",children:[(0,B.jsxs)("div",{className:"flex gap-3",children:[(0,B.jsxs)("div",{className:"flex-1 relative",children:[(0,B.jsx)(J.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),(0,B.jsx)(X.Input,{type:"text",value:r,onChange:a=>s(a.target.value),placeholder:p("queryPlaceholder"),className:"pl-10 h-12 text-lg",onKeyDown:a=>"Enter"===a.key&&at()})]}),(0,B.jsx)(W.Button,{onClick:at,disabled:ag||!r,className:"h-12 px-8",children:ag?p("searching"):p("recall")})]}),(0,B.jsxs)("div",{className:"flex flex-wrap items-center gap-6 mt-4 pt-4 border-t",children:[(0,B.jsx)(JB,{value:t,onChange:u,label:p("typesLabel")}),(0,B.jsx)("div",{className:"h-6 w-px bg-border"}),(0,B.jsxs)("div",{className:"flex items-center gap-2",children:[(0,B.jsx)(Kp,{className:"h-4 w-4 text-muted-foreground"}),(0,B.jsxs)(a6.Select,{value:v,onValueChange:a=>w(a),children:[(0,B.jsx)(a6.SelectTrigger,{className:"w-24 h-8",children:(0,B.jsx)(a6.SelectValue,{})}),(0,B.jsxs)(a6.SelectContent,{children:[(0,B.jsx)(a6.SelectItem,{value:"low",children:p("budgetLow")}),(0,B.jsx)(a6.SelectItem,{value:"mid",children:p("budgetMid")}),(0,B.jsx)(a6.SelectItem,{value:"high",children:p("budgetHigh")})]})]})]}),(0,B.jsxs)("div",{className:"flex items-center gap-2",children:[(0,B.jsx)("span",{className:"text-sm text-muted-foreground",children:p("tokensLabel")}),(0,B.jsx)(X.Input,{type:"number",value:x,onChange:a=>y(parseInt(a.target.value)),className:"w-24 h-8"})]}),(0,B.jsxs)("div",{className:"flex items-center gap-2",children:[(0,B.jsx)(af,{className:"h-4 w-4 text-muted-foreground"}),(0,B.jsx)(X.Input,{type:"datetime-local",value:z,onChange:a=>A(a.target.value),className:"h-8",placeholder:p("queryDatePlaceholder")})]}),(0,B.jsx)("div",{className:"h-6 w-px bg-border"}),(0,B.jsxs)("div",{className:"flex items-center gap-4",children:[(0,B.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,B.jsx)(IM.Checkbox,{checked:D,onCheckedChange:a=>G(a)}),(0,B.jsx)(N.FileText,{className:"h-4 w-4 text-muted-foreground"}),(0,B.jsx)("span",{className:"text-sm",children:p("chunks")})]}),(0,B.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,B.jsx)(IM.Checkbox,{checked:I,onCheckedChange:a=>K(a)}),(0,B.jsx)(O,{className:"h-4 w-4 text-muted-foreground"}),(0,B.jsx)("span",{className:"text-sm",children:p("entities")})]})]})]}),(0,B.jsxs)("div",{className:"flex items-center gap-4 mt-4 pt-4 border-t",children:[(0,B.jsx)(a7,{className:"h-4 w-4 text-muted-foreground"}),(0,B.jsx)("div",{className:"flex-1 max-w-md",children:(0,B.jsx)(X.Input,{type:"text",value:L,onChange:a=>P(a.target.value),placeholder:p("tagsPlaceholder"),className:"h-8"})}),(0,B.jsxs)(a6.Select,{value:R,onValueChange:a=>S(a),children:[(0,B.jsx)(a6.SelectTrigger,{className:"w-40 h-8",children:(0,B.jsx)(a6.SelectValue,{})}),(0,B.jsxs)(a6.SelectContent,{children:[(0,B.jsx)(a6.SelectItem,{value:"any",children:p("tagsMatchAny")}),(0,B.jsx)(a6.SelectItem,{value:"all",children:p("tagsMatchAll")}),(0,B.jsx)(a6.SelectItem,{value:"any_strict",children:p("tagsMatchAnyStrict")}),(0,B.jsx)(a6.SelectItem,{value:"all_strict",children:p("tagsMatchAllStrict")})]})]})]})]})}),ag&&(0,B.jsx)(bp.Card,{children:(0,B.jsxs)(bp.CardContent,{className:"flex flex-col items-center justify-center py-16",children:[(0,B.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mb-4"}),(0,B.jsx)("p",{className:"text-muted-foreground",children:p("searchingMemories")})]})}),!ag&&T&&(0,B.jsxs)("div",{className:"space-y-4",children:[ad?.summary&&(0,B.jsxs)("div",{className:"flex items-center gap-6 text-sm",children:[(0,B.jsxs)("div",{className:"flex items-center gap-2",children:[(0,B.jsx)("span",{className:"text-muted-foreground",children:p("resultsLabel")}),(0,B.jsx)("span",{className:"font-semibold",children:T.length})]}),(0,B.jsxs)("div",{className:"flex items-center gap-2",children:[(0,B.jsx)("span",{className:"text-muted-foreground",children:p("durationLabel")}),(0,B.jsxs)("span",{className:"font-semibold",children:[ad.summary.total_duration_seconds?.toFixed(2),"s"]})]}),(0,B.jsxs)("div",{className:"flex items-center gap-2",children:[(0,B.jsx)("span",{className:"text-muted-foreground",children:p("nodesVisitedLabel")}),(0,B.jsx)("span",{className:"font-semibold",children:ad.summary.total_nodes_visited})]}),(0,B.jsx)("div",{className:"flex-1"}),(0,B.jsx)("div",{className:"flex gap-1 bg-muted p-1 rounded-lg",children:["results","trace","json"].map(a=>(0,B.jsx)("button",{onClick:()=>aj(a),className:`px-3 py-1.5 text-sm font-medium rounded-md transition-colors ${ai===a?"bg-background shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:"results"===a?p("viewResults"):"trace"===a?p("viewTrace"):p("viewJson")},a))})]}),"results"===ai&&(0,B.jsxs)("div",{className:"space-y-4",children:[ab&&ab.length>0&&(0,B.jsxs)(bp.Card,{className:"border-orange-500/30 bg-orange-500/5",children:[(0,B.jsx)(bp.CardHeader,{className:"py-3",children:(0,B.jsxs)(bp.CardTitle,{className:"text-base flex items-center gap-2",children:[(0,B.jsx)(M,{className:"h-4 w-4 text-orange-500"}),(0,B.jsx)("span",{children:"Observations"}),(0,B.jsxs)("span",{className:"text-xs text-muted-foreground",children:["(",ab.length,")"]})]})}),(0,B.jsx)(bp.CardContent,{className:"pt-0 space-y-2",children:ab.map((a,b)=>(0,B.jsxs)("div",{className:"p-3 bg-background rounded-lg border border-orange-500/20",children:[(0,B.jsx)("p",{className:"text-sm text-foreground",children:a.text}),(0,B.jsxs)("div",{className:"flex items-center gap-3 mt-2 text-xs text-muted-foreground",children:[(0,B.jsx)("span",{className:"px-2 py-0.5 rounded bg-orange-500/10 text-orange-600",children:"Observation"}),(0,B.jsx)("span",{children:p("proofCount",{count:a.proof_count||1})}),(0,B.jsx)("span",{children:p("relevance",{value:(a.relevance||0).toFixed(3)})})]})]},a.id||b))})]}),(0,B.jsx)("div",{className:"space-y-3",children:0!==T.length||ab&&0!==ab.length?T.map((a,b)=>{let c=ad?.visits?.find(b=>b.node_id===a.id),d=c?c.weights.final_weight:a.score||0;return(0,B.jsx)(bp.Card,{className:"cursor-pointer hover:border-primary/50 transition-colors",onClick:()=>al(a),children:(0,B.jsx)(bp.CardContent,{className:"py-4",children:(0,B.jsxs)("div",{className:"flex items-start gap-4",children:[(0,B.jsx)("div",{className:"flex-shrink-0 w-8 h-8 rounded-full bg-primary/10 flex items-center justify-center",children:(0,B.jsx)("span",{className:"text-sm font-semibold text-primary",children:b+1})}),(0,B.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,B.jsx)("p",{className:"text-foreground",children:a.text}),(0,B.jsxs)("div",{className:"flex items-center gap-4 mt-2 text-xs text-muted-foreground",children:[(0,B.jsx)("span",{className:"px-2 py-0.5 rounded bg-muted capitalize",children:a.type||"world"}),a.context&&(0,B.jsx)("span",{className:"truncate max-w-xs",children:a.context}),a.occurred_start&&(0,B.jsx)("span",{children:new Date(a.occurred_start).toLocaleDateString()})]})]}),(0,B.jsxs)("div",{className:"flex-shrink-0 text-right",children:[(0,B.jsx)("div",{className:"text-sm font-semibold",children:(d??0).toFixed(3)}),(0,B.jsx)("div",{className:"text-xs text-muted-foreground",children:p("scoreLabel")})]}),(0,B.jsx)(Q.ChevronRight,{className:"h-5 w-5 text-muted-foreground flex-shrink-0"})]})})},b)}):(0,B.jsx)(bp.Card,{children:(0,B.jsxs)(bp.CardContent,{className:"flex flex-col items-center justify-center py-12",children:[(0,B.jsx)(J.Search,{className:"h-12 w-12 text-muted-foreground mb-4"}),(0,B.jsx)("p",{className:"text-muted-foreground",children:p("noMemoriesFound")})]})})})]}),"trace"===ai&&ad&&(0,B.jsxs)("div",{className:"space-y-4",children:[ad.retrieval_results&&ad.retrieval_results.length>0&&(a={},ad.retrieval_results.forEach(b=>{let c=b.fact_type||"all";a[c]||(a[c]=[]),a[c].push(b)}),b=Object.keys(a),(0,B.jsxs)("div",{children:[(0,B.jsxs)("div",{className:"text-xs font-medium text-muted-foreground mb-3 flex items-center gap-2",children:[(0,B.jsx)("div",{className:"flex-1 h-px bg-border"}),(0,B.jsx)("span",{children:p("parallelRetrieval")}),(0,B.jsx)("div",{className:"flex-1 h-px bg-border"})]}),(0,B.jsx)("div",{className:"space-y-2",children:b.map((b,c)=>{let d=a[b],e=`lane-${b}`,f=am.has(e),g=d.reduce((a,b)=>a+(b.results?.length||0),0),h=Math.max(...d.map(a=>a.duration_seconds||0)),i={world:{bg:"bg-blue-500/10",text:"text-blue-500",border:"border-blue-500/30"},experience:{bg:"bg-green-500/10",text:"text-green-500",border:"border-green-500/30"},opinion:{bg:"bg-purple-500/10",text:"text-purple-500",border:"border-purple-500/30"},all:{bg:"bg-gray-500/10",text:"text-gray-500",border:"border-gray-500/30"}},j=i[b]||i.all;return(0,B.jsx)(bp.Card,{className:`transition-colors ${f?"border-primary":j.border}`,children:(0,B.jsxs)(bp.CardContent,{className:"py-3 px-4",children:[(0,B.jsxs)("div",{className:"flex items-center gap-3 cursor-pointer",onClick:()=>aq(e),children:[(0,B.jsx)("div",{className:`w-8 h-8 rounded-lg ${j.bg} flex items-center justify-center`,children:(0,B.jsx)("span",{className:`text-sm font-bold ${j.text} capitalize`,children:b.charAt(0).toUpperCase()})}),(0,B.jsxs)("div",{className:"flex-1",children:[(0,B.jsxs)("div",{className:"flex items-center gap-2",children:[(0,B.jsx)("span",{className:"font-semibold text-foreground capitalize",children:b}),(0,B.jsx)("span",{className:"text-xs text-muted-foreground",children:p("methodsCount",{count:d.length})})]}),(0,B.jsx)("div",{className:"flex gap-1.5 mt-1",children:d.map((a,b)=>(0,B.jsxs)("span",{className:"text-[10px] px-2 py-0.5 rounded-full bg-muted text-muted-foreground capitalize",children:[a.method_name,": ",a.results?.length||0]},b))})]}),(0,B.jsxs)("div",{className:"text-right",children:[(0,B.jsx)("div",{className:"text-2xl font-bold text-foreground",children:g}),(0,B.jsxs)("div",{className:"text-[10px] text-muted-foreground",children:[h.toFixed(2),"s"]})]}),f?(0,B.jsx)(Jj.ChevronDown,{className:"h-5 w-5 text-muted-foreground"}):(0,B.jsx)(Q.ChevronRight,{className:"h-5 w-5 text-muted-foreground"})]}),f&&(0,B.jsx)("div",{className:"mt-4 pt-4 border-t border-border",children:(0,B.jsx)("div",{className:`grid gap-3 ${1===d.length?"grid-cols-1":2===d.length?"grid-cols-2":3===d.length?"grid-cols-3":"grid-cols-4"}`,children:d.map((a,b)=>{let c,d,f,g,h=`${e}-method-${b}`,i=am.has(h),j=a.results||[];return(0,B.jsxs)("div",{className:"flex flex-col",children:[(0,B.jsxs)("div",{className:`p-3 rounded-lg cursor-pointer transition-colors ${i?"bg-primary/10 border border-primary":"bg-muted/50 hover:bg-muted"}`,onClick:a=>{a.stopPropagation(),aq(h)},children:[(0,B.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,B.jsxs)("div",{className:"flex items-center gap-2",children:[(0,B.jsx)("span",{className:"font-medium text-sm text-foreground capitalize",children:a.method_name}),"temporal"===a.method_name&&a.metadata?.constraint&&(0,B.jsxs)("span",{className:"flex items-center gap-1 text-[10px] text-muted-foreground",children:[(0,B.jsx)(Y,{className:"h-3 w-3"}),a.metadata.constraint.start?new Date(a.metadata.constraint.start).toLocaleDateString():"any"," → ",a.metadata.constraint.end?new Date(a.metadata.constraint.end).toLocaleDateString():"any"]})]}),i?(0,B.jsx)(Jj.ChevronDown,{className:"h-3 w-3 text-muted-foreground"}):(0,B.jsx)(Q.ChevronRight,{className:"h-3 w-3 text-muted-foreground"})]}),(0,B.jsxs)("div",{className:"flex items-end justify-between",children:[(0,B.jsx)("div",{className:"text-2xl font-bold text-foreground",children:j.length}),(0,B.jsxs)("div",{className:"text-[10px] text-muted-foreground",children:[a.duration_seconds?.toFixed(2),"s"]})]})]}),i&&j.length>0&&(c=`results-${h}`,f=(d=ao.has(c))?j:j.slice(0,5),g=j.length>5,(0,B.jsxs)("div",{className:"mt-2 space-y-1.5 max-h-[300px] overflow-y-auto",children:[f.map((a,b)=>(0,B.jsx)("div",{className:"p-2 bg-background rounded cursor-pointer hover:bg-muted/50 transition-colors border border-border",onClick:b=>{b.stopPropagation(),as(a)},children:(0,B.jsxs)("div",{className:"flex items-start gap-2",children:[(0,B.jsx)("span",{className:"text-[10px] font-mono text-muted-foreground mt-0.5",children:b+1}),(0,B.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,B.jsx)("p",{className:"text-xs text-foreground line-clamp-2",children:a.text}),(0,B.jsx)("div",{className:"flex items-center gap-2 mt-1",children:(0,B.jsx)("span",{className:"text-[10px] text-muted-foreground",children:(a.score||a.similarity||0).toFixed(4)})})]})]})},b)),g&&(0,B.jsx)("button",{className:"w-full text-[10px] text-primary hover:text-primary/80 py-1.5 hover:bg-muted/50 rounded transition-colors",onClick:a=>{a.stopPropagation(),ar(c)},children:d?p("showLess"):p("viewAllResults",{count:j.length})})]}))]},h)})})})]})},e)})}),(0,B.jsx)("div",{className:"flex justify-center py-2",children:(0,B.jsx)("div",{className:"flex items-center gap-2",children:b.map((a,b)=>{let c={world:"bg-blue-500",experience:"bg-green-500",opinion:"bg-purple-500",all:"bg-gray-500"};return(0,B.jsx)("div",{className:"flex flex-col items-center",children:(0,B.jsx)("div",{className:`w-1 h-4 ${c[a]||c.all} rounded-full opacity-50`})},b)})})}),(0,B.jsx)("div",{className:"flex justify-center",children:(0,B.jsx)(PK,{className:"h-5 w-5 text-muted-foreground/50"})})]})),ad.rrf_merged&&(c="rrf-merge",d=am.has(c),(0,B.jsxs)("div",{children:[(0,B.jsx)(bp.Card,{className:`cursor-pointer transition-colors ${d?"border-primary":"hover:border-primary/50"}`,onClick:()=>aq(c),children:(0,B.jsx)(bp.CardContent,{className:"py-4",children:(0,B.jsxs)("div",{className:"flex items-center gap-4",children:[(0,B.jsx)("div",{className:"flex-shrink-0 w-10 h-10 rounded-full bg-purple-500/10 flex items-center justify-center",children:(0,B.jsx)("span",{className:"text-sm font-bold text-purple-500",children:"∪"})}),(0,B.jsxs)("div",{className:"flex-1",children:[(0,B.jsxs)("div",{className:"flex items-center gap-2",children:[(0,B.jsx)("span",{className:"font-semibold text-foreground",children:p("rrfFusion")}),(0,B.jsx)("span",{className:"text-xs px-2 py-0.5 rounded bg-muted text-muted-foreground",children:p("rrfMerge")})]}),(0,B.jsx)("div",{className:"text-sm text-muted-foreground mt-0.5",children:p("rrfDescription")})]}),(0,B.jsx)("div",{className:"text-2xl font-bold text-foreground",children:ad.rrf_merged.length}),d?(0,B.jsx)(Jj.ChevronDown,{className:"h-5 w-5 text-muted-foreground"}):(0,B.jsx)(Q.ChevronRight,{className:"h-5 w-5 text-muted-foreground"})]})})}),d&&ad.rrf_merged.length>0&&(e="results-rrf",g=(f=ao.has(e))?ad.rrf_merged:ad.rrf_merged.slice(0,5),h=ad.rrf_merged.length>5,(0,B.jsxs)("div",{className:"ml-6 mt-2 space-y-2 border-l-2 border-muted pl-4 max-h-[400px] overflow-y-auto",children:[g.map((a,b)=>(0,B.jsx)("div",{className:"p-3 bg-muted/30 rounded-lg cursor-pointer hover:bg-muted/50 transition-colors",onClick:b=>{b.stopPropagation(),as(a)},children:(0,B.jsxs)("div",{className:"flex items-start gap-3",children:[(0,B.jsx)("span",{className:"text-xs font-mono text-muted-foreground",children:b+1}),(0,B.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,B.jsx)("p",{className:"text-sm text-foreground line-clamp-2",children:a.text}),(0,B.jsxs)("div",{className:"text-xs text-muted-foreground mt-1",children:[p("rrfScore")," ",(a.rrf_score||a.score||0).toFixed(4)]})]})]})},b)),h&&(0,B.jsx)("button",{className:"w-full text-xs text-primary hover:text-primary/80 py-2 hover:bg-muted/50 rounded transition-colors",onClick:a=>{a.stopPropagation(),ar(e)},children:f?p("showLess"):p("viewAllResults",{count:ad.rrf_merged.length})})]})),(0,B.jsx)("div",{className:"flex justify-center py-2",children:(0,B.jsx)(PK,{className:"h-4 w-4 text-muted-foreground/50"})})]})),ad.reranked&&(i="reranking",j=am.has(i),(0,B.jsxs)("div",{children:[(0,B.jsx)(bp.Card,{className:`cursor-pointer transition-colors ${j?"border-primary":"hover:border-primary/50"}`,onClick:()=>aq(i),children:(0,B.jsx)(bp.CardContent,{className:"py-4",children:(0,B.jsxs)("div",{className:"flex items-center gap-4",children:[(0,B.jsx)("div",{className:"flex-shrink-0 w-10 h-10 rounded-full bg-amber-500/10 flex items-center justify-center",children:(0,B.jsx)("span",{className:"text-sm font-bold text-amber-500",children:"⚡"})}),(0,B.jsxs)("div",{className:"flex-1",children:[(0,B.jsxs)("div",{className:"flex items-center gap-2",children:[(0,B.jsx)("span",{className:"font-semibold text-foreground",children:p("combinedScoring")}),(0,B.jsx)("span",{className:"text-xs px-2 py-0.5 rounded bg-muted text-muted-foreground",children:p("rerank")})]}),(0,B.jsx)("div",{className:"text-sm text-muted-foreground mt-0.5",children:(0,B.jsx)("span",{className:"font-mono text-xs",children:"ce × recency_boost(±10%) × temporal_boost(±10%)"})})]}),(0,B.jsx)("div",{className:"text-2xl font-bold text-foreground",children:ad.reranked.length}),j?(0,B.jsx)(Jj.ChevronDown,{className:"h-5 w-5 text-muted-foreground"}):(0,B.jsx)(Q.ChevronRight,{className:"h-5 w-5 text-muted-foreground"})]})})}),j&&ad.reranked.length>0&&(k="results-rerank",n=(l=ao.has(k))?ad.reranked:ad.reranked.slice(0,5),o=ad.reranked.length>5,(0,B.jsxs)("div",{className:"ml-6 mt-2 space-y-2 border-l-2 border-muted pl-4 max-h-[400px] overflow-y-auto",children:[n.map((a,b)=>{let c=a.score_components||{};return(0,B.jsx)("div",{className:"p-3 bg-muted/30 rounded-lg cursor-pointer hover:bg-muted/50 transition-colors",onClick:b=>{b.stopPropagation(),as(a)},children:(0,B.jsxs)("div",{className:"flex items-start gap-3",children:[(0,B.jsx)("span",{className:"text-xs font-mono text-muted-foreground",children:b+1}),(0,B.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,B.jsx)("p",{className:"text-sm text-foreground line-clamp-2",children:a.text}),(0,B.jsxs)("div",{className:"flex flex-wrap gap-x-3 gap-y-1 mt-2 text-[10px] text-muted-foreground font-mono",children:[(0,B.jsxs)("span",{className:"font-semibold text-foreground",children:["= ",(a.rerank_score||a.score||0).toFixed(4)]}),void 0!==c.cross_encoder_score_normalized&&(0,B.jsxs)("span",{title:p("tooltipCrossEncoder"),children:["CE: ",c.cross_encoder_score_normalized.toFixed(3)]}),void 0!==c.temporal&&.5!==c.temporal&&(0,B.jsxs)("span",{title:p("tooltipTemporal"),children:["Tmp: ",c.temporal.toFixed(3)]}),void 0!==c.recency&&(0,B.jsxs)("span",{title:p("tooltipRecency"),children:["Rec: ",c.recency.toFixed(3)]})]})]})]})},b)}),o&&(0,B.jsx)("button",{className:"w-full text-xs text-primary hover:text-primary/80 py-2 hover:bg-muted/50 rounded transition-colors",onClick:a=>{a.stopPropagation(),ar(k)},children:l?p("showLess"):p("viewAllResults",{count:ad.reranked.length})})]})),(0,B.jsx)("div",{className:"flex justify-center py-2",children:(0,B.jsx)(PK,{className:"h-4 w-4 text-muted-foreground/50"})})]})),(0,B.jsx)(bp.Card,{className:"border-primary bg-primary/5",children:(0,B.jsx)(bp.CardContent,{className:"py-4",children:(0,B.jsxs)("div",{className:"flex items-center gap-4",children:[(0,B.jsx)("div",{className:"flex-shrink-0 w-10 h-10 rounded-full bg-primary/20 flex items-center justify-center",children:(0,B.jsx)("span",{className:"text-sm font-bold text-primary",children:"✓"})}),(0,B.jsxs)("div",{className:"flex-1",children:[(0,B.jsxs)("div",{className:"flex items-center gap-2",children:[(0,B.jsx)("span",{className:"font-semibold text-foreground",children:p("finalResults")}),(0,B.jsx)("span",{className:"text-xs px-2 py-0.5 rounded bg-primary/20 text-primary",children:p("output")})]}),(0,B.jsx)("div",{className:"text-sm text-muted-foreground mt-0.5",children:p("finalResultsDescription")})]}),(0,B.jsx)("div",{className:"text-2xl font-bold text-primary",children:T?.length||0})]})})})]}),"json"===ai&&(0,B.jsxs)(bp.Card,{children:[(0,B.jsx)(bp.CardHeader,{children:(0,B.jsx)(bp.CardTitle,{className:"text-lg",children:p("rawResponse")})}),(0,B.jsx)(bp.CardContent,{children:(0,B.jsx)("div",{className:"bg-muted p-4 rounded-lg overflow-auto max-h-[600px]",children:(0,B.jsx)(Ko,{src:{results:T,...Z&&{entities:Z},..._&&{chunks:_},...ab&&{observations:ab},trace:ad},collapsed:2,theme:"default"})})})]})]}),!ag&&!T&&(0,B.jsx)(bp.Card,{className:"border-dashed",children:(0,B.jsxs)(bp.CardContent,{className:"flex flex-col items-center justify-center py-16",children:[(0,B.jsx)(J.Search,{className:"h-12 w-12 text-muted-foreground mb-4"}),(0,B.jsx)("h3",{className:"text-lg font-semibold mb-2",children:p("readyToRecall")}),(0,B.jsx)("p",{className:"text-muted-foreground text-center max-w-md",children:p("readyToRecallDescription")})]})}),ak&&(0,B.jsx)("div",{className:"fixed right-0 top-0 h-screen w-[420px] bg-card border-l shadow-2xl z-50 overflow-y-auto",children:(0,B.jsx)(wl,{memory:ak,onClose:()=>al(null),inPanel:!0,bankId:q||void 0})})]}):(0,B.jsx)(bp.Card,{className:"border-dashed",children:(0,B.jsxs)(bp.CardContent,{className:"flex flex-col items-center justify-center py-16",children:[(0,B.jsx)(M,{className:"h-12 w-12 text-muted-foreground mb-4"}),(0,B.jsx)("h3",{className:"text-xl font-semibold mb-2",children:p("noBankSelected")}),(0,B.jsx)("p",{className:"text-muted-foreground",children:p("noBankSelectedDescription")})]})})}let PM=(0,K.default)("target",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);var PN=a.i(83604),PN=PN,bc=bc;let PO=["skepticism","literalism","empathy"];function PP(){let a=(0,E.useTranslations)("bankProfile");return{skepticism:{label:a("skepticismLabel"),shortLabel:"S",description:a("skepticismDescription"),lowLabel:a("skepticismLow"),highLabel:a("skepticismHigh")},literalism:{label:a("literalismLabel"),shortLabel:"L",description:a("literalismDescription"),lowLabel:a("literalismLow"),highLabel:a("literalismHigh")},empathy:{label:a("empathyLabel"),shortLabel:"E",description:a("empathyDescription"),lowLabel:a("empathyLow"),highLabel:a("empathyHigh")}}}function PQ({hideReflectFields:a=!1}){let b=(0,D.useRouter)(),c=(0,E.useTranslations)("bankProfile"),d=(0,E.useTranslations)("common"),e=(0,E.useTranslations)("bank"),f=PP(),{currentBank:g,setCurrentBank:h,loadBanks:i}=(0,H.useBank)(),{features:j}=(0,IL.useFeatures)();j?.observations;let[k,l]=(0,C.useState)(null),[n,o]=(0,C.useState)(null),[p,q]=(0,C.useState)([]),[r,s]=(0,C.useState)(0),[t,u]=(0,C.useState)([]),[v,w]=(0,C.useState)(0),[x,y]=(0,C.useState)(!1),[z,A]=(0,C.useState)(!1),[G,I]=(0,C.useState)(!1),[J,K]=(0,C.useState)(!1),[L,M]=(0,C.useState)(null),[N,O]=(0,C.useState)(null),[P,Q]=(0,C.useState)(!1),[R,S]=(0,C.useState)(!1),[T,U]=(0,C.useState)(!1),[X,Y]=(0,C.useState)(!1),[Z,$]=(0,C.useState)(!1),[_,aa]=(0,C.useState)(!1),[ab,ac]=(0,C.useState)(null),[ae]=(0,C.useState)(10),[ag,ah]=(0,C.useState)(0),[ai,aj]=(0,C.useState)(null),ak=async(a=ab,b=ag)=>{if(g)try{let c=await V.client.listOperations(g,{status:a||void 0,limit:ae,offset:b});q(c.operations||[]),s(c.total||0)}catch(a){console.error("Error loading operations:",a)}},al=async(a=!1)=>{if(g){if(a){try{let[a,b,c]=await Promise.all([V.client.getBankStats(g),V.client.listDirectives(g),V.client.listMentalModels(g)]);o(a),u(b.items||[]),w(c.items?.length||0)}catch(a){console.error("Error refreshing stats:",a)}return}y(!0);try{let[a,b,c,d]=await Promise.all([V.client.getBankProfile(g),V.client.getBankStats(g),V.client.listDirectives(g),V.client.listMentalModels(g)]);l(a),o(b),u(c.items||[]),w(d.items?.length||0),await ak()}catch(a){}finally{y(!1)}}},am=async()=>{if(g){U(!0);try{await V.client.deleteBank(g),S(!1),h(null),await i(),b.push("/")}catch(a){}finally{U(!1)}}},an=async()=>{if(g){$(!0);try{let a=await V.client.clearObservations(g);Y(!1),await al(),F.toast.success("Success",{description:a.message||"Observations cleared successfully"})}catch(a){}finally{$(!1)}}},ao=async()=>{if(g&&N){Q(!0);try{await V.client.deleteDirective(g,N.id),u(a=>a.filter(a=>a.id!==N.id)),L?.id===N.id&&M(null),O(null)}catch(a){}finally{Q(!1)}}};return((0,C.useEffect)(()=>{if(g){al();let a=setInterval(()=>al(!0),5e3);return()=>clearInterval(a)}},[g]),(0,C.useEffect)(()=>{let a=a=>{"Escape"===a.key&&M(null)};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[]),g)?x&&!k?(0,B.jsx)(bp.Card,{children:(0,B.jsxs)(bp.CardContent,{className:"text-center py-10",children:[(0,B.jsx)(af,{className:"w-12 h-12 mx-auto mb-3 text-muted-foreground animate-pulse"}),(0,B.jsx)("div",{className:"text-lg text-muted-foreground",children:c("loadingProfile")})]})}):(0,B.jsxs)("div",{className:"space-y-6",children:[!a&&(0,B.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[(0,B.jsxs)(bp.Card,{children:[(0,B.jsx)(bp.CardHeader,{className:"pb-2",children:(0,B.jsxs)("div",{className:"flex items-start justify-between",children:[(0,B.jsxs)("div",{children:[(0,B.jsxs)(bp.CardTitle,{className:"flex items-center gap-2 text-lg",children:[(0,B.jsx)(JE,{className:"w-5 h-5 text-primary"}),c("dispositionProfileTitle")]}),(0,B.jsx)(bp.CardDescription,{children:c("editDispositionDescription")})]}),(0,B.jsx)(W.Button,{onClick:()=>A(!0),variant:"ghost",size:"sm",children:(0,B.jsx)(Jh,{className:"h-4 w-4"})})]})}),(0,B.jsx)(bp.CardContent,{children:k&&(0,B.jsx)("div",{className:"space-y-4",children:PO.map(a=>(0,B.jsxs)("div",{className:"space-y-2",children:[(0,B.jsxs)("div",{className:"flex justify-between items-center",children:[(0,B.jsxs)("div",{children:[(0,B.jsx)("label",{className:"text-sm font-medium text-foreground",children:f[a].label}),(0,B.jsx)("p",{className:"text-xs text-muted-foreground",children:f[a].description})]}),(0,B.jsxs)("span",{className:"text-sm font-bold text-primary",children:[k.disposition[a],"/5"]})]}),(0,B.jsxs)("div",{className:"flex items-center gap-2",children:[(0,B.jsx)("span",{className:"text-xs text-muted-foreground",children:f[a].lowLabel}),(0,B.jsx)("div",{className:"flex-1 h-2 bg-muted rounded-full overflow-hidden",children:(0,B.jsx)("div",{className:"h-full bg-primary rounded-full transition-all",style:{width:`${(k.disposition[a]-1)/4*100}%`}})}),(0,B.jsx)("span",{className:"text-xs text-muted-foreground",children:f[a].highLabel})]})]},a))})})]}),(0,B.jsxs)(bp.Card,{children:[(0,B.jsx)(bp.CardHeader,{className:"pb-2",children:(0,B.jsxs)("div",{className:"flex items-start justify-between",children:[(0,B.jsxs)("div",{children:[(0,B.jsxs)(bp.CardTitle,{className:"flex items-center gap-2 text-lg",children:[(0,B.jsx)(PM,{className:"w-5 h-5 text-primary"}),c("missionTitle")]}),(0,B.jsx)(bp.CardDescription,{children:c("editMissionDescription")})]}),(0,B.jsx)(W.Button,{onClick:()=>I(!0),variant:"ghost",size:"sm",children:(0,B.jsx)(Jh,{className:"h-4 w-4"})})]})}),(0,B.jsx)(bp.CardContent,{children:(0,B.jsx)("p",{className:"text-sm text-foreground whitespace-pre-wrap leading-relaxed",children:k?.mission||c("noMissionSet")})})]})]}),(0,B.jsxs)("div",{className:"space-y-4",children:[(0,B.jsxs)("div",{className:"flex items-center justify-between",children:[(0,B.jsxs)("div",{children:[(0,B.jsxs)("h3",{className:"text-lg font-semibold flex items-center gap-2",children:[(0,B.jsx)(PN.default,{className:"w-5 h-5 text-rose-500"}),c("directivesTitle")]}),(0,B.jsx)("p",{className:"text-sm text-muted-foreground",children:c("directivesDescription")})]}),(0,B.jsxs)(W.Button,{onClick:()=>K(!0),variant:"outline",size:"sm",className:"h-8",children:[(0,B.jsx)(II.Plus,{className:"w-4 h-4 mr-1"}),c("addDirective")]})]}),t.length>0?(0,B.jsx)("div",{className:"grid grid-cols-2 gap-3",children:t.map(a=>(0,B.jsx)(bp.Card,{className:`cursor-pointer transition-colors border-rose-500/30 ${L?.id===a.id?"bg-rose-500/10 border-rose-500":"hover:bg-rose-500/5"}`,onClick:()=>M(a),children:(0,B.jsx)(bp.CardContent,{className:"p-3",children:(0,B.jsxs)("div",{className:"flex items-start gap-2",children:[(0,B.jsx)(PN.default,{className:"w-4 h-4 text-rose-500 shrink-0 mt-0.5"}),(0,B.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,B.jsx)("span",{className:"font-medium text-sm text-foreground",children:a.name}),(0,B.jsx)("p",{className:"text-xs text-muted-foreground line-clamp-2 mt-1",children:a.content}),a.tags&&a.tags.length>0&&(0,B.jsxs)("div",{className:"flex items-center gap-1 mt-2 flex-wrap",children:[(0,B.jsx)(a7,{className:"w-3 h-3 text-muted-foreground"}),a.tags.map(a=>(0,B.jsx)("span",{className:"text-xs px-1.5 py-0.5 rounded bg-muted text-muted-foreground",children:a},a))]})]})]})})},a.id))}):(0,B.jsxs)("div",{className:"p-6 border border-dashed border-rose-500/30 rounded-lg text-center",children:[(0,B.jsx)(PN.default,{className:"w-6 h-6 mx-auto mb-2 text-rose-500/50"}),(0,B.jsx)("p",{className:"text-sm text-muted-foreground",children:c("noDirectivesMessage")})]})]}),(0,B.jsx)(IU,{open:R,onOpenChange:S,children:(0,B.jsxs)(I9,{children:[(0,B.jsxs)(Ja,{children:[(0,B.jsx)(Jc,{children:e("deleteMemoryBank")}),(0,B.jsx)(Jd,{asChild:!0,children:(0,B.jsxs)("div",{className:"space-y-2 text-sm text-muted-foreground",children:[(0,B.jsx)("p",{children:e.rich("deleteBankPrompt",{bankName:()=>(0,B.jsx)("span",{className:"font-semibold text-foreground",children:g})})}),(0,B.jsx)("p",{className:"text-red-600 dark:text-red-400 font-medium",children:e("deleteBankWarning")}),n&&(0,B.jsx)("p",{children:e("deleteWillDeleteDetails",{memories:n.total_nodes,documents:n.total_documents,links:n.total_links})})]})})]}),(0,B.jsxs)(Jb,{children:[(0,B.jsx)(Jf,{disabled:T,children:d("cancel")}),(0,B.jsx)(Je,{onClick:am,disabled:T,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:T?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(ad,{className:"w-4 h-4 mr-2 animate-spin"}),e("deleting")]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Jg,{className:"w-4 h-4 mr-2"}),e("deleteBank")]})})]})]})}),(0,B.jsx)(IU,{open:X,onOpenChange:Y,children:(0,B.jsxs)(I9,{children:[(0,B.jsxs)(Ja,{children:[(0,B.jsx)(Jc,{children:e("clearObservationsTitle")}),(0,B.jsx)(Jd,{asChild:!0,children:(0,B.jsxs)("div",{className:"space-y-2 text-sm text-muted-foreground",children:[(0,B.jsx)("p",{children:e.rich("clearObservationsPrompt",{bankName:()=>(0,B.jsx)("span",{className:"font-semibold text-foreground",children:g})})}),(0,B.jsx)("p",{className:"text-amber-600 dark:text-amber-400 font-medium",children:e("clearObservationsWarning")}),n&&n.total_observations>0&&(0,B.jsx)("p",{children:e("deleteWillDeleteObservations",{count:n.total_observations})})]})})]}),(0,B.jsxs)(Jb,{children:[(0,B.jsx)(Jf,{disabled:Z,children:d("cancel")}),(0,B.jsx)(Je,{onClick:an,disabled:Z,className:"bg-amber-500 text-white hover:bg-amber-600",children:Z?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(bc.default,{className:"w-4 h-4 mr-2 animate-spin"}),e("clearing")]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Jg,{className:"w-4 h-4 mr-2"}),e("clearObservations")]})})]})]})}),(0,B.jsx)(PT,{open:J,mode:"create",onClose:()=>K(!1),onCreated:a=>{u(b=>[a,...b]),K(!1)}}),(0,B.jsx)(IU,{open:!!N,onOpenChange:a=>!a&&O(null),children:(0,B.jsxs)(I9,{children:[(0,B.jsxs)(Ja,{children:[(0,B.jsx)(Jc,{children:c("deleteDirectiveTitle")}),(0,B.jsxs)(Jd,{children:[c("deleteDirectiveConfirm",{name:`"${N?.name??""}"`}),(0,B.jsx)("br",{}),(0,B.jsx)("br",{}),(0,B.jsx)("span",{className:"text-destructive font-semibold",children:c("deleteDirectiveWarning")})]})]}),(0,B.jsxs)(Jb,{className:"flex-row justify-end space-x-2",children:[(0,B.jsx)(Jf,{className:"mt-0",children:d("cancel")}),(0,B.jsxs)(Je,{onClick:ao,disabled:P,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:[P?(0,B.jsx)(bc.default,{className:"w-4 h-4 animate-spin mr-1"}):null,d("delete")]})]})]})}),L&&(0,B.jsx)(PU,{directive:L,onClose:()=>M(null),onDelete:()=>O({id:L.id,name:L.name}),onUpdated:a=>{u(b=>b.map(b=>b.id===a.id?a:b)),M(a)}}),z&&k&&(0,B.jsx)(PR,{disposition:k.disposition,onClose:()=>A(!1),onSaved:async()=>{await al(),A(!1)}}),G&&k&&(0,B.jsx)(PS,{mission:k.mission||"",onClose:()=>I(!1),onSaved:async()=>{await al(),I(!1)}})]}):(0,B.jsx)(bp.Card,{children:(0,B.jsxs)(bp.CardContent,{className:"p-10 text-center",children:[(0,B.jsx)("h3",{className:"text-xl font-semibold mb-2 text-card-foreground",children:c("noBankSelected")}),(0,B.jsx)("p",{className:"text-muted-foreground",children:c("noBankSelectedDescription")})]})})}function PR({disposition:a,onClose:b,onSaved:c}){let d=(0,E.useTranslations)("bankProfile"),e=PP(),{currentBank:f}=(0,H.useBank)(),[g,h]=(0,C.useState)(!1),[i,j]=(0,C.useState)(a),k=async()=>{if(f){h(!0);try{await V.client.updateBankConfig(f,{disposition_skepticism:i.skepticism,disposition_literalism:i.literalism,disposition_empathy:i.empathy}),c()}catch(a){}finally{h(!1)}}};return(0,B.jsx)(bf.Dialog,{open:!0,onOpenChange:b,children:(0,B.jsxs)(bf.DialogContent,{className:"max-w-xl",children:[(0,B.jsxs)(bf.DialogHeader,{children:[(0,B.jsx)(bf.DialogTitle,{children:d("editDispositionTitle")}),(0,B.jsx)(bf.DialogDescription,{children:d("editDispositionDescription")})]}),(0,B.jsx)("div",{className:"space-y-4 py-4",children:PO.map(a=>(0,B.jsxs)("div",{className:"space-y-2",children:[(0,B.jsxs)("div",{className:"flex justify-between items-center",children:[(0,B.jsxs)("div",{children:[(0,B.jsx)("label",{className:"text-sm font-medium text-foreground",children:e[a].label}),(0,B.jsx)("p",{className:"text-xs text-muted-foreground",children:e[a].description})]}),(0,B.jsxs)("span",{className:"text-sm font-bold text-primary",children:[i[a],"/5"]})]}),(0,B.jsxs)("div",{className:"flex justify-between text-[10px] text-muted-foreground",children:[(0,B.jsx)("span",{children:e[a].lowLabel}),(0,B.jsx)("span",{children:e[a].highLabel})]}),(0,B.jsx)("input",{type:"range",min:"1",max:"5",step:"1",value:i[a],onChange:b=>j(c=>({...c,[a]:parseInt(b.target.value)})),className:"w-full h-2 bg-muted rounded-lg appearance-none cursor-pointer accent-primary"})]},a))}),(0,B.jsxs)(bf.DialogFooter,{children:[(0,B.jsx)(W.Button,{onClick:b,variant:"outline",disabled:g,children:d("cancel")}),(0,B.jsx)(W.Button,{onClick:k,disabled:g,children:g?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(ad,{className:"w-4 h-4 mr-2 animate-spin"}),d("saving")]}):d("saveChanges")})]})]})})}function PS({mission:a,onClose:b,onSaved:c}){let d=(0,E.useTranslations)("bankProfile"),{currentBank:e}=(0,H.useBank)(),[f,g]=(0,C.useState)(!1),[h,i]=(0,C.useState)(a),j=async()=>{if(e){g(!0);try{await V.client.updateBankConfig(e,{reflect_mission:h||null}),c()}catch(a){}finally{g(!1)}}};return(0,B.jsx)(bf.Dialog,{open:!0,onOpenChange:b,children:(0,B.jsxs)(bf.DialogContent,{className:"max-w-xl",children:[(0,B.jsxs)(bf.DialogHeader,{children:[(0,B.jsx)(bf.DialogTitle,{children:d("editMissionTitle")}),(0,B.jsx)(bf.DialogDescription,{children:d("editMissionDescription")})]}),(0,B.jsx)("div",{className:"space-y-2 py-4",children:(0,B.jsx)(JI.Textarea,{value:h,onChange:a=>i(a.target.value),placeholder:d("missionPlaceholder"),rows:8,className:"resize-none"})}),(0,B.jsxs)(bf.DialogFooter,{children:[(0,B.jsx)(W.Button,{onClick:b,variant:"outline",disabled:f,children:d("cancel")}),(0,B.jsx)(W.Button,{onClick:j,disabled:f,children:f?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(ad,{className:"w-4 h-4 mr-2 animate-spin"}),d("saving")]}):d("saveChanges")})]})]})})}function PT({open:a,mode:b,directive:c,onClose:d,onCreated:e,onSaved:f}){let g=(0,E.useTranslations)("bankProfile"),{currentBank:h}=(0,H.useBank)(),[i,j]=(0,C.useState)(!1),[k,l]=(0,C.useState)({name:"",content:"",tags:""});(0,C.useEffect)(()=>{"edit"===b&&c?l({name:c.name,content:c.content,tags:(c.tags||[]).join(", ")}):"create"===b&&l({name:"",content:"",tags:""})},[a,b,c]);let n=async()=>{if(h&&k.name.trim()&&k.content.trim()){j(!0);try{let a=k.tags.split(",").map(a=>a.trim()).filter(a=>a.length>0);if("create"===b){let b=await V.client.createDirective(h,{name:k.name.trim(),content:k.content.trim(),tags:a.length>0?a:void 0});l({name:"",content:"",tags:""}),e?.(b)}else if(c){let b=await V.client.updateDirective(h,c.id,{name:k.name.trim(),content:k.content.trim(),tags:a});f?.(b),d()}}catch(a){}finally{j(!1)}}},o=()=>{"create"===b&&l({name:"",content:"",tags:""}),d()};return(0,B.jsx)(bf.Dialog,{open:a,onOpenChange:a=>!a&&o(),children:(0,B.jsxs)(bf.DialogContent,{className:"sm:max-w-lg",children:[(0,B.jsxs)(bf.DialogHeader,{children:[(0,B.jsxs)(bf.DialogTitle,{className:"flex items-center gap-2",children:[(0,B.jsx)(PN.default,{className:"w-5 h-5 text-rose-500"}),g("create"===b?"directiveFormCreateTitle":"directiveFormEditTitle")]}),(0,B.jsx)(bf.DialogDescription,{children:g("directiveFormDescription")})]}),(0,B.jsxs)("div",{className:"space-y-4 py-4",children:[(0,B.jsxs)("div",{className:"space-y-2",children:[(0,B.jsx)("label",{className:"text-sm font-medium text-foreground",children:g("directiveNameLabel")}),(0,B.jsx)(X.Input,{value:k.name,onChange:a=>l({...k,name:a.target.value}),placeholder:g("directiveNamePlaceholder")})]}),(0,B.jsxs)("div",{className:"space-y-2",children:[(0,B.jsx)("label",{className:"text-sm font-medium text-foreground",children:g("directiveRuleLabel")}),(0,B.jsx)(JI.Textarea,{value:k.content,onChange:a=>l({...k,content:a.target.value}),placeholder:g("directiveRulePlaceholder"),className:"min-h-[120px]"})]}),(0,B.jsxs)("div",{className:"space-y-2",children:[(0,B.jsxs)("label",{className:"text-sm font-medium text-foreground",children:[g("directiveTagsLabel")," ",(0,B.jsx)("span",{className:"text-muted-foreground font-normal",children:g("directiveTagsOptional")})]}),(0,B.jsx)(X.Input,{value:k.tags,onChange:a=>l({...k,tags:a.target.value}),placeholder:g("directiveTagsPlaceholder")})]})]}),(0,B.jsxs)(bf.DialogFooter,{children:[(0,B.jsx)(W.Button,{variant:"outline",onClick:o,disabled:i,children:g("cancel")}),(0,B.jsxs)(W.Button,{onClick:n,disabled:i||!k.name.trim()||!k.content.trim(),className:"bg-rose-500 hover:bg-rose-600",children:[i?(0,B.jsx)(bc.default,{className:"w-4 h-4 animate-spin mr-1"}):null,g("create"===b?"create":"save")]})]})]})})}function PU({directive:a,onClose:b,onDelete:c,onUpdated:d}){let e=(0,E.useTranslations)("bankProfile"),[f,g]=(0,C.useState)(!1);return(0,B.jsxs)("div",{className:"fixed right-0 top-0 h-screen w-1/2 bg-card border-l-2 border-rose-500 shadow-2xl z-50 overflow-y-auto animate-in slide-in-from-right duration-300 ease-out",children:[(0,B.jsxs)("div",{className:"p-6",children:[(0,B.jsxs)("div",{className:"flex justify-between items-start mb-8 pb-5 border-b border-border",children:[(0,B.jsxs)("div",{className:"flex items-start gap-3",children:[(0,B.jsx)(PN.default,{className:"w-5 h-5 text-rose-500"}),(0,B.jsxs)("div",{children:[(0,B.jsxs)("div",{className:"flex items-center gap-2",children:[(0,B.jsx)("h3",{className:"text-xl font-bold text-foreground",children:a.name}),(0,B.jsx)(W.Button,{variant:"ghost",size:"sm",onClick:()=>g(!0),className:"h-7 w-7 p-0",children:(0,B.jsx)(Jh,{className:"h-3.5 w-3.5"})})]}),(0,B.jsx)("span",{className:"text-xs px-1.5 py-0.5 rounded bg-rose-500/10 text-rose-600 dark:text-rose-400",children:e("directiveDetailBadge")})]})]}),(0,B.jsxs)("div",{className:"flex items-center gap-2",children:[(0,B.jsx)(W.Button,{variant:"ghost",size:"sm",onClick:c,className:"h-8 w-8 p-0 text-muted-foreground hover:text-rose-500",children:(0,B.jsx)(Jg,{className:"h-4 w-4"})}),(0,B.jsx)(W.Button,{variant:"ghost",size:"sm",onClick:b,className:"h-8 w-8 p-0",children:(0,B.jsx)(bb.X,{className:"h-4 w-4"})})]})]}),(0,B.jsxs)("div",{className:"space-y-6",children:[(0,B.jsxs)("div",{children:[(0,B.jsx)("div",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-3",children:e("directiveDetailRuleLabel")}),(0,B.jsx)("div",{className:"prose prose-base dark:prose-invert max-w-none",children:(0,B.jsx)(NR,{remarkPlugins:[Pk],children:a.content})})]}),a.tags&&a.tags.length>0&&(0,B.jsxs)("div",{children:[(0,B.jsx)("div",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-3",children:e("directiveDetailTagsLabel")}),(0,B.jsx)("div",{className:"flex flex-wrap gap-2",children:a.tags.map(a=>(0,B.jsx)("span",{className:"px-2 py-1 rounded bg-muted text-muted-foreground text-sm",children:a},a))})]}),(0,B.jsxs)("div",{children:[(0,B.jsx)("div",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-2",children:e("directiveDetailIdLabel")}),(0,B.jsx)("code",{className:"text-sm font-mono break-all text-muted-foreground",children:a.id})]})]})]}),(0,B.jsx)(PT,{open:f,mode:"edit",directive:a,onClose:()=>g(!1),onSaved:d})]})}let PV=(0,as.cva)("relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),PW=C.forwardRef(({className:a,variant:b,...c},d)=>(0,B.jsx)("div",{ref:d,role:"alert",className:(0,S.cn)(PV({variant:b}),a),...c}));PW.displayName="Alert",C.forwardRef(({className:a,...b},c)=>(0,B.jsx)("h5",{ref:c,className:(0,S.cn)("mb-1 font-medium leading-none tracking-tight",a),...b})).displayName="AlertTitle";let PX=C.forwardRef(({className:a,...b},c)=>(0,B.jsx)("div",{ref:c,className:(0,S.cn)("text-sm [&_p]:leading-relaxed",a),...b}));PX.displayName="AlertDescription";var bc=bc;let PY=(0,K.default)("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]),PZ=["HARM_CATEGORY_HARASSMENT","HARM_CATEGORY_HATE_SPEECH","HARM_CATEGORY_SEXUALLY_EXPLICIT","HARM_CATEGORY_DANGEROUS_CONTENT"].map(a=>({category:a,threshold:"BLOCK_NONE"})),P$=["retain","sync_retain","recall","reflect","list_banks","create_bank","get_bank","get_bank_stats","update_bank","delete_bank","clear_memories","list_mental_models","get_mental_model","create_mental_model","update_mental_model","delete_mental_model","refresh_mental_model","clear_mental_model","list_directives","create_directive","delete_directive","list_memories","get_memory","list_documents","get_document","delete_document","list_operations","get_operation","cancel_operation","list_tags"];function P_(a){return Array.isArray(a)?a:a&&"object"==typeof a&&Array.isArray(a.attributes)?a.attributes:null}function P0(a){return{retain_chunk_size:a.retain_chunk_size??null,retain_extraction_mode:a.retain_extraction_mode??null,retain_mission:a.retain_mission??null,retain_custom_instructions:a.retain_custom_instructions??null,entities_allow_free_form:a.entities_allow_free_form??null,entity_labels:P_(a.entity_labels)}}function P1(a){return{retain_default_strategy:a.retain_default_strategy??null,retain_strategies:a.retain_strategies??null}}function P2(a){return{enable_observations:a.enable_observations??null,consolidation_llm_batch_size:a.consolidation_llm_batch_size??null,consolidation_source_facts_max_tokens:a.consolidation_source_facts_max_tokens??null,consolidation_source_facts_max_tokens_per_observation:a.consolidation_source_facts_max_tokens_per_observation??null,observations_mission:a.observations_mission??null,max_observations_per_scope:a.max_observations_per_scope??null}}function P3(a){return{mcp_enabled_tools:a.mcp_enabled_tools??null}}function P4(a){return{llm_gemini_safety_settings:a.llm_gemini_safety_settings??null}}let P5={reflect_mission:"",disposition_skepticism:3,disposition_literalism:3,disposition_empathy:3};function P6(){let a=(0,E.useTranslations)("bankConfig"),{currentBank:b}=(0,H.useBank)(),{features:c}=(0,IL.useFeatures)(),d=c?.bank_config_api??!0,[e,f]=(0,C.useState)(!0),[g,h]=(0,C.useState)({}),[i,j]=(0,C.useState)(P5),[k,l]=(0,C.useState)(P0({})),[n,o]=(0,C.useState)(P1({})),[p,q]=(0,C.useState)(P2({})),[r,s]=(0,C.useState)(P5),[t,u]=(0,C.useState)(P3({})),[v,w]=(0,C.useState)(P4({})),[x,y]=(0,C.useState)(!1),[z,A]=(0,C.useState)(!1),[D,F]=(0,C.useState)(!1),[G,I]=(0,C.useState)(!1),[J,K]=(0,C.useState)(!1),[L,M]=(0,C.useState)(null),[N,O]=(0,C.useState)(null),[P,Q]=(0,C.useState)(null),[R,S]=(0,C.useState)(null),[T,U]=(0,C.useState)(null),W=(0,C.useMemo)(()=>JSON.stringify(k)!==JSON.stringify(P0(g))||JSON.stringify(n)!==JSON.stringify(P1(g)),[k,n,g]),Y=(0,C.useMemo)(()=>JSON.stringify(p)!==JSON.stringify(P2(g)),[p,g]),Z=(0,C.useMemo)(()=>JSON.stringify(r)!==JSON.stringify(i),[r,i]),$=(0,C.useMemo)(()=>JSON.stringify(t)!==JSON.stringify(P3(g)),[t,g]),_=(0,C.useMemo)(()=>JSON.stringify(v)!==JSON.stringify(P4(g)),[v,g]);(0,C.useEffect)(()=>{b&&aa()},[b]);let aa=async()=>{if(b){f(!0);try{let[a,c]=await Promise.all([V.client.getBankConfig(b),V.client.getBankProfile(b)]),d=a.config,e={reflect_mission:c.mission??"",disposition_skepticism:d.disposition_skepticism??c.disposition?.skepticism??3,disposition_literalism:d.disposition_literalism??c.disposition?.literalism??3,disposition_empathy:d.disposition_empathy??c.disposition?.empathy??3};h(d),j(e),l(P0(d)),o(P1(d)),q(P2(d)),s(e),u(P3(d)),w(P4(d))}catch(a){console.error("Failed to load bank data:",a)}finally{f(!1)}}},ab=async()=>{if(b){y(!0),M(null);try{let a={...k,...n};await V.client.updateBankConfig(b,a),h(b=>({...b,...a}))}catch(b){M(b.message||a("retainFailedToSave"))}finally{y(!1)}}},ac=async()=>{if(b){A(!0),O(null);try{await V.client.updateBankConfig(b,p),h(a=>({...a,...p}))}catch(b){O(b.message||a("observationsFailedToSave"))}finally{A(!1)}}},ad=async()=>{if(b){F(!0),Q(null);try{await V.client.updateBankConfig(b,{reflect_mission:r.reflect_mission||null,disposition_skepticism:r.disposition_skepticism,disposition_literalism:r.disposition_literalism,disposition_empathy:r.disposition_empathy}),j(r)}catch(b){Q(b.message||a("reflectFailedToSave"))}finally{F(!1)}}},ae=async()=>{if(b){I(!0),S(null);try{await V.client.updateBankConfig(b,t),h(a=>({...a,...t}))}catch(b){S(b.message||a("mcpFailedToSave"))}finally{I(!1)}}},af=async()=>{if(b){K(!0),U(null);try{await V.client.updateBankConfig(b,v),h(a=>({...a,...v}))}catch(b){U(b.message||a("geminiFailedToSave"))}finally{K(!1)}}};return b?d?e?(0,B.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,B.jsx)(bc.default,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):(0,B.jsx)(B.Fragment,{children:(0,B.jsxs)("div",{className:"space-y-8",children:[(0,B.jsxs)(Qd,{title:a("retainTitle"),description:a("retainSectionDescription"),error:L,dirty:W,saving:x,onSave:ab,children:[(0,B.jsx)(Qe,{label:a("defaultStrategyLabel"),description:a("defaultStrategyDescription"),children:(0,B.jsxs)(a6.Select,{value:n.retain_default_strategy??"__none__",onValueChange:a=>o(b=>({...b,retain_default_strategy:"__none__"===a?null:a})),children:[(0,B.jsx)(a6.SelectTrigger,{className:"w-full",children:(0,B.jsx)(a6.SelectValue,{})}),(0,B.jsxs)(a6.SelectContent,{children:[(0,B.jsx)(a6.SelectItem,{value:"__none__",children:(0,B.jsx)("span",{className:"text-muted-foreground italic",children:a("default")})}),Object.keys(n.retain_strategies??{}).map(a=>(0,B.jsx)(a6.SelectItem,{value:a,children:a},a))]})]})}),(0,B.jsx)(Qb,{defaultValues:k,onDefaultChange:a=>l(b=>({...b,...a})),strategies:n.retain_strategies,onStrategiesChange:a=>o(b=>({...b,retain_strategies:a}))})]}),(0,B.jsxs)(Qd,{title:a("observationsTitle"),description:a("observationsDescription"),error:N,dirty:Y,saving:z,onSave:ac,children:[(0,B.jsx)(Qe,{label:a("enableObservationsLabel"),description:a("enableObservationsDescription"),children:(0,B.jsx)("div",{className:"flex justify-end",children:(0,B.jsx)(a5.Switch,{checked:p.enable_observations??!1,onCheckedChange:a=>q(b=>({...b,enable_observations:a}))})})}),(0,B.jsx)(Qf,{label:a("missionLabel"),description:a("observationsMissionDescription"),value:p.observations_mission??"",onChange:a=>q(b=>({...b,observations_mission:a||null})),placeholder:a("observationsMissionPlaceholder"),rows:3}),(0,B.jsx)(Qe,{label:a("llmBatchSizeLabel"),description:a("llmBatchSizeDescription"),children:(0,B.jsx)(X.Input,{type:"number",min:1,max:64,value:p.consolidation_llm_batch_size??"",onChange:a=>q(b=>({...b,consolidation_llm_batch_size:a.target.value?parseInt(a.target.value,10):null})),placeholder:a("serverDefault")})}),(0,B.jsx)(Qe,{label:a("sourceFactsMaxTokensLabel"),description:a("sourceFactsMaxTokensDescription"),children:(0,B.jsx)(X.Input,{type:"number",min:-1,value:p.consolidation_source_facts_max_tokens??"",onChange:a=>q(b=>({...b,consolidation_source_facts_max_tokens:a.target.value?parseInt(a.target.value,10):null})),placeholder:a("serverDefault")})}),(0,B.jsx)(Qe,{label:a("sourceFactsMaxTokensPerObservationLabel"),description:a("sourceFactsMaxTokensPerObservationDescription"),children:(0,B.jsx)(X.Input,{type:"number",min:-1,value:p.consolidation_source_facts_max_tokens_per_observation??"",onChange:a=>q(b=>({...b,consolidation_source_facts_max_tokens_per_observation:a.target.value?parseInt(a.target.value,10):null})),placeholder:a("serverDefault")})}),(0,B.jsx)(Qe,{label:a("maxObservationsPerScopeLabel"),description:a("maxObservationsPerScopeDescription"),children:(0,B.jsx)(X.Input,{type:"number",min:-1,value:p.max_observations_per_scope??"",onChange:a=>q(b=>({...b,max_observations_per_scope:a.target.value?parseInt(a.target.value,10):null})),placeholder:a("serverDefault")})})]}),(0,B.jsxs)(Qd,{title:a("reflectTitle"),description:a("reflectDescription"),error:P,dirty:Z,saving:D,onSave:ad,children:[(0,B.jsx)(Qf,{label:a("missionLabel"),description:a("reflectMissionDescription"),value:r.reflect_mission,onChange:a=>s(b=>({...b,reflect_mission:a})),placeholder:a("reflectMissionPlaceholder"),rows:3}),(0,B.jsx)(Qg,{label:a("skepticismLabel"),description:a("skepticismDescription"),lowLabel:a("skepticismLowLabel"),highLabel:a("skepticismHighLabel"),value:r.disposition_skepticism,onChange:a=>s(b=>({...b,disposition_skepticism:a}))}),(0,B.jsx)(Qg,{label:a("literalismLabel"),description:a("literalismDescription"),lowLabel:a("literalismLowLabel"),highLabel:a("literalismHighLabel"),value:r.disposition_literalism,onChange:a=>s(b=>({...b,disposition_literalism:a}))}),(0,B.jsx)(Qg,{label:a("empathyLabel"),description:a("empathyDescription"),lowLabel:a("empathyLowLabel"),highLabel:a("empathyHighLabel"),value:r.disposition_empathy,onChange:a=>s(b=>({...b,disposition_empathy:a}))})]}),(0,B.jsxs)(Qd,{title:a("mcpToolsTitle"),description:a("mcpToolsDescription"),error:R,dirty:$,saving:G,onSave:ae,children:[(0,B.jsx)(Qe,{label:a("restrictToolsLabel"),description:a("restrictToolsDescription"),children:(0,B.jsxs)("div",{className:"flex items-center gap-2 justify-end",children:[(0,B.jsx)(a5.Switch,{checked:null!==t.mcp_enabled_tools,onCheckedChange:a=>u({mcp_enabled_tools:a?[...P$]:null})}),(0,B.jsx)(au,{className:"text-xs text-muted-foreground",children:null!==t.mcp_enabled_tools?a("enabled"):a("disabled")})]})}),null!==t.mcp_enabled_tools&&(0,B.jsx)(Qc,{selected:t.mcp_enabled_tools,onChange:a=>u({mcp_enabled_tools:a})})]}),(0,B.jsx)(Qd,{title:a("modelsTitle"),description:a("modelsDescription"),error:T,dirty:_,saving:J,onSave:af,children:(0,B.jsxs)("div",{className:"px-6 py-4 space-y-4",children:[(0,B.jsx)("p",{className:"text-sm font-semibold",children:a("geminiSubsectionTitle")}),(0,B.jsxs)("div",{className:"pl-4 border-l-2 border-border/40 space-y-4",children:[(0,B.jsx)(Qe,{label:a("safetySettingsLabel"),description:(0,B.jsxs)(B.Fragment,{children:[a("safetySettingsDescriptionPart1")," ",(0,B.jsx)("a",{href:"https://ai.google.dev/gemini-api/docs/safety-settings",target:"_blank",rel:"noopener noreferrer",className:"underline hover:text-foreground transition-colors",children:a("safetySettingsLearnMore")})]}),children:(0,B.jsxs)("div",{className:"flex items-center gap-2 justify-end",children:[(0,B.jsx)(a5.Switch,{checked:null!==v.llm_gemini_safety_settings,onCheckedChange:a=>w({llm_gemini_safety_settings:a?[...PZ]:null})}),(0,B.jsx)(au,{className:"text-xs text-muted-foreground",children:null!==v.llm_gemini_safety_settings?a("custom"):a("default")})]})}),null!==v.llm_gemini_safety_settings&&(0,B.jsx)(Qj,{value:v.llm_gemini_safety_settings,onChange:a=>w({llm_gemini_safety_settings:a})})]})]})})]})}):(0,B.jsxs)("div",{className:"flex flex-col items-center justify-center py-16 gap-3 text-center",children:[(0,B.jsx)("p",{className:"text-base font-medium text-foreground",children:a("apiDisabledTitle")}),(0,B.jsx)("p",{className:"text-sm text-muted-foreground max-w-sm",children:a.rich("apiDisabledDescription",{code:a=>(0,B.jsx)("code",{className:"font-mono text-xs bg-muted px-1 py-0.5 rounded",children:a})})})]}):(0,B.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,B.jsx)("p",{className:"text-muted-foreground",children:a("noBankSelected")})})}let P7=["concise","verbose","verbatim","chunks","custom"],P8="__inherit__";function P9({values:a,onChange:b,isOverride:c=!1}){let d=(0,E.useTranslations)("bankConfig"),e=a.retain_extraction_mode??(c?P8:""),f="custom"===a.retain_extraction_mode;return(0,B.jsxs)("div",{className:"divide-y divide-border/40",children:[(0,B.jsx)(Qe,{label:d("extractionModeLabel"),description:d("extractionModeDescription"),children:(0,B.jsxs)(a6.Select,{value:e,onValueChange:a=>b({retain_extraction_mode:a===P8?null:a||null}),children:[(0,B.jsx)(a6.SelectTrigger,{className:"w-full",children:(0,B.jsx)(a6.SelectValue,{placeholder:c?d("inherited"):void 0})}),(0,B.jsxs)(a6.SelectContent,{children:[c&&(0,B.jsx)(a6.SelectItem,{value:P8,children:(0,B.jsx)("span",{className:"text-muted-foreground italic",children:d("inherited")})}),P7.map(a=>(0,B.jsx)(a6.SelectItem,{value:a,children:a},a))]})]})}),(0,B.jsx)(Qe,{label:d("chunkSizeLabel"),description:d("chunkSizeDescription"),children:(0,B.jsx)(X.Input,{type:"number",min:500,max:8e3,value:a.retain_chunk_size??"",onChange:a=>b({retain_chunk_size:a.target.value?parseFloat(a.target.value):null}),placeholder:c?d("inherited"):void 0})}),(0,B.jsx)(Qf,{label:d("missionLabel"),description:d("retainMissionDescription"),value:a.retain_mission??"",onChange:a=>b({retain_mission:a||null}),placeholder:d(c?"inherited":"retainMissionPlaceholder"),rows:3}),f&&(0,B.jsx)(Qf,{label:d("customExtractionPromptLabel"),description:d("customExtractionPromptDescription"),value:a.retain_custom_instructions??"",onChange:a=>b({retain_custom_instructions:a||null}),rows:5}),(0,B.jsx)(Qe,{label:d("freeFormEntitiesLabel"),description:d("freeFormEntitiesDescription"),children:(0,B.jsxs)("div",{className:"flex justify-end items-center gap-2",children:[(0,B.jsx)(au,{className:"text-sm text-muted-foreground cursor-pointer select-none",children:d(a.entities_allow_free_form??!0?"enabled":"disabled")}),(0,B.jsx)(a5.Switch,{checked:a.entities_allow_free_form??!0,onCheckedChange:a=>b({entities_allow_free_form:a})})]})}),(0,B.jsx)(Qi,{value:a.entity_labels??[],onChange:a=>b({entity_labels:a.length>0?a:null})})]})}function Qa(a){return a?Object.entries(a).map(([a,b],c)=>({id:c,name:a,values:{retain_extraction_mode:b.retain_extraction_mode??null,retain_chunk_size:b.retain_chunk_size??null,retain_mission:b.retain_mission??null,retain_custom_instructions:b.retain_custom_instructions??null,entities_allow_free_form:b.entities_allow_free_form??null,entity_labels:P_(b.entity_labels)}})):[]}function Qb({defaultValues:a,onDefaultChange:b,strategies:c,onStrategiesChange:d}){let e=(0,E.useTranslations)("bankConfig"),f=(0,E.useTranslations)("common"),[g,h]=(0,C.useState)(()=>Qa(c)),[i,j]=(0,C.useState)("default"),[k,l]=(0,C.useState)(null),n=(0,C.useRef)(!1),o=JSON.stringify(c);(0,C.useEffect)(()=>{if(n.current){n.current=!1;return}h(Qa(c))},[o]);let p=a=>{n.current=!0,h(a),d(function(a){let b={};for(let c of a){if(!c.name.trim())continue;let a={};null!==c.values.retain_extraction_mode&&(a.retain_extraction_mode=c.values.retain_extraction_mode),null!==c.values.retain_chunk_size&&(a.retain_chunk_size=c.values.retain_chunk_size),c.values.retain_mission&&(a.retain_mission=c.values.retain_mission),c.values.retain_custom_instructions&&(a.retain_custom_instructions=c.values.retain_custom_instructions),null!==c.values.entities_allow_free_form&&(a.entities_allow_free_form=c.values.entities_allow_free_form),null!==c.values.entity_labels&&(a.entity_labels=c.values.entity_labels),b[c.name.trim()]=a}return Object.keys(b).length>0?b:null}(a))},q=(a,b)=>{p(g.map(c=>c.id===a?{...c,...b}:c))},r="default"!==i?g.find(a=>a.id===i):null;return(0,B.jsxs)("div",{children:[(0,B.jsxs)("div",{className:"border-b border-border px-6 flex items-stretch gap-1 flex-wrap",children:[(0,B.jsx)("button",{type:"button",onClick:()=>j("default"),className:`relative py-3 px-4 text-sm font-semibold transition-colors border-b-2 -mb-px ${"default"===i?"border-primary text-foreground":"border-transparent text-muted-foreground hover:text-foreground hover:border-border"}`,children:e("default")}),g.map(a=>(0,B.jsxs)("div",{className:`relative flex items-center gap-2 py-3 px-4 text-sm font-semibold transition-colors border-b-2 -mb-px cursor-pointer ${i===a.id?"border-primary text-foreground":"border-transparent text-muted-foreground hover:text-foreground hover:border-border"}`,onClick:()=>j(a.id),children:[(0,B.jsx)("span",{className:"font-mono",children:a.name||(0,B.jsx)("span",{className:"italic font-normal opacity-50",children:e("unnamed")})}),(0,B.jsx)("button",{type:"button",onClick:b=>{b.stopPropagation(),l(a)},className:"opacity-40 hover:opacity-100 hover:text-destructive transition-opacity text-base leading-none",children:"×"})]},a.id)),(0,B.jsxs)("button",{type:"button",onClick:()=>{let a=Date.now();p([...g,{id:a,name:"",values:{retain_extraction_mode:null,retain_chunk_size:null,retain_mission:null,retain_custom_instructions:null,entities_allow_free_form:null,entity_labels:null}}]),j(a)},className:"py-3 px-3 text-sm text-muted-foreground hover:text-primary transition-colors flex items-center gap-1.5",children:[(0,B.jsx)(II.Plus,{className:"h-3.5 w-3.5"}),e("addStrategy")]})]}),(0,B.jsx)("div",{children:"default"===i?(0,B.jsx)(P9,{values:a,onChange:b}):r?(0,B.jsxs)("div",{children:[(0,B.jsxs)("div",{className:"px-6 py-3 flex items-center gap-3 border-b border-border/40",children:[(0,B.jsx)("label",{className:"text-xs text-muted-foreground shrink-0",children:e("nameLabel")}),(0,B.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,B.jsx)(X.Input,{value:r.name,onChange:a=>q(r.id,{name:a.target.value}),placeholder:e("strategyNamePlaceholder"),className:`h-7 text-xs font-mono max-w-[200px] ${!r.name.trim()?"border-destructive focus-visible:ring-destructive":""}`}),!r.name.trim()&&(0,B.jsx)("p",{className:"text-xs text-destructive",children:e("nameIsRequired")})]})]}),(0,B.jsx)(P9,{values:r.values,onChange:a=>q(r.id,{values:{...r.values,...a}}),isOverride:!0})]}):null}),(0,B.jsx)(IU,{open:null!==k,onOpenChange:a=>{a||l(null)},children:(0,B.jsxs)(I9,{children:[(0,B.jsxs)(Ja,{children:[(0,B.jsx)(Jc,{children:e("deleteStrategyTitle",{name:k?.name||e("unnamed")})}),(0,B.jsx)(Jd,{children:e("deleteStrategyDescription")})]}),(0,B.jsxs)(Jb,{children:[(0,B.jsx)(Jf,{children:f("cancel")}),(0,B.jsx)(Je,{className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:()=>{if(k){var a;a=k.id,p(g.filter(b=>b.id!==a)),i===a&&j("default"),l(null)}},children:f("delete")})]})]})})]})}function Qc({selected:a,onChange:b}){let c=(0,E.useTranslations)("bankConfig"),d=[{key:"core",label:c("mcpGroupCore"),tools:["retain","sync_retain","recall","reflect"]},{key:"bankManagement",label:c("mcpGroupBankManagement"),tools:["list_banks","create_bank","get_bank","get_bank_stats","update_bank","delete_bank","clear_memories"]},{key:"mentalModels",label:c("mcpGroupMentalModels"),tools:["list_mental_models","get_mental_model","create_mental_model","update_mental_model","delete_mental_model","refresh_mental_model","clear_mental_model"]},{key:"directives",label:c("mcpGroupDirectives"),tools:["list_directives","create_directive","delete_directive"]},{key:"memories",label:c("mcpGroupMemories"),tools:["list_memories","get_memory"]},{key:"documents",label:c("mcpGroupDocuments"),tools:["list_documents","get_document","delete_document"]},{key:"operations",label:c("mcpGroupOperations"),tools:["list_operations","get_operation","cancel_operation"]},{key:"tags",label:c("mcpGroupTags"),tools:["list_tags"]}],e=new Set(a),f=P$.every(a=>e.has(a)),g=0===a.length;return(0,B.jsxs)("div",{className:"px-6 py-4 space-y-4",children:[(0,B.jsxs)("div",{className:"flex items-center justify-between",children:[(0,B.jsx)("p",{className:"text-xs text-muted-foreground",children:c("toolsEnabled",{selected:a.length,total:P$.length})}),(0,B.jsx)("button",{type:"button",onClick:()=>{b(f?[]:[...P$])},className:"text-xs text-primary hover:underline",children:f?c("deselectAll"):c("selectAll")})]}),(0,B.jsx)("div",{className:"space-y-4",children:d.map(a=>{let d=a.tools.filter(a=>e.has(a)).length===a.tools.length;return(0,B.jsxs)("div",{children:[(0,B.jsxs)("div",{className:"flex items-center justify-between mb-1.5",children:[(0,B.jsx)("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:a.label}),(0,B.jsx)("button",{type:"button",onClick:()=>{let c=new Set(e);d?a.tools.forEach(a=>c.delete(a)):a.tools.forEach(a=>c.add(a)),b(P$.filter(a=>c.has(a)))},className:"text-xs text-primary hover:underline",children:d?c("deselect"):c("selectAll")})]}),(0,B.jsx)("div",{className:"flex flex-wrap gap-2",children:a.tools.map(a=>{let c=e.has(a);return(0,B.jsx)("button",{type:"button",onClick:()=>{let c;(c=new Set(e)).has(a)?c.delete(a):c.add(a),b(P$.filter(a=>c.has(a)))},className:`px-2.5 py-1 rounded text-xs font-mono transition-colors border ${c?"bg-primary text-primary-foreground border-primary":"bg-muted/30 text-muted-foreground border-border/40 hover:border-primary/40"}`,children:a},a)})})]},a.key)})}),g&&(0,B.jsx)("p",{className:"text-xs text-destructive",children:c("noToolsWarning")})]})}function Qd({title:a,description:b,children:c,error:d,dirty:e,saving:f,onSave:g}){let h=(0,E.useTranslations)("bankConfig");return(0,B.jsxs)("section",{className:"space-y-3",children:[(0,B.jsxs)("div",{children:[(0,B.jsx)("h2",{className:"text-lg font-semibold",children:a}),(0,B.jsx)("p",{className:"text-sm text-muted-foreground",children:b})]}),(0,B.jsxs)(bp.Card,{className:"bg-muted/20 border-border/40",children:[(0,B.jsx)("div",{className:"divide-y divide-border/40",children:c}),d&&(0,B.jsx)("div",{className:"px-6 pb-2 pt-2",children:(0,B.jsxs)(PW,{variant:"destructive",children:[(0,B.jsx)(PY,{className:"h-4 w-4"}),(0,B.jsx)(PX,{children:d})]})}),(0,B.jsx)("div",{className:"px-6 py-4 flex justify-end border-t border-border/40",children:(0,B.jsx)(W.Button,{size:"sm",disabled:!e||f,onClick:g,children:f?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(bc.default,{className:"h-4 w-4 mr-2 animate-spin"}),h("saving")]}):h("saveChanges")})})]})]})}function Qe({label:a,description:b,children:c}){return(0,B.jsx)("div",{className:"px-6 py-4",children:(0,B.jsxs)("div",{className:"flex flex-col md:flex-row md:items-center md:justify-between gap-4",children:[(0,B.jsxs)("div",{className:"flex-1",children:[(0,B.jsx)("p",{className:"text-sm font-medium",children:a}),b&&(0,B.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:b})]}),(0,B.jsx)("div",{className:"md:w-64 shrink-0",children:c})]})})}function Qf({label:a,description:b,value:c,onChange:d,placeholder:e,rows:f}){return(0,B.jsx)("div",{className:"px-6 py-4",children:(0,B.jsxs)("div",{className:"space-y-2",children:[(0,B.jsxs)("div",{children:[(0,B.jsx)("p",{className:"text-sm font-medium",children:a}),b&&(0,B.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:b})]}),(0,B.jsx)(JI.Textarea,{value:c,onChange:a=>d(a.target.value),placeholder:e,rows:f??3,className:"font-mono text-sm"})]})})}function Qg({label:a,description:b,lowLabel:c,highLabel:d,value:e,onChange:f}){return(0,B.jsx)("div",{className:"px-6 py-4",children:(0,B.jsxs)("div",{className:"space-y-3",children:[(0,B.jsxs)("div",{children:[(0,B.jsx)("p",{className:"text-sm font-medium",children:a}),b&&(0,B.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:b})]}),(0,B.jsxs)("div",{className:"flex items-center gap-1.5",children:[c&&(0,B.jsx)("span",{className:"text-xs text-muted-foreground w-16 text-right shrink-0",children:c}),(0,B.jsx)("div",{className:"flex gap-0.5",children:[1,2,3,4,5].map(a=>(0,B.jsx)("button",{type:"button",onClick:()=>f(a),className:`w-4 h-4 rounded-full transition-colors hover:opacity-80 ${a<=e?"bg-primary":"bg-muted"}`},a))}),d&&(0,B.jsx)("span",{className:"text-xs text-muted-foreground w-20 shrink-0",children:d}),(0,B.jsxs)("span",{className:"text-xs font-mono text-muted-foreground ml-1 shrink-0",children:[e,"/5"]})]})]})})}function Qh({fields:a,onChange:b,depth:c,extraControls:d,examplePrefix:e}){let f=(0,E.useTranslations)("bankConfig"),g={text:f("fieldTypeText"),value:f("fieldTypeValue"),"multi-values":f("fieldTypeMultiValues"),map:f("fieldTypeMap")},[h,i]=(0,C.useState)({}),j=(c,d)=>{let e={};for(let[b,f]of Object.entries(a))e[b]=b===c?{...f,...d}:f;b(e)},k=0===c;return(0,B.jsxs)("div",{className:k?"space-y-1.5 py-1":"space-y-1.5 py-1 ml-3 border-l-2 border-border/40 pl-3",children:[0===Object.keys(a).length&&(0,B.jsx)("p",{className:"text-xs text-muted-foreground italic",children:f("noFieldsYet")}),Object.entries(a).map(([l,n],o)=>{let p="map"===n.type,q="value"===n.type||"multi-values"===n.type,r=h[o]??!0,s=p||q;return(0,B.jsxs)("div",{className:"space-y-1",children:[(0,B.jsxs)("div",{className:"flex items-center gap-1.5",children:[s?(0,B.jsx)("button",{type:"button",onClick:()=>i(a=>({...a,[o]:!r})),className:"text-muted-foreground hover:text-foreground shrink-0 p-0.5 rounded hover:bg-muted/50",children:r?(0,B.jsx)(Jj.ChevronDown,{className:"h-3.5 w-3.5"}):(0,B.jsx)(Q.ChevronRight,{className:"h-3.5 w-3.5"})}):(0,B.jsx)("span",{className:"w-[18px] shrink-0"}),(0,B.jsx)(X.Input,{placeholder:f("fieldNamePlaceholder"),value:l,onChange:c=>((c,d)=>{let e={};for(let[b,f]of Object.entries(a))e[b===c?d:b]=f;b(e)})(l,c.target.value),className:"h-7 text-xs font-mono w-28 shrink-0"}),(0,B.jsx)(X.Input,{placeholder:f("extractorHintWhatPlaceholder"),value:n.description,onChange:a=>j(l,{description:a.target.value}),className:"h-7 text-xs flex-1 min-w-0"}),(0,B.jsxs)(a6.Select,{value:n.type,onValueChange:a=>j(l,{type:a,..."map"===a?{fields:n.fields??{},values:void 0}:{},..."text"===a?{fields:void 0,values:void 0}:{},..."value"===a||"multi-values"===a?{fields:void 0,values:n.values??[]}:{}}),children:[(0,B.jsx)(a6.SelectTrigger,{className:"h-7 text-xs w-[120px] shrink-0 px-2 py-0",children:(0,B.jsx)(a6.SelectValue,{})}),(0,B.jsx)(a6.SelectContent,{children:Object.entries(g).map(([a,b])=>(0,B.jsx)(a6.SelectItem,{value:a,className:"text-xs",children:b},a))})]}),d,(0,B.jsx)("button",{type:"button",onClick:()=>{let c;return c={...a},void(delete c[l],b(c))},className:"text-muted-foreground hover:text-destructive shrink-0 p-0.5 rounded hover:bg-destructive/10",children:(0,B.jsx)(Jg,{className:"h-3.5 w-3.5"})})]}),k&&e&&l&&(0,B.jsx)("div",{className:"ml-[18px] pl-1.5",children:(0,B.jsx)("span",{className:"text-[10px] font-mono text-muted-foreground/60 leading-none",children:"map"===n.type&&n.fields&&Object.keys(n.fields).length>0?`e.g. ${Object.keys(n.fields).slice(0,2).map(a=>`${e}:${a}:<value>`).join(", ")}`:"text"===n.type?`e.g. ${e}:<any text>`:(n.values?.length??0)>0?`e.g. ${e}:${n.values[0].value||"<value>"}`:`e.g. ${e}:<value>`})}),r&&p&&(0,B.jsx)(Qh,{fields:n.fields??{},onChange:a=>j(l,{fields:a}),depth:c+1,examplePrefix:e?`${e}:${l}`:void 0}),r&&q&&(0,B.jsxs)("div",{className:"ml-6 space-y-0.5 py-1",children:[0===(n.values??[]).length&&(0,B.jsx)("p",{className:"text-[11px] text-muted-foreground italic",children:f("noValuesYet")}),(n.values??[]).map((a,b)=>(0,B.jsxs)("div",{className:"flex items-center gap-1.5 group/val",children:[(0,B.jsx)("span",{className:"text-muted-foreground/50 text-[10px] shrink-0",children:"•"}),(0,B.jsx)(X.Input,{placeholder:f("addValueShort"),value:a.value,onChange:c=>{let d=[...n.values??[]];d[b]={...a,value:c.target.value},j(l,{values:d})},className:"h-6 text-[11px] font-mono w-24 shrink-0 border-dashed"}),(0,B.jsx)(X.Input,{placeholder:f("extractorHintWhichPlaceholder"),value:a.description,onChange:c=>{let d=[...n.values??[]];d[b]={...a,description:c.target.value},j(l,{values:d})},className:"h-6 text-[11px] flex-1 min-w-0 border-dashed"}),(0,B.jsx)("button",{type:"button",onClick:()=>{j(l,{values:(n.values??[]).filter((a,c)=>c!==b)})},className:"text-muted-foreground/40 hover:text-destructive shrink-0 p-0.5 rounded hover:bg-destructive/10 opacity-0 group-hover/val:opacity-100 transition-opacity",children:(0,B.jsx)(Jg,{className:"h-3 w-3"})})]},b)),(0,B.jsxs)("button",{type:"button",onClick:()=>{j(l,{values:[...n.values??[],{value:"",description:""}]})},className:"text-[11px] text-muted-foreground/60 hover:text-foreground inline-flex items-center gap-1 ml-2.5",children:[(0,B.jsx)(II.Plus,{className:"h-2.5 w-2.5"}),f("addValueShort")]})]})]},o)}),(0,B.jsxs)("button",{type:"button",onClick:()=>{b({...a,"":{type:"text",description:""}})},className:"text-xs text-muted-foreground hover:text-foreground inline-flex items-center gap-1",children:[(0,B.jsx)(II.Plus,{className:"h-3 w-3"}),f("addField")]})]})}function Qi({value:a,onChange:b}){let c=(0,E.useTranslations)("entityLabelsEditor"),d=(c,d)=>{b(a.map((a,b)=>b===c?{...a,...d}:a))};return(0,B.jsxs)("div",{className:"px-6 py-4 space-y-3",children:[(0,B.jsxs)("div",{className:"flex items-center justify-between",children:[(0,B.jsxs)("div",{children:[(0,B.jsx)("p",{className:"text-sm font-medium",children:c("entityLabelsTitle")}),(0,B.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:c("entityLabelsDescription")})]}),a.length>0&&(0,B.jsx)("span",{className:"text-xs bg-primary/10 text-primary px-2 py-0.5 rounded-full shrink-0",children:c("labelCount",{count:a.length})})]}),0===a.length&&(0,B.jsx)("p",{className:"text-xs text-muted-foreground italic",children:c("noEntityLabelsDefined")}),(0,B.jsx)("div",{className:"space-y-2",children:a.map((e,f)=>(0,B.jsx)("div",{className:"border border-border/50 rounded-md bg-background",children:(0,B.jsx)(Qh,{fields:{[e.key]:{type:e.type,description:e.description,values:e.values,fields:e.fields}},onChange:c=>{let e=Object.entries(c);if(0===e.length)b(a.filter((a,b)=>b!==f));else{let[a,b]=e[0];d(f,{key:a,type:b.type,description:b.description,values:b.values??[],fields:b.fields??{}})}},depth:0,extraControls:(0,B.jsxs)("label",{className:"flex items-center gap-1.5 text-xs text-muted-foreground shrink-0 cursor-pointer select-none",title:c("alsoStoreAsTagTooltip"),children:[(0,B.jsx)(IM.Checkbox,{checked:e.tag,onCheckedChange:a=>d(f,{tag:!!a}),className:"h-4 w-4"}),c("plusTag")]}),examplePrefix:e.key})},f))}),(0,B.jsxs)("button",{type:"button",onClick:()=>{b([...a,{key:"",description:"",type:"value",optional:!0,tag:!1,values:[],fields:{}}])},className:"flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground",children:[(0,B.jsx)(II.Plus,{className:"h-3.5 w-3.5"}),c("addLabel")]})]})}function Qj({value:a,onChange:b}){let c=(0,E.useTranslations)("bankConfig"),d=[{value:"HARM_CATEGORY_HARASSMENT",label:c("geminiCategoryHarassment")},{value:"HARM_CATEGORY_HATE_SPEECH",label:c("geminiCategoryHateSpeech")},{value:"HARM_CATEGORY_SEXUALLY_EXPLICIT",label:c("geminiCategorySexuallyExplicit")},{value:"HARM_CATEGORY_DANGEROUS_CONTENT",label:c("geminiCategoryDangerousContent")}],e=[{value:"HARM_BLOCK_THRESHOLD_UNSPECIFIED",label:c("geminiThresholdUnspecified")},{value:"OFF",label:c("geminiThresholdOff")},{value:"BLOCK_NONE",label:c("geminiThresholdBlockNone")},{value:"BLOCK_LOW_AND_ABOVE",label:c("geminiThresholdBlockLowAndAbove")},{value:"BLOCK_MEDIUM_AND_ABOVE",label:c("geminiThresholdBlockMediumAndAbove")},{value:"BLOCK_ONLY_HIGH",label:c("geminiThresholdBlockOnlyHigh")}],f=b=>a.find(a=>a.category===b)?.threshold??"BLOCK_MEDIUM_AND_ABOVE";return(0,B.jsxs)("div",{className:"px-6 py-4 space-y-3",children:[(0,B.jsxs)("p",{className:"text-xs text-muted-foreground",children:[c("geminiSafetyEditorDescriptionPart1")," ",(0,B.jsx)("a",{href:"https://ai.google.dev/gemini-api/docs/safety-settings",target:"_blank",rel:"noopener noreferrer",className:"underline hover:text-foreground transition-colors",children:c("geminiSafetyEditorLearnMore")})]}),(0,B.jsx)("div",{className:"space-y-2",children:d.map(a=>(0,B.jsxs)("div",{className:"flex items-center justify-between gap-4",children:[(0,B.jsx)("span",{className:"text-sm",children:a.label}),(0,B.jsxs)(a6.Select,{value:f(a.value),onValueChange:c=>{var e;return e=a.value,void b(d.map(a=>({category:a.value,threshold:a.value===e?c:f(a.value)})))},children:[(0,B.jsx)(a6.SelectTrigger,{className:"w-48 h-8 text-xs",children:(0,B.jsx)(a6.SelectValue,{})}),(0,B.jsx)(a6.SelectContent,{children:e.map(a=>(0,B.jsx)(a6.SelectItem,{value:a.value,className:"text-xs",children:a.label},a.value))})]})]},a.value))})]})}let Qk=(0,K.default)("link-2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]),Ql=(0,K.default)("folder-open",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);var Qm=a.i(67511),Qm=Qm;let Qn=(0,K.default)("circle-x",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]),Qo=(0,K.default)("external-link",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);var Qp=["x1","y1","x2","y2","key"],Qq=["offset"],Qr=["xAxisId","yAxisId"],Qs=["xAxisId","yAxisId"];function Qt(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function Qu(a){for(var b=1;b<arguments.length;b++){var c=null!=arguments[b]?arguments[b]:{};b%2?Qt(Object(c),!0).forEach(function(b){var d,e,f;d=a,e=b,f=c[b],(e=function(a){var b=function(a,b){if("object"!=typeof a||!a)return a;var c=a[Symbol.toPrimitive];if(void 0!==c){var d=c.call(a,b||"default");if("object"!=typeof d)return d;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===b?String:Number)(a)}(a,"string");return"symbol"==typeof b?b:b+""}(e))in d?Object.defineProperty(d,e,{value:f,enumerable:!0,configurable:!0,writable:!0}):d[e]=f}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(c)):Qt(Object(c)).forEach(function(b){Object.defineProperty(a,b,Object.getOwnPropertyDescriptor(c,b))})}return a}function Qv(){return(Qv=Object.assign.bind()).apply(null,arguments)}function Qw(a,b){if(null==a)return{};var c,d,e=function(a,b){if(null==a)return{};var c={};for(var d in a)if(({}).hasOwnProperty.call(a,d)){if(-1!==b.indexOf(d))continue;c[d]=a[d]}return c}(a,b);if(Object.getOwnPropertySymbols){var f=Object.getOwnPropertySymbols(a);for(d=0;d<f.length;d++)c=f[d],-1===b.indexOf(c)&&({}).propertyIsEnumerable.call(a,c)&&(e[c]=a[c])}return e}var Qx=a=>{var{fill:b}=a;if(!b||"none"===b)return null;var{fillOpacity:c,x:d,y:e,width:f,height:g,ry:h}=a;return C.createElement("rect",{x:d,y:e,ry:h,width:f,height:g,stroke:"none",fill:b,fillOpacity:c,className:"recharts-cartesian-grid-bg"})};function Qy(a){var{option:b,lineItemProps:c}=a;if(C.isValidElement(b))d=C.cloneElement(b,c);else if("function"==typeof b)d=b(c);else{var d,e,{x1:f,y1:g,x2:h,y2:i,key:j}=c,k=null!=(e=pY(Qw(c,Qp)))?e:{},{offset:l}=k,n=Qw(k,Qq);d=C.createElement("line",Qv({},n,{x1:f,y1:g,x2:h,y2:i,fill:"none",key:j}))}return d}function Qz(a){var{x:b,width:c,horizontal:d=!0,horizontalPoints:e}=a;if(!d||!e||!e.length)return null;var{xAxisId:f,yAxisId:g}=a,h=Qw(a,Qr),i=e.map((a,e)=>{var f=Qu(Qu({},h),{},{x1:b,y1:a,x2:b+c,y2:a,key:"line-".concat(e),index:e});return C.createElement(Qy,{key:"line-".concat(e),option:d,lineItemProps:f})});return C.createElement("g",{className:"recharts-cartesian-grid-horizontal"},i)}function QA(a){var{y:b,height:c,vertical:d=!0,verticalPoints:e}=a;if(!d||!e||!e.length)return null;var{xAxisId:f,yAxisId:g}=a,h=Qw(a,Qs),i=e.map((a,e)=>{var f=Qu(Qu({},h),{},{x1:a,y1:b,x2:a,y2:b+c,key:"line-".concat(e),index:e});return C.createElement(Qy,{option:d,lineItemProps:f,key:"line-".concat(e)})});return C.createElement("g",{className:"recharts-cartesian-grid-vertical"},i)}function QB(a){var{horizontalFill:b,fillOpacity:c,x:d,y:e,width:f,height:g,horizontalPoints:h,horizontal:i=!0}=a;if(!i||!b||!b.length||null==h)return null;var j=h.map(a=>Math.round(a+e-e)).sort((a,b)=>a-b);e!==j[0]&&j.unshift(0);var k=j.map((a,h)=>{var i=j[h+1]?j[h+1]-a:e+g-a;if(i<=0)return null;var k=h%b.length;return C.createElement("rect",{key:"react-".concat(h),y:a,x:d,height:i,width:f,stroke:"none",fill:b[k],fillOpacity:c,className:"recharts-cartesian-grid-bg"})});return C.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},k)}function QC(a){var{vertical:b=!0,verticalFill:c,fillOpacity:d,x:e,y:f,width:g,height:h,verticalPoints:i}=a;if(!b||!c||!c.length)return null;var j=i.map(a=>Math.round(a+e-e)).sort((a,b)=>a-b);e!==j[0]&&j.unshift(0);var k=j.map((a,b)=>{var i=j[b+1]?j[b+1]-a:e+g-a;if(i<=0)return null;var k=b%c.length;return C.createElement("rect",{key:"react-".concat(b),x:a,y:f,width:i,height:h,stroke:"none",fill:c[k],fillOpacity:d,className:"recharts-cartesian-grid-bg"})});return C.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},k)}var QD=(a,b)=>{var{xAxis:c,width:d,height:e,offset:f}=a;return fr(uR(Qu(Qu(Qu({},uW),c),{},{ticks:fs(c,!0),viewBox:{x:0,y:0,width:d,height:e}})),f.left,f.left+f.width,b)},QE=(a,b)=>{var{yAxis:c,width:d,height:e,offset:f}=a;return fr(uR(Qu(Qu(Qu({},uW),c),{},{ticks:fs(c,!0),viewBox:{x:0,y:0,width:d,height:e}})),f.top,f.top+f.height,b)},QF={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[],xAxisId:0,yAxisId:0,syncWithTicks:!1,zIndex:k6.grid};function QG(a){var b=fa(fA),c=fa(fB),d=f6(),e=Qu(Qu({},qB(a,QF)),{},{x:dE(a.x)?a.x:d.left,y:dE(a.y)?a.y:d.top,width:dE(a.width)?a.width:d.width,height:dE(a.height)?a.height:d.height}),{xAxisId:f,yAxisId:g,x:h,y:i,width:j,height:k,syncWithTicks:l,horizontalValues:n,verticalValues:o}=e,p=fM(),q=fa(a=>m3(a,"xAxis",f,p)),r=fa(a=>m3(a,"yAxis",g,p));if(!fm(j)||!fm(k)||!dE(h)||!dE(i))return null;var s=e.verticalCoordinatesGenerator||QD,t=e.horizontalCoordinatesGenerator||QE,{horizontalPoints:u,verticalPoints:v}=e;if((!u||!u.length)&&"function"==typeof t){var w=n&&n.length,x=t({yAxis:r?Qu(Qu({},r),{},{ticks:w?n:r.ticks}):void 0,width:null!=b?b:j,height:null!=c?c:k,offset:d},!!w||l);fR(Array.isArray(x),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(typeof x,"]")),Array.isArray(x)&&(u=x)}if((!v||!v.length)&&"function"==typeof s){var y=o&&o.length,z=s({xAxis:q?Qu(Qu({},q),{},{ticks:y?o:q.ticks}):void 0,width:null!=b?b:j,height:null!=c?c:k,offset:d},!!y||l);fR(Array.isArray(z),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(typeof z,"]")),Array.isArray(z)&&(v=z)}return C.createElement(re,{zIndex:e.zIndex},C.createElement("g",{className:"recharts-cartesian-grid"},C.createElement(Qx,{fill:e.fill,fillOpacity:e.fillOpacity,x:e.x,y:e.y,width:e.width,height:e.height,ry:e.ry}),C.createElement(QB,Qv({},e,{horizontalPoints:u})),C.createElement(QC,Qv({},e,{verticalPoints:v})),C.createElement(Qz,Qv({},e,{offset:d,horizontalPoints:u,xAxis:q,yAxis:r})),C.createElement(QA,Qv({},e,{offset:d,verticalPoints:v,xAxis:q,yAxis:r}))))}QG.displayName="CartesianGrid";let QH=["1h","12h","1d","7d","30d","90d"],QI=["created_at","mentioned_at","occurred_start"],QJ="#8b5cf6",QK="#ec4899",QL="#6366f1",QM="var(--chart-5)",QN="var(--muted-foreground)",QO={world:{label:"World",color:QJ},experience:{label:"Experience",color:QK},observation:{label:"Observations",color:QL}};function QP(a){if(a<1e3)return a.toString();if(a<1e6){let b=a/1e3;return`${b>=10?b.toFixed(0):b.toFixed(1).replace(/\.0$/,"")}k`}if(a<1e9){let b=a/1e6;return`${b>=10?b.toFixed(0):b.toFixed(1).replace(/\.0$/,"")}M`}let b=a/1e9;return`${b>=10?b.toFixed(0):b.toFixed(1).replace(/\.0$/,"")}B`}function QQ({value:a,className:b}){return(0,B.jsx)("span",{className:b,title:a.toLocaleString(),children:QP(a)})}function QR({active:a,payload:b,label:c,valueLabel:d}){return a&&b&&0!==b.length?(0,B.jsxs)("div",{className:"rounded-lg border border-border/60 bg-popover/95 backdrop-blur-sm px-3 py-2 shadow-md",children:[null!=c&&(0,B.jsx)("div",{className:"text-[11px] font-medium text-foreground mb-1.5",children:c}),(0,B.jsx)("div",{className:"space-y-1",children:b.map((a,b)=>(0,B.jsxs)("div",{className:"flex items-center gap-2 text-[11px]",children:[(0,B.jsx)("span",{className:"w-2 h-2 rounded-[2px]",style:{backgroundColor:a.color||a.payload?.fill}}),(0,B.jsx)("span",{className:"text-muted-foreground",children:a.name||d||"Value"}),(0,B.jsx)("span",{className:"ml-auto pl-3 font-semibold tabular-nums text-foreground",children:(a.value??0).toLocaleString()})]},b))})]}):null}function QS({children:a}){return(0,B.jsx)("h3",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-[0.08em] mb-3",children:a})}function QT(a,b){if(!a)return b?b("relativeTimeNever"):"Never";let c=Math.floor((Date.now()-new Date(a).getTime())/6e4);if(c<1)return b?b("relativeTimeJustNow"):"just now";if(c<60)return b?b("relativeTimeMinutes",{mins:c}):`${c}m ago`;let d=Math.floor(c/60);if(d<24)return b?b("relativeTimeHours",{hours:d}):`${d}h ago`;let e=Math.floor(d/24);return b?b("relativeTimeDays",{days:e}):`${e}d ago`}function QU(a){return new Date(/[+Z-]$/.test(a)||/[+-]\d\d:?\d\d$/.test(a)?a:`${a}Z`)}function QV({done:a,total:b,doneColor:c}){let d=Math.round(100*(b>0?a/b:0));return(0,B.jsxs)("div",{className:"space-y-1.5",children:[(0,B.jsxs)("div",{className:"flex items-baseline justify-between",children:[(0,B.jsxs)("span",{className:"text-xs text-muted-foreground",children:[(0,B.jsx)("span",{className:"tabular-nums font-semibold text-foreground text-sm",children:a.toLocaleString()}),(0,B.jsxs)("span",{className:"text-muted-foreground",children:[" / ",b.toLocaleString()]})]}),(0,B.jsxs)("span",{className:"text-xs font-semibold tabular-nums text-foreground",children:[d,"%"]})]}),(0,B.jsx)("div",{className:"h-1.5 w-full rounded-full bg-muted overflow-hidden",children:(0,B.jsx)("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${d}%`,backgroundColor:c}})})]})}function QW({title:a,items:b,emptyLabel:c}){let d=b.reduce((a,b)=>a+b.value,0);return(0,B.jsxs)("div",{className:"space-y-3",children:[(0,B.jsxs)("div",{className:"flex items-center justify-between",children:[(0,B.jsx)("h4",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-[0.08em]",children:a}),(0,B.jsx)(QQ,{value:d,className:"text-xs text-muted-foreground tabular-nums"})]}),0===d?(0,B.jsx)("div",{className:"text-xs text-muted-foreground py-2",children:c}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)("div",{className:"h-1.5 flex w-full rounded-full overflow-hidden bg-muted",children:b.filter(a=>a.value>0).map(a=>(0,B.jsx)("div",{className:"h-full",style:{width:`${a.value/d*100}%`,backgroundColor:a.color},title:`${a.name}: ${a.value.toLocaleString()}`},a.name))}),(0,B.jsx)("div",{className:"grid grid-cols-3 gap-3 text-sm",children:b.map(a=>(0,B.jsxs)("div",{className:"space-y-0.5",children:[(0,B.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,B.jsx)("span",{className:"w-2 h-2 rounded-[2px]",style:{backgroundColor:a.color}}),(0,B.jsx)("span",{className:"text-[11px] uppercase tracking-wider text-muted-foreground font-medium",children:a.name})]}),(0,B.jsxs)("div",{className:"flex items-baseline gap-1.5",children:[(0,B.jsx)(QQ,{value:a.value,className:"text-base font-semibold tabular-nums"}),(0,B.jsx)("span",{className:"text-[10px] text-muted-foreground tabular-nums",children:d>0?`${(a.value/d*100).toFixed(0)}%`:"0%"})]})]},a.name))})]})]})}function QX({icon:a,label:b,value:c}){return(0,B.jsxs)("div",{className:"flex items-center gap-3 p-4",children:[(0,B.jsx)("div",{className:"p-2 rounded-md bg-muted",children:(0,B.jsx)(a,{className:"w-4 h-4 text-muted-foreground"})}),(0,B.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,B.jsx)("p",{className:"text-xs text-muted-foreground font-medium",children:b}),(0,B.jsx)(QQ,{value:c,className:"text-2xl font-semibold text-foreground leading-tight tabular-nums block"})]})]})}let QY=["completed","processing","pending","failed","cancelled"],QZ={completed:"#10b981",processing:"#3b82f6",pending:"#f59e0b",failed:"#ef4444",cancelled:"#6b7280"},Q$={completed:"completed",processing:"processing",pending:"pending",failed:"failed",cancelled:"cancelled"};function Q_({byStatus:a}){let b=(0,E.useTranslations)("bankStats"),c={completed:b("opsCompleted"),processing:b("opsProcessing"),pending:b("opsPending"),failed:b("opsFailed"),cancelled:b("opsCancelled")},d=QY.map(b=>({status:b,label:c[b]??Q$[b],value:a[b]||0,color:QZ[b]}));for(let[b,c]of Object.entries(a))QY.includes(b)||d.push({status:b,label:b,value:c,color:QN});let e=d.reduce((a,b)=>a+b.value,0),f=d.filter(a=>a.value>0);return(0,B.jsxs)(bp.Card,{children:[(0,B.jsxs)(bp.CardHeader,{className:"pb-2 flex flex-row items-center justify-between space-y-0",children:[(0,B.jsxs)(bp.CardTitle,{className:"text-sm font-semibold flex items-center gap-2",children:[(0,B.jsx)(be,{className:"w-3.5 h-3.5 text-muted-foreground"}),b("operations")]}),(0,B.jsxs)("span",{className:"text-xs text-muted-foreground tabular-nums",children:[(0,B.jsx)(QQ,{value:e})," ",b("totalSuffix")]})]}),(0,B.jsx)(bp.CardContent,{children:0===e?(0,B.jsx)("div",{className:"h-[100px] flex items-center justify-center text-sm text-muted-foreground",children:b("noOperationsYet")}):(0,B.jsxs)("div",{className:"space-y-3",children:[(0,B.jsx)("div",{className:"h-1.5 flex w-full rounded-full overflow-hidden bg-muted",children:f.map(a=>(0,B.jsx)("div",{className:"h-full",style:{width:`${a.value/e*100}%`,backgroundColor:a.color},title:`${a.label}: ${a.value.toLocaleString()}`},a.status))}),(0,B.jsx)("div",{className:"space-y-1.5",children:f.map(a=>(0,B.jsxs)("div",{className:"flex items-center gap-2 text-xs",children:[(0,B.jsx)("span",{className:"w-2 h-2 rounded-[2px] flex-shrink-0",style:{backgroundColor:a.color}}),(0,B.jsx)("span",{className:"text-muted-foreground flex-1",children:a.label}),(0,B.jsx)(QQ,{value:a.value,className:"font-semibold tabular-nums text-foreground"}),(0,B.jsxs)("span",{className:"text-[10px] text-muted-foreground tabular-nums w-9 text-right",children:[(a.value/e*100).toFixed(0),"%"]})]},a.status))})]})})]})}function Q0({done:a,pending:b,failed:c,total:d,lastConsolidatedAt:e}){let f=(0,E.useTranslations)("bankStats"),[g,h]=(0,C.useState)(!1),i=c>0;return(0,B.jsxs)(bp.Card,{children:[(0,B.jsx)(bp.CardHeader,{className:"pb-2",children:(0,B.jsx)(bp.CardTitle,{className:"text-sm font-semibold",children:f("consolidation")})}),(0,B.jsxs)(bp.CardContent,{className:"space-y-4",children:[(0,B.jsx)(QV,{done:a,total:d,doneColor:QM}),(0,B.jsxs)("div",{className:"grid grid-cols-4 gap-3 pt-1",children:[(0,B.jsxs)("div",{className:"space-y-0.5",children:[(0,B.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,B.jsx)(Qm.default,{className:"w-3 h-3 text-emerald-500"}),(0,B.jsx)("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-medium",children:f("done")})]}),(0,B.jsx)(QQ,{value:a,className:"text-base font-semibold tabular-nums text-foreground block"})]}),(0,B.jsxs)("div",{className:"space-y-0.5",children:[(0,B.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,B.jsx)(PY,{className:"w-3 h-3 text-amber-500"}),(0,B.jsx)("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-medium",children:f("pending")})]}),(0,B.jsx)(QQ,{value:b,className:"text-base font-semibold tabular-nums text-foreground block"})]}),(0,B.jsxs)("button",{type:"button",onClick:()=>i&&h(!0),disabled:!i,className:`text-left space-y-0.5 rounded-md -mx-1 px-1 py-0.5 transition-colors ${i?"cursor-pointer hover:bg-red-500/10 focus:outline-none focus:ring-2 focus:ring-red-500/40":"cursor-default"}`,title:i?f("viewFailedMemoriesLabel"):void 0,children:[(0,B.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,B.jsx)(Qn,{className:`w-3 h-3 ${i?"text-red-600 dark:text-red-400":"text-muted-foreground/50"}`}),(0,B.jsx)("span",{className:`text-[10px] uppercase tracking-wider font-medium ${i?"text-red-600 dark:text-red-400":"text-muted-foreground"}`,children:f("failed")})]}),(0,B.jsxs)("span",{className:`text-base font-semibold tabular-nums block ${i?"text-red-600 dark:text-red-400":"text-foreground"}`,children:[(0,B.jsx)(QQ,{value:c}),i&&(0,B.jsx)(Qo,{className:"inline w-3 h-3 ml-1 opacity-70"})]})]}),(0,B.jsxs)("div",{className:"space-y-0.5",children:[(0,B.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,B.jsx)(af,{className:"w-3 h-3 text-muted-foreground"}),(0,B.jsx)("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-medium",children:f("last")})]}),(0,B.jsx)("span",{className:"text-base font-semibold text-foreground block leading-tight",children:QT(e,f)})]})]})]}),(0,B.jsx)(Q1,{open:g,onOpenChange:h})]})}function Q1({open:a,onOpenChange:b}){let c=(0,E.useTranslations)("bankStats"),d=(0,E.useTranslations)("failedConsolidations"),{currentBank:e}=(0,H.useBank)(),[f,g]=(0,C.useState)([]),[h,i]=(0,C.useState)(0),[j,k]=(0,C.useState)(!1),[l,n]=(0,C.useState)(!1),[o,p]=(0,C.useState)(0);(0,C.useEffect)(()=>{if(!a||!e)return;let b=!1;return k(!0),V.client.listMemories(e,{consolidationState:"failed",limit:200}).then(a=>{b||(g(a.items),i(a.total))}).catch(()=>{}).finally(()=>{b||k(!1)}),()=>{b=!0}},[a,e,o]);let q=async()=>{if(e){n(!0);try{let a=await V.client.recoverConsolidation(e);a.retried_count>0&&await V.client.triggerConsolidation(e),F.toast.success(d("recoverSuccess",{count:a.retried_count})),p(a=>a+1)}catch{}finally{n(!1)}}};return(0,B.jsx)(bf.Dialog,{open:a,onOpenChange:b,children:(0,B.jsxs)(bf.DialogContent,{className:"max-w-4xl max-h-[80vh] flex flex-col",children:[(0,B.jsxs)(bf.DialogHeader,{children:[(0,B.jsxs)(bf.DialogTitle,{className:"flex items-center gap-2",children:[(0,B.jsx)(Qn,{className:"w-4 h-4 text-red-600 dark:text-red-400"}),d("title")]}),(0,B.jsx)(bf.DialogDescription,{children:d("description")})]}),(0,B.jsxs)("div",{className:"flex items-center justify-between gap-2 py-2",children:[(0,B.jsx)("span",{className:"text-sm text-muted-foreground",children:j?d("loading"):d("totalFailed",{total:h})}),(0,B.jsxs)(W.Button,{size:"sm",onClick:q,disabled:l||j||0===h,children:[(0,B.jsx)(ad,{className:`w-3.5 h-3.5 mr-1.5 ${l?"animate-spin":""}`}),d("recoverAll")]})]}),(0,B.jsx)("div",{className:"flex-1 min-h-0 overflow-auto border border-border rounded-md",children:(0,B.jsxs)(ai,{children:[(0,B.jsx)(aj,{children:(0,B.jsxs)(al,{children:[(0,B.jsx)(am,{className:"w-[140px]",children:d("colFailedAt")}),(0,B.jsx)(am,{className:"w-[100px]",children:d("colType")}),(0,B.jsx)(am,{children:d("colText")})]})}),(0,B.jsxs)(ak,{children:[0===f.length&&!j&&(0,B.jsx)(al,{children:(0,B.jsx)(an,{colSpan:3,className:"text-center text-muted-foreground py-8",children:d("noFailedConsolidations")})}),f.map(a=>(0,B.jsxs)(al,{children:[(0,B.jsx)(an,{className:"text-xs text-muted-foreground whitespace-nowrap",children:QT(a.consolidation_failed_at,c)}),(0,B.jsx)(an,{className:"text-xs capitalize",children:a.fact_type}),(0,B.jsxs)(an,{className:"text-sm",children:[(0,B.jsx)("div",{className:"line-clamp-2",children:a.text}),a.context&&(0,B.jsx)("div",{className:"text-xs text-muted-foreground mt-0.5 line-clamp-1",children:a.context})]})]},a.id))]})]})})]})})}function Q2({models:a,lastConsolidatedAt:b}){let c=(0,E.useTranslations)("bankStats"),d=a.length,e=b?new Date(b).getTime():0,f=a.filter(a=>!e||!!a.last_refreshed_at&&new Date(a.last_refreshed_at).getTime()>=e).length,g=d-f;return(0,B.jsxs)(bp.Card,{children:[(0,B.jsx)(bp.CardHeader,{className:"pb-2",children:(0,B.jsxs)(bp.CardTitle,{className:"text-sm font-semibold flex items-center gap-2",children:[(0,B.jsx)(JE,{className:"w-3.5 h-3.5 text-muted-foreground"}),c("mentalModels")]})}),(0,B.jsx)(bp.CardContent,{className:"space-y-4",children:0===d?(0,B.jsx)("div",{className:"text-sm text-muted-foreground py-4",children:c("noMentalModels")}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(QV,{done:f,total:d,doneColor:QM}),(0,B.jsxs)("div",{className:"grid grid-cols-3 gap-3 pt-1",children:[(0,B.jsxs)("div",{className:"space-y-0.5",children:[(0,B.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,B.jsx)(Qm.default,{className:"w-3 h-3 text-emerald-500"}),(0,B.jsx)("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-medium",children:c("upToDate")})]}),(0,B.jsx)("span",{className:"text-base font-semibold tabular-nums text-foreground block",children:f})]}),(0,B.jsxs)("div",{className:"space-y-0.5",children:[(0,B.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,B.jsx)(PY,{className:"w-3 h-3 text-amber-500"}),(0,B.jsx)("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-medium",children:c("stale")})]}),(0,B.jsx)("span",{className:"text-base font-semibold tabular-nums text-foreground block",children:g})]}),(0,B.jsxs)("div",{className:"space-y-0.5",children:[(0,B.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,B.jsx)(JE,{className:"w-3 h-3 text-muted-foreground"}),(0,B.jsx)("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-medium",children:c("total")})]}),(0,B.jsx)("span",{className:"text-base font-semibold tabular-nums text-foreground block",children:d})]})]})]})})]})}let Q3={fontSize:11,fill:QN,fontWeight:500};function Q4(){let a=(0,E.useTranslations)("bankStats"),b={created_at:{short:a("timeFieldIngestedShort"),long:a("timeFieldIngestedLong")},mentioned_at:{short:a("timeFieldMentionedShort"),long:a("timeFieldMentionedLong")},occurred_start:{short:a("timeFieldOccurredShort"),long:a("timeFieldOccurredLong")}},{currentBank:c}=(0,H.useBank)(),{features:d}=(0,IL.useFeatures)(),e=d?.observations??!1,[f,g]=(0,C.useState)(null),[h,i]=(0,C.useState)([]),[j,k]=(0,C.useState)(!1),[l,n]=(0,C.useState)("7d"),[o,p]=(0,C.useState)("created_at"),[q,r]=(0,C.useState)({trunc:"day",buckets:[]}),[s,t]=(0,C.useState)({world:!0,experience:!0,observation:!0}),u=async()=>{if(c){k(!0);try{let[a,b]=await Promise.all([V.client.getBankStats(c),V.client.listMentalModels(c)]);g(a),i(b.items||[])}catch(a){console.error("Error loading bank stats:",a)}finally{k(!1)}}},v=async()=>{if(c)try{let a=await V.client.getMemoriesTimeseries(c,l,o);r({trunc:a.trunc,buckets:a.buckets||[]})}catch(a){console.error("Error loading memories timeseries:",a)}};if((0,C.useEffect)(()=>{if(c){u();let a=setInterval(u,5e3);return()=>clearInterval(a)}},[c]),(0,C.useEffect)(()=>{if(c){v();let a=setInterval(v,5e3);return()=>clearInterval(a)}},[c,l,o]),j&&!f)return(0,B.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,B.jsx)(af,{className:"w-12 h-12 mx-auto mb-3 text-muted-foreground animate-pulse"})});if(!f)return null;let w=e?["world","experience","observation"]:["world","experience"],x=q.buckets.map(a=>{var b,c,d,e;let f,g;return{...a,label:(b=a.time,c=q.trunc,f=QU(b),"day"===c?f.toLocaleDateString(void 0,{month:"short",day:"numeric"}):f.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})),tooltipLabel:(d=a.time,e=q.trunc,g=QU(d),"day"===e?g.toLocaleDateString(void 0,{weekday:"short",month:"short",day:"numeric"}):g.toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}))}}),y=x.reduce((a,b)=>a+w.reduce((a,c)=>a+(s[c]&&b[c]||0),0),0),z=Math.max(0,f.total_nodes-f.pending_consolidation),A={world:a("world"),experience:a("experience"),observation:a("observations")};return(0,B.jsxs)("div",{className:"space-y-8",children:[(0,B.jsxs)("section",{children:[(0,B.jsx)(QS,{children:a("memoryStore")}),(0,B.jsx)(bp.Card,{children:(0,B.jsxs)(bp.CardContent,{className:"p-0",children:[(0,B.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 md:divide-x divide-y md:divide-y-0 divide-border/60",children:[(0,B.jsx)(QX,{icon:M,label:a("memories"),value:f.total_nodes}),(0,B.jsx)(QX,{icon:Ql,label:a("documents"),value:f.total_documents}),(0,B.jsx)(QX,{icon:Qk,label:a("links"),value:f.total_links})]}),(0,B.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 md:divide-x divide-y md:divide-y-0 divide-border/60 border-t border-border/60",children:[(0,B.jsx)("div",{className:"p-5",children:(0,B.jsx)(QW,{title:a("memoryComposition"),items:[{name:a("world"),value:f.nodes_by_fact_type?.world||0,color:QJ},{name:a("experience"),value:f.nodes_by_fact_type?.experience||0,color:QK},...e?[{name:a("observations"),value:f.total_observations||0,color:QL}]:[]],emptyLabel:a("noMemoriesYet")})}),(0,B.jsx)("div",{className:"p-5",children:(0,B.jsx)(QW,{title:a("linkTypes"),items:[{name:a("temporal"),value:f.links_by_link_type?.temporal||0,color:"#009296"},{name:a("semantic"),value:f.links_by_link_type?.semantic||0,color:"#0074d9"},{name:a("entity"),value:f.links_by_link_type?.entity||0,color:"#f59e0b"}],emptyLabel:a("noLinksYet")})})]})]})})]}),(0,B.jsxs)("section",{children:[(0,B.jsx)(QS,{children:a("consolidation")}),(0,B.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,B.jsx)(Q0,{done:z,pending:f.pending_consolidation,failed:f.failed_consolidation??0,total:f.total_nodes,lastConsolidatedAt:f.last_consolidated_at}),(0,B.jsx)(Q2,{models:h,lastConsolidatedAt:f.last_consolidated_at})]})]}),(0,B.jsxs)("section",{children:[(0,B.jsx)(QS,{children:a("activity")}),(0,B.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:[(0,B.jsxs)(bp.Card,{className:"lg:col-span-2",children:[(0,B.jsxs)(bp.CardHeader,{className:"pb-2 space-y-2",children:[(0,B.jsxs)("div",{className:"flex flex-row items-center justify-between",children:[(0,B.jsx)(bp.CardTitle,{className:"text-sm font-semibold",children:a("memoriesByTimeChartTitle",{field:b[o].short.toLowerCase()})}),(0,B.jsx)("div",{className:"flex items-center gap-0.5 rounded-md bg-muted/60 p-0.5",children:QH.map(a=>(0,B.jsx)("button",{onClick:()=>n(a),className:`px-2 py-0.5 text-[11px] font-medium rounded transition-colors tabular-nums ${l===a?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:a},a))})]}),(0,B.jsx)("div",{className:"flex items-center gap-0.5 rounded-md bg-muted/60 p-0.5 w-fit",children:QI.map(a=>(0,B.jsx)("button",{onClick:()=>p(a),title:b[a].long,className:`px-2 py-0.5 text-[11px] font-medium rounded transition-colors ${o===a?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:b[a].short},a))}),(0,B.jsxs)("div",{className:"flex items-center justify-between",children:[(0,B.jsx)("div",{className:"flex items-center gap-1.5",children:w.map(a=>{let b=QO[a],c=s[a];return(0,B.jsxs)("button",{onClick:()=>t(b=>({...b,[a]:!b[a]})),className:`flex items-center gap-1.5 px-2 py-0.5 rounded-md text-[11px] font-medium transition-all ${c?"bg-muted text-foreground":"bg-transparent text-muted-foreground/60 hover:text-muted-foreground"}`,children:[(0,B.jsx)("span",{className:"w-2 h-2 rounded-[2px] transition-opacity",style:{backgroundColor:b.color,opacity:c?1:.3}}),A[a]]},a)})}),(0,B.jsxs)("span",{className:"text-xs text-muted-foreground tabular-nums",children:[(0,B.jsx)(QQ,{value:y})," ",a("totalSuffix")]})]})]}),(0,B.jsx)(bp.CardContent,{children:0===x.length||0===y?(0,B.jsx)("div",{className:"h-[180px] flex items-center justify-center text-sm text-muted-foreground",children:a("noMemoriesIngestedInPeriod")}):(0,B.jsx)("div",{className:"h-[180px]",children:(0,B.jsx)(f2,{width:"100%",height:"100%",children:(0,B.jsxs)(ue,{data:x,margin:{top:8,right:8,bottom:0,left:-10},children:[(0,B.jsx)("defs",{children:w.map(a=>(0,B.jsxs)("linearGradient",{id:`grad-${a}`,x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,B.jsx)("stop",{offset:"0%",stopColor:QO[a].color,stopOpacity:.35}),(0,B.jsx)("stop",{offset:"100%",stopColor:QO[a].color,stopOpacity:0})]},a))}),(0,B.jsx)(QG,{vertical:!1,stroke:"var(--border)",strokeOpacity:.5,strokeDasharray:"2 4"}),(0,B.jsx)(vc,{dataKey:"label",tick:Q3,axisLine:!1,tickLine:!1,dy:4,minTickGap:20}),(0,B.jsx)(vk,{tick:Q3,axisLine:!1,tickLine:!1,width:40,allowDecimals:!1,tickFormatter:a=>QP(a)}),(0,B.jsx)(vT,{content:(0,B.jsx)(QR,{}),labelFormatter:(a,b)=>b?.[0]?.payload?.tooltipLabel||"",cursor:{stroke:QN,strokeWidth:1,strokeDasharray:"3 3"}}),w.map(a=>s[a]?(0,B.jsx)(uK,{type:"monotone",dataKey:a,name:A[a],stackId:"a",stroke:QO[a].color,strokeWidth:2,fill:`url(#grad-${a})`,isAnimationActive:!1},a):null)]})})})})]}),(0,B.jsx)(Q_,{byStatus:f.operations_by_status||{}})]})]})]})}var bc=bc;let Q5=(0,K.default)("rotate-ccw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]),Q6=(0,K.default)("code",[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]]),Q7=(0,K.default)("ban",[["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]),Q8=["all","retain","consolidation","refresh_mental_model","file_convert_retain","webhook_delivery","graph_maintenance"],Q9=[null,"pending","processing","completed","failed","cancelled"];function Ra(){let a,b,c,d=(0,E.useTranslations)("bankOperations"),{currentBank:e}=(0,H.useBank)(),[f,g]=(0,C.useState)([]),[h,i]=(0,C.useState)(0),[j,k]=(0,C.useState)(null),[l,n]=(0,C.useState)(null),[o]=(0,C.useState)(10),[p,q]=(0,C.useState)(0),[r,s]=(0,C.useState)(null),[t,u]=(0,C.useState)(null),[v,w]=(0,C.useState)(!1),[x,y]=(0,C.useState)(null),[z,A]=(0,C.useState)(!1),[D,F]=(0,C.useState)(!1),[G,I]=(0,C.useState)(!1),[J,K]=(0,C.useState)(null),[L,M]=(0,C.useState)(()=>Date.now()),N={all:d("status.all"),pending:d("status.pending"),processing:d("status.processing"),completed:d("status.completed"),failed:d("status.failed"),cancelled:d("status.cancelled")},O={all:d("operationType.all"),retain:d("operationType.retain"),consolidation:d("operationType.consolidation"),refresh_mental_model:d("operationType.refreshMentalModel"),file_convert_retain:d("operationType.fileConvertRetain"),webhook_delivery:d("operationType.webhookDelivery"),graph_maintenance:d("operationType.graphMaintenance")},P=a=>a?N[a]??a:d("unknown"),Q=a=>a?O[a]??a:d("notAvailable"),R=(a,b)=>{let c=P(a);return"pending"===a?(0,B.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-amber-500/10 text-amber-600 dark:text-amber-400 border border-amber-500/20",children:[(0,B.jsx)(af,{className:"w-3 h-3"}),c]}):"processing"===a?(0,B.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400 border border-blue-500/20",children:[(0,B.jsx)(bc.default,{className:"w-3 h-3 animate-spin"}),c]}):"failed"===a?(0,B.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-red-500/10 text-red-600 dark:text-red-400 border border-red-500/20",title:b??void 0,children:[(0,B.jsx)(PY,{className:"w-3 h-3"}),c]}):"completed"===a?(0,B.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border border-emerald-500/20",children:[(0,B.jsx)(ae,{className:"w-3 h-3"}),c]}):"cancelled"===a?(0,B.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-gray-500/10 text-gray-600 dark:text-gray-400 border border-gray-500/20",children:[(0,B.jsx)(Q7,{className:"w-3 h-3"}),c]}):(0,B.jsx)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-muted text-muted-foreground border border-border",children:c})},S=a=>{let b=new Date(a).getTime();if(Number.isNaN(b))return"";let c=Math.max(0,Math.round((L-b)/1e3));return c<5?d("heartbeat.justNow"):c<60?d("heartbeat.secondsAgo",{secs:c}):c<3600?d("heartbeat.minutesAgo",{mins:Math.floor(c/60)}):d("heartbeat.hoursAgo",{hours:Math.floor(c/3600)})},T=(a,b)=>{if(!a)return null;let c=a.stage.replace(/[._]/g," "),e="number"==typeof a.processed&&"number"==typeof a.total&&a.total>0,f=e?Math.min(100,Math.round(a.processed/a.total*100)):null,g=a.at?S(a.at):null;return b?.compact?(0,B.jsxs)("div",{className:"flex items-center gap-1.5 text-[11px] text-muted-foreground whitespace-nowrap",title:`${c}${a.at?` — ${new Date(a.at).toLocaleString()}`:""}`,children:[null!==f&&(0,B.jsx)("span",{className:"h-1 w-14 shrink-0 rounded-full bg-muted overflow-hidden",children:(0,B.jsx)("span",{className:"block h-full rounded-full bg-blue-500/70",style:{width:`${f}%`}})}),e&&(0,B.jsxs)("span",{className:"font-mono",children:[a.processed,"/",a.total]}),g&&(0,B.jsxs)("span",{className:"text-muted-foreground/70",children:["· ",g]})]}):(0,B.jsxs)("div",{className:"mt-1 space-y-1",children:[(0,B.jsxs)("div",{className:"flex items-center gap-1.5 text-[11px] text-muted-foreground",children:[(0,B.jsx)("span",{className:"capitalize",children:c}),e&&(0,B.jsxs)("span",{className:"font-mono",children:[a.processed,"/",a.total]})]}),null!==f&&(0,B.jsx)("div",{className:"h-1 w-24 rounded-full bg-muted overflow-hidden",children:(0,B.jsx)("div",{className:"h-full rounded-full bg-blue-500/70",style:{width:`${f}%`}})}),a.at&&(0,B.jsxs)("div",{className:"flex items-center gap-1 text-[10px] text-muted-foreground/80",title:new Date(a.at).toLocaleString(),children:[(0,B.jsx)(af,{className:"w-2.5 h-2.5"}),(0,B.jsxs)("span",{children:[d("field.lastHeartbeat")," · ",S(a.at)]})]})]})},U=(0,C.useCallback)(async(a=j,b=p,c=l)=>{if(e){w(!0);try{let d=await V.client.listOperations(e,{status:a||void 0,type:c||void 0,limit:o,offset:b,excludeParents:!0});g(d.operations||[]),i(d.total||0),M(Date.now())}catch(a){console.error("Error loading operations:",a)}finally{w(!1)}}},[e,j,p,l,o]),X=a=>{q(a),U(j,a,l)},Y=async a=>{if(e){s(a);try{await V.client.cancelOperation(e,a),await U()}catch(a){}finally{s(null)}}},Z=async a=>{if(e){u(a);try{await V.client.retryOperation(e,a),await U()}catch(a){}finally{u(null)}}},$=async a=>{if(e){F(!0),A(!0),K(null);try{let b=await V.client.getOperationStatus(e,a);y(b)}catch(a){console.error("Error loading operation details:",a),y({error:d("operationDetailsLoadError")})}finally{F(!1)}}},_=async()=>{if(e&&x?.operation_id){I(!0);try{let a=x.operation_id,b=await V.client.getOperationStatus(e,a,{includePayload:!0});y(b),K(a)}catch(a){console.error("Error loading raw payload:",a)}finally{I(!1)}}},aa=f.some(a=>"processing"===a.status);(0,C.useEffect)(()=>{if(e){U(j,p,l);let a=setInterval(()=>U(j,p,l),aa?2e3:5e3);return()=>clearInterval(a)}},[e,j,p,l,aa,U]),(0,C.useEffect)(()=>{if(!aa)return;let a=setInterval(()=>M(Date.now()),1e3);return()=>clearInterval(a)},[aa]);let ab=(0,C.useRef)({}),[ac,ag]=(0,C.useState)(new Set);return((0,C.useEffect)(()=>{let a=ab.current,b=f.filter(b=>a[b.id]&&a[b.id]!==b.status&&("completed"===b.status||"failed"===b.status||"cancelled"===b.status)).map(a=>a.id);if(ab.current=Object.fromEntries(f.map(a=>[a.id,a.status])),0===b.length)return;ag(a=>new Set([...a,...b]));let c=setTimeout(()=>ag(a=>{let c=new Set(a);return b.forEach(a=>c.delete(a)),c}),1200);return()=>clearTimeout(c)},[f]),e)?(0,B.jsxs)("div",{className:"space-y-4",children:[(0,B.jsxs)("div",{className:"flex items-center justify-between",children:[(0,B.jsxs)("div",{children:[(0,B.jsxs)("div",{className:"flex items-center gap-2",children:[(0,B.jsx)("h3",{className:"text-lg font-semibold",children:d("title")}),(0,B.jsx)("button",{onClick:()=>U(),className:"p-1 rounded hover:bg-muted transition-colors",title:d("refreshOperations"),disabled:v,children:(0,B.jsx)(ad,{className:`w-4 h-4 text-muted-foreground hover:text-foreground ${v?"animate-spin":""}`})})]}),(0,B.jsxs)("p",{className:"text-sm text-muted-foreground",children:[d("operationCount",{count:h}),j?` (${P(j)})`:""]})]}),(0,B.jsxs)("div",{className:"flex items-center gap-3",children:[(0,B.jsxs)(a6.Select,{value:l??"all",onValueChange:a=>{var b;n(b="all"===a?null:a),q(0),U(j,0,b)},children:[(0,B.jsx)(a6.SelectTrigger,{className:"h-9 w-[180px] text-sm",children:(0,B.jsx)(a6.SelectValue,{placeholder:d("allTypes")})}),(0,B.jsx)(a6.SelectContent,{children:Q8.map(a=>(0,B.jsx)(a6.SelectItem,{value:a,children:(0,B.jsxs)("div",{children:[(0,B.jsx)("div",{children:O[a]}),"all"!==a&&(0,B.jsx)("div",{className:"text-xs text-muted-foreground font-mono",children:a})]})},a))})]}),(0,B.jsx)("div",{className:"flex gap-1 bg-muted p-1 rounded-lg",children:Q9.map(a=>(0,B.jsx)("button",{onClick:()=>{k(a),q(0),U(a,0,l)},className:`px-3 py-1.5 text-sm font-medium rounded-md transition-colors ${j===a?"bg-background shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:a?P(a):N.all},a??"all"))})]})]}),(0,B.jsx)("div",{children:f.length>0?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)("div",{className:"overflow-x-auto",children:(0,B.jsxs)(ai,{children:[(0,B.jsx)(aj,{children:(0,B.jsxs)(al,{children:[(0,B.jsx)(am,{className:"w-[100px]",children:d("table.id")}),(0,B.jsx)(am,{children:d("table.type")}),(0,B.jsx)(am,{children:d("table.created")}),(0,B.jsx)(am,{children:d("field.updated")}),(0,B.jsx)(am,{className:"w-[300px]",children:d("table.status")}),(0,B.jsx)(am,{className:"w-[110px]",children:d("table.actions")})]})}),(0,B.jsx)(ak,{children:f.map(a=>(0,B.jsxs)(al,{className:`cursor-pointer transition-colors duration-700 hover:bg-muted/50 ${ac.has(a.id)?"completed"===a.status?"bg-emerald-500/15":"bg-red-500/15":"failed"===a.status?"bg-red-500/5":""}`,onClick:()=>$(a.id),children:[(0,B.jsx)(an,{className:"font-mono text-xs text-muted-foreground",children:a.id.substring(0,8)}),(0,B.jsx)(an,{className:"font-medium",title:a.task_type,children:Q(a.task_type)}),(0,B.jsx)(an,{className:"text-sm text-muted-foreground",children:new Date(a.created_at).toLocaleString()}),(0,B.jsx)(an,{className:"text-sm text-muted-foreground",title:a.updated_at?new Date(a.updated_at).toLocaleString():void 0,children:a.updated_at?S(a.updated_at):"—"}),(0,B.jsx)(an,{className:"w-[300px]",children:(0,B.jsxs)("div",{className:"flex items-center gap-2 whitespace-nowrap",children:[R(a.status,a.error_message),"processing"===a.status&&T(a.progress,{compact:!0})]})}),(0,B.jsxs)(an,{className:"w-[110px] whitespace-nowrap",children:["pending"===a.status&&(0,B.jsxs)(W.Button,{variant:"ghost",size:"sm",className:"h-7 text-xs text-muted-foreground hover:text-red-600 dark:hover:text-red-400",onClick:b=>{b.stopPropagation(),Y(a.id)},disabled:r===a.id,children:[r===a.id?(0,B.jsx)(bc.default,{className:"w-3 h-3 animate-spin"}):(0,B.jsx)(bb.X,{className:"w-3 h-3 mr-1"}),r===a.id?"":d("action.cancel")]}),("failed"===a.status||"cancelled"===a.status)&&(0,B.jsxs)(W.Button,{variant:"ghost",size:"sm",className:"h-7 text-xs text-muted-foreground hover:text-blue-600 dark:hover:text-blue-400",onClick:b=>{b.stopPropagation(),Z(a.id)},disabled:t===a.id,children:[t===a.id?(0,B.jsx)(bc.default,{className:"w-3 h-3 animate-spin"}):(0,B.jsx)(Q5,{className:"w-3 h-3 mr-1"}),t===a.id?"":d("action.retry")]})]})]},a.id))})]})}),h>o&&(0,B.jsxs)("div",{className:"flex items-center justify-between mt-4 pt-4 border-t",children:[(0,B.jsx)("p",{className:"text-sm text-muted-foreground",children:d("pagination",{start:p+1,end:Math.min(p+o,h),total:h})}),(0,B.jsxs)("div",{className:"flex gap-2",children:[(0,B.jsx)(W.Button,{variant:"outline",size:"sm",onClick:()=>X(Math.max(0,p-o)),disabled:0===p,children:d("paginationPrevious")}),(0,B.jsx)(W.Button,{variant:"outline",size:"sm",onClick:()=>X(p+o),disabled:p+o>=h,children:d("paginationNext")})]})]})]}):(0,B.jsx)("p",{className:"text-muted-foreground text-center py-8 text-sm",children:j?d("emptyStateWithStatus",{status:P(j)}):d("emptyState")})}),(0,B.jsx)(bf.Dialog,{open:z,onOpenChange:A,children:(0,B.jsxs)(bf.DialogContent,{className:"max-w-3xl max-h-[80vh] overflow-y-auto",children:[(0,B.jsxs)(bf.DialogHeader,{children:[(0,B.jsx)(bf.DialogTitle,{children:d("operationDetails")}),(0,B.jsx)(bf.DialogDescription,{children:x?.operation_id&&(0,B.jsx)("span",{className:"font-mono text-xs",children:x.operation_id})})]}),D?(0,B.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,B.jsx)(bc.default,{className:"w-6 h-6 animate-spin text-muted-foreground"})}):x?(0,B.jsx)("div",{className:"space-y-4",children:x.error?(0,B.jsx)("div",{className:"text-red-600 dark:text-red-400",children:x.error}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,B.jsxs)("div",{children:[(0,B.jsx)("div",{className:"text-sm font-medium text-muted-foreground",children:d("field.status")}),(0,B.jsx)("div",{className:"mt-1",children:R(x.status)})]}),(0,B.jsxs)("div",{children:[(0,B.jsx)("div",{className:"text-sm font-medium text-muted-foreground",children:d("field.type")}),(0,B.jsx)("div",{className:"mt-1 font-mono text-sm",title:x.operation_type??void 0,children:Q(x.operation_type)})]}),(0,B.jsxs)("div",{children:[(0,B.jsx)("div",{className:"text-sm font-medium text-muted-foreground",children:d("field.created")}),(0,B.jsx)("div",{className:"mt-1 text-sm",children:x.created_at?new Date(x.created_at).toLocaleString():d("notAvailable")})]}),(0,B.jsxs)("div",{children:[(0,B.jsx)("div",{className:"text-sm font-medium text-muted-foreground",children:d("field.updated")}),(0,B.jsx)("div",{className:"mt-1 text-sm",children:x.updated_at?new Date(x.updated_at).toLocaleString():d("notAvailable")})]}),x.completed_at&&(0,B.jsxs)("div",{children:[(0,B.jsx)("div",{className:"text-sm font-medium text-muted-foreground",children:d("field.completed")}),(0,B.jsx)("div",{className:"mt-1 text-sm",children:new Date(x.completed_at).toLocaleString()})]}),x.result_metadata?.items_count!==void 0&&(0,B.jsxs)("div",{children:[(0,B.jsx)("div",{className:"text-sm font-medium text-muted-foreground",children:d("totalItems")}),(0,B.jsx)("div",{className:"mt-1 text-sm",children:x.result_metadata.items_count})]})]}),"processing"===x.status&&x.progress&&(0,B.jsxs)("div",{children:[(0,B.jsx)("div",{className:"text-sm font-medium text-muted-foreground mb-1",children:d("field.progress")}),T(x.progress),"consolidation"===x.operation_type&&(0,B.jsx)("p",{className:"mt-1.5 text-[11px] leading-snug text-muted-foreground/70",children:d("progressEstimateNote")})]}),("pending"===x.status||"failed"===x.status||"cancelled"===x.status)&&(0,B.jsxs)("div",{className:"flex gap-2",children:["pending"===x.status&&(0,B.jsxs)(W.Button,{variant:"outline",size:"sm",className:"text-xs",onClick:()=>Y(x.operation_id),disabled:r===x.operation_id,children:[r===x.operation_id?(0,B.jsx)(bc.default,{className:"w-3 h-3 animate-spin mr-1"}):(0,B.jsx)(bb.X,{className:"w-3 h-3 mr-1"}),d("action.cancel")]}),("failed"===x.status||"cancelled"===x.status)&&(0,B.jsxs)(W.Button,{variant:"outline",size:"sm",className:"text-xs",onClick:()=>Z(x.operation_id),disabled:t===x.operation_id,children:[t===x.operation_id?(0,B.jsx)(bc.default,{className:"w-3 h-3 animate-spin mr-1"}):(0,B.jsx)(Q5,{className:"w-3 h-3 mr-1"}),d("action.retry")]})]}),x.result_metadata&&Object.keys(x.result_metadata).length>0&&(0,B.jsxs)("div",{children:[(0,B.jsx)("div",{className:"text-sm font-medium text-muted-foreground mb-2",children:d("metadata")}),(0,B.jsx)("pre",{className:"rounded-lg border bg-muted/30 p-3 text-xs font-mono overflow-x-auto max-h-96 whitespace-pre-wrap break-words",children:JSON.stringify(x.result_metadata,null,2)})]}),x.error_message&&(0,B.jsxs)("div",{className:"rounded-lg border border-red-500/20 bg-red-500/5 p-3",children:[(0,B.jsx)("div",{className:"text-sm font-medium text-red-600 dark:text-red-400 mb-1",children:d("error")}),(0,B.jsx)("div",{className:"text-sm text-red-600/80 dark:text-red-400/80 font-mono",children:x.error_message})]}),x.child_operations&&x.child_operations.length>0&&(0,B.jsxs)("div",{children:[(0,B.jsx)("div",{className:"text-sm font-medium text-muted-foreground mb-2",children:d("subBatchesCount",{count:x.result_metadata?.num_sub_batches||x.child_operations.length})}),(0,B.jsxs)(ai,{children:[(0,B.jsx)(aj,{children:(0,B.jsxs)(al,{children:[(0,B.jsx)(am,{className:"w-[60px]",children:d("table.index")}),(0,B.jsx)(am,{className:"w-[100px]",children:d("table.id")}),(0,B.jsx)(am,{className:"w-[80px]",children:d("table.items")}),(0,B.jsx)(am,{children:d("table.status")})]})}),(0,B.jsx)(ak,{children:x.child_operations.map(a=>(0,B.jsxs)(al,{children:[(0,B.jsx)(an,{className:"text-sm",children:a.sub_batch_index}),(0,B.jsx)(an,{className:"font-mono text-xs text-muted-foreground",children:a.operation_id.substring(0,8)}),(0,B.jsx)(an,{className:"text-sm",children:a.items_count}),(0,B.jsx)(an,{children:R(a.status,a.error_message)})]},a.operation_id))})]})]}),(a=J===x.operation_id,b=!!x.task_payload,c=!!x.result_metadata?.is_parent,(0,B.jsxs)("div",{children:[(0,B.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,B.jsx)("div",{className:"text-sm font-medium text-muted-foreground",children:d("rawPayload")}),!a&&(0,B.jsxs)(W.Button,{variant:"outline",size:"sm",className:"h-7 text-xs",onClick:_,disabled:G,children:[G?(0,B.jsx)(bc.default,{className:"w-3 h-3 mr-1 animate-spin"}):(0,B.jsx)(Q6,{className:"w-3 h-3 mr-1"}),d("loadRaw")]})]}),b?(0,B.jsx)("pre",{className:"rounded-lg border bg-muted/30 p-3 text-xs font-mono overflow-x-auto max-h-96 whitespace-pre-wrap break-words",children:JSON.stringify(x.task_payload,null,2)}):a?(0,B.jsx)("p",{className:"text-xs text-muted-foreground",children:c?d("rawPayloadParentHelp"):d("rawPayloadEmpty")}):(0,B.jsx)("p",{className:"text-xs text-muted-foreground",children:d("rawPayloadHelp")})]}))]})}):null]})})]}):null}var bc=bc;let Rb=(0,K.default)("layout-grid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]);function Rc(){let a=(0,E.useTranslations)("mentalModels"),{currentBank:b}=(0,H.useBank)(),[c,d]=(0,C.useState)([]),[e,f]=(0,C.useState)(!1),[g,h]=(0,C.useState)("files"),[i,j]=(0,C.useState)(""),[k,l]=(0,C.useState)(1),[n,o]=(0,C.useState)(!1),[p,q]=(0,C.useState)(null),[r,s]=(0,C.useState)(null),[t,u]=(0,C.useState)([]),[v,w]=(0,C.useState)("any"),[x,y]=(0,C.useState)(!1),[z,A]=(0,C.useState)(null),[D,G]=(0,C.useState)(null),[I,J]=(0,C.useState)(!1),[K,M]=(0,C.useState)(null),[N,O]=(0,C.useState)(!1),R=c.filter(a=>{if(!i)return!0;let b=i.toLowerCase();return a.id.toLowerCase().includes(b)||a.name.toLowerCase().includes(b)||a.source_query.toLowerCase().includes(b)||a.content.toLowerCase().includes(b)}),S=async()=>{if(b){f(!0);try{let a=await V.client.listMentalModels(b,t.length>0?t:void 0,t.length>0?v:void 0);d(a.items||[])}catch(a){console.error("Error loading mental models:",a)}finally{f(!1)}}},[T,U]=(0,C.useState)(new Set),Y=async c=>{if(!b)return;let e=c.last_refreshed_at;U(a=>new Set(a).add(c.id));try{await V.client.refreshMentalModel(b,c.id);for(let f=0;f<120;f++){await new Promise(a=>setTimeout(a,1e3));let f=await V.client.getMentalModel(b,c.id);if(f.last_refreshed_at!==e){d(a=>a.map(a=>a.id===c.id?f:a)),p?.id===c.id&&q(f),F.toast.success(a("toastRefreshed"));return}}F.toast.error(a("toastRefreshTimeout"))}catch{}finally{U(a=>{let b=new Set(a);return b.delete(c.id),b})}},Z=async()=>{if(b&&D){J(!0);try{await V.client.deleteMentalModel(b,D.id),d(a=>a.filter(a=>a.id!==D.id)),p?.id===D.id&&q(null),G(null)}catch(a){}finally{J(!1)}}},$=async()=>{if(b&&K){O(!0);try{let a=await V.client.clearMentalModel(b,K.id);d(b=>b.map(b=>b.id===a.id?a:b)),p?.id===a.id&&q(a),F.toast.success("Mental model content cleared"),M(null)}catch{}finally{O(!1)}}};if((0,C.useEffect)(()=>{b&&S()},[b,t,v]),(0,C.useEffect)(()=>{let a=a=>{"Escape"===a.key&&q(null)};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[]),(0,C.useEffect)(()=>{l(1)},[i,t,v]),!b)return(0,B.jsx)(bp.Card,{children:(0,B.jsx)(bp.CardContent,{className:"p-10 text-center",children:(0,B.jsx)("p",{className:"text-muted-foreground",children:a("selectBankPrompt")})})});let ab=Math.ceil(R.length/100),ac=(k-1)*100,ae=ac+100,af=R.slice(ac,ae);return(0,B.jsxs)("div",{children:[e?(0,B.jsxs)("div",{className:"text-center py-12",children:[(0,B.jsx)(ad,{className:"w-8 h-8 mx-auto mb-3 text-muted-foreground animate-spin"}),(0,B.jsx)("p",{className:"text-muted-foreground",children:a("loading")})]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)("div",{className:"mb-4 flex items-center gap-3 flex-wrap",children:[(0,B.jsx)(X.Input,{type:"text",value:i,onChange:a=>j(a.target.value),placeholder:a("filterPlaceholder"),className:"w-80 h-9"}),(0,B.jsx)(IG,{value:t,onChange:u,fetchSuggestions:async a=>{if(!b)return[];let c=a?`${a}*`:void 0;return(await V.client.listTags(b,c,20,"mental_models")).items.map(a=>a.tag)},matchMode:v,onMatchModeChange:w,className:"flex-1 min-w-[260px]"}),(0,B.jsxs)(W.Button,{onClick:()=>o(!0),size:"sm",children:[(0,B.jsx)(II.Plus,{className:"w-4 h-4 mr-2"}),a("addMentalModel")]})]}),(0,B.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,B.jsx)("div",{className:"text-sm text-muted-foreground",children:i||t.length>0?a("countFiltered",{filtered:R.length,total:c.length}):a("count",{count:c.length})}),(0,B.jsx)("div",{className:"flex items-center gap-3",children:(0,B.jsxs)("div",{className:"flex items-center gap-2 bg-muted rounded-lg p-1",children:[(0,B.jsxs)("button",{onClick:()=>h("files"),className:`px-3 py-1.5 rounded-md text-sm font-medium transition-all flex items-center gap-1.5 ${"files"===g?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:[(0,B.jsx)(Ql,{className:"w-4 h-4"}),a("viewList")]}),(0,B.jsxs)("button",{onClick:()=>h("dashboard"),className:`px-3 py-1.5 rounded-md text-sm font-medium transition-all flex items-center gap-1.5 ${"dashboard"===g?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:[(0,B.jsx)(Rb,{className:"w-4 h-4"}),a("viewDashboard")]})]})})]}),R.length>0?(0,B.jsxs)(B.Fragment,{children:["dashboard"===g&&(0,B.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:af.map(b=>(0,B.jsx)(bp.Card,{className:`cursor-pointer transition-all hover:shadow-md hover:border-primary/50 ${p?.id===b.id?"border-primary shadow-md":""}`,onClick:()=>q(b),children:(0,B.jsxs)(bp.CardContent,{className:"p-4",children:[(0,B.jsxs)("div",{className:"flex items-start justify-between mb-3",children:[(0,B.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,B.jsx)("h3",{className:"font-semibold text-foreground mb-1 truncate",children:b.name}),(0,B.jsxs)("div",{className:"flex items-center gap-2",children:[(0,B.jsx)("code",{className:"text-xs font-mono text-muted-foreground truncate",children:b.id}),(0,B.jsx)("span",{className:`text-xs px-2 py-0.5 rounded-full font-medium flex-shrink-0 ${b.trigger?.refresh_after_consolidation?"bg-green-500/10 text-green-600 dark:text-green-400":"bg-slate-500/10 text-slate-600 dark:text-slate-400"}`,children:b.trigger?.refresh_after_consolidation?a("badgeAutoRefresh"):a("badgeManual")})]})]}),(0,B.jsx)(Rd,{m:b,refreshing:T.has(b.id),onEdit:a=>{A(a),y(!0)},onRefresh:Y,onClear:a=>M({id:a.id,name:a.name}),onDelete:a=>G({id:a.id,name:a.name}),triggerClassName:"h-7 w-7 ml-2 flex-shrink-0"})]}),(0,B.jsx)("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-3",children:b.source_query}),(0,B.jsxs)("div",{className:"relative mb-3 border-t border-border pt-3 max-h-40 overflow-hidden",children:[(0,B.jsx)(Pn,{children:b.content}),(0,B.jsx)("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 h-12 bg-gradient-to-t from-card to-transparent"})]}),(0,B.jsxs)("div",{className:"flex items-center justify-between text-xs border-t border-border pt-3",children:[(0,B.jsx)("div",{className:"flex items-center gap-2",children:b.tags.length>0&&(0,B.jsxs)("div",{className:"flex gap-1",children:[b.tags.slice(0,2).map(a=>(0,B.jsx)("span",{className:"px-1.5 py-0.5 rounded text-xs bg-blue-500/10 text-blue-600 dark:text-blue-400",children:a},a)),b.tags.length>2&&(0,B.jsxs)("span",{className:"px-1.5 py-0.5 rounded text-xs bg-muted text-muted-foreground",children:["+",b.tags.length-2]})]})}),(0,B.jsx)("div",{className:"text-muted-foreground",title:Pr(b.last_refreshed_at),children:Pq(b.last_refreshed_at)})]})]})},b.id))}),"files"===g&&(0,B.jsx)(Rg,{mentalModels:R,selectedId:r,onSelect:s,onOpenDetail:q,refreshingIds:T,onEdit:a=>{A(a),y(!0)},onRefresh:Y,onClear:a=>M({id:a.id,name:a.name}),onDelete:a=>G({id:a.id,name:a.name})}),"files"!==g&&ab>1&&(0,B.jsxs)("div",{className:"flex items-center justify-between mt-3 pt-3 border-t",children:[(0,B.jsxs)("div",{className:"text-xs text-muted-foreground",children:[ac+1,"-",Math.min(ae,R.length)," of"," ",R.length]}),(0,B.jsxs)("div",{className:"flex items-center gap-1",children:[(0,B.jsx)(W.Button,{variant:"outline",size:"sm",onClick:()=>l(1),disabled:1===k,className:"h-7 w-7 p-0",children:(0,B.jsx)(_,{className:"h-3 w-3"})}),(0,B.jsx)(W.Button,{variant:"outline",size:"sm",onClick:()=>l(a=>Math.max(1,a-1)),disabled:1===k,className:"h-7 w-7 p-0",children:(0,B.jsx)(P,{className:"h-3 w-3"})}),(0,B.jsxs)("span",{className:"text-xs px-2",children:[k," / ",ab]}),(0,B.jsx)(W.Button,{variant:"outline",size:"sm",onClick:()=>l(a=>Math.min(ab,a+1)),disabled:k===ab,className:"h-7 w-7 p-0",children:(0,B.jsx)(Q.ChevronRight,{className:"h-3 w-3"})}),(0,B.jsx)(W.Button,{variant:"outline",size:"sm",onClick:()=>l(ab),disabled:k===ab,className:"h-7 w-7 p-0",children:(0,B.jsx)(aa,{className:"h-3 w-3"})})]})]})]}):(0,B.jsxs)("div",{className:"p-6 border border-dashed border-border rounded-lg text-center",children:[(0,B.jsx)(L,{className:"w-6 h-6 mx-auto mb-2 text-muted-foreground"}),(0,B.jsx)("p",{className:"text-sm text-muted-foreground",children:i?a("emptyFilterMatch"):a("emptyNoModels")})]})]}),(0,B.jsx)(Re,{open:n,onClose:()=>o(!1),onCreated:()=>{o(!1),S()}}),(0,B.jsx)(IU,{open:!!D,onOpenChange:a=>!a&&G(null),children:(0,B.jsxs)(I9,{children:[(0,B.jsxs)(Ja,{children:[(0,B.jsx)(Jc,{children:a("deleteDialogTitle")}),(0,B.jsxs)(Jd,{children:[a("deleteDialogDescription",{name:D?.name??""}),(0,B.jsx)("br",{}),(0,B.jsx)("br",{}),(0,B.jsx)("span",{className:"text-destructive font-semibold",children:a("deleteDialogWarning")})]})]}),(0,B.jsxs)(Jb,{className:"flex-row justify-end space-x-2",children:[(0,B.jsx)(Jf,{className:"mt-0",children:a("deleteDialogCancel")}),(0,B.jsxs)(Je,{onClick:Z,disabled:I,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:[I?(0,B.jsx)(bc.default,{className:"w-4 h-4 animate-spin mr-1"}):null,a("deleteDialogConfirm")]})]})]})}),(0,B.jsx)(IU,{open:!!K,onOpenChange:a=>!a&&M(null),children:(0,B.jsxs)(I9,{children:[(0,B.jsxs)(Ja,{children:[(0,B.jsx)(Jc,{children:a("clearDialogTitle")}),(0,B.jsxs)(Jd,{children:[a.rich("clearDialogDescription",{name:K?.name??"",bold:a=>(0,B.jsx)("span",{className:"font-semibold",children:a})}),(0,B.jsx)("br",{}),(0,B.jsx)("br",{}),a("clearDialogReSynth")]})]}),(0,B.jsxs)(Jb,{className:"flex-row justify-end space-x-2",children:[(0,B.jsx)(Jf,{className:"mt-0",children:a("cancelButton")}),(0,B.jsxs)(Je,{onClick:$,disabled:N,children:[N?(0,B.jsx)(bc.default,{className:"w-4 h-4 animate-spin mr-1"}):null,a("clearDialogConfirm")]})]})]})}),(0,B.jsx)(PD,{mentalModelId:p?.id??null,onClose:()=>q(null),onDelete:a=>G({id:a.id,name:a.name}),onClear:a=>M({id:a.id,name:a.name}),onEdit:a=>{A(a),y(!0)},onRefreshed:a=>{d(b=>b.map(b=>b.id===a.id?a:b)),q(a)}}),z&&(0,B.jsx)(Rf,{open:x,mentalModel:z,onClose:()=>{y(!1),A(null)},onUpdated:a=>{d(b=>b.map(b=>b.id===a.id?a:b)),q(a),y(!1),A(null)}})]})}function Rd({m:a,refreshing:b,onEdit:c,onRefresh:d,onClear:e,onDelete:f,triggerClassName:g}){let h=(0,E.useTranslations)("mentalModels");return(0,B.jsxs)(IN.DropdownMenu,{children:[(0,B.jsx)(IN.DropdownMenuTrigger,{asChild:!0,children:(0,B.jsx)(W.Button,{variant:"ghost",size:"sm",className:`p-0 text-muted-foreground ${g??"h-8 w-8"}`,onClick:a=>a.stopPropagation(),"aria-label":h("actionsAriaLabel"),children:(0,B.jsx)(Ji,{className:"h-4 w-4"})})}),(0,B.jsxs)(IN.DropdownMenuContent,{align:"end",onClick:a=>a.stopPropagation(),children:[(0,B.jsxs)(IN.DropdownMenuItem,{onClick:()=>c(a),children:[(0,B.jsx)(Jh,{className:"h-4 w-4 mr-2"}),h("actionEdit")]}),(0,B.jsxs)(IN.DropdownMenuItem,{onClick:()=>d(a),disabled:b,children:[(0,B.jsx)(ad,{className:`h-4 w-4 mr-2 ${b?"animate-spin":""}`}),h("actionRefresh")]}),(0,B.jsxs)(IN.DropdownMenuItem,{onClick:()=>e(a),children:[(0,B.jsx)(Kq,{className:"h-4 w-4 mr-2"}),h("actionClearContent")]}),(0,B.jsx)(IN.DropdownMenuSeparator,{}),(0,B.jsxs)(IN.DropdownMenuItem,{onClick:()=>f(a),className:"text-red-600 focus:text-red-600 dark:text-red-400 dark:focus:text-red-400 focus:bg-red-500/10",children:[(0,B.jsx)(Jg,{className:"h-4 w-4 mr-2"}),h("actionDelete")]})]})]})}function Re({open:a,onClose:b,onCreated:c}){let d=(0,E.useTranslations)("mentalModels"),{currentBank:e}=(0,H.useBank)(),[f,g]=(0,C.useState)(!1),[h,i]=(0,C.useState)({id:"",name:"",sourceQuery:"",maxTokens:"2048",tags:"",autoRefresh:!1,mode:"full",factTypes:[],excludeMentalModels:!1,excludeMentalModelIds:"",tagsMatch:"",tagGroups:"",includeChunks:"",recallMaxTokens:"",recallChunksMaxTokens:""}),j=async()=>{if(e&&h.name.trim()&&h.sourceQuery.trim()){g(!0);try{let a,b=h.tags.split(",").map(a=>a.trim()).filter(a=>a.length>0),f=parseInt(h.maxTokens)||2048,g=h.excludeMentalModelIds.split(",").map(a=>a.trim()).filter(a=>a.length>0);if(h.tagGroups.trim())try{a=JSON.parse(h.tagGroups.trim())}catch{F.toast.error(d("invalidTagGroupsJson"));return}let j=h.recallMaxTokens.trim()?parseInt(h.recallMaxTokens,10):void 0,k=h.recallChunksMaxTokens.trim()?parseInt(h.recallChunksMaxTokens,10):void 0,l="true"===h.includeChunks||"false"!==h.includeChunks&&void 0;await V.client.createMentalModel(e,{id:h.id.trim()||void 0,name:h.name.trim(),source_query:h.sourceQuery.trim(),tags:b.length>0?b:void 0,max_tokens:f,trigger:{mode:h.mode,refresh_after_consolidation:h.autoRefresh,fact_types:h.factTypes.length>0?h.factTypes:void 0,exclude_mental_models:h.excludeMentalModels||void 0,exclude_mental_model_ids:g.length>0?g:void 0,tags_match:h.tagsMatch||void 0,tag_groups:a,include_chunks:l,recall_max_tokens:j,recall_chunks_max_tokens:k}}),i({id:"",name:"",sourceQuery:"",maxTokens:"2048",tags:"",autoRefresh:!1,mode:"full",factTypes:[],excludeMentalModels:!1,excludeMentalModelIds:"",tagsMatch:"",tagGroups:"",includeChunks:"",recallMaxTokens:"",recallChunksMaxTokens:""}),c()}catch(a){}finally{g(!1)}}};return(0,B.jsx)(bf.Dialog,{open:a,onOpenChange:a=>{a||(i({id:"",name:"",sourceQuery:"",maxTokens:"2048",tags:"",autoRefresh:!1,mode:"full",factTypes:[],excludeMentalModels:!1,excludeMentalModelIds:"",tagsMatch:"",tagGroups:"",includeChunks:"",recallMaxTokens:"",recallChunksMaxTokens:""}),b())},children:(0,B.jsxs)(bf.DialogContent,{className:"sm:max-w-2xl max-h-[90vh] flex flex-col",children:[(0,B.jsxs)(bf.DialogHeader,{children:[(0,B.jsx)(bf.DialogTitle,{children:d("createDialogTitle")}),(0,B.jsx)(bf.DialogDescription,{children:d("createDialogDescription")})]}),(0,B.jsxs)(bh.Tabs,{defaultValue:"general",className:"py-2 flex-1 flex flex-col min-h-0 overflow-hidden",children:[(0,B.jsxs)(bh.TabsList,{className:"w-full",children:[(0,B.jsx)(bh.TabsTrigger,{value:"general",className:"flex-1",children:d("tabGeneral")}),(0,B.jsx)(bh.TabsTrigger,{value:"options",className:"flex-1",children:d("tabOptions")})]}),(0,B.jsxs)("div",{className:"flex-1 overflow-y-auto mt-2 px-1.5",children:[(0,B.jsxs)(bh.TabsContent,{value:"general",className:"space-y-4 pt-4",children:[(0,B.jsxs)("div",{className:"space-y-2",children:[(0,B.jsx)("label",{className:"text-sm font-medium text-foreground",children:d("fieldId")}),(0,B.jsx)(X.Input,{value:h.id,onChange:a=>i({...h,id:a.target.value}),placeholder:d("fieldIdPlaceholder")})]}),(0,B.jsxs)("div",{className:"space-y-2",children:[(0,B.jsx)("label",{className:"text-sm font-medium text-foreground",children:d("fieldName")}),(0,B.jsx)(X.Input,{value:h.name,onChange:a=>i({...h,name:a.target.value}),placeholder:d("fieldNamePlaceholder")})]}),(0,B.jsxs)("div",{className:"space-y-2",children:[(0,B.jsx)("label",{className:"text-sm font-medium text-foreground",children:d("fieldSourceQuery")}),(0,B.jsx)(JI.Textarea,{value:h.sourceQuery,onChange:a=>i({...h,sourceQuery:a.target.value}),placeholder:d("fieldSourceQueryPlaceholder"),className:"min-h-[140px] font-mono text-sm leading-6 whitespace-pre-wrap",spellCheck:!1})]}),(0,B.jsxs)("div",{className:"space-y-2",children:[(0,B.jsx)("label",{className:"text-sm font-medium text-foreground",children:d("fieldMaxTokens")}),(0,B.jsx)(X.Input,{type:"number",value:h.maxTokens,onChange:a=>i({...h,maxTokens:a.target.value}),placeholder:d("fieldMaxTokensPlaceholder"),min:"256",max:"8192"})]})]}),(0,B.jsxs)(bh.TabsContent,{value:"options",className:"space-y-6 pt-4",children:[(0,B.jsxs)("section",{className:"space-y-4",children:[(0,B.jsx)("h3",{className:"text-sm font-semibold text-foreground border-b pb-1",children:d("optionsSectionRefresh")}),(0,B.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,B.jsx)(IM.Checkbox,{id:"auto-refresh",checked:h.autoRefresh,onCheckedChange:a=>i({...h,autoRefresh:!0===a})}),(0,B.jsx)("label",{htmlFor:"auto-refresh",className:"text-sm font-medium text-foreground cursor-pointer",children:d("optionsAutoRefreshLabel")})]}),(0,B.jsxs)("div",{className:"space-y-2",children:[(0,B.jsx)("label",{className:"text-sm font-medium text-foreground",children:d("optionsRefreshModeLabel")}),(0,B.jsxs)(a6.Select,{value:h.mode,onValueChange:a=>i({...h,mode:a}),children:[(0,B.jsx)(a6.SelectTrigger,{children:(0,B.jsx)(a6.SelectValue,{})}),(0,B.jsxs)(a6.SelectContent,{children:[(0,B.jsx)(a6.SelectItem,{value:"full",children:d("optionsRefreshModeFull")}),(0,B.jsx)(a6.SelectItem,{value:"delta",children:d("optionsRefreshModeDelta")})]})]}),(0,B.jsx)("p",{className:"text-xs text-muted-foreground",children:d("optionsRefreshModeDeltaDescription")})]})]}),(0,B.jsxs)("section",{className:"space-y-4",children:[(0,B.jsx)("h3",{className:"text-sm font-semibold text-foreground border-b pb-1",children:d("optionsSectionOtherModels")}),(0,B.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,B.jsx)(IM.Checkbox,{id:"exclude-mental-models",checked:h.excludeMentalModels,onCheckedChange:a=>i({...h,excludeMentalModels:!0===a})}),(0,B.jsx)("label",{htmlFor:"exclude-mental-models",className:"text-sm font-medium text-foreground cursor-pointer",children:d("optionsExcludeAllLabel")})]}),(0,B.jsxs)("div",{className:"space-y-2",children:[(0,B.jsx)("label",{className:"text-sm font-medium text-foreground",children:d("optionsExcludeIdsLabel")}),(0,B.jsx)(X.Input,{value:h.excludeMentalModelIds,onChange:a=>i({...h,excludeMentalModelIds:a.target.value}),placeholder:d("optionsExcludeIdsPlaceholder")})]})]}),(0,B.jsxs)("section",{className:"space-y-4",children:[(0,B.jsx)("h3",{className:"text-sm font-semibold text-foreground border-b pb-1",children:d("optionsSectionTags")}),(0,B.jsxs)("div",{className:"space-y-2",children:[(0,B.jsx)("label",{className:"text-sm font-medium text-foreground",children:d("optionsTagsLabel")}),(0,B.jsx)(X.Input,{value:h.tags,onChange:a=>i({...h,tags:a.target.value}),placeholder:d("optionsTagsPlaceholder")}),(0,B.jsx)("p",{className:"text-xs text-muted-foreground",children:d("optionsTagsDescription")})]}),(0,B.jsxs)("div",{className:"space-y-2",children:[(0,B.jsx)("label",{className:"text-sm font-medium text-foreground",children:d("optionsTagsMatchLabel")}),(0,B.jsxs)(a6.Select,{value:h.tagsMatch,onValueChange:a=>i({...h,tagsMatch:"default"===a?"":a}),children:[(0,B.jsx)(a6.SelectTrigger,{children:(0,B.jsx)(a6.SelectValue,{placeholder:d("optionsTagsMatchDefaultPlaceholder")})}),(0,B.jsxs)(a6.SelectContent,{children:[(0,B.jsx)(a6.SelectItem,{value:"default",children:d("optionsTagsMatchDefault")}),(0,B.jsx)(a6.SelectItem,{value:"any",children:d("optionsTagsMatchAny")}),(0,B.jsx)(a6.SelectItem,{value:"all",children:d("optionsTagsMatchAll")}),(0,B.jsx)(a6.SelectItem,{value:"any_strict",children:d("optionsTagsMatchAnyStrict")}),(0,B.jsx)(a6.SelectItem,{value:"all_strict",children:d("optionsTagsMatchAllStrict")})]})]}),(0,B.jsx)("p",{className:"text-xs text-muted-foreground",children:d("optionsTagsMatchDescription")})]}),(0,B.jsxs)("div",{className:"space-y-2",children:[(0,B.jsx)("label",{className:"text-sm font-medium text-foreground",children:d("optionsTagGroupsLabel")}),(0,B.jsx)(JI.Textarea,{value:h.tagGroups,onChange:a=>i({...h,tagGroups:a.target.value}),placeholder:'e.g., [{"or": [{"tags": ["user:alice"], "match": "all_strict"}, {"tags": ["shared"]}]}]',rows:3,className:"font-mono text-xs"}),(0,B.jsx)("p",{className:"text-xs text-muted-foreground",children:d("optionsTagGroupsDescription")})]})]}),(0,B.jsxs)("section",{className:"space-y-4",children:[(0,B.jsx)("h3",{className:"text-sm font-semibold text-foreground border-b pb-1",children:d("optionsSectionRecall")}),(0,B.jsx)("p",{className:"text-xs text-muted-foreground",children:d("optionsRecallDescription")}),(0,B.jsxs)("div",{className:"space-y-3",children:[(0,B.jsx)("label",{className:"text-sm font-medium text-foreground",children:d("optionsFactTypesLabel")}),(0,B.jsx)(JC,{value:h.factTypes,onChange:a=>i({...h,factTypes:a})}),(0,B.jsx)("p",{className:"text-xs text-muted-foreground",children:d("optionsFactTypesEmpty")})]}),(0,B.jsxs)("div",{className:"space-y-2",children:[(0,B.jsx)("label",{className:"text-sm font-medium text-foreground",children:d("optionsIncludeChunksLabel")}),(0,B.jsxs)(a6.Select,{value:h.includeChunks||"default",onValueChange:a=>i({...h,includeChunks:"default"===a?"":a}),children:[(0,B.jsx)(a6.SelectTrigger,{children:(0,B.jsx)(a6.SelectValue,{})}),(0,B.jsxs)(a6.SelectContent,{children:[(0,B.jsx)(a6.SelectItem,{value:"default",children:d("optionsIncludeChunksDefault")}),(0,B.jsx)(a6.SelectItem,{value:"true",children:d("optionsIncludeChunksYes")}),(0,B.jsx)(a6.SelectItem,{value:"false",children:d("optionsIncludeChunksNo")})]})]})]}),(0,B.jsxs)("div",{className:"space-y-2",children:[(0,B.jsx)("label",{className:"text-sm font-medium text-foreground",children:d("optionsRecallMaxTokensLabel")}),(0,B.jsx)(X.Input,{type:"number",value:h.recallMaxTokens,onChange:a=>i({...h,recallMaxTokens:a.target.value}),placeholder:d("optionsRecallMaxTokensPlaceholder"),min:"0"}),(0,B.jsx)("p",{className:"text-xs text-muted-foreground",children:d("optionsRecallMaxTokensDescription")})]}),(0,B.jsxs)("div",{className:"space-y-2",children:[(0,B.jsx)("label",{className:"text-sm font-medium text-foreground",children:d("optionsRecallChunksMaxTokensLabel")}),(0,B.jsx)(X.Input,{type:"number",value:h.recallChunksMaxTokens,onChange:a=>i({...h,recallChunksMaxTokens:a.target.value}),placeholder:d("optionsRecallChunksMaxTokensPlaceholder"),min:"0"}),(0,B.jsx)("p",{className:"text-xs text-muted-foreground",children:d("optionsRecallChunksMaxTokensDescription")})]})]})]})]})]}),(0,B.jsxs)(bf.DialogFooter,{children:[(0,B.jsx)(W.Button,{variant:"outline",onClick:b,disabled:f,children:d("cancelButton")}),(0,B.jsx)(W.Button,{onClick:j,disabled:f||!h.name.trim()||!h.sourceQuery.trim(),children:f?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(bc.default,{className:"w-4 h-4 animate-spin mr-1"}),d("creatingButton")]}):d("createButton")})]})]})})}function Rf({open:a,mentalModel:b,onClose:c,onUpdated:d}){let e=(0,E.useTranslations)("mentalModels"),{currentBank:f}=(0,H.useBank)(),[g,h]=(0,C.useState)(!1),i=()=>({name:b.name,sourceQuery:b.source_query,maxTokens:String(b.max_tokens||2048),tags:b.tags.join(", "),autoRefresh:b.trigger?.refresh_after_consolidation||!1,mode:b.trigger?.mode||"full",factTypes:b.trigger?.fact_types||[],excludeMentalModels:b.trigger?.exclude_mental_models||!1,excludeMentalModelIds:(b.trigger?.exclude_mental_model_ids||[]).join(", "),tagsMatch:b.trigger?.tags_match||"",tagGroups:b.trigger?.tag_groups?JSON.stringify(b.trigger.tag_groups,null,2):"",includeChunks:b.trigger?.include_chunks===!0?"true":b.trigger?.include_chunks===!1?"false":"",recallMaxTokens:b.trigger?.recall_max_tokens!=null?String(b.trigger.recall_max_tokens):"",recallChunksMaxTokens:b.trigger?.recall_chunks_max_tokens!=null?String(b.trigger.recall_chunks_max_tokens):""}),[j,k]=(0,C.useState)(i);(0,C.useEffect)(()=>{a&&k(i())},[a,b]);let l=async()=>{if(f&&j.name.trim()&&j.sourceQuery.trim()){h(!0);try{let a,g=j.tags.split(",").map(a=>a.trim()).filter(a=>a.length>0),h=parseInt(j.maxTokens)||2048,i=j.excludeMentalModelIds.split(",").map(a=>a.trim()).filter(a=>a.length>0);if(j.tagGroups.trim())try{a=JSON.parse(j.tagGroups.trim())}catch{F.toast.error(e("invalidTagGroupsJson"));return}let k=j.recallMaxTokens.trim()?parseInt(j.recallMaxTokens,10):void 0,l=j.recallChunksMaxTokens.trim()?parseInt(j.recallChunksMaxTokens,10):void 0,n="true"===j.includeChunks||"false"!==j.includeChunks&&void 0,o=await V.client.updateMentalModel(f,b.id,{name:j.name.trim(),source_query:j.sourceQuery.trim(),tags:g.length>0?g:void 0,max_tokens:h,trigger:{mode:j.mode,refresh_after_consolidation:j.autoRefresh,fact_types:j.factTypes.length>0?j.factTypes:void 0,exclude_mental_models:j.excludeMentalModels||void 0,exclude_mental_model_ids:i.length>0?i:void 0,tags_match:j.tagsMatch||void 0,tag_groups:a,include_chunks:n,recall_max_tokens:k,recall_chunks_max_tokens:l}});d(o),c()}catch(a){}finally{h(!1)}}};return(0,B.jsx)(bf.Dialog,{open:a,onOpenChange:a=>!a&&c(),children:(0,B.jsxs)(bf.DialogContent,{className:"sm:max-w-2xl max-h-[90vh] flex flex-col",children:[(0,B.jsxs)(bf.DialogHeader,{children:[(0,B.jsx)(bf.DialogTitle,{children:e("updateDialogTitle")}),(0,B.jsx)(bf.DialogDescription,{children:e("updateDialogDescription")})]}),(0,B.jsxs)(bh.Tabs,{defaultValue:"general",className:"py-2 flex-1 flex flex-col min-h-0 overflow-hidden",children:[(0,B.jsxs)(bh.TabsList,{className:"w-full",children:[(0,B.jsx)(bh.TabsTrigger,{value:"general",className:"flex-1",children:e("tabGeneral")}),(0,B.jsx)(bh.TabsTrigger,{value:"options",className:"flex-1",children:e("tabOptions")})]}),(0,B.jsxs)("div",{className:"flex-1 overflow-y-auto mt-2 px-1.5",children:[(0,B.jsxs)(bh.TabsContent,{value:"general",className:"space-y-4 pt-4",children:[(0,B.jsxs)("div",{className:"space-y-2",children:[(0,B.jsx)("label",{className:"text-sm font-medium text-muted-foreground",children:e("fieldId")}),(0,B.jsx)(X.Input,{value:b.id,disabled:!0,className:"bg-muted"})]}),(0,B.jsxs)("div",{className:"space-y-2",children:[(0,B.jsx)("label",{className:"text-sm font-medium text-foreground",children:e("fieldName")}),(0,B.jsx)(X.Input,{value:j.name,onChange:a=>k({...j,name:a.target.value}),placeholder:e("fieldNamePlaceholder")})]}),(0,B.jsxs)("div",{className:"space-y-2",children:[(0,B.jsx)("label",{className:"text-sm font-medium text-foreground",children:e("fieldSourceQuery")}),(0,B.jsx)(JI.Textarea,{value:j.sourceQuery,onChange:a=>k({...j,sourceQuery:a.target.value}),placeholder:e("fieldSourceQueryPlaceholder"),className:"min-h-[140px] font-mono text-sm leading-6 whitespace-pre-wrap",spellCheck:!1})]}),(0,B.jsxs)("div",{className:"space-y-2",children:[(0,B.jsx)("label",{className:"text-sm font-medium text-foreground",children:e("fieldMaxTokens")}),(0,B.jsx)(X.Input,{type:"number",value:j.maxTokens,onChange:a=>k({...j,maxTokens:a.target.value}),placeholder:e("fieldMaxTokensPlaceholder"),min:"256",max:"8192"})]})]}),(0,B.jsxs)(bh.TabsContent,{value:"options",className:"space-y-6 pt-4",children:[(0,B.jsxs)("section",{className:"space-y-4",children:[(0,B.jsx)("h3",{className:"text-sm font-semibold text-foreground border-b pb-1",children:e("optionsSectionRefresh")}),(0,B.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,B.jsx)(IM.Checkbox,{id:"update-auto-refresh",checked:j.autoRefresh,onCheckedChange:a=>k({...j,autoRefresh:!0===a})}),(0,B.jsx)("label",{htmlFor:"update-auto-refresh",className:"text-sm font-medium text-foreground cursor-pointer",children:e("optionsAutoRefreshLabel")})]}),(0,B.jsxs)("div",{className:"space-y-2",children:[(0,B.jsx)("label",{className:"text-sm font-medium text-foreground",children:e("optionsRefreshModeLabel")}),(0,B.jsxs)(a6.Select,{value:j.mode,onValueChange:a=>k({...j,mode:a}),children:[(0,B.jsx)(a6.SelectTrigger,{children:(0,B.jsx)(a6.SelectValue,{})}),(0,B.jsxs)(a6.SelectContent,{children:[(0,B.jsx)(a6.SelectItem,{value:"full",children:e("optionsRefreshModeFull")}),(0,B.jsx)(a6.SelectItem,{value:"delta",children:e("optionsRefreshModeDelta")})]})]}),(0,B.jsx)("p",{className:"text-xs text-muted-foreground",children:e("optionsRefreshModeDeltaDescription")})]})]}),(0,B.jsxs)("section",{className:"space-y-4",children:[(0,B.jsx)("h3",{className:"text-sm font-semibold text-foreground border-b pb-1",children:e("optionsSectionOtherModels")}),(0,B.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,B.jsx)(IM.Checkbox,{id:"update-exclude-mental-models",checked:j.excludeMentalModels,onCheckedChange:a=>k({...j,excludeMentalModels:!0===a})}),(0,B.jsx)("label",{htmlFor:"update-exclude-mental-models",className:"text-sm font-medium text-foreground cursor-pointer",children:e("optionsExcludeAllLabel")})]}),(0,B.jsxs)("div",{className:"space-y-2",children:[(0,B.jsx)("label",{className:"text-sm font-medium text-foreground",children:e("optionsExcludeIdsLabel")}),(0,B.jsx)(X.Input,{value:j.excludeMentalModelIds,onChange:a=>k({...j,excludeMentalModelIds:a.target.value}),placeholder:e("optionsExcludeIdsPlaceholder")})]})]}),(0,B.jsxs)("section",{className:"space-y-4",children:[(0,B.jsx)("h3",{className:"text-sm font-semibold text-foreground border-b pb-1",children:e("optionsSectionTags")}),(0,B.jsxs)("div",{className:"space-y-2",children:[(0,B.jsx)("label",{className:"text-sm font-medium text-foreground",children:e("optionsTagsLabel")}),(0,B.jsx)(X.Input,{value:j.tags,onChange:a=>k({...j,tags:a.target.value}),placeholder:e("optionsTagsPlaceholder")}),(0,B.jsx)("p",{className:"text-xs text-muted-foreground",children:e("optionsTagsDescription")})]}),(0,B.jsxs)("div",{className:"space-y-2",children:[(0,B.jsx)("label",{className:"text-sm font-medium text-foreground",children:e("optionsTagsMatchLabel")}),(0,B.jsxs)(a6.Select,{value:j.tagsMatch||"default",onValueChange:a=>k({...j,tagsMatch:"default"===a?"":a}),children:[(0,B.jsx)(a6.SelectTrigger,{children:(0,B.jsx)(a6.SelectValue,{placeholder:e("optionsTagsMatchDefaultPlaceholder")})}),(0,B.jsxs)(a6.SelectContent,{children:[(0,B.jsx)(a6.SelectItem,{value:"default",children:e("optionsTagsMatchDefault")}),(0,B.jsx)(a6.SelectItem,{value:"any",children:e("optionsTagsMatchAny")}),(0,B.jsx)(a6.SelectItem,{value:"all",children:e("optionsTagsMatchAll")}),(0,B.jsx)(a6.SelectItem,{value:"any_strict",children:e("optionsTagsMatchAnyStrict")}),(0,B.jsx)(a6.SelectItem,{value:"all_strict",children:e("optionsTagsMatchAllStrict")})]})]}),(0,B.jsx)("p",{className:"text-xs text-muted-foreground",children:e("optionsTagsMatchDescription")})]}),(0,B.jsxs)("div",{className:"space-y-2",children:[(0,B.jsx)("label",{className:"text-sm font-medium text-foreground",children:e("optionsTagGroupsLabel")}),(0,B.jsx)(JI.Textarea,{value:j.tagGroups,onChange:a=>k({...j,tagGroups:a.target.value}),placeholder:'e.g., [{"or": [{"tags": ["user:alice"], "match": "all_strict"}, {"tags": ["shared"]}]}]',rows:3,className:"font-mono text-xs"}),(0,B.jsx)("p",{className:"text-xs text-muted-foreground",children:e("optionsTagGroupsDescription")})]})]}),(0,B.jsxs)("section",{className:"space-y-4",children:[(0,B.jsx)("h3",{className:"text-sm font-semibold text-foreground border-b pb-1",children:e("optionsSectionRecall")}),(0,B.jsx)("p",{className:"text-xs text-muted-foreground",children:e("optionsRecallDescription")}),(0,B.jsxs)("div",{className:"space-y-3",children:[(0,B.jsx)("label",{className:"text-sm font-medium text-foreground",children:e("optionsFactTypesLabel")}),(0,B.jsx)(JC,{value:j.factTypes,onChange:a=>k({...j,factTypes:a})}),(0,B.jsx)("p",{className:"text-xs text-muted-foreground",children:e("optionsFactTypesEmpty")})]}),(0,B.jsxs)("div",{className:"space-y-2",children:[(0,B.jsx)("label",{className:"text-sm font-medium text-foreground",children:e("optionsIncludeChunksLabel")}),(0,B.jsxs)(a6.Select,{value:j.includeChunks||"default",onValueChange:a=>k({...j,includeChunks:"default"===a?"":a}),children:[(0,B.jsx)(a6.SelectTrigger,{children:(0,B.jsx)(a6.SelectValue,{})}),(0,B.jsxs)(a6.SelectContent,{children:[(0,B.jsx)(a6.SelectItem,{value:"default",children:e("optionsIncludeChunksDefault")}),(0,B.jsx)(a6.SelectItem,{value:"true",children:e("optionsIncludeChunksYes")}),(0,B.jsx)(a6.SelectItem,{value:"false",children:e("optionsIncludeChunksNo")})]})]})]}),(0,B.jsxs)("div",{className:"space-y-2",children:[(0,B.jsx)("label",{className:"text-sm font-medium text-foreground",children:e("optionsRecallMaxTokensLabel")}),(0,B.jsx)(X.Input,{type:"number",value:j.recallMaxTokens,onChange:a=>k({...j,recallMaxTokens:a.target.value}),placeholder:e("optionsRecallMaxTokensPlaceholder"),min:"0"}),(0,B.jsx)("p",{className:"text-xs text-muted-foreground",children:e("optionsRecallMaxTokensDescription")})]}),(0,B.jsxs)("div",{className:"space-y-2",children:[(0,B.jsx)("label",{className:"text-sm font-medium text-foreground",children:e("optionsRecallChunksMaxTokensLabel")}),(0,B.jsx)(X.Input,{type:"number",value:j.recallChunksMaxTokens,onChange:a=>k({...j,recallChunksMaxTokens:a.target.value}),placeholder:e("optionsRecallChunksMaxTokensPlaceholder"),min:"0"}),(0,B.jsx)("p",{className:"text-xs text-muted-foreground",children:e("optionsRecallChunksMaxTokensDescription")})]})]})]})]})]}),(0,B.jsxs)(bf.DialogFooter,{children:[(0,B.jsx)(W.Button,{variant:"outline",onClick:c,disabled:g,children:e("cancelButton")}),(0,B.jsx)(W.Button,{onClick:l,disabled:g||!j.name.trim()||!j.sourceQuery.trim(),children:g?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(bc.default,{className:"w-4 h-4 animate-spin mr-1"}),e("updatingButton")]}):e("updateButton")})]})]})})}function Rg({mentalModels:a,selectedId:b,onSelect:c,onOpenDetail:d,refreshingIds:e,onEdit:f,onRefresh:g,onClear:h,onDelete:i}){let j=(0,E.useTranslations)("mentalModels"),k=b&&a.some(a=>a.id===b)?b:a[0]?.id??null,l=a.find(a=>a.id===k)??null;return(0,B.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-[320px_1fr] gap-0 overflow-hidden min-h-[600px]",children:[(0,B.jsx)("aside",{className:"border-r border-border bg-muted/30 overflow-y-auto max-h-[calc(100vh-260px)]",children:(0,B.jsx)("ul",{className:"py-1",children:a.map(a=>{let b=a.id===k;return(0,B.jsx)("li",{children:(0,B.jsxs)("button",{onClick:()=>c(a.id),className:`w-full flex items-start gap-2 px-3 py-2 text-left transition-colors border-l-2 ${b?"bg-primary/10 border-primary text-foreground":"border-transparent text-muted-foreground hover:bg-muted hover:text-foreground"}`,title:`${a.name}
|
|
9
|
-
${a.source_query}`,children:[(0,B.jsx)(N.FileText,{className:"w-3.5 h-3.5 flex-shrink-0 mt-0.5"}),(0,B.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,B.jsxs)("div",{className:"flex items-center gap-2",children:[(0,B.jsx)("span",{className:`truncate text-sm font-medium ${b?"text-foreground":""}`,children:a.name}),(0,B.jsx)("span",{className:"ml-auto text-[10px] text-muted-foreground flex-shrink-0",title:Pr(a.last_refreshed_at),children:Pq(a.last_refreshed_at)})]}),a.source_query&&(0,B.jsx)("div",{className:"text-xs text-muted-foreground/80 truncate italic mt-0.5",children:a.source_query})]})]})},a.id)})})}),(0,B.jsx)("section",{className:"overflow-y-auto max-h-[calc(100vh-260px)]",children:l?(0,B.jsxs)("article",{className:"p-6",children:[(0,B.jsx)("header",{className:"mb-4 pb-4 border-b border-border",children:(0,B.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,B.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,B.jsx)("h2",{className:"text-xl font-semibold text-foreground",children:l.name}),l.source_query&&(0,B.jsxs)("p",{className:"text-sm text-muted-foreground mt-1 italic",children:["“",l.source_query,"”"]}),(0,B.jsxs)("div",{className:"flex items-center gap-3 mt-2 text-xs text-muted-foreground",children:[(0,B.jsxs)("span",{title:Pr(l.last_refreshed_at),children:["Refreshed ",Pq(l.last_refreshed_at)]}),l.tags.length>0&&(0,B.jsx)("div",{className:"flex gap-1",children:l.tags.map(a=>(0,B.jsx)("span",{className:"px-1.5 py-0.5 rounded text-xs bg-blue-500/10 text-blue-600 dark:text-blue-400",children:a},a))})]})]}),(0,B.jsxs)("div",{className:"flex items-center gap-1 flex-shrink-0",children:[(0,B.jsx)(W.Button,{variant:"outline",size:"sm",onClick:()=>d(l),children:"Open"}),(0,B.jsx)(Rd,{m:l,refreshing:e.has(l.id),onEdit:f,onRefresh:g,onClear:h,onDelete:i})]})]})}),l.content?(0,B.jsx)("div",{className:"prose prose-sm dark:prose-invert max-w-none",children:(0,B.jsx)(Pn,{children:l.content})}):(0,B.jsx)("p",{className:"text-sm text-muted-foreground italic",children:j("emptyContent")})]}):(0,B.jsxs)("div",{className:"p-10 text-center text-muted-foreground",children:[(0,B.jsx)(N.FileText,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),(0,B.jsx)("p",{className:"text-sm",children:j("selectModelPrompt")})]})})]})}let Rh=(0,K.default)("eye-off",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);var bc=bc;let Ri=["consolidation.completed","retain.completed"],Rj={url:"",secret:"",event_types:["consolidation.completed"],enabled:!0,http_config:{method:"POST",timeout_seconds:30,headers:[],params:[]}};function Rk(a){return Object.fromEntries(a.filter(a=>a.key.trim()).map(a=>[a.key,a.value]))}function Rl(a){return{method:a.method,timeout_seconds:a.timeout_seconds,headers:Rk(a.headers),params:Rk(a.params)}}function Rm({label:a,pairs:b,onChange:c}){let d=(0,E.useTranslations)("webhooksView"),e=(a,d,e)=>{c(b.map((b,c)=>c===a?{...b,[d]:e}:b))};return(0,B.jsxs)("div",{className:"space-y-2",children:[(0,B.jsxs)("div",{className:"flex items-center justify-between",children:[(0,B.jsx)(au,{children:a}),(0,B.jsxs)(W.Button,{type:"button",variant:"ghost",size:"sm",className:"h-6 text-xs px-2",onClick:()=>c([...b,{key:"",value:""}]),children:[(0,B.jsx)(II.Plus,{className:"w-3 h-3 mr-1"}),d("kvAdd")]})]}),b.length>0&&(0,B.jsx)("div",{className:"space-y-1.5",children:b.map((a,f)=>(0,B.jsxs)("div",{className:"flex items-center gap-2",children:[(0,B.jsx)(X.Input,{placeholder:d("kvKeyPlaceholder"),value:a.key,onChange:a=>e(f,"key",a.target.value),className:"h-8 text-sm flex-1"}),(0,B.jsx)(X.Input,{placeholder:d("kvValuePlaceholder"),value:a.value,onChange:a=>e(f,"value",a.target.value),className:"h-8 text-sm flex-1"}),(0,B.jsx)("button",{type:"button",onClick:()=>c(b.filter((a,b)=>b!==f)),className:"text-muted-foreground hover:text-foreground shrink-0","aria-label":d("kvRemovePair"),children:(0,B.jsx)(bb.X,{className:"w-4 h-4"})})]},f))})]})}function Rn({status:a}){let b=(0,E.useTranslations)("webhooksView");return"completed"===a?(0,B.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border border-emerald-500/20",children:[(0,B.jsx)(ae,{className:"w-3 h-3"}),b("deliveryStatusDelivered")]}):"pending"===a?(0,B.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-amber-500/10 text-amber-600 dark:text-amber-400 border border-amber-500/20",children:[(0,B.jsx)(af,{className:"w-3 h-3"}),b("deliveryStatusPending")]}):"failed"===a?(0,B.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-red-500/10 text-red-600 dark:text-red-400 border border-red-500/20",children:[(0,B.jsx)(PY,{className:"w-3 h-3"}),b("deliveryStatusFailed")]}):(0,B.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-muted text-muted-foreground border border-border",children:a})}function Ro({delivery:a,formatDate:b}){let c=(0,E.useTranslations)("webhooksView"),[d,e]=(0,C.useState)(!1),f=a.last_response_body||a.last_error;return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(al,{className:f?"cursor-pointer hover:bg-muted/40":void 0,onClick:()=>f&&e(a=>!a),children:[(0,B.jsx)(an,{className:"w-8 pl-3 pr-0",children:f?d?(0,B.jsx)(Jj.ChevronDown,{className:"w-4 h-4 text-muted-foreground"}):(0,B.jsx)(Q.ChevronRight,{className:"w-4 h-4 text-muted-foreground"}):(0,B.jsx)("span",{className:"w-4 h-4 inline-block"})}),(0,B.jsx)(an,{children:(0,B.jsx)(Rn,{status:a.status})}),(0,B.jsx)(an,{children:null!=a.last_response_status?(0,B.jsx)("span",{className:`font-mono text-xs px-1.5 py-0.5 rounded border ${a.last_response_status>=200&&a.last_response_status<300?"bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border-emerald-500/20":"bg-red-500/10 text-red-600 dark:text-red-400 border-red-500/20"}`,children:a.last_response_status}):(0,B.jsx)("span",{className:"text-muted-foreground text-xs",children:"—"})}),(0,B.jsx)(an,{className:"text-center text-sm",children:a.attempts}),(0,B.jsx)(an,{className:"font-mono text-xs text-muted-foreground",children:a.event_type}),(0,B.jsx)(an,{className:"text-xs text-muted-foreground whitespace-nowrap",children:b(a.created_at)})]}),d&&f&&(0,B.jsx)(al,{className:"bg-muted/20 hover:bg-muted/20",children:(0,B.jsx)(an,{colSpan:6,className:"px-4 py-3",children:(0,B.jsxs)("div",{className:"space-y-3",children:[a.last_error&&(0,B.jsxs)("div",{className:"space-y-1",children:[(0,B.jsx)("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:c("expandedError")}),(0,B.jsx)("p",{className:"font-mono text-xs text-red-600 dark:text-red-400 break-all",children:a.last_error})]}),a.last_response_body&&(0,B.jsxs)("div",{className:"space-y-1",children:[(0,B.jsxs)("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:[c("expandedResponseBody"),a.last_attempt_at&&(0,B.jsxs)("span",{className:"ml-2 normal-case font-normal",children:["· ",b(a.last_attempt_at)]})]}),(0,B.jsx)("pre",{className:"font-mono text-xs bg-background rounded p-2 overflow-x-auto whitespace-pre-wrap break-all max-h-40 overflow-y-auto border border-border",children:a.last_response_body})]})]})})})]})}function Rp(){let a=(0,E.useTranslations)("webhooksView"),{currentBank:b}=(0,H.useBank)(),[c,d]=(0,C.useState)([]),[e,f]=(0,C.useState)(!1),[g,h]=(0,C.useState)(!1),[i,j]=(0,C.useState)(!1),[k,l]=(0,C.useState)(null),[n,o]=(0,C.useState)(null),[p,q]=(0,C.useState)(!1),[r,s]=(0,C.useState)(Rj),[t,u]=(0,C.useState)(!1),[v,w]=(0,C.useState)(null),[x,y]=(0,C.useState)(Rj),[z,A]=(0,C.useState)(!1),[D,F]=(0,C.useState)(!1),[G,I]=(0,C.useState)(!1),[J,K]=(0,C.useState)(!1),[L,M]=(0,C.useState)(null),[N,O]=(0,C.useState)([]),[P,Q]=(0,C.useState)(!1),[R,S]=(0,C.useState)(null),[T,U]=(0,C.useState)(!1),Y=async()=>{if(b){f(!0);try{let a=await V.client.listWebhooks(b);d(a.items||[])}catch(a){console.error("Error loading webhooks:",a)}finally{f(!1)}}};(0,C.useEffect)(()=>{b&&Y()},[b]);let Z=async()=>{if(b&&r.url){j(!0);try{await V.client.createWebhook(b,{url:r.url,secret:r.secret||void 0,event_types:r.event_types.length>0?r.event_types:void 0,enabled:r.enabled,http_config:Rl(r.http_config)}),h(!1),s(Rj),q(!1),await Y()}catch(a){}finally{j(!1)}}},$=async a=>{if(b){l(a),o(null);try{await V.client.deleteWebhook(b,a),await Y()}catch(a){}finally{l(null)}}},_=async()=>{if(b&&v&&x.url){I(!0);try{let a={url:x.url,event_types:x.event_types,enabled:x.enabled,http_config:Rl(x.http_config)};D?a.secret=null:x.secret&&(a.secret=x.secret),await V.client.updateWebhook(b,v.id,a),u(!1),await Y()}catch{}finally{I(!1)}}},aa=async a=>{if(b){M(a),K(!0),O([]),S(null),Q(!0);try{let c=await V.client.listWebhookDeliveries(b,a.id,50);O(c.items||[]),S(c.next_cursor??null)}catch(a){console.error("Error loading deliveries:",a)}finally{Q(!1)}}},ab=async()=>{if(b&&L&&R){U(!0);try{let a=await V.client.listWebhookDeliveries(b,L.id,50,R);O(b=>[...b,...a.items||[]]),S(a.next_cursor??null)}catch(a){console.error("Error loading more deliveries:",a)}finally{U(!1)}}},af=b=>b?new Date(b).toLocaleString():a("formatDateNA");return b?(0,B.jsxs)("div",{className:"space-y-4",children:[(0,B.jsxs)("div",{className:"flex items-center justify-between",children:[(0,B.jsxs)("div",{children:[(0,B.jsxs)("div",{className:"flex items-center gap-2",children:[(0,B.jsx)("h3",{className:"text-lg font-semibold",children:a("title")}),(0,B.jsx)("button",{onClick:()=>Y(),className:"p-1 rounded hover:bg-muted transition-colors",title:a("refreshTitle"),"aria-label":a("refreshAriaLabel"),disabled:e,children:(0,B.jsx)(ad,{className:`w-4 h-4 text-muted-foreground hover:text-foreground ${e?"animate-spin":""}`})})]}),(0,B.jsx)("p",{className:"text-sm text-muted-foreground",children:a("webhookCount",{count:c.length})})]}),(0,B.jsxs)(W.Button,{size:"sm",onClick:()=>h(!0),children:[(0,B.jsx)(II.Plus,{className:"w-4 h-4 mr-2"}),a("addWebhook")]})]}),c.length>0?(0,B.jsx)("div",{className:"overflow-x-auto",children:(0,B.jsxs)(ai,{children:[(0,B.jsx)(aj,{children:(0,B.jsxs)(al,{children:[(0,B.jsx)(am,{children:a("tableHeaderUrl")}),(0,B.jsx)(am,{children:a("tableHeaderMethod")}),(0,B.jsx)(am,{children:a("tableHeaderEventTypes")}),(0,B.jsx)(am,{children:a("tableHeaderStatus")}),(0,B.jsx)(am,{children:a("tableHeaderCreatedAt")}),(0,B.jsx)(am,{className:"w-[120px]"})]})}),(0,B.jsx)(ak,{children:c.map(b=>(0,B.jsxs)(al,{children:[(0,B.jsx)(an,{className:"font-mono text-sm max-w-[300px] truncate",children:(0,B.jsx)("span",{title:b.url,children:b.url})}),(0,B.jsx)(an,{children:(0,B.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-mono font-medium bg-muted text-muted-foreground border border-border",children:b.http_config?.method||"POST"})}),(0,B.jsx)(an,{children:(0,B.jsx)("div",{className:"flex flex-wrap gap-1",children:b.event_types.length>0?b.event_types.map(a=>(0,B.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400 border border-blue-500/20",children:a},a)):(0,B.jsx)("span",{className:"text-xs text-muted-foreground",children:a("allEvents")})})}),(0,B.jsx)(an,{children:b.enabled?(0,B.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border border-emerald-500/20",children:[(0,B.jsx)(ae,{className:"w-3 h-3"}),a("statusEnabled")]}):(0,B.jsx)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-muted text-muted-foreground border border-border",children:a("statusDisabled")})}),(0,B.jsx)(an,{className:"text-sm text-muted-foreground",children:af(b.created_at)}),(0,B.jsx)(an,{children:(0,B.jsxs)("div",{className:"flex items-center gap-1",children:[(0,B.jsxs)(W.Button,{variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:()=>aa(b),title:a("viewDeliveriesTitle"),children:[(0,B.jsx)(ac,{className:"w-3 h-3 mr-1"}),a("deliveriesButton")]}),(0,B.jsx)(W.Button,{variant:"ghost",size:"sm",className:"h-7 text-xs text-muted-foreground hover:text-foreground",onClick:()=>{let a;return w(b),void(y((a=b.http_config??{method:"POST",timeout_seconds:30,headers:{},params:{}},{url:b.url,secret:"",event_types:b.event_types,enabled:b.enabled,http_config:{method:a.method,timeout_seconds:a.timeout_seconds,headers:Object.entries(a.headers??{}).map(([a,b])=>({key:a,value:b})),params:Object.entries(a.params??{}).map(([a,b])=>({key:a,value:b}))}})),A(!1),F(!1),u(!0))},title:a("editWebhookTitle"),"aria-label":a("editWebhookAriaLabel"),children:(0,B.jsx)(Jh,{className:"w-3 h-3"})}),(0,B.jsx)(W.Button,{variant:"ghost",size:"sm",className:"h-7 text-xs text-muted-foreground hover:text-red-600 dark:hover:text-red-400",onClick:()=>o(b),disabled:k===b.id,title:a("deleteWebhookTitle"),"aria-label":a("deleteWebhookAriaLabel"),children:k===b.id?(0,B.jsx)(bc.default,{className:"w-3 h-3 animate-spin"}):(0,B.jsx)(Jg,{className:"w-3 h-3"})})]})})]},b.id))})]})}):(0,B.jsx)("p",{className:"text-muted-foreground text-center py-8 text-sm",children:a("emptyStateCanManage")}),(0,B.jsx)(bf.Dialog,{open:g,onOpenChange:a=>{a||(s(Rj),q(!1)),h(a)},children:(0,B.jsxs)(bf.DialogContent,{className:"max-w-lg max-h-[85vh] overflow-y-auto",children:[(0,B.jsxs)(bf.DialogHeader,{children:[(0,B.jsx)(bf.DialogTitle,{children:a("createDialogTitle")}),(0,B.jsx)(bf.DialogDescription,{children:a("createDialogDescription")})]}),(0,B.jsxs)("div",{className:"space-y-4 py-2",children:[(0,B.jsxs)("div",{className:"space-y-1.5",children:[(0,B.jsx)(au,{children:a("formTypeLabel")}),(0,B.jsx)("div",{className:"flex items-center h-9 px-3 rounded-md border border-border bg-muted text-sm text-muted-foreground",children:"HTTP"})]}),(0,B.jsxs)("div",{className:"space-y-1.5",children:[(0,B.jsxs)(au,{htmlFor:"webhook-url",children:[a("formUrlLabel")," ",(0,B.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,B.jsx)(X.Input,{id:"webhook-url",type:"url",placeholder:a("formUrlPlaceholder"),value:r.url,onChange:a=>s(b=>({...b,url:a.target.value}))})]}),(0,B.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,B.jsxs)("div",{className:"space-y-1.5",children:[(0,B.jsx)(au,{children:a("formMethodLabel")}),(0,B.jsxs)(a6.Select,{value:r.http_config.method,onValueChange:a=>s(b=>({...b,http_config:{...b.http_config,method:a}})),children:[(0,B.jsx)(a6.SelectTrigger,{children:(0,B.jsx)(a6.SelectValue,{})}),(0,B.jsxs)(a6.SelectContent,{children:[(0,B.jsx)(a6.SelectItem,{value:"POST",children:"POST"}),(0,B.jsx)(a6.SelectItem,{value:"GET",children:"GET"})]})]})]}),(0,B.jsxs)("div",{className:"space-y-1.5",children:[(0,B.jsx)(au,{htmlFor:"webhook-timeout",children:a("formTimeoutLabel")}),(0,B.jsx)(X.Input,{id:"webhook-timeout",type:"number",min:1,max:300,value:r.http_config.timeout_seconds,onChange:a=>s(b=>({...b,http_config:{...b.http_config,timeout_seconds:parseInt(a.target.value)||30}}))})]})]}),(0,B.jsxs)("div",{className:"space-y-1.5",children:[(0,B.jsxs)(au,{htmlFor:"webhook-secret",children:[a("formSecretLabel")," ",(0,B.jsx)("span",{className:"text-muted-foreground text-xs",children:a("formSecretOptional")})]}),(0,B.jsxs)("div",{className:"relative",children:[(0,B.jsx)(X.Input,{id:"webhook-secret",type:p?"text":"password",placeholder:a("formSecretPlaceholderOptional"),value:r.secret,onChange:a=>s(b=>({...b,secret:a.target.value})),className:"pr-10"}),(0,B.jsx)("button",{type:"button",onClick:()=>q(a=>!a),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",tabIndex:-1,"aria-label":p?a("formHideSecret"):a("formShowSecret"),children:p?(0,B.jsx)(Rh,{className:"w-4 h-4"}):(0,B.jsx)(ac,{className:"w-4 h-4"})})]})]}),(0,B.jsx)(Rm,{label:a("formCustomHeaders"),pairs:r.http_config.headers,onChange:a=>s(b=>({...b,http_config:{...b.http_config,headers:a}}))}),(0,B.jsx)(Rm,{label:a("formQueryParams"),pairs:r.http_config.params,onChange:a=>s(b=>({...b,http_config:{...b.http_config,params:a}}))}),(0,B.jsxs)("div",{className:"space-y-2",children:[(0,B.jsx)(au,{children:a("formEventTypes")}),(0,B.jsx)("div",{className:"space-y-2",children:Ri.map(a=>(0,B.jsxs)("div",{className:"flex items-center gap-2",children:[(0,B.jsx)(IM.Checkbox,{id:`event-${a}`,checked:r.event_types.includes(a),onCheckedChange:()=>{s(b=>({...b,event_types:b.event_types.includes(a)?b.event_types.filter(b=>b!==a):[...b.event_types,a]}))}}),(0,B.jsx)(au,{htmlFor:`event-${a}`,className:"font-mono text-sm cursor-pointer",children:a})]},a))})]}),(0,B.jsxs)("div",{className:"flex items-center gap-3",children:[(0,B.jsx)(a5.Switch,{id:"webhook-enabled",checked:r.enabled,onCheckedChange:a=>s(b=>({...b,enabled:a}))}),(0,B.jsx)(au,{htmlFor:"webhook-enabled",children:a("formEnabled")})]})]}),(0,B.jsxs)(bf.DialogFooter,{children:[(0,B.jsx)(W.Button,{variant:"outline",onClick:()=>h(!1),disabled:i,children:a("cancel")}),(0,B.jsx)(W.Button,{onClick:Z,disabled:i||!r.url,children:i?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(bc.default,{className:"w-4 h-4 mr-2 animate-spin"}),a("creating")]}):a("createWebhook")})]})]})}),(0,B.jsx)(bf.Dialog,{open:t,onOpenChange:a=>{a||(w(null),y(Rj),A(!1),F(!1)),u(a)},children:(0,B.jsxs)(bf.DialogContent,{className:"max-w-lg max-h-[85vh] overflow-y-auto",children:[(0,B.jsxs)(bf.DialogHeader,{children:[(0,B.jsx)(bf.DialogTitle,{children:a("editDialogTitle")}),(0,B.jsx)(bf.DialogDescription,{children:a("editDialogDescription")})]}),(0,B.jsxs)("div",{className:"space-y-4 py-2",children:[(0,B.jsxs)("div",{className:"space-y-1.5",children:[(0,B.jsx)(au,{children:a("formTypeLabel")}),(0,B.jsx)("div",{className:"flex items-center h-9 px-3 rounded-md border border-border bg-muted text-sm text-muted-foreground",children:"HTTP"})]}),(0,B.jsxs)("div",{className:"space-y-1.5",children:[(0,B.jsxs)(au,{htmlFor:"edit-webhook-url",children:[a("formUrlLabel")," ",(0,B.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,B.jsx)(X.Input,{id:"edit-webhook-url",type:"url",placeholder:a("formUrlPlaceholder"),value:x.url,onChange:a=>y(b=>({...b,url:a.target.value}))})]}),(0,B.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,B.jsxs)("div",{className:"space-y-1.5",children:[(0,B.jsx)(au,{children:a("formMethodLabel")}),(0,B.jsxs)(a6.Select,{value:x.http_config.method,onValueChange:a=>y(b=>({...b,http_config:{...b.http_config,method:a}})),children:[(0,B.jsx)(a6.SelectTrigger,{children:(0,B.jsx)(a6.SelectValue,{})}),(0,B.jsxs)(a6.SelectContent,{children:[(0,B.jsx)(a6.SelectItem,{value:"POST",children:"POST"}),(0,B.jsx)(a6.SelectItem,{value:"GET",children:"GET"})]})]})]}),(0,B.jsxs)("div",{className:"space-y-1.5",children:[(0,B.jsx)(au,{htmlFor:"edit-webhook-timeout",children:a("formTimeoutLabel")}),(0,B.jsx)(X.Input,{id:"edit-webhook-timeout",type:"number",min:1,max:300,value:x.http_config.timeout_seconds,onChange:a=>y(b=>({...b,http_config:{...b.http_config,timeout_seconds:parseInt(a.target.value)||30}}))})]})]}),(0,B.jsxs)("div",{className:"space-y-1.5",children:[(0,B.jsx)(au,{htmlFor:"edit-webhook-secret",children:a("formSecretLabel")}),(0,B.jsxs)("div",{className:"relative",children:[(0,B.jsx)(X.Input,{id:"edit-webhook-secret",type:z?"text":"password",placeholder:a("formSecretPlaceholderEdit"),value:x.secret,disabled:D,onChange:a=>y(b=>({...b,secret:a.target.value})),className:"pr-10"}),(0,B.jsx)("button",{type:"button",onClick:()=>A(a=>!a),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",tabIndex:-1,"aria-label":z?a("formHideSecret"):a("formShowSecret"),children:z?(0,B.jsx)(Rh,{className:"w-4 h-4"}):(0,B.jsx)(ac,{className:"w-4 h-4"})})]}),(0,B.jsxs)("div",{className:"flex items-center gap-2 mt-1",children:[(0,B.jsx)(IM.Checkbox,{id:"edit-clear-secret",checked:D,onCheckedChange:a=>{F(!!a),a&&y(a=>({...a,secret:""}))}}),(0,B.jsx)(au,{htmlFor:"edit-clear-secret",className:"text-xs text-muted-foreground cursor-pointer",children:a("formClearSecret")})]})]}),(0,B.jsx)(Rm,{label:a("formCustomHeaders"),pairs:x.http_config.headers,onChange:a=>y(b=>({...b,http_config:{...b.http_config,headers:a}}))}),(0,B.jsx)(Rm,{label:a("formQueryParams"),pairs:x.http_config.params,onChange:a=>y(b=>({...b,http_config:{...b.http_config,params:a}}))}),(0,B.jsxs)("div",{className:"space-y-2",children:[(0,B.jsx)(au,{children:a("formEventTypes")}),(0,B.jsx)("div",{className:"space-y-2",children:Ri.map(a=>(0,B.jsxs)("div",{className:"flex items-center gap-2",children:[(0,B.jsx)(IM.Checkbox,{id:`edit-event-${a}`,checked:x.event_types.includes(a),onCheckedChange:()=>y(b=>({...b,event_types:b.event_types.includes(a)?b.event_types.filter(b=>b!==a):[...b.event_types,a]}))}),(0,B.jsx)(au,{htmlFor:`edit-event-${a}`,className:"font-mono text-sm cursor-pointer",children:a})]},a))})]}),(0,B.jsxs)("div",{className:"flex items-center gap-3",children:[(0,B.jsx)(a5.Switch,{id:"edit-webhook-enabled",checked:x.enabled,onCheckedChange:a=>y(b=>({...b,enabled:a}))}),(0,B.jsx)(au,{htmlFor:"edit-webhook-enabled",children:a("formEnabled")})]})]}),(0,B.jsxs)(bf.DialogFooter,{children:[(0,B.jsx)(W.Button,{variant:"outline",onClick:()=>u(!1),disabled:G,children:a("cancel")}),(0,B.jsx)(W.Button,{onClick:_,disabled:G||!x.url,children:G?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(bc.default,{className:"w-4 h-4 mr-2 animate-spin"}),a("saving")]}):a("saveChanges")})]})]})}),(0,B.jsx)(bf.Dialog,{open:!!n,onOpenChange:a=>{a||o(null)},children:(0,B.jsxs)(bf.DialogContent,{className:"max-w-md",children:[(0,B.jsxs)(bf.DialogHeader,{children:[(0,B.jsx)(bf.DialogTitle,{children:a("deleteDialogTitle")}),(0,B.jsx)(bf.DialogDescription,{children:a("deleteDialogDescription")})]}),n&&(0,B.jsx)("div",{className:"py-2",children:(0,B.jsx)("p",{className:"font-mono text-sm truncate text-muted-foreground bg-muted px-3 py-2 rounded-md border border-border",children:n.url})}),(0,B.jsxs)(bf.DialogFooter,{children:[(0,B.jsx)(W.Button,{variant:"outline",onClick:()=>o(null),children:a("cancel")}),(0,B.jsx)(W.Button,{variant:"destructive",onClick:()=>n&&$(n.id),disabled:!!k,children:k?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(bc.default,{className:"w-4 h-4 mr-2 animate-spin"}),a("deleting")]}):a("deleteWebhookConfirm")})]})]})}),(0,B.jsx)(bf.Dialog,{open:J,onOpenChange:a=>{a||(O([]),S(null)),K(a)},children:(0,B.jsxs)(bf.DialogContent,{className:"max-w-3xl max-h-[80vh] overflow-y-auto",children:[(0,B.jsxs)(bf.DialogHeader,{children:[(0,B.jsx)(bf.DialogTitle,{children:a("deliveriesDialogTitle")}),L&&(0,B.jsx)(bf.DialogDescription,{className:"font-mono text-xs truncate",children:L.url})]}),P?(0,B.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,B.jsx)(bc.default,{className:"w-6 h-6 animate-spin text-muted-foreground"})}):N.length>0?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)("div",{className:"overflow-x-auto",children:(0,B.jsxs)(ai,{children:[(0,B.jsx)(aj,{children:(0,B.jsxs)(al,{children:[(0,B.jsx)(am,{className:"w-8 pl-3 pr-0"}),(0,B.jsx)(am,{children:a("deliveriesTableHeaderStatus")}),(0,B.jsx)(am,{children:a("deliveriesTableHeaderHttp")}),(0,B.jsx)(am,{className:"text-center",children:a("deliveriesTableHeaderAttempts")}),(0,B.jsx)(am,{children:a("deliveriesTableHeaderEvent")}),(0,B.jsx)(am,{children:a("deliveriesTableHeaderCreatedAt")})]})}),(0,B.jsx)(ak,{children:N.map(a=>(0,B.jsx)(Ro,{delivery:a,formatDate:af},a.id))})]})}),R&&(0,B.jsx)("div",{className:"flex justify-center pt-2",children:(0,B.jsxs)(W.Button,{variant:"outline",size:"sm",onClick:ab,disabled:T,children:[T&&(0,B.jsx)(bc.default,{className:"w-4 h-4 mr-2 animate-spin"}),a("loadMore")]})})]}):(0,B.jsx)("p",{className:"text-muted-foreground text-center py-8 text-sm",children:a("noDeliveries")})]})})]}):null}function Rq(a){return[{value:"all",label:a("actionAll")},{value:"retain",label:a("actionRetain")},{value:"recall",label:a("actionRecall")},{value:"reflect",label:a("actionReflect")},{value:"create_bank",label:a("actionCreateBank")},{value:"update_bank",label:a("actionUpdateBank")},{value:"delete_bank",label:a("actionDeleteBank")},{value:"clear_memories",label:a("actionClearMemories")},{value:"consolidation",label:a("actionConsolidation")},{value:"batch_retain",label:a("actionBatchRetain")},{value:"create_mental_model",label:a("actionCreateMentalModel")},{value:"refresh_mental_model",label:a("actionRefreshMentalModel")},{value:"delete_mental_model",label:a("actionDeleteMentalModel")},{value:"create_directive",label:a("actionCreateDirective")},{value:"delete_directive",label:a("actionDeleteDirective")},{value:"file_convert_retain",label:a("actionFileConvertRetain")},{value:"webhook_delivery",label:a("actionWebhookDelivery")}]}function Rr(a,b){if(!a||!b)return"—";let c=new Date(a).getTime(),d=new Date(b).getTime()-c;return d<1e3?`${d}ms`:d<6e4?`${(d/1e3).toFixed(1)}s`:`${(d/6e4).toFixed(1)}m`}function Rs(a){return a?new Date(a).toLocaleString(void 0,{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):"—"}function Rt({transport:a}){let b={http:"bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-300",mcp:"bg-purple-100 text-purple-800 dark:bg-purple-900/30 dark:text-purple-300",system:"bg-gray-100 text-gray-800 dark:bg-gray-900/30 dark:text-gray-300"};return(0,B.jsx)("span",{className:`inline-flex items-center px-2 py-0.5 rounded text-xs font-medium ${b[a]||b.system}`,children:a})}function Ru({bankId:a}){let b=(0,E.useTranslations)("auditLogsView"),c=Rq(b),d=[{value:"1d",label:b("periodToday")},{value:"7d",label:b("periodLast7Days")},{value:"30d",label:b("periodLast30Days")}],[e,f]=(0,C.useState)("7d"),[g,h]=(0,C.useState)(null),[i,j]=(0,C.useState)([]),[k,l]=(0,C.useState)("day"),[n,o]=(0,C.useState)(!1),p=(0,C.useCallback)(async(b=e,c=g)=>{o(!0);try{let d=await V.client.getAuditLogStats(a,{period:b,action:c||void 0});j(d.buckets||[]),l(d.trunc||"day")}catch(a){console.error("Error loading audit stats:",a)}finally{o(!1)}},[a,e,g]);(0,C.useEffect)(()=>{p()},[a]);let q=i.map(a=>{var b;let c;return{time:(b=a.time,c=new Date(b),"hour"===k?c.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"}):c.toLocaleDateString(void 0,{month:"short",day:"numeric"})),total:a.total}});return(0,B.jsxs)(bp.Card,{children:[(0,B.jsxs)(bp.CardHeader,{className:"pb-2 flex flex-row items-center justify-between space-y-0 gap-3",children:[(0,B.jsx)(bp.CardTitle,{className:"text-sm font-semibold",children:b("requestVolume")}),(0,B.jsxs)("div",{className:"flex gap-2",children:[(0,B.jsxs)(a6.Select,{value:g||"all",onValueChange:a=>{let b="all"===a?null:a;h(b),p(e,b)},children:[(0,B.jsx)(a6.SelectTrigger,{className:"w-[160px] h-8 text-xs",children:(0,B.jsx)(a6.SelectValue,{})}),(0,B.jsx)(a6.SelectContent,{position:"popper",className:"max-h-[300px] overflow-y-auto",children:c.map(a=>(0,B.jsx)(a6.SelectItem,{value:a.value,children:a.label},a.value))})]}),d.map(a=>(0,B.jsx)(W.Button,{variant:e===a.value?"default":"outline",size:"sm",className:"h-8 text-xs",onClick:()=>{f(a.value),p(a.value,g)},children:a.label},a.value))]})]}),(0,B.jsx)(bp.CardContent,{children:(0,B.jsx)("div",{className:"h-[120px]",children:n?(0,B.jsx)("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:b("chartLoading")}):0===q.length?(0,B.jsx)("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:b("chartNoData")}):(0,B.jsx)(f2,{width:"100%",height:"100%",children:(0,B.jsxs)(qG,{data:q,margin:{top:5,right:5,bottom:0,left:5},children:[(0,B.jsx)(vc,{dataKey:"time",tick:{fontSize:10},axisLine:!1,tickLine:!1,className:"text-muted-foreground"}),(0,B.jsx)(vT,{contentStyle:{backgroundColor:"var(--popover)",border:"1px solid var(--border)",borderRadius:"6px",fontSize:"12px",padding:"4px 8px"}}),(0,B.jsx)(uc,{type:"monotone",dataKey:"total",stroke:"var(--primary)",strokeWidth:2,dot:!1,activeDot:{r:3}})]})})})})]})}function Rv(){let a=(0,E.useTranslations)("auditLogsView"),b=Rq(a),c=[{value:"all",label:a("transportAll")},{value:"http",label:a("transportHttp")},{value:"mcp",label:a("transportMcp")},{value:"system",label:a("transportSystem")}],{currentBank:d}=(0,H.useBank)(),[e,f]=(0,C.useState)([]),[g,h]=(0,C.useState)(0),[i,j]=(0,C.useState)(null),[k,l]=(0,C.useState)(null),[n,o]=(0,C.useState)("all"),[p]=(0,C.useState)(20),[q,r]=(0,C.useState)(0),[s,t]=(0,C.useState)(!1),[u,v]=(0,C.useState)(null),[w,x]=(0,C.useState)(!1),y=(0,C.useCallback)(a=>{if("all"===a)return{};let b=new Date,c=new Date;return"1h"===a?c.setHours(b.getHours()-1):"1d"===a?c.setDate(b.getDate()-1):"7d"===a?c.setDate(b.getDate()-7):"30d"===a&&c.setDate(b.getDate()-30),{start_date:c.toISOString()}},[]),z=(0,C.useCallback)(async(a=i,b=k,c=n,e=q)=>{if(d){t(!0);try{let g=y(c),i=await V.client.listAuditLogs(d,{action:a||void 0,transport:b||void 0,start_date:g.start_date,end_date:g.end_date,limit:p,offset:e});f(i.items||[]),h(i.total||0)}catch(a){console.error("Error loading audit logs:",a)}finally{t(!1)}}},[d,i,k,n,q,p,y]),A=a=>{r(a),z(i,k,n,a)};(0,C.useEffect)(()=>{d&&z(i,k,n,q)},[d]);let D=Math.ceil(g/p),F=Math.floor(q/p)+1;return d?(0,B.jsxs)("div",{className:"space-y-6",children:[(0,B.jsx)(Ru,{bankId:d}),(0,B.jsxs)("div",{className:"flex items-center gap-3 flex-wrap",children:[(0,B.jsxs)(a6.Select,{value:i||"all",onValueChange:a=>{let b="all"===a?null:a;j(b),r(0),z(b,k,n,0)},children:[(0,B.jsx)(a6.SelectTrigger,{className:"w-[180px]",children:(0,B.jsx)(a6.SelectValue,{placeholder:a("actionAll")})}),(0,B.jsx)(a6.SelectContent,{position:"popper",className:"max-h-[300px] overflow-y-auto",children:b.map(a=>(0,B.jsx)(a6.SelectItem,{value:a.value,children:a.label},a.value))})]}),(0,B.jsxs)(a6.Select,{value:k||"all",onValueChange:a=>{let b="all"===a?null:a;l(b),r(0),z(i,b,n,0)},children:[(0,B.jsx)(a6.SelectTrigger,{className:"w-[160px]",children:(0,B.jsx)(a6.SelectValue,{placeholder:a("transportAll")})}),(0,B.jsx)(a6.SelectContent,{position:"popper",className:"max-h-[300px] overflow-y-auto",children:c.map(a=>(0,B.jsx)(a6.SelectItem,{value:a.value,children:a.label},a.value))})]}),(0,B.jsxs)(a6.Select,{value:n,onValueChange:a=>{o(a),r(0),z(i,k,a,0)},children:[(0,B.jsx)(a6.SelectTrigger,{className:"w-[150px]",children:(0,B.jsx)(a6.SelectValue,{})}),(0,B.jsxs)(a6.SelectContent,{position:"popper",children:[(0,B.jsx)(a6.SelectItem,{value:"all",children:a("dateRangeAll")}),(0,B.jsx)(a6.SelectItem,{value:"1h",children:a("dateRangeLastHour")}),(0,B.jsx)(a6.SelectItem,{value:"1d",children:a("dateRangeLast24Hours")}),(0,B.jsx)(a6.SelectItem,{value:"7d",children:a("dateRangeLast7Days")}),(0,B.jsx)(a6.SelectItem,{value:"30d",children:a("dateRangeLast30Days")})]})]}),(0,B.jsxs)(W.Button,{variant:"outline",size:"sm",onClick:()=>z(i,k,n,q),disabled:s,children:[(0,B.jsx)(ad,{className:`w-4 h-4 mr-1 ${s?"animate-spin":""}`}),a("refresh")]}),(0,B.jsx)("span",{className:"text-sm text-muted-foreground ml-auto",children:a("entryCount",{count:g})})]}),(0,B.jsxs)(ai,{children:[(0,B.jsx)(aj,{children:(0,B.jsxs)(al,{children:[(0,B.jsx)(am,{className:"w-[200px]",children:a("tableHeaderTime")}),(0,B.jsx)(am,{children:a("tableHeaderAction")}),(0,B.jsx)(am,{className:"w-[100px]",children:a("tableHeaderTransport")}),(0,B.jsx)(am,{className:"w-[100px]",children:a("tableHeaderDuration")})]})}),(0,B.jsx)(ak,{children:0===e.length?(0,B.jsx)(al,{children:(0,B.jsx)(an,{colSpan:4,className:"text-center text-muted-foreground py-8",children:a(s?"tableLoading":"tableNoLogs")})}):e.map(a=>(0,B.jsxs)(al,{className:"cursor-pointer hover:bg-muted/50",onClick:()=>{v(a),x(!0)},children:[(0,B.jsx)(an,{className:"text-sm font-mono",children:Rs(a.started_at)}),(0,B.jsx)(an,{className:"font-medium",children:a.action}),(0,B.jsx)(an,{children:(0,B.jsx)(Rt,{transport:a.transport})}),(0,B.jsx)(an,{className:"text-sm text-muted-foreground font-mono",children:Rr(a.started_at,a.ended_at)})]},a.id))})]}),D>1&&(0,B.jsxs)("div",{className:"flex items-center justify-between",children:[(0,B.jsx)("span",{className:"text-sm text-muted-foreground",children:a("paginationPage",{current:F,total:D})}),(0,B.jsxs)("div",{className:"flex gap-2",children:[(0,B.jsxs)(W.Button,{variant:"outline",size:"sm",onClick:()=>A(Math.max(0,q-p)),disabled:0===q,children:[(0,B.jsx)(P,{className:"w-4 h-4 mr-1"}),a("previous")]}),(0,B.jsxs)(W.Button,{variant:"outline",size:"sm",onClick:()=>A(q+p),disabled:q+p>=g,children:[a("next"),(0,B.jsx)(Q.ChevronRight,{className:"w-4 h-4 ml-1"})]})]})]}),(0,B.jsx)(bf.Dialog,{open:w,onOpenChange:x,children:(0,B.jsxs)(bf.DialogContent,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[(0,B.jsx)(bf.DialogHeader,{children:(0,B.jsx)(bf.DialogTitle,{children:a("detailDialogTitle",{action:u?.action??""})})}),u&&(0,B.jsxs)("div",{className:"space-y-4",children:[(0,B.jsxs)("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[(0,B.jsxs)("div",{children:[(0,B.jsx)("span",{className:"text-muted-foreground",children:a("detailAction")})," ",(0,B.jsx)("span",{className:"font-medium",children:u.action})]}),(0,B.jsxs)("div",{children:[(0,B.jsx)("span",{className:"text-muted-foreground",children:a("detailTransport")})," ",(0,B.jsx)(Rt,{transport:u.transport})]}),(0,B.jsxs)("div",{children:[(0,B.jsx)("span",{className:"text-muted-foreground",children:a("detailStarted")})," ",(0,B.jsx)("span",{className:"font-mono",children:Rs(u.started_at)})]}),(0,B.jsxs)("div",{children:[(0,B.jsx)("span",{className:"text-muted-foreground",children:a("detailDuration")})," ",(0,B.jsx)("span",{className:"font-mono",children:Rr(u.started_at,u.ended_at)})]})]}),u.request&&(0,B.jsxs)("div",{children:[(0,B.jsx)("h4",{className:"text-sm font-semibold mb-2",children:a("detailRequest")}),(0,B.jsx)(bq,{value:u.request,className:"bg-muted max-h-[300px] overflow-y-auto"})]}),u.response&&(0,B.jsxs)("div",{children:[(0,B.jsx)("h4",{className:"text-sm font-semibold mb-2",children:a("detailResponse")}),(0,B.jsx)(bq,{value:u.response,className:"bg-muted max-h-[300px] overflow-y-auto"})]}),u.metadata&&Object.keys(u.metadata).length>0&&(0,B.jsxs)("div",{children:[(0,B.jsx)("h4",{className:"text-sm font-semibold mb-2",children:a("detailMetadata")}),(0,B.jsx)(bq,{value:u.metadata})]})]})]})})]}):null}let Rw=(0,K.default)("power-off",[["path",{d:"M18.36 6.64A9 9 0 0 1 20.77 15",key:"dxknvb"}],["path",{d:"M6.16 6.16a9 9 0 1 0 12.68 12.68",key:"1x7qb5"}],["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);function Rx({title:a,description:b,icon:c=Rw}){return(0,B.jsxs)("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[(0,B.jsx)("div",{className:"text-muted-foreground mb-2",children:(0,B.jsx)(c,{width:48,height:48,strokeWidth:1.5})}),(0,B.jsx)("h3",{className:"text-lg font-semibold text-foreground mb-1",children:a}),(0,B.jsx)("p",{className:"text-sm text-muted-foreground max-w-md",children:b})]})}var bc=bc;a.s(["default",0,function(){(0,D.useParams)();let a=(0,D.useRouter)(),b=(0,D.useSearchParams)(),c=(0,E.useTranslations)("bank"),d=(0,E.useTranslations)("common"),{features:e}=(0,IL.useFeatures)(),{currentBank:f,setCurrentBank:g,loadBanks:h}=(0,H.useBank)(),i=b.get("view")||"profile",j=b.get("subTab")||"world",k=b.get("bankConfigTab")||"general",l=e?.observations??!1,n=e?.bank_config_api??!1,o=e?.audit_log??!1,p=e?.llm_trace??!1,[q,r]=(0,C.useState)(!1),[s,t]=(0,C.useState)(!1),[u,v]=(0,C.useState)(!1),[w,x]=(0,C.useState)(!1),[y,z]=(0,C.useState)(!1),[A,J]=(0,C.useState)(!1),[K,L]=(0,C.useState)(!1),[M,N]=(0,C.useState)(!1),O=b=>{f&&a.push((0,I.bankRoute)(f,`?view=data&subTab=${b}`))},P=b=>{f&&a.push((0,I.bankRoute)(f,`?view=profile&bankConfigTab=${b}`))},Q=async()=>{if(f){t(!0);try{await V.client.deleteBank(f),r(!1),g(null),await h(),a.push("/")}catch(a){}finally{t(!1)}}},R=async()=>{if(f){x(!0);try{let a=await V.client.clearObservations(f);v(!1),F.toast.success(c("observationsCleared"),{description:a.message||c("observationsClearedDefault")})}catch(a){}finally{x(!1)}}},S=async()=>{if(f){N(!0);try{await V.client.resetBankConfig(f),L(!1)}catch{}finally{N(!1)}}},T=async()=>{if(f){z(!0);try{await V.client.triggerConsolidation(f)}catch(a){}finally{z(!1)}}},X=async()=>{if(f){J(!0);try{let a=await V.client.recoverConsolidation(f);F.toast.success(c("recoveredMemories",{count:a.retried_count}))}catch(a){}finally{J(!1)}}};return(0,B.jsxs)("div",{className:"min-h-screen bg-background flex flex-col",children:[(0,B.jsx)(G.BankSelector,{}),(0,B.jsxs)("div",{className:"flex flex-1 overflow-hidden",children:[(0,B.jsx)(U,{currentTab:i,onTabChange:b=>{f&&a.push((0,I.bankRoute)(f,`?view=${b}`))}}),(0,B.jsx)("main",{className:"flex-1 overflow-y-auto",children:(0,B.jsxs)("div",{className:"p-6",children:["profile"===i&&(0,B.jsxs)("div",{children:[(0,B.jsxs)("div",{className:"flex justify-between items-start mb-6",children:[(0,B.jsxs)("div",{children:[(0,B.jsx)("h1",{className:"text-3xl font-bold mb-2 text-foreground",children:c("bankConfiguration")}),(0,B.jsx)("p",{className:"text-muted-foreground",children:c("bankConfigurationDescription")})]}),(0,B.jsxs)(IN.DropdownMenu,{children:[(0,B.jsx)(IN.DropdownMenuTrigger,{asChild:!0,children:(0,B.jsxs)(W.Button,{variant:"outline",size:"sm",children:[c("actions"),(0,B.jsx)(Ji,{className:"w-4 h-4 ml-2"})]})}),(0,B.jsxs)(IN.DropdownMenuContent,{align:"end",className:"w-48",children:[(0,B.jsxs)(IN.DropdownMenuItem,{onClick:async()=>{if(f)try{let a=await V.client.exportBankTemplate(f),b=JSON.stringify(a,null,2);await navigator.clipboard.writeText(b),F.toast.success(c("templateCopied"))}catch{F.toast.error(c("failedToExportTemplate"))}},children:[(0,B.jsx)(Jk,{className:"w-4 h-4 mr-2"}),c("exportTemplate")]}),(0,B.jsx)(IN.DropdownMenuSeparator,{}),(0,B.jsxs)(IN.DropdownMenuItem,{onClick:T,disabled:y||!l,title:l?void 0:"Observations feature is not enabled",children:[y?(0,B.jsx)(bc.default,{className:"w-4 h-4 mr-2 animate-spin"}):(0,B.jsx)(JE,{className:"w-4 h-4 mr-2"}),y?c("consolidating"):c("runConsolidation"),!l&&(0,B.jsx)("span",{className:"ml-auto text-xs text-muted-foreground",children:"Off"})]}),(0,B.jsxs)(IN.DropdownMenuItem,{onClick:X,disabled:A||!l,title:l?void 0:"Observations feature is not enabled",children:[A?(0,B.jsx)(bc.default,{className:"w-4 h-4 mr-2 animate-spin"}):(0,B.jsx)(Q5,{className:"w-4 h-4 mr-2"}),A?c("recovering"):c("recoverConsolidation"),!l&&(0,B.jsx)("span",{className:"ml-auto text-xs text-muted-foreground",children:"Off"})]}),(0,B.jsxs)(IN.DropdownMenuItem,{onClick:()=>v(!0),disabled:!l,className:"text-amber-600 dark:text-amber-400 focus:text-amber-700 dark:focus:text-amber-300",title:l?void 0:"Observations feature is not enabled",children:[(0,B.jsx)(Jg,{className:"w-4 h-4 mr-2"}),c("clearObservations"),!l&&(0,B.jsx)("span",{className:"ml-auto text-xs text-muted-foreground",children:"Off"})]}),(0,B.jsx)(IN.DropdownMenuSeparator,{}),(0,B.jsxs)(IN.DropdownMenuItem,{onClick:()=>L(!0),disabled:!n,className:"text-amber-600 dark:text-amber-400 focus:text-amber-700 dark:focus:text-amber-300",title:n?void 0:"Bank Config API is disabled",children:[(0,B.jsx)(Q5,{className:"w-4 h-4 mr-2"}),c("resetConfiguration"),!n&&(0,B.jsx)("span",{className:"ml-auto text-xs text-muted-foreground",children:"Off"})]}),(0,B.jsx)(IN.DropdownMenuSeparator,{}),(0,B.jsxs)(IN.DropdownMenuItem,{onClick:()=>r(!0),className:"text-red-600 dark:text-red-400 focus:text-red-700 dark:focus:text-red-300",children:[(0,B.jsx)(Jg,{className:"w-4 h-4 mr-2"}),c("deleteBank")]})]})]})]}),(0,B.jsx)("div",{className:"mb-6 border-b border-border",children:(0,B.jsxs)("div",{className:"flex gap-1",children:[(0,B.jsxs)("button",{onClick:()=>P("general"),className:`px-6 py-3 font-semibold text-sm transition-all relative ${"general"===k?"text-primary":"text-muted-foreground hover:text-foreground"}`,children:[c("general"),"general"===k&&(0,B.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]}),n&&(0,B.jsxs)("button",{onClick:()=>P("configuration"),className:`px-6 py-3 font-semibold text-sm transition-all relative ${"configuration"===k?"text-primary":"text-muted-foreground hover:text-foreground"}`,children:[c("configuration"),"configuration"===k&&(0,B.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]}),(0,B.jsxs)("button",{onClick:()=>P("webhooks"),className:`px-6 py-3 font-semibold text-sm transition-all relative ${"webhooks"===k?"text-primary":"text-muted-foreground hover:text-foreground"}`,children:[c("webhooks"),"webhooks"===k&&(0,B.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]}),(0,B.jsxs)("button",{onClick:()=>P("audit-logs"),className:`px-6 py-3 font-semibold text-sm transition-all relative ${"audit-logs"===k?"text-primary":"text-muted-foreground hover:text-foreground"}`,children:[c("auditLogs"),!o&&(0,B.jsx)("span",{className:"ml-2 text-xs px-1.5 py-0.5 rounded bg-muted text-muted-foreground",children:"Off"}),"audit-logs"===k&&(0,B.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]}),(0,B.jsxs)("button",{onClick:()=>P("llm-requests"),className:`px-6 py-3 font-semibold text-sm transition-all relative ${"llm-requests"===k?"text-primary":"text-muted-foreground hover:text-foreground"}`,children:[c("llmRequests"),!p&&(0,B.jsx)("span",{className:"ml-2 text-xs px-1.5 py-0.5 rounded bg-muted text-muted-foreground",children:"Off"}),"llm-requests"===k&&(0,B.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]})]})}),(0,B.jsxs)("div",{children:["general"===k&&(0,B.jsxs)("div",{children:[(0,B.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:c("overviewAndOperations")}),(0,B.jsxs)("div",{className:"space-y-6",children:[(0,B.jsx)(Q4,{}),(0,B.jsx)(Ra,{}),(0,B.jsx)(PQ,{hideReflectFields:!0})]})]}),"configuration"===k&&n&&(0,B.jsx)("div",{className:"space-y-6",children:(0,B.jsx)(P6,{})}),"webhooks"===k&&(0,B.jsxs)("div",{children:[(0,B.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:c("webhooksDescription")}),(0,B.jsx)(Rp,{})]}),"audit-logs"===k&&(o?(0,B.jsxs)("div",{children:[(0,B.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:c("auditLogsDescription")}),(0,B.jsx)(Rv,{})]}):(0,B.jsx)(Rx,{title:c("auditLogsNotEnabled"),description:c.rich("auditLogsDisabledMessage",{envVar:()=>(0,B.jsx)("code",{className:"px-1 py-0.5 bg-muted rounded text-xs",children:"HINDSIGHT_API_AUDIT_LOG_ENABLED=true"})})})),"llm-requests"===k&&(p?(0,B.jsxs)("div",{children:[(0,B.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:c("llmRequestsDescription")}),(0,B.jsx)(wj,{})]}):(0,B.jsx)(Rx,{title:c("llmRequestsNotEnabled"),description:c.rich("llmRequestsDisabledMessage",{envVar:()=>(0,B.jsx)("code",{className:"px-1 py-0.5 bg-muted rounded text-xs",children:"HINDSIGHT_API_LLM_TRACE_ENABLED=true"})})}))]})]}),"recall"===i&&(0,B.jsxs)("div",{children:[(0,B.jsx)("h1",{className:"text-3xl font-bold mb-2 text-foreground",children:c("recallAnalyzer")}),(0,B.jsx)("p",{className:"text-muted-foreground mb-6",children:c("recallAnalyzerDescription")}),(0,B.jsx)(PL,{})]}),"reflect"===i&&(0,B.jsxs)("div",{children:[(0,B.jsx)("h1",{className:"text-3xl font-bold mb-2 text-foreground",children:c("reflect")}),(0,B.jsx)("p",{className:"text-muted-foreground mb-6",children:c("reflectDescription")}),(0,B.jsx)(PJ,{})]}),"data"===i&&(0,B.jsxs)("div",{children:[(0,B.jsx)("h1",{className:"text-3xl font-bold mb-2 text-foreground",children:c("memories")}),(0,B.jsx)("p",{className:"text-muted-foreground mb-6",children:c("memoriesDescription")}),(0,B.jsx)("div",{className:"mb-6 border-b border-border",children:(0,B.jsxs)("div",{className:"flex gap-1",children:[(0,B.jsxs)("button",{onClick:()=>O("world"),className:`px-6 py-3 font-semibold text-sm transition-all relative ${"world"===j?"text-primary":"text-muted-foreground hover:text-foreground"}`,children:[c("worldFacts"),"world"===j&&(0,B.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]}),(0,B.jsxs)("button",{onClick:()=>O("experience"),className:`px-6 py-3 font-semibold text-sm transition-all relative ${"experience"===j?"text-primary":"text-muted-foreground hover:text-foreground"}`,children:[c("experience"),"experience"===j&&(0,B.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]}),(0,B.jsxs)("button",{onClick:()=>O("observations"),className:`px-6 py-3 font-semibold text-sm transition-all relative ${"observations"===j?"text-primary":"text-muted-foreground hover:text-foreground"}`,children:[c("observations"),!l&&(0,B.jsx)("span",{className:"ml-2 text-xs px-1.5 py-0.5 rounded bg-muted text-muted-foreground",children:"Off"}),"observations"===j&&(0,B.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]}),(0,B.jsxs)("button",{onClick:()=>O("mental-models"),className:`px-6 py-3 font-semibold text-sm transition-all relative ${"mental-models"===j?"text-primary":"text-muted-foreground hover:text-foreground"}`,children:[c("mentalModels"),"mental-models"===j&&(0,B.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]})]})}),(0,B.jsxs)("div",{children:["world"===j&&(0,B.jsxs)("div",{children:[(0,B.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:c("worldFactsDescription")}),(0,B.jsx)(IJ,{factType:"world"},"world")]}),"experience"===j&&(0,B.jsxs)("div",{children:[(0,B.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:c("experienceDescription")}),(0,B.jsx)(IJ,{factType:"experience"},"experience")]}),"observations"===j&&(l?(0,B.jsxs)("div",{children:[(0,B.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:c("observationsDescription")}),(0,B.jsx)(IJ,{factType:"observation"},"observations")]}):(0,B.jsx)(Rx,{title:c("observationsNotEnabled"),description:c.rich("observationsDisabledMessage",{envVar:()=>(0,B.jsx)("code",{className:"px-1 py-0.5 bg-muted rounded text-xs",children:"HINDSIGHT_API_ENABLE_OBSERVATIONS=true"})})})),"mental-models"===j&&(0,B.jsxs)("div",{children:[(0,B.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:c("mentalModelsDescription")}),(0,B.jsx)(Rc,{},"mental-models")]})]})]}),"documents"===i&&(0,B.jsx)("div",{children:(0,B.jsx)(Jw,{})}),"entities"===i&&(0,B.jsxs)("div",{children:[(0,B.jsx)("h1",{className:"text-3xl font-bold mb-2 text-foreground",children:c("entities")}),(0,B.jsx)("p",{className:"text-muted-foreground mb-6",children:c("entitiesDescription")}),(0,B.jsx)(Jx,{})]})]})})]}),(0,B.jsx)(IU,{open:q,onOpenChange:r,children:(0,B.jsxs)(I9,{children:[(0,B.jsxs)(Ja,{children:[(0,B.jsx)(Jc,{children:c("deleteMemoryBank")}),(0,B.jsx)(Jd,{asChild:!0,children:(0,B.jsxs)("div",{className:"space-y-2 text-sm text-muted-foreground",children:[(0,B.jsx)("p",{children:c.rich("deleteBankPrompt",{bankName:()=>(0,B.jsx)("span",{className:"font-semibold text-foreground",children:f})})}),(0,B.jsx)("p",{className:"text-red-600 dark:text-red-400 font-medium",children:c("deleteBankWarning")})]})})]}),(0,B.jsxs)(Jb,{children:[(0,B.jsx)(Jf,{disabled:s,children:d("cancel")}),(0,B.jsx)(Je,{onClick:Q,disabled:s,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:s?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(bc.default,{className:"w-4 h-4 mr-2 animate-spin"}),c("deleting")]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Jg,{className:"w-4 h-4 mr-2"}),c("deleteBank")]})})]})]})}),(0,B.jsx)(IU,{open:K,onOpenChange:L,children:(0,B.jsxs)(I9,{children:[(0,B.jsxs)(Ja,{children:[(0,B.jsx)(Jc,{children:c("resetConfigTitle")}),(0,B.jsx)(Jd,{asChild:!0,children:(0,B.jsxs)("div",{className:"space-y-2 text-sm text-muted-foreground",children:[(0,B.jsx)("p",{children:c.rich("resetConfigPrompt",{bankName:()=>(0,B.jsx)("span",{className:"font-semibold text-foreground",children:f})})}),(0,B.jsx)("p",{className:"text-amber-600 dark:text-amber-400 font-medium",children:c("resetConfigWarning")})]})})]}),(0,B.jsxs)(Jb,{children:[(0,B.jsx)(Jf,{disabled:M,children:d("cancel")}),(0,B.jsx)(Je,{onClick:S,disabled:M,children:M?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(bc.default,{className:"w-4 h-4 mr-2 animate-spin"}),c("resetting")]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Q5,{className:"w-4 h-4 mr-2"}),c("resetConfiguration")]})})]})]})}),(0,B.jsx)(IU,{open:u,onOpenChange:v,children:(0,B.jsxs)(I9,{children:[(0,B.jsxs)(Ja,{children:[(0,B.jsx)(Jc,{children:c("clearObservationsTitle")}),(0,B.jsx)(Jd,{asChild:!0,children:(0,B.jsxs)("div",{className:"space-y-2 text-sm text-muted-foreground",children:[(0,B.jsx)("p",{children:c.rich("clearObservationsPrompt",{bankName:()=>(0,B.jsx)("span",{className:"font-semibold text-foreground",children:f})})}),(0,B.jsx)("p",{className:"text-amber-600 dark:text-amber-400 font-medium",children:c("clearObservationsWarning")})]})})]}),(0,B.jsxs)(Jb,{children:[(0,B.jsx)(Jf,{disabled:w,children:d("cancel")}),(0,B.jsx)(Je,{onClick:R,disabled:w,className:"bg-amber-500 text-white hover:bg-amber-600",children:w?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(bc.default,{className:"w-4 h-4 mr-2 animate-spin"}),c("clearing")]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Jg,{className:"w-4 h-4 mr-2"}),c("clearObservations")]})})]})]})})]})}],23962)}];
|
|
7
|
+
For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return C.useEffect(()=>{document.getElementById(a.current?.getAttribute("aria-describedby"))||console.warn(b)},[b,a]),null};let I8=C.forwardRef(({className:a,...b},c)=>(0,B.jsx)(IW,{className:(0,S.cn)("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",a),...b,ref:c}));I8.displayName=IW.displayName;let I9=C.forwardRef(({className:a,...b},c)=>(0,B.jsxs)(IV,{children:[(0,B.jsx)(I8,{}),(0,B.jsx)(I_,{ref:c,className:(0,S.cn)("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",a),...b})]}));I9.displayName=I_.displayName;let Ja=({className:a,...b})=>(0,B.jsx)("div",{className:(0,S.cn)("flex flex-col space-y-2 text-center sm:text-left",a),...b});Ja.displayName="AlertDialogHeader";let Jb=({className:a,...b})=>(0,B.jsx)("div",{className:(0,S.cn)("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",a),...b});Jb.displayName="AlertDialogFooter";let Jc=C.forwardRef(({className:a,...b},c)=>(0,B.jsx)(I1,{ref:c,className:(0,S.cn)("text-lg font-semibold",a),...b}));Jc.displayName=I1.displayName;let Jd=C.forwardRef(({className:a,...b},c)=>(0,B.jsx)(I3,{ref:c,className:(0,S.cn)("text-sm text-muted-foreground",a),...b}));Jd.displayName=I3.displayName;let Je=C.forwardRef(({className:a,...b},c)=>(0,B.jsx)(I4,{ref:c,className:(0,S.cn)((0,W.buttonVariants)(),a),...b}));Je.displayName=I4.displayName;let Jf=C.forwardRef(({className:a,...b},c)=>(0,B.jsx)(I6,{ref:c,className:(0,S.cn)((0,W.buttonVariants)({variant:"outline"}),"mt-2 sm:mt-0",a),...b}));Jf.displayName=I6.displayName;let Jg=(0,K.default)("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]),Jh=(0,K.default)("pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]),Ji=(0,K.default)("ellipsis-vertical",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]]);var Jj=a.i(5784);let Jk=(0,K.default)("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]);var Jl=a.i(73320),Jm=a.i(43108);function Jn(a){let b=Math.floor((Date.now()-new Date(a).getTime())/1e3);if(b<60)return"just now";let c=Math.floor(b/60);if(c<60)return`${c}m ago`;let d=Math.floor(c/60);if(d<24)return`${d}h ago`;let e=Math.floor(d/24);if(e<30)return`${e}d ago`;let f=Math.floor(e/30);return f<12?`${f}mo ago`:`${Math.floor(f/12)}y ago`}function Jo(a){return a<1024?`${a} B`:a<1048576?`${(a/1024).toFixed(1)} KB`:`${(a/1048576).toFixed(1)} MB`}function Jp({metadata:a}){let b=Object.entries(a);return 0===b.length?(0,B.jsx)("span",{children:"-"}):(0,B.jsxs)("div",{className:"flex flex-wrap gap-1",children:[b.slice(0,3).map(([a,b])=>(0,B.jsxs)("span",{className:"text-xs px-2 py-0.5 rounded-full bg-blue-500/10 text-blue-600 dark:text-blue-400 font-medium",children:[a,"=",String(b)]},a)),b.length>3&&(0,B.jsxs)("span",{className:"text-xs px-2 py-0.5 text-muted-foreground",children:["+",b.length-3]})]})}function Jq({children:a}){return(0,B.jsx)("div",{className:"text-[11px] font-semibold uppercase tracking-[0.08em] text-muted-foreground mb-1",children:a})}function Jr({title:a,icon:b,children:c}){return(0,B.jsxs)("div",{className:"rounded-lg border border-border bg-muted/20 overflow-hidden",children:[(0,B.jsxs)("div",{className:"flex items-center gap-1.5 px-4 py-2 border-b border-border bg-muted/40 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:[b,a]}),(0,B.jsx)("div",{className:"p-4 space-y-4",children:c})]})}function Js({bankId:a,documentId:b}){let c=(0,E.useTranslations)("documentsView"),[d,e]=(0,C.useState)([]),[f,g]=(0,C.useState)(!1),[h,i]=(0,C.useState)(null);return((0,C.useEffect)(()=>{let c=!1;return(async()=>{try{let d=await V.client.listLLMRequests(a,{document_id:b,group:!0,limit:50});if(c)return;let f=new Map;for(let a of d.items||[]){let b=a.trace_id||a.id;f.has(b)||f.set(b,[]),f.get(b).push(a)}let g=[...f.entries()].map(([a,b])=>({traceId:a,entry:b[0],calls:b.length,tokens:b.reduce((a,b)=>a+(b.total_tokens??0),0),status:b.some(a=>"error"===a.status)?"error":"success",start:b.map(a=>a.started_at).filter(Boolean).sort()[0]??null}));g.sort((a,b)=>(b.start||"").localeCompare(a.start||"")),e(g)}catch{}finally{c||g(!0)}})(),()=>{c=!0}},[a,b]),f&&0!==d.length)?(0,B.jsxs)(Jr,{title:c("retainTracesTitle"),icon:(0,B.jsx)(be,{className:"w-3.5 h-3.5"}),children:[(0,B.jsx)("div",{className:"space-y-1",children:d.map(a=>(0,B.jsxs)("button",{type:"button",onClick:()=>i(a.entry),className:"w-full flex items-center justify-between gap-2 rounded-md px-2 py-1.5 text-sm text-left hover:bg-muted/50",children:[(0,B.jsxs)("span",{className:"inline-flex items-center gap-2 min-w-0",children:[(0,B.jsx)("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${"error"===a.status?"bg-red-500":"bg-green-500"}`}),(0,B.jsx)("span",{className:"font-mono text-xs",children:a.entry.operation||"retain"}),(0,B.jsx)("span",{className:"text-muted-foreground text-xs truncate",children:a.start?new Date(a.start).toLocaleString():""})]}),(0,B.jsx)("span",{className:"text-muted-foreground text-xs font-mono shrink-0",children:c("retainTracesSummary",{calls:a.calls,tokens:a.tokens.toLocaleString()})})]},a.traceId))}),(0,B.jsx)(wh,{bankId:a,entry:h,open:!!h,onOpenChange:a=>!a&&i(null)})]}):null}function Jt({label:a,value:b}){return(0,B.jsxs)("div",{children:[(0,B.jsx)(Jq,{children:a}),(0,B.jsx)("div",{className:"text-sm text-foreground",children:b})]})}function Ju({nodesByFactType:a}){let b=(0,E.useTranslations)("dataView"),c=a??{world:0,experience:0,observation:0},d=c.world+c.experience+c.observation,e=[{name:"World",value:c.world,color:"#8b5cf6"},{name:"Experience",value:c.experience,color:"#ec4899"},{name:"Observations",value:c.observation,color:"#6366f1"}];return(0,B.jsxs)("div",{className:"space-y-3",children:[(0,B.jsxs)("div",{className:"flex items-center justify-between",children:[(0,B.jsx)("h4",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-[0.08em]",children:b("memoryComposition")}),(0,B.jsx)("span",{className:"text-xs text-muted-foreground tabular-nums",children:d.toLocaleString()})]}),0===d?(0,B.jsx)("div",{className:"text-xs text-muted-foreground py-2",children:b("noMemoriesYet")}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)("div",{className:"h-1.5 flex w-full rounded-full overflow-hidden bg-muted",children:e.filter(a=>a.value>0).map(a=>(0,B.jsx)("div",{className:"h-full",style:{width:`${a.value/d*100}%`,backgroundColor:a.color},title:`${a.name}: ${a.value.toLocaleString()}`},a.name))}),(0,B.jsx)("div",{className:"grid grid-cols-3 gap-3 text-sm",children:e.map(a=>(0,B.jsxs)("div",{className:"space-y-0.5",children:[(0,B.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,B.jsx)("span",{className:"w-2 h-2 rounded-[2px]",style:{backgroundColor:a.color}}),(0,B.jsx)("span",{className:"text-[11px] uppercase tracking-wider text-muted-foreground font-medium",children:a.name})]}),(0,B.jsxs)("div",{className:"flex items-baseline gap-1.5",children:[(0,B.jsx)("span",{className:"text-base font-semibold tabular-nums",children:a.value.toLocaleString()}),(0,B.jsx)("span",{className:"text-[10px] text-muted-foreground tabular-nums",children:d>0?`${(a.value/d*100).toFixed(0)}%`:"0%"})]})]},a.name))})]})]})}function Jv({chunkFactType:a,setChunkFactType:b}){return(0,B.jsx)("div",{className:"flex items-center gap-1 px-2 py-1.5 border-b border-border bg-muted/30",children:["world","experience","observation"].map(c=>(0,B.jsx)("button",{onClick:()=>b(c),className:`px-2 py-0.5 rounded text-[11px] font-medium transition-colors ${a===c?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:"observation"===c?"Obs":c.charAt(0).toUpperCase()+c.slice(1)},c))})}function Jw({chunk:a}){let[b,c]=(0,C.useState)(!1),[d,e]=(0,C.useState)(!1),[f,g]=(0,C.useState)("world"),h=a.chunk_text??"",i=h.length>150?h.slice(0,150)+"...":h;return(0,B.jsxs)("div",{children:[(0,B.jsxs)("button",{className:"w-full flex items-center gap-3 px-4 py-2 text-left hover:bg-muted/30 transition-colors",onClick:()=>c(!b),children:[(0,B.jsx)(Jj.ChevronDown,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground transition-transform ${b?"":"-rotate-90"}`}),(0,B.jsxs)("span",{className:"text-xs font-mono text-muted-foreground shrink-0",children:["#",a.chunk_index]}),(0,B.jsxs)("span",{className:"text-[11px] text-muted-foreground/60 shrink-0",children:[h.length.toLocaleString()," chars"]}),!b&&(0,B.jsx)("span",{className:"text-xs text-foreground/50 truncate",children:i})]}),b&&(d?(0,B.jsxs)("div",{style:{height:"500px"},className:"flex flex-col border-t border-border",children:[(0,B.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 bg-muted/30 border-b border-border",children:[(0,B.jsx)(Jv,{chunkFactType:f,setChunkFactType:g}),(0,B.jsx)("div",{className:"flex-1"}),(0,B.jsxs)(W.Button,{variant:"ghost",size:"sm",onClick:()=>e(!1),className:"h-6 px-2 text-xs gap-1",children:[(0,B.jsx)(ac,{className:"w-3 h-3"}),"Compact"]})]}),(0,B.jsx)("div",{className:"flex-1 min-h-0",children:(0,B.jsx)(IJ,{factType:f,chunkId:a.chunk_id},`${a.chunk_id}-${f}-full`)})]}):(0,B.jsxs)("div",{className:"grid grid-cols-2 divide-x divide-border",style:{height:"350px"},children:[(0,B.jsx)("div",{className:"overflow-y-auto",children:(0,B.jsx)("pre",{className:"px-4 py-3 text-[11px] leading-5 text-foreground/80 whitespace-pre-wrap font-mono",children:h})}),(0,B.jsxs)("div",{className:"flex flex-col overflow-hidden",children:[(0,B.jsx)(Jv,{chunkFactType:f,setChunkFactType:g}),(0,B.jsx)("div",{className:"flex-1 min-h-0",children:(0,B.jsx)(IJ,{factType:f,chunkId:a.chunk_id,compact:!0,onExpandToggle:()=>e(!0)},`${a.chunk_id}-${f}-compact`)})]})]}))]})}function Jx(){let a=(0,E.useTranslations)("documentsView"),b=(0,E.useTranslations)("common"),c=(0,E.useTranslations)("bank"),{currentBank:d}=(0,H.useBank)(),{features:e}=(0,IL.useFeatures)(),[f,g]=(0,C.useState)([]),[h,i]=(0,C.useState)(!1),[j,k]=(0,C.useState)(""),[l,n]=(0,C.useState)(0),[o,p]=(0,C.useState)(!1),[q,r]=(0,C.useState)(!1),[s,t]=(0,C.useState)(!1),[u,v]=(0,C.useState)(!1),[w,x]=(0,C.useState)(!1),[y,z]=(0,C.useState)(null),[A,D]=(0,C.useState)("skip"),[G,I]=(0,C.useState)(1),J=Math.ceil(l/50),K=(G-1)*50,[L,M]=(0,C.useState)(null),[O,S]=(0,C.useState)(!1),[T,U]=(0,C.useState)(null),[Y,Z]=(0,C.useState)(!1),[$,ab]=(0,C.useState)(""),[ac,ae]=(0,C.useState)(!1),[af,ah]=(0,C.useState)(!1),[ao,ap]=(0,C.useState)(""),[aq,ar]=(0,C.useState)(!1),[as,at]=(0,C.useState)([]),[av,aw]=(0,C.useState)(0),[ax,ay]=(0,C.useState)(!1),[az,aA]=(0,C.useState)(!1),[aB,aC]=(0,C.useState)(!1),[aD,aE]=(0,C.useState)(null),[aF,aG]=(0,C.useState)(null),[aH,aI]=(0,C.useState)(null),aJ=async(a=1)=>{if(d){i(!0);try{let b=await V.client.listDocuments({bank_id:d,q:j,limit:50,offset:(a-1)*50});g(b.items||[]),n(b.total||0)}catch(a){}finally{i(!1)}}},aK=a=>{I(a),aJ(a)},aL=async a=>{if(d){S(!0),M({id:a}),Z(!1),ab(""),ah(!1),ap(""),at([]),aw(0),aA(!1);try{let b=await V.client.getDocument(a,d);M(b)}catch(a){M(null)}finally{S(!1)}}},aM=async a=>{if(d){ay(!0);try{let b=await V.client.listDocumentChunks({document_id:a,bank_id:d,limit:100});at(b.items||[]),aw(b.total||0),aA(!0)}catch(a){}finally{ay(!1)}}},aN=async()=>{if(d&&L){aC(!0);try{let a=await V.client.reprocessDocument(L.id,d);aE({success:!0,message:`Reprocessing started (operation: ${a.operation_id})`})}catch(a){aE({success:!1,message:"Error reprocessing document: "+a.message})}finally{aC(!1)}}},aO=async()=>{if(!d||!aF)return;let b=aF.id;U(b),aG(null);try{let c=await V.client.deleteDocument(b,d);aI({success:!0,message:a("toastDeletedDocumentAndUnits",{count:c.memory_units_deleted})}),L?.id===b&&M(null),aJ(G)}catch(b){console.error("Error deleting document:",b),aI({success:!1,message:a("toastErrorDeletingDocument")+b.message})}finally{U(null)}},aP=()=>{Z(!1),ab("")},aQ=async()=>{if(!d||!L||!ao.trim())return;let a=L.retain_params??{},b={content:ao,document_id:L.id};a.context&&(b.context=a.context),a.event_date&&(b.timestamp=a.event_date),a.metadata&&Object.keys(a.metadata).length>0&&(b.metadata=a.metadata),L.tags&&L.tags.length>0&&(b.tags=L.tags),ar(!0);try{await V.client.retain({bank_id:d,items:[b],async:!1});let a=await V.client.getDocument(L.id,d);M(a),ah(!1),ap(""),aJ(G)}catch(a){console.error("Error updating document content:",a)}finally{ar(!1)}},aR=async()=>{if(!d||!L)return;let a=$.split(",").map(a=>a.trim()).filter(a=>a.length>0);ae(!0);try{await V.client.updateDocument(L.id,d,a),M({...L,tags:a}),g(b=>b.map(b=>b.id===L.id?{...b,tags:a}:b)),Z(!1),ab("")}catch(a){console.error("Error updating document tags:",a)}finally{ae(!1)}};(0,C.useEffect)(()=>{d&&(I(1),aJ(1))},[d]),(0,C.useEffect)(()=>{if(!d)return;let a=setTimeout(()=>{I(1),aJ(1)},300);return()=>clearTimeout(a)},[j]);let aS=async(b,c=!1)=>{if(d&&!o){p(!0);try{var e;let f,g,h=await V.client.exportDocuments(d,b,c),i=b&&1===b.length?`-${b[0]}`:"-documents";e=`${d}${i}.zip`,f=URL.createObjectURL(h),(g=document.createElement("a")).href=f,g.download=e,document.body.appendChild(g),g.click(),g.remove(),URL.revokeObjectURL(f),F.toast.success(a("exportSuccess")),t(!1)}catch{}finally{p(!1)}}},aT=async b=>{if(b&&d){r(!0);try{let{operation_id:c}=await V.client.importDocuments(d,b,A),e=Date.now()+3e5,f=null;for(;Date.now()<e;){let b=await V.client.getOperationStatus(d,c);if("completed"===b.status){f=b.result_metadata??{};break}if("failed"===b.status)return void F.toast.error(b.error_message||a("importFailed"));await new Promise(a=>setTimeout(a,1e3))}if(null===f)return void F.toast.error(a("importTimeout"));F.toast.success(a("importSuccess",{imported:f.documents_imported??0,facts:f.facts_imported??0,skipped:f.documents_skipped??0})),aJ(G),x(!1),z(null)}catch{}finally{r(!1)}}},aU=e?.document_export_api??!1,aV=e?.document_import_api??!1;return(0,B.jsxs)("div",{children:[(0,B.jsxs)("div",{className:"mb-6 flex items-start justify-between gap-4",children:[(0,B.jsxs)("div",{children:[(0,B.jsx)("h1",{className:"text-3xl font-bold mb-2 text-foreground",children:c("documents")}),(0,B.jsx)("p",{className:"text-muted-foreground",children:c("documentsDescription")})]}),(aU||aV)&&(0,B.jsxs)(IN.DropdownMenu,{children:[(0,B.jsx)(IN.DropdownMenuTrigger,{asChild:!0,children:(0,B.jsxs)(W.Button,{variant:"outline",size:"sm",className:"h-8 shrink-0",disabled:!d||o||q,children:[o?a("exporting"):q?a("importing"):a("actionsButton"),(0,B.jsx)(Jj.ChevronDown,{className:"w-4 h-4 ml-1"})]})}),(0,B.jsxs)(IN.DropdownMenuContent,{align:"end",children:[aU&&(0,B.jsxs)(IN.DropdownMenuItem,{onClick:()=>{v(!1),t(!0)},children:[(0,B.jsx)(Jk,{className:"h-4 w-4 mr-2"}),a("exportButton")]}),aV&&(0,B.jsxs)(IN.DropdownMenuItem,{onClick:()=>x(!0),children:[(0,B.jsx)(Jl.Upload,{className:"h-4 w-4 mr-2"}),a("importButton")]})]})]})]}),(0,B.jsx)(bf.Dialog,{open:s,onOpenChange:t,children:(0,B.jsxs)(bf.DialogContent,{children:[(0,B.jsxs)(bf.DialogHeader,{children:[(0,B.jsx)(bf.DialogTitle,{children:a("exportDialogTitle")}),(0,B.jsx)(bf.DialogDescription,{children:a("exportDialogDescription")})]}),(0,B.jsxs)("div",{className:"flex items-start gap-2 py-2",children:[(0,B.jsx)(IM.Checkbox,{id:"export-include-observations",checked:u,onCheckedChange:a=>v(!0===a)}),(0,B.jsxs)("div",{className:"grid gap-1 leading-none",children:[(0,B.jsx)(au,{htmlFor:"export-include-observations",children:a("exportIncludeObservationsLabel")}),(0,B.jsx)("p",{className:"text-xs text-muted-foreground",children:a("exportIncludeObservationsHint")})]})]}),(0,B.jsxs)(bf.DialogFooter,{children:[(0,B.jsx)(W.Button,{variant:"outline",size:"sm",onClick:()=>t(!1),disabled:o,children:b("cancel")}),(0,B.jsxs)(W.Button,{size:"sm",onClick:()=>aS(void 0,u),disabled:o,children:[(0,B.jsx)(Jk,{className:"h-4 w-4 mr-2"}),o?a("exporting"):a("exportButton")]})]})]})}),(0,B.jsx)(bf.Dialog,{open:w,onOpenChange:a=>{x(a),a||z(null)},children:(0,B.jsxs)(bf.DialogContent,{children:[(0,B.jsxs)(bf.DialogHeader,{children:[(0,B.jsx)(bf.DialogTitle,{children:a("importDialogTitle")}),(0,B.jsx)(bf.DialogDescription,{children:a("importDialogDescription")})]}),(0,B.jsxs)("div",{className:"py-2 space-y-4",children:[(0,B.jsx)("input",{type:"file",accept:".zip,application/zip",disabled:q,onChange:a=>z(a.target.files?.[0]??null),className:"block w-full text-sm text-muted-foreground file:mr-3 file:rounded-md file:border-0 file:bg-muted file:px-3 file:py-1.5 file:text-sm file:font-medium hover:file:bg-muted/80"}),(0,B.jsxs)("div",{className:"grid gap-1.5",children:[(0,B.jsx)(au,{htmlFor:"import-on-conflict",children:a("importConflictLabel")}),(0,B.jsxs)(a6.Select,{value:A,onValueChange:a=>D(a),disabled:q,children:[(0,B.jsx)(a6.SelectTrigger,{id:"import-on-conflict",className:"h-8",children:(0,B.jsx)(a6.SelectValue,{})}),(0,B.jsxs)(a6.SelectContent,{children:[(0,B.jsx)(a6.SelectItem,{value:"skip",children:a("importConflictSkip")}),(0,B.jsx)(a6.SelectItem,{value:"replace",children:a("importConflictReplace")}),(0,B.jsx)(a6.SelectItem,{value:"new-id",children:a("importConflictNewId")})]})]})]})]}),(0,B.jsxs)(bf.DialogFooter,{children:[(0,B.jsx)(W.Button,{variant:"outline",size:"sm",onClick:()=>{x(!1),z(null)},disabled:q,children:b("cancel")}),(0,B.jsxs)(W.Button,{size:"sm",onClick:()=>y&&aT(y),disabled:!y||q,children:[(0,B.jsx)(Jl.Upload,{className:"h-4 w-4 mr-2"}),q?a("importing"):a("importButton")]})]})]})}),h?(0,B.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,B.jsxs)("div",{className:"text-center",children:[(0,B.jsx)("div",{className:"text-4xl mb-2",children:"⏳"}),(0,B.jsx)("div",{className:"text-sm text-muted-foreground",children:a("loadingDocuments")})]})}):f.length>0?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)("div",{className:"mb-4 text-sm text-muted-foreground",children:a("totalDocuments",{total:l})}),(0,B.jsxs)("div",{className:"w-full",children:[(0,B.jsx)("div",{className:"px-5 mb-4",children:(0,B.jsx)(X.Input,{type:"text",value:j,onChange:a=>k(a.target.value),placeholder:a("searchPlaceholder"),className:"max-w-2xl"})}),(0,B.jsx)("div",{className:"overflow-x-auto px-5 pb-5",children:(0,B.jsxs)(ai,{children:[(0,B.jsx)(aj,{children:(0,B.jsxs)(al,{children:[(0,B.jsx)(am,{children:a("colDocumentId")}),(0,B.jsx)(am,{children:a("colCreated")}),(0,B.jsx)(am,{children:a("colUpdated")}),(0,B.jsx)(am,{children:a("colTags")}),(0,B.jsx)(am,{children:a("colMetadata")}),(0,B.jsx)(am,{children:a("colSize")}),(0,B.jsx)(am,{children:a("colMemoryUnits")})]})}),(0,B.jsx)(ak,{children:f.length>0?f.map(a=>(0,B.jsxs)(al,{className:`cursor-pointer hover:bg-muted/50 ${L?.id===a.id?"bg-primary/10":""}`,onClick:()=>aL(a.id),children:[(0,B.jsx)(an,{className:"text-card-foreground font-mono text-xs break-all",children:a.id}),(0,B.jsx)(an,{className:"text-card-foreground",title:a.created_at?new Date(a.created_at).toLocaleString():"",children:a.created_at?Jn(a.created_at):"N/A"}),(0,B.jsx)(an,{className:"text-card-foreground",title:a.updated_at?new Date(a.updated_at).toLocaleString():"",children:a.updated_at?Jn(a.updated_at):"N/A"}),(0,B.jsx)(an,{className:"text-card-foreground",children:a.tags&&a.tags.length>0?(0,B.jsxs)("div",{className:"flex flex-wrap gap-1",children:[a.tags.slice(0,3).map((a,b)=>(0,B.jsx)("span",{className:"text-xs px-2 py-0.5 rounded-full bg-amber-500/10 text-amber-600 dark:text-amber-400 font-medium",children:a},b)),a.tags.length>3&&(0,B.jsxs)("span",{className:"text-xs px-2 py-0.5 text-muted-foreground",children:["+",a.tags.length-3]})]}):"-"}),(0,B.jsx)(an,{className:"text-card-foreground",children:a.document_metadata&&Object.keys(a.document_metadata).length>0?(0,B.jsx)(Jp,{metadata:a.document_metadata}):"-"}),(0,B.jsx)(an,{className:"text-card-foreground",children:Jo(a.text_length||0)}),(0,B.jsx)(an,{className:"text-card-foreground",children:a.memory_unit_count})]},a.id)):(0,B.jsx)(al,{children:(0,B.jsx)(an,{colSpan:7,className:"text-center",children:a("clickLoadDocumentsToView")})})})]})}),J>1&&(0,B.jsxs)("div",{className:"flex items-center justify-between mt-3 pt-3 border-t px-5",children:[(0,B.jsxs)("div",{className:"text-xs text-muted-foreground",children:[K+1,"-",Math.min(K+50,l)," of ",l]}),(0,B.jsxs)("div",{className:"flex items-center gap-1",children:[(0,B.jsx)(W.Button,{variant:"outline",size:"sm",onClick:()=>aK(1),disabled:1===G||h,className:"h-7 w-7 p-0",children:(0,B.jsx)(_,{className:"h-3 w-3"})}),(0,B.jsx)(W.Button,{variant:"outline",size:"sm",onClick:()=>aK(G-1),disabled:1===G||h,className:"h-7 w-7 p-0",children:(0,B.jsx)(P,{className:"h-3 w-3"})}),(0,B.jsxs)("span",{className:"text-xs px-2",children:[G," / ",J]}),(0,B.jsx)(W.Button,{variant:"outline",size:"sm",onClick:()=>aK(G+1),disabled:G===J||h,className:"h-7 w-7 p-0",children:(0,B.jsx)(Q.ChevronRight,{className:"h-3 w-3"})}),(0,B.jsx)(W.Button,{variant:"outline",size:"sm",onClick:()=>aK(J),disabled:G===J||h,className:"h-7 w-7 p-0",children:(0,B.jsx)(aa,{className:"h-3 w-3"})})]})]})]})]}):(0,B.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,B.jsxs)("div",{className:"text-center",children:[(0,B.jsx)("div",{className:"text-4xl mb-2",children:"📄"}),(0,B.jsx)("div",{className:"text-sm text-muted-foreground",children:a("noDocumentsFound")})]})}),(0,B.jsx)(bf.Dialog,{open:!!L,onOpenChange:a=>!a&&M(null),children:(0,B.jsxs)(bf.DialogContent,{className:"w-[95vw] max-w-[95vw] h-[92vh] sm:max-w-[95vw] flex flex-col overflow-hidden",children:[(0,B.jsx)(bf.DialogHeader,{className:"pr-10",children:(0,B.jsx)(bf.DialogTitle,{className:"flex items-center gap-2",children:(0,B.jsx)("span",{className:"truncate font-mono text-sm",children:L?.id??"Document"})})}),O?(0,B.jsx)("div",{className:"flex items-center justify-center flex-1",children:(0,B.jsxs)("div",{className:"text-center",children:[(0,B.jsx)("div",{className:"text-4xl mb-2",children:"⏳"}),(0,B.jsx)("div",{className:"text-sm text-muted-foreground",children:a("loadingDocument")})]})}):L?(0,B.jsxs)(bh.Tabs,{defaultValue:"general",className:"flex-1 flex flex-col overflow-hidden",children:[(0,B.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,B.jsxs)(bh.TabsList,{className:"grid grid-cols-3 w-full max-w-md",children:[(0,B.jsxs)(bh.TabsTrigger,{value:"general",className:"flex items-center gap-1.5",children:[(0,B.jsx)(R,{className:"w-3.5 h-3.5"}),"General"]}),(0,B.jsxs)(bh.TabsTrigger,{value:"content",className:"flex items-center gap-1.5",children:[(0,B.jsx)(N.FileText,{className:"w-3.5 h-3.5"}),"Content"]}),(0,B.jsxs)(bh.TabsTrigger,{value:"chunks",className:"flex items-center gap-1.5",onClick:()=>{!az&&L?.id&&aM(L.id)},children:[(0,B.jsx)(bi,{className:"w-3.5 h-3.5"}),"Chunks",az?` (${av})`:""]})]}),(0,B.jsxs)(IN.DropdownMenu,{children:[(0,B.jsx)(IN.DropdownMenuTrigger,{asChild:!0,children:(0,B.jsx)(W.Button,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 shrink-0",disabled:aB,"aria-label":b("actions"),children:(0,B.jsx)(Ji,{className:"h-4 w-4"})})}),(0,B.jsxs)(IN.DropdownMenuContent,{align:"end",children:[(0,B.jsxs)(IN.DropdownMenuItem,{onClick:aN,disabled:aB,children:[(0,B.jsx)(ad,{className:"h-4 w-4 mr-2"}),"Reprocess"]}),aU&&(0,B.jsxs)(IN.DropdownMenuItem,{onClick:()=>aS([L.id]),disabled:o,children:[(0,B.jsx)(Jk,{className:"h-4 w-4 mr-2"}),a("exportButton")]}),(0,B.jsx)(IN.DropdownMenuSeparator,{}),(0,B.jsxs)(IN.DropdownMenuItem,{onClick:()=>{aG({id:L.id,memoryCount:L.memory_unit_count})},className:"text-red-600 focus:text-red-600 dark:text-red-400 dark:focus:text-red-400 focus:bg-red-500/10",children:[(0,B.jsx)(Jg,{className:"h-4 w-4 mr-2"}),a("deleteButton")]})]})]})]}),(0,B.jsxs)("div",{className:"flex-1 overflow-y-auto mt-4",children:[(0,B.jsx)(bh.TabsContent,{value:"content",className:"mt-0",children:e?.store_document_text||L.original_text?void 0!==L.original_text?af?(0,B.jsxs)("div",{className:"space-y-2",children:[(0,B.jsx)("div",{className:"flex items-center justify-end mb-2",children:(0,B.jsxs)("div",{className:"flex gap-2",children:[(0,B.jsxs)(W.Button,{size:"sm",onClick:aQ,disabled:aq||!ao.trim(),className:"h-7 px-3 gap-1 text-xs",children:[aq?(0,B.jsx)("span",{className:"animate-spin",children:"⏳"}):(0,B.jsx)(ba.Check,{className:"h-3 w-3"}),a("saveButton")]}),(0,B.jsxs)(W.Button,{variant:"outline",size:"sm",onClick:()=>{ah(!1),ap("")},disabled:aq,className:"h-7 px-3 gap-1 text-xs",children:[(0,B.jsx)(bb.X,{className:"h-3 w-3"}),a("cancelButton")]})]})}),(0,B.jsx)("textarea",{value:ao,onChange:a=>ap(a.target.value),className:"w-full min-h-[400px] max-h-[600px] p-4 bg-muted/50 rounded-lg border border-border text-sm font-mono leading-relaxed text-card-foreground resize-y",autoFocus:!0}),(0,B.jsx)("p",{className:"text-xs text-muted-foreground",children:a("saveHint")})]}):(0,B.jsxs)("div",{className:"rounded-lg border border-border bg-muted/30 overflow-hidden",children:[(0,B.jsxs)("div",{className:"flex items-center justify-between gap-2 px-4 py-2 border-b border-border bg-muted/50 text-xs text-muted-foreground",children:[(0,B.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,B.jsx)(N.FileText,{className:"w-3.5 h-3.5"}),(0,B.jsx)("span",{className:"font-semibold uppercase tracking-wide",children:a("storedContent")}),(0,B.jsxs)("span",{className:"text-muted-foreground/70",children:["·"," ",L.original_text?.length?.toLocaleString()??0," chars"]})]}),(0,B.jsxs)(W.Button,{variant:"ghost",size:"sm",onClick:()=>{ap(L?.original_text??""),ah(!0)},className:"h-6 px-2 gap-1 text-xs",children:[(0,B.jsx)(Jh,{className:"h-3 w-3"}),a("editButton")]})]}),(0,B.jsx)("pre",{className:"p-4 text-[11px] leading-5 text-foreground/80 whitespace-pre-wrap font-mono",children:L.original_text})]}):null:(0,B.jsxs)("div",{className:"flex items-start gap-2 rounded-md border border-amber-500/30 bg-amber-500/10 px-4 py-3 text-xs text-amber-700 dark:text-amber-400",children:[(0,B.jsx)(Jm.Lock,{className:"h-4 w-4 mt-0.5 shrink-0"}),(0,B.jsx)("span",{children:a("textNotStoredWarning")})]})}),(0,B.jsx)(bh.TabsContent,{value:"general",className:"mt-0",children:(0,B.jsxs)("div",{className:"space-y-4",children:[(0,B.jsxs)(bh.Tabs,{defaultValue:"world",className:"flex flex-col",children:[(0,B.jsxs)(bh.TabsList,{className:"w-fit",children:[(0,B.jsx)(bh.TabsTrigger,{value:"world",children:"World"}),(0,B.jsx)(bh.TabsTrigger,{value:"experience",children:"Experience"}),(0,B.jsx)(bh.TabsTrigger,{value:"observation",children:"Observations"})]}),(0,B.jsxs)("div",{className:"mt-2",children:[(0,B.jsx)(bh.TabsContent,{value:"world",className:"mt-0",children:(0,B.jsx)(IJ,{factType:"world",documentId:L.id,compact:!0})}),(0,B.jsx)(bh.TabsContent,{value:"experience",className:"mt-0",children:(0,B.jsx)(IJ,{factType:"experience",documentId:L.id,compact:!0})}),(0,B.jsx)(bh.TabsContent,{value:"observation",className:"mt-0",children:(0,B.jsx)(IJ,{factType:"observation",documentId:L.id,compact:!0})})]})]}),(0,B.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,B.jsxs)(Jr,{title:"Document",icon:(0,B.jsx)(N.FileText,{className:"w-3.5 h-3.5"}),children:[L.created_at&&(0,B.jsx)(Jt,{label:a("labelCreated"),value:new Date(L.created_at).toLocaleString()}),L.updated_at&&(0,B.jsx)(Jt,{label:a("labelUpdated"),value:new Date(L.updated_at).toLocaleString()}),L.original_text&&(0,B.jsx)(Jt,{label:a("colSize"),value:Jo(new Blob([L.original_text]).size)}),(0,B.jsx)(Jt,{label:a("labelTags"),value:Y?(0,B.jsxs)("div",{className:"flex items-center gap-2",children:[(0,B.jsx)(X.Input,{value:$,onChange:a=>ab(a.target.value),placeholder:a("tagsInputPlaceholder"),className:"text-sm h-7 w-64",onKeyDown:a=>{"Enter"===a.key&&aR(),"Escape"===a.key&&aP()},autoFocus:!0}),(0,B.jsx)(W.Button,{size:"sm",onClick:aR,disabled:ac,className:"h-7 w-7 p-0",children:ac?(0,B.jsx)("span",{className:"animate-spin text-xs",children:"⏳"}):(0,B.jsx)(ba.Check,{className:"h-3 w-3"})}),(0,B.jsx)(W.Button,{variant:"outline",size:"sm",onClick:aP,disabled:ac,className:"h-7 w-7 p-0",children:(0,B.jsx)(bb.X,{className:"h-3 w-3"})})]}):(0,B.jsxs)("div",{className:"flex items-center gap-2",children:[L.tags&&L.tags.length>0?(0,B.jsx)("div",{className:"flex flex-wrap gap-1.5",children:L.tags.map((a,b)=>(0,B.jsx)("span",{className:"text-xs px-2 py-0.5 rounded-full bg-amber-500/10 text-amber-600 dark:text-amber-400 font-medium",children:a},b))}):(0,B.jsx)("span",{className:"text-sm text-muted-foreground italic",children:"none"}),(0,B.jsx)(W.Button,{variant:"ghost",size:"sm",onClick:()=>{ab((L?.tags??[]).join(", ")),Z(!0)},className:"h-6 w-6 p-0",children:(0,B.jsx)(Jh,{className:"h-3 w-3"})})]})}),L.retain_params?.context&&(0,B.jsx)(Jt,{label:"Context",value:L.retain_params.context}),L.retain_params?.event_date&&(0,B.jsx)(Jt,{label:a("labelEventDate"),value:new Date(L.retain_params.event_date).toLocaleString()}),L.retain_params?.metadata&&Object.keys(L.retain_params.metadata).length>0&&(0,B.jsx)(Jt,{label:"Metadata",value:(0,B.jsx)(Jp,{metadata:L.retain_params.metadata})})]}),(0,B.jsx)(Jr,{title:a("memoryCompositionTitle"),icon:(0,B.jsx)(ag,{className:"w-3.5 h-3.5"}),children:(0,B.jsx)(Ju,{nodesByFactType:L.nodes_by_fact_type})}),d&&L?.id&&(0,B.jsx)(Js,{bankId:d,documentId:L.id})]})]})}),(0,B.jsxs)(bh.TabsContent,{value:"chunks",className:"mt-0",children:[!e?.store_document_text&&(0,B.jsxs)("div",{className:"flex items-start gap-2 rounded-md border border-amber-500/30 bg-amber-500/10 px-4 py-3 mb-3 text-xs text-amber-700 dark:text-amber-400",children:[(0,B.jsx)(Jm.Lock,{className:"h-4 w-4 mt-0.5 shrink-0"}),(0,B.jsx)("span",{children:a("textNotStoredWarning")})]}),ax?(0,B.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,B.jsxs)("div",{className:"text-center",children:[(0,B.jsx)("div",{className:"text-4xl mb-2",children:"⏳"}),(0,B.jsx)("div",{className:"text-sm text-muted-foreground",children:a("loadingChunks")})]})}):as.length>0?(0,B.jsx)("div",{className:"rounded-lg border border-border overflow-hidden divide-y divide-border",children:as.map(a=>(0,B.jsx)(Jw,{chunk:a},a.chunk_id))}):az?(0,B.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,B.jsxs)("div",{className:"text-center",children:[(0,B.jsx)("div",{className:"text-4xl mb-2",children:"📄"}),(0,B.jsx)("div",{className:"text-sm text-muted-foreground",children:a("noChunksFound")})]})}):(0,B.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,B.jsx)("div",{className:"text-center",children:(0,B.jsx)("div",{className:"text-sm text-muted-foreground",children:a("clickChunksTabToLoad")})})})]})]})]}):null]})}),(0,B.jsx)(IU,{open:!!aF,onOpenChange:a=>!a&&aG(null),children:(0,B.jsxs)(I9,{children:[(0,B.jsxs)(Ja,{children:[(0,B.jsx)(Jc,{children:a("deleteDialogTitle")}),(0,B.jsxs)(Jd,{children:[a("deleteDialogDescription")," ",(0,B.jsxs)("span",{className:"font-mono font-semibold",children:['"',aF?.id,'"']}),"?",(0,B.jsx)("br",{}),(0,B.jsx)("br",{}),a("deleteDialogWillDelete")," ",aF?.memoryCount!==void 0?(0,B.jsx)("span",{className:"font-semibold",children:a("deleteDialogMemoryUnits",{count:aF.memoryCount})}):a("deleteDialogAllMemoryUnits")," ",a("deleteDialogExtracted"),(0,B.jsx)("br",{}),(0,B.jsx)("br",{}),(0,B.jsx)("span",{className:"text-destructive font-semibold",children:a("deleteDialogCannotUndo")})]})]}),(0,B.jsxs)(Jb,{children:[(0,B.jsx)(Jf,{children:a("cancelButton")}),(0,B.jsx)(Je,{onClick:aO,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:a("deleteButton")})]})]})}),(0,B.jsx)(IU,{open:!!aH,onOpenChange:a=>!a&&aI(null),children:(0,B.jsxs)(I9,{children:[(0,B.jsxs)(Ja,{children:[(0,B.jsx)(Jc,{children:aH?.success?a("deleteResultSuccessTitle"):a("deleteResultErrorTitle")}),(0,B.jsx)(Jd,{children:aH?.message})]}),(0,B.jsx)(Jb,{children:(0,B.jsx)(Je,{onClick:()=>aI(null),children:a("okButton")})})]})}),(0,B.jsx)(IU,{open:!!aD,onOpenChange:a=>!a&&aE(null),children:(0,B.jsxs)(I9,{children:[(0,B.jsxs)(Ja,{children:[(0,B.jsx)(Jc,{children:aD?.success?"Reprocessing Started":a("deleteResultErrorTitle")}),(0,B.jsx)(Jd,{children:aD?.message})]}),(0,B.jsx)(Jb,{children:(0,B.jsx)(Je,{onClick:()=>aE(null),children:a("okButton")})})]})})]})}function Jy(){let a=(0,E.useTranslations)("entitiesView"),{currentBank:b}=(0,H.useBank)(),[c,d]=(0,C.useState)([]),[e,f]=(0,C.useState)(!1),[g,h]=(0,C.useState)(null),[i,j]=(0,C.useState)(!1),[k,l]=(0,C.useState)("relations"),[n,o]=(0,C.useState)(null),[p,q]=(0,C.useState)(!1),[r,s]=(0,C.useState)(1),[t,u]=(0,C.useState)(0),v=Math.ceil(t/50),w=(r-1)*50,x=async(a=1)=>{if(b){f(!0);try{let c=await V.client.listEntities({bank_id:b,limit:50,offset:(a-1)*50});d(c.items||[]),u(c.total||0)}catch(a){}finally{f(!1)}}},y=async a=>{if(b){j(!0);try{let c=await V.client.getEntity(a,b);h(c)}catch(a){}finally{j(!1)}}},z=a=>{s(a),x(a)},A=(0,C.useCallback)(async()=>{if(b){q(!0);try{let a=await V.client.getEntityGraph({bank_id:b,limit:2e3,min_count:1});o(a)}catch(a){}finally{q(!1)}}},[b]);(0,C.useEffect)(()=>{b&&(s(1),x(1),h(null),o(null))},[b]),(0,C.useEffect)(()=>{"relations"!==k||!b||n||p||A()},[k,b,n,p,A]);let D=(0,C.useMemo)(()=>n?HA(n):{nodes:[],links:[]},[n]),F=(0,C.useMemo)(()=>{let a=new Map;for(let b of D.links){let c="number"==typeof b.weight&&b.weight>0?b.weight:1;a.set(b.source,(a.get(b.source)||0)+c),a.set(b.target,(a.get(b.target)||0)+c)}return a},[D]),G=(0,C.useMemo)(()=>{let a=1;for(let b of F.values())b>a&&(a=b);return a},[F]),I=(0,C.useCallback)(a=>3+11*Math.sqrt((F.get(a.id)||0)/G),[F,G]),J=(0,C.useMemo)(()=>{let a=n?.edges||[];if(!a.length)return null;let b=new Map,c=1/0,d=-1/0;for(let e of a){let a=e.data.lastCooccurred;if(!a)continue;let f=Date.parse(a);if(!Number.isNaN(f)){for(let a of[e.data.source,e.data.target]){let c=b.get(a);(void 0===c||f>c)&&b.set(a,f)}f<c&&(c=f),f>d&&(d=f)}}return Number.isFinite(c)&&Number.isFinite(d)&&d!==c?{times:b,minT:c,maxT:d}:null},[n]),K=(0,C.useCallback)(a=>{if(!J)return .5;let b=J.times.get(a.id);return void 0===b?0:(b-J.minT)/(J.maxT-J.minT)},[J]),L=(0,C.useCallback)(a=>{y(a.id)},[b]),M=b=>b?new Date(b).toLocaleDateString():a("na");return(0,B.jsxs)("div",{children:[(0,B.jsx)("div",{className:"mb-4 flex items-center justify-end",children:(0,B.jsxs)("div",{className:"flex items-center gap-2 bg-muted rounded-lg p-1",children:[(0,B.jsxs)("button",{onClick:()=>l("relations"),className:`px-3 py-1.5 rounded-md text-sm font-medium transition-all flex items-center gap-1.5 ${"relations"===k?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:[(0,B.jsx)(IH,{className:"w-4 h-4"}),a("viewRelations")]}),(0,B.jsxs)("button",{onClick:()=>l("list"),className:`px-3 py-1.5 rounded-md text-sm font-medium transition-all flex items-center gap-1.5 ${"list"===k?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:[(0,B.jsx)(ah,{className:"w-4 h-4"}),a("viewList")]})]})}),"relations"===k&&(0,B.jsx)("div",{className:"border border-border rounded-lg overflow-hidden",children:p?(0,B.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,B.jsxs)("div",{className:"text-center",children:[(0,B.jsx)("div",{className:"text-4xl mb-2",children:"..."}),(0,B.jsx)("div",{className:"text-sm text-muted-foreground",children:a("loadingEntityGraph")})]})}):D.nodes.length>0?(0,B.jsx)(IF,{data:D,height:700,onNodeClick:L,nodeSizeFn:I,nodeHeatFn:J?K:void 0,heatLegendLabel:J?a("heatLegendLabel"):void 0,heatLegendEndpoints:J?[new Date(J.minT).toISOString().slice(0,10),new Date(J.maxT).toISOString().slice(0,10)]:void 0,sizeLegendLabel:a("sizeLegendLabel"),compactLabels:!0}):(0,B.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,B.jsxs)("div",{className:"text-center",children:[(0,B.jsx)("div",{className:"text-sm text-muted-foreground",children:a("noCooccurrences")}),(0,B.jsx)("div",{className:"text-xs text-muted-foreground mt-1",children:a("noCooccurrencesDescription")})]})})}),"list"===k&&(0,B.jsx)("div",{children:e?(0,B.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,B.jsxs)("div",{className:"text-center",children:[(0,B.jsx)("div",{className:"text-4xl mb-2",children:"..."}),(0,B.jsx)("div",{className:"text-sm text-muted-foreground",children:a("loadingEntities")})]})}):c.length>0?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)("div",{className:"mb-4 text-sm text-muted-foreground",children:a("entityCount",{count:t})}),(0,B.jsx)("div",{className:"overflow-x-auto",children:(0,B.jsxs)(ai,{children:[(0,B.jsx)(aj,{children:(0,B.jsxs)(al,{children:[(0,B.jsx)(am,{children:a("colName")}),(0,B.jsx)(am,{children:a("colMentions")}),(0,B.jsx)(am,{children:a("colFirstSeen")}),(0,B.jsx)(am,{children:a("colLastSeen")})]})}),(0,B.jsx)(ak,{children:c.map(a=>(0,B.jsxs)(al,{onClick:()=>y(a.id),className:`cursor-pointer hover:bg-muted/50 ${g?.id===a.id?"bg-primary/10":""}`,children:[(0,B.jsx)(an,{className:"font-medium text-card-foreground",children:a.canonical_name}),(0,B.jsx)(an,{className:"text-card-foreground",children:a.mention_count}),(0,B.jsx)(an,{className:"text-card-foreground",children:M(a.first_seen)}),(0,B.jsx)(an,{className:"text-card-foreground",children:M(a.last_seen)})]},a.id))})]})}),v>1&&(0,B.jsxs)("div",{className:"flex items-center justify-between mt-3 pt-3 border-t",children:[(0,B.jsxs)("div",{className:"text-xs text-muted-foreground",children:[w+1,"-",Math.min(w+50,t)," of ",t]}),(0,B.jsxs)("div",{className:"flex items-center gap-1",children:[(0,B.jsx)(W.Button,{variant:"outline",size:"sm",onClick:()=>z(1),disabled:1===r||e,className:"h-7 w-7 p-0",children:(0,B.jsx)(_,{className:"h-3 w-3"})}),(0,B.jsx)(W.Button,{variant:"outline",size:"sm",onClick:()=>z(r-1),disabled:1===r||e,className:"h-7 w-7 p-0",children:(0,B.jsx)(P,{className:"h-3 w-3"})}),(0,B.jsxs)("span",{className:"text-xs px-2",children:[r," / ",v]}),(0,B.jsx)(W.Button,{variant:"outline",size:"sm",onClick:()=>z(r+1),disabled:r===v||e,className:"h-7 w-7 p-0",children:(0,B.jsx)(Q.ChevronRight,{className:"h-3 w-3"})}),(0,B.jsx)(W.Button,{variant:"outline",size:"sm",onClick:()=>z(v),disabled:r===v||e,className:"h-7 w-7 p-0",children:(0,B.jsx)(aa,{className:"h-3 w-3"})})]})]})]}):(0,B.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,B.jsxs)("div",{className:"text-center",children:[(0,B.jsx)("div",{className:"text-4xl mb-2",children:"..."}),(0,B.jsx)("div",{className:"text-sm text-muted-foreground",children:a("noEntitiesFound")}),(0,B.jsx)("div",{className:"text-xs text-muted-foreground mt-1",children:a("noEntitiesDescription")})]})})}),g&&(0,B.jsx)("div",{className:"fixed right-0 top-0 h-screen w-[420px] bg-card border-l-2 border-primary shadow-2xl z-50 overflow-y-auto animate-in slide-in-from-right duration-300 ease-out",children:(0,B.jsxs)("div",{className:"p-5",children:[(0,B.jsxs)("div",{className:"flex justify-between items-center mb-6 pb-4 border-b border-border",children:[(0,B.jsxs)("div",{children:[(0,B.jsx)("h3",{className:"text-xl font-bold text-card-foreground",children:g.canonical_name}),(0,B.jsx)("p",{className:"text-sm text-muted-foreground mt-1",children:a("entityDetails")})]}),(0,B.jsx)(W.Button,{variant:"ghost",size:"sm",onClick:()=>h(null),className:"h-8 w-8 p-0",children:(0,B.jsx)("span",{className:"text-lg",children:"x"})})]}),(0,B.jsxs)("div",{className:"space-y-5",children:[(0,B.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,B.jsxs)("div",{className:"p-4 bg-muted/50 rounded-lg",children:[(0,B.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:a("mentionsLabel")}),(0,B.jsx)("div",{className:"text-lg font-semibold text-card-foreground",children:g.mention_count})]}),(0,B.jsxs)("div",{className:"p-4 bg-muted/50 rounded-lg",children:[(0,B.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:a("firstSeenLabel")}),(0,B.jsx)("div",{className:"text-sm font-medium text-card-foreground",children:M(g.first_seen)})]})]}),(0,B.jsxs)("div",{className:"p-4 bg-muted/50 rounded-lg",children:[(0,B.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:a("entityIdLabel")}),(0,B.jsx)("code",{className:"text-xs font-mono break-all text-muted-foreground",children:g.id})]})]})]})})]})}let Jz=["world","experience","observation"],JA={world:{active:"bg-violet-500/15 text-violet-700 border-violet-400 dark:text-violet-300 dark:border-violet-500",inactive:"border-border text-muted-foreground hover:border-violet-300 hover:text-violet-600 dark:hover:text-violet-400",dot:"bg-violet-500"},experience:{active:"bg-pink-500/15 text-pink-700 border-pink-400 dark:text-pink-300 dark:border-pink-500",inactive:"border-border text-muted-foreground hover:border-pink-300 hover:text-pink-600 dark:hover:text-pink-400",dot:"bg-pink-500"},observation:{active:"bg-indigo-500/15 text-indigo-700 border-indigo-400 dark:text-indigo-300 dark:border-indigo-500",inactive:"border-border text-muted-foreground hover:border-indigo-300 hover:text-indigo-600 dark:hover:text-indigo-400",dot:"bg-indigo-500"}};function JB({ft:a,active:b,onToggle:c}){let d=(0,E.useTranslations)("factTypeFilter"),e=JA[a];return(0,B.jsxs)("button",{type:"button",onClick:c,className:(0,S.cn)("inline-flex items-center gap-1.5 rounded-full border px-3 py-1 text-xs font-medium transition-all",b?e.active:e.inactive),children:[(0,B.jsx)("span",{className:(0,S.cn)("h-1.5 w-1.5 rounded-full",b?e.dot:"bg-muted-foreground/50")}),d(a)]})}function JC({value:a,onChange:b,label:c}){let d=(0,E.useTranslations)("factTypeFilter"),e=c??d("defaultLabel");return(0,B.jsxs)("div",{className:"flex items-center gap-2",children:[e&&(0,B.jsx)("span",{className:"text-sm font-medium text-muted-foreground",children:e}),(0,B.jsx)("div",{className:"flex gap-1.5",children:Jz.map(c=>(0,B.jsx)(JB,{ft:c,active:a.includes(c),onToggle:()=>b(a.includes(c)?a.filter(a=>a!==c):[...a,c])},c))})]})}function JD({value:a,onChange:b}){return(0,B.jsx)("div",{className:"flex flex-wrap gap-1.5",children:Jz.map(c=>(0,B.jsx)(JB,{ft:c,active:a.includes(c),onToggle:()=>b(a.includes(c)?a.filter(a=>a!==c):[...a,c])},c))})}var JE=a.i(97063);let JF=(0,K.default)("brain",[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]]),JG=(0,K.default)("message-square",[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]]),JH=(0,K.default)("shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]),JI=(0,K.default)("play",[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]]);var JJ=a.i(6219);"function"==typeof SuppressedError&&SuppressedError;var JK=function(){var a=document.getSelection();if(!a.rangeCount)return function(){};for(var b=document.activeElement,c=[],d=0;d<a.rangeCount;d++)c.push(a.getRangeAt(d));switch(b.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":b.blur();break;default:b=null}return a.removeAllRanges(),function(){"Caret"===a.type&&a.removeAllRanges(),a.rangeCount||c.forEach(function(b){a.addRange(b)}),b&&b.focus()}},JL={"text/plain":"Text","text/html":"Url",default:"Text"},JM=function(a,b){var c,d,e,f,g,h,i,j,k=!1;b||(b={}),e=b.debug||!1;try{if(g=JK(),h=document.createRange(),i=document.getSelection(),(j=document.createElement("span")).textContent=a,j.ariaHidden="true",j.style.all="unset",j.style.position="fixed",j.style.top=0,j.style.clip="rect(0, 0, 0, 0)",j.style.whiteSpace="pre",j.style.webkitUserSelect="text",j.style.MozUserSelect="text",j.style.msUserSelect="text",j.style.userSelect="text",j.addEventListener("copy",function(c){if(c.stopPropagation(),b.format)if(c.preventDefault(),void 0===c.clipboardData){e&&console.warn("unable to use e.clipboardData"),e&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var d=JL[b.format]||JL.default;window.clipboardData.setData(d,a)}else c.clipboardData.clearData(),c.clipboardData.setData(b.format,a);b.onCopy&&(c.preventDefault(),b.onCopy(c.clipboardData))}),document.body.appendChild(j),h.selectNodeContents(j),i.addRange(h),!document.execCommand("copy"))throw Error("copy command was unsuccessful");k=!0}catch(g){e&&console.error("unable to copy using execCommand: ",g),e&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(b.format||"text",a),b.onCopy&&b.onCopy(window.clipboardData),k=!0}catch(g){e&&console.error("unable to copy using clipboardData: ",g),e&&console.error("falling back to prompt"),c="message"in b?b.message:"Copy to clipboard: #{key}, Enter",d=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C",f=c.replace(/#{\s*key\s*}/g,d),window.prompt(f,a)}}finally{i&&("function"==typeof i.removeRange?i.removeRange(h):i.removeAllRanges()),j&&document.body.removeChild(j),g()}return k};function JN(a){return"[object Object]"===Object.prototype.toString.call(a)}function JO(a){return Array.isArray(a)?a.length:JN(a)?Object.keys(a).length:0}function JP(a,b,c,d,e,f){if(f&&void 0!==f.collapsed)return!!f.collapsed;if("boolean"==typeof d)return d;if("number"==typeof d&&b>d)return!0;let g=JO(a);if("function"==typeof d){let e=JS(d,[{node:a,depth:b,indexOrName:c,size:g}]);if("boolean"==typeof e)return e}return!!(Array.isArray(a)&&g>e||JN(a)&&g>e)}function JQ(a,b,c,d,e,f){if(f&&void 0!==f.collapsed)return!!f.collapsed;if("boolean"==typeof d)return d;if("number"==typeof d&&b>d)return!0;let g=Math.ceil(a.length/100);if("function"==typeof d){let e=JS(d,[{node:a,depth:b,indexOrName:c,size:g}]);if("boolean"==typeof e)return e}return!!(Array.isArray(a)&&g>e||JN(a)&&g>e)}function JR(a,b,c){return"boolean"==typeof a?a:"number"==typeof a&&!!(b>a)||"collapsed"===a&&!!c||"expanded"===a&&!c}function JS(a,b){try{return a(...b)}catch(a){reportError(a)}}function JT(a){if(!0===a||JN(a)&&!0===a.add)return!0}function JU(a){if(!0===a||JN(a)&&!0===a.edit)return!0}function JV(a){if(!0===a||JN(a)&&!0===a.delete)return!0}function JW(a){return!a||void 0===a.add||!!a.add}function JX(a){return!a||void 0===a.edit||!!a.edit}function JY(a){return!a||void 0===a.delete||!!a.delete}function JZ(a){return!a||void 0===a.enableClipboard||!!a.enableClipboard}function J$(){return(J$=Object.assign.bind()).apply(this,arguments)}var J_=function(a){return C.createElement("svg",J$({xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"none",viewBox:"0 0 16 16"},a),l||(l=C.createElement("path",{fill:"currentColor",d:"M12.473 5.806a.666.666 0 0 0-.946 0L8.473 8.86a.667.667 0 0 1-.946 0L4.473 5.806a.667.667 0 1 0-.946.94l3.06 3.06a2 2 0 0 0 2.826 0l3.06-3.06a.667.667 0 0 0 0-.94Z"})))};function J0(){return(J0=Object.assign.bind()).apply(this,arguments)}var J1=function(a){return C.createElement("svg",J0({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},a),n||(n=C.createElement("path",{fill:"currentColor",d:"M17.542 2.5h-4.75a3.963 3.963 0 0 0-3.959 3.958v4.75a3.963 3.963 0 0 0 3.959 3.959h4.75a3.963 3.963 0 0 0 3.958-3.959v-4.75A3.963 3.963 0 0 0 17.542 2.5Zm2.375 8.708a2.378 2.378 0 0 1-2.375 2.375h-4.75a2.378 2.378 0 0 1-2.375-2.375v-4.75a2.378 2.378 0 0 1 2.375-2.375h4.75a2.378 2.378 0 0 1 2.375 2.375v4.75Zm-4.75 6.334a3.963 3.963 0 0 1-3.959 3.958h-4.75A3.963 3.963 0 0 1 2.5 17.542v-4.75a3.963 3.963 0 0 1 3.958-3.959.791.791 0 1 1 0 1.584 2.378 2.378 0 0 0-2.375 2.375v4.75a2.378 2.378 0 0 0 2.375 2.375h4.75a2.378 2.378 0 0 0 2.375-2.375.792.792 0 1 1 1.584 0Z"})))};function J2(){return(J2=Object.assign.bind()).apply(this,arguments)}var J3=function(a){return C.createElement("svg",J2({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},a),o||(o=C.createElement("path",{fill:"currentColor",d:"M17.25 3H6.75A3.755 3.755 0 0 0 3 6.75v10.5A3.754 3.754 0 0 0 6.75 21h10.5A3.754 3.754 0 0 0 21 17.25V6.75A3.755 3.755 0 0 0 17.25 3Zm2.25 14.25a2.25 2.25 0 0 1-2.25 2.25H6.75a2.25 2.25 0 0 1-2.25-2.25V6.75A2.25 2.25 0 0 1 6.75 4.5h10.5a2.25 2.25 0 0 1 2.25 2.25v10.5Z"})),p||(p=C.createElement("path",{fill:"#14C786",d:"M10.312 14.45 7.83 11.906a.625.625 0 0 0-.896 0 .659.659 0 0 0 0 .918l2.481 2.546a1.264 1.264 0 0 0 .896.381 1.237 1.237 0 0 0 .895-.38l5.858-6.011a.658.658 0 0 0 0-.919.625.625 0 0 0-.896 0l-5.857 6.01Z"})))};function J4({node:a,nodeMeta:b}){let{customizeCopy:c,CopyComponent:d,CopiedComponent:e}=(0,C.useContext)(Ko),[f,g]=(0,C.useState)(!1),h=d=>{d.stopPropagation();let e=c(a,b);"string"==typeof e&&e&&function(a){var b,c,d,e;b=this,c=void 0,d=void 0,e=function*(){try{yield navigator.clipboard.writeText(a)}catch(b){JM(a)}},new(d||(d=Promise))(function(a,f){function g(a){try{i(e.next(a))}catch(a){f(a)}}function h(a){try{i(e.throw(a))}catch(a){f(a)}}function i(b){var c;b.done?a(b.value):((c=b.value)instanceof d?c:new d(function(a){a(c)})).then(g,h)}i((e=e.apply(b,c||[])).next())})}(e),g(!0),setTimeout(()=>g(!1),3e3)};return f?"function"==typeof e?(0,B.jsx)(e,{className:"json-view--copy",style:{display:"inline-block"}}):(0,B.jsx)(J3,{className:"json-view--copy",style:{display:"inline-block"}}):"function"==typeof d?(0,B.jsx)(d,{onClick:h,className:"json-view--copy"}):(0,B.jsx)(J1,{onClick:h,className:"json-view--copy"})}function J5({indexOrName:a,value:b,depth:c,deleteHandle:d,editHandle:e,parent:f,parentPath:g}){let{displayArrayIndex:h}=(0,C.useContext)(Ko),i=Array.isArray(f);return(0,B.jsxs)("div",Object.assign({className:"json-view--pair"},{children:[!i||i&&h?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)("span",Object.assign({className:"number"==typeof a?"json-view--index":"json-view--property"},{children:a})),":"," "]}):(0,B.jsx)(B.Fragment,{}),(0,B.jsx)(Km,{node:b,depth:c+1,deleteHandle:(a,b)=>d(a,b),editHandle:(a,b,c,d)=>e(a,b,c,d),parent:f,indexOrName:a,parentPath:g})]}))}function J6(){return(J6=Object.assign.bind()).apply(this,arguments)}var J7=function(a){return C.createElement("svg",J6({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},a),q||(q=C.createElement("path",{fill:"currentColor",d:"M18.75 6h-2.325a3.757 3.757 0 0 0-3.675-3h-1.5a3.757 3.757 0 0 0-3.675 3H5.25a.75.75 0 0 0 0 1.5H6v9.75A3.754 3.754 0 0 0 9.75 21h4.5A3.754 3.754 0 0 0 18 17.25V7.5h.75a.75.75 0 1 0 0-1.5Zm-7.5-1.5h1.5A2.255 2.255 0 0 1 14.872 6H9.128a2.255 2.255 0 0 1 2.122-1.5Zm5.25 12.75a2.25 2.25 0 0 1-2.25 2.25h-4.5a2.25 2.25 0 0 1-2.25-2.25V7.5h9v9.75Z"})),r||(r=C.createElement("path",{fill:"#DA0000",d:"M10.5 16.5a.75.75 0 0 0 .75-.75v-4.5a.75.75 0 1 0-1.5 0v4.5a.75.75 0 0 0 .75.75ZM13.5 16.5a.75.75 0 0 0 .75-.75v-4.5a.75.75 0 1 0-1.5 0v4.5a.75.75 0 0 0 .75.75Z"})))};function J8(){return(J8=Object.assign.bind()).apply(this,arguments)}var J9=function(a){return C.createElement("svg",J8({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},a),s||(s=C.createElement("path",{fill:"currentColor",d:"M21 6.75v10.5A3.754 3.754 0 0 1 17.25 21H6.75A3.754 3.754 0 0 1 3 17.25V6.75A3.754 3.754 0 0 1 6.75 3h10.5A3.754 3.754 0 0 1 21 6.75Zm-1.5 0c0-1.24-1.01-2.25-2.25-2.25H6.75C5.51 4.5 4.5 5.51 4.5 6.75v10.5c0 1.24 1.01 2.25 2.25 2.25h10.5c1.24 0 2.25-1.01 2.25-2.25V6.75Z"})),t||(t=C.createElement("path",{fill:"#14C786",d:"M15 12.75a.75.75 0 1 0 0-1.5h-2.25V9a.75.75 0 1 0-1.5 0v2.25H9a.75.75 0 1 0 0 1.5h2.25V15a.75.75 0 1 0 1.5 0v-2.25H15Z"})))};function Ka(){return(Ka=Object.assign.bind()).apply(this,arguments)}var Kb=function(a){return C.createElement("svg",Ka({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},a),u||(u=C.createElement("path",{fill:"currentColor",d:"M12 3a9 9 0 1 0 9 9 9.01 9.01 0 0 0-9-9Zm0 16.5a7.5 7.5 0 1 1 7.5-7.5 7.509 7.509 0 0 1-7.5 7.5Z"})),v||(v=C.createElement("path",{fill:"#14C786",d:"m10.85 13.96-1.986-2.036a.5.5 0 0 0-.716 0 .527.527 0 0 0 0 .735l1.985 2.036a1.01 1.01 0 0 0 .717.305.99.99 0 0 0 .716-.305l4.686-4.808a.526.526 0 0 0 0-.735.5.5 0 0 0-.716 0l-4.687 4.809Z"})))};function Kc(){return(Kc=Object.assign.bind()).apply(this,arguments)}var Kd=function(a){return C.createElement("svg",Kc({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},a),w||(w=C.createElement("path",{fill:"#DA0000",d:"M15 9a.75.75 0 0 0-1.06 0L12 10.94 10.06 9A.75.75 0 0 0 9 10.06L10.94 12 9 13.94A.75.75 0 0 0 10.06 15L12 13.06 13.94 15A.75.75 0 0 0 15 13.94L13.06 12 15 10.06A.75.75 0 0 0 15 9Z"})),x||(x=C.createElement("path",{fill:"currentColor",d:"M12 3a9 9 0 1 0 9 9 9.01 9.01 0 0 0-9-9Zm0 16.5a7.5 7.5 0 1 1 7.5-7.5 7.509 7.509 0 0 1-7.5 7.5Z"})))};function Ke({originNode:a,node:b,depth:c,index:d,deleteHandle:e,customOptions:f,startIndex:g,parent:h,parentPath:i}){let{enableClipboard:j,src:k,onEdit:l,onChange:n,forceUpdate:o,displaySize:p,CustomOperation:q}=(0,C.useContext)(Ko),r=[...i,String(d)],[s,t]=(0,C.useState)(!0),u=(0,C.useCallback)((b,d,e)=>{a[b]=d,l&&l({newValue:d,oldValue:e,depth:c,src:k,indexOrName:b,parentType:"array",parentPath:i}),n&&n({type:"edit",depth:c,src:k,indexOrName:b,parentType:"array",parentPath:i}),o()},[b,l,n,o]),v=b=>{a.splice(b,1),e&&e(b,i),o()},w=(0,B.jsxs)(B.Fragment,{children:[!s&&(0,B.jsxs)("span",Object.assign({onClick:()=>t(!0),className:"jv-size-chevron"},{children:[JR(p,c,s)&&(0,B.jsxs)("span",Object.assign({className:"jv-size"},{children:[JO(b)," Items"]})),(0,B.jsx)(J_,{className:"jv-chevron"})]})),!s&&j&&JZ(f)&&(0,B.jsx)(J4,{node:b,nodeMeta:{depth:c,indexOrName:d,parent:h,parentPath:i,currentPath:r}}),"function"==typeof q?(0,B.jsx)(q,{node:b}):null]});return(0,B.jsxs)("div",{children:[(0,B.jsx)("span",{children:"["}),w,s?(0,B.jsxs)("button",Object.assign({onClick:()=>t(!1),className:"jv-button"},{children:[g," ... ",g+b.length-1]})):(0,B.jsx)("div",Object.assign({className:"jv-indent"},{children:b.map((a,e)=>(0,B.jsx)(J5,{indexOrName:e+g,value:a,depth:c,parent:b,deleteHandle:v,editHandle:u,parentPath:i},String(d)+String(e)))})),(0,B.jsx)("span",{children:"]"})]})}function Kf({node:a,depth:b,deleteHandle:c,indexOrName:d,customOptions:e,parent:f,parentPath:g}){let h=void 0!==d?[...g,String(d)]:g,i=[];for(let b=0;b<a.length;b+=100)i.push(a.slice(b,b+100));let{collapsed:j,enableClipboard:k,collapseObjectsAfterLength:l,editable:n,onDelete:o,src:p,onAdd:q,CustomOperation:r,onChange:s,forceUpdate:t,displaySize:u}=(0,C.useContext)(Ko),[v,w]=(0,C.useState)(JQ(a,b,d,j,l,e));(0,C.useEffect)(()=>{w(JQ(a,b,d,j,l,e))},[j,l]);let[x,y]=(0,C.useState)(!1),[z,A]=(0,C.useState)(!1),D=()=>{a.push(null),q&&q({indexOrName:a.length-1,depth:b,src:p,parentType:"array",parentPath:g}),s&&s({type:"add",indexOrName:a.length-1,depth:b,src:p,parentType:"array",parentPath:g}),t()},E=x||z,F=(0,B.jsxs)(B.Fragment,{children:[!v&&!E&&(0,B.jsxs)("span",Object.assign({onClick:()=>w(!0),className:"jv-size-chevron"},{children:[JR(u,b,v)&&(0,B.jsxs)("span",Object.assign({className:"jv-size"},{children:[a.length," Items"]})),(0,B.jsx)(J_,{className:"jv-chevron"})]})),E&&(0,B.jsx)(Kb,{className:"json-view--edit",style:{display:"inline-block"},onClick:z?D:()=>{y(!1),c&&c(d,g),o&&o({value:a,depth:b,src:p,indexOrName:d,parentType:"array",parentPath:g}),s&&s({type:"delete",depth:b,src:p,indexOrName:d,parentType:"array",parentPath:g})}}),E&&(0,B.jsx)(Kd,{className:"json-view--edit",style:{display:"inline-block"},onClick:()=>{y(!1),A(!1)}}),!v&&!E&&k&&JZ(e)&&(0,B.jsx)(J4,{node:a,nodeMeta:{depth:b,indexOrName:d,parent:f,parentPath:g,currentPath:h}}),!v&&!E&&JT(n)&&JW(e)&&(0,B.jsx)(J9,{className:"json-view--edit",onClick:()=>{D()}}),!v&&!E&&JV(n)&&JY(e)&&c&&(0,B.jsx)(J7,{className:"json-view--edit",onClick:()=>y(!0)}),"function"==typeof r?(0,B.jsx)(r,{node:a}):null]});return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)("span",{children:"["}),F,v?(0,B.jsx)("button",Object.assign({onClick:()=>w(!1),className:"jv-button"},{children:"..."})):(0,B.jsx)("div",Object.assign({className:"jv-indent"},{children:i.map((f,h)=>(0,B.jsx)(Ke,{originNode:a,node:f,depth:b,index:h,startIndex:100*h,deleteHandle:c,customOptions:e,parentPath:g},String(d)+String(h)))})),(0,B.jsx)("span",{children:"]"}),v&&JR(u,b,v)&&(0,B.jsxs)("span",Object.assign({onClick:()=>w(!1),className:"jv-size"},{children:[a.length," Items"]}))]})}function Kg({node:a,depth:b,indexOrName:c,deleteHandle:d,customOptions:e,parent:f,parentPath:g}){let{collapsed:h,onCollapse:i,enableClipboard:j,ignoreLargeArray:k,collapseObjectsAfterLength:l,editable:n,onDelete:o,src:p,onAdd:q,onEdit:r,onChange:s,forceUpdate:t,displaySize:u,CustomOperation:v}=(0,C.useContext)(Ko),w=void 0!==c?[...g,String(c)]:g;if(!k&&Array.isArray(a)&&a.length>100)return(0,B.jsx)(Kf,{node:a,depth:b,indexOrName:c,deleteHandle:d,customOptions:e,parentPath:w});let x=JN(a),[y,z]=(0,C.useState)(JP(a,b,c,h,l,e)),A=d=>{null==i||i({isCollapsing:!d,node:a,depth:b,indexOrName:c}),z(d)};(0,C.useEffect)(()=>{A(JP(a,b,c,h,l,e))},[h,l]);let D=(0,C.useCallback)((c,d,e)=>{Array.isArray(a)?a[+c]=d:a&&(a[c]=d),r&&r({newValue:d,oldValue:e,depth:b,src:p,indexOrName:c,parentType:x?"object":"array",parentPath:w}),s&&s({type:"edit",depth:b,src:p,indexOrName:c,parentType:x?"object":"array",parentPath:w}),t()},[a,r,s,t]),E=b=>{Array.isArray(a)?a.splice(+b,1):a&&delete a[b],t()},[F,G]=(0,C.useState)(!1),[H,I]=(0,C.useState)(!1),J=(0,C.useRef)(null),K=()=>{var c;if(x){let d=null==(c=J.current)?void 0:c.value;d&&(a[d]=null,J.current&&(J.current.value=""),I(!1),q&&q({indexOrName:d,depth:b,src:p,parentType:"object",parentPath:w}),s&&s({type:"add",indexOrName:d,depth:b,src:p,parentType:"object",parentPath:w}))}else Array.isArray(a)&&(a.push(null),q&&q({indexOrName:a.length-1,depth:b,src:p,parentType:"array",parentPath:w}),s&&s({type:"add",indexOrName:a.length-1,depth:b,src:p,parentType:"array",parentPath:w}));t()},L=F||H,M=()=>{G(!1),I(!1)},N=(0,B.jsxs)(B.Fragment,{children:[!y&&!L&&(0,B.jsxs)("span",Object.assign({onClick:()=>A(!0),className:"jv-size-chevron"},{children:[JR(u,b,y)&&(0,B.jsxs)("span",Object.assign({className:"jv-size"},{children:[JO(a)," Items"]})),(0,B.jsx)(J_,{className:"jv-chevron"})]})),H&&x&&(0,B.jsx)("input",{className:"json-view--input",placeholder:"property",ref:J,onKeyDown:a=>{"Enter"===a.key?(a.preventDefault(),K()):"Escape"===a.key&&M()}}),L&&(0,B.jsx)(Kb,{className:"json-view--edit",style:{display:"inline-block"},onClick:H?K:()=>{G(!1),d&&d(c,w),o&&o({value:a,depth:b,src:p,indexOrName:c,parentType:x?"object":"array",parentPath:w}),s&&s({type:"delete",depth:b,src:p,indexOrName:c,parentType:x?"object":"array",parentPath:w})}}),L&&(0,B.jsx)(Kd,{className:"json-view--edit",style:{display:"inline-block"},onClick:M}),!y&&!L&&j&&JZ(e)&&(0,B.jsx)(J4,{node:a,nodeMeta:{depth:b,indexOrName:c,parent:f,parentPath:g,currentPath:w}}),!y&&!L&&JT(n)&&JW(e)&&(0,B.jsx)(J9,{className:"json-view--edit",onClick:()=>{x?(I(!0),setTimeout(()=>{var a;return null==(a=J.current)?void 0:a.focus()})):K()}}),!y&&!L&&JV(n)&&JY(e)&&d&&(0,B.jsx)(J7,{className:"json-view--edit",onClick:()=>G(!0)}),"function"==typeof v?(0,B.jsx)(v,{node:a}):null]});return Array.isArray(a)?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)("span",{children:"["}),N,y?(0,B.jsx)("button",Object.assign({onClick:()=>A(!1),className:"jv-button"},{children:"..."})):(0,B.jsx)("div",Object.assign({className:"jv-indent"},{children:a.map((d,e)=>(0,B.jsx)(J5,{indexOrName:e,value:d,depth:b,parent:a,deleteHandle:E,editHandle:D,parentPath:w},String(c)+String(e)))})),(0,B.jsx)("span",{children:"]"}),y&&JR(u,b,y)&&(0,B.jsxs)("span",Object.assign({onClick:()=>A(!1),className:"jv-size"},{children:[JO(a)," Items"]}))]}):x?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)("span",{children:"{"}),N,y?(0,B.jsx)("button",Object.assign({onClick:()=>A(!1),className:"jv-button"},{children:"..."})):(0,B.jsx)("div",Object.assign({className:"jv-indent"},{children:Object.entries(a).map(([d,e])=>(0,B.jsx)(J5,{indexOrName:d,value:e,depth:b,parent:a,deleteHandle:E,editHandle:D,parentPath:w},String(c)+String(d)))})),(0,B.jsx)("span",{children:"}"}),y&&JR(u,b,y)&&(0,B.jsxs)("span",Object.assign({onClick:()=>A(!1),className:"jv-size"},{children:[JO(a)," Items"]}))]}):(0,B.jsx)("span",{children:String(a)})}let Kh=C.default.forwardRef(({str:a,className:b,ctrlClick:c},d)=>{let{collapseStringMode:e,collapseStringsAfterLength:f,customizeCollapseStringUI:g}=(0,C.useContext)(Ko),[h,i]=(0,C.useState)(!0),j=(0,C.useRef)(null);f=f>0?f:0;let k=a.replace(/\s+/g," "),l="function"==typeof g?g(k,h):"string"==typeof g?g:"...",n=a=>{var b;if((a.ctrlKey||a.metaKey)&&c)c(a);else{let a=window.getSelection();if(a&&a.anchorOffset!==a.focusOffset&&(null==(b=a.anchorNode)?void 0:b.parentElement)===j.current)return;i(!h)}};if(a.length<=f)return(0,B.jsxs)("span",Object.assign({ref:j,className:b,onClick:c},{children:['"',a,'"']}));if("address"===e)return a.length<=10?(0,B.jsxs)("span",Object.assign({ref:j,className:b,onClick:c},{children:['"',a,'"']})):(0,B.jsxs)("span",Object.assign({ref:j,onClick:n,className:b+" cursor-pointer"},{children:['"',h?[k.slice(0,6),l,k.slice(-4)]:a,'"']}));if("directly"===e)return(0,B.jsxs)("span",Object.assign({ref:j,onClick:n,className:b+" cursor-pointer"},{children:['"',h?[k.slice(0,f),l]:a,'"']}));if("word"===e){let c=f,d=f+1,e=k,g=1;for(;;){if(/\W/.test(a[c])){e=a.slice(0,c);break}if(/\W/.test(a[d])){e=a.slice(0,d);break}if(6===g){e=a.slice(0,f);break}g++,c--,d++}return(0,B.jsxs)("span",Object.assign({ref:j,onClick:n,className:b+" cursor-pointer"},{children:['"',h?[e,l]:a,'"']}))}return(0,B.jsxs)("span",Object.assign({ref:j,className:b},{children:['"',a,'"']}))});function Ki(){return(Ki=Object.assign.bind()).apply(this,arguments)}var Kj=function(a){return C.createElement("svg",Ki({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},a),y||(y=C.createElement("path",{fill:"currentColor",d:"M17.25 3H6.75A3.754 3.754 0 0 0 3 6.75v10.5A3.754 3.754 0 0 0 6.75 21h10.5A3.754 3.754 0 0 0 21 17.25V6.75A3.754 3.754 0 0 0 17.25 3Zm2.25 14.25c0 1.24-1.01 2.25-2.25 2.25H6.75c-1.24 0-2.25-1.01-2.25-2.25V6.75c0-1.24 1.01-2.25 2.25-2.25h10.5c1.24 0 2.25 1.01 2.25 2.25v10.5Zm-6.09-9.466-5.031 5.03a2.981 2.981 0 0 0-.879 2.121v1.19c0 .415.336.75.75.75h1.19c.8 0 1.554-.312 2.12-.879l5.03-5.03a2.252 2.252 0 0 0 0-3.182c-.85-.85-2.331-.85-3.18 0Zm-2.91 7.151c-.28.28-.666.44-1.06.44H9v-.44c0-.4.156-.777.44-1.06l3.187-3.188 1.06 1.061-3.187 3.188Zm5.03-5.03-.782.783-1.06-1.061.782-.782a.766.766 0 0 1 1.06 0 .75.75 0 0 1 0 1.06Z"})))};function Kk(){return(Kk=Object.assign.bind()).apply(this,arguments)}var Kl=function(a){return C.createElement("svg",Kk({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},a),z||(z=C.createElement("path",{fill:"currentColor",d:"M6.75 3h5.5v1.5h-5.5C5.51 4.5 4.5 5.51 4.5 6.75v10.5c0 1.24 1.01 2.25 2.25 2.25h10.5c1.24 0 2.25-1.01 2.25-2.25v-5.5H21v5.5A3.754 3.754 0 0 1 17.25 21H6.75A3.754 3.754 0 0 1 3 17.25V6.75A3.754 3.754 0 0 1 6.75 3Z"})),A||(A=C.createElement("path",{fill:"currentColor",d:"M20.013 3h-3.946a.987.987 0 0 0 0 1.973h1.564l-6.342 6.342a1.004 1.004 0 0 0 0 1.396 1.004 1.004 0 0 0 1.396 0l6.342-6.342v1.564a.987.987 0 0 0 1.973 0V3.987A.987.987 0 0 0 20.013 3Z"})))};function Km({node:a,depth:b,deleteHandle:c,indexOrName:d,parent:e,editHandle:f,parentPath:g}){let h,{collapseStringsAfterLength:i,enableClipboard:j,editable:k,src:l,onDelete:n,onChange:o,customizeNode:p,matchesURL:q,urlRegExp:r,EditComponent:s,DoneComponent:t,CancelComponent:u,CustomOperation:v}=(0,C.useContext)(Ko);if("function"==typeof p&&(h=JS(p,[{node:a,depth:b,indexOrName:d}])),h){if((0,C.isValidElement)(h))return h;else if("function"==typeof h){let c=h;return(0,B.jsx)(c,{node:a,depth:b,indexOrName:d})}}if(Array.isArray(a)||JN(a))return(0,B.jsx)(Kg,{parent:e,node:a,depth:b,indexOrName:d,deleteHandle:c,parentPath:g,customOptions:"object"==typeof h?h:void 0});{var w;let p=typeof a,x=void 0!==d?[...g,String(d)]:g,[y,z]=(0,C.useState)(!1),[A,D]=(0,C.useState)(!1),E=(0,C.useRef)(null),F=()=>{z(!0),setTimeout(()=>{var a,b;null==(a=window.getSelection())||a.selectAllChildren(E.current),null==(b=E.current)||b.focus()})},G=(0,C.useCallback)(()=>{let b=E.current.innerText;try{let c=JSON.parse(b);f&&f(d,c,a,g)}catch(e){let c="string"===p?b.trim().replace(/^\"([\s\S]+?)\"$/,"$1"):b;f&&f(d,c,a,g)}z(!1)},[f,d,a,g,p]),H=()=>{z(!1),D(!1)},I=()=>{D(!1),c&&c(d,g),n&&n({value:a,depth:b,src:l,indexOrName:d,parentType:Array.isArray(e)?"array":"object",parentPath:g}),o&&o({depth:b,src:l,indexOrName:d,parentType:Array.isArray(e)?"array":"object",type:"delete",parentPath:g})},J=(0,C.useCallback)(a=>{"Enter"===a.key?(a.preventDefault(),G()):"Escape"===a.key&&H()},[G]),K=y||A,L=!K&&JU(k)&&JX(h)&&f?a=>{(a.ctrlKey||a.metaKey)&&F()}:void 0,M=(0,B.jsxs)(B.Fragment,{children:[K&&("function"==typeof t?(0,B.jsx)(t,{className:"json-view--edit",style:{display:"inline-block"},onClick:A?I:G}):(0,B.jsx)(Kb,{className:"json-view--edit",style:{display:"inline-block"},onClick:A?I:G})),K&&("function"==typeof u?(0,B.jsx)(u,{className:"json-view--edit",style:{display:"inline-block"},onClick:H}):(0,B.jsx)(Kd,{className:"json-view--edit",style:{display:"inline-block"},onClick:H})),!K&&j&&JZ(h)&&(0,B.jsx)(J4,{node:a,nodeMeta:{depth:b,indexOrName:d,parent:e,parentPath:g,currentPath:x}}),!K&&q&&"string"===p&&r.test(a)&&(!(w=h)||void 0===w.matchesURL||!!w.matchesURL)&&(0,B.jsx)("a",Object.assign({href:a,target:"_blank",className:"json-view--link"},{children:(0,B.jsx)(Kl,{})})),!K&&JU(k)&&JX(h)&&f&&("function"==typeof s?(0,B.jsx)(s,{className:"json-view--edit",onClick:F}):(0,B.jsx)(Kj,{className:"json-view--edit",onClick:F})),!K&&JV(k)&&JY(h)&&c&&(0,B.jsx)(J7,{className:"json-view--edit",onClick:()=>D(!0)}),"function"==typeof v?(0,B.jsx)(v,{node:a}):null]}),N="json-view--string";switch(p){case"number":case"bigint":N="json-view--number";break;case"boolean":N="json-view--boolean";break;case"object":N="json-view--null"}"string"==typeof(null==h?void 0:h.className)&&(N+=" "+h.className),A&&(N+=" json-view--deleting");let O=String(a);"bigint"===p&&(O+="n");let P=(0,C.useMemo)(()=>(0,B.jsx)("span",{contentEditable:!0,className:N,dangerouslySetInnerHTML:{__html:"string"===p?`"${O}"`:O},ref:E,onKeyDown:J}),[O,p,J]);return"string"===p?(0,B.jsxs)(B.Fragment,{children:[y?P:a.length>i?(0,B.jsx)(Kh,{str:a,ref:E,className:N,ctrlClick:L}):(0,B.jsxs)("span",Object.assign({className:N,onClick:L},{children:['"',O,'"']})),M]}):(0,B.jsxs)(B.Fragment,{children:[y?P:(0,B.jsx)("span",Object.assign({className:N,onClick:L},{children:O})),M]})}}let Kn=/^(((ht|f)tps?):\/\/)?([^!@#$%^&*?.\s-]([^!@#$%^&*?.\s]{0,63}[^!@#$%^&*?.\s])?\.)+[a-z]{2,6}\/?/,Ko=(0,C.createContext)({src:void 0,collapseStringsAfterLength:99,collapseStringMode:"directly",customizeCollapseStringUI:void 0,collapseObjectsAfterLength:20,collapsed:!1,onCollapse:void 0,enableClipboard:!0,editable:!1,onEdit:void 0,onDelete:void 0,onAdd:void 0,onChange:void 0,forceUpdate:()=>{},customizeNode:void 0,customizeCopy:()=>{},displaySize:void 0,displayArrayIndex:!0,matchesURL:!1,urlRegExp:Kn,ignoreLargeArray:!1,CopyComponent:void 0,CopiedComponent:void 0,EditComponent:void 0,CancelComponent:void 0,DoneComponent:void 0,CustomOperation:void 0});function Kp({src:a,collapseStringsAfterLength:b=99,collapseStringMode:c="directly",customizeCollapseStringUI:d,collapseObjectsAfterLength:e=99,collapsed:f,onCollapse:g,enableClipboard:h=!0,editable:i=!1,onEdit:j,onDelete:k,onAdd:l,onChange:n,dark:o=!1,theme:p="default",customizeNode:q,customizeCopy:r=a=>(function(a){if("string"==typeof a)return a;try{return JSON.stringify(a,(a,b)=>{switch(typeof b){case"bigint":return String(b)+"n";case"number":case"boolean":case"object":case"string":return b;default:return String(b)}},void 0)}catch(a){return`${a.name}: ${a.message}`||"JSON.stringify failed"}})(a),displaySize:s,displayArrayIndex:t=!0,style:u,className:v,matchesURL:w=!1,urlRegExp:x=Kn,ignoreLargeArray:y=!1,CopyComponent:z,CopiedComponent:A,EditComponent:D,CancelComponent:E,DoneComponent:F,CustomOperation:G}){let[H,I]=(0,C.useState)(0),J=(0,C.useCallback)(()=>I(a=>++a),[]),[K,L]=(0,C.useState)(a);return(0,C.useEffect)(()=>L(a),[a]),(0,B.jsx)(Ko.Provider,Object.assign({value:{src:K,collapseStringsAfterLength:b,collapseStringMode:c,customizeCollapseStringUI:d,collapseObjectsAfterLength:e,collapsed:f,onCollapse:g,enableClipboard:h,editable:i,onEdit:j,onDelete:k,onAdd:l,onChange:n,forceUpdate:J,customizeNode:q,customizeCopy:r,displaySize:s,displayArrayIndex:t,matchesURL:w,urlRegExp:x,ignoreLargeArray:y,CopyComponent:z,CopiedComponent:A,EditComponent:D,CancelComponent:E,DoneComponent:F,CustomOperation:G}},{children:(0,B.jsx)("code",Object.assign({className:"json-view"+(o?" dark":"")+(p&&"default"!==p?" json-view_"+p:"")+(v?" "+v:""),style:u},{children:(0,B.jsx)(Km,{node:K,depth:1,editHandle:(a,b,c,d)=>{L(b),j&&j({newValue:b,oldValue:c,depth:1,src:K,indexOrName:a,parentType:null,parentPath:d}),n&&n({type:"edit",depth:1,src:K,indexOrName:a,parentType:null,parentPath:d})},deleteHandle:(a,b)=>{L(void 0),k&&k({value:K,depth:1,src:K,indexOrName:a,parentType:null,parentPath:b}),n&&n({depth:1,src:K,indexOrName:a,parentType:null,type:"delete",parentPath:b})},parentPath:[]})}))}))}var bc=bc;let Kq=(0,K.default)("zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]),Kr=(0,K.default)("eraser",[["path",{d:"M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21",key:"g5wo59"}],["path",{d:"m5.082 11.09 8.828 8.828",key:"1wx5vj"}]]);function Ks(){}function Kt(){}let Ku=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Kv=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Kw={};function Kx(a,b){return((b||Kw).jsx?Kv:Ku).test(a)}let Ky=/[ \t\n\f\r]/g;function Kz(a){return""===a.replace(Ky,"")}class KA{constructor(a,b){this.attribute=b,this.property=a}}KA.prototype.attribute="",KA.prototype.booleanish=!1,KA.prototype.boolean=!1,KA.prototype.commaOrSpaceSeparated=!1,KA.prototype.commaSeparated=!1,KA.prototype.defined=!1,KA.prototype.mustUseProperty=!1,KA.prototype.number=!1,KA.prototype.overloadedBoolean=!1,KA.prototype.property="",KA.prototype.spaceSeparated=!1,KA.prototype.space=void 0;let KB=0,KC=KJ(),KD=KJ(),KE=KJ(),KF=KJ(),KG=KJ(),KH=KJ(),KI=KJ();function KJ(){return 2**++KB}a.s(["boolean",0,KC,"booleanish",0,KD,"commaOrSpaceSeparated",0,KI,"commaSeparated",0,KH,"number",0,KF,"overloadedBoolean",0,KE,"spaceSeparated",0,KG],53427);var KK=a.i(53427);let KL=Object.keys(KK);class KM extends KA{constructor(a,b,c,d){let e=-1;if(super(a,b),function(a,b,c){c&&(a[b]=c)}(this,"space",d),"number"==typeof c)for(;++e<KL.length;){const a=KL[e];!function(a,b,c){c&&(a[b]=c)}(this,KL[e],(c&KK[a])===KK[a])}}}function KN(a){return a.toLowerCase()}KM.prototype.defined=!0;let KO=/[A-Z]/g,KP=/-[a-z]/g,KQ=/^data[-\w.:]+$/i;function KR(a){return"-"+a.toLowerCase()}function KS(a){return a.charAt(1).toUpperCase()}let KT={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"};class KU{constructor(a,b,c){this.normal=b,this.property=a,c&&(this.space=c)}}function KV(a,b){let c={},d={};for(let b of a)Object.assign(c,b.property),Object.assign(d,b.normal);return new KU(c,d,b)}function KW(a){let b={},c={};for(let[d,e]of Object.entries(a.properties)){let f=new KM(d,a.transform(a.attributes||{},d),e,a.space);a.mustUseProperty&&a.mustUseProperty.includes(d)&&(f.mustUseProperty=!0),b[d]=f,c[KN(d)]=d,c[KN(f.attribute)]=d}return new KU(b,c,a.space)}KU.prototype.normal={},KU.prototype.property={},KU.prototype.space=void 0;let KX=KW({properties:{ariaActiveDescendant:null,ariaAtomic:KD,ariaAutoComplete:null,ariaBusy:KD,ariaChecked:KD,ariaColCount:KF,ariaColIndex:KF,ariaColSpan:KF,ariaControls:KG,ariaCurrent:null,ariaDescribedBy:KG,ariaDetails:null,ariaDisabled:KD,ariaDropEffect:KG,ariaErrorMessage:null,ariaExpanded:KD,ariaFlowTo:KG,ariaGrabbed:KD,ariaHasPopup:null,ariaHidden:KD,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:KG,ariaLevel:KF,ariaLive:null,ariaModal:KD,ariaMultiLine:KD,ariaMultiSelectable:KD,ariaOrientation:null,ariaOwns:KG,ariaPlaceholder:null,ariaPosInSet:KF,ariaPressed:KD,ariaReadOnly:KD,ariaRelevant:null,ariaRequired:KD,ariaRoleDescription:KG,ariaRowCount:KF,ariaRowIndex:KF,ariaRowSpan:KF,ariaSelected:KD,ariaSetSize:KF,ariaSort:null,ariaValueMax:KF,ariaValueMin:KF,ariaValueNow:KF,ariaValueText:null,role:null},transform:(a,b)=>"role"===b?b:"aria-"+b.slice(4).toLowerCase()});function KY(a,b){return b in a?a[b]:b}function KZ(a,b){return KY(a,b.toLowerCase())}let K$=KW({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:KH,acceptCharset:KG,accessKey:KG,action:null,allow:null,allowFullScreen:KC,allowPaymentRequest:KC,allowUserMedia:KC,alt:null,as:null,async:KC,autoCapitalize:null,autoComplete:KG,autoFocus:KC,autoPlay:KC,blocking:KG,capture:null,charSet:null,checked:KC,cite:null,className:KG,cols:KF,colSpan:null,content:null,contentEditable:KD,controls:KC,controlsList:KG,coords:KF|KH,crossOrigin:null,data:null,dateTime:null,decoding:null,default:KC,defer:KC,dir:null,dirName:null,disabled:KC,download:KE,draggable:KD,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:KC,formTarget:null,headers:KG,height:KF,hidden:KE,high:KF,href:null,hrefLang:null,htmlFor:KG,httpEquiv:KG,id:null,imageSizes:null,imageSrcSet:null,inert:KC,inputMode:null,integrity:null,is:null,isMap:KC,itemId:null,itemProp:KG,itemRef:KG,itemScope:KC,itemType:KG,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:KC,low:KF,manifest:null,max:null,maxLength:KF,media:null,method:null,min:null,minLength:KF,multiple:KC,muted:KC,name:null,nonce:null,noModule:KC,noValidate:KC,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:KC,optimum:KF,pattern:null,ping:KG,placeholder:null,playsInline:KC,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:KC,referrerPolicy:null,rel:KG,required:KC,reversed:KC,rows:KF,rowSpan:KF,sandbox:KG,scope:null,scoped:KC,seamless:KC,selected:KC,shadowRootClonable:KC,shadowRootDelegatesFocus:KC,shadowRootMode:null,shape:null,size:KF,sizes:null,slot:null,span:KF,spellCheck:KD,src:null,srcDoc:null,srcLang:null,srcSet:null,start:KF,step:null,style:null,tabIndex:KF,target:null,title:null,translate:null,type:null,typeMustMatch:KC,useMap:null,value:KD,width:KF,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:KG,axis:null,background:null,bgColor:null,border:KF,borderColor:null,bottomMargin:KF,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:KC,declare:KC,event:null,face:null,frame:null,frameBorder:null,hSpace:KF,leftMargin:KF,link:null,longDesc:null,lowSrc:null,marginHeight:KF,marginWidth:KF,noResize:KC,noHref:KC,noShade:KC,noWrap:KC,object:null,profile:null,prompt:null,rev:null,rightMargin:KF,rules:null,scheme:null,scrolling:KD,standby:null,summary:null,text:null,topMargin:KF,valueType:null,version:null,vAlign:null,vLink:null,vSpace:KF,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:KC,disableRemotePlayback:KC,prefix:null,property:null,results:KF,security:null,unselectable:null},space:"html",transform:KZ}),K_=KW({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:KI,accentHeight:KF,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:KF,amplitude:KF,arabicForm:null,ascent:KF,attributeName:null,attributeType:null,azimuth:KF,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:KF,by:null,calcMode:null,capHeight:KF,className:KG,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:KF,diffuseConstant:KF,direction:null,display:null,dur:null,divisor:KF,dominantBaseline:null,download:KC,dx:null,dy:null,edgeMode:null,editable:null,elevation:KF,enableBackground:null,end:null,event:null,exponent:KF,externalResourcesRequired:null,fill:null,fillOpacity:KF,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:KH,g2:KH,glyphName:KH,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:KF,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:KF,horizOriginX:KF,horizOriginY:KF,id:null,ideographic:KF,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:KF,k:KF,k1:KF,k2:KF,k3:KF,k4:KF,kernelMatrix:KI,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:KF,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:KF,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:KF,overlineThickness:KF,paintOrder:null,panose1:null,path:null,pathLength:KF,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:KG,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:KF,pointsAtY:KF,pointsAtZ:KF,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:KI,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:KI,rev:KI,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:KI,requiredFeatures:KI,requiredFonts:KI,requiredFormats:KI,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:KF,specularExponent:KF,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:KF,strikethroughThickness:KF,string:null,stroke:null,strokeDashArray:KI,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:KF,strokeOpacity:KF,strokeWidth:null,style:null,surfaceScale:KF,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:KI,tabIndex:KF,tableValues:null,target:null,targetX:KF,targetY:KF,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:KI,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:KF,underlineThickness:KF,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:KF,values:null,vAlphabetic:KF,vMathematical:KF,vectorEffect:null,vHanging:KF,vIdeographic:KF,version:null,vertAdvY:KF,vertOriginX:KF,vertOriginY:KF,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:KF,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:KY}),K0=KW({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform:(a,b)=>"xlink:"+b.slice(5).toLowerCase()}),K1=KW({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:KZ}),K2=KW({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform:(a,b)=>"xml:"+b.slice(3).toLowerCase()}),K3=KV([KX,K$,K0,K1,K2],"html"),K4=KV([KX,K_,K0,K1,K2],"svg");var K5=a.i(52540);let K6=K8("end"),K7=K8("start");function K8(a){return function(b){let c=b&&b.position&&b.position[a]||{};if("number"==typeof c.line&&c.line>0&&"number"==typeof c.column&&c.column>0)return{line:c.line,column:c.column,offset:"number"==typeof c.offset&&c.offset>-1?c.offset:void 0}}}function K9(a){return a&&"object"==typeof a?"position"in a||"type"in a?Lb(a.position):"start"in a||"end"in a?Lb(a):"line"in a||"column"in a?La(a):"":""}function La(a){return Lc(a&&a.line)+":"+Lc(a&&a.column)}function Lb(a){return La(a&&a.start)+"-"+La(a&&a.end)}function Lc(a){return a&&"number"==typeof a?a:1}class Ld extends Error{constructor(a,b,c){super(),"string"==typeof b&&(c=b,b=void 0);let d="",e={},f=!1;if(b&&(e="line"in b&&"column"in b||"start"in b&&"end"in b?{place:b}:"type"in b?{ancestors:[b],place:b.position}:{...b}),"string"==typeof a?d=a:!e.cause&&a&&(f=!0,d=a.message,e.cause=a),!e.ruleId&&!e.source&&"string"==typeof c){const a=c.indexOf(":");-1===a?e.ruleId=c:(e.source=c.slice(0,a),e.ruleId=c.slice(a+1))}if(!e.place&&e.ancestors&&e.ancestors){const a=e.ancestors[e.ancestors.length-1];a&&(e.place=a.position)}const g=e.place&&"start"in e.place?e.place.start:e.place;this.ancestors=e.ancestors||void 0,this.cause=e.cause||void 0,this.column=g?g.column:void 0,this.fatal=void 0,this.file="",this.message=d,this.line=g?g.line:void 0,this.name=K9(e.place)||"1:1",this.place=e.place||void 0,this.reason=this.message,this.ruleId=e.ruleId||void 0,this.source=e.source||void 0,this.stack=f&&e.cause&&"string"==typeof e.cause.stack?e.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Ld.prototype.file="",Ld.prototype.name="",Ld.prototype.reason="",Ld.prototype.message="",Ld.prototype.stack="",Ld.prototype.column=void 0,Ld.prototype.line=void 0,Ld.prototype.ancestors=void 0,Ld.prototype.cause=void 0,Ld.prototype.fatal=void 0,Ld.prototype.place=void 0,Ld.prototype.ruleId=void 0,Ld.prototype.source=void 0;let Le={}.hasOwnProperty,Lf=new Map,Lg=/[A-Z]/g,Lh=new Set(["table","tbody","thead","tfoot","tr"]),Li=new Set(["td","th"]),Lj="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Lk(a,b,c){var d,e,f,g,h,i,j,k,l;let n,o,p,q,r,s,t,u,v,w,x;return"element"===b.type?(d=a,e=b,f=c,o=n=d.schema,"svg"===e.tagName.toLowerCase()&&"html"===n.space&&(d.schema=K4),d.ancestors.push(e),p=Lo(d,e.tagName,!1),q=function(a,b){let c,d,e={};for(d in b.properties)if("children"!==d&&Le.call(b.properties,d)){let f=function(a,b,c){let d=function(a,b){let c=KN(b),d=b,e=KA;if(c in a.normal)return a.property[a.normal[c]];if(c.length>4&&"data"===c.slice(0,4)&&KQ.test(b)){if("-"===b.charAt(4)){let a=b.slice(5).replace(KP,KS);d="data"+a.charAt(0).toUpperCase()+a.slice(1)}else{let a=b.slice(4);if(!KP.test(a)){let c=a.replace(KO,KR);"-"!==c.charAt(0)&&(c="-"+c),b="data"+c}}e=KM}return new e(d,b)}(a.schema,b);if(!(null==c||"number"==typeof c&&Number.isNaN(c))){var e;let b;if(Array.isArray(c)&&(c=d.commaSeparated?(b={},(""===(e=c)[e.length-1]?[...e,""]:e).join((b.padRight?" ":"")+","+(!1===b.padLeft?"":" ")).trim()):c.join(" ").trim()),"style"===d.property){let b="object"==typeof c?c:function(a,b){try{return(0,K5.default)(b,{reactCompat:!0})}catch(c){if(a.ignoreInvalidStyle)return{};let b=new Ld("Cannot parse `style` attribute",{ancestors:a.ancestors,cause:c,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw b.file=a.filePath||void 0,b.url=Lj+"#cannot-parse-style-attribute",b}}(a,String(c));return"css"===a.stylePropertyNameCase&&(b=function(a){let b,c={};for(b in a)Le.call(a,b)&&(c[function(a){let b=a.replace(Lg,Lq);return"ms-"===b.slice(0,3)&&(b="-"+b),b}(b)]=a[b]);return c}(b)),["style",b]}return["react"===a.elementAttributeNameCase&&d.space?KT[d.property]||d.property:d.attribute,c]}}(a,d,b.properties[d]);if(f){let[d,g]=f;a.tableCellAlignToStyle&&"align"===d&&"string"==typeof g&&Li.has(b.tagName)?c=g:e[d]=g}}return c&&((e.style||(e.style={}))["css"===a.stylePropertyNameCase?"text-align":"textAlign"]=c),e}(d,e),r=Ln(d,e),Lh.has(e.tagName)&&(r=r.filter(function(a){return"string"!=typeof a||!("object"==typeof a?"text"===a.type&&Kz(a.value):Kz(a))})),Ll(d,q,p,e),Lm(q,r),d.ancestors.pop(),d.schema=n,d.create(e,p,q,f)):"mdxFlowExpression"===b.type||"mdxTextExpression"===b.type?function(a,b){if(b.data&&b.data.estree&&a.evaluater){let c=b.data.estree.body[0];return Ks("ExpressionStatement"===c.type),a.evaluater.evaluateExpression(c.expression)}Lp(a,b.position)}(a,b):"mdxJsxFlowElement"===b.type||"mdxJsxTextElement"===b.type?(g=a,h=b,i=c,t=s=g.schema,"svg"===h.name&&"html"===s.space&&(g.schema=K4),g.ancestors.push(h),u=null===h.name?g.Fragment:Lo(g,h.name,!0),v=function(a,b){let c={};for(let d of b.attributes)if("mdxJsxExpressionAttribute"===d.type)if(d.data&&d.data.estree&&a.evaluater){let b=d.data.estree.body[0];Ks("ExpressionStatement"===b.type);let e=b.expression;Ks("ObjectExpression"===e.type);let f=e.properties[0];Ks("SpreadElement"===f.type),Object.assign(c,a.evaluater.evaluateExpression(f.argument))}else Lp(a,b.position);else{let e,f=d.name;if(d.value&&"object"==typeof d.value)if(d.value.data&&d.value.data.estree&&a.evaluater){let b=d.value.data.estree.body[0];Ks("ExpressionStatement"===b.type),e=a.evaluater.evaluateExpression(b.expression)}else Lp(a,b.position);else e=null===d.value||d.value;c[f]=e}return c}(g,h),w=Ln(g,h),Ll(g,v,u,h),Lm(v,w),g.ancestors.pop(),g.schema=s,g.create(h,u,v,i)):"mdxjsEsm"===b.type?function(a,b){if(b.data&&b.data.estree&&a.evaluater)return a.evaluater.evaluateProgram(b.data.estree);Lp(a,b.position)}(a,b):"root"===b.type?(j=a,k=b,l=c,Lm(x={},Ln(j,k)),j.create(k,j.Fragment,x,l)):"text"===b.type?b.value:void 0}function Ll(a,b,c,d){"string"!=typeof c&&c!==a.Fragment&&a.passNode&&(b.node=d)}function Lm(a,b){if(b.length>0){let c=b.length>1?b:b[0];c&&(a.children=c)}}function Ln(a,b){let c=[],d=-1,e=a.passKeys?new Map:Lf;for(;++d<b.children.length;){let f,g=b.children[d];if(a.passKeys){let a="element"===g.type?g.tagName:"mdxJsxFlowElement"===g.type||"mdxJsxTextElement"===g.type?g.name:void 0;if(a){let b=e.get(a)||0;f=a+"-"+b,e.set(a,b+1)}}let h=Lk(a,g,f);void 0!==h&&c.push(h)}return c}function Lo(a,b,c){let d;if(c)if(b.includes(".")){let a,c=b.split("."),e=-1;for(;++e<c.length;){let b=Kx(c[e])?{type:"Identifier",name:c[e]}:{type:"Literal",value:c[e]};a=a?{type:"MemberExpression",object:a,property:b,computed:!!(e&&"Literal"===b.type),optional:!1}:b}Ks(a,"always a result"),d=a}else d=Kx(b)&&!/^[a-z]/.test(b)?{type:"Identifier",name:b}:{type:"Literal",value:b};else d={type:"Literal",value:b};if("Literal"===d.type){let b=d.value;return Le.call(a.components,b)?a.components[b]:b}if(a.evaluater)return a.evaluater.evaluateExpression(d);Lp(a)}function Lp(a,b){let c=new Ld("Cannot handle MDX estrees without `createEvaluater`",{ancestors:a.ancestors,place:b,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw c.file=a.filePath||void 0,c.url=Lj+"#cannot-handle-mdx-estrees-without-createevaluater",c}function Lq(a){return"-"+a.toLowerCase()}let Lr={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},Ls={};function Lt(a,b){let c=b||Ls;return Lu(a,"boolean"!=typeof c.includeImageAlt||c.includeImageAlt,"boolean"!=typeof c.includeHtml||c.includeHtml)}function Lu(a,b,c){var d;if((d=a)&&"object"==typeof d){if("value"in a)return"html"!==a.type||c?a.value:"";if(b&&"alt"in a&&a.alt)return a.alt;if("children"in a)return Lv(a.children,b,c)}return Array.isArray(a)?Lv(a,b,c):""}function Lv(a,b,c){let d=[],e=-1;for(;++e<a.length;)d[e]=Lu(a[e],b,c);return d.join("")}function Lw(a,b,c,d){let e,f=a.length,g=0;if(b=b<0?-b>f?0:f+b:b>f?f:b,c=c>0?c:0,d.length<1e4)(e=Array.from(d)).unshift(b,c),a.splice(...e);else for(c&&a.splice(b,c);g<d.length;)(e=d.slice(g,g+1e4)).unshift(b,0),a.splice(...e),g+=1e4,b+=1e4}function Lx(a,b){return a.length>0?(Lw(a,a.length,0,b),a):b}let Ly={}.hasOwnProperty;function Lz(a){let b={},c=-1;for(;++c<a.length;)!function(a,b){let c;for(c in b){let d,e=(Ly.call(a,c)?a[c]:void 0)||(a[c]={}),f=b[c];if(f)for(d in f){Ly.call(e,d)||(e[d]=[]);let a=f[d];!function(a,b){let c=-1,d=[];for(;++c<b.length;)("after"===b[c].add?a:d).push(b[c]);Lw(a,0,0,d)}(e[d],Array.isArray(a)?a:a?[a]:[])}}}(b,a[c]);return b}function LA(a){return null!==a&&a<-2}function LB(a){return -2===a||-1===a||32===a}function LC(a){return function(b){return null!==b&&b>-1&&a.test(String.fromCharCode(b))}}function LD(a,b,c,d){let e=d?d-1:1/0,f=0;return function(d){return LB(d)?(a.enter(c),function d(g){return LB(g)&&f++<e?(a.consume(g),d):(a.exit(c),b(g))}(d)):b(d)}}LC(/[A-Za-z]/),LC(/[\dA-Za-z]/),LC(/[#-'*+\--9=?A-Z^-~]/),LC(/\d/),LC(/[\dA-Fa-f]/),LC(/[!-/:-@[-`{-~]/),LC(/\p{P}|\p{S}/u),LC(/\s/);let LE={tokenize:function(a){let b,c=a.attempt(this.parser.constructs.contentInitial,function(b){return null===b?void a.consume(b):(a.enter("lineEnding"),a.consume(b),a.exit("lineEnding"),LD(a,c,"linePrefix"))},function(c){return a.enter("paragraph"),function c(d){let e=a.enter("chunkText",{contentType:"text",previous:b});return b&&(b.next=e),b=e,function b(d){if(null===d){a.exit("chunkText"),a.exit("paragraph"),a.consume(d);return}return LA(d)?(a.consume(d),a.exit("chunkText"),c):(a.consume(d),b)}(d)}(c)});return c}},LF={tokenize:function(a){let b,c,d,e=this,f=[],g=0;return h;function h(b){if(g<f.length){let c=f[g];return e.containerState=c[1],a.attempt(c[0].continuation,i,j)(b)}return j(b)}function i(a){if(g++,e.containerState._closeFlow){let c;e.containerState._closeFlow=void 0,b&&s();let d=e.events.length,f=d;for(;f--;)if("exit"===e.events[f][0]&&"chunkFlow"===e.events[f][1].type){c=e.events[f][1].end;break}r(g);let h=d;for(;h<e.events.length;)e.events[h][1].end={...c},h++;return Lw(e.events,f+1,0,e.events.slice(d)),e.events.length=h,j(a)}return h(a)}function j(c){if(g===f.length){if(!b)return n(c);if(b.currentConstruct&&b.currentConstruct.concrete)return p(c);e.interrupt=!!(b.currentConstruct&&!b._gfmTableDynamicInterruptHack)}return e.containerState={},a.check(LG,k,l)(c)}function k(a){return b&&s(),r(g),n(a)}function l(a){return e.parser.lazy[e.now().line]=g!==f.length,d=e.now().offset,p(a)}function n(b){return e.containerState={},a.attempt(LG,o,p)(b)}function o(a){return g++,f.push([e.currentConstruct,e.containerState]),n(a)}function p(d){if(null===d){b&&s(),r(0),a.consume(d);return}return b=b||e.parser.flow(e.now()),a.enter("chunkFlow",{_tokenizer:b,contentType:"flow",previous:c}),function b(c){if(null===c){q(a.exit("chunkFlow"),!0),r(0),a.consume(c);return}return LA(c)?(a.consume(c),q(a.exit("chunkFlow")),g=0,e.interrupt=void 0,h):(a.consume(c),b)}(d)}function q(a,f){let h=e.sliceStream(a);if(f&&h.push(null),a.previous=c,c&&(c.next=a),c=a,b.defineSkip(a.start),b.write(h),e.parser.lazy[a.start.line]){let a,c,f=b.events.length;for(;f--;)if(b.events[f][1].start.offset<d&&(!b.events[f][1].end||b.events[f][1].end.offset>d))return;let h=e.events.length,i=h;for(;i--;)if("exit"===e.events[i][0]&&"chunkFlow"===e.events[i][1].type){if(a){c=e.events[i][1].end;break}a=!0}for(r(g),f=h;f<e.events.length;)e.events[f][1].end={...c},f++;Lw(e.events,i+1,0,e.events.slice(h)),e.events.length=f}}function r(b){let c=f.length;for(;c-- >b;){let b=f[c];e.containerState=b[1],b[0].exit.call(e,a)}f.length=b}function s(){b.write([null]),c=void 0,b=void 0,e.containerState._closeFlow=void 0}}},LG={tokenize:function(a,b,c){return LD(a,a.attempt(this.parser.constructs.document,b,c),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}},LH=LQ(/[A-Za-z]/),LI=LQ(/[\dA-Za-z]/),LJ=LQ(/[#-'*+\--9=?A-Z^-~]/),LK=LQ(/\d/),LL=LQ(/[\dA-Fa-f]/),LM=LQ(/[!-/:-@[-`{-~]/);function LN(a){return null!==a&&a<-2}function LO(a){return null!==a&&(a<0||32===a)}function LP(a){return -2===a||-1===a||32===a}function LQ(a){return function(b){return null!==b&&b>-1&&a.test(String.fromCharCode(b))}}function LR(a,b,c,d){let e=d?d-1:1/0,f=0;return function(d){return LP(d)?(a.enter(c),function d(g){return LP(g)&&f++<e?(a.consume(g),d):(a.exit(c),b(g))}(d)):b(d)}}LQ(/\p{P}|\p{S}/u),LQ(/\s/);let LS={partial:!0,tokenize:function(a,b,c){return function(b){return LP(b)?LR(a,d,"linePrefix")(b):d(b)};function d(a){return null===a||LN(a)?b(a):c(a)}}};class LT{constructor(a){this.left=a?[...a]:[],this.right=[]}get(a){if(a<0||a>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+a+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return a<this.left.length?this.left[a]:this.right[this.right.length-a+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(a,b){let c=null==b?1/0:b;return c<this.left.length?this.left.slice(a,c):a>this.left.length?this.right.slice(this.right.length-c+this.left.length,this.right.length-a+this.left.length).reverse():this.left.slice(a).concat(this.right.slice(this.right.length-c+this.left.length).reverse())}splice(a,b,c){this.setCursor(Math.trunc(a));let d=this.right.splice(this.right.length-(b||0),1/0);return c&&LU(this.left,c),d.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(a){this.setCursor(1/0),this.left.push(a)}pushMany(a){this.setCursor(1/0),LU(this.left,a)}unshift(a){this.setCursor(0),this.right.push(a)}unshiftMany(a){this.setCursor(0),LU(this.right,a.reverse())}setCursor(a){if(a!==this.left.length&&(!(a>this.left.length)||0!==this.right.length)&&(!(a<0)||0!==this.left.length))if(a<this.left.length){let b=this.left.splice(a,1/0);LU(this.right,b.reverse())}else{let b=this.right.splice(this.left.length+this.right.length-a,1/0);LU(this.left,b.reverse())}}}function LU(a,b){let c=0;if(b.length<1e4)a.push(...b);else for(;c<b.length;)a.push(...b.slice(c,c+1e4)),c+=1e4}function LV(a){let b,c,d,e,f,g,h,i={},j=-1,k=new LT(a);for(;++j<k.length;){for(;j in i;)j=i[j];if(b=k.get(j),j&&"chunkFlow"===b[1].type&&"listItemPrefix"===k.get(j-1)[1].type&&((d=0)<(g=b[1]._tokenizer.events).length&&"lineEndingBlank"===g[d][1].type&&(d+=2),d<g.length&&"content"===g[d][1].type))for(;++d<g.length&&"content"!==g[d][1].type;)"chunkText"===g[d][1].type&&(g[d][1]._isInFirstContentOfListItem=!0,d++);if("enter"===b[0])b[1].contentType&&(Object.assign(i,function(a,b){let c,d,e=a.get(b)[1],f=a.get(b)[2],g=b-1,h=[],i=e._tokenizer;!i&&(i=f.parser[e.contentType](e.start),e._contentTypeTextTrailing&&(i._contentTypeTextTrailing=!0));let j=i.events,k=[],l={},n=-1,o=e,p=0,q=0,r=[0];for(;o;){for(;a.get(++g)[1]!==o;);h.push(g),!o._tokenizer&&(c=f.sliceStream(o),o.next||c.push(null),d&&i.defineSkip(o.start),o._isInFirstContentOfListItem&&(i._gfmTasklistFirstContentOfListItem=!0),i.write(c),o._isInFirstContentOfListItem&&(i._gfmTasklistFirstContentOfListItem=void 0)),d=o,o=o.next}for(o=e;++n<j.length;)"exit"===j[n][0]&&"enter"===j[n-1][0]&&j[n][1].type===j[n-1][1].type&&j[n][1].start.line!==j[n][1].end.line&&(q=n+1,r.push(q),o._tokenizer=void 0,o.previous=void 0,o=o.next);for(i.events=[],o?(o._tokenizer=void 0,o.previous=void 0):r.pop(),n=r.length;n--;){let b=j.slice(r[n],r[n+1]),c=h.pop();k.push([c,c+b.length-1]),a.splice(c,2,b)}for(k.reverse(),n=-1;++n<k.length;)l[p+k[n][0]]=p+k[n][1],p+=k[n][1]-k[n][0]-1;return l}(k,j)),j=i[j],h=!0);else if(b[1]._container){for(d=j,c=void 0;d--;)if("lineEnding"===(e=k.get(d))[1].type||"lineEndingBlank"===e[1].type)"enter"===e[0]&&(c&&(k.get(c)[1].type="lineEndingBlank"),e[1].type="lineEnding",c=d);else if("linePrefix"===e[1].type||"listItemIndent"===e[1].type);else break;c&&(b[1].end={...k.get(c)[1].start},(f=k.slice(c,j)).unshift(b),k.splice(c,j-c+1,f))}}return Lw(a,0,1/0,k.slice(0)),!h}let LW={resolve:function(a){return LV(a),a},tokenize:function(a,b){let c;return function(b){return a.enter("content"),c=a.enter("chunkContent",{contentType:"content"}),d(b)};function d(b){return null===b?e(b):LN(b)?a.check(LX,f,e)(b):(a.consume(b),d)}function e(c){return a.exit("chunkContent"),a.exit("content"),b(c)}function f(b){return a.consume(b),a.exit("chunkContent"),c.next=a.enter("chunkContent",{contentType:"content",previous:c}),c=c.next,d}}},LX={partial:!0,tokenize:function(a,b,c){let d=this;return function(b){return a.exit("chunkContent"),a.enter("lineEnding"),a.consume(b),a.exit("lineEnding"),LR(a,e,"linePrefix")};function e(e){if(null===e||LN(e))return c(e);let f=d.events[d.events.length-1];return!d.parser.constructs.disable.null.includes("codeIndented")&&f&&"linePrefix"===f[1].type&&f[2].sliceSerialize(f[1],!0).length>=4?b(e):a.interrupt(d.parser.constructs.flow,c,b)(e)}}},LY={tokenize:function(a){let b=this,c=a.attempt(LS,function(d){return null===d?void a.consume(d):(a.enter("lineEndingBlank"),a.consume(d),a.exit("lineEndingBlank"),b.currentConstruct=void 0,c)},a.attempt(this.parser.constructs.flowInitial,d,LD(a,a.attempt(this.parser.constructs.flow,d,a.attempt(LW,d)),"linePrefix")));return c;function d(d){return null===d?void a.consume(d):(a.enter("lineEnding"),a.consume(d),a.exit("lineEnding"),b.currentConstruct=void 0,c)}}},LZ={resolveAll:L1()},L$=L0("string"),L_=L0("text");function L0(a){return{resolveAll:L1("text"===a?L2:void 0),tokenize:function(b){let c=this,d=this.parser.constructs[a],e=b.attempt(d,f,g);return f;function f(a){return i(a)?e(a):g(a)}function g(a){return null===a?void b.consume(a):(b.enter("data"),b.consume(a),h)}function h(a){return i(a)?(b.exit("data"),e(a)):(b.consume(a),h)}function i(a){if(null===a)return!0;let b=d[a],e=-1;if(b)for(;++e<b.length;){let a=b[e];if(!a.previous||a.previous.call(c,c.previous))return!0}return!1}}}}function L1(a){return function(b,c){let d,e=-1;for(;++e<=b.length;)void 0===d?b[e]&&"data"===b[e][1].type&&(d=e,e++):b[e]&&"data"===b[e][1].type||(e!==d+2&&(b[d][1].end=b[e-1][1].end,b.splice(d+2,e-d-2),e=d+2),d=void 0);return a?a(b,c):b}}function L2(a,b){let c=0;for(;++c<=a.length;)if((c===a.length||"lineEnding"===a[c][1].type)&&"data"===a[c-1][1].type){let d,e=a[c-1][1],f=b.sliceStream(e),g=f.length,h=-1,i=0;for(;g--;){let a=f[g];if("string"==typeof a){for(h=a.length;32===a.charCodeAt(h-1);)i++,h--;if(h)break;h=-1}else if(-2===a)d=!0,i++;else if(-1===a);else{g++;break}}if(b._contentTypeTextTrailing&&c===a.length&&(i=0),i){let f={type:c===a.length||d||i<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:g?h:e.start._bufferIndex+h,_index:e.start._index+g,line:e.end.line,column:e.end.column-i,offset:e.end.offset-i},end:{...e.end}};e.end={...f.start},e.start.offset===e.end.offset?Object.assign(e,f):(a.splice(c,0,["enter",f,b],["exit",f,b]),c+=2)}c++}return a}L5(/[A-Za-z]/),L5(/[\dA-Za-z]/),L5(/[#-'*+\--9=?A-Z^-~]/),L5(/\d/),L5(/[\dA-Fa-f]/),L5(/[!-/:-@[-`{-~]/);let L3=L5(/\p{P}|\p{S}/u),L4=L5(/\s/);function L5(a){return function(b){return null!==b&&b>-1&&a.test(String.fromCharCode(b))}}function L6(a){return null===a||null!==a&&(a<0||32===a)||L4(a)?1:L3(a)?2:void 0}function L7(a,b,c){let d=[],e=-1;for(;++e<a.length;){let f=a[e].resolveAll;f&&!d.includes(f)&&(b=f(b,c),d.push(f))}return b}let L8={name:"attention",resolveAll:function(a,b){let c,d,e,f,g,h,i,j,k=-1;for(;++k<a.length;)if("enter"===a[k][0]&&"attentionSequence"===a[k][1].type&&a[k][1]._close){for(c=k;c--;)if("exit"===a[c][0]&&"attentionSequence"===a[c][1].type&&a[c][1]._open&&b.sliceSerialize(a[c][1]).charCodeAt(0)===b.sliceSerialize(a[k][1]).charCodeAt(0)){if((a[c][1]._close||a[k][1]._open)&&(a[k][1].end.offset-a[k][1].start.offset)%3&&!((a[c][1].end.offset-a[c][1].start.offset+a[k][1].end.offset-a[k][1].start.offset)%3))continue;h=a[c][1].end.offset-a[c][1].start.offset>1&&a[k][1].end.offset-a[k][1].start.offset>1?2:1;let l={...a[c][1].end},n={...a[k][1].start};L9(l,-h),L9(n,h),f={type:h>1?"strongSequence":"emphasisSequence",start:l,end:{...a[c][1].end}},g={type:h>1?"strongSequence":"emphasisSequence",start:{...a[k][1].start},end:n},e={type:h>1?"strongText":"emphasisText",start:{...a[c][1].end},end:{...a[k][1].start}},d={type:h>1?"strong":"emphasis",start:{...f.start},end:{...g.end}},a[c][1].end={...f.start},a[k][1].start={...g.end},i=[],a[c][1].end.offset-a[c][1].start.offset&&(i=Lx(i,[["enter",a[c][1],b],["exit",a[c][1],b]])),i=Lx(i,[["enter",d,b],["enter",f,b],["exit",f,b],["enter",e,b]]),i=Lx(i,L7(b.parser.constructs.insideSpan.null,a.slice(c+1,k),b)),i=Lx(i,[["exit",e,b],["enter",g,b],["exit",g,b],["exit",d,b]]),a[k][1].end.offset-a[k][1].start.offset?(j=2,i=Lx(i,[["enter",a[k][1],b],["exit",a[k][1],b]])):j=0,Lw(a,c-1,k-c+3,i),k=c+i.length-j-2;break}}for(k=-1;++k<a.length;)"attentionSequence"===a[k][1].type&&(a[k][1].type="data");return a},tokenize:function(a,b){let c,d=this.parser.constructs.attentionMarkers.null,e=this.previous,f=L6(e);return function(g){return c=g,a.enter("attentionSequence"),function g(h){if(h===c)return a.consume(h),g;let i=a.exit("attentionSequence"),j=L6(h),k=!j||2===j&&f||d.includes(h),l=!f||2===f&&j||d.includes(e);return i._open=!!(42===c?k:k&&(f||!l)),i._close=!!(42===c?l:l&&(j||!k)),b(h)}(g)}}};function L9(a,b){a.column+=b,a.offset+=b,a._bufferIndex+=b}let Ma={continuation:{tokenize:function(a,b,c){let d=this;return function(b){return LP(b)?LR(a,e,"linePrefix",d.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(b):e(b)};function e(d){return a.attempt(Ma,b,c)(d)}}},exit:function(a){a.exit("blockQuote")},name:"blockQuote",tokenize:function(a,b,c){let d=this;return function(b){if(62===b){let c=d.containerState;return c.open||(a.enter("blockQuote",{_container:!0}),c.open=!0),a.enter("blockQuotePrefix"),a.enter("blockQuoteMarker"),a.consume(b),a.exit("blockQuoteMarker"),e}return c(b)};function e(c){return LP(c)?(a.enter("blockQuotePrefixWhitespace"),a.consume(c),a.exit("blockQuotePrefixWhitespace"),a.exit("blockQuotePrefix"),b):(a.exit("blockQuotePrefix"),b(c))}}},Mb={name:"characterEscape",tokenize:function(a,b,c){return function(b){return a.enter("characterEscape"),a.enter("escapeMarker"),a.consume(b),a.exit("escapeMarker"),d};function d(d){return LM(d)?(a.enter("characterEscapeValue"),a.consume(d),a.exit("characterEscapeValue"),a.exit("characterEscape"),b):c(d)}}},Mc={AElig:"Æ",AMP:"&",Aacute:"Á",Abreve:"Ă",Acirc:"Â",Acy:"А",Afr:"𝔄",Agrave:"À",Alpha:"Α",Amacr:"Ā",And:"⩓",Aogon:"Ą",Aopf:"𝔸",ApplyFunction:"",Aring:"Å",Ascr:"𝒜",Assign:"≔",Atilde:"Ã",Auml:"Ä",Backslash:"∖",Barv:"⫧",Barwed:"⌆",Bcy:"Б",Because:"∵",Bernoullis:"ℬ",Beta:"Β",Bfr:"𝔅",Bopf:"𝔹",Breve:"˘",Bscr:"ℬ",Bumpeq:"≎",CHcy:"Ч",COPY:"©",Cacute:"Ć",Cap:"⋒",CapitalDifferentialD:"ⅅ",Cayleys:"ℭ",Ccaron:"Č",Ccedil:"Ç",Ccirc:"Ĉ",Cconint:"∰",Cdot:"Ċ",Cedilla:"¸",CenterDot:"·",Cfr:"ℭ",Chi:"Χ",CircleDot:"⊙",CircleMinus:"⊖",CirclePlus:"⊕",CircleTimes:"⊗",ClockwiseContourIntegral:"∲",CloseCurlyDoubleQuote:"”",CloseCurlyQuote:"’",Colon:"∷",Colone:"⩴",Congruent:"≡",Conint:"∯",ContourIntegral:"∮",Copf:"ℂ",Coproduct:"∐",CounterClockwiseContourIntegral:"∳",Cross:"⨯",Cscr:"𝒞",Cup:"⋓",CupCap:"≍",DD:"ⅅ",DDotrahd:"⤑",DJcy:"Ђ",DScy:"Ѕ",DZcy:"Џ",Dagger:"‡",Darr:"↡",Dashv:"⫤",Dcaron:"Ď",Dcy:"Д",Del:"∇",Delta:"Δ",Dfr:"𝔇",DiacriticalAcute:"´",DiacriticalDot:"˙",DiacriticalDoubleAcute:"˝",DiacriticalGrave:"`",DiacriticalTilde:"˜",Diamond:"⋄",DifferentialD:"ⅆ",Dopf:"𝔻",Dot:"¨",DotDot:"⃜",DotEqual:"≐",DoubleContourIntegral:"∯",DoubleDot:"¨",DoubleDownArrow:"⇓",DoubleLeftArrow:"⇐",DoubleLeftRightArrow:"⇔",DoubleLeftTee:"⫤",DoubleLongLeftArrow:"⟸",DoubleLongLeftRightArrow:"⟺",DoubleLongRightArrow:"⟹",DoubleRightArrow:"⇒",DoubleRightTee:"⊨",DoubleUpArrow:"⇑",DoubleUpDownArrow:"⇕",DoubleVerticalBar:"∥",DownArrow:"↓",DownArrowBar:"⤓",DownArrowUpArrow:"⇵",DownBreve:"̑",DownLeftRightVector:"⥐",DownLeftTeeVector:"⥞",DownLeftVector:"↽",DownLeftVectorBar:"⥖",DownRightTeeVector:"⥟",DownRightVector:"⇁",DownRightVectorBar:"⥗",DownTee:"⊤",DownTeeArrow:"↧",Downarrow:"⇓",Dscr:"𝒟",Dstrok:"Đ",ENG:"Ŋ",ETH:"Ð",Eacute:"É",Ecaron:"Ě",Ecirc:"Ê",Ecy:"Э",Edot:"Ė",Efr:"𝔈",Egrave:"È",Element:"∈",Emacr:"Ē",EmptySmallSquare:"◻",EmptyVerySmallSquare:"▫",Eogon:"Ę",Eopf:"𝔼",Epsilon:"Ε",Equal:"⩵",EqualTilde:"≂",Equilibrium:"⇌",Escr:"ℰ",Esim:"⩳",Eta:"Η",Euml:"Ë",Exists:"∃",ExponentialE:"ⅇ",Fcy:"Ф",Ffr:"𝔉",FilledSmallSquare:"◼",FilledVerySmallSquare:"▪",Fopf:"𝔽",ForAll:"∀",Fouriertrf:"ℱ",Fscr:"ℱ",GJcy:"Ѓ",GT:">",Gamma:"Γ",Gammad:"Ϝ",Gbreve:"Ğ",Gcedil:"Ģ",Gcirc:"Ĝ",Gcy:"Г",Gdot:"Ġ",Gfr:"𝔊",Gg:"⋙",Gopf:"𝔾",GreaterEqual:"≥",GreaterEqualLess:"⋛",GreaterFullEqual:"≧",GreaterGreater:"⪢",GreaterLess:"≷",GreaterSlantEqual:"⩾",GreaterTilde:"≳",Gscr:"𝒢",Gt:"≫",HARDcy:"Ъ",Hacek:"ˇ",Hat:"^",Hcirc:"Ĥ",Hfr:"ℌ",HilbertSpace:"ℋ",Hopf:"ℍ",HorizontalLine:"─",Hscr:"ℋ",Hstrok:"Ħ",HumpDownHump:"≎",HumpEqual:"≏",IEcy:"Е",IJlig:"IJ",IOcy:"Ё",Iacute:"Í",Icirc:"Î",Icy:"И",Idot:"İ",Ifr:"ℑ",Igrave:"Ì",Im:"ℑ",Imacr:"Ī",ImaginaryI:"ⅈ",Implies:"⇒",Int:"∬",Integral:"∫",Intersection:"⋂",InvisibleComma:"",InvisibleTimes:"",Iogon:"Į",Iopf:"𝕀",Iota:"Ι",Iscr:"ℐ",Itilde:"Ĩ",Iukcy:"І",Iuml:"Ï",Jcirc:"Ĵ",Jcy:"Й",Jfr:"𝔍",Jopf:"𝕁",Jscr:"𝒥",Jsercy:"Ј",Jukcy:"Є",KHcy:"Х",KJcy:"Ќ",Kappa:"Κ",Kcedil:"Ķ",Kcy:"К",Kfr:"𝔎",Kopf:"𝕂",Kscr:"𝒦",LJcy:"Љ",LT:"<",Lacute:"Ĺ",Lambda:"Λ",Lang:"⟪",Laplacetrf:"ℒ",Larr:"↞",Lcaron:"Ľ",Lcedil:"Ļ",Lcy:"Л",LeftAngleBracket:"⟨",LeftArrow:"←",LeftArrowBar:"⇤",LeftArrowRightArrow:"⇆",LeftCeiling:"⌈",LeftDoubleBracket:"⟦",LeftDownTeeVector:"⥡",LeftDownVector:"⇃",LeftDownVectorBar:"⥙",LeftFloor:"⌊",LeftRightArrow:"↔",LeftRightVector:"⥎",LeftTee:"⊣",LeftTeeArrow:"↤",LeftTeeVector:"⥚",LeftTriangle:"⊲",LeftTriangleBar:"⧏",LeftTriangleEqual:"⊴",LeftUpDownVector:"⥑",LeftUpTeeVector:"⥠",LeftUpVector:"↿",LeftUpVectorBar:"⥘",LeftVector:"↼",LeftVectorBar:"⥒",Leftarrow:"⇐",Leftrightarrow:"⇔",LessEqualGreater:"⋚",LessFullEqual:"≦",LessGreater:"≶",LessLess:"⪡",LessSlantEqual:"⩽",LessTilde:"≲",Lfr:"𝔏",Ll:"⋘",Lleftarrow:"⇚",Lmidot:"Ŀ",LongLeftArrow:"⟵",LongLeftRightArrow:"⟷",LongRightArrow:"⟶",Longleftarrow:"⟸",Longleftrightarrow:"⟺",Longrightarrow:"⟹",Lopf:"𝕃",LowerLeftArrow:"↙",LowerRightArrow:"↘",Lscr:"ℒ",Lsh:"↰",Lstrok:"Ł",Lt:"≪",Map:"⤅",Mcy:"М",MediumSpace:" ",Mellintrf:"ℳ",Mfr:"𝔐",MinusPlus:"∓",Mopf:"𝕄",Mscr:"ℳ",Mu:"Μ",NJcy:"Њ",Nacute:"Ń",Ncaron:"Ň",Ncedil:"Ņ",Ncy:"Н",NegativeMediumSpace:"",NegativeThickSpace:"",NegativeThinSpace:"",NegativeVeryThinSpace:"",NestedGreaterGreater:"≫",NestedLessLess:"≪",NewLine:"\n",Nfr:"𝔑",NoBreak:"",NonBreakingSpace:" ",Nopf:"ℕ",Not:"⫬",NotCongruent:"≢",NotCupCap:"≭",NotDoubleVerticalBar:"∦",NotElement:"∉",NotEqual:"≠",NotEqualTilde:"≂̸",NotExists:"∄",NotGreater:"≯",NotGreaterEqual:"≱",NotGreaterFullEqual:"≧̸",NotGreaterGreater:"≫̸",NotGreaterLess:"≹",NotGreaterSlantEqual:"⩾̸",NotGreaterTilde:"≵",NotHumpDownHump:"≎̸",NotHumpEqual:"≏̸",NotLeftTriangle:"⋪",NotLeftTriangleBar:"⧏̸",NotLeftTriangleEqual:"⋬",NotLess:"≮",NotLessEqual:"≰",NotLessGreater:"≸",NotLessLess:"≪̸",NotLessSlantEqual:"⩽̸",NotLessTilde:"≴",NotNestedGreaterGreater:"⪢̸",NotNestedLessLess:"⪡̸",NotPrecedes:"⊀",NotPrecedesEqual:"⪯̸",NotPrecedesSlantEqual:"⋠",NotReverseElement:"∌",NotRightTriangle:"⋫",NotRightTriangleBar:"⧐̸",NotRightTriangleEqual:"⋭",NotSquareSubset:"⊏̸",NotSquareSubsetEqual:"⋢",NotSquareSuperset:"⊐̸",NotSquareSupersetEqual:"⋣",NotSubset:"⊂⃒",NotSubsetEqual:"⊈",NotSucceeds:"⊁",NotSucceedsEqual:"⪰̸",NotSucceedsSlantEqual:"⋡",NotSucceedsTilde:"≿̸",NotSuperset:"⊃⃒",NotSupersetEqual:"⊉",NotTilde:"≁",NotTildeEqual:"≄",NotTildeFullEqual:"≇",NotTildeTilde:"≉",NotVerticalBar:"∤",Nscr:"𝒩",Ntilde:"Ñ",Nu:"Ν",OElig:"Œ",Oacute:"Ó",Ocirc:"Ô",Ocy:"О",Odblac:"Ő",Ofr:"𝔒",Ograve:"Ò",Omacr:"Ō",Omega:"Ω",Omicron:"Ο",Oopf:"𝕆",OpenCurlyDoubleQuote:"“",OpenCurlyQuote:"‘",Or:"⩔",Oscr:"𝒪",Oslash:"Ø",Otilde:"Õ",Otimes:"⨷",Ouml:"Ö",OverBar:"‾",OverBrace:"⏞",OverBracket:"⎴",OverParenthesis:"⏜",PartialD:"∂",Pcy:"П",Pfr:"𝔓",Phi:"Φ",Pi:"Π",PlusMinus:"±",Poincareplane:"ℌ",Popf:"ℙ",Pr:"⪻",Precedes:"≺",PrecedesEqual:"⪯",PrecedesSlantEqual:"≼",PrecedesTilde:"≾",Prime:"″",Product:"∏",Proportion:"∷",Proportional:"∝",Pscr:"𝒫",Psi:"Ψ",QUOT:'"',Qfr:"𝔔",Qopf:"ℚ",Qscr:"𝒬",RBarr:"⤐",REG:"®",Racute:"Ŕ",Rang:"⟫",Rarr:"↠",Rarrtl:"⤖",Rcaron:"Ř",Rcedil:"Ŗ",Rcy:"Р",Re:"ℜ",ReverseElement:"∋",ReverseEquilibrium:"⇋",ReverseUpEquilibrium:"⥯",Rfr:"ℜ",Rho:"Ρ",RightAngleBracket:"⟩",RightArrow:"→",RightArrowBar:"⇥",RightArrowLeftArrow:"⇄",RightCeiling:"⌉",RightDoubleBracket:"⟧",RightDownTeeVector:"⥝",RightDownVector:"⇂",RightDownVectorBar:"⥕",RightFloor:"⌋",RightTee:"⊢",RightTeeArrow:"↦",RightTeeVector:"⥛",RightTriangle:"⊳",RightTriangleBar:"⧐",RightTriangleEqual:"⊵",RightUpDownVector:"⥏",RightUpTeeVector:"⥜",RightUpVector:"↾",RightUpVectorBar:"⥔",RightVector:"⇀",RightVectorBar:"⥓",Rightarrow:"⇒",Ropf:"ℝ",RoundImplies:"⥰",Rrightarrow:"⇛",Rscr:"ℛ",Rsh:"↱",RuleDelayed:"⧴",SHCHcy:"Щ",SHcy:"Ш",SOFTcy:"Ь",Sacute:"Ś",Sc:"⪼",Scaron:"Š",Scedil:"Ş",Scirc:"Ŝ",Scy:"С",Sfr:"𝔖",ShortDownArrow:"↓",ShortLeftArrow:"←",ShortRightArrow:"→",ShortUpArrow:"↑",Sigma:"Σ",SmallCircle:"∘",Sopf:"𝕊",Sqrt:"√",Square:"□",SquareIntersection:"⊓",SquareSubset:"⊏",SquareSubsetEqual:"⊑",SquareSuperset:"⊐",SquareSupersetEqual:"⊒",SquareUnion:"⊔",Sscr:"𝒮",Star:"⋆",Sub:"⋐",Subset:"⋐",SubsetEqual:"⊆",Succeeds:"≻",SucceedsEqual:"⪰",SucceedsSlantEqual:"≽",SucceedsTilde:"≿",SuchThat:"∋",Sum:"∑",Sup:"⋑",Superset:"⊃",SupersetEqual:"⊇",Supset:"⋑",THORN:"Þ",TRADE:"™",TSHcy:"Ћ",TScy:"Ц",Tab:" ",Tau:"Τ",Tcaron:"Ť",Tcedil:"Ţ",Tcy:"Т",Tfr:"𝔗",Therefore:"∴",Theta:"Θ",ThickSpace:" ",ThinSpace:" ",Tilde:"∼",TildeEqual:"≃",TildeFullEqual:"≅",TildeTilde:"≈",Topf:"𝕋",TripleDot:"⃛",Tscr:"𝒯",Tstrok:"Ŧ",Uacute:"Ú",Uarr:"↟",Uarrocir:"⥉",Ubrcy:"Ў",Ubreve:"Ŭ",Ucirc:"Û",Ucy:"У",Udblac:"Ű",Ufr:"𝔘",Ugrave:"Ù",Umacr:"Ū",UnderBar:"_",UnderBrace:"⏟",UnderBracket:"⎵",UnderParenthesis:"⏝",Union:"⋃",UnionPlus:"⊎",Uogon:"Ų",Uopf:"𝕌",UpArrow:"↑",UpArrowBar:"⤒",UpArrowDownArrow:"⇅",UpDownArrow:"↕",UpEquilibrium:"⥮",UpTee:"⊥",UpTeeArrow:"↥",Uparrow:"⇑",Updownarrow:"⇕",UpperLeftArrow:"↖",UpperRightArrow:"↗",Upsi:"ϒ",Upsilon:"Υ",Uring:"Ů",Uscr:"𝒰",Utilde:"Ũ",Uuml:"Ü",VDash:"⊫",Vbar:"⫫",Vcy:"В",Vdash:"⊩",Vdashl:"⫦",Vee:"⋁",Verbar:"‖",Vert:"‖",VerticalBar:"∣",VerticalLine:"|",VerticalSeparator:"❘",VerticalTilde:"≀",VeryThinSpace:" ",Vfr:"𝔙",Vopf:"𝕍",Vscr:"𝒱",Vvdash:"⊪",Wcirc:"Ŵ",Wedge:"⋀",Wfr:"𝔚",Wopf:"𝕎",Wscr:"𝒲",Xfr:"𝔛",Xi:"Ξ",Xopf:"𝕏",Xscr:"𝒳",YAcy:"Я",YIcy:"Ї",YUcy:"Ю",Yacute:"Ý",Ycirc:"Ŷ",Ycy:"Ы",Yfr:"𝔜",Yopf:"𝕐",Yscr:"𝒴",Yuml:"Ÿ",ZHcy:"Ж",Zacute:"Ź",Zcaron:"Ž",Zcy:"З",Zdot:"Ż",ZeroWidthSpace:"",Zeta:"Ζ",Zfr:"ℨ",Zopf:"ℤ",Zscr:"𝒵",aacute:"á",abreve:"ă",ac:"∾",acE:"∾̳",acd:"∿",acirc:"â",acute:"´",acy:"а",aelig:"æ",af:"",afr:"𝔞",agrave:"à",alefsym:"ℵ",aleph:"ℵ",alpha:"α",amacr:"ā",amalg:"⨿",amp:"&",and:"∧",andand:"⩕",andd:"⩜",andslope:"⩘",andv:"⩚",ang:"∠",ange:"⦤",angle:"∠",angmsd:"∡",angmsdaa:"⦨",angmsdab:"⦩",angmsdac:"⦪",angmsdad:"⦫",angmsdae:"⦬",angmsdaf:"⦭",angmsdag:"⦮",angmsdah:"⦯",angrt:"∟",angrtvb:"⊾",angrtvbd:"⦝",angsph:"∢",angst:"Å",angzarr:"⍼",aogon:"ą",aopf:"𝕒",ap:"≈",apE:"⩰",apacir:"⩯",ape:"≊",apid:"≋",apos:"'",approx:"≈",approxeq:"≊",aring:"å",ascr:"𝒶",ast:"*",asymp:"≈",asympeq:"≍",atilde:"ã",auml:"ä",awconint:"∳",awint:"⨑",bNot:"⫭",backcong:"≌",backepsilon:"϶",backprime:"‵",backsim:"∽",backsimeq:"⋍",barvee:"⊽",barwed:"⌅",barwedge:"⌅",bbrk:"⎵",bbrktbrk:"⎶",bcong:"≌",bcy:"б",bdquo:"„",becaus:"∵",because:"∵",bemptyv:"⦰",bepsi:"϶",bernou:"ℬ",beta:"β",beth:"ℶ",between:"≬",bfr:"𝔟",bigcap:"⋂",bigcirc:"◯",bigcup:"⋃",bigodot:"⨀",bigoplus:"⨁",bigotimes:"⨂",bigsqcup:"⨆",bigstar:"★",bigtriangledown:"▽",bigtriangleup:"△",biguplus:"⨄",bigvee:"⋁",bigwedge:"⋀",bkarow:"⤍",blacklozenge:"⧫",blacksquare:"▪",blacktriangle:"▴",blacktriangledown:"▾",blacktriangleleft:"◂",blacktriangleright:"▸",blank:"␣",blk12:"▒",blk14:"░",blk34:"▓",block:"█",bne:"=⃥",bnequiv:"≡⃥",bnot:"⌐",bopf:"𝕓",bot:"⊥",bottom:"⊥",bowtie:"⋈",boxDL:"╗",boxDR:"╔",boxDl:"╖",boxDr:"╓",boxH:"═",boxHD:"╦",boxHU:"╩",boxHd:"╤",boxHu:"╧",boxUL:"╝",boxUR:"╚",boxUl:"╜",boxUr:"╙",boxV:"║",boxVH:"╬",boxVL:"╣",boxVR:"╠",boxVh:"╫",boxVl:"╢",boxVr:"╟",boxbox:"⧉",boxdL:"╕",boxdR:"╒",boxdl:"┐",boxdr:"┌",boxh:"─",boxhD:"╥",boxhU:"╨",boxhd:"┬",boxhu:"┴",boxminus:"⊟",boxplus:"⊞",boxtimes:"⊠",boxuL:"╛",boxuR:"╘",boxul:"┘",boxur:"└",boxv:"│",boxvH:"╪",boxvL:"╡",boxvR:"╞",boxvh:"┼",boxvl:"┤",boxvr:"├",bprime:"‵",breve:"˘",brvbar:"¦",bscr:"𝒷",bsemi:"⁏",bsim:"∽",bsime:"⋍",bsol:"\\",bsolb:"⧅",bsolhsub:"⟈",bull:"•",bullet:"•",bump:"≎",bumpE:"⪮",bumpe:"≏",bumpeq:"≏",cacute:"ć",cap:"∩",capand:"⩄",capbrcup:"⩉",capcap:"⩋",capcup:"⩇",capdot:"⩀",caps:"∩︀",caret:"⁁",caron:"ˇ",ccaps:"⩍",ccaron:"č",ccedil:"ç",ccirc:"ĉ",ccups:"⩌",ccupssm:"⩐",cdot:"ċ",cedil:"¸",cemptyv:"⦲",cent:"¢",centerdot:"·",cfr:"𝔠",chcy:"ч",check:"✓",checkmark:"✓",chi:"χ",cir:"○",cirE:"⧃",circ:"ˆ",circeq:"≗",circlearrowleft:"↺",circlearrowright:"↻",circledR:"®",circledS:"Ⓢ",circledast:"⊛",circledcirc:"⊚",circleddash:"⊝",cire:"≗",cirfnint:"⨐",cirmid:"⫯",cirscir:"⧂",clubs:"♣",clubsuit:"♣",colon:":",colone:"≔",coloneq:"≔",comma:",",commat:"@",comp:"∁",compfn:"∘",complement:"∁",complexes:"ℂ",cong:"≅",congdot:"⩭",conint:"∮",copf:"𝕔",coprod:"∐",copy:"©",copysr:"℗",crarr:"↵",cross:"✗",cscr:"𝒸",csub:"⫏",csube:"⫑",csup:"⫐",csupe:"⫒",ctdot:"⋯",cudarrl:"⤸",cudarrr:"⤵",cuepr:"⋞",cuesc:"⋟",cularr:"↶",cularrp:"⤽",cup:"∪",cupbrcap:"⩈",cupcap:"⩆",cupcup:"⩊",cupdot:"⊍",cupor:"⩅",cups:"∪︀",curarr:"↷",curarrm:"⤼",curlyeqprec:"⋞",curlyeqsucc:"⋟",curlyvee:"⋎",curlywedge:"⋏",curren:"¤",curvearrowleft:"↶",curvearrowright:"↷",cuvee:"⋎",cuwed:"⋏",cwconint:"∲",cwint:"∱",cylcty:"⌭",dArr:"⇓",dHar:"⥥",dagger:"†",daleth:"ℸ",darr:"↓",dash:"‐",dashv:"⊣",dbkarow:"⤏",dblac:"˝",dcaron:"ď",dcy:"д",dd:"ⅆ",ddagger:"‡",ddarr:"⇊",ddotseq:"⩷",deg:"°",delta:"δ",demptyv:"⦱",dfisht:"⥿",dfr:"𝔡",dharl:"⇃",dharr:"⇂",diam:"⋄",diamond:"⋄",diamondsuit:"♦",diams:"♦",die:"¨",digamma:"ϝ",disin:"⋲",div:"÷",divide:"÷",divideontimes:"⋇",divonx:"⋇",djcy:"ђ",dlcorn:"⌞",dlcrop:"⌍",dollar:"$",dopf:"𝕕",dot:"˙",doteq:"≐",doteqdot:"≑",dotminus:"∸",dotplus:"∔",dotsquare:"⊡",doublebarwedge:"⌆",downarrow:"↓",downdownarrows:"⇊",downharpoonleft:"⇃",downharpoonright:"⇂",drbkarow:"⤐",drcorn:"⌟",drcrop:"⌌",dscr:"𝒹",dscy:"ѕ",dsol:"⧶",dstrok:"đ",dtdot:"⋱",dtri:"▿",dtrif:"▾",duarr:"⇵",duhar:"⥯",dwangle:"⦦",dzcy:"џ",dzigrarr:"⟿",eDDot:"⩷",eDot:"≑",eacute:"é",easter:"⩮",ecaron:"ě",ecir:"≖",ecirc:"ê",ecolon:"≕",ecy:"э",edot:"ė",ee:"ⅇ",efDot:"≒",efr:"𝔢",eg:"⪚",egrave:"è",egs:"⪖",egsdot:"⪘",el:"⪙",elinters:"⏧",ell:"ℓ",els:"⪕",elsdot:"⪗",emacr:"ē",empty:"∅",emptyset:"∅",emptyv:"∅",emsp13:" ",emsp14:" ",emsp:" ",eng:"ŋ",ensp:" ",eogon:"ę",eopf:"𝕖",epar:"⋕",eparsl:"⧣",eplus:"⩱",epsi:"ε",epsilon:"ε",epsiv:"ϵ",eqcirc:"≖",eqcolon:"≕",eqsim:"≂",eqslantgtr:"⪖",eqslantless:"⪕",equals:"=",equest:"≟",equiv:"≡",equivDD:"⩸",eqvparsl:"⧥",erDot:"≓",erarr:"⥱",escr:"ℯ",esdot:"≐",esim:"≂",eta:"η",eth:"ð",euml:"ë",euro:"€",excl:"!",exist:"∃",expectation:"ℰ",exponentiale:"ⅇ",fallingdotseq:"≒",fcy:"ф",female:"♀",ffilig:"ffi",fflig:"ff",ffllig:"ffl",ffr:"𝔣",filig:"fi",fjlig:"fj",flat:"♭",fllig:"fl",fltns:"▱",fnof:"ƒ",fopf:"𝕗",forall:"∀",fork:"⋔",forkv:"⫙",fpartint:"⨍",frac12:"½",frac13:"⅓",frac14:"¼",frac15:"⅕",frac16:"⅙",frac18:"⅛",frac23:"⅔",frac25:"⅖",frac34:"¾",frac35:"⅗",frac38:"⅜",frac45:"⅘",frac56:"⅚",frac58:"⅝",frac78:"⅞",frasl:"⁄",frown:"⌢",fscr:"𝒻",gE:"≧",gEl:"⪌",gacute:"ǵ",gamma:"γ",gammad:"ϝ",gap:"⪆",gbreve:"ğ",gcirc:"ĝ",gcy:"г",gdot:"ġ",ge:"≥",gel:"⋛",geq:"≥",geqq:"≧",geqslant:"⩾",ges:"⩾",gescc:"⪩",gesdot:"⪀",gesdoto:"⪂",gesdotol:"⪄",gesl:"⋛︀",gesles:"⪔",gfr:"𝔤",gg:"≫",ggg:"⋙",gimel:"ℷ",gjcy:"ѓ",gl:"≷",glE:"⪒",gla:"⪥",glj:"⪤",gnE:"≩",gnap:"⪊",gnapprox:"⪊",gne:"⪈",gneq:"⪈",gneqq:"≩",gnsim:"⋧",gopf:"𝕘",grave:"`",gscr:"ℊ",gsim:"≳",gsime:"⪎",gsiml:"⪐",gt:">",gtcc:"⪧",gtcir:"⩺",gtdot:"⋗",gtlPar:"⦕",gtquest:"⩼",gtrapprox:"⪆",gtrarr:"⥸",gtrdot:"⋗",gtreqless:"⋛",gtreqqless:"⪌",gtrless:"≷",gtrsim:"≳",gvertneqq:"≩︀",gvnE:"≩︀",hArr:"⇔",hairsp:" ",half:"½",hamilt:"ℋ",hardcy:"ъ",harr:"↔",harrcir:"⥈",harrw:"↭",hbar:"ℏ",hcirc:"ĥ",hearts:"♥",heartsuit:"♥",hellip:"…",hercon:"⊹",hfr:"𝔥",hksearow:"⤥",hkswarow:"⤦",hoarr:"⇿",homtht:"∻",hookleftarrow:"↩",hookrightarrow:"↪",hopf:"𝕙",horbar:"―",hscr:"𝒽",hslash:"ℏ",hstrok:"ħ",hybull:"⁃",hyphen:"‐",iacute:"í",ic:"",icirc:"î",icy:"и",iecy:"е",iexcl:"¡",iff:"⇔",ifr:"𝔦",igrave:"ì",ii:"ⅈ",iiiint:"⨌",iiint:"∭",iinfin:"⧜",iiota:"℩",ijlig:"ij",imacr:"ī",image:"ℑ",imagline:"ℐ",imagpart:"ℑ",imath:"ı",imof:"⊷",imped:"Ƶ",in:"∈",incare:"℅",infin:"∞",infintie:"⧝",inodot:"ı",int:"∫",intcal:"⊺",integers:"ℤ",intercal:"⊺",intlarhk:"⨗",intprod:"⨼",iocy:"ё",iogon:"į",iopf:"𝕚",iota:"ι",iprod:"⨼",iquest:"¿",iscr:"𝒾",isin:"∈",isinE:"⋹",isindot:"⋵",isins:"⋴",isinsv:"⋳",isinv:"∈",it:"",itilde:"ĩ",iukcy:"і",iuml:"ï",jcirc:"ĵ",jcy:"й",jfr:"𝔧",jmath:"ȷ",jopf:"𝕛",jscr:"𝒿",jsercy:"ј",jukcy:"є",kappa:"κ",kappav:"ϰ",kcedil:"ķ",kcy:"к",kfr:"𝔨",kgreen:"ĸ",khcy:"х",kjcy:"ќ",kopf:"𝕜",kscr:"𝓀",lAarr:"⇚",lArr:"⇐",lAtail:"⤛",lBarr:"⤎",lE:"≦",lEg:"⪋",lHar:"⥢",lacute:"ĺ",laemptyv:"⦴",lagran:"ℒ",lambda:"λ",lang:"⟨",langd:"⦑",langle:"⟨",lap:"⪅",laquo:"«",larr:"←",larrb:"⇤",larrbfs:"⤟",larrfs:"⤝",larrhk:"↩",larrlp:"↫",larrpl:"⤹",larrsim:"⥳",larrtl:"↢",lat:"⪫",latail:"⤙",late:"⪭",lates:"⪭︀",lbarr:"⤌",lbbrk:"❲",lbrace:"{",lbrack:"[",lbrke:"⦋",lbrksld:"⦏",lbrkslu:"⦍",lcaron:"ľ",lcedil:"ļ",lceil:"⌈",lcub:"{",lcy:"л",ldca:"⤶",ldquo:"“",ldquor:"„",ldrdhar:"⥧",ldrushar:"⥋",ldsh:"↲",le:"≤",leftarrow:"←",leftarrowtail:"↢",leftharpoondown:"↽",leftharpoonup:"↼",leftleftarrows:"⇇",leftrightarrow:"↔",leftrightarrows:"⇆",leftrightharpoons:"⇋",leftrightsquigarrow:"↭",leftthreetimes:"⋋",leg:"⋚",leq:"≤",leqq:"≦",leqslant:"⩽",les:"⩽",lescc:"⪨",lesdot:"⩿",lesdoto:"⪁",lesdotor:"⪃",lesg:"⋚︀",lesges:"⪓",lessapprox:"⪅",lessdot:"⋖",lesseqgtr:"⋚",lesseqqgtr:"⪋",lessgtr:"≶",lesssim:"≲",lfisht:"⥼",lfloor:"⌊",lfr:"𝔩",lg:"≶",lgE:"⪑",lhard:"↽",lharu:"↼",lharul:"⥪",lhblk:"▄",ljcy:"љ",ll:"≪",llarr:"⇇",llcorner:"⌞",llhard:"⥫",lltri:"◺",lmidot:"ŀ",lmoust:"⎰",lmoustache:"⎰",lnE:"≨",lnap:"⪉",lnapprox:"⪉",lne:"⪇",lneq:"⪇",lneqq:"≨",lnsim:"⋦",loang:"⟬",loarr:"⇽",lobrk:"⟦",longleftarrow:"⟵",longleftrightarrow:"⟷",longmapsto:"⟼",longrightarrow:"⟶",looparrowleft:"↫",looparrowright:"↬",lopar:"⦅",lopf:"𝕝",loplus:"⨭",lotimes:"⨴",lowast:"∗",lowbar:"_",loz:"◊",lozenge:"◊",lozf:"⧫",lpar:"(",lparlt:"⦓",lrarr:"⇆",lrcorner:"⌟",lrhar:"⇋",lrhard:"⥭",lrm:"",lrtri:"⊿",lsaquo:"‹",lscr:"𝓁",lsh:"↰",lsim:"≲",lsime:"⪍",lsimg:"⪏",lsqb:"[",lsquo:"‘",lsquor:"‚",lstrok:"ł",lt:"<",ltcc:"⪦",ltcir:"⩹",ltdot:"⋖",lthree:"⋋",ltimes:"⋉",ltlarr:"⥶",ltquest:"⩻",ltrPar:"⦖",ltri:"◃",ltrie:"⊴",ltrif:"◂",lurdshar:"⥊",luruhar:"⥦",lvertneqq:"≨︀",lvnE:"≨︀",mDDot:"∺",macr:"¯",male:"♂",malt:"✠",maltese:"✠",map:"↦",mapsto:"↦",mapstodown:"↧",mapstoleft:"↤",mapstoup:"↥",marker:"▮",mcomma:"⨩",mcy:"м",mdash:"—",measuredangle:"∡",mfr:"𝔪",mho:"℧",micro:"µ",mid:"∣",midast:"*",midcir:"⫰",middot:"·",minus:"−",minusb:"⊟",minusd:"∸",minusdu:"⨪",mlcp:"⫛",mldr:"…",mnplus:"∓",models:"⊧",mopf:"𝕞",mp:"∓",mscr:"𝓂",mstpos:"∾",mu:"μ",multimap:"⊸",mumap:"⊸",nGg:"⋙̸",nGt:"≫⃒",nGtv:"≫̸",nLeftarrow:"⇍",nLeftrightarrow:"⇎",nLl:"⋘̸",nLt:"≪⃒",nLtv:"≪̸",nRightarrow:"⇏",nVDash:"⊯",nVdash:"⊮",nabla:"∇",nacute:"ń",nang:"∠⃒",nap:"≉",napE:"⩰̸",napid:"≋̸",napos:"ʼn",napprox:"≉",natur:"♮",natural:"♮",naturals:"ℕ",nbsp:" ",nbump:"≎̸",nbumpe:"≏̸",ncap:"⩃",ncaron:"ň",ncedil:"ņ",ncong:"≇",ncongdot:"⩭̸",ncup:"⩂",ncy:"н",ndash:"–",ne:"≠",neArr:"⇗",nearhk:"⤤",nearr:"↗",nearrow:"↗",nedot:"≐̸",nequiv:"≢",nesear:"⤨",nesim:"≂̸",nexist:"∄",nexists:"∄",nfr:"𝔫",ngE:"≧̸",nge:"≱",ngeq:"≱",ngeqq:"≧̸",ngeqslant:"⩾̸",nges:"⩾̸",ngsim:"≵",ngt:"≯",ngtr:"≯",nhArr:"⇎",nharr:"↮",nhpar:"⫲",ni:"∋",nis:"⋼",nisd:"⋺",niv:"∋",njcy:"њ",nlArr:"⇍",nlE:"≦̸",nlarr:"↚",nldr:"‥",nle:"≰",nleftarrow:"↚",nleftrightarrow:"↮",nleq:"≰",nleqq:"≦̸",nleqslant:"⩽̸",nles:"⩽̸",nless:"≮",nlsim:"≴",nlt:"≮",nltri:"⋪",nltrie:"⋬",nmid:"∤",nopf:"𝕟",not:"¬",notin:"∉",notinE:"⋹̸",notindot:"⋵̸",notinva:"∉",notinvb:"⋷",notinvc:"⋶",notni:"∌",notniva:"∌",notnivb:"⋾",notnivc:"⋽",npar:"∦",nparallel:"∦",nparsl:"⫽⃥",npart:"∂̸",npolint:"⨔",npr:"⊀",nprcue:"⋠",npre:"⪯̸",nprec:"⊀",npreceq:"⪯̸",nrArr:"⇏",nrarr:"↛",nrarrc:"⤳̸",nrarrw:"↝̸",nrightarrow:"↛",nrtri:"⋫",nrtrie:"⋭",nsc:"⊁",nsccue:"⋡",nsce:"⪰̸",nscr:"𝓃",nshortmid:"∤",nshortparallel:"∦",nsim:"≁",nsime:"≄",nsimeq:"≄",nsmid:"∤",nspar:"∦",nsqsube:"⋢",nsqsupe:"⋣",nsub:"⊄",nsubE:"⫅̸",nsube:"⊈",nsubset:"⊂⃒",nsubseteq:"⊈",nsubseteqq:"⫅̸",nsucc:"⊁",nsucceq:"⪰̸",nsup:"⊅",nsupE:"⫆̸",nsupe:"⊉",nsupset:"⊃⃒",nsupseteq:"⊉",nsupseteqq:"⫆̸",ntgl:"≹",ntilde:"ñ",ntlg:"≸",ntriangleleft:"⋪",ntrianglelefteq:"⋬",ntriangleright:"⋫",ntrianglerighteq:"⋭",nu:"ν",num:"#",numero:"№",numsp:" ",nvDash:"⊭",nvHarr:"⤄",nvap:"≍⃒",nvdash:"⊬",nvge:"≥⃒",nvgt:">⃒",nvinfin:"⧞",nvlArr:"⤂",nvle:"≤⃒",nvlt:"<⃒",nvltrie:"⊴⃒",nvrArr:"⤃",nvrtrie:"⊵⃒",nvsim:"∼⃒",nwArr:"⇖",nwarhk:"⤣",nwarr:"↖",nwarrow:"↖",nwnear:"⤧",oS:"Ⓢ",oacute:"ó",oast:"⊛",ocir:"⊚",ocirc:"ô",ocy:"о",odash:"⊝",odblac:"ő",odiv:"⨸",odot:"⊙",odsold:"⦼",oelig:"œ",ofcir:"⦿",ofr:"𝔬",ogon:"˛",ograve:"ò",ogt:"⧁",ohbar:"⦵",ohm:"Ω",oint:"∮",olarr:"↺",olcir:"⦾",olcross:"⦻",oline:"‾",olt:"⧀",omacr:"ō",omega:"ω",omicron:"ο",omid:"⦶",ominus:"⊖",oopf:"𝕠",opar:"⦷",operp:"⦹",oplus:"⊕",or:"∨",orarr:"↻",ord:"⩝",order:"ℴ",orderof:"ℴ",ordf:"ª",ordm:"º",origof:"⊶",oror:"⩖",orslope:"⩗",orv:"⩛",oscr:"ℴ",oslash:"ø",osol:"⊘",otilde:"õ",otimes:"⊗",otimesas:"⨶",ouml:"ö",ovbar:"⌽",par:"∥",para:"¶",parallel:"∥",parsim:"⫳",parsl:"⫽",part:"∂",pcy:"п",percnt:"%",period:".",permil:"‰",perp:"⊥",pertenk:"‱",pfr:"𝔭",phi:"φ",phiv:"ϕ",phmmat:"ℳ",phone:"☎",pi:"π",pitchfork:"⋔",piv:"ϖ",planck:"ℏ",planckh:"ℎ",plankv:"ℏ",plus:"+",plusacir:"⨣",plusb:"⊞",pluscir:"⨢",plusdo:"∔",plusdu:"⨥",pluse:"⩲",plusmn:"±",plussim:"⨦",plustwo:"⨧",pm:"±",pointint:"⨕",popf:"𝕡",pound:"£",pr:"≺",prE:"⪳",prap:"⪷",prcue:"≼",pre:"⪯",prec:"≺",precapprox:"⪷",preccurlyeq:"≼",preceq:"⪯",precnapprox:"⪹",precneqq:"⪵",precnsim:"⋨",precsim:"≾",prime:"′",primes:"ℙ",prnE:"⪵",prnap:"⪹",prnsim:"⋨",prod:"∏",profalar:"⌮",profline:"⌒",profsurf:"⌓",prop:"∝",propto:"∝",prsim:"≾",prurel:"⊰",pscr:"𝓅",psi:"ψ",puncsp:" ",qfr:"𝔮",qint:"⨌",qopf:"𝕢",qprime:"⁗",qscr:"𝓆",quaternions:"ℍ",quatint:"⨖",quest:"?",questeq:"≟",quot:'"',rAarr:"⇛",rArr:"⇒",rAtail:"⤜",rBarr:"⤏",rHar:"⥤",race:"∽̱",racute:"ŕ",radic:"√",raemptyv:"⦳",rang:"⟩",rangd:"⦒",range:"⦥",rangle:"⟩",raquo:"»",rarr:"→",rarrap:"⥵",rarrb:"⇥",rarrbfs:"⤠",rarrc:"⤳",rarrfs:"⤞",rarrhk:"↪",rarrlp:"↬",rarrpl:"⥅",rarrsim:"⥴",rarrtl:"↣",rarrw:"↝",ratail:"⤚",ratio:"∶",rationals:"ℚ",rbarr:"⤍",rbbrk:"❳",rbrace:"}",rbrack:"]",rbrke:"⦌",rbrksld:"⦎",rbrkslu:"⦐",rcaron:"ř",rcedil:"ŗ",rceil:"⌉",rcub:"}",rcy:"р",rdca:"⤷",rdldhar:"⥩",rdquo:"”",rdquor:"”",rdsh:"↳",real:"ℜ",realine:"ℛ",realpart:"ℜ",reals:"ℝ",rect:"▭",reg:"®",rfisht:"⥽",rfloor:"⌋",rfr:"𝔯",rhard:"⇁",rharu:"⇀",rharul:"⥬",rho:"ρ",rhov:"ϱ",rightarrow:"→",rightarrowtail:"↣",rightharpoondown:"⇁",rightharpoonup:"⇀",rightleftarrows:"⇄",rightleftharpoons:"⇌",rightrightarrows:"⇉",rightsquigarrow:"↝",rightthreetimes:"⋌",ring:"˚",risingdotseq:"≓",rlarr:"⇄",rlhar:"⇌",rlm:"",rmoust:"⎱",rmoustache:"⎱",rnmid:"⫮",roang:"⟭",roarr:"⇾",robrk:"⟧",ropar:"⦆",ropf:"𝕣",roplus:"⨮",rotimes:"⨵",rpar:")",rpargt:"⦔",rppolint:"⨒",rrarr:"⇉",rsaquo:"›",rscr:"𝓇",rsh:"↱",rsqb:"]",rsquo:"’",rsquor:"’",rthree:"⋌",rtimes:"⋊",rtri:"▹",rtrie:"⊵",rtrif:"▸",rtriltri:"⧎",ruluhar:"⥨",rx:"℞",sacute:"ś",sbquo:"‚",sc:"≻",scE:"⪴",scap:"⪸",scaron:"š",sccue:"≽",sce:"⪰",scedil:"ş",scirc:"ŝ",scnE:"⪶",scnap:"⪺",scnsim:"⋩",scpolint:"⨓",scsim:"≿",scy:"с",sdot:"⋅",sdotb:"⊡",sdote:"⩦",seArr:"⇘",searhk:"⤥",searr:"↘",searrow:"↘",sect:"§",semi:";",seswar:"⤩",setminus:"∖",setmn:"∖",sext:"✶",sfr:"𝔰",sfrown:"⌢",sharp:"♯",shchcy:"щ",shcy:"ш",shortmid:"∣",shortparallel:"∥",shy:"",sigma:"σ",sigmaf:"ς",sigmav:"ς",sim:"∼",simdot:"⩪",sime:"≃",simeq:"≃",simg:"⪞",simgE:"⪠",siml:"⪝",simlE:"⪟",simne:"≆",simplus:"⨤",simrarr:"⥲",slarr:"←",smallsetminus:"∖",smashp:"⨳",smeparsl:"⧤",smid:"∣",smile:"⌣",smt:"⪪",smte:"⪬",smtes:"⪬︀",softcy:"ь",sol:"/",solb:"⧄",solbar:"⌿",sopf:"𝕤",spades:"♠",spadesuit:"♠",spar:"∥",sqcap:"⊓",sqcaps:"⊓︀",sqcup:"⊔",sqcups:"⊔︀",sqsub:"⊏",sqsube:"⊑",sqsubset:"⊏",sqsubseteq:"⊑",sqsup:"⊐",sqsupe:"⊒",sqsupset:"⊐",sqsupseteq:"⊒",squ:"□",square:"□",squarf:"▪",squf:"▪",srarr:"→",sscr:"𝓈",ssetmn:"∖",ssmile:"⌣",sstarf:"⋆",star:"☆",starf:"★",straightepsilon:"ϵ",straightphi:"ϕ",strns:"¯",sub:"⊂",subE:"⫅",subdot:"⪽",sube:"⊆",subedot:"⫃",submult:"⫁",subnE:"⫋",subne:"⊊",subplus:"⪿",subrarr:"⥹",subset:"⊂",subseteq:"⊆",subseteqq:"⫅",subsetneq:"⊊",subsetneqq:"⫋",subsim:"⫇",subsub:"⫕",subsup:"⫓",succ:"≻",succapprox:"⪸",succcurlyeq:"≽",succeq:"⪰",succnapprox:"⪺",succneqq:"⪶",succnsim:"⋩",succsim:"≿",sum:"∑",sung:"♪",sup1:"¹",sup2:"²",sup3:"³",sup:"⊃",supE:"⫆",supdot:"⪾",supdsub:"⫘",supe:"⊇",supedot:"⫄",suphsol:"⟉",suphsub:"⫗",suplarr:"⥻",supmult:"⫂",supnE:"⫌",supne:"⊋",supplus:"⫀",supset:"⊃",supseteq:"⊇",supseteqq:"⫆",supsetneq:"⊋",supsetneqq:"⫌",supsim:"⫈",supsub:"⫔",supsup:"⫖",swArr:"⇙",swarhk:"⤦",swarr:"↙",swarrow:"↙",swnwar:"⤪",szlig:"ß",target:"⌖",tau:"τ",tbrk:"⎴",tcaron:"ť",tcedil:"ţ",tcy:"т",tdot:"⃛",telrec:"⌕",tfr:"𝔱",there4:"∴",therefore:"∴",theta:"θ",thetasym:"ϑ",thetav:"ϑ",thickapprox:"≈",thicksim:"∼",thinsp:" ",thkap:"≈",thksim:"∼",thorn:"þ",tilde:"˜",times:"×",timesb:"⊠",timesbar:"⨱",timesd:"⨰",tint:"∭",toea:"⤨",top:"⊤",topbot:"⌶",topcir:"⫱",topf:"𝕥",topfork:"⫚",tosa:"⤩",tprime:"‴",trade:"™",triangle:"▵",triangledown:"▿",triangleleft:"◃",trianglelefteq:"⊴",triangleq:"≜",triangleright:"▹",trianglerighteq:"⊵",tridot:"◬",trie:"≜",triminus:"⨺",triplus:"⨹",trisb:"⧍",tritime:"⨻",trpezium:"⏢",tscr:"𝓉",tscy:"ц",tshcy:"ћ",tstrok:"ŧ",twixt:"≬",twoheadleftarrow:"↞",twoheadrightarrow:"↠",uArr:"⇑",uHar:"⥣",uacute:"ú",uarr:"↑",ubrcy:"ў",ubreve:"ŭ",ucirc:"û",ucy:"у",udarr:"⇅",udblac:"ű",udhar:"⥮",ufisht:"⥾",ufr:"𝔲",ugrave:"ù",uharl:"↿",uharr:"↾",uhblk:"▀",ulcorn:"⌜",ulcorner:"⌜",ulcrop:"⌏",ultri:"◸",umacr:"ū",uml:"¨",uogon:"ų",uopf:"𝕦",uparrow:"↑",updownarrow:"↕",upharpoonleft:"↿",upharpoonright:"↾",uplus:"⊎",upsi:"υ",upsih:"ϒ",upsilon:"υ",upuparrows:"⇈",urcorn:"⌝",urcorner:"⌝",urcrop:"⌎",uring:"ů",urtri:"◹",uscr:"𝓊",utdot:"⋰",utilde:"ũ",utri:"▵",utrif:"▴",uuarr:"⇈",uuml:"ü",uwangle:"⦧",vArr:"⇕",vBar:"⫨",vBarv:"⫩",vDash:"⊨",vangrt:"⦜",varepsilon:"ϵ",varkappa:"ϰ",varnothing:"∅",varphi:"ϕ",varpi:"ϖ",varpropto:"∝",varr:"↕",varrho:"ϱ",varsigma:"ς",varsubsetneq:"⊊︀",varsubsetneqq:"⫋︀",varsupsetneq:"⊋︀",varsupsetneqq:"⫌︀",vartheta:"ϑ",vartriangleleft:"⊲",vartriangleright:"⊳",vcy:"в",vdash:"⊢",vee:"∨",veebar:"⊻",veeeq:"≚",vellip:"⋮",verbar:"|",vert:"|",vfr:"𝔳",vltri:"⊲",vnsub:"⊂⃒",vnsup:"⊃⃒",vopf:"𝕧",vprop:"∝",vrtri:"⊳",vscr:"𝓋",vsubnE:"⫋︀",vsubne:"⊊︀",vsupnE:"⫌︀",vsupne:"⊋︀",vzigzag:"⦚",wcirc:"ŵ",wedbar:"⩟",wedge:"∧",wedgeq:"≙",weierp:"℘",wfr:"𝔴",wopf:"𝕨",wp:"℘",wr:"≀",wreath:"≀",wscr:"𝓌",xcap:"⋂",xcirc:"◯",xcup:"⋃",xdtri:"▽",xfr:"𝔵",xhArr:"⟺",xharr:"⟷",xi:"ξ",xlArr:"⟸",xlarr:"⟵",xmap:"⟼",xnis:"⋻",xodot:"⨀",xopf:"𝕩",xoplus:"⨁",xotime:"⨂",xrArr:"⟹",xrarr:"⟶",xscr:"𝓍",xsqcup:"⨆",xuplus:"⨄",xutri:"△",xvee:"⋁",xwedge:"⋀",yacute:"ý",yacy:"я",ycirc:"ŷ",ycy:"ы",yen:"¥",yfr:"𝔶",yicy:"ї",yopf:"𝕪",yscr:"𝓎",yucy:"ю",yuml:"ÿ",zacute:"ź",zcaron:"ž",zcy:"з",zdot:"ż",zeetrf:"ℨ",zeta:"ζ",zfr:"𝔷",zhcy:"ж",zigrarr:"⇝",zopf:"𝕫",zscr:"𝓏",zwj:"",zwnj:""},Md={}.hasOwnProperty;function Me(a){return!!Md.call(Mc,a)&&Mc[a]}let Mf={name:"characterReference",tokenize:function(a,b,c){let d,e,f=this,g=0;return function(b){return a.enter("characterReference"),a.enter("characterReferenceMarker"),a.consume(b),a.exit("characterReferenceMarker"),h};function h(b){return 35===b?(a.enter("characterReferenceMarkerNumeric"),a.consume(b),a.exit("characterReferenceMarkerNumeric"),i):(a.enter("characterReferenceValue"),d=31,e=LI,j(b))}function i(b){return 88===b||120===b?(a.enter("characterReferenceMarkerHexadecimal"),a.consume(b),a.exit("characterReferenceMarkerHexadecimal"),a.enter("characterReferenceValue"),d=6,e=LL,j):(a.enter("characterReferenceValue"),d=7,e=LK,j(b))}function j(h){if(59===h&&g){let d=a.exit("characterReferenceValue");return e!==LI||Me(f.sliceSerialize(d))?(a.enter("characterReferenceMarker"),a.consume(h),a.exit("characterReferenceMarker"),a.exit("characterReference"),b):c(h)}return e(h)&&g++<d?(a.consume(h),j):c(h)}}},Mg={partial:!0,tokenize:function(a,b,c){let d=this;return function(b){return null===b?c(b):(a.enter("lineEnding"),a.consume(b),a.exit("lineEnding"),e)};function e(a){return d.parser.lazy[d.now().line]?c(a):b(a)}}},Mh={concrete:!0,name:"codeFenced",tokenize:function(a,b,c){let d,e=this,f={partial:!0,tokenize:function(a,b,c){let f=0;return function(b){return a.enter("lineEnding"),a.consume(b),a.exit("lineEnding"),g};function g(b){return a.enter("codeFencedFence"),LP(b)?LR(a,i,"linePrefix",e.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(b):i(b)}function i(b){return b===d?(a.enter("codeFencedFenceSequence"),function b(e){return e===d?(f++,a.consume(e),b):f>=h?(a.exit("codeFencedFenceSequence"),LP(e)?LR(a,j,"whitespace")(e):j(e)):c(e)}(b)):c(b)}function j(d){return null===d||LN(d)?(a.exit("codeFencedFence"),b(d)):c(d)}}},g=0,h=0;return function(b){var f;let j;return f=b,g=(j=e.events[e.events.length-1])&&"linePrefix"===j[1].type?j[2].sliceSerialize(j[1],!0).length:0,d=f,a.enter("codeFenced"),a.enter("codeFencedFence"),a.enter("codeFencedFenceSequence"),function b(e){return e===d?(h++,a.consume(e),b):h<3?c(e):(a.exit("codeFencedFenceSequence"),LP(e)?LR(a,i,"whitespace")(e):i(e))}(f)};function i(f){return null===f||LN(f)?(a.exit("codeFencedFence"),e.interrupt?b(f):a.check(Mg,k,p)(f)):(a.enter("codeFencedFenceInfo"),a.enter("chunkString",{contentType:"string"}),function b(e){return null===e||LN(e)?(a.exit("chunkString"),a.exit("codeFencedFenceInfo"),i(e)):LP(e)?(a.exit("chunkString"),a.exit("codeFencedFenceInfo"),LR(a,j,"whitespace")(e)):96===e&&e===d?c(e):(a.consume(e),b)}(f))}function j(b){return null===b||LN(b)?i(b):(a.enter("codeFencedFenceMeta"),a.enter("chunkString",{contentType:"string"}),function b(e){return null===e||LN(e)?(a.exit("chunkString"),a.exit("codeFencedFenceMeta"),i(e)):96===e&&e===d?c(e):(a.consume(e),b)}(b))}function k(b){return a.attempt(f,p,l)(b)}function l(b){return a.enter("lineEnding"),a.consume(b),a.exit("lineEnding"),n}function n(b){return g>0&&LP(b)?LR(a,o,"linePrefix",g+1)(b):o(b)}function o(b){return null===b||LN(b)?a.check(Mg,k,p)(b):(a.enter("codeFlowValue"),function b(c){return null===c||LN(c)?(a.exit("codeFlowValue"),o(c)):(a.consume(c),b)}(b))}function p(c){return a.exit("codeFenced"),b(c)}}},Mi={name:"codeIndented",tokenize:function(a,b,c){let d=this;return function(b){return a.enter("codeIndented"),LR(a,e,"linePrefix",5)(b)};function e(b){let e=d.events[d.events.length-1];return e&&"linePrefix"===e[1].type&&e[2].sliceSerialize(e[1],!0).length>=4?function b(c){return null===c?f(c):LN(c)?a.attempt(Mj,b,f)(c):(a.enter("codeFlowValue"),function c(d){return null===d||LN(d)?(a.exit("codeFlowValue"),b(d)):(a.consume(d),c)}(c))}(b):c(b)}function f(c){return a.exit("codeIndented"),b(c)}}},Mj={partial:!0,tokenize:function(a,b,c){let d=this;return e;function e(b){return d.parser.lazy[d.now().line]?c(b):LN(b)?(a.enter("lineEnding"),a.consume(b),a.exit("lineEnding"),e):LR(a,f,"linePrefix",5)(b)}function f(a){let f=d.events[d.events.length-1];return f&&"linePrefix"===f[1].type&&f[2].sliceSerialize(f[1],!0).length>=4?b(a):LN(a)?e(a):c(a)}}};function Mk(a){return null!==a&&(a<32||127===a)}function Ml(a){return function(b){return null!==b&&b>-1&&a.test(String.fromCharCode(b))}}function Mm(a,b,c,d,e,f,g,h,i){let j=i||1/0,k=0;return function(b){return 60===b?(a.enter(d),a.enter(e),a.enter(f),a.consume(b),a.exit(f),l):null===b||32===b||41===b||Mk(b)?c(b):(a.enter(d),a.enter(g),a.enter(h),a.enter("chunkString",{contentType:"string"}),p(b))};function l(c){return 62===c?(a.enter(f),a.consume(c),a.exit(f),a.exit(e),a.exit(d),b):(a.enter(h),a.enter("chunkString",{contentType:"string"}),n(c))}function n(b){return 62===b?(a.exit("chunkString"),a.exit(h),l(b)):null===b||60===b||null!==b&&b<-2?c(b):(a.consume(b),92===b?o:n)}function o(b){return 60===b||62===b||92===b?(a.consume(b),n):n(b)}function p(e){return!k&&(null===e||41===e||null!==e&&(e<0||32===e))?(a.exit("chunkString"),a.exit(h),a.exit(g),a.exit(d),b(e)):k<j&&40===e?(a.consume(e),k++,p):41===e?(a.consume(e),k--,p):null===e||32===e||40===e||Mk(e)?c(e):(a.consume(e),92===e?q:p)}function q(b){return 40===b||41===b||92===b?(a.consume(b),p):p(b)}}function Mn(a){return null!==a&&a<-2}function Mo(a){return function(b){return null!==b&&b>-1&&a.test(String.fromCharCode(b))}}function Mp(a,b,c,d,e,f){let g,h=this,i=0;return function(b){return a.enter(d),a.enter(e),a.consume(b),a.exit(e),a.enter(f),j};function j(l){return i>999||null===l||91===l||93===l&&!g||94===l&&!i&&"_hiddenFootnoteSupport"in h.parser.constructs?c(l):93===l?(a.exit(f),a.enter(e),a.consume(l),a.exit(e),a.exit(d),b):Mn(l)?(a.enter("lineEnding"),a.consume(l),a.exit("lineEnding"),j):(a.enter("chunkString",{contentType:"string"}),k(l))}function k(b){return null===b||91===b||93===b||Mn(b)||i++>999?(a.exit("chunkString"),j(b)):(a.consume(b),g||(g=-2!==b&&-1!==b&&32!==b),92===b?l:k)}function l(b){return 91===b||92===b||93===b?(a.consume(b),i++,k):k(b)}}function Mq(a){return null!==a&&a<-2}function Mr(a){return -2===a||-1===a||32===a}function Ms(a){return function(b){return null!==b&&b>-1&&a.test(String.fromCharCode(b))}}function Mt(a,b,c,d,e,f){let g;return function(b){return 34===b||39===b||40===b?(a.enter(d),a.enter(e),a.consume(b),a.exit(e),g=40===b?41:b,h):c(b)};function h(c){return c===g?(a.enter(e),a.consume(c),a.exit(e),a.exit(d),b):(a.enter(f),i(c))}function i(b){if(b===g)return a.exit(f),h(g);if(null===b)return c(b);if(Mq(b)){var d,e;let c,f;return a.enter("lineEnding"),a.consume(b),a.exit("lineEnding"),d=i,e="linePrefix",c=1/0,f=0,function(b){return Mr(b)?(a.enter(e),function b(g){return Mr(g)&&f++<c?(a.consume(g),b):(a.exit(e),d(g))}(b)):d(b)}}return a.enter("chunkString",{contentType:"string"}),j(b)}function j(b){return b===g||null===b||Mq(b)?(a.exit("chunkString"),i(b)):(a.consume(b),92===b?k:j)}function k(b){return b===g||92===b?(a.consume(b),j):j(b)}}function Mu(a){return -2===a||-1===a||32===a}function Mv(a){return function(b){return null!==b&&b>-1&&a.test(String.fromCharCode(b))}}function Mw(a,b){let c;return function d(e){var f,g;if(null!==e&&e<-2)return a.enter("lineEnding"),a.consume(e),a.exit("lineEnding"),c=!0,d;if(Mu(e)){let b,h;return(f=d,g=c?"linePrefix":"lineSuffix",b=1/0,h=0,function(c){return Mu(c)?(a.enter(g),function c(d){return Mu(d)&&h++<b?(a.consume(d),c):(a.exit(g),f(d))}(c)):f(c)})(e)}return b(e)}}function Mx(a){return a.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}Ml(/[A-Za-z]/),Ml(/[\dA-Za-z]/),Ml(/[#-'*+\--9=?A-Z^-~]/),Ml(/\d/),Ml(/[\dA-Fa-f]/),Ml(/[!-/:-@[-`{-~]/),Ml(/\p{P}|\p{S}/u),Ml(/\s/),Mo(/[A-Za-z]/),Mo(/[\dA-Za-z]/),Mo(/[#-'*+\--9=?A-Z^-~]/),Mo(/\d/),Mo(/[\dA-Fa-f]/),Mo(/[!-/:-@[-`{-~]/),Mo(/\p{P}|\p{S}/u),Mo(/\s/),Ms(/[A-Za-z]/),Ms(/[\dA-Za-z]/),Ms(/[#-'*+\--9=?A-Z^-~]/),Ms(/\d/),Ms(/[\dA-Fa-f]/),Ms(/[!-/:-@[-`{-~]/),Ms(/\p{P}|\p{S}/u),Ms(/\s/),Mv(/[A-Za-z]/),Mv(/[\dA-Za-z]/),Mv(/[#-'*+\--9=?A-Z^-~]/),Mv(/\d/),Mv(/[\dA-Fa-f]/),Mv(/[!-/:-@[-`{-~]/),Mv(/\p{P}|\p{S}/u),Mv(/\s/);let My={partial:!0,tokenize:function(a,b,c){return function(b){return LO(b)?Mw(a,d)(b):c(b)};function d(b){return Mt(a,e,c,"definitionTitle","definitionTitleMarker","definitionTitleString")(b)}function e(b){return LP(b)?LR(a,f,"whitespace")(b):f(b)}function f(a){return null===a||LN(a)?b(a):c(a)}}},Mz=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],MA=["pre","script","style","textarea"],MB={partial:!0,tokenize:function(a,b,c){return function(d){return a.enter("lineEnding"),a.consume(d),a.exit("lineEnding"),a.attempt(LS,b,c)}}},MC={partial:!0,tokenize:function(a,b,c){let d=this;return function(b){return LN(b)?(a.enter("lineEnding"),a.consume(b),a.exit("lineEnding"),e):c(b)};function e(a){return d.parser.lazy[d.now().line]?c(a):b(a)}}},MD={name:"labelEnd",resolveAll:function(a){let b=-1,c=[];for(;++b<a.length;){let d=a[b][1];if(c.push(a[b]),"labelImage"===d.type||"labelLink"===d.type||"labelEnd"===d.type){let a="labelImage"===d.type?4:2;d.type="data",b+=a}}return a.length!==c.length&&Lw(a,0,a.length,c),a},resolveTo:function(a,b){let c,d,e,f,g=a.length,h=0;for(;g--;)if(c=a[g][1],d){if("link"===c.type||"labelLink"===c.type&&c._inactive)break;"enter"===a[g][0]&&"labelLink"===c.type&&(c._inactive=!0)}else if(e){if("enter"===a[g][0]&&("labelImage"===c.type||"labelLink"===c.type)&&!c._balanced&&(d=g,"labelLink"!==c.type)){h=2;break}}else"labelEnd"===c.type&&(e=g);let i={type:"labelLink"===a[d][1].type?"link":"image",start:{...a[d][1].start},end:{...a[a.length-1][1].end}},j={type:"label",start:{...a[d][1].start},end:{...a[e][1].end}},k={type:"labelText",start:{...a[d+h+2][1].end},end:{...a[e-2][1].start}};return f=Lx(f=[["enter",i,b],["enter",j,b]],a.slice(d+1,d+h+3)),f=Lx(f,[["enter",k,b]]),f=Lx(f,L7(b.parser.constructs.insideSpan.null,a.slice(d+h+4,e-3),b)),f=Lx(f,[["exit",k,b],a[e-2],a[e-1],["exit",j,b]]),f=Lx(f,a.slice(e+1)),f=Lx(f,[["exit",i,b]]),Lw(a,d,a.length,f),a},tokenize:function(a,b,c){let d,e,f=this,g=f.events.length;for(;g--;)if(("labelImage"===f.events[g][1].type||"labelLink"===f.events[g][1].type)&&!f.events[g][1]._balanced){d=f.events[g][1];break}return function(b){return d?d._inactive?k(b):(e=f.parser.defined.includes(Mx(f.sliceSerialize({start:d.end,end:f.now()}))),a.enter("labelEnd"),a.enter("labelMarker"),a.consume(b),a.exit("labelMarker"),a.exit("labelEnd"),h):c(b)};function h(b){return 40===b?a.attempt(ME,j,e?j:k)(b):91===b?a.attempt(MF,j,e?i:k)(b):e?j(b):k(b)}function i(b){return a.attempt(MG,j,k)(b)}function j(a){return b(a)}function k(a){return d._balanced=!0,c(a)}}},ME={tokenize:function(a,b,c){return function(b){return a.enter("resource"),a.enter("resourceMarker"),a.consume(b),a.exit("resourceMarker"),d};function d(b){return LO(b)?Mw(a,e)(b):e(b)}function e(b){return 41===b?j(b):Mm(a,f,g,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(b)}function f(b){return LO(b)?Mw(a,h)(b):j(b)}function g(a){return c(a)}function h(b){return 34===b||39===b||40===b?Mt(a,i,c,"resourceTitle","resourceTitleMarker","resourceTitleString")(b):j(b)}function i(b){return LO(b)?Mw(a,j)(b):j(b)}function j(d){return 41===d?(a.enter("resourceMarker"),a.consume(d),a.exit("resourceMarker"),a.exit("resource"),b):c(d)}}},MF={tokenize:function(a,b,c){let d=this;return function(b){return Mp.call(d,a,e,f,"reference","referenceMarker","referenceString")(b)};function e(a){return d.parser.defined.includes(Mx(d.sliceSerialize(d.events[d.events.length-1][1]).slice(1,-1)))?b(a):c(a)}function f(a){return c(a)}}},MG={tokenize:function(a,b,c){return function(b){return a.enter("reference"),a.enter("referenceMarker"),a.consume(b),a.exit("referenceMarker"),d};function d(d){return 93===d?(a.enter("referenceMarker"),a.consume(d),a.exit("referenceMarker"),a.exit("reference"),b):c(d)}}},MH={name:"labelStartImage",resolveAll:MD.resolveAll,tokenize:function(a,b,c){let d=this;return function(b){return a.enter("labelImage"),a.enter("labelImageMarker"),a.consume(b),a.exit("labelImageMarker"),e};function e(b){return 91===b?(a.enter("labelMarker"),a.consume(b),a.exit("labelMarker"),a.exit("labelImage"),f):c(b)}function f(a){return 94===a&&"_hiddenFootnoteSupport"in d.parser.constructs?c(a):b(a)}}},MI={name:"labelStartLink",resolveAll:MD.resolveAll,tokenize:function(a,b,c){let d=this;return function(b){return a.enter("labelLink"),a.enter("labelMarker"),a.consume(b),a.exit("labelMarker"),a.exit("labelLink"),e};function e(a){return 94===a&&"_hiddenFootnoteSupport"in d.parser.constructs?c(a):b(a)}}},MJ={name:"lineEnding",tokenize:function(a,b){return function(c){return a.enter("lineEnding"),a.consume(c),a.exit("lineEnding"),LR(a,b,"linePrefix")}}},MK={name:"thematicBreak",tokenize:function(a,b,c){let d,e=0;return function(f){var g;return a.enter("thematicBreak"),d=g=f,function f(g){return g===d?(a.enter("thematicBreakSequence"),function b(c){return c===d?(a.consume(c),e++,b):(a.exit("thematicBreakSequence"),LP(c)?LR(a,f,"whitespace")(c):f(c))}(g)):e>=3&&(null===g||LN(g))?(a.exit("thematicBreak"),b(g)):c(g)}(g)}}},ML={continuation:{tokenize:function(a,b,c){let d=this;return d.containerState._closeFlow=void 0,a.check(LS,function(c){return d.containerState.furtherBlankLines=d.containerState.furtherBlankLines||d.containerState.initialBlankLine,LR(a,b,"listItemIndent",d.containerState.size+1)(c)},function(c){return d.containerState.furtherBlankLines||!LP(c)?(d.containerState.furtherBlankLines=void 0,d.containerState.initialBlankLine=void 0,e(c)):(d.containerState.furtherBlankLines=void 0,d.containerState.initialBlankLine=void 0,a.attempt(MN,b,e)(c))});function e(e){return d.containerState._closeFlow=!0,d.interrupt=void 0,LR(a,a.attempt(ML,b,c),"linePrefix",d.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(e)}}},exit:function(a){a.exit(this.containerState.type)},name:"list",tokenize:function(a,b,c){let d=this,e=d.events[d.events.length-1],f=e&&"linePrefix"===e[1].type?e[2].sliceSerialize(e[1],!0).length:0,g=0;return function(b){let e=d.containerState.type||(42===b||43===b||45===b?"listUnordered":"listOrdered");if("listUnordered"===e?!d.containerState.marker||b===d.containerState.marker:LK(b)){if(d.containerState.type||(d.containerState.type=e,a.enter(e,{_container:!0})),"listUnordered"===e)return a.enter("listItemPrefix"),42===b||45===b?a.check(MK,c,h)(b):h(b);if(!d.interrupt||49===b)return a.enter("listItemPrefix"),a.enter("listItemValue"),function b(e){return LK(e)&&++g<10?(a.consume(e),b):(!d.interrupt||g<2)&&(d.containerState.marker?e===d.containerState.marker:41===e||46===e)?(a.exit("listItemValue"),h(e)):c(e)}(b)}return c(b)};function h(b){return a.enter("listItemMarker"),a.consume(b),a.exit("listItemMarker"),d.containerState.marker=d.containerState.marker||b,a.check(LS,d.interrupt?c:i,a.attempt(MM,k,j))}function i(a){return d.containerState.initialBlankLine=!0,f++,k(a)}function j(b){return LP(b)?(a.enter("listItemPrefixWhitespace"),a.consume(b),a.exit("listItemPrefixWhitespace"),k):c(b)}function k(c){return d.containerState.size=f+d.sliceSerialize(a.exit("listItemPrefix"),!0).length,b(c)}}},MM={partial:!0,tokenize:function(a,b,c){let d=this;return LR(a,function(a){let e=d.events[d.events.length-1];return!LP(a)&&e&&"listItemPrefixWhitespace"===e[1].type?b(a):c(a)},"listItemPrefixWhitespace",d.parser.constructs.disable.null.includes("codeIndented")?void 0:5)}},MN={partial:!0,tokenize:function(a,b,c){let d=this;return LR(a,function(a){let e=d.events[d.events.length-1];return e&&"listItemIndent"===e[1].type&&e[2].sliceSerialize(e[1],!0).length===d.containerState.size?b(a):c(a)},"listItemIndent",d.containerState.size+1)}},MO={name:"setextUnderline",resolveTo:function(a,b){let c,d,e,f=a.length;for(;f--;)if("enter"===a[f][0]){if("content"===a[f][1].type){c=f;break}"paragraph"===a[f][1].type&&(d=f)}else"content"===a[f][1].type&&a.splice(f,1),e||"definition"!==a[f][1].type||(e=f);let g={type:"setextHeading",start:{...a[c][1].start},end:{...a[a.length-1][1].end}};return a[d][1].type="setextHeadingText",e?(a.splice(d,0,["enter",g,b]),a.splice(e+1,0,["exit",a[c][1],b]),a[c][1].end={...a[e][1].end}):a[c][1]=g,a.push(["exit",g,b]),a},tokenize:function(a,b,c){let d,e=this;return function(b){var g;let h,i=e.events.length;for(;i--;)if("lineEnding"!==e.events[i][1].type&&"linePrefix"!==e.events[i][1].type&&"content"!==e.events[i][1].type){h="paragraph"===e.events[i][1].type;break}return!e.parser.lazy[e.now().line]&&(e.interrupt||h)?(a.enter("setextHeadingLine"),d=b,g=b,a.enter("setextHeadingLineSequence"),function b(c){return c===d?(a.consume(c),b):(a.exit("setextHeadingLineSequence"),LP(c)?LR(a,f,"lineSuffix")(c):f(c))}(g)):c(b)};function f(d){return null===d||LN(d)?(a.exit("setextHeadingLine"),b(d)):c(d)}}};a.s(["attentionMarkers",0,{null:[42,95]},"contentInitial",0,{91:{name:"definition",tokenize:function(a,b,c){let d,e=this;return function(b){var d;return a.enter("definition"),d=b,Mp.call(e,a,f,c,"definitionLabel","definitionLabelMarker","definitionLabelString")(d)};function f(b){return(d=Mx(e.sliceSerialize(e.events[e.events.length-1][1]).slice(1,-1)),58===b)?(a.enter("definitionMarker"),a.consume(b),a.exit("definitionMarker"),g):c(b)}function g(b){return LO(b)?Mw(a,h)(b):h(b)}function h(b){return Mm(a,i,c,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(b)}function i(b){return a.attempt(My,j,j)(b)}function j(b){return LP(b)?LR(a,k,"whitespace")(b):k(b)}function k(f){return null===f||LN(f)?(a.exit("definition"),e.parser.defined.push(d),b(f)):c(f)}}}},"disable",0,{null:[]},"document",0,{42:ML,43:ML,45:ML,48:ML,49:ML,50:ML,51:ML,52:ML,53:ML,54:ML,55:ML,56:ML,57:ML,62:Ma},"flow",0,{35:{name:"headingAtx",resolve:function(a,b){let c,d,e=a.length-2,f=3;return"whitespace"===a[3][1].type&&(f+=2),e-2>f&&"whitespace"===a[e][1].type&&(e-=2),"atxHeadingSequence"===a[e][1].type&&(f===e-1||e-4>f&&"whitespace"===a[e-2][1].type)&&(e-=f+1===e?2:4),e>f&&(c={type:"atxHeadingText",start:a[f][1].start,end:a[e][1].end},d={type:"chunkText",start:a[f][1].start,end:a[e][1].end,contentType:"text"},Lw(a,f,e-f+1,[["enter",c,b],["enter",d,b],["exit",d,b],["exit",c,b]])),a},tokenize:function(a,b,c){let d=0;return function(e){var f;return a.enter("atxHeading"),f=e,a.enter("atxHeadingSequence"),function e(f){return 35===f&&d++<6?(a.consume(f),e):null===f||LO(f)?(a.exit("atxHeadingSequence"),function c(d){return 35===d?(a.enter("atxHeadingSequence"),function b(d){return 35===d?(a.consume(d),b):(a.exit("atxHeadingSequence"),c(d))}(d)):null===d||LN(d)?(a.exit("atxHeading"),b(d)):LP(d)?LR(a,c,"whitespace")(d):(a.enter("atxHeadingText"),function b(d){return null===d||35===d||LO(d)?(a.exit("atxHeadingText"),c(d)):(a.consume(d),b)}(d))}(f)):c(f)}(f)}}},42:MK,45:[MO,MK],60:{concrete:!0,name:"htmlFlow",resolveTo:function(a){let b=a.length;for(;b--&&("enter"!==a[b][0]||"htmlFlow"!==a[b][1].type););return b>1&&"linePrefix"===a[b-2][1].type&&(a[b][1].start=a[b-2][1].start,a[b+1][1].start=a[b-2][1].start,a.splice(b-2,2)),a},tokenize:function(a,b,c){let d,e,f,g,h,i=this;return function(b){var c;return c=b,a.enter("htmlFlow"),a.enter("htmlFlowData"),a.consume(c),j};function j(g){return 33===g?(a.consume(g),k):47===g?(a.consume(g),e=!0,o):63===g?(a.consume(g),d=3,i.interrupt?b:H):LH(g)?(a.consume(g),f=String.fromCharCode(g),p):c(g)}function k(e){return 45===e?(a.consume(e),d=2,l):91===e?(a.consume(e),d=5,g=0,n):LH(e)?(a.consume(e),d=4,i.interrupt?b:H):c(e)}function l(d){return 45===d?(a.consume(d),i.interrupt?b:H):c(d)}function n(d){let e="CDATA[";return d===e.charCodeAt(g++)?(a.consume(d),g===e.length)?i.interrupt?b:z:n:c(d)}function o(b){return LH(b)?(a.consume(b),f=String.fromCharCode(b),p):c(b)}function p(g){if(null===g||47===g||62===g||LO(g)){let h=47===g,j=f.toLowerCase();return!h&&!e&&MA.includes(j)?(d=1,i.interrupt?b(g):z(g)):Mz.includes(f.toLowerCase())?(d=6,h)?(a.consume(g),q):i.interrupt?b(g):z(g):(d=7,i.interrupt&&!i.parser.lazy[i.now().line]?c(g):e?function b(c){return LP(c)?(a.consume(c),b):x(c)}(g):r(g))}return 45===g||LI(g)?(a.consume(g),f+=String.fromCharCode(g),p):c(g)}function q(d){return 62===d?(a.consume(d),i.interrupt?b:z):c(d)}function r(b){return 47===b?(a.consume(b),x):58===b||95===b||LH(b)?(a.consume(b),s):LP(b)?(a.consume(b),r):x(b)}function s(b){return 45===b||46===b||58===b||95===b||LI(b)?(a.consume(b),s):t(b)}function t(b){return 61===b?(a.consume(b),u):LP(b)?(a.consume(b),t):r(b)}function u(b){return null===b||60===b||61===b||62===b||96===b?c(b):34===b||39===b?(a.consume(b),h=b,v):LP(b)?(a.consume(b),u):function b(c){return null===c||34===c||39===c||47===c||60===c||61===c||62===c||96===c||LO(c)?t(c):(a.consume(c),b)}(b)}function v(b){return b===h?(a.consume(b),h=null,w):null===b||LN(b)?c(b):(a.consume(b),v)}function w(a){return 47===a||62===a||LP(a)?r(a):c(a)}function x(b){return 62===b?(a.consume(b),y):c(b)}function y(b){return null===b||LN(b)?z(b):LP(b)?(a.consume(b),y):c(b)}function z(b){return 45===b&&2===d?(a.consume(b),D):60===b&&1===d?(a.consume(b),E):62===b&&4===d?(a.consume(b),I):63===b&&3===d?(a.consume(b),H):93===b&&5===d?(a.consume(b),G):LN(b)&&(6===d||7===d)?(a.exit("htmlFlowData"),a.check(MB,J,A)(b)):null===b||LN(b)?(a.exit("htmlFlowData"),A(b)):(a.consume(b),z)}function A(b){return a.check(MC,B,J)(b)}function B(b){return a.enter("lineEnding"),a.consume(b),a.exit("lineEnding"),C}function C(b){return null===b||LN(b)?A(b):(a.enter("htmlFlowData"),z(b))}function D(b){return 45===b?(a.consume(b),H):z(b)}function E(b){return 47===b?(a.consume(b),f="",F):z(b)}function F(b){if(62===b){let c=f.toLowerCase();return MA.includes(c)?(a.consume(b),I):z(b)}return LH(b)&&f.length<8?(a.consume(b),f+=String.fromCharCode(b),F):z(b)}function G(b){return 93===b?(a.consume(b),H):z(b)}function H(b){return 62===b?(a.consume(b),I):45===b&&2===d?(a.consume(b),H):z(b)}function I(b){return null===b||LN(b)?(a.exit("htmlFlowData"),J(b)):(a.consume(b),I)}function J(c){return a.exit("htmlFlow"),b(c)}}},61:MO,95:MK,96:Mh,126:Mh},"flowInitial",0,{[-2]:Mi,[-1]:Mi,32:Mi},"insideSpan",0,{null:[L8,LZ]},"string",0,{38:Mf,92:Mb},"text",0,{[-5]:MJ,[-4]:MJ,[-3]:MJ,33:MH,38:Mf,42:L8,60:[{name:"autolink",tokenize:function(a,b,c){let d=0;return function(b){return a.enter("autolink"),a.enter("autolinkMarker"),a.consume(b),a.exit("autolinkMarker"),a.enter("autolinkProtocol"),e};function e(b){return LH(b)?(a.consume(b),f):64===b?c(b):h(b)}function f(b){return 43===b||45===b||46===b||LI(b)?(d=1,function b(c){return 58===c?(a.consume(c),d=0,g):(43===c||45===c||46===c||LI(c))&&d++<32?(a.consume(c),b):(d=0,h(c))}(b)):h(b)}function g(d){return 62===d?(a.exit("autolinkProtocol"),a.enter("autolinkMarker"),a.consume(d),a.exit("autolinkMarker"),a.exit("autolink"),b):null===d||32===d||60===d||null!==d&&(d<32||127===d)?c(d):(a.consume(d),g)}function h(b){return 64===b?(a.consume(b),i):LJ(b)?(a.consume(b),h):c(b)}function i(e){return LI(e)?function e(f){return 46===f?(a.consume(f),d=0,i):62===f?(a.exit("autolinkProtocol").type="autolinkEmail",a.enter("autolinkMarker"),a.consume(f),a.exit("autolinkMarker"),a.exit("autolink"),b):function b(f){if((45===f||LI(f))&&d++<63){let c=45===f?b:e;return a.consume(f),c}return c(f)}(f)}(e):c(e)}}},{name:"htmlText",tokenize:function(a,b,c){let d,e,f,g=this;return function(b){return a.enter("htmlText"),a.enter("htmlTextData"),a.consume(b),h};function h(b){return 33===b?(a.consume(b),i):47===b?(a.consume(b),v):63===b?(a.consume(b),t):LH(b)?(a.consume(b),x):c(b)}function i(b){return 45===b?(a.consume(b),j):91===b?(a.consume(b),e=0,o):LH(b)?(a.consume(b),s):c(b)}function j(b){return 45===b?(a.consume(b),n):c(b)}function k(b){return null===b?c(b):45===b?(a.consume(b),l):LN(b)?(f=k,F(b)):(a.consume(b),k)}function l(b){return 45===b?(a.consume(b),n):k(b)}function n(a){return 62===a?E(a):45===a?l(a):k(a)}function o(b){let d="CDATA[";return b===d.charCodeAt(e++)?(a.consume(b),e===d.length?p:o):c(b)}function p(b){return null===b?c(b):93===b?(a.consume(b),q):LN(b)?(f=p,F(b)):(a.consume(b),p)}function q(b){return 93===b?(a.consume(b),r):p(b)}function r(b){return 62===b?E(b):93===b?(a.consume(b),r):p(b)}function s(b){return null===b||62===b?E(b):LN(b)?(f=s,F(b)):(a.consume(b),s)}function t(b){return null===b?c(b):63===b?(a.consume(b),u):LN(b)?(f=t,F(b)):(a.consume(b),t)}function u(a){return 62===a?E(a):t(a)}function v(b){return LH(b)?(a.consume(b),w):c(b)}function w(b){return 45===b||LI(b)?(a.consume(b),w):function b(c){return LN(c)?(f=b,F(c)):LP(c)?(a.consume(c),b):E(c)}(b)}function x(b){return 45===b||LI(b)?(a.consume(b),x):47===b||62===b||LO(b)?y(b):c(b)}function y(b){return 47===b?(a.consume(b),E):58===b||95===b||LH(b)?(a.consume(b),z):LN(b)?(f=y,F(b)):LP(b)?(a.consume(b),y):E(b)}function z(b){return 45===b||46===b||58===b||95===b||LI(b)?(a.consume(b),z):function b(c){return 61===c?(a.consume(c),A):LN(c)?(f=b,F(c)):LP(c)?(a.consume(c),b):y(c)}(b)}function A(b){return null===b||60===b||61===b||62===b||96===b?c(b):34===b||39===b?(a.consume(b),d=b,B):LN(b)?(f=A,F(b)):LP(b)?(a.consume(b),A):(a.consume(b),C)}function B(b){return b===d?(a.consume(b),d=void 0,D):null===b?c(b):LN(b)?(f=B,F(b)):(a.consume(b),B)}function C(b){return null===b||34===b||39===b||60===b||61===b||96===b?c(b):47===b||62===b||LO(b)?y(b):(a.consume(b),C)}function D(a){return 47===a||62===a||LO(a)?y(a):c(a)}function E(d){return 62===d?(a.consume(d),a.exit("htmlTextData"),a.exit("htmlText"),b):c(d)}function F(b){return a.exit("htmlTextData"),a.enter("lineEnding"),a.consume(b),a.exit("lineEnding"),G}function G(b){return LP(b)?LR(a,H,"linePrefix",g.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(b):H(b)}function H(b){return a.enter("htmlTextData"),f(b)}}}],91:MI,92:[{name:"hardBreakEscape",tokenize:function(a,b,c){return function(b){return a.enter("hardBreakEscape"),a.consume(b),d};function d(d){return LN(d)?(a.exit("hardBreakEscape"),b(d)):c(d)}}},Mb],93:MD,95:L8,96:{name:"codeText",previous:function(a){return 96!==a||"characterEscape"===this.events[this.events.length-1][1].type},resolve:function(a){let b,c,d=a.length-4,e=3;if(("lineEnding"===a[3][1].type||"space"===a[e][1].type)&&("lineEnding"===a[d][1].type||"space"===a[d][1].type)){for(b=e;++b<d;)if("codeTextData"===a[b][1].type){a[e][1].type="codeTextPadding",a[d][1].type="codeTextPadding",e+=2,d-=2;break}}for(b=e-1,d++;++b<=d;)void 0===c?b!==d&&"lineEnding"!==a[b][1].type&&(c=b):(b===d||"lineEnding"===a[b][1].type)&&(a[c][1].type="codeTextData",b!==c+2&&(a[c][1].end=a[b-1][1].end,a.splice(c+2,b-c-2),d-=b-c-2,b=c+2),c=void 0);return a},tokenize:function(a,b,c){let d,e,f=0;return function(b){return a.enter("codeText"),a.enter("codeTextSequence"),function b(c){return 96===c?(a.consume(c),f++,b):(a.exit("codeTextSequence"),g(c))}(b)};function g(i){return null===i?c(i):32===i?(a.enter("space"),a.consume(i),a.exit("space"),g):96===i?(e=a.enter("codeTextSequence"),d=0,function c(g){return 96===g?(a.consume(g),d++,c):d===f?(a.exit("codeTextSequence"),a.exit("codeText"),b(g)):(e.type="codeTextData",h(g))}(i)):LN(i)?(a.enter("lineEnding"),a.consume(i),a.exit("lineEnding"),g):(a.enter("codeTextData"),h(i))}function h(b){return null===b||32===b||96===b||LN(b)?(a.exit("codeTextData"),g(b)):(a.consume(b),h)}}}}],35856);var MP=a.i(35856);let MQ=/[\0\t\n\r]/g;function MR(a,b){let c=Number.parseInt(a,b);return c<9||11===c||c>13&&c<32||c>126&&c<160||c>55295&&c<57344||c>64975&&c<65008||(65535&c)==65535||(65535&c)==65534||c>1114111?"�":String.fromCodePoint(c)}let MS=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function MT(a,b,c){if(b)return b;if(35===c.charCodeAt(0)){let a=c.charCodeAt(1),b=120===a||88===a;return MR(c.slice(b?2:1),b?16:10)}return Me(c)||a}let MU={}.hasOwnProperty;function MV(a){return{line:a.line,column:a.column,offset:a.offset}}function MW(a,b){if(a)throw Error("Cannot close `"+a.type+"` ("+K9({start:a.start,end:a.end})+"): a different token (`"+b.type+"`, "+K9({start:b.start,end:b.end})+") is open");throw Error("Cannot close document, a token (`"+b.type+"`, "+K9({start:b.start,end:b.end})+") is still open")}function MX(a){let b=this;b.parser=function(c){var d,e;let f,g,h,i;return"string"!=typeof(d={...b.data("settings"),...a,extensions:b.data("micromarkExtensions")||[],mdastExtensions:b.data("fromMarkdownExtensions")||[]})&&(e=d,d=void 0),(function(a){let b={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:d(s),autolinkProtocol:j,autolinkEmail:j,atxHeading:d(p),blockQuote:d(function(){return{type:"blockquote",children:[]}}),characterEscape:j,characterReference:j,codeFenced:d(o),codeFencedFenceInfo:e,codeFencedFenceMeta:e,codeIndented:d(o,e),codeText:d(function(){return{type:"inlineCode",value:""}},e),codeTextData:j,data:j,codeFlowValue:j,definition:d(function(){return{type:"definition",identifier:"",label:null,title:null,url:""}}),definitionDestinationString:e,definitionLabelString:e,definitionTitleString:e,emphasis:d(function(){return{type:"emphasis",children:[]}}),hardBreakEscape:d(q),hardBreakTrailing:d(q),htmlFlow:d(r,e),htmlFlowData:j,htmlText:d(r,e),htmlTextData:j,image:d(function(){return{type:"image",title:null,url:"",alt:null}}),label:e,link:d(s),listItem:d(function(a){return{type:"listItem",spread:a._spread,checked:null,children:[]}}),listItemValue:function(a){this.data.expectingFirstListItemValue&&(this.stack[this.stack.length-2].start=Number.parseInt(this.sliceSerialize(a),10),this.data.expectingFirstListItemValue=void 0)},listOrdered:d(t,function(){this.data.expectingFirstListItemValue=!0}),listUnordered:d(t),paragraph:d(function(){return{type:"paragraph",children:[]}}),reference:function(){this.data.referenceType="collapsed"},referenceString:e,resourceDestinationString:e,resourceTitleString:e,setextHeading:d(p),strong:d(function(){return{type:"strong",children:[]}}),thematicBreak:d(function(){return{type:"thematicBreak"}})},exit:{atxHeading:g(),atxHeadingSequence:function(a){let b=this.stack[this.stack.length-1];b.depth||(b.depth=this.sliceSerialize(a).length)},autolink:g(),autolinkEmail:function(a){k.call(this,a),this.stack[this.stack.length-1].url="mailto:"+this.sliceSerialize(a)},autolinkProtocol:function(a){k.call(this,a),this.stack[this.stack.length-1].url=this.sliceSerialize(a)},blockQuote:g(),characterEscapeValue:k,characterReferenceMarkerHexadecimal:n,characterReferenceMarkerNumeric:n,characterReferenceValue:function(a){let b,c=this.sliceSerialize(a),d=this.data.characterReferenceType;d?(b=MR(c,"characterReferenceMarkerNumeric"===d?10:16),this.data.characterReferenceType=void 0):b=Me(c);let e=this.stack[this.stack.length-1];e.value+=b},characterReference:function(a){this.stack.pop().position.end=MV(a.end)},codeFenced:g(function(){let a=this.resume();this.stack[this.stack.length-1].value=a.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}),codeFencedFence:function(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)},codeFencedFenceInfo:function(){let a=this.resume();this.stack[this.stack.length-1].lang=a},codeFencedFenceMeta:function(){let a=this.resume();this.stack[this.stack.length-1].meta=a},codeFlowValue:k,codeIndented:g(function(){let a=this.resume();this.stack[this.stack.length-1].value=a.replace(/(\r?\n|\r)$/g,"")}),codeText:g(function(){let a=this.resume();this.stack[this.stack.length-1].value=a}),codeTextData:k,data:k,definition:g(),definitionDestinationString:function(){let a=this.resume();this.stack[this.stack.length-1].url=a},definitionLabelString:function(a){let b=this.resume(),c=this.stack[this.stack.length-1];c.label=b,c.identifier=Mx(this.sliceSerialize(a)).toLowerCase()},definitionTitleString:function(){let a=this.resume();this.stack[this.stack.length-1].title=a},emphasis:g(),hardBreakEscape:g(l),hardBreakTrailing:g(l),htmlFlow:g(function(){let a=this.resume();this.stack[this.stack.length-1].value=a}),htmlFlowData:k,htmlText:g(function(){let a=this.resume();this.stack[this.stack.length-1].value=a}),htmlTextData:k,image:g(function(){let a=this.stack[this.stack.length-1];if(this.data.inReference){let b=this.data.referenceType||"shortcut";a.type+="Reference",a.referenceType=b,delete a.url,delete a.title}else delete a.identifier,delete a.label;this.data.referenceType=void 0}),label:function(){let a=this.stack[this.stack.length-1],b=this.resume(),c=this.stack[this.stack.length-1];this.data.inReference=!0,"link"===c.type?c.children=a.children:c.alt=b},labelText:function(a){let b=this.sliceSerialize(a),c=this.stack[this.stack.length-2];c.label=b.replace(MS,MT),c.identifier=Mx(b).toLowerCase()},lineEnding:function(a){let c=this.stack[this.stack.length-1];if(this.data.atHardBreak){c.children[c.children.length-1].position.end=MV(a.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&b.canContainEols.includes(c.type)&&(j.call(this,a),k.call(this,a))},link:g(function(){let a=this.stack[this.stack.length-1];if(this.data.inReference){let b=this.data.referenceType||"shortcut";a.type+="Reference",a.referenceType=b,delete a.url,delete a.title}else delete a.identifier,delete a.label;this.data.referenceType=void 0}),listItem:g(),listOrdered:g(),listUnordered:g(),paragraph:g(),referenceString:function(a){let b=this.resume(),c=this.stack[this.stack.length-1];c.label=b,c.identifier=Mx(this.sliceSerialize(a)).toLowerCase(),this.data.referenceType="full"},resourceDestinationString:function(){let a=this.resume();this.stack[this.stack.length-1].url=a},resourceTitleString:function(){let a=this.resume();this.stack[this.stack.length-1].title=a},resource:function(){this.data.inReference=void 0},setextHeading:g(function(){this.data.setextHeadingSlurpLineEnding=void 0}),setextHeadingLineSequence:function(a){this.stack[this.stack.length-1].depth=61===this.sliceSerialize(a).codePointAt(0)?1:2},setextHeadingText:function(){this.data.setextHeadingSlurpLineEnding=!0},strong:g(),thematicBreak:g()}};!function a(b,c){let d=-1;for(;++d<c.length;){let e=c[d];Array.isArray(e)?a(b,e):function(a,b){let c;for(c in b)if(MU.call(b,c))switch(c){case"canContainEols":{let d=b[c];d&&a[c].push(...d);break}case"transforms":{let d=b[c];d&&a[c].push(...d);break}case"enter":case"exit":{let d=b[c];d&&Object.assign(a[c],d)}}}(b,e)}}(b,(a||{}).mdastExtensions||[]);let c={};return function(a){let d={type:"root",children:[]},g={stack:[d],tokenStack:[],config:b,enter:f,exit:h,buffer:e,resume:i,data:c},j=[],k=-1;for(;++k<a.length;)("listOrdered"===a[k][1].type||"listUnordered"===a[k][1].type)&&("enter"===a[k][0]?j.push(k):k=function(a,b,c){let d,e,f,g,h=b-1,i=-1,j=!1;for(;++h<=c;){let b=a[h];switch(b[1].type){case"listUnordered":case"listOrdered":case"blockQuote":"enter"===b[0]?i++:i--,g=void 0;break;case"lineEndingBlank":"enter"===b[0]&&(!d||g||i||f||(f=h),g=void 0);break;case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:g=void 0}if(!i&&"enter"===b[0]&&"listItemPrefix"===b[1].type||-1===i&&"exit"===b[0]&&("listUnordered"===b[1].type||"listOrdered"===b[1].type)){if(d){let g=h;for(e=void 0;g--;){let b=a[g];if("lineEnding"===b[1].type||"lineEndingBlank"===b[1].type){if("exit"===b[0])continue;e&&(a[e][1].type="lineEndingBlank",j=!0),b[1].type="lineEnding",e=g}else if("linePrefix"===b[1].type||"blockQuotePrefix"===b[1].type||"blockQuotePrefixWhitespace"===b[1].type||"blockQuoteMarker"===b[1].type||"listItemIndent"===b[1].type);else break}f&&(!e||f<e)&&(d._spread=!0),d.end=Object.assign({},e?a[e][1].start:b[1].end),a.splice(e||h,0,["exit",d,b[2]]),h++,c++}if("listItemPrefix"===b[1].type){let e={type:"listItem",_spread:!1,start:Object.assign({},b[1].start),end:void 0};d=e,a.splice(h,0,["enter",e,b[2]]),h++,c++,f=void 0,g=!0}}}return a[b][1]._spread=j,c}(a,j.pop(),k));for(k=-1;++k<a.length;){let c=b[a[k][0]];MU.call(c,a[k][1].type)&&c[a[k][1].type].call(Object.assign({sliceSerialize:a[k][2].sliceSerialize},g),a[k][1])}if(g.tokenStack.length>0){let a=g.tokenStack[g.tokenStack.length-1];(a[1]||MW).call(g,void 0,a[0])}for(d.position={start:MV(a.length>0?a[0][1].start:{line:1,column:1,offset:0}),end:MV(a.length>0?a[a.length-2][1].end:{line:1,column:1,offset:0})},k=-1;++k<b.transforms.length;)d=b.transforms[k](d)||d;return d};function d(a,b){return function(c){f.call(this,a(c),c),b&&b.call(this,c)}}function e(){this.stack.push({type:"fragment",children:[]})}function f(a,b,c){this.stack[this.stack.length-1].children.push(a),this.stack.push(a),this.tokenStack.push([b,c||void 0]),a.position={start:MV(b.start),end:void 0}}function g(a){return function(b){a&&a.call(this,b),h.call(this,b)}}function h(a,b){let c=this.stack.pop(),d=this.tokenStack.pop();if(d)d[0].type!==a.type&&(b?b.call(this,a,d[0]):(d[1]||MW).call(this,a,d[0]));else throw Error("Cannot close `"+a.type+"` ("+K9({start:a.start,end:a.end})+"): it’s not open");c.position.end=MV(a.end)}function i(){return Lt(this.stack.pop())}function j(a){let b=this.stack[this.stack.length-1].children,c=b[b.length-1];c&&"text"===c.type||((c={type:"text",value:""}).position={start:MV(a.start),end:void 0},b.push(c)),this.stack.push(c)}function k(a){let b=this.stack.pop();b.value+=this.sliceSerialize(a),b.position.end=MV(a.end)}function l(){this.data.atHardBreak=!0}function n(a){this.data.characterReferenceType=a.type}function o(){return{type:"code",lang:null,meta:null,value:""}}function p(){return{type:"heading",depth:0,children:[]}}function q(){return{type:"break"}}function r(){return{type:"html",value:""}}function s(){return{type:"link",title:null,url:"",children:[]}}function t(a){return{type:"list",ordered:"listOrdered"===a.type,start:null,spread:a._spread,children:[]}}})(e)(function(a){for(;!LV(a););return a}((function(a){let b={constructs:Lz([MP,...(a||{}).extensions||[]]),content:c(LE),defined:[],document:c(LF),flow:c(LY),lazy:{},string:c(L$),text:c(L_)};return b;function c(a){return function(c){return function(a,b,c){let d={_bufferIndex:-1,_index:0,line:c&&c.line||1,column:c&&c.column||1,offset:c&&c.offset||0},e={},f=[],g=[],h=[],i={attempt:p(function(a,b){q(a,b.from)}),check:p(o),consume:function(a){LA(a)?(d.line++,d.column=1,d.offset+=-3===a?2:1,r()):-1!==a&&(d.column++,d.offset++),d._bufferIndex<0?d._index++:(d._bufferIndex++,d._bufferIndex===g[d._index].length&&(d._bufferIndex=-1,d._index++)),j.previous=a},enter:function(a,b){let c=b||{};return c.type=a,c.start=n(),j.events.push(["enter",c,j]),h.push(c),c},exit:function(a){let b=h.pop();return b.end=n(),j.events.push(["exit",b,j]),b},interrupt:p(o,{interrupt:!0})},j={code:null,containerState:{},defineSkip:function(a){e[a.line]=a.column,r()},events:[],now:n,parser:a,previous:null,sliceSerialize:function(a,b){return function(a,b){let c,d=-1,e=[];for(;++d<a.length;){let f,g=a[d];if("string"==typeof g)f=g;else switch(g){case -5:f="\r";break;case -4:f="\n";break;case -3:f="\r\n";break;case -2:f=b?" ":" ";break;case -1:if(!b&&c)continue;f=" ";break;default:f=String.fromCharCode(g)}c=-2===g,e.push(f)}return e.join("")}(l(a),b)},sliceStream:l,write:function(a){return(g=Lx(g,a),function(){let a;for(;d._index<g.length;){let c=g[d._index];if("string"==typeof c)for(a=d._index,d._bufferIndex<0&&(d._bufferIndex=0);d._index===a&&d._bufferIndex<c.length;){var b;b=c.charCodeAt(d._bufferIndex),k=k(b)}else k=k(c)}}(),null!==g[g.length-1])?[]:(q(b,0),j.events=L7(f,j.events,j),j.events)}},k=b.tokenize.call(j,i);return b.resolveAll&&f.push(b),j;function l(a){return function(a,b){let c,d=b.start._index,e=b.start._bufferIndex,f=b.end._index,g=b.end._bufferIndex;if(d===f)c=[a[d].slice(e,g)];else{if(c=a.slice(d,f),e>-1){let a=c[0];"string"==typeof a?c[0]=a.slice(e):c.shift()}g>0&&c.push(a[f].slice(0,g))}return c}(g,a)}function n(){let{_bufferIndex:a,_index:b,line:c,column:e,offset:f}=d;return{_bufferIndex:a,_index:b,line:c,column:e,offset:f}}function o(a,b){b.restore()}function p(a,b){return function(c,e,f){var g;let k,l,o,p;return Array.isArray(c)?q(c):"tokenize"in c?q([c]):(g=c,function(a){let b=null!==a&&g[a],c=null!==a&&g.null;return q([...Array.isArray(b)?b:b?[b]:[],...Array.isArray(c)?c:c?[c]:[]])(a)});function q(a){return(k=a,l=0,0===a.length)?f:s(a[l])}function s(a){return function(c){let e,f,g,k,l;return(e=n(),f=j.previous,g=j.currentConstruct,k=j.events.length,l=Array.from(h),p={from:k,restore:function(){d=e,j.previous=f,j.currentConstruct=g,j.events.length=k,h=l,r()}},o=a,a.partial||(j.currentConstruct=a),a.name&&j.parser.constructs.disable.null.includes(a.name))?u(c):a.tokenize.call(b?Object.assign(Object.create(j),b):j,i,t,u)(c)}}function t(b){return a(o,p),e}function u(a){return(p.restore(),++l<k.length)?s(k[l]):f}}}function q(a,b){a.resolveAll&&!f.includes(a)&&f.push(a),a.resolve&&Lw(j.events,b,j.events.length-b,a.resolve(j.events.slice(b),j)),a.resolveTo&&(j.events=a.resolveTo(j.events,j))}function r(){d.line in e&&d.column<2&&(d.column=e[d.line],d.offset+=e[d.line]-1)}}(b,a,c)}}})(e).document().write((g=1,h="",i=!0,function(a,b,c){let d,e,j,k,l,n=[];for(a=h+("string"==typeof a?a.toString():new TextDecoder(b||void 0).decode(a)),j=0,h="",i&&(65279===a.charCodeAt(0)&&j++,i=void 0);j<a.length;){if(MQ.lastIndex=j,k=(d=MQ.exec(a))&&void 0!==d.index?d.index:a.length,l=a.charCodeAt(k),!d){h=a.slice(j);break}if(10===l&&j===k&&f)n.push(-3),f=void 0;else switch(f&&(n.push(-5),f=void 0),j<k&&(n.push(a.slice(j,k)),g+=k-j),l){case 0:n.push(65533),g++;break;case 9:for(e=4*Math.ceil(g/4),n.push(-2);g++<e;)n.push(-1);break;case 10:n.push(-4),g=1;break;default:f=!0,g=1}j=k+1}return c&&(f&&n.push(-5),h&&n.push(h),n.push(null)),n})(c,d,!0))))}}let MY="object"==typeof self?self:globalThis,MZ=a=>{var b;let c,d;return(b=new Map,c=(a,c)=>(b.set(c,a),a),d=e=>{if(b.has(e))return b.get(e);let[f,g]=a[e];switch(f){case 0:case -1:return c(g,e);case 1:{let a=c([],e);for(let b of g)a.push(d(b));return a}case 2:{let a=c({},e);for(let[b,c]of g)a[d(b)]=d(c);return a}case 3:return c(new Date(g),e);case 4:{let{source:a,flags:b}=g;return c(new RegExp(a,b),e)}case 5:{let a=c(new Map,e);for(let[b,c]of g)a.set(d(b),d(c));return a}case 6:{let a=c(new Set,e);for(let b of g)a.add(d(b));return a}case 7:{let{name:a,message:b}=g;return c(new MY[a](b),e)}case 8:return c(BigInt(g),e);case"BigInt":return c(Object(BigInt(g)),e);case"ArrayBuffer":return c(new Uint8Array(g).buffer,g);case"DataView":{let{buffer:a}=new Uint8Array(g);return c(new DataView(a),g)}}return c(new MY[f](g),e)})(0)},{toString:M$}={},{keys:M_}=Object,M0=a=>{let b=typeof a;if("object"!==b||!a)return[0,b];let c=M$.call(a).slice(8,-1);switch(c){case"Array":return[1,""];case"Object":return[2,""];case"Date":return[3,""];case"RegExp":return[4,""];case"Map":return[5,""];case"Set":return[6,""];case"DataView":return[1,c]}return c.includes("Array")?[1,c]:c.includes("Error")?[7,c]:[2,c]},M1=([a,b])=>0===a&&("function"===b||"symbol"===b),M2=(a,{json:b,lossy:c}={})=>{var d,e,f;let g,h,i=[];return(d=!(b||c),e=!!b,f=new Map,g=(a,b)=>{let c=i.push(a)-1;return f.set(b,c),c},h=a=>{if(f.has(a))return f.get(a);let[b,c]=M0(a);switch(b){case 0:{let e=a;switch(c){case"bigint":b=8,e=a.toString();break;case"function":case"symbol":if(d)throw TypeError("unable to serialize "+c);e=null;break;case"undefined":return g([-1],a)}return g([b,e],a)}case 1:{if(c){let b=a;return"DataView"===c?b=new Uint8Array(a.buffer):"ArrayBuffer"===c&&(b=new Uint8Array(a)),g([c,[...b]],a)}let d=[],e=g([b,d],a);for(let b of a)d.push(h(b));return e}case 2:{if(c)switch(c){case"BigInt":return g([c,a.toString()],a);case"Boolean":case"Number":case"String":return g([c,a.valueOf()],a)}if(e&&"toJSON"in a)return h(a.toJSON());let f=[],i=g([b,f],a);for(let b of M_(a))(d||!M1(M0(a[b])))&&f.push([h(b),h(a[b])]);return i}case 3:return g([b,a.toISOString()],a);case 4:{let{source:c,flags:d}=a;return g([b,{source:c,flags:d}],a)}case 5:{let c=[],e=g([b,c],a);for(let[b,e]of a)(d||!(M1(M0(b))||M1(M0(e))))&&c.push([h(b),h(e)]);return e}case 6:{let c=[],e=g([b,c],a);for(let b of a)(d||!M1(M0(b)))&&c.push(h(b));return e}}let{message:i}=a;return g([b,{name:c,message:i}],a)})(a),i},M3="function"==typeof structuredClone?(a,b)=>b&&("json"in b||"lossy"in b)?MZ(M2(a,b)):structuredClone(a):(a,b)=>MZ(M2(a,b));M5(/[A-Za-z]/);let M4=M5(/[\dA-Za-z]/);function M5(a){return function(b){return null!==b&&b>-1&&a.test(String.fromCharCode(b))}}function M6(a){let b=[],c=-1,d=0,e=0;for(;++c<a.length;){let f=a.charCodeAt(c),g="";if(37===f&&M4(a.charCodeAt(c+1))&&M4(a.charCodeAt(c+2)))e=2;else if(f<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(f))||(g=String.fromCharCode(f));else if(f>55295&&f<57344){let b=a.charCodeAt(c+1);f<56320&&b>56319&&b<57344?(g=String.fromCharCode(f,b),e=1):g="�"}else g=String.fromCharCode(f);g&&(b.push(a.slice(d,c),encodeURIComponent(g)),d=c+e+1,g=""),e&&(c+=e,e=0)}return b.join("")+a.slice(d)}function M7(a,b){let c=[{type:"text",value:"↩"}];return b>1&&c.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(b)}]}),c}function M8(a,b){return"Back to reference "+(a+1)+(b>1?"-"+b:"")}M5(/[#-'*+\--9=?A-Z^-~]/),M5(/\d/),M5(/[\dA-Fa-f]/),M5(/[!-/:-@[-`{-~]/),M5(/\p{P}|\p{S}/u),M5(/\s/);let M9=function(a){var b,c;if(null==a)return Nb;if("function"==typeof a)return Na(a);if("object"==typeof a){return Array.isArray(a)?function(a){let b=[],c=-1;for(;++c<a.length;)b[c]=M9(a[c]);return Na(function(...a){let c=-1;for(;++c<b.length;)if(b[c].apply(this,a))return!0;return!1})}(a):(b=a,Na(function(a){let c;for(c in b)if(a[c]!==b[c])return!1;return!0}))}if("string"==typeof a){return c=a,Na(function(a){return a&&a.type===c})}throw Error("Expected function, string, or object as test")};function Na(a){return function(b,c,d){return!!(function(a){return null!==a&&"object"==typeof a&&"type"in a}(b)&&a.call(this,b,"number"==typeof c?c:void 0,d||void 0))}}function Nb(){return!0}let Nc=[];function Nd(a,b,c,d){let e;"function"==typeof b&&"function"!=typeof c?(d=c,c=b):e=b;let f=M9(e),g=d?-1:1;(function a(e,h,i){let j=e&&"object"==typeof e?e:{};if("string"==typeof j.type){let a="string"==typeof j.tagName?j.tagName:"string"==typeof j.name?j.name:void 0;Object.defineProperty(k,"name",{value:"node (\x1b[33m"+e.type+(a?"<"+a+">":"")+"\x1b[39m)"})}return k;function k(){var j;let k,l,n,o=Nc;if((!b||f(e,h,i[i.length-1]||void 0))&&!1===(o=Array.isArray(j=c(e,i))?j:"number"==typeof j?[!0,j]:null==j?Nc:[j])[0])return o;if("children"in e&&e.children&&e.children&&"skip"!==o[0])for(l=(d?e.children.length:-1)+g,n=i.concat(e);l>-1&&l<e.children.length;){if(!1===(k=a(e.children[l],l,n)())[0])return k;l="number"==typeof k[1]?k[1]:l+g}return o}})(a,void 0,[])()}function Ne(a,b,c,d){let e,f,g;"function"==typeof b&&"function"!=typeof c?(f=void 0,g=b,e=c):(f=b,g=c,e=d),Nd(a,f,function(a,b){let c=b[b.length-1],d=c?c.children.indexOf(a):void 0;return g(a,d,c)},e)}function Nf(a,b){let c=b.referenceType,d="]";if("collapsed"===c?d+="[]":"full"===c&&(d+="["+(b.label||b.identifier)+"]"),"imageReference"===b.type)return[{type:"text",value:"!["+b.alt+d}];let e=a.all(b),f=e[0];f&&"text"===f.type?f.value="["+f.value:e.unshift({type:"text",value:"["});let g=e[e.length-1];return g&&"text"===g.type?g.value+=d:e.push({type:"text",value:d}),e}function Ng(a){let b=a.spread;return null==b?a.children.length>1:b}function Nh(a,b,c){let d=0,e=a.length;if(b){let b=a.codePointAt(d);for(;9===b||32===b;)d++,b=a.codePointAt(d)}if(c){let b=a.codePointAt(e-1);for(;9===b||32===b;)e--,b=a.codePointAt(e-1)}return e>d?a.slice(d,e):""}let Ni={blockquote:function(a,b){let c={type:"element",tagName:"blockquote",properties:{},children:a.wrap(a.all(b),!0)};return a.patch(b,c),a.applyData(b,c)},break:function(a,b){let c={type:"element",tagName:"br",properties:{},children:[]};return a.patch(b,c),[a.applyData(b,c),{type:"text",value:"\n"}]},code:function(a,b){let c=b.value?b.value+"\n":"",d={},e=b.lang?b.lang.split(/\s+/):[];e.length>0&&(d.className=["language-"+e[0]]);let f={type:"element",tagName:"code",properties:d,children:[{type:"text",value:c}]};return b.meta&&(f.data={meta:b.meta}),a.patch(b,f),f={type:"element",tagName:"pre",properties:{},children:[f=a.applyData(b,f)]},a.patch(b,f),f},delete:function(a,b){let c={type:"element",tagName:"del",properties:{},children:a.all(b)};return a.patch(b,c),a.applyData(b,c)},emphasis:function(a,b){let c={type:"element",tagName:"em",properties:{},children:a.all(b)};return a.patch(b,c),a.applyData(b,c)},footnoteReference:function(a,b){let c,d="string"==typeof a.options.clobberPrefix?a.options.clobberPrefix:"user-content-",e=String(b.identifier).toUpperCase(),f=M6(e.toLowerCase()),g=a.footnoteOrder.indexOf(e),h=a.footnoteCounts.get(e);void 0===h?(h=0,a.footnoteOrder.push(e),c=a.footnoteOrder.length):c=g+1,h+=1,a.footnoteCounts.set(e,h);let i={type:"element",tagName:"a",properties:{href:"#"+d+"fn-"+f,id:d+"fnref-"+f+(h>1?"-"+h:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(c)}]};a.patch(b,i);let j={type:"element",tagName:"sup",properties:{},children:[i]};return a.patch(b,j),a.applyData(b,j)},heading:function(a,b){let c={type:"element",tagName:"h"+b.depth,properties:{},children:a.all(b)};return a.patch(b,c),a.applyData(b,c)},html:function(a,b){if(a.options.allowDangerousHtml){let c={type:"raw",value:b.value};return a.patch(b,c),a.applyData(b,c)}},imageReference:function(a,b){let c=String(b.identifier).toUpperCase(),d=a.definitionById.get(c);if(!d)return Nf(a,b);let e={src:M6(d.url||""),alt:b.alt};null!==d.title&&void 0!==d.title&&(e.title=d.title);let f={type:"element",tagName:"img",properties:e,children:[]};return a.patch(b,f),a.applyData(b,f)},image:function(a,b){let c={src:M6(b.url)};null!==b.alt&&void 0!==b.alt&&(c.alt=b.alt),null!==b.title&&void 0!==b.title&&(c.title=b.title);let d={type:"element",tagName:"img",properties:c,children:[]};return a.patch(b,d),a.applyData(b,d)},inlineCode:function(a,b){let c={type:"text",value:b.value.replace(/\r?\n|\r/g," ")};a.patch(b,c);let d={type:"element",tagName:"code",properties:{},children:[c]};return a.patch(b,d),a.applyData(b,d)},linkReference:function(a,b){let c=String(b.identifier).toUpperCase(),d=a.definitionById.get(c);if(!d)return Nf(a,b);let e={href:M6(d.url||"")};null!==d.title&&void 0!==d.title&&(e.title=d.title);let f={type:"element",tagName:"a",properties:e,children:a.all(b)};return a.patch(b,f),a.applyData(b,f)},link:function(a,b){let c={href:M6(b.url)};null!==b.title&&void 0!==b.title&&(c.title=b.title);let d={type:"element",tagName:"a",properties:c,children:a.all(b)};return a.patch(b,d),a.applyData(b,d)},listItem:function(a,b,c){let d=a.all(b),e=c?function(a){let b=!1;if("list"===a.type){b=a.spread||!1;let c=a.children,d=-1;for(;!b&&++d<c.length;)b=Ng(c[d])}return b}(c):Ng(b),f={},g=[];if("boolean"==typeof b.checked){let a,c=d[0];c&&"element"===c.type&&"p"===c.tagName?a=c:(a={type:"element",tagName:"p",properties:{},children:[]},d.unshift(a)),a.children.length>0&&a.children.unshift({type:"text",value:" "}),a.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:b.checked,disabled:!0},children:[]}),f.className=["task-list-item"]}let h=-1;for(;++h<d.length;){let a=d[h];(e||0!==h||"element"!==a.type||"p"!==a.tagName)&&g.push({type:"text",value:"\n"}),"element"!==a.type||"p"!==a.tagName||e?g.push(a):g.push(...a.children)}let i=d[d.length-1];i&&(e||"element"!==i.type||"p"!==i.tagName)&&g.push({type:"text",value:"\n"});let j={type:"element",tagName:"li",properties:f,children:g};return a.patch(b,j),a.applyData(b,j)},list:function(a,b){let c={},d=a.all(b),e=-1;for("number"==typeof b.start&&1!==b.start&&(c.start=b.start);++e<d.length;){let a=d[e];if("element"===a.type&&"li"===a.tagName&&a.properties&&Array.isArray(a.properties.className)&&a.properties.className.includes("task-list-item")){c.className=["contains-task-list"];break}}let f={type:"element",tagName:b.ordered?"ol":"ul",properties:c,children:a.wrap(d,!0)};return a.patch(b,f),a.applyData(b,f)},paragraph:function(a,b){let c={type:"element",tagName:"p",properties:{},children:a.all(b)};return a.patch(b,c),a.applyData(b,c)},root:function(a,b){let c={type:"root",children:a.wrap(a.all(b))};return a.patch(b,c),a.applyData(b,c)},strong:function(a,b){let c={type:"element",tagName:"strong",properties:{},children:a.all(b)};return a.patch(b,c),a.applyData(b,c)},table:function(a,b){let c=a.all(b),d=c.shift(),e=[];if(d){let c={type:"element",tagName:"thead",properties:{},children:a.wrap([d],!0)};a.patch(b.children[0],c),e.push(c)}if(c.length>0){let d={type:"element",tagName:"tbody",properties:{},children:a.wrap(c,!0)},f=K7(b.children[1]),g=K6(b.children[b.children.length-1]);f&&g&&(d.position={start:f,end:g}),e.push(d)}let f={type:"element",tagName:"table",properties:{},children:a.wrap(e,!0)};return a.patch(b,f),a.applyData(b,f)},tableCell:function(a,b){let c={type:"element",tagName:"td",properties:{},children:a.all(b)};return a.patch(b,c),a.applyData(b,c)},tableRow:function(a,b,c){let d=c?c.children:void 0,e=0===(d?d.indexOf(b):1)?"th":"td",f=c&&"table"===c.type?c.align:void 0,g=f?f.length:b.children.length,h=-1,i=[];for(;++h<g;){let c=b.children[h],d={},g=f?f[h]:void 0;g&&(d.align=g);let j={type:"element",tagName:e,properties:d,children:[]};c&&(j.children=a.all(c),a.patch(c,j),j=a.applyData(c,j)),i.push(j)}let j={type:"element",tagName:"tr",properties:{},children:a.wrap(i,!0)};return a.patch(b,j),a.applyData(b,j)},text:function(a,b){let c={type:"text",value:function(a){let b=String(a),c=/\r?\n|\r/g,d=c.exec(b),e=0,f=[];for(;d;)f.push(Nh(b.slice(e,d.index),e>0,!0),d[0]),e=d.index+d[0].length,d=c.exec(b);return f.push(Nh(b.slice(e),e>0,!1)),f.join("")}(String(b.value))};return a.patch(b,c),a.applyData(b,c)},thematicBreak:function(a,b){let c={type:"element",tagName:"hr",properties:{},children:[]};return a.patch(b,c),a.applyData(b,c)},toml:Nj,yaml:Nj,definition:Nj,footnoteDefinition:Nj};function Nj(){}let Nk={}.hasOwnProperty,Nl={};function Nm(a,b){a.position&&(b.position=function(a){let b=K7(a),c=K6(a);if(b&&c)return{start:b,end:c}}(a))}function Nn(a,b){let c=b;if(a&&a.data){let b=a.data.hName,d=a.data.hChildren,e=a.data.hProperties;"string"==typeof b&&("element"===c.type?c.tagName=b:c={type:"element",tagName:b,properties:{},children:"children"in c?c.children:[c]}),"element"===c.type&&e&&Object.assign(c.properties,M3(e)),"children"in c&&c.children&&null!=d&&(c.children=d)}return c}function No(a,b){let c=[],d=-1;for(b&&c.push({type:"text",value:"\n"});++d<a.length;)d&&c.push({type:"text",value:"\n"}),c.push(a[d]);return b&&a.length>0&&c.push({type:"text",value:"\n"}),c}function Np(a){let b=0,c=a.charCodeAt(b);for(;9===c||32===c;)b++,c=a.charCodeAt(b);return a.slice(b)}function Nq(a,b){let c,d,e,f,g=(c=b||Nl,d=new Map,e=new Map,f={all:function(a){let b=[];if("children"in a){let c=a.children,d=-1;for(;++d<c.length;){let e=f.one(c[d],a);if(e){if(d&&"break"===c[d-1].type&&(Array.isArray(e)||"text"!==e.type||(e.value=Np(e.value)),!Array.isArray(e)&&"element"===e.type)){let a=e.children[0];a&&"text"===a.type&&(a.value=Np(a.value))}Array.isArray(e)?b.push(...e):b.push(e)}}}return b},applyData:Nn,definitionById:d,footnoteById:e,footnoteCounts:new Map,footnoteOrder:[],handlers:{...Ni,...c.handlers},one:function(a,b){let c=a.type,d=f.handlers[c];if(Nk.call(f.handlers,c)&&d)return d(f,a,b);if(f.options.passThrough&&f.options.passThrough.includes(c)){if("children"in a){let{children:b,...c}=a,d=M3(c);return d.children=f.all(a),d}return M3(a)}return(f.options.unknownHandler||function(a,b){let c=b.data||{},d="value"in b&&!(Nk.call(c,"hProperties")||Nk.call(c,"hChildren"))?{type:"text",value:b.value}:{type:"element",tagName:"div",properties:{},children:a.all(b)};return a.patch(b,d),a.applyData(b,d)})(f,a,b)},options:c,patch:Nm,wrap:No},Ne(a,function(a){if("definition"===a.type||"footnoteDefinition"===a.type){let b="definition"===a.type?d:e,c=String(a.identifier).toUpperCase();b.has(c)||b.set(c,a)}}),f),h=g.one(a,void 0),i=function(a){let b="string"==typeof a.options.clobberPrefix?a.options.clobberPrefix:"user-content-",c=a.options.footnoteBackContent||M7,d=a.options.footnoteBackLabel||M8,e=a.options.footnoteLabel||"Footnotes",f=a.options.footnoteLabelTagName||"h2",g=a.options.footnoteLabelProperties||{className:["sr-only"]},h=[],i=-1;for(;++i<a.footnoteOrder.length;){let e=a.footnoteById.get(a.footnoteOrder[i]);if(!e)continue;let f=a.all(e),g=String(e.identifier).toUpperCase(),j=M6(g.toLowerCase()),k=0,l=[],n=a.footnoteCounts.get(g);for(;void 0!==n&&++k<=n;){l.length>0&&l.push({type:"text",value:" "});let a="string"==typeof c?c:c(i,k);"string"==typeof a&&(a={type:"text",value:a}),l.push({type:"element",tagName:"a",properties:{href:"#"+b+"fnref-"+j+(k>1?"-"+k:""),dataFootnoteBackref:"",ariaLabel:"string"==typeof d?d:d(i,k),className:["data-footnote-backref"]},children:Array.isArray(a)?a:[a]})}let o=f[f.length-1];if(o&&"element"===o.type&&"p"===o.tagName){let a=o.children[o.children.length-1];a&&"text"===a.type?a.value+=" ":o.children.push({type:"text",value:" "}),o.children.push(...l)}else f.push(...l);let p={type:"element",tagName:"li",properties:{id:b+"fn-"+j},children:a.wrap(f,!0)};a.patch(e,p),h.push(p)}if(0!==h.length)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:f,properties:{...M3(g),id:"footnote-label"},children:[{type:"text",value:e}]},{type:"text",value:"\n"},{type:"element",tagName:"ol",properties:{},children:a.wrap(h,!0)},{type:"text",value:"\n"}]}}(g),j=Array.isArray(h)?{type:"root",children:h}:h||{type:"root",children:[]};return i&&(Ks("children"in j),j.children.push({type:"text",value:"\n"},i)),j}function Nr(a,b){return a&&"run"in a?async function(c,d){let e=Nq(c,{file:d,...b});await a.run(e,d)}:function(c,d){return Nq(c,{file:d,...a||b})}}function Ns(a){if(a)throw a}var Nt=a.i(97599);function Nu(a){if("object"!=typeof a||null===a)return!1;let b=Object.getPrototypeOf(a);return(null===b||b===Object.prototype||null===Object.getPrototypeOf(b))&&!(Symbol.toStringTag in a)&&!(Symbol.iterator in a)}var Nv=a.i(50227),Nv=Nv,Nw=a.i(59639),Nw=Nw,Nx=a.i(57764),Nx=Nx;function Ny(a){return!!(null!==a&&"object"==typeof a&&"href"in a&&a.href&&"protocol"in a&&a.protocol&&void 0===a.auth)}let Nz=["history","path","basename","stem","extname","dirname"];class NA{constructor(a){let b,c;b=a?Ny(a)?{path:a}:"string"==typeof a||function(a){return!!(a&&"object"==typeof a&&"byteLength"in a&&"byteOffset"in a)}(a)?{value:a}:a:{},this.cwd="cwd"in b?"":Nw.default.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let d=-1;for(;++d<Nz.length;){const a=Nz[d];a in b&&void 0!==b[a]&&null!==b[a]&&(this[a]="history"===a?[...b[a]]:b[a])}for(c in b)Nz.includes(c)||(this[c]=b[c])}get basename(){return"string"==typeof this.path?Nv.default.basename(this.path):void 0}set basename(a){NC(a,"basename"),NB(a,"basename"),this.path=Nv.default.join(this.dirname||"",a)}get dirname(){return"string"==typeof this.path?Nv.default.dirname(this.path):void 0}set dirname(a){ND(this.basename,"dirname"),this.path=Nv.default.join(a||"",this.basename)}get extname(){return"string"==typeof this.path?Nv.default.extname(this.path):void 0}set extname(a){if(NB(a,"extname"),ND(this.dirname,"extname"),a){if(46!==a.codePointAt(0))throw Error("`extname` must start with `.`");if(a.includes(".",1))throw Error("`extname` cannot contain multiple dots")}this.path=Nv.default.join(this.dirname,this.stem+(a||""))}get path(){return this.history[this.history.length-1]}set path(a){Ny(a)&&(a=(0,Nx.fileURLToPath)(a)),NC(a,"path"),this.path!==a&&this.history.push(a)}get stem(){return"string"==typeof this.path?Nv.default.basename(this.path,this.extname):void 0}set stem(a){NC(a,"stem"),NB(a,"stem"),this.path=Nv.default.join(this.dirname||"",a+(this.extname||""))}fail(a,b,c){let d=this.message(a,b,c);throw d.fatal=!0,d}info(a,b,c){let d=this.message(a,b,c);return d.fatal=void 0,d}message(a,b,c){let d=new Ld(a,b,c);return this.path&&(d.name=this.path+":"+d.name,d.file=this.path),d.fatal=!1,this.messages.push(d),d}toString(a){return void 0===this.value?"":"string"==typeof this.value?this.value:new TextDecoder(a||void 0).decode(this.value)}}function NB(a,b){if(a&&a.includes(Nv.default.sep))throw Error("`"+b+"` cannot be a path: did not expect `"+Nv.default.sep+"`")}function NC(a,b){if(!a)throw Error("`"+b+"` cannot be empty")}function ND(a,b){if(!a)throw Error("Setting `"+b+"` requires `path` to be set too")}let NE=function(a){let b=this.constructor.prototype,c=b[a],d=function(){return c.apply(d,arguments)};return Object.setPrototypeOf(d,b),d},NF={}.hasOwnProperty;class NG extends NE{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=function(){let a=[],b={run:function(...b){let c=-1,d=b.pop();if("function"!=typeof d)throw TypeError("Expected function as last argument, not "+d);!function e(f,...g){let h=a[++c],i=-1;if(f)return void d(f);for(;++i<b.length;)(null===g[i]||void 0===g[i])&&(g[i]=b[i]);b=g,h?(function(a,b){let c;return function(...b){let f,g=a.length>b.length;g&&b.push(d);try{f=a.apply(this,b)}catch(a){if(g&&c)throw a;return d(a)}g||(f&&f.then&&"function"==typeof f.then?f.then(e,d):f instanceof Error?d(f):e(f))};function d(a,...e){c||(c=!0,b(a,...e))}function e(a){d(null,a)}})(h,e)(...g):d(null,...g)}(null,...b)},use:function(c){if("function"!=typeof c)throw TypeError("Expected `middelware` to be a function, not "+c);return a.push(c),b}};return b}()}copy(){let a=new NG,b=-1;for(;++b<this.attachers.length;){let c=this.attachers[b];a.use(...c)}return a.data((0,Nt.default)(!0,{},this.namespace)),a}data(a,b){return"string"==typeof a?2==arguments.length?(NK("data",this.frozen),this.namespace[a]=b,this):NF.call(this.namespace,a)&&this.namespace[a]||void 0:a?(NK("data",this.frozen),this.namespace=a,this):this.namespace}freeze(){if(this.frozen)return this;for(;++this.freezeIndex<this.attachers.length;){let[a,...b]=this.attachers[this.freezeIndex];if(!1===b[0])continue;!0===b[0]&&(b[0]=void 0);let c=a.call(this,...b);"function"==typeof c&&this.transformers.use(c)}return this.frozen=!0,this.freezeIndex=1/0,this}parse(a){this.freeze();let b=NN(a),c=this.parser||this.Parser;return NI("parse",c),c(String(b),b)}process(a,b){let c=this;return this.freeze(),NI("process",this.parser||this.Parser),NJ("process",this.compiler||this.Compiler),b?d(void 0,b):new Promise(d);function d(d,e){let f=NN(a),g=c.parse(f);function h(a,c){a||!c?e(a):d?d(c):(Ks(b,"`done` is defined if `resolve` is not"),b(void 0,c))}c.run(g,f,function(a,b,d){var e,f;if(a||!b||!d)return h(a);let g=c.stringify(b,d);"string"==typeof(e=g)||(f=e)&&"object"==typeof f&&"byteLength"in f&&"byteOffset"in f?d.value=g:d.result=g,h(a,d)})}}processSync(a){let b,c=!1;return this.freeze(),NI("processSync",this.parser||this.Parser),NJ("processSync",this.compiler||this.Compiler),this.process(a,function(a,d){c=!0,Ns(a),b=d}),NM("processSync","process",c),Ks(b,"we either bailed on an error or have a tree"),b}run(a,b,c){NL(a),this.freeze();let d=this.transformers;return c||"function"!=typeof b||(c=b,b=void 0),c?e(void 0,c):new Promise(e);function e(e,f){Ks("function"!=typeof b,"`file` can’t be a `done` anymore, we checked");let g=NN(b);d.run(a,g,function(b,d,g){let h=d||a;b?f(b):e?e(h):(Ks(c,"`done` is defined if `resolve` is not"),c(void 0,h,g))})}}runSync(a,b){let c,d=!1;return this.run(a,b,function(a,b){Ns(a),c=b,d=!0}),NM("runSync","run",d),Ks(c,"we either bailed on an error or have a tree"),c}stringify(a,b){this.freeze();let c=NN(b),d=this.compiler||this.Compiler;return NJ("stringify",d),NL(a),d(a,c)}use(a,...b){let c=this.attachers,d=this.namespace;if(NK("use",this.frozen),null==a);else if("function"==typeof a)g(a,b);else if("object"==typeof a)Array.isArray(a)?f(a):e(a);else throw TypeError("Expected usable value, not `"+a+"`");return this;function e(a){if(!("plugins"in a)&&!("settings"in a))throw Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");f(a.plugins),a.settings&&(d.settings=(0,Nt.default)(!0,d.settings,a.settings))}function f(a){let b=-1;if(null==a);else if(Array.isArray(a))for(;++b<a.length;)!function(a){if("function"==typeof a)g(a,[]);else if("object"==typeof a)if(Array.isArray(a)){let[b,...c]=a;g(b,c)}else e(a);else throw TypeError("Expected usable value, not `"+a+"`")}(a[b]);else throw TypeError("Expected a list of plugins, not `"+a+"`")}function g(a,b){let d=-1,e=-1;for(;++d<c.length;)if(c[d][0]===a){e=d;break}if(-1===e)c.push([a,...b]);else if(b.length>0){let[d,...f]=b,g=c[e][1];Nu(g)&&Nu(d)&&(d=(0,Nt.default)(!0,g,d)),c[e]=[a,d,...f]}}}}let NH=new NG().freeze();function NI(a,b){if("function"!=typeof b)throw TypeError("Cannot `"+a+"` without `parser`")}function NJ(a,b){if("function"!=typeof b)throw TypeError("Cannot `"+a+"` without `compiler`")}function NK(a,b){if(b)throw Error("Cannot call `"+a+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function NL(a){if(!Nu(a)||"string"!=typeof a.type)throw TypeError("Expected node, got `"+a+"`")}function NM(a,b,c){if(!c)throw Error("`"+a+"` finished async. Use `"+b+"` instead")}function NN(a){var b;return(b=a)&&"object"==typeof b&&"message"in b&&"messages"in b?a:new NA(a)}let NO=[],NP={allowDangerousHtml:!0},NQ=/^(https?|ircs?|mailto|xmpp)$/i,NR=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function NS(a){var b;let c,d,e,f,g,h=(c=(b=a).rehypePlugins||NO,d=b.remarkPlugins||NO,e=b.remarkRehypeOptions?{...b.remarkRehypeOptions,...NP}:NP,NH().use(MX).use(d).use(Nr,e).use(c)),i=(f=a.children||"",g=new NA,"string"==typeof f?g.value=f:Kt("Unexpected value `"+f+"` for `children` prop, expected `string`"),g);return function(a,b){let c=b.allowedElements,d=b.allowElement,e=b.components,f=b.disallowedElements,g=b.skipHtml,h=b.unwrapDisallowed,i=b.urlTransform||NT;for(let a of NR)Object.hasOwn(b,a.from)&&Kt("Unexpected `"+a.from+"` prop, "+(a.to?"use `"+a.to+"` instead":"remove it")+" (see <https://github.com/remarkjs/react-markdown/blob/main/changelog.md#"+a.id+"> for more info)");return c&&f&&Kt("Unexpected combined `allowedElements` and `disallowedElements`, expected one or the other"),Ne(a,function(a,b,e){if("raw"===a.type&&e&&"number"==typeof b)return g?e.children.splice(b,1):e.children[b]={type:"text",value:a.value},b;if("element"===a.type){let b;for(b in Lr)if(Object.hasOwn(Lr,b)&&Object.hasOwn(a.properties,b)){let c=a.properties[b],d=Lr[b];(null===d||d.includes(a.tagName))&&(a.properties[b]=i(String(c||""),b,a))}}if("element"===a.type){let g=c?!c.includes(a.tagName):!!f&&f.includes(a.tagName);if(!g&&d&&"number"==typeof b&&(g=!d(a,b,e)),g&&e&&"number"==typeof b)return h&&a.children?e.children.splice(b,1,...a.children):e.children.splice(b,1),b}}),function(a,b){var c,d,e,f;let g;if(!b||void 0===b.Fragment)throw TypeError("Expected `Fragment` in options");let h=b.filePath||void 0;if(b.development){if("function"!=typeof b.jsxDEV)throw TypeError("Expected `jsxDEV` in options when `development: true`");c=h,d=b.jsxDEV,g=function(a,b,e,f){let g=Array.isArray(e.children),h=K7(a);return d(b,e,f,g,{columnNumber:h?h.column-1:void 0,fileName:c,lineNumber:h?h.line:void 0},void 0)}}else{if("function"!=typeof b.jsx)throw TypeError("Expected `jsx` in production options");if("function"!=typeof b.jsxs)throw TypeError("Expected `jsxs` in production options");e=b.jsx,f=b.jsxs,g=function(a,b,c,d){let g=Array.isArray(c.children)?f:e;return d?g(b,c,d):g(b,c)}}let i={Fragment:b.Fragment,ancestors:[],components:b.components||{},create:g,elementAttributeNameCase:b.elementAttributeNameCase||"react",evaluater:b.createEvaluater?b.createEvaluater():void 0,filePath:h,ignoreInvalidStyle:b.ignoreInvalidStyle||!1,passKeys:!1!==b.passKeys,passNode:b.passNode||!1,schema:"svg"===b.space?K4:K3,stylePropertyNameCase:b.stylePropertyNameCase||"dom",tableCellAlignToStyle:!1!==b.tableCellAlignToStyle},j=Lk(i,a,void 0);return j&&"string"!=typeof j?j:i.create(a,i.Fragment,{children:j||void 0},void 0)}(a,{Fragment:B.Fragment,components:e,ignoreInvalidStyle:!0,jsx:B.jsx,jsxs:B.jsxs,passKeys:!0,passNode:!0})}(h.runSync(h.parse(i),i),a)}function NT(a){let b=a.indexOf(":"),c=a.indexOf("?"),d=a.indexOf("#"),e=a.indexOf("/");return -1===b||-1!==e&&b>e||-1!==c&&b>c||-1!==d&&b>d||NQ.test(a.slice(0,b))?a:""}function NU(a,b){let c=String(a);if("string"!=typeof b)throw TypeError("Expected character");let d=0,e=c.indexOf(b);for(;-1!==e;)d++,e=c.indexOf(b,e+b.length);return d}NX(/[A-Za-z]/),NX(/[\dA-Za-z]/),NX(/[#-'*+\--9=?A-Z^-~]/),NX(/\d/),NX(/[\dA-Fa-f]/),NX(/[!-/:-@[-`{-~]/);let NV=NX(/\p{P}|\p{S}/u),NW=NX(/\s/);function NX(a){return function(b){return null!==b&&b>-1&&a.test(String.fromCharCode(b))}}let NY="phrasing",NZ=["autolink","link","image","label"];function N$(a){this.enter({type:"link",title:null,url:"",children:[]},a)}function N_(a){this.config.enter.autolinkProtocol.call(this,a)}function N0(a){this.config.exit.autolinkProtocol.call(this,a)}function N1(a){this.config.exit.data.call(this,a);let b=this.stack[this.stack.length-1];Ks("link"===b.type),b.url="http://"+this.sliceSerialize(a)}function N2(a){this.config.exit.autolinkEmail.call(this,a)}function N3(a){this.exit(a)}function N4(a){!function(a,b,c){let d=M9((c||{}).ignore||[]),e=function(a){let b=[];if(!Array.isArray(a))throw TypeError("Expected find and replace tuple or list of tuples");let c=!a[0]||Array.isArray(a[0])?a:[a],d=-1;for(;++d<c.length;){var e;let a=c[d];b.push(["string"==typeof(e=a[0])?RegExp(function(a){if("string"!=typeof a)throw TypeError("Expected a string");return a.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}(e),"g"):e,function(a){return"function"==typeof a?a:function(){return a}}(a[1])])}return b}(b),f=-1;for(;++f<e.length;)Nd(a,"text",g);function g(a,b){let c,g=-1;for(;++g<b.length;){let a=b[g],e=c?c.children:void 0;if(d(a,e?e.indexOf(a):void 0,c))return;c=a}if(c)return function(a,b){let c=b[b.length-1],d=e[f][0],g=e[f][1],h=0,i=c.children.indexOf(a),j=!1,k=[];d.lastIndex=0;let l=d.exec(a.value);for(;l;){let c=l.index,e={index:l.index,input:l.input,stack:[...b,a]},f=g(...l,e);if("string"==typeof f&&(f=f.length>0?{type:"text",value:f}:void 0),!1===f?d.lastIndex=c+1:(h!==c&&k.push({type:"text",value:a.value.slice(h,c)}),Array.isArray(f)?k.push(...f):f&&k.push(f),h=c+l[0].length,j=!0),!d.global)break;l=d.exec(a.value)}return j?(h<a.value.length&&k.push({type:"text",value:a.value.slice(h)}),c.children.splice(i,1,...k)):k=[a],i+k.length}(a,b)}}(a,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,N5],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,N6]],{ignore:["link","linkReference"]})}function N5(a,b,c,d,e){let f,g="";if(!N7(e))return!1;if(/^w/i.test(b)&&(c=b+c,b="",g="http://"),(f=c.split(".")).length<2||f[f.length-1]&&(/_/.test(f[f.length-1])||!/[a-zA-Z\d]/.test(f[f.length-1]))||f[f.length-2]&&(/_/.test(f[f.length-2])||!/[a-zA-Z\d]/.test(f[f.length-2])))return!1;let h=function(a){let b=/[!"&'),.:;<>?\]}]+$/.exec(a);if(!b)return[a,void 0];a=a.slice(0,b.index);let c=b[0],d=c.indexOf(")"),e=NU(a,"("),f=NU(a,")");for(;-1!==d&&e>f;)a+=c.slice(0,d+1),d=(c=c.slice(d+1)).indexOf(")"),f++;return[a,c]}(c+d);if(!h[0])return!1;let i={type:"link",title:null,url:g+b+h[0],children:[{type:"text",value:b+h[0]}]};return h[1]?[i,{type:"text",value:h[1]}]:i}function N6(a,b,c,d){return!(!N7(d,!0)||/[-\d_]$/.test(c))&&{type:"link",title:null,url:"mailto:"+b+"@"+c,children:[{type:"text",value:b+"@"+c}]}}function N7(a,b){let c=a.input.charCodeAt(a.index-1);return(0===a.index||NW(c)||NV(c))&&(!b||47!==c)}function N8(){this.buffer()}function N9(a){this.enter({type:"footnoteReference",identifier:"",label:""},a)}function Oa(){this.buffer()}function Ob(a){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},a)}function Oc(a){let b=this.resume(),c=this.stack[this.stack.length-1];Ks("footnoteReference"===c.type),c.identifier=Mx(this.sliceSerialize(a)).toLowerCase(),c.label=b}function Od(a){this.exit(a)}function Oe(a){let b=this.resume(),c=this.stack[this.stack.length-1];Ks("footnoteDefinition"===c.type),c.identifier=Mx(this.sliceSerialize(a)).toLowerCase(),c.label=b}function Of(a){this.exit(a)}function Og(a,b,c,d){let e=c.createTracker(d),f=e.move("[^"),g=c.enter("footnoteReference"),h=c.enter("reference");return f+=e.move(c.safe(c.associationId(a),{after:"]",before:f})),h(),g(),f+=e.move("]")}function Oh(a,b,c){return 0===b?a:Oi(a,b,c)}function Oi(a,b,c){return(c?"":" ")+a}Og.peek=function(){return"["};let Oj=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];function Ok(a){this.enter({type:"delete",children:[]},a)}function Ol(a){this.exit(a)}function Om(a,b,c,d){let e=c.createTracker(d),f=c.enter("strikethrough"),g=e.move("~~");return g+=c.containerPhrasing(a,{...e.current(),before:g,after:"~"}),g+=e.move("~~"),f(),g}function On(a){return a.length}function Oo(a){let b="string"==typeof a?a.codePointAt(0):0;return 67===b||99===b?99:76===b||108===b?108:114*(82===b||114===b)}Om.peek=function(){return"~"};function Op(a,b,c){let d=a.value||"",e="`",f=-1;for(;RegExp("(^|[^`])"+e+"([^`]|$)").test(d);)e+="`";for(/[^ \r\n]/.test(d)&&(/^[ \r\n]/.test(d)&&/[ \r\n]$/.test(d)||/^`|`$/.test(d))&&(d=" "+d+" ");++f<c.unsafe.length;){let a,b=c.unsafe[f],e=c.compilePattern(b);if(b.atBreak)for(;a=e.exec(d);){let b=a.index;10===d.charCodeAt(b)&&13===d.charCodeAt(b-1)&&b--,d=d.slice(0,b)+" "+d.slice(a.index+1)}}return e+d+e}Op.peek=function(){return"`"};M9(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);let Oq=function(a,b,c,d){let e=function(a){let b=a.options.listItemIndent||"one";if("tab"!==b&&"one"!==b&&"mixed"!==b)throw Error("Cannot serialize items with `"+b+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return b}(c),f=c.bulletCurrent||function(a){let b=a.options.bullet||"*";if("*"!==b&&"+"!==b&&"-"!==b)throw Error("Cannot serialize items with `"+b+"` for `options.bullet`, expected `*`, `+`, or `-`");return b}(c);b&&"list"===b.type&&b.ordered&&(f=("number"==typeof b.start&&b.start>-1?b.start:1)+(!1===c.options.incrementListMarker?0:b.children.indexOf(a))+f);let g=f.length+1;("tab"===e||"mixed"===e&&(b&&"list"===b.type&&b.spread||a.spread))&&(g=4*Math.ceil(g/4));let h=c.createTracker(d);h.move(f+" ".repeat(g-f.length)),h.shift(g);let i=c.enter("listItem"),j=c.indentLines(c.containerFlow(a,h.current()),function(a,b,c){return b?(c?"":" ".repeat(g))+a:(c?f:f+" ".repeat(g-f.length))+a});return i(),j};function Or(a){let b=a._align;Ks(b,"expected `_align` on table"),this.enter({type:"table",align:b.map(function(a){return"none"===a?null:a}),children:[]},a),this.data.inTable=!0}function Os(a){this.exit(a),this.data.inTable=void 0}function Ot(a){this.enter({type:"tableRow",children:[]},a)}function Ou(a){this.exit(a)}function Ov(a){this.enter({type:"tableCell",children:[]},a)}function Ow(a){let b=this.resume();this.data.inTable&&(b=b.replace(/\\([\\|])/g,Ox));let c=this.stack[this.stack.length-1];Ks("inlineCode"===c.type),c.value=b,this.exit(a)}function Ox(a,b){return"|"===b?b:a}function Oy(a){let b=this.stack[this.stack.length-2];Ks("listItem"===b.type),b.checked="taskListCheckValueChecked"===a.type}function Oz(a){let b=this.stack[this.stack.length-2];if(b&&"listItem"===b.type&&"boolean"==typeof b.checked){let a=this.stack[this.stack.length-1];Ks("paragraph"===a.type);let c=a.children[0];if(c&&"text"===c.type){let d,e=b.children,f=-1;for(;++f<e.length;){let a=e[f];if("paragraph"===a.type){d=a;break}}d===a&&(c.value=c.value.slice(1),0===c.value.length?a.children.shift():a.position&&c.position&&"number"==typeof c.position.start.offset&&(c.position.start.column++,c.position.start.offset++,a.position.start=Object.assign({},c.position.start)))}}this.exit(a)}function OA(a,b,c,d){let e=a.children[0],f="boolean"==typeof a.checked&&e&&"paragraph"===e.type,g="["+(a.checked?"x":" ")+"] ",h=c.createTracker(d);f&&h.move(g);let i=Oq(a,b,c,{...d,...h.current()});return f&&(i=i.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,function(a){return a+g})),i}let OB=OG(/[A-Za-z]/),OC=OG(/[\dA-Za-z]/);function OD(a){return null!==a&&(a<0||32===a)}OG(/[#-'*+\--9=?A-Z^-~]/),OG(/\d/),OG(/[\dA-Fa-f]/),OG(/[!-/:-@[-`{-~]/);let OE=OG(/\p{P}|\p{S}/u),OF=OG(/\s/);function OG(a){return function(b){return null!==b&&b>-1&&a.test(String.fromCharCode(b))}}let OH={tokenize:function(a,b,c){let d=0;return function b(f){return(87===f||119===f)&&d<3?(d++,a.consume(f),b):46===f&&3===d?(a.consume(f),e):c(f)};function e(a){return null===a?c(a):b(a)}},partial:!0},OI={tokenize:function(a,b,c){let d,e,f;return g;function g(b){return 46===b||95===b?a.check(OK,i,h)(b):null===b||OD(b)||OF(b)||45!==b&&OE(b)?i(b):(f=!0,a.consume(b),g)}function h(b){return 95===b?d=!0:(e=d,d=void 0),a.consume(b),g}function i(a){return e||d||!f?c(a):b(a)}},partial:!0},OJ={tokenize:function(a,b){let c=0,d=0;return e;function e(g){return 40===g?(c++,a.consume(g),e):41===g&&d<c?f(g):33===g||34===g||38===g||39===g||41===g||42===g||44===g||46===g||58===g||59===g||60===g||63===g||93===g||95===g||126===g?a.check(OK,b,f)(g):null===g||OD(g)||OF(g)?b(g):(a.consume(g),e)}function f(b){return 41===b&&d++,a.consume(b),e}},partial:!0},OK={tokenize:function(a,b,c){return d;function d(g){return 33===g||34===g||39===g||41===g||42===g||44===g||46===g||58===g||59===g||63===g||95===g||126===g?(a.consume(g),d):38===g?(a.consume(g),f):93===g?(a.consume(g),e):60===g||null===g||OD(g)||OF(g)?b(g):c(g)}function e(a){return null===a||40===a||91===a||OD(a)||OF(a)?b(a):d(a)}function f(b){return OB(b)?function b(e){return 59===e?(a.consume(e),d):OB(e)?(a.consume(e),b):c(e)}(b):c(b)}},partial:!0},OL={tokenize:function(a,b,c){return function(b){return a.consume(b),d};function d(a){return OC(a)?c(a):b(a)}},partial:!0},OM={name:"wwwAutolink",tokenize:function(a,b,c){let d=this;return function(b){return 87!==b&&119!==b||!OR.call(d,d.previous)||OV(d.events)?c(b):(a.enter("literalAutolink"),a.enter("literalAutolinkWww"),a.check(OH,a.attempt(OI,a.attempt(OJ,e),c),c)(b))};function e(c){return a.exit("literalAutolinkWww"),a.exit("literalAutolink"),b(c)}},previous:OR},ON={name:"protocolAutolink",tokenize:function(a,b,c){let d=this,e="",f=!1;return function(b){return(72===b||104===b)&&OS.call(d,d.previous)&&!OV(d.events)?(a.enter("literalAutolink"),a.enter("literalAutolinkHttp"),e+=String.fromCodePoint(b),a.consume(b),g):c(b)};function g(b){if(OB(b)&&e.length<5)return e+=String.fromCodePoint(b),a.consume(b),g;if(58===b){let c=e.toLowerCase();if("http"===c||"https"===c)return a.consume(b),h}return c(b)}function h(b){return 47===b?(a.consume(b),f)?i:(f=!0,h):c(b)}function i(b){return null===b||null!==b&&(b<32||127===b)||OD(b)||OF(b)||OE(b)?c(b):a.attempt(OI,a.attempt(OJ,j),c)(b)}function j(c){return a.exit("literalAutolinkHttp"),a.exit("literalAutolink"),b(c)}},previous:OS},OO={name:"emailAutolink",tokenize:function(a,b,c){let d,e,f=this;return function(b){return!OU(b)||!OT.call(f,f.previous)||OV(f.events)?c(b):(a.enter("literalAutolink"),a.enter("literalAutolinkEmail"),function b(d){return OU(d)?(a.consume(d),b):64===d?(a.consume(d),g):c(d)}(b))};function g(b){return 46===b?a.check(OL,i,h)(b):45===b||95===b||OC(b)?(e=!0,a.consume(b),g):i(b)}function h(b){return a.consume(b),d=!0,g}function i(g){return e&&d&&OB(f.previous)?(a.exit("literalAutolinkEmail"),a.exit("literalAutolink"),b(g)):c(g)}},previous:OT},OP={},OQ=48;for(;OQ<123;)OP[OQ]=OO,58==++OQ?OQ=65:91===OQ&&(OQ=97);function OR(a){return null===a||40===a||42===a||95===a||91===a||93===a||126===a||OD(a)}function OS(a){return!OB(a)}function OT(a){return!(47===a||OU(a))}function OU(a){return 43===a||45===a||46===a||95===a||OC(a)}function OV(a){let b=a.length,c=!1;for(;b--;){let d=a[b][1];if(("labelLink"===d.type||"labelImage"===d.type)&&!d._balanced){c=!0;break}if(d._gfmAutolinkLiteralWalkedInto){c=!1;break}}return a.length>0&&!c&&(a[a.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),c}function OW(a){return null!==a&&(a<0||32===a)}function OX(a){return -2===a||-1===a||32===a}function OY(a){return function(b){return null!==b&&b>-1&&a.test(String.fromCharCode(b))}}function OZ(a,b,c,d){let e=d?d-1:1/0,f=0;return function(d){return OX(d)?(a.enter(c),function d(g){return OX(g)&&f++<e?(a.consume(g),d):(a.exit(c),b(g))}(d)):b(d)}}OP[43]=OO,OP[45]=OO,OP[46]=OO,OP[95]=OO,OP[72]=[OO,ON],OP[104]=[OO,ON],OP[87]=[OO,OM],OP[119]=[OO,OM],OY(/[A-Za-z]/),OY(/[\dA-Za-z]/),OY(/[#-'*+\--9=?A-Z^-~]/),OY(/\d/),OY(/[\dA-Fa-f]/),OY(/[!-/:-@[-`{-~]/),OY(/\p{P}|\p{S}/u),OY(/\s/);let O$={tokenize:function(a,b,c){let d=this;return OZ(a,function(a){let e=d.events[d.events.length-1];return e&&"gfmFootnoteDefinitionIndent"===e[1].type&&4===e[2].sliceSerialize(e[1],!0).length?b(a):c(a)},"gfmFootnoteDefinitionIndent",5)},partial:!0};function O_(a,b,c){let d,e=this,f=e.events.length,g=e.parser.gfmFootnotes||(e.parser.gfmFootnotes=[]);for(;f--;){let a=e.events[f][1];if("labelImage"===a.type){d=a;break}if("gfmFootnoteCall"===a.type||"labelLink"===a.type||"label"===a.type||"image"===a.type||"link"===a.type)break}return function(f){if(!d||!d._balanced)return c(f);let h=Mx(e.sliceSerialize({start:d.end,end:e.now()}));return 94===h.codePointAt(0)&&g.includes(h.slice(1))?(a.enter("gfmFootnoteCallLabelMarker"),a.consume(f),a.exit("gfmFootnoteCallLabelMarker"),b(f)):c(f)}}function O0(a,b){let c=a.length;for(;c--;)if("labelImage"===a[c][1].type&&"enter"===a[c][0]){a[c][1];break}a[c+1][1].type="data",a[c+3][1].type="gfmFootnoteCallLabelMarker";let d={type:"gfmFootnoteCall",start:Object.assign({},a[c+3][1].start),end:Object.assign({},a[a.length-1][1].end)},e={type:"gfmFootnoteCallMarker",start:Object.assign({},a[c+3][1].end),end:Object.assign({},a[c+3][1].end)};e.end.column++,e.end.offset++,e.end._bufferIndex++;let f={type:"gfmFootnoteCallString",start:Object.assign({},e.end),end:Object.assign({},a[a.length-1][1].start)},g={type:"chunkString",contentType:"string",start:Object.assign({},f.start),end:Object.assign({},f.end)},h=[a[c+1],a[c+2],["enter",d,b],a[c+3],a[c+4],["enter",e,b],["exit",e,b],["enter",f,b],["enter",g,b],["exit",g,b],["exit",f,b],a[a.length-2],a[a.length-1],["exit",d,b]];return a.splice(c,a.length-c+1,...h),a}function O1(a,b,c){let d,e=this,f=e.parser.gfmFootnotes||(e.parser.gfmFootnotes=[]),g=0;return function(b){return a.enter("gfmFootnoteCall"),a.enter("gfmFootnoteCallLabelMarker"),a.consume(b),a.exit("gfmFootnoteCallLabelMarker"),h};function h(b){return 94!==b?c(b):(a.enter("gfmFootnoteCallMarker"),a.consume(b),a.exit("gfmFootnoteCallMarker"),a.enter("gfmFootnoteCallString"),a.enter("chunkString").contentType="string",i)}function i(h){if(g>999||93===h&&!d||null===h||91===h||OW(h))return c(h);if(93===h){a.exit("chunkString");let d=a.exit("gfmFootnoteCallString");return f.includes(Mx(e.sliceSerialize(d)))?(a.enter("gfmFootnoteCallLabelMarker"),a.consume(h),a.exit("gfmFootnoteCallLabelMarker"),a.exit("gfmFootnoteCall"),b):c(h)}return OW(h)||(d=!0),g++,a.consume(h),92===h?j:i}function j(b){return 91===b||92===b||93===b?(a.consume(b),g++,i):i(b)}}function O2(a,b,c){let d,e,f=this,g=f.parser.gfmFootnotes||(f.parser.gfmFootnotes=[]),h=0;return function(b){return a.enter("gfmFootnoteDefinition")._container=!0,a.enter("gfmFootnoteDefinitionLabel"),a.enter("gfmFootnoteDefinitionLabelMarker"),a.consume(b),a.exit("gfmFootnoteDefinitionLabelMarker"),i};function i(b){return 94===b?(a.enter("gfmFootnoteDefinitionMarker"),a.consume(b),a.exit("gfmFootnoteDefinitionMarker"),a.enter("gfmFootnoteDefinitionLabelString"),a.enter("chunkString").contentType="string",j):c(b)}function j(b){if(h>999||93===b&&!e||null===b||91===b||OW(b))return c(b);if(93===b){a.exit("chunkString");let c=a.exit("gfmFootnoteDefinitionLabelString");return d=Mx(f.sliceSerialize(c)),a.enter("gfmFootnoteDefinitionLabelMarker"),a.consume(b),a.exit("gfmFootnoteDefinitionLabelMarker"),a.exit("gfmFootnoteDefinitionLabel"),l}return OW(b)||(e=!0),h++,a.consume(b),92===b?k:j}function k(b){return 91===b||92===b||93===b?(a.consume(b),h++,j):j(b)}function l(b){return 58===b?(a.enter("definitionMarker"),a.consume(b),a.exit("definitionMarker"),g.includes(d)||g.push(d),OZ(a,n,"gfmFootnoteDefinitionWhitespace")):c(b)}function n(a){return b(a)}}function O3(a,b,c){return a.check(LS,b,a.attempt(O$,b,c))}function O4(a){a.exit("gfmFootnoteDefinition")}function O5(a){return null!==a&&a<-2}function O6(a){return null!==a&&(a<0||32===a)}function O7(a){return -2===a||-1===a||32===a}function O8(a){return function(b){return null!==b&&b>-1&&a.test(String.fromCharCode(b))}}function O9(a,b,c,d){let e=d?d-1:1/0,f=0;return function(d){return O7(d)?(a.enter(c),function d(g){return O7(g)&&f++<e?(a.consume(g),d):(a.exit(c),b(g))}(d)):b(d)}}O8(/[A-Za-z]/),O8(/[\dA-Za-z]/),O8(/[#-'*+\--9=?A-Z^-~]/),O8(/\d/),O8(/[\dA-Fa-f]/),O8(/[!-/:-@[-`{-~]/),O8(/\p{P}|\p{S}/u),O8(/\s/);class Pa{constructor(){this.map=[]}add(a,b,c){!function(a,b,c,d){let e=0;if(0!==c||0!==d.length){for(;e<a.map.length;){if(a.map[e][0]===b){a.map[e][1]+=c,a.map[e][2].push(...d);return}e+=1}a.map.push([b,c,d])}}(this,a,b,c)}consume(a){if(this.map.sort(function(a,b){return a[0]-b[0]}),0===this.map.length)return;let b=this.map.length,c=[];for(;b>0;)b-=1,c.push(a.slice(this.map[b][0]+this.map[b][1]),this.map[b][2]),a.length=this.map[b][0];c.push(a.slice()),a.length=0;let d=c.pop();for(;d;){for(let b of d)a.push(b);d=c.pop()}this.map.length=0}}function Pb(a,b,c){let d,e=this,f=0,g=0;return function(a){let b=e.events.length-1;for(;b>-1;){let a=e.events[b][1].type;if("lineEnding"===a||"linePrefix"===a)b--;else break}let d=b>-1?e.events[b][1].type:null,f="tableHead"===d||"tableRow"===d?t:h;return f===t&&e.parser.lazy[e.now().line]?c(a):f(a)};function h(b){var c;return a.enter("tableHead"),a.enter("tableRow"),124===(c=b)||(d=!0,g+=1),i(c)}function i(b){return null===b?c(b):O5(b)?g>1?(g=0,e.interrupt=!0,a.exit("tableRow"),a.enter("lineEnding"),a.consume(b),a.exit("lineEnding"),l):c(b):O7(b)?O9(a,i,"whitespace")(b):(g+=1,d&&(d=!1,f+=1),124===b)?(a.enter("tableCellDivider"),a.consume(b),a.exit("tableCellDivider"),d=!0,i):(a.enter("data"),j(b))}function j(b){return null===b||124===b||O6(b)?(a.exit("data"),i(b)):(a.consume(b),92===b?k:j)}function k(b){return 92===b||124===b?(a.consume(b),j):j(b)}function l(b){return(e.interrupt=!1,e.parser.lazy[e.now().line])?c(b):(a.enter("tableDelimiterRow"),d=!1,O7(b))?O9(a,n,"linePrefix",e.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(b):n(b)}function n(b){return 45===b||58===b?p(b):124===b?(d=!0,a.enter("tableCellDivider"),a.consume(b),a.exit("tableCellDivider"),o):c(b)}function o(b){return O7(b)?O9(a,p,"whitespace")(b):p(b)}function p(b){return 58===b?(g+=1,d=!0,a.enter("tableDelimiterMarker"),a.consume(b),a.exit("tableDelimiterMarker"),q):45===b?(g+=1,q(b)):null===b||O5(b)?s(b):c(b)}function q(b){return 45===b?(a.enter("tableDelimiterFiller"),function b(c){return 45===c?(a.consume(c),b):58===c?(d=!0,a.exit("tableDelimiterFiller"),a.enter("tableDelimiterMarker"),a.consume(c),a.exit("tableDelimiterMarker"),r):(a.exit("tableDelimiterFiller"),r(c))}(b)):c(b)}function r(b){return O7(b)?O9(a,s,"whitespace")(b):s(b)}function s(e){if(124===e)return n(e);if(null===e||O5(e))return d&&f===g?(a.exit("tableDelimiterRow"),a.exit("tableHead"),b(e)):c(e);return c(e)}function t(b){return a.enter("tableRow"),u(b)}function u(c){return 124===c?(a.enter("tableCellDivider"),a.consume(c),a.exit("tableCellDivider"),u):null===c||O5(c)?(a.exit("tableRow"),b(c)):O7(c)?O9(a,u,"whitespace")(c):(a.enter("data"),v(c))}function v(b){return null===b||124===b||O6(b)?(a.exit("data"),u(b)):(a.consume(b),92===b?w:v)}function w(b){return 92===b||124===b?(a.consume(b),v):v(b)}}function Pc(a,b){let c,d,e,f=-1,g=!0,h=0,i=[0,0,0,0],j=[0,0,0,0],k=!1,l=0,n=new Pa;for(;++f<a.length;){let o=a[f],p=o[1];"enter"===o[0]?"tableHead"===p.type?(k=!1,0!==l&&(Pe(n,b,l,c,d),d=void 0,l=0),c={type:"table",start:Object.assign({},p.start),end:Object.assign({},p.end)},n.add(f,0,[["enter",c,b]])):"tableRow"===p.type||"tableDelimiterRow"===p.type?(g=!0,e=void 0,i=[0,0,0,0],j=[0,f+1,0,0],k&&(k=!1,d={type:"tableBody",start:Object.assign({},p.start),end:Object.assign({},p.end)},n.add(f,0,[["enter",d,b]])),h="tableDelimiterRow"===p.type?2:d?3:1):h&&("data"===p.type||"tableDelimiterMarker"===p.type||"tableDelimiterFiller"===p.type)?(g=!1,0===j[2]&&(0!==i[1]&&(j[0]=j[1],e=Pd(n,b,i,h,void 0,e),i=[0,0,0,0]),j[2]=f)):"tableCellDivider"===p.type&&(g?g=!1:(0!==i[1]&&(j[0]=j[1],e=Pd(n,b,i,h,void 0,e)),j=[(i=j)[1],f,0,0])):"tableHead"===p.type?(k=!0,l=f):"tableRow"===p.type||"tableDelimiterRow"===p.type?(l=f,0!==i[1]?(j[0]=j[1],e=Pd(n,b,i,h,f,e)):0!==j[1]&&(e=Pd(n,b,j,h,f,e)),h=0):h&&("data"===p.type||"tableDelimiterMarker"===p.type||"tableDelimiterFiller"===p.type)&&(j[3]=f)}for(0!==l&&Pe(n,b,l,c,d),n.consume(b.events),f=-1;++f<b.events.length;){let a=b.events[f];"enter"===a[0]&&"table"===a[1].type&&(a[1]._align=function(a,b){let c=!1,d=[];for(;b<a.length;){let e=a[b];if(c){if("enter"===e[0])"tableContent"===e[1].type&&d.push("tableDelimiterMarker"===a[b+1][1].type?"left":"none");else if("tableContent"===e[1].type){if("tableDelimiterMarker"===a[b-1][1].type){let a=d.length-1;d[a]="left"===d[a]?"center":"right"}}else if("tableDelimiterRow"===e[1].type)break}else"enter"===e[0]&&"tableDelimiterRow"===e[1].type&&(c=!0);b+=1}return d}(b.events,f))}return a}function Pd(a,b,c,d,e,f){0!==c[0]&&(f.end=Object.assign({},Pf(b.events,c[0])),a.add(c[0],0,[["exit",f,b]]));let g=Pf(b.events,c[1]);if(f={type:1===d?"tableHeader":2===d?"tableDelimiter":"tableData",start:Object.assign({},g),end:Object.assign({},g)},a.add(c[1],0,[["enter",f,b]]),0!==c[2]){let e=Pf(b.events,c[2]),f=Pf(b.events,c[3]),g={type:"tableContent",start:Object.assign({},e),end:Object.assign({},f)};if(a.add(c[2],0,[["enter",g,b]]),2!==d){let d=b.events[c[2]],e=b.events[c[3]];if(d[1].end=Object.assign({},e[1].end),d[1].type="chunkText",d[1].contentType="text",c[3]>c[2]+1){let b=c[2]+1,d=c[3]-c[2]-1;a.add(b,d,[])}}a.add(c[3]+1,0,[["exit",g,b]])}return void 0!==e&&(f.end=Object.assign({},Pf(b.events,e)),a.add(e,0,[["exit",f,b]]),f=void 0),f}function Pe(a,b,c,d,e){let f=[],g=Pf(b.events,c);e&&(e.end=Object.assign({},g),f.push(["exit",e,b])),d.end=Object.assign({},g),f.push(["exit",d,b]),a.add(c+1,0,f)}function Pf(a,b){let c=a[b],d="enter"===c[0]?"start":"end";return c[1][d]}function Pg(a){return -2===a||-1===a||32===a}function Ph(a){return function(b){return null!==b&&b>-1&&a.test(String.fromCharCode(b))}}Ph(/[A-Za-z]/),Ph(/[\dA-Za-z]/),Ph(/[#-'*+\--9=?A-Z^-~]/),Ph(/\d/),Ph(/[\dA-Fa-f]/),Ph(/[!-/:-@[-`{-~]/),Ph(/\p{P}|\p{S}/u),Ph(/\s/);let Pi={name:"tasklistCheck",tokenize:function(a,b,c){let d=this;return function(b){return null===d.previous&&d._gfmTasklistFirstContentOfListItem?(a.enter("taskListCheck"),a.enter("taskListCheckMarker"),a.consume(b),a.exit("taskListCheckMarker"),e):c(b)};function e(b){return null!==b&&(b<0||32===b)?(a.enter("taskListCheckValueUnchecked"),a.consume(b),a.exit("taskListCheckValueUnchecked"),f):88===b||120===b?(a.enter("taskListCheckValueChecked"),a.consume(b),a.exit("taskListCheckValueChecked"),f):c(b)}function f(b){return 93===b?(a.enter("taskListCheckMarker"),a.consume(b),a.exit("taskListCheckMarker"),a.exit("taskListCheck"),g):c(b)}function g(d){return null!==d&&d<-2?b(d):Pg(d)?a.check({tokenize:Pj},b,c)(d):c(d)}}};function Pj(a,b,c){var d,e;let f,g;return d=function(a){return null===a?c(a):b(a)},e="whitespace",f=1/0,g=0,function(b){return Pg(b)?(a.enter(e),function b(c){return Pg(c)&&g++<f?(a.consume(c),b):(a.exit(e),d(c))}(b)):d(b)}}let Pk={};function Pl(a){let b,c,d,e=a||Pk,f=this.data(),g=f.micromarkExtensions||(f.micromarkExtensions=[]),h=f.fromMarkdownExtensions||(f.fromMarkdownExtensions=[]),i=f.toMarkdownExtensions||(f.toMarkdownExtensions=[]);g.push(Lz([{text:OP},{document:{91:{name:"gfmFootnoteDefinition",tokenize:O2,continuation:{tokenize:O3},exit:O4}},text:{91:{name:"gfmFootnoteCall",tokenize:O1},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:O_,resolveTo:O0}}},(b=(e||{}).singleTilde,c={name:"strikethrough",tokenize:function(a,c,d){let e=this.previous,f=this.events,g=0;return function(h){return 126===e&&"characterEscape"!==f[f.length-1][1].type?d(h):(a.enter("strikethroughSequenceTemporary"),function f(h){let i=L6(e);if(126===h)return g>1?d(h):(a.consume(h),g++,f);if(g<2&&!b)return d(h);let j=a.exit("strikethroughSequenceTemporary"),k=L6(h);return j._open=!k||2===k&&!!i,j._close=!i||2===i&&!!k,c(h)}(h))}},resolveAll:function(a,b){let c=-1;for(;++c<a.length;)if("enter"===a[c][0]&&"strikethroughSequenceTemporary"===a[c][1].type&&a[c][1]._close){let d=c;for(;d--;)if("exit"===a[d][0]&&"strikethroughSequenceTemporary"===a[d][1].type&&a[d][1]._open&&a[c][1].end.offset-a[c][1].start.offset==a[d][1].end.offset-a[d][1].start.offset){a[c][1].type="strikethroughSequence",a[d][1].type="strikethroughSequence";let e={type:"strikethrough",start:Object.assign({},a[d][1].start),end:Object.assign({},a[c][1].end)},f={type:"strikethroughText",start:Object.assign({},a[d][1].end),end:Object.assign({},a[c][1].start)},g=[["enter",e,b],["enter",a[d][1],b],["exit",a[d][1],b],["enter",f,b]],h=b.parser.constructs.insideSpan.null;h&&Lw(g,g.length,0,L7(h,a.slice(d+1,c),b)),Lw(g,g.length,0,[["exit",f,b],["enter",a[c][1],b],["exit",a[c][1],b],["exit",e,b]]),Lw(a,d-1,c-d+3,g),c=d+g.length-2;break}}for(c=-1;++c<a.length;)"strikethroughSequenceTemporary"===a[c][1].type&&(a[c][1].type="data");return a}},null==b&&(b=!0),{text:{126:c},insideSpan:{null:[c]},attentionMarkers:{null:[126]}}),{flow:{null:{name:"table",tokenize:Pb,resolveAll:Pc}}},{text:{91:Pi}}])),h.push([{transforms:[N4],enter:{literalAutolink:N$,literalAutolinkEmail:N_,literalAutolinkHttp:N_,literalAutolinkWww:N_},exit:{literalAutolink:N3,literalAutolinkEmail:N2,literalAutolinkHttp:N0,literalAutolinkWww:N1}},{enter:{gfmFootnoteCallString:N8,gfmFootnoteCall:N9,gfmFootnoteDefinitionLabelString:Oa,gfmFootnoteDefinition:Ob},exit:{gfmFootnoteCallString:Oc,gfmFootnoteCall:Od,gfmFootnoteDefinitionLabelString:Oe,gfmFootnoteDefinition:Of}},{canContainEols:["delete"],enter:{strikethrough:Ok},exit:{strikethrough:Ol}},{enter:{table:Or,tableData:Ov,tableHeader:Ov,tableRow:Ot},exit:{codeText:Ow,table:Os,tableData:Ou,tableHeader:Ou,tableRow:Ou}},{exit:{taskListCheckValueChecked:Oy,taskListCheckValueUnchecked:Oy,paragraph:Oz}}]),i.push({extensions:[{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:NY,notInConstruct:NZ},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:NY,notInConstruct:NZ},{character:":",before:"[ps]",after:"\\/",inConstruct:NY,notInConstruct:NZ}]},(d=!1,e&&e.firstLineBlank&&(d=!0),{handlers:{footnoteDefinition:function(a,b,c,e){let f=c.createTracker(e),g=f.move("[^"),h=c.enter("footnoteDefinition"),i=c.enter("label");return g+=f.move(c.safe(c.associationId(a),{before:g,after:"]"})),i(),g+=f.move("]:"),a.children&&a.children.length>0&&(f.shift(4),g+=f.move((d?"\n":" ")+c.indentLines(c.containerFlow(a,f.current()),d?Oi:Oh))),h(),g},footnoteReference:Og},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]}),{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:Oj}],handlers:{delete:Om}},function(a){let b=a||{},c=b.tableCellPadding,d=b.tablePipeAlign,e=b.stringLength,f=c?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:"\n",inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:function(a,b,c){let d=Op(a,b,c);return c.stack.includes("tableCell")&&(d=d.replace(/\|/g,"\\$&")),d},table:function(a,b,c,d){return h(function(a,b,c){let d=a.children,e=-1,f=[],g=b.enter("table");for(;++e<d.length;)f[e]=i(d[e],b,c);return g(),f}(a,c,d),a.align)},tableCell:g,tableRow:function(a,b,c,d){let e=h([i(a,c,d)]);return e.slice(0,e.indexOf("\n"))}}};function g(a,b,c,d){let e=c.enter("tableCell"),g=c.enter("phrasing"),h=c.containerPhrasing(a,{...d,before:f,after:f});return g(),e(),h}function h(a,b){return function(a,b){let c=b||{},d=(c.align||[]).concat(),e=c.stringLength||On,f=[],g=[],h=[],i=[],j=0,k=-1;for(;++k<a.length;){let b=[],d=[],f=-1;for(a[k].length>j&&(j=a[k].length);++f<a[k].length;){var l;let g=null==(l=a[k][f])?"":String(l);if(!1!==c.alignDelimiters){let a=e(g);d[f]=a,(void 0===i[f]||a>i[f])&&(i[f]=a)}b.push(g)}g[k]=b,h[k]=d}let n=-1;if("object"==typeof d&&"length"in d)for(;++n<j;)f[n]=Oo(d[n]);else{let a=Oo(d);for(;++n<j;)f[n]=a}n=-1;let o=[],p=[];for(;++n<j;){let a=f[n],b="",d="";99===a?(b=":",d=":"):108===a?b=":":114===a&&(d=":");let e=!1===c.alignDelimiters?1:Math.max(1,i[n]-b.length-d.length),g=b+"-".repeat(e)+d;!1!==c.alignDelimiters&&((e=b.length+e+d.length)>i[n]&&(i[n]=e),p[n]=e),o[n]=g}g.splice(1,0,o),h.splice(1,0,p),k=-1;let q=[];for(;++k<g.length;){let a=g[k],b=h[k];n=-1;let d=[];for(;++n<j;){let e=a[n]||"",g="",h="";if(!1!==c.alignDelimiters){let a=i[n]-(b[n]||0),c=f[n];114===c?g=" ".repeat(a):99===c?a%2?(g=" ".repeat(a/2+.5),h=" ".repeat(a/2-.5)):h=g=" ".repeat(a/2):h=" ".repeat(a)}!1===c.delimiterStart||n||d.push("|"),!1!==c.padding&&(!1!==c.alignDelimiters||""!==e)&&(!1!==c.delimiterStart||n)&&d.push(" "),!1!==c.alignDelimiters&&d.push(g),d.push(e),!1!==c.alignDelimiters&&d.push(h),!1!==c.padding&&d.push(" "),(!1!==c.delimiterEnd||n!==j-1)&&d.push("|")}q.push(!1===c.delimiterEnd?d.join("").replace(/ +$/,""):d.join(""))}return q.join("\n")}(a,{align:b,alignDelimiters:d,padding:c,stringLength:e})}function i(a,b,c){let d=a.children,e=-1,f=[],h=b.enter("tableRow");for(;++e<d.length;)f[e]=g(d[e],a,b,c);return h(),f}}(e),{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:OA}}]})}let Pm=/^\s*\|.*\|\s*$/,Pn=/^\s*\|?\s*:?-+:?\s*(\|\s*:?-+:?\s*)+\|?\s*$/;function Po({children:a,className:b}){return(0,B.jsx)("div",{className:(0,S.cn)("text-[13px] leading-6 text-foreground/90 space-y-2 [&>:first-child]:mt-0",b),children:(0,B.jsx)(NS,{remarkPlugins:[Pl],components:{h1:a=>(0,B.jsx)("div",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground mt-4 mb-1",...a}),h2:a=>(0,B.jsx)("div",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground mt-4 mb-1",...a}),h3:a=>(0,B.jsx)("div",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground mt-3 mb-1",...a}),h4:a=>(0,B.jsx)("div",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground mt-3 mb-1",...a}),p:a=>(0,B.jsx)("p",{className:"my-1.5",...a}),ul:a=>(0,B.jsx)("ul",{className:"list-disc pl-5 my-1.5 space-y-0.5",...a}),ol:a=>(0,B.jsx)("ol",{className:"list-decimal pl-5 my-1.5 space-y-0.5",...a}),li:a=>(0,B.jsx)("li",{className:"leading-6",...a}),strong:a=>(0,B.jsx)("strong",{className:"font-semibold text-foreground",...a}),code:a=>(0,B.jsx)("code",{className:"text-[12px] font-mono bg-muted/70 px-1 py-0.5 rounded",...a}),a:a=>(0,B.jsx)("a",{className:"text-primary underline",...a}),table:a=>(0,B.jsx)("div",{className:"overflow-x-auto my-3 rounded-md border border-border",children:(0,B.jsx)("table",{className:"text-[12px] w-full border-collapse",...a})}),thead:a=>(0,B.jsx)("thead",{className:"bg-muted/60",...a}),th:a=>(0,B.jsx)("th",{className:"text-left font-semibold px-3 py-1.5 border-b border-border whitespace-nowrap",...a}),td:a=>(0,B.jsx)("td",{className:"px-3 py-1.5 border-b border-border/40 align-top [tr:last-child_&]:border-b-0",...a}),hr:a=>(0,B.jsx)("hr",{className:"my-3 border-border/60",...a}),blockquote:a=>(0,B.jsx)("blockquote",{className:"border-l-2 border-border/60 pl-3 my-2 text-muted-foreground italic",...a})},children:function(a){let b=a.split("\n"),c=[],d=0;for(;d<b.length;){let a=b[d],e=b[d+1];if(a&&e&&Pm.test(a)&&Pn.test(e)){for(c.length>0&&""!==c[c.length-1].trim()&&c.push("");d<b.length&&Pm.test(b[d]);)c.push(b[d].replace(/^\s+/,"")),d++;d<b.length&&""!==b[d].trim()&&c.push("");continue}c.push(a),d++}return c.join("\n")}(a)})})}var Pp=a.i(28094),bc=bc;function Pq({directiveId:a,onClose:b}){let c,d=(0,E.useTranslations)("directiveDetailModal"),{currentBank:e}=(0,H.useBank)(),[f,g]=(0,C.useState)(null),[h,i]=(0,C.useState)(!1),[j,k]=(0,C.useState)(null);(0,C.useEffect)(()=>{a&&e&&(async()=>{i(!0),k(null),g(null);try{let b=await V.client.getDirective(e,a);g(b)}catch(a){console.error("Error loading directive:",a),k(a.message)}finally{i(!1)}})()},[a,e]);let l=null!==a;return(0,B.jsx)(bf.Dialog,{open:l,onOpenChange:a=>!a&&b(),children:(0,B.jsxs)(bf.DialogContent,{className:"max-w-2xl max-h-[80vh] overflow-hidden flex flex-col p-6",children:[(0,B.jsx)(Pp.VisuallyHidden,{children:(0,B.jsx)(bf.DialogTitle,{children:d("title")})}),h?(0,B.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,B.jsx)(bc.default,{className:"w-8 h-8 animate-spin text-muted-foreground"})}):j?(0,B.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,B.jsx)("div",{className:"text-center text-destructive",children:(0,B.jsx)("div",{className:"text-sm",children:d("errorPrefix",{error:j})})})}):f?(0,B.jsxs)("div",{className:"flex-1 overflow-y-auto space-y-6",children:[(0,B.jsxs)("div",{className:"pb-5 border-b border-border",children:[(0,B.jsxs)("div",{className:"flex items-center gap-2",children:[(0,B.jsx)("h3",{className:"text-xl font-bold text-foreground",children:f.name}),!f.is_active&&(0,B.jsx)("span",{className:"px-2 py-0.5 rounded-full bg-red-500/10 text-red-600 dark:text-red-400 text-xs font-medium",children:d("inactive")})]}),(0,B.jsx)("code",{className:"text-xs font-mono text-muted-foreground/70",children:f.id})]}),(0,B.jsxs)("div",{className:"flex gap-8",children:[(0,B.jsxs)("div",{children:[(0,B.jsx)("div",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-1",children:d("created")}),(0,B.jsx)("div",{className:"text-sm text-foreground",children:(c=new Date(f.created_at),`${c.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})} at ${c.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!1})}`)})]}),(0,B.jsxs)("div",{children:[(0,B.jsx)("div",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-1",children:d("priority")}),(0,B.jsx)("div",{className:"text-sm text-foreground",children:f.priority})]})]}),(0,B.jsxs)("div",{children:[(0,B.jsx)("div",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-3",children:d("content")}),(0,B.jsx)("div",{className:"prose prose-base dark:prose-invert max-w-none",children:(0,B.jsx)(NS,{remarkPlugins:[Pl],children:f.content})})]}),f.tags&&f.tags.length>0&&(0,B.jsxs)("div",{children:[(0,B.jsx)("div",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-3",children:d("tags")}),(0,B.jsx)("div",{className:"flex flex-wrap gap-1.5",children:f.tags.map((a,b)=>(0,B.jsx)("span",{className:"px-2 py-0.5 bg-purple-500/10 text-purple-600 dark:text-purple-400 rounded text-xs",children:a},b))})]})]}):null]})})}function Pr(a){let b=new Date(a).getTime(),c=Math.round((Date.now()-b)/1e3);if(60>Math.abs(c))return c>=0?"just now":"in a moment";let d=c,e="second";for(let[a,b]of[[60,"second"],[60,"minute"],[24,"hour"],[7,"day"],[4.345,"week"],[12,"month"],[1/0,"year"]]){if(Math.abs(d)<a)break;d/=a,e=b}return new Intl.RelativeTimeFormat("en",{numeric:"auto"}).format(-Math.round(d),e)}function Ps(a){let b=new Date(a);return`${b.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})} at ${b.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!1})}`}var Pt=a.i(5500);let Pu={light:{body:"#1a1a1a",removedLineBg:"#ffeef0",addedLineBg:"#e6ffec",removedWordBg:"#fdb8c0",removedWordText:"#67060c",addedWordBg:"#acf2bc",addedWordText:"#0a3622"},dark:{body:"#e6edf3",removedLineBg:"#3d1419",addedLineBg:"#0d2818",removedWordBg:"#7d2530",removedWordText:"#ffd0d6",addedWordBg:"#1a4d2c",addedWordText:"#b8e6c1"}};function Pv(a,b){return"directives"===a?{label:b?b("factTypeDirective"):"directive",color:"bg-purple-500/10 text-purple-600 dark:text-purple-400"}:"mental-models"===a?{label:b?b("factTypeMentalModel"):"mental model",color:"bg-indigo-500/10 text-indigo-600 dark:text-indigo-400"}:"world"===a?{label:b?b("factTypeWorld"):"world",color:"bg-blue-500/10 text-blue-600 dark:text-blue-400"}:"experience"===a?{label:b?b("factTypeExperience"):"experience",color:"bg-green-500/10 text-green-600 dark:text-green-400"}:"observation"===a?{label:b?b("factTypeObservation"):"observation",color:"bg-amber-500/10 text-amber-600 dark:text-amber-400"}:{label:a,color:"bg-slate-500/10 text-slate-600 dark:text-slate-400"}}let Pw=["observation","experience","world","directives","mental-models"];function Px({based_on:a,onViewMemory:b,onViewDirective:c}){let d=(0,E.useTranslations)("mentalModelDetailModal"),e=(0,C.useMemo)(()=>{if(!a)return[];let b=Object.entries(a).map(([a,b])=>({factType:a,facts:b??[]})).filter(a=>a.facts.length>0);return b.sort((a,b)=>{let c=Pw.indexOf(a.factType),d=Pw.indexOf(b.factType);return(-1===c?999:c)-(-1===d?999:d)}),b},[a]);return 0===e.length?(0,B.jsx)("p",{className:"text-sm text-muted-foreground italic",children:d("noBasedOnData")}):(0,B.jsx)("div",{className:"space-y-4",children:e.map(a=>{let e=Pv(a.factType,d);return(0,B.jsxs)("div",{className:"rounded-lg border border-border/60 overflow-hidden",children:[(0,B.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 bg-muted/40 border-b border-border/60",children:[(0,B.jsx)("span",{className:`px-2 py-0.5 rounded text-[10px] font-semibold uppercase tracking-wide ${e.color}`,children:e.label}),(0,B.jsx)("span",{className:"text-xs text-muted-foreground",children:a.facts.length})]}),(0,B.jsx)("ul",{className:"divide-y divide-border/50",children:a.facts.map((e,f)=>{let g="directives"===a.factType&&!!c||"directives"!==a.factType&&"mental-models"!==a.factType&&!!b;return(0,B.jsxs)("li",{className:"group flex items-start gap-3 px-3 py-2 hover:bg-muted/30",children:[(0,B.jsxs)("p",{className:"text-sm text-foreground leading-relaxed flex-1 min-w-0",children:[e.text,e.context&&(0,B.jsx)("span",{className:"block text-xs text-muted-foreground italic mt-0.5",children:e.context})]}),g&&(0,B.jsx)("button",{className:"text-xs text-muted-foreground hover:text-foreground opacity-0 group-hover:opacity-100 transition-opacity shrink-0 mt-0.5",onClick:()=>{"directives"===a.factType?c?.(e.id):b?.(e.id)},children:d("viewArrow")})]},e.id||f)})})]},a.factType)})})}function Py(a){return a.match(/\s+|[A-Za-z0-9_]+|[^\s\w]/g)||[]}function Pz(a){return/^\s+$/.test(a)?" ":a}function PA(a,b,c){let d={backgroundColor:c.removedWordBg,color:c.removedWordText,fontWeight:600,borderRadius:"2px"},e={backgroundColor:c.addedWordBg,color:c.addedWordText,fontWeight:600,borderRadius:"2px"};return a.map((a,c)=>"same"===a.type?(0,B.jsx)("span",{children:a.text},c):(0,B.jsx)("span",{style:"left"===b?d:e,children:a.text},c))}function PB({before:a,after:b}){let c=(0,E.useTranslations)("mentalModelDetailModal"),{theme:d}=(0,Pt.useTheme)(),e=Pu[d],{left:f,right:g}=function(a,b){let c=a.split("\n"),d=b.split("\n"),e=c.length,f=d.length,g=Array.from({length:e+1},()=>Array(f+1).fill(0));for(let a=1;a<=e;a++)for(let b=1;b<=f;b++)g[a][b]=c[a-1]===d[b-1]?g[a-1][b-1]+1:Math.max(g[a-1][b],g[a][b-1]);let h=[],i=e,j=f;for(;i>0||j>0;)i>0&&j>0&&c[i-1]===d[j-1]?(h.push({type:"same",text:c[i-1]}),i--,j--):j>0&&(0===i||g[i][j-1]>=g[i-1][j])?(h.push({type:"added",text:d[j-1]}),j--):(h.push({type:"removed",text:c[i-1]}),i--);h.reverse();let k=[],l=[],n=0;for(;n<h.length;){let a=h[n];if("same"===a.type){k.push({type:"same",spans:[{type:"same",text:a.text}]}),l.push({type:"same",spans:[{type:"same",text:a.text}]}),n++;continue}let b=[],c=[];for(;n<h.length&&"same"!==h[n].type;)"removed"===h[n].type?b.push(h[n].text):c.push(h[n].text),n++;let d=Math.max(b.length,c.length);for(let a=0;a<d;a++){let d=a<b.length?b[a]:null,e=a<c.length?c[a]:null;if(null!==d&&null!==e){let a=function(a,b){let c=Py(a),d=Py(b),e=c.length,f=d.length,g=Array.from({length:e+1},()=>Array(f+1).fill(0));for(let a=1;a<=e;a++)for(let b=1;b<=f;b++)g[a][b]=Pz(c[a-1])===Pz(d[b-1])?g[a-1][b-1]+1:Math.max(g[a-1][b],g[a][b-1]);let h=[],i=[],j=e,k=f,l=[],n=[];for(;j>0||k>0;)if(j>0&&k>0&&Pz(c[j-1])===Pz(d[k-1]))l.push({type:"same",text:c[j-1]}),n.push({type:"same",text:d[k-1]}),j--,k--;else if(k>0&&(0===j||g[j][k-1]>=g[j-1][k])){let a=d[k-1];n.push({type:/^\s+$/.test(a)?"same":"added",text:a}),k--}else{let a=c[j-1];l.push({type:/^\s+$/.test(a)?"same":"removed",text:a}),j--}for(;l.length;)h.push(l.pop());for(;n.length;)i.push(n.pop());return{left:h,right:i}}(d,e),b=a.left.some(a=>"same"!==a.type)?"removed":"same",c=a.right.some(a=>"same"!==a.type)?"added":"same";k.push({type:b,spans:a.left}),l.push({type:c,spans:a.right})}else null!==d?(k.push({type:"removed",spans:[{type:"removed",text:d}]}),l.push({type:"same",spans:[{type:"same",text:""}]})):null!==e&&(k.push({type:"same",spans:[{type:"same",text:""}]}),l.push({type:"added",spans:[{type:"added",text:e}]}))}}return{left:k,right:l}}(a,b);return f.some(a=>"same"!==a.type)||g.some(a=>"same"!==a.type)?(0,B.jsxs)("div",{className:"grid grid-cols-2 divide-x divide-border border border-border rounded-md overflow-hidden text-[13px] font-mono",style:{color:e.body},children:[(0,B.jsxs)("div",{children:[(0,B.jsx)("div",{className:"px-3 py-1.5 bg-muted text-foreground font-sans font-semibold text-xs uppercase tracking-wide border-b border-border",children:c("diffBefore")}),f.map((a,b)=>(0,B.jsx)("div",{className:"px-3 py-0.5 whitespace-pre-wrap leading-5 min-h-[1.25rem]",style:"removed"===a.type?{backgroundColor:e.removedLineBg}:void 0,children:PA(a.spans,"left",e)},b))]}),(0,B.jsxs)("div",{children:[(0,B.jsx)("div",{className:"px-3 py-1.5 bg-muted text-foreground font-sans font-semibold text-xs uppercase tracking-wide border-b border-border",children:c("diffAfter")}),g.map((a,b)=>(0,B.jsx)("div",{className:"px-3 py-0.5 whitespace-pre-wrap leading-5 min-h-[1.25rem]",style:"added"===a.type?{backgroundColor:e.addedLineBg}:void 0,children:PA(a.spans,"right",e)},b))]})]}):(0,B.jsx)("span",{className:"text-sm text-muted-foreground italic",children:c("unchanged")})}function PC({before:a,after:b,onViewMemory:c,onViewDirective:d}){let e=(0,E.useTranslations)("mentalModelDetailModal"),f=(0,C.useMemo)(()=>{let c=new Set([...Object.keys(a??{}),...Object.keys(b??{})]),d=[];for(let e of c){let c=(a?.[e]??[]).filter(Boolean),f=(b?.[e]??[]).filter(Boolean),g=new Set(c.map(a=>a.id)),h=new Set(f.map(a=>a.id)),i=f.filter(a=>!g.has(a.id)),j=c.filter(a=>!h.has(a.id)),k=f.filter(a=>g.has(a.id));(0!==i.length||0!==j.length||0!==k.length)&&d.push({factType:e,added:i,removed:j,kept:k})}return d.sort((a,b)=>{let c=Pw.indexOf(a.factType),d=Pw.indexOf(b.factType);return(-1===c?999:c)-(-1===d?999:d)}),d},[a,b]);if(0===f.length)return(0,B.jsx)("p",{className:"text-sm text-muted-foreground italic",children:e("noBasedOnData")});let g=(a,b,f)=>(0,B.jsxs)("li",{className:`group flex items-start gap-2 px-3 py-2 ${"added"===f?"bg-green-500/15 dark:bg-green-500/10 border-l-2 border-green-600 dark:border-green-500 text-green-950 dark:text-green-100":"removed"===f?"bg-red-500/15 dark:bg-red-500/10 border-l-2 border-red-600 dark:border-red-500 text-red-950 dark:text-red-200 line-through decoration-red-700/70 dark:decoration-red-400/70":""}`,children:[(0,B.jsx)("span",{className:`font-mono text-sm shrink-0 ${"added"===f?"text-green-700 dark:text-green-400":"removed"===f?"text-red-700 dark:text-red-400":"text-muted-foreground/40"}`,children:"added"===f?"+":"removed"===f?"−":" "}),(0,B.jsxs)("p",{className:"text-sm leading-relaxed flex-1 min-w-0",children:[a.text,a.context&&(0,B.jsx)("span",{className:"block text-xs text-muted-foreground italic mt-0.5 no-underline",children:a.context})]}),("directives"===b&&!!d||"directives"!==b&&"mental-models"!==b&&!!c)&&"removed"!==f&&(0,B.jsx)("button",{className:"text-xs text-muted-foreground hover:text-foreground opacity-0 group-hover:opacity-100 transition-opacity shrink-0 mt-0.5",onClick:()=>{"directives"===b?d(a.id):c(a.id)},children:e("viewArrow")})]},`${f}-${a.id}`);return(0,B.jsx)("div",{className:"space-y-4",children:f.map(a=>{let b=Pv(a.factType,e);return(0,B.jsxs)("div",{className:"rounded-lg border border-border/60 overflow-hidden",children:[(0,B.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 bg-muted/40 border-b border-border/60",children:[(0,B.jsx)("span",{className:`px-2 py-0.5 rounded text-[10px] font-semibold uppercase tracking-wide ${b.color}`,children:b.label}),a.added.length>0&&(0,B.jsxs)("span",{className:"text-xs text-green-600 dark:text-green-400",children:["+",a.added.length]}),a.removed.length>0&&(0,B.jsxs)("span",{className:"text-xs text-red-600 dark:text-red-400",children:["−",a.removed.length]}),a.kept.length>0&&(0,B.jsx)("span",{className:"text-xs text-muted-foreground",children:e("keptCount",{count:a.kept.length})})]}),(0,B.jsxs)("ul",{className:"divide-y divide-border/40",children:[a.added.map(b=>g(b,a.factType,"added")),a.removed.map(b=>g(b,a.factType,"removed")),a.kept.map(b=>g(b,a.factType,"kept"))]})]},a.factType)})})}function PD({history:a,currentContent:b,currentBasedOn:c,onViewMemory:d,onViewDirective:e}){let f=(0,E.useTranslations)("mentalModelDetailModal"),[g,h]=(0,C.useState)(0),i=a[g],j=0===g?b:a[g-1].previous_content??"",k=i.previous_reflect_response?.based_on,l=0===g?c:a[g-1].previous_reflect_response?.based_on,n=i.previous_reflect_response??null;return(0,B.jsxs)("div",{className:"space-y-4",children:[(0,B.jsxs)("div",{className:"flex items-center justify-between",children:[(0,B.jsxs)("span",{className:"text-xs text-muted-foreground",children:[(0,B.jsxs)("span",{className:"font-semibold text-foreground",children:["v",a.length-g]})," →"," ",(0,B.jsxs)("span",{className:"font-semibold text-foreground",children:["v",a.length-g+1,0===g?f("versionCurrent"):""]})," ","· ",f("changedAt",{date:new Date(i.changed_at).toLocaleString()})]}),(0,B.jsxs)("div",{className:"flex items-center gap-1",children:[(0,B.jsx)(W.Button,{variant:"outline",size:"sm",className:"h-7 w-7 p-0",disabled:g===a.length-1,onClick:()=>h(g+1),children:(0,B.jsx)(P,{className:"h-3.5 w-3.5"})}),(0,B.jsx)(W.Button,{variant:"outline",size:"sm",className:"h-7 w-7 p-0",disabled:0===g,onClick:()=>h(g-1),children:(0,B.jsx)(Q.ChevronRight,{className:"h-3.5 w-3.5"})})]})]}),(0,B.jsxs)("div",{children:[(0,B.jsx)(PJ,{children:f("contentDiff")}),null!==i.previous_content?(0,B.jsx)(PB,{before:i.previous_content,after:j}):(0,B.jsx)("div",{className:"border border-border rounded-lg p-3",children:(0,B.jsx)("span",{className:"text-sm text-muted-foreground italic",children:f("previousContentNotAvailable")})})]}),(0,B.jsxs)("div",{children:[(0,B.jsx)(PJ,{children:f("basedOnDiff")}),n?.based_on?(0,B.jsx)(PC,{before:k,after:l,onViewMemory:d,onViewDirective:e}):(0,B.jsx)("p",{className:"text-sm text-muted-foreground italic",children:f("basedOnNotCaptured")})]})]})}function PE({mentalModelId:a,onClose:b,onEdit:c,onDelete:d,onClear:e,onRefreshed:f,initialTab:g="content"}){let h=(0,E.useTranslations)("mentalModelDetailModal"),{currentBank:i}=(0,H.useBank)(),[j,k]=(0,C.useState)(null),[l,n]=(0,C.useState)(!1),[o,p]=(0,C.useState)(null),[q,r]=(0,C.useState)(g),[s,t]=(0,C.useState)(!1),[u,v]=(0,C.useState)(!1),[w,x]=(0,C.useState)(null),[y,z]=(0,C.useState)(null),[A,D]=(0,C.useState)(null),[G,I]=(0,C.useState)(!1);(0,C.useEffect)(()=>{a&&i&&(async()=>{n(!0),p(null),k(null),D(null),r(g);try{let b=await V.client.getMentalModel(i,a);k(b)}catch(a){console.error("Error loading mental model:",a),p(a.message)}finally{n(!1)}})()},[a,i,g]),(0,C.useEffect)(()=>{"history"===q&&j&&i&&null===A&&(async()=>{I(!0);try{let a=await V.client.getMentalModelHistory(i,j.id);D(a)}catch(a){console.error("Error loading mental model history:",a),D([])}finally{I(!1)}})()},[q,j,i,A]);let J=async()=>{if(i&&j){v(!0);try{let a=await V.client.getMentalModel(i,j.id);k(a),D(null)}catch(a){console.error("Error reloading mental model:",a)}finally{v(!1)}}},K=async()=>{if(!i||!j)return;t(!0);let a=j.last_refreshed_at;try{await V.client.refreshMentalModel(i,j.id);let b=0,c=async()=>{b++;try{let d=await V.client.getMentalModel(i,j.id);if(d.last_refreshed_at!==a){k(d),D(null),f?.(d),t(!1);return}if(b>=120){t(!1),F.toast.error(h("refreshTimeoutTitle"),{description:h("refreshTimeoutDescription")});return}setTimeout(c,1e3)}catch(a){console.error("Error polling mental model:",a),t(!1)}};setTimeout(c,1e3)}catch{t(!1)}},L=null!==a,M=j?.reflect_response?.based_on,O=M?Object.values(M).reduce((a,b)=>a+(b?.length??0),0):0;return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(bf.Dialog,{open:L,onOpenChange:a=>!a&&b(),children:(0,B.jsxs)(bf.DialogContent,{className:"w-[95vw] max-w-[95vw] h-[92vh] sm:max-w-[95vw] flex flex-col overflow-hidden",children:[(0,B.jsx)(bf.DialogHeader,{className:"pr-10",children:(0,B.jsxs)(bf.DialogTitle,{className:"flex items-center gap-2",children:[(0,B.jsx)("span",{className:"truncate",children:j?.name??h("mentalModelFallback")}),j&&(0,B.jsx)(W.Button,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 shrink-0",onClick:J,disabled:u,title:h("reloadData"),children:(0,B.jsx)(ad,{className:`h-3.5 w-3.5 ${u?"animate-spin":""}`})}),j?.trigger?.refresh_after_consolidation&&(0,B.jsxs)("span",{className:"flex items-center gap-1 px-2 py-0.5 rounded-full bg-green-500/10 text-green-600 dark:text-green-400 text-xs font-medium",children:[(0,B.jsx)(Kq,{className:"w-3 h-3"}),h("autoRefresh")]})]})}),l?(0,B.jsx)("div",{className:"flex items-center justify-center flex-1",children:(0,B.jsx)(bc.default,{className:"w-8 h-8 animate-spin text-muted-foreground"})}):o?(0,B.jsx)("div",{className:"flex items-center justify-center flex-1",children:(0,B.jsx)("div",{className:"text-center text-destructive",children:(0,B.jsx)("div",{className:"text-sm",children:h("errorPrefix",{error:o})})})}):j?(0,B.jsxs)(bh.Tabs,{value:q,onValueChange:a=>r(a),className:"flex-1 flex flex-col overflow-hidden",children:[(0,B.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,B.jsxs)(bh.TabsList,{className:"grid grid-cols-3 w-full max-w-md",children:[(0,B.jsxs)(bh.TabsTrigger,{value:"content",className:"flex items-center gap-1.5",children:[(0,B.jsx)(N.FileText,{className:"w-3.5 h-3.5"}),h("tabContent")]}),(0,B.jsxs)(bh.TabsTrigger,{value:"configuration",className:"flex items-center gap-1.5",children:[(0,B.jsx)(R,{className:"w-3.5 h-3.5"}),h("tabConfiguration")]}),(0,B.jsxs)(bh.TabsTrigger,{value:"history",className:"flex items-center gap-1.5",children:[(0,B.jsx)(bd,{className:"w-3.5 h-3.5"}),h("tabHistory")]})]}),(0,B.jsxs)(IN.DropdownMenu,{children:[(0,B.jsx)(IN.DropdownMenuTrigger,{asChild:!0,children:(0,B.jsx)(W.Button,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 shrink-0",disabled:s,"aria-label":h("actionsAriaLabel"),children:(0,B.jsx)(Ji,{className:"h-4 w-4"})})}),(0,B.jsxs)(IN.DropdownMenuContent,{align:"end",children:[c&&(0,B.jsxs)(IN.DropdownMenuItem,{onClick:()=>c(j),children:[(0,B.jsx)(Jh,{className:"h-4 w-4 mr-2"}),h("actionEdit")]}),(0,B.jsxs)(IN.DropdownMenuItem,{onClick:K,disabled:s,children:[(0,B.jsx)(ad,{className:"h-4 w-4 mr-2"}),h("actionRefreshManually")]}),e&&(0,B.jsxs)(IN.DropdownMenuItem,{onClick:()=>e(j),children:[(0,B.jsx)(Kr,{className:"h-4 w-4 mr-2"}),h("actionClearContent")]}),d&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(IN.DropdownMenuSeparator,{}),(0,B.jsxs)(IN.DropdownMenuItem,{onClick:()=>d(j),className:"text-red-600 focus:text-red-600 dark:text-red-400 dark:focus:text-red-400 focus:bg-red-500/10",children:[(0,B.jsx)(Jg,{className:"h-4 w-4 mr-2"}),h("actionDelete")]})]})]})]})]}),(0,B.jsxs)("div",{className:"flex-1 overflow-y-auto mt-4",children:[(0,B.jsxs)(bh.TabsContent,{value:"content",className:"mt-0 space-y-6",children:[(0,B.jsxs)("div",{className:"rounded-lg border border-border bg-muted/30 overflow-hidden",children:[(0,B.jsxs)("div",{className:"flex items-center justify-between gap-2 px-4 py-2 border-b border-border bg-muted/50 text-xs text-muted-foreground",children:[(0,B.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,B.jsx)(N.FileText,{className:"w-3.5 h-3.5"}),(0,B.jsx)("span",{className:"font-semibold uppercase tracking-wide",children:h("storedContent")}),(0,B.jsxs)("span",{className:"text-muted-foreground/70",children:["· ",h("charsCount",{count:j.content.length})]})]}),(0,B.jsxs)("div",{className:"flex items-center gap-2",children:[!0===j.is_stale?(0,B.jsx)("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-semibold uppercase tracking-wide bg-amber-500/15 text-amber-700 dark:text-amber-400",title:h("staleTitle"),children:h("stale")}):!1===j.is_stale?(0,B.jsx)("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-semibold uppercase tracking-wide bg-green-500/15 text-green-700 dark:text-green-400",title:h("inSyncTitle"),children:h("inSync")}):null,(0,B.jsxs)("span",{title:Ps(j.last_refreshed_at),className:"flex items-center gap-1",children:[(0,B.jsx)(ad,{className:"w-3 h-3"}),h("lastRefreshed",{time:Pr(j.last_refreshed_at)})]})]})]}),(0,B.jsx)(Po,{className:"p-4",children:j.content})]}),(0,B.jsxs)("div",{children:[(0,B.jsx)(PJ,{children:O>0?h("basedOnWithCount",{count:O}):h("basedOn")}),j.reflect_response?(0,B.jsx)(Px,{based_on:M,onViewMemory:a=>x(a),onViewDirective:a=>z(a)}):(0,B.jsx)("p",{className:"text-sm text-muted-foreground",children:h("noSourceData")})]})]}),(0,B.jsx)(bh.TabsContent,{value:"configuration",className:"mt-0",children:(0,B.jsx)(PI,{mentalModel:j})}),(0,B.jsx)(bh.TabsContent,{value:"history",className:"mt-0",children:G?(0,B.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,B.jsx)(bc.default,{className:"w-6 h-6 animate-spin text-muted-foreground"})}):A&&A.length>0?(0,B.jsx)(PD,{history:A,currentContent:j.content,currentBasedOn:M,onViewMemory:a=>x(a),onViewDirective:a=>z(a)}):(0,B.jsx)("p",{className:"text-sm text-muted-foreground italic",children:h("noHistory")})})]})]}):null]})}),w&&(0,B.jsx)(bo,{memoryId:w,onClose:()=>x(null)}),y&&(0,B.jsx)(Pq,{directiveId:y,onClose:()=>z(null)})]})}function PF({label:a,value:b}){return(0,B.jsxs)("div",{children:[(0,B.jsx)(PJ,{children:a}),(0,B.jsx)("div",{className:"text-sm text-foreground",children:b})]})}function PG({title:a,icon:b,children:c}){return(0,B.jsxs)("div",{className:"rounded-lg border border-border bg-muted/20 overflow-hidden",children:[(0,B.jsxs)("div",{className:"flex items-center gap-1.5 px-4 py-2 border-b border-border bg-muted/40 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:[b,a]}),(0,B.jsx)("div",{className:"p-4 space-y-4",children:c})]})}function PH({label:a,color:b}){return(0,B.jsx)("span",{className:`px-2 py-0.5 rounded text-xs ${b??"bg-muted text-foreground border border-border/60"}`,children:a})}function PI({mentalModel:a}){let b=(0,E.useTranslations)("mentalModelDetailModal"),c=a.trigger??{refresh_after_consolidation:!1},d=c.fact_types??[],e=c.tag_groups??[],f=c.exclude_mental_model_ids??[];return(0,B.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,B.jsxs)(PG,{title:b("identityTitle"),icon:(0,B.jsx)(N.FileText,{className:"w-3.5 h-3.5"}),children:[(0,B.jsx)(PF,{label:b("labelId"),value:(0,B.jsx)("code",{className:"text-xs font-mono text-muted-foreground break-all",children:a.id})}),(0,B.jsx)(PF,{label:b("labelName"),value:a.name}),a.source_query&&(0,B.jsx)(PF,{label:b("labelSourceQuery"),value:(0,B.jsx)("pre",{className:"text-sm font-mono text-foreground bg-muted/30 border border-border/60 rounded p-2 leading-6 m-0",style:{whiteSpace:"pre-wrap",wordBreak:"break-word",fontFamily:"var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace)"},children:a.source_query})}),(0,B.jsx)(PF,{label:b("labelTags"),value:a.tags?.length>0?(0,B.jsx)("div",{className:"flex flex-wrap gap-1.5",children:a.tags.map(a=>(0,B.jsx)(PH,{label:a,color:"bg-amber-500/10 text-amber-600 dark:text-amber-400"},a))}):(0,B.jsx)("span",{className:"text-muted-foreground italic text-sm",children:b("noTags")})})]}),(0,B.jsxs)(PG,{title:b("timingTitle"),icon:(0,B.jsx)(ad,{className:"w-3.5 h-3.5"}),children:[(0,B.jsx)(PF,{label:b("labelCreated"),value:Ps(a.created_at)}),(0,B.jsx)(PF,{label:b("labelLastRefreshed"),value:(0,B.jsx)("span",{title:Ps(a.last_refreshed_at),children:Pr(a.last_refreshed_at)})}),(0,B.jsx)(PF,{label:b("labelMaxTokens"),value:a.max_tokens.toLocaleString()})]}),(0,B.jsxs)(PG,{title:b("refreshTriggerTitle"),icon:(0,B.jsx)(Kq,{className:"w-3.5 h-3.5"}),children:[(0,B.jsx)(PF,{label:b("labelRefreshMode"),value:"delta"===c.mode?(0,B.jsx)(PH,{label:b("pillDelta"),color:"bg-purple-500/10 text-purple-600 dark:text-purple-400"}):(0,B.jsx)(PH,{label:b("pillFull")})}),(0,B.jsx)(PF,{label:b("labelAutoRefreshAfterConsolidation"),value:c.refresh_after_consolidation?(0,B.jsx)(PH,{label:b("pillEnabled"),color:"bg-green-500/10 text-green-600 dark:text-green-400"}):(0,B.jsx)(PH,{label:b("pillDisabled")})}),(0,B.jsx)(PF,{label:b("labelFactTypes"),value:d.length>0?(0,B.jsx)("div",{className:"flex flex-wrap gap-1.5",children:d.map(a=>{let c=Pv(a,b);return(0,B.jsx)(PH,{label:c.label,color:c.color},a)})}):(0,B.jsx)("span",{className:"text-muted-foreground italic text-sm",children:b("factTypesAll")})}),(0,B.jsx)(PF,{label:b("labelExcludeMentalModels"),value:c.exclude_mental_models?b("valueYes"):b("valueNo")}),f.length>0&&(0,B.jsx)(PF,{label:b("labelExcludedIds"),value:(0,B.jsx)("div",{className:"flex flex-wrap gap-1.5",children:f.map(a=>(0,B.jsx)("code",{className:"text-xs font-mono px-1.5 py-0.5 rounded bg-muted border border-border/60",children:a},a))})})]}),(0,B.jsxs)(PG,{title:b("recallParamsTitle"),icon:(0,B.jsx)(R,{className:"w-3.5 h-3.5"}),children:[(0,B.jsx)(PF,{label:b("labelIncludeChunks"),value:null==c.include_chunks?b("includeChunksDefault"):c.include_chunks?b("valueYes"):b("valueNo")}),(0,B.jsx)(PF,{label:b("labelRecallMaxTokens"),value:null!=c.recall_max_tokens?c.recall_max_tokens.toLocaleString():b("recallMaxTokensDefault")}),(0,B.jsx)(PF,{label:b("labelRecallChunksMaxTokens"),value:null!=c.recall_chunks_max_tokens?c.recall_chunks_max_tokens.toLocaleString():b("recallChunksMaxTokensDefault")}),(0,B.jsx)(PF,{label:b("labelTagsMatch"),value:c.tags_match?(0,B.jsx)(PH,{label:c.tags_match}):b("tagsMatchDefault")})]}),e.length>0&&(0,B.jsx)("div",{className:"md:col-span-2",children:(0,B.jsx)(PG,{title:b("tagGroupsTitle"),icon:(0,B.jsx)(R,{className:"w-3.5 h-3.5"}),children:(0,B.jsx)("pre",{className:"text-xs font-mono bg-muted/40 rounded p-3 overflow-x-auto border border-border/60",children:JSON.stringify(e,null,2)})})})]})}function PJ({children:a}){return(0,B.jsx)("div",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-2",children:a})}function PK(){let a,b,c,d,e,f,g,h,i,j,k,l=(0,E.useTranslations)("thinkView"),{currentBank:n}=(0,H.useBank)(),[o,p]=(0,C.useState)(""),[q,r]=(0,C.useState)("mid"),[s,t]=(0,C.useState)(4096),[u,v]=(0,C.useState)(!0),[w,x]=(0,C.useState)(!0),[y,z]=(0,C.useState)("answer"),[A,D]=(0,C.useState)(null),[F,G]=(0,C.useState)(!1),[I,J]=(0,C.useState)(""),[K,N]=(0,C.useState)("any"),[O,P]=(0,C.useState)([]),[Q,R]=(0,C.useState)(!1),[S,T]=(0,C.useState)(""),[U,Y]=(0,C.useState)(""),[Z,$]=(0,C.useState)(!1),[_,aa]=(0,C.useState)(!1),[ab,ac]=(0,C.useState)(null),[ad,ae]=(0,C.useState)(null),[ag,ah]=(0,C.useState)(null),[ai,aj]=(0,C.useState)(!1),[ak,al]=(0,C.useState)(null),[am,an]=(0,C.useState)(null),[ao,ap]=(0,C.useState)(!1),[aq,ar]=(0,C.useState)(null),[as,at]=(0,C.useState)("world"),au="General Feedback",av=async a=>{if(al(a),an(null),n&&a?.id){ap(!0);try{let b=await V.client.listObservations(n),c=b.items?.find(b=>b.id===a.id);an(c||a)}catch(b){console.error("Failed to load observation:",b),an(a)}finally{ap(!1)}}},aw=async()=>{if(n&&U.trim()){$(!0);try{let a=await V.client.listDirectives(n),b=a.items?.find(a=>a.name===au);if(b){let a=b.content?`${b.content}
|
|
8
|
+
${U.trim()}`:U.trim();await V.client.updateDirective(n,b.id,{content:a})}else await V.client.createDirective(n,{name:au,content:U.trim()});Y(""),aa(!0),setTimeout(()=>aa(!1),3e3)}catch(a){}finally{$(!1)}}},ax=async()=>{if(n&&o){G(!0),z("answer");try{let a=I.split(",").map(a=>a.trim()).filter(a=>a.length>0),b=S.split(",").map(a=>a.trim()).filter(a=>a.length>0),c=await V.client.reflect({bank_id:n,query:o,budget:q,max_tokens:s,include_facts:u,include_tool_calls:w,...a.length>0&&{tags:a,tags_match:K},...O.length>0&&{fact_types:O},...Q&&{exclude_mental_models:!0},...b.length>0&&{exclude_mental_model_ids:b}});D(c)}catch(a){}finally{G(!1)}}};return n?(0,B.jsxs)("div",{className:"space-y-6",children:[(0,B.jsx)(bp.Card,{children:(0,B.jsxs)(bp.CardContent,{className:"pt-6",children:[(0,B.jsxs)("div",{className:"flex gap-3",children:[(0,B.jsxs)("div",{className:"flex-1 relative",children:[(0,B.jsx)(L,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),(0,B.jsx)(X.Input,{type:"text",value:o,onChange:a=>p(a.target.value),placeholder:l("queryPlaceholder"),className:"pl-10 h-12 text-lg",onKeyDown:a=>"Enter"===a.key&&ax()})]}),(0,B.jsx)(W.Button,{onClick:ax,disabled:F||!o,className:"h-12 px-8",children:F?l("reflecting"):l("reflect")})]}),(0,B.jsxs)("div",{className:"flex flex-wrap items-center gap-6 mt-4 pt-4 border-t",children:[(0,B.jsxs)("div",{className:"flex items-center gap-2",children:[(0,B.jsx)("span",{className:"text-sm font-medium text-muted-foreground",children:l("budgetLabel")}),(0,B.jsxs)(a6.Select,{value:q,onValueChange:a=>r(a),children:[(0,B.jsx)(a6.SelectTrigger,{className:"w-24 h-8",children:(0,B.jsx)(a6.SelectValue,{})}),(0,B.jsxs)(a6.SelectContent,{children:[(0,B.jsx)(a6.SelectItem,{value:"low",children:l("budgetLow")}),(0,B.jsx)(a6.SelectItem,{value:"mid",children:l("budgetMid")}),(0,B.jsx)(a6.SelectItem,{value:"high",children:l("budgetHigh")})]})]})]}),(0,B.jsxs)("div",{className:"flex items-center gap-2",children:[(0,B.jsx)("span",{className:"text-sm text-muted-foreground",children:l("tokensLabel")}),(0,B.jsx)(X.Input,{type:"number",value:s,onChange:a=>t(parseInt(a.target.value)||4096),className:"w-24 h-8"})]}),(0,B.jsx)("div",{className:"h-6 w-px bg-border"}),(0,B.jsxs)("div",{className:"flex items-center gap-4",children:[(0,B.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,B.jsx)(IM.Checkbox,{checked:u,onCheckedChange:a=>v(a)}),(0,B.jsx)("span",{className:"text-sm",children:l("includeSource")})]}),(0,B.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,B.jsx)(IM.Checkbox,{checked:w,onCheckedChange:a=>x(a)}),(0,B.jsx)("span",{className:"text-sm",children:l("includeTools")})]})]})]}),(0,B.jsxs)("div",{className:"flex items-center gap-4 mt-4 pt-4 border-t",children:[(0,B.jsx)(a7,{className:"h-4 w-4 text-muted-foreground"}),(0,B.jsx)("div",{className:"flex-1 max-w-md",children:(0,B.jsx)(X.Input,{type:"text",value:I,onChange:a=>J(a.target.value),placeholder:l("tagsPlaceholder"),className:"h-8"})}),(0,B.jsxs)(a6.Select,{value:K,onValueChange:a=>N(a),children:[(0,B.jsx)(a6.SelectTrigger,{className:"w-40 h-8",children:(0,B.jsx)(a6.SelectValue,{})}),(0,B.jsxs)(a6.SelectContent,{children:[(0,B.jsx)(a6.SelectItem,{value:"any",children:l("tagsMatchAny")}),(0,B.jsx)(a6.SelectItem,{value:"all",children:l("tagsMatchAll")}),(0,B.jsx)(a6.SelectItem,{value:"any_strict",children:l("tagsMatchAnyStrict")}),(0,B.jsx)(a6.SelectItem,{value:"all_strict",children:l("tagsMatchAllStrict")})]})]})]}),(0,B.jsxs)("div",{className:"flex flex-wrap items-center gap-6 mt-4 pt-4 border-t",children:[(0,B.jsx)(JC,{value:O,onChange:P}),(0,B.jsx)("div",{className:"h-6 w-px bg-border"}),(0,B.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,B.jsx)(IM.Checkbox,{checked:Q,onCheckedChange:a=>R(a)}),(0,B.jsx)("span",{className:"text-sm",children:l("excludeMentalModels")})]}),(0,B.jsxs)("div",{className:"flex items-center gap-2",children:[(0,B.jsx)("span",{className:"text-sm text-muted-foreground",children:l("excludeIdsLabel")}),(0,B.jsx)(X.Input,{type:"text",value:S,onChange:a=>T(a.target.value),placeholder:l("excludeIdsPlaceholder"),className:"h-8 w-48"})]})]})]})}),F&&(0,B.jsx)(bp.Card,{children:(0,B.jsxs)(bp.CardContent,{className:"flex flex-col items-center justify-center py-16",children:[(0,B.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mb-4"}),(0,B.jsx)("p",{className:"text-muted-foreground",children:l("reflectingOnMemories")})]})}),!F&&A&&(0,B.jsxs)("div",{className:"space-y-4",children:[(0,B.jsxs)("div",{className:"flex items-center gap-6 text-sm",children:[A.usage&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)("div",{className:"flex items-center gap-2",children:[(0,B.jsx)("span",{className:"text-muted-foreground",children:l("inputTokensLabel")}),(0,B.jsx)("span",{className:"font-semibold",children:A.usage.input_tokens?.toLocaleString()})]}),(0,B.jsxs)("div",{className:"flex items-center gap-2",children:[(0,B.jsx)("span",{className:"text-muted-foreground",children:l("outputTokensLabel")}),(0,B.jsx)("span",{className:"font-semibold",children:A.usage.output_tokens?.toLocaleString()})]})]}),A.trace?.tool_calls&&(0,B.jsxs)("div",{className:"flex items-center gap-2",children:[(0,B.jsx)("span",{className:"text-muted-foreground",children:l("toolCallsLabel")}),(0,B.jsx)("span",{className:"font-semibold",children:A.trace.tool_calls.length}),(0,B.jsxs)("span",{className:"text-muted-foreground",children:["(",A.trace.tool_calls.reduce((a,b)=>a+b.duration_ms,0),"ms)"]})]}),A.trace?.llm_calls&&(0,B.jsxs)("div",{className:"flex items-center gap-2",children:[(0,B.jsx)("span",{className:"text-muted-foreground",children:l("llmCallsLabel")}),(0,B.jsx)("span",{className:"font-semibold",children:A.trace.llm_calls.length}),(0,B.jsxs)("span",{className:"text-muted-foreground",children:["(",A.trace.llm_calls.reduce((a,b)=>a+b.duration_ms,0),"ms)"]})]}),(0,B.jsx)("div",{className:"flex-1"}),(0,B.jsx)("div",{className:"flex gap-1 bg-muted p-1 rounded-lg",children:["answer","trace","json"].map(a=>(0,B.jsx)("button",{onClick:()=>z(a),className:`px-3 py-1.5 text-sm font-medium rounded-md transition-colors ${y===a?"bg-background shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:"answer"===a?l("viewAnswer"):"trace"===a?l("viewTrace"):l("viewJson")},a))})]}),"answer"===y&&(0,B.jsxs)("div",{className:"space-y-6",children:[(0,B.jsxs)(bp.Card,{children:[(0,B.jsx)(bp.CardHeader,{children:(0,B.jsx)(bp.CardTitle,{children:l("answerTitle")})}),(0,B.jsx)(bp.CardContent,{children:(0,B.jsx)("div",{className:"prose prose-sm max-w-none dark:prose-invert",children:(0,B.jsx)(NS,{remarkPlugins:[Pl],children:A.text})})})]}),(0,B.jsxs)(bp.Card,{className:"border-blue-200 dark:border-blue-800",children:[(0,B.jsxs)(bp.CardHeader,{className:"py-4",children:[(0,B.jsxs)(bp.CardTitle,{className:"flex items-center gap-2 text-base",children:[(0,B.jsx)(JG,{className:"w-4 h-4"}),l("addDirectiveTitle")]}),(0,B.jsx)(bp.CardDescription,{className:"text-xs",children:l("addDirectiveDescription")})]}),(0,B.jsx)(bp.CardContent,{className:"pt-0",children:_?(0,B.jsxs)("div",{className:"flex items-center gap-2 text-green-600 dark:text-green-400",children:[(0,B.jsx)("span",{className:"text-lg",children:"✓"}),(0,B.jsx)("span",{className:"text-sm font-medium",children:l("directiveSaved",{name:au})})]}):(0,B.jsxs)("div",{className:"flex gap-3",children:[(0,B.jsx)(JJ.Textarea,{value:U,onChange:a=>Y(a.target.value),placeholder:l("directivePlaceholder"),className:"flex-1 min-h-[60px] resize-none",onKeyDown:a=>{"Enter"===a.key&&(a.metaKey||a.ctrlKey)&&aw()}}),(0,B.jsx)(W.Button,{onClick:aw,disabled:Z||!U.trim(),className:"self-end",children:Z?l("savingDirective"):l("saveDirective")})]})})]})]}),"trace"===y&&(0,B.jsxs)("div",{className:"space-y-4",children:[A.observations_created&&A.observations_created.length>0&&(0,B.jsxs)(bp.Card,{className:"border-emerald-200 dark:border-emerald-800",children:[(0,B.jsxs)(bp.CardHeader,{className:"bg-emerald-50 dark:bg-emerald-950 py-3",children:[(0,B.jsxs)(bp.CardTitle,{className:"flex items-center gap-2 text-base",children:[(0,B.jsx)(JF,{className:"w-4 h-4 text-emerald-600"}),l("observationsCreatedTitle",{count:A.observations_created.length})]}),(0,B.jsx)(bp.CardDescription,{className:"text-xs",children:l("observationsCreatedDescription")})]}),(0,B.jsx)(bp.CardContent,{className:"pt-4",children:(0,B.jsx)("div",{className:"space-y-2",children:A.observations_created.map((a,b)=>(0,B.jsxs)("div",{className:"p-3 bg-emerald-50 dark:bg-emerald-950/50 rounded-lg border border-emerald-200 dark:border-emerald-800",children:[(0,B.jsx)("div",{className:"font-medium text-sm text-emerald-900 dark:text-emerald-100",children:a.name}),(0,B.jsx)("div",{className:"text-xs text-emerald-700 dark:text-emerald-300 mt-1",children:a.description}),(0,B.jsxs)("div",{className:"text-[10px] text-muted-foreground mt-2 font-mono",children:["ID: ",a.id]})]},b))})})]}),(0,B.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[(0,B.jsxs)(bp.Card,{className:"h-fit",children:[(0,B.jsxs)(bp.CardHeader,{className:"pb-3",children:[(0,B.jsx)(bp.CardTitle,{className:"text-base",children:l("executionTraceTitle")}),(0,B.jsx)(bp.CardDescription,{className:"text-xs",children:l("executionTraceDescription",{iterations:A.iterations||0,iterationsPlural:1!==(A.iterations||0)?"s":"",totalMs:(A.trace?.llm_calls?.reduce((a,b)=>a+b.duration_ms,0)||0)+(A.trace?.tool_calls?.reduce((a,b)=>a+b.duration_ms,0)||0)})})]}),(0,B.jsx)(bp.CardContent,{children:w?A.trace?.llm_calls&&A.trace.llm_calls.length>0||A.trace?.tool_calls&&A.trace.tool_calls.length>0?(0,B.jsx)("div",{className:"max-h-[500px] overflow-y-auto pr-2",children:(a=A.trace?.llm_calls||[],b=A.trace?.tool_calls||[],c=[],a.forEach((d,e)=>{let f=b.filter(a=>a.iteration===e+1),g=e===a.length-1,h=d.scope.includes("final")||g&&0===f.length,i=h?a.length:e+1;c.push({type:"llm",llm:d,iteration:i,isFinal:h}),f.length>0&&c.push({type:"tools",tools:f,iteration:e+1})}),c.map((a,b)=>(0,B.jsxs)("div",{className:"relative",children:[b<c.length-1&&(0,B.jsx)("div",{className:"absolute left-3 top-6 bottom-0 w-0.5 bg-border"}),"llm"===a.type?(0,B.jsxs)("div",{className:"flex items-start gap-3 pb-3",children:[(0,B.jsx)("div",{className:`w-6 h-6 rounded-full flex items-center justify-center flex-shrink-0 ${a.isFinal?"bg-emerald-500/15 text-emerald-600 dark:text-emerald-400":"bg-primary/10 text-primary"}`,children:a.isFinal?(0,B.jsx)(ba.Check,{className:"w-3.5 h-3.5",strokeWidth:2.5}):(0,B.jsx)("span",{className:"text-[10px] font-semibold",children:a.iteration})}),(0,B.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,B.jsxs)("div",{className:"flex items-center justify-between",children:[(0,B.jsx)("span",{className:"font-medium text-sm",children:a.isFinal?l("responseGenerated"):l("agentDecided")}),(0,B.jsxs)("span",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[(0,B.jsx)(af,{className:"w-3 h-3"}),a.llm.duration_ms,"ms"]})]}),(0,B.jsx)("span",{className:"text-xs text-muted-foreground",children:a.isFinal?l("finalAnswer"):l("calledToolsBelow")})]})]}):(0,B.jsxs)("div",{className:"flex items-start gap-3 pb-3",children:[(0,B.jsx)("div",{className:"w-6 h-6 rounded-full flex items-center justify-center bg-blue-500/15 text-blue-600 dark:text-blue-400 flex-shrink-0",children:(0,B.jsx)(JI,{className:"w-3 h-3",fill:"currentColor"})}),(0,B.jsxs)("div",{className:"flex-1 min-w-0 space-y-2",children:[(0,B.jsx)("div",{className:"text-xs text-muted-foreground",children:(a.tools?.length??0)!==1?l("executingToolsPlural",{count:a.tools?.length??0}):l("executingTools",{count:a.tools?.length??0})}),a.tools?.map((a,b)=>(0,B.jsxs)("div",{className:"border border-border rounded-lg overflow-hidden",children:[(0,B.jsxs)("div",{className:"flex items-center justify-between px-3 py-1.5 bg-muted/50",children:[(0,B.jsx)("span",{className:"font-medium text-sm text-foreground",children:a.tool}),(0,B.jsxs)("span",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[(0,B.jsx)(af,{className:"w-3 h-3"}),a.duration_ms,"ms"]})]}),(0,B.jsxs)("div",{className:"p-2 space-y-2",children:[(0,B.jsxs)("div",{children:[(0,B.jsx)("p",{className:"text-[10px] font-semibold text-muted-foreground mb-1",children:l("toolInputLabel")}),(0,B.jsx)("div",{className:"bg-muted p-1.5 rounded text-xs overflow-auto max-h-32",children:(0,B.jsx)(Kp,{src:a.input,collapsed:1,theme:"default"})})]}),a.output&&(0,B.jsxs)("div",{children:[(0,B.jsx)("p",{className:"text-[10px] font-semibold text-muted-foreground mb-1",children:l("toolOutputLabel")}),(0,B.jsx)("div",{className:"bg-muted p-1.5 rounded text-xs overflow-auto max-h-32",children:(0,B.jsx)(Kp,{src:a.output,collapsed:1,theme:"default"})})]})]})]},b))]})]})]},b)))}):(0,B.jsxs)("div",{className:"flex items-start gap-3 p-3 bg-muted border border-border rounded-lg",children:[(0,B.jsx)(JE.Info,{className:"w-4 h-4 text-muted-foreground mt-0.5 flex-shrink-0"}),(0,B.jsxs)("div",{children:[(0,B.jsx)("p",{className:"font-medium text-sm text-foreground",children:l("noOperations")}),(0,B.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:l("noOperationsDescription")})]})]}):(0,B.jsxs)("div",{className:"flex items-start gap-3 p-3 bg-muted border border-border rounded-lg",children:[(0,B.jsx)(JE.Info,{className:"w-4 h-4 text-muted-foreground mt-0.5 flex-shrink-0"}),(0,B.jsxs)("div",{children:[(0,B.jsx)("p",{className:"font-medium text-sm text-foreground",children:l("notIncluded")}),(0,B.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:l("enableIncludeTools")})]})]})})]}),(0,B.jsxs)(bp.Card,{className:"h-fit",children:[(0,B.jsxs)(bp.CardHeader,{className:"pb-3",children:[(0,B.jsx)(bp.CardTitle,{className:"text-base",children:l("basedOnTitle")}),(0,B.jsx)(bp.CardDescription,{className:"text-xs",children:l("basedOnDescription",{count:(A.based_on?.memories?.length||0)+(A.based_on?.observations?.filter(a=>"directive"!==a.subtype)?.length||0)+(A.based_on?.directives?.length||0)})})]}),(0,B.jsx)(bp.CardContent,{children:u?A.based_on?.memories&&A.based_on.memories.length>0||A.based_on?.mental_models&&A.based_on.mental_models.length>0||A.based_on?.directives&&A.based_on.directives.length>0||A.based_on?.observations&&A.based_on.observations.length>0?(e=(d=A.based_on?.memories||[]).filter(a=>"world"===a.type),f=d.filter(a=>"experience"===a.type),g=A.based_on?.mental_models||[],h=(A.based_on?.observations||[]).filter(a=>"directive"!==a.subtype),i=A.based_on?.directives||[],j=[{id:"directives",label:l("tabDirectives"),count:i.length},{id:"mental_models",label:l("tabMentalModels"),count:g.length},{id:"observations",label:l("tabObservations"),count:h.length},{id:"world",label:l("tabWorld"),count:e.length},{id:"experience",label:l("tabExperience"),count:f.length}],k=(()=>{switch(as){case"directives":return i;case"mental_models":return g;case"observations":return h;case"world":return e;case"experience":return f;default:return[]}})(),(0,B.jsxs)("div",{children:[(0,B.jsx)("div",{className:"flex items-center gap-1 bg-muted rounded-lg p-1 mb-4",children:j.map(a=>(0,B.jsxs)("button",{onClick:()=>at(a.id),className:`flex-1 px-3 py-1.5 rounded-md text-sm font-medium transition-all ${as===a.id?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:[a.label," (",a.count,")"]},a.id))}),k.length>0?(0,B.jsx)("div",{className:"max-h-[400px] overflow-y-auto pr-2 space-y-3",children:k.map((a,b)=>{let c,d;return(0,B.jsx)("div",{className:`p-4 bg-muted/50 rounded-lg border border-border/50 ${"directives"!==as?"cursor-pointer hover:bg-muted/80 transition-colors":""}`,onClick:()=>{"directives"!==as&&("observations"===as?av(a):"mental_models"===as?ar(a.id):ac(a.id))},children:"directives"===as?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)("div",{className:"font-medium text-sm",children:a.name}),a.content&&(0,B.jsx)("p",{className:"mt-1 text-xs text-muted-foreground line-clamp-2",children:a.content})]}):"observations"===as?(0,B.jsx)("div",{className:"font-medium text-sm",children:a.name}):"mental_models"===as?(d=(c=a.text?.indexOf(": ")??-1)>0?a.text.slice(0,c):a.id,(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)("div",{className:"font-medium text-sm",children:d}),(0,B.jsx)("code",{className:"text-xs font-mono text-muted-foreground",children:a.id})]})):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)("p",{className:"text-sm text-foreground leading-relaxed",children:a.text}),a.context&&(0,B.jsx)("div",{className:"text-xs text-muted-foreground mt-2",children:a.context})]})},a.id||b)})}):(0,B.jsx)("p",{className:"text-sm text-muted-foreground text-center py-4",children:l("noTabItems",{tab:as})})]})):(0,B.jsxs)("div",{className:"flex items-start gap-3 p-3 bg-amber-50 dark:bg-amber-950 border border-amber-200 dark:border-amber-800 rounded-lg",children:[(0,B.jsx)(JE.Info,{className:"w-4 h-4 text-amber-600 dark:text-amber-400 mt-0.5 flex-shrink-0"}),(0,B.jsxs)("div",{children:[(0,B.jsx)("p",{className:"font-medium text-sm text-amber-900 dark:text-amber-100",children:l("noFactsFound")}),(0,B.jsx)("p",{className:"text-xs text-amber-700 dark:text-amber-300 mt-0.5",children:l("noFactsFoundDescription")})]})]}):(0,B.jsxs)("div",{className:"flex items-start gap-3 p-3 bg-muted border border-border rounded-lg",children:[(0,B.jsx)(JE.Info,{className:"w-4 h-4 text-muted-foreground mt-0.5 flex-shrink-0"}),(0,B.jsxs)("div",{children:[(0,B.jsx)("p",{className:"font-medium text-sm text-foreground",children:l("notIncludedBasedOn")}),(0,B.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:l("enableIncludeSource")})]})]})})]})]})]}),"json"===y&&(0,B.jsxs)(bp.Card,{children:[(0,B.jsx)(bp.CardHeader,{children:(0,B.jsx)(bp.CardTitle,{className:"text-lg",children:l("rawResponseTitle")})}),(0,B.jsx)(bp.CardContent,{children:(0,B.jsx)("div",{className:"bg-muted p-4 rounded-lg overflow-auto max-h-[600px]",children:(0,B.jsx)(Kp,{src:A,collapsed:2,theme:"default"})})})]})]}),!F&&!A&&(0,B.jsx)(bp.Card,{className:"border-dashed",children:(0,B.jsxs)(bp.CardContent,{className:"flex flex-col items-center justify-center py-16",children:[(0,B.jsx)(L,{className:"h-12 w-12 text-muted-foreground mb-4"}),(0,B.jsx)("h3",{className:"text-lg font-semibold mb-2",children:l("readyToReflect")}),(0,B.jsx)("p",{className:"text-muted-foreground text-center max-w-md",children:l("readyToReflectDescription")})]})}),(0,B.jsx)(bo,{memoryId:ab,onClose:()=>ac(null)}),ad&&(0,B.jsx)("div",{className:"fixed right-0 top-0 h-screen w-[420px] bg-card border-l shadow-2xl z-50 overflow-y-auto",children:(0,B.jsxs)("div",{className:"p-6",children:[(0,B.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,B.jsxs)("div",{className:"flex items-center gap-2",children:[(0,B.jsx)(JH,{className:"w-5 h-5"}),(0,B.jsx)("h2",{className:"text-lg font-semibold",children:"Directive"})]}),(0,B.jsx)(W.Button,{variant:"ghost",size:"icon",onClick:()=>{ae(null),ah(null)},children:(0,B.jsx)(bb.X,{className:"w-4 h-4"})})]}),ai?(0,B.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,B.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})}):(0,B.jsxs)("div",{className:"space-y-4",children:[(0,B.jsxs)("div",{children:[(0,B.jsx)("h3",{className:"text-sm font-medium text-muted-foreground",children:"Name"}),(0,B.jsx)("p",{className:"mt-1 font-medium",children:ag?.name||ad.name})]}),ag?.description&&(0,B.jsxs)("div",{children:[(0,B.jsx)("h3",{className:"text-sm font-medium text-muted-foreground",children:"Description"}),(0,B.jsx)("p",{className:"mt-1 text-sm",children:ag.description})]}),ag?.tags&&ag.tags.length>0&&(0,B.jsxs)("div",{children:[(0,B.jsx)("h3",{className:"text-sm font-medium text-muted-foreground mb-1",children:"Tags"}),(0,B.jsx)("div",{className:"flex flex-wrap gap-1",children:ag.tags.map(a=>(0,B.jsxs)("span",{className:"text-xs px-2 py-0.5 rounded bg-muted text-muted-foreground flex items-center gap-1",children:[(0,B.jsx)(a7,{className:"w-2.5 h-2.5"}),a]},a))})]}),(ag?.content||ad.content)&&(0,B.jsxs)("div",{children:[(0,B.jsx)("h3",{className:"text-sm font-medium text-muted-foreground mb-2",children:"Content"}),(0,B.jsx)("div",{className:"p-3 bg-muted rounded-lg",children:(0,B.jsx)("div",{className:"text-sm text-muted-foreground whitespace-pre-wrap",children:ag?.content||ad.content})})]}),(0,B.jsxs)("div",{className:"pt-2 border-t",children:[(0,B.jsx)("h3",{className:"text-sm font-medium text-muted-foreground",children:"ID"}),(0,B.jsx)("p",{className:"mt-1 font-mono text-xs text-muted-foreground",children:ad.id})]})]})]})}),ak&&(0,B.jsx)("div",{className:"fixed right-0 top-0 h-screen w-[420px] bg-card border-l shadow-2xl z-50 overflow-y-auto",children:(0,B.jsxs)("div",{className:"p-6",children:[(0,B.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,B.jsxs)("div",{className:"flex items-center gap-2",children:[(0,B.jsx)(JF,{className:"w-5 h-5"}),(0,B.jsx)("h2",{className:"text-lg font-semibold",children:l("observationPanelTitle")})]}),(0,B.jsx)(W.Button,{variant:"ghost",size:"icon",onClick:()=>{al(null),an(null)},children:(0,B.jsx)(bb.X,{className:"w-4 h-4"})})]}),ao?(0,B.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,B.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})}):(0,B.jsxs)("div",{className:"space-y-4",children:[(0,B.jsxs)("div",{children:[(0,B.jsx)("h3",{className:"text-sm font-medium text-muted-foreground",children:l("observationTextField")}),(0,B.jsx)("div",{className:"mt-1 prose prose-sm max-w-none dark:prose-invert",children:(0,B.jsx)(NS,{remarkPlugins:[Pl],children:am?.text||ak.text})})]}),am?.tags&&am.tags.length>0&&(0,B.jsxs)("div",{children:[(0,B.jsx)("h3",{className:"text-sm font-medium text-muted-foreground mb-1",children:l("observationTagsField")}),(0,B.jsx)("div",{className:"flex flex-wrap gap-1",children:am.tags.map(a=>(0,B.jsxs)("span",{className:"text-xs px-2 py-0.5 rounded bg-muted text-muted-foreground flex items-center gap-1",children:[(0,B.jsx)(a7,{className:"w-2.5 h-2.5"}),a]},a))})]}),am?.source_memories&&am.source_memories.length>0&&(0,B.jsxs)("div",{children:[(0,B.jsx)("h3",{className:"text-sm font-medium text-muted-foreground mb-2",children:l("observationSourceMemoriesField",{count:am.source_memories.length})}),(0,B.jsx)("div",{className:"space-y-2",children:am.source_memories.map((a,b)=>(0,B.jsx)("div",{className:"p-3 bg-muted rounded-lg",children:(0,B.jsx)("div",{className:"text-sm text-muted-foreground whitespace-pre-wrap",children:a.text||("string"==typeof a?a:"")})},b))})]}),(0,B.jsxs)("div",{className:"pt-2 border-t",children:[(0,B.jsx)("h3",{className:"text-sm font-medium text-muted-foreground",children:l("observationIdField")}),(0,B.jsx)("p",{className:"mt-1 font-mono text-xs text-muted-foreground",children:ak.id})]})]})]})}),(0,B.jsx)(PE,{mentalModelId:aq,onClose:()=>ar(null)})]}):(0,B.jsx)(bp.Card,{className:"border-dashed",children:(0,B.jsxs)(bp.CardContent,{className:"flex flex-col items-center justify-center py-16",children:[(0,B.jsx)(M,{className:"h-12 w-12 text-muted-foreground mb-4"}),(0,B.jsx)("h3",{className:"text-xl font-semibold mb-2",children:l("noBankSelected")}),(0,B.jsx)("p",{className:"text-muted-foreground",children:l("noBankSelectedDescription")})]})})}let PL=(0,K.default)("arrow-down",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);function PM(){let a,b,c,d,e,f,g,h,i,j,k,l,n,o,p=(0,E.useTranslations)("searchDebug"),{currentBank:q}=(0,H.useBank)(),[r,s]=(0,C.useState)(""),[t,u]=(0,C.useState)(["world"]),[v,w]=(0,C.useState)("mid"),[x,y]=(0,C.useState)(4096),[z,A]=(0,C.useState)(""),[D,G]=(0,C.useState)(!1),[I,K]=(0,C.useState)(!1),[L,P]=(0,C.useState)(""),[R,S]=(0,C.useState)("any"),[T,U]=(0,C.useState)(null),[Z,$]=(0,C.useState)(null),[_,aa]=(0,C.useState)(null),[ab,ac]=(0,C.useState)(null),[ad,ae]=(0,C.useState)(null),[ag,ah]=(0,C.useState)(!1),[ai,aj]=(0,C.useState)("results"),[ak,al]=(0,C.useState)(null),[am,an]=(0,C.useState)(new Set),[ao,ap]=(0,C.useState)(new Set),aq=a=>{an(b=>{let c=new Set(b);return c.has(a)?c.delete(a):c.add(a),c})},ar=a=>{ap(b=>{let c=new Set(b);return c.has(a)?c.delete(a):c.add(a),c})},as=a=>{let b=a.id||a.node_id;al(T?.find(a=>a.id===b||a.node_id===b)||a)},at=async()=>{if(!q)return void F.toast.error(p("errorSelectBank"));if(r){if(0===t.length)return void F.toast.error(p("errorSelectFactType"));ah(!0);try{let a=L.split(",").map(a=>a.trim()).filter(a=>a.length>0),b={bank_id:q,query:r,types:t,budget:v,max_tokens:x,trace:!0,include:{entities:I?{max_tokens:500}:null,chunks:D?{max_tokens:8192}:null},...z&&{query_timestamp:z},...a.length>0&&{tags:a,tags_match:R}},c=await V.client.recall(b);U(c.results||[]),$(c.entities||null),aa(c.chunks||null),ac(c.observations||null),ae(c.trace||null),aj("results")}catch(a){}finally{ah(!1)}}};return q?(0,B.jsxs)("div",{className:"space-y-6",children:[(0,B.jsx)(bp.Card,{children:(0,B.jsxs)(bp.CardContent,{className:"pt-6",children:[(0,B.jsxs)("div",{className:"flex gap-3",children:[(0,B.jsxs)("div",{className:"flex-1 relative",children:[(0,B.jsx)(J.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),(0,B.jsx)(X.Input,{type:"text",value:r,onChange:a=>s(a.target.value),placeholder:p("queryPlaceholder"),className:"pl-10 h-12 text-lg",onKeyDown:a=>"Enter"===a.key&&at()})]}),(0,B.jsx)(W.Button,{onClick:at,disabled:ag||!r,className:"h-12 px-8",children:ag?p("searching"):p("recall")})]}),(0,B.jsxs)("div",{className:"flex flex-wrap items-center gap-6 mt-4 pt-4 border-t",children:[(0,B.jsx)(JC,{value:t,onChange:u,label:p("typesLabel")}),(0,B.jsx)("div",{className:"h-6 w-px bg-border"}),(0,B.jsxs)("div",{className:"flex items-center gap-2",children:[(0,B.jsx)(Kq,{className:"h-4 w-4 text-muted-foreground"}),(0,B.jsxs)(a6.Select,{value:v,onValueChange:a=>w(a),children:[(0,B.jsx)(a6.SelectTrigger,{className:"w-24 h-8",children:(0,B.jsx)(a6.SelectValue,{})}),(0,B.jsxs)(a6.SelectContent,{children:[(0,B.jsx)(a6.SelectItem,{value:"low",children:p("budgetLow")}),(0,B.jsx)(a6.SelectItem,{value:"mid",children:p("budgetMid")}),(0,B.jsx)(a6.SelectItem,{value:"high",children:p("budgetHigh")})]})]})]}),(0,B.jsxs)("div",{className:"flex items-center gap-2",children:[(0,B.jsx)("span",{className:"text-sm text-muted-foreground",children:p("tokensLabel")}),(0,B.jsx)(X.Input,{type:"number",value:x,onChange:a=>y(parseInt(a.target.value)),className:"w-24 h-8"})]}),(0,B.jsxs)("div",{className:"flex items-center gap-2",children:[(0,B.jsx)(af,{className:"h-4 w-4 text-muted-foreground"}),(0,B.jsx)(X.Input,{type:"datetime-local",value:z,onChange:a=>A(a.target.value),className:"h-8",placeholder:p("queryDatePlaceholder")})]}),(0,B.jsx)("div",{className:"h-6 w-px bg-border"}),(0,B.jsxs)("div",{className:"flex items-center gap-4",children:[(0,B.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,B.jsx)(IM.Checkbox,{checked:D,onCheckedChange:a=>G(a)}),(0,B.jsx)(N.FileText,{className:"h-4 w-4 text-muted-foreground"}),(0,B.jsx)("span",{className:"text-sm",children:p("chunks")})]}),(0,B.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,B.jsx)(IM.Checkbox,{checked:I,onCheckedChange:a=>K(a)}),(0,B.jsx)(O,{className:"h-4 w-4 text-muted-foreground"}),(0,B.jsx)("span",{className:"text-sm",children:p("entities")})]})]})]}),(0,B.jsxs)("div",{className:"flex items-center gap-4 mt-4 pt-4 border-t",children:[(0,B.jsx)(a7,{className:"h-4 w-4 text-muted-foreground"}),(0,B.jsx)("div",{className:"flex-1 max-w-md",children:(0,B.jsx)(X.Input,{type:"text",value:L,onChange:a=>P(a.target.value),placeholder:p("tagsPlaceholder"),className:"h-8"})}),(0,B.jsxs)(a6.Select,{value:R,onValueChange:a=>S(a),children:[(0,B.jsx)(a6.SelectTrigger,{className:"w-40 h-8",children:(0,B.jsx)(a6.SelectValue,{})}),(0,B.jsxs)(a6.SelectContent,{children:[(0,B.jsx)(a6.SelectItem,{value:"any",children:p("tagsMatchAny")}),(0,B.jsx)(a6.SelectItem,{value:"all",children:p("tagsMatchAll")}),(0,B.jsx)(a6.SelectItem,{value:"any_strict",children:p("tagsMatchAnyStrict")}),(0,B.jsx)(a6.SelectItem,{value:"all_strict",children:p("tagsMatchAllStrict")})]})]})]})]})}),ag&&(0,B.jsx)(bp.Card,{children:(0,B.jsxs)(bp.CardContent,{className:"flex flex-col items-center justify-center py-16",children:[(0,B.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mb-4"}),(0,B.jsx)("p",{className:"text-muted-foreground",children:p("searchingMemories")})]})}),!ag&&T&&(0,B.jsxs)("div",{className:"space-y-4",children:[ad?.summary&&(0,B.jsxs)("div",{className:"flex items-center gap-6 text-sm",children:[(0,B.jsxs)("div",{className:"flex items-center gap-2",children:[(0,B.jsx)("span",{className:"text-muted-foreground",children:p("resultsLabel")}),(0,B.jsx)("span",{className:"font-semibold",children:T.length})]}),(0,B.jsxs)("div",{className:"flex items-center gap-2",children:[(0,B.jsx)("span",{className:"text-muted-foreground",children:p("durationLabel")}),(0,B.jsxs)("span",{className:"font-semibold",children:[ad.summary.total_duration_seconds?.toFixed(2),"s"]})]}),(0,B.jsxs)("div",{className:"flex items-center gap-2",children:[(0,B.jsx)("span",{className:"text-muted-foreground",children:p("nodesVisitedLabel")}),(0,B.jsx)("span",{className:"font-semibold",children:ad.summary.total_nodes_visited})]}),(0,B.jsx)("div",{className:"flex-1"}),(0,B.jsx)("div",{className:"flex gap-1 bg-muted p-1 rounded-lg",children:["results","trace","json"].map(a=>(0,B.jsx)("button",{onClick:()=>aj(a),className:`px-3 py-1.5 text-sm font-medium rounded-md transition-colors ${ai===a?"bg-background shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:"results"===a?p("viewResults"):"trace"===a?p("viewTrace"):p("viewJson")},a))})]}),"results"===ai&&(0,B.jsxs)("div",{className:"space-y-4",children:[ab&&ab.length>0&&(0,B.jsxs)(bp.Card,{className:"border-orange-500/30 bg-orange-500/5",children:[(0,B.jsx)(bp.CardHeader,{className:"py-3",children:(0,B.jsxs)(bp.CardTitle,{className:"text-base flex items-center gap-2",children:[(0,B.jsx)(M,{className:"h-4 w-4 text-orange-500"}),(0,B.jsx)("span",{children:"Observations"}),(0,B.jsxs)("span",{className:"text-xs text-muted-foreground",children:["(",ab.length,")"]})]})}),(0,B.jsx)(bp.CardContent,{className:"pt-0 space-y-2",children:ab.map((a,b)=>(0,B.jsxs)("div",{className:"p-3 bg-background rounded-lg border border-orange-500/20",children:[(0,B.jsx)("p",{className:"text-sm text-foreground",children:a.text}),(0,B.jsxs)("div",{className:"flex items-center gap-3 mt-2 text-xs text-muted-foreground",children:[(0,B.jsx)("span",{className:"px-2 py-0.5 rounded bg-orange-500/10 text-orange-600",children:"Observation"}),(0,B.jsx)("span",{children:p("proofCount",{count:a.proof_count||1})}),(0,B.jsx)("span",{children:p("relevance",{value:(a.relevance||0).toFixed(3)})})]})]},a.id||b))})]}),(0,B.jsx)("div",{className:"space-y-3",children:0!==T.length||ab&&0!==ab.length?T.map((a,b)=>{let c=ad?.visits?.find(b=>b.node_id===a.id),d=c?c.weights.final_weight:a.score||0;return(0,B.jsx)(bp.Card,{className:"cursor-pointer hover:border-primary/50 transition-colors",onClick:()=>al(a),children:(0,B.jsx)(bp.CardContent,{className:"py-4",children:(0,B.jsxs)("div",{className:"flex items-start gap-4",children:[(0,B.jsx)("div",{className:"flex-shrink-0 w-8 h-8 rounded-full bg-primary/10 flex items-center justify-center",children:(0,B.jsx)("span",{className:"text-sm font-semibold text-primary",children:b+1})}),(0,B.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,B.jsx)("p",{className:"text-foreground",children:a.text}),(0,B.jsxs)("div",{className:"flex items-center gap-4 mt-2 text-xs text-muted-foreground",children:[(0,B.jsx)("span",{className:"px-2 py-0.5 rounded bg-muted capitalize",children:a.type||"world"}),a.context&&(0,B.jsx)("span",{className:"truncate max-w-xs",children:a.context}),a.occurred_start&&(0,B.jsx)("span",{children:new Date(a.occurred_start).toLocaleDateString()})]})]}),(0,B.jsxs)("div",{className:"flex-shrink-0 text-right",children:[(0,B.jsx)("div",{className:"text-sm font-semibold",children:(d??0).toFixed(3)}),(0,B.jsx)("div",{className:"text-xs text-muted-foreground",children:p("scoreLabel")})]}),(0,B.jsx)(Q.ChevronRight,{className:"h-5 w-5 text-muted-foreground flex-shrink-0"})]})})},b)}):(0,B.jsx)(bp.Card,{children:(0,B.jsxs)(bp.CardContent,{className:"flex flex-col items-center justify-center py-12",children:[(0,B.jsx)(J.Search,{className:"h-12 w-12 text-muted-foreground mb-4"}),(0,B.jsx)("p",{className:"text-muted-foreground",children:p("noMemoriesFound")})]})})})]}),"trace"===ai&&ad&&(0,B.jsxs)("div",{className:"space-y-4",children:[ad.retrieval_results&&ad.retrieval_results.length>0&&(a={},ad.retrieval_results.forEach(b=>{let c=b.fact_type||"all";a[c]||(a[c]=[]),a[c].push(b)}),b=Object.keys(a),(0,B.jsxs)("div",{children:[(0,B.jsxs)("div",{className:"text-xs font-medium text-muted-foreground mb-3 flex items-center gap-2",children:[(0,B.jsx)("div",{className:"flex-1 h-px bg-border"}),(0,B.jsx)("span",{children:p("parallelRetrieval")}),(0,B.jsx)("div",{className:"flex-1 h-px bg-border"})]}),(0,B.jsx)("div",{className:"space-y-2",children:b.map((b,c)=>{let d=a[b],e=`lane-${b}`,f=am.has(e),g=d.reduce((a,b)=>a+(b.results?.length||0),0),h=Math.max(...d.map(a=>a.duration_seconds||0)),i={world:{bg:"bg-blue-500/10",text:"text-blue-500",border:"border-blue-500/30"},experience:{bg:"bg-green-500/10",text:"text-green-500",border:"border-green-500/30"},opinion:{bg:"bg-purple-500/10",text:"text-purple-500",border:"border-purple-500/30"},all:{bg:"bg-gray-500/10",text:"text-gray-500",border:"border-gray-500/30"}},j=i[b]||i.all;return(0,B.jsx)(bp.Card,{className:`transition-colors ${f?"border-primary":j.border}`,children:(0,B.jsxs)(bp.CardContent,{className:"py-3 px-4",children:[(0,B.jsxs)("div",{className:"flex items-center gap-3 cursor-pointer",onClick:()=>aq(e),children:[(0,B.jsx)("div",{className:`w-8 h-8 rounded-lg ${j.bg} flex items-center justify-center`,children:(0,B.jsx)("span",{className:`text-sm font-bold ${j.text} capitalize`,children:b.charAt(0).toUpperCase()})}),(0,B.jsxs)("div",{className:"flex-1",children:[(0,B.jsxs)("div",{className:"flex items-center gap-2",children:[(0,B.jsx)("span",{className:"font-semibold text-foreground capitalize",children:b}),(0,B.jsx)("span",{className:"text-xs text-muted-foreground",children:p("methodsCount",{count:d.length})})]}),(0,B.jsx)("div",{className:"flex gap-1.5 mt-1",children:d.map((a,b)=>(0,B.jsxs)("span",{className:"text-[10px] px-2 py-0.5 rounded-full bg-muted text-muted-foreground capitalize",children:[a.method_name,": ",a.results?.length||0]},b))})]}),(0,B.jsxs)("div",{className:"text-right",children:[(0,B.jsx)("div",{className:"text-2xl font-bold text-foreground",children:g}),(0,B.jsxs)("div",{className:"text-[10px] text-muted-foreground",children:[h.toFixed(2),"s"]})]}),f?(0,B.jsx)(Jj.ChevronDown,{className:"h-5 w-5 text-muted-foreground"}):(0,B.jsx)(Q.ChevronRight,{className:"h-5 w-5 text-muted-foreground"})]}),f&&(0,B.jsx)("div",{className:"mt-4 pt-4 border-t border-border",children:(0,B.jsx)("div",{className:`grid gap-3 ${1===d.length?"grid-cols-1":2===d.length?"grid-cols-2":3===d.length?"grid-cols-3":"grid-cols-4"}`,children:d.map((a,b)=>{let c,d,f,g,h=`${e}-method-${b}`,i=am.has(h),j=a.results||[];return(0,B.jsxs)("div",{className:"flex flex-col",children:[(0,B.jsxs)("div",{className:`p-3 rounded-lg cursor-pointer transition-colors ${i?"bg-primary/10 border border-primary":"bg-muted/50 hover:bg-muted"}`,onClick:a=>{a.stopPropagation(),aq(h)},children:[(0,B.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,B.jsxs)("div",{className:"flex items-center gap-2",children:[(0,B.jsx)("span",{className:"font-medium text-sm text-foreground capitalize",children:a.method_name}),"temporal"===a.method_name&&a.metadata?.constraint&&(0,B.jsxs)("span",{className:"flex items-center gap-1 text-[10px] text-muted-foreground",children:[(0,B.jsx)(Y,{className:"h-3 w-3"}),a.metadata.constraint.start?new Date(a.metadata.constraint.start).toLocaleDateString():"any"," → ",a.metadata.constraint.end?new Date(a.metadata.constraint.end).toLocaleDateString():"any"]})]}),i?(0,B.jsx)(Jj.ChevronDown,{className:"h-3 w-3 text-muted-foreground"}):(0,B.jsx)(Q.ChevronRight,{className:"h-3 w-3 text-muted-foreground"})]}),(0,B.jsxs)("div",{className:"flex items-end justify-between",children:[(0,B.jsx)("div",{className:"text-2xl font-bold text-foreground",children:j.length}),(0,B.jsxs)("div",{className:"text-[10px] text-muted-foreground",children:[a.duration_seconds?.toFixed(2),"s"]})]})]}),i&&j.length>0&&(c=`results-${h}`,f=(d=ao.has(c))?j:j.slice(0,5),g=j.length>5,(0,B.jsxs)("div",{className:"mt-2 space-y-1.5 max-h-[300px] overflow-y-auto",children:[f.map((a,b)=>(0,B.jsx)("div",{className:"p-2 bg-background rounded cursor-pointer hover:bg-muted/50 transition-colors border border-border",onClick:b=>{b.stopPropagation(),as(a)},children:(0,B.jsxs)("div",{className:"flex items-start gap-2",children:[(0,B.jsx)("span",{className:"text-[10px] font-mono text-muted-foreground mt-0.5",children:b+1}),(0,B.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,B.jsx)("p",{className:"text-xs text-foreground line-clamp-2",children:a.text}),(0,B.jsx)("div",{className:"flex items-center gap-2 mt-1",children:(0,B.jsx)("span",{className:"text-[10px] text-muted-foreground",children:(a.score||a.similarity||0).toFixed(4)})})]})]})},b)),g&&(0,B.jsx)("button",{className:"w-full text-[10px] text-primary hover:text-primary/80 py-1.5 hover:bg-muted/50 rounded transition-colors",onClick:a=>{a.stopPropagation(),ar(c)},children:d?p("showLess"):p("viewAllResults",{count:j.length})})]}))]},h)})})})]})},e)})}),(0,B.jsx)("div",{className:"flex justify-center py-2",children:(0,B.jsx)("div",{className:"flex items-center gap-2",children:b.map((a,b)=>{let c={world:"bg-blue-500",experience:"bg-green-500",opinion:"bg-purple-500",all:"bg-gray-500"};return(0,B.jsx)("div",{className:"flex flex-col items-center",children:(0,B.jsx)("div",{className:`w-1 h-4 ${c[a]||c.all} rounded-full opacity-50`})},b)})})}),(0,B.jsx)("div",{className:"flex justify-center",children:(0,B.jsx)(PL,{className:"h-5 w-5 text-muted-foreground/50"})})]})),ad.rrf_merged&&(c="rrf-merge",d=am.has(c),(0,B.jsxs)("div",{children:[(0,B.jsx)(bp.Card,{className:`cursor-pointer transition-colors ${d?"border-primary":"hover:border-primary/50"}`,onClick:()=>aq(c),children:(0,B.jsx)(bp.CardContent,{className:"py-4",children:(0,B.jsxs)("div",{className:"flex items-center gap-4",children:[(0,B.jsx)("div",{className:"flex-shrink-0 w-10 h-10 rounded-full bg-purple-500/10 flex items-center justify-center",children:(0,B.jsx)("span",{className:"text-sm font-bold text-purple-500",children:"∪"})}),(0,B.jsxs)("div",{className:"flex-1",children:[(0,B.jsxs)("div",{className:"flex items-center gap-2",children:[(0,B.jsx)("span",{className:"font-semibold text-foreground",children:p("rrfFusion")}),(0,B.jsx)("span",{className:"text-xs px-2 py-0.5 rounded bg-muted text-muted-foreground",children:p("rrfMerge")})]}),(0,B.jsx)("div",{className:"text-sm text-muted-foreground mt-0.5",children:p("rrfDescription")})]}),(0,B.jsx)("div",{className:"text-2xl font-bold text-foreground",children:ad.rrf_merged.length}),d?(0,B.jsx)(Jj.ChevronDown,{className:"h-5 w-5 text-muted-foreground"}):(0,B.jsx)(Q.ChevronRight,{className:"h-5 w-5 text-muted-foreground"})]})})}),d&&ad.rrf_merged.length>0&&(e="results-rrf",g=(f=ao.has(e))?ad.rrf_merged:ad.rrf_merged.slice(0,5),h=ad.rrf_merged.length>5,(0,B.jsxs)("div",{className:"ml-6 mt-2 space-y-2 border-l-2 border-muted pl-4 max-h-[400px] overflow-y-auto",children:[g.map((a,b)=>(0,B.jsx)("div",{className:"p-3 bg-muted/30 rounded-lg cursor-pointer hover:bg-muted/50 transition-colors",onClick:b=>{b.stopPropagation(),as(a)},children:(0,B.jsxs)("div",{className:"flex items-start gap-3",children:[(0,B.jsx)("span",{className:"text-xs font-mono text-muted-foreground",children:b+1}),(0,B.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,B.jsx)("p",{className:"text-sm text-foreground line-clamp-2",children:a.text}),(0,B.jsxs)("div",{className:"text-xs text-muted-foreground mt-1",children:[p("rrfScore")," ",(a.rrf_score||a.score||0).toFixed(4)]})]})]})},b)),h&&(0,B.jsx)("button",{className:"w-full text-xs text-primary hover:text-primary/80 py-2 hover:bg-muted/50 rounded transition-colors",onClick:a=>{a.stopPropagation(),ar(e)},children:f?p("showLess"):p("viewAllResults",{count:ad.rrf_merged.length})})]})),(0,B.jsx)("div",{className:"flex justify-center py-2",children:(0,B.jsx)(PL,{className:"h-4 w-4 text-muted-foreground/50"})})]})),ad.reranked&&(i="reranking",j=am.has(i),(0,B.jsxs)("div",{children:[(0,B.jsx)(bp.Card,{className:`cursor-pointer transition-colors ${j?"border-primary":"hover:border-primary/50"}`,onClick:()=>aq(i),children:(0,B.jsx)(bp.CardContent,{className:"py-4",children:(0,B.jsxs)("div",{className:"flex items-center gap-4",children:[(0,B.jsx)("div",{className:"flex-shrink-0 w-10 h-10 rounded-full bg-amber-500/10 flex items-center justify-center",children:(0,B.jsx)("span",{className:"text-sm font-bold text-amber-500",children:"⚡"})}),(0,B.jsxs)("div",{className:"flex-1",children:[(0,B.jsxs)("div",{className:"flex items-center gap-2",children:[(0,B.jsx)("span",{className:"font-semibold text-foreground",children:p("combinedScoring")}),(0,B.jsx)("span",{className:"text-xs px-2 py-0.5 rounded bg-muted text-muted-foreground",children:p("rerank")})]}),(0,B.jsx)("div",{className:"text-sm text-muted-foreground mt-0.5",children:(0,B.jsx)("span",{className:"font-mono text-xs",children:"ce × recency_boost(±10%) × temporal_boost(±10%)"})})]}),(0,B.jsx)("div",{className:"text-2xl font-bold text-foreground",children:ad.reranked.length}),j?(0,B.jsx)(Jj.ChevronDown,{className:"h-5 w-5 text-muted-foreground"}):(0,B.jsx)(Q.ChevronRight,{className:"h-5 w-5 text-muted-foreground"})]})})}),j&&ad.reranked.length>0&&(k="results-rerank",n=(l=ao.has(k))?ad.reranked:ad.reranked.slice(0,5),o=ad.reranked.length>5,(0,B.jsxs)("div",{className:"ml-6 mt-2 space-y-2 border-l-2 border-muted pl-4 max-h-[400px] overflow-y-auto",children:[n.map((a,b)=>{let c=a.score_components||{};return(0,B.jsx)("div",{className:"p-3 bg-muted/30 rounded-lg cursor-pointer hover:bg-muted/50 transition-colors",onClick:b=>{b.stopPropagation(),as(a)},children:(0,B.jsxs)("div",{className:"flex items-start gap-3",children:[(0,B.jsx)("span",{className:"text-xs font-mono text-muted-foreground",children:b+1}),(0,B.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,B.jsx)("p",{className:"text-sm text-foreground line-clamp-2",children:a.text}),(0,B.jsxs)("div",{className:"flex flex-wrap gap-x-3 gap-y-1 mt-2 text-[10px] text-muted-foreground font-mono",children:[(0,B.jsxs)("span",{className:"font-semibold text-foreground",children:["= ",(a.rerank_score||a.score||0).toFixed(4)]}),void 0!==c.cross_encoder_score_normalized&&(0,B.jsxs)("span",{title:p("tooltipCrossEncoder"),children:["CE: ",c.cross_encoder_score_normalized.toFixed(3)]}),void 0!==c.temporal&&.5!==c.temporal&&(0,B.jsxs)("span",{title:p("tooltipTemporal"),children:["Tmp: ",c.temporal.toFixed(3)]}),void 0!==c.recency&&(0,B.jsxs)("span",{title:p("tooltipRecency"),children:["Rec: ",c.recency.toFixed(3)]})]})]})]})},b)}),o&&(0,B.jsx)("button",{className:"w-full text-xs text-primary hover:text-primary/80 py-2 hover:bg-muted/50 rounded transition-colors",onClick:a=>{a.stopPropagation(),ar(k)},children:l?p("showLess"):p("viewAllResults",{count:ad.reranked.length})})]})),(0,B.jsx)("div",{className:"flex justify-center py-2",children:(0,B.jsx)(PL,{className:"h-4 w-4 text-muted-foreground/50"})})]})),(0,B.jsx)(bp.Card,{className:"border-primary bg-primary/5",children:(0,B.jsx)(bp.CardContent,{className:"py-4",children:(0,B.jsxs)("div",{className:"flex items-center gap-4",children:[(0,B.jsx)("div",{className:"flex-shrink-0 w-10 h-10 rounded-full bg-primary/20 flex items-center justify-center",children:(0,B.jsx)("span",{className:"text-sm font-bold text-primary",children:"✓"})}),(0,B.jsxs)("div",{className:"flex-1",children:[(0,B.jsxs)("div",{className:"flex items-center gap-2",children:[(0,B.jsx)("span",{className:"font-semibold text-foreground",children:p("finalResults")}),(0,B.jsx)("span",{className:"text-xs px-2 py-0.5 rounded bg-primary/20 text-primary",children:p("output")})]}),(0,B.jsx)("div",{className:"text-sm text-muted-foreground mt-0.5",children:p("finalResultsDescription")})]}),(0,B.jsx)("div",{className:"text-2xl font-bold text-primary",children:T?.length||0})]})})})]}),"json"===ai&&(0,B.jsxs)(bp.Card,{children:[(0,B.jsx)(bp.CardHeader,{children:(0,B.jsx)(bp.CardTitle,{className:"text-lg",children:p("rawResponse")})}),(0,B.jsx)(bp.CardContent,{children:(0,B.jsx)("div",{className:"bg-muted p-4 rounded-lg overflow-auto max-h-[600px]",children:(0,B.jsx)(Kp,{src:{results:T,...Z&&{entities:Z},..._&&{chunks:_},...ab&&{observations:ab},trace:ad},collapsed:2,theme:"default"})})})]})]}),!ag&&!T&&(0,B.jsx)(bp.Card,{className:"border-dashed",children:(0,B.jsxs)(bp.CardContent,{className:"flex flex-col items-center justify-center py-16",children:[(0,B.jsx)(J.Search,{className:"h-12 w-12 text-muted-foreground mb-4"}),(0,B.jsx)("h3",{className:"text-lg font-semibold mb-2",children:p("readyToRecall")}),(0,B.jsx)("p",{className:"text-muted-foreground text-center max-w-md",children:p("readyToRecallDescription")})]})}),ak&&(0,B.jsx)("div",{className:"fixed right-0 top-0 h-screen w-[420px] bg-card border-l shadow-2xl z-50 overflow-y-auto",children:(0,B.jsx)(wl,{memory:ak,onClose:()=>al(null),inPanel:!0,bankId:q||void 0})})]}):(0,B.jsx)(bp.Card,{className:"border-dashed",children:(0,B.jsxs)(bp.CardContent,{className:"flex flex-col items-center justify-center py-16",children:[(0,B.jsx)(M,{className:"h-12 w-12 text-muted-foreground mb-4"}),(0,B.jsx)("h3",{className:"text-xl font-semibold mb-2",children:p("noBankSelected")}),(0,B.jsx)("p",{className:"text-muted-foreground",children:p("noBankSelectedDescription")})]})})}let PN=(0,K.default)("target",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);var PO=a.i(83604),PO=PO,bc=bc;let PP=["skepticism","literalism","empathy"];function PQ(){let a=(0,E.useTranslations)("bankProfile");return{skepticism:{label:a("skepticismLabel"),shortLabel:"S",description:a("skepticismDescription"),lowLabel:a("skepticismLow"),highLabel:a("skepticismHigh")},literalism:{label:a("literalismLabel"),shortLabel:"L",description:a("literalismDescription"),lowLabel:a("literalismLow"),highLabel:a("literalismHigh")},empathy:{label:a("empathyLabel"),shortLabel:"E",description:a("empathyDescription"),lowLabel:a("empathyLow"),highLabel:a("empathyHigh")}}}function PR({hideReflectFields:a=!1}){let b=(0,D.useRouter)(),c=(0,E.useTranslations)("bankProfile"),d=(0,E.useTranslations)("common"),e=(0,E.useTranslations)("bank"),f=PQ(),{currentBank:g,setCurrentBank:h,loadBanks:i}=(0,H.useBank)(),{features:j}=(0,IL.useFeatures)();j?.observations;let[k,l]=(0,C.useState)(null),[n,o]=(0,C.useState)(null),[p,q]=(0,C.useState)([]),[r,s]=(0,C.useState)(0),[t,u]=(0,C.useState)([]),[v,w]=(0,C.useState)(0),[x,y]=(0,C.useState)(!1),[z,A]=(0,C.useState)(!1),[G,I]=(0,C.useState)(!1),[J,K]=(0,C.useState)(!1),[L,M]=(0,C.useState)(null),[N,O]=(0,C.useState)(null),[P,Q]=(0,C.useState)(!1),[R,S]=(0,C.useState)(!1),[T,U]=(0,C.useState)(!1),[X,Y]=(0,C.useState)(!1),[Z,$]=(0,C.useState)(!1),[_,aa]=(0,C.useState)(!1),[ab,ac]=(0,C.useState)(null),[ae]=(0,C.useState)(10),[ag,ah]=(0,C.useState)(0),[ai,aj]=(0,C.useState)(null),ak=async(a=ab,b=ag)=>{if(g)try{let c=await V.client.listOperations(g,{status:a||void 0,limit:ae,offset:b});q(c.operations||[]),s(c.total||0)}catch(a){console.error("Error loading operations:",a)}},al=async(a=!1)=>{if(g){if(a){try{let[a,b,c]=await Promise.all([V.client.getBankStats(g),V.client.listDirectives(g),V.client.listMentalModels(g)]);o(a),u(b.items||[]),w(c.items?.length||0)}catch(a){console.error("Error refreshing stats:",a)}return}y(!0);try{let[a,b,c,d]=await Promise.all([V.client.getBankProfile(g),V.client.getBankStats(g),V.client.listDirectives(g),V.client.listMentalModels(g)]);l(a),o(b),u(c.items||[]),w(d.items?.length||0),await ak()}catch(a){}finally{y(!1)}}},am=async()=>{if(g){U(!0);try{await V.client.deleteBank(g),S(!1),h(null),await i(),b.push("/")}catch(a){}finally{U(!1)}}},an=async()=>{if(g){$(!0);try{let a=await V.client.clearObservations(g);Y(!1),await al(),F.toast.success("Success",{description:a.message||"Observations cleared successfully"})}catch(a){}finally{$(!1)}}},ao=async()=>{if(g&&N){Q(!0);try{await V.client.deleteDirective(g,N.id),u(a=>a.filter(a=>a.id!==N.id)),L?.id===N.id&&M(null),O(null)}catch(a){}finally{Q(!1)}}};return((0,C.useEffect)(()=>{if(g){al();let a=setInterval(()=>al(!0),5e3);return()=>clearInterval(a)}},[g]),(0,C.useEffect)(()=>{let a=a=>{"Escape"===a.key&&M(null)};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[]),g)?x&&!k?(0,B.jsx)(bp.Card,{children:(0,B.jsxs)(bp.CardContent,{className:"text-center py-10",children:[(0,B.jsx)(af,{className:"w-12 h-12 mx-auto mb-3 text-muted-foreground animate-pulse"}),(0,B.jsx)("div",{className:"text-lg text-muted-foreground",children:c("loadingProfile")})]})}):(0,B.jsxs)("div",{className:"space-y-6",children:[!a&&(0,B.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[(0,B.jsxs)(bp.Card,{children:[(0,B.jsx)(bp.CardHeader,{className:"pb-2",children:(0,B.jsxs)("div",{className:"flex items-start justify-between",children:[(0,B.jsxs)("div",{children:[(0,B.jsxs)(bp.CardTitle,{className:"flex items-center gap-2 text-lg",children:[(0,B.jsx)(JF,{className:"w-5 h-5 text-primary"}),c("dispositionProfileTitle")]}),(0,B.jsx)(bp.CardDescription,{children:c("editDispositionDescription")})]}),(0,B.jsx)(W.Button,{onClick:()=>A(!0),variant:"ghost",size:"sm",children:(0,B.jsx)(Jh,{className:"h-4 w-4"})})]})}),(0,B.jsx)(bp.CardContent,{children:k&&(0,B.jsx)("div",{className:"space-y-4",children:PP.map(a=>(0,B.jsxs)("div",{className:"space-y-2",children:[(0,B.jsxs)("div",{className:"flex justify-between items-center",children:[(0,B.jsxs)("div",{children:[(0,B.jsx)("label",{className:"text-sm font-medium text-foreground",children:f[a].label}),(0,B.jsx)("p",{className:"text-xs text-muted-foreground",children:f[a].description})]}),(0,B.jsxs)("span",{className:"text-sm font-bold text-primary",children:[k.disposition[a],"/5"]})]}),(0,B.jsxs)("div",{className:"flex items-center gap-2",children:[(0,B.jsx)("span",{className:"text-xs text-muted-foreground",children:f[a].lowLabel}),(0,B.jsx)("div",{className:"flex-1 h-2 bg-muted rounded-full overflow-hidden",children:(0,B.jsx)("div",{className:"h-full bg-primary rounded-full transition-all",style:{width:`${(k.disposition[a]-1)/4*100}%`}})}),(0,B.jsx)("span",{className:"text-xs text-muted-foreground",children:f[a].highLabel})]})]},a))})})]}),(0,B.jsxs)(bp.Card,{children:[(0,B.jsx)(bp.CardHeader,{className:"pb-2",children:(0,B.jsxs)("div",{className:"flex items-start justify-between",children:[(0,B.jsxs)("div",{children:[(0,B.jsxs)(bp.CardTitle,{className:"flex items-center gap-2 text-lg",children:[(0,B.jsx)(PN,{className:"w-5 h-5 text-primary"}),c("missionTitle")]}),(0,B.jsx)(bp.CardDescription,{children:c("editMissionDescription")})]}),(0,B.jsx)(W.Button,{onClick:()=>I(!0),variant:"ghost",size:"sm",children:(0,B.jsx)(Jh,{className:"h-4 w-4"})})]})}),(0,B.jsx)(bp.CardContent,{children:(0,B.jsx)("p",{className:"text-sm text-foreground whitespace-pre-wrap leading-relaxed",children:k?.mission||c("noMissionSet")})})]})]}),(0,B.jsxs)("div",{className:"space-y-4",children:[(0,B.jsxs)("div",{className:"flex items-center justify-between",children:[(0,B.jsxs)("div",{children:[(0,B.jsxs)("h3",{className:"text-lg font-semibold flex items-center gap-2",children:[(0,B.jsx)(PO.default,{className:"w-5 h-5 text-rose-500"}),c("directivesTitle")]}),(0,B.jsx)("p",{className:"text-sm text-muted-foreground",children:c("directivesDescription")})]}),(0,B.jsxs)(W.Button,{onClick:()=>K(!0),variant:"outline",size:"sm",className:"h-8",children:[(0,B.jsx)(II.Plus,{className:"w-4 h-4 mr-1"}),c("addDirective")]})]}),t.length>0?(0,B.jsx)("div",{className:"grid grid-cols-2 gap-3",children:t.map(a=>(0,B.jsx)(bp.Card,{className:`cursor-pointer transition-colors border-rose-500/30 ${L?.id===a.id?"bg-rose-500/10 border-rose-500":"hover:bg-rose-500/5"}`,onClick:()=>M(a),children:(0,B.jsx)(bp.CardContent,{className:"p-3",children:(0,B.jsxs)("div",{className:"flex items-start gap-2",children:[(0,B.jsx)(PO.default,{className:"w-4 h-4 text-rose-500 shrink-0 mt-0.5"}),(0,B.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,B.jsx)("span",{className:"font-medium text-sm text-foreground",children:a.name}),(0,B.jsx)("p",{className:"text-xs text-muted-foreground line-clamp-2 mt-1",children:a.content}),a.tags&&a.tags.length>0&&(0,B.jsxs)("div",{className:"flex items-center gap-1 mt-2 flex-wrap",children:[(0,B.jsx)(a7,{className:"w-3 h-3 text-muted-foreground"}),a.tags.map(a=>(0,B.jsx)("span",{className:"text-xs px-1.5 py-0.5 rounded bg-muted text-muted-foreground",children:a},a))]})]})]})})},a.id))}):(0,B.jsxs)("div",{className:"p-6 border border-dashed border-rose-500/30 rounded-lg text-center",children:[(0,B.jsx)(PO.default,{className:"w-6 h-6 mx-auto mb-2 text-rose-500/50"}),(0,B.jsx)("p",{className:"text-sm text-muted-foreground",children:c("noDirectivesMessage")})]})]}),(0,B.jsx)(IU,{open:R,onOpenChange:S,children:(0,B.jsxs)(I9,{children:[(0,B.jsxs)(Ja,{children:[(0,B.jsx)(Jc,{children:e("deleteMemoryBank")}),(0,B.jsx)(Jd,{asChild:!0,children:(0,B.jsxs)("div",{className:"space-y-2 text-sm text-muted-foreground",children:[(0,B.jsx)("p",{children:e.rich("deleteBankPrompt",{bankName:()=>(0,B.jsx)("span",{className:"font-semibold text-foreground",children:g})})}),(0,B.jsx)("p",{className:"text-red-600 dark:text-red-400 font-medium",children:e("deleteBankWarning")}),n&&(0,B.jsx)("p",{children:e("deleteWillDeleteDetails",{memories:n.total_nodes,documents:n.total_documents,links:n.total_links})})]})})]}),(0,B.jsxs)(Jb,{children:[(0,B.jsx)(Jf,{disabled:T,children:d("cancel")}),(0,B.jsx)(Je,{onClick:am,disabled:T,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:T?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(ad,{className:"w-4 h-4 mr-2 animate-spin"}),e("deleting")]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Jg,{className:"w-4 h-4 mr-2"}),e("deleteBank")]})})]})]})}),(0,B.jsx)(IU,{open:X,onOpenChange:Y,children:(0,B.jsxs)(I9,{children:[(0,B.jsxs)(Ja,{children:[(0,B.jsx)(Jc,{children:e("clearObservationsTitle")}),(0,B.jsx)(Jd,{asChild:!0,children:(0,B.jsxs)("div",{className:"space-y-2 text-sm text-muted-foreground",children:[(0,B.jsx)("p",{children:e.rich("clearObservationsPrompt",{bankName:()=>(0,B.jsx)("span",{className:"font-semibold text-foreground",children:g})})}),(0,B.jsx)("p",{className:"text-amber-600 dark:text-amber-400 font-medium",children:e("clearObservationsWarning")}),n&&n.total_observations>0&&(0,B.jsx)("p",{children:e("deleteWillDeleteObservations",{count:n.total_observations})})]})})]}),(0,B.jsxs)(Jb,{children:[(0,B.jsx)(Jf,{disabled:Z,children:d("cancel")}),(0,B.jsx)(Je,{onClick:an,disabled:Z,className:"bg-amber-500 text-white hover:bg-amber-600",children:Z?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(bc.default,{className:"w-4 h-4 mr-2 animate-spin"}),e("clearing")]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Jg,{className:"w-4 h-4 mr-2"}),e("clearObservations")]})})]})]})}),(0,B.jsx)(PU,{open:J,mode:"create",onClose:()=>K(!1),onCreated:a=>{u(b=>[a,...b]),K(!1)}}),(0,B.jsx)(IU,{open:!!N,onOpenChange:a=>!a&&O(null),children:(0,B.jsxs)(I9,{children:[(0,B.jsxs)(Ja,{children:[(0,B.jsx)(Jc,{children:c("deleteDirectiveTitle")}),(0,B.jsxs)(Jd,{children:[c("deleteDirectiveConfirm",{name:`"${N?.name??""}"`}),(0,B.jsx)("br",{}),(0,B.jsx)("br",{}),(0,B.jsx)("span",{className:"text-destructive font-semibold",children:c("deleteDirectiveWarning")})]})]}),(0,B.jsxs)(Jb,{className:"flex-row justify-end space-x-2",children:[(0,B.jsx)(Jf,{className:"mt-0",children:d("cancel")}),(0,B.jsxs)(Je,{onClick:ao,disabled:P,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:[P?(0,B.jsx)(bc.default,{className:"w-4 h-4 animate-spin mr-1"}):null,d("delete")]})]})]})}),L&&(0,B.jsx)(PV,{directive:L,onClose:()=>M(null),onDelete:()=>O({id:L.id,name:L.name}),onUpdated:a=>{u(b=>b.map(b=>b.id===a.id?a:b)),M(a)}}),z&&k&&(0,B.jsx)(PS,{disposition:k.disposition,onClose:()=>A(!1),onSaved:async()=>{await al(),A(!1)}}),G&&k&&(0,B.jsx)(PT,{mission:k.mission||"",onClose:()=>I(!1),onSaved:async()=>{await al(),I(!1)}})]}):(0,B.jsx)(bp.Card,{children:(0,B.jsxs)(bp.CardContent,{className:"p-10 text-center",children:[(0,B.jsx)("h3",{className:"text-xl font-semibold mb-2 text-card-foreground",children:c("noBankSelected")}),(0,B.jsx)("p",{className:"text-muted-foreground",children:c("noBankSelectedDescription")})]})})}function PS({disposition:a,onClose:b,onSaved:c}){let d=(0,E.useTranslations)("bankProfile"),e=PQ(),{currentBank:f}=(0,H.useBank)(),[g,h]=(0,C.useState)(!1),[i,j]=(0,C.useState)(a),k=async()=>{if(f){h(!0);try{await V.client.updateBankConfig(f,{disposition_skepticism:i.skepticism,disposition_literalism:i.literalism,disposition_empathy:i.empathy}),c()}catch(a){}finally{h(!1)}}};return(0,B.jsx)(bf.Dialog,{open:!0,onOpenChange:b,children:(0,B.jsxs)(bf.DialogContent,{className:"max-w-xl",children:[(0,B.jsxs)(bf.DialogHeader,{children:[(0,B.jsx)(bf.DialogTitle,{children:d("editDispositionTitle")}),(0,B.jsx)(bf.DialogDescription,{children:d("editDispositionDescription")})]}),(0,B.jsx)("div",{className:"space-y-4 py-4",children:PP.map(a=>(0,B.jsxs)("div",{className:"space-y-2",children:[(0,B.jsxs)("div",{className:"flex justify-between items-center",children:[(0,B.jsxs)("div",{children:[(0,B.jsx)("label",{className:"text-sm font-medium text-foreground",children:e[a].label}),(0,B.jsx)("p",{className:"text-xs text-muted-foreground",children:e[a].description})]}),(0,B.jsxs)("span",{className:"text-sm font-bold text-primary",children:[i[a],"/5"]})]}),(0,B.jsxs)("div",{className:"flex justify-between text-[10px] text-muted-foreground",children:[(0,B.jsx)("span",{children:e[a].lowLabel}),(0,B.jsx)("span",{children:e[a].highLabel})]}),(0,B.jsx)("input",{type:"range",min:"1",max:"5",step:"1",value:i[a],onChange:b=>j(c=>({...c,[a]:parseInt(b.target.value)})),className:"w-full h-2 bg-muted rounded-lg appearance-none cursor-pointer accent-primary"})]},a))}),(0,B.jsxs)(bf.DialogFooter,{children:[(0,B.jsx)(W.Button,{onClick:b,variant:"outline",disabled:g,children:d("cancel")}),(0,B.jsx)(W.Button,{onClick:k,disabled:g,children:g?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(ad,{className:"w-4 h-4 mr-2 animate-spin"}),d("saving")]}):d("saveChanges")})]})]})})}function PT({mission:a,onClose:b,onSaved:c}){let d=(0,E.useTranslations)("bankProfile"),{currentBank:e}=(0,H.useBank)(),[f,g]=(0,C.useState)(!1),[h,i]=(0,C.useState)(a),j=async()=>{if(e){g(!0);try{await V.client.updateBankConfig(e,{reflect_mission:h||null}),c()}catch(a){}finally{g(!1)}}};return(0,B.jsx)(bf.Dialog,{open:!0,onOpenChange:b,children:(0,B.jsxs)(bf.DialogContent,{className:"max-w-xl",children:[(0,B.jsxs)(bf.DialogHeader,{children:[(0,B.jsx)(bf.DialogTitle,{children:d("editMissionTitle")}),(0,B.jsx)(bf.DialogDescription,{children:d("editMissionDescription")})]}),(0,B.jsx)("div",{className:"space-y-2 py-4",children:(0,B.jsx)(JJ.Textarea,{value:h,onChange:a=>i(a.target.value),placeholder:d("missionPlaceholder"),rows:8,className:"resize-none"})}),(0,B.jsxs)(bf.DialogFooter,{children:[(0,B.jsx)(W.Button,{onClick:b,variant:"outline",disabled:f,children:d("cancel")}),(0,B.jsx)(W.Button,{onClick:j,disabled:f,children:f?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(ad,{className:"w-4 h-4 mr-2 animate-spin"}),d("saving")]}):d("saveChanges")})]})]})})}function PU({open:a,mode:b,directive:c,onClose:d,onCreated:e,onSaved:f}){let g=(0,E.useTranslations)("bankProfile"),{currentBank:h}=(0,H.useBank)(),[i,j]=(0,C.useState)(!1),[k,l]=(0,C.useState)({name:"",content:"",tags:""});(0,C.useEffect)(()=>{"edit"===b&&c?l({name:c.name,content:c.content,tags:(c.tags||[]).join(", ")}):"create"===b&&l({name:"",content:"",tags:""})},[a,b,c]);let n=async()=>{if(h&&k.name.trim()&&k.content.trim()){j(!0);try{let a=k.tags.split(",").map(a=>a.trim()).filter(a=>a.length>0);if("create"===b){let b=await V.client.createDirective(h,{name:k.name.trim(),content:k.content.trim(),tags:a.length>0?a:void 0});l({name:"",content:"",tags:""}),e?.(b)}else if(c){let b=await V.client.updateDirective(h,c.id,{name:k.name.trim(),content:k.content.trim(),tags:a});f?.(b),d()}}catch(a){}finally{j(!1)}}},o=()=>{"create"===b&&l({name:"",content:"",tags:""}),d()};return(0,B.jsx)(bf.Dialog,{open:a,onOpenChange:a=>!a&&o(),children:(0,B.jsxs)(bf.DialogContent,{className:"sm:max-w-lg",children:[(0,B.jsxs)(bf.DialogHeader,{children:[(0,B.jsxs)(bf.DialogTitle,{className:"flex items-center gap-2",children:[(0,B.jsx)(PO.default,{className:"w-5 h-5 text-rose-500"}),g("create"===b?"directiveFormCreateTitle":"directiveFormEditTitle")]}),(0,B.jsx)(bf.DialogDescription,{children:g("directiveFormDescription")})]}),(0,B.jsxs)("div",{className:"space-y-4 py-4",children:[(0,B.jsxs)("div",{className:"space-y-2",children:[(0,B.jsx)("label",{className:"text-sm font-medium text-foreground",children:g("directiveNameLabel")}),(0,B.jsx)(X.Input,{value:k.name,onChange:a=>l({...k,name:a.target.value}),placeholder:g("directiveNamePlaceholder")})]}),(0,B.jsxs)("div",{className:"space-y-2",children:[(0,B.jsx)("label",{className:"text-sm font-medium text-foreground",children:g("directiveRuleLabel")}),(0,B.jsx)(JJ.Textarea,{value:k.content,onChange:a=>l({...k,content:a.target.value}),placeholder:g("directiveRulePlaceholder"),className:"min-h-[120px]"})]}),(0,B.jsxs)("div",{className:"space-y-2",children:[(0,B.jsxs)("label",{className:"text-sm font-medium text-foreground",children:[g("directiveTagsLabel")," ",(0,B.jsx)("span",{className:"text-muted-foreground font-normal",children:g("directiveTagsOptional")})]}),(0,B.jsx)(X.Input,{value:k.tags,onChange:a=>l({...k,tags:a.target.value}),placeholder:g("directiveTagsPlaceholder")})]})]}),(0,B.jsxs)(bf.DialogFooter,{children:[(0,B.jsx)(W.Button,{variant:"outline",onClick:o,disabled:i,children:g("cancel")}),(0,B.jsxs)(W.Button,{onClick:n,disabled:i||!k.name.trim()||!k.content.trim(),className:"bg-rose-500 hover:bg-rose-600",children:[i?(0,B.jsx)(bc.default,{className:"w-4 h-4 animate-spin mr-1"}):null,g("create"===b?"create":"save")]})]})]})})}function PV({directive:a,onClose:b,onDelete:c,onUpdated:d}){let e=(0,E.useTranslations)("bankProfile"),[f,g]=(0,C.useState)(!1);return(0,B.jsxs)("div",{className:"fixed right-0 top-0 h-screen w-1/2 bg-card border-l-2 border-rose-500 shadow-2xl z-50 overflow-y-auto animate-in slide-in-from-right duration-300 ease-out",children:[(0,B.jsxs)("div",{className:"p-6",children:[(0,B.jsxs)("div",{className:"flex justify-between items-start mb-8 pb-5 border-b border-border",children:[(0,B.jsxs)("div",{className:"flex items-start gap-3",children:[(0,B.jsx)(PO.default,{className:"w-5 h-5 text-rose-500"}),(0,B.jsxs)("div",{children:[(0,B.jsxs)("div",{className:"flex items-center gap-2",children:[(0,B.jsx)("h3",{className:"text-xl font-bold text-foreground",children:a.name}),(0,B.jsx)(W.Button,{variant:"ghost",size:"sm",onClick:()=>g(!0),className:"h-7 w-7 p-0",children:(0,B.jsx)(Jh,{className:"h-3.5 w-3.5"})})]}),(0,B.jsx)("span",{className:"text-xs px-1.5 py-0.5 rounded bg-rose-500/10 text-rose-600 dark:text-rose-400",children:e("directiveDetailBadge")})]})]}),(0,B.jsxs)("div",{className:"flex items-center gap-2",children:[(0,B.jsx)(W.Button,{variant:"ghost",size:"sm",onClick:c,className:"h-8 w-8 p-0 text-muted-foreground hover:text-rose-500",children:(0,B.jsx)(Jg,{className:"h-4 w-4"})}),(0,B.jsx)(W.Button,{variant:"ghost",size:"sm",onClick:b,className:"h-8 w-8 p-0",children:(0,B.jsx)(bb.X,{className:"h-4 w-4"})})]})]}),(0,B.jsxs)("div",{className:"space-y-6",children:[(0,B.jsxs)("div",{children:[(0,B.jsx)("div",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-3",children:e("directiveDetailRuleLabel")}),(0,B.jsx)("div",{className:"prose prose-base dark:prose-invert max-w-none",children:(0,B.jsx)(NS,{remarkPlugins:[Pl],children:a.content})})]}),a.tags&&a.tags.length>0&&(0,B.jsxs)("div",{children:[(0,B.jsx)("div",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-3",children:e("directiveDetailTagsLabel")}),(0,B.jsx)("div",{className:"flex flex-wrap gap-2",children:a.tags.map(a=>(0,B.jsx)("span",{className:"px-2 py-1 rounded bg-muted text-muted-foreground text-sm",children:a},a))})]}),(0,B.jsxs)("div",{children:[(0,B.jsx)("div",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-2",children:e("directiveDetailIdLabel")}),(0,B.jsx)("code",{className:"text-sm font-mono break-all text-muted-foreground",children:a.id})]})]})]}),(0,B.jsx)(PU,{open:f,mode:"edit",directive:a,onClose:()=>g(!1),onSaved:d})]})}let PW=(0,as.cva)("relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),PX=C.forwardRef(({className:a,variant:b,...c},d)=>(0,B.jsx)("div",{ref:d,role:"alert",className:(0,S.cn)(PW({variant:b}),a),...c}));PX.displayName="Alert",C.forwardRef(({className:a,...b},c)=>(0,B.jsx)("h5",{ref:c,className:(0,S.cn)("mb-1 font-medium leading-none tracking-tight",a),...b})).displayName="AlertTitle";let PY=C.forwardRef(({className:a,...b},c)=>(0,B.jsx)("div",{ref:c,className:(0,S.cn)("text-sm [&_p]:leading-relaxed",a),...b}));PY.displayName="AlertDescription";var bc=bc;let PZ=(0,K.default)("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]),P$=["HARM_CATEGORY_HARASSMENT","HARM_CATEGORY_HATE_SPEECH","HARM_CATEGORY_SEXUALLY_EXPLICIT","HARM_CATEGORY_DANGEROUS_CONTENT"].map(a=>({category:a,threshold:"BLOCK_NONE"})),P_=["retain","sync_retain","recall","reflect","list_banks","create_bank","get_bank","get_bank_stats","update_bank","delete_bank","clear_memories","list_mental_models","get_mental_model","create_mental_model","update_mental_model","delete_mental_model","refresh_mental_model","clear_mental_model","list_directives","create_directive","delete_directive","list_memories","get_memory","list_documents","get_document","delete_document","list_operations","get_operation","cancel_operation","list_tags"];function P0(a){return Array.isArray(a)?a:a&&"object"==typeof a&&Array.isArray(a.attributes)?a.attributes:null}function P1(a){return{retain_chunk_size:a.retain_chunk_size??null,retain_extraction_mode:a.retain_extraction_mode??null,retain_mission:a.retain_mission??null,retain_custom_instructions:a.retain_custom_instructions??null,entities_allow_free_form:a.entities_allow_free_form??null,entity_labels:P0(a.entity_labels)}}function P2(a){return{retain_default_strategy:a.retain_default_strategy??null,retain_strategies:a.retain_strategies??null}}function P3(a){return{enable_observations:a.enable_observations??null,consolidation_llm_batch_size:a.consolidation_llm_batch_size??null,consolidation_source_facts_max_tokens:a.consolidation_source_facts_max_tokens??null,consolidation_source_facts_max_tokens_per_observation:a.consolidation_source_facts_max_tokens_per_observation??null,observations_mission:a.observations_mission??null,max_observations_per_scope:a.max_observations_per_scope??null}}function P4(a){return{mcp_enabled_tools:a.mcp_enabled_tools??null}}function P5(a){return{llm_gemini_safety_settings:a.llm_gemini_safety_settings??null}}let P6={reflect_mission:"",disposition_skepticism:3,disposition_literalism:3,disposition_empathy:3};function P7(){let a=(0,E.useTranslations)("bankConfig"),{currentBank:b}=(0,H.useBank)(),{features:c}=(0,IL.useFeatures)(),d=c?.bank_config_api??!0,[e,f]=(0,C.useState)(!0),[g,h]=(0,C.useState)({}),[i,j]=(0,C.useState)(P6),[k,l]=(0,C.useState)(P1({})),[n,o]=(0,C.useState)(P2({})),[p,q]=(0,C.useState)(P3({})),[r,s]=(0,C.useState)(P6),[t,u]=(0,C.useState)(P4({})),[v,w]=(0,C.useState)(P5({})),[x,y]=(0,C.useState)(!1),[z,A]=(0,C.useState)(!1),[D,F]=(0,C.useState)(!1),[G,I]=(0,C.useState)(!1),[J,K]=(0,C.useState)(!1),[L,M]=(0,C.useState)(null),[N,O]=(0,C.useState)(null),[P,Q]=(0,C.useState)(null),[R,S]=(0,C.useState)(null),[T,U]=(0,C.useState)(null),W=(0,C.useMemo)(()=>JSON.stringify(k)!==JSON.stringify(P1(g))||JSON.stringify(n)!==JSON.stringify(P2(g)),[k,n,g]),Y=(0,C.useMemo)(()=>JSON.stringify(p)!==JSON.stringify(P3(g)),[p,g]),Z=(0,C.useMemo)(()=>JSON.stringify(r)!==JSON.stringify(i),[r,i]),$=(0,C.useMemo)(()=>JSON.stringify(t)!==JSON.stringify(P4(g)),[t,g]),_=(0,C.useMemo)(()=>JSON.stringify(v)!==JSON.stringify(P5(g)),[v,g]);(0,C.useEffect)(()=>{b&&aa()},[b]);let aa=async()=>{if(b){f(!0);try{let[a,c]=await Promise.all([V.client.getBankConfig(b),V.client.getBankProfile(b)]),d=a.config,e={reflect_mission:c.mission??"",disposition_skepticism:d.disposition_skepticism??c.disposition?.skepticism??3,disposition_literalism:d.disposition_literalism??c.disposition?.literalism??3,disposition_empathy:d.disposition_empathy??c.disposition?.empathy??3};h(d),j(e),l(P1(d)),o(P2(d)),q(P3(d)),s(e),u(P4(d)),w(P5(d))}catch(a){console.error("Failed to load bank data:",a)}finally{f(!1)}}},ab=async()=>{if(b){y(!0),M(null);try{let a={...k,...n};await V.client.updateBankConfig(b,a),h(b=>({...b,...a}))}catch(b){M(b.message||a("retainFailedToSave"))}finally{y(!1)}}},ac=async()=>{if(b){A(!0),O(null);try{await V.client.updateBankConfig(b,p),h(a=>({...a,...p}))}catch(b){O(b.message||a("observationsFailedToSave"))}finally{A(!1)}}},ad=async()=>{if(b){F(!0),Q(null);try{await V.client.updateBankConfig(b,{reflect_mission:r.reflect_mission||null,disposition_skepticism:r.disposition_skepticism,disposition_literalism:r.disposition_literalism,disposition_empathy:r.disposition_empathy}),j(r)}catch(b){Q(b.message||a("reflectFailedToSave"))}finally{F(!1)}}},ae=async()=>{if(b){I(!0),S(null);try{await V.client.updateBankConfig(b,t),h(a=>({...a,...t}))}catch(b){S(b.message||a("mcpFailedToSave"))}finally{I(!1)}}},af=async()=>{if(b){K(!0),U(null);try{await V.client.updateBankConfig(b,v),h(a=>({...a,...v}))}catch(b){U(b.message||a("geminiFailedToSave"))}finally{K(!1)}}};return b?d?e?(0,B.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,B.jsx)(bc.default,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):(0,B.jsx)(B.Fragment,{children:(0,B.jsxs)("div",{className:"space-y-8",children:[(0,B.jsxs)(Qe,{title:a("retainTitle"),description:a("retainSectionDescription"),error:L,dirty:W,saving:x,onSave:ab,children:[(0,B.jsx)(Qf,{label:a("defaultStrategyLabel"),description:a("defaultStrategyDescription"),children:(0,B.jsxs)(a6.Select,{value:n.retain_default_strategy??"__none__",onValueChange:a=>o(b=>({...b,retain_default_strategy:"__none__"===a?null:a})),children:[(0,B.jsx)(a6.SelectTrigger,{className:"w-full",children:(0,B.jsx)(a6.SelectValue,{})}),(0,B.jsxs)(a6.SelectContent,{children:[(0,B.jsx)(a6.SelectItem,{value:"__none__",children:(0,B.jsx)("span",{className:"text-muted-foreground italic",children:a("default")})}),Object.keys(n.retain_strategies??{}).map(a=>(0,B.jsx)(a6.SelectItem,{value:a,children:a},a))]})]})}),(0,B.jsx)(Qc,{defaultValues:k,onDefaultChange:a=>l(b=>({...b,...a})),strategies:n.retain_strategies,onStrategiesChange:a=>o(b=>({...b,retain_strategies:a}))})]}),(0,B.jsxs)(Qe,{title:a("observationsTitle"),description:a("observationsDescription"),error:N,dirty:Y,saving:z,onSave:ac,children:[(0,B.jsx)(Qf,{label:a("enableObservationsLabel"),description:a("enableObservationsDescription"),children:(0,B.jsx)("div",{className:"flex justify-end",children:(0,B.jsx)(a5.Switch,{checked:p.enable_observations??!1,onCheckedChange:a=>q(b=>({...b,enable_observations:a}))})})}),(0,B.jsx)(Qg,{label:a("missionLabel"),description:a("observationsMissionDescription"),value:p.observations_mission??"",onChange:a=>q(b=>({...b,observations_mission:a||null})),placeholder:a("observationsMissionPlaceholder"),rows:3}),(0,B.jsx)(Qf,{label:a("llmBatchSizeLabel"),description:a("llmBatchSizeDescription"),children:(0,B.jsx)(X.Input,{type:"number",min:1,max:64,value:p.consolidation_llm_batch_size??"",onChange:a=>q(b=>({...b,consolidation_llm_batch_size:a.target.value?parseInt(a.target.value,10):null})),placeholder:a("serverDefault")})}),(0,B.jsx)(Qf,{label:a("sourceFactsMaxTokensLabel"),description:a("sourceFactsMaxTokensDescription"),children:(0,B.jsx)(X.Input,{type:"number",min:-1,value:p.consolidation_source_facts_max_tokens??"",onChange:a=>q(b=>({...b,consolidation_source_facts_max_tokens:a.target.value?parseInt(a.target.value,10):null})),placeholder:a("serverDefault")})}),(0,B.jsx)(Qf,{label:a("sourceFactsMaxTokensPerObservationLabel"),description:a("sourceFactsMaxTokensPerObservationDescription"),children:(0,B.jsx)(X.Input,{type:"number",min:-1,value:p.consolidation_source_facts_max_tokens_per_observation??"",onChange:a=>q(b=>({...b,consolidation_source_facts_max_tokens_per_observation:a.target.value?parseInt(a.target.value,10):null})),placeholder:a("serverDefault")})}),(0,B.jsx)(Qf,{label:a("maxObservationsPerScopeLabel"),description:a("maxObservationsPerScopeDescription"),children:(0,B.jsx)(X.Input,{type:"number",min:-1,value:p.max_observations_per_scope??"",onChange:a=>q(b=>({...b,max_observations_per_scope:a.target.value?parseInt(a.target.value,10):null})),placeholder:a("serverDefault")})})]}),(0,B.jsxs)(Qe,{title:a("reflectTitle"),description:a("reflectDescription"),error:P,dirty:Z,saving:D,onSave:ad,children:[(0,B.jsx)(Qg,{label:a("missionLabel"),description:a("reflectMissionDescription"),value:r.reflect_mission,onChange:a=>s(b=>({...b,reflect_mission:a})),placeholder:a("reflectMissionPlaceholder"),rows:3}),(0,B.jsx)(Qh,{label:a("skepticismLabel"),description:a("skepticismDescription"),lowLabel:a("skepticismLowLabel"),highLabel:a("skepticismHighLabel"),value:r.disposition_skepticism,onChange:a=>s(b=>({...b,disposition_skepticism:a}))}),(0,B.jsx)(Qh,{label:a("literalismLabel"),description:a("literalismDescription"),lowLabel:a("literalismLowLabel"),highLabel:a("literalismHighLabel"),value:r.disposition_literalism,onChange:a=>s(b=>({...b,disposition_literalism:a}))}),(0,B.jsx)(Qh,{label:a("empathyLabel"),description:a("empathyDescription"),lowLabel:a("empathyLowLabel"),highLabel:a("empathyHighLabel"),value:r.disposition_empathy,onChange:a=>s(b=>({...b,disposition_empathy:a}))})]}),(0,B.jsxs)(Qe,{title:a("mcpToolsTitle"),description:a("mcpToolsDescription"),error:R,dirty:$,saving:G,onSave:ae,children:[(0,B.jsx)(Qf,{label:a("restrictToolsLabel"),description:a("restrictToolsDescription"),children:(0,B.jsxs)("div",{className:"flex items-center gap-2 justify-end",children:[(0,B.jsx)(a5.Switch,{checked:null!==t.mcp_enabled_tools,onCheckedChange:a=>u({mcp_enabled_tools:a?[...P_]:null})}),(0,B.jsx)(au,{className:"text-xs text-muted-foreground",children:null!==t.mcp_enabled_tools?a("enabled"):a("disabled")})]})}),null!==t.mcp_enabled_tools&&(0,B.jsx)(Qd,{selected:t.mcp_enabled_tools,onChange:a=>u({mcp_enabled_tools:a})})]}),(0,B.jsx)(Qe,{title:a("modelsTitle"),description:a("modelsDescription"),error:T,dirty:_,saving:J,onSave:af,children:(0,B.jsxs)("div",{className:"px-6 py-4 space-y-4",children:[(0,B.jsx)("p",{className:"text-sm font-semibold",children:a("geminiSubsectionTitle")}),(0,B.jsxs)("div",{className:"pl-4 border-l-2 border-border/40 space-y-4",children:[(0,B.jsx)(Qf,{label:a("safetySettingsLabel"),description:(0,B.jsxs)(B.Fragment,{children:[a("safetySettingsDescriptionPart1")," ",(0,B.jsx)("a",{href:"https://ai.google.dev/gemini-api/docs/safety-settings",target:"_blank",rel:"noopener noreferrer",className:"underline hover:text-foreground transition-colors",children:a("safetySettingsLearnMore")})]}),children:(0,B.jsxs)("div",{className:"flex items-center gap-2 justify-end",children:[(0,B.jsx)(a5.Switch,{checked:null!==v.llm_gemini_safety_settings,onCheckedChange:a=>w({llm_gemini_safety_settings:a?[...P$]:null})}),(0,B.jsx)(au,{className:"text-xs text-muted-foreground",children:null!==v.llm_gemini_safety_settings?a("custom"):a("default")})]})}),null!==v.llm_gemini_safety_settings&&(0,B.jsx)(Qk,{value:v.llm_gemini_safety_settings,onChange:a=>w({llm_gemini_safety_settings:a})})]})]})})]})}):(0,B.jsxs)("div",{className:"flex flex-col items-center justify-center py-16 gap-3 text-center",children:[(0,B.jsx)("p",{className:"text-base font-medium text-foreground",children:a("apiDisabledTitle")}),(0,B.jsx)("p",{className:"text-sm text-muted-foreground max-w-sm",children:a.rich("apiDisabledDescription",{code:a=>(0,B.jsx)("code",{className:"font-mono text-xs bg-muted px-1 py-0.5 rounded",children:a})})})]}):(0,B.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,B.jsx)("p",{className:"text-muted-foreground",children:a("noBankSelected")})})}let P8=["concise","verbose","verbatim","chunks","custom"],P9="__inherit__";function Qa({values:a,onChange:b,isOverride:c=!1}){let d=(0,E.useTranslations)("bankConfig"),e=a.retain_extraction_mode??(c?P9:""),f="custom"===a.retain_extraction_mode;return(0,B.jsxs)("div",{className:"divide-y divide-border/40",children:[(0,B.jsx)(Qf,{label:d("extractionModeLabel"),description:d("extractionModeDescription"),children:(0,B.jsxs)(a6.Select,{value:e,onValueChange:a=>b({retain_extraction_mode:a===P9?null:a||null}),children:[(0,B.jsx)(a6.SelectTrigger,{className:"w-full",children:(0,B.jsx)(a6.SelectValue,{placeholder:c?d("inherited"):void 0})}),(0,B.jsxs)(a6.SelectContent,{children:[c&&(0,B.jsx)(a6.SelectItem,{value:P9,children:(0,B.jsx)("span",{className:"text-muted-foreground italic",children:d("inherited")})}),P8.map(a=>(0,B.jsx)(a6.SelectItem,{value:a,children:a},a))]})]})}),(0,B.jsx)(Qf,{label:d("chunkSizeLabel"),description:d("chunkSizeDescription"),children:(0,B.jsx)(X.Input,{type:"number",min:500,max:8e3,value:a.retain_chunk_size??"",onChange:a=>b({retain_chunk_size:a.target.value?parseFloat(a.target.value):null}),placeholder:c?d("inherited"):void 0})}),(0,B.jsx)(Qg,{label:d("missionLabel"),description:d("retainMissionDescription"),value:a.retain_mission??"",onChange:a=>b({retain_mission:a||null}),placeholder:d(c?"inherited":"retainMissionPlaceholder"),rows:3}),f&&(0,B.jsx)(Qg,{label:d("customExtractionPromptLabel"),description:d("customExtractionPromptDescription"),value:a.retain_custom_instructions??"",onChange:a=>b({retain_custom_instructions:a||null}),rows:5}),(0,B.jsx)(Qf,{label:d("freeFormEntitiesLabel"),description:d("freeFormEntitiesDescription"),children:(0,B.jsxs)("div",{className:"flex justify-end items-center gap-2",children:[(0,B.jsx)(au,{className:"text-sm text-muted-foreground cursor-pointer select-none",children:d(a.entities_allow_free_form??!0?"enabled":"disabled")}),(0,B.jsx)(a5.Switch,{checked:a.entities_allow_free_form??!0,onCheckedChange:a=>b({entities_allow_free_form:a})})]})}),(0,B.jsx)(Qj,{value:a.entity_labels??[],onChange:a=>b({entity_labels:a.length>0?a:null})})]})}function Qb(a){return a?Object.entries(a).map(([a,b],c)=>({id:c,name:a,values:{retain_extraction_mode:b.retain_extraction_mode??null,retain_chunk_size:b.retain_chunk_size??null,retain_mission:b.retain_mission??null,retain_custom_instructions:b.retain_custom_instructions??null,entities_allow_free_form:b.entities_allow_free_form??null,entity_labels:P0(b.entity_labels)}})):[]}function Qc({defaultValues:a,onDefaultChange:b,strategies:c,onStrategiesChange:d}){let e=(0,E.useTranslations)("bankConfig"),f=(0,E.useTranslations)("common"),[g,h]=(0,C.useState)(()=>Qb(c)),[i,j]=(0,C.useState)("default"),[k,l]=(0,C.useState)(null),n=(0,C.useRef)(!1),o=JSON.stringify(c);(0,C.useEffect)(()=>{if(n.current){n.current=!1;return}h(Qb(c))},[o]);let p=a=>{n.current=!0,h(a),d(function(a){let b={};for(let c of a){if(!c.name.trim())continue;let a={};null!==c.values.retain_extraction_mode&&(a.retain_extraction_mode=c.values.retain_extraction_mode),null!==c.values.retain_chunk_size&&(a.retain_chunk_size=c.values.retain_chunk_size),c.values.retain_mission&&(a.retain_mission=c.values.retain_mission),c.values.retain_custom_instructions&&(a.retain_custom_instructions=c.values.retain_custom_instructions),null!==c.values.entities_allow_free_form&&(a.entities_allow_free_form=c.values.entities_allow_free_form),null!==c.values.entity_labels&&(a.entity_labels=c.values.entity_labels),b[c.name.trim()]=a}return Object.keys(b).length>0?b:null}(a))},q=(a,b)=>{p(g.map(c=>c.id===a?{...c,...b}:c))},r="default"!==i?g.find(a=>a.id===i):null;return(0,B.jsxs)("div",{children:[(0,B.jsxs)("div",{className:"border-b border-border px-6 flex items-stretch gap-1 flex-wrap",children:[(0,B.jsx)("button",{type:"button",onClick:()=>j("default"),className:`relative py-3 px-4 text-sm font-semibold transition-colors border-b-2 -mb-px ${"default"===i?"border-primary text-foreground":"border-transparent text-muted-foreground hover:text-foreground hover:border-border"}`,children:e("default")}),g.map(a=>(0,B.jsxs)("div",{className:`relative flex items-center gap-2 py-3 px-4 text-sm font-semibold transition-colors border-b-2 -mb-px cursor-pointer ${i===a.id?"border-primary text-foreground":"border-transparent text-muted-foreground hover:text-foreground hover:border-border"}`,onClick:()=>j(a.id),children:[(0,B.jsx)("span",{className:"font-mono",children:a.name||(0,B.jsx)("span",{className:"italic font-normal opacity-50",children:e("unnamed")})}),(0,B.jsx)("button",{type:"button",onClick:b=>{b.stopPropagation(),l(a)},className:"opacity-40 hover:opacity-100 hover:text-destructive transition-opacity text-base leading-none",children:"×"})]},a.id)),(0,B.jsxs)("button",{type:"button",onClick:()=>{let a=Date.now();p([...g,{id:a,name:"",values:{retain_extraction_mode:null,retain_chunk_size:null,retain_mission:null,retain_custom_instructions:null,entities_allow_free_form:null,entity_labels:null}}]),j(a)},className:"py-3 px-3 text-sm text-muted-foreground hover:text-primary transition-colors flex items-center gap-1.5",children:[(0,B.jsx)(II.Plus,{className:"h-3.5 w-3.5"}),e("addStrategy")]})]}),(0,B.jsx)("div",{children:"default"===i?(0,B.jsx)(Qa,{values:a,onChange:b}):r?(0,B.jsxs)("div",{children:[(0,B.jsxs)("div",{className:"px-6 py-3 flex items-center gap-3 border-b border-border/40",children:[(0,B.jsx)("label",{className:"text-xs text-muted-foreground shrink-0",children:e("nameLabel")}),(0,B.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,B.jsx)(X.Input,{value:r.name,onChange:a=>q(r.id,{name:a.target.value}),placeholder:e("strategyNamePlaceholder"),className:`h-7 text-xs font-mono max-w-[200px] ${!r.name.trim()?"border-destructive focus-visible:ring-destructive":""}`}),!r.name.trim()&&(0,B.jsx)("p",{className:"text-xs text-destructive",children:e("nameIsRequired")})]})]}),(0,B.jsx)(Qa,{values:r.values,onChange:a=>q(r.id,{values:{...r.values,...a}}),isOverride:!0})]}):null}),(0,B.jsx)(IU,{open:null!==k,onOpenChange:a=>{a||l(null)},children:(0,B.jsxs)(I9,{children:[(0,B.jsxs)(Ja,{children:[(0,B.jsx)(Jc,{children:e("deleteStrategyTitle",{name:k?.name||e("unnamed")})}),(0,B.jsx)(Jd,{children:e("deleteStrategyDescription")})]}),(0,B.jsxs)(Jb,{children:[(0,B.jsx)(Jf,{children:f("cancel")}),(0,B.jsx)(Je,{className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:()=>{if(k){var a;a=k.id,p(g.filter(b=>b.id!==a)),i===a&&j("default"),l(null)}},children:f("delete")})]})]})})]})}function Qd({selected:a,onChange:b}){let c=(0,E.useTranslations)("bankConfig"),d=[{key:"core",label:c("mcpGroupCore"),tools:["retain","sync_retain","recall","reflect"]},{key:"bankManagement",label:c("mcpGroupBankManagement"),tools:["list_banks","create_bank","get_bank","get_bank_stats","update_bank","delete_bank","clear_memories"]},{key:"mentalModels",label:c("mcpGroupMentalModels"),tools:["list_mental_models","get_mental_model","create_mental_model","update_mental_model","delete_mental_model","refresh_mental_model","clear_mental_model"]},{key:"directives",label:c("mcpGroupDirectives"),tools:["list_directives","create_directive","delete_directive"]},{key:"memories",label:c("mcpGroupMemories"),tools:["list_memories","get_memory"]},{key:"documents",label:c("mcpGroupDocuments"),tools:["list_documents","get_document","delete_document"]},{key:"operations",label:c("mcpGroupOperations"),tools:["list_operations","get_operation","cancel_operation"]},{key:"tags",label:c("mcpGroupTags"),tools:["list_tags"]}],e=new Set(a),f=P_.every(a=>e.has(a)),g=0===a.length;return(0,B.jsxs)("div",{className:"px-6 py-4 space-y-4",children:[(0,B.jsxs)("div",{className:"flex items-center justify-between",children:[(0,B.jsx)("p",{className:"text-xs text-muted-foreground",children:c("toolsEnabled",{selected:a.length,total:P_.length})}),(0,B.jsx)("button",{type:"button",onClick:()=>{b(f?[]:[...P_])},className:"text-xs text-primary hover:underline",children:f?c("deselectAll"):c("selectAll")})]}),(0,B.jsx)("div",{className:"space-y-4",children:d.map(a=>{let d=a.tools.filter(a=>e.has(a)).length===a.tools.length;return(0,B.jsxs)("div",{children:[(0,B.jsxs)("div",{className:"flex items-center justify-between mb-1.5",children:[(0,B.jsx)("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:a.label}),(0,B.jsx)("button",{type:"button",onClick:()=>{let c=new Set(e);d?a.tools.forEach(a=>c.delete(a)):a.tools.forEach(a=>c.add(a)),b(P_.filter(a=>c.has(a)))},className:"text-xs text-primary hover:underline",children:d?c("deselect"):c("selectAll")})]}),(0,B.jsx)("div",{className:"flex flex-wrap gap-2",children:a.tools.map(a=>{let c=e.has(a);return(0,B.jsx)("button",{type:"button",onClick:()=>{let c;(c=new Set(e)).has(a)?c.delete(a):c.add(a),b(P_.filter(a=>c.has(a)))},className:`px-2.5 py-1 rounded text-xs font-mono transition-colors border ${c?"bg-primary text-primary-foreground border-primary":"bg-muted/30 text-muted-foreground border-border/40 hover:border-primary/40"}`,children:a},a)})})]},a.key)})}),g&&(0,B.jsx)("p",{className:"text-xs text-destructive",children:c("noToolsWarning")})]})}function Qe({title:a,description:b,children:c,error:d,dirty:e,saving:f,onSave:g}){let h=(0,E.useTranslations)("bankConfig");return(0,B.jsxs)("section",{className:"space-y-3",children:[(0,B.jsxs)("div",{children:[(0,B.jsx)("h2",{className:"text-lg font-semibold",children:a}),(0,B.jsx)("p",{className:"text-sm text-muted-foreground",children:b})]}),(0,B.jsxs)(bp.Card,{className:"bg-muted/20 border-border/40",children:[(0,B.jsx)("div",{className:"divide-y divide-border/40",children:c}),d&&(0,B.jsx)("div",{className:"px-6 pb-2 pt-2",children:(0,B.jsxs)(PX,{variant:"destructive",children:[(0,B.jsx)(PZ,{className:"h-4 w-4"}),(0,B.jsx)(PY,{children:d})]})}),(0,B.jsx)("div",{className:"px-6 py-4 flex justify-end border-t border-border/40",children:(0,B.jsx)(W.Button,{size:"sm",disabled:!e||f,onClick:g,children:f?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(bc.default,{className:"h-4 w-4 mr-2 animate-spin"}),h("saving")]}):h("saveChanges")})})]})]})}function Qf({label:a,description:b,children:c}){return(0,B.jsx)("div",{className:"px-6 py-4",children:(0,B.jsxs)("div",{className:"flex flex-col md:flex-row md:items-center md:justify-between gap-4",children:[(0,B.jsxs)("div",{className:"flex-1",children:[(0,B.jsx)("p",{className:"text-sm font-medium",children:a}),b&&(0,B.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:b})]}),(0,B.jsx)("div",{className:"md:w-64 shrink-0",children:c})]})})}function Qg({label:a,description:b,value:c,onChange:d,placeholder:e,rows:f}){return(0,B.jsx)("div",{className:"px-6 py-4",children:(0,B.jsxs)("div",{className:"space-y-2",children:[(0,B.jsxs)("div",{children:[(0,B.jsx)("p",{className:"text-sm font-medium",children:a}),b&&(0,B.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:b})]}),(0,B.jsx)(JJ.Textarea,{value:c,onChange:a=>d(a.target.value),placeholder:e,rows:f??3,className:"font-mono text-sm"})]})})}function Qh({label:a,description:b,lowLabel:c,highLabel:d,value:e,onChange:f}){return(0,B.jsx)("div",{className:"px-6 py-4",children:(0,B.jsxs)("div",{className:"space-y-3",children:[(0,B.jsxs)("div",{children:[(0,B.jsx)("p",{className:"text-sm font-medium",children:a}),b&&(0,B.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:b})]}),(0,B.jsxs)("div",{className:"flex items-center gap-1.5",children:[c&&(0,B.jsx)("span",{className:"text-xs text-muted-foreground w-16 text-right shrink-0",children:c}),(0,B.jsx)("div",{className:"flex gap-0.5",children:[1,2,3,4,5].map(a=>(0,B.jsx)("button",{type:"button",onClick:()=>f(a),className:`w-4 h-4 rounded-full transition-colors hover:opacity-80 ${a<=e?"bg-primary":"bg-muted"}`},a))}),d&&(0,B.jsx)("span",{className:"text-xs text-muted-foreground w-20 shrink-0",children:d}),(0,B.jsxs)("span",{className:"text-xs font-mono text-muted-foreground ml-1 shrink-0",children:[e,"/5"]})]})]})})}function Qi({fields:a,onChange:b,depth:c,extraControls:d,examplePrefix:e}){let f=(0,E.useTranslations)("bankConfig"),g={text:f("fieldTypeText"),value:f("fieldTypeValue"),"multi-values":f("fieldTypeMultiValues"),map:f("fieldTypeMap")},[h,i]=(0,C.useState)({}),j=(c,d)=>{let e={};for(let[b,f]of Object.entries(a))e[b]=b===c?{...f,...d}:f;b(e)},k=0===c;return(0,B.jsxs)("div",{className:k?"space-y-1.5 py-1":"space-y-1.5 py-1 ml-3 border-l-2 border-border/40 pl-3",children:[0===Object.keys(a).length&&(0,B.jsx)("p",{className:"text-xs text-muted-foreground italic",children:f("noFieldsYet")}),Object.entries(a).map(([l,n],o)=>{let p="map"===n.type,q="value"===n.type||"multi-values"===n.type,r=h[o]??!0,s=p||q;return(0,B.jsxs)("div",{className:"space-y-1",children:[(0,B.jsxs)("div",{className:"flex items-center gap-1.5",children:[s?(0,B.jsx)("button",{type:"button",onClick:()=>i(a=>({...a,[o]:!r})),className:"text-muted-foreground hover:text-foreground shrink-0 p-0.5 rounded hover:bg-muted/50",children:r?(0,B.jsx)(Jj.ChevronDown,{className:"h-3.5 w-3.5"}):(0,B.jsx)(Q.ChevronRight,{className:"h-3.5 w-3.5"})}):(0,B.jsx)("span",{className:"w-[18px] shrink-0"}),(0,B.jsx)(X.Input,{placeholder:f("fieldNamePlaceholder"),value:l,onChange:c=>((c,d)=>{let e={};for(let[b,f]of Object.entries(a))e[b===c?d:b]=f;b(e)})(l,c.target.value),className:"h-7 text-xs font-mono w-28 shrink-0"}),(0,B.jsx)(X.Input,{placeholder:f("extractorHintWhatPlaceholder"),value:n.description,onChange:a=>j(l,{description:a.target.value}),className:"h-7 text-xs flex-1 min-w-0"}),(0,B.jsxs)(a6.Select,{value:n.type,onValueChange:a=>j(l,{type:a,..."map"===a?{fields:n.fields??{},values:void 0}:{},..."text"===a?{fields:void 0,values:void 0}:{},..."value"===a||"multi-values"===a?{fields:void 0,values:n.values??[]}:{}}),children:[(0,B.jsx)(a6.SelectTrigger,{className:"h-7 text-xs w-[120px] shrink-0 px-2 py-0",children:(0,B.jsx)(a6.SelectValue,{})}),(0,B.jsx)(a6.SelectContent,{children:Object.entries(g).map(([a,b])=>(0,B.jsx)(a6.SelectItem,{value:a,className:"text-xs",children:b},a))})]}),d,(0,B.jsx)("button",{type:"button",onClick:()=>{let c;return c={...a},void(delete c[l],b(c))},className:"text-muted-foreground hover:text-destructive shrink-0 p-0.5 rounded hover:bg-destructive/10",children:(0,B.jsx)(Jg,{className:"h-3.5 w-3.5"})})]}),k&&e&&l&&(0,B.jsx)("div",{className:"ml-[18px] pl-1.5",children:(0,B.jsx)("span",{className:"text-[10px] font-mono text-muted-foreground/60 leading-none",children:"map"===n.type&&n.fields&&Object.keys(n.fields).length>0?`e.g. ${Object.keys(n.fields).slice(0,2).map(a=>`${e}:${a}:<value>`).join(", ")}`:"text"===n.type?`e.g. ${e}:<any text>`:(n.values?.length??0)>0?`e.g. ${e}:${n.values[0].value||"<value>"}`:`e.g. ${e}:<value>`})}),r&&p&&(0,B.jsx)(Qi,{fields:n.fields??{},onChange:a=>j(l,{fields:a}),depth:c+1,examplePrefix:e?`${e}:${l}`:void 0}),r&&q&&(0,B.jsxs)("div",{className:"ml-6 space-y-0.5 py-1",children:[0===(n.values??[]).length&&(0,B.jsx)("p",{className:"text-[11px] text-muted-foreground italic",children:f("noValuesYet")}),(n.values??[]).map((a,b)=>(0,B.jsxs)("div",{className:"flex items-center gap-1.5 group/val",children:[(0,B.jsx)("span",{className:"text-muted-foreground/50 text-[10px] shrink-0",children:"•"}),(0,B.jsx)(X.Input,{placeholder:f("addValueShort"),value:a.value,onChange:c=>{let d=[...n.values??[]];d[b]={...a,value:c.target.value},j(l,{values:d})},className:"h-6 text-[11px] font-mono w-24 shrink-0 border-dashed"}),(0,B.jsx)(X.Input,{placeholder:f("extractorHintWhichPlaceholder"),value:a.description,onChange:c=>{let d=[...n.values??[]];d[b]={...a,description:c.target.value},j(l,{values:d})},className:"h-6 text-[11px] flex-1 min-w-0 border-dashed"}),(0,B.jsx)("button",{type:"button",onClick:()=>{j(l,{values:(n.values??[]).filter((a,c)=>c!==b)})},className:"text-muted-foreground/40 hover:text-destructive shrink-0 p-0.5 rounded hover:bg-destructive/10 opacity-0 group-hover/val:opacity-100 transition-opacity",children:(0,B.jsx)(Jg,{className:"h-3 w-3"})})]},b)),(0,B.jsxs)("button",{type:"button",onClick:()=>{j(l,{values:[...n.values??[],{value:"",description:""}]})},className:"text-[11px] text-muted-foreground/60 hover:text-foreground inline-flex items-center gap-1 ml-2.5",children:[(0,B.jsx)(II.Plus,{className:"h-2.5 w-2.5"}),f("addValueShort")]})]})]},o)}),(0,B.jsxs)("button",{type:"button",onClick:()=>{b({...a,"":{type:"text",description:""}})},className:"text-xs text-muted-foreground hover:text-foreground inline-flex items-center gap-1",children:[(0,B.jsx)(II.Plus,{className:"h-3 w-3"}),f("addField")]})]})}function Qj({value:a,onChange:b}){let c=(0,E.useTranslations)("entityLabelsEditor"),d=(c,d)=>{b(a.map((a,b)=>b===c?{...a,...d}:a))};return(0,B.jsxs)("div",{className:"px-6 py-4 space-y-3",children:[(0,B.jsxs)("div",{className:"flex items-center justify-between",children:[(0,B.jsxs)("div",{children:[(0,B.jsx)("p",{className:"text-sm font-medium",children:c("entityLabelsTitle")}),(0,B.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:c("entityLabelsDescription")})]}),a.length>0&&(0,B.jsx)("span",{className:"text-xs bg-primary/10 text-primary px-2 py-0.5 rounded-full shrink-0",children:c("labelCount",{count:a.length})})]}),0===a.length&&(0,B.jsx)("p",{className:"text-xs text-muted-foreground italic",children:c("noEntityLabelsDefined")}),(0,B.jsx)("div",{className:"space-y-2",children:a.map((e,f)=>(0,B.jsx)("div",{className:"border border-border/50 rounded-md bg-background",children:(0,B.jsx)(Qi,{fields:{[e.key]:{type:e.type,description:e.description,values:e.values,fields:e.fields}},onChange:c=>{let e=Object.entries(c);if(0===e.length)b(a.filter((a,b)=>b!==f));else{let[a,b]=e[0];d(f,{key:a,type:b.type,description:b.description,values:b.values??[],fields:b.fields??{}})}},depth:0,extraControls:(0,B.jsxs)("label",{className:"flex items-center gap-1.5 text-xs text-muted-foreground shrink-0 cursor-pointer select-none",title:c("alsoStoreAsTagTooltip"),children:[(0,B.jsx)(IM.Checkbox,{checked:e.tag,onCheckedChange:a=>d(f,{tag:!!a}),className:"h-4 w-4"}),c("plusTag")]}),examplePrefix:e.key})},f))}),(0,B.jsxs)("button",{type:"button",onClick:()=>{b([...a,{key:"",description:"",type:"value",optional:!0,tag:!1,values:[],fields:{}}])},className:"flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground",children:[(0,B.jsx)(II.Plus,{className:"h-3.5 w-3.5"}),c("addLabel")]})]})}function Qk({value:a,onChange:b}){let c=(0,E.useTranslations)("bankConfig"),d=[{value:"HARM_CATEGORY_HARASSMENT",label:c("geminiCategoryHarassment")},{value:"HARM_CATEGORY_HATE_SPEECH",label:c("geminiCategoryHateSpeech")},{value:"HARM_CATEGORY_SEXUALLY_EXPLICIT",label:c("geminiCategorySexuallyExplicit")},{value:"HARM_CATEGORY_DANGEROUS_CONTENT",label:c("geminiCategoryDangerousContent")}],e=[{value:"HARM_BLOCK_THRESHOLD_UNSPECIFIED",label:c("geminiThresholdUnspecified")},{value:"OFF",label:c("geminiThresholdOff")},{value:"BLOCK_NONE",label:c("geminiThresholdBlockNone")},{value:"BLOCK_LOW_AND_ABOVE",label:c("geminiThresholdBlockLowAndAbove")},{value:"BLOCK_MEDIUM_AND_ABOVE",label:c("geminiThresholdBlockMediumAndAbove")},{value:"BLOCK_ONLY_HIGH",label:c("geminiThresholdBlockOnlyHigh")}],f=b=>a.find(a=>a.category===b)?.threshold??"BLOCK_MEDIUM_AND_ABOVE";return(0,B.jsxs)("div",{className:"px-6 py-4 space-y-3",children:[(0,B.jsxs)("p",{className:"text-xs text-muted-foreground",children:[c("geminiSafetyEditorDescriptionPart1")," ",(0,B.jsx)("a",{href:"https://ai.google.dev/gemini-api/docs/safety-settings",target:"_blank",rel:"noopener noreferrer",className:"underline hover:text-foreground transition-colors",children:c("geminiSafetyEditorLearnMore")})]}),(0,B.jsx)("div",{className:"space-y-2",children:d.map(a=>(0,B.jsxs)("div",{className:"flex items-center justify-between gap-4",children:[(0,B.jsx)("span",{className:"text-sm",children:a.label}),(0,B.jsxs)(a6.Select,{value:f(a.value),onValueChange:c=>{var e;return e=a.value,void b(d.map(a=>({category:a.value,threshold:a.value===e?c:f(a.value)})))},children:[(0,B.jsx)(a6.SelectTrigger,{className:"w-48 h-8 text-xs",children:(0,B.jsx)(a6.SelectValue,{})}),(0,B.jsx)(a6.SelectContent,{children:e.map(a=>(0,B.jsx)(a6.SelectItem,{value:a.value,className:"text-xs",children:a.label},a.value))})]})]},a.value))})]})}let Ql=(0,K.default)("link-2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]),Qm=(0,K.default)("folder-open",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);var Qn=a.i(67511),Qn=Qn;let Qo=(0,K.default)("circle-x",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]),Qp=(0,K.default)("external-link",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);var Qq=["x1","y1","x2","y2","key"],Qr=["offset"],Qs=["xAxisId","yAxisId"],Qt=["xAxisId","yAxisId"];function Qu(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function Qv(a){for(var b=1;b<arguments.length;b++){var c=null!=arguments[b]?arguments[b]:{};b%2?Qu(Object(c),!0).forEach(function(b){var d,e,f;d=a,e=b,f=c[b],(e=function(a){var b=function(a,b){if("object"!=typeof a||!a)return a;var c=a[Symbol.toPrimitive];if(void 0!==c){var d=c.call(a,b||"default");if("object"!=typeof d)return d;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===b?String:Number)(a)}(a,"string");return"symbol"==typeof b?b:b+""}(e))in d?Object.defineProperty(d,e,{value:f,enumerable:!0,configurable:!0,writable:!0}):d[e]=f}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(c)):Qu(Object(c)).forEach(function(b){Object.defineProperty(a,b,Object.getOwnPropertyDescriptor(c,b))})}return a}function Qw(){return(Qw=Object.assign.bind()).apply(null,arguments)}function Qx(a,b){if(null==a)return{};var c,d,e=function(a,b){if(null==a)return{};var c={};for(var d in a)if(({}).hasOwnProperty.call(a,d)){if(-1!==b.indexOf(d))continue;c[d]=a[d]}return c}(a,b);if(Object.getOwnPropertySymbols){var f=Object.getOwnPropertySymbols(a);for(d=0;d<f.length;d++)c=f[d],-1===b.indexOf(c)&&({}).propertyIsEnumerable.call(a,c)&&(e[c]=a[c])}return e}var Qy=a=>{var{fill:b}=a;if(!b||"none"===b)return null;var{fillOpacity:c,x:d,y:e,width:f,height:g,ry:h}=a;return C.createElement("rect",{x:d,y:e,ry:h,width:f,height:g,stroke:"none",fill:b,fillOpacity:c,className:"recharts-cartesian-grid-bg"})};function Qz(a){var{option:b,lineItemProps:c}=a;if(C.isValidElement(b))d=C.cloneElement(b,c);else if("function"==typeof b)d=b(c);else{var d,e,{x1:f,y1:g,x2:h,y2:i,key:j}=c,k=null!=(e=pY(Qx(c,Qq)))?e:{},{offset:l}=k,n=Qx(k,Qr);d=C.createElement("line",Qw({},n,{x1:f,y1:g,x2:h,y2:i,fill:"none",key:j}))}return d}function QA(a){var{x:b,width:c,horizontal:d=!0,horizontalPoints:e}=a;if(!d||!e||!e.length)return null;var{xAxisId:f,yAxisId:g}=a,h=Qx(a,Qs),i=e.map((a,e)=>{var f=Qv(Qv({},h),{},{x1:b,y1:a,x2:b+c,y2:a,key:"line-".concat(e),index:e});return C.createElement(Qz,{key:"line-".concat(e),option:d,lineItemProps:f})});return C.createElement("g",{className:"recharts-cartesian-grid-horizontal"},i)}function QB(a){var{y:b,height:c,vertical:d=!0,verticalPoints:e}=a;if(!d||!e||!e.length)return null;var{xAxisId:f,yAxisId:g}=a,h=Qx(a,Qt),i=e.map((a,e)=>{var f=Qv(Qv({},h),{},{x1:a,y1:b,x2:a,y2:b+c,key:"line-".concat(e),index:e});return C.createElement(Qz,{option:d,lineItemProps:f,key:"line-".concat(e)})});return C.createElement("g",{className:"recharts-cartesian-grid-vertical"},i)}function QC(a){var{horizontalFill:b,fillOpacity:c,x:d,y:e,width:f,height:g,horizontalPoints:h,horizontal:i=!0}=a;if(!i||!b||!b.length||null==h)return null;var j=h.map(a=>Math.round(a+e-e)).sort((a,b)=>a-b);e!==j[0]&&j.unshift(0);var k=j.map((a,h)=>{var i=j[h+1]?j[h+1]-a:e+g-a;if(i<=0)return null;var k=h%b.length;return C.createElement("rect",{key:"react-".concat(h),y:a,x:d,height:i,width:f,stroke:"none",fill:b[k],fillOpacity:c,className:"recharts-cartesian-grid-bg"})});return C.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},k)}function QD(a){var{vertical:b=!0,verticalFill:c,fillOpacity:d,x:e,y:f,width:g,height:h,verticalPoints:i}=a;if(!b||!c||!c.length)return null;var j=i.map(a=>Math.round(a+e-e)).sort((a,b)=>a-b);e!==j[0]&&j.unshift(0);var k=j.map((a,b)=>{var i=j[b+1]?j[b+1]-a:e+g-a;if(i<=0)return null;var k=b%c.length;return C.createElement("rect",{key:"react-".concat(b),x:a,y:f,width:i,height:h,stroke:"none",fill:c[k],fillOpacity:d,className:"recharts-cartesian-grid-bg"})});return C.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},k)}var QE=(a,b)=>{var{xAxis:c,width:d,height:e,offset:f}=a;return fr(uR(Qv(Qv(Qv({},uW),c),{},{ticks:fs(c,!0),viewBox:{x:0,y:0,width:d,height:e}})),f.left,f.left+f.width,b)},QF=(a,b)=>{var{yAxis:c,width:d,height:e,offset:f}=a;return fr(uR(Qv(Qv(Qv({},uW),c),{},{ticks:fs(c,!0),viewBox:{x:0,y:0,width:d,height:e}})),f.top,f.top+f.height,b)},QG={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[],xAxisId:0,yAxisId:0,syncWithTicks:!1,zIndex:k6.grid};function QH(a){var b=fa(fA),c=fa(fB),d=f6(),e=Qv(Qv({},qB(a,QG)),{},{x:dE(a.x)?a.x:d.left,y:dE(a.y)?a.y:d.top,width:dE(a.width)?a.width:d.width,height:dE(a.height)?a.height:d.height}),{xAxisId:f,yAxisId:g,x:h,y:i,width:j,height:k,syncWithTicks:l,horizontalValues:n,verticalValues:o}=e,p=fM(),q=fa(a=>m3(a,"xAxis",f,p)),r=fa(a=>m3(a,"yAxis",g,p));if(!fm(j)||!fm(k)||!dE(h)||!dE(i))return null;var s=e.verticalCoordinatesGenerator||QE,t=e.horizontalCoordinatesGenerator||QF,{horizontalPoints:u,verticalPoints:v}=e;if((!u||!u.length)&&"function"==typeof t){var w=n&&n.length,x=t({yAxis:r?Qv(Qv({},r),{},{ticks:w?n:r.ticks}):void 0,width:null!=b?b:j,height:null!=c?c:k,offset:d},!!w||l);fR(Array.isArray(x),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(typeof x,"]")),Array.isArray(x)&&(u=x)}if((!v||!v.length)&&"function"==typeof s){var y=o&&o.length,z=s({xAxis:q?Qv(Qv({},q),{},{ticks:y?o:q.ticks}):void 0,width:null!=b?b:j,height:null!=c?c:k,offset:d},!!y||l);fR(Array.isArray(z),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(typeof z,"]")),Array.isArray(z)&&(v=z)}return C.createElement(re,{zIndex:e.zIndex},C.createElement("g",{className:"recharts-cartesian-grid"},C.createElement(Qy,{fill:e.fill,fillOpacity:e.fillOpacity,x:e.x,y:e.y,width:e.width,height:e.height,ry:e.ry}),C.createElement(QC,Qw({},e,{horizontalPoints:u})),C.createElement(QD,Qw({},e,{verticalPoints:v})),C.createElement(QA,Qw({},e,{offset:d,horizontalPoints:u,xAxis:q,yAxis:r})),C.createElement(QB,Qw({},e,{offset:d,verticalPoints:v,xAxis:q,yAxis:r}))))}QH.displayName="CartesianGrid";let QI=["1h","12h","1d","7d","30d","90d"],QJ=["created_at","mentioned_at","occurred_start"],QK="#8b5cf6",QL="#ec4899",QM="#6366f1",QN="var(--chart-5)",QO="var(--muted-foreground)",QP={world:{label:"World",color:QK},experience:{label:"Experience",color:QL},observation:{label:"Observations",color:QM}};function QQ(a){if(a<1e3)return a.toString();if(a<1e6){let b=a/1e3;return`${b>=10?b.toFixed(0):b.toFixed(1).replace(/\.0$/,"")}k`}if(a<1e9){let b=a/1e6;return`${b>=10?b.toFixed(0):b.toFixed(1).replace(/\.0$/,"")}M`}let b=a/1e9;return`${b>=10?b.toFixed(0):b.toFixed(1).replace(/\.0$/,"")}B`}function QR({value:a,className:b}){return(0,B.jsx)("span",{className:b,title:a.toLocaleString(),children:QQ(a)})}function QS({active:a,payload:b,label:c,valueLabel:d}){return a&&b&&0!==b.length?(0,B.jsxs)("div",{className:"rounded-lg border border-border/60 bg-popover/95 backdrop-blur-sm px-3 py-2 shadow-md",children:[null!=c&&(0,B.jsx)("div",{className:"text-[11px] font-medium text-foreground mb-1.5",children:c}),(0,B.jsx)("div",{className:"space-y-1",children:b.map((a,b)=>(0,B.jsxs)("div",{className:"flex items-center gap-2 text-[11px]",children:[(0,B.jsx)("span",{className:"w-2 h-2 rounded-[2px]",style:{backgroundColor:a.color||a.payload?.fill}}),(0,B.jsx)("span",{className:"text-muted-foreground",children:a.name||d||"Value"}),(0,B.jsx)("span",{className:"ml-auto pl-3 font-semibold tabular-nums text-foreground",children:(a.value??0).toLocaleString()})]},b))})]}):null}function QT({children:a}){return(0,B.jsx)("h3",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-[0.08em] mb-3",children:a})}function QU(a,b){if(!a)return b?b("relativeTimeNever"):"Never";let c=Math.floor((Date.now()-new Date(a).getTime())/6e4);if(c<1)return b?b("relativeTimeJustNow"):"just now";if(c<60)return b?b("relativeTimeMinutes",{mins:c}):`${c}m ago`;let d=Math.floor(c/60);if(d<24)return b?b("relativeTimeHours",{hours:d}):`${d}h ago`;let e=Math.floor(d/24);return b?b("relativeTimeDays",{days:e}):`${e}d ago`}function QV(a){return new Date(/[+Z-]$/.test(a)||/[+-]\d\d:?\d\d$/.test(a)?a:`${a}Z`)}function QW({done:a,total:b,doneColor:c}){let d=Math.round(100*(b>0?a/b:0));return(0,B.jsxs)("div",{className:"space-y-1.5",children:[(0,B.jsxs)("div",{className:"flex items-baseline justify-between",children:[(0,B.jsxs)("span",{className:"text-xs text-muted-foreground",children:[(0,B.jsx)("span",{className:"tabular-nums font-semibold text-foreground text-sm",children:a.toLocaleString()}),(0,B.jsxs)("span",{className:"text-muted-foreground",children:[" / ",b.toLocaleString()]})]}),(0,B.jsxs)("span",{className:"text-xs font-semibold tabular-nums text-foreground",children:[d,"%"]})]}),(0,B.jsx)("div",{className:"h-1.5 w-full rounded-full bg-muted overflow-hidden",children:(0,B.jsx)("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${d}%`,backgroundColor:c}})})]})}function QX({title:a,items:b,emptyLabel:c}){let d=b.reduce((a,b)=>a+b.value,0);return(0,B.jsxs)("div",{className:"space-y-3",children:[(0,B.jsxs)("div",{className:"flex items-center justify-between",children:[(0,B.jsx)("h4",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-[0.08em]",children:a}),(0,B.jsx)(QR,{value:d,className:"text-xs text-muted-foreground tabular-nums"})]}),0===d?(0,B.jsx)("div",{className:"text-xs text-muted-foreground py-2",children:c}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)("div",{className:"h-1.5 flex w-full rounded-full overflow-hidden bg-muted",children:b.filter(a=>a.value>0).map(a=>(0,B.jsx)("div",{className:"h-full",style:{width:`${a.value/d*100}%`,backgroundColor:a.color},title:`${a.name}: ${a.value.toLocaleString()}`},a.name))}),(0,B.jsx)("div",{className:"grid grid-cols-3 gap-3 text-sm",children:b.map(a=>(0,B.jsxs)("div",{className:"space-y-0.5",children:[(0,B.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,B.jsx)("span",{className:"w-2 h-2 rounded-[2px]",style:{backgroundColor:a.color}}),(0,B.jsx)("span",{className:"text-[11px] uppercase tracking-wider text-muted-foreground font-medium",children:a.name})]}),(0,B.jsxs)("div",{className:"flex items-baseline gap-1.5",children:[(0,B.jsx)(QR,{value:a.value,className:"text-base font-semibold tabular-nums"}),(0,B.jsx)("span",{className:"text-[10px] text-muted-foreground tabular-nums",children:d>0?`${(a.value/d*100).toFixed(0)}%`:"0%"})]})]},a.name))})]})]})}function QY({icon:a,label:b,value:c}){return(0,B.jsxs)("div",{className:"flex items-center gap-3 p-4",children:[(0,B.jsx)("div",{className:"p-2 rounded-md bg-muted",children:(0,B.jsx)(a,{className:"w-4 h-4 text-muted-foreground"})}),(0,B.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,B.jsx)("p",{className:"text-xs text-muted-foreground font-medium",children:b}),(0,B.jsx)(QR,{value:c,className:"text-2xl font-semibold text-foreground leading-tight tabular-nums block"})]})]})}let QZ=["completed","processing","pending","failed","cancelled"],Q$={completed:"#10b981",processing:"#3b82f6",pending:"#f59e0b",failed:"#ef4444",cancelled:"#6b7280"},Q_={completed:"completed",processing:"processing",pending:"pending",failed:"failed",cancelled:"cancelled"};function Q0({byStatus:a}){let b=(0,E.useTranslations)("bankStats"),c={completed:b("opsCompleted"),processing:b("opsProcessing"),pending:b("opsPending"),failed:b("opsFailed"),cancelled:b("opsCancelled")},d=QZ.map(b=>({status:b,label:c[b]??Q_[b],value:a[b]||0,color:Q$[b]}));for(let[b,c]of Object.entries(a))QZ.includes(b)||d.push({status:b,label:b,value:c,color:QO});let e=d.reduce((a,b)=>a+b.value,0),f=d.filter(a=>a.value>0);return(0,B.jsxs)(bp.Card,{children:[(0,B.jsxs)(bp.CardHeader,{className:"pb-2 flex flex-row items-center justify-between space-y-0",children:[(0,B.jsxs)(bp.CardTitle,{className:"text-sm font-semibold flex items-center gap-2",children:[(0,B.jsx)(be,{className:"w-3.5 h-3.5 text-muted-foreground"}),b("operations")]}),(0,B.jsxs)("span",{className:"text-xs text-muted-foreground tabular-nums",children:[(0,B.jsx)(QR,{value:e})," ",b("totalSuffix")]})]}),(0,B.jsx)(bp.CardContent,{children:0===e?(0,B.jsx)("div",{className:"h-[100px] flex items-center justify-center text-sm text-muted-foreground",children:b("noOperationsYet")}):(0,B.jsxs)("div",{className:"space-y-3",children:[(0,B.jsx)("div",{className:"h-1.5 flex w-full rounded-full overflow-hidden bg-muted",children:f.map(a=>(0,B.jsx)("div",{className:"h-full",style:{width:`${a.value/e*100}%`,backgroundColor:a.color},title:`${a.label}: ${a.value.toLocaleString()}`},a.status))}),(0,B.jsx)("div",{className:"space-y-1.5",children:f.map(a=>(0,B.jsxs)("div",{className:"flex items-center gap-2 text-xs",children:[(0,B.jsx)("span",{className:"w-2 h-2 rounded-[2px] flex-shrink-0",style:{backgroundColor:a.color}}),(0,B.jsx)("span",{className:"text-muted-foreground flex-1",children:a.label}),(0,B.jsx)(QR,{value:a.value,className:"font-semibold tabular-nums text-foreground"}),(0,B.jsxs)("span",{className:"text-[10px] text-muted-foreground tabular-nums w-9 text-right",children:[(a.value/e*100).toFixed(0),"%"]})]},a.status))})]})})]})}function Q1({done:a,pending:b,failed:c,total:d,lastConsolidatedAt:e}){let f=(0,E.useTranslations)("bankStats"),[g,h]=(0,C.useState)(!1),i=c>0;return(0,B.jsxs)(bp.Card,{children:[(0,B.jsx)(bp.CardHeader,{className:"pb-2",children:(0,B.jsx)(bp.CardTitle,{className:"text-sm font-semibold",children:f("consolidation")})}),(0,B.jsxs)(bp.CardContent,{className:"space-y-4",children:[(0,B.jsx)(QW,{done:a,total:d,doneColor:QN}),(0,B.jsxs)("div",{className:"grid grid-cols-4 gap-3 pt-1",children:[(0,B.jsxs)("div",{className:"space-y-0.5",children:[(0,B.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,B.jsx)(Qn.default,{className:"w-3 h-3 text-emerald-500"}),(0,B.jsx)("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-medium",children:f("done")})]}),(0,B.jsx)(QR,{value:a,className:"text-base font-semibold tabular-nums text-foreground block"})]}),(0,B.jsxs)("div",{className:"space-y-0.5",children:[(0,B.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,B.jsx)(PZ,{className:"w-3 h-3 text-amber-500"}),(0,B.jsx)("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-medium",children:f("pending")})]}),(0,B.jsx)(QR,{value:b,className:"text-base font-semibold tabular-nums text-foreground block"})]}),(0,B.jsxs)("button",{type:"button",onClick:()=>i&&h(!0),disabled:!i,className:`text-left space-y-0.5 rounded-md -mx-1 px-1 py-0.5 transition-colors ${i?"cursor-pointer hover:bg-red-500/10 focus:outline-none focus:ring-2 focus:ring-red-500/40":"cursor-default"}`,title:i?f("viewFailedMemoriesLabel"):void 0,children:[(0,B.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,B.jsx)(Qo,{className:`w-3 h-3 ${i?"text-red-600 dark:text-red-400":"text-muted-foreground/50"}`}),(0,B.jsx)("span",{className:`text-[10px] uppercase tracking-wider font-medium ${i?"text-red-600 dark:text-red-400":"text-muted-foreground"}`,children:f("failed")})]}),(0,B.jsxs)("span",{className:`text-base font-semibold tabular-nums block ${i?"text-red-600 dark:text-red-400":"text-foreground"}`,children:[(0,B.jsx)(QR,{value:c}),i&&(0,B.jsx)(Qp,{className:"inline w-3 h-3 ml-1 opacity-70"})]})]}),(0,B.jsxs)("div",{className:"space-y-0.5",children:[(0,B.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,B.jsx)(af,{className:"w-3 h-3 text-muted-foreground"}),(0,B.jsx)("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-medium",children:f("last")})]}),(0,B.jsx)("span",{className:"text-base font-semibold text-foreground block leading-tight",children:QU(e,f)})]})]})]}),(0,B.jsx)(Q2,{open:g,onOpenChange:h})]})}function Q2({open:a,onOpenChange:b}){let c=(0,E.useTranslations)("bankStats"),d=(0,E.useTranslations)("failedConsolidations"),{currentBank:e}=(0,H.useBank)(),[f,g]=(0,C.useState)([]),[h,i]=(0,C.useState)(0),[j,k]=(0,C.useState)(!1),[l,n]=(0,C.useState)(!1),[o,p]=(0,C.useState)(0);(0,C.useEffect)(()=>{if(!a||!e)return;let b=!1;return k(!0),V.client.listMemories(e,{consolidationState:"failed",limit:200}).then(a=>{b||(g(a.items),i(a.total))}).catch(()=>{}).finally(()=>{b||k(!1)}),()=>{b=!0}},[a,e,o]);let q=async()=>{if(e){n(!0);try{let a=await V.client.recoverConsolidation(e);a.retried_count>0&&await V.client.triggerConsolidation(e),F.toast.success(d("recoverSuccess",{count:a.retried_count})),p(a=>a+1)}catch{}finally{n(!1)}}};return(0,B.jsx)(bf.Dialog,{open:a,onOpenChange:b,children:(0,B.jsxs)(bf.DialogContent,{className:"max-w-4xl max-h-[80vh] flex flex-col",children:[(0,B.jsxs)(bf.DialogHeader,{children:[(0,B.jsxs)(bf.DialogTitle,{className:"flex items-center gap-2",children:[(0,B.jsx)(Qo,{className:"w-4 h-4 text-red-600 dark:text-red-400"}),d("title")]}),(0,B.jsx)(bf.DialogDescription,{children:d("description")})]}),(0,B.jsxs)("div",{className:"flex items-center justify-between gap-2 py-2",children:[(0,B.jsx)("span",{className:"text-sm text-muted-foreground",children:j?d("loading"):d("totalFailed",{total:h})}),(0,B.jsxs)(W.Button,{size:"sm",onClick:q,disabled:l||j||0===h,children:[(0,B.jsx)(ad,{className:`w-3.5 h-3.5 mr-1.5 ${l?"animate-spin":""}`}),d("recoverAll")]})]}),(0,B.jsx)("div",{className:"flex-1 min-h-0 overflow-auto border border-border rounded-md",children:(0,B.jsxs)(ai,{children:[(0,B.jsx)(aj,{children:(0,B.jsxs)(al,{children:[(0,B.jsx)(am,{className:"w-[140px]",children:d("colFailedAt")}),(0,B.jsx)(am,{className:"w-[100px]",children:d("colType")}),(0,B.jsx)(am,{children:d("colText")})]})}),(0,B.jsxs)(ak,{children:[0===f.length&&!j&&(0,B.jsx)(al,{children:(0,B.jsx)(an,{colSpan:3,className:"text-center text-muted-foreground py-8",children:d("noFailedConsolidations")})}),f.map(a=>(0,B.jsxs)(al,{children:[(0,B.jsx)(an,{className:"text-xs text-muted-foreground whitespace-nowrap",children:QU(a.consolidation_failed_at,c)}),(0,B.jsx)(an,{className:"text-xs capitalize",children:a.fact_type}),(0,B.jsxs)(an,{className:"text-sm",children:[(0,B.jsx)("div",{className:"line-clamp-2",children:a.text}),a.context&&(0,B.jsx)("div",{className:"text-xs text-muted-foreground mt-0.5 line-clamp-1",children:a.context})]})]},a.id))]})]})})]})})}function Q3({models:a,lastConsolidatedAt:b}){let c=(0,E.useTranslations)("bankStats"),d=a.length,e=b?new Date(b).getTime():0,f=a.filter(a=>!e||!!a.last_refreshed_at&&new Date(a.last_refreshed_at).getTime()>=e).length,g=d-f;return(0,B.jsxs)(bp.Card,{children:[(0,B.jsx)(bp.CardHeader,{className:"pb-2",children:(0,B.jsxs)(bp.CardTitle,{className:"text-sm font-semibold flex items-center gap-2",children:[(0,B.jsx)(JF,{className:"w-3.5 h-3.5 text-muted-foreground"}),c("mentalModels")]})}),(0,B.jsx)(bp.CardContent,{className:"space-y-4",children:0===d?(0,B.jsx)("div",{className:"text-sm text-muted-foreground py-4",children:c("noMentalModels")}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(QW,{done:f,total:d,doneColor:QN}),(0,B.jsxs)("div",{className:"grid grid-cols-3 gap-3 pt-1",children:[(0,B.jsxs)("div",{className:"space-y-0.5",children:[(0,B.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,B.jsx)(Qn.default,{className:"w-3 h-3 text-emerald-500"}),(0,B.jsx)("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-medium",children:c("upToDate")})]}),(0,B.jsx)("span",{className:"text-base font-semibold tabular-nums text-foreground block",children:f})]}),(0,B.jsxs)("div",{className:"space-y-0.5",children:[(0,B.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,B.jsx)(PZ,{className:"w-3 h-3 text-amber-500"}),(0,B.jsx)("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-medium",children:c("stale")})]}),(0,B.jsx)("span",{className:"text-base font-semibold tabular-nums text-foreground block",children:g})]}),(0,B.jsxs)("div",{className:"space-y-0.5",children:[(0,B.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,B.jsx)(JF,{className:"w-3 h-3 text-muted-foreground"}),(0,B.jsx)("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-medium",children:c("total")})]}),(0,B.jsx)("span",{className:"text-base font-semibold tabular-nums text-foreground block",children:d})]})]})]})})]})}let Q4={fontSize:11,fill:QO,fontWeight:500};function Q5(){let a=(0,E.useTranslations)("bankStats"),b={created_at:{short:a("timeFieldIngestedShort"),long:a("timeFieldIngestedLong")},mentioned_at:{short:a("timeFieldMentionedShort"),long:a("timeFieldMentionedLong")},occurred_start:{short:a("timeFieldOccurredShort"),long:a("timeFieldOccurredLong")}},{currentBank:c}=(0,H.useBank)(),{features:d}=(0,IL.useFeatures)(),e=d?.observations??!1,[f,g]=(0,C.useState)(null),[h,i]=(0,C.useState)([]),[j,k]=(0,C.useState)(!1),[l,n]=(0,C.useState)("7d"),[o,p]=(0,C.useState)("created_at"),[q,r]=(0,C.useState)({trunc:"day",buckets:[]}),[s,t]=(0,C.useState)({world:!0,experience:!0,observation:!0}),u=async()=>{if(c){k(!0);try{let[a,b]=await Promise.all([V.client.getBankStats(c),V.client.listMentalModels(c)]);g(a),i(b.items||[])}catch(a){console.error("Error loading bank stats:",a)}finally{k(!1)}}},v=async()=>{if(c)try{let a=await V.client.getMemoriesTimeseries(c,l,o);r({trunc:a.trunc,buckets:a.buckets||[]})}catch(a){console.error("Error loading memories timeseries:",a)}};if((0,C.useEffect)(()=>{if(c){u();let a=setInterval(u,5e3);return()=>clearInterval(a)}},[c]),(0,C.useEffect)(()=>{if(c){v();let a=setInterval(v,5e3);return()=>clearInterval(a)}},[c,l,o]),j&&!f)return(0,B.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,B.jsx)(af,{className:"w-12 h-12 mx-auto mb-3 text-muted-foreground animate-pulse"})});if(!f)return null;let w=e?["world","experience","observation"]:["world","experience"],x=q.buckets.map(a=>{var b,c,d,e;let f,g;return{...a,label:(b=a.time,c=q.trunc,f=QV(b),"day"===c?f.toLocaleDateString(void 0,{month:"short",day:"numeric"}):f.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})),tooltipLabel:(d=a.time,e=q.trunc,g=QV(d),"day"===e?g.toLocaleDateString(void 0,{weekday:"short",month:"short",day:"numeric"}):g.toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}))}}),y=x.reduce((a,b)=>a+w.reduce((a,c)=>a+(s[c]&&b[c]||0),0),0),z=Math.max(0,f.total_nodes-f.pending_consolidation),A={world:a("world"),experience:a("experience"),observation:a("observations")};return(0,B.jsxs)("div",{className:"space-y-8",children:[(0,B.jsxs)("section",{children:[(0,B.jsx)(QT,{children:a("memoryStore")}),(0,B.jsx)(bp.Card,{children:(0,B.jsxs)(bp.CardContent,{className:"p-0",children:[(0,B.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 md:divide-x divide-y md:divide-y-0 divide-border/60",children:[(0,B.jsx)(QY,{icon:M,label:a("memories"),value:f.total_nodes}),(0,B.jsx)(QY,{icon:Qm,label:a("documents"),value:f.total_documents}),(0,B.jsx)(QY,{icon:Ql,label:a("links"),value:f.total_links})]}),(0,B.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 md:divide-x divide-y md:divide-y-0 divide-border/60 border-t border-border/60",children:[(0,B.jsx)("div",{className:"p-5",children:(0,B.jsx)(QX,{title:a("memoryComposition"),items:[{name:a("world"),value:f.nodes_by_fact_type?.world||0,color:QK},{name:a("experience"),value:f.nodes_by_fact_type?.experience||0,color:QL},...e?[{name:a("observations"),value:f.total_observations||0,color:QM}]:[]],emptyLabel:a("noMemoriesYet")})}),(0,B.jsx)("div",{className:"p-5",children:(0,B.jsx)(QX,{title:a("linkTypes"),items:[{name:a("temporal"),value:f.links_by_link_type?.temporal||0,color:"#009296"},{name:a("semantic"),value:f.links_by_link_type?.semantic||0,color:"#0074d9"},{name:a("entity"),value:f.links_by_link_type?.entity||0,color:"#f59e0b"}],emptyLabel:a("noLinksYet")})})]})]})})]}),(0,B.jsxs)("section",{children:[(0,B.jsx)(QT,{children:a("consolidation")}),(0,B.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,B.jsx)(Q1,{done:z,pending:f.pending_consolidation,failed:f.failed_consolidation??0,total:f.total_nodes,lastConsolidatedAt:f.last_consolidated_at}),(0,B.jsx)(Q3,{models:h,lastConsolidatedAt:f.last_consolidated_at})]})]}),(0,B.jsxs)("section",{children:[(0,B.jsx)(QT,{children:a("activity")}),(0,B.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:[(0,B.jsxs)(bp.Card,{className:"lg:col-span-2",children:[(0,B.jsxs)(bp.CardHeader,{className:"pb-2 space-y-2",children:[(0,B.jsxs)("div",{className:"flex flex-row items-center justify-between",children:[(0,B.jsx)(bp.CardTitle,{className:"text-sm font-semibold",children:a("memoriesByTimeChartTitle",{field:b[o].short.toLowerCase()})}),(0,B.jsx)("div",{className:"flex items-center gap-0.5 rounded-md bg-muted/60 p-0.5",children:QI.map(a=>(0,B.jsx)("button",{onClick:()=>n(a),className:`px-2 py-0.5 text-[11px] font-medium rounded transition-colors tabular-nums ${l===a?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:a},a))})]}),(0,B.jsx)("div",{className:"flex items-center gap-0.5 rounded-md bg-muted/60 p-0.5 w-fit",children:QJ.map(a=>(0,B.jsx)("button",{onClick:()=>p(a),title:b[a].long,className:`px-2 py-0.5 text-[11px] font-medium rounded transition-colors ${o===a?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:b[a].short},a))}),(0,B.jsxs)("div",{className:"flex items-center justify-between",children:[(0,B.jsx)("div",{className:"flex items-center gap-1.5",children:w.map(a=>{let b=QP[a],c=s[a];return(0,B.jsxs)("button",{onClick:()=>t(b=>({...b,[a]:!b[a]})),className:`flex items-center gap-1.5 px-2 py-0.5 rounded-md text-[11px] font-medium transition-all ${c?"bg-muted text-foreground":"bg-transparent text-muted-foreground/60 hover:text-muted-foreground"}`,children:[(0,B.jsx)("span",{className:"w-2 h-2 rounded-[2px] transition-opacity",style:{backgroundColor:b.color,opacity:c?1:.3}}),A[a]]},a)})}),(0,B.jsxs)("span",{className:"text-xs text-muted-foreground tabular-nums",children:[(0,B.jsx)(QR,{value:y})," ",a("totalSuffix")]})]})]}),(0,B.jsx)(bp.CardContent,{children:0===x.length||0===y?(0,B.jsx)("div",{className:"h-[180px] flex items-center justify-center text-sm text-muted-foreground",children:a("noMemoriesIngestedInPeriod")}):(0,B.jsx)("div",{className:"h-[180px]",children:(0,B.jsx)(f2,{width:"100%",height:"100%",children:(0,B.jsxs)(ue,{data:x,margin:{top:8,right:8,bottom:0,left:-10},children:[(0,B.jsx)("defs",{children:w.map(a=>(0,B.jsxs)("linearGradient",{id:`grad-${a}`,x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,B.jsx)("stop",{offset:"0%",stopColor:QP[a].color,stopOpacity:.35}),(0,B.jsx)("stop",{offset:"100%",stopColor:QP[a].color,stopOpacity:0})]},a))}),(0,B.jsx)(QH,{vertical:!1,stroke:"var(--border)",strokeOpacity:.5,strokeDasharray:"2 4"}),(0,B.jsx)(vc,{dataKey:"label",tick:Q4,axisLine:!1,tickLine:!1,dy:4,minTickGap:20}),(0,B.jsx)(vk,{tick:Q4,axisLine:!1,tickLine:!1,width:40,allowDecimals:!1,tickFormatter:a=>QQ(a)}),(0,B.jsx)(vT,{content:(0,B.jsx)(QS,{}),labelFormatter:(a,b)=>b?.[0]?.payload?.tooltipLabel||"",cursor:{stroke:QO,strokeWidth:1,strokeDasharray:"3 3"}}),w.map(a=>s[a]?(0,B.jsx)(uK,{type:"monotone",dataKey:a,name:A[a],stackId:"a",stroke:QP[a].color,strokeWidth:2,fill:`url(#grad-${a})`,isAnimationActive:!1},a):null)]})})})})]}),(0,B.jsx)(Q0,{byStatus:f.operations_by_status||{}})]})]})]})}var bc=bc;let Q6=(0,K.default)("rotate-ccw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]),Q7=(0,K.default)("code",[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]]),Q8=(0,K.default)("ban",[["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]),Q9=["all","retain","consolidation","refresh_mental_model","file_convert_retain","webhook_delivery","graph_maintenance"],Ra=[null,"pending","processing","completed","failed","cancelled"];function Rb(){let a,b,c,d=(0,E.useTranslations)("bankOperations"),{currentBank:e}=(0,H.useBank)(),[f,g]=(0,C.useState)([]),[h,i]=(0,C.useState)(0),[j,k]=(0,C.useState)(null),[l,n]=(0,C.useState)(null),[o]=(0,C.useState)(10),[p,q]=(0,C.useState)(0),[r,s]=(0,C.useState)(null),[t,u]=(0,C.useState)(null),[v,w]=(0,C.useState)(!1),[x,y]=(0,C.useState)(null),[z,A]=(0,C.useState)(!1),[D,F]=(0,C.useState)(!1),[G,I]=(0,C.useState)(!1),[J,K]=(0,C.useState)(null),[L,M]=(0,C.useState)(()=>Date.now()),N={all:d("status.all"),pending:d("status.pending"),processing:d("status.processing"),completed:d("status.completed"),failed:d("status.failed"),cancelled:d("status.cancelled")},O={all:d("operationType.all"),retain:d("operationType.retain"),consolidation:d("operationType.consolidation"),refresh_mental_model:d("operationType.refreshMentalModel"),file_convert_retain:d("operationType.fileConvertRetain"),webhook_delivery:d("operationType.webhookDelivery"),graph_maintenance:d("operationType.graphMaintenance")},P=a=>a?N[a]??a:d("unknown"),Q=a=>a?O[a]??a:d("notAvailable"),R=(a,b)=>{let c=P(a);return"pending"===a?(0,B.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-amber-500/10 text-amber-600 dark:text-amber-400 border border-amber-500/20",children:[(0,B.jsx)(af,{className:"w-3 h-3"}),c]}):"processing"===a?(0,B.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400 border border-blue-500/20",children:[(0,B.jsx)(bc.default,{className:"w-3 h-3 animate-spin"}),c]}):"failed"===a?(0,B.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-red-500/10 text-red-600 dark:text-red-400 border border-red-500/20",title:b??void 0,children:[(0,B.jsx)(PZ,{className:"w-3 h-3"}),c]}):"completed"===a?(0,B.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border border-emerald-500/20",children:[(0,B.jsx)(ae,{className:"w-3 h-3"}),c]}):"cancelled"===a?(0,B.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-gray-500/10 text-gray-600 dark:text-gray-400 border border-gray-500/20",children:[(0,B.jsx)(Q8,{className:"w-3 h-3"}),c]}):(0,B.jsx)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-muted text-muted-foreground border border-border",children:c})},S=a=>{let b=new Date(a).getTime();if(Number.isNaN(b))return"";let c=Math.max(0,Math.round((L-b)/1e3));return c<5?d("heartbeat.justNow"):c<60?d("heartbeat.secondsAgo",{secs:c}):c<3600?d("heartbeat.minutesAgo",{mins:Math.floor(c/60)}):d("heartbeat.hoursAgo",{hours:Math.floor(c/3600)})},T=(a,b)=>{if(!a)return null;let c=a.stage.replace(/[._]/g," "),e="number"==typeof a.processed&&"number"==typeof a.total&&a.total>0,f=e?Math.min(100,Math.round(a.processed/a.total*100)):null,g=a.at?S(a.at):null;return b?.compact?(0,B.jsxs)("div",{className:"flex items-center gap-1.5 text-[11px] text-muted-foreground whitespace-nowrap",title:`${c}${a.at?` — ${new Date(a.at).toLocaleString()}`:""}`,children:[null!==f&&(0,B.jsx)("span",{className:"h-1 w-14 shrink-0 rounded-full bg-muted overflow-hidden",children:(0,B.jsx)("span",{className:"block h-full rounded-full bg-blue-500/70",style:{width:`${f}%`}})}),e&&(0,B.jsxs)("span",{className:"font-mono",children:[a.processed,"/",a.total]}),g&&(0,B.jsxs)("span",{className:"text-muted-foreground/70",children:["· ",g]})]}):(0,B.jsxs)("div",{className:"mt-1 space-y-1",children:[(0,B.jsxs)("div",{className:"flex items-center gap-1.5 text-[11px] text-muted-foreground",children:[(0,B.jsx)("span",{className:"capitalize",children:c}),e&&(0,B.jsxs)("span",{className:"font-mono",children:[a.processed,"/",a.total]})]}),null!==f&&(0,B.jsx)("div",{className:"h-1 w-24 rounded-full bg-muted overflow-hidden",children:(0,B.jsx)("div",{className:"h-full rounded-full bg-blue-500/70",style:{width:`${f}%`}})}),a.at&&(0,B.jsxs)("div",{className:"flex items-center gap-1 text-[10px] text-muted-foreground/80",title:new Date(a.at).toLocaleString(),children:[(0,B.jsx)(af,{className:"w-2.5 h-2.5"}),(0,B.jsxs)("span",{children:[d("field.lastHeartbeat")," · ",S(a.at)]})]})]})},U=(0,C.useCallback)(async(a=j,b=p,c=l)=>{if(e){w(!0);try{let d=await V.client.listOperations(e,{status:a||void 0,type:c||void 0,limit:o,offset:b,excludeParents:!0});g(d.operations||[]),i(d.total||0),M(Date.now())}catch(a){console.error("Error loading operations:",a)}finally{w(!1)}}},[e,j,p,l,o]),X=a=>{q(a),U(j,a,l)},Y=async a=>{if(e){s(a);try{await V.client.cancelOperation(e,a),await U()}catch(a){}finally{s(null)}}},Z=async a=>{if(e){u(a);try{await V.client.retryOperation(e,a),await U()}catch(a){}finally{u(null)}}},$=async a=>{if(e){F(!0),A(!0),K(null);try{let b=await V.client.getOperationStatus(e,a);y(b)}catch(a){console.error("Error loading operation details:",a),y({error:d("operationDetailsLoadError")})}finally{F(!1)}}},_=async()=>{if(e&&x?.operation_id){I(!0);try{let a=x.operation_id,b=await V.client.getOperationStatus(e,a,{includePayload:!0});y(b),K(a)}catch(a){console.error("Error loading raw payload:",a)}finally{I(!1)}}},aa=f.some(a=>"processing"===a.status);(0,C.useEffect)(()=>{if(e){U(j,p,l);let a=setInterval(()=>U(j,p,l),aa?2e3:5e3);return()=>clearInterval(a)}},[e,j,p,l,aa,U]),(0,C.useEffect)(()=>{if(!aa)return;let a=setInterval(()=>M(Date.now()),1e3);return()=>clearInterval(a)},[aa]);let ab=(0,C.useRef)({}),[ac,ag]=(0,C.useState)(new Set);return((0,C.useEffect)(()=>{let a=ab.current,b=f.filter(b=>a[b.id]&&a[b.id]!==b.status&&("completed"===b.status||"failed"===b.status||"cancelled"===b.status)).map(a=>a.id);if(ab.current=Object.fromEntries(f.map(a=>[a.id,a.status])),0===b.length)return;ag(a=>new Set([...a,...b]));let c=setTimeout(()=>ag(a=>{let c=new Set(a);return b.forEach(a=>c.delete(a)),c}),1200);return()=>clearTimeout(c)},[f]),e)?(0,B.jsxs)("div",{className:"space-y-4",children:[(0,B.jsxs)("div",{className:"flex items-center justify-between",children:[(0,B.jsxs)("div",{children:[(0,B.jsxs)("div",{className:"flex items-center gap-2",children:[(0,B.jsx)("h3",{className:"text-lg font-semibold",children:d("title")}),(0,B.jsx)("button",{onClick:()=>U(),className:"p-1 rounded hover:bg-muted transition-colors",title:d("refreshOperations"),disabled:v,children:(0,B.jsx)(ad,{className:`w-4 h-4 text-muted-foreground hover:text-foreground ${v?"animate-spin":""}`})})]}),(0,B.jsxs)("p",{className:"text-sm text-muted-foreground",children:[d("operationCount",{count:h}),j?` (${P(j)})`:""]})]}),(0,B.jsxs)("div",{className:"flex items-center gap-3",children:[(0,B.jsxs)(a6.Select,{value:l??"all",onValueChange:a=>{var b;n(b="all"===a?null:a),q(0),U(j,0,b)},children:[(0,B.jsx)(a6.SelectTrigger,{className:"h-9 w-[180px] text-sm",children:(0,B.jsx)(a6.SelectValue,{placeholder:d("allTypes")})}),(0,B.jsx)(a6.SelectContent,{children:Q9.map(a=>(0,B.jsx)(a6.SelectItem,{value:a,children:(0,B.jsxs)("div",{children:[(0,B.jsx)("div",{children:O[a]}),"all"!==a&&(0,B.jsx)("div",{className:"text-xs text-muted-foreground font-mono",children:a})]})},a))})]}),(0,B.jsx)("div",{className:"flex gap-1 bg-muted p-1 rounded-lg",children:Ra.map(a=>(0,B.jsx)("button",{onClick:()=>{k(a),q(0),U(a,0,l)},className:`px-3 py-1.5 text-sm font-medium rounded-md transition-colors ${j===a?"bg-background shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:a?P(a):N.all},a??"all"))})]})]}),(0,B.jsx)("div",{children:f.length>0?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)("div",{className:"overflow-x-auto",children:(0,B.jsxs)(ai,{children:[(0,B.jsx)(aj,{children:(0,B.jsxs)(al,{children:[(0,B.jsx)(am,{className:"w-[100px]",children:d("table.id")}),(0,B.jsx)(am,{children:d("table.type")}),(0,B.jsx)(am,{children:d("table.created")}),(0,B.jsx)(am,{children:d("field.updated")}),(0,B.jsx)(am,{className:"w-[300px]",children:d("table.status")}),(0,B.jsx)(am,{className:"w-[110px]",children:d("table.actions")})]})}),(0,B.jsx)(ak,{children:f.map(a=>(0,B.jsxs)(al,{className:`cursor-pointer transition-colors duration-700 hover:bg-muted/50 ${ac.has(a.id)?"completed"===a.status?"bg-emerald-500/15":"bg-red-500/15":"failed"===a.status?"bg-red-500/5":""}`,onClick:()=>$(a.id),children:[(0,B.jsx)(an,{className:"font-mono text-xs text-muted-foreground",children:a.id.substring(0,8)}),(0,B.jsx)(an,{className:"font-medium",title:a.task_type,children:Q(a.task_type)}),(0,B.jsx)(an,{className:"text-sm text-muted-foreground",children:new Date(a.created_at).toLocaleString()}),(0,B.jsx)(an,{className:"text-sm text-muted-foreground",title:a.updated_at?new Date(a.updated_at).toLocaleString():void 0,children:a.updated_at?S(a.updated_at):"—"}),(0,B.jsx)(an,{className:"w-[300px]",children:(0,B.jsxs)("div",{className:"flex items-center gap-2 whitespace-nowrap",children:[R(a.status,a.error_message),"processing"===a.status&&T(a.progress,{compact:!0})]})}),(0,B.jsxs)(an,{className:"w-[110px] whitespace-nowrap",children:["pending"===a.status&&(0,B.jsxs)(W.Button,{variant:"ghost",size:"sm",className:"h-7 text-xs text-muted-foreground hover:text-red-600 dark:hover:text-red-400",onClick:b=>{b.stopPropagation(),Y(a.id)},disabled:r===a.id,children:[r===a.id?(0,B.jsx)(bc.default,{className:"w-3 h-3 animate-spin"}):(0,B.jsx)(bb.X,{className:"w-3 h-3 mr-1"}),r===a.id?"":d("action.cancel")]}),("failed"===a.status||"cancelled"===a.status)&&(0,B.jsxs)(W.Button,{variant:"ghost",size:"sm",className:"h-7 text-xs text-muted-foreground hover:text-blue-600 dark:hover:text-blue-400",onClick:b=>{b.stopPropagation(),Z(a.id)},disabled:t===a.id,children:[t===a.id?(0,B.jsx)(bc.default,{className:"w-3 h-3 animate-spin"}):(0,B.jsx)(Q6,{className:"w-3 h-3 mr-1"}),t===a.id?"":d("action.retry")]})]})]},a.id))})]})}),h>o&&(0,B.jsxs)("div",{className:"flex items-center justify-between mt-4 pt-4 border-t",children:[(0,B.jsx)("p",{className:"text-sm text-muted-foreground",children:d("pagination",{start:p+1,end:Math.min(p+o,h),total:h})}),(0,B.jsxs)("div",{className:"flex gap-2",children:[(0,B.jsx)(W.Button,{variant:"outline",size:"sm",onClick:()=>X(Math.max(0,p-o)),disabled:0===p,children:d("paginationPrevious")}),(0,B.jsx)(W.Button,{variant:"outline",size:"sm",onClick:()=>X(p+o),disabled:p+o>=h,children:d("paginationNext")})]})]})]}):(0,B.jsx)("p",{className:"text-muted-foreground text-center py-8 text-sm",children:j?d("emptyStateWithStatus",{status:P(j)}):d("emptyState")})}),(0,B.jsx)(bf.Dialog,{open:z,onOpenChange:A,children:(0,B.jsxs)(bf.DialogContent,{className:"max-w-3xl max-h-[80vh] overflow-y-auto",children:[(0,B.jsxs)(bf.DialogHeader,{children:[(0,B.jsx)(bf.DialogTitle,{children:d("operationDetails")}),(0,B.jsx)(bf.DialogDescription,{children:x?.operation_id&&(0,B.jsx)("span",{className:"font-mono text-xs",children:x.operation_id})})]}),D?(0,B.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,B.jsx)(bc.default,{className:"w-6 h-6 animate-spin text-muted-foreground"})}):x?(0,B.jsx)("div",{className:"space-y-4",children:x.error?(0,B.jsx)("div",{className:"text-red-600 dark:text-red-400",children:x.error}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,B.jsxs)("div",{children:[(0,B.jsx)("div",{className:"text-sm font-medium text-muted-foreground",children:d("field.status")}),(0,B.jsx)("div",{className:"mt-1",children:R(x.status)})]}),(0,B.jsxs)("div",{children:[(0,B.jsx)("div",{className:"text-sm font-medium text-muted-foreground",children:d("field.type")}),(0,B.jsx)("div",{className:"mt-1 font-mono text-sm",title:x.operation_type??void 0,children:Q(x.operation_type)})]}),(0,B.jsxs)("div",{children:[(0,B.jsx)("div",{className:"text-sm font-medium text-muted-foreground",children:d("field.created")}),(0,B.jsx)("div",{className:"mt-1 text-sm",children:x.created_at?new Date(x.created_at).toLocaleString():d("notAvailable")})]}),(0,B.jsxs)("div",{children:[(0,B.jsx)("div",{className:"text-sm font-medium text-muted-foreground",children:d("field.updated")}),(0,B.jsx)("div",{className:"mt-1 text-sm",children:x.updated_at?new Date(x.updated_at).toLocaleString():d("notAvailable")})]}),x.completed_at&&(0,B.jsxs)("div",{children:[(0,B.jsx)("div",{className:"text-sm font-medium text-muted-foreground",children:d("field.completed")}),(0,B.jsx)("div",{className:"mt-1 text-sm",children:new Date(x.completed_at).toLocaleString()})]}),x.result_metadata?.items_count!==void 0&&(0,B.jsxs)("div",{children:[(0,B.jsx)("div",{className:"text-sm font-medium text-muted-foreground",children:d("totalItems")}),(0,B.jsx)("div",{className:"mt-1 text-sm",children:x.result_metadata.items_count})]})]}),"processing"===x.status&&x.progress&&(0,B.jsxs)("div",{children:[(0,B.jsx)("div",{className:"text-sm font-medium text-muted-foreground mb-1",children:d("field.progress")}),T(x.progress),"consolidation"===x.operation_type&&(0,B.jsx)("p",{className:"mt-1.5 text-[11px] leading-snug text-muted-foreground/70",children:d("progressEstimateNote")})]}),("pending"===x.status||"failed"===x.status||"cancelled"===x.status)&&(0,B.jsxs)("div",{className:"flex gap-2",children:["pending"===x.status&&(0,B.jsxs)(W.Button,{variant:"outline",size:"sm",className:"text-xs",onClick:()=>Y(x.operation_id),disabled:r===x.operation_id,children:[r===x.operation_id?(0,B.jsx)(bc.default,{className:"w-3 h-3 animate-spin mr-1"}):(0,B.jsx)(bb.X,{className:"w-3 h-3 mr-1"}),d("action.cancel")]}),("failed"===x.status||"cancelled"===x.status)&&(0,B.jsxs)(W.Button,{variant:"outline",size:"sm",className:"text-xs",onClick:()=>Z(x.operation_id),disabled:t===x.operation_id,children:[t===x.operation_id?(0,B.jsx)(bc.default,{className:"w-3 h-3 animate-spin mr-1"}):(0,B.jsx)(Q6,{className:"w-3 h-3 mr-1"}),d("action.retry")]})]}),x.result_metadata&&Object.keys(x.result_metadata).length>0&&(0,B.jsxs)("div",{children:[(0,B.jsx)("div",{className:"text-sm font-medium text-muted-foreground mb-2",children:d("metadata")}),(0,B.jsx)("pre",{className:"rounded-lg border bg-muted/30 p-3 text-xs font-mono overflow-x-auto max-h-96 whitespace-pre-wrap break-words",children:JSON.stringify(x.result_metadata,null,2)})]}),x.error_message&&(0,B.jsxs)("div",{className:"rounded-lg border border-red-500/20 bg-red-500/5 p-3",children:[(0,B.jsx)("div",{className:"text-sm font-medium text-red-600 dark:text-red-400 mb-1",children:d("error")}),(0,B.jsx)("div",{className:"text-sm text-red-600/80 dark:text-red-400/80 font-mono",children:x.error_message})]}),x.child_operations&&x.child_operations.length>0&&(0,B.jsxs)("div",{children:[(0,B.jsx)("div",{className:"text-sm font-medium text-muted-foreground mb-2",children:d("subBatchesCount",{count:x.result_metadata?.num_sub_batches||x.child_operations.length})}),(0,B.jsxs)(ai,{children:[(0,B.jsx)(aj,{children:(0,B.jsxs)(al,{children:[(0,B.jsx)(am,{className:"w-[60px]",children:d("table.index")}),(0,B.jsx)(am,{className:"w-[100px]",children:d("table.id")}),(0,B.jsx)(am,{className:"w-[80px]",children:d("table.items")}),(0,B.jsx)(am,{children:d("table.status")})]})}),(0,B.jsx)(ak,{children:x.child_operations.map(a=>(0,B.jsxs)(al,{children:[(0,B.jsx)(an,{className:"text-sm",children:a.sub_batch_index}),(0,B.jsx)(an,{className:"font-mono text-xs text-muted-foreground",children:a.operation_id.substring(0,8)}),(0,B.jsx)(an,{className:"text-sm",children:a.items_count}),(0,B.jsx)(an,{children:R(a.status,a.error_message)})]},a.operation_id))})]})]}),(a=J===x.operation_id,b=!!x.task_payload,c=!!x.result_metadata?.is_parent,(0,B.jsxs)("div",{children:[(0,B.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,B.jsx)("div",{className:"text-sm font-medium text-muted-foreground",children:d("rawPayload")}),!a&&(0,B.jsxs)(W.Button,{variant:"outline",size:"sm",className:"h-7 text-xs",onClick:_,disabled:G,children:[G?(0,B.jsx)(bc.default,{className:"w-3 h-3 mr-1 animate-spin"}):(0,B.jsx)(Q7,{className:"w-3 h-3 mr-1"}),d("loadRaw")]})]}),b?(0,B.jsx)("pre",{className:"rounded-lg border bg-muted/30 p-3 text-xs font-mono overflow-x-auto max-h-96 whitespace-pre-wrap break-words",children:JSON.stringify(x.task_payload,null,2)}):a?(0,B.jsx)("p",{className:"text-xs text-muted-foreground",children:c?d("rawPayloadParentHelp"):d("rawPayloadEmpty")}):(0,B.jsx)("p",{className:"text-xs text-muted-foreground",children:d("rawPayloadHelp")})]}))]})}):null]})})]}):null}var bc=bc;let Rc=(0,K.default)("layout-grid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]);function Rd(){let a=(0,E.useTranslations)("mentalModels"),{currentBank:b}=(0,H.useBank)(),[c,d]=(0,C.useState)([]),[e,f]=(0,C.useState)(!1),[g,h]=(0,C.useState)("files"),[i,j]=(0,C.useState)(""),[k,l]=(0,C.useState)(1),[n,o]=(0,C.useState)(!1),[p,q]=(0,C.useState)(null),[r,s]=(0,C.useState)(null),[t,u]=(0,C.useState)([]),[v,w]=(0,C.useState)("any"),[x,y]=(0,C.useState)(!1),[z,A]=(0,C.useState)(null),[D,G]=(0,C.useState)(null),[I,J]=(0,C.useState)(!1),[K,M]=(0,C.useState)(null),[N,O]=(0,C.useState)(!1),R=c.filter(a=>{if(!i)return!0;let b=i.toLowerCase();return a.id.toLowerCase().includes(b)||a.name.toLowerCase().includes(b)||a.source_query.toLowerCase().includes(b)||a.content.toLowerCase().includes(b)}),S=async()=>{if(b){f(!0);try{let a=await V.client.listMentalModels(b,t.length>0?t:void 0,t.length>0?v:void 0);d(a.items||[])}catch(a){console.error("Error loading mental models:",a)}finally{f(!1)}}},[T,U]=(0,C.useState)(new Set),Y=async c=>{if(!b)return;let e=c.last_refreshed_at;U(a=>new Set(a).add(c.id));try{await V.client.refreshMentalModel(b,c.id);for(let f=0;f<120;f++){await new Promise(a=>setTimeout(a,1e3));let f=await V.client.getMentalModel(b,c.id);if(f.last_refreshed_at!==e){d(a=>a.map(a=>a.id===c.id?f:a)),p?.id===c.id&&q(f),F.toast.success(a("toastRefreshed"));return}}F.toast.error(a("toastRefreshTimeout"))}catch{}finally{U(a=>{let b=new Set(a);return b.delete(c.id),b})}},Z=async()=>{if(b&&D){J(!0);try{await V.client.deleteMentalModel(b,D.id),d(a=>a.filter(a=>a.id!==D.id)),p?.id===D.id&&q(null),G(null)}catch(a){}finally{J(!1)}}},$=async()=>{if(b&&K){O(!0);try{let a=await V.client.clearMentalModel(b,K.id);d(b=>b.map(b=>b.id===a.id?a:b)),p?.id===a.id&&q(a),F.toast.success("Mental model content cleared"),M(null)}catch{}finally{O(!1)}}};if((0,C.useEffect)(()=>{b&&S()},[b,t,v]),(0,C.useEffect)(()=>{let a=a=>{"Escape"===a.key&&q(null)};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[]),(0,C.useEffect)(()=>{l(1)},[i,t,v]),!b)return(0,B.jsx)(bp.Card,{children:(0,B.jsx)(bp.CardContent,{className:"p-10 text-center",children:(0,B.jsx)("p",{className:"text-muted-foreground",children:a("selectBankPrompt")})})});let ab=Math.ceil(R.length/100),ac=(k-1)*100,ae=ac+100,af=R.slice(ac,ae);return(0,B.jsxs)("div",{children:[e?(0,B.jsxs)("div",{className:"text-center py-12",children:[(0,B.jsx)(ad,{className:"w-8 h-8 mx-auto mb-3 text-muted-foreground animate-spin"}),(0,B.jsx)("p",{className:"text-muted-foreground",children:a("loading")})]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)("div",{className:"mb-4 flex items-center gap-3 flex-wrap",children:[(0,B.jsx)(X.Input,{type:"text",value:i,onChange:a=>j(a.target.value),placeholder:a("filterPlaceholder"),className:"w-80 h-9"}),(0,B.jsx)(IG,{value:t,onChange:u,fetchSuggestions:async a=>{if(!b)return[];let c=a?`${a}*`:void 0;return(await V.client.listTags(b,c,20,"mental_models")).items.map(a=>a.tag)},matchMode:v,onMatchModeChange:w,className:"flex-1 min-w-[260px]"}),(0,B.jsxs)(W.Button,{onClick:()=>o(!0),size:"sm",children:[(0,B.jsx)(II.Plus,{className:"w-4 h-4 mr-2"}),a("addMentalModel")]})]}),(0,B.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,B.jsx)("div",{className:"text-sm text-muted-foreground",children:i||t.length>0?a("countFiltered",{filtered:R.length,total:c.length}):a("count",{count:c.length})}),(0,B.jsx)("div",{className:"flex items-center gap-3",children:(0,B.jsxs)("div",{className:"flex items-center gap-2 bg-muted rounded-lg p-1",children:[(0,B.jsxs)("button",{onClick:()=>h("files"),className:`px-3 py-1.5 rounded-md text-sm font-medium transition-all flex items-center gap-1.5 ${"files"===g?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:[(0,B.jsx)(Qm,{className:"w-4 h-4"}),a("viewList")]}),(0,B.jsxs)("button",{onClick:()=>h("dashboard"),className:`px-3 py-1.5 rounded-md text-sm font-medium transition-all flex items-center gap-1.5 ${"dashboard"===g?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:[(0,B.jsx)(Rc,{className:"w-4 h-4"}),a("viewDashboard")]})]})})]}),R.length>0?(0,B.jsxs)(B.Fragment,{children:["dashboard"===g&&(0,B.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:af.map(b=>(0,B.jsx)(bp.Card,{className:`cursor-pointer transition-all hover:shadow-md hover:border-primary/50 ${p?.id===b.id?"border-primary shadow-md":""}`,onClick:()=>q(b),children:(0,B.jsxs)(bp.CardContent,{className:"p-4",children:[(0,B.jsxs)("div",{className:"flex items-start justify-between mb-3",children:[(0,B.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,B.jsx)("h3",{className:"font-semibold text-foreground mb-1 truncate",children:b.name}),(0,B.jsxs)("div",{className:"flex items-center gap-2",children:[(0,B.jsx)("code",{className:"text-xs font-mono text-muted-foreground truncate",children:b.id}),(0,B.jsx)("span",{className:`text-xs px-2 py-0.5 rounded-full font-medium flex-shrink-0 ${b.trigger?.refresh_after_consolidation?"bg-green-500/10 text-green-600 dark:text-green-400":"bg-slate-500/10 text-slate-600 dark:text-slate-400"}`,children:b.trigger?.refresh_after_consolidation?a("badgeAutoRefresh"):a("badgeManual")})]})]}),(0,B.jsx)(Re,{m:b,refreshing:T.has(b.id),onEdit:a=>{A(a),y(!0)},onRefresh:Y,onClear:a=>M({id:a.id,name:a.name}),onDelete:a=>G({id:a.id,name:a.name}),triggerClassName:"h-7 w-7 ml-2 flex-shrink-0"})]}),(0,B.jsx)("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-3",children:b.source_query}),(0,B.jsxs)("div",{className:"relative mb-3 border-t border-border pt-3 max-h-40 overflow-hidden",children:[(0,B.jsx)(Po,{children:b.content}),(0,B.jsx)("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 h-12 bg-gradient-to-t from-card to-transparent"})]}),(0,B.jsxs)("div",{className:"flex items-center justify-between text-xs border-t border-border pt-3",children:[(0,B.jsx)("div",{className:"flex items-center gap-2",children:b.tags.length>0&&(0,B.jsxs)("div",{className:"flex gap-1",children:[b.tags.slice(0,2).map(a=>(0,B.jsx)("span",{className:"px-1.5 py-0.5 rounded text-xs bg-blue-500/10 text-blue-600 dark:text-blue-400",children:a},a)),b.tags.length>2&&(0,B.jsxs)("span",{className:"px-1.5 py-0.5 rounded text-xs bg-muted text-muted-foreground",children:["+",b.tags.length-2]})]})}),(0,B.jsx)("div",{className:"text-muted-foreground",title:Ps(b.last_refreshed_at),children:Pr(b.last_refreshed_at)})]})]})},b.id))}),"files"===g&&(0,B.jsx)(Rh,{mentalModels:R,selectedId:r,onSelect:s,onOpenDetail:q,refreshingIds:T,onEdit:a=>{A(a),y(!0)},onRefresh:Y,onClear:a=>M({id:a.id,name:a.name}),onDelete:a=>G({id:a.id,name:a.name})}),"files"!==g&&ab>1&&(0,B.jsxs)("div",{className:"flex items-center justify-between mt-3 pt-3 border-t",children:[(0,B.jsxs)("div",{className:"text-xs text-muted-foreground",children:[ac+1,"-",Math.min(ae,R.length)," of"," ",R.length]}),(0,B.jsxs)("div",{className:"flex items-center gap-1",children:[(0,B.jsx)(W.Button,{variant:"outline",size:"sm",onClick:()=>l(1),disabled:1===k,className:"h-7 w-7 p-0",children:(0,B.jsx)(_,{className:"h-3 w-3"})}),(0,B.jsx)(W.Button,{variant:"outline",size:"sm",onClick:()=>l(a=>Math.max(1,a-1)),disabled:1===k,className:"h-7 w-7 p-0",children:(0,B.jsx)(P,{className:"h-3 w-3"})}),(0,B.jsxs)("span",{className:"text-xs px-2",children:[k," / ",ab]}),(0,B.jsx)(W.Button,{variant:"outline",size:"sm",onClick:()=>l(a=>Math.min(ab,a+1)),disabled:k===ab,className:"h-7 w-7 p-0",children:(0,B.jsx)(Q.ChevronRight,{className:"h-3 w-3"})}),(0,B.jsx)(W.Button,{variant:"outline",size:"sm",onClick:()=>l(ab),disabled:k===ab,className:"h-7 w-7 p-0",children:(0,B.jsx)(aa,{className:"h-3 w-3"})})]})]})]}):(0,B.jsxs)("div",{className:"p-6 border border-dashed border-border rounded-lg text-center",children:[(0,B.jsx)(L,{className:"w-6 h-6 mx-auto mb-2 text-muted-foreground"}),(0,B.jsx)("p",{className:"text-sm text-muted-foreground",children:i?a("emptyFilterMatch"):a("emptyNoModels")})]})]}),(0,B.jsx)(Rf,{open:n,onClose:()=>o(!1),onCreated:()=>{o(!1),S()}}),(0,B.jsx)(IU,{open:!!D,onOpenChange:a=>!a&&G(null),children:(0,B.jsxs)(I9,{children:[(0,B.jsxs)(Ja,{children:[(0,B.jsx)(Jc,{children:a("deleteDialogTitle")}),(0,B.jsxs)(Jd,{children:[a("deleteDialogDescription",{name:D?.name??""}),(0,B.jsx)("br",{}),(0,B.jsx)("br",{}),(0,B.jsx)("span",{className:"text-destructive font-semibold",children:a("deleteDialogWarning")})]})]}),(0,B.jsxs)(Jb,{className:"flex-row justify-end space-x-2",children:[(0,B.jsx)(Jf,{className:"mt-0",children:a("deleteDialogCancel")}),(0,B.jsxs)(Je,{onClick:Z,disabled:I,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:[I?(0,B.jsx)(bc.default,{className:"w-4 h-4 animate-spin mr-1"}):null,a("deleteDialogConfirm")]})]})]})}),(0,B.jsx)(IU,{open:!!K,onOpenChange:a=>!a&&M(null),children:(0,B.jsxs)(I9,{children:[(0,B.jsxs)(Ja,{children:[(0,B.jsx)(Jc,{children:a("clearDialogTitle")}),(0,B.jsxs)(Jd,{children:[a.rich("clearDialogDescription",{name:K?.name??"",bold:a=>(0,B.jsx)("span",{className:"font-semibold",children:a})}),(0,B.jsx)("br",{}),(0,B.jsx)("br",{}),a("clearDialogReSynth")]})]}),(0,B.jsxs)(Jb,{className:"flex-row justify-end space-x-2",children:[(0,B.jsx)(Jf,{className:"mt-0",children:a("cancelButton")}),(0,B.jsxs)(Je,{onClick:$,disabled:N,children:[N?(0,B.jsx)(bc.default,{className:"w-4 h-4 animate-spin mr-1"}):null,a("clearDialogConfirm")]})]})]})}),(0,B.jsx)(PE,{mentalModelId:p?.id??null,onClose:()=>q(null),onDelete:a=>G({id:a.id,name:a.name}),onClear:a=>M({id:a.id,name:a.name}),onEdit:a=>{A(a),y(!0)},onRefreshed:a=>{d(b=>b.map(b=>b.id===a.id?a:b)),q(a)}}),z&&(0,B.jsx)(Rg,{open:x,mentalModel:z,onClose:()=>{y(!1),A(null)},onUpdated:a=>{d(b=>b.map(b=>b.id===a.id?a:b)),q(a),y(!1),A(null)}})]})}function Re({m:a,refreshing:b,onEdit:c,onRefresh:d,onClear:e,onDelete:f,triggerClassName:g}){let h=(0,E.useTranslations)("mentalModels");return(0,B.jsxs)(IN.DropdownMenu,{children:[(0,B.jsx)(IN.DropdownMenuTrigger,{asChild:!0,children:(0,B.jsx)(W.Button,{variant:"ghost",size:"sm",className:`p-0 text-muted-foreground ${g??"h-8 w-8"}`,onClick:a=>a.stopPropagation(),"aria-label":h("actionsAriaLabel"),children:(0,B.jsx)(Ji,{className:"h-4 w-4"})})}),(0,B.jsxs)(IN.DropdownMenuContent,{align:"end",onClick:a=>a.stopPropagation(),children:[(0,B.jsxs)(IN.DropdownMenuItem,{onClick:()=>c(a),children:[(0,B.jsx)(Jh,{className:"h-4 w-4 mr-2"}),h("actionEdit")]}),(0,B.jsxs)(IN.DropdownMenuItem,{onClick:()=>d(a),disabled:b,children:[(0,B.jsx)(ad,{className:`h-4 w-4 mr-2 ${b?"animate-spin":""}`}),h("actionRefresh")]}),(0,B.jsxs)(IN.DropdownMenuItem,{onClick:()=>e(a),children:[(0,B.jsx)(Kr,{className:"h-4 w-4 mr-2"}),h("actionClearContent")]}),(0,B.jsx)(IN.DropdownMenuSeparator,{}),(0,B.jsxs)(IN.DropdownMenuItem,{onClick:()=>f(a),className:"text-red-600 focus:text-red-600 dark:text-red-400 dark:focus:text-red-400 focus:bg-red-500/10",children:[(0,B.jsx)(Jg,{className:"h-4 w-4 mr-2"}),h("actionDelete")]})]})]})}function Rf({open:a,onClose:b,onCreated:c}){let d=(0,E.useTranslations)("mentalModels"),{currentBank:e}=(0,H.useBank)(),[f,g]=(0,C.useState)(!1),[h,i]=(0,C.useState)({id:"",name:"",sourceQuery:"",maxTokens:"2048",tags:"",autoRefresh:!1,mode:"full",factTypes:[],excludeMentalModels:!1,excludeMentalModelIds:"",tagsMatch:"",tagGroups:"",includeChunks:"",recallMaxTokens:"",recallChunksMaxTokens:""}),j=async()=>{if(e&&h.name.trim()&&h.sourceQuery.trim()){g(!0);try{let a,b=h.tags.split(",").map(a=>a.trim()).filter(a=>a.length>0),f=parseInt(h.maxTokens)||2048,g=h.excludeMentalModelIds.split(",").map(a=>a.trim()).filter(a=>a.length>0);if(h.tagGroups.trim())try{a=JSON.parse(h.tagGroups.trim())}catch{F.toast.error(d("invalidTagGroupsJson"));return}let j=h.recallMaxTokens.trim()?parseInt(h.recallMaxTokens,10):void 0,k=h.recallChunksMaxTokens.trim()?parseInt(h.recallChunksMaxTokens,10):void 0,l="true"===h.includeChunks||"false"!==h.includeChunks&&void 0;await V.client.createMentalModel(e,{id:h.id.trim()||void 0,name:h.name.trim(),source_query:h.sourceQuery.trim(),tags:b.length>0?b:void 0,max_tokens:f,trigger:{mode:h.mode,refresh_after_consolidation:h.autoRefresh,fact_types:h.factTypes.length>0?h.factTypes:void 0,exclude_mental_models:h.excludeMentalModels||void 0,exclude_mental_model_ids:g.length>0?g:void 0,tags_match:h.tagsMatch||void 0,tag_groups:a,include_chunks:l,recall_max_tokens:j,recall_chunks_max_tokens:k}}),i({id:"",name:"",sourceQuery:"",maxTokens:"2048",tags:"",autoRefresh:!1,mode:"full",factTypes:[],excludeMentalModels:!1,excludeMentalModelIds:"",tagsMatch:"",tagGroups:"",includeChunks:"",recallMaxTokens:"",recallChunksMaxTokens:""}),c()}catch(a){}finally{g(!1)}}};return(0,B.jsx)(bf.Dialog,{open:a,onOpenChange:a=>{a||(i({id:"",name:"",sourceQuery:"",maxTokens:"2048",tags:"",autoRefresh:!1,mode:"full",factTypes:[],excludeMentalModels:!1,excludeMentalModelIds:"",tagsMatch:"",tagGroups:"",includeChunks:"",recallMaxTokens:"",recallChunksMaxTokens:""}),b())},children:(0,B.jsxs)(bf.DialogContent,{className:"sm:max-w-2xl max-h-[90vh] flex flex-col",children:[(0,B.jsxs)(bf.DialogHeader,{children:[(0,B.jsx)(bf.DialogTitle,{children:d("createDialogTitle")}),(0,B.jsx)(bf.DialogDescription,{children:d("createDialogDescription")})]}),(0,B.jsxs)(bh.Tabs,{defaultValue:"general",className:"py-2 flex-1 flex flex-col min-h-0 overflow-hidden",children:[(0,B.jsxs)(bh.TabsList,{className:"w-full",children:[(0,B.jsx)(bh.TabsTrigger,{value:"general",className:"flex-1",children:d("tabGeneral")}),(0,B.jsx)(bh.TabsTrigger,{value:"options",className:"flex-1",children:d("tabOptions")})]}),(0,B.jsxs)("div",{className:"flex-1 overflow-y-auto mt-2 px-1.5",children:[(0,B.jsxs)(bh.TabsContent,{value:"general",className:"space-y-4 pt-4",children:[(0,B.jsxs)("div",{className:"space-y-2",children:[(0,B.jsx)("label",{className:"text-sm font-medium text-foreground",children:d("fieldId")}),(0,B.jsx)(X.Input,{value:h.id,onChange:a=>i({...h,id:a.target.value}),placeholder:d("fieldIdPlaceholder")})]}),(0,B.jsxs)("div",{className:"space-y-2",children:[(0,B.jsx)("label",{className:"text-sm font-medium text-foreground",children:d("fieldName")}),(0,B.jsx)(X.Input,{value:h.name,onChange:a=>i({...h,name:a.target.value}),placeholder:d("fieldNamePlaceholder")})]}),(0,B.jsxs)("div",{className:"space-y-2",children:[(0,B.jsx)("label",{className:"text-sm font-medium text-foreground",children:d("fieldSourceQuery")}),(0,B.jsx)(JJ.Textarea,{value:h.sourceQuery,onChange:a=>i({...h,sourceQuery:a.target.value}),placeholder:d("fieldSourceQueryPlaceholder"),className:"min-h-[140px] font-mono text-sm leading-6 whitespace-pre-wrap",spellCheck:!1})]}),(0,B.jsxs)("div",{className:"space-y-2",children:[(0,B.jsx)("label",{className:"text-sm font-medium text-foreground",children:d("fieldMaxTokens")}),(0,B.jsx)(X.Input,{type:"number",value:h.maxTokens,onChange:a=>i({...h,maxTokens:a.target.value}),placeholder:d("fieldMaxTokensPlaceholder"),min:"256",max:"8192"})]})]}),(0,B.jsxs)(bh.TabsContent,{value:"options",className:"space-y-6 pt-4",children:[(0,B.jsxs)("section",{className:"space-y-4",children:[(0,B.jsx)("h3",{className:"text-sm font-semibold text-foreground border-b pb-1",children:d("optionsSectionRefresh")}),(0,B.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,B.jsx)(IM.Checkbox,{id:"auto-refresh",checked:h.autoRefresh,onCheckedChange:a=>i({...h,autoRefresh:!0===a})}),(0,B.jsx)("label",{htmlFor:"auto-refresh",className:"text-sm font-medium text-foreground cursor-pointer",children:d("optionsAutoRefreshLabel")})]}),(0,B.jsxs)("div",{className:"space-y-2",children:[(0,B.jsx)("label",{className:"text-sm font-medium text-foreground",children:d("optionsRefreshModeLabel")}),(0,B.jsxs)(a6.Select,{value:h.mode,onValueChange:a=>i({...h,mode:a}),children:[(0,B.jsx)(a6.SelectTrigger,{children:(0,B.jsx)(a6.SelectValue,{})}),(0,B.jsxs)(a6.SelectContent,{children:[(0,B.jsx)(a6.SelectItem,{value:"full",children:d("optionsRefreshModeFull")}),(0,B.jsx)(a6.SelectItem,{value:"delta",children:d("optionsRefreshModeDelta")})]})]}),(0,B.jsx)("p",{className:"text-xs text-muted-foreground",children:d("optionsRefreshModeDeltaDescription")})]})]}),(0,B.jsxs)("section",{className:"space-y-4",children:[(0,B.jsx)("h3",{className:"text-sm font-semibold text-foreground border-b pb-1",children:d("optionsSectionOtherModels")}),(0,B.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,B.jsx)(IM.Checkbox,{id:"exclude-mental-models",checked:h.excludeMentalModels,onCheckedChange:a=>i({...h,excludeMentalModels:!0===a})}),(0,B.jsx)("label",{htmlFor:"exclude-mental-models",className:"text-sm font-medium text-foreground cursor-pointer",children:d("optionsExcludeAllLabel")})]}),(0,B.jsxs)("div",{className:"space-y-2",children:[(0,B.jsx)("label",{className:"text-sm font-medium text-foreground",children:d("optionsExcludeIdsLabel")}),(0,B.jsx)(X.Input,{value:h.excludeMentalModelIds,onChange:a=>i({...h,excludeMentalModelIds:a.target.value}),placeholder:d("optionsExcludeIdsPlaceholder")})]})]}),(0,B.jsxs)("section",{className:"space-y-4",children:[(0,B.jsx)("h3",{className:"text-sm font-semibold text-foreground border-b pb-1",children:d("optionsSectionTags")}),(0,B.jsxs)("div",{className:"space-y-2",children:[(0,B.jsx)("label",{className:"text-sm font-medium text-foreground",children:d("optionsTagsLabel")}),(0,B.jsx)(X.Input,{value:h.tags,onChange:a=>i({...h,tags:a.target.value}),placeholder:d("optionsTagsPlaceholder")}),(0,B.jsx)("p",{className:"text-xs text-muted-foreground",children:d("optionsTagsDescription")})]}),(0,B.jsxs)("div",{className:"space-y-2",children:[(0,B.jsx)("label",{className:"text-sm font-medium text-foreground",children:d("optionsTagsMatchLabel")}),(0,B.jsxs)(a6.Select,{value:h.tagsMatch,onValueChange:a=>i({...h,tagsMatch:"default"===a?"":a}),children:[(0,B.jsx)(a6.SelectTrigger,{children:(0,B.jsx)(a6.SelectValue,{placeholder:d("optionsTagsMatchDefaultPlaceholder")})}),(0,B.jsxs)(a6.SelectContent,{children:[(0,B.jsx)(a6.SelectItem,{value:"default",children:d("optionsTagsMatchDefault")}),(0,B.jsx)(a6.SelectItem,{value:"any",children:d("optionsTagsMatchAny")}),(0,B.jsx)(a6.SelectItem,{value:"all",children:d("optionsTagsMatchAll")}),(0,B.jsx)(a6.SelectItem,{value:"any_strict",children:d("optionsTagsMatchAnyStrict")}),(0,B.jsx)(a6.SelectItem,{value:"all_strict",children:d("optionsTagsMatchAllStrict")})]})]}),(0,B.jsx)("p",{className:"text-xs text-muted-foreground",children:d("optionsTagsMatchDescription")})]}),(0,B.jsxs)("div",{className:"space-y-2",children:[(0,B.jsx)("label",{className:"text-sm font-medium text-foreground",children:d("optionsTagGroupsLabel")}),(0,B.jsx)(JJ.Textarea,{value:h.tagGroups,onChange:a=>i({...h,tagGroups:a.target.value}),placeholder:'e.g., [{"or": [{"tags": ["user:alice"], "match": "all_strict"}, {"tags": ["shared"]}]}]',rows:3,className:"font-mono text-xs"}),(0,B.jsx)("p",{className:"text-xs text-muted-foreground",children:d("optionsTagGroupsDescription")})]})]}),(0,B.jsxs)("section",{className:"space-y-4",children:[(0,B.jsx)("h3",{className:"text-sm font-semibold text-foreground border-b pb-1",children:d("optionsSectionRecall")}),(0,B.jsx)("p",{className:"text-xs text-muted-foreground",children:d("optionsRecallDescription")}),(0,B.jsxs)("div",{className:"space-y-3",children:[(0,B.jsx)("label",{className:"text-sm font-medium text-foreground",children:d("optionsFactTypesLabel")}),(0,B.jsx)(JD,{value:h.factTypes,onChange:a=>i({...h,factTypes:a})}),(0,B.jsx)("p",{className:"text-xs text-muted-foreground",children:d("optionsFactTypesEmpty")})]}),(0,B.jsxs)("div",{className:"space-y-2",children:[(0,B.jsx)("label",{className:"text-sm font-medium text-foreground",children:d("optionsIncludeChunksLabel")}),(0,B.jsxs)(a6.Select,{value:h.includeChunks||"default",onValueChange:a=>i({...h,includeChunks:"default"===a?"":a}),children:[(0,B.jsx)(a6.SelectTrigger,{children:(0,B.jsx)(a6.SelectValue,{})}),(0,B.jsxs)(a6.SelectContent,{children:[(0,B.jsx)(a6.SelectItem,{value:"default",children:d("optionsIncludeChunksDefault")}),(0,B.jsx)(a6.SelectItem,{value:"true",children:d("optionsIncludeChunksYes")}),(0,B.jsx)(a6.SelectItem,{value:"false",children:d("optionsIncludeChunksNo")})]})]})]}),(0,B.jsxs)("div",{className:"space-y-2",children:[(0,B.jsx)("label",{className:"text-sm font-medium text-foreground",children:d("optionsRecallMaxTokensLabel")}),(0,B.jsx)(X.Input,{type:"number",value:h.recallMaxTokens,onChange:a=>i({...h,recallMaxTokens:a.target.value}),placeholder:d("optionsRecallMaxTokensPlaceholder"),min:"0"}),(0,B.jsx)("p",{className:"text-xs text-muted-foreground",children:d("optionsRecallMaxTokensDescription")})]}),(0,B.jsxs)("div",{className:"space-y-2",children:[(0,B.jsx)("label",{className:"text-sm font-medium text-foreground",children:d("optionsRecallChunksMaxTokensLabel")}),(0,B.jsx)(X.Input,{type:"number",value:h.recallChunksMaxTokens,onChange:a=>i({...h,recallChunksMaxTokens:a.target.value}),placeholder:d("optionsRecallChunksMaxTokensPlaceholder"),min:"0"}),(0,B.jsx)("p",{className:"text-xs text-muted-foreground",children:d("optionsRecallChunksMaxTokensDescription")})]})]})]})]})]}),(0,B.jsxs)(bf.DialogFooter,{children:[(0,B.jsx)(W.Button,{variant:"outline",onClick:b,disabled:f,children:d("cancelButton")}),(0,B.jsx)(W.Button,{onClick:j,disabled:f||!h.name.trim()||!h.sourceQuery.trim(),children:f?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(bc.default,{className:"w-4 h-4 animate-spin mr-1"}),d("creatingButton")]}):d("createButton")})]})]})})}function Rg({open:a,mentalModel:b,onClose:c,onUpdated:d}){let e=(0,E.useTranslations)("mentalModels"),{currentBank:f}=(0,H.useBank)(),[g,h]=(0,C.useState)(!1),i=()=>({name:b.name,sourceQuery:b.source_query,maxTokens:String(b.max_tokens||2048),tags:b.tags.join(", "),autoRefresh:b.trigger?.refresh_after_consolidation||!1,mode:b.trigger?.mode||"full",factTypes:b.trigger?.fact_types||[],excludeMentalModels:b.trigger?.exclude_mental_models||!1,excludeMentalModelIds:(b.trigger?.exclude_mental_model_ids||[]).join(", "),tagsMatch:b.trigger?.tags_match||"",tagGroups:b.trigger?.tag_groups?JSON.stringify(b.trigger.tag_groups,null,2):"",includeChunks:b.trigger?.include_chunks===!0?"true":b.trigger?.include_chunks===!1?"false":"",recallMaxTokens:b.trigger?.recall_max_tokens!=null?String(b.trigger.recall_max_tokens):"",recallChunksMaxTokens:b.trigger?.recall_chunks_max_tokens!=null?String(b.trigger.recall_chunks_max_tokens):""}),[j,k]=(0,C.useState)(i);(0,C.useEffect)(()=>{a&&k(i())},[a,b]);let l=async()=>{if(f&&j.name.trim()&&j.sourceQuery.trim()){h(!0);try{let a,g=j.tags.split(",").map(a=>a.trim()).filter(a=>a.length>0),h=parseInt(j.maxTokens)||2048,i=j.excludeMentalModelIds.split(",").map(a=>a.trim()).filter(a=>a.length>0);if(j.tagGroups.trim())try{a=JSON.parse(j.tagGroups.trim())}catch{F.toast.error(e("invalidTagGroupsJson"));return}let k=j.recallMaxTokens.trim()?parseInt(j.recallMaxTokens,10):void 0,l=j.recallChunksMaxTokens.trim()?parseInt(j.recallChunksMaxTokens,10):void 0,n="true"===j.includeChunks||"false"!==j.includeChunks&&void 0,o=await V.client.updateMentalModel(f,b.id,{name:j.name.trim(),source_query:j.sourceQuery.trim(),tags:g.length>0?g:void 0,max_tokens:h,trigger:{mode:j.mode,refresh_after_consolidation:j.autoRefresh,fact_types:j.factTypes.length>0?j.factTypes:void 0,exclude_mental_models:j.excludeMentalModels||void 0,exclude_mental_model_ids:i.length>0?i:void 0,tags_match:j.tagsMatch||void 0,tag_groups:a,include_chunks:n,recall_max_tokens:k,recall_chunks_max_tokens:l}});d(o),c()}catch(a){}finally{h(!1)}}};return(0,B.jsx)(bf.Dialog,{open:a,onOpenChange:a=>!a&&c(),children:(0,B.jsxs)(bf.DialogContent,{className:"sm:max-w-2xl max-h-[90vh] flex flex-col",children:[(0,B.jsxs)(bf.DialogHeader,{children:[(0,B.jsx)(bf.DialogTitle,{children:e("updateDialogTitle")}),(0,B.jsx)(bf.DialogDescription,{children:e("updateDialogDescription")})]}),(0,B.jsxs)(bh.Tabs,{defaultValue:"general",className:"py-2 flex-1 flex flex-col min-h-0 overflow-hidden",children:[(0,B.jsxs)(bh.TabsList,{className:"w-full",children:[(0,B.jsx)(bh.TabsTrigger,{value:"general",className:"flex-1",children:e("tabGeneral")}),(0,B.jsx)(bh.TabsTrigger,{value:"options",className:"flex-1",children:e("tabOptions")})]}),(0,B.jsxs)("div",{className:"flex-1 overflow-y-auto mt-2 px-1.5",children:[(0,B.jsxs)(bh.TabsContent,{value:"general",className:"space-y-4 pt-4",children:[(0,B.jsxs)("div",{className:"space-y-2",children:[(0,B.jsx)("label",{className:"text-sm font-medium text-muted-foreground",children:e("fieldId")}),(0,B.jsx)(X.Input,{value:b.id,disabled:!0,className:"bg-muted"})]}),(0,B.jsxs)("div",{className:"space-y-2",children:[(0,B.jsx)("label",{className:"text-sm font-medium text-foreground",children:e("fieldName")}),(0,B.jsx)(X.Input,{value:j.name,onChange:a=>k({...j,name:a.target.value}),placeholder:e("fieldNamePlaceholder")})]}),(0,B.jsxs)("div",{className:"space-y-2",children:[(0,B.jsx)("label",{className:"text-sm font-medium text-foreground",children:e("fieldSourceQuery")}),(0,B.jsx)(JJ.Textarea,{value:j.sourceQuery,onChange:a=>k({...j,sourceQuery:a.target.value}),placeholder:e("fieldSourceQueryPlaceholder"),className:"min-h-[140px] font-mono text-sm leading-6 whitespace-pre-wrap",spellCheck:!1})]}),(0,B.jsxs)("div",{className:"space-y-2",children:[(0,B.jsx)("label",{className:"text-sm font-medium text-foreground",children:e("fieldMaxTokens")}),(0,B.jsx)(X.Input,{type:"number",value:j.maxTokens,onChange:a=>k({...j,maxTokens:a.target.value}),placeholder:e("fieldMaxTokensPlaceholder"),min:"256",max:"8192"})]})]}),(0,B.jsxs)(bh.TabsContent,{value:"options",className:"space-y-6 pt-4",children:[(0,B.jsxs)("section",{className:"space-y-4",children:[(0,B.jsx)("h3",{className:"text-sm font-semibold text-foreground border-b pb-1",children:e("optionsSectionRefresh")}),(0,B.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,B.jsx)(IM.Checkbox,{id:"update-auto-refresh",checked:j.autoRefresh,onCheckedChange:a=>k({...j,autoRefresh:!0===a})}),(0,B.jsx)("label",{htmlFor:"update-auto-refresh",className:"text-sm font-medium text-foreground cursor-pointer",children:e("optionsAutoRefreshLabel")})]}),(0,B.jsxs)("div",{className:"space-y-2",children:[(0,B.jsx)("label",{className:"text-sm font-medium text-foreground",children:e("optionsRefreshModeLabel")}),(0,B.jsxs)(a6.Select,{value:j.mode,onValueChange:a=>k({...j,mode:a}),children:[(0,B.jsx)(a6.SelectTrigger,{children:(0,B.jsx)(a6.SelectValue,{})}),(0,B.jsxs)(a6.SelectContent,{children:[(0,B.jsx)(a6.SelectItem,{value:"full",children:e("optionsRefreshModeFull")}),(0,B.jsx)(a6.SelectItem,{value:"delta",children:e("optionsRefreshModeDelta")})]})]}),(0,B.jsx)("p",{className:"text-xs text-muted-foreground",children:e("optionsRefreshModeDeltaDescription")})]})]}),(0,B.jsxs)("section",{className:"space-y-4",children:[(0,B.jsx)("h3",{className:"text-sm font-semibold text-foreground border-b pb-1",children:e("optionsSectionOtherModels")}),(0,B.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,B.jsx)(IM.Checkbox,{id:"update-exclude-mental-models",checked:j.excludeMentalModels,onCheckedChange:a=>k({...j,excludeMentalModels:!0===a})}),(0,B.jsx)("label",{htmlFor:"update-exclude-mental-models",className:"text-sm font-medium text-foreground cursor-pointer",children:e("optionsExcludeAllLabel")})]}),(0,B.jsxs)("div",{className:"space-y-2",children:[(0,B.jsx)("label",{className:"text-sm font-medium text-foreground",children:e("optionsExcludeIdsLabel")}),(0,B.jsx)(X.Input,{value:j.excludeMentalModelIds,onChange:a=>k({...j,excludeMentalModelIds:a.target.value}),placeholder:e("optionsExcludeIdsPlaceholder")})]})]}),(0,B.jsxs)("section",{className:"space-y-4",children:[(0,B.jsx)("h3",{className:"text-sm font-semibold text-foreground border-b pb-1",children:e("optionsSectionTags")}),(0,B.jsxs)("div",{className:"space-y-2",children:[(0,B.jsx)("label",{className:"text-sm font-medium text-foreground",children:e("optionsTagsLabel")}),(0,B.jsx)(X.Input,{value:j.tags,onChange:a=>k({...j,tags:a.target.value}),placeholder:e("optionsTagsPlaceholder")}),(0,B.jsx)("p",{className:"text-xs text-muted-foreground",children:e("optionsTagsDescription")})]}),(0,B.jsxs)("div",{className:"space-y-2",children:[(0,B.jsx)("label",{className:"text-sm font-medium text-foreground",children:e("optionsTagsMatchLabel")}),(0,B.jsxs)(a6.Select,{value:j.tagsMatch||"default",onValueChange:a=>k({...j,tagsMatch:"default"===a?"":a}),children:[(0,B.jsx)(a6.SelectTrigger,{children:(0,B.jsx)(a6.SelectValue,{placeholder:e("optionsTagsMatchDefaultPlaceholder")})}),(0,B.jsxs)(a6.SelectContent,{children:[(0,B.jsx)(a6.SelectItem,{value:"default",children:e("optionsTagsMatchDefault")}),(0,B.jsx)(a6.SelectItem,{value:"any",children:e("optionsTagsMatchAny")}),(0,B.jsx)(a6.SelectItem,{value:"all",children:e("optionsTagsMatchAll")}),(0,B.jsx)(a6.SelectItem,{value:"any_strict",children:e("optionsTagsMatchAnyStrict")}),(0,B.jsx)(a6.SelectItem,{value:"all_strict",children:e("optionsTagsMatchAllStrict")})]})]}),(0,B.jsx)("p",{className:"text-xs text-muted-foreground",children:e("optionsTagsMatchDescription")})]}),(0,B.jsxs)("div",{className:"space-y-2",children:[(0,B.jsx)("label",{className:"text-sm font-medium text-foreground",children:e("optionsTagGroupsLabel")}),(0,B.jsx)(JJ.Textarea,{value:j.tagGroups,onChange:a=>k({...j,tagGroups:a.target.value}),placeholder:'e.g., [{"or": [{"tags": ["user:alice"], "match": "all_strict"}, {"tags": ["shared"]}]}]',rows:3,className:"font-mono text-xs"}),(0,B.jsx)("p",{className:"text-xs text-muted-foreground",children:e("optionsTagGroupsDescription")})]})]}),(0,B.jsxs)("section",{className:"space-y-4",children:[(0,B.jsx)("h3",{className:"text-sm font-semibold text-foreground border-b pb-1",children:e("optionsSectionRecall")}),(0,B.jsx)("p",{className:"text-xs text-muted-foreground",children:e("optionsRecallDescription")}),(0,B.jsxs)("div",{className:"space-y-3",children:[(0,B.jsx)("label",{className:"text-sm font-medium text-foreground",children:e("optionsFactTypesLabel")}),(0,B.jsx)(JD,{value:j.factTypes,onChange:a=>k({...j,factTypes:a})}),(0,B.jsx)("p",{className:"text-xs text-muted-foreground",children:e("optionsFactTypesEmpty")})]}),(0,B.jsxs)("div",{className:"space-y-2",children:[(0,B.jsx)("label",{className:"text-sm font-medium text-foreground",children:e("optionsIncludeChunksLabel")}),(0,B.jsxs)(a6.Select,{value:j.includeChunks||"default",onValueChange:a=>k({...j,includeChunks:"default"===a?"":a}),children:[(0,B.jsx)(a6.SelectTrigger,{children:(0,B.jsx)(a6.SelectValue,{})}),(0,B.jsxs)(a6.SelectContent,{children:[(0,B.jsx)(a6.SelectItem,{value:"default",children:e("optionsIncludeChunksDefault")}),(0,B.jsx)(a6.SelectItem,{value:"true",children:e("optionsIncludeChunksYes")}),(0,B.jsx)(a6.SelectItem,{value:"false",children:e("optionsIncludeChunksNo")})]})]})]}),(0,B.jsxs)("div",{className:"space-y-2",children:[(0,B.jsx)("label",{className:"text-sm font-medium text-foreground",children:e("optionsRecallMaxTokensLabel")}),(0,B.jsx)(X.Input,{type:"number",value:j.recallMaxTokens,onChange:a=>k({...j,recallMaxTokens:a.target.value}),placeholder:e("optionsRecallMaxTokensPlaceholder"),min:"0"}),(0,B.jsx)("p",{className:"text-xs text-muted-foreground",children:e("optionsRecallMaxTokensDescription")})]}),(0,B.jsxs)("div",{className:"space-y-2",children:[(0,B.jsx)("label",{className:"text-sm font-medium text-foreground",children:e("optionsRecallChunksMaxTokensLabel")}),(0,B.jsx)(X.Input,{type:"number",value:j.recallChunksMaxTokens,onChange:a=>k({...j,recallChunksMaxTokens:a.target.value}),placeholder:e("optionsRecallChunksMaxTokensPlaceholder"),min:"0"}),(0,B.jsx)("p",{className:"text-xs text-muted-foreground",children:e("optionsRecallChunksMaxTokensDescription")})]})]})]})]})]}),(0,B.jsxs)(bf.DialogFooter,{children:[(0,B.jsx)(W.Button,{variant:"outline",onClick:c,disabled:g,children:e("cancelButton")}),(0,B.jsx)(W.Button,{onClick:l,disabled:g||!j.name.trim()||!j.sourceQuery.trim(),children:g?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(bc.default,{className:"w-4 h-4 animate-spin mr-1"}),e("updatingButton")]}):e("updateButton")})]})]})})}function Rh({mentalModels:a,selectedId:b,onSelect:c,onOpenDetail:d,refreshingIds:e,onEdit:f,onRefresh:g,onClear:h,onDelete:i}){let j=(0,E.useTranslations)("mentalModels"),k=b&&a.some(a=>a.id===b)?b:a[0]?.id??null,l=a.find(a=>a.id===k)??null;return(0,B.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-[320px_1fr] gap-0 overflow-hidden min-h-[600px]",children:[(0,B.jsx)("aside",{className:"border-r border-border bg-muted/30 overflow-y-auto max-h-[calc(100vh-260px)]",children:(0,B.jsx)("ul",{className:"py-1",children:a.map(a=>{let b=a.id===k;return(0,B.jsx)("li",{children:(0,B.jsxs)("button",{onClick:()=>c(a.id),className:`w-full flex items-start gap-2 px-3 py-2 text-left transition-colors border-l-2 ${b?"bg-primary/10 border-primary text-foreground":"border-transparent text-muted-foreground hover:bg-muted hover:text-foreground"}`,title:`${a.name}
|
|
9
|
+
${a.source_query}`,children:[(0,B.jsx)(N.FileText,{className:"w-3.5 h-3.5 flex-shrink-0 mt-0.5"}),(0,B.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,B.jsxs)("div",{className:"flex items-center gap-2",children:[(0,B.jsx)("span",{className:`truncate text-sm font-medium ${b?"text-foreground":""}`,children:a.name}),(0,B.jsx)("span",{className:"ml-auto text-[10px] text-muted-foreground flex-shrink-0",title:Ps(a.last_refreshed_at),children:Pr(a.last_refreshed_at)})]}),a.source_query&&(0,B.jsx)("div",{className:"text-xs text-muted-foreground/80 truncate italic mt-0.5",children:a.source_query})]})]})},a.id)})})}),(0,B.jsx)("section",{className:"overflow-y-auto max-h-[calc(100vh-260px)]",children:l?(0,B.jsxs)("article",{className:"p-6",children:[(0,B.jsx)("header",{className:"mb-4 pb-4 border-b border-border",children:(0,B.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,B.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,B.jsx)("h2",{className:"text-xl font-semibold text-foreground",children:l.name}),l.source_query&&(0,B.jsxs)("p",{className:"text-sm text-muted-foreground mt-1 italic",children:["“",l.source_query,"”"]}),(0,B.jsxs)("div",{className:"flex items-center gap-3 mt-2 text-xs text-muted-foreground",children:[(0,B.jsxs)("span",{title:Ps(l.last_refreshed_at),children:["Refreshed ",Pr(l.last_refreshed_at)]}),l.tags.length>0&&(0,B.jsx)("div",{className:"flex gap-1",children:l.tags.map(a=>(0,B.jsx)("span",{className:"px-1.5 py-0.5 rounded text-xs bg-blue-500/10 text-blue-600 dark:text-blue-400",children:a},a))})]})]}),(0,B.jsxs)("div",{className:"flex items-center gap-1 flex-shrink-0",children:[(0,B.jsx)(W.Button,{variant:"outline",size:"sm",onClick:()=>d(l),children:"Open"}),(0,B.jsx)(Re,{m:l,refreshing:e.has(l.id),onEdit:f,onRefresh:g,onClear:h,onDelete:i})]})]})}),l.content?(0,B.jsx)("div",{className:"prose prose-sm dark:prose-invert max-w-none",children:(0,B.jsx)(Po,{children:l.content})}):(0,B.jsx)("p",{className:"text-sm text-muted-foreground italic",children:j("emptyContent")})]}):(0,B.jsxs)("div",{className:"p-10 text-center text-muted-foreground",children:[(0,B.jsx)(N.FileText,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),(0,B.jsx)("p",{className:"text-sm",children:j("selectModelPrompt")})]})})]})}let Ri=(0,K.default)("eye-off",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);var bc=bc;let Rj=["consolidation.completed","retain.completed"],Rk={url:"",secret:"",event_types:["consolidation.completed"],enabled:!0,http_config:{method:"POST",timeout_seconds:30,headers:[],params:[]}};function Rl(a){return Object.fromEntries(a.filter(a=>a.key.trim()).map(a=>[a.key,a.value]))}function Rm(a){return{method:a.method,timeout_seconds:a.timeout_seconds,headers:Rl(a.headers),params:Rl(a.params)}}function Rn({label:a,pairs:b,onChange:c}){let d=(0,E.useTranslations)("webhooksView"),e=(a,d,e)=>{c(b.map((b,c)=>c===a?{...b,[d]:e}:b))};return(0,B.jsxs)("div",{className:"space-y-2",children:[(0,B.jsxs)("div",{className:"flex items-center justify-between",children:[(0,B.jsx)(au,{children:a}),(0,B.jsxs)(W.Button,{type:"button",variant:"ghost",size:"sm",className:"h-6 text-xs px-2",onClick:()=>c([...b,{key:"",value:""}]),children:[(0,B.jsx)(II.Plus,{className:"w-3 h-3 mr-1"}),d("kvAdd")]})]}),b.length>0&&(0,B.jsx)("div",{className:"space-y-1.5",children:b.map((a,f)=>(0,B.jsxs)("div",{className:"flex items-center gap-2",children:[(0,B.jsx)(X.Input,{placeholder:d("kvKeyPlaceholder"),value:a.key,onChange:a=>e(f,"key",a.target.value),className:"h-8 text-sm flex-1"}),(0,B.jsx)(X.Input,{placeholder:d("kvValuePlaceholder"),value:a.value,onChange:a=>e(f,"value",a.target.value),className:"h-8 text-sm flex-1"}),(0,B.jsx)("button",{type:"button",onClick:()=>c(b.filter((a,b)=>b!==f)),className:"text-muted-foreground hover:text-foreground shrink-0","aria-label":d("kvRemovePair"),children:(0,B.jsx)(bb.X,{className:"w-4 h-4"})})]},f))})]})}function Ro({status:a}){let b=(0,E.useTranslations)("webhooksView");return"completed"===a?(0,B.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border border-emerald-500/20",children:[(0,B.jsx)(ae,{className:"w-3 h-3"}),b("deliveryStatusDelivered")]}):"pending"===a?(0,B.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-amber-500/10 text-amber-600 dark:text-amber-400 border border-amber-500/20",children:[(0,B.jsx)(af,{className:"w-3 h-3"}),b("deliveryStatusPending")]}):"failed"===a?(0,B.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-red-500/10 text-red-600 dark:text-red-400 border border-red-500/20",children:[(0,B.jsx)(PZ,{className:"w-3 h-3"}),b("deliveryStatusFailed")]}):(0,B.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-muted text-muted-foreground border border-border",children:a})}function Rp({delivery:a,formatDate:b}){let c=(0,E.useTranslations)("webhooksView"),[d,e]=(0,C.useState)(!1),f=a.last_response_body||a.last_error;return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(al,{className:f?"cursor-pointer hover:bg-muted/40":void 0,onClick:()=>f&&e(a=>!a),children:[(0,B.jsx)(an,{className:"w-8 pl-3 pr-0",children:f?d?(0,B.jsx)(Jj.ChevronDown,{className:"w-4 h-4 text-muted-foreground"}):(0,B.jsx)(Q.ChevronRight,{className:"w-4 h-4 text-muted-foreground"}):(0,B.jsx)("span",{className:"w-4 h-4 inline-block"})}),(0,B.jsx)(an,{children:(0,B.jsx)(Ro,{status:a.status})}),(0,B.jsx)(an,{children:null!=a.last_response_status?(0,B.jsx)("span",{className:`font-mono text-xs px-1.5 py-0.5 rounded border ${a.last_response_status>=200&&a.last_response_status<300?"bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border-emerald-500/20":"bg-red-500/10 text-red-600 dark:text-red-400 border-red-500/20"}`,children:a.last_response_status}):(0,B.jsx)("span",{className:"text-muted-foreground text-xs",children:"—"})}),(0,B.jsx)(an,{className:"text-center text-sm",children:a.attempts}),(0,B.jsx)(an,{className:"font-mono text-xs text-muted-foreground",children:a.event_type}),(0,B.jsx)(an,{className:"text-xs text-muted-foreground whitespace-nowrap",children:b(a.created_at)})]}),d&&f&&(0,B.jsx)(al,{className:"bg-muted/20 hover:bg-muted/20",children:(0,B.jsx)(an,{colSpan:6,className:"px-4 py-3",children:(0,B.jsxs)("div",{className:"space-y-3",children:[a.last_error&&(0,B.jsxs)("div",{className:"space-y-1",children:[(0,B.jsx)("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:c("expandedError")}),(0,B.jsx)("p",{className:"font-mono text-xs text-red-600 dark:text-red-400 break-all",children:a.last_error})]}),a.last_response_body&&(0,B.jsxs)("div",{className:"space-y-1",children:[(0,B.jsxs)("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:[c("expandedResponseBody"),a.last_attempt_at&&(0,B.jsxs)("span",{className:"ml-2 normal-case font-normal",children:["· ",b(a.last_attempt_at)]})]}),(0,B.jsx)("pre",{className:"font-mono text-xs bg-background rounded p-2 overflow-x-auto whitespace-pre-wrap break-all max-h-40 overflow-y-auto border border-border",children:a.last_response_body})]})]})})})]})}function Rq(){let a=(0,E.useTranslations)("webhooksView"),{currentBank:b}=(0,H.useBank)(),[c,d]=(0,C.useState)([]),[e,f]=(0,C.useState)(!1),[g,h]=(0,C.useState)(!1),[i,j]=(0,C.useState)(!1),[k,l]=(0,C.useState)(null),[n,o]=(0,C.useState)(null),[p,q]=(0,C.useState)(!1),[r,s]=(0,C.useState)(Rk),[t,u]=(0,C.useState)(!1),[v,w]=(0,C.useState)(null),[x,y]=(0,C.useState)(Rk),[z,A]=(0,C.useState)(!1),[D,F]=(0,C.useState)(!1),[G,I]=(0,C.useState)(!1),[J,K]=(0,C.useState)(!1),[L,M]=(0,C.useState)(null),[N,O]=(0,C.useState)([]),[P,Q]=(0,C.useState)(!1),[R,S]=(0,C.useState)(null),[T,U]=(0,C.useState)(!1),Y=async()=>{if(b){f(!0);try{let a=await V.client.listWebhooks(b);d(a.items||[])}catch(a){console.error("Error loading webhooks:",a)}finally{f(!1)}}};(0,C.useEffect)(()=>{b&&Y()},[b]);let Z=async()=>{if(b&&r.url){j(!0);try{await V.client.createWebhook(b,{url:r.url,secret:r.secret||void 0,event_types:r.event_types.length>0?r.event_types:void 0,enabled:r.enabled,http_config:Rm(r.http_config)}),h(!1),s(Rk),q(!1),await Y()}catch(a){}finally{j(!1)}}},$=async a=>{if(b){l(a),o(null);try{await V.client.deleteWebhook(b,a),await Y()}catch(a){}finally{l(null)}}},_=async()=>{if(b&&v&&x.url){I(!0);try{let a={url:x.url,event_types:x.event_types,enabled:x.enabled,http_config:Rm(x.http_config)};D?a.secret=null:x.secret&&(a.secret=x.secret),await V.client.updateWebhook(b,v.id,a),u(!1),await Y()}catch{}finally{I(!1)}}},aa=async a=>{if(b){M(a),K(!0),O([]),S(null),Q(!0);try{let c=await V.client.listWebhookDeliveries(b,a.id,50);O(c.items||[]),S(c.next_cursor??null)}catch(a){console.error("Error loading deliveries:",a)}finally{Q(!1)}}},ab=async()=>{if(b&&L&&R){U(!0);try{let a=await V.client.listWebhookDeliveries(b,L.id,50,R);O(b=>[...b,...a.items||[]]),S(a.next_cursor??null)}catch(a){console.error("Error loading more deliveries:",a)}finally{U(!1)}}},af=b=>b?new Date(b).toLocaleString():a("formatDateNA");return b?(0,B.jsxs)("div",{className:"space-y-4",children:[(0,B.jsxs)("div",{className:"flex items-center justify-between",children:[(0,B.jsxs)("div",{children:[(0,B.jsxs)("div",{className:"flex items-center gap-2",children:[(0,B.jsx)("h3",{className:"text-lg font-semibold",children:a("title")}),(0,B.jsx)("button",{onClick:()=>Y(),className:"p-1 rounded hover:bg-muted transition-colors",title:a("refreshTitle"),"aria-label":a("refreshAriaLabel"),disabled:e,children:(0,B.jsx)(ad,{className:`w-4 h-4 text-muted-foreground hover:text-foreground ${e?"animate-spin":""}`})})]}),(0,B.jsx)("p",{className:"text-sm text-muted-foreground",children:a("webhookCount",{count:c.length})})]}),(0,B.jsxs)(W.Button,{size:"sm",onClick:()=>h(!0),children:[(0,B.jsx)(II.Plus,{className:"w-4 h-4 mr-2"}),a("addWebhook")]})]}),c.length>0?(0,B.jsx)("div",{className:"overflow-x-auto",children:(0,B.jsxs)(ai,{children:[(0,B.jsx)(aj,{children:(0,B.jsxs)(al,{children:[(0,B.jsx)(am,{children:a("tableHeaderUrl")}),(0,B.jsx)(am,{children:a("tableHeaderMethod")}),(0,B.jsx)(am,{children:a("tableHeaderEventTypes")}),(0,B.jsx)(am,{children:a("tableHeaderStatus")}),(0,B.jsx)(am,{children:a("tableHeaderCreatedAt")}),(0,B.jsx)(am,{className:"w-[120px]"})]})}),(0,B.jsx)(ak,{children:c.map(b=>(0,B.jsxs)(al,{children:[(0,B.jsx)(an,{className:"font-mono text-sm max-w-[300px] truncate",children:(0,B.jsx)("span",{title:b.url,children:b.url})}),(0,B.jsx)(an,{children:(0,B.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-mono font-medium bg-muted text-muted-foreground border border-border",children:b.http_config?.method||"POST"})}),(0,B.jsx)(an,{children:(0,B.jsx)("div",{className:"flex flex-wrap gap-1",children:b.event_types.length>0?b.event_types.map(a=>(0,B.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400 border border-blue-500/20",children:a},a)):(0,B.jsx)("span",{className:"text-xs text-muted-foreground",children:a("allEvents")})})}),(0,B.jsx)(an,{children:b.enabled?(0,B.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border border-emerald-500/20",children:[(0,B.jsx)(ae,{className:"w-3 h-3"}),a("statusEnabled")]}):(0,B.jsx)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-muted text-muted-foreground border border-border",children:a("statusDisabled")})}),(0,B.jsx)(an,{className:"text-sm text-muted-foreground",children:af(b.created_at)}),(0,B.jsx)(an,{children:(0,B.jsxs)("div",{className:"flex items-center gap-1",children:[(0,B.jsxs)(W.Button,{variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:()=>aa(b),title:a("viewDeliveriesTitle"),children:[(0,B.jsx)(ac,{className:"w-3 h-3 mr-1"}),a("deliveriesButton")]}),(0,B.jsx)(W.Button,{variant:"ghost",size:"sm",className:"h-7 text-xs text-muted-foreground hover:text-foreground",onClick:()=>{let a;return w(b),void(y((a=b.http_config??{method:"POST",timeout_seconds:30,headers:{},params:{}},{url:b.url,secret:"",event_types:b.event_types,enabled:b.enabled,http_config:{method:a.method,timeout_seconds:a.timeout_seconds,headers:Object.entries(a.headers??{}).map(([a,b])=>({key:a,value:b})),params:Object.entries(a.params??{}).map(([a,b])=>({key:a,value:b}))}})),A(!1),F(!1),u(!0))},title:a("editWebhookTitle"),"aria-label":a("editWebhookAriaLabel"),children:(0,B.jsx)(Jh,{className:"w-3 h-3"})}),(0,B.jsx)(W.Button,{variant:"ghost",size:"sm",className:"h-7 text-xs text-muted-foreground hover:text-red-600 dark:hover:text-red-400",onClick:()=>o(b),disabled:k===b.id,title:a("deleteWebhookTitle"),"aria-label":a("deleteWebhookAriaLabel"),children:k===b.id?(0,B.jsx)(bc.default,{className:"w-3 h-3 animate-spin"}):(0,B.jsx)(Jg,{className:"w-3 h-3"})})]})})]},b.id))})]})}):(0,B.jsx)("p",{className:"text-muted-foreground text-center py-8 text-sm",children:a("emptyStateCanManage")}),(0,B.jsx)(bf.Dialog,{open:g,onOpenChange:a=>{a||(s(Rk),q(!1)),h(a)},children:(0,B.jsxs)(bf.DialogContent,{className:"max-w-lg max-h-[85vh] overflow-y-auto",children:[(0,B.jsxs)(bf.DialogHeader,{children:[(0,B.jsx)(bf.DialogTitle,{children:a("createDialogTitle")}),(0,B.jsx)(bf.DialogDescription,{children:a("createDialogDescription")})]}),(0,B.jsxs)("div",{className:"space-y-4 py-2",children:[(0,B.jsxs)("div",{className:"space-y-1.5",children:[(0,B.jsx)(au,{children:a("formTypeLabel")}),(0,B.jsx)("div",{className:"flex items-center h-9 px-3 rounded-md border border-border bg-muted text-sm text-muted-foreground",children:"HTTP"})]}),(0,B.jsxs)("div",{className:"space-y-1.5",children:[(0,B.jsxs)(au,{htmlFor:"webhook-url",children:[a("formUrlLabel")," ",(0,B.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,B.jsx)(X.Input,{id:"webhook-url",type:"url",placeholder:a("formUrlPlaceholder"),value:r.url,onChange:a=>s(b=>({...b,url:a.target.value}))})]}),(0,B.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,B.jsxs)("div",{className:"space-y-1.5",children:[(0,B.jsx)(au,{children:a("formMethodLabel")}),(0,B.jsxs)(a6.Select,{value:r.http_config.method,onValueChange:a=>s(b=>({...b,http_config:{...b.http_config,method:a}})),children:[(0,B.jsx)(a6.SelectTrigger,{children:(0,B.jsx)(a6.SelectValue,{})}),(0,B.jsxs)(a6.SelectContent,{children:[(0,B.jsx)(a6.SelectItem,{value:"POST",children:"POST"}),(0,B.jsx)(a6.SelectItem,{value:"GET",children:"GET"})]})]})]}),(0,B.jsxs)("div",{className:"space-y-1.5",children:[(0,B.jsx)(au,{htmlFor:"webhook-timeout",children:a("formTimeoutLabel")}),(0,B.jsx)(X.Input,{id:"webhook-timeout",type:"number",min:1,max:300,value:r.http_config.timeout_seconds,onChange:a=>s(b=>({...b,http_config:{...b.http_config,timeout_seconds:parseInt(a.target.value)||30}}))})]})]}),(0,B.jsxs)("div",{className:"space-y-1.5",children:[(0,B.jsxs)(au,{htmlFor:"webhook-secret",children:[a("formSecretLabel")," ",(0,B.jsx)("span",{className:"text-muted-foreground text-xs",children:a("formSecretOptional")})]}),(0,B.jsxs)("div",{className:"relative",children:[(0,B.jsx)(X.Input,{id:"webhook-secret",type:p?"text":"password",placeholder:a("formSecretPlaceholderOptional"),value:r.secret,onChange:a=>s(b=>({...b,secret:a.target.value})),className:"pr-10"}),(0,B.jsx)("button",{type:"button",onClick:()=>q(a=>!a),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",tabIndex:-1,"aria-label":p?a("formHideSecret"):a("formShowSecret"),children:p?(0,B.jsx)(Ri,{className:"w-4 h-4"}):(0,B.jsx)(ac,{className:"w-4 h-4"})})]})]}),(0,B.jsx)(Rn,{label:a("formCustomHeaders"),pairs:r.http_config.headers,onChange:a=>s(b=>({...b,http_config:{...b.http_config,headers:a}}))}),(0,B.jsx)(Rn,{label:a("formQueryParams"),pairs:r.http_config.params,onChange:a=>s(b=>({...b,http_config:{...b.http_config,params:a}}))}),(0,B.jsxs)("div",{className:"space-y-2",children:[(0,B.jsx)(au,{children:a("formEventTypes")}),(0,B.jsx)("div",{className:"space-y-2",children:Rj.map(a=>(0,B.jsxs)("div",{className:"flex items-center gap-2",children:[(0,B.jsx)(IM.Checkbox,{id:`event-${a}`,checked:r.event_types.includes(a),onCheckedChange:()=>{s(b=>({...b,event_types:b.event_types.includes(a)?b.event_types.filter(b=>b!==a):[...b.event_types,a]}))}}),(0,B.jsx)(au,{htmlFor:`event-${a}`,className:"font-mono text-sm cursor-pointer",children:a})]},a))})]}),(0,B.jsxs)("div",{className:"flex items-center gap-3",children:[(0,B.jsx)(a5.Switch,{id:"webhook-enabled",checked:r.enabled,onCheckedChange:a=>s(b=>({...b,enabled:a}))}),(0,B.jsx)(au,{htmlFor:"webhook-enabled",children:a("formEnabled")})]})]}),(0,B.jsxs)(bf.DialogFooter,{children:[(0,B.jsx)(W.Button,{variant:"outline",onClick:()=>h(!1),disabled:i,children:a("cancel")}),(0,B.jsx)(W.Button,{onClick:Z,disabled:i||!r.url,children:i?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(bc.default,{className:"w-4 h-4 mr-2 animate-spin"}),a("creating")]}):a("createWebhook")})]})]})}),(0,B.jsx)(bf.Dialog,{open:t,onOpenChange:a=>{a||(w(null),y(Rk),A(!1),F(!1)),u(a)},children:(0,B.jsxs)(bf.DialogContent,{className:"max-w-lg max-h-[85vh] overflow-y-auto",children:[(0,B.jsxs)(bf.DialogHeader,{children:[(0,B.jsx)(bf.DialogTitle,{children:a("editDialogTitle")}),(0,B.jsx)(bf.DialogDescription,{children:a("editDialogDescription")})]}),(0,B.jsxs)("div",{className:"space-y-4 py-2",children:[(0,B.jsxs)("div",{className:"space-y-1.5",children:[(0,B.jsx)(au,{children:a("formTypeLabel")}),(0,B.jsx)("div",{className:"flex items-center h-9 px-3 rounded-md border border-border bg-muted text-sm text-muted-foreground",children:"HTTP"})]}),(0,B.jsxs)("div",{className:"space-y-1.5",children:[(0,B.jsxs)(au,{htmlFor:"edit-webhook-url",children:[a("formUrlLabel")," ",(0,B.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,B.jsx)(X.Input,{id:"edit-webhook-url",type:"url",placeholder:a("formUrlPlaceholder"),value:x.url,onChange:a=>y(b=>({...b,url:a.target.value}))})]}),(0,B.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,B.jsxs)("div",{className:"space-y-1.5",children:[(0,B.jsx)(au,{children:a("formMethodLabel")}),(0,B.jsxs)(a6.Select,{value:x.http_config.method,onValueChange:a=>y(b=>({...b,http_config:{...b.http_config,method:a}})),children:[(0,B.jsx)(a6.SelectTrigger,{children:(0,B.jsx)(a6.SelectValue,{})}),(0,B.jsxs)(a6.SelectContent,{children:[(0,B.jsx)(a6.SelectItem,{value:"POST",children:"POST"}),(0,B.jsx)(a6.SelectItem,{value:"GET",children:"GET"})]})]})]}),(0,B.jsxs)("div",{className:"space-y-1.5",children:[(0,B.jsx)(au,{htmlFor:"edit-webhook-timeout",children:a("formTimeoutLabel")}),(0,B.jsx)(X.Input,{id:"edit-webhook-timeout",type:"number",min:1,max:300,value:x.http_config.timeout_seconds,onChange:a=>y(b=>({...b,http_config:{...b.http_config,timeout_seconds:parseInt(a.target.value)||30}}))})]})]}),(0,B.jsxs)("div",{className:"space-y-1.5",children:[(0,B.jsx)(au,{htmlFor:"edit-webhook-secret",children:a("formSecretLabel")}),(0,B.jsxs)("div",{className:"relative",children:[(0,B.jsx)(X.Input,{id:"edit-webhook-secret",type:z?"text":"password",placeholder:a("formSecretPlaceholderEdit"),value:x.secret,disabled:D,onChange:a=>y(b=>({...b,secret:a.target.value})),className:"pr-10"}),(0,B.jsx)("button",{type:"button",onClick:()=>A(a=>!a),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",tabIndex:-1,"aria-label":z?a("formHideSecret"):a("formShowSecret"),children:z?(0,B.jsx)(Ri,{className:"w-4 h-4"}):(0,B.jsx)(ac,{className:"w-4 h-4"})})]}),(0,B.jsxs)("div",{className:"flex items-center gap-2 mt-1",children:[(0,B.jsx)(IM.Checkbox,{id:"edit-clear-secret",checked:D,onCheckedChange:a=>{F(!!a),a&&y(a=>({...a,secret:""}))}}),(0,B.jsx)(au,{htmlFor:"edit-clear-secret",className:"text-xs text-muted-foreground cursor-pointer",children:a("formClearSecret")})]})]}),(0,B.jsx)(Rn,{label:a("formCustomHeaders"),pairs:x.http_config.headers,onChange:a=>y(b=>({...b,http_config:{...b.http_config,headers:a}}))}),(0,B.jsx)(Rn,{label:a("formQueryParams"),pairs:x.http_config.params,onChange:a=>y(b=>({...b,http_config:{...b.http_config,params:a}}))}),(0,B.jsxs)("div",{className:"space-y-2",children:[(0,B.jsx)(au,{children:a("formEventTypes")}),(0,B.jsx)("div",{className:"space-y-2",children:Rj.map(a=>(0,B.jsxs)("div",{className:"flex items-center gap-2",children:[(0,B.jsx)(IM.Checkbox,{id:`edit-event-${a}`,checked:x.event_types.includes(a),onCheckedChange:()=>y(b=>({...b,event_types:b.event_types.includes(a)?b.event_types.filter(b=>b!==a):[...b.event_types,a]}))}),(0,B.jsx)(au,{htmlFor:`edit-event-${a}`,className:"font-mono text-sm cursor-pointer",children:a})]},a))})]}),(0,B.jsxs)("div",{className:"flex items-center gap-3",children:[(0,B.jsx)(a5.Switch,{id:"edit-webhook-enabled",checked:x.enabled,onCheckedChange:a=>y(b=>({...b,enabled:a}))}),(0,B.jsx)(au,{htmlFor:"edit-webhook-enabled",children:a("formEnabled")})]})]}),(0,B.jsxs)(bf.DialogFooter,{children:[(0,B.jsx)(W.Button,{variant:"outline",onClick:()=>u(!1),disabled:G,children:a("cancel")}),(0,B.jsx)(W.Button,{onClick:_,disabled:G||!x.url,children:G?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(bc.default,{className:"w-4 h-4 mr-2 animate-spin"}),a("saving")]}):a("saveChanges")})]})]})}),(0,B.jsx)(bf.Dialog,{open:!!n,onOpenChange:a=>{a||o(null)},children:(0,B.jsxs)(bf.DialogContent,{className:"max-w-md",children:[(0,B.jsxs)(bf.DialogHeader,{children:[(0,B.jsx)(bf.DialogTitle,{children:a("deleteDialogTitle")}),(0,B.jsx)(bf.DialogDescription,{children:a("deleteDialogDescription")})]}),n&&(0,B.jsx)("div",{className:"py-2",children:(0,B.jsx)("p",{className:"font-mono text-sm truncate text-muted-foreground bg-muted px-3 py-2 rounded-md border border-border",children:n.url})}),(0,B.jsxs)(bf.DialogFooter,{children:[(0,B.jsx)(W.Button,{variant:"outline",onClick:()=>o(null),children:a("cancel")}),(0,B.jsx)(W.Button,{variant:"destructive",onClick:()=>n&&$(n.id),disabled:!!k,children:k?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(bc.default,{className:"w-4 h-4 mr-2 animate-spin"}),a("deleting")]}):a("deleteWebhookConfirm")})]})]})}),(0,B.jsx)(bf.Dialog,{open:J,onOpenChange:a=>{a||(O([]),S(null)),K(a)},children:(0,B.jsxs)(bf.DialogContent,{className:"max-w-3xl max-h-[80vh] overflow-y-auto",children:[(0,B.jsxs)(bf.DialogHeader,{children:[(0,B.jsx)(bf.DialogTitle,{children:a("deliveriesDialogTitle")}),L&&(0,B.jsx)(bf.DialogDescription,{className:"font-mono text-xs truncate",children:L.url})]}),P?(0,B.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,B.jsx)(bc.default,{className:"w-6 h-6 animate-spin text-muted-foreground"})}):N.length>0?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)("div",{className:"overflow-x-auto",children:(0,B.jsxs)(ai,{children:[(0,B.jsx)(aj,{children:(0,B.jsxs)(al,{children:[(0,B.jsx)(am,{className:"w-8 pl-3 pr-0"}),(0,B.jsx)(am,{children:a("deliveriesTableHeaderStatus")}),(0,B.jsx)(am,{children:a("deliveriesTableHeaderHttp")}),(0,B.jsx)(am,{className:"text-center",children:a("deliveriesTableHeaderAttempts")}),(0,B.jsx)(am,{children:a("deliveriesTableHeaderEvent")}),(0,B.jsx)(am,{children:a("deliveriesTableHeaderCreatedAt")})]})}),(0,B.jsx)(ak,{children:N.map(a=>(0,B.jsx)(Rp,{delivery:a,formatDate:af},a.id))})]})}),R&&(0,B.jsx)("div",{className:"flex justify-center pt-2",children:(0,B.jsxs)(W.Button,{variant:"outline",size:"sm",onClick:ab,disabled:T,children:[T&&(0,B.jsx)(bc.default,{className:"w-4 h-4 mr-2 animate-spin"}),a("loadMore")]})})]}):(0,B.jsx)("p",{className:"text-muted-foreground text-center py-8 text-sm",children:a("noDeliveries")})]})})]}):null}function Rr(a){return[{value:"all",label:a("actionAll")},{value:"retain",label:a("actionRetain")},{value:"recall",label:a("actionRecall")},{value:"reflect",label:a("actionReflect")},{value:"create_bank",label:a("actionCreateBank")},{value:"update_bank",label:a("actionUpdateBank")},{value:"delete_bank",label:a("actionDeleteBank")},{value:"clear_memories",label:a("actionClearMemories")},{value:"consolidation",label:a("actionConsolidation")},{value:"batch_retain",label:a("actionBatchRetain")},{value:"create_mental_model",label:a("actionCreateMentalModel")},{value:"refresh_mental_model",label:a("actionRefreshMentalModel")},{value:"delete_mental_model",label:a("actionDeleteMentalModel")},{value:"create_directive",label:a("actionCreateDirective")},{value:"delete_directive",label:a("actionDeleteDirective")},{value:"file_convert_retain",label:a("actionFileConvertRetain")},{value:"webhook_delivery",label:a("actionWebhookDelivery")}]}function Rs(a,b){if(!a||!b)return"—";let c=new Date(a).getTime(),d=new Date(b).getTime()-c;return d<1e3?`${d}ms`:d<6e4?`${(d/1e3).toFixed(1)}s`:`${(d/6e4).toFixed(1)}m`}function Rt(a){return a?new Date(a).toLocaleString(void 0,{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):"—"}function Ru({transport:a}){let b={http:"bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-300",mcp:"bg-purple-100 text-purple-800 dark:bg-purple-900/30 dark:text-purple-300",system:"bg-gray-100 text-gray-800 dark:bg-gray-900/30 dark:text-gray-300"};return(0,B.jsx)("span",{className:`inline-flex items-center px-2 py-0.5 rounded text-xs font-medium ${b[a]||b.system}`,children:a})}function Rv({bankId:a}){let b=(0,E.useTranslations)("auditLogsView"),c=Rr(b),d=[{value:"1d",label:b("periodToday")},{value:"7d",label:b("periodLast7Days")},{value:"30d",label:b("periodLast30Days")}],[e,f]=(0,C.useState)("7d"),[g,h]=(0,C.useState)(null),[i,j]=(0,C.useState)([]),[k,l]=(0,C.useState)("day"),[n,o]=(0,C.useState)(!1),p=(0,C.useCallback)(async(b=e,c=g)=>{o(!0);try{let d=await V.client.getAuditLogStats(a,{period:b,action:c||void 0});j(d.buckets||[]),l(d.trunc||"day")}catch(a){console.error("Error loading audit stats:",a)}finally{o(!1)}},[a,e,g]);(0,C.useEffect)(()=>{p()},[a]);let q=i.map(a=>{var b;let c;return{time:(b=a.time,c=new Date(b),"hour"===k?c.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"}):c.toLocaleDateString(void 0,{month:"short",day:"numeric"})),total:a.total}});return(0,B.jsxs)(bp.Card,{children:[(0,B.jsxs)(bp.CardHeader,{className:"pb-2 flex flex-row items-center justify-between space-y-0 gap-3",children:[(0,B.jsx)(bp.CardTitle,{className:"text-sm font-semibold",children:b("requestVolume")}),(0,B.jsxs)("div",{className:"flex gap-2",children:[(0,B.jsxs)(a6.Select,{value:g||"all",onValueChange:a=>{let b="all"===a?null:a;h(b),p(e,b)},children:[(0,B.jsx)(a6.SelectTrigger,{className:"w-[160px] h-8 text-xs",children:(0,B.jsx)(a6.SelectValue,{})}),(0,B.jsx)(a6.SelectContent,{position:"popper",className:"max-h-[300px] overflow-y-auto",children:c.map(a=>(0,B.jsx)(a6.SelectItem,{value:a.value,children:a.label},a.value))})]}),d.map(a=>(0,B.jsx)(W.Button,{variant:e===a.value?"default":"outline",size:"sm",className:"h-8 text-xs",onClick:()=>{f(a.value),p(a.value,g)},children:a.label},a.value))]})]}),(0,B.jsx)(bp.CardContent,{children:(0,B.jsx)("div",{className:"h-[120px]",children:n?(0,B.jsx)("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:b("chartLoading")}):0===q.length?(0,B.jsx)("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:b("chartNoData")}):(0,B.jsx)(f2,{width:"100%",height:"100%",children:(0,B.jsxs)(qG,{data:q,margin:{top:5,right:5,bottom:0,left:5},children:[(0,B.jsx)(vc,{dataKey:"time",tick:{fontSize:10},axisLine:!1,tickLine:!1,className:"text-muted-foreground"}),(0,B.jsx)(vT,{contentStyle:{backgroundColor:"var(--popover)",border:"1px solid var(--border)",borderRadius:"6px",fontSize:"12px",padding:"4px 8px"}}),(0,B.jsx)(uc,{type:"monotone",dataKey:"total",stroke:"var(--primary)",strokeWidth:2,dot:!1,activeDot:{r:3}})]})})})})]})}function Rw(){let a=(0,E.useTranslations)("auditLogsView"),b=Rr(a),c=[{value:"all",label:a("transportAll")},{value:"http",label:a("transportHttp")},{value:"mcp",label:a("transportMcp")},{value:"system",label:a("transportSystem")}],{currentBank:d}=(0,H.useBank)(),[e,f]=(0,C.useState)([]),[g,h]=(0,C.useState)(0),[i,j]=(0,C.useState)(null),[k,l]=(0,C.useState)(null),[n,o]=(0,C.useState)("all"),[p]=(0,C.useState)(20),[q,r]=(0,C.useState)(0),[s,t]=(0,C.useState)(!1),[u,v]=(0,C.useState)(null),[w,x]=(0,C.useState)(!1),y=(0,C.useCallback)(a=>{if("all"===a)return{};let b=new Date,c=new Date;return"1h"===a?c.setHours(b.getHours()-1):"1d"===a?c.setDate(b.getDate()-1):"7d"===a?c.setDate(b.getDate()-7):"30d"===a&&c.setDate(b.getDate()-30),{start_date:c.toISOString()}},[]),z=(0,C.useCallback)(async(a=i,b=k,c=n,e=q)=>{if(d){t(!0);try{let g=y(c),i=await V.client.listAuditLogs(d,{action:a||void 0,transport:b||void 0,start_date:g.start_date,end_date:g.end_date,limit:p,offset:e});f(i.items||[]),h(i.total||0)}catch(a){console.error("Error loading audit logs:",a)}finally{t(!1)}}},[d,i,k,n,q,p,y]),A=a=>{r(a),z(i,k,n,a)};(0,C.useEffect)(()=>{d&&z(i,k,n,q)},[d]);let D=Math.ceil(g/p),F=Math.floor(q/p)+1;return d?(0,B.jsxs)("div",{className:"space-y-6",children:[(0,B.jsx)(Rv,{bankId:d}),(0,B.jsxs)("div",{className:"flex items-center gap-3 flex-wrap",children:[(0,B.jsxs)(a6.Select,{value:i||"all",onValueChange:a=>{let b="all"===a?null:a;j(b),r(0),z(b,k,n,0)},children:[(0,B.jsx)(a6.SelectTrigger,{className:"w-[180px]",children:(0,B.jsx)(a6.SelectValue,{placeholder:a("actionAll")})}),(0,B.jsx)(a6.SelectContent,{position:"popper",className:"max-h-[300px] overflow-y-auto",children:b.map(a=>(0,B.jsx)(a6.SelectItem,{value:a.value,children:a.label},a.value))})]}),(0,B.jsxs)(a6.Select,{value:k||"all",onValueChange:a=>{let b="all"===a?null:a;l(b),r(0),z(i,b,n,0)},children:[(0,B.jsx)(a6.SelectTrigger,{className:"w-[160px]",children:(0,B.jsx)(a6.SelectValue,{placeholder:a("transportAll")})}),(0,B.jsx)(a6.SelectContent,{position:"popper",className:"max-h-[300px] overflow-y-auto",children:c.map(a=>(0,B.jsx)(a6.SelectItem,{value:a.value,children:a.label},a.value))})]}),(0,B.jsxs)(a6.Select,{value:n,onValueChange:a=>{o(a),r(0),z(i,k,a,0)},children:[(0,B.jsx)(a6.SelectTrigger,{className:"w-[150px]",children:(0,B.jsx)(a6.SelectValue,{})}),(0,B.jsxs)(a6.SelectContent,{position:"popper",children:[(0,B.jsx)(a6.SelectItem,{value:"all",children:a("dateRangeAll")}),(0,B.jsx)(a6.SelectItem,{value:"1h",children:a("dateRangeLastHour")}),(0,B.jsx)(a6.SelectItem,{value:"1d",children:a("dateRangeLast24Hours")}),(0,B.jsx)(a6.SelectItem,{value:"7d",children:a("dateRangeLast7Days")}),(0,B.jsx)(a6.SelectItem,{value:"30d",children:a("dateRangeLast30Days")})]})]}),(0,B.jsxs)(W.Button,{variant:"outline",size:"sm",onClick:()=>z(i,k,n,q),disabled:s,children:[(0,B.jsx)(ad,{className:`w-4 h-4 mr-1 ${s?"animate-spin":""}`}),a("refresh")]}),(0,B.jsx)("span",{className:"text-sm text-muted-foreground ml-auto",children:a("entryCount",{count:g})})]}),(0,B.jsxs)(ai,{children:[(0,B.jsx)(aj,{children:(0,B.jsxs)(al,{children:[(0,B.jsx)(am,{className:"w-[200px]",children:a("tableHeaderTime")}),(0,B.jsx)(am,{children:a("tableHeaderAction")}),(0,B.jsx)(am,{className:"w-[100px]",children:a("tableHeaderTransport")}),(0,B.jsx)(am,{className:"w-[100px]",children:a("tableHeaderDuration")})]})}),(0,B.jsx)(ak,{children:0===e.length?(0,B.jsx)(al,{children:(0,B.jsx)(an,{colSpan:4,className:"text-center text-muted-foreground py-8",children:a(s?"tableLoading":"tableNoLogs")})}):e.map(a=>(0,B.jsxs)(al,{className:"cursor-pointer hover:bg-muted/50",onClick:()=>{v(a),x(!0)},children:[(0,B.jsx)(an,{className:"text-sm font-mono",children:Rt(a.started_at)}),(0,B.jsx)(an,{className:"font-medium",children:a.action}),(0,B.jsx)(an,{children:(0,B.jsx)(Ru,{transport:a.transport})}),(0,B.jsx)(an,{className:"text-sm text-muted-foreground font-mono",children:Rs(a.started_at,a.ended_at)})]},a.id))})]}),D>1&&(0,B.jsxs)("div",{className:"flex items-center justify-between",children:[(0,B.jsx)("span",{className:"text-sm text-muted-foreground",children:a("paginationPage",{current:F,total:D})}),(0,B.jsxs)("div",{className:"flex gap-2",children:[(0,B.jsxs)(W.Button,{variant:"outline",size:"sm",onClick:()=>A(Math.max(0,q-p)),disabled:0===q,children:[(0,B.jsx)(P,{className:"w-4 h-4 mr-1"}),a("previous")]}),(0,B.jsxs)(W.Button,{variant:"outline",size:"sm",onClick:()=>A(q+p),disabled:q+p>=g,children:[a("next"),(0,B.jsx)(Q.ChevronRight,{className:"w-4 h-4 ml-1"})]})]})]}),(0,B.jsx)(bf.Dialog,{open:w,onOpenChange:x,children:(0,B.jsxs)(bf.DialogContent,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[(0,B.jsx)(bf.DialogHeader,{children:(0,B.jsx)(bf.DialogTitle,{children:a("detailDialogTitle",{action:u?.action??""})})}),u&&(0,B.jsxs)("div",{className:"space-y-4",children:[(0,B.jsxs)("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[(0,B.jsxs)("div",{children:[(0,B.jsx)("span",{className:"text-muted-foreground",children:a("detailAction")})," ",(0,B.jsx)("span",{className:"font-medium",children:u.action})]}),(0,B.jsxs)("div",{children:[(0,B.jsx)("span",{className:"text-muted-foreground",children:a("detailTransport")})," ",(0,B.jsx)(Ru,{transport:u.transport})]}),(0,B.jsxs)("div",{children:[(0,B.jsx)("span",{className:"text-muted-foreground",children:a("detailStarted")})," ",(0,B.jsx)("span",{className:"font-mono",children:Rt(u.started_at)})]}),(0,B.jsxs)("div",{children:[(0,B.jsx)("span",{className:"text-muted-foreground",children:a("detailDuration")})," ",(0,B.jsx)("span",{className:"font-mono",children:Rs(u.started_at,u.ended_at)})]})]}),u.request&&(0,B.jsxs)("div",{children:[(0,B.jsx)("h4",{className:"text-sm font-semibold mb-2",children:a("detailRequest")}),(0,B.jsx)(bq,{value:u.request,className:"bg-muted max-h-[300px] overflow-y-auto"})]}),u.response&&(0,B.jsxs)("div",{children:[(0,B.jsx)("h4",{className:"text-sm font-semibold mb-2",children:a("detailResponse")}),(0,B.jsx)(bq,{value:u.response,className:"bg-muted max-h-[300px] overflow-y-auto"})]}),u.metadata&&Object.keys(u.metadata).length>0&&(0,B.jsxs)("div",{children:[(0,B.jsx)("h4",{className:"text-sm font-semibold mb-2",children:a("detailMetadata")}),(0,B.jsx)(bq,{value:u.metadata})]})]})]})})]}):null}let Rx=(0,K.default)("power-off",[["path",{d:"M18.36 6.64A9 9 0 0 1 20.77 15",key:"dxknvb"}],["path",{d:"M6.16 6.16a9 9 0 1 0 12.68 12.68",key:"1x7qb5"}],["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);function Ry({title:a,description:b,icon:c=Rx}){return(0,B.jsxs)("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[(0,B.jsx)("div",{className:"text-muted-foreground mb-2",children:(0,B.jsx)(c,{width:48,height:48,strokeWidth:1.5})}),(0,B.jsx)("h3",{className:"text-lg font-semibold text-foreground mb-1",children:a}),(0,B.jsx)("p",{className:"text-sm text-muted-foreground max-w-md",children:b})]})}var bc=bc;a.s(["default",0,function(){(0,D.useParams)();let a=(0,D.useRouter)(),b=(0,D.useSearchParams)(),c=(0,E.useTranslations)("bank"),d=(0,E.useTranslations)("common"),{features:e}=(0,IL.useFeatures)(),{currentBank:f,setCurrentBank:g,loadBanks:h}=(0,H.useBank)(),i=b.get("view")||"profile",j=b.get("subTab")||"world",k=b.get("bankConfigTab")||"general",l=e?.observations??!1,n=e?.bank_config_api??!1,o=e?.audit_log??!1,p=e?.llm_trace??!1,[q,r]=(0,C.useState)(!1),[s,t]=(0,C.useState)(!1),[u,v]=(0,C.useState)(!1),[w,x]=(0,C.useState)(!1),[y,z]=(0,C.useState)(!1),[A,J]=(0,C.useState)(!1),[K,L]=(0,C.useState)(!1),[M,N]=(0,C.useState)(!1),O=b=>{f&&a.push((0,I.bankRoute)(f,`?view=data&subTab=${b}`))},P=b=>{f&&a.push((0,I.bankRoute)(f,`?view=profile&bankConfigTab=${b}`))},Q=async()=>{if(f){t(!0);try{await V.client.deleteBank(f),r(!1),g(null),await h(),a.push("/")}catch(a){}finally{t(!1)}}},R=async()=>{if(f){x(!0);try{let a=await V.client.clearObservations(f);v(!1),F.toast.success(c("observationsCleared"),{description:a.message||c("observationsClearedDefault")})}catch(a){}finally{x(!1)}}},S=async()=>{if(f){N(!0);try{await V.client.resetBankConfig(f),L(!1)}catch{}finally{N(!1)}}},T=async()=>{if(f){z(!0);try{await V.client.triggerConsolidation(f)}catch(a){}finally{z(!1)}}},X=async()=>{if(f){J(!0);try{let a=await V.client.recoverConsolidation(f);F.toast.success(c("recoveredMemories",{count:a.retried_count}))}catch(a){}finally{J(!1)}}};return(0,B.jsxs)("div",{className:"min-h-screen bg-background flex flex-col",children:[(0,B.jsx)(G.BankSelector,{}),(0,B.jsxs)("div",{className:"flex flex-1 overflow-hidden",children:[(0,B.jsx)(U,{currentTab:i,onTabChange:b=>{f&&a.push((0,I.bankRoute)(f,`?view=${b}`))}}),(0,B.jsx)("main",{className:"flex-1 overflow-y-auto",children:(0,B.jsxs)("div",{className:"p-6",children:["profile"===i&&(0,B.jsxs)("div",{children:[(0,B.jsxs)("div",{className:"flex justify-between items-start mb-6",children:[(0,B.jsxs)("div",{children:[(0,B.jsx)("h1",{className:"text-3xl font-bold mb-2 text-foreground",children:c("bankConfiguration")}),(0,B.jsx)("p",{className:"text-muted-foreground",children:c("bankConfigurationDescription")})]}),(0,B.jsxs)(IN.DropdownMenu,{children:[(0,B.jsx)(IN.DropdownMenuTrigger,{asChild:!0,children:(0,B.jsxs)(W.Button,{variant:"outline",size:"sm",children:[c("actions"),(0,B.jsx)(Ji,{className:"w-4 h-4 ml-2"})]})}),(0,B.jsxs)(IN.DropdownMenuContent,{align:"end",className:"w-48",children:[(0,B.jsxs)(IN.DropdownMenuItem,{onClick:async()=>{if(f)try{let a=await V.client.exportBankTemplate(f),b=JSON.stringify(a,null,2);await navigator.clipboard.writeText(b),F.toast.success(c("templateCopied"))}catch{F.toast.error(c("failedToExportTemplate"))}},children:[(0,B.jsx)(Jk,{className:"w-4 h-4 mr-2"}),c("exportTemplate")]}),(0,B.jsx)(IN.DropdownMenuSeparator,{}),(0,B.jsxs)(IN.DropdownMenuItem,{onClick:T,disabled:y||!l,title:l?void 0:"Observations feature is not enabled",children:[y?(0,B.jsx)(bc.default,{className:"w-4 h-4 mr-2 animate-spin"}):(0,B.jsx)(JF,{className:"w-4 h-4 mr-2"}),y?c("consolidating"):c("runConsolidation"),!l&&(0,B.jsx)("span",{className:"ml-auto text-xs text-muted-foreground",children:"Off"})]}),(0,B.jsxs)(IN.DropdownMenuItem,{onClick:X,disabled:A||!l,title:l?void 0:"Observations feature is not enabled",children:[A?(0,B.jsx)(bc.default,{className:"w-4 h-4 mr-2 animate-spin"}):(0,B.jsx)(Q6,{className:"w-4 h-4 mr-2"}),A?c("recovering"):c("recoverConsolidation"),!l&&(0,B.jsx)("span",{className:"ml-auto text-xs text-muted-foreground",children:"Off"})]}),(0,B.jsxs)(IN.DropdownMenuItem,{onClick:()=>v(!0),disabled:!l,className:"text-amber-600 dark:text-amber-400 focus:text-amber-700 dark:focus:text-amber-300",title:l?void 0:"Observations feature is not enabled",children:[(0,B.jsx)(Jg,{className:"w-4 h-4 mr-2"}),c("clearObservations"),!l&&(0,B.jsx)("span",{className:"ml-auto text-xs text-muted-foreground",children:"Off"})]}),(0,B.jsx)(IN.DropdownMenuSeparator,{}),(0,B.jsxs)(IN.DropdownMenuItem,{onClick:()=>L(!0),disabled:!n,className:"text-amber-600 dark:text-amber-400 focus:text-amber-700 dark:focus:text-amber-300",title:n?void 0:"Bank Config API is disabled",children:[(0,B.jsx)(Q6,{className:"w-4 h-4 mr-2"}),c("resetConfiguration"),!n&&(0,B.jsx)("span",{className:"ml-auto text-xs text-muted-foreground",children:"Off"})]}),(0,B.jsx)(IN.DropdownMenuSeparator,{}),(0,B.jsxs)(IN.DropdownMenuItem,{onClick:()=>r(!0),className:"text-red-600 dark:text-red-400 focus:text-red-700 dark:focus:text-red-300",children:[(0,B.jsx)(Jg,{className:"w-4 h-4 mr-2"}),c("deleteBank")]})]})]})]}),(0,B.jsx)("div",{className:"mb-6 border-b border-border",children:(0,B.jsxs)("div",{className:"flex gap-1",children:[(0,B.jsxs)("button",{onClick:()=>P("general"),className:`px-6 py-3 font-semibold text-sm transition-all relative ${"general"===k?"text-primary":"text-muted-foreground hover:text-foreground"}`,children:[c("general"),"general"===k&&(0,B.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]}),n&&(0,B.jsxs)("button",{onClick:()=>P("configuration"),className:`px-6 py-3 font-semibold text-sm transition-all relative ${"configuration"===k?"text-primary":"text-muted-foreground hover:text-foreground"}`,children:[c("configuration"),"configuration"===k&&(0,B.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]}),(0,B.jsxs)("button",{onClick:()=>P("webhooks"),className:`px-6 py-3 font-semibold text-sm transition-all relative ${"webhooks"===k?"text-primary":"text-muted-foreground hover:text-foreground"}`,children:[c("webhooks"),"webhooks"===k&&(0,B.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]}),(0,B.jsxs)("button",{onClick:()=>P("audit-logs"),className:`px-6 py-3 font-semibold text-sm transition-all relative ${"audit-logs"===k?"text-primary":"text-muted-foreground hover:text-foreground"}`,children:[c("auditLogs"),!o&&(0,B.jsx)("span",{className:"ml-2 text-xs px-1.5 py-0.5 rounded bg-muted text-muted-foreground",children:"Off"}),"audit-logs"===k&&(0,B.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]}),(0,B.jsxs)("button",{onClick:()=>P("llm-requests"),className:`px-6 py-3 font-semibold text-sm transition-all relative ${"llm-requests"===k?"text-primary":"text-muted-foreground hover:text-foreground"}`,children:[c("llmRequests"),!p&&(0,B.jsx)("span",{className:"ml-2 text-xs px-1.5 py-0.5 rounded bg-muted text-muted-foreground",children:"Off"}),"llm-requests"===k&&(0,B.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]})]})}),(0,B.jsxs)("div",{children:["general"===k&&(0,B.jsxs)("div",{children:[(0,B.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:c("overviewAndOperations")}),(0,B.jsxs)("div",{className:"space-y-6",children:[(0,B.jsx)(Q5,{}),(0,B.jsx)(Rb,{}),(0,B.jsx)(PR,{hideReflectFields:!0})]})]}),"configuration"===k&&n&&(0,B.jsx)("div",{className:"space-y-6",children:(0,B.jsx)(P7,{})}),"webhooks"===k&&(0,B.jsxs)("div",{children:[(0,B.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:c("webhooksDescription")}),(0,B.jsx)(Rq,{})]}),"audit-logs"===k&&(o?(0,B.jsxs)("div",{children:[(0,B.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:c("auditLogsDescription")}),(0,B.jsx)(Rw,{})]}):(0,B.jsx)(Ry,{title:c("auditLogsNotEnabled"),description:c.rich("auditLogsDisabledMessage",{envVar:()=>(0,B.jsx)("code",{className:"px-1 py-0.5 bg-muted rounded text-xs",children:"HINDSIGHT_API_AUDIT_LOG_ENABLED=true"})})})),"llm-requests"===k&&(p?(0,B.jsxs)("div",{children:[(0,B.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:c("llmRequestsDescription")}),(0,B.jsx)(wj,{})]}):(0,B.jsx)(Ry,{title:c("llmRequestsNotEnabled"),description:c.rich("llmRequestsDisabledMessage",{envVar:()=>(0,B.jsx)("code",{className:"px-1 py-0.5 bg-muted rounded text-xs",children:"HINDSIGHT_API_LLM_TRACE_ENABLED=true"})})}))]})]}),"recall"===i&&(0,B.jsxs)("div",{children:[(0,B.jsx)("h1",{className:"text-3xl font-bold mb-2 text-foreground",children:c("recallAnalyzer")}),(0,B.jsx)("p",{className:"text-muted-foreground mb-6",children:c("recallAnalyzerDescription")}),(0,B.jsx)(PM,{})]}),"reflect"===i&&(0,B.jsxs)("div",{children:[(0,B.jsx)("h1",{className:"text-3xl font-bold mb-2 text-foreground",children:c("reflect")}),(0,B.jsx)("p",{className:"text-muted-foreground mb-6",children:c("reflectDescription")}),(0,B.jsx)(PK,{})]}),"data"===i&&(0,B.jsxs)("div",{children:[(0,B.jsx)("h1",{className:"text-3xl font-bold mb-2 text-foreground",children:c("memories")}),(0,B.jsx)("p",{className:"text-muted-foreground mb-6",children:c("memoriesDescription")}),(0,B.jsx)("div",{className:"mb-6 border-b border-border",children:(0,B.jsxs)("div",{className:"flex gap-1",children:[(0,B.jsxs)("button",{onClick:()=>O("world"),className:`px-6 py-3 font-semibold text-sm transition-all relative ${"world"===j?"text-primary":"text-muted-foreground hover:text-foreground"}`,children:[c("worldFacts"),"world"===j&&(0,B.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]}),(0,B.jsxs)("button",{onClick:()=>O("experience"),className:`px-6 py-3 font-semibold text-sm transition-all relative ${"experience"===j?"text-primary":"text-muted-foreground hover:text-foreground"}`,children:[c("experience"),"experience"===j&&(0,B.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]}),(0,B.jsxs)("button",{onClick:()=>O("observations"),className:`px-6 py-3 font-semibold text-sm transition-all relative ${"observations"===j?"text-primary":"text-muted-foreground hover:text-foreground"}`,children:[c("observations"),!l&&(0,B.jsx)("span",{className:"ml-2 text-xs px-1.5 py-0.5 rounded bg-muted text-muted-foreground",children:"Off"}),"observations"===j&&(0,B.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]}),(0,B.jsxs)("button",{onClick:()=>O("mental-models"),className:`px-6 py-3 font-semibold text-sm transition-all relative ${"mental-models"===j?"text-primary":"text-muted-foreground hover:text-foreground"}`,children:[c("mentalModels"),"mental-models"===j&&(0,B.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]})]})}),(0,B.jsxs)("div",{children:["world"===j&&(0,B.jsxs)("div",{children:[(0,B.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:c("worldFactsDescription")}),(0,B.jsx)(IJ,{factType:"world"},"world")]}),"experience"===j&&(0,B.jsxs)("div",{children:[(0,B.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:c("experienceDescription")}),(0,B.jsx)(IJ,{factType:"experience"},"experience")]}),"observations"===j&&(l?(0,B.jsxs)("div",{children:[(0,B.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:c("observationsDescription")}),(0,B.jsx)(IJ,{factType:"observation"},"observations")]}):(0,B.jsx)(Ry,{title:c("observationsNotEnabled"),description:c.rich("observationsDisabledMessage",{envVar:()=>(0,B.jsx)("code",{className:"px-1 py-0.5 bg-muted rounded text-xs",children:"HINDSIGHT_API_ENABLE_OBSERVATIONS=true"})})})),"mental-models"===j&&(0,B.jsxs)("div",{children:[(0,B.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:c("mentalModelsDescription")}),(0,B.jsx)(Rd,{},"mental-models")]})]})]}),"documents"===i&&(0,B.jsx)("div",{children:(0,B.jsx)(Jx,{})}),"entities"===i&&(0,B.jsxs)("div",{children:[(0,B.jsx)("h1",{className:"text-3xl font-bold mb-2 text-foreground",children:c("entities")}),(0,B.jsx)("p",{className:"text-muted-foreground mb-6",children:c("entitiesDescription")}),(0,B.jsx)(Jy,{})]})]})})]}),(0,B.jsx)(IU,{open:q,onOpenChange:r,children:(0,B.jsxs)(I9,{children:[(0,B.jsxs)(Ja,{children:[(0,B.jsx)(Jc,{children:c("deleteMemoryBank")}),(0,B.jsx)(Jd,{asChild:!0,children:(0,B.jsxs)("div",{className:"space-y-2 text-sm text-muted-foreground",children:[(0,B.jsx)("p",{children:c.rich("deleteBankPrompt",{bankName:()=>(0,B.jsx)("span",{className:"font-semibold text-foreground",children:f})})}),(0,B.jsx)("p",{className:"text-red-600 dark:text-red-400 font-medium",children:c("deleteBankWarning")})]})})]}),(0,B.jsxs)(Jb,{children:[(0,B.jsx)(Jf,{disabled:s,children:d("cancel")}),(0,B.jsx)(Je,{onClick:Q,disabled:s,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:s?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(bc.default,{className:"w-4 h-4 mr-2 animate-spin"}),c("deleting")]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Jg,{className:"w-4 h-4 mr-2"}),c("deleteBank")]})})]})]})}),(0,B.jsx)(IU,{open:K,onOpenChange:L,children:(0,B.jsxs)(I9,{children:[(0,B.jsxs)(Ja,{children:[(0,B.jsx)(Jc,{children:c("resetConfigTitle")}),(0,B.jsx)(Jd,{asChild:!0,children:(0,B.jsxs)("div",{className:"space-y-2 text-sm text-muted-foreground",children:[(0,B.jsx)("p",{children:c.rich("resetConfigPrompt",{bankName:()=>(0,B.jsx)("span",{className:"font-semibold text-foreground",children:f})})}),(0,B.jsx)("p",{className:"text-amber-600 dark:text-amber-400 font-medium",children:c("resetConfigWarning")})]})})]}),(0,B.jsxs)(Jb,{children:[(0,B.jsx)(Jf,{disabled:M,children:d("cancel")}),(0,B.jsx)(Je,{onClick:S,disabled:M,children:M?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(bc.default,{className:"w-4 h-4 mr-2 animate-spin"}),c("resetting")]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Q6,{className:"w-4 h-4 mr-2"}),c("resetConfiguration")]})})]})]})}),(0,B.jsx)(IU,{open:u,onOpenChange:v,children:(0,B.jsxs)(I9,{children:[(0,B.jsxs)(Ja,{children:[(0,B.jsx)(Jc,{children:c("clearObservationsTitle")}),(0,B.jsx)(Jd,{asChild:!0,children:(0,B.jsxs)("div",{className:"space-y-2 text-sm text-muted-foreground",children:[(0,B.jsx)("p",{children:c.rich("clearObservationsPrompt",{bankName:()=>(0,B.jsx)("span",{className:"font-semibold text-foreground",children:f})})}),(0,B.jsx)("p",{className:"text-amber-600 dark:text-amber-400 font-medium",children:c("clearObservationsWarning")})]})})]}),(0,B.jsxs)(Jb,{children:[(0,B.jsx)(Jf,{disabled:w,children:d("cancel")}),(0,B.jsx)(Je,{onClick:R,disabled:w,className:"bg-amber-500 text-white hover:bg-amber-600",children:w?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(bc.default,{className:"w-4 h-4 mr-2 animate-spin"}),c("clearing")]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Jg,{className:"w-4 h-4 mr-2"}),c("clearObservations")]})})]})]})})]})}],23962)}];
|
|
10
10
|
|
|
11
11
|
//# sourceMappingURL=%5Broot-of-the-server%5D__0_x23ke._.js.map
|