graview 0.1.51 → 0.1.53
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.2IKVO743.js +1 -0
- package/dist/preview/{chunk.UK5F3S2N.js → chunk.2LQ37DC2.js} +1 -1
- package/dist/preview/{chunk.ALCH5H7U.js → chunk.3377DLPA.js} +1 -1
- package/dist/preview/chunk.34Q7OKK3.js +1 -0
- package/dist/preview/{chunk.5ZAK57JA.js → chunk.36XV4ZMC.js} +2 -2
- package/dist/preview/chunk.3FRVG6JW.js +32 -0
- package/dist/preview/{chunk.3MU37W5D.js → chunk.3FUFVVR4.js} +1 -1
- package/dist/preview/chunk.3Y7BDRP3.js +1 -0
- package/dist/preview/{chunk.3TVAE7LE.js → chunk.4DCPB67O.js} +1 -1
- package/dist/preview/chunk.4DFO43VM.js +1 -0
- package/dist/preview/chunk.4QVZXCV5.js +1 -0
- package/dist/preview/chunk.4SVAHPJA.js +1 -0
- package/dist/preview/chunk.52Y37IAD.js +1 -0
- package/dist/preview/chunk.56UFDIX5.js +1 -0
- package/dist/preview/chunk.5E4UGVAD.js +1 -0
- package/dist/preview/chunk.5H3VCAPN.js +1 -0
- package/dist/preview/chunk.5K5D4IMM.js +1 -0
- package/dist/preview/{chunk.DQNN5FE5.js → chunk.5XFRWXYQ.js} +1 -1
- package/dist/preview/{chunk.PYRJDTVS.js → chunk.65F3DF5Q.js} +1 -1
- package/dist/preview/{chunk.CMEETACI.js → chunk.6CVW53WA.js} +1 -1
- package/dist/preview/chunk.6ESAZJBN.js +1 -0
- package/dist/preview/chunk.6S3B4XC4.js +1 -0
- package/dist/preview/{chunk.P4CLT32V.js → chunk.6W2DUW5S.js} +5 -5
- package/dist/preview/chunk.6YGRRXJB.js +2 -0
- package/dist/preview/{chunk.CQPNDJAC.js → chunk.72Q4R7N6.js} +1 -1
- package/dist/preview/chunk.7BXOQEUP.js +1 -0
- package/dist/preview/{chunk.OJ64WTLW.js → chunk.7NFCI4LH.js} +2 -2
- package/dist/preview/{chunk.EA2NMVRE.js → chunk.7R6GXJS4.js} +1 -1
- package/dist/preview/chunk.A2RQFAZ6.js +1 -0
- package/dist/preview/{chunk.TNL2BVCH.js → chunk.AQJD23AN.js} +1 -1
- package/dist/preview/{chunk.NQ26KMSQ.js → chunk.ASCTAUFD.js} +1 -1
- package/dist/preview/chunk.B3T4N2XM.js +25 -0
- package/dist/preview/chunk.B3WVCSW5.js +1 -0
- package/dist/preview/{chunk.AL7LFNOS.js → chunk.BB5XKTVC.js} +1 -1
- package/dist/preview/{chunk.LYIHPVDZ.js → chunk.BG2SC77J.js} +1 -1
- package/dist/preview/{chunk.353CGK6C.js → chunk.BPPDBPTL.js} +1 -1
- package/dist/preview/chunk.BQHRZJ5Z.js +1 -0
- package/dist/preview/{chunk.W2DKFQ6R.js → chunk.CANTHIRO.js} +1 -1
- package/dist/preview/chunk.CIUQWCU4.js +1 -0
- package/dist/preview/chunk.CSA6SWTI.js +1 -0
- package/dist/preview/{chunk.GJQF7I22.js → chunk.CWPRQSED.js} +1 -1
- package/dist/preview/{chunk.4EZFOZBA.js → chunk.CYP5KXIQ.js} +1 -1
- package/dist/preview/chunk.D3A24PQ6.js +1 -0
- package/dist/preview/{chunk.7RIFDWDF.js → chunk.DQPEVPKQ.js} +1 -1
- package/dist/preview/{chunk.XWXYC3BJ.js → chunk.DUZS52WX.js} +1 -1
- package/dist/preview/chunk.E52UTLQ2.js +1 -0
- package/dist/preview/{chunk.2534FLZZ.js → chunk.E647LWH5.js} +1 -1
- package/dist/preview/chunk.EG2N5F6L.js +1 -0
- package/dist/preview/{chunk.SPU3BVAO.js → chunk.EZXGVTT2.js} +1 -1
- package/dist/preview/chunk.F5RN6YXG.js +4 -0
- package/dist/preview/chunk.FBRARPGR.js +4 -0
- package/dist/preview/{chunk.XCCBUWMC.js → chunk.FCAKLO5U.js} +1 -1
- package/dist/preview/{chunk.ACB4TD4W.js → chunk.FGJM4LJO.js} +1 -1
- package/dist/preview/{chunk.WESWDXRW.js → chunk.FJN4OGAS.js} +1 -1
- package/dist/preview/chunk.FXNUR5JI.js +88 -0
- package/dist/preview/chunk.G226CUJQ.js +1 -0
- package/dist/preview/chunk.G6DISMVT.js +67 -0
- package/dist/preview/{chunk.SRFZKDQ6.js → chunk.GANAZIRD.js} +1 -1
- package/dist/preview/{chunk.SJKHVIHA.js → chunk.GBIVIHGD.js} +19 -14
- package/dist/preview/chunk.GGHZEAAT.js +1 -0
- package/dist/preview/chunk.GPYZR6HE.js +1 -0
- package/dist/preview/{chunk.JI2UVZUU.js → chunk.GYO57LKD.js} +1 -1
- package/dist/preview/{chunk.MN6WHE4B.js → chunk.GZBODS7Z.js} +1 -1
- package/dist/preview/chunk.GZWC72HS.js +1 -0
- package/dist/preview/{chunk.2W2YVB6X.js → chunk.H2B3SEI7.js} +1 -1
- package/dist/preview/{chunk.ESK3UZRC.js → chunk.H6EMDQP5.js} +1 -1
- package/dist/preview/chunk.HAIHXBVX.js +1 -0
- package/dist/preview/{chunk.ESSENNHM.js → chunk.HBVURYWY.js} +2 -2
- package/dist/preview/{chunk.ZZODDJYK.js → chunk.HDXDYS4C.js} +1 -1
- package/dist/preview/chunk.HE545Z6I.js +1 -0
- package/dist/preview/chunk.HIDLE6BN.js +18 -0
- package/dist/preview/chunk.HIFLBWQJ.js +9 -0
- package/dist/preview/chunk.I62MCBQM.js +1 -0
- package/dist/preview/chunk.I6SUHXJF.js +1 -0
- package/dist/preview/chunk.I6W3IQ4W.js +1 -0
- package/dist/preview/chunk.ICYJ7QJG.js +2 -0
- package/dist/preview/{chunk.Z7N3MJ36.js → chunk.IYVBJDR7.js} +1 -1
- package/dist/preview/{chunk.FFCUZPTC.js → chunk.J6OT74RM.js} +1 -1
- package/dist/preview/{chunk.K7RKWB2K.js → chunk.JCJ7NTW4.js} +1 -1
- package/dist/preview/{chunk.4T67XS2D.js → chunk.JKCLYLT4.js} +1 -1
- package/dist/preview/chunk.JQTO52Q7.js +1 -0
- package/dist/preview/chunk.JRU5BT7K.js +5 -0
- package/dist/preview/{chunk.XCQ7ZPR5.js → chunk.K7WME4P4.js} +1 -1
- package/dist/preview/{chunk.APFRPN5S.js → chunk.KAKJYAHM.js} +1 -1
- package/dist/preview/chunk.KCM2VOC7.js +1 -0
- package/dist/preview/{chunk.CTOBNZLM.js → chunk.KWMBRB6O.js} +1 -1
- package/dist/preview/{chunk.KVEDMKUN.js → chunk.KY7QD22S.js} +1 -1
- package/dist/preview/{chunk.S32AGJ3W.js → chunk.LAOZEYYQ.js} +1 -1
- package/dist/preview/{chunk.7GAC7U34.js → chunk.LCG3VLCB.js} +1 -1
- package/dist/preview/{chunk.IUIDDNN3.js → chunk.LDLWYAHK.js} +1 -1
- package/dist/preview/chunk.LEKML4S4.js +1 -0
- package/dist/preview/{chunk.MY5OXSS7.js → chunk.MDIAWTNK.js} +1 -1
- package/dist/preview/chunk.MKWVNW4Q.js +35 -0
- package/dist/preview/{chunk.3H7YIKKC.js → chunk.MSPRCR3Q.js} +1 -1
- package/dist/preview/{chunk.VICCAWAN.js → chunk.MT45H2T5.js} +1 -1
- package/dist/preview/chunk.MXTDQXVW.js +1 -0
- package/dist/preview/{chunk.WQLAIEWJ.js → chunk.N6A3DIOY.js} +1 -1
- package/dist/preview/{chunk.FU4YSVWX.js → chunk.NAEEPUWJ.js} +1 -1
- package/dist/preview/{chunk.KK46XLGU.js → chunk.NCTTPW7A.js} +1 -1
- package/dist/preview/chunk.OCWZJNZF.js +1 -0
- package/dist/preview/chunk.OP3ZUI4W.js +1 -0
- package/dist/preview/{chunk.U7SNDY3F.js → chunk.OPKXCL5R.js} +1 -1
- package/dist/preview/chunk.OXLYDXQV.js +1 -0
- package/dist/preview/{chunk.6KYWJXZR.js → chunk.OZYZBRWO.js} +1 -1
- package/dist/preview/chunk.P2W727C7.js +1 -0
- package/dist/preview/{chunk.T3RTFTOZ.js → chunk.P7FN3SFB.js} +1 -1
- package/dist/preview/{chunk.NVRK6A7T.js → chunk.PEA4D66Y.js} +1 -1
- package/dist/preview/chunk.Q5JVKSEN.js +1 -0
- package/dist/preview/chunk.QATG5HNV.js +1 -0
- package/dist/preview/{chunk.NZDHXREL.js → chunk.R3DWF35R.js} +1 -1
- package/dist/preview/{chunk.BYY7YXBI.js → chunk.RIS3OKAI.js} +1 -1
- package/dist/preview/{chunk.GMAXA5GV.js → chunk.RUTZEEBR.js} +1 -1
- package/dist/preview/{chunk.OU5TRY4N.js → chunk.S2ATSY6P.js} +1 -1
- package/dist/preview/{chunk.MX3Y3LPH.js → chunk.S6TN3MLY.js} +1 -1
- package/dist/preview/{chunk.IE4ZJQV3.js → chunk.T56SOSIR.js} +4 -4
- package/dist/preview/chunk.THL67D77.js +1 -0
- package/dist/preview/{chunk.SSAY4ITS.js → chunk.TLQTDKOL.js} +2 -2
- package/dist/preview/{chunk.FKJ3HIA5.js → chunk.TRPPN2GD.js} +1 -1
- package/dist/preview/{chunk.OW72XZF4.js → chunk.TTFYXKLI.js} +1 -1
- package/dist/preview/{chunk.HVX7LFWR.js → chunk.TXEWSZGO.js} +1 -1
- package/dist/preview/chunk.U4T4Y2MT.js +1 -0
- package/dist/preview/chunk.ULTYDYTS.js +19 -0
- package/dist/preview/chunk.UQ4CASST.js +1 -0
- package/dist/preview/chunk.UQENE3VE.js +1 -0
- package/dist/preview/chunk.USAGE5C6.js +28 -0
- package/dist/preview/{chunk.RMMJQYJJ.js → chunk.UVMLX4US.js} +1 -1
- package/dist/preview/{chunk.2VJ52LGS.js → chunk.UXNZPPWR.js} +1 -1
- package/dist/preview/chunk.UYCPQ6IW.js +1 -0
- package/dist/preview/chunk.V6X3U3JF.js +1 -0
- package/dist/preview/{chunk.K7ECYKZL.js → chunk.VOHDRH3P.js} +1 -1
- package/dist/preview/{chunk.HFKGND5Q.js → chunk.VRJ4TULC.js} +1 -1
- package/dist/preview/{chunk.GLTWLQ6L.js → chunk.VTCPA4V4.js} +1 -1
- package/dist/preview/chunk.VTRI2MT2.js +2 -0
- package/dist/preview/chunk.W54NXXC5.js +293 -0
- package/dist/preview/{chunk.MG3DMURZ.js → chunk.WDEMPWS4.js} +1 -1
- package/dist/preview/chunk.XBNASVTY.js +1 -0
- package/dist/preview/{chunk.B4PUI3GO.js → chunk.XDEKL6TJ.js} +1 -1
- package/dist/preview/chunk.XE72DFBV.js +13 -0
- package/dist/preview/{chunk.UWFEXEY3.js → chunk.XFIZLWYA.js} +1 -1
- package/dist/preview/{chunk.76QSPWSJ.js → chunk.XXCT6DLX.js} +1 -1
- package/dist/preview/{chunk.JX2C3HVD.js → chunk.Y4VOCJ7R.js} +1 -1
- package/dist/preview/chunk.YA7ZMGOL.js +1 -0
- package/dist/preview/{chunk.B7LBG4UP.js → chunk.YI7WHBAD.js} +2 -2
- package/dist/preview/{chunk.WFHFWJ6E.js → chunk.Z4YSCHZT.js} +1 -1
- package/dist/preview/{chunk.B6LKLV32.js → chunk.ZQWKS6K5.js} +1 -1
- package/dist/preview/{chunk.R5R7CLOU.js → chunk.ZYYM52N5.js} +1 -1
- package/dist/preview/index.html +50 -50
- package/dist/preview/page.js +2 -2
- package/package.json +6 -6
- package/dist/preview/chunk.2W45NM7Q.js +0 -9
- package/dist/preview/chunk.32BOL7OL.js +0 -1
- package/dist/preview/chunk.34HGT7HQ.js +0 -1
- package/dist/preview/chunk.3SBTQ66X.js +0 -1
- package/dist/preview/chunk.4N5R4K6O.js +0 -1
- package/dist/preview/chunk.5ON3JSAK.js +0 -1
- package/dist/preview/chunk.7G4M2PX3.js +0 -5
- package/dist/preview/chunk.7NQROWHU.js +0 -1
- package/dist/preview/chunk.AJAMTRZ3.js +0 -1
- package/dist/preview/chunk.AL45OI4A.js +0 -1
- package/dist/preview/chunk.AZOW57MT.js +0 -1
- package/dist/preview/chunk.BRDAO2OF.js +0 -4
- package/dist/preview/chunk.BV6HKTHK.js +0 -1
- package/dist/preview/chunk.CI4DEKPX.js +0 -1
- package/dist/preview/chunk.CUB4IAUJ.js +0 -1
- package/dist/preview/chunk.CUN4VN42.js +0 -1
- package/dist/preview/chunk.CV55N3Y6.js +0 -1
- package/dist/preview/chunk.CXC5FOIO.js +0 -1
- package/dist/preview/chunk.DEH6O3K4.js +0 -28
- package/dist/preview/chunk.DUY27OJV.js +0 -1
- package/dist/preview/chunk.E2R6VFZX.js +0 -1
- package/dist/preview/chunk.ET3XJDPX.js +0 -1
- package/dist/preview/chunk.FEIJ7ETK.js +0 -1
- package/dist/preview/chunk.FG5ZFYYL.js +0 -1
- package/dist/preview/chunk.FTBH7CPZ.js +0 -1
- package/dist/preview/chunk.FYDDFOSD.js +0 -35
- package/dist/preview/chunk.G446PWV6.js +0 -1
- package/dist/preview/chunk.GRYS6VSF.js +0 -1
- package/dist/preview/chunk.GYTVL6GR.js +0 -359
- package/dist/preview/chunk.HASVT7IC.js +0 -1
- package/dist/preview/chunk.IBJBCZKG.js +0 -1
- package/dist/preview/chunk.IFL2MYTQ.js +0 -1
- package/dist/preview/chunk.JBR66TUP.js +0 -1
- package/dist/preview/chunk.JG2FGZF2.js +0 -18
- package/dist/preview/chunk.JMDKAP23.js +0 -1
- package/dist/preview/chunk.KOBCLWPC.js +0 -1
- package/dist/preview/chunk.KQSD5MLY.js +0 -1
- package/dist/preview/chunk.KRODTMGR.js +0 -1
- package/dist/preview/chunk.KYKHZZT7.js +0 -1
- package/dist/preview/chunk.MCFLCC42.js +0 -12
- package/dist/preview/chunk.MMVCZOEX.js +0 -32
- package/dist/preview/chunk.MRXQBEPQ.js +0 -1
- package/dist/preview/chunk.N5XONWU2.js +0 -1
- package/dist/preview/chunk.NNUUD26E.js +0 -1
- package/dist/preview/chunk.OHDJYGH7.js +0 -2
- package/dist/preview/chunk.OPCBZNKF.js +0 -19
- package/dist/preview/chunk.PMV6XVVZ.js +0 -1
- package/dist/preview/chunk.PPZ2TOB5.js +0 -1
- package/dist/preview/chunk.QEQQXWYU.js +0 -1
- package/dist/preview/chunk.QPAJCRFB.js +0 -1
- package/dist/preview/chunk.RNOBACJ6.js +0 -1
- package/dist/preview/chunk.S4CKKT3C.js +0 -1
- package/dist/preview/chunk.SJYQ72EC.js +0 -1
- package/dist/preview/chunk.SKG4IHT5.js +0 -88
- package/dist/preview/chunk.TBSPEO2L.js +0 -1
- package/dist/preview/chunk.TMYGLXR6.js +0 -25
- package/dist/preview/chunk.TVWN5I4M.js +0 -1
- package/dist/preview/chunk.UCUWEYKM.js +0 -1
- package/dist/preview/chunk.UIWI4GKW.js +0 -1
- package/dist/preview/chunk.UVAWWCFW.js +0 -1
- package/dist/preview/chunk.V4GAOZAW.js +0 -1
- package/dist/preview/chunk.XZVPVAIS.js +0 -1
- package/dist/preview/chunk.Y2ZBVWII.js +0 -1
- package/dist/preview/chunk.Y3LTHEN7.js +0 -1
- package/dist/preview/chunk.Y5AMZBHA.js +0 -4
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import"./chunk.AJZBJBMO.js";var x="\uFEFF",$=/^[=+\-@\t\r]/;function h(e){return $.test(e)?`'${e}`:e}function w(e){let o=h(e);return/[",\r\n]/.test(o)?`"${o.replace(/"/g,'""')}"`:o}function f(e,o={}){let r=e.map(s=>`${s.map(w).join(",")}\r
|
|
2
|
+
`).join("");return o.bom===!1?r:x+r}function k(e){let{schema:o,graph:r,kind:s}=e,{labelOf:a,readableFields:i,withComputed:c}=e.words,l=o.tryDefinition(s),S=Object.keys(l?.computed??{}).length>0,j=t=>S?c(o,r,t):t,u=e.groups.flatMap(t=>t.nodes.map(n=>{let d=j(n),v=a(l,d),R=i(d,l,{said:[v],locale:e.locale,timeZone:e.timeZone});return{group:t.label??"",name:v,fields:R}})),y=l?.display?.page,g=[...y?.fields??[],...(y?.groups??[]).flatMap(t=>t.fields),...Object.keys(l?.fields?.shape??{}),...Object.keys(l?.computed??{})],p=new Map;for(let t of u)for(let n of t.fields)p.has(n.key)||p.set(n.key,n.label);let m=t=>{let n=g.indexOf(t);return n<0?g.length:n},b=[...p].map(([t,n],d)=>({key:t,label:n,at:d})).sort((t,n)=>m(t.key)-m(n.key)||t.at-n.at),O=[...e.grouped?["Group"]:[],"Name",...b.map(t=>t.label.charAt(0).toUpperCase()+t.label.slice(1))],E=u.map(t=>{let n=new Map(t.fields.map(d=>[d.key,d.value]));return[...e.grouped?[t.group]:[],t.name,...b.map(d=>n.get(d.key)??"")]});return[O,...E]}function C(e){return f(k(e))}function L(e,o=new Date){let r=typeof o=="string"?o.slice(0,10):`${o.getFullYear()}-${String(o.getMonth()+1).padStart(2,"0")}-${String(o.getDate()).padStart(2,"0")}`;return`${e.replace(/[/\\:*?"<>|\u0000-\u001f\u007f]/g,"-").replace(/\s+/g," ").trim().replace(/^\.+/,"")||"List"} \u2014 ${r}.csv`}async function T(e,o,r,s){let a=e.read().title,i=e.about;try{await o.lens?.("kind"in i?{op:"set-lens-export",title:i.kind,export:r}:{op:"set-lens-export",title:i.lens,...i.on!==void 0?{on:i.on}:{},export:r})}catch(c){return s?.notify({kind:"toast",tone:"bad",sentence:c instanceof Error&&c.message?c.message:r?`Export could not be turned on for \u201C${a}\u201D.`:`Export could not be turned off for \u201C${a}\u201D.`}),!1}return s?.notify({kind:"toast",sentence:r?`\u201C${a}\u201D offers Export CSV again.`:`\u201C${a}\u201D offers Export CSV to nobody now.`}),!0}async function G(e){let o=C(e),r=L(e.title);if(e.onExport)return void await e.onExport(o,r);let s=globalThis,a=s.URL.createObjectURL(new s.Blob([o],{type:"text/csv;charset=utf-8"})),i=s.document.createElement("a");i.href=a,i.download=r,i.click(),setTimeout(()=>s.URL.revokeObjectURL(a),3e4)}export{x as CSV_BOM,w as csvCell,L as csvFileName,h as csvSafe,C as listCsv,k as listCsvRows,G as saveShownList,T as switchExport,f as toCsv};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{C as y,L as h,Lb as $,Pb as x,U as g,fa as m}from"./chunk.
|
|
1
|
+
import{C as y,L as h,Lb as $,Pb as x,U as g,fa as m}from"./chunk.6W2DUW5S.js";function B(n,e,t){let o=n?.display?.format?.[e];return o?o(t):typeof t=="string"?m(t):String(t)}function G(n,e,t,o){let s=n.tryDefinition(e)?.edges,i=s&&Object.hasOwn(s,t)?s[t]:void 0;return(o==="out"?i?.description:i?.inverse)??m(t).toLowerCase()}var O=Symbol.for("@graview/core:markdown");function S(n){let e=y(n);return!!e&&(e[O]===1||S(e.innerType))}var w=/^ {0,3}#{1,6}(?:[ \t]+|$)/,b=/^[ \t]*(?:[-*+•]|\d{1,9}[.)])[ \t]+(?:\[[ xX]\][ \t]+)?/,k=/^ {0,3}(?:(?:-[ \t]*){3,}|(?:\*[ \t]*){3,}|(?:_[ \t]*){3,})$/,R=/^ {0,3}(?:`{3,}|~{3,})/,F=/^ {0,3}(?:>[ \t]?)+/,A=/^\|?\s*:?-{2,}:?\s*(?:\|\s*:?-{2,}:?\s*)*\|?$/,_={amp:"&",lt:"<",gt:">",quot:'"',"#39":"'",nbsp:" "};function E(n){return n.replace(/!?\[([^\]\n]{0,500})\]\([^)\n]{0,500}\)/g,"$1").replace(/<((?:https?:|mailto:)[^>\s]*)>/gi,"$1").replace(/<\/?[A-Za-z][^<>\n]*>/g,"").replace(/`+([^`\n]*)`+/g,"$1").replace(/(\*\*|__|~~)(?=\S)([^\n]{0,500}?\S)\1/g,"$2").replace(/(^|[^\w*])\*(?=\S)([^*\n]{0,500}?\S)\*(?![\w*])/g,"$1$2").replace(/(^|\W)_(?=\S)([^_\n]{0,500}?\S)_(?!\w)/g,"$1$2").replace(/\\([\\`*_{}[\]()#+\-.!>|~])/g,"$1").replace(/&(amp|lt|gt|quot|#39|nbsp);/g,(e,t)=>_[t]??"")}function N(n,e,t){let o=n.replace(/\r\n?/g,`
|
|
2
2
|
`).split(`
|
|
3
3
|
`),s=[],i=[],c=0,d=!1,u=()=>{let r=i.join(" ").replace(/\s+/g," ").trim();r&&(s.push(r),c+=r.length),i=[]},a=0;for(;a<o.length&&c<=t;){let r=o[a++];if(e&&R.test(r)){d=!d,d||u();continue}if(!d&&(r.trim().length===0||e&&(k.test(r)||A.test(r.trim())))){u();continue}let f=!d&&e&&w.test(r),l=!d&&b.test(r);if((f||l)&&u(),e&&!d?(r=r.replace(F,""),f&&(r=r.replace(w,"").replace(/[ \t]+#+[ \t]*$/,"")),l&&(r=r.replace(b,"")),r.includes("|")&&(r=r.replace(/^[ \t]*\||\|[ \t]*$/g,"").split("|").map(p=>p.trim()).filter(Boolean).join(" \xB7 ")),r=E(Number.isFinite(t)?r.slice(0,t*2+200):r)):l&&(r=r.replace(b,"")),i.push(r),f&&u(),i.reduce((p,T)=>p+T.length,0)>t)break}return u(),{blocks:s,more:o.slice(a).some(r=>r.trim().length>0&&!(e&&(R.test(r)||k.test(r))))}}function M(n,e){return`${(n.slice(0,e+1).replace(/\s+\S*$/,"")||n.slice(0,e)).replace(/[\s,;:.—-]+$/,"")}\u2026`}function Z(n,e={}){let t=e.most??160,{blocks:o,more:s}=N(n,e.markdown===!0,t),i=o[0]??"";if(i.length<=t)return(s||o.length>1)&&i.length>0&&!/[.!?…:]$/.test(i)?`${i}\u2026`:i;let c=x(i);return c&&c.length<=t?c:M(i,t)}var J=n=>N(n,!0,Number.POSITIVE_INFINITY).blocks.join(" ");var j={d:1440,h:60,m:1};function ne(n){if(typeof n=="number")return Number.isFinite(n)&&n>=0?Math.round(n):void 0;if(typeof n!="string")return;let e=n.trim().toLowerCase();if(/^\d+$/.test(e))return Number(e);let t=/^(\d+):([0-5]\d)(?::([0-5]\d))?$/.exec(e);if(t)return Number(t[1])*60+Number(t[2])+Math.round(Number(t[3]??0)/60);let o=0,s=!1,i=e.replace(/(\d*[.,]?\d+) *(days?|d|hours?|hrs?|hr|h|minutes?|mins?|min|m)(?![a-z])/g,(c,d,u)=>(s=!0,o+=Number(d.replace(",","."))*j[u[0]]," "));return s&&/^[\s,+]*(?:and[\s,+]*)*$/.test(i)?Math.round(o):void 0}function I(n,e){if(!Number.isFinite(n))return String(n);let t=Math.round(Math.abs(n)),o=Math.floor(t/60),s=t%60,i=[o?`${g(o,e)} h`:"",s||!o?`${g(s,e)} min`:""].filter(Boolean).join(" ");return n<0?`\u2212${i}`:i}var D=/^(\+?1[ .-]?)?\(?([2-9]\d\d)\)?[ .-]?(\d{3})[ .-]?(\d{4})(?: *(?:ext\.?|x|#) *(\d+))?$/i;function W(n,e){let t=n.trim(),o=/[-_](US|CA)\b/i.test(h(e))?D.exec(t):null;if(!o)return t;let[,s,i,c,d,u]=o;return`${s?.startsWith("+")?"+1 ":""}(${i}) ${c}-${d}${u?` ext. ${u}`:""}`}function P(n){let[,e="",t]=/^(.*?)(?: *(?:ext\.?|x|#) *(\d+))?$/i.exec(n.trim())??[],o=e.replace(/\D/g,"");return o.length<3?void 0:`tel:${e.startsWith("+")?"+":""}${o}${t?`;ext=${t}`:""}`}var L=()=>/Mac|iPhone|iPad|iPod/.test(globalThis.navigator?.userAgent??"");function q(n,e=L()){let t=encodeURIComponent(n.trim());return e?`https://maps.apple.com/?q=${t}`:`https://www.google.com/maps/search/?api=1&query=${t}`}var C=n=>n?.fields?.shape??{},U=(n,e)=>{let t=C(n);return Object.hasOwn(t,e)?$(t[e]):void 0},H=(n,e)=>{let t=n.computed,o=t&&Object.hasOwn(t,e)?t[e]:void 0;return typeof o=="object"?o.as:void 0};function te(n,e){return U(n,e)??(n&&H(n,e)==="duration"?"duration":void 0)}function re(n,e,t){return n==="duration"?typeof e=="number"?I(e,t):void 0:n==="phone"?typeof e=="string"?W(e,t):void 0:n==="place"&&typeof e=="string"?e.trim():void 0}function oe(n,e){if(!(typeof e!="string"||!e.trim()))return n==="phone"?P(e):n==="place"?q(e):void 0}export{S as a,B as b,G as c,Z as d,J as e,ne as f,te as g,re as h,oe as i};
|
|
@@ -0,0 +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{e as k,g as M,h as I,i as B,l as P}from"./chunk.MT45H2T5.js";import"./chunk.S2ATSY6P.js";import"./chunk.72Q4R7N6.js";import"./chunk.G6DISMVT.js";import"./chunk.W54NXXC5.js";import{G as te,Ga as q,T as W}from"./chunk.B3T4N2XM.js";import{a as L}from"./chunk.SDO3U72B.js";import"./chunk.6W2DUW5S.js";import"./chunk.SLBWPVIY.js";import{b as h}from"./chunk.AJZBJBMO.js";var r=h(te(),1);var A=h(W(),1),U=q(L(()=>(__graviewPreload(import.meta.url,["./chunk.G6DISMVT.js","./chunk.W54NXXC5.js","./chunk.B3T4N2XM.js","./chunk.SDO3U72B.js","./chunk.6W2DUW5S.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.YA7ZMGOL.js")))),v={Part:U.part((n,t)=>(0,A.jsx)(n.WhenMonth,{...t}),{quiet:!0}),prefetch:()=>U.prefetch()};var o=h(W(),1),z="try \u201Ctomorrow 3pm\u201D, \u201CFri 10:30\u201D or \u201C17 Oct\u201D";function K(n,t,d,p=!1){let S=Date.UTC(+n.day.slice(0,4),+n.day.slice(5,7)-1,+n.day.slice(8,10),0,t?n.minutes??0:0),g={weekday:p?"long":"short",year:"numeric",month:p?"long":"short",day:"numeric",...t?{hour:"numeric",minute:"2-digit"}:{},timeZone:"UTC"},m;try{m=new Intl.DateTimeFormat(d??"en-US",g)}catch{m=new Intl.DateTimeFormat("en-US",g)}return m.format(S).replace(/ /g," ")}function ce({value:n,time:t,instant:d=!1,label:p,name:S,required:g,autoFocus:m,autoSelect:H,locale:s,onChange:j,onLeave:_,onCancel:V,inputRef:w,boxStyle:Z}){let x=(0,r.useId)(),u=(0,r.useRef)(null),D=(0,r.useRef)(null),b=e=>{let a=M(e);return a?K(a,t,s):e??""},[T,C]=(0,r.useState)(()=>b(n)),[F,y]=(0,r.useState)(!1),[G,E]=(0,r.useState)(n),[J,Q]=(0,r.useState)(n);n!==J&&(Q(n),n!==G&&(E(n),C(b(n)))),(0,r.useEffect)(()=>{H&&(u.current?.focus(),u.current?.select())},[H]);let i=t&&d?B(s):void 0,N=T===b(n),l=M(n),c=N?l:P(T,{today:k().day,time:t,...l?{base:l}:{},...s?{locale:s}:{}}),X=N?n:c?I(c,{time:t,instant:d}):void 0,$=T.trim()==="",f=!$&&c===void 0;(0,r.useEffect)(()=>{u.current?.setCustomValidity(f?`Not a date this reads \u2014 ${z}`:"")},[f]);let O=e=>{E(e),j(e)},Y=e=>{C(e);let a=e.trim()===""?void 0:P(e,{today:k().day,time:t,...l?{base:l}:{},...s?{locale:s}:{}});O(a?I(a,{time:t,instant:d}):void 0)},ee=e=>{let a=t?{day:e,minutes:c?.minutes??l?.minutes??540}:{day:e},R=I(a,{time:t,instant:d});C(b(R)),O(R),y(!1),requestAnimationFrame(()=>{u.current?.focus(),u.current?.select()})},ne=$?`Type a date, or pick one \u2014 ${z}`:f?`Not a date this reads \u2014 ${z}`:c?`${K(c,t,s,!0)}${i?` ${i.short}`:""}`:"";return(0,o.jsxs)("span",{"data-graview-when":t?d?"instant":"moment":"day",style:{display:"inline-flex",flex:"1 1 14rem",flexWrap:"wrap",alignItems:"center",gap:"4px 6px",maxWidth:"100%",minWidth:0},onBlur:e=>{let a=e.relatedTarget;a&&e.currentTarget.contains(a)||!a&&typeof document<"u"&&!document.hasFocus()||(y(!1),_?.(X))},children:[(0,o.jsx)("input",{ref:e=>{u.current=e,typeof w=="function"?w(e):w&&(w.current=e)},type:"text",name:S,required:g,autoFocus:m,"aria-label":p,"aria-describedby":`${x}-said`,"aria-invalid":f||void 0,autoComplete:"off",spellCheck:!1,enterKeyHint:"done",placeholder:t?"tomorrow 3pm":"17 Oct",value:T,"data-graview-part":"control",onChange:e=>Y(e.target.value),onKeyDown:e=>{e.key==="Escape"?(e.preventDefault(),V?.()):e.key==="ArrowDown"&&e.altKey&&(e.preventDefault(),y(!0))},style:{flex:"1 1 12ch",minWidth:"10ch",maxWidth:"100%",boxSizing:"border-box",font:"inherit",...Z}}),(0,o.jsx)("button",{ref:D,type:"button","aria-label":`Pick a date for ${p}`,"aria-expanded":F,"aria-controls":`${x}-month`,"data-graview-part":"when-pick",onClick:()=>y(e=>!e),onPointerEnter:()=>v.prefetch(),style:{display:"inline-flex",alignItems:"center",justifyContent:"center",minWidth:32,minHeight:32,padding:0,borderRadius:6},children:(0,o.jsxs)("svg",{"aria-hidden":"true",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.4",children:[(0,o.jsx)("rect",{x:"2",y:"3",width:"12",height:"11",rx:"1.5"}),(0,o.jsx)("path",{d:"M2 6.5h12M5.5 1.5v3M10.5 1.5v3"})]})}),(0,o.jsxs)("span",{id:`${x}-said`,"aria-live":"polite","data-graview-part":"when-said",...i?{"data-graview-zone":i.zone,title:`Times are in ${i.zone.replace(/_/g," ")} (${i.short})`}:{},style:{flexBasis:"100%",fontSize:"0.75rem",color:f?"var(--graview-bad)":"var(--graview-ink-faint)"},children:[ne,i&&!f&&!$?(0,o.jsx)("span",{"data-graview-part":"when-zone",children:` \xB7 ${(i.zone.split("/").at(-1)??i.zone).replace(/_/g," ")} time`}):null]}),F?(0,o.jsx)(r.Suspense,{fallback:null,children:(0,o.jsx)(v.Part,{id:`${x}-month`,label:p,selected:c?.day??l?.day,today:k().day,locale:s,onPick:ee,onClose:()=>{y(!1),D.current?.focus()}})}):null]})}export{ce as WhenInput,K as wallAsRead};
|
|
@@ -1,6 +1,6 @@
|
|
|
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{
|
|
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{G as C,Ga as K,T as k}from"./chunk.B3T4N2XM.js";import{a as H}from"./chunk.SDO3U72B.js";import{b}from"./chunk.AJZBJBMO.js";var n=b(C(),1),N=450,_=10,O=t=>t instanceof HTMLInputElement?t.dataset.graviewChooseBox??void 0:void 0,q={ArrowDown:1,ArrowRight:1,ArrowUp:-1,ArrowLeft:-1,Home:-1/0,End:1/0},S=t=>t instanceof Element?t.closest("[data-graview-choose]"):null,G=t=>t instanceof HTMLElement&&(t.isContentEditable||t instanceof HTMLInputElement&&t.type!=="checkbox"||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement);function Y(t){let[i,d]=(0,n.useState)(()=>new Set),l=(0,n.useRef)(null),x=(0,n.useRef)(null),[E,P]=(0,n.useState)(null),R=E!==null&&t.includes(E)?E:t[0],L=(0,n.useMemo)(()=>t.filter(e=>i.has(e)),[t,i]),M=(0,n.useMemo)(()=>new Set(t),[t]);(0,n.useEffect)(()=>{[...i].some(e=>!M.has(e))&&d(e=>new Set([...e].filter(o=>M.has(o))))},[M,i]);let u=(0,n.useCallback)((e,o=!1)=>{let a=l.current;d(s=>{let r=new Set(s),f=a===null?-1:t.indexOf(a),y=t.indexOf(e);if(o&&f>=0&&y>=0){let T=s.has(a);for(let p of t.slice(Math.min(f,y),Math.max(f,y)+1))T?r.add(p):r.delete(p)}else r.has(e)?r.delete(e):r.add(e);return r}),l.current=e},[t]),v=(0,n.useCallback)(e=>d(new Set(e)),[]),A=(0,n.useCallback)(()=>{l.current=null,d(new Set)},[]),c=(0,n.useRef)(null),g=(0,n.useRef)(!1),m=L.length>0,h=()=>{c.current&&clearTimeout(c.current.timer),c.current=null};(0,n.useEffect)(()=>h,[]);let B={ref:x,onKeyDown:e=>{if(G(e.target))return;let o=O(e.target);if(e.key==="Tab"&&!e.shiftKey&&!e.metaKey&&!e.ctrlKey&&!e.altKey&&o!==void 0&&m){let s=document.querySelector('[data-testid="several-bar"]'),r=s?.querySelector("[data-mutation]:not([disabled])")??s?.querySelector("button:not([disabled])");if(r){e.preventDefault(),e.stopPropagation(),r.focus();return}}let a=q[e.key];if(o!==void 0&&a!==void 0&&!e.metaKey&&!e.ctrlKey&&!e.altKey){let s=t.indexOf(o),r=t[Math.max(0,Math.min(t.length-1,s+(Number.isFinite(a)?a:a>0?t.length:-t.length)))];if(e.preventDefault(),e.stopPropagation(),r===void 0||r===o)return;if(e.shiftKey){let f=l.current!==null&&t.includes(l.current)?l.current:o,[y,T]=[t.indexOf(f),t.indexOf(r)].sort((p,F)=>p-F);d(p=>new Set([...p,...t.slice(y,T+1)])),l.current=f}P(r),x.current?.querySelector(`[data-graview-choose-box="${CSS.escape(r)}"]`)?.focus();return}if((e.metaKey||e.ctrlKey)&&!e.altKey&&e.key.toLowerCase()==="a"){e.preventDefault(),e.stopPropagation(),v(t);return}if(e.key===" "&&!e.metaKey&&!e.ctrlKey){let s=S(e.target),r=e.target instanceof HTMLButtonElement||e.target instanceof HTMLInputElement&&e.target.type==="checkbox";if(!s||r)return;e.preventDefault(),u(s.dataset.graviewChoose,e.shiftKey)}},onFocus:e=>{let o=O(e.target);o!==void 0&&P(o)},onPointerDown:e=>{if(g.current=!1,e.pointerType==="mouse"||e.button>0)return;let o=S(e.target);if(!o||e.target instanceof HTMLInputElement&&e.target.type==="checkbox")return;let a=o.dataset.graviewChoose;h(),c.current={id:a,x:e.clientX,y:e.clientY,timer:setTimeout(()=>{c.current=null,g.current=!0,u(a)},N)}},onPointerMove:e=>{let o=c.current;o&&Math.hypot(e.clientX-o.x,e.clientY-o.y)>_&&h()},onPointerUp:h,onPointerCancel:h,onClickCapture:e=>{let o=S(e.target);if(!o||e.target instanceof HTMLInputElement&&e.target.type==="checkbox"&&e.target.hasAttribute("data-graview-choose-box"))return;if(g.current){g.current=!1,e.preventDefault(),e.stopPropagation();return}let s=o.dataset.graviewChoose;if(e.shiftKey&&(m||l.current!==null)){e.preventDefault(),e.stopPropagation(),u(s,!0);return}m&&matchMedia?.("(pointer: coarse)").matches&&(e.preventDefault(),e.stopPropagation(),u(s))},onContextMenu:e=>{(g.current||c.current)&&(e.preventDefault(),e.stopPropagation())},...m?{"data-graview-choosing":""}:{}},j=(0,n.useCallback)(e=>i.has(e),[i]);return{chosen:L,has:j,toggle:u,choose:v,clear:A,listProps:B,boxProps:(e,o)=>({type:"checkbox",className:"graview-choose-box","data-graview-choose-box":e,"aria-label":`Choose ${o}`,tabIndex:e===R?0:-1,checked:i.has(e),onChange:()=>{},onClick:a=>{a.stopPropagation(),u(e,a.shiftKey)}}),list:x}}var $=`
|
|
2
2
|
.graview-choose-box{width:24px;height:24px;margin:0;accent-color:var(--graview-accent);cursor:pointer;opacity:0}
|
|
3
3
|
[data-graview-choose]:hover .graview-choose-box,[data-graview-choose]:focus-within .graview-choose-box,.graview-choose-box:focus-visible,.graview-choose-box:checked,[data-graview-choosing] .graview-choose-box{opacity:1}
|
|
4
4
|
[data-graview-choose]{-webkit-touch-callout:none}
|
|
5
5
|
[data-graview-choosing] [data-graview-choose]{-webkit-user-select:none;user-select:none}
|
|
6
|
-
`;var D=b(C(),1),w=b(k(),1),I=K(H(()=>(__graviewPreload(import.meta.url,["./chunk.
|
|
6
|
+
`;var D=b(C(),1),w=b(k(),1),I=K(H(()=>(__graviewPreload(import.meta.url,["./chunk.GZBODS7Z.js","./chunk.CANTHIRO.js","./chunk.NAEEPUWJ.js","./chunk.AQJD23AN.js","./chunk.52Y37IAD.js","./chunk.CSA6SWTI.js","./chunk.4DCPB67O.js","./chunk.Y4VOCJ7R.js","./chunk.IYVBJDR7.js","./chunk.MB7LKKUD.js","./chunk.VTCPA4V4.js","./chunk.FGJM4LJO.js","./chunk.K7WME4P4.js","./chunk.MDIAWTNK.js","./chunk.PEA4D66Y.js","./chunk.TRPPN2GD.js","./chunk.MT45H2T5.js","./chunk.S2ATSY6P.js","./chunk.72Q4R7N6.js","./chunk.G6DISMVT.js","./chunk.W54NXXC5.js","./chunk.B3T4N2XM.js","./chunk.SDO3U72B.js","./chunk.6W2DUW5S.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.DQPEVPKQ.js")))),U=I.part((t,i)=>(0,w.jsx)(t.SeveralBar,{...i}),{what:"The selection bar"});function Q(t){return t.chosen.length===0?null:(0,w.jsx)(D.Suspense,{fallback:null,children:(0,w.jsx)(U,{...t})})}var W=()=>I.prefetch();export{Y as a,$ as b,Q as c,W as d};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as k}from"./chunk.G4JJXA63.js";import{a as Q}from"./chunk.ET3XJDPX.js";import{a as Y}from"./chunk.3MU37W5D.js";import{a as X}from"./chunk.ACB4TD4W.js";import{c as _}from"./chunk.NVRK6A7T.js";import{qb as H,rb as q,vd as P,xd as z,yd as G,zd as J}from"./chunk.P4CLT32V.js";var O=e=>"failed"in e;function ue(e,n){let r=e.schema.kinds,t=e.policy?.sees;if(!t?.length||q(n))return{kinds:r};let s=H(n).roles??[],o=new Set(t.filter(i=>i.roles==="*"||s.some(a=>i.roles.includes(a))).flatMap(i=>i.kinds));return{kinds:r.filter(i=>o.has(i))}}function L(e,n){if(!n)return e;let r=new Set(n.kinds.filter(o=>e.tryDefinition(o)!==void 0));if(r.size===e.kinds.length)return e;let t=new Map,s=o=>{if(r.has(o)){if(!t.has(o)){let i=e.tryDefinition(o),a=Object.fromEntries(Object.entries(i?.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(o,{...i,edges:a})}return t.get(o)}};return{...e,definitions:e.definitions.filter(o=>r.has(o.kind)),kinds:e.kinds.filter(o=>r.has(o)),tryDefinition:s,definition:o=>{let i=s(o);if(!i)throw new Error(`Unknown node kind "${o}"`);return i}}}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 s=e.tryDefinition(t);if(!s)continue;let o=s.display?.labels??{},i=Object.entries(s.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:(o[d]??y(d)).toLowerCase()}}),a=Object.entries(s.edges??{}).map(([d,c])=>({name:d,from:t,to:c.to==="*"?e.kinds.filter(u=>u!==t):c.to,words:y(d)})),l=(s.plural??`${y(t)}s`).toLowerCase();n.push({kind:t,plural:l,noun:(s.noun??y(t)).toLowerCase(),fields:i,roles:s.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} `),v=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 s=new Set([t.plural,t.noun,`${t.noun}s`,y(t.kind),`${y(t.kind)}s`]),o=-1;for(let i of s){let a=e.indexOf(` ${i} `);a>=0&&(o<0||a<o)&&(o=a)}o>=0&&r.push({info:t,at:o})}return r.sort((t,s)=>t.at-s.at).map(t=>t.info)}function x(e,n,r){let t=n.trim().toLowerCase();if(t.length===0)return;let s=e.fields.filter(o=>!r||r(o));return s.find(o=>o.words===t||y(o.name)===t||o.name.toLowerCase()===t)??s.find(o=>o.words===v(t)||y(o.name)===v(t))??s.find(o=>t.split(" ").some(i=>i.length>2&&(o.words.split(" ").includes(i)||o.words.split(" ").includes(v(i)))))}function oe(e,n,r){let t=n.trim().toLowerCase();if(t.length!==0)return e.edges.find(s=>s.words===t||s.name.toLowerCase()===t)??e.edges.find(s=>s.to.some(o=>{let i=r.info(o);return i!==void 0&&(i.noun===v(t)||i.plural===t||y(o)===v(t))}))??e.edges.find(s=>t.split(" ").some(o=>o.length>2&&s.words.split(" ").includes(o)))}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(o=>o.type==="enum");if(n){let o=x(e,n);if(o&&o.type==="enum")return o;o&&h(`${e.plural}' ${o.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 s=r.find(o=>/^(status|stage|state|phase)$/.test(o.name));return s||(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},o=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(!o)return h(`no date field on ${e.plural}`);let i=t("end")??r.find(l=>l!==o&&/^(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:o,...i&&i!==o?{end:i}:{},...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 s=[];for(let i of e.kinds)for(let a of i.edges)for(let l of a.to){let d=e.info(l);if(!d||d.kind===i.kind)continue;let c=0;n.includes(i)&&(c+=4),n.includes(d)&&(c+=4),(Z.test(d.kind)||Z.test(d.noun))&&(c+=3),t&&(a.words.includes(t)||d.noun===v(t))&&(c+=5),a.words.split(" ").some(u=>u.length>2&&r.includes(` ${u}`))&&(c+=2),s.push({rows:i,across:d,link:a,score:c})}let o=s.sort((i,a)=>a.score-i.score)[0];return o||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,s){let o=U(t);switch(e){case"columns":{if(o){let i=x(n,o);if(!i||i.type!=="enum"){let a=oe(n,o,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,o).name}}case"calendar":{let i=ee(n,t),a=M(t);return{lens:"calendar",kind:n.kind,start:i.start.name,...i.end?{end:i.end.name}:{},...i.done?{done:i.done.name}:{},...a?{range:a}:{}}}case"timeline":{let i=ie(n);if(i&&!/\bdates?\b|\bdue\b|\bdeadlines?\b|\bmonths?\b|\byears?\b/.test(t))return{lens:"timeline",kind:n.kind,start:i.start.name,end:i.end.name,column:i.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 i=De(r,s,t,o);return{lens:"coverage",kind:i.rows.kind,across:i.across.kind,link:i.link.name}}case"board":{let i=$(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(i)||!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:i.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 i=$(n,n.roles.outline)??n.fields.find(a=>a.name==="outline");return i?{lens:"plan",kind:n.kind,outline:i.name}:h(`${n.plural} have no outline to draw a plan from`)}case"blocks":{let i={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]??(o&&!/ sort(?:ed)? by /.test(t)?o:void 0);if(a){let c=x(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`);i.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=x(n,l);if(!c)return h(`${n.plural} have nothing called ${l} to sort by`);i.sort={by:c.name,.../\b(newest|latest|desc|descending|most)\b/.test(t)?{direction:"desc"}:{}}}let d=V(n,t);return d.length>0&&(i.where=d),i}}}function V(e,n){let r=[],t=se(n);if(t){let s=e.fields.filter(A),o=$(e,e.roles.start),i=s.find(l=>E(n,l.words))??(A(o)?o:void 0)??s[0];(!i||!A(i))&&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(i.name,/\boverdue\b|\blate\b|\bpast due\b/.test(n)?a?.name:void 0),says:t.says(i)})}if(/\bonly\b|\bjust\b|\bthat are\b|\bwhich are\b/.test(n)){for(let s of e.fields){if(s.type!=="enum")continue;let o=s.options?.find(i=>E(n,i.toLowerCase())||E(n,y(i)));o&&r.push({expr:`${s.name} == '${o.replace(/'/g,"")}'`,says:`that are ${y(o)}`})}if(/\bnot done\b|\bundone\b|\bunfinished\b|\bopen ones\b|\bstill to do\b/.test(n)){let s=e.fields.find(o=>o.type==="boolean"&&/^(done|finished|complete|completed)$/.test(o.name));s&&r.push({expr:`not ${s.name}`,says:`not ${s.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=s=>s?$(r,s)?.words??y(s):"";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 s=e.range??"month";if(s==="agenda")return{title:`${k(r.plural)} in date order`,detail:`of ${r.plural} in order of ${t(e.start)}`};let o=s==="years"?"year":s;return{title:`${k(r.plural)} by ${o}`,detail:`of ${r.plural} by ${t(e.start)}, a ${o} 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 s=n.info(e.across);return{title:`${k(r.plural)} by ${s.noun}`,detail:`of which ${s.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 s=[e.where?.map(o=>o.says).join(" and "),e.group?`by ${t(e.group)}`:void 0,e.sort?`in order of ${t(e.sort.by)}`:void 0].filter(o=>!!o);return{title:[k(r.plural),...s].join(" "),detail:[`of ${r.plural}`,...s].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(o=>e.where.length>1?`(${o.expr})`:o.expr).join(" and ")}`:"",s={list:`all('${e.kind}')${t}`,as:e.as??"row"};return e.group&&(s.group=e.group),e.sort&&(s.sort=e.sort.direction?{by:e.sort.by,direction:e.sort.direction}:e.sort.by),s.empty="Nothing here yet.",{name:"blocks",...r,options:{blocks:[s]}}}}}function C(e,n){let{app:r}=n,t=o=>o.toLowerCase().replace(/[^\p{L}\p{N}]+/gu,"-").replace(/^-+|-+$/g,""),s=new Set(["home","overview",...Q(r,n.views?{views:n.views}:{}).map(o=>o.slug),...(r.lenses??[]).flatMap(o=>o.title?[t(o.title)]:[])]);if(!s.has(t(e)))return e;for(let o=2;;o++)if(!s.has(t(`${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=(i,a)=>{if(typeof i!="string"||i.trim()==="")return`its ${a} says nothing`;try{return _(i)}catch(l){return`its ${a} does not read: ${l instanceof Error?l.message.replace(/ \(at character.*$/,""):String(l)}`}},t=i=>{if(i.t==="where")return t(i.set);if(i.t==="call"&&i.fn==="all"){let a=i.args[0];return a?.t==="lit"&&typeof a.value=="string"?e.info(a.value)??null:void 0}},s=(i,a)=>{switch(i.t){case"lit":return;case"ident":return a&&!a.fields.some(l=>l.name===i.name)&&!a.edges.some(l=>l.name===i.name)?`${a.plural} have nothing called ${i.name}`:void 0;case"member":return s(i.object,a);case"list":return i.items.map(l=>s(l,a)).find(Boolean);case"unary":return s(i.operand,a);case"binary":return s(i.left,a)??s(i.right,a);case"where":{let l=t(i.set);return l===null?"Nothing by that name here":s(i.set,a)??s(i.filter,l??void 0)}case"call":return i.fn==="all"?t(i)===null?"Nothing by that name here":void 0:i.args.map(l=>s(l,a)).find(Boolean)}},o=(i,a)=>{if(a>4)return"its blocks nest deeper than a place draws";for(let l of i){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=s(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=o(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=o(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=s(f,void 0);if(m)return m}}}};return o(n,1)}function T(e,n,r){let t=L(e.schema,r),s=f=>({ok:!1,failed:`Couldn't draw that: ${f.replace(/\.$/,"")}.`});if(!G(n.name)||n.name==="reach")return s(`"${String(n.name)}" is not a picture the seat can draw; it draws ${z.filter(f=>f!=="reach").join(", ")}`);if(typeof n.title!="string"||n.title.trim().length===0||n.title.length>80)return s("it needs a title of a few words");if(typeof n.on!="string"||!t.tryDefinition(n.on))return s("Nothing by that name here");let o=P[n.name],i=n.bindings??{};if(o.binds==="fields")for(let[f,m]of Object.entries(i)){if(!t.tryDefinition(f))return s("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 s(`${y(f)} has no field "${String(D)}" for its ${S}`);for(let S of o.requiredRoles)if(!(S in(m??{})))return s(`a ${n.name} needs ${y(f)}'s ${S}`)}else if(o.binds==="entities")for(let f of o.requiredRoles){let m=i[f];if(!m)return s(`a ${n.name} needs its ${f}`);if(typeof m.kind=="string"&&!t.tryDefinition(m.kind))return s("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 s(u.message.replace(/^"[^"]*" /,"it "));let p=d.undrawn.find(f=>f.index===l);if(p)return s(p.why);let g=d.drawn.find(f=>f.index===l);if(!g)return s("its bindings name something the app does not have");if(g.as==="overview")return s(`"${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 s(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 ve(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,s=typeof n.on=="string"?n.on:w(t)&&P[r]?.binds==="fields"?Object.keys(t)[0]??"":"";return{name:r,title:typeof n.title=="string"?n.title.trim():"",on:s,...w(t)?{bindings:t}:{},...w(n.options)?{options:n.options}:{}}}function xe(e){let n=s=>w(e.bindings?.[s])?e.bindings[s]:{},r=s=>typeof s=="string"?s: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 s=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}:{},...s?{range:s}:{}}: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 s=w(e.bindings?.columns)?r(e.bindings.columns.kind):void 0,o=w(e.bindings?.link)?r(e.bindings.link.edge):void 0;return s&&o?{lens:"coverage",kind:e.on,across:s,link:o}:void 0}case"blocks":{let s=e.options?.blocks;if(!Array.isArray(s)||s.length!==1||!w(s[0]))return;let o=s[0],i=new RegExp(`^all\\('${e.on}'\\)(?: where (.+))?$`).exec(String(o.list??""));if(!i)return;let a=o.sort;return{lens:"blocks",kind:e.on,as:o.as==="card"?"card":"row",...typeof o.group=="string"?{group:o.group}:{},...typeof a=="string"?{sort:{by:a}}:w(a)&&typeof a.by=="string"?{sort:{by:a.by,...a.direction==="desc"?{direction:"desc"}:{}}}:{},...i[1]?{where:[{expr:i[1],says:"as asked"}]}:{}}}default:return}}function W(e,n,r,t,s){let o=I(L(e.schema,t)).info(n.on),i=xe(n);return{title:n.title,said:`${B[n.name]??"A picture"} of ${o?.plural??y(n.on)}.`,kind:n.on,lens:n,drawn:r,edit:K(n),by:s,asks:[],...i?{recipe:i}:{}}}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,s){let o=Re(e,n),i=e.title??s??C(o.title,r),a=Ae(e,i),l=T(r.app,a,r.sight);return l.ok?{title:i,said:`${B[e.lens]} ${o.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 s=e.lens==="blocks"&&!e.group&&!e.sort&&!e.where?.length&&e.title===void 0;return F(s?{...e,title:C(`Every ${t.noun}`,n)}:e,r,n,[])}function Le(e,n,r,t){if(r.length>0)return r;let s=i=>{switch(e){case"columns":return i.fields.some(a=>a.type==="enum");case"calendar":return i.fields.some(A);case"timeline":return ie(i)!==void 0||i.fields.some(A);case"coverage":return i.edges.some(a=>a.to.some(l=>l!==i.kind));case"board":return i.fields.some(a=>a.name==="x")&&i.fields.some(a=>a.name==="y");case"plan":return i.fields.some(a=>a.name==="outline")||i.roles.outline!==void 0;default:return!0}};return[...n.kinds.filter(s)].sort((i,a)=>Number(a.fields.some(l=>E(t,l.words)))-Number(i.fields.some(l=>E(t,l.words))))}function Ie(e,n){let r=I(L(n.app.schema,n.sight)),t=re(e),s=$e(t);if(s.length===0)return;let o=pe(t,r),i;for(let a of s){let l=a==="coverage"?[o[0]??r.kinds[0]].filter(d=>!!d):Le(a,r,o,t);for(let d of l)try{let c=ae(a,d,r,t,o),u=F(c,r,n,[e]);if(!O(u))return u;i??=u.failed}catch(c){if(!(c instanceof j))throw c;i??=`Couldn't draw that: ${c.message}.`}l.length===0&&o.length===0&&(i??=`Couldn't draw that: nothing here has what ${B[a].toLowerCase()} needs.`)}return{failed:i??"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 s=await le(e,n,void 0);return O(s)&&t?t:s}async function je(e,n,r){let t={lastGood:e},s={...r,lastGood:e},o=I(L(r.app.schema,r.sight)),i=re(n),a=o.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(i)??/ (?:call|name) it (.+?) $/.exec(i);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)},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(i);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,o,i,[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),o,s,l)}if(d){let g=Te(d,a,o,i);if(g)return F(g,o,s,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,s,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 s=/ (?: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(s){let d=x(n,s);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,s,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 ${s} to group by`)}let o=/ (?:sort(?:ed)?|order(?:ed)?) by ([\p{L}\p{N} -]+?)(?= (?:and|only|with)|\s*$)/u.exec(t)?.[1];if(o){let d=x(n,o);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 ${o} 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 i=se(t);if(i&&e.lens==="calendar"&&i.range)return{...R(e),range:i.range};if(i&&e.lens==="calendar"&&!i.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(o=>`${o.name} (${o.type??"value"}${o.options?`: ${o.options.join(" | ")}`:""})`).join(", "),t=n.edges.map(o=>`${o.name} \u2192 ${o.to.join(" | ")}`).join(", "),s=Object.entries(n.roles).map(([o,i])=>`${o}=${i}`).join(", ");return`- ${n.kind} ("${n.plural}"): ${r}${t?`; relations: ${t}`:""}${s?`; roles: ${s}`:""}`}).join(`
|
|
1
|
+
import{a as k}from"./chunk.G4JJXA63.js";import{a as Q}from"./chunk.CSA6SWTI.js";import{a as Y}from"./chunk.3FUFVVR4.js";import{a as X}from"./chunk.FGJM4LJO.js";import{c as _}from"./chunk.PEA4D66Y.js";import{Ad as J,qb as H,rb as q,wd as P,yd as z,zd as G}from"./chunk.6W2DUW5S.js";var O=e=>"failed"in e;function ue(e,n){let r=e.schema.kinds,t=e.policy?.sees;if(!t?.length||q(n))return{kinds:r};let s=H(n).roles??[],o=new Set(t.filter(i=>i.roles==="*"||s.some(a=>i.roles.includes(a))).flatMap(i=>i.kinds));return{kinds:r.filter(i=>o.has(i))}}function L(e,n){if(!n)return e;let r=new Set(n.kinds.filter(o=>e.tryDefinition(o)!==void 0));if(r.size===e.kinds.length)return e;let t=new Map,s=o=>{if(r.has(o)){if(!t.has(o)){let i=e.tryDefinition(o),a=Object.fromEntries(Object.entries(i?.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(o,{...i,edges:a})}return t.get(o)}};return{...e,definitions:e.definitions.filter(o=>r.has(o.kind)),kinds:e.kinds.filter(o=>r.has(o)),tryDefinition:s,definition:o=>{let i=s(o);if(!i)throw new Error(`Unknown node kind "${o}"`);return i}}}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 s=e.tryDefinition(t);if(!s)continue;let o=s.display?.labels??{},i=Object.entries(s.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:(o[d]??y(d)).toLowerCase()}}),a=Object.entries(s.edges??{}).map(([d,c])=>({name:d,from:t,to:c.to==="*"?e.kinds.filter(u=>u!==t):c.to,words:y(d)})),l=(s.plural??`${y(t)}s`).toLowerCase();n.push({kind:t,plural:l,noun:(s.noun??y(t)).toLowerCase(),fields:i,roles:s.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} `),v=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 s=new Set([t.plural,t.noun,`${t.noun}s`,y(t.kind),`${y(t.kind)}s`]),o=-1;for(let i of s){let a=e.indexOf(` ${i} `);a>=0&&(o<0||a<o)&&(o=a)}o>=0&&r.push({info:t,at:o})}return r.sort((t,s)=>t.at-s.at).map(t=>t.info)}function x(e,n,r){let t=n.trim().toLowerCase();if(t.length===0)return;let s=e.fields.filter(o=>!r||r(o));return s.find(o=>o.words===t||y(o.name)===t||o.name.toLowerCase()===t)??s.find(o=>o.words===v(t)||y(o.name)===v(t))??s.find(o=>t.split(" ").some(i=>i.length>2&&(o.words.split(" ").includes(i)||o.words.split(" ").includes(v(i)))))}function oe(e,n,r){let t=n.trim().toLowerCase();if(t.length!==0)return e.edges.find(s=>s.words===t||s.name.toLowerCase()===t)??e.edges.find(s=>s.to.some(o=>{let i=r.info(o);return i!==void 0&&(i.noun===v(t)||i.plural===t||y(o)===v(t))}))??e.edges.find(s=>t.split(" ").some(o=>o.length>2&&s.words.split(" ").includes(o)))}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(o=>o.type==="enum");if(n){let o=x(e,n);if(o&&o.type==="enum")return o;o&&h(`${e.plural}' ${o.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 s=r.find(o=>/^(status|stage|state|phase)$/.test(o.name));return s||(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},o=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(!o)return h(`no date field on ${e.plural}`);let i=t("end")??r.find(l=>l!==o&&/^(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:o,...i&&i!==o?{end:i}:{},...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 s=[];for(let i of e.kinds)for(let a of i.edges)for(let l of a.to){let d=e.info(l);if(!d||d.kind===i.kind)continue;let c=0;n.includes(i)&&(c+=4),n.includes(d)&&(c+=4),(Z.test(d.kind)||Z.test(d.noun))&&(c+=3),t&&(a.words.includes(t)||d.noun===v(t))&&(c+=5),a.words.split(" ").some(u=>u.length>2&&r.includes(` ${u}`))&&(c+=2),s.push({rows:i,across:d,link:a,score:c})}let o=s.sort((i,a)=>a.score-i.score)[0];return o||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,s){let o=U(t);switch(e){case"columns":{if(o){let i=x(n,o);if(!i||i.type!=="enum"){let a=oe(n,o,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,o).name}}case"calendar":{let i=ee(n,t),a=M(t);return{lens:"calendar",kind:n.kind,start:i.start.name,...i.end?{end:i.end.name}:{},...i.done?{done:i.done.name}:{},...a?{range:a}:{}}}case"timeline":{let i=ie(n);if(i&&!/\bdates?\b|\bdue\b|\bdeadlines?\b|\bmonths?\b|\byears?\b/.test(t))return{lens:"timeline",kind:n.kind,start:i.start.name,end:i.end.name,column:i.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 i=De(r,s,t,o);return{lens:"coverage",kind:i.rows.kind,across:i.across.kind,link:i.link.name}}case"board":{let i=$(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(i)||!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:i.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 i=$(n,n.roles.outline)??n.fields.find(a=>a.name==="outline");return i?{lens:"plan",kind:n.kind,outline:i.name}:h(`${n.plural} have no outline to draw a plan from`)}case"blocks":{let i={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]??(o&&!/ sort(?:ed)? by /.test(t)?o:void 0);if(a){let c=x(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`);i.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=x(n,l);if(!c)return h(`${n.plural} have nothing called ${l} to sort by`);i.sort={by:c.name,.../\b(newest|latest|desc|descending|most)\b/.test(t)?{direction:"desc"}:{}}}let d=V(n,t);return d.length>0&&(i.where=d),i}}}function V(e,n){let r=[],t=se(n);if(t){let s=e.fields.filter(A),o=$(e,e.roles.start),i=s.find(l=>E(n,l.words))??(A(o)?o:void 0)??s[0];(!i||!A(i))&&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(i.name,/\boverdue\b|\blate\b|\bpast due\b/.test(n)?a?.name:void 0),says:t.says(i)})}if(/\bonly\b|\bjust\b|\bthat are\b|\bwhich are\b/.test(n)){for(let s of e.fields){if(s.type!=="enum")continue;let o=s.options?.find(i=>E(n,i.toLowerCase())||E(n,y(i)));o&&r.push({expr:`${s.name} == '${o.replace(/'/g,"")}'`,says:`that are ${y(o)}`})}if(/\bnot done\b|\bundone\b|\bunfinished\b|\bopen ones\b|\bstill to do\b/.test(n)){let s=e.fields.find(o=>o.type==="boolean"&&/^(done|finished|complete|completed)$/.test(o.name));s&&r.push({expr:`not ${s.name}`,says:`not ${s.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=s=>s?$(r,s)?.words??y(s):"";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 s=e.range??"month";if(s==="agenda")return{title:`${k(r.plural)} in date order`,detail:`of ${r.plural} in order of ${t(e.start)}`};let o=s==="years"?"year":s;return{title:`${k(r.plural)} by ${o}`,detail:`of ${r.plural} by ${t(e.start)}, a ${o} 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 s=n.info(e.across);return{title:`${k(r.plural)} by ${s.noun}`,detail:`of which ${s.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 s=[e.where?.map(o=>o.says).join(" and "),e.group?`by ${t(e.group)}`:void 0,e.sort?`in order of ${t(e.sort.by)}`:void 0].filter(o=>!!o);return{title:[k(r.plural),...s].join(" "),detail:[`of ${r.plural}`,...s].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(o=>e.where.length>1?`(${o.expr})`:o.expr).join(" and ")}`:"",s={list:`all('${e.kind}')${t}`,as:e.as??"row"};return e.group&&(s.group=e.group),e.sort&&(s.sort=e.sort.direction?{by:e.sort.by,direction:e.sort.direction}:e.sort.by),s.empty="Nothing here yet.",{name:"blocks",...r,options:{blocks:[s]}}}}}function C(e,n){let{app:r}=n,t=o=>o.toLowerCase().replace(/[^\p{L}\p{N}]+/gu,"-").replace(/^-+|-+$/g,""),s=new Set(["home","overview",...Q(r,n.views?{views:n.views}:{}).map(o=>o.slug),...(r.lenses??[]).flatMap(o=>o.title?[t(o.title)]:[])]);if(!s.has(t(e)))return e;for(let o=2;;o++)if(!s.has(t(`${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=(i,a)=>{if(typeof i!="string"||i.trim()==="")return`its ${a} says nothing`;try{return _(i)}catch(l){return`its ${a} does not read: ${l instanceof Error?l.message.replace(/ \(at character.*$/,""):String(l)}`}},t=i=>{if(i.t==="where")return t(i.set);if(i.t==="call"&&i.fn==="all"){let a=i.args[0];return a?.t==="lit"&&typeof a.value=="string"?e.info(a.value)??null:void 0}},s=(i,a)=>{switch(i.t){case"lit":return;case"ident":return a&&!a.fields.some(l=>l.name===i.name)&&!a.edges.some(l=>l.name===i.name)?`${a.plural} have nothing called ${i.name}`:void 0;case"member":return s(i.object,a);case"list":return i.items.map(l=>s(l,a)).find(Boolean);case"unary":return s(i.operand,a);case"binary":return s(i.left,a)??s(i.right,a);case"where":{let l=t(i.set);return l===null?"Nothing by that name here":s(i.set,a)??s(i.filter,l??void 0)}case"call":return i.fn==="all"?t(i)===null?"Nothing by that name here":void 0:i.args.map(l=>s(l,a)).find(Boolean)}},o=(i,a)=>{if(a>4)return"its blocks nest deeper than a place draws";for(let l of i){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=s(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=o(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=o(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=s(f,void 0);if(m)return m}}}};return o(n,1)}function T(e,n,r){let t=L(e.schema,r),s=f=>({ok:!1,failed:`Couldn't draw that: ${f.replace(/\.$/,"")}.`});if(!G(n.name)||n.name==="reach")return s(`"${String(n.name)}" is not a picture the seat can draw; it draws ${z.filter(f=>f!=="reach").join(", ")}`);if(typeof n.title!="string"||n.title.trim().length===0||n.title.length>80)return s("it needs a title of a few words");if(typeof n.on!="string"||!t.tryDefinition(n.on))return s("Nothing by that name here");let o=P[n.name],i=n.bindings??{};if(o.binds==="fields")for(let[f,m]of Object.entries(i)){if(!t.tryDefinition(f))return s("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 s(`${y(f)} has no field "${String(D)}" for its ${S}`);for(let S of o.requiredRoles)if(!(S in(m??{})))return s(`a ${n.name} needs ${y(f)}'s ${S}`)}else if(o.binds==="entities")for(let f of o.requiredRoles){let m=i[f];if(!m)return s(`a ${n.name} needs its ${f}`);if(typeof m.kind=="string"&&!t.tryDefinition(m.kind))return s("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 s(u.message.replace(/^"[^"]*" /,"it "));let p=d.undrawn.find(f=>f.index===l);if(p)return s(p.why);let g=d.drawn.find(f=>f.index===l);if(!g)return s("its bindings name something the app does not have");if(g.as==="overview")return s(`"${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 s(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 ve(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,s=typeof n.on=="string"?n.on:w(t)&&P[r]?.binds==="fields"?Object.keys(t)[0]??"":"";return{name:r,title:typeof n.title=="string"?n.title.trim():"",on:s,...w(t)?{bindings:t}:{},...w(n.options)?{options:n.options}:{}}}function xe(e){let n=s=>w(e.bindings?.[s])?e.bindings[s]:{},r=s=>typeof s=="string"?s: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 s=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}:{},...s?{range:s}:{}}: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 s=w(e.bindings?.columns)?r(e.bindings.columns.kind):void 0,o=w(e.bindings?.link)?r(e.bindings.link.edge):void 0;return s&&o?{lens:"coverage",kind:e.on,across:s,link:o}:void 0}case"blocks":{let s=e.options?.blocks;if(!Array.isArray(s)||s.length!==1||!w(s[0]))return;let o=s[0],i=new RegExp(`^all\\('${e.on}'\\)(?: where (.+))?$`).exec(String(o.list??""));if(!i)return;let a=o.sort;return{lens:"blocks",kind:e.on,as:o.as==="card"?"card":"row",...typeof o.group=="string"?{group:o.group}:{},...typeof a=="string"?{sort:{by:a}}:w(a)&&typeof a.by=="string"?{sort:{by:a.by,...a.direction==="desc"?{direction:"desc"}:{}}}:{},...i[1]?{where:[{expr:i[1],says:"as asked"}]}:{}}}default:return}}function W(e,n,r,t,s){let o=I(L(e.schema,t)).info(n.on),i=xe(n);return{title:n.title,said:`${B[n.name]??"A picture"} of ${o?.plural??y(n.on)}.`,kind:n.on,lens:n,drawn:r,edit:K(n),by:s,asks:[],...i?{recipe:i}:{}}}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,s){let o=Re(e,n),i=e.title??s??C(o.title,r),a=Ae(e,i),l=T(r.app,a,r.sight);return l.ok?{title:i,said:`${B[e.lens]} ${o.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 s=e.lens==="blocks"&&!e.group&&!e.sort&&!e.where?.length&&e.title===void 0;return F(s?{...e,title:C(`Every ${t.noun}`,n)}:e,r,n,[])}function Le(e,n,r,t){if(r.length>0)return r;let s=i=>{switch(e){case"columns":return i.fields.some(a=>a.type==="enum");case"calendar":return i.fields.some(A);case"timeline":return ie(i)!==void 0||i.fields.some(A);case"coverage":return i.edges.some(a=>a.to.some(l=>l!==i.kind));case"board":return i.fields.some(a=>a.name==="x")&&i.fields.some(a=>a.name==="y");case"plan":return i.fields.some(a=>a.name==="outline")||i.roles.outline!==void 0;default:return!0}};return[...n.kinds.filter(s)].sort((i,a)=>Number(a.fields.some(l=>E(t,l.words)))-Number(i.fields.some(l=>E(t,l.words))))}function Ie(e,n){let r=I(L(n.app.schema,n.sight)),t=re(e),s=$e(t);if(s.length===0)return;let o=pe(t,r),i;for(let a of s){let l=a==="coverage"?[o[0]??r.kinds[0]].filter(d=>!!d):Le(a,r,o,t);for(let d of l)try{let c=ae(a,d,r,t,o),u=F(c,r,n,[e]);if(!O(u))return u;i??=u.failed}catch(c){if(!(c instanceof j))throw c;i??=`Couldn't draw that: ${c.message}.`}l.length===0&&o.length===0&&(i??=`Couldn't draw that: nothing here has what ${B[a].toLowerCase()} needs.`)}return{failed:i??"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 s=await le(e,n,void 0);return O(s)&&t?t:s}async function je(e,n,r){let t={lastGood:e},s={...r,lastGood:e},o=I(L(r.app.schema,r.sight)),i=re(n),a=o.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(i)??/ (?:call|name) it (.+?) $/.exec(i);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)},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(i);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,o,i,[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),o,s,l)}if(d){let g=Te(d,a,o,i);if(g)return F(g,o,s,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,s,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 s=/ (?: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(s){let d=x(n,s);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,s,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 ${s} to group by`)}let o=/ (?:sort(?:ed)?|order(?:ed)?) by ([\p{L}\p{N} -]+?)(?= (?:and|only|with)|\s*$)/u.exec(t)?.[1];if(o){let d=x(n,o);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 ${o} 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 i=se(t);if(i&&e.lens==="calendar"&&i.range)return{...R(e),range:i.range};if(i&&e.lens==="calendar"&&!i.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(o=>`${o.name} (${o.type??"value"}${o.options?`: ${o.options.join(" | ")}`:""})`).join(", "),t=n.edges.map(o=>`${o.name} \u2192 ${o.to.join(" | ")}`).join(", "),s=Object.entries(n.roles).map(([o,i])=>`${o}=${i}`).join(", ");return`- ${n.kind} ("${n.plural}"): ${r}${t?`; relations: ${t}`:""}${s?`; roles: ${s}`:""}`}).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)}
|
|
@@ -0,0 +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{b as v}from"./chunk.TLQTDKOL.js";import"./chunk.G6DISMVT.js";import"./chunk.W54NXXC5.js";import{G as S,S as y,T as b}from"./chunk.B3T4N2XM.js";import"./chunk.SDO3U72B.js";import"./chunk.6W2DUW5S.js";import"./chunk.SLBWPVIY.js";import{b as u}from"./chunk.AJZBJBMO.js";var r=u(S(),1);var t=u(b(),1);function E(o){let a=(0,r.useContext)(y),l=(0,t.jsx)(C,{...o});return!a||o.nodeId===void 0?l:(0,t.jsx)(P,{nodeId:o.nodeId,field:o.field,label:o.label,...o.markdown?{markdown:!0}:{},live:a,onDone:d=>o.onDone?o.onDone(d):o.onCancel(),writtenWhole:l})}var P=(0,r.lazy)(()=>(__graviewPreload(import.meta.url,["./chunk.TLQTDKOL.js","./chunk.G6DISMVT.js","./chunk.W54NXXC5.js","./chunk.B3T4N2XM.js","./chunk.SDO3U72B.js","./chunk.6W2DUW5S.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.GGHZEAAT.js")));function C({field:o,label:a,value:l,markdown:d,onSave:s,onCancel:c}){let[i,h]=(0,r.useState)(l),[n,w]=(0,r.useState)(!1),f=(0,r.useRef)(null);return(0,r.useEffect)(()=>f.current?.focus(),[n]),(0,r.useLayoutEffect)(()=>{let e=f.current;if(!e||n||typeof CSS<"u"&&CSS.supports?.("field-sizing","content"))return;let p=()=>{e.style.height="auto";let m=getComputedStyle(e);e.style.height=`${e.scrollHeight+parseFloat(m.borderTopWidth)+parseFloat(m.borderBottomWidth)}px`};p();let x=requestAnimationFrame(p);return()=>cancelAnimationFrame(x)},[i,n]),(0,t.jsxs)("form",{style:{display:"grid",gap:8,minWidth:0},onSubmit:e=>{e.preventDefault(),s(i,!1)},children:[n?(0,t.jsx)("div",{"data-graview-preview":o,"aria-label":`${a}, as it will read`,role:"region",style:k,children:(0,t.jsx)(v,{text:i,markdown:!0})}):(0,t.jsx)("textarea",{ref:f,"aria-label":a,"data-graview-field":o,value:i,rows:3,onChange:e=>h(e.target.value),onKeyDown:e=>{e.key==="Escape"?(e.preventDefault(),c()):e.key==="Enter"&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),s(i,!1))},onBlur:e=>{e.relatedTarget instanceof Node&&e.currentTarget.form?.contains(e.relatedTarget)||s(i,!0)},style:T}),(0,t.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:8},children:[(0,t.jsx)("button",{type:"submit",style:g,children:"Save"}),(0,t.jsx)("button",{type:"button",onClick:c,style:g,children:"Cancel"}),d?(0,t.jsx)("button",{type:"button","aria-pressed":n,onClick:()=>w(!n),style:g,children:n?"Write":"Preview"}):null,(0,t.jsx)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)"},children:"Ctrl or \u2318 Enter saves \xB7 Esc puts it back"})]})]})}var k={minHeight:"7.5em",padding:"8px 10px",border:"1px dashed var(--graview-edge-bright)",borderRadius:6,lineHeight:1.6,minWidth:0},g={font:"inherit",fontSize:"0.8125rem",minHeight:28,padding:"2px 12px"},T={font:"inherit",lineHeight:1.5,width:"100%",boxSizing:"border-box",minHeight:"7.5em",padding:"8px 10px",resize:"vertical",fieldSizing:"content",color:"var(--graview-ink)",background:"var(--graview-panel, transparent)",border:"1px solid var(--graview-edge-bright)",borderRadius:6};export{E as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{G as T}from"./chunk.
|
|
1
|
+
import{G as T}from"./chunk.B3T4N2XM.js";import{b as g}from"./chunk.AJZBJBMO.js";var s=g(T(),1),m="data-graview-roving",E="data-graview-roving-item",L={ArrowDown:{column:1,both:1},ArrowUp:{column:-1,both:-1},ArrowRight:{column:0,both:1},ArrowLeft:{column:0,both:-1}},w=e=>e instanceof HTMLElement&&(e.isContentEditable||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement||e instanceof HTMLInputElement&&!["button","checkbox","radio","submit"].includes(e.type));function p(e){return[...e.querySelectorAll(`[${E}]`)].filter(c=>c.closest(`[${m}]`)===e&&!c.disabled&&c.getAttribute("aria-hidden")!=="true")}var M=e=>(e.textContent?.trim()||e.getAttribute("aria-label")||"").toLowerCase();function H({flow:e="column",letters:c=!1}={}){let a=(0,s.useRef)(null),i=(0,s.useRef)(null),f=(0,s.useCallback)(()=>{let t=a.current;if(!t)return;let n=p(t);if(n.length===0)return;let o=typeof document>"u"?null:document.activeElement,u=n.find(r=>r===o)??(i.current&&n.includes(i.current)?i.current:n[0]);for(let r of n){let l=r===u?"0":"-1";r.getAttribute("tabindex")!==l&&r.setAttribute("tabindex",l)}},[]);(0,s.useLayoutEffect)(f);let d=t=>{t&&(i.current=t,t.focus(),f())};return{ref:a,[m]:c?"letters":"",onFocus:t=>{let n=t.target.closest?.(`[${E}]`);n&&n.closest(`[${m}]`)===a.current&&i.current!==n&&(i.current=n,f())},onKeyDown:t=>{let n=a.current;if(!n||t.metaKey||t.ctrlKey||t.altKey||w(t.target))return;let o=p(n),u=o.findIndex(l=>l===t.target||l.contains(t.target));if(u<0)return;let r=L[t.key]?.[e];if(r){t.preventDefault(),t.stopPropagation(),d(o[Math.max(0,Math.min(o.length-1,u+r))]);return}if(t.key==="Home"||t.key==="End"){t.preventDefault(),t.stopPropagation(),d(t.key==="Home"?o[0]:o[o.length-1]);return}if(c&&t.key.length===1&&t.key.trim()!==""){let l=t.key.toLowerCase(),y=[...o.slice(u+1),...o.slice(0,u+1)].find(b=>M(b).startsWith(l));if(!y)return;t.preventDefault(),t.stopPropagation(),d(y)}}}}export{E as a,H as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{Ma as y,Oa as k,T as w,j as c,l as h,m as b,r as f}from"./chunk.B3T4N2XM.js";import{U as i}from"./chunk.6W2DUW5S.js";import{b as g}from"./chunk.AJZBJBMO.js";var s=null,a=new Set,v=e=>{s={kind:e,n:(s?.n??0)+1};for(let t of a)t()},A=()=>s,C=e=>(a.add(e),()=>a.delete(e)),V=()=>{s=null};var d=g(w(),1);function T(e,t){if(e.length===0||t.length===0)return[];let o=new Set(t.map(n=>n.id));return e.filter(n=>n.nodeIds.some(l=>o.has(l)))}var x=(e,t)=>`${i(e)} ${e===1?"problem":"problems"} in ${t}`;function q({kind:e,plural:t,problems:o,flag:n,listed:l=!1}){let{view:p,go:P}=k(),{set:$}=y();if(o.length===0)return null;let u=x(o.length,t),m=o.length===1?"it":"them";return(0,d.jsx)("button",{type:"button",className:"graview-district-problems","data-testid":`district-problems-${e}`,"data-graview-problems":o.length,"aria-expanded":l,"aria-label":u,title:`${u} \u2014 ${o[0].message}${o.length>1?` (and ${i(o.length-1)} more)`:""}. Press to see ${m} and how to fix ${m}.`,onClick:r=>{r.stopPropagation(),p.overview||P(h(c(b(p,!0),null),"view",null)),$([f(e)]),v(e)},onDoubleClick:r=>r.stopPropagation(),onPointerDown:r=>r.stopPropagation(),children:(0,d.jsx)("span",{"aria-hidden":"true",children:`${n} ${i(o.length)}`})})}export{A as a,C as b,V as c,T as d,x as e,q as f};
|
|
@@ -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 Ye}from"./chunk.SDO3U72B.js";import{Ga as Xn,J as Zn,Ka as kt,Kd as so,Ma as Jn,Oc as to,Od as lo,Qd as Ue,Rd as Rt,Ya as Qn,Yc as no,_c as oo,bd as ro,ed as io,rc as eo,ud as ao}from"./chunk.6W2DUW5S.js";import{a as $e,b as _}from"./chunk.AJZBJBMO.js";var To=$e(w=>{"use strict";var _t=Symbol.for("react.transitional.element"),ti=Symbol.for("react.portal"),ni=Symbol.for("react.fragment"),oi=Symbol.for("react.strict_mode"),ri=Symbol.for("react.profiler"),ii=Symbol.for("react.consumer"),ai=Symbol.for("react.context"),si=Symbol.for("react.forward_ref"),li=Symbol.for("react.suspense"),di=Symbol.for("react.memo"),xo=Symbol.for("react.lazy"),ui=Symbol.for("react.activity"),So=Symbol.iterator;function ci(e){return e===null||typeof e!="object"?null:(e=So&&e[So]||e["@@iterator"],typeof e=="function"?e:null)}var Eo={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Po=Object.assign,Ao={};function he(e,t,n){this.props=e,this.context=t,this.refs=Ao,this.updater=n||Eo}he.prototype.isReactComponent={};he.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")};he.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function ko(){}ko.prototype=he.prototype;function Ht(e,t,n){this.props=e,this.context=t,this.refs=Ao,this.updater=n||Eo}var Dt=Ht.prototype=new ko;Dt.constructor=Ht;Po(Dt,he.prototype);Dt.isPureReactComponent=!0;var wo=Array.isArray;function Lt(){}var O={H:null,A:null,T:null,S:null},Ro=Object.prototype.hasOwnProperty;function Nt(e,t,n){var o=n.ref;return{$$typeof:_t,type:e,key:t,ref:o!==void 0?o:null,props:n}}function fi(e,t){return Nt(e.type,t,e.props)}function jt(e){return typeof e=="object"&&e!==null&&e.$$typeof===_t}function pi(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var vo=/\/+/g;function It(e,t){return typeof e=="object"&&e!==null&&e.key!=null?pi(""+e.key):t.toString(36)}function yi(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(Lt,Lt):(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 ge(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 _t:case ti:a=!0;break;case xo:return a=e._init,ge(a(e._payload),t,n,o,r)}}if(a)return r=r(e),a=o===""?"."+It(e,0):o,wo(r)?(n="",a!=null&&(n=a.replace(vo,"$&/")+"/"),ge(r,t,n,"",function(c){return c})):r!=null&&(jt(r)&&(r=fi(r,n+(r.key==null||e&&e.key===r.key?"":(""+r.key).replace(vo,"$&/")+"/")+a)),t.push(r)),1;a=0;var s=o===""?".":o+":";if(wo(e))for(var l=0;l<e.length;l++)o=e[l],i=s+It(o,l),a+=ge(o,t,n,i,r);else if(l=ci(e),typeof l=="function")for(e=l.call(e),l=0;!(o=e.next()).done;)o=o.value,i=s+It(o,l++),a+=ge(o,t,n,i,r);else if(i==="object"){if(typeof e.then=="function")return ge(yi(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 ot(e,t,n){if(e==null)return e;var o=[],r=0;return ge(e,o,"","",function(i){return t.call(n,i,r++)}),o}function mi(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 bo=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)},gi={map:ot,forEach:function(e,t,n){ot(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return ot(e,function(){t++}),t},toArray:function(e){return ot(e,function(t){return t})||[]},only:function(e){if(!jt(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};w.Activity=ui;w.Children=gi;w.Component=he;w.Fragment=ni;w.Profiler=ri;w.PureComponent=Ht;w.StrictMode=oi;w.Suspense=li;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=Po({},e.props),r=e.key;if(t!=null)for(i in t.key!==void 0&&(r=""+t.key),t)!Ro.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),s=0;s<i;s++)a[s]=arguments[s+2];o.children=a}return Nt(e.type,r,o)};w.createContext=function(e){return e={$$typeof:ai,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:ii,_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)Ro.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 s=Array(a),l=0;l<a;l++)s[l]=arguments[l+2];r.children=s}if(e&&e.defaultProps)for(o in a=e.defaultProps,a)r[o]===void 0&&(r[o]=a[o]);return Nt(e,i,r)};w.createRef=function(){return{current:null}};w.forwardRef=function(e){return{$$typeof:si,render:e}};w.isValidElement=jt;w.lazy=function(e){return{$$typeof:xo,_payload:{_status:-1,_result:e},_init:mi}};w.memo=function(e,t){return{$$typeof:di,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(Lt,bo)}catch(i){bo(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 N=$e((es,Mo)=>{"use strict";Mo.exports=To()});var Wo=$e(at=>{"use strict";var ki=Symbol.for("react.transitional.element"),Ri=Symbol.for("react.fragment");function jo(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:ki,type:e,key:o,ref:t!==void 0?t:null,props:n}}at.Fragment=Ri;at.jsx=jo;at.jsxs=jo});var De=$e((us,Go)=>{"use strict";Go.exports=Wo()});var pe={focusId:null,relation:null,expanded:[],pins:{}},Ze=e=>{let t=Number(e);return Number.isFinite(t)?t:null};function Q(e){let t=new URLSearchParams;e.focusId&&t.set("focus",e.focusId),e.relation&&t.set("relation",e.relation),e.overview&&t.set("overview","1"),e.zoom&&t.set("zoom","1"),e.past&&t.set("past","1"),e.shown&&e.shown.length>0&&t.set("show",[...e.shown].sort().join(",")),e.selection!==void 0&&e.selection.length>0&&t.set("sel",[...e.selection].sort().join(",")),e.expanded.length>0&&t.set("expand",[...e.expanded].sort().join(","));for(let o of Object.keys(e.pins).sort()){let r=e.pins[o];t.set(`pin.${o}`,`${Xe(r.x)},${Xe(r.y)}`)}e.pan&&(e.pan.x!==0||e.pan.y!==0)&&t.set("pan",`${Xe(e.pan.x)},${Xe(e.pan.y)}`);for(let o of Object.keys(e.within??{}).sort()){let r=e.within[o];r.length>0&&t.set(`in.${o}`,r)}e.q&&e.q.trim().length>0&&t.set("q",e.q);let n=t.toString();return n?`#${n}`:"#"}function Yr(e){return e&&e.startsWith("agg:")?`aggregate:${e.slice(4)}`:e}function Je(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,x]=p.split(","),k=g===void 0?null:Ze(g),y=x===void 0?null:Ze(x);k===null||y===null||(o[m.slice(4)]={x:k,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(",")??[],s=a[0]===void 0?null:Ze(a[0]),l=a[1]===void 0?null:Ze(a[1]),c=(n.get("sel")??"").split(",").filter(m=>m.length>0).sort(),u=n.get("overview")==="1";return{...c.length>0?{selection:c}:{},...u?{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()}:{},...s!==null&&l!==null?{pan:{x:s,y:l}}:{},...Object.keys(r).length>0?{within:r}:{},...n.get("q")?.trim()?{q:n.get("q")}:{},focusId:Yr(n.get("focus")),relation:n.get("relation"),expanded:(n.get("expand")??"").split(",").filter(m=>m.length>0&&(u||!m.startsWith("kind:"))).sort(),pins:o}}function Da(e){let t=Je(e);return Q(t)==="#"?{...t,overview:!0}:t}function Na(e){let t=Q(e);return t==="#overview=1"?"":t}function Xe(e){return Math.round(e*100)/100}function co(e,t){return Q(e)===Q(t)}var uo="edge:";function fo(e){if(!e.startsWith(uo))return null;let t=e.slice(uo.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 Tt(e){let{pan:t,...n}=e;return{...n,pins:{}}}function z(e,t){if(t===e.focusId)return{...e,focusId:t};let n=Tt(e);return{...n.within?.q!==void 0?le(n,"q",null):n,focusId:t}}function po(e,t){return{...e,relation:t}}function le(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 ye(e,t){if(t!==e.overview&&(e=Tt(e)),!t){let n=e.expanded.filter(o=>!o.startsWith("kind:"));return{...e,overview:!1,expanded:n}}return{...e,overview:t}}function Qe(e,t){if(t.length===0){let{selection:n,...o}=e;return o}return{...e,selection:[...t]}}function _e(e,t){if(t!==(e.zoom===!0)&&(e=Tt(e)),!t){let{zoom:n,...o}=e;return o}return{...e,zoom:!0}}function et(e,t){let n=new Set(e.expanded);return n.has(t)?n.delete(t):n.add(t),{...e,expanded:[...n].sort()}}var nt="aggregate:",tt="kind:";function Mt(e){return`${tt}${e}`}function me(e){return e.startsWith(tt)?e.slice(tt.length):null}var Ga="kinds:beyond";function Zr(e){let t=me(e);return t?[t]:de(e)}function ee(...e){return`${nt}${[...e].sort().join("+")}`}function yo(e){return e.startsWith(nt)}function de(e){return!yo(e)||e.includes("|")?[]:e.slice(nt.length).split("+").filter(Boolean)}function mo(e,t,n={}){let o=me(t);if(o!==null&&e.overview&&n.ownPicture!==!0)return et(e,t);let r=o!==null?ee(o):t;if(e.zoom&&e.focusId===r&&!(o!==null&&n.carry))return _e(e,!1);if(o!==null&&n.carry){let i=ye({...z(e,r),relation:null},!1);return le(_e(i,!0),"q",n.carry)}return _e({...z(e,r),relation:null},!0)}function Xr(e,t,n){return le(ye(z(e,ee(t)),!1),"view",n)}function Fa(e,t){return e.id<t.id?-1:e.id>t.id?1:0}var go="aggregate:";function Ct(e){return e.startsWith(go)&&e.includes("|")}var Ot=e=>e?.off===!0,Jr=e=>e!==void 0&&!Ot(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),ho=e=>e!==void 0&&!Ot(e)&&(e.fast!==void 0||e.decide!==void 0),Qr=e=>e?.suggestOnOpen!==!1&&ho(e),ei=e=>e?.hoverChips===!0&&ho(e);var Vt={};var Co=_(N(),1),hi={turns:[],outcomes:new Map,busy:!1,pending:null,draft:null,draftNote:null},Oo=e=>`graview:seat:${e}`;function Si(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 wi(e,t){if(e)try{sessionStorage.setItem(e,JSON.stringify({turns:t.turns.slice(-40),outcomes:[...t.outcomes],draft:t.draft}))}catch{}}function Wt(e){let t=e===null?null:Oo(e),n={...hi,...Si(t)},o=new Set,r=(i,a=!0)=>{n=i,a&&wi(t,n);for(let s of[...o])s()};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 vi(e){return(0,Co.useSyncExternalStore)(e.subscribe,e.get,e.get)}var Io=_(N(),1),bi={entries:[],ghost:null,loaded:!1};function Vo(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 Gt(e){let t=bi,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:Vo(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:Vo(t.entries,i)})).catch(i=>{console.warn("The host's AI interactions could not be read:",i)})}}}function xi(e){return(0,Io.useSyncExternalStore)(e.subscribe,e.get,e.get)}function Lo(e){return e?.closest?.("[data-graview-pick]")?.getAttribute("data-graview-pick")??null}var rt=_(N(),1),it=(0,rt.createContext)(void 0),Ei=()=>(0,rt.useContext)(it);var P=_(N(),1),He=(0,P.createContext)(null);function Ho(){return(0,P.useContext)(He)}function Pi(e,t){let n=Ho(),o=(0,P.useMemo)(()=>n?n.live.seenBy(t):e,[n,e,t]),r=(0,P.useRef)(0),i=(0,P.useCallback)(a=>o.subscribe(()=>{r.current+=1,a()}),[o]);return(0,P.useSyncExternalStore)(i,()=>r.current,()=>0),o}var Do=Ye(()=>(__graviewPreload(import.meta.url,["./chunk.ZJXUWOG3.js","./chunk.TI4OSTQV.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.PFXGWY3P.js")));function Ft(e){let[,t]=(0,P.useReducer)(o=>o+1,0),n=e.publishing?.mode==="on-publish"&&!no();return(0,P.useEffect)(()=>{n&&Do().then(t,()=>{})},[n]),!n}var _o,Ai=400;function Kt(e,t,n){let o=(0,P.useContext)(He),r=o!==null&&o.owns(e,t),[i,a]=(0,P.useState)(null),[s,l]=(0,P.useState)(_o);(0,P.useEffect)(()=>{if(s||r||i===null)return;let b=!0;return Do().then(V=>{_o=V,b&&l(V)},()=>{}),()=>{b=!1}},[s,r,i]);let[c,u]=(0,P.useState)(0),m=(0,P.useMemo)(()=>r||i===null||i>=e.log.length||!s?void 0:s.askArchived(e,i,n)??s.askDeclaration(n,i),[r,e,i,n,s,c]),p=m&&"waiting"in m?m.waiting:void 0,g=m&&"seq"in m?m:null,[x,k]=(0,P.useState)(void 0);(0,P.useEffect)(()=>{if(!p)return;let b=!0,V=setTimeout(()=>b&&k(p),Ai);return p.then(()=>b&&u(L=>L+1)),()=>{b=!1,clearTimeout(V)}},[p]);let y=p!==void 0&&x!==p||g!==null,v=(0,P.useMemo)(()=>{if(r||i===null||i>=e.log.length||!s||y)return null;try{let b=s.pastAt(e,i,n);return{seq:i,at:b.past?.at,store:b}}catch{return null}},[r,e,i,n,s,y,c]),S=(0,P.useRef)(null),E=y?S.current:v;(0,P.useEffect)(()=>{S.current=E},[E]);let A=(0,P.useCallback)(b=>a(b===null?null:b>=e.log.length?Number.POSITIVE_INFINITY:b),[e]),G=(0,P.useCallback)((b,V)=>[e,E?.store].some(L=>L!==void 0&&(L===b||L.seenBy(V)===b)),[e,E]),H=i!==null,j=(0,P.useMemo)(()=>({past:E,open:H,show:A,live:e,host:n,owns:G,archive:g}),[E,H,A,e,n,G,g]);return r?o:j}var No=_(N(),1),Bt=(0,No.createContext)(null);var Fo=e=>`graview:setting:${e}`;function Ko(){return localStorage}function Bo(e,t){try{let n=(t??Ko()).getItem(Fo(e.name));if(n!==null&&e.options.some(o=>o.value===n))return n}catch{}return e.initial}function qo(e,t,n){try{(n??Ko()).setItem(Fo(e.name),t)}catch{}}function zo(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 I=_(N(),1);function qt(e){return Ue(e)}var Ti=12,Mi=4;function Ci(e,t,n){let o=qt(t);return e.get(o)??{participant:o,who:t.id??t.kind,at:null,mode:"docked",since:n,trail:[]}}var st=(e,t)=>t===null||e[e.length-1]===t?e:[...e,t].slice(-Ti);function $o(e,t){let n=e.filter(r=>r.length>0);if(n.length===0)return null;if(n.length<=Mi)return n[0];let o=new Set(n.map(r=>t(r)).filter(r=>r!==void 0));return o.size===1?Mt([...o][0]):n[0]}function zt(e,t,n){let o=new Map(e);if(t.type==="rest"){for(let[a,s]of e)s.mode!=="asking"&&s.mode!=="docked"&&t.at-s.since>=t.holdMs&&o.set(a,{...s,mode:"docked",at:null,trail:[],say:void 0,confidence:void 0});return o}if(t.author.kind!=="agent")return o;let r=Ci(e,t.author,t.at),i=a=>o.set(r.participant,{...r,...a,since:t.at});switch(t.type){case"read":{let a=$o(t.ids,n);return i({at:a,mode:"reading",trail:st(r.trail,a)}),o}case"about-to-write":case"write":{let a=$o(t.ids,n);return i({at:a,mode:"writing",trail:st(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:st(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:st(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 Uo="graview:session";function Yo(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(Uo);if(o)return o;let r=t();return n.setItem(Uo,r),r}catch{return t()}}var $t={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"},Ut={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"},Zo=[$t,Ut],Oi=800;function Xo(e){let{channel:t,store:n,view:o,principal:r,session:i,robots:a,seatWho:s,settingValues:l,setView:c,ttlMs:u=lo,people:m,seats:p}=e,[g,x]=(0,I.useState)(()=>new Map),[k,y]=(0,I.useState)(null),[v,S]=(0,I.useState)(null),[E,A]=(0,I.useState)(null),G=typeof r.id=="string"&&r.id.length>0,H=G&&(l[$t.name]??$t.initial)==="shared",j=H&&(l[Ut.name]??Ut.initial)==="shared",b=qt({kind:r.kind,...r.id?{id:r.id}:{},session:i}),V=G?Qn(r,{graph:n.graph,schema:n.schema,...p?{seats:p}:{},...m?{people:m}:{}}):"",L=s?a.get(`agent:${s}:${i}`):void 0,F=(0,I.useMemo)(()=>!t||!H?null:{participant:b,kind:r.kind,name:V,...r.onBehalfOf?.id?{onBehalfOf:r.onBehalfOf.id,...r.onBehalfOf.name?{onBehalfOfName:r.onBehalfOf.name}:{}}:{},hue:eo(r.id??"nobody"),stop:E??Q(o),...j?{over:k}:{},...L?{robot:{at:L.at,mode:L.mode}}:{},at:new Date().toISOString()},[t,H,j,b,V,r.id,r.kind,r.onBehalfOf?.id,r.onBehalfOf?.name,o,E,k,L?.at,L?.mode]),We=(0,I.useRef)(null),Pe=R=>R&&t?.here({...R,caret:We.current??void 0,at:new Date().toISOString()}),Ae=(0,I.useCallback)(R=>{We.current=R,Pe(F)},[t,F]);(0,I.useEffect)(()=>{if(!F)return;Pe(F);let R=setInterval(()=>Pe(F),Oi);return()=>clearInterval(R)},[t,F]),(0,I.useEffect)(()=>t?t.onWho(B=>x(Rt(new Map,B,Date.now(),u))):void 0,[t,u]);let ke=g.size>0;(0,I.useEffect)(()=>{if(!ke)return;let R=setInterval(()=>{x(B=>{let X=Rt(B,[],Date.now(),u);return X.size===B.size?B:X})},Math.max(250,Math.min(1e3,u/4)));return()=>clearInterval(R)},[ke,u]),(0,I.useEffect)(()=>{if(!t||typeof window>"u")return;let R=()=>t.leave();return window.addEventListener("pagehide",R),()=>window.removeEventListener("pagehide",R)},[t]),(0,I.useEffect)(()=>{if(!j||typeof document>"u")return;let R=null,B=X=>{let ie=Lo(X.target);ie!==R&&(R=ie,y(ie))};return document.addEventListener("pointermove",B,{passive:!0}),()=>document.removeEventListener("pointermove",B)},[j]);let ue=(0,I.useRef)(null),K=v?g.get(v)??null:null,oe=(0,I.useCallback)(R=>{ue.current=null,S(R)},[]);(0,I.useEffect)(()=>{if(v){if(!K){S(null);return}K.stop!==ue.current?.stop&&(ue.current={stop:K.stop,at:Date.now()},c(Je(K.stop)))}},[v,K,c]),(0,I.useEffect)(()=>{let R=ue.current;!v||R===null||Date.now()-R.at<400||co(o,Je(R.stop))||S(null)},[o,v]),(0,I.useEffect)(()=>{if(!v||typeof document>"u")return;let R=B=>{B.key==="Escape"&&S(null)};return document.addEventListener("keydown",R),()=>document.removeEventListener("keydown",R)},[v]);let Re=F!==null,re=(0,I.useMemo)(()=>Re?{participant:b,name:V}:null,[Re,b,V]);return(0,I.useMemo)(()=>({who:g,sharing:re,following:K,follow:oe,sayWhere:A,sayCaret:Ae}),[g,re,K,oe,Ae])}var U=_(N(),1);function Jo(e){return Ue(e.author)}function Vi(e,t){return e.length>1?"co-edited":t==="rule"?"rule":t==="agent"?"autonomous":"directed"}function Qo(e,t,n,o,r){let i=new Map;for(let[l,c]of e)o-c.at<r&&i.set(l,c);let a=new Set(n.flatMap(l=>l.nodeIds)),s=(l,c,u)=>{let m=i.get(l),p=m?.participants.includes(Jo(c))?m.participants:[...m?.participants??[],Jo(c)];i.set(l,{at:o,manner:Vi(p,c.author.kind),intent:c.intent,wrote:(m?.wrote??!1)||(u.wrote??!1),read:(m?.read??!1)||(u.read??!1),broke:(m?.broke??!1)||a.has(l),participants:p})};for(let l of t){for(let c of l.writes)s(c,l,{wrote:!0});for(let c of l.reads)l.writes.includes(c)||s(c,l,{read:!0})}for(let l of n)for(let c of l.nodeIds){let u=i.get(c);i.set(c,{at:o,manner:u?.manner??"rule",intent:u?.intent??l.message,wrote:u?.wrote??!1,read:u?.read??!1,broke:!0,participants:u?.participants??["rule::"]})}return i}var Ii=2600;function er(e,t=Ii){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)(l=>{r.current=l,o(l),i.current&&clearTimeout(i.current),i.current=setTimeout(()=>{r.current=new Map,o(new Map)},t)},[t]);(0,U.useEffect)(()=>{let l=e.violations(),c=e.subscribe((u,m)=>{let p=e.violations(),g=io(e.allInvariants(),l,p).introduces;l=p,a(Qo(r.current,m,g.map(x=>({nodeIds:x.nodeIds,message:x.message})),Date.now(),t))});return()=>{c(),i.current&&clearTimeout(i.current)}},[e,t,a]);let s=(0,U.useCallback)(l=>{l.reads.length!==0&&a(Qo(r.current,[Li(l)],[],Date.now(),t))},[t,a]);return{activity:n,noteAttention:s}}function Li(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=_(N(),1);function tr(){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 lt=_(N(),1),_i=e=>e.definitions.some(t=>Xn(t).size>0);function nr(e,t,n){let[o,r]=(0,lt.useState)(void 0),i=(n.roles??[]).join("\0");return(0,lt.useEffect)(()=>{if(!t||!_i(e.schema)){r(void 0);return}let a=!0,s=!1,l=e.graph,c=()=>{s||(s=!0,queueMicrotask(()=>{s=!1,a&&e.reread()}))},u=Jn(t,{kind:n.kind,...n.id===void 0?{}:{id:n.id},...n.roles?{roles:n.roles}:{}},c);return kt(l,u.read),r(u),e.reread(),()=>{a=!1,kt(l,void 0)}},[e,t,n.kind,n.id,i]),o}function or(){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 te=_(De(),1),Hi="graview:place-menu",Ne=(0,d.createContext)(null),sr=(0,d.createContext)("scene");function Di({mode:e,children:t}){return(0,te.jsx)(sr.Provider,{value:e,children:t})}function Ni(){return(0,d.useContext)(sr)}var lr={kind:"human"},ji=[],Wi=[],Gi=[],Yt=[];function dr(e,t){let n=(0,d.useId)();(0,d.useEffect)(()=>{if(!globalThis.__graviewWatch)return;let o=t??lr,r=()=>ro(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 Fi=()=>{try{return typeof location<"u"&&new URLSearchParams(location.search).get("as")==="published"?"published":void 0}catch{return}},Ki={off:!0};function Bi({store:e,views:t,initialView:n,scheme:o="dark",initialSelection:r,principal:i,as:a,seats:s=ji,onSeat:l,people:c=Wi,memory:u,presenceTtlMs:m,app:p,settings:g=p?.settings??Gi,presence:x,typing:k,brand:y,locale:v,timeZone:S,onKeepLens:E,providers:A,ai:G,files:H,resolveApp:j,history:b,linkedRecords:V,menuSections:L,keptViews:F,onExport:We,subscriptions:Pe,dismissals:Ae,whileAway:ke,signIn:ue,view:K,onViewChange:oe,children:Re}){let re=(0,d.useContext)(Ne),R=L??re?.menuSections,B=ue??re?.signIn,X=F??re?.keptViews,ie=We??re?.onExport,[_r,Hr]=(0,d.useState)(null),ce=_r??i??s[0]?.principal??lr,Ge=Kt(e,ce,b),pn=Ge.past&&Ge.live===e?Ge.past.store:e,wt=a??Fi(),vt=!Ft(e),D=(0,d.useMemo)(()=>vt?e:pn.seenBy(ce,wt?{as:wt}:void 0),[vt,e,pn,ce,wt]);dr(e,ce);let[ae]=(0,d.useState)(()=>Yo(u)),[yn,Dr]=(0,d.useState)(!1),mn=(0,d.useCallback)(()=>Dr(!0),[]),se=(0,d.useMemo)(()=>x?[...g,...Zo]:g,[g,x]),[bt]=(0,d.useState)(()=>n??Qt(t,e.schema)),[Nr,gn]=(0,d.useState)(()=>Qe(bt??pe,r??bt?.selection??[])),Te=(0,d.useRef)(bt??pe).current,[hn,jr]=(0,d.useState)(null),[Sn,Wr]=(0,d.useState)(null),Z=(0,d.useContext)(Ne),[wn]=(0,d.useState)(()=>Z?.seatTalk??Wt(y?.name??e.schema.kinds.join(","))),xt=G??Z?.ai??Vt,Fe=(0,d.useMemo)(()=>xt.off?Ki:xt,[xt]),vn=(0,d.useRef)(Fe.interactions);vn.current=Fe.interactions;let[bn]=(0,d.useState)(()=>Z?.aiDesk??Gt(()=>vn.current)),[Gr]=(0,d.useState)(()=>Z?.subscriptions??oo()),xn=Pe??Z?.subscriptions??Gr,Et=E??Z?.onKeepLens,Ke=p??Z?.app,Be=v??Z?.locale,Fr=y?.locale??Ke?.brand?.locale,qe=S??Z?.timeZone;Zn({reader:Be,app:Fr,readerTimeZone:qe,appTimeZone:y?.timeZone??Ke?.brand?.timeZone});let En=(0,d.useRef)(null),Pn=(0,d.useCallback)(f=>{En.current=f},[]),An=(0,d.useCallback)(f=>En.current?.whereIs(f)??null,[]),[kn]=(0,d.useState)(()=>tr()),[Rn]=(0,d.useState)(()=>or()),[Pt,Kr]=(0,d.useState)(null),[Me,Tn]=(0,d.useState)(()=>new Map),Ce=(0,d.useRef)(Me);Ce.current=Me;let Oe=(0,d.useRef)(null),At=(0,d.useCallback)(f=>D.graph.getNode(f)?.kind,[D]),J=(0,d.useCallback)(f=>{let h=zt(Ce.current,f,At);Ce.current=h,Tn(h),Oe.current&&clearTimeout(Oe.current),[...h.values()].some(C=>C.mode!=="docked"&&C.mode!=="asking")&&(Oe.current=setTimeout(()=>{let C=zt(Ce.current,{type:"rest",at:Date.now(),holdMs:Jt},At);Ce.current=C,Tn(C)},Jt+20))},[At]),Mn=(0,d.useCallback)(f=>J({...f,at:f.at??Date.now()}),[J]),Cn=(0,d.useCallback)(f=>{Kr(f),f&&J({type:"home",author:{kind:"agent",id:f,session:ae},at:Date.now()})},[J,ae]);(0,d.useEffect)(()=>D.subscribe((f,h)=>{for(let T of h)T.author.kind==="agent"&&J({type:"write",author:T.author,ids:T.writes,at:Date.now()})}),[D,J]),(0,d.useEffect)(()=>()=>{Oe.current&&clearTimeout(Oe.current)},[]);let $=(0,d.useMemo)(()=>({...ce,session:ae}),[ce,ae]),On=nr(D,V,$),Vn=(0,d.useCallback)(f=>{Hr(f),l?.(f)},[l]),[Ve,Br]=(0,d.useState)(()=>Object.fromEntries(se.map(f=>[f.name,Bo(f,u)])));(0,d.useEffect)(()=>{for(let f of se)zo(f,Ve[f.name]??f.initial)},[se,Ve]);let In=(0,d.useCallback)((f,h)=>{let T=se.find(C=>C.name===f);!T||!T.options.some(C=>C.value===h)||(qo(T,h,u),Br(C=>({...C,[f]:h})))},[se,u]),[Ln,qr]=(0,d.useState)(null),{activity:_n,noteAttention:Hn}=er(D),Dn=(0,d.useCallback)(f=>{Hn(f),J({type:"read",author:f.author,ids:f.reads,at:Date.now()})},[Hn,J]),fe=(0,d.useCallback)(f=>{if(me(f)!==null||de(f).length>0||Ct(f))return!0;let h=fo(f);return h?D.graph.allEdges().some(T=>T.kind===h.kind&&T.from===h.from&&T.to===h.to):D.graph.getNode(f)!==void 0},[D]),Nn=(0,d.useCallback)(f=>{let h=f.selection??Yt,T=h.filter(fe),C=T.length===h.length?f:Qe(f,T);return C.focusId!==null&&!fe(C.focusId)&&(C=z(C,null)),C},[fe]),Ie=(0,d.useCallback)(f=>{let h=Nn(f),T=ar(D,$,h.shown);if(h.focusId!==null&&T.size>0){let C=de(h.focusId),Yn=D.graph.getNode(h.focusId);(C.length>0?C.every(Ur=>T.has(Ur)):Yn?T.has(Yn.kind):!1)&&(h={...h,focusId:null})}if(!h.overview&&h.focusId===null){let C=Te.focusId!==null&&!fe(Te.focusId)?Qt(t,e.schema)??{...pe,overview:!0}:Te;C.focusId!==null&&fe(C.focusId)?h={...h,focusId:C.focusId}:C.overview===!0&&(h={...h,overview:!0})}return h},[Nn,fe,D,Te,$,t,e.schema]),q=Ie(K??Nr),jn=(0,d.useMemo)(()=>ar(D,$,q.shown),[D,$,q.shown]),Wn=(0,d.useMemo)(()=>[...D.modules.administered.entries()].map(([f,h])=>{let T=D.mayAdminister(f,$);return{name:f,...h.description?{description:h.description}:{},kinds:h.kinds??[],canShow:T,shown:T&&(q.shown??[]).includes(f)}}),[D,$,q.shown]),Le=(0,d.useCallback)(f=>{let h=T=>Ie(typeof f=="function"?f(T):f);if(K!==void 0){oe?.(h(K));return}oe&&oe(h(q)),gn(T=>h(T))},[q,oe,K,Ie]);(0,d.useEffect)(()=>{K===void 0&&gn(f=>{let h=Ie(f);return h===f?f:h})},[q,K,Ie]);let Gn=q.selection??Yt,Fn=(0,d.useCallback)(f=>{Le(h=>Qe(h,typeof f=="function"?f(h.selection??Yt):f))},[Le]),{who:ze,following:Kn,follow:Bn,sayWhere:zr,sayCaret:qn,sharing:zn}=Xo({channel:x,store:D,view:q,principal:$,session:ae,robots:Me,seatWho:Pt,settingValues:Ve,setView:Le,seats:s,people:c,...m!==void 0?{ttlMs:m}:{}}),$r=(0,d.useMemo)(()=>({store:D,scheme:o,views:t,view:q,setView:Le,homeView:Te,selection:Gn,setSelection:Fn,menuAt:hn,setMenuAt:jr,whereIs:An,pointer:kn,motion:Rn,registerScene:Pn,robots:Me,noteSeat:Mn,seatWho:Pt,registerSeatWho:Cn,actsDoor:Sn,registerActsDoor:Wr,seatTalk:wn,aiDesk:bn,...u?{memory:u}:{},who:ze,following:Kn,follow:Bn,sayWhere:zr,sharing:zn,session:ae,ai:Fe,resolveApp:j,linkedRecords:V,menuSections:R,...X?{keptViews:X}:{},...ie?{onExport:ie}:{},subscriptions:xn,dismissals:Ae,whileAway:ke,signIn:B,linkedReads:On,movedByHand:yn,noteMoved:mn,emphasis:Ln,setEmphasis:qr,activity:_n,noteAttention:Dn,principal:$,seats:s,people:c,takeSeat:Vn,settings:se,settingValues:Ve,chooseSetting:In,hiddenKinds:jn,administered:Wn,...A?{providers:A}:{},...y?{brand:y}:{},...Et?{onKeepLens:Et}:{},app:Ke,...Be?{locale:Be}:{},...qe?{timeZone:qe}:{}}),[D,o,t,q,Le,Gn,Fn,hn,An,kn,Rn,Pn,Me,Mn,Pt,Cn,Sn,wn,bn,u,ze,Kn,Bn,zn,ae,Fe,j,V,R,X,ie,xn,Ae,ke,B,On,yn,mn,Ln,_n,Dn,$,s,c,Vn,se,Ve,In,jn,Wn,A,y,Et,Ke,Be,qe]),$n=(0,d.useMemo)(()=>k?{typing:k,sayCaret:qn,who:ze}:null,[k,qn,ze]),Un=H?(0,te.jsx)(it.Provider,{value:H,children:Re}):Re;return(0,te.jsx)(Ne.Provider,{value:$r,children:(0,te.jsx)(He.Provider,{value:Ge,children:(0,te.jsx)(Yi,{children:vt?null:$n?(0,te.jsx)(Bt.Provider,{value:$n,children:Un}):Un})})})}var ur=(0,d.createContext)(null),Zt,Xt=new Set,qi=e=>(Xt.add(e),()=>void Xt.delete(e)),rr=()=>Zt;function zi(e){if(!Zt){Zt=e;for(let t of[...Xt])t()}}var $i=300;function Ui(e){let t=0;return async(n,o)=>{let r=++t;return await new Promise(i=>setTimeout(i,$i)),r===t?e(n,o):[]}}function Yi({children:e}){let{store:t,view:n,views:o,principal:r,hiddenKinds:i,selection:a,ai:s}=ne(),l=dt(),c=n.q,u=n.focusId,m=!!(c&&c.trim().length>0),p=(0,d.useSyncExternalStore)(qi,rr,rr),g=(0,d.useMemo)(()=>m&&p?{flagged:new Set(t.violations().flatMap(E=>E.nodeIds)),touched:p.touchWeights(t.log.all())}:null,[t,l,m,p]),x=u?t.graph.getNode(u)?.kind??me(u)??(de(u).length===1?de(u)[0]:void 0):void 0,k=(0,d.useMemo)(()=>s.near&&Ui(s.near),[s.near]),y=(0,d.useMemo)(()=>!c||!g||!p?null:p.search(t,c,{...x?{inKind:x}:{},principal:r,places:o.places(),kinds:t.schema.kinds.filter(E=>!i.has(E)),from:[...a,...u&&t.graph.has(u)?[u]:[]],flagged:g.flagged,touched:g.touched,limit:200,rank:k}),[t,c,r,o,i,a,u,x,g,k]),[v,S]=(0,d.useState)();return(0,d.useEffect)(()=>void y?.later?.then(E=>S([y,E])),[y]),(0,te.jsx)(ur.Provider,{value:v?.[0]===y?v[1]:y,children:e})}var ir=new WeakMap;function Gs(e){let t=ir.get(e);return t||ir.set(e,t=new Set(e.matched)),t}function Zi(){return(0,d.useContext)(ur)}function ne(){let e=(0,d.useContext)(Ne);if(!e)throw new Error("useGraview must be used inside a <GraviewProvider>.");return e}function en(){return(0,d.useContext)(Ne)??null}function dt(){let{store:e}=ne(),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 Xi(e){let{store:t}=ne(),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 ar(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 Jt=2600;var cr=new WeakSet,Ji=e=>cr.has(e),Qi=e=>void cr.add(e);function Qt(e,t){let n=so(e.arrangement?.()?.first,t,e.places());if(!(!n||n.to==="home"))return n.to==="place"?{...pe,focusId:ee(n.place.kind),within:{view:n.place.as}}:{...pe,focusId:ee(n.kind)}}var fr=_(N(),1),ea=(0,fr.createContext)(!1);var ut=Symbol.for("graview.default-view");function pr(e){return Object.defineProperty(e,ut,{value:!0,enumerable:!1}),e}function yr(e){return typeof e=="function"&&e[ut]===!0}var ct=Symbol.for("graview.replaces-page");function mr(e){return Object.defineProperty(e,ct,{value:!0,enumerable:!1}),e}function gr(e){return typeof e=="function"&&e[ct]===!0}var ft=Symbol.for("graview.bleeds");function hr(e){return Object.defineProperty(e,ft,{value:!0,enumerable:!1}),e}function Sr(e){return typeof e=="function"&&e[ft]===!0}var pt=Symbol.for("graview.previews");function wr(e,t={}){return Object.defineProperty(e,pt,{value:t,enumerable:!1}),e}function vr(e){return typeof e=="function"?e[pt]:void 0}function ta(e){return ao(e)}function na(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.homes?.()??[];if(o.length>0)for(let r of o)e.home?.(r.view,r.name!==void 0?{name:r.name}:void 0);else{let r=t.homeView?.();r&&e.home?.(r)}return e}var M=_(N(),1),Y=_(De(),1),tn=new Set,yt=0;function nn(e){return()=>{yt+=1;let t=e();return t.then(()=>void(yt-=1),()=>void(yt-=1)),t}}var oa=()=>yt,gt=(0,M.createContext)(null);function ra(){return{waiting:new Map,at:0}}function ia(e){for(let[t,n]of e.waiting)n<e.at&&e.waiting.delete(t);e.at+=1}var aa=e=>e?.waiting.size??0;function Er(e,t){e?.waiting.set(t,e.at)}function Pr(e){let t=(0,M.useContext)(gt);(0,M.useLayoutEffect)(()=>{t?.waiting.delete(e)},[t,e])}function sa(e){let t={},n=!1,o=new Set,r=(0,M.lazy)(nn(()=>e().then(a=>{n=!0;let s=a.default;function l(c){return Pr(t),(0,M.createElement)(s,c)}return{default:l}},a=>{for(let s of o)s.waiting.delete(t);throw a})));function i(a){let s=(0,M.useContext)(gt);return!n&&s&&(o.add(s),Er(s,t)),(0,M.createElement)(r,a)}return i}var Ar=!1,kr=!1,mt=new Set;function la(){Ar=!0}function da(){kr=!0;for(let e of[...mt])e();mt.clear()}var Rr=()=>kr||!Ar;function ua(e){return Rr()?(e(),()=>{}):(mt.add(e),()=>void mt.delete(e))}var br=!1;function on(){for(let e of[...tn])e()}function ca(){br||typeof window>"u"||(br=!0,window.addEventListener("online",on))}function rn(e){let t,n=!1,o=!1,r,i=0,a=new Set,s=()=>{i+=1;for(let p of[...a])p()},l=p=>(a.add(p),()=>void a.delete(p)),c=()=>i,u=()=>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,tn.delete(u),s(),g),g=>{throw r=void 0,o=!0,tn.add(u),ca(),s(),g});return p.catch(()=>{}),r=p,p}return{load:m,prefetch:u,get current(){return t},get failed(){return o},part(p,g={}){let x=g.what??"This part",k={};function y(E){(0,M.useSyncExternalStore)(l,c,c),Pr(k);let A=(0,M.useRef)(null),G=(0,M.useRef)(null),H=(0,M.useRef)(!1);return(0,M.useEffect)(()=>{o&&r===void 0&&u()},[]),n&&typeof document<"u"&&A.current!==null&&document.activeElement===A.current&&(H.current=!0),(0,M.useLayoutEffect)(()=>{if(!(!n||!H.current)){H.current=!1;for(let j=G.current?.nextElementSibling??null;j!==null;j=j.nextElementSibling){let b=j.matches(xr)?j:j.querySelector(xr);if(b instanceof HTMLElement){b.focus();return}}}}),n?(0,Y.jsxs)(Y.Fragment,{children:[H.current?(0,Y.jsx)("span",{ref:G,hidden:!0}):null,p(t,E)]}):g.quiet?null:(0,Y.jsx)(fa,{what:x,button:A,...g.as?{as:g.as}:{}})}let v=(0,M.lazy)(nn(()=>m().then(()=>({default:y}),()=>({default:y}))));function S(E){let A=(0,M.useContext)(gt),[G]=(0,M.useState)(()=>n||o);return!n&&!o&&Er(A,k),(0,M.createElement)(G?y:v,E)}return S}}}var xr="button,a[href],input,select,textarea,[tabindex]:not([tabindex='-1'])";function fa({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:on,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 we=_(N(),1);function pa(){let{selection:e,setSelection:t}=ne();return(0,we.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 ya(){let{store:e}=ne(),t=dt();return(0,we.useMemo)(()=>ma(e),[e,t])}var Tr=new WeakMap;function ma(e){let t=Tr.get(e);if(!t){let n={violations:null};e.subscribe(()=>{n.violations=null}),Tr.set(e,n),t=n}return t.violations??=e.violations(),t.violations}function ga(){let{view:e,setView:t}=ne();return(0,we.useMemo)(()=>({view:e,url:Q(e),focus:n=>t(o=>z(o,n)),show:n=>t(o=>po(o,n)),toggle:n=>t(o=>et(o,n)),go:n=>t(n)}),[e,t])}var Se={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;Se.at=typeof t?.graview=="number"?t.graview:0,Se.at>Se.depth&&(Se.depth=Se.at),Se.tell()});var W=_(N(),1),sn={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"]}},ha={position:"fixed",inset:"auto",margin:0,zIndex:to("popover"),boxSizing:"border-box"},ht=6,ve=8,Sa=e=>typeof e.showPopover=="function";function St(e){try{return e.matches(":popover-open")}catch{return!1}}function wa(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 ln(e,t,n={}){let o=wa(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(),s=r.height-o.bottom-ht-ve,l=o.top-ht-ve,c=a.height<=s||s>=l,u=Math.max(96,Math.floor(c?s:l)),m=Math.min(a.height,u);a.height>u&&(e.style.maxHeight=i?`min(${i}, ${u}px)`:`${u}px`);let p=a.width,g=n.align==="start"?o.left:o.right-p,x=typeof t=="function"?null:t.current?.closest("[data-graview-embed]")?.getBoundingClientRect();x&&p<=x.right-x.left&&(g<x.left?g=o.left+p<=x.right?o.left:x.left:g+p>x.right&&(g=o.right-p>=x.left?o.right-p:x.right-p));let k=p>=r.width-2*ve?Math.max(0,(r.width-p)/2):Math.max(ve,Math.min(g,r.width-ve-p)),y=c?o.bottom+ht:Math.max(ve,o.top-ht-m);e.style.left=`${Math.round(k)}px`,e.style.top=`${Math.round(y)}px`}function Mr(e,t,n,o={}){let r=o.align??"end";(0,W.useLayoutEffect)(()=>{let i=e.current;if(!t||!i)return;if(Sa(i)&&!St(i))try{i.showPopover(),ba()}catch{}let a=0,s=c=>{c?.target instanceof Node&&i.contains(c.target)||(cancelAnimationFrame(a),a=requestAnimationFrame(()=>ln(i,n,{align:r})))};ln(i,n,{align:r}),addEventListener("resize",s),addEventListener("scroll",s,!0);let l=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>s());return l?.observe(i),()=>{if(cancelAnimationFrame(a),removeEventListener("resize",s),removeEventListener("scroll",s,!0),l?.disconnect(),i.isConnected&&St(i))try{i.hidePopover()}catch{}}},[t,e,r])}var dn=new Set;function va(e){return dn.add(e),()=>dn.delete(e)}function ba(){for(let e of dn)if(!(!e.isConnected||!St(e)))try{e.hidePopover(),e.showPopover()}catch{}}var be=null,xa='button:not([disabled]), [href], input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), summary, [tabindex]:not([tabindex="-1"])';function Ea(e){for(let t of e.querySelectorAll(xa))if(t.closest("[hidden]")===null&&getComputedStyle(t).visibility!=="hidden")return t;return e}var an=()=>{let e=document.activeElement;return e===null||e===document.body};function Pa(e,t={}){let{at:n,returnTo:o,onOpenChange:r}=t,i=t.popover!==!1,[a,s]=(0,W.useState)(!1),l=t.open??a,c=(0,W.useRef)(null),u=(0,W.useRef)(null),m=(0,W.useCallback)(S=>{c.current=S},[]),p=(0,W.useCallback)(S=>{u.current=S},[]),g=`graview-popover-${(0,W.useId)().replace(/:/g,"")}`,x=(0,W.useRef)({onOpenChange:r,returnTo:o,controlled:t.open!==void 0});x.current={onOpenChange:r,returnTo:o,controlled:t.open!==void 0};let k=(0,W.useCallback)(S=>{x.current.controlled||s(S),x.current.onOpenChange?.(S)},[]),y=(0,W.useCallback)(()=>{(document.querySelector(`[aria-controls="${g}"]`)??c.current??x.current.returnTo?.()??null)?.focus({preventScroll:!0})},[g]),v=(0,W.useCallback)(S=>{let E=u.current,A=typeof document>"u"?null:document.activeElement,G=A===null||A===document.body||E!==null&&E.contains(A);k(!1),!(!S||!G)&&(y(),requestAnimationFrame(()=>{an()&&y()}))},[k,y]);return Mr(u,i&&l,n??c,t.align?{align:t.align}:{}),(0,W.useEffect)(()=>{if(!i||!l)return;let S={name:e,close:()=>v(!1)};if(be&&be.close!==S.close&&be.close(),be=S,sn[e].focus==="into"){let b=u.current;b&&!b.contains(document.activeElement)&&Ea(b).focus({preventScroll:!0})}let E=b=>{b.key==="Escape"&&v(!0)},A=b=>{let V=b.target;if(!(V instanceof Node))return;let L=u.current;if(L?.contains(V)||c.current?.contains(V))return;let F=V instanceof Element?V.closest('[role="dialog"], [role="alertdialog"]'):null;F&&!(L&&F.contains(L))||(v(!1),sn[e].focus==="into"&&requestAnimationFrame(()=>{(an()||L!==null&&L.contains(document.activeElement))&&y()}))},G=null,H=null,j=b=>{let V=b.target;if(!(V instanceof Element))return;let L=u.current,F=V.closest('[role="dialog"], [role="alertdialog"]');!F||L&&(L.contains(F)||F.contains(L))||(G=F,v(!1))};return document.addEventListener("keydown",E),document.addEventListener("pointerdown",A,!0),document.addEventListener("focusin",j),()=>{document.removeEventListener("keydown",E),document.removeEventListener("pointerdown",A,!0),document.removeEventListener("focusin",j);let b=G;b&&typeof MutationObserver<"u"&&(H?.disconnect(),H=new MutationObserver(()=>{b.isConnected||(H?.disconnect(),requestAnimationFrame(()=>{(an()||document.activeElement.closest("[hidden]")!==null)&&y()}))}),H.observe(document.body,{childList:!0,subtree:!0}),setTimeout(()=>H?.disconnect(),10*6e4)),be?.close===S.close&&(be=null)}},[i,l,e,v,y]),{open:l,setOpen:S=>S?k(!0):v(!0),toggle:()=>l?v(!0):k(!0),trigger:{ref:m,"aria-expanded":l,"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 xe=_(N(),1);var Cr=(0,xe.createContext)(null);function Aa(){let e=(0,xe.useContext)(Cr),t=en(),n=(o,r,i)=>t?.setView(a=>le(le(ye(z(a,ee(o)),!1),"view",r),"filter",i?.filter??null));return(0,xe.useMemo)(()=>e??{record:o=>{t&&(t.setView(r=>z(ye(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 Ee=_(N(),1);var ka=rn(Ye(()=>(__graviewPreload(import.meta.url,["./chunk.B3T4N2XM.js","./chunk.SDO3U72B.js","./chunk.6W2DUW5S.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.U4T4Y2MT.js"))));function Ra(e,t,n){let o,r=!1,i=()=>{let{hidden:s,removed:l}=t.current();o||r||s.length+l.length===0||(o=()=>{},ka.load().then(c=>{r||(o=c.watchTidied(e,t,n))},String))};i();let a=t.onChange?.(i);return()=>{r=!0,a?.(),o?.()}}function Ta(e,t){let[n,o]=(0,Ee.useState)();return(0,Ee.useEffect)(()=>t?Ra(e,t,r=>o([e,r])):void 0,[e,t]),n?.[0]===e?n[1]:e}var Or=_(N(),1),Ma=(0,Or.createContext)(!1);var un=_(N(),1),Ca=(0,un.createContext)(null),Oa=(0,un.createContext)(null);var Vr=_(N(),1),Va=(0,Vr.createContext)(null);var Ir=_(N(),1),cn='button:not([disabled]), a[href], input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), summary, [tabindex]:not([tabindex="-1"])',fn=e=>e instanceof HTMLElement&&(e.matches(cn)||e.hasAttribute("tabindex")),je=e=>typeof e.checkVisibility=="function"?e.checkVisibility():e.getClientRects().length>0;function Ia(e,t){let n=l=>l.replace(/["\\]/g,"\\$&"),o=t.getAttribute("data-testid"),r=t.getAttribute("data-graview-pick"),i=t.getAttribute("aria-label"),a=o?`[data-testid="${n(o)}"]`:r?`[data-graview-pick="${n(r)}"]`:i?`${t.tagName.toLowerCase()}[aria-label="${n(i)}"]`:null;if(!a)return null;let s=e.querySelector(a);return s&&fn(s)&&je(s)?s:null}var La=e=>e.isConnected&&fn(e)&&!e.matches(":disabled")&&e instanceof HTMLElement&&je(e);function Lr(e,t){let n=t?Ia(e,t):null;if(n)return n;let o=e.querySelector("[data-graview-view][tabindex]");if(o&&je(o))return o;for(let r of e.querySelectorAll(cn))if(je(r))return r;return fn(e)&&je(e)?e:null}function _a(e){(0,Ir.useEffect)(()=>{let t=e.current;if(!t||typeof MutationObserver>"u")return;let n=[],o=y=>{let v=y.target;if(v instanceof Element){n=[];for(let S=v;S&&S!==t.parentElement;S=S.parentElement)n.push(S)}},r=!1,i=!1,a=t.ownerDocument,s=()=>!i&&a.defaultView!==null,l=(y,v)=>void setTimeout(()=>s()&&v(),y),c=y=>void requestAnimationFrame(()=>s()&&y()),u=y=>{if(r=!1,i)return;let v=a.activeElement;if(!(!(v===null||v===a.body||v===a.documentElement)||n.length===0)){if(La(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 A=Lr(E,n[0]);if(A){A.focus({preventScroll:!0}),n=[];return}}}},m=(y,v=Date.now()+2500)=>{l(100,()=>{u(y);let S=a.activeElement;(S===null||S===a.body||S===a.documentElement)&&n.length>0&&Date.now()<v&&m(y,v)})},p=()=>{r||n.length===0||(r=!0,l(60,()=>c(()=>{u(!1),m(!1)})))},g=y=>{if(!(y instanceof KeyboardEvent&&!["Enter"," ","Escape"].includes(y.key))){if(!(y instanceof KeyboardEvent)){let v=y.target instanceof Element?y.target.closest(cn):null,S=a.activeElement,E=S===null||S===a.body||S===a.documentElement;if(v&&E&&t.contains(v)){n=[];for(let A=v;A&&A!==t.parentElement;A=A.parentElement)n.push(A);l(150,()=>c(()=>{u(!1),m(!1)}));return}}!(y instanceof KeyboardEvent)&&!(y.target instanceof Node&&n[0]?.contains(y.target))||l(150,()=>c(()=>{u(!0),m(!0)}))}},x=new MutationObserver(()=>{n.length>0&&!n[0].isConnected&&p()}),k=y=>{y.relatedTarget===null&&p()};return t.addEventListener("focusin",o),t.addEventListener("focusout",k),t.addEventListener("click",g),t.addEventListener("keydown",g),x.observe(t,{childList:!0,subtree:!0}),()=>{i=!0,t.removeEventListener("focusin",o),t.removeEventListener("focusout",k),t.removeEventListener("click",g),t.removeEventListener("keydown",g),x.disconnect()}},[e])}export{pe as a,Q as b,Je as c,Da as d,Na as e,co as f,uo as g,fo as h,Tt as i,z as j,po as k,le as l,ye as m,Qe as n,_e as o,et as p,nt as q,Mt as r,me as s,Ga as t,Zr as u,ee as v,yo as w,de as x,mo as y,Xr as z,Fa as A,go as B,Ct as C,Jr as D,Qr as E,ei as F,N as G,Wt as H,vi as I,xi as J,Lo as K,it as L,Ei as M,He as N,Ho as O,Pi as P,Ft as Q,Kt as R,Bt as S,De as T,Hi as U,Ne as V,Di as W,Ni as X,dr as Y,Bi as Z,zi as _,Gs as $,Zi as aa,ne as ba,en as ca,dt as da,Xi as ea,Ji as fa,Qi as ga,Qt as ha,Cr as ia,Aa as ja,ea as ka,pr as la,yr as ma,mr as na,gr as oa,hr as pa,Sr as qa,wr as ra,vr as sa,ta,na as ua,nn as va,oa as wa,gt as xa,ra as ya,ia as za,aa as Aa,sa as Ba,la as Ca,da as Da,Rr as Ea,ua as Fa,rn as Ga,Ta as Ha,Ma as Ia,Ca as Ja,Oa as Ka,Va as La,pa as Ma,ya as Na,ga as Oa,Se as Pa,_a as Qa,ha as Ra,St as Sa,Mr as Ta,va as Ua,Pa as Va};
|
|
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
|
+
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var n="http://www.w3.org/1999/xhtml",u=new Set(["button","submit","reset","checkbox","radio","image"]),d=new Set(["button","checkbox","switch","tab","menuitem","menuitemcheckbox","menuitemradio","option","radio","slider","spinbutton","textbox","combobox","link"]),c=new Set(["div","span","section","article","aside","header","footer","figure","p","b","i","em","strong","small","mark","time","img"]),e=(t,...r)=>t.namespaceURI===n&&r.includes(t.localName),l=t=>(t.getAttribute("type")??"text").toLowerCase(),b=t=>e(t,"textarea","select")||e(t,"input")&&!u.has(l(t)),i=t=>e(t,"input","select","textarea");function f(t){return e(t,"button","summary")||e(t,"input")&&u.has(l(t))||t.localName==="a"&&t.hasAttribute("data-graview-link")}function p(t){if(e(t,"option","optgroup","datalist"))return'An option is never pressed by itself: put data-act on its select, with data-save="change", or on a button.';if(e(t,"label"))return"A press on a label presses its field too, and would ask for the act twice: put data-act on a button, or on the field.";if(b(t)&&!t.hasAttribute("data-save"))return'A click into a field to type or to pick is not a press: give it data-save ("input" or "change") to save it as it is typed, or put data-act on a button beside it.'}var A=t=>t.hasAttribute("data-act")&&p(t)===void 0&&!(i(t)&&t.hasAttribute("data-save")),h=new Set(["button","checkbox","switch","tab"]);function E(t,r=t.getAttribute("role")){return f(t)||i(t)||e(t,"label","option")||t.hasAttribute("data-graview-link")?!1:h.has(r??"")||t.hasAttribute("aria-pressed")||t.hasAttribute("aria-expanded")}function x(t){return e(t,"button","input","select","textarea","summary","iframe")||t.localName==="a"&&t.hasAttribute("href")?!0:t.hasAttribute("tabindex")||(t.getAttribute("contenteditable")??"false")!=="false"}var P=t=>!t.hasAttribute("role")&&(t.namespaceURI!==n||c.has(t.localName));function g(t){return e(t,"button","input","select","textarea","label","summary","option")||t.hasAttribute("data-act")||t.hasAttribute("data-lightbox")||t.hasAttribute("data-drop")?!0:d.has(t.getAttribute("role")??"")}function w(t,r){return!t.hasAttribute("data-record")&&!t.hasAttribute("data-place")?!1:t.localName==="a"?!0:r||i(t)||e(t,"fieldset","form","label","option")||t.localName==="graview-video"||t.hasAttribute("data-act")||t.hasAttribute("data-lightbox")||t.hasAttribute("data-drop")||t.hasAttribute("data-field")?!1:t.getAttribute("role")!=="group"}function m(t,r){if(t.localName==="a"||t.localName==="button")return!1;let s=t.getAttribute("data-record"),a=t.getAttribute("data-place");for(let o of r)if(o.localName==="a"&&(s!==null?o.getAttribute("data-record")===s:a!==null&&o.getAttribute("data-place")===a))return!0;return!1}function k(t,r,s){for(let a=t;a&&a!==r;a=a.parentElement){if(s(a))return a;if(g(a))return}}export{b as a,f as b,A as c,E as d,x as e,P as f,w as g,m as h,k as i};
|
|
@@ -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{a as U,b as V,d as b,e as B,f as C,g as W}from"./chunk.
|
|
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 U,b as V,d as b,e as B,f as C,g as W}from"./chunk.3377DLPA.js";import{a as p,b as T,c as S,e as _}from"./chunk.BBLIT7S7.js";import{b as z}from"./chunk.FCAKLO5U.js";import{a as J,b as h,d as A}from"./chunk.H2B3SEI7.js";import{a as R}from"./chunk.SDO3U72B.js";import"./chunk.6W2DUW5S.js";import"./chunk.SLBWPVIY.js";import"./chunk.AJZBJBMO.js";var Q=R(()=>(__graviewPreload(import.meta.url,["./chunk.AJZBJBMO.js"]),import("./chunk.SHNYYBNW.js")));function te(d,e){let f=d.ownerDocument,u=f.defaultView,t=f.createElement("iframe");t.setAttribute("sandbox",T),t.setAttribute("referrerpolicy","no-referrer"),t.setAttribute("allow",""),t.setAttribute("title",e.title??e.view),t.setAttribute("data-guest-view",e.view),t.setAttribute("aria-busy","true"),t.style.border="0",t.style.width="100%",t.style.display="block",t.src=e.url;let a={applied:0,refused:0,dropped:0},P=h(e.limits),i,y,o={applied:0,refused:0,dropped:0},v=()=>{if(!i)return;let r=i.stats;a.applied+=r.applied-o.applied,a.refused+=r.refused-o.refused,a.dropped+=r.dropped-o.dropped,o={...r}},O=W(u,()=>l(),"data"),g=()=>C(()=>e.theme?.()??b(d),e.brand,O),L="",l=()=>{i&&(L=JSON.stringify(g()),i.push())},k=B(f,()=>{i&&JSON.stringify(g())!==L&&l()}),n,w=!1,D=e.pictures?z(Q,({createGuestPictures:r})=>{n=r(u,{as:"data",view:`"${e.title??e.view}"`,pictures:e.pictures,...e.limits?{limits:e.limits}:{},...e.file?{file:e.file}:{},moved:()=>{i?.push(),G&&E()}}),w&&x()}):()=>{},G=!1,c,N=()=>{!G||n?.waiting()||(clearTimeout(c),t.removeAttribute("data-guest-view-failed"),t.removeAttribute("aria-busy"),t.setAttribute("data-guest-view-drawn",""))},E=()=>{clearTimeout(c),c=setTimeout(N,250)},F=setTimeout(()=>{i||(t.removeAttribute("aria-busy"),t.setAttribute("data-guest-view-failed","silent"))},e.limits?.readyMs??8e3),H=()=>{v(),i?.dispose(),y?.close(),i=void 0,y=void 0,o={applied:0,refused:0,dropped:0}},M=r=>{if(!(r.source===null||r.source!==t.contentWindow)){if(r.origin!==S||!P.message()){a.dropped+=1;return}if(!_(r.data)||r.data.protocol!==1){a.dropped+=1;return}if(e.pictures&&!n){w=!0;return}x()}},x=()=>{w=!1,H();let r=U(),m=new MessageChannel;y=m.port1;let I=A({store:e.store,principal:e.principal,view:e.view,nonce:r,send:s=>m.port1.postMessage(s),...e.input?{input:e.input}:{},...e.reads?{reads:e.reads}:{},...n?{hand:n.hand}:{},theme:g,...e.places?{places:()=>[...new Set(e.places().map(s=>s.as))],placesShown:e.places}:{},...e.onNavigatePlace?{onNavigatePlace:e.onNavigatePlace}:{},...e.onNavigate?{onNavigate:e.onNavigate}:{},...e.onArrive?{onArrive:e.onArrive}:e.goTo?{onArrive:s=>V(e.goTo(),s)}:{},...e.onLost?{onLost:e.onLost}:{},onSize:s=>{e.onSize?e.onSize(s):t.style.height=`${s}px`,N()},...e.limits?{limits:e.limits}:{},limiter:P});i=I,m.port1.onmessage=s=>{I.receive(s.data),v()};let j={graview:"host-hello",protocol:1,nonce:r,view:e.view};t.contentWindow.postMessage(j,"*",[m.port2]),l(),G=!0,E()};return u.addEventListener("message",M),d.appendChild(t),d.removeAttribute("aria-busy"),{iframe:t,update:l,get stats(){return v(),a},dispose(){H(),clearTimeout(F),clearTimeout(c),k(),O.dispose(),D(),n?.dispose(),u.removeEventListener("message",M),t.remove()}}}export{p as GUEST_PROTOCOL,T as GUEST_SANDBOX,S as OPAQUE_ORIGIN,A as createGuestHost,h as createGuestLimiter,te as mountGuestView,J as readAcross,b as readTheme};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as h}from"./chunk.TI4OSTQV.js";import{I as k,M as I,P as M,T as w,W as R,dc as T,eb as j,fb as y,gc as N,ka as P,mc as K,ob as B,pc as b}from"./chunk.
|
|
1
|
+
import{a as h}from"./chunk.TI4OSTQV.js";import{I as k,M as I,P as M,T as w,W as R,dc as T,eb as j,fb as y,gc as N,ka as P,mc as K,ob as B,pc as b}from"./chunk.6W2DUW5S.js";var O=(e,i)=>e.expiresAt!==void 0&&Date.parse(e.expiresAt)<=Date.parse(i),L=(e,i,n)=>(e??[]).some(t=>t.suggestion===i&&(t.until===void 0||Date.parse(t.until)>Date.parse(n)));function $(e,i=()=>!0,n={}){let t=T(e),o=new Set(e.map(r=>r.lineage?.suggestion)),s=n.now??new Date().toISOString();return e.filter(r=>r.suggests&&!r.withheld&&!t.has(r.id)&&!o.has(r.id)&&!O(r,s)&&!L(n.dismissed,r.id,s)).map(({id:r,batch:g,suggests:p,intent:c,author:a,lineage:d,at:l,expiresAt:f})=>{let u=new Set;return JSON.stringify(p.map(D=>D.args),(D,x)=>(typeof x=="string"&&i(x)&&u.add(x),x)),{id:r,batch:g,calls:p,intent:c,author:a,...d?{lineage:d}:{},at:l,expiresAt:f,about:[...u]}})}function W(e,i){return e.ops.length>0&&e.ops.every(n=>n.suggests!==void 0||n.undoes!==void 0&&i(n.undoes)?.suggests!==void 0)}var v=e=>[...e].length;function F(e){let i,n=0,t=0;for(let o of e.ops){let s=o.mutation?.name===B&&o.withheld!==!0&&o.undoes===void 0?o.mutation.args:void 0;if(typeof s?.node!="string"||typeof s.field!="string"||i&&(i.node!==s.node||i.field!==s.field))return;i={node:s.node,field:s.field};for(let r of o.primitives)r.op==="splice-text"?(n+=v(r.inserted),t+=v(r.removed)):r.op==="patch-node"&&typeof r.after[s.field]=="string"&&(n+=v(r.after[s.field]))}return i&&{...i,inserted:n,removed:t}}function V(e,i,n){let t=n.getNode(e.node)?.kind,o=[...e.inserted>0||e.removed===0?[`+${e.inserted}`]:[],...e.removed>0?[`\u2212${e.removed}`]:[]];return`Wrote in ${P(t?i.tryDefinition(t):void 0,e.field)} (${o.join(" ")})`}var m=e=>JSON.stringify([e.kind,e.id??"",e.name??""]),_=e=>e.ops.find(i=>i.lineage?.run!==void 0)?.lineage?.run;function J(e,i=()=>{}){let n=[];for(let t of e){if(W(t,i))continue;if(!K(t.author)){let a=F(t),d=n.at(-1),l=a&&d&&"batch"in d&&m(d.batch.author)===m(t.author)&&d.typed?.node===a.node&&d.typed.field===a.field?d.typed:void 0;l?n[n.length-1]={batch:t,typed:{...l,batches:[...l.batches,t],inserted:l.inserted+a.inserted,removed:l.removed+a.removed}}:n.push(a?{batch:t,typed:{batches:[t],...a}}:{batch:t});continue}let o=_(t),s=m(t.author),r=o!==void 0?n.findIndex(a=>"digest"in a&&a.digest.run===o&&m(a.digest.author)===s):n.length-1,g=n[r],p=g!==void 0&&"digest"in g&&m(g.digest.author)===s&&g.digest.run===o?g.digest:void 0,c=[...p?.batches??[],t];p&&n.splice(r,1),n.push({digest:{author:t.author,batches:c,things:Y(c),at:t.at,...o!==void 0?{run:o}:{}}})}return n}var Y=e=>e.reduce((i,n)=>i+(n.undone?0:n.ops.length),0),q=e=>{let i=Date.parse(e);if(Number.isNaN(i))return!1;let{minutes:n}=M(i,I());return n<6*60||n>=21*60};function z(e,i=w(new Date().toISOString())??k()){let n=w(e.at)??e.at.slice(0,10),o=e.run!==void 0&&n===i&&[e.at,...(e.batches??[]).map(s=>s.at)].every(q)?"overnight":n===i?"today":`on ${R(n)}`;return`Tidied ${e.things===1?"one thing":`${e.things} things`} ${o}`}var S=e=>e,A=(e,i)=>i===void 0?{}:{[e]:i};function de(e,i,n){let t=h(e)?.store??e,o=S(t),s=N(n.lineage);if(s===void 0)throw new y("A suggestion says what it is based on: { basis, confidence? }");let r=n.author??o.by;if(n.expiresAt!==void 0&&Number.isNaN(Date.parse(n.expiresAt)))throw new y(`A suggestion expires at a time: "${n.expiresAt}" is not one (an ISO time, like 2026-10-23T06:00:00Z).`);let g=o.actMeanings(),p=b(i,g),c=C(t).find(u=>b(u.calls,g)===p);if(c)return t.log.get(c.id);o.refuseDeclined(i,r);let a=o.rehearsal();a.suggesting=!0;let d=a.applying(i,{author:r,lineage:s,...A("via",n.via)});if(d.ops.length===0)return;let l=[...new Set(d.ops.flatMap(u=>u.described??[]))],f={id:o.nextId(),seq:t.log.length,batch:o.mintBatch("batch"),author:r,intent:d.ops.map(u=>u.intent).join("; "),...A("batchIntent",n.intent),mutation:null,primitives:[],reads:[],writes:[],...l.length>0?{described:l}:{},at:o.now(),...A("via",n.via),lineage:s,suggests:i,...A("expiresAt",n.expiresAt)};return t.log.append(f),t.notify(j,[f]),f}function C(e,i,n={}){let t=h(e),o=t?.store??e,s=i??t?.principal,r=(s!==void 0?o.seenBy(s):o).log.all();return $(r,g=>o.graph.has(g),{now:S(o).now(),dismissed:n.dismissed})}function E(e,i,n){let t=C(e,n).find(s=>s.id===i),o=t?void 0:e.log.get(i);if(o?.suggests&&O(o,S(e).now()))throw new y(`That suggestion expired on ${o.expiresAt.slice(0,10)}.`);if(!t)throw new y("That suggestion is no longer waiting: it was accepted or declined, or it is not one you can see.");return t}function ge(e,i,n={}){let t=h(e)?.store??e,o=n.author??S(t).by,s=E(t,i,o);return t.applyAll(s.calls,{...n,author:o,lineage:{...s.lineage,suggestion:i}})}function le(e,i,n={}){let t=h(e)?.store??e,o=n.author??S(t).by,s=E(t,i,o);return t.undo(s.batch,{...n,author:o})}export{V as a,J as b,z as c,de as d,C as e,ge as f,le as g};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{E as $}from"./chunk.G6DISMVT.js";import{G as L,Oa as U,a as I,b as R,c as E,d as f,e as k,j as W,m as F,v as j}from"./chunk.B3T4N2XM.js";import{Fd as s,Md as b,Nd as r}from"./chunk.6W2DUW5S.js";import{b as H}from"./chunk.AJZBJBMO.js";var u=H(L(),1),_=e=>typeof e=="object"&&e!==null&&"idx"in e;function S(e){let n=r(window.location.pathname,e);return n===null?null:n!==s&&n!=="/"?"pages":n===s||window.location.href.includes("#")?f(window.location.hash).overview?"graview":"scene":_(window.history.state)?"pages":null}function K(e){let n=e.face??(e.stop&&E(e.stop).overview?"graview":"scene");return e.routing!=="address"||typeof window>"u"?n:S(e.basePath)??n}function Q(e){return e.routing!=="address"||typeof window>"u"?!1:r(window.location.pathname,e.basePath)==="/"&&S(e.basePath)===null}function X(e){if(typeof window>"u")return;let n=r(window.location.pathname,e);return n===s||n==="/"&&window.location.href.includes("#")?R(f(window.location.hash)):void 0}function Z({basePath:e,pagesWere:n,shown:t,onFace:i,toggle:l,kinds:N,places:w,opens:B,landed:V}){let{view:O,go:p}=U(),g=(0,u.useRef)({shown:t,view:O,onFace:i,landed:V});g.current={shown:t,view:O,onFace:i,landed:V};let m=(0,u.useRef)(n??"/"),P=()=>{m.current=`${r(window.location.pathname,e)??"/"}${window.location.search}`};return l.current=(o,c,a)=>{let{shown:d,view:h,onFace:A}=g.current;if(o==="pages"&&d!=="pages")window.history.pushState(null,"",b(c??m.current,{basePath:e}));else if(o!=="pages"&&d==="pages"){P();let y=a===void 0?h:M(E(a),w),v=q(y)?z(B):y,T=v!==y&&v.overview?"graview":o,x=Y(T,v,N);p(x),window.history.pushState(null,"",`${b(s,{basePath:e})}${k(x)}`),A?.(T);return}A?.(o)},(0,u.useEffect)(()=>{let o=()=>{if(r(window.location.pathname,e)===null)return;let c=S(e)??"pages",{shown:a,onFace:d,landed:h}=g.current;if(c==="pages"){P(),h?.(m.current),a!=="pages"&&d?.("pages");return}a==="pages"&&(p(M(f(window.location.hash),w)),d?.(c))};return window.addEventListener("popstate",o),()=>window.removeEventListener("popstate",o)},[e,p,w]),null}function M(e,n){let t=e.within?.view,i=t!==void 0&&!e.focusId?n.find(l=>l.as===t):void 0;return i?{...e,focusId:j(i.kind)}:e}function Y(e,n,t){return e==="graview"?F(n,!0):n.overview?W(F(n,!1),$(n,t)):n}function q(e){return e.focusId===null&&e.overview!==!0}function z(e){return e??{...I,overview:!0}}export{K as a,Q as b,X as c,Z as d,M as e,Y as f,q as g,z as h};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as c,b as d,c as e,d as f,e as g,f as h,g as i,h as j,i as k,j as l,k as m,l as n,m as o,n as p}from"./chunk.ULTYDYTS.js";import{a,b}from"./chunk.2LQ37DC2.js";import"./chunk.UXNZPPWR.js";import"./chunk.GYO57LKD.js";import"./chunk.MT45H2T5.js";import"./chunk.S2ATSY6P.js";import"./chunk.72Q4R7N6.js";import"./chunk.G6DISMVT.js";import"./chunk.W54NXXC5.js";import"./chunk.B3T4N2XM.js";import"./chunk.SDO3U72B.js";import"./chunk.6W2DUW5S.js";import"./chunk.SLBWPVIY.js";import"./chunk.AJZBJBMO.js";export{j as ARRANGE_NARROW,o as ArrangeBar,e as CHIP_FIELDS,d as MANY_AT_THE_FAR_END,c as TYPED_FROM,p as arrangementCaption,a as arrangementOf,i as chipOffers,m as directionWords,g as farCount,f as farCounts,l as inSentence,h as offeredFilters,n as preloadArrangeLists,k as sayCondition,b as withArrangement};
|