tinybase 5.3.0-beta.1 → 5.3.0-beta.2
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/@types/ui-react/index.d.cts +0 -71
- package/@types/ui-react/index.d.ts +0 -71
- package/@types/ui-react/with-schemas/index.d.cts +0 -71
- package/@types/ui-react/with-schemas/index.d.ts +0 -71
- package/cjs/es6/min/ui-react-inspector/index.cjs +1 -1
- package/cjs/es6/min/ui-react-inspector/index.cjs.gz +0 -0
- package/cjs/es6/min/ui-react-inspector/with-schemas/index.cjs +1 -1
- package/cjs/es6/min/ui-react-inspector/with-schemas/index.cjs.gz +0 -0
- package/cjs/es6/ui-react-inspector/index.cjs +1 -1
- package/cjs/es6/ui-react-inspector/with-schemas/index.cjs +1 -1
- package/cjs/min/ui-react-inspector/index.cjs +1 -1
- package/cjs/min/ui-react-inspector/index.cjs.gz +0 -0
- package/cjs/min/ui-react-inspector/with-schemas/index.cjs +1 -1
- package/cjs/min/ui-react-inspector/with-schemas/index.cjs.gz +0 -0
- package/cjs/ui-react-inspector/index.cjs +1 -1
- package/cjs/ui-react-inspector/with-schemas/index.cjs +1 -1
- package/es6/min/ui-react-inspector/index.js +1 -1
- package/es6/min/ui-react-inspector/index.js.gz +0 -0
- package/es6/min/ui-react-inspector/with-schemas/index.js +1 -1
- package/es6/min/ui-react-inspector/with-schemas/index.js.gz +0 -0
- package/es6/ui-react-inspector/index.js +1 -1
- package/es6/ui-react-inspector/with-schemas/index.js +1 -1
- package/min/ui-react-inspector/index.js +1 -1
- package/min/ui-react-inspector/index.js.gz +0 -0
- package/min/ui-react-inspector/with-schemas/index.js +1 -1
- package/min/ui-react-inspector/with-schemas/index.js.gz +0 -0
- package/package.json +1 -1
- package/readme.md +2 -2
- package/releases.md +2 -2
- package/ui-react-inspector/index.js +1 -1
- package/ui-react-inspector/with-schemas/index.js +1 -1
- package/umd/es6/min/ui-react-inspector/index.js +1 -1
- package/umd/es6/min/ui-react-inspector/index.js.gz +0 -0
- package/umd/es6/min/ui-react-inspector/with-schemas/index.js +1 -1
- package/umd/es6/min/ui-react-inspector/with-schemas/index.js.gz +0 -0
- package/umd/es6/ui-react-inspector/index.js +2 -1
- package/umd/es6/ui-react-inspector/with-schemas/index.js +2 -1
- package/umd/min/ui-react-inspector/index.js +1 -1
- package/umd/min/ui-react-inspector/index.js.gz +0 -0
- package/umd/min/ui-react-inspector/with-schemas/index.js +1 -1
- package/umd/min/ui-react-inspector/with-schemas/index.js.gz +0 -0
- package/umd/ui-react-inspector/index.js +2 -1
- package/umd/ui-react-inspector/with-schemas/index.js +2 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"react";import{useCell as t,useValue as n,useSetValueCallback as s,useSetCellCallback as l,useValueIds as a,ValueView as r,useStoreOrStoreById as o,useRowCount as i,useSortedRowIds as d,useTableCellIds as c,useIndexesOrIndexesById as u,useSliceRowIds as h,useRelationshipsOrRelationshipsById as m,useRowIds as g,useResultRowCount as p,useResultSortedRowIds as b,useResultTableCellIds as f,useRemoteRowId as y,CellView as I,ResultCellView as w,useIndexes as v,useIndexIds as C,useSliceIds as k,useMetrics as T,useMetricIds as x,useMetric as S,useQueries as q,useQueryIds as N,useRelationships as V,useRelationshipIds as M,useStore as L,useTableIds as R,useValues as E,useStoreIds as z,useMetricsIds as $,useIndexesIds as A,useRelationshipsIds as F,useQueriesIds as J,useCreateStore as O,useCreatePersister as P}from"../../ui-react/with-schemas/index.js";const D=e=>typeof e,j="",B=D(j),H=D(!0),W=D(0),Q=D(D),G="type",K="default",U="Has",X="Ids",Y="Table",Z=Y+"s",_=Y+X,ee="Row",te=ee+"Count",ne=ee+X,se="Cell",le=se+X,ae="Value",re=ae+"s",oe=ae+X,ie="currentTarget",de="value",ce=e=>j+e,ue=globalThis.window,he=Math,me=he.min,ge=he.floor,pe=isFinite,be=e=>null==e,fe=(e,t,n)=>be(e)?n?.():t(e),ye=e=>e==B||e==H,Ie=e=>D(e)==Q,we=e=>Array.isArray(e),ve=(e,t,n)=>e.slice(t,n),Ce=e=>e.length,ke=e=>{throw Error(e)},{PureComponent:Te,Fragment:xe,createElement:Se,useCallback:qe,useLayoutEffect:Ne,useRef:Ve,useState:Me}=e,Le=(e,...t)=>be(e)?{}:e(...t),Re=(e,t)=>e.sort(t),Ee=(e,t)=>e.forEach(t),ze=(e,t)=>e.map(t),$e=e=>0==Ce(e),Ae=(e,...t)=>e.push(...t),Fe=e=>e.shift(),Je=Object,Oe=e=>Je.getPrototypeOf(e),Pe=Je.entries,De=Je.isFrozen,je=e=>!be(e)&&fe(Oe(e),(e=>e==Je.prototype||be(Oe(e))),(()=>!0)),Be=Je.keys,He=Je.freeze,We=(e=[])=>Je.fromEntries(e),Qe=(e,t)=>t in e,Ge=(e,t)=>(delete e[t],e),Ke=(e,t)=>ze(Pe(e),(([e,n])=>t(n,e))),Ue=e=>je(e)&&0==(e=>Ce(Be(e)))(e),Xe=(e,t,n,s=0)=>be(e)||!je(e)||!s&&Ue(e)||De(e)?(n?.(),!1):(Ke(e,((n,s)=>{t(n,s)||Ge(e,s)})),!!s||!Ue(e)),Ye=JSON.stringify,Ze=JSON.parse,_e=e=>Ye(e,((e,t)=>t instanceof Map?Je.fromEntries([...t]):t)),et="tinybaseInspector",tt="TinyBase Inspector",nt=["left","top","bottom","right","full"],st="state",lt="sort",at="open",rt="position",ot=at,it="editable",dt=(...e)=>_e(e),ct=(e,t)=>ze(Re(e),t),ut=(e,n)=>[!!t(st,e,it,n),qe((t=>{n.setCell(st,e,it,(e=>!e)),t.preventDefault()}),[n,e])],ht="M20 80l5-15l40-40l10 10l-40 40l-15 5m5-15l10 10",mt='content:url("',gt=mt+"data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' stroke-width='4' stroke='white' fill='none'>",pt='</svg>")',bt=mt+"data:image/svg+xml,%3csvg viewBox='0 0 680 680' xmlns='http://www.w3.org/2000/svg' style='width:680px%3bheight:680px'%3e %3cpath stroke='white' stroke-width='80' fill='none' d='M340 617a84 241 90 11.01 0zM131 475a94 254 70 10428-124 114 286 70 01-428 124zm0-140a94 254 70 10428-124 114 286 70 01-428 124zm-12-127a94 254 70 00306 38 90 260 90 01-306-38zm221 3a74 241 90 11.01 0z' /%3e %3cpath fill='%23d81b60' d='M131 475a94 254 70 10428-124 114 286 70 01-428 124zm0-140a94 254 70 10428-124 114 286 70 01-428 124z' /%3e %3cpath d='M249 619a94 240 90 00308-128 114 289 70 01-308 128zM119 208a94 254 70 00306 38 90 260 90 01-306-38zm221 3a74 241 90 11.01 0z' /%3e%3c/svg%3e\")",ft=ze([[20,20,20,60],[20,20,60,20],[20,60,60,20],[60,20,20,60],[30,30,40,40]],(([e,t,n,s])=>gt+`<rect x='20' y='20' width='60' height='60' fill='grey'/><rect x='${e}' y='${t}' width='${n}' height='${s}' fill='white'/>`+pt)),yt=gt+"<path d='M20 20l60 60M20 80l60-60' />"+pt,It=gt+`<path d='${ht}' />`+pt,wt=gt+`<path d='${ht}M20 20l60 60' />`+pt,vt="*::-webkit-scrollbar",Ct=((e,t="")=>e.join(t))(Ke({"":"all:initial;font-family:sans-serif;font-size:0.75rem;position:fixed;z-index:999999","*":"all:revert","*::before":"all:revert","*::after":"all:revert",[vt]:"width:0.5rem;height:0.5rem;",[vt+"-track"]:"background:#111",[vt+"-thumb"]:"background:#999;border:1px solid #111",[vt+"-thumb:hover"]:"background:#fff",[vt+"-corner"]:"background:#111",img:"width:1rem;height:1rem;background:#111;border:0;vertical-align:text-bottom",">img":"padding:0.25rem;bottom:0;right:0;position:fixed;"+bt,...We(ze(["bottom:0;left:0","top:0;right:0"],((e,t)=>[`>img[data-position='${t}']`,e]))),main:"display:flex;flex-direction:column;background:#111d;color:#fff;position:fixed;",...We(ze(["bottom:0;left:0;width:35vw;height:100vh","top:0;right:0;width:100vw;height:30vh","bottom:0;left:0;width:100vw;height:30vh","top:0;right:0;width:35vw;height:100vh","top:0;right:0;width:100vw;height:100vh"],((e,t)=>[`main[data-position='${t}']`,e]))),header:"display:flex;padding:0.25rem;background:#000;align-items:center","header>img:nth-of-type(1)":bt,"header>img:nth-of-type(6)":yt,...We(ze(ft,((e,t)=>[`header>img[data-id='${t}']`,e]))),"header>span":"flex:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;margin-left:0.25rem",article:"padding:0.25rem 0.25rem 0.25rem 0.5rem;overflow:auto;flex:1",details:"margin-left:0.75rem;width:fit-content;","details img":"display:none","details[open]>summary img":"display:unset;background:none;margin-left:0.25rem","details[open]>summary img.edit":It,"details[open]>summary img.done":wt,summary:"margin-left:-0.75rem;line-height:1.25rem;user-select:none;width:fit-content",table:"border-collapse:collapse;table-layout:fixed;margin-bottom:0.5rem","table input":"background:#111;color:unset;padding:0 0.25rem;border:0;font-size:unset;vertical-align:top;margin:0",'table input[type="number"]':"width:4rem","table tbody button":"font-size:0;background:#fff;border-radius:50%;margin:0 0.125rem 0 0;width:0.85rem;color:#111","table button:first-letter":"font-size:0.75rem",thead:"background:#222","th:nth-of-type(1)":"min-width:2rem;","th.sorted":"background:#000","table caption":"text-align:left;white-space:nowrap;line-height:1.25rem",button:"width:1.5rem;border:none;background:none;color:#fff;padding:0","button[disabled]":"color:#777","button.next":"margin-right:0.5rem",[`th,#${et} td`]:"overflow:hidden;text-overflow:ellipsis;padding:0.25rem 0.5rem;max-width:12rem;white-space:nowrap;border-width:1px 0;border-style:solid;border-color:#777;text-align:left","span.warn":"margin:0.25rem;color:#d81b60"},((e,t)=>e?`#${et} ${t}{${e}}`:""))),kt=({s:e})=>{const t=n(rt,e)??1,l=s(ot,(()=>!0),[],e);return n(ot,e)?null:Se("img",{onClick:l,title:tt,"data-position":t})},Tt=({uniqueId:e,summary:n,editable:s,handleEditable:a,children:r,s:o})=>{const i=!!t(st,e,at,o),d=l(st,e,at,(e=>e[ie].open),[],o);return Se("details",{open:i,onToggle:d},Se("summary",null,n,a?Se("img",{onClick:a,className:s?"done":"edit"}):null),r)},xt=e=>{const t=D(e);return ye(t)||t==W&&pe(e)?t:void 0},St=(e,t,n,s,l)=>be(l)?e.delCell(t,n,s,!0):e.setCell(t,n,s,l),qt=(e,t,n)=>be(n)?e.delValue(t):e.setValue(t,n),Nt=(e,t,n,s)=>e==B?t:e==W?n:s,{useCallback:Vt,useMemo:Mt,useState:Lt}=e,Rt="editable",Et=(e,t)=>ze(c(e,t),(t=>e+"."+t)),zt=(e,t,n)=>{const s=Vt(e,t);return n?s:void 0},$t=(...e)=>Mt((()=>e),e),At=(e,t)=>Mt((()=>({store:e,tableId:t})),[e,t]),Ft=(e,t)=>Mt((()=>({queries:e,queryId:t})),[e,t]),Jt=(e,t=!1,n,s=0,l,a,r,o)=>{const[[i,d,c],u]=Lt([e,t,s]),h=Vt((e=>{u(e),o?.(e)}),[o]),m=zt((e=>h([e,e==i&&!d,c])),[h,i,d,c],n),g=Vt((e=>h([i,d,e])),[h,i,d]),p=!0===r?Yt:r;return[[i,d,c],m,Mt((()=>!1===r?null:Se(p,{offset:c,limit:l,total:a,onChange:g})),[r,p,c,l,a,g])]},Ot=(e,t,n)=>Mt((()=>{const s=t??e;return l=we(s)?We(ze(s,(e=>[e,e]))):s,a=(e,t)=>{return{label:t,component:n,...(s=e,D(s)==B?{label:e}:e)};var s},We(Ke(l,((e,t)=>[t,a(e,t)])));var l,a}),[t,n,e]),Pt=({className:e,headerRow:t,idColumn:n,params:[s,l,a,r,o,i]})=>Se("table",{className:e},i?Se("caption",null,i):null,!1===t?null:Se("thead",null,Se("tr",null,!1===n?null:Se(Dt,{sort:r??[],label:"Id",onClick:o}),Ke(s,(({label:e},t)=>Se(Dt,{key:t,cellId:t,label:e,sort:r??[],onClick:o}))))),Se("tbody",null,ze(a,(e=>Se("tr",{key:e},!1===n?null:Se("th",null,e),Ke(s,(({component:t,getComponentProps:n},s)=>Se("td",{key:s},Se(t,{...Le(n,e,s),...l,rowId:e,cellId:s}))))))))),Dt=({cellId:e,sort:[t,n],label:s=e??j,onClick:l})=>Se("th",{onClick:zt((()=>l?.(e)),[l,e],l),className:be(n)||t!=e?void 0:`sorted ${n?"de":"a"}scending`},be(n)||t!=e?null:(n?"↓":"↑")+" ",s),jt=({localRowId:t,params:[n,s,l,a,r,o,i]})=>{const d=y(r,t,o);return Se("tr",null,!1===n?null:Se(e.Fragment,null,Se("th",null,t),Se("th",null,d)),Ke(s,(({component:e,getComponentProps:n},s)=>{const[r,o]=s.split(".",2),c=r===l?t:r===a?d:null;return be(c)?null:Se("td",{key:s},Se(e,{...Le(n,c,o),store:i,tableId:r,rowId:c,cellId:o}))})))},Bt=({thing:e,onThingChange:t,className:n,hasSchema:s,showType:l=!0})=>{const[a,r]=Lt(),[o,i]=Lt(),[d,c]=Lt(),[u,h]=Lt(),[m,g]=Lt();o!==e&&(r(xt(e)),i(e),c(e+""),h(Number(e)||0),g(!!e));const p=Vt(((e,n)=>{n(e),i(e),t(e)}),[t]),b=Vt((()=>{if(!s?.()){const e=Nt(a,W,H,B),n=Nt(e,d,u,m);r(e),i(n),t(n)}}),[s,t,d,u,m,a]);return Se("div",{className:n},l?Se("button",{className:a,onClick:b},a):null,Nt(a,Se("input",{key:a,value:d,onChange:Vt((e=>p(e[ie][de]+"",c)),[p])}),Se("input",{key:a,type:"number",value:u,onChange:Vt((e=>p(Number(e[ie][de]||0),h)),[p])}),Se("input",{key:a,type:"checkbox",checked:m,onChange:Vt((e=>p(!!e[ie].checked,g)),[p])})))},Ht=({tableId:e,cellId:t,descending:n,offset:s,limit:l,store:a,editable:r,sortOnClick:o,paginator:u=!1,onChange:h,customCells:m,...g})=>{const[p,b,f]=Jt(t,n,o,s,l,i(e,a),u,h);return Se(Pt,{...g,params:$t(Ot(c(e,a),m,r?Ut:I),At(a,e),d(e,...p,l,a),p,b,f)})},Wt=({store:e,editable:t=!1,valueComponent:n=(t?Xt:r),getValueComponentProps:s,className:l,headerRow:o,idColumn:i})=>Se("table",{className:l},!1===o?null:Se("thead",null,Se("tr",null,!1===i?null:Se("th",null,"Id"),Se("th",null,ae))),Se("tbody",null,ze(a(e),(t=>Se("tr",{key:t},!1===i?null:Se("th",null,t),Se("td",null,Se(n,{...Le(s,t),valueId:t,store:e}))))))),Qt=({indexId:e,sliceId:t,indexes:n,editable:s,customCells:l,...a})=>{const[r,o,i]=((e,t)=>[e,e?.getStore(),e?.getTableId(t)])(u(n),e);return Se(Pt,{...a,params:$t(Ot(c(i,o),l,s?Ut:I),At(o,i),h(e,t,r))})},Gt=({relationshipId:t,relationships:n,editable:s,customCells:l,className:a,headerRow:r,idColumn:o=!0})=>{const[i,d,c,u]=((e,t)=>[e,e?.getStore(),e?.getLocalTableId(t),e?.getRemoteTableId(t)])(m(n),t),h=Ot([...Et(c,d),...Et(u,d)],l,s?Ut:I),p=$t(o,h,c,u,t,i,d);return Se("table",{className:a},!1===r?null:Se("thead",null,Se("tr",null,!1===o?null:Se(e.Fragment,null,Se("th",null,c,".Id"),Se("th",null,u,".Id")),Ke(h,(({label:e},t)=>Se("th",{key:t},e))))),Se("tbody",null,ze(g(c,d),(e=>Se(jt,{key:e,localRowId:e,params:p})))))},Kt=({queryId:e,cellId:t,descending:n,offset:s,limit:l,queries:a,sortOnClick:r,paginator:o=!1,customCells:i,onChange:d,...c})=>{const[u,h,m]=Jt(t,n,r,s,l,p(e,a),o,d);return Se(Pt,{...c,params:$t(Ot(f(e,a),i,w),Ft(a,e),b(e,...u,l,a),u,h,m)})},Ut=({tableId:e,rowId:n,cellId:s,store:a,className:r,showType:i})=>Se(Bt,{thing:t(e,n,s,a),onThingChange:l(e,n,s,(e=>e),[],a),className:r??Rt+se,showType:i,hasSchema:o(a)?.hasTablesSchema}),Xt=({valueId:e,store:t,className:l,showType:a})=>Se(Bt,{thing:n(e,t),onThingChange:s(e,(e=>e),[],t),className:l??Rt+ae,showType:a,hasSchema:o(t)?.hasValuesSchema}),Yt=({onChange:t,total:n,offset:s=0,limit:l=n,singular:a="row",plural:r=a+"s"})=>{(s>n||s<0)&&(s=0,t(0));const o=zt((()=>t(s-l)),[t,s,l],s>0),i=zt((()=>t(s+l)),[t,s,l],s+l<n);return Se(e.Fragment,null,n>l&&Se(e.Fragment,null,Se("button",{className:"previous",disabled:0==s,onClick:o},"←"),Se("button",{className:"next",disabled:s+l>=n,onClick:i},"→"),s+1," to ",me(n,s+l)," of "),n," ",1!=n?r:a)},Zt=({indexes:e,indexesId:t,indexId:n,s:s})=>Se(Tt,{uniqueId:dt("i",t,n),summary:"Index: "+n,s:s},ze(k(n,e),(l=>Se(_t,{indexes:e,indexesId:t,indexId:n,sliceId:l,s:s,key:l})))),_t=({indexes:e,indexesId:t,indexId:n,sliceId:s,s:l})=>{const a=dt("i",t,n,s),[r,o]=ut(a,l);return Se(Tt,{uniqueId:a,summary:"Slice: "+s,editable:r,handleEditable:o,s:l},Se(Qt,{sliceId:s,indexId:n,indexes:e,editable:r}))},en=({indexesId:e,s:t})=>{const n=v(e),s=C(n);return be(n)?null:Se(Tt,{uniqueId:dt("i",e),summary:"Indexes: "+(e??K),s:t},$e(s)?"No indexes defined":ct(s,(s=>Se(Zt,{indexes:n,indexesId:e,indexId:s,s:t,key:s}))))},tn=({metrics:e,metricId:t})=>Se("tr",null,Se("th",null,t),Se("td",null,e?.getTableId(t)),Se("td",null,S(t,e))),nn=({metricsId:e,s:t})=>{const n=T(e),s=x(n);return be(n)?null:Se(Tt,{uniqueId:dt("m",e),summary:"Metrics: "+(e??K),s:t},$e(s)?"No metrics defined":Se("table",null,Se("thead",null,Se("th",null,"Metric Id"),Se("th",null,"Table Id"),Se("th",null,"Metric")),Se("tbody",null,ze(s,(e=>Se(tn,{metrics:n,metricId:e,key:e}))))))},sn=({queries:e,queriesId:n,queryId:s,s:a})=>{const r=dt("q",n,s),[o,i,d]=Ze(t(st,r,lt,a)??"[]"),c=l(st,r,lt,_e,[],a);return Se(Tt,{uniqueId:r,summary:"Query: "+s,s:a},Se(Kt,{queryId:s,queries:e,cellId:o,descending:i,offset:d,limit:10,paginator:!0,sortOnClick:!0,onChange:c}))},ln=({queriesId:e,s:t})=>{const n=q(e),s=N(n);return be(n)?null:Se(Tt,{uniqueId:dt("q",e),summary:"Queries: "+(e??K),s:t},$e(s)?"No queries defined":ct(s,(s=>Se(sn,{queries:n,queriesId:e,queryId:s,s:t,key:s}))))},an=({relationships:e,relationshipsId:t,relationshipId:n,s:s})=>{const l=dt("r",t,n),[a,r]=ut(l,s);return Se(Tt,{uniqueId:l,summary:"Relationship: "+n,editable:a,handleEditable:r,s:s},Se(Gt,{relationshipId:n,relationships:e,editable:a}))},rn=({relationshipsId:e,s:t})=>{const n=V(e),s=M(n);return be(n)?null:Se(Tt,{uniqueId:dt("r",e),summary:"Relationships: "+(e??K),s:t},$e(s)?"No relationships defined":ct(s,(s=>Se(an,{relationships:n,relationshipsId:e,relationshipId:s,s:t,key:s}))))},on=({tableId:e,store:n,storeId:s,s:a})=>{const r=dt("t",s,e),[o,i,d]=Ze(t(st,r,lt,a)??"[]"),c=l(st,r,lt,_e,[],a),[u,h]=ut(r,a);return Se(Tt,{uniqueId:r,summary:Y+": "+e,editable:u,handleEditable:h,s:a},Se(Ht,{tableId:e,store:n,cellId:o,descending:i,offset:d,limit:10,paginator:!0,sortOnClick:!0,onChange:c,editable:u}))},dn=({store:e,storeId:t,s:n})=>{const s=dt("v",t),[l,r]=ut(s,n);return $e(a(e))?null:Se(Tt,{uniqueId:s,summary:re,editable:l,handleEditable:r,s:n},Se(Wt,{store:e,editable:l}))},cn=({storeId:e,s:t})=>{const n=L(e),s=R(n);return be(n)?null:Se(Tt,{uniqueId:dt("s",e),summary:(n.isMergeable()?"Mergeable":"")+"Store: "+(e??K),s:t},Se(dn,{storeId:e,store:n,s:t}),ct(s,(s=>Se(on,{store:n,storeId:e,tableId:s,s:t,key:s}))))},un=({s:e})=>{const t=Ve(null),n=Ve(0),[s,l]=Me(!1),{scrollLeft:a,scrollTop:r}=E(e);Ne((()=>{const e=t.current;if(e&&!s){const t=new MutationObserver((()=>{e.scrollWidth>=ge(a)+e.clientWidth&&e.scrollHeight>=ge(r)+e.clientHeight&&e.scrollTo(a,r)}));return t.observe(e,{childList:!0,subtree:!0}),()=>t.disconnect()}}),[s,a,r]);const o=qe((t=>{const{scrollLeft:s,scrollTop:a}=t[ie];cancelIdleCallback(n.current),n.current=requestIdleCallback((()=>{l(!0),e.setPartialValues({scrollLeft:s,scrollTop:a})}))}),[e]),i=L(),d=z(),c=T(),u=$(),h=v(),m=A(),g=V(),p=F(),b=q(),f=J();return be(i)&&$e(d)&&be(c)&&$e(u)&&be(h)&&$e(m)&&be(g)&&$e(p)&&be(b)&&$e(f)?Se("span",{className:"warn"},"There are no Stores or other objects to inspect. Make sure you placed the Inspector inside a Provider component."):Se("article",{ref:t,onScroll:o},Se(cn,{s:e}),ze(d,(t=>Se(cn,{storeId:t,s:e,key:t}))),Se(nn,{s:e}),ze(u,(t=>Se(nn,{metricsId:t,s:e,key:t}))),Se(en,{s:e}),ze(m,(t=>Se(en,{indexesId:t,s:e,key:t}))),Se(rn,{s:e}),ze(p,(t=>Se(rn,{relationshipsId:t,s:e,key:t}))),Se(ln,{s:e}),ze(f,(t=>Se(ln,{queriesId:t,s:e,key:t}))))};class hn extends Te{constructor(e){super(e),this.state={e:0}}static getDerivedStateFromError(){return{e:1}}componentDidCatch=(e,t)=>console.error(e,t.componentStack);render(){return this.state.e?Se("span",{className:"warn"},"Inspector error: please see console for details."):this.props.children}}const mn=({s:e})=>{const t=n(rt,e)??1,l=s(ot,(()=>!1),[],e),a=s(rt,(e=>Number(e[ie].dataset.id)),[],e);return Se("header",null,Se("img",{title:tt}),Se("span",null,tt),ze(nt,((e,n)=>n==t?null:Se("img",{onClick:a,"data-id":n,title:"Dock to "+e,key:n}))),Se("img",{onClick:l,title:"Close"}))},gn=({s:e})=>{const t=n(rt,e)??1;return n(ot,e)?Se("main",{"data-position":t},Se(mn,{s:e}),Se(hn,null,Se(un,{s:e}))):null},pn=e=>t=>{return n=(t,n)=>t+e(n),Cn(t).reduce(n,0);var n},bn=e=>e?.size??0,fn=pn(bn),yn=pn(fn),In=pn(yn),wn=(e,t)=>e?.has(t)??!1,vn=e=>be(e)||0==bn(e),Cn=e=>[...e?.values()??[]],kn=e=>e.clear(),Tn=(e,t)=>e?.forEach(t),xn=(e,t)=>e?.delete(t),Sn=e=>new Map(e),qn=e=>[...e?.keys()??[]],Nn=(e,t)=>e?.get(t),Vn=(e,t)=>Tn(e,((e,n)=>t(n,e))),Mn=(e,t,n)=>be(n)?(xn(e,t),e):e?.set(t,n),Ln=(e,t,n,s)=>(wn(e,t)?s?.(Nn(e,t)):Mn(e,t,n()),Nn(e,t)),Rn=(e,t,n,s=Mn)=>(Ke(t,((t,s)=>n(e,s,t))),Vn(e,(n=>Qe(t,n)?0:s(e,n))),e),En=(e,t,n,s)=>{const l={};return Tn(e,((e,a)=>{if(!n?.(e,a)){const n=t?t(e,a):e;s?.(n)||(l[a]=n)}})),l},zn=(e,t,n)=>En(e,(e=>En(e,t,n)),vn,Ue),$n=(e,t,n)=>En(e,(e=>zn(e,t,n)),vn,Ue),An=(e,t)=>{const n=Sn();return Tn(e,((e,s)=>n.set(s,t?.(e)??e))),n},Fn=e=>An(e,An),Jn=e=>An(e,Fn),On=(e,t,n,s,l=0)=>fe((n?Ln:Nn)(e,t[l],l>Ce(t)-2?n:Sn),(a=>{if(l>Ce(t)-2)return s?.(a)&&Mn(e,t[l]),a;const r=On(a,t,n,s,l+1);return vn(a)&&Mn(e,t[l]),r})),Pn=Sn(),Dn=Sn(),jn="storage",Bn=e=>new Set(we(e)||be(e)?e:[e]),Hn=(e,t)=>e?.add(t),Wn=/^\d+$/,Qn=()=>{const e=[];let t=0;return[n=>(n?Fe(e):null)??j+t++,t=>{Wn.test(t)&&Ce(e)<1e3&&Ae(e,t)}]},Gn=e=>[e,e],Kn=(e,t=fn)=>t(e[0])+t(e[1]),Un=()=>[Sn(),Sn()],Xn=e=>[...e],Yn=([e,t])=>e===t;Sn(ze("-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz".split(j),((e,t)=>[e,t])));const Zn=(e,t,n)=>Mn(e,t,Nn(e,t)==-n?void 0:n),_n=()=>{let e,t,n=!1,s=!1,l=0,a=[];const r=Sn(),o=Sn(),i=Sn(),d=Sn(),c=Sn(),u=Sn(),h=Sn(),m=Sn(),g=Sn(),p=Sn(),b=Sn(),f=Sn(),y=Sn(),I=Sn(),w=Bn(),v=Sn(),C=Sn(),k=Sn(),T=Sn(),x=Un(),S=Un(),q=Un(),N=Un(),V=Un(),M=Un(),L=Un(),R=Un(),E=Un(),z=Un(),$=Un(),A=Un(),F=Un(),J=Un(),O=Un(),P=Un(),D=Un(),B=Un(),H=Un(),Q=Un(),X=Un(),ie=Un(),de=Sn(),ue=Un(),[he,me,ge,pe]=(()=>{let e;const[t,n]=Qn(),s=Sn();return[(n,l,a,r=[],o=()=>[])=>{e??=ln;const i=t(1);return Mn(s,i,[n,l,a,r,o]),Hn(On(l,a??[j],Bn),i),i},(t,n,...l)=>Ee(((e,t=[j])=>{const n=[],s=(e,l)=>l==Ce(t)?Ae(n,e):null===t[l]?Tn(e,(e=>s(e,l+1))):Ee([t[l],null],(t=>s(Nn(e,t),l+1)));return s(e,0),n})(t,n),(t=>Tn(t,(t=>Nn(s,t)[0](e,...n??[],...l))))),e=>fe(Nn(s,e),(([,t,l])=>(On(t,l??[j],void 0,(t=>(xn(t,e),vn(t)?1:0))),Mn(s,e),n(e),l))),t=>fe(Nn(s,t),(([t,,n=[],s,l])=>{const a=(...r)=>{const o=Ce(r);o==Ce(n)?t(e,...r,...l(r)):be(n[o])?Ee(s[o]?.(...r)??[],(e=>a(...r,e))):a(...r,n[o])};a()}))]})(),ke=e=>{if(!Xe(e,((e,t)=>[G,K].includes(t))))return!1;const t=e[G];return!(!ye(t)&&t!=W||(xt(e[K])!=t&&Ge(e,K),0))},Te=we,xe=(t,n)=>(!e||wn(b,n)||mt(n))&&Xe(t,((e,t)=>Se(n,t,e)),(()=>mt(n))),Se=(e,t,n,s)=>Xe(s?n:Me(n,e,t),((s,l)=>fe(qe(e,t,l,s),(e=>(n[l]=e,!0)),(()=>!1))),(()=>mt(e,t))),qe=(t,n,s,l)=>e?fe(Nn(Nn(b,t),s),(e=>xt(l)!=e[G]?mt(t,n,s,l,e[K]):l),(()=>mt(t,n,s,l))):be(xt(l))?mt(t,n,s,l):l,Ne=(e,t)=>Xe(t?e:Le(e),((t,n)=>fe(Ve(n,t),(t=>(e[n]=t,!0)),(()=>!1))),(()=>gt())),Ve=(e,n)=>t?fe(Nn(y,e),(t=>xt(n)!=t[G]?gt(e,n,t[K]):n),(()=>gt(e,n))):be(xt(n))?gt(e,n):n,Me=(e,t,n)=>(fe(Nn(f,t),(([s,l])=>{Tn(s,((t,n)=>{Qe(e,n)||(e[n]=t)})),Tn(l,(s=>{Qe(e,s)||mt(t,n,s)}))})),e),Le=e=>(t&&(Tn(I,((t,n)=>{Qe(e,n)||(e[n]=t)})),Tn(w,(t=>{Qe(e,t)||gt(t)}))),e),$e=e=>Rn(b,e,((e,t,n)=>{const s=Sn(),l=Bn();Rn(Ln(b,t,Sn),n,((e,t,n)=>{Mn(e,t,n),fe(n[K],(e=>Mn(s,t,e)),(()=>Hn(l,t)))})),Mn(f,t,[s,l])}),((e,t)=>{Mn(b,t),Mn(f,t)})),Fe=e=>Rn(y,e,((e,t,n)=>{Mn(y,t,n),fe(n[K],(e=>Mn(I,t,e)),(()=>Hn(w,t)))}),((e,t)=>{Mn(y,t),Mn(I,t),xn(w,t)})),Je=e=>Ue(e)?Ut():Ht(e),Oe=e=>Rn(k,e,((e,t,n)=>Pe(t,n)),((e,t)=>st(t))),Pe=(e,t)=>Rn(Ln(k,e,(()=>(ot(e,1),Mn(v,e,Qn()),Mn(C,e,Sn()),Sn()))),t,((t,n,s)=>De(e,t,n,s)),((t,n)=>lt(e,t,n))),De=(e,t,n,s,l)=>Rn(Ln(t,n,(()=>(it(e,n,1),Sn()))),s,((t,s,l)=>je(e,n,t,s,l)),((s,a)=>at(e,t,n,s,a,l))),je=(e,t,n,s,l)=>{wn(n,s)||dt(e,t,s,1);const a=Nn(n,s);l!==a&&(ct(e,t,s,a,l),Mn(n,s,l))},Be=(e,t,n,s,l)=>fe(Nn(t,n),(t=>je(e,n,t,s,l)),(()=>De(e,t,n,Me({[s]:l},e,n)))),We=e=>Ue(e)?Zt():Wt(e),Ye=e=>Rn(T,e,((e,t,n)=>et(t,n)),((e,t)=>rt(t))),et=(e,t)=>{wn(T,e)||ut(e,1);const n=Nn(T,e);t!==n&&(ht(e,n,t),Mn(T,e,t))},tt=(e,t)=>{const[n]=Nn(v,e),s=n(t);return wn(Nn(k,e),s)?tt(e,t):s},nt=e=>Nn(k,e)??Pe(e,{}),st=e=>Pe(e,{}),lt=(e,t,n)=>{const[,s]=Nn(v,e);s(n),De(e,t,n,{},!0)},at=(e,t,n,s,l,a)=>{const r=Nn(Nn(f,e)?.[0],l);if(!be(r)&&!a)return je(e,n,s,l,r);const o=t=>{ct(e,n,t,Nn(s,t)),dt(e,n,t,-1),Mn(s,t)};be(r)?o(l):Vn(s,o),vn(s)&&(it(e,n,-1),vn(Mn(t,n))&&(ot(e,-1),Mn(k,e),Mn(v,e),Mn(C,e)))},rt=e=>{const t=Nn(I,e);if(!be(t))return et(e,t);ht(e,Nn(T,e)),ut(e,-1),Mn(T,e)},ot=(e,t)=>Zn(r,e,t),it=(e,t,n)=>Zn(Ln(d,e,Sn),t,n)&&Mn(i,e,Ln(i,e,(()=>0))+n),dt=(e,t,n,s)=>{const l=Nn(C,e),a=Nn(l,n)??0;(0==a&&1==s||1==a&&-1==s)&&Zn(Ln(o,e,Sn),n,s),Mn(l,n,a!=-s?a+s:null),Zn(Ln(Ln(c,e,Sn),t,Sn),n,s)},ct=(e,t,n,s,l)=>{Ln(Ln(Ln(u,e,Sn),t,Sn),n,(()=>[s,0]))[1]=l,a[3]?.(e,t,n,l)},ut=(e,t)=>Zn(h,e,t),ht=(e,t,n)=>{Ln(m,e,(()=>[t,0]))[1]=n,a[4]?.(e,n)},mt=(e,t,n,s,l)=>(Ae(Ln(Ln(Ln(g,e,Sn),t,Sn),n,(()=>[])),s),l),gt=(e,t,n)=>(Ae(Ln(p,e,(()=>[])),t),n),pt=(e,t,n)=>fe(Nn(Nn(Nn(u,e),t),n),(([e,t])=>[!0,e,t]),(()=>[!1,...Gn(Et(e,t,n))])),bt=e=>fe(Nn(m,e),(([e,t])=>[!0,e,t]),(()=>[!1,...Gn(At(e))])),ft=e=>vn(g)||vn(P[e])?0:Tn(e?Jn(g):g,((t,n)=>Tn(t,((t,s)=>Tn(t,((t,l)=>me(P[e],[n,s,l],t))))))),yt=e=>vn(p)||vn(D[e])?0:Tn(e?An(p):p,((t,n)=>me(D[e],[n],t))),It=(e,t,n,s)=>{if(!vn(e))return me(t,s,(()=>En(e))),Vn(e,((e,t)=>me(n,[...s??[],e],1==t))),1},wt=e=>{const t=Ft();t!=n&&me(x[e],void 0,t);const s=vn(z[e]),l=vn(F[e])&&vn(J[e])&&vn(E[e])&&vn($[e])&&vn(M[e])&&vn(L[e])&&vn(R[e])&&s&&vn(q[e])&&vn(N[e]),a=vn(O[e])&&vn(A[e])&&vn(V[e])&&vn(S[e]);if(!l||!a){const t=e?[An(r),Fn(o),An(i),Fn(d),Jn(c),Jn(u)]:[r,o,i,d,c,u];if(!l){It(t[0],q[e],N[e]),Tn(t[1],((t,n)=>It(t,M[e],L[e],[n]))),Tn(t[2],((t,n)=>{0!=t&&me(R[e],[n],Vt(n))}));const n=Bn();Tn(t[3],((t,l)=>{It(t,E[e],$[e],[l])&&!s&&(me(z[e],[l,null]),Hn(n,l))})),s||Tn(t[5],((t,s)=>{if(!wn(n,s)){const n=Bn();Tn(t,(e=>Tn(e,(([t,s],l)=>s!==t?Hn(n,l):xn(e,l))))),Tn(n,(t=>me(z[e],[s,t])))}})),Tn(t[4],((t,n)=>Tn(t,((t,s)=>It(t,F[e],J[e],[n,s])))))}if(!a){let n;Tn(t[5],((t,s)=>{let l;Tn(t,((t,a)=>{let r;Tn(t,(([t,o],i)=>{o!==t&&(me(O[e],[s,a,i],o,t,pt),n=l=r=1)})),r&&me(A[e],[s,a],pt)})),l&&me(V[e],[s],pt)})),n&&me(S[e],void 0,pt)}}},vt=e=>{const t=jt();t!=s&&me(B[e],void 0,t);const n=vn(Q[e])&&vn(X[e]),l=vn(ie[e])&&vn(H[e]);if(!n||!l){const t=e?[An(h),An(m)]:[h,m];if(n||It(t[0],Q[e],X[e]),!l){let n;Tn(t[1],(([t,s],l)=>{s!==t&&(me(ie[e],[l],s,t,bt),n=1)})),n&&me(H[e],void 0,bt)}}},Ct=(e,...t)=>(tn((()=>e(...ze(t,ce)))),ln),kt=()=>$n(k),Tt=()=>qn(k),Nt=e=>qn(Nn(C,ce(e))),Vt=e=>bn(Nn(k,ce(e))),Mt=e=>qn(Nn(k,ce(e))),Lt=(e,t,n,s=0,l)=>{return ze(ve(Re((a=Nn(k,ce(e)),r=(e,n)=>[be(t)?n:Nn(e,ce(t)),n],ze([...a?.entries()??[]],(([e,t])=>r(t,e)))),(([e],[t])=>((e??0)<(t??0)?-1:1)*(n?-1:1))),s,be(l)?l:s+l),(([,e])=>e));var a,r},Rt=(e,t)=>qn(Nn(Nn(k,ce(e)),ce(t))),Et=(e,t,n)=>Nn(Nn(Nn(k,ce(e)),ce(t)),ce(n)),zt=()=>En(T),$t=()=>qn(T),At=e=>Nn(T,ce(e)),Ft=()=>!vn(k),Jt=e=>wn(k,ce(e)),Ot=(e,t)=>wn(Nn(C,ce(e)),ce(t)),Pt=(e,t)=>wn(Nn(k,ce(e)),ce(t)),Dt=(e,t,n)=>wn(Nn(Nn(k,ce(e)),ce(t)),ce(n)),jt=()=>!vn(T),Bt=e=>wn(T,ce(e)),Ht=e=>Ct((()=>(e=>Xe(e,xe,mt))(e)?Oe(e):0)),Wt=e=>Ct((()=>Ne(e)?Ye(e):0)),Qt=e=>{try{Je(Ze(e))}catch{}return ln},Gt=t=>Ct((()=>{if((e=Xe(t,(e=>Xe(e,ke))))&&($e(t),!vn(k))){const e=kt();Ut(),Ht(e)}})),Kt=e=>Ct((()=>{if(t=(e=>Xe(e,ke))(e)){const n=zt();en(),Zt(),t=!0,Fe(e),Wt(n)}})),Ut=()=>Ct((()=>Oe({}))),Xt=e=>Ct((e=>wn(k,e)?st(e):0),e),Yt=(e,t)=>Ct(((e,t)=>fe(Nn(k,e),(n=>wn(n,t)?lt(e,n,t):0))),e,t),Zt=()=>Ct((()=>Ye({}))),_t=()=>Ct((()=>{$e({}),e=!1})),en=()=>Ct((()=>{Fe({}),t=!1})),tn=(e,t)=>{if(-1!=l){nn();const n=e();return sn(t),n}},nn=()=>(-1!=l&&l++,1==l&&(a[0]?.(),me(de)),ln),sn=e=>(l>0&&(l--,0==l&&(l=1,ft(1),vn(u)||wt(1),yt(1),vn(m)||vt(1),e?.(ln)&&(Tn(u,((e,t)=>Tn(e,((e,n)=>Tn(e,(([e],s)=>St(ln,t,n,s,e))))))),kn(u),Tn(m,(([e],t)=>qt(ln,t,e))),kn(m)),me(ue[0],void 0),l=-1,ft(0),vn(u)||wt(0),yt(0),vn(m)||vt(0),a[1]?.(),me(ue[1],void 0),a[2]?.(),l=0,n=Ft(),s=jt(),Ee([r,o,i,d,c,u,g,h,m,p],kn))),ln),ln={getContent:()=>[kt(),zt()],getTables:kt,getTableIds:Tt,getTable:e=>zn(Nn(k,ce(e))),getTableCellIds:Nt,getRowCount:Vt,getRowIds:Mt,getSortedRowIds:Lt,getRow:(e,t)=>En(Nn(Nn(k,ce(e)),ce(t))),getCellIds:Rt,getCell:Et,getValues:zt,getValueIds:$t,getValue:At,hasTables:Ft,hasTable:Jt,hasTableCell:Ot,hasRow:Pt,hasCell:Dt,hasValues:jt,hasValue:Bt,getTablesJson:()=>_e(k),getValuesJson:()=>_e(T),getJson:()=>_e([k,T]),getTablesSchemaJson:()=>_e(b),getValuesSchemaJson:()=>_e(y),getSchemaJson:()=>_e([b,y]),hasTablesSchema:()=>e,hasValuesSchema:()=>t,setContent:e=>Ct((()=>Te(e)?(([e,t])=>{(Ue(e)?Ut:Ht)(e),(Ue(t)?Zt:Wt)(t)})(e):0)),setTables:Ht,setTable:(e,t)=>Ct((e=>xe(t,e)?Pe(e,t):0),e),setRow:(e,t,n)=>Ct(((e,t)=>Se(e,t,n)?De(e,nt(e),t,n):0),e,t),addRow:(e,t,n=!0)=>tn((()=>{let s;return Se(e,s,t)&&(e=ce(e),De(e,nt(e),s=tt(e,n?1:0),t)),s})),setPartialRow:(e,t,n)=>Ct(((e,t)=>{if(Se(e,t,n,1)){const s=nt(e);Ke(n,((n,l)=>Be(e,s,t,l,n)))}}),e,t),setCell:(e,t,n,s)=>Ct(((e,t,n)=>fe(qe(e,t,n,Ie(s)?s(Et(e,t,n)):s),(s=>Be(e,nt(e),t,n,s)))),e,t,n),setValues:Wt,setPartialValues:e=>Ct((()=>Ne(e,1)?Ke(e,((e,t)=>et(t,e))):0)),setValue:(e,t)=>Ct((e=>fe(Ve(e,Ie(t)?t(At(e)):t),(t=>et(e,t)))),e),applyChanges:e=>Ct((()=>{Ke(e[0],((e,t)=>be(e)?Xt(t):Ke(e,((e,n)=>be(e)?Yt(t,n):Ke(e,((e,s)=>St(ln,t,n,s,e))))))),Ke(e[1],((e,t)=>qt(ln,t,e)))})),setTablesJson:Qt,setValuesJson:e=>{try{We(Ze(e))}catch{}return ln},setJson:e=>Ct((()=>{try{const[t,n]=Ze(e);Je(t),We(n)}catch{Qt(e)}})),setTablesSchema:Gt,setValuesSchema:Kt,setSchema:(e,t)=>Ct((()=>{Gt(e),Kt(t)})),delTables:Ut,delTable:Xt,delRow:Yt,delCell:(e,t,n,s)=>Ct(((e,t,n)=>fe(Nn(k,e),(l=>fe(Nn(l,t),(a=>wn(a,n)?at(e,l,t,a,n,s):0))))),e,t,n),delValues:Zt,delValue:e=>Ct((e=>wn(T,e)?rt(e):0),e),delTablesSchema:_t,delValuesSchema:en,delSchema:()=>Ct((()=>{_t(),en()})),transaction:tn,startTransaction:nn,getTransactionChanges:()=>[En(u,((e,t)=>-1===Nn(r,t)?void 0:En(e,((e,n)=>-1===Nn(Nn(d,t),n)?void 0:En(e,(([,e])=>e),(e=>Yn(e)))),vn,Ue)),vn,Ue),En(m,(([,e])=>e),(e=>Yn(e))),1],getTransactionLog:()=>[!vn(u),!vn(m),$n(u,Xn,Yn),$n(g),En(m,Xn,Yn),En(p),En(r),zn(d),$n(c),En(h)],finishTransaction:sn,forEachTable:e=>Tn(k,((t,n)=>e(n,(e=>Tn(t,((t,n)=>e(n,(e=>Vn(t,e))))))))),forEachTableCell:(e,t)=>Vn(Nn(C,ce(e)),t),forEachRow:(e,t)=>Tn(Nn(k,ce(e)),((e,n)=>t(n,(t=>Vn(e,t))))),forEachCell:(e,t,n)=>Vn(Nn(Nn(k,ce(e)),ce(t)),n),forEachValue:e=>Vn(T,e),addSortedRowIdsListener:(e,t,n,s,l,a,r)=>{let o=Lt(e,t,n,s,l);return he((()=>{const r=Lt(e,t,n,s,l);var i,d,c;d=o,Ce(i=r)===Ce(d)&&(c=(e,t)=>d[t]===e,i.every(c))||(o=r,a(ln,e,t,n,s,l,o))}),z[r?1:0],[e,t],[Tt])},addStartTransactionListener:e=>he(e,de),addWillFinishTransactionListener:e=>he(e,ue[0]),addDidFinishTransactionListener:e=>he(e,ue[1]),callListener:e=>(pe(e),ln),delListener:e=>(ge(e),ln),getListenerStats:()=>({hasTables:Kn(x),tables:Kn(S),tableIds:Kn(q),hasTable:Kn(N),table:Kn(V),tableCellIds:Kn(M),hasTableCell:Kn(L,yn),rowCount:Kn(R),rowIds:Kn(E),sortedRowIds:Kn(z),hasRow:Kn($,yn),row:Kn(A,yn),cellIds:Kn(F,yn),hasCell:Kn(J,In),cell:Kn(O,In),invalidCell:Kn(P,In),hasValues:Kn(B),values:Kn(H),valueIds:Kn(Q),hasValue:Kn(X),value:Kn(ie),invalidValue:Kn(D),transaction:fn(de)+Kn(ue)}),isMergeable:()=>!1,createStore:_n,addListener:he,callListeners:me,setInternalListeners:(e,t,n,s,l)=>a=[e,t,n,s,l]};return Ke({[U+Z]:[0,x,[],()=>[Ft()]],[Z]:[0,S],[_]:[0,q],[U+Y]:[1,N,[Tt],e=>[Jt(...e)]],[Y]:[1,V,[Tt]],[Y+le]:[1,M,[Tt]],[U+Y+se]:[2,L,[Tt,Nt],e=>[Ot(...e)]],[te]:[1,R,[Tt]],[ne]:[1,E,[Tt]],[U+ee]:[2,$,[Tt,Mt],e=>[Pt(...e)]],[ee]:[2,A,[Tt,Mt]],[le]:[2,F,[Tt,Mt]],[U+se]:[3,J,[Tt,Mt,Rt],e=>[Dt(...e)]],[se]:[3,O,[Tt,Mt,Rt],e=>Gn(Et(...e))],InvalidCell:[3,P],[U+re]:[0,B,[],()=>[jt()]],[re]:[0,H],[oe]:[0,Q],[U+ae]:[1,X,[$t],e=>[Bt(...e)]],[ae]:[1,ie,[$t],e=>Gn(At(e[0]))],InvalidValue:[1,D]},(([e,t,n,s],l)=>{ln["add"+l+"Listener"]=(...l)=>he(l[e],t[l[e+1]?1:0],e>0?ve(l,0,e):void 0,n,s)})),He(ln)},es=({position:e="right",open:t=!1})=>{const n=O(_n),s=nt.indexOf(e);return P(n,(e=>{return t=et,n=sessionStorage,((e,t,n,s,l,a,r,o={},i=[])=>{let d,c,u,h=0,m=0,g=0;Ln(Pn,i,(()=>0)),Ln(Dn,i,(()=>[]));const[p,b,f,y,I]=((e=1,t)=>1!=e&&t.isMergeable()?[1,t.getMergeableContent,t.getTransactionMergeableChanges,([[e],[t]])=>!Ue(e)||!Ue(t),t.setDefaultContent]:2!=e?[0,t.getContent,t.getTransactionChanges,([e,t])=>!Ue(e)||!Ue(t),t.setContent]:ke("Store type not supported by this Persister"))(r,e),w=t=>{(p&&we(t?.[0])?1===t?.[2]?e.applyMergeableChanges:e.setMergeableContent:1===t?.[2]?e.applyChanges:e.setContent)(t)},v=async e=>(2!=h&&(h=1,m++,await x((async()=>{try{const e=await t();we(e)?w(e):ke("Content is not an array "+e)}catch(t){e&&I(e)}h=0}))),S),C=()=>(c&&(l(c),c=void 0),S),k=async e=>(1!=h&&(h=2,g++,await x((async()=>{try{await n(b,e)}catch(e){}h=0}))),S),T=()=>(fe(u,e.delListener),u=void 0,S),x=async(...e)=>(Ae(Nn(Dn,i),...e),await(async()=>{if(!Nn(Pn,i)){for(Mn(Pn,i,1);!be(d=Fe(Nn(Dn,i)));)try{await d()}catch(e){}Mn(Pn,i,0)}})(),S),S={load:v,startAutoLoad:async e=>{await C().load(e);try{c=await s((async(e,t)=>{t||e?2!=h&&(h=1,m++,w(t??e),h=0):await v()}))}catch(e){}return S},stopAutoLoad:C,isAutoLoading:()=>!be(c),save:k,startAutoSave:async()=>(await T().save(),u=e.addDidFinishTransactionListener((()=>{const e=f();y(e)&&k(e)})),S),stopAutoSave:T,isAutoSaving:()=>!be(u),schedule:x,getStore:()=>e,destroy:()=>(Nn(Dn,i).splice(0,void 0),C().stopAutoSave()),getStats:()=>({loads:m,saves:g}),...o};return He(S)})(e,(async()=>{return e=n.getItem(t),Ze(e,((e,t)=>""===t?void 0:t));var e}),(async e=>{return n.setItem(t,(s=e(),Ye(s,((e,t)=>void 0===t?"":t))));var s}),(e=>{const s=s=>{if(s.storageArea===n&&s.key===t)try{e(Ze(s.newValue))}catch{e()}};return ue.addEventListener(jn,s),s}),(e=>ue.removeEventListener(jn,e)),0,3,{getStorageName:()=>t});var t,n}),void 0,(async e=>{await e.load([{},{position:-1==s?1:s,open:!!t}]),await e.startAutoSave()})),Se(xe,null,Se("aside",{id:et},Se(kt,{s:n}),Se(gn,{s:n})),Se("style",null,Ct))};export{es as Inspector};
|
|
1
|
+
import e from"react";import{useCell as t,useValue as n,useSetValueCallback as s,useSetCellCallback as l,useValueIds as a,ValueView as r,useStoreOrStoreById as o,useRowCount as i,useSortedRowIds as d,useTableCellIds as c,useIndexesOrIndexesById as u,useSliceRowIds as h,useRelationshipsOrRelationshipsById as m,useRowIds as g,useResultRowCount as p,useResultSortedRowIds as b,useResultTableCellIds as f,useRemoteRowId as y,CellView as I,ResultCellView as w,useIndexes as v,useIndexIds as C,useSliceIds as k,useMetrics as T,useMetricIds as x,useMetric as S,useQueries as q,useQueryIds as N,useRelationships as V,useRelationshipIds as M,useStore as L,useTableIds as R,useValues as E,useStoreIds as z,useMetricsIds as $,useIndexesIds as A,useRelationshipsIds as F,useQueriesIds as J,useCreateStore as O,useCreatePersister as P}from"../../ui-react/with-schemas/index.js";const D=e=>typeof e,j="",B=D(j),H=D(!0),W=D(0),Q=D(D),G="type",K="default",U="Has",X="Ids",Y="Table",Z=Y+"s",_=Y+X,ee="Row",te=ee+"Count",ne=ee+X,se="Cell",le=se+X,ae="Value",re=ae+"s",oe=ae+X,ie="currentTarget",de="value",ce=e=>j+e,ue=globalThis.window,he=Math,me=he.min,ge=he.floor,pe=isFinite,be=e=>null==e,fe=(e,t,n)=>be(e)?n?.():t(e),ye=e=>e==B||e==H,Ie=e=>D(e)==Q,we=e=>Array.isArray(e),ve=(e,t,n)=>e.slice(t,n),Ce=e=>e.length,ke=e=>{throw Error(e)},{PureComponent:Te,Fragment:xe,createElement:Se,useCallback:qe,useLayoutEffect:Ne,useRef:Ve,useState:Me}=e,Le=(e,...t)=>be(e)?{}:e(...t),Re=(e,t)=>e.sort(t),Ee=(e,t)=>e.forEach(t),ze=(e,t)=>e.map(t),$e=e=>0==Ce(e),Ae=(e,...t)=>e.push(...t),Fe=e=>e.shift(),Je=Object,Oe=e=>Je.getPrototypeOf(e),Pe=Je.entries,De=Je.isFrozen,je=e=>!be(e)&&fe(Oe(e),(e=>e==Je.prototype||be(Oe(e))),(()=>!0)),Be=Je.keys,He=Je.freeze,We=(e=[])=>Je.fromEntries(e),Qe=(e,t)=>t in e,Ge=(e,t)=>(delete e[t],e),Ke=(e,t)=>ze(Pe(e),(([e,n])=>t(n,e))),Ue=e=>je(e)&&0==(e=>Ce(Be(e)))(e),Xe=(e,t,n,s=0)=>be(e)||!je(e)||!s&&Ue(e)||De(e)?(n?.(),!1):(Ke(e,((n,s)=>{t(n,s)||Ge(e,s)})),!!s||!Ue(e)),Ye=JSON.stringify,Ze=JSON.parse,_e=e=>Ye(e,((e,t)=>t instanceof Map?Je.fromEntries([...t]):t)),et="tinybaseInspector",tt="TinyBase Inspector",nt=["left","top","bottom","right","full"],st="state",lt="sort",at="open",rt="position",ot=at,it="editable",dt=(...e)=>_e(e),ct=(e,t)=>ze(Re([...e]),t),ut=(e,n)=>[!!t(st,e,it,n),qe((t=>{n.setCell(st,e,it,(e=>!e)),t.preventDefault()}),[n,e])],ht="M20 80l5-15l40-40l10 10l-40 40l-15 5m5-15l10 10",mt='content:url("',gt=mt+"data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' stroke-width='4' stroke='white' fill='none'>",pt='</svg>")',bt=mt+"data:image/svg+xml,%3csvg viewBox='0 0 680 680' xmlns='http://www.w3.org/2000/svg' style='width:680px%3bheight:680px'%3e %3cpath stroke='white' stroke-width='80' fill='none' d='M340 617a84 241 90 11.01 0zM131 475a94 254 70 10428-124 114 286 70 01-428 124zm0-140a94 254 70 10428-124 114 286 70 01-428 124zm-12-127a94 254 70 00306 38 90 260 90 01-306-38zm221 3a74 241 90 11.01 0z' /%3e %3cpath fill='%23d81b60' d='M131 475a94 254 70 10428-124 114 286 70 01-428 124zm0-140a94 254 70 10428-124 114 286 70 01-428 124z' /%3e %3cpath d='M249 619a94 240 90 00308-128 114 289 70 01-308 128zM119 208a94 254 70 00306 38 90 260 90 01-306-38zm221 3a74 241 90 11.01 0z' /%3e%3c/svg%3e\")",ft=ze([[20,20,20,60],[20,20,60,20],[20,60,60,20],[60,20,20,60],[30,30,40,40]],(([e,t,n,s])=>gt+`<rect x='20' y='20' width='60' height='60' fill='grey'/><rect x='${e}' y='${t}' width='${n}' height='${s}' fill='white'/>`+pt)),yt=gt+"<path d='M20 20l60 60M20 80l60-60' />"+pt,It=gt+`<path d='${ht}' />`+pt,wt=gt+`<path d='${ht}M20 20l60 60' />`+pt,vt="*::-webkit-scrollbar",Ct=((e,t="")=>e.join(t))(Ke({"":"all:initial;font-family:sans-serif;font-size:0.75rem;position:fixed;z-index:999999","*":"all:revert","*::before":"all:revert","*::after":"all:revert",[vt]:"width:0.5rem;height:0.5rem;",[vt+"-track"]:"background:#111",[vt+"-thumb"]:"background:#999;border:1px solid #111",[vt+"-thumb:hover"]:"background:#fff",[vt+"-corner"]:"background:#111",img:"width:1rem;height:1rem;background:#111;border:0;vertical-align:text-bottom",">img":"padding:0.25rem;bottom:0;right:0;position:fixed;"+bt,...We(ze(["bottom:0;left:0","top:0;right:0"],((e,t)=>[`>img[data-position='${t}']`,e]))),main:"display:flex;flex-direction:column;background:#111d;color:#fff;position:fixed;",...We(ze(["bottom:0;left:0;width:35vw;height:100vh","top:0;right:0;width:100vw;height:30vh","bottom:0;left:0;width:100vw;height:30vh","top:0;right:0;width:35vw;height:100vh","top:0;right:0;width:100vw;height:100vh"],((e,t)=>[`main[data-position='${t}']`,e]))),header:"display:flex;padding:0.25rem;background:#000;align-items:center","header>img:nth-of-type(1)":bt,"header>img:nth-of-type(6)":yt,...We(ze(ft,((e,t)=>[`header>img[data-id='${t}']`,e]))),"header>span":"flex:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;margin-left:0.25rem",article:"padding:0.25rem 0.25rem 0.25rem 0.5rem;overflow:auto;flex:1",details:"margin-left:0.75rem;width:fit-content;","details img":"display:none","details[open]>summary img":"display:unset;background:none;margin-left:0.25rem","details[open]>summary img.edit":It,"details[open]>summary img.done":wt,summary:"margin-left:-0.75rem;line-height:1.25rem;user-select:none;width:fit-content",table:"border-collapse:collapse;table-layout:fixed;margin-bottom:0.5rem","table input":"background:#111;color:unset;padding:0 0.25rem;border:0;font-size:unset;vertical-align:top;margin:0",'table input[type="number"]':"width:4rem","table tbody button":"font-size:0;background:#fff;border-radius:50%;margin:0 0.125rem 0 0;width:0.85rem;color:#111","table button:first-letter":"font-size:0.75rem",thead:"background:#222","th:nth-of-type(1)":"min-width:2rem;","th.sorted":"background:#000","table caption":"text-align:left;white-space:nowrap;line-height:1.25rem",button:"width:1.5rem;border:none;background:none;color:#fff;padding:0","button[disabled]":"color:#777","button.next":"margin-right:0.5rem",[`th,#${et} td`]:"overflow:hidden;text-overflow:ellipsis;padding:0.25rem 0.5rem;max-width:12rem;white-space:nowrap;border-width:1px 0;border-style:solid;border-color:#777;text-align:left","span.warn":"margin:0.25rem;color:#d81b60"},((e,t)=>e?`#${et} ${t}{${e}}`:""))),kt=({s:e})=>{const t=n(rt,e)??1,l=s(ot,(()=>!0),[],e);return n(ot,e)?null:Se("img",{onClick:l,title:tt,"data-position":t})},Tt=({uniqueId:e,summary:n,editable:s,handleEditable:a,children:r,s:o})=>{const i=!!t(st,e,at,o),d=l(st,e,at,(e=>e[ie].open),[],o);return Se("details",{open:i,onToggle:d},Se("summary",null,n,a?Se("img",{onClick:a,className:s?"done":"edit"}):null),r)},xt=e=>{const t=D(e);return ye(t)||t==W&&pe(e)?t:void 0},St=(e,t,n,s,l)=>be(l)?e.delCell(t,n,s,!0):e.setCell(t,n,s,l),qt=(e,t,n)=>be(n)?e.delValue(t):e.setValue(t,n),Nt=(e,t,n,s)=>e==B?t:e==W?n:s,{useCallback:Vt,useMemo:Mt,useState:Lt}=e,Rt="editable",Et=(e,t)=>ze(c(e,t),(t=>e+"."+t)),zt=(e,t,n)=>{const s=Vt(e,t);return n?s:void 0},$t=(...e)=>Mt((()=>e),e),At=(e,t)=>Mt((()=>({store:e,tableId:t})),[e,t]),Ft=(e,t)=>Mt((()=>({queries:e,queryId:t})),[e,t]),Jt=(e,t=!1,n,s=0,l,a,r,o)=>{const[[i,d,c],u]=Lt([e,t,s]),h=Vt((e=>{u(e),o?.(e)}),[o]),m=zt((e=>h([e,e==i&&!d,c])),[h,i,d,c],n),g=Vt((e=>h([i,d,e])),[h,i,d]),p=!0===r?Yt:r;return[[i,d,c],m,Mt((()=>!1===r?null:Se(p,{offset:c,limit:l,total:a,onChange:g})),[r,p,c,l,a,g])]},Ot=(e,t,n)=>Mt((()=>{const s=t??e;return l=we(s)?We(ze(s,(e=>[e,e]))):s,a=(e,t)=>{return{label:t,component:n,...(s=e,D(s)==B?{label:e}:e)};var s},We(Ke(l,((e,t)=>[t,a(e,t)])));var l,a}),[t,n,e]),Pt=({className:e,headerRow:t,idColumn:n,params:[s,l,a,r,o,i]})=>Se("table",{className:e},i?Se("caption",null,i):null,!1===t?null:Se("thead",null,Se("tr",null,!1===n?null:Se(Dt,{sort:r??[],label:"Id",onClick:o}),Ke(s,(({label:e},t)=>Se(Dt,{key:t,cellId:t,label:e,sort:r??[],onClick:o}))))),Se("tbody",null,ze(a,(e=>Se("tr",{key:e},!1===n?null:Se("th",null,e),Ke(s,(({component:t,getComponentProps:n},s)=>Se("td",{key:s},Se(t,{...Le(n,e,s),...l,rowId:e,cellId:s}))))))))),Dt=({cellId:e,sort:[t,n],label:s=e??j,onClick:l})=>Se("th",{onClick:zt((()=>l?.(e)),[l,e],l),className:be(n)||t!=e?void 0:`sorted ${n?"de":"a"}scending`},be(n)||t!=e?null:(n?"↓":"↑")+" ",s),jt=({localRowId:t,params:[n,s,l,a,r,o,i]})=>{const d=y(r,t,o);return Se("tr",null,!1===n?null:Se(e.Fragment,null,Se("th",null,t),Se("th",null,d)),Ke(s,(({component:e,getComponentProps:n},s)=>{const[r,o]=s.split(".",2),c=r===l?t:r===a?d:null;return be(c)?null:Se("td",{key:s},Se(e,{...Le(n,c,o),store:i,tableId:r,rowId:c,cellId:o}))})))},Bt=({thing:e,onThingChange:t,className:n,hasSchema:s,showType:l=!0})=>{const[a,r]=Lt(),[o,i]=Lt(),[d,c]=Lt(),[u,h]=Lt(),[m,g]=Lt();o!==e&&(r(xt(e)),i(e),c(e+""),h(Number(e)||0),g(!!e));const p=Vt(((e,n)=>{n(e),i(e),t(e)}),[t]),b=Vt((()=>{if(!s?.()){const e=Nt(a,W,H,B),n=Nt(e,d,u,m);r(e),i(n),t(n)}}),[s,t,d,u,m,a]);return Se("div",{className:n},l?Se("button",{className:a,onClick:b},a):null,Nt(a,Se("input",{key:a,value:d,onChange:Vt((e=>p(e[ie][de]+"",c)),[p])}),Se("input",{key:a,type:"number",value:u,onChange:Vt((e=>p(Number(e[ie][de]||0),h)),[p])}),Se("input",{key:a,type:"checkbox",checked:m,onChange:Vt((e=>p(!!e[ie].checked,g)),[p])})))},Ht=({tableId:e,cellId:t,descending:n,offset:s,limit:l,store:a,editable:r,sortOnClick:o,paginator:u=!1,onChange:h,customCells:m,...g})=>{const[p,b,f]=Jt(t,n,o,s,l,i(e,a),u,h);return Se(Pt,{...g,params:$t(Ot(c(e,a),m,r?Ut:I),At(a,e),d(e,...p,l,a),p,b,f)})},Wt=({store:e,editable:t=!1,valueComponent:n=(t?Xt:r),getValueComponentProps:s,className:l,headerRow:o,idColumn:i})=>Se("table",{className:l},!1===o?null:Se("thead",null,Se("tr",null,!1===i?null:Se("th",null,"Id"),Se("th",null,ae))),Se("tbody",null,ze(a(e),(t=>Se("tr",{key:t},!1===i?null:Se("th",null,t),Se("td",null,Se(n,{...Le(s,t),valueId:t,store:e}))))))),Qt=({indexId:e,sliceId:t,indexes:n,editable:s,customCells:l,...a})=>{const[r,o,i]=((e,t)=>[e,e?.getStore(),e?.getTableId(t)])(u(n),e);return Se(Pt,{...a,params:$t(Ot(c(i,o),l,s?Ut:I),At(o,i),h(e,t,r))})},Gt=({relationshipId:t,relationships:n,editable:s,customCells:l,className:a,headerRow:r,idColumn:o=!0})=>{const[i,d,c,u]=((e,t)=>[e,e?.getStore(),e?.getLocalTableId(t),e?.getRemoteTableId(t)])(m(n),t),h=Ot([...Et(c,d),...Et(u,d)],l,s?Ut:I),p=$t(o,h,c,u,t,i,d);return Se("table",{className:a},!1===r?null:Se("thead",null,Se("tr",null,!1===o?null:Se(e.Fragment,null,Se("th",null,c,".Id"),Se("th",null,u,".Id")),Ke(h,(({label:e},t)=>Se("th",{key:t},e))))),Se("tbody",null,ze(g(c,d),(e=>Se(jt,{key:e,localRowId:e,params:p})))))},Kt=({queryId:e,cellId:t,descending:n,offset:s,limit:l,queries:a,sortOnClick:r,paginator:o=!1,customCells:i,onChange:d,...c})=>{const[u,h,m]=Jt(t,n,r,s,l,p(e,a),o,d);return Se(Pt,{...c,params:$t(Ot(f(e,a),i,w),Ft(a,e),b(e,...u,l,a),u,h,m)})},Ut=({tableId:e,rowId:n,cellId:s,store:a,className:r,showType:i})=>Se(Bt,{thing:t(e,n,s,a),onThingChange:l(e,n,s,(e=>e),[],a),className:r??Rt+se,showType:i,hasSchema:o(a)?.hasTablesSchema}),Xt=({valueId:e,store:t,className:l,showType:a})=>Se(Bt,{thing:n(e,t),onThingChange:s(e,(e=>e),[],t),className:l??Rt+ae,showType:a,hasSchema:o(t)?.hasValuesSchema}),Yt=({onChange:t,total:n,offset:s=0,limit:l=n,singular:a="row",plural:r=a+"s"})=>{(s>n||s<0)&&(s=0,t(0));const o=zt((()=>t(s-l)),[t,s,l],s>0),i=zt((()=>t(s+l)),[t,s,l],s+l<n);return Se(e.Fragment,null,n>l&&Se(e.Fragment,null,Se("button",{className:"previous",disabled:0==s,onClick:o},"←"),Se("button",{className:"next",disabled:s+l>=n,onClick:i},"→"),s+1," to ",me(n,s+l)," of "),n," ",1!=n?r:a)},Zt=({indexes:e,indexesId:t,indexId:n,s:s})=>Se(Tt,{uniqueId:dt("i",t,n),summary:"Index: "+n,s:s},ze(k(n,e),(l=>Se(_t,{indexes:e,indexesId:t,indexId:n,sliceId:l,s:s,key:l})))),_t=({indexes:e,indexesId:t,indexId:n,sliceId:s,s:l})=>{const a=dt("i",t,n,s),[r,o]=ut(a,l);return Se(Tt,{uniqueId:a,summary:"Slice: "+s,editable:r,handleEditable:o,s:l},Se(Qt,{sliceId:s,indexId:n,indexes:e,editable:r}))},en=({indexesId:e,s:t})=>{const n=v(e),s=C(n);return be(n)?null:Se(Tt,{uniqueId:dt("i",e),summary:"Indexes: "+(e??K),s:t},$e(s)?"No indexes defined":ct(s,(s=>Se(Zt,{indexes:n,indexesId:e,indexId:s,s:t,key:s}))))},tn=({metrics:e,metricId:t})=>Se("tr",null,Se("th",null,t),Se("td",null,e?.getTableId(t)),Se("td",null,S(t,e))),nn=({metricsId:e,s:t})=>{const n=T(e),s=x(n);return be(n)?null:Se(Tt,{uniqueId:dt("m",e),summary:"Metrics: "+(e??K),s:t},$e(s)?"No metrics defined":Se("table",null,Se("thead",null,Se("th",null,"Metric Id"),Se("th",null,"Table Id"),Se("th",null,"Metric")),Se("tbody",null,ze(s,(e=>Se(tn,{metrics:n,metricId:e,key:e}))))))},sn=({queries:e,queriesId:n,queryId:s,s:a})=>{const r=dt("q",n,s),[o,i,d]=Ze(t(st,r,lt,a)??"[]"),c=l(st,r,lt,_e,[],a);return Se(Tt,{uniqueId:r,summary:"Query: "+s,s:a},Se(Kt,{queryId:s,queries:e,cellId:o,descending:i,offset:d,limit:10,paginator:!0,sortOnClick:!0,onChange:c}))},ln=({queriesId:e,s:t})=>{const n=q(e),s=N(n);return be(n)?null:Se(Tt,{uniqueId:dt("q",e),summary:"Queries: "+(e??K),s:t},$e(s)?"No queries defined":ct(s,(s=>Se(sn,{queries:n,queriesId:e,queryId:s,s:t,key:s}))))},an=({relationships:e,relationshipsId:t,relationshipId:n,s:s})=>{const l=dt("r",t,n),[a,r]=ut(l,s);return Se(Tt,{uniqueId:l,summary:"Relationship: "+n,editable:a,handleEditable:r,s:s},Se(Gt,{relationshipId:n,relationships:e,editable:a}))},rn=({relationshipsId:e,s:t})=>{const n=V(e),s=M(n);return be(n)?null:Se(Tt,{uniqueId:dt("r",e),summary:"Relationships: "+(e??K),s:t},$e(s)?"No relationships defined":ct(s,(s=>Se(an,{relationships:n,relationshipsId:e,relationshipId:s,s:t,key:s}))))},on=({tableId:e,store:n,storeId:s,s:a})=>{const r=dt("t",s,e),[o,i,d]=Ze(t(st,r,lt,a)??"[]"),c=l(st,r,lt,_e,[],a),[u,h]=ut(r,a);return Se(Tt,{uniqueId:r,summary:Y+": "+e,editable:u,handleEditable:h,s:a},Se(Ht,{tableId:e,store:n,cellId:o,descending:i,offset:d,limit:10,paginator:!0,sortOnClick:!0,onChange:c,editable:u}))},dn=({store:e,storeId:t,s:n})=>{const s=dt("v",t),[l,r]=ut(s,n);return $e(a(e))?null:Se(Tt,{uniqueId:s,summary:re,editable:l,handleEditable:r,s:n},Se(Wt,{store:e,editable:l}))},cn=({storeId:e,s:t})=>{const n=L(e),s=R(n);return be(n)?null:Se(Tt,{uniqueId:dt("s",e),summary:(n.isMergeable()?"Mergeable":"")+"Store: "+(e??K),s:t},Se(dn,{storeId:e,store:n,s:t}),ct(s,(s=>Se(on,{store:n,storeId:e,tableId:s,s:t,key:s}))))},un=({s:e})=>{const t=Ve(null),n=Ve(0),[s,l]=Me(!1),{scrollLeft:a,scrollTop:r}=E(e);Ne((()=>{const e=t.current;if(e&&!s){const t=new MutationObserver((()=>{e.scrollWidth>=ge(a)+e.clientWidth&&e.scrollHeight>=ge(r)+e.clientHeight&&e.scrollTo(a,r)}));return t.observe(e,{childList:!0,subtree:!0}),()=>t.disconnect()}}),[s,a,r]);const o=qe((t=>{const{scrollLeft:s,scrollTop:a}=t[ie];cancelIdleCallback(n.current),n.current=requestIdleCallback((()=>{l(!0),e.setPartialValues({scrollLeft:s,scrollTop:a})}))}),[e]),i=L(),d=z(),c=T(),u=$(),h=v(),m=A(),g=V(),p=F(),b=q(),f=J();return be(i)&&$e(d)&&be(c)&&$e(u)&&be(h)&&$e(m)&&be(g)&&$e(p)&&be(b)&&$e(f)?Se("span",{className:"warn"},"There are no Stores or other objects to inspect. Make sure you placed the Inspector inside a Provider component."):Se("article",{ref:t,onScroll:o},Se(cn,{s:e}),ze(d,(t=>Se(cn,{storeId:t,s:e,key:t}))),Se(nn,{s:e}),ze(u,(t=>Se(nn,{metricsId:t,s:e,key:t}))),Se(en,{s:e}),ze(m,(t=>Se(en,{indexesId:t,s:e,key:t}))),Se(rn,{s:e}),ze(p,(t=>Se(rn,{relationshipsId:t,s:e,key:t}))),Se(ln,{s:e}),ze(f,(t=>Se(ln,{queriesId:t,s:e,key:t}))))};class hn extends Te{constructor(e){super(e),this.state={e:0}}static getDerivedStateFromError(){return{e:1}}componentDidCatch=(e,t)=>console.error(e,t.componentStack);render(){return this.state.e?Se("span",{className:"warn"},"Inspector error: please see console for details."):this.props.children}}const mn=({s:e})=>{const t=n(rt,e)??1,l=s(ot,(()=>!1),[],e),a=s(rt,(e=>Number(e[ie].dataset.id)),[],e);return Se("header",null,Se("img",{title:tt}),Se("span",null,tt),ze(nt,((e,n)=>n==t?null:Se("img",{onClick:a,"data-id":n,title:"Dock to "+e,key:n}))),Se("img",{onClick:l,title:"Close"}))},gn=({s:e})=>{const t=n(rt,e)??1;return n(ot,e)?Se("main",{"data-position":t},Se(mn,{s:e}),Se(hn,null,Se(un,{s:e}))):null},pn=e=>t=>{return n=(t,n)=>t+e(n),Cn(t).reduce(n,0);var n},bn=e=>e?.size??0,fn=pn(bn),yn=pn(fn),In=pn(yn),wn=(e,t)=>e?.has(t)??!1,vn=e=>be(e)||0==bn(e),Cn=e=>[...e?.values()??[]],kn=e=>e.clear(),Tn=(e,t)=>e?.forEach(t),xn=(e,t)=>e?.delete(t),Sn=e=>new Map(e),qn=e=>[...e?.keys()??[]],Nn=(e,t)=>e?.get(t),Vn=(e,t)=>Tn(e,((e,n)=>t(n,e))),Mn=(e,t,n)=>be(n)?(xn(e,t),e):e?.set(t,n),Ln=(e,t,n,s)=>(wn(e,t)?s?.(Nn(e,t)):Mn(e,t,n()),Nn(e,t)),Rn=(e,t,n,s=Mn)=>(Ke(t,((t,s)=>n(e,s,t))),Vn(e,(n=>Qe(t,n)?0:s(e,n))),e),En=(e,t,n,s)=>{const l={};return Tn(e,((e,a)=>{if(!n?.(e,a)){const n=t?t(e,a):e;s?.(n)||(l[a]=n)}})),l},zn=(e,t,n)=>En(e,(e=>En(e,t,n)),vn,Ue),$n=(e,t,n)=>En(e,(e=>zn(e,t,n)),vn,Ue),An=(e,t)=>{const n=Sn();return Tn(e,((e,s)=>n.set(s,t?.(e)??e))),n},Fn=e=>An(e,An),Jn=e=>An(e,Fn),On=(e,t,n,s,l=0)=>fe((n?Ln:Nn)(e,t[l],l>Ce(t)-2?n:Sn),(a=>{if(l>Ce(t)-2)return s?.(a)&&Mn(e,t[l]),a;const r=On(a,t,n,s,l+1);return vn(a)&&Mn(e,t[l]),r})),Pn=Sn(),Dn=Sn(),jn="storage",Bn=e=>new Set(we(e)||be(e)?e:[e]),Hn=(e,t)=>e?.add(t),Wn=/^\d+$/,Qn=()=>{const e=[];let t=0;return[n=>(n?Fe(e):null)??j+t++,t=>{Wn.test(t)&&Ce(e)<1e3&&Ae(e,t)}]},Gn=e=>[e,e],Kn=(e,t=fn)=>t(e[0])+t(e[1]),Un=()=>[Sn(),Sn()],Xn=e=>[...e],Yn=([e,t])=>e===t;Sn(ze("-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz".split(j),((e,t)=>[e,t])));const Zn=(e,t,n)=>Mn(e,t,Nn(e,t)==-n?void 0:n),_n=()=>{let e,t,n=!1,s=!1,l=0,a=[];const r=Sn(),o=Sn(),i=Sn(),d=Sn(),c=Sn(),u=Sn(),h=Sn(),m=Sn(),g=Sn(),p=Sn(),b=Sn(),f=Sn(),y=Sn(),I=Sn(),w=Bn(),v=Sn(),C=Sn(),k=Sn(),T=Sn(),x=Un(),S=Un(),q=Un(),N=Un(),V=Un(),M=Un(),L=Un(),R=Un(),E=Un(),z=Un(),$=Un(),A=Un(),F=Un(),J=Un(),O=Un(),P=Un(),D=Un(),B=Un(),H=Un(),Q=Un(),X=Un(),ie=Un(),de=Sn(),ue=Un(),[he,me,ge,pe]=(()=>{let e;const[t,n]=Qn(),s=Sn();return[(n,l,a,r=[],o=()=>[])=>{e??=ln;const i=t(1);return Mn(s,i,[n,l,a,r,o]),Hn(On(l,a??[j],Bn),i),i},(t,n,...l)=>Ee(((e,t=[j])=>{const n=[],s=(e,l)=>l==Ce(t)?Ae(n,e):null===t[l]?Tn(e,(e=>s(e,l+1))):Ee([t[l],null],(t=>s(Nn(e,t),l+1)));return s(e,0),n})(t,n),(t=>Tn(t,(t=>Nn(s,t)[0](e,...n??[],...l))))),e=>fe(Nn(s,e),(([,t,l])=>(On(t,l??[j],void 0,(t=>(xn(t,e),vn(t)?1:0))),Mn(s,e),n(e),l))),t=>fe(Nn(s,t),(([t,,n=[],s,l])=>{const a=(...r)=>{const o=Ce(r);o==Ce(n)?t(e,...r,...l(r)):be(n[o])?Ee(s[o]?.(...r)??[],(e=>a(...r,e))):a(...r,n[o])};a()}))]})(),ke=e=>{if(!Xe(e,((e,t)=>[G,K].includes(t))))return!1;const t=e[G];return!(!ye(t)&&t!=W||(xt(e[K])!=t&&Ge(e,K),0))},Te=we,xe=(t,n)=>(!e||wn(b,n)||mt(n))&&Xe(t,((e,t)=>Se(n,t,e)),(()=>mt(n))),Se=(e,t,n,s)=>Xe(s?n:Me(n,e,t),((s,l)=>fe(qe(e,t,l,s),(e=>(n[l]=e,!0)),(()=>!1))),(()=>mt(e,t))),qe=(t,n,s,l)=>e?fe(Nn(Nn(b,t),s),(e=>xt(l)!=e[G]?mt(t,n,s,l,e[K]):l),(()=>mt(t,n,s,l))):be(xt(l))?mt(t,n,s,l):l,Ne=(e,t)=>Xe(t?e:Le(e),((t,n)=>fe(Ve(n,t),(t=>(e[n]=t,!0)),(()=>!1))),(()=>gt())),Ve=(e,n)=>t?fe(Nn(y,e),(t=>xt(n)!=t[G]?gt(e,n,t[K]):n),(()=>gt(e,n))):be(xt(n))?gt(e,n):n,Me=(e,t,n)=>(fe(Nn(f,t),(([s,l])=>{Tn(s,((t,n)=>{Qe(e,n)||(e[n]=t)})),Tn(l,(s=>{Qe(e,s)||mt(t,n,s)}))})),e),Le=e=>(t&&(Tn(I,((t,n)=>{Qe(e,n)||(e[n]=t)})),Tn(w,(t=>{Qe(e,t)||gt(t)}))),e),$e=e=>Rn(b,e,((e,t,n)=>{const s=Sn(),l=Bn();Rn(Ln(b,t,Sn),n,((e,t,n)=>{Mn(e,t,n),fe(n[K],(e=>Mn(s,t,e)),(()=>Hn(l,t)))})),Mn(f,t,[s,l])}),((e,t)=>{Mn(b,t),Mn(f,t)})),Fe=e=>Rn(y,e,((e,t,n)=>{Mn(y,t,n),fe(n[K],(e=>Mn(I,t,e)),(()=>Hn(w,t)))}),((e,t)=>{Mn(y,t),Mn(I,t),xn(w,t)})),Je=e=>Ue(e)?Ut():Ht(e),Oe=e=>Rn(k,e,((e,t,n)=>Pe(t,n)),((e,t)=>st(t))),Pe=(e,t)=>Rn(Ln(k,e,(()=>(ot(e,1),Mn(v,e,Qn()),Mn(C,e,Sn()),Sn()))),t,((t,n,s)=>De(e,t,n,s)),((t,n)=>lt(e,t,n))),De=(e,t,n,s,l)=>Rn(Ln(t,n,(()=>(it(e,n,1),Sn()))),s,((t,s,l)=>je(e,n,t,s,l)),((s,a)=>at(e,t,n,s,a,l))),je=(e,t,n,s,l)=>{wn(n,s)||dt(e,t,s,1);const a=Nn(n,s);l!==a&&(ct(e,t,s,a,l),Mn(n,s,l))},Be=(e,t,n,s,l)=>fe(Nn(t,n),(t=>je(e,n,t,s,l)),(()=>De(e,t,n,Me({[s]:l},e,n)))),We=e=>Ue(e)?Zt():Wt(e),Ye=e=>Rn(T,e,((e,t,n)=>et(t,n)),((e,t)=>rt(t))),et=(e,t)=>{wn(T,e)||ut(e,1);const n=Nn(T,e);t!==n&&(ht(e,n,t),Mn(T,e,t))},tt=(e,t)=>{const[n]=Nn(v,e),s=n(t);return wn(Nn(k,e),s)?tt(e,t):s},nt=e=>Nn(k,e)??Pe(e,{}),st=e=>Pe(e,{}),lt=(e,t,n)=>{const[,s]=Nn(v,e);s(n),De(e,t,n,{},!0)},at=(e,t,n,s,l,a)=>{const r=Nn(Nn(f,e)?.[0],l);if(!be(r)&&!a)return je(e,n,s,l,r);const o=t=>{ct(e,n,t,Nn(s,t)),dt(e,n,t,-1),Mn(s,t)};be(r)?o(l):Vn(s,o),vn(s)&&(it(e,n,-1),vn(Mn(t,n))&&(ot(e,-1),Mn(k,e),Mn(v,e),Mn(C,e)))},rt=e=>{const t=Nn(I,e);if(!be(t))return et(e,t);ht(e,Nn(T,e)),ut(e,-1),Mn(T,e)},ot=(e,t)=>Zn(r,e,t),it=(e,t,n)=>Zn(Ln(d,e,Sn),t,n)&&Mn(i,e,Ln(i,e,(()=>0))+n),dt=(e,t,n,s)=>{const l=Nn(C,e),a=Nn(l,n)??0;(0==a&&1==s||1==a&&-1==s)&&Zn(Ln(o,e,Sn),n,s),Mn(l,n,a!=-s?a+s:null),Zn(Ln(Ln(c,e,Sn),t,Sn),n,s)},ct=(e,t,n,s,l)=>{Ln(Ln(Ln(u,e,Sn),t,Sn),n,(()=>[s,0]))[1]=l,a[3]?.(e,t,n,l)},ut=(e,t)=>Zn(h,e,t),ht=(e,t,n)=>{Ln(m,e,(()=>[t,0]))[1]=n,a[4]?.(e,n)},mt=(e,t,n,s,l)=>(Ae(Ln(Ln(Ln(g,e,Sn),t,Sn),n,(()=>[])),s),l),gt=(e,t,n)=>(Ae(Ln(p,e,(()=>[])),t),n),pt=(e,t,n)=>fe(Nn(Nn(Nn(u,e),t),n),(([e,t])=>[!0,e,t]),(()=>[!1,...Gn(Et(e,t,n))])),bt=e=>fe(Nn(m,e),(([e,t])=>[!0,e,t]),(()=>[!1,...Gn(At(e))])),ft=e=>vn(g)||vn(P[e])?0:Tn(e?Jn(g):g,((t,n)=>Tn(t,((t,s)=>Tn(t,((t,l)=>me(P[e],[n,s,l],t))))))),yt=e=>vn(p)||vn(D[e])?0:Tn(e?An(p):p,((t,n)=>me(D[e],[n],t))),It=(e,t,n,s)=>{if(!vn(e))return me(t,s,(()=>En(e))),Vn(e,((e,t)=>me(n,[...s??[],e],1==t))),1},wt=e=>{const t=Ft();t!=n&&me(x[e],void 0,t);const s=vn(z[e]),l=vn(F[e])&&vn(J[e])&&vn(E[e])&&vn($[e])&&vn(M[e])&&vn(L[e])&&vn(R[e])&&s&&vn(q[e])&&vn(N[e]),a=vn(O[e])&&vn(A[e])&&vn(V[e])&&vn(S[e]);if(!l||!a){const t=e?[An(r),Fn(o),An(i),Fn(d),Jn(c),Jn(u)]:[r,o,i,d,c,u];if(!l){It(t[0],q[e],N[e]),Tn(t[1],((t,n)=>It(t,M[e],L[e],[n]))),Tn(t[2],((t,n)=>{0!=t&&me(R[e],[n],Vt(n))}));const n=Bn();Tn(t[3],((t,l)=>{It(t,E[e],$[e],[l])&&!s&&(me(z[e],[l,null]),Hn(n,l))})),s||Tn(t[5],((t,s)=>{if(!wn(n,s)){const n=Bn();Tn(t,(e=>Tn(e,(([t,s],l)=>s!==t?Hn(n,l):xn(e,l))))),Tn(n,(t=>me(z[e],[s,t])))}})),Tn(t[4],((t,n)=>Tn(t,((t,s)=>It(t,F[e],J[e],[n,s])))))}if(!a){let n;Tn(t[5],((t,s)=>{let l;Tn(t,((t,a)=>{let r;Tn(t,(([t,o],i)=>{o!==t&&(me(O[e],[s,a,i],o,t,pt),n=l=r=1)})),r&&me(A[e],[s,a],pt)})),l&&me(V[e],[s],pt)})),n&&me(S[e],void 0,pt)}}},vt=e=>{const t=jt();t!=s&&me(B[e],void 0,t);const n=vn(Q[e])&&vn(X[e]),l=vn(ie[e])&&vn(H[e]);if(!n||!l){const t=e?[An(h),An(m)]:[h,m];if(n||It(t[0],Q[e],X[e]),!l){let n;Tn(t[1],(([t,s],l)=>{s!==t&&(me(ie[e],[l],s,t,bt),n=1)})),n&&me(H[e],void 0,bt)}}},Ct=(e,...t)=>(tn((()=>e(...ze(t,ce)))),ln),kt=()=>$n(k),Tt=()=>qn(k),Nt=e=>qn(Nn(C,ce(e))),Vt=e=>bn(Nn(k,ce(e))),Mt=e=>qn(Nn(k,ce(e))),Lt=(e,t,n,s=0,l)=>{return ze(ve(Re((a=Nn(k,ce(e)),r=(e,n)=>[be(t)?n:Nn(e,ce(t)),n],ze([...a?.entries()??[]],(([e,t])=>r(t,e)))),(([e],[t])=>((e??0)<(t??0)?-1:1)*(n?-1:1))),s,be(l)?l:s+l),(([,e])=>e));var a,r},Rt=(e,t)=>qn(Nn(Nn(k,ce(e)),ce(t))),Et=(e,t,n)=>Nn(Nn(Nn(k,ce(e)),ce(t)),ce(n)),zt=()=>En(T),$t=()=>qn(T),At=e=>Nn(T,ce(e)),Ft=()=>!vn(k),Jt=e=>wn(k,ce(e)),Ot=(e,t)=>wn(Nn(C,ce(e)),ce(t)),Pt=(e,t)=>wn(Nn(k,ce(e)),ce(t)),Dt=(e,t,n)=>wn(Nn(Nn(k,ce(e)),ce(t)),ce(n)),jt=()=>!vn(T),Bt=e=>wn(T,ce(e)),Ht=e=>Ct((()=>(e=>Xe(e,xe,mt))(e)?Oe(e):0)),Wt=e=>Ct((()=>Ne(e)?Ye(e):0)),Qt=e=>{try{Je(Ze(e))}catch{}return ln},Gt=t=>Ct((()=>{if((e=Xe(t,(e=>Xe(e,ke))))&&($e(t),!vn(k))){const e=kt();Ut(),Ht(e)}})),Kt=e=>Ct((()=>{if(t=(e=>Xe(e,ke))(e)){const n=zt();en(),Zt(),t=!0,Fe(e),Wt(n)}})),Ut=()=>Ct((()=>Oe({}))),Xt=e=>Ct((e=>wn(k,e)?st(e):0),e),Yt=(e,t)=>Ct(((e,t)=>fe(Nn(k,e),(n=>wn(n,t)?lt(e,n,t):0))),e,t),Zt=()=>Ct((()=>Ye({}))),_t=()=>Ct((()=>{$e({}),e=!1})),en=()=>Ct((()=>{Fe({}),t=!1})),tn=(e,t)=>{if(-1!=l){nn();const n=e();return sn(t),n}},nn=()=>(-1!=l&&l++,1==l&&(a[0]?.(),me(de)),ln),sn=e=>(l>0&&(l--,0==l&&(l=1,ft(1),vn(u)||wt(1),yt(1),vn(m)||vt(1),e?.(ln)&&(Tn(u,((e,t)=>Tn(e,((e,n)=>Tn(e,(([e],s)=>St(ln,t,n,s,e))))))),kn(u),Tn(m,(([e],t)=>qt(ln,t,e))),kn(m)),me(ue[0],void 0),l=-1,ft(0),vn(u)||wt(0),yt(0),vn(m)||vt(0),a[1]?.(),me(ue[1],void 0),a[2]?.(),l=0,n=Ft(),s=jt(),Ee([r,o,i,d,c,u,g,h,m,p],kn))),ln),ln={getContent:()=>[kt(),zt()],getTables:kt,getTableIds:Tt,getTable:e=>zn(Nn(k,ce(e))),getTableCellIds:Nt,getRowCount:Vt,getRowIds:Mt,getSortedRowIds:Lt,getRow:(e,t)=>En(Nn(Nn(k,ce(e)),ce(t))),getCellIds:Rt,getCell:Et,getValues:zt,getValueIds:$t,getValue:At,hasTables:Ft,hasTable:Jt,hasTableCell:Ot,hasRow:Pt,hasCell:Dt,hasValues:jt,hasValue:Bt,getTablesJson:()=>_e(k),getValuesJson:()=>_e(T),getJson:()=>_e([k,T]),getTablesSchemaJson:()=>_e(b),getValuesSchemaJson:()=>_e(y),getSchemaJson:()=>_e([b,y]),hasTablesSchema:()=>e,hasValuesSchema:()=>t,setContent:e=>Ct((()=>Te(e)?(([e,t])=>{(Ue(e)?Ut:Ht)(e),(Ue(t)?Zt:Wt)(t)})(e):0)),setTables:Ht,setTable:(e,t)=>Ct((e=>xe(t,e)?Pe(e,t):0),e),setRow:(e,t,n)=>Ct(((e,t)=>Se(e,t,n)?De(e,nt(e),t,n):0),e,t),addRow:(e,t,n=!0)=>tn((()=>{let s;return Se(e,s,t)&&(e=ce(e),De(e,nt(e),s=tt(e,n?1:0),t)),s})),setPartialRow:(e,t,n)=>Ct(((e,t)=>{if(Se(e,t,n,1)){const s=nt(e);Ke(n,((n,l)=>Be(e,s,t,l,n)))}}),e,t),setCell:(e,t,n,s)=>Ct(((e,t,n)=>fe(qe(e,t,n,Ie(s)?s(Et(e,t,n)):s),(s=>Be(e,nt(e),t,n,s)))),e,t,n),setValues:Wt,setPartialValues:e=>Ct((()=>Ne(e,1)?Ke(e,((e,t)=>et(t,e))):0)),setValue:(e,t)=>Ct((e=>fe(Ve(e,Ie(t)?t(At(e)):t),(t=>et(e,t)))),e),applyChanges:e=>Ct((()=>{Ke(e[0],((e,t)=>be(e)?Xt(t):Ke(e,((e,n)=>be(e)?Yt(t,n):Ke(e,((e,s)=>St(ln,t,n,s,e))))))),Ke(e[1],((e,t)=>qt(ln,t,e)))})),setTablesJson:Qt,setValuesJson:e=>{try{We(Ze(e))}catch{}return ln},setJson:e=>Ct((()=>{try{const[t,n]=Ze(e);Je(t),We(n)}catch{Qt(e)}})),setTablesSchema:Gt,setValuesSchema:Kt,setSchema:(e,t)=>Ct((()=>{Gt(e),Kt(t)})),delTables:Ut,delTable:Xt,delRow:Yt,delCell:(e,t,n,s)=>Ct(((e,t,n)=>fe(Nn(k,e),(l=>fe(Nn(l,t),(a=>wn(a,n)?at(e,l,t,a,n,s):0))))),e,t,n),delValues:Zt,delValue:e=>Ct((e=>wn(T,e)?rt(e):0),e),delTablesSchema:_t,delValuesSchema:en,delSchema:()=>Ct((()=>{_t(),en()})),transaction:tn,startTransaction:nn,getTransactionChanges:()=>[En(u,((e,t)=>-1===Nn(r,t)?void 0:En(e,((e,n)=>-1===Nn(Nn(d,t),n)?void 0:En(e,(([,e])=>e),(e=>Yn(e)))),vn,Ue)),vn,Ue),En(m,(([,e])=>e),(e=>Yn(e))),1],getTransactionLog:()=>[!vn(u),!vn(m),$n(u,Xn,Yn),$n(g),En(m,Xn,Yn),En(p),En(r),zn(d),$n(c),En(h)],finishTransaction:sn,forEachTable:e=>Tn(k,((t,n)=>e(n,(e=>Tn(t,((t,n)=>e(n,(e=>Vn(t,e))))))))),forEachTableCell:(e,t)=>Vn(Nn(C,ce(e)),t),forEachRow:(e,t)=>Tn(Nn(k,ce(e)),((e,n)=>t(n,(t=>Vn(e,t))))),forEachCell:(e,t,n)=>Vn(Nn(Nn(k,ce(e)),ce(t)),n),forEachValue:e=>Vn(T,e),addSortedRowIdsListener:(e,t,n,s,l,a,r)=>{let o=Lt(e,t,n,s,l);return he((()=>{const r=Lt(e,t,n,s,l);var i,d,c;d=o,Ce(i=r)===Ce(d)&&(c=(e,t)=>d[t]===e,i.every(c))||(o=r,a(ln,e,t,n,s,l,o))}),z[r?1:0],[e,t],[Tt])},addStartTransactionListener:e=>he(e,de),addWillFinishTransactionListener:e=>he(e,ue[0]),addDidFinishTransactionListener:e=>he(e,ue[1]),callListener:e=>(pe(e),ln),delListener:e=>(ge(e),ln),getListenerStats:()=>({hasTables:Kn(x),tables:Kn(S),tableIds:Kn(q),hasTable:Kn(N),table:Kn(V),tableCellIds:Kn(M),hasTableCell:Kn(L,yn),rowCount:Kn(R),rowIds:Kn(E),sortedRowIds:Kn(z),hasRow:Kn($,yn),row:Kn(A,yn),cellIds:Kn(F,yn),hasCell:Kn(J,In),cell:Kn(O,In),invalidCell:Kn(P,In),hasValues:Kn(B),values:Kn(H),valueIds:Kn(Q),hasValue:Kn(X),value:Kn(ie),invalidValue:Kn(D),transaction:fn(de)+Kn(ue)}),isMergeable:()=>!1,createStore:_n,addListener:he,callListeners:me,setInternalListeners:(e,t,n,s,l)=>a=[e,t,n,s,l]};return Ke({[U+Z]:[0,x,[],()=>[Ft()]],[Z]:[0,S],[_]:[0,q],[U+Y]:[1,N,[Tt],e=>[Jt(...e)]],[Y]:[1,V,[Tt]],[Y+le]:[1,M,[Tt]],[U+Y+se]:[2,L,[Tt,Nt],e=>[Ot(...e)]],[te]:[1,R,[Tt]],[ne]:[1,E,[Tt]],[U+ee]:[2,$,[Tt,Mt],e=>[Pt(...e)]],[ee]:[2,A,[Tt,Mt]],[le]:[2,F,[Tt,Mt]],[U+se]:[3,J,[Tt,Mt,Rt],e=>[Dt(...e)]],[se]:[3,O,[Tt,Mt,Rt],e=>Gn(Et(...e))],InvalidCell:[3,P],[U+re]:[0,B,[],()=>[jt()]],[re]:[0,H],[oe]:[0,Q],[U+ae]:[1,X,[$t],e=>[Bt(...e)]],[ae]:[1,ie,[$t],e=>Gn(At(e[0]))],InvalidValue:[1,D]},(([e,t,n,s],l)=>{ln["add"+l+"Listener"]=(...l)=>he(l[e],t[l[e+1]?1:0],e>0?ve(l,0,e):void 0,n,s)})),He(ln)},es=({position:e="right",open:t=!1})=>{const n=O(_n),s=nt.indexOf(e);return P(n,(e=>{return t=et,n=sessionStorage,((e,t,n,s,l,a,r,o={},i=[])=>{let d,c,u,h=0,m=0,g=0;Ln(Pn,i,(()=>0)),Ln(Dn,i,(()=>[]));const[p,b,f,y,I]=((e=1,t)=>1!=e&&t.isMergeable()?[1,t.getMergeableContent,t.getTransactionMergeableChanges,([[e],[t]])=>!Ue(e)||!Ue(t),t.setDefaultContent]:2!=e?[0,t.getContent,t.getTransactionChanges,([e,t])=>!Ue(e)||!Ue(t),t.setContent]:ke("Store type not supported by this Persister"))(r,e),w=t=>{(p&&we(t?.[0])?1===t?.[2]?e.applyMergeableChanges:e.setMergeableContent:1===t?.[2]?e.applyChanges:e.setContent)(t)},v=async e=>(2!=h&&(h=1,m++,await x((async()=>{try{const e=await t();we(e)?w(e):ke("Content is not an array "+e)}catch(t){e&&I(e)}h=0}))),S),C=()=>(c&&(l(c),c=void 0),S),k=async e=>(1!=h&&(h=2,g++,await x((async()=>{try{await n(b,e)}catch(e){}h=0}))),S),T=()=>(fe(u,e.delListener),u=void 0,S),x=async(...e)=>(Ae(Nn(Dn,i),...e),await(async()=>{if(!Nn(Pn,i)){for(Mn(Pn,i,1);!be(d=Fe(Nn(Dn,i)));)try{await d()}catch(e){}Mn(Pn,i,0)}})(),S),S={load:v,startAutoLoad:async e=>{await C().load(e);try{c=await s((async(e,t)=>{t||e?2!=h&&(h=1,m++,w(t??e),h=0):await v()}))}catch(e){}return S},stopAutoLoad:C,isAutoLoading:()=>!be(c),save:k,startAutoSave:async()=>(await T().save(),u=e.addDidFinishTransactionListener((()=>{const e=f();y(e)&&k(e)})),S),stopAutoSave:T,isAutoSaving:()=>!be(u),schedule:x,getStore:()=>e,destroy:()=>(Nn(Dn,i).splice(0,void 0),C().stopAutoSave()),getStats:()=>({loads:m,saves:g}),...o};return He(S)})(e,(async()=>{return e=n.getItem(t),Ze(e,((e,t)=>""===t?void 0:t));var e}),(async e=>{return n.setItem(t,(s=e(),Ye(s,((e,t)=>void 0===t?"":t))));var s}),(e=>{const s=s=>{if(s.storageArea===n&&s.key===t)try{e(Ze(s.newValue))}catch{e()}};return ue.addEventListener(jn,s),s}),(e=>ue.removeEventListener(jn,e)),0,3,{getStorageName:()=>t});var t,n}),void 0,(async e=>{await e.load([{},{position:-1==s?1:s,open:!!t}]),await e.startAutoSave()})),Se(xe,null,Se("aside",{id:et},Se(kt,{s:n}),Se(gn,{s:n})),Se("style",null,Ct))};export{es as Inspector};
|
|
Binary file
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<section id="hero"><h2 id="the-reactive-data-store-for-local-first-apps">The <em>reactive</em> data store for <span>local-first apps</span>.</h2></section><p><a href="https://beta.tinybase.org/guides/releases/#v5-
|
|
1
|
+
<section id="hero"><h2 id="the-reactive-data-store-for-local-first-apps">The <em>reactive</em> data store for <span>local-first apps</span>.</h2></section><p><a href="https://beta.tinybase.org/guides/releases/#v5-3"><em>NEW!</em> v5.3 release</a></p><p><span id="one-with">"Adding some missing APIs!"</span></p><p><a class="start" href="https://beta.tinybase.org/guides/the-basics/getting-started/">Get started</a></p><p><a href="https://beta.tinybase.org/demos/">Try the demos</a></p><p><a href="https://beta.tinybase.org/api/store/interfaces/store/store/">Read the docs</a></p><hr><section><h2 id="it-s-reactive">It's <em>Reactive</em></h2><p>TinyBase lets you <a href="#register-granular-listeners">listen to changes</a> made to any part of your data. This means your app will be fast, since you only spend rendering cycles on things that change. The optional <a href="#call-hooks-to-bind-to-data">bindings to React</a> and <a href="#pre-built-reactive-components">pre-built components</a> let you easily build fully reactive UIs on top of TinyBase. You even get a built-in <a href="#set-checkpoints-for-an-undo-stack">undo stack</a>, and <a href="#an-inspector-for-your-data">developer tools</a>!</p></section><section><h2 id="it-s-database-like">It's <em>Database-Like</em></h2><p>Consumer app? Enterprise app? Or even a game? Model <a href="#start-with-a-simple-key-value-store">key-value data</a> and <a href="#level-up-to-use-tabular-data">tabular data</a> with optional typed <a href="#apply-schemas-to-tables-values">schematization</a>, whatever its data structures. There are built-in <a href="#create-indexes-for-fast-lookups">indexing</a>, <a href="#define-metrics-and-aggregations">metric aggregation</a>, and tabular <a href="#model-table-relationships">relationships</a> APIs - and a powerful <a href="#build-complex-queries-with-tinyql">query engine</a> to select, join, filter, and group data (reactively!) without SQL.</p></section><section><h2 id="it-synchronizes">It <em>Synchronizes</em></h2><p>TinyBase has <a href="#synchronize-between-devices">native CRDT</a> support, meaning that you can deterministically <a href="https://beta.tinybase.org/guides/synchronization/">synchronize</a> and merge data across multiple sources, clients, and servers. And although TinyBase is an in-memory data store, you can easily <a href="#persist-to-storage-databases-more">persist</a> your data to file, <a href="https://beta.tinybase.org/api/persister-browser">browser storage</a>, <a href="https://beta.tinybase.org/api/persister-indexed-db">IndexedDB</a>, <a href="https://beta.tinybase.org/guides/persistence/database-persistence/">SQLite or PostgreSQL databases</a>, and <a href="https://beta.tinybase.org/guides/persistence/third-party-crdt-persistence/">more</a>.</p></section><section><h2 id="it-s-built-for-a-local-first-world">It's Built For A <em>Local-First</em> World</h2><p>TinyBase works anywhere that JavaScript does, but it's especially great for local-first apps: where data is stored locally on the user's device and that can be run offline. It's tiny by name, tiny by nature: just <a href="#did-we-say-tiny">5.3kB - 11.4kB</a> and with no dependencies - yet <a href="#well-tested-and-documented">100% tested</a>, <a href="https://beta.tinybase.org/guides/the-basics/getting-started/">fully documented</a>, and of course, <a href="https://github.com/tinyplex/tinybase">open source</a>!</p></section><hr><section id="friends"><h2 id="tinybase-works-great-on-its-own-but-also-plays-well-with-friends">TinyBase works great on its own, but also plays well with friends!</h2><div><a href="https://beta.tinybase.org/guides/building-uis/getting-started-with-ui-react"><img width="48" src="https://beta.tinybase.org/react.svg"> React</a></div><div><a href="https://beta.tinybase.org/api/persister-indexed-db/functions/creation/createindexeddbpersister"><img width="48" src="https://beta.tinybase.org/indexeddb.svg"> IndexedDB</a></div><div><a href="https://beta.tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://beta.tinybase.org/postgresql.svg"> PostgreSQL</a></div><div><a href="https://beta.tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://beta.tinybase.org/pglite.svg"> PGlite</a></div><div><a href="https://beta.tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://beta.tinybase.org/sqlite.svg"> SQLite</a></div><div><a href="https://beta.tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://beta.tinybase.org/expo.svg"> Expo SQLite</a></div><div><a href="https://beta.tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://beta.tinybase.org/electric.svg"> ElectricSQL</a></div><div><a href="https://beta.tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://beta.tinybase.org/turso.svg"> Turso</a></div><div><a href="https://beta.tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://beta.tinybase.org/powersync.svg"> PowerSync</a></div><div><a href="https://beta.tinybase.org/api/persister-partykit-client"><img width="48" src="https://beta.tinybase.org/partykit.svg"> PartyKit</a></div><div><a href="https://beta.tinybase.org/api/persister-yjs/functions/creation/createyjspersister"><img width="48" src="https://beta.tinybase.org/yjs.svg"> YJS</a></div><div><a href="https://beta.tinybase.org/api/persister-cr-sqlite-wasm"><img width="48" src="https://beta.tinybase.org/crsqlite.png"> CR-SQLite</a></div><div><a href="https://beta.tinybase.org/api/persister-automerge"><img width="48" src="https://beta.tinybase.org/automerge.svg"> Automerge</a></div></section><hr><section id="follow"><a href="https://github.com/tinyplex/tinybase" target="_blank"><img src="https://img.shields.io/github/stars/tinyplex/tinybase?style=for-the-badge&logo=GitHub&logoColor=%23fff&label=GitHub&labelColor=%23d81b60&color=%23333"> </a><a href="https://discord.com/invite/mGz3mevwP8" target="_blank"><img src="https://img.shields.io/discord/1027918215323590676?style=for-the-badge&logo=discord&logoColor=%23fff&label=Discord&labelColor=%233131e8&color=%23333"> </a><a href="https://twitter.com/tinybasejs" target="_blank"><img src="https://img.shields.io/twitter/follow/tinybasejs?style=for-the-badge&logo=x&logoColor=%23fff&label=Twitter&labelColor=%23333&color=%23333"></a><br><a href="https://github.com/tinyplex/tinybase/discussions" target="_blank"><img src="https://img.shields.io/github/discussions/tinyplex/tinybase?style=for-the-badge&logo=GitHub&logoColor=%23fff&label=Ideas&labelColor=%23d81b60&color=%23333"> </a><a href="https://github.com/tinyplex/tinybase/issues" target="_blank"><img src="https://img.shields.io/github/issues/tinyplex/tinybase?style=for-the-badge&logo=GitHub&logoColor=%23fff&label=Issues&labelColor=%23d81b60&color=%23333"> </a><a href="#well-tested-and-documented"><img src="https://img.shields.io/badge/Tests-100%25-green?style=for-the-badge&logo=jest&logoColor=%23fff&color=%23333&labelColor=%2387c305"> </a><a href="https://www.npmjs.com/package/tinybase/v/5.3.0-beta.1" target="_blank"><img src="https://img.shields.io/npm/v/tinybase?style=for-the-badge&logo=npm&logoColor=%23fff&labelColor=%23bd0005&color=%23333"></a></section><hr><section><h2 id="start-with-a-simple-key-value-store">Start with a simple key-value store.</h2><p>Creating a <a href="https://beta.tinybase.org/api/store/interfaces/store/store/"><code>Store</code></a> requires just a simple call to the <a href="https://beta.tinybase.org/api/store/functions/creation/createstore/"><code>createStore</code></a> function. Once you have one, you can easily set <a href="https://beta.tinybase.org/api/store/type-aliases/store/values/"><code>Values</code></a> in it by unique <a href="https://beta.tinybase.org/api/common/type-aliases/identity/id/"><code>Id</code></a>. And of course you can easily get them back out again.</p><p>Read more about using keyed value data in <a href="https://beta.tinybase.org/guides/the-basics/">The Basics</a> guide.</p></section>
|
|
2
2
|
|
|
3
3
|
```js
|
|
4
4
|
import {createStore} from 'tinybase';
|
|
@@ -294,4 +294,4 @@ export const createShop: typeof createShopDecl = () => {
|
|
|
294
294
|
};
|
|
295
295
|
```
|
|
296
296
|
|
|
297
|
-
<section><h2 id="did-we-say-tiny">Did we say tiny?</h2><p>If you use the basic <a href="https://beta.tinybase.org/api/store/"><code>store</code></a> module alone, you'll only add a gzipped <em>5.3kB</em> to your app. Incrementally add the other modules as you need more functionality, or get it all for <em>11.4kB</em>.</p><p>The optional <a href="https://beta.tinybase.org/api/ui-react/"><code>ui-react</code></a> module is just <em>4.8kB</em>, the ui-react-dom components are another <em>2.5kB</em>, and everything is super fast. Life's easy when you have zero dependencies!</p><p>Read more about how TinyBase is structured and packaged in the <a href="https://beta.tinybase.org/guides/how-tinybase-is-built/architecture/">Architecture</a> guide.</p></section><div class="table"><table class="fixed"><tbody><tr><th> </th><th>Minified .js.gz</th><th>Source .js</th></tr><tr><th class="right"><a href="https://beta.tinybase.org/api/store/">tinybase/store</a> (minimal)</th><td>5.3kB</td><td>52.6kB</td></tr><tr><th class="right">tinybase (complete)</th><td>11.4kB</td><td>118.8kB</td></tr><tr><th class="right"><a href="https://beta.tinybase.org/api/ui-react/">ui-react</a></th><td>4.8kB</td><td>49.9kB</td></tr><tr><th class="right"><a href="https://beta.tinybase.org/api/ui-react-dom/">ui-react-dom</a></th><td>2.5kB</td><td>20.4kB</td></tr></tbody></table></div><section><h2 id="well-tested-and-documented">Well tested and documented.</h2><p>TinyBase has <em>100.0%</em> test coverage, including the code throughout the documentation - even on this page! The guides, demos, and API examples are designed to make it as easy as possible for you to get your TinyBase-powered app up and running.</p><p>Read more about how TinyBase is tested in the Unit <a href="https://beta.tinybase.org/guides/how-tinybase-is-built/testing/">Testing</a> guide.</p></section><div class="table"><table class="fixed"><tbody><tr><th width="30%"> </th><th>Total</th><th>Tested</th><th>Coverage</th></tr><tr><th class="right">Lines</th><td>2,244</td><td>2,244</td><td>100.0%</td></tr><tr><th class="right">Statements</th><td>2,423</td><td>2,423</td><td>100.0%</td></tr><tr><th class="right">Functions</th><td>968</td><td>968</td><td>100.0%</td></tr><tr><th class="right">Branches</th><td>862</td><td>862</td><td>100.0%</td></tr><tr><th class="right">Tests</th><td colspan="3">7,347</td></tr><tr><th class="right">Assertions</th><td colspan="3">32,970</td></tr></tbody></table></div><hr><section id="sponsors"><h2 id="proud-to-be-sponsored-by">Proud to be sponsored by:</h2><a href="https://github.com/cpojer" target="_blank"><img title="cpojer" src="https://github.com/cpojer.png?size=48" width="48" height="48"></a><a href="https://github.com/expo" target="_blank"><img title="expo" src="https://github.com/expo.png?size=48" width="48" height="48"></a><a href="https://github.com/beekeeb" target="_blank"><img title="beekeeb" src="https://github.com/beekeeb.png?size=48" width="48" height="48"></a><a href="https://github.com/cancelself" target="_blank"><img title="cancelself" src="https://github.com/cancelself.png?size=48" width="48" height="48"></a><a href="https://github.com/WonderPanda" target="_blank"><img title="WonderPanda" src="https://github.com/WonderPanda.png?size=48" width="48" height="48"></a><a href="https://github.com/arpitBhalla" target="_blank"><img title="arpitBhalla" src="https://github.com/arpitBhalla.png?size=48" width="48" height="48"></a></section><section id="users"><h2 id="excited-to-be-used-by">Excited to be used by:</h2><a href="https://github.com/Apocalypsor" target="_blank"><img title="Apocalypsor" src="https://github.com/Apocalypsor.png?size=48" width="48" height="48"></a><a href="https://github.com/brentvatne" target="_blank"><img title="brentvatne" src="https://github.com/brentvatne.png?size=48" width="48" height="48"></a><a href="https://github.com/byCedric" target="_blank"><img title="byCedric" src="https://github.com/byCedric.png?size=48" width="48" height="48"></a><a href="https://github.com/circadian-risk" target="_blank"><img title="circadian-risk" src="https://github.com/circadian-risk.png?size=48" width="48" height="48"></a><a href="https://github.com/cpojer" target="_blank"><img title="cpojer" src="https://github.com/cpojer.png?size=48" width="48" height="48"></a><a href="https://github.com/cubecull" target="_blank"><img title="cubecull" src="https://github.com/cubecull.png?size=48" width="48" height="48"></a><a href="https://github.com/erwinkn" target="_blank"><img title="erwinkn" src="https://github.com/erwinkn.png?size=48" width="48" height="48"></a><a href="https://github.com/expo" target="_blank"><img title="expo" src="https://github.com/expo.png?size=48" width="48" height="48"></a><a href="https://github.com/ezra-en" target="_blank"><img title="ezra-en" src="https://github.com/ezra-en.png?size=48" width="48" height="48"></a><a href="https://github.com/fdfontes" target="_blank"><img title="fdfontes" src="https://github.com/fdfontes.png?size=48" width="48" height="48"></a><a href="https://github.com/feychenie" target="_blank"><img title="feychenie" src="https://github.com/feychenie.png?size=48" width="48" height="48"></a><a href="https://github.com/flaming-codes" target="_blank"><img title="flaming-codes" src="https://github.com/flaming-codes.png?size=48" width="48" height="48"></a><a href="https://github.com/fostertheweb" target="_blank"><img title="fostertheweb" src="https://github.com/fostertheweb.png?size=48" width="48" height="48"></a><a href="https://github.com/generates" target="_blank"><img title="generates" src="https://github.com/generates.png?size=48" width="48" height="48"></a><a href="https://github.com/Giulio987" target="_blank"><img title="Giulio987" src="https://github.com/Giulio987.png?size=48" width="48" height="48"></a><a href="https://github.com/itsdevcoffee" target="_blank"><img title="itsdevcoffee" src="https://github.com/itsdevcoffee.png?size=48" width="48" height="48"></a><a href="https://github.com/jaysc" target="_blank"><img title="jaysc" src="https://github.com/jaysc.png?size=48" width="48" height="48"></a><a href="https://github.com/jbolda" target="_blank"><img title="jbolda" src="https://github.com/jbolda.png?size=48" width="48" height="48"></a><a href="https://github.com/Kayoo-asso" target="_blank"><img title="Kayoo-asso" src="https://github.com/Kayoo-asso.png?size=48" width="48" height="48"></a><a href="https://github.com/kotofurumiya" target="_blank"><img title="kotofurumiya" src="https://github.com/kotofurumiya.png?size=48" width="48" height="48"></a><a href="https://github.com/Kudo" target="_blank"><img title="Kudo" src="https://github.com/Kudo.png?size=48" width="48" height="48"></a><a href="https://github.com/learn-anything" target="_blank"><img title="learn-anything" src="https://github.com/learn-anything.png?size=48" width="48" height="48"></a><a href="https://github.com/lluc" target="_blank"><img title="lluc" src="https://github.com/lluc.png?size=48" width="48" height="48"></a><a href="https://github.com/marksteve" target="_blank"><img title="marksteve" src="https://github.com/marksteve.png?size=48" width="48" height="48"></a><a href="https://github.com/miking-the-viking" target="_blank"><img title="miking-the-viking" src="https://github.com/miking-the-viking.png?size=48" width="48" height="48"></a><a href="https://github.com/mjamesderocher" target="_blank"><img title="mjamesderocher" src="https://github.com/mjamesderocher.png?size=48" width="48" height="48"></a><a href="https://github.com/mouktardev" target="_blank"><img title="mouktardev" src="https://github.com/mouktardev.png?size=48" width="48" height="48"></a><a href="https://github.com/nickmessing" target="_blank"><img title="nickmessing" src="https://github.com/nickmessing.png?size=48" width="48" height="48"></a><a href="https://github.com/nikitavoloboev" target="_blank"><img title="nikitavoloboev" src="https://github.com/nikitavoloboev.png?size=48" width="48" height="48"></a><a href="https://github.com/nkzw-tech" target="_blank"><img title="nkzw-tech" src="https://github.com/nkzw-tech.png?size=48" width="48" height="48"></a><a href="https://github.com/palerdot" target="_blank"><img title="palerdot" src="https://github.com/palerdot.png?size=48" width="48" height="48"></a><a href="https://github.com/PorcoRosso85" target="_blank"><img title="PorcoRosso85" src="https://github.com/PorcoRosso85.png?size=48" width="48" height="48"></a><a href="https://github.com/primodiumxyz" target="_blank"><img title="primodiumxyz" src="https://github.com/primodiumxyz.png?size=48" width="48" height="48"></a><a href="https://github.com/shaneosullivan" target="_blank"><img title="shaneosullivan" src="https://github.com/shaneosullivan.png?size=48" width="48" height="48"></a><a href="https://github.com/sudo-self" target="_blank"><img title="sudo-self" src="https://github.com/sudo-self.png?size=48" width="48" height="48"></a><a href="https://github.com/SuperSonicHub1" target="_blank"><img title="SuperSonicHub1" src="https://github.com/SuperSonicHub1.png?size=48" width="48" height="48"></a><a href="https://github.com/threepointone" target="_blank"><img title="threepointone" src="https://github.com/threepointone.png?size=48" width="48" height="48"></a><a href="https://github.com/uptonking" target="_blank"><img title="uptonking" src="https://github.com/uptonking.png?size=48" width="48" height="48"></a><a href="https://github.com/ViktorZhurbin" target="_blank"><img title="ViktorZhurbin" src="https://github.com/ViktorZhurbin.png?size=48" width="48" height="48"></a><a href="https://github.com/WonderPanda" target="_blank"><img title="WonderPanda" src="https://github.com/WonderPanda.png?size=48" width="48" height="48"></a></section><hr><p><a class="start" href="https://beta.tinybase.org/guides/the-basics/getting-started/">Get started</a></p><p><a href="https://beta.tinybase.org/demos/">Try the demos</a></p><p><a href="https://beta.tinybase.org/api/store/interfaces/store/store/">Read the docs</a></p><hr><section id="about"><h2 id="about">About</h2><p>Modern apps deserve better. Why trade reactive user experiences to be able to use relational data? Or sacrifice features for bundle size? And why does the cloud do all the work <a href="https://localfirstweb.dev/" target="_blank">anyway</a>?</p><p>Building TinyBase was originally an interesting exercise for <a rel="me" href="https://tripleodeon.com">me</a> in API design, minification, and documentation. But now it has taken on a life of its own, and has grown beyond my wildest expectations.</p><p>It could not have been built without these great <a href="https://beta.tinybase.org/guides/how-tinybase-is-built/credits/#giants">projects</a> and <a href="https://beta.tinybase.org/guides/how-tinybase-is-built/credits/#and-friends">friends</a>, and I hope you enjoy using it as much as I do building it!</p></section><section id="story"><h2 id="the-story">The story</h2><a href="https://youtu.be/hXL7OkW-Prk?t=1232" target="_blank"><img src="https://beta.tinybase.org/youtube.webp"></a></section>
|
|
297
|
+
<section><h2 id="did-we-say-tiny">Did we say tiny?</h2><p>If you use the basic <a href="https://beta.tinybase.org/api/store/"><code>store</code></a> module alone, you'll only add a gzipped <em>5.3kB</em> to your app. Incrementally add the other modules as you need more functionality, or get it all for <em>11.4kB</em>.</p><p>The optional <a href="https://beta.tinybase.org/api/ui-react/"><code>ui-react</code></a> module is just <em>4.8kB</em>, the ui-react-dom components are another <em>2.5kB</em>, and everything is super fast. Life's easy when you have zero dependencies!</p><p>Read more about how TinyBase is structured and packaged in the <a href="https://beta.tinybase.org/guides/how-tinybase-is-built/architecture/">Architecture</a> guide.</p></section><div class="table"><table class="fixed"><tbody><tr><th> </th><th>Minified .js.gz</th><th>Source .js</th></tr><tr><th class="right"><a href="https://beta.tinybase.org/api/store/">tinybase/store</a> (minimal)</th><td>5.3kB</td><td>52.6kB</td></tr><tr><th class="right">tinybase (complete)</th><td>11.4kB</td><td>118.8kB</td></tr><tr><th class="right"><a href="https://beta.tinybase.org/api/ui-react/">ui-react</a></th><td>4.8kB</td><td>49.9kB</td></tr><tr><th class="right"><a href="https://beta.tinybase.org/api/ui-react-dom/">ui-react-dom</a></th><td>2.5kB</td><td>20.4kB</td></tr></tbody></table></div><section><h2 id="well-tested-and-documented">Well tested and documented.</h2><p>TinyBase has <em>100.0%</em> test coverage, including the code throughout the documentation - even on this page! The guides, demos, and API examples are designed to make it as easy as possible for you to get your TinyBase-powered app up and running.</p><p>Read more about how TinyBase is tested in the Unit <a href="https://beta.tinybase.org/guides/how-tinybase-is-built/testing/">Testing</a> guide.</p></section><div class="table"><table class="fixed"><tbody><tr><th width="30%"> </th><th>Total</th><th>Tested</th><th>Coverage</th></tr><tr><th class="right">Lines</th><td>2,244</td><td>2,244</td><td>100.0%</td></tr><tr><th class="right">Statements</th><td>2,423</td><td>2,423</td><td>100.0%</td></tr><tr><th class="right">Functions</th><td>968</td><td>968</td><td>100.0%</td></tr><tr><th class="right">Branches</th><td>862</td><td>862</td><td>100.0%</td></tr><tr><th class="right">Tests</th><td colspan="3">7,347</td></tr><tr><th class="right">Assertions</th><td colspan="3">32,974</td></tr></tbody></table></div><hr><section id="sponsors"><h2 id="proud-to-be-sponsored-by">Proud to be sponsored by:</h2><a href="https://github.com/cpojer" target="_blank"><img title="cpojer" src="https://github.com/cpojer.png?size=48" width="48" height="48"></a><a href="https://github.com/expo" target="_blank"><img title="expo" src="https://github.com/expo.png?size=48" width="48" height="48"></a><a href="https://github.com/beekeeb" target="_blank"><img title="beekeeb" src="https://github.com/beekeeb.png?size=48" width="48" height="48"></a><a href="https://github.com/cancelself" target="_blank"><img title="cancelself" src="https://github.com/cancelself.png?size=48" width="48" height="48"></a><a href="https://github.com/WonderPanda" target="_blank"><img title="WonderPanda" src="https://github.com/WonderPanda.png?size=48" width="48" height="48"></a><a href="https://github.com/arpitBhalla" target="_blank"><img title="arpitBhalla" src="https://github.com/arpitBhalla.png?size=48" width="48" height="48"></a></section><section id="users"><h2 id="excited-to-be-used-by">Excited to be used by:</h2><a href="https://github.com/Apocalypsor" target="_blank"><img title="Apocalypsor" src="https://github.com/Apocalypsor.png?size=48" width="48" height="48"></a><a href="https://github.com/brentvatne" target="_blank"><img title="brentvatne" src="https://github.com/brentvatne.png?size=48" width="48" height="48"></a><a href="https://github.com/byCedric" target="_blank"><img title="byCedric" src="https://github.com/byCedric.png?size=48" width="48" height="48"></a><a href="https://github.com/circadian-risk" target="_blank"><img title="circadian-risk" src="https://github.com/circadian-risk.png?size=48" width="48" height="48"></a><a href="https://github.com/cpojer" target="_blank"><img title="cpojer" src="https://github.com/cpojer.png?size=48" width="48" height="48"></a><a href="https://github.com/cubecull" target="_blank"><img title="cubecull" src="https://github.com/cubecull.png?size=48" width="48" height="48"></a><a href="https://github.com/erwinkn" target="_blank"><img title="erwinkn" src="https://github.com/erwinkn.png?size=48" width="48" height="48"></a><a href="https://github.com/expo" target="_blank"><img title="expo" src="https://github.com/expo.png?size=48" width="48" height="48"></a><a href="https://github.com/ezra-en" target="_blank"><img title="ezra-en" src="https://github.com/ezra-en.png?size=48" width="48" height="48"></a><a href="https://github.com/fdfontes" target="_blank"><img title="fdfontes" src="https://github.com/fdfontes.png?size=48" width="48" height="48"></a><a href="https://github.com/feychenie" target="_blank"><img title="feychenie" src="https://github.com/feychenie.png?size=48" width="48" height="48"></a><a href="https://github.com/flaming-codes" target="_blank"><img title="flaming-codes" src="https://github.com/flaming-codes.png?size=48" width="48" height="48"></a><a href="https://github.com/fostertheweb" target="_blank"><img title="fostertheweb" src="https://github.com/fostertheweb.png?size=48" width="48" height="48"></a><a href="https://github.com/generates" target="_blank"><img title="generates" src="https://github.com/generates.png?size=48" width="48" height="48"></a><a href="https://github.com/Giulio987" target="_blank"><img title="Giulio987" src="https://github.com/Giulio987.png?size=48" width="48" height="48"></a><a href="https://github.com/itsdevcoffee" target="_blank"><img title="itsdevcoffee" src="https://github.com/itsdevcoffee.png?size=48" width="48" height="48"></a><a href="https://github.com/jaysc" target="_blank"><img title="jaysc" src="https://github.com/jaysc.png?size=48" width="48" height="48"></a><a href="https://github.com/jbolda" target="_blank"><img title="jbolda" src="https://github.com/jbolda.png?size=48" width="48" height="48"></a><a href="https://github.com/Kayoo-asso" target="_blank"><img title="Kayoo-asso" src="https://github.com/Kayoo-asso.png?size=48" width="48" height="48"></a><a href="https://github.com/kotofurumiya" target="_blank"><img title="kotofurumiya" src="https://github.com/kotofurumiya.png?size=48" width="48" height="48"></a><a href="https://github.com/Kudo" target="_blank"><img title="Kudo" src="https://github.com/Kudo.png?size=48" width="48" height="48"></a><a href="https://github.com/learn-anything" target="_blank"><img title="learn-anything" src="https://github.com/learn-anything.png?size=48" width="48" height="48"></a><a href="https://github.com/lluc" target="_blank"><img title="lluc" src="https://github.com/lluc.png?size=48" width="48" height="48"></a><a href="https://github.com/marksteve" target="_blank"><img title="marksteve" src="https://github.com/marksteve.png?size=48" width="48" height="48"></a><a href="https://github.com/miking-the-viking" target="_blank"><img title="miking-the-viking" src="https://github.com/miking-the-viking.png?size=48" width="48" height="48"></a><a href="https://github.com/mjamesderocher" target="_blank"><img title="mjamesderocher" src="https://github.com/mjamesderocher.png?size=48" width="48" height="48"></a><a href="https://github.com/mouktardev" target="_blank"><img title="mouktardev" src="https://github.com/mouktardev.png?size=48" width="48" height="48"></a><a href="https://github.com/nickmessing" target="_blank"><img title="nickmessing" src="https://github.com/nickmessing.png?size=48" width="48" height="48"></a><a href="https://github.com/nikitavoloboev" target="_blank"><img title="nikitavoloboev" src="https://github.com/nikitavoloboev.png?size=48" width="48" height="48"></a><a href="https://github.com/nkzw-tech" target="_blank"><img title="nkzw-tech" src="https://github.com/nkzw-tech.png?size=48" width="48" height="48"></a><a href="https://github.com/palerdot" target="_blank"><img title="palerdot" src="https://github.com/palerdot.png?size=48" width="48" height="48"></a><a href="https://github.com/PorcoRosso85" target="_blank"><img title="PorcoRosso85" src="https://github.com/PorcoRosso85.png?size=48" width="48" height="48"></a><a href="https://github.com/primodiumxyz" target="_blank"><img title="primodiumxyz" src="https://github.com/primodiumxyz.png?size=48" width="48" height="48"></a><a href="https://github.com/shaneosullivan" target="_blank"><img title="shaneosullivan" src="https://github.com/shaneosullivan.png?size=48" width="48" height="48"></a><a href="https://github.com/sudo-self" target="_blank"><img title="sudo-self" src="https://github.com/sudo-self.png?size=48" width="48" height="48"></a><a href="https://github.com/SuperSonicHub1" target="_blank"><img title="SuperSonicHub1" src="https://github.com/SuperSonicHub1.png?size=48" width="48" height="48"></a><a href="https://github.com/threepointone" target="_blank"><img title="threepointone" src="https://github.com/threepointone.png?size=48" width="48" height="48"></a><a href="https://github.com/uptonking" target="_blank"><img title="uptonking" src="https://github.com/uptonking.png?size=48" width="48" height="48"></a><a href="https://github.com/ViktorZhurbin" target="_blank"><img title="ViktorZhurbin" src="https://github.com/ViktorZhurbin.png?size=48" width="48" height="48"></a><a href="https://github.com/WonderPanda" target="_blank"><img title="WonderPanda" src="https://github.com/WonderPanda.png?size=48" width="48" height="48"></a></section><hr><p><a class="start" href="https://beta.tinybase.org/guides/the-basics/getting-started/">Get started</a></p><p><a href="https://beta.tinybase.org/demos/">Try the demos</a></p><p><a href="https://beta.tinybase.org/api/store/interfaces/store/store/">Read the docs</a></p><hr><section id="about"><h2 id="about">About</h2><p>Modern apps deserve better. Why trade reactive user experiences to be able to use relational data? Or sacrifice features for bundle size? And why does the cloud do all the work <a href="https://localfirstweb.dev/" target="_blank">anyway</a>?</p><p>Building TinyBase was originally an interesting exercise for <a rel="me" href="https://tripleodeon.com">me</a> in API design, minification, and documentation. But now it has taken on a life of its own, and has grown beyond my wildest expectations.</p><p>It could not have been built without these great <a href="https://beta.tinybase.org/guides/how-tinybase-is-built/credits/#giants">projects</a> and <a href="https://beta.tinybase.org/guides/how-tinybase-is-built/credits/#and-friends">friends</a>, and I hope you enjoy using it as much as I do building it!</p></section><section id="story"><h2 id="the-story">The story</h2><a href="https://youtu.be/hXL7OkW-Prk?t=1232" target="_blank"><img src="https://beta.tinybase.org/youtube.webp"></a></section>
|
package/releases.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<p>This is a reverse chronological list of the major <a href="https://beta.tinybase.org/">TinyBase</a> releases, with highlighted features.</p><h2 id="v5-2">v5.2</h2><p>This release introduces new Persisters for... PostgreSQL! <a href="https://beta.tinybase.org/">TinyBase</a> now has two new <a href="https://beta.tinybase.org/api/persisters/interfaces/persister/persister/"><code>Persister</code></a> modules:</p><ul><li>The <a href="https://beta.tinybase.org/api/persister-postgres/"><code>persister-postgres</code></a> module provides the <a href="https://beta.tinybase.org/api/persister-postgres/interfaces/persister/postgrespersister/"><code>PostgresPersister</code></a>, which uses the excellent <a href="https://github.com/porsager/postgres"><code>postgres</code></a> module to bind to regular PostgreSQL databases, generally on a server.</li><li>The <a href="https://beta.tinybase.org/api/persister-pglite/"><code>persister-pglite</code></a> module provides the <a href="https://beta.tinybase.org/api/persister-pglite/interfaces/persister/pglitepersister/"><code>PglitePersister</code></a>, which uses the new and exciting <a href="https://github.com/electric-sql/pglite"><code>pglite</code></a> module for running PostgreSQL... in a browser!</li></ul><p>Conceptually, things behave in the same way as they do for the various SQLite persisters. Simply use the <a href="https://beta.tinybase.org/api/persister-postgres/functions/creation/createpostgrespersister/"><code>createPostgresPersister</code></a> function (or the similar <a href="https://beta.tinybase.org/api/persister-pglite/functions/creation/createpglitepersister/"><code>createPglitePersister</code></a> function) to persist your <a href="https://beta.tinybase.org/">TinyBase</a> data:</p>
|
|
1
|
+
<p>This is a reverse chronological list of the major <a href="https://beta.tinybase.org/">TinyBase</a> releases, with highlighted features.</p><h2 id="v5-3">v5.3</h2><p>This release is focussed on a few API improvements and quality-of-life changes. These include:</p><h2 id="in-the-ui-react-module">In the <a href="https://beta.tinybase.org/api/ui-react/"><code>ui-react</code></a> module...</h2><ul><li>The new <a href="https://beta.tinybase.org/api/ui-react/functions/metrics-hooks/useprovidemetrics/"><code>useProvideMetrics</code></a> hook, which lets you imperatively register <a href="https://beta.tinybase.org/api/metrics/interfaces/metrics/metrics/"><code>Metrics</code></a> objects into a Provider context, much like the existing <a href="https://beta.tinybase.org/api/ui-react/functions/store-hooks/useprovidestore/"><code>useProvideStore</code></a> hook.</li><li>The new <a href="https://beta.tinybase.org/api/ui-react/functions/other/useprovideindexes/"><code>useProvideIndexes</code></a> hook, which lets you register <a href="https://beta.tinybase.org/api/indexes/interfaces/indexes/indexes/"><code>Indexes</code></a> objects, similarly.</li><li>The new <a href="https://beta.tinybase.org/api/ui-react/functions/other/useproviderelationships/"><code>useProvideRelationships</code></a> hook, which lets you register <a href="https://beta.tinybase.org/api/relationships/interfaces/relationships/relationships/"><code>Relationships</code></a> objects.</li><li>The new <a href="https://beta.tinybase.org/api/ui-react/functions/other/useprovidequeries/"><code>useProvideQueries</code></a> hook, which lets you register <a href="https://beta.tinybase.org/api/queries/interfaces/queries/queries/"><code>Queries</code></a> objects.</li><li>The new <a href="https://beta.tinybase.org/api/ui-react/functions/other/useprovidecheckpoints/"><code>useProvideCheckpoints</code></a> hook, which lets you register <a href="https://beta.tinybase.org/api/checkpoints/interfaces/checkpoints/checkpoints/"><code>Checkpoints</code></a> objects.</li></ul><p>Please provide feedback on this new release on GitHub!</p><h2 id="v5-2">v5.2</h2><p>This release introduces new Persisters for... PostgreSQL! <a href="https://beta.tinybase.org/">TinyBase</a> now has two new <a href="https://beta.tinybase.org/api/persisters/interfaces/persister/persister/"><code>Persister</code></a> modules:</p><ul><li>The <a href="https://beta.tinybase.org/api/persister-postgres/"><code>persister-postgres</code></a> module provides the <a href="https://beta.tinybase.org/api/persister-postgres/interfaces/persister/postgrespersister/"><code>PostgresPersister</code></a>, which uses the excellent <a href="https://github.com/porsager/postgres"><code>postgres</code></a> module to bind to regular PostgreSQL databases, generally on a server.</li><li>The <a href="https://beta.tinybase.org/api/persister-pglite/"><code>persister-pglite</code></a> module provides the <a href="https://beta.tinybase.org/api/persister-pglite/interfaces/persister/pglitepersister/"><code>PglitePersister</code></a>, which uses the new and exciting <a href="https://github.com/electric-sql/pglite"><code>pglite</code></a> module for running PostgreSQL... in a browser!</li></ul><p>Conceptually, things behave in the same way as they do for the various SQLite persisters. Simply use the <a href="https://beta.tinybase.org/api/persister-postgres/functions/creation/createpostgrespersister/"><code>createPostgresPersister</code></a> function (or the similar <a href="https://beta.tinybase.org/api/persister-pglite/functions/creation/createpglitepersister/"><code>createPglitePersister</code></a> function) to persist your <a href="https://beta.tinybase.org/">TinyBase</a> data:</p>
|
|
2
2
|
|
|
3
3
|
```js
|
|
4
4
|
import postgres from 'postgres';
|
|
@@ -36,7 +36,7 @@ pgPersister.destroy();
|
|
|
36
36
|
await sql.end();
|
|
37
37
|
```
|
|
38
38
|
|
|
39
|
-
<p>Note that these two <a href="https://beta.tinybase.org/api/persisters/interfaces/persister/persister/"><code>Persister</code></a> objects support both the <code>json</code> and <code>tabular</code> modes for saving <a href="https://beta.tinybase.org/">TinyBase</a> data into the database. See the <a href="https://beta.tinybase.org/api/persisters/type-aliases/configuration/databasepersisterconfig/"><code>DatabasePersisterConfig</code></a> type for more details. (Note however that, like the SQLite Persisters, only the <code>json</code> mode is supported for <a href="https://beta.tinybase.org/api/mergeable-store/interfaces/mergeable/mergeablestore/"><code>MergeableStore</code></a> instances, due to their additional CRDT metadata.)</p><p>This release also exposes the new <a href="https://beta.tinybase.org/api/persisters/functions/creation/createcustomsqlitepersister/"><code>createCustomSqlitePersister</code></a> function and <a href="https://beta.tinybase.org/api/persisters/functions/creation/createcustompostgresqlpersister/"><code>createCustomPostgreSqlPersister</code></a> function at the top level of the persister module. These can be used to build <a href="https://beta.tinybase.org/api/persisters/interfaces/persister/persister/"><code>Persister</code></a> objects against SQLite and PostgreSQL SDKs (or forks) that are not already included with <a href="https://beta.tinybase.org/">TinyBase</a>.</p><h3 id="minor-breaking-change">Minor breaking change</h3><p>It's very unlikely to affect most apps, but also be aware that the <a href="https://beta.tinybase.org/api/persisters/"><code>persisters</code></a> module and <a href="https://beta.tinybase.org/api/synchronizers/"><code>synchronizers</code></a> module are no longer bundled in the 'master' tinybase module. If you are using them (most likely because you have built a custom <a href="https://beta.tinybase.org/api/persisters/interfaces/persister/persister/"><code>Persister</code></a> or <a href="https://beta.tinybase.org/api/synchronizers/interfaces/synchronizer/synchronizer/"><code>Synchronizer</code></a>), you will need to update your imports accordingly to the standalone <code>tinybase/persisters</code> and <code>tinybase/synchronizers</code> versions of them. Apologies.</p><
|
|
39
|
+
<p>Note that these two <a href="https://beta.tinybase.org/api/persisters/interfaces/persister/persister/"><code>Persister</code></a> objects support both the <code>json</code> and <code>tabular</code> modes for saving <a href="https://beta.tinybase.org/">TinyBase</a> data into the database. See the <a href="https://beta.tinybase.org/api/persisters/type-aliases/configuration/databasepersisterconfig/"><code>DatabasePersisterConfig</code></a> type for more details. (Note however that, like the SQLite Persisters, only the <code>json</code> mode is supported for <a href="https://beta.tinybase.org/api/mergeable-store/interfaces/mergeable/mergeablestore/"><code>MergeableStore</code></a> instances, due to their additional CRDT metadata.)</p><p>This release also exposes the new <a href="https://beta.tinybase.org/api/persisters/functions/creation/createcustomsqlitepersister/"><code>createCustomSqlitePersister</code></a> function and <a href="https://beta.tinybase.org/api/persisters/functions/creation/createcustompostgresqlpersister/"><code>createCustomPostgreSqlPersister</code></a> function at the top level of the persister module. These can be used to build <a href="https://beta.tinybase.org/api/persisters/interfaces/persister/persister/"><code>Persister</code></a> objects against SQLite and PostgreSQL SDKs (or forks) that are not already included with <a href="https://beta.tinybase.org/">TinyBase</a>.</p><h3 id="minor-breaking-change">Minor breaking change</h3><p>It's very unlikely to affect most apps, but also be aware that the <a href="https://beta.tinybase.org/api/persisters/"><code>persisters</code></a> module and <a href="https://beta.tinybase.org/api/synchronizers/"><code>synchronizers</code></a> module are no longer bundled in the 'master' tinybase module. If you are using them (most likely because you have built a custom <a href="https://beta.tinybase.org/api/persisters/interfaces/persister/persister/"><code>Persister</code></a> or <a href="https://beta.tinybase.org/api/synchronizers/interfaces/synchronizer/synchronizer/"><code>Synchronizer</code></a>), you will need to update your imports accordingly to the standalone <code>tinybase/persisters</code> and <code>tinybase/synchronizers</code> versions of them. Apologies.</p><h2 id="v5-1">v5.1</h2><p>This release lets you persist data on a server using the <a href="https://beta.tinybase.org/api/synchronizer-ws-server/functions/creation/createwsserver/"><code>createWsServer</code></a> function. This makes it possible for all clients to disconnect from a path, but, when they reconnect, for the data to still be present for them to sync with.</p><p>This is done by passing in a second argument to the <a href="https://beta.tinybase.org/api/synchronizer-ws-server/functions/creation/createwsserver/"><code>createWsServer</code></a> function that creates a <a href="https://beta.tinybase.org/api/persisters/interfaces/persister/persister/"><code>Persister</code></a> instance (for which also need to create or provide a <a href="https://beta.tinybase.org/api/mergeable-store/interfaces/mergeable/mergeablestore/"><code>MergeableStore</code></a>) for a given path:</p>
|
|
40
40
|
|
|
41
41
|
```js
|
|
42
42
|
import {WebSocketServer} from 'ws';
|
|
@@ -197,7 +197,7 @@ const POSITION_VALUE = 'position';
|
|
|
197
197
|
const OPEN_VALUE = OPEN_CELL;
|
|
198
198
|
const EDITABLE_CELL = 'editable';
|
|
199
199
|
const getUniqueId = (...args) => jsonStringWithMap(args);
|
|
200
|
-
const sortedIdsMap = (ids, callback) => arrayMap(arraySort(ids), callback);
|
|
200
|
+
const sortedIdsMap = (ids, callback) => arrayMap(arraySort([...ids]), callback);
|
|
201
201
|
const useEditable = (uniqueId, s) => [
|
|
202
202
|
!!useCell(STATE_TABLE, uniqueId, EDITABLE_CELL, s),
|
|
203
203
|
useCallback$1(
|
|
@@ -197,7 +197,7 @@ const POSITION_VALUE = 'position';
|
|
|
197
197
|
const OPEN_VALUE = OPEN_CELL;
|
|
198
198
|
const EDITABLE_CELL = 'editable';
|
|
199
199
|
const getUniqueId = (...args) => jsonStringWithMap(args);
|
|
200
|
-
const sortedIdsMap = (ids, callback) => arrayMap(arraySort(ids), callback);
|
|
200
|
+
const sortedIdsMap = (ids, callback) => arrayMap(arraySort([...ids]), callback);
|
|
201
201
|
const useEditable = (uniqueId, s) => [
|
|
202
202
|
!!useCell(STATE_TABLE, uniqueId, EDITABLE_CELL, s),
|
|
203
203
|
useCallback$1(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var e,t;e=this,t=function(e,t,l){"use strict";const n=e=>typeof e,s="",r=n(s),a=n(!0),o=n(0),i=n(n),u="type",d="default",c="Has",h="Ids",m="Table",p=m+"s",b=m+h,g="Row",v=g+"Count",f=g+h,y="Cell",I=y+h,w="Value",C=w+"s",k=w+h,x="currentTarget",S="value",T=e=>s+e,V=globalThis.window,R=Math,O=R.min,q=R.floor,M=isFinite,P=e=>null==e,N=(e,t,l)=>P(e)?null==l?void 0:l():t(e),L=e=>e==r||e==a,E=e=>n(e)==i,j=e=>Array.isArray(e),z=(e,t,l)=>e.slice(t,l),$=e=>e.length,A=e=>{throw Error(e)},{PureComponent:F,Fragment:J,createElement:B,useCallback:D,useLayoutEffect:Q,useRef:H,useState:W}=t,U=(e,...t)=>P(e)?{}:e(...t),G=(e,t)=>e.sort(t),K=(e,t)=>e.forEach(t),X=(e,t)=>e.map(t),Y=e=>0==$(e),Z=(e,...t)=>e.push(...t),_=e=>e.shift(),ee=Object,te=e=>ee.getPrototypeOf(e),le=ee.entries,ne=ee.isFrozen,se=e=>!P(e)&&N(te(e),(e=>e==ee.prototype||P(te(e))),(()=>!0)),re=ee.keys,ae=ee.freeze,oe=(e=[])=>ee.fromEntries(e),ie=(e,t)=>t in e,ue=(e,t)=>(delete e[t],e),de=(e,t)=>X(le(e),(([e,l])=>t(l,e))),ce=e=>se(e)&&0==(e=>$(re(e)))(e),he=(e,t,l,n=0)=>P(e)||!se(e)||!n&&ce(e)||ne(e)?(null==l||l(),!1):(de(e,((l,n)=>{t(l,n)||ue(e,n)})),!!n||!ce(e)),me=JSON.stringify,pe=JSON.parse,be=e=>me(e,((e,t)=>t instanceof Map?ee.fromEntries([...t]):t)),ge="tinybaseInspector",ve="TinyBase Inspector",fe=["left","top","bottom","right","full"],ye="state",Ie="sort",we="open",Ce="position",ke=we,xe="editable",Se=(...e)=>be(e),Te=(e,t)=>X(G(e),t),Ve=(e,t)=>[!!l.useCell(ye,e,xe,t),D((l=>{t.setCell(ye,e,xe,(e=>!e)),l.preventDefault()}),[t,e])],Re="M20 80l5-15l40-40l10 10l-40 40l-15 5m5-15l10 10",Oe='content:url("',qe=Oe+"data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' stroke-width='4' stroke='white' fill='none'>",Me='</svg>")',Pe=Oe+"data:image/svg+xml,%3csvg viewBox='0 0 680 680' xmlns='http://www.w3.org/2000/svg' style='width:680px%3bheight:680px'%3e %3cpath stroke='white' stroke-width='80' fill='none' d='M340 617a84 241 90 11.01 0zM131 475a94 254 70 10428-124 114 286 70 01-428 124zm0-140a94 254 70 10428-124 114 286 70 01-428 124zm-12-127a94 254 70 00306 38 90 260 90 01-306-38zm221 3a74 241 90 11.01 0z' /%3e %3cpath fill='%23d81b60' d='M131 475a94 254 70 10428-124 114 286 70 01-428 124zm0-140a94 254 70 10428-124 114 286 70 01-428 124z' /%3e %3cpath d='M249 619a94 240 90 00308-128 114 289 70 01-308 128zM119 208a94 254 70 00306 38 90 260 90 01-306-38zm221 3a74 241 90 11.01 0z' /%3e%3c/svg%3e\")",Ne=X([[20,20,20,60],[20,20,60,20],[20,60,60,20],[60,20,20,60],[30,30,40,40]],(([e,t,l,n])=>qe+`<rect x='20' y='20' width='60' height='60' fill='grey'/><rect x='${e}' y='${t}' width='${l}' height='${n}' fill='white'/>`+Me)),Le=qe+"<path d='M20 20l60 60M20 80l60-60' />"+Me,Ee=qe+`<path d='${Re}' />`+Me,je=qe+`<path d='${Re}M20 20l60 60' />`+Me;var ze=Object.defineProperty,$e=Object.defineProperties,Ae=Object.getOwnPropertyDescriptors,Fe=Object.getOwnPropertySymbols,Je=Object.prototype.hasOwnProperty,Be=Object.prototype.propertyIsEnumerable,De=(e,t,l)=>t in e?ze(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l,Qe=(e,t)=>{for(var l in t||(t={}))Je.call(t,l)&&De(e,l,t[l]);if(Fe)for(var l of Fe(t))Be.call(t,l)&&De(e,l,t[l]);return e},He=(e,t)=>$e(e,Ae(t));const We="*::-webkit-scrollbar",Ue=((e,t="")=>e.join(t))(de(He(Qe(He(Qe(He(Qe({"":"all:initial;font-family:sans-serif;font-size:0.75rem;position:fixed;z-index:999999","*":"all:revert","*::before":"all:revert","*::after":"all:revert",[We]:"width:0.5rem;height:0.5rem;",[We+"-track"]:"background:#111",[We+"-thumb"]:"background:#999;border:1px solid #111",[We+"-thumb:hover"]:"background:#fff",[We+"-corner"]:"background:#111",img:"width:1rem;height:1rem;background:#111;border:0;vertical-align:text-bottom",">img":"padding:0.25rem;bottom:0;right:0;position:fixed;"+Pe},oe(X(["bottom:0;left:0","top:0;right:0"],((e,t)=>[`>img[data-position='${t}']`,e])))),{main:"display:flex;flex-direction:column;background:#111d;color:#fff;position:fixed;"}),oe(X(["bottom:0;left:0;width:35vw;height:100vh","top:0;right:0;width:100vw;height:30vh","bottom:0;left:0;width:100vw;height:30vh","top:0;right:0;width:35vw;height:100vh","top:0;right:0;width:100vw;height:100vh"],((e,t)=>[`main[data-position='${t}']`,e])))),{header:"display:flex;padding:0.25rem;background:#000;align-items:center","header>img:nth-of-type(1)":Pe,"header>img:nth-of-type(6)":Le}),oe(X(Ne,((e,t)=>[`header>img[data-id='${t}']`,e])))),{"header>span":"flex:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;margin-left:0.25rem",article:"padding:0.25rem 0.25rem 0.25rem 0.5rem;overflow:auto;flex:1",details:"margin-left:0.75rem;width:fit-content;","details img":"display:none","details[open]>summary img":"display:unset;background:none;margin-left:0.25rem","details[open]>summary img.edit":Ee,"details[open]>summary img.done":je,summary:"margin-left:-0.75rem;line-height:1.25rem;user-select:none;width:fit-content",table:"border-collapse:collapse;table-layout:fixed;margin-bottom:0.5rem","table input":"background:#111;color:unset;padding:0 0.25rem;border:0;font-size:unset;vertical-align:top;margin:0",'table input[type="number"]':"width:4rem","table tbody button":"font-size:0;background:#fff;border-radius:50%;margin:0 0.125rem 0 0;width:0.85rem;color:#111","table button:first-letter":"font-size:0.75rem",thead:"background:#222","th:nth-of-type(1)":"min-width:2rem;","th.sorted":"background:#000","table caption":"text-align:left;white-space:nowrap;line-height:1.25rem",button:"width:1.5rem;border:none;background:none;color:#fff;padding:0","button[disabled]":"color:#777","button.next":"margin-right:0.5rem",[`th,#${ge} td`]:"overflow:hidden;text-overflow:ellipsis;padding:0.25rem 0.5rem;max-width:12rem;white-space:nowrap;border-width:1px 0;border-style:solid;border-color:#777;text-align:left","span.warn":"margin:0.25rem;color:#d81b60"}),((e,t)=>e?`#${ge} ${t}{${e}}`:""))),Ge=({s:e})=>{var t;const n=null!=(t=l.useValue(Ce,e))?t:1,s=l.useSetValueCallback(ke,(()=>!0),[],e);return l.useValue(ke,e)?null:B("img",{onClick:s,title:ve,"data-position":n})},Ke=({uniqueId:e,summary:t,editable:n,handleEditable:s,children:r,s:a})=>{const o=!!l.useCell(ye,e,we,a),i=l.useSetCellCallback(ye,e,we,(e=>e[x].open),[],a);return B("details",{open:o,onToggle:i},B("summary",null,t,s?B("img",{onClick:s,className:n?"done":"edit"}):null),r)},Xe=e=>{const t=n(e);return L(t)||t==o&&M(e)?t:void 0},Ye=(e,t,l,n,s)=>P(s)?e.delCell(t,l,n,!0):e.setCell(t,l,n,s),Ze=(e,t,l)=>P(l)?e.delValue(t):e.setValue(t,l),_e=(e,t,l,n)=>e==r?t:e==o?l:n;var et=Object.defineProperty,tt=Object.defineProperties,lt=Object.getOwnPropertyDescriptors,nt=Object.getOwnPropertySymbols,st=Object.prototype.hasOwnProperty,rt=Object.prototype.propertyIsEnumerable,at=(e,t,l)=>t in e?et(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l,ot=(e,t)=>{for(var l in t||(t={}))st.call(t,l)&&at(e,l,t[l]);if(nt)for(var l of nt(t))rt.call(t,l)&&at(e,l,t[l]);return e},it=(e,t)=>tt(e,lt(t)),ut=(e,t)=>{var l={};for(var n in e)st.call(e,n)&&t.indexOf(n)<0&&(l[n]=e[n]);if(null!=e&&nt)for(var n of nt(e))t.indexOf(n)<0&&rt.call(e,n)&&(l[n]=e[n]);return l};const{useCallback:dt,useMemo:ct,useState:ht}=t,mt="editable",pt=(e,t)=>X(l.useTableCellIds(e,t),(t=>e+"."+t)),bt=(e,t,l)=>{const n=dt(e,t);return l?n:void 0},gt=(...e)=>ct((()=>e),e),vt=(e,t)=>ct((()=>({store:e,tableId:t})),[e,t]),ft=(e,t)=>ct((()=>({queries:e,queryId:t})),[e,t]),yt=(e,t=!1,l,n=0,s,r,a,o)=>{const[[i,u,d],c]=ht([e,t,n]),h=dt((e=>{c(e),null==o||o(e)}),[o]),m=bt((e=>h([e,e==i&&!u,d])),[h,i,u,d],l),p=dt((e=>h([i,u,e])),[h,i,u]),b=!0===a?Pt:a;return[[i,u,d],m,ct((()=>!1===a?null:B(b,{offset:d,limit:s,total:r,onChange:p})),[a,b,d,s,r,p])]},It=(e,t,l)=>ct((()=>{const s=null!=t?t:e;return a=j(s)?oe(X(s,(e=>[e,e]))):s,o=(e,t)=>ot(ot({},{label:t,component:l}),n(e)==r?{label:e}:e),oe(de(a,((e,t)=>[t,o(e,t)])));var a,o}),[t,l,e]),wt=({className:e,headerRow:t,idColumn:l,params:[n,s,r,a,o,i]})=>B("table",{className:e},i?B("caption",null,i):null,!1===t?null:B("thead",null,B("tr",null,!1===l?null:B(Ct,{sort:null!=a?a:[],label:"Id",onClick:o}),de(n,(({label:e},t)=>B(Ct,{key:t,cellId:t,label:e,sort:null!=a?a:[],onClick:o}))))),B("tbody",null,X(r,(e=>B("tr",{key:e},!1===l?null:B("th",null,e),de(n,(({component:t,getComponentProps:l},n)=>B("td",{key:n},B(t,it(ot(ot({},U(l,e,n)),s),{rowId:e,cellId:n})))))))))),Ct=({cellId:e,sort:[t,l],label:n=(null!=e?e:s),onClick:r})=>B("th",{onClick:bt((()=>null==r?void 0:r(e)),[r,e],r),className:P(l)||t!=e?void 0:`sorted ${l?"de":"a"}scending`},P(l)||t!=e?null:(l?"↓":"↑")+" ",n),kt=({localRowId:e,params:[n,s,r,a,o,i,u]})=>{const d=l.useRemoteRowId(o,e,i);return B("tr",null,!1===n?null:B(t.Fragment,null,B("th",null,e),B("th",null,d)),de(s,(({component:t,getComponentProps:l},n)=>{const[s,o]=n.split(".",2),i=s===r?e:s===a?d:null;return P(i)?null:B("td",{key:n},B(t,it(ot({},U(l,i,o)),{store:u,tableId:s,rowId:i,cellId:o})))})))},xt=({thing:e,onThingChange:t,className:l,hasSchema:n,showType:s=!0})=>{const[i,u]=ht(),[d,c]=ht(),[h,m]=ht(),[p,b]=ht(),[g,v]=ht();d!==e&&(u(Xe(e)),c(e),m(e+""),b(Number(e)||0),v(!!e));const f=dt(((e,l)=>{l(e),c(e),t(e)}),[t]),y=dt((()=>{if(!(null==n?void 0:n())){const e=_e(i,o,a,r),l=_e(e,h,p,g);u(e),c(l),t(l)}}),[n,t,h,p,g,i]);return B("div",{className:l},s?B("button",{className:i,onClick:y},i):null,_e(i,B("input",{key:i,value:h,onChange:dt((e=>f(e[x][S]+"",m)),[f])}),B("input",{key:i,type:"number",value:p,onChange:dt((e=>f(Number(e[x][S]||0),b)),[f])}),B("input",{key:i,type:"checkbox",checked:g,onChange:dt((e=>f(!!e[x].checked,v)),[f])})))},St=e=>{var t=e,{tableId:n,cellId:s,descending:r,offset:a,limit:o,store:i,editable:u,sortOnClick:d,paginator:c=!1,onChange:h,customCells:m}=t,p=ut(t,["tableId","cellId","descending","offset","limit","store","editable","sortOnClick","paginator","onChange","customCells"]);const[b,g,v]=yt(s,r,d,a,o,l.useRowCount(n,i),c,h);return B(wt,it(ot({},p),{params:gt(It(l.useTableCellIds(n,i),m,u?qt:l.CellView),vt(i,n),l.useSortedRowIds(n,...b,o,i),b,g,v)}))},Tt=({store:e,editable:t=!1,valueComponent:n=(t?Mt:l.ValueView),getValueComponentProps:s,className:r,headerRow:a,idColumn:o})=>B("table",{className:r},!1===a?null:B("thead",null,B("tr",null,!1===o?null:B("th",null,"Id"),B("th",null,w))),B("tbody",null,X(l.useValueIds(e),(t=>B("tr",{key:t},!1===o?null:B("th",null,t),B("td",null,B(n,it(ot({},U(s,t)),{valueId:t,store:e})))))))),Vt=e=>{var t=e,{indexId:n,sliceId:s,indexes:r,editable:a,customCells:o}=t,i=ut(t,["indexId","sliceId","indexes","editable","customCells"]);const[u,d,c]=((e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getTableId(t)])(l.useIndexesOrIndexesById(r),n);return B(wt,it(ot({},i),{params:gt(It(l.useTableCellIds(c,d),o,a?qt:l.CellView),vt(d,c),l.useSliceRowIds(n,s,u))}))},Rt=({relationshipId:e,relationships:n,editable:s,customCells:r,className:a,headerRow:o,idColumn:i=!0})=>{const[u,d,c,h]=((e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(t),null==e?void 0:e.getRemoteTableId(t)])(l.useRelationshipsOrRelationshipsById(n),e),m=It([...pt(c,d),...pt(h,d)],r,s?qt:l.CellView),p=gt(i,m,c,h,e,u,d);return B("table",{className:a},!1===o?null:B("thead",null,B("tr",null,!1===i?null:B(t.Fragment,null,B("th",null,c,".Id"),B("th",null,h,".Id")),de(m,(({label:e},t)=>B("th",{key:t},e))))),B("tbody",null,X(l.useRowIds(c,d),(e=>B(kt,{key:e,localRowId:e,params:p})))))},Ot=e=>{var t=e,{queryId:n,cellId:s,descending:r,offset:a,limit:o,queries:i,sortOnClick:u,paginator:d=!1,customCells:c,onChange:h}=t,m=ut(t,["queryId","cellId","descending","offset","limit","queries","sortOnClick","paginator","customCells","onChange"]);const[p,b,g]=yt(s,r,u,a,o,l.useResultRowCount(n,i),d,h);return B(wt,it(ot({},m),{params:gt(It(l.useResultTableCellIds(n,i),c,l.ResultCellView),ft(i,n),l.useResultSortedRowIds(n,...p,o,i),p,b,g)}))},qt=({tableId:e,rowId:t,cellId:n,store:s,className:r,showType:a})=>{var o;return B(xt,{thing:l.useCell(e,t,n,s),onThingChange:l.useSetCellCallback(e,t,n,(e=>e),[],s),className:null!=r?r:mt+y,showType:a,hasSchema:null==(o=l.useStoreOrStoreById(s))?void 0:o.hasTablesSchema})},Mt=({valueId:e,store:t,className:n,showType:s})=>{var r;return B(xt,{thing:l.useValue(e,t),onThingChange:l.useSetValueCallback(e,(e=>e),[],t),className:null!=n?n:mt+w,showType:s,hasSchema:null==(r=l.useStoreOrStoreById(t))?void 0:r.hasValuesSchema})},Pt=({onChange:e,total:l,offset:n=0,limit:s=l,singular:r="row",plural:a=r+"s"})=>{(n>l||n<0)&&(n=0,e(0));const o=bt((()=>e(n-s)),[e,n,s],n>0),i=bt((()=>e(n+s)),[e,n,s],n+s<l);return B(t.Fragment,null,l>s&&B(t.Fragment,null,B("button",{className:"previous",disabled:0==n,onClick:o},"←"),B("button",{className:"next",disabled:n+s>=l,onClick:i},"→"),n+1," to ",O(l,n+s)," of "),l," ",1!=l?a:r)},Nt=({indexes:e,indexesId:t,indexId:n,s:s})=>B(Ke,{uniqueId:Se("i",t,n),summary:"Index: "+n,s:s},X(l.useSliceIds(n,e),(l=>B(Lt,{indexes:e,indexesId:t,indexId:n,sliceId:l,s:s,key:l})))),Lt=({indexes:e,indexesId:t,indexId:l,sliceId:n,s:s})=>{const r=Se("i",t,l,n),[a,o]=Ve(r,s);return B(Ke,{uniqueId:r,summary:"Slice: "+n,editable:a,handleEditable:o,s:s},B(Vt,{sliceId:n,indexId:l,indexes:e,editable:a}))},Et=({indexesId:e,s:t})=>{const n=l.useIndexes(e),s=l.useIndexIds(n);return P(n)?null:B(Ke,{uniqueId:Se("i",e),summary:"Indexes: "+(null!=e?e:d),s:t},Y(s)?"No indexes defined":Te(s,(l=>B(Nt,{indexes:n,indexesId:e,indexId:l,s:t,key:l}))))},jt=({metrics:e,metricId:t})=>B("tr",null,B("th",null,t),B("td",null,null==e?void 0:e.getTableId(t)),B("td",null,l.useMetric(t,e))),zt=({metricsId:e,s:t})=>{const n=l.useMetrics(e),s=l.useMetricIds(n);return P(n)?null:B(Ke,{uniqueId:Se("m",e),summary:"Metrics: "+(null!=e?e:d),s:t},Y(s)?"No metrics defined":B("table",null,B("thead",null,B("th",null,"Metric Id"),B("th",null,"Table Id"),B("th",null,"Metric")),B("tbody",null,X(s,(e=>B(jt,{metrics:n,metricId:e,key:e}))))))},$t=({queries:e,queriesId:t,queryId:n,s:s})=>{var r;const a=Se("q",t,n),[o,i,u]=pe(null!=(r=l.useCell(ye,a,Ie,s))?r:"[]"),d=l.useSetCellCallback(ye,a,Ie,be,[],s);return B(Ke,{uniqueId:a,summary:"Query: "+n,s:s},B(Ot,{queryId:n,queries:e,cellId:o,descending:i,offset:u,limit:10,paginator:!0,sortOnClick:!0,onChange:d}))},At=({queriesId:e,s:t})=>{const n=l.useQueries(e),s=l.useQueryIds(n);return P(n)?null:B(Ke,{uniqueId:Se("q",e),summary:"Queries: "+(null!=e?e:d),s:t},Y(s)?"No queries defined":Te(s,(l=>B($t,{queries:n,queriesId:e,queryId:l,s:t,key:l}))))},Ft=({relationships:e,relationshipsId:t,relationshipId:l,s:n})=>{const s=Se("r",t,l),[r,a]=Ve(s,n);return B(Ke,{uniqueId:s,summary:"Relationship: "+l,editable:r,handleEditable:a,s:n},B(Rt,{relationshipId:l,relationships:e,editable:r}))},Jt=({relationshipsId:e,s:t})=>{const n=l.useRelationships(e),s=l.useRelationshipIds(n);return P(n)?null:B(Ke,{uniqueId:Se("r",e),summary:"Relationships: "+(null!=e?e:d),s:t},Y(s)?"No relationships defined":Te(s,(l=>B(Ft,{relationships:n,relationshipsId:e,relationshipId:l,s:t,key:l}))))},Bt=({tableId:e,store:t,storeId:n,s:s})=>{var r;const a=Se("t",n,e),[o,i,u]=pe(null!=(r=l.useCell(ye,a,Ie,s))?r:"[]"),d=l.useSetCellCallback(ye,a,Ie,be,[],s),[c,h]=Ve(a,s);return B(Ke,{uniqueId:a,summary:m+": "+e,editable:c,handleEditable:h,s:s},B(St,{tableId:e,store:t,cellId:o,descending:i,offset:u,limit:10,paginator:!0,sortOnClick:!0,onChange:d,editable:c}))},Dt=({store:e,storeId:t,s:n})=>{const s=Se("v",t),[r,a]=Ve(s,n);return Y(l.useValueIds(e))?null:B(Ke,{uniqueId:s,summary:C,editable:r,handleEditable:a,s:n},B(Tt,{store:e,editable:r}))},Qt=({storeId:e,s:t})=>{const n=l.useStore(e),s=l.useTableIds(n);return P(n)?null:B(Ke,{uniqueId:Se("s",e),summary:(n.isMergeable()?"Mergeable":"")+"Store: "+(null!=e?e:d),s:t},B(Dt,{storeId:e,store:n,s:t}),Te(s,(l=>B(Bt,{store:n,storeId:e,tableId:l,s:t,key:l}))))},Ht=({s:e})=>{const t=H(null),n=H(0),[s,r]=W(!1),{scrollLeft:a,scrollTop:o}=l.useValues(e);Q((()=>{const e=t.current;if(e&&!s){const t=new MutationObserver((()=>{e.scrollWidth>=q(a)+e.clientWidth&&e.scrollHeight>=q(o)+e.clientHeight&&e.scrollTo(a,o)}));return t.observe(e,{childList:!0,subtree:!0}),()=>t.disconnect()}}),[s,a,o]);const i=D((t=>{const{scrollLeft:l,scrollTop:s}=t[x];cancelIdleCallback(n.current),n.current=requestIdleCallback((()=>{r(!0),e.setPartialValues({scrollLeft:l,scrollTop:s})}))}),[e]),u=l.useStore(),d=l.useStoreIds(),c=l.useMetrics(),h=l.useMetricsIds(),m=l.useIndexes(),p=l.useIndexesIds(),b=l.useRelationships(),g=l.useRelationshipsIds(),v=l.useQueries(),f=l.useQueriesIds();return P(u)&&Y(d)&&P(c)&&Y(h)&&P(m)&&Y(p)&&P(b)&&Y(g)&&P(v)&&Y(f)?B("span",{className:"warn"},"There are no Stores or other objects to inspect. Make sure you placed the Inspector inside a Provider component."):B("article",{ref:t,onScroll:i},B(Qt,{s:e}),X(d,(t=>B(Qt,{storeId:t,s:e,key:t}))),B(zt,{s:e}),X(h,(t=>B(zt,{metricsId:t,s:e,key:t}))),B(Et,{s:e}),X(p,(t=>B(Et,{indexesId:t,s:e,key:t}))),B(Jt,{s:e}),X(g,(t=>B(Jt,{relationshipsId:t,s:e,key:t}))),B(At,{s:e}),X(f,(t=>B(At,{queriesId:t,s:e,key:t}))))};var Wt=Object.defineProperty;class Ut extends F{constructor(e){var t,l,n;super(e),n=(e,t)=>console.error(e,t.componentStack),(l="componentDidCatch")in(t=this)?Wt(t,l,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[l]=n,this.state={e:0}}static getDerivedStateFromError(){return{e:1}}render(){return this.state.e?B("span",{className:"warn"},"Inspector error: please see console for details."):this.props.children}}const Gt=({s:e})=>{var t;const n=null!=(t=l.useValue(Ce,e))?t:1,s=l.useSetValueCallback(ke,(()=>!1),[],e),r=l.useSetValueCallback(Ce,(e=>Number(e[x].dataset.id)),[],e);return B("header",null,B("img",{title:ve}),B("span",null,ve),X(fe,((e,t)=>t==n?null:B("img",{onClick:r,"data-id":t,title:"Dock to "+e,key:t}))),B("img",{onClick:s,title:"Close"}))},Kt=({s:e})=>{var t;const n=null!=(t=l.useValue(Ce,e))?t:1;return l.useValue(ke,e)?B("main",{"data-position":n},B(Gt,{s:e}),B(Ut,null,B(Ht,{s:e}))):null},Xt=e=>t=>{return l=(t,l)=>t+e(l),nl(t).reduce(l,0);var l},Yt=e=>{var t;return null!=(t=null==e?void 0:e.size)?t:0},Zt=Xt(Yt),_t=Xt(Zt),el=Xt(_t),tl=(e,t)=>{var l;return null!=(l=null==e?void 0:e.has(t))&&l},ll=e=>P(e)||0==Yt(e),nl=e=>{var t;return[...null!=(t=null==e?void 0:e.values())?t:[]]},sl=e=>e.clear(),rl=(e,t)=>null==e?void 0:e.forEach(t),al=(e,t)=>null==e?void 0:e.delete(t),ol=e=>new Map(e),il=e=>{var t;return[...null!=(t=null==e?void 0:e.keys())?t:[]]},ul=(e,t)=>null==e?void 0:e.get(t),dl=(e,t)=>rl(e,((e,l)=>t(l,e))),cl=(e,t,l)=>P(l)?(al(e,t),e):null==e?void 0:e.set(t,l),hl=(e,t,l,n)=>(tl(e,t)?null==n||n(ul(e,t)):cl(e,t,l()),ul(e,t)),ml=(e,t,l,n=cl)=>(de(t,((t,n)=>l(e,n,t))),dl(e,(l=>ie(t,l)?0:n(e,l))),e),pl=(e,t,l,n)=>{const s={};return rl(e,((e,r)=>{if(!(null==l?void 0:l(e,r))){const l=t?t(e,r):e;(null==n?void 0:n(l))||(s[r]=l)}})),s},bl=(e,t,l)=>pl(e,(e=>pl(e,t,l)),ll,ce),gl=(e,t,l)=>pl(e,(e=>bl(e,t,l)),ll,ce),vl=(e,t)=>{const l=ol();return rl(e,((e,n)=>{var s;return l.set(n,null!=(s=null==t?void 0:t(e))?s:e)})),l},fl=e=>vl(e,vl),yl=e=>vl(e,fl),Il=(e,t,l,n,s=0)=>N((l?hl:ul)(e,t[s],s>$(t)-2?l:ol),(r=>{if(s>$(t)-2)return(null==n?void 0:n(r))&&cl(e,t[s]),r;const a=Il(r,t,l,n,s+1);return ll(r)&&cl(e,t[s]),a}));var wl=Object.defineProperty,Cl=Object.getOwnPropertySymbols,kl=Object.prototype.hasOwnProperty,xl=Object.prototype.propertyIsEnumerable,Sl=(e,t,l)=>t in e?wl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l,Tl=(e,t,l)=>new Promise(((n,s)=>{var r=e=>{try{o(l.next(e))}catch(e){s(e)}},a=e=>{try{o(l.throw(e))}catch(e){s(e)}},o=e=>e.done?n(e.value):Promise.resolve(e.value).then(r,a);o((l=l.apply(e,t)).next())}));const Vl=ol(),Rl=ol();var Ol=(e,t,l)=>new Promise(((n,s)=>{var r=e=>{try{o(l.next(e))}catch(e){s(e)}},a=e=>{try{o(l.throw(e))}catch(e){s(e)}},o=e=>e.done?n(e.value):Promise.resolve(e.value).then(r,a);o((l=l.apply(e,t)).next())}));const ql="storage",Ml=e=>new Set(j(e)||P(e)?e:[e]),Pl=(e,t)=>null==e?void 0:e.add(t),Nl=/^\d+$/,Ll=()=>{const e=[];let t=0;return[l=>{var n;return null!=(n=l?_(e):null)?n:s+t++},t=>{Nl.test(t)&&$(e)<1e3&&Z(e,t)}]},El=e=>[e,e],jl=(e,t=Zt)=>t(e[0])+t(e[1]),zl=()=>[ol(),ol()],$l=e=>[...e],Al=([e,t])=>e===t;ol(X("-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz".split(s),((e,t)=>[e,t])));const Fl=(e,t,l)=>cl(e,t,ul(e,t)==-l?void 0:l),Jl=()=>{let e,t,l=!1,n=!1,r=0,a=[];const i=ol(),h=ol(),x=ol(),S=ol(),V=ol(),R=ol(),O=ol(),q=ol(),M=ol(),A=ol(),F=ol(),J=ol(),B=ol(),D=ol(),Q=Ml(),H=ol(),W=ol(),U=ol(),Y=ol(),_=zl(),ee=zl(),te=zl(),le=zl(),ne=zl(),se=zl(),re=zl(),oe=zl(),me=zl(),ge=zl(),ve=zl(),fe=zl(),ye=zl(),Ie=zl(),we=zl(),Ce=zl(),ke=zl(),xe=zl(),Se=zl(),Te=zl(),Ve=zl(),Re=zl(),Oe=ol(),qe=zl(),[Me,Pe,Ne,Le]=(()=>{let e;const[t,l]=Ll(),n=ol();return[(l,r,a,o=[],i=()=>[])=>{null!=e||(e=Vl);const u=t(1);return cl(n,u,[l,r,a,o,i]),Pl(Il(r,null!=a?a:[s],Ml),u),u},(t,l,...r)=>K(((e,t=[s])=>{const l=[],n=(e,s)=>s==$(t)?Z(l,e):null===t[s]?rl(e,(e=>n(e,s+1))):K([t[s],null],(t=>n(ul(e,t),s+1)));return n(e,0),l})(t,l),(t=>rl(t,(t=>ul(n,t)[0](e,...null!=l?l:[],...r))))),e=>N(ul(n,e),(([,t,r])=>(Il(t,null!=r?r:[s],void 0,(t=>(al(t,e),ll(t)?1:0))),cl(n,e),l(e),r))),t=>N(ul(n,t),(([t,,l=[],n,s])=>{const r=(...a)=>{var o,i;const u=$(a);u==$(l)?t(e,...a,...s(a)):P(l[u])?K(null!=(i=null==(o=n[u])?void 0:o.call(n,...a))?i:[],(e=>r(...a,e))):r(...a,l[u])};r()}))]})(),Ee=e=>{if(!he(e,((e,t)=>[u,d].includes(t))))return!1;const t=e[u];return!(!L(t)&&t!=o||(Xe(e[d])!=t&&ue(e,d),0))},je=j,ze=(t,l)=>(!e||tl(F,l)||gt(l))&&he(t,((e,t)=>$e(l,t,e)),(()=>gt(l))),$e=(e,t,l,n)=>he(n?l:Be(l,e,t),((n,s)=>N(Ae(e,t,s,n),(e=>(l[s]=e,!0)),(()=>!1))),(()=>gt(e,t))),Ae=(t,l,n,s)=>e?N(ul(ul(F,t),n),(e=>Xe(s)!=e[u]?gt(t,l,n,s,e[d]):s),(()=>gt(t,l,n,s))):P(Xe(s))?gt(t,l,n,s):s,Fe=(e,t)=>he(t?e:De(e),((t,l)=>N(Je(l,t),(t=>(e[l]=t,!0)),(()=>!1))),(()=>vt())),Je=(e,l)=>t?N(ul(B,e),(t=>Xe(l)!=t[u]?vt(e,l,t[d]):l),(()=>vt(e,l))):P(Xe(l))?vt(e,l):l,Be=(e,t,l)=>(N(ul(J,t),(([n,s])=>{rl(n,((t,l)=>{ie(e,l)||(e[l]=t)})),rl(s,(n=>{ie(e,n)||gt(t,l,n)}))})),e),De=e=>(t&&(rl(D,((t,l)=>{ie(e,l)||(e[l]=t)})),rl(Q,(t=>{ie(e,t)||vt(t)}))),e),Qe=e=>ml(F,e,((e,t,l)=>{const n=ol(),s=Ml();ml(hl(F,t,ol),l,((e,t,l)=>{cl(e,t,l),N(l[d],(e=>cl(n,t,e)),(()=>Pl(s,t)))})),cl(J,t,[n,s])}),((e,t)=>{cl(F,t),cl(J,t)})),He=e=>ml(B,e,((e,t,l)=>{cl(B,t,l),N(l[d],(e=>cl(D,t,e)),(()=>Pl(Q,t)))}),((e,t)=>{cl(B,t),cl(D,t),al(Q,t)})),We=e=>ce(e)?Kt():Qt(e),Ue=e=>ml(U,e,((e,t,l)=>Ge(t,l)),((e,t)=>at(t))),Ge=(e,t)=>ml(hl(U,e,(()=>(dt(e,1),cl(H,e,Ll()),cl(W,e,ol()),ol()))),t,((t,l,n)=>Ke(e,t,l,n)),((t,l)=>ot(e,t,l))),Ke=(e,t,l,n,s)=>ml(hl(t,l,(()=>(ct(e,l,1),ol()))),n,((t,n,s)=>_e(e,l,t,n,s)),((n,r)=>it(e,t,l,n,r,s))),_e=(e,t,l,n,s)=>{tl(l,n)||ht(e,t,n,1);const r=ul(l,n);s!==r&&(mt(e,t,n,r,s),cl(l,n,s))},et=(e,t,l,n,s)=>N(ul(t,l),(t=>_e(e,l,t,n,s)),(()=>Ke(e,t,l,Be({[n]:s},e,l)))),tt=e=>ce(e)?wl():Ht(e),lt=e=>ml(Y,e,((e,t,l)=>nt(t,l)),((e,t)=>ut(t))),nt=(e,t)=>{tl(Y,e)||pt(e,1);const l=ul(Y,e);t!==l&&(bt(e,l,t),cl(Y,e,t))},st=(e,t)=>{const[l]=ul(H,e),n=l(t);return tl(ul(U,e),n)?st(e,t):n},rt=e=>{var t;return null!=(t=ul(U,e))?t:Ge(e,{})},at=e=>Ge(e,{}),ot=(e,t,l)=>{const[,n]=ul(H,e);n(l),Ke(e,t,l,{},!0)},it=(e,t,l,n,s,r)=>{var a;const o=ul(null==(a=ul(J,e))?void 0:a[0],s);if(!P(o)&&!r)return _e(e,l,n,s,o);const i=t=>{mt(e,l,t,ul(n,t)),ht(e,l,t,-1),cl(n,t)};P(o)?i(s):dl(n,i),ll(n)&&(ct(e,l,-1),ll(cl(t,l))&&(dt(e,-1),cl(U,e),cl(H,e),cl(W,e)))},ut=e=>{const t=ul(D,e);if(!P(t))return nt(e,t);bt(e,ul(Y,e)),pt(e,-1),cl(Y,e)},dt=(e,t)=>Fl(i,e,t),ct=(e,t,l)=>Fl(hl(S,e,ol),t,l)&&cl(x,e,hl(x,e,(()=>0))+l),ht=(e,t,l,n)=>{var s;const r=ul(W,e),a=null!=(s=ul(r,l))?s:0;(0==a&&1==n||1==a&&-1==n)&&Fl(hl(h,e,ol),l,n),cl(r,l,a!=-n?a+n:null),Fl(hl(hl(V,e,ol),t,ol),l,n)},mt=(e,t,l,n,s)=>{var r;hl(hl(hl(R,e,ol),t,ol),l,(()=>[n,0]))[1]=s,null==(r=a[3])||r.call(a,e,t,l,s)},pt=(e,t)=>Fl(O,e,t),bt=(e,t,l)=>{var n;hl(q,e,(()=>[t,0]))[1]=l,null==(n=a[4])||n.call(a,e,l)},gt=(e,t,l,n,s)=>(Z(hl(hl(hl(M,e,ol),t,ol),l,(()=>[])),n),s),vt=(e,t,l)=>(Z(hl(A,e,(()=>[])),t),l),ft=(e,t,l)=>N(ul(ul(ul(R,e),t),l),(([e,t])=>[!0,e,t]),(()=>[!1,...El(Nt(e,t,l))])),yt=e=>N(ul(q,e),(([e,t])=>[!0,e,t]),(()=>[!1,...El(jt(e))])),It=e=>ll(M)||ll(Ce[e])?0:rl(e?yl(M):M,((t,l)=>rl(t,((t,n)=>rl(t,((t,s)=>Pe(Ce[e],[l,n,s],t))))))),wt=e=>ll(A)||ll(ke[e])?0:rl(e?vl(A):A,((t,l)=>Pe(ke[e],[l],t))),Ct=(e,t,l,n)=>{if(!ll(e))return Pe(t,n,(()=>pl(e))),dl(e,((e,t)=>Pe(l,[...null!=n?n:[],e],1==t))),1},kt=e=>{const t=zt();t!=l&&Pe(_[e],void 0,t);const n=ll(ge[e]),s=ll(ye[e])&&ll(Ie[e])&&ll(me[e])&&ll(ve[e])&&ll(se[e])&&ll(re[e])&&ll(oe[e])&&n&&ll(te[e])&&ll(le[e]),r=ll(we[e])&&ll(fe[e])&&ll(ne[e])&&ll(ee[e]);if(!s||!r){const t=e?[vl(i),fl(h),vl(x),fl(S),yl(V),yl(R)]:[i,h,x,S,V,R];if(!s){Ct(t[0],te[e],le[e]),rl(t[1],((t,l)=>Ct(t,se[e],re[e],[l]))),rl(t[2],((t,l)=>{0!=t&&Pe(oe[e],[l],Ot(l))}));const l=Ml();rl(t[3],((t,s)=>{Ct(t,me[e],ve[e],[s])&&!n&&(Pe(ge[e],[s,null]),Pl(l,s))})),n||rl(t[5],((t,n)=>{if(!tl(l,n)){const l=Ml();rl(t,(e=>rl(e,(([t,n],s)=>n!==t?Pl(l,s):al(e,s))))),rl(l,(t=>Pe(ge[e],[n,t])))}})),rl(t[4],((t,l)=>rl(t,((t,n)=>Ct(t,ye[e],Ie[e],[l,n])))))}if(!r){let l;rl(t[5],((t,n)=>{let s;rl(t,((t,r)=>{let a;rl(t,(([t,o],i)=>{o!==t&&(Pe(we[e],[n,r,i],o,t,ft),l=s=a=1)})),a&&Pe(fe[e],[n,r],ft)})),s&&Pe(ne[e],[n],ft)})),l&&Pe(ee[e],void 0,ft)}}},xt=e=>{const t=Bt();t!=n&&Pe(xe[e],void 0,t);const l=ll(Te[e])&&ll(Ve[e]),s=ll(Re[e])&&ll(Se[e]);if(!l||!s){const t=e?[vl(O),vl(q)]:[O,q];if(l||Ct(t[0],Te[e],Ve[e]),!s){let l;rl(t[1],(([t,n],s)=>{n!==t&&(Pe(Re[e],[s],n,t,yt),l=1)})),l&&Pe(Se[e],void 0,yt)}}},St=(e,...t)=>(xl((()=>e(...X(t,T)))),Vl),Tt=()=>gl(U),Vt=()=>il(U),Rt=e=>il(ul(W,T(e))),Ot=e=>Yt(ul(U,T(e))),qt=e=>il(ul(U,T(e))),Mt=(e,t,l,n=0,s)=>{return X(z(G((r=ul(U,T(e)),a=(e,l)=>[P(t)?l:ul(e,T(t)),l],X([...null!=(o=null==r?void 0:r.entries())?o:[]],(([e,t])=>a(t,e)))),(([e],[t])=>{return((null!=(n=e)?n:0)<(null!=(s=t)?s:0)?-1:1)*(l?-1:1);var n,s})),n,P(s)?s:n+s),(([,e])=>e));var r,a,o},Pt=(e,t)=>il(ul(ul(U,T(e)),T(t))),Nt=(e,t,l)=>ul(ul(ul(U,T(e)),T(t)),T(l)),Lt=()=>pl(Y),Et=()=>il(Y),jt=e=>ul(Y,T(e)),zt=()=>!ll(U),$t=e=>tl(U,T(e)),At=(e,t)=>tl(ul(W,T(e)),T(t)),Ft=(e,t)=>tl(ul(U,T(e)),T(t)),Jt=(e,t,l)=>tl(ul(ul(U,T(e)),T(t)),T(l)),Bt=()=>!ll(Y),Dt=e=>tl(Y,T(e)),Qt=e=>St((()=>(e=>he(e,ze,gt))(e)?Ue(e):0)),Ht=e=>St((()=>Fe(e)?lt(e):0)),Wt=e=>{try{We(pe(e))}catch(e){}return Vl},Ut=t=>St((()=>{if((e=he(t,(e=>he(e,Ee))))&&(Qe(t),!ll(U))){const e=Tt();Kt(),Qt(e)}})),Gt=e=>St((()=>{if(t=(e=>he(e,Ee))(e)){const l=Lt();kl(),wl(),t=!0,He(e),Ht(l)}})),Kt=()=>St((()=>Ue({}))),Xt=e=>St((e=>tl(U,e)?at(e):0),e),nl=(e,t)=>St(((e,t)=>N(ul(U,e),(l=>tl(l,t)?ot(e,l,t):0))),e,t),wl=()=>St((()=>lt({}))),Cl=()=>St((()=>{Qe({}),e=!1})),kl=()=>St((()=>{He({}),t=!1})),xl=(e,t)=>{if(-1!=r){Sl();const l=e();return Tl(t),l}},Sl=()=>{var e;return-1!=r&&r++,1==r&&(null==(e=a[0])||e.call(a),Pe(Oe)),Vl},Tl=e=>{var t,s;return r>0&&(r--,0==r&&(r=1,It(1),ll(R)||kt(1),wt(1),ll(q)||xt(1),(null==e?void 0:e(Vl))&&(rl(R,((e,t)=>rl(e,((e,l)=>rl(e,(([e],n)=>Ye(Vl,t,l,n,e))))))),sl(R),rl(q,(([e],t)=>Ze(Vl,t,e))),sl(q)),Pe(qe[0],void 0),r=-1,It(0),ll(R)||kt(0),wt(0),ll(q)||xt(0),null==(t=a[1])||t.call(a),Pe(qe[1],void 0),null==(s=a[2])||s.call(a),r=0,l=zt(),n=Bt(),K([i,h,x,S,V,R,M,O,q,A],sl))),Vl},Vl={getContent:()=>[Tt(),Lt()],getTables:Tt,getTableIds:Vt,getTable:e=>bl(ul(U,T(e))),getTableCellIds:Rt,getRowCount:Ot,getRowIds:qt,getSortedRowIds:Mt,getRow:(e,t)=>pl(ul(ul(U,T(e)),T(t))),getCellIds:Pt,getCell:Nt,getValues:Lt,getValueIds:Et,getValue:jt,hasTables:zt,hasTable:$t,hasTableCell:At,hasRow:Ft,hasCell:Jt,hasValues:Bt,hasValue:Dt,getTablesJson:()=>be(U),getValuesJson:()=>be(Y),getJson:()=>be([U,Y]),getTablesSchemaJson:()=>be(F),getValuesSchemaJson:()=>be(B),getSchemaJson:()=>be([F,B]),hasTablesSchema:()=>e,hasValuesSchema:()=>t,setContent:e=>St((()=>je(e)?(([e,t])=>{(ce(e)?Kt:Qt)(e),(ce(t)?wl:Ht)(t)})(e):0)),setTables:Qt,setTable:(e,t)=>St((e=>ze(t,e)?Ge(e,t):0),e),setRow:(e,t,l)=>St(((e,t)=>$e(e,t,l)?Ke(e,rt(e),t,l):0),e,t),addRow:(e,t,l=!0)=>xl((()=>{let n;return $e(e,n,t)&&(e=T(e),Ke(e,rt(e),n=st(e,l?1:0),t)),n})),setPartialRow:(e,t,l)=>St(((e,t)=>{if($e(e,t,l,1)){const n=rt(e);de(l,((l,s)=>et(e,n,t,s,l)))}}),e,t),setCell:(e,t,l,n)=>St(((e,t,l)=>N(Ae(e,t,l,E(n)?n(Nt(e,t,l)):n),(n=>et(e,rt(e),t,l,n)))),e,t,l),setValues:Ht,setPartialValues:e=>St((()=>Fe(e,1)?de(e,((e,t)=>nt(t,e))):0)),setValue:(e,t)=>St((e=>N(Je(e,E(t)?t(jt(e)):t),(t=>nt(e,t)))),e),applyChanges:e=>St((()=>{de(e[0],((e,t)=>P(e)?Xt(t):de(e,((e,l)=>P(e)?nl(t,l):de(e,((e,n)=>Ye(Vl,t,l,n,e))))))),de(e[1],((e,t)=>Ze(Vl,t,e)))})),setTablesJson:Wt,setValuesJson:e=>{try{tt(pe(e))}catch(e){}return Vl},setJson:e=>St((()=>{try{const[t,l]=pe(e);We(t),tt(l)}catch(t){Wt(e)}})),setTablesSchema:Ut,setValuesSchema:Gt,setSchema:(e,t)=>St((()=>{Ut(e),Gt(t)})),delTables:Kt,delTable:Xt,delRow:nl,delCell:(e,t,l,n)=>St(((e,t,l)=>N(ul(U,e),(s=>N(ul(s,t),(r=>tl(r,l)?it(e,s,t,r,l,n):0))))),e,t,l),delValues:wl,delValue:e=>St((e=>tl(Y,e)?ut(e):0),e),delTablesSchema:Cl,delValuesSchema:kl,delSchema:()=>St((()=>{Cl(),kl()})),transaction:xl,startTransaction:Sl,getTransactionChanges:()=>[pl(R,((e,t)=>-1===ul(i,t)?void 0:pl(e,((e,l)=>-1===ul(ul(S,t),l)?void 0:pl(e,(([,e])=>e),(e=>Al(e)))),ll,ce)),ll,ce),pl(q,(([,e])=>e),(e=>Al(e))),1],getTransactionLog:()=>[!ll(R),!ll(q),gl(R,$l,Al),gl(M),pl(q,$l,Al),pl(A),pl(i),bl(S),gl(V),pl(O)],finishTransaction:Tl,forEachTable:e=>rl(U,((t,l)=>e(l,(e=>rl(t,((t,l)=>e(l,(e=>dl(t,e))))))))),forEachTableCell:(e,t)=>dl(ul(W,T(e)),t),forEachRow:(e,t)=>rl(ul(U,T(e)),((e,l)=>t(l,(t=>dl(e,t))))),forEachCell:(e,t,l)=>dl(ul(ul(U,T(e)),T(t)),l),forEachValue:e=>dl(Y,e),addSortedRowIdsListener:(e,t,l,n,s,r,a)=>{let o=Mt(e,t,l,n,s);return Me((()=>{const a=Mt(e,t,l,n,s);var i,u,d;u=o,$(i=a)===$(u)&&(d=(e,t)=>u[t]===e,i.every(d))||(o=a,r(Vl,e,t,l,n,s,o))}),ge[a?1:0],[e,t],[Vt])},addStartTransactionListener:e=>Me(e,Oe),addWillFinishTransactionListener:e=>Me(e,qe[0]),addDidFinishTransactionListener:e=>Me(e,qe[1]),callListener:e=>(Le(e),Vl),delListener:e=>(Ne(e),Vl),getListenerStats:()=>({hasTables:jl(_),tables:jl(ee),tableIds:jl(te),hasTable:jl(le),table:jl(ne),tableCellIds:jl(se),hasTableCell:jl(re,_t),rowCount:jl(oe),rowIds:jl(me),sortedRowIds:jl(ge),hasRow:jl(ve,_t),row:jl(fe,_t),cellIds:jl(ye,_t),hasCell:jl(Ie,el),cell:jl(we,el),invalidCell:jl(Ce,el),hasValues:jl(xe),values:jl(Se),valueIds:jl(Te),hasValue:jl(Ve),value:jl(Re),invalidValue:jl(ke),transaction:Zt(Oe)+jl(qe)}),isMergeable:()=>!1,createStore:Jl,addListener:Me,callListeners:Pe,setInternalListeners:(e,t,l,n,s)=>a=[e,t,l,n,s]};return de({[c+p]:[0,_,[],()=>[zt()]],[p]:[0,ee],[b]:[0,te],[c+m]:[1,le,[Vt],e=>[$t(...e)]],[m]:[1,ne,[Vt]],[m+I]:[1,se,[Vt]],[c+m+y]:[2,re,[Vt,Rt],e=>[At(...e)]],[v]:[1,oe,[Vt]],[f]:[1,me,[Vt]],[c+g]:[2,ve,[Vt,qt],e=>[Ft(...e)]],[g]:[2,fe,[Vt,qt]],[I]:[2,ye,[Vt,qt]],[c+y]:[3,Ie,[Vt,qt,Pt],e=>[Jt(...e)]],[y]:[3,we,[Vt,qt,Pt],e=>El(Nt(...e))],InvalidCell:[3,Ce],[c+C]:[0,xe,[],()=>[Bt()]],[C]:[0,Se],[k]:[0,Te],[c+w]:[1,Ve,[Et],e=>[Dt(...e)]],[w]:[1,Re,[Et],e=>El(jt(e[0]))],InvalidValue:[1,ke]},(([e,t,l,n],s)=>{Vl["add"+s+"Listener"]=(...s)=>Me(s[e],t[s[e+1]?1:0],e>0?z(s,0,e):void 0,l,n)})),ae(Vl)};e.Inspector=({position:e="right",open:t=!1})=>{const n=l.useCreateStore(Jl),s=fe.indexOf(e);return l.useCreatePersister(n,(e=>{return t=ge,l=sessionStorage,((e,t,l,n,s,r,a,o={},i=[])=>{let u,d,c,h=0,m=0,p=0;hl(Vl,i,(()=>0)),hl(Rl,i,(()=>[]));const[b,g,v,f,y]=((e=1,t)=>1!=e&&t.isMergeable()?[1,t.getMergeableContent,t.getTransactionMergeableChanges,([[e],[t]])=>!ce(e)||!ce(t),t.setDefaultContent]:2!=e?[0,t.getContent,t.getTransactionChanges,([e,t])=>!ce(e)||!ce(t),t.setContent]:A("Store type not supported by this Persister"))(a,e),I=t=>{(b&&j(null==t?void 0:t[0])?1===(null==t?void 0:t[2])?e.applyMergeableChanges:e.setMergeableContent:1===(null==t?void 0:t[2])?e.applyChanges:e.setContent)(t)},w=e=>Tl(void 0,null,(function*(){return 2!=h&&(h=1,m++,yield S((()=>Tl(void 0,null,(function*(){try{const e=yield t();j(e)?I(e):A("Content is not an array "+e)}catch(t){e&&y(e)}h=0}))))),T})),C=()=>(d&&(s(d),d=void 0),T),k=e=>Tl(void 0,null,(function*(){return 1!=h&&(h=2,p++,yield S((()=>Tl(void 0,null,(function*(){try{yield l(g,e)}catch(e){}h=0}))))),T})),x=()=>(N(c,e.delListener),c=void 0,T),S=(...e)=>Tl(void 0,null,(function*(){return Z(ul(Rl,i),...e),yield Tl(void 0,null,(function*(){if(!ul(Vl,i)){for(cl(Vl,i,1);!P(u=_(ul(Rl,i)));)try{yield u()}catch(e){}cl(Vl,i,0)}})),T})),T=((e,t)=>{for(var l in t||(t={}))kl.call(t,l)&&Sl(e,l,t[l]);if(Cl)for(var l of Cl(t))xl.call(t,l)&&Sl(e,l,t[l]);return e})({load:w,startAutoLoad:e=>Tl(void 0,null,(function*(){yield C().load(e);try{d=yield n(((e,t)=>Tl(void 0,null,(function*(){t||e?2!=h&&(h=1,m++,I(null!=t?t:e),h=0):yield w()}))))}catch(e){}return T})),stopAutoLoad:C,isAutoLoading:()=>!P(d),save:k,startAutoSave:()=>Tl(void 0,null,(function*(){return yield x().save(),c=e.addDidFinishTransactionListener((()=>{const e=v();f(e)&&k(e)})),T})),stopAutoSave:x,isAutoSaving:()=>!P(c),schedule:S,getStore:()=>e,destroy:()=>(ul(Rl,i).splice(0,void 0),C().stopAutoSave()),getStats:()=>({loads:m,saves:p})},o);return ae(T)})(e,(()=>Ol(void 0,null,(function*(){return e=l.getItem(t),pe(e,((e,t)=>""===t?void 0:t));var e}))),(e=>Ol(void 0,null,(function*(){return l.setItem(t,(n=e(),me(n,((e,t)=>void 0===t?"":t))));var n}))),(e=>{const n=n=>{if(n.storageArea===l&&n.key===t)try{e(pe(n.newValue))}catch(t){e()}};return V.addEventListener(ql,n),n}),(e=>V.removeEventListener(ql,e)),0,3,{getStorageName:()=>t});var t,l}),void 0,(e=>{return l=function*(){yield e.load([{},{position:-1==s?1:s,open:!!t}]),yield e.startAutoSave()},new Promise(((e,t)=>{var n=e=>{try{r(l.next(e))}catch(e){t(e)}},s=e=>{try{r(l.throw(e))}catch(e){t(e)}},r=t=>t.done?e(t.value):Promise.resolve(t.value).then(n,s);r((l=l.apply(void 0,null)).next())}));var l})),B(J,null,B("aside",{id:ge},B(Ge,{s:n}),B(Kt,{s:n})),B("style",null,Ue))}},"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("../ui-react/index.js")):"function"==typeof define&&define.amd?define(["exports","react","../ui-react"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).TinyBaseUiReactInspector={},e.React,e.TinyBaseUiReact);
|
|
1
|
+
var e,t;e=this,t=function(e,t,l){"use strict";const n=e=>typeof e,s="",r=n(s),a=n(!0),o=n(0),i=n(n),u="type",d="default",c="Has",h="Ids",m="Table",p=m+"s",b=m+h,g="Row",v=g+"Count",f=g+h,y="Cell",I=y+h,w="Value",C=w+"s",k=w+h,x="currentTarget",S="value",T=e=>s+e,V=globalThis.window,R=Math,O=R.min,q=R.floor,M=isFinite,P=e=>null==e,N=(e,t,l)=>P(e)?null==l?void 0:l():t(e),L=e=>e==r||e==a,E=e=>n(e)==i,j=e=>Array.isArray(e),z=(e,t,l)=>e.slice(t,l),$=e=>e.length,A=e=>{throw Error(e)},{PureComponent:F,Fragment:J,createElement:B,useCallback:D,useLayoutEffect:Q,useRef:H,useState:W}=t,U=(e,...t)=>P(e)?{}:e(...t),G=(e,t)=>e.sort(t),K=(e,t)=>e.forEach(t),X=(e,t)=>e.map(t),Y=e=>0==$(e),Z=(e,...t)=>e.push(...t),_=e=>e.shift(),ee=Object,te=e=>ee.getPrototypeOf(e),le=ee.entries,ne=ee.isFrozen,se=e=>!P(e)&&N(te(e),(e=>e==ee.prototype||P(te(e))),(()=>!0)),re=ee.keys,ae=ee.freeze,oe=(e=[])=>ee.fromEntries(e),ie=(e,t)=>t in e,ue=(e,t)=>(delete e[t],e),de=(e,t)=>X(le(e),(([e,l])=>t(l,e))),ce=e=>se(e)&&0==(e=>$(re(e)))(e),he=(e,t,l,n=0)=>P(e)||!se(e)||!n&&ce(e)||ne(e)?(null==l||l(),!1):(de(e,((l,n)=>{t(l,n)||ue(e,n)})),!!n||!ce(e)),me=JSON.stringify,pe=JSON.parse,be=e=>me(e,((e,t)=>t instanceof Map?ee.fromEntries([...t]):t)),ge="tinybaseInspector",ve="TinyBase Inspector",fe=["left","top","bottom","right","full"],ye="state",Ie="sort",we="open",Ce="position",ke=we,xe="editable",Se=(...e)=>be(e),Te=(e,t)=>X(G([...e]),t),Ve=(e,t)=>[!!l.useCell(ye,e,xe,t),D((l=>{t.setCell(ye,e,xe,(e=>!e)),l.preventDefault()}),[t,e])],Re="M20 80l5-15l40-40l10 10l-40 40l-15 5m5-15l10 10",Oe='content:url("',qe=Oe+"data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' stroke-width='4' stroke='white' fill='none'>",Me='</svg>")',Pe=Oe+"data:image/svg+xml,%3csvg viewBox='0 0 680 680' xmlns='http://www.w3.org/2000/svg' style='width:680px%3bheight:680px'%3e %3cpath stroke='white' stroke-width='80' fill='none' d='M340 617a84 241 90 11.01 0zM131 475a94 254 70 10428-124 114 286 70 01-428 124zm0-140a94 254 70 10428-124 114 286 70 01-428 124zm-12-127a94 254 70 00306 38 90 260 90 01-306-38zm221 3a74 241 90 11.01 0z' /%3e %3cpath fill='%23d81b60' d='M131 475a94 254 70 10428-124 114 286 70 01-428 124zm0-140a94 254 70 10428-124 114 286 70 01-428 124z' /%3e %3cpath d='M249 619a94 240 90 00308-128 114 289 70 01-308 128zM119 208a94 254 70 00306 38 90 260 90 01-306-38zm221 3a74 241 90 11.01 0z' /%3e%3c/svg%3e\")",Ne=X([[20,20,20,60],[20,20,60,20],[20,60,60,20],[60,20,20,60],[30,30,40,40]],(([e,t,l,n])=>qe+`<rect x='20' y='20' width='60' height='60' fill='grey'/><rect x='${e}' y='${t}' width='${l}' height='${n}' fill='white'/>`+Me)),Le=qe+"<path d='M20 20l60 60M20 80l60-60' />"+Me,Ee=qe+`<path d='${Re}' />`+Me,je=qe+`<path d='${Re}M20 20l60 60' />`+Me;var ze=Object.defineProperty,$e=Object.defineProperties,Ae=Object.getOwnPropertyDescriptors,Fe=Object.getOwnPropertySymbols,Je=Object.prototype.hasOwnProperty,Be=Object.prototype.propertyIsEnumerable,De=(e,t,l)=>t in e?ze(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l,Qe=(e,t)=>{for(var l in t||(t={}))Je.call(t,l)&&De(e,l,t[l]);if(Fe)for(var l of Fe(t))Be.call(t,l)&&De(e,l,t[l]);return e},He=(e,t)=>$e(e,Ae(t));const We="*::-webkit-scrollbar",Ue=((e,t="")=>e.join(t))(de(He(Qe(He(Qe(He(Qe({"":"all:initial;font-family:sans-serif;font-size:0.75rem;position:fixed;z-index:999999","*":"all:revert","*::before":"all:revert","*::after":"all:revert",[We]:"width:0.5rem;height:0.5rem;",[We+"-track"]:"background:#111",[We+"-thumb"]:"background:#999;border:1px solid #111",[We+"-thumb:hover"]:"background:#fff",[We+"-corner"]:"background:#111",img:"width:1rem;height:1rem;background:#111;border:0;vertical-align:text-bottom",">img":"padding:0.25rem;bottom:0;right:0;position:fixed;"+Pe},oe(X(["bottom:0;left:0","top:0;right:0"],((e,t)=>[`>img[data-position='${t}']`,e])))),{main:"display:flex;flex-direction:column;background:#111d;color:#fff;position:fixed;"}),oe(X(["bottom:0;left:0;width:35vw;height:100vh","top:0;right:0;width:100vw;height:30vh","bottom:0;left:0;width:100vw;height:30vh","top:0;right:0;width:35vw;height:100vh","top:0;right:0;width:100vw;height:100vh"],((e,t)=>[`main[data-position='${t}']`,e])))),{header:"display:flex;padding:0.25rem;background:#000;align-items:center","header>img:nth-of-type(1)":Pe,"header>img:nth-of-type(6)":Le}),oe(X(Ne,((e,t)=>[`header>img[data-id='${t}']`,e])))),{"header>span":"flex:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;margin-left:0.25rem",article:"padding:0.25rem 0.25rem 0.25rem 0.5rem;overflow:auto;flex:1",details:"margin-left:0.75rem;width:fit-content;","details img":"display:none","details[open]>summary img":"display:unset;background:none;margin-left:0.25rem","details[open]>summary img.edit":Ee,"details[open]>summary img.done":je,summary:"margin-left:-0.75rem;line-height:1.25rem;user-select:none;width:fit-content",table:"border-collapse:collapse;table-layout:fixed;margin-bottom:0.5rem","table input":"background:#111;color:unset;padding:0 0.25rem;border:0;font-size:unset;vertical-align:top;margin:0",'table input[type="number"]':"width:4rem","table tbody button":"font-size:0;background:#fff;border-radius:50%;margin:0 0.125rem 0 0;width:0.85rem;color:#111","table button:first-letter":"font-size:0.75rem",thead:"background:#222","th:nth-of-type(1)":"min-width:2rem;","th.sorted":"background:#000","table caption":"text-align:left;white-space:nowrap;line-height:1.25rem",button:"width:1.5rem;border:none;background:none;color:#fff;padding:0","button[disabled]":"color:#777","button.next":"margin-right:0.5rem",[`th,#${ge} td`]:"overflow:hidden;text-overflow:ellipsis;padding:0.25rem 0.5rem;max-width:12rem;white-space:nowrap;border-width:1px 0;border-style:solid;border-color:#777;text-align:left","span.warn":"margin:0.25rem;color:#d81b60"}),((e,t)=>e?`#${ge} ${t}{${e}}`:""))),Ge=({s:e})=>{var t;const n=null!=(t=l.useValue(Ce,e))?t:1,s=l.useSetValueCallback(ke,(()=>!0),[],e);return l.useValue(ke,e)?null:B("img",{onClick:s,title:ve,"data-position":n})},Ke=({uniqueId:e,summary:t,editable:n,handleEditable:s,children:r,s:a})=>{const o=!!l.useCell(ye,e,we,a),i=l.useSetCellCallback(ye,e,we,(e=>e[x].open),[],a);return B("details",{open:o,onToggle:i},B("summary",null,t,s?B("img",{onClick:s,className:n?"done":"edit"}):null),r)},Xe=e=>{const t=n(e);return L(t)||t==o&&M(e)?t:void 0},Ye=(e,t,l,n,s)=>P(s)?e.delCell(t,l,n,!0):e.setCell(t,l,n,s),Ze=(e,t,l)=>P(l)?e.delValue(t):e.setValue(t,l),_e=(e,t,l,n)=>e==r?t:e==o?l:n;var et=Object.defineProperty,tt=Object.defineProperties,lt=Object.getOwnPropertyDescriptors,nt=Object.getOwnPropertySymbols,st=Object.prototype.hasOwnProperty,rt=Object.prototype.propertyIsEnumerable,at=(e,t,l)=>t in e?et(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l,ot=(e,t)=>{for(var l in t||(t={}))st.call(t,l)&&at(e,l,t[l]);if(nt)for(var l of nt(t))rt.call(t,l)&&at(e,l,t[l]);return e},it=(e,t)=>tt(e,lt(t)),ut=(e,t)=>{var l={};for(var n in e)st.call(e,n)&&t.indexOf(n)<0&&(l[n]=e[n]);if(null!=e&&nt)for(var n of nt(e))t.indexOf(n)<0&&rt.call(e,n)&&(l[n]=e[n]);return l};const{useCallback:dt,useMemo:ct,useState:ht}=t,mt="editable",pt=(e,t)=>X(l.useTableCellIds(e,t),(t=>e+"."+t)),bt=(e,t,l)=>{const n=dt(e,t);return l?n:void 0},gt=(...e)=>ct((()=>e),e),vt=(e,t)=>ct((()=>({store:e,tableId:t})),[e,t]),ft=(e,t)=>ct((()=>({queries:e,queryId:t})),[e,t]),yt=(e,t=!1,l,n=0,s,r,a,o)=>{const[[i,u,d],c]=ht([e,t,n]),h=dt((e=>{c(e),null==o||o(e)}),[o]),m=bt((e=>h([e,e==i&&!u,d])),[h,i,u,d],l),p=dt((e=>h([i,u,e])),[h,i,u]),b=!0===a?Pt:a;return[[i,u,d],m,ct((()=>!1===a?null:B(b,{offset:d,limit:s,total:r,onChange:p})),[a,b,d,s,r,p])]},It=(e,t,l)=>ct((()=>{const s=null!=t?t:e;return a=j(s)?oe(X(s,(e=>[e,e]))):s,o=(e,t)=>ot(ot({},{label:t,component:l}),n(e)==r?{label:e}:e),oe(de(a,((e,t)=>[t,o(e,t)])));var a,o}),[t,l,e]),wt=({className:e,headerRow:t,idColumn:l,params:[n,s,r,a,o,i]})=>B("table",{className:e},i?B("caption",null,i):null,!1===t?null:B("thead",null,B("tr",null,!1===l?null:B(Ct,{sort:null!=a?a:[],label:"Id",onClick:o}),de(n,(({label:e},t)=>B(Ct,{key:t,cellId:t,label:e,sort:null!=a?a:[],onClick:o}))))),B("tbody",null,X(r,(e=>B("tr",{key:e},!1===l?null:B("th",null,e),de(n,(({component:t,getComponentProps:l},n)=>B("td",{key:n},B(t,it(ot(ot({},U(l,e,n)),s),{rowId:e,cellId:n})))))))))),Ct=({cellId:e,sort:[t,l],label:n=(null!=e?e:s),onClick:r})=>B("th",{onClick:bt((()=>null==r?void 0:r(e)),[r,e],r),className:P(l)||t!=e?void 0:`sorted ${l?"de":"a"}scending`},P(l)||t!=e?null:(l?"↓":"↑")+" ",n),kt=({localRowId:e,params:[n,s,r,a,o,i,u]})=>{const d=l.useRemoteRowId(o,e,i);return B("tr",null,!1===n?null:B(t.Fragment,null,B("th",null,e),B("th",null,d)),de(s,(({component:t,getComponentProps:l},n)=>{const[s,o]=n.split(".",2),i=s===r?e:s===a?d:null;return P(i)?null:B("td",{key:n},B(t,it(ot({},U(l,i,o)),{store:u,tableId:s,rowId:i,cellId:o})))})))},xt=({thing:e,onThingChange:t,className:l,hasSchema:n,showType:s=!0})=>{const[i,u]=ht(),[d,c]=ht(),[h,m]=ht(),[p,b]=ht(),[g,v]=ht();d!==e&&(u(Xe(e)),c(e),m(e+""),b(Number(e)||0),v(!!e));const f=dt(((e,l)=>{l(e),c(e),t(e)}),[t]),y=dt((()=>{if(!(null==n?void 0:n())){const e=_e(i,o,a,r),l=_e(e,h,p,g);u(e),c(l),t(l)}}),[n,t,h,p,g,i]);return B("div",{className:l},s?B("button",{className:i,onClick:y},i):null,_e(i,B("input",{key:i,value:h,onChange:dt((e=>f(e[x][S]+"",m)),[f])}),B("input",{key:i,type:"number",value:p,onChange:dt((e=>f(Number(e[x][S]||0),b)),[f])}),B("input",{key:i,type:"checkbox",checked:g,onChange:dt((e=>f(!!e[x].checked,v)),[f])})))},St=e=>{var t=e,{tableId:n,cellId:s,descending:r,offset:a,limit:o,store:i,editable:u,sortOnClick:d,paginator:c=!1,onChange:h,customCells:m}=t,p=ut(t,["tableId","cellId","descending","offset","limit","store","editable","sortOnClick","paginator","onChange","customCells"]);const[b,g,v]=yt(s,r,d,a,o,l.useRowCount(n,i),c,h);return B(wt,it(ot({},p),{params:gt(It(l.useTableCellIds(n,i),m,u?qt:l.CellView),vt(i,n),l.useSortedRowIds(n,...b,o,i),b,g,v)}))},Tt=({store:e,editable:t=!1,valueComponent:n=(t?Mt:l.ValueView),getValueComponentProps:s,className:r,headerRow:a,idColumn:o})=>B("table",{className:r},!1===a?null:B("thead",null,B("tr",null,!1===o?null:B("th",null,"Id"),B("th",null,w))),B("tbody",null,X(l.useValueIds(e),(t=>B("tr",{key:t},!1===o?null:B("th",null,t),B("td",null,B(n,it(ot({},U(s,t)),{valueId:t,store:e})))))))),Vt=e=>{var t=e,{indexId:n,sliceId:s,indexes:r,editable:a,customCells:o}=t,i=ut(t,["indexId","sliceId","indexes","editable","customCells"]);const[u,d,c]=((e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getTableId(t)])(l.useIndexesOrIndexesById(r),n);return B(wt,it(ot({},i),{params:gt(It(l.useTableCellIds(c,d),o,a?qt:l.CellView),vt(d,c),l.useSliceRowIds(n,s,u))}))},Rt=({relationshipId:e,relationships:n,editable:s,customCells:r,className:a,headerRow:o,idColumn:i=!0})=>{const[u,d,c,h]=((e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(t),null==e?void 0:e.getRemoteTableId(t)])(l.useRelationshipsOrRelationshipsById(n),e),m=It([...pt(c,d),...pt(h,d)],r,s?qt:l.CellView),p=gt(i,m,c,h,e,u,d);return B("table",{className:a},!1===o?null:B("thead",null,B("tr",null,!1===i?null:B(t.Fragment,null,B("th",null,c,".Id"),B("th",null,h,".Id")),de(m,(({label:e},t)=>B("th",{key:t},e))))),B("tbody",null,X(l.useRowIds(c,d),(e=>B(kt,{key:e,localRowId:e,params:p})))))},Ot=e=>{var t=e,{queryId:n,cellId:s,descending:r,offset:a,limit:o,queries:i,sortOnClick:u,paginator:d=!1,customCells:c,onChange:h}=t,m=ut(t,["queryId","cellId","descending","offset","limit","queries","sortOnClick","paginator","customCells","onChange"]);const[p,b,g]=yt(s,r,u,a,o,l.useResultRowCount(n,i),d,h);return B(wt,it(ot({},m),{params:gt(It(l.useResultTableCellIds(n,i),c,l.ResultCellView),ft(i,n),l.useResultSortedRowIds(n,...p,o,i),p,b,g)}))},qt=({tableId:e,rowId:t,cellId:n,store:s,className:r,showType:a})=>{var o;return B(xt,{thing:l.useCell(e,t,n,s),onThingChange:l.useSetCellCallback(e,t,n,(e=>e),[],s),className:null!=r?r:mt+y,showType:a,hasSchema:null==(o=l.useStoreOrStoreById(s))?void 0:o.hasTablesSchema})},Mt=({valueId:e,store:t,className:n,showType:s})=>{var r;return B(xt,{thing:l.useValue(e,t),onThingChange:l.useSetValueCallback(e,(e=>e),[],t),className:null!=n?n:mt+w,showType:s,hasSchema:null==(r=l.useStoreOrStoreById(t))?void 0:r.hasValuesSchema})},Pt=({onChange:e,total:l,offset:n=0,limit:s=l,singular:r="row",plural:a=r+"s"})=>{(n>l||n<0)&&(n=0,e(0));const o=bt((()=>e(n-s)),[e,n,s],n>0),i=bt((()=>e(n+s)),[e,n,s],n+s<l);return B(t.Fragment,null,l>s&&B(t.Fragment,null,B("button",{className:"previous",disabled:0==n,onClick:o},"←"),B("button",{className:"next",disabled:n+s>=l,onClick:i},"→"),n+1," to ",O(l,n+s)," of "),l," ",1!=l?a:r)},Nt=({indexes:e,indexesId:t,indexId:n,s:s})=>B(Ke,{uniqueId:Se("i",t,n),summary:"Index: "+n,s:s},X(l.useSliceIds(n,e),(l=>B(Lt,{indexes:e,indexesId:t,indexId:n,sliceId:l,s:s,key:l})))),Lt=({indexes:e,indexesId:t,indexId:l,sliceId:n,s:s})=>{const r=Se("i",t,l,n),[a,o]=Ve(r,s);return B(Ke,{uniqueId:r,summary:"Slice: "+n,editable:a,handleEditable:o,s:s},B(Vt,{sliceId:n,indexId:l,indexes:e,editable:a}))},Et=({indexesId:e,s:t})=>{const n=l.useIndexes(e),s=l.useIndexIds(n);return P(n)?null:B(Ke,{uniqueId:Se("i",e),summary:"Indexes: "+(null!=e?e:d),s:t},Y(s)?"No indexes defined":Te(s,(l=>B(Nt,{indexes:n,indexesId:e,indexId:l,s:t,key:l}))))},jt=({metrics:e,metricId:t})=>B("tr",null,B("th",null,t),B("td",null,null==e?void 0:e.getTableId(t)),B("td",null,l.useMetric(t,e))),zt=({metricsId:e,s:t})=>{const n=l.useMetrics(e),s=l.useMetricIds(n);return P(n)?null:B(Ke,{uniqueId:Se("m",e),summary:"Metrics: "+(null!=e?e:d),s:t},Y(s)?"No metrics defined":B("table",null,B("thead",null,B("th",null,"Metric Id"),B("th",null,"Table Id"),B("th",null,"Metric")),B("tbody",null,X(s,(e=>B(jt,{metrics:n,metricId:e,key:e}))))))},$t=({queries:e,queriesId:t,queryId:n,s:s})=>{var r;const a=Se("q",t,n),[o,i,u]=pe(null!=(r=l.useCell(ye,a,Ie,s))?r:"[]"),d=l.useSetCellCallback(ye,a,Ie,be,[],s);return B(Ke,{uniqueId:a,summary:"Query: "+n,s:s},B(Ot,{queryId:n,queries:e,cellId:o,descending:i,offset:u,limit:10,paginator:!0,sortOnClick:!0,onChange:d}))},At=({queriesId:e,s:t})=>{const n=l.useQueries(e),s=l.useQueryIds(n);return P(n)?null:B(Ke,{uniqueId:Se("q",e),summary:"Queries: "+(null!=e?e:d),s:t},Y(s)?"No queries defined":Te(s,(l=>B($t,{queries:n,queriesId:e,queryId:l,s:t,key:l}))))},Ft=({relationships:e,relationshipsId:t,relationshipId:l,s:n})=>{const s=Se("r",t,l),[r,a]=Ve(s,n);return B(Ke,{uniqueId:s,summary:"Relationship: "+l,editable:r,handleEditable:a,s:n},B(Rt,{relationshipId:l,relationships:e,editable:r}))},Jt=({relationshipsId:e,s:t})=>{const n=l.useRelationships(e),s=l.useRelationshipIds(n);return P(n)?null:B(Ke,{uniqueId:Se("r",e),summary:"Relationships: "+(null!=e?e:d),s:t},Y(s)?"No relationships defined":Te(s,(l=>B(Ft,{relationships:n,relationshipsId:e,relationshipId:l,s:t,key:l}))))},Bt=({tableId:e,store:t,storeId:n,s:s})=>{var r;const a=Se("t",n,e),[o,i,u]=pe(null!=(r=l.useCell(ye,a,Ie,s))?r:"[]"),d=l.useSetCellCallback(ye,a,Ie,be,[],s),[c,h]=Ve(a,s);return B(Ke,{uniqueId:a,summary:m+": "+e,editable:c,handleEditable:h,s:s},B(St,{tableId:e,store:t,cellId:o,descending:i,offset:u,limit:10,paginator:!0,sortOnClick:!0,onChange:d,editable:c}))},Dt=({store:e,storeId:t,s:n})=>{const s=Se("v",t),[r,a]=Ve(s,n);return Y(l.useValueIds(e))?null:B(Ke,{uniqueId:s,summary:C,editable:r,handleEditable:a,s:n},B(Tt,{store:e,editable:r}))},Qt=({storeId:e,s:t})=>{const n=l.useStore(e),s=l.useTableIds(n);return P(n)?null:B(Ke,{uniqueId:Se("s",e),summary:(n.isMergeable()?"Mergeable":"")+"Store: "+(null!=e?e:d),s:t},B(Dt,{storeId:e,store:n,s:t}),Te(s,(l=>B(Bt,{store:n,storeId:e,tableId:l,s:t,key:l}))))},Ht=({s:e})=>{const t=H(null),n=H(0),[s,r]=W(!1),{scrollLeft:a,scrollTop:o}=l.useValues(e);Q((()=>{const e=t.current;if(e&&!s){const t=new MutationObserver((()=>{e.scrollWidth>=q(a)+e.clientWidth&&e.scrollHeight>=q(o)+e.clientHeight&&e.scrollTo(a,o)}));return t.observe(e,{childList:!0,subtree:!0}),()=>t.disconnect()}}),[s,a,o]);const i=D((t=>{const{scrollLeft:l,scrollTop:s}=t[x];cancelIdleCallback(n.current),n.current=requestIdleCallback((()=>{r(!0),e.setPartialValues({scrollLeft:l,scrollTop:s})}))}),[e]),u=l.useStore(),d=l.useStoreIds(),c=l.useMetrics(),h=l.useMetricsIds(),m=l.useIndexes(),p=l.useIndexesIds(),b=l.useRelationships(),g=l.useRelationshipsIds(),v=l.useQueries(),f=l.useQueriesIds();return P(u)&&Y(d)&&P(c)&&Y(h)&&P(m)&&Y(p)&&P(b)&&Y(g)&&P(v)&&Y(f)?B("span",{className:"warn"},"There are no Stores or other objects to inspect. Make sure you placed the Inspector inside a Provider component."):B("article",{ref:t,onScroll:i},B(Qt,{s:e}),X(d,(t=>B(Qt,{storeId:t,s:e,key:t}))),B(zt,{s:e}),X(h,(t=>B(zt,{metricsId:t,s:e,key:t}))),B(Et,{s:e}),X(p,(t=>B(Et,{indexesId:t,s:e,key:t}))),B(Jt,{s:e}),X(g,(t=>B(Jt,{relationshipsId:t,s:e,key:t}))),B(At,{s:e}),X(f,(t=>B(At,{queriesId:t,s:e,key:t}))))};var Wt=Object.defineProperty;class Ut extends F{constructor(e){var t,l,n;super(e),n=(e,t)=>console.error(e,t.componentStack),(l="componentDidCatch")in(t=this)?Wt(t,l,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[l]=n,this.state={e:0}}static getDerivedStateFromError(){return{e:1}}render(){return this.state.e?B("span",{className:"warn"},"Inspector error: please see console for details."):this.props.children}}const Gt=({s:e})=>{var t;const n=null!=(t=l.useValue(Ce,e))?t:1,s=l.useSetValueCallback(ke,(()=>!1),[],e),r=l.useSetValueCallback(Ce,(e=>Number(e[x].dataset.id)),[],e);return B("header",null,B("img",{title:ve}),B("span",null,ve),X(fe,((e,t)=>t==n?null:B("img",{onClick:r,"data-id":t,title:"Dock to "+e,key:t}))),B("img",{onClick:s,title:"Close"}))},Kt=({s:e})=>{var t;const n=null!=(t=l.useValue(Ce,e))?t:1;return l.useValue(ke,e)?B("main",{"data-position":n},B(Gt,{s:e}),B(Ut,null,B(Ht,{s:e}))):null},Xt=e=>t=>{return l=(t,l)=>t+e(l),nl(t).reduce(l,0);var l},Yt=e=>{var t;return null!=(t=null==e?void 0:e.size)?t:0},Zt=Xt(Yt),_t=Xt(Zt),el=Xt(_t),tl=(e,t)=>{var l;return null!=(l=null==e?void 0:e.has(t))&&l},ll=e=>P(e)||0==Yt(e),nl=e=>{var t;return[...null!=(t=null==e?void 0:e.values())?t:[]]},sl=e=>e.clear(),rl=(e,t)=>null==e?void 0:e.forEach(t),al=(e,t)=>null==e?void 0:e.delete(t),ol=e=>new Map(e),il=e=>{var t;return[...null!=(t=null==e?void 0:e.keys())?t:[]]},ul=(e,t)=>null==e?void 0:e.get(t),dl=(e,t)=>rl(e,((e,l)=>t(l,e))),cl=(e,t,l)=>P(l)?(al(e,t),e):null==e?void 0:e.set(t,l),hl=(e,t,l,n)=>(tl(e,t)?null==n||n(ul(e,t)):cl(e,t,l()),ul(e,t)),ml=(e,t,l,n=cl)=>(de(t,((t,n)=>l(e,n,t))),dl(e,(l=>ie(t,l)?0:n(e,l))),e),pl=(e,t,l,n)=>{const s={};return rl(e,((e,r)=>{if(!(null==l?void 0:l(e,r))){const l=t?t(e,r):e;(null==n?void 0:n(l))||(s[r]=l)}})),s},bl=(e,t,l)=>pl(e,(e=>pl(e,t,l)),ll,ce),gl=(e,t,l)=>pl(e,(e=>bl(e,t,l)),ll,ce),vl=(e,t)=>{const l=ol();return rl(e,((e,n)=>{var s;return l.set(n,null!=(s=null==t?void 0:t(e))?s:e)})),l},fl=e=>vl(e,vl),yl=e=>vl(e,fl),Il=(e,t,l,n,s=0)=>N((l?hl:ul)(e,t[s],s>$(t)-2?l:ol),(r=>{if(s>$(t)-2)return(null==n?void 0:n(r))&&cl(e,t[s]),r;const a=Il(r,t,l,n,s+1);return ll(r)&&cl(e,t[s]),a}));var wl=Object.defineProperty,Cl=Object.getOwnPropertySymbols,kl=Object.prototype.hasOwnProperty,xl=Object.prototype.propertyIsEnumerable,Sl=(e,t,l)=>t in e?wl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l,Tl=(e,t,l)=>new Promise(((n,s)=>{var r=e=>{try{o(l.next(e))}catch(e){s(e)}},a=e=>{try{o(l.throw(e))}catch(e){s(e)}},o=e=>e.done?n(e.value):Promise.resolve(e.value).then(r,a);o((l=l.apply(e,t)).next())}));const Vl=ol(),Rl=ol();var Ol=(e,t,l)=>new Promise(((n,s)=>{var r=e=>{try{o(l.next(e))}catch(e){s(e)}},a=e=>{try{o(l.throw(e))}catch(e){s(e)}},o=e=>e.done?n(e.value):Promise.resolve(e.value).then(r,a);o((l=l.apply(e,t)).next())}));const ql="storage",Ml=e=>new Set(j(e)||P(e)?e:[e]),Pl=(e,t)=>null==e?void 0:e.add(t),Nl=/^\d+$/,Ll=()=>{const e=[];let t=0;return[l=>{var n;return null!=(n=l?_(e):null)?n:s+t++},t=>{Nl.test(t)&&$(e)<1e3&&Z(e,t)}]},El=e=>[e,e],jl=(e,t=Zt)=>t(e[0])+t(e[1]),zl=()=>[ol(),ol()],$l=e=>[...e],Al=([e,t])=>e===t;ol(X("-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz".split(s),((e,t)=>[e,t])));const Fl=(e,t,l)=>cl(e,t,ul(e,t)==-l?void 0:l),Jl=()=>{let e,t,l=!1,n=!1,r=0,a=[];const i=ol(),h=ol(),x=ol(),S=ol(),V=ol(),R=ol(),O=ol(),q=ol(),M=ol(),A=ol(),F=ol(),J=ol(),B=ol(),D=ol(),Q=Ml(),H=ol(),W=ol(),U=ol(),Y=ol(),_=zl(),ee=zl(),te=zl(),le=zl(),ne=zl(),se=zl(),re=zl(),oe=zl(),me=zl(),ge=zl(),ve=zl(),fe=zl(),ye=zl(),Ie=zl(),we=zl(),Ce=zl(),ke=zl(),xe=zl(),Se=zl(),Te=zl(),Ve=zl(),Re=zl(),Oe=ol(),qe=zl(),[Me,Pe,Ne,Le]=(()=>{let e;const[t,l]=Ll(),n=ol();return[(l,r,a,o=[],i=()=>[])=>{null!=e||(e=Vl);const u=t(1);return cl(n,u,[l,r,a,o,i]),Pl(Il(r,null!=a?a:[s],Ml),u),u},(t,l,...r)=>K(((e,t=[s])=>{const l=[],n=(e,s)=>s==$(t)?Z(l,e):null===t[s]?rl(e,(e=>n(e,s+1))):K([t[s],null],(t=>n(ul(e,t),s+1)));return n(e,0),l})(t,l),(t=>rl(t,(t=>ul(n,t)[0](e,...null!=l?l:[],...r))))),e=>N(ul(n,e),(([,t,r])=>(Il(t,null!=r?r:[s],void 0,(t=>(al(t,e),ll(t)?1:0))),cl(n,e),l(e),r))),t=>N(ul(n,t),(([t,,l=[],n,s])=>{const r=(...a)=>{var o,i;const u=$(a);u==$(l)?t(e,...a,...s(a)):P(l[u])?K(null!=(i=null==(o=n[u])?void 0:o.call(n,...a))?i:[],(e=>r(...a,e))):r(...a,l[u])};r()}))]})(),Ee=e=>{if(!he(e,((e,t)=>[u,d].includes(t))))return!1;const t=e[u];return!(!L(t)&&t!=o||(Xe(e[d])!=t&&ue(e,d),0))},je=j,ze=(t,l)=>(!e||tl(F,l)||gt(l))&&he(t,((e,t)=>$e(l,t,e)),(()=>gt(l))),$e=(e,t,l,n)=>he(n?l:Be(l,e,t),((n,s)=>N(Ae(e,t,s,n),(e=>(l[s]=e,!0)),(()=>!1))),(()=>gt(e,t))),Ae=(t,l,n,s)=>e?N(ul(ul(F,t),n),(e=>Xe(s)!=e[u]?gt(t,l,n,s,e[d]):s),(()=>gt(t,l,n,s))):P(Xe(s))?gt(t,l,n,s):s,Fe=(e,t)=>he(t?e:De(e),((t,l)=>N(Je(l,t),(t=>(e[l]=t,!0)),(()=>!1))),(()=>vt())),Je=(e,l)=>t?N(ul(B,e),(t=>Xe(l)!=t[u]?vt(e,l,t[d]):l),(()=>vt(e,l))):P(Xe(l))?vt(e,l):l,Be=(e,t,l)=>(N(ul(J,t),(([n,s])=>{rl(n,((t,l)=>{ie(e,l)||(e[l]=t)})),rl(s,(n=>{ie(e,n)||gt(t,l,n)}))})),e),De=e=>(t&&(rl(D,((t,l)=>{ie(e,l)||(e[l]=t)})),rl(Q,(t=>{ie(e,t)||vt(t)}))),e),Qe=e=>ml(F,e,((e,t,l)=>{const n=ol(),s=Ml();ml(hl(F,t,ol),l,((e,t,l)=>{cl(e,t,l),N(l[d],(e=>cl(n,t,e)),(()=>Pl(s,t)))})),cl(J,t,[n,s])}),((e,t)=>{cl(F,t),cl(J,t)})),He=e=>ml(B,e,((e,t,l)=>{cl(B,t,l),N(l[d],(e=>cl(D,t,e)),(()=>Pl(Q,t)))}),((e,t)=>{cl(B,t),cl(D,t),al(Q,t)})),We=e=>ce(e)?Kt():Qt(e),Ue=e=>ml(U,e,((e,t,l)=>Ge(t,l)),((e,t)=>at(t))),Ge=(e,t)=>ml(hl(U,e,(()=>(dt(e,1),cl(H,e,Ll()),cl(W,e,ol()),ol()))),t,((t,l,n)=>Ke(e,t,l,n)),((t,l)=>ot(e,t,l))),Ke=(e,t,l,n,s)=>ml(hl(t,l,(()=>(ct(e,l,1),ol()))),n,((t,n,s)=>_e(e,l,t,n,s)),((n,r)=>it(e,t,l,n,r,s))),_e=(e,t,l,n,s)=>{tl(l,n)||ht(e,t,n,1);const r=ul(l,n);s!==r&&(mt(e,t,n,r,s),cl(l,n,s))},et=(e,t,l,n,s)=>N(ul(t,l),(t=>_e(e,l,t,n,s)),(()=>Ke(e,t,l,Be({[n]:s},e,l)))),tt=e=>ce(e)?wl():Ht(e),lt=e=>ml(Y,e,((e,t,l)=>nt(t,l)),((e,t)=>ut(t))),nt=(e,t)=>{tl(Y,e)||pt(e,1);const l=ul(Y,e);t!==l&&(bt(e,l,t),cl(Y,e,t))},st=(e,t)=>{const[l]=ul(H,e),n=l(t);return tl(ul(U,e),n)?st(e,t):n},rt=e=>{var t;return null!=(t=ul(U,e))?t:Ge(e,{})},at=e=>Ge(e,{}),ot=(e,t,l)=>{const[,n]=ul(H,e);n(l),Ke(e,t,l,{},!0)},it=(e,t,l,n,s,r)=>{var a;const o=ul(null==(a=ul(J,e))?void 0:a[0],s);if(!P(o)&&!r)return _e(e,l,n,s,o);const i=t=>{mt(e,l,t,ul(n,t)),ht(e,l,t,-1),cl(n,t)};P(o)?i(s):dl(n,i),ll(n)&&(ct(e,l,-1),ll(cl(t,l))&&(dt(e,-1),cl(U,e),cl(H,e),cl(W,e)))},ut=e=>{const t=ul(D,e);if(!P(t))return nt(e,t);bt(e,ul(Y,e)),pt(e,-1),cl(Y,e)},dt=(e,t)=>Fl(i,e,t),ct=(e,t,l)=>Fl(hl(S,e,ol),t,l)&&cl(x,e,hl(x,e,(()=>0))+l),ht=(e,t,l,n)=>{var s;const r=ul(W,e),a=null!=(s=ul(r,l))?s:0;(0==a&&1==n||1==a&&-1==n)&&Fl(hl(h,e,ol),l,n),cl(r,l,a!=-n?a+n:null),Fl(hl(hl(V,e,ol),t,ol),l,n)},mt=(e,t,l,n,s)=>{var r;hl(hl(hl(R,e,ol),t,ol),l,(()=>[n,0]))[1]=s,null==(r=a[3])||r.call(a,e,t,l,s)},pt=(e,t)=>Fl(O,e,t),bt=(e,t,l)=>{var n;hl(q,e,(()=>[t,0]))[1]=l,null==(n=a[4])||n.call(a,e,l)},gt=(e,t,l,n,s)=>(Z(hl(hl(hl(M,e,ol),t,ol),l,(()=>[])),n),s),vt=(e,t,l)=>(Z(hl(A,e,(()=>[])),t),l),ft=(e,t,l)=>N(ul(ul(ul(R,e),t),l),(([e,t])=>[!0,e,t]),(()=>[!1,...El(Nt(e,t,l))])),yt=e=>N(ul(q,e),(([e,t])=>[!0,e,t]),(()=>[!1,...El(jt(e))])),It=e=>ll(M)||ll(Ce[e])?0:rl(e?yl(M):M,((t,l)=>rl(t,((t,n)=>rl(t,((t,s)=>Pe(Ce[e],[l,n,s],t))))))),wt=e=>ll(A)||ll(ke[e])?0:rl(e?vl(A):A,((t,l)=>Pe(ke[e],[l],t))),Ct=(e,t,l,n)=>{if(!ll(e))return Pe(t,n,(()=>pl(e))),dl(e,((e,t)=>Pe(l,[...null!=n?n:[],e],1==t))),1},kt=e=>{const t=zt();t!=l&&Pe(_[e],void 0,t);const n=ll(ge[e]),s=ll(ye[e])&&ll(Ie[e])&&ll(me[e])&&ll(ve[e])&&ll(se[e])&&ll(re[e])&&ll(oe[e])&&n&&ll(te[e])&&ll(le[e]),r=ll(we[e])&&ll(fe[e])&&ll(ne[e])&&ll(ee[e]);if(!s||!r){const t=e?[vl(i),fl(h),vl(x),fl(S),yl(V),yl(R)]:[i,h,x,S,V,R];if(!s){Ct(t[0],te[e],le[e]),rl(t[1],((t,l)=>Ct(t,se[e],re[e],[l]))),rl(t[2],((t,l)=>{0!=t&&Pe(oe[e],[l],Ot(l))}));const l=Ml();rl(t[3],((t,s)=>{Ct(t,me[e],ve[e],[s])&&!n&&(Pe(ge[e],[s,null]),Pl(l,s))})),n||rl(t[5],((t,n)=>{if(!tl(l,n)){const l=Ml();rl(t,(e=>rl(e,(([t,n],s)=>n!==t?Pl(l,s):al(e,s))))),rl(l,(t=>Pe(ge[e],[n,t])))}})),rl(t[4],((t,l)=>rl(t,((t,n)=>Ct(t,ye[e],Ie[e],[l,n])))))}if(!r){let l;rl(t[5],((t,n)=>{let s;rl(t,((t,r)=>{let a;rl(t,(([t,o],i)=>{o!==t&&(Pe(we[e],[n,r,i],o,t,ft),l=s=a=1)})),a&&Pe(fe[e],[n,r],ft)})),s&&Pe(ne[e],[n],ft)})),l&&Pe(ee[e],void 0,ft)}}},xt=e=>{const t=Bt();t!=n&&Pe(xe[e],void 0,t);const l=ll(Te[e])&&ll(Ve[e]),s=ll(Re[e])&&ll(Se[e]);if(!l||!s){const t=e?[vl(O),vl(q)]:[O,q];if(l||Ct(t[0],Te[e],Ve[e]),!s){let l;rl(t[1],(([t,n],s)=>{n!==t&&(Pe(Re[e],[s],n,t,yt),l=1)})),l&&Pe(Se[e],void 0,yt)}}},St=(e,...t)=>(xl((()=>e(...X(t,T)))),Vl),Tt=()=>gl(U),Vt=()=>il(U),Rt=e=>il(ul(W,T(e))),Ot=e=>Yt(ul(U,T(e))),qt=e=>il(ul(U,T(e))),Mt=(e,t,l,n=0,s)=>{return X(z(G((r=ul(U,T(e)),a=(e,l)=>[P(t)?l:ul(e,T(t)),l],X([...null!=(o=null==r?void 0:r.entries())?o:[]],(([e,t])=>a(t,e)))),(([e],[t])=>{return((null!=(n=e)?n:0)<(null!=(s=t)?s:0)?-1:1)*(l?-1:1);var n,s})),n,P(s)?s:n+s),(([,e])=>e));var r,a,o},Pt=(e,t)=>il(ul(ul(U,T(e)),T(t))),Nt=(e,t,l)=>ul(ul(ul(U,T(e)),T(t)),T(l)),Lt=()=>pl(Y),Et=()=>il(Y),jt=e=>ul(Y,T(e)),zt=()=>!ll(U),$t=e=>tl(U,T(e)),At=(e,t)=>tl(ul(W,T(e)),T(t)),Ft=(e,t)=>tl(ul(U,T(e)),T(t)),Jt=(e,t,l)=>tl(ul(ul(U,T(e)),T(t)),T(l)),Bt=()=>!ll(Y),Dt=e=>tl(Y,T(e)),Qt=e=>St((()=>(e=>he(e,ze,gt))(e)?Ue(e):0)),Ht=e=>St((()=>Fe(e)?lt(e):0)),Wt=e=>{try{We(pe(e))}catch(e){}return Vl},Ut=t=>St((()=>{if((e=he(t,(e=>he(e,Ee))))&&(Qe(t),!ll(U))){const e=Tt();Kt(),Qt(e)}})),Gt=e=>St((()=>{if(t=(e=>he(e,Ee))(e)){const l=Lt();kl(),wl(),t=!0,He(e),Ht(l)}})),Kt=()=>St((()=>Ue({}))),Xt=e=>St((e=>tl(U,e)?at(e):0),e),nl=(e,t)=>St(((e,t)=>N(ul(U,e),(l=>tl(l,t)?ot(e,l,t):0))),e,t),wl=()=>St((()=>lt({}))),Cl=()=>St((()=>{Qe({}),e=!1})),kl=()=>St((()=>{He({}),t=!1})),xl=(e,t)=>{if(-1!=r){Sl();const l=e();return Tl(t),l}},Sl=()=>{var e;return-1!=r&&r++,1==r&&(null==(e=a[0])||e.call(a),Pe(Oe)),Vl},Tl=e=>{var t,s;return r>0&&(r--,0==r&&(r=1,It(1),ll(R)||kt(1),wt(1),ll(q)||xt(1),(null==e?void 0:e(Vl))&&(rl(R,((e,t)=>rl(e,((e,l)=>rl(e,(([e],n)=>Ye(Vl,t,l,n,e))))))),sl(R),rl(q,(([e],t)=>Ze(Vl,t,e))),sl(q)),Pe(qe[0],void 0),r=-1,It(0),ll(R)||kt(0),wt(0),ll(q)||xt(0),null==(t=a[1])||t.call(a),Pe(qe[1],void 0),null==(s=a[2])||s.call(a),r=0,l=zt(),n=Bt(),K([i,h,x,S,V,R,M,O,q,A],sl))),Vl},Vl={getContent:()=>[Tt(),Lt()],getTables:Tt,getTableIds:Vt,getTable:e=>bl(ul(U,T(e))),getTableCellIds:Rt,getRowCount:Ot,getRowIds:qt,getSortedRowIds:Mt,getRow:(e,t)=>pl(ul(ul(U,T(e)),T(t))),getCellIds:Pt,getCell:Nt,getValues:Lt,getValueIds:Et,getValue:jt,hasTables:zt,hasTable:$t,hasTableCell:At,hasRow:Ft,hasCell:Jt,hasValues:Bt,hasValue:Dt,getTablesJson:()=>be(U),getValuesJson:()=>be(Y),getJson:()=>be([U,Y]),getTablesSchemaJson:()=>be(F),getValuesSchemaJson:()=>be(B),getSchemaJson:()=>be([F,B]),hasTablesSchema:()=>e,hasValuesSchema:()=>t,setContent:e=>St((()=>je(e)?(([e,t])=>{(ce(e)?Kt:Qt)(e),(ce(t)?wl:Ht)(t)})(e):0)),setTables:Qt,setTable:(e,t)=>St((e=>ze(t,e)?Ge(e,t):0),e),setRow:(e,t,l)=>St(((e,t)=>$e(e,t,l)?Ke(e,rt(e),t,l):0),e,t),addRow:(e,t,l=!0)=>xl((()=>{let n;return $e(e,n,t)&&(e=T(e),Ke(e,rt(e),n=st(e,l?1:0),t)),n})),setPartialRow:(e,t,l)=>St(((e,t)=>{if($e(e,t,l,1)){const n=rt(e);de(l,((l,s)=>et(e,n,t,s,l)))}}),e,t),setCell:(e,t,l,n)=>St(((e,t,l)=>N(Ae(e,t,l,E(n)?n(Nt(e,t,l)):n),(n=>et(e,rt(e),t,l,n)))),e,t,l),setValues:Ht,setPartialValues:e=>St((()=>Fe(e,1)?de(e,((e,t)=>nt(t,e))):0)),setValue:(e,t)=>St((e=>N(Je(e,E(t)?t(jt(e)):t),(t=>nt(e,t)))),e),applyChanges:e=>St((()=>{de(e[0],((e,t)=>P(e)?Xt(t):de(e,((e,l)=>P(e)?nl(t,l):de(e,((e,n)=>Ye(Vl,t,l,n,e))))))),de(e[1],((e,t)=>Ze(Vl,t,e)))})),setTablesJson:Wt,setValuesJson:e=>{try{tt(pe(e))}catch(e){}return Vl},setJson:e=>St((()=>{try{const[t,l]=pe(e);We(t),tt(l)}catch(t){Wt(e)}})),setTablesSchema:Ut,setValuesSchema:Gt,setSchema:(e,t)=>St((()=>{Ut(e),Gt(t)})),delTables:Kt,delTable:Xt,delRow:nl,delCell:(e,t,l,n)=>St(((e,t,l)=>N(ul(U,e),(s=>N(ul(s,t),(r=>tl(r,l)?it(e,s,t,r,l,n):0))))),e,t,l),delValues:wl,delValue:e=>St((e=>tl(Y,e)?ut(e):0),e),delTablesSchema:Cl,delValuesSchema:kl,delSchema:()=>St((()=>{Cl(),kl()})),transaction:xl,startTransaction:Sl,getTransactionChanges:()=>[pl(R,((e,t)=>-1===ul(i,t)?void 0:pl(e,((e,l)=>-1===ul(ul(S,t),l)?void 0:pl(e,(([,e])=>e),(e=>Al(e)))),ll,ce)),ll,ce),pl(q,(([,e])=>e),(e=>Al(e))),1],getTransactionLog:()=>[!ll(R),!ll(q),gl(R,$l,Al),gl(M),pl(q,$l,Al),pl(A),pl(i),bl(S),gl(V),pl(O)],finishTransaction:Tl,forEachTable:e=>rl(U,((t,l)=>e(l,(e=>rl(t,((t,l)=>e(l,(e=>dl(t,e))))))))),forEachTableCell:(e,t)=>dl(ul(W,T(e)),t),forEachRow:(e,t)=>rl(ul(U,T(e)),((e,l)=>t(l,(t=>dl(e,t))))),forEachCell:(e,t,l)=>dl(ul(ul(U,T(e)),T(t)),l),forEachValue:e=>dl(Y,e),addSortedRowIdsListener:(e,t,l,n,s,r,a)=>{let o=Mt(e,t,l,n,s);return Me((()=>{const a=Mt(e,t,l,n,s);var i,u,d;u=o,$(i=a)===$(u)&&(d=(e,t)=>u[t]===e,i.every(d))||(o=a,r(Vl,e,t,l,n,s,o))}),ge[a?1:0],[e,t],[Vt])},addStartTransactionListener:e=>Me(e,Oe),addWillFinishTransactionListener:e=>Me(e,qe[0]),addDidFinishTransactionListener:e=>Me(e,qe[1]),callListener:e=>(Le(e),Vl),delListener:e=>(Ne(e),Vl),getListenerStats:()=>({hasTables:jl(_),tables:jl(ee),tableIds:jl(te),hasTable:jl(le),table:jl(ne),tableCellIds:jl(se),hasTableCell:jl(re,_t),rowCount:jl(oe),rowIds:jl(me),sortedRowIds:jl(ge),hasRow:jl(ve,_t),row:jl(fe,_t),cellIds:jl(ye,_t),hasCell:jl(Ie,el),cell:jl(we,el),invalidCell:jl(Ce,el),hasValues:jl(xe),values:jl(Se),valueIds:jl(Te),hasValue:jl(Ve),value:jl(Re),invalidValue:jl(ke),transaction:Zt(Oe)+jl(qe)}),isMergeable:()=>!1,createStore:Jl,addListener:Me,callListeners:Pe,setInternalListeners:(e,t,l,n,s)=>a=[e,t,l,n,s]};return de({[c+p]:[0,_,[],()=>[zt()]],[p]:[0,ee],[b]:[0,te],[c+m]:[1,le,[Vt],e=>[$t(...e)]],[m]:[1,ne,[Vt]],[m+I]:[1,se,[Vt]],[c+m+y]:[2,re,[Vt,Rt],e=>[At(...e)]],[v]:[1,oe,[Vt]],[f]:[1,me,[Vt]],[c+g]:[2,ve,[Vt,qt],e=>[Ft(...e)]],[g]:[2,fe,[Vt,qt]],[I]:[2,ye,[Vt,qt]],[c+y]:[3,Ie,[Vt,qt,Pt],e=>[Jt(...e)]],[y]:[3,we,[Vt,qt,Pt],e=>El(Nt(...e))],InvalidCell:[3,Ce],[c+C]:[0,xe,[],()=>[Bt()]],[C]:[0,Se],[k]:[0,Te],[c+w]:[1,Ve,[Et],e=>[Dt(...e)]],[w]:[1,Re,[Et],e=>El(jt(e[0]))],InvalidValue:[1,ke]},(([e,t,l,n],s)=>{Vl["add"+s+"Listener"]=(...s)=>Me(s[e],t[s[e+1]?1:0],e>0?z(s,0,e):void 0,l,n)})),ae(Vl)};e.Inspector=({position:e="right",open:t=!1})=>{const n=l.useCreateStore(Jl),s=fe.indexOf(e);return l.useCreatePersister(n,(e=>{return t=ge,l=sessionStorage,((e,t,l,n,s,r,a,o={},i=[])=>{let u,d,c,h=0,m=0,p=0;hl(Vl,i,(()=>0)),hl(Rl,i,(()=>[]));const[b,g,v,f,y]=((e=1,t)=>1!=e&&t.isMergeable()?[1,t.getMergeableContent,t.getTransactionMergeableChanges,([[e],[t]])=>!ce(e)||!ce(t),t.setDefaultContent]:2!=e?[0,t.getContent,t.getTransactionChanges,([e,t])=>!ce(e)||!ce(t),t.setContent]:A("Store type not supported by this Persister"))(a,e),I=t=>{(b&&j(null==t?void 0:t[0])?1===(null==t?void 0:t[2])?e.applyMergeableChanges:e.setMergeableContent:1===(null==t?void 0:t[2])?e.applyChanges:e.setContent)(t)},w=e=>Tl(void 0,null,(function*(){return 2!=h&&(h=1,m++,yield S((()=>Tl(void 0,null,(function*(){try{const e=yield t();j(e)?I(e):A("Content is not an array "+e)}catch(t){e&&y(e)}h=0}))))),T})),C=()=>(d&&(s(d),d=void 0),T),k=e=>Tl(void 0,null,(function*(){return 1!=h&&(h=2,p++,yield S((()=>Tl(void 0,null,(function*(){try{yield l(g,e)}catch(e){}h=0}))))),T})),x=()=>(N(c,e.delListener),c=void 0,T),S=(...e)=>Tl(void 0,null,(function*(){return Z(ul(Rl,i),...e),yield Tl(void 0,null,(function*(){if(!ul(Vl,i)){for(cl(Vl,i,1);!P(u=_(ul(Rl,i)));)try{yield u()}catch(e){}cl(Vl,i,0)}})),T})),T=((e,t)=>{for(var l in t||(t={}))kl.call(t,l)&&Sl(e,l,t[l]);if(Cl)for(var l of Cl(t))xl.call(t,l)&&Sl(e,l,t[l]);return e})({load:w,startAutoLoad:e=>Tl(void 0,null,(function*(){yield C().load(e);try{d=yield n(((e,t)=>Tl(void 0,null,(function*(){t||e?2!=h&&(h=1,m++,I(null!=t?t:e),h=0):yield w()}))))}catch(e){}return T})),stopAutoLoad:C,isAutoLoading:()=>!P(d),save:k,startAutoSave:()=>Tl(void 0,null,(function*(){return yield x().save(),c=e.addDidFinishTransactionListener((()=>{const e=v();f(e)&&k(e)})),T})),stopAutoSave:x,isAutoSaving:()=>!P(c),schedule:S,getStore:()=>e,destroy:()=>(ul(Rl,i).splice(0,void 0),C().stopAutoSave()),getStats:()=>({loads:m,saves:p})},o);return ae(T)})(e,(()=>Ol(void 0,null,(function*(){return e=l.getItem(t),pe(e,((e,t)=>""===t?void 0:t));var e}))),(e=>Ol(void 0,null,(function*(){return l.setItem(t,(n=e(),me(n,((e,t)=>void 0===t?"":t))));var n}))),(e=>{const n=n=>{if(n.storageArea===l&&n.key===t)try{e(pe(n.newValue))}catch(t){e()}};return V.addEventListener(ql,n),n}),(e=>V.removeEventListener(ql,e)),0,3,{getStorageName:()=>t});var t,l}),void 0,(e=>{return l=function*(){yield e.load([{},{position:-1==s?1:s,open:!!t}]),yield e.startAutoSave()},new Promise(((e,t)=>{var n=e=>{try{r(l.next(e))}catch(e){t(e)}},s=e=>{try{r(l.throw(e))}catch(e){t(e)}},r=t=>t.done?e(t.value):Promise.resolve(t.value).then(n,s);r((l=l.apply(void 0,null)).next())}));var l})),B(J,null,B("aside",{id:ge},B(Ge,{s:n}),B(Kt,{s:n})),B("style",null,Ue))}},"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("../ui-react/index.js")):"function"==typeof define&&define.amd?define(["exports","react","../ui-react"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).TinyBaseUiReactInspector={},e.React,e.TinyBaseUiReact);
|
|
Binary file
|