tinybase 4.2.0 → 4.2.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.
Files changed (56) hide show
  1. package/lib/cjs/store.cjs +1 -1
  2. package/lib/cjs/store.cjs.gz +0 -0
  3. package/lib/cjs/tinybase.cjs +1 -1
  4. package/lib/cjs/tinybase.cjs.gz +0 -0
  5. package/lib/cjs/ui-react-dom-debug.cjs +1 -1
  6. package/lib/cjs/ui-react-dom-debug.cjs.gz +0 -0
  7. package/lib/cjs/ui-react.cjs +1 -1
  8. package/lib/cjs/ui-react.cjs.gz +0 -0
  9. package/lib/cjs-es6/store.cjs +1 -1
  10. package/lib/cjs-es6/store.cjs.gz +0 -0
  11. package/lib/cjs-es6/tinybase.cjs +1 -1
  12. package/lib/cjs-es6/tinybase.cjs.gz +0 -0
  13. package/lib/cjs-es6/ui-react-dom-debug.cjs +1 -1
  14. package/lib/cjs-es6/ui-react-dom-debug.cjs.gz +0 -0
  15. package/lib/cjs-es6/ui-react.cjs +1 -1
  16. package/lib/cjs-es6/ui-react.cjs.gz +0 -0
  17. package/lib/debug/store.js +10 -10
  18. package/lib/debug/tinybase.js +10 -10
  19. package/lib/debug/ui-react-dom.js +10 -10
  20. package/lib/debug/ui-react.js +37 -0
  21. package/lib/es6/store.js +1 -1
  22. package/lib/es6/store.js.gz +0 -0
  23. package/lib/es6/tinybase.js +1 -1
  24. package/lib/es6/tinybase.js.gz +0 -0
  25. package/lib/es6/ui-react-dom-debug.js +1 -1
  26. package/lib/es6/ui-react-dom-debug.js.gz +0 -0
  27. package/lib/es6/ui-react.js +1 -1
  28. package/lib/es6/ui-react.js.gz +0 -0
  29. package/lib/store.js +1 -1
  30. package/lib/store.js.gz +0 -0
  31. package/lib/tinybase.js +1 -1
  32. package/lib/tinybase.js.gz +0 -0
  33. package/lib/types/store.d.ts +6 -0
  34. package/lib/types/ui-react.d.ts +175 -0
  35. package/lib/types/with-schemas/store.d.ts +6 -0
  36. package/lib/types/with-schemas/ui-react.d.ts +205 -0
  37. package/lib/ui-react.js +1 -1
  38. package/lib/ui-react.js.gz +0 -0
  39. package/lib/umd/store.js +1 -1
  40. package/lib/umd/store.js.gz +0 -0
  41. package/lib/umd/tinybase.js +1 -1
  42. package/lib/umd/tinybase.js.gz +0 -0
  43. package/lib/umd/ui-react-dom-debug.js +1 -1
  44. package/lib/umd/ui-react-dom-debug.js.gz +0 -0
  45. package/lib/umd/ui-react.js +1 -1
  46. package/lib/umd/ui-react.js.gz +0 -0
  47. package/lib/umd-es6/store.js +1 -1
  48. package/lib/umd-es6/store.js.gz +0 -0
  49. package/lib/umd-es6/tinybase.js +1 -1
  50. package/lib/umd-es6/tinybase.js.gz +0 -0
  51. package/lib/umd-es6/ui-react-dom-debug.js +1 -1
  52. package/lib/umd-es6/ui-react-dom-debug.js.gz +0 -0
  53. package/lib/umd-es6/ui-react.js +1 -1
  54. package/lib/umd-es6/ui-react.js.gz +0 -0
  55. package/package.json +11 -10
  56. package/readme.md +1 -1
@@ -1 +1 @@
1
- var e,l;e=this,l=function(e,l,t){"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="Ids",h="Table",m=h+"s",b=h+c,p="Row",v=p+"Count",g=p+c,f="Cell",I=f+c,y="Value",w=y+"s",C=y+c,k="currentTarget",x="value",S=e=>s+e,T=Math.floor,V=isFinite,R=(e,l)=>e instanceof l,O=e=>null==e,q=(e,l,t)=>O(e)?null==t?void 0:t():l(e),P=e=>e==r||e==a,N=e=>n(e)==i,E=e=>Array.isArray(e),{PureComponent:L,Fragment:M,createElement:j,useCallback:z,useLayoutEffect:$,useRef:A,useState:F}=l,J=(e,...l)=>O(e)?{}:e(...l),D=(e,l)=>e.forEach(l),B=(e,l)=>e.map(l),H=e=>e.length,Q=e=>0==H(e),W=(e,l,t)=>e.slice(l,t),U=(e,...l)=>e.push(...l),G=e=>e.shift(),K=Object,X=K.keys,Y=K.isFrozen,Z=K.freeze,_=e=>R(e,K)&&e.constructor==K,ee=(e=[])=>K.fromEntries(e),le=(e,l)=>!O(((e,l)=>q(e,(e=>e[l])))(e,l)),te=(e,l)=>(delete e[l],e),ne=(e,l)=>B(K.entries(e),(([e,t])=>l(t,e))),se=e=>_(e)&&0==(e=>H(X(e)))(e),re=e=>JSON.stringify(e,((e,l)=>R(l,Map)?K.fromEntries([...l]):l)),ae=JSON.parse,oe="tinybaseStoreInspector",ie="TinyBase Store Inspector",ue=["left","top","bottom","right","full"],de="state",ce="sort",he="open",me="position",be=he,pe="editable",ve=(...e)=>re(e),ge=(e,l)=>B(e.sort(),l),fe=(e,l)=>[!!t.useCell(de,e,pe,l),z((t=>{l.setCell(de,e,pe,(e=>!e)),t.preventDefault()}),[l,e])],Ie="M20 80l5-15l40-40l10 10l-40 40l-15 5m5-15l10 10",ye='content:url("',we=ye+"data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' stroke-width='4' stroke='white' fill='none'>",Ce='</svg>")',ke=ye+"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\")",xe=B([[20,20,20,60],[20,20,60,20],[20,60,60,20],[60,20,20,60],[30,30,40,40]],(([e,l,t,n])=>we+`<rect x='20' y='20' width='60' height='60' fill='grey'/><rect x='${e}' y='${l}' width='${t}' height='${n}' fill='white'/>`+Ce)),Se=we+"<path d='M20 20l60 60M20 80l60-60' />"+Ce,Te=we+`<path d='${Ie}' />`+Ce,Ve=we+`<path d='${Ie}M20 20l60 60' />`+Ce;var Re=Object.defineProperty,Oe=Object.defineProperties,qe=Object.getOwnPropertyDescriptors,Pe=Object.getOwnPropertySymbols,Ne=Object.prototype.hasOwnProperty,Ee=Object.prototype.propertyIsEnumerable,Le=(e,l,t)=>l in e?Re(e,l,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[l]=t,Me=(e,l)=>{for(var t in l||(l={}))Ne.call(l,t)&&Le(e,t,l[t]);if(Pe)for(var t of Pe(l))Ee.call(l,t)&&Le(e,t,l[t]);return e},je=(e,l)=>Oe(e,qe(l));const ze="*::-webkit-scrollbar",$e=`#${oe}{\n all:initial;font-family:sans-serif;font-size:0.75rem;position:fixed;z-index:999999;\n ${((e,l="")=>e.join(l))(ne(je(Me(je(Me(je(Me({"*":"all:revert","*::before":"all:revert","*::after":"all:revert",[ze]:"width:0.5rem;height:0.5rem;",[ze+"-track"]:"background:#111",[ze+"-thumb"]:"background:#999;border:1px solid #111",[ze+"-thumb:hover"]:"background:#fff",[ze+"-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;"+ke},ee(B(["bottom:0;left:0","top:0;right:0"],((e,l)=>[`>img[data-position='${l}']`,e])))),{main:"display:flex;flex-direction:column;background:#111d;color:#fff;position:fixed;"}),ee(B(["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,l)=>[`main[data-position='${l}']`,e])))),{header:"display:flex;padding:0.25rem;background:#000;align-items:center","header>img:nth-of-type(1)":ke,"header>img:nth-of-type(6)":Se}),ee(B(xe,((e,l)=>[`header>img[data-id='${l}']`,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":Te,"details[open]>summary img.done":Ve,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,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,l)=>e?`& ${l}{${e}}`:"")))}`,Ae=({s:e})=>{var l;const n=null!=(l=t.useValue(me,e))?l:1,s=t.useSetValueCallback(be,(()=>!0),[],e);return t.useValue(be,e)?null:j("img",{onClick:s,title:ie,"data-position":n})},Fe=({uniqueId:e,summary:l,editable:n,handleEditable:s,children:r,s:a})=>{const o=!!t.useCell(de,e,he,a),i=t.useSetCellCallback(de,e,he,(e=>e[k].open),[],a);return j("details",{open:o,onToggle:i},j("summary",null,l,s?j("img",{onClick:s,className:n?"done":"edit"}):null),r)},Je=e=>{const l=n(e);return P(l)||l==o&&V(e)?l:void 0},De=(e,l,t,n,s)=>O(s)?e.delCell(l,t,n,!0):e.setCell(l,t,n,s),Be=(e,l,t)=>O(t)?e.delValue(l):e.setValue(l,t),He=(e,l,t,n)=>e==r?l:e==o?t:n;var Qe=Object.defineProperty,We=Object.defineProperties,Ue=Object.getOwnPropertyDescriptors,Ge=Object.getOwnPropertySymbols,Ke=Object.prototype.hasOwnProperty,Xe=Object.prototype.propertyIsEnumerable,Ye=(e,l,t)=>l in e?Qe(e,l,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[l]=t,Ze=(e,l)=>{for(var t in l||(l={}))Ke.call(l,t)&&Ye(e,t,l[t]);if(Ge)for(var t of Ge(l))Xe.call(l,t)&&Ye(e,t,l[t]);return e},_e=(e,l)=>We(e,Ue(l)),el=(e,l)=>{var t={};for(var n in e)Ke.call(e,n)&&l.indexOf(n)<0&&(t[n]=e[n]);if(null!=e&&Ge)for(var n of Ge(e))l.indexOf(n)<0&&Xe.call(e,n)&&(t[n]=e[n]);return t};const{useCallback:ll,useMemo:tl,useState:nl}=l,sl="editable",rl=(e,l)=>B(t.useTableCellIds(e,l),(l=>e+"."+l)),al=(e,l,t)=>{const n=ll(e,l);return t?n:void 0},ol=(...e)=>tl((()=>e),e),il=(e,l)=>tl((()=>({store:e,tableId:l})),[e,l]),ul=(e,l)=>tl((()=>({queries:e,queryId:l})),[e,l]),dl=(e,l=!1,t,n=0,s,r,a,o)=>{const[[i,u,d],c]=nl([e,l,n]),h=ll((e=>{c(e),null==o||o(e)}),[o]),m=al((e=>h([e,e==i&&!u,d])),[h,i,u,d],t),b=ll((e=>h([i,u,e])),[h,i,u]),p=!0===a?kl:a;return[[i,u,d],m,tl((()=>!1===a?null:j(p,{offset:d,limit:s,total:r,onChange:b})),[a,p,d,s,r,b])]},cl=(e,l,t)=>tl((()=>{const s=null!=l?l:e;return ee(ne(E(s)?ee(B(s,(e=>[e,e]))):s,((e,l)=>{return[l,Ze(Ze({},{label:l,component:t}),(s=e,n(s)==r?{label:e}:e))];var s})))}),[l,t,e]),hl=({className:e,headerRow:l,idColumn:t,params:[n,s,r,a,o,i]})=>j("table",{className:e},i?j("caption",null,i):null,!1===l?null:j("thead",null,j("tr",null,!1===t?null:j(ml,{sort:null!=a?a:[],label:"Id",onClick:o}),ne(n,(({label:e},l)=>j(ml,{key:l,cellId:l,label:e,sort:null!=a?a:[],onClick:o}))))),j("tbody",null,B(r,(e=>j("tr",{key:e},!1===t?null:j("th",null,e),ne(n,(({component:l,getComponentProps:t},n)=>j("td",{key:n},j(l,_e(Ze(Ze({},J(t,e,n)),s),{rowId:e,cellId:n})))))))))),ml=({cellId:e,sort:[l,t],label:n=(null!=e?e:s),onClick:r})=>j("th",{onClick:al((()=>null==r?void 0:r(e)),[r,e],r),className:O(t)||l!=e?void 0:`sorted ${t?"de":"a"}scending`},O(t)||l!=e?null:(t?"↓":"↑")+" ",n),bl=({localRowId:e,params:[n,s,r,a,o,i,u]})=>{const d=t.useRemoteRowId(o,e,i);return j("tr",null,!1===n?null:j(l.Fragment,null,j("th",null,e),j("th",null,d)),ne(s,(({component:l,getComponentProps:t},n)=>{const[s,o]=n.split(".",2),i=s===r?e:s===a?d:null;return O(i)?null:j("td",{key:n},j(l,_e(Ze({},J(t,i,o)),{store:u,tableId:s,rowId:i,cellId:o})))})))},pl=({thing:e,onThingChange:l,className:t,hasSchema:n})=>{const[s,i]=nl(),[u,d]=nl(),[c,h]=nl(),[m,b]=nl(),[p,v]=nl();u!==e&&(i(Je(e)),d(e),h(e+""),b(Number(e)||0),v(!!e));const g=ll(((e,t)=>{t(e),d(e),l(e)}),[l]);return j("div",{className:t},j("button",{className:s,onClick:ll((()=>{if(!(null==n?void 0:n())){const e=He(s,o,a,r),t=He(e,c,m,p);i(e),d(t),l(t)}}),[n,l,c,m,p,s])},s),He(s,j("input",{key:s,value:c,onChange:ll((e=>g(e[k][x]+"",h)),[g])}),j("input",{key:s,type:"number",value:m,onChange:ll((e=>g(Number(e[k][x]||0),b)),[g])}),j("input",{key:s,type:"checkbox",checked:p,onChange:ll((e=>g(!!e[k].checked,v)),[g])})))},vl=e=>{var l=e,{tableId:n,cellId:s,descending:r,offset:a,limit:o,store:i,editable:u,sortOnClick:d,paginator:c=!1,onChange:h,customCells:m}=l,b=el(l,["tableId","cellId","descending","offset","limit","store","editable","sortOnClick","paginator","onChange","customCells"]);const[p,v,g]=dl(s,r,d,a,o,t.useRowCount(n,i),c,h);return j(hl,_e(Ze({},b),{params:ol(cl(t.useTableCellIds(n,i),m,u?wl:t.CellView),il(i,n),t.useSortedRowIds(n,...p,o,i),p,v,g)}))},gl=({store:e,editable:l=!1,valueComponent:n=(l?Cl:t.ValueView),getValueComponentProps:s,className:r,headerRow:a,idColumn:o})=>j("table",{className:r},!1===a?null:j("thead",null,j("tr",null,!1===o?null:j("th",null,"Id"),j("th",null,y))),j("tbody",null,B(t.useValueIds(e),(l=>j("tr",{key:l},!1===o?null:j("th",null,l),j("td",null,j(n,_e(Ze({},J(s,l)),{valueId:l,store:e})))))))),fl=e=>{var l=e,{indexId:n,sliceId:s,indexes:r,editable:a,customCells:o}=l,i=el(l,["indexId","sliceId","indexes","editable","customCells"]);const[u,d,c]=((e,l)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getTableId(l)])(t.useIndexesOrIndexesById(r),n);return j(hl,_e(Ze({},i),{params:ol(cl(t.useTableCellIds(c,d),o,a?wl:t.CellView),il(d,c),t.useSliceRowIds(n,s,u))}))},Il=({relationshipId:e,relationships:n,editable:s,customCells:r,className:a,headerRow:o,idColumn:i=!0})=>{const[u,d,c,h]=((e,l)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(l),null==e?void 0:e.getRemoteTableId(l)])(t.useRelationshipsOrRelationshipsById(n),e),m=cl([...rl(c,d),...rl(h,d)],r,s?wl:t.CellView),b=ol(i,m,c,h,e,u,d);return j("table",{className:a},!1===o?null:j("thead",null,j("tr",null,!1===i?null:j(l.Fragment,null,j("th",null,c,".Id"),j("th",null,h,".Id")),ne(m,(({label:e},l)=>j("th",{key:l},e))))),j("tbody",null,B(t.useRowIds(c,d),(e=>j(bl,{key:e,localRowId:e,params:b})))))},yl=e=>{var l=e,{queryId:n,cellId:s,descending:r,offset:a,limit:o,queries:i,sortOnClick:u,paginator:d=!1,customCells:c,onChange:h}=l,m=el(l,["queryId","cellId","descending","offset","limit","queries","sortOnClick","paginator","customCells","onChange"]);const[b,p,v]=dl(s,r,u,a,o,t.useResultRowCount(n,i),d,h);return j(hl,_e(Ze({},m),{params:ol(cl(t.useResultTableCellIds(n,i),c,t.ResultCellView),ul(i,n),t.useResultSortedRowIds(n,...b,o,i),b,p,v)}))},wl=({tableId:e,rowId:l,cellId:n,store:s,className:r})=>{var a;return j(pl,{thing:t.useCell(e,l,n,s),onThingChange:t.useSetCellCallback(e,l,n,(e=>e),[],s),className:null!=r?r:sl+f,hasSchema:null==(a=t.useStoreOrStoreById(s))?void 0:a.hasTablesSchema})},Cl=({valueId:e,store:l,className:n})=>{var s;return j(pl,{thing:t.useValue(e,l),onThingChange:t.useSetValueCallback(e,(e=>e),[],l),className:null!=n?n:sl+y,hasSchema:null==(s=t.useStoreOrStoreById(l))?void 0:s.hasValuesSchema})},kl=({onChange:e,total:t,offset:n=0,limit:s=t,singular:r="row",plural:a=r+"s"})=>{(n>t||n<0)&&(n=0,e(0));const o=al((()=>e(n-s)),[e,n,s],n>0),i=al((()=>e(n+s)),[e,n,s],n+s<t);return j(l.Fragment,null,t>s&&j(l.Fragment,null,j("button",{className:"previous",disabled:0==n,onClick:o},"←"),j("button",{className:"next",disabled:n+s>=t,onClick:i},"→"),n+1," to ",Math.min(t,n+s)," of "),t," ",1!=t?a:r)},xl=({indexes:e,indexesId:l,indexId:n,s:s})=>j(Fe,{uniqueId:ve("i",l,n),summary:"Index: "+n,s:s},B(t.useSliceIds(n,e),(t=>j(Sl,{indexes:e,indexesId:l,indexId:n,sliceId:t,s:s})))),Sl=({indexes:e,indexesId:l,indexId:t,sliceId:n,s:s})=>{const r=ve("i",l,t,n),[a,o]=fe(r,s);return j(Fe,{uniqueId:r,summary:"Slice: "+n,editable:a,handleEditable:o,s:s},j(fl,{sliceId:n,indexId:t,indexes:e,editable:a}))},Tl=({indexesId:e,s:l})=>{const n=t.useIndexes(e),s=t.useIndexIds(n);return O(n)?null:j(Fe,{uniqueId:ve("i",e),summary:"Indexes: "+(null!=e?e:d),s:l},Q(s)?"No indexes defined":ge(s,(t=>j(xl,{indexes:n,indexesId:e,indexId:t,s:l}))))},Vl=({metrics:e,metricId:l})=>j("tr",null,j("th",null,l),j("td",null,null==e?void 0:e.getTableId(l)),j("td",null,t.useMetric(l,e))),Rl=({metricsId:e,s:l})=>{const n=t.useMetrics(e),s=t.useMetricIds(n);return O(n)?null:j(Fe,{uniqueId:ve("m",e),summary:"Metrics: "+(null!=e?e:d),s:l},Q(s)?"No metrics defined":j("table",null,j("thead",null,j("th",null,"Metric Id"),j("th",null,"Table Id"),j("th",null,"Metric")),j("tbody",null,B(s,(e=>j(Vl,{metrics:n,metricId:e}))))))},Ol=({queries:e,queriesId:l,queryId:n,s:s})=>{var r;const a=ve("q",l,n),[o,i,u]=ae(null!=(r=t.useCell(de,a,ce,s))?r:"[]"),d=t.useSetCellCallback(de,a,ce,re,[],s);return j(Fe,{uniqueId:a,summary:"Query: "+n,s:s},j(yl,{queryId:n,queries:e,cellId:o,descending:i,offset:u,limit:10,paginator:!0,sortOnClick:!0,onChange:d}))},ql=({queriesId:e,s:l})=>{const n=t.useQueries(e),s=t.useQueryIds(n);return O(n)?null:j(Fe,{uniqueId:ve("q",e),summary:"Queries: "+(null!=e?e:d),s:l},Q(s)?"No queries defined":ge(s,(t=>j(Ol,{queries:n,queriesId:e,queryId:t,s:l}))))},Pl=({relationships:e,relationshipsId:l,relationshipId:t,s:n})=>{const s=ve("r",l,t),[r,a]=fe(s,n);return j(Fe,{uniqueId:s,summary:"Relationship: "+t,editable:r,handleEditable:a,s:n},j(Il,{relationshipId:t,relationships:e,editable:r}))},Nl=({relationshipsId:e,s:l})=>{const n=t.useRelationships(e),s=t.useRelationshipIds(n);return O(n)?null:j(Fe,{uniqueId:ve("r",e),summary:"Relationships: "+(null!=e?e:d),s:l},Q(s)?"No relationships defined":ge(s,(t=>j(Pl,{relationships:n,relationshipsId:e,relationshipId:t,s:l}))))},El=({tableId:e,store:l,storeId:n,s:s})=>{var r;const a=ve("t",n,e),[o,i,u]=ae(null!=(r=t.useCell(de,a,ce,s))?r:"[]"),d=t.useSetCellCallback(de,a,ce,re,[],s),[c,m]=fe(a,s);return j(Fe,{uniqueId:a,summary:h+": "+e,editable:c,handleEditable:m,s:s},j(vl,{tableId:e,store:l,cellId:o,descending:i,offset:u,limit:10,paginator:!0,sortOnClick:!0,onChange:d,editable:c}))},Ll=({store:e,storeId:l,s:n})=>{const s=ve("v",l),[r,a]=fe(s,n);return Q(t.useValueIds(e))?null:j(Fe,{uniqueId:s,summary:w,editable:r,handleEditable:a,s:n},j(gl,{store:e,editable:r}))},Ml=({storeId:e,s:l})=>{const n=t.useStore(e),s=t.useTableIds(n);return O(n)?null:j(Fe,{uniqueId:ve("s",e),summary:"Store: "+(null!=e?e:d),s:l},j(Ll,{storeId:e,store:n,s:l}),ge(s,(t=>j(El,{store:n,storeId:e,tableId:t,s:l}))))},jl=({s:e})=>{const l=A(null),n=A(0),[s,r]=F(!1),{scrollLeft:a,scrollTop:o}=t.useValues(e);$((()=>{const e=l.current;if(e&&!s){const l=new MutationObserver((()=>{e.scrollWidth>=T(a)+e.clientWidth&&e.scrollHeight>=T(o)+e.clientHeight&&e.scrollTo(a,o)}));return l.observe(e,{childList:!0,subtree:!0}),()=>l.disconnect()}}),[s,a,o]);const i=z((l=>{const{scrollLeft:t,scrollTop:s}=l[k];cancelIdleCallback(n.current),n.current=requestIdleCallback((()=>{r(!0),e.setPartialValues({scrollLeft:t,scrollTop:s})}))}),[e]),u=t.useStore(),d=t.useStoreIds(),c=t.useMetrics(),h=t.useMetricsIds(),m=t.useIndexes(),b=t.useIndexesIds(),p=t.useRelationships(),v=t.useRelationshipsIds(),g=t.useQueries(),f=t.useQueriesIds();return O(u)&&Q(d)&&O(c)&&Q(h)&&O(m)&&Q(b)&&O(p)&&Q(v)&&O(g)&&Q(f)?j("span",{className:"warn"},"There are no Stores or other objects to inspect. Make sure you placed the StoreInspector inside a Provider component."):j("article",{ref:l,onScroll:i},j(Ml,{s:e}),B(d,(l=>j(Ml,{storeId:l,key:l,s:e}))),j(Rl,{s:e}),B(h,(l=>j(Rl,{metricsId:l,key:l,s:e}))),j(Tl,{s:e}),B(b,(l=>j(Tl,{indexesId:l,key:l,s:e}))),j(Nl,{s:e}),B(v,(l=>j(Nl,{relationshipsId:l,key:l,s:e}))),j(ql,{s:e}),B(f,(l=>j(ql,{queriesId:l,key:l,s:e}))))};var zl=Object.defineProperty,$l=(e,l,t)=>(((e,l,t)=>{l in e?zl(e,l,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[l]=t})(e,"symbol"!=typeof l?l+"":l,t),t);class Al extends L{constructor(e){super(e),$l(this,"componentDidCatch",((e,l)=>console.error(e,l.componentStack))),this.state={e:0}}render(){return this.state.e?j("span",{className:"warn"},"Inspector error: please see console for details."):this.props.children}}$l(Al,"getDerivedStateFromError",(()=>({e:1})));const Fl=({s:e})=>{var l;const n=null!=(l=t.useValue(me,e))?l:1,s=t.useSetValueCallback(be,(()=>!1),[],e),r=t.useSetValueCallback(me,(e=>Number(e[k].dataset.id)),[],e);return j("header",null,j("img",{title:ie}),j("span",null,ie),B(ue,((e,l)=>l==n?null:j("img",{onClick:r,"data-id":l,title:"Dock to "+e,key:l}))),j("img",{onClick:s,title:"Close"}))},Jl=({s:e})=>{var l;const n=null!=(l=t.useValue(me,e))?l:1;return t.useValue(be,e)?j("main",{"data-position":n},j(Fl,{s:e}),j(Al,null,j(jl,{s:e}))):null},Dl=e=>l=>{return t=(l,t)=>l+e(t),Kl(l).reduce(t,0);var t},Bl=e=>{var l;return null!=(l=null==e?void 0:e.size)?l:0},Hl=Dl(Bl),Ql=Dl(Hl),Wl=Dl(Ql),Ul=(e,l)=>{var t;return null!=(t=null==e?void 0:e.has(l))&&t},Gl=e=>O(e)||0==Bl(e),Kl=e=>{var l;return[...null!=(l=null==e?void 0:e.values())?l:[]]},Xl=e=>e.clear(),Yl=(e,l)=>null==e?void 0:e.forEach(l),Zl=(e,l)=>null==e?void 0:e.delete(l),_l=e=>new Map(e),et=e=>{var l;return[...null!=(l=null==e?void 0:e.keys())?l:[]]},lt=(e,l)=>null==e?void 0:e.get(l),tt=(e,l)=>Yl(e,((e,t)=>l(t,e))),nt=(e,l,t)=>O(t)?(Zl(e,l),e):null==e?void 0:e.set(l,t),st=(e,l,t)=>(Ul(e,l)||nt(e,l,t()),lt(e,l)),rt=(e,l,t,n=nt)=>(ne(l,((l,n)=>t(e,n,l))),tt(e,(t=>le(l,t)?0:n(e,t))),e),at=(e,l,t)=>{const n={};return Yl(e,((e,s)=>{const r=l?l(e,s):e;!(null==t?void 0:t(r,e))&&(n[s]=r)})),n},ot=(e,l,t)=>at(e,(e=>at(e,l,t)),se),it=(e,l,t)=>at(e,(e=>ot(e,l,t)),se),ut=(e,l)=>{const t=_l();return Yl(e,((e,n)=>{var s;return t.set(n,null!=(s=null==l?void 0:l(e))?s:e)})),t},dt=e=>ut(e,ut),ct=e=>ut(e,dt),ht=(e,l,t,n,s=0)=>q((t?st:lt)(e,l[s],s>H(l)-2?t:_l),(r=>{if(s>H(l)-2)return(null==n?void 0:n(r))&&nt(e,l[s]),r;const a=ht(r,l,t,n,s+1);return Gl(r)&&nt(e,l[s]),a}));var mt=(e,l,t)=>new Promise(((n,s)=>{var r=e=>{try{o(t.next(e))}catch(e){s(e)}},a=e=>{try{o(t.throw(e))}catch(e){s(e)}},o=e=>e.done?n(e.value):Promise.resolve(e.value).then(r,a);o((t=t.apply(e,l)).next())}));const bt=_l(),pt=_l();var vt=(e,l,t)=>new Promise(((n,s)=>{var r=e=>{try{o(t.next(e))}catch(e){s(e)}},a=e=>{try{o(t.throw(e))}catch(e){s(e)}},o=e=>e.done?n(e.value):Promise.resolve(e.value).then(r,a);o((t=t.apply(e,l)).next())}));const gt="storage",ft=globalThis.window,It=e=>new Set(E(e)||O(e)?e:[e]),yt=(e,l)=>null==e?void 0:e.add(l),wt=/^\d+$/,Ct=()=>{const e=[];let l=0;return[t=>{var n;return null!=(n=t?G(e):null)?n:s+l++},l=>{wt.test(l)&&H(e)<1e3&&U(e,l)}]},kt=e=>[e,e],xt=(e,l=Hl)=>l(e[0])+l(e[1]),St=()=>[_l(),_l()],Tt=e=>[...e],Vt=([e,l])=>e===l,Rt=(e,l,t)=>O(e)||!_(e)||se(e)||Y(e)?(null==t||t(),!1):(ne(e,((t,n)=>{l(t,n)||te(e,n)})),!se(e)),Ot=(e,l,t)=>nt(e,l,lt(e,l)==-t?void 0:t),qt=()=>{let e,l,t=!1,n=!1,r=0;const a=_l(),i=_l(),c=_l(),k=_l(),x=_l(),T=_l(),V=_l(),R=_l(),E=_l(),L=_l(),M=_l(),j=_l(),z=_l(),$=_l(),A=It(),F=_l(),J=_l(),Q=_l(),G=_l(),K=St(),X=St(),Y=St(),_=St(),ee=St(),oe=St(),ie=St(),ue=St(),de=St(),ce=St(),he=St(),me=St(),be=St(),pe=St(),ve=St(),ge=_l(),fe=St(),[Ie,ye,we,Ce]=(e=>{let l;const[t,n]=Ct(),r=_l();return[(e,n,a,o=[],i=(()=>[]))=>{null!=l||(l=Al);const u=t(1);return nt(r,u,[e,n,a,o,i]),yt(ht(n,null!=a?a:[s],It),u),u},(e,t,...n)=>D(((e,l=[s])=>{const t=[],n=(e,s)=>s==H(l)?U(t,e):null===l[s]?Yl(e,(e=>n(e,s+1))):D([l[s],null],(l=>n(lt(e,l),s+1)));return n(e,0),t})(e,t),(e=>Yl(e,(e=>lt(r,e)[0](l,...null!=t?t:[],...n))))),e=>q(lt(r,e),(([,l,t])=>(ht(l,null!=t?t:[s],void 0,(l=>(Zl(l,e),Gl(l)?1:0))),nt(r,e),n(e),t))),e=>q(lt(r,e),(([e,,t=[],n,s])=>{const r=(...a)=>{var o,i;const u=H(a);u==H(t)?e(l,...a,...s(a)):O(t[u])?D(null!=(i=null==(o=n[u])?void 0:o.call(n,...a))?i:[],(e=>r(...a,e))):r(...a,t[u])};r()}))]})(),ke=e=>{if(!Rt(e,((e,l)=>[u,d].includes(l))))return!1;const l=e[u];return!(!P(l)&&l!=o||(Je(e[d])!=l&&te(e,d),0))},xe=(l,t)=>(!e||Ul(M,t)||nl(t))&&Rt(l,((e,l)=>Se(t,l,e)),(()=>nl(t))),Se=(e,l,t,n)=>Rt(n?t:Oe(t,e,l),((n,s)=>q(Te(e,l,s,n),(e=>(t[s]=e,!0)),(()=>!1))),(()=>nl(e,l))),Te=(l,t,n,s)=>e?q(lt(lt(M,l),n),(e=>Je(s)!=e[u]?nl(l,t,n,s,e[d]):s),(()=>nl(l,t,n,s))):O(Je(s))?nl(l,t,n,s):s,Ve=(e,l)=>Rt(l?e:qe(e),((l,t)=>q(Re(t,l),(l=>(e[t]=l,!0)),(()=>!1))),(()=>sl())),Re=(e,t)=>l?q(lt(z,e),(l=>Je(t)!=l[u]?sl(e,t,l[d]):t),(()=>sl(e,t))):O(Je(t))?sl(e,t):t,Oe=(e,l,t)=>(q(lt(j,l),(([n,s])=>{Yl(n,((l,t)=>{le(e,t)||(e[t]=l)})),Yl(s,(n=>{le(e,n)||nl(l,t,n)}))})),e),qe=e=>(l&&(Yl($,((l,t)=>{le(e,t)||(e[t]=l)})),Yl(A,(l=>{le(e,l)||sl(l)}))),e),Pe=e=>rt(M,e,((e,l,t)=>{const n=_l(),s=It();rt(st(M,l,_l),t,((e,l,t)=>{nt(e,l,t),q(t[d],(e=>nt(n,l,e)),(()=>yt(s,l)))})),nt(j,l,[n,s])}),((e,l)=>{nt(M,l),nt(j,l)})),Ne=e=>rt(z,e,((e,l,t)=>{nt(z,l,t),q(t[d],(e=>nt($,l,e)),(()=>yt(A,l)))}),((e,l)=>{nt(z,l),nt($,l),Zl(A,l)})),Ee=e=>se(e)?ql():Sl(e),Le=e=>rt(Q,e,((e,l,t)=>Me(l,t)),((e,l)=>Ue(l))),Me=(e,l)=>rt(st(Q,e,(()=>(Ye(e,1),nt(F,e,Ct()),nt(J,e,_l()),_l()))),l,((l,t,n)=>je(e,l,t,n)),((l,t)=>Ge(e,l,t))),je=(e,l,t,n,s)=>rt(st(l,t,(()=>(Ze(e,t,1),_l()))),n,((l,n,s)=>ze(e,t,l,n,s)),((n,r)=>Ke(e,l,t,n,r,s))),ze=(e,l,t,n,s)=>{Ul(t,n)||_e(e,l,n,1);const r=lt(t,n);s!==r&&(el(e,l,n,r,s),nt(t,n,s))},$e=(e,l,t,n,s)=>q(lt(l,t),(l=>ze(e,t,l,n,s)),(()=>je(e,l,t,Oe({[n]:s},e,t)))),Ae=e=>se(e)?El():Tl(e),Fe=e=>rt(G,e,((e,l,t)=>He(l,t)),((e,l)=>Xe(l))),He=(e,l)=>{Ul(G,e)||ll(e,1);const t=lt(G,e);l!==t&&(tl(e,t,l),nt(G,e,l))},Qe=(e,l)=>{const[t]=lt(F,e),n=t(l);return Ul(lt(Q,e),n)?Qe(e,l):n},We=e=>{var l;return null!=(l=lt(Q,e))?l:Me(e,{})},Ue=e=>Me(e,{}),Ge=(e,l,t)=>{const[,n]=lt(F,e);n(t),je(e,l,t,{},!0)},Ke=(e,l,t,n,s,r)=>{var a;const o=lt(null==(a=lt(j,e))?void 0:a[0],s);if(!O(o)&&!r)return ze(e,t,n,s,o);const i=l=>{el(e,t,l,lt(n,l)),_e(e,t,l,-1),nt(n,l)};O(o)?i(s):tt(n,i),Gl(n)&&(Ze(e,t,-1),Gl(nt(l,t))&&(Ye(e,-1),nt(Q,e),nt(F,e),nt(J,e)))},Xe=e=>{const l=lt($,e);if(!O(l))return He(e,l);tl(e,lt(G,e)),ll(e,-1),nt(G,e)},Ye=(e,l)=>Ot(a,e,l),Ze=(e,l,t)=>Ot(st(k,e,_l),l,t)&&nt(c,e,st(c,e,(()=>0))+t),_e=(e,l,t,n)=>{var s;const r=lt(J,e),a=null!=(s=lt(r,t))?s:0;(0==a&&1==n||1==a&&-1==n)&&Ot(st(i,e,_l),t,n),nt(r,t,a!=-n?a+n:null),Ot(st(st(x,e,_l),l,_l),t,n)},el=(e,l,t,n,s)=>st(st(st(T,e,_l),l,_l),t,(()=>[n,0]))[1]=s,ll=(e,l)=>Ot(V,e,l),tl=(e,l,t)=>st(R,e,(()=>[l,0]))[1]=t,nl=(e,l,t,n,s)=>(U(st(st(st(E,e,_l),l,_l),t,(()=>[])),n),s),sl=(e,l,t)=>(U(st(L,e,(()=>[])),l),t),rl=(e,l,t)=>q(lt(lt(lt(T,e),l),t),(([e,l])=>[!0,e,l]),(()=>[!1,...kt(wl(e,l,t))])),al=e=>q(lt(R,e),(([e,l])=>[!0,e,l]),(()=>[!1,...kt(xl(e))])),ol=e=>Gl(E)||Gl(he[e])?0:Yl(e?ct(E):E,((l,t)=>Yl(l,((l,n)=>Yl(l,((l,s)=>ye(he[e],[t,n,s],l))))))),il=e=>Gl(L)||Gl(me[e])?0:Yl(e?ut(L):L,((l,t)=>ye(me[e],[t],l))),ul=(e,l,t)=>{if(!Gl(l))return ye(e,t,(()=>at(l))),1},dl=e=>{const l=Gl(ie[e]),t=Gl(de[e])&&Gl(_[e])&&Gl(ee[e])&&Gl(oe[e])&&l&&Gl(X[e]),n=Gl(ce[e])&&Gl(ue[e])&&Gl(Y[e])&&Gl(K[e]);if(!t||!n){const s=e?[ut(a),dt(i),ut(c),dt(k),ct(x),ct(T)]:[a,i,c,k,x,T];if(!t){ul(X[e],s[0]),Yl(s[1],((l,t)=>ul(_[e],l,[t]))),Yl(s[2],((l,t)=>{0!=l&&ye(ee[e],[t],gl(t))}));const t=It();Yl(s[3],((n,s)=>{ul(oe[e],n,[s])&&!l&&(ye(ie[e],[s,null]),yt(t,s))})),l||Yl(s[5],((l,n)=>{if(!Ul(t,n)){const t=It();Yl(l,(e=>Yl(e,(([l,n],s)=>n!==l?yt(t,s):Zl(e,s))))),Yl(t,(l=>ye(ie[e],[n,l])))}})),Yl(s[4],((l,t)=>Yl(l,((l,n)=>ul(de[e],l,[t,n])))))}if(!n){let l;Yl(s[5],((t,n)=>{let s;Yl(t,((t,r)=>{let a;Yl(t,(([t,o],i)=>{o!==t&&(ye(ce[e],[n,r,i],o,t,rl),l=s=a=1)})),a&&ye(ue[e],[n,r],rl)})),s&&ye(Y[e],[n],rl)})),l&&ye(K[e],void 0,rl)}}},cl=e=>{const l=Gl(pe[e]),t=Gl(ve[e])&&Gl(be[e]);if(!l||!t){const n=e?[ut(V),ut(R)]:[V,R];if(l||ul(pe[e],n[0]),!t){let l;Yl(n[1],(([t,n],s)=>{n!==t&&(ye(ve[e],[s],n,t,al),l=1)})),l&&ye(be[e],void 0,al)}}},hl=(e,...l)=>(jl((()=>e(...B(l,S)))),Al),ml=()=>[at(T,((e,l)=>-1===lt(a,l)?null:at(e,((e,t)=>-1===lt(lt(k,l),t)?null:at(e,(([,e])=>null!=e?e:null),((e,l)=>Vt(l)))),se)),se),at(R,(([,e])=>null!=e?e:null),((e,l)=>Vt(l)))],bl=()=>({cellsTouched:t,valuesTouched:n,changedCells:it(T,Tt,Vt),invalidCells:it(E),changedValues:at(R,Tt,Vt),invalidValues:at(L),changedTableIds:at(a),changedRowIds:ot(k),changedCellIds:it(x),changedValueIds:at(V)}),pl=()=>it(Q),vl=()=>et(Q),gl=e=>Bl(lt(Q,S(e))),fl=e=>et(lt(Q,S(e))),Il=(e,l,t,n=0,s)=>{return B(W((a=lt(Q,S(e)),o=(e,t)=>[O(l)?t:lt(e,S(l)),t],r=([e],[l])=>{return((null!=(n=e)?n:0)<(null!=(s=l)?s:0)?-1:1)*(t?-1:1);var n,s},B([...null!=(i=null==a?void 0:a.entries())?i:[]],(([e,l])=>o(l,e))).sort(r)),n,O(s)?s:n+s),(([,e])=>e));var r,a,o,i},yl=(e,l)=>et(lt(lt(Q,S(e)),S(l))),wl=(e,l,t)=>lt(lt(lt(Q,S(e)),S(l)),S(t)),Cl=()=>at(G),kl=()=>et(G),xl=e=>lt(G,S(e)),Sl=e=>hl((()=>(e=>Rt(e,xe,nl))(e)?Le(e):0)),Tl=e=>hl((()=>Ve(e)?Fe(e):0)),Vl=e=>{try{Ee(ae(e))}catch(e){}return Al},Rl=l=>hl((()=>{if((e=Rt(l,(e=>Rt(e,ke))))&&(Pe(l),!Gl(Q))){const e=pl();ql(),Sl(e)}})),Ol=e=>hl((()=>{if(l=(e=>Rt(e,ke))(e)){const t=Cl();Ml(),El(),l=!0,Ne(e),Tl(t)}})),ql=()=>hl((()=>Le({}))),Pl=e=>hl((e=>Ul(Q,e)?Ue(e):0),e),Nl=(e,l)=>hl(((e,l)=>q(lt(Q,e),(t=>Ul(t,l)?Ge(e,t,l):0))),e,l),El=()=>hl((()=>Fe({}))),Ll=()=>hl((()=>{Pe({}),e=!1})),Ml=()=>hl((()=>{Ne({}),l=!1})),jl=(e,l)=>{if(-1!=r){zl();const t=e();return $l(l),t}},zl=()=>(-1!=r&&r++,1==r&&ye(ge,void 0,ml,bl),Al),$l=e=>(r>0&&(r--,0==r&&(t=!Gl(T),n=!Gl(R),r=1,ol(1),t&&dl(1),il(1),n&&cl(1),(null==e?void 0:e(ml,bl))&&(Yl(T,((e,l)=>Yl(e,((e,t)=>Yl(e,(([e],n)=>De(Al,l,t,n,e))))))),Yl(R,(([e],l)=>Be(Al,l,e))),t=n=!1),ye(fe[0],void 0,ml,bl),r=-1,ol(0),t&&dl(0),il(0),n&&cl(0),ye(fe[1],void 0,ml,bl),r=0,t=n=!1,D([a,i,c,k,x,T,E,V,R,L],Xl))),Al),Al={getContent:()=>[pl(),Cl()],getTables:pl,getTableIds:vl,getTable:e=>ot(lt(Q,S(e))),getTableCellIds:e=>et(lt(J,S(e))),getRowCount:gl,getRowIds:fl,getSortedRowIds:Il,getRow:(e,l)=>at(lt(lt(Q,S(e)),S(l))),getCellIds:yl,getCell:wl,getValues:Cl,getValueIds:kl,getValue:xl,hasTables:()=>!Gl(Q),hasTable:e=>Ul(Q,S(e)),hasTableCell:(e,l)=>Ul(lt(J,S(e)),S(l)),hasRow:(e,l)=>Ul(lt(Q,S(e)),S(l)),hasCell:(e,l,t)=>Ul(lt(lt(Q,S(e)),S(l)),S(t)),hasValues:()=>!Gl(G),hasValue:e=>Ul(G,S(e)),getTablesJson:()=>re(Q),getValuesJson:()=>re(G),getJson:()=>re([Q,G]),getTablesSchemaJson:()=>re(M),getValuesSchemaJson:()=>re(z),getSchemaJson:()=>re([M,z]),hasTablesSchema:()=>e,hasValuesSchema:()=>l,setContent:([e,l])=>hl((()=>{(se(e)?ql:Sl)(e),(se(l)?El:Tl)(l)})),setTables:Sl,setTable:(e,l)=>hl((e=>xe(l,e)?Me(e,l):0),e),setRow:(e,l,t)=>hl(((e,l)=>Se(e,l,t)?je(e,We(e),l,t):0),e,l),addRow:(e,l,t=!0)=>jl((()=>{let n;return Se(e,n,l)&&(e=S(e),je(e,We(e),n=Qe(e,t?1:0),l)),n})),setPartialRow:(e,l,t)=>hl(((e,l)=>{if(Se(e,l,t,1)){const n=We(e);ne(t,((t,s)=>$e(e,n,l,s,t)))}}),e,l),setCell:(e,l,t,n)=>hl(((e,l,t)=>q(Te(e,l,t,N(n)?n(wl(e,l,t)):n),(n=>$e(e,We(e),l,t,n)))),e,l,t),setValues:Tl,setPartialValues:e=>hl((()=>Ve(e,1)?ne(e,((e,l)=>He(l,e))):0)),setValue:(e,l)=>hl((e=>q(Re(e,N(l)?l(xl(e)):l),(l=>He(e,l)))),e),setTransactionChanges:e=>hl((()=>{ne(e[0],((e,l)=>O(e)?Pl(l):ne(e,((e,t)=>O(e)?Nl(l,t):ne(e,((e,n)=>De(Al,l,t,n,e))))))),ne(e[1],((e,l)=>Be(Al,l,e)))})),setTablesJson:Vl,setValuesJson:e=>{try{Ae(ae(e))}catch(e){}return Al},setJson:e=>{try{const[l,t]=ae(e);Ee(l),Ae(t)}catch(l){Vl(e)}return Al},setTablesSchema:Rl,setValuesSchema:Ol,setSchema:(e,l)=>hl((()=>{Rl(e),Ol(l)})),delTables:ql,delTable:Pl,delRow:Nl,delCell:(e,l,t,n)=>hl(((e,l,t)=>q(lt(Q,e),(s=>q(lt(s,l),(r=>Ul(r,t)?Ke(e,s,l,r,t,n):0))))),e,l,t),delValues:El,delValue:e=>hl((e=>Ul(G,e)?Xe(e):0),e),delTablesSchema:Ll,delValuesSchema:Ml,delSchema:()=>hl((()=>{Ll(),Ml()})),transaction:jl,startTransaction:zl,finishTransaction:$l,forEachTable:e=>Yl(Q,((l,t)=>e(t,(e=>Yl(l,((l,t)=>e(t,(e=>tt(l,e))))))))),forEachTableCell:(e,l)=>tt(lt(J,S(e)),l),forEachRow:(e,l)=>Yl(lt(Q,S(e)),((e,t)=>l(t,(l=>tt(e,l))))),forEachCell:(e,l,t)=>tt(lt(lt(Q,S(e)),S(l)),t),forEachValue:e=>tt(G,e),addSortedRowIdsListener:(e,l,t,n,s,r,a)=>{let o=Il(e,l,t,n,s);return Ie((()=>{const a=Il(e,l,t,n,s);var i,u,d;u=o,H(i=a)===H(u)&&(d=(e,l)=>u[l]===e,i.every(d))||(o=a,r(Al,e,l,t,n,s,o))}),ie[a?1:0],[e,l],[vl])},addStartTransactionListener:e=>Ie(e,ge),addWillFinishTransactionListener:e=>Ie(e,fe[0]),addDidFinishTransactionListener:e=>Ie(e,fe[1]),callListener:e=>(Ce(e),Al),delListener:e=>(we(e),Al),getListenerStats:()=>({tables:xt(K),tableIds:xt(X),tableCellIds:xt(_),table:xt(Y),rowCount:xt(ee),rowIds:xt(oe),sortedRowIds:xt(ie),row:xt(ue,Ql),cellIds:xt(de,Ql),cell:xt(ce,Wl),invalidCell:xt(he,Wl),values:xt(be),valueIds:xt(pe),value:xt(ve),invalidValue:xt(me),transaction:Hl(ge)+xt(fe)}),createStore:qt,addListener:Ie,callListeners:ye};return ne({[m]:[0,K],[b]:[0,X],[h]:[1,Y,[vl]],[h+I]:[1,_,[vl]],[v]:[1,ee,[vl]],[g]:[1,oe,[vl]],[p]:[2,ue,[vl,fl]],[I]:[2,de,[vl,fl]],[f]:[3,ce,[vl,fl,yl],e=>kt(wl(...e))],InvalidCell:[3,he],[w]:[0,be],[C]:[0,pe],[y]:[1,ve,[kl],e=>kt(xl(e[0]))],InvalidValue:[1,me]},(([e,l,t,n],s)=>{Al["add"+s+"Listener"]=(...s)=>Ie(s[e],l[s[e+1]?1:0],e>0?W(s,0,e):void 0,t,n)})),Z(Al)},Pt=({position:e="right",open:l=!1})=>{const n=t.useCreateStore(qt),s=ue.indexOf(e);return t.useCreatePersister(n,(e=>{return((e,l,t,n)=>((e,l,t,n,s,r,a=[])=>{let o,i,u,d=0,c=0,h=0,m=0;st(bt,a,(()=>0)),st(pt,a,(()=>[]));const b=e=>mt(void 0,null,(function*(){return 2!=d&&(d=1,c++,yield p.schedule((()=>mt(void 0,null,(function*(){yield e(),d=0}))))),p})),p={load:(t,n)=>mt(void 0,null,(function*(){return yield b((()=>mt(void 0,null,(function*(){try{e.setContent(yield l())}catch(l){e.setContent([t,n])}}))))})),startAutoLoad:(...t)=>mt(void 0,[...t],(function*(t={},s={}){return p.stopAutoLoad(),yield p.load(t,s),m=1,u=n(((t,n)=>mt(void 0,null,(function*(){if(n){const l=n();yield b((()=>mt(void 0,null,(function*(){return e.setTransactionChanges(l)}))))}else yield b((()=>mt(void 0,null,(function*(){var n;try{e.setContent(null!=(n=null==t?void 0:t())?n:yield l())}catch(e){null==r||r(e)}}))))})))),p})),stopAutoLoad:()=>(m&&(s(u),u=void 0,m=0),p),save:l=>mt(void 0,null,(function*(){return 1!=d&&(d=2,h++,yield p.schedule((()=>mt(void 0,null,(function*(){try{yield t(e.getContent,l)}catch(e){null==r||r(e)}d=0}))))),p})),startAutoSave:()=>mt(void 0,null,(function*(){return yield p.stopAutoSave().save(),o=e.addDidFinishTransactionListener(((e,l)=>{const[t,n]=l();se(t)&&se(n)||p.save((()=>[t,n]))})),p})),stopAutoSave:()=>(q(o,e.delListener),p),schedule:(...e)=>mt(void 0,null,(function*(){return U(lt(pt,a),...e),yield mt(void 0,null,(function*(){if(!lt(bt,a)){for(nt(bt,a,1);!O(i=G(lt(pt,a)));)try{yield i()}catch(e){null==r||r(e)}nt(bt,a,0)}})),p})),getStore:()=>e,destroy:()=>p.stopAutoLoad().stopAutoSave(),getStats:()=>({loads:c,saves:h})};return Z(p)})(e,(()=>vt(void 0,null,(function*(){return ae(t.getItem(l))}))),(e=>vt(void 0,null,(function*(){return t.setItem(l,re(e()))}))),(e=>{const n=n=>{n.storageArea===t&&n.key===l&&e((()=>ae(n.newValue)))};return ft.addEventListener(gt,n),n}),(e=>ft.removeEventListener(gt,e)),n))(e,oe,sessionStorage,l);var l}),void 0,(e=>{return t=function*(){yield e.load(void 0,{position:-1==s?1:s,open:!!l}),yield e.startAutoSave()},new Promise(((e,l)=>{var n=e=>{try{r(t.next(e))}catch(e){l(e)}},s=e=>{try{r(t.throw(e))}catch(e){l(e)}},r=l=>l.done?e(l.value):Promise.resolve(l.value).then(n,s);r((t=t.apply(void 0,null)).next())}));var t})),j(M,null,j("aside",{id:oe},j(Ae,{s:n}),j(Jl,{s:n})),j("style",null,$e))};var Nt=Object.defineProperty,Et=Object.getOwnPropertySymbols,Lt=Object.prototype.hasOwnProperty,Mt=Object.prototype.propertyIsEnumerable,jt=(e,l,t)=>l in e?Nt(e,l,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[l]=t;e.EditableCellView=wl,e.EditableValueView=Cl,e.RelationshipInHtmlTable=Il,e.ResultSortedTableInHtmlTable=yl,e.ResultTableInHtmlTable=e=>{var l=e,{queryId:n,queries:s,customCells:r}=l,a=el(l,["queryId","queries","customCells"]);return j(hl,_e(Ze({},a),{params:ol(cl(t.useResultTableCellIds(n,s),r,t.ResultCellView),ul(s,n),t.useResultRowIds(n,s))}))},e.SliceInHtmlTable=fl,e.SortedTableInHtmlTable=vl,e.SortedTablePaginator=kl,e.StoreInspector=e=>j(Pt,((e,l)=>{for(var t in l||(l={}))Lt.call(l,t)&&jt(e,t,l[t]);if(Et)for(var t of Et(l))Mt.call(l,t)&&jt(e,t,l[t]);return e})({},e)),e.TableInHtmlTable=e=>{var l=e,{tableId:n,store:s,editable:r,customCells:a}=l,o=el(l,["tableId","store","editable","customCells"]);return j(hl,_e(Ze({},o),{params:ol(cl(t.useTableCellIds(n,s),a,r?wl:t.CellView),il(s,n),t.useRowIds(n,s))}))},e.ValuesInHtmlTable=gl},"object"==typeof exports&&"undefined"!=typeof module?l(exports,require("react"),require("./ui-react")):"function"==typeof define&&define.amd?define(["exports","react","./ui-react"],l):l((e="undefined"!=typeof globalThis?globalThis:e||self).TinyBaseUiReactDomDebug={},e.React,e.TinyBaseUiReact);
1
+ var e,l;e=this,l=function(e,l,t){"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="Ids",h="Table",m=h+"s",b=h+c,p="Row",v=p+"Count",g=p+c,f="Cell",I=f+c,y="Value",w=y+"s",C=y+c,k="currentTarget",x="value",S=e=>s+e,T=Math.floor,V=isFinite,R=(e,l)=>e instanceof l,O=e=>null==e,q=(e,l,t)=>O(e)?null==t?void 0:t():l(e),P=e=>e==r||e==a,N=e=>n(e)==i,E=e=>Array.isArray(e),{PureComponent:L,Fragment:M,createElement:j,useCallback:z,useLayoutEffect:$,useRef:A,useState:F}=l,J=(e,...l)=>O(e)?{}:e(...l),D=(e,l)=>e.forEach(l),B=(e,l)=>e.map(l),H=e=>e.length,Q=e=>0==H(e),W=(e,l,t)=>e.slice(l,t),U=(e,...l)=>e.push(...l),G=e=>e.shift(),K=Object,X=K.keys,Y=K.isFrozen,Z=K.freeze,_=e=>R(e,K)&&e.constructor==K,ee=(e=[])=>K.fromEntries(e),le=(e,l)=>!O(((e,l)=>q(e,(e=>e[l])))(e,l)),te=(e,l)=>(delete e[l],e),ne=(e,l)=>B(K.entries(e),(([e,t])=>l(t,e))),se=e=>_(e)&&0==(e=>H(X(e)))(e),re=e=>JSON.stringify(e,((e,l)=>R(l,Map)?K.fromEntries([...l]):l)),ae=JSON.parse,oe="tinybaseStoreInspector",ie="TinyBase Store Inspector",ue=["left","top","bottom","right","full"],de="state",ce="sort",he="open",me="position",be=he,pe="editable",ve=(...e)=>re(e),ge=(e,l)=>B(e.sort(),l),fe=(e,l)=>[!!t.useCell(de,e,pe,l),z((t=>{l.setCell(de,e,pe,(e=>!e)),t.preventDefault()}),[l,e])],Ie="M20 80l5-15l40-40l10 10l-40 40l-15 5m5-15l10 10",ye='content:url("',we=ye+"data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' stroke-width='4' stroke='white' fill='none'>",Ce='</svg>")',ke=ye+"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\")",xe=B([[20,20,20,60],[20,20,60,20],[20,60,60,20],[60,20,20,60],[30,30,40,40]],(([e,l,t,n])=>we+`<rect x='20' y='20' width='60' height='60' fill='grey'/><rect x='${e}' y='${l}' width='${t}' height='${n}' fill='white'/>`+Ce)),Se=we+"<path d='M20 20l60 60M20 80l60-60' />"+Ce,Te=we+`<path d='${Ie}' />`+Ce,Ve=we+`<path d='${Ie}M20 20l60 60' />`+Ce;var Re=Object.defineProperty,Oe=Object.defineProperties,qe=Object.getOwnPropertyDescriptors,Pe=Object.getOwnPropertySymbols,Ne=Object.prototype.hasOwnProperty,Ee=Object.prototype.propertyIsEnumerable,Le=(e,l,t)=>l in e?Re(e,l,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[l]=t,Me=(e,l)=>{for(var t in l||(l={}))Ne.call(l,t)&&Le(e,t,l[t]);if(Pe)for(var t of Pe(l))Ee.call(l,t)&&Le(e,t,l[t]);return e},je=(e,l)=>Oe(e,qe(l));const ze="*::-webkit-scrollbar",$e=`#${oe}{\n all:initial;font-family:sans-serif;font-size:0.75rem;position:fixed;z-index:999999;\n ${((e,l="")=>e.join(l))(ne(je(Me(je(Me(je(Me({"*":"all:revert","*::before":"all:revert","*::after":"all:revert",[ze]:"width:0.5rem;height:0.5rem;",[ze+"-track"]:"background:#111",[ze+"-thumb"]:"background:#999;border:1px solid #111",[ze+"-thumb:hover"]:"background:#fff",[ze+"-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;"+ke},ee(B(["bottom:0;left:0","top:0;right:0"],((e,l)=>[`>img[data-position='${l}']`,e])))),{main:"display:flex;flex-direction:column;background:#111d;color:#fff;position:fixed;"}),ee(B(["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,l)=>[`main[data-position='${l}']`,e])))),{header:"display:flex;padding:0.25rem;background:#000;align-items:center","header>img:nth-of-type(1)":ke,"header>img:nth-of-type(6)":Se}),ee(B(xe,((e,l)=>[`header>img[data-id='${l}']`,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":Te,"details[open]>summary img.done":Ve,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,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,l)=>e?`& ${l}{${e}}`:"")))}`,Ae=({s:e})=>{var l;const n=null!=(l=t.useValue(me,e))?l:1,s=t.useSetValueCallback(be,(()=>!0),[],e);return t.useValue(be,e)?null:j("img",{onClick:s,title:ie,"data-position":n})},Fe=({uniqueId:e,summary:l,editable:n,handleEditable:s,children:r,s:a})=>{const o=!!t.useCell(de,e,he,a),i=t.useSetCellCallback(de,e,he,(e=>e[k].open),[],a);return j("details",{open:o,onToggle:i},j("summary",null,l,s?j("img",{onClick:s,className:n?"done":"edit"}):null),r)},Je=e=>{const l=n(e);return P(l)||l==o&&V(e)?l:void 0},De=(e,l,t,n,s)=>O(s)?e.delCell(l,t,n,!0):e.setCell(l,t,n,s),Be=(e,l,t)=>O(t)?e.delValue(l):e.setValue(l,t),He=(e,l,t,n)=>e==r?l:e==o?t:n;var Qe=Object.defineProperty,We=Object.defineProperties,Ue=Object.getOwnPropertyDescriptors,Ge=Object.getOwnPropertySymbols,Ke=Object.prototype.hasOwnProperty,Xe=Object.prototype.propertyIsEnumerable,Ye=(e,l,t)=>l in e?Qe(e,l,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[l]=t,Ze=(e,l)=>{for(var t in l||(l={}))Ke.call(l,t)&&Ye(e,t,l[t]);if(Ge)for(var t of Ge(l))Xe.call(l,t)&&Ye(e,t,l[t]);return e},_e=(e,l)=>We(e,Ue(l)),el=(e,l)=>{var t={};for(var n in e)Ke.call(e,n)&&l.indexOf(n)<0&&(t[n]=e[n]);if(null!=e&&Ge)for(var n of Ge(e))l.indexOf(n)<0&&Xe.call(e,n)&&(t[n]=e[n]);return t};const{useCallback:ll,useMemo:tl,useState:nl}=l,sl="editable",rl=(e,l)=>B(t.useTableCellIds(e,l),(l=>e+"."+l)),al=(e,l,t)=>{const n=ll(e,l);return t?n:void 0},ol=(...e)=>tl((()=>e),e),il=(e,l)=>tl((()=>({store:e,tableId:l})),[e,l]),ul=(e,l)=>tl((()=>({queries:e,queryId:l})),[e,l]),dl=(e,l=!1,t,n=0,s,r,a,o)=>{const[[i,u,d],c]=nl([e,l,n]),h=ll((e=>{c(e),null==o||o(e)}),[o]),m=al((e=>h([e,e==i&&!u,d])),[h,i,u,d],t),b=ll((e=>h([i,u,e])),[h,i,u]),p=!0===a?kl:a;return[[i,u,d],m,tl((()=>!1===a?null:j(p,{offset:d,limit:s,total:r,onChange:b})),[a,p,d,s,r,b])]},cl=(e,l,t)=>tl((()=>{const s=null!=l?l:e;return ee(ne(E(s)?ee(B(s,(e=>[e,e]))):s,((e,l)=>{return[l,Ze(Ze({},{label:l,component:t}),(s=e,n(s)==r?{label:e}:e))];var s})))}),[l,t,e]),hl=({className:e,headerRow:l,idColumn:t,params:[n,s,r,a,o,i]})=>j("table",{className:e},i?j("caption",null,i):null,!1===l?null:j("thead",null,j("tr",null,!1===t?null:j(ml,{sort:null!=a?a:[],label:"Id",onClick:o}),ne(n,(({label:e},l)=>j(ml,{key:l,cellId:l,label:e,sort:null!=a?a:[],onClick:o}))))),j("tbody",null,B(r,(e=>j("tr",{key:e},!1===t?null:j("th",null,e),ne(n,(({component:l,getComponentProps:t},n)=>j("td",{key:n},j(l,_e(Ze(Ze({},J(t,e,n)),s),{rowId:e,cellId:n})))))))))),ml=({cellId:e,sort:[l,t],label:n=(null!=e?e:s),onClick:r})=>j("th",{onClick:al((()=>null==r?void 0:r(e)),[r,e],r),className:O(t)||l!=e?void 0:`sorted ${t?"de":"a"}scending`},O(t)||l!=e?null:(t?"↓":"↑")+" ",n),bl=({localRowId:e,params:[n,s,r,a,o,i,u]})=>{const d=t.useRemoteRowId(o,e,i);return j("tr",null,!1===n?null:j(l.Fragment,null,j("th",null,e),j("th",null,d)),ne(s,(({component:l,getComponentProps:t},n)=>{const[s,o]=n.split(".",2),i=s===r?e:s===a?d:null;return O(i)?null:j("td",{key:n},j(l,_e(Ze({},J(t,i,o)),{store:u,tableId:s,rowId:i,cellId:o})))})))},pl=({thing:e,onThingChange:l,className:t,hasSchema:n})=>{const[s,i]=nl(),[u,d]=nl(),[c,h]=nl(),[m,b]=nl(),[p,v]=nl();u!==e&&(i(Je(e)),d(e),h(e+""),b(Number(e)||0),v(!!e));const g=ll(((e,t)=>{t(e),d(e),l(e)}),[l]);return j("div",{className:t},j("button",{className:s,onClick:ll((()=>{if(!(null==n?void 0:n())){const e=He(s,o,a,r),t=He(e,c,m,p);i(e),d(t),l(t)}}),[n,l,c,m,p,s])},s),He(s,j("input",{key:s,value:c,onChange:ll((e=>g(e[k][x]+"",h)),[g])}),j("input",{key:s,type:"number",value:m,onChange:ll((e=>g(Number(e[k][x]||0),b)),[g])}),j("input",{key:s,type:"checkbox",checked:p,onChange:ll((e=>g(!!e[k].checked,v)),[g])})))},vl=e=>{var l=e,{tableId:n,cellId:s,descending:r,offset:a,limit:o,store:i,editable:u,sortOnClick:d,paginator:c=!1,onChange:h,customCells:m}=l,b=el(l,["tableId","cellId","descending","offset","limit","store","editable","sortOnClick","paginator","onChange","customCells"]);const[p,v,g]=dl(s,r,d,a,o,t.useRowCount(n,i),c,h);return j(hl,_e(Ze({},b),{params:ol(cl(t.useTableCellIds(n,i),m,u?wl:t.CellView),il(i,n),t.useSortedRowIds(n,...p,o,i),p,v,g)}))},gl=({store:e,editable:l=!1,valueComponent:n=(l?Cl:t.ValueView),getValueComponentProps:s,className:r,headerRow:a,idColumn:o})=>j("table",{className:r},!1===a?null:j("thead",null,j("tr",null,!1===o?null:j("th",null,"Id"),j("th",null,y))),j("tbody",null,B(t.useValueIds(e),(l=>j("tr",{key:l},!1===o?null:j("th",null,l),j("td",null,j(n,_e(Ze({},J(s,l)),{valueId:l,store:e})))))))),fl=e=>{var l=e,{indexId:n,sliceId:s,indexes:r,editable:a,customCells:o}=l,i=el(l,["indexId","sliceId","indexes","editable","customCells"]);const[u,d,c]=((e,l)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getTableId(l)])(t.useIndexesOrIndexesById(r),n);return j(hl,_e(Ze({},i),{params:ol(cl(t.useTableCellIds(c,d),o,a?wl:t.CellView),il(d,c),t.useSliceRowIds(n,s,u))}))},Il=({relationshipId:e,relationships:n,editable:s,customCells:r,className:a,headerRow:o,idColumn:i=!0})=>{const[u,d,c,h]=((e,l)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(l),null==e?void 0:e.getRemoteTableId(l)])(t.useRelationshipsOrRelationshipsById(n),e),m=cl([...rl(c,d),...rl(h,d)],r,s?wl:t.CellView),b=ol(i,m,c,h,e,u,d);return j("table",{className:a},!1===o?null:j("thead",null,j("tr",null,!1===i?null:j(l.Fragment,null,j("th",null,c,".Id"),j("th",null,h,".Id")),ne(m,(({label:e},l)=>j("th",{key:l},e))))),j("tbody",null,B(t.useRowIds(c,d),(e=>j(bl,{key:e,localRowId:e,params:b})))))},yl=e=>{var l=e,{queryId:n,cellId:s,descending:r,offset:a,limit:o,queries:i,sortOnClick:u,paginator:d=!1,customCells:c,onChange:h}=l,m=el(l,["queryId","cellId","descending","offset","limit","queries","sortOnClick","paginator","customCells","onChange"]);const[b,p,v]=dl(s,r,u,a,o,t.useResultRowCount(n,i),d,h);return j(hl,_e(Ze({},m),{params:ol(cl(t.useResultTableCellIds(n,i),c,t.ResultCellView),ul(i,n),t.useResultSortedRowIds(n,...b,o,i),b,p,v)}))},wl=({tableId:e,rowId:l,cellId:n,store:s,className:r})=>{var a;return j(pl,{thing:t.useCell(e,l,n,s),onThingChange:t.useSetCellCallback(e,l,n,(e=>e),[],s),className:null!=r?r:sl+f,hasSchema:null==(a=t.useStoreOrStoreById(s))?void 0:a.hasTablesSchema})},Cl=({valueId:e,store:l,className:n})=>{var s;return j(pl,{thing:t.useValue(e,l),onThingChange:t.useSetValueCallback(e,(e=>e),[],l),className:null!=n?n:sl+y,hasSchema:null==(s=t.useStoreOrStoreById(l))?void 0:s.hasValuesSchema})},kl=({onChange:e,total:t,offset:n=0,limit:s=t,singular:r="row",plural:a=r+"s"})=>{(n>t||n<0)&&(n=0,e(0));const o=al((()=>e(n-s)),[e,n,s],n>0),i=al((()=>e(n+s)),[e,n,s],n+s<t);return j(l.Fragment,null,t>s&&j(l.Fragment,null,j("button",{className:"previous",disabled:0==n,onClick:o},"←"),j("button",{className:"next",disabled:n+s>=t,onClick:i},"→"),n+1," to ",Math.min(t,n+s)," of "),t," ",1!=t?a:r)},xl=({indexes:e,indexesId:l,indexId:n,s:s})=>j(Fe,{uniqueId:ve("i",l,n),summary:"Index: "+n,s:s},B(t.useSliceIds(n,e),(t=>j(Sl,{indexes:e,indexesId:l,indexId:n,sliceId:t,s:s})))),Sl=({indexes:e,indexesId:l,indexId:t,sliceId:n,s:s})=>{const r=ve("i",l,t,n),[a,o]=fe(r,s);return j(Fe,{uniqueId:r,summary:"Slice: "+n,editable:a,handleEditable:o,s:s},j(fl,{sliceId:n,indexId:t,indexes:e,editable:a}))},Tl=({indexesId:e,s:l})=>{const n=t.useIndexes(e),s=t.useIndexIds(n);return O(n)?null:j(Fe,{uniqueId:ve("i",e),summary:"Indexes: "+(null!=e?e:d),s:l},Q(s)?"No indexes defined":ge(s,(t=>j(xl,{indexes:n,indexesId:e,indexId:t,s:l}))))},Vl=({metrics:e,metricId:l})=>j("tr",null,j("th",null,l),j("td",null,null==e?void 0:e.getTableId(l)),j("td",null,t.useMetric(l,e))),Rl=({metricsId:e,s:l})=>{const n=t.useMetrics(e),s=t.useMetricIds(n);return O(n)?null:j(Fe,{uniqueId:ve("m",e),summary:"Metrics: "+(null!=e?e:d),s:l},Q(s)?"No metrics defined":j("table",null,j("thead",null,j("th",null,"Metric Id"),j("th",null,"Table Id"),j("th",null,"Metric")),j("tbody",null,B(s,(e=>j(Vl,{metrics:n,metricId:e}))))))},Ol=({queries:e,queriesId:l,queryId:n,s:s})=>{var r;const a=ve("q",l,n),[o,i,u]=ae(null!=(r=t.useCell(de,a,ce,s))?r:"[]"),d=t.useSetCellCallback(de,a,ce,re,[],s);return j(Fe,{uniqueId:a,summary:"Query: "+n,s:s},j(yl,{queryId:n,queries:e,cellId:o,descending:i,offset:u,limit:10,paginator:!0,sortOnClick:!0,onChange:d}))},ql=({queriesId:e,s:l})=>{const n=t.useQueries(e),s=t.useQueryIds(n);return O(n)?null:j(Fe,{uniqueId:ve("q",e),summary:"Queries: "+(null!=e?e:d),s:l},Q(s)?"No queries defined":ge(s,(t=>j(Ol,{queries:n,queriesId:e,queryId:t,s:l}))))},Pl=({relationships:e,relationshipsId:l,relationshipId:t,s:n})=>{const s=ve("r",l,t),[r,a]=fe(s,n);return j(Fe,{uniqueId:s,summary:"Relationship: "+t,editable:r,handleEditable:a,s:n},j(Il,{relationshipId:t,relationships:e,editable:r}))},Nl=({relationshipsId:e,s:l})=>{const n=t.useRelationships(e),s=t.useRelationshipIds(n);return O(n)?null:j(Fe,{uniqueId:ve("r",e),summary:"Relationships: "+(null!=e?e:d),s:l},Q(s)?"No relationships defined":ge(s,(t=>j(Pl,{relationships:n,relationshipsId:e,relationshipId:t,s:l}))))},El=({tableId:e,store:l,storeId:n,s:s})=>{var r;const a=ve("t",n,e),[o,i,u]=ae(null!=(r=t.useCell(de,a,ce,s))?r:"[]"),d=t.useSetCellCallback(de,a,ce,re,[],s),[c,m]=fe(a,s);return j(Fe,{uniqueId:a,summary:h+": "+e,editable:c,handleEditable:m,s:s},j(vl,{tableId:e,store:l,cellId:o,descending:i,offset:u,limit:10,paginator:!0,sortOnClick:!0,onChange:d,editable:c}))},Ll=({store:e,storeId:l,s:n})=>{const s=ve("v",l),[r,a]=fe(s,n);return Q(t.useValueIds(e))?null:j(Fe,{uniqueId:s,summary:w,editable:r,handleEditable:a,s:n},j(gl,{store:e,editable:r}))},Ml=({storeId:e,s:l})=>{const n=t.useStore(e),s=t.useTableIds(n);return O(n)?null:j(Fe,{uniqueId:ve("s",e),summary:"Store: "+(null!=e?e:d),s:l},j(Ll,{storeId:e,store:n,s:l}),ge(s,(t=>j(El,{store:n,storeId:e,tableId:t,s:l}))))},jl=({s:e})=>{const l=A(null),n=A(0),[s,r]=F(!1),{scrollLeft:a,scrollTop:o}=t.useValues(e);$((()=>{const e=l.current;if(e&&!s){const l=new MutationObserver((()=>{e.scrollWidth>=T(a)+e.clientWidth&&e.scrollHeight>=T(o)+e.clientHeight&&e.scrollTo(a,o)}));return l.observe(e,{childList:!0,subtree:!0}),()=>l.disconnect()}}),[s,a,o]);const i=z((l=>{const{scrollLeft:t,scrollTop:s}=l[k];cancelIdleCallback(n.current),n.current=requestIdleCallback((()=>{r(!0),e.setPartialValues({scrollLeft:t,scrollTop:s})}))}),[e]),u=t.useStore(),d=t.useStoreIds(),c=t.useMetrics(),h=t.useMetricsIds(),m=t.useIndexes(),b=t.useIndexesIds(),p=t.useRelationships(),v=t.useRelationshipsIds(),g=t.useQueries(),f=t.useQueriesIds();return O(u)&&Q(d)&&O(c)&&Q(h)&&O(m)&&Q(b)&&O(p)&&Q(v)&&O(g)&&Q(f)?j("span",{className:"warn"},"There are no Stores or other objects to inspect. Make sure you placed the StoreInspector inside a Provider component."):j("article",{ref:l,onScroll:i},j(Ml,{s:e}),B(d,(l=>j(Ml,{storeId:l,key:l,s:e}))),j(Rl,{s:e}),B(h,(l=>j(Rl,{metricsId:l,key:l,s:e}))),j(Tl,{s:e}),B(b,(l=>j(Tl,{indexesId:l,key:l,s:e}))),j(Nl,{s:e}),B(v,(l=>j(Nl,{relationshipsId:l,key:l,s:e}))),j(ql,{s:e}),B(f,(l=>j(ql,{queriesId:l,key:l,s:e}))))};var zl=Object.defineProperty,$l=(e,l,t)=>(((e,l,t)=>{l in e?zl(e,l,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[l]=t})(e,"symbol"!=typeof l?l+"":l,t),t);class Al extends L{constructor(e){super(e),$l(this,"componentDidCatch",((e,l)=>console.error(e,l.componentStack))),this.state={e:0}}render(){return this.state.e?j("span",{className:"warn"},"Inspector error: please see console for details."):this.props.children}}$l(Al,"getDerivedStateFromError",(()=>({e:1})));const Fl=({s:e})=>{var l;const n=null!=(l=t.useValue(me,e))?l:1,s=t.useSetValueCallback(be,(()=>!1),[],e),r=t.useSetValueCallback(me,(e=>Number(e[k].dataset.id)),[],e);return j("header",null,j("img",{title:ie}),j("span",null,ie),B(ue,((e,l)=>l==n?null:j("img",{onClick:r,"data-id":l,title:"Dock to "+e,key:l}))),j("img",{onClick:s,title:"Close"}))},Jl=({s:e})=>{var l;const n=null!=(l=t.useValue(me,e))?l:1;return t.useValue(be,e)?j("main",{"data-position":n},j(Fl,{s:e}),j(Al,null,j(jl,{s:e}))):null},Dl=e=>l=>{return t=(l,t)=>l+e(t),Kl(l).reduce(t,0);var t},Bl=e=>{var l;return null!=(l=null==e?void 0:e.size)?l:0},Hl=Dl(Bl),Ql=Dl(Hl),Wl=Dl(Ql),Ul=(e,l)=>{var t;return null!=(t=null==e?void 0:e.has(l))&&t},Gl=e=>O(e)||0==Bl(e),Kl=e=>{var l;return[...null!=(l=null==e?void 0:e.values())?l:[]]},Xl=e=>e.clear(),Yl=(e,l)=>null==e?void 0:e.forEach(l),Zl=(e,l)=>null==e?void 0:e.delete(l),_l=e=>new Map(e),et=e=>{var l;return[...null!=(l=null==e?void 0:e.keys())?l:[]]},lt=(e,l)=>null==e?void 0:e.get(l),tt=(e,l)=>Yl(e,((e,t)=>l(t,e))),nt=(e,l,t)=>O(t)?(Zl(e,l),e):null==e?void 0:e.set(l,t),st=(e,l,t)=>(Ul(e,l)||nt(e,l,t()),lt(e,l)),rt=(e,l,t,n=nt)=>(ne(l,((l,n)=>t(e,n,l))),tt(e,(t=>le(l,t)?0:n(e,t))),e),at=(e,l,t)=>{const n={};return Yl(e,((e,s)=>{const r=l?l(e,s):e;!(null==t?void 0:t(r,e))&&(n[s]=r)})),n},ot=(e,l,t)=>at(e,(e=>at(e,l,t)),se),it=(e,l,t)=>at(e,(e=>ot(e,l,t)),se),ut=(e,l)=>{const t=_l();return Yl(e,((e,n)=>{var s;return t.set(n,null!=(s=null==l?void 0:l(e))?s:e)})),t},dt=e=>ut(e,ut),ct=e=>ut(e,dt),ht=(e,l,t,n,s=0)=>q((t?st:lt)(e,l[s],s>H(l)-2?t:_l),(r=>{if(s>H(l)-2)return(null==n?void 0:n(r))&&nt(e,l[s]),r;const a=ht(r,l,t,n,s+1);return Gl(r)&&nt(e,l[s]),a}));var mt=(e,l,t)=>new Promise(((n,s)=>{var r=e=>{try{o(t.next(e))}catch(e){s(e)}},a=e=>{try{o(t.throw(e))}catch(e){s(e)}},o=e=>e.done?n(e.value):Promise.resolve(e.value).then(r,a);o((t=t.apply(e,l)).next())}));const bt=_l(),pt=_l();var vt=(e,l,t)=>new Promise(((n,s)=>{var r=e=>{try{o(t.next(e))}catch(e){s(e)}},a=e=>{try{o(t.throw(e))}catch(e){s(e)}},o=e=>e.done?n(e.value):Promise.resolve(e.value).then(r,a);o((t=t.apply(e,l)).next())}));const gt="storage",ft=globalThis.window,It=e=>new Set(E(e)||O(e)?e:[e]),yt=(e,l)=>null==e?void 0:e.add(l),wt=/^\d+$/,Ct=()=>{const e=[];let l=0;return[t=>{var n;return null!=(n=t?G(e):null)?n:s+l++},l=>{wt.test(l)&&H(e)<1e3&&U(e,l)}]},kt=e=>[e,e],xt=(e,l=Hl)=>l(e[0])+l(e[1]),St=()=>[_l(),_l()],Tt=e=>[...e],Vt=([e,l])=>e===l,Rt=(e,l,t)=>O(e)||!_(e)||se(e)||Y(e)?(null==t||t(),!1):(ne(e,((t,n)=>{l(t,n)||te(e,n)})),!se(e)),Ot=(e,l,t)=>nt(e,l,lt(e,l)==-t?void 0:t),qt=()=>{let e,l,t=!1,n=!1,r=0;const a=_l(),i=_l(),c=_l(),k=_l(),x=_l(),T=_l(),V=_l(),R=_l(),E=_l(),L=_l(),M=_l(),j=_l(),z=_l(),$=_l(),A=It(),F=_l(),J=_l(),Q=_l(),G=_l(),K=St(),X=St(),Y=St(),_=St(),ee=St(),oe=St(),ie=St(),ue=St(),de=St(),ce=St(),he=St(),me=St(),be=St(),pe=St(),ve=St(),ge=_l(),fe=St(),[Ie,ye,we,Ce]=(e=>{let l;const[t,n]=Ct(),r=_l();return[(e,n,a,o=[],i=(()=>[]))=>{null!=l||(l=Al);const u=t(1);return nt(r,u,[e,n,a,o,i]),yt(ht(n,null!=a?a:[s],It),u),u},(e,t,...n)=>D(((e,l=[s])=>{const t=[],n=(e,s)=>s==H(l)?U(t,e):null===l[s]?Yl(e,(e=>n(e,s+1))):D([l[s],null],(l=>n(lt(e,l),s+1)));return n(e,0),t})(e,t),(e=>Yl(e,(e=>lt(r,e)[0](l,...null!=t?t:[],...n))))),e=>q(lt(r,e),(([,l,t])=>(ht(l,null!=t?t:[s],void 0,(l=>(Zl(l,e),Gl(l)?1:0))),nt(r,e),n(e),t))),e=>q(lt(r,e),(([e,,t=[],n,s])=>{const r=(...a)=>{var o,i;const u=H(a);u==H(t)?e(l,...a,...s(a)):O(t[u])?D(null!=(i=null==(o=n[u])?void 0:o.call(n,...a))?i:[],(e=>r(...a,e))):r(...a,t[u])};r()}))]})(),ke=e=>{if(!Rt(e,((e,l)=>[u,d].includes(l))))return!1;const l=e[u];return!(!P(l)&&l!=o||(Je(e[d])!=l&&te(e,d),0))},xe=(l,t)=>(!e||Ul(M,t)||nl(t))&&Rt(l,((e,l)=>Se(t,l,e)),(()=>nl(t))),Se=(e,l,t,n)=>Rt(n?t:Oe(t,e,l),((n,s)=>q(Te(e,l,s,n),(e=>(t[s]=e,!0)),(()=>!1))),(()=>nl(e,l))),Te=(l,t,n,s)=>e?q(lt(lt(M,l),n),(e=>Je(s)!=e[u]?nl(l,t,n,s,e[d]):s),(()=>nl(l,t,n,s))):O(Je(s))?nl(l,t,n,s):s,Ve=(e,l)=>Rt(l?e:qe(e),((l,t)=>q(Re(t,l),(l=>(e[t]=l,!0)),(()=>!1))),(()=>sl())),Re=(e,t)=>l?q(lt(z,e),(l=>Je(t)!=l[u]?sl(e,t,l[d]):t),(()=>sl(e,t))):O(Je(t))?sl(e,t):t,Oe=(e,l,t)=>(q(lt(j,l),(([n,s])=>{Yl(n,((l,t)=>{le(e,t)||(e[t]=l)})),Yl(s,(n=>{le(e,n)||nl(l,t,n)}))})),e),qe=e=>(l&&(Yl($,((l,t)=>{le(e,t)||(e[t]=l)})),Yl(A,(l=>{le(e,l)||sl(l)}))),e),Pe=e=>rt(M,e,((e,l,t)=>{const n=_l(),s=It();rt(st(M,l,_l),t,((e,l,t)=>{nt(e,l,t),q(t[d],(e=>nt(n,l,e)),(()=>yt(s,l)))})),nt(j,l,[n,s])}),((e,l)=>{nt(M,l),nt(j,l)})),Ne=e=>rt(z,e,((e,l,t)=>{nt(z,l,t),q(t[d],(e=>nt($,l,e)),(()=>yt(A,l)))}),((e,l)=>{nt(z,l),nt($,l),Zl(A,l)})),Ee=e=>se(e)?ql():Sl(e),Le=e=>rt(Q,e,((e,l,t)=>Me(l,t)),((e,l)=>Ue(l))),Me=(e,l)=>rt(st(Q,e,(()=>(Ye(e,1),nt(F,e,Ct()),nt(J,e,_l()),_l()))),l,((l,t,n)=>je(e,l,t,n)),((l,t)=>Ge(e,l,t))),je=(e,l,t,n,s)=>rt(st(l,t,(()=>(Ze(e,t,1),_l()))),n,((l,n,s)=>ze(e,t,l,n,s)),((n,r)=>Ke(e,l,t,n,r,s))),ze=(e,l,t,n,s)=>{Ul(t,n)||_e(e,l,n,1);const r=lt(t,n);s!==r&&(el(e,l,n,r,s),nt(t,n,s))},$e=(e,l,t,n,s)=>q(lt(l,t),(l=>ze(e,t,l,n,s)),(()=>je(e,l,t,Oe({[n]:s},e,t)))),Ae=e=>se(e)?El():Tl(e),Fe=e=>rt(G,e,((e,l,t)=>He(l,t)),((e,l)=>Xe(l))),He=(e,l)=>{Ul(G,e)||ll(e,1);const t=lt(G,e);l!==t&&(tl(e,t,l),nt(G,e,l))},Qe=(e,l)=>{const[t]=lt(F,e),n=t(l);return Ul(lt(Q,e),n)?Qe(e,l):n},We=e=>{var l;return null!=(l=lt(Q,e))?l:Me(e,{})},Ue=e=>Me(e,{}),Ge=(e,l,t)=>{const[,n]=lt(F,e);n(t),je(e,l,t,{},!0)},Ke=(e,l,t,n,s,r)=>{var a;const o=lt(null==(a=lt(j,e))?void 0:a[0],s);if(!O(o)&&!r)return ze(e,t,n,s,o);const i=l=>{el(e,t,l,lt(n,l)),_e(e,t,l,-1),nt(n,l)};O(o)?i(s):tt(n,i),Gl(n)&&(Ze(e,t,-1),Gl(nt(l,t))&&(Ye(e,-1),nt(Q,e),nt(F,e),nt(J,e)))},Xe=e=>{const l=lt($,e);if(!O(l))return He(e,l);tl(e,lt(G,e)),ll(e,-1),nt(G,e)},Ye=(e,l)=>Ot(a,e,l),Ze=(e,l,t)=>Ot(st(k,e,_l),l,t)&&nt(c,e,st(c,e,(()=>0))+t),_e=(e,l,t,n)=>{var s;const r=lt(J,e),a=null!=(s=lt(r,t))?s:0;(0==a&&1==n||1==a&&-1==n)&&Ot(st(i,e,_l),t,n),nt(r,t,a!=-n?a+n:null),Ot(st(st(x,e,_l),l,_l),t,n)},el=(e,l,t,n,s)=>st(st(st(T,e,_l),l,_l),t,(()=>[n,0]))[1]=s,ll=(e,l)=>Ot(V,e,l),tl=(e,l,t)=>st(R,e,(()=>[l,0]))[1]=t,nl=(e,l,t,n,s)=>(U(st(st(st(E,e,_l),l,_l),t,(()=>[])),n),s),sl=(e,l,t)=>(U(st(L,e,(()=>[])),l),t),rl=(e,l,t)=>q(lt(lt(lt(T,e),l),t),(([e,l])=>[!0,e,l]),(()=>[!1,...kt(wl(e,l,t))])),al=e=>q(lt(R,e),(([e,l])=>[!0,e,l]),(()=>[!1,...kt(xl(e))])),ol=e=>Gl(E)||Gl(he[e])?0:Yl(e?ct(E):E,((l,t)=>Yl(l,((l,n)=>Yl(l,((l,s)=>ye(he[e],[t,n,s],l))))))),il=e=>Gl(L)||Gl(me[e])?0:Yl(e?ut(L):L,((l,t)=>ye(me[e],[t],l))),ul=(e,l,t)=>{if(!Gl(l))return ye(e,t,(()=>at(l))),1},dl=e=>{const l=Gl(ie[e]),t=Gl(de[e])&&Gl(_[e])&&Gl(ee[e])&&Gl(oe[e])&&l&&Gl(X[e]),n=Gl(ce[e])&&Gl(ue[e])&&Gl(Y[e])&&Gl(K[e]);if(!t||!n){const s=e?[ut(a),dt(i),ut(c),dt(k),ct(x),ct(T)]:[a,i,c,k,x,T];if(!t){ul(X[e],s[0]),Yl(s[1],((l,t)=>ul(_[e],l,[t]))),Yl(s[2],((l,t)=>{0!=l&&ye(ee[e],[t],gl(t))}));const t=It();Yl(s[3],((n,s)=>{ul(oe[e],n,[s])&&!l&&(ye(ie[e],[s,null]),yt(t,s))})),l||Yl(s[5],((l,n)=>{if(!Ul(t,n)){const t=It();Yl(l,(e=>Yl(e,(([l,n],s)=>n!==l?yt(t,s):Zl(e,s))))),Yl(t,(l=>ye(ie[e],[n,l])))}})),Yl(s[4],((l,t)=>Yl(l,((l,n)=>ul(de[e],l,[t,n])))))}if(!n){let l;Yl(s[5],((t,n)=>{let s;Yl(t,((t,r)=>{let a;Yl(t,(([t,o],i)=>{o!==t&&(ye(ce[e],[n,r,i],o,t,rl),l=s=a=1)})),a&&ye(ue[e],[n,r],rl)})),s&&ye(Y[e],[n],rl)})),l&&ye(K[e],void 0,rl)}}},cl=e=>{const l=Gl(pe[e]),t=Gl(ve[e])&&Gl(be[e]);if(!l||!t){const n=e?[ut(V),ut(R)]:[V,R];if(l||ul(pe[e],n[0]),!t){let l;Yl(n[1],(([t,n],s)=>{n!==t&&(ye(ve[e],[s],n,t,al),l=1)})),l&&ye(be[e],void 0,al)}}},hl=(e,...l)=>(jl((()=>e(...B(l,S)))),Al),ml=()=>[at(T,((e,l)=>-1===lt(a,l)?null:at(e,((e,t)=>-1===lt(lt(k,l),t)?null:at(e,(([,e])=>null!=e?e:null),((e,l)=>Vt(l)))),se)),se),at(R,(([,e])=>null!=e?e:null),((e,l)=>Vt(l)))],bl=()=>({cellsTouched:t,valuesTouched:n,changedCells:it(T,Tt,Vt),invalidCells:it(E),changedValues:at(R,Tt,Vt),invalidValues:at(L),changedTableIds:at(a),changedRowIds:ot(k),changedCellIds:it(x),changedValueIds:at(V)}),pl=()=>it(Q),vl=()=>et(Q),gl=e=>Bl(lt(Q,S(e))),fl=e=>et(lt(Q,S(e))),Il=(e,l,t,n=0,s)=>{return B(W((a=lt(Q,S(e)),o=(e,t)=>[O(l)?t:lt(e,S(l)),t],r=([e],[l])=>{return((null!=(n=e)?n:0)<(null!=(s=l)?s:0)?-1:1)*(t?-1:1);var n,s},B([...null!=(i=null==a?void 0:a.entries())?i:[]],(([e,l])=>o(l,e))).sort(r)),n,O(s)?s:n+s),(([,e])=>e));var r,a,o,i},yl=(e,l)=>et(lt(lt(Q,S(e)),S(l))),wl=(e,l,t)=>lt(lt(lt(Q,S(e)),S(l)),S(t)),Cl=()=>at(G),kl=()=>et(G),xl=e=>lt(G,S(e)),Sl=e=>hl((()=>(e=>Rt(e,xe,nl))(e)?Le(e):0)),Tl=e=>hl((()=>Ve(e)?Fe(e):0)),Vl=e=>{try{Ee(ae(e))}catch(e){}return Al},Rl=l=>hl((()=>{if((e=Rt(l,(e=>Rt(e,ke))))&&(Pe(l),!Gl(Q))){const e=pl();ql(),Sl(e)}})),Ol=e=>hl((()=>{if(l=(e=>Rt(e,ke))(e)){const t=Cl();Ml(),El(),l=!0,Ne(e),Tl(t)}})),ql=()=>hl((()=>Le({}))),Pl=e=>hl((e=>Ul(Q,e)?Ue(e):0),e),Nl=(e,l)=>hl(((e,l)=>q(lt(Q,e),(t=>Ul(t,l)?Ge(e,t,l):0))),e,l),El=()=>hl((()=>Fe({}))),Ll=()=>hl((()=>{Pe({}),e=!1})),Ml=()=>hl((()=>{Ne({}),l=!1})),jl=(e,l)=>{if(-1!=r){zl();const t=e();return $l(l),t}},zl=()=>(-1!=r&&r++,1==r&&ye(ge,void 0,ml,bl),Al),$l=e=>(r>0&&(r--,0==r&&(t=!Gl(T),n=!Gl(R),r=1,ol(1),t&&dl(1),il(1),n&&cl(1),(null==e?void 0:e(ml,bl))&&(Yl(T,((e,l)=>Yl(e,((e,t)=>Yl(e,(([e],n)=>De(Al,l,t,n,e))))))),Yl(R,(([e],l)=>Be(Al,l,e))),t=n=!1),ye(fe[0],void 0,ml,bl),r=-1,ol(0),t&&dl(0),il(0),n&&cl(0),ye(fe[1],void 0,ml,bl),r=0,t=n=!1,D([a,i,c,k,x,T,E,V,R,L],Xl))),Al),Al={getContent:()=>[pl(),Cl()],getTables:pl,getTableIds:vl,getTable:e=>ot(lt(Q,S(e))),getTableCellIds:e=>et(lt(J,S(e))),getRowCount:gl,getRowIds:fl,getSortedRowIds:Il,getRow:(e,l)=>at(lt(lt(Q,S(e)),S(l))),getCellIds:yl,getCell:wl,getValues:Cl,getValueIds:kl,getValue:xl,hasTables:()=>!Gl(Q),hasTable:e=>Ul(Q,S(e)),hasTableCell:(e,l)=>Ul(lt(J,S(e)),S(l)),hasRow:(e,l)=>Ul(lt(Q,S(e)),S(l)),hasCell:(e,l,t)=>Ul(lt(lt(Q,S(e)),S(l)),S(t)),hasValues:()=>!Gl(G),hasValue:e=>Ul(G,S(e)),getTablesJson:()=>re(Q),getValuesJson:()=>re(G),getJson:()=>re([Q,G]),getTablesSchemaJson:()=>re(M),getValuesSchemaJson:()=>re(z),getSchemaJson:()=>re([M,z]),hasTablesSchema:()=>e,hasValuesSchema:()=>l,setContent:([e,l])=>hl((()=>{(se(e)?ql:Sl)(e),(se(l)?El:Tl)(l)})),setTables:Sl,setTable:(e,l)=>hl((e=>xe(l,e)?Me(e,l):0),e),setRow:(e,l,t)=>hl(((e,l)=>Se(e,l,t)?je(e,We(e),l,t):0),e,l),addRow:(e,l,t=!0)=>jl((()=>{let n;return Se(e,n,l)&&(e=S(e),je(e,We(e),n=Qe(e,t?1:0),l)),n})),setPartialRow:(e,l,t)=>hl(((e,l)=>{if(Se(e,l,t,1)){const n=We(e);ne(t,((t,s)=>$e(e,n,l,s,t)))}}),e,l),setCell:(e,l,t,n)=>hl(((e,l,t)=>q(Te(e,l,t,N(n)?n(wl(e,l,t)):n),(n=>$e(e,We(e),l,t,n)))),e,l,t),setValues:Tl,setPartialValues:e=>hl((()=>Ve(e,1)?ne(e,((e,l)=>He(l,e))):0)),setValue:(e,l)=>hl((e=>q(Re(e,N(l)?l(xl(e)):l),(l=>He(e,l)))),e),setTransactionChanges:e=>hl((()=>{ne(e[0],((e,l)=>O(e)?Pl(l):ne(e,((e,t)=>O(e)?Nl(l,t):ne(e,((e,n)=>De(Al,l,t,n,e))))))),ne(e[1],((e,l)=>Be(Al,l,e)))})),setTablesJson:Vl,setValuesJson:e=>{try{Ae(ae(e))}catch(e){}return Al},setJson:e=>hl((()=>{try{const[l,t]=ae(e);Ee(l),Ae(t)}catch(l){Vl(e)}})),setTablesSchema:Rl,setValuesSchema:Ol,setSchema:(e,l)=>hl((()=>{Rl(e),Ol(l)})),delTables:ql,delTable:Pl,delRow:Nl,delCell:(e,l,t,n)=>hl(((e,l,t)=>q(lt(Q,e),(s=>q(lt(s,l),(r=>Ul(r,t)?Ke(e,s,l,r,t,n):0))))),e,l,t),delValues:El,delValue:e=>hl((e=>Ul(G,e)?Xe(e):0),e),delTablesSchema:Ll,delValuesSchema:Ml,delSchema:()=>hl((()=>{Ll(),Ml()})),transaction:jl,startTransaction:zl,finishTransaction:$l,forEachTable:e=>Yl(Q,((l,t)=>e(t,(e=>Yl(l,((l,t)=>e(t,(e=>tt(l,e))))))))),forEachTableCell:(e,l)=>tt(lt(J,S(e)),l),forEachRow:(e,l)=>Yl(lt(Q,S(e)),((e,t)=>l(t,(l=>tt(e,l))))),forEachCell:(e,l,t)=>tt(lt(lt(Q,S(e)),S(l)),t),forEachValue:e=>tt(G,e),addSortedRowIdsListener:(e,l,t,n,s,r,a)=>{let o=Il(e,l,t,n,s);return Ie((()=>{const a=Il(e,l,t,n,s);var i,u,d;u=o,H(i=a)===H(u)&&(d=(e,l)=>u[l]===e,i.every(d))||(o=a,r(Al,e,l,t,n,s,o))}),ie[a?1:0],[e,l],[vl])},addStartTransactionListener:e=>Ie(e,ge),addWillFinishTransactionListener:e=>Ie(e,fe[0]),addDidFinishTransactionListener:e=>Ie(e,fe[1]),callListener:e=>(Ce(e),Al),delListener:e=>(we(e),Al),getListenerStats:()=>({tables:xt(K),tableIds:xt(X),tableCellIds:xt(_),table:xt(Y),rowCount:xt(ee),rowIds:xt(oe),sortedRowIds:xt(ie),row:xt(ue,Ql),cellIds:xt(de,Ql),cell:xt(ce,Wl),invalidCell:xt(he,Wl),values:xt(be),valueIds:xt(pe),value:xt(ve),invalidValue:xt(me),transaction:Hl(ge)+xt(fe)}),createStore:qt,addListener:Ie,callListeners:ye};return ne({[m]:[0,K],[b]:[0,X],[h]:[1,Y,[vl]],[h+I]:[1,_,[vl]],[v]:[1,ee,[vl]],[g]:[1,oe,[vl]],[p]:[2,ue,[vl,fl]],[I]:[2,de,[vl,fl]],[f]:[3,ce,[vl,fl,yl],e=>kt(wl(...e))],InvalidCell:[3,he],[w]:[0,be],[C]:[0,pe],[y]:[1,ve,[kl],e=>kt(xl(e[0]))],InvalidValue:[1,me]},(([e,l,t,n],s)=>{Al["add"+s+"Listener"]=(...s)=>Ie(s[e],l[s[e+1]?1:0],e>0?W(s,0,e):void 0,t,n)})),Z(Al)},Pt=({position:e="right",open:l=!1})=>{const n=t.useCreateStore(qt),s=ue.indexOf(e);return t.useCreatePersister(n,(e=>{return((e,l,t,n)=>((e,l,t,n,s,r,a=[])=>{let o,i,u,d=0,c=0,h=0,m=0;st(bt,a,(()=>0)),st(pt,a,(()=>[]));const b=e=>mt(void 0,null,(function*(){return 2!=d&&(d=1,c++,yield p.schedule((()=>mt(void 0,null,(function*(){yield e(),d=0}))))),p})),p={load:(t,n)=>mt(void 0,null,(function*(){return yield b((()=>mt(void 0,null,(function*(){try{e.setContent(yield l())}catch(l){e.setContent([t,n])}}))))})),startAutoLoad:(...t)=>mt(void 0,[...t],(function*(t={},s={}){return p.stopAutoLoad(),yield p.load(t,s),m=1,u=n(((t,n)=>mt(void 0,null,(function*(){if(n){const l=n();yield b((()=>mt(void 0,null,(function*(){return e.setTransactionChanges(l)}))))}else yield b((()=>mt(void 0,null,(function*(){var n;try{e.setContent(null!=(n=null==t?void 0:t())?n:yield l())}catch(e){null==r||r(e)}}))))})))),p})),stopAutoLoad:()=>(m&&(s(u),u=void 0,m=0),p),save:l=>mt(void 0,null,(function*(){return 1!=d&&(d=2,h++,yield p.schedule((()=>mt(void 0,null,(function*(){try{yield t(e.getContent,l)}catch(e){null==r||r(e)}d=0}))))),p})),startAutoSave:()=>mt(void 0,null,(function*(){return yield p.stopAutoSave().save(),o=e.addDidFinishTransactionListener(((e,l)=>{const[t,n]=l();se(t)&&se(n)||p.save((()=>[t,n]))})),p})),stopAutoSave:()=>(q(o,e.delListener),p),schedule:(...e)=>mt(void 0,null,(function*(){return U(lt(pt,a),...e),yield mt(void 0,null,(function*(){if(!lt(bt,a)){for(nt(bt,a,1);!O(i=G(lt(pt,a)));)try{yield i()}catch(e){null==r||r(e)}nt(bt,a,0)}})),p})),getStore:()=>e,destroy:()=>p.stopAutoLoad().stopAutoSave(),getStats:()=>({loads:c,saves:h})};return Z(p)})(e,(()=>vt(void 0,null,(function*(){return ae(t.getItem(l))}))),(e=>vt(void 0,null,(function*(){return t.setItem(l,re(e()))}))),(e=>{const n=n=>{n.storageArea===t&&n.key===l&&e((()=>ae(n.newValue)))};return ft.addEventListener(gt,n),n}),(e=>ft.removeEventListener(gt,e)),n))(e,oe,sessionStorage,l);var l}),void 0,(e=>{return t=function*(){yield e.load(void 0,{position:-1==s?1:s,open:!!l}),yield e.startAutoSave()},new Promise(((e,l)=>{var n=e=>{try{r(t.next(e))}catch(e){l(e)}},s=e=>{try{r(t.throw(e))}catch(e){l(e)}},r=l=>l.done?e(l.value):Promise.resolve(l.value).then(n,s);r((t=t.apply(void 0,null)).next())}));var t})),j(M,null,j("aside",{id:oe},j(Ae,{s:n}),j(Jl,{s:n})),j("style",null,$e))};var Nt=Object.defineProperty,Et=Object.getOwnPropertySymbols,Lt=Object.prototype.hasOwnProperty,Mt=Object.prototype.propertyIsEnumerable,jt=(e,l,t)=>l in e?Nt(e,l,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[l]=t;e.EditableCellView=wl,e.EditableValueView=Cl,e.RelationshipInHtmlTable=Il,e.ResultSortedTableInHtmlTable=yl,e.ResultTableInHtmlTable=e=>{var l=e,{queryId:n,queries:s,customCells:r}=l,a=el(l,["queryId","queries","customCells"]);return j(hl,_e(Ze({},a),{params:ol(cl(t.useResultTableCellIds(n,s),r,t.ResultCellView),ul(s,n),t.useResultRowIds(n,s))}))},e.SliceInHtmlTable=fl,e.SortedTableInHtmlTable=vl,e.SortedTablePaginator=kl,e.StoreInspector=e=>j(Pt,((e,l)=>{for(var t in l||(l={}))Lt.call(l,t)&&jt(e,t,l[t]);if(Et)for(var t of Et(l))Mt.call(l,t)&&jt(e,t,l[t]);return e})({},e)),e.TableInHtmlTable=e=>{var l=e,{tableId:n,store:s,editable:r,customCells:a}=l,o=el(l,["tableId","store","editable","customCells"]);return j(hl,_e(Ze({},o),{params:ol(cl(t.useTableCellIds(n,s),a,r?wl:t.CellView),il(s,n),t.useRowIds(n,s))}))},e.ValuesInHtmlTable=gl},"object"==typeof exports&&"undefined"!=typeof module?l(exports,require("react"),require("./ui-react")):"function"==typeof define&&define.amd?define(["exports","react","./ui-react"],l):l((e="undefined"!=typeof globalThis?globalThis:e||self).TinyBaseUiReactDomDebug={},e.React,e.TinyBaseUiReact);
@@ -1 +1 @@
1
- var e,s;e=this,s=function(e,s){"use strict";const t=e=>typeof e,o="",l=t(o),r="Result",u="Ids",n="Table",d=n+"s",i=n+u,a="Row",c=a+"Count",I=a+u,p="Sorted"+a+u,C="Cell",b=C+u,w="Value",R=w+"s",k=w+u,v=e=>null==e,g=(e,s,t)=>v(e)?null==t?void 0:t():s(e),y=e=>t(e)==l,m=()=>{},h=(e,s)=>e.map(s),f=Object.keys,{createContext:L,useContext:V}=s,S=L([]),T=(e,s)=>{var t;const o=V(S);return v(e)?o[s]:y(e)?((e,s)=>g(e,(e=>e[s])))(null!=(t=o[s+1])?t:{},e):e},x=(e,s)=>{const t=T(e,s);return v(e)||y(e)?t:e},P=e=>{var s;return f(null!=(s=V(S)[e])?s:{})},O=e=>x(e,0),q=e=>x(e,2),B=e=>x(e,4),M=e=>x(e,6),j=e=>x(e,8),D=e=>x(e,10),{useCallback:Q,useEffect:E,useMemo:F,useRef:A,useState:G}=s,U=(e,s,t=[])=>{const o=F((()=>s(e)),[e,...t]);return E((()=>()=>o.destroy()),[o]),o},z=(e,s,t,o=[],l)=>{const[,r]=G(),u=Q((()=>{var l,r;return null!=(r=null==(l=null==s?void 0:s["get"+e])?void 0:l.call(s,...o))?r:t}),[s,...o]),[n]=G(u),d=A(n);return F((()=>d.current=u()),[u]),H(e,s,((...e)=>{d.current=v(l)?u():e[l],r([])}),[],o),d.current},H=(e,s,t,o=[],l=[],...r)=>E((()=>{var o;const u=null==(o=null==s?void 0:s["add"+e+"Listener"])?void 0:o.call(s,...l,t,...r);return()=>null==s?void 0:s.delListener(u)}),[s,...l,...o,...r]),J=(e,s,t,o=[],l=m,r=[],...u)=>{const n=O(e);return Q((e=>g(n,(o=>g(t(e,o),(e=>l(o["set"+s](...u,e),e)))))),[n,s,...o,...r,...u])},K=(e,s,t=m,o=[],...l)=>{const r=O(e);return Q((()=>t(null==r?void 0:r["del"+s](...l))),[r,s,...o,...l])},N=(e,s,t)=>{const o=D(e);return Q((()=>null==o?void 0:o[s](t)),[o,s,t])},W=e=>z(i,O(e),[],[]),X=(e,s)=>z(I,O(s),[],[e]),Y=(e,s,t,o=0,l,r)=>z(p,O(r),[],[e,s,t,o,l],6),Z=(e,s,t)=>z(b,O(t),[],[e,s]),$=(e,s,t,o)=>z(C,O(o),void 0,[e,s,t],4),_=e=>z(k,O(e),[],[]),ee=(e,s)=>z(w,O(s),void 0,[e]),se=(e,s)=>z("Metric",q(s),void 0,[e]),te=(e,s)=>z("SliceIds",B(s),[],[e]),oe=(e,s,t)=>z("Slice"+I,B(t),[],[e,s]),le=(e,s,t)=>z("RemoteRowId",M(t),void 0,[e,s]),re=(e,s,t)=>z("Local"+I,M(t),[],[e,s]),ue=(e,s,t)=>z("Linked"+I,M(t),[],[e,s]),ne=(e,s)=>z(r+I,j(s),[],[e]),de=(e,s,t,o=0,l,u)=>z(r+p,j(u),[],[e,s,t,o,l],6),ie=(e,s,t)=>z(r+b,j(t),[],[e,s]),ae=(e,s,t,o)=>z(r+C,j(o),void 0,[e,s,t]),ce=e=>z("CheckpointIds",D(e),[[],void 0,[]]),Ie=(e,s)=>z("Checkpoint",D(s),void 0,[e]),pe=e=>N(e,"goBackward"),Ce=e=>N(e,"goForward"),{PureComponent:be,Fragment:we,createElement:Re,useCallback:ke,useLayoutEffect:ve,useRef:ge,useState:ye}=s,me=(e,...s)=>v(e)?{}:e(...s),he=(e,s)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(s),null==e?void 0:e.getRemoteTableId(s)];var fe=Object.defineProperty,Le=Object.defineProperties,Ve=Object.getOwnPropertyDescriptors,Se=Object.getOwnPropertySymbols,Te=Object.prototype.hasOwnProperty,xe=Object.prototype.propertyIsEnumerable,Pe=(e,s,t)=>s in e?fe(e,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[s]=t,Oe=(e,s)=>{for(var t in s||(s={}))Te.call(s,t)&&Pe(e,t,s[t]);if(Se)for(var t of Se(s))xe.call(s,t)&&Pe(e,t,s[t]);return e},qe=(e,s)=>Le(e,Ve(s)),Be=(e,s)=>{var t={};for(var o in e)Te.call(e,o)&&s.indexOf(o)<0&&(t[o]=e[o]);if(null!=e&&Se)for(var o of Se(e))s.indexOf(o)<0&&xe.call(e,o)&&(t[o]=e[o]);return t};const{useMemo:Me}=s,je=({tableId:e,store:s,rowComponent:t=Ge,getRowComponentProps:o,customCellIds:l,separator:r,debugIds:u},n)=>Fe(h(n,(r=>Re(t,qe(Oe({},me(o,r)),{key:r,tableId:e,rowId:r,customCellIds:l,store:s,debugIds:u})))),r,u,e),De=({queryId:e,queries:s,resultRowComponent:t=Ke,getResultRowComponentProps:o,separator:l,debugIds:r},u)=>Fe(h(u,(l=>Re(t,qe(Oe({},me(o,l)),{key:l,queryId:e,rowId:l,queries:s,debugIds:r})))),l,r,e),Qe=({relationshipId:e,relationships:s,rowComponent:t=Ge,getRowComponentProps:o,separator:l,debugIds:r},u,n)=>{const[d,i,a]=he(M(s),e),c=u(e,n,d);return Fe(h(c,(e=>Re(t,qe(Oe({},me(o,e)),{key:e,tableId:a,rowId:e,store:i,debugIds:r})))),l,r,n)},Ee=e=>({checkpoints:s,checkpointComponent:t=Ne,getCheckpointComponentProps:o,separator:l,debugIds:r})=>{const u=D(s);return Fe(h(e(ce(u)),(e=>Re(t,qe(Oe({},me(o,e)),{key:e,checkpoints:u,checkpointId:e,debugIds:r})))),l)},Fe=(e,s,t,o)=>{const l=v(s)||!Array.isArray(e)?e:h(e,((e,t)=>t>0?[s,e]:e));return t?[o,":{",l,"}"]:l},Ae=({tableId:e,rowId:s,cellId:t,store:l,debugIds:r})=>{var u;return Fe(o+(null!=(u=$(e,s,t,l))?u:o),void 0,r,t)},Ge=({tableId:e,rowId:s,store:t,cellComponent:o=Ae,getCellComponentProps:l,customCellIds:r,separator:u,debugIds:n})=>Fe(h(((e,s,t,o)=>{const l=Z(s,t,o);return null!=e?e:l})(r,e,s,t),(r=>Re(o,qe(Oe({},me(l,r)),{key:r,tableId:e,rowId:s,cellId:r,store:t,debugIds:n})))),u,n,s),Ue=e=>je(e,X(e.tableId,e.store)),ze=({valueId:e,store:s,debugIds:t})=>{var l;return Fe(o+(null!=(l=ee(e,s))?l:o),void 0,t,e)},He=({indexId:e,sliceId:s,indexes:t,rowComponent:o=Ge,getRowComponentProps:l,separator:r,debugIds:u})=>{const[n,d,i]=((e,s)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getTableId(s)])(B(t),e),a=oe(e,s,n);return Fe(h(a,(e=>Re(o,qe(Oe({},me(l,e)),{key:e,tableId:i,rowId:e,store:d,debugIds:u})))),r,u,s)},Je=({queryId:e,rowId:s,cellId:t,queries:l,debugIds:r})=>{var u;return Fe(o+(null!=(u=ae(e,s,t,l))?u:o),void 0,r,t)},Ke=({queryId:e,rowId:s,queries:t,resultCellComponent:o=Je,getResultCellComponentProps:l,separator:r,debugIds:u})=>Fe(h(ie(e,s,t),(r=>Re(o,qe(Oe({},me(l,r)),{key:r,queryId:e,rowId:s,cellId:r,queries:t,debugIds:u})))),r,u,s),Ne=({checkpoints:e,checkpointId:s,debugIds:t})=>{var l;return Fe(null!=(l=Ie(s,e))?l:o,void 0,t,s)},We=Ee((e=>e[0])),Xe=Ee((e=>v(e[1])?[]:[e[1]])),Ye=Ee((e=>e[2]));e.BackwardCheckpointsView=We,e.CellView=Ae,e.CheckpointView=Ne,e.CurrentCheckpointView=Xe,e.ForwardCheckpointsView=Ye,e.IndexView=({indexId:e,indexes:s,sliceComponent:t=He,getSliceComponentProps:o,separator:l,debugIds:r})=>Fe(h(te(e,s),(l=>Re(t,qe(Oe({},me(o,l)),{key:l,indexId:e,sliceId:l,indexes:s,debugIds:r})))),l,r,e),e.LinkedRowsView=e=>Qe(e,ue,e.firstRowId),e.LocalRowsView=e=>Qe(e,re,e.remoteRowId),e.MetricView=({metricId:e,metrics:s,debugIds:t})=>{var l;return Fe(null!=(l=se(e,s))?l:o,void 0,t,e)},e.Provider=({store:e,storesById:t,metrics:o,metricsById:l,indexes:r,indexesById:u,relationships:n,relationshipsById:d,queries:i,queriesById:a,checkpoints:c,checkpointsById:I,children:p})=>{const C=s.useContext(S);return Re(S.Provider,{value:Me((()=>[null!=e?e:C[0],Oe(Oe({},C[1]),t),null!=o?o:C[2],Oe(Oe({},C[3]),l),null!=r?r:C[4],Oe(Oe({},C[5]),u),null!=n?n:C[6],Oe(Oe({},C[7]),d),null!=i?i:C[8],Oe(Oe({},C[9]),a),null!=c?c:C[10],Oe(Oe({},C[11]),I)]),[e,t,o,l,r,u,n,d,i,a,c,I,C])},p)},e.RemoteRowView=({relationshipId:e,localRowId:s,relationships:t,rowComponent:o=Ge,getRowComponentProps:l,debugIds:r})=>{const[u,n,,d]=he(M(t),e),i=le(e,s,u);return Fe(v(d)||v(i)?null:Re(o,qe(Oe({},me(l,i)),{key:i,tableId:d,rowId:i,store:n,debugIds:r})),void 0,r,s)},e.ResultCellView=Je,e.ResultRowView=Ke,e.ResultSortedTableView=e=>{var s=e,{cellId:t,descending:o,offset:l,limit:r}=s,u=Be(s,["cellId","descending","offset","limit"]);return De(u,de(u.queryId,t,o,l,r,u.queries))},e.ResultTableView=e=>De(e,ne(e.queryId,e.queries)),e.RowView=Ge,e.SliceView=He,e.SortedTableView=e=>{var s=e,{cellId:t,descending:o,offset:l,limit:r}=s,u=Be(s,["cellId","descending","offset","limit"]);return je(u,Y(u.tableId,t,o,l,r,u.store))},e.TableView=Ue,e.TablesView=({store:e,tableComponent:s=Ue,getTableComponentProps:t,separator:o,debugIds:l})=>Fe(h(W(e),(o=>Re(s,qe(Oe({},me(t,o)),{key:o,tableId:o,store:e,debugIds:l})))),o),e.ValueView=ze,e.ValuesView=({store:e,valueComponent:s=ze,getValueComponentProps:t,separator:o,debugIds:l})=>Fe(h(_(e),(o=>Re(s,qe(Oe({},me(t,o)),{key:o,valueId:o,store:e,debugIds:l})))),o),e.useAddRowCallback=(e,s,t=[],o,l=m,r=[],u=!0)=>{const n=O(o);return Q((t=>g(n,(o=>g(s(t,o),(s=>l(o.addRow(e,s,u),o,s)))))),[n,e,...t,...r,u])},e.useCell=$,e.useCellIds=Z,e.useCellIdsListener=(e,s,t,o,l,r)=>H(b,O(r),t,o,[e,s],l),e.useCellListener=(e,s,t,o,l,r,u)=>H(C,O(u),o,l,[e,s,t],r),e.useCheckpoint=Ie,e.useCheckpointIds=ce,e.useCheckpointIdsListener=(e,s,t)=>H("CheckpointIds",D(t),e,s),e.useCheckpointListener=(e,s,t,o)=>H("Checkpoint",D(o),s,t,[e]),e.useCheckpoints=e=>T(e,10),e.useCheckpointsIds=()=>P(11),e.useCheckpointsOrCheckpointsById=D,e.useCreateCheckpoints=(e,s,t)=>U(e,s,t),e.useCreateIndexes=(e,s,t)=>U(e,s,t),e.useCreateMetrics=(e,s,t)=>U(e,s,t),e.useCreatePersister=(e,s,t=[],o,l=[])=>{const[,r]=G(),u=F((()=>s(e)),[e,...t]);return E((()=>{var e;return e=function*(){yield null==o?void 0:o(u),r(1)},new Promise(((s,t)=>{var o=s=>{try{r(e.next(s))}catch(e){t(e)}},l=s=>{try{r(e.throw(s))}catch(e){t(e)}},r=e=>e.done?s(e.value):Promise.resolve(e.value).then(o,l);r((e=e.apply(void 0,null)).next())})),()=>{u.destroy()}}),[u,...l]),u},e.useCreateQueries=(e,s,t)=>U(e,s,t),e.useCreateRelationships=(e,s,t)=>U(e,s,t),e.useCreateStore=(e,s=[])=>F(e,s),e.useDelCellCallback=(e,s,t,o,l,r,u)=>K(l,C,r,u,e,s,t,o),e.useDelRowCallback=(e,s,t,o,l)=>K(t,a,o,l,e,s),e.useDelTableCallback=(e,s,t,o)=>K(s,n,t,o,e),e.useDelTablesCallback=(e,s,t)=>K(e,d,s,t),e.useDelValueCallback=(e,s,t,o)=>K(s,w,t,o,e),e.useDelValuesCallback=(e,s,t)=>K(e,R,s,t),e.useGoBackwardCallback=pe,e.useGoForwardCallback=Ce,e.useGoToCallback=(e,s=[],t,o=m,l=[])=>{const r=D(t);return Q((s=>g(r,(t=>g(e(s),(e=>o(t.goTo(e),e)))))),[r,...s,...l])},e.useIndexIds=e=>z("IndexIds",B(e),[]),e.useIndexes=e=>T(e,4),e.useIndexesIds=()=>P(5),e.useIndexesOrIndexesById=B,e.useLinkedRowIds=ue,e.useLinkedRowIdsListener=(e,s,t,o,l)=>H("Linked"+I,M(l),t,o,[e,s]),e.useLocalRowIds=re,e.useLocalRowIdsListener=(e,s,t,o,l)=>H("Local"+I,M(l),t,o,[e,s]),e.useMetric=se,e.useMetricIds=e=>z("MetricIds",q(e),[]),e.useMetricListener=(e,s,t,o)=>H("Metric",q(o),s,t,[e]),e.useMetrics=e=>T(e,2),e.useMetricsIds=()=>P(3),e.useMetricsOrMetricsById=q,e.useQueries=e=>T(e,8),e.useQueriesIds=()=>P(9),e.useQueriesOrQueriesById=j,e.useQueryIds=e=>z("QueryIds",j(e),[]),e.useRedoInformation=e=>{var s;const t=D(e),[,,[l]]=ce(t);return[!v(l),Ce(t),l,null!=(s=g(l,(e=>null==t?void 0:t.getCheckpoint(e))))?s:o]},e.useRelationshipIds=e=>z("RelationshipIds",M(e),[]),e.useRelationships=e=>T(e,6),e.useRelationshipsIds=()=>P(7),e.useRelationshipsOrRelationshipsById=M,e.useRemoteRowId=le,e.useRemoteRowIdListener=(e,s,t,o,l)=>H("RemoteRowId",M(l),t,o,[e,s]),e.useResultCell=ae,e.useResultCellIds=ie,e.useResultCellIdsListener=(e,s,t,o,l)=>H(r+b,j(l),t,o,[e,s]),e.useResultCellListener=(e,s,t,o,l,u)=>H(r+C,j(u),o,l,[e,s,t]),e.useResultRow=(e,s,t)=>z(r+a,j(t),{},[e,s]),e.useResultRowCount=(e,s)=>z(r+c,j(s),[],[e]),e.useResultRowCountListener=(e,s,t,o)=>H(r+c,j(o),s,t,[e]),e.useResultRowIds=ne,e.useResultRowIdsListener=(e,s,t,o)=>H(r+I,j(o),s,t,[e]),e.useResultRowListener=(e,s,t,o,l)=>H(r+a,j(l),t,o,[e,s]),e.useResultSortedRowIds=de,e.useResultSortedRowIdsListener=(e,s,t,o,l,u,n,d)=>H(r+p,j(d),u,n,[e,s,t,o,l]),e.useResultTable=(e,s)=>z(r+n,j(s),{},[e]),e.useResultTableCellIds=(e,s)=>z(r+n+b,j(s),[],[e]),e.useResultTableCellIdsListener=(e,s,t,o)=>H(r+n+b,j(o),s,t,[e]),e.useResultTableListener=(e,s,t,o)=>H(r+n,j(o),s,t,[e]),e.useRow=(e,s,t)=>z(a,O(t),{},[e,s]),e.useRowCount=(e,s)=>z(c,O(s),[],[e]),e.useRowCountListener=(e,s,t,o,l)=>H(c,O(l),s,t,[e],o),e.useRowIds=X,e.useRowIdsListener=(e,s,t,o,l)=>H(I,O(l),s,t,[e],o),e.useRowListener=(e,s,t,o,l,r)=>H(a,O(r),t,o,[e,s],l),e.useSetCellCallback=(e,s,t,o,l,r,u,n)=>J(r,C,o,l,u,n,e,s,t),e.useSetCheckpointCallback=(e=m,s=[],t,o=m,l=[])=>{const r=D(t);return Q((s=>g(r,(t=>{const l=e(s);o(t.addCheckpoint(l),t,l)}))),[r,...s,...l])},e.useSetPartialRowCallback=(e,s,t,o,l,r,u)=>J(l,"PartialRow",t,o,r,u,e,s),e.useSetPartialValuesCallback=(e,s,t,o,l)=>J(t,"PartialValues",e,s,o,l),e.useSetRowCallback=(e,s,t,o,l,r,u)=>J(l,a,t,o,r,u,e,s),e.useSetTableCallback=(e,s,t,o,l,r)=>J(o,n,s,t,l,r,e),e.useSetTablesCallback=(e,s,t,o,l)=>J(t,d,e,s,o,l),e.useSetValueCallback=(e,s,t,o,l,r)=>J(o,w,s,t,l,r,e),e.useSetValuesCallback=(e,s,t,o,l)=>J(t,R,e,s,o,l),e.useSliceIds=te,e.useSliceIdsListener=(e,s,t,o)=>H("SliceIds",B(o),s,t,[e]),e.useSliceRowIds=oe,e.useSliceRowIdsListener=(e,s,t,o,l)=>H("Slice"+I,B(l),t,o,[e,s]),e.useSortedRowIds=Y,e.useSortedRowIdsListener=(e,s,t,o,l,r,u,n,d)=>H(p,O(d),r,u,[e,s,t,o,l],n),e.useStore=e=>T(e,0),e.useStoreIds=()=>P(1),e.useStoreOrStoreById=O,e.useTable=(e,s)=>z(n,O(s),{},[e]),e.useTableCellIds=(e,s)=>z(n+b,O(s),[],[e]),e.useTableCellIdsListener=(e,s,t,o,l)=>H(n+b,O(l),s,t,[e],o),e.useTableIds=W,e.useTableIdsListener=(e,s,t,o)=>H(i,O(o),e,s,[],t),e.useTableListener=(e,s,t,o,l)=>H(n,O(l),s,t,[e],o),e.useTables=e=>z(d,O(e),{}),e.useTablesListener=(e,s,t,o)=>H(d,O(o),e,s,[],t),e.useUndoInformation=e=>{var s;const t=D(e),[l,r]=ce(t);return[(u=l,!(0==(e=>e.length)(u))),pe(t),r,null!=(s=g(r,(e=>null==t?void 0:t.getCheckpoint(e))))?s:o];var u},e.useValue=ee,e.useValueIds=_,e.useValueIdsListener=(e,s,t,o)=>H(k,O(o),e,s,[],t),e.useValueListener=(e,s,t,o,l)=>H(w,O(l),s,t,[e],o),e.useValues=e=>z(R,O(e),{}),e.useValuesListener=(e,s,t,o)=>H(R,O(o),e,s,[],t)},"object"==typeof exports&&"undefined"!=typeof module?s(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],s):s((e="undefined"!=typeof globalThis?globalThis:e||self).TinyBaseUiReact={},e.React);
1
+ var e,s;e=this,s=function(e,s){"use strict";const t=e=>typeof e,o="",l=t(o),r="Listener",u="Result",n="Ids",d="Table",i=d+"s",a=d+n,c="Row",I=c+"Count",p=c+n,C="Sorted"+c+n,b="Cell",w=b+n,R="Value",k=R+"s",v=R+n,g=e=>null==e,h=(e,s,t)=>g(e)?null==t?void 0:t():s(e),y=e=>t(e)==l,m=()=>{},L=(e,s)=>e.map(s),f=Object.keys,{createContext:S,useContext:V}=s,T=S([]),x=(e,s)=>{var t;const o=V(T);return g(e)?o[s]:y(e)?((e,s)=>h(e,(e=>e[s])))(null!=(t=o[s+1])?t:{},e):e},P=(e,s)=>{const t=x(e,s);return g(e)||y(e)?t:e},O=e=>{var s;return f(null!=(s=V(T)[e])?s:{})},q=e=>P(e,0),B=e=>P(e,2),M=e=>P(e,4),D=e=>P(e,6),j=e=>P(e,8),F=e=>P(e,10),Q=e=>e.toLowerCase();Q(r);const E="Transaction";Q(E);const{useCallback:A,useEffect:G,useMemo:U,useRef:W,useState:z}=s,H=(e,s,t=[])=>{const o=U((()=>s(e)),[e,...t]);return G((()=>()=>o.destroy()),[o]),o},J=(e,s,t,o=[],l)=>{const[,r]=z(),u=A((()=>{var l,r;return null!=(r=null==(l=null==s?void 0:s["get"+e])?void 0:l.call(s,...o))?r:t}),[s,...o]),[n]=z(u),d=W(n);return U((()=>d.current=u()),[u]),K(e,s,((...e)=>{d.current=g(l)?u():e[l],r([])}),[],o),d.current},K=(e,s,t,o=[],l=[],...u)=>G((()=>{var o;const n=null==(o=null==s?void 0:s["add"+e+r])?void 0:o.call(s,...l,t,...u);return()=>null==s?void 0:s.delListener(n)}),[s,...l,...o,...u]),N=(e,s,t,o=[],l=m,r=[],...u)=>{const n=q(e);return A((e=>h(n,(o=>h(t(e,o),(e=>l(o["set"+s](...u,e),e)))))),[n,s,...o,...r,...u])},X=(e,s,t=m,o=[],...l)=>{const r=q(e);return A((()=>t(null==r?void 0:r["del"+s](...l))),[r,s,...o,...l])},Y=(e,s,t)=>{const o=F(e);return A((()=>null==o?void 0:o[s](t)),[o,s,t])},Z=e=>J(a,q(e),[],[]),$=(e,s)=>J(p,q(s),[],[e]),_=(e,s,t,o=0,l,r)=>J(C,q(r),[],[e,s,t,o,l],6),ee=(e,s,t)=>J(w,q(t),[],[e,s]),se=(e,s,t,o)=>J(b,q(o),void 0,[e,s,t],4),te=e=>J(v,q(e),[],[]),oe=(e,s)=>J(R,q(s),void 0,[e]),le=(e,s)=>J("Metric",B(s),void 0,[e]),re=(e,s)=>J("SliceIds",M(s),[],[e]),ue=(e,s,t)=>J("Slice"+p,M(t),[],[e,s]),ne=(e,s,t)=>J("RemoteRowId",D(t),void 0,[e,s]),de=(e,s,t)=>J("Local"+p,D(t),[],[e,s]),ie=(e,s,t)=>J("Linked"+p,D(t),[],[e,s]),ae=(e,s)=>J(u+p,j(s),[],[e]),ce=(e,s,t,o=0,l,r)=>J(u+C,j(r),[],[e,s,t,o,l],6),Ie=(e,s,t)=>J(u+w,j(t),[],[e,s]),pe=(e,s,t,o)=>J(u+b,j(o),void 0,[e,s,t]),Ce=e=>J("CheckpointIds",F(e),[[],void 0,[]]),be=(e,s)=>J("Checkpoint",F(s),void 0,[e]),we=e=>Y(e,"goBackward"),Re=e=>Y(e,"goForward"),{PureComponent:ke,Fragment:ve,createElement:ge,useCallback:he,useLayoutEffect:ye,useRef:me,useState:Le}=s,fe=(e,...s)=>g(e)?{}:e(...s),Se=(e,s)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(s),null==e?void 0:e.getRemoteTableId(s)];var Ve=Object.defineProperty,Te=Object.defineProperties,xe=Object.getOwnPropertyDescriptors,Pe=Object.getOwnPropertySymbols,Oe=Object.prototype.hasOwnProperty,qe=Object.prototype.propertyIsEnumerable,Be=(e,s,t)=>s in e?Ve(e,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[s]=t,Me=(e,s)=>{for(var t in s||(s={}))Oe.call(s,t)&&Be(e,t,s[t]);if(Pe)for(var t of Pe(s))qe.call(s,t)&&Be(e,t,s[t]);return e},De=(e,s)=>Te(e,xe(s)),je=(e,s)=>{var t={};for(var o in e)Oe.call(e,o)&&s.indexOf(o)<0&&(t[o]=e[o]);if(null!=e&&Pe)for(var o of Pe(e))s.indexOf(o)<0&&qe.call(e,o)&&(t[o]=e[o]);return t};const{useMemo:Fe}=s,Qe=({tableId:e,store:s,rowComponent:t=ze,getRowComponentProps:o,customCellIds:l,separator:r,debugIds:u},n)=>Ue(L(n,(r=>ge(t,De(Me({},fe(o,r)),{key:r,tableId:e,rowId:r,customCellIds:l,store:s,debugIds:u})))),r,u,e),Ee=({queryId:e,queries:s,resultRowComponent:t=Xe,getResultRowComponentProps:o,separator:l,debugIds:r},u)=>Ue(L(u,(l=>ge(t,De(Me({},fe(o,l)),{key:l,queryId:e,rowId:l,queries:s,debugIds:r})))),l,r,e),Ae=({relationshipId:e,relationships:s,rowComponent:t=ze,getRowComponentProps:o,separator:l,debugIds:r},u,n)=>{const[d,i,a]=Se(D(s),e),c=u(e,n,d);return Ue(L(c,(e=>ge(t,De(Me({},fe(o,e)),{key:e,tableId:a,rowId:e,store:i,debugIds:r})))),l,r,n)},Ge=e=>({checkpoints:s,checkpointComponent:t=Ye,getCheckpointComponentProps:o,separator:l,debugIds:r})=>{const u=F(s);return Ue(L(e(Ce(u)),(e=>ge(t,De(Me({},fe(o,e)),{key:e,checkpoints:u,checkpointId:e,debugIds:r})))),l)},Ue=(e,s,t,o)=>{const l=g(s)||!Array.isArray(e)?e:L(e,((e,t)=>t>0?[s,e]:e));return t?[o,":{",l,"}"]:l},We=({tableId:e,rowId:s,cellId:t,store:l,debugIds:r})=>{var u;return Ue(o+(null!=(u=se(e,s,t,l))?u:o),void 0,r,t)},ze=({tableId:e,rowId:s,store:t,cellComponent:o=We,getCellComponentProps:l,customCellIds:r,separator:u,debugIds:n})=>Ue(L(((e,s,t,o)=>{const l=ee(s,t,o);return null!=e?e:l})(r,e,s,t),(r=>ge(o,De(Me({},fe(l,r)),{key:r,tableId:e,rowId:s,cellId:r,store:t,debugIds:n})))),u,n,s),He=e=>Qe(e,$(e.tableId,e.store)),Je=({valueId:e,store:s,debugIds:t})=>{var l;return Ue(o+(null!=(l=oe(e,s))?l:o),void 0,t,e)},Ke=({indexId:e,sliceId:s,indexes:t,rowComponent:o=ze,getRowComponentProps:l,separator:r,debugIds:u})=>{const[n,d,i]=((e,s)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getTableId(s)])(M(t),e),a=ue(e,s,n);return Ue(L(a,(e=>ge(o,De(Me({},fe(l,e)),{key:e,tableId:i,rowId:e,store:d,debugIds:u})))),r,u,s)},Ne=({queryId:e,rowId:s,cellId:t,queries:l,debugIds:r})=>{var u;return Ue(o+(null!=(u=pe(e,s,t,l))?u:o),void 0,r,t)},Xe=({queryId:e,rowId:s,queries:t,resultCellComponent:o=Ne,getResultCellComponentProps:l,separator:r,debugIds:u})=>Ue(L(Ie(e,s,t),(r=>ge(o,De(Me({},fe(l,r)),{key:r,queryId:e,rowId:s,cellId:r,queries:t,debugIds:u})))),r,u,s),Ye=({checkpoints:e,checkpointId:s,debugIds:t})=>{var l;return Ue(null!=(l=be(s,e))?l:o,void 0,t,s)},Ze=Ge((e=>e[0])),$e=Ge((e=>g(e[1])?[]:[e[1]])),_e=Ge((e=>e[2]));e.BackwardCheckpointsView=Ze,e.CellView=We,e.CheckpointView=Ye,e.CurrentCheckpointView=$e,e.ForwardCheckpointsView=_e,e.IndexView=({indexId:e,indexes:s,sliceComponent:t=Ke,getSliceComponentProps:o,separator:l,debugIds:r})=>Ue(L(re(e,s),(l=>ge(t,De(Me({},fe(o,l)),{key:l,indexId:e,sliceId:l,indexes:s,debugIds:r})))),l,r,e),e.LinkedRowsView=e=>Ae(e,ie,e.firstRowId),e.LocalRowsView=e=>Ae(e,de,e.remoteRowId),e.MetricView=({metricId:e,metrics:s,debugIds:t})=>{var l;return Ue(null!=(l=le(e,s))?l:o,void 0,t,e)},e.Provider=({store:e,storesById:t,metrics:o,metricsById:l,indexes:r,indexesById:u,relationships:n,relationshipsById:d,queries:i,queriesById:a,checkpoints:c,checkpointsById:I,children:p})=>{const C=s.useContext(T);return ge(T.Provider,{value:Fe((()=>[null!=e?e:C[0],Me(Me({},C[1]),t),null!=o?o:C[2],Me(Me({},C[3]),l),null!=r?r:C[4],Me(Me({},C[5]),u),null!=n?n:C[6],Me(Me({},C[7]),d),null!=i?i:C[8],Me(Me({},C[9]),a),null!=c?c:C[10],Me(Me({},C[11]),I)]),[e,t,o,l,r,u,n,d,i,a,c,I,C])},p)},e.RemoteRowView=({relationshipId:e,localRowId:s,relationships:t,rowComponent:o=ze,getRowComponentProps:l,debugIds:r})=>{const[u,n,,d]=Se(D(t),e),i=ne(e,s,u);return Ue(g(d)||g(i)?null:ge(o,De(Me({},fe(l,i)),{key:i,tableId:d,rowId:i,store:n,debugIds:r})),void 0,r,s)},e.ResultCellView=Ne,e.ResultRowView=Xe,e.ResultSortedTableView=e=>{var s=e,{cellId:t,descending:o,offset:l,limit:r}=s,u=je(s,["cellId","descending","offset","limit"]);return Ee(u,ce(u.queryId,t,o,l,r,u.queries))},e.ResultTableView=e=>Ee(e,ae(e.queryId,e.queries)),e.RowView=ze,e.SliceView=Ke,e.SortedTableView=e=>{var s=e,{cellId:t,descending:o,offset:l,limit:r}=s,u=je(s,["cellId","descending","offset","limit"]);return Qe(u,_(u.tableId,t,o,l,r,u.store))},e.TableView=He,e.TablesView=({store:e,tableComponent:s=He,getTableComponentProps:t,separator:o,debugIds:l})=>Ue(L(Z(e),(o=>ge(s,De(Me({},fe(t,o)),{key:o,tableId:o,store:e,debugIds:l})))),o),e.ValueView=Je,e.ValuesView=({store:e,valueComponent:s=Je,getValueComponentProps:t,separator:o,debugIds:l})=>Ue(L(te(e),(o=>ge(s,De(Me({},fe(t,o)),{key:o,valueId:o,store:e,debugIds:l})))),o),e.useAddRowCallback=(e,s,t=[],o,l=m,r=[],u=!0)=>{const n=q(o);return A((t=>h(n,(o=>h(s(t,o),(s=>l(o.addRow(e,s,u),o,s)))))),[n,e,...t,...r,u])},e.useCell=se,e.useCellIds=ee,e.useCellIdsListener=(e,s,t,o,l,r)=>K(w,q(r),t,o,[e,s],l),e.useCellListener=(e,s,t,o,l,r,u)=>K(b,q(u),o,l,[e,s,t],r),e.useCheckpoint=be,e.useCheckpointIds=Ce,e.useCheckpointIdsListener=(e,s,t)=>K("CheckpointIds",F(t),e,s),e.useCheckpointListener=(e,s,t,o)=>K("Checkpoint",F(o),s,t,[e]),e.useCheckpoints=e=>x(e,10),e.useCheckpointsIds=()=>O(11),e.useCheckpointsOrCheckpointsById=F,e.useCreateCheckpoints=(e,s,t)=>H(e,s,t),e.useCreateIndexes=(e,s,t)=>H(e,s,t),e.useCreateMetrics=(e,s,t)=>H(e,s,t),e.useCreatePersister=(e,s,t=[],o,l=[])=>{const[,r]=z(),u=U((()=>s(e)),[e,...t]);return G((()=>{var e;return e=function*(){yield null==o?void 0:o(u),r(1)},new Promise(((s,t)=>{var o=s=>{try{r(e.next(s))}catch(e){t(e)}},l=s=>{try{r(e.throw(s))}catch(e){t(e)}},r=e=>e.done?s(e.value):Promise.resolve(e.value).then(o,l);r((e=e.apply(void 0,null)).next())})),()=>{u.destroy()}}),[u,...l]),u},e.useCreateQueries=(e,s,t)=>H(e,s,t),e.useCreateRelationships=(e,s,t)=>H(e,s,t),e.useCreateStore=(e,s=[])=>U(e,s),e.useDelCellCallback=(e,s,t,o,l,r,u)=>X(l,b,r,u,e,s,t,o),e.useDelRowCallback=(e,s,t,o,l)=>X(t,c,o,l,e,s),e.useDelTableCallback=(e,s,t,o)=>X(s,d,t,o,e),e.useDelTablesCallback=(e,s,t)=>X(e,i,s,t),e.useDelValueCallback=(e,s,t,o)=>X(s,R,t,o,e),e.useDelValuesCallback=(e,s,t)=>X(e,k,s,t),e.useDidFinishTransactionListener=(e,s,t)=>K("DidFinish"+E,q(t),e,s),e.useGoBackwardCallback=we,e.useGoForwardCallback=Re,e.useGoToCallback=(e,s=[],t,o=m,l=[])=>{const r=F(t);return A((s=>h(r,(t=>h(e(s),(e=>o(t.goTo(e),e)))))),[r,...s,...l])},e.useIndexIds=e=>J("IndexIds",M(e),[]),e.useIndexes=e=>x(e,4),e.useIndexesIds=()=>O(5),e.useIndexesOrIndexesById=M,e.useLinkedRowIds=ie,e.useLinkedRowIdsListener=(e,s,t,o,l)=>K("Linked"+p,D(l),t,o,[e,s]),e.useLocalRowIds=de,e.useLocalRowIdsListener=(e,s,t,o,l)=>K("Local"+p,D(l),t,o,[e,s]),e.useMetric=le,e.useMetricIds=e=>J("MetricIds",B(e),[]),e.useMetricListener=(e,s,t,o)=>K("Metric",B(o),s,t,[e]),e.useMetrics=e=>x(e,2),e.useMetricsIds=()=>O(3),e.useMetricsOrMetricsById=B,e.useQueries=e=>x(e,8),e.useQueriesIds=()=>O(9),e.useQueriesOrQueriesById=j,e.useQueryIds=e=>J("QueryIds",j(e),[]),e.useRedoInformation=e=>{var s;const t=F(e),[,,[l]]=Ce(t);return[!g(l),Re(t),l,null!=(s=h(l,(e=>null==t?void 0:t.getCheckpoint(e))))?s:o]},e.useRelationshipIds=e=>J("RelationshipIds",D(e),[]),e.useRelationships=e=>x(e,6),e.useRelationshipsIds=()=>O(7),e.useRelationshipsOrRelationshipsById=D,e.useRemoteRowId=ne,e.useRemoteRowIdListener=(e,s,t,o,l)=>K("RemoteRowId",D(l),t,o,[e,s]),e.useResultCell=pe,e.useResultCellIds=Ie,e.useResultCellIdsListener=(e,s,t,o,l)=>K(u+w,j(l),t,o,[e,s]),e.useResultCellListener=(e,s,t,o,l,r)=>K(u+b,j(r),o,l,[e,s,t]),e.useResultRow=(e,s,t)=>J(u+c,j(t),{},[e,s]),e.useResultRowCount=(e,s)=>J(u+I,j(s),[],[e]),e.useResultRowCountListener=(e,s,t,o)=>K(u+I,j(o),s,t,[e]),e.useResultRowIds=ae,e.useResultRowIdsListener=(e,s,t,o)=>K(u+p,j(o),s,t,[e]),e.useResultRowListener=(e,s,t,o,l)=>K(u+c,j(l),t,o,[e,s]),e.useResultSortedRowIds=ce,e.useResultSortedRowIdsListener=(e,s,t,o,l,r,n,d)=>K(u+C,j(d),r,n,[e,s,t,o,l]),e.useResultTable=(e,s)=>J(u+d,j(s),{},[e]),e.useResultTableCellIds=(e,s)=>J(u+d+w,j(s),[],[e]),e.useResultTableCellIdsListener=(e,s,t,o)=>K(u+d+w,j(o),s,t,[e]),e.useResultTableListener=(e,s,t,o)=>K(u+d,j(o),s,t,[e]),e.useRow=(e,s,t)=>J(c,q(t),{},[e,s]),e.useRowCount=(e,s)=>J(I,q(s),[],[e]),e.useRowCountListener=(e,s,t,o,l)=>K(I,q(l),s,t,[e],o),e.useRowIds=$,e.useRowIdsListener=(e,s,t,o,l)=>K(p,q(l),s,t,[e],o),e.useRowListener=(e,s,t,o,l,r)=>K(c,q(r),t,o,[e,s],l),e.useSetCellCallback=(e,s,t,o,l,r,u,n)=>N(r,b,o,l,u,n,e,s,t),e.useSetCheckpointCallback=(e=m,s=[],t,o=m,l=[])=>{const r=F(t);return A((s=>h(r,(t=>{const l=e(s);o(t.addCheckpoint(l),t,l)}))),[r,...s,...l])},e.useSetPartialRowCallback=(e,s,t,o,l,r,u)=>N(l,"PartialRow",t,o,r,u,e,s),e.useSetPartialValuesCallback=(e,s,t,o,l)=>N(t,"PartialValues",e,s,o,l),e.useSetRowCallback=(e,s,t,o,l,r,u)=>N(l,c,t,o,r,u,e,s),e.useSetTableCallback=(e,s,t,o,l,r)=>N(o,d,s,t,l,r,e),e.useSetTablesCallback=(e,s,t,o,l)=>N(t,i,e,s,o,l),e.useSetValueCallback=(e,s,t,o,l,r)=>N(o,R,s,t,l,r,e),e.useSetValuesCallback=(e,s,t,o,l)=>N(t,k,e,s,o,l),e.useSliceIds=re,e.useSliceIdsListener=(e,s,t,o)=>K("SliceIds",M(o),s,t,[e]),e.useSliceRowIds=ue,e.useSliceRowIdsListener=(e,s,t,o,l)=>K("Slice"+p,M(l),t,o,[e,s]),e.useSortedRowIds=_,e.useSortedRowIdsListener=(e,s,t,o,l,r,u,n,d)=>K(C,q(d),r,u,[e,s,t,o,l],n),e.useStartTransactionListener=(e,s,t)=>K("Start"+E,q(t),e,s),e.useStore=e=>x(e,0),e.useStoreIds=()=>O(1),e.useStoreOrStoreById=q,e.useTable=(e,s)=>J(d,q(s),{},[e]),e.useTableCellIds=(e,s)=>J(d+w,q(s),[],[e]),e.useTableCellIdsListener=(e,s,t,o,l)=>K(d+w,q(l),s,t,[e],o),e.useTableIds=Z,e.useTableIdsListener=(e,s,t,o)=>K(a,q(o),e,s,[],t),e.useTableListener=(e,s,t,o,l)=>K(d,q(l),s,t,[e],o),e.useTables=e=>J(i,q(e),{}),e.useTablesListener=(e,s,t,o)=>K(i,q(o),e,s,[],t),e.useUndoInformation=e=>{var s;const t=F(e),[l,r]=Ce(t);return[(u=l,!(0==(e=>e.length)(u))),we(t),r,null!=(s=h(r,(e=>null==t?void 0:t.getCheckpoint(e))))?s:o];var u},e.useValue=oe,e.useValueIds=te,e.useValueIdsListener=(e,s,t,o)=>K(v,q(o),e,s,[],t),e.useValueListener=(e,s,t,o,l)=>K(R,q(l),s,t,[e],o),e.useValues=e=>J(k,q(e),{}),e.useValuesListener=(e,s,t,o)=>K(k,q(o),e,s,[],t),e.useWillFinishTransactionListener=(e,s,t)=>K("WillFinish"+E,q(t),e,s)},"object"==typeof exports&&"undefined"!=typeof module?s(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],s):s((e="undefined"!=typeof globalThis?globalThis:e||self).TinyBaseUiReact={},e.React);
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tinybase",
3
- "version": "4.2.0",
3
+ "version": "4.2.2",
4
4
  "author": "jamesgpearce",
5
5
  "repository": "github:tinyplex/tinybase",
6
6
  "license": "MIT",
@@ -213,7 +213,7 @@
213
213
  "devDependencies": {
214
214
  "@automerge/automerge": "^2.1.0-alpha.6",
215
215
  "@babel/cli": "^7.22.15",
216
- "@babel/core": "^7.22.15",
216
+ "@babel/core": "^7.22.17",
217
217
  "@babel/preset-env": "^7.22.15",
218
218
  "@babel/preset-react": "^7.22.15",
219
219
  "@babel/preset-typescript": "^7.22.15",
@@ -228,29 +228,30 @@
228
228
  "@types/jest": "^29.5.4",
229
229
  "@types/jest-environment-puppeteer": "^5.0.3",
230
230
  "@types/less": "^3.0.4",
231
- "@types/node": "^20.5.9",
231
+ "@types/node": "^20.6.0",
232
232
  "@types/puppeteer": "^5.4.7",
233
233
  "@types/react": "^18.2.21",
234
234
  "@types/react-dom": "^18.2.7",
235
235
  "@types/react-test-renderer": "^18.0.1",
236
236
  "@types/tmp": "^0.2.3",
237
- "@typescript-eslint/eslint-plugin": "^6.6.0",
238
- "@typescript-eslint/parser": "^6.6.0",
239
- "@vlcn.io/crsqlite-wasm": "^0.14.0",
237
+ "@typescript-eslint/eslint-plugin": "^6.7.0",
238
+ "@typescript-eslint/parser": "^6.7.0",
239
+ "@vlcn.io/crsqlite-wasm": "^0.15.1",
240
240
  "asciichart": "^1.5.25",
241
241
  "automerge-repo": "^0.1.0",
242
242
  "babel-eslint": "^10.1.0",
243
243
  "babel-jest": "^29.6.4",
244
244
  "babel-plugin-transform-import-meta": "^2.2.1",
245
+ "babel-plugin-transform-vite-meta-env": "^1.0.3",
245
246
  "babel-preset-minify": "^0.5.2",
246
247
  "buffer-replace": "^1.0.0",
247
248
  "country-flag-emoji-json": "^2.0.0",
248
- "cspell": "^7.3.2",
249
+ "cspell": "^7.3.5",
249
250
  "esbuild": "^0.19.2",
250
- "eslint": "^8.48.0",
251
+ "eslint": "^8.49.0",
251
252
  "eslint-config-prettier": "^9.0.0",
252
253
  "eslint-plugin-jest": "^27.2.3",
253
- "eslint-plugin-jsdoc": "^46.5.1",
254
+ "eslint-plugin-jsdoc": "^46.6.0",
254
255
  "eslint-plugin-react": "7.33.2",
255
256
  "eslint-plugin-react-hooks": "^4.6.0",
256
257
  "expo-sqlite": "^11.5.0",
@@ -269,7 +270,7 @@
269
270
  "react": "^18.2.0",
270
271
  "react-dom": "^18.2.0",
271
272
  "react-test-renderer": "^18.2.0",
272
- "rollup": "^3.29.0",
273
+ "rollup": "^3.29.1",
273
274
  "rollup-plugin-esbuild": "^5.0.0",
274
275
  "rollup-plugin-gzip": "^3.1.0",
275
276
  "rollup-plugin-preserve-shebang": "^1.0.1",
package/readme.md CHANGED
@@ -247,4 +247,4 @@ export const createShop: typeof createShopDecl = () => {
247
247
  };
248
248
  ```
249
249
 
250
- <section><h2 id="did-we-say-tiny">Did we say tiny?</h2><p>If you use the basic <a href="https://tinybase.org/api/store/"><code>store</code></a> module alone, you&#x27;ll only add a gzipped <em>4.8kB</em> to your app. Incrementally add the other modules as you need more functionality, or get it all for <em>9.2kB</em>.</p><p>The optional <a href="https://tinybase.org/api/ui-react/"><code>ui-react</code></a> module is just another <em>3.8kB</em>, the auxiliary <a href="https://tinybase.org/api/tools/"><code>tools</code></a> module is <em>10.5kB</em>, and everything is super fast. Life&#x27;s easy when you have zero dependencies!</p><p>Read more about how TinyBase is structured and packaged in the <a href="https://tinybase.org/guides/how-tinybase-is-built/architecture/">Architecture</a> guide.</p></section><div class="table"><table class="fixed"><tbody><tr><th width="30%"> </th><th>.js.gz</th><th>.js</th><th>debug.js</th><th>.d.ts</th></tr><tr><th class="right"><a href="https://tinybase.org/api/store/">store</a></th><td>4.8kB</td><td>11.4kB</td><td>48.6kB</td><td>219.8kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/metrics/">metrics</a></th><td>1.8kB</td><td>3.6kB</td><td>15.2kB</td><td>30.9kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/indexes/">indexes</a></th><td>1.9kB</td><td>3.8kB</td><td>17.1kB</td><td>35.6kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/relationships/">relationships</a></th><td>1.9kB</td><td>3.7kB</td><td>17.2kB</td><td>44.2kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/queries/">queries</a></th><td>2.8kB</td><td>5.7kB</td><td>25.6kB</td><td>126.6kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/checkpoints/">checkpoints</a></th><td>1.6kB</td><td>3.1kB</td><td>12.5kB</td><td>33.3kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/persisters/">persisters</a></th><td>0.7kB</td><td>1.5kB</td><td>5.1kB</td><td>43.4kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/common/">common</a></th><td>0.1kB</td><td>0.1kB</td><td>0.1kB</td><td>3.5kB</td></tr><tr><th class="right">tinybase (all)</th><td>9.2kB</td><td>22.5kB</td><td>97.5kB</td><td>0.3kB</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://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>1,870</td><td>1,870</td><td>100.0%</td></tr><tr><th class="right">Statements</th><td>2,023</td><td>2,023</td><td>100.0%</td></tr><tr><th class="right">Functions</th><td>806</td><td>806</td><td>100.0%</td></tr><tr><th class="right">Branches</th><td>689</td><td>689</td><td>100.0%</td></tr><tr><th class="right">Tests</th><td colspan="3">3,356</td></tr><tr><th class="right">Assertions</th><td colspan="3">15,205</td></tr></tbody></table></div><hr><p><a class="start" href="https://tinybase.org/guides/the-basics/getting-started/">Get started</a></p><p><a href="https://tinybase.org/demos/">Try the demos</a></p><p><a href="https://tinybase.org/api/store/interfaces/store/store/">Read the docs</a></p><hr><section><h2 id="follow">Follow</h2><ul><li>News and updates on <a href="https://twitter.com/tinybasejs">Twitter</a>, <a href="https://discord.com/invite/mGz3mevwP8">Discord</a>, and <a href="https://facebook.com/tinybasejs">Facebook</a>.</li><li><a href="https://github.com/tinyplex/tinybase/discussions">Discussions</a> and <a href="https://github.com/tinyplex/tinybase/issues">issues</a> on <a href="https://github.com/tinyplex/tinybase">GitHub</a>.</li><li><a href="https://tinybase.org/guides/releases/">Release notes</a> for each version.</li><li>Packages on <a href="https://www.npmjs.com/package/tinybase/v/4.2.0">NPM</a>.</li></ul></section><section><h2 id="about">About</h2><p>Building TinyBase was originally an interesting exercise for <a rel="me" href="https://hachyderm.io/@jamesgpearce">me</a> in API design, minification, and documentation. It could not have been built without these great <a href="https://tinybase.org/guides/how-tinybase-is-built/credits/#giants">projects</a> and <a href="https://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>
250
+ <section><h2 id="did-we-say-tiny">Did we say tiny?</h2><p>If you use the basic <a href="https://tinybase.org/api/store/"><code>store</code></a> module alone, you&#x27;ll only add a gzipped <em>4.8kB</em> to your app. Incrementally add the other modules as you need more functionality, or get it all for <em>9.2kB</em>.</p><p>The optional <a href="https://tinybase.org/api/ui-react/"><code>ui-react</code></a> module is just another <em>3.9kB</em>, the auxiliary <a href="https://tinybase.org/api/tools/"><code>tools</code></a> module is <em>10.5kB</em>, and everything is super fast. Life&#x27;s easy when you have zero dependencies!</p><p>Read more about how TinyBase is structured and packaged in the <a href="https://tinybase.org/guides/how-tinybase-is-built/architecture/">Architecture</a> guide.</p></section><div class="table"><table class="fixed"><tbody><tr><th width="30%"> </th><th>.js.gz</th><th>.js</th><th>debug.js</th><th>.d.ts</th></tr><tr><th class="right"><a href="https://tinybase.org/api/store/">store</a></th><td>4.8kB</td><td>11.4kB</td><td>48.7kB</td><td>220.1kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/metrics/">metrics</a></th><td>1.8kB</td><td>3.6kB</td><td>15.2kB</td><td>30.9kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/indexes/">indexes</a></th><td>1.9kB</td><td>3.8kB</td><td>17.1kB</td><td>35.6kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/relationships/">relationships</a></th><td>1.9kB</td><td>3.7kB</td><td>17.2kB</td><td>44.2kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/queries/">queries</a></th><td>2.8kB</td><td>5.7kB</td><td>25.6kB</td><td>126.6kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/checkpoints/">checkpoints</a></th><td>1.6kB</td><td>3.1kB</td><td>12.5kB</td><td>33.3kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/persisters/">persisters</a></th><td>0.7kB</td><td>1.5kB</td><td>5.1kB</td><td>43.4kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/common/">common</a></th><td>0.1kB</td><td>0.1kB</td><td>0.1kB</td><td>3.5kB</td></tr><tr><th class="right">tinybase (all)</th><td>9.2kB</td><td>22.5kB</td><td>97.5kB</td><td>0.3kB</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://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>1,880</td><td>1,880</td><td>100.0%</td></tr><tr><th class="right">Statements</th><td>2,034</td><td>2,034</td><td>100.0%</td></tr><tr><th class="right">Functions</th><td>811</td><td>811</td><td>100.0%</td></tr><tr><th class="right">Branches</th><td>689</td><td>689</td><td>100.0%</td></tr><tr><th class="right">Tests</th><td colspan="3">3,365</td></tr><tr><th class="right">Assertions</th><td colspan="3">15,251</td></tr></tbody></table></div><hr><p><a class="start" href="https://tinybase.org/guides/the-basics/getting-started/">Get started</a></p><p><a href="https://tinybase.org/demos/">Try the demos</a></p><p><a href="https://tinybase.org/api/store/interfaces/store/store/">Read the docs</a></p><hr><section><h2 id="follow">Follow</h2><ul><li>News and updates on <a href="https://twitter.com/tinybasejs">Twitter</a>, <a href="https://discord.com/invite/mGz3mevwP8">Discord</a>, and <a href="https://facebook.com/tinybasejs">Facebook</a>.</li><li><a href="https://github.com/tinyplex/tinybase/discussions">Discussions</a> and <a href="https://github.com/tinyplex/tinybase/issues">issues</a> on <a href="https://github.com/tinyplex/tinybase">GitHub</a>.</li><li><a href="https://tinybase.org/guides/releases/">Release notes</a> for each version.</li><li>Packages on <a href="https://www.npmjs.com/package/tinybase/v/4.2.2">NPM</a>.</li></ul></section><section><h2 id="about">About</h2><p>Building TinyBase was originally an interesting exercise for <a rel="me" href="https://hachyderm.io/@jamesgpearce">me</a> in API design, minification, and documentation. It could not have been built without these great <a href="https://tinybase.org/guides/how-tinybase-is-built/credits/#giants">projects</a> and <a href="https://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>