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.
- package/dist/preview/chunk.26CZTUY4.js +1 -0
- package/dist/preview/chunk.2CIBWZJG.js +1 -0
- package/dist/preview/chunk.2EXGG6BB.js +1 -0
- package/dist/preview/chunk.2NBYNZRD.js +1 -0
- package/dist/preview/chunk.2XAONC66.js +1 -0
- package/dist/preview/chunk.34ZMMURV.js +27 -0
- package/dist/preview/chunk.3ADPAGPY.js +28 -0
- package/dist/preview/chunk.3JGGBLRB.js +1 -0
- package/dist/preview/chunk.3JNMSOFG.js +1 -0
- package/dist/preview/chunk.3R4W2P5X.js +1 -0
- package/dist/preview/chunk.3SKKIHU3.js +4 -0
- package/dist/preview/{chunk.5BGA2VUS.js → chunk.3URFMWXZ.js} +4 -4
- package/dist/preview/chunk.3VL5WECB.js +1 -0
- package/dist/preview/chunk.42YX6NOY.js +2 -0
- package/dist/preview/chunk.4ALKPNXM.js +1 -0
- package/dist/preview/chunk.4HP7UWA2.js +1 -0
- package/dist/preview/chunk.4SJUTBDV.js +1 -0
- package/dist/preview/chunk.5U5J3ISK.js +1 -0
- package/dist/preview/chunk.6T2Q6NLO.js +1 -0
- package/dist/preview/chunk.6V2RG5JG.js +5 -0
- package/dist/preview/chunk.6XMEU2Q2.js +1 -0
- package/dist/preview/chunk.7BWT5L2L.js +1 -0
- package/dist/preview/chunk.AK3IHFCF.js +1 -0
- package/dist/preview/chunk.BPWNWE7N.js +1 -0
- package/dist/preview/chunk.C5CYZNSJ.js +1 -0
- package/dist/preview/chunk.CM6LOIQE.js +88 -0
- package/dist/preview/chunk.D3IECJ2S.js +17 -0
- package/dist/preview/chunk.DT7LHWU2.js +1 -0
- package/dist/preview/chunk.DZRTOURR.js +1 -0
- package/dist/preview/chunk.ERXSYPYL.js +84 -0
- package/dist/preview/chunk.EYZ7MHBZ.js +0 -0
- package/dist/preview/chunk.FDELO7NY.js +116 -0
- package/dist/preview/chunk.FGVKJWNS.js +6 -0
- package/dist/preview/chunk.FWCOJDOD.js +1 -0
- package/dist/preview/chunk.GFF2FB2J.js +25 -0
- package/dist/preview/chunk.GLBHQFJ2.js +1 -0
- package/dist/preview/chunk.HHI65WFZ.js +3 -0
- package/dist/preview/chunk.HHPGWJDO.js +2 -0
- package/dist/preview/chunk.HJCQ6I3S.js +1 -0
- package/dist/preview/chunk.HSCTWAUV.js +1 -0
- package/dist/preview/chunk.INZUEWC5.js +1 -0
- package/dist/preview/chunk.J2ITFGN3.js +1 -0
- package/dist/preview/chunk.JH6MU6TX.js +2 -0
- package/dist/preview/chunk.JISMMIMX.js +1 -0
- package/dist/preview/chunk.JN7DIFR3.js +1 -0
- package/dist/preview/chunk.JPHNKWTY.js +1 -0
- package/dist/preview/chunk.JTNWD2CN.js +1 -0
- package/dist/preview/chunk.K75FUIZI.js +1 -0
- package/dist/preview/chunk.K776HO42.js +2 -0
- package/dist/preview/chunk.KN3ULTGF.js +1 -0
- package/dist/preview/chunk.KOB6N3SL.js +1 -0
- package/dist/preview/chunk.KQT7WAQE.js +1 -0
- package/dist/preview/chunk.L4DECHXR.js +327 -0
- package/dist/preview/chunk.L6OMEYL6.js +10 -0
- package/dist/preview/chunk.LQ7V6KEE.js +1 -0
- package/dist/preview/chunk.MB7LKKUD.js +1 -0
- package/dist/preview/chunk.MD74YVRN.js +3 -0
- package/dist/preview/chunk.MGNP4LAM.js +1 -0
- package/dist/preview/chunk.NCTOBUCT.js +1 -0
- package/dist/preview/chunk.NDADLJE6.js +1 -0
- package/dist/preview/chunk.NO52VON3.js +1 -0
- package/dist/preview/chunk.O2LK2AO7.js +1 -0
- package/dist/preview/chunk.OAF7TUMI.js +1 -0
- package/dist/preview/chunk.OQ4KFN6W.js +1 -0
- package/dist/preview/chunk.OQDETV4X.js +1 -0
- package/dist/preview/chunk.OXQMNIRO.js +1 -0
- package/dist/preview/chunk.OZNW5W4Z.js +1 -0
- package/dist/preview/chunk.PAVR5TK5.js +1 -0
- package/dist/preview/chunk.PKK6FRZR.js +2 -0
- package/dist/preview/chunk.Q5WEOX3Q.js +1 -0
- package/dist/preview/chunk.QIAKO27D.js +1 -0
- package/dist/preview/chunk.QNGWEV47.js +1 -0
- package/dist/preview/{chunk.EYF6ONTA.js → chunk.QTA4ROAK.js} +1 -1
- package/dist/preview/chunk.QTMWHE5O.js +1 -0
- package/dist/preview/chunk.R26DREVU.js +1 -0
- package/dist/preview/chunk.RI3PYG5T.js +19 -0
- package/dist/preview/chunk.RIEHYQLK.js +1101 -0
- package/dist/preview/chunk.RRVIXV7W.js +1 -0
- package/dist/preview/chunk.RYT5U3QM.js +1 -0
- package/dist/preview/chunk.SE5SKFQH.js +1 -0
- package/dist/preview/chunk.SHPXD6FC.js +1 -0
- package/dist/preview/chunk.SOBC3CTN.js +47 -0
- package/dist/preview/chunk.SOD3PBJM.js +1 -0
- package/dist/preview/chunk.T3VPD7JQ.js +1 -0
- package/dist/preview/chunk.TI4OSTQV.js +1 -0
- package/dist/preview/chunk.UDSEJKCY.js +1 -0
- package/dist/preview/chunk.UGFDSE37.js +1 -0
- package/dist/preview/chunk.UT6642FC.js +1 -0
- package/dist/preview/chunk.UWGWXFWZ.js +1 -0
- package/dist/preview/{chunk.IKT7JQUW.js → chunk.UZWWDAGM.js} +1 -1
- package/dist/preview/chunk.V5ZYUVMH.js +1 -0
- package/dist/preview/chunk.V7BDAGDE.js +35 -0
- package/dist/preview/chunk.VG56IUIQ.js +9 -0
- package/dist/preview/chunk.VOAZBHCG.js +1 -0
- package/dist/preview/chunk.VS7K3SCD.js +9 -0
- package/dist/preview/chunk.VSZQXB4Q.js +3 -0
- package/dist/preview/chunk.W3S6UXNA.js +1 -0
- package/dist/preview/chunk.WAFDCOOG.js +3 -0
- package/dist/preview/chunk.WYTIOLPP.js +1 -0
- package/dist/preview/chunk.X37L5TN5.js +1 -0
- package/dist/preview/chunk.XDYAG276.js +1 -0
- package/dist/preview/chunk.XRJBLH4N.js +1 -0
- package/dist/preview/chunk.XS7YFNDU.js +1 -0
- package/dist/preview/chunk.XSTXV6FP.js +6 -0
- package/dist/preview/chunk.Y4UXEL6Y.js +1 -0
- package/dist/preview/chunk.YJUB4OD7.js +1 -0
- package/dist/preview/chunk.YLQB3KBA.js +1 -0
- package/dist/preview/chunk.YNQDVGZM.js +1 -0
- package/dist/preview/chunk.YV2LJFGS.js +1 -0
- package/dist/preview/chunk.Z2YUYZT4.js +1 -0
- package/dist/preview/chunk.ZYKAS4BT.js +1 -0
- package/dist/preview/page.js +6 -6
- package/package.json +6 -6
- package/dist/preview/chunk.22H4JXTH.js +0 -8
- package/dist/preview/chunk.25OYH6MY.js +0 -1
- package/dist/preview/chunk.2GBQJXJH.js +0 -19
- package/dist/preview/chunk.2VUG6EAN.js +0 -1
- package/dist/preview/chunk.337WDTG3.js +0 -2
- package/dist/preview/chunk.3HLLQ5CJ.js +0 -1
- package/dist/preview/chunk.46KUPBQC.js +0 -1
- package/dist/preview/chunk.4H7CQE56.js +0 -1
- package/dist/preview/chunk.4HGBVU5B.js +0 -1
- package/dist/preview/chunk.4RO5DA22.js +0 -1
- package/dist/preview/chunk.4TUNX4WM.js +0 -29
- package/dist/preview/chunk.6LJ66MB7.js +0 -1
- package/dist/preview/chunk.6R4EI47C.js +0 -1
- package/dist/preview/chunk.7S22MBNN.js +0 -1
- package/dist/preview/chunk.A73BXXE4.js +0 -3
- package/dist/preview/chunk.AHDOKM4O.js +0 -1
- package/dist/preview/chunk.ARE3MEDN.js +0 -1
- package/dist/preview/chunk.ASFZTYFO.js +0 -1
- package/dist/preview/chunk.BBJZ6O7J.js +0 -1
- package/dist/preview/chunk.BCBH6WJF.js +0 -1
- package/dist/preview/chunk.CAZAB352.js +0 -1
- package/dist/preview/chunk.CY7MDLRS.js +0 -1
- package/dist/preview/chunk.DAVRLRGB.js +0 -1
- package/dist/preview/chunk.DCIC3YHX.js +0 -1
- package/dist/preview/chunk.EW4JFOJY.js +0 -1
- package/dist/preview/chunk.FP27W5MU.js +0 -1
- package/dist/preview/chunk.G2OOBROL.js +0 -1040
- package/dist/preview/chunk.GCKSQ52O.js +0 -1
- package/dist/preview/chunk.GE5EAN36.js +0 -2
- package/dist/preview/chunk.HOPIZMJR.js +0 -2
- package/dist/preview/chunk.IBGO4BUF.js +0 -1
- package/dist/preview/chunk.IDI2BQ7Y.js +0 -9
- package/dist/preview/chunk.IH42QTOM.js +0 -1
- package/dist/preview/chunk.ISRS7GOT.js +0 -321
- package/dist/preview/chunk.J6CBMLGR.js +0 -1
- package/dist/preview/chunk.JRCV6HVV.js +0 -1
- package/dist/preview/chunk.KWW3YHQ4.js +0 -23
- package/dist/preview/chunk.MKNXV4TM.js +0 -8
- package/dist/preview/chunk.MRK6QJV5.js +0 -25
- package/dist/preview/chunk.MVNIKZIC.js +0 -1
- package/dist/preview/chunk.N2WTNKEV.js +0 -1
- package/dist/preview/chunk.N7HCALRK.js +0 -61
- package/dist/preview/chunk.NRRUGG22.js +0 -1
- package/dist/preview/chunk.OGL4PHTY.js +0 -1
- package/dist/preview/chunk.ONDILMIX.js +0 -1
- package/dist/preview/chunk.PFQFPJ5L.js +0 -16
- package/dist/preview/chunk.PN2H6X7O.js +0 -1
- package/dist/preview/chunk.PWHJHFC4.js +0 -1
- package/dist/preview/chunk.Q3HVA6L4.js +0 -1
- package/dist/preview/chunk.RZLNDVGN.js +0 -107
- package/dist/preview/chunk.SBHVVJY7.js +0 -1
- package/dist/preview/chunk.SNBIZ3B6.js +0 -1
- package/dist/preview/chunk.TBG2QBOS.js +0 -1
- package/dist/preview/chunk.VR735ZQL.js +0 -1
- package/dist/preview/chunk.VSXCXPK2.js +0 -1
- package/dist/preview/chunk.W3LDQ6B2.js +0 -1
- package/dist/preview/chunk.WCNONCTL.js +0 -6
- package/dist/preview/chunk.WHTNSETN.js +0 -1
- package/dist/preview/chunk.XG67BWH6.js +0 -1
- package/dist/preview/chunk.XRM6WXPW.js +0 -1
- package/dist/preview/chunk.Y5LPZLDE.js +0 -1
- package/dist/preview/chunk.YETBY2LM.js +0 -1
- package/dist/preview/chunk.YSYT3ASK.js +0 -1
- package/dist/preview/chunk.ZEUBAAVQ.js +0 -1
- package/dist/preview/chunk.ZJDRD6PO.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as x,b as k,c as b,d as E,e as V}from"./chunk.GE5EAN36.js";import{g as d}from"./chunk.337WDTG3.js";var S=["card","row","page"],O=["good","warn","bad","neutral","accent"],M=["money","percent","date","relative","count"],R=4,w=40,A=["number","money","percent"],N=["card","row"],F=100,$={title:[],headline:[],list:["sort","limit","group","empty","as"],text:["tone"],badge:["tone"],field:["as","currency","label"],image:["as","label"],progress:["label"],group:["direction"],when:["show"],divider:[],figure:["as","currency","label"]},W=Object.keys($),T=`{"title": "{name}"}, {"headline": "{count(all('offer'))} offers"}, {"figure": expr, "as"?: "number"|"money"|"percent", "currency"?, "label"?}, {"list": expr, "sort"?, "limit"?, "group"?, "empty"?, "as"?: "card"|"row"}, {"text": "\u2026", "tone"?}, {"badge": "{status}", "tone"?}, {"field": "quote", "as"?, "currency"?, "label"?}, {"image": "photos", "as"?: "thumb"|"gallery"}, {"progress": {"value": expr, "max": expr}, "label"?}, {"group": [blocks], "direction"?: "row"|"column"}, {"when": expr, "show": [blocks]}, {"divider": true}, {"figure": true}`,D=n=>/^(image|file)$/.test(n?.of??n?.type??"");function tn(n){return Object.fromEntries(Object.entries(n.views??{}).filter(([,e])=>!Array.isArray(e)))}function sn(n){let e=n.views?.home;return Array.isArray(e)?e:void 0}var G={field:()=>!1,relation:()=>!1,figure:!1},z=n=>n.kind??"the home",h=(n,e)=>n!==void 0&&Object.hasOwn(n,e),y=n=>typeof n=="object"&&n!==null&&!Array.isArray(n);function I(n,e,s){let o=x(n);for(let a of o.unknownFunctions)s.findings.push(d("unknown-function",e,`"${a}" is not a function the rule language knows`,"see docs/declaration-document.md#expression-language"));for(let a of o.names){if(s.kind===null){s.findings.push(d("view-name",e,`"${a}" names nothing here: these blocks are about no one record`,"reach records with all('<kind>'), like count(all('offer')) or first(all('party') where role == 'client').name"));continue}a==="id"||s.spec.field(a)||s.spec.relation(a)||s.findings.push(d("view-name",e,`${s.kind} has no field or relation called "${a}"`))}for(let a of o.edges)s.edges.has(a)||s.findings.push(d("view-edge",e,`"${a}" is not a relation any kind declares`));for(let a of o.sweeps)s.kinds.has(a)||s.findings.push(d("view-kind",e,`"${a}" is not a kind this document declares`))}function m(n,e,s){if(typeof n!="string"||n.length===0||n.length>2e3){s.findings.push(d("view-expression",e,`an expression is a line of the rule language, like "status == 'booked'"`));return}try{I(b(n),e,s)}catch(o){if(!(o instanceof k))throw o;s.findings.push(d("expression",e,`${o.sentence} (at character ${o.at+1})`))}}function j(n,e,s){if(typeof n!="string"||n.length===0||n.length>300){s.findings.push(d("view-template",e,'a template is words with {field} in braces, like "{name}" or "{quote|money}", at most 300 characters'));return}let o;try{o=V(n)}catch(a){if(a instanceof E||a instanceof k){s.findings.push(d("template",e,a.sentence));return}throw a}for(let a of o)a.expr&&I(a.expr,e,s)}function C(n,e,s){if(typeof n=="string"){O.includes(n)||s.findings.push(d("view-tone",e,`"${n}" is not a tone`,`use one of ${O.join(", ")}, or {"expr": "if(status == 'booked', 'good', 'neutral')"}`));return}if(y(n)&&Object.keys(n).length===1&&"expr"in n){m(n.expr,`${e}.expr`,s);return}s.findings.push(d("view-tone",e,'a tone is a word or {"expr": \u2026}',`one of ${O.join(", ")}`))}function v(n,e,s,o){if(!Array.isArray(n)){o.findings.push(d("view-shape",e,"a view is a list of blocks"));return}if(s>R){o.findings.push(d("view-depth",e,`blocks nest at most ${R} deep`,"flatten a group or a condition"));return}n.forEach((a,l)=>H(a,`${e}.${l}`,s,o))}function H(n,e,s,o){if(o.count++,!y(n)){o.findings.push(d("view-block",e,"a block is an object naming what it shows",`one of ${T}`));return}let a=Object.keys(n),l=a.filter(t=>W.includes(t)&&!(t==="group"&&a.includes("list")));if(l.length===0){o.findings.push(d("view-block",e,`${a.length>0?a.map(t=>`"${t}"`).join(", "):"an empty object"} is not a block Graview knows`,`one of ${T}`));return}if(l.length>1){o.findings.push(d("view-block",e,`a block is one thing, and this says ${l.map(t=>`"${t}"`).join(" and ")}`,"split it into two blocks"));return}let r=l[0];for(let t of a)t!==r&&t!="key"&&!$[r].includes(t)&&o.findings.push(d("unknown-key",`${e}.${t}`,`"${t}" is not part of a ${r} block`,$[r].length>0?`a ${r} block may also say ${$[r].map(f=>`"${f}"`).join(", ")}`:`a ${r} block says nothing else`));let i=n[r];switch(r){case"title":case"headline":case"text":case"badge":j(i,`${e}.${r}`,o),"tone"in n&&C(n.tone,`${e}.tone`,o);return;case"image":case"field":{let t=r==="image";if(typeof i!="string"||!(t?o.spec.files?.(i):o.spec.field(i))){let u=typeof i=="string"&&o.spec.relation(i);o.findings.push(d(`view-${r}`,`${e}.${r}`,`${o.kind} has no ${t?"image or file ":""}field ${typeof i=="string"?`"${i}"`:"by that name"}`,u?`"${i}" is a relation; show it with {"text": "{${i}.name}"}`:void 0))}let f=t?["thumb","gallery"]:M;"as"in n&&!f.includes(n.as)&&o.findings.push(d("view-format",`${e}.as`,`"${String(n.as)}" is not a way to show ${t?"pictures":"a field"}`,`use one of ${f.join(", ")}`)),t||L(n,e,o,"field"),"label"in n&&Y(n.label,`${e}.label`,o);return}case"progress":{!y(i)||Object.keys(i).some(t=>t!=="value"&&t!=="max")||!("value"in i)||!("max"in i)?o.findings.push(d("view-progress",`${e}.progress`,'progress is {"value": expression, "max": expression}')):(m(i.value,`${e}.progress.value`,o),m(i.max,`${e}.progress.max`,o)),"label"in n&&j(n.label,`${e}.label`,o);return}case"group":"direction"in n&&n.direction!=="row"&&n.direction!=="column"&&o.findings.push(d("view-direction",`${e}.direction`,`a group runs "row" or "column", not "${String(n.direction)}"`)),v(i,`${e}.group`,s+1,o);return;case"when":m(i,`${e}.when`,o),"show"in n?v(n.show,`${e}.show`,s+1,o):o.findings.push(d("view-when",e,'a condition says what it shows: {"when": expr, "show": [blocks]}'));return;case"figure":if(typeof i=="string")return P(n,e,o);for(let t of["as","currency","label"])t in n&&o.findings.push(d("unknown-key",`${e}.${t}`,`"${t}" belongs to a figure that works a number out; {"figure": true} is the kind's picture`,`write {"figure": "count(all('offer'))", "as": "number"}`));i!==!0?o.findings.push(d("view-block",`${e}.figure`,`a figure is a number worked out, {"figure": "sum(all('offer'), net)", "as": "money"}, or the kind's picture, {"figure": true}`)):o.spec.figure||o.findings.push(d("view-figure",`${e}.figure`,`${z(o)} has no figure to show`,o.kind===null?`work a number out: {"figure": "count(all('offer'))"}`:'give the kind a "figure", or leave this block out'));return;case"list":return X(n,e,o);case"divider":i!==!0&&o.findings.push(d("view-block",`${e}.${r}`,`write {"${r}": true}`));return}}function P(n,e,s){m(n.figure,`${e}.figure`,s),"as"in n&&!A.includes(n.as)&&s.findings.push(d("view-format",`${e}.as`,`"${String(n.as)}" is not a way to say a figure`,`use one of ${A.join(", ")}`)),L(n,e,s,"figure"),"label"in n&&j(n.label,`${e}.label`,s)}function L(n,e,s,o){"currency"in n&&(typeof n.currency!="string"||!/^[A-Z]{3}$/.test(n.currency)?s.findings.push(d("view-currency",`${e}.currency`,'a currency is its three-letter code, like "USD" or "EUR"')):n.as!=="money"&&s.findings.push(d("view-currency",`${e}.currency`,`a currency belongs on a ${o} shown as money`,'add "as": "money"')))}function U(n,e){let s=[...e.kinds],o=(l,r)=>{let i=new Set;for(let t of l){let f=e.vocabulary.namesOf(t)?.targets?.(r);if(f==="*")return s;for(let u of f??[])i.add(u)}return i.size>0?[...i]:void 0},a=l=>{switch(l.t){case"ident":return e.kind!==null&&e.spec.relation(l.name)?o([e.kind],l.name):void 0;case"member":{let r=a(l.object);return r?o(r,l.name):void 0}case"where":return a(l.set);case"call":{let r=l.args[0],i=r?.t==="lit"&&typeof r.value=="string"?r.value:void 0;if(l.fn==="all")return i!==void 0&&e.kinds.has(i)?[i]:void 0;let t=l.args.length===2&&l.args[1]?.t==="lit"&&typeof l.args[1].value=="string"?l.args[1].value:void 0;if(l.fn==="out"&&t!==void 0){let f=a(r);return f?o(f,t):void 0}if(l.fn==="out")return i!==void 0&&e.kind!==null?o([e.kind],i):void 0;if(l.fn==="in"){let f=t??i,u=t!==void 0?a(r):e.kind!==null?[e.kind]:void 0,c=f!==void 0?e.vocabulary.sources(f).filter(g=>{let p=e.vocabulary.namesOf(g)?.targets?.(f);return!u||p==="*"||u.some(K=>p?.includes(K))}):[];return c.length>0?c:void 0}if((l.fn==="sort"||l.fn==="first")&&r)return a(r);if(l.fn==="either"){let f=l.args.map(a);return f.every(u=>u!==void 0)?[...new Set(f.flatMap(u=>u??[]))]:void 0}return}default:return}};return a(n)}function _(n,e,s,o){let a;try{a=b(n)}catch(r){if(!(r instanceof k))throw r;o.findings.push(d("expression",e,`${r.sentence} (at character ${r.at+1})`));return}let l=x(a);for(let r of l.unknownFunctions)o.findings.push(d("unknown-function",e,`"${r}" is not a function the rule language knows`,"see docs/declaration-document.md#expression-language"));for(let r of l.edges)o.edges.has(r)||o.findings.push(d("view-edge",e,`"${r}" is not a relation any kind declares`));if(s)for(let r of l.names)r==="id"||s.some(i=>o.vocabulary.namesOf(i)?.field(r)||o.vocabulary.namesOf(i)?.relation(r))||o.findings.push(d("view-name",e,`${s.join(" and ")} ${s.length===1?"has":"have"} no field or relation called "${r}"`))}function X(n,e,s){let o=n.list;m(o,`${e}.list`,s);let a;if(typeof o=="string")try{a=U(b(o),s)}catch{a=void 0}let l=i=>{if(!a)return[...s.kinds].map(f=>s.vocabulary.namesOf(f)?.choices?.(i)).find(f=>f!==void 0);let t=a.map(f=>s.vocabulary.namesOf(f)?.choices?.(i));return t.every(f=>f!==void 0)?[...new Set(t.flatMap(f=>f??[]))]:void 0},r=a?a.join(" and "):"any kind";if("sort"in n){let i=n.sort;if(typeof i=="string")_(i,`${e}.sort`,a,s);else if(y(i)&&typeof i.by=="string"&&Object.keys(i).every(t=>t==="by"||t==="direction")){let t=i.direction;t!==void 0&&t!=="asc"&&t!=="desc"&&t!=="choices"?s.findings.push(d("list-sort",`${e}.sort.direction`,`a list is sorted "asc", "desc" or "choices", not "${String(t)}"`,'"choices" puts a choice field in the order its choices are declared')):t==="choices"?l(i.by)===void 0&&s.findings.push(d("list-sort",`${e}.sort.by`,`"${i.by}" is not a choice field of ${r}, so it has no declared order`,'sort by a choice field, or say "asc" or "desc"')):_(i.by,`${e}.sort.by`,a,s)}else s.findings.push(d("list-sort",`${e}.sort`,'a sort is a key, like "net", or {"by": key, "direction": "asc" | "desc" | "choices"}'))}if("limit"in n){let i=n.limit;(typeof i!="number"||!Number.isInteger(i)||i<1||i>F)&&s.findings.push(d("list-limit",`${e}.limit`,`a limit is a whole number from 1 to ${F}`))}if("group"in n){let i=n.group,t=typeof i=="string"?i:y(i)&&typeof i.by=="string"?i.by:void 0;if(!(typeof i=="string"||y(i)&&Object.keys(i).every(u=>u==="by"||u==="headings"))||t===void 0)s.findings.push(d("list-group",`${e}.group`,'a group is a choice field, like "type", or {"by": "type", "headings": {"pain": "What hurts"}}'));else{let u=l(t);if(u===void 0&&s.findings.push(d("list-group",`${e}.group`,`"${t}" is not a choice field of ${r}, so it has no choices to group by`,"group by a field whose type is enum")),y(i)&&"headings"in i){let c=i.headings;if(!y(c)||Object.values(c).some(g=>typeof g!="string"||g.length===0||g.length>80))s.findings.push(d("list-group",`${e}.group.headings`,'headings are words per choice, like {"pain": "What hurts"}, at most 80 characters each'));else if(u)for(let g of Object.keys(c))u.includes(g)||s.findings.push(d("list-group",`${e}.group.headings.${g}`,`"${g}" is not one of ${t}'s choices`,`use ${u.join(", ")}`))}}}"empty"in n&&(typeof n.empty!="string"||n.empty.length===0||n.empty.length>200)&&s.findings.push(d("list-empty",`${e}.empty`,"what an empty list says is a sentence, at most 200 characters")),"as"in n&&!N.includes(n.as)&&s.findings.push(d("list-as",`${e}.as`,`a list draws each record as its "card" or its "row", not "${String(n.as)}"`))}function Y(n,e,s){(typeof n!="string"||n.length===0||n.length>60)&&s.findings.push(d("view-label",e,"a label is a few words, at most 60 characters"))}function B(n,e,s,o,a,l,r){let i={kind:null,spec:G,kinds:o,edges:a,vocabulary:s,findings:l,count:0};Array.isArray(n)&&n.length===0&&l.push(d("view-shape",e,`${r} has no blocks`,'give it one: {"headline": "\u2026"}')),v(n,e,1,i),i.count>w&&l.push(d("view-size",e,`${r} has ${i.count} blocks; a view has at most ${w}`,"show less"))}function q(n,e,s,o,a){Array.isArray(n)&&n.forEach((l,r)=>{if(!y(l)||l.name!=="blocks"||!y(l.options)||!("blocks"in l.options))return;let i=[];B(l.options.blocks,`lenses.${r}.options.blocks`,e,s,o,i,`the lens "${String(l.title??r)}"`);for(let t of i)a.push({...t,severity:"warning"})})}function Z(n,e,s,o,a,l,r){let i=[];if(n===void 0)return i;if(!y(n))return i.push(d("view-shape",e,'views are an object of kinds, each with a "card", a "row" or a "page"')),i;for(let[t,f]of Object.entries(n)){if(t==="home"&&Array.isArray(f)){B(f,`${e}.home`,r,o,a,i,"the home");continue}let u=s(t);if(!u){i.push(d("view-kind",`${e}.${t}`,`"${t}" is not a kind this ${l} declares`));continue}if(!y(f)){i.push(d("view-shape",`${e}.${t}`,`a kind's views are {"card": [blocks], "row": [blocks], "page": [blocks]}`));continue}for(let c of Object.keys(f))S.includes(c)||i.push(d("view-slot",`${e}.${t}.${c}`,`"${c}" is not a place a view is drawn`,`use ${S.map(g=>`"${g}"`).join(", ")}`));for(let c of S){let g=f[c];if(g===void 0)continue;let p={kind:t,spec:u,kinds:o,edges:a,vocabulary:r,findings:i,count:0};v(g,`${e}.${t}.${c}`,1,p),p.count>w&&i.push(d("view-size",`${e}.${t}.${c}`,`this ${c} has ${p.count} blocks; a view has at most ${w}`,"show less, or move detail to the page"))}}return i}function rn(n){let e=new Set(Object.keys(n.kinds)),s=new Set(Object.values(n.kinds).flatMap(r=>Object.keys(r.edges??{}))),o=r=>{let i=h(n.kinds,r)?n.kinds[r]:void 0;return i?{field:t=>h(i.fields,t)||h(i.computed,t),relation:t=>h(i.edges,t),figure:i.figure!==void 0,files:t=>h(i.fields,t)&&D(i.fields[t]),choices:t=>h(i.fields,t)&&i.fields[t].type==="enum"?i.fields[t].options:void 0,targets:t=>h(i.edges,t)?i.edges[t].to:void 0}:void 0},a={namesOf:o,sources:r=>Object.keys(n.kinds).filter(i=>h(n.kinds[i].edges,r))},l=Z(n.views,"views",o,e,s,"document",a);return q(n.lenses,a,e,s,l),l}export{O as a,M as b,A as c,F as d,tn as e,sn as f,rn as g};
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import{Gb as e}from"./chunk.MKNXV4TM.js";var a=`
|
|
2
|
-
.graview-spec { display: flex; flex-direction: column; gap: 6px; min-width: 0; color: var(--graview-ink); }
|
|
3
|
-
|
|
4
|
-
.graview-spec-row { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px 10px; box-sizing: border-box; max-width: 100%; padding: 5px 10px; border: 1px solid var(--graview-edge); border-radius: var(--graview-radius-sm, 8px); background: var(--graview-panel); font-size: 0.875rem; }
|
|
5
|
-
.graview-spec-row[data-selected] { border-color: var(--graview-accent); }
|
|
6
|
-
.graview-spec-row > * { flex: 0 0 auto; min-width: 0; max-width: 100%; }
|
|
7
|
-
.graview-spec-row > .graview-spec-title, .graview-spec-row > .graview-spec-text { flex: 1 1 9rem; overflow-wrap: anywhere; }
|
|
8
|
-
.graview-spec-row > .graview-spec-title { font-size: 0.9375rem; }
|
|
9
|
-
.graview-spec-row > .graview-spec-progress { grid-template-columns: auto minmax(3rem, 5rem) auto; align-items: center; column-gap: 6px; }
|
|
10
|
-
.graview-spec-list[data-as="row"] .graview-spec-row { border-width: 0 0 1px; border-radius: 0; background: transparent; padding: 6px 2px; }
|
|
11
|
-
[data-graview-rows] .graview-spec-row { border-width: 0; border-radius: 0; background: transparent; padding: 2px 0; }
|
|
12
|
-
[data-graview-rows] .graview-spec-row > .graview-spec-title { font-size: 1.0625rem; font-weight: 600; }
|
|
13
|
-
.graview-spec-page { padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px solid var(--graview-edge); }
|
|
14
|
-
.graview-spec-title { font-family: var(--graview-font-display, inherit); font-weight: 600; font-size: 1rem; line-height: 1.3; overflow-wrap: anywhere; }
|
|
15
|
-
.graview-spec-text { margin: 0; font-size: 0.875rem; line-height: 1.45; overflow-wrap: anywhere; }
|
|
16
|
-
.graview-spec-text[data-graview-tone] { color: var(--graview-spec-tone); }
|
|
17
|
-
|
|
18
|
-
.graview-spec-badge { align-self: flex-start; display: inline-block; max-width: 100%; box-sizing: border-box; padding: 1px 8px; border: 1px solid currentColor; border-radius: 999px; background: var(--graview-panel); color: var(--graview-spec-tone, var(--graview-ink-muted)); font-size: 0.8125rem; font-weight: 600; line-height: 1.5; overflow-wrap: anywhere; }
|
|
19
|
-
.graview-spec-row .graview-spec-badge, .graview-spec-group[data-direction="row"] .graview-spec-badge { align-self: center; }
|
|
20
|
-
.graview-spec [data-graview-tone="good"] { --graview-spec-tone: var(--graview-good); }
|
|
21
|
-
.graview-spec [data-graview-tone="bad"] { --graview-spec-tone: var(--graview-bad); }
|
|
22
|
-
.graview-spec [data-graview-tone="warn"] { --graview-spec-tone: var(--graview-warn); }
|
|
23
|
-
.graview-spec [data-graview-tone="accent"] { --graview-spec-tone: var(--graview-accent); }
|
|
24
|
-
.graview-spec [data-graview-tone="neutral"] { --graview-spec-tone: var(--graview-ink-muted); }
|
|
25
|
-
.graview-spec-field { display: flex; flex-wrap: wrap; gap: 2px 8px; align-items: baseline; min-width: 0; font-size: 0.875rem; line-height: 1.4; }
|
|
26
|
-
.graview-spec-label { color: var(--graview-ink-muted); }
|
|
27
|
-
.graview-spec-value { min-width: 0; color: var(--graview-ink); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
|
|
28
|
-
.graview-spec-link { position: relative; z-index: ${e.raised}; color: var(--graview-accent); text-decoration: underline; }
|
|
29
|
-
.graview-spec-progress { display: grid; gap: 4px; font-size: 0.8125rem; }
|
|
30
|
-
.graview-spec-progress > .graview-spec-label, .graview-spec-progress > .graview-spec-value { white-space: nowrap; }
|
|
31
|
-
.graview-spec-track { display: block; height: 6px; border-radius: 999px; background: var(--graview-edge); overflow: hidden; }
|
|
32
|
-
.graview-spec-fill { display: block; height: 100%; background: var(--graview-accent); }
|
|
33
|
-
.graview-spec-group { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
|
|
34
|
-
.graview-spec-group[data-direction="row"] { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
|
|
35
|
-
.graview-spec-row .graview-spec-group { flex: 1 1 9rem; }
|
|
36
|
-
.graview-spec-divider { width: 100%; margin: 2px 0; border: 0; border-top: 1px solid var(--graview-edge); }
|
|
37
|
-
.graview-spec-figure { display: inline-flex; width: 22px; height: 22px; }
|
|
38
|
-
.graview-spec-row[data-graview-tall] { flex-direction: column; flex-wrap: nowrap; align-items: stretch; border-radius: 10px; padding: 8px 12px; }
|
|
39
|
-
.graview-spec-row[data-graview-tall] .graview-spec-badge { align-self: flex-start; }
|
|
40
|
-
.graview-spec-home, .graview-spec-place { gap: 14px; }
|
|
41
|
-
.graview-spec-headline { margin: 0; font-family: var(--graview-font-display, inherit); font-weight: 600; letter-spacing: -0.01em; line-height: 1.15; overflow-wrap: anywhere; font-size: 1.125rem; }
|
|
42
|
-
.graview-spec-headline[data-level="1"] { font-size: clamp(1.75rem, 5vw, 2.75rem); line-height: 1.05; text-wrap: balance; }
|
|
43
|
-
.graview-spec-headline[data-level="2"] { font-size: clamp(1.25rem, 3vw, 1.625rem); margin-top: 8px; }
|
|
44
|
-
.graview-spec-number { display: grid; gap: 2px; justify-items: start; }
|
|
45
|
-
.graview-spec-number-value { font-family: var(--graview-font-display, inherit); font-weight: 600; font-size: 1.75rem; line-height: 1.05; letter-spacing: -0.015em; font-variant-numeric: tabular-nums; }
|
|
46
|
-
.graview-spec-card .graview-spec-number-value, .graview-spec-row .graview-spec-number-value { font-size: 1.25rem; }
|
|
47
|
-
.graview-spec-number .graview-spec-label { font-size: 0.8125rem; }
|
|
48
|
-
.graview-spec-listing { display: grid; gap: 10px; min-width: 0; position: relative; z-index: ${e.raised}; }
|
|
49
|
-
.graview-spec-list-group { display: grid; gap: 8px; min-width: 0; }
|
|
50
|
-
.graview-spec-list-heading { margin: 6px 0 0; font-family: var(--graview-font-display, inherit); font-size: 1rem; font-weight: 600; padding-bottom: 4px; border-bottom: 1px solid var(--graview-edge-bright, var(--graview-edge)); }
|
|
51
|
-
.graview-spec-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; min-width: 0; }
|
|
52
|
-
.graview-spec-list[data-as="card"] { grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr)); gap: 10px; }
|
|
53
|
-
.graview-spec-list[data-as="names"] { display: flex; flex-wrap: wrap; gap: 4px 12px; }
|
|
54
|
-
.graview-spec-item { position: relative; min-width: 0; }
|
|
55
|
-
.graview-spec-item-name { font-size: 0.875rem; font-weight: 600; }
|
|
56
|
-
.graview-spec-item-link { all: unset; position: absolute; inset: 0; min-height: 24px; border-radius: 10px; cursor: pointer; }
|
|
57
|
-
.graview-spec-item-link:hover { background: color-mix(in srgb, var(--graview-accent) 6%, transparent); }
|
|
58
|
-
.graview-spec-item-link:focus-visible { outline: 2px solid var(--graview-accent); outline-offset: 2px; }
|
|
59
|
-
.graview-spec-item .graview-spec-listing { z-index: ${e.raised}; }
|
|
60
|
-
.graview-spec-empty, .graview-spec-more { color: var(--graview-ink-muted); }
|
|
61
|
-
`;export{a};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Hb as zt,Kb as qt,Lb as Ut,Nb as $t,Va as Gt,Za as Kt,_a as Bt,ac as Yt,ca as Ft,fc as Se,gc as Ke,nb as jt}from"./chunk.MKNXV4TM.js";import{a as F,b as ve}from"./chunk.MRK6QJV5.js";import{b as C}from"./chunk.AJZBJBMO.js";var te={focusId:null,relation:null,expanded:[],pins:{}},be=e=>{let t=Number(e);return Number.isFinite(t)?t:null};function U(e){let t=new URLSearchParams;e.focusId&&t.set("focus",e.focusId),e.relation&&t.set("relation",e.relation),e.overview&&t.set("overview","1"),e.zoom&&t.set("zoom","1"),e.past&&t.set("past","1"),e.shown&&e.shown.length>0&&t.set("show",[...e.shown].sort().join(",")),e.selection!==void 0&&e.selection.length>0&&t.set("sel",[...e.selection].sort().join(",")),e.expanded.length>0&&t.set("expand",[...e.expanded].sort().join(","));for(let o of Object.keys(e.pins).sort()){let r=e.pins[o];t.set(`pin.${o}`,`${xe(r.x)},${xe(r.y)}`)}e.pan&&(e.pan.x!==0||e.pan.y!==0)&&t.set("pan",`${xe(e.pan.x)},${xe(e.pan.y)}`);for(let o of Object.keys(e.within??{}).sort()){let r=e.within[o];r.length>0&&t.set(`in.${o}`,r)}e.q&&e.q.trim().length>0&&t.set("q",e.q);let n=t.toString();return n?`#${n}`:"#"}function $n(e){return e&&e.startsWith("agg:")?`aggregate:${e.slice(4)}`:e}function Ee(e){let t=e.includes("#")?e.slice(e.indexOf("#")+1):e,n=new URLSearchParams(t),o=Object.create(null);for(let[g,p]of n){if(!g.startsWith("pin."))continue;let[m,S]=p.split(","),k=m===void 0?null:be(m),h=S===void 0?null:be(S);k===null||h===null||(o[g.slice(4)]={x:k,y:h})}let r=Object.create(null);for(let[g,p]of n)!g.startsWith("in.")||p.length===0||(r[g.slice(3)]=p);let i=n.get("view");i&&i.length>0&&r.view===void 0&&(r.view=i);let a=n.get("pan")?.split(",")??[],u=a[0]===void 0?null:be(a[0]),l=a[1]===void 0?null:be(a[1]),c=(n.get("sel")??"").split(",").filter(g=>g.length>0).sort(),f=n.get("overview")==="1";return{...c.length>0?{selection:c}:{},...f?{overview:!0}:{},...n.get("zoom")==="1"?{zoom:!0}:{},...n.get("past")==="1"?{past:!0}:{},...n.get("show")?{shown:[...new Set(n.get("show").split(",").filter(Boolean))].sort()}:{},...u!==null&&l!==null?{pan:{x:u,y:l}}:{},...Object.keys(r).length>0?{within:r}:{},...n.get("q")?.trim()?{q:n.get("q")}:{},focusId:$n(n.get("focus")),relation:n.get("relation"),expanded:(n.get("expand")??"").split(",").filter(g=>g.length>0&&(f||!g.startsWith("kind:"))).sort(),pins:o}}function rr(e){let t=Ee(e);return U(t)==="#"?{...t,overview:!0}:t}function ir(e){let t=U(e);return t==="#overview=1"?"":t}function xe(e){return Math.round(e*100)/100}function Qt(e,t){return U(e)===U(t)}var Be="edge:";function ar(e,t,n){let o=r=>encodeURIComponent(r);return`${Be}${o(e)}:${o(t)}:${o(n)}`}function Xt(e){if(!e.startsWith(Be))return null;let t=e.slice(Be.length).split(":");if(t.length!==3)return null;let[n,o,r]=t;if(!n||!o||!r)return null;try{return{kind:decodeURIComponent(n),from:decodeURIComponent(o),to:decodeURIComponent(r)}}catch{return null}}function Re(e){let{pan:t,...n}=e;return{...n,pins:{}}}function $(e,t){if(t===e.focusId)return{...e,focusId:t};let n=Re(e);return{...n.within?.q!==void 0?ge(n,"q",null):n,focusId:t}}function Jt(e,t){return{...e,relation:t}}function ge(e,t,n){let o={...e.within??{}};if(n===null?delete o[t]:o[t]=n,Object.keys(o).length===0){let{within:r,...i}=e;return i}return{...e,within:o}}function je(e,t){if(t!==e.overview&&(e=Re(e)),!t){let n=e.expanded.filter(o=>!o.startsWith("kind:"));return{...e,overview:!1,expanded:n}}return{...e,overview:t}}function sr(e,t,n){let o=new Set(e.shown??[]);if(n?o.add(t):o.delete(t),o.size===0){let{shown:r,...i}=e;return i}return{...e,shown:[...o].sort()}}function Yn(e,t){if(t===null||t.trim().length===0){let{q:n,...o}=e;return o}return{...e,q:t}}function lr(e){let t=e.q!==void 0&&e.within?.q===e.q;return Yn(t?ge(e,"q",null):e,null)}function dr(e,t){if(!t){let{past:n,...o}=e;return o}return{...e,past:!0}}function Pe(e,t){if(t.length===0){let{selection:n,...o}=e;return o}return{...e,selection:[...t]}}function me(e,t){if(t!==(e.zoom===!0)&&(e=Re(e)),!t){let{zoom:n,...o}=e;return o}return{...e,zoom:!0}}function Me(e,t){let n=new Set(e.expanded);return n.has(t)?n.delete(t):n.add(t),{...e,expanded:[...n].sort()}}function cr(e,t){if(t===null||t.x===0&&t.y===0){let{pan:n,...o}=e;return o}return{...e,pan:t}}function ur(e){return Re(e)}function pr(e,t,n){let o={...e.pins};return n===null?delete o[t]:o[t]=n,{...e,pins:o}}var ke="aggregate:",Ae="kind:";function ze(e){return`${Ae}${e}`}function ne(e){return e.startsWith(Ae)?e.slice(Ae.length):null}var gr="kinds:beyond";function Qn(e){let t=ne(e);return t?[t]:X(e)}function oe(...e){return`${ke}${[...e].sort().join("+")}`}function Zt(e){return e.startsWith(ke)}function X(e){return!Zt(e)||e.includes("|")?[]:e.slice(ke.length).split("+").filter(Boolean)}function en(e,t,n={}){let o=ne(t);if(o!==null&&e.overview&&n.ownPicture!==!0)return Me(e,t);let r=o!==null?oe(o):t;if(e.zoom&&e.focusId===r&&!(o!==null&&n.carry))return me(e,!1);if(o!==null&&n.carry){let i=je({...$(e,r),relation:null},!1);return ge(me(i,!0),"q",n.carry)}return me({...$(e,r),relation:null},!0)}function Xn(e,t,n){return ge(je($(e,oe(t)),!1),"view",n)}function mr(e,t){return e.id<t.id?-1:e.id>t.id?1:0}var tn="aggregate:";function qe(e){return e.startsWith(tn)&&e.includes("|")}function Jn(e,t){let n=0,o=138;for(let r of e.split(" ")){let i=t(r),a=o+t(" ")+i;if(a<=138)o=a;else{let u=Math.ceil(i/138)||1;n+=u,o=i-(u-1)*138}}return n}var Zn=16.25,Ue=27,eo=(e,t)=>{let n=Math.ceil(e.length*7.1/138);return t?Math.max(Ue,Math.ceil(Math.max(n,Jn(e,t))*Zn)+6):Math.max(Ue,n*16+6)};function to(e,t,n){return e.length===0?0:10+e.reduce((o,r)=>o+eo(r,n),0)+(e.length-1)*2}var nn=27,on=8,no=4,rn=64,oo=e=>Math.max(1,Math.min(on,e)),ro=e=>e*nn+rn;var io=(e,t)=>e.length*t*.58;var $e=C(F(),1),ao={turns:[],outcomes:new Map,busy:!1,open:!1,side:"left",pending:null,drawn:0,draft:null,draftNote:null},an=e=>`graview:seat:${e}`;function so(e){if(!e)return{};try{let t=sessionStorage.getItem(e);if(!t)return{};let n=JSON.parse(t);return{...Array.isArray(n.turns)?{turns:n.turns}:{},...Array.isArray(n.outcomes)?{outcomes:new Map(n.outcomes)}:{},...typeof n.open=="boolean"?{open:n.open}:{},...n.side==="left"||n.side==="right"?{side:n.side}:{},...n.draft?.drawn?{draft:n.draft}:{}}}catch{return{}}}function lo(e,t){if(e)try{sessionStorage.setItem(e,JSON.stringify({turns:t.turns.slice(-40),outcomes:[...t.outcomes],open:t.open,side:t.side,draft:t.draft}))}catch{}}function Ye(e){let t=e===null?null:an(e),n={...ao,...so(t)},o=new Set,r=(i,a=!0)=>{n=i,a&&lo(t,n);for(let u of[...o])u()};return{get:()=>n,subscribe(i){return o.add(i),()=>void o.delete(i)},setTurns:i=>r({...n,turns:i(n.turns)}),settle:(i,a)=>r({...n,outcomes:new Map(n.outcomes).set(i,a)}),setBusy:i=>r({...n,busy:i},!1),setOpen:i=>{n.open!==i&&r({...n,open:i})},setSide:i=>{n.side!==i&&r({...n,side:i})},ask:i=>r({...n,open:!0,pending:i.trim()||null}),takePending(){let i=n.pending;return i!==null&&r({...n,pending:null},!1),i},drawn(){return r({...n,drawn:n.drawn+1},!1),()=>r({...n,drawn:Math.max(0,n.drawn-1)},!1)},setDraft:(i,a=null)=>r({...n,draft:i,draftNote:a})}}function co(e){let t=()=>e.get().drawn>0;return(0,$e.useSyncExternalStore)(e.subscribe,t,t)}function uo(e){return(0,$e.useSyncExternalStore)(e.subscribe,e.get,e.get)}var Te=C(F(),1),Oe=(0,Te.createContext)(void 0),po=()=>(0,Te.useContext)(Oe);var Qe={};var fo="I can answer about what's in this app. Open questions need AI, which isn't on here.",yo="Answered with AI";var sn=e=>`graview:setting:${e}`;function ln(){return localStorage}function dn(e,t){try{let n=(t??ln()).getItem(sn(e.name));if(n!==null&&e.options.some(o=>o.value===n))return n}catch{}return e.initial}function cn(e,t,n){try{(n??ln()).setItem(sn(e.name),t)}catch{}}function un(e,t){if(typeof document>"u")return;let n=document.documentElement;if(e.honored==="root-font-size"){n.style.fontSize=t===e.initial?"":t;return}let o=`graview${e.name.replace(/-([a-z0-9])/g,(r,i)=>i.toUpperCase()).replace(/^[a-z]/,r=>r.toUpperCase())}`;t===e.initial?delete n.dataset[o]:n.dataset[o]=t}var O=C(F(),1);function pn(e){return e?.closest?.("[data-graview-pick]")?.getAttribute("data-graview-pick")??null}function Xe(e){return Se(e)}var go=12,mo=4;function ho(e,t,n){let o=Xe(t);return e.get(o)??{participant:o,who:t.id??t.kind,at:null,mode:"docked",since:n,trail:[]}}var Ve=(e,t)=>t===null||e[e.length-1]===t?e:[...e,t].slice(-go);function fn(e,t){let n=e.filter(r=>r.length>0);if(n.length===0)return null;if(n.length<=mo)return n[0];let o=new Set(n.map(r=>t(r)).filter(r=>r!==void 0));return o.size===1?ze([...o][0]):n[0]}function Je(e,t,n){let o=new Map(e);if(t.type==="rest"){for(let[a,u]of e)u.mode!=="asking"&&u.mode!=="docked"&&t.at-u.since>=t.holdMs&&o.set(a,{...u,mode:"docked",at:null,trail:[],say:void 0,confidence:void 0});return o}if(t.author.kind!=="agent")return o;let r=ho(e,t.author,t.at),i=a=>o.set(r.participant,{...r,...a,since:t.at});switch(t.type){case"read":{let a=fn(t.ids,n);return i({at:a,mode:"reading",trail:Ve(r.trail,a)}),o}case"about-to-write":case"write":{let a=fn(t.ids,n);return i({at:a,mode:"writing",trail:Ve(r.trail,a),say:void 0,confidence:void 0}),o}case"refused":return i({at:t.where,mode:"refused",say:t.say,confidence:void 0,trail:Ve(r.trail,t.where)}),o;case"asking":return i({at:t.where??r.at,mode:"asking",say:t.say,...t.confidence!==void 0?{confidence:t.confidence}:{confidence:void 0},trail:Ve(r.trail,t.where)}),o;case"said":return i({say:t.say,...t.confidence!==void 0?{confidence:t.confidence}:{confidence:void 0},...t.caption?{caption:t.caption}:{}}),o;case"over":return i({over:t.over}),o;case"home":return i({at:null,mode:"docked",trail:[],say:void 0,confidence:void 0,over:null}),o;default:return o}}var yn="graview:session";function gn(e){let t=()=>typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID().slice(0,8):Math.random().toString(36).slice(2,10);try{let n=e??sessionStorage,o=n.getItem(yn);if(o)return o;let r=t();return n.setItem(yn,r),r}catch{return t()}}var Ze={name:"share-where",title:"Where you are",description:"Whether the others here see which stop you are on.",honored:"root-attribute",options:[{value:"shared",label:"Shown"},{value:"private",label:"Hidden"}],initial:"shared"},et={name:"share-over",title:"What you point at",description:"Whether the others see the thing under your pointer, outlined in your color.",honored:"root-attribute",options:[{value:"private",label:"Kept to yourself"},{value:"shared",label:"Outlined for others"}],initial:"private"},mn=[Ze,et],So=800;function hn(e){let{channel:t,store:n,view:o,principal:r,session:i,robots:a,seatWho:u,settingValues:l,setView:c,ttlMs:f=1e4,people:g,seats:p}=e,[m,S]=(0,O.useState)(()=>new Map),[k,h]=(0,O.useState)(null),[v,w]=(0,O.useState)(null),[x,R]=(0,O.useState)(null),N=typeof r.id=="string"&&r.id.length>0,V=N&&(l[Ze.name]??Ze.initial)==="shared",W=V&&(l[et.name]??et.initial)==="shared",M=Xe({kind:r.kind,...r.id?{id:r.id}:{},session:i}),b=N?Ft(r,{graph:n.graph,schema:n.schema,...p?{seats:p}:{},...g?{people:g}:{}}):"",A=u?a.get(`agent:${u}:${i}`):void 0,L=(0,O.useMemo)(()=>!t||!V?null:{participant:M,kind:r.kind,name:b,...r.onBehalfOf?.id?{onBehalfOf:r.onBehalfOf.id,...r.onBehalfOf.name?{onBehalfOfName:r.onBehalfOf.name}:{}}:{},hue:jt(r.id??"nobody"),stop:x??U(o),...W?{over:k}:{},...A?{robot:{at:A.at,mode:A.mode}}:{},at:new Date().toISOString()},[t,V,W,M,b,r.id,r.kind,r.onBehalfOf?.id,r.onBehalfOf?.name,o,x,k,A?.at,A?.mode]);(0,O.useEffect)(()=>{if(!t||!L)return;t.here(L);let T=setInterval(()=>t.here({...L,at:new Date().toISOString()}),So);return()=>clearInterval(T)},[t,L]),(0,O.useEffect)(()=>t?t.onWho(D=>S(Ke(new Map,D,Date.now(),f))):void 0,[t,f]);let we=m.size>0;(0,O.useEffect)(()=>{if(!we)return;let T=setInterval(()=>{S(D=>{let K=Ke(D,[],Date.now(),f);return K.size===D.size?D:K})},Math.max(250,Math.min(1e3,f/4)));return()=>clearInterval(T)},[we,f]),(0,O.useEffect)(()=>{if(!t||typeof window>"u")return;let T=()=>t.leave();return window.addEventListener("pagehide",T),()=>window.removeEventListener("pagehide",T)},[t]),(0,O.useEffect)(()=>{if(!W||typeof document>"u")return;let T=null,D=K=>{let Z=pn(K.target);Z!==T&&(T=Z,h(Z))};return document.addEventListener("pointermove",D,{passive:!0}),()=>document.removeEventListener("pointermove",D)},[W]);let Q=(0,O.useRef)(null),H=v?m.get(v)??null:null,J=(0,O.useCallback)(T=>{Q.current=null,w(T)},[]);return(0,O.useEffect)(()=>{if(v){if(!H){w(null);return}H.stop!==Q.current?.stop&&(Q.current={stop:H.stop,at:Date.now()},c(Ee(H.stop)))}},[v,H,c]),(0,O.useEffect)(()=>{let T=Q.current;!v||T===null||Date.now()-T.at<400||Qt(o,Ee(T.stop))||w(null)},[o,v]),(0,O.useEffect)(()=>{if(!v||typeof document>"u")return;let T=D=>{D.key==="Escape"&&w(null)};return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[v]),(0,O.useMemo)(()=>({who:m,sharing:L?{participant:M,name:b}:null,following:H,follow:J,sayWhere:R}),[m,L,M,b,H,J])}var B=C(F(),1);function wn(e){return Se(e.author)}function vo(e,t){return e.length>1?"co-edited":t==="rule"?"rule":t==="agent"?"autonomous":"directed"}function Sn(e,t,n,o,r){let i=new Map;for(let[l,c]of e)o-c.at<r&&i.set(l,c);let a=new Set(n.flatMap(l=>l.nodeIds)),u=(l,c,f)=>{let g=i.get(l),p=g?.participants.includes(wn(c))?g.participants:[...g?.participants??[],wn(c)];i.set(l,{at:o,manner:vo(p,c.author.kind),intent:c.intent,wrote:(g?.wrote??!1)||(f.wrote??!1),read:(g?.read??!1)||(f.read??!1),broke:(g?.broke??!1)||a.has(l),participants:p})};for(let l of t){for(let c of l.writes)u(c,l,{wrote:!0});for(let c of l.reads)l.writes.includes(c)||u(c,l,{read:!0})}for(let l of n)for(let c of l.nodeIds){let f=i.get(c);i.set(c,{at:o,manner:f?.manner??"rule",intent:f?.intent??l.message,wrote:f?.wrote??!1,read:f?.read??!1,broke:!0,participants:f?.participants??["rule::"]})}return i}var bo=2600;function vn(e,t=bo){let[n,o]=(0,B.useState)(()=>new Map),r=(0,B.useRef)(n);r.current=n;let i=(0,B.useRef)(null),a=(0,B.useCallback)(l=>{r.current=l,o(l),i.current&&clearTimeout(i.current),i.current=setTimeout(()=>{r.current=new Map,o(new Map)},t)},[t]);(0,B.useEffect)(()=>{let l=e.violations(),c=e.subscribe((f,g)=>{let p=e.violations(),m=$t(e.allInvariants(),l,p).introduces;l=p,a(Sn(r.current,g,m.map(S=>({nodeIds:S.nodeIds,message:S.message})),Date.now(),t))});return()=>{c(),i.current&&clearTimeout(i.current)}},[e,t,a]);let u=(0,B.useCallback)(l=>{l.reads.length!==0&&a(Sn(r.current,[xo(l)],[],Date.now(),t))},[t,a]);return{activity:n,noteAttention:u}}function xo(e){return{id:`attention:${e.intent}`,seq:-1,batch:"attention",author:e.author,intent:e.intent,mutation:null,primitives:[],inverse:[],reads:e.reads,writes:[],at:new Date().toISOString()}}var s=C(F(),1);function bn(){let e=null,t=new Set,n=new Set,o=r=>{for(let i of n)i(r)};return{subscribe(r){return t.add(r),t.size===1&&o(!0),()=>{t.delete(r),t.size===0&&(e=null,o(!1))}},snapshot:()=>e,set(r){if(!(e===r||e&&r&&e.x===r.x&&e.y===r.y)){e=r;for(let i of t)i()}},get listeners(){return t.size},onActive(r){return n.add(r),()=>void n.delete(r)}}}function xn(){let e=!1,t=new Set;return{moving:()=>e,set(n){if(n!==e){e=n;for(let o of t)o()}},subscribe(n){return t.add(n),()=>t.delete(n)}}}var re=C(ve(),1),Ie=(0,s.createContext)(null),Pn=(0,s.createContext)("scene");function Eo({mode:e,children:t}){return(0,re.jsx)(Pn.Provider,{value:e,children:t})}function Ro(){return(0,s.useContext)(Pn)}var Mn={kind:"human"},Po=[],Mo=[],Ao=[],tt=[];function An(e,t){let n=(0,s.useId)();(0,s.useEffect)(()=>{if(!globalThis.__graviewWatch)return;let o=t??Mn,r=()=>{qt(e,o,n),Ut(e)};r();let i,a=e.subscribe(()=>{clearTimeout(i),i=setTimeout(r,250)});return()=>{clearTimeout(i),a(),globalThis.__graviewWatch?.unseen?.({words:[],from:n,gone:!0})}},[e,t,n])}function ko({store:e,views:t,initialView:n,scheme:o="dark",initialSelection:r,principal:i,seats:a=Po,onSeat:u,people:l=Mo,memory:c,presenceTtlMs:f,app:g,settings:p=g?.settings??Ao,presence:m,brand:S,onKeepLens:k,providers:h,ai:v=Qe,files:w,view:x,onViewChange:R,children:N}){let[V,W]=(0,s.useState)(null),M=V??i??a[0]?.principal??Mn,b=(0,s.useMemo)(()=>e.seenBy(M),[e,M]);An(e,M);let[A]=(0,s.useState)(()=>gn(c)),[L,we]=(0,s.useState)(!1),Q=(0,s.useCallback)(()=>we(!0),[]),H=(0,s.useMemo)(()=>m?[...p,...mn]:p,[p,m]),[J]=(0,s.useState)(()=>n??ot(t,e.schema)),[T,D]=(0,s.useState)(()=>Pe(J??te,r??J?.selection??[])),K=(0,s.useRef)(J??te).current,[Z,Fn]=(0,s.useState)(null),[ft,Gn]=(0,s.useState)(null),De=(0,s.useContext)(Ie),[yt]=(0,s.useState)(()=>De?.seatTalk??Ye(S?.name??e.schema.kinds.join(","))),We=k??De?.onKeepLens,gt=g??De?.app,mt=(0,s.useRef)(null),ht=(0,s.useCallback)(d=>{mt.current=d},[]),wt=(0,s.useCallback)(d=>mt.current?.whereIs(d)??null,[]),[St]=(0,s.useState)(()=>bn()),[vt]=(0,s.useState)(()=>xn()),[Fe,Kn]=(0,s.useState)(null),[de,bt]=(0,s.useState)(()=>new Map),ce=(0,s.useRef)(de);ce.current=de;let ue=(0,s.useRef)(null),Ge=(0,s.useCallback)(d=>b.graph.getNode(d)?.kind,[b]),q=(0,s.useCallback)(d=>{let y=Je(ce.current,d,Ge);ce.current=y,bt(y),ue.current&&clearTimeout(ue.current),[...y.values()].some(P=>P.mode!=="docked"&&P.mode!=="asking")&&(ue.current=setTimeout(()=>{let P=Je(ce.current,{type:"rest",at:Date.now(),holdMs:nt},Ge);ce.current=P,bt(P)},nt+20))},[Ge]),xt=(0,s.useCallback)(d=>q({...d,at:d.at??Date.now()}),[q]),Et=(0,s.useCallback)(d=>{Kn(d),d&&q({type:"home",author:{kind:"agent",id:d,session:A},at:Date.now()})},[q,A]);(0,s.useEffect)(()=>b.subscribe((d,y)=>{for(let E of y)E.author.kind==="agent"&&q({type:"write",author:E.author,ids:E.writes,at:Date.now()})}),[b,q]),(0,s.useEffect)(()=>()=>{ue.current&&clearTimeout(ue.current)},[]);let z=(0,s.useMemo)(()=>({...M,session:A}),[M,A]),Rt=(0,s.useCallback)(d=>{W(d),u?.(d)},[u]),[pe,Bn]=(0,s.useState)(()=>Object.fromEntries(H.map(d=>[d.name,dn(d,c)])));(0,s.useEffect)(()=>{for(let d of H)un(d,pe[d.name]??d.initial)},[H,pe]);let Pt=(0,s.useCallback)((d,y)=>{let E=H.find(P=>P.name===d);!E||!E.options.some(P=>P.value===y)||(cn(E,y,c),Bn(P=>({...P,[d]:y})))},[H,c]),[Mt,jn]=(0,s.useState)(null),{activity:At,noteAttention:kt}=vn(b),Tt=(0,s.useCallback)(d=>{kt(d),q({type:"read",author:d.author,ids:d.reads,at:Date.now()})},[kt,q]),ee=(0,s.useCallback)(d=>{if(ne(d)!==null||X(d).length>0||qe(d))return!0;let y=Xt(d);return y?b.graph.allEdges().some(E=>E.kind===y.kind&&E.from===y.from&&E.to===y.to):b.graph.getNode(d)!==void 0},[b]),Ot=(0,s.useCallback)(d=>{let y=d.selection??tt,E=y.filter(ee),P=E.length===y.length?d:Pe(d,E);return P.focusId!==null&&!ee(P.focusId)&&(P=$(P,null)),P},[ee]),fe=(0,s.useCallback)(d=>{let y=Ot(d),E=Rn(b,z,y.shown);if(y.focusId!==null&&E.size>0){let P=X(y.focusId),Wt=b.graph.getNode(y.focusId);(P.length>0?P.every(Un=>E.has(Un)):Wt?E.has(Wt.kind):!1)&&(y={...y,focusId:null})}if(!y.overview&&y.focusId===null){let P=K.focusId!==null&&!ee(K.focusId)?ot(t,e.schema)??{...te,overview:!0}:K;P.focusId!==null&&ee(P.focusId)?y={...y,focusId:P.focusId}:P.overview===!0&&(y={...y,overview:!0})}return y},[Ot,ee,b,K,z,t,e.schema]),G=fe(x??T),Vt=(0,s.useMemo)(()=>Rn(b,z,G.shown),[b,z,G.shown]),It=(0,s.useMemo)(()=>[...b.modules.administered.entries()].map(([d,y])=>{let E=b.mayAdminister(d,z);return{name:d,...y.description?{description:y.description}:{},kinds:y.kinds??[],canShow:E,shown:E&&(G.shown??[]).includes(d)}}),[b,z,G.shown]),ye=(0,s.useCallback)(d=>{let y=E=>fe(typeof d=="function"?d(E):d);if(x!==void 0){R?.(y(x));return}R&&R(y(G)),D(E=>y(E))},[G,R,x,fe]);(0,s.useEffect)(()=>{x===void 0&&D(d=>{let y=fe(d);return y===d?d:y})},[G,x,fe]);let Lt=G.selection??tt,Ct=(0,s.useCallback)(d=>{ye(y=>Pe(y,typeof d=="function"?d(y.selection??tt):d))},[ye]),{who:_t,following:Nt,follow:Ht,sayWhere:zn,sharing:Dt}=hn({channel:m,store:b,view:G,principal:z,session:A,robots:de,seatWho:Fe,settingValues:pe,setView:ye,seats:a,people:l,...f!==void 0?{ttlMs:f}:{}}),qn=(0,s.useMemo)(()=>({store:b,scheme:o,views:t,view:G,setView:ye,homeView:K,selection:Lt,setSelection:Ct,menuAt:Z,setMenuAt:Fn,whereIs:wt,pointer:St,motion:vt,registerScene:ht,robots:de,noteSeat:xt,seatWho:Fe,registerSeatWho:Et,actsDoor:ft,registerActsDoor:Gn,seatTalk:yt,...c?{memory:c}:{},who:_t,following:Nt,follow:Ht,sayWhere:zn,sharing:Dt,session:A,ai:v,movedByHand:L,noteMoved:Q,emphasis:Mt,setEmphasis:jn,activity:At,noteAttention:Tt,principal:z,seats:a,people:l,takeSeat:Rt,settings:H,settingValues:pe,chooseSetting:Pt,hiddenKinds:Vt,administered:It,...h?{providers:h}:{},...S?{brand:S}:{},...We?{onKeepLens:We}:{},app:gt}),[b,o,t,G,ye,Lt,Ct,Z,wt,St,vt,ht,de,xt,Fe,Et,ft,yt,c,_t,Nt,Ht,Dt,A,v,L,Q,Mt,At,Tt,z,a,l,Rt,H,pe,Pt,Vt,It,h,S,We,gt]);return(0,re.jsx)(Ie.Provider,{value:qn,children:(0,re.jsx)(To,{children:w?(0,re.jsx)(Oe.Provider,{value:w,children:N}):N})})}var kn=(0,s.createContext)(null);function To({children:e}){let{store:t,view:n,views:o,principal:r,hiddenKinds:i,selection:a}=Y(),u=Le(),l=n.q,c=n.focusId,f=!!(l&&l.trim().length>0),g=(0,s.useMemo)(()=>f?{flagged:new Set(t.violations().flatMap(S=>S.nodeIds)),touched:Kt(t.log.all())}:null,[t,u,f]),p=c?t.graph.getNode(c)?.kind??ne(c)??(X(c).length===1?X(c)[0]:void 0):void 0,m=(0,s.useMemo)(()=>!l||!g?null:Bt(t,l,{...p?{inKind:p}:{},principal:r,places:o.places(),kinds:t.schema.kinds.filter(S=>!i.has(S)),from:[...a,...c&&t.graph.has(c)?[c]:[]],flagged:g.flagged,touched:g.touched,limit:200}),[t,l,r,o,i,a,c,p,g]);return(0,re.jsx)(kn.Provider,{value:m,children:e})}var En=new WeakMap;function ri(e){let t=En.get(e);return t||En.set(e,t=new Set(e.matched)),t}function Oo(){return(0,s.useContext)(kn)}function Y(){let e=(0,s.useContext)(Ie);if(!e)throw new Error("useGraview must be used inside a <GraviewProvider>.");return e}function Vo(){return(0,s.useContext)(Ie)??null}function Le(){let{store:e}=Y(),t=(0,s.useRef)(null),n=(0,s.useRef)(null),o=(0,s.useCallback)(()=>(n.current!==e&&(n.current=e,t.current=null),t.current??=e.graph.allNodes(),t.current),[e]),r=(0,s.useCallback)(i=>e.subscribe(()=>{t.current=null,i()}),[e]);return(0,s.useSyncExternalStore)(r,o,o)}function Io(e){let{store:t}=Y(),n=(0,s.useCallback)(r=>t.subscribe(r),[t]),o=(0,s.useCallback)(()=>e===null?void 0:t.graph.getNode(e),[t,e]);return(0,s.useSyncExternalStore)(n,o,o)}function Rn(e,t,n){let o=new Set(e.modules.disabledKinds);for(let r of e.kindsKeptFrom(t))o.add(r);for(let[r,i]of e.modules.administered)if(!(e.mayAdminister(r,t)&&(n??[]).includes(r)))for(let a of i.kinds??[])o.add(a);return o}var nt=2600;function ot(e,t){let n=Yt(e.arrangement?.()?.first,t,e.places());if(!(!n||n.to==="home"))return n.to==="place"?{...te,focusId:oe(n.place.kind),within:{view:n.place.as}}:{...te,focusId:oe(n.kind)}}var Ce=Symbol.for("graview.default-view");function Tn(e){return Object.defineProperty(e,Ce,{value:!0,enumerable:!1}),e}function On(e){return typeof e=="function"&&e[Ce]===!0}var rt=Symbol.for("graview.replaces-page");function Vn(e){return typeof e=="function"&&e[rt]===!0}function Co(e){return Gt(e)}function _o(e,t){if(t===e)return e;for(let r of t.registrations()){let i={...r.title?{title:r.title}:{},...r.across?{across:r.across}:{},...r.beside?{beside:!0}:{}};e.register(r.kind,{cardinality:r.cardinality,fidelity:r.fidelity},r.view,i)}let n=t.arrangement?.();n&&e.arrange?.(n);let o=t.homeView?.();return o&&e.home?.(o),e}var ae=C(F(),1);function No(){let{selection:e,setSelection:t}=Y();return(0,ae.useMemo)(()=>({selection:e,set:n=>t(n),clear:()=>t([]),toggle:n=>t(o=>o.includes(n)?o.filter(r=>r!==n):[...o,n]),isSelected:n=>e.includes(n)}),[e,t])}function Ho(){let{store:e}=Y(),t=Le();return(0,ae.useMemo)(()=>Do(e),[e,t])}var In=new WeakMap;function Do(e){let t=In.get(e);if(!t){let n={violations:null};e.subscribe(()=>{n.violations=null}),In.set(e,n),t=n}return t.violations??=e.violations(),t.violations}function Wo(){let{view:e,setView:t}=Y();return(0,ae.useMemo)(()=>({view:e,url:U(e),focus:n=>t(o=>$(o,n)),show:n=>t(o=>Jt(o,n)),toggle:n=>t(o=>Me(o,n)),go:n=>t(n)}),[e,t])}var ie={at:0,depth:0,listeners:new Set,tell(){for(let e of this.listeners)e()}};typeof window<"u"&&window.addEventListener("popstate",e=>{let t=e.state;ie.at=typeof t?.graview=="number"?t.graview:0,ie.at>ie.depth&&(ie.depth=ie.at),ie.tell()});var I=C(F(),1),at={profile:{trigger:"profile-button",pane:"profile",opens:"press",focus:"into",drawn:["shell","embed"]},problems:{trigger:"standing",pane:"problems",opens:"press",focus:"into",drawn:["shell","embed"]},places:{trigger:"app-places-open",pane:"app-places",opens:"press",focus:"into",drawn:["embed"]},here:{trigger:"here-open",pane:"here-list",opens:"press",focus:"into",drawn:["shell","embed","pages"]},activity:{trigger:"activity-button",pane:"activity",opens:"press",focus:"into",drawn:["shell","embed","pages"]},find:{trigger:"find-box",pane:"find-strip",opens:"typing",focus:"stays",drawn:["shell"]},districts:{trigger:"beyond-more",pane:"beyond-list",opens:"press",focus:"into",drawn:["shell","embed"]},acts:{trigger:null,pane:"context-menu",opens:"context-menu",focus:"into",drawn:["shell","embed"]},arrange:{trigger:"arrange-add",pane:"arrange-list",opens:"press",focus:"into",drawn:["pages"]},"studio-ask":{trigger:"studio-agent",pane:"studio-agent-panel",opens:"press",focus:"into",drawn:["studio"]}},Fo={position:"fixed",inset:"auto",margin:0,zIndex:zt("popover"),boxSizing:"border-box"},_e=6,se=8,Go=e=>typeof e.showPopover=="function";function Ne(e){try{return e.matches(":popover-open")}catch{return!1}}function Ko(e){if(typeof e=="function"){let o=e();return o?{left:o.x,right:o.x,top:o.y,bottom:o.y}:null}let t=e.current;if(!t||!t.isConnected)return null;let n=t.getBoundingClientRect();return{left:n.left,right:n.right,top:n.top,bottom:n.bottom}}function st(e,t,n={}){let o=Ko(t);if(!o)return;let r={width:document.documentElement.clientWidth||innerWidth,height:innerHeight},i=e.dataset.graviewDesignedHeight??=e.style.maxHeight;e.style.maxHeight=i;let a=e.getBoundingClientRect(),u=r.height-o.bottom-_e-se,l=o.top-_e-se,c=a.height<=u||u>=l,f=Math.max(96,Math.floor(c?u:l)),g=Math.min(a.height,f);a.height>f&&(e.style.maxHeight=i?`min(${i}, ${f}px)`:`${f}px`);let p=a.width,m=n.align==="start"?o.left:o.right-p,S=typeof t=="function"?null:t.current?.closest("[data-graview-embed]")?.getBoundingClientRect();S&&p<=S.right-S.left&&(m<S.left?m=o.left+p<=S.right?o.left:S.left:m+p>S.right&&(m=o.right-p>=S.left?o.right-p:S.right-p));let k=p>=r.width-2*se?Math.max(0,(r.width-p)/2):Math.max(se,Math.min(m,r.width-se-p)),h=c?o.bottom+_e:Math.max(se,o.top-_e-g);e.style.left=`${Math.round(k)}px`,e.style.top=`${Math.round(h)}px`}function Ln(e,t,n,o={}){let r=o.align??"end";(0,I.useLayoutEffect)(()=>{let i=e.current;if(!t||!i)return;if(Go(i)&&!Ne(i))try{i.showPopover(),jo()}catch{}let a=0,u=c=>{c?.target instanceof Node&&i.contains(c.target)||(cancelAnimationFrame(a),a=requestAnimationFrame(()=>st(i,n,{align:r})))};st(i,n,{align:r}),addEventListener("resize",u),addEventListener("scroll",u,!0);let l=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>u());return l?.observe(i),()=>{if(cancelAnimationFrame(a),removeEventListener("resize",u),removeEventListener("scroll",u,!0),l?.disconnect(),i.isConnected&&Ne(i))try{i.hidePopover()}catch{}}},[t,e,r])}var lt=new Set;function Bo(e){return lt.add(e),()=>lt.delete(e)}function jo(){for(let e of lt)if(!(!e.isConnected||!Ne(e)))try{e.hidePopover(),e.showPopover()}catch{}}var le=null,zo='button:not([disabled]), [href], input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), summary, [tabindex]:not([tabindex="-1"])';function qo(e){for(let t of e.querySelectorAll(zo))if(t.closest("[hidden]")===null&&getComputedStyle(t).visibility!=="hidden")return t;return e}var it=()=>{let e=document.activeElement;return e===null||e===document.body};function Uo(e,t={}){let{at:n,returnTo:o,onOpenChange:r}=t,i=t.popover!==!1,[a,u]=(0,I.useState)(!1),l=t.open??a,c=(0,I.useRef)(null),f=(0,I.useRef)(null),g=(0,I.useCallback)(w=>{c.current=w},[]),p=(0,I.useCallback)(w=>{f.current=w},[]),m=`graview-popover-${(0,I.useId)().replace(/:/g,"")}`,S=(0,I.useRef)({onOpenChange:r,returnTo:o,controlled:t.open!==void 0});S.current={onOpenChange:r,returnTo:o,controlled:t.open!==void 0};let k=(0,I.useCallback)(w=>{S.current.controlled||u(w),S.current.onOpenChange?.(w)},[]),h=(0,I.useCallback)(()=>{(document.querySelector(`[aria-controls="${m}"]`)??c.current??S.current.returnTo?.()??null)?.focus({preventScroll:!0})},[m]),v=(0,I.useCallback)(w=>{let x=f.current,R=typeof document>"u"?null:document.activeElement,N=R===null||R===document.body||x!==null&&x.contains(R);k(!1),!(!w||!N)&&(h(),requestAnimationFrame(()=>{it()&&h()}))},[k,h]);return Ln(f,i&&l,n??c,t.align?{align:t.align}:{}),(0,I.useEffect)(()=>{if(!i||!l)return;let w={name:e,close:()=>v(!1)};if(le&&le.close!==w.close&&le.close(),le=w,at[e].focus==="into"){let M=f.current;M&&!M.contains(document.activeElement)&&qo(M).focus({preventScroll:!0})}let x=M=>{M.key==="Escape"&&v(!0)},R=M=>{let b=M.target;if(!(b instanceof Node))return;let A=f.current;if(A?.contains(b)||c.current?.contains(b))return;let L=b instanceof Element?b.closest('[role="dialog"], [role="alertdialog"]'):null;L&&!(A&&L.contains(A))||(v(!1),at[e].focus==="into"&&requestAnimationFrame(()=>{(it()||A!==null&&A.contains(document.activeElement))&&h()}))},N=null,V=null,W=M=>{let b=M.target;if(!(b instanceof Element))return;let A=f.current,L=b.closest('[role="dialog"], [role="alertdialog"]');!L||A&&(A.contains(L)||L.contains(A))||(N=L,v(!1))};return document.addEventListener("keydown",x),document.addEventListener("pointerdown",R,!0),document.addEventListener("focusin",W),()=>{document.removeEventListener("keydown",x),document.removeEventListener("pointerdown",R,!0),document.removeEventListener("focusin",W);let M=N;M&&typeof MutationObserver<"u"&&(V?.disconnect(),V=new MutationObserver(()=>{M.isConnected||(V?.disconnect(),requestAnimationFrame(()=>{(it()||document.activeElement.closest("[hidden]")!==null)&&h()}))}),V.observe(document.body,{childList:!0,subtree:!0}),setTimeout(()=>V?.disconnect(),10*6e4)),le?.close===w.close&&(le=null)}},[i,l,e,v,h]),{open:l,setOpen:w=>w?k(!0):v(!0),toggle:()=>l?v(!0):k(!0),trigger:{ref:g,"aria-expanded":l,"aria-controls":m,"data-graview-popover-trigger":e},pane:{ref:p,id:m,popover:"manual",tabIndex:-1,"data-graview-popover":e,"data-graview-overlay":""}}}var _=C(F(),1),j=C(ve(),1),dt=new Set,Cn=!1;function ct(){for(let e of[...dt])e()}function $o(){Cn||typeof window>"u"||(Cn=!0,window.addEventListener("online",ct))}function Yo(e){let t,n=!1,o=!1,r,i=0,a=new Set,u=()=>{i+=1;for(let p of[...a])p()},l=p=>(a.add(p),()=>void a.delete(p)),c=()=>i,f=()=>void g().catch(()=>{});function g(){if(n)return Promise.resolve(t);if(r)return r;let p=e().then(m=>(t=m,n=!0,o=!1,r=void 0,dt.delete(f),u(),m),m=>{throw r=void 0,o=!0,dt.add(f),$o(),u(),m});return p.catch(()=>{}),r=p,p}return{load:g,prefetch:f,get current(){return t},get failed(){return o},part(p,m={}){let S=m.what??"This part";function k(w){(0,_.useSyncExternalStore)(l,c,c);let x=(0,_.useRef)(null),R=(0,_.useRef)(null),N=(0,_.useRef)(!1);return(0,_.useEffect)(()=>{o&&r===void 0&&f()},[]),n&&typeof document<"u"&&x.current!==null&&document.activeElement===x.current&&(N.current=!0),(0,_.useLayoutEffect)(()=>{if(!(!n||!N.current)){N.current=!1;for(let V=R.current?.nextElementSibling??null;V!==null;V=V.nextElementSibling){let W=V.matches(_n)?V:V.querySelector(_n);if(W instanceof HTMLElement){W.focus();return}}}}),n?(0,j.jsxs)(j.Fragment,{children:[N.current?(0,j.jsx)("span",{ref:R,hidden:!0}):null,p(t,w)]}):m.quiet?null:(0,j.jsx)(Qo,{what:S,button:x,...m.as?{as:m.as}:{}})}let h=(0,_.lazy)(()=>g().then(()=>({default:k}),()=>({default:k})));function v(w){let[x]=(0,_.useState)(()=>n||o);return(0,_.createElement)(x?k:h,w)}return v}}}var _n="button,a[href],input,select,textarea,[tabindex]:not([tabindex='-1'])";function Qo({what:e,button:t,as:n="p"}){let r=typeof navigator<"u"&&navigator.onLine===!1?`${e} will load when you're back online.`:`${e} didn't load.`;return(0,j.jsxs)(n,{"data-testid":"lazy-part-missing",style:{margin:0,fontSize:"0.875rem",color:"var(--graview-ink-muted)"},children:[(0,j.jsx)("span",{role:"status",children:r})," ",(0,j.jsx)("button",{ref:t,type:"button","data-testid":"lazy-part-retry",onClick:ct,style:{font:"inherit",fontWeight:600,color:"var(--graview-ink)",background:"none",border:"1px solid var(--graview-edge)",borderRadius:6,padding:"2px 10px"},children:"Try again"})]})}var He=C(F(),1);var Xo=(0,He.createContext)(null);var Nn=C(F(),1),Jo=(0,Nn.createContext)(!1);var Hn=C(F(),1),Zo=(0,Hn.createContext)(null);var Dn=C(F(),1),ut='button:not([disabled]), a[href], input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), summary, [tabindex]:not([tabindex="-1"])',pt=e=>e instanceof HTMLElement&&(e.matches(ut)||e.hasAttribute("tabindex")),he=e=>typeof e.checkVisibility=="function"?e.checkVisibility():e.getClientRects().length>0;function er(e,t){let n=l=>l.replace(/["\\]/g,"\\$&"),o=t.getAttribute("data-testid"),r=t.getAttribute("data-graview-pick"),i=t.getAttribute("aria-label"),a=o?`[data-testid="${n(o)}"]`:r?`[data-graview-pick="${n(r)}"]`:i?`${t.tagName.toLowerCase()}[aria-label="${n(i)}"]`:null;if(!a)return null;let u=e.querySelector(a);return u&&pt(u)&&he(u)?u:null}var tr=e=>e.isConnected&&pt(e)&&!e.matches(":disabled")&&e instanceof HTMLElement&&he(e);function Wn(e,t){let n=t?er(e,t):null;if(n)return n;let o=e.querySelector("[data-graview-view][tabindex]");if(o&&he(o))return o;for(let r of e.querySelectorAll(ut))if(he(r))return r;return pt(e)&&he(e)?e:null}function nr(e){(0,Dn.useEffect)(()=>{let t=e.current;if(!t||typeof MutationObserver>"u")return;let n=[],o=h=>{let v=h.target;if(v instanceof Element){n=[];for(let w=v;w&&w!==t.parentElement;w=w.parentElement)n.push(w)}},r=!1,i=!1,a=t.ownerDocument,u=()=>!i&&a.defaultView!==null,l=(h,v)=>void setTimeout(()=>u()&&v(),h),c=h=>void requestAnimationFrame(()=>u()&&h()),f=h=>{if(r=!1,i)return;let v=a.activeElement;if(!(!(v===null||v===a.body||v===a.documentElement)||n.length===0)){if(tr(n[0])){h&&n[0]instanceof HTMLElement&&n[0].focus({preventScroll:!0});return}for(let x of n.slice(1)){if(!x.isConnected)continue;let R=Wn(x,n[0]);if(R){R.focus({preventScroll:!0}),n=[];return}}}},g=(h,v=Date.now()+2500)=>{l(100,()=>{f(h);let w=a.activeElement;(w===null||w===a.body||w===a.documentElement)&&n.length>0&&Date.now()<v&&g(h,v)})},p=()=>{r||n.length===0||(r=!0,l(60,()=>c(()=>{f(!1),g(!1)})))},m=h=>{if(!(h instanceof KeyboardEvent&&!["Enter"," ","Escape"].includes(h.key))){if(!(h instanceof KeyboardEvent)){let v=h.target instanceof Element?h.target.closest(ut):null,w=a.activeElement,x=w===null||w===a.body||w===a.documentElement;if(v&&x&&t.contains(v)){n=[];for(let R=v;R&&R!==t.parentElement;R=R.parentElement)n.push(R);l(150,()=>c(()=>{f(!1),g(!1)}));return}}!(h instanceof KeyboardEvent)&&!(h.target instanceof Node&&n[0]?.contains(h.target))||l(150,()=>c(()=>{f(!0),g(!0)}))}},S=new MutationObserver(()=>{n.length>0&&!n[0].isConnected&&p()}),k=h=>{h.relatedTarget===null&&p()};return t.addEventListener("focusin",o),t.addEventListener("focusout",k),t.addEventListener("click",m),t.addEventListener("keydown",m),S.observe(t,{childList:!0,subtree:!0}),()=>{i=!0,t.removeEventListener("focusin",o),t.removeEventListener("focusout",k),t.removeEventListener("click",m),t.removeEventListener("keydown",m),S.disconnect()}},[e])}export{te as a,U as b,Ee as c,rr as d,ir as e,Qt as f,ar as g,Xt as h,$ as i,Jt as j,ge as k,je as l,sr as m,Yn as n,lr as o,dr as p,Pe as q,me as r,Me as s,cr as t,ur as u,pr as v,ke as w,ze as x,ne as y,gr as z,Qn as A,oe as B,Zt as C,X as D,en as E,Xn as F,mr as G,tn as H,qe as I,Ue as J,to as K,nn as L,no as M,rn as N,oo as O,ro as P,io as Q,fo as R,yo as S,Ye as T,co as U,uo as V,pn as W,Oe as X,po as Y,Eo as Z,Ro as _,An as $,ko as aa,ri as ba,Oo as ca,Y as da,Vo as ea,Le as fa,Io as ga,ot as ha,Xo as ia,Tn as ja,On as ka,Vn as la,Co as ma,_o as na,Jo as oa,Zo as pa,No as qa,Ho as ra,Wo as sa,ie as ta,nr as ua,Fo as va,Ne as wa,Bo as xa,Uo as ya,Yo as za};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as b,b as N,c as S}from"./chunk.DCIC3YHX.js";import{d as y}from"./chunk.6LJ66MB7.js";import{wa as m,xa as w}from"./chunk.NRRUGG22.js";import{Hb as x}from"./chunk.MKNXV4TM.js";import{a as C,b as h}from"./chunk.MRK6QJV5.js";import{b as g}from"./chunk.AJZBJBMO.js";var c=g(C(),1);var i=g(h(),1),P=6e3;function M(){let t=[],n=0,s=new Set,a=new Map,p,r=()=>{for(let e of[...s])e()},o=e=>{if(clearTimeout(a.get(e.id)),a.delete(e.id),e.kind!=="toast")return;let l=(e.actions?.length??0)+(e.action?1:0),f=e.timeout??(l>0?!1:P);f!==!1&&a.set(e.id,setTimeout(()=>p?.()?o(e):d(e.id),f))},d=e=>{clearTimeout(a.get(e)),a.delete(e),t.some(l=>l.id===e)&&(t=t.filter(l=>l.id!==e),r())},u=e=>{t=t.some(l=>l.id===e.id)?t.map(l=>l.id===e.id?e:l):[...t,e],o(e),r()};return{notify(e){let l=e.id??`notice-${++n}`;return u({...e,id:l,said:++n}),{id:l,dismiss:()=>d(l),update:f=>{let v=t.find(L=>L.id===l);v&&u({...v,...f,id:l,kind:v.kind,said:f.sentence!==void 0&&f.sentence!==v.sentence?++n:v.said})}}},dismiss:d,hold(e){p=e},list:()=>t,subscribe(e){return s.add(e),()=>s.delete(e)}}}var k={info:"var(--graview-accent)",good:"var(--graview-good)",warn:"var(--graview-warn)",bad:"var(--graview-bad)"};function T({notices:t,at:n,anchor:s,board:a}){let p=(0,c.useRef)(null),r=t.length>0;return(0,c.useLayoutEffect)(()=>{let o=p.current;if(!r||!o)return;if(typeof o.showPopover=="function"&&!m(o))try{o.showPopover()}catch{}let d=()=>(n==="top"?S:N)(o,s());d(),n==="foot"&&a.hold?.(()=>o.matches(":hover, :focus-within"));let u=w(o);addEventListener("resize",d),addEventListener("scroll",d,!0),n==="foot"&&addEventListener(b,d);let e=typeof ResizeObserver=="function"?new ResizeObserver(d):null;return e?.observe(o),()=>{if(u(),e?.disconnect(),removeEventListener("resize",d),removeEventListener("scroll",d,!0),removeEventListener(b,d),o.isConnected&&m(o))try{o.hidePopover()}catch{}}},[r,n,s,a]),r?(0,i.jsx)("div",{ref:p,popover:"manual",role:"region","aria-label":n==="top"?"Notices":"Messages","data-testid":n==="top"?"notices-banners":"notices-toasts","data-graview-offstage":"",style:{position:"fixed",inset:"auto",margin:0,padding:0,border:"none",background:"none",overflow:"visible",zIndex:x("toast"),width:"max-content",height:"auto",maxWidth:"min(560px, calc(100vw - 32px))",display:"grid",gap:8,color:"var(--graview-ink)"},children:t.map(o=>(0,i.jsx)(R,{notice:o,board:a},o.id))}):null}function R({notice:t,board:n}){let s=t.tone??"info",a=[...t.action?[t.action]:[],...t.actions??[]],p=()=>n.dismiss(t.id);return(0,i.jsxs)("div",{"data-testid":"notice","data-kind":t.kind,"data-tone":s,style:{boxSizing:"border-box",display:"flex",flexWrap:"wrap",alignItems:"center",gap:"8px 12px",padding:t.kind==="banner"?"8px 10px 8px 14px":"10px 12px 10px 14px",borderRadius:"var(--graview-radius, 12px)",borderTop:"1px solid var(--graview-edge)",borderRight:"1px solid var(--graview-edge)",borderBottom:"1px solid var(--graview-edge)",borderLeft:`3px solid ${k[s]}`,background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)",fontSize:"0.875rem",lineHeight:1.45},children:[(0,i.jsx)("span",{"aria-hidden":"true",style:{width:7,height:7,borderRadius:999,flex:"0 0 auto",background:k[s]}}),(0,i.jsx)("span",{style:{flex:"1 1 16rem",minWidth:0},children:t.sentence}),a.length>0?(0,i.jsx)("span",{style:{display:"flex",flexWrap:"wrap",gap:6},children:a.map((r,o)=>r.href!==void 0?(0,i.jsx)("a",{href:r.href,...r.target?{target:r.target,rel:"noopener"}:{},"data-testid":"notice-action",onClick:()=>{r.onSelect?.(),p()},style:{...H,...o===0?E:{}},children:r.label},r.label):(0,i.jsx)("button",{type:"button","data-testid":"notice-action",onClick:()=>{p(),r.onSelect?.()},style:{...H,...o===0?E:{}},children:r.label},r.label))}):null,(0,i.jsx)("button",{type:"button","data-testid":"notice-dismiss","aria-label":`Dismiss: ${t.sentence}`,title:"Dismiss",onClick:p,style:A,children:"\xD7"})]})}var H={display:"inline-flex",alignItems:"center",minHeight:28,padding:"2px 12px",borderRadius:9,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)",color:"var(--graview-ink)",font:"inherit",fontWeight:500,textDecoration:"none",cursor:"pointer"},E={background:"var(--graview-accent)",borderColor:"var(--graview-accent)",color:"var(--graview-accent-ink)"},A={minWidth:28,minHeight:28,padding:0,border:"none",background:"none",boxShadow:"none",color:"var(--graview-ink-muted)",fontSize:"1rem",cursor:"pointer"};function B({notices:t}){let n=t.reduce((d,u)=>!d||u.said>d.said?u:d,void 0),[s,a]=(0,c.useState)(""),[p,r]=(0,c.useState)(""),o=(0,c.useRef)(0);return(0,c.useEffect)(()=>{if(!n||n.said===o.current)return;o.current=n.said;let d=n.tone==="bad";(d?r:a)("");let u=setTimeout(()=>(d?r:a)(n.sentence),50);return()=>clearTimeout(u)},[n]),(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("div",{role:"status","aria-live":"polite","data-testid":"notices-said",style:y,children:s}),(0,i.jsx)("div",{role:"alert","data-testid":"notices-alarm",style:y,children:p})]})}var W=(0,c.createContext)(null);function F({board:t,anchor:n}){let s=(0,c.useSyncExternalStore)(t.subscribe,t.list,t.list);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(T,{notices:s.filter(a=>a.kind==="banner"),at:"top",anchor:n,board:t}),(0,i.jsx)(T,{notices:s.filter(a=>a.kind==="toast"),at:"foot",anchor:n,board:t}),(0,i.jsx)(B,{notices:s})]})}export{M as a,W as b,F as c};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function d(e,t){let a=e.batches();for(let i=a.length-1;i>=0;i--){let n=a[i];if(n.undone||n.ops.length===0||n.ops.every(o=>o.undoes!==void 0))continue;let c=n.author;if(!(c.kind==="human"&&(t?.id===void 0||c.id===void 0||c.id===t.id)))continue;let r=e.canUndo(n.id);if(!(!r.ok||!r.ops.every(o=>!o.mutation||e.permits(o.mutation,t).ok)))return{batch:n.id,intent:n.intent}}}function h(e,t,a){let i=d(e,t);return i&&e.batches().slice(a).some(n=>n.id===i.batch)?i:void 0}var f=e=>`Take back \u201C${e.intent}\u201D`;function m(e,t){let a=d(e,t);return a&&e.undo(a.batch,t?{author:t}:{}),a}function l(e){let t=e.target;return!e.defaultPrevented&&!e.altKey&&!e.shiftKey&&(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()==="z"&&!(t instanceof HTMLElement&&(t.isContentEditable||t.matches("input, textarea, select")))}export{d as a,h as b,f as c,m as d,l as e};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import{c as E,d as I}from"./chunk.2GBQJXJH.js";import"./chunk.ZJDRD6PO.js";import"./chunk.SNBIZ3B6.js";import"./chunk.6LJ66MB7.js";import"./chunk.NRRUGG22.js";import{Q as A,U as k}from"./chunk.MKNXV4TM.js";import{a as F,b as S}from"./chunk.MRK6QJV5.js";import{b as f}from"./chunk.AJZBJBMO.js";var v=f(F(),1);var a=f(S(),1),C=40,O=60;function D(l,i,p){return l.allNodes().filter(o=>o.kind===i).map(o=>o[p])}function G(l){if(l.length<2)return[];let i=[...l].sort((n,d)=>n-d),p=i[i.length-1]-i[0];if(p<=0)return[];let o=Math.max(1,10**Math.floor(Math.log10(p/4))),e=p/4>=o*5?o*5:o,r=n=>Math.round(n/e)*e;return[...new Set([.2,.4,.6,.8].map(n=>r(i[Math.floor(n*(i.length-1))])))].filter(n=>n>0)}function T(l,i,p){let o=p.far??[],e=new Map,r=new Set(o);for(let t of i.allNodes())r.has(t.kind)&&e.set(t.id,A(l.tryDefinition(t.kind),t));let n=[...e.entries()].map(([t,g])=>({id:t,label:g}));return(n.length<=C?n:n.map(t=>({end:t,ties:i.out(t.id).length+i.in(t.id).length})).sort((t,g)=>g.ties-t.ties||t.end.label.localeCompare(g.end.label)).slice(0,C).map(t=>t.end)).sort((t,g)=>t.label.localeCompare(g.label))}function R(l,i,p){let o=[];for(let e of p.filters)if(e.about==="is")for(let r of e.options??[])o.push({value:`is:${r}`,label:r,group:e.label,condition:{key:"is",value:r}});else if(e.about==="edge"){o.push({value:`${e.key}:*`,label:"anything",group:e.label,condition:{key:e.key,value:"*"}}),o.push({value:`${e.key}:none`,label:"nothing",group:e.label,condition:{key:e.key,value:"none"}});for(let r of T(l,i,e))o.push({value:`${e.key}:${r.id}`,label:r.label,group:e.label,condition:{key:e.key,value:r.id}})}else if(e.type==="date")for(let r of["before","after","on"])o.push({value:`${e.key}:${r}`,label:`${r}\u2026`,group:e.label,ask:{key:e.key,op:r,label:e.label}});else if(e.type==="number"){let r=l.tryDefinition(p.kind),n=G(D(i,p.kind,e.key).filter(d=>typeof d=="number"));for(let d of["at-most","at-least"])for(let t of d==="at-most"?n:[...n].reverse())o.push({value:`${e.key}:${d}:${t}`,label:`${d==="at-most"?"at most":"at least"} ${k(r,e.key,t)}`,group:e.label,condition:{key:e.key,value:`${d}:${t}`}})}else if(e.type==="text"){let r=[...new Set(D(i,p.kind,e.key).filter(n=>typeof n=="string"&&n.length>0&&!n.includes(",")))].sort((n,d)=>n.localeCompare(d));if(r.length>=2&&r.length<=O)for(let n of r)o.push({value:`${e.key}:${n}`,label:n,group:e.label,condition:{key:e.key,value:n}})}else if(e.type==="boolean")o.push({value:`${e.key}:true`,label:"yes",group:e.label,condition:{key:e.key,value:"true"}}),o.push({value:`${e.key}:false`,label:"no",group:e.label,condition:{key:e.key,value:"false"}});else for(let r of e.options??[])o.push({value:`${e.key}:${r}`,label:k(l.tryDefinition(p.kind),e.key,r),group:e.label,condition:{key:e.key,value:r}});return o}var H=["day","week","month","year","decade"];function K(l){let{which:i,schema:p,graph:o,offers:e,arrangement:r,set:n,toggle:d,has:t,done:g}=l,y=l.testId,h=(0,v.useRef)(null);(0,v.useEffect)(()=>{let u=h.current?.closest("[data-graview-popover]");!u||document.activeElement!==u||(u.querySelector('[aria-pressed="true"]')??u.querySelector("button, input"))?.focus({preventScroll:!0})},[]);let L=r.sort?e.sorts.find(u=>u.key===r.sort.by):void 0,P=r.group?e.groups.find(u=>u.key===r.group.by):void 0,M=I(L),m=e.natural?e.sorts.find(u=>u.key===e.natural.by):void 0,N=i==="filter"||i==="all"&&l.parts?.filter?R(p,o,e):[],w=u=>(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("p",{children:"Sort by"}),(0,a.jsx)(c,{testId:`${y}-sort-default`,value:"",on:!r.sort,onPress:()=>(n({sort:void 0}),u()),children:m?`As declared (${E(m.label)})`:"As they were added"}),e.sorts.map(s=>(0,a.jsx)(c,{value:s.key,on:r.sort?.by===s.key,onPress:()=>(n({sort:{by:s.key,direction:r.sort?.direction??"asc"}}),u()),children:s.label},s.key)),r.sort?(0,a.jsxs)("div",{role:"group","aria-label":"Order","data-testid":`${y}-direction`,children:[(0,a.jsx)("p",{"aria-hidden":"true",children:"Order"}),["asc","desc"].map(s=>(0,a.jsx)(c,{testId:`${y}-direction-${s}`,value:s,on:r.sort.direction===s,onPress:()=>(n({sort:{by:r.sort.by,direction:s}}),u()),children:M[s]},s))]}):null]}),x=u=>(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("p",{children:"Group by"}),(0,a.jsx)(c,{testId:`${y}-group-none`,value:"",on:!r.group,onPress:()=>(n({group:void 0}),u()),children:"Not grouped"}),e.groups.map(s=>(0,a.jsx)(c,{value:s.key,on:r.group?.by===s.key,onPress:()=>(n({group:{by:s.key}}),u()),children:s.label},s.key)),r.group&&P?.buckets?(0,a.jsxs)("div",{role:"group","aria-label":"How wide a group is","data-testid":`${y}-bucket`,children:[(0,a.jsx)("p",{"aria-hidden":"true",children:"Each group"}),H.map(s=>(0,a.jsx)(c,{testId:`${y}-bucket-${s}`,value:s,on:(r.group.bucket??"day")===s,onPress:()=>(n({group:{by:r.group.by,bucket:s}}),u()),children:`A ${s}`},s))]}):null]}),$=u=>(0,a.jsx)(z,{entries:N,has:t,testId:y,onToggle:s=>(d(s),u())}),b=l.parts??{sort:!0,group:!0,filter:!0};return(0,a.jsxs)("div",{ref:h,style:{display:"contents"},children:[(0,a.jsx)("style",{children:W}),i==="sort"?w(g):i==="group"?x(g):i==="filter"?$(g):(0,a.jsxs)(a.Fragment,{children:[b.sort?(0,a.jsx)("div",{role:"group","aria-label":"Sort",children:w(g)}):null,b.group?(0,a.jsx)("div",{role:"group","aria-label":"Group",children:x(g)}):null,b.filter?(0,a.jsx)("div",{role:"group","aria-label":"Filter",children:$(g)}):null]})]})}function c({value:l,on:i,onPress:p,testId:o,children:e}){return(0,a.jsx)("button",{type:"button",className:"graview-arrange-item",value:l,"data-value":l,"aria-pressed":i,onClick:p,...o?{"data-testid":o}:{},children:e})}function z({entries:l,has:i,testId:p,onToggle:o}){let[e,r]=(0,v.useState)(null);if(e)return(0,a.jsx)(B,{ask:e,testId:p,onDay:d=>o({key:e.key,value:`${e.op}:${d}`}),onCancel:()=>r(null)});let n=[...new Set(l.map(d=>d.group))];return(0,a.jsx)(a.Fragment,{children:n.map(d=>(0,a.jsxs)("div",{role:"group","aria-label":d,children:[(0,a.jsx)("p",{"aria-hidden":"true",children:d}),l.filter(t=>t.group===d).map(t=>(0,a.jsx)(c,{value:t.value,on:t.condition?i(t.condition):!1,onPress:()=>t.condition?o(t.condition):r(t.ask),children:t.label},t.value))]},d))})}function B({ask:l,testId:i,onDay:p,onCancel:o}){let[e,r]=(0,v.useState)(""),n=/^\d{4}-\d{2}-\d{2}$/.test(e)&&Number(e.slice(0,4))>=1e3,d=()=>{n&&p(e)};return(0,a.jsxs)("div",{role:"group","aria-label":`${l.label} ${l.op} which day`,"data-testid":`${i}-ask-day`,className:"graview-arrange-ask",children:[(0,a.jsx)("p",{"aria-hidden":"true",children:`${l.label} ${l.op}`}),(0,a.jsx)("input",{type:"date","data-testid":`${i}-day`,"aria-label":`${l.label} ${l.op} which day`,autoFocus:!0,value:e,onChange:t=>r(t.target.value),onKeyDown:t=>{t.key==="Enter"?(t.preventDefault(),d()):t.key==="Escape"&&(t.preventDefault(),t.stopPropagation(),t.nativeEvent.stopImmediatePropagation(),o())}}),(0,a.jsxs)("span",{children:[(0,a.jsx)("button",{type:"button","data-testid":`${i}-day-add`,disabled:!n,onClick:d,children:"Add"}),(0,a.jsx)("button",{type:"button",onClick:o,children:"Never mind"})]})]})}var W=`
|
|
2
|
-
.graview-arrange-list{display:grid;align-content:start;width:min(300px,calc(100vw - 24px));height:auto;max-height:min(70vh,520px);overflow:auto;margin:0;padding:6px;border-radius:10px;border:1px solid var(--graview-edge);background:var(--graview-float);box-shadow:var(--graview-lift-high);color:var(--graview-ink);font-size:.875rem;line-height:1.3}
|
|
3
|
-
.graview-arrange-list [role=group]{display:grid}
|
|
4
|
-
.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)}
|
|
5
|
-
.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}
|
|
6
|
-
.graview-arrange-item::before{content:"";flex:0 0 12px}
|
|
7
|
-
.graview-arrange-item[aria-pressed=true]{font-weight:600}
|
|
8
|
-
.graview-arrange-item[aria-pressed=true]::before{content:"\u2713";color:var(--graview-accent)}
|
|
9
|
-
.graview-arrange-item:hover{background:color-mix(in srgb,var(--graview-ink) 7%,transparent)}
|
|
10
|
-
.graview-arrange-ask{display:grid;gap:8px;padding:0 8px 8px}
|
|
11
|
-
.graview-arrange-ask p{margin:8px 0 0}
|
|
12
|
-
.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)}
|
|
13
|
-
.graview-arrange-ask span{display:flex;gap:8px}
|
|
14
|
-
.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}
|
|
15
|
-
.graview-arrange-ask button:disabled{opacity:.5;cursor:default}
|
|
16
|
-
`;export{K as ArrangeLists,C as FAR_ENDS,R as filterEntries,G as roundSteps};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as y}from"./chunk.BCBH6WJF.js";import{B as f,Ca as p,Q as d,za as m}from"./chunk.MKNXV4TM.js";function P(n){let e=n.indexOf("{"),t=n.indexOf("["),a=t!==-1&&(e===-1||t<e)?t:e;if(a===-1)return;let r=n[a],i=r==="["?"]":"}",o=0,l=!1,s=!1;for(let u=a;u<n.length;u++){let c=n[u];if(l){s?s=!1:c==="\\"?s=!0:c==='"'&&(l=!1);continue}if(c==='"')l=!0;else if(c===r)o+=1;else if(c===i&&(o-=1,o===0))try{return JSON.parse(n.slice(a,u+1))}catch{return}}}function g(n,e){let t;try{t=n.mutation(e.mutation)}catch{return e}let a={...e.args},r=!1;for(let i of y(t.input)){if(i.control!=="node")continue;let o=a[i.name];if(typeof o!="string"||o.length===0||n.graph.getNode(o))continue;let l=o.trim().toLowerCase(),s=[...n.graph.allNodes()].filter(u=>(i.kinds.includes("*")||i.kinds.includes(u.kind))&&d(n.schema.tryDefinition(u.kind),u).trim().toLowerCase()===l);s.length===1&&(a[i.name]=s[0].id,r=!0)}return r?{...e,args:a}:e}function x(n,e,t){let a=t===void 0?null:new Set(t),r=[];for(let i of e){if(typeof i.mutation!="string")continue;let o=!0;try{n.mutation(i.mutation)}catch{o=!1}o?a&&!a.has(i.mutation)&&r.push({proposal:i,why:"not-allowed"}):r.push({proposal:i,why:"unknown"})}return r}function C(n,e,t){let a=t===void 0?null:new Set(t);return e.filter(r=>{if(typeof r.mutation!="string"||a&&!a.has(r.mutation))return!1;try{n.mutation(r.mutation)}catch{return!1}return r.args!==null&&typeof r.args=="object"})}function b(n,e){let t=n.allMutations().find(l=>l.name===e.mutation);if(t?.describe){let l=g(n,e),s=t.input.safeParse?.(l.args);if(s?.success)try{return t.describe(s.data,n.graph)}catch{}}let a=t?.subject?.arg,r=a?e.args[a]:void 0,i=typeof r=="string"?n.graph.getNode(r):void 0,o=t?.title??e.mutation;return i?`${o} \u2014 ${d(n.schema.tryDefinition(i.kind),i)}`:o}function A(n,e){let t=n.allMutations().find(o=>o.name===e.mutation);if(!t)return[];e=g(n,e);let a=t.input.shape??{},r=m(t.input),i=[];for(let o of Object.keys(a)){if(k(a[o]))continue;let l=e.args[o],s=r.find(c=>c.name===o);l!=null&&l!==""&&(!s||typeof l!="string"||n.graph.getNode(l)!==void 0)||i.push({name:o,...s?{kinds:s.kinds}:{},...s?{candidates:s.kinds.includes("*")?n.graph.allNodes().map(c=>c.id):s.kinds.flatMap(c=>n.graph.nodesOfKind(c).map(h=>h.id))}:{},shape:p(t.input,o)})}return i}function k(n){let e=f(n)?.type;return e==="optional"||e==="default"||e==="nullable"}export{P as a,g as b,x as c,C as d,b as e,A as f};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as y}from"./chunk.EYF6ONTA.js";import{a as f,d as g}from"./chunk.6LJ66MB7.js";import{za as m}from"./chunk.NRRUGG22.js";import{$ as p}from"./chunk.MKNXV4TM.js";import{a as R,b as c}from"./chunk.MRK6QJV5.js";import{b as u}from"./chunk.AJZBJBMO.js";var s=u(R(),1);var r=u(c(),1),S,h=()=>S??=m(f(()=>import("./chunk.IBGO4BUF.js")));function L(e){let[n,t]=(0,s.useState)(()=>h().current);return(0,s.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,s.useMemo)(()=>t?t.withLines(e,n):n,[t,e,n])}function I(e,n){let t=L(n.some(i=>i.shape));return(0,s.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,o=i==="kind"?d?x(n,d):void 0:i==="record"?e.record:void 0,k=i==="kind"&&o?`${o}: ${e.said}`:i==="record"&&o?`${o} \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,o?(0,r.jsxs)("span",{"data-graview-rule-head":"",style:{fontWeight:600,marginRight:i==="record"||a?0:"0.6em"},children:[o,i==="record"&&!a?(0,r.jsx)("span",{style:{color:"var(--graview-ink-faint)",fontWeight:400},children:" \u2014 "}):null]}):null,a&&o?(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.label:void 0}export{D as a,I as b,M as c,b as d,C as e,z as f};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as f,d as y}from"./chunk.6LJ66MB7.js";import{_ as m,za as h}from"./chunk.NRRUGG22.js";import{a as k,b as u}from"./chunk.MRK6QJV5.js";import{b as g}from"./chunk.AJZBJBMO.js";var p=g(k(),1);var n=g(u(),1);var w={default:{background:"var(--graview-panel, #ffffff)",color:"var(--graview-ink, #1a1a1a)"},muted:{background:"var(--graview-panel-muted, #f7f5f1)",color:"var(--graview-ink, #1a1a1a)"},warning:{background:"var(--graview-panel-warning, #fdf3ec)",color:"var(--graview-ink, #1a1a1a)"}},R={color:"var(--graview-ink-muted, #55514a)"},N={color:"var(--graview-ink-faint, #625d55)"};function z(e){let[i,t]=(0,p.useState)(!1);return(0,p.useEffect)(()=>{let a=e.current;if(!a||typeof ResizeObserver>"u")return;let o=()=>t(a.scrollHeight>a.clientHeight+1||a.scrollWidth>a.clientWidth+1);o();let d=new ResizeObserver(o);d.observe(a);for(let l of a.children)d.observe(l);return()=>d.disconnect()}),i}function C({level:e,style:i,children:t}){if(e===void 0)return(0,n.jsx)("strong",{style:i,children:t});let a=`h${e}`;return(0,n.jsx)(a,{style:{margin:0,...i},children:t})}function T({title:e,subtitle:i,meta:t,selected:a,tone:o="default",children:d,style:l,fit:s=!1,variant:b,heading:S}){let c=(0,p.useRef)(null),v=z(c),P=m(),r=(b??(P==="fullscreen"?"page":"card"))==="page";return(0,n.jsxs)("div",{"data-graview-primitive":"panel","data-graview-variant":r?"page":"card","data-selected":a||void 0,style:{display:"flex",flexDirection:"column",gap:r?12:"var(--graview-gap, 7px)",height:r||s?"auto":"100%",maxHeight:r?"none":"100%",padding:r?0:"var(--graview-pad, 15px)",boxSizing:"border-box",borderRadius:r?0:"var(--graview-radius, 12px)",border:r?"none":`1px solid ${a?"var(--graview-accent, #2f6f5e)":"var(--graview-edge, #e4e0d8)"}`,boxShadow:r?"none":a?"0 0 0 1px var(--graview-accent-dim), var(--graview-lift-low)":"var(--graview-lift-low)",overflow:r?"visible":"hidden",...w[o],...r?{background:"transparent"}:{},"--graview-panel-bg":w[o].background,...l},children:[o==="warning"?(0,n.jsx)("span",{"data-graview-broken":"",style:y,children:"Implicated in a problem."}):null,e===void 0?null:(0,n.jsxs)("div",{style:{display:"flex",alignItems:"baseline",flexWrap:"wrap",gap:8,minWidth:0},children:[o==="warning"?(0,n.jsx)("span",{"aria-hidden":"true",title:"Implicated in a problem",style:{color:"var(--graview-warn)",flex:"0 0 auto"},children:"\u26A0"}):null,(0,n.jsx)(C,{level:S,style:{fontFamily:"var(--graview-font-display, inherit)",fontSize:r?"1.5625rem":"0.9375rem",lineHeight:r?1.15:1.25,fontWeight:r?600:560,letterSpacing:r?"-0.012em":"0.005em",minWidth:0,overflowWrap:"anywhere"},children:e}),t===void 0?null:(0,n.jsx)("span",{style:{marginLeft:"auto",fontSize:"0.75rem",letterSpacing:"0.08em",textTransform:"uppercase",minWidth:0,overflowWrap:"anywhere",...N},children:t})]}),i===void 0?null:(0,n.jsx)("div",{style:{fontSize:r?"0.90625rem":"0.8125rem",lineHeight:1.5,...R},children:i}),(0,n.jsx)("div",{ref:c,className:r?void 0:"graview-scroll",...v&&!r?{tabIndex:0,role:"region",...typeof e=="string"?{"aria-label":e}:{}}:{},style:{display:"flex",flexDirection:"column",gap:r?22:"var(--graview-gap, 7px)",flex:"1 1 auto",...r?{overflow:"visible"}:{}},"data-graview-overflowing":v&&!r?"":void 0,children:d})]})}function x({label:e,hue:i,selected:t,title:a,pickId:o,emphasis:d}){let l=typeof e=="string"?e:void 0,s=i===void 0?void 0:Math.round(i);return(0,n.jsxs)("span",{"data-graview-primitive":"chip","data-selected":t||void 0,"data-graview-pick":o,"data-graview-emphasis":d,title:a??l,style:{cursor:o?"pointer":void 0,display:"inline-flex",alignItems:"center",alignSelf:"flex-start",minHeight:24,boxSizing:"border-box",padding:"3px 9px",borderRadius:6,fontSize:"0.8125rem",lineHeight:1.5,whiteSpace:"nowrap",maxWidth:"min(28ch, 100%)",overflow:"hidden",letterSpacing:"0.01em",border:`1px solid ${t?"var(--graview-accent)":s===void 0?"var(--graview-edge)":`hsl(${s} 55% var(--graview-tint-lightness) / 0.45)`}`,background:s===void 0?"var(--graview-panel-muted)":`hsl(${s} 55% var(--graview-tint-lightness) / calc(var(--graview-tint-alpha) * 0.65))`,color:"var(--graview-ink, #1a1a1a)",boxShadow:t?"0 0 14px -4px var(--graview-accent)":void 0},children:[s===void 0?null:(0,n.jsx)("span",{"aria-hidden":"true",style:{width:9,height:6,clipPath:"polygon(50% 0, 100% 50%, 50% 100%, 0 50%)",flex:"0 0 auto",marginRight:6,background:`hsl(${s} 55% var(--graview-tint-lightness) / 0.9)`}}),(0,n.jsx)("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e})]})}function H({items:e,max:i=8,selectedIds:t=[],pick:a=!1}){let o=e.slice(0,i),d=e.length-o.length;return(0,n.jsxs)("div",{"data-graview-primitive":"roster",style:{display:"flex",flexWrap:"wrap",gap:6,alignContent:"flex-start"},children:[o.map(l=>(0,n.jsx)(x,{label:l.label,...l.hue===void 0?{}:{hue:l.hue},...a?{pickId:l.id}:{},...l.emphasis===void 0?{}:{emphasis:l.emphasis},selected:t.includes(l.id)},l.id)),d>0?(0,n.jsx)(x,{label:`+${d} more`}):null]})}function L({label:e,count:i,items:t,onExpand:a,flagged:o}){return(0,n.jsx)(T,{title:e,meta:o?`\u26A0 ${i}`:i,tone:o?"warning":"muted",style:a?{cursor:"zoom-in"}:void 0,children:t&&t.length>0?(0,n.jsx)(H,{items:t,max:6,pick:!0}):null})}var W=h(f(()=>import("./chunk.FP27W5MU.js"))),O=W.part((e,i)=>e.drawFiles(i),{quiet:!0});export{T as a,x as b,H as c,L as d,O as e};
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import{A as he,B as ke,C as ta,D as At,E as pe,F as na,G as aa,H as L,I as De,J as Lt,K as ra,L as Tt,M as it,N as ia,O as U,P as J,Q as Mt,a as G,b as ye,c as q,d as Qn,e as Pe,f as Ne,g as D,h as ne,i as Y,j as k,k as _,l as F,m as X,n as tt,o as ee,p as Xn,q as nt,r as at,s as I,t as Ce,u as Zn,v as rt,w as le,x as ea,y as de,z as Rt}from"./chunk.4TUNX4WM.js";import{b as et,d as V}from"./chunk.7S22MBNN.js";import{a as _n,d as Yn,e as Jn}from"./chunk.ONDILMIX.js";import{a as Un,e as jn}from"./chunk.J6CBMLGR.js";import{a as Ct}from"./chunk.TBG2QBOS.js";import{a as Ze,b as qn}from"./chunk.BCBH6WJF.js";import{a as Pt,b as In,d as Hn,f as zn,g as Bn,h as Gn,k as Xe}from"./chunk.A73BXXE4.js";import{a as Na}from"./chunk.IKT7JQUW.js";import{h as $n,i as En}from"./chunk.ISRS7GOT.js";import{e as Wn,i as Vn}from"./chunk.DCIC3YHX.js";import{o as bt}from"./chunk.WHTNSETN.js";import{c as Fn,d as On,j as We}from"./chunk.46KUPBQC.js";import{a as Qe,b as Ln,c as Tn,e as St,f as Mn}from"./chunk.PWHJHFC4.js";import{e as xe}from"./chunk.Q3HVA6L4.js";import{f as Kn}from"./chunk.2GBQJXJH.js";import{b as Nn,c as xt,d as Dn}from"./chunk.SNBIZ3B6.js";import{a as wn,c as An}from"./chunk.6LJ66MB7.js";import{$ as bn,B as He,V as kn,X as Sn,aa as xn,ea as se,ia as Pn,ka as Ee,la as Cn,ua as Rn,x as vn}from"./chunk.NRRUGG22.js";import{$ as be,Ga as ln,Ha as dn,Hb as fn,Ja as pn,O as $e,P as _e,Q as re,R as Zt,T as ie,V as en,X as tn,Xa as cn,Xb as kt,Ya as gn,Yb as yn,_ as nn,_a as un,aa as an,ab as Ye,ac as hn,ba as rn,bb as mn,db as Je,la as vt,ma as on,ra as sn}from"./chunk.MKNXV4TM.js";import{a as ve,b as B}from"./chunk.MRK6QJV5.js";import{b as $}from"./chunk.AJZBJBMO.js";function oa(t,e,n={}){let r=t.graph.getNode(e);if(!r)return;let i=t.schema.tryDefinition(r.kind),a=s=>re(t.schema.tryDefinition(s.kind),s),d=new Map;for(let s of t.graph.allEdges()){let l=s.from===e?"out":s.to===e?"in":null;if(!l)continue;let o=l==="out"?s.to:s.from,c=t.graph.getNode(o);if(!c)continue;let u=(l==="out"?i:t.schema.tryDefinition(c.kind))?.edges?.[s.kind],g=l==="in"?u?.inverse??u?.description:u?.description,m=`${s.kind}|${l}|${g??""}`;(d.get(m)??(()=>{let E={edgeKind:s.kind,direction:l,...g?{description:g}:{},targets:[]};return d.set(m,E),E})()).targets.push({id:c.id,kind:c.kind,label:a(c)})}return{id:e,kind:r.kind,label:a(r),fields:an(We(t.schema,t.graph,r),i),violations:vt(t.violations(n.context),[e]),actions:Ct(t,[e],{focus:e,...n.principal?{principal:n.principal}:{},...n.context?{context:n.context}:{}}),links:[...d.values()].map(s=>{let l=_e(s.targets.flatMap(o=>{let c=t.graph.getNode(o.id);return c?[c]:[]}),o=>t.schema.tryDefinition(o));return{...s,targets:[...s.targets].map(o=>l.has(o.id)?{...o,apart:l.get(o.id)}:o).sort((o,c)=>o.label.localeCompare(c.label))}})}}function Re(t,e,n={}){return{kind:e,members:t.graph.nodesOfKind(e),actions:Ct(t,[],{kindSelection:[e],...n.principal?{principal:n.principal}:{},...n.context?{context:n.context}:{}})}}function sa(t,e){let n=(a,d)=>`${a}|${JSON.stringify(d)}`,r=new Map;for(let a of[...t.affordances,...t.withheld]){if(a.provider!=="invariant")continue;let d=n(a.mutation,a.args);r.has(d)||r.set(d,a.rank??Number.MAX_SAFE_INTEGER)}let i=Number.MAX_SAFE_INTEGER;return[...e].map((a,d)=>({repair:a,declared:d})).sort((a,d)=>(r.get(n(a.repair.mutation,a.repair.args??{}))??i)-(r.get(n(d.repair.mutation,d.repair.args??{}))??i)||a.declared-d.declared).map(a=>a.repair)}function Ae(t){let e=t.schema.kinds.map(i=>({kind:i,plural:tn(t.schema,i),count:t.graph.nodesOfKind(i).length})),n=new Map;for(let i of t.graph.allEdges()){let a=t.graph.getNode(i.from),d=t.graph.getNode(i.to);if(!a||!d)continue;let s=`${i.kind}|${a.kind}|${d.kind}`;n.set(s,(n.get(s)??0)+1)}let r=[];for(let{kind:i}of e){let a=t.schema.tryDefinition(i)?.edges??{};for(let[d,s]of Object.entries(a)){let l=s.to==="*"||s.to===void 0?(()=>{let o=[...n.keys()].filter(c=>c.startsWith(`${d}|${i}|`)).map(c=>c.split("|")[2]);return o.length>0?o:["*"]})():s.to;for(let o of l)r.push({edgeKind:d,from:i,to:o,...s.description?{description:s.description}:{},...s.inverse?{inverse:s.inverse}:{},count:n.get(`${d}|${i}|${o}`)??0})}}return{kinds:e,relations:r}}var Te=$(ve(),1);var Ft=$(ve(),1),S=$(B(),1),Da=`
|
|
2
|
-
form:where([data-graview-part="form"]) {
|
|
3
|
-
/* A grid item of the section above it and a grid container for the
|
|
4
|
-
fields below: both halves are allowed to be narrower than what is in
|
|
5
|
-
them, or a big enough text size pushes the page sideways. See the note
|
|
6
|
-
on \`column\` in pages.tsx. */
|
|
7
|
-
display: grid;
|
|
8
|
-
grid-template-columns: minmax(0, 1fr);
|
|
9
|
-
min-width: 0;
|
|
10
|
-
gap: 12px;
|
|
11
|
-
}
|
|
12
|
-
label:where([data-graview-part="field"]) {
|
|
13
|
-
display: grid;
|
|
14
|
-
/* A track the width it was given: see the note on \`column\` in pages.tsx. */
|
|
15
|
-
grid-template-columns: minmax(0, 1fr);
|
|
16
|
-
min-width: 0;
|
|
17
|
-
gap: 4px;
|
|
18
|
-
}
|
|
19
|
-
label:where([data-graview-part="field"][data-graview-field="boolean"]) {
|
|
20
|
-
grid-auto-flow: column;
|
|
21
|
-
justify-content: start;
|
|
22
|
-
align-items: center;
|
|
23
|
-
}
|
|
24
|
-
span:where([data-graview-part="label"]),
|
|
25
|
-
legend:where([data-graview-part="label"]),
|
|
26
|
-
p:where([data-graview-part="unasked"]) {
|
|
27
|
-
font-size: 0.8125rem;
|
|
28
|
-
color: var(--graview-ink-muted);
|
|
29
|
-
}
|
|
30
|
-
p:where([data-graview-part="unasked"]) { margin: 0; }
|
|
31
|
-
input:where([data-graview-part="control"]:not([type="checkbox"])),
|
|
32
|
-
select:where([data-graview-part="control"]) {
|
|
33
|
-
font: inherit;
|
|
34
|
-
/* A TARGET IN EVERY ENGINE, not only in the one it was measured in.
|
|
35
|
-
Padding and line height alone came to 24 in Chromium and to 22 in
|
|
36
|
-
WebKit, which has its own intrinsic metrics for a \`select\` and rounds
|
|
37
|
-
nothing up for anybody. So every picker on the routed face was under
|
|
38
|
-
the WCAG 2.2 minimum in the browser iOS ships, and the check that says
|
|
39
|
-
so (\`verify-pages\`' \`bigEnoughToHit\`) only ever ran there through
|
|
40
|
-
\`pnpm engines\`. */
|
|
41
|
-
min-height: 24px;
|
|
42
|
-
/* NEVER WIDER THAN ITS FIELD. A select is as wide as its longest option,
|
|
43
|
-
and a picker over 320 vehicles ("2027 Mercedes-Benz GLE AMG 53 4MATIC+
|
|
44
|
-
Coupe") was 618 pixels on a 390 phone, and the whole page scrolled
|
|
45
|
-
sideways. It shrinks to its track and cuts the option inside its box. */
|
|
46
|
-
min-width: 0;
|
|
47
|
-
max-width: 100%;
|
|
48
|
-
text-overflow: ellipsis;
|
|
49
|
-
box-sizing: border-box;
|
|
50
|
-
padding: 7px 10px;
|
|
51
|
-
border-radius: 8px;
|
|
52
|
-
border: 1px solid var(--graview-edge);
|
|
53
|
-
background: var(--graview-panel);
|
|
54
|
-
color: var(--graview-ink);
|
|
55
|
-
}
|
|
56
|
-
/* A PICKER THAT STILL LOOKS LIKE ONE.
|
|
57
|
-
WebKit ignores an author's padding and minimum height on a \`select\`
|
|
58
|
-
while the native appearance is on \u2014 so every picker on the routed face
|
|
59
|
-
came out 22 pixels tall in the browser iOS ships, under the 24 WCAG 2.2
|
|
60
|
-
asks for, while the same element measured 35 in Chromium. Turning the
|
|
61
|
-
appearance off is what makes the box the size it was asked to be, and it
|
|
62
|
-
takes the platform's chevron with it; the chevron is put back, in the ink
|
|
63
|
-
the scheme is already using. */
|
|
64
|
-
span:where([data-graview-part="picker"]) {
|
|
65
|
-
position: relative;
|
|
66
|
-
display: grid;
|
|
67
|
-
min-width: 0;
|
|
68
|
-
}
|
|
69
|
-
span:where([data-graview-part="picker"]) > select:where([data-graview-part="control"]) {
|
|
70
|
-
appearance: none;
|
|
71
|
-
padding-right: 28px;
|
|
72
|
-
}
|
|
73
|
-
span:where([data-graview-part="chevron"]) {
|
|
74
|
-
position: absolute;
|
|
75
|
-
right: 10px;
|
|
76
|
-
top: 50%;
|
|
77
|
-
transform: translateY(-50%);
|
|
78
|
-
font-size: 0.75rem;
|
|
79
|
-
line-height: 1;
|
|
80
|
-
color: var(--graview-ink-muted);
|
|
81
|
-
pointer-events: none;
|
|
82
|
-
}
|
|
83
|
-
fieldset:where([data-graview-part="group"]) {
|
|
84
|
-
display: grid;
|
|
85
|
-
gap: 10px;
|
|
86
|
-
border: 1px solid var(--graview-edge);
|
|
87
|
-
border-radius: 10px;
|
|
88
|
-
padding: 12px;
|
|
89
|
-
}
|
|
90
|
-
fieldset:where([data-graview-part="group"][data-graview-field="list"]) { gap: 8px; }
|
|
91
|
-
div:where([data-graview-part="item"]) {
|
|
92
|
-
display: flex;
|
|
93
|
-
gap: 8px;
|
|
94
|
-
align-items: end;
|
|
95
|
-
}
|
|
96
|
-
button:where([data-graview-part="add"]),
|
|
97
|
-
button:where([data-graview-part="submit"]) { justify-self: start; }
|
|
98
|
-
p:where([data-graview-part="refused"]) {
|
|
99
|
-
margin: 0;
|
|
100
|
-
color: var(--graview-warn);
|
|
101
|
-
font-size: 0.875rem;
|
|
102
|
-
}
|
|
103
|
-
`;function la({children:t}){return(0,S.jsxs)("span",{"data-graview-part":"picker",children:[t,(0,S.jsx)("span",{"aria-hidden":"true","data-graview-part":"chevron",children:"\u25BE"})]})}var Ia=t=>({label:ie(t),option:e=>e});function ot({store:t,spec:e,value:n,onChange:r,prefilled:i,open:a,words:d=Ia}){if(e.name in i&&e.control!=="group"&&e.control!=="variant")return null;let s=e.control==="node"&&!e.kinds.includes("*")?e.kinds.map(o=>ie(be(t.schema.tryDefinition(o),o))).join(" or "):d(e.name).label,l=s+(e.optional||e.control==="boolean"?"":" *");switch(e.control){case"text":case"date":return e.control==="text"&&e.long?(0,S.jsxs)("label",{"data-graview-part":"field","data-graview-field":"text",children:[(0,S.jsx)("span",{"data-graview-part":"label",children:l}),(0,S.jsx)("textarea",{name:e.name,required:!e.optional,rows:6,value:typeof n=="string"?n:"",onChange:o=>r(o.target.value),"data-graview-part":"control",style:{fieldSizing:"content",minHeight:"7.5em",resize:"vertical",font:"inherit",lineHeight:1.5}})]}):(0,S.jsxs)("label",{"data-graview-part":"field","data-graview-field":e.control,children:[(0,S.jsx)("span",{"data-graview-part":"label",children:l}),(0,S.jsx)("input",{type:e.control==="date"?e.time?"datetime-local":"date":"text",name:e.name,required:!e.optional,value:typeof n=="string"?n:"",onChange:o=>r(o.target.value),"data-graview-part":"control"})]});case"number":return(0,S.jsxs)("label",{"data-graview-part":"field","data-graview-field":e.control,children:[(0,S.jsx)("span",{"data-graview-part":"label",children:l}),(0,S.jsx)("input",{type:"number",name:e.name,required:!e.optional,...e.min===void 0?{}:{min:e.min},...e.max===void 0?{}:{max:e.max},...e.step===void 0?{}:{step:e.step},value:typeof n=="number"?n:"",onChange:o=>r(o.target.value===""?void 0:Number(o.target.value)),"data-graview-part":"control"})]});case"boolean":return(0,S.jsxs)("label",{"data-graview-part":"field","data-graview-field":"boolean",children:[(0,S.jsx)("input",{type:"checkbox",name:e.name,checked:n===!0,onChange:o=>r(o.target.checked),"data-graview-part":"control"}),(0,S.jsx)("span",{"data-graview-part":"label",children:l})]});case"choice":return(0,S.jsxs)("label",{"data-graview-part":"field","data-graview-field":e.control,children:[(0,S.jsx)("span",{"data-graview-part":"label",children:l}),(0,S.jsx)(la,{children:(0,S.jsxs)("select",{name:e.name,required:!e.optional,value:typeof n=="string"?n:"",onChange:o=>r(o.target.value||void 0),"data-graview-part":"control",children:[(0,S.jsx)("option",{value:"",children:"\u2014"}),(e.options??[]).map(o=>(0,S.jsx)("option",{value:o,children:d(e.name).option(o)},o))]})})]});case"node":{let o=a.find(m=>m.name===e.name)?.candidates,c=new Set(Object.values(i).filter(m=>typeof m=="string")),f=(e.kinds.includes("*")?[...t.graph.allNodes()]:e.kinds.flatMap(m=>t.graph.nodesOfKind(m))).filter(m=>!c.has(m.id)),u=o?o.map(m=>t.graph.getNode(m)).filter(m=>m!==void 0):f,g=_e(u,m=>t.schema.tryDefinition(m));return(0,S.jsxs)("label",{"data-graview-part":"field","data-graview-field":e.control,children:[(0,S.jsx)("span",{"data-graview-part":"label",children:l}),(0,S.jsx)(la,{children:(0,S.jsxs)("select",{name:e.name,required:!e.optional,value:typeof n=="string"?n:"",onChange:m=>r(m.target.value||void 0),"data-graview-part":"control",children:[(0,S.jsx)("option",{value:"",children:"\u2014"}),u.map(m=>{let x=g.get(m.id);return(0,S.jsxs)("option",{value:m.id,children:[re(t.schema.tryDefinition(m.kind),m),x?` \xB7 ${x}`:""]},m.id)})]})})]})}case"group":{let o=n??{};return(0,S.jsxs)("fieldset",{"data-graview-part":"group","data-graview-field":e.control,children:[(0,S.jsx)("legend",{"data-graview-part":"label",children:l}),e.fields.map(c=>(0,S.jsx)(ot,{store:t,spec:c,value:o[c.name],onChange:f=>r({...o,[c.name]:f}),prefilled:i,open:a,words:d},c.name))]})}case"variant":{let o=n??{},c=typeof o[e.tag]=="string"?o[e.tag]:"",f=e.options.find(u=>u.value===c);return(0,S.jsxs)("fieldset",{"data-graview-part":"group","data-graview-field":e.control,children:[(0,S.jsx)("legend",{"data-graview-part":"label",children:l}),(0,S.jsxs)("label",{"data-graview-part":"field","data-graview-field":"choice",children:[(0,S.jsx)("span",{"data-graview-part":"label",children:ie(e.tag)}),(0,S.jsxs)("select",{value:c,onChange:u=>r({[e.tag]:u.target.value}),"data-graview-part":"control",children:[(0,S.jsx)("option",{value:"",children:"\u2014"}),e.options.map(u=>(0,S.jsx)("option",{value:u.value,children:ie(u.value)},u.value))]})]}),f?.fields.map(u=>(0,S.jsx)(ot,{store:t,spec:u,value:o[u.name],onChange:g=>r({...o,[u.name]:g}),prefilled:i,open:a,words:d},u.name))]})}case"file":case"list":{let o=e.control==="file"?e:e.item.control==="file"?e.item:void 0;if(o||e.control==="file")return(0,S.jsx)(xe,{as:"control",title:l,value:n,onChange:r,several:o!==e,image:o?.image===!0,label:s});let c=Array.isArray(n)?n:[];return(0,S.jsxs)("fieldset",{"data-graview-part":"group","data-graview-field":"list",children:[(0,S.jsx)("legend",{"data-graview-part":"label",children:l}),c.map((f,u)=>(0,S.jsxs)("div",{"data-graview-part":"item",children:[(0,S.jsx)("div",{style:{flex:1},children:(0,S.jsx)(ot,{store:t,spec:{...e.item,optional:!1},value:f,onChange:g=>r(c.map((m,x)=>x===u?g:m)),prefilled:i,open:a,words:d})}),(0,S.jsx)("button",{type:"button","data-graview-part":"remove",onClick:()=>r(c.filter((g,m)=>m!==u)),children:"remove"})]},u)),(0,S.jsx)("button",{type:"button","data-graview-part":"add",onClick:()=>r([...c,void 0]),children:"add another"})]})}case"opaque":return(0,S.jsxs)("p",{"data-graview-part":"unasked",children:["\u201C",ie(e.name),"\u201D needs a structured answer this form cannot ask for yet."]})}}function fe({store:t,mutation:e,prefilled:n={},open:r=[],onDone:i,principal:a,initial:d,label:s,only:l}){let[o,c]=(0,Ft.useState)(()=>({...d})),[f,u]=(0,Ft.useState)(null),g=Ze(e.input).filter(x=>l===void 0||l.includes(x.name)),m=x=>mn(t.schema,e,x);return(0,S.jsxs)("form",{"data-testid":`form-${e.name}`,onSubmit:x=>{x.preventDefault();try{t.apply({name:e.name,args:{...qn(g,o),...n}},a?{author:a}:{}),u(null),c({}),i?.()}catch(E){u(Je(t.schema,t.allMutations(),E))}},"data-graview-part":"form",children:[(0,S.jsx)("style",{children:Da}),g.map(x=>(0,S.jsx)(ot,{store:t,spec:x,value:o[x.name],onChange:E=>c(C=>({...C,[x.name]:E})),prefilled:n,open:r,words:m},x.name)),f?(0,S.jsx)("p",{"data-testid":"refused","data-graview-part":"refused",role:"alert",children:f}):null,(0,S.jsx)("button",{type:"submit","data-graview-part":"submit",children:s??e.title??e.name})]})}var b=$(B(),1);function ce(t){let e=t.views;if(!e)return[];let n=new Set(Ce(t.store,t.principal));return e.places().filter(r=>n.has(r.kind))}var Le=t=>`place:${t.kind}:${t.as}`;function ge(t,e){let n=(t.views?.places()??[]).some(r=>r.as===e.as&&r.kind!==e.kind);return Qn(e.as,n?G(t.store.schema,e.kind):void 0)}function ze(t,e){let n=t.schema.tryDefinition(e);return t.graph.nodesOfKind(e).filter(r=>$e(n,r))}function Ot(t,e,n){let r=(a,d)=>en(t.schema,d,a),i=r(ze(t,e).length,e);return n?`${i} across ${r(ze(t,n).length,n)}`:i}function $t({context:t,place:e,chosen:n}){let{store:r,views:i,invariantContext:a}=t,s=i?.resolve(e.kind,{cardinality:"many",fidelity:"full"},e.as)?.view;if(!s)return null;let l=ze(r,e.kind),o=[...new Set(r.violations(a).flatMap(c=>c.nodeIds))];return(0,b.jsx)(bt,{kind:e.kind,view:e.title,children:(0,b.jsx)(s,{nodes:l,label:e.title,fidelity:"full",cardinality:"many",mode:"fullscreen",selected:!1,...n&&n.length>0?{implicated:n}:{},...o.length>0?{flagged:o}:{}})})}function Ka({store:t,views:e,as:n,invariantContext:r}){V(t);let i={store:t,views:e,...r?{invariantContext:r}:{}},a=e.places().find(d=>d.as===n);return a?(0,b.jsx)($t,{context:i,place:a}):null}function Ha({context:t,kind:e}){let{store:n,views:r,invariantContext:i}=t,a=ze(n,e),d=n.schema.tryDefinition(e),s=I(n,e),o=r?.resolve(e,{cardinality:"many",fidelity:"full"})?.view,c=[...new Set(n.violations(i).flatMap(m=>m.nodeIds))];if(o&&!Ee(o))return(0,b.jsx)(bt,{kind:e,children:(0,b.jsx)(o,{nodes:a,label:s,fidelity:"full",cardinality:"many",mode:"fullscreen",selected:!1,...c.length>0?{flagged:c}:{}})});let f=r?.resolve(e,{cardinality:"one",fidelity:"summary"})?.view,u=8,g=a.slice(0,u);return(0,b.jsxs)("div",{"data-testid":"kind-sheet",style:f?{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(200px, 1fr))",gridAutoRows:"max-content",alignContent:"center",gap:12,padding:24}:{display:"flex",flexWrap:"wrap",alignContent:"center",justifyContent:"center",gap:10,padding:24},children:[g.map(m=>f?(0,b.jsx)(f,{node:m,fidelity:"summary",cardinality:"one",mode:"fullscreen",selected:!1,...c.includes(m.id)?{flagged:[m.id]}:{}},m.id):(0,b.jsx)("span",{style:{fontSize:"1.0625rem",padding:"8px 14px",borderRadius:8,border:"1px solid var(--graview-edge-bright)",background:"var(--graview-ground)",color:"var(--graview-ink)"},children:re(d,m)},m.id)),a.length>u?(0,b.jsxs)("span",{style:{...k,alignSelf:"center",padding:"0 6px"},children:["+",a.length-u," more ",s.toLowerCase()]}):null]})}function Et(t){let{store:e}=t,n=Zn(t),r=[...ce(t)].sort((a,d)=>n.indexOf(a.kind)-n.indexOf(d.kind)),i=new Set(r.map(a=>a.kind));return[...r.map(a=>({key:Le(a),kind:a.kind,title:a.title,to:ge(t,a),place:a})),...rt(t).filter(a=>!i.has(a)).map(a=>({key:`kind:${a}`,kind:a,title:I(e,a),to:`/${G(e.schema,a)}`}))]}var da=.72,za=540,pa=16/10;function Ba(t){let e=(0,Te.useRef)(null),[n,r]=(0,Te.useState)(t);return(0,Te.useLayoutEffect)(()=>{let i=e.current;if(!i||typeof ResizeObserver>"u")return;let a=()=>{let s=i.getBoundingClientRect().width;s>0&&r(l=>Math.abs(l-s)<.5?l:s)};a();let d=new ResizeObserver(a);return d.observe(i),()=>d.disconnect()},[]),{ref:e,width:n}}function Wt({context:t,entry:e}){let{store:n,brand:r,principal:i}=t,{ref:a,width:d}=Ba(za),s=d/da,l=ze(n,e.kind),o=n.schema.tryDefinition(e.kind),c=l.length===0?Re(n,e.kind,{...i?{principal:i}:{},...t.invariantContext?{context:t.invariantContext}:{}}).actions.affordances[0]:void 0,f=e.place!==void 0;return(0,b.jsxs)(L,{to:e.to,"data-testid":f?"place-card":"kind-card",className:"graview-gallery-card",style:{...X,display:"grid",gap:10,alignContent:"start",minWidth:0},children:[(0,b.jsxs)("span",{ref:a,"data-testid":f?"place-picture":"kind-picture","aria-hidden":"true",inert:!0,style:{display:"block",position:"relative",width:"100%",aspectRatio:`${pa}`,overflow:"hidden",borderRadius:12,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)",pointerEvents:"none"},children:[(0,b.jsx)("span",{style:{position:"absolute",left:0,top:0,width:s,height:s/pa,display:"grid",gridTemplateRows:"minmax(0, 1fr)",transform:`scale(${da})`,transformOrigin:"0 0"},children:e.place?(0,b.jsx)($t,{context:t,place:e.place}):(0,b.jsx)(Ha,{context:t,kind:e.kind})}),l.length===0?(0,b.jsx)("span",{"data-testid":"picture-empty",style:{position:"absolute",inset:0,display:"grid",placeContent:"center",justifyItems:"center",gap:2,padding:20,textAlign:"center"},children:(0,b.jsxs)("span",{style:{display:"grid",gap:2,padding:"10px 16px",borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-ground)",color:"var(--graview-ink)"},children:[(0,b.jsxs)("span",{style:{fontFamily:Pe,fontWeight:600,fontSize:"1.0625rem"},children:["No ",I(n,e.kind).toLowerCase()," yet"]}),c?(0,b.jsxs)("span",{style:k,children:["Begin with \u201C",c.label,"\u201D"]}):null]})}):null]}),(0,b.jsxs)("span",{style:{display:"grid",gap:2,minWidth:0},children:[(0,b.jsxs)("span",{style:{display:"flex",alignItems:"center",gap:8,minWidth:0},children:[f?null:(0,b.jsx)(ee,{kind:e.kind,brand:r,schema:n.schema,size:8}),(0,b.jsx)("span",{style:{fontFamily:Pe,fontSize:"1.25rem",fontWeight:600,lineHeight:1.3,overflowWrap:"anywhere"},children:e.title})]}),(0,b.jsxs)("span",{style:k,children:[e.place?Ot(n,e.place.kind,e.place.across):Ot(n,e.kind),!f&&o?.description?` \xB7 ${o.description}`:null]})]})]})}var ca={display:"grid",gap:"32px 28px",gridTemplateColumns:"repeat(auto-fill, minmax(min(420px, 100%), 1fr))"},Ga=`
|
|
104
|
-
.graview-gallery-card > span:first-child { transition: border-color 160ms ease, box-shadow 160ms ease; }
|
|
105
|
-
.graview-gallery-card:hover > span:first-child,
|
|
106
|
-
.graview-gallery-card:focus-visible > span:first-child { border-color: var(--graview-edge-bright); box-shadow: 0 1px 0 var(--graview-edge), 0 10px 30px -18px var(--graview-ink); }
|
|
107
|
-
`;function Nt({context:t}){V(t.store);let e=Et(t);return e.length===0?null:(0,b.jsxs)("section",{style:ca,"data-testid":"gallery",children:[(0,b.jsx)("style",{children:Ga}),e.map(n=>(0,b.jsx)(Wt,{context:t,entry:n},n.key))]})}function Dt({context:t}){let{store:e}=t;V(e);let n=ce(t),r=Et(t);return(0,b.jsxs)(U,{context:t,style:Ne,children:[(0,b.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,b.jsx)("p",{style:ne,children:n.length===0?"None of its own yet":`${n.length} ${n.length===1?"picture":"pictures"}`}),(0,b.jsx)(J,{context:t,children:"Pictures"}),(0,b.jsx)("p",{style:Y,children:n.length===0?"Nothing here has a picture of its own yet, so each kind is drawn as the scene draws it. Title a group view and it appears here by name.":"The ways this installation looks at what it holds \u2014 each one the same picture the scene shows, here as a page."})]}),r.length>0?(0,b.jsx)("div",{style:ca,"data-testid":"places",children:r.map(i=>(0,b.jsx)(Wt,{context:t,entry:i},i.key))}):null]})}function It({context:t}){let{store:e,principal:n}=t;V(e);let r=ke(),i=he(),[a]=De(),d=decodeURIComponent(r.as??""),[s,l]=(0,Te.useState)(null),o=a.get("of"),f=ce(t).find(x=>x.as===d&&(!o||G(e.schema,x.kind)===o));if(!f)return(0,b.jsxs)(U,{context:t,children:[(0,b.jsx)(J,{context:t,children:"No picture is called that."}),(0,b.jsx)("p",{style:Y,children:(0,b.jsx)(L,{to:"/places",style:F,children:"The pictures there are \u2192"})})]});let u=I(e,f.kind),m=Re(e,f.kind,{...n?{principal:n}:{},...t.invariantContext?{context:t.invariantContext}:{}}).actions.affordances.map(x=>({affordance:x,mutation:e.allMutations().find(E=>E.name===x.mutation)})).filter(x=>x.mutation!==void 0);return(0,b.jsxs)(U,{context:t,style:Ne,children:[(0,b.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,b.jsx)(J,{context:t,children:f.title}),(0,b.jsxs)("p",{style:Y,"data-testid":"place-lede",children:[Ot(e,f.kind,f.across),"."]}),(0,b.jsx)("p",{style:{...k,margin:0},children:(0,b.jsxs)(L,{to:`/${G(e.schema,f.kind)}`,style:{...F,...k},"data-testid":"place-as-list",children:["All ",u.toLowerCase()," as a list \u2192"]})})]}),(0,b.jsx)("div",{"data-testid":"place-lens",style:{height:"min(72vh, 760px)",display:"grid",gridTemplateRows:"minmax(0, 1fr)",overflow:"auto",maxWidth:"100%",borderRadius:12,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)"},onClick:x=>{let E=x.target?.closest("[data-graview-pick]"),C=E?.getAttribute("data-graview-pick"),K=E?.getAttribute("data-graview-joins");if(K)try{let Q=JSON.parse(K);if(Array.isArray(Q)&&Q.every(we=>typeof we=="string")){x.preventDefault(),l({at:Le(f),ids:Q});return}}catch{}if(!C)return;let ue=e.graph.getNode(C);ue&&(x.preventDefault(),i(q(e.schema,ue.kind,C)))},children:(0,b.jsx)($t,{context:t,place:f,...s?.at===Le(f)?{chosen:s.ids}:{}})}),(0,b.jsx)("div",{style:{maxWidth:760,display:"grid",gap:40},children:m.map(({affordance:x,mutation:E})=>(0,b.jsxs)("section",{style:{..._,display:"grid",gap:14},children:[(0,b.jsx)("h2",{style:D,children:E.title??E.name}),E.description?(0,b.jsx)("p",{style:{...k,margin:0,maxWidth:"58ch"},children:E.description}):null,(0,b.jsx)(fe,{store:e,mutation:E,prefilled:x.args,open:x.open,label:x.label,...n?{principal:n}:{}})]},x.id))})]})}var W=$(ve(),1);var Me=$(ve(),1);function ga(t,e,n){let r=Math.max(0,t.left),i=Math.min(e.width,t.right),a=Math.max(0,t.top),d=Math.min(e.height,t.bottom);return{shown:d-a>=n.height+2*16&&i-r>=n.width+2*16,left:Math.round(r),top:Math.round(a),width:Math.round(Math.max(0,i-r)),height:Math.round(Math.max(0,d-a))}}function ua(t,e,n){let r=t.style;r.left=`${e.left}px`,r.top=`${e.top}px`,r.right="auto",r.bottom="auto",r.visibility=n?"":"hidden";let i=t.getBoundingClientRect();i.width!==0&&(r.left=`${Math.round(2*e.left-i.left)}px`,r.top=`${Math.round(2*e.top-i.top)}px`)}var Se=$(B(),1);function ma({context:t}){let e=he(),n=se(),{pathname:r}=de(),[,i,a]=r.split("/"),d=i==="places"&&a?decodeURIComponent(a):void 0,s=(0,Me.useRef)(null);return Va(s,n!==null),n?(0,Se.jsxs)(Se.Fragment,{children:[(0,Se.jsx)(Ua,{context:t}),(0,Se.jsx)("div",{ref:s,"data-testid":"page-seat",style:{position:"fixed",left:0,top:0,width:"100vw",height:"100dvh",pointerEvents:"none",zIndex:fn("rail"),containerType:"size"},children:(0,Se.jsx)(Un,{onPick:l=>{let o=t.store.graph.getNode(l);o&&e(q(t.store.schema,o.kind,l))},onMove:l=>{if(n.seatTalk.get().draft&&n.seatTalk.setDraft(null),l.to==="place"&&(l.face==="scene"||l.slug==="overview")){t.overview?t.overview("#"):t.embedded||window.location.assign(t.sceneHref??"/");return}e(l.address)},...d?{place:d}:{},onDraft:()=>{r!=="/~draft"&&e("/~draft")}})})]}):null}var qa={width:160,height:40};function Va(t,e){let{pathname:n}=de(),r=An(e);(0,Me.useLayoutEffect)(()=>{let i=t.current;if(!i)return;let a=i.parentElement?.closest("[data-embed-content]")??null,d=()=>a??document.querySelector("main")??null,s=()=>{let f=d(),u={width:document.documentElement.clientWidth||innerWidth,height:r??innerHeight},g=f?.getBoundingClientRect()??{left:0,top:0,right:u.width,bottom:u.height},m=ga(a?g:{left:g.left,right:g.right,top:g.top,bottom:Math.max(g.bottom,u.height)},u,qa);i.style.width=`${m.width}px`,i.style.height=`${m.height}px`,ua(i,m,m.shown)};s(),addEventListener("resize",s),addEventListener("scroll",s,!0);let l=0,o=typeof ResizeObserver=="function"?new ResizeObserver(()=>{cancelAnimationFrame(l),l=requestAnimationFrame(s)}):null,c=d();return c&&o?.observe(c),()=>{cancelAnimationFrame(l),o?.disconnect(),removeEventListener("resize",s),removeEventListener("scroll",s,!0)}},[t,e,n,r])}function Ua({context:t}){let{store:e}=t,n=se(),{pathname:r}=de(),i=(0,Me.useRef)(n?.setSelection);return i.current=n?.setSelection,(0,Me.useEffect)(()=>{let a=i.current;if(!a)return;let[,d,s]=r.split("/"),l=(()=>{if(d==="places"){let c=t.views?.places().find(f=>f.as===decodeURIComponent(s??""));return c?[He(c.kind)]:[]}let o=d?ye(e.schema,d):void 0;return o&&s?[decodeURIComponent(s)]:o?[vn(o)]:[]})();a(o=>o.length===l.length&&o.every((c,f)=>c===l[f])?o:l)},[r]),null}var te=$(ve(),1);var ya=$(Na(),1);var Z=$(B(),1);var ja=(0,te.lazy)(wn(()=>import("./chunk.VSXCXPK2.js").then(t=>({default:t.TakeBack}))));function _a({context:t,docked:e,at:n}){let{store:r}=t,i=V(r),[a]=(0,te.useState)(()=>r.batches().length),d=(0,te.useRef)(!1);return d.current||=i>0||!e&&a>0,d.current?(0,Z.jsx)(te.Suspense,{fallback:null,children:(0,Z.jsx)(ja,{context:t,docked:e,at:n,since:a})}):null}function Ya(t,e,n){let{store:r,principal:i,embedded:a}=t;(0,te.useEffect)(()=>{if(!n)return;let d=s=>{if(!Jn(s))return;let l=s.target,o=l instanceof Node&&e.current?.contains(l),c=l===document.body||l===document.documentElement||l===document;if(!(!o&&!(c&&!a))&&_n(r,i)){s.preventDefault();try{Yn(r,i)}catch{}}};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[r,i,a,e,n])}function ha({context:t,registry:e,root:n,children:r}){let i=(0,te.useMemo)(ra,[]),a=e?.without()??new Set;return Ya(t,n,!a.has("undo")),(0,Z.jsxs)(Lt.Provider,{value:i,children:[(0,Z.jsx)(Ja,{context:t,placed:i,without:a}),r]})}function Ja({context:t,placed:e,without:n}){let[r,i]=(0,te.useState)(!1);(0,te.useLayoutEffect)(()=>i(!0),[]);let a=Tt(e,"find"),d=Tt(e,"undo"),s=de(),l=En();if(!r)return null;let o=s.pathname.split("/").filter(Boolean),f=(o.length===1?ye(t.store.schema,o[0]):void 0)!==void 0;return(0,Z.jsxs)(Z.Fragment,{children:[!a&&!n.has("find")&&l?(0,ya.createPortal)((0,Z.jsx)(fa,{context:t,narrowsLists:f}),l.slot):null,!a&&!n.has("find")&&!l?(0,Z.jsx)("div",{"data-testid":"face-find-bar",style:{display:"flex",alignItems:"center",padding:"8px 16px",borderBottom:"1px solid var(--graview-edge)",background:"var(--graview-bar)",minWidth:0},children:(0,Z.jsx)(fa,{context:t,narrowsLists:f})}):null,!d&&!n.has("undo")?(0,Z.jsx)(_a,{context:t,docked:!0,at:s.pathname+s.search}):null,l?.own&&!n.has("undo")?(0,Z.jsx)(ea,{context:t,own:l.own}):null]})}function fa({context:t,narrowsLists:e}){return(0,Z.jsx)(Lt.Provider,{value:null,children:(0,Z.jsx)(Mt,{context:t,narrowsLists:e})})}var T=$(B(),1);function wa(t,e){return e==="*"?{label:"anything",path:null}:{label:I(t,e),path:`/${G(t.schema,e)}`}}function Qa({context:t,relation:e}){let{store:n}=t,r=wa(n,e.from),i=wa(n,e.to),a=d=>d.path?(0,T.jsx)(L,{to:d.path,style:{...X,fontWeight:550},children:d.label}):(0,T.jsx)("span",{children:d.label});return(0,T.jsxs)("li",{"data-testid":"relation","data-relation":e.edgeKind,style:{display:"grid",gridTemplateColumns:"30px minmax(0, 1fr) auto",gap:12,alignItems:"baseline"},children:[(0,T.jsx)(jn,{edgeKind:e.edgeKind,...t.brand?.kit?{kit:t.brand.kit}:{}}),(0,T.jsxs)("span",{style:{display:"grid",gap:1},children:[(0,T.jsxs)("span",{children:[a(r)," ",(0,T.jsxs)("span",{style:k,"data-graview-speaks-ids":"",children:[ie(e.edgeKind)," \u2192"]})," ",a(i)]}),e.description||e.inverse?(0,T.jsxs)("span",{style:{...k,fontSize:"0.9375rem"},children:[e.description?le(e.description):null,e.description&&e.inverse?" \xB7 ":null,e.inverse?`from the other end, ${e.inverse}`:null]}):null]}),i.path?(0,T.jsx)(L,{to:`${i.path}?with=${encodeURIComponent(e.edgeKind)}`,style:{...F,...k,fontVariantNumeric:"tabular-nums",display:"inline-block",minWidth:24,minHeight:24,textAlign:"center"},title:`The ${i.label.toLowerCase()} that have this`,children:e.count}):(0,T.jsx)("span",{style:{...k,fontVariantNumeric:"tabular-nums"},children:e.count})]})}function va({context:t,heading:e=!0}){let{store:n}=t,r=new Set(Ce(n,t.principal)),i=Ae(n).relations.filter(a=>r.has(a.from)&&(a.to==="*"||r.has(a.to)));return i.length===0?null:(0,T.jsxs)("section",{style:{..._,display:"grid",gap:12},"data-testid":"kind-map",children:[e?(0,T.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:10,flexWrap:"wrap"},children:[(0,T.jsx)("h2",{style:D,children:(0,T.jsx)(L,{to:"/map",style:X,children:"Connections"})}),(0,T.jsx)("span",{style:k,children:i.length===1?"1 relation":`${i.length} relations`})]}):null,(0,T.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:10},children:i.map(a=>(0,T.jsx)(Qa,{context:t,relation:a},`${a.edgeKind}|${a.from}|${a.to}`))})]})}function Kt({context:t}){let{store:e}=t;V(e);let n=new Set(Ce(e,t.principal)),r=Ae(e),i=r.relations.filter(a=>n.has(a.from));return(0,T.jsxs)(U,{context:t,children:[(0,T.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,T.jsx)("p",{style:ne,children:i.length===0?"No relations":`${i.length} ${i.length===1?"relation":"relations"}`}),(0,T.jsx)(J,{context:t,children:"Connections"}),(0,T.jsx)("p",{style:Y,children:i.length===0?"Nothing here is declared to relate to anything else yet.":"The kinds this installation holds, and the relations declared between them \u2014 each in the declaration's own words, with how many of it there are."})]}),(0,T.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexWrap:"wrap",gap:"6px 18px"},"data-testid":"map-kinds",children:r.kinds.filter(a=>n.has(a.kind)).map(a=>(0,T.jsxs)("li",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[(0,T.jsx)(ee,{kind:a.kind,brand:t.brand,schema:e.schema,size:7}),(0,T.jsx)(L,{to:`/${G(e.schema,a.kind)}`,style:F,children:a.plural}),(0,T.jsx)("span",{style:k,children:a.count})]},a.kind))}),(0,T.jsx)(va,{context:t,heading:!1})]})}function ka({context:t}){let n=[...se()?.robots.values()??[]].filter(i=>i.mode==="asking"&&i.say);if(n.length===0)return null;let{store:r}=t;return(0,T.jsxs)("section",{style:{..._,display:"grid",gap:10},"data-testid":"seat-questions",children:[(0,T.jsx)("h2",{style:D,children:n.length===1?"The seat asked something":`The seat asked ${n.length} things`}),(0,T.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:8},children:n.map(i=>{let a=i.at?r.graph.getNode(i.at):void 0;return(0,T.jsxs)("li",{style:{display:"grid",gap:2},children:[(0,T.jsx)("span",{children:i.say}),a?(0,T.jsxs)(L,{to:q(r.schema,a.kind,a.id),style:{...F,...k},children:[re(r.schema.tryDefinition(a.kind),a)," \u2192"]}):null]},i.participant)})})]})}var O=$(B(),1);function Ht({context:t}){let{principal:e}=t,{store:n,brand:r,invariantContext:i}=t;V(n);let a=n.violations(i),d=`${a.length===1?"A rule is broken":"Rules are broken"} \u2014 see what, and what would fix it`,s=[...n.log.all()].slice(-5).reverse(),o=rt(t).map(C=>({kind:C,members:n.graph.nodesOfKind(C).filter(K=>$e(n.schema.tryDefinition(C),K))})),c=o.filter(C=>C.members.length>0),f=o.map(C=>({entry:C,creator:n.allMutations().find(K=>(K.creates??[]).includes(C.kind)&&n.permits({name:K.name,args:{}},t.principal).ok)})).find(C=>C.creator!==void 0),u=c.length===0?"Nothing here yet.":`${c.map(C=>`${C.members.length} ${C.members.length===1?C.kind:I(n,C.kind).toLowerCase()}`).join(", ").replace(/, ([^,]*)$/," and $1")}.`,g=t.views?.homeView?.(),m=n.schema.kinds.some(C=>n.graph.nodesOfKind(C).length>0);if(g&&m){let C=r?.subtitle?(0,O.jsx)("p",{style:{...k,margin:0},"data-testid":"app-subtitle",children:r.subtitle}):null,K=g[Symbol.for("graview.home-blocks")]===!0;return(0,O.jsx)(U,{context:t,style:Ne,children:(0,O.jsxs)("div",{style:{display:"grid",gap:12},"data-testid":"home-view",children:[K?null:C,a.length>0?(0,O.jsx)(L,{to:"/problems",style:{...F,color:"var(--graview-warn)"},children:d}):null,(0,O.jsx)(Gn.Provider,{value:K?C:null,children:(0,O.jsx)(g,{cardinality:"many",fidelity:"full",mode:"fullscreen",selected:!1})})]})})}let x=new Set(Ce(n,t.principal)),E=Ae(n).relations.filter(C=>x.has(C.from)&&(C.to==="*"||x.has(C.to)));return(0,O.jsxs)(U,{context:t,style:Ne,children:[(0,O.jsxs)("header",{style:{display:"grid",gap:12},children:[r?.subtitle?(0,O.jsx)("p",{style:{...k,margin:0},"data-testid":"app-subtitle",children:r.subtitle}):null,(0,O.jsx)(J,{context:t,"data-testid":"standing",children:u}),(0,O.jsxs)("p",{style:{...Y,display:"grid",gap:4},"data-testid":"standing-card",children:[c.length===0&&f?(0,O.jsxs)("span",{children:["Begin with \u201C",f.creator?.title??f.creator?.name,"\u201D, under"," ",(0,O.jsx)(L,{to:`/${G(n.schema,f.entry.kind)}`,style:F,children:I(n,f.entry.kind)}),"."]}):null,a.length===0?(0,O.jsx)("span",{children:"All rules hold."}):(0,O.jsx)(L,{to:"/problems",style:{...F,color:"var(--graview-warn)"},children:d})]})]}),(0,O.jsx)(Nt,{context:t}),(0,O.jsxs)("section",{style:{..._,display:"grid",gap:14},"data-testid":"kinds",children:[(0,O.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:10,flexWrap:"wrap"},children:[(0,O.jsx)("h2",{style:D,children:"What is here"}),E.length>0?(0,O.jsxs)(L,{to:"/map",style:{...F,...k,marginLeft:"auto"},"data-testid":"map-link",children:["Connections \xB7 ",E.length===1?"1 relation":`${E.length} relations`," \u2192"]}):null]}),(0,O.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexWrap:"wrap",gap:"8px 10px"},children:o.map(({kind:C,members:K})=>(0,O.jsx)("li",{style:{maxWidth:"100%"},children:(0,O.jsxs)(L,{to:`/${G(n.schema,C)}`,style:{...X,flexWrap:"wrap",gap:8,padding:"6px 14px 6px 10px",borderRadius:8,border:"1px solid var(--graview-edge-bright)",background:"var(--graview-panel)"},children:[(0,O.jsx)(ee,{kind:C,brand:r,schema:n.schema,size:7}),(0,O.jsx)("span",{style:{fontWeight:550,overflowWrap:"anywhere"},children:I(n,C)}),(0,O.jsx)("span",{style:{...k,fontVariantNumeric:"tabular-nums"},children:K.length===0?"none yet":K.length})]})},C))})]}),s.length>0?(0,O.jsxs)("section",{style:{..._,display:"grid",gap:10},children:[(0,O.jsx)("h2",{style:D,children:"Recently"}),(0,O.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:6},children:s.map(C=>(0,O.jsxs)("li",{style:k,children:[(0,O.jsx)("span",{style:{color:"var(--graview-ink)"},children:C.intent})," \u2014 ",nt(C,e,{graph:n.graph,schema:n.schema,...t.seats?{seats:t.seats}:{},...t.people?{people:t.people}:{}})]},C.id))})]}):null]})}var Fe=$(ve(),1);var R=$(B(),1);function zt({context:t}){let{store:e,brand:n,principal:r,invariantContext:i}=t;V(e);let[a]=De(),d=a.get("q")??"",s=typeof i?.today=="string"?i.today:void 0,l=un(e,d,{...r?{principal:r}:{},places:ce(t),flagged:new Set(e.violations(i).flatMap(g=>g.nodeIds)),...s?{today:s}:{},limit:200}),o=l.hits.filter(g=>g.about==="node"),c=l.hits.filter(g=>g.about==="kind"||g.about==="place"||g.about==="rule"),f=[...new Set(o.map(g=>g.kind))],u=d.trim();return(0,R.jsxs)(U,{context:t,children:[(0,R.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,R.jsx)("p",{style:ne,children:"Search"}),(0,R.jsx)(J,{context:t,"data-testid":"search-heading",children:u.length===0?"Find anything by its name":l.hits.length===0?(0,R.jsxs)(R.Fragment,{children:["Nothing here is called \u201C",u,"\u201D."]}):(0,R.jsxs)(R.Fragment,{children:[Xa(e,l.byKind)," for \u201C",u,"\u201D"]})}),u.length>0?(0,R.jsxs)("p",{style:{...k,margin:0},"data-testid":"search-searched",children:[Ye(e.schema,l.searched),l.conditions.filter(g=>g.key!=="is"&&g.admittedBy.length<l.searched.kinds.length).map(g=>(0,R.jsxs)("span",{children:[" ",g.key,":",g.value," narrows"," ",g.admittedBy.length===0?"nothing here":g.admittedBy.map(m=>I(e,m).toLowerCase()).join(" and "),"."]},`${g.key}:${g.value}`))]}):(0,R.jsxs)("p",{style:Y,children:["Type in the box above. Words find the start of words in names and in what each record says;"," ",(0,R.jsx)("code",{children:"done:false"})," and the like narrow as a list does, and ",(0,R.jsx)("code",{children:"is:any"})," includes what is past."]})]}),c.length>0?(0,R.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:6},"data-testid":"search-named",children:c.map(g=>(0,R.jsx)("li",{"data-testid":"search-hit","data-about":g.about,children:g.about==="kind"?(0,R.jsxs)(L,{to:`/${G(e.schema,g.kind)}`,style:F,children:[g.label,g.count>0?(0,R.jsxs)("span",{style:k,children:[" \xB7 ",g.count," match"]}):null]}):g.about==="place"?(0,R.jsxs)(L,{to:ge(t,g),style:F,children:["Go to ",g.title]}):g.about==="rule"?(0,R.jsxs)(L,{to:"/problems",style:F,children:["The rule \u201C",g.label,"\u201D"]}):null},`${g.about}:${g.about==="rule"?g.name:g.about==="place"?g.as:g.kind}`))}):null,f.map(g=>(0,R.jsxs)("section",{style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr)",gap:0,minWidth:0},"data-testid":"search-group","data-kind":g,children:[(0,R.jsxs)("h2",{style:{...D,fontSize:"1.0625rem",marginBottom:4,display:"flex",alignItems:"center",gap:8},children:[(0,R.jsx)(ee,{kind:g,brand:n,schema:e.schema,size:8}),(0,R.jsx)(L,{to:`/${G(e.schema,g)}?${new URLSearchParams({q:u}).toString()}`,style:F,"data-testid":"search-kind-link",children:I(e,g)}),(0,R.jsx)("span",{style:k,children:l.byKind[g]})]}),(0,R.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:0},children:o.filter(m=>m.kind===g).map(m=>(0,R.jsxs)("li",{"data-testid":"search-hit","data-about":"node",style:{display:"grid",gap:2,padding:"12px 0",minWidth:0,borderTop:"1px solid var(--graview-edge)"},children:[(0,R.jsxs)(L,{to:q(e.schema,g,m.id),style:{...X,fontFamily:Pe,fontSize:"1.1875rem",fontWeight:600,lineHeight:1.3,overflowWrap:"anywhere"},children:[m.flagged?(0,R.jsx)("span",{style:{color:"var(--graview-warn)"},children:"\u26A0 "}):null,m.label,m.apart?(0,R.jsxs)("span",{style:k,children:[" \xB7 ",m.apart]}):null,m.current?null:(0,R.jsx)("span",{style:k,children:" \xB7 past"})]}),(0,R.jsx)(st,{why:m.why})]},m.id))})]},g)),u.length>0?(0,R.jsx)(Za,{asked:u}):null,u.length>0&&l.hits.length===0?(0,R.jsx)(ba,{store:e,kinds:l.searched.kinds,words:l.words,...r?{principal:r}:{},...i?{invariantContext:i}:{}}):null]})}function st({why:t}){return t.field==="label"?null:(0,R.jsxs)("span",{style:k,"data-testid":"search-why",children:[t.reading,": ",t.fragment]})}function Xa(t,e){let n=Object.entries(e).map(([r,i])=>`${i} ${i===1?be(t.schema.tryDefinition(r),r):I(t,r).toLowerCase()}`);return n.length===0?"Found":n.length===1?le(n[0]):le(`${n.slice(0,-1).join(", ")} and ${n[n.length-1]}`)}function Sa(t,e,n={}){let r=[];for(let i of e){let a=Re(t,i,{...n.principal?{principal:n.principal}:{},...n.invariantContext?{context:n.invariantContext}:{}});for(let d of lt(t,i,a.actions.affordances))r.some(s=>s.mutation.name===d.mutation.name)||r.push(d)}return r}function lt(t,e,n){let r=t.schema.tryDefinition(e)?.fieldRoles?.label,i=[];for(let a of n){let d=t.allMutations().find(o=>o.name===a.mutation);if(!d||!d.creates?.includes(e)||i.some(o=>o.mutation.name===d.name))continue;let s=Ze(d.input).map(o=>o.name),l=s.includes("label")?"label":r&&s.includes(r)?r:void 0;!l||a.args[l]!==void 0||i.push({kind:e,affordance:a,mutation:d,arg:l})}return i}function ba({store:t,kinds:e,words:n,principal:r,invariantContext:i}){let a=Sa(t,e,{...r?{principal:r}:{},...i?{invariantContext:i}:{}});return a.length===0||n.trim().length===0?null:(0,R.jsx)("div",{style:{display:"grid",gap:24},"data-testid":"search-to-create",children:a.map(({kind:d,affordance:s,mutation:l,arg:o})=>(0,R.jsxs)("section",{style:{..._,display:"grid",gap:14},children:[(0,R.jsxs)("h2",{style:D,children:[le(nn(be(t.schema.tryDefinition(d),d)))," called \u201C",n,"\u201D"]}),(0,R.jsx)(fe,{store:t,mutation:l,prefilled:s.args,open:s.open,initial:{[o]:n},...r?{principal:r}:{}})]},`${s.id}|${n}`))})}function Za({asked:t}){let e=se();return e?(0,R.jsx)(er,{asked:t,talk:e.seatTalk}):null}function er({asked:t,talk:e}){let{drawn:n}=kn(e);return n===0?null:(0,R.jsx)("p",{style:{margin:0},children:(0,R.jsxs)("button",{type:"button","data-testid":"search-ask",onClick:()=>e.ask(t),style:{...F,font:"inherit",padding:0,border:0,background:"transparent",cursor:"pointer",textAlign:"start"},children:["Ask: \u2018",t,"\u2019"]})})}var h=$(B(),1),xa=8,Pa=40;function Bt({context:t}){let e=ke(),n=ye(t.store.schema,e.slug??"");return n?(0,h.jsx)(Ca,{context:t,kind:n}):(0,h.jsx)(U,{context:t,children:(0,h.jsx)(J,{context:t,children:"No such kind of thing here."})})}function Ca({context:t,kind:e,opening:n,row:r,layout:i="list",description:a,bare:d}){let{store:s,brand:l,invariantContext:o}=t;V(s);let[c,f]=De(),u=s.schema.tryDefinition(e),g=s.graph.nodesOfKind(e),m=Ae(s).relations.filter(p=>p.from===e||p.to===e),x=new Set(s.violations(o).flatMap(p=>p.nodeIds)),E=dn(s.schema,e),C=m.map(p=>p.edgeKind),K=ar(c,E,C),ue=["sort","filter","group","q","by","with","past",...C].some(p=>c.has(p)),Q=g.length>=Pa,we=u?.fieldRoles?.when,N=ue?K.arrangement:xt(n??nr(Q,we),E).arrangement,ae=cn(N.query??""),Oe=[...N.filter??[],...ae.conditions].some(p=>p.key==="is"&&(p.value==="past"||p.value==="any"))||ln(u,[...N.filter??[],...ae.conditions]),y=Oe||!u?.lifecycle?N:{...N,filter:[...N.filter??[],{key:"is",value:"current"}]},A=Dn(g,y,{schema:s.schema,graph:s.graph,flagged:x,...typeof o?.today=="string"?{today:o.today}:{}}),j=A.nodes,z=u?.lifecycle&&!Oe?g.filter(p=>$e(u,p)):g,Vt=g.length-z.length,Ut=N.group?.by??null,La=p=>{let P=new URLSearchParams(c);for(let oe of["sort","filter","group","q","by","with","past",...m.map(je=>je.edgeKind)])P.delete(oe);let H=Nn(p);for(let oe of["sort","filter","group","q"])H[oe]&&P.set(oe,H[oe]);![...P.keys()].some(oe=>["sort","filter","group","q"].includes(oe))&&(n||Q||we)&&P.set("sort",""),f(P)},{principal:jt}=t,gt=Re(s,e,{...jt?{principal:jt}:{},...t.invariantContext?{context:t.invariantContext}:{}}),Ie=gt.actions.affordances.map(p=>({affordance:p,mutation:s.allMutations().find(P=>P.name===p.mutation)})).filter(p=>p.mutation!==void 0),_t=gt.actions.withheld,Yt=ae.words&&j.length===0?Object.fromEntries(lt(s,e,gt.actions.affordances).map(p=>[p.mutation.name,p.arg])):{},ut=I(s,e),Ge=t.views?.lookup(e,{cardinality:"one",fidelity:"glyph"}),Jt=Ge!==void 0&&!Ee(Ge)?Ge:void 0,mt=p=>{let P=re(u,p);if(r){let Ke=u?.computed?We(s.schema,s.graph,p):p;return(0,h.jsx)("li",{"data-testid":"record-row",style:{minWidth:0},children:r(p,{label:P,href:q(s.schema,e,p.id),flagged:x.has(p.id),glance:at(Ke,u,P)})},p.id)}if(Jt){let Ke=Xe(Ge,p,s.graph),$a=u?.computed?We(s.schema,s.graph,p):p,Ea=Object.fromEntries(Object.entries($a).filter(([Wa])=>!Ke?.fields.has(Wa))),Xt=Ke?at(Ea,u,Ke.title??P):"";return(0,h.jsxs)("li",{"data-testid":"record-row",style:{position:"relative",display:"flex",flexWrap:"wrap",alignItems:"baseline",columnGap:16,rowGap:2,padding:"10px 0",borderTop:"1px solid var(--graview-edge)"},children:[(0,h.jsx)("div",{style:{flex:"1 1 14rem",minWidth:0},children:(0,h.jsx)(Jt,{node:p,cardinality:"one",fidelity:"glyph",mode:"fullscreen",selected:!1,...x.has(p.id)?{flagged:[p.id]}:{}})}),Xt?(0,h.jsx)("span",{style:{...k,flex:"0 1 auto",minWidth:0,overflowWrap:"anywhere"},"data-testid":"record-glance",children:Xt}):null,(0,h.jsx)(L,{to:q(s.schema,e,p.id),"aria-label":x.has(p.id)?`${P} \u2014 implicated in a problem`:P,style:{position:"absolute",inset:0,borderRadius:6}})]},p.id)}let H=u?.computed?We(s.schema,s.graph,p):p,oe=at(H,u,P),je=ae.words?gn(u,p,ae.words):void 0,wt=Q?void 0:On(p,u);return(0,h.jsxs)("li",{style:Q?{display:"flex",flexWrap:"wrap",alignItems:"baseline",columnGap:16,rowGap:0,padding:"5px 0",borderTop:"1px solid var(--graview-edge)",overflowWrap:"anywhere"}:{display:"grid",gridTemplateColumns:wt?"auto minmax(0, 1fr)":"minmax(0, 1fr)",columnGap:14,gap:2,padding:"14px 0",borderTop:"1px solid var(--graview-edge)",overflowWrap:"anywhere"},children:[wt?(0,h.jsx)(xe,{as:"thumb",file:wt,style:{gridRow:"span 3"}}):null,(0,h.jsxs)(L,{to:q(s.schema,e,p.id),style:Q?{...X,flex:"1 1 14rem",minWidth:0,fontSize:"1rem",fontWeight:600,lineHeight:1.35}:{...X,fontFamily:Pe,fontSize:"1.25rem",fontWeight:600,lineHeight:1.3},children:[x.has(p.id)?(0,h.jsx)("span",{style:{color:"var(--graview-warn)"},children:"\u26A0 "}):null,P]}),oe?(0,h.jsx)("span",{style:Q?{...k,flex:"0 1 auto",minWidth:0,fontSize:"0.875rem"}:k,children:oe}):null,je?(0,h.jsx)(st,{why:je}):null]},p.id)},ft=ce(t).filter(p=>p.kind===e),Ta=(N.filter??[]).some(p=>p.key!=="is"||p.value!=="any"),Ma=!!(N.sort||N.group||N.query||Ta),Fa=z.length>=xa||ue&&Ma,me=N.sort?E.sorts.find(p=>p.key===N.sort.by):void 0,yt=me?.type==="date"||me!==void 0&&me.key===we,Qt=Q&&!A.grouped&&me&&(me.about==="label"||me.type==="text"||yt)?p=>{let P=me.about==="label"?re(u,p):p[me.key];if(typeof P!="string"||P.length===0)return yt?"No date":"#";if(yt)return P.slice(0,4);let H=P.trim().charAt(0).toLocaleUpperCase();return/\p{L}/u.test(H)?H:"#"}:void 0,qe=Qt?j.reduce((p,P)=>{let H=Qt(P);return p.at(-1)?.key===H?p.at(-1).nodes.push(P):p.push({key:H,nodes:[P]}),p},[]):void 0,ht=i==="grid"?{margin:0,padding:0,listStyle:"none",display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(min(100%, 15rem), 1fr))",gap:12}:{margin:0,padding:0,listStyle:"none",display:"grid",gap:r&&i==="list"?6:0},Ve=p=>`list-at-${p.replace(/[^\p{L}\p{N}]/gu,"_")}`,Ue=m.map(p=>{let P=p.from===e?p.to:p.from,H=p.from===e?p.description:p.inverse??p.description;return{relation:p,far:P,words:H}}),Oa=new Set(Ue.map(p=>(p.words??"").toLowerCase()).filter((p,P,H)=>p&&H.indexOf(p)!==P));return(0,h.jsxs)(d?tr:U,{context:t,children:[(0,h.jsxs)("div",{style:{display:"grid",gap:12},children:[(0,h.jsxs)("header",{style:{display:"grid",gap:4},children:[(0,h.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,minWidth:0},children:[(0,h.jsx)(ee,{kind:e,brand:l,schema:s.schema,size:8}),(0,h.jsx)(J,{context:t,children:ut})]}),a??u?.description?(0,h.jsx)("p",{style:{...Y,fontSize:"1.0625rem",lineHeight:1.4},children:a??u?.description}):null,Ue.length>0||ft.length>0?(0,h.jsxs)("p",{style:{...k,margin:0,display:"flex",flexWrap:"wrap",columnGap:18,rowGap:2},"data-testid":"kind-related",children:[Ue.length>0?(0,h.jsxs)("span",{"data-testid":"kind-relations",children:["Related:"," ",Ue.map(({relation:p,far:P,words:H},oe)=>(0,h.jsxs)("span",{"data-relation":p.edgeKind,children:[oe>0?" \xB7 ":null,P==="*"?le(H??ie(p.edgeKind)):(0,h.jsx)(L,{to:`/${G(s.schema,P)}`,style:F,title:I(s,P),children:H&&Oa.has(H.toLowerCase())?`${le(H)}: ${I(s,P).toLowerCase()}`:le(H??I(s,P))})]},`${p.edgeKind}|${p.from}|${p.to}`))]}):null,ft.length>0?(0,h.jsxs)("span",{"data-testid":"kind-pictures",children:["Also as:"," ",ft.map((p,P)=>(0,h.jsxs)("span",{children:[P>0?" \xB7 ":null,(0,h.jsx)(L,{to:ge(t,p),style:F,children:p.title})]},Le(p)))]}):null]}):null]}),K.dropped.length>0?(0,h.jsxs)("p",{style:{...k,margin:0},"data-testid":"list-dropped",children:["This link asked for ",K.dropped.join(", "),", which ",ut.toLowerCase()," cannot be arranged by; the rest is shown."]}):null,z.length>0?(0,h.jsx)(Kn,{schema:s.schema,graph:s.graph,kind:e,arrangement:N,onChange:La,kept:{shown:j.length,of:z.length},noun:{one:be(u,e),many:ut.toLowerCase()},...Fa?{}:{allow:!1},query:t.framed===!0&&t.barAbove!==!0}):null,j.length===0&&ae.words?(0,h.jsxs)("p",{style:{...Y,fontSize:"1.0625rem"},"data-testid":"none-yet",children:["Nothing here is called \u201C",ae.words,"\u201D."," ",(0,h.jsx)("span",{style:k,"data-testid":"list-searched",children:Ye(s.schema,{kinds:[e],past:Oe})})," ",(0,h.jsx)(L,{to:"?",style:F,children:"Show every one"})]}):j.length===0?(0,h.jsxs)("p",{style:{...Y,fontSize:"1.0625rem"},"data-testid":"none-yet",children:[N.filter?.length||N.query?"None of them.":"None yet",!N.filter?.length&&!N.query&&Ie.length>0?` \u2014 the first one starts below, with \u201C${Ie[0]?.mutation.title??Ie[0]?.mutation.name}\u201D.`:!N.filter?.length&&!N.query?".":"",N.filter?.length||N.query?(0,h.jsxs)(h.Fragment,{children:[" ",(0,h.jsx)(L,{to:"?",style:F,children:"Show every one"})]}):null]}):A.grouped&&Ut?(0,h.jsx)("div",{style:{display:"grid",gap:18},"data-testid":"records","data-grouped":Ut,children:A.groups.map(p=>(0,h.jsxs)("section",{style:{display:"grid",gap:0},"data-testid":"list-group",children:[(0,h.jsxs)("h2",{style:{...D,fontSize:"1.0625rem",marginBottom:4},children:[p.label," ",(0,h.jsx)("span",{style:k,children:p.nodes.length})]}),(0,h.jsx)("ul",{style:ht,"data-graview-rows":"",children:p.nodes.map(mt)})]},p.key||"-"))}):qe&&qe.length>1?(0,h.jsxs)("div",{style:{display:"grid",gap:14},"data-testid":"records","data-sectioned":me?.type==="date"?"year":"letter",children:[(0,h.jsx)("nav",{"aria-label":"Jump to","data-testid":"list-index",style:{...k,display:"flex",flexWrap:"wrap",gap:me?.type==="date"?"0 10px":"0 4px",fontSize:"0.8125rem",lineHeight:1.3},children:qe.map(p=>(0,h.jsx)("a",{href:`#${Ve(p.key)}`,onClick:P=>{P.preventDefault(),document.getElementById(Ve(p.key))?.scrollIntoView({block:"start"})},style:{...F,flex:"0 0 auto",minWidth:24,justifyContent:"center",textDecoration:"none"},children:p.key},p.key))}),qe.map(p=>(0,h.jsxs)("section",{"data-testid":"list-section","aria-labelledby":Ve(p.key),style:{display:"grid",gap:0},children:[(0,h.jsx)("h2",{id:Ve(p.key),style:{...D,fontSize:"0.9375rem",color:"var(--graview-ink-muted)",marginBottom:2,scrollMarginTop:64},children:p.key}),(0,h.jsx)("ul",{style:ht,"data-graview-rows":"",children:p.nodes.map(mt)})]},p.key))]}):(0,h.jsx)("ul",{style:ht,"data-testid":"records","data-graview-rows":"",children:j.map(mt)}),Vt>0?(0,h.jsxs)(L,{to:rr(c,"filter","is:any"),style:{...F,...k,justifySelf:"start"},"data-testid":"past-link",children:["+",Vt," past"]}):null,Ie.length>0?(0,h.jsx)("div",{style:{display:"grid",gap:6},"data-testid":"beginnings",children:Ie.map(({affordance:p,mutation:P})=>{let H=!!(Yt[P.name]&&j.length===0);return(0,h.jsx)(ir,{name:P.name,title:P.title??P.name,description:P.description,open:j.length===0,children:(0,h.jsx)(fe,{store:s,mutation:P,prefilled:p.args,open:p.open,...H?{initial:{[Yt[P.name]]:ae.words}}:{},...t.principal?{principal:t.principal}:{}},H?`${P.name}|${ae.words}`:P.name)},p.id)})}):null]}),_t.length>0?(0,h.jsx)("ul",{style:{..._,margin:0,padding:0,listStyle:"none",display:"grid",gap:4},"data-testid":"withheld",children:_t.map(p=>(0,h.jsxs)("li",{style:k,children:[(0,h.jsx)("s",{children:p.label})," \u2014 ",p.refusal.message]},p.id))}):null]})}function tr({children:t}){return(0,h.jsx)("div",{style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr)",gap:40,minWidth:0},children:t})}var nr=(t,e)=>e?{sort:{by:e,direction:"desc"}}:t?{sort:{by:"label",direction:"asc"}}:{};function ar(t,e,n){let r=pn({...t.get("sort")?{sort:t.get("sort")}:{},...t.get("filter")?{filter:t.get("filter")}:{},...t.get("group")?{group:t.get("group")}:{},...t.get("q")?{q:t.get("q")}:{}}),i=[...r.filter??[]],a=t.get("by"),d=r.group??(a?{by:a}:void 0);for(let l of n){let o=t.get(l);o&&i.push({key:l,value:o})}let s=t.get("with");return s&&i.push({key:s,value:"*"}),t.get("past")==="1"&&!i.some(l=>l.key==="is")&&i.push({key:"is",value:"any"}),xt({...r.sort?{sort:r.sort}:{},...r.query?{query:r.query}:{},...i.length>0?{filter:i}:{},...d?{group:d}:{}},e)}function rr(t,e,n){let r=new URLSearchParams(t);return r.set(e,n),r.delete("past"),`?${r.toString()}`}function ir({name:t,title:e,description:n,open:r,children:i}){let[a,d]=(0,Fe.useState)(r),s=(0,Fe.useRef)(null),l=(0,Fe.useRef)(null),o=`begin-${(0,Fe.useId)().replace(/:/g,"")}`;return(0,h.jsxs)("div",{"data-testid":`act-${t}`,style:{display:"grid",gap:10},children:[(0,h.jsxs)("button",{ref:s,type:"button","data-testid":`act-open-${t}`,"aria-expanded":a,"aria-controls":o,onClick:()=>{d(!a),a||requestAnimationFrame(()=>l.current?.querySelector("input, select, textarea, button")?.focus())},style:{...X,justifySelf:"start",minHeight:32,padding:"0 2px",border:0,background:"none",font:"inherit",fontSize:"0.9375rem",fontWeight:600,color:"var(--graview-ink)",cursor:"pointer"},children:[(0,h.jsx)("span",{"aria-hidden":"true",style:{marginRight:6},children:a?"\u2212":"+"}),e]}),(0,h.jsxs)("div",{ref:l,id:o,hidden:!a,onKeyDown:c=>{c.key==="Escape"&&(c.preventDefault(),d(!1),s.current?.focus())},style:a?{display:"grid",gap:12,padding:"4px 0 12px"}:void 0,children:[n?(0,h.jsx)("p",{style:{...k,margin:0,maxWidth:"58ch"},children:n}):null,i]})]})}var ct=$(ve(),1);var Be=$(ve(),1);var M=$(B(),1);function Gt({context:t}){let{store:e,brand:n,invariantContext:r,principal:i}=t;V(e);let a=e.violations(r),d=e.allInvariants(),s=Qe(e,a),l=Ln(e.schema,d);return(0,M.jsxs)(U,{context:t,children:[(0,M.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,M.jsx)(J,{context:t,children:a.length===0?"All rules hold":"What is broken"}),(0,M.jsx)("p",{style:Y,"data-testid":"problems-count",children:a.length===0?"Every declared rule is satisfied by what is here.":on(a)})]}),(0,M.jsx)(ka,{context:t}),s.map((o,c)=>{let f=o.nodeIds[0],u=f?e.graph.getNode(f):void 0;return(0,M.jsxs)("section",{style:{display:"grid",gap:10,padding:"16px 18px",borderLeft:"3px solid var(--graview-warn)",background:"var(--graview-panel-warning)",borderRadius:"0 var(--graview-radius, 12px) var(--graview-radius, 12px) 0"},children:[o.line?null:(0,M.jsx)(dt,{violation:o,schema:e.schema,...n?{brand:n}:{}}),u?(0,M.jsxs)("p",{style:{margin:0,display:"inline-flex",alignItems:"center",gap:8},children:[(0,M.jsx)(ee,{kind:u.kind,brand:n,schema:e.schema,size:7}),(0,M.jsx)(L,{to:q(e.schema,u.kind,u.id),style:F,children:re(e.schema.tryDefinition(u.kind),u)})]}):null,o.line?(0,M.jsx)(dt,{violation:o,schema:e.schema,...n?{brand:n}:{}}):null,(0,M.jsx)(pt,{store:e,repairs:o.repairs,...i?{principal:i}:{}})]},c)}),d.length>0?(0,M.jsxs)("section",{style:{..._,display:"grid",gap:12},"data-testid":"rules",children:[(0,M.jsx)("h2",{style:D,children:"The rules"}),(0,M.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:10},children:d.map(o=>{let c=a.filter(g=>g.invariant===o.name).length,f=l.get(o.name),u=o.label??o.name;return(0,M.jsxs)("li",{"data-graview-rule":o.name,style:{display:"grid",gap:2},children:[(0,M.jsxs)("span",{style:{display:"flex",flexWrap:"wrap",alignItems:"baseline",columnGap:12,rowGap:2},children:[f?(0,M.jsx)(St,{line:f,schema:e.schema,...n?{brand:n}:{},style:{flex:"1 1 18rem"}}):(0,M.jsx)("span",{style:{flex:"1 1 18rem",fontWeight:550},children:u}),(0,M.jsx)("span",{style:{...k,fontSize:"0.875rem",color:c>0?"var(--graview-warn)":"var(--graview-ink-faint)"},children:c===0?"holds":`broken in ${c} ${c===1?"place":"places"}`})]}),f&&u.trim().length>0?(0,M.jsx)("span",{style:{...k,fontSize:"0.875rem"},children:u}):null]},o.name)})})]}):null]})}function dt({violation:t,schema:e,brand:n}){if(!t.line)return(0,M.jsx)("p",{style:{margin:0,color:"var(--graview-warn)",fontWeight:550},children:t.message});let r=Mn(t);return(0,M.jsxs)("div",{style:{display:"grid",gap:2},"data-testid":"problem-line",title:Tn(t),children:[(0,M.jsx)(St,{line:t.line,schema:e,...n?{brand:n}:{},lead:"none",style:{color:"var(--graview-warn)",fontSize:"1.0625rem"}}),r?(0,M.jsx)("span",{style:{...k,fontSize:"0.875rem"},children:r}):null]})}function pt({store:t,repairs:e,principal:n}){let[r,i]=(0,Be.useState)(null),[a,d]=(0,Be.useState)(null),s=(0,Be.useRef)([]);if(e.length===0)return null;let l=r===null?null:e[r],o=l&&(l.missing??[]).length>0?t.allMutations().find(c=>c.name===l.mutation):void 0;return(0,M.jsxs)("div",{style:{display:"grid",gap:10},"data-testid":"repairs",children:[(0,M.jsx)("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:e.map((c,f)=>{let u=(c.missing??[]).length>0,g=t.permits({name:c.mutation,args:{...c.args}},n);return g.ok?(0,M.jsx)("button",{ref:m=>{s.current[f]=m},type:"button","data-graview-repair":c.mutation,"data-graview-asks":u||void 0,"aria-expanded":u?r===f:void 0,onClick:()=>{if(d(null),u){i(r===f?null:f);return}i(null);try{t.apply({name:c.mutation,args:{...c.args}},n?{author:n}:{})}catch(m){d(Je(t.schema,t.allMutations(),m))}},style:tt,children:u?`${c.label} \u2026`:c.label},f):(0,M.jsxs)("p",{"data-testid":"withheld","data-withheld":g.refusal.wouldNeed.join(",")||"nobody",style:{margin:0,fontSize:"0.875rem",color:"var(--graview-ink-muted)"},children:[(0,M.jsx)("s",{children:c.label})," \u2014 ",g.refusal.message]},f)})}),o&&l?(0,M.jsx)(fe,{store:t,mutation:o,prefilled:{...l.args},only:l.missing??[],label:l.label,onDone:()=>{let c=r;i(null),requestAnimationFrame(()=>{let f=c===null?null:s.current[c];if(f?.isConnected){f.focus();return}let u=document.querySelector("[data-graview-page-title]")??document.querySelector("main h1, main h2");u&&(u.hasAttribute("tabindex")||(u.tabIndex=-1),u.focus())})},...n?{principal:n}:{}}):null,l&&!o&&(l.missing??[]).length>0?(0,M.jsxs)("p",{"data-testid":"refused",role:"alert",style:{margin:0,color:"var(--graview-warn)",fontSize:"0.875rem"},children:["\u201C",l.label,"\u201D names ",l.mutation,", which this app does not declare."]}):null,a?(0,M.jsx)("p",{"data-testid":"refused",role:"alert",style:{margin:0,color:"var(--graview-warn)",fontSize:"0.875rem"},children:a}):null]})}var w=$(B(),1),or=[];function qt({context:t}){let{store:e,brand:n,principal:r,invariantContext:i}=t;V(e);let a=se()!==null,d=ke(),s=decodeURIComponent(d.id??""),l=oa(e,s,{...r?{principal:r}:{},...i?{context:i}:{}}),o=Qe(e,l?.violations??or),[c,f]=(0,ct.useState)(null),u=(0,ct.useRef)(null);if(!l)return(0,w.jsx)(U,{context:t,children:(0,w.jsx)(J,{context:t,children:"Nothing lives at this address."})});let g=e.graph.getNode(s),m=e.schema.tryDefinition(l.kind),x=m?.describe&&g?Zt(m,g):null,E=[...e.log.all()].filter(y=>!sn(y)&&(y.writes.includes(s)||y.reads.includes(s))).slice(-8).reverse(),C=l.actions.affordances.filter(y=>y.provider!=="invariant"),K=t.views?.lookup(l.kind,{cardinality:"one",fidelity:"full"}),ue=K!==void 0&&!Ee(K)?K:void 0,Q=ue&&g?Xe(K,g,e.graph):void 0,we=Q?l.fields.filter(y=>!Q.fields.has(y.key)):l.fields,N=Q?l.links.flatMap(y=>{let A=y.targets.filter(j=>!Q.records.has(j.id));return A.length>0?[{...y,targets:A}]:[]}):l.links,ae=ue!==void 0&&Cn(K),Oe=a&&Fn(m).length>0;return(0,w.jsxs)(U,{context:t,children:[(0,w.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,w.jsxs)("p",{style:{...ne,display:"flex",alignItems:"center",gap:8},children:[(0,w.jsx)(ee,{kind:l.kind,brand:n,schema:e.schema,size:8}),(0,w.jsx)(L,{to:`/${G(e.schema,l.kind)}`,style:X,children:I(e,l.kind)})]}),(0,w.jsx)(J,{context:t,children:a&&g?.label===l.label?(0,w.jsx)(Pt,{nodeId:s,field:"label",value:l.label}):l.label}),x&&x!==l.label?(0,w.jsx)("p",{style:Y,children:x}):null,(0,w.jsx)(et,{context:t,stop:`#focus=${encodeURIComponent(s)}`,style:{...F,...k},"data-testid":"spatial-link"}),ce(t).some(y=>y.kind===l.kind||y.across===l.kind)?(0,w.jsxs)("p",{style:{...k,margin:0},"data-testid":"seen-in",children:["Seen in:"," ",ce(t).filter(y=>y.kind===l.kind||y.across===l.kind).map((y,A)=>(0,w.jsxs)("span",{children:[A>0?" \xB7 ":null,(0,w.jsx)(L,{to:ge(t,y),style:F,children:y.title})," ",(0,w.jsx)(et,{context:t,stop:`#view=${encodeURIComponent(y.as)}`,style:{...F,...k,display:"inline-block",minWidth:24,textAlign:"center"},title:`${y.title}, in the scene`,children:"\u2197"})]},Le(y)))]}):null]}),ue&&g?(0,w.jsx)("section",{"data-testid":"record-view",style:{display:"grid",minWidth:0},children:(0,w.jsx)(Hn,{children:(0,w.jsx)(ue,{node:g,cardinality:"one",fidelity:"full",mode:"fullscreen",selected:!1,...l.violations.length>0?{flagged:[s]}:{}})})}):null,l.violations.length>0?(0,w.jsx)("section",{"data-testid":"record-violations",style:{display:"grid",gap:12,padding:"16px 18px",borderLeft:"3px solid var(--graview-warn)",background:"var(--graview-panel-warning)",borderRadius:"0 var(--graview-radius, 12px) var(--graview-radius, 12px) 0"},children:o.map((y,A)=>(0,w.jsxs)("div",{style:{display:"grid",gap:8},children:[(0,w.jsx)(dt,{violation:y,schema:e.schema,...n?{brand:n}:{}}),(0,w.jsx)(pt,{store:e,repairs:sa(l.actions,y.repairs),...r?{principal:r}:{}})]},A))}):null,!ae&&(we.length>0||Oe)?(0,w.jsxs)("section",{style:{..._,display:"grid",gap:14},"data-testid":"record-fields",children:[(0,w.jsx)("h2",{style:D,children:"The facts"}),rn(m,we).map((y,A)=>{let j=(0,w.jsx)("dl",{style:{margin:0,display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(200px, 1fr))",gap:"14px 24px"},children:y.fields.map(z=>z.files?(0,w.jsx)(xe,{as:"field",read:!a,nodeId:s,field:z.key,label:z.label,files:z.files,labelStyle:{...ne,fontSize:"0.75rem"},style:{gap:4}},z.key):z.long?(0,w.jsx)(In,{nodeId:s,field:z.key,label:z.label,value:z.value,style:{gridColumn:"1 / -1",gap:4},labelStyle:{...ne,fontSize:"0.75rem"},valueStyle:{fontSize:"1.0625rem",lineHeight:1.6}},z.key):(0,w.jsxs)("div",{style:{display:"grid",gap:2,minWidth:0,alignContent:"start"},children:[(0,w.jsx)("dt",{style:{...ne,fontSize:"0.75rem"},children:z.label}),(0,w.jsx)("dd",{style:{margin:0,fontSize:"1.125rem",overflowWrap:"anywhere",minWidth:0},children:a?(0,w.jsx)(Pt,{nodeId:s,field:z.key,value:z.value,stored:z.stored}):z.value})]},z.key))});return y.title?(0,w.jsxs)("section",{style:{display:"grid",gap:10,minWidth:0},children:[(0,w.jsx)("h3",{"data-graview-field-group":y.title,style:{...D,fontSize:"1.0625rem"},children:y.title}),j]},A):(0,w.jsx)("div",{children:j},A)}),Oe?(0,w.jsx)(xe,{as:"unfilled",nodeId:s,skip:[...Q?.fields??[]],labelStyle:{...ne,fontSize:"0.75rem"},style:{gap:4}}):null]}):null,(ae?[]:N).map(y=>(0,w.jsxs)("section",{style:{..._,display:"grid",gap:10},children:[(0,w.jsx)("p",{style:ne,children:Xn(e,y)}),y.description?(0,w.jsx)("h2",{style:D,children:le(y.description)}):(0,w.jsxs)("h2",{style:D,"aria-label":ie(y.edgeKind),children:[y.direction==="in"?"\u2190 ":"\u2192 ",ie(y.edgeKind)]}),(0,w.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexWrap:"wrap",gap:"6px 18px"},children:y.targets.map(A=>(0,w.jsxs)("li",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[(0,w.jsx)(ee,{kind:A.kind,brand:n,schema:e.schema,size:7}),(0,w.jsxs)(L,{to:q(e.schema,A.kind,A.id),style:{...F,fontSize:"1.125rem"},children:[A.label,A.apart?(0,w.jsxs)("span",{style:k,children:[" \xB7 ",A.apart]}):null]})]},A.id))}),(y.direction==="out"&&e.schema.edge(y.edgeKind)?.cardinality==="one"?[]:[...new Set(y.targets.map(A=>A.kind))]).map(A=>(0,w.jsxs)(L,{to:`/${G(e.schema,A)}?${encodeURIComponent(y.edgeKind)}=${encodeURIComponent(s)}`,style:{...F,...k},"data-testid":"related-all",children:["Sort and filter ",y.description??`these ${I(e,A).toLowerCase()}`,y.targets.some(j=>j.kind!==A)?` (${I(e,A).toLowerCase()})`:""," \u2192"]},A))]},`${y.edgeKind}|${y.direction}|${y.description??""}`)),!ae&&(C.length>0||l.actions.withheld.length>0)?(0,w.jsxs)("section",{style:{..._,display:"grid",gap:14},"data-testid":"record-actions",children:[(0,w.jsx)("h2",{style:D,ref:u,tabIndex:-1,children:"What can be done"}),(0,w.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:8},children:C.map(y=>{let A=c===y.id;return(0,w.jsx)("button",{type:"button","data-affordance":y.id,"data-rank":y.rank,"aria-expanded":A,onClick:()=>f(A?null:y.id),style:{...tt,...A?{borderColor:"var(--graview-accent)",color:"var(--graview-accent)"}:{}},children:y.label},y.id)})}),C.map(y=>{if(c!==y.id)return null;let A=e.allMutations().find(j=>j.name===y.mutation);return A?(0,w.jsxs)("div",{style:{display:"grid",gap:10,padding:18,border:"1px solid var(--graview-edge)",borderRadius:"var(--graview-radius, 12px)",background:"var(--graview-panel)"},children:[(0,w.jsx)("h3",{style:{...D,fontSize:"1.1875rem"},children:y.label}),A.description?(0,w.jsx)("p",{style:{...k,margin:0},children:A.description}):null,(0,w.jsx)(fe,{store:e,mutation:A,prefilled:y.args,open:y.open,label:y.label,onDone:()=>{f(null);let j=y.id;requestAnimationFrame(()=>{(u.current?.parentElement?.querySelector(`[data-affordance="${j.replace(/["\\]/g,"\\$&")}"]`)??u.current)?.focus()})},...r?{principal:r}:{}})]},y.id):null}),l.actions.withheld.length>0?(0,w.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:4},children:l.actions.withheld.map(y=>(0,w.jsxs)("li",{style:k,children:[(0,w.jsx)("s",{children:y.label})," \u2014 ",y.refusal.message]},y.id))}):null]}):null,E.length>0?(0,w.jsxs)("section",{style:{..._,display:"grid",gap:10},"data-testid":"record-history",children:[(0,w.jsx)("h2",{style:D,children:"What has happened"}),(0,w.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:6},children:E.map(y=>(0,w.jsxs)("li",{style:k,children:[(0,w.jsx)("span",{style:{color:"var(--graview-ink)"},children:y.intent})," \u2014 ",nt(y,r,{graph:e.graph,schema:e.schema,...t.seats?{seats:t.seats}:{},...t.people?{people:t.people}:{}})]},y.id))})]}):null]})}var v=$(B(),1),sr=(0,W.lazy)(()=>import("./chunk.MVNIKZIC.js").then(t=>({default:t.DraftPage})));function lr({context:t,children:e}){let n=he(),r=t.store.schema,i=(0,W.useMemo)(()=>({href:a=>q(r,a.kind,a.id),go:a=>n(q(r,a.kind,a.id))}),[r,n]);return(0,v.jsx)(zn.Provider,{value:i,children:(0,v.jsx)(Bn.Provider,{value:(t.titleLevel??(t.framed&&!t.barAbove?1:2))-1,children:e})})}function dr({steering:t}){let e=de(),n=he(),r=`${e.pathname}${e.search}`;return(0,W.useLayoutEffect)(()=>t.at(r),[r,t]),(0,W.useLayoutEffect)(()=>{let i=d=>{d!==r&&n(d)};t.go.current=i;let a=t.pending?.current;return a!==void 0&&(t.pending.current=void 0,i(a)),()=>{t.go.current===i&&(t.go.current=void 0)}},[r,n,t]),null}function pr({context:t,to:e}){let{pathname:n}=de(),r=se(),i=(e??r)?.sayWhere,a=cr(t,n);return(0,W.useEffect)(()=>(i?.(a),()=>i?.(null)),[i,a]),null}function cr(t,e){let[n="",r,i]=e.split("/").filter(Boolean).map(d=>{try{return decodeURIComponent(d)}catch{return d}});if(i!==void 0)return"#";if(n==="places"&&r!==void 0){if(r===kt)return"#overview=1";let d=t.views?.places().find(s=>s.as===r);return d?`#focus=${encodeURIComponent(He(d.kind))}&view=${encodeURIComponent(d.as)}`:"#"}let a=ye(t.store.schema,n);return a?`#focus=${encodeURIComponent(r??He(a))}`:"#"}function gr({onNavigate:t,path:e}){let n=de(),r=Rt(),i=he(),a=`${n.pathname}${n.search}`,d=(0,W.useRef)(t);d.current=t;let s=(0,W.useRef)(null);(0,W.useEffect)(()=>{let o=s.current;s.current=a,o!==null&&(a===o&&r!=="PUSH"||d.current?.(a,r==="POP"?"pop":r==="REPLACE"?"replace":"push"))},[n.key]);let l=(0,W.useRef)(e);return(0,W.useEffect)(()=>{e===void 0||e===l.current||(l.current=e,e!==a&&i(e))},[e]),null}function Ra({context:t,registry:e,page:n}){let r=ke(),i=ye(t.store.schema,r.slug??""),a=n==="list"?Bt:qt,s=(i?e?.lookup(i,n):void 0)??a;return(0,v.jsx)(s,{context:t})}function ur({context:t,registry:e,children:n}){let r=(0,W.useRef)(null);return Rn(r),(0,v.jsx)("div",{ref:r,"data-graview-face":"pages",style:{display:"contents"},children:(0,v.jsx)(ha,{context:t,registry:e,root:r,children:n})})}function mr(){let{pathname:t}=de(),e=Rt(),n=(0,W.useRef)(null);(0,W.useLayoutEffect)(()=>{if(e!=="POP"){for(let a=n.current?.parentElement;a;a=a.parentElement){let{overflowY:d}=getComputedStyle(a);if((d==="auto"||d==="scroll")&&a.scrollHeight>a.clientHeight){a.scrollTop=0;return}}window.scrollTo(0,0)}},[t]);let r=(0,W.useRef)(t),i=(0,W.useRef)(!1);return(0,W.useEffect)(()=>{if(!i.current&&t===r.current)return;i.current=!0;let a=document.activeElement;if(a!==null&&a!==document.body&&a!==document.documentElement)return;let d=n.current?.closest("main")??document.querySelector("main"),l=n.current?.closest("[data-graview-face]")?.querySelector("[data-graview-page-title]")??d?.querySelector("h1, h2")??null??d??null;l&&(l.hasAttribute("tabindex")||l.setAttribute("tabindex","-1"),l.focus({preventScroll:!0}))},[t]),(0,v.jsx)("span",{ref:n,hidden:!0,"data-graview-scroll-reset":""})}function fr({context:t,children:e}){let n=he(),r=(0,W.useMemo)(()=>({record:i=>{let a=t.store.graph.getNode(i);a&&n(q(t.store.schema,a.kind,i))},place:i=>{let a=t.views?.places().find(d=>d.as===i);a&&n(ge(t,a))}}),[t,n]);return(0,v.jsx)(Pn.Provider,{value:r,children:e})}function yr({context:t,Home:e}){let i=de().key==="default"?hn(t.views?.arrangement?.()?.first,t.store.schema,t.views?.places()??[]):void 0,a=i?.to==="place"?ge(t,i.place):i?.to==="kind"?`/${G(t.store.schema,i.kind)}`:void 0;return a?(0,v.jsx)(At,{to:a,replace:!0}):(0,v.jsx)(e,{context:t})}function Aa({context:t,registry:e}){let n=e?.lookupSurface("shell"),r=n!==void 0,i=r&&(e?.without().has("bar")??!1),a=r&&!i&&!t.embedded?{...t,barAbove:!0}:t,d=m=>n===void 0?(0,v.jsx)(it,{context:t,children:m}):i?(0,v.jsx)(n,{context:t,children:m}):(0,v.jsx)(it,{context:t,children:(0,v.jsx)(n,{context:a,children:m})}),s=e?.lookupSurface("home")??Ht,l=e?.lookupSurface("problems")??Gt,o=r?{...a,framed:!0}:t,[c,f]=(0,W.useState)(null),u=(0,W.useMemo)(()=>({onFind:f,find:!(e?.without().has("find")??!1),places:!(e?.without().has("places")??!1)}),[e]),g=(0,v.jsx)(ur,{context:t,registry:e,children:(0,v.jsx)(fr,{context:t,children:d((0,v.jsx)(v.Fragment,{children:(0,v.jsxs)(lr,{context:o,children:[(0,v.jsx)(mr,{}),(0,v.jsxs)(na,{children:[(e?.routes()??[]).map(({path:m,component:x})=>(0,v.jsx)(pe,{path:m,element:(0,v.jsx)(x,{context:o})},m)),(0,v.jsx)(pe,{path:"/",element:(0,v.jsx)(yr,{context:o,Home:s})}),(0,v.jsx)(pe,{path:"/problems",element:(0,v.jsx)(l,{context:o})}),(0,v.jsx)(pe,{path:"/~draft",element:(0,v.jsx)(W.Suspense,{fallback:null,children:(0,v.jsx)(sr,{context:o})})}),(0,v.jsx)(pe,{path:"/search",element:(0,v.jsx)(zt,{context:o})}),(0,v.jsx)(pe,{path:"/map",element:(0,v.jsx)(Kt,{context:o})}),(0,v.jsx)(pe,{path:"/places",element:(0,v.jsx)(Dt,{context:o})}),ce(o).some(m=>m.as===kt)?null:(0,v.jsx)(pe,{path:yn,element:(0,v.jsx)(At,{to:"/",replace:!0})}),(0,v.jsx)(pe,{path:"/places/:as",element:(0,v.jsx)(It,{context:o})}),(0,v.jsx)(pe,{path:"/:slug",element:(0,v.jsx)(Ra,{context:o,registry:e,page:"list"})}),(0,v.jsx)(pe,{path:"/:slug/:id",element:(0,v.jsx)(Ra,{context:o,registry:e,page:"record"})})]})]})}))})});return t.embedded||!r||i?g:(0,v.jsx)(ia.Provider,{value:u,children:(0,v.jsx)($n.Provider,{value:c,children:g})})}function hr({context:t,registry:e,basename:n,initialPath:r,onNavigate:i,path:a,steering:d}){(0,W.useState)(()=>t.views?Vn(t.views,t.store.schema,Wn(t.brand,t.store.schema)):void 0);let s=se(),l=t.store.seenBy(t.principal??{kind:"human"}),o=l===t.store?t:{...t,store:l};bn(t.store,t.principal);let c=(0,v.jsxs)(v.Fragment,{children:[i||a!==void 0?(0,v.jsx)(gr,{onNavigate:i,path:a}):null,d?(0,v.jsx)(dr,{steering:d}):null,o.presence||s?(0,v.jsx)(pr,{context:o,to:s}):null,(0,v.jsx)(Aa,{context:o,...e?{registry:e}:{}})]}),f=o.views?(0,v.jsxs)(xn,{store:o.store,views:o.views,...o.principal?{principal:o.principal}:{},...o.brand?{brand:o.brand}:{},...o.settings?{settings:o.settings}:{},...o.presence&&!s?{presence:o.presence}:{},...o.people?{people:o.people}:{},...o.onKeepLens?{onKeepLens:o.onKeepLens}:{},...o.ai?{ai:o.ai}:{},...o.app?{app:o.app}:{},children:[c,(0,v.jsx)(ma,{context:o})]}):c,u=o.files?(0,v.jsx)(Sn.Provider,{value:o.files,children:f}):f;if(r!==void 0){let g=n===void 0?r:`${n.replace(/\/$/,"")}${r}`;return(0,v.jsx)(ta,{initialEntries:[g],...n===void 0?{}:{basename:n},children:u})}return(0,v.jsx)(aa,{...n===void 0?{}:{basename:n},children:u})}export{Ka as a,hr as b};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{g as a}from"./chunk.GE5EAN36.js";import{b as s}from"./chunk.337WDTG3.js";function f(e){let r=new Map;for(let i of e.kinds){let n=e.tryDefinition(i),o=a(n);r.set(i,{fields:new Set(Object.keys(n?.fields?.shape??{})),edges:new Map(Object.entries(n?.edges??{}).map(([d,p])=>[d,p.cardinality??"many"])),...o?{computed:o}:{}})}let t=a(e);return t&&r.set(s,{computed:t}),r}export{f as a};
|