graview 0.1.46 → 0.1.47
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.L2PI7V4R.js → chunk.24OZGU7J.js} +1 -1
- package/dist/preview/{chunk.FGR7KCI6.js → chunk.2CLANQHZ.js} +1 -1
- package/dist/preview/{chunk.P4O5DGLN.js → chunk.2L3VFGHX.js} +1 -1
- package/dist/preview/chunk.2MCZ4CU5.js +1 -0
- package/dist/preview/{chunk.R2AG4NHQ.js → chunk.2W22AWSL.js} +1 -1
- package/dist/preview/chunk.3LDYUO77.js +1 -0
- package/dist/preview/{chunk.6OPI4WWO.js → chunk.47RTA6M3.js} +1 -1
- package/dist/preview/{chunk.N7VNEUJR.js → chunk.4YS7547F.js} +1 -1
- package/dist/preview/{chunk.W45NKVSV.js → chunk.4YXJPKXD.js} +1 -1
- package/dist/preview/{chunk.UNCS63AM.js → chunk.52VGZBO3.js} +1 -1
- package/dist/preview/{chunk.X25KXCWI.js → chunk.57ZSMK3R.js} +1 -1
- package/dist/preview/{chunk.6MADC6DM.js → chunk.5AGW4NRZ.js} +1 -1
- package/dist/preview/chunk.5G53VDOC.js +1 -0
- package/dist/preview/chunk.5M4TMZXC.js +1 -0
- package/dist/preview/{chunk.GEPNIMXW.js → chunk.5TM5VA2H.js} +1 -1
- package/dist/preview/{chunk.Y5ARSVH4.js → chunk.63MS2LOP.js} +1 -1
- package/dist/preview/{chunk.LKVXSC5O.js → chunk.6QVXXQCW.js} +1 -1
- package/dist/preview/{chunk.RNBPDB37.js → chunk.6TIEX67B.js} +1 -1
- package/dist/preview/{chunk.JF3GD4H5.js → chunk.76GF5US2.js} +1 -1
- package/dist/preview/{chunk.55D33E5A.js → chunk.7ELB37JU.js} +1 -1
- package/dist/preview/chunk.7N2GXZYI.js +3 -0
- package/dist/preview/{chunk.ATDU5Y7V.js → chunk.7NNI7YH4.js} +1 -1
- package/dist/preview/{chunk.MWONSI3P.js → chunk.A3RNSSUQ.js} +1 -1
- package/dist/preview/{chunk.CICGAEBW.js → chunk.A7RKTSOH.js} +2 -2
- package/dist/preview/{chunk.T7O6K3IN.js → chunk.AWXDZUKH.js} +1 -1
- package/dist/preview/{chunk.FXTBMW3S.js → chunk.BBS5C2BY.js} +1 -1
- package/dist/preview/{chunk.IJABD7SI.js → chunk.C3NHNYA6.js} +1 -1
- package/dist/preview/{chunk.S5MQVPLF.js → chunk.C44MC5X3.js} +1 -1
- package/dist/preview/{chunk.O24DD2VF.js → chunk.CMOXKRWT.js} +1 -1
- package/dist/preview/{chunk.HBD7FBZS.js → chunk.COYLGLTI.js} +1 -1
- package/dist/preview/{chunk.6SOUQNXR.js → chunk.CTQULC5F.js} +1 -1
- package/dist/preview/{chunk.PLWVLW22.js → chunk.DNROW6LX.js} +1 -1
- package/dist/preview/{chunk.JLEC3USG.js → chunk.DQS7D2W2.js} +1 -1
- package/dist/preview/{chunk.UR3XYOQ6.js → chunk.ETPKXUAN.js} +1 -1
- package/dist/preview/{chunk.XXEYRHRG.js → chunk.ETR6AV47.js} +1 -1
- package/dist/preview/{chunk.6QYJ2K6K.js → chunk.EUPSAYEI.js} +1 -1
- package/dist/preview/{chunk.I3GP5JW7.js → chunk.EYI3Y2DY.js} +1 -1
- package/dist/preview/chunk.F2VMMCVK.js +1 -0
- package/dist/preview/{chunk.SS27NH5O.js → chunk.F67F6QZ6.js} +1 -1
- package/dist/preview/chunk.FOJDVK2Q.js +1 -0
- package/dist/preview/{chunk.VC3BX2ZF.js → chunk.FOQ27RAR.js} +1 -1
- package/dist/preview/{chunk.EPUBSKKL.js → chunk.FWSCBHZ5.js} +1 -1
- package/dist/preview/chunk.G446PWV6.js +1 -0
- package/dist/preview/{chunk.WP5W44Y4.js → chunk.GCKZ2YRJ.js} +2 -2
- package/dist/preview/{chunk.WO3DDFFY.js → chunk.GQHAAKJG.js} +1 -1
- package/dist/preview/{chunk.F37DHXA2.js → chunk.I6JLOEJU.js} +1 -1
- package/dist/preview/chunk.IJNOT4S4.js +4 -0
- package/dist/preview/{chunk.ONEYVLC2.js → chunk.IPAZOKMQ.js} +1 -1
- package/dist/preview/{chunk.5ESCD57M.js → chunk.IQ2HKGJS.js} +1 -1
- package/dist/preview/{chunk.DEUTHHGI.js → chunk.IROYMLER.js} +1 -1
- package/dist/preview/chunk.ISNEX772.js +1 -0
- package/dist/preview/{chunk.R4OU7O6C.js → chunk.IXOQQBJE.js} +1 -1
- package/dist/preview/{chunk.NWA7Q6CI.js → chunk.IYIN6VSN.js} +1 -1
- package/dist/preview/{chunk.FO5BOBYV.js → chunk.JUWWRRHA.js} +1 -1
- package/dist/preview/{chunk.JNIGZEOF.js → chunk.K2NCGPCL.js} +1 -1
- package/dist/preview/{chunk.4KNEBLB7.js → chunk.KSM6NVAT.js} +1 -1
- package/dist/preview/{chunk.BFKV4GKP.js → chunk.L4YNDNX7.js} +1 -1
- package/dist/preview/{chunk.A5VGTO3E.js → chunk.MBETS27C.js} +1 -1
- package/dist/preview/{chunk.3OSGN463.js → chunk.MCB26YCQ.js} +1 -1
- package/dist/preview/chunk.MCCUVGTE.js +1 -0
- package/dist/preview/{chunk.BCWPV4WR.js → chunk.MF73YBJL.js} +1 -1
- package/dist/preview/{chunk.UOXFALRL.js → chunk.N7JT6MG2.js} +1 -1
- package/dist/preview/{chunk.V5Z2OED6.js → chunk.NDWW5EER.js} +1 -1
- package/dist/preview/{chunk.LVEFQLGQ.js → chunk.NEEOVRB7.js} +1 -1
- package/dist/preview/{chunk.NMIXBH37.js → chunk.NFIGGSMJ.js} +1 -1
- package/dist/preview/{chunk.JBW3DI7E.js → chunk.O2WWYZI7.js} +1 -1
- package/dist/preview/{chunk.XSNAG4JT.js → chunk.O4WEJ47H.js} +3 -3
- package/dist/preview/{chunk.LUNATPAB.js → chunk.OCTOGZVJ.js} +2 -2
- package/dist/preview/{chunk.BAMPYMUE.js → chunk.OJGUIWDD.js} +1 -1
- package/dist/preview/{chunk.VDVJCLGS.js → chunk.OONCUAOH.js} +1 -1
- package/dist/preview/{chunk.VBPK6ARF.js → chunk.P4KCZRIG.js} +1 -1
- package/dist/preview/{chunk.4Y6VGQVQ.js → chunk.PBKO5CKD.js} +1 -1
- package/dist/preview/{chunk.JLYNMAME.js → chunk.PYE3WZM7.js} +1 -1
- package/dist/preview/{chunk.F5PBK4TF.js → chunk.QGG6ZRJ5.js} +2 -2
- package/dist/preview/{chunk.LETJC5TD.js → chunk.QZEZHCOI.js} +1 -1
- package/dist/preview/{chunk.DQOCBKC3.js → chunk.R6V37SR7.js} +1 -1
- package/dist/preview/{chunk.NGIPVTTE.js → chunk.RBJAPOZ3.js} +1 -1
- package/dist/preview/{chunk.RZXPBOGT.js → chunk.RG6WNOBW.js} +1 -1
- package/dist/preview/{chunk.LKN734RR.js → chunk.RUPRZDN3.js} +1 -1
- package/dist/preview/{chunk.S6WHA4CW.js → chunk.RVJXO5GG.js} +1 -1
- package/dist/preview/chunk.RX2M4C5W.js +2 -0
- package/dist/preview/{chunk.EAJB2PJZ.js → chunk.RZF3QM4E.js} +1 -1
- package/dist/preview/{chunk.JLIUUFK2.js → chunk.S5IQFZ5Z.js} +1 -1
- package/dist/preview/{chunk.TOZJZXWQ.js → chunk.SD6N4DGF.js} +1 -1
- package/dist/preview/{chunk.URO2EGY7.js → chunk.SGKK4UKP.js} +1 -1
- package/dist/preview/{chunk.OHSJQYJN.js → chunk.SWWAEOZ7.js} +1 -1
- package/dist/preview/chunk.SZR3Z43B.js +1 -0
- package/dist/preview/{chunk.RTI3FEDD.js → chunk.T42S2WMB.js} +1 -1
- package/dist/preview/chunk.T7RJCEJB.js +18 -0
- package/dist/preview/{chunk.3MMLRSRC.js → chunk.TCXKPILZ.js} +1 -1
- package/dist/preview/{chunk.TFVFJFXC.js → chunk.TJEV5ZAM.js} +3 -3
- package/dist/preview/{chunk.Z5IGHCZX.js → chunk.UV3YU64Z.js} +1 -1
- package/dist/preview/{chunk.WQONZBA3.js → chunk.V7XHNRQM.js} +2 -2
- package/dist/preview/{chunk.M5GJHVWZ.js → chunk.VC3UGFHY.js} +1 -1
- package/dist/preview/{chunk.NIVTK2W5.js → chunk.VSNHCGKC.js} +1 -1
- package/dist/preview/{chunk.UVNVDLV5.js → chunk.VXVWUIGO.js} +1 -1
- package/dist/preview/chunk.W6COSBO2.js +21 -0
- package/dist/preview/{chunk.3VFYSXMQ.js → chunk.WHEUTAXA.js} +1 -1
- package/dist/preview/{chunk.ITYQUSZI.js → chunk.WJS6P7GI.js} +1 -1
- package/dist/preview/chunk.X5G7FOPY.js +12 -0
- package/dist/preview/{chunk.6WA6ASQB.js → chunk.XYEFZ2OO.js} +1 -1
- package/dist/preview/chunk.Y4ZUJUUT.js +25 -0
- package/dist/preview/{chunk.HZCA3UWJ.js → chunk.YHH4TWZ2.js} +1 -1
- package/dist/preview/{chunk.4RJZVTW7.js → chunk.YVONXFKE.js} +1 -1
- package/dist/preview/{chunk.5R2R364Q.js → chunk.Z4UM4CMT.js} +1 -1
- package/dist/preview/{chunk.4HYJHGI4.js → chunk.ZCYGUP3I.js} +1 -1
- package/dist/preview/{chunk.FVOJCVRX.js → chunk.ZL7ZBJUU.js} +1 -1
- package/dist/preview/{chunk.JT3IZIU5.js → chunk.ZQY6ODXC.js} +1 -1
- package/dist/preview/{chunk.SL2FZ54V.js → chunk.ZWVN75EY.js} +1 -1
- package/dist/preview/index.html +33 -33
- package/dist/preview/page.js +2 -2
- package/package.json +6 -6
- package/dist/preview/chunk.2JJYGYT2.js +0 -1
- package/dist/preview/chunk.5K6KX3UC.js +0 -1
- package/dist/preview/chunk.6BDM2XRX.js +0 -1
- package/dist/preview/chunk.6UIW664O.js +0 -6
- package/dist/preview/chunk.AQQZY6OY.js +0 -3
- package/dist/preview/chunk.GVY5UQTJ.js +0 -1
- package/dist/preview/chunk.JHIUG25Q.js +0 -1
- package/dist/preview/chunk.JQLR6KO2.js +0 -1
- package/dist/preview/chunk.NITU5H4J.js +0 -1
- package/dist/preview/chunk.UPQZU7UO.js +0 -21
- package/dist/preview/chunk.V3QUTJR2.js +0 -2
- package/dist/preview/chunk.WM2LWHTJ.js +0 -1
- package/dist/preview/chunk.WSTBCWW7.js +0 -4
- package/dist/preview/chunk.X233NILF.js +0 -1
- package/dist/preview/chunk.XWAMQPUM.js +0 -25
- package/dist/preview/chunk.XXDBZQNY.js +0 -18
- package/dist/preview/chunk.ZTIF23VF.js +0 -1
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{a as Ke}from"./chunk.SDO3U72B.js";import{$b as Fn,Fa as jn,Hc as Bn,J as Nn,Ja as St,Kc as qn,La as Wn,Nc as zn,Wa as Gn,ad as $n,qd as Un,vd as Fe,wc as Kn,wd as wt}from"./chunk.AS4CQBOQ.js";import{a as Ge,b as _}from"./chunk.AJZBJBMO.js";var yo=Ge(w=>{"use strict";var Rt=Symbol.for("react.transitional.element"),Nr=Symbol.for("react.portal"),jr=Symbol.for("react.fragment"),Wr=Symbol.for("react.strict_mode"),Gr=Symbol.for("react.profiler"),Fr=Symbol.for("react.consumer"),Kr=Symbol.for("react.context"),Br=Symbol.for("react.forward_ref"),qr=Symbol.for("react.suspense"),zr=Symbol.for("react.memo"),so=Symbol.for("react.lazy"),$r=Symbol.for("react.activity"),oo=Symbol.iterator;function Ur(e){return e===null||typeof e!="object"?null:(e=oo&&e[oo]||e["@@iterator"],typeof e=="function"?e:null)}var lo={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},uo=Object.assign,co={};function ge(e,t,n){this.props=e,this.context=t,this.refs=co,this.updater=n||lo}ge.prototype.isReactComponent={};ge.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};ge.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function fo(){}fo.prototype=ge.prototype;function Tt(e,t,n){this.props=e,this.context=t,this.refs=co,this.updater=n||lo}var Mt=Tt.prototype=new fo;Mt.constructor=Tt;uo(Mt,ge.prototype);Mt.isPureReactComponent=!0;var ro=Array.isArray;function kt(){}var O={H:null,A:null,T:null,S:null},po=Object.prototype.hasOwnProperty;function Ot(e,t,n){var o=n.ref;return{$$typeof:Rt,type:e,key:t,ref:o!==void 0?o:null,props:n}}function Yr(e,t){return Ot(e.type,t,e.props)}function Vt(e){return typeof e=="object"&&e!==null&&e.$$typeof===Rt}function Zr(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var io=/\/+/g;function At(e,t){return typeof e=="object"&&e!==null&&e.key!=null?Zr(""+e.key):t.toString(36)}function Xr(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(kt,kt):(e.status="pending",e.then(function(t){e.status==="pending"&&(e.status="fulfilled",e.value=t)},function(t){e.status==="pending"&&(e.status="rejected",e.reason=t)})),e.status){case"fulfilled":return e.value;case"rejected":throw e.reason}}throw e}function me(e,t,n,o,r){var i=typeof e;(i==="undefined"||i==="boolean")&&(e=null);var a=!1;if(e===null)a=!0;else switch(i){case"bigint":case"string":case"number":a=!0;break;case"object":switch(e.$$typeof){case Rt:case Nr:a=!0;break;case so:return a=e._init,me(a(e._payload),t,n,o,r)}}if(a)return r=r(e),a=o===""?"."+At(e,0):o,ro(r)?(n="",a!=null&&(n=a.replace(io,"$&/")+"/"),me(r,t,n,"",function(u){return u})):r!=null&&(Vt(r)&&(r=Yr(r,n+(r.key==null||e&&e.key===r.key?"":(""+r.key).replace(io,"$&/")+"/")+a)),t.push(r)),1;a=0;var l=o===""?".":o+":";if(ro(e))for(var s=0;s<e.length;s++)o=e[s],i=l+At(o,s),a+=me(o,t,n,i,r);else if(s=Ur(e),typeof s=="function")for(e=s.call(e),s=0;!(o=e.next()).done;)o=o.value,i=l+At(o,s++),a+=me(o,t,n,i,r);else if(i==="object"){if(typeof e.then=="function")return me(Xr(e),t,n,o,r);throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.")}return a}function Xe(e,t,n){if(e==null)return e;var o=[],r=0;return me(e,o,"","",function(i){return t.call(n,i,r++)}),o}function Jr(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var ao=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},Qr={map:Xe,forEach:function(e,t,n){Xe(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Xe(e,function(){t++}),t},toArray:function(e){return Xe(e,function(t){return t})||[]},only:function(e){if(!Vt(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};w.Activity=$r;w.Children=Qr;w.Component=ge;w.Fragment=jr;w.Profiler=Gr;w.PureComponent=Tt;w.StrictMode=Wr;w.Suspense=qr;w.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=O;w.__COMPILER_RUNTIME={__proto__:null,c:function(e){return O.H.useMemoCache(e)}};w.cache=function(e){return function(){return e.apply(null,arguments)}};w.cacheSignal=function(){return null};w.cloneElement=function(e,t,n){if(e==null)throw Error("The argument must be a React element, but you passed "+e+".");var o=uo({},e.props),r=e.key;if(t!=null)for(i in t.key!==void 0&&(r=""+t.key),t)!po.call(t,i)||i==="key"||i==="__self"||i==="__source"||i==="ref"&&t.ref===void 0||(o[i]=t[i]);var i=arguments.length-2;if(i===1)o.children=n;else if(1<i){for(var a=Array(i),l=0;l<i;l++)a[l]=arguments[l+2];o.children=a}return Ot(e.type,r,o)};w.createContext=function(e){return e={$$typeof:Kr,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:Fr,_context:e},e};w.createElement=function(e,t,n){var o,r={},i=null;if(t!=null)for(o in t.key!==void 0&&(i=""+t.key),t)po.call(t,o)&&o!=="key"&&o!=="__self"&&o!=="__source"&&(r[o]=t[o]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var l=Array(a),s=0;s<a;s++)l[s]=arguments[s+2];r.children=l}if(e&&e.defaultProps)for(o in a=e.defaultProps,a)r[o]===void 0&&(r[o]=a[o]);return Ot(e,i,r)};w.createRef=function(){return{current:null}};w.forwardRef=function(e){return{$$typeof:Br,render:e}};w.isValidElement=Vt;w.lazy=function(e){return{$$typeof:so,_payload:{_status:-1,_result:e},_init:Jr}};w.memo=function(e,t){return{$$typeof:zr,type:e,compare:t===void 0?null:t}};w.startTransition=function(e){var t=O.T,n={};O.T=n;try{var o=e(),r=O.S;r!==null&&r(n,o),typeof o=="object"&&o!==null&&typeof o.then=="function"&&o.then(kt,ao)}catch(i){ao(i)}finally{t!==null&&n.types!==null&&(t.types=n.types),O.T=t}};w.unstable_useCacheRefresh=function(){return O.H.useCacheRefresh()};w.use=function(e){return O.H.use(e)};w.useActionState=function(e,t,n){return O.H.useActionState(e,t,n)};w.useCallback=function(e,t){return O.H.useCallback(e,t)};w.useContext=function(e){return O.H.useContext(e)};w.useDebugValue=function(){};w.useDeferredValue=function(e,t){return O.H.useDeferredValue(e,t)};w.useEffect=function(e,t){return O.H.useEffect(e,t)};w.useEffectEvent=function(e){return O.H.useEffectEvent(e)};w.useId=function(){return O.H.useId()};w.useImperativeHandle=function(e,t,n){return O.H.useImperativeHandle(e,t,n)};w.useInsertionEffect=function(e,t){return O.H.useInsertionEffect(e,t)};w.useLayoutEffect=function(e,t){return O.H.useLayoutEffect(e,t)};w.useMemo=function(e,t){return O.H.useMemo(e,t)};w.useOptimistic=function(e,t){return O.H.useOptimistic(e,t)};w.useReducer=function(e,t,n){return O.H.useReducer(e,t,n)};w.useRef=function(e){return O.H.useRef(e)};w.useState=function(e){return O.H.useState(e)};w.useSyncExternalStore=function(e,t,n){return O.H.useSyncExternalStore(e,t,n)};w.useTransition=function(){return O.H.useTransition()};w.version="19.2.8"});var j=Ge((Na,mo)=>{"use strict";mo.exports=yo()});var Po=Ge(et=>{"use strict";var ui=Symbol.for("react.transitional.element"),ci=Symbol.for("react.fragment");function Eo(e,t,n){var o=null;if(n!==void 0&&(o=""+n),t.key!==void 0&&(o=""+t.key),"key"in t){n={};for(var r in t)r!=="key"&&(n[r]=t[r])}else n=t;return t=n.ref,{$$typeof:ui,type:e,key:o,ref:t!==void 0?t:null,props:n}}et.Fragment=ci;et.jsx=Eo;et.jsxs=Eo});var Ie=Ge((za,Ao)=>{"use strict";Ao.exports=Po()});var fe={focusId:null,relation:null,expanded:[],pins:{}},Be=e=>{let t=Number(e);return Number.isFinite(t)?t:null};function te(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}`,`${qe(r.x)},${qe(r.y)}`)}e.pan&&(e.pan.x!==0||e.pan.y!==0)&&t.set("pan",`${qe(e.pan.x)},${qe(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 Cr(e){return e&&e.startsWith("agg:")?`aggregate:${e.slice(4)}`:e}function ze(e){let t=e.includes("#")?e.slice(e.indexOf("#")+1):e,n=new URLSearchParams(t),o=Object.create(null);for(let[m,p]of n){if(!m.startsWith("pin."))continue;let[g,v]=p.split(","),T=g===void 0?null:Be(g),y=v===void 0?null:Be(v);T===null||y===null||(o[m.slice(4)]={x:T,y})}let r=Object.create(null);for(let[m,p]of n)!m.startsWith("in.")||p.length===0||(r[m.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(",")??[],l=a[0]===void 0?null:Be(a[0]),s=a[1]===void 0?null:Be(a[1]),u=(n.get("sel")??"").split(",").filter(m=>m.length>0).sort(),f=n.get("overview")==="1";return{...u.length>0?{selection:u}:{},...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()}:{},...l!==null&&s!==null?{pan:{x:l,y:s}}:{},...Object.keys(r).length>0?{within:r}:{},...n.get("q")?.trim()?{q:n.get("q")}:{},focusId:Cr(n.get("focus")),relation:n.get("relation"),expanded:(n.get("expand")??"").split(",").filter(m=>m.length>0&&(f||!m.startsWith("kind:"))).sort(),pins:o}}function ba(e){let t=ze(e);return te(t)==="#"?{...t,overview:!0}:t}function xa(e){let t=te(e);return t==="#overview=1"?"":t}function qe(e){return Math.round(e*100)/100}function Zn(e,t){return te(e)===te(t)}var Yn="edge:";function Xn(e){if(!e.startsWith(Yn))return null;let t=e.slice(Yn.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 vt(e){let{pan:t,...n}=e;return{...n,pins:{}}}function q(e,t){if(t===e.focusId)return{...e,focusId:t};let n=vt(e);return{...n.within?.q!==void 0?ae(n,"q",null):n,focusId:t}}function Jn(e,t){return{...e,relation:t}}function ae(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 pe(e,t){if(t!==e.overview&&(e=vt(e)),!t){let n=e.expanded.filter(o=>!o.startsWith("kind:"));return{...e,overview:!1,expanded:n}}return{...e,overview:t}}function $e(e,t){if(t.length===0){let{selection:n,...o}=e;return o}return{...e,selection:[...t]}}function Ve(e,t){if(t!==(e.zoom===!0)&&(e=vt(e)),!t){let{zoom:n,...o}=e;return o}return{...e,zoom:!0}}function Ue(e,t){let n=new Set(e.expanded);return n.has(t)?n.delete(t):n.add(t),{...e,expanded:[...n].sort()}}var Ze="aggregate:",Ye="kind:";function bt(e){return`${Ye}${e}`}function ye(e){return e.startsWith(Ye)?e.slice(Ye.length):null}var Aa="kinds:beyond";function Ir(e){let t=ye(e);return t?[t]:se(e)}function ne(...e){return`${Ze}${[...e].sort().join("+")}`}function Qn(e){return e.startsWith(Ze)}function se(e){return!Qn(e)||e.includes("|")?[]:e.slice(Ze.length).split("+").filter(Boolean)}function eo(e,t,n={}){let o=ye(t);if(o!==null&&e.overview&&n.ownPicture!==!0)return Ue(e,t);let r=o!==null?ne(o):t;if(e.zoom&&e.focusId===r&&!(o!==null&&n.carry))return Ve(e,!1);if(o!==null&&n.carry){let i=pe({...q(e,r),relation:null},!1);return ae(Ve(i,!0),"q",n.carry)}return Ve({...q(e,r),relation:null},!0)}function _r(e,t,n){return ae(pe(q(e,ne(t)),!1),"view",n)}function ka(e,t){return e.id<t.id?-1:e.id>t.id?1:0}var to="aggregate:";function xt(e){return e.startsWith(to)&&e.includes("|")}var Et=e=>e?.off===!0,Lr=e=>e!==void 0&&!Et(e)&&(e.fast!==void 0||e.thinking!==void 0||e.answer!==void 0||e.decide!==void 0||e.complete!==void 0||e.turn!==void 0),no=e=>e!==void 0&&!Et(e)&&(e.fast!==void 0||e.decide!==void 0),Hr=e=>e?.suggestOnOpen!==!1&&no(e),Dr=e=>e?.hoverChips===!0&&no(e);var Pt={};var go=_(j(),1),ei={turns:[],outcomes:new Map,busy:!1,pending:null,draft:null,draftNote:null},ho=e=>`graview:seat:${e}`;function ti(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)}:{},...n.draft?.drawn?{draft:n.draft}:{}}}catch{return{}}}function ni(e,t){if(e)try{sessionStorage.setItem(e,JSON.stringify({turns:t.turns.slice(-40),outcomes:[...t.outcomes],draft:t.draft}))}catch{}}function Ct(e){let t=e===null?null:ho(e),n={...ei,...ti(t)},o=new Set,r=(i,a=!0)=>{n=i,a&&ni(t,n);for(let l of[...o])l()};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),ask:i=>r({...n,pending:i.trim()||null}),takePending(){let i=n.pending;return i!==null&&r({...n,pending:null},!1),i},setDraft:(i,a=null)=>r({...n,draft:i,draftNote:a})}}function oi(e){return(0,go.useSyncExternalStore)(e.subscribe,e.get,e.get)}var wo=_(j(),1),ri={entries:[],ghost:null,loaded:!1};function So(e,t){let n=new Map(e.map(o=>[o.id,o]));for(let o of t)n.set(o.id,{...n.get(o.id),...o});return[...n.values()].sort((o,r)=>o.at<r.at?1:o.at>r.at?-1:0)}function It(e){let t=ri,n=new Set,o=r=>{t=r;for(let i of[...n])i()};return{get:()=>t,subscribe:r=>(n.add(r),()=>n.delete(r)),record:r=>{o({...t,entries:So(t.entries,[r])}),Promise.resolve(e()?.keep?.(r)).catch(i=>{console.warn("The host did not keep an AI interaction:",i)})},setGhost:r=>o({...t,ghost:r}),load:()=>{if(t.loaded)return;o({...t,loaded:!0});let r=e()?.load;r&&Promise.resolve(r()).then(i=>o({...t,entries:So(t.entries,i)})).catch(i=>{console.warn("The host's AI interactions could not be read:",i)})}}}function ii(e){return(0,wo.useSyncExternalStore)(e.subscribe,e.get,e.get)}function vo(e){return e?.closest?.("[data-graview-pick]")?.getAttribute("data-graview-pick")??null}var Je=_(j(),1),Qe=(0,Je.createContext)(void 0),ai=()=>(0,Je.useContext)(Qe);var A=_(j(),1),Ce=(0,A.createContext)(null);function xo(){return(0,A.useContext)(Ce)}function si(e,t){let n=xo(),o=(0,A.useMemo)(()=>n?n.live.seenBy(t):e,[n,e,t]),r=(0,A.useRef)(0),i=(0,A.useCallback)(a=>o.subscribe(()=>{r.current+=1,a()}),[o]);return(0,A.useSyncExternalStore)(i,()=>r.current,()=>0),o}var li=Ke(()=>(__graviewPreload(import.meta.url,["./chunk.TI4OSTQV.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.E2AJ7U5Z.js"))),bo,di=400;function _t(e,t,n){let o=(0,A.useContext)(Ce),r=o!==null&&o.owns(e,t),[i,a]=(0,A.useState)(null),[l,s]=(0,A.useState)(bo);(0,A.useEffect)(()=>{if(l||r||i===null)return;let x=!0;return li().then(C=>{bo=C,x&&s(C)},()=>{}),()=>{x=!1}},[l,r,i]);let[u,f]=(0,A.useState)(0),m=(0,A.useMemo)(()=>r||i===null||i>=e.log.length||!l?void 0:l.askArchived(e,i,n)??l.askDeclaration(n,i),[r,e,i,n,l,u]),p=m&&"waiting"in m?m.waiting:void 0,g=m&&"seq"in m?m:null,[v,T]=(0,A.useState)(void 0);(0,A.useEffect)(()=>{if(!p)return;let x=!0,C=setTimeout(()=>x&&T(p),di);return p.then(()=>x&&f(V=>V+1)),()=>{x=!1,clearTimeout(C)}},[p]);let y=p!==void 0&&v!==p||g!==null,b=(0,A.useMemo)(()=>{if(r||i===null||i>=e.log.length||!l||y)return null;try{let x=l.pastAt(e,i,n);return{seq:i,at:x.past?.at,store:x}}catch{return null}},[r,e,i,n,l,y,u]),h=(0,A.useRef)(null),E=y?h.current:b;(0,A.useEffect)(()=>{h.current=E},[E]);let P=(0,A.useCallback)(x=>a(x===null?null:x>=e.log.length?Number.POSITIVE_INFINITY:x),[e]),W=(0,A.useCallback)((x,C)=>[e,E?.store].some(V=>V!==void 0&&(V===x||V.seenBy(C)===x)),[e,E]),N=i!==null,H=(0,A.useMemo)(()=>({past:E,open:N,show:P,live:e,host:n,owns:W,archive:g}),[E,N,P,e,n,W,g]);return r?o:H}var ko=e=>`graview:setting:${e}`;function Ro(){return localStorage}function To(e,t){try{let n=(t??Ro()).getItem(ko(e.name));if(n!==null&&e.options.some(o=>o.value===n))return n}catch{}return e.initial}function Mo(e,t,n){try{(n??Ro()).setItem(ko(e.name),t)}catch{}}function Oo(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 L=_(j(),1);function Lt(e){return Fe(e)}var fi=12,pi=4;function yi(e,t,n){let o=Lt(t);return e.get(o)??{participant:o,who:t.id??t.kind,at:null,mode:"docked",since:n,trail:[]}}var tt=(e,t)=>t===null||e[e.length-1]===t?e:[...e,t].slice(-fi);function Vo(e,t){let n=e.filter(r=>r.length>0);if(n.length===0)return null;if(n.length<=pi)return n[0];let o=new Set(n.map(r=>t(r)).filter(r=>r!==void 0));return o.size===1?bt([...o][0]):n[0]}function Ht(e,t,n){let o=new Map(e);if(t.type==="rest"){for(let[a,l]of e)l.mode!=="asking"&&l.mode!=="docked"&&t.at-l.since>=t.holdMs&&o.set(a,{...l,mode:"docked",at:null,trail:[],say:void 0,confidence:void 0});return o}if(t.author.kind!=="agent")return o;let r=yi(e,t.author,t.at),i=a=>o.set(r.participant,{...r,...a,since:t.at});switch(t.type){case"read":{let a=Vo(t.ids,n);return i({at:a,mode:"reading",trail:tt(r.trail,a)}),o}case"about-to-write":case"write":{let a=Vo(t.ids,n);return i({at:a,mode:"writing",trail:tt(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:tt(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:tt(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 Co="graview:session";function Io(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(Co);if(o)return o;let r=t();return n.setItem(Co,r),r}catch{return t()}}var Dt={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"},Nt={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"},_o=[Dt,Nt],gi=800;function Lo(e){let{channel:t,store:n,view:o,principal:r,session:i,robots:a,seatWho:l,settingValues:s,setView:u,ttlMs:f=1e4,people:m,seats:p}=e,[g,v]=(0,L.useState)(()=>new Map),[T,y]=(0,L.useState)(null),[b,h]=(0,L.useState)(null),[E,P]=(0,L.useState)(null),W=typeof r.id=="string"&&r.id.length>0,N=W&&(s[Dt.name]??Dt.initial)==="shared",H=N&&(s[Nt.name]??Nt.initial)==="shared",x=Lt({kind:r.kind,...r.id?{id:r.id}:{},session:i}),C=W?Gn(r,{graph:n.graph,schema:n.schema,...p?{seats:p}:{},...m?{people:m}:{}}):"",V=l?a.get(`agent:${l}:${i}`):void 0,F=(0,L.useMemo)(()=>!t||!N?null:{participant:x,kind:r.kind,name:C,...r.onBehalfOf?.id?{onBehalfOf:r.onBehalfOf.id,...r.onBehalfOf.name?{onBehalfOfName:r.onBehalfOf.name}:{}}:{},hue:Fn(r.id??"nobody"),stop:E??te(o),...H?{over:T}:{},...V?{robot:{at:V.at,mode:V.mode}}:{},at:new Date().toISOString()},[t,N,H,x,C,r.id,r.kind,r.onBehalfOf?.id,r.onBehalfOf?.name,o,E,T,V?.at,V?.mode]);(0,L.useEffect)(()=>{if(!t||!F)return;t.here(F);let I=setInterval(()=>t.here({...F,at:new Date().toISOString()}),gi);return()=>clearInterval(I)},[t,F]),(0,L.useEffect)(()=>t?t.onWho(K=>v(wt(new Map,K,Date.now(),f))):void 0,[t,f]);let Z=g.size>0;(0,L.useEffect)(()=>{if(!Z)return;let I=setInterval(()=>{v(K=>{let Q=wt(K,[],Date.now(),f);return Q.size===K.size?K:Q})},Math.max(250,Math.min(1e3,f/4)));return()=>clearInterval(I)},[Z,f]),(0,L.useEffect)(()=>{if(!t||typeof window>"u")return;let I=()=>t.leave();return window.addEventListener("pagehide",I),()=>window.removeEventListener("pagehide",I)},[t]),(0,L.useEffect)(()=>{if(!H||typeof document>"u")return;let I=null,K=Q=>{let Ee=vo(Q.target);Ee!==I&&(I=Ee,y(Ee))};return document.addEventListener("pointermove",K,{passive:!0}),()=>document.removeEventListener("pointermove",K)},[H]);let X=(0,L.useRef)(null),z=b?g.get(b)??null:null,de=(0,L.useCallback)(I=>{X.current=null,h(I)},[]);return(0,L.useEffect)(()=>{if(b){if(!z){h(null);return}z.stop!==X.current?.stop&&(X.current={stop:z.stop,at:Date.now()},u(ze(z.stop)))}},[b,z,u]),(0,L.useEffect)(()=>{let I=X.current;!b||I===null||Date.now()-I.at<400||Zn(o,ze(I.stop))||h(null)},[o,b]),(0,L.useEffect)(()=>{if(!b||typeof document>"u")return;let I=K=>{K.key==="Escape"&&h(null)};return document.addEventListener("keydown",I),()=>document.removeEventListener("keydown",I)},[b]),(0,L.useMemo)(()=>({who:g,sharing:F?{participant:x,name:C}:null,following:z,follow:de,sayWhere:P}),[g,F,x,C,z,de])}var U=_(j(),1);function Ho(e){return Fe(e.author)}function hi(e,t){return e.length>1?"co-edited":t==="rule"?"rule":t==="agent"?"autonomous":"directed"}function Do(e,t,n,o,r){let i=new Map;for(let[s,u]of e)o-u.at<r&&i.set(s,u);let a=new Set(n.flatMap(s=>s.nodeIds)),l=(s,u,f)=>{let m=i.get(s),p=m?.participants.includes(Ho(u))?m.participants:[...m?.participants??[],Ho(u)];i.set(s,{at:o,manner:hi(p,u.author.kind),intent:u.intent,wrote:(m?.wrote??!1)||(f.wrote??!1),read:(m?.read??!1)||(f.read??!1),broke:(m?.broke??!1)||a.has(s),participants:p})};for(let s of t){for(let u of s.writes)l(u,s,{wrote:!0});for(let u of s.reads)s.writes.includes(u)||l(u,s,{read:!0})}for(let s of n)for(let u of s.nodeIds){let f=i.get(u);i.set(u,{at:o,manner:f?.manner??"rule",intent:f?.intent??s.message,wrote:f?.wrote??!1,read:f?.read??!1,broke:!0,participants:f?.participants??["rule::"]})}return i}var Si=2600;function No(e,t=Si){let[n,o]=(0,U.useState)(()=>new Map),r=(0,U.useRef)(n);r.current=n;let i=(0,U.useRef)(null),a=(0,U.useCallback)(s=>{r.current=s,o(s),i.current&&clearTimeout(i.current),i.current=setTimeout(()=>{r.current=new Map,o(new Map)},t)},[t]);(0,U.useEffect)(()=>{let s=e.violations(),u=e.subscribe((f,m)=>{let p=e.violations(),g=zn(e.allInvariants(),s,p).introduces;s=p,a(Do(r.current,m,g.map(v=>({nodeIds:v.nodeIds,message:v.message})),Date.now(),t))});return()=>{u(),i.current&&clearTimeout(i.current)}},[e,t,a]);let l=(0,U.useCallback)(s=>{s.reads.length!==0&&a(Do(r.current,[wi(s)],[],Date.now(),t))},[t,a]);return{activity:n,noteAttention:l}}function wi(e){return{id:`attention:${e.intent}`,seq:-1,batch:"attention",author:e.author,intent:e.intent,mutation:null,primitives:[],reads:e.reads,writes:[],at:new Date().toISOString()}}var d=_(j(),1);function jo(){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)}}}var nt=_(j(),1),vi=e=>e.definitions.some(t=>jn(t).size>0);function Wo(e,t,n){let[o,r]=(0,nt.useState)(void 0),i=(n.roles??[]).join("\0");return(0,nt.useEffect)(()=>{if(!t||!vi(e.schema)){r(void 0);return}let a=!0,l=!1,s=e.graph,u=()=>{l||(l=!0,queueMicrotask(()=>{l=!1,a&&e.reread()}))},f=Wn(t,{kind:n.kind,...n.id===void 0?{}:{id:n.id},...n.roles?{roles:n.roles}:{}},u);return St(s,f.read),r(f),e.reread(),()=>{a=!1,St(s,void 0)}},[e,t,n.kind,n.id,i]),o}function Go(){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 le=_(Ie(),1),bi="graview:place-menu",_e=(0,d.createContext)(null),qo=(0,d.createContext)("scene");function xi({mode:e,children:t}){return(0,le.jsx)(qo.Provider,{value:e,children:t})}function Ei(){return(0,d.useContext)(qo)}var zo={kind:"human"},Pi=[],Ai=[],ki=[],jt=[];function $o(e,t){let n=(0,d.useId)();(0,d.useEffect)(()=>{if(!globalThis.__graviewWatch)return;let o=t??zo,r=()=>qn(e,o,n);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])}var Ri={off:!0};function Ti({store:e,views:t,initialView:n,scheme:o="dark",initialSelection:r,principal:i,seats:a=Pi,onSeat:l,people:s=Ai,memory:u,presenceTtlMs:f,app:m,settings:p=m?.settings??ki,presence:g,brand:v,locale:T,timeZone:y,onKeepLens:b,providers:h,ai:E,files:P,resolveApp:W,history:N,linkedRecords:H,menuSections:x,keptViews:C,subscriptions:V,signIn:F,view:Z,onViewChange:X,children:z}){let de=(0,d.useContext)(_e),I=x??de?.menuSections,K=F??de?.signIn,Q=C??de?.keptViews,[Ee,wr]=(0,d.useState)(null),ue=Ee??i??a[0]?.principal??zo,He=_t(e,ue,N),nn=He.past&&He.live===e?He.past.store:e,D=(0,d.useMemo)(()=>nn.seenBy(ue),[nn,ue]);$o(e,ue);let[re]=(0,d.useState)(()=>Io(u)),[on,vr]=(0,d.useState)(!1),rn=(0,d.useCallback)(()=>vr(!0),[]),ie=(0,d.useMemo)(()=>g?[...p,..._o]:p,[p,g]),[pt]=(0,d.useState)(()=>n??Kt(t,e.schema)),[br,an]=(0,d.useState)(()=>$e(pt??fe,r??pt?.selection??[])),Pe=(0,d.useRef)(pt??fe).current,[sn,xr]=(0,d.useState)(null),[ln,Er]=(0,d.useState)(null),J=(0,d.useContext)(_e),[dn]=(0,d.useState)(()=>J?.seatTalk??Ct(v?.name??e.schema.kinds.join(","))),yt=E??J?.ai??Pt,De=(0,d.useMemo)(()=>yt.off?Ri:yt,[yt]),un=(0,d.useRef)(De.interactions);un.current=De.interactions;let[cn]=(0,d.useState)(()=>J?.aiDesk??It(()=>un.current)),[Pr]=(0,d.useState)(()=>J?.subscriptions??Bn()),fn=V??J?.subscriptions??Pr,mt=b??J?.onKeepLens,Ne=m??J?.app,je=T??J?.locale,Ar=v?.locale??Ne?.brand?.locale,We=y??J?.timeZone;Nn({reader:je,app:Ar,readerTimeZone:We,appTimeZone:v?.timeZone??Ne?.brand?.timeZone});let pn=(0,d.useRef)(null),yn=(0,d.useCallback)(c=>{pn.current=c},[]),mn=(0,d.useCallback)(c=>pn.current?.whereIs(c)??null,[]),[gn]=(0,d.useState)(()=>jo()),[hn]=(0,d.useState)(()=>Go()),[gt,kr]=(0,d.useState)(null),[Ae,Sn]=(0,d.useState)(()=>new Map),ke=(0,d.useRef)(Ae);ke.current=Ae;let Re=(0,d.useRef)(null),ht=(0,d.useCallback)(c=>D.graph.getNode(c)?.kind,[D]),ee=(0,d.useCallback)(c=>{let S=Ht(ke.current,c,ht);ke.current=S,Sn(S),Re.current&&clearTimeout(Re.current),[...S.values()].some(M=>M.mode!=="docked"&&M.mode!=="asking")&&(Re.current=setTimeout(()=>{let M=Ht(ke.current,{type:"rest",at:Date.now(),holdMs:Ft},ht);ke.current=M,Sn(M)},Ft+20))},[ht]),wn=(0,d.useCallback)(c=>ee({...c,at:c.at??Date.now()}),[ee]),vn=(0,d.useCallback)(c=>{kr(c),c&&ee({type:"home",author:{kind:"agent",id:c,session:re},at:Date.now()})},[ee,re]);(0,d.useEffect)(()=>D.subscribe((c,S)=>{for(let k of S)k.author.kind==="agent"&&ee({type:"write",author:k.author,ids:k.writes,at:Date.now()})}),[D,ee]),(0,d.useEffect)(()=>()=>{Re.current&&clearTimeout(Re.current)},[]);let $=(0,d.useMemo)(()=>({...ue,session:re}),[ue,re]),bn=Wo(D,H,$),xn=(0,d.useCallback)(c=>{wr(c),l?.(c)},[l]),[Te,Rr]=(0,d.useState)(()=>Object.fromEntries(ie.map(c=>[c.name,To(c,u)])));(0,d.useEffect)(()=>{for(let c of ie)Oo(c,Te[c.name]??c.initial)},[ie,Te]);let En=(0,d.useCallback)((c,S)=>{let k=ie.find(M=>M.name===c);!k||!k.options.some(M=>M.value===S)||(Mo(k,S,u),Rr(M=>({...M,[c]:S})))},[ie,u]),[Pn,Tr]=(0,d.useState)(null),{activity:An,noteAttention:kn}=No(D),Rn=(0,d.useCallback)(c=>{kn(c),ee({type:"read",author:c.author,ids:c.reads,at:Date.now()})},[kn,ee]),ce=(0,d.useCallback)(c=>{if(ye(c)!==null||se(c).length>0||xt(c))return!0;let S=Xn(c);return S?D.graph.allEdges().some(k=>k.kind===S.kind&&k.from===S.from&&k.to===S.to):D.graph.getNode(c)!==void 0},[D]),Tn=(0,d.useCallback)(c=>{let S=c.selection??jt,k=S.filter(ce),M=k.length===S.length?c:$e(c,k);return M.focusId!==null&&!ce(M.focusId)&&(M=q(M,null)),M},[ce]),Me=(0,d.useCallback)(c=>{let S=Tn(c),k=Bo(D,$,S.shown);if(S.focusId!==null&&k.size>0){let M=se(S.focusId),Dn=D.graph.getNode(S.focusId);(M.length>0?M.every(Vr=>k.has(Vr)):Dn?k.has(Dn.kind):!1)&&(S={...S,focusId:null})}if(!S.overview&&S.focusId===null){let M=Pe.focusId!==null&&!ce(Pe.focusId)?Kt(t,e.schema)??{...fe,overview:!0}:Pe;M.focusId!==null&&ce(M.focusId)?S={...S,focusId:M.focusId}:M.overview===!0&&(S={...S,overview:!0})}return S},[Tn,ce,D,Pe,$,t,e.schema]),B=Me(Z??br),Mn=(0,d.useMemo)(()=>Bo(D,$,B.shown),[D,$,B.shown]),On=(0,d.useMemo)(()=>[...D.modules.administered.entries()].map(([c,S])=>{let k=D.mayAdminister(c,$);return{name:c,...S.description?{description:S.description}:{},kinds:S.kinds??[],canShow:k,shown:k&&(B.shown??[]).includes(c)}}),[D,$,B.shown]),Oe=(0,d.useCallback)(c=>{let S=k=>Me(typeof c=="function"?c(k):c);if(Z!==void 0){X?.(S(Z));return}X&&X(S(B)),an(k=>S(k))},[B,X,Z,Me]);(0,d.useEffect)(()=>{Z===void 0&&an(c=>{let S=Me(c);return S===c?c:S})},[B,Z,Me]);let Vn=B.selection??jt,Cn=(0,d.useCallback)(c=>{Oe(S=>$e(S,typeof c=="function"?c(S.selection??jt):c))},[Oe]),{who:In,following:_n,follow:Ln,sayWhere:Mr,sharing:Hn}=Lo({channel:g,store:D,view:B,principal:$,session:re,robots:Ae,seatWho:gt,settingValues:Te,setView:Oe,seats:a,people:s,...f!==void 0?{ttlMs:f}:{}}),Or=(0,d.useMemo)(()=>({store:D,scheme:o,views:t,view:B,setView:Oe,homeView:Pe,selection:Vn,setSelection:Cn,menuAt:sn,setMenuAt:xr,whereIs:mn,pointer:gn,motion:hn,registerScene:yn,robots:Ae,noteSeat:wn,seatWho:gt,registerSeatWho:vn,actsDoor:ln,registerActsDoor:Er,seatTalk:dn,aiDesk:cn,...u?{memory:u}:{},who:In,following:_n,follow:Ln,sayWhere:Mr,sharing:Hn,session:re,ai:De,resolveApp:W,linkedRecords:H,menuSections:I,...Q?{keptViews:Q}:{},subscriptions:fn,signIn:K,linkedReads:bn,movedByHand:on,noteMoved:rn,emphasis:Pn,setEmphasis:Tr,activity:An,noteAttention:Rn,principal:$,seats:a,people:s,takeSeat:xn,settings:ie,settingValues:Te,chooseSetting:En,hiddenKinds:Mn,administered:On,...h?{providers:h}:{},...v?{brand:v}:{},...mt?{onKeepLens:mt}:{},app:Ne,...je?{locale:je}:{},...We?{timeZone:We}:{}}),[D,o,t,B,Oe,Vn,Cn,sn,mn,gn,hn,yn,Ae,wn,gt,vn,ln,dn,cn,u,In,_n,Ln,Hn,re,De,W,H,I,Q,fn,K,bn,on,rn,Pn,An,Rn,$,a,s,xn,ie,Te,En,Mn,On,h,v,mt,Ne,je,We]);return(0,le.jsx)(_e.Provider,{value:Or,children:(0,le.jsx)(Ce.Provider,{value:He,children:(0,le.jsx)(Ii,{children:P?(0,le.jsx)(Qe.Provider,{value:P,children:z}):z})})})}var Uo=(0,d.createContext)(null),Wt,Gt=new Set,Mi=e=>(Gt.add(e),()=>void Gt.delete(e)),Fo=()=>Wt;function Oi(e){if(!Wt){Wt=e;for(let t of[...Gt])t()}}var Vi=300;function Ci(e){let t=0;return async(n,o)=>{let r=++t;return await new Promise(i=>setTimeout(i,Vi)),r===t?e(n,o):[]}}function Ii({children:e}){let{store:t,view:n,views:o,principal:r,hiddenKinds:i,selection:a,ai:l}=oe(),s=ot(),u=n.q,f=n.focusId,m=!!(u&&u.trim().length>0),p=(0,d.useSyncExternalStore)(Mi,Fo,Fo),g=(0,d.useMemo)(()=>m&&p?{flagged:new Set(t.violations().flatMap(E=>E.nodeIds)),touched:p.touchWeights(t.log.all())}:null,[t,s,m,p]),v=f?t.graph.getNode(f)?.kind??ye(f)??(se(f).length===1?se(f)[0]:void 0):void 0,T=(0,d.useMemo)(()=>l.near&&Ci(l.near),[l.near]),y=(0,d.useMemo)(()=>!u||!g||!p?null:p.search(t,u,{...v?{inKind:v}:{},principal:r,places:o.places(),kinds:t.schema.kinds.filter(E=>!i.has(E)),from:[...a,...f&&t.graph.has(f)?[f]:[]],flagged:g.flagged,touched:g.touched,limit:200,rank:T}),[t,u,r,o,i,a,f,v,g,T]),[b,h]=(0,d.useState)();return(0,d.useEffect)(()=>void y?.later?.then(E=>h([y,E])),[y]),(0,le.jsx)(Uo.Provider,{value:b?.[0]===y?b[1]:y,children:e})}var Ko=new WeakMap;function xs(e){let t=Ko.get(e);return t||Ko.set(e,t=new Set(e.matched)),t}function _i(){return(0,d.useContext)(Uo)}function oe(){let e=(0,d.useContext)(_e);if(!e)throw new Error("useGraview must be used inside a <GraviewProvider>.");return e}function Bt(){return(0,d.useContext)(_e)??null}function ot(){let{store:e}=oe(),t=(0,d.useRef)(null),n=(0,d.useRef)(null),o=(0,d.useCallback)(()=>(n.current!==e&&(n.current=e,t.current=null),t.current??=e.graph.allNodes(),t.current),[e]),r=(0,d.useCallback)(i=>e.subscribe(()=>{t.current=null,i()}),[e]);return(0,d.useSyncExternalStore)(r,o,o)}function Li(e){let{store:t}=oe(),n=(0,d.useCallback)(r=>t.subscribe(r),[t]),o=(0,d.useCallback)(()=>e===null?void 0:t.graph.getNode(e),[t,e]);return(0,d.useSyncExternalStore)(n,o,o)}function Bo(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 Ft=2600;var Yo=new WeakSet,Hi=e=>Yo.has(e),Di=e=>void Yo.add(e);function Kt(e,t){let n=Un(e.arrangement?.()?.first,t,e.places());if(!(!n||n.to==="home"))return n.to==="place"?{...fe,focusId:ne(n.place.kind),within:{view:n.place.as}}:{...fe,focusId:ne(n.kind)}}var Zo=_(j(),1),Ni=(0,Zo.createContext)(!1);var rt=Symbol.for("graview.default-view");function Xo(e){return Object.defineProperty(e,rt,{value:!0,enumerable:!1}),e}function Jo(e){return typeof e=="function"&&e[rt]===!0}var it=Symbol.for("graview.replaces-page");function Qo(e){return Object.defineProperty(e,it,{value:!0,enumerable:!1}),e}function er(e){return typeof e=="function"&&e[it]===!0}var at=Symbol.for("graview.bleeds");function tr(e){return Object.defineProperty(e,at,{value:!0,enumerable:!1}),e}function nr(e){return typeof e=="function"&&e[at]===!0}var st=Symbol.for("graview.previews");function or(e,t={}){return Object.defineProperty(e,st,{value:t,enumerable:!1}),e}function rr(e){return typeof e=="function"?e[st]:void 0}function ji(e){return $n(e)}function Wi(e,t){if(t===e)return e;for(let r of t.registrations())e.register(r.kind,r,r.view,r);let n=t.arrangement?.();n&&e.arrange?.(n);let o=t.homeView?.();return o&&e.home?.(o),e}var R=_(j(),1),Y=_(Ie(),1),qt=new Set,lt=0;function zt(e){return()=>{lt+=1;let t=e();return t.then(()=>void(lt-=1),()=>void(lt-=1)),t}}var Gi=()=>lt,ut=(0,R.createContext)(null);function Fi(){return{waiting:new Map,at:0}}function Ki(e){for(let[t,n]of e.waiting)n<e.at&&e.waiting.delete(t);e.at+=1}var Bi=e=>e?.waiting.size??0;function sr(e,t){e?.waiting.set(t,e.at)}function lr(e){let t=(0,R.useContext)(ut);(0,R.useLayoutEffect)(()=>{t?.waiting.delete(e)},[t,e])}function qi(e){let t={},n=!1,o=new Set,r=(0,R.lazy)(zt(()=>e().then(a=>{n=!0;let l=a.default;function s(u){return lr(t),(0,R.createElement)(l,u)}return{default:s}},a=>{for(let l of o)l.waiting.delete(t);throw a})));function i(a){let l=(0,R.useContext)(ut);return!n&&l&&(o.add(l),sr(l,t)),(0,R.createElement)(r,a)}return i}var dr=!1,ur=!1,dt=new Set;function zi(){dr=!0}function $i(){ur=!0;for(let e of[...dt])e();dt.clear()}var cr=()=>ur||!dr;function Ui(e){return cr()?(e(),()=>{}):(dt.add(e),()=>void dt.delete(e))}var ir=!1;function $t(){for(let e of[...qt])e()}function Yi(){ir||typeof window>"u"||(ir=!0,window.addEventListener("online",$t))}function Ut(e){let t,n=!1,o=!1,r,i=0,a=new Set,l=()=>{i+=1;for(let p of[...a])p()},s=p=>(a.add(p),()=>void a.delete(p)),u=()=>i,f=()=>void m().catch(()=>{});function m(){if(n)return Promise.resolve(t);if(r)return r;let p=e().then(g=>(t=g,n=!0,o=!1,r=void 0,qt.delete(f),l(),g),g=>{throw r=void 0,o=!0,qt.add(f),Yi(),l(),g});return p.catch(()=>{}),r=p,p}return{load:m,prefetch:f,get current(){return t},get failed(){return o},part(p,g={}){let v=g.what??"This part",T={};function y(E){(0,R.useSyncExternalStore)(s,u,u),lr(T);let P=(0,R.useRef)(null),W=(0,R.useRef)(null),N=(0,R.useRef)(!1);return(0,R.useEffect)(()=>{o&&r===void 0&&f()},[]),n&&typeof document<"u"&&P.current!==null&&document.activeElement===P.current&&(N.current=!0),(0,R.useLayoutEffect)(()=>{if(!(!n||!N.current)){N.current=!1;for(let H=W.current?.nextElementSibling??null;H!==null;H=H.nextElementSibling){let x=H.matches(ar)?H:H.querySelector(ar);if(x instanceof HTMLElement){x.focus();return}}}}),n?(0,Y.jsxs)(Y.Fragment,{children:[N.current?(0,Y.jsx)("span",{ref:W,hidden:!0}):null,p(t,E)]}):g.quiet?null:(0,Y.jsx)(Zi,{what:v,button:P,...g.as?{as:g.as}:{}})}let b=(0,R.lazy)(zt(()=>m().then(()=>({default:y}),()=>({default:y}))));function h(E){let P=(0,R.useContext)(ut),[W]=(0,R.useState)(()=>n||o);return!n&&!o&&sr(P,T),(0,R.createElement)(W?y:b,E)}return h}}}var ar="button,a[href],input,select,textarea,[tabindex]:not([tabindex='-1'])";function Zi({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,Y.jsxs)(n,{"data-testid":"lazy-part-missing",style:{margin:0,fontSize:"0.875rem",color:"var(--graview-ink-muted)"},children:[(0,Y.jsx)("span",{role:"status",children:r})," ",(0,Y.jsx)("button",{ref:t,type:"button","data-testid":"lazy-part-retry",onClick:$t,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 Se=_(j(),1);function Xi(){let{selection:e,setSelection:t}=oe();return(0,Se.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 Ji(){let{store:e}=oe(),t=ot();return(0,Se.useMemo)(()=>Qi(e),[e,t])}var fr=new WeakMap;function Qi(e){let t=fr.get(e);if(!t){let n={violations:null};e.subscribe(()=>{n.violations=null}),fr.set(e,n),t=n}return t.violations??=e.violations(),t.violations}function ea(){let{view:e,setView:t}=oe();return(0,Se.useMemo)(()=>({view:e,url:te(e),focus:n=>t(o=>q(o,n)),show:n=>t(o=>Jn(o,n)),toggle:n=>t(o=>Ue(o,n)),go:n=>t(n)}),[e,t])}var he={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;he.at=typeof t?.graview=="number"?t.graview:0,he.at>he.depth&&(he.depth=he.at),he.tell()});var G=_(j(),1),Zt={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"]},suggested:{trigger:"suggested-button",pane:"suggested",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","pages"]},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"]}},ta={position:"fixed",inset:"auto",margin:0,zIndex:Kn("popover"),boxSizing:"border-box"},ct=6,we=8,na=e=>typeof e.showPopover=="function";function ft(e){try{return e.matches(":popover-open")}catch{return!1}}function oa(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 Xt(e,t,n={}){let o=oa(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(),l=r.height-o.bottom-ct-we,s=o.top-ct-we,u=a.height<=l||l>=s,f=Math.max(96,Math.floor(u?l:s)),m=Math.min(a.height,f);a.height>f&&(e.style.maxHeight=i?`min(${i}, ${f}px)`:`${f}px`);let p=a.width,g=n.align==="start"?o.left:o.right-p,v=typeof t=="function"?null:t.current?.closest("[data-graview-embed]")?.getBoundingClientRect();v&&p<=v.right-v.left&&(g<v.left?g=o.left+p<=v.right?o.left:v.left:g+p>v.right&&(g=o.right-p>=v.left?o.right-p:v.right-p));let T=p>=r.width-2*we?Math.max(0,(r.width-p)/2):Math.max(we,Math.min(g,r.width-we-p)),y=u?o.bottom+ct:Math.max(we,o.top-ct-m);e.style.left=`${Math.round(T)}px`,e.style.top=`${Math.round(y)}px`}function pr(e,t,n,o={}){let r=o.align??"end";(0,G.useLayoutEffect)(()=>{let i=e.current;if(!t||!i)return;if(na(i)&&!ft(i))try{i.showPopover(),ia()}catch{}let a=0,l=u=>{u?.target instanceof Node&&i.contains(u.target)||(cancelAnimationFrame(a),a=requestAnimationFrame(()=>Xt(i,n,{align:r})))};Xt(i,n,{align:r}),addEventListener("resize",l),addEventListener("scroll",l,!0);let s=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>l());return s?.observe(i),()=>{if(cancelAnimationFrame(a),removeEventListener("resize",l),removeEventListener("scroll",l,!0),s?.disconnect(),i.isConnected&&ft(i))try{i.hidePopover()}catch{}}},[t,e,r])}var Jt=new Set;function ra(e){return Jt.add(e),()=>Jt.delete(e)}function ia(){for(let e of Jt)if(!(!e.isConnected||!ft(e)))try{e.hidePopover(),e.showPopover()}catch{}}var ve=null,aa='button:not([disabled]), [href], input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), summary, [tabindex]:not([tabindex="-1"])';function sa(e){for(let t of e.querySelectorAll(aa))if(t.closest("[hidden]")===null&&getComputedStyle(t).visibility!=="hidden")return t;return e}var Yt=()=>{let e=document.activeElement;return e===null||e===document.body};function la(e,t={}){let{at:n,returnTo:o,onOpenChange:r}=t,i=t.popover!==!1,[a,l]=(0,G.useState)(!1),s=t.open??a,u=(0,G.useRef)(null),f=(0,G.useRef)(null),m=(0,G.useCallback)(h=>{u.current=h},[]),p=(0,G.useCallback)(h=>{f.current=h},[]),g=`graview-popover-${(0,G.useId)().replace(/:/g,"")}`,v=(0,G.useRef)({onOpenChange:r,returnTo:o,controlled:t.open!==void 0});v.current={onOpenChange:r,returnTo:o,controlled:t.open!==void 0};let T=(0,G.useCallback)(h=>{v.current.controlled||l(h),v.current.onOpenChange?.(h)},[]),y=(0,G.useCallback)(()=>{(document.querySelector(`[aria-controls="${g}"]`)??u.current??v.current.returnTo?.()??null)?.focus({preventScroll:!0})},[g]),b=(0,G.useCallback)(h=>{let E=f.current,P=typeof document>"u"?null:document.activeElement,W=P===null||P===document.body||E!==null&&E.contains(P);T(!1),!(!h||!W)&&(y(),requestAnimationFrame(()=>{Yt()&&y()}))},[T,y]);return pr(f,i&&s,n??u,t.align?{align:t.align}:{}),(0,G.useEffect)(()=>{if(!i||!s)return;let h={name:e,close:()=>b(!1)};if(ve&&ve.close!==h.close&&ve.close(),ve=h,Zt[e].focus==="into"){let x=f.current;x&&!x.contains(document.activeElement)&&sa(x).focus({preventScroll:!0})}let E=x=>{x.key==="Escape"&&b(!0)},P=x=>{let C=x.target;if(!(C instanceof Node))return;let V=f.current;if(V?.contains(C)||u.current?.contains(C))return;let F=C instanceof Element?C.closest('[role="dialog"], [role="alertdialog"]'):null;F&&!(V&&F.contains(V))||(b(!1),Zt[e].focus==="into"&&requestAnimationFrame(()=>{(Yt()||V!==null&&V.contains(document.activeElement))&&y()}))},W=null,N=null,H=x=>{let C=x.target;if(!(C instanceof Element))return;let V=f.current,F=C.closest('[role="dialog"], [role="alertdialog"]');!F||V&&(V.contains(F)||F.contains(V))||(W=F,b(!1))};return document.addEventListener("keydown",E),document.addEventListener("pointerdown",P,!0),document.addEventListener("focusin",H),()=>{document.removeEventListener("keydown",E),document.removeEventListener("pointerdown",P,!0),document.removeEventListener("focusin",H);let x=W;x&&typeof MutationObserver<"u"&&(N?.disconnect(),N=new MutationObserver(()=>{x.isConnected||(N?.disconnect(),requestAnimationFrame(()=>{(Yt()||document.activeElement.closest("[hidden]")!==null)&&y()}))}),N.observe(document.body,{childList:!0,subtree:!0}),setTimeout(()=>N?.disconnect(),10*6e4)),ve?.close===h.close&&(ve=null)}},[i,s,e,b,y]),{open:s,setOpen:h=>h?T(!0):b(!0),toggle:()=>s?b(!0):T(!0),trigger:{ref:m,"aria-expanded":s,"aria-controls":g,"data-graview-popover-trigger":e},pane:{ref:p,id:g,popover:"manual",tabIndex:-1,"data-graview-popover":e,"data-graview-overlay":""}}}var be=_(j(),1);var yr=(0,be.createContext)(null);function da(){let e=(0,be.useContext)(yr),t=Bt(),n=(o,r,i)=>t?.setView(a=>ae(ae(pe(q(a,ne(o)),!1),"view",r),"filter",i?.filter??null));return(0,be.useMemo)(()=>e??{record:o=>{t&&(t.setView(r=>q(pe(r,!1),o)),t.setSelection([o]))},place:(o,r)=>{let i=t?.views.places().find(a=>a.as===o);i&&n(i.kind,i.as,r)},list:(o,r)=>n(o,null,r)},[e,t])}var xe=_(j(),1);var ua=Ut(Ke(()=>(__graviewPreload(import.meta.url,["./chunk.Y4ZUJUUT.js","./chunk.SDO3U72B.js","./chunk.AS4CQBOQ.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.ZCYGUP3I.js"))));function ca(e,t,n){let o,r=!1,i=()=>{let{hidden:l,removed:s}=t.current();o||r||l.length+s.length===0||(o=()=>{},ua.load().then(u=>{r||(o=u.watchTidied(e,t,n))},String))};i();let a=t.onChange?.(i);return()=>{r=!0,a?.(),o?.()}}function fa(e,t){let[n,o]=(0,xe.useState)();return(0,xe.useEffect)(()=>t?ca(e,t,r=>o([e,r])):void 0,[e,t]),n?.[0]===e?n[1]:e}var mr=_(j(),1),pa=(0,mr.createContext)(!1);var Qt=_(j(),1),ya=(0,Qt.createContext)(null),ma=(0,Qt.createContext)(null);var gr=_(j(),1),ga=(0,gr.createContext)(null);var hr=_(j(),1),en='button:not([disabled]), a[href], input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), summary, [tabindex]:not([tabindex="-1"])',tn=e=>e instanceof HTMLElement&&(e.matches(en)||e.hasAttribute("tabindex")),Le=e=>typeof e.checkVisibility=="function"?e.checkVisibility():e.getClientRects().length>0;function ha(e,t){let n=s=>s.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 l=e.querySelector(a);return l&&tn(l)&&Le(l)?l:null}var Sa=e=>e.isConnected&&tn(e)&&!e.matches(":disabled")&&e instanceof HTMLElement&&Le(e);function Sr(e,t){let n=t?ha(e,t):null;if(n)return n;let o=e.querySelector("[data-graview-view][tabindex]");if(o&&Le(o))return o;for(let r of e.querySelectorAll(en))if(Le(r))return r;return tn(e)&&Le(e)?e:null}function wa(e){(0,hr.useEffect)(()=>{let t=e.current;if(!t||typeof MutationObserver>"u")return;let n=[],o=y=>{let b=y.target;if(b instanceof Element){n=[];for(let h=b;h&&h!==t.parentElement;h=h.parentElement)n.push(h)}},r=!1,i=!1,a=t.ownerDocument,l=()=>!i&&a.defaultView!==null,s=(y,b)=>void setTimeout(()=>l()&&b(),y),u=y=>void requestAnimationFrame(()=>l()&&y()),f=y=>{if(r=!1,i)return;let b=a.activeElement;if(!(!(b===null||b===a.body||b===a.documentElement)||n.length===0)){if(Sa(n[0])){y&&n[0]instanceof HTMLElement&&n[0].focus({preventScroll:!0});return}for(let E of n.slice(1)){if(!E.isConnected)continue;let P=Sr(E,n[0]);if(P){P.focus({preventScroll:!0}),n=[];return}}}},m=(y,b=Date.now()+2500)=>{s(100,()=>{f(y);let h=a.activeElement;(h===null||h===a.body||h===a.documentElement)&&n.length>0&&Date.now()<b&&m(y,b)})},p=()=>{r||n.length===0||(r=!0,s(60,()=>u(()=>{f(!1),m(!1)})))},g=y=>{if(!(y instanceof KeyboardEvent&&!["Enter"," ","Escape"].includes(y.key))){if(!(y instanceof KeyboardEvent)){let b=y.target instanceof Element?y.target.closest(en):null,h=a.activeElement,E=h===null||h===a.body||h===a.documentElement;if(b&&E&&t.contains(b)){n=[];for(let P=b;P&&P!==t.parentElement;P=P.parentElement)n.push(P);s(150,()=>u(()=>{f(!1),m(!1)}));return}}!(y instanceof KeyboardEvent)&&!(y.target instanceof Node&&n[0]?.contains(y.target))||s(150,()=>u(()=>{f(!0),m(!0)}))}},v=new MutationObserver(()=>{n.length>0&&!n[0].isConnected&&p()}),T=y=>{y.relatedTarget===null&&p()};return t.addEventListener("focusin",o),t.addEventListener("focusout",T),t.addEventListener("click",g),t.addEventListener("keydown",g),v.observe(t,{childList:!0,subtree:!0}),()=>{i=!0,t.removeEventListener("focusin",o),t.removeEventListener("focusout",T),t.removeEventListener("click",g),t.removeEventListener("keydown",g),v.disconnect()}},[e])}export{fe as a,te as b,ze as c,ba as d,xa as e,Zn as f,Yn as g,Xn as h,vt as i,q as j,Jn as k,ae as l,pe as m,$e as n,Ve as o,Ue as p,Ze as q,bt as r,ye as s,Aa as t,Ir as u,ne as v,Qn as w,se as x,eo as y,_r as z,ka as A,to as B,xt as C,Lr as D,Hr as E,Dr as F,j as G,Ct as H,oi as I,ii as J,vo as K,Qe as L,ai as M,Ce as N,xo as O,si as P,_t as Q,Ie as R,bi as S,xi as T,Ei as U,$o as V,Ti as W,Oi as X,xs as Y,_i as Z,oe as _,Bt as $,ot as aa,Li as ba,Hi as ca,Di as da,Kt as ea,yr as fa,da as ga,Ni as ha,Xo as ia,Jo as ja,Qo as ka,er as la,tr as ma,nr as na,or as oa,rr as pa,ji as qa,Wi as ra,zt as sa,Gi as ta,ut as ua,Fi as va,Ki as wa,Bi as xa,qi as ya,zi as za,$i as Aa,cr as Ba,Ui as Ca,Ut as Da,fa as Ea,pa as Fa,ya as Ga,ma as Ha,ga as Ia,Xi as Ja,Ji as Ka,ea as La,he as Ma,wa as Na,ta as Oa,ft as Pa,pr as Qa,ra as Ra,la as Sa};
|
|
2
|
+
/*! Bundled license information:
|
|
3
|
+
|
|
4
|
+
react/cjs/react.production.js:
|
|
5
|
+
(**
|
|
6
|
+
* @license React
|
|
7
|
+
* react.production.js
|
|
8
|
+
*
|
|
9
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
10
|
+
*
|
|
11
|
+
* This source code is licensed under the MIT license found in the
|
|
12
|
+
* LICENSE file in the root directory of this source tree.
|
|
13
|
+
*)
|
|
14
|
+
|
|
15
|
+
react/cjs/react-jsx-runtime.production.js:
|
|
16
|
+
(**
|
|
17
|
+
* @license React
|
|
18
|
+
* react-jsx-runtime.production.js
|
|
19
|
+
*
|
|
20
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
21
|
+
*
|
|
22
|
+
* This source code is licensed under the MIT license found in the
|
|
23
|
+
* LICENSE file in the root directory of this source tree.
|
|
24
|
+
*)
|
|
25
|
+
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{d as Se,f as be}from"./chunk.JBW3DI7E.js";import{e as pt}from"./chunk.NIVTK2W5.js";import{a as ae,b as tt}from"./chunk.OHSJQYJN.js";import{b as Pe,c as U,d as X,e as it,f as rt}from"./chunk.DEUTHHGI.js";import{a as wt,d as yt,f as vt}from"./chunk.EPUBSKKL.js";import{a as ve,b as gt}from"./chunk.ATDU5Y7V.js";import{a as Ce,b as ft}from"./chunk.AQQZY6OY.js";import{a as mt,b as ht}from"./chunk.Y5ARSVH4.js";import{h as ut}from"./chunk.PKUDIWIF.js";import{d as ot,e as ie,f as J,g as we,h as st,j as lt,k as re}from"./chunk.ZIEHF67C.js";import{j as dt,o as ye}from"./chunk.6MADC6DM.js";import{c as ct}from"./chunk.JLEC3USG.js";import{c as at,d as Re}from"./chunk.DX357TZ3.js";import{c as nt}from"./chunk.H7KCWCB4.js";import{Aa as xe,Ba as fe,Ca as Ne,G as q,R as I,T as Ye,Z as Ze,_ as V,aa as ue,ha as Qe,ia as _,j as _e,ja as pe,l as je,m as qe,oa as me,r as ne,v as Ue,wa as he,y as Xe,ya as et,z as Je}from"./chunk.XWAMQPUM.js";import{a as ge}from"./chunk.SDO3U72B.js";import{$b as te,U as Q,ca as $,ea as ee,gb as Ke,la as H}from"./chunk.AS4CQBOQ.js";import{b as L}from"./chunk.AJZBJBMO.js";var f=L(q(),1);var St=L(q(),1);function bt(e){(0,St.useLayoutEffect)(()=>{let n=e.current,t=n?.parentElement;if(!n||!t)return;let a=n.style.bottom,o=()=>{let d=t.querySelector(zt);if(!d){n.style.bottom=a;return}let u=t.getBoundingClientRect(),m=d.getBoundingClientRect(),g=u.height>0?t.offsetHeight/u.height:1;n.style.bottom=`${Math.max(0,Math.round((u.bottom-m.top)*g))}px`};if(o(),typeof ResizeObserver>"u")return;let s=new ResizeObserver(o);return s.observe(t),()=>s.disconnect()},[e])}var zt=".graview-spec-listing";var $e=L(q(),1);var P=L(q(),1);var kt=L(q(),1);var B=L(I(),1);function xt({id:e,max:n=8,empty:t,hide:a}){let{store:o}=V();ue();let s=Kt(o,e,o.violations()),[d,u]=(0,kt.useState)(()=>new Set),m=a?s.flatMap(g=>{let w=g.ids.filter(r=>!a.has(r));return w.length>0?[{...g,ids:w}]:[]}):s;return m.length===0?t&&s.length===0?(0,B.jsx)("p",{style:{margin:0,fontSize:"0.875rem",color:"var(--graview-ink-faint)"},children:t}):null:(0,B.jsx)("div",{"data-graview-primitive":"connections",style:{display:"flex",flexDirection:"column",gap:12},children:m.map(g=>{let w=d.has(g.key),r=g.ids.length>n,c=w?g.ids:g.ids.slice(0,n),y=g.ids.length-Math.min(n,g.ids.length),k=`graview-more-${e}-${g.key}`.replace(/[^A-Za-z0-9_-]/g,"-");return(0,B.jsxs)("section",{style:{display:"flex",flexDirection:"column",gap:6},children:[(0,B.jsx)("h2",{...g.said?{"aria-label":g.said}:{},style:{margin:0,fontSize:"0.75rem",fontWeight:600,letterSpacing:"0.09em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},children:g.label}),(0,B.jsxs)("div",{id:k,style:{display:"flex",flexWrap:"wrap",gap:6},children:[c.map(h=>{let S=o.graph.getNode(h);return S?(0,B.jsx)(X,{pickId:h,hue:te(S.kind),title:`Go to the ${H(o.schema.tryDefinition(S.kind),S.kind)}`,label:$(o.schema.tryDefinition(S.kind),S)},h):null}),r?(0,B.jsx)("button",{type:"button","data-graview-more":g.key,"aria-expanded":w,"aria-controls":k,...w?{}:{"aria-label":`${y} more: ${g.said??g.label}`},onClick:h=>{h.stopPropagation(),u(S=>{let b=new Set(S);return b.has(g.key)?b.delete(g.key):b.add(g.key),b})},style:Ft,children:w?"Show fewer":`+${y} more`}):null]})]},g.key)})})}var Ft={display:"inline-flex",alignItems:"center",alignSelf:"flex-start",minHeight:24,boxSizing:"border-box",padding:"3px 9px",borderRadius:6,border:"1px solid var(--graview-edge)",background:"var(--graview-panel-muted)",color:"var(--graview-accent)",font:"inherit",fontSize:"0.8125rem",lineHeight:1.5,whiteSpace:"nowrap",cursor:"pointer"};function Kt(e,n,t=[]){let a=e.graph.getNode(n);if(!a)return[];let o=new Map,s=[];for(let d of t)if(d.subjectId===n)for(let u of d.nodeIds)u!==n&&!s.includes(u)&&e.graph.has(u)&&s.push(u);s.length>0&&o.set("judges",{key:"judges",label:"what it finds wrong",ids:s});for(let d of e.graph.allEdges()){let u=d.from===n?d.to:d.to===n?d.from:null;if(u===null||u===n)continue;let m=e.graph.getNode(u);if(!m)continue;let g=d.from===n?"out":"in",w=g==="out"?a.kind:m.kind,r=_t(e.schema,w,d.kind,g),c=`${d.kind}:${g}:${r.label}`,y=o.get(c)??{key:c,...r,ids:[]};y.ids.includes(u)||y.ids.push(u),o.set(c,y)}for(let d of o.values())d.ids.sort();return[...o.values()].sort((d,u)=>d.key<u.key?-1:d.key>u.key?1:0)}function _t(e,n,t,a){let o=nt(e,n,t,a),s=ee(t).toLowerCase();return o.trim().toLowerCase()!==s?{label:o}:a==="out"?{label:`\u2192 ${s}`,said:s}:{label:`\u2190 ${s}`,said:`${s}, pointing here`}}var Nt=L(q(),1),oe=(0,Nt.createContext)(null);var l=L(I(),1),jt=he(ge(()=>(__graviewPreload(import.meta.url,["./chunk.BCWPV4WR.js","./chunk.Y5ARSVH4.js","./chunk.PKUDIWIF.js","./chunk.VW2VCPJX.js","./chunk.HDRD33II.js","./chunk.DX357TZ3.js","./chunk.H7KCWCB4.js","./chunk.XSNAG4JT.js","./chunk.XWAMQPUM.js","./chunk.SDO3U72B.js","./chunk.AS4CQBOQ.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.A5VGTO3E.js")))).part((e,n)=>(0,l.jsx)(e.ArrangeBar,{...n}),{what:"Arranging this list"}),qt=he(ge(()=>(__graviewPreload(import.meta.url,["./chunk.NGIPVTTE.js","./chunk.BFKV4GKP.js","./chunk.WP5W44Y4.js","./chunk.M5GJHVWZ.js","./chunk.WSTBCWW7.js","./chunk.HZCA3UWJ.js","./chunk.JBW3DI7E.js","./chunk.AGIO2GRV.js","./chunk.NIVTK2W5.js","./chunk.HJCQ6I3S.js","./chunk.BNPQUI3F.js","./chunk.6RY6OSE6.js","./chunk.V3QUTJR2.js","./chunk.5ESCD57M.js","./chunk.DQOCBKC3.js","./chunk.OHSJQYJN.js","./chunk.DEUTHHGI.js","./chunk.EPUBSKKL.js","./chunk.ATDU5Y7V.js","./chunk.AQQZY6OY.js","./chunk.BCWPV4WR.js","./chunk.Y5ARSVH4.js","./chunk.PKUDIWIF.js","./chunk.VW2VCPJX.js","./chunk.4RJZVTW7.js","./chunk.G4JJXA63.js","./chunk.WBHM5I3I.js","./chunk.VC3BX2ZF.js","./chunk.UKAPFIPJ.js","./chunk.UT6642FC.js","./chunk.WAB7UDHU.js","./chunk.IW7YFPGG.js","./chunk.Q5WEOX3Q.js","./chunk.4OGOTHRD.js","./chunk.6YD2DLIC.js","./chunk.Q7RQC3F7.js","./chunk.WVUJXDXZ.js","./chunk.ZIEHF67C.js","./chunk.UHX4WTM7.js","./chunk.IKX4VDTW.js","./chunk.RNEJYIQ7.js","./chunk.TBQOSI4J.js","./chunk.KWQ7QOHD.js","./chunk.GZHZLJBF.js","./chunk.6MADC6DM.js","./chunk.OJGHDWI6.js","./chunk.JLEC3USG.js","./chunk.HDRD33II.js","./chunk.DX357TZ3.js","./chunk.H7KCWCB4.js","./chunk.XSNAG4JT.js","./chunk.XWAMQPUM.js","./chunk.SDO3U72B.js","./chunk.AS4CQBOQ.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.BAMPYMUE.js")))).part((e,n)=>(0,l.jsx)(e.KindStop,{...n}),{what:"This list"});function Ae(e){let{brand:n}=V();return te(e,n?.accents)}function Ut(e,n){if(!n.endsWith("\u2026")&&!n.endsWith("..."))return;let t=n.replace(/[…]|\.\.\.$/g,"").trim();if(!(t.length<12)){for(let a of Object.values(e))if(typeof a=="string"&&a.length>t.length&&a.startsWith(t))return a}}function Xt(e,n){let a=Math.max(0,...e.slice(0,n*2).map(s=>s.length))*7.5+28<=212/2?2:1,o=n*a;return{columns:a,shown:Math.min(e.length,o)}}var Jt=8,Rt=500,Yt=12;function Ct(e){return{x:e.clientX,y:e.clientY,pointerType:e.pointerType??""}}function Zt(e,n,t){let a=performance.now()+Rt,o=["pointerdown","pointerup","mousedown","mouseup","dblclick"],s=r=>{if(performance.now()>a||!(r instanceof MouseEvent))return!1;let c=Ct(r);return n.pointerType&&c.pointerType&&n.pointerType!==c.pointerType?!1:Math.hypot(c.x-n.x,c.y-n.y)<=Yt},d=r=>{if(!s(r))return g();r.stopPropagation()},u=r=>{if(!s(r))return g();r.stopPropagation(),r.preventDefault(),e.removeEventListener("click",u,!0),setTimeout(g,50),t()},m=!1,g=()=>{if(!m){m=!0,clearTimeout(w),e.removeEventListener("click",u,!0);for(let r of o)e.removeEventListener(r,d,!0)}};for(let r of o)e.addEventListener(r,d,!0);e.addEventListener("click",u,!0);let w=setTimeout(g,Rt)}function Qt({View:e,members:n,mode:t,flagged:a}){let{isSelected:o}=xe(),s=n.slice(0,Jt);return(0,l.jsxs)("div",{"data-graview-rows":"",style:{display:"grid",gap:4,minWidth:0},children:[s.map(d=>(0,l.jsx)("div",{"data-graview-pick":d.id,style:{minWidth:0,cursor:"pointer"},children:(0,l.jsx)(e,{node:d,cardinality:"one",fidelity:"glyph",mode:t,selected:o(d.id),...a?.includes(d.id)?{flagged:[d.id]}:{}})},d.id)),n.length>s.length?(0,l.jsx)(X,{label:`+${n.length-s.length} more`}):null]})}var en=11/15,tn=he(ge(()=>(__graviewPreload(import.meta.url,["./chunk.HDRD33II.js","./chunk.DX357TZ3.js","./chunk.H7KCWCB4.js","./chunk.XSNAG4JT.js","./chunk.XWAMQPUM.js","./chunk.SDO3U72B.js","./chunk.AS4CQBOQ.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.TOZJZXWQ.js")))).part((e,n)=>(0,l.jsx)(e.StatesBar,{...n}),{quiet:!0});function nn({text:e,accent:n}){let t=(0,P.useRef)(null),a=(0,P.useRef)(null),[o,s]=(0,P.useState)(1),[d,u]=(0,P.useState)(!1),m=o<1?`${o}em`:void 0;return(0,P.useLayoutEffect)(()=>{let g=t.current,w=a.current;if(!g||!w)return;let r=()=>{let y=g.clientWidth,k=w.offsetWidth;if(y<=0||k<=0)return;let h=parseFloat(getComputedStyle(w).fontSize)/parseFloat(getComputedStyle(g).fontSize)||1,S=k/h,b=Math.max(en,Math.min(1,Math.floor(y/S*100)/100));s(N=>Math.abs(N-b)<.01?N:b),u(S*b>y+.5)};if(r(),typeof ResizeObserver>"u")return;let c=new ResizeObserver(r);return c.observe(g),()=>c.disconnect()},[e]),(0,l.jsx)("span",{ref:t,"data-graview-district-name":"",...o<1?{"data-graview-fitted":""}:{},...d?{title:e}:{},style:{display:"block",minWidth:0,fontSize:"0.9375rem",lineHeight:1.25,letterSpacing:"0.05em",textTransform:"uppercase",color:n?"var(--graview-accent)":"var(--graview-ink-muted)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:(0,l.jsx)("span",{ref:a,style:{fontSize:m},children:e})})}function Pt(e,n){return!!e?.display?.page?.groups?.length||Re(n,e).some(t=>t.long)}function At(e,n=me(e)){for(let t of e.kinds){let a=e.tryDefinition(t),o=a?.plural??`${String(t)}s`,s=r=>{let c=r.node,y=fe(),k=(0,P.useContext)(oe);if(!c)return null;let h=k?.nodeId===c.id?k:null,S=$(a,c),b=r.mode==="fullscreen"?Ut(c,S)??S:S,N=Ke(y,[c.id]);return(0,l.jsxs)(U,{title:(0,l.jsx)(vt,{nodeId:c.id,children:h?.title??b}),...h?{}:{subtitle:a?.describe?at(a,c):a?.description??String(t)},selected:r.selected,...r.flagged?.includes(c.id)?{tone:"warning"}:{},fit:!0,children:[h?(0,l.jsx)(oe.Provider,{value:null,children:h.body}):null,(0,l.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:"22px 34px",alignItems:"flex-start"},children:[(0,l.jsx)("div",{style:{flex:Pt(a,c)?"1 1 100%":"1 1 0",minWidth:"min(200px, 100%)"},children:(0,l.jsx)(yt,{id:c.id,shown:[b,S,a?.description,h?.title],...h?{hide:[...h.fields]}:{}})}),(0,l.jsx)("div",{style:{flex:Pt(a,c)?"1 1 100%":"1.4 1 0",minWidth:"min(220px, 100%)"},children:(0,l.jsx)(xt,{id:c.id,empty:`Nothing is connected to this ${H(a,String(t))} yet.`,...h?{hide:h.records}:{}})})]}),N.length>0?(0,l.jsx)("p",{"data-graview-broken":"",style:{margin:"14px 0 0",paddingTop:12,borderTop:"1px solid var(--graview-edge)",fontSize:"0.875rem",color:"var(--graview-warn)"},children:N.map(v=>v.message).join(" \xB7 ")}):null]})},d=r=>{let c=r.node;if(!c)return null;let{store:y}=V(),k=a?.computed?lt(y.schema,y.graph,c):c,h=Re(k,a,{limit:3,said:[$(a,c)],glance:!0}),S=Ae(t),b=h.filter(x=>!x.long&&!x.markdown),N=h.find(x=>x.long||x.markdown),v=ot(c,a);return(0,l.jsxs)(U,{title:$(a,c),selected:r.selected,tone:r.flagged?.includes(c.id)?"warning":"muted",fit:!0,children:[v?(0,l.jsx)(ve,{as:"thumb",file:v,size:64,style:{marginBottom:6}}):null,(0,l.jsx)(it,{items:b.map(x=>({id:x.key,label:x.alone,hue:S})),max:3}),N?(0,l.jsx)("p",{"data-graview-excerpt":N.key,title:N.value,style:{margin:b.length>0?"6px 0 0":0,fontSize:"0.8125rem",lineHeight:1.35,color:"var(--graview-ink-muted)",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},children:N.value}):null]})},u=r=>{let c=r.node,y=Ae(t),k=ye().marks.flag;if(!c)return null;let h=r.flagged?.includes(c.id)??!1;return(0,l.jsx)(X,{label:h?`${$(a,c)} ${k}`:$(a,c),hue:y,selected:r.selected,title:h?`${ee(H(a,String(t)))} \u2014 implicated in a problem`:ee(H(a,String(t)))})},m=r=>r.fidelity==="full"?(0,l.jsx)(P.Suspense,{fallback:(0,l.jsx)(g,{...r}),children:(0,l.jsx)(qt,{kind:String(t),members:r.nodes??[],...r.flagged?{flagged:r.flagged}:{},...r.label?{label:r.label}:{},...r.retired?{retired:r.retired}:{}})}):(0,l.jsx)(g,{...r}),g=r=>{let{brand:c,store:y,views:k}=V(),{view:h,go:S}=Ne(),b=r.nodes??[],N=k.lookup(String(t),{cardinality:"one",fidelity:"glyph"}),v=N!==void 0&&!pe(N)?N:void 0,x=mt(h),C=ut(b,x,{schema:e,graph:y.graph,flagged:new Set(r.flagged??[])}),M=R=>({id:R.id,label:$(e.tryDefinition(R.kind),R),hue:te(R.kind,c?.accents)}),W=r.fidelity==="full"&&b.length>1?(0,l.jsx)(P.Suspense,{fallback:null,children:(0,l.jsx)(jt,{schema:e,graph:y.graph,kind:String(t),arrangement:x,onChange:R=>S(ht(h,R)),kept:{shown:C.nodes.length,of:b.length},style:{marginBottom:8}})}):null,se=R=>R.some(A=>r.flagged?.includes(A.id)),le=fe(),Y=ye().marks.flag,z=(R,A,de)=>v?(0,l.jsx)(U,{title:R,meta:(0,l.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[(0,l.jsx)(be,{kind:String(t),plural:o,problems:Se(le,A),flag:Y}),(0,l.jsx)("span",{title:`${Q(A.length)} ${A.length===1?H(a,String(t)):o.toLowerCase()}`,children:Q(A.length)})]}),tone:se(A)?"warning":"muted",children:(0,l.jsx)(Qt,{View:v,members:A,mode:r.mode,...r.flagged?{flagged:r.flagged}:{}})},de):(0,l.jsx)(rt,{label:R,count:A.length,flagged:se(A),items:A.map(M),problems:(0,l.jsx)(be,{kind:String(t),plural:o,problems:Se(le,A),flag:Y})},de);return C.grouped?(0,l.jsxs)("div",{style:{display:"grid",gap:8},"data-graview-grouped":x.group?.by,children:[W,C.groups.map(R=>z(`${r.label??o} \xB7 ${R.label}`,R.nodes,R.key||"-"))]}):(0,l.jsxs)("div",{style:{display:"grid",gap:4},children:[W,z(r.label??o,C.nodes)]})},w=r=>{let c=r.nodes??[],y=Xt(c.map(p=>$(a,p)),r.openedRows??dt(c.length)),k=Ae(t),{brand:h}=V(),S=tt(String(t),e,h),b=ye().marks.flag,{selection:N,set:v,clear:x}=xe(),{toggle:C,view:M,go:W}=Ne(),{views:se,hiddenKinds:le}=V(),Y=(0,P.useContext)(Qe),z=M.overview&&!le.has(String(t))?se.places().filter(p=>p.kind===String(t)):[],R=r.focused?M.within?.view??z[0]?.as:void 0,A=c.filter(p=>r.flagged?.includes(p.id)).length,de=A>0,Ot=fe(),Ht=Se(Ot,c),F=(M.overview??!1)&&r.nestedUnder===void 0,G=r.focused||r.raised,He=r.rank==="secondary"&&!G,E=r.nestedUnder!==void 0,Ie=new Set(N),K=Y?N.length===1&&N[0]===ne(String(t)):r.opened??!1,It=ct(),O=G||F?0:c.filter(p=>It.includes(p.id)&&!Ie.has(p.id)).length,ke=O>0&&!de,ce=Ze(),j=ce&&!E?ce.byKind[String(t)]??0:0,We=(0,P.useRef)(null),ze=(0,P.useRef)(null);(0,P.useLayoutEffect)(()=>{let p=ze.current,T=We.current;if(!p||!T||!F)return;let D=()=>T.style.setProperty("--graview-plate-h",`${p.offsetHeight}px`);if(D(),typeof ResizeObserver>"u")return;let Z=new ResizeObserver(D);return Z.observe(p,{box:"border-box"}),()=>Z.disconnect()},[F]);let Wt=E?8:Math.min(46,10+Math.round(Math.sqrt(c.length)*8)),Fe=E?(0,l.jsx)("span",{style:{fontSize:"0.75rem",lineHeight:1.25,letterSpacing:"0.05em",textTransform:"uppercase",color:G?"var(--graview-accent)":"var(--graview-ink-muted)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:r.label??o}):(0,l.jsx)(nn,{text:r.label??o,accent:!!G});return(0,l.jsxs)("div",{ref:We,className:"graview-kind-card","data-graview-rank":r.rank,"data-graview-landmark":S||void 0,"data-graview-nested":E||void 0,"data-graview-tied":O||void 0,"data-graview-hits":ce&&!E?j:void 0,"data-graview-emphasis":ce&&!E?j>0?"lit":"dimmed":void 0,...a?.description||E?{title:E?[r.label??o,a?.description].filter(Boolean).join(" \u2014 "):a.description}:{},style:{position:"relative",height:"100%","--graview-hue":Math.round(k)},children:[S?(0,l.jsx)("span",{className:"graview-kind-block graview-kind-landmark","data-graview-opened":r.opened||void 0,"aria-hidden":"true",style:{"--graview-rise":Wt},children:(0,l.jsx)(ae,{kind:String(t),schema:e,...h?{brand:h}:{},size:96})}):null,(0,l.jsxs)("div",{ref:ze,className:"graview-kind-face","data-graview-opened":r.opened||void 0,"data-graview-nameplate":F?r.nameplate??"full":void 0,style:{display:"flex",flexDirection:"column",gap:E?1:3,padding:E?"5px 7px":"7px 10px",borderRadius:"var(--graview-radius-sm, 9px)",justifyContent:"center",position:"relative",height:"100%",overflow:"hidden",boxSizing:"border-box",border:G?"1px solid var(--graview-accent)":O>0?"1px solid var(--graview-accent-dim)":`1px solid hsl(${Math.round(k)} 55% var(--graview-tint-lightness) / 0.34)`,backgroundColor:"var(--graview-panel)",backgroundImage:`linear-gradient(hsl(${Math.round(k)} 55% var(--graview-tint-lightness) / calc(var(--graview-tint-alpha) * ${G?1.1:He?.28:.5})), hsl(${Math.round(k)} 55% var(--graview-tint-lightness) / calc(var(--graview-tint-alpha) * ${G?1.1:He?.28:.5})))`,boxShadow:G?"0 0 0 1px var(--graview-accent-dim)":void 0},children:[!E&&!F&&c.length>0?(0,l.jsx)("div",{"data-graview-tally":c.length,"data-graview-broken":A||void 0,"aria-hidden":"true",style:{position:"absolute",left:0,right:0,top:0,display:"flex",height:3,background:`hsl(${Math.round(k)} 55% var(--graview-tint-lightness) / 0.4)`},children:A>0?(0,l.jsx)("span",{style:{width:`${Math.max(6,Math.round(A/c.length*100))}%`,background:"var(--graview-warn)"}}):null}):null,S?(0,l.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",gap:E?4:6},children:[(0,l.jsx)(ae,{kind:String(t),schema:e,...h?{brand:h}:{},size:E?14:18}),Fe]}):Fe,(0,l.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:5,fontSize:"0.875rem"},children:[(0,l.jsx)("span",{title:c.length>0?`${Q(c.length)} ${c.length===1?H(a,String(t)):o.toLowerCase()}`:void 0,style:{fontVariantNumeric:"tabular-nums",color:ke?"var(--graview-accent)":"var(--graview-ink-faint)"},children:c.length===0?"none yet":ke?O===c.length?`${O} tied`:`${O} of ${c.length} tied`:Q(c.length)}),(0,l.jsx)(be,{kind:String(t),plural:o,problems:Ht,flag:b,listed:K}),(r.retired??0)>0?(0,l.jsxs)("button",{type:"button",className:"graview-kind-past","data-graview-retired":r.retired,title:`${r.retired} retired ${o.toLowerCase()} \u2014 press to widen the view to the past`,onClick:p=>{p.stopPropagation(),W(pt(M,!0))},onDoubleClick:p=>p.stopPropagation(),onPointerDown:p=>p.stopPropagation(),children:["+",r.retired," past"]}):null,j>0?(0,l.jsxs)("button",{type:"button",className:"graview-kind-hits","data-testid":`hits-${String(t)}`,title:`${j} ${j===1?"match":"matches"} for \u201C${M.q??""}\u201D \u2014 press to go in, narrowed`,onClick:p=>{p.stopPropagation(),W(Xe(M,ne(String(t)),{ownPicture:!0,...M.q?{carry:M.q}:{}}))},onDoubleClick:p=>p.stopPropagation(),onPointerDown:p=>p.stopPropagation(),children:[j," match"]}):null,O>0&&!ke?(0,l.jsxs)("span",{style:{fontSize:"0.8125rem",color:"var(--graview-accent)"},children:[O," tied"]}):null,r.hasOwnView&&!F?(0,l.jsx)("span",{title:`${o} has a view of its own`,"aria-label":"has its own view",style:{fontSize:"0.6875rem",color:"var(--graview-accent)"},children:"\u25C6"}):null,!E&&c.length>0&&!r.focused?(0,l.jsxs)("button",{type:"button",className:"graview-kind-open","data-testid":`open-${String(t)}`,"aria-expanded":K,"aria-label":K?`Close up the ${o}`:`See the ${o} in here`,title:K?"Close it up":`See the ${o} in here`,onClick:p=>{p.stopPropagation(),Y?K?x():v([ne(String(t))]):C(ne(String(t)))},onDoubleClick:p=>p.stopPropagation(),onPointerDown:p=>p.stopPropagation(),children:[(0,l.jsx)("span",{className:"graview-kind-open-word",children:K?"close":"open"})," ",(0,l.jsx)("span",{"aria-hidden":"true",children:K?"\u25B4":"\u25BE"})]}):null]}),F&&r.states?(0,l.jsx)(P.Suspense,{fallback:null,children:(0,l.jsx)(tn,{states:r.states,definition:a})}):null,r.opened?(0,l.jsxs)("div",{className:"graview-kind-members","data-graview-buildings":r.plot?.side??1,style:{display:"grid",gridTemplateColumns:`repeat(${y.columns}, minmax(0, 1fr))`,gap:3},children:[c.slice(0,y.shown).map(p=>{let T=r.flagged?.includes(p.id)??!1,D=$(a,p);return(0,l.jsx)(X,{pickId:p.id,label:T?`${D} ${b}`:D,title:T?`${D} \u2014 implicated in a problem`:void 0,hue:k,selected:Ie.has(p.id)},p.id)}),c.length>y.shown?(0,l.jsxs)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)",padding:"2px 4px",gridColumn:"1 / -1"},children:["+",c.length-y.shown," more \u2014 double-click to go in"]}):null]}):null]}),!E&&z.length>0?(0,l.jsx)("div",{className:"graview-drive-in","data-testid":`drive-in-${String(t)}`,"data-graview-showing":R,onPointerDown:p=>p.stopPropagation(),onDoubleClick:p=>p.stopPropagation(),children:(0,l.jsx)("div",{className:"graview-drive-in-marquee",role:"group","aria-label":`${o}: pictures`,"data-graview-thumbs":z.length===1?"one":"two",children:z.map(p=>{let T=R===p.as;return(0,l.jsxs)("div",{className:"graview-drive-in-thumb","data-graview-pressed":T||void 0,children:[(0,l.jsx)("span",{className:"graview-drive-in-thumb-title","aria-hidden":"true",children:p.title}),(0,l.jsx)("button",{type:"button",className:"graview-drive-in-thumb-press","data-testid":`showing-${p.as}`,"aria-label":`${o}: ${p.title}`,"aria-pressed":T,title:T?`${p.title} is showing \u2014 press again to open it`:`Show ${p.title} on the billboard \u2014 double-click to open it`,onClick:D=>{D.stopPropagation();let Z=()=>W(Je(M,String(t),p.as));if(D.detail>=2||T&&r.focused){Z();return}W(je(_e(qe(M,!0),Ue(String(t))),"view",p.as)),D.detail===1&&Zt(D.currentTarget.ownerDocument,Ct(D.nativeEvent),Z)}})]},p.as)})})}):null]})};m.generic=!0,w.generic=!0,n.register(t,{cardinality:"one",fidelity:"full"},_(s)).register(t,{cardinality:"one",fidelity:"summary"},_(d)).register(t,{cardinality:"one",fidelity:"glyph"},_(u)).register(t,{cardinality:"many",fidelity:"full"},_(m)).register(t,{cardinality:"many",fidelity:"summary"},_(m)).register(t,{cardinality:"many",fidelity:"glyph"},_(w))}return n}var Ee=L(I(),1),$t=new WeakMap;function an(e){let n=$t.get(e);return n||$t.set(e,n=At(e,me(e))),n}var Ve=et;function Vt(){return(0,$e.useContext)(Ve)}function qn({children:e}){return(0,Ee.jsx)(Ve.Provider,{value:!0,children:e})}function Et(e){let n=(0,$e.useContext)(Ve),{store:t}=V();if(n)return null;let a=e.kind??e.node?.kind??e.nodes?.[0]?.kind;if(!a)return null;let o=an(t.schema).lookup(a,{cardinality:e.cardinality,fidelity:e.fidelity});return o?(0,Ee.jsx)(o,{...e}):null}var i=L(I(),1),rn=90,Dt=(0,f.createContext)(null),Lt=(e,n)=>e.trim().toLowerCase().replace(/[_-]+/g," ")===n.trim().toLowerCase().replace(/[_-]+/g," "),on=(0,f.createContext)(null),Be=(0,f.createContext)(null);function Mt({block:e}){let n=(0,f.useContext)(Be),t=n?.slots?.[e.key],a=(0,i.jsx)(sn,{block:e});return t?(0,i.jsx)(f.Suspense,{fallback:a,children:(0,i.jsx)(t,{block:e,node:n.node,drawn:a})}):a}function sn({block:e}){let n=(0,f.useContext)(Dt),t=(0,f.useContext)(dn),a=(0,f.useContext)(De),o=(0,f.useContext)(Pe);if(n&&e.t==="badge"&&n.values.some(s=>Lt(s,e.text))||n&&e.t==="field"&&n.field!==void 0&&e.field===n.field||e.t==="badge"&&/^0(?:\s+\p{L}+)?$/u.test(e.text.trim()))return null;switch(e.t){case"title":return(0,i.jsx)("strong",{className:"graview-spec-title",...o!==null&&Lt(o,e.text)?{"aria-hidden":!0}:{},children:e.text});case"text":return e.markdown||Ce(e.text)?(0,i.jsx)("div",{className:"graview-spec-text",...e.tone?{"data-graview-tone":e.tone}:{},children:(0,i.jsx)(ft,{text:e.text,markdown:e.markdown})}):e.runs?(0,i.jsx)("p",{className:"graview-spec-text graview-spec-meta",...e.tone?{"data-graview-tone":e.tone}:{},children:e.runs.map((s,d)=>(0,i.jsxs)(f.Fragment,{children:[d>0?" ":null,s.field!==void 0?(0,i.jsx)("span",{className:"graview-spec-chip","data-graview-field":s.field,children:s.text}):(0,i.jsx)("span",{className:"graview-spec-meta-words",children:d>0&&e.runs[d-1].field===void 0?`\xB7 ${s.text}`:s.text})]},d))}):(0,i.jsx)("p",{className:"graview-spec-text",...e.tone?{"data-graview-tone":e.tone}:{},children:e.text});case"badge":return(0,i.jsx)("span",{className:"graview-spec-badge","data-graview-tone":e.tone,children:e.text});case"field":return(0,i.jsxs)("span",{className:"graview-spec-field","data-graview-field":e.field,children:[(0,i.jsx)("span",{className:"graview-spec-label",children:e.label}),(0,i.jsx)("span",{className:"graview-spec-value",...Ce(e.text)?{style:{whiteSpace:"pre-line"}}:{},children:e.linked?(0,i.jsx)(gt,{relation:e.linked.relation,refs:e.linked.refs,as:"chip"}):e.app?(0,i.jsx)(wt,{address:e.app}):e.href?(0,i.jsx)("a",{className:"graview-spec-link",href:e.href,...e.href.startsWith("tel:")?{}:{rel:"noopener noreferrer",target:"_blank"},children:e.text}):e.text})]});case"image":return(0,i.jsx)(ve,{as:"block",field:e.field,files:e.files,label:e.label,view:e.as});case"progress":return e.value===void 0||e.max===void 0?(0,i.jsxs)("span",{className:"graview-spec-progress",children:[(0,i.jsx)("span",{className:"graview-spec-label",children:e.label}),(0,i.jsx)("span",{className:"graview-spec-value",children:e.text})]}):(0,i.jsxs)("span",{className:"graview-spec-progress",children:[(0,i.jsx)("span",{className:"graview-spec-label",children:e.label}),(0,i.jsx)("span",{className:"graview-spec-track",role:"progressbar","aria-label":e.label,"aria-valuemin":0,"aria-valuemax":e.max,"aria-valuenow":Math.max(0,Math.min(e.value,e.max)),"aria-valuetext":e.text,children:(0,i.jsx)("span",{className:"graview-spec-fill",style:{width:`${Math.round(Math.max(0,Math.min(e.value,e.max))/e.max*100)}%`}})}),(0,i.jsx)("span",{className:"graview-spec-value",children:e.text})]});case"group":return(0,i.jsx)("span",{className:"graview-spec-group","data-direction":e.direction,children:(0,i.jsx)(Le,{blocks:e.blocks})});case"when":return e.shown?(0,i.jsx)(Le,{blocks:e.blocks}):null;case"divider":return(0,i.jsx)("hr",{className:"graview-spec-divider"});case"figure":return(0,i.jsx)(ln,{});case"headline":{let s=`h${Math.min(6,e.level+t)}`,d=(0,i.jsx)(s,{className:"graview-spec-headline","data-level":e.level,"data-long":e.text.length>rn?"":void 0,children:e.text});return a!==null&&e.level===1?(0,i.jsxs)(i.Fragment,{children:[d,a]}):d}case"number":return(0,i.jsxs)("span",{className:"graview-spec-number",...e.emphasis?{"data-emphasis":e.emphasis}:{},children:[(0,i.jsx)("span",{className:"graview-spec-number-value",children:e.text}),e.label?(0,i.jsx)("span",{className:"graview-spec-label",children:e.label}):null]});case"list":return(0,i.jsx)(un,{list:e})}}function ln(){let e=(0,f.useContext)(Be)?.figure;return e?(0,i.jsx)("span",{className:"graview-spec-figure","aria-hidden":"true",children:e()}):null}function Le({blocks:e}){let n=[];for(let t=0;t<e.length;t++){let a=t;for(;e[a]?.t==="badge"&&e[a+1]?.t==="badge";)a++;if(a===t){n.push((0,i.jsx)(Mt,{block:e[t]},t));continue}n.push((0,i.jsx)("span",{className:"graview-spec-badges",children:e.slice(t,a+1).map((o,s)=>(0,i.jsx)(Mt,{block:o},s))},t)),t=a}return n}function Tt({blocks:e,ctx:n,view:t}){let a=(0,f.useContext)(on)?.[t];return(0,i.jsx)(Be.Provider,{value:{figure:n.figure,slots:a,node:n.node},children:(0,i.jsx)(Le,{blocks:e})})}function Ge({blocks:e,ctx:n,view:t}){return(0,i.jsx)(Tt,{blocks:J(e,n),ctx:n,view:t})}var Me=3,Bt=(0,f.createContext)(0),Gt=(0,f.createContext)(null),dn=(0,f.createContext)(0),De=(0,f.createContext)(null),cn=(0,f.createContext)(null);function gn({node:e,as:n,depth:t,said:a=null}){let{store:o,views:s}=V(),d=$(o.schema.tryDefinition(e.kind),e),u=s.lookup(e.kind,{cardinality:"one",fidelity:n==="card"?"summary":"glyph"});return n==="row"&&t<=Me&&(!u||pe(u))?(0,i.jsxs)("li",{className:"graview-spec-item","data-graview-listed":e.id,"data-as":n,children:[(0,i.jsx)(Te,{node:e,label:d}),(0,i.jsx)("div",{className:"graview-spec graview-spec-row","data-graview-spec":"row","data-graview-kind":e.kind,"aria-hidden":"true",children:(0,i.jsx)("strong",{className:"graview-spec-title",children:d})})]}):(0,i.jsxs)("li",{className:"graview-spec-item","data-graview-listed":e.id,"data-as":n,children:[(0,i.jsx)(Te,{node:e,label:d}),t<=Me&&u?(0,i.jsx)(Ye,{mode:"scene",children:(0,i.jsx)(Bt.Provider,{value:t,children:(0,i.jsx)(Dt.Provider,{value:a,children:(0,i.jsx)(Pe.Provider,{value:d,children:(0,i.jsx)(u,{node:e,cardinality:"one",fidelity:n==="card"?"summary":"glyph",mode:"scene",selected:!1})})})})}):(0,i.jsx)("span",{className:"graview-spec-item-name","aria-hidden":"true",children:d})]})}function Te({node:e,label:n,describedBy:t}){let a=(0,f.useContext)(Gt),o=(0,f.useRef)(null);return bt(o),a?(0,i.jsx)("a",{ref:o,className:"graview-spec-item-link",href:a.href(e),"aria-label":n,...t?{"aria-describedby":t}:{},onClick:s=>{s.metaKey||s.ctrlKey||s.shiftKey||s.button!==0||(s.preventDefault(),s.stopPropagation(),a.go(e))}}):(0,i.jsx)("button",{ref:o,type:"button",className:"graview-spec-item-link","data-graview-pick":e.id,"aria-label":n,...t?{"aria-describedby":t}:{}})}function un({list:e}){let n=(0,f.useContext)(Bt)+1,{store:t}=V(),a=(0,f.useContext)(Gt),[o,s]=(0,f.useState)(e.members.length);if(e.failed)return(0,i.jsx)("p",{className:"graview-spec-text",children:"\u2014"});if(e.members.length===0)return e.empty?(0,i.jsx)("p",{className:"graview-spec-text graview-spec-empty",children:e.empty}):null;let d=(v,x=null)=>n>Me?(0,i.jsx)("ul",{className:"graview-spec-list","data-as":"names",children:v.map(C=>(0,i.jsxs)("li",{className:"graview-spec-item","data-graview-listed":C.id,"data-as":"name",children:[(0,i.jsx)(Te,{node:C,label:$(t.schema.tryDefinition(C.kind),C)}),(0,i.jsx)("span",{className:"graview-spec-item-name","aria-hidden":"true",children:$(t.schema.tryDefinition(C.kind),C)})]},C.id))}):(0,i.jsx)("ul",{className:"graview-spec-list","data-as":e.as,children:v.map(C=>(0,i.jsx)(gn,{node:C,as:e.as,depth:n,said:x},C.id))}),u=e.rest??[],m=Math.min(o,e.members.length+u.length),g=m>e.members.length?[...e.members,...u].slice(0,m):e.members,w=e.members.length+u.length-m,r=Math.max(1,e.members.length),c=w>0?(0,i.jsx)("p",{className:"graview-spec-text graview-spec-more",children:(0,i.jsx)("button",{type:"button",className:"graview-spec-show-more","data-graview-show-more":w,onClick:()=>s(m+r),children:`Show ${Math.min(r,w)} more`})}):null,y=e.total??e.members.length+e.more,k=e.more-u.length,h=c??(a?.more&&y>g.length?a.more({members:g,total:y}):k>0?(0,i.jsx)("p",{className:"graview-spec-text graview-spec-more",children:`and ${k} more`}):null);if(!e.groups)return(0,i.jsxs)("div",{className:"graview-spec-listing",children:[d(g),h]});let S=`h${e.headingLevel}`,b=m,N=m>e.members.length&&e.everyGroup?e.everyGroup.flatMap(v=>{if(b<=0)return[];let x=v.members.slice(0,b);return b-=x.length,[{...v,members:x}]}):e.groups;return(0,i.jsxs)("div",{className:"graview-spec-listing",children:[N.map(v=>(0,i.jsxs)("section",{className:"graview-spec-list-group","data-graview-group":v.value??"",children:[v.heading?(0,i.jsxs)(S,{className:"graview-spec-list-heading",children:[v.heading," ",(0,i.jsx)("span",{className:"graview-spec-list-count",children:(e.everyGroup?.find(x=>x.value===v.value)??v).members.length})]}):null,d(v.members,v.value!==null?{values:[v.value,...v.heading?[v.heading]:[]]}:null)]},v.value??"")),h]})}function da({blocks:e,heading:n=2,firstHeading:t,slot:a,view:o=a}){let{store:s,brand:d}=V();ue();let u=re(s,null,null,{heading:n,firstHeading:t,money:d}),m=(0,f.useContext)(De),w=(0,f.useContext)(cn)?.lede===!0&&a==="place"&&e[0]?.t==="headline"?e.slice(1):e,r=w.some(c=>c.t==="headline");return(0,i.jsxs)("div",{className:`graview-spec graview-spec-${a}`,"data-graview-spec":a,children:[m!==null&&!r?m:null,(0,i.jsx)(De.Provider,{value:r?m:null,children:(0,i.jsx)(Ge,{blocks:w,ctx:u,view:o})})]})}function Oe(e,n="card"){let{store:t,brand:a}=V(),o=t.schema;return{...re(t,null,e,{slot:n,money:a}),figure:()=>(0,i.jsx)(ae,{kind:e.kind,schema:o,...a?{brand:a}:{},size:22})}}function pn({slot:e,blocks:n,node:t,selected:a}){let o=Oe(t,e);return(0,i.jsx)("div",{className:`graview-spec graview-spec-${e}`,"data-graview-spec":e,"data-graview-kind":t.kind,...e==="row"&&n.some(st)?{"data-graview-tall":""}:{},...a?{"data-selected":""}:{},children:(0,i.jsx)(Ge,{blocks:n,ctx:o,view:`${t.kind}.${e}`})})}function mn({blocks:e,node:n,selected:t,flagged:a}){let o=Oe(n),[s,...d]=e,u=s?.t==="title";return(0,i.jsx)(U,{...u?{title:J([s],o)[0].text}:{},selected:t,tone:a?"warning":"muted",fit:!0,children:(0,i.jsx)("div",{className:"graview-spec graview-spec-card","data-graview-spec":"card","data-graview-kind":n.kind,children:(0,i.jsx)(Ge,{blocks:u?d:e,ctx:o,view:`${n.kind}.card`})})})}function hn({blocks:e,props:n}){let t=n.node,a=Oe(t,"page"),o=Vt(),s=J(e,a),d=we(e,s),u=d.title!==void 0&&(!o||d.title===$(a.schema?.tryDefinition(t.kind),t)),m=(0,i.jsx)("div",{className:"graview-spec graview-spec-page","data-graview-spec":"page","data-graview-kind":t.kind,children:(0,i.jsx)(Tt,{blocks:u?s.slice(1):s,ctx:a,view:`${t.kind}.page`})});return o?m:(0,i.jsx)(oe.Provider,{value:{nodeId:t.id,...d.title!==void 0?{title:d.title}:{},body:m,fields:d.fields,records:d.records},children:(0,i.jsx)(Et,{...n})})}function ca(e,n,t){return typeof e=="function"?e.says?.(n,t):void 0}function fn({blocks:e,node:n,selected:t}){let{store:a}=V();return(0,i.jsx)("div",{title:$(a.schema.tryDefinition(n.kind),n),style:{minWidth:0,maxWidth:"100%"},children:(0,i.jsx)(pn,{slot:"row",blocks:e,node:n,selected:t})})}function ga(e,n,t){if(!t)return e;let a=new Set(n.kinds);for(let[o,s]of Object.entries(t)){if(!a.has(o)||!s)continue;let d=o;if(s.card){let u=ie(s.card),m=g=>g.node?(0,i.jsx)(mn,{blocks:u,node:g.node,selected:g.selected,flagged:g.flagged?.includes(g.node.id)??!1}):null;e.register(d,{cardinality:"one",fidelity:"summary"},m)}if(s.row){let u=ie(s.row),m=g=>g.node?(0,i.jsx)(fn,{blocks:u,node:g.node,selected:g.selected}):null;m.says=(g,w)=>we(u,J(u,re({graph:w,schema:n},null,g,{slot:"row"}))),e.register(d,{cardinality:"one",fidelity:"glyph"},m)}if(s.page){let u=ie(s.page),m=g=>g.node?(0,i.jsx)(hn,{blocks:u,props:g}):null;m.says=(g,w)=>we(u,J(u,re({graph:w,schema:n},null,g))),e.register(d,{cardinality:"one",fidelity:"full"},m)}}return e}export{bt as a,qn as b,Dt as c,Gt as d,dn as e,De as f,cn as g,Te as h,da as i,ca as j,ga as k,At as l};
|
|
1
|
+
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{d as Se,f as be}from"./chunk.O2WWYZI7.js";import{e as pt}from"./chunk.VSNHCGKC.js";import{a as ae,b as tt}from"./chunk.SWWAEOZ7.js";import{b as Pe,c as U,d as X,e as it,f as rt}from"./chunk.IROYMLER.js";import{a as wt,d as yt,f as vt}from"./chunk.FWSCBHZ5.js";import{a as ve,b as gt}from"./chunk.7NNI7YH4.js";import{a as Ce,b as ft}from"./chunk.7N2GXZYI.js";import{a as mt,b as ht}from"./chunk.63MS2LOP.js";import{h as ut}from"./chunk.PKUDIWIF.js";import{d as ot,e as ie,f as J,g as we,h as st,j as lt,k as re}from"./chunk.ZIEHF67C.js";import{j as dt,o as ye}from"./chunk.5AGW4NRZ.js";import{c as ct}from"./chunk.DQS7D2W2.js";import{c as at,d as Re}from"./chunk.DX357TZ3.js";import{c as nt}from"./chunk.H7KCWCB4.js";import{Da as he,Fa as et,G as q,Ja as xe,Ka as fe,La as Ne,R as I,T as Ye,Z as Ze,_ as V,aa as ue,ha as Qe,ia as _,j as _e,ja as pe,l as je,m as qe,qa as me,r as ne,v as Ue,y as Xe,z as Je}from"./chunk.Y4ZUJUUT.js";import{a as ge}from"./chunk.SDO3U72B.js";import{$b as te,U as Q,ca as $,ea as ee,gb as Ke,la as H}from"./chunk.AS4CQBOQ.js";import{b as L}from"./chunk.AJZBJBMO.js";var f=L(q(),1);var St=L(q(),1);function bt(e){(0,St.useLayoutEffect)(()=>{let n=e.current,t=n?.parentElement;if(!n||!t)return;let a=n.style.bottom,o=()=>{let d=t.querySelector(zt);if(!d){n.style.bottom=a;return}let u=t.getBoundingClientRect(),m=d.getBoundingClientRect(),g=u.height>0?t.offsetHeight/u.height:1;n.style.bottom=`${Math.max(0,Math.round((u.bottom-m.top)*g))}px`};if(o(),typeof ResizeObserver>"u")return;let s=new ResizeObserver(o);return s.observe(t),()=>s.disconnect()},[e])}var zt=".graview-spec-listing";var $e=L(q(),1);var P=L(q(),1);var kt=L(q(),1);var B=L(I(),1);function xt({id:e,max:n=8,empty:t,hide:a}){let{store:o}=V();ue();let s=Kt(o,e,o.violations()),[d,u]=(0,kt.useState)(()=>new Set),m=a?s.flatMap(g=>{let w=g.ids.filter(r=>!a.has(r));return w.length>0?[{...g,ids:w}]:[]}):s;return m.length===0?t&&s.length===0?(0,B.jsx)("p",{style:{margin:0,fontSize:"0.875rem",color:"var(--graview-ink-faint)"},children:t}):null:(0,B.jsx)("div",{"data-graview-primitive":"connections",style:{display:"flex",flexDirection:"column",gap:12},children:m.map(g=>{let w=d.has(g.key),r=g.ids.length>n,c=w?g.ids:g.ids.slice(0,n),y=g.ids.length-Math.min(n,g.ids.length),k=`graview-more-${e}-${g.key}`.replace(/[^A-Za-z0-9_-]/g,"-");return(0,B.jsxs)("section",{style:{display:"flex",flexDirection:"column",gap:6},children:[(0,B.jsx)("h2",{...g.said?{"aria-label":g.said}:{},style:{margin:0,fontSize:"0.75rem",fontWeight:600,letterSpacing:"0.09em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},children:g.label}),(0,B.jsxs)("div",{id:k,style:{display:"flex",flexWrap:"wrap",gap:6},children:[c.map(h=>{let S=o.graph.getNode(h);return S?(0,B.jsx)(X,{pickId:h,hue:te(S.kind),title:`Go to the ${H(o.schema.tryDefinition(S.kind),S.kind)}`,label:$(o.schema.tryDefinition(S.kind),S)},h):null}),r?(0,B.jsx)("button",{type:"button","data-graview-more":g.key,"aria-expanded":w,"aria-controls":k,...w?{}:{"aria-label":`${y} more: ${g.said??g.label}`},onClick:h=>{h.stopPropagation(),u(S=>{let b=new Set(S);return b.has(g.key)?b.delete(g.key):b.add(g.key),b})},style:Ft,children:w?"Show fewer":`+${y} more`}):null]})]},g.key)})})}var Ft={display:"inline-flex",alignItems:"center",alignSelf:"flex-start",minHeight:24,boxSizing:"border-box",padding:"3px 9px",borderRadius:6,border:"1px solid var(--graview-edge)",background:"var(--graview-panel-muted)",color:"var(--graview-accent)",font:"inherit",fontSize:"0.8125rem",lineHeight:1.5,whiteSpace:"nowrap",cursor:"pointer"};function Kt(e,n,t=[]){let a=e.graph.getNode(n);if(!a)return[];let o=new Map,s=[];for(let d of t)if(d.subjectId===n)for(let u of d.nodeIds)u!==n&&!s.includes(u)&&e.graph.has(u)&&s.push(u);s.length>0&&o.set("judges",{key:"judges",label:"what it finds wrong",ids:s});for(let d of e.graph.allEdges()){let u=d.from===n?d.to:d.to===n?d.from:null;if(u===null||u===n)continue;let m=e.graph.getNode(u);if(!m)continue;let g=d.from===n?"out":"in",w=g==="out"?a.kind:m.kind,r=_t(e.schema,w,d.kind,g),c=`${d.kind}:${g}:${r.label}`,y=o.get(c)??{key:c,...r,ids:[]};y.ids.includes(u)||y.ids.push(u),o.set(c,y)}for(let d of o.values())d.ids.sort();return[...o.values()].sort((d,u)=>d.key<u.key?-1:d.key>u.key?1:0)}function _t(e,n,t,a){let o=nt(e,n,t,a),s=ee(t).toLowerCase();return o.trim().toLowerCase()!==s?{label:o}:a==="out"?{label:`\u2192 ${s}`,said:s}:{label:`\u2190 ${s}`,said:`${s}, pointing here`}}var Nt=L(q(),1),oe=(0,Nt.createContext)(null);var l=L(I(),1),jt=he(ge(()=>(__graviewPreload(import.meta.url,["./chunk.MF73YBJL.js","./chunk.63MS2LOP.js","./chunk.PKUDIWIF.js","./chunk.VW2VCPJX.js","./chunk.HDRD33II.js","./chunk.DX357TZ3.js","./chunk.H7KCWCB4.js","./chunk.O4WEJ47H.js","./chunk.Y4ZUJUUT.js","./chunk.SDO3U72B.js","./chunk.AS4CQBOQ.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.MBETS27C.js")))).part((e,n)=>(0,l.jsx)(e.ArrangeBar,{...n}),{what:"Arranging this list"}),qt=he(ge(()=>(__graviewPreload(import.meta.url,["./chunk.RBJAPOZ3.js","./chunk.L4YNDNX7.js","./chunk.GCKZ2YRJ.js","./chunk.VC3UGFHY.js","./chunk.IJNOT4S4.js","./chunk.YHH4TWZ2.js","./chunk.O2WWYZI7.js","./chunk.AGIO2GRV.js","./chunk.VSNHCGKC.js","./chunk.HJCQ6I3S.js","./chunk.BNPQUI3F.js","./chunk.6RY6OSE6.js","./chunk.RX2M4C5W.js","./chunk.IQ2HKGJS.js","./chunk.R6V37SR7.js","./chunk.SWWAEOZ7.js","./chunk.IROYMLER.js","./chunk.FWSCBHZ5.js","./chunk.7NNI7YH4.js","./chunk.7N2GXZYI.js","./chunk.MF73YBJL.js","./chunk.63MS2LOP.js","./chunk.PKUDIWIF.js","./chunk.VW2VCPJX.js","./chunk.YVONXFKE.js","./chunk.G4JJXA63.js","./chunk.WBHM5I3I.js","./chunk.FOQ27RAR.js","./chunk.UKAPFIPJ.js","./chunk.UT6642FC.js","./chunk.WAB7UDHU.js","./chunk.IW7YFPGG.js","./chunk.Q5WEOX3Q.js","./chunk.4OGOTHRD.js","./chunk.6YD2DLIC.js","./chunk.Q7RQC3F7.js","./chunk.WVUJXDXZ.js","./chunk.ZIEHF67C.js","./chunk.UHX4WTM7.js","./chunk.IKX4VDTW.js","./chunk.RNEJYIQ7.js","./chunk.TBQOSI4J.js","./chunk.KWQ7QOHD.js","./chunk.GZHZLJBF.js","./chunk.5AGW4NRZ.js","./chunk.OJGHDWI6.js","./chunk.DQS7D2W2.js","./chunk.HDRD33II.js","./chunk.DX357TZ3.js","./chunk.H7KCWCB4.js","./chunk.O4WEJ47H.js","./chunk.Y4ZUJUUT.js","./chunk.SDO3U72B.js","./chunk.AS4CQBOQ.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.OJGUIWDD.js")))).part((e,n)=>(0,l.jsx)(e.KindStop,{...n}),{what:"This list"});function Ae(e){let{brand:n}=V();return te(e,n?.accents)}function Ut(e,n){if(!n.endsWith("\u2026")&&!n.endsWith("..."))return;let t=n.replace(/[…]|\.\.\.$/g,"").trim();if(!(t.length<12)){for(let a of Object.values(e))if(typeof a=="string"&&a.length>t.length&&a.startsWith(t))return a}}function Xt(e,n){let a=Math.max(0,...e.slice(0,n*2).map(s=>s.length))*7.5+28<=212/2?2:1,o=n*a;return{columns:a,shown:Math.min(e.length,o)}}var Jt=8,Rt=500,Yt=12;function Ct(e){return{x:e.clientX,y:e.clientY,pointerType:e.pointerType??""}}function Zt(e,n,t){let a=performance.now()+Rt,o=["pointerdown","pointerup","mousedown","mouseup","dblclick"],s=r=>{if(performance.now()>a||!(r instanceof MouseEvent))return!1;let c=Ct(r);return n.pointerType&&c.pointerType&&n.pointerType!==c.pointerType?!1:Math.hypot(c.x-n.x,c.y-n.y)<=Yt},d=r=>{if(!s(r))return g();r.stopPropagation()},u=r=>{if(!s(r))return g();r.stopPropagation(),r.preventDefault(),e.removeEventListener("click",u,!0),setTimeout(g,50),t()},m=!1,g=()=>{if(!m){m=!0,clearTimeout(w),e.removeEventListener("click",u,!0);for(let r of o)e.removeEventListener(r,d,!0)}};for(let r of o)e.addEventListener(r,d,!0);e.addEventListener("click",u,!0);let w=setTimeout(g,Rt)}function Qt({View:e,members:n,mode:t,flagged:a}){let{isSelected:o}=xe(),s=n.slice(0,Jt);return(0,l.jsxs)("div",{"data-graview-rows":"",style:{display:"grid",gap:4,minWidth:0},children:[s.map(d=>(0,l.jsx)("div",{"data-graview-pick":d.id,style:{minWidth:0,cursor:"pointer"},children:(0,l.jsx)(e,{node:d,cardinality:"one",fidelity:"glyph",mode:t,selected:o(d.id),...a?.includes(d.id)?{flagged:[d.id]}:{}})},d.id)),n.length>s.length?(0,l.jsx)(X,{label:`+${n.length-s.length} more`}):null]})}var en=11/15,tn=he(ge(()=>(__graviewPreload(import.meta.url,["./chunk.HDRD33II.js","./chunk.DX357TZ3.js","./chunk.H7KCWCB4.js","./chunk.O4WEJ47H.js","./chunk.Y4ZUJUUT.js","./chunk.SDO3U72B.js","./chunk.AS4CQBOQ.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.SD6N4DGF.js")))).part((e,n)=>(0,l.jsx)(e.StatesBar,{...n}),{quiet:!0});function nn({text:e,accent:n}){let t=(0,P.useRef)(null),a=(0,P.useRef)(null),[o,s]=(0,P.useState)(1),[d,u]=(0,P.useState)(!1),m=o<1?`${o}em`:void 0;return(0,P.useLayoutEffect)(()=>{let g=t.current,w=a.current;if(!g||!w)return;let r=()=>{let y=g.clientWidth,k=w.offsetWidth;if(y<=0||k<=0)return;let h=parseFloat(getComputedStyle(w).fontSize)/parseFloat(getComputedStyle(g).fontSize)||1,S=k/h,b=Math.max(en,Math.min(1,Math.floor(y/S*100)/100));s(N=>Math.abs(N-b)<.01?N:b),u(S*b>y+.5)};if(r(),typeof ResizeObserver>"u")return;let c=new ResizeObserver(r);return c.observe(g),()=>c.disconnect()},[e]),(0,l.jsx)("span",{ref:t,"data-graview-district-name":"",...o<1?{"data-graview-fitted":""}:{},...d?{title:e}:{},style:{display:"block",minWidth:0,fontSize:"0.9375rem",lineHeight:1.25,letterSpacing:"0.05em",textTransform:"uppercase",color:n?"var(--graview-accent)":"var(--graview-ink-muted)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:(0,l.jsx)("span",{ref:a,style:{fontSize:m},children:e})})}function Pt(e,n){return!!e?.display?.page?.groups?.length||Re(n,e).some(t=>t.long)}function At(e,n=me(e)){for(let t of e.kinds){let a=e.tryDefinition(t),o=a?.plural??`${String(t)}s`,s=r=>{let c=r.node,y=fe(),k=(0,P.useContext)(oe);if(!c)return null;let h=k?.nodeId===c.id?k:null,S=$(a,c),b=r.mode==="fullscreen"?Ut(c,S)??S:S,N=Ke(y,[c.id]);return(0,l.jsxs)(U,{title:(0,l.jsx)(vt,{nodeId:c.id,children:h?.title??b}),...h?{}:{subtitle:a?.describe?at(a,c):a?.description??String(t)},selected:r.selected,...r.flagged?.includes(c.id)?{tone:"warning"}:{},fit:!0,children:[h?(0,l.jsx)(oe.Provider,{value:null,children:h.body}):null,(0,l.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:"22px 34px",alignItems:"flex-start"},children:[(0,l.jsx)("div",{style:{flex:Pt(a,c)?"1 1 100%":"1 1 0",minWidth:"min(200px, 100%)"},children:(0,l.jsx)(yt,{id:c.id,shown:[b,S,a?.description,h?.title],...h?{hide:[...h.fields]}:{}})}),(0,l.jsx)("div",{style:{flex:Pt(a,c)?"1 1 100%":"1.4 1 0",minWidth:"min(220px, 100%)"},children:(0,l.jsx)(xt,{id:c.id,empty:`Nothing is connected to this ${H(a,String(t))} yet.`,...h?{hide:h.records}:{}})})]}),N.length>0?(0,l.jsx)("p",{"data-graview-broken":"",style:{margin:"14px 0 0",paddingTop:12,borderTop:"1px solid var(--graview-edge)",fontSize:"0.875rem",color:"var(--graview-warn)"},children:N.map(v=>v.message).join(" \xB7 ")}):null]})},d=r=>{let c=r.node;if(!c)return null;let{store:y}=V(),k=a?.computed?lt(y.schema,y.graph,c):c,h=Re(k,a,{limit:3,said:[$(a,c)],glance:!0}),S=Ae(t),b=h.filter(x=>!x.long&&!x.markdown),N=h.find(x=>x.long||x.markdown),v=ot(c,a);return(0,l.jsxs)(U,{title:$(a,c),selected:r.selected,tone:r.flagged?.includes(c.id)?"warning":"muted",fit:!0,children:[v?(0,l.jsx)(ve,{as:"thumb",file:v,size:64,style:{marginBottom:6}}):null,(0,l.jsx)(it,{items:b.map(x=>({id:x.key,label:x.alone,hue:S})),max:3}),N?(0,l.jsx)("p",{"data-graview-excerpt":N.key,title:N.value,style:{margin:b.length>0?"6px 0 0":0,fontSize:"0.8125rem",lineHeight:1.35,color:"var(--graview-ink-muted)",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},children:N.value}):null]})},u=r=>{let c=r.node,y=Ae(t),k=ye().marks.flag;if(!c)return null;let h=r.flagged?.includes(c.id)??!1;return(0,l.jsx)(X,{label:h?`${$(a,c)} ${k}`:$(a,c),hue:y,selected:r.selected,title:h?`${ee(H(a,String(t)))} \u2014 implicated in a problem`:ee(H(a,String(t)))})},m=r=>r.fidelity==="full"?(0,l.jsx)(P.Suspense,{fallback:(0,l.jsx)(g,{...r}),children:(0,l.jsx)(qt,{kind:String(t),members:r.nodes??[],...r.flagged?{flagged:r.flagged}:{},...r.label?{label:r.label}:{},...r.retired?{retired:r.retired}:{}})}):(0,l.jsx)(g,{...r}),g=r=>{let{brand:c,store:y,views:k}=V(),{view:h,go:S}=Ne(),b=r.nodes??[],N=k.lookup(String(t),{cardinality:"one",fidelity:"glyph"}),v=N!==void 0&&!pe(N)?N:void 0,x=mt(h),C=ut(b,x,{schema:e,graph:y.graph,flagged:new Set(r.flagged??[])}),M=R=>({id:R.id,label:$(e.tryDefinition(R.kind),R),hue:te(R.kind,c?.accents)}),W=r.fidelity==="full"&&b.length>1?(0,l.jsx)(P.Suspense,{fallback:null,children:(0,l.jsx)(jt,{schema:e,graph:y.graph,kind:String(t),arrangement:x,onChange:R=>S(ht(h,R)),kept:{shown:C.nodes.length,of:b.length},style:{marginBottom:8}})}):null,se=R=>R.some(A=>r.flagged?.includes(A.id)),le=fe(),Y=ye().marks.flag,z=(R,A,de)=>v?(0,l.jsx)(U,{title:R,meta:(0,l.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[(0,l.jsx)(be,{kind:String(t),plural:o,problems:Se(le,A),flag:Y}),(0,l.jsx)("span",{title:`${Q(A.length)} ${A.length===1?H(a,String(t)):o.toLowerCase()}`,children:Q(A.length)})]}),tone:se(A)?"warning":"muted",children:(0,l.jsx)(Qt,{View:v,members:A,mode:r.mode,...r.flagged?{flagged:r.flagged}:{}})},de):(0,l.jsx)(rt,{label:R,count:A.length,flagged:se(A),items:A.map(M),problems:(0,l.jsx)(be,{kind:String(t),plural:o,problems:Se(le,A),flag:Y})},de);return C.grouped?(0,l.jsxs)("div",{style:{display:"grid",gap:8},"data-graview-grouped":x.group?.by,children:[W,C.groups.map(R=>z(`${r.label??o} \xB7 ${R.label}`,R.nodes,R.key||"-"))]}):(0,l.jsxs)("div",{style:{display:"grid",gap:4},children:[W,z(r.label??o,C.nodes)]})},w=r=>{let c=r.nodes??[],y=Xt(c.map(p=>$(a,p)),r.openedRows??dt(c.length)),k=Ae(t),{brand:h}=V(),S=tt(String(t),e,h),b=ye().marks.flag,{selection:N,set:v,clear:x}=xe(),{toggle:C,view:M,go:W}=Ne(),{views:se,hiddenKinds:le}=V(),Y=(0,P.useContext)(Qe),z=M.overview&&!le.has(String(t))?se.places().filter(p=>p.kind===String(t)):[],R=r.focused?M.within?.view??z[0]?.as:void 0,A=c.filter(p=>r.flagged?.includes(p.id)).length,de=A>0,Ot=fe(),Ht=Se(Ot,c),F=(M.overview??!1)&&r.nestedUnder===void 0,G=r.focused||r.raised,He=r.rank==="secondary"&&!G,E=r.nestedUnder!==void 0,Ie=new Set(N),K=Y?N.length===1&&N[0]===ne(String(t)):r.opened??!1,It=ct(),O=G||F?0:c.filter(p=>It.includes(p.id)&&!Ie.has(p.id)).length,ke=O>0&&!de,ce=Ze(),j=ce&&!E?ce.byKind[String(t)]??0:0,We=(0,P.useRef)(null),ze=(0,P.useRef)(null);(0,P.useLayoutEffect)(()=>{let p=ze.current,T=We.current;if(!p||!T||!F)return;let D=()=>T.style.setProperty("--graview-plate-h",`${p.offsetHeight}px`);if(D(),typeof ResizeObserver>"u")return;let Z=new ResizeObserver(D);return Z.observe(p,{box:"border-box"}),()=>Z.disconnect()},[F]);let Wt=E?8:Math.min(46,10+Math.round(Math.sqrt(c.length)*8)),Fe=E?(0,l.jsx)("span",{style:{fontSize:"0.75rem",lineHeight:1.25,letterSpacing:"0.05em",textTransform:"uppercase",color:G?"var(--graview-accent)":"var(--graview-ink-muted)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:r.label??o}):(0,l.jsx)(nn,{text:r.label??o,accent:!!G});return(0,l.jsxs)("div",{ref:We,className:"graview-kind-card","data-graview-rank":r.rank,"data-graview-landmark":S||void 0,"data-graview-nested":E||void 0,"data-graview-tied":O||void 0,"data-graview-hits":ce&&!E?j:void 0,"data-graview-emphasis":ce&&!E?j>0?"lit":"dimmed":void 0,...a?.description||E?{title:E?[r.label??o,a?.description].filter(Boolean).join(" \u2014 "):a.description}:{},style:{position:"relative",height:"100%","--graview-hue":Math.round(k)},children:[S?(0,l.jsx)("span",{className:"graview-kind-block graview-kind-landmark","data-graview-opened":r.opened||void 0,"aria-hidden":"true",style:{"--graview-rise":Wt},children:(0,l.jsx)(ae,{kind:String(t),schema:e,...h?{brand:h}:{},size:96})}):null,(0,l.jsxs)("div",{ref:ze,className:"graview-kind-face","data-graview-opened":r.opened||void 0,"data-graview-nameplate":F?r.nameplate??"full":void 0,style:{display:"flex",flexDirection:"column",gap:E?1:3,padding:E?"5px 7px":"7px 10px",borderRadius:"var(--graview-radius-sm, 9px)",justifyContent:"center",position:"relative",height:"100%",overflow:"hidden",boxSizing:"border-box",border:G?"1px solid var(--graview-accent)":O>0?"1px solid var(--graview-accent-dim)":`1px solid hsl(${Math.round(k)} 55% var(--graview-tint-lightness) / 0.34)`,backgroundColor:"var(--graview-panel)",backgroundImage:`linear-gradient(hsl(${Math.round(k)} 55% var(--graview-tint-lightness) / calc(var(--graview-tint-alpha) * ${G?1.1:He?.28:.5})), hsl(${Math.round(k)} 55% var(--graview-tint-lightness) / calc(var(--graview-tint-alpha) * ${G?1.1:He?.28:.5})))`,boxShadow:G?"0 0 0 1px var(--graview-accent-dim)":void 0},children:[!E&&!F&&c.length>0?(0,l.jsx)("div",{"data-graview-tally":c.length,"data-graview-broken":A||void 0,"aria-hidden":"true",style:{position:"absolute",left:0,right:0,top:0,display:"flex",height:3,background:`hsl(${Math.round(k)} 55% var(--graview-tint-lightness) / 0.4)`},children:A>0?(0,l.jsx)("span",{style:{width:`${Math.max(6,Math.round(A/c.length*100))}%`,background:"var(--graview-warn)"}}):null}):null,S?(0,l.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",gap:E?4:6},children:[(0,l.jsx)(ae,{kind:String(t),schema:e,...h?{brand:h}:{},size:E?14:18}),Fe]}):Fe,(0,l.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:5,fontSize:"0.875rem"},children:[(0,l.jsx)("span",{title:c.length>0?`${Q(c.length)} ${c.length===1?H(a,String(t)):o.toLowerCase()}`:void 0,style:{fontVariantNumeric:"tabular-nums",color:ke?"var(--graview-accent)":"var(--graview-ink-faint)"},children:c.length===0?"none yet":ke?O===c.length?`${O} tied`:`${O} of ${c.length} tied`:Q(c.length)}),(0,l.jsx)(be,{kind:String(t),plural:o,problems:Ht,flag:b,listed:K}),(r.retired??0)>0?(0,l.jsxs)("button",{type:"button",className:"graview-kind-past","data-graview-retired":r.retired,title:`${r.retired} retired ${o.toLowerCase()} \u2014 press to widen the view to the past`,onClick:p=>{p.stopPropagation(),W(pt(M,!0))},onDoubleClick:p=>p.stopPropagation(),onPointerDown:p=>p.stopPropagation(),children:["+",r.retired," past"]}):null,j>0?(0,l.jsxs)("button",{type:"button",className:"graview-kind-hits","data-testid":`hits-${String(t)}`,title:`${j} ${j===1?"match":"matches"} for \u201C${M.q??""}\u201D \u2014 press to go in, narrowed`,onClick:p=>{p.stopPropagation(),W(Xe(M,ne(String(t)),{ownPicture:!0,...M.q?{carry:M.q}:{}}))},onDoubleClick:p=>p.stopPropagation(),onPointerDown:p=>p.stopPropagation(),children:[j," match"]}):null,O>0&&!ke?(0,l.jsxs)("span",{style:{fontSize:"0.8125rem",color:"var(--graview-accent)"},children:[O," tied"]}):null,r.hasOwnView&&!F?(0,l.jsx)("span",{title:`${o} has a view of its own`,"aria-label":"has its own view",style:{fontSize:"0.6875rem",color:"var(--graview-accent)"},children:"\u25C6"}):null,!E&&c.length>0&&!r.focused?(0,l.jsxs)("button",{type:"button",className:"graview-kind-open","data-testid":`open-${String(t)}`,"aria-expanded":K,"aria-label":K?`Close up the ${o}`:`See the ${o} in here`,title:K?"Close it up":`See the ${o} in here`,onClick:p=>{p.stopPropagation(),Y?K?x():v([ne(String(t))]):C(ne(String(t)))},onDoubleClick:p=>p.stopPropagation(),onPointerDown:p=>p.stopPropagation(),children:[(0,l.jsx)("span",{className:"graview-kind-open-word",children:K?"close":"open"})," ",(0,l.jsx)("span",{"aria-hidden":"true",children:K?"\u25B4":"\u25BE"})]}):null]}),F&&r.states?(0,l.jsx)(P.Suspense,{fallback:null,children:(0,l.jsx)(tn,{states:r.states,definition:a})}):null,r.opened?(0,l.jsxs)("div",{className:"graview-kind-members","data-graview-buildings":r.plot?.side??1,style:{display:"grid",gridTemplateColumns:`repeat(${y.columns}, minmax(0, 1fr))`,gap:3},children:[c.slice(0,y.shown).map(p=>{let T=r.flagged?.includes(p.id)??!1,D=$(a,p);return(0,l.jsx)(X,{pickId:p.id,label:T?`${D} ${b}`:D,title:T?`${D} \u2014 implicated in a problem`:void 0,hue:k,selected:Ie.has(p.id)},p.id)}),c.length>y.shown?(0,l.jsxs)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)",padding:"2px 4px",gridColumn:"1 / -1"},children:["+",c.length-y.shown," more \u2014 double-click to go in"]}):null]}):null]}),!E&&z.length>0?(0,l.jsx)("div",{className:"graview-drive-in","data-testid":`drive-in-${String(t)}`,"data-graview-showing":R,onPointerDown:p=>p.stopPropagation(),onDoubleClick:p=>p.stopPropagation(),children:(0,l.jsx)("div",{className:"graview-drive-in-marquee",role:"group","aria-label":`${o}: pictures`,"data-graview-thumbs":z.length===1?"one":"two",children:z.map(p=>{let T=R===p.as;return(0,l.jsxs)("div",{className:"graview-drive-in-thumb","data-graview-pressed":T||void 0,children:[(0,l.jsx)("span",{className:"graview-drive-in-thumb-title","aria-hidden":"true",children:p.title}),(0,l.jsx)("button",{type:"button",className:"graview-drive-in-thumb-press","data-testid":`showing-${p.as}`,"aria-label":`${o}: ${p.title}`,"aria-pressed":T,title:T?`${p.title} is showing \u2014 press again to open it`:`Show ${p.title} on the billboard \u2014 double-click to open it`,onClick:D=>{D.stopPropagation();let Z=()=>W(Je(M,String(t),p.as));if(D.detail>=2||T&&r.focused){Z();return}W(je(_e(qe(M,!0),Ue(String(t))),"view",p.as)),D.detail===1&&Zt(D.currentTarget.ownerDocument,Ct(D.nativeEvent),Z)}})]},p.as)})})}):null]})};m.generic=!0,w.generic=!0,n.register(t,{cardinality:"one",fidelity:"full"},_(s)).register(t,{cardinality:"one",fidelity:"summary"},_(d)).register(t,{cardinality:"one",fidelity:"glyph"},_(u)).register(t,{cardinality:"many",fidelity:"full"},_(m)).register(t,{cardinality:"many",fidelity:"summary"},_(m)).register(t,{cardinality:"many",fidelity:"glyph"},_(w))}return n}var Ee=L(I(),1),$t=new WeakMap;function an(e){let n=$t.get(e);return n||$t.set(e,n=At(e,me(e))),n}var Ve=et;function Vt(){return(0,$e.useContext)(Ve)}function qn({children:e}){return(0,Ee.jsx)(Ve.Provider,{value:!0,children:e})}function Et(e){let n=(0,$e.useContext)(Ve),{store:t}=V();if(n)return null;let a=e.kind??e.node?.kind??e.nodes?.[0]?.kind;if(!a)return null;let o=an(t.schema).lookup(a,{cardinality:e.cardinality,fidelity:e.fidelity});return o?(0,Ee.jsx)(o,{...e}):null}var i=L(I(),1),rn=90,Dt=(0,f.createContext)(null),Lt=(e,n)=>e.trim().toLowerCase().replace(/[_-]+/g," ")===n.trim().toLowerCase().replace(/[_-]+/g," "),on=(0,f.createContext)(null),Be=(0,f.createContext)(null);function Mt({block:e}){let n=(0,f.useContext)(Be),t=n?.slots?.[e.key],a=(0,i.jsx)(sn,{block:e});return t?(0,i.jsx)(f.Suspense,{fallback:a,children:(0,i.jsx)(t,{block:e,node:n.node,drawn:a})}):a}function sn({block:e}){let n=(0,f.useContext)(Dt),t=(0,f.useContext)(dn),a=(0,f.useContext)(De),o=(0,f.useContext)(Pe);if(n&&e.t==="badge"&&n.values.some(s=>Lt(s,e.text))||n&&e.t==="field"&&n.field!==void 0&&e.field===n.field||e.t==="badge"&&/^0(?:\s+\p{L}+)?$/u.test(e.text.trim()))return null;switch(e.t){case"title":return(0,i.jsx)("strong",{className:"graview-spec-title",...o!==null&&Lt(o,e.text)?{"aria-hidden":!0}:{},children:e.text});case"text":return e.markdown||Ce(e.text)?(0,i.jsx)("div",{className:"graview-spec-text",...e.tone?{"data-graview-tone":e.tone}:{},children:(0,i.jsx)(ft,{text:e.text,markdown:e.markdown})}):e.runs?(0,i.jsx)("p",{className:"graview-spec-text graview-spec-meta",...e.tone?{"data-graview-tone":e.tone}:{},children:e.runs.map((s,d)=>(0,i.jsxs)(f.Fragment,{children:[d>0?" ":null,s.field!==void 0?(0,i.jsx)("span",{className:"graview-spec-chip","data-graview-field":s.field,children:s.text}):(0,i.jsx)("span",{className:"graview-spec-meta-words",children:d>0&&e.runs[d-1].field===void 0?`\xB7 ${s.text}`:s.text})]},d))}):(0,i.jsx)("p",{className:"graview-spec-text",...e.tone?{"data-graview-tone":e.tone}:{},children:e.text});case"badge":return(0,i.jsx)("span",{className:"graview-spec-badge","data-graview-tone":e.tone,children:e.text});case"field":return(0,i.jsxs)("span",{className:"graview-spec-field","data-graview-field":e.field,children:[(0,i.jsx)("span",{className:"graview-spec-label",children:e.label}),(0,i.jsx)("span",{className:"graview-spec-value",...Ce(e.text)?{style:{whiteSpace:"pre-line"}}:{},children:e.linked?(0,i.jsx)(gt,{relation:e.linked.relation,refs:e.linked.refs,as:"chip"}):e.app?(0,i.jsx)(wt,{address:e.app}):e.href?(0,i.jsx)("a",{className:"graview-spec-link",href:e.href,...e.href.startsWith("tel:")?{}:{rel:"noopener noreferrer",target:"_blank"},children:e.text}):e.text})]});case"image":return(0,i.jsx)(ve,{as:"block",field:e.field,files:e.files,label:e.label,view:e.as});case"progress":return e.value===void 0||e.max===void 0?(0,i.jsxs)("span",{className:"graview-spec-progress",children:[(0,i.jsx)("span",{className:"graview-spec-label",children:e.label}),(0,i.jsx)("span",{className:"graview-spec-value",children:e.text})]}):(0,i.jsxs)("span",{className:"graview-spec-progress",children:[(0,i.jsx)("span",{className:"graview-spec-label",children:e.label}),(0,i.jsx)("span",{className:"graview-spec-track",role:"progressbar","aria-label":e.label,"aria-valuemin":0,"aria-valuemax":e.max,"aria-valuenow":Math.max(0,Math.min(e.value,e.max)),"aria-valuetext":e.text,children:(0,i.jsx)("span",{className:"graview-spec-fill",style:{width:`${Math.round(Math.max(0,Math.min(e.value,e.max))/e.max*100)}%`}})}),(0,i.jsx)("span",{className:"graview-spec-value",children:e.text})]});case"group":return(0,i.jsx)("span",{className:"graview-spec-group","data-direction":e.direction,children:(0,i.jsx)(Le,{blocks:e.blocks})});case"when":return e.shown?(0,i.jsx)(Le,{blocks:e.blocks}):null;case"divider":return(0,i.jsx)("hr",{className:"graview-spec-divider"});case"figure":return(0,i.jsx)(ln,{});case"headline":{let s=`h${Math.min(6,e.level+t)}`,d=(0,i.jsx)(s,{className:"graview-spec-headline","data-level":e.level,"data-long":e.text.length>rn?"":void 0,children:e.text});return a!==null&&e.level===1?(0,i.jsxs)(i.Fragment,{children:[d,a]}):d}case"number":return(0,i.jsxs)("span",{className:"graview-spec-number",...e.emphasis?{"data-emphasis":e.emphasis}:{},children:[(0,i.jsx)("span",{className:"graview-spec-number-value",children:e.text}),e.label?(0,i.jsx)("span",{className:"graview-spec-label",children:e.label}):null]});case"list":return(0,i.jsx)(un,{list:e})}}function ln(){let e=(0,f.useContext)(Be)?.figure;return e?(0,i.jsx)("span",{className:"graview-spec-figure","aria-hidden":"true",children:e()}):null}function Le({blocks:e}){let n=[];for(let t=0;t<e.length;t++){let a=t;for(;e[a]?.t==="badge"&&e[a+1]?.t==="badge";)a++;if(a===t){n.push((0,i.jsx)(Mt,{block:e[t]},t));continue}n.push((0,i.jsx)("span",{className:"graview-spec-badges",children:e.slice(t,a+1).map((o,s)=>(0,i.jsx)(Mt,{block:o},s))},t)),t=a}return n}function Tt({blocks:e,ctx:n,view:t}){let a=(0,f.useContext)(on)?.[t];return(0,i.jsx)(Be.Provider,{value:{figure:n.figure,slots:a,node:n.node},children:(0,i.jsx)(Le,{blocks:e})})}function Ge({blocks:e,ctx:n,view:t}){return(0,i.jsx)(Tt,{blocks:J(e,n),ctx:n,view:t})}var Me=3,Bt=(0,f.createContext)(0),Gt=(0,f.createContext)(null),dn=(0,f.createContext)(0),De=(0,f.createContext)(null),cn=(0,f.createContext)(null);function gn({node:e,as:n,depth:t,said:a=null}){let{store:o,views:s}=V(),d=$(o.schema.tryDefinition(e.kind),e),u=s.lookup(e.kind,{cardinality:"one",fidelity:n==="card"?"summary":"glyph"});return n==="row"&&t<=Me&&(!u||pe(u))?(0,i.jsxs)("li",{className:"graview-spec-item","data-graview-listed":e.id,"data-as":n,children:[(0,i.jsx)(Te,{node:e,label:d}),(0,i.jsx)("div",{className:"graview-spec graview-spec-row","data-graview-spec":"row","data-graview-kind":e.kind,"aria-hidden":"true",children:(0,i.jsx)("strong",{className:"graview-spec-title",children:d})})]}):(0,i.jsxs)("li",{className:"graview-spec-item","data-graview-listed":e.id,"data-as":n,children:[(0,i.jsx)(Te,{node:e,label:d}),t<=Me&&u?(0,i.jsx)(Ye,{mode:"scene",children:(0,i.jsx)(Bt.Provider,{value:t,children:(0,i.jsx)(Dt.Provider,{value:a,children:(0,i.jsx)(Pe.Provider,{value:d,children:(0,i.jsx)(u,{node:e,cardinality:"one",fidelity:n==="card"?"summary":"glyph",mode:"scene",selected:!1})})})})}):(0,i.jsx)("span",{className:"graview-spec-item-name","aria-hidden":"true",children:d})]})}function Te({node:e,label:n,describedBy:t}){let a=(0,f.useContext)(Gt),o=(0,f.useRef)(null);return bt(o),a?(0,i.jsx)("a",{ref:o,className:"graview-spec-item-link",href:a.href(e),"aria-label":n,...t?{"aria-describedby":t}:{},onClick:s=>{s.metaKey||s.ctrlKey||s.shiftKey||s.button!==0||(s.preventDefault(),s.stopPropagation(),a.go(e))}}):(0,i.jsx)("button",{ref:o,type:"button",className:"graview-spec-item-link","data-graview-pick":e.id,"aria-label":n,...t?{"aria-describedby":t}:{}})}function un({list:e}){let n=(0,f.useContext)(Bt)+1,{store:t}=V(),a=(0,f.useContext)(Gt),[o,s]=(0,f.useState)(e.members.length);if(e.failed)return(0,i.jsx)("p",{className:"graview-spec-text",children:"\u2014"});if(e.members.length===0)return e.empty?(0,i.jsx)("p",{className:"graview-spec-text graview-spec-empty",children:e.empty}):null;let d=(v,x=null)=>n>Me?(0,i.jsx)("ul",{className:"graview-spec-list","data-as":"names",children:v.map(C=>(0,i.jsxs)("li",{className:"graview-spec-item","data-graview-listed":C.id,"data-as":"name",children:[(0,i.jsx)(Te,{node:C,label:$(t.schema.tryDefinition(C.kind),C)}),(0,i.jsx)("span",{className:"graview-spec-item-name","aria-hidden":"true",children:$(t.schema.tryDefinition(C.kind),C)})]},C.id))}):(0,i.jsx)("ul",{className:"graview-spec-list","data-as":e.as,children:v.map(C=>(0,i.jsx)(gn,{node:C,as:e.as,depth:n,said:x},C.id))}),u=e.rest??[],m=Math.min(o,e.members.length+u.length),g=m>e.members.length?[...e.members,...u].slice(0,m):e.members,w=e.members.length+u.length-m,r=Math.max(1,e.members.length),c=w>0?(0,i.jsx)("p",{className:"graview-spec-text graview-spec-more",children:(0,i.jsx)("button",{type:"button",className:"graview-spec-show-more","data-graview-show-more":w,onClick:()=>s(m+r),children:`Show ${Math.min(r,w)} more`})}):null,y=e.total??e.members.length+e.more,k=e.more-u.length,h=c??(a?.more&&y>g.length?a.more({members:g,total:y}):k>0?(0,i.jsx)("p",{className:"graview-spec-text graview-spec-more",children:`and ${k} more`}):null);if(!e.groups)return(0,i.jsxs)("div",{className:"graview-spec-listing",children:[d(g),h]});let S=`h${e.headingLevel}`,b=m,N=m>e.members.length&&e.everyGroup?e.everyGroup.flatMap(v=>{if(b<=0)return[];let x=v.members.slice(0,b);return b-=x.length,[{...v,members:x}]}):e.groups;return(0,i.jsxs)("div",{className:"graview-spec-listing",children:[N.map(v=>(0,i.jsxs)("section",{className:"graview-spec-list-group","data-graview-group":v.value??"",children:[v.heading?(0,i.jsxs)(S,{className:"graview-spec-list-heading",children:[v.heading," ",(0,i.jsx)("span",{className:"graview-spec-list-count",children:(e.everyGroup?.find(x=>x.value===v.value)??v).members.length})]}):null,d(v.members,v.value!==null?{values:[v.value,...v.heading?[v.heading]:[]]}:null)]},v.value??"")),h]})}function da({blocks:e,heading:n=2,firstHeading:t,slot:a,view:o=a}){let{store:s,brand:d}=V();ue();let u=re(s,null,null,{heading:n,firstHeading:t,money:d}),m=(0,f.useContext)(De),w=(0,f.useContext)(cn)?.lede===!0&&a==="place"&&e[0]?.t==="headline"?e.slice(1):e,r=w.some(c=>c.t==="headline");return(0,i.jsxs)("div",{className:`graview-spec graview-spec-${a}`,"data-graview-spec":a,children:[m!==null&&!r?m:null,(0,i.jsx)(De.Provider,{value:r?m:null,children:(0,i.jsx)(Ge,{blocks:w,ctx:u,view:o})})]})}function Oe(e,n="card"){let{store:t,brand:a}=V(),o=t.schema;return{...re(t,null,e,{slot:n,money:a}),figure:()=>(0,i.jsx)(ae,{kind:e.kind,schema:o,...a?{brand:a}:{},size:22})}}function pn({slot:e,blocks:n,node:t,selected:a}){let o=Oe(t,e);return(0,i.jsx)("div",{className:`graview-spec graview-spec-${e}`,"data-graview-spec":e,"data-graview-kind":t.kind,...e==="row"&&n.some(st)?{"data-graview-tall":""}:{},...a?{"data-selected":""}:{},children:(0,i.jsx)(Ge,{blocks:n,ctx:o,view:`${t.kind}.${e}`})})}function mn({blocks:e,node:n,selected:t,flagged:a}){let o=Oe(n),[s,...d]=e,u=s?.t==="title";return(0,i.jsx)(U,{...u?{title:J([s],o)[0].text}:{},selected:t,tone:a?"warning":"muted",fit:!0,children:(0,i.jsx)("div",{className:"graview-spec graview-spec-card","data-graview-spec":"card","data-graview-kind":n.kind,children:(0,i.jsx)(Ge,{blocks:u?d:e,ctx:o,view:`${n.kind}.card`})})})}function hn({blocks:e,props:n}){let t=n.node,a=Oe(t,"page"),o=Vt(),s=J(e,a),d=we(e,s),u=d.title!==void 0&&(!o||d.title===$(a.schema?.tryDefinition(t.kind),t)),m=(0,i.jsx)("div",{className:"graview-spec graview-spec-page","data-graview-spec":"page","data-graview-kind":t.kind,children:(0,i.jsx)(Tt,{blocks:u?s.slice(1):s,ctx:a,view:`${t.kind}.page`})});return o?m:(0,i.jsx)(oe.Provider,{value:{nodeId:t.id,...d.title!==void 0?{title:d.title}:{},body:m,fields:d.fields,records:d.records},children:(0,i.jsx)(Et,{...n})})}function ca(e,n,t){return typeof e=="function"?e.says?.(n,t):void 0}function fn({blocks:e,node:n,selected:t}){let{store:a}=V();return(0,i.jsx)("div",{title:$(a.schema.tryDefinition(n.kind),n),style:{minWidth:0,maxWidth:"100%"},children:(0,i.jsx)(pn,{slot:"row",blocks:e,node:n,selected:t})})}function ga(e,n,t){if(!t)return e;let a=new Set(n.kinds);for(let[o,s]of Object.entries(t)){if(!a.has(o)||!s)continue;let d=o;if(s.card){let u=ie(s.card),m=g=>g.node?(0,i.jsx)(mn,{blocks:u,node:g.node,selected:g.selected,flagged:g.flagged?.includes(g.node.id)??!1}):null;e.register(d,{cardinality:"one",fidelity:"summary"},m)}if(s.row){let u=ie(s.row),m=g=>g.node?(0,i.jsx)(fn,{blocks:u,node:g.node,selected:g.selected}):null;m.says=(g,w)=>we(u,J(u,re({graph:w,schema:n},null,g,{slot:"row"}))),e.register(d,{cardinality:"one",fidelity:"glyph"},m)}if(s.page){let u=ie(s.page),m=g=>g.node?(0,i.jsx)(hn,{blocks:u,props:g}):null;m.says=(g,w)=>we(u,J(u,re({graph:w,schema:n},null,g))),e.register(d,{cardinality:"one",fidelity:"full"},m)}}return e}export{bt as a,qn as b,Dt as c,Gt as d,dn as e,De as f,cn as g,Te as h,da as i,ca as j,ga as k,At as l};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as k}from"./chunk.G4JJXA63.js";import{a as Q}from"./chunk.VC3BX2ZF.js";import{a as Y}from"./chunk.WAB7UDHU.js";import{a as X}from"./chunk.UHX4WTM7.js";import{c as _}from"./chunk.TBQOSI4J.js";import{cd as G,ed as H,fd as P,gd as J,kb as q,lb as z}from"./chunk.AS4CQBOQ.js";var O=e=>"failed"in e;function ue(e,n){let r=e.schema.kinds,t=e.policy?.sees;if(!t?.length||z(n))return{kinds:r};let o=q(n).roles??[],i=new Set(t.filter(s=>s.roles==="*"||o.some(a=>s.roles.includes(a))).flatMap(s=>s.kinds));return{kinds:r.filter(s=>i.has(s))}}function L(e,n){if(!n)return e;let r=new Set(n.kinds.filter(i=>e.tryDefinition(i)!==void 0));if(r.size===e.kinds.length)return e;let t=new Map,o=i=>{if(r.has(i)){if(!t.has(i)){let s=e.tryDefinition(i),a=Object.fromEntries(Object.entries(s?.edges??{}).flatMap(([l,d])=>{if(d.to==="*")return[[l,d]];let c=d.to.filter(u=>r.has(u));return c.length>0?[[l,{...d,to:c}]]:[]}));t.set(i,{...s,edges:a})}return t.get(i)}};return{...e,definitions:e.definitions.filter(i=>r.has(i.kind)),kinds:e.kinds.filter(i=>r.has(i)),tryDefinition:o,definition:i=>{let s=o(i);if(!s)throw new Error(`Unknown node kind "${i}"`);return s}}}var fe=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),y=e=>fe(e).replace(/[-_]+/g," ").trim();function I(e){let n=[];for(let t of e.kinds){let o=e.tryDefinition(t);if(!o)continue;let i=o.display?.labels??{},s=Object.entries(o.fields?.shape??{}).filter(([d])=>d!=="id"&&d!=="kind").map(([d,c])=>{let u=X(c);return{name:d,type:u?.type,...u?.options?{options:u.options}:{},words:(i[d]??y(d)).toLowerCase()}}),a=Object.entries(o.edges??{}).map(([d,c])=>({name:d,from:t,to:c.to==="*"?e.kinds.filter(u=>u!==t):c.to,words:y(d)})),l=(o.plural??`${y(t)}s`).toLowerCase();n.push({kind:t,plural:l,noun:(o.noun??y(t)).toLowerCase(),fields:s,roles:o.fieldRoles??{},edges:a})}let r=new Map(n.map(t=>[t.kind,t]));return{schema:e,kinds:n,info:t=>r.get(t)}}var $=(e,n)=>n===void 0?void 0:e.fields.find(r=>r.name===n),A=e=>e?.type==="date"||e?.type==="datetime",N=e=>e?.type==="number"||e?.type==="integer"||e?.type==="duration",re=e=>` ${e.toLowerCase().replace(/[“”"’‘]/g,"'").replace(/[^\p{L}\p{N}' -]+/gu," ").replace(/\s+/g," ").trim()} `,E=(e,n)=>e.includes(` ${n} `),x=e=>e.endsWith("ies")?`${e.slice(0,-3)}y`:e.endsWith("ses")?e.slice(0,-2):e.endsWith("s")?e.slice(0,-1):e;function pe(e,n){let r=[];for(let t of n.kinds){let o=new Set([t.plural,t.noun,`${t.noun}s`,y(t.kind),`${y(t.kind)}s`]),i=-1;for(let s of o){let a=e.indexOf(` ${s} `);a>=0&&(i<0||a<i)&&(i=a)}i>=0&&r.push({info:t,at:i})}return r.sort((t,o)=>t.at-o.at).map(t=>t.info)}function v(e,n,r){let t=n.trim().toLowerCase();if(t.length===0)return;let o=e.fields.filter(i=>!r||r(i));return o.find(i=>i.words===t||y(i.name)===t||i.name.toLowerCase()===t)??o.find(i=>i.words===x(t)||y(i.name)===x(t))??o.find(i=>t.split(" ").some(s=>s.length>2&&(i.words.split(" ").includes(s)||i.words.split(" ").includes(x(s)))))}function oe(e,n,r){let t=n.trim().toLowerCase();if(t.length!==0)return e.edges.find(o=>o.words===t||o.name.toLowerCase()===t)??e.edges.find(o=>o.to.some(i=>{let s=r.info(i);return s!==void 0&&(s.noun===x(t)||s.plural===t||y(i)===x(t))}))??e.edges.find(o=>t.split(" ").some(i=>i.length>2&&o.words.split(" ").includes(i)))}function U(e){return/ (?:grouped |group |split |sorted |organi[sz]ed )?by ([\p{L}\p{N}' -]+?)(?= (?:and|with|for|in|on|only|where|from|this|that|as|sorted|grouped) |\s*$)/u.exec(e)?.[1]?.trim()}var me=/\bwho\b.*\b(covers?|cover|tends?|owns?|handles?|does|works? on|looks? after|is on|is assigned|staffs?|runs?)\b|\bcoverage\b|\bmatrix\b|\bwho covers\b/,ge=/\bcalendar\b|\bmonth\b|\bagenda\b|\bschedule\b|\bdue\b|\bdeadlines?\b|\bdates?\b|\bwhen\b/,ye=/\btimeline\b|\bover time\b|\bgantt\b|\bspans?\b|\bweek\b/,he=/\bboard\b|\bkanban\b|\bcolumns?\b|\bpipeline\b|\bstages?\b|\bstatus\b/,be=/\blaid out\b|\blayout\b|\bseating\b|\bwhere (?:they|it|each) (?:sits?|lies?|stands?)\b|\bfloor\b/,we=/\bplan\b|\bmap\b|\bregions?\b/,ke=/\blist\b|\btable\b|\bgroup(?:ed)? by\b|\bsort(?:ed)? by\b|\bonly\b|\bjust the\b/;function $e(e){let n=[];return/\blist\b|\btable\b/.test(e)&&n.push("blocks"),me.test(e)&&n.push("coverage"),be.test(e)&&n.push("board"),(/\bfloor plan\b/.test(e)||we.test(e))&&n.push("plan"),ye.test(e)&&n.push("timeline"),ge.test(e)&&n.push("calendar"),he.test(e)&&n.push("columns"),ke.test(e)&&!n.includes("blocks")&&n.push("blocks"),n.length===0&&U(e)&&n.push("columns"),n}var se=e=>{let n=r=>r?` and not ${r}`:"";if(/\boverdue\b|\blate\b|\bpast due\b/.test(e))return{cond:(r,t)=>`days(today(), ${r}) < 0${n(t)}`,says:r=>`overdue by ${r.words}`};if(/\btoday\b/.test(e))return{range:"day",cond:r=>`days(today(), ${r}) == 0`,says:r=>`with ${r.words} today`};if(/\bthis week\b|\bnext 7 days\b|\bnext week\b/.test(e))return{range:"week",cond:r=>`days(today(), ${r}) >= 0 and days(today(), ${r}) <= 6`,says:r=>`with ${r.words} in the next week`};if(/\bthis month\b|\bnext 30 days\b|\bnext month\b/.test(e))return{range:"month",cond:r=>`days(today(), ${r}) >= 0 and days(today(), ${r}) <= 30`,says:r=>`with ${r.words} in the next month`};if(/\blast month\b|\bpast month\b/.test(e))return{range:"month",cond:r=>`days(today(), ${r}) >= -30 and days(today(), ${r}) <= 0`,says:r=>`with ${r.words} in the last month`};if(/\bthis year\b/.test(e))return{range:"year",cond:r=>`days(today(), ${r}) >= 0 and days(today(), ${r}) <= 365`,says:r=>`with ${r.words} in the next year`};if(/\bquarter\b/.test(e))return{range:"quarter",cond:r=>`days(today(), ${r}) >= 0 and days(today(), ${r}) <= 91`,says:r=>`with ${r.words} in the next quarter`}},M=e=>{if(/\bagenda\b|\bin order\b/.test(e))return"agenda";if(/\btoday\b|\bday\b/.test(e))return"day";if(/\bweek\b/.test(e))return"week";if(/\bquarter\b/.test(e))return"quarter";if(/\byears\b/.test(e))return"years";if(/\byear\b/.test(e))return"year";if(/\bmonth\b/.test(e))return"month"},Z=/^(user|person|people|member|staff|gardener|volunteer|owner|agent|employee|worker|team|player|customer|client|contact|party|attendee|guest)s?$/,j=class extends Error{},h=e=>{throw new j(e)};function Se(e,n){let r=e.fields.filter(i=>i.type==="enum");if(n){let i=v(e,n);if(i&&i.type==="enum")return i;i&&h(`${e.plural}' ${i.words} is not a choice, so it has no columns`)}let t=$(e,e.roles.status??e.roles.column);if(t?.type==="enum")return t;let o=r.find(i=>/^(status|stage|state|phase)$/.test(i.name));return o||(r[0]?r[0]:h(`${e.plural} have no choice field to put in columns`))}function ee(e,n){let r=e.fields.filter(A),t=l=>{let d=$(e,e.roles[l]);return A(d)?d:void 0},i=r.find(l=>E(n,l.words)||E(n,y(l.name)))??t("start")??r.find(l=>/^(due|date|on|at|start|starts|begins|from|sown|when)/i.test(l.name))??r[0];if(!i)return h(`no date field on ${e.plural}`);let s=t("end")??r.find(l=>l!==i&&/^(end|ends|until|to|finish|finished|harvested|due|closes|through)/i.test(l.name)),a=e.fields.find(l=>l.type==="boolean"&&/^(done|finished|complete|completed|closed)$/.test(l.name));return{start:i,...s&&s!==i?{end:s}:{},...a?{done:a}:{}}}function ie(e){let n=$(e,e.roles.start),r=$(e,e.roles.end),t=$(e,e.roles.column??e.roles.day??e.roles.columns);if(N(n)&&N(r)&&t?.type==="enum")return{start:n,end:r,column:t}}function De(e,n,r,t){let o=[];for(let s of e.kinds)for(let a of s.edges)for(let l of a.to){let d=e.info(l);if(!d||d.kind===s.kind)continue;let c=0;n.includes(s)&&(c+=4),n.includes(d)&&(c+=4),(Z.test(d.kind)||Z.test(d.noun))&&(c+=3),t&&(a.words.includes(t)||d.noun===x(t))&&(c+=5),a.words.split(" ").some(u=>u.length>2&&r.includes(` ${u}`))&&(c+=2),o.push({rows:s,across:d,link:a,score:c})}let i=o.sort((s,a)=>a.score-s.score)[0];return i||h(n[0]?`${n[0].plural} are joined to nothing else, so there is no who-covers-what to draw`:"nothing here is joined to anything else, so there is no who-covers-what to draw")}function ae(e,n,r,t,o){let i=U(t);switch(e){case"columns":{if(i){let s=v(n,i);if(!s||s.type!=="enum"){let a=oe(n,i,r);if(a){let l=r.info(a.to[0]);return{lens:"coverage",kind:n.kind,across:l.kind,link:a.name}}}}return{lens:"columns",kind:n.kind,column:Se(n,i).name}}case"calendar":{let s=ee(n,t),a=M(t);return{lens:"calendar",kind:n.kind,start:s.start.name,...s.end?{end:s.end.name}:{},...s.done?{done:s.done.name}:{},...a?{range:a}:{}}}case"timeline":{let s=ie(n);if(s&&!/\bdates?\b|\bdue\b|\bdeadlines?\b|\bmonths?\b|\byears?\b/.test(t))return{lens:"timeline",kind:n.kind,start:s.start.name,end:s.end.name,column:s.column.name};let a=ee(n,t);return{lens:"calendar",kind:n.kind,start:a.start.name,...a.end?{end:a.end.name}:{},...a.done?{done:a.done.name}:{},range:M(t)??"quarter"}}case"coverage":{let s=De(r,o,t,i);return{lens:"coverage",kind:s.rows.kind,across:s.across.kind,link:s.link.name}}case"board":{let s=$(n,n.roles.x)??n.fields.find(c=>c.name==="x"),a=$(n,n.roles.y)??n.fields.find(c=>c.name==="y");if(!N(s)||!N(a))return h(`${n.plural} have no x and y to be laid out by`);let d=r.kinds.flatMap(c=>c.edges.filter(u=>u.to.includes(n.kind)&&c.kind!==n.kind))[0]??n.edges[0];return d?{lens:"board",kind:n.kind,x:s.name,y:a.name,fill:d.name,...d.from!==n.kind?{fillFrom:"occupant"}:{}}:h(`nothing is joined to ${n.plural} to fill them`)}case"plan":{let s=$(n,n.roles.outline)??n.fields.find(a=>a.name==="outline");return s?{lens:"plan",kind:n.kind,outline:s.name}:h(`${n.plural} have no outline to draw a plan from`)}case"blocks":{let s={lens:"blocks",kind:n.kind,as:/\bcards?\b/.test(t)?"card":"row"},a=/ group(?:ed)? by ([\p{L}\p{N} -]+?)(?= (?:and|only|sorted|with)|\s*$)/u.exec(t)?.[1]??(i&&!/ sort(?:ed)? by /.test(t)?i:void 0);if(a){let c=v(n,a);if(!c||c.type!=="enum")return h(c?`${n.plural}' ${c.words} is not a choice, so they cannot be grouped by it`:`${n.plural} have nothing called ${a} to group by`);s.group=c.name}let l=/ sort(?:ed)? by ([\p{L}\p{N} -]+?)(?= (?:and|only|grouped|with)|\s*$)/u.exec(t)?.[1];if(l){let c=v(n,l);if(!c)return h(`${n.plural} have nothing called ${l} to sort by`);s.sort={by:c.name,.../\b(newest|latest|desc|descending|most)\b/.test(t)?{direction:"desc"}:{}}}let d=V(n,t);return d.length>0&&(s.where=d),s}}}function V(e,n){let r=[],t=se(n);if(t){let o=e.fields.filter(A),i=$(e,e.roles.start),s=o.find(l=>E(n,l.words))??(A(i)?i:void 0)??o[0];(!s||!A(s))&&h(`no date field on ${e.plural}`);let a=e.fields.find(l=>l.type==="boolean"&&/^(done|finished|complete|completed|closed)$/.test(l.name));r.push({expr:t.cond(s.name,/\boverdue\b|\blate\b|\bpast due\b/.test(n)?a?.name:void 0),says:t.says(s)})}if(/\bonly\b|\bjust\b|\bthat are\b|\bwhich are\b/.test(n)){for(let o of e.fields){if(o.type!=="enum")continue;let i=o.options?.find(s=>E(n,s.toLowerCase())||E(n,y(s)));i&&r.push({expr:`${o.name} == '${i.replace(/'/g,"")}'`,says:`that are ${y(i)}`})}if(/\bnot done\b|\bundone\b|\bunfinished\b|\bopen ones\b|\bstill to do\b/.test(n)){let o=e.fields.find(i=>i.type==="boolean"&&/^(done|finished|complete|completed)$/.test(i.name));o&&r.push({expr:`not ${o.name}`,says:`not ${o.words}`})}}return r}var B={columns:"A board",calendar:"A calendar",timeline:"A timeline",coverage:"A grid",board:"A layout",plan:"A plan",blocks:"A list",reach:"A picture"};function Re(e,n){let r=n.info(e.kind),t=o=>o?$(r,o)?.words??y(o):"";switch(e.lens){case"columns":return{title:`${k(r.plural)} by ${t(e.column)}`,detail:`of ${r.plural} by ${t(e.column)}`};case"calendar":{let o=e.range??"month";if(o==="agenda")return{title:`${k(r.plural)} in date order`,detail:`of ${r.plural} in order of ${t(e.start)}`};let i=o==="years"?"year":o;return{title:`${k(r.plural)} by ${i}`,detail:`of ${r.plural} by ${t(e.start)}, a ${i} at a time`}}case"timeline":return{title:`${k(r.plural)} over the ${t(e.column)}`,detail:`of ${r.plural} from ${t(e.start)} to ${t(e.end)}, by ${t(e.column)}`};case"coverage":{let o=n.info(e.across);return{title:`${k(r.plural)} by ${o.noun}`,detail:`of which ${o.noun} covers which ${r.noun}`}}case"board":return{title:`${k(r.plural)} where they stand`,detail:`of ${r.plural} where they stand`};case"plan":return{title:`${k(r.plural)} on a plan`,detail:`of ${r.plural}`};default:{let o=[e.where?.map(i=>i.says).join(" and "),e.group?`by ${t(e.group)}`:void 0,e.sort?`in order of ${t(e.sort.by)}`:void 0].filter(i=>!!i);return{title:[k(r.plural),...o].join(" "),detail:[`of ${r.plural}`,...o].join(" ")}}}}function Ae(e,n){let r={title:n,on:e.kind};switch(e.lens){case"columns":return{name:"columns",...r,bindings:{[e.kind]:{column:e.column}}};case"calendar":return{name:"calendar",...r,bindings:{[e.kind]:{start:e.start,...e.end?{end:e.end}:{},...e.done?{done:e.done}:{}}},...e.range?{options:{range:e.range}}:{}};case"timeline":return{name:"timeline",...r,bindings:{[e.kind]:{start:e.start,end:e.end,column:e.column}}};case"coverage":return{name:"coverage",...r,bindings:{rows:{kind:e.kind},columns:{kind:e.across},link:{edge:e.link}}};case"board":return{name:"board",...r,bindings:{slots:{kind:e.kind},x:{field:e.x,on:"slots"},y:{field:e.y,on:"slots"},fill:{edge:e.fill}},...e.fillFrom?{options:{fillFrom:e.fillFrom}}:{}};case"plan":return{name:"plan",...r,bindings:{regions:{kind:e.kind},outline:{field:e.outline,on:"regions"}}};default:{let t=e.where?.length?` where ${e.where.map(i=>e.where.length>1?`(${i.expr})`:i.expr).join(" and ")}`:"",o={list:`all('${e.kind}')${t}`,as:e.as??"row"};return e.group&&(o.group=e.group),e.sort&&(o.sort=e.sort.direction?{by:e.sort.by,direction:e.sort.direction}:e.sort.by),o.empty="Nothing here yet.",{name:"blocks",...r,options:{blocks:[o]}}}}}function C(e,n){let r=o=>o.toLowerCase().replace(/[^\p{L}\p{N}]+/gu,"-").replace(/^-+|-+$/g,""),t=new Set(["home","overview",...Q(n).map(o=>o.slug),...(n.lenses??[]).flatMap(o=>o.title?[r(o.title)]:[])]);if(!t.has(r(e)))return e;for(let o=2;;o++)if(!t.has(r(`${e} ${o}`)))return`${e} ${o}`}var ne={title:[],headline:[],text:["tone"],figure:["as","currency","label"],list:["sort","limit","group","empty","as"],progress:["label"],group:["direction"],when:["show"],divider:[]};function Ee(e,n){if(!Array.isArray(n)||n.length===0)return"it has no blocks to draw";if(n.length>40)return"it has more blocks than a place draws";let r=(s,a)=>{if(typeof s!="string"||s.trim()==="")return`its ${a} says nothing`;try{return _(s)}catch(l){return`its ${a} does not read: ${l instanceof Error?l.message.replace(/ \(at character.*$/,""):String(l)}`}},t=s=>{if(s.t==="where")return t(s.set);if(s.t==="call"&&s.fn==="all"){let a=s.args[0];return a?.t==="lit"&&typeof a.value=="string"?e.info(a.value)??null:void 0}},o=(s,a)=>{switch(s.t){case"lit":return;case"ident":return a&&!a.fields.some(l=>l.name===s.name)&&!a.edges.some(l=>l.name===s.name)?`${a.plural} have nothing called ${s.name}`:void 0;case"member":return o(s.object,a);case"list":return s.items.map(l=>o(l,a)).find(Boolean);case"unary":return o(s.operand,a);case"binary":return o(s.left,a)??o(s.right,a);case"where":{let l=t(s.set);return l===null?"Nothing by that name here":o(s.set,a)??o(s.filter,l??void 0)}case"call":return s.fn==="all"?t(s)===null?"Nothing by that name here":void 0:s.args.map(l=>o(l,a)).find(Boolean)}},i=(s,a)=>{if(a>4)return"its blocks nest deeper than a place draws";for(let l of s){if(!w(l))return"a block is not an object";let d=Object.keys(ne).find(p=>p in l);if(!d)return`"${Object.keys(l)[0]??""}" is not a block a place draws`;let c=Object.keys(l).find(p=>p!==d&&p!=="key"&&!ne[d].includes(p));if(c)return`a ${d} block takes no "${c}"`;let u=l[d];if(d==="list"||d==="figure"||d==="when"){if(d==="figure"&&u===!0)continue;let p=r(u,d);if(typeof p=="string")return p;let g=o(p,void 0);if(g)return g;if(d==="list"){let f=t(p);if(f==null)return f===null?"Nothing by that name here":"its list does not say which records it lists, like all('task')";for(let m of["group","sort"]){let b=l[m],S=typeof b=="string"?b:w(b)&&typeof b.by=="string"?b.by:void 0;if(b===void 0)continue;let D=S?f.fields.find(ce=>ce.name===S):void 0;if(!D)return`${f.plural} have nothing called ${String(S??b)} to ${m} by`;if(m==="group"&&D.type!=="enum")return`${f.plural}' ${D.words} is not a choice, so they cannot be grouped by it`}}if(d==="when"){let f=l.show;if(!Array.isArray(f))return"a when block shows a list of blocks";let m=i(f,a+1);if(m)return m}}else if(d==="group"){if(!Array.isArray(u))return"a group block holds a list of blocks";let p=i(u,a+1);if(p)return p}else{if(d!=="divider"&&typeof u!="string")return`a ${d} block says words`;if(typeof u=="string")for(let p of u.matchAll(/\{([^{}]*)\}/g)){let g=p[1].split(/\|(?![|])/)[0],f=r(g,`${d}'s braces`);if(typeof f=="string")return f;let m=o(f,void 0);if(m)return m}}}};return i(n,1)}function T(e,n,r){let t=L(e.schema,r),o=f=>({ok:!1,failed:`Couldn't draw that: ${f.replace(/\.$/,"")}.`});if(!P(n.name)||n.name==="reach")return o(`"${String(n.name)}" is not a picture the seat can draw; it draws ${H.filter(f=>f!=="reach").join(", ")}`);if(typeof n.title!="string"||n.title.trim().length===0||n.title.length>80)return o("it needs a title of a few words");if(typeof n.on!="string"||!t.tryDefinition(n.on))return o("Nothing by that name here");let i=G[n.name],s=n.bindings??{};if(i.binds==="fields")for(let[f,m]of Object.entries(s)){if(!t.tryDefinition(f))return o("Nothing by that name here");let b=Object.keys(t.tryDefinition(f).fields?.shape??{});for(let[S,D]of Object.entries(m??{}))if(typeof D!="string"||!b.includes(D))return o(`${y(f)} has no field "${String(D)}" for its ${S}`);for(let S of i.requiredRoles)if(!(S in(m??{})))return o(`a ${n.name} needs ${y(f)}'s ${S}`)}else if(i.binds==="entities")for(let f of i.requiredRoles){let m=s[f];if(!m)return o(`a ${n.name} needs its ${f}`);if(typeof m.kind=="string"&&!t.tryDefinition(m.kind))return o("Nothing by that name here")}let a={...e,schema:t,lenses:[...e.lenses??[],n]},l=a.lenses.length-1,d=J(a),c=`lenses.${l}`,u=d.findings.find(f=>f.path===c||f.path.startsWith(`${c}.`));if(u)return o(u.message.replace(/^"[^"]*" /,"it "));let p=d.undrawn.find(f=>f.index===l);if(p)return o(p.why);let g=d.drawn.find(f=>f.index===l);if(!g)return o("its bindings name something the app does not have");if(g.as==="overview")return o(`"${n.title}" is the scene's own address; give it another title`);if(n.name==="blocks"){let f=Ee(I(t),n.options?.blocks);if(f)return o(f)}return{ok:!0,drawn:g}}function K(e){return{op:"add-lens",title:e.title,lens:e.name,on:e.on,...e.bindings?{bindings:e.bindings}:{},...e.options?{options:e.options}:{}}}function xe(e){return{op:"remove-lens",title:e.title,on:e.on}}var w=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function de(e){let n=w(e)?e:{},r=String(n.lens??n.name??""),t=n.bindings,o=typeof n.on=="string"?n.on:w(t)&&G[r]?.binds==="fields"?Object.keys(t)[0]??"":"";return{name:r,title:typeof n.title=="string"?n.title.trim():"",on:o,...w(t)?{bindings:t}:{},...w(n.options)?{options:n.options}:{}}}function ve(e){let n=o=>w(e.bindings?.[o])?e.bindings[o]:{},r=o=>typeof o=="string"?o:void 0,t=n(e.on);switch(e.name){case"columns":return r(t.column)?{lens:"columns",kind:e.on,column:t.column}:void 0;case"calendar":{let o=r(e.options?.range);return r(t.start)?{lens:"calendar",kind:e.on,start:t.start,...r(t.end)?{end:t.end}:{},...r(t.done)?{done:t.done}:{},...o?{range:o}:{}}:void 0}case"timeline":return r(t.start)&&r(t.end)&&r(t.column)?{lens:"timeline",kind:e.on,start:t.start,end:t.end,column:t.column}:void 0;case"coverage":{let o=w(e.bindings?.columns)?r(e.bindings.columns.kind):void 0,i=w(e.bindings?.link)?r(e.bindings.link.edge):void 0;return o&&i?{lens:"coverage",kind:e.on,across:o,link:i}:void 0}case"blocks":{let o=e.options?.blocks;if(!Array.isArray(o)||o.length!==1||!w(o[0]))return;let i=o[0],s=new RegExp(`^all\\('${e.on}'\\)(?: where (.+))?$`).exec(String(i.list??""));if(!s)return;let a=i.sort;return{lens:"blocks",kind:e.on,as:i.as==="card"?"card":"row",...typeof i.group=="string"?{group:i.group}:{},...typeof a=="string"?{sort:{by:a}}:w(a)&&typeof a.by=="string"?{sort:{by:a.by,...a.direction==="desc"?{direction:"desc"}:{}}}:{},...s[1]?{where:[{expr:s[1],says:"as asked"}]}:{}}}default:return}}function W(e,n,r,t,o){let i=I(L(e.schema,t)).info(n.on),s=ve(n);return{title:n.title,said:`${B[n.name]??"A picture"} of ${i?.plural??y(n.on)}.`,kind:n.on,lens:n,drawn:r,edit:K(n),by:o,asks:[],...s?{recipe:s}:{}}}function te(e){return{title:e.title,said:e.said,lens:{title:e.lens.title,lens:e.lens.name,on:e.lens.on,...e.lens.bindings?{bindings:e.lens.bindings}:{},...e.lens.options?{options:e.lens.options}:{}},edit:e.edit,by:e.by,check:"It draws, and graview check would take it."}}function F(e,n,r,t,o){let i=Re(e,n),s=e.title??o??C(i.title,r.app),a=Ae(e,s),l=T(r.app,a,r.sight);return l.ok?{title:s,said:`${B[e.lens]} ${i.detail}.`,kind:e.kind,lens:a,drawn:l.drawn,edit:K(a),by:"template",asks:t,recipe:e}:{failed:l.failed,...r.lastGood?{lastGood:r.lastGood}:{}}}function Ye(e,n){let r=I(L(n.app.schema,n.sight)),t=r.info(e.kind);if(!t)return{failed:"Couldn't draw that: Nothing by that name here."};let o=e.lens==="blocks"&&!e.group&&!e.sort&&!e.where?.length&&e.title===void 0;return F(o?{...e,title:C(`Every ${t.noun}`,n.app)}:e,r,n,[])}function Le(e,n,r,t){if(r.length>0)return r;let o=s=>{switch(e){case"columns":return s.fields.some(a=>a.type==="enum");case"calendar":return s.fields.some(A);case"timeline":return ie(s)!==void 0||s.fields.some(A);case"coverage":return s.edges.some(a=>a.to.some(l=>l!==s.kind));case"board":return s.fields.some(a=>a.name==="x")&&s.fields.some(a=>a.name==="y");case"plan":return s.fields.some(a=>a.name==="outline")||s.roles.outline!==void 0;default:return!0}};return[...n.kinds.filter(o)].sort((s,a)=>Number(a.fields.some(l=>E(t,l.words)))-Number(s.fields.some(l=>E(t,l.words))))}function Ie(e,n){let r=I(L(n.app.schema,n.sight)),t=re(e),o=$e(t);if(o.length===0)return;let i=pe(t,r),s;for(let a of o){let l=a==="coverage"?[i[0]??r.kinds[0]].filter(d=>!!d):Le(a,r,i,t);for(let d of l)try{let c=ae(a,d,r,t,i),u=F(c,r,n,[e]);if(!O(u))return u;s??=u.failed}catch(c){if(!(c instanceof j))throw c;s??=`Couldn't draw that: ${c.message}.`}l.length===0&&i.length===0&&(s??=`Couldn't draw that: nothing here has what ${B[a].toLowerCase()} needs.`)}return{failed:s??"Couldn't draw that: Nothing by that name here.",...n.lastGood?{lastGood:n.lastGood}:{}}}async function Oe(e,n){let r=n.lastGood?{lastGood:n.lastGood}:{};if(e.trim().length===0)return{failed:"Say what you would like to see, like \u201Ca board of tasks by status\u201D.",...r};let t=Ie(e,n);if(t&&!O(t))return t;if(!n.complete)return t??{failed:"Couldn't draw that: drawing freely needs AI, which isn't on here. Ask for a board, a calendar, a timeline, a list or who covers what.",...r};let o=await le(e,n,void 0);return O(o)&&t?t:o}async function je(e,n,r){let t={lastGood:e},o={...r,lastGood:e},i=I(L(r.app.schema,r.sight)),s=re(n),a=i.info(e.kind),l=[...e.asks,n];if(!a)return{failed:"Couldn't change that: Nothing by that name here.",...t};let d=e.recipe,c=/^ (?:call|name|title) (?:it|this)? ?(.+?) $/.exec(s)??/ (?:call|name) it (.+?) $/.exec(s);try{if(c){let g=n.replace(/^.*?\b(?:call|name|title)\b\s*(?:it|this)?\s*/i,"").replace(/^["“']|["”']$/g,"").trim();if(g.length===0)return{failed:"Couldn't change that: say what to call it.",...t};let f={...e.lens,title:C(g,r.app)},m=T(r.app,f,r.sight);return m.ok?{...e,title:f.title,lens:f,drawn:m.drawn,edit:K(f),asks:l,...d?{recipe:{...d,title:f.title}}:{}}:{failed:m.failed,...t}}let p=/ as (?:a |an )?(board|kanban|calendar|timeline|list|table|cards|rows|grid|plan|layout)\b/.exec(s);if(p){let g=p[1]==="board"||p[1]==="kanban"?"columns":p[1]==="calendar"?"calendar":p[1]==="timeline"?"timeline":p[1]==="grid"?"coverage":p[1]==="plan"?"plan":p[1]==="layout"?"board":"blocks",f=ae(g,a,i,s,[a]),m=p[1]==="cards"?"card":p[1]==="rows"?"row":void 0,b=g==="blocks"&&d?.lens==="blocks"?{...d,...m?{as:m}:{}}:g==="blocks"&&d?.lens==="columns"?{...f,group:d.column,...m?{as:m}:{}}:f;return F(R(b),i,o,l)}if(d){let g=Te(d,a,i,s);if(g)return F(g,i,o,l)}}catch(p){if(!(p instanceof j))throw p;return{failed:`Couldn't change that: ${p.message}.`,...t}}if(!r.complete)return{failed:"Couldn't change that: changing it freely needs AI, which isn't on here. Try \u201Cgroup by status\u201D, \u201Conly this month\u201D or \u201Cas a calendar\u201D.",...t};let u=await le(n,o,e);return O(u)?u:{...u,asks:l}}var R=e=>{let{title:n,...r}=e;return r};function Te(e,n,r,t){let o=/ (?:group(?:ed)?|split|organi[sz]ed?|put them|columns) by ([\p{L}\p{N} -]+?)(?= (?:and|only|with)|\s*$)/u.exec(t)?.[1]??(/^ by /.test(t)?U(t):void 0);if(o){let d=v(n,o);if(d?.type==="enum")return e.lens==="blocks"?{...R(e),group:d.name}:{lens:"columns",kind:e.kind,column:d.name};let c=oe(n,o,r);return c?{lens:"coverage",kind:e.kind,across:c.to[0],link:c.name}:h(d?`${n.plural}' ${d.words} is not a choice, so they cannot be grouped by it`:`${n.plural} have nothing called ${o} to group by`)}let i=/ (?:sort(?:ed)?|order(?:ed)?) by ([\p{L}\p{N} -]+?)(?= (?:and|only|with)|\s*$)/u.exec(t)?.[1];if(i){let d=v(n,i);return d?{...e.lens==="blocks"?R(e):{lens:"blocks",kind:e.kind,as:"row",...e.lens==="columns"?{group:e.column}:{}},sort:{by:d.name,.../\b(newest|latest|desc|descending|most)\b/.test(t)?{direction:"desc"}:{}}}:h(`${n.plural} have nothing called ${i} to sort by`)}if(/\b(?:all of them|everything|show all|clear the filter|no filter|without the filter)\b/.test(t)){if(e.lens!=="blocks"||!e.where)return h("it already shows all of them");let{where:d,...c}=R(e);return c}let s=se(t);if(s&&e.lens==="calendar"&&s.range)return{...R(e),range:s.range};if(s&&e.lens==="calendar"&&!s.range)return{lens:"blocks",kind:e.kind,as:"row",sort:{by:e.start},where:V(n,t)};let a=V(n,t);if(a.length>0){let d=e.lens==="blocks"?R(e):{lens:"blocks",kind:e.kind,as:"row",...e.lens==="columns"?{group:e.column}:{}};return{...d,where:[...d.where??[],...a]}}let l=e.lens==="calendar"?M(t):void 0;if(l)return{...R(e),range:l}}function Ne(e){return e.kinds.map(n=>{let r=n.fields.map(i=>`${i.name} (${i.type??"value"}${i.options?`: ${i.options.join(" | ")}`:""})`).join(", "),t=n.edges.map(i=>`${i.name} \u2192 ${i.to.join(" | ")}`).join(", "),o=Object.entries(n.roles).map(([i,s])=>`${i}=${s}`).join(", ");return`- ${n.kind} ("${n.plural}"): ${r}${t?`; relations: ${t}`:""}${o?`; roles: ${o}`:""}`}).join(`
|
|
1
|
+
import{a as k}from"./chunk.G4JJXA63.js";import{a as Q}from"./chunk.FOQ27RAR.js";import{a as Y}from"./chunk.WAB7UDHU.js";import{a as X}from"./chunk.UHX4WTM7.js";import{c as _}from"./chunk.TBQOSI4J.js";import{cd as G,ed as H,fd as P,gd as J,kb as q,lb as z}from"./chunk.AS4CQBOQ.js";var O=e=>"failed"in e;function ue(e,n){let r=e.schema.kinds,t=e.policy?.sees;if(!t?.length||z(n))return{kinds:r};let o=q(n).roles??[],i=new Set(t.filter(s=>s.roles==="*"||o.some(a=>s.roles.includes(a))).flatMap(s=>s.kinds));return{kinds:r.filter(s=>i.has(s))}}function L(e,n){if(!n)return e;let r=new Set(n.kinds.filter(i=>e.tryDefinition(i)!==void 0));if(r.size===e.kinds.length)return e;let t=new Map,o=i=>{if(r.has(i)){if(!t.has(i)){let s=e.tryDefinition(i),a=Object.fromEntries(Object.entries(s?.edges??{}).flatMap(([l,d])=>{if(d.to==="*")return[[l,d]];let c=d.to.filter(u=>r.has(u));return c.length>0?[[l,{...d,to:c}]]:[]}));t.set(i,{...s,edges:a})}return t.get(i)}};return{...e,definitions:e.definitions.filter(i=>r.has(i.kind)),kinds:e.kinds.filter(i=>r.has(i)),tryDefinition:o,definition:i=>{let s=o(i);if(!s)throw new Error(`Unknown node kind "${i}"`);return s}}}var fe=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),y=e=>fe(e).replace(/[-_]+/g," ").trim();function I(e){let n=[];for(let t of e.kinds){let o=e.tryDefinition(t);if(!o)continue;let i=o.display?.labels??{},s=Object.entries(o.fields?.shape??{}).filter(([d])=>d!=="id"&&d!=="kind").map(([d,c])=>{let u=X(c);return{name:d,type:u?.type,...u?.options?{options:u.options}:{},words:(i[d]??y(d)).toLowerCase()}}),a=Object.entries(o.edges??{}).map(([d,c])=>({name:d,from:t,to:c.to==="*"?e.kinds.filter(u=>u!==t):c.to,words:y(d)})),l=(o.plural??`${y(t)}s`).toLowerCase();n.push({kind:t,plural:l,noun:(o.noun??y(t)).toLowerCase(),fields:s,roles:o.fieldRoles??{},edges:a})}let r=new Map(n.map(t=>[t.kind,t]));return{schema:e,kinds:n,info:t=>r.get(t)}}var $=(e,n)=>n===void 0?void 0:e.fields.find(r=>r.name===n),A=e=>e?.type==="date"||e?.type==="datetime",N=e=>e?.type==="number"||e?.type==="integer"||e?.type==="duration",re=e=>` ${e.toLowerCase().replace(/[“”"’‘]/g,"'").replace(/[^\p{L}\p{N}' -]+/gu," ").replace(/\s+/g," ").trim()} `,E=(e,n)=>e.includes(` ${n} `),x=e=>e.endsWith("ies")?`${e.slice(0,-3)}y`:e.endsWith("ses")?e.slice(0,-2):e.endsWith("s")?e.slice(0,-1):e;function pe(e,n){let r=[];for(let t of n.kinds){let o=new Set([t.plural,t.noun,`${t.noun}s`,y(t.kind),`${y(t.kind)}s`]),i=-1;for(let s of o){let a=e.indexOf(` ${s} `);a>=0&&(i<0||a<i)&&(i=a)}i>=0&&r.push({info:t,at:i})}return r.sort((t,o)=>t.at-o.at).map(t=>t.info)}function v(e,n,r){let t=n.trim().toLowerCase();if(t.length===0)return;let o=e.fields.filter(i=>!r||r(i));return o.find(i=>i.words===t||y(i.name)===t||i.name.toLowerCase()===t)??o.find(i=>i.words===x(t)||y(i.name)===x(t))??o.find(i=>t.split(" ").some(s=>s.length>2&&(i.words.split(" ").includes(s)||i.words.split(" ").includes(x(s)))))}function oe(e,n,r){let t=n.trim().toLowerCase();if(t.length!==0)return e.edges.find(o=>o.words===t||o.name.toLowerCase()===t)??e.edges.find(o=>o.to.some(i=>{let s=r.info(i);return s!==void 0&&(s.noun===x(t)||s.plural===t||y(i)===x(t))}))??e.edges.find(o=>t.split(" ").some(i=>i.length>2&&o.words.split(" ").includes(i)))}function U(e){return/ (?:grouped |group |split |sorted |organi[sz]ed )?by ([\p{L}\p{N}' -]+?)(?= (?:and|with|for|in|on|only|where|from|this|that|as|sorted|grouped) |\s*$)/u.exec(e)?.[1]?.trim()}var me=/\bwho\b.*\b(covers?|cover|tends?|owns?|handles?|does|works? on|looks? after|is on|is assigned|staffs?|runs?)\b|\bcoverage\b|\bmatrix\b|\bwho covers\b/,ge=/\bcalendar\b|\bmonth\b|\bagenda\b|\bschedule\b|\bdue\b|\bdeadlines?\b|\bdates?\b|\bwhen\b/,ye=/\btimeline\b|\bover time\b|\bgantt\b|\bspans?\b|\bweek\b/,he=/\bboard\b|\bkanban\b|\bcolumns?\b|\bpipeline\b|\bstages?\b|\bstatus\b/,be=/\blaid out\b|\blayout\b|\bseating\b|\bwhere (?:they|it|each) (?:sits?|lies?|stands?)\b|\bfloor\b/,we=/\bplan\b|\bmap\b|\bregions?\b/,ke=/\blist\b|\btable\b|\bgroup(?:ed)? by\b|\bsort(?:ed)? by\b|\bonly\b|\bjust the\b/;function $e(e){let n=[];return/\blist\b|\btable\b/.test(e)&&n.push("blocks"),me.test(e)&&n.push("coverage"),be.test(e)&&n.push("board"),(/\bfloor plan\b/.test(e)||we.test(e))&&n.push("plan"),ye.test(e)&&n.push("timeline"),ge.test(e)&&n.push("calendar"),he.test(e)&&n.push("columns"),ke.test(e)&&!n.includes("blocks")&&n.push("blocks"),n.length===0&&U(e)&&n.push("columns"),n}var se=e=>{let n=r=>r?` and not ${r}`:"";if(/\boverdue\b|\blate\b|\bpast due\b/.test(e))return{cond:(r,t)=>`days(today(), ${r}) < 0${n(t)}`,says:r=>`overdue by ${r.words}`};if(/\btoday\b/.test(e))return{range:"day",cond:r=>`days(today(), ${r}) == 0`,says:r=>`with ${r.words} today`};if(/\bthis week\b|\bnext 7 days\b|\bnext week\b/.test(e))return{range:"week",cond:r=>`days(today(), ${r}) >= 0 and days(today(), ${r}) <= 6`,says:r=>`with ${r.words} in the next week`};if(/\bthis month\b|\bnext 30 days\b|\bnext month\b/.test(e))return{range:"month",cond:r=>`days(today(), ${r}) >= 0 and days(today(), ${r}) <= 30`,says:r=>`with ${r.words} in the next month`};if(/\blast month\b|\bpast month\b/.test(e))return{range:"month",cond:r=>`days(today(), ${r}) >= -30 and days(today(), ${r}) <= 0`,says:r=>`with ${r.words} in the last month`};if(/\bthis year\b/.test(e))return{range:"year",cond:r=>`days(today(), ${r}) >= 0 and days(today(), ${r}) <= 365`,says:r=>`with ${r.words} in the next year`};if(/\bquarter\b/.test(e))return{range:"quarter",cond:r=>`days(today(), ${r}) >= 0 and days(today(), ${r}) <= 91`,says:r=>`with ${r.words} in the next quarter`}},M=e=>{if(/\bagenda\b|\bin order\b/.test(e))return"agenda";if(/\btoday\b|\bday\b/.test(e))return"day";if(/\bweek\b/.test(e))return"week";if(/\bquarter\b/.test(e))return"quarter";if(/\byears\b/.test(e))return"years";if(/\byear\b/.test(e))return"year";if(/\bmonth\b/.test(e))return"month"},Z=/^(user|person|people|member|staff|gardener|volunteer|owner|agent|employee|worker|team|player|customer|client|contact|party|attendee|guest)s?$/,j=class extends Error{},h=e=>{throw new j(e)};function Se(e,n){let r=e.fields.filter(i=>i.type==="enum");if(n){let i=v(e,n);if(i&&i.type==="enum")return i;i&&h(`${e.plural}' ${i.words} is not a choice, so it has no columns`)}let t=$(e,e.roles.status??e.roles.column);if(t?.type==="enum")return t;let o=r.find(i=>/^(status|stage|state|phase)$/.test(i.name));return o||(r[0]?r[0]:h(`${e.plural} have no choice field to put in columns`))}function ee(e,n){let r=e.fields.filter(A),t=l=>{let d=$(e,e.roles[l]);return A(d)?d:void 0},i=r.find(l=>E(n,l.words)||E(n,y(l.name)))??t("start")??r.find(l=>/^(due|date|on|at|start|starts|begins|from|sown|when)/i.test(l.name))??r[0];if(!i)return h(`no date field on ${e.plural}`);let s=t("end")??r.find(l=>l!==i&&/^(end|ends|until|to|finish|finished|harvested|due|closes|through)/i.test(l.name)),a=e.fields.find(l=>l.type==="boolean"&&/^(done|finished|complete|completed|closed)$/.test(l.name));return{start:i,...s&&s!==i?{end:s}:{},...a?{done:a}:{}}}function ie(e){let n=$(e,e.roles.start),r=$(e,e.roles.end),t=$(e,e.roles.column??e.roles.day??e.roles.columns);if(N(n)&&N(r)&&t?.type==="enum")return{start:n,end:r,column:t}}function De(e,n,r,t){let o=[];for(let s of e.kinds)for(let a of s.edges)for(let l of a.to){let d=e.info(l);if(!d||d.kind===s.kind)continue;let c=0;n.includes(s)&&(c+=4),n.includes(d)&&(c+=4),(Z.test(d.kind)||Z.test(d.noun))&&(c+=3),t&&(a.words.includes(t)||d.noun===x(t))&&(c+=5),a.words.split(" ").some(u=>u.length>2&&r.includes(` ${u}`))&&(c+=2),o.push({rows:s,across:d,link:a,score:c})}let i=o.sort((s,a)=>a.score-s.score)[0];return i||h(n[0]?`${n[0].plural} are joined to nothing else, so there is no who-covers-what to draw`:"nothing here is joined to anything else, so there is no who-covers-what to draw")}function ae(e,n,r,t,o){let i=U(t);switch(e){case"columns":{if(i){let s=v(n,i);if(!s||s.type!=="enum"){let a=oe(n,i,r);if(a){let l=r.info(a.to[0]);return{lens:"coverage",kind:n.kind,across:l.kind,link:a.name}}}}return{lens:"columns",kind:n.kind,column:Se(n,i).name}}case"calendar":{let s=ee(n,t),a=M(t);return{lens:"calendar",kind:n.kind,start:s.start.name,...s.end?{end:s.end.name}:{},...s.done?{done:s.done.name}:{},...a?{range:a}:{}}}case"timeline":{let s=ie(n);if(s&&!/\bdates?\b|\bdue\b|\bdeadlines?\b|\bmonths?\b|\byears?\b/.test(t))return{lens:"timeline",kind:n.kind,start:s.start.name,end:s.end.name,column:s.column.name};let a=ee(n,t);return{lens:"calendar",kind:n.kind,start:a.start.name,...a.end?{end:a.end.name}:{},...a.done?{done:a.done.name}:{},range:M(t)??"quarter"}}case"coverage":{let s=De(r,o,t,i);return{lens:"coverage",kind:s.rows.kind,across:s.across.kind,link:s.link.name}}case"board":{let s=$(n,n.roles.x)??n.fields.find(c=>c.name==="x"),a=$(n,n.roles.y)??n.fields.find(c=>c.name==="y");if(!N(s)||!N(a))return h(`${n.plural} have no x and y to be laid out by`);let d=r.kinds.flatMap(c=>c.edges.filter(u=>u.to.includes(n.kind)&&c.kind!==n.kind))[0]??n.edges[0];return d?{lens:"board",kind:n.kind,x:s.name,y:a.name,fill:d.name,...d.from!==n.kind?{fillFrom:"occupant"}:{}}:h(`nothing is joined to ${n.plural} to fill them`)}case"plan":{let s=$(n,n.roles.outline)??n.fields.find(a=>a.name==="outline");return s?{lens:"plan",kind:n.kind,outline:s.name}:h(`${n.plural} have no outline to draw a plan from`)}case"blocks":{let s={lens:"blocks",kind:n.kind,as:/\bcards?\b/.test(t)?"card":"row"},a=/ group(?:ed)? by ([\p{L}\p{N} -]+?)(?= (?:and|only|sorted|with)|\s*$)/u.exec(t)?.[1]??(i&&!/ sort(?:ed)? by /.test(t)?i:void 0);if(a){let c=v(n,a);if(!c||c.type!=="enum")return h(c?`${n.plural}' ${c.words} is not a choice, so they cannot be grouped by it`:`${n.plural} have nothing called ${a} to group by`);s.group=c.name}let l=/ sort(?:ed)? by ([\p{L}\p{N} -]+?)(?= (?:and|only|grouped|with)|\s*$)/u.exec(t)?.[1];if(l){let c=v(n,l);if(!c)return h(`${n.plural} have nothing called ${l} to sort by`);s.sort={by:c.name,.../\b(newest|latest|desc|descending|most)\b/.test(t)?{direction:"desc"}:{}}}let d=V(n,t);return d.length>0&&(s.where=d),s}}}function V(e,n){let r=[],t=se(n);if(t){let o=e.fields.filter(A),i=$(e,e.roles.start),s=o.find(l=>E(n,l.words))??(A(i)?i:void 0)??o[0];(!s||!A(s))&&h(`no date field on ${e.plural}`);let a=e.fields.find(l=>l.type==="boolean"&&/^(done|finished|complete|completed|closed)$/.test(l.name));r.push({expr:t.cond(s.name,/\boverdue\b|\blate\b|\bpast due\b/.test(n)?a?.name:void 0),says:t.says(s)})}if(/\bonly\b|\bjust\b|\bthat are\b|\bwhich are\b/.test(n)){for(let o of e.fields){if(o.type!=="enum")continue;let i=o.options?.find(s=>E(n,s.toLowerCase())||E(n,y(s)));i&&r.push({expr:`${o.name} == '${i.replace(/'/g,"")}'`,says:`that are ${y(i)}`})}if(/\bnot done\b|\bundone\b|\bunfinished\b|\bopen ones\b|\bstill to do\b/.test(n)){let o=e.fields.find(i=>i.type==="boolean"&&/^(done|finished|complete|completed)$/.test(i.name));o&&r.push({expr:`not ${o.name}`,says:`not ${o.words}`})}}return r}var B={columns:"A board",calendar:"A calendar",timeline:"A timeline",coverage:"A grid",board:"A layout",plan:"A plan",blocks:"A list",reach:"A picture"};function Re(e,n){let r=n.info(e.kind),t=o=>o?$(r,o)?.words??y(o):"";switch(e.lens){case"columns":return{title:`${k(r.plural)} by ${t(e.column)}`,detail:`of ${r.plural} by ${t(e.column)}`};case"calendar":{let o=e.range??"month";if(o==="agenda")return{title:`${k(r.plural)} in date order`,detail:`of ${r.plural} in order of ${t(e.start)}`};let i=o==="years"?"year":o;return{title:`${k(r.plural)} by ${i}`,detail:`of ${r.plural} by ${t(e.start)}, a ${i} at a time`}}case"timeline":return{title:`${k(r.plural)} over the ${t(e.column)}`,detail:`of ${r.plural} from ${t(e.start)} to ${t(e.end)}, by ${t(e.column)}`};case"coverage":{let o=n.info(e.across);return{title:`${k(r.plural)} by ${o.noun}`,detail:`of which ${o.noun} covers which ${r.noun}`}}case"board":return{title:`${k(r.plural)} where they stand`,detail:`of ${r.plural} where they stand`};case"plan":return{title:`${k(r.plural)} on a plan`,detail:`of ${r.plural}`};default:{let o=[e.where?.map(i=>i.says).join(" and "),e.group?`by ${t(e.group)}`:void 0,e.sort?`in order of ${t(e.sort.by)}`:void 0].filter(i=>!!i);return{title:[k(r.plural),...o].join(" "),detail:[`of ${r.plural}`,...o].join(" ")}}}}function Ae(e,n){let r={title:n,on:e.kind};switch(e.lens){case"columns":return{name:"columns",...r,bindings:{[e.kind]:{column:e.column}}};case"calendar":return{name:"calendar",...r,bindings:{[e.kind]:{start:e.start,...e.end?{end:e.end}:{},...e.done?{done:e.done}:{}}},...e.range?{options:{range:e.range}}:{}};case"timeline":return{name:"timeline",...r,bindings:{[e.kind]:{start:e.start,end:e.end,column:e.column}}};case"coverage":return{name:"coverage",...r,bindings:{rows:{kind:e.kind},columns:{kind:e.across},link:{edge:e.link}}};case"board":return{name:"board",...r,bindings:{slots:{kind:e.kind},x:{field:e.x,on:"slots"},y:{field:e.y,on:"slots"},fill:{edge:e.fill}},...e.fillFrom?{options:{fillFrom:e.fillFrom}}:{}};case"plan":return{name:"plan",...r,bindings:{regions:{kind:e.kind},outline:{field:e.outline,on:"regions"}}};default:{let t=e.where?.length?` where ${e.where.map(i=>e.where.length>1?`(${i.expr})`:i.expr).join(" and ")}`:"",o={list:`all('${e.kind}')${t}`,as:e.as??"row"};return e.group&&(o.group=e.group),e.sort&&(o.sort=e.sort.direction?{by:e.sort.by,direction:e.sort.direction}:e.sort.by),o.empty="Nothing here yet.",{name:"blocks",...r,options:{blocks:[o]}}}}}function C(e,n){let r=o=>o.toLowerCase().replace(/[^\p{L}\p{N}]+/gu,"-").replace(/^-+|-+$/g,""),t=new Set(["home","overview",...Q(n).map(o=>o.slug),...(n.lenses??[]).flatMap(o=>o.title?[r(o.title)]:[])]);if(!t.has(r(e)))return e;for(let o=2;;o++)if(!t.has(r(`${e} ${o}`)))return`${e} ${o}`}var ne={title:[],headline:[],text:["tone"],figure:["as","currency","label"],list:["sort","limit","group","empty","as"],progress:["label"],group:["direction"],when:["show"],divider:[]};function Ee(e,n){if(!Array.isArray(n)||n.length===0)return"it has no blocks to draw";if(n.length>40)return"it has more blocks than a place draws";let r=(s,a)=>{if(typeof s!="string"||s.trim()==="")return`its ${a} says nothing`;try{return _(s)}catch(l){return`its ${a} does not read: ${l instanceof Error?l.message.replace(/ \(at character.*$/,""):String(l)}`}},t=s=>{if(s.t==="where")return t(s.set);if(s.t==="call"&&s.fn==="all"){let a=s.args[0];return a?.t==="lit"&&typeof a.value=="string"?e.info(a.value)??null:void 0}},o=(s,a)=>{switch(s.t){case"lit":return;case"ident":return a&&!a.fields.some(l=>l.name===s.name)&&!a.edges.some(l=>l.name===s.name)?`${a.plural} have nothing called ${s.name}`:void 0;case"member":return o(s.object,a);case"list":return s.items.map(l=>o(l,a)).find(Boolean);case"unary":return o(s.operand,a);case"binary":return o(s.left,a)??o(s.right,a);case"where":{let l=t(s.set);return l===null?"Nothing by that name here":o(s.set,a)??o(s.filter,l??void 0)}case"call":return s.fn==="all"?t(s)===null?"Nothing by that name here":void 0:s.args.map(l=>o(l,a)).find(Boolean)}},i=(s,a)=>{if(a>4)return"its blocks nest deeper than a place draws";for(let l of s){if(!w(l))return"a block is not an object";let d=Object.keys(ne).find(p=>p in l);if(!d)return`"${Object.keys(l)[0]??""}" is not a block a place draws`;let c=Object.keys(l).find(p=>p!==d&&p!=="key"&&!ne[d].includes(p));if(c)return`a ${d} block takes no "${c}"`;let u=l[d];if(d==="list"||d==="figure"||d==="when"){if(d==="figure"&&u===!0)continue;let p=r(u,d);if(typeof p=="string")return p;let g=o(p,void 0);if(g)return g;if(d==="list"){let f=t(p);if(f==null)return f===null?"Nothing by that name here":"its list does not say which records it lists, like all('task')";for(let m of["group","sort"]){let b=l[m],S=typeof b=="string"?b:w(b)&&typeof b.by=="string"?b.by:void 0;if(b===void 0)continue;let D=S?f.fields.find(ce=>ce.name===S):void 0;if(!D)return`${f.plural} have nothing called ${String(S??b)} to ${m} by`;if(m==="group"&&D.type!=="enum")return`${f.plural}' ${D.words} is not a choice, so they cannot be grouped by it`}}if(d==="when"){let f=l.show;if(!Array.isArray(f))return"a when block shows a list of blocks";let m=i(f,a+1);if(m)return m}}else if(d==="group"){if(!Array.isArray(u))return"a group block holds a list of blocks";let p=i(u,a+1);if(p)return p}else{if(d!=="divider"&&typeof u!="string")return`a ${d} block says words`;if(typeof u=="string")for(let p of u.matchAll(/\{([^{}]*)\}/g)){let g=p[1].split(/\|(?![|])/)[0],f=r(g,`${d}'s braces`);if(typeof f=="string")return f;let m=o(f,void 0);if(m)return m}}}};return i(n,1)}function T(e,n,r){let t=L(e.schema,r),o=f=>({ok:!1,failed:`Couldn't draw that: ${f.replace(/\.$/,"")}.`});if(!P(n.name)||n.name==="reach")return o(`"${String(n.name)}" is not a picture the seat can draw; it draws ${H.filter(f=>f!=="reach").join(", ")}`);if(typeof n.title!="string"||n.title.trim().length===0||n.title.length>80)return o("it needs a title of a few words");if(typeof n.on!="string"||!t.tryDefinition(n.on))return o("Nothing by that name here");let i=G[n.name],s=n.bindings??{};if(i.binds==="fields")for(let[f,m]of Object.entries(s)){if(!t.tryDefinition(f))return o("Nothing by that name here");let b=Object.keys(t.tryDefinition(f).fields?.shape??{});for(let[S,D]of Object.entries(m??{}))if(typeof D!="string"||!b.includes(D))return o(`${y(f)} has no field "${String(D)}" for its ${S}`);for(let S of i.requiredRoles)if(!(S in(m??{})))return o(`a ${n.name} needs ${y(f)}'s ${S}`)}else if(i.binds==="entities")for(let f of i.requiredRoles){let m=s[f];if(!m)return o(`a ${n.name} needs its ${f}`);if(typeof m.kind=="string"&&!t.tryDefinition(m.kind))return o("Nothing by that name here")}let a={...e,schema:t,lenses:[...e.lenses??[],n]},l=a.lenses.length-1,d=J(a),c=`lenses.${l}`,u=d.findings.find(f=>f.path===c||f.path.startsWith(`${c}.`));if(u)return o(u.message.replace(/^"[^"]*" /,"it "));let p=d.undrawn.find(f=>f.index===l);if(p)return o(p.why);let g=d.drawn.find(f=>f.index===l);if(!g)return o("its bindings name something the app does not have");if(g.as==="overview")return o(`"${n.title}" is the scene's own address; give it another title`);if(n.name==="blocks"){let f=Ee(I(t),n.options?.blocks);if(f)return o(f)}return{ok:!0,drawn:g}}function K(e){return{op:"add-lens",title:e.title,lens:e.name,on:e.on,...e.bindings?{bindings:e.bindings}:{},...e.options?{options:e.options}:{}}}function xe(e){return{op:"remove-lens",title:e.title,on:e.on}}var w=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function de(e){let n=w(e)?e:{},r=String(n.lens??n.name??""),t=n.bindings,o=typeof n.on=="string"?n.on:w(t)&&G[r]?.binds==="fields"?Object.keys(t)[0]??"":"";return{name:r,title:typeof n.title=="string"?n.title.trim():"",on:o,...w(t)?{bindings:t}:{},...w(n.options)?{options:n.options}:{}}}function ve(e){let n=o=>w(e.bindings?.[o])?e.bindings[o]:{},r=o=>typeof o=="string"?o:void 0,t=n(e.on);switch(e.name){case"columns":return r(t.column)?{lens:"columns",kind:e.on,column:t.column}:void 0;case"calendar":{let o=r(e.options?.range);return r(t.start)?{lens:"calendar",kind:e.on,start:t.start,...r(t.end)?{end:t.end}:{},...r(t.done)?{done:t.done}:{},...o?{range:o}:{}}:void 0}case"timeline":return r(t.start)&&r(t.end)&&r(t.column)?{lens:"timeline",kind:e.on,start:t.start,end:t.end,column:t.column}:void 0;case"coverage":{let o=w(e.bindings?.columns)?r(e.bindings.columns.kind):void 0,i=w(e.bindings?.link)?r(e.bindings.link.edge):void 0;return o&&i?{lens:"coverage",kind:e.on,across:o,link:i}:void 0}case"blocks":{let o=e.options?.blocks;if(!Array.isArray(o)||o.length!==1||!w(o[0]))return;let i=o[0],s=new RegExp(`^all\\('${e.on}'\\)(?: where (.+))?$`).exec(String(i.list??""));if(!s)return;let a=i.sort;return{lens:"blocks",kind:e.on,as:i.as==="card"?"card":"row",...typeof i.group=="string"?{group:i.group}:{},...typeof a=="string"?{sort:{by:a}}:w(a)&&typeof a.by=="string"?{sort:{by:a.by,...a.direction==="desc"?{direction:"desc"}:{}}}:{},...s[1]?{where:[{expr:s[1],says:"as asked"}]}:{}}}default:return}}function W(e,n,r,t,o){let i=I(L(e.schema,t)).info(n.on),s=ve(n);return{title:n.title,said:`${B[n.name]??"A picture"} of ${i?.plural??y(n.on)}.`,kind:n.on,lens:n,drawn:r,edit:K(n),by:o,asks:[],...s?{recipe:s}:{}}}function te(e){return{title:e.title,said:e.said,lens:{title:e.lens.title,lens:e.lens.name,on:e.lens.on,...e.lens.bindings?{bindings:e.lens.bindings}:{},...e.lens.options?{options:e.lens.options}:{}},edit:e.edit,by:e.by,check:"It draws, and graview check would take it."}}function F(e,n,r,t,o){let i=Re(e,n),s=e.title??o??C(i.title,r.app),a=Ae(e,s),l=T(r.app,a,r.sight);return l.ok?{title:s,said:`${B[e.lens]} ${i.detail}.`,kind:e.kind,lens:a,drawn:l.drawn,edit:K(a),by:"template",asks:t,recipe:e}:{failed:l.failed,...r.lastGood?{lastGood:r.lastGood}:{}}}function Ye(e,n){let r=I(L(n.app.schema,n.sight)),t=r.info(e.kind);if(!t)return{failed:"Couldn't draw that: Nothing by that name here."};let o=e.lens==="blocks"&&!e.group&&!e.sort&&!e.where?.length&&e.title===void 0;return F(o?{...e,title:C(`Every ${t.noun}`,n.app)}:e,r,n,[])}function Le(e,n,r,t){if(r.length>0)return r;let o=s=>{switch(e){case"columns":return s.fields.some(a=>a.type==="enum");case"calendar":return s.fields.some(A);case"timeline":return ie(s)!==void 0||s.fields.some(A);case"coverage":return s.edges.some(a=>a.to.some(l=>l!==s.kind));case"board":return s.fields.some(a=>a.name==="x")&&s.fields.some(a=>a.name==="y");case"plan":return s.fields.some(a=>a.name==="outline")||s.roles.outline!==void 0;default:return!0}};return[...n.kinds.filter(o)].sort((s,a)=>Number(a.fields.some(l=>E(t,l.words)))-Number(s.fields.some(l=>E(t,l.words))))}function Ie(e,n){let r=I(L(n.app.schema,n.sight)),t=re(e),o=$e(t);if(o.length===0)return;let i=pe(t,r),s;for(let a of o){let l=a==="coverage"?[i[0]??r.kinds[0]].filter(d=>!!d):Le(a,r,i,t);for(let d of l)try{let c=ae(a,d,r,t,i),u=F(c,r,n,[e]);if(!O(u))return u;s??=u.failed}catch(c){if(!(c instanceof j))throw c;s??=`Couldn't draw that: ${c.message}.`}l.length===0&&i.length===0&&(s??=`Couldn't draw that: nothing here has what ${B[a].toLowerCase()} needs.`)}return{failed:s??"Couldn't draw that: Nothing by that name here.",...n.lastGood?{lastGood:n.lastGood}:{}}}async function Oe(e,n){let r=n.lastGood?{lastGood:n.lastGood}:{};if(e.trim().length===0)return{failed:"Say what you would like to see, like \u201Ca board of tasks by status\u201D.",...r};let t=Ie(e,n);if(t&&!O(t))return t;if(!n.complete)return t??{failed:"Couldn't draw that: drawing freely needs AI, which isn't on here. Ask for a board, a calendar, a timeline, a list or who covers what.",...r};let o=await le(e,n,void 0);return O(o)&&t?t:o}async function je(e,n,r){let t={lastGood:e},o={...r,lastGood:e},i=I(L(r.app.schema,r.sight)),s=re(n),a=i.info(e.kind),l=[...e.asks,n];if(!a)return{failed:"Couldn't change that: Nothing by that name here.",...t};let d=e.recipe,c=/^ (?:call|name|title) (?:it|this)? ?(.+?) $/.exec(s)??/ (?:call|name) it (.+?) $/.exec(s);try{if(c){let g=n.replace(/^.*?\b(?:call|name|title)\b\s*(?:it|this)?\s*/i,"").replace(/^["“']|["”']$/g,"").trim();if(g.length===0)return{failed:"Couldn't change that: say what to call it.",...t};let f={...e.lens,title:C(g,r.app)},m=T(r.app,f,r.sight);return m.ok?{...e,title:f.title,lens:f,drawn:m.drawn,edit:K(f),asks:l,...d?{recipe:{...d,title:f.title}}:{}}:{failed:m.failed,...t}}let p=/ as (?:a |an )?(board|kanban|calendar|timeline|list|table|cards|rows|grid|plan|layout)\b/.exec(s);if(p){let g=p[1]==="board"||p[1]==="kanban"?"columns":p[1]==="calendar"?"calendar":p[1]==="timeline"?"timeline":p[1]==="grid"?"coverage":p[1]==="plan"?"plan":p[1]==="layout"?"board":"blocks",f=ae(g,a,i,s,[a]),m=p[1]==="cards"?"card":p[1]==="rows"?"row":void 0,b=g==="blocks"&&d?.lens==="blocks"?{...d,...m?{as:m}:{}}:g==="blocks"&&d?.lens==="columns"?{...f,group:d.column,...m?{as:m}:{}}:f;return F(R(b),i,o,l)}if(d){let g=Te(d,a,i,s);if(g)return F(g,i,o,l)}}catch(p){if(!(p instanceof j))throw p;return{failed:`Couldn't change that: ${p.message}.`,...t}}if(!r.complete)return{failed:"Couldn't change that: changing it freely needs AI, which isn't on here. Try \u201Cgroup by status\u201D, \u201Conly this month\u201D or \u201Cas a calendar\u201D.",...t};let u=await le(n,o,e);return O(u)?u:{...u,asks:l}}var R=e=>{let{title:n,...r}=e;return r};function Te(e,n,r,t){let o=/ (?:group(?:ed)?|split|organi[sz]ed?|put them|columns) by ([\p{L}\p{N} -]+?)(?= (?:and|only|with)|\s*$)/u.exec(t)?.[1]??(/^ by /.test(t)?U(t):void 0);if(o){let d=v(n,o);if(d?.type==="enum")return e.lens==="blocks"?{...R(e),group:d.name}:{lens:"columns",kind:e.kind,column:d.name};let c=oe(n,o,r);return c?{lens:"coverage",kind:e.kind,across:c.to[0],link:c.name}:h(d?`${n.plural}' ${d.words} is not a choice, so they cannot be grouped by it`:`${n.plural} have nothing called ${o} to group by`)}let i=/ (?:sort(?:ed)?|order(?:ed)?) by ([\p{L}\p{N} -]+?)(?= (?:and|only|with)|\s*$)/u.exec(t)?.[1];if(i){let d=v(n,i);return d?{...e.lens==="blocks"?R(e):{lens:"blocks",kind:e.kind,as:"row",...e.lens==="columns"?{group:e.column}:{}},sort:{by:d.name,.../\b(newest|latest|desc|descending|most)\b/.test(t)?{direction:"desc"}:{}}}:h(`${n.plural} have nothing called ${i} to sort by`)}if(/\b(?:all of them|everything|show all|clear the filter|no filter|without the filter)\b/.test(t)){if(e.lens!=="blocks"||!e.where)return h("it already shows all of them");let{where:d,...c}=R(e);return c}let s=se(t);if(s&&e.lens==="calendar"&&s.range)return{...R(e),range:s.range};if(s&&e.lens==="calendar"&&!s.range)return{lens:"blocks",kind:e.kind,as:"row",sort:{by:e.start},where:V(n,t)};let a=V(n,t);if(a.length>0){let d=e.lens==="blocks"?R(e):{lens:"blocks",kind:e.kind,as:"row",...e.lens==="columns"?{group:e.column}:{}};return{...d,where:[...d.where??[],...a]}}let l=e.lens==="calendar"?M(t):void 0;if(l)return{...R(e),range:l}}function Ne(e){return e.kinds.map(n=>{let r=n.fields.map(i=>`${i.name} (${i.type??"value"}${i.options?`: ${i.options.join(" | ")}`:""})`).join(", "),t=n.edges.map(i=>`${i.name} \u2192 ${i.to.join(" | ")}`).join(", "),o=Object.entries(n.roles).map(([i,s])=>`${i}=${s}`).join(", ");return`- ${n.kind} ("${n.plural}"): ${r}${t?`; relations: ${t}`:""}${o?`; roles: ${o}`:""}`}).join(`
|
|
2
2
|
`)}var Fe=['columns \u2014 a board, records in columns by one choice field: {"lens": "columns", "on": K, "bindings": {K: {"column": "<enum field>"}}}','calendar \u2014 records on a calendar by a date: {"lens": "calendar", "on": K, "bindings": {K: {"start": "<date field>", "end"?: "<date field>", "done"?: "<boolean field>"}}, "options": {"range"?: "day" | "week" | "month" | "quarter" | "year" | "agenda"}}','timeline \u2014 minutes of a day in columns: {"lens": "timeline", "on": K, "bindings": {K: {"start": "<number field>", "end": "<number field>", "column": "<enum field>"}}}','coverage \u2014 who covers what, a grid of two kinds joined by a relation: {"lens": "coverage", "on": K, "bindings": {"rows": {"kind": K}, "columns": {"kind": J}, "link": {"edge": "<relation of K to J>"}}}',`blocks \u2014 anything else, as blocks: {"lens": "blocks", "on": K, "options": {"blocks": [{"headline": "words"}, {"list": "all('K') where <condition>", "group"?: "<enum field>", "sort"?: "<field>" | {"by": "<field>", "direction": "desc"}, "as"?: "row" | "card", "empty"?: "words"}, {"figure": "count(all('K'))", "label": "words"}]}}. Conditions read a record's own fields: status == 'open', not done, days(today(), due) <= 7.`].join(`
|
|
3
3
|
`);function Ce(e,n,r){return["You draw a view of an app's data as JSON \u2014 never code. The app's kinds, their fields (with types) and relations:",Ne(n),"","The lenses you may use (prefer the first four; use blocks only when none of them fits):",Fe,"",r?`The view on screen now:
|
|
4
4
|
${JSON.stringify(r.lens)}
|