tinybase 4.3.9 → 4.3.11

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.
@@ -1 +1 @@
1
- import e from"react";import{useCell as t,useValue as l,useSetValueCallback as n,useSetCellCallback as r,useRowIds as o,useTableCellIds as s,useRowCount as a,useSortedRowIds as i,useValueIds as d,ValueView as u,useIndexesOrIndexesById as c,useSliceRowIds as h,useRelationshipsOrRelationshipsById as m,useResultRowIds as p,useResultTableCellIds as v,useResultRowCount as b,useResultSortedRowIds as g,useStoreOrStoreById as f,useRemoteRowId as y,CellView as I,ResultCellView as w,useIndexes as C,useIndexIds as k,useSliceIds as x,useMetrics as T,useMetricIds as S,useMetric as O,useQueries as q,useQueryIds as V,useRelationships as N,useRelationshipIds as P,useStore as L,useTableIds as R,useValues as E,useStoreIds as j,useMetricsIds as M,useIndexesIds as z,useRelationshipsIds as $,useQueriesIds as A,useCreateStore as F,useCreatePersister as J}from"./ui-react";const D=e=>typeof e,B="",W=D(B),H=D(!0),Q=D(0),G=D(D),K="type",U="default",X="Ids",Y="Table",Z=Y+"s",_=Y+X,ee="Row",te=ee+"Count",le=ee+X,ne="Cell",re=ne+X,oe="Value",se=oe+"s",ae=oe+X,ie="currentTarget",de="value",ue=e=>B+e,ce=Math.floor,he=isFinite,me=(e,t)=>e instanceof t,pe=e=>null==e,ve=(e,t,l)=>pe(e)?null==l?void 0:l():t(e),be=e=>e==W||e==H,ge=e=>D(e)==G,fe=e=>Array.isArray(e),ye=(e,t,l)=>e.slice(t,l),Ie=e=>e.length,{PureComponent:we,Fragment:Ce,createElement:ke,useCallback:xe,useLayoutEffect:Te,useRef:Se,useState:Oe}=e,qe=(e,...t)=>pe(e)?{}:e(...t),Ve=(e,t)=>e.forEach(t),Ne=(e,t)=>e.map(t),Pe=e=>0==Ie(e),Le=(e,...t)=>e.push(...t),Re=e=>e.shift(),Ee=Object,je=Ee.keys,Me=Ee.isFrozen,ze=Ee.freeze,$e=e=>me(e,Ee)&&e.constructor==Ee,Ae=(e=[])=>Ee.fromEntries(e),Fe=(e,t)=>!pe(((e,t)=>ve(e,(e=>e[t])))(e,t)),Je=(e,t)=>(delete e[t],e),De=(e,t)=>Ne(Ee.entries(e),(([e,l])=>t(l,e))),Be=e=>$e(e)&&0==(e=>Ie(je(e)))(e),We=e=>JSON.stringify(e,((e,t)=>me(t,Map)?Ee.fromEntries([...t]):t)),He=JSON.parse,Qe="tinybaseStoreInspector",Ge="TinyBase Store Inspector",Ke=["left","top","bottom","right","full"],Ue="state",Xe="sort",Ye="open",Ze="position",_e=Ye,et="editable",tt=(...e)=>We(e),lt=(e,t)=>Ne(e.sort(),t),nt=(e,l)=>[!!t(Ue,e,et,l),xe((t=>{l.setCell(Ue,e,et,(e=>!e)),t.preventDefault()}),[l,e])],rt="M20 80l5-15l40-40l10 10l-40 40l-15 5m5-15l10 10",ot='content:url("',st=ot+"data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' stroke-width='4' stroke='white' fill='none'>",at='</svg>")',it=ot+"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\")",dt=Ne([[20,20,20,60],[20,20,60,20],[20,60,60,20],[60,20,20,60],[30,30,40,40]],(([e,t,l,n])=>st+`<rect x='20' y='20' width='60' height='60' fill='grey'/><rect x='${e}' y='${t}' width='${l}' height='${n}' fill='white'/>`+at)),ut=st+"<path d='M20 20l60 60M20 80l60-60' />"+at,ct=st+`<path d='${rt}' />`+at,ht=st+`<path d='${rt}M20 20l60 60' />`+at;var mt=Object.defineProperty,pt=Object.defineProperties,vt=Object.getOwnPropertyDescriptors,bt=Object.getOwnPropertySymbols,gt=Object.prototype.hasOwnProperty,ft=Object.prototype.propertyIsEnumerable,yt=(e,t,l)=>t in e?mt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l,It=(e,t)=>{for(var l in t||(t={}))gt.call(t,l)&&yt(e,l,t[l]);if(bt)for(var l of bt(t))ft.call(t,l)&&yt(e,l,t[l]);return e},wt=(e,t)=>pt(e,vt(t));const Ct="*::-webkit-scrollbar",kt=`#${Qe}{\n all:initial;font-family:sans-serif;font-size:0.75rem;position:fixed;z-index:999999;\n ${((e,t="")=>e.join(t))(De(wt(It(wt(It(wt(It({"*":"all:revert","*::before":"all:revert","*::after":"all:revert",[Ct]:"width:0.5rem;height:0.5rem;",[Ct+"-track"]:"background:#111",[Ct+"-thumb"]:"background:#999;border:1px solid #111",[Ct+"-thumb:hover"]:"background:#fff",[Ct+"-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;"+it},Ae(Ne(["bottom:0;left:0","top:0;right:0"],((e,t)=>[`>img[data-position='${t}']`,e])))),{main:"display:flex;flex-direction:column;background:#111d;color:#fff;position:fixed;"}),Ae(Ne(["bottom:0;left:0;width:35vw;height:100vh","top:0;right:0;width:100vw;height:30vh","bottom:0;left:0;width:100vw;height:30vh","top:0;right:0;width:35vw;height:100vh","top:0;right:0;width:100vw;height:100vh"],((e,t)=>[`main[data-position='${t}']`,e])))),{header:"display:flex;padding:0.25rem;background:#000;align-items:center","header>img:nth-of-type(1)":it,"header>img:nth-of-type(6)":ut}),Ae(Ne(dt,((e,t)=>[`header>img[data-id='${t}']`,e])))),{"header>span":"flex:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;margin-left:0.25rem",article:"padding:0.25rem 0.25rem 0.25rem 0.5rem;overflow:auto;flex:1",details:"margin-left:0.75rem;width:fit-content;","details img":"display:none","details[open]>summary img":"display:unset;background:none;margin-left:0.25rem","details[open]>summary img.edit":ct,"details[open]>summary img.done":ht,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,t)=>e?`& ${t}{${e}}`:"")))}`,xt=({s:e})=>{var t;const r=null!=(t=l(Ze,e))?t:1,o=n(_e,(()=>!0),[],e);return l(_e,e)?null:ke("img",{onClick:o,title:Ge,"data-position":r})},Tt=({uniqueId:e,summary:l,editable:n,handleEditable:o,children:s,s:a})=>{const i=!!t(Ue,e,Ye,a),d=r(Ue,e,Ye,(e=>e[ie].open),[],a);return ke("details",{open:i,onToggle:d},ke("summary",null,l,o?ke("img",{onClick:o,className:n?"done":"edit"}):null),s)},St=e=>{const t=D(e);return be(t)||t==Q&&he(e)?t:void 0},Ot=(e,t,l,n,r)=>pe(r)?e.delCell(t,l,n,!0):e.setCell(t,l,n,r),qt=(e,t,l)=>pe(l)?e.delValue(t):e.setValue(t,l),Vt=(e,t,l,n)=>e==W?t:e==Q?l:n;var Nt=Object.defineProperty,Pt=Object.defineProperties,Lt=Object.getOwnPropertyDescriptors,Rt=Object.getOwnPropertySymbols,Et=Object.prototype.hasOwnProperty,jt=Object.prototype.propertyIsEnumerable,Mt=(e,t,l)=>t in e?Nt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l,zt=(e,t)=>{for(var l in t||(t={}))Et.call(t,l)&&Mt(e,l,t[l]);if(Rt)for(var l of Rt(t))jt.call(t,l)&&Mt(e,l,t[l]);return e},$t=(e,t)=>Pt(e,Lt(t)),At=(e,t)=>{var l={};for(var n in e)Et.call(e,n)&&t.indexOf(n)<0&&(l[n]=e[n]);if(null!=e&&Rt)for(var n of Rt(e))t.indexOf(n)<0&&jt.call(e,n)&&(l[n]=e[n]);return l};const{useCallback:Ft,useMemo:Jt,useState:Dt}=e,Bt="editable",Wt=(e,t)=>Ne(s(e,t),(t=>e+"."+t)),Ht=(e,t,l)=>{const n=Ft(e,t);return l?n:void 0},Qt=(...e)=>Jt((()=>e),e),Gt=(e,t)=>Jt((()=>({store:e,tableId:t})),[e,t]),Kt=(e,t)=>Jt((()=>({queries:e,queryId:t})),[e,t]),Ut=(e,t=!1,l,n=0,r,o,s,a)=>{const[[i,d,u],c]=Dt([e,t,n]),h=Ft((e=>{c(e),null==a||a(e)}),[a]),m=Ht((e=>h([e,e==i&&!d,u])),[h,i,d,u],l),p=Ft((e=>h([i,d,e])),[h,i,d]),v=!0===s?ul:s;return[[i,d,u],m,Jt((()=>!1===s?null:ke(v,{offset:u,limit:r,total:o,onChange:p})),[s,v,u,r,o,p])]},Xt=(e,t,l)=>Jt((()=>{const n=null!=t?t:e;return Ae(De(fe(n)?Ae(Ne(n,(e=>[e,e]))):n,((e,t)=>{return[t,zt(zt({},{label:t,component:l}),(n=e,D(n)==W?{label:e}:e))];var n})))}),[t,l,e]),Yt=({className:e,headerRow:t,idColumn:l,params:[n,r,o,s,a,i]})=>ke("table",{className:e},i?ke("caption",null,i):null,!1===t?null:ke("thead",null,ke("tr",null,!1===l?null:ke(Zt,{sort:null!=s?s:[],label:"Id",onClick:a}),De(n,(({label:e},t)=>ke(Zt,{key:t,cellId:t,label:e,sort:null!=s?s:[],onClick:a}))))),ke("tbody",null,Ne(o,(e=>ke("tr",{key:e},!1===l?null:ke("th",null,e),De(n,(({component:t,getComponentProps:l},n)=>ke("td",{key:n},ke(t,$t(zt(zt({},qe(l,e,n)),r),{rowId:e,cellId:n})))))))))),Zt=({cellId:e,sort:[t,l],label:n=(null!=e?e:B),onClick:r})=>ke("th",{onClick:Ht((()=>null==r?void 0:r(e)),[r,e],r),className:pe(l)||t!=e?void 0:`sorted ${l?"de":"a"}scending`},pe(l)||t!=e?null:(l?"↓":"↑")+" ",n),_t=({localRowId:t,params:[l,n,r,o,s,a,i]})=>{const d=y(s,t,a);return ke("tr",null,!1===l?null:ke(e.Fragment,null,ke("th",null,t),ke("th",null,d)),De(n,(({component:e,getComponentProps:l},n)=>{const[s,a]=n.split(".",2),u=s===r?t:s===o?d:null;return pe(u)?null:ke("td",{key:n},ke(e,$t(zt({},qe(l,u,a)),{store:i,tableId:s,rowId:u,cellId:a})))})))},el=({thing:e,onThingChange:t,className:l,hasSchema:n})=>{const[r,o]=Dt(),[s,a]=Dt(),[i,d]=Dt(),[u,c]=Dt(),[h,m]=Dt();s!==e&&(o(St(e)),a(e),d(e+""),c(Number(e)||0),m(!!e));const p=Ft(((e,l)=>{l(e),a(e),t(e)}),[t]);return ke("div",{className:l},ke("button",{className:r,onClick:Ft((()=>{if(!(null==n?void 0:n())){const e=Vt(r,Q,H,W),l=Vt(e,i,u,h);o(e),a(l),t(l)}}),[n,t,i,u,h,r])},r),Vt(r,ke("input",{key:r,value:i,onChange:Ft((e=>p(e[ie][de]+"",d)),[p])}),ke("input",{key:r,type:"number",value:u,onChange:Ft((e=>p(Number(e[ie][de]||0),c)),[p])}),ke("input",{key:r,type:"checkbox",checked:h,onChange:Ft((e=>p(!!e[ie].checked,m)),[p])})))},tl=e=>{var t=e,{tableId:l,store:n,editable:r,customCells:a}=t,i=At(t,["tableId","store","editable","customCells"]);return ke(Yt,$t(zt({},i),{params:Qt(Xt(s(l,n),a,r?il:I),Gt(n,l),o(l,n))}))},ll=e=>{var t=e,{tableId:l,cellId:n,descending:r,offset:o,limit:d,store:u,editable:c,sortOnClick:h,paginator:m=!1,onChange:p,customCells:v}=t,b=At(t,["tableId","cellId","descending","offset","limit","store","editable","sortOnClick","paginator","onChange","customCells"]);const[g,f,y]=Ut(n,r,h,o,d,a(l,u),m,p);return ke(Yt,$t(zt({},b),{params:Qt(Xt(s(l,u),v,c?il:I),Gt(u,l),i(l,...g,d,u),g,f,y)}))},nl=({store:e,editable:t=!1,valueComponent:l=(t?dl:u),getValueComponentProps:n,className:r,headerRow:o,idColumn:s})=>ke("table",{className:r},!1===o?null:ke("thead",null,ke("tr",null,!1===s?null:ke("th",null,"Id"),ke("th",null,oe))),ke("tbody",null,Ne(d(e),(t=>ke("tr",{key:t},!1===s?null:ke("th",null,t),ke("td",null,ke(l,$t(zt({},qe(n,t)),{valueId:t,store:e})))))))),rl=e=>{var t=e,{indexId:l,sliceId:n,indexes:r,editable:o,customCells:a}=t,i=At(t,["indexId","sliceId","indexes","editable","customCells"]);const[d,u,m]=((e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getTableId(t)])(c(r),l);return ke(Yt,$t(zt({},i),{params:Qt(Xt(s(m,u),a,o?il:I),Gt(u,m),h(l,n,d))}))},ol=({relationshipId:t,relationships:l,editable:n,customCells:r,className:s,headerRow:a,idColumn:i=!0})=>{const[d,u,c,h]=((e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(t),null==e?void 0:e.getRemoteTableId(t)])(m(l),t),p=Xt([...Wt(c,u),...Wt(h,u)],r,n?il:I),v=Qt(i,p,c,h,t,d,u);return ke("table",{className:s},!1===a?null:ke("thead",null,ke("tr",null,!1===i?null:ke(e.Fragment,null,ke("th",null,c,".Id"),ke("th",null,h,".Id")),De(p,(({label:e},t)=>ke("th",{key:t},e))))),ke("tbody",null,Ne(o(c,u),(e=>ke(_t,{key:e,localRowId:e,params:v})))))},sl=e=>{var t=e,{queryId:l,queries:n,customCells:r}=t,o=At(t,["queryId","queries","customCells"]);return ke(Yt,$t(zt({},o),{params:Qt(Xt(v(l,n),r,w),Kt(n,l),p(l,n))}))},al=e=>{var t=e,{queryId:l,cellId:n,descending:r,offset:o,limit:s,queries:a,sortOnClick:i,paginator:d=!1,customCells:u,onChange:c}=t,h=At(t,["queryId","cellId","descending","offset","limit","queries","sortOnClick","paginator","customCells","onChange"]);const[m,p,f]=Ut(n,r,i,o,s,b(l,a),d,c);return ke(Yt,$t(zt({},h),{params:Qt(Xt(v(l,a),u,w),Kt(a,l),g(l,...m,s,a),m,p,f)}))},il=({tableId:e,rowId:l,cellId:n,store:o,className:s})=>{var a;return ke(el,{thing:t(e,l,n,o),onThingChange:r(e,l,n,(e=>e),[],o),className:null!=s?s:Bt+ne,hasSchema:null==(a=f(o))?void 0:a.hasTablesSchema})},dl=({valueId:e,store:t,className:r})=>{var o;return ke(el,{thing:l(e,t),onThingChange:n(e,(e=>e),[],t),className:null!=r?r:Bt+oe,hasSchema:null==(o=f(t))?void 0:o.hasValuesSchema})},ul=({onChange:t,total:l,offset:n=0,limit:r=l,singular:o="row",plural:s=o+"s"})=>{(n>l||n<0)&&(n=0,t(0));const a=Ht((()=>t(n-r)),[t,n,r],n>0),i=Ht((()=>t(n+r)),[t,n,r],n+r<l);return ke(e.Fragment,null,l>r&&ke(e.Fragment,null,ke("button",{className:"previous",disabled:0==n,onClick:a},"←"),ke("button",{className:"next",disabled:n+r>=l,onClick:i},"→"),n+1," to ",Math.min(l,n+r)," of "),l," ",1!=l?s:o)},cl=({indexes:e,indexesId:t,indexId:l,s:n})=>ke(Tt,{uniqueId:tt("i",t,l),summary:"Index: "+l,s:n},Ne(x(l,e),(r=>ke(hl,{indexes:e,indexesId:t,indexId:l,sliceId:r,s:n,key:r})))),hl=({indexes:e,indexesId:t,indexId:l,sliceId:n,s:r})=>{const o=tt("i",t,l,n),[s,a]=nt(o,r);return ke(Tt,{uniqueId:o,summary:"Slice: "+n,editable:s,handleEditable:a,s:r},ke(rl,{sliceId:n,indexId:l,indexes:e,editable:s}))},ml=({indexesId:e,s:t})=>{const l=C(e),n=k(l);return pe(l)?null:ke(Tt,{uniqueId:tt("i",e),summary:"Indexes: "+(null!=e?e:U),s:t},Pe(n)?"No indexes defined":lt(n,(n=>ke(cl,{indexes:l,indexesId:e,indexId:n,s:t,key:n}))))},pl=({metrics:e,metricId:t})=>ke("tr",null,ke("th",null,t),ke("td",null,null==e?void 0:e.getTableId(t)),ke("td",null,O(t,e))),vl=({metricsId:e,s:t})=>{const l=T(e),n=S(l);return pe(l)?null:ke(Tt,{uniqueId:tt("m",e),summary:"Metrics: "+(null!=e?e:U),s:t},Pe(n)?"No metrics defined":ke("table",null,ke("thead",null,ke("th",null,"Metric Id"),ke("th",null,"Table Id"),ke("th",null,"Metric")),ke("tbody",null,Ne(n,(e=>ke(pl,{metrics:l,metricId:e,key:e}))))))},bl=({queries:e,queriesId:l,queryId:n,s:o})=>{var s;const a=tt("q",l,n),[i,d,u]=He(null!=(s=t(Ue,a,Xe,o))?s:"[]"),c=r(Ue,a,Xe,We,[],o);return ke(Tt,{uniqueId:a,summary:"Query: "+n,s:o},ke(al,{queryId:n,queries:e,cellId:i,descending:d,offset:u,limit:10,paginator:!0,sortOnClick:!0,onChange:c}))},gl=({queriesId:e,s:t})=>{const l=q(e),n=V(l);return pe(l)?null:ke(Tt,{uniqueId:tt("q",e),summary:"Queries: "+(null!=e?e:U),s:t},Pe(n)?"No queries defined":lt(n,(n=>ke(bl,{queries:l,queriesId:e,queryId:n,s:t,key:n}))))},fl=({relationships:e,relationshipsId:t,relationshipId:l,s:n})=>{const r=tt("r",t,l),[o,s]=nt(r,n);return ke(Tt,{uniqueId:r,summary:"Relationship: "+l,editable:o,handleEditable:s,s:n},ke(ol,{relationshipId:l,relationships:e,editable:o}))},yl=({relationshipsId:e,s:t})=>{const l=N(e),n=P(l);return pe(l)?null:ke(Tt,{uniqueId:tt("r",e),summary:"Relationships: "+(null!=e?e:U),s:t},Pe(n)?"No relationships defined":lt(n,(n=>ke(fl,{relationships:l,relationshipsId:e,relationshipId:n,s:t,key:n}))))},Il=({tableId:e,store:l,storeId:n,s:o})=>{var s;const a=tt("t",n,e),[i,d,u]=He(null!=(s=t(Ue,a,Xe,o))?s:"[]"),c=r(Ue,a,Xe,We,[],o),[h,m]=nt(a,o);return ke(Tt,{uniqueId:a,summary:Y+": "+e,editable:h,handleEditable:m,s:o},ke(ll,{tableId:e,store:l,cellId:i,descending:d,offset:u,limit:10,paginator:!0,sortOnClick:!0,onChange:c,editable:h}))},wl=({store:e,storeId:t,s:l})=>{const n=tt("v",t),[r,o]=nt(n,l);return Pe(d(e))?null:ke(Tt,{uniqueId:n,summary:se,editable:r,handleEditable:o,s:l},ke(nl,{store:e,editable:r}))},Cl=({storeId:e,s:t})=>{const l=L(e),n=R(l);return pe(l)?null:ke(Tt,{uniqueId:tt("s",e),summary:"Store: "+(null!=e?e:U),s:t},ke(wl,{storeId:e,store:l,s:t}),lt(n,(n=>ke(Il,{store:l,storeId:e,tableId:n,s:t,key:n}))))},kl=({s:e})=>{const t=Se(null),l=Se(0),[n,r]=Oe(!1),{scrollLeft:o,scrollTop:s}=E(e);Te((()=>{const e=t.current;if(e&&!n){const t=new MutationObserver((()=>{e.scrollWidth>=ce(o)+e.clientWidth&&e.scrollHeight>=ce(s)+e.clientHeight&&e.scrollTo(o,s)}));return t.observe(e,{childList:!0,subtree:!0}),()=>t.disconnect()}}),[n,o,s]);const a=xe((t=>{const{scrollLeft:n,scrollTop:o}=t[ie];cancelIdleCallback(l.current),l.current=requestIdleCallback((()=>{r(!0),e.setPartialValues({scrollLeft:n,scrollTop:o})}))}),[e]),i=L(),d=j(),u=T(),c=M(),h=C(),m=z(),p=N(),v=$(),b=q(),g=A();return pe(i)&&Pe(d)&&pe(u)&&Pe(c)&&pe(h)&&Pe(m)&&pe(p)&&Pe(v)&&pe(b)&&Pe(g)?ke("span",{className:"warn"},"There are no Stores or other objects to inspect. Make sure you placed the StoreInspector inside a Provider component."):ke("article",{ref:t,onScroll:a},ke(Cl,{s:e}),Ne(d,(t=>ke(Cl,{storeId:t,s:e,key:t}))),ke(vl,{s:e}),Ne(c,(t=>ke(vl,{metricsId:t,s:e,key:t}))),ke(ml,{s:e}),Ne(m,(t=>ke(ml,{indexesId:t,s:e,key:t}))),ke(yl,{s:e}),Ne(v,(t=>ke(yl,{relationshipsId:t,s:e,key:t}))),ke(gl,{s:e}),Ne(g,(t=>ke(gl,{queriesId:t,s:e,key:t}))))};class xl extends we{constructor(e){super(e),this.componentDidCatch=(e,t)=>console.error(e,t.componentStack),this.state={e:0}}render(){return this.state.e?ke("span",{className:"warn"},"Inspector error: please see console for details."):this.props.children}}xl.getDerivedStateFromError=()=>({e:1});const Tl=({s:e})=>{var t;const r=null!=(t=l(Ze,e))?t:1,o=n(_e,(()=>!1),[],e),s=n(Ze,(e=>Number(e[ie].dataset.id)),[],e);return ke("header",null,ke("img",{title:Ge}),ke("span",null,Ge),Ne(Ke,((e,t)=>t==r?null:ke("img",{onClick:s,"data-id":t,title:"Dock to "+e,key:t}))),ke("img",{onClick:o,title:"Close"}))},Sl=({s:e})=>{var t;const n=null!=(t=l(Ze,e))?t:1;return l(_e,e)?ke("main",{"data-position":n},ke(Tl,{s:e}),ke(xl,null,ke(kl,{s:e}))):null},Ol=e=>t=>{return l=(t,l)=>t+e(l),El(t).reduce(l,0);var l},ql=e=>{var t;return null!=(t=null==e?void 0:e.size)?t:0},Vl=Ol(ql),Nl=Ol(Vl),Pl=Ol(Nl),Ll=(e,t)=>{var l;return null!=(l=null==e?void 0:e.has(t))&&l},Rl=e=>pe(e)||0==ql(e),El=e=>{var t;return[...null!=(t=null==e?void 0:e.values())?t:[]]},jl=e=>e.clear(),Ml=(e,t)=>null==e?void 0:e.forEach(t),zl=(e,t)=>null==e?void 0:e.delete(t),$l=e=>new Map(e),Al=e=>{var t;return[...null!=(t=null==e?void 0:e.keys())?t:[]]},Fl=(e,t)=>null==e?void 0:e.get(t),Jl=(e,t)=>Ml(e,((e,l)=>t(l,e))),Dl=(e,t,l)=>pe(l)?(zl(e,t),e):null==e?void 0:e.set(t,l),Bl=(e,t,l)=>(Ll(e,t)||Dl(e,t,l()),Fl(e,t)),Wl=(e,t,l,n=Dl)=>(De(t,((t,n)=>l(e,n,t))),Jl(e,(l=>Fe(t,l)?0:n(e,l))),e),Hl=(e,t,l)=>{const n={};return Ml(e,((e,r)=>{const o=t?t(e,r):e;!(null==l?void 0:l(o,e))&&(n[r]=o)})),n},Ql=(e,t,l)=>Hl(e,(e=>Hl(e,t,l)),Be),Gl=(e,t,l)=>Hl(e,(e=>Ql(e,t,l)),Be),Kl=(e,t)=>{const l=$l();return Ml(e,((e,n)=>{var r;return l.set(n,null!=(r=null==t?void 0:t(e))?r:e)})),l},Ul=e=>Kl(e,Kl),Xl=e=>Kl(e,Ul),Yl=(e,t,l,n,r=0)=>ve((l?Bl:Fl)(e,t[r],r>Ie(t)-2?l:$l),(o=>{if(r>Ie(t)-2)return(null==n?void 0:n(o))&&Dl(e,t[r]),o;const s=Yl(o,t,l,n,r+1);return Rl(o)&&Dl(e,t[r]),s}));var Zl=(e,t,l)=>new Promise(((n,r)=>{var o=e=>{try{a(l.next(e))}catch(e){r(e)}},s=e=>{try{a(l.throw(e))}catch(e){r(e)}},a=e=>e.done?n(e.value):Promise.resolve(e.value).then(o,s);a((l=l.apply(e,t)).next())}));const _l=$l(),en=$l();var tn=(e,t,l)=>new Promise(((n,r)=>{var o=e=>{try{a(l.next(e))}catch(e){r(e)}},s=e=>{try{a(l.throw(e))}catch(e){r(e)}},a=e=>e.done?n(e.value):Promise.resolve(e.value).then(o,s);a((l=l.apply(e,t)).next())}));const ln="storage",nn=globalThis.window,rn=e=>new Set(fe(e)||pe(e)?e:[e]),on=(e,t)=>null==e?void 0:e.add(t),sn=/^\d+$/,an=()=>{const e=[];let t=0;return[l=>{var n;return null!=(n=l?Re(e):null)?n:B+t++},t=>{sn.test(t)&&Ie(e)<1e3&&Le(e,t)}]},dn=e=>[e,e],un=(e,t=Vl)=>t(e[0])+t(e[1]),cn=()=>[$l(),$l()],hn=e=>[...e],mn=([e,t])=>e===t,pn=(e,t,l)=>pe(e)||!$e(e)||Be(e)||Me(e)?(null==l||l(),!1):(De(e,((l,n)=>{t(l,n)||Je(e,n)})),!Be(e)),vn=(e,t,l)=>Dl(e,t,Fl(e,t)==-l?void 0:l),bn=()=>{let e,t,l=!1,n=!1,r=0;const o=$l(),s=$l(),a=$l(),i=$l(),d=$l(),u=$l(),c=$l(),h=$l(),m=$l(),p=$l(),v=$l(),b=$l(),g=$l(),f=$l(),y=rn(),I=$l(),w=$l(),C=$l(),k=$l(),x=cn(),T=cn(),S=cn(),O=cn(),q=cn(),V=cn(),N=cn(),P=cn(),L=cn(),R=cn(),E=cn(),j=cn(),M=cn(),z=cn(),$=cn(),A=$l(),F=cn(),[J,D,W,H]=(e=>{let t;const[l,n]=an(),r=$l();return[(e,n,o,s=[],a=(()=>[]))=>{null!=t||(t=At);const i=l(1);return Dl(r,i,[e,n,o,s,a]),on(Yl(n,null!=o?o:[B],rn),i),i},(e,l,...n)=>Ve(((e,t=[B])=>{const l=[],n=(e,r)=>r==Ie(t)?Le(l,e):null===t[r]?Ml(e,(e=>n(e,r+1))):Ve([t[r],null],(t=>n(Fl(e,t),r+1)));return n(e,0),l})(e,l),(e=>Ml(e,(e=>Fl(r,e)[0](t,...null!=l?l:[],...n))))),e=>ve(Fl(r,e),(([,t,l])=>(Yl(t,null!=l?l:[B],void 0,(t=>(zl(t,e),Rl(t)?1:0))),Dl(r,e),n(e),l))),e=>ve(Fl(r,e),(([e,,l=[],n,r])=>{const o=(...s)=>{var a,i;const d=Ie(s);d==Ie(l)?e(t,...s,...r(s)):pe(l[d])?Ve(null!=(i=null==(a=n[d])?void 0:a.call(n,...s))?i:[],(e=>o(...s,e))):o(...s,l[d])};o()}))]})(),G=e=>{if(!pn(e,((e,t)=>[K,U].includes(t))))return!1;const t=e[K];return!(!be(t)&&t!=Q||(St(e[U])!=t&&Je(e,U),0))},X=(t,l)=>(!e||Ll(v,l)||et(l))&&pn(t,((e,t)=>ie(l,t,e)),(()=>et(l))),ie=(e,t,l,n)=>pn(n?l:me(l,e,t),((n,r)=>ve(de(e,t,r,n),(e=>(l[r]=e,!0)),(()=>!1))),(()=>et(e,t))),de=(t,l,n,r)=>e?ve(Fl(Fl(v,t),n),(e=>St(r)!=e[K]?et(t,l,n,r,e[U]):r),(()=>et(t,l,n,r))):pe(St(r))?et(t,l,n,r):r,ce=(e,t)=>pn(t?e:fe(e),((t,l)=>ve(he(l,t),(t=>(e[l]=t,!0)),(()=>!1))),(()=>tt())),he=(e,l)=>t?ve(Fl(g,e),(t=>St(l)!=t[K]?tt(e,l,t[U]):l),(()=>tt(e,l))):pe(St(l))?tt(e,l):l,me=(e,t,l)=>(ve(Fl(b,t),(([n,r])=>{Ml(n,((t,l)=>{Fe(e,l)||(e[l]=t)})),Ml(r,(n=>{Fe(e,n)||et(t,l,n)}))})),e),fe=e=>(t&&(Ml(f,((t,l)=>{Fe(e,l)||(e[l]=t)})),Ml(y,(t=>{Fe(e,t)||tt(t)}))),e),we=e=>Wl(v,e,((e,t,l)=>{const n=$l(),r=rn();Wl(Bl(v,t,$l),l,((e,t,l)=>{Dl(e,t,l),ve(l[U],(e=>Dl(n,t,e)),(()=>on(r,t)))})),Dl(b,t,[n,r])}),((e,t)=>{Dl(v,t),Dl(b,t)})),Ce=e=>Wl(g,e,((e,t,l)=>{Dl(g,t,l),ve(l[U],(e=>Dl(f,t,e)),(()=>on(y,t)))}),((e,t)=>{Dl(g,t),Dl(f,t),zl(y,t)})),ke=e=>Be(e)?Nt():Ct(e),xe=e=>Wl(C,e,((e,t,l)=>Te(t,l)),((e,t)=>$e(t))),Te=(e,t)=>Wl(Bl(C,e,(()=>(Ke(e,1),Dl(I,e,an()),Dl(w,e,$l()),$l()))),t,((t,l,n)=>Se(e,t,l,n)),((t,l)=>Ae(e,t,l))),Se=(e,t,l,n,r)=>Wl(Bl(t,l,(()=>(Ue(e,l,1),$l()))),n,((t,n,r)=>Oe(e,l,t,n,r)),((n,o)=>Qe(e,t,l,n,o,r))),Oe=(e,t,l,n,r)=>{Ll(l,n)||Xe(e,t,n,1);const o=Fl(l,n);r!==o&&(Ye(e,t,n,o,r),Dl(l,n,r))},qe=(e,t,l,n,r)=>ve(Fl(t,l),(t=>Oe(e,l,t,n,r)),(()=>Se(e,t,l,me({[n]:r},e,l)))),Pe=e=>Be(e)?Rt():kt(e),Re=e=>Wl(k,e,((e,t,l)=>Ee(t,l)),((e,t)=>Ge(t))),Ee=(e,t)=>{Ll(k,e)||Ze(e,1);const l=Fl(k,e);t!==l&&(_e(e,l,t),Dl(k,e,t))},je=(e,t)=>{const[l]=Fl(I,e),n=l(t);return Ll(Fl(C,e),n)?je(e,t):n},Me=e=>{var t;return null!=(t=Fl(C,e))?t:Te(e,{})},$e=e=>Te(e,{}),Ae=(e,t,l)=>{const[,n]=Fl(I,e);n(l),Se(e,t,l,{},!0)},Qe=(e,t,l,n,r,o)=>{var s;const a=Fl(null==(s=Fl(b,e))?void 0:s[0],r);if(!pe(a)&&!o)return Oe(e,l,n,r,a);const i=t=>{Ye(e,l,t,Fl(n,t)),Xe(e,l,t,-1),Dl(n,t)};pe(a)?i(r):Jl(n,i),Rl(n)&&(Ue(e,l,-1),Rl(Dl(t,l))&&(Ke(e,-1),Dl(C,e),Dl(I,e),Dl(w,e)))},Ge=e=>{const t=Fl(f,e);if(!pe(t))return Ee(e,t);_e(e,Fl(k,e)),Ze(e,-1),Dl(k,e)},Ke=(e,t)=>vn(o,e,t),Ue=(e,t,l)=>vn(Bl(i,e,$l),t,l)&&Dl(a,e,Bl(a,e,(()=>0))+l),Xe=(e,t,l,n)=>{var r;const o=Fl(w,e),a=null!=(r=Fl(o,l))?r:0;(0==a&&1==n||1==a&&-1==n)&&vn(Bl(s,e,$l),l,n),Dl(o,l,a!=-n?a+n:null),vn(Bl(Bl(d,e,$l),t,$l),l,n)},Ye=(e,t,l,n,r)=>Bl(Bl(Bl(u,e,$l),t,$l),l,(()=>[n,0]))[1]=r,Ze=(e,t)=>vn(c,e,t),_e=(e,t,l)=>Bl(h,e,(()=>[t,0]))[1]=l,et=(e,t,l,n,r)=>(Le(Bl(Bl(Bl(m,e,$l),t,$l),l,(()=>[])),n),r),tt=(e,t,l)=>(Le(Bl(p,e,(()=>[])),t),l),lt=(e,t,l)=>ve(Fl(Fl(Fl(u,e),t),l),(([e,t])=>[!0,e,t]),(()=>[!1,...dn(ft(e,t,l))])),nt=e=>ve(Fl(h,e),(([e,t])=>[!0,e,t]),(()=>[!1,...dn(wt(e))])),rt=e=>Rl(m)||Rl(E[e])?0:Ml(e?Xl(m):m,((t,l)=>Ml(t,((t,n)=>Ml(t,((t,r)=>D(E[e],[l,n,r],t))))))),ot=e=>Rl(p)||Rl(j[e])?0:Ml(e?Kl(p):p,((t,l)=>D(j[e],[l],t))),st=(e,t,l)=>{if(!Rl(t))return D(e,l,(()=>Hl(t))),1},at=e=>{const t=Rl(N[e]),l=Rl(L[e])&&Rl(O[e])&&Rl(q[e])&&Rl(V[e])&&t&&Rl(T[e]),n=Rl(R[e])&&Rl(P[e])&&Rl(S[e])&&Rl(x[e]);if(!l||!n){const r=e?[Kl(o),Ul(s),Kl(a),Ul(i),Xl(d),Xl(u)]:[o,s,a,i,d,u];if(!l){st(T[e],r[0]),Ml(r[1],((t,l)=>st(O[e],t,[l]))),Ml(r[2],((t,l)=>{0!=t&&D(q[e],[l],pt(l))}));const l=rn();Ml(r[3],((n,r)=>{st(V[e],n,[r])&&!t&&(D(N[e],[r,null]),on(l,r))})),t||Ml(r[5],((t,n)=>{if(!Ll(l,n)){const l=rn();Ml(t,(e=>Ml(e,(([t,n],r)=>n!==t?on(l,r):zl(e,r))))),Ml(l,(t=>D(N[e],[n,t])))}})),Ml(r[4],((t,l)=>Ml(t,((t,n)=>st(L[e],t,[l,n])))))}if(!n){let t;Ml(r[5],((l,n)=>{let r;Ml(l,((l,o)=>{let s;Ml(l,(([l,a],i)=>{a!==l&&(D(R[e],[n,o,i],a,l,lt),t=r=s=1)})),s&&D(P[e],[n,o],lt)})),r&&D(S[e],[n],lt)})),t&&D(x[e],void 0,lt)}}},it=e=>{const t=Rl(z[e]),l=Rl($[e])&&Rl(M[e]);if(!t||!l){const n=e?[Kl(c),Kl(h)]:[c,h];if(t||st(z[e],n[0]),!l){let t;Ml(n[1],(([l,n],r)=>{n!==l&&(D($[e],[r],n,l,nt),t=1)})),t&&D(M[e],void 0,nt)}}},dt=(e,...t)=>(Mt((()=>e(...Ne(t,ue)))),At),ut=()=>[Hl(u,((e,t)=>-1===Fl(o,t)?null:Hl(e,((e,l)=>-1===Fl(Fl(i,t),l)?null:Hl(e,(([,e])=>null!=e?e:null),((e,t)=>mn(t)))),Be)),Be),Hl(h,(([,e])=>null!=e?e:null),((e,t)=>mn(t)))],ct=()=>({cellsTouched:l,valuesTouched:n,changedCells:Gl(u,hn,mn),invalidCells:Gl(m),changedValues:Hl(h,hn,mn),invalidValues:Hl(p),changedTableIds:Hl(o),changedRowIds:Ql(i),changedCellIds:Gl(d),changedValueIds:Hl(c)}),ht=()=>Gl(C),mt=()=>Al(C),pt=e=>ql(Fl(C,ue(e))),vt=e=>Al(Fl(C,ue(e))),bt=(e,t,l,n=0,r)=>{return Ne(ye((s=Fl(C,ue(e)),a=(e,l)=>[pe(t)?l:Fl(e,ue(t)),l],o=([e],[t])=>{return((null!=(n=e)?n:0)<(null!=(r=t)?r:0)?-1:1)*(l?-1:1);var n,r},Ne([...null!=(i=null==s?void 0:s.entries())?i:[]],(([e,t])=>a(t,e))).sort(o)),n,pe(r)?r:n+r),(([,e])=>e));var o,s,a,i},gt=(e,t)=>Al(Fl(Fl(C,ue(e)),ue(t))),ft=(e,t,l)=>Fl(Fl(Fl(C,ue(e)),ue(t)),ue(l)),yt=()=>Hl(k),It=()=>Al(k),wt=e=>Fl(k,ue(e)),Ct=e=>dt((()=>(e=>pn(e,X,et))(e)?xe(e):0)),kt=e=>dt((()=>ce(e)?Re(e):0)),xt=e=>{try{ke(He(e))}catch(e){}return At},Tt=t=>dt((()=>{if((e=pn(t,(e=>pn(e,G))))&&(we(t),!Rl(C))){const e=ht();Nt(),Ct(e)}})),Vt=e=>dt((()=>{if(t=(e=>pn(e,G))(e)){const l=yt();jt(),Rt(),t=!0,Ce(e),kt(l)}})),Nt=()=>dt((()=>xe({}))),Pt=e=>dt((e=>Ll(C,e)?$e(e):0),e),Lt=(e,t)=>dt(((e,t)=>ve(Fl(C,e),(l=>Ll(l,t)?Ae(e,l,t):0))),e,t),Rt=()=>dt((()=>Re({}))),Et=()=>dt((()=>{we({}),e=!1})),jt=()=>dt((()=>{Ce({}),t=!1})),Mt=(e,t)=>{if(-1!=r){zt();const l=e();return $t(t),l}},zt=()=>(-1!=r&&r++,1==r&&D(A,void 0,ut,ct),At),$t=e=>(r>0&&(r--,0==r&&(l=!Rl(u),n=!Rl(h),r=1,rt(1),l&&at(1),ot(1),n&&it(1),(null==e?void 0:e(ut,ct))&&(Ml(u,((e,t)=>Ml(e,((e,l)=>Ml(e,(([e],n)=>Ot(At,t,l,n,e))))))),Ml(h,(([e],t)=>qt(At,t,e))),l=n=!1),D(F[0],void 0,ut,ct),r=-1,rt(0),l&&at(0),ot(0),n&&it(0),D(F[1],void 0,ut,ct),r=0,l=n=!1,Ve([o,s,a,i,d,u,m,c,h,p],jl))),At),At={getContent:()=>[ht(),yt()],getTables:ht,getTableIds:mt,getTable:e=>Ql(Fl(C,ue(e))),getTableCellIds:e=>Al(Fl(w,ue(e))),getRowCount:pt,getRowIds:vt,getSortedRowIds:bt,getRow:(e,t)=>Hl(Fl(Fl(C,ue(e)),ue(t))),getCellIds:gt,getCell:ft,getValues:yt,getValueIds:It,getValue:wt,hasTables:()=>!Rl(C),hasTable:e=>Ll(C,ue(e)),hasTableCell:(e,t)=>Ll(Fl(w,ue(e)),ue(t)),hasRow:(e,t)=>Ll(Fl(C,ue(e)),ue(t)),hasCell:(e,t,l)=>Ll(Fl(Fl(C,ue(e)),ue(t)),ue(l)),hasValues:()=>!Rl(k),hasValue:e=>Ll(k,ue(e)),getTablesJson:()=>We(C),getValuesJson:()=>We(k),getJson:()=>We([C,k]),getTablesSchemaJson:()=>We(v),getValuesSchemaJson:()=>We(g),getSchemaJson:()=>We([v,g]),hasTablesSchema:()=>e,hasValuesSchema:()=>t,setContent:([e,t])=>dt((()=>{(Be(e)?Nt:Ct)(e),(Be(t)?Rt:kt)(t)})),setTables:Ct,setTable:(e,t)=>dt((e=>X(t,e)?Te(e,t):0),e),setRow:(e,t,l)=>dt(((e,t)=>ie(e,t,l)?Se(e,Me(e),t,l):0),e,t),addRow:(e,t,l=!0)=>Mt((()=>{let n;return ie(e,n,t)&&(e=ue(e),Se(e,Me(e),n=je(e,l?1:0),t)),n})),setPartialRow:(e,t,l)=>dt(((e,t)=>{if(ie(e,t,l,1)){const n=Me(e);De(l,((l,r)=>qe(e,n,t,r,l)))}}),e,t),setCell:(e,t,l,n)=>dt(((e,t,l)=>ve(de(e,t,l,ge(n)?n(ft(e,t,l)):n),(n=>qe(e,Me(e),t,l,n)))),e,t,l),setValues:kt,setPartialValues:e=>dt((()=>ce(e,1)?De(e,((e,t)=>Ee(t,e))):0)),setValue:(e,t)=>dt((e=>ve(he(e,ge(t)?t(wt(e)):t),(t=>Ee(e,t)))),e),setTransactionChanges:e=>dt((()=>{De(e[0],((e,t)=>pe(e)?Pt(t):De(e,((e,l)=>pe(e)?Lt(t,l):De(e,((e,n)=>Ot(At,t,l,n,e))))))),De(e[1],((e,t)=>qt(At,t,e)))})),setTablesJson:xt,setValuesJson:e=>{try{Pe(He(e))}catch(e){}return At},setJson:e=>dt((()=>{try{const[t,l]=He(e);ke(t),Pe(l)}catch(t){xt(e)}})),setTablesSchema:Tt,setValuesSchema:Vt,setSchema:(e,t)=>dt((()=>{Tt(e),Vt(t)})),delTables:Nt,delTable:Pt,delRow:Lt,delCell:(e,t,l,n)=>dt(((e,t,l)=>ve(Fl(C,e),(r=>ve(Fl(r,t),(o=>Ll(o,l)?Qe(e,r,t,o,l,n):0))))),e,t,l),delValues:Rt,delValue:e=>dt((e=>Ll(k,e)?Ge(e):0),e),delTablesSchema:Et,delValuesSchema:jt,delSchema:()=>dt((()=>{Et(),jt()})),transaction:Mt,startTransaction:zt,finishTransaction:$t,forEachTable:e=>Ml(C,((t,l)=>e(l,(e=>Ml(t,((t,l)=>e(l,(e=>Jl(t,e))))))))),forEachTableCell:(e,t)=>Jl(Fl(w,ue(e)),t),forEachRow:(e,t)=>Ml(Fl(C,ue(e)),((e,l)=>t(l,(t=>Jl(e,t))))),forEachCell:(e,t,l)=>Jl(Fl(Fl(C,ue(e)),ue(t)),l),forEachValue:e=>Jl(k,e),addSortedRowIdsListener:(e,t,l,n,r,o,s)=>{let a=bt(e,t,l,n,r);return J((()=>{const s=bt(e,t,l,n,r);var i,d,u;d=a,Ie(i=s)===Ie(d)&&(u=(e,t)=>d[t]===e,i.every(u))||(a=s,o(At,e,t,l,n,r,a))}),N[s?1:0],[e,t],[mt])},addStartTransactionListener:e=>J(e,A),addWillFinishTransactionListener:e=>J(e,F[0]),addDidFinishTransactionListener:e=>J(e,F[1]),callListener:e=>(H(e),At),delListener:e=>(W(e),At),getListenerStats:()=>({tables:un(x),tableIds:un(T),tableCellIds:un(O),table:un(S),rowCount:un(q),rowIds:un(V),sortedRowIds:un(N),row:un(P,Nl),cellIds:un(L,Nl),cell:un(R,Pl),invalidCell:un(E,Pl),values:un(M),valueIds:un(z),value:un($),invalidValue:un(j),transaction:Vl(A)+un(F)}),createStore:bn,addListener:J,callListeners:D};return De({[Z]:[0,x],[_]:[0,T],[Y]:[1,S,[mt]],[Y+re]:[1,O,[mt]],[te]:[1,q,[mt]],[le]:[1,V,[mt]],[ee]:[2,P,[mt,vt]],[re]:[2,L,[mt,vt]],[ne]:[3,R,[mt,vt,gt],e=>dn(ft(...e))],InvalidCell:[3,E],[se]:[0,M],[ae]:[0,z],[oe]:[1,$,[It],e=>dn(wt(e[0]))],InvalidValue:[1,j]},(([e,t,l,n],r)=>{At["add"+r+"Listener"]=(...r)=>J(r[e],t[r[e+1]?1:0],e>0?ye(r,0,e):void 0,l,n)})),ze(At)},gn=({position:e="right",open:t=!1})=>{const l=F(bn),n=Ke.indexOf(e);return J(l,(e=>{return((e,t,l,n)=>((e,t,l,n,r,o,s=[])=>{let a,i,d,u=0,c=0,h=0,m=0;Bl(_l,s,(()=>0)),Bl(en,s,(()=>[]));const p=e=>Zl(void 0,null,(function*(){return 2!=u&&(u=1,c++,yield v.schedule((()=>Zl(void 0,null,(function*(){yield e(),u=0}))))),v})),v={load:(l,n)=>Zl(void 0,null,(function*(){return yield p((()=>Zl(void 0,null,(function*(){try{e.setContent(yield t())}catch(t){e.setContent([l,n])}}))))})),startAutoLoad:(...l)=>Zl(void 0,[...l],(function*(l={},r={}){return v.stopAutoLoad(),yield v.load(l,r),m=1,d=n(((l,n)=>Zl(void 0,null,(function*(){if(n){const t=n();yield p((()=>Zl(void 0,null,(function*(){return e.setTransactionChanges(t)}))))}else yield p((()=>Zl(void 0,null,(function*(){var n;try{e.setContent(null!=(n=null==l?void 0:l())?n:yield t())}catch(e){null==o||o(e)}}))))})))),v})),stopAutoLoad:()=>(m&&(r(d),d=void 0,m=0),v),save:t=>Zl(void 0,null,(function*(){return 1!=u&&(u=2,h++,yield v.schedule((()=>Zl(void 0,null,(function*(){try{yield l(e.getContent,t)}catch(e){null==o||o(e)}u=0}))))),v})),startAutoSave:()=>Zl(void 0,null,(function*(){return yield v.stopAutoSave().save(),a=e.addDidFinishTransactionListener(((e,t)=>{const[l,n]=t();Be(l)&&Be(n)||v.save((()=>[l,n]))})),v})),stopAutoSave:()=>(ve(a,e.delListener),v),schedule:(...e)=>Zl(void 0,null,(function*(){return Le(Fl(en,s),...e),yield Zl(void 0,null,(function*(){if(!Fl(_l,s)){for(Dl(_l,s,1);!pe(i=Re(Fl(en,s)));)try{yield i()}catch(e){null==o||o(e)}Dl(_l,s,0)}})),v})),getStore:()=>e,destroy:()=>v.stopAutoLoad().stopAutoSave(),getStats:()=>({loads:c,saves:h})};return ze(v)})(e,(()=>tn(void 0,null,(function*(){return He(l.getItem(t))}))),(e=>tn(void 0,null,(function*(){return l.setItem(t,We(e()))}))),(e=>{const n=n=>{n.storageArea===l&&n.key===t&&e((()=>He(n.newValue)))};return nn.addEventListener(ln,n),n}),(e=>nn.removeEventListener(ln,e)),n))(e,Qe,sessionStorage,t);var t}),void 0,(e=>{return l=function*(){yield e.load(void 0,{position:-1==n?1:n,open:!!t}),yield e.startAutoSave()},new Promise(((e,t)=>{var n=e=>{try{o(l.next(e))}catch(e){t(e)}},r=e=>{try{o(l.throw(e))}catch(e){t(e)}},o=t=>t.done?e(t.value):Promise.resolve(t.value).then(n,r);o((l=l.apply(void 0,null)).next())}));var l})),ke(Ce,null,ke("aside",{id:Qe},ke(xt,{s:l}),ke(Sl,{s:l})),ke("style",null,kt))};var fn=Object.defineProperty,yn=Object.getOwnPropertySymbols,In=Object.prototype.hasOwnProperty,wn=Object.prototype.propertyIsEnumerable,Cn=(e,t,l)=>t in e?fn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l;const kn=e=>ke(gn,((e,t)=>{for(var l in t||(t={}))In.call(t,l)&&Cn(e,l,t[l]);if(yn)for(var l of yn(t))wn.call(t,l)&&Cn(e,l,t[l]);return e})({},e));export{il as EditableCellView,dl as EditableValueView,ol as RelationshipInHtmlTable,al as ResultSortedTableInHtmlTable,sl as ResultTableInHtmlTable,rl as SliceInHtmlTable,ll as SortedTableInHtmlTable,ul as SortedTablePaginator,kn as StoreInspector,tl as TableInHtmlTable,nl as ValuesInHtmlTable};
1
+ import e from"react";import{useCell as t,useValue as l,useSetValueCallback as n,useSetCellCallback as r,useRowIds as o,useTableCellIds as s,useRowCount as a,useSortedRowIds as i,useValueIds as d,ValueView as u,useIndexesOrIndexesById as c,useSliceRowIds as h,useRelationshipsOrRelationshipsById as m,useResultRowIds as p,useResultTableCellIds as v,useResultRowCount as b,useResultSortedRowIds as g,useStoreOrStoreById as f,useRemoteRowId as y,CellView as I,ResultCellView as w,useIndexes as C,useIndexIds as k,useSliceIds as x,useMetrics as T,useMetricIds as S,useMetric as O,useQueries as q,useQueryIds as V,useRelationships as N,useRelationshipIds as P,useStore as L,useTableIds as R,useValues as E,useStoreIds as j,useMetricsIds as M,useIndexesIds as z,useRelationshipsIds as $,useQueriesIds as A,useCreateStore as F,useCreatePersister as J}from"./ui-react";const D=e=>typeof e,B="",W=D(B),H=D(!0),Q=D(0),G=D(D),K="type",U="default",X="Ids",Y="Table",Z=Y+"s",_=Y+X,ee="Row",te=ee+"Count",le=ee+X,ne="Cell",re=ne+X,oe="Value",se=oe+"s",ae=oe+X,ie="currentTarget",de="value",ue=e=>B+e,ce=Math.floor,he=isFinite,me=(e,t)=>e instanceof t,pe=e=>null==e,ve=(e,t,l)=>pe(e)?null==l?void 0:l():t(e),be=e=>e==W||e==H,ge=e=>D(e)==G,fe=e=>Array.isArray(e),ye=(e,t,l)=>e.slice(t,l),Ie=e=>e.length,{PureComponent:we,Fragment:Ce,createElement:ke,useCallback:xe,useLayoutEffect:Te,useRef:Se,useState:Oe}=e,qe=(e,...t)=>pe(e)?{}:e(...t),Ve=(e,t)=>e.forEach(t),Ne=(e,t)=>e.map(t),Pe=e=>0==Ie(e),Le=(e,...t)=>e.push(...t),Re=e=>e.shift(),Ee=Object,je=Ee.keys,Me=Ee.isFrozen,ze=Ee.freeze,$e=e=>me(e,Ee)&&e.constructor==Ee,Ae=(e=[])=>Ee.fromEntries(e),Fe=(e,t)=>!pe(((e,t)=>ve(e,(e=>e[t])))(e,t)),Je=(e,t)=>(delete e[t],e),De=(e,t)=>Ne(Ee.entries(e),(([e,l])=>t(l,e))),Be=e=>$e(e)&&0==(e=>Ie(je(e)))(e),We=e=>JSON.stringify(e,((e,t)=>me(t,Map)?Ee.fromEntries([...t]):t)),He=JSON.parse,Qe="tinybaseStoreInspector",Ge="TinyBase Store Inspector",Ke=["left","top","bottom","right","full"],Ue="state",Xe="sort",Ye="open",Ze="position",_e=Ye,et="editable",tt=(...e)=>We(e),lt=(e,t)=>Ne(e.sort(),t),nt=(e,l)=>[!!t(Ue,e,et,l),xe((t=>{l.setCell(Ue,e,et,(e=>!e)),t.preventDefault()}),[l,e])],rt="M20 80l5-15l40-40l10 10l-40 40l-15 5m5-15l10 10",ot='content:url("',st=ot+"data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' stroke-width='4' stroke='white' fill='none'>",at='</svg>")',it=ot+"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\")",dt=Ne([[20,20,20,60],[20,20,60,20],[20,60,60,20],[60,20,20,60],[30,30,40,40]],(([e,t,l,n])=>st+`<rect x='20' y='20' width='60' height='60' fill='grey'/><rect x='${e}' y='${t}' width='${l}' height='${n}' fill='white'/>`+at)),ut=st+"<path d='M20 20l60 60M20 80l60-60' />"+at,ct=st+`<path d='${rt}' />`+at,ht=st+`<path d='${rt}M20 20l60 60' />`+at;var mt=Object.defineProperty,pt=Object.defineProperties,vt=Object.getOwnPropertyDescriptors,bt=Object.getOwnPropertySymbols,gt=Object.prototype.hasOwnProperty,ft=Object.prototype.propertyIsEnumerable,yt=(e,t,l)=>t in e?mt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l,It=(e,t)=>{for(var l in t||(t={}))gt.call(t,l)&&yt(e,l,t[l]);if(bt)for(var l of bt(t))ft.call(t,l)&&yt(e,l,t[l]);return e},wt=(e,t)=>pt(e,vt(t));const Ct="*::-webkit-scrollbar",kt=`#${Qe}{\n all:initial;font-family:sans-serif;font-size:0.75rem;position:fixed;z-index:999999;\n ${((e,t="")=>e.join(t))(De(wt(It(wt(It(wt(It({"*":"all:revert","*::before":"all:revert","*::after":"all:revert",[Ct]:"width:0.5rem;height:0.5rem;",[Ct+"-track"]:"background:#111",[Ct+"-thumb"]:"background:#999;border:1px solid #111",[Ct+"-thumb:hover"]:"background:#fff",[Ct+"-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;"+it},Ae(Ne(["bottom:0;left:0","top:0;right:0"],((e,t)=>[`>img[data-position='${t}']`,e])))),{main:"display:flex;flex-direction:column;background:#111d;color:#fff;position:fixed;"}),Ae(Ne(["bottom:0;left:0;width:35vw;height:100vh","top:0;right:0;width:100vw;height:30vh","bottom:0;left:0;width:100vw;height:30vh","top:0;right:0;width:35vw;height:100vh","top:0;right:0;width:100vw;height:100vh"],((e,t)=>[`main[data-position='${t}']`,e])))),{header:"display:flex;padding:0.25rem;background:#000;align-items:center","header>img:nth-of-type(1)":it,"header>img:nth-of-type(6)":ut}),Ae(Ne(dt,((e,t)=>[`header>img[data-id='${t}']`,e])))),{"header>span":"flex:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;margin-left:0.25rem",article:"padding:0.25rem 0.25rem 0.25rem 0.5rem;overflow:auto;flex:1",details:"margin-left:0.75rem;width:fit-content;","details img":"display:none","details[open]>summary img":"display:unset;background:none;margin-left:0.25rem","details[open]>summary img.edit":ct,"details[open]>summary img.done":ht,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,t)=>e?`& ${t}{${e}}`:"")))}`,xt=({s:e})=>{var t;const r=null!=(t=l(Ze,e))?t:1,o=n(_e,(()=>!0),[],e);return l(_e,e)?null:ke("img",{onClick:o,title:Ge,"data-position":r})},Tt=({uniqueId:e,summary:l,editable:n,handleEditable:o,children:s,s:a})=>{const i=!!t(Ue,e,Ye,a),d=r(Ue,e,Ye,(e=>e[ie].open),[],a);return ke("details",{open:i,onToggle:d},ke("summary",null,l,o?ke("img",{onClick:o,className:n?"done":"edit"}):null),s)},St=e=>{const t=D(e);return be(t)||t==Q&&he(e)?t:void 0},Ot=(e,t,l,n,r)=>pe(r)?e.delCell(t,l,n,!0):e.setCell(t,l,n,r),qt=(e,t,l)=>pe(l)?e.delValue(t):e.setValue(t,l),Vt=(e,t,l,n)=>e==W?t:e==Q?l:n;var Nt=Object.defineProperty,Pt=Object.defineProperties,Lt=Object.getOwnPropertyDescriptors,Rt=Object.getOwnPropertySymbols,Et=Object.prototype.hasOwnProperty,jt=Object.prototype.propertyIsEnumerable,Mt=(e,t,l)=>t in e?Nt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l,zt=(e,t)=>{for(var l in t||(t={}))Et.call(t,l)&&Mt(e,l,t[l]);if(Rt)for(var l of Rt(t))jt.call(t,l)&&Mt(e,l,t[l]);return e},$t=(e,t)=>Pt(e,Lt(t)),At=(e,t)=>{var l={};for(var n in e)Et.call(e,n)&&t.indexOf(n)<0&&(l[n]=e[n]);if(null!=e&&Rt)for(var n of Rt(e))t.indexOf(n)<0&&jt.call(e,n)&&(l[n]=e[n]);return l};const{useCallback:Ft,useMemo:Jt,useState:Dt}=e,Bt="editable",Wt=(e,t)=>Ne(s(e,t),(t=>e+"."+t)),Ht=(e,t,l)=>{const n=Ft(e,t);return l?n:void 0},Qt=(...e)=>Jt((()=>e),e),Gt=(e,t)=>Jt((()=>({store:e,tableId:t})),[e,t]),Kt=(e,t)=>Jt((()=>({queries:e,queryId:t})),[e,t]),Ut=(e,t=!1,l,n=0,r,o,s,a)=>{const[[i,d,u],c]=Dt([e,t,n]),h=Ft((e=>{c(e),null==a||a(e)}),[a]),m=Ht((e=>h([e,e==i&&!d,u])),[h,i,d,u],l),p=Ft((e=>h([i,d,e])),[h,i,d]),v=!0===s?ul:s;return[[i,d,u],m,Jt((()=>!1===s?null:ke(v,{offset:u,limit:r,total:o,onChange:p})),[s,v,u,r,o,p])]},Xt=(e,t,l)=>Jt((()=>{const n=null!=t?t:e;return Ae(De(fe(n)?Ae(Ne(n,(e=>[e,e]))):n,((e,t)=>{return[t,zt(zt({},{label:t,component:l}),(n=e,D(n)==W?{label:e}:e))];var n})))}),[t,l,e]),Yt=({className:e,headerRow:t,idColumn:l,params:[n,r,o,s,a,i]})=>ke("table",{className:e},i?ke("caption",null,i):null,!1===t?null:ke("thead",null,ke("tr",null,!1===l?null:ke(Zt,{sort:null!=s?s:[],label:"Id",onClick:a}),De(n,(({label:e},t)=>ke(Zt,{key:t,cellId:t,label:e,sort:null!=s?s:[],onClick:a}))))),ke("tbody",null,Ne(o,(e=>ke("tr",{key:e},!1===l?null:ke("th",null,e),De(n,(({component:t,getComponentProps:l},n)=>ke("td",{key:n},ke(t,$t(zt(zt({},qe(l,e,n)),r),{rowId:e,cellId:n})))))))))),Zt=({cellId:e,sort:[t,l],label:n=(null!=e?e:B),onClick:r})=>ke("th",{onClick:Ht((()=>null==r?void 0:r(e)),[r,e],r),className:pe(l)||t!=e?void 0:`sorted ${l?"de":"a"}scending`},pe(l)||t!=e?null:(l?"↓":"↑")+" ",n),_t=({localRowId:t,params:[l,n,r,o,s,a,i]})=>{const d=y(s,t,a);return ke("tr",null,!1===l?null:ke(e.Fragment,null,ke("th",null,t),ke("th",null,d)),De(n,(({component:e,getComponentProps:l},n)=>{const[s,a]=n.split(".",2),u=s===r?t:s===o?d:null;return pe(u)?null:ke("td",{key:n},ke(e,$t(zt({},qe(l,u,a)),{store:i,tableId:s,rowId:u,cellId:a})))})))},el=({thing:e,onThingChange:t,className:l,hasSchema:n,showType:r=!0})=>{const[o,s]=Dt(),[a,i]=Dt(),[d,u]=Dt(),[c,h]=Dt(),[m,p]=Dt();a!==e&&(s(St(e)),i(e),u(e+""),h(Number(e)||0),p(!!e));const v=Ft(((e,l)=>{l(e),i(e),t(e)}),[t]),b=Ft((()=>{if(!(null==n?void 0:n())){const e=Vt(o,Q,H,W),l=Vt(e,d,c,m);s(e),i(l),t(l)}}),[n,t,d,c,m,o]);return ke("div",{className:l},r?ke("button",{className:o,onClick:b},o):null,Vt(o,ke("input",{key:o,value:d,onChange:Ft((e=>v(e[ie][de]+"",u)),[v])}),ke("input",{key:o,type:"number",value:c,onChange:Ft((e=>v(Number(e[ie][de]||0),h)),[v])}),ke("input",{key:o,type:"checkbox",checked:m,onChange:Ft((e=>v(!!e[ie].checked,p)),[v])})))},tl=e=>{var t=e,{tableId:l,store:n,editable:r,customCells:a}=t,i=At(t,["tableId","store","editable","customCells"]);return ke(Yt,$t(zt({},i),{params:Qt(Xt(s(l,n),a,r?il:I),Gt(n,l),o(l,n))}))},ll=e=>{var t=e,{tableId:l,cellId:n,descending:r,offset:o,limit:d,store:u,editable:c,sortOnClick:h,paginator:m=!1,onChange:p,customCells:v}=t,b=At(t,["tableId","cellId","descending","offset","limit","store","editable","sortOnClick","paginator","onChange","customCells"]);const[g,f,y]=Ut(n,r,h,o,d,a(l,u),m,p);return ke(Yt,$t(zt({},b),{params:Qt(Xt(s(l,u),v,c?il:I),Gt(u,l),i(l,...g,d,u),g,f,y)}))},nl=({store:e,editable:t=!1,valueComponent:l=(t?dl:u),getValueComponentProps:n,className:r,headerRow:o,idColumn:s})=>ke("table",{className:r},!1===o?null:ke("thead",null,ke("tr",null,!1===s?null:ke("th",null,"Id"),ke("th",null,oe))),ke("tbody",null,Ne(d(e),(t=>ke("tr",{key:t},!1===s?null:ke("th",null,t),ke("td",null,ke(l,$t(zt({},qe(n,t)),{valueId:t,store:e})))))))),rl=e=>{var t=e,{indexId:l,sliceId:n,indexes:r,editable:o,customCells:a}=t,i=At(t,["indexId","sliceId","indexes","editable","customCells"]);const[d,u,m]=((e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getTableId(t)])(c(r),l);return ke(Yt,$t(zt({},i),{params:Qt(Xt(s(m,u),a,o?il:I),Gt(u,m),h(l,n,d))}))},ol=({relationshipId:t,relationships:l,editable:n,customCells:r,className:s,headerRow:a,idColumn:i=!0})=>{const[d,u,c,h]=((e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(t),null==e?void 0:e.getRemoteTableId(t)])(m(l),t),p=Xt([...Wt(c,u),...Wt(h,u)],r,n?il:I),v=Qt(i,p,c,h,t,d,u);return ke("table",{className:s},!1===a?null:ke("thead",null,ke("tr",null,!1===i?null:ke(e.Fragment,null,ke("th",null,c,".Id"),ke("th",null,h,".Id")),De(p,(({label:e},t)=>ke("th",{key:t},e))))),ke("tbody",null,Ne(o(c,u),(e=>ke(_t,{key:e,localRowId:e,params:v})))))},sl=e=>{var t=e,{queryId:l,queries:n,customCells:r}=t,o=At(t,["queryId","queries","customCells"]);return ke(Yt,$t(zt({},o),{params:Qt(Xt(v(l,n),r,w),Kt(n,l),p(l,n))}))},al=e=>{var t=e,{queryId:l,cellId:n,descending:r,offset:o,limit:s,queries:a,sortOnClick:i,paginator:d=!1,customCells:u,onChange:c}=t,h=At(t,["queryId","cellId","descending","offset","limit","queries","sortOnClick","paginator","customCells","onChange"]);const[m,p,f]=Ut(n,r,i,o,s,b(l,a),d,c);return ke(Yt,$t(zt({},h),{params:Qt(Xt(v(l,a),u,w),Kt(a,l),g(l,...m,s,a),m,p,f)}))},il=({tableId:e,rowId:l,cellId:n,store:o,className:s,showType:a})=>{var i;return ke(el,{thing:t(e,l,n,o),onThingChange:r(e,l,n,(e=>e),[],o),className:null!=s?s:Bt+ne,showType:a,hasSchema:null==(i=f(o))?void 0:i.hasTablesSchema})},dl=({valueId:e,store:t,className:r,showType:o})=>{var s;return ke(el,{thing:l(e,t),onThingChange:n(e,(e=>e),[],t),className:null!=r?r:Bt+oe,showType:o,hasSchema:null==(s=f(t))?void 0:s.hasValuesSchema})},ul=({onChange:t,total:l,offset:n=0,limit:r=l,singular:o="row",plural:s=o+"s"})=>{(n>l||n<0)&&(n=0,t(0));const a=Ht((()=>t(n-r)),[t,n,r],n>0),i=Ht((()=>t(n+r)),[t,n,r],n+r<l);return ke(e.Fragment,null,l>r&&ke(e.Fragment,null,ke("button",{className:"previous",disabled:0==n,onClick:a},"←"),ke("button",{className:"next",disabled:n+r>=l,onClick:i},"→"),n+1," to ",Math.min(l,n+r)," of "),l," ",1!=l?s:o)},cl=({indexes:e,indexesId:t,indexId:l,s:n})=>ke(Tt,{uniqueId:tt("i",t,l),summary:"Index: "+l,s:n},Ne(x(l,e),(r=>ke(hl,{indexes:e,indexesId:t,indexId:l,sliceId:r,s:n,key:r})))),hl=({indexes:e,indexesId:t,indexId:l,sliceId:n,s:r})=>{const o=tt("i",t,l,n),[s,a]=nt(o,r);return ke(Tt,{uniqueId:o,summary:"Slice: "+n,editable:s,handleEditable:a,s:r},ke(rl,{sliceId:n,indexId:l,indexes:e,editable:s}))},ml=({indexesId:e,s:t})=>{const l=C(e),n=k(l);return pe(l)?null:ke(Tt,{uniqueId:tt("i",e),summary:"Indexes: "+(null!=e?e:U),s:t},Pe(n)?"No indexes defined":lt(n,(n=>ke(cl,{indexes:l,indexesId:e,indexId:n,s:t,key:n}))))},pl=({metrics:e,metricId:t})=>ke("tr",null,ke("th",null,t),ke("td",null,null==e?void 0:e.getTableId(t)),ke("td",null,O(t,e))),vl=({metricsId:e,s:t})=>{const l=T(e),n=S(l);return pe(l)?null:ke(Tt,{uniqueId:tt("m",e),summary:"Metrics: "+(null!=e?e:U),s:t},Pe(n)?"No metrics defined":ke("table",null,ke("thead",null,ke("th",null,"Metric Id"),ke("th",null,"Table Id"),ke("th",null,"Metric")),ke("tbody",null,Ne(n,(e=>ke(pl,{metrics:l,metricId:e,key:e}))))))},bl=({queries:e,queriesId:l,queryId:n,s:o})=>{var s;const a=tt("q",l,n),[i,d,u]=He(null!=(s=t(Ue,a,Xe,o))?s:"[]"),c=r(Ue,a,Xe,We,[],o);return ke(Tt,{uniqueId:a,summary:"Query: "+n,s:o},ke(al,{queryId:n,queries:e,cellId:i,descending:d,offset:u,limit:10,paginator:!0,sortOnClick:!0,onChange:c}))},gl=({queriesId:e,s:t})=>{const l=q(e),n=V(l);return pe(l)?null:ke(Tt,{uniqueId:tt("q",e),summary:"Queries: "+(null!=e?e:U),s:t},Pe(n)?"No queries defined":lt(n,(n=>ke(bl,{queries:l,queriesId:e,queryId:n,s:t,key:n}))))},fl=({relationships:e,relationshipsId:t,relationshipId:l,s:n})=>{const r=tt("r",t,l),[o,s]=nt(r,n);return ke(Tt,{uniqueId:r,summary:"Relationship: "+l,editable:o,handleEditable:s,s:n},ke(ol,{relationshipId:l,relationships:e,editable:o}))},yl=({relationshipsId:e,s:t})=>{const l=N(e),n=P(l);return pe(l)?null:ke(Tt,{uniqueId:tt("r",e),summary:"Relationships: "+(null!=e?e:U),s:t},Pe(n)?"No relationships defined":lt(n,(n=>ke(fl,{relationships:l,relationshipsId:e,relationshipId:n,s:t,key:n}))))},Il=({tableId:e,store:l,storeId:n,s:o})=>{var s;const a=tt("t",n,e),[i,d,u]=He(null!=(s=t(Ue,a,Xe,o))?s:"[]"),c=r(Ue,a,Xe,We,[],o),[h,m]=nt(a,o);return ke(Tt,{uniqueId:a,summary:Y+": "+e,editable:h,handleEditable:m,s:o},ke(ll,{tableId:e,store:l,cellId:i,descending:d,offset:u,limit:10,paginator:!0,sortOnClick:!0,onChange:c,editable:h}))},wl=({store:e,storeId:t,s:l})=>{const n=tt("v",t),[r,o]=nt(n,l);return Pe(d(e))?null:ke(Tt,{uniqueId:n,summary:se,editable:r,handleEditable:o,s:l},ke(nl,{store:e,editable:r}))},Cl=({storeId:e,s:t})=>{const l=L(e),n=R(l);return pe(l)?null:ke(Tt,{uniqueId:tt("s",e),summary:"Store: "+(null!=e?e:U),s:t},ke(wl,{storeId:e,store:l,s:t}),lt(n,(n=>ke(Il,{store:l,storeId:e,tableId:n,s:t,key:n}))))},kl=({s:e})=>{const t=Se(null),l=Se(0),[n,r]=Oe(!1),{scrollLeft:o,scrollTop:s}=E(e);Te((()=>{const e=t.current;if(e&&!n){const t=new MutationObserver((()=>{e.scrollWidth>=ce(o)+e.clientWidth&&e.scrollHeight>=ce(s)+e.clientHeight&&e.scrollTo(o,s)}));return t.observe(e,{childList:!0,subtree:!0}),()=>t.disconnect()}}),[n,o,s]);const a=xe((t=>{const{scrollLeft:n,scrollTop:o}=t[ie];cancelIdleCallback(l.current),l.current=requestIdleCallback((()=>{r(!0),e.setPartialValues({scrollLeft:n,scrollTop:o})}))}),[e]),i=L(),d=j(),u=T(),c=M(),h=C(),m=z(),p=N(),v=$(),b=q(),g=A();return pe(i)&&Pe(d)&&pe(u)&&Pe(c)&&pe(h)&&Pe(m)&&pe(p)&&Pe(v)&&pe(b)&&Pe(g)?ke("span",{className:"warn"},"There are no Stores or other objects to inspect. Make sure you placed the StoreInspector inside a Provider component."):ke("article",{ref:t,onScroll:a},ke(Cl,{s:e}),Ne(d,(t=>ke(Cl,{storeId:t,s:e,key:t}))),ke(vl,{s:e}),Ne(c,(t=>ke(vl,{metricsId:t,s:e,key:t}))),ke(ml,{s:e}),Ne(m,(t=>ke(ml,{indexesId:t,s:e,key:t}))),ke(yl,{s:e}),Ne(v,(t=>ke(yl,{relationshipsId:t,s:e,key:t}))),ke(gl,{s:e}),Ne(g,(t=>ke(gl,{queriesId:t,s:e,key:t}))))};class xl extends we{constructor(e){super(e),this.componentDidCatch=(e,t)=>console.error(e,t.componentStack),this.state={e:0}}render(){return this.state.e?ke("span",{className:"warn"},"Inspector error: please see console for details."):this.props.children}}xl.getDerivedStateFromError=()=>({e:1});const Tl=({s:e})=>{var t;const r=null!=(t=l(Ze,e))?t:1,o=n(_e,(()=>!1),[],e),s=n(Ze,(e=>Number(e[ie].dataset.id)),[],e);return ke("header",null,ke("img",{title:Ge}),ke("span",null,Ge),Ne(Ke,((e,t)=>t==r?null:ke("img",{onClick:s,"data-id":t,title:"Dock to "+e,key:t}))),ke("img",{onClick:o,title:"Close"}))},Sl=({s:e})=>{var t;const n=null!=(t=l(Ze,e))?t:1;return l(_e,e)?ke("main",{"data-position":n},ke(Tl,{s:e}),ke(xl,null,ke(kl,{s:e}))):null},Ol=e=>t=>{return l=(t,l)=>t+e(l),El(t).reduce(l,0);var l},ql=e=>{var t;return null!=(t=null==e?void 0:e.size)?t:0},Vl=Ol(ql),Nl=Ol(Vl),Pl=Ol(Nl),Ll=(e,t)=>{var l;return null!=(l=null==e?void 0:e.has(t))&&l},Rl=e=>pe(e)||0==ql(e),El=e=>{var t;return[...null!=(t=null==e?void 0:e.values())?t:[]]},jl=e=>e.clear(),Ml=(e,t)=>null==e?void 0:e.forEach(t),zl=(e,t)=>null==e?void 0:e.delete(t),$l=e=>new Map(e),Al=e=>{var t;return[...null!=(t=null==e?void 0:e.keys())?t:[]]},Fl=(e,t)=>null==e?void 0:e.get(t),Jl=(e,t)=>Ml(e,((e,l)=>t(l,e))),Dl=(e,t,l)=>pe(l)?(zl(e,t),e):null==e?void 0:e.set(t,l),Bl=(e,t,l)=>(Ll(e,t)||Dl(e,t,l()),Fl(e,t)),Wl=(e,t,l,n=Dl)=>(De(t,((t,n)=>l(e,n,t))),Jl(e,(l=>Fe(t,l)?0:n(e,l))),e),Hl=(e,t,l)=>{const n={};return Ml(e,((e,r)=>{const o=t?t(e,r):e;!(null==l?void 0:l(o,e))&&(n[r]=o)})),n},Ql=(e,t,l)=>Hl(e,(e=>Hl(e,t,l)),Be),Gl=(e,t,l)=>Hl(e,(e=>Ql(e,t,l)),Be),Kl=(e,t)=>{const l=$l();return Ml(e,((e,n)=>{var r;return l.set(n,null!=(r=null==t?void 0:t(e))?r:e)})),l},Ul=e=>Kl(e,Kl),Xl=e=>Kl(e,Ul),Yl=(e,t,l,n,r=0)=>ve((l?Bl:Fl)(e,t[r],r>Ie(t)-2?l:$l),(o=>{if(r>Ie(t)-2)return(null==n?void 0:n(o))&&Dl(e,t[r]),o;const s=Yl(o,t,l,n,r+1);return Rl(o)&&Dl(e,t[r]),s}));var Zl=(e,t,l)=>new Promise(((n,r)=>{var o=e=>{try{a(l.next(e))}catch(e){r(e)}},s=e=>{try{a(l.throw(e))}catch(e){r(e)}},a=e=>e.done?n(e.value):Promise.resolve(e.value).then(o,s);a((l=l.apply(e,t)).next())}));const _l=$l(),en=$l();var tn=(e,t,l)=>new Promise(((n,r)=>{var o=e=>{try{a(l.next(e))}catch(e){r(e)}},s=e=>{try{a(l.throw(e))}catch(e){r(e)}},a=e=>e.done?n(e.value):Promise.resolve(e.value).then(o,s);a((l=l.apply(e,t)).next())}));const ln="storage",nn=globalThis.window,rn=e=>new Set(fe(e)||pe(e)?e:[e]),on=(e,t)=>null==e?void 0:e.add(t),sn=/^\d+$/,an=()=>{const e=[];let t=0;return[l=>{var n;return null!=(n=l?Re(e):null)?n:B+t++},t=>{sn.test(t)&&Ie(e)<1e3&&Le(e,t)}]},dn=e=>[e,e],un=(e,t=Vl)=>t(e[0])+t(e[1]),cn=()=>[$l(),$l()],hn=e=>[...e],mn=([e,t])=>e===t,pn=(e,t,l)=>pe(e)||!$e(e)||Be(e)||Me(e)?(null==l||l(),!1):(De(e,((l,n)=>{t(l,n)||Je(e,n)})),!Be(e)),vn=(e,t,l)=>Dl(e,t,Fl(e,t)==-l?void 0:l),bn=()=>{let e,t,l=!1,n=!1,r=0;const o=$l(),s=$l(),a=$l(),i=$l(),d=$l(),u=$l(),c=$l(),h=$l(),m=$l(),p=$l(),v=$l(),b=$l(),g=$l(),f=$l(),y=rn(),I=$l(),w=$l(),C=$l(),k=$l(),x=cn(),T=cn(),S=cn(),O=cn(),q=cn(),V=cn(),N=cn(),P=cn(),L=cn(),R=cn(),E=cn(),j=cn(),M=cn(),z=cn(),$=cn(),A=$l(),F=cn(),[J,D,W,H]=(e=>{let t;const[l,n]=an(),r=$l();return[(e,n,o,s=[],a=(()=>[]))=>{null!=t||(t=At);const i=l(1);return Dl(r,i,[e,n,o,s,a]),on(Yl(n,null!=o?o:[B],rn),i),i},(e,l,...n)=>Ve(((e,t=[B])=>{const l=[],n=(e,r)=>r==Ie(t)?Le(l,e):null===t[r]?Ml(e,(e=>n(e,r+1))):Ve([t[r],null],(t=>n(Fl(e,t),r+1)));return n(e,0),l})(e,l),(e=>Ml(e,(e=>Fl(r,e)[0](t,...null!=l?l:[],...n))))),e=>ve(Fl(r,e),(([,t,l])=>(Yl(t,null!=l?l:[B],void 0,(t=>(zl(t,e),Rl(t)?1:0))),Dl(r,e),n(e),l))),e=>ve(Fl(r,e),(([e,,l=[],n,r])=>{const o=(...s)=>{var a,i;const d=Ie(s);d==Ie(l)?e(t,...s,...r(s)):pe(l[d])?Ve(null!=(i=null==(a=n[d])?void 0:a.call(n,...s))?i:[],(e=>o(...s,e))):o(...s,l[d])};o()}))]})(),G=e=>{if(!pn(e,((e,t)=>[K,U].includes(t))))return!1;const t=e[K];return!(!be(t)&&t!=Q||(St(e[U])!=t&&Je(e,U),0))},X=(t,l)=>(!e||Ll(v,l)||et(l))&&pn(t,((e,t)=>ie(l,t,e)),(()=>et(l))),ie=(e,t,l,n)=>pn(n?l:me(l,e,t),((n,r)=>ve(de(e,t,r,n),(e=>(l[r]=e,!0)),(()=>!1))),(()=>et(e,t))),de=(t,l,n,r)=>e?ve(Fl(Fl(v,t),n),(e=>St(r)!=e[K]?et(t,l,n,r,e[U]):r),(()=>et(t,l,n,r))):pe(St(r))?et(t,l,n,r):r,ce=(e,t)=>pn(t?e:fe(e),((t,l)=>ve(he(l,t),(t=>(e[l]=t,!0)),(()=>!1))),(()=>tt())),he=(e,l)=>t?ve(Fl(g,e),(t=>St(l)!=t[K]?tt(e,l,t[U]):l),(()=>tt(e,l))):pe(St(l))?tt(e,l):l,me=(e,t,l)=>(ve(Fl(b,t),(([n,r])=>{Ml(n,((t,l)=>{Fe(e,l)||(e[l]=t)})),Ml(r,(n=>{Fe(e,n)||et(t,l,n)}))})),e),fe=e=>(t&&(Ml(f,((t,l)=>{Fe(e,l)||(e[l]=t)})),Ml(y,(t=>{Fe(e,t)||tt(t)}))),e),we=e=>Wl(v,e,((e,t,l)=>{const n=$l(),r=rn();Wl(Bl(v,t,$l),l,((e,t,l)=>{Dl(e,t,l),ve(l[U],(e=>Dl(n,t,e)),(()=>on(r,t)))})),Dl(b,t,[n,r])}),((e,t)=>{Dl(v,t),Dl(b,t)})),Ce=e=>Wl(g,e,((e,t,l)=>{Dl(g,t,l),ve(l[U],(e=>Dl(f,t,e)),(()=>on(y,t)))}),((e,t)=>{Dl(g,t),Dl(f,t),zl(y,t)})),ke=e=>Be(e)?Nt():Ct(e),xe=e=>Wl(C,e,((e,t,l)=>Te(t,l)),((e,t)=>$e(t))),Te=(e,t)=>Wl(Bl(C,e,(()=>(Ke(e,1),Dl(I,e,an()),Dl(w,e,$l()),$l()))),t,((t,l,n)=>Se(e,t,l,n)),((t,l)=>Ae(e,t,l))),Se=(e,t,l,n,r)=>Wl(Bl(t,l,(()=>(Ue(e,l,1),$l()))),n,((t,n,r)=>Oe(e,l,t,n,r)),((n,o)=>Qe(e,t,l,n,o,r))),Oe=(e,t,l,n,r)=>{Ll(l,n)||Xe(e,t,n,1);const o=Fl(l,n);r!==o&&(Ye(e,t,n,o,r),Dl(l,n,r))},qe=(e,t,l,n,r)=>ve(Fl(t,l),(t=>Oe(e,l,t,n,r)),(()=>Se(e,t,l,me({[n]:r},e,l)))),Pe=e=>Be(e)?Rt():kt(e),Re=e=>Wl(k,e,((e,t,l)=>Ee(t,l)),((e,t)=>Ge(t))),Ee=(e,t)=>{Ll(k,e)||Ze(e,1);const l=Fl(k,e);t!==l&&(_e(e,l,t),Dl(k,e,t))},je=(e,t)=>{const[l]=Fl(I,e),n=l(t);return Ll(Fl(C,e),n)?je(e,t):n},Me=e=>{var t;return null!=(t=Fl(C,e))?t:Te(e,{})},$e=e=>Te(e,{}),Ae=(e,t,l)=>{const[,n]=Fl(I,e);n(l),Se(e,t,l,{},!0)},Qe=(e,t,l,n,r,o)=>{var s;const a=Fl(null==(s=Fl(b,e))?void 0:s[0],r);if(!pe(a)&&!o)return Oe(e,l,n,r,a);const i=t=>{Ye(e,l,t,Fl(n,t)),Xe(e,l,t,-1),Dl(n,t)};pe(a)?i(r):Jl(n,i),Rl(n)&&(Ue(e,l,-1),Rl(Dl(t,l))&&(Ke(e,-1),Dl(C,e),Dl(I,e),Dl(w,e)))},Ge=e=>{const t=Fl(f,e);if(!pe(t))return Ee(e,t);_e(e,Fl(k,e)),Ze(e,-1),Dl(k,e)},Ke=(e,t)=>vn(o,e,t),Ue=(e,t,l)=>vn(Bl(i,e,$l),t,l)&&Dl(a,e,Bl(a,e,(()=>0))+l),Xe=(e,t,l,n)=>{var r;const o=Fl(w,e),a=null!=(r=Fl(o,l))?r:0;(0==a&&1==n||1==a&&-1==n)&&vn(Bl(s,e,$l),l,n),Dl(o,l,a!=-n?a+n:null),vn(Bl(Bl(d,e,$l),t,$l),l,n)},Ye=(e,t,l,n,r)=>Bl(Bl(Bl(u,e,$l),t,$l),l,(()=>[n,0]))[1]=r,Ze=(e,t)=>vn(c,e,t),_e=(e,t,l)=>Bl(h,e,(()=>[t,0]))[1]=l,et=(e,t,l,n,r)=>(Le(Bl(Bl(Bl(m,e,$l),t,$l),l,(()=>[])),n),r),tt=(e,t,l)=>(Le(Bl(p,e,(()=>[])),t),l),lt=(e,t,l)=>ve(Fl(Fl(Fl(u,e),t),l),(([e,t])=>[!0,e,t]),(()=>[!1,...dn(ft(e,t,l))])),nt=e=>ve(Fl(h,e),(([e,t])=>[!0,e,t]),(()=>[!1,...dn(wt(e))])),rt=e=>Rl(m)||Rl(E[e])?0:Ml(e?Xl(m):m,((t,l)=>Ml(t,((t,n)=>Ml(t,((t,r)=>D(E[e],[l,n,r],t))))))),ot=e=>Rl(p)||Rl(j[e])?0:Ml(e?Kl(p):p,((t,l)=>D(j[e],[l],t))),st=(e,t,l)=>{if(!Rl(t))return D(e,l,(()=>Hl(t))),1},at=e=>{const t=Rl(N[e]),l=Rl(L[e])&&Rl(O[e])&&Rl(q[e])&&Rl(V[e])&&t&&Rl(T[e]),n=Rl(R[e])&&Rl(P[e])&&Rl(S[e])&&Rl(x[e]);if(!l||!n){const r=e?[Kl(o),Ul(s),Kl(a),Ul(i),Xl(d),Xl(u)]:[o,s,a,i,d,u];if(!l){st(T[e],r[0]),Ml(r[1],((t,l)=>st(O[e],t,[l]))),Ml(r[2],((t,l)=>{0!=t&&D(q[e],[l],pt(l))}));const l=rn();Ml(r[3],((n,r)=>{st(V[e],n,[r])&&!t&&(D(N[e],[r,null]),on(l,r))})),t||Ml(r[5],((t,n)=>{if(!Ll(l,n)){const l=rn();Ml(t,(e=>Ml(e,(([t,n],r)=>n!==t?on(l,r):zl(e,r))))),Ml(l,(t=>D(N[e],[n,t])))}})),Ml(r[4],((t,l)=>Ml(t,((t,n)=>st(L[e],t,[l,n])))))}if(!n){let t;Ml(r[5],((l,n)=>{let r;Ml(l,((l,o)=>{let s;Ml(l,(([l,a],i)=>{a!==l&&(D(R[e],[n,o,i],a,l,lt),t=r=s=1)})),s&&D(P[e],[n,o],lt)})),r&&D(S[e],[n],lt)})),t&&D(x[e],void 0,lt)}}},it=e=>{const t=Rl(z[e]),l=Rl($[e])&&Rl(M[e]);if(!t||!l){const n=e?[Kl(c),Kl(h)]:[c,h];if(t||st(z[e],n[0]),!l){let t;Ml(n[1],(([l,n],r)=>{n!==l&&(D($[e],[r],n,l,nt),t=1)})),t&&D(M[e],void 0,nt)}}},dt=(e,...t)=>(Mt((()=>e(...Ne(t,ue)))),At),ut=()=>[Hl(u,((e,t)=>-1===Fl(o,t)?null:Hl(e,((e,l)=>-1===Fl(Fl(i,t),l)?null:Hl(e,(([,e])=>null!=e?e:null),((e,t)=>mn(t)))),Be)),Be),Hl(h,(([,e])=>null!=e?e:null),((e,t)=>mn(t)))],ct=()=>({cellsTouched:l,valuesTouched:n,changedCells:Gl(u,hn,mn),invalidCells:Gl(m),changedValues:Hl(h,hn,mn),invalidValues:Hl(p),changedTableIds:Hl(o),changedRowIds:Ql(i),changedCellIds:Gl(d),changedValueIds:Hl(c)}),ht=()=>Gl(C),mt=()=>Al(C),pt=e=>ql(Fl(C,ue(e))),vt=e=>Al(Fl(C,ue(e))),bt=(e,t,l,n=0,r)=>{return Ne(ye((s=Fl(C,ue(e)),a=(e,l)=>[pe(t)?l:Fl(e,ue(t)),l],o=([e],[t])=>{return((null!=(n=e)?n:0)<(null!=(r=t)?r:0)?-1:1)*(l?-1:1);var n,r},Ne([...null!=(i=null==s?void 0:s.entries())?i:[]],(([e,t])=>a(t,e))).sort(o)),n,pe(r)?r:n+r),(([,e])=>e));var o,s,a,i},gt=(e,t)=>Al(Fl(Fl(C,ue(e)),ue(t))),ft=(e,t,l)=>Fl(Fl(Fl(C,ue(e)),ue(t)),ue(l)),yt=()=>Hl(k),It=()=>Al(k),wt=e=>Fl(k,ue(e)),Ct=e=>dt((()=>(e=>pn(e,X,et))(e)?xe(e):0)),kt=e=>dt((()=>ce(e)?Re(e):0)),xt=e=>{try{ke(He(e))}catch(e){}return At},Tt=t=>dt((()=>{if((e=pn(t,(e=>pn(e,G))))&&(we(t),!Rl(C))){const e=ht();Nt(),Ct(e)}})),Vt=e=>dt((()=>{if(t=(e=>pn(e,G))(e)){const l=yt();jt(),Rt(),t=!0,Ce(e),kt(l)}})),Nt=()=>dt((()=>xe({}))),Pt=e=>dt((e=>Ll(C,e)?$e(e):0),e),Lt=(e,t)=>dt(((e,t)=>ve(Fl(C,e),(l=>Ll(l,t)?Ae(e,l,t):0))),e,t),Rt=()=>dt((()=>Re({}))),Et=()=>dt((()=>{we({}),e=!1})),jt=()=>dt((()=>{Ce({}),t=!1})),Mt=(e,t)=>{if(-1!=r){zt();const l=e();return $t(t),l}},zt=()=>(-1!=r&&r++,1==r&&D(A,void 0,ut,ct),At),$t=e=>(r>0&&(r--,0==r&&(l=!Rl(u),n=!Rl(h),r=1,rt(1),l&&at(1),ot(1),n&&it(1),(null==e?void 0:e(ut,ct))&&(Ml(u,((e,t)=>Ml(e,((e,l)=>Ml(e,(([e],n)=>Ot(At,t,l,n,e))))))),Ml(h,(([e],t)=>qt(At,t,e))),l=n=!1),D(F[0],void 0,ut,ct),r=-1,rt(0),l&&at(0),ot(0),n&&it(0),D(F[1],void 0,ut,ct),r=0,l=n=!1,Ve([o,s,a,i,d,u,m,c,h,p],jl))),At),At={getContent:()=>[ht(),yt()],getTables:ht,getTableIds:mt,getTable:e=>Ql(Fl(C,ue(e))),getTableCellIds:e=>Al(Fl(w,ue(e))),getRowCount:pt,getRowIds:vt,getSortedRowIds:bt,getRow:(e,t)=>Hl(Fl(Fl(C,ue(e)),ue(t))),getCellIds:gt,getCell:ft,getValues:yt,getValueIds:It,getValue:wt,hasTables:()=>!Rl(C),hasTable:e=>Ll(C,ue(e)),hasTableCell:(e,t)=>Ll(Fl(w,ue(e)),ue(t)),hasRow:(e,t)=>Ll(Fl(C,ue(e)),ue(t)),hasCell:(e,t,l)=>Ll(Fl(Fl(C,ue(e)),ue(t)),ue(l)),hasValues:()=>!Rl(k),hasValue:e=>Ll(k,ue(e)),getTablesJson:()=>We(C),getValuesJson:()=>We(k),getJson:()=>We([C,k]),getTablesSchemaJson:()=>We(v),getValuesSchemaJson:()=>We(g),getSchemaJson:()=>We([v,g]),hasTablesSchema:()=>e,hasValuesSchema:()=>t,setContent:([e,t])=>dt((()=>{(Be(e)?Nt:Ct)(e),(Be(t)?Rt:kt)(t)})),setTables:Ct,setTable:(e,t)=>dt((e=>X(t,e)?Te(e,t):0),e),setRow:(e,t,l)=>dt(((e,t)=>ie(e,t,l)?Se(e,Me(e),t,l):0),e,t),addRow:(e,t,l=!0)=>Mt((()=>{let n;return ie(e,n,t)&&(e=ue(e),Se(e,Me(e),n=je(e,l?1:0),t)),n})),setPartialRow:(e,t,l)=>dt(((e,t)=>{if(ie(e,t,l,1)){const n=Me(e);De(l,((l,r)=>qe(e,n,t,r,l)))}}),e,t),setCell:(e,t,l,n)=>dt(((e,t,l)=>ve(de(e,t,l,ge(n)?n(ft(e,t,l)):n),(n=>qe(e,Me(e),t,l,n)))),e,t,l),setValues:kt,setPartialValues:e=>dt((()=>ce(e,1)?De(e,((e,t)=>Ee(t,e))):0)),setValue:(e,t)=>dt((e=>ve(he(e,ge(t)?t(wt(e)):t),(t=>Ee(e,t)))),e),setTransactionChanges:e=>dt((()=>{De(e[0],((e,t)=>pe(e)?Pt(t):De(e,((e,l)=>pe(e)?Lt(t,l):De(e,((e,n)=>Ot(At,t,l,n,e))))))),De(e[1],((e,t)=>qt(At,t,e)))})),setTablesJson:xt,setValuesJson:e=>{try{Pe(He(e))}catch(e){}return At},setJson:e=>dt((()=>{try{const[t,l]=He(e);ke(t),Pe(l)}catch(t){xt(e)}})),setTablesSchema:Tt,setValuesSchema:Vt,setSchema:(e,t)=>dt((()=>{Tt(e),Vt(t)})),delTables:Nt,delTable:Pt,delRow:Lt,delCell:(e,t,l,n)=>dt(((e,t,l)=>ve(Fl(C,e),(r=>ve(Fl(r,t),(o=>Ll(o,l)?Qe(e,r,t,o,l,n):0))))),e,t,l),delValues:Rt,delValue:e=>dt((e=>Ll(k,e)?Ge(e):0),e),delTablesSchema:Et,delValuesSchema:jt,delSchema:()=>dt((()=>{Et(),jt()})),transaction:Mt,startTransaction:zt,finishTransaction:$t,forEachTable:e=>Ml(C,((t,l)=>e(l,(e=>Ml(t,((t,l)=>e(l,(e=>Jl(t,e))))))))),forEachTableCell:(e,t)=>Jl(Fl(w,ue(e)),t),forEachRow:(e,t)=>Ml(Fl(C,ue(e)),((e,l)=>t(l,(t=>Jl(e,t))))),forEachCell:(e,t,l)=>Jl(Fl(Fl(C,ue(e)),ue(t)),l),forEachValue:e=>Jl(k,e),addSortedRowIdsListener:(e,t,l,n,r,o,s)=>{let a=bt(e,t,l,n,r);return J((()=>{const s=bt(e,t,l,n,r);var i,d,u;d=a,Ie(i=s)===Ie(d)&&(u=(e,t)=>d[t]===e,i.every(u))||(a=s,o(At,e,t,l,n,r,a))}),N[s?1:0],[e,t],[mt])},addStartTransactionListener:e=>J(e,A),addWillFinishTransactionListener:e=>J(e,F[0]),addDidFinishTransactionListener:e=>J(e,F[1]),callListener:e=>(H(e),At),delListener:e=>(W(e),At),getListenerStats:()=>({tables:un(x),tableIds:un(T),tableCellIds:un(O),table:un(S),rowCount:un(q),rowIds:un(V),sortedRowIds:un(N),row:un(P,Nl),cellIds:un(L,Nl),cell:un(R,Pl),invalidCell:un(E,Pl),values:un(M),valueIds:un(z),value:un($),invalidValue:un(j),transaction:Vl(A)+un(F)}),createStore:bn,addListener:J,callListeners:D};return De({[Z]:[0,x],[_]:[0,T],[Y]:[1,S,[mt]],[Y+re]:[1,O,[mt]],[te]:[1,q,[mt]],[le]:[1,V,[mt]],[ee]:[2,P,[mt,vt]],[re]:[2,L,[mt,vt]],[ne]:[3,R,[mt,vt,gt],e=>dn(ft(...e))],InvalidCell:[3,E],[se]:[0,M],[ae]:[0,z],[oe]:[1,$,[It],e=>dn(wt(e[0]))],InvalidValue:[1,j]},(([e,t,l,n],r)=>{At["add"+r+"Listener"]=(...r)=>J(r[e],t[r[e+1]?1:0],e>0?ye(r,0,e):void 0,l,n)})),ze(At)},gn=({position:e="right",open:t=!1})=>{const l=F(bn),n=Ke.indexOf(e);return J(l,(e=>{return((e,t,l,n)=>((e,t,l,n,r,o,s=[])=>{let a,i,d,u=0,c=0,h=0,m=0;Bl(_l,s,(()=>0)),Bl(en,s,(()=>[]));const p=e=>Zl(void 0,null,(function*(){return 2!=u&&(u=1,c++,yield v.schedule((()=>Zl(void 0,null,(function*(){yield e(),u=0}))))),v})),v={load:(l,n)=>Zl(void 0,null,(function*(){return yield p((()=>Zl(void 0,null,(function*(){try{e.setContent(yield t())}catch(t){e.setContent([l,n])}}))))})),startAutoLoad:(...l)=>Zl(void 0,[...l],(function*(l={},r={}){return v.stopAutoLoad(),yield v.load(l,r),m=1,d=n(((l,n)=>Zl(void 0,null,(function*(){if(n){const t=n();yield p((()=>Zl(void 0,null,(function*(){return e.setTransactionChanges(t)}))))}else yield p((()=>Zl(void 0,null,(function*(){var n;try{e.setContent(null!=(n=null==l?void 0:l())?n:yield t())}catch(e){null==o||o(e)}}))))})))),v})),stopAutoLoad:()=>(m&&(r(d),d=void 0,m=0),v),save:t=>Zl(void 0,null,(function*(){return 1!=u&&(u=2,h++,yield v.schedule((()=>Zl(void 0,null,(function*(){try{yield l(e.getContent,t)}catch(e){null==o||o(e)}u=0}))))),v})),startAutoSave:()=>Zl(void 0,null,(function*(){return yield v.stopAutoSave().save(),a=e.addDidFinishTransactionListener(((e,t)=>{const[l,n]=t();Be(l)&&Be(n)||v.save((()=>[l,n]))})),v})),stopAutoSave:()=>(ve(a,e.delListener),v),schedule:(...e)=>Zl(void 0,null,(function*(){return Le(Fl(en,s),...e),yield Zl(void 0,null,(function*(){if(!Fl(_l,s)){for(Dl(_l,s,1);!pe(i=Re(Fl(en,s)));)try{yield i()}catch(e){null==o||o(e)}Dl(_l,s,0)}})),v})),getStore:()=>e,destroy:()=>v.stopAutoLoad().stopAutoSave(),getStats:()=>({loads:c,saves:h})};return ze(v)})(e,(()=>tn(void 0,null,(function*(){return He(l.getItem(t))}))),(e=>tn(void 0,null,(function*(){return l.setItem(t,We(e()))}))),(e=>{const n=n=>{n.storageArea===l&&n.key===t&&e((()=>He(n.newValue)))};return nn.addEventListener(ln,n),n}),(e=>nn.removeEventListener(ln,e)),n))(e,Qe,sessionStorage,t);var t}),void 0,(e=>{return l=function*(){yield e.load(void 0,{position:-1==n?1:n,open:!!t}),yield e.startAutoSave()},new Promise(((e,t)=>{var n=e=>{try{o(l.next(e))}catch(e){t(e)}},r=e=>{try{o(l.throw(e))}catch(e){t(e)}},o=t=>t.done?e(t.value):Promise.resolve(t.value).then(n,r);o((l=l.apply(void 0,null)).next())}));var l})),ke(Ce,null,ke("aside",{id:Qe},ke(xt,{s:l}),ke(Sl,{s:l})),ke("style",null,kt))};var fn=Object.defineProperty,yn=Object.getOwnPropertySymbols,In=Object.prototype.hasOwnProperty,wn=Object.prototype.propertyIsEnumerable,Cn=(e,t,l)=>t in e?fn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l;const kn=e=>ke(gn,((e,t)=>{for(var l in t||(t={}))In.call(t,l)&&Cn(e,l,t[l]);if(yn)for(var l of yn(t))wn.call(t,l)&&Cn(e,l,t[l]);return e})({},e));export{il as EditableCellView,dl as EditableValueView,ol as RelationshipInHtmlTable,al as ResultSortedTableInHtmlTable,sl as ResultTableInHtmlTable,rl as SliceInHtmlTable,ll as SortedTableInHtmlTable,ul as SortedTablePaginator,kn as StoreInspector,tl as TableInHtmlTable,nl as ValuesInHtmlTable};
Binary file
@@ -1 +1 @@
1
- import e from"react";import{useRowIds as t,useTableCellIds as l,useRowCount as r,useSortedRowIds as n,useValueIds as o,ValueView as a,useIndexesOrIndexesById as i,useSliceRowIds as s,useRelationshipsOrRelationshipsById as d,useResultRowIds as c,useResultTableCellIds as u,useResultRowCount as m,useResultSortedRowIds as h,useCell as p,useSetCellCallback as g,useStoreOrStoreById as b,useValue as f,useSetValueCallback as v,useRemoteRowId as w,CellView as y,ResultCellView as k}from"./ui-react";const C=e=>typeof e,I=C(""),x=C(!0),O=C(0),N="Value",j="currentTarget",P="value",z=isFinite,S=e=>null==e,{PureComponent:M,Fragment:$,createElement:q,useCallback:T,useLayoutEffect:F,useRef:R,useState:E}=e,D=(e,...t)=>S(e)?{}:e(...t),V=(e,t)=>e.map(t),A=Object,B=(e=[])=>A.fromEntries(e),L=(e,t)=>V(A.entries(e),(([e,l])=>t(l,e))),G="M20 80l5-15l40-40l10 10l-40 40l-15 5m5-15l10 10",H='content:url("',J=H+"data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' stroke-width='4' stroke='white' fill='none'>",K='</svg>")',Q=H+"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\")",U=V([[20,20,20,60],[20,20,60,20],[20,60,60,20],[60,20,20,60],[30,30,40,40]],(([e,t,l,r])=>J+`<rect x='20' y='20' width='60' height='60' fill='grey'/><rect x='${e}' y='${t}' width='${l}' height='${r}' fill='white'/>`+K)),W=J+"<path d='M20 20l60 60M20 80l60-60' />"+K,X=J+`<path d='${G}' />`+K,Y=J+`<path d='${G}M20 20l60 60' />`+K;var Z=Object.defineProperty,_=Object.defineProperties,ee=Object.getOwnPropertyDescriptors,te=Object.getOwnPropertySymbols,le=Object.prototype.hasOwnProperty,re=Object.prototype.propertyIsEnumerable,ne=(e,t,l)=>t in e?Z(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l,oe=(e,t)=>{for(var l in t||(t={}))le.call(t,l)&&ne(e,l,t[l]);if(te)for(var l of te(t))re.call(t,l)&&ne(e,l,t[l]);return e},ae=(e,t)=>_(e,ee(t));const ie="*::-webkit-scrollbar";((e,t="")=>{e.join(t)})(L(ae(oe(ae(oe(ae(oe({"*":"all:revert","*::before":"all:revert","*::after":"all:revert",[ie]:"width:0.5rem;height:0.5rem;",[ie+"-track"]:"background:#111",[ie+"-thumb"]:"background:#999;border:1px solid #111",[ie+"-thumb:hover"]:"background:#fff",[ie+"-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;"+Q},B(V(["bottom:0;left:0","top:0;right:0"],((e,t)=>[`>img[data-position='${t}']`,e])))),{main:"display:flex;flex-direction:column;background:#111d;color:#fff;position:fixed;"}),B(V(["bottom:0;left:0;width:35vw;height:100vh","top:0;right:0;width:100vw;height:30vh","bottom:0;left:0;width:100vw;height:30vh","top:0;right:0;width:35vw;height:100vh","top:0;right:0;width:100vw;height:100vh"],((e,t)=>[`main[data-position='${t}']`,e])))),{header:"display:flex;padding:0.25rem;background:#000;align-items:center","header>img:nth-of-type(1)":Q,"header>img:nth-of-type(6)":W}),B(V(U,((e,t)=>[`header>img[data-id='${t}']`,e])))),{"header>span":"flex:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;margin-left:0.25rem",article:"padding:0.25rem 0.25rem 0.25rem 0.5rem;overflow:auto;flex:1",details:"margin-left:0.75rem;width:fit-content;","details img":"display:none","details[open]>summary img":"display:unset;background:none;margin-left:0.25rem","details[open]>summary img.edit":X,"details[open]>summary img.done":Y,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,t)=>e?`& ${t}{${e}}`:"")));const se=(e,t,l,r)=>e==I?t:e==O?l:r;var de=Object.defineProperty,ce=Object.defineProperties,ue=Object.getOwnPropertyDescriptors,me=Object.getOwnPropertySymbols,he=Object.prototype.hasOwnProperty,pe=Object.prototype.propertyIsEnumerable,ge=(e,t,l)=>t in e?de(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l,be=(e,t)=>{for(var l in t||(t={}))he.call(t,l)&&ge(e,l,t[l]);if(me)for(var l of me(t))pe.call(t,l)&&ge(e,l,t[l]);return e},fe=(e,t)=>ce(e,ue(t)),ve=(e,t)=>{var l={};for(var r in e)he.call(e,r)&&t.indexOf(r)<0&&(l[r]=e[r]);if(null!=e&&me)for(var r of me(e))t.indexOf(r)<0&&pe.call(e,r)&&(l[r]=e[r]);return l};const{useCallback:we,useMemo:ye,useState:ke}=e,Ce="editable",Ie=(e,t)=>V(l(e,t),(t=>e+"."+t)),xe=(e,t,l)=>{const r=we(e,t);return l?r:void 0},Oe=(...e)=>ye((()=>e),e),Ne=(e,t)=>ye((()=>({store:e,tableId:t})),[e,t]),je=(e,t)=>ye((()=>({queries:e,queryId:t})),[e,t]),Pe=(e,t=!1,l,r=0,n,o,a,i)=>{const[[s,d,c],u]=ke([e,t,r]),m=we((e=>{u(e),null==i||i(e)}),[i]),h=xe((e=>m([e,e==s&&!d,c])),[m,s,d,c],l),p=we((e=>m([s,d,e])),[m,s,d]),g=!0===a?Ge:a;return[[s,d,c],h,ye((()=>!1===a?null:q(g,{offset:c,limit:n,total:o,onChange:p})),[a,g,c,n,o,p])]},ze=(e,t,l)=>ye((()=>{const r=null!=t?t:e;return B(L(Array.isArray(r)?B(V(r,(e=>[e,e]))):r,((e,t)=>{return[t,be(be({},{label:t,component:l}),(r=e,C(r)==I?{label:e}:e))];var r})))}),[t,l,e]),Se=({className:e,headerRow:t,idColumn:l,params:[r,n,o,a,i,s]})=>q("table",{className:e},s?q("caption",null,s):null,!1===t?null:q("thead",null,q("tr",null,!1===l?null:q(Me,{sort:null!=a?a:[],label:"Id",onClick:i}),L(r,(({label:e},t)=>q(Me,{key:t,cellId:t,label:e,sort:null!=a?a:[],onClick:i}))))),q("tbody",null,V(o,(e=>q("tr",{key:e},!1===l?null:q("th",null,e),L(r,(({component:t,getComponentProps:l},r)=>q("td",{key:r},q(t,fe(be(be({},D(l,e,r)),n),{rowId:e,cellId:r})))))))))),Me=({cellId:e,sort:[t,l],label:r=(null!=e?e:""),onClick:n})=>q("th",{onClick:xe((()=>null==n?void 0:n(e)),[n,e],n),className:S(l)||t!=e?void 0:`sorted ${l?"de":"a"}scending`},S(l)||t!=e?null:(l?"↓":"↑")+" ",r),$e=({localRowId:t,params:[l,r,n,o,a,i,s]})=>{const d=w(a,t,i);return q("tr",null,!1===l?null:q(e.Fragment,null,q("th",null,t),q("th",null,d)),L(r,(({component:e,getComponentProps:l},r)=>{const[a,i]=r.split(".",2),c=a===n?t:a===o?d:null;return S(c)?null:q("td",{key:r},q(e,fe(be({},D(l,c,i)),{store:s,tableId:a,rowId:c,cellId:i})))})))},qe=({thing:e,onThingChange:t,className:l,hasSchema:r})=>{const[n,o]=ke(),[a,i]=ke(),[s,d]=ke(),[c,u]=ke(),[m,h]=ke();a!==e&&(o((e=>{const t=C(e);return(e=>e==I||e==x)(t)||t==O&&z(e)?t:void 0})(e)),i(e),d(e+""),u(Number(e)||0),h(!!e));const p=we(((e,l)=>{l(e),i(e),t(e)}),[t]);return q("div",{className:l},q("button",{className:n,onClick:we((()=>{if(!(null==r?void 0:r())){const e=se(n,O,x,I),l=se(e,s,c,m);o(e),i(l),t(l)}}),[r,t,s,c,m,n])},n),se(n,q("input",{key:n,value:s,onChange:we((e=>p(e[j][P]+"",d)),[p])}),q("input",{key:n,type:"number",value:c,onChange:we((e=>p(Number(e[j][P]||0),u)),[p])}),q("input",{key:n,type:"checkbox",checked:m,onChange:we((e=>p(!!e[j].checked,h)),[p])})))},Te=e=>{var r=e,{tableId:n,store:o,editable:a,customCells:i}=r,s=ve(r,["tableId","store","editable","customCells"]);return q(Se,fe(be({},s),{params:Oe(ze(l(n,o),i,a?Be:y),Ne(o,n),t(n,o))}))},Fe=e=>{var t=e,{tableId:o,cellId:a,descending:i,offset:s,limit:d,store:c,editable:u,sortOnClick:m,paginator:h=!1,onChange:p,customCells:g}=t,b=ve(t,["tableId","cellId","descending","offset","limit","store","editable","sortOnClick","paginator","onChange","customCells"]);const[f,v,w]=Pe(a,i,m,s,d,r(o,c),h,p);return q(Se,fe(be({},b),{params:Oe(ze(l(o,c),g,u?Be:y),Ne(c,o),n(o,...f,d,c),f,v,w)}))},Re=({store:e,editable:t=!1,valueComponent:l=(t?Le:a),getValueComponentProps:r,className:n,headerRow:i,idColumn:s})=>q("table",{className:n},!1===i?null:q("thead",null,q("tr",null,!1===s?null:q("th",null,"Id"),q("th",null,N))),q("tbody",null,V(o(e),(t=>q("tr",{key:t},!1===s?null:q("th",null,t),q("td",null,q(l,fe(be({},D(r,t)),{valueId:t,store:e})))))))),Ee=e=>{var t=e,{indexId:r,sliceId:n,indexes:o,editable:a,customCells:d}=t,c=ve(t,["indexId","sliceId","indexes","editable","customCells"]);const[u,m,h]=((e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getTableId(t)])(i(o),r);return q(Se,fe(be({},c),{params:Oe(ze(l(h,m),d,a?Be:y),Ne(m,h),s(r,n,u))}))},De=({relationshipId:l,relationships:r,editable:n,customCells:o,className:a,headerRow:i,idColumn:s=!0})=>{const[c,u,m,h]=((e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(t),null==e?void 0:e.getRemoteTableId(t)])(d(r),l),p=ze([...Ie(m,u),...Ie(h,u)],o,n?Be:y),g=Oe(s,p,m,h,l,c,u);return q("table",{className:a},!1===i?null:q("thead",null,q("tr",null,!1===s?null:q(e.Fragment,null,q("th",null,m,".Id"),q("th",null,h,".Id")),L(p,(({label:e},t)=>q("th",{key:t},e))))),q("tbody",null,V(t(m,u),(e=>q($e,{key:e,localRowId:e,params:g})))))},Ve=e=>{var t=e,{queryId:l,queries:r,customCells:n}=t,o=ve(t,["queryId","queries","customCells"]);return q(Se,fe(be({},o),{params:Oe(ze(u(l,r),n,k),je(r,l),c(l,r))}))},Ae=e=>{var t=e,{queryId:l,cellId:r,descending:n,offset:o,limit:a,queries:i,sortOnClick:s,paginator:d=!1,customCells:c,onChange:p}=t,g=ve(t,["queryId","cellId","descending","offset","limit","queries","sortOnClick","paginator","customCells","onChange"]);const[b,f,v]=Pe(r,n,s,o,a,m(l,i),d,p);return q(Se,fe(be({},g),{params:Oe(ze(u(l,i),c,k),je(i,l),h(l,...b,a,i),b,f,v)}))},Be=({tableId:e,rowId:t,cellId:l,store:r,className:n})=>{var o;return q(qe,{thing:p(e,t,l,r),onThingChange:g(e,t,l,(e=>e),[],r),className:null!=n?n:Ce+"Cell",hasSchema:null==(o=b(r))?void 0:o.hasTablesSchema})},Le=({valueId:e,store:t,className:l})=>{var r;return q(qe,{thing:f(e,t),onThingChange:v(e,(e=>e),[],t),className:null!=l?l:Ce+N,hasSchema:null==(r=b(t))?void 0:r.hasValuesSchema})},Ge=({onChange:t,total:l,offset:r=0,limit:n=l,singular:o="row",plural:a=o+"s"})=>{(r>l||r<0)&&(r=0,t(0));const i=xe((()=>t(r-n)),[t,r,n],r>0),s=xe((()=>t(r+n)),[t,r,n],r+n<l);return q(e.Fragment,null,l>n&&q(e.Fragment,null,q("button",{className:"previous",disabled:0==r,onClick:i},"←"),q("button",{className:"next",disabled:r+n>=l,onClick:s},"→"),r+1," to ",Math.min(l,r+n)," of "),l," ",1!=l?a:o)};(class extends M{constructor(e){super(e),this.componentDidCatch=(e,t)=>console.error(e,t.componentStack),this.state={e:0}}render(){return this.state.e?q("span",{className:"warn"},"Inspector error: please see console for details."):this.props.children}}).getDerivedStateFromError=()=>({e:1});const He=e=>new Map(e);He(),He();const Je=e=>null;export{Be as EditableCellView,Le as EditableValueView,De as RelationshipInHtmlTable,Ae as ResultSortedTableInHtmlTable,Ve as ResultTableInHtmlTable,Ee as SliceInHtmlTable,Fe as SortedTableInHtmlTable,Ge as SortedTablePaginator,Je as StoreInspector,Te as TableInHtmlTable,Re as ValuesInHtmlTable};
1
+ import e from"react";import{useRowIds as t,useTableCellIds as l,useRowCount as r,useSortedRowIds as n,useValueIds as o,ValueView as a,useIndexesOrIndexesById as i,useSliceRowIds as s,useRelationshipsOrRelationshipsById as d,useResultRowIds as u,useResultTableCellIds as c,useResultRowCount as m,useResultSortedRowIds as h,useCell as p,useSetCellCallback as g,useStoreOrStoreById as b,useValue as f,useSetValueCallback as w,useRemoteRowId as v,CellView as y,ResultCellView as k}from"./ui-react";const C=e=>typeof e,I=C(""),x=C(!0),O=C(0),N="Value",j="currentTarget",P="value",z=isFinite,S=e=>null==e,{PureComponent:T,Fragment:M,createElement:$,useCallback:q,useLayoutEffect:F,useRef:R,useState:E}=e,D=(e,...t)=>S(e)?{}:e(...t),V=(e,t)=>e.map(t),A=Object,B=(e=[])=>A.fromEntries(e),L=(e,t)=>V(A.entries(e),(([e,l])=>t(l,e))),G="M20 80l5-15l40-40l10 10l-40 40l-15 5m5-15l10 10",H='content:url("',J=H+"data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' stroke-width='4' stroke='white' fill='none'>",K='</svg>")',Q=H+"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\")",U=V([[20,20,20,60],[20,20,60,20],[20,60,60,20],[60,20,20,60],[30,30,40,40]],(([e,t,l,r])=>J+`<rect x='20' y='20' width='60' height='60' fill='grey'/><rect x='${e}' y='${t}' width='${l}' height='${r}' fill='white'/>`+K)),W=J+"<path d='M20 20l60 60M20 80l60-60' />"+K,X=J+`<path d='${G}' />`+K,Y=J+`<path d='${G}M20 20l60 60' />`+K;var Z=Object.defineProperty,_=Object.defineProperties,ee=Object.getOwnPropertyDescriptors,te=Object.getOwnPropertySymbols,le=Object.prototype.hasOwnProperty,re=Object.prototype.propertyIsEnumerable,ne=(e,t,l)=>t in e?Z(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l,oe=(e,t)=>{for(var l in t||(t={}))le.call(t,l)&&ne(e,l,t[l]);if(te)for(var l of te(t))re.call(t,l)&&ne(e,l,t[l]);return e},ae=(e,t)=>_(e,ee(t));const ie="*::-webkit-scrollbar";((e,t="")=>{e.join(t)})(L(ae(oe(ae(oe(ae(oe({"*":"all:revert","*::before":"all:revert","*::after":"all:revert",[ie]:"width:0.5rem;height:0.5rem;",[ie+"-track"]:"background:#111",[ie+"-thumb"]:"background:#999;border:1px solid #111",[ie+"-thumb:hover"]:"background:#fff",[ie+"-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;"+Q},B(V(["bottom:0;left:0","top:0;right:0"],((e,t)=>[`>img[data-position='${t}']`,e])))),{main:"display:flex;flex-direction:column;background:#111d;color:#fff;position:fixed;"}),B(V(["bottom:0;left:0;width:35vw;height:100vh","top:0;right:0;width:100vw;height:30vh","bottom:0;left:0;width:100vw;height:30vh","top:0;right:0;width:35vw;height:100vh","top:0;right:0;width:100vw;height:100vh"],((e,t)=>[`main[data-position='${t}']`,e])))),{header:"display:flex;padding:0.25rem;background:#000;align-items:center","header>img:nth-of-type(1)":Q,"header>img:nth-of-type(6)":W}),B(V(U,((e,t)=>[`header>img[data-id='${t}']`,e])))),{"header>span":"flex:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;margin-left:0.25rem",article:"padding:0.25rem 0.25rem 0.25rem 0.5rem;overflow:auto;flex:1",details:"margin-left:0.75rem;width:fit-content;","details img":"display:none","details[open]>summary img":"display:unset;background:none;margin-left:0.25rem","details[open]>summary img.edit":X,"details[open]>summary img.done":Y,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,t)=>e?`& ${t}{${e}}`:"")));const se=(e,t,l,r)=>e==I?t:e==O?l:r;var de=Object.defineProperty,ue=Object.defineProperties,ce=Object.getOwnPropertyDescriptors,me=Object.getOwnPropertySymbols,he=Object.prototype.hasOwnProperty,pe=Object.prototype.propertyIsEnumerable,ge=(e,t,l)=>t in e?de(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l,be=(e,t)=>{for(var l in t||(t={}))he.call(t,l)&&ge(e,l,t[l]);if(me)for(var l of me(t))pe.call(t,l)&&ge(e,l,t[l]);return e},fe=(e,t)=>ue(e,ce(t)),we=(e,t)=>{var l={};for(var r in e)he.call(e,r)&&t.indexOf(r)<0&&(l[r]=e[r]);if(null!=e&&me)for(var r of me(e))t.indexOf(r)<0&&pe.call(e,r)&&(l[r]=e[r]);return l};const{useCallback:ve,useMemo:ye,useState:ke}=e,Ce="editable",Ie=(e,t)=>V(l(e,t),(t=>e+"."+t)),xe=(e,t,l)=>{const r=ve(e,t);return l?r:void 0},Oe=(...e)=>ye((()=>e),e),Ne=(e,t)=>ye((()=>({store:e,tableId:t})),[e,t]),je=(e,t)=>ye((()=>({queries:e,queryId:t})),[e,t]),Pe=(e,t=!1,l,r=0,n,o,a,i)=>{const[[s,d,u],c]=ke([e,t,r]),m=ve((e=>{c(e),null==i||i(e)}),[i]),h=xe((e=>m([e,e==s&&!d,u])),[m,s,d,u],l),p=ve((e=>m([s,d,e])),[m,s,d]),g=!0===a?Ge:a;return[[s,d,u],h,ye((()=>!1===a?null:$(g,{offset:u,limit:n,total:o,onChange:p})),[a,g,u,n,o,p])]},ze=(e,t,l)=>ye((()=>{const r=null!=t?t:e;return B(L(Array.isArray(r)?B(V(r,(e=>[e,e]))):r,((e,t)=>{return[t,be(be({},{label:t,component:l}),(r=e,C(r)==I?{label:e}:e))];var r})))}),[t,l,e]),Se=({className:e,headerRow:t,idColumn:l,params:[r,n,o,a,i,s]})=>$("table",{className:e},s?$("caption",null,s):null,!1===t?null:$("thead",null,$("tr",null,!1===l?null:$(Te,{sort:null!=a?a:[],label:"Id",onClick:i}),L(r,(({label:e},t)=>$(Te,{key:t,cellId:t,label:e,sort:null!=a?a:[],onClick:i}))))),$("tbody",null,V(o,(e=>$("tr",{key:e},!1===l?null:$("th",null,e),L(r,(({component:t,getComponentProps:l},r)=>$("td",{key:r},$(t,fe(be(be({},D(l,e,r)),n),{rowId:e,cellId:r})))))))))),Te=({cellId:e,sort:[t,l],label:r=(null!=e?e:""),onClick:n})=>$("th",{onClick:xe((()=>null==n?void 0:n(e)),[n,e],n),className:S(l)||t!=e?void 0:`sorted ${l?"de":"a"}scending`},S(l)||t!=e?null:(l?"↓":"↑")+" ",r),Me=({localRowId:t,params:[l,r,n,o,a,i,s]})=>{const d=v(a,t,i);return $("tr",null,!1===l?null:$(e.Fragment,null,$("th",null,t),$("th",null,d)),L(r,(({component:e,getComponentProps:l},r)=>{const[a,i]=r.split(".",2),u=a===n?t:a===o?d:null;return S(u)?null:$("td",{key:r},$(e,fe(be({},D(l,u,i)),{store:s,tableId:a,rowId:u,cellId:i})))})))},$e=({thing:e,onThingChange:t,className:l,hasSchema:r,showType:n=!0})=>{const[o,a]=ke(),[i,s]=ke(),[d,u]=ke(),[c,m]=ke(),[h,p]=ke();i!==e&&(a((e=>{const t=C(e);return(e=>e==I||e==x)(t)||t==O&&z(e)?t:void 0})(e)),s(e),u(e+""),m(Number(e)||0),p(!!e));const g=ve(((e,l)=>{l(e),s(e),t(e)}),[t]),b=ve((()=>{if(!(null==r?void 0:r())){const e=se(o,O,x,I),l=se(e,d,c,h);a(e),s(l),t(l)}}),[r,t,d,c,h,o]);return $("div",{className:l},n?$("button",{className:o,onClick:b},o):null,se(o,$("input",{key:o,value:d,onChange:ve((e=>g(e[j][P]+"",u)),[g])}),$("input",{key:o,type:"number",value:c,onChange:ve((e=>g(Number(e[j][P]||0),m)),[g])}),$("input",{key:o,type:"checkbox",checked:h,onChange:ve((e=>g(!!e[j].checked,p)),[g])})))},qe=e=>{var r=e,{tableId:n,store:o,editable:a,customCells:i}=r,s=we(r,["tableId","store","editable","customCells"]);return $(Se,fe(be({},s),{params:Oe(ze(l(n,o),i,a?Be:y),Ne(o,n),t(n,o))}))},Fe=e=>{var t=e,{tableId:o,cellId:a,descending:i,offset:s,limit:d,store:u,editable:c,sortOnClick:m,paginator:h=!1,onChange:p,customCells:g}=t,b=we(t,["tableId","cellId","descending","offset","limit","store","editable","sortOnClick","paginator","onChange","customCells"]);const[f,w,v]=Pe(a,i,m,s,d,r(o,u),h,p);return $(Se,fe(be({},b),{params:Oe(ze(l(o,u),g,c?Be:y),Ne(u,o),n(o,...f,d,u),f,w,v)}))},Re=({store:e,editable:t=!1,valueComponent:l=(t?Le:a),getValueComponentProps:r,className:n,headerRow:i,idColumn:s})=>$("table",{className:n},!1===i?null:$("thead",null,$("tr",null,!1===s?null:$("th",null,"Id"),$("th",null,N))),$("tbody",null,V(o(e),(t=>$("tr",{key:t},!1===s?null:$("th",null,t),$("td",null,$(l,fe(be({},D(r,t)),{valueId:t,store:e})))))))),Ee=e=>{var t=e,{indexId:r,sliceId:n,indexes:o,editable:a,customCells:d}=t,u=we(t,["indexId","sliceId","indexes","editable","customCells"]);const[c,m,h]=((e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getTableId(t)])(i(o),r);return $(Se,fe(be({},u),{params:Oe(ze(l(h,m),d,a?Be:y),Ne(m,h),s(r,n,c))}))},De=({relationshipId:l,relationships:r,editable:n,customCells:o,className:a,headerRow:i,idColumn:s=!0})=>{const[u,c,m,h]=((e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(t),null==e?void 0:e.getRemoteTableId(t)])(d(r),l),p=ze([...Ie(m,c),...Ie(h,c)],o,n?Be:y),g=Oe(s,p,m,h,l,u,c);return $("table",{className:a},!1===i?null:$("thead",null,$("tr",null,!1===s?null:$(e.Fragment,null,$("th",null,m,".Id"),$("th",null,h,".Id")),L(p,(({label:e},t)=>$("th",{key:t},e))))),$("tbody",null,V(t(m,c),(e=>$(Me,{key:e,localRowId:e,params:g})))))},Ve=e=>{var t=e,{queryId:l,queries:r,customCells:n}=t,o=we(t,["queryId","queries","customCells"]);return $(Se,fe(be({},o),{params:Oe(ze(c(l,r),n,k),je(r,l),u(l,r))}))},Ae=e=>{var t=e,{queryId:l,cellId:r,descending:n,offset:o,limit:a,queries:i,sortOnClick:s,paginator:d=!1,customCells:u,onChange:p}=t,g=we(t,["queryId","cellId","descending","offset","limit","queries","sortOnClick","paginator","customCells","onChange"]);const[b,f,w]=Pe(r,n,s,o,a,m(l,i),d,p);return $(Se,fe(be({},g),{params:Oe(ze(c(l,i),u,k),je(i,l),h(l,...b,a,i),b,f,w)}))},Be=({tableId:e,rowId:t,cellId:l,store:r,className:n,showType:o})=>{var a;return $($e,{thing:p(e,t,l,r),onThingChange:g(e,t,l,(e=>e),[],r),className:null!=n?n:Ce+"Cell",showType:o,hasSchema:null==(a=b(r))?void 0:a.hasTablesSchema})},Le=({valueId:e,store:t,className:l,showType:r})=>{var n;return $($e,{thing:f(e,t),onThingChange:w(e,(e=>e),[],t),className:null!=l?l:Ce+N,showType:r,hasSchema:null==(n=b(t))?void 0:n.hasValuesSchema})},Ge=({onChange:t,total:l,offset:r=0,limit:n=l,singular:o="row",plural:a=o+"s"})=>{(r>l||r<0)&&(r=0,t(0));const i=xe((()=>t(r-n)),[t,r,n],r>0),s=xe((()=>t(r+n)),[t,r,n],r+n<l);return $(e.Fragment,null,l>n&&$(e.Fragment,null,$("button",{className:"previous",disabled:0==r,onClick:i},"←"),$("button",{className:"next",disabled:r+n>=l,onClick:s},"→"),r+1," to ",Math.min(l,r+n)," of "),l," ",1!=l?a:o)};(class extends T{constructor(e){super(e),this.componentDidCatch=(e,t)=>console.error(e,t.componentStack),this.state={e:0}}render(){return this.state.e?$("span",{className:"warn"},"Inspector error: please see console for details."):this.props.children}}).getDerivedStateFromError=()=>({e:1});const He=e=>new Map(e);He(),He();const Je=e=>null;export{Be as EditableCellView,Le as EditableValueView,De as RelationshipInHtmlTable,Ae as ResultSortedTableInHtmlTable,Ve as ResultTableInHtmlTable,Ee as SliceInHtmlTable,Fe as SortedTableInHtmlTable,Ge as SortedTablePaginator,Je as StoreInspector,qe as TableInHtmlTable,Re as ValuesInHtmlTable};
Binary file
@@ -1476,6 +1476,10 @@ export function ResultSortedTableInHtmlTable(
1476
1476
  * A Cell contains a string, number, or boolean, so the value is rendered in an
1477
1477
  * appropriate <input> tag and a button lets the user change type, if possible.
1478
1478
  *
1479
+ * Set the `showType` prop to false to remove the ability for the user to see or
1480
+ * change the Cell type. They will also not be able to change the type if there
1481
+ * is a TablesSchema applied to the Store.
1482
+ *
1479
1483
  * This component uses the useCell hook under the covers, which means that any
1480
1484
  * changes to the specified Cell outside of this component will cause a
1481
1485
  * re-render.
@@ -1516,7 +1520,7 @@ export function ResultSortedTableInHtmlTable(
1516
1520
  * @since v4.1.0
1517
1521
  */
1518
1522
  export function EditableCellView(
1519
- props: CellProps & {readonly className?: string},
1523
+ props: CellProps & {readonly className?: string; readonly showType?: boolean},
1520
1524
  ): ComponentReturnType;
1521
1525
 
1522
1526
  /**
@@ -1533,6 +1537,10 @@ export function EditableCellView(
1533
1537
  * A Value contains a string, number, or boolean, so the value is rendered in an
1534
1538
  * appropriate <input> tag and a button lets the user change type, if possible.
1535
1539
  *
1540
+ * Set the `showType` prop to false to remove the ability for the user to see or
1541
+ * change the Value type. They will also not be able to change the type if there
1542
+ * is a ValuesSchema applied to the Store.
1543
+ *
1536
1544
  * This component uses the useValue hook under the covers, which means that any
1537
1545
  * changes to the specified Value outside of this component will cause a
1538
1546
  * re-render.
@@ -1571,7 +1579,10 @@ export function EditableCellView(
1571
1579
  * @since v4.1.0
1572
1580
  */
1573
1581
  export function EditableValueView(
1574
- props: ValueProps & {readonly className?: string},
1582
+ props: ValueProps & {
1583
+ readonly className?: string;
1584
+ readonly showType?: boolean;
1585
+ },
1575
1586
  ): ComponentReturnType;
1576
1587
 
1577
1588
  /**
@@ -1577,7 +1577,7 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
1577
1577
  *
1578
1578
  * ```ts override
1579
1579
  * EditableCellView(
1580
- * props: CellProps & {readonly className?: string},
1580
+ * props: CellProps & {readonly className?: string; readonly showType?: boolean},
1581
1581
  * ): ComponentReturnType;
1582
1582
  * ```
1583
1583
  *
@@ -1590,6 +1590,10 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
1590
1590
  * A Cell contains a string, number, or boolean, so the value is rendered in an
1591
1591
  * appropriate <input> tag and a button lets the user change type, if possible.
1592
1592
  *
1593
+ * Set the `showType` prop to false to remove the ability for the user to see or
1594
+ * change the Cell type. They will also not be able to change the type if there
1595
+ * is a TablesSchema applied to the Store.
1596
+ *
1593
1597
  * This component uses the useCell hook under the covers, which means that any
1594
1598
  * changes to the specified Cell outside of this component will cause a
1595
1599
  * re-render.
@@ -1630,7 +1634,10 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
1630
1634
  * @since v4.1.0
1631
1635
  */
1632
1636
  EditableCellView: (
1633
- props: CellProps<Schemas> & {className?: string},
1637
+ props: CellProps<Schemas> & {
1638
+ className?: string;
1639
+ readonly showType?: boolean;
1640
+ },
1634
1641
  ) => ComponentReturnType;
1635
1642
 
1636
1643
  /**
@@ -1642,7 +1649,10 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
1642
1649
  *
1643
1650
  * ```ts override
1644
1651
  * EditableValueView(
1645
- * props: ValueProps & {readonly className?: string},
1652
+ * props: ValueProps & {
1653
+ * readonly className?: string;
1654
+ * readonly showType?: boolean;
1655
+ * },
1646
1656
  * ): ComponentReturnType;
1647
1657
  * ```
1648
1658
  *
@@ -1655,6 +1665,10 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
1655
1665
  * A Value contains a string, number, or boolean, so the value is rendered in an
1656
1666
  * appropriate <input> tag and a button lets the user change type, if possible.
1657
1667
  *
1668
+ * Set the `showType` prop to false to remove the ability for the user to see or
1669
+ * change the Value type. They will also not be able to change the type if there
1670
+ * is a ValuesSchema applied to the Store.
1671
+ *
1658
1672
  * This component uses the useValue hook under the covers, which means that any
1659
1673
  * changes to the specified Value outside of this component will cause a
1660
1674
  * re-render.
@@ -1693,7 +1707,10 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
1693
1707
  * @since v4.1.0
1694
1708
  */
1695
1709
  EditableValueView: (
1696
- props: ValueProps<Schemas> & {className?: string},
1710
+ props: ValueProps<Schemas> & {
1711
+ className?: string;
1712
+ readonly showType?: boolean;
1713
+ },
1697
1714
  ) => ComponentReturnType;
1698
1715
 
1699
1716
  /**
@@ -1 +1 @@
1
- import e from"react";import{useRowIds as t,useTableCellIds as l,useRowCount as a,useSortedRowIds as n,useValueIds as o,ValueView as r,useIndexesOrIndexesById as i,useSliceRowIds as s,useRelationshipsOrRelationshipsById as d,useResultRowIds as m,useResultTableCellIds as c,useResultRowCount as h,useResultSortedRowIds as u,useCell as g,useSetCellCallback as p,useStoreOrStoreById as b,useValue as f,useSetValueCallback as w,useRemoteRowId as k,CellView as v,ResultCellView as y}from"./ui-react";const C=e=>typeof e,x=C(""),I=C(!0),N=C(0),z="Value",M="currentTarget",$="value",S=isFinite,T=e=>null==e,{PureComponent:F,Fragment:R,createElement:q,useCallback:E,useLayoutEffect:P,useRef:O,useState:V}=e,j=(e,...t)=>T(e)?{}:e(...t),A=(e,t)=>e.map(t),B=Object,D=(e=[])=>B.fromEntries(e),L=(e,t)=>A(B.entries(e),(([e,l])=>t(l,e))),G="M20 80l5-15l40-40l10 10l-40 40l-15 5m5-15l10 10",H='content:url("',J=H+"data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' stroke-width='4' stroke='white' fill='none'>",K='</svg>")',Q=H+"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\")",U=A([[20,20,20,60],[20,20,60,20],[20,60,60,20],[60,20,20,60],[30,30,40,40]],(([e,t,l,a])=>J+`<rect x='20' y='20' width='60' height='60' fill='grey'/><rect x='${e}' y='${t}' width='${l}' height='${a}' fill='white'/>`+K)),W=J+"<path d='M20 20l60 60M20 80l60-60' />"+K,X=J+`<path d='${G}' />`+K,Y=J+`<path d='${G}M20 20l60 60' />`+K,Z="*::-webkit-scrollbar";((e,t="")=>{e.join(t)})(L({"*":"all:revert","*::before":"all:revert","*::after":"all:revert",[Z]:"width:0.5rem;height:0.5rem;",[Z+"-track"]:"background:#111",[Z+"-thumb"]:"background:#999;border:1px solid #111",[Z+"-thumb:hover"]:"background:#fff",[Z+"-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;"+Q,...D(A(["bottom:0;left:0","top:0;right:0"],((e,t)=>[`>img[data-position='${t}']`,e]))),main:"display:flex;flex-direction:column;background:#111d;color:#fff;position:fixed;",...D(A(["bottom:0;left:0;width:35vw;height:100vh","top:0;right:0;width:100vw;height:30vh","bottom:0;left:0;width:100vw;height:30vh","top:0;right:0;width:35vw;height:100vh","top:0;right:0;width:100vw;height:100vh"],((e,t)=>[`main[data-position='${t}']`,e]))),header:"display:flex;padding:0.25rem;background:#000;align-items:center","header>img:nth-of-type(1)":Q,"header>img:nth-of-type(6)":W,...D(A(U,((e,t)=>[`header>img[data-id='${t}']`,e]))),"header>span":"flex:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;margin-left:0.25rem",article:"padding:0.25rem 0.25rem 0.25rem 0.5rem;overflow:auto;flex:1",details:"margin-left:0.75rem;width:fit-content;","details img":"display:none","details[open]>summary img":"display:unset;background:none;margin-left:0.25rem","details[open]>summary img.edit":X,"details[open]>summary img.done":Y,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,t)=>e?`& ${t}{${e}}`:"")));const _=(e,t,l,a)=>e==x?t:e==N?l:a,{useCallback:ee,useMemo:te,useState:le}=e,ae="editable",ne=(e,t)=>A(l(e,t),(t=>e+"."+t)),oe=(e,t,l)=>{const a=ee(e,t);return l?a:void 0},re=(...e)=>te((()=>e),e),ie=(e,t)=>te((()=>({store:e,tableId:t})),[e,t]),se=(e,t)=>te((()=>({queries:e,queryId:t})),[e,t]),de=(e,t=!1,l,a=0,n,o,r,i)=>{const[[s,d,m],c]=le([e,t,a]),h=ee((e=>{c(e),i?.(e)}),[i]),u=oe((e=>h([e,e==s&&!d,m])),[h,s,d,m],l),g=ee((e=>h([s,d,e])),[h,s,d]),p=!0===r?Ie:r;return[[s,d,m],u,te((()=>!1===r?null:q(p,{offset:m,limit:n,total:o,onChange:g})),[r,p,m,n,o,g])]},me=(e,t,l)=>te((()=>{const a=t??e;return D(L(Array.isArray(a)?D(A(a,(e=>[e,e]))):a,((e,t)=>{return[t,{label:t,component:l,...(a=e,C(a)==x?{label:e}:e)}];var a})))}),[t,l,e]),ce=({className:e,headerRow:t,idColumn:l,params:[a,n,o,r,i,s]})=>q("table",{className:e},s?q("caption",null,s):null,!1===t?null:q("thead",null,q("tr",null,!1===l?null:q(he,{sort:r??[],label:"Id",onClick:i}),L(a,(({label:e},t)=>q(he,{key:t,cellId:t,label:e,sort:r??[],onClick:i}))))),q("tbody",null,A(o,(e=>q("tr",{key:e},!1===l?null:q("th",null,e),L(a,(({component:t,getComponentProps:l},a)=>q("td",{key:a},q(t,{...j(l,e,a),...n,rowId:e,cellId:a}))))))))),he=({cellId:e,sort:[t,l],label:a=e??"",onClick:n})=>q("th",{onClick:oe((()=>n?.(e)),[n,e],n),className:T(l)||t!=e?void 0:`sorted ${l?"de":"a"}scending`},T(l)||t!=e?null:(l?"↓":"↑")+" ",a),ue=({localRowId:t,params:[l,a,n,o,r,i,s]})=>{const d=k(r,t,i);return q("tr",null,!1===l?null:q(e.Fragment,null,q("th",null,t),q("th",null,d)),L(a,(({component:e,getComponentProps:l},a)=>{const[r,i]=a.split(".",2),m=r===n?t:r===o?d:null;return T(m)?null:q("td",{key:a},q(e,{...j(l,m,i),store:s,tableId:r,rowId:m,cellId:i}))})))},ge=({thing:e,onThingChange:t,className:l,hasSchema:a})=>{const[n,o]=le(),[r,i]=le(),[s,d]=le(),[m,c]=le(),[h,u]=le();r!==e&&(o((e=>{const t=C(e);return(e=>e==x||e==I)(t)||t==N&&S(e)?t:void 0})(e)),i(e),d(e+""),c(Number(e)||0),u(!!e));const g=ee(((e,l)=>{l(e),i(e),t(e)}),[t]);return q("div",{className:l},q("button",{className:n,onClick:ee((()=>{if(!a?.()){const e=_(n,N,I,x),l=_(e,s,m,h);o(e),i(l),t(l)}}),[a,t,s,m,h,n])},n),_(n,q("input",{key:n,value:s,onChange:ee((e=>g(e[M][$]+"",d)),[g])}),q("input",{key:n,type:"number",value:m,onChange:ee((e=>g(Number(e[M][$]||0),c)),[g])}),q("input",{key:n,type:"checkbox",checked:h,onChange:ee((e=>g(!!e[M].checked,u)),[g])})))},pe=({tableId:e,store:a,editable:n,customCells:o,...r})=>q(ce,{...r,params:re(me(l(e,a),o,n?Ce:v),ie(a,e),t(e,a))}),be=({tableId:e,cellId:t,descending:o,offset:r,limit:i,store:s,editable:d,sortOnClick:m,paginator:c=!1,onChange:h,customCells:u,...g})=>{const[p,b,f]=de(t,o,m,r,i,a(e,s),c,h);return q(ce,{...g,params:re(me(l(e,s),u,d?Ce:v),ie(s,e),n(e,...p,i,s),p,b,f)})},fe=({store:e,editable:t=!1,valueComponent:l=(t?xe:r),getValueComponentProps:a,className:n,headerRow:i,idColumn:s})=>q("table",{className:n},!1===i?null:q("thead",null,q("tr",null,!1===s?null:q("th",null,"Id"),q("th",null,z))),q("tbody",null,A(o(e),(t=>q("tr",{key:t},!1===s?null:q("th",null,t),q("td",null,q(l,{...j(a,t),valueId:t,store:e}))))))),we=({indexId:e,sliceId:t,indexes:a,editable:n,customCells:o,...r})=>{const[d,m,c]=((e,t)=>[e,e?.getStore(),e?.getTableId(t)])(i(a),e);return q(ce,{...r,params:re(me(l(c,m),o,n?Ce:v),ie(m,c),s(e,t,d))})},ke=({relationshipId:l,relationships:a,editable:n,customCells:o,className:r,headerRow:i,idColumn:s=!0})=>{const[m,c,h,u]=((e,t)=>[e,e?.getStore(),e?.getLocalTableId(t),e?.getRemoteTableId(t)])(d(a),l),g=me([...ne(h,c),...ne(u,c)],o,n?Ce:v),p=re(s,g,h,u,l,m,c);return q("table",{className:r},!1===i?null:q("thead",null,q("tr",null,!1===s?null:q(e.Fragment,null,q("th",null,h,".Id"),q("th",null,u,".Id")),L(g,(({label:e},t)=>q("th",{key:t},e))))),q("tbody",null,A(t(h,c),(e=>q(ue,{key:e,localRowId:e,params:p})))))},ve=({queryId:e,queries:t,customCells:l,...a})=>q(ce,{...a,params:re(me(c(e,t),l,y),se(t,e),m(e,t))}),ye=({queryId:e,cellId:t,descending:l,offset:a,limit:n,queries:o,sortOnClick:r,paginator:i=!1,customCells:s,onChange:d,...m})=>{const[g,p,b]=de(t,l,r,a,n,h(e,o),i,d);return q(ce,{...m,params:re(me(c(e,o),s,y),se(o,e),u(e,...g,n,o),g,p,b)})},Ce=({tableId:e,rowId:t,cellId:l,store:a,className:n})=>q(ge,{thing:g(e,t,l,a),onThingChange:p(e,t,l,(e=>e),[],a),className:n??ae+"Cell",hasSchema:b(a)?.hasTablesSchema}),xe=({valueId:e,store:t,className:l})=>q(ge,{thing:f(e,t),onThingChange:w(e,(e=>e),[],t),className:l??ae+z,hasSchema:b(t)?.hasValuesSchema}),Ie=({onChange:t,total:l,offset:a=0,limit:n=l,singular:o="row",plural:r=o+"s"})=>{(a>l||a<0)&&(a=0,t(0));const i=oe((()=>t(a-n)),[t,a,n],a>0),s=oe((()=>t(a+n)),[t,a,n],a+n<l);return q(e.Fragment,null,l>n&&q(e.Fragment,null,q("button",{className:"previous",disabled:0==a,onClick:i},"←"),q("button",{className:"next",disabled:a+n>=l,onClick:s},"→"),a+1," to ",Math.min(l,a+n)," of "),l," ",1!=l?r:o)};class Ne extends F{constructor(e){super(e),this.componentDidCatch=(e,t)=>console.error(e,t.componentStack),this.state={e:0}}static{this.getDerivedStateFromError=()=>({e:1})}render(){return this.state.e?q("span",{className:"warn"},"Inspector error: please see console for details."):this.props.children}}const ze=e=>new Map(e);ze(),ze();const Me=e=>null;export{Ce as EditableCellView,xe as EditableValueView,ke as RelationshipInHtmlTable,ye as ResultSortedTableInHtmlTable,ve as ResultTableInHtmlTable,we as SliceInHtmlTable,be as SortedTableInHtmlTable,Ie as SortedTablePaginator,Me as StoreInspector,pe as TableInHtmlTable,fe as ValuesInHtmlTable};
1
+ import e from"react";import{useRowIds as t,useTableCellIds as l,useRowCount as a,useSortedRowIds as n,useValueIds as o,ValueView as r,useIndexesOrIndexesById as i,useSliceRowIds as s,useRelationshipsOrRelationshipsById as d,useResultRowIds as m,useResultTableCellIds as h,useResultRowCount as c,useResultSortedRowIds as u,useCell as g,useSetCellCallback as p,useStoreOrStoreById as b,useValue as f,useSetValueCallback as w,useRemoteRowId as y,CellView as k,ResultCellView as v}from"./ui-react";const C=e=>typeof e,x=C(""),I=C(!0),N=C(0),z="Value",T="currentTarget",M="value",$=isFinite,S=e=>null==e,{PureComponent:F,Fragment:R,createElement:q,useCallback:E,useLayoutEffect:P,useRef:O,useState:V}=e,j=(e,...t)=>S(e)?{}:e(...t),A=(e,t)=>e.map(t),B=Object,D=(e=[])=>B.fromEntries(e),L=(e,t)=>A(B.entries(e),(([e,l])=>t(l,e))),G="M20 80l5-15l40-40l10 10l-40 40l-15 5m5-15l10 10",H='content:url("',J=H+"data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' stroke-width='4' stroke='white' fill='none'>",K='</svg>")',Q=H+"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\")",U=A([[20,20,20,60],[20,20,60,20],[20,60,60,20],[60,20,20,60],[30,30,40,40]],(([e,t,l,a])=>J+`<rect x='20' y='20' width='60' height='60' fill='grey'/><rect x='${e}' y='${t}' width='${l}' height='${a}' fill='white'/>`+K)),W=J+"<path d='M20 20l60 60M20 80l60-60' />"+K,X=J+`<path d='${G}' />`+K,Y=J+`<path d='${G}M20 20l60 60' />`+K,Z="*::-webkit-scrollbar";((e,t="")=>{e.join(t)})(L({"*":"all:revert","*::before":"all:revert","*::after":"all:revert",[Z]:"width:0.5rem;height:0.5rem;",[Z+"-track"]:"background:#111",[Z+"-thumb"]:"background:#999;border:1px solid #111",[Z+"-thumb:hover"]:"background:#fff",[Z+"-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;"+Q,...D(A(["bottom:0;left:0","top:0;right:0"],((e,t)=>[`>img[data-position='${t}']`,e]))),main:"display:flex;flex-direction:column;background:#111d;color:#fff;position:fixed;",...D(A(["bottom:0;left:0;width:35vw;height:100vh","top:0;right:0;width:100vw;height:30vh","bottom:0;left:0;width:100vw;height:30vh","top:0;right:0;width:35vw;height:100vh","top:0;right:0;width:100vw;height:100vh"],((e,t)=>[`main[data-position='${t}']`,e]))),header:"display:flex;padding:0.25rem;background:#000;align-items:center","header>img:nth-of-type(1)":Q,"header>img:nth-of-type(6)":W,...D(A(U,((e,t)=>[`header>img[data-id='${t}']`,e]))),"header>span":"flex:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;margin-left:0.25rem",article:"padding:0.25rem 0.25rem 0.25rem 0.5rem;overflow:auto;flex:1",details:"margin-left:0.75rem;width:fit-content;","details img":"display:none","details[open]>summary img":"display:unset;background:none;margin-left:0.25rem","details[open]>summary img.edit":X,"details[open]>summary img.done":Y,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,t)=>e?`& ${t}{${e}}`:"")));const _=(e,t,l,a)=>e==x?t:e==N?l:a,{useCallback:ee,useMemo:te,useState:le}=e,ae="editable",ne=(e,t)=>A(l(e,t),(t=>e+"."+t)),oe=(e,t,l)=>{const a=ee(e,t);return l?a:void 0},re=(...e)=>te((()=>e),e),ie=(e,t)=>te((()=>({store:e,tableId:t})),[e,t]),se=(e,t)=>te((()=>({queries:e,queryId:t})),[e,t]),de=(e,t=!1,l,a=0,n,o,r,i)=>{const[[s,d,m],h]=le([e,t,a]),c=ee((e=>{h(e),i?.(e)}),[i]),u=oe((e=>c([e,e==s&&!d,m])),[c,s,d,m],l),g=ee((e=>c([s,d,e])),[c,s,d]),p=!0===r?Ie:r;return[[s,d,m],u,te((()=>!1===r?null:q(p,{offset:m,limit:n,total:o,onChange:g})),[r,p,m,n,o,g])]},me=(e,t,l)=>te((()=>{const a=t??e;return D(L(Array.isArray(a)?D(A(a,(e=>[e,e]))):a,((e,t)=>{return[t,{label:t,component:l,...(a=e,C(a)==x?{label:e}:e)}];var a})))}),[t,l,e]),he=({className:e,headerRow:t,idColumn:l,params:[a,n,o,r,i,s]})=>q("table",{className:e},s?q("caption",null,s):null,!1===t?null:q("thead",null,q("tr",null,!1===l?null:q(ce,{sort:r??[],label:"Id",onClick:i}),L(a,(({label:e},t)=>q(ce,{key:t,cellId:t,label:e,sort:r??[],onClick:i}))))),q("tbody",null,A(o,(e=>q("tr",{key:e},!1===l?null:q("th",null,e),L(a,(({component:t,getComponentProps:l},a)=>q("td",{key:a},q(t,{...j(l,e,a),...n,rowId:e,cellId:a}))))))))),ce=({cellId:e,sort:[t,l],label:a=e??"",onClick:n})=>q("th",{onClick:oe((()=>n?.(e)),[n,e],n),className:S(l)||t!=e?void 0:`sorted ${l?"de":"a"}scending`},S(l)||t!=e?null:(l?"↓":"↑")+" ",a),ue=({localRowId:t,params:[l,a,n,o,r,i,s]})=>{const d=y(r,t,i);return q("tr",null,!1===l?null:q(e.Fragment,null,q("th",null,t),q("th",null,d)),L(a,(({component:e,getComponentProps:l},a)=>{const[r,i]=a.split(".",2),m=r===n?t:r===o?d:null;return S(m)?null:q("td",{key:a},q(e,{...j(l,m,i),store:s,tableId:r,rowId:m,cellId:i}))})))},ge=({thing:e,onThingChange:t,className:l,hasSchema:a,showType:n=!0})=>{const[o,r]=le(),[i,s]=le(),[d,m]=le(),[h,c]=le(),[u,g]=le();i!==e&&(r((e=>{const t=C(e);return(e=>e==x||e==I)(t)||t==N&&$(e)?t:void 0})(e)),s(e),m(e+""),c(Number(e)||0),g(!!e));const p=ee(((e,l)=>{l(e),s(e),t(e)}),[t]),b=ee((()=>{if(!a?.()){const e=_(o,N,I,x),l=_(e,d,h,u);r(e),s(l),t(l)}}),[a,t,d,h,u,o]);return q("div",{className:l},n?q("button",{className:o,onClick:b},o):null,_(o,q("input",{key:o,value:d,onChange:ee((e=>p(e[T][M]+"",m)),[p])}),q("input",{key:o,type:"number",value:h,onChange:ee((e=>p(Number(e[T][M]||0),c)),[p])}),q("input",{key:o,type:"checkbox",checked:u,onChange:ee((e=>p(!!e[T].checked,g)),[p])})))},pe=({tableId:e,store:a,editable:n,customCells:o,...r})=>q(he,{...r,params:re(me(l(e,a),o,n?Ce:k),ie(a,e),t(e,a))}),be=({tableId:e,cellId:t,descending:o,offset:r,limit:i,store:s,editable:d,sortOnClick:m,paginator:h=!1,onChange:c,customCells:u,...g})=>{const[p,b,f]=de(t,o,m,r,i,a(e,s),h,c);return q(he,{...g,params:re(me(l(e,s),u,d?Ce:k),ie(s,e),n(e,...p,i,s),p,b,f)})},fe=({store:e,editable:t=!1,valueComponent:l=(t?xe:r),getValueComponentProps:a,className:n,headerRow:i,idColumn:s})=>q("table",{className:n},!1===i?null:q("thead",null,q("tr",null,!1===s?null:q("th",null,"Id"),q("th",null,z))),q("tbody",null,A(o(e),(t=>q("tr",{key:t},!1===s?null:q("th",null,t),q("td",null,q(l,{...j(a,t),valueId:t,store:e}))))))),we=({indexId:e,sliceId:t,indexes:a,editable:n,customCells:o,...r})=>{const[d,m,h]=((e,t)=>[e,e?.getStore(),e?.getTableId(t)])(i(a),e);return q(he,{...r,params:re(me(l(h,m),o,n?Ce:k),ie(m,h),s(e,t,d))})},ye=({relationshipId:l,relationships:a,editable:n,customCells:o,className:r,headerRow:i,idColumn:s=!0})=>{const[m,h,c,u]=((e,t)=>[e,e?.getStore(),e?.getLocalTableId(t),e?.getRemoteTableId(t)])(d(a),l),g=me([...ne(c,h),...ne(u,h)],o,n?Ce:k),p=re(s,g,c,u,l,m,h);return q("table",{className:r},!1===i?null:q("thead",null,q("tr",null,!1===s?null:q(e.Fragment,null,q("th",null,c,".Id"),q("th",null,u,".Id")),L(g,(({label:e},t)=>q("th",{key:t},e))))),q("tbody",null,A(t(c,h),(e=>q(ue,{key:e,localRowId:e,params:p})))))},ke=({queryId:e,queries:t,customCells:l,...a})=>q(he,{...a,params:re(me(h(e,t),l,v),se(t,e),m(e,t))}),ve=({queryId:e,cellId:t,descending:l,offset:a,limit:n,queries:o,sortOnClick:r,paginator:i=!1,customCells:s,onChange:d,...m})=>{const[g,p,b]=de(t,l,r,a,n,c(e,o),i,d);return q(he,{...m,params:re(me(h(e,o),s,v),se(o,e),u(e,...g,n,o),g,p,b)})},Ce=({tableId:e,rowId:t,cellId:l,store:a,className:n,showType:o})=>q(ge,{thing:g(e,t,l,a),onThingChange:p(e,t,l,(e=>e),[],a),className:n??ae+"Cell",showType:o,hasSchema:b(a)?.hasTablesSchema}),xe=({valueId:e,store:t,className:l,showType:a})=>q(ge,{thing:f(e,t),onThingChange:w(e,(e=>e),[],t),className:l??ae+z,showType:a,hasSchema:b(t)?.hasValuesSchema}),Ie=({onChange:t,total:l,offset:a=0,limit:n=l,singular:o="row",plural:r=o+"s"})=>{(a>l||a<0)&&(a=0,t(0));const i=oe((()=>t(a-n)),[t,a,n],a>0),s=oe((()=>t(a+n)),[t,a,n],a+n<l);return q(e.Fragment,null,l>n&&q(e.Fragment,null,q("button",{className:"previous",disabled:0==a,onClick:i},"←"),q("button",{className:"next",disabled:a+n>=l,onClick:s},"→"),a+1," to ",Math.min(l,a+n)," of "),l," ",1!=l?r:o)};class Ne extends F{constructor(e){super(e),this.componentDidCatch=(e,t)=>console.error(e,t.componentStack),this.state={e:0}}static{this.getDerivedStateFromError=()=>({e:1})}render(){return this.state.e?q("span",{className:"warn"},"Inspector error: please see console for details."):this.props.children}}const ze=e=>new Map(e);ze(),ze();const Te=e=>null;export{Ce as EditableCellView,xe as EditableValueView,ye as RelationshipInHtmlTable,ve as ResultSortedTableInHtmlTable,ke as ResultTableInHtmlTable,we as SliceInHtmlTable,be as SortedTableInHtmlTable,Ie as SortedTablePaginator,Te as StoreInspector,pe as TableInHtmlTable,fe as ValuesInHtmlTable};
Binary file
@@ -1 +1 @@
1
- var e,t;e=this,t=function(e,t,s){"use strict";const l=e=>typeof e,a="",n=l(a),r=l(!0),o=l(0),i=l(l),d="type",u="default",c="Ids",h="Table",m=h+"s",b=h+c,g="Row",I=g+"Count",p=g+c,f="Cell",w=f+c,y="Value",C=y+"s",v=y+c,k="currentTarget",T="value",S=e=>a+e,x=Math.floor,V=isFinite,R=(e,t)=>e instanceof t,q=e=>null==e,N=(e,t,s)=>q(e)?s?.():t(e),L=e=>e==n||e==r,M=e=>l(e)==i,E=e=>Array.isArray(e),z=(e,t,s)=>e.slice(t,s),$=e=>e.length,{PureComponent:O,Fragment:A,createElement:F,useCallback:J,useLayoutEffect:P,useRef:B,useState:H}=t,D=(e,...t)=>q(e)?{}:e(...t),Q=(e,t)=>e.forEach(t),j=(e,t)=>e.map(t),W=e=>0==$(e),U=(e,...t)=>e.push(...t),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),te=(e,t)=>!q(((e,t)=>N(e,(e=>e[t])))(e,t)),se=(e,t)=>(delete e[t],e),le=(e,t)=>j(K.entries(e),(([e,s])=>t(s,e))),ae=e=>_(e)&&0==(e=>$(X(e)))(e),ne=e=>JSON.stringify(e,((e,t)=>R(t,Map)?K.fromEntries([...t]):t)),re=JSON.parse,oe="tinybaseStoreInspector",ie="TinyBase Store Inspector",de=["left","top","bottom","right","full"],ue="state",ce="sort",he="open",me="position",be=he,ge="editable",Ie=(...e)=>ne(e),pe=(e,t)=>j(e.sort(),t),fe=(e,t)=>[!!s.useCell(ue,e,ge,t),J((s=>{t.setCell(ue,e,ge,(e=>!e)),s.preventDefault()}),[t,e])],we="M20 80l5-15l40-40l10 10l-40 40l-15 5m5-15l10 10",ye='content:url("',Ce=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'>",ve='</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\")",Te=j([[20,20,20,60],[20,20,60,20],[20,60,60,20],[60,20,20,60],[30,30,40,40]],(([e,t,s,l])=>Ce+`<rect x='20' y='20' width='60' height='60' fill='grey'/><rect x='${e}' y='${t}' width='${s}' height='${l}' fill='white'/>`+ve)),Se=Ce+"<path d='M20 20l60 60M20 80l60-60' />"+ve,xe=Ce+`<path d='${we}' />`+ve,Ve=Ce+`<path d='${we}M20 20l60 60' />`+ve,Re="*::-webkit-scrollbar",qe=`#${oe}{\n all:initial;font-family:sans-serif;font-size:0.75rem;position:fixed;z-index:999999;\n ${((e,t="")=>e.join(t))(le({"*":"all:revert","*::before":"all:revert","*::after":"all:revert",[Re]:"width:0.5rem;height:0.5rem;",[Re+"-track"]:"background:#111",[Re+"-thumb"]:"background:#999;border:1px solid #111",[Re+"-thumb:hover"]:"background:#fff",[Re+"-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(j(["bottom:0;left:0","top:0;right:0"],((e,t)=>[`>img[data-position='${t}']`,e]))),main:"display:flex;flex-direction:column;background:#111d;color:#fff;position:fixed;",...ee(j(["bottom:0;left:0;width:35vw;height:100vh","top:0;right:0;width:100vw;height:30vh","bottom:0;left:0;width:100vw;height:30vh","top:0;right:0;width:35vw;height:100vh","top:0;right:0;width:100vw;height:100vh"],((e,t)=>[`main[data-position='${t}']`,e]))),header:"display:flex;padding:0.25rem;background:#000;align-items:center","header>img:nth-of-type(1)":ke,"header>img:nth-of-type(6)":Se,...ee(j(Te,((e,t)=>[`header>img[data-id='${t}']`,e]))),"header>span":"flex:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;margin-left:0.25rem",article:"padding:0.25rem 0.25rem 0.25rem 0.5rem;overflow:auto;flex:1",details:"margin-left:0.75rem;width:fit-content;","details img":"display:none","details[open]>summary img":"display:unset;background:none;margin-left:0.25rem","details[open]>summary img.edit":xe,"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,t)=>e?`& ${t}{${e}}`:"")))}`,Ne=({s:e})=>{const t=s.useValue(me,e)??1,l=s.useSetValueCallback(be,(()=>!0),[],e);return s.useValue(be,e)?null:F("img",{onClick:l,title:ie,"data-position":t})},Le=({uniqueId:e,summary:t,editable:l,handleEditable:a,children:n,s:r})=>{const o=!!s.useCell(ue,e,he,r),i=s.useSetCellCallback(ue,e,he,(e=>e[k].open),[],r);return F("details",{open:o,onToggle:i},F("summary",null,t,a?F("img",{onClick:a,className:l?"done":"edit"}):null),n)},Me=e=>{const t=l(e);return L(t)||t==o&&V(e)?t:void 0},Ee=(e,t,s,l,a)=>q(a)?e.delCell(t,s,l,!0):e.setCell(t,s,l,a),ze=(e,t,s)=>q(s)?e.delValue(t):e.setValue(t,s),$e=(e,t,s,l)=>e==n?t:e==o?s:l,{useCallback:Oe,useMemo:Ae,useState:Fe}=t,Je="editable",Pe=(e,t)=>j(s.useTableCellIds(e,t),(t=>e+"."+t)),Be=(e,t,s)=>{const l=Oe(e,t);return s?l:void 0},He=(...e)=>Ae((()=>e),e),De=(e,t)=>Ae((()=>({store:e,tableId:t})),[e,t]),Qe=(e,t)=>Ae((()=>({queries:e,queryId:t})),[e,t]),je=(e,t=!1,s,l=0,a,n,r,o)=>{const[[i,d,u],c]=Fe([e,t,l]),h=Oe((e=>{c(e),o?.(e)}),[o]),m=Be((e=>h([e,e==i&&!d,u])),[h,i,d,u],s),b=Oe((e=>h([i,d,e])),[h,i,d]),g=!0===r?at:r;return[[i,d,u],m,Ae((()=>!1===r?null:F(g,{offset:u,limit:a,total:n,onChange:b})),[r,g,u,a,n,b])]},We=(e,t,s)=>Ae((()=>{const a=t??e;return ee(le(E(a)?ee(j(a,(e=>[e,e]))):a,((e,t)=>{return[t,{label:t,component:s,...(a=e,l(a)==n?{label:e}:e)}];var a})))}),[t,s,e]),Ue=({className:e,headerRow:t,idColumn:s,params:[l,a,n,r,o,i]})=>F("table",{className:e},i?F("caption",null,i):null,!1===t?null:F("thead",null,F("tr",null,!1===s?null:F(Ge,{sort:r??[],label:"Id",onClick:o}),le(l,(({label:e},t)=>F(Ge,{key:t,cellId:t,label:e,sort:r??[],onClick:o}))))),F("tbody",null,j(n,(e=>F("tr",{key:e},!1===s?null:F("th",null,e),le(l,(({component:t,getComponentProps:s},l)=>F("td",{key:l},F(t,{...D(s,e,l),...a,rowId:e,cellId:l}))))))))),Ge=({cellId:e,sort:[t,s],label:l=e??a,onClick:n})=>F("th",{onClick:Be((()=>n?.(e)),[n,e],n),className:q(s)||t!=e?void 0:`sorted ${s?"de":"a"}scending`},q(s)||t!=e?null:(s?"↓":"↑")+" ",l),Ke=({localRowId:e,params:[l,a,n,r,o,i,d]})=>{const u=s.useRemoteRowId(o,e,i);return F("tr",null,!1===l?null:F(t.Fragment,null,F("th",null,e),F("th",null,u)),le(a,(({component:t,getComponentProps:s},l)=>{const[a,o]=l.split(".",2),i=a===n?e:a===r?u:null;return q(i)?null:F("td",{key:l},F(t,{...D(s,i,o),store:d,tableId:a,rowId:i,cellId:o}))})))},Xe=({thing:e,onThingChange:t,className:s,hasSchema:l})=>{const[a,i]=Fe(),[d,u]=Fe(),[c,h]=Fe(),[m,b]=Fe(),[g,I]=Fe();d!==e&&(i(Me(e)),u(e),h(e+""),b(Number(e)||0),I(!!e));const p=Oe(((e,s)=>{s(e),u(e),t(e)}),[t]);return F("div",{className:s},F("button",{className:a,onClick:Oe((()=>{if(!l?.()){const e=$e(a,o,r,n),s=$e(e,c,m,g);i(e),u(s),t(s)}}),[l,t,c,m,g,a])},a),$e(a,F("input",{key:a,value:c,onChange:Oe((e=>p(e[k][T]+"",h)),[p])}),F("input",{key:a,type:"number",value:m,onChange:Oe((e=>p(Number(e[k][T]||0),b)),[p])}),F("input",{key:a,type:"checkbox",checked:g,onChange:Oe((e=>p(!!e[k].checked,I)),[p])})))},Ye=({tableId:e,cellId:t,descending:l,offset:a,limit:n,store:r,editable:o,sortOnClick:i,paginator:d=!1,onChange:u,customCells:c,...h})=>{const[m,b,g]=je(t,l,i,a,n,s.useRowCount(e,r),d,u);return F(Ue,{...h,params:He(We(s.useTableCellIds(e,r),c,o?st:s.CellView),De(r,e),s.useSortedRowIds(e,...m,n,r),m,b,g)})},Ze=({store:e,editable:t=!1,valueComponent:l=(t?lt:s.ValueView),getValueComponentProps:a,className:n,headerRow:r,idColumn:o})=>F("table",{className:n},!1===r?null:F("thead",null,F("tr",null,!1===o?null:F("th",null,"Id"),F("th",null,y))),F("tbody",null,j(s.useValueIds(e),(t=>F("tr",{key:t},!1===o?null:F("th",null,t),F("td",null,F(l,{...D(a,t),valueId:t,store:e}))))))),_e=({indexId:e,sliceId:t,indexes:l,editable:a,customCells:n,...r})=>{const[o,i,d]=((e,t)=>[e,e?.getStore(),e?.getTableId(t)])(s.useIndexesOrIndexesById(l),e);return F(Ue,{...r,params:He(We(s.useTableCellIds(d,i),n,a?st:s.CellView),De(i,d),s.useSliceRowIds(e,t,o))})},et=({relationshipId:e,relationships:l,editable:a,customCells:n,className:r,headerRow:o,idColumn:i=!0})=>{const[d,u,c,h]=((e,t)=>[e,e?.getStore(),e?.getLocalTableId(t),e?.getRemoteTableId(t)])(s.useRelationshipsOrRelationshipsById(l),e),m=We([...Pe(c,u),...Pe(h,u)],n,a?st:s.CellView),b=He(i,m,c,h,e,d,u);return F("table",{className:r},!1===o?null:F("thead",null,F("tr",null,!1===i?null:F(t.Fragment,null,F("th",null,c,".Id"),F("th",null,h,".Id")),le(m,(({label:e},t)=>F("th",{key:t},e))))),F("tbody",null,j(s.useRowIds(c,u),(e=>F(Ke,{key:e,localRowId:e,params:b})))))},tt=({queryId:e,cellId:t,descending:l,offset:a,limit:n,queries:r,sortOnClick:o,paginator:i=!1,customCells:d,onChange:u,...c})=>{const[h,m,b]=je(t,l,o,a,n,s.useResultRowCount(e,r),i,u);return F(Ue,{...c,params:He(We(s.useResultTableCellIds(e,r),d,s.ResultCellView),Qe(r,e),s.useResultSortedRowIds(e,...h,n,r),h,m,b)})},st=({tableId:e,rowId:t,cellId:l,store:a,className:n})=>F(Xe,{thing:s.useCell(e,t,l,a),onThingChange:s.useSetCellCallback(e,t,l,(e=>e),[],a),className:n??Je+f,hasSchema:s.useStoreOrStoreById(a)?.hasTablesSchema}),lt=({valueId:e,store:t,className:l})=>F(Xe,{thing:s.useValue(e,t),onThingChange:s.useSetValueCallback(e,(e=>e),[],t),className:l??Je+y,hasSchema:s.useStoreOrStoreById(t)?.hasValuesSchema}),at=({onChange:e,total:s,offset:l=0,limit:a=s,singular:n="row",plural:r=n+"s"})=>{(l>s||l<0)&&(l=0,e(0));const o=Be((()=>e(l-a)),[e,l,a],l>0),i=Be((()=>e(l+a)),[e,l,a],l+a<s);return F(t.Fragment,null,s>a&&F(t.Fragment,null,F("button",{className:"previous",disabled:0==l,onClick:o},"←"),F("button",{className:"next",disabled:l+a>=s,onClick:i},"→"),l+1," to ",Math.min(s,l+a)," of "),s," ",1!=s?r:n)},nt=({indexes:e,indexesId:t,indexId:l,s:a})=>F(Le,{uniqueId:Ie("i",t,l),summary:"Index: "+l,s:a},j(s.useSliceIds(l,e),(s=>F(rt,{indexes:e,indexesId:t,indexId:l,sliceId:s,s:a,key:s})))),rt=({indexes:e,indexesId:t,indexId:s,sliceId:l,s:a})=>{const n=Ie("i",t,s,l),[r,o]=fe(n,a);return F(Le,{uniqueId:n,summary:"Slice: "+l,editable:r,handleEditable:o,s:a},F(_e,{sliceId:l,indexId:s,indexes:e,editable:r}))},ot=({indexesId:e,s:t})=>{const l=s.useIndexes(e),a=s.useIndexIds(l);return q(l)?null:F(Le,{uniqueId:Ie("i",e),summary:"Indexes: "+(e??u),s:t},W(a)?"No indexes defined":pe(a,(s=>F(nt,{indexes:l,indexesId:e,indexId:s,s:t,key:s}))))},it=({metrics:e,metricId:t})=>F("tr",null,F("th",null,t),F("td",null,e?.getTableId(t)),F("td",null,s.useMetric(t,e))),dt=({metricsId:e,s:t})=>{const l=s.useMetrics(e),a=s.useMetricIds(l);return q(l)?null:F(Le,{uniqueId:Ie("m",e),summary:"Metrics: "+(e??u),s:t},W(a)?"No metrics defined":F("table",null,F("thead",null,F("th",null,"Metric Id"),F("th",null,"Table Id"),F("th",null,"Metric")),F("tbody",null,j(a,(e=>F(it,{metrics:l,metricId:e,key:e}))))))},ut=({queries:e,queriesId:t,queryId:l,s:a})=>{const n=Ie("q",t,l),[r,o,i]=re(s.useCell(ue,n,ce,a)??"[]"),d=s.useSetCellCallback(ue,n,ce,ne,[],a);return F(Le,{uniqueId:n,summary:"Query: "+l,s:a},F(tt,{queryId:l,queries:e,cellId:r,descending:o,offset:i,limit:10,paginator:!0,sortOnClick:!0,onChange:d}))},ct=({queriesId:e,s:t})=>{const l=s.useQueries(e),a=s.useQueryIds(l);return q(l)?null:F(Le,{uniqueId:Ie("q",e),summary:"Queries: "+(e??u),s:t},W(a)?"No queries defined":pe(a,(s=>F(ut,{queries:l,queriesId:e,queryId:s,s:t,key:s}))))},ht=({relationships:e,relationshipsId:t,relationshipId:s,s:l})=>{const a=Ie("r",t,s),[n,r]=fe(a,l);return F(Le,{uniqueId:a,summary:"Relationship: "+s,editable:n,handleEditable:r,s:l},F(et,{relationshipId:s,relationships:e,editable:n}))},mt=({relationshipsId:e,s:t})=>{const l=s.useRelationships(e),a=s.useRelationshipIds(l);return q(l)?null:F(Le,{uniqueId:Ie("r",e),summary:"Relationships: "+(e??u),s:t},W(a)?"No relationships defined":pe(a,(s=>F(ht,{relationships:l,relationshipsId:e,relationshipId:s,s:t,key:s}))))},bt=({tableId:e,store:t,storeId:l,s:a})=>{const n=Ie("t",l,e),[r,o,i]=re(s.useCell(ue,n,ce,a)??"[]"),d=s.useSetCellCallback(ue,n,ce,ne,[],a),[u,c]=fe(n,a);return F(Le,{uniqueId:n,summary:h+": "+e,editable:u,handleEditable:c,s:a},F(Ye,{tableId:e,store:t,cellId:r,descending:o,offset:i,limit:10,paginator:!0,sortOnClick:!0,onChange:d,editable:u}))},gt=({store:e,storeId:t,s:l})=>{const a=Ie("v",t),[n,r]=fe(a,l);return W(s.useValueIds(e))?null:F(Le,{uniqueId:a,summary:C,editable:n,handleEditable:r,s:l},F(Ze,{store:e,editable:n}))},It=({storeId:e,s:t})=>{const l=s.useStore(e),a=s.useTableIds(l);return q(l)?null:F(Le,{uniqueId:Ie("s",e),summary:"Store: "+(e??u),s:t},F(gt,{storeId:e,store:l,s:t}),pe(a,(s=>F(bt,{store:l,storeId:e,tableId:s,s:t,key:s}))))},pt=({s:e})=>{const t=B(null),l=B(0),[a,n]=H(!1),{scrollLeft:r,scrollTop:o}=s.useValues(e);P((()=>{const e=t.current;if(e&&!a){const t=new MutationObserver((()=>{e.scrollWidth>=x(r)+e.clientWidth&&e.scrollHeight>=x(o)+e.clientHeight&&e.scrollTo(r,o)}));return t.observe(e,{childList:!0,subtree:!0}),()=>t.disconnect()}}),[a,r,o]);const i=J((t=>{const{scrollLeft:s,scrollTop:a}=t[k];cancelIdleCallback(l.current),l.current=requestIdleCallback((()=>{n(!0),e.setPartialValues({scrollLeft:s,scrollTop:a})}))}),[e]),d=s.useStore(),u=s.useStoreIds(),c=s.useMetrics(),h=s.useMetricsIds(),m=s.useIndexes(),b=s.useIndexesIds(),g=s.useRelationships(),I=s.useRelationshipsIds(),p=s.useQueries(),f=s.useQueriesIds();return q(d)&&W(u)&&q(c)&&W(h)&&q(m)&&W(b)&&q(g)&&W(I)&&q(p)&&W(f)?F("span",{className:"warn"},"There are no Stores or other objects to inspect. Make sure you placed the StoreInspector inside a Provider component."):F("article",{ref:t,onScroll:i},F(It,{s:e}),j(u,(t=>F(It,{storeId:t,s:e,key:t}))),F(dt,{s:e}),j(h,(t=>F(dt,{metricsId:t,s:e,key:t}))),F(ot,{s:e}),j(b,(t=>F(ot,{indexesId:t,s:e,key:t}))),F(mt,{s:e}),j(I,(t=>F(mt,{relationshipsId:t,s:e,key:t}))),F(ct,{s:e}),j(f,(t=>F(ct,{queriesId:t,s:e,key:t}))))};class ft extends O{constructor(e){super(e),this.componentDidCatch=(e,t)=>console.error(e,t.componentStack),this.state={e:0}}static{this.getDerivedStateFromError=()=>({e:1})}render(){return this.state.e?F("span",{className:"warn"},"Inspector error: please see console for details."):this.props.children}}const wt=({s:e})=>{const t=s.useValue(me,e)??1,l=s.useSetValueCallback(be,(()=>!1),[],e),a=s.useSetValueCallback(me,(e=>Number(e[k].dataset.id)),[],e);return F("header",null,F("img",{title:ie}),F("span",null,ie),j(de,((e,s)=>s==t?null:F("img",{onClick:a,"data-id":s,title:"Dock to "+e,key:s}))),F("img",{onClick:l,title:"Close"}))},yt=({s:e})=>{const t=s.useValue(me,e)??1;return s.useValue(be,e)?F("main",{"data-position":t},F(wt,{s:e}),F(ft,null,F(pt,{s:e}))):null},Ct=e=>t=>{return s=(t,s)=>t+e(s),Rt(t).reduce(s,0);var s},vt=e=>e?.size??0,kt=Ct(vt),Tt=Ct(kt),St=Ct(Tt),xt=(e,t)=>e?.has(t)??!1,Vt=e=>q(e)||0==vt(e),Rt=e=>[...e?.values()??[]],qt=e=>e.clear(),Nt=(e,t)=>e?.forEach(t),Lt=(e,t)=>e?.delete(t),Mt=e=>new Map(e),Et=e=>[...e?.keys()??[]],zt=(e,t)=>e?.get(t),$t=(e,t)=>Nt(e,((e,s)=>t(s,e))),Ot=(e,t,s)=>q(s)?(Lt(e,t),e):e?.set(t,s),At=(e,t,s)=>(xt(e,t)||Ot(e,t,s()),zt(e,t)),Ft=(e,t,s,l=Ot)=>(le(t,((t,l)=>s(e,l,t))),$t(e,(s=>te(t,s)?0:l(e,s))),e),Jt=(e,t,s)=>{const l={};return Nt(e,((e,a)=>{const n=t?t(e,a):e;!s?.(n,e)&&(l[a]=n)})),l},Pt=(e,t,s)=>Jt(e,(e=>Jt(e,t,s)),ae),Bt=(e,t,s)=>Jt(e,(e=>Pt(e,t,s)),ae),Ht=(e,t)=>{const s=Mt();return Nt(e,((e,l)=>s.set(l,t?.(e)??e))),s},Dt=e=>Ht(e,Ht),Qt=e=>Ht(e,Dt),jt=(e,t,s,l,a=0)=>N((s?At:zt)(e,t[a],a>$(t)-2?s:Mt),(n=>{if(a>$(t)-2)return l?.(n)&&Ot(e,t[a]),n;const r=jt(n,t,s,l,a+1);return Vt(n)&&Ot(e,t[a]),r})),Wt=Mt(),Ut=Mt(),Gt="storage",Kt=globalThis.window,Xt=e=>new Set(E(e)||q(e)?e:[e]),Yt=(e,t)=>e?.add(t),Zt=/^\d+$/,_t=()=>{const e=[];let t=0;return[s=>(s?G(e):null)??a+t++,t=>{Zt.test(t)&&$(e)<1e3&&U(e,t)}]},es=e=>[e,e],ts=(e,t=kt)=>t(e[0])+t(e[1]),ss=()=>[Mt(),Mt()],ls=e=>[...e],as=([e,t])=>e===t,ns=(e,t,s)=>q(e)||!_(e)||ae(e)||Y(e)?(s?.(),!1):(le(e,((s,l)=>{t(s,l)||se(e,l)})),!ae(e)),rs=(e,t,s)=>Ot(e,t,zt(e,t)==-s?void 0:s),os=()=>{let e,t,s=!1,l=!1,n=0;const r=Mt(),i=Mt(),c=Mt(),k=Mt(),T=Mt(),x=Mt(),V=Mt(),R=Mt(),E=Mt(),O=Mt(),A=Mt(),F=Mt(),J=Mt(),P=Mt(),B=Xt(),H=Mt(),D=Mt(),W=Mt(),G=Mt(),K=ss(),X=ss(),Y=ss(),_=ss(),ee=ss(),oe=ss(),ie=ss(),de=ss(),ue=ss(),ce=ss(),he=ss(),me=ss(),be=ss(),ge=ss(),Ie=ss(),pe=Mt(),fe=ss(),[we,ye,Ce,ve]=(e=>{let t;const[s,l]=_t(),n=Mt();return[(e,l,r,o=[],i=(()=>[]))=>{t??=ws;const d=s(1);return Ot(n,d,[e,l,r,o,i]),Yt(jt(l,r??[a],Xt),d),d},(e,s,...l)=>Q(((e,t=[a])=>{const s=[],l=(e,a)=>a==$(t)?U(s,e):null===t[a]?Nt(e,(e=>l(e,a+1))):Q([t[a],null],(t=>l(zt(e,t),a+1)));return l(e,0),s})(e,s),(e=>Nt(e,(e=>zt(n,e)[0](t,...s??[],...l))))),e=>N(zt(n,e),(([,t,s])=>(jt(t,s??[a],void 0,(t=>(Lt(t,e),Vt(t)?1:0))),Ot(n,e),l(e),s))),e=>N(zt(n,e),(([e,,s=[],l,a])=>{const n=(...r)=>{const o=$(r);o==$(s)?e(t,...r,...a(r)):q(s[o])?Q(l[o]?.(...r)??[],(e=>n(...r,e))):n(...r,s[o])};n()}))]})(),ke=e=>{if(!ns(e,((e,t)=>[d,u].includes(t))))return!1;const t=e[d];return!(!L(t)&&t!=o||(Me(e[u])!=t&&se(e,u),0))},Te=(t,s)=>(!e||xt(A,s)||lt(s))&&ns(t,((e,t)=>Se(s,t,e)),(()=>lt(s))),Se=(e,t,s,l)=>ns(l?s:qe(s,e,t),((l,a)=>N(xe(e,t,a,l),(e=>(s[a]=e,!0)),(()=>!1))),(()=>lt(e,t))),xe=(t,s,l,a)=>e?N(zt(zt(A,t),l),(e=>Me(a)!=e[d]?lt(t,s,l,a,e[u]):a),(()=>lt(t,s,l,a))):q(Me(a))?lt(t,s,l,a):a,Ve=(e,t)=>ns(t?e:Ne(e),((t,s)=>N(Re(s,t),(t=>(e[s]=t,!0)),(()=>!1))),(()=>at())),Re=(e,s)=>t?N(zt(J,e),(t=>Me(s)!=t[d]?at(e,s,t[u]):s),(()=>at(e,s))):q(Me(s))?at(e,s):s,qe=(e,t,s)=>(N(zt(F,t),(([l,a])=>{Nt(l,((t,s)=>{te(e,s)||(e[s]=t)})),Nt(a,(l=>{te(e,l)||lt(t,s,l)}))})),e),Ne=e=>(t&&(Nt(P,((t,s)=>{te(e,s)||(e[s]=t)})),Nt(B,(t=>{te(e,t)||at(t)}))),e),Le=e=>Ft(A,e,((e,t,s)=>{const l=Mt(),a=Xt();Ft(At(A,t,Mt),s,((e,t,s)=>{Ot(e,t,s),N(s[u],(e=>Ot(l,t,e)),(()=>Yt(a,t)))})),Ot(F,t,[l,a])}),((e,t)=>{Ot(A,t),Ot(F,t)})),$e=e=>Ft(J,e,((e,t,s)=>{Ot(J,t,s),N(s[u],(e=>Ot(P,t,e)),(()=>Yt(B,t)))}),((e,t)=>{Ot(J,t),Ot(P,t),Lt(B,t)})),Oe=e=>ae(e)?us():Gt(e),Ae=e=>Ft(W,e,((e,t,s)=>Fe(t,s)),((e,t)=>Ue(t))),Fe=(e,t)=>Ft(At(W,e,(()=>(Ye(e,1),Ot(H,e,_t()),Ot(D,e,Mt()),Mt()))),t,((t,s,l)=>Je(e,t,s,l)),((t,s)=>Ge(e,t,s))),Je=(e,t,s,l,a)=>Ft(At(t,s,(()=>(Ze(e,s,1),Mt()))),l,((t,l,a)=>Pe(e,s,t,l,a)),((l,n)=>Ke(e,t,s,l,n,a))),Pe=(e,t,s,l,a)=>{xt(s,l)||_e(e,t,l,1);const n=zt(s,l);a!==n&&(et(e,t,l,n,a),Ot(s,l,a))},Be=(e,t,s,l,a)=>N(zt(t,s),(t=>Pe(e,s,t,l,a)),(()=>Je(e,t,s,qe({[l]:a},e,s)))),He=e=>ae(e)?ms():Kt(e),De=e=>Ft(G,e,((e,t,s)=>Qe(t,s)),((e,t)=>Xe(t))),Qe=(e,t)=>{xt(G,e)||tt(e,1);const s=zt(G,e);t!==s&&(st(e,s,t),Ot(G,e,t))},je=(e,t)=>{const[s]=zt(H,e),l=s(t);return xt(zt(W,e),l)?je(e,t):l},We=e=>zt(W,e)??Fe(e,{}),Ue=e=>Fe(e,{}),Ge=(e,t,s)=>{const[,l]=zt(H,e);l(s),Je(e,t,s,{},!0)},Ke=(e,t,s,l,a,n)=>{const r=zt(zt(F,e)?.[0],a);if(!q(r)&&!n)return Pe(e,s,l,a,r);const o=t=>{et(e,s,t,zt(l,t)),_e(e,s,t,-1),Ot(l,t)};q(r)?o(a):$t(l,o),Vt(l)&&(Ze(e,s,-1),Vt(Ot(t,s))&&(Ye(e,-1),Ot(W,e),Ot(H,e),Ot(D,e)))},Xe=e=>{const t=zt(P,e);if(!q(t))return Qe(e,t);st(e,zt(G,e)),tt(e,-1),Ot(G,e)},Ye=(e,t)=>rs(r,e,t),Ze=(e,t,s)=>rs(At(k,e,Mt),t,s)&&Ot(c,e,At(c,e,(()=>0))+s),_e=(e,t,s,l)=>{const a=zt(D,e),n=zt(a,s)??0;(0==n&&1==l||1==n&&-1==l)&&rs(At(i,e,Mt),s,l),Ot(a,s,n!=-l?n+l:null),rs(At(At(T,e,Mt),t,Mt),s,l)},et=(e,t,s,l,a)=>At(At(At(x,e,Mt),t,Mt),s,(()=>[l,0]))[1]=a,tt=(e,t)=>rs(V,e,t),st=(e,t,s)=>At(R,e,(()=>[t,0]))[1]=s,lt=(e,t,s,l,a)=>(U(At(At(At(E,e,Mt),t,Mt),s,(()=>[])),l),a),at=(e,t,s)=>(U(At(O,e,(()=>[])),t),s),nt=(e,t,s)=>N(zt(zt(zt(x,e),t),s),(([e,t])=>[!0,e,t]),(()=>[!1,...es(Ct(e,t,s))])),rt=e=>N(zt(R,e),(([e,t])=>[!0,e,t]),(()=>[!1,...es(Ut(e))])),ot=e=>Vt(E)||Vt(he[e])?0:Nt(e?Qt(E):E,((t,s)=>Nt(t,((t,l)=>Nt(t,((t,a)=>ye(he[e],[s,l,a],t))))))),it=e=>Vt(O)||Vt(me[e])?0:Nt(e?Ht(O):O,((t,s)=>ye(me[e],[s],t))),dt=(e,t,s)=>{if(!Vt(t))return ye(e,s,(()=>Jt(t))),1},ut=e=>{const t=Vt(ie[e]),s=Vt(ue[e])&&Vt(_[e])&&Vt(ee[e])&&Vt(oe[e])&&t&&Vt(X[e]),l=Vt(ce[e])&&Vt(de[e])&&Vt(Y[e])&&Vt(K[e]);if(!s||!l){const a=e?[Ht(r),Dt(i),Ht(c),Dt(k),Qt(T),Qt(x)]:[r,i,c,k,T,x];if(!s){dt(X[e],a[0]),Nt(a[1],((t,s)=>dt(_[e],t,[s]))),Nt(a[2],((t,s)=>{0!=t&&ye(ee[e],[s],pt(s))}));const s=Xt();Nt(a[3],((l,a)=>{dt(oe[e],l,[a])&&!t&&(ye(ie[e],[a,null]),Yt(s,a))})),t||Nt(a[5],((t,l)=>{if(!xt(s,l)){const s=Xt();Nt(t,(e=>Nt(e,(([t,l],a)=>l!==t?Yt(s,a):Lt(e,a))))),Nt(s,(t=>ye(ie[e],[l,t])))}})),Nt(a[4],((t,s)=>Nt(t,((t,l)=>dt(ue[e],t,[s,l])))))}if(!l){let t;Nt(a[5],((s,l)=>{let a;Nt(s,((s,n)=>{let r;Nt(s,(([s,o],i)=>{o!==s&&(ye(ce[e],[l,n,i],o,s,nt),t=a=r=1)})),r&&ye(de[e],[l,n],nt)})),a&&ye(Y[e],[l],nt)})),t&&ye(K[e],void 0,nt)}}},ct=e=>{const t=Vt(ge[e]),s=Vt(Ie[e])&&Vt(be[e]);if(!t||!s){const l=e?[Ht(V),Ht(R)]:[V,R];if(t||dt(ge[e],l[0]),!s){let t;Nt(l[1],(([s,l],a)=>{l!==s&&(ye(Ie[e],[a],l,s,rt),t=1)})),t&&ye(be[e],void 0,rt)}}},ht=(e,...t)=>(Is((()=>e(...j(t,S)))),ws),mt=()=>[Jt(x,((e,t)=>-1===zt(r,t)?null:Jt(e,((e,s)=>-1===zt(zt(k,t),s)?null:Jt(e,(([,e])=>e??null),((e,t)=>as(t)))),ae)),ae),Jt(R,(([,e])=>e??null),((e,t)=>as(t)))],bt=()=>({cellsTouched:s,valuesTouched:l,changedCells:Bt(x,ls,as),invalidCells:Bt(E),changedValues:Jt(R,ls,as),invalidValues:Jt(O),changedTableIds:Jt(r),changedRowIds:Pt(k),changedCellIds:Bt(T),changedValueIds:Jt(V)}),gt=()=>Bt(W),It=()=>Et(W),pt=e=>vt(zt(W,S(e))),ft=e=>Et(zt(W,S(e))),wt=(e,t,s,l=0,a)=>{return j(z((r=zt(W,S(e)),o=(e,s)=>[q(t)?s:zt(e,S(t)),s],n=([e],[t])=>((e??0)<(t??0)?-1:1)*(s?-1:1),j([...r?.entries()??[]],(([e,t])=>o(t,e))).sort(n)),l,q(a)?a:l+a),(([,e])=>e));var n,r,o},yt=(e,t)=>Et(zt(zt(W,S(e)),S(t))),Ct=(e,t,s)=>zt(zt(zt(W,S(e)),S(t)),S(s)),Rt=()=>Jt(G),Wt=()=>Et(G),Ut=e=>zt(G,S(e)),Gt=e=>ht((()=>(e=>ns(e,Te,lt))(e)?Ae(e):0)),Kt=e=>ht((()=>Ve(e)?De(e):0)),Zt=e=>{try{Oe(re(e))}catch{}return ws},is=t=>ht((()=>{if((e=ns(t,(e=>ns(e,ke))))&&(Le(t),!Vt(W))){const e=gt();us(),Gt(e)}})),ds=e=>ht((()=>{if(t=(e=>ns(e,ke))(e)){const s=Rt();gs(),ms(),t=!0,$e(e),Kt(s)}})),us=()=>ht((()=>Ae({}))),cs=e=>ht((e=>xt(W,e)?Ue(e):0),e),hs=(e,t)=>ht(((e,t)=>N(zt(W,e),(s=>xt(s,t)?Ge(e,s,t):0))),e,t),ms=()=>ht((()=>De({}))),bs=()=>ht((()=>{Le({}),e=!1})),gs=()=>ht((()=>{$e({}),t=!1})),Is=(e,t)=>{if(-1!=n){ps();const s=e();return fs(t),s}},ps=()=>(-1!=n&&n++,1==n&&ye(pe,void 0,mt,bt),ws),fs=e=>(n>0&&(n--,0==n&&(s=!Vt(x),l=!Vt(R),n=1,ot(1),s&&ut(1),it(1),l&&ct(1),e?.(mt,bt)&&(Nt(x,((e,t)=>Nt(e,((e,s)=>Nt(e,(([e],l)=>Ee(ws,t,s,l,e))))))),Nt(R,(([e],t)=>ze(ws,t,e))),s=l=!1),ye(fe[0],void 0,mt,bt),n=-1,ot(0),s&&ut(0),it(0),l&&ct(0),ye(fe[1],void 0,mt,bt),n=0,s=l=!1,Q([r,i,c,k,T,x,E,V,R,O],qt))),ws),ws={getContent:()=>[gt(),Rt()],getTables:gt,getTableIds:It,getTable:e=>Pt(zt(W,S(e))),getTableCellIds:e=>Et(zt(D,S(e))),getRowCount:pt,getRowIds:ft,getSortedRowIds:wt,getRow:(e,t)=>Jt(zt(zt(W,S(e)),S(t))),getCellIds:yt,getCell:Ct,getValues:Rt,getValueIds:Wt,getValue:Ut,hasTables:()=>!Vt(W),hasTable:e=>xt(W,S(e)),hasTableCell:(e,t)=>xt(zt(D,S(e)),S(t)),hasRow:(e,t)=>xt(zt(W,S(e)),S(t)),hasCell:(e,t,s)=>xt(zt(zt(W,S(e)),S(t)),S(s)),hasValues:()=>!Vt(G),hasValue:e=>xt(G,S(e)),getTablesJson:()=>ne(W),getValuesJson:()=>ne(G),getJson:()=>ne([W,G]),getTablesSchemaJson:()=>ne(A),getValuesSchemaJson:()=>ne(J),getSchemaJson:()=>ne([A,J]),hasTablesSchema:()=>e,hasValuesSchema:()=>t,setContent:([e,t])=>ht((()=>{(ae(e)?us:Gt)(e),(ae(t)?ms:Kt)(t)})),setTables:Gt,setTable:(e,t)=>ht((e=>Te(t,e)?Fe(e,t):0),e),setRow:(e,t,s)=>ht(((e,t)=>Se(e,t,s)?Je(e,We(e),t,s):0),e,t),addRow:(e,t,s=!0)=>Is((()=>{let l;return Se(e,l,t)&&(e=S(e),Je(e,We(e),l=je(e,s?1:0),t)),l})),setPartialRow:(e,t,s)=>ht(((e,t)=>{if(Se(e,t,s,1)){const l=We(e);le(s,((s,a)=>Be(e,l,t,a,s)))}}),e,t),setCell:(e,t,s,l)=>ht(((e,t,s)=>N(xe(e,t,s,M(l)?l(Ct(e,t,s)):l),(l=>Be(e,We(e),t,s,l)))),e,t,s),setValues:Kt,setPartialValues:e=>ht((()=>Ve(e,1)?le(e,((e,t)=>Qe(t,e))):0)),setValue:(e,t)=>ht((e=>N(Re(e,M(t)?t(Ut(e)):t),(t=>Qe(e,t)))),e),setTransactionChanges:e=>ht((()=>{le(e[0],((e,t)=>q(e)?cs(t):le(e,((e,s)=>q(e)?hs(t,s):le(e,((e,l)=>Ee(ws,t,s,l,e))))))),le(e[1],((e,t)=>ze(ws,t,e)))})),setTablesJson:Zt,setValuesJson:e=>{try{He(re(e))}catch{}return ws},setJson:e=>ht((()=>{try{const[t,s]=re(e);Oe(t),He(s)}catch{Zt(e)}})),setTablesSchema:is,setValuesSchema:ds,setSchema:(e,t)=>ht((()=>{is(e),ds(t)})),delTables:us,delTable:cs,delRow:hs,delCell:(e,t,s,l)=>ht(((e,t,s)=>N(zt(W,e),(a=>N(zt(a,t),(n=>xt(n,s)?Ke(e,a,t,n,s,l):0))))),e,t,s),delValues:ms,delValue:e=>ht((e=>xt(G,e)?Xe(e):0),e),delTablesSchema:bs,delValuesSchema:gs,delSchema:()=>ht((()=>{bs(),gs()})),transaction:Is,startTransaction:ps,finishTransaction:fs,forEachTable:e=>Nt(W,((t,s)=>e(s,(e=>Nt(t,((t,s)=>e(s,(e=>$t(t,e))))))))),forEachTableCell:(e,t)=>$t(zt(D,S(e)),t),forEachRow:(e,t)=>Nt(zt(W,S(e)),((e,s)=>t(s,(t=>$t(e,t))))),forEachCell:(e,t,s)=>$t(zt(zt(W,S(e)),S(t)),s),forEachValue:e=>$t(G,e),addSortedRowIdsListener:(e,t,s,l,a,n,r)=>{let o=wt(e,t,s,l,a);return we((()=>{const r=wt(e,t,s,l,a);var i,d,u;d=o,$(i=r)===$(d)&&(u=(e,t)=>d[t]===e,i.every(u))||(o=r,n(ws,e,t,s,l,a,o))}),ie[r?1:0],[e,t],[It])},addStartTransactionListener:e=>we(e,pe),addWillFinishTransactionListener:e=>we(e,fe[0]),addDidFinishTransactionListener:e=>we(e,fe[1]),callListener:e=>(ve(e),ws),delListener:e=>(Ce(e),ws),getListenerStats:()=>({tables:ts(K),tableIds:ts(X),tableCellIds:ts(_),table:ts(Y),rowCount:ts(ee),rowIds:ts(oe),sortedRowIds:ts(ie),row:ts(de,Tt),cellIds:ts(ue,Tt),cell:ts(ce,St),invalidCell:ts(he,St),values:ts(be),valueIds:ts(ge),value:ts(Ie),invalidValue:ts(me),transaction:kt(pe)+ts(fe)}),createStore:os,addListener:we,callListeners:ye};return le({[m]:[0,K],[b]:[0,X],[h]:[1,Y,[It]],[h+w]:[1,_,[It]],[I]:[1,ee,[It]],[p]:[1,oe,[It]],[g]:[2,de,[It,ft]],[w]:[2,ue,[It,ft]],[f]:[3,ce,[It,ft,yt],e=>es(Ct(...e))],InvalidCell:[3,he],[C]:[0,be],[v]:[0,ge],[y]:[1,Ie,[Wt],e=>es(Ut(e[0]))],InvalidValue:[1,me]},(([e,t,s,l],a)=>{ws["add"+a+"Listener"]=(...a)=>we(a[e],t[a[e+1]?1:0],e>0?z(a,0,e):void 0,s,l)})),Z(ws)},is=({position:e="right",open:t=!1})=>{const l=s.useCreateStore(os),a=de.indexOf(e);return s.useCreatePersister(l,(e=>{return((e,t,s,l)=>((e,t,s,l,a,n,r=[])=>{let o,i,d,u=0,c=0,h=0,m=0;At(Wt,r,(()=>0)),At(Ut,r,(()=>[]));const b=async e=>(2!=u&&(u=1,c++,await g.schedule((async()=>{await e(),u=0}))),g),g={load:async(s,l)=>await b((async()=>{try{e.setContent(await t())}catch{e.setContent([s,l])}})),startAutoLoad:async(s={},a={})=>(g.stopAutoLoad(),await g.load(s,a),m=1,d=l((async(s,l)=>{if(l){const t=l();await b((async()=>e.setTransactionChanges(t)))}else await b((async()=>{try{e.setContent(s?.()??await t())}catch(e){n?.(e)}}))})),g),stopAutoLoad:()=>(m&&(a(d),d=void 0,m=0),g),save:async t=>(1!=u&&(u=2,h++,await g.schedule((async()=>{try{await s(e.getContent,t)}catch(e){n?.(e)}u=0}))),g),startAutoSave:async()=>(await g.stopAutoSave().save(),o=e.addDidFinishTransactionListener(((e,t)=>{const[s,l]=t();ae(s)&&ae(l)||g.save((()=>[s,l]))})),g),stopAutoSave:()=>(N(o,e.delListener),g),schedule:async(...e)=>(U(zt(Ut,r),...e),await(async()=>{if(!zt(Wt,r)){for(Ot(Wt,r,1);!q(i=G(zt(Ut,r)));)try{await i()}catch(e){n?.(e)}Ot(Wt,r,0)}})(),g),getStore:()=>e,destroy:()=>g.stopAutoLoad().stopAutoSave(),getStats:()=>({loads:c,saves:h})};return Z(g)})(e,(async()=>re(s.getItem(t))),(async e=>s.setItem(t,ne(e()))),(e=>{const l=l=>{l.storageArea===s&&l.key===t&&e((()=>re(l.newValue)))};return Kt.addEventListener(Gt,l),l}),(e=>Kt.removeEventListener(Gt,e)),l))(e,oe,sessionStorage,t);var t}),void 0,(async e=>{await e.load(void 0,{position:-1==a?1:a,open:!!t}),await e.startAutoSave()})),F(A,null,F("aside",{id:oe},F(Ne,{s:l}),F(yt,{s:l})),F("style",null,qe))};e.EditableCellView=st,e.EditableValueView=lt,e.RelationshipInHtmlTable=et,e.ResultSortedTableInHtmlTable=tt,e.ResultTableInHtmlTable=({queryId:e,queries:t,customCells:l,...a})=>F(Ue,{...a,params:He(We(s.useResultTableCellIds(e,t),l,s.ResultCellView),Qe(t,e),s.useResultRowIds(e,t))}),e.SliceInHtmlTable=_e,e.SortedTableInHtmlTable=Ye,e.SortedTablePaginator=at,e.StoreInspector=e=>F(is,{...e}),e.TableInHtmlTable=({tableId:e,store:t,editable:l,customCells:a,...n})=>F(Ue,{...n,params:He(We(s.useTableCellIds(e,t),a,l?st:s.CellView),De(t,e),s.useRowIds(e,t))}),e.ValuesInHtmlTable=Ze},"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("./ui-react")):"function"==typeof define&&define.amd?define(["exports","react","./ui-react"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).TinyBaseUiReactDomDebug={},e.React,e.TinyBaseUiReact);
1
+ var e,t;e=this,t=function(e,t,s){"use strict";const l=e=>typeof e,a="",n=l(a),o=l(!0),r=l(0),i=l(l),d="type",u="default",c="Ids",h="Table",m=h+"s",b=h+c,g="Row",p=g+"Count",I=g+c,f="Cell",w=f+c,y="Value",C=y+"s",v=y+c,k="currentTarget",T="value",S=e=>a+e,x=Math.floor,V=isFinite,R=(e,t)=>e instanceof t,q=e=>null==e,N=(e,t,s)=>q(e)?s?.():t(e),L=e=>e==n||e==o,M=e=>l(e)==i,E=e=>Array.isArray(e),z=(e,t,s)=>e.slice(t,s),$=e=>e.length,{PureComponent:O,Fragment:A,createElement:F,useCallback:J,useLayoutEffect:P,useRef:B,useState:H}=t,D=(e,...t)=>q(e)?{}:e(...t),Q=(e,t)=>e.forEach(t),j=(e,t)=>e.map(t),W=e=>0==$(e),U=(e,...t)=>e.push(...t),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),te=(e,t)=>!q(((e,t)=>N(e,(e=>e[t])))(e,t)),se=(e,t)=>(delete e[t],e),le=(e,t)=>j(K.entries(e),(([e,s])=>t(s,e))),ae=e=>_(e)&&0==(e=>$(X(e)))(e),ne=e=>JSON.stringify(e,((e,t)=>R(t,Map)?K.fromEntries([...t]):t)),oe=JSON.parse,re="tinybaseStoreInspector",ie="TinyBase Store Inspector",de=["left","top","bottom","right","full"],ue="state",ce="sort",he="open",me="position",be=he,ge="editable",pe=(...e)=>ne(e),Ie=(e,t)=>j(e.sort(),t),fe=(e,t)=>[!!s.useCell(ue,e,ge,t),J((s=>{t.setCell(ue,e,ge,(e=>!e)),s.preventDefault()}),[t,e])],we="M20 80l5-15l40-40l10 10l-40 40l-15 5m5-15l10 10",ye='content:url("',Ce=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'>",ve='</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\")",Te=j([[20,20,20,60],[20,20,60,20],[20,60,60,20],[60,20,20,60],[30,30,40,40]],(([e,t,s,l])=>Ce+`<rect x='20' y='20' width='60' height='60' fill='grey'/><rect x='${e}' y='${t}' width='${s}' height='${l}' fill='white'/>`+ve)),Se=Ce+"<path d='M20 20l60 60M20 80l60-60' />"+ve,xe=Ce+`<path d='${we}' />`+ve,Ve=Ce+`<path d='${we}M20 20l60 60' />`+ve,Re="*::-webkit-scrollbar",qe=`#${re}{\n all:initial;font-family:sans-serif;font-size:0.75rem;position:fixed;z-index:999999;\n ${((e,t="")=>e.join(t))(le({"*":"all:revert","*::before":"all:revert","*::after":"all:revert",[Re]:"width:0.5rem;height:0.5rem;",[Re+"-track"]:"background:#111",[Re+"-thumb"]:"background:#999;border:1px solid #111",[Re+"-thumb:hover"]:"background:#fff",[Re+"-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(j(["bottom:0;left:0","top:0;right:0"],((e,t)=>[`>img[data-position='${t}']`,e]))),main:"display:flex;flex-direction:column;background:#111d;color:#fff;position:fixed;",...ee(j(["bottom:0;left:0;width:35vw;height:100vh","top:0;right:0;width:100vw;height:30vh","bottom:0;left:0;width:100vw;height:30vh","top:0;right:0;width:35vw;height:100vh","top:0;right:0;width:100vw;height:100vh"],((e,t)=>[`main[data-position='${t}']`,e]))),header:"display:flex;padding:0.25rem;background:#000;align-items:center","header>img:nth-of-type(1)":ke,"header>img:nth-of-type(6)":Se,...ee(j(Te,((e,t)=>[`header>img[data-id='${t}']`,e]))),"header>span":"flex:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;margin-left:0.25rem",article:"padding:0.25rem 0.25rem 0.25rem 0.5rem;overflow:auto;flex:1",details:"margin-left:0.75rem;width:fit-content;","details img":"display:none","details[open]>summary img":"display:unset;background:none;margin-left:0.25rem","details[open]>summary img.edit":xe,"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,t)=>e?`& ${t}{${e}}`:"")))}`,Ne=({s:e})=>{const t=s.useValue(me,e)??1,l=s.useSetValueCallback(be,(()=>!0),[],e);return s.useValue(be,e)?null:F("img",{onClick:l,title:ie,"data-position":t})},Le=({uniqueId:e,summary:t,editable:l,handleEditable:a,children:n,s:o})=>{const r=!!s.useCell(ue,e,he,o),i=s.useSetCellCallback(ue,e,he,(e=>e[k].open),[],o);return F("details",{open:r,onToggle:i},F("summary",null,t,a?F("img",{onClick:a,className:l?"done":"edit"}):null),n)},Me=e=>{const t=l(e);return L(t)||t==r&&V(e)?t:void 0},Ee=(e,t,s,l,a)=>q(a)?e.delCell(t,s,l,!0):e.setCell(t,s,l,a),ze=(e,t,s)=>q(s)?e.delValue(t):e.setValue(t,s),$e=(e,t,s,l)=>e==n?t:e==r?s:l,{useCallback:Oe,useMemo:Ae,useState:Fe}=t,Je="editable",Pe=(e,t)=>j(s.useTableCellIds(e,t),(t=>e+"."+t)),Be=(e,t,s)=>{const l=Oe(e,t);return s?l:void 0},He=(...e)=>Ae((()=>e),e),De=(e,t)=>Ae((()=>({store:e,tableId:t})),[e,t]),Qe=(e,t)=>Ae((()=>({queries:e,queryId:t})),[e,t]),je=(e,t=!1,s,l=0,a,n,o,r)=>{const[[i,d,u],c]=Fe([e,t,l]),h=Oe((e=>{c(e),r?.(e)}),[r]),m=Be((e=>h([e,e==i&&!d,u])),[h,i,d,u],s),b=Oe((e=>h([i,d,e])),[h,i,d]),g=!0===o?at:o;return[[i,d,u],m,Ae((()=>!1===o?null:F(g,{offset:u,limit:a,total:n,onChange:b})),[o,g,u,a,n,b])]},We=(e,t,s)=>Ae((()=>{const a=t??e;return ee(le(E(a)?ee(j(a,(e=>[e,e]))):a,((e,t)=>{return[t,{label:t,component:s,...(a=e,l(a)==n?{label:e}:e)}];var a})))}),[t,s,e]),Ue=({className:e,headerRow:t,idColumn:s,params:[l,a,n,o,r,i]})=>F("table",{className:e},i?F("caption",null,i):null,!1===t?null:F("thead",null,F("tr",null,!1===s?null:F(Ge,{sort:o??[],label:"Id",onClick:r}),le(l,(({label:e},t)=>F(Ge,{key:t,cellId:t,label:e,sort:o??[],onClick:r}))))),F("tbody",null,j(n,(e=>F("tr",{key:e},!1===s?null:F("th",null,e),le(l,(({component:t,getComponentProps:s},l)=>F("td",{key:l},F(t,{...D(s,e,l),...a,rowId:e,cellId:l}))))))))),Ge=({cellId:e,sort:[t,s],label:l=e??a,onClick:n})=>F("th",{onClick:Be((()=>n?.(e)),[n,e],n),className:q(s)||t!=e?void 0:`sorted ${s?"de":"a"}scending`},q(s)||t!=e?null:(s?"↓":"↑")+" ",l),Ke=({localRowId:e,params:[l,a,n,o,r,i,d]})=>{const u=s.useRemoteRowId(r,e,i);return F("tr",null,!1===l?null:F(t.Fragment,null,F("th",null,e),F("th",null,u)),le(a,(({component:t,getComponentProps:s},l)=>{const[a,r]=l.split(".",2),i=a===n?e:a===o?u:null;return q(i)?null:F("td",{key:l},F(t,{...D(s,i,r),store:d,tableId:a,rowId:i,cellId:r}))})))},Xe=({thing:e,onThingChange:t,className:s,hasSchema:l,showType:a=!0})=>{const[i,d]=Fe(),[u,c]=Fe(),[h,m]=Fe(),[b,g]=Fe(),[p,I]=Fe();u!==e&&(d(Me(e)),c(e),m(e+""),g(Number(e)||0),I(!!e));const f=Oe(((e,s)=>{s(e),c(e),t(e)}),[t]),w=Oe((()=>{if(!l?.()){const e=$e(i,r,o,n),s=$e(e,h,b,p);d(e),c(s),t(s)}}),[l,t,h,b,p,i]);return F("div",{className:s},a?F("button",{className:i,onClick:w},i):null,$e(i,F("input",{key:i,value:h,onChange:Oe((e=>f(e[k][T]+"",m)),[f])}),F("input",{key:i,type:"number",value:b,onChange:Oe((e=>f(Number(e[k][T]||0),g)),[f])}),F("input",{key:i,type:"checkbox",checked:p,onChange:Oe((e=>f(!!e[k].checked,I)),[f])})))},Ye=({tableId:e,cellId:t,descending:l,offset:a,limit:n,store:o,editable:r,sortOnClick:i,paginator:d=!1,onChange:u,customCells:c,...h})=>{const[m,b,g]=je(t,l,i,a,n,s.useRowCount(e,o),d,u);return F(Ue,{...h,params:He(We(s.useTableCellIds(e,o),c,r?st:s.CellView),De(o,e),s.useSortedRowIds(e,...m,n,o),m,b,g)})},Ze=({store:e,editable:t=!1,valueComponent:l=(t?lt:s.ValueView),getValueComponentProps:a,className:n,headerRow:o,idColumn:r})=>F("table",{className:n},!1===o?null:F("thead",null,F("tr",null,!1===r?null:F("th",null,"Id"),F("th",null,y))),F("tbody",null,j(s.useValueIds(e),(t=>F("tr",{key:t},!1===r?null:F("th",null,t),F("td",null,F(l,{...D(a,t),valueId:t,store:e}))))))),_e=({indexId:e,sliceId:t,indexes:l,editable:a,customCells:n,...o})=>{const[r,i,d]=((e,t)=>[e,e?.getStore(),e?.getTableId(t)])(s.useIndexesOrIndexesById(l),e);return F(Ue,{...o,params:He(We(s.useTableCellIds(d,i),n,a?st:s.CellView),De(i,d),s.useSliceRowIds(e,t,r))})},et=({relationshipId:e,relationships:l,editable:a,customCells:n,className:o,headerRow:r,idColumn:i=!0})=>{const[d,u,c,h]=((e,t)=>[e,e?.getStore(),e?.getLocalTableId(t),e?.getRemoteTableId(t)])(s.useRelationshipsOrRelationshipsById(l),e),m=We([...Pe(c,u),...Pe(h,u)],n,a?st:s.CellView),b=He(i,m,c,h,e,d,u);return F("table",{className:o},!1===r?null:F("thead",null,F("tr",null,!1===i?null:F(t.Fragment,null,F("th",null,c,".Id"),F("th",null,h,".Id")),le(m,(({label:e},t)=>F("th",{key:t},e))))),F("tbody",null,j(s.useRowIds(c,u),(e=>F(Ke,{key:e,localRowId:e,params:b})))))},tt=({queryId:e,cellId:t,descending:l,offset:a,limit:n,queries:o,sortOnClick:r,paginator:i=!1,customCells:d,onChange:u,...c})=>{const[h,m,b]=je(t,l,r,a,n,s.useResultRowCount(e,o),i,u);return F(Ue,{...c,params:He(We(s.useResultTableCellIds(e,o),d,s.ResultCellView),Qe(o,e),s.useResultSortedRowIds(e,...h,n,o),h,m,b)})},st=({tableId:e,rowId:t,cellId:l,store:a,className:n,showType:o})=>F(Xe,{thing:s.useCell(e,t,l,a),onThingChange:s.useSetCellCallback(e,t,l,(e=>e),[],a),className:n??Je+f,showType:o,hasSchema:s.useStoreOrStoreById(a)?.hasTablesSchema}),lt=({valueId:e,store:t,className:l,showType:a})=>F(Xe,{thing:s.useValue(e,t),onThingChange:s.useSetValueCallback(e,(e=>e),[],t),className:l??Je+y,showType:a,hasSchema:s.useStoreOrStoreById(t)?.hasValuesSchema}),at=({onChange:e,total:s,offset:l=0,limit:a=s,singular:n="row",plural:o=n+"s"})=>{(l>s||l<0)&&(l=0,e(0));const r=Be((()=>e(l-a)),[e,l,a],l>0),i=Be((()=>e(l+a)),[e,l,a],l+a<s);return F(t.Fragment,null,s>a&&F(t.Fragment,null,F("button",{className:"previous",disabled:0==l,onClick:r},"←"),F("button",{className:"next",disabled:l+a>=s,onClick:i},"→"),l+1," to ",Math.min(s,l+a)," of "),s," ",1!=s?o:n)},nt=({indexes:e,indexesId:t,indexId:l,s:a})=>F(Le,{uniqueId:pe("i",t,l),summary:"Index: "+l,s:a},j(s.useSliceIds(l,e),(s=>F(ot,{indexes:e,indexesId:t,indexId:l,sliceId:s,s:a,key:s})))),ot=({indexes:e,indexesId:t,indexId:s,sliceId:l,s:a})=>{const n=pe("i",t,s,l),[o,r]=fe(n,a);return F(Le,{uniqueId:n,summary:"Slice: "+l,editable:o,handleEditable:r,s:a},F(_e,{sliceId:l,indexId:s,indexes:e,editable:o}))},rt=({indexesId:e,s:t})=>{const l=s.useIndexes(e),a=s.useIndexIds(l);return q(l)?null:F(Le,{uniqueId:pe("i",e),summary:"Indexes: "+(e??u),s:t},W(a)?"No indexes defined":Ie(a,(s=>F(nt,{indexes:l,indexesId:e,indexId:s,s:t,key:s}))))},it=({metrics:e,metricId:t})=>F("tr",null,F("th",null,t),F("td",null,e?.getTableId(t)),F("td",null,s.useMetric(t,e))),dt=({metricsId:e,s:t})=>{const l=s.useMetrics(e),a=s.useMetricIds(l);return q(l)?null:F(Le,{uniqueId:pe("m",e),summary:"Metrics: "+(e??u),s:t},W(a)?"No metrics defined":F("table",null,F("thead",null,F("th",null,"Metric Id"),F("th",null,"Table Id"),F("th",null,"Metric")),F("tbody",null,j(a,(e=>F(it,{metrics:l,metricId:e,key:e}))))))},ut=({queries:e,queriesId:t,queryId:l,s:a})=>{const n=pe("q",t,l),[o,r,i]=oe(s.useCell(ue,n,ce,a)??"[]"),d=s.useSetCellCallback(ue,n,ce,ne,[],a);return F(Le,{uniqueId:n,summary:"Query: "+l,s:a},F(tt,{queryId:l,queries:e,cellId:o,descending:r,offset:i,limit:10,paginator:!0,sortOnClick:!0,onChange:d}))},ct=({queriesId:e,s:t})=>{const l=s.useQueries(e),a=s.useQueryIds(l);return q(l)?null:F(Le,{uniqueId:pe("q",e),summary:"Queries: "+(e??u),s:t},W(a)?"No queries defined":Ie(a,(s=>F(ut,{queries:l,queriesId:e,queryId:s,s:t,key:s}))))},ht=({relationships:e,relationshipsId:t,relationshipId:s,s:l})=>{const a=pe("r",t,s),[n,o]=fe(a,l);return F(Le,{uniqueId:a,summary:"Relationship: "+s,editable:n,handleEditable:o,s:l},F(et,{relationshipId:s,relationships:e,editable:n}))},mt=({relationshipsId:e,s:t})=>{const l=s.useRelationships(e),a=s.useRelationshipIds(l);return q(l)?null:F(Le,{uniqueId:pe("r",e),summary:"Relationships: "+(e??u),s:t},W(a)?"No relationships defined":Ie(a,(s=>F(ht,{relationships:l,relationshipsId:e,relationshipId:s,s:t,key:s}))))},bt=({tableId:e,store:t,storeId:l,s:a})=>{const n=pe("t",l,e),[o,r,i]=oe(s.useCell(ue,n,ce,a)??"[]"),d=s.useSetCellCallback(ue,n,ce,ne,[],a),[u,c]=fe(n,a);return F(Le,{uniqueId:n,summary:h+": "+e,editable:u,handleEditable:c,s:a},F(Ye,{tableId:e,store:t,cellId:o,descending:r,offset:i,limit:10,paginator:!0,sortOnClick:!0,onChange:d,editable:u}))},gt=({store:e,storeId:t,s:l})=>{const a=pe("v",t),[n,o]=fe(a,l);return W(s.useValueIds(e))?null:F(Le,{uniqueId:a,summary:C,editable:n,handleEditable:o,s:l},F(Ze,{store:e,editable:n}))},pt=({storeId:e,s:t})=>{const l=s.useStore(e),a=s.useTableIds(l);return q(l)?null:F(Le,{uniqueId:pe("s",e),summary:"Store: "+(e??u),s:t},F(gt,{storeId:e,store:l,s:t}),Ie(a,(s=>F(bt,{store:l,storeId:e,tableId:s,s:t,key:s}))))},It=({s:e})=>{const t=B(null),l=B(0),[a,n]=H(!1),{scrollLeft:o,scrollTop:r}=s.useValues(e);P((()=>{const e=t.current;if(e&&!a){const t=new MutationObserver((()=>{e.scrollWidth>=x(o)+e.clientWidth&&e.scrollHeight>=x(r)+e.clientHeight&&e.scrollTo(o,r)}));return t.observe(e,{childList:!0,subtree:!0}),()=>t.disconnect()}}),[a,o,r]);const i=J((t=>{const{scrollLeft:s,scrollTop:a}=t[k];cancelIdleCallback(l.current),l.current=requestIdleCallback((()=>{n(!0),e.setPartialValues({scrollLeft:s,scrollTop:a})}))}),[e]),d=s.useStore(),u=s.useStoreIds(),c=s.useMetrics(),h=s.useMetricsIds(),m=s.useIndexes(),b=s.useIndexesIds(),g=s.useRelationships(),p=s.useRelationshipsIds(),I=s.useQueries(),f=s.useQueriesIds();return q(d)&&W(u)&&q(c)&&W(h)&&q(m)&&W(b)&&q(g)&&W(p)&&q(I)&&W(f)?F("span",{className:"warn"},"There are no Stores or other objects to inspect. Make sure you placed the StoreInspector inside a Provider component."):F("article",{ref:t,onScroll:i},F(pt,{s:e}),j(u,(t=>F(pt,{storeId:t,s:e,key:t}))),F(dt,{s:e}),j(h,(t=>F(dt,{metricsId:t,s:e,key:t}))),F(rt,{s:e}),j(b,(t=>F(rt,{indexesId:t,s:e,key:t}))),F(mt,{s:e}),j(p,(t=>F(mt,{relationshipsId:t,s:e,key:t}))),F(ct,{s:e}),j(f,(t=>F(ct,{queriesId:t,s:e,key:t}))))};class ft extends O{constructor(e){super(e),this.componentDidCatch=(e,t)=>console.error(e,t.componentStack),this.state={e:0}}static{this.getDerivedStateFromError=()=>({e:1})}render(){return this.state.e?F("span",{className:"warn"},"Inspector error: please see console for details."):this.props.children}}const wt=({s:e})=>{const t=s.useValue(me,e)??1,l=s.useSetValueCallback(be,(()=>!1),[],e),a=s.useSetValueCallback(me,(e=>Number(e[k].dataset.id)),[],e);return F("header",null,F("img",{title:ie}),F("span",null,ie),j(de,((e,s)=>s==t?null:F("img",{onClick:a,"data-id":s,title:"Dock to "+e,key:s}))),F("img",{onClick:l,title:"Close"}))},yt=({s:e})=>{const t=s.useValue(me,e)??1;return s.useValue(be,e)?F("main",{"data-position":t},F(wt,{s:e}),F(ft,null,F(It,{s:e}))):null},Ct=e=>t=>{return s=(t,s)=>t+e(s),Rt(t).reduce(s,0);var s},vt=e=>e?.size??0,kt=Ct(vt),Tt=Ct(kt),St=Ct(Tt),xt=(e,t)=>e?.has(t)??!1,Vt=e=>q(e)||0==vt(e),Rt=e=>[...e?.values()??[]],qt=e=>e.clear(),Nt=(e,t)=>e?.forEach(t),Lt=(e,t)=>e?.delete(t),Mt=e=>new Map(e),Et=e=>[...e?.keys()??[]],zt=(e,t)=>e?.get(t),$t=(e,t)=>Nt(e,((e,s)=>t(s,e))),Ot=(e,t,s)=>q(s)?(Lt(e,t),e):e?.set(t,s),At=(e,t,s)=>(xt(e,t)||Ot(e,t,s()),zt(e,t)),Ft=(e,t,s,l=Ot)=>(le(t,((t,l)=>s(e,l,t))),$t(e,(s=>te(t,s)?0:l(e,s))),e),Jt=(e,t,s)=>{const l={};return Nt(e,((e,a)=>{const n=t?t(e,a):e;!s?.(n,e)&&(l[a]=n)})),l},Pt=(e,t,s)=>Jt(e,(e=>Jt(e,t,s)),ae),Bt=(e,t,s)=>Jt(e,(e=>Pt(e,t,s)),ae),Ht=(e,t)=>{const s=Mt();return Nt(e,((e,l)=>s.set(l,t?.(e)??e))),s},Dt=e=>Ht(e,Ht),Qt=e=>Ht(e,Dt),jt=(e,t,s,l,a=0)=>N((s?At:zt)(e,t[a],a>$(t)-2?s:Mt),(n=>{if(a>$(t)-2)return l?.(n)&&Ot(e,t[a]),n;const o=jt(n,t,s,l,a+1);return Vt(n)&&Ot(e,t[a]),o})),Wt=Mt(),Ut=Mt(),Gt="storage",Kt=globalThis.window,Xt=e=>new Set(E(e)||q(e)?e:[e]),Yt=(e,t)=>e?.add(t),Zt=/^\d+$/,_t=()=>{const e=[];let t=0;return[s=>(s?G(e):null)??a+t++,t=>{Zt.test(t)&&$(e)<1e3&&U(e,t)}]},es=e=>[e,e],ts=(e,t=kt)=>t(e[0])+t(e[1]),ss=()=>[Mt(),Mt()],ls=e=>[...e],as=([e,t])=>e===t,ns=(e,t,s)=>q(e)||!_(e)||ae(e)||Y(e)?(s?.(),!1):(le(e,((s,l)=>{t(s,l)||se(e,l)})),!ae(e)),os=(e,t,s)=>Ot(e,t,zt(e,t)==-s?void 0:s),rs=()=>{let e,t,s=!1,l=!1,n=0;const o=Mt(),i=Mt(),c=Mt(),k=Mt(),T=Mt(),x=Mt(),V=Mt(),R=Mt(),E=Mt(),O=Mt(),A=Mt(),F=Mt(),J=Mt(),P=Mt(),B=Xt(),H=Mt(),D=Mt(),W=Mt(),G=Mt(),K=ss(),X=ss(),Y=ss(),_=ss(),ee=ss(),re=ss(),ie=ss(),de=ss(),ue=ss(),ce=ss(),he=ss(),me=ss(),be=ss(),ge=ss(),pe=ss(),Ie=Mt(),fe=ss(),[we,ye,Ce,ve]=(e=>{let t;const[s,l]=_t(),n=Mt();return[(e,l,o,r=[],i=(()=>[]))=>{t??=ws;const d=s(1);return Ot(n,d,[e,l,o,r,i]),Yt(jt(l,o??[a],Xt),d),d},(e,s,...l)=>Q(((e,t=[a])=>{const s=[],l=(e,a)=>a==$(t)?U(s,e):null===t[a]?Nt(e,(e=>l(e,a+1))):Q([t[a],null],(t=>l(zt(e,t),a+1)));return l(e,0),s})(e,s),(e=>Nt(e,(e=>zt(n,e)[0](t,...s??[],...l))))),e=>N(zt(n,e),(([,t,s])=>(jt(t,s??[a],void 0,(t=>(Lt(t,e),Vt(t)?1:0))),Ot(n,e),l(e),s))),e=>N(zt(n,e),(([e,,s=[],l,a])=>{const n=(...o)=>{const r=$(o);r==$(s)?e(t,...o,...a(o)):q(s[r])?Q(l[r]?.(...o)??[],(e=>n(...o,e))):n(...o,s[r])};n()}))]})(),ke=e=>{if(!ns(e,((e,t)=>[d,u].includes(t))))return!1;const t=e[d];return!(!L(t)&&t!=r||(Me(e[u])!=t&&se(e,u),0))},Te=(t,s)=>(!e||xt(A,s)||lt(s))&&ns(t,((e,t)=>Se(s,t,e)),(()=>lt(s))),Se=(e,t,s,l)=>ns(l?s:qe(s,e,t),((l,a)=>N(xe(e,t,a,l),(e=>(s[a]=e,!0)),(()=>!1))),(()=>lt(e,t))),xe=(t,s,l,a)=>e?N(zt(zt(A,t),l),(e=>Me(a)!=e[d]?lt(t,s,l,a,e[u]):a),(()=>lt(t,s,l,a))):q(Me(a))?lt(t,s,l,a):a,Ve=(e,t)=>ns(t?e:Ne(e),((t,s)=>N(Re(s,t),(t=>(e[s]=t,!0)),(()=>!1))),(()=>at())),Re=(e,s)=>t?N(zt(J,e),(t=>Me(s)!=t[d]?at(e,s,t[u]):s),(()=>at(e,s))):q(Me(s))?at(e,s):s,qe=(e,t,s)=>(N(zt(F,t),(([l,a])=>{Nt(l,((t,s)=>{te(e,s)||(e[s]=t)})),Nt(a,(l=>{te(e,l)||lt(t,s,l)}))})),e),Ne=e=>(t&&(Nt(P,((t,s)=>{te(e,s)||(e[s]=t)})),Nt(B,(t=>{te(e,t)||at(t)}))),e),Le=e=>Ft(A,e,((e,t,s)=>{const l=Mt(),a=Xt();Ft(At(A,t,Mt),s,((e,t,s)=>{Ot(e,t,s),N(s[u],(e=>Ot(l,t,e)),(()=>Yt(a,t)))})),Ot(F,t,[l,a])}),((e,t)=>{Ot(A,t),Ot(F,t)})),$e=e=>Ft(J,e,((e,t,s)=>{Ot(J,t,s),N(s[u],(e=>Ot(P,t,e)),(()=>Yt(B,t)))}),((e,t)=>{Ot(J,t),Ot(P,t),Lt(B,t)})),Oe=e=>ae(e)?us():Gt(e),Ae=e=>Ft(W,e,((e,t,s)=>Fe(t,s)),((e,t)=>Ue(t))),Fe=(e,t)=>Ft(At(W,e,(()=>(Ye(e,1),Ot(H,e,_t()),Ot(D,e,Mt()),Mt()))),t,((t,s,l)=>Je(e,t,s,l)),((t,s)=>Ge(e,t,s))),Je=(e,t,s,l,a)=>Ft(At(t,s,(()=>(Ze(e,s,1),Mt()))),l,((t,l,a)=>Pe(e,s,t,l,a)),((l,n)=>Ke(e,t,s,l,n,a))),Pe=(e,t,s,l,a)=>{xt(s,l)||_e(e,t,l,1);const n=zt(s,l);a!==n&&(et(e,t,l,n,a),Ot(s,l,a))},Be=(e,t,s,l,a)=>N(zt(t,s),(t=>Pe(e,s,t,l,a)),(()=>Je(e,t,s,qe({[l]:a},e,s)))),He=e=>ae(e)?ms():Kt(e),De=e=>Ft(G,e,((e,t,s)=>Qe(t,s)),((e,t)=>Xe(t))),Qe=(e,t)=>{xt(G,e)||tt(e,1);const s=zt(G,e);t!==s&&(st(e,s,t),Ot(G,e,t))},je=(e,t)=>{const[s]=zt(H,e),l=s(t);return xt(zt(W,e),l)?je(e,t):l},We=e=>zt(W,e)??Fe(e,{}),Ue=e=>Fe(e,{}),Ge=(e,t,s)=>{const[,l]=zt(H,e);l(s),Je(e,t,s,{},!0)},Ke=(e,t,s,l,a,n)=>{const o=zt(zt(F,e)?.[0],a);if(!q(o)&&!n)return Pe(e,s,l,a,o);const r=t=>{et(e,s,t,zt(l,t)),_e(e,s,t,-1),Ot(l,t)};q(o)?r(a):$t(l,r),Vt(l)&&(Ze(e,s,-1),Vt(Ot(t,s))&&(Ye(e,-1),Ot(W,e),Ot(H,e),Ot(D,e)))},Xe=e=>{const t=zt(P,e);if(!q(t))return Qe(e,t);st(e,zt(G,e)),tt(e,-1),Ot(G,e)},Ye=(e,t)=>os(o,e,t),Ze=(e,t,s)=>os(At(k,e,Mt),t,s)&&Ot(c,e,At(c,e,(()=>0))+s),_e=(e,t,s,l)=>{const a=zt(D,e),n=zt(a,s)??0;(0==n&&1==l||1==n&&-1==l)&&os(At(i,e,Mt),s,l),Ot(a,s,n!=-l?n+l:null),os(At(At(T,e,Mt),t,Mt),s,l)},et=(e,t,s,l,a)=>At(At(At(x,e,Mt),t,Mt),s,(()=>[l,0]))[1]=a,tt=(e,t)=>os(V,e,t),st=(e,t,s)=>At(R,e,(()=>[t,0]))[1]=s,lt=(e,t,s,l,a)=>(U(At(At(At(E,e,Mt),t,Mt),s,(()=>[])),l),a),at=(e,t,s)=>(U(At(O,e,(()=>[])),t),s),nt=(e,t,s)=>N(zt(zt(zt(x,e),t),s),(([e,t])=>[!0,e,t]),(()=>[!1,...es(Ct(e,t,s))])),ot=e=>N(zt(R,e),(([e,t])=>[!0,e,t]),(()=>[!1,...es(Ut(e))])),rt=e=>Vt(E)||Vt(he[e])?0:Nt(e?Qt(E):E,((t,s)=>Nt(t,((t,l)=>Nt(t,((t,a)=>ye(he[e],[s,l,a],t))))))),it=e=>Vt(O)||Vt(me[e])?0:Nt(e?Ht(O):O,((t,s)=>ye(me[e],[s],t))),dt=(e,t,s)=>{if(!Vt(t))return ye(e,s,(()=>Jt(t))),1},ut=e=>{const t=Vt(ie[e]),s=Vt(ue[e])&&Vt(_[e])&&Vt(ee[e])&&Vt(re[e])&&t&&Vt(X[e]),l=Vt(ce[e])&&Vt(de[e])&&Vt(Y[e])&&Vt(K[e]);if(!s||!l){const a=e?[Ht(o),Dt(i),Ht(c),Dt(k),Qt(T),Qt(x)]:[o,i,c,k,T,x];if(!s){dt(X[e],a[0]),Nt(a[1],((t,s)=>dt(_[e],t,[s]))),Nt(a[2],((t,s)=>{0!=t&&ye(ee[e],[s],It(s))}));const s=Xt();Nt(a[3],((l,a)=>{dt(re[e],l,[a])&&!t&&(ye(ie[e],[a,null]),Yt(s,a))})),t||Nt(a[5],((t,l)=>{if(!xt(s,l)){const s=Xt();Nt(t,(e=>Nt(e,(([t,l],a)=>l!==t?Yt(s,a):Lt(e,a))))),Nt(s,(t=>ye(ie[e],[l,t])))}})),Nt(a[4],((t,s)=>Nt(t,((t,l)=>dt(ue[e],t,[s,l])))))}if(!l){let t;Nt(a[5],((s,l)=>{let a;Nt(s,((s,n)=>{let o;Nt(s,(([s,r],i)=>{r!==s&&(ye(ce[e],[l,n,i],r,s,nt),t=a=o=1)})),o&&ye(de[e],[l,n],nt)})),a&&ye(Y[e],[l],nt)})),t&&ye(K[e],void 0,nt)}}},ct=e=>{const t=Vt(ge[e]),s=Vt(pe[e])&&Vt(be[e]);if(!t||!s){const l=e?[Ht(V),Ht(R)]:[V,R];if(t||dt(ge[e],l[0]),!s){let t;Nt(l[1],(([s,l],a)=>{l!==s&&(ye(pe[e],[a],l,s,ot),t=1)})),t&&ye(be[e],void 0,ot)}}},ht=(e,...t)=>(ps((()=>e(...j(t,S)))),ws),mt=()=>[Jt(x,((e,t)=>-1===zt(o,t)?null:Jt(e,((e,s)=>-1===zt(zt(k,t),s)?null:Jt(e,(([,e])=>e??null),((e,t)=>as(t)))),ae)),ae),Jt(R,(([,e])=>e??null),((e,t)=>as(t)))],bt=()=>({cellsTouched:s,valuesTouched:l,changedCells:Bt(x,ls,as),invalidCells:Bt(E),changedValues:Jt(R,ls,as),invalidValues:Jt(O),changedTableIds:Jt(o),changedRowIds:Pt(k),changedCellIds:Bt(T),changedValueIds:Jt(V)}),gt=()=>Bt(W),pt=()=>Et(W),It=e=>vt(zt(W,S(e))),ft=e=>Et(zt(W,S(e))),wt=(e,t,s,l=0,a)=>{return j(z((o=zt(W,S(e)),r=(e,s)=>[q(t)?s:zt(e,S(t)),s],n=([e],[t])=>((e??0)<(t??0)?-1:1)*(s?-1:1),j([...o?.entries()??[]],(([e,t])=>r(t,e))).sort(n)),l,q(a)?a:l+a),(([,e])=>e));var n,o,r},yt=(e,t)=>Et(zt(zt(W,S(e)),S(t))),Ct=(e,t,s)=>zt(zt(zt(W,S(e)),S(t)),S(s)),Rt=()=>Jt(G),Wt=()=>Et(G),Ut=e=>zt(G,S(e)),Gt=e=>ht((()=>(e=>ns(e,Te,lt))(e)?Ae(e):0)),Kt=e=>ht((()=>Ve(e)?De(e):0)),Zt=e=>{try{Oe(oe(e))}catch{}return ws},is=t=>ht((()=>{if((e=ns(t,(e=>ns(e,ke))))&&(Le(t),!Vt(W))){const e=gt();us(),Gt(e)}})),ds=e=>ht((()=>{if(t=(e=>ns(e,ke))(e)){const s=Rt();gs(),ms(),t=!0,$e(e),Kt(s)}})),us=()=>ht((()=>Ae({}))),cs=e=>ht((e=>xt(W,e)?Ue(e):0),e),hs=(e,t)=>ht(((e,t)=>N(zt(W,e),(s=>xt(s,t)?Ge(e,s,t):0))),e,t),ms=()=>ht((()=>De({}))),bs=()=>ht((()=>{Le({}),e=!1})),gs=()=>ht((()=>{$e({}),t=!1})),ps=(e,t)=>{if(-1!=n){Is();const s=e();return fs(t),s}},Is=()=>(-1!=n&&n++,1==n&&ye(Ie,void 0,mt,bt),ws),fs=e=>(n>0&&(n--,0==n&&(s=!Vt(x),l=!Vt(R),n=1,rt(1),s&&ut(1),it(1),l&&ct(1),e?.(mt,bt)&&(Nt(x,((e,t)=>Nt(e,((e,s)=>Nt(e,(([e],l)=>Ee(ws,t,s,l,e))))))),Nt(R,(([e],t)=>ze(ws,t,e))),s=l=!1),ye(fe[0],void 0,mt,bt),n=-1,rt(0),s&&ut(0),it(0),l&&ct(0),ye(fe[1],void 0,mt,bt),n=0,s=l=!1,Q([o,i,c,k,T,x,E,V,R,O],qt))),ws),ws={getContent:()=>[gt(),Rt()],getTables:gt,getTableIds:pt,getTable:e=>Pt(zt(W,S(e))),getTableCellIds:e=>Et(zt(D,S(e))),getRowCount:It,getRowIds:ft,getSortedRowIds:wt,getRow:(e,t)=>Jt(zt(zt(W,S(e)),S(t))),getCellIds:yt,getCell:Ct,getValues:Rt,getValueIds:Wt,getValue:Ut,hasTables:()=>!Vt(W),hasTable:e=>xt(W,S(e)),hasTableCell:(e,t)=>xt(zt(D,S(e)),S(t)),hasRow:(e,t)=>xt(zt(W,S(e)),S(t)),hasCell:(e,t,s)=>xt(zt(zt(W,S(e)),S(t)),S(s)),hasValues:()=>!Vt(G),hasValue:e=>xt(G,S(e)),getTablesJson:()=>ne(W),getValuesJson:()=>ne(G),getJson:()=>ne([W,G]),getTablesSchemaJson:()=>ne(A),getValuesSchemaJson:()=>ne(J),getSchemaJson:()=>ne([A,J]),hasTablesSchema:()=>e,hasValuesSchema:()=>t,setContent:([e,t])=>ht((()=>{(ae(e)?us:Gt)(e),(ae(t)?ms:Kt)(t)})),setTables:Gt,setTable:(e,t)=>ht((e=>Te(t,e)?Fe(e,t):0),e),setRow:(e,t,s)=>ht(((e,t)=>Se(e,t,s)?Je(e,We(e),t,s):0),e,t),addRow:(e,t,s=!0)=>ps((()=>{let l;return Se(e,l,t)&&(e=S(e),Je(e,We(e),l=je(e,s?1:0),t)),l})),setPartialRow:(e,t,s)=>ht(((e,t)=>{if(Se(e,t,s,1)){const l=We(e);le(s,((s,a)=>Be(e,l,t,a,s)))}}),e,t),setCell:(e,t,s,l)=>ht(((e,t,s)=>N(xe(e,t,s,M(l)?l(Ct(e,t,s)):l),(l=>Be(e,We(e),t,s,l)))),e,t,s),setValues:Kt,setPartialValues:e=>ht((()=>Ve(e,1)?le(e,((e,t)=>Qe(t,e))):0)),setValue:(e,t)=>ht((e=>N(Re(e,M(t)?t(Ut(e)):t),(t=>Qe(e,t)))),e),setTransactionChanges:e=>ht((()=>{le(e[0],((e,t)=>q(e)?cs(t):le(e,((e,s)=>q(e)?hs(t,s):le(e,((e,l)=>Ee(ws,t,s,l,e))))))),le(e[1],((e,t)=>ze(ws,t,e)))})),setTablesJson:Zt,setValuesJson:e=>{try{He(oe(e))}catch{}return ws},setJson:e=>ht((()=>{try{const[t,s]=oe(e);Oe(t),He(s)}catch{Zt(e)}})),setTablesSchema:is,setValuesSchema:ds,setSchema:(e,t)=>ht((()=>{is(e),ds(t)})),delTables:us,delTable:cs,delRow:hs,delCell:(e,t,s,l)=>ht(((e,t,s)=>N(zt(W,e),(a=>N(zt(a,t),(n=>xt(n,s)?Ke(e,a,t,n,s,l):0))))),e,t,s),delValues:ms,delValue:e=>ht((e=>xt(G,e)?Xe(e):0),e),delTablesSchema:bs,delValuesSchema:gs,delSchema:()=>ht((()=>{bs(),gs()})),transaction:ps,startTransaction:Is,finishTransaction:fs,forEachTable:e=>Nt(W,((t,s)=>e(s,(e=>Nt(t,((t,s)=>e(s,(e=>$t(t,e))))))))),forEachTableCell:(e,t)=>$t(zt(D,S(e)),t),forEachRow:(e,t)=>Nt(zt(W,S(e)),((e,s)=>t(s,(t=>$t(e,t))))),forEachCell:(e,t,s)=>$t(zt(zt(W,S(e)),S(t)),s),forEachValue:e=>$t(G,e),addSortedRowIdsListener:(e,t,s,l,a,n,o)=>{let r=wt(e,t,s,l,a);return we((()=>{const o=wt(e,t,s,l,a);var i,d,u;d=r,$(i=o)===$(d)&&(u=(e,t)=>d[t]===e,i.every(u))||(r=o,n(ws,e,t,s,l,a,r))}),ie[o?1:0],[e,t],[pt])},addStartTransactionListener:e=>we(e,Ie),addWillFinishTransactionListener:e=>we(e,fe[0]),addDidFinishTransactionListener:e=>we(e,fe[1]),callListener:e=>(ve(e),ws),delListener:e=>(Ce(e),ws),getListenerStats:()=>({tables:ts(K),tableIds:ts(X),tableCellIds:ts(_),table:ts(Y),rowCount:ts(ee),rowIds:ts(re),sortedRowIds:ts(ie),row:ts(de,Tt),cellIds:ts(ue,Tt),cell:ts(ce,St),invalidCell:ts(he,St),values:ts(be),valueIds:ts(ge),value:ts(pe),invalidValue:ts(me),transaction:kt(Ie)+ts(fe)}),createStore:rs,addListener:we,callListeners:ye};return le({[m]:[0,K],[b]:[0,X],[h]:[1,Y,[pt]],[h+w]:[1,_,[pt]],[p]:[1,ee,[pt]],[I]:[1,re,[pt]],[g]:[2,de,[pt,ft]],[w]:[2,ue,[pt,ft]],[f]:[3,ce,[pt,ft,yt],e=>es(Ct(...e))],InvalidCell:[3,he],[C]:[0,be],[v]:[0,ge],[y]:[1,pe,[Wt],e=>es(Ut(e[0]))],InvalidValue:[1,me]},(([e,t,s,l],a)=>{ws["add"+a+"Listener"]=(...a)=>we(a[e],t[a[e+1]?1:0],e>0?z(a,0,e):void 0,s,l)})),Z(ws)},is=({position:e="right",open:t=!1})=>{const l=s.useCreateStore(rs),a=de.indexOf(e);return s.useCreatePersister(l,(e=>{return((e,t,s,l)=>((e,t,s,l,a,n,o=[])=>{let r,i,d,u=0,c=0,h=0,m=0;At(Wt,o,(()=>0)),At(Ut,o,(()=>[]));const b=async e=>(2!=u&&(u=1,c++,await g.schedule((async()=>{await e(),u=0}))),g),g={load:async(s,l)=>await b((async()=>{try{e.setContent(await t())}catch{e.setContent([s,l])}})),startAutoLoad:async(s={},a={})=>(g.stopAutoLoad(),await g.load(s,a),m=1,d=l((async(s,l)=>{if(l){const t=l();await b((async()=>e.setTransactionChanges(t)))}else await b((async()=>{try{e.setContent(s?.()??await t())}catch(e){n?.(e)}}))})),g),stopAutoLoad:()=>(m&&(a(d),d=void 0,m=0),g),save:async t=>(1!=u&&(u=2,h++,await g.schedule((async()=>{try{await s(e.getContent,t)}catch(e){n?.(e)}u=0}))),g),startAutoSave:async()=>(await g.stopAutoSave().save(),r=e.addDidFinishTransactionListener(((e,t)=>{const[s,l]=t();ae(s)&&ae(l)||g.save((()=>[s,l]))})),g),stopAutoSave:()=>(N(r,e.delListener),g),schedule:async(...e)=>(U(zt(Ut,o),...e),await(async()=>{if(!zt(Wt,o)){for(Ot(Wt,o,1);!q(i=G(zt(Ut,o)));)try{await i()}catch(e){n?.(e)}Ot(Wt,o,0)}})(),g),getStore:()=>e,destroy:()=>g.stopAutoLoad().stopAutoSave(),getStats:()=>({loads:c,saves:h})};return Z(g)})(e,(async()=>oe(s.getItem(t))),(async e=>s.setItem(t,ne(e()))),(e=>{const l=l=>{l.storageArea===s&&l.key===t&&e((()=>oe(l.newValue)))};return Kt.addEventListener(Gt,l),l}),(e=>Kt.removeEventListener(Gt,e)),l))(e,re,sessionStorage,t);var t}),void 0,(async e=>{await e.load(void 0,{position:-1==a?1:a,open:!!t}),await e.startAutoSave()})),F(A,null,F("aside",{id:re},F(Ne,{s:l}),F(yt,{s:l})),F("style",null,qe))};e.EditableCellView=st,e.EditableValueView=lt,e.RelationshipInHtmlTable=et,e.ResultSortedTableInHtmlTable=tt,e.ResultTableInHtmlTable=({queryId:e,queries:t,customCells:l,...a})=>F(Ue,{...a,params:He(We(s.useResultTableCellIds(e,t),l,s.ResultCellView),Qe(t,e),s.useResultRowIds(e,t))}),e.SliceInHtmlTable=_e,e.SortedTableInHtmlTable=Ye,e.SortedTablePaginator=at,e.StoreInspector=e=>F(is,{...e}),e.TableInHtmlTable=({tableId:e,store:t,editable:l,customCells:a,...n})=>F(Ue,{...n,params:He(We(s.useTableCellIds(e,t),a,l?st:s.CellView),De(t,e),s.useRowIds(e,t))}),e.ValuesInHtmlTable=Ze},"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("./ui-react")):"function"==typeof define&&define.amd?define(["exports","react","./ui-react"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).TinyBaseUiReactDomDebug={},e.React,e.TinyBaseUiReact);
Binary file