most-box 0.3.3 → 0.3.4
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/README.md +7 -6
- package/out/admin/index.html +0 -0
- package/out/app/index.html +0 -0
- package/out/assets/{AccountMenu-D36x3rKH.js → AccountMenu-ptQklqvD.js} +1 -1
- package/out/assets/{AppTop-qtp-3wqv.js → AppTop-Cy0ZOCxO.js} +1 -1
- package/out/assets/{CopyButton-C00LHzxo.js → CopyButton-C8PIDSJZ.js} +1 -1
- package/out/assets/{FilePreviewOverlay-BvOCftIV.js → FilePreviewOverlay-faaTnmlN.js} +1 -1
- package/out/assets/{MarketingHeader-D7AjEmWU.js → MarketingHeader-CxJ_OVOW.js} +1 -1
- package/out/assets/{MarketingLayout-BVw4vr-u.js → MarketingLayout-CiN5KYcE.js} +1 -1
- package/out/assets/{MilkdownEditor-DXVbZsH_.js → MilkdownEditor-BzbYt-xb.js} +1 -1
- package/out/assets/{OpenSidebarButton-DI6Ld8um.js → OpenSidebarButton-CGhXxQ5Z.js} +1 -1
- package/out/assets/{chatJoinInvite-aCHhLrlm.js → chatJoinInvite-B-ucvYdg.js} +1 -1
- package/out/assets/index-D0Uk9-58.js +31 -0
- package/out/assets/{index.lazy-_CazgyO7.js → index.lazy-B6XDJ8fg.js} +1 -1
- package/out/assets/{index.lazy-DxOIgf3c.js → index.lazy-BFdWbm3R.js} +1 -1
- package/out/assets/{index.lazy-08bEbzIk.js → index.lazy-BzIt7fP4.js} +1 -1
- package/out/assets/index.lazy-CLkb32nv.js +1 -0
- package/out/assets/{index.lazy-DuvCRtpm.js → index.lazy-CNmqW4-r.js} +1 -1
- package/out/assets/{index.lazy-odd8ydDw.js → index.lazy-Cnkj-gAd.js} +1 -1
- package/out/assets/{index.lazy-Bi5KZylP.js → index.lazy-Cx1bp84f.js} +1 -1
- package/out/assets/{index.lazy-B4pxVFWK.js → index.lazy-CxLzR674.js} +2 -2
- package/out/assets/{index.lazy-CRV2-Y6z.js → index.lazy-D4RjTGu-.js} +1 -1
- package/out/assets/{index.lazy-CJnFeoy4.js → index.lazy-D9xLqvqW.js} +1 -1
- package/out/assets/{index.lazy-CzCHV559.js → index.lazy-DNCF6MTJ.js} +1 -1
- package/out/assets/{index.lazy-DrfZ9XTR.js → index.lazy-MY-mUG5Z.js} +1 -1
- package/out/assets/{index.lazy-Itk05ouU.js → index.lazy-erUKA2rI.js} +1 -1
- package/out/assets/{index.lazy-FNVWBYth.js → index.lazy-qTjgLKhY.js} +1 -1
- package/out/assets/{useGameRoom-CATo4XWU.js → useGameRoom-CS1w4IqP.js} +1 -1
- package/out/chat/index.html +0 -0
- package/out/chat/join/demo/index.html +0 -0
- package/out/chat/join/index.html +0 -0
- package/out/download/index.html +2 -2
- package/out/game/gandengyan/index.html +0 -0
- package/out/game/index.html +0 -0
- package/out/game/zhajinhua/index.html +0 -0
- package/out/index.html +2 -2
- package/out/note/index.html +0 -0
- package/out/ping/index.html +2 -2
- package/out/profile/index.html +0 -0
- package/out/web3/index.html +0 -0
- package/package.json +1 -1
- package/server/src/core/releaseManifest.js +10 -3
- package/out/assets/index-CUzbruyP.js +0 -31
- package/out/assets/index.lazy-6b-8jxXI.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as e,o as t,r as n,t as r}from"./jsx-runtime-Bt-cYkS5.js";import{B as i,H as a,d as o,n as s,o as c,t as l,u}from"./useAppStore-DOnk608w.js";import{t as d}from"./triangle-alert-B9sMiA9l.js";import{t as f}from"./arrow-up-down-B-677ip8.js";import{t as p}from"./chevron-right-D75NRNNs.js";import{t as m}from"./download-COQOcPqI.js";import{t as h}from"./file-text-DiyIGL1I.js";import{t as g}from"./hard-drive-Cqa7Rstj.js";import{t as _}from"./refresh-cw-D4BsHvhi.js";import{t as v}from"./save-B02sbO9Y.js";import{t as ee}from"./shield-check-Boae7Nc6.js";import{t as te}from"./trash-2-BLwoM0ME.js";import{t as ne}from"./wifi-ljEI_ySA.js";import{A as re,C as ie,D as ae}from"./index-
|
|
1
|
+
import{n as e,o as t,r as n,t as r}from"./jsx-runtime-Bt-cYkS5.js";import{B as i,H as a,d as o,n as s,o as c,t as l,u}from"./useAppStore-DOnk608w.js";import{t as d}from"./triangle-alert-B9sMiA9l.js";import{t as f}from"./arrow-up-down-B-677ip8.js";import{t as p}from"./chevron-right-D75NRNNs.js";import{t as m}from"./download-COQOcPqI.js";import{t as h}from"./file-text-DiyIGL1I.js";import{t as g}from"./hard-drive-Cqa7Rstj.js";import{t as _}from"./refresh-cw-D4BsHvhi.js";import{t as v}from"./save-B02sbO9Y.js";import{t as ee}from"./shield-check-Boae7Nc6.js";import{t as te}from"./trash-2-BLwoM0ME.js";import{t as ne}from"./wifi-ljEI_ySA.js";import{A as re,C as ie,D as ae}from"./index-D0Uk9-58.js";import{t as y}from"./dayjs.min-Dcc0B6Je.js";import{t as oe}from"./MarketingHeader-CxJ_OVOW.js";import{t as b}from"./format-CR8oUWq6.js";var se=i(`activity`,[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]),x=i(`arrow-down`,[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]),ce=i(`arrow-up`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),S=i(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),le=i(`chevrons-left`,[[`path`,{d:`m11 17-5-5 5-5`,key:`13zhaf`}],[`path`,{d:`m18 17-5-5 5-5`,key:`h8a8et`}]]),ue=i(`chevrons-right`,[[`path`,{d:`m6 17 5-5-5-5`,key:`xnjwq`}],[`path`,{d:`m13 17 5-5-5-5`,key:`17xmmf`}]]),de=i(`clipboard`,[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}]]),fe=i(`database`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]),C=t(e(),1);function w(e,t){return typeof e==`function`?e(t):e}function T(e,t){return n=>{t.setState(t=>({...t,[e]:w(n,t[e])}))}}function E(e){return e instanceof Function}function pe(e){return Array.isArray(e)&&e.every(e=>typeof e==`number`)}function D(e,t){let n=[],r=e=>{e.forEach(e=>{n.push(e);let i=t(e);i!=null&&i.length&&r(i)})};return r(e),n}function O(e,t,n){let r=[],i;return a=>{let o;n.key&&n.debug&&(o=Date.now());let s=e(a);if(!(s.length!==r.length||s.some((e,t)=>r[t]!==e)))return i;r=s;let c;if(n.key&&n.debug&&(c=Date.now()),i=t(...s),n==null||n.onChange==null||n.onChange(i),n.key&&n.debug&&n!=null&&n.debug()){let e=Math.round((Date.now()-o)*100)/100,t=Math.round((Date.now()-c)*100)/100,r=t/16,i=(e,t)=>{for(e=String(e);e.length<t;)e=` `+e;return e};console.info(`%c⏱ ${i(t,5)} /${i(e,5)} ms`,`
|
|
2
2
|
font-size: .6rem;
|
|
3
3
|
font-weight: bold;
|
|
4
4
|
color: hsl(${Math.max(0,Math.min(120-120*r,120))}deg 100% 31%);`,n?.key)}return i}}function k(e,t,n,r){return{debug:()=>e?.debugAll??e[t],key:!1,onChange:r}}function me(e,t,n,r){let i={id:`${t.id}_${n.id}`,row:t,column:n,getValue:()=>t.getValue(r),renderValue:()=>i.getValue()??e.options.renderFallbackValue,getContext:O(()=>[e,n,t,i],(e,t,n,r)=>({table:e,column:t,row:n,cell:r,getValue:r.getValue,renderValue:r.renderValue}),k(e.options,`debugCells`,`cell.getContext`))};return e._features.forEach(r=>{r.createCell==null||r.createCell(i,n,t,e)},{}),i}function he(e,t,n,r){let i={...e._getDefaultColumnDef(),...t},a=i.accessorKey,o=i.id??(a?typeof String.prototype.replaceAll==`function`?a.replaceAll(`.`,`_`):a.replace(/\./g,`_`):void 0)??(typeof i.header==`string`?i.header:void 0),s;if(i.accessorFn?s=i.accessorFn:a&&(s=a.includes(`.`)?e=>{let t=e;for(let e of a.split(`.`))t=t?.[e];return t}:e=>e[i.accessorKey]),!o)throw Error();let c={id:`${String(o)}`,accessorFn:s,parent:r,depth:n,columnDef:i,columns:[],getFlatColumns:O(()=>[!0],()=>[c,...c.columns?.flatMap(e=>e.getFlatColumns())],k(e.options,`debugColumns`,`column.getFlatColumns`)),getLeafColumns:O(()=>[e._getOrderColumnsFn()],e=>{var t;return(t=c.columns)!=null&&t.length?e(c.columns.flatMap(e=>e.getLeafColumns())):[c]},k(e.options,`debugColumns`,`column.getLeafColumns`))};for(let t of e._features)t.createColumn==null||t.createColumn(c,e);return c}var A=`debugHeaders`;function ge(e,t,n){let r={id:n.id??t.id,column:t,index:n.index,isPlaceholder:!!n.isPlaceholder,placeholderId:n.placeholderId,depth:n.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{let e=[],t=n=>{n.subHeaders&&n.subHeaders.length&&n.subHeaders.map(t),e.push(n)};return t(r),e},getContext:()=>({table:e,header:r,column:t})};return e._features.forEach(t=>{t.createHeader==null||t.createHeader(r,e)}),r}var _e={createTable:e=>{e.getHeaderGroups=O(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r,i)=>{let a=r?.map(e=>n.find(t=>t.id===e)).filter(Boolean)??[],o=i?.map(e=>n.find(t=>t.id===e)).filter(Boolean)??[],s=n.filter(e=>!(r!=null&&r.includes(e.id))&&!(i!=null&&i.includes(e.id)));return j(t,[...a,...s,...o],e)},k(e.options,A,`getHeaderGroups`)),e.getCenterHeaderGroups=O(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r,i)=>(n=n.filter(e=>!(r!=null&&r.includes(e.id))&&!(i!=null&&i.includes(e.id))),j(t,n,e,`center`)),k(e.options,A,`getCenterHeaderGroups`)),e.getLeftHeaderGroups=O(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(t,n,r)=>j(t,r?.map(e=>n.find(t=>t.id===e)).filter(Boolean)??[],e,`left`),k(e.options,A,`getLeftHeaderGroups`)),e.getRightHeaderGroups=O(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(t,n,r)=>j(t,r?.map(e=>n.find(t=>t.id===e)).filter(Boolean)??[],e,`right`),k(e.options,A,`getRightHeaderGroups`)),e.getFooterGroups=O(()=>[e.getHeaderGroups()],e=>[...e].reverse(),k(e.options,A,`getFooterGroups`)),e.getLeftFooterGroups=O(()=>[e.getLeftHeaderGroups()],e=>[...e].reverse(),k(e.options,A,`getLeftFooterGroups`)),e.getCenterFooterGroups=O(()=>[e.getCenterHeaderGroups()],e=>[...e].reverse(),k(e.options,A,`getCenterFooterGroups`)),e.getRightFooterGroups=O(()=>[e.getRightHeaderGroups()],e=>[...e].reverse(),k(e.options,A,`getRightFooterGroups`)),e.getFlatHeaders=O(()=>[e.getHeaderGroups()],e=>e.map(e=>e.headers).flat(),k(e.options,A,`getFlatHeaders`)),e.getLeftFlatHeaders=O(()=>[e.getLeftHeaderGroups()],e=>e.map(e=>e.headers).flat(),k(e.options,A,`getLeftFlatHeaders`)),e.getCenterFlatHeaders=O(()=>[e.getCenterHeaderGroups()],e=>e.map(e=>e.headers).flat(),k(e.options,A,`getCenterFlatHeaders`)),e.getRightFlatHeaders=O(()=>[e.getRightHeaderGroups()],e=>e.map(e=>e.headers).flat(),k(e.options,A,`getRightFlatHeaders`)),e.getCenterLeafHeaders=O(()=>[e.getCenterFlatHeaders()],e=>e.filter(e=>{var t;return!((t=e.subHeaders)!=null&&t.length)}),k(e.options,A,`getCenterLeafHeaders`)),e.getLeftLeafHeaders=O(()=>[e.getLeftFlatHeaders()],e=>e.filter(e=>{var t;return!((t=e.subHeaders)!=null&&t.length)}),k(e.options,A,`getLeftLeafHeaders`)),e.getRightLeafHeaders=O(()=>[e.getRightFlatHeaders()],e=>e.filter(e=>{var t;return!((t=e.subHeaders)!=null&&t.length)}),k(e.options,A,`getRightLeafHeaders`)),e.getLeafHeaders=O(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(e,t,n)=>[...e[0]?.headers??[],...t[0]?.headers??[],...n[0]?.headers??[]].map(e=>e.getLeafHeaders()).flat(),k(e.options,A,`getLeafHeaders`))}};function j(e,t,n,r){let i=0,a=function(e,t){t===void 0&&(t=1),i=Math.max(i,t),e.filter(e=>e.getIsVisible()).forEach(e=>{var n;(n=e.columns)!=null&&n.length&&a(e.columns,t+1)},0)};a(e);let o=[],s=(e,t)=>{let i={depth:t,id:[r,`${t}`].filter(Boolean).join(`_`),headers:[]},a=[];e.forEach(e=>{let o=[...a].reverse()[0],s=e.column.depth===i.depth,c,l=!1;if(s&&e.column.parent?c=e.column.parent:(c=e.column,l=!0),o&&o?.column===c)o.subHeaders.push(e);else{let i=ge(n,c,{id:[r,t,c.id,e?.id].filter(Boolean).join(`_`),isPlaceholder:l,placeholderId:l?`${a.filter(e=>e.column===c).length}`:void 0,depth:t,index:a.length});i.subHeaders.push(e),a.push(i)}i.headers.push(e),e.headerGroup=i}),o.push(i),t>0&&s(a,t-1)};s(t.map((e,t)=>ge(n,e,{depth:i,index:t})),i-1),o.reverse();let c=e=>e.filter(e=>e.column.getIsVisible()).map(e=>{let t=0,n=0,r=[0];e.subHeaders&&e.subHeaders.length?(r=[],c(e.subHeaders).forEach(e=>{let{colSpan:n,rowSpan:i}=e;t+=n,r.push(i)})):t=1;let i=Math.min(...r);return n+=i,e.colSpan=t,e.rowSpan=n,{colSpan:t,rowSpan:n}});return c(o[0]?.headers??[]),o}var ve=(e,t,n,r,i,a,o)=>{let s={id:t,index:r,original:n,depth:i,parentId:o,_valuesCache:{},_uniqueValuesCache:{},getValue:t=>{if(s._valuesCache.hasOwnProperty(t))return s._valuesCache[t];let n=e.getColumn(t);if(n!=null&&n.accessorFn)return s._valuesCache[t]=n.accessorFn(s.original,r),s._valuesCache[t]},getUniqueValues:t=>{if(s._uniqueValuesCache.hasOwnProperty(t))return s._uniqueValuesCache[t];let n=e.getColumn(t);if(n!=null&&n.accessorFn)return n.columnDef.getUniqueValues?(s._uniqueValuesCache[t]=n.columnDef.getUniqueValues(s.original,r),s._uniqueValuesCache[t]):(s._uniqueValuesCache[t]=[s.getValue(t)],s._uniqueValuesCache[t])},renderValue:t=>s.getValue(t)??e.options.renderFallbackValue,subRows:a??[],getLeafRows:()=>D(s.subRows,e=>e.subRows),getParentRow:()=>s.parentId?e.getRow(s.parentId,!0):void 0,getParentRows:()=>{let e=[],t=s;for(;;){let n=t.getParentRow();if(!n)break;e.push(n),t=n}return e.reverse()},getAllCells:O(()=>[e.getAllLeafColumns()],t=>t.map(t=>me(e,s,t,t.id)),k(e.options,`debugRows`,`getAllCells`)),_getAllCellsByColumnId:O(()=>[s.getAllCells()],e=>e.reduce((e,t)=>(e[t.column.id]=t,e),{}),k(e.options,`debugRows`,`getAllCellsByColumnId`))};for(let t=0;t<e._features.length;t++){let n=e._features[t];n==null||n.createRow==null||n.createRow(s,e)}return s},ye={createColumn:(e,t)=>{e._getFacetedRowModel=t.options.getFacetedRowModel&&t.options.getFacetedRowModel(t,e.id),e.getFacetedRowModel=()=>e._getFacetedRowModel?e._getFacetedRowModel():t.getPreFilteredRowModel(),e._getFacetedUniqueValues=t.options.getFacetedUniqueValues&&t.options.getFacetedUniqueValues(t,e.id),e.getFacetedUniqueValues=()=>e._getFacetedUniqueValues?e._getFacetedUniqueValues():new Map,e._getFacetedMinMaxValues=t.options.getFacetedMinMaxValues&&t.options.getFacetedMinMaxValues(t,e.id),e.getFacetedMinMaxValues=()=>{if(e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}}},be=(e,t,n)=>{var r,i;let a=n==null||(r=n.toString())==null?void 0:r.toLowerCase();return!!(!((i=e.getValue(t))==null||(i=i.toString())==null||(i=i.toLowerCase())==null)&&i.includes(a))};be.autoRemove=e=>z(e);var M=(e,t,n)=>{var r;return!!(!((r=e.getValue(t))==null||(r=r.toString())==null)&&r.includes(n))};M.autoRemove=e=>z(e);var N=(e,t,n)=>{var r;return((r=e.getValue(t))==null||(r=r.toString())==null?void 0:r.toLowerCase())===n?.toLowerCase()};N.autoRemove=e=>z(e);var xe=(e,t,n)=>e.getValue(t)?.includes(n);xe.autoRemove=e=>z(e);var Se=(e,t,n)=>!n.some(n=>{var r;return!((r=e.getValue(t))!=null&&r.includes(n))});Se.autoRemove=e=>z(e)||!(e!=null&&e.length);var P=(e,t,n)=>n.some(n=>e.getValue(t)?.includes(n));P.autoRemove=e=>z(e)||!(e!=null&&e.length);var F=(e,t,n)=>e.getValue(t)===n;F.autoRemove=e=>z(e);var I=(e,t,n)=>e.getValue(t)==n;I.autoRemove=e=>z(e);var L=(e,t,n)=>{let[r,i]=n,a=e.getValue(t);return a>=r&&a<=i};L.resolveFilterValue=e=>{let[t,n]=e,r=typeof t==`number`?t:parseFloat(t),i=typeof n==`number`?n:parseFloat(n),a=t===null||Number.isNaN(r)?-1/0:r,o=n===null||Number.isNaN(i)?1/0:i;if(a>o){let e=a;a=o,o=e}return[a,o]},L.autoRemove=e=>z(e)||z(e[0])&&z(e[1]);var R={includesString:be,includesStringSensitive:M,equalsString:N,arrIncludes:xe,arrIncludesAll:Se,arrIncludesSome:P,equals:F,weakEquals:I,inNumberRange:L};function z(e){return e==null||e===``}var Ce={getDefaultColumnDef:()=>({filterFn:`auto`}),getInitialState:e=>({columnFilters:[],...e}),getDefaultOptions:e=>({onColumnFiltersChange:T(`columnFilters`,e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),createColumn:(e,t)=>{e.getAutoFilterFn=()=>{let n=t.getCoreRowModel().flatRows[0]?.getValue(e.id);return typeof n==`string`?R.includesString:typeof n==`number`?R.inNumberRange:typeof n==`boolean`||typeof n==`object`&&n?R.equals:Array.isArray(n)?R.arrIncludes:R.weakEquals},e.getFilterFn=()=>E(e.columnDef.filterFn)?e.columnDef.filterFn:e.columnDef.filterFn===`auto`?e.getAutoFilterFn():t.options.filterFns?.[e.columnDef.filterFn]??R[e.columnDef.filterFn],e.getCanFilter=()=>(e.columnDef.enableColumnFilter??!0)&&(t.options.enableColumnFilters??!0)&&(t.options.enableFilters??!0)&&!!e.accessorFn,e.getIsFiltered=()=>e.getFilterIndex()>-1,e.getFilterValue=()=>{var n;return(n=t.getState().columnFilters)==null||(n=n.find(t=>t.id===e.id))==null?void 0:n.value},e.getFilterIndex=()=>t.getState().columnFilters?.findIndex(t=>t.id===e.id)??-1,e.setFilterValue=n=>{t.setColumnFilters(t=>{let r=e.getFilterFn(),i=t?.find(t=>t.id===e.id),a=w(n,i?i.value:void 0);if(B(r,a,e))return t?.filter(t=>t.id!==e.id)??[];let o={id:e.id,value:a};return i?t?.map(t=>t.id===e.id?o:t)??[]:t!=null&&t.length?[...t,o]:[o]})}},createRow:(e,t)=>{e.columnFilters={},e.columnFiltersMeta={}},createTable:e=>{e.setColumnFilters=t=>{let n=e.getAllLeafColumns();e.options.onColumnFiltersChange==null||e.options.onColumnFiltersChange(e=>w(t,e)?.filter(e=>{let t=n.find(t=>t.id===e.id);return!(t&&B(t.getFilterFn(),e.value,t))}))},e.resetColumnFilters=t=>{e.setColumnFilters(t?[]:e.initialState?.columnFilters??[])},e.getPreFilteredRowModel=()=>e.getCoreRowModel(),e.getFilteredRowModel=()=>(!e._getFilteredRowModel&&e.options.getFilteredRowModel&&(e._getFilteredRowModel=e.options.getFilteredRowModel(e)),e.options.manualFiltering||!e._getFilteredRowModel?e.getPreFilteredRowModel():e._getFilteredRowModel())}};function B(e,t,n){return(e&&e.autoRemove?e.autoRemove(t,n):!1)||t===void 0||typeof t==`string`&&!t}var V={sum:(e,t,n)=>n.reduce((t,n)=>{let r=n.getValue(e);return t+(typeof r==`number`?r:0)},0),min:(e,t,n)=>{let r;return n.forEach(t=>{let n=t.getValue(e);n!=null&&(r>n||r===void 0&&n>=n)&&(r=n)}),r},max:(e,t,n)=>{let r;return n.forEach(t=>{let n=t.getValue(e);n!=null&&(r<n||r===void 0&&n>=n)&&(r=n)}),r},extent:(e,t,n)=>{let r,i;return n.forEach(t=>{let n=t.getValue(e);n!=null&&(r===void 0?n>=n&&(r=i=n):(r>n&&(r=n),i<n&&(i=n)))}),[r,i]},mean:(e,t)=>{let n=0,r=0;if(t.forEach(t=>{let i=t.getValue(e);i!=null&&(i=+i)>=i&&(++n,r+=i)}),n)return r/n},median:(e,t)=>{if(!t.length)return;let n=t.map(t=>t.getValue(e));if(!pe(n))return;if(n.length===1)return n[0];let r=Math.floor(n.length/2),i=n.sort((e,t)=>e-t);return n.length%2==0?(i[r-1]+i[r])/2:i[r]},unique:(e,t)=>Array.from(new Set(t.map(t=>t.getValue(e))).values()),uniqueCount:(e,t)=>new Set(t.map(t=>t.getValue(e))).size,count:(e,t)=>t.length},H={getDefaultColumnDef:()=>({aggregatedCell:e=>{var t;return((t=e.getValue())==null||t.toString==null?void 0:t.toString())??null},aggregationFn:`auto`}),getInitialState:e=>({grouping:[],...e}),getDefaultOptions:e=>({onGroupingChange:T(`grouping`,e),groupedColumnMode:`reorder`}),createColumn:(e,t)=>{e.toggleGrouping=()=>{t.setGrouping(t=>t!=null&&t.includes(e.id)?t.filter(t=>t!==e.id):[...t??[],e.id])},e.getCanGroup=()=>(e.columnDef.enableGrouping??!0)&&(t.options.enableGrouping??!0)&&(!!e.accessorFn||!!e.columnDef.getGroupingValue),e.getIsGrouped=()=>t.getState().grouping?.includes(e.id),e.getGroupedIndex=()=>t.getState().grouping?.indexOf(e.id),e.getToggleGroupingHandler=()=>{let t=e.getCanGroup();return()=>{t&&e.toggleGrouping()}},e.getAutoAggregationFn=()=>{let n=t.getCoreRowModel().flatRows[0]?.getValue(e.id);if(typeof n==`number`)return V.sum;if(Object.prototype.toString.call(n)===`[object Date]`)return V.extent},e.getAggregationFn=()=>{if(!e)throw Error();return E(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:e.columnDef.aggregationFn===`auto`?e.getAutoAggregationFn():t.options.aggregationFns?.[e.columnDef.aggregationFn]??V[e.columnDef.aggregationFn]}},createTable:e=>{e.setGrouping=t=>e.options.onGroupingChange==null?void 0:e.options.onGroupingChange(t),e.resetGrouping=t=>{e.setGrouping(t?[]:e.initialState?.grouping??[])},e.getPreGroupedRowModel=()=>e.getFilteredRowModel(),e.getGroupedRowModel=()=>(!e._getGroupedRowModel&&e.options.getGroupedRowModel&&(e._getGroupedRowModel=e.options.getGroupedRowModel(e)),e.options.manualGrouping||!e._getGroupedRowModel?e.getPreGroupedRowModel():e._getGroupedRowModel())},createRow:(e,t)=>{e.getIsGrouped=()=>!!e.groupingColumnId,e.getGroupingValue=n=>{if(e._groupingValuesCache.hasOwnProperty(n))return e._groupingValuesCache[n];let r=t.getColumn(n);return r!=null&&r.columnDef.getGroupingValue?(e._groupingValuesCache[n]=r.columnDef.getGroupingValue(e.original),e._groupingValuesCache[n]):e.getValue(n)},e._groupingValuesCache={}},createCell:(e,t,n,r)=>{e.getIsGrouped=()=>t.getIsGrouped()&&t.id===n.groupingColumnId,e.getIsPlaceholder=()=>!e.getIsGrouped()&&t.getIsGrouped(),e.getIsAggregated=()=>{var t;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!!((t=n.subRows)!=null&&t.length)}}};function we(e,t,n){if(!(t!=null&&t.length)||!n)return e;let r=e.filter(e=>!t.includes(e.id));return n===`remove`?r:[...t.map(t=>e.find(e=>e.id===t)).filter(Boolean),...r]}var Te={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:T(`columnOrder`,e)}),createColumn:(e,t)=>{e.getIndex=O(e=>[J(t,e)],t=>t.findIndex(t=>t.id===e.id),k(t.options,`debugColumns`,`getIndex`)),e.getIsFirstColumn=n=>J(t,n)[0]?.id===e.id,e.getIsLastColumn=n=>{let r=J(t,n);return r[r.length-1]?.id===e.id}},createTable:e=>{e.setColumnOrder=t=>e.options.onColumnOrderChange==null?void 0:e.options.onColumnOrderChange(t),e.resetColumnOrder=t=>{e.setColumnOrder(t?[]:e.initialState.columnOrder??[])},e._getOrderColumnsFn=O(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(e,t,n)=>r=>{let i=[];if(!(e!=null&&e.length))i=r;else{let t=[...e],n=[...r];for(;n.length&&t.length;){let e=t.shift(),r=n.findIndex(t=>t.id===e);r>-1&&i.push(n.splice(r,1)[0])}i=[...i,...n]}return we(i,t,n)},k(e.options,`debugTable`,`_getOrderColumnsFn`))}},U=()=>({left:[],right:[]}),Ee={getInitialState:e=>({columnPinning:U(),...e}),getDefaultOptions:e=>({onColumnPinningChange:T(`columnPinning`,e)}),createColumn:(e,t)=>{e.pin=n=>{let r=e.getLeafColumns().map(e=>e.id).filter(Boolean);t.setColumnPinning(e=>n===`right`?{left:(e?.left??[]).filter(e=>!(r!=null&&r.includes(e))),right:[...(e?.right??[]).filter(e=>!(r!=null&&r.includes(e))),...r]}:n===`left`?{left:[...(e?.left??[]).filter(e=>!(r!=null&&r.includes(e))),...r],right:(e?.right??[]).filter(e=>!(r!=null&&r.includes(e)))}:{left:(e?.left??[]).filter(e=>!(r!=null&&r.includes(e))),right:(e?.right??[]).filter(e=>!(r!=null&&r.includes(e)))})},e.getCanPin=()=>e.getLeafColumns().some(e=>(e.columnDef.enablePinning??!0)&&(t.options.enableColumnPinning??t.options.enablePinning??!0)),e.getIsPinned=()=>{let n=e.getLeafColumns().map(e=>e.id),{left:r,right:i}=t.getState().columnPinning,a=n.some(e=>r?.includes(e)),o=n.some(e=>i?.includes(e));return a?`left`:o?`right`:!1},e.getPinnedIndex=()=>{var n;let r=e.getIsPinned();return r?((n=t.getState().columnPinning)==null||(n=n[r])==null?void 0:n.indexOf(e.id))??-1:0}},createRow:(e,t)=>{e.getCenterVisibleCells=O(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left,t.getState().columnPinning.right],(e,t,n)=>{let r=[...t??[],...n??[]];return e.filter(e=>!r.includes(e.column.id))},k(t.options,`debugRows`,`getCenterVisibleCells`)),e.getLeftVisibleCells=O(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left],(e,t)=>(t??[]).map(t=>e.find(e=>e.column.id===t)).filter(Boolean).map(e=>({...e,position:`left`})),k(t.options,`debugRows`,`getLeftVisibleCells`)),e.getRightVisibleCells=O(()=>[e._getAllVisibleCells(),t.getState().columnPinning.right],(e,t)=>(t??[]).map(t=>e.find(e=>e.column.id===t)).filter(Boolean).map(e=>({...e,position:`right`})),k(t.options,`debugRows`,`getRightVisibleCells`))},createTable:e=>{e.setColumnPinning=t=>e.options.onColumnPinningChange==null?void 0:e.options.onColumnPinningChange(t),e.resetColumnPinning=t=>e.setColumnPinning(t?U():e.initialState?.columnPinning??U()),e.getIsSomeColumnsPinned=t=>{let n=e.getState().columnPinning;return t?!!n[t]?.length:!!(n.left?.length||n.right?.length)},e.getLeftLeafColumns=O(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(e,t)=>(t??[]).map(t=>e.find(e=>e.id===t)).filter(Boolean),k(e.options,`debugColumns`,`getLeftLeafColumns`)),e.getRightLeafColumns=O(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(e,t)=>(t??[]).map(t=>e.find(e=>e.id===t)).filter(Boolean),k(e.options,`debugColumns`,`getRightLeafColumns`)),e.getCenterLeafColumns=O(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(e,t,n)=>{let r=[...t??[],...n??[]];return e.filter(e=>!r.includes(e.id))},k(e.options,`debugColumns`,`getCenterLeafColumns`))}};function De(e){return e||(typeof document<`u`?document:null)}var W={size:150,minSize:20,maxSize:2**53-1},G=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),Oe={getDefaultColumnDef:()=>W,getInitialState:e=>({columnSizing:{},columnSizingInfo:G(),...e}),getDefaultOptions:e=>({columnResizeMode:`onEnd`,columnResizeDirection:`ltr`,onColumnSizingChange:T(`columnSizing`,e),onColumnSizingInfoChange:T(`columnSizingInfo`,e)}),createColumn:(e,t)=>{e.getSize=()=>{let n=t.getState().columnSizing[e.id];return Math.min(Math.max(e.columnDef.minSize??W.minSize,n??e.columnDef.size??W.size),e.columnDef.maxSize??W.maxSize)},e.getStart=O(e=>[e,J(t,e),t.getState().columnSizing],(t,n)=>n.slice(0,e.getIndex(t)).reduce((e,t)=>e+t.getSize(),0),k(t.options,`debugColumns`,`getStart`)),e.getAfter=O(e=>[e,J(t,e),t.getState().columnSizing],(t,n)=>n.slice(e.getIndex(t)+1).reduce((e,t)=>e+t.getSize(),0),k(t.options,`debugColumns`,`getAfter`)),e.resetSize=()=>{t.setColumnSizing(t=>{let{[e.id]:n,...r}=t;return r})},e.getCanResize=()=>(e.columnDef.enableResizing??!0)&&(t.options.enableColumnResizing??!0),e.getIsResizing=()=>t.getState().columnSizingInfo.isResizingColumn===e.id},createHeader:(e,t)=>{e.getSize=()=>{let t=0,n=e=>{e.subHeaders.length?e.subHeaders.forEach(n):t+=e.column.getSize()??0};return n(e),t},e.getStart=()=>{if(e.index>0){let t=e.headerGroup.headers[e.index-1];return t.getStart()+t.getSize()}return 0},e.getResizeHandler=n=>{let r=t.getColumn(e.column.id),i=r?.getCanResize();return a=>{if(!r||!i||(a.persist==null||a.persist(),q(a)&&a.touches&&a.touches.length>1))return;let o=e.getSize(),s=e?e.getLeafHeaders().map(e=>[e.column.id,e.column.getSize()]):[[r.id,r.getSize()]],c=q(a)?Math.round(a.touches[0].clientX):a.clientX,l={},u=(e,n)=>{typeof n==`number`&&(t.setColumnSizingInfo(e=>{let r=t.options.columnResizeDirection===`rtl`?-1:1,i=(n-(e?.startOffset??0))*r,a=Math.max(i/(e?.startSize??0),-.999999);return e.columnSizingStart.forEach(e=>{let[t,n]=e;l[t]=Math.round(Math.max(n+n*a,0)*100)/100}),{...e,deltaOffset:i,deltaPercentage:a}}),(t.options.columnResizeMode===`onChange`||e===`end`)&&t.setColumnSizing(e=>({...e,...l})))},d=e=>u(`move`,e),f=e=>{u(`end`,e),t.setColumnSizingInfo(e=>({...e,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},p=De(n),m={moveHandler:e=>d(e.clientX),upHandler:e=>{p?.removeEventListener(`mousemove`,m.moveHandler),p?.removeEventListener(`mouseup`,m.upHandler),f(e.clientX)}},h={moveHandler:e=>(e.cancelable&&(e.preventDefault(),e.stopPropagation()),d(e.touches[0].clientX),!1),upHandler:e=>{p?.removeEventListener(`touchmove`,h.moveHandler),p?.removeEventListener(`touchend`,h.upHandler),e.cancelable&&(e.preventDefault(),e.stopPropagation()),f(e.touches[0]?.clientX)}},g=ke()?{passive:!1}:!1;q(a)?(p?.addEventListener(`touchmove`,h.moveHandler,g),p?.addEventListener(`touchend`,h.upHandler,g)):(p?.addEventListener(`mousemove`,m.moveHandler,g),p?.addEventListener(`mouseup`,m.upHandler,g)),t.setColumnSizingInfo(e=>({...e,startOffset:c,startSize:o,deltaOffset:0,deltaPercentage:0,columnSizingStart:s,isResizingColumn:r.id}))}}},createTable:e=>{e.setColumnSizing=t=>e.options.onColumnSizingChange==null?void 0:e.options.onColumnSizingChange(t),e.setColumnSizingInfo=t=>e.options.onColumnSizingInfoChange==null?void 0:e.options.onColumnSizingInfoChange(t),e.resetColumnSizing=t=>{e.setColumnSizing(t?{}:e.initialState.columnSizing??{})},e.resetHeaderSizeInfo=t=>{e.setColumnSizingInfo(t?G():e.initialState.columnSizingInfo??G())},e.getTotalSize=()=>e.getHeaderGroups()[0]?.headers.reduce((e,t)=>e+t.getSize(),0)??0,e.getLeftTotalSize=()=>e.getLeftHeaderGroups()[0]?.headers.reduce((e,t)=>e+t.getSize(),0)??0,e.getCenterTotalSize=()=>e.getCenterHeaderGroups()[0]?.headers.reduce((e,t)=>e+t.getSize(),0)??0,e.getRightTotalSize=()=>e.getRightHeaderGroups()[0]?.headers.reduce((e,t)=>e+t.getSize(),0)??0}},K=null;function ke(){if(typeof K==`boolean`)return K;let e=!1;try{let t={get passive(){return e=!0,!1}},n=()=>{};window.addEventListener(`test`,n,t),window.removeEventListener(`test`,n)}catch{e=!1}return K=e,K}function q(e){return e.type===`touchstart`}var Ae={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:T(`columnVisibility`,e)}),createColumn:(e,t)=>{e.toggleVisibility=n=>{e.getCanHide()&&t.setColumnVisibility(t=>({...t,[e.id]:n??!e.getIsVisible()}))},e.getIsVisible=()=>{let n=e.columns;return(n.length?n.some(e=>e.getIsVisible()):t.getState().columnVisibility?.[e.id])??!0},e.getCanHide=()=>(e.columnDef.enableHiding??!0)&&(t.options.enableHiding??!0),e.getToggleVisibilityHandler=()=>t=>{e.toggleVisibility==null||e.toggleVisibility(t.target.checked)}},createRow:(e,t)=>{e._getAllVisibleCells=O(()=>[e.getAllCells(),t.getState().columnVisibility],e=>e.filter(e=>e.column.getIsVisible()),k(t.options,`debugRows`,`_getAllVisibleCells`)),e.getVisibleCells=O(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(e,t,n)=>[...e,...t,...n],k(t.options,`debugRows`,`getVisibleCells`))},createTable:e=>{let t=(t,n)=>O(()=>[n(),n().filter(e=>e.getIsVisible()).map(e=>e.id).join(`_`)],e=>e.filter(e=>e.getIsVisible==null?void 0:e.getIsVisible()),k(e.options,`debugColumns`,t));e.getVisibleFlatColumns=t(`getVisibleFlatColumns`,()=>e.getAllFlatColumns()),e.getVisibleLeafColumns=t(`getVisibleLeafColumns`,()=>e.getAllLeafColumns()),e.getLeftVisibleLeafColumns=t(`getLeftVisibleLeafColumns`,()=>e.getLeftLeafColumns()),e.getRightVisibleLeafColumns=t(`getRightVisibleLeafColumns`,()=>e.getRightLeafColumns()),e.getCenterVisibleLeafColumns=t(`getCenterVisibleLeafColumns`,()=>e.getCenterLeafColumns()),e.setColumnVisibility=t=>e.options.onColumnVisibilityChange==null?void 0:e.options.onColumnVisibilityChange(t),e.resetColumnVisibility=t=>{e.setColumnVisibility(t?{}:e.initialState.columnVisibility??{})},e.toggleAllColumnsVisible=t=>{t??=!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce((e,n)=>({...e,[n.id]:t||!(n.getCanHide!=null&&n.getCanHide())}),{}))},e.getIsAllColumnsVisible=()=>!e.getAllLeafColumns().some(e=>!(e.getIsVisible!=null&&e.getIsVisible())),e.getIsSomeColumnsVisible=()=>e.getAllLeafColumns().some(e=>e.getIsVisible==null?void 0:e.getIsVisible()),e.getToggleAllColumnsVisibilityHandler=()=>t=>{e.toggleAllColumnsVisible(t.target?.checked)}}};function J(e,t){return t?t===`center`?e.getCenterVisibleLeafColumns():t===`left`?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}var je={createTable:e=>{e._getGlobalFacetedRowModel=e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,`__global__`),e.getGlobalFacetedRowModel=()=>e.options.manualFiltering||!e._getGlobalFacetedRowModel?e.getPreFilteredRowModel():e._getGlobalFacetedRowModel(),e._getGlobalFacetedUniqueValues=e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,`__global__`),e.getGlobalFacetedUniqueValues=()=>e._getGlobalFacetedUniqueValues?e._getGlobalFacetedUniqueValues():new Map,e._getGlobalFacetedMinMaxValues=e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,`__global__`),e.getGlobalFacetedMinMaxValues=()=>{if(e._getGlobalFacetedMinMaxValues)return e._getGlobalFacetedMinMaxValues()}}},Me={getInitialState:e=>({globalFilter:void 0,...e}),getDefaultOptions:e=>({onGlobalFilterChange:T(`globalFilter`,e),globalFilterFn:`auto`,getColumnCanGlobalFilter:t=>{var n;let r=(n=e.getCoreRowModel().flatRows[0])==null||(n=n._getAllCellsByColumnId()[t.id])==null?void 0:n.getValue();return typeof r==`string`||typeof r==`number`}}),createColumn:(e,t)=>{e.getCanGlobalFilter=()=>(e.columnDef.enableGlobalFilter??!0)&&(t.options.enableGlobalFilter??!0)&&(t.options.enableFilters??!0)&&((t.options.getColumnCanGlobalFilter==null?void 0:t.options.getColumnCanGlobalFilter(e))??!0)&&!!e.accessorFn},createTable:e=>{e.getGlobalAutoFilterFn=()=>R.includesString,e.getGlobalFilterFn=()=>{let{globalFilterFn:t}=e.options;return E(t)?t:t===`auto`?e.getGlobalAutoFilterFn():e.options.filterFns?.[t]??R[t]},e.setGlobalFilter=t=>{e.options.onGlobalFilterChange==null||e.options.onGlobalFilterChange(t)},e.resetGlobalFilter=t=>{e.setGlobalFilter(t?void 0:e.initialState.globalFilter)}}},Ne={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:T(`expanded`,e),paginateExpandedRows:!0}),createTable:e=>{let t=!1,n=!1;e._autoResetExpanded=()=>{if(!t){e._queue(()=>{t=!0});return}if(e.options.autoResetAll??e.options.autoResetExpanded??!e.options.manualExpanding){if(n)return;n=!0,e._queue(()=>{e.resetExpanded(),n=!1})}},e.setExpanded=t=>e.options.onExpandedChange==null?void 0:e.options.onExpandedChange(t),e.toggleAllRowsExpanded=t=>{t??!e.getIsAllRowsExpanded()?e.setExpanded(!0):e.setExpanded({})},e.resetExpanded=t=>{e.setExpanded(t?{}:e.initialState?.expanded??{})},e.getCanSomeRowsExpand=()=>e.getPrePaginationRowModel().flatRows.some(e=>e.getCanExpand()),e.getToggleAllRowsExpandedHandler=()=>t=>{t.persist==null||t.persist(),e.toggleAllRowsExpanded()},e.getIsSomeRowsExpanded=()=>{let t=e.getState().expanded;return t===!0||Object.values(t).some(Boolean)},e.getIsAllRowsExpanded=()=>{let t=e.getState().expanded;return typeof t==`boolean`?t===!0:!(!Object.keys(t).length||e.getRowModel().flatRows.some(e=>!e.getIsExpanded()))},e.getExpandedDepth=()=>{let t=0;return(e.getState().expanded===!0?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach(e=>{let n=e.split(`.`);t=Math.max(t,n.length)}),t},e.getPreExpandedRowModel=()=>e.getSortedRowModel(),e.getExpandedRowModel=()=>(!e._getExpandedRowModel&&e.options.getExpandedRowModel&&(e._getExpandedRowModel=e.options.getExpandedRowModel(e)),e.options.manualExpanding||!e._getExpandedRowModel?e.getPreExpandedRowModel():e._getExpandedRowModel())},createRow:(e,t)=>{e.toggleExpanded=n=>{t.setExpanded(r=>{let i=r===!0?!0:!!(r!=null&&r[e.id]),a={};if(r===!0?Object.keys(t.getRowModel().rowsById).forEach(e=>{a[e]=!0}):a=r,n??=!i,!i&&n)return{...a,[e.id]:!0};if(i&&!n){let{[e.id]:t,...n}=a;return n}return r})},e.getIsExpanded=()=>{let n=t.getState().expanded;return!!((t.options.getIsRowExpanded==null?void 0:t.options.getIsRowExpanded(e))??(n===!0||n?.[e.id]))},e.getCanExpand=()=>{var n;return(t.options.getRowCanExpand==null?void 0:t.options.getRowCanExpand(e))??((t.options.enableExpanding??!0)&&!!((n=e.subRows)!=null&&n.length))},e.getIsAllParentsExpanded=()=>{let n=!0,r=e;for(;n&&r.parentId;)r=t.getRow(r.parentId,!0),n=r.getIsExpanded();return n},e.getToggleExpandedHandler=()=>{let t=e.getCanExpand();return()=>{t&&e.toggleExpanded()}}}},Pe=0,Fe=10,Ie=()=>({pageIndex:Pe,pageSize:Fe}),Le={getInitialState:e=>({...e,pagination:{...Ie(),...e?.pagination}}),getDefaultOptions:e=>({onPaginationChange:T(`pagination`,e)}),createTable:e=>{let t=!1,n=!1;e._autoResetPageIndex=()=>{if(!t){e._queue(()=>{t=!0});return}if(e.options.autoResetAll??e.options.autoResetPageIndex??!e.options.manualPagination){if(n)return;n=!0,e._queue(()=>{e.resetPageIndex(),n=!1})}},e.setPagination=t=>e.options.onPaginationChange==null?void 0:e.options.onPaginationChange(e=>w(t,e)),e.resetPagination=t=>{e.setPagination(t?Ie():e.initialState.pagination??Ie())},e.setPageIndex=t=>{e.setPagination(n=>{let r=w(t,n.pageIndex),i=e.options.pageCount===void 0||e.options.pageCount===-1?2**53-1:e.options.pageCount-1;return r=Math.max(0,Math.min(r,i)),{...n,pageIndex:r}})},e.resetPageIndex=t=>{var n;e.setPageIndex(t?Pe:((n=e.initialState)==null||(n=n.pagination)==null?void 0:n.pageIndex)??Pe)},e.resetPageSize=t=>{var n;e.setPageSize(t?Fe:((n=e.initialState)==null||(n=n.pagination)==null?void 0:n.pageSize)??Fe)},e.setPageSize=t=>{e.setPagination(e=>{let n=Math.max(1,w(t,e.pageSize)),r=e.pageSize*e.pageIndex,i=Math.floor(r/n);return{...e,pageIndex:i,pageSize:n}})},e.setPageCount=t=>e.setPagination(n=>{let r=w(t,e.options.pageCount??-1);return typeof r==`number`&&(r=Math.max(-1,r)),{...n,pageCount:r}}),e.getPageOptions=O(()=>[e.getPageCount()],e=>{let t=[];return e&&e>0&&(t=[...Array(e)].fill(null).map((e,t)=>t)),t},k(e.options,`debugTable`,`getPageOptions`)),e.getCanPreviousPage=()=>e.getState().pagination.pageIndex>0,e.getCanNextPage=()=>{let{pageIndex:t}=e.getState().pagination,n=e.getPageCount();return n===-1?!0:n===0?!1:t<n-1},e.previousPage=()=>e.setPageIndex(e=>e-1),e.nextPage=()=>e.setPageIndex(e=>e+1),e.firstPage=()=>e.setPageIndex(0),e.lastPage=()=>e.setPageIndex(e.getPageCount()-1),e.getPrePaginationRowModel=()=>e.getExpandedRowModel(),e.getPaginationRowModel=()=>(!e._getPaginationRowModel&&e.options.getPaginationRowModel&&(e._getPaginationRowModel=e.options.getPaginationRowModel(e)),e.options.manualPagination||!e._getPaginationRowModel?e.getPrePaginationRowModel():e._getPaginationRowModel()),e.getPageCount=()=>e.options.pageCount??Math.ceil(e.getRowCount()/e.getState().pagination.pageSize),e.getRowCount=()=>e.options.rowCount??e.getPrePaginationRowModel().rows.length}},Re=()=>({top:[],bottom:[]}),ze={getInitialState:e=>({rowPinning:Re(),...e}),getDefaultOptions:e=>({onRowPinningChange:T(`rowPinning`,e)}),createRow:(e,t)=>{e.pin=(n,r,i)=>{let a=r?e.getLeafRows().map(e=>{let{id:t}=e;return t}):[],o=i?e.getParentRows().map(e=>{let{id:t}=e;return t}):[],s=new Set([...o,e.id,...a]);t.setRowPinning(e=>n===`bottom`?{top:(e?.top??[]).filter(e=>!(s!=null&&s.has(e))),bottom:[...(e?.bottom??[]).filter(e=>!(s!=null&&s.has(e))),...Array.from(s)]}:n===`top`?{top:[...(e?.top??[]).filter(e=>!(s!=null&&s.has(e))),...Array.from(s)],bottom:(e?.bottom??[]).filter(e=>!(s!=null&&s.has(e)))}:{top:(e?.top??[]).filter(e=>!(s!=null&&s.has(e))),bottom:(e?.bottom??[]).filter(e=>!(s!=null&&s.has(e)))})},e.getCanPin=()=>{let{enableRowPinning:n,enablePinning:r}=t.options;return typeof n==`function`?n(e):n??r??!0},e.getIsPinned=()=>{let n=[e.id],{top:r,bottom:i}=t.getState().rowPinning,a=n.some(e=>r?.includes(e)),o=n.some(e=>i?.includes(e));return a?`top`:o?`bottom`:!1},e.getPinnedIndex=()=>{let n=e.getIsPinned();return n?((n===`top`?t.getTopRows():t.getBottomRows())?.map(e=>{let{id:t}=e;return t}))?.indexOf(e.id)??-1:-1}},createTable:e=>{e.setRowPinning=t=>e.options.onRowPinningChange==null?void 0:e.options.onRowPinningChange(t),e.resetRowPinning=t=>e.setRowPinning(t?Re():e.initialState?.rowPinning??Re()),e.getIsSomeRowsPinned=t=>{let n=e.getState().rowPinning;return t?!!n[t]?.length:!!(n.top?.length||n.bottom?.length)},e._getPinnedRows=(t,n,r)=>(e.options.keepPinnedRows??!0?(n??[]).map(t=>{let n=e.getRow(t,!0);return n.getIsAllParentsExpanded()?n:null}):(n??[]).map(e=>t.find(t=>t.id===e))).filter(Boolean).map(e=>({...e,position:r})),e.getTopRows=O(()=>[e.getRowModel().rows,e.getState().rowPinning.top],(t,n)=>e._getPinnedRows(t,n,`top`),k(e.options,`debugRows`,`getTopRows`)),e.getBottomRows=O(()=>[e.getRowModel().rows,e.getState().rowPinning.bottom],(t,n)=>e._getPinnedRows(t,n,`bottom`),k(e.options,`debugRows`,`getBottomRows`)),e.getCenterRows=O(()=>[e.getRowModel().rows,e.getState().rowPinning.top,e.getState().rowPinning.bottom],(e,t,n)=>{let r=new Set([...t??[],...n??[]]);return e.filter(e=>!r.has(e.id))},k(e.options,`debugRows`,`getCenterRows`))}},Be={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:T(`rowSelection`,e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:e=>{e.setRowSelection=t=>e.options.onRowSelectionChange==null?void 0:e.options.onRowSelectionChange(t),e.resetRowSelection=t=>e.setRowSelection(t?{}:e.initialState.rowSelection??{}),e.toggleAllRowsSelected=t=>{e.setRowSelection(n=>{t=t===void 0?!e.getIsAllRowsSelected():t;let r={...n},i=e.getPreGroupedRowModel().flatRows;return t?i.forEach(e=>{e.getCanSelect()&&(r[e.id]=!0)}):i.forEach(e=>{delete r[e.id]}),r})},e.toggleAllPageRowsSelected=t=>e.setRowSelection(n=>{let r=t===void 0?!e.getIsAllPageRowsSelected():t,i={...n};return e.getRowModel().rows.forEach(t=>{Ve(i,t.id,r,!0,e)}),i}),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=O(()=>[e.getState().rowSelection,e.getCoreRowModel()],(t,n)=>Object.keys(t).length?He(e,n):{rows:[],flatRows:[],rowsById:{}},k(e.options,`debugTable`,`getSelectedRowModel`)),e.getFilteredSelectedRowModel=O(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(t,n)=>Object.keys(t).length?He(e,n):{rows:[],flatRows:[],rowsById:{}},k(e.options,`debugTable`,`getFilteredSelectedRowModel`)),e.getGroupedSelectedRowModel=O(()=>[e.getState().rowSelection,e.getSortedRowModel()],(t,n)=>Object.keys(t).length?He(e,n):{rows:[],flatRows:[],rowsById:{}},k(e.options,`debugTable`,`getGroupedSelectedRowModel`)),e.getIsAllRowsSelected=()=>{let t=e.getFilteredRowModel().flatRows,{rowSelection:n}=e.getState(),r=!!(t.length&&Object.keys(n).length);return r&&t.some(e=>e.getCanSelect()&&!n[e.id])&&(r=!1),r},e.getIsAllPageRowsSelected=()=>{let t=e.getPaginationRowModel().flatRows.filter(e=>e.getCanSelect()),{rowSelection:n}=e.getState(),r=!!t.length;return r&&t.some(e=>!n[e.id])&&(r=!1),r},e.getIsSomeRowsSelected=()=>{let t=Object.keys(e.getState().rowSelection??{}).length;return t>0&&t<e.getFilteredRowModel().flatRows.length},e.getIsSomePageRowsSelected=()=>{let t=e.getPaginationRowModel().flatRows;return e.getIsAllPageRowsSelected()?!1:t.filter(e=>e.getCanSelect()).some(e=>e.getIsSelected()||e.getIsSomeSelected())},e.getToggleAllRowsSelectedHandler=()=>t=>{e.toggleAllRowsSelected(t.target.checked)},e.getToggleAllPageRowsSelectedHandler=()=>t=>{e.toggleAllPageRowsSelected(t.target.checked)}},createRow:(e,t)=>{e.toggleSelected=(n,r)=>{let i=e.getIsSelected();t.setRowSelection(a=>{if(n=n===void 0?!i:n,e.getCanSelect()&&i===n)return a;let o={...a};return Ve(o,e.id,n,r?.selectChildren??!0,t),o})},e.getIsSelected=()=>{let{rowSelection:n}=t.getState();return Ue(e,n)},e.getIsSomeSelected=()=>{let{rowSelection:n}=t.getState();return We(e,n)===`some`},e.getIsAllSubRowsSelected=()=>{let{rowSelection:n}=t.getState();return We(e,n)===`all`},e.getCanSelect=()=>typeof t.options.enableRowSelection==`function`?t.options.enableRowSelection(e):t.options.enableRowSelection??!0,e.getCanSelectSubRows=()=>typeof t.options.enableSubRowSelection==`function`?t.options.enableSubRowSelection(e):t.options.enableSubRowSelection??!0,e.getCanMultiSelect=()=>typeof t.options.enableMultiRowSelection==`function`?t.options.enableMultiRowSelection(e):t.options.enableMultiRowSelection??!0,e.getToggleSelectedHandler=()=>{let t=e.getCanSelect();return n=>{t&&e.toggleSelected(n.target?.checked)}}}},Ve=(e,t,n,r,i)=>{var a;let o=i.getRow(t,!0);n?(o.getCanMultiSelect()||Object.keys(e).forEach(t=>delete e[t]),o.getCanSelect()&&(e[t]=!0)):delete e[t],r&&(a=o.subRows)!=null&&a.length&&o.getCanSelectSubRows()&&o.subRows.forEach(t=>Ve(e,t.id,n,r,i))};function He(e,t){let n=e.getState().rowSelection,r=[],i={},a=function(e,t){return e.map(e=>{var t;let o=Ue(e,n);if(o&&(r.push(e),i[e.id]=e),(t=e.subRows)!=null&&t.length&&(e={...e,subRows:a(e.subRows)}),o)return e}).filter(Boolean)};return{rows:a(t.rows),flatRows:r,rowsById:i}}function Ue(e,t){return t[e.id]??!1}function We(e,t,n){var r;if(!((r=e.subRows)!=null&&r.length))return!1;let i=!0,a=!1;return e.subRows.forEach(e=>{if(!(a&&!i)&&(e.getCanSelect()&&(Ue(e,t)?a=!0:i=!1),e.subRows&&e.subRows.length)){let n=We(e,t);n===`all`?a=!0:(n===`some`&&(a=!0),i=!1)}}),i?`all`:a?`some`:!1}var Ge=/([0-9]+)/gm,Ke=(e,t,n)=>$e(Y(e.getValue(n)).toLowerCase(),Y(t.getValue(n)).toLowerCase()),qe=(e,t,n)=>$e(Y(e.getValue(n)),Y(t.getValue(n))),Je=(e,t,n)=>Qe(Y(e.getValue(n)).toLowerCase(),Y(t.getValue(n)).toLowerCase()),Ye=(e,t,n)=>Qe(Y(e.getValue(n)),Y(t.getValue(n))),Xe=(e,t,n)=>{let r=e.getValue(n),i=t.getValue(n);return r>i?1:r<i?-1:0},Ze=(e,t,n)=>Qe(e.getValue(n),t.getValue(n));function Qe(e,t){return e===t?0:e>t?1:-1}function Y(e){return typeof e==`number`?isNaN(e)||e===1/0||e===-1/0?``:String(e):typeof e==`string`?e:``}function $e(e,t){let n=e.split(Ge).filter(Boolean),r=t.split(Ge).filter(Boolean);for(;n.length&&r.length;){let e=n.shift(),t=r.shift(),i=parseInt(e,10),a=parseInt(t,10),o=[i,a].sort();if(isNaN(o[0])){if(e>t)return 1;if(t>e)return-1;continue}if(isNaN(o[1]))return isNaN(i)?-1:1;if(i>a)return 1;if(a>i)return-1}return n.length-r.length}var X={alphanumeric:Ke,alphanumericCaseSensitive:qe,text:Je,textCaseSensitive:Ye,datetime:Xe,basic:Ze},et=[_e,Ae,Te,Ee,ye,Ce,je,Me,{getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:`auto`,sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:T(`sorting`,e),isMultiSortEvent:e=>e.shiftKey}),createColumn:(e,t)=>{e.getAutoSortingFn=()=>{let n=t.getFilteredRowModel().flatRows.slice(10),r=!1;for(let t of n){let n=t?.getValue(e.id);if(Object.prototype.toString.call(n)===`[object Date]`)return X.datetime;if(typeof n==`string`&&(r=!0,n.split(Ge).length>1))return X.alphanumeric}return r?X.text:X.basic},e.getAutoSortDir=()=>typeof t.getFilteredRowModel().flatRows[0]?.getValue(e.id)==`string`?`asc`:`desc`,e.getSortingFn=()=>{if(!e)throw Error();return E(e.columnDef.sortingFn)?e.columnDef.sortingFn:e.columnDef.sortingFn===`auto`?e.getAutoSortingFn():t.options.sortingFns?.[e.columnDef.sortingFn]??X[e.columnDef.sortingFn]},e.toggleSorting=(n,r)=>{let i=e.getNextSortingOrder(),a=n!=null;t.setSorting(o=>{let s=o?.find(t=>t.id===e.id),c=o?.findIndex(t=>t.id===e.id),l=[],u,d=a?n:i===`desc`;return u=o!=null&&o.length&&e.getCanMultiSort()&&r?s?`toggle`:`add`:o!=null&&o.length&&c!==o.length-1?`replace`:s?`toggle`:`replace`,u===`toggle`&&(a||i||(u=`remove`)),u===`add`?(l=[...o,{id:e.id,desc:d}],l.splice(0,l.length-(t.options.maxMultiSortColCount??2**53-1))):l=u===`toggle`?o.map(t=>t.id===e.id?{...t,desc:d}:t):u===`remove`?o.filter(t=>t.id!==e.id):[{id:e.id,desc:d}],l})},e.getFirstSortDir=()=>e.columnDef.sortDescFirst??t.options.sortDescFirst??e.getAutoSortDir()===`desc`?`desc`:`asc`,e.getNextSortingOrder=n=>{let r=e.getFirstSortDir(),i=e.getIsSorted();return i?i!==r&&(t.options.enableSortingRemoval??!0)&&(!n||(t.options.enableMultiRemove??!0))?!1:i===`desc`?`asc`:`desc`:r},e.getCanSort=()=>(e.columnDef.enableSorting??!0)&&(t.options.enableSorting??!0)&&!!e.accessorFn,e.getCanMultiSort=()=>e.columnDef.enableMultiSort??t.options.enableMultiSort??!!e.accessorFn,e.getIsSorted=()=>{let n=t.getState().sorting?.find(t=>t.id===e.id);return n?n.desc?`desc`:`asc`:!1},e.getSortIndex=()=>t.getState().sorting?.findIndex(t=>t.id===e.id)??-1,e.clearSorting=()=>{t.setSorting(t=>t!=null&&t.length?t.filter(t=>t.id!==e.id):[])},e.getToggleSortingHandler=()=>{let n=e.getCanSort();return r=>{n&&(r.persist==null||r.persist(),e.toggleSorting==null||e.toggleSorting(void 0,e.getCanMultiSort()?t.options.isMultiSortEvent==null?void 0:t.options.isMultiSortEvent(r):!1))}}},createTable:e=>{e.setSorting=t=>e.options.onSortingChange==null?void 0:e.options.onSortingChange(t),e.resetSorting=t=>{e.setSorting(t?[]:e.initialState?.sorting??[])},e.getPreSortedRowModel=()=>e.getGroupedRowModel(),e.getSortedRowModel=()=>(!e._getSortedRowModel&&e.options.getSortedRowModel&&(e._getSortedRowModel=e.options.getSortedRowModel(e)),e.options.manualSorting||!e._getSortedRowModel?e.getPreSortedRowModel():e._getSortedRowModel())}},H,Ne,Le,ze,Be,Oe];function tt(e){let t=[...et,...e._features??[]],n={_features:t},r=n._features.reduce((e,t)=>Object.assign(e,t.getDefaultOptions==null?void 0:t.getDefaultOptions(n)),{}),i=e=>n.options.mergeOptions?n.options.mergeOptions(r,e):{...r,...e},a={...e.initialState??{}};n._features.forEach(e=>{a=(e.getInitialState==null?void 0:e.getInitialState(a))??a});let o=[],s=!1,c={_features:t,options:{...r,...e},initialState:a,_queue:e=>{o.push(e),s||(s=!0,Promise.resolve().then(()=>{for(;o.length;)o.shift()();s=!1}).catch(e=>setTimeout(()=>{throw e})))},reset:()=>{n.setState(n.initialState)},setOptions:e=>{n.options=i(w(e,n.options))},getState:()=>n.options.state,setState:e=>{n.options.onStateChange==null||n.options.onStateChange(e)},_getRowId:(e,t,r)=>(n.options.getRowId==null?void 0:n.options.getRowId(e,t,r))??`${r?[r.id,t].join(`.`):t}`,getCoreRowModel:()=>(n._getCoreRowModel||=n.options.getCoreRowModel(n),n._getCoreRowModel()),getRowModel:()=>n.getPaginationRowModel(),getRow:(e,t)=>{let r=(t?n.getPrePaginationRowModel():n.getRowModel()).rowsById[e];if(!r&&(r=n.getCoreRowModel().rowsById[e],!r))throw Error();return r},_getDefaultColumnDef:O(()=>[n.options.defaultColumn],e=>(e??={},{header:e=>{let t=e.header.column.columnDef;return t.accessorKey?t.accessorKey:t.accessorFn?t.id:null},cell:e=>{var t;return((t=e.renderValue())==null||t.toString==null?void 0:t.toString())??null},...n._features.reduce((e,t)=>Object.assign(e,t.getDefaultColumnDef==null?void 0:t.getDefaultColumnDef()),{}),...e}),k(e,`debugColumns`,`_getDefaultColumnDef`)),_getColumnDefs:()=>n.options.columns,getAllColumns:O(()=>[n._getColumnDefs()],e=>{let t=function(e,r,i){return i===void 0&&(i=0),e.map(e=>{let a=he(n,e,i,r),o=e;return a.columns=o.columns?t(o.columns,a,i+1):[],a})};return t(e)},k(e,`debugColumns`,`getAllColumns`)),getAllFlatColumns:O(()=>[n.getAllColumns()],e=>e.flatMap(e=>e.getFlatColumns()),k(e,`debugColumns`,`getAllFlatColumns`)),_getAllFlatColumnsById:O(()=>[n.getAllFlatColumns()],e=>e.reduce((e,t)=>(e[t.id]=t,e),{}),k(e,`debugColumns`,`getAllFlatColumnsById`)),getAllLeafColumns:O(()=>[n.getAllColumns(),n._getOrderColumnsFn()],(e,t)=>t(e.flatMap(e=>e.getLeafColumns())),k(e,`debugColumns`,`getAllLeafColumns`)),getColumn:e=>n._getAllFlatColumnsById()[e]};Object.assign(n,c);for(let e=0;e<n._features.length;e++){let t=n._features[e];t==null||t.createTable==null||t.createTable(n)}return n}function nt(){return e=>O(()=>[e.options.data],t=>{let n={rows:[],flatRows:[],rowsById:{}},r=function(t,i,a){i===void 0&&(i=0);let o=[];for(let c=0;c<t.length;c++){let l=ve(e,e._getRowId(t[c],c,a),t[c],c,i,void 0,a?.id);if(n.flatRows.push(l),n.rowsById[l.id]=l,o.push(l),e.options.getSubRows){var s;l.originalSubRows=e.options.getSubRows(t[c],c),(s=l.originalSubRows)!=null&&s.length&&(l.subRows=r(l.originalSubRows,i+1,l))}}return o};return n.rows=r(t),n},k(e.options,`debugTable`,`getRowModel`,()=>e._autoResetPageIndex()))}function rt(e){let t=[],n=e=>{var r;t.push(e),(r=e.subRows)!=null&&r.length&&e.getIsExpanded()&&e.subRows.forEach(n)};return e.rows.forEach(n),{rows:t,flatRows:e.flatRows,rowsById:e.rowsById}}function Z(e){return e=>O(()=>[e.getState().pagination,e.getPrePaginationRowModel(),e.options.paginateExpandedRows?void 0:e.getState().expanded],(t,n)=>{if(!n.rows.length)return n;let{pageSize:r,pageIndex:i}=t,{rows:a,flatRows:o,rowsById:s}=n,c=r*i,l=c+r;a=a.slice(c,l);let u;u=e.options.paginateExpandedRows?{rows:a,flatRows:o,rowsById:s}:rt({rows:a,flatRows:o,rowsById:s}),u.flatRows=[];let d=e=>{u.flatRows.push(e),e.subRows.length&&e.subRows.forEach(d)};return u.rows.forEach(d),u},k(e.options,`debugTable`,`getPaginationRowModel`))}function it(){return e=>O(()=>[e.getState().sorting,e.getPreSortedRowModel()],(t,n)=>{if(!n.rows.length||!(t!=null&&t.length))return n;let r=e.getState().sorting,i=[],a=r.filter(t=>e.getColumn(t.id)?.getCanSort()),o={};a.forEach(t=>{let n=e.getColumn(t.id);n&&(o[t.id]={sortUndefined:n.columnDef.sortUndefined,invertSorting:n.columnDef.invertSorting,sortingFn:n.getSortingFn()})});let s=e=>{let t=e.map(e=>({...e}));return t.sort((e,t)=>{for(let n=0;n<a.length;n+=1){let r=a[n],i=o[r.id],s=i.sortUndefined,c=r?.desc??!1,l=0;if(s){let n=e.getValue(r.id),i=t.getValue(r.id),a=n===void 0,o=i===void 0;if(a||o){if(s===`first`)return a?-1:1;if(s===`last`)return a?1:-1;l=a&&o?0:a?s:-s}}if(l===0&&(l=i.sortingFn(e,t,r.id)),l!==0)return c&&(l*=-1),i.invertSorting&&(l*=-1),l}return e.index-t.index}),t.forEach(e=>{var t;i.push(e),(t=e.subRows)!=null&&t.length&&(e.subRows=s(e.subRows))}),t};return{rows:s(n.rows),flatRows:i,rowsById:n.rowsById}},k(e.options,`debugTable`,`getSortedRowModel`,()=>e._autoResetPageIndex()))}function at(e,t){return e?ot(e)?C.createElement(e,t):e:null}function ot(e){return st(e)||typeof e==`function`||ct(e)}function st(e){return typeof e==`function`&&(()=>{let t=Object.getPrototypeOf(e);return t.prototype&&t.prototype.isReactComponent})()}function ct(e){return typeof e==`object`&&typeof e.$$typeof==`symbol`&&[`react.memo`,`react.forward_ref`].includes(e.$$typeof.description)}function lt(e){let t={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[n]=C.useState(()=>({current:tt(t)})),[r,i]=C.useState(()=>n.current.initialState);return n.current.setOptions(t=>({...t,...e,state:{...r,...e.state},onStateChange:t=>{i(t),e.onStateChange==null||e.onStateChange(t)}})),n.current}var ut=n(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?t.exports=r():typeof define==`function`&&define.amd?define(r):(n=typeof globalThis<`u`?globalThis:n||self).dayjs_plugin_relativeTime=r()})(e,(function(){return function(e,t,n){e||={};var r=t.prototype,i={future:`in %s`,past:`%s ago`,s:`a few seconds`,m:`a minute`,mm:`%d minutes`,h:`an hour`,hh:`%d hours`,d:`a day`,dd:`%d days`,M:`a month`,MM:`%d months`,y:`a year`,yy:`%d years`};function a(e,t,n,i){return r.fromToBase(e,t,n,i)}n.en.relativeTime=i,r.fromToBase=function(t,r,a,o,s){for(var c,l,u,d=a.$locale().relativeTime||i,f=e.thresholds||[{l:`s`,r:44,d:`second`},{l:`m`,r:89},{l:`mm`,r:44,d:`minute`},{l:`h`,r:89},{l:`hh`,r:21,d:`hour`},{l:`d`,r:35},{l:`dd`,r:25,d:`day`},{l:`M`,r:45},{l:`MM`,r:10,d:`month`},{l:`y`,r:17},{l:`yy`,d:`year`}],p=f.length,m=0;m<p;m+=1){var h=f[m];h.d&&(c=o?n(t).diff(a,h.d,!0):a.diff(t,h.d,!0));var g=(e.rounding||Math.round)(Math.abs(c));if(u=c>0,g<=h.r||!h.r){g<=1&&m>0&&(h=f[m-1]);var _=d[h.l];s&&(g=s(``+g)),l=typeof _==`string`?_.replace(`%d`,g):_(g,r,h.l,u);break}}if(r)return l;var v=u?d.future:d.past;return typeof v==`function`?v(l):v.replace(`%s`,l)},r.to=function(e,t){return a(e,t,this,!0)},r.from=function(e,t){return a(e,t,this)};var o=function(e){return e.$u?n.utc():n()};r.toNow=function(e){return this.to(o(this),e)},r.fromNow=function(e){return this.from(o(this),e)}}}))})),dt=n(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?t.exports=r(y()):typeof define==`function`&&define.amd?define([`dayjs`],r):(n=typeof globalThis<`u`?globalThis:n||self).dayjs_locale_zh_cn=r(n.dayjs)})(e,(function(e){function t(e){return e&&typeof e==`object`&&`default`in e?e:{default:e}}var n=t(e),r={name:`zh-cn`,weekdays:`星期日_星期一_星期二_星期三_星期四_星期五_星期六`.split(`_`),weekdaysShort:`周日_周一_周二_周三_周四_周五_周六`.split(`_`),weekdaysMin:`日_一_二_三_四_五_六`.split(`_`),months:`一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月`.split(`_`),monthsShort:`1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月`.split(`_`),ordinal:function(e,t){return t===`W`?e+`周`:e+`日`},weekStart:1,yearStart:4,formats:{LT:`HH:mm`,LTS:`HH:mm:ss`,L:`YYYY/MM/DD`,LL:`YYYY年M月D日`,LLL:`YYYY年M月D日Ah点mm分`,LLLL:`YYYY年M月D日ddddAh点mm分`,l:`YYYY/M/D`,ll:`YYYY年M月D日`,lll:`YYYY年M月D日 HH:mm`,llll:`YYYY年M月D日dddd HH:mm`},relativeTime:{future:`%s内`,past:`%s前`,s:`几秒`,m:`1 分钟`,mm:`%d 分钟`,h:`1 小时`,hh:`%d 小时`,d:`1 天`,dd:`%d 天`,M:`1 个月`,MM:`%d 个月`,y:`1 年`,yy:`%d 年`},meridiem:function(e,t){var n=100*e+t;return n<600?`凌晨`:n<900?`早上`:n<1100?`上午`:n<1300?`中午`:n<1800?`下午`:`晚上`}};return n.default.locale(r,null,!0),r}))})),ft=n(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?t.exports=r(y()):typeof define==`function`&&define.amd?define([`dayjs`],r):(n=typeof globalThis<`u`?globalThis:n||self).dayjs_locale_zh_tw=r(n.dayjs)})(e,(function(e){function t(e){return e&&typeof e==`object`&&`default`in e?e:{default:e}}var n=t(e),r={name:`zh-tw`,weekdays:`星期日_星期一_星期二_星期三_星期四_星期五_星期六`.split(`_`),weekdaysShort:`週日_週一_週二_週三_週四_週五_週六`.split(`_`),weekdaysMin:`日_一_二_三_四_五_六`.split(`_`),months:`一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月`.split(`_`),monthsShort:`1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月`.split(`_`),ordinal:function(e,t){return t===`W`?e+`週`:e+`日`},formats:{LT:`HH:mm`,LTS:`HH:mm:ss`,L:`YYYY/MM/DD`,LL:`YYYY年M月D日`,LLL:`YYYY年M月D日 HH:mm`,LLLL:`YYYY年M月D日dddd HH:mm`,l:`YYYY/M/D`,ll:`YYYY年M月D日`,lll:`YYYY年M月D日 HH:mm`,llll:`YYYY年M月D日dddd HH:mm`},relativeTime:{future:`%s內`,past:`%s前`,s:`幾秒`,m:`1 分鐘`,mm:`%d 分鐘`,h:`1 小時`,hh:`%d 小時`,d:`1 天`,dd:`%d 天`,M:`1 個月`,MM:`%d 個月`,y:`1 年`,yy:`%d 年`},meridiem:function(e,t){var n=100*e+t;return n<600?`凌晨`:n<900?`早上`:n<1100?`上午`:n<1300?`中午`:n<1800?`下午`:`晚上`}};return n.default.locale(r,null,!0),r}))})),Q=t(y(),1),pt=t(ut(),1);dt(),ft();var $=r();Q.default.extend(pt.default);var mt=null,ht=[],gt=300,_t=10,vt=[10,20,50,100];function yt(e,t){let n=Math.max(0,Number(e)||0),r=Math.floor(n/86400),i=Math.floor(n%86400/3600),a=Math.floor(n%3600/60);return r>0?t(`admin.uptime.daysHours`,{days:r,hours:i}):i>0?t(`admin.uptime.hoursMinutes`,{hours:i,minutes:a}):t(`admin.uptime.minutes`,{minutes:a})}function bt(e){return Number.isFinite(e)?String(Math.round(e/(1024*1024*1024)*100)/100):`0`}function xt(e){let t=Number(e);return!Number.isFinite(t)||t<0?0:Math.round(t*1024*1024*1024)}function St(e){return Array.from(new Set(String(e||``).split(/[\n,]/).map(e=>e.trim()).filter(Boolean)))}function Ct(e,t=12,n=8){return e?e.length<=t+n+3?e:`${e.slice(0,t)}...${e.slice(-n)}`:`-`}function wt(e,t){switch(e.seedStatus){case`queued`:return t(`admin.seedStatus.queued`);case`joining`:return t(`admin.seedStatus.joining`);case`active`:return t(`admin.seedStatus.active`);case`paused`:return t(`admin.seedStatus.paused`);case`error`:return e.seedError?t(`admin.seedStatus.errorWithMessage`,{message:e.seedError}):t(`admin.seedStatus.error`);default:return e.joined?t(`admin.seedStatus.active`):t(`admin.seedStatus.notJoined`)}}function Tt(e){return{"zh-CN":`zh-cn`,"zh-TW":`zh-tw`,en:`en`}[e]}function Et(e,t,n){if(!e)return t(`admin.time.never`);let r=(0,Q.default)(e);if(!r.isValid())return t(`admin.time.never`);if(r.isAfter((0,Q.default)()))return t(`admin.time.justNow`);let i=Tt(n);return r.locale(i).from((0,Q.default)().locale(i))}var Dt=[{labelKey:`admin.seedHelp.active.label`,tone:`active`,descKey:`admin.seedHelp.active.desc`},{labelKey:`admin.seedHelp.pending.label`,tone:`pending`,descKey:`admin.seedHelp.pending.desc`},{labelKey:`admin.seedHelp.paused.label`,tone:`muted`,descKey:`admin.seedHelp.paused.desc`},{labelKey:`admin.seedHelp.error.label`,tone:`error`,descKey:`admin.seedHelp.error.desc`}],Ot=[{value:`all`,labelKey:`admin.logFilter.all`},{value:`join`,labelKey:`admin.logFilter.join`},{value:`pull`,labelKey:`admin.logFilter.pull`},{value:`verify`,labelKey:`admin.logFilter.verify`},{value:`serve`,labelKey:`admin.logFilter.serve`},{value:`error`,labelKey:`admin.logFilter.error`}],kt={join:[`join`,`joined`,`topic`],pull:[`pull`,`p2p`],verify:[`verify`,`verified`,`integrity`,`download:success`],serve:[`seed`,`seeding`,`holding`,`publish:success`,`topic:joined`],error:[`error`,`failed`,`fail`]};function At(e){let t=``;try{t=JSON.stringify(e.data||{})}catch{}return[e.level,e.event,e.message,t].map(e=>String(e||``).toLowerCase()).join(` `)}function jt(e,t){let n=String(t||`all`).trim().toLowerCase();if(!n||n===`all`)return!0;let r=At(e);return n===`error`?e.level===`error`||kt.error.some(e=>r.includes(e)):(kt[n]||[n]).some(e=>r.includes(e))}function Mt(e,t){return t(e===`asc`?`admin.table.sortDesc`:e===`desc`?`admin.table.sortClear`:`admin.table.sortAsc`)}function Nt({sort:e}){return e===`asc`?(0,$.jsx)(ce,{size:13}):e===`desc`?(0,$.jsx)(x,{size:13}):(0,$.jsx)(f,{size:13})}function Pt({table:e,t}){let{pageIndex:n,pageSize:r}=e.getState().pagination,i=Math.max(1,e.getPageCount()),a=e.getPrePaginationRowModel().rows.length;return(0,$.jsxs)(`div`,{className:`admin-table-pagination`,"aria-label":t(`admin.table.pagination`),children:[(0,$.jsx)(`span`,{className:`admin-table-pagination-status`,children:t(`admin.table.totalRows`,{count:a})}),(0,$.jsxs)(`label`,{className:`admin-table-page-size`,children:[(0,$.jsx)(`span`,{children:t(`admin.table.pageSize`)}),(0,$.jsx)(`select`,{className:`input admin-page-size-select`,value:r,onChange:t=>e.setPageSize(Number(t.target.value)),children:vt.map(e=>(0,$.jsx)(`option`,{value:e,children:e},e))})]}),(0,$.jsx)(`span`,{className:`admin-table-pagination-status`,children:t(`admin.table.pageIndicator`,{page:n+1,total:i})}),(0,$.jsxs)(`div`,{className:`admin-table-page-actions`,children:[(0,$.jsx)(`button`,{className:`btn btn-icon`,type:`button`,onClick:()=>e.setPageIndex(0),disabled:!e.getCanPreviousPage(),"aria-label":t(`admin.table.firstPage`),title:t(`admin.table.firstPage`),children:(0,$.jsx)(le,{size:15})}),(0,$.jsx)(`button`,{className:`btn btn-icon`,type:`button`,onClick:()=>e.previousPage(),disabled:!e.getCanPreviousPage(),"aria-label":t(`admin.table.previousPage`),title:t(`admin.table.previousPage`),children:(0,$.jsx)(S,{size:15})}),(0,$.jsx)(`button`,{className:`btn btn-icon`,type:`button`,onClick:()=>e.nextPage(),disabled:!e.getCanNextPage(),"aria-label":t(`admin.table.nextPage`),title:t(`admin.table.nextPage`),children:(0,$.jsx)(p,{size:15})}),(0,$.jsx)(`button`,{className:`btn btn-icon`,type:`button`,onClick:()=>e.setPageIndex(Math.max(0,i-1)),disabled:!e.getCanNextPage(),"aria-label":t(`admin.table.lastPage`),title:t(`admin.table.lastPage`),children:(0,$.jsx)(ue,{size:15})})]})]})}function Ft({table:e,className:t,emptyText:n,t:r}){let i=e.getRowModel().rows,a=e.getPrePaginationRowModel().rows.length>e.getState().pagination.pageSize;return(0,$.jsxs)(`div`,{className:`admin-table ${t}`,children:[(0,$.jsxs)(`table`,{className:`admin-data-table`,children:[(0,$.jsx)(`thead`,{children:e.getHeaderGroups().map(e=>(0,$.jsx)(`tr`,{children:e.headers.map(e=>{let t=e.column.getIsSorted(),n=Mt(t,r);return(0,$.jsx)(`th`,{className:`admin-col-${e.column.id}`,"aria-sort":t===`asc`?`ascending`:t===`desc`?`descending`:void 0,children:e.isPlaceholder?null:e.column.getCanSort()?(0,$.jsxs)(`button`,{className:`admin-table-sort`,type:`button`,onClick:e.column.getToggleSortingHandler(),"aria-label":n,title:n,children:[(0,$.jsx)(`span`,{children:at(e.column.columnDef.header,e.getContext())}),(0,$.jsx)(Nt,{sort:t})]}):(0,$.jsx)(`span`,{children:at(e.column.columnDef.header,e.getContext())})},e.id)})},e.id))}),(0,$.jsxs)(`tbody`,{children:[i.map(e=>(0,$.jsx)(`tr`,{children:e.getVisibleCells().map(e=>(0,$.jsx)(`td`,{className:`admin-col-${e.column.id}`,children:at(e.column.columnDef.cell,e.getContext())},e.id))},e.id)),i.length===0&&(0,$.jsx)(`tr`,{children:(0,$.jsx)(`td`,{className:`admin-empty-row`,colSpan:e.getAllLeafColumns().length,children:n})})]})]}),a&&(0,$.jsx)(Pt,{table:e,t:r})]})}function It(){let{t:e,locale:t,formatNumber:n,formatTime:r}=re(),i=l(e=>e.hasBackend),a=l(e=>e.addToast),[f,p]=(0,C.useState)(mt),[y,x]=(0,C.useState)([]),[ce,S]=(0,C.useState)(``),[le,ue]=(0,C.useState)(!1),[w,T]=(0,C.useState)(!1),[E,pe]=(0,C.useState)(!1),[D,O]=(0,C.useState)(`all`),[k,me]=(0,C.useState)([]),[he,A]=(0,C.useState)({pageIndex:0,pageSize:_t}),[ge,_e]=(0,C.useState)([]),[j,ve]=(0,C.useState)({pageIndex:0,pageSize:_t}),[ye,be]=(0,C.useState)([{id:`log-time`,desc:!0}]),[M,N]=(0,C.useState)({pageIndex:0,pageSize:_t}),[xe,Se]=(0,C.useState)([]),[P,F]=(0,C.useState)(``),[I,L]=(0,C.useState)({dataPath:``,capacityGiB:`100`,maxFileSizeGiB:`10`,remoteInvites:``}),R=i===!0;function z(){return R?!0:(a(e(i===null?`admin.toast.backendChecking`:`admin.toast.backendDisconnected`),`warning`),!1)}let Ce=(0,C.useMemo)(()=>!f||f.capacity.configuredBytes<=0?0:Math.min(100,Math.round(f.capacity.usedBytes/f.capacity.configuredBytes*100)),[f]),B=f?.holdings||ht,V=o(),H=!!V&&!V.includes(`localhost`)&&!V.includes(`127.0.0.1`),we=(0,C.useMemo)(()=>[{id:`user`,accessorKey:`address`,header:e(`admin.userData.user`),cell:e=>{let t=e.getValue();return(0,$.jsx)(`span`,{title:t,translate:`no`,children:Ct(t)})}},{id:`user-files`,accessorKey:`fileCount`,header:e(`admin.userData.files`),cell:e=>n(e.getValue())},{id:`user-trash`,accessorKey:`trashCount`,header:e(`admin.userData.trash`),cell:e=>n(e.getValue())},{id:`user-actions`,header:e(`admin.userData.actions`),enableSorting:!1,cell:t=>{let n=t.row.original.address;return(0,$.jsxs)(`button`,{className:`btn btn-ghost`,onClick:()=>Me(n),disabled:P===n,children:[(0,$.jsx)(te,{size:16}),e(`admin.action.clear`)]})}}],[n,P,e]),Te=(0,C.useMemo)(()=>[{id:`file`,accessorKey:`fileName`,header:e(`admin.holdings.file`),cell:e=>(0,$.jsx)(`span`,{translate:`no`,children:e.getValue()||`-`})},{id:`cid`,accessorKey:`cid`,header:`CID`,cell:e=>{let t=e.row.original;return(0,$.jsx)(`span`,{title:t.cid,translate:`no`,children:Ct(t.cid)})}},{id:`size`,accessorKey:`size`,header:e(`admin.holdings.size`),cell:e=>b(e.getValue())},{id:`peers`,accessorFn:e=>e.peerCount??0,header:e(`admin.holdings.peers`),cell:e=>n(e.getValue())},{id:`topic`,accessorFn:e=>Number(e.joined),header:e(`admin.holdings.topicJoined`),cell:t=>{let n=t.row.original;return(0,$.jsx)(`span`,{className:`admin-seed-pill ${n.joined?`active`:``}`,children:n.joined?e(`admin.holdings.joinedYes`):e(`admin.holdings.joinedNo`)})}},{id:`last-served`,accessorFn:e=>e.lastServedAt&&new Date(e.lastServedAt).getTime()||0,header:e(`admin.holdings.lastServed`),cell:n=>{let r=n.row.original.lastServedAt;return(0,$.jsx)(`span`,{title:r||``,children:Et(r,e,t)})}},{id:`total-served`,accessorFn:e=>e.totalServedBytes||0,header:e(`admin.holdings.totalServed`),cell:e=>b(e.getValue())},{id:`status`,accessorFn:e=>e.seedStatus||(e.joined?`active`:`not-joined`),header:e(`admin.holdings.status`),cell:t=>{let n=t.row.original;return(0,$.jsx)(`span`,{className:`admin-seed-pill ${n.seedStatus===`error`?`error`:n.seedStatus===`active`||n.joined?`active`:``}`,children:wt(n,e)})}}],[n,t,e]),U=(0,C.useMemo)(()=>[{id:`log-time`,accessorFn:e=>new Date(e.ts).getTime()||0,header:e(`admin.logs.time`),cell:e=>(0,$.jsx)(`time`,{children:r(e.row.original.ts)})},{id:`log-level`,accessorKey:`level`,header:e(`admin.logs.level`),cell:e=>(0,$.jsx)(`span`,{className:`admin-log-level ${e.getValue()}`,translate:`no`,children:e.getValue()})},{id:`log-event`,accessorKey:`event`,header:e(`admin.logs.event`),cell:e=>(0,$.jsx)(`strong`,{translate:`no`,children:e.getValue()})},{id:`log-message`,accessorKey:`message`,header:e(`admin.logs.message`),cell:e=>(0,$.jsx)(`span`,{translate:`no`,children:e.getValue()})}],[r,e]),Ee=lt({data:xe,columns:we,state:{sorting:k,pagination:he},onSortingChange:me,onPaginationChange:A,getCoreRowModel:nt(),getSortedRowModel:it(),getPaginationRowModel:Z(),getRowId:e=>e.address}),De=lt({data:B,columns:Te,state:{sorting:ge,pagination:j},onSortingChange:_e,onPaginationChange:ve,getCoreRowModel:nt(),getSortedRowModel:it(),getPaginationRowModel:Z(),getRowId:e=>e.cid}),W=lt({data:y,columns:U,state:{sorting:ye,pagination:M},onSortingChange:be,onPaginationChange:N,getCoreRowModel:nt(),getSortedRowModel:it(),getPaginationRowModel:Z(),getRowId:e=>e.id}),G=async()=>{if(!R)return!1;try{let e=await s.get(`/api/node/status`).json(),t=await s.get(`/api/node/config`).json();return p(e),L({dataPath:t.dataPath||e.dataPath||``,capacityGiB:bt(t.capacityBytes),maxFileSizeGiB:bt(t.maxFileSizeBytes),remoteInvites:(t.remoteInvites||[]).join(`
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/MilkdownEditor-
|
|
2
|
-
import{n as e,o as t,t as n}from"./jsx-runtime-Bt-cYkS5.js";import{B as r,C as i,E as a,H as o,M as s,d as c,j as l,o as u,t as d,w as f}from"./useAppStore-DOnk608w.js";import{n as ee}from"./useNavigate-DWlBD_-b.js";import{a as te,i as ne,n as re,o as p}from"./chatNoteDraft-CYbvcEvC.js";import{t as ie}from"./OpenSidebarButton-DI6Ld8um.js";import{n as m,t as h}from"./lock-CuwwlXlx.js";import{t as g}from"./chevron-right-D75NRNNs.js";import{n as _,t as v}from"./notebook-pen-BzrCXQJE.js";import{t as y}from"./folder-BS_GbpPQ.js";import{n as ae,t as b}from"./AppTop-qtp-3wqv.js";import{t as oe}from"./save-B02sbO9Y.js";import{t as se}from"./search-HW4oPOBP.js";import{t as ce}from"./trash-2-BLwoM0ME.js";import{A as le,N as ue,S as de,_ as fe,a as pe,b as x,c as S,g as C,i as w,l as me,o as T,r as he,s as ge,t as E,u as _e,v as ve,w as D,y as O}from"./index-CUzbruyP.js";var ye=r(`move`,[[`path`,{d:`M12 2v20`,key:`t6zp3m`}],[`path`,{d:`m15 19-3 3-3-3`,key:`11eu04`}],[`path`,{d:`m19 9 3 3-3 3`,key:`1mg7y2`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}],[`path`,{d:`m5 9-3 3 3 3`,key:`j64kie`}],[`path`,{d:`m9 5 3-3 3 3`,key:`l8vdw6`}]]),be=r(`pencil-ruler`,[[`path`,{d:`M13 7 8.7 2.7a2.41 2.41 0 0 0-3.4 0L2.7 5.3a2.41 2.41 0 0 0 0 3.4L7 13`,key:`orapub`}],[`path`,{d:`m8 6 2-2`,key:`115y1s`}],[`path`,{d:`m18 16 2-2`,key:`ee94s4`}],[`path`,{d:`m17 11 4.3 4.3c.94.94.94 2.46 0 3.4l-2.6 2.6c-.94.94-2.46.94-3.4 0L11 17`,key:`cfq27r`}],[`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`}]]),k=t(e(),1),A=n();function j(e){return e.type===`directory`?f(e.path?`${e.path}/${e.name}`:e.name):i(e)}function xe({target:e,targetLabel:t,directories:n,onMove:r,onClose:i}){let{t:a}=le(),o=f(e.path||``),s=j(e),c=n.filter(t=>e.type===`directory`?t.path!==s&&!t.path.startsWith(`${s}/`):!0),[l,u]=(0,k.useState)(o),[d,ee]=(0,k.useState)(``),[te,ne]=(0,k.useState)(new Set),re=f(d),p=d.trim()?re:l,ie=f(p)===o,h=a(`note.move.rootDirectory`),_=new Map;for(let e of c){let t=_.get(e.parentPath)||[];t.push(e),_.set(e.parentPath,t)}let v=c.filter(e=>{if(!e.parentPath)return!0;let t=e.parentPath.split(`/`).filter(Boolean);return t.every((e,n)=>te.has(t.slice(0,n+1).join(`/`)))}),ae=[{label:h,path:``},...l.split(`/`).filter(Boolean).map((e,t,n)=>({label:e,path:n.slice(0,t+1).join(`/`)}))];function b(e){u(f(e)),ee(``)}function oe(e){b(e),_.has(e)&&ne(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}function se(){ie||r(p)}return(0,A.jsx)(O,{onClose:i,children:(0,A.jsxs)(`div`,{className:`note-move-modal`,onClick:e=>e.stopPropagation(),children:[(0,A.jsxs)(`div`,{className:`modal-header`,children:[(0,A.jsx)(`h3`,{children:a(`note.move.title`)}),(0,A.jsx)(`button`,{className:`btn btn-icon`,onClick:i,children:(0,A.jsx)(de,{size:18})})]}),(0,A.jsxs)(`div`,{className:`note-move-target`,children:[(0,A.jsx)(`span`,{children:a(`note.move.moving`)}),(0,A.jsx)(`strong`,{translate:`no`,children:t||e.name})]}),(0,A.jsx)(`div`,{className:`note-move-path`,children:ae.map((e,t)=>(0,A.jsxs)(k.Fragment,{children:[t>0&&(0,A.jsx)(`span`,{children:`/`}),(0,A.jsx)(`button`,{type:`button`,onClick:()=>b(e.path),children:(0,A.jsx)(`span`,{translate:e.path?`no`:`yes`,children:e.label})})]},e.path||`root`))}),(0,A.jsxs)(`div`,{className:`note-move-folder-list`,children:[(0,A.jsxs)(`button`,{type:`button`,className:`note-move-folder-item ${l===``?`selected`:``}`,onClick:()=>b(``),children:[(0,A.jsx)(`span`,{className:`note-move-folder-spacer`}),(0,A.jsx)(y,{className:`note-move-folder-icon`,size:16}),(0,A.jsx)(`span`,{children:h})]}),c.length===0?(0,A.jsx)(`p`,{className:`note-move-empty`,children:a(`note.move.noFolders`)}):v.map(e=>{let t=_.has(e.path),n=te.has(e.path);return(0,A.jsxs)(`button`,{type:`button`,className:`note-move-folder-item note-move-depth-${Math.min(e.depth,4)} ${l===e.path?`selected`:``}`,onClick:()=>oe(e.path),children:[t?n?(0,A.jsx)(m,{className:`note-move-expander`,size:14}):(0,A.jsx)(g,{className:`note-move-expander`,size:14}):(0,A.jsx)(`span`,{className:`note-move-folder-spacer`}),(0,A.jsx)(y,{className:`note-move-folder-icon`,size:16}),(0,A.jsx)(`span`,{translate:`no`,children:e.name}),e.parentPath&&(0,A.jsx)(`small`,{translate:`no`,children:e.parentPath})]},e.path)})]}),(0,A.jsx)(`input`,{className:`input input-compact`,value:d,onChange:e=>ee(e.target.value),placeholder:a(`note.move.pathPlaceholder`),translate:`no`}),(0,A.jsxs)(`div`,{className:`note-move-destination`,children:[(0,A.jsx)(`span`,{children:a(`note.move.destinationLabel`)}),(0,A.jsx)(`span`,{translate:p?`no`:`yes`,children:p||h})]}),(0,A.jsxs)(`div`,{className:`modal-actions`,children:[(0,A.jsx)(`button`,{className:`btn btn-secondary`,onClick:i,children:a(`common.cancel`)}),(0,A.jsx)(`button`,{className:`btn btn-primary`,onClick:se,disabled:ie,children:a(`note.action.move`)})]})]})})}function Se({children:e}){return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(b,{}),e]})}var Ce=(0,k.lazy)(async()=>({default:(await E(()=>import(`./MilkdownEditor-DXVbZsH_.js`),__vite__mapDeps([0,1,2,3,4,5,6,7]))).MilkdownEditor})),M=/\[\[([^\]\n]+?)\]\]/g,we=/(```[\s\S]*?```)/g;function Te(e){let t=new URLSearchParams(e),n=t.get(`mode`);return{cid:t.get(`cid`)||void 0,file:t.get(`file`)||void 0,path:t.get(`path`)||void 0,chatDraft:t.get(`chatDraft`)||void 0,mode:n===`edit`?`edit`:void 0}}function N(e={}){let t=new URLSearchParams;e.cid&&t.set(`cid`,e.cid),e.file&&t.set(`file`,e.file),e.path&&t.set(`path`,e.path),e.chatDraft&&t.set(`chatDraft`,e.chatDraft),e.mode&&t.set(`mode`,e.mode);let n=t.toString();return n?`/note/?${n}`:`/note/`}function Ee(e){let t=e.indexOf(`?`),n=t>=0?e.slice(t):``;if(typeof window>`u`)return Te(n);try{return Te(new URL(e,window.location.origin).search)}catch{return Te(n)}}var P={"note.error.nameRequired":`note.error.nameRequired`,"note.error.nameNoSlash":`note.error.nameNoSlash`,"note.error.nameNoBackslash":`note.error.nameNoBackslash`,"note.error.nameInvalid":`note.error.nameInvalid`,"note.error.nameConflict":`note.error.nameConflict`,"note.error.moveIntoSelf":`note.error.moveIntoSelf`};function De(e,t,n){let r=e instanceof Error?e.message:``,i=P[r];return i?n(i):r||t}function Oe(e){return e.type===`directory`?f(e.path?`${e.path}/${e.name}`:e.name):i(e)}function F(e=``){return String(e).trim().replace(/\.md$/i,``)}function I(e){let t=F(e);return t?`${t}.md`:``}function ke(e,t,n){let r=F(e)||t;for(let e=0;e<1e3;e+=1){let t=I(e===0?r:`${r} ${e+1}`);if(t&&!n(t))return t}return I(`${r} ${Date.now()}`)}function Ae(e=``){let t=f(e).split(`/`).filter(Boolean);if(t.length===0)return``;let n=t.length-1;return t[n]=I(t[n]),t.join(`/`)}function je(e=``){let t=f(e).split(`/`).filter(Boolean);if(t.length===0)return``;let n=t.length-1;return t[n]=F(t[n]),t.join(`/`)}function Me(e){return je(i(e))}function L(e){let t=e.trim().replace(/^\/+/,``),n=t.search(/[#^]/);return je(n>=0?t.slice(0,n):t)}function Ne(e,t){let n=t?.trim();if(n)return n;let r=e.split(`/`).filter(Boolean);return r[r.length-1]||e}function R(e){return e.replace(/\\/g,`\\\\`).replace(/\[/g,`\\[`).replace(/\]/g,`\\]`)}function Pe(e,t){return`[${R(e)}](<${t.replace(/>/g,`%3E`)}>)`}function Fe(e,t,n=``){let r=L(t);if(!r)return null;let i=r.toLowerCase(),a=e=>Me(e).toLowerCase();if(r.includes(`/`))return e.find(e=>a(e)===i)||null;let o=f(n);if(o){let t=f(`${o}/${r}`).toLowerCase(),n=e.find(e=>a(e)===t);if(n)return n}return e.find(e=>F(e.name).toLowerCase()===i)||null}function Ie(e,t,n,r=``,i){let a=e.indexOf(`|`),o=a>=0?e.slice(0,a):e,s=a>=0?e.slice(a+1):void 0,c=L(o);if(!c)return null;let l=Fe(t,o,r),u=l?n(l):i?.(c);return u?{label:Ne(c,s),href:u}:null}function Le(e,t,n,r=``,i){return e.includes(`[[`)?e.split(we).map(e=>e.startsWith("```")?e:e.replace(M,(e,a)=>{let o=Ie(a,t,n,r,i);return o?Pe(o.label,o.href):e})).join(``):e}function z(e){return e.type===`file`?F(e.name):e.name}function B(e){return e.type===`file`?je(e.fullPath):e.fullPath}function Re(e){return e.type===`file`?F(e.name):e.name}function ze(e=``){let t=f(e).split(`/`).filter(Boolean);return t.map((e,n)=>t.slice(0,n+1).join(`/`))}function Be(e,t){let n=new Set(e);return n.has(t)?n.delete(t):n.add(t),n}function Ve(e,t){if(t.length===0)return e;let n=!1,r=new Set(e);for(let e of t)r.has(e)||(r.add(e),n=!0);return n?r:e}function He(e){return{name:e.name,cid:`__dir__${e.fullPath}`,path:e.path,type:`directory`,size:0,created_at:e.updatedAt,updated_at:e.updatedAt}}function Ue(e,t){let n=[],r=new Map;function a(e){return e&&r.get(e)?.children||n}function o(e,t,n){let i=f(t?`${t}/${e}`:e),o=r.get(i);if(o)return o.updatedAt=Math.max(o.updatedAt,n),o;let s={id:`directory:${i}`,type:`directory`,name:e,path:t,fullPath:i,updatedAt:n,children:[]};return r.set(i,s),a(t).push(s),s}for(let t of e){let e=f(t.path||``),n=e.split(`/`).filter(Boolean),r=t.updated_at||t.created_at||0,s=``;for(let e of n)s=o(e,s,r).fullPath;a(s).push({id:`file:${t.cid}:${i(t)}`,type:`file`,name:t.name,path:e,fullPath:i(t),updatedAt:r,note:t,children:[]})}function s(e){e.sort((e,n)=>{if(e.type!==n.type)return e.type===`directory`?-1:1;let r=t(z(e),z(n));return r===0?t(B(e),B(n)):r});for(let t of e)t.type===`directory`&&s(t.children)}return s(n),n}function We(e,t){let n=t.trim().toLowerCase();return n?e.flatMap(e=>{let t=z(e).toLowerCase(),r=B(e).toLowerCase(),i=t.includes(n)||r.includes(n);if(e.type===`file`)return i?[e]:[];let a=i?e.children:We(e.children,n);return!i&&a.length===0?[]:[{...e,children:a}]}):e}function Ge({nodes:e,searchQuery:t,expandedPaths:n,activeFileId:r,activeFolderPath:i,onToggleDirectory:a,onOpenFile:o,renderActions:s}){let c=t.trim().length>0;return(0,A.jsx)(`div`,{className:`note-tree`,role:`tree`,children:e.map(e=>(0,A.jsx)(V,{node:e,forceExpanded:c,expandedPaths:n,activeFileId:r,activeFolderPath:i,onToggleDirectory:a,onOpenFile:o,renderActions:s},e.id))})}function V({node:e,forceExpanded:t,expandedPaths:n,activeFileId:r,activeFolderPath:i,onToggleDirectory:a,onOpenFile:o,renderActions:s}){let c=e.type===`directory`,l=c&&(t||n.has(e.fullPath)),u=e.type===`file`&&e.note?.cid===r,d=c&&f(i)===e.fullPath,ee=c?He(e):e.note||null,te=ee&&s?s(ee):null;return(0,A.jsxs)(`div`,{className:`note-tree-node`,role:`none`,children:[(0,A.jsxs)(`div`,{className:`note-tree-row ${c?`is-directory`:`is-file`} ${u?`is-active`:``} ${d?`is-folder-active`:``} ${te?`has-actions`:``}`,children:[(0,A.jsxs)(`button`,{type:`button`,className:`note-tree-item`,role:`treeitem`,"aria-expanded":c?l:void 0,onClick:()=>{if(c){a(e);return}e.note&&o(e.note)},children:[(0,A.jsx)(`span`,{className:`note-tree-toggle`,"aria-hidden":`true`,children:c?l?(0,A.jsx)(m,{size:16}):(0,A.jsx)(g,{size:16}):(0,A.jsx)(`span`,{className:`note-tree-toggle-placeholder`})}),(0,A.jsx)(`span`,{className:`note-tree-label`,translate:`no`,children:z(e)}),e.note?.isSecret&&(0,A.jsx)(h,{className:`note-tree-lock`,size:14,"aria-hidden":`true`})]}),te]}),c&&l&&e.children.length>0&&(0,A.jsx)(`div`,{className:`note-tree-children`,role:`group`,children:e.children.map(e=>(0,A.jsx)(V,{node:e,forceExpanded:t,expandedPaths:n,activeFileId:r,activeFolderPath:i,onToggleDirectory:a,onOpenFile:o,renderActions:s},e.id))})]})}function Ke(e,t){let n=new Set;for(let t of e){let e=f(t.path).split(`/`).filter(Boolean);for(let t=0;t<e.length;t+=1)n.add(e.slice(0,t+1).join(`/`))}return Array.from(n).sort(t).map(e=>{let t=e.split(`/`);return{path:e,name:t[t.length-1]||e,parentPath:t.slice(0,-1).join(`/`),depth:Math.max(t.length-1,0)}})}function H(e){return e.map(e=>({name:e.name,cid:e.path,path:f(e.directory),content:``,size:e.size,type:`file`,created_at:Number(e.mtimeMs)||Date.now(),updated_at:Number(e.mtimeMs)||Date.now(),isSecret:!1}))}function U(e,t){let n=I(t);return f(e?`${e}/${n}`:n)}function qe(e){let t=e||typeof window<`u`&&window.location.origin||``;if(!t)return!1;try{let e=new URL(t).hostname.toLowerCase();return e===`localhost`||e===`127.0.0.1`||e===`::1`||e===`[::1]`||e.startsWith(`127.`)}catch{return!1}}function W(e,t=``){let[n,r]=(0,k.useState)(!1);return(0,k.useEffect)(()=>{let n=!1;return!e||!t?(r(!1),()=>{n=!0}):(T().then(e=>{n||r(e.configured===!0)}).catch(()=>{n||r(!1)}),()=>{n=!0})},[e,t]),n}function G(){let{t:e,formatDate:t,compareStrings:n}=le(),r=ee(),i=ue({select:e=>e.searchStr}),o=(0,k.useMemo)(()=>Te(i),[i]),c=(0,k.useRef)(null),u=d(e=>e.addToast),p=a(e=>e.wallet),m=a(e=>e.openLoginModal),g=d(e=>e.notes),_=d(e=>e.notesPath),y=d(e=>e.setNotesPath),b=d(e=>e.saveNote),pe=d(e=>e.deleteNote),x=d(e=>e.renameNote),S=d(e=>e.localDataReady),C=o.cid||``,w=g.find(e=>e.cid===C),me=!!C,T=me&&o.mode===`edit`,[he,ge]=(0,k.useState)(``),[E,_e]=(0,k.useState)(null),[O,j]=(0,k.useState)(null),[M,we]=(0,k.useState)(null),P=(0,k.useRef)(``),je=(0,k.useRef)(``),[Me,L]=(0,k.useState)(``),[Ne,R]=(0,k.useState)(``),[Pe,z]=(0,k.useState)(``),[B,He]=(0,k.useState)(``),[V,H]=(0,k.useState)(``),[U,qe]=(0,k.useState)(!1),[W,G]=(0,k.useState)(``),[K,q]=(0,k.useState)(!1),[Je,Ye]=(0,k.useState)(()=>new Set(ze(_)));(0,k.useEffect)(()=>{if(!C){L(``),R(``);return}if(!w){L(``),R(S?e(`note.error.notFound`):``);return}if(w.content.startsWith(`mp://1`)){if(!p){L(``),R(e(`note.error.loginToDecrypt`));return}let t=l(w.content,p.danger);if(!t){L(``),R(e(`note.error.decryptFailed`));return}L(t),R(``);return}L(w.content||``),R(``)},[C,S,w,e,p]),(0,k.useEffect)(()=>{if(!T){q(!1);return}if(!C||!w){z(``),He(``),H(``),qe(!1),G(S?e(`note.error.notFound`):``);return}if(z(F(w.name)),He(w.path||``),qe(w.isSecret===!0||w.content.startsWith(`mp://1`)),w.content.startsWith(`mp://1`)){if(!p){H(``),G(e(`note.error.loginToDecrypt`));return}let t=l(w.content,p.danger);if(!t){H(``),G(e(`note.error.decryptFailed`));return}H(t),G(``);return}H(w.content||``),G(``)},[C,T,S,w,e,p]);let Xe=(0,k.useMemo)(()=>Ue(g,n),[n,g]),Ze=(0,k.useMemo)(()=>We(Xe,he),[Xe,he]),Qe=w?.isSecret===!0||w?.content.startsWith(`mp://1`)===!0,J=e(T?U?`note.privacy.secret`:`note.privacy.public`:Qe?`note.privacy.secret`:`note.privacy.public`),$e=(0,k.useMemo)(()=>Ke(g,n),[n,g]),et=(0,k.useMemo)(()=>Le(Me,g,e=>N({cid:e.cid}),w?.path||``,e=>N({path:Ae(e)})),[g,Me,w?.path]),tt=(0,k.useCallback)(e=>Ie(e,g,e=>N({cid:e.cid}),w?.path||``,e=>N({path:Ae(e)})),[g,w?.path]);(0,k.useEffect)(()=>{w?.path&&Ye(e=>Ve(e,ze(w.path)))},[w?.path]),(0,k.useEffect)(()=>{if(!o.path||C||g.length===0)return;let e=Fe(g,o.path);e&&(y(f(e.path||``)),r({href:N({cid:e.cid}),replace:!0}))},[C,r,g,o.path,y]),(0,k.useEffect)(()=>{let t=o.chatDraft||``;if(!t||P.current===t||!S)return;if(!p){let e=`${t}:auth`;je.current!==e&&(je.current=e,m());return}let n=ne(t);if(!n){P.current=t,u(e(`note.chatDraft.missing`),`warning`),Y({},!0);return}P.current=t,at(n)},[u,S,o.chatDraft,e,p]);function Y(e={},t=!1){r({href:N(e),replace:t})}function nt(e){Y(Ee(e))}function rt(e){y(f(e.path||``)),Y({cid:e.cid})}function it(e){y(e.fullPath),Ye(t=>Be(t,e.fullPath))}function X(e){Y({cid:e.cid,mode:`edit`})}function Z(){return p?!0:(m(),!1)}async function at(t){if(p)try{let n=await b({name:ke(t.title,e(`note.chatDraft.defaultTitle`),e=>g.some(t=>f(t.path||``)===f(_)&&t.name===e)),path:_,content:t.content,isSecret:!1});re(t.id),u(e(`note.chatDraft.created`),`success`),Y({cid:n,mode:`edit`},!0)}catch(t){P.current=``,u(De(t,e(`note.toast.createFailed`),e),`error`)}}function ot(){Y(w?{cid:w.cid}:{})}async function st(){if(!Z())return;if(!w){u(e(`note.toast.notFound`),`error`);return}let t=I(Pe);if(!t){u(e(`note.toast.nameRequired`),`warning`);return}q(!0);try{let n=c.current?.getMarkdown()??V,r=U?s(n,p.danger):n,i=await b({cid:w.cid,name:t,path:B,content:r,isSecret:U});H(n),Y({cid:i},!0),u(e(`note.toast.saved`),`success`)}catch(t){u(De(t,e(`note.toast.saveFailed`),e),`error`)}finally{q(!1)}}function ct(){Z()&&_e({title:e(`note.create.title`),placeholder:e(`note.namePlaceholder`),confirmText:e(`note.create.action`),onConfirm:async t=>{if(Z())try{let n=await b({name:I(t),path:_,content:``,isSecret:!1});_e(null),u(e(`note.toast.created`),`success`),Y({cid:n,mode:`edit`})}catch(t){u(De(t,e(`note.toast.createFailed`),e),`error`)}}})}function lt(e){Z()&&we(e)}async function Q(t){if(M)try{x(Oe(M),t,M.name),we(null),u(e(`note.toast.moved`),`success`)}catch(t){u(De(t,e(`note.toast.moveFailed`),e),`error`)}}function $(t){if(!Z())return;let n=t.type===`directory`;j({title:e(n?`note.delete.folderTitle`:`note.delete.noteTitle`),message:e(`note.delete.message`,{name:Re(t)}),confirmText:e(`note.action.delete`),onConfirm:async()=>{pe(n?void 0:t.cid,t.path,t.name),j(null),u(e(`note.toast.deleted`),`success`),t.type===`file`&&t.cid===C&&Y()}})}let ut=(0,A.jsxs)(`div`,{className:`note-header-title`,children:[(0,A.jsx)(`h2`,{className:`header-title`,children:e(`note.title`)}),(0,A.jsx)(`span`,{children:e(`note.count`,{count:g.length})})]}),dt=(0,A.jsx)(`div`,{className:`note-theme-wrap`}),ft=(0,A.jsxs)(`section`,{className:`note-list-panel note-sidebar-list`,"aria-label":e(`note.listLabel`),children:[(0,A.jsxs)(`div`,{className:`note-search`,children:[(0,A.jsx)(se,{size:16}),(0,A.jsx)(`input`,{className:`input input-flex`,value:he,onChange:e=>ge(e.target.value),placeholder:e(`note.search.placeholder`)})]}),Ze.length===0?(0,A.jsxs)(`div`,{className:`ui-empty-state note-empty-state`,children:[(0,A.jsx)(v,{size:32}),(0,A.jsx)(`p`,{children:e(he?`note.empty.noMatches`:`note.empty.noNotes`)})]}):(0,A.jsx)(Ge,{nodes:Ze,searchQuery:he,expandedPaths:Je,activeFileId:C,activeFolderPath:C?``:_,onToggleDirectory:it,onOpenFile:rt}),(0,A.jsx)(`div`,{className:`note-create-btn`,children:(0,A.jsxs)(`button`,{className:`btn`,onClick:ct,children:[(0,A.jsx)(te,{size:16}),e(`note.newNote`)]})})]});return(0,A.jsxs)(ae,{sidebar:()=>(0,A.jsx)(Se,{children:ft}),headerTitle:ut,headerRight:dt,children:[(0,A.jsx)(`main`,{className:`note-page note-browser-page ${me?`has-editor`:``}`,children:(0,A.jsx)(`section`,{className:`note-workspace`,children:(0,A.jsx)(`section`,{className:`note-editor-panel`,"aria-label":e(T?`note.editorLabel.edit`:`note.editorLabel.read`),children:me?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(`div`,{className:`note-editor-panel-header`,children:[(0,A.jsxs)(`div`,{className:`note-editor-title-area`,children:[T?(0,A.jsx)(`input`,{className:`note-title-input`,value:Pe,onChange:e=>z(e.target.value),placeholder:e(`note.namePlaceholder`),translate:`no`,disabled:!w}):w?(0,A.jsx)(`h3`,{translate:`no`,children:F(w.name)}):(0,A.jsx)(`h3`,{children:e(`note.untitled`)}),w&&(0,A.jsxs)(`div`,{className:`note-editor-info`,children:[(0,A.jsx)(`span`,{children:e(T?`note.mode.edit`:`note.mode.read`)}),(0,A.jsx)(`span`,{children:J}),(0,A.jsx)(`span`,{children:t(w.updated_at)})]})]}),(0,A.jsxs)(`div`,{className:`note-editor-actions`,children:[(0,A.jsx)(`button`,{type:`button`,className:`btn btn-icon`,onClick:T?ot:()=>Y(),title:e(T?`common.cancel`:`common.close`),"aria-label":e(T?`common.cancel`:`common.close`),children:(0,A.jsx)(de,{size:16})}),T?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(`button`,{className:`btn btn-sm ${U?`btn-warning`:`btn-secondary`}`,onClick:()=>qe(!U),disabled:!w,children:[U?(0,A.jsx)(h,{size:16}):(0,A.jsx)(D,{size:16}),e(U?`note.privacy.secret`:`note.privacy.public`)]}),(0,A.jsxs)(`button`,{className:`btn btn-sm btn-primary`,onClick:st,disabled:K||!!W||!w,children:[(0,A.jsx)(oe,{size:16}),e(K?`note.action.saving`:`note.action.save`)]})]}):w&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`button`,{type:`button`,className:`btn btn-icon`,onClick:()=>lt(w),title:e(`note.action.move`),"aria-label":e(`note.action.move`),children:(0,A.jsx)(ye,{size:16})}),(0,A.jsx)(`button`,{type:`button`,className:`btn btn-icon note-editor-action-danger`,onClick:()=>$(w),title:e(`note.action.delete`),"aria-label":e(`note.action.delete`),children:(0,A.jsx)(ce,{size:16})}),(0,A.jsxs)(`button`,{type:`button`,className:`btn btn-sm btn-primary`,onClick:()=>X(w),disabled:!!Ne,title:e(`note.action.edit`),"aria-label":e(`note.action.edit`),children:[(0,A.jsx)(be,{size:16}),e(`note.action.edit`)]})]})]})]}),T?W?(0,A.jsxs)(`div`,{className:`note-empty-state editor-error`,children:[(0,A.jsx)(h,{size:36}),(0,A.jsx)(`p`,{children:W})]}):w?(0,A.jsx)(`div`,{className:`note-editor-frame editing`,children:(0,A.jsx)(Ce,{ref:c,content:V,onChange:H,className:`milkdown-editor`})}):(0,A.jsxs)(`div`,{className:`note-empty-state editor-error`,children:[(0,A.jsx)(v,{size:36}),(0,A.jsx)(`p`,{children:e(S?`note.error.notFound`:`note.loading`)})]}):Ne?(0,A.jsxs)(`div`,{className:`ui-empty-state note-empty-state editor-error`,children:[(0,A.jsx)(h,{size:36}),(0,A.jsx)(`p`,{children:Ne})]}):w?(0,A.jsx)(`div`,{className:`note-editor-frame reading`,children:(0,A.jsx)(Ce,{content:et,readOnly:!0,onInternalNoteLinkOpen:nt,resolveWikiNoteLink:tt,className:`milkdown-editor`})}):(0,A.jsxs)(`div`,{className:`ui-empty-state note-empty-state editor-error`,children:[(0,A.jsx)(v,{size:36}),(0,A.jsx)(`p`,{children:e(S?`note.error.notFound`:`note.loading`)})]})]}):(0,A.jsxs)(`div`,{className:`ui-empty-state note-editor-empty`,children:[(0,A.jsx)(`div`,{className:`ui-empty-icon note-editor-empty-icon`,children:(0,A.jsx)(v,{size:32})}),(0,A.jsx)(`h3`,{className:`ui-empty-title`,children:e(`note.noOpen.title`)}),(0,A.jsx)(`p`,{className:`ui-empty-desc`,children:g.length>0?e(`note.noOpen.select`):e(`note.noOpen.createFirst`)}),(0,A.jsx)(ie,{label:e(`note.openList`),variant:`default`})]})})})}),E&&(0,A.jsx)(fe,{title:E.title,placeholder:E.placeholder,defaultValue:E.defaultValue,confirmText:E.confirmText,onConfirm:E.onConfirm,onClose:()=>_e(null)}),O&&(0,A.jsx)(ve,{title:O.title,message:O.message,confirmText:O.confirmText,danger:!0,onConfirm:O.onConfirm,onClose:()=>j(null)}),M&&(0,A.jsx)(xe,{target:M,targetLabel:Re(M),directories:$e,onMove:Q,onClose:()=>we(null)})]})}function K(){let{t:e,formatDate:t,compareStrings:n}=le(),r=ee(),i=ue({select:e=>e.searchStr}),o=(0,k.useMemo)(()=>Te(i),[i]),s=(0,k.useRef)(null),c=d(e=>e.addToast),l=a(e=>e.wallet),m=a(e=>e.openLoginModal),g=o.file||``,y=!!g,b=y&&o.mode===`edit`,[x,E]=(0,k.useState)(null),[D,O]=(0,k.useState)([]),[j,M]=(0,k.useState)(``),[we,P]=(0,k.useState)(!0),[De,Me]=(0,k.useState)(``),[L,Ne]=(0,k.useState)(``),[R,Pe]=(0,k.useState)(!1),[z,B]=(0,k.useState)(null),[He,V]=(0,k.useState)(``),[qe,W]=(0,k.useState)(``),[G,K]=(0,k.useState)(!1),[q,Je]=(0,k.useState)(``),[Ye,Xe]=(0,k.useState)(!1),[Ze,Qe]=(0,k.useState)(()=>new Set(ze(j))),[J,$e]=(0,k.useState)(null),[et,tt]=(0,k.useState)(null),[Y,nt]=(0,k.useState)(null),rt=(0,k.useRef)(``),it=(0,k.useRef)(``),X=(0,k.useMemo)(()=>H(D),[D]),Z=X.find(e=>e.cid===g),at=(0,k.useMemo)(()=>Ke(X,n),[n,X]),ot=(0,k.useMemo)(()=>Ue(X,n),[n,X]),st=(0,k.useMemo)(()=>We(ot,L),[ot,L]),ct=(0,k.useMemo)(()=>Le(z?.content||``,X,e=>N({file:e.cid}),Z?.path||z?.directory||``,e=>N({path:Ae(e)})),[z?.content,z?.directory,Z?.path,X]),lt=(0,k.useCallback)(e=>Ie(e,X,e=>N({file:e.cid}),Z?.path||z?.directory||``,e=>N({path:Ae(e)})),[z?.directory,Z?.path,X]);(0,k.useEffect)(()=>{Z?.path&&Qe(e=>Ve(e,ze(Z.path)))},[Z?.path]),(0,k.useEffect)(()=>{if(!o.path||g||X.length===0)return;let e=Fe(X,o.path);e&&(M(f(e.path||``)),r({href:N({file:e.cid}),replace:!0}))},[g,r,o.path,X]),(0,k.useEffect)(()=>{let t=o.chatDraft||``;if(!t||rt.current===t||we)return;if(!l){let e=`${t}:auth`;it.current!==e&&(it.current=e,m());return}if(x?.configured!==!0){let n=`${t}:vault`;it.current!==n&&(it.current=n,c(e(`note.chatDraft.openVaultFirst`),`warning`));return}let n=ne(t);if(!n){rt.current=t,c(e(`note.chatDraft.missing`),`warning`),$({},!0);return}rt.current=t,_t(n)},[c,o.chatDraft,e,we,x?.configured,l]);let Q=(0,k.useCallback)(async()=>{if(!l){E(null),O([]),Me(e(`note.vault.loginRequired`)),P(!1);return}P(!0),Me(``);try{let e=await T();E(e),e.configured?O(await ge()):O([])}catch(t){E(null),O([]),Me(await u(t,e(`note.vault.loadFailed`)))}finally{P(!1)}},[e,l]);(0,k.useEffect)(()=>{Q()},[Q]),(0,k.useEffect)(()=>{V(F(z?.name||Z?.name||``))},[z?.name,Z?.name]),(0,k.useEffect)(()=>{let t=!1;async function n(){if(!g){B(null),W(``),Je(``),K(!1);return}if(!l){B(null),W(``),Je(e(`note.vault.loginRequired`)),K(!1);return}if(x?.configured!==!0){B(null),W(``),Je(``),K(!1);return}K(!0),Je(``);try{let e=await me(g);if(t)return;B(e),W(e.content)}catch(n){if(t)return;B(null),W(``),Je(await u(n,e(`note.error.notFound`)))}finally{t||K(!1)}}return n(),()=>{t=!0}},[g,e,x?.configured,l]);function $(e={},t=!1){r({href:N(e),replace:t})}function ut(e){$(Ee(e))}function dt(e){M(f(e.path||``)),$({file:e.cid})}function ft(e){M(e.fullPath),Qe(t=>Be(t,e.fullPath))}function pt(){g&&$({file:g,mode:`edit`})}function mt(){V(F(z?.name||Z?.name||``)),$(g?{file:g}:{})}async function ht(){if(!l){m();return}let t=window.electronAPI?.selectNoteVaultDirectory;if(!t){c(e(`note.vault.selectFailed`),`error`);return}Pe(!0);try{let n=await t();if(!n)return;await he(n),await Q(),$({},!0),c(e(`note.vault.opened`),`success`)}catch(t){c(await u(t,e(`note.vault.selectFailed`)),`error`)}finally{Pe(!1)}}function gt(){return l?x?.configured===!0?!0:(c(e(`note.vault.emptyPrompt`),`warning`),!1):(m(),!1)}async function _t(t){if(gt())try{let n=ke(t.title,e(`note.chatDraft.defaultTitle`),e=>D.some(t=>f(t.directory)===f(j)&&t.name===e)),r=await w(f(j?`${j}/${n}`:n),t.content);re(t.id),await Q(),c(e(`note.chatDraft.created`),`success`),$({file:r.path,mode:`edit`},!0)}catch(t){rt.current=``,c(await u(t,e(`note.toast.createFailed`)),`error`)}}function vt(){gt()&&$e({title:e(`note.create.title`),placeholder:e(`note.namePlaceholder`),confirmText:e(`note.create.action`),onConfirm:async t=>{if(!gt())return;let n=U(j,t);if(!n){c(e(`note.toast.nameRequired`),`warning`);return}try{let t=await w(n,``);$e(null),await Q(),$({file:t.path,mode:`edit`}),c(e(`note.toast.created`),`success`)}catch(t){c(await u(t,e(`note.toast.createFailed`)),`error`)}}})}function yt(e){gt()&&nt(e)}async function bt(t){if(!(!Y||!gt()))try{let n=g;if(Y.type===`directory`){let e=Oe(Y),r=f(t?`${t}/${Y.name}`:Y.name),i=D.filter(t=>t.path.startsWith(`${e}/`));for(let t of i){let i=f(`${r}/${t.path.slice(e.length+1)}`);await S(t.path,i),g===t.path&&(n=i)}}else{let e=f(t?`${t}/${Y.name}`:Y.name),r=await S(Y.cid,e);g===Y.cid&&(n=r.path)}nt(null),await Q(),$(n?{file:n}:{},!0),c(e(`note.toast.moved`),`success`)}catch(t){c(await u(t,e(`note.toast.moveFailed`)),`error`)}}function xt(t){gt()&&tt({title:t.type===`directory`?e(`note.delete.folderTitle`):e(`note.delete.noteTitle`),message:e(`note.delete.message`,{name:Re(t)}),confirmText:e(`note.action.delete`),onConfirm:async()=>{try{if(t.type===`directory`){let e=Oe(t),n=D.filter(t=>t.path.startsWith(`${e}/`));for(let e of n)await pe(e.path);g.startsWith(`${e}/`)&&$({},!0)}else await pe(t.cid),g===t.cid&&$({},!0);tt(null),await Q(),c(e(`note.toast.deleted`),`success`)}catch(t){c(await u(t,e(`note.toast.deleteFailed`)),`error`)}}})}async function St(){if(!l){m();return}if(!g||!z){c(e(`note.toast.notFound`),`error`);return}let t=I(He);if(!t){c(e(`note.toast.nameRequired`),`warning`);return}Xe(!0);try{let n=s.current?.getMarkdown()??qe,r=z.path;if(t!==z.name){r=f(z.directory?`${z.directory}/${t}`:t);let e=await S(z.path,r);B(e),V(F(e.name)),r=e.path}let i=await _e(r,n);B(i),V(F(i.name)),W(i.content),await Q(),$({file:i.path},!0),c(e(`note.toast.saved`),`success`)}catch(t){c(await u(t,e(`note.toast.saveFailed`)),`error`)}finally{Xe(!1)}}let Ct=(0,A.jsxs)(`div`,{className:`note-header-title`,children:[(0,A.jsx)(`h2`,{className:`header-title`,children:e(`note.title`)}),(0,A.jsx)(`span`,{children:e(`note.count`,{count:D.length})})]}),wt=(0,A.jsx)(`div`,{className:`note-theme-wrap`,children:(0,A.jsxs)(`button`,{className:`btn btn-sm`,onClick:ht,disabled:R,title:e(`note.vault.open`),"aria-label":e(`note.vault.open`),children:[(0,A.jsx)(_,{size:16}),e(R?`note.vault.opening`:`note.vault.open`)]})}),Tt=(0,A.jsxs)(`section`,{className:`note-list-panel note-sidebar-list`,"aria-label":e(`note.listLabel`),children:[(0,A.jsxs)(`div`,{className:`note-search`,children:[(0,A.jsx)(se,{size:16}),(0,A.jsx)(`input`,{className:`input input-flex`,value:L,onChange:e=>Ne(e.target.value),placeholder:e(`note.search.placeholder`)})]}),we?(0,A.jsxs)(`div`,{className:`ui-empty-state note-empty-state`,children:[(0,A.jsx)(v,{size:32}),(0,A.jsx)(`p`,{children:e(`note.loading`)})]}):De?(0,A.jsxs)(`div`,{className:`ui-empty-state note-empty-state`,children:[(0,A.jsx)(h,{size:32}),(0,A.jsx)(`p`,{children:De})]}):x?.configured===!0?st.length===0?(0,A.jsxs)(`div`,{className:`ui-empty-state note-empty-state`,children:[(0,A.jsx)(v,{size:32}),(0,A.jsx)(`p`,{children:e(L?`note.empty.noMatches`:`note.vault.noFiles`)})]}):(0,A.jsx)(Ge,{nodes:st,searchQuery:L,expandedPaths:Ze,activeFileId:g,activeFolderPath:g?``:j,onToggleDirectory:ft,onOpenFile:dt,renderActions:t=>(0,A.jsx)(C,{ariaLabel:e(`common.moreActions`),className:`note-list-actions-anchor`,placement:`bottom-end`,items:[{key:`move`,label:e(`note.action.move`),icon:(0,A.jsx)(ye,{size:16}),onSelect:()=>yt(t)},{key:`delete`,label:e(`note.action.delete`),icon:(0,A.jsx)(ce,{size:16}),danger:!0,onSelect:()=>xt(t)}],renderTrigger:t=>(0,A.jsx)(`button`,{...t,className:`note-list-actions-trigger`,title:e(`common.moreActions`),"aria-label":e(`common.moreActions`),children:(0,A.jsx)(p,{size:16})})})}):(0,A.jsxs)(`div`,{className:`ui-empty-state note-empty-state`,children:[(0,A.jsx)(_,{size:32}),(0,A.jsxs)(`button`,{className:`btn btn-primary`,onClick:ht,disabled:R,children:[(0,A.jsx)(_,{size:16}),e(R?`note.vault.opening`:`note.vault.open`)]})]}),x?.configured===!0&&(0,A.jsx)(`div`,{className:`note-create-btn`,children:(0,A.jsxs)(`button`,{className:`btn`,onClick:vt,children:[(0,A.jsx)(te,{size:16}),e(`note.newNote`)]})})]}),Et=z?.mtimeMs||Z?.updated_at||Date.now(),Dt=F(z?.name||Z?.name||``)||e(`note.untitled`);return(0,A.jsxs)(ae,{sidebar:()=>(0,A.jsx)(Se,{children:Tt}),headerTitle:Ct,headerRight:wt,children:[(0,A.jsx)(`main`,{className:`note-page note-browser-page ${y?`has-editor`:``}`,children:(0,A.jsx)(`section`,{className:`note-workspace`,children:(0,A.jsx)(`section`,{className:`note-editor-panel`,"aria-label":e(b?`note.editorLabel.edit`:`note.editorLabel.read`),children:y?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(`div`,{className:`note-editor-panel-header`,children:[(0,A.jsxs)(`div`,{className:`note-editor-title-area`,children:[b&&z?(0,A.jsx)(`input`,{className:`note-title-input`,value:He,onChange:e=>V(e.target.value),onKeyDown:e=>{if(e.key===`Enter`){e.currentTarget.blur();return}e.key===`Escape`&&(V(F(z.name)),e.currentTarget.blur())},placeholder:e(`note.namePlaceholder`),translate:`no`}):(0,A.jsx)(`h3`,{translate:`no`,children:Dt}),(0,A.jsxs)(`div`,{className:`note-editor-info`,children:[(0,A.jsx)(`span`,{children:e(b?`note.mode.edit`:`note.mode.read`)}),(0,A.jsx)(`span`,{translate:`no`,children:je(g)}),(0,A.jsx)(`span`,{children:t(Et)})]})]}),(0,A.jsxs)(`div`,{className:`note-editor-actions`,children:[(0,A.jsx)(`button`,{type:`button`,className:`btn btn-icon`,onClick:b?mt:()=>$(),title:e(b?`common.cancel`:`common.close`),"aria-label":e(b?`common.cancel`:`common.close`),children:(0,A.jsx)(de,{size:16})}),b?(0,A.jsxs)(`button`,{className:`btn btn-sm btn-primary`,onClick:St,disabled:Ye||!!q||!z,children:[(0,A.jsx)(oe,{size:16}),e(Ye?`note.action.saving`:`note.action.save`)]}):Z&&(0,A.jsxs)(`button`,{type:`button`,className:`btn btn-sm btn-primary`,onClick:pt,disabled:!!q||!z,title:e(`note.action.edit`),"aria-label":e(`note.action.edit`),children:[(0,A.jsx)(be,{size:16}),e(`note.action.edit`)]})]})]}),G?(0,A.jsxs)(`div`,{className:`ui-empty-state note-empty-state editor-error`,children:[(0,A.jsx)(v,{size:36}),(0,A.jsx)(`p`,{children:e(`note.loading`)})]}):q?(0,A.jsxs)(`div`,{className:`ui-empty-state note-empty-state editor-error`,children:[(0,A.jsx)(h,{size:36}),(0,A.jsx)(`p`,{children:q})]}):b?(0,A.jsx)(`div`,{className:`note-editor-frame editing`,children:(0,A.jsx)(Ce,{ref:s,content:qe,onChange:W,className:`milkdown-editor`})}):z?(0,A.jsx)(`div`,{className:`note-editor-frame reading`,children:(0,A.jsx)(Ce,{content:ct,readOnly:!0,onInternalNoteLinkOpen:ut,resolveWikiNoteLink:lt,className:`milkdown-editor`})}):(0,A.jsxs)(`div`,{className:`ui-empty-state note-empty-state editor-error`,children:[(0,A.jsx)(v,{size:36}),(0,A.jsx)(`p`,{children:e(`note.error.notFound`)})]})]}):(0,A.jsxs)(`div`,{className:`ui-empty-state note-editor-empty`,children:[(0,A.jsx)(`div`,{className:`ui-empty-icon note-editor-empty-icon`,children:(0,A.jsx)(v,{size:32})}),(0,A.jsx)(`h3`,{className:`ui-empty-title`,children:x?.configured?e(`note.noOpen.title`):e(`note.vault.open`)}),(0,A.jsx)(`p`,{className:`ui-empty-desc`,children:x?.configured?e(`note.noOpen.select`):e(`note.vault.emptyPrompt`)}),x?.configured?(0,A.jsx)(ie,{label:e(`note.openList`),variant:`default`}):(0,A.jsxs)(`button`,{className:`btn btn-primary`,onClick:ht,disabled:R,children:[(0,A.jsx)(_,{size:16}),e(R?`note.vault.opening`:`note.vault.open`)]})]})})})}),J&&(0,A.jsx)(fe,{title:J.title,placeholder:J.placeholder,defaultValue:J.defaultValue,confirmText:J.confirmText,onConfirm:J.onConfirm,onClose:()=>$e(null)}),et&&(0,A.jsx)(ve,{title:et.title,message:et.message,confirmText:et.confirmText,danger:!0,onConfirm:et.onConfirm,onClose:()=>tt(null)}),Y&&(0,A.jsx)(xe,{target:Y,targetLabel:Re(Y),directories:at,onMove:bt,onClose:()=>nt(null)})]})}function q(){let{t:e}=le(),t=d(e=>e.hasBackend),n=a(e=>e.wallet),r=x(),i=t===!0&&qe(c()),o=W(i,n?.address||``),s=i&&(r||o);return(0,A.jsx)(k.Suspense,{fallback:(0,A.jsx)(`div`,{className:`note-editor-loading`,children:e(`note.loading`)}),children:s?(0,A.jsx)(K,{}):(0,A.jsx)(G,{})})}var Je=o(`/note/`)({component:q});export{Je as Route};
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/MilkdownEditor-BzbYt-xb.js","assets/jsx-runtime-Bt-cYkS5.js","assets/index-D0Uk9-58.js","assets/useAppStore-DOnk608w.js","assets/useNavigate-DWlBD_-b.js","assets/index-FV6RZlVI.css","assets/dist-CSyRxrry.js","assets/dist-RU_cpjXQ.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{n as e,o as t,t as n}from"./jsx-runtime-Bt-cYkS5.js";import{B as r,C as i,E as a,H as o,M as s,d as c,j as l,o as u,t as d,w as f}from"./useAppStore-DOnk608w.js";import{n as ee}from"./useNavigate-DWlBD_-b.js";import{a as te,i as ne,n as re,o as p}from"./chatNoteDraft-CYbvcEvC.js";import{t as ie}from"./OpenSidebarButton-CGhXxQ5Z.js";import{n as m,t as h}from"./lock-CuwwlXlx.js";import{t as g}from"./chevron-right-D75NRNNs.js";import{n as _,t as v}from"./notebook-pen-BzrCXQJE.js";import{t as y}from"./folder-BS_GbpPQ.js";import{n as ae,t as b}from"./AppTop-Cy0ZOCxO.js";import{t as oe}from"./save-B02sbO9Y.js";import{t as se}from"./search-HW4oPOBP.js";import{t as ce}from"./trash-2-BLwoM0ME.js";import{A as le,N as ue,S as de,_ as fe,a as pe,b as x,c as S,g as C,i as w,l as me,o as T,r as he,s as ge,t as E,u as _e,v as ve,w as D,y as O}from"./index-D0Uk9-58.js";var ye=r(`move`,[[`path`,{d:`M12 2v20`,key:`t6zp3m`}],[`path`,{d:`m15 19-3 3-3-3`,key:`11eu04`}],[`path`,{d:`m19 9 3 3-3 3`,key:`1mg7y2`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}],[`path`,{d:`m5 9-3 3 3 3`,key:`j64kie`}],[`path`,{d:`m9 5 3-3 3 3`,key:`l8vdw6`}]]),be=r(`pencil-ruler`,[[`path`,{d:`M13 7 8.7 2.7a2.41 2.41 0 0 0-3.4 0L2.7 5.3a2.41 2.41 0 0 0 0 3.4L7 13`,key:`orapub`}],[`path`,{d:`m8 6 2-2`,key:`115y1s`}],[`path`,{d:`m18 16 2-2`,key:`ee94s4`}],[`path`,{d:`m17 11 4.3 4.3c.94.94.94 2.46 0 3.4l-2.6 2.6c-.94.94-2.46.94-3.4 0L11 17`,key:`cfq27r`}],[`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`}]]),k=t(e(),1),A=n();function j(e){return e.type===`directory`?f(e.path?`${e.path}/${e.name}`:e.name):i(e)}function xe({target:e,targetLabel:t,directories:n,onMove:r,onClose:i}){let{t:a}=le(),o=f(e.path||``),s=j(e),c=n.filter(t=>e.type===`directory`?t.path!==s&&!t.path.startsWith(`${s}/`):!0),[l,u]=(0,k.useState)(o),[d,ee]=(0,k.useState)(``),[te,ne]=(0,k.useState)(new Set),re=f(d),p=d.trim()?re:l,ie=f(p)===o,h=a(`note.move.rootDirectory`),_=new Map;for(let e of c){let t=_.get(e.parentPath)||[];t.push(e),_.set(e.parentPath,t)}let v=c.filter(e=>{if(!e.parentPath)return!0;let t=e.parentPath.split(`/`).filter(Boolean);return t.every((e,n)=>te.has(t.slice(0,n+1).join(`/`)))}),ae=[{label:h,path:``},...l.split(`/`).filter(Boolean).map((e,t,n)=>({label:e,path:n.slice(0,t+1).join(`/`)}))];function b(e){u(f(e)),ee(``)}function oe(e){b(e),_.has(e)&&ne(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}function se(){ie||r(p)}return(0,A.jsx)(O,{onClose:i,children:(0,A.jsxs)(`div`,{className:`note-move-modal`,onClick:e=>e.stopPropagation(),children:[(0,A.jsxs)(`div`,{className:`modal-header`,children:[(0,A.jsx)(`h3`,{children:a(`note.move.title`)}),(0,A.jsx)(`button`,{className:`btn btn-icon`,onClick:i,children:(0,A.jsx)(de,{size:18})})]}),(0,A.jsxs)(`div`,{className:`note-move-target`,children:[(0,A.jsx)(`span`,{children:a(`note.move.moving`)}),(0,A.jsx)(`strong`,{translate:`no`,children:t||e.name})]}),(0,A.jsx)(`div`,{className:`note-move-path`,children:ae.map((e,t)=>(0,A.jsxs)(k.Fragment,{children:[t>0&&(0,A.jsx)(`span`,{children:`/`}),(0,A.jsx)(`button`,{type:`button`,onClick:()=>b(e.path),children:(0,A.jsx)(`span`,{translate:e.path?`no`:`yes`,children:e.label})})]},e.path||`root`))}),(0,A.jsxs)(`div`,{className:`note-move-folder-list`,children:[(0,A.jsxs)(`button`,{type:`button`,className:`note-move-folder-item ${l===``?`selected`:``}`,onClick:()=>b(``),children:[(0,A.jsx)(`span`,{className:`note-move-folder-spacer`}),(0,A.jsx)(y,{className:`note-move-folder-icon`,size:16}),(0,A.jsx)(`span`,{children:h})]}),c.length===0?(0,A.jsx)(`p`,{className:`note-move-empty`,children:a(`note.move.noFolders`)}):v.map(e=>{let t=_.has(e.path),n=te.has(e.path);return(0,A.jsxs)(`button`,{type:`button`,className:`note-move-folder-item note-move-depth-${Math.min(e.depth,4)} ${l===e.path?`selected`:``}`,onClick:()=>oe(e.path),children:[t?n?(0,A.jsx)(m,{className:`note-move-expander`,size:14}):(0,A.jsx)(g,{className:`note-move-expander`,size:14}):(0,A.jsx)(`span`,{className:`note-move-folder-spacer`}),(0,A.jsx)(y,{className:`note-move-folder-icon`,size:16}),(0,A.jsx)(`span`,{translate:`no`,children:e.name}),e.parentPath&&(0,A.jsx)(`small`,{translate:`no`,children:e.parentPath})]},e.path)})]}),(0,A.jsx)(`input`,{className:`input input-compact`,value:d,onChange:e=>ee(e.target.value),placeholder:a(`note.move.pathPlaceholder`),translate:`no`}),(0,A.jsxs)(`div`,{className:`note-move-destination`,children:[(0,A.jsx)(`span`,{children:a(`note.move.destinationLabel`)}),(0,A.jsx)(`span`,{translate:p?`no`:`yes`,children:p||h})]}),(0,A.jsxs)(`div`,{className:`modal-actions`,children:[(0,A.jsx)(`button`,{className:`btn btn-secondary`,onClick:i,children:a(`common.cancel`)}),(0,A.jsx)(`button`,{className:`btn btn-primary`,onClick:se,disabled:ie,children:a(`note.action.move`)})]})]})})}function Se({children:e}){return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(b,{}),e]})}var Ce=(0,k.lazy)(async()=>({default:(await E(()=>import(`./MilkdownEditor-BzbYt-xb.js`),__vite__mapDeps([0,1,2,3,4,5,6,7]))).MilkdownEditor})),M=/\[\[([^\]\n]+?)\]\]/g,we=/(```[\s\S]*?```)/g;function Te(e){let t=new URLSearchParams(e),n=t.get(`mode`);return{cid:t.get(`cid`)||void 0,file:t.get(`file`)||void 0,path:t.get(`path`)||void 0,chatDraft:t.get(`chatDraft`)||void 0,mode:n===`edit`?`edit`:void 0}}function N(e={}){let t=new URLSearchParams;e.cid&&t.set(`cid`,e.cid),e.file&&t.set(`file`,e.file),e.path&&t.set(`path`,e.path),e.chatDraft&&t.set(`chatDraft`,e.chatDraft),e.mode&&t.set(`mode`,e.mode);let n=t.toString();return n?`/note/?${n}`:`/note/`}function Ee(e){let t=e.indexOf(`?`),n=t>=0?e.slice(t):``;if(typeof window>`u`)return Te(n);try{return Te(new URL(e,window.location.origin).search)}catch{return Te(n)}}var P={"note.error.nameRequired":`note.error.nameRequired`,"note.error.nameNoSlash":`note.error.nameNoSlash`,"note.error.nameNoBackslash":`note.error.nameNoBackslash`,"note.error.nameInvalid":`note.error.nameInvalid`,"note.error.nameConflict":`note.error.nameConflict`,"note.error.moveIntoSelf":`note.error.moveIntoSelf`};function De(e,t,n){let r=e instanceof Error?e.message:``,i=P[r];return i?n(i):r||t}function Oe(e){return e.type===`directory`?f(e.path?`${e.path}/${e.name}`:e.name):i(e)}function F(e=``){return String(e).trim().replace(/\.md$/i,``)}function I(e){let t=F(e);return t?`${t}.md`:``}function ke(e,t,n){let r=F(e)||t;for(let e=0;e<1e3;e+=1){let t=I(e===0?r:`${r} ${e+1}`);if(t&&!n(t))return t}return I(`${r} ${Date.now()}`)}function Ae(e=``){let t=f(e).split(`/`).filter(Boolean);if(t.length===0)return``;let n=t.length-1;return t[n]=I(t[n]),t.join(`/`)}function je(e=``){let t=f(e).split(`/`).filter(Boolean);if(t.length===0)return``;let n=t.length-1;return t[n]=F(t[n]),t.join(`/`)}function Me(e){return je(i(e))}function L(e){let t=e.trim().replace(/^\/+/,``),n=t.search(/[#^]/);return je(n>=0?t.slice(0,n):t)}function Ne(e,t){let n=t?.trim();if(n)return n;let r=e.split(`/`).filter(Boolean);return r[r.length-1]||e}function R(e){return e.replace(/\\/g,`\\\\`).replace(/\[/g,`\\[`).replace(/\]/g,`\\]`)}function Pe(e,t){return`[${R(e)}](<${t.replace(/>/g,`%3E`)}>)`}function Fe(e,t,n=``){let r=L(t);if(!r)return null;let i=r.toLowerCase(),a=e=>Me(e).toLowerCase();if(r.includes(`/`))return e.find(e=>a(e)===i)||null;let o=f(n);if(o){let t=f(`${o}/${r}`).toLowerCase(),n=e.find(e=>a(e)===t);if(n)return n}return e.find(e=>F(e.name).toLowerCase()===i)||null}function Ie(e,t,n,r=``,i){let a=e.indexOf(`|`),o=a>=0?e.slice(0,a):e,s=a>=0?e.slice(a+1):void 0,c=L(o);if(!c)return null;let l=Fe(t,o,r),u=l?n(l):i?.(c);return u?{label:Ne(c,s),href:u}:null}function Le(e,t,n,r=``,i){return e.includes(`[[`)?e.split(we).map(e=>e.startsWith("```")?e:e.replace(M,(e,a)=>{let o=Ie(a,t,n,r,i);return o?Pe(o.label,o.href):e})).join(``):e}function z(e){return e.type===`file`?F(e.name):e.name}function B(e){return e.type===`file`?je(e.fullPath):e.fullPath}function Re(e){return e.type===`file`?F(e.name):e.name}function ze(e=``){let t=f(e).split(`/`).filter(Boolean);return t.map((e,n)=>t.slice(0,n+1).join(`/`))}function Be(e,t){let n=new Set(e);return n.has(t)?n.delete(t):n.add(t),n}function Ve(e,t){if(t.length===0)return e;let n=!1,r=new Set(e);for(let e of t)r.has(e)||(r.add(e),n=!0);return n?r:e}function He(e){return{name:e.name,cid:`__dir__${e.fullPath}`,path:e.path,type:`directory`,size:0,created_at:e.updatedAt,updated_at:e.updatedAt}}function Ue(e,t){let n=[],r=new Map;function a(e){return e&&r.get(e)?.children||n}function o(e,t,n){let i=f(t?`${t}/${e}`:e),o=r.get(i);if(o)return o.updatedAt=Math.max(o.updatedAt,n),o;let s={id:`directory:${i}`,type:`directory`,name:e,path:t,fullPath:i,updatedAt:n,children:[]};return r.set(i,s),a(t).push(s),s}for(let t of e){let e=f(t.path||``),n=e.split(`/`).filter(Boolean),r=t.updated_at||t.created_at||0,s=``;for(let e of n)s=o(e,s,r).fullPath;a(s).push({id:`file:${t.cid}:${i(t)}`,type:`file`,name:t.name,path:e,fullPath:i(t),updatedAt:r,note:t,children:[]})}function s(e){e.sort((e,n)=>{if(e.type!==n.type)return e.type===`directory`?-1:1;let r=t(z(e),z(n));return r===0?t(B(e),B(n)):r});for(let t of e)t.type===`directory`&&s(t.children)}return s(n),n}function We(e,t){let n=t.trim().toLowerCase();return n?e.flatMap(e=>{let t=z(e).toLowerCase(),r=B(e).toLowerCase(),i=t.includes(n)||r.includes(n);if(e.type===`file`)return i?[e]:[];let a=i?e.children:We(e.children,n);return!i&&a.length===0?[]:[{...e,children:a}]}):e}function Ge({nodes:e,searchQuery:t,expandedPaths:n,activeFileId:r,activeFolderPath:i,onToggleDirectory:a,onOpenFile:o,renderActions:s}){let c=t.trim().length>0;return(0,A.jsx)(`div`,{className:`note-tree`,role:`tree`,children:e.map(e=>(0,A.jsx)(V,{node:e,forceExpanded:c,expandedPaths:n,activeFileId:r,activeFolderPath:i,onToggleDirectory:a,onOpenFile:o,renderActions:s},e.id))})}function V({node:e,forceExpanded:t,expandedPaths:n,activeFileId:r,activeFolderPath:i,onToggleDirectory:a,onOpenFile:o,renderActions:s}){let c=e.type===`directory`,l=c&&(t||n.has(e.fullPath)),u=e.type===`file`&&e.note?.cid===r,d=c&&f(i)===e.fullPath,ee=c?He(e):e.note||null,te=ee&&s?s(ee):null;return(0,A.jsxs)(`div`,{className:`note-tree-node`,role:`none`,children:[(0,A.jsxs)(`div`,{className:`note-tree-row ${c?`is-directory`:`is-file`} ${u?`is-active`:``} ${d?`is-folder-active`:``} ${te?`has-actions`:``}`,children:[(0,A.jsxs)(`button`,{type:`button`,className:`note-tree-item`,role:`treeitem`,"aria-expanded":c?l:void 0,onClick:()=>{if(c){a(e);return}e.note&&o(e.note)},children:[(0,A.jsx)(`span`,{className:`note-tree-toggle`,"aria-hidden":`true`,children:c?l?(0,A.jsx)(m,{size:16}):(0,A.jsx)(g,{size:16}):(0,A.jsx)(`span`,{className:`note-tree-toggle-placeholder`})}),(0,A.jsx)(`span`,{className:`note-tree-label`,translate:`no`,children:z(e)}),e.note?.isSecret&&(0,A.jsx)(h,{className:`note-tree-lock`,size:14,"aria-hidden":`true`})]}),te]}),c&&l&&e.children.length>0&&(0,A.jsx)(`div`,{className:`note-tree-children`,role:`group`,children:e.children.map(e=>(0,A.jsx)(V,{node:e,forceExpanded:t,expandedPaths:n,activeFileId:r,activeFolderPath:i,onToggleDirectory:a,onOpenFile:o,renderActions:s},e.id))})]})}function Ke(e,t){let n=new Set;for(let t of e){let e=f(t.path).split(`/`).filter(Boolean);for(let t=0;t<e.length;t+=1)n.add(e.slice(0,t+1).join(`/`))}return Array.from(n).sort(t).map(e=>{let t=e.split(`/`);return{path:e,name:t[t.length-1]||e,parentPath:t.slice(0,-1).join(`/`),depth:Math.max(t.length-1,0)}})}function H(e){return e.map(e=>({name:e.name,cid:e.path,path:f(e.directory),content:``,size:e.size,type:`file`,created_at:Number(e.mtimeMs)||Date.now(),updated_at:Number(e.mtimeMs)||Date.now(),isSecret:!1}))}function U(e,t){let n=I(t);return f(e?`${e}/${n}`:n)}function qe(e){let t=e||typeof window<`u`&&window.location.origin||``;if(!t)return!1;try{let e=new URL(t).hostname.toLowerCase();return e===`localhost`||e===`127.0.0.1`||e===`::1`||e===`[::1]`||e.startsWith(`127.`)}catch{return!1}}function W(e,t=``){let[n,r]=(0,k.useState)(!1);return(0,k.useEffect)(()=>{let n=!1;return!e||!t?(r(!1),()=>{n=!0}):(T().then(e=>{n||r(e.configured===!0)}).catch(()=>{n||r(!1)}),()=>{n=!0})},[e,t]),n}function G(){let{t:e,formatDate:t,compareStrings:n}=le(),r=ee(),i=ue({select:e=>e.searchStr}),o=(0,k.useMemo)(()=>Te(i),[i]),c=(0,k.useRef)(null),u=d(e=>e.addToast),p=a(e=>e.wallet),m=a(e=>e.openLoginModal),g=d(e=>e.notes),_=d(e=>e.notesPath),y=d(e=>e.setNotesPath),b=d(e=>e.saveNote),pe=d(e=>e.deleteNote),x=d(e=>e.renameNote),S=d(e=>e.localDataReady),C=o.cid||``,w=g.find(e=>e.cid===C),me=!!C,T=me&&o.mode===`edit`,[he,ge]=(0,k.useState)(``),[E,_e]=(0,k.useState)(null),[O,j]=(0,k.useState)(null),[M,we]=(0,k.useState)(null),P=(0,k.useRef)(``),je=(0,k.useRef)(``),[Me,L]=(0,k.useState)(``),[Ne,R]=(0,k.useState)(``),[Pe,z]=(0,k.useState)(``),[B,He]=(0,k.useState)(``),[V,H]=(0,k.useState)(``),[U,qe]=(0,k.useState)(!1),[W,G]=(0,k.useState)(``),[K,q]=(0,k.useState)(!1),[Je,Ye]=(0,k.useState)(()=>new Set(ze(_)));(0,k.useEffect)(()=>{if(!C){L(``),R(``);return}if(!w){L(``),R(S?e(`note.error.notFound`):``);return}if(w.content.startsWith(`mp://1`)){if(!p){L(``),R(e(`note.error.loginToDecrypt`));return}let t=l(w.content,p.danger);if(!t){L(``),R(e(`note.error.decryptFailed`));return}L(t),R(``);return}L(w.content||``),R(``)},[C,S,w,e,p]),(0,k.useEffect)(()=>{if(!T){q(!1);return}if(!C||!w){z(``),He(``),H(``),qe(!1),G(S?e(`note.error.notFound`):``);return}if(z(F(w.name)),He(w.path||``),qe(w.isSecret===!0||w.content.startsWith(`mp://1`)),w.content.startsWith(`mp://1`)){if(!p){H(``),G(e(`note.error.loginToDecrypt`));return}let t=l(w.content,p.danger);if(!t){H(``),G(e(`note.error.decryptFailed`));return}H(t),G(``);return}H(w.content||``),G(``)},[C,T,S,w,e,p]);let Xe=(0,k.useMemo)(()=>Ue(g,n),[n,g]),Ze=(0,k.useMemo)(()=>We(Xe,he),[Xe,he]),Qe=w?.isSecret===!0||w?.content.startsWith(`mp://1`)===!0,J=e(T?U?`note.privacy.secret`:`note.privacy.public`:Qe?`note.privacy.secret`:`note.privacy.public`),$e=(0,k.useMemo)(()=>Ke(g,n),[n,g]),et=(0,k.useMemo)(()=>Le(Me,g,e=>N({cid:e.cid}),w?.path||``,e=>N({path:Ae(e)})),[g,Me,w?.path]),tt=(0,k.useCallback)(e=>Ie(e,g,e=>N({cid:e.cid}),w?.path||``,e=>N({path:Ae(e)})),[g,w?.path]);(0,k.useEffect)(()=>{w?.path&&Ye(e=>Ve(e,ze(w.path)))},[w?.path]),(0,k.useEffect)(()=>{if(!o.path||C||g.length===0)return;let e=Fe(g,o.path);e&&(y(f(e.path||``)),r({href:N({cid:e.cid}),replace:!0}))},[C,r,g,o.path,y]),(0,k.useEffect)(()=>{let t=o.chatDraft||``;if(!t||P.current===t||!S)return;if(!p){let e=`${t}:auth`;je.current!==e&&(je.current=e,m());return}let n=ne(t);if(!n){P.current=t,u(e(`note.chatDraft.missing`),`warning`),Y({},!0);return}P.current=t,at(n)},[u,S,o.chatDraft,e,p]);function Y(e={},t=!1){r({href:N(e),replace:t})}function nt(e){Y(Ee(e))}function rt(e){y(f(e.path||``)),Y({cid:e.cid})}function it(e){y(e.fullPath),Ye(t=>Be(t,e.fullPath))}function X(e){Y({cid:e.cid,mode:`edit`})}function Z(){return p?!0:(m(),!1)}async function at(t){if(p)try{let n=await b({name:ke(t.title,e(`note.chatDraft.defaultTitle`),e=>g.some(t=>f(t.path||``)===f(_)&&t.name===e)),path:_,content:t.content,isSecret:!1});re(t.id),u(e(`note.chatDraft.created`),`success`),Y({cid:n,mode:`edit`},!0)}catch(t){P.current=``,u(De(t,e(`note.toast.createFailed`),e),`error`)}}function ot(){Y(w?{cid:w.cid}:{})}async function st(){if(!Z())return;if(!w){u(e(`note.toast.notFound`),`error`);return}let t=I(Pe);if(!t){u(e(`note.toast.nameRequired`),`warning`);return}q(!0);try{let n=c.current?.getMarkdown()??V,r=U?s(n,p.danger):n,i=await b({cid:w.cid,name:t,path:B,content:r,isSecret:U});H(n),Y({cid:i},!0),u(e(`note.toast.saved`),`success`)}catch(t){u(De(t,e(`note.toast.saveFailed`),e),`error`)}finally{q(!1)}}function ct(){Z()&&_e({title:e(`note.create.title`),placeholder:e(`note.namePlaceholder`),confirmText:e(`note.create.action`),onConfirm:async t=>{if(Z())try{let n=await b({name:I(t),path:_,content:``,isSecret:!1});_e(null),u(e(`note.toast.created`),`success`),Y({cid:n,mode:`edit`})}catch(t){u(De(t,e(`note.toast.createFailed`),e),`error`)}}})}function lt(e){Z()&&we(e)}async function Q(t){if(M)try{x(Oe(M),t,M.name),we(null),u(e(`note.toast.moved`),`success`)}catch(t){u(De(t,e(`note.toast.moveFailed`),e),`error`)}}function $(t){if(!Z())return;let n=t.type===`directory`;j({title:e(n?`note.delete.folderTitle`:`note.delete.noteTitle`),message:e(`note.delete.message`,{name:Re(t)}),confirmText:e(`note.action.delete`),onConfirm:async()=>{pe(n?void 0:t.cid,t.path,t.name),j(null),u(e(`note.toast.deleted`),`success`),t.type===`file`&&t.cid===C&&Y()}})}let ut=(0,A.jsxs)(`div`,{className:`note-header-title`,children:[(0,A.jsx)(`h2`,{className:`header-title`,children:e(`note.title`)}),(0,A.jsx)(`span`,{children:e(`note.count`,{count:g.length})})]}),dt=(0,A.jsx)(`div`,{className:`note-theme-wrap`}),ft=(0,A.jsxs)(`section`,{className:`note-list-panel note-sidebar-list`,"aria-label":e(`note.listLabel`),children:[(0,A.jsxs)(`div`,{className:`note-search`,children:[(0,A.jsx)(se,{size:16}),(0,A.jsx)(`input`,{className:`input input-flex`,value:he,onChange:e=>ge(e.target.value),placeholder:e(`note.search.placeholder`)})]}),Ze.length===0?(0,A.jsxs)(`div`,{className:`ui-empty-state note-empty-state`,children:[(0,A.jsx)(v,{size:32}),(0,A.jsx)(`p`,{children:e(he?`note.empty.noMatches`:`note.empty.noNotes`)})]}):(0,A.jsx)(Ge,{nodes:Ze,searchQuery:he,expandedPaths:Je,activeFileId:C,activeFolderPath:C?``:_,onToggleDirectory:it,onOpenFile:rt}),(0,A.jsx)(`div`,{className:`note-create-btn`,children:(0,A.jsxs)(`button`,{className:`btn`,onClick:ct,children:[(0,A.jsx)(te,{size:16}),e(`note.newNote`)]})})]});return(0,A.jsxs)(ae,{sidebar:()=>(0,A.jsx)(Se,{children:ft}),headerTitle:ut,headerRight:dt,children:[(0,A.jsx)(`main`,{className:`note-page note-browser-page ${me?`has-editor`:``}`,children:(0,A.jsx)(`section`,{className:`note-workspace`,children:(0,A.jsx)(`section`,{className:`note-editor-panel`,"aria-label":e(T?`note.editorLabel.edit`:`note.editorLabel.read`),children:me?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(`div`,{className:`note-editor-panel-header`,children:[(0,A.jsxs)(`div`,{className:`note-editor-title-area`,children:[T?(0,A.jsx)(`input`,{className:`note-title-input`,value:Pe,onChange:e=>z(e.target.value),placeholder:e(`note.namePlaceholder`),translate:`no`,disabled:!w}):w?(0,A.jsx)(`h3`,{translate:`no`,children:F(w.name)}):(0,A.jsx)(`h3`,{children:e(`note.untitled`)}),w&&(0,A.jsxs)(`div`,{className:`note-editor-info`,children:[(0,A.jsx)(`span`,{children:e(T?`note.mode.edit`:`note.mode.read`)}),(0,A.jsx)(`span`,{children:J}),(0,A.jsx)(`span`,{children:t(w.updated_at)})]})]}),(0,A.jsxs)(`div`,{className:`note-editor-actions`,children:[(0,A.jsx)(`button`,{type:`button`,className:`btn btn-icon`,onClick:T?ot:()=>Y(),title:e(T?`common.cancel`:`common.close`),"aria-label":e(T?`common.cancel`:`common.close`),children:(0,A.jsx)(de,{size:16})}),T?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(`button`,{className:`btn btn-sm ${U?`btn-warning`:`btn-secondary`}`,onClick:()=>qe(!U),disabled:!w,children:[U?(0,A.jsx)(h,{size:16}):(0,A.jsx)(D,{size:16}),e(U?`note.privacy.secret`:`note.privacy.public`)]}),(0,A.jsxs)(`button`,{className:`btn btn-sm btn-primary`,onClick:st,disabled:K||!!W||!w,children:[(0,A.jsx)(oe,{size:16}),e(K?`note.action.saving`:`note.action.save`)]})]}):w&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`button`,{type:`button`,className:`btn btn-icon`,onClick:()=>lt(w),title:e(`note.action.move`),"aria-label":e(`note.action.move`),children:(0,A.jsx)(ye,{size:16})}),(0,A.jsx)(`button`,{type:`button`,className:`btn btn-icon note-editor-action-danger`,onClick:()=>$(w),title:e(`note.action.delete`),"aria-label":e(`note.action.delete`),children:(0,A.jsx)(ce,{size:16})}),(0,A.jsxs)(`button`,{type:`button`,className:`btn btn-sm btn-primary`,onClick:()=>X(w),disabled:!!Ne,title:e(`note.action.edit`),"aria-label":e(`note.action.edit`),children:[(0,A.jsx)(be,{size:16}),e(`note.action.edit`)]})]})]})]}),T?W?(0,A.jsxs)(`div`,{className:`note-empty-state editor-error`,children:[(0,A.jsx)(h,{size:36}),(0,A.jsx)(`p`,{children:W})]}):w?(0,A.jsx)(`div`,{className:`note-editor-frame editing`,children:(0,A.jsx)(Ce,{ref:c,content:V,onChange:H,className:`milkdown-editor`})}):(0,A.jsxs)(`div`,{className:`note-empty-state editor-error`,children:[(0,A.jsx)(v,{size:36}),(0,A.jsx)(`p`,{children:e(S?`note.error.notFound`:`note.loading`)})]}):Ne?(0,A.jsxs)(`div`,{className:`ui-empty-state note-empty-state editor-error`,children:[(0,A.jsx)(h,{size:36}),(0,A.jsx)(`p`,{children:Ne})]}):w?(0,A.jsx)(`div`,{className:`note-editor-frame reading`,children:(0,A.jsx)(Ce,{content:et,readOnly:!0,onInternalNoteLinkOpen:nt,resolveWikiNoteLink:tt,className:`milkdown-editor`})}):(0,A.jsxs)(`div`,{className:`ui-empty-state note-empty-state editor-error`,children:[(0,A.jsx)(v,{size:36}),(0,A.jsx)(`p`,{children:e(S?`note.error.notFound`:`note.loading`)})]})]}):(0,A.jsxs)(`div`,{className:`ui-empty-state note-editor-empty`,children:[(0,A.jsx)(`div`,{className:`ui-empty-icon note-editor-empty-icon`,children:(0,A.jsx)(v,{size:32})}),(0,A.jsx)(`h3`,{className:`ui-empty-title`,children:e(`note.noOpen.title`)}),(0,A.jsx)(`p`,{className:`ui-empty-desc`,children:g.length>0?e(`note.noOpen.select`):e(`note.noOpen.createFirst`)}),(0,A.jsx)(ie,{label:e(`note.openList`),variant:`default`})]})})})}),E&&(0,A.jsx)(fe,{title:E.title,placeholder:E.placeholder,defaultValue:E.defaultValue,confirmText:E.confirmText,onConfirm:E.onConfirm,onClose:()=>_e(null)}),O&&(0,A.jsx)(ve,{title:O.title,message:O.message,confirmText:O.confirmText,danger:!0,onConfirm:O.onConfirm,onClose:()=>j(null)}),M&&(0,A.jsx)(xe,{target:M,targetLabel:Re(M),directories:$e,onMove:Q,onClose:()=>we(null)})]})}function K(){let{t:e,formatDate:t,compareStrings:n}=le(),r=ee(),i=ue({select:e=>e.searchStr}),o=(0,k.useMemo)(()=>Te(i),[i]),s=(0,k.useRef)(null),c=d(e=>e.addToast),l=a(e=>e.wallet),m=a(e=>e.openLoginModal),g=o.file||``,y=!!g,b=y&&o.mode===`edit`,[x,E]=(0,k.useState)(null),[D,O]=(0,k.useState)([]),[j,M]=(0,k.useState)(``),[we,P]=(0,k.useState)(!0),[De,Me]=(0,k.useState)(``),[L,Ne]=(0,k.useState)(``),[R,Pe]=(0,k.useState)(!1),[z,B]=(0,k.useState)(null),[He,V]=(0,k.useState)(``),[qe,W]=(0,k.useState)(``),[G,K]=(0,k.useState)(!1),[q,Je]=(0,k.useState)(``),[Ye,Xe]=(0,k.useState)(!1),[Ze,Qe]=(0,k.useState)(()=>new Set(ze(j))),[J,$e]=(0,k.useState)(null),[et,tt]=(0,k.useState)(null),[Y,nt]=(0,k.useState)(null),rt=(0,k.useRef)(``),it=(0,k.useRef)(``),X=(0,k.useMemo)(()=>H(D),[D]),Z=X.find(e=>e.cid===g),at=(0,k.useMemo)(()=>Ke(X,n),[n,X]),ot=(0,k.useMemo)(()=>Ue(X,n),[n,X]),st=(0,k.useMemo)(()=>We(ot,L),[ot,L]),ct=(0,k.useMemo)(()=>Le(z?.content||``,X,e=>N({file:e.cid}),Z?.path||z?.directory||``,e=>N({path:Ae(e)})),[z?.content,z?.directory,Z?.path,X]),lt=(0,k.useCallback)(e=>Ie(e,X,e=>N({file:e.cid}),Z?.path||z?.directory||``,e=>N({path:Ae(e)})),[z?.directory,Z?.path,X]);(0,k.useEffect)(()=>{Z?.path&&Qe(e=>Ve(e,ze(Z.path)))},[Z?.path]),(0,k.useEffect)(()=>{if(!o.path||g||X.length===0)return;let e=Fe(X,o.path);e&&(M(f(e.path||``)),r({href:N({file:e.cid}),replace:!0}))},[g,r,o.path,X]),(0,k.useEffect)(()=>{let t=o.chatDraft||``;if(!t||rt.current===t||we)return;if(!l){let e=`${t}:auth`;it.current!==e&&(it.current=e,m());return}if(x?.configured!==!0){let n=`${t}:vault`;it.current!==n&&(it.current=n,c(e(`note.chatDraft.openVaultFirst`),`warning`));return}let n=ne(t);if(!n){rt.current=t,c(e(`note.chatDraft.missing`),`warning`),$({},!0);return}rt.current=t,_t(n)},[c,o.chatDraft,e,we,x?.configured,l]);let Q=(0,k.useCallback)(async()=>{if(!l){E(null),O([]),Me(e(`note.vault.loginRequired`)),P(!1);return}P(!0),Me(``);try{let e=await T();E(e),e.configured?O(await ge()):O([])}catch(t){E(null),O([]),Me(await u(t,e(`note.vault.loadFailed`)))}finally{P(!1)}},[e,l]);(0,k.useEffect)(()=>{Q()},[Q]),(0,k.useEffect)(()=>{V(F(z?.name||Z?.name||``))},[z?.name,Z?.name]),(0,k.useEffect)(()=>{let t=!1;async function n(){if(!g){B(null),W(``),Je(``),K(!1);return}if(!l){B(null),W(``),Je(e(`note.vault.loginRequired`)),K(!1);return}if(x?.configured!==!0){B(null),W(``),Je(``),K(!1);return}K(!0),Je(``);try{let e=await me(g);if(t)return;B(e),W(e.content)}catch(n){if(t)return;B(null),W(``),Je(await u(n,e(`note.error.notFound`)))}finally{t||K(!1)}}return n(),()=>{t=!0}},[g,e,x?.configured,l]);function $(e={},t=!1){r({href:N(e),replace:t})}function ut(e){$(Ee(e))}function dt(e){M(f(e.path||``)),$({file:e.cid})}function ft(e){M(e.fullPath),Qe(t=>Be(t,e.fullPath))}function pt(){g&&$({file:g,mode:`edit`})}function mt(){V(F(z?.name||Z?.name||``)),$(g?{file:g}:{})}async function ht(){if(!l){m();return}let t=window.electronAPI?.selectNoteVaultDirectory;if(!t){c(e(`note.vault.selectFailed`),`error`);return}Pe(!0);try{let n=await t();if(!n)return;await he(n),await Q(),$({},!0),c(e(`note.vault.opened`),`success`)}catch(t){c(await u(t,e(`note.vault.selectFailed`)),`error`)}finally{Pe(!1)}}function gt(){return l?x?.configured===!0?!0:(c(e(`note.vault.emptyPrompt`),`warning`),!1):(m(),!1)}async function _t(t){if(gt())try{let n=ke(t.title,e(`note.chatDraft.defaultTitle`),e=>D.some(t=>f(t.directory)===f(j)&&t.name===e)),r=await w(f(j?`${j}/${n}`:n),t.content);re(t.id),await Q(),c(e(`note.chatDraft.created`),`success`),$({file:r.path,mode:`edit`},!0)}catch(t){rt.current=``,c(await u(t,e(`note.toast.createFailed`)),`error`)}}function vt(){gt()&&$e({title:e(`note.create.title`),placeholder:e(`note.namePlaceholder`),confirmText:e(`note.create.action`),onConfirm:async t=>{if(!gt())return;let n=U(j,t);if(!n){c(e(`note.toast.nameRequired`),`warning`);return}try{let t=await w(n,``);$e(null),await Q(),$({file:t.path,mode:`edit`}),c(e(`note.toast.created`),`success`)}catch(t){c(await u(t,e(`note.toast.createFailed`)),`error`)}}})}function yt(e){gt()&&nt(e)}async function bt(t){if(!(!Y||!gt()))try{let n=g;if(Y.type===`directory`){let e=Oe(Y),r=f(t?`${t}/${Y.name}`:Y.name),i=D.filter(t=>t.path.startsWith(`${e}/`));for(let t of i){let i=f(`${r}/${t.path.slice(e.length+1)}`);await S(t.path,i),g===t.path&&(n=i)}}else{let e=f(t?`${t}/${Y.name}`:Y.name),r=await S(Y.cid,e);g===Y.cid&&(n=r.path)}nt(null),await Q(),$(n?{file:n}:{},!0),c(e(`note.toast.moved`),`success`)}catch(t){c(await u(t,e(`note.toast.moveFailed`)),`error`)}}function xt(t){gt()&&tt({title:t.type===`directory`?e(`note.delete.folderTitle`):e(`note.delete.noteTitle`),message:e(`note.delete.message`,{name:Re(t)}),confirmText:e(`note.action.delete`),onConfirm:async()=>{try{if(t.type===`directory`){let e=Oe(t),n=D.filter(t=>t.path.startsWith(`${e}/`));for(let e of n)await pe(e.path);g.startsWith(`${e}/`)&&$({},!0)}else await pe(t.cid),g===t.cid&&$({},!0);tt(null),await Q(),c(e(`note.toast.deleted`),`success`)}catch(t){c(await u(t,e(`note.toast.deleteFailed`)),`error`)}}})}async function St(){if(!l){m();return}if(!g||!z){c(e(`note.toast.notFound`),`error`);return}let t=I(He);if(!t){c(e(`note.toast.nameRequired`),`warning`);return}Xe(!0);try{let n=s.current?.getMarkdown()??qe,r=z.path;if(t!==z.name){r=f(z.directory?`${z.directory}/${t}`:t);let e=await S(z.path,r);B(e),V(F(e.name)),r=e.path}let i=await _e(r,n);B(i),V(F(i.name)),W(i.content),await Q(),$({file:i.path},!0),c(e(`note.toast.saved`),`success`)}catch(t){c(await u(t,e(`note.toast.saveFailed`)),`error`)}finally{Xe(!1)}}let Ct=(0,A.jsxs)(`div`,{className:`note-header-title`,children:[(0,A.jsx)(`h2`,{className:`header-title`,children:e(`note.title`)}),(0,A.jsx)(`span`,{children:e(`note.count`,{count:D.length})})]}),wt=(0,A.jsx)(`div`,{className:`note-theme-wrap`,children:(0,A.jsxs)(`button`,{className:`btn btn-sm`,onClick:ht,disabled:R,title:e(`note.vault.open`),"aria-label":e(`note.vault.open`),children:[(0,A.jsx)(_,{size:16}),e(R?`note.vault.opening`:`note.vault.open`)]})}),Tt=(0,A.jsxs)(`section`,{className:`note-list-panel note-sidebar-list`,"aria-label":e(`note.listLabel`),children:[(0,A.jsxs)(`div`,{className:`note-search`,children:[(0,A.jsx)(se,{size:16}),(0,A.jsx)(`input`,{className:`input input-flex`,value:L,onChange:e=>Ne(e.target.value),placeholder:e(`note.search.placeholder`)})]}),we?(0,A.jsxs)(`div`,{className:`ui-empty-state note-empty-state`,children:[(0,A.jsx)(v,{size:32}),(0,A.jsx)(`p`,{children:e(`note.loading`)})]}):De?(0,A.jsxs)(`div`,{className:`ui-empty-state note-empty-state`,children:[(0,A.jsx)(h,{size:32}),(0,A.jsx)(`p`,{children:De})]}):x?.configured===!0?st.length===0?(0,A.jsxs)(`div`,{className:`ui-empty-state note-empty-state`,children:[(0,A.jsx)(v,{size:32}),(0,A.jsx)(`p`,{children:e(L?`note.empty.noMatches`:`note.vault.noFiles`)})]}):(0,A.jsx)(Ge,{nodes:st,searchQuery:L,expandedPaths:Ze,activeFileId:g,activeFolderPath:g?``:j,onToggleDirectory:ft,onOpenFile:dt,renderActions:t=>(0,A.jsx)(C,{ariaLabel:e(`common.moreActions`),className:`note-list-actions-anchor`,placement:`bottom-end`,items:[{key:`move`,label:e(`note.action.move`),icon:(0,A.jsx)(ye,{size:16}),onSelect:()=>yt(t)},{key:`delete`,label:e(`note.action.delete`),icon:(0,A.jsx)(ce,{size:16}),danger:!0,onSelect:()=>xt(t)}],renderTrigger:t=>(0,A.jsx)(`button`,{...t,className:`note-list-actions-trigger`,title:e(`common.moreActions`),"aria-label":e(`common.moreActions`),children:(0,A.jsx)(p,{size:16})})})}):(0,A.jsxs)(`div`,{className:`ui-empty-state note-empty-state`,children:[(0,A.jsx)(_,{size:32}),(0,A.jsxs)(`button`,{className:`btn btn-primary`,onClick:ht,disabled:R,children:[(0,A.jsx)(_,{size:16}),e(R?`note.vault.opening`:`note.vault.open`)]})]}),x?.configured===!0&&(0,A.jsx)(`div`,{className:`note-create-btn`,children:(0,A.jsxs)(`button`,{className:`btn`,onClick:vt,children:[(0,A.jsx)(te,{size:16}),e(`note.newNote`)]})})]}),Et=z?.mtimeMs||Z?.updated_at||Date.now(),Dt=F(z?.name||Z?.name||``)||e(`note.untitled`);return(0,A.jsxs)(ae,{sidebar:()=>(0,A.jsx)(Se,{children:Tt}),headerTitle:Ct,headerRight:wt,children:[(0,A.jsx)(`main`,{className:`note-page note-browser-page ${y?`has-editor`:``}`,children:(0,A.jsx)(`section`,{className:`note-workspace`,children:(0,A.jsx)(`section`,{className:`note-editor-panel`,"aria-label":e(b?`note.editorLabel.edit`:`note.editorLabel.read`),children:y?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(`div`,{className:`note-editor-panel-header`,children:[(0,A.jsxs)(`div`,{className:`note-editor-title-area`,children:[b&&z?(0,A.jsx)(`input`,{className:`note-title-input`,value:He,onChange:e=>V(e.target.value),onKeyDown:e=>{if(e.key===`Enter`){e.currentTarget.blur();return}e.key===`Escape`&&(V(F(z.name)),e.currentTarget.blur())},placeholder:e(`note.namePlaceholder`),translate:`no`}):(0,A.jsx)(`h3`,{translate:`no`,children:Dt}),(0,A.jsxs)(`div`,{className:`note-editor-info`,children:[(0,A.jsx)(`span`,{children:e(b?`note.mode.edit`:`note.mode.read`)}),(0,A.jsx)(`span`,{translate:`no`,children:je(g)}),(0,A.jsx)(`span`,{children:t(Et)})]})]}),(0,A.jsxs)(`div`,{className:`note-editor-actions`,children:[(0,A.jsx)(`button`,{type:`button`,className:`btn btn-icon`,onClick:b?mt:()=>$(),title:e(b?`common.cancel`:`common.close`),"aria-label":e(b?`common.cancel`:`common.close`),children:(0,A.jsx)(de,{size:16})}),b?(0,A.jsxs)(`button`,{className:`btn btn-sm btn-primary`,onClick:St,disabled:Ye||!!q||!z,children:[(0,A.jsx)(oe,{size:16}),e(Ye?`note.action.saving`:`note.action.save`)]}):Z&&(0,A.jsxs)(`button`,{type:`button`,className:`btn btn-sm btn-primary`,onClick:pt,disabled:!!q||!z,title:e(`note.action.edit`),"aria-label":e(`note.action.edit`),children:[(0,A.jsx)(be,{size:16}),e(`note.action.edit`)]})]})]}),G?(0,A.jsxs)(`div`,{className:`ui-empty-state note-empty-state editor-error`,children:[(0,A.jsx)(v,{size:36}),(0,A.jsx)(`p`,{children:e(`note.loading`)})]}):q?(0,A.jsxs)(`div`,{className:`ui-empty-state note-empty-state editor-error`,children:[(0,A.jsx)(h,{size:36}),(0,A.jsx)(`p`,{children:q})]}):b?(0,A.jsx)(`div`,{className:`note-editor-frame editing`,children:(0,A.jsx)(Ce,{ref:s,content:qe,onChange:W,className:`milkdown-editor`})}):z?(0,A.jsx)(`div`,{className:`note-editor-frame reading`,children:(0,A.jsx)(Ce,{content:ct,readOnly:!0,onInternalNoteLinkOpen:ut,resolveWikiNoteLink:lt,className:`milkdown-editor`})}):(0,A.jsxs)(`div`,{className:`ui-empty-state note-empty-state editor-error`,children:[(0,A.jsx)(v,{size:36}),(0,A.jsx)(`p`,{children:e(`note.error.notFound`)})]})]}):(0,A.jsxs)(`div`,{className:`ui-empty-state note-editor-empty`,children:[(0,A.jsx)(`div`,{className:`ui-empty-icon note-editor-empty-icon`,children:(0,A.jsx)(v,{size:32})}),(0,A.jsx)(`h3`,{className:`ui-empty-title`,children:x?.configured?e(`note.noOpen.title`):e(`note.vault.open`)}),(0,A.jsx)(`p`,{className:`ui-empty-desc`,children:x?.configured?e(`note.noOpen.select`):e(`note.vault.emptyPrompt`)}),x?.configured?(0,A.jsx)(ie,{label:e(`note.openList`),variant:`default`}):(0,A.jsxs)(`button`,{className:`btn btn-primary`,onClick:ht,disabled:R,children:[(0,A.jsx)(_,{size:16}),e(R?`note.vault.opening`:`note.vault.open`)]})]})})})}),J&&(0,A.jsx)(fe,{title:J.title,placeholder:J.placeholder,defaultValue:J.defaultValue,confirmText:J.confirmText,onConfirm:J.onConfirm,onClose:()=>$e(null)}),et&&(0,A.jsx)(ve,{title:et.title,message:et.message,confirmText:et.confirmText,danger:!0,onConfirm:et.onConfirm,onClose:()=>tt(null)}),Y&&(0,A.jsx)(xe,{target:Y,targetLabel:Re(Y),directories:at,onMove:bt,onClose:()=>nt(null)})]})}function q(){let{t:e}=le(),t=d(e=>e.hasBackend),n=a(e=>e.wallet),r=x(),i=t===!0&&qe(c()),o=W(i,n?.address||``),s=i&&(r||o);return(0,A.jsx)(k.Suspense,{fallback:(0,A.jsx)(`div`,{className:`note-editor-loading`,children:e(`note.loading`)}),children:s?(0,A.jsx)(K,{}):(0,A.jsx)(G,{})})}var Je=o(`/note/`)({component:q});export{Je as Route};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{n as e,o as t,t as n}from"./jsx-runtime-Bt-cYkS5.js";import{A as r,B as i,E as a,F as o,H as s,I as c,N as l,O as u,R as d,k as f,t as p}from"./useAppStore-DOnk608w.js";import{n as m,r as h,t as g}from"./mp-Dv12gDTx.js";import{n as _,t as v}from"./lock-CuwwlXlx.js";import{t as y}from"./download-COQOcPqI.js";import{t as b}from"./external-link-D6tHlYgS.js";import{t as x}from"./key-round-JR8M3aHl.js";import{i as S}from"./AccountMenu-D36x3rKH.js";import{n as C,t as w}from"./AppTop-qtp-3wqv.js";import{t as T}from"./wallet-D9Iw4YWE.js";import{A as E,T as D,f as ee,w as O}from"./index-CUzbruyP.js";import{t as k}from"./CopyButton-C00LHzxo.js";var te=i(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),ne=i(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),re=i(`qr-code`,[[`rect`,{width:`5`,height:`5`,x:`3`,y:`3`,rx:`1`,key:`1tu5fj`}],[`rect`,{width:`5`,height:`5`,x:`16`,y:`3`,rx:`1`,key:`1v8r4q`}],[`rect`,{width:`5`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`1x03jg`}],[`path`,{d:`M21 16h-3a2 2 0 0 0-2 2v3`,key:`177gqh`}],[`path`,{d:`M21 21v.01`,key:`ents32`}],[`path`,{d:`M12 7v3a2 2 0 0 1-2 2H7`,key:`8crl2c`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M12 3h.01`,key:`n36tog`}],[`path`,{d:`M12 16v.01`,key:`133mhm`}],[`path`,{d:`M16 12h1`,key:`1slzba`}],[`path`,{d:`M21 12v.01`,key:`1lwtk9`}],[`path`,{d:`M12 21v-1`,key:`1880an`}]]),ie=i(`shield-alert`,[[`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`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]),ae=i(`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`}]]),A=t(e()),j=n();function oe(e){return e?`•`.repeat(Math.min(e.length,32)):`-`}function se({title:e,username:t,password:n,showPassword:r,showPrivateKey:i,account:a,onUsernameChange:o,onPasswordChange:s,onTogglePassword:c,onTogglePrivateKey:l,onGenerate:u}){let{t:d}=E();return(0,j.jsxs)(`div`,{className:`web3-box-account`,children:[(0,j.jsx)(`div`,{className:`web3-box-account-header`,children:(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`h2`,{children:e}),(0,j.jsx)(`p`,{children:d(`web3.box.account.desc`)})]})}),(0,j.jsxs)(`div`,{className:`web3-box-login`,children:[(0,j.jsx)(`input`,{type:`text`,placeholder:d(`login.username.placeholder`),value:t,onChange:e=>o(e.target.value),className:`input`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:`false`}),(0,j.jsxs)(`div`,{className:`input-wrap`,children:[(0,j.jsx)(`input`,{type:r?`text`:`password`,placeholder:d(`web3.login.passwordOptional`),value:n,onChange:e=>s(e.target.value),className:`input`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:`false`}),(0,j.jsx)(`button`,{className:`input-eye`,onClick:c,type:`button`,children:r?(0,j.jsx)(D,{size:16}):(0,j.jsx)(O,{size:16})})]}),(0,j.jsxs)(`button`,{className:`btn btn-primary btn-full`,onClick:u,disabled:!t.trim(),type:`button`,children:[(0,j.jsx)(x,{size:16}),d(`web3.box.account.generate`)]})]}),a?(0,j.jsxs)(`div`,{className:`web3-box-key-list`,children:[(0,j.jsxs)(`div`,{className:`web3-box-key-row`,children:[(0,j.jsx)(`span`,{children:d(`web3.label.address`)}),(0,j.jsxs)(`div`,{className:`mono-row`,children:[(0,j.jsx)(`code`,{className:`mono`,translate:`no`,children:a.address.toLowerCase()}),(0,j.jsx)(k,{text:a.address.toLowerCase()})]})]}),(0,j.jsxs)(`div`,{className:`web3-box-key-row`,children:[(0,j.jsx)(`span`,{children:d(`web3.label.x25519Public`)}),(0,j.jsxs)(`div`,{className:`mono-row`,children:[(0,j.jsx)(`code`,{className:`mono`,translate:`no`,children:a.publicKey}),(0,j.jsx)(k,{text:a.publicKey})]})]}),(0,j.jsxs)(`div`,{className:`web3-box-key-row`,children:[(0,j.jsx)(`span`,{children:d(`web3.label.x25519Private`)}),(0,j.jsxs)(`div`,{className:`mono-row danger`,children:[(0,j.jsx)(`code`,{className:`mono`,translate:`no`,children:i?a.privateKey:oe(a.privateKey)}),(0,j.jsx)(`button`,{className:`btn btn-icon`,onClick:l,title:d(i?`web3.action.hidePrivateKey`:`web3.action.showPrivateKey`),type:`button`,children:i?(0,j.jsx)(O,{size:14}):(0,j.jsx)(D,{size:14})})]})]})]}):null]})}function ce(e,t){return Number.isFinite(e)?t(e):`-`}function M({title:e,description:t,message:n,cipherText:r,decryptedText:i,error:a,encryptLabel:o,decryptLabel:s,messagePlaceholder:l,cipherPlaceholder:u,onMessageChange:d,onCipherTextChange:f,onEncrypt:p,onDecrypt:m}){let{t:h,formatDateTime:g}=E(),_=`box-message-${e.replaceAll(/\s+/g,`-`)}`,y=c(r);return(0,j.jsxs)(`section`,{className:`web3-box-flow`,children:[(0,j.jsx)(`div`,{className:`web3-box-flow-header`,children:(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`h2`,{children:e}),(0,j.jsx)(`p`,{children:t})]})}),(0,j.jsx)(`label`,{className:`web3-box-label`,htmlFor:_,children:h(`web3.box.plaintext`)}),(0,j.jsx)(`textarea`,{id:_,className:`textarea`,value:n,onChange:e=>d(e.target.value),rows:4,placeholder:l,translate:`no`}),(0,j.jsxs)(`div`,{className:`web3-box-actions`,children:[(0,j.jsxs)(`button`,{className:`btn btn-primary`,onClick:p,type:`button`,children:[(0,j.jsx)(v,{size:16}),o]}),(0,j.jsxs)(`button`,{className:`btn btn-secondary`,onClick:m,type:`button`,children:[(0,j.jsx)(x,{size:16}),s]})]}),a&&(0,j.jsx)(`p`,{className:`web3-tools-danger`,children:a}),(0,j.jsxs)(`div`,{className:`web3-box-result-grid`,children:[(0,j.jsxs)(`div`,{className:`web3-box-result`,children:[(0,j.jsx)(`label`,{className:`web3-box-result-header`,children:(0,j.jsx)(`span`,{children:h(`web3.box.ciphertext`)})}),(0,j.jsx)(`textarea`,{className:`textarea mono`,value:r,onChange:e=>f(e.target.value),rows:5,placeholder:u,translate:`no`})]}),(0,j.jsxs)(`div`,{className:`web3-box-result`,children:[(0,j.jsx)(`label`,{className:`web3-box-result-header`,children:(0,j.jsx)(`span`,{children:h(`web3.box.decryptResult`)})}),(0,j.jsx)(`textarea`,{className:`textarea mono`,value:i,readOnly:!0,rows:5,placeholder:h(`web3.box.decryptResultPlaceholder`),translate:`no`})]})]}),y&&(0,j.jsxs)(`div`,{className:`web3-box-token-meta`,children:[(0,j.jsxs)(`div`,{className:`web3-box-token-meta-row`,children:[(0,j.jsx)(`span`,{children:h(`web3.box.timestamp`)}),(0,j.jsx)(`code`,{translate:`no`,children:ce(y.timestampMs,g)})]}),(0,j.jsxs)(`div`,{className:`web3-box-token-meta-row`,children:[(0,j.jsx)(`span`,{children:h(`web3.box.nonce`)}),(0,j.jsx)(`code`,{translate:`no`,children:y.nonce})]})]})]})}function le(e){let{t}=E();return(0,j.jsxs)(`div`,{className:`web3-box-workspace`,children:[(0,j.jsxs)(`div`,{className:`web3-box-grid`,children:[(0,j.jsx)(se,{title:t(`web3.box.accountA`),username:e.boxAUsername,password:e.boxAPassword,showPassword:e.boxAShowPassword,showPrivateKey:e.boxAShowPrivateKey,account:e.boxAAccount,onUsernameChange:e.onBoxAUsernameChange,onPasswordChange:e.onBoxAPasswordChange,onTogglePassword:e.onBoxAShowPasswordToggle,onTogglePrivateKey:e.onBoxAShowPrivateKeyToggle,onGenerate:e.onGenerateBoxA}),(0,j.jsx)(se,{title:t(`web3.box.accountB`),username:e.boxBUsername,password:e.boxBPassword,showPassword:e.boxBShowPassword,showPrivateKey:e.boxBShowPrivateKey,account:e.boxBAccount,onUsernameChange:e.onBoxBUsernameChange,onPasswordChange:e.onBoxBPasswordChange,onTogglePassword:e.onBoxBShowPasswordToggle,onTogglePrivateKey:e.onBoxBShowPrivateKeyToggle,onGenerate:e.onGenerateBoxB})]}),(0,j.jsxs)(`div`,{className:`web3-box-flow-grid`,children:[(0,j.jsx)(M,{title:`A → B`,description:t(`web3.box.flowAB.desc`),message:e.boxABMessage,cipherText:e.boxABCipherText,decryptedText:e.boxABDecryptedText,error:e.boxABError,encryptLabel:t(`web3.box.flowAB.encrypt`),decryptLabel:t(`web3.box.flowAB.decrypt`),messagePlaceholder:t(`web3.box.flowAB.messagePlaceholder`),cipherPlaceholder:t(`web3.box.cipherPlaceholder`),onMessageChange:e.onBoxABMessageChange,onCipherTextChange:e.onBoxABCipherTextChange,onEncrypt:e.onEncryptBoxAB,onDecrypt:e.onDecryptBoxAB}),(0,j.jsx)(M,{title:`B → A`,description:t(`web3.box.flowBA.desc`),message:e.boxBAMessage,cipherText:e.boxBACipherText,decryptedText:e.boxBADecryptedText,error:e.boxBAError,encryptLabel:t(`web3.box.flowBA.encrypt`),decryptLabel:t(`web3.box.flowBA.decrypt`),messagePlaceholder:t(`web3.box.flowBA.messagePlaceholder`),cipherPlaceholder:t(`web3.box.cipherPlaceholder`),onMessageChange:e.onBoxBAMessageChange,onCipherTextChange:e.onBoxBACipherTextChange,onEncrypt:e.onEncryptBoxBA,onDecrypt:e.onDecryptBoxBA})]}),(0,j.jsxs)(`div`,{className:`web3-box-flow-grid`,children:[(0,j.jsxs)(`section`,{className:`web3-box-flow`,children:[(0,j.jsx)(`div`,{className:`web3-box-flow-header`,children:(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`h2`,{children:t(`web3.box.encryptTitle`)}),(0,j.jsx)(`p`,{children:t(`web3.box.encryptDesc`)})]})}),(0,j.jsx)(`label`,{className:`web3-box-result-header`,children:(0,j.jsx)(`span`,{children:t(`web3.box.sender`)})}),(0,j.jsxs)(`div`,{className:`input-wrap`,children:[(0,j.jsx)(`input`,{type:e.boxEncryptShowPrivateKey?`text`:`password`,placeholder:t(`web3.box.senderPrivatePlaceholder`),value:e.boxEncryptSenderPrivateKey,onChange:t=>e.onBoxEncryptSenderPrivateKeyChange(t.target.value),className:`input`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:`false`}),(0,j.jsx)(`button`,{className:`input-eye`,onClick:e.onBoxEncryptShowPrivateKeyToggle,type:`button`,children:e.boxEncryptShowPrivateKey?(0,j.jsx)(D,{size:16}):(0,j.jsx)(O,{size:16})})]}),(0,j.jsx)(`label`,{className:`web3-box-result-header`,children:(0,j.jsx)(`span`,{children:t(`web3.box.recipient`)})}),(0,j.jsx)(`input`,{type:`text`,placeholder:t(`web3.box.recipientPublicPlaceholder`),value:e.boxEncryptRecipientPublicKey,onChange:t=>e.onBoxEncryptRecipientPublicKeyChange(t.target.value),className:`input`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:`false`}),(0,j.jsx)(`label`,{className:`web3-box-result-header`,children:(0,j.jsx)(`span`,{children:t(`web3.box.plaintext`)})}),(0,j.jsx)(`textarea`,{className:`textarea`,value:e.boxEncryptMessage,onChange:t=>e.onBoxEncryptMessageChange(t.target.value),rows:4,placeholder:t(`web3.box.messagePlaceholder`),translate:`no`}),(0,j.jsx)(`div`,{className:`web3-box-actions`,children:(0,j.jsxs)(`button`,{className:`btn btn-primary`,onClick:e.onEncryptOnly,type:`button`,children:[(0,j.jsx)(v,{size:16}),t(`web3.box.encryptTitle`)]})}),e.boxEncryptError&&(0,j.jsx)(`p`,{className:`web3-tools-danger`,children:e.boxEncryptError}),(0,j.jsxs)(`div`,{className:`web3-box-result`,children:[(0,j.jsx)(`label`,{className:`web3-box-result-header`,children:(0,j.jsx)(`span`,{children:t(`web3.box.ciphertext`)})}),(0,j.jsx)(`textarea`,{className:`textarea mono`,value:e.boxEncryptCipherText,readOnly:!0,rows:5,placeholder:t(`web3.box.encryptResultPlaceholder`),translate:`no`})]})]}),(0,j.jsxs)(`section`,{className:`web3-box-flow`,children:[(0,j.jsx)(`div`,{className:`web3-box-flow-header`,children:(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`h2`,{children:t(`web3.box.decryptTitle`)}),(0,j.jsx)(`p`,{children:t(`web3.box.decryptDesc`)})]})}),(0,j.jsx)(`label`,{className:`web3-box-result-header`,children:(0,j.jsx)(`span`,{children:t(`web3.box.sender`)})}),(0,j.jsx)(`input`,{type:`text`,placeholder:t(`web3.box.senderPublicPlaceholder`),value:e.boxDecryptSenderPublicKey,onChange:t=>e.onBoxDecryptSenderPublicKeyChange(t.target.value),className:`input`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:`false`}),(0,j.jsx)(`label`,{className:`web3-box-result-header`,children:(0,j.jsx)(`span`,{children:t(`web3.box.recipient`)})}),(0,j.jsxs)(`div`,{className:`input-wrap`,children:[(0,j.jsx)(`input`,{type:e.boxDecryptShowPrivateKey?`text`:`password`,placeholder:t(`web3.box.recipientPrivatePlaceholder`),value:e.boxDecryptRecipientPrivateKey,onChange:t=>e.onBoxDecryptRecipientPrivateKeyChange(t.target.value),className:`input`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:`false`}),(0,j.jsx)(`button`,{className:`input-eye`,onClick:e.onBoxDecryptShowPrivateKeyToggle,type:`button`,children:e.boxDecryptShowPrivateKey?(0,j.jsx)(D,{size:16}):(0,j.jsx)(O,{size:16})})]}),(0,j.jsx)(`label`,{className:`web3-box-result-header`,children:(0,j.jsx)(`span`,{children:t(`web3.box.ciphertext`)})}),(0,j.jsx)(`textarea`,{className:`textarea mono`,value:e.boxDecryptCipherText,onChange:t=>e.onBoxDecryptCipherTextChange(t.target.value),rows:5,placeholder:t(`web3.box.cipherDecryptPlaceholder`),translate:`no`}),(0,j.jsx)(`div`,{className:`web3-box-actions`,children:(0,j.jsxs)(`button`,{className:`btn btn-secondary`,onClick:e.onDecryptOnly,type:`button`,children:[(0,j.jsx)(x,{size:16}),t(`web3.box.decryptTitle`)]})}),e.boxDecryptError&&(0,j.jsx)(`p`,{className:`web3-tools-danger`,children:e.boxDecryptError}),(0,j.jsxs)(`div`,{className:`web3-box-result`,children:[(0,j.jsx)(`label`,{className:`web3-box-result-header`,children:(0,j.jsx)(`span`,{children:t(`web3.box.decryptResult`)})}),(0,j.jsx)(`textarea`,{className:`textarea mono`,value:e.boxDecryptResult,readOnly:!0,rows:5,placeholder:t(`web3.box.decryptResultPlaceholder`),translate:`no`})]})]})]})]})}function N({icon:e,message:t,className:n=`empty-state glass`}){return(0,j.jsxs)(`div`,{className:n,children:[(0,j.jsx)(`div`,{className:`empty-state-icon`,children:e}),(0,j.jsx)(`p`,{children:t})]})}function ue({label:e,pem:t,filename:n}){let{t:r}=E();function i(){let e=new Blob([t],{type:`text/plain`}),r=URL.createObjectURL(e),i=document.createElement(`a`);i.href=r,i.download=n,i.click(),URL.revokeObjectURL(r)}return(0,j.jsxs)(`div`,{className:`web3-pem-block`,children:[(0,j.jsxs)(`div`,{className:`web3-pem-header`,children:[(0,j.jsx)(`span`,{className:`web3-pem-label`,children:e}),(0,j.jsxs)(`div`,{className:`web3-pem-actions`,children:[(0,j.jsx)(k,{text:t,label:r(`common.copy`),className:`btn btn-sm`,iconSize:14}),(0,j.jsxs)(`button`,{type:`button`,className:`btn btn-sm btn-primary`,onClick:i,title:r(`common.download`),children:[(0,j.jsx)(y,{size:14}),r(`common.download`)]})]})]}),(0,j.jsx)(`textarea`,{className:`textarea mono`,value:t,readOnly:!0,rows:6,translate:`no`})]})}function de({walletResult:e,publicPem:t,privatePem:n}){let{t:r}=E();if(!t||!n)return(0,j.jsx)(N,{icon:(0,j.jsx)(v,{size:36}),message:r(`web3.empty.pem`)});let i=e?.username||`wallet`;return(0,j.jsxs)(`div`,{className:`web3-pem-list`,children:[(0,j.jsx)(ue,{label:`${i}.pub`,pem:t,filename:`${i}.pub`}),(0,j.jsx)(ue,{label:`${i}.pem`,pem:n,filename:`${i}.pem`})]})}var fe=Object.defineProperty,P=Object.getOwnPropertySymbols,pe=Object.prototype.hasOwnProperty,F=Object.prototype.propertyIsEnumerable,me=(e,t,n)=>t in e?fe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,I=(e,t)=>{for(var n in t||={})pe.call(t,n)&&me(e,n,t[n]);if(P)for(var n of P(t))F.call(t,n)&&me(e,n,t[n]);return e},L=(e,t)=>{var n={};for(var r in e)pe.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&P)for(var r of P(e))t.indexOf(r)<0&&F.call(e,r)&&(n[r]=e[r]);return n},R;(e=>{let t=class t{constructor(e,n,r,a){if(this.version=e,this.errorCorrectionLevel=n,this.modules=[],this.isFunction=[],e<t.MIN_VERSION||e>t.MAX_VERSION)throw RangeError(`Version value out of range`);if(a<-1||a>7)throw RangeError(`Mask value out of range`);this.size=e*4+17;let o=[];for(let e=0;e<this.size;e++)o.push(!1);for(let e=0;e<this.size;e++)this.modules.push(o.slice()),this.isFunction.push(o.slice());this.drawFunctionPatterns();let s=this.addEccAndInterleave(r);if(this.drawCodewords(s),a==-1){let e=1e9;for(let t=0;t<8;t++){this.applyMask(t),this.drawFormatBits(t);let n=this.getPenaltyScore();n<e&&(a=t,e=n),this.applyMask(t)}}i(0<=a&&a<=7),this.mask=a,this.applyMask(a),this.drawFormatBits(a),this.isFunction=[]}static encodeText(n,r){let i=e.QrSegment.makeSegments(n);return t.encodeSegments(i,r)}static encodeBinary(n,r){let i=e.QrSegment.makeBytes(n);return t.encodeSegments([i],r)}static encodeSegments(e,r,a=1,s=40,c=-1,l=!0){if(!(t.MIN_VERSION<=a&&a<=s&&s<=t.MAX_VERSION)||c<-1||c>7)throw RangeError(`Invalid value`);let u,d;for(u=a;;u++){let n=t.getNumDataCodewords(u,r)*8,i=o.getTotalBits(e,u);if(i<=n){d=i;break}if(u>=s)throw RangeError(`Data too long`)}for(let e of[t.Ecc.MEDIUM,t.Ecc.QUARTILE,t.Ecc.HIGH])l&&d<=t.getNumDataCodewords(u,e)*8&&(r=e);let f=[];for(let t of e){n(t.mode.modeBits,4,f),n(t.numChars,t.mode.numCharCountBits(u),f);for(let e of t.getData())f.push(e)}i(f.length==d);let p=t.getNumDataCodewords(u,r)*8;i(f.length<=p),n(0,Math.min(4,p-f.length),f),n(0,(8-f.length%8)%8,f),i(f.length%8==0);for(let e=236;f.length<p;e^=253)n(e,8,f);let m=[];for(;m.length*8<f.length;)m.push(0);return f.forEach((e,t)=>m[t>>>3]|=e<<7-(t&7)),new t(u,r,m,c)}getModule(e,t){return 0<=e&&e<this.size&&0<=t&&t<this.size&&this.modules[t][e]}getModules(){return this.modules}drawFunctionPatterns(){for(let e=0;e<this.size;e++)this.setFunctionModule(6,e,e%2==0),this.setFunctionModule(e,6,e%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);let e=this.getAlignmentPatternPositions(),t=e.length;for(let n=0;n<t;n++)for(let r=0;r<t;r++)n==0&&r==0||n==0&&r==t-1||n==t-1&&r==0||this.drawAlignmentPattern(e[n],e[r]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(e){let t=this.errorCorrectionLevel.formatBits<<3|e,n=t;for(let e=0;e<10;e++)n=n<<1^(n>>>9)*1335;let a=(t<<10|n)^21522;i(a>>>15==0);for(let e=0;e<=5;e++)this.setFunctionModule(8,e,r(a,e));this.setFunctionModule(8,7,r(a,6)),this.setFunctionModule(8,8,r(a,7)),this.setFunctionModule(7,8,r(a,8));for(let e=9;e<15;e++)this.setFunctionModule(14-e,8,r(a,e));for(let e=0;e<8;e++)this.setFunctionModule(this.size-1-e,8,r(a,e));for(let e=8;e<15;e++)this.setFunctionModule(8,this.size-15+e,r(a,e));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let e=this.version;for(let t=0;t<12;t++)e=e<<1^(e>>>11)*7973;let t=this.version<<12|e;i(t>>>18==0);for(let e=0;e<18;e++){let n=r(t,e),i=this.size-11+e%3,a=Math.floor(e/3);this.setFunctionModule(i,a,n),this.setFunctionModule(a,i,n)}}drawFinderPattern(e,t){for(let n=-4;n<=4;n++)for(let r=-4;r<=4;r++){let i=Math.max(Math.abs(r),Math.abs(n)),a=e+r,o=t+n;0<=a&&a<this.size&&0<=o&&o<this.size&&this.setFunctionModule(a,o,i!=2&&i!=4)}}drawAlignmentPattern(e,t){for(let n=-2;n<=2;n++)for(let r=-2;r<=2;r++)this.setFunctionModule(e+r,t+n,Math.max(Math.abs(r),Math.abs(n))!=1)}setFunctionModule(e,t,n){this.modules[t][e]=n,this.isFunction[t][e]=!0}addEccAndInterleave(e){let n=this.version,r=this.errorCorrectionLevel;if(e.length!=t.getNumDataCodewords(n,r))throw RangeError(`Invalid argument`);let a=t.NUM_ERROR_CORRECTION_BLOCKS[r.ordinal][n],o=t.ECC_CODEWORDS_PER_BLOCK[r.ordinal][n],s=Math.floor(t.getNumRawDataModules(n)/8),c=a-s%a,l=Math.floor(s/a),u=[],d=t.reedSolomonComputeDivisor(o);for(let n=0,r=0;n<a;n++){let i=e.slice(r,r+l-o+(n<c?0:1));r+=i.length;let a=t.reedSolomonComputeRemainder(i,d);n<c&&i.push(0),u.push(i.concat(a))}let f=[];for(let e=0;e<u[0].length;e++)u.forEach((t,n)=>{(e!=l-o||n>=c)&&f.push(t[e])});return i(f.length==s),f}drawCodewords(e){if(e.length!=Math.floor(t.getNumRawDataModules(this.version)/8))throw RangeError(`Invalid argument`);let n=0;for(let t=this.size-1;t>=1;t-=2){t==6&&(t=5);for(let i=0;i<this.size;i++)for(let a=0;a<2;a++){let o=t-a,s=t+1&2?i:this.size-1-i;!this.isFunction[s][o]&&n<e.length*8&&(this.modules[s][o]=r(e[n>>>3],7-(n&7)),n++)}}i(n==e.length*8)}applyMask(e){if(e<0||e>7)throw RangeError(`Mask value out of range`);for(let t=0;t<this.size;t++)for(let n=0;n<this.size;n++){let r;switch(e){case 0:r=(n+t)%2==0;break;case 1:r=t%2==0;break;case 2:r=n%3==0;break;case 3:r=(n+t)%3==0;break;case 4:r=(Math.floor(n/3)+Math.floor(t/2))%2==0;break;case 5:r=n*t%2+n*t%3==0;break;case 6:r=(n*t%2+n*t%3)%2==0;break;case 7:r=((n+t)%2+n*t%3)%2==0;break;default:throw Error(`Unreachable`)}!this.isFunction[t][n]&&r&&(this.modules[t][n]=!this.modules[t][n])}}getPenaltyScore(){let e=0;for(let n=0;n<this.size;n++){let r=!1,i=0,a=[0,0,0,0,0,0,0];for(let o=0;o<this.size;o++)this.modules[n][o]==r?(i++,i==5?e+=t.PENALTY_N1:i>5&&e++):(this.finderPenaltyAddHistory(i,a),r||(e+=this.finderPenaltyCountPatterns(a)*t.PENALTY_N3),r=this.modules[n][o],i=1);e+=this.finderPenaltyTerminateAndCount(r,i,a)*t.PENALTY_N3}for(let n=0;n<this.size;n++){let r=!1,i=0,a=[0,0,0,0,0,0,0];for(let o=0;o<this.size;o++)this.modules[o][n]==r?(i++,i==5?e+=t.PENALTY_N1:i>5&&e++):(this.finderPenaltyAddHistory(i,a),r||(e+=this.finderPenaltyCountPatterns(a)*t.PENALTY_N3),r=this.modules[o][n],i=1);e+=this.finderPenaltyTerminateAndCount(r,i,a)*t.PENALTY_N3}for(let n=0;n<this.size-1;n++)for(let r=0;r<this.size-1;r++){let i=this.modules[n][r];i==this.modules[n][r+1]&&i==this.modules[n+1][r]&&i==this.modules[n+1][r+1]&&(e+=t.PENALTY_N2)}let n=0;for(let e of this.modules)n=e.reduce((e,t)=>e+ +!!t,n);let r=this.size*this.size,a=Math.ceil(Math.abs(n*20-r*10)/r)-1;return i(0<=a&&a<=9),e+=a*t.PENALTY_N4,i(0<=e&&e<=2568888),e}getAlignmentPatternPositions(){if(this.version==1)return[];{let e=Math.floor(this.version/7)+2,t=this.version==32?26:Math.ceil((this.version*4+4)/(e*2-2))*2,n=[6];for(let r=this.size-7;n.length<e;r-=t)n.splice(1,0,r);return n}}static getNumRawDataModules(e){if(e<t.MIN_VERSION||e>t.MAX_VERSION)throw RangeError(`Version number out of range`);let n=(16*e+128)*e+64;if(e>=2){let t=Math.floor(e/7)+2;n-=(25*t-10)*t-55,e>=7&&(n-=36)}return i(208<=n&&n<=29648),n}static getNumDataCodewords(e,n){return Math.floor(t.getNumRawDataModules(e)/8)-t.ECC_CODEWORDS_PER_BLOCK[n.ordinal][e]*t.NUM_ERROR_CORRECTION_BLOCKS[n.ordinal][e]}static reedSolomonComputeDivisor(e){if(e<1||e>255)throw RangeError(`Degree out of range`);let n=[];for(let t=0;t<e-1;t++)n.push(0);n.push(1);let r=1;for(let i=0;i<e;i++){for(let e=0;e<n.length;e++)n[e]=t.reedSolomonMultiply(n[e],r),e+1<n.length&&(n[e]^=n[e+1]);r=t.reedSolomonMultiply(r,2)}return n}static reedSolomonComputeRemainder(e,n){let r=n.map(e=>0);for(let i of e){let e=i^r.shift();r.push(0),n.forEach((n,i)=>r[i]^=t.reedSolomonMultiply(n,e))}return r}static reedSolomonMultiply(e,t){if(e>>>8||t>>>8)throw RangeError(`Byte out of range`);let n=0;for(let r=7;r>=0;r--)n=n<<1^(n>>>7)*285,n^=(t>>>r&1)*e;return i(n>>>8==0),n}finderPenaltyCountPatterns(e){let t=e[1];i(t<=this.size*3);let n=t>0&&e[2]==t&&e[3]==t*3&&e[4]==t&&e[5]==t;return(n&&e[0]>=t*4&&e[6]>=t?1:0)+(n&&e[6]>=t*4&&e[0]>=t?1:0)}finderPenaltyTerminateAndCount(e,t,n){return e&&(this.finderPenaltyAddHistory(t,n),t=0),t+=this.size,this.finderPenaltyAddHistory(t,n),this.finderPenaltyCountPatterns(n)}finderPenaltyAddHistory(e,t){t[0]==0&&(e+=this.size),t.pop(),t.unshift(e)}};t.MIN_VERSION=1,t.MAX_VERSION=40,t.PENALTY_N1=3,t.PENALTY_N2=3,t.PENALTY_N3=40,t.PENALTY_N4=10,t.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],t.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],e.QrCode=t;function n(e,t,n){if(t<0||t>31||e>>>t)throw RangeError(`Value out of range`);for(let r=t-1;r>=0;r--)n.push(e>>>r&1)}function r(e,t){return(e>>>t&1)!=0}function i(e){if(!e)throw Error(`Assertion error`)}let a=class e{constructor(e,t,n){if(this.mode=e,this.numChars=t,this.bitData=n,t<0)throw RangeError(`Invalid argument`);this.bitData=n.slice()}static makeBytes(t){let r=[];for(let e of t)n(e,8,r);return new e(e.Mode.BYTE,t.length,r)}static makeNumeric(t){if(!e.isNumeric(t))throw RangeError(`String contains non-numeric characters`);let r=[];for(let e=0;e<t.length;){let i=Math.min(t.length-e,3);n(parseInt(t.substring(e,e+i),10),i*3+1,r),e+=i}return new e(e.Mode.NUMERIC,t.length,r)}static makeAlphanumeric(t){if(!e.isAlphanumeric(t))throw RangeError(`String contains unencodable characters in alphanumeric mode`);let r=[],i;for(i=0;i+2<=t.length;i+=2){let a=e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i))*45;a+=e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i+1)),n(a,11,r)}return i<t.length&&n(e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i)),6,r),new e(e.Mode.ALPHANUMERIC,t.length,r)}static makeSegments(t){return t==``?[]:e.isNumeric(t)?[e.makeNumeric(t)]:e.isAlphanumeric(t)?[e.makeAlphanumeric(t)]:[e.makeBytes(e.toUtf8ByteArray(t))]}static makeEci(t){let r=[];if(t<0)throw RangeError(`ECI assignment value out of range`);if(t<128)n(t,8,r);else if(t<16384)n(2,2,r),n(t,14,r);else if(t<1e6)n(6,3,r),n(t,21,r);else throw RangeError(`ECI assignment value out of range`);return new e(e.Mode.ECI,0,r)}static isNumeric(t){return e.NUMERIC_REGEX.test(t)}static isAlphanumeric(t){return e.ALPHANUMERIC_REGEX.test(t)}getData(){return this.bitData.slice()}static getTotalBits(e,t){let n=0;for(let r of e){let e=r.mode.numCharCountBits(t);if(r.numChars>=1<<e)return 1/0;n+=4+e+r.bitData.length}return n}static toUtf8ByteArray(e){e=encodeURI(e);let t=[];for(let n=0;n<e.length;n++)e.charAt(n)==`%`?(t.push(parseInt(e.substring(n+1,n+3),16)),n+=2):t.push(e.charCodeAt(n));return t}};a.NUMERIC_REGEX=/^[0-9]*$/,a.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,a.ALPHANUMERIC_CHARSET=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`;let o=a;e.QrSegment=a})(R||={}),(e=>{(e=>{let t=class{constructor(e,t){this.ordinal=e,this.formatBits=t}};t.LOW=new t(0,1),t.MEDIUM=new t(1,0),t.QUARTILE=new t(2,3),t.HIGH=new t(3,2),e.Ecc=t})(e.QrCode||={})})(R||={}),(e=>{(e=>{let t=class{constructor(e,t){this.modeBits=e,this.numBitsCharCount=t}numCharCountBits(e){return this.numBitsCharCount[Math.floor((e+7)/17)]}};t.NUMERIC=new t(1,[10,12,14]),t.ALPHANUMERIC=new t(2,[9,11,13]),t.BYTE=new t(4,[8,16,16]),t.KANJI=new t(8,[8,10,12]),t.ECI=new t(7,[0,0,0]),e.Mode=t})(e.QrSegment||={})})(R||={});var z=R,he={L:z.QrCode.Ecc.LOW,M:z.QrCode.Ecc.MEDIUM,Q:z.QrCode.Ecc.QUARTILE,H:z.QrCode.Ecc.HIGH},B=128,V=`L`,H=`#FFFFFF`,U=`#000000`,W=!1,G=1,ge=4,_e=0,ve=.1;function K(e,t=0){let n=[];return e.forEach(function(e,r){let i=null;e.forEach(function(a,o){if(!a&&i!==null){n.push(`M${i+t} ${r+t}h${o-i}v1H${i+t}z`),i=null;return}if(o===e.length-1){if(!a)return;i===null?n.push(`M${o+t},${r+t} h1v1H${o+t}z`):n.push(`M${i+t},${r+t} h${o+1-i}v1H${i+t}z`);return}a&&i===null&&(i=o)})}),n.join(``)}function ye(e,t){return e.slice().map((e,n)=>n<t.y||n>=t.y+t.h?e:e.map((e,n)=>n<t.x||n>=t.x+t.w?e:!1))}function be(e,t,n,r){if(r==null)return null;let i=e.length+n*2,a=Math.floor(t*ve),o=i/t,s=(r.width||a)*o,c=(r.height||a)*o,l=r.x==null?e.length/2-s/2:r.x*o,u=r.y==null?e.length/2-c/2:r.y*o,d=r.opacity==null?1:r.opacity,f=null;if(r.excavate){let e=Math.floor(l),t=Math.floor(u);f={x:e,y:t,w:Math.ceil(s+l-e),h:Math.ceil(c+u-t)}}let p=r.crossOrigin;return{x:l,y:u,h:c,w:s,excavation:f,opacity:d,crossOrigin:p}}function xe(e,t){return t==null?e?ge:_e:Math.max(Math.floor(t),0)}function q({value:e,level:t,minVersion:n,includeMargin:r,marginSize:i,imageSettings:a,size:o,boostLevel:s}){let c=A.useMemo(()=>{let r=(Array.isArray(e)?e:[e]).reduce((e,t)=>(e.push(...z.QrSegment.makeSegments(t)),e),[]);return z.QrCode.encodeSegments(r,he[t],n,void 0,void 0,s)},[e,t,n,s]),{cells:l,margin:u,numCells:d,calculatedImageSettings:f}=A.useMemo(()=>{let e=c.getModules(),t=xe(r,i);return{cells:e,margin:t,numCells:e.length+t*2,calculatedImageSettings:be(e,o,t,a)}},[c,o,a,r,i]);return{qrcode:c,margin:u,cells:l,numCells:d,calculatedImageSettings:f}}var Se=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),Ce=A.forwardRef(function(e,t){let n=e,{value:r,size:i=B,level:a=V,bgColor:o=H,fgColor:s=U,includeMargin:c=W,minVersion:l=G,boostLevel:u,marginSize:d,imageSettings:f}=n,p=L(n,[`value`,`size`,`level`,`bgColor`,`fgColor`,`includeMargin`,`minVersion`,`boostLevel`,`marginSize`,`imageSettings`]),{style:m}=p,h=L(p,[`style`]),g=f?.src,_=A.useRef(null),v=A.useRef(null),y=A.useCallback(e=>{_.current=e,typeof t==`function`?t(e):t&&(t.current=e)},[t]),[b,x]=A.useState(!1),{margin:S,cells:C,numCells:w,calculatedImageSettings:T}=q({value:r,level:a,minVersion:l,boostLevel:u,includeMargin:c,marginSize:d,imageSettings:f,size:i});A.useEffect(()=>{if(_.current!=null){let e=_.current,t=e.getContext(`2d`);if(!t)return;let n=C,r=v.current,a=T!=null&&r!==null&&r.complete&&r.naturalHeight!==0&&r.naturalWidth!==0;a&&T.excavation!=null&&(n=ye(C,T.excavation));let c=window.devicePixelRatio||1;e.height=e.width=i*c;let l=i/w*c;t.scale(l,l),t.fillStyle=o,t.fillRect(0,0,w,w),t.fillStyle=s,Se?t.fill(new Path2D(K(n,S))):C.forEach(function(e,n){e.forEach(function(e,r){e&&t.fillRect(r+S,n+S,1,1)})}),T&&(t.globalAlpha=T.opacity),a&&t.drawImage(r,T.x+S,T.y+S,T.w,T.h)}}),A.useEffect(()=>{x(!1)},[g]);let E=I({height:i,width:i},m),D=null;return g!=null&&(D=A.createElement(`img`,{src:g,key:g,style:{display:`none`},onLoad:()=>{x(!0)},ref:v,crossOrigin:T?.crossOrigin})),A.createElement(A.Fragment,null,A.createElement(`canvas`,I({style:E,height:i,width:i,ref:y,role:`img`},h)),D)});Ce.displayName=`QRCodeCanvas`;var J=A.forwardRef(function(e,t){let n=e,{value:r,size:i=B,level:a=V,bgColor:o=H,fgColor:s=U,includeMargin:c=W,minVersion:l=G,boostLevel:u,title:d,marginSize:f,imageSettings:p}=n,m=L(n,[`value`,`size`,`level`,`bgColor`,`fgColor`,`includeMargin`,`minVersion`,`boostLevel`,`title`,`marginSize`,`imageSettings`]),{margin:h,cells:g,numCells:_,calculatedImageSettings:v}=q({value:r,level:a,minVersion:l,boostLevel:u,includeMargin:c,marginSize:f,imageSettings:p,size:i}),y=g,b=null;p!=null&&v!=null&&(v.excavation!=null&&(y=ye(g,v.excavation)),b=A.createElement(`image`,{href:p.src,height:v.h,width:v.w,x:v.x+h,y:v.y+h,preserveAspectRatio:`none`,opacity:v.opacity,crossOrigin:v.crossOrigin}));let x=K(y,h);return A.createElement(`svg`,I({height:i,width:i,viewBox:`0 0 ${_} ${_}`,ref:t,role:`img`},m),!!d&&A.createElement(`title`,null,d),A.createElement(`path`,{fill:o,d:`M0,0 h${_}v${_}H0z`,shapeRendering:`crispEdges`}),A.createElement(`path`,{fill:s,d:x,shapeRendering:`crispEdges`}),b)});J.displayName=`QRCodeSVG`;function we({walletResult:e,mnemonicPhrase:t,deriveBatch:n,deriveList:r,deriveShowIndex:i,deriveShowAddress:a,deriveShowPrivateKey:o,showAddressQr:s,showMnemonicReveal:c,showMnemonicQr:l,onToggleAddressQr:u,onToggleMnemonicReveal:d,onToggleMnemonicQr:f,onToggleDeriveIndex:p,onToggleDeriveAddress:m,onToggleDerivePrivateKey:h,onDerive:g}){let{t:v}=E(),y=e?.address||``;return!e||!y?(0,j.jsx)(N,{icon:(0,j.jsx)(T,{size:36}),message:v(`web3.empty.walletTools`)}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{className:`web3-tools-section`,children:[(0,j.jsxs)(`button`,{className:`web3-tools-toggle`,onClick:u,children:[(0,j.jsx)(re,{size:14}),v(s?`web3.action.hideAddressQr`:`web3.action.showAddressQr`),s?(0,j.jsx)(te,{size:14}):(0,j.jsx)(_,{size:14})]}),s&&(0,j.jsxs)(`div`,{className:`web3-mnemonic-reveal`,children:[(0,j.jsxs)(`div`,{className:`web3-mnemonic-card`,children:[(0,j.jsx)(`p`,{className:`web3-mnemonic-text`,translate:`no`,children:y}),(0,j.jsx)(k,{text:y})]}),(0,j.jsx)(`div`,{className:`qr-wrap`,children:(0,j.jsx)(J,{value:y,size:200})})]})]}),t&&(0,j.jsxs)(`div`,{className:`web3-tools-section`,children:[(0,j.jsxs)(`button`,{className:`web3-tools-toggle`,onClick:d,children:[(0,j.jsx)(x,{size:14}),v(c?`web3.action.hideMnemonic`:`web3.action.showMnemonic`),c?(0,j.jsx)(te,{size:14}):(0,j.jsx)(_,{size:14})]}),c&&(0,j.jsxs)(`div`,{className:`web3-mnemonic-reveal`,children:[(0,j.jsxs)(`div`,{className:`web3-mnemonic-card`,children:[(0,j.jsx)(`p`,{className:`web3-mnemonic-text`,translate:`no`,children:t}),(0,j.jsx)(k,{text:t})]}),(0,j.jsxs)(`p`,{className:`web3-tools-danger`,children:[(0,j.jsx)(ie,{size:14}),v(`web3.warning.mnemonic`)]}),(0,j.jsx)(`button`,{className:`web3-tools-toggle`,onClick:f,children:v(l?`web3.action.hideMnemonicQr`:`web3.action.showMnemonicQr`)}),l&&(0,j.jsx)(`div`,{className:`qr-wrap`,children:(0,j.jsx)(J,{value:t,size:260})})]})]}),t&&(0,j.jsxs)(`div`,{className:`web3-mnemonic-reveal`,children:[(0,j.jsx)(`div`,{children:(0,j.jsx)(`button`,{className:`btn btn-primary`,onClick:g,children:v(`web3.action.deriveAddresses`,{count:n})})}),(0,j.jsxs)(`p`,{className:`web3-tools-danger`,children:[(0,j.jsx)(ie,{size:14}),v(`web3.warning.privateKey`)]}),r.length>0&&(0,j.jsx)(`div`,{className:`web3-derive-table-wrap`,children:(0,j.jsxs)(`table`,{className:`web3-derive-table`,children:[(0,j.jsx)(`thead`,{children:(0,j.jsxs)(`tr`,{children:[(0,j.jsx)(`th`,{onClick:p,className:`web3-derive-th`,children:v(`web3.label.account`)}),(0,j.jsx)(`th`,{onClick:m,className:`web3-derive-th`,children:v(`web3.label.address`)}),(0,j.jsx)(`th`,{onClick:h,className:`web3-derive-th danger`,children:v(`web3.label.privateKeyToggle`,{action:v(o?`web3.action.hide`:`web3.action.show`)})})]})}),(0,j.jsx)(`tbody`,{children:r.map(e=>(0,j.jsxs)(`tr`,{children:[(0,j.jsx)(`td`,{children:i?e.index+1:``}),(0,j.jsx)(`td`,{translate:`no`,children:a?e.address:``}),(0,j.jsx)(`td`,{className:`danger`,children:(0,j.jsx)(`span`,{translate:`no`,children:o?e.privateKey:``})})]},e.index))})]})})]})]})}function Y({title:e,icon:t,children:n,accent:r=!1}){return(0,j.jsxs)(`div`,{className:`web3-key-card ${r?`accent`:``}`,children:[(0,j.jsxs)(`div`,{className:`web3-key-card-header`,children:[(0,j.jsx)(`span`,{className:`web3-key-card-icon`,children:t}),(0,j.jsx)(`span`,{className:`web3-key-card-title`,children:e})]}),(0,j.jsx)(`div`,{className:`web3-key-card-body`,translate:`no`,children:n})]})}function Te(e){return e?`•`.repeat(Math.min(e.length,32)):`-`}function Ee({walletResult:e,keys:t,ipns:n,avatarSrc:r,showPrivateKey:i,onTogglePrivateKey:a}){let{t:o}=E(),s=e?.address||``;return!e||!s?(0,j.jsx)(N,{icon:(0,j.jsx)(S,{size:36}),message:o(`web3.empty.identity`)}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{className:`web3-identity-card`,children:[(0,j.jsx)(`img`,{src:r,alt:`avatar`,className:`web3-identity-avatar`}),(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`h1`,{className:`web3-identity-name`,children:e.username||o(`web3.notSignedIn`)}),(0,j.jsxs)(`div`,{className:`web3-identity-address`,children:[(0,j.jsx)(`code`,{translate:`no`,children:s.toLowerCase()}),(0,j.jsx)(k,{text:s.toLowerCase()}),(0,j.jsxs)(`a`,{href:`https://debank.com/profile/${s}`,target:`_blank`,rel:`noopener noreferrer`,className:`link`,children:[(0,j.jsx)(b,{size:14}),o(`web3.action.view`)]})]})]})]}),t&&(0,j.jsxs)(`div`,{className:`web3-key-grid`,children:[(0,j.jsx)(Y,{title:o(`web3.label.ed25519Public`),icon:(0,j.jsx)(h,{size:18}),children:(0,j.jsxs)(`div`,{className:`mono-row`,children:[(0,j.jsx)(`code`,{className:`mono`,translate:`no`,children:t.ed_public_key}),(0,j.jsx)(k,{text:t.ed_public_key})]})}),(0,j.jsx)(Y,{title:o(`web3.label.x25519Public`),icon:(0,j.jsx)(x,{size:18}),children:(0,j.jsxs)(`div`,{className:`mono-row`,children:[(0,j.jsx)(`code`,{className:`mono`,translate:`no`,children:t.public_key}),(0,j.jsx)(k,{text:t.public_key})]})}),(0,j.jsx)(Y,{title:o(`web3.label.combinedPrivate`),icon:(0,j.jsx)(ae,{size:18}),accent:!0,children:(0,j.jsxs)(`div`,{className:`mono-row danger`,children:[(0,j.jsx)(`code`,{className:`mono`,translate:`no`,children:i?t.private_key:Te(t.private_key)}),(0,j.jsx)(`button`,{className:`btn btn-icon`,onClick:a,title:o(i?`web3.action.hidePrivateKey`:`web3.action.showPrivateKey`),type:`button`,children:i?(0,j.jsx)(O,{size:14}):(0,j.jsx)(D,{size:14})})]})}),(0,j.jsx)(Y,{title:`IPNS ID`,icon:(0,j.jsx)(ne,{size:18}),children:(0,j.jsxs)(`div`,{className:`mono-row`,children:[(0,j.jsx)(`code`,{className:`mono`,translate:`no`,children:n}),(0,j.jsx)(k,{text:n})]})})]})]})}function De({username:e,password:t,showPassword:n,generating:r,onUsernameChange:i,onPasswordChange:a,onTogglePassword:o,onGenerate:s}){let{t:c}=E();return(0,j.jsxs)(`div`,{className:`input-panel`,children:[(0,j.jsxs)(`div`,{className:`web3-tools-inputs`,children:[(0,j.jsx)(`input`,{type:`text`,placeholder:c(`login.username.placeholder`),value:e,onChange:e=>i(e.target.value),className:`input`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:`false`}),(0,j.jsxs)(`div`,{className:`input-wrap`,children:[(0,j.jsx)(`input`,{type:n?`text`:`password`,placeholder:c(`web3.login.passwordOptional`),value:t,onChange:e=>a(e.target.value),className:`input`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:`false`}),(0,j.jsx)(`button`,{className:`input-eye`,onClick:o,type:`button`,children:n?(0,j.jsx)(D,{size:16}):(0,j.jsx)(O,{size:16})})]})]}),(0,j.jsx)(`button`,{className:`btn btn-primary btn-full`,onClick:s,disabled:!e.trim()||r,type:`button`,children:r?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`span`,{className:`spinner`}),c(`web3.login.generating`)]}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(T,{size:16}),c(`web3.login.generateAndSignIn`)]})})]})}var X=e=>btoa(String.fromCharCode(...e)),Oe=e=>{let t=new Uint8Array([48,5,6,3,43,101,112]),n=new Uint8Array([4,34,4,32,...e.slice(0,32)]),r=new Uint8Array([2,1,0]),i=r.length+t.length+n.length,a=new Uint8Array(2+i);a[0]=48,a[1]=i;let o=2;return a.set(r,o),o+=r.length,a.set(t,o),o+=t.length,a.set(n,o),`-----BEGIN PRIVATE KEY-----\n${X(a).match(/.{1,64}/g)?.join(`
|
|
1
|
+
import{n as e,o as t,t as n}from"./jsx-runtime-Bt-cYkS5.js";import{A as r,B as i,E as a,F as o,H as s,I as c,N as l,O as u,R as d,k as f,t as p}from"./useAppStore-DOnk608w.js";import{n as m,r as h,t as g}from"./mp-Dv12gDTx.js";import{n as _,t as v}from"./lock-CuwwlXlx.js";import{t as y}from"./download-COQOcPqI.js";import{t as b}from"./external-link-D6tHlYgS.js";import{t as x}from"./key-round-JR8M3aHl.js";import{i as S}from"./AccountMenu-ptQklqvD.js";import{n as C,t as w}from"./AppTop-Cy0ZOCxO.js";import{t as T}from"./wallet-D9Iw4YWE.js";import{A as E,T as D,f as ee,w as O}from"./index-D0Uk9-58.js";import{t as k}from"./CopyButton-C8PIDSJZ.js";var te=i(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),ne=i(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),re=i(`qr-code`,[[`rect`,{width:`5`,height:`5`,x:`3`,y:`3`,rx:`1`,key:`1tu5fj`}],[`rect`,{width:`5`,height:`5`,x:`16`,y:`3`,rx:`1`,key:`1v8r4q`}],[`rect`,{width:`5`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`1x03jg`}],[`path`,{d:`M21 16h-3a2 2 0 0 0-2 2v3`,key:`177gqh`}],[`path`,{d:`M21 21v.01`,key:`ents32`}],[`path`,{d:`M12 7v3a2 2 0 0 1-2 2H7`,key:`8crl2c`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M12 3h.01`,key:`n36tog`}],[`path`,{d:`M12 16v.01`,key:`133mhm`}],[`path`,{d:`M16 12h1`,key:`1slzba`}],[`path`,{d:`M21 12v.01`,key:`1lwtk9`}],[`path`,{d:`M12 21v-1`,key:`1880an`}]]),ie=i(`shield-alert`,[[`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`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]),ae=i(`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`}]]),A=t(e()),j=n();function oe(e){return e?`•`.repeat(Math.min(e.length,32)):`-`}function se({title:e,username:t,password:n,showPassword:r,showPrivateKey:i,account:a,onUsernameChange:o,onPasswordChange:s,onTogglePassword:c,onTogglePrivateKey:l,onGenerate:u}){let{t:d}=E();return(0,j.jsxs)(`div`,{className:`web3-box-account`,children:[(0,j.jsx)(`div`,{className:`web3-box-account-header`,children:(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`h2`,{children:e}),(0,j.jsx)(`p`,{children:d(`web3.box.account.desc`)})]})}),(0,j.jsxs)(`div`,{className:`web3-box-login`,children:[(0,j.jsx)(`input`,{type:`text`,placeholder:d(`login.username.placeholder`),value:t,onChange:e=>o(e.target.value),className:`input`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:`false`}),(0,j.jsxs)(`div`,{className:`input-wrap`,children:[(0,j.jsx)(`input`,{type:r?`text`:`password`,placeholder:d(`web3.login.passwordOptional`),value:n,onChange:e=>s(e.target.value),className:`input`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:`false`}),(0,j.jsx)(`button`,{className:`input-eye`,onClick:c,type:`button`,children:r?(0,j.jsx)(D,{size:16}):(0,j.jsx)(O,{size:16})})]}),(0,j.jsxs)(`button`,{className:`btn btn-primary btn-full`,onClick:u,disabled:!t.trim(),type:`button`,children:[(0,j.jsx)(x,{size:16}),d(`web3.box.account.generate`)]})]}),a?(0,j.jsxs)(`div`,{className:`web3-box-key-list`,children:[(0,j.jsxs)(`div`,{className:`web3-box-key-row`,children:[(0,j.jsx)(`span`,{children:d(`web3.label.address`)}),(0,j.jsxs)(`div`,{className:`mono-row`,children:[(0,j.jsx)(`code`,{className:`mono`,translate:`no`,children:a.address.toLowerCase()}),(0,j.jsx)(k,{text:a.address.toLowerCase()})]})]}),(0,j.jsxs)(`div`,{className:`web3-box-key-row`,children:[(0,j.jsx)(`span`,{children:d(`web3.label.x25519Public`)}),(0,j.jsxs)(`div`,{className:`mono-row`,children:[(0,j.jsx)(`code`,{className:`mono`,translate:`no`,children:a.publicKey}),(0,j.jsx)(k,{text:a.publicKey})]})]}),(0,j.jsxs)(`div`,{className:`web3-box-key-row`,children:[(0,j.jsx)(`span`,{children:d(`web3.label.x25519Private`)}),(0,j.jsxs)(`div`,{className:`mono-row danger`,children:[(0,j.jsx)(`code`,{className:`mono`,translate:`no`,children:i?a.privateKey:oe(a.privateKey)}),(0,j.jsx)(`button`,{className:`btn btn-icon`,onClick:l,title:d(i?`web3.action.hidePrivateKey`:`web3.action.showPrivateKey`),type:`button`,children:i?(0,j.jsx)(O,{size:14}):(0,j.jsx)(D,{size:14})})]})]})]}):null]})}function ce(e,t){return Number.isFinite(e)?t(e):`-`}function M({title:e,description:t,message:n,cipherText:r,decryptedText:i,error:a,encryptLabel:o,decryptLabel:s,messagePlaceholder:l,cipherPlaceholder:u,onMessageChange:d,onCipherTextChange:f,onEncrypt:p,onDecrypt:m}){let{t:h,formatDateTime:g}=E(),_=`box-message-${e.replaceAll(/\s+/g,`-`)}`,y=c(r);return(0,j.jsxs)(`section`,{className:`web3-box-flow`,children:[(0,j.jsx)(`div`,{className:`web3-box-flow-header`,children:(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`h2`,{children:e}),(0,j.jsx)(`p`,{children:t})]})}),(0,j.jsx)(`label`,{className:`web3-box-label`,htmlFor:_,children:h(`web3.box.plaintext`)}),(0,j.jsx)(`textarea`,{id:_,className:`textarea`,value:n,onChange:e=>d(e.target.value),rows:4,placeholder:l,translate:`no`}),(0,j.jsxs)(`div`,{className:`web3-box-actions`,children:[(0,j.jsxs)(`button`,{className:`btn btn-primary`,onClick:p,type:`button`,children:[(0,j.jsx)(v,{size:16}),o]}),(0,j.jsxs)(`button`,{className:`btn btn-secondary`,onClick:m,type:`button`,children:[(0,j.jsx)(x,{size:16}),s]})]}),a&&(0,j.jsx)(`p`,{className:`web3-tools-danger`,children:a}),(0,j.jsxs)(`div`,{className:`web3-box-result-grid`,children:[(0,j.jsxs)(`div`,{className:`web3-box-result`,children:[(0,j.jsx)(`label`,{className:`web3-box-result-header`,children:(0,j.jsx)(`span`,{children:h(`web3.box.ciphertext`)})}),(0,j.jsx)(`textarea`,{className:`textarea mono`,value:r,onChange:e=>f(e.target.value),rows:5,placeholder:u,translate:`no`})]}),(0,j.jsxs)(`div`,{className:`web3-box-result`,children:[(0,j.jsx)(`label`,{className:`web3-box-result-header`,children:(0,j.jsx)(`span`,{children:h(`web3.box.decryptResult`)})}),(0,j.jsx)(`textarea`,{className:`textarea mono`,value:i,readOnly:!0,rows:5,placeholder:h(`web3.box.decryptResultPlaceholder`),translate:`no`})]})]}),y&&(0,j.jsxs)(`div`,{className:`web3-box-token-meta`,children:[(0,j.jsxs)(`div`,{className:`web3-box-token-meta-row`,children:[(0,j.jsx)(`span`,{children:h(`web3.box.timestamp`)}),(0,j.jsx)(`code`,{translate:`no`,children:ce(y.timestampMs,g)})]}),(0,j.jsxs)(`div`,{className:`web3-box-token-meta-row`,children:[(0,j.jsx)(`span`,{children:h(`web3.box.nonce`)}),(0,j.jsx)(`code`,{translate:`no`,children:y.nonce})]})]})]})}function le(e){let{t}=E();return(0,j.jsxs)(`div`,{className:`web3-box-workspace`,children:[(0,j.jsxs)(`div`,{className:`web3-box-grid`,children:[(0,j.jsx)(se,{title:t(`web3.box.accountA`),username:e.boxAUsername,password:e.boxAPassword,showPassword:e.boxAShowPassword,showPrivateKey:e.boxAShowPrivateKey,account:e.boxAAccount,onUsernameChange:e.onBoxAUsernameChange,onPasswordChange:e.onBoxAPasswordChange,onTogglePassword:e.onBoxAShowPasswordToggle,onTogglePrivateKey:e.onBoxAShowPrivateKeyToggle,onGenerate:e.onGenerateBoxA}),(0,j.jsx)(se,{title:t(`web3.box.accountB`),username:e.boxBUsername,password:e.boxBPassword,showPassword:e.boxBShowPassword,showPrivateKey:e.boxBShowPrivateKey,account:e.boxBAccount,onUsernameChange:e.onBoxBUsernameChange,onPasswordChange:e.onBoxBPasswordChange,onTogglePassword:e.onBoxBShowPasswordToggle,onTogglePrivateKey:e.onBoxBShowPrivateKeyToggle,onGenerate:e.onGenerateBoxB})]}),(0,j.jsxs)(`div`,{className:`web3-box-flow-grid`,children:[(0,j.jsx)(M,{title:`A → B`,description:t(`web3.box.flowAB.desc`),message:e.boxABMessage,cipherText:e.boxABCipherText,decryptedText:e.boxABDecryptedText,error:e.boxABError,encryptLabel:t(`web3.box.flowAB.encrypt`),decryptLabel:t(`web3.box.flowAB.decrypt`),messagePlaceholder:t(`web3.box.flowAB.messagePlaceholder`),cipherPlaceholder:t(`web3.box.cipherPlaceholder`),onMessageChange:e.onBoxABMessageChange,onCipherTextChange:e.onBoxABCipherTextChange,onEncrypt:e.onEncryptBoxAB,onDecrypt:e.onDecryptBoxAB}),(0,j.jsx)(M,{title:`B → A`,description:t(`web3.box.flowBA.desc`),message:e.boxBAMessage,cipherText:e.boxBACipherText,decryptedText:e.boxBADecryptedText,error:e.boxBAError,encryptLabel:t(`web3.box.flowBA.encrypt`),decryptLabel:t(`web3.box.flowBA.decrypt`),messagePlaceholder:t(`web3.box.flowBA.messagePlaceholder`),cipherPlaceholder:t(`web3.box.cipherPlaceholder`),onMessageChange:e.onBoxBAMessageChange,onCipherTextChange:e.onBoxBACipherTextChange,onEncrypt:e.onEncryptBoxBA,onDecrypt:e.onDecryptBoxBA})]}),(0,j.jsxs)(`div`,{className:`web3-box-flow-grid`,children:[(0,j.jsxs)(`section`,{className:`web3-box-flow`,children:[(0,j.jsx)(`div`,{className:`web3-box-flow-header`,children:(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`h2`,{children:t(`web3.box.encryptTitle`)}),(0,j.jsx)(`p`,{children:t(`web3.box.encryptDesc`)})]})}),(0,j.jsx)(`label`,{className:`web3-box-result-header`,children:(0,j.jsx)(`span`,{children:t(`web3.box.sender`)})}),(0,j.jsxs)(`div`,{className:`input-wrap`,children:[(0,j.jsx)(`input`,{type:e.boxEncryptShowPrivateKey?`text`:`password`,placeholder:t(`web3.box.senderPrivatePlaceholder`),value:e.boxEncryptSenderPrivateKey,onChange:t=>e.onBoxEncryptSenderPrivateKeyChange(t.target.value),className:`input`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:`false`}),(0,j.jsx)(`button`,{className:`input-eye`,onClick:e.onBoxEncryptShowPrivateKeyToggle,type:`button`,children:e.boxEncryptShowPrivateKey?(0,j.jsx)(D,{size:16}):(0,j.jsx)(O,{size:16})})]}),(0,j.jsx)(`label`,{className:`web3-box-result-header`,children:(0,j.jsx)(`span`,{children:t(`web3.box.recipient`)})}),(0,j.jsx)(`input`,{type:`text`,placeholder:t(`web3.box.recipientPublicPlaceholder`),value:e.boxEncryptRecipientPublicKey,onChange:t=>e.onBoxEncryptRecipientPublicKeyChange(t.target.value),className:`input`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:`false`}),(0,j.jsx)(`label`,{className:`web3-box-result-header`,children:(0,j.jsx)(`span`,{children:t(`web3.box.plaintext`)})}),(0,j.jsx)(`textarea`,{className:`textarea`,value:e.boxEncryptMessage,onChange:t=>e.onBoxEncryptMessageChange(t.target.value),rows:4,placeholder:t(`web3.box.messagePlaceholder`),translate:`no`}),(0,j.jsx)(`div`,{className:`web3-box-actions`,children:(0,j.jsxs)(`button`,{className:`btn btn-primary`,onClick:e.onEncryptOnly,type:`button`,children:[(0,j.jsx)(v,{size:16}),t(`web3.box.encryptTitle`)]})}),e.boxEncryptError&&(0,j.jsx)(`p`,{className:`web3-tools-danger`,children:e.boxEncryptError}),(0,j.jsxs)(`div`,{className:`web3-box-result`,children:[(0,j.jsx)(`label`,{className:`web3-box-result-header`,children:(0,j.jsx)(`span`,{children:t(`web3.box.ciphertext`)})}),(0,j.jsx)(`textarea`,{className:`textarea mono`,value:e.boxEncryptCipherText,readOnly:!0,rows:5,placeholder:t(`web3.box.encryptResultPlaceholder`),translate:`no`})]})]}),(0,j.jsxs)(`section`,{className:`web3-box-flow`,children:[(0,j.jsx)(`div`,{className:`web3-box-flow-header`,children:(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`h2`,{children:t(`web3.box.decryptTitle`)}),(0,j.jsx)(`p`,{children:t(`web3.box.decryptDesc`)})]})}),(0,j.jsx)(`label`,{className:`web3-box-result-header`,children:(0,j.jsx)(`span`,{children:t(`web3.box.sender`)})}),(0,j.jsx)(`input`,{type:`text`,placeholder:t(`web3.box.senderPublicPlaceholder`),value:e.boxDecryptSenderPublicKey,onChange:t=>e.onBoxDecryptSenderPublicKeyChange(t.target.value),className:`input`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:`false`}),(0,j.jsx)(`label`,{className:`web3-box-result-header`,children:(0,j.jsx)(`span`,{children:t(`web3.box.recipient`)})}),(0,j.jsxs)(`div`,{className:`input-wrap`,children:[(0,j.jsx)(`input`,{type:e.boxDecryptShowPrivateKey?`text`:`password`,placeholder:t(`web3.box.recipientPrivatePlaceholder`),value:e.boxDecryptRecipientPrivateKey,onChange:t=>e.onBoxDecryptRecipientPrivateKeyChange(t.target.value),className:`input`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:`false`}),(0,j.jsx)(`button`,{className:`input-eye`,onClick:e.onBoxDecryptShowPrivateKeyToggle,type:`button`,children:e.boxDecryptShowPrivateKey?(0,j.jsx)(D,{size:16}):(0,j.jsx)(O,{size:16})})]}),(0,j.jsx)(`label`,{className:`web3-box-result-header`,children:(0,j.jsx)(`span`,{children:t(`web3.box.ciphertext`)})}),(0,j.jsx)(`textarea`,{className:`textarea mono`,value:e.boxDecryptCipherText,onChange:t=>e.onBoxDecryptCipherTextChange(t.target.value),rows:5,placeholder:t(`web3.box.cipherDecryptPlaceholder`),translate:`no`}),(0,j.jsx)(`div`,{className:`web3-box-actions`,children:(0,j.jsxs)(`button`,{className:`btn btn-secondary`,onClick:e.onDecryptOnly,type:`button`,children:[(0,j.jsx)(x,{size:16}),t(`web3.box.decryptTitle`)]})}),e.boxDecryptError&&(0,j.jsx)(`p`,{className:`web3-tools-danger`,children:e.boxDecryptError}),(0,j.jsxs)(`div`,{className:`web3-box-result`,children:[(0,j.jsx)(`label`,{className:`web3-box-result-header`,children:(0,j.jsx)(`span`,{children:t(`web3.box.decryptResult`)})}),(0,j.jsx)(`textarea`,{className:`textarea mono`,value:e.boxDecryptResult,readOnly:!0,rows:5,placeholder:t(`web3.box.decryptResultPlaceholder`),translate:`no`})]})]})]})]})}function N({icon:e,message:t,className:n=`empty-state glass`}){return(0,j.jsxs)(`div`,{className:n,children:[(0,j.jsx)(`div`,{className:`empty-state-icon`,children:e}),(0,j.jsx)(`p`,{children:t})]})}function ue({label:e,pem:t,filename:n}){let{t:r}=E();function i(){let e=new Blob([t],{type:`text/plain`}),r=URL.createObjectURL(e),i=document.createElement(`a`);i.href=r,i.download=n,i.click(),URL.revokeObjectURL(r)}return(0,j.jsxs)(`div`,{className:`web3-pem-block`,children:[(0,j.jsxs)(`div`,{className:`web3-pem-header`,children:[(0,j.jsx)(`span`,{className:`web3-pem-label`,children:e}),(0,j.jsxs)(`div`,{className:`web3-pem-actions`,children:[(0,j.jsx)(k,{text:t,label:r(`common.copy`),className:`btn btn-sm`,iconSize:14}),(0,j.jsxs)(`button`,{type:`button`,className:`btn btn-sm btn-primary`,onClick:i,title:r(`common.download`),children:[(0,j.jsx)(y,{size:14}),r(`common.download`)]})]})]}),(0,j.jsx)(`textarea`,{className:`textarea mono`,value:t,readOnly:!0,rows:6,translate:`no`})]})}function de({walletResult:e,publicPem:t,privatePem:n}){let{t:r}=E();if(!t||!n)return(0,j.jsx)(N,{icon:(0,j.jsx)(v,{size:36}),message:r(`web3.empty.pem`)});let i=e?.username||`wallet`;return(0,j.jsxs)(`div`,{className:`web3-pem-list`,children:[(0,j.jsx)(ue,{label:`${i}.pub`,pem:t,filename:`${i}.pub`}),(0,j.jsx)(ue,{label:`${i}.pem`,pem:n,filename:`${i}.pem`})]})}var fe=Object.defineProperty,P=Object.getOwnPropertySymbols,pe=Object.prototype.hasOwnProperty,F=Object.prototype.propertyIsEnumerable,me=(e,t,n)=>t in e?fe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,I=(e,t)=>{for(var n in t||={})pe.call(t,n)&&me(e,n,t[n]);if(P)for(var n of P(t))F.call(t,n)&&me(e,n,t[n]);return e},L=(e,t)=>{var n={};for(var r in e)pe.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&P)for(var r of P(e))t.indexOf(r)<0&&F.call(e,r)&&(n[r]=e[r]);return n},R;(e=>{let t=class t{constructor(e,n,r,a){if(this.version=e,this.errorCorrectionLevel=n,this.modules=[],this.isFunction=[],e<t.MIN_VERSION||e>t.MAX_VERSION)throw RangeError(`Version value out of range`);if(a<-1||a>7)throw RangeError(`Mask value out of range`);this.size=e*4+17;let o=[];for(let e=0;e<this.size;e++)o.push(!1);for(let e=0;e<this.size;e++)this.modules.push(o.slice()),this.isFunction.push(o.slice());this.drawFunctionPatterns();let s=this.addEccAndInterleave(r);if(this.drawCodewords(s),a==-1){let e=1e9;for(let t=0;t<8;t++){this.applyMask(t),this.drawFormatBits(t);let n=this.getPenaltyScore();n<e&&(a=t,e=n),this.applyMask(t)}}i(0<=a&&a<=7),this.mask=a,this.applyMask(a),this.drawFormatBits(a),this.isFunction=[]}static encodeText(n,r){let i=e.QrSegment.makeSegments(n);return t.encodeSegments(i,r)}static encodeBinary(n,r){let i=e.QrSegment.makeBytes(n);return t.encodeSegments([i],r)}static encodeSegments(e,r,a=1,s=40,c=-1,l=!0){if(!(t.MIN_VERSION<=a&&a<=s&&s<=t.MAX_VERSION)||c<-1||c>7)throw RangeError(`Invalid value`);let u,d;for(u=a;;u++){let n=t.getNumDataCodewords(u,r)*8,i=o.getTotalBits(e,u);if(i<=n){d=i;break}if(u>=s)throw RangeError(`Data too long`)}for(let e of[t.Ecc.MEDIUM,t.Ecc.QUARTILE,t.Ecc.HIGH])l&&d<=t.getNumDataCodewords(u,e)*8&&(r=e);let f=[];for(let t of e){n(t.mode.modeBits,4,f),n(t.numChars,t.mode.numCharCountBits(u),f);for(let e of t.getData())f.push(e)}i(f.length==d);let p=t.getNumDataCodewords(u,r)*8;i(f.length<=p),n(0,Math.min(4,p-f.length),f),n(0,(8-f.length%8)%8,f),i(f.length%8==0);for(let e=236;f.length<p;e^=253)n(e,8,f);let m=[];for(;m.length*8<f.length;)m.push(0);return f.forEach((e,t)=>m[t>>>3]|=e<<7-(t&7)),new t(u,r,m,c)}getModule(e,t){return 0<=e&&e<this.size&&0<=t&&t<this.size&&this.modules[t][e]}getModules(){return this.modules}drawFunctionPatterns(){for(let e=0;e<this.size;e++)this.setFunctionModule(6,e,e%2==0),this.setFunctionModule(e,6,e%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);let e=this.getAlignmentPatternPositions(),t=e.length;for(let n=0;n<t;n++)for(let r=0;r<t;r++)n==0&&r==0||n==0&&r==t-1||n==t-1&&r==0||this.drawAlignmentPattern(e[n],e[r]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(e){let t=this.errorCorrectionLevel.formatBits<<3|e,n=t;for(let e=0;e<10;e++)n=n<<1^(n>>>9)*1335;let a=(t<<10|n)^21522;i(a>>>15==0);for(let e=0;e<=5;e++)this.setFunctionModule(8,e,r(a,e));this.setFunctionModule(8,7,r(a,6)),this.setFunctionModule(8,8,r(a,7)),this.setFunctionModule(7,8,r(a,8));for(let e=9;e<15;e++)this.setFunctionModule(14-e,8,r(a,e));for(let e=0;e<8;e++)this.setFunctionModule(this.size-1-e,8,r(a,e));for(let e=8;e<15;e++)this.setFunctionModule(8,this.size-15+e,r(a,e));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let e=this.version;for(let t=0;t<12;t++)e=e<<1^(e>>>11)*7973;let t=this.version<<12|e;i(t>>>18==0);for(let e=0;e<18;e++){let n=r(t,e),i=this.size-11+e%3,a=Math.floor(e/3);this.setFunctionModule(i,a,n),this.setFunctionModule(a,i,n)}}drawFinderPattern(e,t){for(let n=-4;n<=4;n++)for(let r=-4;r<=4;r++){let i=Math.max(Math.abs(r),Math.abs(n)),a=e+r,o=t+n;0<=a&&a<this.size&&0<=o&&o<this.size&&this.setFunctionModule(a,o,i!=2&&i!=4)}}drawAlignmentPattern(e,t){for(let n=-2;n<=2;n++)for(let r=-2;r<=2;r++)this.setFunctionModule(e+r,t+n,Math.max(Math.abs(r),Math.abs(n))!=1)}setFunctionModule(e,t,n){this.modules[t][e]=n,this.isFunction[t][e]=!0}addEccAndInterleave(e){let n=this.version,r=this.errorCorrectionLevel;if(e.length!=t.getNumDataCodewords(n,r))throw RangeError(`Invalid argument`);let a=t.NUM_ERROR_CORRECTION_BLOCKS[r.ordinal][n],o=t.ECC_CODEWORDS_PER_BLOCK[r.ordinal][n],s=Math.floor(t.getNumRawDataModules(n)/8),c=a-s%a,l=Math.floor(s/a),u=[],d=t.reedSolomonComputeDivisor(o);for(let n=0,r=0;n<a;n++){let i=e.slice(r,r+l-o+(n<c?0:1));r+=i.length;let a=t.reedSolomonComputeRemainder(i,d);n<c&&i.push(0),u.push(i.concat(a))}let f=[];for(let e=0;e<u[0].length;e++)u.forEach((t,n)=>{(e!=l-o||n>=c)&&f.push(t[e])});return i(f.length==s),f}drawCodewords(e){if(e.length!=Math.floor(t.getNumRawDataModules(this.version)/8))throw RangeError(`Invalid argument`);let n=0;for(let t=this.size-1;t>=1;t-=2){t==6&&(t=5);for(let i=0;i<this.size;i++)for(let a=0;a<2;a++){let o=t-a,s=t+1&2?i:this.size-1-i;!this.isFunction[s][o]&&n<e.length*8&&(this.modules[s][o]=r(e[n>>>3],7-(n&7)),n++)}}i(n==e.length*8)}applyMask(e){if(e<0||e>7)throw RangeError(`Mask value out of range`);for(let t=0;t<this.size;t++)for(let n=0;n<this.size;n++){let r;switch(e){case 0:r=(n+t)%2==0;break;case 1:r=t%2==0;break;case 2:r=n%3==0;break;case 3:r=(n+t)%3==0;break;case 4:r=(Math.floor(n/3)+Math.floor(t/2))%2==0;break;case 5:r=n*t%2+n*t%3==0;break;case 6:r=(n*t%2+n*t%3)%2==0;break;case 7:r=((n+t)%2+n*t%3)%2==0;break;default:throw Error(`Unreachable`)}!this.isFunction[t][n]&&r&&(this.modules[t][n]=!this.modules[t][n])}}getPenaltyScore(){let e=0;for(let n=0;n<this.size;n++){let r=!1,i=0,a=[0,0,0,0,0,0,0];for(let o=0;o<this.size;o++)this.modules[n][o]==r?(i++,i==5?e+=t.PENALTY_N1:i>5&&e++):(this.finderPenaltyAddHistory(i,a),r||(e+=this.finderPenaltyCountPatterns(a)*t.PENALTY_N3),r=this.modules[n][o],i=1);e+=this.finderPenaltyTerminateAndCount(r,i,a)*t.PENALTY_N3}for(let n=0;n<this.size;n++){let r=!1,i=0,a=[0,0,0,0,0,0,0];for(let o=0;o<this.size;o++)this.modules[o][n]==r?(i++,i==5?e+=t.PENALTY_N1:i>5&&e++):(this.finderPenaltyAddHistory(i,a),r||(e+=this.finderPenaltyCountPatterns(a)*t.PENALTY_N3),r=this.modules[o][n],i=1);e+=this.finderPenaltyTerminateAndCount(r,i,a)*t.PENALTY_N3}for(let n=0;n<this.size-1;n++)for(let r=0;r<this.size-1;r++){let i=this.modules[n][r];i==this.modules[n][r+1]&&i==this.modules[n+1][r]&&i==this.modules[n+1][r+1]&&(e+=t.PENALTY_N2)}let n=0;for(let e of this.modules)n=e.reduce((e,t)=>e+ +!!t,n);let r=this.size*this.size,a=Math.ceil(Math.abs(n*20-r*10)/r)-1;return i(0<=a&&a<=9),e+=a*t.PENALTY_N4,i(0<=e&&e<=2568888),e}getAlignmentPatternPositions(){if(this.version==1)return[];{let e=Math.floor(this.version/7)+2,t=this.version==32?26:Math.ceil((this.version*4+4)/(e*2-2))*2,n=[6];for(let r=this.size-7;n.length<e;r-=t)n.splice(1,0,r);return n}}static getNumRawDataModules(e){if(e<t.MIN_VERSION||e>t.MAX_VERSION)throw RangeError(`Version number out of range`);let n=(16*e+128)*e+64;if(e>=2){let t=Math.floor(e/7)+2;n-=(25*t-10)*t-55,e>=7&&(n-=36)}return i(208<=n&&n<=29648),n}static getNumDataCodewords(e,n){return Math.floor(t.getNumRawDataModules(e)/8)-t.ECC_CODEWORDS_PER_BLOCK[n.ordinal][e]*t.NUM_ERROR_CORRECTION_BLOCKS[n.ordinal][e]}static reedSolomonComputeDivisor(e){if(e<1||e>255)throw RangeError(`Degree out of range`);let n=[];for(let t=0;t<e-1;t++)n.push(0);n.push(1);let r=1;for(let i=0;i<e;i++){for(let e=0;e<n.length;e++)n[e]=t.reedSolomonMultiply(n[e],r),e+1<n.length&&(n[e]^=n[e+1]);r=t.reedSolomonMultiply(r,2)}return n}static reedSolomonComputeRemainder(e,n){let r=n.map(e=>0);for(let i of e){let e=i^r.shift();r.push(0),n.forEach((n,i)=>r[i]^=t.reedSolomonMultiply(n,e))}return r}static reedSolomonMultiply(e,t){if(e>>>8||t>>>8)throw RangeError(`Byte out of range`);let n=0;for(let r=7;r>=0;r--)n=n<<1^(n>>>7)*285,n^=(t>>>r&1)*e;return i(n>>>8==0),n}finderPenaltyCountPatterns(e){let t=e[1];i(t<=this.size*3);let n=t>0&&e[2]==t&&e[3]==t*3&&e[4]==t&&e[5]==t;return(n&&e[0]>=t*4&&e[6]>=t?1:0)+(n&&e[6]>=t*4&&e[0]>=t?1:0)}finderPenaltyTerminateAndCount(e,t,n){return e&&(this.finderPenaltyAddHistory(t,n),t=0),t+=this.size,this.finderPenaltyAddHistory(t,n),this.finderPenaltyCountPatterns(n)}finderPenaltyAddHistory(e,t){t[0]==0&&(e+=this.size),t.pop(),t.unshift(e)}};t.MIN_VERSION=1,t.MAX_VERSION=40,t.PENALTY_N1=3,t.PENALTY_N2=3,t.PENALTY_N3=40,t.PENALTY_N4=10,t.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],t.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],e.QrCode=t;function n(e,t,n){if(t<0||t>31||e>>>t)throw RangeError(`Value out of range`);for(let r=t-1;r>=0;r--)n.push(e>>>r&1)}function r(e,t){return(e>>>t&1)!=0}function i(e){if(!e)throw Error(`Assertion error`)}let a=class e{constructor(e,t,n){if(this.mode=e,this.numChars=t,this.bitData=n,t<0)throw RangeError(`Invalid argument`);this.bitData=n.slice()}static makeBytes(t){let r=[];for(let e of t)n(e,8,r);return new e(e.Mode.BYTE,t.length,r)}static makeNumeric(t){if(!e.isNumeric(t))throw RangeError(`String contains non-numeric characters`);let r=[];for(let e=0;e<t.length;){let i=Math.min(t.length-e,3);n(parseInt(t.substring(e,e+i),10),i*3+1,r),e+=i}return new e(e.Mode.NUMERIC,t.length,r)}static makeAlphanumeric(t){if(!e.isAlphanumeric(t))throw RangeError(`String contains unencodable characters in alphanumeric mode`);let r=[],i;for(i=0;i+2<=t.length;i+=2){let a=e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i))*45;a+=e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i+1)),n(a,11,r)}return i<t.length&&n(e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i)),6,r),new e(e.Mode.ALPHANUMERIC,t.length,r)}static makeSegments(t){return t==``?[]:e.isNumeric(t)?[e.makeNumeric(t)]:e.isAlphanumeric(t)?[e.makeAlphanumeric(t)]:[e.makeBytes(e.toUtf8ByteArray(t))]}static makeEci(t){let r=[];if(t<0)throw RangeError(`ECI assignment value out of range`);if(t<128)n(t,8,r);else if(t<16384)n(2,2,r),n(t,14,r);else if(t<1e6)n(6,3,r),n(t,21,r);else throw RangeError(`ECI assignment value out of range`);return new e(e.Mode.ECI,0,r)}static isNumeric(t){return e.NUMERIC_REGEX.test(t)}static isAlphanumeric(t){return e.ALPHANUMERIC_REGEX.test(t)}getData(){return this.bitData.slice()}static getTotalBits(e,t){let n=0;for(let r of e){let e=r.mode.numCharCountBits(t);if(r.numChars>=1<<e)return 1/0;n+=4+e+r.bitData.length}return n}static toUtf8ByteArray(e){e=encodeURI(e);let t=[];for(let n=0;n<e.length;n++)e.charAt(n)==`%`?(t.push(parseInt(e.substring(n+1,n+3),16)),n+=2):t.push(e.charCodeAt(n));return t}};a.NUMERIC_REGEX=/^[0-9]*$/,a.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,a.ALPHANUMERIC_CHARSET=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`;let o=a;e.QrSegment=a})(R||={}),(e=>{(e=>{let t=class{constructor(e,t){this.ordinal=e,this.formatBits=t}};t.LOW=new t(0,1),t.MEDIUM=new t(1,0),t.QUARTILE=new t(2,3),t.HIGH=new t(3,2),e.Ecc=t})(e.QrCode||={})})(R||={}),(e=>{(e=>{let t=class{constructor(e,t){this.modeBits=e,this.numBitsCharCount=t}numCharCountBits(e){return this.numBitsCharCount[Math.floor((e+7)/17)]}};t.NUMERIC=new t(1,[10,12,14]),t.ALPHANUMERIC=new t(2,[9,11,13]),t.BYTE=new t(4,[8,16,16]),t.KANJI=new t(8,[8,10,12]),t.ECI=new t(7,[0,0,0]),e.Mode=t})(e.QrSegment||={})})(R||={});var z=R,he={L:z.QrCode.Ecc.LOW,M:z.QrCode.Ecc.MEDIUM,Q:z.QrCode.Ecc.QUARTILE,H:z.QrCode.Ecc.HIGH},B=128,V=`L`,H=`#FFFFFF`,U=`#000000`,W=!1,G=1,ge=4,_e=0,ve=.1;function K(e,t=0){let n=[];return e.forEach(function(e,r){let i=null;e.forEach(function(a,o){if(!a&&i!==null){n.push(`M${i+t} ${r+t}h${o-i}v1H${i+t}z`),i=null;return}if(o===e.length-1){if(!a)return;i===null?n.push(`M${o+t},${r+t} h1v1H${o+t}z`):n.push(`M${i+t},${r+t} h${o+1-i}v1H${i+t}z`);return}a&&i===null&&(i=o)})}),n.join(``)}function ye(e,t){return e.slice().map((e,n)=>n<t.y||n>=t.y+t.h?e:e.map((e,n)=>n<t.x||n>=t.x+t.w?e:!1))}function be(e,t,n,r){if(r==null)return null;let i=e.length+n*2,a=Math.floor(t*ve),o=i/t,s=(r.width||a)*o,c=(r.height||a)*o,l=r.x==null?e.length/2-s/2:r.x*o,u=r.y==null?e.length/2-c/2:r.y*o,d=r.opacity==null?1:r.opacity,f=null;if(r.excavate){let e=Math.floor(l),t=Math.floor(u);f={x:e,y:t,w:Math.ceil(s+l-e),h:Math.ceil(c+u-t)}}let p=r.crossOrigin;return{x:l,y:u,h:c,w:s,excavation:f,opacity:d,crossOrigin:p}}function xe(e,t){return t==null?e?ge:_e:Math.max(Math.floor(t),0)}function q({value:e,level:t,minVersion:n,includeMargin:r,marginSize:i,imageSettings:a,size:o,boostLevel:s}){let c=A.useMemo(()=>{let r=(Array.isArray(e)?e:[e]).reduce((e,t)=>(e.push(...z.QrSegment.makeSegments(t)),e),[]);return z.QrCode.encodeSegments(r,he[t],n,void 0,void 0,s)},[e,t,n,s]),{cells:l,margin:u,numCells:d,calculatedImageSettings:f}=A.useMemo(()=>{let e=c.getModules(),t=xe(r,i);return{cells:e,margin:t,numCells:e.length+t*2,calculatedImageSettings:be(e,o,t,a)}},[c,o,a,r,i]);return{qrcode:c,margin:u,cells:l,numCells:d,calculatedImageSettings:f}}var Se=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),Ce=A.forwardRef(function(e,t){let n=e,{value:r,size:i=B,level:a=V,bgColor:o=H,fgColor:s=U,includeMargin:c=W,minVersion:l=G,boostLevel:u,marginSize:d,imageSettings:f}=n,p=L(n,[`value`,`size`,`level`,`bgColor`,`fgColor`,`includeMargin`,`minVersion`,`boostLevel`,`marginSize`,`imageSettings`]),{style:m}=p,h=L(p,[`style`]),g=f?.src,_=A.useRef(null),v=A.useRef(null),y=A.useCallback(e=>{_.current=e,typeof t==`function`?t(e):t&&(t.current=e)},[t]),[b,x]=A.useState(!1),{margin:S,cells:C,numCells:w,calculatedImageSettings:T}=q({value:r,level:a,minVersion:l,boostLevel:u,includeMargin:c,marginSize:d,imageSettings:f,size:i});A.useEffect(()=>{if(_.current!=null){let e=_.current,t=e.getContext(`2d`);if(!t)return;let n=C,r=v.current,a=T!=null&&r!==null&&r.complete&&r.naturalHeight!==0&&r.naturalWidth!==0;a&&T.excavation!=null&&(n=ye(C,T.excavation));let c=window.devicePixelRatio||1;e.height=e.width=i*c;let l=i/w*c;t.scale(l,l),t.fillStyle=o,t.fillRect(0,0,w,w),t.fillStyle=s,Se?t.fill(new Path2D(K(n,S))):C.forEach(function(e,n){e.forEach(function(e,r){e&&t.fillRect(r+S,n+S,1,1)})}),T&&(t.globalAlpha=T.opacity),a&&t.drawImage(r,T.x+S,T.y+S,T.w,T.h)}}),A.useEffect(()=>{x(!1)},[g]);let E=I({height:i,width:i},m),D=null;return g!=null&&(D=A.createElement(`img`,{src:g,key:g,style:{display:`none`},onLoad:()=>{x(!0)},ref:v,crossOrigin:T?.crossOrigin})),A.createElement(A.Fragment,null,A.createElement(`canvas`,I({style:E,height:i,width:i,ref:y,role:`img`},h)),D)});Ce.displayName=`QRCodeCanvas`;var J=A.forwardRef(function(e,t){let n=e,{value:r,size:i=B,level:a=V,bgColor:o=H,fgColor:s=U,includeMargin:c=W,minVersion:l=G,boostLevel:u,title:d,marginSize:f,imageSettings:p}=n,m=L(n,[`value`,`size`,`level`,`bgColor`,`fgColor`,`includeMargin`,`minVersion`,`boostLevel`,`title`,`marginSize`,`imageSettings`]),{margin:h,cells:g,numCells:_,calculatedImageSettings:v}=q({value:r,level:a,minVersion:l,boostLevel:u,includeMargin:c,marginSize:f,imageSettings:p,size:i}),y=g,b=null;p!=null&&v!=null&&(v.excavation!=null&&(y=ye(g,v.excavation)),b=A.createElement(`image`,{href:p.src,height:v.h,width:v.w,x:v.x+h,y:v.y+h,preserveAspectRatio:`none`,opacity:v.opacity,crossOrigin:v.crossOrigin}));let x=K(y,h);return A.createElement(`svg`,I({height:i,width:i,viewBox:`0 0 ${_} ${_}`,ref:t,role:`img`},m),!!d&&A.createElement(`title`,null,d),A.createElement(`path`,{fill:o,d:`M0,0 h${_}v${_}H0z`,shapeRendering:`crispEdges`}),A.createElement(`path`,{fill:s,d:x,shapeRendering:`crispEdges`}),b)});J.displayName=`QRCodeSVG`;function we({walletResult:e,mnemonicPhrase:t,deriveBatch:n,deriveList:r,deriveShowIndex:i,deriveShowAddress:a,deriveShowPrivateKey:o,showAddressQr:s,showMnemonicReveal:c,showMnemonicQr:l,onToggleAddressQr:u,onToggleMnemonicReveal:d,onToggleMnemonicQr:f,onToggleDeriveIndex:p,onToggleDeriveAddress:m,onToggleDerivePrivateKey:h,onDerive:g}){let{t:v}=E(),y=e?.address||``;return!e||!y?(0,j.jsx)(N,{icon:(0,j.jsx)(T,{size:36}),message:v(`web3.empty.walletTools`)}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{className:`web3-tools-section`,children:[(0,j.jsxs)(`button`,{className:`web3-tools-toggle`,onClick:u,children:[(0,j.jsx)(re,{size:14}),v(s?`web3.action.hideAddressQr`:`web3.action.showAddressQr`),s?(0,j.jsx)(te,{size:14}):(0,j.jsx)(_,{size:14})]}),s&&(0,j.jsxs)(`div`,{className:`web3-mnemonic-reveal`,children:[(0,j.jsxs)(`div`,{className:`web3-mnemonic-card`,children:[(0,j.jsx)(`p`,{className:`web3-mnemonic-text`,translate:`no`,children:y}),(0,j.jsx)(k,{text:y})]}),(0,j.jsx)(`div`,{className:`qr-wrap`,children:(0,j.jsx)(J,{value:y,size:200})})]})]}),t&&(0,j.jsxs)(`div`,{className:`web3-tools-section`,children:[(0,j.jsxs)(`button`,{className:`web3-tools-toggle`,onClick:d,children:[(0,j.jsx)(x,{size:14}),v(c?`web3.action.hideMnemonic`:`web3.action.showMnemonic`),c?(0,j.jsx)(te,{size:14}):(0,j.jsx)(_,{size:14})]}),c&&(0,j.jsxs)(`div`,{className:`web3-mnemonic-reveal`,children:[(0,j.jsxs)(`div`,{className:`web3-mnemonic-card`,children:[(0,j.jsx)(`p`,{className:`web3-mnemonic-text`,translate:`no`,children:t}),(0,j.jsx)(k,{text:t})]}),(0,j.jsxs)(`p`,{className:`web3-tools-danger`,children:[(0,j.jsx)(ie,{size:14}),v(`web3.warning.mnemonic`)]}),(0,j.jsx)(`button`,{className:`web3-tools-toggle`,onClick:f,children:v(l?`web3.action.hideMnemonicQr`:`web3.action.showMnemonicQr`)}),l&&(0,j.jsx)(`div`,{className:`qr-wrap`,children:(0,j.jsx)(J,{value:t,size:260})})]})]}),t&&(0,j.jsxs)(`div`,{className:`web3-mnemonic-reveal`,children:[(0,j.jsx)(`div`,{children:(0,j.jsx)(`button`,{className:`btn btn-primary`,onClick:g,children:v(`web3.action.deriveAddresses`,{count:n})})}),(0,j.jsxs)(`p`,{className:`web3-tools-danger`,children:[(0,j.jsx)(ie,{size:14}),v(`web3.warning.privateKey`)]}),r.length>0&&(0,j.jsx)(`div`,{className:`web3-derive-table-wrap`,children:(0,j.jsxs)(`table`,{className:`web3-derive-table`,children:[(0,j.jsx)(`thead`,{children:(0,j.jsxs)(`tr`,{children:[(0,j.jsx)(`th`,{onClick:p,className:`web3-derive-th`,children:v(`web3.label.account`)}),(0,j.jsx)(`th`,{onClick:m,className:`web3-derive-th`,children:v(`web3.label.address`)}),(0,j.jsx)(`th`,{onClick:h,className:`web3-derive-th danger`,children:v(`web3.label.privateKeyToggle`,{action:v(o?`web3.action.hide`:`web3.action.show`)})})]})}),(0,j.jsx)(`tbody`,{children:r.map(e=>(0,j.jsxs)(`tr`,{children:[(0,j.jsx)(`td`,{children:i?e.index+1:``}),(0,j.jsx)(`td`,{translate:`no`,children:a?e.address:``}),(0,j.jsx)(`td`,{className:`danger`,children:(0,j.jsx)(`span`,{translate:`no`,children:o?e.privateKey:``})})]},e.index))})]})})]})]})}function Y({title:e,icon:t,children:n,accent:r=!1}){return(0,j.jsxs)(`div`,{className:`web3-key-card ${r?`accent`:``}`,children:[(0,j.jsxs)(`div`,{className:`web3-key-card-header`,children:[(0,j.jsx)(`span`,{className:`web3-key-card-icon`,children:t}),(0,j.jsx)(`span`,{className:`web3-key-card-title`,children:e})]}),(0,j.jsx)(`div`,{className:`web3-key-card-body`,translate:`no`,children:n})]})}function Te(e){return e?`•`.repeat(Math.min(e.length,32)):`-`}function Ee({walletResult:e,keys:t,ipns:n,avatarSrc:r,showPrivateKey:i,onTogglePrivateKey:a}){let{t:o}=E(),s=e?.address||``;return!e||!s?(0,j.jsx)(N,{icon:(0,j.jsx)(S,{size:36}),message:o(`web3.empty.identity`)}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{className:`web3-identity-card`,children:[(0,j.jsx)(`img`,{src:r,alt:`avatar`,className:`web3-identity-avatar`}),(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`h1`,{className:`web3-identity-name`,children:e.username||o(`web3.notSignedIn`)}),(0,j.jsxs)(`div`,{className:`web3-identity-address`,children:[(0,j.jsx)(`code`,{translate:`no`,children:s.toLowerCase()}),(0,j.jsx)(k,{text:s.toLowerCase()}),(0,j.jsxs)(`a`,{href:`https://debank.com/profile/${s}`,target:`_blank`,rel:`noopener noreferrer`,className:`link`,children:[(0,j.jsx)(b,{size:14}),o(`web3.action.view`)]})]})]})]}),t&&(0,j.jsxs)(`div`,{className:`web3-key-grid`,children:[(0,j.jsx)(Y,{title:o(`web3.label.ed25519Public`),icon:(0,j.jsx)(h,{size:18}),children:(0,j.jsxs)(`div`,{className:`mono-row`,children:[(0,j.jsx)(`code`,{className:`mono`,translate:`no`,children:t.ed_public_key}),(0,j.jsx)(k,{text:t.ed_public_key})]})}),(0,j.jsx)(Y,{title:o(`web3.label.x25519Public`),icon:(0,j.jsx)(x,{size:18}),children:(0,j.jsxs)(`div`,{className:`mono-row`,children:[(0,j.jsx)(`code`,{className:`mono`,translate:`no`,children:t.public_key}),(0,j.jsx)(k,{text:t.public_key})]})}),(0,j.jsx)(Y,{title:o(`web3.label.combinedPrivate`),icon:(0,j.jsx)(ae,{size:18}),accent:!0,children:(0,j.jsxs)(`div`,{className:`mono-row danger`,children:[(0,j.jsx)(`code`,{className:`mono`,translate:`no`,children:i?t.private_key:Te(t.private_key)}),(0,j.jsx)(`button`,{className:`btn btn-icon`,onClick:a,title:o(i?`web3.action.hidePrivateKey`:`web3.action.showPrivateKey`),type:`button`,children:i?(0,j.jsx)(O,{size:14}):(0,j.jsx)(D,{size:14})})]})}),(0,j.jsx)(Y,{title:`IPNS ID`,icon:(0,j.jsx)(ne,{size:18}),children:(0,j.jsxs)(`div`,{className:`mono-row`,children:[(0,j.jsx)(`code`,{className:`mono`,translate:`no`,children:n}),(0,j.jsx)(k,{text:n})]})})]})]})}function De({username:e,password:t,showPassword:n,generating:r,onUsernameChange:i,onPasswordChange:a,onTogglePassword:o,onGenerate:s}){let{t:c}=E();return(0,j.jsxs)(`div`,{className:`input-panel`,children:[(0,j.jsxs)(`div`,{className:`web3-tools-inputs`,children:[(0,j.jsx)(`input`,{type:`text`,placeholder:c(`login.username.placeholder`),value:e,onChange:e=>i(e.target.value),className:`input`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:`false`}),(0,j.jsxs)(`div`,{className:`input-wrap`,children:[(0,j.jsx)(`input`,{type:n?`text`:`password`,placeholder:c(`web3.login.passwordOptional`),value:t,onChange:e=>a(e.target.value),className:`input`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:`false`}),(0,j.jsx)(`button`,{className:`input-eye`,onClick:o,type:`button`,children:n?(0,j.jsx)(D,{size:16}):(0,j.jsx)(O,{size:16})})]})]}),(0,j.jsx)(`button`,{className:`btn btn-primary btn-full`,onClick:s,disabled:!e.trim()||r,type:`button`,children:r?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`span`,{className:`spinner`}),c(`web3.login.generating`)]}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(T,{size:16}),c(`web3.login.generateAndSignIn`)]})})]})}var X=e=>btoa(String.fromCharCode(...e)),Oe=e=>{let t=new Uint8Array([48,5,6,3,43,101,112]),n=new Uint8Array([4,34,4,32,...e.slice(0,32)]),r=new Uint8Array([2,1,0]),i=r.length+t.length+n.length,a=new Uint8Array(2+i);a[0]=48,a[1]=i;let o=2;return a.set(r,o),o+=r.length,a.set(t,o),o+=t.length,a.set(n,o),`-----BEGIN PRIVATE KEY-----\n${X(a).match(/.{1,64}/g)?.join(`
|
|
2
2
|
`)}\n-----END PRIVATE KEY-----`},ke=e=>{let t=new Uint8Array([48,5,6,3,43,101,112]),n=new Uint8Array([3,33,0,...e]),r=t.length+n.length,i=new Uint8Array(2+r);i[0]=48,i[1]=r;let a=2;return i.set(t,a),a+=t.length,i.set(n,a),`-----BEGIN PUBLIC KEY-----\n${X(i).match(/.{1,64}/g)?.join(`
|
|
3
3
|
`)}\n-----END PUBLIC KEY-----`},Ae=[`wallet`,`pem`,`export`,`EA`];function je(){let e=window.location.hash.replace(`#`,``);return Ae.includes(e)?e:`wallet`}function Me(){let{t:e}=E(),t=p(e=>e.addToast),n=a(e=>e.setUserIdentity),[i,s]=(0,A.useState)(`wallet`),[c,h]=(0,A.useState)(``),[_,y]=(0,A.useState)(``),[b,D]=(0,A.useState)(!1),[O,k]=(0,A.useState)(null),[te,ne]=(0,A.useState)(null),[re,ie]=(0,A.useState)(``),[ae,oe]=(0,A.useState)(``),[se,ce]=(0,A.useState)(``),[M,N]=(0,A.useState)(``),[ue,fe]=(0,A.useState)([]),[P,pe]=(0,A.useState)(0),[F,me]=(0,A.useState)(!0),[I,L]=(0,A.useState)(!0),[R,z]=(0,A.useState)(!1),[he,B]=(0,A.useState)(!1),[V,H]=(0,A.useState)(!1),[U,W]=(0,A.useState)(!1),[G,ge]=(0,A.useState)(!1),[_e,ve]=(0,A.useState)(!1),[K,ye]=(0,A.useState)(``),[be,xe]=(0,A.useState)(``),[q,Se]=(0,A.useState)(!1),[Ce,J]=(0,A.useState)(!1),[Y,Te]=(0,A.useState)(null),[X,Ae]=(0,A.useState)(``),[Me,Ne]=(0,A.useState)(``),[Pe,Fe]=(0,A.useState)(!1),[Ie,Le]=(0,A.useState)(!1),[Z,Re]=(0,A.useState)(null),[ze,Be]=(0,A.useState)(`Hello B. This is from A.`),[Ve,He]=(0,A.useState)(``),[Ue,We]=(0,A.useState)(``),[Ge,Ke]=(0,A.useState)(``),[qe,Je]=(0,A.useState)(`Hello A. This is from B.`),[Ye,Xe]=(0,A.useState)(``),[Ze,Qe]=(0,A.useState)(``),[$e,et]=(0,A.useState)(``),[tt,nt]=(0,A.useState)(``),[rt,it]=(0,A.useState)(``),[at,ot]=(0,A.useState)(``),[st,ct]=(0,A.useState)(``),[lt,Q]=(0,A.useState)(``),[ut,dt]=(0,A.useState)(!1),[ft,pt]=(0,A.useState)(``),[mt,ht]=(0,A.useState)(``),[gt,_t]=(0,A.useState)(``),[vt,yt]=(0,A.useState)(``),[bt,$]=(0,A.useState)(``),[xt,St]=(0,A.useState)(!1);(0,A.useEffect)(()=>{s(je());let e=()=>s(je());return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},[]);let Ct=e=>{s(e),window.location.hash=e},wt=(0,A.useCallback)(async()=>{if(!c.trim())return;ve(!0),await new Promise(e=>setTimeout(e,0));let r=o(c.trim(),_),i=`${r.username}#${r.address.slice(-4).toUpperCase()}`;k(r),n({...r,displayName:i}),t(e(`login.toast.signedIn`,{username:r.username}),`success`),N(l(r.danger));let a=u(r.danger);ne(a),ie(m(a.private_key,a.ed_public_key));let s=g(a.private_key,a.ed_public_key);oe(Oe(s.secretKey)),ce(ke(s.publicKey)),fe([]),pe(0),B(!1),H(!1),W(!1),ge(!1),ve(!1)},[t,_,n,e,c]);function Tt(n,r,i){let a=n.trim();if(!a)return;let s=o(a,r),c=u(s.danger);i({username:s.username,address:s.address,publicKey:c.public_key,privateKey:c.private_key}),We(``),Ke(``),Qe(``),et(``),t(e(`web3.toast.accountGenerated`),`success`)}function Et({senderAccount:t,recipientAccount:n,message:i,setCipherText:a,setDecryptedText:o,setError:s}){if(!t||!n){s(e(`web3.error.accountsRequired`));return}if(!i.trim()){s(e(`web3.error.messageRequired`));return}a(r(i,{senderPrivateKey:t.privateKey,recipientPublicKey:n.publicKey})),o(``),s(``)}function Dt({senderAccount:t,recipientAccount:n,cipherText:r,setDecryptedText:i,setError:a}){if(!t||!n){a(e(`web3.error.accountsRequired`));return}if(!r.trim()){a(e(`web3.error.cipherRequired`));return}let o=f(r,{senderPublicKey:t.publicKey,recipientPrivateKey:n.privateKey});if(!o){a(e(`web3.error.decryptFailed`)),i(``);return}i(o),a(``)}function Ot(){if(!tt.trim()){Q(e(`web3.error.senderPublicRequired`));return}if(!rt.trim()){Q(e(`web3.error.recipientPrivateRequired`));return}if(!at.trim()){Q(e(`web3.error.cipherRequired`));return}let t=f(at,{senderPublicKey:tt.trim(),recipientPrivateKey:rt.trim()});if(!t){Q(e(`web3.error.decryptFailed`)),ct(``);return}ct(t),Q(``)}function kt(){if(!ft.trim()){$(e(`web3.error.senderPrivateRequired`));return}if(!mt.trim()){$(e(`web3.error.recipientPublicRequired`));return}if(!gt.trim()){$(e(`web3.error.messageRequired`));return}yt(r(gt,{senderPrivateKey:ft.trim(),recipientPublicKey:mt.trim()})),$(``)}let At=()=>{if(!M)return;let e=[];for(let t=P;t<P+10;t++){let n=`m/44'/60'/0'/0/${t}`,r=d.fromPhrase(M,void 0,n);e.push({index:t,address:r.address,privateKey:r.privateKey})}fe(t=>[...t,...e]),pe(e=>e+10)},jt=ee(O?.address||void 0),Mt=i===`wallet`?`web3.view.wallet`:i===`pem`?`web3.view.pem`:i===`EA`?`web3.view.asymmetric`:`web3.view.export`,Nt=[{id:`wallet`,icon:(0,j.jsx)(S,{size:16}),labelKey:`web3.view.wallet`},{id:`pem`,icon:(0,j.jsx)(v,{size:16}),labelKey:`web3.view.pem`},{id:`export`,icon:(0,j.jsx)(T,{size:16}),labelKey:`web3.view.export`},{id:`EA`,icon:(0,j.jsx)(x,{size:16}),labelKey:`web3.view.asymmetric`}],Pt=i!==`EA`;return(0,j.jsx)(C,{sidebar:({closeSidebar:t})=>(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(w,{onNavigate:t}),(0,j.jsx)(`nav`,{className:`sidebar-nav`,children:Nt.map(n=>(0,j.jsxs)(`button`,{onClick:()=>{Ct(n.id),t()},className:`sidebar-nav-btn ${i===n.id?`active`:``}`,children:[n.icon,(0,j.jsx)(`span`,{children:e(n.labelKey)})]},n.id))})]}),headerTitle:(0,j.jsx)(`h2`,{className:`header-title`,children:e(Mt)}),children:(0,j.jsx)(`div`,{className:`web3-page`,children:(0,j.jsxs)(`div`,{className:`web3-container ${i===`EA`?`wide`:``}`,children:[Pt&&(0,j.jsx)(De,{username:c,password:_,showPassword:b,generating:_e,onUsernameChange:h,onPasswordChange:y,onTogglePassword:()=>D(!b),onGenerate:wt}),i===`wallet`&&(0,j.jsx)(Ee,{walletResult:O,keys:te,ipns:re,avatarSrc:jt,showPrivateKey:G,onTogglePrivateKey:()=>ge(!G)}),i===`pem`&&(0,j.jsx)(de,{walletResult:O,publicPem:se,privatePem:ae}),i===`export`&&(0,j.jsx)(we,{walletResult:O,mnemonicPhrase:M,deriveBatch:10,deriveList:ue,deriveShowIndex:F,deriveShowAddress:I,deriveShowPrivateKey:R,showAddressQr:he,showMnemonicReveal:V,showMnemonicQr:U,onToggleAddressQr:()=>B(!he),onToggleMnemonicReveal:()=>H(!V),onToggleMnemonicQr:()=>W(!U),onToggleDeriveIndex:()=>me(!F),onToggleDeriveAddress:()=>L(!I),onToggleDerivePrivateKey:()=>z(!R),onDerive:At}),i===`EA`&&(0,j.jsx)(le,{boxAUsername:K,boxAPassword:be,boxAShowPassword:q,boxAShowPrivateKey:Ce,boxAAccount:Y,boxBUsername:X,boxBPassword:Me,boxBShowPassword:Pe,boxBShowPrivateKey:Ie,boxBAccount:Z,boxABMessage:ze,boxABCipherText:Ve,boxABDecryptedText:Ue,boxABError:Ge,boxBAMessage:qe,boxBACipherText:Ye,boxBADecryptedText:Ze,boxBAError:$e,boxEncryptSenderPrivateKey:ft,boxEncryptRecipientPublicKey:mt,boxEncryptMessage:gt,boxEncryptCipherText:vt,boxEncryptError:bt,boxEncryptShowPrivateKey:xt,boxDecryptSenderPublicKey:tt,boxDecryptRecipientPrivateKey:rt,boxDecryptCipherText:at,boxDecryptResult:st,boxDecryptError:lt,boxDecryptShowPrivateKey:ut,onBoxAUsernameChange:ye,onBoxAPasswordChange:xe,onBoxAShowPasswordToggle:()=>Se(!q),onBoxAShowPrivateKeyToggle:()=>J(!Ce),onGenerateBoxA:()=>Tt(K,be,Te),onBoxBUsernameChange:Ae,onBoxBPasswordChange:Ne,onBoxBShowPasswordToggle:()=>Fe(!Pe),onBoxBShowPrivateKeyToggle:()=>Le(!Ie),onGenerateBoxB:()=>Tt(X,Me,Re),onBoxABMessageChange:Be,onBoxABCipherTextChange:He,onEncryptBoxAB:()=>Et({senderAccount:Y,recipientAccount:Z,message:ze,setCipherText:He,setDecryptedText:We,setError:Ke}),onDecryptBoxAB:()=>Dt({senderAccount:Y,recipientAccount:Z,cipherText:Ve,setDecryptedText:We,setError:Ke}),onBoxBAMessageChange:Je,onBoxBACipherTextChange:Xe,onEncryptBoxBA:()=>Et({senderAccount:Z,recipientAccount:Y,message:qe,setCipherText:Xe,setDecryptedText:Qe,setError:et}),onDecryptBoxBA:()=>Dt({senderAccount:Z,recipientAccount:Y,cipherText:Ye,setDecryptedText:Qe,setError:et}),onBoxEncryptSenderPrivateKeyChange:pt,onBoxEncryptRecipientPublicKeyChange:ht,onBoxEncryptMessageChange:_t,onBoxEncryptShowPrivateKeyToggle:()=>St(!xt),onEncryptOnly:kt,onBoxDecryptSenderPublicKeyChange:nt,onBoxDecryptRecipientPrivateKeyChange:it,onBoxDecryptCipherTextChange:ot,onBoxDecryptShowPrivateKeyToggle:()=>dt(!ut),onDecryptOnly:Ot})]})})})}var Ne=s(`/web3/`)({component:Me});export{Ne as Route};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,o as t,t as n}from"./jsx-runtime-Bt-cYkS5.js";import{D as r,E as i,H as a,a as o,d as s,m as c,p as l,r as u,t as d}from"./useAppStore-DOnk608w.js";import{t as f}from"./circle-alert-dfN4T6Nq.js";import{t as p}from"./check-iBCQl0yr.js";import{t as m}from"./key-round-JR8M3aHl.js";import{t as h}from"./refresh-cw-D4BsHvhi.js";import{A as g,E as _,N as v,k as y,x as b}from"./index-
|
|
1
|
+
import{n as e,o as t,t as n}from"./jsx-runtime-Bt-cYkS5.js";import{D as r,E as i,H as a,a as o,d as s,m as c,p as l,r as u,t as d}from"./useAppStore-DOnk608w.js";import{t as f}from"./circle-alert-dfN4T6Nq.js";import{t as p}from"./check-iBCQl0yr.js";import{t as m}from"./key-round-JR8M3aHl.js";import{t as h}from"./refresh-cw-D4BsHvhi.js";import{A as g,E as _,N as v,k as y,x as b}from"./index-D0Uk9-58.js";import{i as x,t as S}from"./userProfile-BZvkCuet.js";import{r as C,t as w}from"./chatJoinInvite-B-ucvYdg.js";var T=t(e(),1),E=n();function D({children:e,className:t=``}){return(0,E.jsx)(`main`,{className:t,children:e})}function O(e){return String(e||``).trim().replace(/\/+$/,``)}function k(e){return String(e||``).trim()}function A({inviteNodeUrl:e,inviteNodeInvite:t,hasBackend:n,activeBackendUrl:r,activeRemoteUrl:i,activeRemoteInvite:a}){let o=O(e),s=O(i),c=O(r);return!!o&&!!s&&n===!0&&c===s&&s===o&&k(a)===k(t)}function j(e){return!!O(e.inviteNodeUrl)&&!A(e)}var M=`data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"%3E%3Crect width="64" height="64" rx="16" fill="%232f7dd1"/%3E%3Ccircle cx="32" cy="25" r="11" fill="%23f8fbff"/%3E%3Cpath d="M14 56c3-12 12-18 18-18s15 6 18 18" fill="%23f8fbff"/%3E%3C/svg%3E`,N=`data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"%3E%3Crect width="64" height="64" rx="16" fill="%230f9f7a"/%3E%3Cpath d="M18 20h28v22H18z" rx="6" fill="%23f7fff9"/%3E%3Ccircle cx="27" cy="31" r="3" fill="%230f9f7a"/%3E%3Ccircle cx="37" cy="31" r="3" fill="%230f9f7a"/%3E%3Cpath d="M29 39h6" stroke="%230f9f7a" stroke-width="4" stroke-linecap="round"/%3E%3Cpath d="M32 12v8" stroke="%23f7fff9" stroke-width="5" stroke-linecap="round"/%3E%3C/svg%3E`,P=Object.freeze({id:`chatjoin_support`,name:`User / Service 测试频道`}),F=Object.freeze([Object.freeze({uid:`user`,theme:`sparkbit`,name:`测试用户`,avatar:M}),Object.freeze({uid:`service`,name:`测试客服`,avatar:N})]),I=Object.freeze(F.map(e=>Object.freeze({locale:`zh-CN`,uid:e.uid,theme:e.theme,avatar:e.avatar,name:e.name,channels:[P]})));function L(e){let t=String(e||``).trim();return I.find(e=>e.uid===t)||null}var R=50,z=w;function B(e){try{return JSON.parse(e)}catch{return null}}function V(e,t,n){if(t&&typeof t==`object`&&`error`in t){let e=t.error;if(typeof e==`string`)return e}return e||n}function H(e){return`/chat?channel=${encodeURIComponent(e)}`}function U(e){return String(e||``).trim().slice(0,R)}function W(){let{t:e,setLocale:t}=g(),n=b(),a=v({select:e=>e.searchStr}),{token:w,pub:O,fixture:k}=(0,T.useMemo)(()=>{let e=new URLSearchParams(a);return{token:e.get(`token`)||``,pub:e.get(`pub`)||``,fixture:e.get(`fixture`)||``}},[a]),A=d(e=>e.hasBackend),M=i(e=>e.setUserIdentity),[N,P]=(0,T.useState)(``),[F,I]=(0,T.useState)(!0),[R,W]=(0,T.useState)(``),[G,K]=(0,T.useState)(0),q=(0,T.useRef)(``);function J(){q.current=``,P(``),W(``),I(!0),K(e=>e+1)}return(0,T.useEffect)(()=>{let n=L(k);if(k&&!n){P(e(`chatJoin.error.unknownFixture`,{fixture:k})),I(!1);return}if(!n&&!w){P(e(`chatJoin.error.missingToken`)),I(!1);return}if(!n&&!O){P(e(`chatJoin.error.missingPub`)),I(!1);return}if(A===null){W(e(`chatJoin.status.checkingBackend`));return}let i=n?`fixture:${k}`:`${w}:${O}`;if(q.current===i)return;q.current=i;async function a(n){let i=(t,r)=>n.locale?y(t,n.locale,r):e(t,r);n.locale&&t(n.locale);let a=c(),f=l(),p=s();if(j({inviteNodeUrl:n.node_url,inviteNodeInvite:n.node_invite,hasBackend:A,activeBackendUrl:p,activeRemoteUrl:a,activeRemoteInvite:f})){if(W(i(`chatJoin.status.connectingRemote`)),!(await u({url:n.node_url,invite:n.node_invite||``})).ok)throw Error(i(`chatJoin.error.remoteConnectFailed`));o({url:n.node_url,invite:n.node_invite||``}),d.setState({hasBackend:!0})}else if(!A)throw Error(i(`chatJoin.error.noBackend`));W(i(`chatJoin.status.signingIn`));let m=r(n.uid,``),h={...m,theme:n.theme,displayName:n.name||m.displayName,logo:n.logo,logo_dark:n.logo_dark,data:n.data,avatar:n.avatar};M(h),W(i(`chatJoin.status.joiningChannel`));let g=``;for(let e of n.channels){let t=await x.createChannel(e.id,`public`,S(h)),n=t.channelKey||t.key||e.id;g||=n;let r=U(e.name);r&&await x.setChannelRemark(n,r)}let _=n.channels[0];W(i(`chatJoin.status.openingChannel`)),window.location.href=H(g||_.id)}async function f(){try{if(n){W(e(`chatJoin.status.loadingFixture`,{name:n.name||k})),await a(n);return}W(e(`chatJoin.status.decryptingInvite`));let t=await fetch(`${z}/api/chat.join.decrypt`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({token:w,pub:O})}),r=await t.text(),i=B(r);if(!t.ok)P(V(r,i,e(`chatJoin.error.decrypt`)));else{let t=C(i);if(!t){P(e(`chatJoin.error.invalidInvite`));return}await a(t)}}catch(t){P(e(`chatJoin.error.request`,{message:t instanceof Error?t.message:String(t)}))}finally{I(!1)}}f()},[k,A,O,G,t,M,e,w]),(0,E.jsx)(D,{className:`chat-join-loading-page`,children:(0,E.jsx)(`div`,{className:`chat-join-loading-panel`,children:F?(0,E.jsxs)(`div`,{className:`chat-join-loading`,children:[(0,E.jsx)(m,{size:32}),(0,E.jsx)(`p`,{children:R||e(`chatJoin.status.decrypting`)})]}):N?(0,E.jsxs)(`div`,{className:`chat-join-error`,children:[(0,E.jsx)(f,{size:32}),(0,E.jsx)(`p`,{children:N}),R&&(0,E.jsx)(`p`,{className:`chat-join-status`,children:R}),(0,E.jsxs)(`div`,{className:`chat-join-actions`,children:[(0,E.jsxs)(`button`,{type:`button`,className:`btn btn-secondary`,onClick:n,children:[(0,E.jsx)(_,{size:16}),e(`common.back`)]}),(0,E.jsxs)(`button`,{type:`button`,className:`btn btn-primary`,onClick:J,children:[(0,E.jsx)(h,{size:16}),e(`chatJoin.action.retry`)]})]})]}):(0,E.jsxs)(`div`,{className:`chat-join-success`,children:[(0,E.jsx)(p,{size:32}),(0,E.jsx)(`p`,{children:R||e(`chatJoin.status.decryptSuccess`)})]})})})}function G(){return(0,E.jsx)(T.Suspense,{children:(0,E.jsx)(W,{})})}var K=a(`/chat/join/`)({component:G});export{K as Route};
|