graview 0.1.28 → 0.1.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (178) hide show
  1. package/dist/preview/chunk.26CZTUY4.js +1 -0
  2. package/dist/preview/chunk.2CIBWZJG.js +1 -0
  3. package/dist/preview/chunk.2EXGG6BB.js +1 -0
  4. package/dist/preview/chunk.2NBYNZRD.js +1 -0
  5. package/dist/preview/chunk.2XAONC66.js +1 -0
  6. package/dist/preview/chunk.34ZMMURV.js +27 -0
  7. package/dist/preview/chunk.3ADPAGPY.js +28 -0
  8. package/dist/preview/chunk.3JGGBLRB.js +1 -0
  9. package/dist/preview/chunk.3JNMSOFG.js +1 -0
  10. package/dist/preview/chunk.3R4W2P5X.js +1 -0
  11. package/dist/preview/chunk.3SKKIHU3.js +4 -0
  12. package/dist/preview/{chunk.5BGA2VUS.js → chunk.3URFMWXZ.js} +4 -4
  13. package/dist/preview/chunk.3VL5WECB.js +1 -0
  14. package/dist/preview/chunk.42YX6NOY.js +2 -0
  15. package/dist/preview/chunk.4ALKPNXM.js +1 -0
  16. package/dist/preview/chunk.4HP7UWA2.js +1 -0
  17. package/dist/preview/chunk.4SJUTBDV.js +1 -0
  18. package/dist/preview/chunk.5U5J3ISK.js +1 -0
  19. package/dist/preview/chunk.6T2Q6NLO.js +1 -0
  20. package/dist/preview/chunk.6V2RG5JG.js +5 -0
  21. package/dist/preview/chunk.6XMEU2Q2.js +1 -0
  22. package/dist/preview/chunk.7BWT5L2L.js +1 -0
  23. package/dist/preview/chunk.AK3IHFCF.js +1 -0
  24. package/dist/preview/chunk.BPWNWE7N.js +1 -0
  25. package/dist/preview/chunk.C5CYZNSJ.js +1 -0
  26. package/dist/preview/chunk.CM6LOIQE.js +88 -0
  27. package/dist/preview/chunk.D3IECJ2S.js +17 -0
  28. package/dist/preview/chunk.DT7LHWU2.js +1 -0
  29. package/dist/preview/chunk.DZRTOURR.js +1 -0
  30. package/dist/preview/chunk.ERXSYPYL.js +84 -0
  31. package/dist/preview/chunk.EYZ7MHBZ.js +0 -0
  32. package/dist/preview/chunk.FDELO7NY.js +116 -0
  33. package/dist/preview/chunk.FGVKJWNS.js +6 -0
  34. package/dist/preview/chunk.FWCOJDOD.js +1 -0
  35. package/dist/preview/chunk.GFF2FB2J.js +25 -0
  36. package/dist/preview/chunk.GLBHQFJ2.js +1 -0
  37. package/dist/preview/chunk.HHI65WFZ.js +3 -0
  38. package/dist/preview/chunk.HHPGWJDO.js +2 -0
  39. package/dist/preview/chunk.HJCQ6I3S.js +1 -0
  40. package/dist/preview/chunk.HSCTWAUV.js +1 -0
  41. package/dist/preview/chunk.INZUEWC5.js +1 -0
  42. package/dist/preview/chunk.J2ITFGN3.js +1 -0
  43. package/dist/preview/chunk.JH6MU6TX.js +2 -0
  44. package/dist/preview/chunk.JISMMIMX.js +1 -0
  45. package/dist/preview/chunk.JN7DIFR3.js +1 -0
  46. package/dist/preview/chunk.JPHNKWTY.js +1 -0
  47. package/dist/preview/chunk.JTNWD2CN.js +1 -0
  48. package/dist/preview/chunk.K75FUIZI.js +1 -0
  49. package/dist/preview/chunk.K776HO42.js +2 -0
  50. package/dist/preview/chunk.KN3ULTGF.js +1 -0
  51. package/dist/preview/chunk.KOB6N3SL.js +1 -0
  52. package/dist/preview/chunk.KQT7WAQE.js +1 -0
  53. package/dist/preview/chunk.L4DECHXR.js +327 -0
  54. package/dist/preview/chunk.L6OMEYL6.js +10 -0
  55. package/dist/preview/chunk.LQ7V6KEE.js +1 -0
  56. package/dist/preview/chunk.MB7LKKUD.js +1 -0
  57. package/dist/preview/chunk.MD74YVRN.js +3 -0
  58. package/dist/preview/chunk.MGNP4LAM.js +1 -0
  59. package/dist/preview/chunk.NCTOBUCT.js +1 -0
  60. package/dist/preview/chunk.NDADLJE6.js +1 -0
  61. package/dist/preview/chunk.NO52VON3.js +1 -0
  62. package/dist/preview/chunk.O2LK2AO7.js +1 -0
  63. package/dist/preview/chunk.OAF7TUMI.js +1 -0
  64. package/dist/preview/chunk.OQ4KFN6W.js +1 -0
  65. package/dist/preview/chunk.OQDETV4X.js +1 -0
  66. package/dist/preview/chunk.OXQMNIRO.js +1 -0
  67. package/dist/preview/chunk.OZNW5W4Z.js +1 -0
  68. package/dist/preview/chunk.PAVR5TK5.js +1 -0
  69. package/dist/preview/chunk.PKK6FRZR.js +2 -0
  70. package/dist/preview/chunk.Q5WEOX3Q.js +1 -0
  71. package/dist/preview/chunk.QIAKO27D.js +1 -0
  72. package/dist/preview/chunk.QNGWEV47.js +1 -0
  73. package/dist/preview/{chunk.EYF6ONTA.js → chunk.QTA4ROAK.js} +1 -1
  74. package/dist/preview/chunk.QTMWHE5O.js +1 -0
  75. package/dist/preview/chunk.R26DREVU.js +1 -0
  76. package/dist/preview/chunk.RI3PYG5T.js +19 -0
  77. package/dist/preview/chunk.RIEHYQLK.js +1101 -0
  78. package/dist/preview/chunk.RRVIXV7W.js +1 -0
  79. package/dist/preview/chunk.RYT5U3QM.js +1 -0
  80. package/dist/preview/chunk.SE5SKFQH.js +1 -0
  81. package/dist/preview/chunk.SHPXD6FC.js +1 -0
  82. package/dist/preview/chunk.SOBC3CTN.js +47 -0
  83. package/dist/preview/chunk.SOD3PBJM.js +1 -0
  84. package/dist/preview/chunk.T3VPD7JQ.js +1 -0
  85. package/dist/preview/chunk.TI4OSTQV.js +1 -0
  86. package/dist/preview/chunk.UDSEJKCY.js +1 -0
  87. package/dist/preview/chunk.UGFDSE37.js +1 -0
  88. package/dist/preview/chunk.UT6642FC.js +1 -0
  89. package/dist/preview/chunk.UWGWXFWZ.js +1 -0
  90. package/dist/preview/{chunk.IKT7JQUW.js → chunk.UZWWDAGM.js} +1 -1
  91. package/dist/preview/chunk.V5ZYUVMH.js +1 -0
  92. package/dist/preview/chunk.V7BDAGDE.js +35 -0
  93. package/dist/preview/chunk.VG56IUIQ.js +9 -0
  94. package/dist/preview/chunk.VOAZBHCG.js +1 -0
  95. package/dist/preview/chunk.VS7K3SCD.js +9 -0
  96. package/dist/preview/chunk.VSZQXB4Q.js +3 -0
  97. package/dist/preview/chunk.W3S6UXNA.js +1 -0
  98. package/dist/preview/chunk.WAFDCOOG.js +3 -0
  99. package/dist/preview/chunk.WYTIOLPP.js +1 -0
  100. package/dist/preview/chunk.X37L5TN5.js +1 -0
  101. package/dist/preview/chunk.XDYAG276.js +1 -0
  102. package/dist/preview/chunk.XRJBLH4N.js +1 -0
  103. package/dist/preview/chunk.XS7YFNDU.js +1 -0
  104. package/dist/preview/chunk.XSTXV6FP.js +6 -0
  105. package/dist/preview/chunk.Y4UXEL6Y.js +1 -0
  106. package/dist/preview/chunk.YJUB4OD7.js +1 -0
  107. package/dist/preview/chunk.YLQB3KBA.js +1 -0
  108. package/dist/preview/chunk.YNQDVGZM.js +1 -0
  109. package/dist/preview/chunk.YV2LJFGS.js +1 -0
  110. package/dist/preview/chunk.Z2YUYZT4.js +1 -0
  111. package/dist/preview/chunk.ZYKAS4BT.js +1 -0
  112. package/dist/preview/page.js +6 -6
  113. package/package.json +6 -6
  114. package/dist/preview/chunk.22H4JXTH.js +0 -8
  115. package/dist/preview/chunk.25OYH6MY.js +0 -1
  116. package/dist/preview/chunk.2GBQJXJH.js +0 -19
  117. package/dist/preview/chunk.2VUG6EAN.js +0 -1
  118. package/dist/preview/chunk.337WDTG3.js +0 -2
  119. package/dist/preview/chunk.3HLLQ5CJ.js +0 -1
  120. package/dist/preview/chunk.46KUPBQC.js +0 -1
  121. package/dist/preview/chunk.4H7CQE56.js +0 -1
  122. package/dist/preview/chunk.4HGBVU5B.js +0 -1
  123. package/dist/preview/chunk.4RO5DA22.js +0 -1
  124. package/dist/preview/chunk.4TUNX4WM.js +0 -29
  125. package/dist/preview/chunk.6LJ66MB7.js +0 -1
  126. package/dist/preview/chunk.6R4EI47C.js +0 -1
  127. package/dist/preview/chunk.7S22MBNN.js +0 -1
  128. package/dist/preview/chunk.A73BXXE4.js +0 -3
  129. package/dist/preview/chunk.AHDOKM4O.js +0 -1
  130. package/dist/preview/chunk.ARE3MEDN.js +0 -1
  131. package/dist/preview/chunk.ASFZTYFO.js +0 -1
  132. package/dist/preview/chunk.BBJZ6O7J.js +0 -1
  133. package/dist/preview/chunk.BCBH6WJF.js +0 -1
  134. package/dist/preview/chunk.CAZAB352.js +0 -1
  135. package/dist/preview/chunk.CY7MDLRS.js +0 -1
  136. package/dist/preview/chunk.DAVRLRGB.js +0 -1
  137. package/dist/preview/chunk.DCIC3YHX.js +0 -1
  138. package/dist/preview/chunk.EW4JFOJY.js +0 -1
  139. package/dist/preview/chunk.FP27W5MU.js +0 -1
  140. package/dist/preview/chunk.G2OOBROL.js +0 -1040
  141. package/dist/preview/chunk.GCKSQ52O.js +0 -1
  142. package/dist/preview/chunk.GE5EAN36.js +0 -2
  143. package/dist/preview/chunk.HOPIZMJR.js +0 -2
  144. package/dist/preview/chunk.IBGO4BUF.js +0 -1
  145. package/dist/preview/chunk.IDI2BQ7Y.js +0 -9
  146. package/dist/preview/chunk.IH42QTOM.js +0 -1
  147. package/dist/preview/chunk.ISRS7GOT.js +0 -321
  148. package/dist/preview/chunk.J6CBMLGR.js +0 -1
  149. package/dist/preview/chunk.JRCV6HVV.js +0 -1
  150. package/dist/preview/chunk.KWW3YHQ4.js +0 -23
  151. package/dist/preview/chunk.MKNXV4TM.js +0 -8
  152. package/dist/preview/chunk.MRK6QJV5.js +0 -25
  153. package/dist/preview/chunk.MVNIKZIC.js +0 -1
  154. package/dist/preview/chunk.N2WTNKEV.js +0 -1
  155. package/dist/preview/chunk.N7HCALRK.js +0 -61
  156. package/dist/preview/chunk.NRRUGG22.js +0 -1
  157. package/dist/preview/chunk.OGL4PHTY.js +0 -1
  158. package/dist/preview/chunk.ONDILMIX.js +0 -1
  159. package/dist/preview/chunk.PFQFPJ5L.js +0 -16
  160. package/dist/preview/chunk.PN2H6X7O.js +0 -1
  161. package/dist/preview/chunk.PWHJHFC4.js +0 -1
  162. package/dist/preview/chunk.Q3HVA6L4.js +0 -1
  163. package/dist/preview/chunk.RZLNDVGN.js +0 -107
  164. package/dist/preview/chunk.SBHVVJY7.js +0 -1
  165. package/dist/preview/chunk.SNBIZ3B6.js +0 -1
  166. package/dist/preview/chunk.TBG2QBOS.js +0 -1
  167. package/dist/preview/chunk.VR735ZQL.js +0 -1
  168. package/dist/preview/chunk.VSXCXPK2.js +0 -1
  169. package/dist/preview/chunk.W3LDQ6B2.js +0 -1
  170. package/dist/preview/chunk.WCNONCTL.js +0 -6
  171. package/dist/preview/chunk.WHTNSETN.js +0 -1
  172. package/dist/preview/chunk.XG67BWH6.js +0 -1
  173. package/dist/preview/chunk.XRM6WXPW.js +0 -1
  174. package/dist/preview/chunk.Y5LPZLDE.js +0 -1
  175. package/dist/preview/chunk.YETBY2LM.js +0 -1
  176. package/dist/preview/chunk.YSYT3ASK.js +0 -1
  177. package/dist/preview/chunk.ZEUBAAVQ.js +0 -1
  178. package/dist/preview/chunk.ZJDRD6PO.js +0 -1
@@ -0,0 +1 @@
1
+ import{a as z,b as Z,e as ee}from"./chunk.7BWT5L2L.js";import{b as M}from"./chunk.VSZQXB4Q.js";import{c as Y}from"./chunk.OZNW5W4Z.js";import{o as C}from"./chunk.KQT7WAQE.js";import{i as v,j as Q,k as X}from"./chunk.3VL5WECB.js";import{d as q,e as J}from"./chunk.JH6MU6TX.js";import{b as G,f as K}from"./chunk.WAFDCOOG.js";import{G as re,R as U,Z as P,_,a as O,aa as R,ya as j}from"./chunk.GFF2FB2J.js";import{Y as E,ba as D}from"./chunk.6V2RG5JG.js";import{b as B}from"./chunk.AJZBJBMO.js";var u=B(re(),1);var ie=j(O(()=>import("./chunk.UDSEJKCY.js"))),te=ie.part((r,a)=>r.drawAppLink(a),{quiet:!0});var e=B(U(),1);function H({nodeId:r,field:a,value:d,stored:s=d,said:m}){let{fields:y,commit:i}=C(r),n=y.find(o=>o.field===a),{store:h}=P(),w=h.graph.getNode(r)?.kind,p=h.schema.definitions.find(o=>o.kind===w),g=D(p,a),f=g.toLowerCase(),k=m??`${g.charAt(0).toUpperCase()}${g.slice(1)}: ${d}`,[t,L]=(0,u.useState)(!1),l=n?.shape.type==="number"?n.shape.amount:void 0,S=l&&s!==""&&Number.isFinite(Number(s))?Q(Number(s),l):s,[c,I]=(0,u.useState)(S),W=(0,u.useRef)(null),F=(0,u.useRef)(null),$=(0,u.useRef)(!1),x=o=>{$.current=o,L(!1)};if((0,u.useEffect)(()=>I(S),[S,t]),(0,u.useEffect)(()=>{t?W.current?.focus():$.current&&($.current=!1,F.current?.focus())},[t]),!n)return(0,e.jsx)("span",{"data-graview-field":a,"data-graview-readonly":"",title:`Read-only \u2014 nothing this app declares changes the ${f}`,style:{color:"var(--graview-ink)",cursor:"default",overflowWrap:"anywhere"},children:d});if(!t)return(0,e.jsx)("button",{ref:F,type:"button","data-graview-field":a,"data-graview-editable":n.mutation,...k===d?{}:{"aria-label":k},title:`${n.title} \u2014 changes the ${f}, and can be undone`,onClick:()=>L(!0),style:{all:"unset",cursor:"text",display:"inline-flex",alignItems:"flex-end",minHeight:24,minWidth:24,maxWidth:"100%",overflowWrap:"anywhere",paddingBottom:1,borderBottom:"1px dashed var(--graview-edge-bright)",color:"var(--graview-ink)"},children:d});let A=(o,{left:b=!1}={})=>{x(!b),!(o===s||o===""||o===void 0)&&i(n,o)};if(!n.takesValue){let o=[n,...n.alternatives];return(0,e.jsx)("span",{role:"group","aria-label":`Change ${E(a).toLowerCase()}`,"data-graview-field":a,style:{display:"inline-flex",gap:6,alignItems:"center",flexWrap:"wrap"},onKeyDown:b=>{b.key==="Escape"&&x(!0)},children:o.map((b,ae)=>(0,e.jsx)("button",{type:"button",ref:ae===0?W:void 0,"data-graview-act":b.mutation,onClick:()=>{x(!0),i(b,void 0)},onBlur:N=>{let V=N.relatedTarget;(!V||!N.currentTarget.parentElement?.contains(V))&&x(!1)},style:{padding:"2px 9px",fontSize:"0.8125rem",borderRadius:999},children:b.title},b.mutation))})}return(0,e.jsxs)("form",{style:{display:"inline-flex",gap:4,maxWidth:"100%"},onSubmit:o=>{o.preventDefault(),A(ne(n,c))},children:[n.shape.type==="choice"?(0,e.jsx)("select",{ref:W,"aria-label":E(a),"data-graview-field":a,value:c,onChange:o=>A(o.target.value),onBlur:()=>x(!1),style:{font:"inherit",fontSize:"inherit"},children:n.shape.options.map(o=>(0,e.jsx)("option",{value:o,children:G(p,a,o)},o))}):(0,e.jsxs)(e.Fragment,{children:[l&&v(l).prefix?(0,e.jsx)("span",{"aria-hidden":"true",children:v(l).prefix}):null,(0,e.jsx)("input",{ref:W,"aria-label":l?`${E(a)}, ${v(l).hint}`:E(a),"data-graview-field":a,...l?{inputMode:"decimal",placeholder:v(l).placeholder,"data-graview-amount":l.format??"unit"}:{},type:l?"text":n.shape.type==="number"&&!n.shape.duration?"number":n.shape.type==="date"?n.shape.time?"datetime-local":"date":"text",...n.shape.type==="number"&&n.shape.duration?{placeholder:"1h 30m"}:{},...n.shape.type==="text"&&n.shape.holds==="phone"?{inputMode:"tel",autoComplete:"tel"}:{},...n.shape.type==="number"&&n.shape.min!==void 0&&!l?{min:n.shape.min}:{},...n.shape.type==="number"&&n.shape.max!==void 0&&!l?{max:n.shape.max}:{},...n.shape.type==="number"&&n.shape.step!==void 0&&!l?{step:n.shape.step}:{},value:c,onChange:o=>I(o.target.value),onBlur:()=>A(ne(n,c),{left:!0}),onKeyDown:o=>{o.key==="Escape"&&x(!0)},style:{font:"inherit",fontSize:"inherit",width:`min(${Math.max(6,c.length+1)}ch, 100%)`,maxWidth:"100%",minWidth:0,boxSizing:"border-box",minHeight:24,display:"inline-flex",alignItems:"center",padding:"0 3px"}}),l&&v(l).suffix?(0,e.jsx)("span",{"aria-hidden":"true",children:v(l).suffix}):null]}),n.open.length>0?(0,e.jsxs)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)"},children:["also needs ",n.open.map(o=>o.name).join(", ")]}):null]})}function ne(r,a){return r.shape.type==="number"&&r.shape.amount?X(a,r.shape.amount):r.shape.type==="number"?r.shape.duration?K(a)??a:Number(a):r.shape.type==="text"&&r.shape.holds?a.trim():a}function oe({href:r,field:a,value:d,stored:s,nodeId:m}){let y=r.startsWith("tel:"),i=(n,h)=>(0,e.jsx)("a",{href:r,"data-graview-link":a,...h?{"aria-label":h}:{},...y?{}:{target:"_blank",rel:"noopener noreferrer"},style:{display:"inline-flex",alignItems:"center",minHeight:24,minWidth:24,maxWidth:"100%",overflowWrap:"anywhere",color:"var(--graview-accent)"},children:n});return m===void 0?i(d):(0,e.jsxs)("span",{style:{display:"inline-flex",flexWrap:"wrap",alignItems:"center",gap:"0 10px",maxWidth:"100%"},children:[(0,e.jsx)(H,{nodeId:m,field:a,value:d,...s===void 0?{}:{stored:s}}),i(y?"Call":"Map",y?`Call ${d}`:`Open ${d} in maps`)]})}function We({id:r,hide:a=[],limit:d=10,labels:s={},shown:m=[]}){let{store:y}=P(),i=R(r);if(!i)return null;let n=y.schema.tryDefinition(i.kind),h=q(i,n,{limit:d,said:m}).filter(p=>!a.includes(p.key)),w=Y(n).length>0;return h.length===0&&!w?null:(0,e.jsxs)("div",{"data-graview-fields":i.id,style:{display:"grid",gap:14,alignContent:"start",minWidth:0,fontSize:"0.875rem"},children:[J(n,h).map((p,g)=>{let f=(0,e.jsx)("dl",{style:{margin:0,display:"grid",gridTemplateColumns:"auto 1fr",gap:"5px 16px",alignContent:"start",minWidth:0},children:p.fields.map(t=>t.files?(0,e.jsx)(z,{as:"field",nodeId:i.id,field:t.key,label:s[t.key]??t.label,files:t.files,labelStyle:T,style:{marginTop:6}},t.key):t.long?(0,e.jsx)(le,{nodeId:i.id,field:t.key,label:s[t.key]??t.label,value:t.value,markdown:t.markdown,labelStyle:T,style:{gridColumn:"1 / -1",marginTop:6}},t.key):(0,e.jsxs)("div",{style:{display:"contents"},children:[(0,e.jsx)("dt",{style:{...T,whiteSpace:"nowrap"},children:s[t.key]??t.label}),(0,e.jsxs)("dd",{style:{margin:0,minWidth:0},children:[t.linked?(0,e.jsx)(Z,{relation:t.linked.relation,refs:t.linked.refs,nodeId:i.id,field:t.key}):t.app?(0,e.jsx)(te,{address:t.app,as:"record",nodeId:i.id,field:t.key}):t.href?(0,e.jsx)(oe,{href:t.href,field:t.key,value:t.value,stored:t.stored,nodeId:i.id}):(0,e.jsx)(H,{nodeId:i.id,field:t.key,value:t.value,stored:t.stored}),t.repeats?(0,e.jsx)(ee,{nodeId:i.id,field:t.key,start:i[t.key],value:i[`${t.key}Repeat`],label:`${s[t.key]??t.label} repeats`}):null]})]},t.key))});if(!p.title)return(0,e.jsx)("div",{children:f},g);let k=`graview-field-group-${i.id}-${g}`;return(0,e.jsxs)("div",{role:"group","aria-labelledby":k,style:{display:"grid",gap:6,minWidth:0},children:[(0,e.jsx)("p",{id:k,"data-graview-field-group":p.title,style:se,children:p.title}),f]},g)}),w?(0,e.jsx)(z,{as:"unfilled",nodeId:i.id,skip:a,labels:s,labelStyle:T}):null]})}var T={color:"var(--graview-ink-faint)",fontSize:"0.8125rem"},se={margin:0,fontSize:"0.75rem",letterSpacing:"0.06em",textTransform:"uppercase",color:"var(--graview-ink-muted)",fontWeight:560};function le(r){return _()?(0,e.jsx)(pe,{...r}):(0,e.jsx)(de,{...r})}function de({field:r,label:a,value:d,labelStyle:s,valueStyle:m,style:y,markdown:i}){return(0,e.jsxs)("div",{"data-graview-long":r,style:{display:"grid",gap:6,minWidth:0,...y},children:[(0,e.jsx)("dt",{style:s,children:a}),(0,e.jsx)("dd",{style:{margin:0,minWidth:0,...m},children:(0,e.jsx)("div",{"data-graview-field":r,children:(0,e.jsx)(M,{text:d,markdown:i})})})]})}function pe({nodeId:r,field:a,label:d,value:s,labelStyle:m,valueStyle:y,style:i,markdown:n}){let{fields:h,commit:w}=C(r),p=h.find(c=>c.field===a&&c.takesValue),[g,f]=(0,u.useState)(!1),k=(0,u.useRef)(null),t=(0,u.useRef)(!1);(0,u.useEffect)(()=>{!g&&t.current&&(t.current=!1,k.current?.focus())},[g]);let L=c=>{t.current=c,f(!1)},l=d.toLowerCase(),S=(0,e.jsx)(M,{text:s,markdown:n});return(0,e.jsxs)("div",{"data-graview-long":a,style:{display:"grid",gap:6,minWidth:0,...i},children:[(0,e.jsxs)("dt",{style:{display:"flex",alignItems:"baseline",gap:10,...m},children:[(0,e.jsx)("span",{children:d}),p&&!g?(0,e.jsx)("button",{ref:k,type:"button","data-graview-editable":p.mutation,"aria-label":`Edit the ${l}`,title:`${p.title} \u2014 changes the ${l}, and can be undone`,onClick:()=>f(!0),style:me,children:"Edit"}):null]}),(0,e.jsx)("dd",{style:{margin:0,minWidth:0,...y},children:g&&p?(0,e.jsx)(u.Suspense,{fallback:S,children:(0,e.jsx)(ue,{field:a,label:d,value:s,...n?{markdown:!0}:{},onCancel:()=>L(!0),onSave:(c,I)=>{L(!I),c!==s&&w(p,c)}})}):(0,e.jsx)("div",{"data-graview-field":a,...p?{}:{"data-graview-readonly":"",title:`Read-only \u2014 nothing this app declares changes the ${l}`},...p?{onClick:()=>f(!0)}:{},style:{cursor:p?"text":"default",minWidth:0},children:S})})]})}var ue=(0,u.lazy)(()=>import("./chunk.FWCOJDOD.js")),me={all:"unset",cursor:"pointer",fontSize:"0.75rem",letterSpacing:"normal",textTransform:"none",color:"var(--graview-accent)",borderBottom:"1px dashed currentColor",minHeight:24,minWidth:24,display:"inline-flex",alignItems:"flex-end"};function Ce({nodeId:r,children:a}){let{fields:d}=C(r),s=R(r);if(!s)return(0,e.jsx)(e.Fragment,{children:a});let m=d.find(y=>{let i=s[y.field];return typeof i=="string"&&i===a});return m?(0,e.jsx)(H,{nodeId:r,field:m.field,value:a,said:a}):(0,e.jsx)(e.Fragment,{children:a})}export{te as a,H as b,oe as c,We as d,le as e,Ce as f};
@@ -0,0 +1 @@
1
+ import{d as L}from"./chunk.KN3ULTGF.js";import{a as R,b as O,c as v,d as P}from"./chunk.UGFDSE37.js";import"./chunk.R26DREVU.js";import"./chunk.FGVKJWNS.js";import"./chunk.YV2LJFGS.js";import"./chunk.QNGWEV47.js";import"./chunk.ERXSYPYL.js";import"./chunk.J2ITFGN3.js";import"./chunk.V5ZYUVMH.js";import"./chunk.GLBHQFJ2.js";import"./chunk.QTA4ROAK.js";import"./chunk.2CIBWZJG.js";import{a as E,b as T}from"./chunk.MB7LKKUD.js";import"./chunk.RRVIXV7W.js";import"./chunk.7BWT5L2L.js";import"./chunk.VSZQXB4Q.js";import"./chunk.RI3PYG5T.js";import"./chunk.UWGWXFWZ.js";import"./chunk.SE5SKFQH.js";import"./chunk.W3S6UXNA.js";import"./chunk.WVUJXDXZ.js";import"./chunk.OZNW5W4Z.js";import"./chunk.NDADLJE6.js";import"./chunk.AK3IHFCF.js";import"./chunk.HHPGWJDO.js";import"./chunk.42YX6NOY.js";import"./chunk.EYZ7MHBZ.js";import"./chunk.KQT7WAQE.js";import"./chunk.PAVR5TK5.js";import"./chunk.OQDETV4X.js";import"./chunk.3VL5WECB.js";import"./chunk.JH6MU6TX.js";import"./chunk.WAFDCOOG.js";import"./chunk.L4DECHXR.js";import{G as D,R as C,ua as x}from"./chunk.GFF2FB2J.js";import{dc as k}from"./chunk.6V2RG5JG.js";import{b as S}from"./chunk.AJZBJBMO.js";var o=S(D(),1);var i=S(C(),1);function W(c){let e=document.activeElement;if(e!==null&&e!==document.body&&e!==document.documentElement&&e.isConnected)return;let r=c??document,a=r.querySelector("main")??r.querySelector("[data-graview-page]")??null,n=r.querySelector("[data-graview-page-title]")??a?.querySelector("h1, h2")??a;n instanceof HTMLElement&&(n.hasAttribute("tabindex")||n.setAttribute("tabindex","-1"),n.focus({preventScroll:!0}))}var H=1500;function z(c,e,r){let{store:a,principal:n}=c,u=L(a),l=(0,o.useMemo)(()=>R(a,n),[a,n,u]),b=(0,o.useRef)(r),[p,m]=(0,o.useState)(),[s,f]=(0,o.useState)("");(0,o.useEffect)(()=>{let t=O(a,n,b.current);b.current=a.batches().length,t&&(m({batch:t.batch,at:e,when:Date.now()}),f(""))},[a,n,u]),(0,o.useEffect)(()=>{m(t=>!t||t.at===e?t:Date.now()-t.when<H?{...t,at:e}:void 0)},[e]);let[g,h]=(0,o.useState)(null),y=(0,o.useCallback)(()=>{m(void 0),h(null)},[]),w=(0,o.useCallback)(()=>{h(null);try{let t=P(a,n);t&&f(`Took back \u201C${t.intent}\u201D`)}catch(t){h(t instanceof Error?t.message:String(t))}},[a,n]),d=l&&p?.batch===l.batch&&p.at===e?l:void 0;return{change:l,offered:d,close:y,takeBack:w,refused:g,said:s}}function Y({context:c,docked:e,at:r,since:a}){let{change:n,offered:u,close:l,takeBack:b,refused:p,said:m}=z(c,r,a),s=e?u:n,f=(0,o.useRef)(null),g=e&&(s!==void 0||p!==null);B(f,g),(0,o.useEffect)(()=>{if(!g)return;let d,t=()=>d=setTimeout(()=>f.current?.matches(":hover, :focus-within")?t():l(),1e4);return t(),()=>clearTimeout(d)},[g,s?.batch,p,l]);let h=m||(e&&s?v(s):""),y=e?{position:"fixed",inset:"auto",margin:0,padding:0,border:"none",background:"none",overflow:"visible",zIndex:k("toast"),width:"max-content",height:"auto",bottom:"calc(16px + env(safe-area-inset-bottom, 0px))",left:16,justifyItems:"start",color:"var(--graview-ink)",...g?{}:{display:"none"}}:{},w=s?(0,i.jsxs)("button",{type:"button","data-testid":"page-undo",title:`${v(s)} \u2014 \u2318Z or Ctrl+Z`,"aria-keyshortcuts":"Meta+Z Control+Z",onClick:d=>{let t=d.currentTarget.closest("[data-graview-face]");b(),requestAnimationFrame(()=>W(t))},style:e?I:A,children:[(0,i.jsx)("span",{"aria-hidden":"true",children:"\u21B6"}),(0,i.jsx)("span",{style:e?j:F,children:v(s)})]}):null;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("span",{role:"status","aria-live":"polite",style:N,children:h}),(0,i.jsxs)("div",{ref:f,...e?{popover:"manual","data-graview-foot":"","data-graview-offstage":""}:{},"data-testid":e?"face-undo-dock":"page-undo-place",style:{display:"grid",justifyItems:"end",gap:4,maxWidth:"100%",minWidth:0,...y},children:[e&&s?(0,i.jsxs)("div",{"data-testid":"page-undo-notice",style:_,children:[w,(0,i.jsx)("button",{type:"button","data-testid":"page-undo-dismiss","aria-label":`Dismiss: ${v(s)}`,title:"Dismiss",onClick:d=>{let t=d.currentTarget.closest("[data-graview-face]");l(),requestAnimationFrame(()=>W(t))},style:q,children:"\xD7"})]}):w,p?(0,i.jsx)("span",{"data-testid":"page-undo-refused",role:"alert",style:{fontSize:"0.8125rem",lineHeight:1.4,color:"var(--graview-warn)",background:e?"var(--graview-float)":void 0,padding:e?"4px 8px":void 0,borderRadius:6},children:p}):null]})]})}function B(c,e){(0,o.useLayoutEffect)(()=>{let r=c.current;if(!r||!e)return;if(typeof r.showPopover=="function"&&!x(r))try{r.showPopover()}catch{}let a=()=>r.parentElement?.closest("[data-embed-content]")??null,n=()=>{T(r,a()),dispatchEvent(new Event(E))};n(),addEventListener("resize",n),addEventListener("scroll",n,!0);let u=typeof ResizeObserver=="function"?new ResizeObserver(n):null;return u?.observe(r),()=>{if(u?.disconnect(),removeEventListener("resize",n),removeEventListener("scroll",n,!0),r.isConnected&&x(r))try{r.hidePopover()}catch{}dispatchEvent(new Event(E))}},[c,e])}var A={display:"inline-flex",alignItems:"center",gap:6,minHeight:36,maxWidth:"100%",minWidth:0,padding:"0 14px",borderRadius:999,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",color:"var(--graview-ink)",font:"inherit",fontSize:"0.875rem",cursor:"pointer"},I={...A,textAlign:"start",lineHeight:1.4,padding:"8px 4px 8px 14px",border:"none",background:"none",color:"inherit"},_={display:"flex",alignItems:"center",gap:2,maxWidth:"100%",minWidth:0,paddingRight:6,borderRadius:"var(--graview-radius, 12px)",border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)"},q={flex:"0 0 auto",minWidth:28,minHeight:28,padding:0,border:"none",background:"none",boxShadow:"none",color:"var(--graview-ink-muted)",font:"inherit",fontSize:"1rem",cursor:"pointer"},F={minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},j={minWidth:0,overflow:"hidden",overflowWrap:"anywhere",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:4},N={position:"absolute",width:1,height:1,margin:-1,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0};export{Y as TakeBack};
@@ -0,0 +1 @@
1
+ import{a as H,b as I,c as j,e as R,h as V,i as D,j as A,k,l as x,n as Y,o as Z}from"./chunk.W3S6UXNA.js";import{b as U}from"./chunk.JH6MU6TX.js";import{G as C,J as G,Ja as T,Ma as B,P as M,W,Y as F}from"./chunk.6V2RG5JG.js";function re(e,r){return e===void 0||e===!0?!0:e===!1?!1:e[r]!==!1}function te(e){let r={};return e.query&&e.query.trim().length>0&&(r.q=e.query),e.archived!==void 0&&e.archived!==!1&&(r.archived=String(e.archived)),e.sort&&(r.sort=e.sort.direction==="desc"?`${e.sort.by}:desc`:e.sort.by),e.filter?.length&&(r.filter=e.filter.map(n=>`${n.key}:${n.value}`).join(",")),e.group&&(r.group=e.group.bucket?`${e.group.by}:${e.group.bucket}`:e.group.by),r}function ne(e,r){let n=[],s={};if(e.query&&(s.query=e.query),e.archived!==void 0&&e.archived!==!1&&(s.archived=e.archived),e.sort&&(r.sorts.some(u=>u.key===e.sort.by)?s.sort=e.sort:n.push(`sort ${e.sort.by}`)),e.filter){let u=e.filter.filter(c=>r.filters.find(l=>l.key===c.key)?!0:(n.push(`filter ${c.key}`),!1));u.length>0&&(s.filter=u)}return e.group&&(r.groups.some(u=>u.key===e.group.by)?s.group=e.group:n.push(`group ${e.group.by}`)),{arrangement:s,dropped:n}}function S(e,r){return W(e.schema.tryDefinition(r.kind),A(r))}var oe=(e,r)=>e==null?r==null?0:1:r==null?-1:typeof e=="number"&&typeof r=="number"?e-r:typeof e=="boolean"&&typeof r=="boolean"?e===r?0:e?1:-1:String(e).localeCompare(String(r),void 0,{numeric:!0,sensitivity:"base"});function ie(e,r,n){if(n==="label")return S(e,r);let s=e.schema.tryDefinition(r.kind);return s&&n in(s.fields.shape??{})?T(D(r),n,e.today??C()):s?.computed?.[n]!==void 0?e.read?.(r,n):k(e.graph,r.id,n).map(c=>S(e,c)).sort()[0]}var se=/^(\d{4})-(\d{2})-(\d{2})/;function _(e,r){let n=se.exec(e);if(!n)return;let[,s,u,c]=n;if(r==="day")return`${s}-${u}-${c}`;if(r==="month")return`${s}-${u}-01`;if(r==="year")return`${s}-01-01`;if(r==="decade")return`${String(Number(s)-Number(s)%10).padStart(4,"0")}-01-01`;let a=new Date(Date.UTC(Number(s),Number(u)-1,Number(c))),l=(a.getUTCDay()+6)%7;return a.setUTCDate(a.getUTCDate()-l),a.toISOString().slice(0,10)}function de(e,r){return r==="month"?M(e):r==="week"?`Week of ${G(e)}`:r==="year"?e.slice(0,4):r==="decade"?`The ${e.slice(0,4)}s`:G(e)}function ue(e,r,n){return z(e,n)(r)}function z(e,r){let{words:n,conditions:s}=Y(r);if(n.length===0&&s.length===0)return()=>!0;let u=new Map,c=a=>{let l=u.get(a);return l||(l=new Set(R(e.schema,a).filters.map(d=>d.key)),u.set(a,l)),l};return a=>{let l=c(a.kind),d=s.filter(i=>l.has(i.key));return d.every(i=>x(e,a,i))?n.length>0?Z(e.schema.tryDefinition(a.kind),A(a),n)!==void 0:d.length>0:!1}}function ae(e,r,n){let s=r.query?.trim(),u=r.archived===void 0?e:e.filter(t=>B(t,r.archived)),c=s?u.filter(z(n,s)):u,a=r.filter?.length?c.filter(t=>r.filter.every(f=>x(n,t,f))):[...c],l=[];for(let t=r.sort;t&&l.length<4;t=t.then)l.push(t);let d=l.length>0?a.map((t,f)=>({node:t,index:f,values:l.map(o=>ie(n,t,o.by))})).sort((t,f)=>{for(let[o,p]of l.entries()){let[h,K]=[t.values[o],f.values[o]],v=oe(h,K),E=p.direction==="desc"&&v!==0&&h!==void 0&&K!==void 0?-v:v;if(E!==0)return E}return t.index-f.index}).map(t=>t.node):a,i=r.group;if(!i)return{nodes:d,groups:[{key:"",label:"",nodes:d}],grouped:!1};let y=new Map,g=(t,f,o)=>{let p=y.get(t)??{label:f,nodes:[]};p.nodes.push(o),y.set(t,p)},N=d[0],m=N?n.schema.tryDefinition(N.kind):void 0,O=m?.fields.shape??{},J=m?H(m,i.by):F(i.by),$=i.by in O,b=$?I(O[i.by]):void 0,X=j(n.schema,N?.kind??"").find(t=>t.key===i.by)?.label,L=$?`No ${J.toLowerCase()}`:`Without ${(X??F(i.by)).toLowerCase()}`,q=$?new Map:U([...new Map(d.flatMap(t=>k(n.graph,t.id,i.by)).map(t=>[t.id,t])).values()].map(A),t=>n.schema.tryDefinition(t));for(let t of d){if($){let o=T(D(t),i.by,n.today??C());if(o==null||o==="")g("",L,t);else if(b==="date"){let p=i.bucket??"day",h=_(String(o),p);h?g(h,de(h,p),t):g("",L,t)}else if(b==="boolean")g(o?"1":"0",o?"Yes":"No",t);else{let p=m?.display?.format?.[i.by];g(String(o),p?p(o):String(o),t)}continue}let f=k(n.graph,t.id,i.by).map(o=>({id:o.id,label:q.has(o.id)?`${S(n,o)} \xB7 ${q.get(o.id)}`:S(n,o)})).sort((o,p)=>o.label.localeCompare(p.label));f.length===0?g("",L,t):g(f.map(o=>o.id).join(","),f.map(o=>o.label).join(", "),t)}let w=b==="choice"?V(O[i.by]):void 0,ee=[...y.entries()].sort(([t,f],[o,p])=>t===""?1:o===""?-1:w?w.indexOf(t)-w.indexOf(o):b==="boolean"?o.localeCompare(t):b==="date"?t.localeCompare(o):f.label.localeCompare(p.label)).map(([t,f])=>({key:t,label:f.label,nodes:f.nodes}));return{nodes:d,groups:ee,grouped:!0}}function P(e){if(e===void 0)return;if(typeof e=="string")return{by:e,direction:"asc"};let r=e.then===void 0?void 0:typeof e.then=="string"?{by:e.then,direction:"asc"}:{by:e.then.by,direction:e.then.direction??"asc"};return{by:e.by,direction:e.direction??"asc",...r?{then:r}:{}}}function Q(e){if(e!==void 0)return typeof e=="string"?{by:e}:e}function le(e){let r=P(e?.sort),n=Q(e?.group);if(!(!r&&!n))return{...r?{sort:r}:{},...n?{group:{by:n.by}}:{}}}var fe=(e,r)=>r?e==="1"?"true":"false":e;function ce(e,r,n){let s=n.type==="boolean",u=s?["true","false"]:n.options??[],c=[...new Set([...(r.order??[]).filter(d=>u.includes(d)),...u])],a=r.closed??[],l=d=>{if(d.key==="")return[1,0];let i=fe(d.key,s);if(a.includes(i))return[2,a.indexOf(i)];let y=c.indexOf(i);return[0,y<0?c.length:y]};return e.map((d,i)=>({group:d,at:i,rank:l(d)})).sort((d,i)=>d.rank[0]-i.rank[0]||d.rank[1]-i.rank[1]||d.at-i.at).map(({group:d,rank:i})=>({...d,closed:i[0]===2}))}export{Q as a,le as b,ce as c,re as d,te as e,ne as f,ue as g,ae as h};
@@ -0,0 +1 @@
1
+ import{a as k}from"./chunk.TI4OSTQV.js";import"./chunk.AJZBJBMO.js";function E(e,n){let r;for(let s of[...e??[]].sort((a,p)=>a.seq-p.seq)){if(s.seq>n)break;s.declaration&&(r=s.declaration)}return r}var $=e=>e,G=new WeakMap,P=new WeakMap;function j(e,n){let r=typeof n=="string"?Date.parse(n):n.getTime();if(Number.isNaN(r))throw new RangeError(`\u201C${String(n)}\u201D is not a time`);let a=e.log.all().findIndex(p=>Date.parse(p.at)>r);return a===-1?e.log.length:e.log.horizon+a}function N(e,n,r={}){let s=k(e);if(s)return N(s.store,n,r).seenBy(s.principal);let a=$(e),p=e.log,i=p.horizon,o=typeof n=="number"?n:j(e,n);if(!Number.isInteger(o)||o<i||o>p.length)throw new RangeError(`No moment at seq ${o}: this store holds seqs ${i} to ${p.length}${i>0?"; what is before its horizon is in the archive":""}`);let d=p.all(),l=r.declaration,u=l?.schema??e.schema,S=p.epochs().filter(t=>t.seq<=o),g=S.at(-1),b=g?.seq??i,q=t=>t>i?d[t-1-i]?.id:void 0,f=(G.get(e)??[]).filter(t=>t.seq<=p.length&&q(t.seq)===t.id);G.set(e,f);let O=[...f].reverse().find(t=>t.seq>=b&&t.seq<=o),h=O?.seq??b,M=O?.base??g?.base??H(e),D=e.graph.constructor,m;try{m=D.from(u,M,{validate:a.validate})}catch{m=D.from(u,M,{validate:!1})}let A=e.pastEvery,x=(t,c)=>{f.some(v=>v.seq===t)||(f.push({seq:t,id:c,base:m.snapshot()}),f.sort((v,z)=>v.seq-z.seq))};for(let t=h;t<o;t++){let c=d[t-i];try{K(m,c)}catch{}(t+1)%A===0&&t+1<o&&x(t+1,c.id)}o-h>=A&&x(o,q(o));let I=d[o-1-i]?.at??g?.at,y=(t,c)=>c===void 0?{}:{[t]:c},w=e.constructor;return new w({schema:u,invariants:l?.invariants??a.invariants,invariantOptions:a.invariantOptions,...y("policy",l?l.policy:e.policy),...y("modules",l?.modules??a.declaredModules),...y("enabledModules",a.startingModules),intelligence:e.intelligence,principal:a.by,log:d.slice(0,o-i),epochs:S,...i>0&&!S.some(t=>t.horizon)?{horizon:i}:{},snapshot:m.snapshot(),validate:!1,now:a.now,past:{seq:o,...y("at",I),foldedFrom:h,folded:o-h}})}function H(e){let n=e.log.all(),r=e.log.horizon,s=n[0]?.id,a=P.get(e);if(a&&a.firstId===s)return a.base;let p=e.log.epochs().find(d=>d.seq>r),i=e.graph.constructor.from(e.schema,p?.base??e.graph.snapshot(),{validate:!1});for(let d=(p?.seq??e.log.length)-1;d>=r;d--)try{i.applyPrimitives(n[d-r].inverse,{restoring:!0})}catch{}let o=i.snapshot();return P.set(e,{firstId:s,base:o}),o}function V(e,n,r={}){let s=typeof n=="number"?n:j(e,n);return N(e,s,{declaration:E(r.declarations,s)})}function K(e,n){if(n.undoes!==void 0){e.applyPrimitives(n.primitives,{restoring:!0});return}try{e.applyPrimitives(n.primitives)}catch{e.applyPrimitives(n.primitives,{restoring:!0})}}export{E as declarationAt,V as pastAt,N as pastOf,j as seqAt};
@@ -0,0 +1,47 @@
1
+ import{a as bt,c as Et,d as te}from"./chunk.KN3ULTGF.js";import{h as St}from"./chunk.R26DREVU.js";import{a as dt}from"./chunk.QTA4ROAK.js";import{a as Cr}from"./chunk.UZWWDAGM.js";import{d as ht}from"./chunk.JH6MU6TX.js";import{d as ft}from"./chunk.WAFDCOOG.js";import{d as ct,i as mt,j as pt,m as yt,n as gt,o as vt,x as Rt,y as wt}from"./chunk.L4DECHXR.js";import{G as M,O as st,R as X,_ as ut}from"./chunk.GFF2FB2J.js";import{$ as ie,Ka as qe,Nc as ot,Oc as it,Pc as lt,Tb as et,Y as Se,cc as tt,xc as rt,yc as at,zc as nt}from"./chunk.6V2RG5JG.js";import{b as D}from"./chunk.AJZBJBMO.js";function Lr(e,t){return rt(e,t).slice(1)}function be(e,t){return e.kinds.find(r=>Lr(e,r)===t)}function vn(e,t,r){return at(e,t,r)}function Rn(e,t){return nt(e,t)}var A=D(M(),1),g=D(M(),1),E=D(M(),1),je=D(M(),1),or=D(M(),1),b=D(M(),1),Ga=D(M(),1),Xa=D(M(),1),Qa=D(M(),1),v=D(M(),1),gr=D(M(),1);var ke=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,Nt=/^[\\/]{2}/;function Dr(e,t){return t+e.replace(/\\/g,"/")}var xt="popstate";function de(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function Ot(e={}){let{initialEntries:t=["/"],initialIndex:r,v5Compat:a=!1}=e,n;n=t.map((f,y)=>c(f,typeof f=="string"?null:f.state,y===0?"default":void 0,typeof f=="string"?void 0:f.mask));let o=s(r??n.length-1),i="POP",l=null;function s(f){return Math.min(Math.max(f,0),n.length-1)}function u(){return n[o]}function c(f,y=null,m,h){let S=fe(n?u().pathname:"/",f,y,m,h);return N(S.pathname.charAt(0)==="/",`relative pathnames are not supported in memory history: ${JSON.stringify(f)}`),S}function d(f){return typeof f=="string"?f:j(f)}return{get index(){return o},get action(){return i},get location(){return u()},createHref:d,createURL(f){return new URL(d(f),"http://localhost")},encodeLocation(f){let y=typeof f=="string"?B(f):f;return{pathname:y.pathname||"",search:y.search||"",hash:y.hash||""}},push(f,y){i="PUSH";let m=de(f)?f:c(f,y);o+=1,n.splice(o,n.length,m),a&&l&&l({action:i,location:m,delta:1})},replace(f,y){i="REPLACE";let m=de(f)?f:c(f,y);n[o]=m,a&&l&&l({action:i,location:m,delta:0})},go(f){i="POP";let y=s(o+f),m=n[y];o=y,l&&l({action:i,location:m,delta:f})},listen(f){return l=f,()=>{l=null}}}}function Mt(e={}){function t(a,n){let o=n.state?.masked,{pathname:i,search:l,hash:s}=o||a.location;return fe("",{pathname:i,search:l,hash:s},n.state&&n.state.usr||null,n.state&&n.state.key||"default",o?{pathname:a.location.pathname,search:a.location.search,hash:a.location.hash}:void 0)}function r(a,n){return typeof n=="string"?n:j(n)}return kr(t,r,null,e)}function P(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function N(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function Fr(){return Math.random().toString(36).substring(2,10)}function Pt(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function fe(e,t,r=null,a,n){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?B(t):t,state:r,key:t&&t.key||a||Fr(),mask:n}}function j({pathname:e="/",search:t="",hash:r=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function B(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substring(r),e=e.substring(0,r));let a=e.indexOf("?");a>=0&&(t.search=e.substring(a),e=e.substring(0,a)),e&&(t.pathname=e)}return t}function kr(e,t,r,a={}){let{window:n=document.defaultView,v5Compat:o=!1}=a,i=n.history,l="POP",s=null,u=c();u==null&&(u=0,i.replaceState({...i.state,idx:u},""));function c(){return(i.state||{idx:null}).idx}function d(){l="POP";let h=c(),S=h==null?null:h-u;u=h,s&&s({action:l,location:m.location,delta:S})}function p(h,S){l="PUSH";let R=de(h)?h:fe(m.location,h,S);r&&r(R,h),u=c()+1;let w=Pt(R,u),x=m.createHref(R.mask||R);try{i.pushState(w,"",x)}catch(C){if(C instanceof DOMException&&C.name==="DataCloneError")throw C;n.location.assign(x)}o&&s&&s({action:l,location:m.location,delta:1})}function f(h,S){l="REPLACE";let R=de(h)?h:fe(m.location,h,S);r&&r(R,h),u=c();let w=Pt(R,u),x=m.createHref(R.mask||R);i.replaceState(w,"",x),o&&s&&s({action:l,location:m.location,delta:0})}function y(h){return Tr(n,h)}let m={get action(){return l},get location(){return e(n,i)},listen(h){if(s)throw new Error("A history only accepts one active listener");return n.addEventListener(xt,d),s=h,()=>{n.removeEventListener(xt,d),s=null}},createHref(h){return t(n,h)},createURL:y,encodeLocation(h){let S=y(h);return{pathname:S.pathname,search:S.search,hash:S.hash}},push:p,replace:f,go(h){return i.go(h)}};return m}function Tr(e,t,r=!1){let a="http://localhost";e&&(a=e.location.origin!=="null"?e.location.origin:e.location.href),P(a,"No window.location.(origin|href) available to create URL");let n=typeof t=="string"?t:j(t);return n=n.replace(/ $/,"%20"),!r&&Nt.test(n)&&(n=a+n),new URL(n,a)}var Nr;Nr=new WeakMap;function Te(e,t,r="/"){return Or(e,t,r,!1)}function Or(e,t,r,a,n){let o=typeof t=="string"?B(t):t,i=H(o.pathname||"/",r);if(i==null)return null;let l=n??Ar(e),s=null,u=Vr(i);for(let c=0;s==null&&c<l.length;++c)s=Yr(l[c],u,a);return s}function Mr(e,t){let{route:r,pathname:a,params:n}=e;return{id:r.id,pathname:a,params:n,data:t[r.id],loaderData:t[r.id],handle:r.handle}}function Ar(e){let t=At(e);return _r(t),t}function At(e,t=[],r=[],a="",n=!1){let o=(i,l,s=n,u)=>{let c={relativePath:u===void 0?i.path||"":u,caseSensitive:i.caseSensitive===!0,childrenIndex:l,route:i};if(c.relativePath.startsWith("/")){if(!c.relativePath.startsWith(a)&&s)return;P(c.relativePath.startsWith(a),`Absolute route path "${c.relativePath}" nested under path "${a}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(a.length)}let d=$([a,c.relativePath]),p=r.concat(c);i.children&&i.children.length>0&&(P(i.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${d}".`),At(i.children,t,p,d,s)),!(i.path==null&&!i.index)&&t.push({path:d,score:Br(d,i.index),routesMeta:p.map((f,y)=>{let[m,h]=It(f.relativePath,f.caseSensitive,y===p.length-1);return{...f,matcher:m,compiledParams:h}})})};return e.forEach((i,l)=>{if(i.path===""||!i.path?.includes("?"))o(i,l);else for(let s of _t(i.path))o(i,l,!0,s)}),t}function _t(e){let t=e.split("/");if(t.length===0)return[];let[r,...a]=t,n=r.endsWith("?"),o=r.replace(/\?$/,"");if(a.length===0)return n?[o,""]:[o];let i=_t(a.join("/")),l=[];return l.push(...i.map(s=>s===""?o:[o,s].join("/"))),n&&l.push(...i),l.map(s=>e.startsWith("/")&&s===""?"/":s)}function _r(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:Wr(t.routesMeta.map(a=>a.childrenIndex),r.routesMeta.map(a=>a.childrenIndex)))}var $r=/^:[\w-]+$/,Ir=3,Hr=2,Ur=1,jr=10,zr=-2,Ct=e=>e==="*";function Br(e,t){let r=e.split("/"),a=r.length;return r.some(Ct)&&(a+=zr),t&&(a+=Hr),r.filter(n=>!Ct(n)).reduce((n,o)=>n+($r.test(o)?Ir:o===""?Ur:jr),a)}function Wr(e,t){return e.length===t.length&&e.slice(0,-1).every((a,n)=>a===t[n])?e[e.length-1]-t[t.length-1]:0}function Yr(e,t,r=!1){let{routesMeta:a}=e,n={},o="/",i=[];for(let l=0;l<a.length;++l){let s=a[l],u=l===a.length-1,c=o==="/"?t:t.slice(o.length)||"/",d={path:s.relativePath,caseSensitive:s.caseSensitive,end:u},p=s.matcher&&s.compiledParams?$t(d,c,s.matcher,s.compiledParams):ae(d,c),f=s.route;if(!p&&u&&r&&!a[a.length-1].route.index&&(p=ae({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},c)),!p)return null;Object.assign(n,p.params),i.push({params:n,pathname:$([o,p.pathname]),pathnameBase:Kr($([o,p.pathnameBase])),route:f}),p.pathnameBase!=="/"&&(o=$([o,p.pathnameBase]))}return i}function ae(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,a]=It(e.path,e.caseSensitive,e.end);return $t(e,t,r,a)}function $t(e,t,r,a){let n=t.match(r);if(!n)return null;let o=n[0],i=Q(o,1),l=n.slice(1);return{params:a.reduce((u,{paramName:c,isOptional:d},p)=>{if(c==="*"){let y=l[p]||"";i=Q(o.slice(0,o.length-y.length),1)}let f=l[p];return d&&!f?u[c]=void 0:u[c]=(f||"").replace(/%2F/g,"/"),u},{}),pathname:o,pathnameBase:i,pattern:e}}function It(e,t=!1,r=!0){N(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let a=[],n="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(i,l,s,u,c)=>{if(a.push({paramName:l,isOptional:s!=null}),s){let d=c.charAt(u+i.length);return d&&d!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(a.push({paramName:"*"}),n+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?n+="\\/*$":e!==""&&e!=="/"&&(n+="(?:(?=\\/|$))"),[new RegExp(n,t?void 0:"i"),a]}function Vr(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return N(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function H(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,a=e.charAt(r);return a&&a!=="/"?null:e.slice(r)||"/"}function Ht(e,t="/"){let{pathname:r,search:a="",hash:n=""}=typeof e=="string"?B(e):e,o;return r?(r=Ut(r),r.startsWith("/")||r.startsWith("\\")?o=Lt(r.substring(1),"/"):o=Lt(r,t)):o=t,{pathname:o,search:Gr(a),hash:Xr(n)}}function Lt(e,t){let r=Q(t).split("/");return e.split("/").forEach(n=>{n===".."?r.length>1&&r.pop():n!=="."&&r.push(n)}),r.length>1?r.join("/"):"/"}function Ee(e,t,r,a){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(a)}]. Please separate it out to the \`to.${r}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function Jr(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function Ne(e){let t=Jr(e);return t.map((r,a)=>a===t.length-1?r.pathname:r.pathnameBase)}function pe(e,t,r,a=!1){let n;typeof e=="string"?n=B(e):(n={...e},P(!n.pathname||!n.pathname.includes("?"),Ee("?","pathname","search",n)),P(!n.pathname||!n.pathname.includes("#"),Ee("#","pathname","hash",n)),P(!n.search||!n.search.includes("#"),Ee("#","search","hash",n)));let o=e===""||n.pathname==="",i=o?"/":n.pathname,l;if(i==null)l=r;else{let d=t.length-1;if(!a&&i.startsWith("..")){let p=i.split("/");for(;p[0]==="..";)p.shift(),d-=1;n.pathname=p.join("/")}l=d>=0?t[d]:"/"}let s=Ht(n,l),u=i&&i!=="/"&&i.endsWith("/"),c=(o||i===".")&&r.endsWith("/");return!s.pathname.endsWith("/")&&(u||c)&&(s.pathname+="/"),s}var Ut=e=>e.replace(/[\\/]{2,}/g,"/"),$=e=>Ut(e.join("/"));function Q(e,t=0){let r=e.length;for(;r>t&&e.charCodeAt(r-1)===47;)r--;return r===e.length?e:e.slice(0,r)}var Kr=e=>Q(e).replace(/^\/*/,"/"),Gr=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,Xr=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;var jt=class{constructor(e,t,r,a=!1){this.status=e,this.statusText=t||"",this.internal=a,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}};function zt(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function Qr(e){let t=e.map(r=>r.route.path).filter(Boolean);return $(t)||"/"}var Bt=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Wt(e,t){let r=e;if(typeof r!="string"||!ke.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let a=r,n=!1;if(Bt)try{let o=new URL(window.location.href),i=Nt.test(r)?new URL(Dr(r,o.protocol)):new URL(r),l=H(i.pathname,t);i.origin===o.origin&&l!=null?r=l+i.search+i.hash:n=!0}catch{N(!1,`<Link to="${r}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:a,isExternal:n,to:r}}var Sn=Symbol("Uninstrumented");var bn=Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var Dt=new URL("http://localhost");function Oe(e){if(e.createURL)return e.createURL("/");try{return new URL(e.createHref("/"),Dt)}catch{return Dt}}function xe(e,t){return e.origin===t.origin&&(e.origin!=="null"||e.protocol===t.protocol&&e.host===t.host)}function Zr(e,t){if(e.startsWith("//"))return!0;let r=t.protocol.toLowerCase();return e.toLowerCase().startsWith(r)?t.host===""||e.slice(r.length).startsWith("//"):!1}function Me(e,t,r,a){let n=null;try{n=e==null?null:new URL(e,r)}catch{}let o=new URL(t,r),i=n!=null&&!xe(n,r),l=!xe(o,r);if(a==="reject"){if(i||l)throw new Error("External navigation is not allowed")}else if(l&&(n==null||!Zr(e,n)||!xe(n,o)))throw new Error("External navigation is not allowed")}var Yt=["POST","PUT","PATCH","DELETE"],En=new Set(Yt),qr=["GET",...Yt],xn=new Set(qr);var Pn=Symbol("ResetLoaderData"),ea,ta,ra,aa;ea=new WeakMap;ta=new WeakMap;ra=new WeakMap;aa=new WeakMap;var na=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function oa(e){try{return na.includes(new URL(e).protocol)}catch{return!1}}var Y=A.createContext(null);Y.displayName="DataRouter";var Z=A.createContext(null);Z.displayName="DataRouterState";var Vt=A.createContext(!1);function ia(){return A.useContext(Vt)}var Ae=A.createContext({isTransitioning:!1});Ae.displayName="ViewTransition";var Jt=A.createContext(new Map);Jt.displayName="Fetchers";var la=A.createContext(null);la.displayName="Await";var T=A.createContext(null);T.displayName="Navigation";var V=A.createContext(null);V.displayName="Location";var _=A.createContext({outlet:null,matches:[],isDataRoute:!1});_.displayName="Route";var _e=A.createContext(null);_e.displayName="RouteError";var Le=!0,Kt="REACT_ROUTER_ERROR",sa="REDIRECT",ua="ROUTE_ERROR_RESPONSE";function ca(e){if(e.startsWith(`${Kt}:${sa}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.location=="string"&&typeof t.reloadDocument=="boolean"&&typeof t.replace=="boolean")return t}catch{}}function da(e){if(e.startsWith(`${Kt}:${ua}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new jt(t.status,t.statusText,t.data)}catch{}}function ye(e,{relative:t}={}){P(J(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:a}=g.useContext(T),{hash:n,pathname:o,search:i}=q(e,{relative:t}),l=o;return r!=="/"&&(l=o==="/"?r:$([r,o])),a.createHref({pathname:l,search:i,hash:n})}function J(){return g.useContext(V)!=null}function k(){return P(J(),"useLocation() may be used only in the context of a <Router> component."),g.useContext(V).location}function fa(){return g.useContext(V).navigationType}var Gt="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Xt(e){g.useContext(T).static||g.useLayoutEffect(e)}function K(){let{isDataRoute:e}=g.useContext(_);return e?Ea():ha()}function ha(){P(J(),"useNavigate() may be used only in the context of a <Router> component.");let e=g.useContext(Y),{basename:t,navigator:r}=g.useContext(T),{matches:a}=g.useContext(_),{pathname:n}=k(),o=JSON.stringify(Ne(a)),i=g.useRef(!1);return Xt(()=>{i.current=!0}),g.useCallback((s,u={})=>{if(N(i.current,Gt),!i.current)return;if(typeof s=="number"){r.go(s);return}let c=pe(s,JSON.parse(o),n,u.relative==="path");e==null&&t!=="/"&&(c.pathname=c.pathname==="/"?t:$([t,c.pathname])),Me(typeof s=="string"?s:j(s),r.createHref(c),Oe(r),"reject"),(u.replace?r.replace:r.push)(c,u.state,u)},[t,r,o,n,e])}var Cn=g.createContext(null);function ma(){let{matches:e}=g.useContext(_);return e[e.length-1]?.params??{}}function q(e,{relative:t}={}){let{matches:r}=g.useContext(_),{pathname:a}=k(),n=JSON.stringify(Ne(r));return g.useMemo(()=>pe(e,JSON.parse(n),a,t==="path"),[e,n,a,t])}function Qt(e,t){return Zt(e,t)}function Zt(e,t,r){P(J(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:a}=g.useContext(T),{matches:n}=g.useContext(_),o=n[n.length-1],i=o?o.params:{},l=o?o.pathname:"/",s=o?o.pathnameBase:"/",u=o&&o.route;if(Le){let h=u&&u.path||"";rr(l,!u||h.endsWith("*")||h.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${l}" (under <Route path="${h}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
2
+
3
+ Please change the parent <Route path="${h}"> to <Route path="${h==="/"?"*":`${h}/*`}">.`)}let c=k(),d;if(t){let h=typeof t=="string"?B(t):t;P(s==="/"||h.pathname?.startsWith(s),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${s}" but pathname "${h.pathname}" was given in the \`location\` prop.`),d=h}else d=c;let p=d.pathname||"/",f=p;if(s!=="/"){let h=s.replace(/^\//,"").split("/");f="/"+p.replace(/^\//,"").split("/").slice(h.length).join("/")}let y=r&&r.state.matches.length?r.state.matches.map(h=>Object.assign(h,{route:r.manifest[h.route.id]||h.route})):Te(e,{pathname:f});Le&&(N(u||y!=null,`No routes matched location "${d.pathname}${d.search}${d.hash}" `),N(y==null||y[y.length-1].route.element!==void 0||y[y.length-1].route.Component!==void 0||y[y.length-1].route.lazy!==void 0,`Matched leaf route at location "${d.pathname}${d.search}${d.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`));let m=Ra(y&&y.map(h=>Object.assign({},h,{params:Object.assign({},i,h.params),pathname:$([s,a.encodeLocation?a.encodeLocation(h.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:h.pathname]),pathnameBase:h.pathnameBase==="/"?s:$([s,a.encodeLocation?a.encodeLocation(h.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:h.pathnameBase])})),n,r);return t&&m?g.createElement(V.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...d},navigationType:"POP"}},m):m}function pa(){let e=tr(),t=zt(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,a="rgba(200,200,200, 0.5)",n={padding:"0.5rem",backgroundColor:a},o={padding:"2px 4px",backgroundColor:a},i=null;return Le&&(console.error("Error handled by React Router default ErrorBoundary:",e),i=g.createElement(g.Fragment,null,g.createElement("p",null,"\u{1F4BF} Hey developer \u{1F44B}"),g.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",g.createElement("code",{style:o},"ErrorBoundary")," or"," ",g.createElement("code",{style:o},"errorElement")," prop on your route."))),g.createElement(g.Fragment,null,g.createElement("h2",null,"Unexpected Application Error!"),g.createElement("h3",{style:{fontStyle:"italic"}},t),r?g.createElement("pre",{style:n},r):null,i)}var ya=g.createElement(pa,null),qt=class extends g.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){let r=da(e.digest);r&&(e=r)}let t=e!==void 0?g.createElement(_.Provider,{value:this.props.routeContext},g.createElement(_e.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?g.createElement(ga,{error:e},t):t}};qt.contextType=Vt;var Pe=new WeakMap;function ga({children:e,error:t}){let{basename:r,navigator:a}=g.useContext(T);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let n=ca(t.digest);if(n){let o=Pe.get(t);if(o)throw o;let i=Wt(n.location,r),l=i.absoluteURL||i.to;if(Me(n.location,l,Oe(a),"allow-explicit"),oa(l))throw new Error("Invalid redirect location");if(Bt&&!Pe.get(t))if(i.isExternal||n.reloadDocument)window.location.href=l;else{let s=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:n.replace}));throw Pe.set(t,s),s}return g.createElement("meta",{httpEquiv:"refresh",content:`0;url=${l}`})}}return e}function va({routeContext:e,match:t,children:r}){let a=g.useContext(Y);return a&&a.static&&a.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=t.route.id),g.createElement(_.Provider,{value:e},r)}function Ra(e,t=[],r){let a=r?.state;if(e==null){if(!a)return null;if(a.errors)e=a.matches;else if(t.length===0&&!a.initialized&&a.matches.length>0)e=a.matches;else return null}let n=e,o=a?.errors;if(o!=null){let c=n.findIndex(d=>d.route.id&&o?.[d.route.id]!==void 0);P(c>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(",")}`),n=n.slice(0,Math.min(n.length,c+1))}let i=!1,l=-1;if(r&&a){i=a.renderFallback;for(let c=0;c<n.length;c++){let d=n[c];if((d.route.HydrateFallback||d.route.hydrateFallbackElement)&&(l=c),d.route.id){let{loaderData:p,errors:f}=a,y=d.route.loader&&!p.hasOwnProperty(d.route.id)&&(!f||f[d.route.id]===void 0);if(d.route.lazy||y){r.isStatic&&(i=!0),l>=0?n=n.slice(0,l+1):n=[n[0]];break}}}}let s=r?.onError,u=a&&s?(c,d)=>{s(c,{location:a.location,params:a.matches?.[0]?.params??{},pattern:Qr(a.matches),errorInfo:d})}:void 0;return n.reduceRight((c,d,p)=>{let f,y=!1,m=null,h=null;a&&(f=o&&d.route.id?o[d.route.id]:void 0,m=d.route.errorElement||ya,i&&(l<0&&p===0?(rr("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),y=!0,h=null):l===p&&(y=!0,h=d.route.hydrateFallbackElement||null)));let S=t.concat(n.slice(0,p+1)),R=()=>{let w;return f?w=m:y?w=h:d.route.Component?w=g.createElement(d.route.Component,null):d.route.element?w=d.route.element:w=c,g.createElement(va,{match:d,routeContext:{outlet:c,matches:S,isDataRoute:a!=null},children:w})};return a&&(d.route.ErrorBoundary||d.route.errorElement||p===0)?g.createElement(qt,{location:a.location,revalidation:a.revalidation,component:m,error:f,children:R(),routeContext:{outlet:null,matches:S,isDataRoute:!0},onError:u}):R()},null)}function $e(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function wa(e){let t=g.useContext(Y);return P(t,$e(e)),t}function Ie(e){let t=g.useContext(Z);return P(t,$e(e)),t}function Sa(e){let t=g.useContext(_);return P(t,$e(e)),t}function He(e){let t=Sa(e),r=t.matches[t.matches.length-1];return P(r.route.id,`${e} can only be used on routes that contain a unique "id"`),r.route.id}function ba(){return He("useRouteId")}function er(){let e=Ie("useNavigation");return g.useMemo(()=>{let{matches:t,historyAction:r,...a}=e.navigation;return a},[e.navigation])}function Ue(){let{matches:e,loaderData:t}=Ie("useMatches");return g.useMemo(()=>e.map(r=>Mr(r,t)),[e,t])}function tr(){let e=g.useContext(_e),t=Ie("useRouteError"),r=He("useRouteError");return e!==void 0?e:t.errors?.[r]}function Ea(){let{router:e}=wa("useNavigate"),t=He("useNavigate"),r=g.useRef(!1);return Xt(()=>{r.current=!0}),g.useCallback(async(n,o={})=>{N(r.current,Gt),r.current&&(typeof n=="number"?await e.navigate(n):await e.navigate(n,{fromRouteId:t,...o}))},[e,t])}var Ft={};function rr(e,t,r){!t&&!Ft[e]&&(Ft[e]=!0,N(!1,r))}var xa="useOptimistic",Ln=E[xa];var Dn=E.memo(Pa);function Pa({routes:e,manifest:t,future:r,state:a,isStatic:n,onError:o}){return Zt(e,void 0,{manifest:t,state:a,isStatic:n,onError:o,future:r})}function Ca({basename:e,children:t,initialEntries:r,initialIndex:a,useTransitions:n}){let o=E.useRef();o.current==null&&(o.current=Ot({initialEntries:r,initialIndex:a,v5Compat:!0}));let i=o.current,[l,s]=E.useState({action:i.action,location:i.location}),u=E.useCallback(c=>{n===!1?s(c):E.startTransition(()=>s(c))},[n]);return E.useLayoutEffect(()=>i.listen(u),[i,u]),E.createElement(ge,{basename:e,children:t,location:l.location,navigationType:l.action,navigator:i,useTransitions:n})}function La({to:e,replace:t,state:r,relative:a}){P(J(),"<Navigate> may be used only in the context of a <Router> component.");let{static:n,navigator:o}=E.useContext(T);N(!n,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:i}=E.useContext(_),{pathname:l}=k(),s=K(),u=pe(e,Ne(i),l,a==="path");Me(typeof e=="string"?e:j(e),o.createHref(u),Oe(o),"reject");let c=JSON.stringify(u);return E.useEffect(()=>{s(JSON.parse(c),{replace:t,state:r,relative:a})},[s,c,a,t,r]),null}function ar(e){P(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function ge({basename:e="/",children:t=null,location:r,navigationType:a="POP",navigator:n,static:o=!1,useTransitions:i}){P(!J(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let l=e.replace(/^\/*/,"/"),s=E.useMemo(()=>({basename:l,navigator:n,static:o,useTransitions:i,future:{}}),[l,n,o,i]);typeof r=="string"&&(r=B(r));let{pathname:u="/",search:c="",hash:d="",state:p=null,key:f="default",mask:y}=r,m=E.useMemo(()=>{let h=H(u,l);return h==null?null:{location:{pathname:h,search:c,hash:d,state:p,key:f,mask:y},navigationType:a}},[l,u,c,d,p,f,a,y]);return N(m!=null,`<Router basename="${l}"> is not able to match the URL "${u}${c}${d}" because it does not start with the basename, so the <Router> won't render anything.`),m==null?null:E.createElement(T.Provider,{value:s},E.createElement(V.Provider,{children:t,value:m}))}function Da({children:e,location:t}){return Qt(he(e),t)}function he(e,t=[]){let r=[];return E.Children.forEach(e,(a,n)=>{if(!E.isValidElement(a))return;let o=[...t,n];if(a.type===E.Fragment){r.push.apply(r,he(a.props.children,o));return}P(a.type===ar,`[${typeof a.type=="string"?a.type:a.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),P(!a.props.index||!a.props.children,"An index route cannot have child routes.");let i={id:a.props.id||o.join("-"),caseSensitive:a.props.caseSensitive,element:a.props.element,Component:a.props.Component,index:a.props.index,path:a.props.path,middleware:a.props.middleware,loader:a.props.loader,action:a.props.action,hydrateFallbackElement:a.props.hydrateFallbackElement,HydrateFallback:a.props.HydrateFallback,errorElement:a.props.errorElement,ErrorBoundary:a.props.ErrorBoundary,hasErrorBoundary:a.props.hasErrorBoundary===!0||a.props.ErrorBoundary!=null||a.props.errorElement!=null,shouldRevalidate:a.props.shouldRevalidate,handle:a.props.handle,lazy:a.props.lazy};a.props.children&&(i.children=he(a.props.children,o)),r.push(i)}),r}var ue="get",ce="application/x-www-form-urlencoded";function ve(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function Fa(e){return ve(e)&&e.tagName.toLowerCase()==="button"}function ka(e){return ve(e)&&e.tagName.toLowerCase()==="form"}function Ta(e){return ve(e)&&e.tagName.toLowerCase()==="input"}function Na(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Oa(e,t){return e.button===0&&(!t||t==="_self")&&!Na(e)}function me(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,r)=>{let a=e[r];return t.concat(Array.isArray(a)?a.map(n=>[r,n]):[[r,a]])},[]))}function Ma(e,t){let r=me(e);return t&&t.forEach((a,n)=>{r.has(n)||t.getAll(n).forEach(o=>{r.append(n,o)})}),r}var le=null;function Aa(){if(le===null)try{new FormData(document.createElement("form"),0),le=!1}catch{le=!0}return le}var _a=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Ce(e){return e!=null&&!_a.has(e)?(N(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${ce}"`),null):e}function $a(e,t){let r,a,n,o,i;if(ka(e)){let l=e.getAttribute("action");a=l?H(l,t):null,r=e.getAttribute("method")||ue,n=Ce(e.getAttribute("enctype"))||ce,o=new FormData(e)}else if(Fa(e)||Ta(e)&&(e.type==="submit"||e.type==="image")){let l=e.form;if(l==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let s=e.getAttribute("formaction")||l.getAttribute("action");if(a=s?H(s,t):null,r=e.getAttribute("formmethod")||l.getAttribute("method")||ue,n=Ce(e.getAttribute("formenctype"))||Ce(l.getAttribute("enctype"))||ce,o=new FormData(l,e),!Aa()){let{name:u,type:c,value:d}=e;if(c==="image"){let p=u?`${u}.`:"";o.append(`${p}x`,"0"),o.append(`${p}y`,"0")}else u&&o.append(u,d)}}else{if(ve(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=ue,a=null,n=ce,i=e}return o&&n==="text/plain"&&(i=o,o=void 0),{action:a,method:r.toLowerCase(),encType:n,formData:o,body:i}}var Fn=Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var Ia={"&":"\\u0026",">":"\\u003e","<":"\\u003c","\u2028":"\\u2028","\u2029":"\\u2029"},Ha=/[&><\u2028\u2029]/g;function kt(e){return e.replace(Ha,t=>Ia[t])}function ze(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}var Ua=Symbol("SingleFetchRedirect");function nr(e,t,r,a){let n=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return r?n.pathname.endsWith("/")?n.pathname=`${n.pathname}_.${a}`:n.pathname=`${n.pathname}.${a}`:n.pathname==="/"?n.pathname=`_root.${a}`:t&&H(n.pathname,t)==="/"?n.pathname=`${Q(t)}/_root.${a}`:n.pathname=`${Q(n.pathname)}.${a}`,n}async function ja(e,t){if(e.id in t)return t[e.id];try{let r=await import(e.module);return t[e.id]=r,r}catch(r){if(console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(r),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode&&import.meta.hot)throw r;return window.location.reload(),new Promise(()=>{})}}function za(e){return e!=null&&typeof e.page=="string"}function Ba(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function Wa(e,t,r){let a=await Promise.all(e.map(async n=>{let o=t.routes[n.route.id];if(o){let i=await ja(o,r);return i.links?i.links():[]}return[]}));return Ka(a.flat(1).filter(Ba).filter(n=>n.rel==="stylesheet"||n.rel==="preload").map(n=>n.rel==="stylesheet"?{...n,rel:"prefetch",as:"style"}:{...n,rel:"prefetch"}))}function Tt(e,t,r,a,n,o){let i=(s,u)=>r[u]?s.route.id!==r[u].route.id:!0,l=(s,u)=>r[u].pathname!==s.pathname||r[u].route.path?.endsWith("*")&&r[u].params["*"]!==s.params["*"];return o==="assets"?t.filter((s,u)=>i(s,u)||l(s,u)):o==="data"?t.filter((s,u)=>{let c=a.routes[s.route.id];if(!c||!c.hasLoader)return!1;if(i(s,u)||l(s,u))return!0;if(s.route.shouldRevalidate){let d=s.route.shouldRevalidate({currentUrl:new URL(n.pathname+n.search+n.hash,window.origin),currentParams:r[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:s.params,defaultShouldRevalidate:!0});if(typeof d=="boolean")return d}return!0}):[]}function Ya(e,t,{includeHydrateFallback:r}={}){return Va(e.map(a=>{let n=t.routes[a.route.id];if(!n)return[];let o=[n.module];return n.clientActionModule&&(o=o.concat(n.clientActionModule)),n.clientLoaderModule&&(o=o.concat(n.clientLoaderModule)),r&&n.hydrateFallbackModule&&(o=o.concat(n.hydrateFallbackModule)),n.imports&&(o=o.concat(n.imports)),o}).flat(1))}function Va(e){return[...new Set(e)]}function Ja(e){let t={},r=Object.keys(e).sort();for(let a of r)t[a]=e[a];return t}function Ka(e,t){let r=new Set,a=new Set(t);return e.reduce((n,o)=>{if(t&&!za(o)&&o.as==="script"&&o.href&&a.has(o.href))return n;let l=JSON.stringify(Ja(o));return r.has(l)||(r.add(l),n.push({key:l,link:o})),n},[])}function Be(){let e=b.useContext(Y);return ze(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function Za(){let e=b.useContext(Z);return ze(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var ne=b.createContext(void 0);ne.displayName="FrameworkContext";function Re(){let e=b.useContext(ne);return ze(e,"You must render this element inside a <HydratedRouter> element"),e}function qa(e,t){let r=b.useContext(ne),[a,n]=b.useState(!1),[o,i]=b.useState(!1),{onFocus:l,onBlur:s,onMouseEnter:u,onMouseLeave:c,onTouchStart:d}=t,p=b.useRef(null);b.useEffect(()=>{if(e==="render"&&i(!0),e==="viewport"){let m=S=>{S.forEach(R=>{i(R.isIntersecting)})},h=new IntersectionObserver(m,{threshold:.5});return p.current&&h.observe(p.current),()=>{h.disconnect()}}},[e]),b.useEffect(()=>{if(a){let m=setTimeout(()=>{i(!0)},100);return()=>{clearTimeout(m)}}},[a]);let f=()=>{n(!0)},y=()=>{n(!1),i(!1)};return r?e!=="intent"?[o,p,{}]:[o,p,{onFocus:re(l,f),onBlur:re(s,y),onMouseEnter:re(u,f),onMouseLeave:re(c,y),onTouchStart:re(d,f)}]:[!1,p,{}]}function re(e,t){return r=>{e&&e(r),r.defaultPrevented||t(r)}}function ir({page:e,...t}){let r=ia(),{nonce:a}=Re(),{router:n}=Be(),o=b.useMemo(()=>Te(n.routes,e,n.basename),[n.routes,e,n.basename]);return o?(t.nonce==null&&a&&(t={...t,nonce:a}),r?b.createElement(tn,{page:e,matches:o,...t}):b.createElement(rn,{page:e,matches:o,...t})):null}function en(e){let{manifest:t,routeModules:r}=Re(),[a,n]=b.useState([]);return b.useEffect(()=>{let o=!1;return Wa(e,t,r).then(i=>{o||n(i)}),()=>{o=!0}},[e,t,r]),a}function tn({page:e,matches:t,...r}){let a=k(),{future:n}=Re(),{basename:o}=Be(),i=b.useMemo(()=>{if(e===a.pathname+a.search+a.hash)return[];let l=nr(e,o,n.v8_trailingSlashAwareDataRequests,"rsc"),s=!1,u=[];for(let c of t)typeof c.route.shouldRevalidate=="function"?s=!0:u.push(c.route.id);return s&&u.length>0&&l.searchParams.set("_routes",u.join(",")),[l.pathname+l.search]},[o,n.v8_trailingSlashAwareDataRequests,e,a,t]);return b.createElement(b.Fragment,null,i.map(l=>b.createElement("link",{key:l,rel:"prefetch",as:"fetch",href:l,...r})))}function rn({page:e,matches:t,...r}){let a=k(),{future:n,manifest:o,routeModules:i}=Re(),{basename:l}=Be(),{loaderData:s,matches:u}=Za(),c=b.useMemo(()=>Tt(e,t,u,o,a,"data"),[e,t,u,o,a]),d=b.useMemo(()=>Tt(e,t,u,o,a,"assets"),[e,t,u,o,a]),p=b.useMemo(()=>{if(e===a.pathname+a.search+a.hash)return[];let m=new Set,h=!1;if(t.forEach(R=>{let w=o.routes[R.route.id];!w||!w.hasLoader||(!c.some(x=>x.route.id===R.route.id)&&R.route.id in s&&i[R.route.id]?.shouldRevalidate||w.hasClientLoader?h=!0:m.add(R.route.id))}),m.size===0)return[];let S=nr(e,l,n.v8_trailingSlashAwareDataRequests,"data");return h&&m.size>0&&S.searchParams.set("_routes",t.filter(R=>m.has(R.route.id)).map(R=>R.route.id).join(",")),[S.pathname+S.search]},[l,n.v8_trailingSlashAwareDataRequests,s,a,o,c,t,e,i]),f=b.useMemo(()=>Ya(d,o),[d,o]),y=en(d);return b.createElement(b.Fragment,null,p.map(m=>b.createElement("link",{key:m,rel:"prefetch",as:"fetch",href:m,...r})),f.map(m=>b.createElement("link",{key:m,rel:"modulepreload",href:m,...r})),y.map(({key:m,link:h})=>b.createElement("link",{key:m,nonce:r.nonce,...h,crossOrigin:h.crossOrigin??r.crossOrigin})))}function an(...e){return t=>{e.forEach(r=>{typeof r=="function"?r(t):r!=null&&(r.current=t)})}}var nn=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{nn&&(window.__reactRouterVersion="7.18.3")}catch{}function on({basename:e,children:t,useTransitions:r,window:a}){let n=v.useRef();n.current==null&&(n.current=Mt({window:a,v5Compat:!0}));let o=n.current,[i,l]=v.useState({action:o.action,location:o.location}),s=v.useCallback(u=>{r===!1?l(u):v.startTransition(()=>l(u))},[r]);return v.useLayoutEffect(()=>o.listen(s),[o,s]),v.createElement(ge,{basename:e,children:t,location:i.location,navigationType:i.action,navigator:o,useTransitions:r})}function lr({basename:e,children:t,history:r,useTransitions:a}){let[n,o]=v.useState({action:r.action,location:r.location}),i=v.useCallback(l=>{a===!1?o(l):v.startTransition(()=>o(l))},[a]);return v.useLayoutEffect(()=>r.listen(i),[r,i]),v.createElement(ge,{basename:e,children:t,location:n.location,navigationType:n.action,navigator:r,useTransitions:a})}lr.displayName="unstable_HistoryRouter";var oe=v.forwardRef(function({onClick:t,discover:r="render",prefetch:a="none",relative:n,reloadDocument:o,replace:i,mask:l,state:s,target:u,to:c,preventScrollReset:d,viewTransition:p,defaultShouldRevalidate:f,...y},m){let{basename:h,navigator:S,useTransitions:R}=v.useContext(T),w=typeof c=="string"&&ke.test(c),x=Wt(c,h);c=x.to;let C=ye(c,{relative:n}),F=k(),I=null;if(l){let z=pe(l,[],F.mask?F.mask.pathname:"/",!0);h!=="/"&&(z.pathname=z.pathname==="/"?h:$([h,z.pathname])),I=S.createHref(z)}let[G,ee,we]=qa(a,y),xr=fr(c,{replace:i,mask:l,state:s,target:u,preventScrollReset:d,relative:n,viewTransition:p,defaultShouldRevalidate:f,useTransitions:R});function Pr(z){t&&t(z),z.defaultPrevented||xr(z)}let Qe=!(x.isExternal||o),Ze=v.createElement("a",{...y,...we,href:(Qe?I:void 0)||x.absoluteURL||C,onClick:Qe?Pr:t,ref:an(m,ee),target:u,"data-discover":!w&&r==="render"?"true":void 0});return G&&!w?v.createElement(v.Fragment,null,Ze,v.createElement(ir,{page:C})):Ze});oe.displayName="Link";var sr=v.forwardRef(function({"aria-current":t="page",caseSensitive:r=!1,className:a="",end:n=!1,style:o,to:i,viewTransition:l,children:s,...u},c){let d=q(i,{relative:u.relative}),p=k(),f=v.useContext(Z),{navigator:y,basename:m}=v.useContext(T),h=f!=null&&yr(d)&&l===!0,S=y.encodeLocation?y.encodeLocation(d).pathname:d.pathname,R=p.pathname,w=f&&f.navigation&&f.navigation.location?f.navigation.location.pathname:null;r||(R=R.toLowerCase(),w=w?w.toLowerCase():null,S=S.toLowerCase()),w&&m&&(w=H(w,m)||w);let x=S!=="/"&&S.endsWith("/")?S.length-1:S.length,C=R===S||!n&&R.startsWith(S)&&R.charAt(x)==="/",F=w!=null&&(w===S||!n&&w.startsWith(S)&&w.charAt(S.length)==="/"),I={isActive:C,isPending:F,isTransitioning:h},G=C?t:void 0,ee;typeof a=="function"?ee=a(I):ee=[a,C?"active":null,F?"pending":null,h?"transitioning":null].filter(Boolean).join(" ");let we=typeof o=="function"?o(I):o;return v.createElement(oe,{...u,"aria-current":G,className:ee,ref:c,style:we,to:i,viewTransition:l},typeof s=="function"?s(I):s)});sr.displayName="NavLink";var ur=v.forwardRef(({discover:e="render",fetcherKey:t,navigate:r,reloadDocument:a,replace:n,state:o,method:i=ue,action:l,onSubmit:s,relative:u,preventScrollReset:c,viewTransition:d,defaultShouldRevalidate:p,...f},y)=>{let{useTransitions:m}=v.useContext(T),h=hr(),S=mr(l,{relative:u}),R=i.toLowerCase()==="get"?"get":"post",w=typeof l=="string"&&ke.test(l);return v.createElement("form",{ref:y,method:R,action:S,onSubmit:a?s:C=>{if(s&&s(C),C.defaultPrevented)return;C.preventDefault();let F=C.nativeEvent.submitter,I=F?.getAttribute("formmethod")||i,G=()=>h(F||C.currentTarget,{fetcherKey:t,method:I,navigate:r,replace:n,state:o,relative:u,preventScrollReset:c,viewTransition:d,defaultShouldRevalidate:p});m&&r!==!1?v.startTransition(()=>G()):G()},...f,"data-discover":!w&&e==="render"?"true":void 0})});ur.displayName="Form";function cr({getKey:e,storageKey:t,...r}){let a=v.useContext(ne),{basename:n}=v.useContext(T),o=k(),i=Ue();pr({getKey:e,storageKey:t});let l=v.useMemo(()=>{if(!a||!e)return null;let u=Fe(o,i,n,e);return u!==o.key?u:null},[]);if(!a||a.isSpaMode)return null;let s=((u,c)=>{if(!window.history.state||!window.history.state.key){let d=Math.random().toString(32).slice(2);window.history.replaceState({key:d},"")}try{let p=JSON.parse(sessionStorage.getItem(u)||"{}")[c||window.history.state.key];typeof p=="number"&&window.scrollTo(0,p)}catch(d){console.error(d),sessionStorage.removeItem(u)}}).toString();return r.nonce==null&&a?.nonce&&(r.nonce=a.nonce),v.createElement("script",{...r,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:`(${s})(${kt(JSON.stringify(t||De))}, ${kt(JSON.stringify(l))})`}})}cr.displayName="ScrollRestoration";function dr(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function We(e){let t=v.useContext(Y);return P(t,dr(e)),t}function ln(e){let t=v.useContext(Z);return P(t,dr(e)),t}function fr(e,{target:t,replace:r,mask:a,state:n,preventScrollReset:o,relative:i,viewTransition:l,defaultShouldRevalidate:s,useTransitions:u}={}){let c=K(),d=k(),p=q(e,{relative:i});return v.useCallback(f=>{if(Oa(f,t)){f.preventDefault();let y=r!==void 0?r:j(d)===j(p),m=()=>c(e,{replace:y,mask:a,state:n,preventScrollReset:o,relative:i,viewTransition:l,defaultShouldRevalidate:s});u?v.startTransition(()=>m()):m()}},[d,c,p,r,a,n,t,e,o,i,l,s,u])}function Ye(e){N(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=v.useRef(me(e)),r=v.useRef(!1),a=k(),n=v.useMemo(()=>Ma(a.search,r.current?null:t.current),[a.search]),o=K(),i=v.useCallback((l,s)=>{let u=me(typeof l=="function"?l(new URLSearchParams(n)):l);r.current=!0,o("?"+u,s)},[o,n]);return[n,i]}var sn=0,un=()=>`__${String(++sn)}__`;function hr(){let{router:e}=We("useSubmit"),{basename:t}=v.useContext(T),r=ba(),a=e.fetch,n=e.navigate;return v.useCallback(async(o,i={})=>{let{action:l,method:s,encType:u,formData:c,body:d}=$a(o,t);if(i.navigate===!1){let p=i.fetcherKey||un();await a(p,r,i.action||l,{defaultShouldRevalidate:i.defaultShouldRevalidate,preventScrollReset:i.preventScrollReset,formData:c,body:d,formMethod:i.method||s,formEncType:i.encType||u,flushSync:i.flushSync})}else await n(i.action||l,{defaultShouldRevalidate:i.defaultShouldRevalidate,preventScrollReset:i.preventScrollReset,formData:c,body:d,formMethod:i.method||s,formEncType:i.encType||u,replace:i.replace,state:i.state,fromRouteId:r,flushSync:i.flushSync,viewTransition:i.viewTransition})},[a,n,t,r])}function mr(e,{relative:t}={}){let{basename:r}=v.useContext(T),a=v.useContext(_);P(a,"useFormAction must be used inside a RouteContext");let[n]=a.matches.slice(-1),o={...q(e||".",{relative:t})},i=k();if(e==null){o.search=i.search;let l=new URLSearchParams(o.search),s=l.getAll("index");if(s.some(c=>c==="")){l.delete("index"),s.filter(d=>d).forEach(d=>l.append("index",d));let c=l.toString();o.search=c?`?${c}`:""}}return(!e||e===".")&&n.route.index&&(o.search=o.search?o.search.replace(/^\?/,"?index&"):"?index"),r!=="/"&&(o.pathname=o.pathname==="/"?r:$([r,o.pathname])),j(o)}var De="react-router-scroll-positions",se={};function Fe(e,t,r,a){let n=null;return a&&(r!=="/"?n=a({...e,pathname:H(e.pathname,r)||e.pathname},t):n=a(e,t)),n==null&&(n=e.key),n}function pr({getKey:e,storageKey:t}={}){let{router:r}=We("useScrollRestoration"),{restoreScrollPosition:a,preventScrollReset:n}=ln("useScrollRestoration"),{basename:o}=v.useContext(T),i=k(),l=Ue(),s=er();v.useEffect(()=>(window.history.scrollRestoration="manual",()=>{window.history.scrollRestoration="auto"}),[]),cn(v.useCallback(()=>{if(s.state==="idle"){let u=Fe(i,l,o,e);se[u]=window.scrollY}try{sessionStorage.setItem(t||De,JSON.stringify(se))}catch(u){N(!1,`Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${u}).`)}window.history.scrollRestoration="auto"},[s.state,e,o,i,l,t])),typeof document<"u"&&(v.useLayoutEffect(()=>{try{let u=sessionStorage.getItem(t||De);u&&(se=JSON.parse(u))}catch{}},[t]),v.useLayoutEffect(()=>{let u=r?.enableScrollRestoration(se,()=>window.scrollY,e?(c,d)=>Fe(c,d,o,e):void 0);return()=>u&&u()},[r,o,e]),v.useLayoutEffect(()=>{if(a!==!1){if(typeof a=="number"){window.scrollTo(0,a);return}try{if(i.hash){let u=document.getElementById(decodeURIComponent(i.hash.slice(1)));if(u){u.scrollIntoView();return}}}catch{N(!1,`"${i.hash.slice(1)}" is not a decodable element ID. The view will not scroll to it.`)}n!==!0&&window.scrollTo(0,0)}},[i,a,n]))}function cn(e,t){let{capture:r}=t||{};v.useEffect(()=>{let a=r!=null?{capture:r}:void 0;return window.addEventListener("pagehide",e,a),()=>{window.removeEventListener("pagehide",e,a)}},[e,r])}function yr(e,{relative:t}={}){let r=v.useContext(Ae);P(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:a}=We("useViewTransitionState"),n=q(e,{relative:t});if(!r.isTransitioning)return!1;let o=H(r.currentLocation.pathname,a)||r.currentLocation.pathname,i=H(r.nextLocation.pathname,a)||r.nextLocation.pathname;return ae(n.pathname,i)!=null||ae(n.pathname,o)!=null}var Ve=D(M(),1),vr=D(Cr(),1);var U=D(X(),1);function Rr({context:e,own:t}){te(e.store);let r=ut(),a=st()?.live??e.store;if(te(a),!r||a.batches().length===0)return null;let n=(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Ve.Suspense,{fallback:null,children:(0,U.jsx)(St,{})}),(0,U.jsx)(Ve.Suspense,{fallback:null,children:(0,U.jsx)(bt,{})})]});return t?(0,vr.createPortal)(n,t):(0,U.jsx)("div",{className:"graview-bar-own",children:n})}var O=D(M(),1);var W=D(M(),1),dn=(0,W.createContext)(null);function Ko(){let e=new Map,t=new Set,r=()=>{for(let a of t)a()};return{count:a=>e.get(a)??0,place(a){return e.set(a,(e.get(a)??0)+1),r(),()=>{e.set(a,(e.get(a)??1)-1),r()}},subscribe(a){return t.add(a),()=>t.delete(a)}}}function wr(e){let t=(0,W.useContext)(dn);(0,W.useLayoutEffect)(()=>t?.place(e),[t,e])}function Go(e,t){return(0,W.useSyncExternalStore)(e.subscribe,()=>e.count(t)>0,()=>!1)}var Er=D(X(),1),Je="var(--graview-text-small)",Ke="var(--graview-text-body)",ti="var(--graview-font-display, var(--graview-font-body, system-ui))",Ge={maxWidth:760,margin:"0 auto",padding:"40px 20px max(96px, calc(var(--graview-foot-room, 0px) + env(safe-area-inset-bottom, 0px)))",display:"grid",gridTemplateColumns:"minmax(0, 1fr)",gap:40},Xe=1160,ri={...Ge,maxWidth:Xe},Sr={margin:0,fontSize:"var(--graview-text-title)",lineHeight:1.2,letterSpacing:"-0.012em",overflowWrap:"anywhere",textWrap:"balance"},ai={margin:0,fontSize:"var(--graview-text-heading)",lineHeight:1.3,textWrap:"balance"},ni={margin:0,fontSize:Je,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--graview-ink-muted)"},oi={margin:0,fontSize:Ke,color:"var(--graview-ink-muted)",maxWidth:"60ch"},br={color:"var(--graview-ink-muted)",fontSize:Je},ii={borderTop:"1px solid var(--graview-edge)",paddingTop:24},li={color:"var(--graview-accent)",textDecorationColor:"color-mix(in srgb, currentColor 50%, transparent)",textDecorationThickness:1,textUnderlineOffset:"0.2em",display:"inline-flex",alignItems:"center",minHeight:24},si={color:"inherit",textDecoration:"none",display:"inline-flex",alignItems:"center",minHeight:24},ui=`.graview-list{container-type:inline-size}
4
+ .graview-rows{display:grid;grid-template-columns:minmax(0,1fr);column-gap:1.5rem;margin:0;padding:0;list-style:none;border-top:1px solid var(--graview-edge)}
5
+ .graview-row{grid-column:1/-1;display:grid;grid-template-columns:subgrid;align-items:baseline;align-content:center;position:relative;box-sizing:border-box;min-height:2.75rem;padding:.5rem 0;border-bottom:1px solid var(--graview-edge);overflow-wrap:anywhere}
6
+ .graview-row-title{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;min-height:24px;color:inherit;text-decoration:none;font-size:var(--graview-text-body);font-weight:500;line-height:1.3;text-wrap:pretty;hyphens:manual}
7
+ .graview-row-title::after{content:"";position:absolute;inset:0}
8
+ .graview-row-title:focus-visible{outline:0}
9
+ .graview-row-title:focus-visible::after{outline:2px solid var(--graview-accent);outline-offset:-2px;border-radius:var(--graview-radius-sm)}
10
+ .graview-row:hover .graview-row-title{text-decoration:underline 1px color-mix(in srgb,currentColor 50%,transparent);text-underline-offset:.2em}
11
+ .graview-row:active .graview-row-title{color:var(--graview-accent)}
12
+ .graview-row :is(a,button):not(.graview-row-title){position:relative}
13
+ .graview-row-glance,.graview-row>[data-testid=search-why]{font-size:var(--graview-text-small);line-height:1.5;color:var(--graview-ink-muted)}
14
+ .graview-row>[data-testid=search-why]{grid-column:1/-1}
15
+ .graview-row-glance{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden}
16
+ .graview-group-head{display:flex;gap:.5em;align-items:baseline;margin:0;padding:.375rem 0;font-family:var(--graview-font-body);font-size:var(--graview-text-small);font-weight:var(--graview-weight-label);line-height:1.3;letter-spacing:.02em;scroll-margin-top:4rem}
17
+ .graview-group-head>span{color:var(--graview-ink-muted);font-weight:var(--graview-weight-body)}
18
+ .graview-group-toggle{display:inline-flex;gap:.5em;align-items:center;min-height:2.75rem;margin:-.375rem 0;padding:0 .5rem 0 0;border:0;background:none;color:inherit;font:inherit;letter-spacing:inherit;text-align:start;cursor:pointer;border-radius:var(--graview-radius-sm)}
19
+ .graview-group-toggle:focus-visible{outline:2px solid var(--graview-accent);outline-offset:2px}
20
+ .graview-group-toggle>span{color:var(--graview-ink-muted);font-weight:var(--graview-weight-body)}
21
+ @container (min-width:36rem){.graview-rows{grid-template-columns:minmax(0,1fr) fit-content(40%)}.graview-group-head:has(+.graview-rows){position:sticky;top:0;z-index:${tt.raised};background:var(--graview-ground)}}`,ci={font:"inherit",fontSize:Je,padding:"8px 14px",borderRadius:"var(--graview-radius-sm, 8px)",border:"1px solid var(--graview-edge-bright)",background:"var(--graview-panel)",color:"var(--graview-ink)",cursor:"pointer"};function di({kind:e,brand:t,size:r=10,schema:a}){return(0,Er.jsx)(dt,{kind:e,...a?{schema:a}:{},...t?{brand:t}:{},size:Math.round(r*1.6)})}function fi(e,t){let a=[...new Set(t.targets.map(n=>n.kind))].map(n=>e.schema.tryDefinition(n)?.plural??Se(n));return a.length>0?a.join(" and "):Se(t.edgeKind)}function hi(e,t,r){return e.author.kind==="human"&&(e.author.id===void 0||t?.id===void 0||e.author.id===t.id)?"you":r?qe(e.author,r):e.author.kind==="agent"?e.author.id??"an agent":e.author.id??e.author.kind}function mi(e,t,r){return ht(e,t,{limit:3,said:[r],glance:!0}).map(a=>a.long?ft(a.stored,{markdown:a.markdown,most:100}):a.alone).join(" \xB7 ")}var pi=(e,t)=>ie(e.schema,t),fn=(e,t)=>{let r=e.kindsKeptFrom(t);return e.schema.kinds.filter(a=>!e.modules.disabledKinds.has(a)&&!r.has(a))},hn=e=>lt(fn(e.store,e.principal),e.views?.arrangement?.()?.order),yi=e=>{let t=new Set(e.views?.arrangement?.()?.hide??[]);return hn(e).filter(r=>!t.has(r))},gi=e=>e.charAt(0).toUpperCase()+e.slice(1);var L=D(X(),1);function Li({context:e,children:t}){let{store:r,brand:a}=e;return te(r),ct(e.embedded?void 0:et(a)),(0,L.jsxs)("div",{style:{...e.embedded?{}:{minHeight:"100vh"},display:"flex",flexDirection:"column",background:"var(--graview-ground)",color:"var(--graview-ink)",fontFamily:"var(--graview-font-body, system-ui)",fontSize:Ke,lineHeight:1.5},children:[e.embedded?null:(0,L.jsx)(pn,{context:e}),(0,L.jsx)("div",{style:{flex:1},children:t}),e.remembers?(0,L.jsx)("footer",{style:{borderTop:"1px solid var(--graview-edge)",padding:"14px 20px max(20px, calc(var(--graview-foot-room, 0px) + env(safe-area-inset-bottom, 0px)))",...br},children:(0,L.jsx)("div",{style:{maxWidth:Xe,margin:"0 auto",display:"flex",gap:14,flexWrap:"wrap",alignItems:"center",justifyContent:"flex-end"},children:(0,L.jsxs)("span",{"data-testid":"remembered",children:["Remembered in this browser \xB7 ",(0,L.jsx)(Et,{})]})})}):null]})}var mn=(0,O.createContext)(null);function pn({context:e}){let{store:t,brand:r,sceneHref:a="/",invariantContext:n}=e,o=k(),i=K(),l=ye("/").replace(/\/$/,""),s=(0,O.useContext)(mn),u=s?.places===!1?[]:mt({store:t,principal:e.principal,views:e.views}),c=e.views?.arrangement?.(),d=`${o.pathname}${o.search}`,p=t.violations(n),f=p.length,y=Rt(p,"All rules hold");return(0,L.jsx)(L.Fragment,{children:(0,L.jsx)(gt,{brand:r,name:r?.name??"Graview",description:r?.subtitle,home:{href:`${l}/`,go:()=>i("/"),current:o.pathname==="/"},faces:{scene:{label:ot(c),current:!1,go:()=>window.location.assign(a)},pages:{label:it(c),current:!0,go:()=>{}}},places:u,current:pt(u,d),reach:{href:m=>`${l}${m}`,go:m=>i(m.path)},...s?{onFind:s.onFind,find:s.find}:{findBox:(0,L.jsx)(yn,{context:e})},tools:(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(oe,{to:"/problems","data-testid":"standing-link","aria-label":y,title:y,style:{...yt,padding:f===0?0:"0 8px",textDecoration:"none",fontWeight:600,fontVariantNumeric:"tabular-nums",color:f===0?"var(--graview-ink-muted)":"var(--graview-warn)"},children:[(0,L.jsx)(wt,{tone:f===0?"var(--graview-good)":"var(--graview-warn)"}),f>0?(0,L.jsx)("span",{"aria-hidden":"true",children:f}):null]}),s?null:(0,L.jsx)(Rr,{context:e}),e.views?(0,L.jsx)(vt,{...e.signature?{signature:!0}:{}}):null]})})})}function Di({context:e,style:t,children:r,...a}){let n=e.embedded||e.framed?"section":"main";return(0,L.jsx)(n,{style:{...Ge,...t},...a,children:r})}function Fi({context:e,children:t,...r}){let a=`h${e.titleLevel??(e.framed&&!e.barAbove?1:2)}`;return(0,L.jsx)(a,{style:Sr,"data-graview-page-title":"",...r,children:t})}function yn({context:e,narrowsLists:t=!0}){wr("find");let r=k(),a=K(),[n,o]=Ye(),i=r.pathname.split("/").filter(Boolean),l=t&&i.length===1&&be(e.store.schema,i[0])!==void 0,s=r.pathname==="/search",u=l||s?n.get("q")??"":"",c=l?`Narrow ${ie(e.store.schema,be(e.store.schema,i[0])).toLowerCase()}\u2026`:"",[d,p]=(0,O.useState)(!0);(0,O.useLayoutEffect)(()=>{let R=m.current;if(!R||!c||typeof ResizeObserver>"u")return;let w=()=>{let C=getComputedStyle(R),F=document.createElement("canvas").getContext("2d");F&&(F.font=`${C.fontWeight} ${C.fontSize} ${C.fontFamily}`,p(F.measureText(c).width<=R.clientWidth-parseFloat(C.paddingLeft)-parseFloat(C.paddingRight)))};w();let x=new ResizeObserver(w);return x.observe(R),()=>x.disconnect()},[c]);let[f,y]=(0,O.useState)(u),m=(0,O.useRef)(null);(0,O.useEffect)(()=>{let R=w=>{if(w.defaultPrevented||w.altKey||w.shiftKey||!(w.metaKey||w.ctrlKey)||w.key.toLowerCase()!=="k")return;let x=m.current,C=x?.closest("[data-graview-embed]"),F=w.target,I=F===document.body||F===document.documentElement;!x||!(I||!C||F instanceof Node&&C.contains(F))||(w.preventDefault(),x.closest("[data-graview-app-bar]")?.querySelector('[data-testid="app-find-open"]')?.click(),requestAnimationFrame(()=>{x.focus(),x.select()}))};return document.addEventListener("keydown",R),()=>document.removeEventListener("keydown",R)},[]);let h=(0,O.useRef)(new Set([u]));(0,O.useEffect)(()=>{h.current.has(u)||(h.current=new Set([u]),y(u))},[u]);let S=R=>{if(y(R),h.current.add(R),l){let x=new URLSearchParams(n);R.trim()?x.set("q",R):x.delete("q"),o(x,{replace:!0});return}let w=R.trim()?`/search?${new URLSearchParams({q:R}).toString()}`:"/search";a(w,{replace:s})};return(0,L.jsx)("form",{role:"search","aria-label":l?"Narrow this list":"Find anything",style:{display:"flex",minWidth:0,flex:"1 1 auto"},onSubmit:R=>{R.preventDefault(),l&&f.trim()&&a(`/search?${new URLSearchParams({q:f}).toString()}`)},children:(0,L.jsx)("input",{ref:m,type:"search","data-testid":"nav-find",value:f,onChange:R=>S(R.target.value),placeholder:l?d?c:"Narrow\u2026":"Find\u2026","aria-keyshortcuts":"Meta+K Control+K","aria-label":l?"Narrow this list":"Find anything",style:{width:"100%",minWidth:0,height:30,padding:"0 var(--graview-bar-find-end, 10px) 0 10px",font:"inherit",fontSize:"0.875rem",color:"var(--graview-ink)",background:"var(--graview-ground)",border:"1px solid var(--graview-edge)",borderRadius:8}})})}export{Lr as a,be as b,vn as c,Rn as d,Je as e,ti as f,ri as g,ai as h,ni as i,oi as j,br as k,ii as l,li as m,si as n,ui as o,ci as p,di as q,fi as r,hi as s,mi as t,pi as u,fn as v,hn as w,yi as x,gi as y,Rr as z,ye as A,k as B,fa as C,K as D,ma as E,Ca as F,La as G,ar as H,Da as I,on as J,oe as K,Ye as L,dn as M,Ko as N,Go as O,Li as P,mn as Q,Di as R,Fi as S,yn as T};
22
+ /*! Bundled license information:
23
+
24
+ react-router/dist/development/chunk-BV7QT456.mjs:
25
+ (**
26
+ * react-router v7.18.3
27
+ *
28
+ * Copyright (c) Remix Software Inc.
29
+ *
30
+ * This source code is licensed under the MIT license found in the
31
+ * LICENSE.md file in the root directory of this source tree.
32
+ *
33
+ * @license MIT
34
+ *)
35
+
36
+ react-router/dist/development/index.mjs:
37
+ (**
38
+ * react-router v7.18.3
39
+ *
40
+ * Copyright (c) Remix Software Inc.
41
+ *
42
+ * This source code is licensed under the MIT license found in the
43
+ * LICENSE.md file in the root directory of this source tree.
44
+ *
45
+ * @license MIT
46
+ *)
47
+ */
@@ -0,0 +1 @@
1
+ import{a,b,c,d,e,f,g,h,i}from"./chunk.PKK6FRZR.js";import"./chunk.OAF7TUMI.js";import"./chunk.OZNW5W4Z.js";import"./chunk.NDADLJE6.js";import"./chunk.AK3IHFCF.js";import"./chunk.HHPGWJDO.js";import"./chunk.42YX6NOY.js";import"./chunk.JH6MU6TX.js";import"./chunk.WAFDCOOG.js";import"./chunk.6V2RG5JG.js";import"./chunk.AJZBJBMO.js";export{f as columnActs,c as columnMoves,b as columnOf,d as columnReach,e as columnSteps,h as describePlace,i as placeText,g as resolveFor,a as statusColumns};
@@ -0,0 +1 @@
1
+ import{z as W}from"./chunk.L4DECHXR.js";import{G as H,b as A,c as T,d as v,e as f,f as x,k as I,n as b,qa as k,w as R}from"./chunk.GFF2FB2J.js";import{Mc as s,Sc as y,Tc as r}from"./chunk.6V2RG5JG.js";import{b as B}from"./chunk.AJZBJBMO.js";var u=B(H(),1),L=e=>typeof e=="object"&&e!==null&&"idx"in e;function E(e){let n=r(window.location.pathname,e);return n===null?null:n!==s&&n!=="/"?"pages":n===s||window.location.href.includes("#")?f(window.location.hash).overview?"graview":"scene":L(window.history.state)?"pages":null}function J(e){let n=e.face??(e.stop&&v(e.stop).overview?"graview":"scene");return e.routing!=="address"||typeof window>"u"?n:E(e.basePath)??n}function K(e){return e.routing!=="address"||typeof window>"u"?!1:r(window.location.pathname,e.basePath)==="/"&&E(e.basePath)===null}function Q(e){if(typeof window>"u")return;let n=r(window.location.pathname,e);return n===s||n==="/"&&window.location.href.includes("#")?T(f(window.location.hash)):void 0}function X({basePath:e,pagesWere:n,shown:t,onFace:i,toggle:l,kinds:U,places:w,opens:$}){let{view:F,go:p}=k(),g=(0,u.useRef)({shown:t,view:F,onFace:i});g.current={shown:t,view:F,onFace:i};let S=(0,u.useRef)(n??"/"),M=()=>{S.current=`${r(window.location.pathname,e)??"/"}${window.location.search}`};return l.current=(o,c,a)=>{let{shown:d,view:N,onFace:V}=g.current;if(o==="pages"&&d!=="pages")window.history.pushState(null,"",y(c??S.current,{basePath:e}));else if(o!=="pages"&&d==="pages"){M();let m=a===void 0?N:j(v(a),w),h=Y(m)?q($):m,O=h!==m&&h.overview?"graview":o,P=_(O,h,U);p(P),window.history.pushState(null,"",`${y(s,{basePath:e})}${x(P)}`),V?.(O);return}V?.(o)},(0,u.useEffect)(()=>{let o=()=>{if(r(window.location.pathname,e)===null)return;let c=E(e)??"pages",{shown:a,onFace:d}=g.current;if(c==="pages"){a!=="pages"&&d?.("pages");return}a==="pages"&&(p(j(f(window.location.hash),w)),d?.(c))};return window.addEventListener("popstate",o),()=>window.removeEventListener("popstate",o)},[e,p,w]),null}function j(e,n){let t=e.within?.view,i=t!==void 0&&!e.focusId?n.find(l=>l.as===t):void 0;return i?{...e,focusId:R(i.kind)}:e}function _(e,n,t){return e==="graview"?b(n,!0):n.overview?I(b(n,!1),W(n,t)):n}function Y(e){return e.focusId===null&&e.overview!==!0}function q(e){return e??{...A,overview:!0}}export{J as a,K as b,Q as c,X as d,j as e,_ as f,Y as g,q as h};
@@ -0,0 +1 @@
1
+ var r=Symbol.for("@graview/core:seat"),o=e=>e[r];export{o as a};
@@ -0,0 +1 @@
1
+ import{b as R}from"./chunk.RRVIXV7W.js";import"./chunk.7BWT5L2L.js";import"./chunk.VSZQXB4Q.js";import"./chunk.WVUJXDXZ.js";import"./chunk.OZNW5W4Z.js";import"./chunk.NDADLJE6.js";import"./chunk.AK3IHFCF.js";import"./chunk.HHPGWJDO.js";import"./chunk.42YX6NOY.js";import"./chunk.EYZ7MHBZ.js";import{o as x}from"./chunk.KQT7WAQE.js";import"./chunk.PAVR5TK5.js";import"./chunk.OQDETV4X.js";import"./chunk.3VL5WECB.js";import"./chunk.JH6MU6TX.js";import"./chunk.WAFDCOOG.js";import"./chunk.L4DECHXR.js";import{G as k,R as v,_ as g}from"./chunk.GFF2FB2J.js";import{ba as m,cc as A,ea as c}from"./chunk.6V2RG5JG.js";import{b as u}from"./chunk.AJZBJBMO.js";var f=u(k(),1);var S=u(k(),1),L=(0,S.createContext)(void 0);var i=u(v(),1),W=new WeakMap,y=new WeakMap,P=(e,n)=>`${n.kind}\0${n.id??""}\0${e}`;function C(e,n,r){let o=P(n,r),p=W.get(e);p||W.set(e,p=new Map);let t=p.get(o);return t||(t=Promise.resolve().then(()=>e(n,r)).then(a=>b(a)?a:null,()=>null).then(a=>{let s=y.get(e);return s||y.set(e,s=new Map),s.set(o,a),a}),p.set(o,t)),t}function b(e){if(e===null)return!0;if(typeof e!="object"||e===void 0)return!1;if(e.denied===!0)return!0;let n=e;return typeof n.name=="string"&&n.name.trim()!==""&&typeof n.href=="string"}function h(e){if(/^https?:\/\//i.test(e))try{return new URL(e).href}catch{return}}var N=e=>h(e)??(c(e)?e:void 0),E=e=>h(e)??(e.startsWith("/")&&c(e)?e:void 0),I={kind:"human"},w={color:"var(--graview-ink-muted)"};function M({icon:e}){if(!e)return null;let n=E(e);if(n)return(0,i.jsx)("img",{src:n,alt:"",width:20,height:20,"data-graview-app-icon":"",style:{width:20,height:20,borderRadius:5,objectFit:"cover",flex:"0 0 auto"}});let r=[...e.trim()].slice(0,2).join("");return r?(0,i.jsx)("span",{"aria-hidden":"true","data-graview-app-icon":"",style:{flex:"0 0 auto",lineHeight:"20px"},children:r}):null}function V(e){let n=g(),r=(0,f.useContext)(L)??n?.resolveApp,o=n?.principal??I,p=()=>r?y.get(r)?.get(P(e,o))??"asking":null,[t,a]=(0,f.useState)(p);return(0,f.useEffect)(()=>{let s=p();if(a(s),s!=="asking"||!r)return;let l=!0;return C(r,e,o).then(d=>l&&a(d)),()=>{l=!1}},[r,e,o.kind,o.id]),t}function D({address:e,as:n="chip",nodeId:r,field:o,style:p}){let t=V(e),a={position:"relative",zIndex:A.raised,overflowWrap:"anywhere",minWidth:0,maxWidth:"100%",...p},s;if(t==="asking")s=(0,i.jsx)("span",{"data-graview-app-link":"","data-graview-app-state":"asking","aria-busy":"true",style:{...w,...a},children:"Linked app"});else if(t&&"denied"in t)s=(0,i.jsx)("span",{"data-graview-app-link":"","data-graview-app-state":"denied",style:{...w,fontStyle:"italic",...a},children:"linked app (no access)"});else if(t){let l=N(t.href),d=n==="record"?t.headline?.trim():void 0;s=(0,i.jsxs)(l?"a":"span",{"data-graview-app-link":"","data-graview-app-state":"found",...l?{href:l}:{},...!d&&t.headline?{title:t.headline}:{},style:{display:"inline-flex",alignItems:d?"flex-start":"center",minHeight:24,gap:8,color:"inherit",textUnderlineOffset:3,...a},children:[(0,i.jsx)(M,{icon:t.icon}),(0,i.jsxs)("span",{style:{display:"grid",minWidth:0},children:[(0,i.jsx)("span",{"data-graview-app-name":"",style:{fontWeight:600},children:t.name}),d?(0,i.jsx)("span",{"data-graview-app-headline":"",style:{...w,fontSize:"0.8125em",fontWeight:400},children:d}):null]})]})}else{let l=h(e);s=l?(0,i.jsx)("a",{"data-graview-app-link":"","data-graview-app-state":"plain",href:l,rel:"noopener noreferrer",target:"_blank",style:{color:"var(--graview-accent)",display:"inline-flex",alignItems:"center",minHeight:24,...a},children:e}):(0,i.jsx)("span",{"data-graview-app-link":"","data-graview-app-state":"plain",style:a,children:e})}return r&&o?(0,i.jsx)(H,{nodeId:r,field:o,address:e,drawn:s}):s}function H({nodeId:e,field:n,address:r,drawn:o}){let p=x(e).fields.some(s=>s.field===n),t=g()?.store;if(!p)return o;let a=m(t?t.schema.tryDefinition(String(t.graph.getNode(e)?.kind)):void 0,n).toLowerCase();return(0,i.jsxs)("span",{style:{display:"inline-flex",flexWrap:"wrap",alignItems:"baseline",gap:"4px 12px",maxWidth:"100%",minWidth:0},children:[o,(0,i.jsx)("span",{style:{fontSize:"0.8125rem"},children:(0,i.jsx)(R,{nodeId:e,field:n,value:"Change",stored:r,said:`Change the ${a}`})})]})}var _=e=>(0,i.jsx)(D,{...e});export{D as AppLink,_ as drawAppLink};
@@ -0,0 +1 @@
1
+ function d(e,n){if(e.past)return;let a=e.batches();for(let i=a.length-1;i>=0;i--){let t=a[i];if(t.undone||t.ops.length===0||t.ops.every(o=>o.undoes!==void 0))continue;let c=t.author;if(!(c.kind==="human"&&(n?.id===void 0||c.id===void 0||c.id===n.id)))continue;let r=e.canUndo(t.id);if(!(!r.ok||!r.ops.every(o=>!o.mutation||e.permits(o.mutation,n).ok)))return{batch:t.id,intent:t.intent}}}function f(e,n,a){let i=d(e,n);return i&&e.batches().slice(a).some(t=>t.id===i.batch)?i:void 0}var h=e=>`Take back \u201C${e.intent}\u201D`;function m(e,n){let a=d(e,n);return a&&e.undo(a.batch,n?{author:n}:{}),a}function l(e){let n=e.target;return!e.defaultPrevented&&!e.altKey&&!e.shiftKey&&(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()==="z"&&!(n instanceof HTMLElement&&(n.isContentEditable||n.matches("input, textarea, select")))}export{d as a,f as b,h as c,m as d,l as e};
@@ -0,0 +1 @@
1
+ function g(e){return[`based on \u201C${e.basis}\u201D`,...e.confidence!==void 0?[`${Math.round(e.confidence*100)}% sure`]:[],...e.model?[e.model]:[]].join(" \xB7 ")}var k=e=>`Not yet kept by a person. ${e.by.name??e.by.id??"Something"} made it${e.lineage?`, ${g(e.lineage)}`:""}.`,p=e=>`${e.kind}\0${e.from}\0${e.to}`;function y(e,o){let r=new Map;for(let n of e){if(n.undoes!==void 0||o.has(n.id)||n.withheld)continue;let s=n.author.kind==="human",l=new Map;for(let t of n.primitives){if(t.op!=="add-edge"&&t.op!=="remove-edge")continue;let i=p(t.edge),a=r.get(i)??l.get(i);if(r.delete(i),t.op==="remove-edge")a&&l.set(i,a);else if(a&&(s||!n.lineage))r.set(i,s?{...a,provisional:!1,keptBy:n.id}:a);else{let d=n.lineage;r.set(i,{edge:t.edge,made:n.id,by:n.author,...d?{lineage:d}:{},provisional:!s&&(d?.confidence??1)<1})}}}return r}var c=new WeakMap;function f({log:e}){let o=e.all(),r=`${e.horizon}:${o.length}:${o.at(-1)?.id}`,n=c.get(e);return n?.at!==r&&c.set(e,n={at:r,links:y(o,e.undoneIds())}),n.links}var v=(e,o)=>f(e).get(p(o));var u=e=>[...f(e).values()].filter(o=>o.provisional);export{g as a,k as b,v as c,u as d};
@@ -0,0 +1 @@
1
+ import{e as a}from"./chunk.SE5SKFQH.js";import{m as i}from"./chunk.GFF2FB2J.js";import{Dc as o}from"./chunk.6V2RG5JG.js";function p(t){let r=t.within??{};return o({...r.sort?{sort:r.sort}:{},...r.filter?{filter:r.filter}:{},...r.group?{group:r.group}:{},...r.q?{q:r.q}:{},...r.archived?{archived:r.archived}:{}})}function c(t,r){let m=a(r),e=t;for(let n of["sort","filter","group","q","archived"])e=i(e,n,m[n]??null);return e}export{p as a,c as b};
@@ -1,4 +1,4 @@
1
- import{a as v}from"./chunk.MRK6QJV5.js";import{a as s}from"./chunk.AJZBJBMO.js";var l=s(i=>{"use strict";var m=v();function y(r){var e="https://react.dev/errors/"+r;if(1<arguments.length){e+="?args[]="+encodeURIComponent(arguments[1]);for(var t=2;t<arguments.length;t++)e+="&args[]="+encodeURIComponent(arguments[t])}return"Minified React error #"+r+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function c(){}var n={d:{f:c,r:function(){throw Error(y(522))},D:c,C:c,L:c,m:c,X:c,S:c,M:c},p:0,findDOMNode:null},O=Symbol.for("react.portal");function S(r,e,t){var f=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:O,key:f==null?null:""+f,children:r,containerInfo:e,implementation:t}}var u=m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function a(r,e){if(r==="font")return"";if(typeof e=="string")return e==="use-credentials"?e:""}i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=n;i.createPortal=function(r,e){var t=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)throw Error(y(299));return S(r,e,null,t)};i.flushSync=function(r){var e=u.T,t=n.p;try{if(u.T=null,n.p=2,r)return r()}finally{u.T=e,n.p=t,n.d.f()}};i.preconnect=function(r,e){typeof r=="string"&&(e?(e=e.crossOrigin,e=typeof e=="string"?e==="use-credentials"?e:"":void 0):e=null,n.d.C(r,e))};i.prefetchDNS=function(r){typeof r=="string"&&n.d.D(r)};i.preinit=function(r,e){if(typeof r=="string"&&e&&typeof e.as=="string"){var t=e.as,f=a(t,e.crossOrigin),g=typeof e.integrity=="string"?e.integrity:void 0,d=typeof e.fetchPriority=="string"?e.fetchPriority:void 0;t==="style"?n.d.S(r,typeof e.precedence=="string"?e.precedence:void 0,{crossOrigin:f,integrity:g,fetchPriority:d}):t==="script"&&n.d.X(r,{crossOrigin:f,integrity:g,fetchPriority:d,nonce:typeof e.nonce=="string"?e.nonce:void 0})}};i.preinitModule=function(r,e){if(typeof r=="string")if(typeof e=="object"&&e!==null){if(e.as==null||e.as==="script"){var t=a(e.as,e.crossOrigin);n.d.M(r,{crossOrigin:t,integrity:typeof e.integrity=="string"?e.integrity:void 0,nonce:typeof e.nonce=="string"?e.nonce:void 0})}}else e==null&&n.d.M(r)};i.preload=function(r,e){if(typeof r=="string"&&typeof e=="object"&&e!==null&&typeof e.as=="string"){var t=e.as,f=a(t,e.crossOrigin);n.d.L(r,t,{crossOrigin:f,integrity:typeof e.integrity=="string"?e.integrity:void 0,nonce:typeof e.nonce=="string"?e.nonce:void 0,type:typeof e.type=="string"?e.type:void 0,fetchPriority:typeof e.fetchPriority=="string"?e.fetchPriority:void 0,referrerPolicy:typeof e.referrerPolicy=="string"?e.referrerPolicy:void 0,imageSrcSet:typeof e.imageSrcSet=="string"?e.imageSrcSet:void 0,imageSizes:typeof e.imageSizes=="string"?e.imageSizes:void 0,media:typeof e.media=="string"?e.media:void 0})}};i.preloadModule=function(r,e){if(typeof r=="string")if(e){var t=a(e.as,e.crossOrigin);n.d.m(r,{as:typeof e.as=="string"&&e.as!=="script"?e.as:void 0,crossOrigin:t,integrity:typeof e.integrity=="string"?e.integrity:void 0})}else n.d.m(r)};i.requestFormReset=function(r){n.d.r(r)};i.unstable_batchedUpdates=function(r,e){return r(e)};i.useFormState=function(r,e,t){return u.H.useFormState(r,e,t)};i.useFormStatus=function(){return u.H.useHostTransitionStatus()};i.version="19.2.8"});var E=s((R,_)=>{"use strict";function o(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(o)}catch(r){console.error(r)}}o(),_.exports=l()});export{E as a};
1
+ import{G as v}from"./chunk.GFF2FB2J.js";import{a as s}from"./chunk.AJZBJBMO.js";var l=s(i=>{"use strict";var m=v();function y(r){var e="https://react.dev/errors/"+r;if(1<arguments.length){e+="?args[]="+encodeURIComponent(arguments[1]);for(var t=2;t<arguments.length;t++)e+="&args[]="+encodeURIComponent(arguments[t])}return"Minified React error #"+r+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function c(){}var n={d:{f:c,r:function(){throw Error(y(522))},D:c,C:c,L:c,m:c,X:c,S:c,M:c},p:0,findDOMNode:null},O=Symbol.for("react.portal");function S(r,e,t){var f=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:O,key:f==null?null:""+f,children:r,containerInfo:e,implementation:t}}var u=m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function a(r,e){if(r==="font")return"";if(typeof e=="string")return e==="use-credentials"?e:""}i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=n;i.createPortal=function(r,e){var t=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)throw Error(y(299));return S(r,e,null,t)};i.flushSync=function(r){var e=u.T,t=n.p;try{if(u.T=null,n.p=2,r)return r()}finally{u.T=e,n.p=t,n.d.f()}};i.preconnect=function(r,e){typeof r=="string"&&(e?(e=e.crossOrigin,e=typeof e=="string"?e==="use-credentials"?e:"":void 0):e=null,n.d.C(r,e))};i.prefetchDNS=function(r){typeof r=="string"&&n.d.D(r)};i.preinit=function(r,e){if(typeof r=="string"&&e&&typeof e.as=="string"){var t=e.as,f=a(t,e.crossOrigin),g=typeof e.integrity=="string"?e.integrity:void 0,d=typeof e.fetchPriority=="string"?e.fetchPriority:void 0;t==="style"?n.d.S(r,typeof e.precedence=="string"?e.precedence:void 0,{crossOrigin:f,integrity:g,fetchPriority:d}):t==="script"&&n.d.X(r,{crossOrigin:f,integrity:g,fetchPriority:d,nonce:typeof e.nonce=="string"?e.nonce:void 0})}};i.preinitModule=function(r,e){if(typeof r=="string")if(typeof e=="object"&&e!==null){if(e.as==null||e.as==="script"){var t=a(e.as,e.crossOrigin);n.d.M(r,{crossOrigin:t,integrity:typeof e.integrity=="string"?e.integrity:void 0,nonce:typeof e.nonce=="string"?e.nonce:void 0})}}else e==null&&n.d.M(r)};i.preload=function(r,e){if(typeof r=="string"&&typeof e=="object"&&e!==null&&typeof e.as=="string"){var t=e.as,f=a(t,e.crossOrigin);n.d.L(r,t,{crossOrigin:f,integrity:typeof e.integrity=="string"?e.integrity:void 0,nonce:typeof e.nonce=="string"?e.nonce:void 0,type:typeof e.type=="string"?e.type:void 0,fetchPriority:typeof e.fetchPriority=="string"?e.fetchPriority:void 0,referrerPolicy:typeof e.referrerPolicy=="string"?e.referrerPolicy:void 0,imageSrcSet:typeof e.imageSrcSet=="string"?e.imageSrcSet:void 0,imageSizes:typeof e.imageSizes=="string"?e.imageSizes:void 0,media:typeof e.media=="string"?e.media:void 0})}};i.preloadModule=function(r,e){if(typeof r=="string")if(e){var t=a(e.as,e.crossOrigin);n.d.m(r,{as:typeof e.as=="string"&&e.as!=="script"?e.as:void 0,crossOrigin:t,integrity:typeof e.integrity=="string"?e.integrity:void 0})}else n.d.m(r)};i.requestFormReset=function(r){n.d.r(r)};i.unstable_batchedUpdates=function(r,e){return r(e)};i.useFormState=function(r,e,t){return u.H.useFormState(r,e,t)};i.useFormStatus=function(){return u.H.useHostTransitionStatus()};i.version="19.2.8"});var E=s((R,_)=>{"use strict";function o(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(o)}catch(r){console.error(r)}}o(),_.exports=l()});export{E as a};
2
2
  /*! Bundled license information:
3
3
 
4
4
  react-dom/cjs/react-dom.production.js:
@@ -0,0 +1 @@
1
+ import{a as y}from"./chunk.QTA4ROAK.js";import{g}from"./chunk.L4DECHXR.js";import{G as R,R as c,a as f,ya as m}from"./chunk.GFF2FB2J.js";import{da as p}from"./chunk.6V2RG5JG.js";import{b as u}from"./chunk.AJZBJBMO.js";var o=u(R(),1);var r=u(c(),1),S,h=()=>S??=m(f(()=>import("./chunk.DZRTOURR.js")));function L(e){let[n,t]=(0,o.useState)(()=>h().current);return(0,o.useEffect)(()=>{if(!e||n)return;let i=!0;return h().load().then(a=>i&&t(a),()=>{}),()=>{i=!1}},[e,n]),n}function D(e,n){let t=L(n.length>0);return(0,o.useMemo)(()=>t?t.withLines(e,n):n,[t,e,n])}function I(e,n){let t=L(n.some(i=>i.shape));return(0,o.useMemo)(()=>{let i=new Map;if(!t)return i;for(let a of n){let l=t.ruleLine(a,e);l&&i.set(a.name,l)}return i},[t,e,n])}function M(e){let n=e.line;if(!(!n||e.message.endsWith(` \u2014 ${n.text}`)||e.message===b(e)))return e.message}function b(e){let n=e.line;return n?n.record!==void 0?`${n.record} \u2014 ${n.text}`:n.text:e.message}var P={name:{},op:{color:"var(--graview-ink-muted)",fontWeight:500},value:{fontWeight:600,fontVariantNumeric:"tabular-nums"},word:{color:"var(--graview-ink-muted)"},open:{color:"var(--graview-ink-faint)"},close:{color:"var(--graview-ink-faint)"}};function w({parts:e}){return(0,r.jsx)(r.Fragment,{children:e.map((n,t)=>(0,r.jsxs)("span",{children:[n.space?" ":"",(0,r.jsx)("span",{"data-graview-rule-part":n.as,style:P[n.as],children:n.text})]},t))})}function x(e,n){let t=p(e?.tryDefinition(n),n);return t.charAt(0).toUpperCase()+t.slice(1)}function C({line:e,schema:n,brand:t,lead:i=e.record===void 0?"kind":"record",stacked:a=!1,style:l}){let d=e.kind,s=i==="kind"?d?x(n,d):void 0:i==="record"?e.record:void 0,k=i==="kind"&&s?`${s}: ${e.said}`:i==="record"&&s?`${s} \u2014 ${e.said}`:e.said;return(0,r.jsxs)("span",{"data-graview-rule-line":"",style:{overflowWrap:"anywhere",...l},children:[(0,r.jsx)("span",{style:g,children:k}),(0,r.jsxs)("span",{"aria-hidden":"true",children:[i!=="none"&&d?(0,r.jsx)("span",{style:{display:"inline-flex",verticalAlign:"-0.1em",marginRight:"0.4em"},children:(0,r.jsx)(y,{kind:d,...n?{schema:n}:{},...t?{brand:t}:{},size:13})}):null,s?(0,r.jsxs)("span",{"data-graview-rule-head":"",style:{fontWeight:600,marginRight:i==="record"||a?0:"0.6em"},children:[s,i==="record"&&!a?(0,r.jsx)("span",{style:{color:"var(--graview-ink-faint)",fontWeight:400},children:" \u2014 "}):null]}):null,a&&s?(0,r.jsx)("br",{}):null,(0,r.jsx)(w,{parts:e.parts}),e.when&&e.when.length>0?(0,r.jsxs)("span",{"data-graview-rule-when":"",style:{color:"var(--graview-ink-faint)"},children:[", when ",(0,r.jsx)(w,{parts:e.when})]}):null]})]})}function z(e){return e.line?e.label&&e.label.trim().length>0?e.label:void 0:e.label&&e.label!==e.message&&!e.message.startsWith(e.label)?e.label:void 0}export{D as a,I as b,M as c,b as d,C as e,z as f};
@@ -0,0 +1,35 @@
1
+ import{a as I,j as M,k as O}from"./chunk.RI3PYG5T.js";import"./chunk.UWGWXFWZ.js";import{g as P}from"./chunk.SE5SKFQH.js";import{l as D}from"./chunk.W3S6UXNA.js";import"./chunk.3VL5WECB.js";import"./chunk.JH6MU6TX.js";import{b as C}from"./chunk.WAFDCOOG.js";import"./chunk.L4DECHXR.js";import{G as q,R as F}from"./chunk.GFF2FB2J.js";import{W as L,cc as E}from"./chunk.6V2RG5JG.js";import{b as N}from"./chunk.AJZBJBMO.js";var f=N(q(),1);var n=N(F(),1),R=40,B=60;function T(l,o,s){return l.allNodes().filter(i=>i.kind===o).map(i=>i[s])}function Y(l){if(l.length<2)return[];let o=[...l].sort((a,d)=>a-d),s=o[o.length-1]-o[0];if(s<=0)return[];let i=Math.max(1,10**Math.floor(Math.log10(s/4))),e=s/4>=i*5?i*5:i,t=a=>Math.round(a/e)*e;return[...new Set([.2,.4,.6,.8].map(a=>t(o[Math.floor(a*(o.length-1))])))].filter(a=>a>0)}function _(l,o,s){let i=new Set(s.far??[]),e=new Map;for(let t of o.allNodes())i.has(t.kind)&&e.set(t.id,L(l.tryDefinition(t.kind),t));return[...e.entries()].map(([t,a])=>({id:t,label:a}))}function K(l,o,s){let i=_(l,o,s);return(i.length<=R?i:i.map(t=>({end:t,ties:o.out(t.id).length+o.in(t.id).length})).sort((t,a)=>a.ties-t.ties||t.end.label.localeCompare(a.end.label)).slice(0,R).map(t=>t.end)).sort((t,a)=>t.label.localeCompare(a.label))}function U(l,o,s){let i=[];for(let e of s.filters){let t=i.length;if(e.about==="is")for(let a of e.options??[])i.push({value:`is:${a}`,label:a,group:e.label,condition:{key:"is",value:a}});else if(e.about==="edge"){i.push({value:`${e.key}:*`,label:"anything",group:e.label,condition:{key:e.key,value:"*"}}),i.push({value:`${e.key}:none`,label:"nothing",group:e.label,condition:{key:e.key,value:"none"}});for(let a of K(l,o,e))i.push({value:`${e.key}:${a.id}`,label:a.label,group:e.label,condition:{key:e.key,value:a.id}})}else if(e.type==="date")for(let a of["before","after","on"])i.push({value:`${e.key}:${a}`,label:`${a}\u2026`,group:e.label,ask:{key:e.key,op:a,label:e.label}});else if(e.type==="number"){let a=l.tryDefinition(s.kind),d=Y(T(o,s.kind,e.key).filter(p=>typeof p=="number"));for(let p of["at-most","at-least"])for(let v of p==="at-most"?d:[...d].reverse())i.push({value:`${e.key}:${p}:${v}`,label:`${p==="at-most"?"at most":"at least"} ${C(a,e.key,v)}`,group:e.label,condition:{key:e.key,value:`${p}:${v}`}})}else if(e.type==="text"){let a=[...new Set(T(o,s.kind,e.key).filter(d=>typeof d=="string"&&d.length>0&&!d.includes(",")))].sort((d,p)=>d.localeCompare(p));if(a.length>=2&&a.length<=B)for(let d of a)i.push({value:`${e.key}:${d}`,label:d,group:e.label,condition:{key:e.key,value:d}})}else if(e.type==="boolean")i.push({value:`${e.key}:true`,label:"yes",group:e.label,condition:{key:e.key,value:"true"}}),i.push({value:`${e.key}:false`,label:"no",group:e.label,condition:{key:e.key,value:"false"}});else if(e.about==="via"){let a=l.tryDefinition(e.far?.[0]??"");for(let d of e.options??[])i.push({value:`${e.key}:${d}`,label:C(a,e.key.split(".")[1],d),group:e.label,condition:{key:e.key,value:d}})}else for(let a of e.options??[])i.push({value:`${e.key}:${a}`,label:C(l.tryDefinition(s.kind),e.key,a),group:e.label,condition:{key:e.key,value:a}});for(let a=t;a<i.length;a++)i[a]={...i[a],key:e.key}}return i}function V(l,o,s,i){let e=l.tryDefinition(o);return["at-most","at-least"].map(t=>({value:`${s.key}:${t}:${i}`,label:`${t==="at-most"?"at most":"at least"} ${C(e,s.key,i)}`,group:s.label,key:s.key,condition:{key:s.key,value:`${t}:${i}`}}))}function G(l){let o=l.trim().replace(/(?<=\d),(?=\d{3}\b)/g,"");return/^-?\d+(\.\d+)?$/.test(o)?Number(o):null}function j(l,o,s){let i=U(l,o,s);return s.filters.flatMap(e=>{let t=i.filter(d=>d.key===e.key);if(e.type==="number"&&e.about!=="edge")return[{key:e.key,label:e.label,entries:t,atNumber:d=>V(l,s.kind,e,d)}];if(t.length===0)return[];if(e.about!=="edge")return[{key:e.key,label:e.label,entries:t}];let a=_(l,o,e);return a.length<I?[{key:e.key,label:e.label,entries:t}]:[{key:e.key,label:e.label,entries:t.filter(d=>d.value===`${e.key}:*`||d.value===`${e.key}:none`),typed:[...a].sort((d,p)=>d.label.localeCompare(p.label))}]})}var z=8;function H(l,o){let s=o.trim().toLocaleLowerCase();if(!s)return{shown:[],more:0};let e=[...l.filter(t=>t.label.toLocaleLowerCase().includes(s))].sort((t,a)=>+!t.label.toLocaleLowerCase().startsWith(s)-+!a.label.toLocaleLowerCase().startsWith(s));return{shown:e.slice(0,z),more:Math.max(0,e.length-z)}}var J=["day","week","month","year","decade"];function le(l){let{which:o,schema:s,graph:i,offers:e,arrangement:t,set:a,toggle:d,has:p,done:v}=l,m=l.testId,A=(0,f.useRef)(null);(0,f.useEffect)(()=>{let u=A.current?.closest("[data-graview-popover]");!u||document.activeElement!==u||(u.querySelector('[aria-pressed="true"]')??u.querySelector("button, input"))?.focus({preventScroll:!0})},[]);let y=t.sort?e.sorts.find(u=>u.key===t.sort.by):void 0,S=t.group?e.groups.find(u=>u.key===t.group.by):void 0,b=O(y),r=e.natural?e.sorts.find(u=>u.key===e.natural.by):void 0,k=o==="filter"||o==="all"&&l.parts?.filter?j(s,i,e):[],w=u=>(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("p",{children:"Sort by"}),(0,n.jsx)($,{testId:`${m}-sort-default`,value:"",on:!t.sort,onPress:()=>(a({sort:void 0}),u()),children:r?`As declared (${M(r.label)})`:"As they were added"}),e.sorts.map(g=>(0,n.jsx)($,{value:g.key,on:t.sort?.by===g.key,onPress:()=>(a({sort:{by:g.key,direction:t.sort?.direction??"asc"}}),u()),children:g.label},g.key)),t.sort?(0,n.jsxs)("div",{role:"group","aria-label":"Order","data-testid":`${m}-direction`,children:[(0,n.jsx)("p",{"aria-hidden":"true",children:"Order"}),["asc","desc"].map(g=>(0,n.jsx)($,{testId:`${m}-direction-${g}`,value:g,on:t.sort.direction===g,onPress:()=>(a({sort:{by:t.sort.by,direction:g}}),u()),children:b[g]},g))]}):null]}),c=u=>(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("p",{children:"Group by"}),(0,n.jsx)($,{testId:`${m}-group-none`,value:"",on:!t.group,onPress:()=>(a({group:void 0}),u()),children:"Not grouped"}),e.groups.map(g=>(0,n.jsx)($,{value:g.key,on:t.group?.by===g.key,onPress:()=>(a({group:{by:g.key}}),u()),children:g.label},g.key)),t.group&&S?.buckets?(0,n.jsxs)("div",{role:"group","aria-label":"How wide a group is","data-testid":`${m}-bucket`,children:[(0,n.jsx)("p",{"aria-hidden":"true",children:"Each group"}),J.map(g=>(0,n.jsx)($,{testId:`${m}-bucket-${g}`,value:g,on:(t.group.bucket??"day")===g,onPress:()=>(a({group:{by:t.group.by,bucket:g}}),u()),children:`A ${g}`},g))]}):null]}),x=u=>(0,n.jsx)(Q,{sections:k,has:p,testId:m,onToggle:g=>(d(g),u())}),h=l.parts??{sort:!0,group:!0,filter:!0};return(0,n.jsxs)("div",{ref:A,style:{display:"contents"},children:[(0,n.jsx)("style",{children:Z}),o==="sort"?w(v):o==="group"?c(v):o==="filter"?x(v):(0,n.jsxs)(n.Fragment,{children:[h.sort?(0,n.jsx)("div",{role:"group","aria-label":"Sort",children:w(v)}):null,h.group?(0,n.jsx)("div",{role:"group","aria-label":"Group",children:c(v)}):null,h.filter?(0,n.jsx)("div",{role:"group","aria-label":"Filter",children:x(v)}):null]})]})}function $({value:l,on:o,onPress:s,testId:i,children:e}){return(0,n.jsx)("button",{type:"button",className:"graview-arrange-item",value:l,"data-value":l,"aria-pressed":o,onClick:s,...i?{"data-testid":i}:{},children:e})}function Q({sections:l,has:o,testId:s,onToggle:i}){let[e,t]=(0,f.useState)(null),[a,d]=(0,f.useState)(""),[p,v]=(0,f.useState)(()=>new Set(l.length===1?[l[0].key]:[])),[m,A]=(0,f.useState)({});if(e)return(0,n.jsx)(X,{ask:e,testId:s,onDay:r=>i({key:e.key,value:`${e.op}:${r}`}),onCancel:()=>t(null)});let y=r=>(0,n.jsx)($,{value:r.value,on:r.condition?o(r.condition):!1,onPress:()=>r.condition?i(r.condition):t(r.ask),children:r.label},r.value),S=(r,k)=>{let w=(r.typed??[]).filter(h=>o({key:r.key,value:h.id})),c=H(r.typed??[],k),x=[...w,...c.shown.filter(h=>!w.includes(h))];return(0,n.jsxs)(n.Fragment,{children:[x.map(h=>y({value:`${r.key}:${h.id}`,label:h.label,group:r.label,key:r.key,condition:{key:r.key,value:h.id}})),k.trim()&&c.shown.length===0?(0,n.jsx)("span",{className:"graview-arrange-none",children:"None is called that."}):null,c.more>0?(0,n.jsx)("span",{className:"graview-arrange-none",children:`${c.more} more \u2014 type more of the name`}):null]})},b=a.trim().toLocaleLowerCase();return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("label",{className:"graview-arrange-find",children:[(0,n.jsx)("span",{style:{position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0 0 0 0)"},children:"Find a filter"}),(0,n.jsx)("input",{type:"search","data-testid":`${s}-filter-find`,value:a,placeholder:"Find a filter, a name or a number\u2026",onChange:r=>d(r.target.value)})]}),l.map(r=>{let k=r.entries.filter(c=>c.condition&&o(c.condition)).length+(r.typed??[]).filter(c=>o({key:r.key,value:c.id})).length;if(b){let c=r.label.toLocaleLowerCase().includes(b),x=r.atNumber&&G(b)!==null?r.atNumber(G(b)):[],h=[...x,...c?r.entries:r.entries.filter(g=>g.label.toLocaleLowerCase().includes(b)&&!x.some(W=>W.value===g.value))],u=r.typed?H(r.typed,b):{shown:[],more:0};return h.length===0&&u.shown.length===0?null:(0,n.jsxs)("div",{role:"group","aria-label":r.label,"data-section":r.key,children:[(0,n.jsx)("p",{"aria-hidden":"true",children:r.label}),h.map(y),r.typed?S(r,b):null]},r.key)}if(r.entries.length===0&&!r.typed)return null;let w=p.has(r.key);return(0,n.jsxs)("div",{role:"group","aria-label":r.label,"data-section":r.key,children:[(0,n.jsxs)("button",{type:"button",className:"graview-arrange-section","data-testid":`${s}-section`,"data-key":r.key,"aria-expanded":w,onClick:()=>v(c=>c.has(r.key)?new Set([...c].filter(x=>x!==r.key)):new Set([...c,r.key])),children:[(0,n.jsx)("span",{children:r.label}),k>0?(0,n.jsx)("span",{className:"graview-arrange-on",children:`${k} on`}):null]}),w?(0,n.jsxs)(n.Fragment,{children:[r.typed?(0,n.jsx)("input",{type:"search",className:"graview-arrange-far","data-testid":`${s}-far-find`,"data-key":r.key,"aria-label":`${r.label}: type a name`,placeholder:`Type a name (${r.typed.length})\u2026`,autoFocus:!0,value:m[r.key]??"",onChange:c=>A({...m,[r.key]:c.target.value})}):null,r.entries.map(y),r.typed?S(r,m[r.key]??""):null]}):null]},r.key)})]})}function X({ask:l,testId:o,onDay:s,onCancel:i}){let[e,t]=(0,f.useState)(""),a=/^\d{4}-\d{2}-\d{2}$/.test(e)&&Number(e.slice(0,4))>=1e3,d=()=>{a&&s(e)};return(0,n.jsxs)("div",{role:"group","aria-label":`${l.label} ${l.op} which day`,"data-testid":`${o}-ask-day`,className:"graview-arrange-ask",children:[(0,n.jsx)("p",{"aria-hidden":"true",children:`${l.label} ${l.op}`}),(0,n.jsx)("input",{type:"date","data-testid":`${o}-day`,"aria-label":`${l.label} ${l.op} which day`,autoFocus:!0,value:e,onChange:p=>t(p.target.value),onKeyDown:p=>{p.key==="Enter"?(p.preventDefault(),d()):p.key==="Escape"&&(p.preventDefault(),p.stopPropagation(),p.nativeEvent.stopImmediatePropagation(),i())}}),(0,n.jsxs)("span",{children:[(0,n.jsx)("button",{type:"button","data-testid":`${o}-day-add`,disabled:!a,onClick:d,children:"Add"}),(0,n.jsx)("button",{type:"button",onClick:i,children:"Never mind"})]})]})}var Z=`
2
+ .graview-arrange-list{display:grid;align-content:start;width:min(300px,calc(100vw - 24px));height:auto;max-height:min(70vh,520px);overflow:auto;overscroll-behavior:contain;margin:0;padding:0 6px 6px;border-radius:10px;border:1px solid var(--graview-edge);background:linear-gradient(var(--graview-float),var(--graview-float)),var(--graview-panel);box-shadow:var(--graview-lift-high);color:var(--graview-ink);font-size:.875rem;line-height:1.3}
3
+ .graview-arrange-list>*:first-child:not(.graview-arrange-find){margin-top:6px}
4
+ @media (max-width:519px){.graview-arrange-list{left:0!important;right:0!important;top:auto!important;bottom:0!important;width:100%!important;max-height:min(80dvh,560px)!important;border-radius:14px 14px 0 0;padding-bottom:calc(10px + env(safe-area-inset-bottom))}}
5
+ .graview-arrange-find{position:sticky;top:0;z-index:${E.raised};display:block;margin:0 -6px 2px;padding:6px;background:linear-gradient(var(--graview-float),var(--graview-float)),var(--graview-panel);border-bottom:1px solid var(--graview-edge)}
6
+ .graview-arrange-find input,.graview-arrange-far{box-sizing:border-box;width:100%;min-height:32px;margin:0;padding:0 8px;border:1px solid var(--graview-edge);border-radius:7px;background:var(--graview-panel);font:inherit;color:var(--graview-ink)}
7
+ .graview-arrange-far{width:calc(100% - 16px);margin:2px 8px 4px}
8
+ .graview-arrange-section{display:flex;align-items:center;justify-content:space-between;gap:8px;width:100%;min-height:32px;margin:0;padding:6px 8px;border:0;border-radius:7px;background:none;font:inherit;font-weight:600;text-align:left;color:var(--graview-ink);cursor:pointer}
9
+ .graview-arrange-section::after{content:"";flex:0 0 7px;height:7px;margin-left:auto;border:solid var(--graview-ink-muted);border-width:0 1.5px 1.5px 0;transform:rotate(-45deg)}
10
+ .graview-arrange-section[aria-expanded=true]::after{transform:rotate(45deg)}
11
+ .graview-arrange-section:hover{background:color-mix(in srgb,var(--graview-ink) 7%,transparent)}
12
+ .graview-arrange-on{font-weight:400;color:var(--graview-accent)}
13
+ .graview-arrange-none{display:block;padding:4px 8px 6px 28px;color:var(--graview-ink-muted)}
14
+ .graview-arrange-list [role=group]{display:grid}
15
+ .graview-arrange-list p{margin:8px 8px 2px;font-size:.6875rem;font-weight:600;letter-spacing:.06em;text-transform:uppercase;color:var(--graview-ink-muted)}
16
+ .graview-arrange-item{display:flex;align-items:flex-start;gap:8px;width:100%;min-height:30px;margin:0;padding:6px 8px;border:0;border-radius:7px;background:none;font:inherit;text-align:left;color:var(--graview-ink);cursor:pointer;overflow-wrap:anywhere}
17
+ .graview-arrange-item::before{content:"";flex:0 0 12px}
18
+ .graview-arrange-item[aria-pressed=true]{font-weight:600}
19
+ .graview-arrange-item[aria-pressed=true]::before{content:"\u2713";color:var(--graview-accent)}
20
+ .graview-arrange-item:hover{background:color-mix(in srgb,var(--graview-ink) 7%,transparent)}
21
+ .graview-arrange-ask{display:grid;gap:8px;padding:0 8px 8px}
22
+ .graview-arrange-ask p{margin:8px 0 0}
23
+ .graview-arrange-ask input{box-sizing:border-box;width:100%;min-height:32px;padding:0 8px;border:1px solid var(--graview-edge);border-radius:7px;background:var(--graview-panel);font:inherit;color:var(--graview-ink)}
24
+ .graview-arrange-ask span{display:flex;gap:8px}
25
+ .graview-arrange-ask button{min-height:30px;padding:0 12px;border:1px solid var(--graview-edge);border-radius:7px;background:var(--graview-panel);font:inherit;color:var(--graview-ink);cursor:pointer}
26
+ .graview-arrange-ask button:disabled{opacity:.5;cursor:default}
27
+ `;function se({offers:l,chips:o,schema:s,graph:i,kind:e,arrangement:t,has:a,choose:d,testId:p}){return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("style",{children:re}),(0,n.jsx)(ee,{offers:l,chips:o,schema:s,graph:i,kind:e,arrangement:t,has:a,choose:d,testId:p})]})}function ee({offers:l,chips:o,schema:s,graph:i,kind:e,arrangement:t,has:a,choose:d,testId:p}){let v={schema:s,graph:i,...o.flagged?{flagged:o.flagged}:{},...o.today?{today:o.today}:{}},m=s.tryDefinition(e),A=o.nodes.filter(y=>!t.query||P(v,y,t.query));return(0,n.jsx)("div",{className:"graview-arrange-chips","data-testid":`${p}-chips`,children:l.map(y=>{let S=(t.filter??[]).filter(r=>r.key!==y.key),b=new Map;for(let r of A){if(!S.every(w=>D(v,r,w)))continue;let k=String(r[y.key]);b.set(k,(b.get(k)??0)+1)}return(0,n.jsxs)("div",{role:"group","aria-label":y.label,className:"graview-arrange-chip-row","data-field":y.key,children:[(0,n.jsx)("span",{className:"graview-arrange-chip-label","aria-hidden":"true",children:y.label}),(y.options??[]).filter(r=>(b.get(r)??0)>0||a({key:y.key,value:r})).map(r=>{let k=C(m,y.key,r),w=b.get(r)??0;return(0,n.jsxs)("button",{type:"button",className:"graview-arrange-chip","data-testid":`${p}-chip`,"data-value":`${y.key}:${r}`,"aria-pressed":a({key:y.key,value:r}),"aria-label":`${y.label}: ${k}, ${w}`,onClick:()=>d(y.key,r),children:[k,(0,n.jsx)("span",{className:"graview-arrange-chip-count","aria-hidden":"true",children:w})]},r)})]},y.key)})})}var re=`
28
+ .graview-arrange-chips,.graview-arrange-chip-row{display:contents}
29
+ @container (max-width:519px){.graview-arrange-chips{display:flex;flex:1 1 10rem;align-items:center;gap:6px;min-width:0;overflow-x:auto;scrollbar-width:none}.graview-arrange-chip-label{margin:0}.graview-arrange-chip{flex:0 0 auto;white-space:nowrap}}
30
+ .graview-arrange-chip-label{margin:0 0 0 8px;font-size:.8125rem;color:var(--graview-ink-muted)}
31
+ .graview-arrange-chip{display:inline-flex;align-items:center;gap:6px;min-height:28px;max-width:100%;box-sizing:border-box;margin:0;padding:0 10px;border:1px solid var(--graview-edge);border-radius:999px;background:var(--graview-panel);font:inherit;font-size:.8125rem;line-height:1.2;color:var(--graview-ink);cursor:pointer;overflow-wrap:anywhere;text-align:left}
32
+ .graview-arrange-chip:hover{border-color:var(--graview-edge-bright,var(--graview-edge))}
33
+ .graview-arrange-chip[aria-pressed=true]{border-color:var(--graview-accent);background:color-mix(in srgb,var(--graview-accent) 12%,var(--graview-panel));font-weight:600}
34
+ .graview-arrange-chip-count{color:var(--graview-ink-muted);font-variant-numeric:tabular-nums;font-weight:400}
35
+ `;export{se as ArrangeChips,le as ArrangeLists,R as FAR_ENDS,z as TYPED_MATCHES,U as filterEntries,j as filterSections,Y as roundSteps,H as typedMatches,G as typedNumber};
@@ -0,0 +1,9 @@
1
+ import{a as J}from"./chunk.KOB6N3SL.js";import{a as V,c as T,e as _,f as D}from"./chunk.V5ZYUVMH.js";import"./chunk.GLBHQFJ2.js";import"./chunk.6XMEU2Q2.js";import"./chunk.QIAKO27D.js";import"./chunk.UT6642FC.js";import"./chunk.QTA4ROAK.js";import"./chunk.2CIBWZJG.js";import"./chunk.7BWT5L2L.js";import"./chunk.TI4OSTQV.js";import"./chunk.OQDETV4X.js";import"./chunk.3VL5WECB.js";import"./chunk.JH6MU6TX.js";import"./chunk.WAFDCOOG.js";import"./chunk.L4DECHXR.js";import{G as q,R as k,Z as w,d as B,ta as j,xa as E,y as G}from"./chunk.GFF2FB2J.js";import{$ as L,Ka as M,W as H,Y as I,eb as W}from"./chunk.6V2RG5JG.js";import{b as f}from"./chunk.AJZBJBMO.js";function P(e){return{minHeight:24,padding:"3px 10px",borderRadius:6,fontSize:"0.875rem",borderWidth:1,borderStyle:"solid",borderColor:e?"transparent":"var(--graview-edge)",color:e?"var(--graview-ink)":"var(--graview-ink-muted)",fontWeight:e?600:400,background:e?"color-mix(in srgb, var(--graview-accent) 16%, transparent)":"transparent"}}var A=f(k(),1);function K(){let{seats:e,principal:n,takeSeat:i}=w();return e.length<2?null:(0,A.jsxs)("div",{role:"group","aria-label":"Seat","data-testid":"seats",style:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:6,rowGap:4},children:[(0,A.jsx)("span",{style:{fontSize:"0.75rem",letterSpacing:"0.12em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},children:"As"}),e.map(r=>{let d=Q(n,r.principal);return(0,A.jsx)("button",{type:"button","aria-pressed":d,"data-testid":`seat-${r.principal.id??r.label}`,title:`Sit down as ${r.label}: the acts, the kinds and the pages narrow to what this seat may do`,onClick:()=>i(r.principal),style:{...P(d),whiteSpace:"nowrap"},children:r.label},r.principal.id??r.label)})]})}function Q(e,n){return e.kind===n.kind&&e.id===n.id}var C=f(q(),1),l=f(k(),1),X=`
2
+ .graview-here{display:flex;flex:none}
3
+ .graview-here>button{display:inline-flex;align-items:center;gap:4px;height:30px;margin:0;padding:0 4px;border:1px solid transparent;border-radius:8px;background:none;box-shadow:none;font:inherit;font-size:.75rem;color:var(--graview-ink-muted);cursor:pointer}
4
+ .graview-here-mark{display:inline-flex;align-items:center;justify-content:center;flex:none;box-sizing:border-box;width:24px;height:24px;border-radius:50%;border:1.5px solid hsl(var(--graview-hue) 50% 48%);background:var(--graview-panel-muted);color:var(--graview-ink);font-size:.75rem;font-weight:600;box-shadow:0 0 0 2px var(--graview-bar)}
5
+ .graview-here-mark+.graview-here-mark{margin-left:-10px}
6
+ .graview-here-mark[data-agent]{border-radius:5px}
7
+ .graview-here-mark[data-counted]{--graview-hue:0;border-color:var(--graview-edge)}
8
+ .graview-here small{display:block;font-size:.75rem;color:var(--graview-ink-muted)}
9
+ .graview-bar[data-finding] .graview-here{display:none}`,Z={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0 0 0 0)"};function ee(e,n){let i=n.id===void 0?null:`${n.kind}:${n.id}`,r=new Map;for(let d of e.values()){let p=d.participant.slice(0,d.participant.lastIndexOf(":"));if(p===i)continue;let o=p.endsWith(":")?d.participant:p,s=r.get(o);(!s||s.at<d.at)&&r.set(o,d)}return[...r.values()]}var F=e=>e.name&&e.onBehalfOfName?`${e.name}, for ${e.onBehalfOfName}`:e.name??"",U=e=>e===1?"1 viewer":`${e} viewers`;function te(e){let n=e.map(F).filter(Boolean),i=n.length<e.length?[...n,U(e.length-n.length)]:n,r=i.pop();return`${i.length>0?`${i.join(", ")} and ${r}`:r} ${e.length===1?"is":"are"} here`}function ne(e,n){let{store:i,hidden:r,pictures:d}=n,p=B(e),o=i.kindsKeptFrom(n.principal),s=c=>!r.has(c)&&!o.has(c)&&!i.modules.disabledKinds.has(c),u=d.find(c=>c.as===p.within?.view&&s(c.kind));if(u)return u.title;if(!p.focusId)return p.overview?"the whole thing":null;let h=G(p.focusId);if(h.length>0)return h.every(s)?h.map(c=>L(i.schema,c)).join(" and "):null;let m=i.graph.getNode(p.focusId);return m&&s(m.kind)?H(i.schema.tryDefinition(m.kind),m):null}function re(e,n){let i=s=>s.id!==void 0&&(s.id===n.principal.id||s.onBehalfOf?.id===n.principal.id),r=e.filter(s=>!W(s)&&s.author.kind!=="system"&&!i(s.author)),d=r[0];if(!d)return null;let p=M(d.author,{graph:n.store.graph,schema:n.store.schema,...n.seats?{seats:n.seats}:{},...n.people?{people:n.people}:{}}),o=[...new Set(r.map(s=>s.intent))].join("; ");return`${p}: ${o}`}function ae(e,n,i){let r=re(e,n);r&&(i(""),setTimeout(()=>i(r),50))}function ie({scene:e,compact:n}){let{who:i,principal:r,store:d,views:p,hiddenKinds:o,follow:s}=w(),u=E("here"),h=ee(i,r),m=h.length===0?"":te(h),[c,z]=(0,C.useState)("");if((0,C.useEffect)(()=>z(m),[m]),h.length===0)return null;let S=h.filter(g=>g.name),y=S.slice(0,n?2:3),v=h.length-y.length,b=h.length-S.length,a=p.places();return(0,l.jsxs)("div",{className:"graview-here","data-testid":"here",children:[(0,l.jsx)("style",{children:X}),(0,l.jsx)("span",{role:"status","aria-live":"polite",style:Z,children:c}),(0,l.jsxs)("button",{type:"button","data-testid":"here-open",...u.trigger,onClick:u.toggle,"aria-label":`${m} \u2014 who and where`,title:m,children:[y.length>0?(0,l.jsx)("span",{style:{display:"flex"},children:y.map(g=>(0,l.jsx)(O,{one:g},g.participant))}):(0,l.jsx)(O,{count:v}),y.length>0&&v>0?(0,l.jsxs)("span",{"aria-hidden":"true",children:["+",v]}):null]}),(0,l.jsxs)("ul",{...u.pane,"aria-label":"Who is here","data-testid":"here-list",hidden:!u.open,className:"graview-bar-list",style:j,children:[S.map(g=>{let x=ne(g.stop,{store:d,principal:r,hidden:o,pictures:a}),N=F(g);return(0,l.jsx)("li",{children:(0,l.jsxs)(e?"button":"span",{className:"graview-bar-item","data-testid":"here-one",...e?{type:"button",title:`Go where ${N} is`,onClick:()=>{u.setOpen(!1),s(g.participant)}}:{style:{cursor:"default"}},children:[(0,l.jsx)(O,{one:g}),(0,l.jsxs)("span",{children:[N,x?(0,l.jsxs)("small",{children:["On ",x]}):null]})]})},g.participant)}),b>0?(0,l.jsx)("li",{children:(0,l.jsxs)("span",{className:"graview-bar-item","data-testid":"here-viewers",style:{cursor:"default"},children:[(0,l.jsx)(O,{count:b}),(0,l.jsxs)("span",{children:[U(b),(0,l.jsx)("small",{children:"Not signed in"})]})]})}):null]})]})}function O({one:e,count:n}){return(0,l.jsx)("span",{className:"graview-here-mark","aria-hidden":"true",...e?{style:{"--graview-hue":Math.round(e.hue)}}:{"data-counted":""},...e?.kind==="agent"?{"data-agent":""}:{},children:e?(e.name??"").trim().charAt(0).toUpperCase():n})}var t=f(k(),1);function Se({violations:e,pick:n}){let{store:i,brand:r,setMenuAt:d}=w(),p=V(i,e);return(0,t.jsx)(t.Fragment,{children:p.map((o,s)=>{let u=D(o),h=o.repairs.length>0?`${o.repairs.length} ${o.repairs.length===1?"way":"ways"} to fix`:"";return(0,t.jsx)("li",{style:{borderTop:s===0?"none":"1px solid var(--graview-edge)"},children:(0,t.jsxs)("button",{type:"button",onClick:m=>{let c=m.currentTarget.closest("ol").getBoundingClientRect();n(o),d({x:c.left,y:c.top,on:o.subjectId})},...T(o)!==void 0?{title:T(o)}:{},style:{width:"100%",textAlign:"left",fontSize:"0.8125rem",lineHeight:1.4,padding:"7px 8px",border:"1px solid transparent",background:"none",boxShadow:"none",borderRadius:7},children:[o.line?(0,t.jsx)(_,{line:o.line,schema:i.schema,...r?{brand:r}:{},stacked:!0,style:{display:"block",color:"var(--graview-ink)"}}):(0,t.jsx)("span",{style:{display:"block",color:"var(--graview-ink)"},children:o.message}),u||h?(0,t.jsx)("span",{style:{color:"var(--graview-ink-faint)",fontSize:"0.75rem"},children:[u,h].filter(Boolean).join(" \xB7 ")}):null]})},`${o.invariant}:${s}`)})})}function xe({name:e,me:n,scheme:i,onScheme:r,profileHref:d,hostActions:p,close:o,part:s,signature:u=!1}){let{principal:h,seats:m,settings:c,settingValues:z,chooseSetting:S,sharing:y}=w(),v=h.roles??[],b={setOpen:a=>o()};return(0,t.jsx)(t.Fragment,{children:s==="top"?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{style:{display:"grid",gap:3},children:[(0,t.jsx)("span",{style:R,children:"Signed in as"}),(0,t.jsx)("strong",{style:{fontSize:"1rem",fontWeight:550},children:e}),(0,t.jsx)("span",{style:{fontSize:"0.8125rem",color:"var(--graview-ink-muted)"},children:v.length>0?v.map(a=>I(a)).join(", "):n===void 0?"This app has no sign-in; everything here is yours.":"No role in particular"}),n!==void 0&&d!==void 0?(0,t.jsx)("a",{href:d(n.id),"data-testid":"profile-record",style:{display:"inline-flex",alignItems:"center",minHeight:24,justifySelf:"start",fontSize:"0.875rem",color:"var(--graview-accent)"},children:"Your record \u2197"}):null,y?(0,t.jsxs)("span",{"data-testid":"profile-seen-as",style:{fontSize:"0.8125rem",color:"var(--graview-ink-muted)"},children:["Seen by others as ",y.name]}):null]}),p.length>0?(0,t.jsx)("ul",{role:"list","aria-label":"From the host","data-testid":"host-actions",style:{...$,margin:0,paddingLeft:0,listStyle:"none",display:"grid",gap:2},children:p.map(a=>(0,t.jsx)("li",{children:a.href!==void 0?(0,t.jsx)("a",{href:a.href,"data-testid":"host-action",className:"graview-host-action",...a.target?{target:a.target,rel:"noopener"}:{},onClick:()=>{a.onSelect?.(),b.setOpen(!1)},style:Y,children:a.label}):(0,t.jsx)("button",{type:"button","data-testid":"host-action",className:"graview-host-action",onClick:()=>{b.setOpen(!1),a.onSelect?.()},style:{...Y,width:"100%",textAlign:"left",border:"none",background:"none",boxShadow:"none",font:"inherit",cursor:"pointer"},children:a.label})},a.label))}):null]}):(0,t.jsxs)(t.Fragment,{children:[m.length>1?(0,t.jsxs)("div",{style:{display:"grid",gap:6,...$},children:[(0,t.jsx)("span",{style:R,children:"Sit as somebody else"}),(0,t.jsx)(K,{})]}):null,c.length>0?(0,t.jsx)("div",{style:{display:"grid",gap:10,...$},children:c.map(a=>(0,t.jsxs)("fieldset",{"data-testid":`setting-${a.name}`,style:{border:0,margin:0,padding:0,display:"grid",gap:5},children:[(0,t.jsx)("legend",{style:{...R,padding:0},children:a.title}),a.description?(0,t.jsx)("span",{style:{fontSize:"0.8125rem",color:"var(--graview-ink-muted)"},children:a.description}):null,(0,t.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:a.options.map(g=>{let x=(z[a.name]??a.initial)===g.value;return(0,t.jsx)("button",{type:"button","aria-pressed":x,"data-testid":`setting-${a.name}-${g.value}`,onClick:()=>S(a.name,g.value),style:P(x),children:g.label},g.value)})})]},a.name))}):null,i!==void 0&&r!==void 0?(0,t.jsxs)("div",{style:{display:"grid",gap:5,...$},children:[(0,t.jsx)("span",{style:R,children:"Scheme"}),(0,t.jsx)("div",{style:{display:"flex",gap:4},children:["light","dark"].map(a=>(0,t.jsx)("button",{type:"button","aria-pressed":i===a,"data-testid":`profile-scheme-${a}`,onClick:()=>r(a),style:P(i===a),children:a==="light"?"\u2600 Light":"\u263E Dark"},a))})]}):null,u?(0,t.jsxs)("p",{"data-testid":"graview-signature",style:{...$,margin:0,display:"flex",alignItems:"center",gap:6,fontSize:"0.75rem",color:"var(--graview-ink-faint)"},children:["Built with",(0,t.jsxs)("a",{href:"https://graview.dev",target:"_blank",rel:"noopener",style:{display:"inline-flex",alignItems:"center",gap:4,minHeight:24,color:"var(--graview-ink-muted)",fontWeight:600,textDecoration:"none"},children:[(0,t.jsx)("span",{"data-testid":"graview-mark",style:{display:"inline-flex",lineHeight:0},dangerouslySetInnerHTML:{__html:oe}}),"Graview"]})]}):null]})})}var oe='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" width="14" height="14" aria-hidden="true" focusable="false"><g fill="none" stroke="currentColor" stroke-width="2.4" stroke-linejoin="round"><path d="M13 11 L3 8 L14 3 H29 L21 9"/><path d="M10 18 L3 23 L16.5 28 L29 21 L22 19"/><path d="M16.5 18.5 V23.5" stroke-linecap="round"/></g><circle cx="16.5" cy="13.5" r="2" fill="var(--graview-mark-point, currentColor)"/></svg>',Y={display:"flex",alignItems:"center",minHeight:28,padding:"2px 8px",borderRadius:7,fontSize:"0.875rem",color:"var(--graview-ink)",textDecoration:"none"},R={fontSize:"0.75rem",letterSpacing:"0.14em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},$={paddingTop:10,borderTop:"1px solid var(--graview-edge)"};export{J as ActivityRail,ie as Here,Se as ProblemRows,xe as ProfilePane,ae as sayTheirChange};
@@ -0,0 +1 @@
1
+ import{a as Se,b as Me,c as Ke,d as ue,e as F,f as Pe,h as Ce}from"./chunk.QTMWHE5O.js";import{h as Ne,i as _e,j as Ie}from"./chunk.NDADLJE6.js";import{a as oe,b as se,c as Z,d as Ge,e as Y,g as ee,h as qe}from"./chunk.HHPGWJDO.js";import{c as Re,h as g,i as Te,j as fe}from"./chunk.42YX6NOY.js";import{b as L,c as q,e as Oe,f as xe,g as G,h as v,k as K,l as X,m as C,n as Ee,na as Fe,o as V,p as R,r as k,s as Q,t as x,u as D,ua as De,v as I,va as le,w as P,wa as pe,x as n,y as U,z as Ae}from"./chunk.6V2RG5JG.js";function me(e){let o=/^(edit|remove|archive|unarchive|merge|leave-alone|allow-tidying|skip|detach|split)-(.+)$/.exec(e);return o?{act:o[1],kind:o[2]}:void 0}var he="graview-document",ye=1,be=256*1024,ge=64*1024,ke=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,$e=/^[a-z][A-Za-z0-9]*$/,cn=new Set(["id","kind"]),dn=e=>e in Object.prototype,Ue=U(e=>!dn(e),"every object already has this name \u2014 choose another"),We=(e,o)=>[...e===void 0?[]:[xe(e)],...o===void 0?[]:[Oe(o)]],h=(e,o)=>v().check(...We(e,o)),E=(e,o,r)=>R(e).check(...We(o,r)),T=e=>v().check(G(ke,`${e} names are kebab-case, lower-case words joined by hyphens like "tool-note" (field and relation names are camelCase, like "supersededBy")`)),ln=/^(?:[a-z][a-z0-9]*(?:-[a-z0-9]+)*|[a-z][A-Za-z0-9]*)$/,W=v().check(G(ln,'relation names are one camelCase word, like "supersededBy" (kind names are kebab-case, like "tool-note")'),Ue),N=v().check(G($e,'field names are one word or camelCase, like "dueDate", so rules say them bare (kind names are kebab-case, like "tool-note")'),U(e=>!cn.has(e),'a field cannot be called "id" or "kind" \u2014 the framework keeps those; try "type" or "category"'),Ue),B=h(1,500),H=h(1,2e3),re=h(1,300),pn=["string","text","number","integer","boolean","date","datetime","enum","list","url","email","image","file","app-link","phone","place","duration"],Ze=k({type:I(pn),required:n(C()),description:n(B),label:n(h(1,60)),options:n(E(h(1,80),1,100)),of:n(I(["string","number","date","image","file"])),default:n(V()),unit:n(h(void 0,12)),format:n(I(["money","percent","duration","markdown"])),min:n(K()),max:n(K()),step:n(K()),renamedFrom:n(v().check(G($e))),repeats:n(C())}).check(Ae((e,o)=>{e.type==="enum"&&!e.options&&o.addIssue({code:"custom",message:'an enum field lists its "options"',path:["options"]}),e.type!=="enum"&&e.options&&o.addIssue({code:"custom",message:'"options" belongs only on an enum field',path:["options"]}),e.type!=="list"&&e.of&&o.addIssue({code:"custom",message:'"of" belongs only on a list field',path:["of"]}),e.repeats&&e.type!=="date"&&e.type!=="datetime"&&o.addIssue({code:"custom",message:'"repeats" belongs only on a date or datetime field',path:["repeats"]})})),fn=v().check(G(new RegExp(`${ke.source}|${Fe.source}`),'a relation goes to a kind of this document, like "house", or of another app, like "@nick/house/house"')),un=k({to:x([E(fn,1),P("*")]),cardinality:n(I(["one","many"])),description:n(B),inverse:n(h(1,80)),appendOnly:n(C()),renamedFrom:n(v()),tidying:n(P("never"))}),Ye=x([H,k({expr:H,label:n(h(1,60)),description:n(B)})]),mn=k({noun:n(h(1,40)),plural:n(h(1,40)),description:n(B),fields:D(N,Ze).check(U(e=>Object.keys(e).length>0,"a kind has at least one field")),label:n(re),describe:n(re),lifecycle:n(k({field:N,retired:E(x([v(),K(),C()]),1)})),figure:n(h(void 0,2e4)),glance:n(E(N,1,20)),page:n(k({fields:n(E(N,1,40)),groups:n(E(k({title:h(1,60),fields:E(N,1,40)}),1,12))})),edges:n(D(W,un)),computed:n(D(v(),Ye).check(U(e=>Object.keys(e).length<=20,"a kind works out at most 20 computed fields"))),fieldRoles:n(D(v(),v())),renamedFrom:n(v().check(G(ke))),people:n(C()),archives:n(P(!1)),tidying:n(I(["never","no-links"]))}),ne=x([v(),K(),C(),Ee(),R(V()),k({expr:H})]),J=v().check(G(/^\$[A-Za-z][A-Za-z0-9]*$/,'a reference is "$" and a name, like "$subject" or "$new"')),gn=x([k({create:T("kind"),as:n(v().check(G($e))),set:n(D(N,ne))}),k({set:D(N,ne),target:n(J)}),k({connect:W,from:J,to:J}),k({sever:W,from:J,to:J}),k({remove:J})]),zn=k({title:n(h(1,80)),description:n(B),fromTheOtherEnd:n(h(1,80)),on:n(x([T("kind"),E(T("kind"),1)])),creates:n(T("kind")),sets:n(D(N,ne)),writes:n(E(N,1)),connects:n(W),severs:n(W),setsOther:n(D(N,ne)),replaces:n(x([P(!0),E(W,1,10)])),removes:n(P(!0)),args:n(D(N,Ze)),effects:n(E(gn,1,20)),allowedWhen:n(H),refusal:n(re),destructive:n(C())}),hn=k({act:T("act"),label:n(h(1,80)),args:n(D(v(),ne))}),yn=k({title:n(h(1,120)),description:n(B),over:x([P("graph"),T("kind")]),when:n(H),require:H,says:n(re),repairs:n(E(hn,void 0,10))}),bn=k({roles:x([E(T("role"),1),P("*")]),mutations:x([E(T("act"),1),P("*")]),kinds:n(x([R(T("kind")),P("*")])),describe:n(B),self:n(C()),ownEnd:n(C())}),Ve=n(E(T("field"),1)),kn=k({roles:x([E(T("role"),1),P("*")]),kinds:E(T("kind"),1),own:n(C()),via:n(W),fields:Ve,hide:Ve}),$n=k({grants:R(bn),sees:n(R(kn))}),wn=k({accent:n(v().check(G(/^#[0-9a-fA-F]{6}$/,'an accent is a color like "#c2577a"'))),name:n(h(1,60)),currency:n(v().check(G(/^[A-Z]{3}$/,'a currency is its three-letter code, like "USD" or "EUR"'))),locale:n(h(2,35)),logo:n(x([h(1,ge),k({src:h(1,ge),alt:n(h(1,120))})])),favicon:n(x([h(1,ge),k({emoji:v()})])),typography:n(k({display:n(h(1,200)),body:n(h(1,200)),mono:n(h(1,200))})),shape:n(k({radius:n(K().check(q(0),L(32))),density:n(K().check(q(.75),L(1.5)))})),accents:n(D(v(),K().check(q(0),L(360)))),scheme:n(I(["light","dark","auto"]))}),ze=D(v(),V()),Be=x([h(1,120),k({by:h(1,120),direction:n(I(["asc","desc"]))})]),Le=K().check(X(),q(1),L(9999)),vn=Q({create:n(C()),options:n(Q({sort:n(Be),columnSort:n(Be),horizon:n(x([K().check(X(),q(1),L(200)),Q({years:K().check(X(),q(1),L(200)),title:h(1,80),from:n(Le),to:n(Le)})]))}))}),jn=k({card:n(R(V())),row:n(R(V())),page:n(R(V()))}),Sn=()=>{let e=n(I(["asc","desc"]));return x([h(1,120),k({by:h(1,120),direction:e,then:n(x([h(1,120),k({by:h(1,120),direction:e})]))})])},On=()=>x([h(1,120),k({by:h(1,120),order:n(E(h(1,80),void 0,40)),closed:n(E(h(1,80),void 0,40))})]),xn=Q({order:n(R(v())),hide:n(R(v())),first:n(v()),primary:n(E(h(1,80),void 0,40)),scene:n(h(1,40)),pages:n(h(1,40)),lists:n(D(v(),k({filters:n(E(h(1,120),void 0,40)),sort:n(Sn()),group:n(On())})))}),Je=k({$schema:n(v()),format:P(he),formatVersion:P(ye),name:h(1,80),description:n(B),version:n(K().check(X(),q(1))),kinds:D(T("kind"),mn).check(U(e=>Object.keys(e).length>0,"a document declares at least one kind"),U(e=>Object.keys(e).length<=40,"a document declares at most 40 kinds")),computed:n(D(v(),Ye)),acts:n(D(T("act"),zn)),rules:n(D(T("rule"),yn)),roles:n(R(T("role"))),policy:n($n),modules:n(ze),lenses:n(R(vn)),pages:n(xn),views:n(D(v(),x([jn,R(V())]))),brand:n(wn),settings:n(R(ze)),migrations:n(R(ze))});var En={};function He(e,o=En,r=ye){let{document:a,respelled:l}=Se(e),p=l.length>0?{respelled:l}:{};if(!a||typeof a!="object"||Array.isArray(a))return{document:a};let u=a;if(u.format!==he||typeof u.formatVersion!="number"||u.formatVersion>=r)return{document:a,...p};let z=u.formatVersion,$=structuredClone(u);for(let s=z;s<r;s++){let t=o[s];if(!t)throw new Error(`there is no upgrade from format ${s} to ${s+1}`);$={...t($),formatVersion:s+1}}return{document:$,from:z,...p}}function Xe(e,o,r){let a=Object.keys(e).filter(z=>e[z].edges?.[o]!==void 0);if(a.length===0)return;let l=a.map(z=>e[z].edges[o].to),p=l.some(z=>z==="*")?"*":[...new Set(l.flatMap(z=>z))];if(r.length===0||r.some(z=>a.includes(z)))return{reversed:!1,kinds:p};let u=a.filter(z=>{let $=e[z].edges[o].to;return $==="*"||r.every(s=>$.includes(s))});return u.length>0?{reversed:!0,kinds:u}:{reversed:!1,kinds:p}}var nn=(e,o)=>{let r=e?.fields[o];return r!==void 0&&(r.type==="duration"||(r.type==="number"||r.type==="integer")&&r.format==="duration")};function Qe(e,o,r,a){if(a==="out"){let l=e[o]?.edges?.[r]?.to;return l===void 0?[]:l==="*"?Object.keys(e):l}return Object.entries(e).filter(([,l])=>{let p=l.edges?.[r]?.to;return p!==void 0&&(p==="*"||p.includes(o))}).map(([l])=>l)}function we(e,o,r){if(r.t==="ident")return e[o]?.edges?.[r.name]?Qe(e,o,r.name,"out"):void 0;if(r.t==="where")return we(e,o,r.set);if(r.t==="call"&&(r.fn==="out"||r.fn==="in")&&r.args[0]?.t==="lit"&&typeof r.args[0].value=="string")return Qe(e,o,r.args[0].value,r.fn)}var en=(e,o,r)=>{let a=o.filter(l=>e[l]?.fields[r]!==void 0);return a.length>0&&a.every(l=>nn(e[l],r))};function tn(e,o,r){let a=e.kinds,l=a[o],p=new Map(r),u=new Map,z=(s,t)=>{if(t>8)return!1;switch(s.t){case"ident":return nn(l,s.name)||$(s.name,t+1);case"member":{let d=we(a,o,s.object);return d!==void 0&&en(a,d,s.name)}case"call":{if(s.fn!=="sum"&&s.fn!=="min"&&s.fn!=="max")return!1;let[d,w]=s.args,f=d&&we(a,o,d);return f!==void 0&&w?.t==="ident"&&en(a,f,w.name)}case"binary":return(s.op==="+"||s.op==="-")&&z(s.left,t)&&z(s.right,t);case"unary":return s.op==="-"&&z(s.operand,t);default:return!1}},$=(s,t)=>{if(l?.computed?.[s]===void 0)return!1;if(u.has(s))return u.get(s);u.set(s,!1);let d=p.get(s),w=d!==void 0&&z(d,t);return u.set(s,w),w};return r.map(([s])=>s).filter(s=>$(s,0))}function on(e,o,r=`kinds.${e}.page`){let a=o.page;if(!a)return[];let l=[],p=[...Object.keys(o.fields),...Object.keys(o.computed??{})],u=new Set,z=(s,t)=>{p.includes(s)?u.has(s)&&l.push(g("page-field-twice",t,`"${s}" is on ${e}'s page twice; name each field once`)):l.push(g("page-field",t,`${e}'s page is to show "${s}", and ${e} has no field or computed field called that`,`use one of: ${p.join(", ")}`)),u.add(s)};(a.fields??[]).forEach((s,t)=>z(s,`${r}.fields.${t}`));let $=new Set;return(a.groups??[]).forEach((s,t)=>{let d=s.title.trim().toLowerCase();$.has(d)&&l.push(g("page-group-twice",`${r}.groups.${t}.title`,`${e}'s page has two groups called "${s.title}"; give each its own title`)),$.add(d),s.fields.forEach((w,f)=>z(w,`${r}.groups.${t}.fields.${f}`))}),l}var An=new Set(["subject","now","today","me"]);function Fn(e){if((typeof e=="string"?e:JSON.stringify(e??null)).length>be)return{findings:[g("too-large","",`a document may be at most ${be/1024} KB`)]};if(typeof e=="string")try{e=JSON.parse(e)}catch(a){return{findings:[g("not-json","",`this is not JSON: ${a.message}`)]}}try{e=He(e).document}catch(a){return{findings:[g("format","formatVersion",a.message)]}}let o=Je.safeParse(e);if(!o.success)return{findings:o.error.issues.map(a=>{let l=a.path.map(String).join(".");if(a.code==="unrecognized_keys")return g("unknown-key",l,`${a.keys.map(p=>`"${p}"`).join(", ")} ${a.keys.length===1?"is":"are"} not part of a Graview document here`,"check the spelling against docs/declaration-document.md");if(a.code==="invalid_union"&&/\.effects\.\d+$/.test(l))return g("effect-shape",l,"this effect is not one Graview knows",'an effect is one of {"create": kind, "as"?: name, "set"?: {field: value}}, {"set": {field: value, \u2026}, "target"?: "$ref"}, {"connect"|"sever": relation, "from": "$ref", "to": "$ref"}, {"remove": "$ref"}');if(a.code==="invalid_key"){let p=a.issues?.[0]?.message;return g("shape",l,`the name "${String(a.path.at(-1))}" is not allowed here${p?`: ${p}`:""}`)}return g("shape",l,a.message)})};let r=o.data;return{document:r,findings:Dn(r)}}var ae=e=>[e??[]].flat();function sn(e){let o=new Map;for(let[r,a]of Object.entries(e.kinds))for(let[l,p]of Object.entries(le(a.edges))){let u=o.get(l);o.set(l,{name:l,from:[...u?.from??[],r],to:p.to==="*"||u?.to==="*"?"*":[...new Set([...u?.to??[],...p.to])],cardinality:p.cardinality??"many"})}return o}function lt(e){let o=new Map;for(let[a,l]of Object.entries(e.kinds)){let p=ee(l),u=pe(l.edges);o.set(a,{fields:new Set([...Object.keys(l.fields),...u.keys()]),edges:new Map(Object.entries(le(l.edges)).map(([z,$])=>[z,$.cardinality??"many"])),...p?{computed:p}:{},...u.size>0?{linked:u}:{}})}let r=ee(e);return r&&o.set(Re,{computed:r}),o}function rn(e,o){let r=[],a=ae(e.on),l=(p,u)=>{let z=Xe(o.kinds,p,a)?.reversed===!0,[$,s]=z?["$to","$subject"]:["$subject","$to"];return u==="connect"?{connect:p,from:$,to:s}:{sever:p,from:$,to:s}};if(e.creates){let p=o.kinds[e.creates],u={};for(let z of Object.keys(p?.fields??{}))u[z]=`$${z}`;for(let z of e.effects??[])"set"in z&&!("create"in z)&&F(z.target)==="new"&&Object.assign(u,z.set);r.push({create:e.creates,as:"new",set:u})}return e.sets&&r.push({set:e.sets}),e.writes&&!(e.creates&&e.on===void 0)&&r.push({set:Object.fromEntries(e.writes.map(p=>[p,`$${p}`]))}),e.connects&&(e.replaces&&r.push({replace:e.replaces===!0?[e.connects]:[...e.replaces],keep:e.connects}),r.push(l(e.connects,"connect"))),e.severs&&r.push(l(e.severs,"sever")),e.setsOther&&(e.connects||e.severs)&&r.push({set:e.setsOther,target:"$to"}),e.removes&&r.push({remove:"$subject"}),e.effects&&r.push(...e.effects.filter(p=>!(e.creates&&"set"in p&&!("create"in p)&&F(p.target)==="new"))),r}function ve(e,o,r){try{let a=Z(e),l=oe(a);for(let p of l.unknownFunctions)r.push(g("unknown-function",o,`"${p}" is not a function the rule language knows`,"see docs/declaration-document.md#expression-language"));return a}catch(a){if(a instanceof se){r.push(g("expression",o,a.sentence+` (at character ${a.at+1})`));return}throw a}}function je(e,o,r){try{return Y(e)}catch(a){if(a instanceof Ge||a instanceof se){r.push(g("template",o,(a instanceof se,a.sentence)));return}throw a}}function Dn(e){let o=[],r=new Set(Object.keys(e.kinds)),a=sn(e),l=e.acts??{},p=new Set(e.roles??[]),u=(s,t)=>pe(e.kinds[s]?.edges).has(t),z=s=>Object.keys(e.kinds).some(t=>u(t,s));for(let[s,t]of Object.entries(e.kinds)){let d=`kinds.${s}`;for(let[f,c]of Object.entries(t.edges??{})){if(!De(c)&&c.to!=="*")for(let i of c.to)r.has(i)||o.push(g("edge-target",`${d}.edges.${f}.to`,`"${i}" is not a kind this document declares`));t.fields[f]&&o.push(g("edge-field-clash",`${d}.edges.${f}`,`"${f}" is both a field and a relation of ${s}`,"rename one of them"))}t.lifecycle&&!t.fields[t.lifecycle.field]&&o.push(g("lifecycle-field",`${d}.lifecycle.field`,`${s} has no field "${t.lifecycle.field}"`));let w=f=>t.computed!==void 0&&Object.hasOwn(t.computed,f);for(let f of t.glance??[])!t.fields[f]&&!w(f)&&o.push(g("glance-field",`${d}.glance`,`a glance at ${s} is to say "${f}", and ${s} has no field or computed field called that`,`use one of: ${[...Object.keys(t.fields),...Object.keys(t.computed??{})].join(", ")}`));o.push(...on(s,t));for(let f of["label","describe"]){let c=t[f];if(!c)continue;let i=je(c,`${d}.${f}`,o);for(let A of i??[])if(A.expr){for(let y of oe(A.expr).names)if(!t.fields[y]){if(w(y)){qe(t,y)||o.push(g("template-field",`${d}.${f}`,`${s}'s ${y} is worked out from beyond the record, and a ${f} is said with no graph to read`,`show it in a view instead, or name a computed field worked out from ${s}'s own fields`));continue}o.push(g("template-field",`${d}.${f}`,`${s} has no field "${y}" for its ${f} to show`,f==="label"?"a label can only show the record's own fields and what they work out":void 0))}}}for(let[f,c]of Object.entries(t.fields)){c.default!==void 0&&c.type==="enum"&&!c.options?.includes(String(c.default))&&o.push(g("default-option",`${d}.fields.${f}.default`,`"${String(c.default)}" is not one of ${f}'s options`));let i=`${f}Repeat`;c.repeats&&(t.fields[i]||t.edges?.[i]||t.computed?.[i])&&o.push(g("repeat-clash",`${d}.fields.${f}.repeats`,`${s} already has "${i}", where how ${f} repeats is kept`))}}for(let[s,t]of Object.entries(l)){let d=`acts.${s}`;for(let i of ae(t.on))r.has(i)||o.push(g("act-kind",`${d}.on`,`"${i}" is not a kind this document declares`));let w=ae(t.on),f=rn(t,e);if(t.creates&&t.on===void 0&&t.writes&&r.has(t.creates)){for(let i of t.writes)if(!e.kinds[t.creates].fields[i])if(e.kinds[t.creates].computed?.[i]!==void 0)o.push(g("computed-written",`${d}.writes`,`${t.creates}'s ${i} is worked out, not written: no act can set it`,"write the stored fields it is worked out from"));else{if(u(t.creates,i))continue;o.push(g("act-field",`${d}.writes`,`${t.creates} has no field "${i}"`))}}f.length===0&&o.push(g("act-empty",d,`"${s}" does nothing`,"give it effects or a shorthand such as sets or creates"));let c=new Map;f.forEach((i,A)=>{let y=f.length-(t.effects?.length??0),j=t.effects&&A>=y?`${d}.effects.${A-y}`:d;if("create"in i){if(!r.has(i.create))o.push(g("act-kind",`${j}.create`,`"${i.create}" is not a kind this document declares`));else for(let b of Object.keys(i.set??{}))e.kinds[i.create].fields[b]||(e.kinds[i.create].computed?.[b]!==void 0?o.push(g("computed-written",`${j}.set.${b}`,`${i.create}'s ${b} is worked out, not written: no act can set it`,"set the stored fields it is worked out from")):o.push(g("act-field",`${j}.set.${b}`,`${i.create} has no field "${b}"`)));i.as&&c.set(i.as,i.create)}else if("connect"in i||"sever"in i){let b="connect"in i?i.connect:i.sever;!a.has(b)&&!z(b)&&o.push(g("act-edge",`${j}.${"connect"in i?"connect":"sever"}`,`"${b}" is not a relation any kind declares`)),F(i.from)==="subject"&&w.length===0&&o.push(g("act-subject",`${d}.on`,`"${s}" acts on "$subject" but does not say which kinds it is "on"`))}else if("set"in i){let b=F(i.target??"$subject"),ce=b==="subject"?w:c.has(b??"")?[c.get(b)]:[];b==="subject"&&w.length===0&&o.push(g("act-subject",`${d}.on`,`"${s}" changes "$subject" but does not say which kinds it is "on"`));for(let _ of Object.keys(i.set))for(let m of ce)if(!(!r.has(m)||e.kinds[m].fields[_]))if(e.kinds[m].computed?.[_]!==void 0)o.push(g("computed-written",`${j}.set.${_}`,`${m}'s ${_} is worked out, not written: no act can set it`,"set the stored fields it is worked out from"));else{if(u(m,_))continue;o.push(g("act-field",`${j}.set.${_}`,`${m} has no field "${_}"`))}}else"remove"in i&&F(i.remove)==="subject"&&w.length===0&&o.push(g("act-subject",`${d}.on`,`"${s}" removes "$subject" but does not say which kinds it is "on"`));("set"in i&&i.set?Object.values(i.set):[]).forEach(b=>{b&&typeof b=="object"&&!Array.isArray(b)&&"expr"in b&&ve(b.expr,`${j}.set`,o)})}),t.allowedWhen&&ve(t.allowedWhen,`${d}.allowedWhen`,o),t.refusal&&je(t.refusal,`${d}.refusal`,o)}for(let[s,t]of Object.entries(e.rules??{})){let d=`rules.${s}`;t.over!=="graph"&&!r.has(t.over)&&o.push(g("rule-kind",`${d}.over`,`"${t.over}" is not a kind this document declares`));let w=t.over==="graph"?void 0:e.kinds[t.over];for(let f of["when","require"]){let c=t[f];if(!c)continue;let i=ve(c,`${d}.${f}`,o);if(!i)continue;let A=oe(i);for(let y of A.names)if(t.over==="graph")o.push(g("rule-name",`${d}.${f}`,`"${y}" means nothing in a rule over the whole graph`,`name a kind in "over", or use all('kind')`));else if(w&&!w.fields[y]&&!w.edges?.[y]&&w.computed?.[y]===void 0){let j=Object.keys(w.edges??{}).find(S=>S.includes("-")&&S.split("-").includes(y));o.push(g("rule-name",`${d}.${f}`,`${t.over} has no field or relation called "${y}"`,j?`"${j}" reads as a subtraction in a rule; rename the relation to one camelCase word, like "${j.replace(/-([a-z0-9])/g,(S,b)=>b.toUpperCase())}"`:void 0))}for(let y of A.edges)!a.has(y)&&!z(y)&&o.push(g("rule-edge",`${d}.${f}`,`"${y}" is not a relation any kind declares`));for(let y of A.sweeps)r.has(y)?t.over!=="graph"&&o.push(Te("rule-cost",`${d}.${f}`,`this rule looks at every ${y} for every ${t.over}, which grows slowly as the app grows`,"walk a relation with out()/in() instead of all() where you can")):o.push(g("rule-kind",`${d}.${f}`,`"${y}" is not a kind this document declares`))}t.says&&je(t.says,`${d}.says`,o),(t.repairs??[]).forEach((f,c)=>{!l[f.act]&&!me(f.act)&&o.push(g("repair-act",`${d}.repairs.${c}.act`,`"${f.act}" is not an act this document declares`))})}let $=e.policy;return $&&($.grants.forEach((s,t)=>{if(s.roles!=="*"&&p.size>0)for(let d of s.roles)p.has(d)||o.push(g("grant-role",`policy.grants.${t}.roles`,`"${d}" is not one of the document's roles`));if(s.mutations!=="*")for(let d of s.mutations)!l[d]&&!me(d)&&o.push(g("grant-act",`policy.grants.${t}.mutations`,`"${d}" is not an act this document declares`))}),($.sees??[]).forEach((s,t)=>{for(let d of s.kinds)r.has(d)||o.push(g("sight-kind",`policy.sees.${t}.kinds`,`"${d}" is not a kind this document declares`));if(s.roles!=="*"&&p.size>0)for(let d of s.roles)p.has(d)||o.push(g("sight-role",`policy.sees.${t}.roles`,`"${d}" is not one of the document's roles`))})),o.push(...Ie(e)),o}function Rn(e,o,r,a){let l=new Map,p=ae(e.on),u=new Map,z=new Map;(p.length>0||o.some(c=>"remove"in c&&F(c.remove)==="subject"||"from"in c&&(F(c.from)==="subject"||F(c.to)==="subject")||"set"in c&&!("create"in c)&&F(c.target??"$subject")==="subject"))&&l.set(ue,{ref:p.length>0?p:"*",required:!0});let s=e.args??{},t=e.writes?.length===1,d=(c,i)=>i&&c.type===i.type&&c.min===void 0&&c.max===void 0&&c.step===void 0?{...c,...i.min===void 0?{}:{min:i.min},...i.max===void 0?{}:{max:i.max},...i.step===void 0?{}:{step:i.step}}:c,w=(c,i)=>i&&c.type===i.type&&c.format===void 0&&c.unit===void 0?{...d(c,i),...i.format?{format:i.format}:{},...i.unit?{unit:i.unit}:{}}:d(c,i),f=(c,i,A)=>{if(c===ue||An.has(c)||u.has(c)||l.has(c))return;let y=s[c]?w(s[c],A):void 0;l.set(c,y?{field:y,optional:!y.required,required:!!y.required}:i())};for(let c of o)if("create"in c){let i=r.kinds[c.create];for(let[A,y]of Object.entries(c.set??{})){let j=F(y),S=i?.fields[A];if(j&&S){let b=!!S.required&&S.default===void 0;f(j,()=>({field:S,optional:!b,required:b}),S)}}c.as&&u.set(c.as,c.create)}else if("connect"in c||"sever"in c){let i=a.get("connect"in c?c.connect:c.sever);for(let[A,y]of[["from",c.from],["to",c.to]]){let j=F(y);if(!j)continue;let S=A==="to"?i?.to??"*":i?.from??"*";S!=="*"&&!z.has(j)&&z.set(j,S),f(j,()=>({ref:S,required:!0}))}}else if("set"in c){let i=F(c.target??"$subject"),A=i==="subject"?p[0]:u.get(i??"")??z.get(i??"")?.[0];i&&i!=="subject"&&!u.has(i)&&f(i,()=>({ref:"*",required:!0}));for(let[y,j]of Object.entries(c.set)){let S=F(j);if(!S)continue;let b=A?r.kinds[A]?.fields[y]:void 0;f(S,()=>b?{field:b,optional:!t,required:t}:{any:!0,required:!1},b)}}else if("remove"in c){let i=F(c.remove);i&&f(i,()=>({ref:"*",required:!0}))}for(let[c,i]of Object.entries(s))l.has(c)||l.set(c,{field:i,optional:!i.required,required:!!i.required});return l}function pt(e,o={}){let r=Fn(e);if(!r.document||fe(r.findings))return{ok:!1,findings:r.findings};let a=r.document,l=[...r.findings];o.previous&&l.push(...Mn(a,o.previous));let p=Tn(a,l);return fe(p.findings)?{ok:!1,findings:p.findings}:Ce(p,o)}function ie(e,o){return e.map(r=>{let a=!r.format&&r.expr?.t==="ident"?o?.[r.expr.name]?.format:void 0;return a==="money"||a==="percent"?{...r,format:a}:r})}function Tn(e,o){let r=sn(e),a={};for(let[s,t]of Object.entries(e.kinds)){let d=Pe(t),w=t.label??(d?`{${d}}`:void 0),f=ee(t),c=f?tn(e,s,[...f]):[];a[s]={...w?{label:ie(Y(w),t.fields)}:{},...t.describe?{describe:ie(Y(t.describe),t.fields)}:{},...f?{computed:[...f]}:{},...c.length>0?{durations:c}:{}}}let l={};for(let[s,t]of Object.entries(e.acts??{})){let d=rn(t,e),w=Rn(t,d,e,r),f=t.destructive??d.some(m=>"remove"in m||"sever"in m||"replace"in m),c=[...new Set(d.flatMap(m=>"create"in m?[m.create]:[]))],i=[...new Set(d.flatMap(m=>"connect"in m?[m.connect]:[]))],A=[...new Set(d.flatMap(m=>"sever"in m?[m.sever]:"replace"in m?m.replace:[]))],y=[...new Set(d.flatMap(m=>"set"in m&&!("create"in m)&&F(m.target??"$subject")==="subject"?Object.keys(m.set):[]))],j=new Map;for(let m of d){if(!("connect"in m)&&!("sever"in m))continue;let O=r.get("connect"in m?m.connect:m.sever);for(let[M,an]of[["from",m.from],["to",m.to]]){let te=F(an),de=M==="to"?O?.to:O?.from;te&&te!=="subject"&&de&&de!=="*"&&j.set(te,[...new Set([...j.get(te)??[],...de])])}}let S={};for(let m of d){if(!("set"in m)||"create"in m)continue;let O=F(m.target??"$subject");for(let M of O&&O!=="subject"&&j.get(O)||[])S[M]=[...new Set([...S[M]??[],...Object.keys(m.set)])]}let b={};for(let m of d)if(!(!("set"in m)||"create"in m||F(m.target??"$subject")!=="subject"))for(let[O,M]of Object.entries(m.set??{}))typeof M=="string"&&F(M)===void 0||typeof M=="number"||typeof M=="boolean"?b[O]=typeof M=="string"&&M.startsWith("$$")?M.slice(1):M:delete b[O];let ce=c.length===0&&d.every(m=>!("set"in m)||!m.set||Object.values(m.set).every(O=>!(O&&typeof O=="object"&&!Array.isArray(O)&&"expr"in O))),_=new Map;for(let m of d)if(!(!("set"in m)||!m.set))for(let O of Object.values(m.set))O&&typeof O=="object"&&!Array.isArray(O)&&"expr"in O&&_.set(O.expr,Z(O.expr));l[s]={title:t.title??s.replace(/-/g," "),effects:d,args:[...w],...t.allowedWhen?{guard:Z(t.allowedWhen)}:{},...t.refusal?{refusal:ie(Y(t.refusal),e.kinds[[t.on??[]].flat()[0]??""]?.fields)}:{},exprs:[..._],destructive:f,idempotent:ce,creates:c,connects:i,severs:A,writes:y,writesOther:S,sets:b}}let p={};for(let[s,t]of Object.entries(e.rules??{}))p[s]={title:t.title??s.replace(/-/g," "),require:Z(t.require),...t.when?{when:Z(t.when)}:{},...t.says?{says:ie(Y(t.says),e.kinds[t.over]?.fields)}:{}};let u=Me(e,o),z=Ne(e),$=_e(e);return{format:Ke,document:e,findings:o,kinds:a,...e.computed?{facts:[...ee(e)??[]]}:{},edges:[...r].map(([s,{from:t,to:d,cardinality:w}])=>[s,{from:t,to:d,cardinality:w}]),acts:l,rules:p,brand:u,...Object.keys(z).length>0?{viewSpecs:z}:{},...$?{home:$}:{}}}function ft(e,o,r){let a=/^defineNode\("([^"]+)"\)/.exec(o)?.[1],l=a?r.kinds[a]:void 0;if(!a||!l)return e;let p=Object.keys(l.fields).filter(u=>u!=="label").slice(0,3);return{...e,path:`kinds.${a}.glance`,fix:`Say which: "glance": [${p.map(u=>`"${u}"`).join(", ")}] on kinds.${a} \u2014 the facts a person compares one by, at a glance.`}}function Mn(e,o){let r=[],a=new Set(Object.values(o.kinds).flatMap(l=>Object.keys(l.edges??{})));for(let[l,p]of Object.entries(e.kinds)){let u=p.renamedFrom;u&&!o.kinds[u]&&r.push(g("renamed-from-nothing",`kinds.${l}.renamedFrom`,`${l} says it was ${u}, and the previous version has no kind called ${u}`,"name the kind it was, or drop renamedFrom"));let z=o.kinds[u??l];for(let[$,s]of Object.entries(p.fields)){let t=s.renamedFrom;t&&!z?.fields[t]&&r.push(g("renamed-from-nothing",`kinds.${l}.fields.${$}.renamedFrom`,`${$} says it was ${t}, and the previous ${u??l} has no field called ${t}`,"name the field it was, or drop renamedFrom"))}for(let[$,s]of Object.entries(p.edges??{})){let t=s.renamedFrom;t&&!a.has(t)&&r.push(g("renamed-from-nothing",`kinds.${l}.edges.${$}.renamedFrom`,`${$} says it was ${t}, and the previous version has no relation called ${t}`,"name the relation it was, or drop renamedFrom"))}}return r}export{Fn as a,lt as b,rn as c,pt as d,ft as e};
@@ -0,0 +1,9 @@
1
+ import"./chunk.L4DECHXR.js";import{R as T}from"./chunk.GFF2FB2J.js";import"./chunk.6V2RG5JG.js";import{b as A}from"./chunk.AJZBJBMO.js";var F=/^ {0,3}(`{3,}|~{3,})[ \t]*([^`\s]*)/,D=/^ {0,3}(#{1,6})(?:[ \t]+|$)/,R=/^ {0,3}(?:(?:-[ \t]*){3,}|(?:\*[ \t]*){3,}|(?:_[ \t]*){3,})$/,v=/^ {0,3}>[ \t]?/,_=/^([ \t]*)([-*+]|(\d{1,9})[.)])(?:[ \t]+|$)/,K=/^\|?\s*:?-+:?\s*(?:\|\s*:?-+:?\s*)+\|?$|^\|\s*:?-+:?\s*\|$/,w=/^[ \t]*$/;function O(t){let n=F.exec(t);if(!(!n||n[1][0]==="`"&&t.indexOf("`",n[0].length)>=0))return{mark:n[1],lang:n[2]}}function U(t,n){let r=t.trim().slice(n).trim(),e=r.length;for(;e>0&&r[e-1]==="#";)e--;return(e===0||r[e-1]===" "||r[e-1]===" ")&&(r=r.slice(0,e).trim()),r}var $=t=>O(t)!==void 0||D.test(t)||R.test(t)||v.test(t)||_.test(t),b=t=>[...t].reduce((n,r)=>r===" "?n+4-n%4:n+1,0);function E(t){let n=t.trim().replace(/^\|/,"").replace(/(?<!\\)\|$/,""),r=[],e="",l=!1;for(let c=0;c<n.length;c++){let h=n[c];h==="\\"&&n[c+1]==="|"?(e+="|",c++):h==="`"?(l=!l,e+=h):h==="|"&&!l?(r.push(e.trim()),e=""):e+=h}return r.push(e.trim()),r}function W(t){return B(t.replace(/\r\n?/g,`
2
+ `).replace(/\0/g,"\uFFFD").split(`
3
+ `),0)}function B(t,n){let r=[],e=0;for(;e<t.length;){let l=t[e];if(w.test(l)){e++;continue}let c=O(l);if(c){let o=new RegExp(`^ {0,3}${c.mark[0]==="`"?"`":"~"}{${c.mark.length},}[ \\t]*$`),a=[];for(e++;e<t.length&&!o.test(t[e]);)a.push(t[e++]);e++,r.push({t:"code",text:a.join(`
4
+ `),...c.lang?{lang:c.lang}:{}});continue}let h=D.exec(l);if(h){r.push({t:"heading",level:h[1].length,children:k(U(l,h[1].length),0)}),e++;continue}if(R.test(l)){r.push({t:"rule"}),e++;continue}if(v.test(l)){let o=[];for(;e<t.length&&(v.test(t[e])||o.length>0&&!w.test(t[e])&&!$(t[e])&&!w.test(o[o.length-1]));)o.push(t[e++].replace(v,""));r.push(n<8?{t:"quote",blocks:B(o,n+1)}:{t:"p",children:k(o.join(`
5
+ `),0)});continue}let s=_.exec(l);if(s){let o=s[3]!==void 0,a=b(s[1]),f=[];for(;e<t.length;){let u=_.exec(t[e]);if(!u||b(u[1])>a+1||b(u[1])<a||u[3]!==void 0!==o)break;let y=b(u[0]),p=[t[e].slice(u[0].length)];for(e++;e<t.length;){let S=t[e];if(w.test(S)){let x=e;for(;x<t.length&&w.test(t[x]);)x++;if(x<t.length&&b(/^[ \t]*/.exec(t[x])[0])>=Math.min(y,a+2)){for(;e<x;e++)p.push("");continue}break}let P=b(/^[ \t]*/.exec(S)[0]);if(P>=Math.min(y,a+2))p.push(" ".repeat(Math.max(0,P-y))+S.replace(/^[ \t]*/,""));else if(!$(S)&&!w.test(p[p.length-1]))p.push(S.trim());else break;e++}let M=/^\[([ xX])\][ \t]+/.exec(p[0]);M&&(p[0]=`${M[1]===" "?"\u2610":"\u2611"} ${p[0].slice(M[0].length)}`),f.push(n<8?B(p,n+1):[{t:"p",children:k(p.join(`
6
+ `),0)}])}r.push({t:"list",ordered:o,start:o?Math.min(Number(s[3]),999999999):1,items:f});continue}let i=t[e+1];if(l.includes("|")&&i!==void 0&&K.test(i.trim())){let o=E(l),a=E(i).map(u=>/^:-+:$/.test(u)?"center":/-:$/.test(u)?"right":/^:-/.test(u)?"left":void 0),f=[];for(e+=2;e<t.length&&!w.test(t[e])&&t[e].includes("|")&&!$(t[e]);){let u=E(t[e++]);f.push(o.map((y,p)=>k(u[p]??"",0)))}r.push({t:"table",align:o.map((u,y)=>a[y]),head:o.map(u=>k(u,0)),rows:f});continue}let d=[];for(;e<t.length&&!w.test(t[e])&&(d.length===0||!$(t[e]));)d.push(t[e++].trim());r.push({t:"p",children:k(d.join(`
7
+ `),0)})}return r}function I(t){let n=t.trim().replace(/^<|>$/g,"");if(!/[\u0000- \u007f-\u009f]/.test(n))return/^(?:https?:\/\/[^/?#]|mailto:[^@\s]+@)/i.test(n)?n:void 0}var X={amp:"&",lt:"<",gt:">",quot:'"',apos:"'",nbsp:"\xA0",copy:"\xA9",reg:"\xAE",trade:"\u2122",mdash:"\u2014",ndash:"\u2013",hellip:"\u2026",rarr:"\u2192",larr:"\u2190",times:"\xD7",middot:"\xB7",lsquo:"\u2018",rsquo:"\u2019",ldquo:"\u201C",rdquo:"\u201D",bull:"\u2022",deg:"\xB0"};function z(t){if(t[0]==="#"){let n=t[1]==="x"||t[1]==="X"?parseInt(t.slice(2),16):parseInt(t.slice(1),10);return Number.isFinite(n)&&n>31&&n<=1114111&&!(n>=55296&&n<=57343)&&!(n>=127&&n<=159)?String.fromCodePoint(n):void 0}return X[t]}var G=/[\\`*_{}[\]()#+\-.!>|~<&"']/,L=/(?:https?:\/\/|mailto:)[^\s<>"'`]{1,2000}/iy,q=/<((?:https?:\/\/|mailto:)[^\s<>]{1,2000})>/iy;function k(t,n){let r=[],e="",l=()=>{e&&r.push({t:"text",text:e}),e=""},c=new Map,h=(i,d)=>{if((c.get(i)??1/0)<=d)return-1;let o=i[0]==="`",a=d;for(;;){if(a=t.indexOf(i,a),a<0)return c.set(i,Math.min(c.get(i)??1/0,d)),-1;let f=t[a-1],u=t[a+i.length];if((!o||f!=="`"&&u!=="`")&&(o||f!==void 0&&!/\s/.test(f)&&(i.length>1||u!==i&&f!==i)&&!(i==="_"&&u!==void 0&&/\w/.test(u))))return a;a+=o?1:i.length}},s=0;for(;s<t.length;){let i=t[s];if(i==="\\"&&s+1<t.length&&G.test(t[s+1])){e+=t[s+1],s+=2;continue}if(i==="\\"&&t[s+1]===`
8
+ `){l(),r.push({t:"br"}),s+=2;continue}if(i===`
9
+ `){l(),r.push({t:"br"}),s++;continue}if(i==="&"){let d=/^&(#[0-9]{1,7}|#[xX][0-9a-fA-F]{1,6}|[A-Za-z]{2,8});/.exec(t.slice(s,s+12)),o=d?z(d[1]):void 0;if(d&&o!==void 0){e+=o,s+=d[0].length;continue}}if(i==="`"){let d=/^`+/.exec(t.slice(s,s+32))[0],o=h(d,s+d.length);if(o>=0&&t[o+d.length]!=="`"){l();let a=t.slice(s+d.length,o).replace(/\n/g," ");r.push({t:"code",text:/^ .* $/.test(a)&&a.trim()?a.slice(1,-1):a}),s=o+d.length;continue}e+=d,s+=d.length;continue}if(i==="<"){q.lastIndex=s;let d=q.exec(t),o=d?I(d[1]):void 0;if(d&&o){l(),r.push({t:"link",href:o,children:[{t:"text",text:d[1]}]}),s+=d[0].length;continue}}if((i==="h"||i==="H"||i==="m"||i==="M")&&(s===0||/[\s(*_~]/.test(t[s-1]))){L.lastIndex=s;let d=L.exec(t);if(d){let o=d[0].replace(/[.,:;!?*_~]+$/,"");for(;o.endsWith(")")&&o.split("(").length<o.split(")").length;)o=o.slice(0,-1).replace(/[.,:;!?]+$/,"");let a=I(o);if(a&&o.length>8){l(),r.push({t:"link",href:a,children:[{t:"text",text:o}]}),s+=o.length;continue}}}if(i==="["||i==="!"&&t[s+1]==="["){let d=i==="!"?s+1:s,o=Q(t,d);if(o){l();let a=I(o.address),f=n<8?k(o.words,n+1):[{t:"text",text:o.words}];a?r.push({t:"link",href:a,children:f.length>0?f:[{t:"text",text:o.address}]}):r.push(...f),s=o.end;continue}}if(i==="*"||i==="_"||i==="~"){let d=t[s+1]===i;if(i==="~"&&!d){e+=i,s++;continue}let o=d?i+i:i,a=t[s+o.length],f=t[s-1],y=a!==void 0&&!/\s/.test(a)&&!(i==="_"&&f!==void 0&&/\w/.test(f))&&n<8?h(o,s+o.length+1):-1;if(y>=0){l();let p=k(t.slice(s+o.length,y),n+1);r.push({t:i==="~"?"del":d?"strong":"em",children:p}),s=y+o.length;continue}e+=o,s+=o.length;continue}e+=i,s++}return l(),r}function Q(t,n){let r=0,e=n,l=Math.min(t.length,n+1e3);for(;e<l;e++){let h=t[e];if(h==="\\")e++;else if(h==="[")r++;else if(h==="]"&&--r===0)break}if(r!==0||t[e+1]!=="(")return;let c=/^\(\s*(<[^<>\n]*>|[^\s()]*(?:\([^\s()]*\)[^\s()]*)*)(?:\s+(?:"[^"\n]*"|'[^'\n]*'))?\s*\)/.exec(t.slice(e+1,e+2049));if(c)return{words:t.slice(n+1,e),address:c[1].replace(/^<|>$/g,""),end:e+1+c[0].length}}var N=(t,n=3)=>Math.min(6,t+n-1);var g=A(T(),1),Y={display:"grid",gap:"0.7em",minWidth:0,overflowWrap:"anywhere"},Z={margin:0},H={margin:0,paddingInlineStart:"1.6em",display:"grid",gap:"0.3em"},J={display:"grid",gap:"0.3em",minWidth:0},V={margin:"0.4em 0 0",fontSize:"1em",fontWeight:650,lineHeight:1.35,color:"var(--graview-ink)"},ee={fontSize:"0.9em",background:"var(--graview-panel-muted)",borderRadius:4,padding:"0.1em 0.3em"},te={margin:0,padding:"0.7em 0.9em",overflowX:"auto",maxWidth:"100%",background:"var(--graview-panel-muted)",borderRadius:"var(--graview-radius-sm, 8px)",fontSize:"0.875em",lineHeight:1.5,whiteSpace:"pre",overflowWrap:"normal"},ne={margin:0,paddingInlineStart:"0.9em",borderInlineStart:"3px solid var(--graview-edge)",color:"var(--graview-ink-muted)",display:"grid",gap:"0.6em"},re={border:0,borderTop:"1px solid var(--graview-edge)",margin:"0.3em 0",width:"100%"},oe={overflowX:"auto",maxWidth:"100%"},ie={borderCollapse:"collapse",fontSize:"0.9375em",minWidth:"50%"},j={padding:"0.35em 0.7em",borderBottom:"1px solid var(--graview-edge)",textAlign:"start",verticalAlign:"top",overflowWrap:"normal"},se={color:"var(--graview-accent)",paddingBlock:"0.2em"};function m(t,n){return t.map((r,e)=>{switch(r.t){case"text":return r.text;case"br":return(0,g.jsx)("br",{},e);case"code":return(0,g.jsx)("code",{style:ee,children:r.text},e);case"strong":return(0,g.jsx)("strong",{children:m(r.children,n)},e);case"em":return(0,g.jsx)("em",{children:m(r.children,n)},e);case"del":return(0,g.jsx)("del",{children:m(r.children,n)},e);case"link":{let l=n==="_blank"&&!/^mailto:/i.test(r.href);return(0,g.jsx)("a",{href:r.href,rel:"noopener noreferrer nofollow",...l?{target:"_blank"}:{},style:se,onClick:c=>c.stopPropagation(),children:m(r.children,n)},e)}}})}function C(t,n,r){return t.map((e,l)=>{switch(e.t){case"heading":{let c=`h${N(e.level,n)}`;return(0,g.jsx)(c,{style:V,children:m(e.children,r)},l)}case"p":return(0,g.jsx)("p",{style:Z,children:m(e.children,r)},l);case"list":{let c=e.items.map((h,s)=>{let i=h[0]?.t==="p"?h[0].children[0]:void 0,d=i?.t==="text"&&/^[☐☑] /.test(i.text);return(0,g.jsx)("li",{style:{display:"list-item",minWidth:0,...d?{listStyle:"none"}:{}},children:h.length===1&&h[0].t==="p"?m(h[0].children,r):(0,g.jsx)("div",{style:J,children:C(h,n,r)})},s)});return e.ordered?(0,g.jsx)("ol",{start:e.start,style:{...H,listStyle:"decimal"},children:c},l):(0,g.jsx)("ul",{style:{...H,listStyle:"disc"},children:c},l)}case"quote":return(0,g.jsx)("blockquote",{style:ne,children:C(e.blocks,n,r)},l);case"code":return(0,g.jsx)("pre",{style:te,tabIndex:0,children:(0,g.jsx)("code",{children:e.text})},l);case"rule":return(0,g.jsx)("hr",{style:re},l);case"table":return(0,g.jsx)("div",{style:oe,"data-graview-md-table":"",children:(0,g.jsxs)("table",{style:ie,children:[(0,g.jsx)("thead",{children:(0,g.jsx)("tr",{children:e.head.map((c,h)=>(0,g.jsx)("th",{style:{...j,fontWeight:600,...e.align[h]?{textAlign:e.align[h]}:{}},children:m(c,r)},h))})}),(0,g.jsx)("tbody",{children:e.rows.map((c,h)=>(0,g.jsx)("tr",{children:c.map((s,i)=>(0,g.jsx)("td",{style:{...j,...e.align[i]?{textAlign:e.align[i]}:{}},children:m(s,r)},i))},h))})]})},l)}})}function le({text:t,className:n,style:r,headingsFrom:e=3,target:l="_blank"}){return(0,g.jsx)("div",{"data-graview-text-body":"","data-graview-markdown":"",...n?{className:n}:{},style:{...Y,...r},children:C(W(t),e,l)})}export{le as default};