graview 0.1.59 → 0.1.61
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/README.md +4 -2
- package/dist/preview/{chunk.KE6ZRUMP.js → chunk.2AWVQ5SW.js} +1 -1
- package/dist/preview/{chunk.WEGPDJTB.js → chunk.2LNSENPV.js} +1 -1
- package/dist/preview/chunk.2QFKNTAZ.js +1 -0
- package/dist/preview/{chunk.PS5SEND3.js → chunk.2WZAFKJ2.js} +1 -1
- package/dist/preview/{chunk.UITZ74YJ.js → chunk.2XSIJH5J.js} +1 -1
- package/dist/preview/{chunk.WTUB7W2D.js → chunk.3FUUYYR5.js} +1 -1
- package/dist/preview/{chunk.ZLMI2NHC.js → chunk.3HFUO3DC.js} +1 -1
- package/dist/preview/chunk.3ICWPRRJ.js +1 -0
- package/dist/preview/{chunk.M3JIIF32.js → chunk.3RW677X6.js} +1 -1
- package/dist/preview/{chunk.GDUM2UOM.js → chunk.3SMNWZ3M.js} +1 -1
- package/dist/preview/{chunk.LKE2FBXL.js → chunk.4G32374Q.js} +1 -1
- package/dist/preview/{chunk.4T5QIZKB.js → chunk.4LG34OC2.js} +2 -2
- package/dist/preview/{chunk.TCPTVTFU.js → chunk.4OEWFPH3.js} +1 -1
- package/dist/preview/{chunk.SZG6HJWH.js → chunk.4STDIZVI.js} +1 -1
- package/dist/preview/{chunk.X2G4ZRB2.js → chunk.5POG3G2C.js} +1 -1
- package/dist/preview/{chunk.GR2B7SKI.js → chunk.5S7IGASX.js} +1 -1
- package/dist/preview/chunk.5T53SF2K.js +1 -0
- package/dist/preview/{chunk.E22DDEQI.js → chunk.5X22RKB3.js} +1 -1
- package/dist/preview/{chunk.4OMOP77U.js → chunk.65KFZV3A.js} +1 -1
- package/dist/preview/chunk.66IKLMYX.js +104 -0
- package/dist/preview/chunk.6DOOLVT4.js +1 -0
- package/dist/preview/{chunk.KSVJHSRH.js → chunk.6HZY5NRX.js} +1 -1
- package/dist/preview/{chunk.ATSKKTUO.js → chunk.6SO64TUI.js} +1 -1
- package/dist/preview/{chunk.J4HTSXUA.js → chunk.6VLCMBRE.js} +1 -1
- package/dist/preview/{chunk.OVSZXILB.js → chunk.747OH3EE.js} +1 -1
- package/dist/preview/chunk.7CETF4A6.js +1 -0
- package/dist/preview/{chunk.XOTES3PI.js → chunk.7LZ6JDJA.js} +2 -2
- package/dist/preview/{chunk.HKINU7VO.js → chunk.7R727IKU.js} +1 -1
- package/dist/preview/chunk.A2ZQASQV.js +1 -0
- package/dist/preview/chunk.AVFOTYZR.js +74 -0
- package/dist/preview/{chunk.IIESMHXY.js → chunk.BDTT4ENI.js} +2 -2
- package/dist/preview/{chunk.ROHSF4WM.js → chunk.BFDJTWGX.js} +1 -1
- package/dist/preview/{chunk.N4LOI3YA.js → chunk.BI6DS3PZ.js} +1 -1
- package/dist/preview/{chunk.R4YDAJRL.js → chunk.BJI2C3IZ.js} +1 -1
- package/dist/preview/{chunk.G7HIAUEA.js → chunk.C634A6ZC.js} +1 -1
- package/dist/preview/{chunk.EGJUFZD5.js → chunk.CRCJ3TAG.js} +1 -1
- package/dist/preview/{chunk.QC4YXFF7.js → chunk.CUTLO6DA.js} +1 -1
- package/dist/preview/chunk.D4TA5XDC.js +4 -0
- package/dist/preview/{chunk.QLTHHWBA.js → chunk.D5Q64GA4.js} +1 -1
- package/dist/preview/{chunk.VDGMFX5C.js → chunk.DHJI7LIW.js} +1 -1
- package/dist/preview/{chunk.CYUMQPMH.js → chunk.DHY7KOBV.js} +1 -1
- package/dist/preview/chunk.DKXVEVDG.js +1 -0
- package/dist/preview/{chunk.V6EEDYYW.js → chunk.DLDP6OWD.js} +1 -1
- package/dist/preview/{chunk.VS25R6R2.js → chunk.DP5DUV6F.js} +1 -1
- package/dist/preview/chunk.DXWTM4SH.js +1 -0
- package/dist/preview/{chunk.BDBLGGFJ.js → chunk.E6RNMWFN.js} +1 -1
- package/dist/preview/{chunk.CLR6KAA3.js → chunk.E7UDVC4V.js} +1 -1
- package/dist/preview/{chunk.W2VOD6SD.js → chunk.EN2ABVIP.js} +1 -1
- package/dist/preview/{chunk.2QESVWUW.js → chunk.EVEHSENK.js} +1 -1
- package/dist/preview/{chunk.3XIIJHQ6.js → chunk.F4VHCQNP.js} +1 -1
- package/dist/preview/{chunk.IPPZEGBX.js → chunk.F7IQ4B6A.js} +1 -1
- package/dist/preview/chunk.F7PIW2EM.js +5 -0
- package/dist/preview/{chunk.QL555VQ2.js → chunk.FC6AF6CC.js} +1 -1
- package/dist/preview/{chunk.SU6WKQ73.js → chunk.FJIXSGYU.js} +1 -1
- package/dist/preview/{chunk.6N7LNTB6.js → chunk.FWUG7Y6C.js} +1 -1
- package/dist/preview/chunk.G4VMRYS4.js +1 -0
- package/dist/preview/{chunk.7JOG6XFC.js → chunk.GI6XQF5X.js} +1 -1
- package/dist/preview/{chunk.S7ZLGODY.js → chunk.GIW657OR.js} +1 -1
- package/dist/preview/chunk.GPWYWALF.js +1 -0
- package/dist/preview/{chunk.F6P3WSMW.js → chunk.GQNSNJTJ.js} +1 -1
- package/dist/preview/chunk.HGVBGSRS.js +6 -0
- package/dist/preview/{chunk.CUJX3IVA.js → chunk.HOQMD6WQ.js} +1 -1
- package/dist/preview/{chunk.U5PX2ECA.js → chunk.HQNE4I4M.js} +1 -1
- package/dist/preview/{chunk.2FOIJ5ID.js → chunk.HZHNM2KI.js} +1 -1
- package/dist/preview/{chunk.D3AISGQH.js → chunk.IA5ZBMRD.js} +1 -1
- package/dist/preview/{chunk.ZFH4SCCF.js → chunk.ISRQQVS4.js} +1 -1
- package/dist/preview/{chunk.BPC4XQFZ.js → chunk.ISXNAFRC.js} +2 -2
- package/dist/preview/{chunk.6VNKGTLF.js → chunk.JEQO24GS.js} +1 -1
- package/dist/preview/{chunk.MZJ3KTEU.js → chunk.JHAFQNGC.js} +1 -1
- package/dist/preview/chunk.JU3BCCQM.js +1 -0
- package/dist/preview/{chunk.EZ3CRUBU.js → chunk.K2AC536Q.js} +2 -2
- package/dist/preview/chunk.K3UOXAZS.js +1 -0
- package/dist/preview/{chunk.WGTBQHHE.js → chunk.KRFRREEW.js} +1 -1
- package/dist/preview/chunk.LA2DMHZC.js +1 -0
- package/dist/preview/chunk.LQAT7FA6.js +3 -0
- package/dist/preview/{chunk.UHUBQ4EX.js → chunk.LTI5PKTS.js} +1 -1
- package/dist/preview/chunk.MBP7VDYM.js +1 -0
- package/dist/preview/{chunk.UFTAGUTU.js → chunk.MBPOYZ3J.js} +1 -1
- package/dist/preview/chunk.MBU7UH6J.js +1 -0
- package/dist/preview/chunk.MH6CCHEX.js +1 -0
- package/dist/preview/{chunk.G2TCFWYX.js → chunk.MK72IRIY.js} +1 -1
- package/dist/preview/{chunk.QXMQUIQZ.js → chunk.MNRTA2CB.js} +1 -1
- package/dist/preview/chunk.MU3XII7I.js +1 -0
- package/dist/preview/chunk.MYVED5LU.js +1 -0
- package/dist/preview/chunk.N5WDQAIM.js +5 -0
- package/dist/preview/{chunk.VNJKGSGZ.js → chunk.N7T7VB77.js} +1 -1
- package/dist/preview/{chunk.JPNBQFJ3.js → chunk.NUEPFPRA.js} +1 -1
- package/dist/preview/chunk.ODVRO2BJ.js +1 -0
- package/dist/preview/{chunk.DGM3Y2FB.js → chunk.OVPFROL3.js} +1 -1
- package/dist/preview/{chunk.RKZ4J3H2.js → chunk.PGA5TUSN.js} +1 -1
- package/dist/preview/{chunk.VGHZQEHS.js → chunk.PJ5AO7CK.js} +1 -1
- package/dist/preview/{chunk.E2REVMAG.js → chunk.PYVWGTQS.js} +1 -1
- package/dist/preview/{chunk.CIB65YO6.js → chunk.PZXTSWDH.js} +1 -1
- package/dist/preview/chunk.Q5I5M3FR.js +1 -0
- package/dist/preview/chunk.QATUGE34.js +1 -0
- package/dist/preview/{chunk.T227XQIO.js → chunk.QL77K3D4.js} +1 -1
- package/dist/preview/{chunk.VNBEAF62.js → chunk.R3N73BJO.js} +1 -1
- package/dist/preview/{chunk.3UTRR5YM.js → chunk.R5547CJ7.js} +1 -1
- package/dist/preview/chunk.REH6RXNH.js +1 -0
- package/dist/preview/{chunk.HJOVOA52.js → chunk.RZ5PPQBV.js} +1 -1
- package/dist/preview/{chunk.ATVPAYS6.js → chunk.SAYAFOF6.js} +1 -1
- package/dist/preview/{chunk.UM5H2VVR.js → chunk.SBLYBRDU.js} +1 -1
- package/dist/preview/{chunk.7XSDXX5Z.js → chunk.SCGF4ZPP.js} +1 -1
- package/dist/preview/{chunk.2MFXP3FB.js → chunk.SIYBHZDD.js} +1 -1
- package/dist/preview/{chunk.YMRVKG6W.js → chunk.SJALH7IX.js} +1 -1
- package/dist/preview/{chunk.P6CHNBRR.js → chunk.SKQO467Y.js} +1 -1
- package/dist/preview/chunk.SLAZFFCQ.js +1 -0
- package/dist/preview/chunk.SLPJWOKC.js +1 -0
- package/dist/preview/{chunk.ZUKYMU6C.js → chunk.TKLYUVMR.js} +1 -1
- package/dist/preview/chunk.TMAZNDA6.js +1 -0
- package/dist/preview/{chunk.4QWTSI7V.js → chunk.U2ISOUM2.js} +1 -1
- package/dist/preview/{chunk.BFN6B4C4.js → chunk.U3JK2DNC.js} +1 -1
- package/dist/preview/chunk.U5P23GO7.js +1 -0
- package/dist/preview/{chunk.Q3Y5EV5A.js → chunk.UACSX64H.js} +3 -3
- package/dist/preview/{chunk.7AMBLGVB.js → chunk.ULHB3RYK.js} +1 -1
- package/dist/preview/{chunk.NSGQXCH6.js → chunk.UO544PZH.js} +1 -1
- package/dist/preview/{chunk.L3K25NCS.js → chunk.UXOBUK3C.js} +1 -1
- package/dist/preview/{chunk.B5HLA45D.js → chunk.VKHAAH32.js} +1 -1
- package/dist/preview/{chunk.IZ2ZTNEV.js → chunk.VN7I7XIO.js} +1 -1
- package/dist/preview/{chunk.HF5SNUTK.js → chunk.VOOOIECX.js} +1 -1
- package/dist/preview/chunk.VS6NT5C4.js +1 -0
- package/dist/preview/{chunk.VFRURRNI.js → chunk.VUAOCYG2.js} +1 -1
- package/dist/preview/{chunk.P3CUCDHO.js → chunk.VX65S2FA.js} +1 -1
- package/dist/preview/chunk.VYFMUCBT.js +1 -0
- package/dist/preview/{chunk.HVUUJQRE.js → chunk.W5TVQYAI.js} +1 -1
- package/dist/preview/{chunk.LDYOQCY7.js → chunk.WD4VPMEE.js} +1 -1
- package/dist/preview/{chunk.DO45KXLM.js → chunk.WICFQROI.js} +1 -1
- package/dist/preview/{chunk.MRYN42EQ.js → chunk.WS7LAT4Z.js} +1 -1
- package/dist/preview/{chunk.CZH27V2R.js → chunk.X2I3XH2E.js} +1 -1
- package/dist/preview/{chunk.KOGUYWHG.js → chunk.XFSGB6EU.js} +1 -1
- package/dist/preview/{chunk.U7G56KXT.js → chunk.XWWSW3ZV.js} +1 -1
- package/dist/preview/chunk.XZUHFXME.js +1 -0
- package/dist/preview/{chunk.Z4CJJ4QP.js → chunk.XZWXDQ3N.js} +1 -1
- package/dist/preview/chunk.Y7H5O2SL.js +1 -0
- package/dist/preview/chunk.YFVJUHAK.js +1 -0
- package/dist/preview/chunk.YGIJDHAV.js +2 -0
- package/dist/preview/{chunk.MOAUE3N2.js → chunk.YOT7ESDG.js} +3 -3
- package/dist/preview/{chunk.QT6UV7HN.js → chunk.ZC3FRCJQ.js} +1 -1
- package/dist/preview/{chunk.6O3YPUW3.js → chunk.ZJCM62GH.js} +1 -1
- package/dist/preview/{chunk.DWHPZBPZ.js → chunk.ZKAZA6UJ.js} +1 -1
- package/dist/preview/{chunk.2XTCDFWU.js → chunk.ZQHCNFJK.js} +1 -1
- package/dist/preview/{chunk.2NJDT47T.js → chunk.ZVG3DR5G.js} +1 -1
- package/dist/preview/chunk.ZYNUMVEC.js +1 -0
- package/dist/preview/index.html +50 -50
- package/dist/preview/page.js +2 -2
- package/package.json +6 -6
- package/dist/preview/chunk.2FP4KEEG.js +0 -1
- package/dist/preview/chunk.3XLOFZRM.js +0 -1
- package/dist/preview/chunk.6BLNFVB4.js +0 -1
- package/dist/preview/chunk.6E36I2GC.js +0 -1
- package/dist/preview/chunk.6IUEGPCZ.js +0 -67
- package/dist/preview/chunk.AXXYJCSW.js +0 -1
- package/dist/preview/chunk.CJUIJ6TL.js +0 -1
- package/dist/preview/chunk.E4SYOBGB.js +0 -1
- package/dist/preview/chunk.FJTVY6AE.js +0 -1
- package/dist/preview/chunk.GQHFLOTZ.js +0 -5
- package/dist/preview/chunk.KHZA5F7A.js +0 -1
- package/dist/preview/chunk.KKQXGN5U.js +0 -104
- package/dist/preview/chunk.LDLTQNJ2.js +0 -1
- package/dist/preview/chunk.LHJWII6C.js +0 -1
- package/dist/preview/chunk.MHILFBK6.js +0 -1
- package/dist/preview/chunk.MMWLLWFS.js +0 -1
- package/dist/preview/chunk.NIFQDN6R.js +0 -6
- package/dist/preview/chunk.NOLGJFA4.js +0 -2
- package/dist/preview/chunk.OLW44AP5.js +0 -1
- package/dist/preview/chunk.P52UTBNO.js +0 -4
- package/dist/preview/chunk.PCVPH5KM.js +0 -1
- package/dist/preview/chunk.Q6LLURRM.js +0 -1
- package/dist/preview/chunk.QDZAITMN.js +0 -1
- package/dist/preview/chunk.QHU3KUZZ.js +0 -1
- package/dist/preview/chunk.S6VON4LU.js +0 -1
- package/dist/preview/chunk.U37WZMUO.js +0 -1
- package/dist/preview/chunk.U5JFW2YM.js +0 -1
- package/dist/preview/chunk.V5MOMBZG.js +0 -1
- package/dist/preview/chunk.VUSJ7HPC.js +0 -1
- package/dist/preview/chunk.VXRECLX6.js +0 -1
- package/dist/preview/chunk.W66VMALY.js +0 -1
- package/dist/preview/chunk.WGVIJDV5.js +0 -1
- package/dist/preview/chunk.X3MMJ3QC.js +0 -5
- package/dist/preview/chunk.X5YRNNHU.js +0 -1
- package/dist/preview/chunk.YGZCESXY.js +0 -3
- package/dist/preview/chunk.YMC2T2HN.js +0 -1
- package/dist/preview/chunk.YN6BXZHO.js +0 -1
- package/dist/preview/chunk.ZT3NEAFI.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as O,b,c as w,d as R,e as V}from"./chunk.HKINU7VO.js";import{h as d,i as S}from"./chunk.YGZCESXY.js";import{Ka as $,La as F}from"./chunk.X3MMJ3QC.js";var E=["card","row","page"],j=["good","warn","bad","neutral","accent"],U=["money","percent","date","time","datetime","relative","count"],_=4,T=40,I=120,L=["number","money","percent"],B=["large"],C=["card","row"],M=1e3,ce=100;function X(e){let n=/^\s*(out|in)\(\s*['"]([A-Za-z][A-Za-z0-9_-]*)['"]\s*\)\s*$/.exec(e);return n?{edge:n[2],way:n[1]}:/^[A-Za-z][A-Za-z0-9_-]*$/.test(e)?{edge:e}:void 0}var v={title:[],headline:[],list:["sort","limit","group","empty","as"],text:["tone","lines"],badge:["tone"],field:["as","currency","label"],image:["as","label"],progress:["label"],group:["direction"],when:["show"],divider:[],figure:["as","currency","label","emphasis"]},Z=Object.keys(v),G=`{"title": "{name}"}, {"headline": "{count(all('offer'))} offers"}, {"figure": expr, "as"?: "number"|"money"|"percent", "currency"?, "label"?, "emphasis"?: "large"}, {"list": expr, "sort"?, "limit"?, "group"?, "empty"?, "as"?: "card"|"row"}, {"text": "\u2026", "tone"?, "lines"?: 0-12}, {"badge": "{status}", "tone"?}, {"field": "quote", "as"?, "currency"?, "label"?}, {"image": "photos", "as"?: "thumb"|"gallery"}, {"progress": {"value": expr, "max": expr}, "label"?}, {"group": [blocks], "direction"?: "row"|"column"}, {"when": expr, "show": [blocks]}, {"divider": true}, {"figure": true}`,Y=e=>/^(image|video|file)$/.test(e?.of??e?.type??"");function ge(e){return Object.fromEntries(Object.entries(e.views??{}).filter(([,n])=>!Array.isArray(n)))}function ye(e){let n=e.views?.home;return Array.isArray(n)?n:void 0}var q={field:()=>!1,relation:()=>!1,figure:!1},z=e=>e.kind??"the home",m=(e,n)=>e!==void 0&&Object.hasOwn(e,n),g=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function W(e,n,t){let s=O(e);for(let a of s.unknownFunctions)t.findings.push(d("unknown-function",n,`"${a}" is not a function the rule language knows`,"see docs/declaration-document.md#expression-language"));for(let a of s.names){if(t.kind===null){t.findings.push(d("view-name",n,`"${a}" names nothing here: these blocks are about no one record`,"reach records with all('<kind>'), like count(all('offer')) or first(all('party') where role == 'client').name"));continue}a==="id"||t.spec.field(a)||t.spec.relation(a)||t.findings.push(d("view-name",n,`${t.kind} has no field or relation called "${a}"`))}for(let a of s.edges)t.edges.has(a)||t.findings.push(d("view-edge",n,`"${a}" is not a relation any kind declares`));for(let a of s.sweeps)t.kinds.has(a)||t.findings.push(d("view-kind",n,`"${a}" is not a kind this document declares`))}function k(e,n,t){if(typeof e!="string"||e.length===0||e.length>2e3){t.findings.push(d("view-expression",n,`an expression is a line of the rule language, like "status == 'booked'"`));return}try{W(w(e),n,t)}catch(s){if(!(s instanceof b))throw s;t.findings.push(d("expression",n,`${s.sentence} (at character ${s.at+1})`))}}function A(e,n,t,s,a=!1){let l=s==="text";if(typeof e!="string"||e.length===0||e.length>300){t.findings.push(d("view-template",n,'a template is words with {field} in braces, like "{name}" or "{quote|money}", at most 300 characters'));return}let r;try{r=V(e)}catch(i){if(i instanceof R||i instanceof b){t.findings.push(d("template",n,i.sentence));return}throw i}for(let i of r)if(i.expr){if(W(i.expr,n,t),l&&!a&&!i.format&&i.expr.t==="ident"&&(t.slot==="card"||t.slot==="row")&&t.spec.prose?.(i.expr.name)){let o=i.expr.name;t.findings.push(S("view-whole-text",n,`${t.kind} ${t.slot} shows ${o} whole; it will be clamped. Use {${o}|excerpt} or move it to the page.`,`write {${o}|excerpt}, or {${o}|excerpt: 80} for fewer characters`))}if(s==="headline"&&!i.format&&i.expr.t==="ident"&&t.spec.prose?.(i.expr.name)){let o=i.expr.name;t.findings.push(S("view-headline-long",n,`${z(t)}${t.slot?` ${t.slot}`:""} heads it with ${o}, a long text, drawn at a headline's size; a headline is a few words.`,`say it in a text block, {"text": "{${o}}"}, or head it with {${o}|excerpt: 60}`))}}}var K=12;function J(e,n,t){typeof e=="number"&&Number.isInteger(e)&&e>=0&&e<=K||t.findings.push(d("view-lines",n,`lines is ${JSON.stringify(e)}, and a text block's lines is a whole number from 1 to ${K}, or 0 to show it whole`,'{"text": "{awards}", "lines": 6}, or "lines": 0 for no cut at all'))}function Q(e,n,t){if(typeof e=="string"){j.includes(e)||t.findings.push(d("view-tone",n,`"${e}" is not a tone`,`use one of ${j.join(", ")}, or {"expr": "if(status == 'booked', 'good', 'neutral')"}`));return}if(g(e)&&Object.keys(e).length===1&&"expr"in e){k(e.expr,`${n}.expr`,t);return}t.findings.push(d("view-tone",n,'a tone is a word or {"expr": \u2026}',`one of ${j.join(", ")}`))}function x(e,n,t,s){if(!Array.isArray(e)){s.findings.push(d("view-shape",n,"a view is a list of blocks"));return}if(t>_){s.findings.push(d("view-depth",n,`blocks nest at most ${_} deep`,"flatten a group or a condition"));return}e.forEach((a,l)=>ee(a,`${n}.${l}`,t,s))}function ee(e,n,t,s){if(t===1&&s.count++,s.all++,!g(e)){s.findings.push(d("view-block",n,"a block is an object naming what it shows",`one of ${G}`));return}let a=Object.keys(e),l=a.filter(o=>Z.includes(o)&&!(o==="group"&&a.includes("list")));if(l.length===0){s.findings.push(d("view-block",n,`${a.length>0?a.map(o=>`"${o}"`).join(", "):"an empty object"} is not a block Graview knows`,`one of ${G}`));return}if(l.length>1){s.findings.push(d("view-block",n,`a block is one thing, and this says ${l.map(o=>`"${o}"`).join(" and ")}`,"split it into two blocks"));return}let r=l[0];for(let o of a)o!==r&&o!="key"&&!v[r].includes(o)&&s.findings.push(d("unknown-key",`${n}.${o}`,`"${o}" is not part of a ${r} block`,v[r].length>0?`a ${r} block may also say ${v[r].map(f=>`"${f}"`).join(", ")}`:`a ${r} block says nothing else`));let i=e[r];switch(r){case"title":case"headline":case"text":case"badge":A(i,`${n}.${r}`,s,r==="text"||r==="headline"?r:void 0,r==="text"&&"lines"in e),"tone"in e&&Q(e.tone,`${n}.tone`,s),r==="text"&&"lines"in e&&J(e.lines,`${n}.lines`,s);return;case"image":case"field":{let o=r==="image";if(typeof i!="string"||!(o?s.spec.files?.(i):s.spec.field(i))){let u=typeof i=="string"&&s.spec.relation(i);s.findings.push(d(`view-${r}`,`${n}.${r}`,`${s.kind} has no ${o?"image, video or file ":""}field ${typeof i=="string"?`"${i}"`:"by that name"}`,u?`"${i}" is a relation; show it with {"text": "{${i}.name}"}`:void 0))}let f=o?["thumb","gallery"]:U;"as"in e&&!f.includes(e.as)&&s.findings.push(d("view-format",`${n}.as`,`"${String(e.as)}" is not a way to show ${o?"pictures":"a field"}`,`use one of ${f.join(", ")}`)),o||D(e,n,s,"field"),"label"in e&&oe(e.label,`${n}.label`,s);return}case"progress":{!g(i)||Object.keys(i).some(o=>o!=="value"&&o!=="max")||!("value"in i)||!("max"in i)?s.findings.push(d("view-progress",`${n}.progress`,'progress is {"value": expression, "max": expression}')):(k(i.value,`${n}.progress.value`,s),k(i.max,`${n}.progress.max`,s)),"label"in e&&A(e.label,`${n}.label`,s);return}case"group":"direction"in e&&e.direction!=="row"&&e.direction!=="column"&&s.findings.push(d("view-direction",`${n}.direction`,`a group runs "row" or "column", not "${String(e.direction)}"`)),x(i,`${n}.group`,t+1,s);return;case"when":k(i,`${n}.when`,s),"show"in e?x(e.show,`${n}.show`,t+1,s):s.findings.push(d("view-when",n,'a condition says what it shows: {"when": expr, "show": [blocks]}'));return;case"figure":if(typeof i=="string")return ne(e,n,s);for(let o of["as","currency","label","emphasis"])o in e&&s.findings.push(d("unknown-key",`${n}.${o}`,`"${o}" belongs to a figure that works a number out; {"figure": true} is the kind's picture`,`write {"figure": "count(all('offer'))", "as": "number"}`));i!==!0?s.findings.push(d("view-block",`${n}.figure`,`a figure is a number worked out, {"figure": "sum(all('offer'), net)", "as": "money"}, or the kind's picture, {"figure": true}`)):s.spec.figure||s.findings.push(d("view-figure",`${n}.figure`,`${z(s)} has no figure to show`,s.kind===null?`work a number out: {"figure": "count(all('offer'))"}`:'give the kind a "figure", or leave this block out'));return;case"list":return te(e,n,s);case"divider":i!==!0&&s.findings.push(d("view-block",`${n}.${r}`,`write {"${r}": true}`));return}}function ne(e,n,t){k(e.figure,`${n}.figure`,t),"as"in e&&!L.includes(e.as)&&t.findings.push(d("view-format",`${n}.as`,`"${String(e.as)}" is not a way to say a figure`,`use one of ${L.join(", ")}`)),D(e,n,t,"figure"),"label"in e&&A(e.label,`${n}.label`,t),"emphasis"in e&&!B.includes(e.emphasis)&&t.findings.push(d("view-emphasis",`${n}.emphasis`,`"${String(e.emphasis)}" is not how loudly a figure is said`,`use ${B.map(s=>`"${s}"`).join(", ")}, or leave it out for the figure's own size`))}function D(e,n,t,s){"currency"in e&&(typeof e.currency!="string"||!/^[A-Z]{3}$/.test(e.currency)?t.findings.push(d("view-currency",`${n}.currency`,'a currency is its three-letter code, like "USD" or "EUR"')):e.as!=="money"&&t.findings.push(d("view-currency",`${n}.currency`,`a currency belongs on a ${s} shown as money`,'add "as": "money"')))}function ie(e,n){let t=[...n.kinds],s=(l,r)=>{let i=new Set;for(let o of l){let f=n.vocabulary.namesOf(o)?.targets?.(r);if(f==="*")return t;for(let u of f??[])i.add(u)}return i.size>0?[...i]:void 0},a=l=>{switch(l.t){case"ident":return n.kind!==null&&n.spec.relation(l.name)?s([n.kind],l.name):void 0;case"member":{let r=a(l.object);return r?s(r,l.name):void 0}case"where":return a(l.set);case"call":{let r=l.args[0],i=r?.t==="lit"&&typeof r.value=="string"?r.value:void 0;if(l.fn==="all")return i!==void 0&&n.kinds.has(i)?[i]:void 0;let o=l.args.length===2&&l.args[1]?.t==="lit"&&typeof l.args[1].value=="string"?l.args[1].value:void 0;if(l.fn==="out"&&o!==void 0){let f=a(r);return f?s(f,o):void 0}if(l.fn==="out")return i!==void 0&&n.kind!==null?s([n.kind],i):void 0;if(l.fn==="in"){let f=o??i,u=o!==void 0?a(r):n.kind!==null?[n.kind]:void 0,c=f!==void 0?n.vocabulary.sources(f).filter(p=>{let y=n.vocabulary.namesOf(p)?.targets?.(f);return!u||y==="*"||u.some(h=>y?.includes(h))}):[];return c.length>0?c:void 0}if((l.fn==="sort"||l.fn==="first")&&r)return a(r);if(l.fn==="either"){let f=l.args.map(a);return f.every(u=>u!==void 0)?[...new Set(f.flatMap(u=>u??[]))]:void 0}return}default:return}};return a(e)}function N(e,n,t,s){let a;try{a=w(e)}catch(r){if(!(r instanceof b))throw r;s.findings.push(d("expression",n,`${r.sentence} (at character ${r.at+1})`));return}let l=O(a);for(let r of l.unknownFunctions)s.findings.push(d("unknown-function",n,`"${r}" is not a function the rule language knows`,"see docs/declaration-document.md#expression-language"));for(let r of l.edges)s.edges.has(r)||s.findings.push(d("view-edge",n,`"${r}" is not a relation any kind declares`));if(t)for(let r of l.names)r==="id"||t.some(i=>s.vocabulary.namesOf(i)?.field(r)||s.vocabulary.namesOf(i)?.relation(r))||s.findings.push(d("view-name",n,`${t.join(" and ")} ${t.length===1?"has":"have"} no field or relation called "${r}"`))}function te(e,n,t){let s=e.list;k(s,`${n}.list`,t);let a;if(typeof s=="string")try{a=ie(w(s),t)}catch{a=void 0}let l=i=>{if(!a)return[...t.kinds].map(f=>t.vocabulary.namesOf(f)?.choices?.(i)).find(f=>f!==void 0);let o=a.map(f=>t.vocabulary.namesOf(f)?.choices?.(i));return o.every(f=>f!==void 0)?[...new Set(o.flatMap(f=>f??[]))]:void 0},r=a?a.join(" and "):"any kind";if("sort"in e){let i=e.sort;if(typeof i=="string")N(i,`${n}.sort`,a,t);else if(g(i)&&typeof i.by=="string"&&Object.keys(i).every(o=>o==="by"||o==="direction")){let o=i.direction;o!==void 0&&o!=="asc"&&o!=="desc"&&o!=="choices"?t.findings.push(d("list-sort",`${n}.sort.direction`,`a list is sorted "asc", "desc" or "choices", not "${String(o)}"`,'"choices" puts a choice field in the order its choices are declared')):o==="choices"?l(i.by)===void 0&&t.findings.push(d("list-sort",`${n}.sort.by`,`"${i.by}" is not a choice field of ${r}, so it has no declared order`,'sort by a choice field, or say "asc" or "desc"')):N(i.by,`${n}.sort.by`,a,t)}else t.findings.push(d("list-sort",`${n}.sort`,'a sort is a key, like "net", or {"by": key, "direction": "asc" | "desc" | "choices"}'))}if("limit"in e){let i=e.limit;(typeof i!="number"||!Number.isInteger(i)||i<1||i>M)&&t.findings.push(d("list-limit",`${n}.limit`,`a limit is a whole number from 1 to ${M}`))}if("group"in e){let i=e.group,o=typeof i=="string"?i:g(i)&&typeof i.by=="string"?i.by:void 0;if(!(typeof i=="string"||g(i)&&Object.keys(i).every(u=>u==="by"||u==="headings"))||o===void 0)t.findings.push(d("list-group",`${n}.group`,'a group is a choice field, like "type", or {"by": "type", "headings": {"pain": "What hurts"}} \u2014 or a relation, like "inGenre", a heading per linked record'));else{let u=l(o),c=u===void 0?X(o):void 0,p=c!==void 0&&(c.way!==void 0?t.edges.has(c.edge):a?a.every(y=>t.vocabulary.namesOf(y)?.relation(c.edge)):t.edges.has(c.edge));if(u===void 0&&!p&&t.findings.push(d("list-group",`${n}.group`,`"${o}" is not a choice field or a relation of ${r}, so it has nothing to group by`,'group by a field whose type is enum, or by a relation of the kind listed, like "inGenre"')),g(i)&&"headings"in i){let y=i.headings;if(!g(y)||Object.values(y).some(h=>typeof h!="string"||h.length===0||h.length>80))t.findings.push(d("list-group",`${n}.group.headings`,'headings are words per choice, like {"pain": "What hurts"}, at most 80 characters each'));else if(u)for(let h of Object.keys(y))u.includes(h)||t.findings.push(d("list-group",`${n}.group.headings.${h}`,`"${h}" is not one of ${o}'s choices`,`use ${u.join(", ")}`))}}}"empty"in e&&(typeof e.empty!="string"||e.empty.length===0||e.empty.length>200)&&t.findings.push(d("list-empty",`${n}.empty`,"what an empty list says is a sentence, at most 200 characters")),"as"in e&&!C.includes(e.as)&&t.findings.push(d("list-as",`${n}.as`,`a list draws each record as its "card" or its "row", not "${String(e.as)}"`))}function oe(e,n,t){(typeof e!="string"||e.length===0||e.length>60)&&t.findings.push(d("view-label",n,"a label is a few words, at most 60 characters"))}function P(e,n,t,s,a,l,r){let i={kind:null,spec:q,kinds:s,edges:a,vocabulary:t,findings:l,count:0,all:0};Array.isArray(e)&&e.length===0&&l.push(d("view-shape",n,`${r} has no blocks`,'give it one: {"headline": "\u2026"}')),x(e,n,1,i),H(i,n,r,"show less")}function H(e,n,t,s){e.count>T?e.findings.push(d("view-size",n,`${t} has ${e.count} blocks at its top; a view has at most ${T} there, a group or a condition counting as one`,`${s}, or gather some into a group`)):e.all>I&&e.findings.push(d("view-size",n,`${t} has ${e.all} blocks counting the ones inside its groups and conditions; a view has at most ${I} in all`,s))}function se(e,n,t,s,a){Array.isArray(e)&&e.forEach((l,r)=>{if(!g(l)||l.name!=="blocks"||!g(l.options)||!("blocks"in l.options))return;let i=[];P(l.options.blocks,`lenses.${r}.options.blocks`,n,t,s,i,`the lens "${String(l.title??r)}"`);for(let o of i)a.push({...o,severity:"warning"})})}function re(e,n,t,s,a,l,r){let i=[];if(e===void 0)return i;if(!g(e))return i.push(d("view-shape",n,'views are an object of kinds, each with a "card", a "row" or a "page"')),i;for(let[o,f]of Object.entries(e)){if(o==="home"&&Array.isArray(f)){P(f,`${n}.home`,r,s,a,i,"the home");continue}let u=t(o);if(!u){i.push(d("view-kind",`${n}.${o}`,`"${o}" is not a kind this ${l} declares`));continue}if(!g(f)){i.push(d("view-shape",`${n}.${o}`,`a kind's views are {"card": [blocks], "row": [blocks], "page": [blocks]}`));continue}for(let c of Object.keys(f))E.includes(c)||i.push(d("view-slot",`${n}.${o}.${c}`,`"${c}" is not a place a view is drawn`,`use ${E.map(p=>`"${p}"`).join(", ")}`));for(let c of E){let p=f[c];if(p===void 0)continue;let y={kind:o,spec:u,kinds:s,edges:a,vocabulary:r,findings:i,count:0,all:0,slot:c};x(p,`${n}.${o}.${c}`,1,y),H(y,`${n}.${o}.${c}`,`this ${c}`,"show less, or move detail to the page")}}return i}function he(e){let n=new Set(Object.keys(e.kinds)),t=new Set(Object.values(e.kinds).flatMap(r=>Object.keys($(r.edges)))),s=r=>{let i=m(e.kinds,r)?e.kinds[r]:void 0;return i?{field:o=>m(i.fields,o)||m(i.computed,o)||F(i.edges).has(o),relation:o=>m($(i.edges),o),figure:i.figure!==void 0,files:o=>m(i.fields,o)&&Y(i.fields[o]),choices:o=>m(i.fields,o)&&i.fields[o].type==="enum"?i.fields[o].options:void 0,targets:o=>m($(i.edges),o)?i.edges[o].to:void 0,prose:o=>m(i.fields,o)&&i.fields[o].type==="text"}:void 0},a={namesOf:s,sources:r=>Object.keys(e.kinds).filter(i=>m(e.kinds[i].edges,r))},l=re(e.views,"views",s,n,t,"document",a);return se(e.lenses,a,n,t,l),l}export{j as a,U as b,L as c,B as d,M as e,ce as f,X as g,ge as h,ye as i,he as j};
|
|
1
|
+
import{a as O,b,c as w,d as R,e as V}from"./chunk.7R727IKU.js";import{h as d,i as S}from"./chunk.LQAT7FA6.js";import{Ka as $,La as F}from"./chunk.F7PIW2EM.js";var E=["card","row","page"],j=["good","warn","bad","neutral","accent"],U=["money","percent","date","time","datetime","relative","count"],_=4,T=40,I=120,L=["number","money","percent"],B=["large"],C=["card","row"],M=1e3,ce=100;function X(e){let n=/^\s*(out|in)\(\s*['"]([A-Za-z][A-Za-z0-9_-]*)['"]\s*\)\s*$/.exec(e);return n?{edge:n[2],way:n[1]}:/^[A-Za-z][A-Za-z0-9_-]*$/.test(e)?{edge:e}:void 0}var v={title:[],headline:[],list:["sort","limit","group","empty","as"],text:["tone","lines"],badge:["tone"],field:["as","currency","label"],image:["as","label"],progress:["label"],group:["direction"],when:["show"],divider:[],figure:["as","currency","label","emphasis"]},Z=Object.keys(v),G=`{"title": "{name}"}, {"headline": "{count(all('offer'))} offers"}, {"figure": expr, "as"?: "number"|"money"|"percent", "currency"?, "label"?, "emphasis"?: "large"}, {"list": expr, "sort"?, "limit"?, "group"?, "empty"?, "as"?: "card"|"row"}, {"text": "\u2026", "tone"?, "lines"?: 0-12}, {"badge": "{status}", "tone"?}, {"field": "quote", "as"?, "currency"?, "label"?}, {"image": "photos", "as"?: "thumb"|"gallery"}, {"progress": {"value": expr, "max": expr}, "label"?}, {"group": [blocks], "direction"?: "row"|"column"}, {"when": expr, "show": [blocks]}, {"divider": true}, {"figure": true}`,Y=e=>/^(image|video|file)$/.test(e?.of??e?.type??"");function ge(e){return Object.fromEntries(Object.entries(e.views??{}).filter(([,n])=>!Array.isArray(n)))}function ye(e){let n=e.views?.home;return Array.isArray(n)?n:void 0}var q={field:()=>!1,relation:()=>!1,figure:!1},z=e=>e.kind??"the home",m=(e,n)=>e!==void 0&&Object.hasOwn(e,n),g=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function W(e,n,t){let s=O(e);for(let a of s.unknownFunctions)t.findings.push(d("unknown-function",n,`"${a}" is not a function the rule language knows`,"see docs/declaration-document.md#expression-language"));for(let a of s.names){if(t.kind===null){t.findings.push(d("view-name",n,`"${a}" names nothing here: these blocks are about no one record`,"reach records with all('<kind>'), like count(all('offer')) or first(all('party') where role == 'client').name"));continue}a==="id"||t.spec.field(a)||t.spec.relation(a)||t.findings.push(d("view-name",n,`${t.kind} has no field or relation called "${a}"`))}for(let a of s.edges)t.edges.has(a)||t.findings.push(d("view-edge",n,`"${a}" is not a relation any kind declares`));for(let a of s.sweeps)t.kinds.has(a)||t.findings.push(d("view-kind",n,`"${a}" is not a kind this document declares`))}function k(e,n,t){if(typeof e!="string"||e.length===0||e.length>2e3){t.findings.push(d("view-expression",n,`an expression is a line of the rule language, like "status == 'booked'"`));return}try{W(w(e),n,t)}catch(s){if(!(s instanceof b))throw s;t.findings.push(d("expression",n,`${s.sentence} (at character ${s.at+1})`))}}function A(e,n,t,s,a=!1){let l=s==="text";if(typeof e!="string"||e.length===0||e.length>300){t.findings.push(d("view-template",n,'a template is words with {field} in braces, like "{name}" or "{quote|money}", at most 300 characters'));return}let r;try{r=V(e)}catch(i){if(i instanceof R||i instanceof b){t.findings.push(d("template",n,i.sentence));return}throw i}for(let i of r)if(i.expr){if(W(i.expr,n,t),l&&!a&&!i.format&&i.expr.t==="ident"&&(t.slot==="card"||t.slot==="row")&&t.spec.prose?.(i.expr.name)){let o=i.expr.name;t.findings.push(S("view-whole-text",n,`${t.kind} ${t.slot} shows ${o} whole; it will be clamped. Use {${o}|excerpt} or move it to the page.`,`write {${o}|excerpt}, or {${o}|excerpt: 80} for fewer characters`))}if(s==="headline"&&!i.format&&i.expr.t==="ident"&&t.spec.prose?.(i.expr.name)){let o=i.expr.name;t.findings.push(S("view-headline-long",n,`${z(t)}${t.slot?` ${t.slot}`:""} heads it with ${o}, a long text, drawn at a headline's size; a headline is a few words.`,`say it in a text block, {"text": "{${o}}"}, or head it with {${o}|excerpt: 60}`))}}}var K=12;function J(e,n,t){typeof e=="number"&&Number.isInteger(e)&&e>=0&&e<=K||t.findings.push(d("view-lines",n,`lines is ${JSON.stringify(e)}, and a text block's lines is a whole number from 1 to ${K}, or 0 to show it whole`,'{"text": "{awards}", "lines": 6}, or "lines": 0 for no cut at all'))}function Q(e,n,t){if(typeof e=="string"){j.includes(e)||t.findings.push(d("view-tone",n,`"${e}" is not a tone`,`use one of ${j.join(", ")}, or {"expr": "if(status == 'booked', 'good', 'neutral')"}`));return}if(g(e)&&Object.keys(e).length===1&&"expr"in e){k(e.expr,`${n}.expr`,t);return}t.findings.push(d("view-tone",n,'a tone is a word or {"expr": \u2026}',`one of ${j.join(", ")}`))}function x(e,n,t,s){if(!Array.isArray(e)){s.findings.push(d("view-shape",n,"a view is a list of blocks"));return}if(t>_){s.findings.push(d("view-depth",n,`blocks nest at most ${_} deep`,"flatten a group or a condition"));return}e.forEach((a,l)=>ee(a,`${n}.${l}`,t,s))}function ee(e,n,t,s){if(t===1&&s.count++,s.all++,!g(e)){s.findings.push(d("view-block",n,"a block is an object naming what it shows",`one of ${G}`));return}let a=Object.keys(e),l=a.filter(o=>Z.includes(o)&&!(o==="group"&&a.includes("list")));if(l.length===0){s.findings.push(d("view-block",n,`${a.length>0?a.map(o=>`"${o}"`).join(", "):"an empty object"} is not a block Graview knows`,`one of ${G}`));return}if(l.length>1){s.findings.push(d("view-block",n,`a block is one thing, and this says ${l.map(o=>`"${o}"`).join(" and ")}`,"split it into two blocks"));return}let r=l[0];for(let o of a)o!==r&&o!="key"&&!v[r].includes(o)&&s.findings.push(d("unknown-key",`${n}.${o}`,`"${o}" is not part of a ${r} block`,v[r].length>0?`a ${r} block may also say ${v[r].map(f=>`"${f}"`).join(", ")}`:`a ${r} block says nothing else`));let i=e[r];switch(r){case"title":case"headline":case"text":case"badge":A(i,`${n}.${r}`,s,r==="text"||r==="headline"?r:void 0,r==="text"&&"lines"in e),"tone"in e&&Q(e.tone,`${n}.tone`,s),r==="text"&&"lines"in e&&J(e.lines,`${n}.lines`,s);return;case"image":case"field":{let o=r==="image";if(typeof i!="string"||!(o?s.spec.files?.(i):s.spec.field(i))){let u=typeof i=="string"&&s.spec.relation(i);s.findings.push(d(`view-${r}`,`${n}.${r}`,`${s.kind} has no ${o?"image, video or file ":""}field ${typeof i=="string"?`"${i}"`:"by that name"}`,u?`"${i}" is a relation; show it with {"text": "{${i}.name}"}`:void 0))}let f=o?["thumb","gallery"]:U;"as"in e&&!f.includes(e.as)&&s.findings.push(d("view-format",`${n}.as`,`"${String(e.as)}" is not a way to show ${o?"pictures":"a field"}`,`use one of ${f.join(", ")}`)),o||D(e,n,s,"field"),"label"in e&&oe(e.label,`${n}.label`,s);return}case"progress":{!g(i)||Object.keys(i).some(o=>o!=="value"&&o!=="max")||!("value"in i)||!("max"in i)?s.findings.push(d("view-progress",`${n}.progress`,'progress is {"value": expression, "max": expression}')):(k(i.value,`${n}.progress.value`,s),k(i.max,`${n}.progress.max`,s)),"label"in e&&A(e.label,`${n}.label`,s);return}case"group":"direction"in e&&e.direction!=="row"&&e.direction!=="column"&&s.findings.push(d("view-direction",`${n}.direction`,`a group runs "row" or "column", not "${String(e.direction)}"`)),x(i,`${n}.group`,t+1,s);return;case"when":k(i,`${n}.when`,s),"show"in e?x(e.show,`${n}.show`,t+1,s):s.findings.push(d("view-when",n,'a condition says what it shows: {"when": expr, "show": [blocks]}'));return;case"figure":if(typeof i=="string")return ne(e,n,s);for(let o of["as","currency","label","emphasis"])o in e&&s.findings.push(d("unknown-key",`${n}.${o}`,`"${o}" belongs to a figure that works a number out; {"figure": true} is the kind's picture`,`write {"figure": "count(all('offer'))", "as": "number"}`));i!==!0?s.findings.push(d("view-block",`${n}.figure`,`a figure is a number worked out, {"figure": "sum(all('offer'), net)", "as": "money"}, or the kind's picture, {"figure": true}`)):s.spec.figure||s.findings.push(d("view-figure",`${n}.figure`,`${z(s)} has no figure to show`,s.kind===null?`work a number out: {"figure": "count(all('offer'))"}`:'give the kind a "figure", or leave this block out'));return;case"list":return te(e,n,s);case"divider":i!==!0&&s.findings.push(d("view-block",`${n}.${r}`,`write {"${r}": true}`));return}}function ne(e,n,t){k(e.figure,`${n}.figure`,t),"as"in e&&!L.includes(e.as)&&t.findings.push(d("view-format",`${n}.as`,`"${String(e.as)}" is not a way to say a figure`,`use one of ${L.join(", ")}`)),D(e,n,t,"figure"),"label"in e&&A(e.label,`${n}.label`,t),"emphasis"in e&&!B.includes(e.emphasis)&&t.findings.push(d("view-emphasis",`${n}.emphasis`,`"${String(e.emphasis)}" is not how loudly a figure is said`,`use ${B.map(s=>`"${s}"`).join(", ")}, or leave it out for the figure's own size`))}function D(e,n,t,s){"currency"in e&&(typeof e.currency!="string"||!/^[A-Z]{3}$/.test(e.currency)?t.findings.push(d("view-currency",`${n}.currency`,'a currency is its three-letter code, like "USD" or "EUR"')):e.as!=="money"&&t.findings.push(d("view-currency",`${n}.currency`,`a currency belongs on a ${s} shown as money`,'add "as": "money"')))}function ie(e,n){let t=[...n.kinds],s=(l,r)=>{let i=new Set;for(let o of l){let f=n.vocabulary.namesOf(o)?.targets?.(r);if(f==="*")return t;for(let u of f??[])i.add(u)}return i.size>0?[...i]:void 0},a=l=>{switch(l.t){case"ident":return n.kind!==null&&n.spec.relation(l.name)?s([n.kind],l.name):void 0;case"member":{let r=a(l.object);return r?s(r,l.name):void 0}case"where":return a(l.set);case"call":{let r=l.args[0],i=r?.t==="lit"&&typeof r.value=="string"?r.value:void 0;if(l.fn==="all")return i!==void 0&&n.kinds.has(i)?[i]:void 0;let o=l.args.length===2&&l.args[1]?.t==="lit"&&typeof l.args[1].value=="string"?l.args[1].value:void 0;if(l.fn==="out"&&o!==void 0){let f=a(r);return f?s(f,o):void 0}if(l.fn==="out")return i!==void 0&&n.kind!==null?s([n.kind],i):void 0;if(l.fn==="in"){let f=o??i,u=o!==void 0?a(r):n.kind!==null?[n.kind]:void 0,c=f!==void 0?n.vocabulary.sources(f).filter(p=>{let y=n.vocabulary.namesOf(p)?.targets?.(f);return!u||y==="*"||u.some(h=>y?.includes(h))}):[];return c.length>0?c:void 0}if((l.fn==="sort"||l.fn==="first")&&r)return a(r);if(l.fn==="either"){let f=l.args.map(a);return f.every(u=>u!==void 0)?[...new Set(f.flatMap(u=>u??[]))]:void 0}return}default:return}};return a(e)}function N(e,n,t,s){let a;try{a=w(e)}catch(r){if(!(r instanceof b))throw r;s.findings.push(d("expression",n,`${r.sentence} (at character ${r.at+1})`));return}let l=O(a);for(let r of l.unknownFunctions)s.findings.push(d("unknown-function",n,`"${r}" is not a function the rule language knows`,"see docs/declaration-document.md#expression-language"));for(let r of l.edges)s.edges.has(r)||s.findings.push(d("view-edge",n,`"${r}" is not a relation any kind declares`));if(t)for(let r of l.names)r==="id"||t.some(i=>s.vocabulary.namesOf(i)?.field(r)||s.vocabulary.namesOf(i)?.relation(r))||s.findings.push(d("view-name",n,`${t.join(" and ")} ${t.length===1?"has":"have"} no field or relation called "${r}"`))}function te(e,n,t){let s=e.list;k(s,`${n}.list`,t);let a;if(typeof s=="string")try{a=ie(w(s),t)}catch{a=void 0}let l=i=>{if(!a)return[...t.kinds].map(f=>t.vocabulary.namesOf(f)?.choices?.(i)).find(f=>f!==void 0);let o=a.map(f=>t.vocabulary.namesOf(f)?.choices?.(i));return o.every(f=>f!==void 0)?[...new Set(o.flatMap(f=>f??[]))]:void 0},r=a?a.join(" and "):"any kind";if("sort"in e){let i=e.sort;if(typeof i=="string")N(i,`${n}.sort`,a,t);else if(g(i)&&typeof i.by=="string"&&Object.keys(i).every(o=>o==="by"||o==="direction")){let o=i.direction;o!==void 0&&o!=="asc"&&o!=="desc"&&o!=="choices"?t.findings.push(d("list-sort",`${n}.sort.direction`,`a list is sorted "asc", "desc" or "choices", not "${String(o)}"`,'"choices" puts a choice field in the order its choices are declared')):o==="choices"?l(i.by)===void 0&&t.findings.push(d("list-sort",`${n}.sort.by`,`"${i.by}" is not a choice field of ${r}, so it has no declared order`,'sort by a choice field, or say "asc" or "desc"')):N(i.by,`${n}.sort.by`,a,t)}else t.findings.push(d("list-sort",`${n}.sort`,'a sort is a key, like "net", or {"by": key, "direction": "asc" | "desc" | "choices"}'))}if("limit"in e){let i=e.limit;(typeof i!="number"||!Number.isInteger(i)||i<1||i>M)&&t.findings.push(d("list-limit",`${n}.limit`,`a limit is a whole number from 1 to ${M}`))}if("group"in e){let i=e.group,o=typeof i=="string"?i:g(i)&&typeof i.by=="string"?i.by:void 0;if(!(typeof i=="string"||g(i)&&Object.keys(i).every(u=>u==="by"||u==="headings"))||o===void 0)t.findings.push(d("list-group",`${n}.group`,'a group is a choice field, like "type", or {"by": "type", "headings": {"pain": "What hurts"}} \u2014 or a relation, like "inGenre", a heading per linked record'));else{let u=l(o),c=u===void 0?X(o):void 0,p=c!==void 0&&(c.way!==void 0?t.edges.has(c.edge):a?a.every(y=>t.vocabulary.namesOf(y)?.relation(c.edge)):t.edges.has(c.edge));if(u===void 0&&!p&&t.findings.push(d("list-group",`${n}.group`,`"${o}" is not a choice field or a relation of ${r}, so it has nothing to group by`,'group by a field whose type is enum, or by a relation of the kind listed, like "inGenre"')),g(i)&&"headings"in i){let y=i.headings;if(!g(y)||Object.values(y).some(h=>typeof h!="string"||h.length===0||h.length>80))t.findings.push(d("list-group",`${n}.group.headings`,'headings are words per choice, like {"pain": "What hurts"}, at most 80 characters each'));else if(u)for(let h of Object.keys(y))u.includes(h)||t.findings.push(d("list-group",`${n}.group.headings.${h}`,`"${h}" is not one of ${o}'s choices`,`use ${u.join(", ")}`))}}}"empty"in e&&(typeof e.empty!="string"||e.empty.length===0||e.empty.length>200)&&t.findings.push(d("list-empty",`${n}.empty`,"what an empty list says is a sentence, at most 200 characters")),"as"in e&&!C.includes(e.as)&&t.findings.push(d("list-as",`${n}.as`,`a list draws each record as its "card" or its "row", not "${String(e.as)}"`))}function oe(e,n,t){(typeof e!="string"||e.length===0||e.length>60)&&t.findings.push(d("view-label",n,"a label is a few words, at most 60 characters"))}function P(e,n,t,s,a,l,r){let i={kind:null,spec:q,kinds:s,edges:a,vocabulary:t,findings:l,count:0,all:0};Array.isArray(e)&&e.length===0&&l.push(d("view-shape",n,`${r} has no blocks`,'give it one: {"headline": "\u2026"}')),x(e,n,1,i),H(i,n,r,"show less")}function H(e,n,t,s){e.count>T?e.findings.push(d("view-size",n,`${t} has ${e.count} blocks at its top; a view has at most ${T} there, a group or a condition counting as one`,`${s}, or gather some into a group`)):e.all>I&&e.findings.push(d("view-size",n,`${t} has ${e.all} blocks counting the ones inside its groups and conditions; a view has at most ${I} in all`,s))}function se(e,n,t,s,a){Array.isArray(e)&&e.forEach((l,r)=>{if(!g(l)||l.name!=="blocks"||!g(l.options)||!("blocks"in l.options))return;let i=[];P(l.options.blocks,`lenses.${r}.options.blocks`,n,t,s,i,`the lens "${String(l.title??r)}"`);for(let o of i)a.push({...o,severity:"warning"})})}function re(e,n,t,s,a,l,r){let i=[];if(e===void 0)return i;if(!g(e))return i.push(d("view-shape",n,'views are an object of kinds, each with a "card", a "row" or a "page"')),i;for(let[o,f]of Object.entries(e)){if(o==="home"&&Array.isArray(f)){P(f,`${n}.home`,r,s,a,i,"the home");continue}let u=t(o);if(!u){i.push(d("view-kind",`${n}.${o}`,`"${o}" is not a kind this ${l} declares`));continue}if(!g(f)){i.push(d("view-shape",`${n}.${o}`,`a kind's views are {"card": [blocks], "row": [blocks], "page": [blocks]}`));continue}for(let c of Object.keys(f))E.includes(c)||i.push(d("view-slot",`${n}.${o}.${c}`,`"${c}" is not a place a view is drawn`,`use ${E.map(p=>`"${p}"`).join(", ")}`));for(let c of E){let p=f[c];if(p===void 0)continue;let y={kind:o,spec:u,kinds:s,edges:a,vocabulary:r,findings:i,count:0,all:0,slot:c};x(p,`${n}.${o}.${c}`,1,y),H(y,`${n}.${o}.${c}`,`this ${c}`,"show less, or move detail to the page")}}return i}function he(e){let n=new Set(Object.keys(e.kinds)),t=new Set(Object.values(e.kinds).flatMap(r=>Object.keys($(r.edges)))),s=r=>{let i=m(e.kinds,r)?e.kinds[r]:void 0;return i?{field:o=>m(i.fields,o)||m(i.computed,o)||F(i.edges).has(o),relation:o=>m($(i.edges),o),figure:i.figure!==void 0,files:o=>m(i.fields,o)&&Y(i.fields[o]),choices:o=>m(i.fields,o)&&i.fields[o].type==="enum"?i.fields[o].options:void 0,targets:o=>m($(i.edges),o)?i.edges[o].to:void 0,prose:o=>m(i.fields,o)&&i.fields[o].type==="text"}:void 0},a={namesOf:s,sources:r=>Object.keys(e.kinds).filter(i=>m(e.kinds[i].edges,r))},l=re(e.views,"views",s,n,t,"document",a);return se(e.lenses,a,n,t,l),l}export{j as a,U as b,L as c,B as d,M as e,ce as f,X as g,ge as h,ye as i,he as j};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as v,b as y,c as m}from"./chunk.MB7LKKUD.js";import"./chunk.
|
|
1
|
+
import{a as v,b as y,c as m}from"./chunk.MB7LKKUD.js";import"./chunk.AVFOTYZR.js";import"./chunk.HOQMD6WQ.js";import{G as N,Sa as c,T as u,Ua as b}from"./chunk.N7T7VB77.js";import"./chunk.SDO3U72B.js";import{ad as f}from"./chunk.F7PIW2EM.js";import"./chunk.FQLNBIQ5.js";import{b as p}from"./chunk.AJZBJBMO.js";var l=p(N(),1);var t=p(u(),1);function z({notices:o,anchor:n,board:a}){return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(w,{notices:o.filter(i=>i.kind==="banner"),at:"top",anchor:n,board:a}),(0,t.jsx)(w,{notices:o.filter(i=>i.kind==="toast"),at:"foot",anchor:n,board:a})]})}var h={info:"var(--graview-accent)",good:"var(--graview-good)",warn:"var(--graview-warn)",bad:"var(--graview-bad)"};function w({notices:o,at:n,anchor:a,board:i}){let d=(0,l.useRef)(null),e=o.length>0;return(0,l.useLayoutEffect)(()=>{let r=d.current;if(!e||!r)return;if(typeof r.showPopover=="function"&&!c(r))try{r.showPopover()}catch{}let s=()=>(n==="top"?m:y)(r,a());s(),n==="foot"&&i.hold?.(()=>r.matches(":hover, :focus-within"));let S=b(r);addEventListener("resize",s),addEventListener("scroll",s,!0),n==="foot"&&addEventListener(v,s);let g=typeof ResizeObserver=="function"?new ResizeObserver(s):null;return g?.observe(r),()=>{if(S(),g?.disconnect(),removeEventListener("resize",s),removeEventListener("scroll",s,!0),removeEventListener(v,s),r.isConnected&&c(r))try{r.hidePopover()}catch{}}},[e,n,a,i]),e?(0,t.jsx)("div",{ref:d,popover:"manual",role:"region","aria-label":n==="top"?"Notices":"Messages","data-testid":n==="top"?"notices-banners":"notices-toasts","data-graview-offstage":"",style:{position:"fixed",inset:"auto",margin:0,padding:0,border:"none",background:"none",overflow:"visible",zIndex:f("toast"),width:"max-content",height:"auto",maxWidth:"min(560px, calc(100vw - 32px))",display:"grid",gap:8,color:"var(--graview-ink)"},children:o.map(r=>(0,t.jsx)(C,{notice:r,board:i},r.id))}):null}var T=o=>o.split(/\s+/).filter(Boolean).map(n=>n.replace(/^Meta\+/,"\u2318").replace(/^Control\+/,"Ctrl+").replace(/^Alt\+/,"Alt+")).join(" or ");function C({notice:o,board:n}){let a=o.tone??"info",i=[...o.action?[o.action]:[],...o.actions??[]],d=()=>n.dismiss(o.id);return(0,t.jsxs)("div",{"data-testid":"notice","data-kind":o.kind,"data-tone":a,style:{boxSizing:"border-box",display:"flex",flexWrap:"wrap",alignItems:"center",gap:"8px 12px",padding:o.kind==="banner"?"8px 10px 8px 14px":"10px 12px 10px 14px",borderRadius:"var(--graview-radius, 12px)",borderTop:"1px solid var(--graview-edge)",borderRight:"1px solid var(--graview-edge)",borderBottom:"1px solid var(--graview-edge)",borderLeft:`3px solid ${h[a]}`,background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)",fontSize:"0.875rem",lineHeight:1.45},children:[(0,t.jsx)("span",{"aria-hidden":"true",style:{width:7,height:7,borderRadius:999,flex:"0 0 auto",background:h[a]}}),(0,t.jsx)("span",{style:{flex:"1 1 16rem",minWidth:0},children:o.sentence}),i.length>0?(0,t.jsx)("span",{style:{display:"flex",flexWrap:"wrap",gap:6},children:i.map((e,r)=>e.href!==void 0?(0,t.jsx)("a",{href:e.href,...e.target?{target:e.target,rel:"noopener"}:{},"data-testid":"notice-action",onClick:()=>{e.onSelect?.(),d()},style:{...x,...r===0?k:{}},children:e.label},e.label):(0,t.jsx)("button",{type:"button","data-testid":"notice-action",...e.keys?{"aria-keyshortcuts":e.keys,title:`${e.label} \u2014 ${T(e.keys)}`}:{},onClick:()=>{d(),e.onSelect?.()},style:{...x,...r===0?k:{}},children:e.label},e.label))}):null,(0,t.jsx)("button",{type:"button","data-testid":"notice-dismiss","aria-label":`Dismiss: ${o.sentence}`,title:"Dismiss",onClick:d,style:E,children:"\xD7"})]})}var x={display:"inline-flex",alignItems:"center",minHeight:28,padding:"2px 12px",borderRadius:9,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)",color:"var(--graview-ink)",font:"inherit",fontWeight:500,textDecoration:"none",cursor:"pointer"},k={background:"var(--graview-accent)",borderColor:"var(--graview-accent)",color:"var(--graview-accent-ink)"},E={minWidth:28,minHeight:28,padding:0,border:"none",background:"none",boxShadow:"none",color:"var(--graview-ink-muted)",fontSize:"1rem",cursor:"pointer"};export{z as NoticeStacks};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as Lt,b as Le,c as Dt,g as kt,h as ne,i as Ft,j as Tt}from"./chunk.GQHFLOTZ.js";import{m as Ct}from"./chunk.2XTCDFWU.js";import{g as vt}from"./chunk.YMRVKG6W.js";import{a as pt}from"./chunk.D3AISGQH.js";import{d as gt}from"./chunk.SZG6HJWH.js";import{d as yt}from"./chunk.2FOIJ5ID.js";import{C as xt,D as Pt,g as mt,p as Rt,q as wt,t as St,u as bt,v as Et}from"./chunk.6IUEGPCZ.js";import{c as Nr}from"./chunk.CUJX3IVA.js";import{G as M,O as ft,T as ee,ca as ht}from"./chunk.VNJKGSGZ.js";import{Bd as it,Cd as lt,Dd as st,Ec as nt,Sd as ut,Td as ct,Ud as dt,Vc as ot,_a as at,da as Ce,ka as de}from"./chunk.X3MMJ3QC.js";import{b as D}from"./chunk.AJZBJBMO.js";function Mr(e,t){return it(e,t).slice(1)}function fe(e,t){return e.kinds.find(r=>Mr(e,r)===t)}function Fn(e,t,r){return lt(e,t,r)}function Tn(e,t){return st(e,t)}var _=D(M(),1),g=D(M(),1),x=D(M(),1),Ve=D(M(),1),hr=D(M(),1),S=D(M(),1),tn=D(M(),1),rn=D(M(),1),an=D(M(),1),v=D(M(),1),Pr=D(M(),1);var Ae=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,Ut=/^[\\/]{2}/;function Or(e,t){return t+e.replace(/\\/g,"/")}var Nt="popstate";function ge(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function jt(e={}){let{initialEntries:t=["/"],initialIndex:r,v5Compat:a=!1}=e,n;n=t.map((h,y)=>c(h,typeof h=="string"?null:h.state,y===0?"default":void 0,typeof h=="string"?void 0:h.mask));let o=s(r??n.length-1),i="POP",l=null;function s(h){return Math.min(Math.max(h,0),n.length-1)}function u(){return n[o]}function c(h,y=null,p,f){let R=ve(n?u().pathname:"/",h,y,p,f);return O(R.pathname.charAt(0)==="/",`relative pathnames are not supported in memory history: ${JSON.stringify(h)}`),R}function d(h){return typeof h=="string"?h:W(h)}return{get index(){return o},get action(){return i},get location(){return u()},createHref:d,createURL(h){return new URL(d(h),"http://localhost")},encodeLocation(h){let y=typeof h=="string"?V(h):h;return{pathname:y.pathname||"",search:y.search||"",hash:y.hash||""}},push(h,y){i="PUSH";let p=ge(h)?h:c(h,y);o+=1,n.splice(o,n.length,p),a&&l&&l({action:i,location:p,delta:1})},replace(h,y){i="REPLACE";let p=ge(h)?h:c(h,y);n[o]=p,a&&l&&l({action:i,location:p,delta:0})},go(h){i="POP";let y=s(o+h),p=n[y];o=y,l&&l({action:i,location:p,delta:h})},listen(h){return l=h,()=>{l=null}}}}function zt(e={}){function t(a,n){let o=n.state?.masked,{pathname:i,search:l,hash:s}=o||a.location;return ve("",{pathname:i,search:l,hash:s},n.state&&n.state.usr||null,n.state&&n.state.key||"default",o?{pathname:a.location.pathname,search:a.location.search,hash:a.location.hash}:void 0)}function r(a,n){return typeof n=="string"?n:W(n)}return _r(t,r,null,e)}function L(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function O(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function Ar(){return Math.random().toString(36).substring(2,10)}function Mt(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function ve(e,t,r=null,a,n){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?V(t):t,state:r,key:t&&t.key||a||Ar(),mask:n}}function W({pathname:e="/",search:t="",hash:r=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function V(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substring(r),e=e.substring(0,r));let a=e.indexOf("?");a>=0&&(t.search=e.substring(a),e=e.substring(0,a)),e&&(t.pathname=e)}return t}function _r(e,t,r,a={}){let{window:n=document.defaultView,v5Compat:o=!1}=a,i=n.history,l="POP",s=null,u=c();u==null&&(u=0,i.replaceState({...i.state,idx:u},""));function c(){return(i.state||{idx:null}).idx}function d(){l="POP";let f=c(),R=f==null?null:f-u;u=f,s&&s({action:l,location:p.location,delta:R})}function m(f,R){l="PUSH";let w=ge(f)?f:ve(p.location,f,R);r&&r(w,f),u=c()+1;let b=Mt(w,u),P=p.createHref(w.mask||w);try{i.pushState(b,"",P)}catch(E){if(E instanceof DOMException&&E.name==="DataCloneError")throw E;n.location.assign(P)}o&&s&&s({action:l,location:p.location,delta:1})}function h(f,R){l="REPLACE";let w=ge(f)?f:ve(p.location,f,R);r&&r(w,f),u=c();let b=Mt(w,u),P=p.createHref(w.mask||w);i.replaceState(b,"",P),o&&s&&s({action:l,location:p.location,delta:0})}function y(f){return $r(n,f)}let p={get action(){return l},get location(){return e(n,i)},listen(f){if(s)throw new Error("A history only accepts one active listener");return n.addEventListener(Nt,d),s=f,()=>{n.removeEventListener(Nt,d),s=null}},createHref(f){return t(n,f)},createURL:y,encodeLocation(f){let R=y(f);return{pathname:R.pathname,search:R.search,hash:R.hash}},push:m,replace:h,go(f){return i.go(f)}};return p}function $r(e,t,r=!1){let a="http://localhost";e&&(a=e.location.origin!=="null"?e.location.origin:e.location.href),L(a,"No window.location.(origin|href) available to create URL");let n=typeof t=="string"?t:W(t);return n=n.replace(/ $/,"%20"),!r&&Ut.test(n)&&(n=a+n),new URL(n,a)}var Ir;Ir=new WeakMap;function _e(e,t,r="/"){return Hr(e,t,r,!1)}function Hr(e,t,r,a,n){let o=typeof t=="string"?V(t):t,i=U(o.pathname||"/",r);if(i==null)return null;let l=n??jr(e),s=null,u=qr(i);for(let c=0;s==null&&c<l.length;++c)s=Qr(l[c],u,a);return s}function Ur(e,t){let{route:r,pathname:a,params:n}=e;return{id:r.id,pathname:a,params:n,data:t[r.id],loaderData:t[r.id],handle:r.handle}}function jr(e){let t=Bt(e);return zr(t),t}function Bt(e,t=[],r=[],a="",n=!1){let o=(i,l,s=n,u)=>{let c={relativePath:u===void 0?i.path||"":u,caseSensitive:i.caseSensitive===!0,childrenIndex:l,route:i};if(c.relativePath.startsWith("/")){if(!c.relativePath.startsWith(a)&&s)return;L(c.relativePath.startsWith(a),`Absolute route path "${c.relativePath}" nested under path "${a}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(a.length)}let d=H([a,c.relativePath]),m=r.concat(c);i.children&&i.children.length>0&&(L(i.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${d}".`),Bt(i.children,t,m,d,s)),!(i.path==null&&!i.index)&&t.push({path:d,score:Gr(d,i.index),routesMeta:m.map((h,y)=>{let[p,f]=Vt(h.relativePath,h.caseSensitive,y===m.length-1);return{...h,matcher:p,compiledParams:f}})})};return e.forEach((i,l)=>{if(i.path===""||!i.path?.includes("?"))o(i,l);else for(let s of Wt(i.path))o(i,l,!0,s)}),t}function Wt(e){let t=e.split("/");if(t.length===0)return[];let[r,...a]=t,n=r.endsWith("?"),o=r.replace(/\?$/,"");if(a.length===0)return n?[o,""]:[o];let i=Wt(a.join("/")),l=[];return l.push(...i.map(s=>s===""?o:[o,s].join("/"))),n&&l.push(...i),l.map(s=>e.startsWith("/")&&s===""?"/":s)}function zr(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:Xr(t.routesMeta.map(a=>a.childrenIndex),r.routesMeta.map(a=>a.childrenIndex)))}var Br=/^:[\w-]+$/,Wr=3,Yr=2,Vr=1,Jr=10,Kr=-2,Ot=e=>e==="*";function Gr(e,t){let r=e.split("/"),a=r.length;return r.some(Ot)&&(a+=Kr),t&&(a+=Yr),r.filter(n=>!Ot(n)).reduce((n,o)=>n+(Br.test(o)?Wr:o===""?Vr:Jr),a)}function Xr(e,t){return e.length===t.length&&e.slice(0,-1).every((a,n)=>a===t[n])?e[e.length-1]-t[t.length-1]:0}function Qr(e,t,r=!1){let{routesMeta:a}=e,n={},o="/",i=[];for(let l=0;l<a.length;++l){let s=a[l],u=l===a.length-1,c=o==="/"?t:t.slice(o.length)||"/",d={path:s.relativePath,caseSensitive:s.caseSensitive,end:u},m=s.matcher&&s.compiledParams?Yt(d,c,s.matcher,s.compiledParams):ie(d,c),h=s.route;if(!m&&u&&r&&!a[a.length-1].route.index&&(m=ie({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},c)),!m)return null;Object.assign(n,m.params),i.push({params:n,pathname:H([o,m.pathname]),pathnameBase:ea(H([o,m.pathnameBase])),route:h}),m.pathnameBase!=="/"&&(o=H([o,m.pathnameBase]))}return i}function ie(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,a]=Vt(e.path,e.caseSensitive,e.end);return Yt(e,t,r,a)}function Yt(e,t,r,a){let n=t.match(r);if(!n)return null;let o=n[0],i=te(o,1),l=n.slice(1);return{params:a.reduce((u,{paramName:c,isOptional:d},m)=>{if(c==="*"){let y=l[m]||"";i=te(o.slice(0,o.length-y.length),1)}let h=l[m];return d&&!h?u[c]=void 0:u[c]=(h||"").replace(/%2F/g,"/"),u},{}),pathname:o,pathnameBase:i,pattern:e}}function Vt(e,t=!1,r=!0){O(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let a=[],n="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(i,l,s,u,c)=>{if(a.push({paramName:l,isOptional:s!=null}),s){let d=c.charAt(u+i.length);return d&&d!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(a.push({paramName:"*"}),n+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?n+="\\/*$":e!==""&&e!=="/"&&(n+="(?:(?=\\/|$))"),[new RegExp(n,t?void 0:"i"),a]}function qr(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return O(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function U(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,a=e.charAt(r);return a&&a!=="/"?null:e.slice(r)||"/"}function Jt(e,t="/"){let{pathname:r,search:a="",hash:n=""}=typeof e=="string"?V(e):e,o;return r?(r=Kt(r),r.startsWith("/")||r.startsWith("\\")?o=At(r.substring(1),"/"):o=At(r,t)):o=t,{pathname:o,search:ta(a),hash:ra(n)}}function At(e,t){let r=te(t).split("/");return e.split("/").forEach(n=>{n===".."?r.length>1&&r.pop():n!=="."&&r.push(n)}),r.length>1?r.join("/"):"/"}function De(e,t,r,a){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(a)}]. Please separate it out to the \`to.${r}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function Zr(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function $e(e){let t=Zr(e);return t.map((r,a)=>a===t.length-1?r.pathname:r.pathnameBase)}function Se(e,t,r,a=!1){let n;typeof e=="string"?n=V(e):(n={...e},L(!n.pathname||!n.pathname.includes("?"),De("?","pathname","search",n)),L(!n.pathname||!n.pathname.includes("#"),De("#","pathname","hash",n)),L(!n.search||!n.search.includes("#"),De("#","search","hash",n)));let o=e===""||n.pathname==="",i=o?"/":n.pathname,l;if(i==null)l=r;else{let d=t.length-1;if(!a&&i.startsWith("..")){let m=i.split("/");for(;m[0]==="..";)m.shift(),d-=1;n.pathname=m.join("/")}l=d>=0?t[d]:"/"}let s=Jt(n,l),u=i&&i!=="/"&&i.endsWith("/"),c=(o||i===".")&&r.endsWith("/");return!s.pathname.endsWith("/")&&(u||c)&&(s.pathname+="/"),s}var Kt=e=>e.replace(/[\\/]{2,}/g,"/"),H=e=>Kt(e.join("/"));function te(e,t=0){let r=e.length;for(;r>t&&e.charCodeAt(r-1)===47;)r--;return r===e.length?e:e.slice(0,r)}var ea=e=>te(e).replace(/^\/*/,"/"),ta=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,ra=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;var Gt=class{constructor(e,t,r,a=!1){this.status=e,this.statusText=t||"",this.internal=a,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}};function Xt(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function aa(e){let t=e.map(r=>r.route.path).filter(Boolean);return H(t)||"/"}var Qt=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function qt(e,t){let r=e;if(typeof r!="string"||!Ae.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let a=r,n=!1;if(Qt)try{let o=new URL(window.location.href),i=Ut.test(r)?new URL(Or(r,o.protocol)):new URL(r),l=U(i.pathname,t);i.origin===o.origin&&l!=null?r=l+i.search+i.hash:n=!0}catch{O(!1,`<Link to="${r}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:a,isExternal:n,to:r}}var Mn=Symbol("Uninstrumented");var On=Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var _t=new URL("http://localhost");function Ie(e){if(e.createURL)return e.createURL("/");try{return new URL(e.createHref("/"),_t)}catch{return _t}}function ke(e,t){return e.origin===t.origin&&(e.origin!=="null"||e.protocol===t.protocol&&e.host===t.host)}function na(e,t){if(e.startsWith("//"))return!0;let r=t.protocol.toLowerCase();return e.toLowerCase().startsWith(r)?t.host===""||e.slice(r.length).startsWith("//"):!1}function He(e,t,r,a){let n=null;try{n=e==null?null:new URL(e,r)}catch{}let o=new URL(t,r),i=n!=null&&!ke(n,r),l=!ke(o,r);if(a==="reject"){if(i||l)throw new Error("External navigation is not allowed")}else if(l&&(n==null||!na(e,n)||!ke(n,o)))throw new Error("External navigation is not allowed")}var Zt=["POST","PUT","PATCH","DELETE"],An=new Set(Zt),oa=["GET",...Zt],_n=new Set(oa);var $n=Symbol("ResetLoaderData"),ia,la,sa,ua;ia=new WeakMap;la=new WeakMap;sa=new WeakMap;ua=new WeakMap;var ca=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function da(e){try{return ca.includes(new URL(e).protocol)}catch{return!1}}var G=_.createContext(null);G.displayName="DataRouter";var re=_.createContext(null);re.displayName="DataRouterState";var er=_.createContext(!1);function fa(){return _.useContext(er)}var Ue=_.createContext({isTransitioning:!1});Ue.displayName="ViewTransition";var tr=_.createContext(new Map);tr.displayName="Fetchers";var ha=_.createContext(null);ha.displayName="Await";var N=_.createContext(null);N.displayName="Navigation";var X=_.createContext(null);X.displayName="Location";var I=_.createContext({outlet:null,matches:[],isDataRoute:!1});I.displayName="Route";var je=_.createContext(null);je.displayName="RouteError";var Ne=!0,rr="REACT_ROUTER_ERROR",ma="REDIRECT",pa="ROUTE_ERROR_RESPONSE";function ya(e){if(e.startsWith(`${rr}:${ma}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.location=="string"&&typeof t.reloadDocument=="boolean"&&typeof t.replace=="boolean")return t}catch{}}function ga(e){if(e.startsWith(`${rr}:${pa}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new Gt(t.status,t.statusText,t.data)}catch{}}function be(e,{relative:t}={}){L(Q(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:a}=g.useContext(N),{hash:n,pathname:o,search:i}=ae(e,{relative:t}),l=o;return r!=="/"&&(l=o==="/"?r:H([r,o])),a.createHref({pathname:l,search:i,hash:n})}function Q(){return g.useContext(X)!=null}function T(){return L(Q(),"useLocation() may be used only in the context of a <Router> component."),g.useContext(X).location}function va(){return g.useContext(X).navigationType}var ar="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function nr(e){g.useContext(N).static||g.useLayoutEffect(e)}function q(){let{isDataRoute:e}=g.useContext(I);return e?ka():Ra()}function Ra(){L(Q(),"useNavigate() may be used only in the context of a <Router> component.");let e=g.useContext(G),{basename:t,navigator:r}=g.useContext(N),{matches:a}=g.useContext(I),{pathname:n}=T(),o=JSON.stringify($e(a)),i=g.useRef(!1);return nr(()=>{i.current=!0}),g.useCallback((s,u={})=>{if(O(i.current,ar),!i.current)return;if(typeof s=="number"){r.go(s);return}let c=Se(s,JSON.parse(o),n,u.relative==="path");e==null&&t!=="/"&&(c.pathname=c.pathname==="/"?t:H([t,c.pathname])),He(typeof s=="string"?s:W(s),r.createHref(c),Ie(r),"reject"),(u.replace?r.replace:r.push)(c,u.state,u)},[t,r,o,n,e])}var In=g.createContext(null);function wa(){let{matches:e}=g.useContext(I);return e[e.length-1]?.params??{}}function ae(e,{relative:t}={}){let{matches:r}=g.useContext(I),{pathname:a}=T(),n=JSON.stringify($e(r));return g.useMemo(()=>Se(e,JSON.parse(n),a,t==="path"),[e,n,a,t])}function or(e,t){return ir(e,t)}function ir(e,t,r){L(Q(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:a}=g.useContext(N),{matches:n}=g.useContext(I),o=n[n.length-1],i=o?o.params:{},l=o?o.pathname:"/",s=o?o.pathnameBase:"/",u=o&&o.route;if(Ne){let f=u&&u.path||"";cr(l,!u||f.endsWith("*")||f.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${l}" (under <Route path="${f}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
1
|
+
import{a as Lt,b as Le,c as Dt,g as kt,h as ne,i as Ft,j as Tt}from"./chunk.N5WDQAIM.js";import{m as Ct}from"./chunk.ZQHCNFJK.js";import{g as vt}from"./chunk.SJALH7IX.js";import{a as pt}from"./chunk.IA5ZBMRD.js";import{d as gt}from"./chunk.4STDIZVI.js";import{d as yt}from"./chunk.HZHNM2KI.js";import{C as xt,D as Pt,g as mt,p as Rt,q as wt,t as St,u as bt,v as Et}from"./chunk.AVFOTYZR.js";import{c as Nr}from"./chunk.HOQMD6WQ.js";import{G as M,O as ft,T as ee,ca as ht}from"./chunk.N7T7VB77.js";import{$c as ot,Dd as it,Ed as lt,Fd as st,Kc as nt,Ud as ut,Vd as ct,Wd as dt,_a as at,da as Ce,ka as de}from"./chunk.F7PIW2EM.js";import{b as D}from"./chunk.AJZBJBMO.js";function Mr(e,t){return it(e,t).slice(1)}function fe(e,t){return e.kinds.find(r=>Mr(e,r)===t)}function Fn(e,t,r){return lt(e,t,r)}function Tn(e,t){return st(e,t)}var _=D(M(),1),g=D(M(),1),x=D(M(),1),Ve=D(M(),1),hr=D(M(),1),S=D(M(),1),tn=D(M(),1),rn=D(M(),1),an=D(M(),1),v=D(M(),1),Pr=D(M(),1);var Ae=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,Ut=/^[\\/]{2}/;function Or(e,t){return t+e.replace(/\\/g,"/")}var Nt="popstate";function ge(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function jt(e={}){let{initialEntries:t=["/"],initialIndex:r,v5Compat:a=!1}=e,n;n=t.map((h,y)=>c(h,typeof h=="string"?null:h.state,y===0?"default":void 0,typeof h=="string"?void 0:h.mask));let o=s(r??n.length-1),i="POP",l=null;function s(h){return Math.min(Math.max(h,0),n.length-1)}function u(){return n[o]}function c(h,y=null,p,f){let R=ve(n?u().pathname:"/",h,y,p,f);return O(R.pathname.charAt(0)==="/",`relative pathnames are not supported in memory history: ${JSON.stringify(h)}`),R}function d(h){return typeof h=="string"?h:W(h)}return{get index(){return o},get action(){return i},get location(){return u()},createHref:d,createURL(h){return new URL(d(h),"http://localhost")},encodeLocation(h){let y=typeof h=="string"?V(h):h;return{pathname:y.pathname||"",search:y.search||"",hash:y.hash||""}},push(h,y){i="PUSH";let p=ge(h)?h:c(h,y);o+=1,n.splice(o,n.length,p),a&&l&&l({action:i,location:p,delta:1})},replace(h,y){i="REPLACE";let p=ge(h)?h:c(h,y);n[o]=p,a&&l&&l({action:i,location:p,delta:0})},go(h){i="POP";let y=s(o+h),p=n[y];o=y,l&&l({action:i,location:p,delta:h})},listen(h){return l=h,()=>{l=null}}}}function zt(e={}){function t(a,n){let o=n.state?.masked,{pathname:i,search:l,hash:s}=o||a.location;return ve("",{pathname:i,search:l,hash:s},n.state&&n.state.usr||null,n.state&&n.state.key||"default",o?{pathname:a.location.pathname,search:a.location.search,hash:a.location.hash}:void 0)}function r(a,n){return typeof n=="string"?n:W(n)}return _r(t,r,null,e)}function L(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function O(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function Ar(){return Math.random().toString(36).substring(2,10)}function Mt(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function ve(e,t,r=null,a,n){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?V(t):t,state:r,key:t&&t.key||a||Ar(),mask:n}}function W({pathname:e="/",search:t="",hash:r=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function V(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substring(r),e=e.substring(0,r));let a=e.indexOf("?");a>=0&&(t.search=e.substring(a),e=e.substring(0,a)),e&&(t.pathname=e)}return t}function _r(e,t,r,a={}){let{window:n=document.defaultView,v5Compat:o=!1}=a,i=n.history,l="POP",s=null,u=c();u==null&&(u=0,i.replaceState({...i.state,idx:u},""));function c(){return(i.state||{idx:null}).idx}function d(){l="POP";let f=c(),R=f==null?null:f-u;u=f,s&&s({action:l,location:p.location,delta:R})}function m(f,R){l="PUSH";let w=ge(f)?f:ve(p.location,f,R);r&&r(w,f),u=c()+1;let b=Mt(w,u),P=p.createHref(w.mask||w);try{i.pushState(b,"",P)}catch(E){if(E instanceof DOMException&&E.name==="DataCloneError")throw E;n.location.assign(P)}o&&s&&s({action:l,location:p.location,delta:1})}function h(f,R){l="REPLACE";let w=ge(f)?f:ve(p.location,f,R);r&&r(w,f),u=c();let b=Mt(w,u),P=p.createHref(w.mask||w);i.replaceState(b,"",P),o&&s&&s({action:l,location:p.location,delta:0})}function y(f){return $r(n,f)}let p={get action(){return l},get location(){return e(n,i)},listen(f){if(s)throw new Error("A history only accepts one active listener");return n.addEventListener(Nt,d),s=f,()=>{n.removeEventListener(Nt,d),s=null}},createHref(f){return t(n,f)},createURL:y,encodeLocation(f){let R=y(f);return{pathname:R.pathname,search:R.search,hash:R.hash}},push:m,replace:h,go(f){return i.go(f)}};return p}function $r(e,t,r=!1){let a="http://localhost";e&&(a=e.location.origin!=="null"?e.location.origin:e.location.href),L(a,"No window.location.(origin|href) available to create URL");let n=typeof t=="string"?t:W(t);return n=n.replace(/ $/,"%20"),!r&&Ut.test(n)&&(n=a+n),new URL(n,a)}var Ir;Ir=new WeakMap;function _e(e,t,r="/"){return Hr(e,t,r,!1)}function Hr(e,t,r,a,n){let o=typeof t=="string"?V(t):t,i=U(o.pathname||"/",r);if(i==null)return null;let l=n??jr(e),s=null,u=qr(i);for(let c=0;s==null&&c<l.length;++c)s=Qr(l[c],u,a);return s}function Ur(e,t){let{route:r,pathname:a,params:n}=e;return{id:r.id,pathname:a,params:n,data:t[r.id],loaderData:t[r.id],handle:r.handle}}function jr(e){let t=Bt(e);return zr(t),t}function Bt(e,t=[],r=[],a="",n=!1){let o=(i,l,s=n,u)=>{let c={relativePath:u===void 0?i.path||"":u,caseSensitive:i.caseSensitive===!0,childrenIndex:l,route:i};if(c.relativePath.startsWith("/")){if(!c.relativePath.startsWith(a)&&s)return;L(c.relativePath.startsWith(a),`Absolute route path "${c.relativePath}" nested under path "${a}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(a.length)}let d=H([a,c.relativePath]),m=r.concat(c);i.children&&i.children.length>0&&(L(i.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${d}".`),Bt(i.children,t,m,d,s)),!(i.path==null&&!i.index)&&t.push({path:d,score:Gr(d,i.index),routesMeta:m.map((h,y)=>{let[p,f]=Vt(h.relativePath,h.caseSensitive,y===m.length-1);return{...h,matcher:p,compiledParams:f}})})};return e.forEach((i,l)=>{if(i.path===""||!i.path?.includes("?"))o(i,l);else for(let s of Wt(i.path))o(i,l,!0,s)}),t}function Wt(e){let t=e.split("/");if(t.length===0)return[];let[r,...a]=t,n=r.endsWith("?"),o=r.replace(/\?$/,"");if(a.length===0)return n?[o,""]:[o];let i=Wt(a.join("/")),l=[];return l.push(...i.map(s=>s===""?o:[o,s].join("/"))),n&&l.push(...i),l.map(s=>e.startsWith("/")&&s===""?"/":s)}function zr(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:Xr(t.routesMeta.map(a=>a.childrenIndex),r.routesMeta.map(a=>a.childrenIndex)))}var Br=/^:[\w-]+$/,Wr=3,Yr=2,Vr=1,Jr=10,Kr=-2,Ot=e=>e==="*";function Gr(e,t){let r=e.split("/"),a=r.length;return r.some(Ot)&&(a+=Kr),t&&(a+=Yr),r.filter(n=>!Ot(n)).reduce((n,o)=>n+(Br.test(o)?Wr:o===""?Vr:Jr),a)}function Xr(e,t){return e.length===t.length&&e.slice(0,-1).every((a,n)=>a===t[n])?e[e.length-1]-t[t.length-1]:0}function Qr(e,t,r=!1){let{routesMeta:a}=e,n={},o="/",i=[];for(let l=0;l<a.length;++l){let s=a[l],u=l===a.length-1,c=o==="/"?t:t.slice(o.length)||"/",d={path:s.relativePath,caseSensitive:s.caseSensitive,end:u},m=s.matcher&&s.compiledParams?Yt(d,c,s.matcher,s.compiledParams):ie(d,c),h=s.route;if(!m&&u&&r&&!a[a.length-1].route.index&&(m=ie({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},c)),!m)return null;Object.assign(n,m.params),i.push({params:n,pathname:H([o,m.pathname]),pathnameBase:ea(H([o,m.pathnameBase])),route:h}),m.pathnameBase!=="/"&&(o=H([o,m.pathnameBase]))}return i}function ie(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,a]=Vt(e.path,e.caseSensitive,e.end);return Yt(e,t,r,a)}function Yt(e,t,r,a){let n=t.match(r);if(!n)return null;let o=n[0],i=te(o,1),l=n.slice(1);return{params:a.reduce((u,{paramName:c,isOptional:d},m)=>{if(c==="*"){let y=l[m]||"";i=te(o.slice(0,o.length-y.length),1)}let h=l[m];return d&&!h?u[c]=void 0:u[c]=(h||"").replace(/%2F/g,"/"),u},{}),pathname:o,pathnameBase:i,pattern:e}}function Vt(e,t=!1,r=!0){O(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let a=[],n="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(i,l,s,u,c)=>{if(a.push({paramName:l,isOptional:s!=null}),s){let d=c.charAt(u+i.length);return d&&d!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(a.push({paramName:"*"}),n+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?n+="\\/*$":e!==""&&e!=="/"&&(n+="(?:(?=\\/|$))"),[new RegExp(n,t?void 0:"i"),a]}function qr(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return O(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function U(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,a=e.charAt(r);return a&&a!=="/"?null:e.slice(r)||"/"}function Jt(e,t="/"){let{pathname:r,search:a="",hash:n=""}=typeof e=="string"?V(e):e,o;return r?(r=Kt(r),r.startsWith("/")||r.startsWith("\\")?o=At(r.substring(1),"/"):o=At(r,t)):o=t,{pathname:o,search:ta(a),hash:ra(n)}}function At(e,t){let r=te(t).split("/");return e.split("/").forEach(n=>{n===".."?r.length>1&&r.pop():n!=="."&&r.push(n)}),r.length>1?r.join("/"):"/"}function De(e,t,r,a){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(a)}]. Please separate it out to the \`to.${r}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function Zr(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function $e(e){let t=Zr(e);return t.map((r,a)=>a===t.length-1?r.pathname:r.pathnameBase)}function Se(e,t,r,a=!1){let n;typeof e=="string"?n=V(e):(n={...e},L(!n.pathname||!n.pathname.includes("?"),De("?","pathname","search",n)),L(!n.pathname||!n.pathname.includes("#"),De("#","pathname","hash",n)),L(!n.search||!n.search.includes("#"),De("#","search","hash",n)));let o=e===""||n.pathname==="",i=o?"/":n.pathname,l;if(i==null)l=r;else{let d=t.length-1;if(!a&&i.startsWith("..")){let m=i.split("/");for(;m[0]==="..";)m.shift(),d-=1;n.pathname=m.join("/")}l=d>=0?t[d]:"/"}let s=Jt(n,l),u=i&&i!=="/"&&i.endsWith("/"),c=(o||i===".")&&r.endsWith("/");return!s.pathname.endsWith("/")&&(u||c)&&(s.pathname+="/"),s}var Kt=e=>e.replace(/[\\/]{2,}/g,"/"),H=e=>Kt(e.join("/"));function te(e,t=0){let r=e.length;for(;r>t&&e.charCodeAt(r-1)===47;)r--;return r===e.length?e:e.slice(0,r)}var ea=e=>te(e).replace(/^\/*/,"/"),ta=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,ra=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;var Gt=class{constructor(e,t,r,a=!1){this.status=e,this.statusText=t||"",this.internal=a,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}};function Xt(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function aa(e){let t=e.map(r=>r.route.path).filter(Boolean);return H(t)||"/"}var Qt=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function qt(e,t){let r=e;if(typeof r!="string"||!Ae.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let a=r,n=!1;if(Qt)try{let o=new URL(window.location.href),i=Ut.test(r)?new URL(Or(r,o.protocol)):new URL(r),l=U(i.pathname,t);i.origin===o.origin&&l!=null?r=l+i.search+i.hash:n=!0}catch{O(!1,`<Link to="${r}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:a,isExternal:n,to:r}}var Mn=Symbol("Uninstrumented");var On=Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var _t=new URL("http://localhost");function Ie(e){if(e.createURL)return e.createURL("/");try{return new URL(e.createHref("/"),_t)}catch{return _t}}function ke(e,t){return e.origin===t.origin&&(e.origin!=="null"||e.protocol===t.protocol&&e.host===t.host)}function na(e,t){if(e.startsWith("//"))return!0;let r=t.protocol.toLowerCase();return e.toLowerCase().startsWith(r)?t.host===""||e.slice(r.length).startsWith("//"):!1}function He(e,t,r,a){let n=null;try{n=e==null?null:new URL(e,r)}catch{}let o=new URL(t,r),i=n!=null&&!ke(n,r),l=!ke(o,r);if(a==="reject"){if(i||l)throw new Error("External navigation is not allowed")}else if(l&&(n==null||!na(e,n)||!ke(n,o)))throw new Error("External navigation is not allowed")}var Zt=["POST","PUT","PATCH","DELETE"],An=new Set(Zt),oa=["GET",...Zt],_n=new Set(oa);var $n=Symbol("ResetLoaderData"),ia,la,sa,ua;ia=new WeakMap;la=new WeakMap;sa=new WeakMap;ua=new WeakMap;var ca=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function da(e){try{return ca.includes(new URL(e).protocol)}catch{return!1}}var G=_.createContext(null);G.displayName="DataRouter";var re=_.createContext(null);re.displayName="DataRouterState";var er=_.createContext(!1);function fa(){return _.useContext(er)}var Ue=_.createContext({isTransitioning:!1});Ue.displayName="ViewTransition";var tr=_.createContext(new Map);tr.displayName="Fetchers";var ha=_.createContext(null);ha.displayName="Await";var N=_.createContext(null);N.displayName="Navigation";var X=_.createContext(null);X.displayName="Location";var I=_.createContext({outlet:null,matches:[],isDataRoute:!1});I.displayName="Route";var je=_.createContext(null);je.displayName="RouteError";var Ne=!0,rr="REACT_ROUTER_ERROR",ma="REDIRECT",pa="ROUTE_ERROR_RESPONSE";function ya(e){if(e.startsWith(`${rr}:${ma}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.location=="string"&&typeof t.reloadDocument=="boolean"&&typeof t.replace=="boolean")return t}catch{}}function ga(e){if(e.startsWith(`${rr}:${pa}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new Gt(t.status,t.statusText,t.data)}catch{}}function be(e,{relative:t}={}){L(Q(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:a}=g.useContext(N),{hash:n,pathname:o,search:i}=ae(e,{relative:t}),l=o;return r!=="/"&&(l=o==="/"?r:H([r,o])),a.createHref({pathname:l,search:i,hash:n})}function Q(){return g.useContext(X)!=null}function T(){return L(Q(),"useLocation() may be used only in the context of a <Router> component."),g.useContext(X).location}function va(){return g.useContext(X).navigationType}var ar="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function nr(e){g.useContext(N).static||g.useLayoutEffect(e)}function q(){let{isDataRoute:e}=g.useContext(I);return e?ka():Ra()}function Ra(){L(Q(),"useNavigate() may be used only in the context of a <Router> component.");let e=g.useContext(G),{basename:t,navigator:r}=g.useContext(N),{matches:a}=g.useContext(I),{pathname:n}=T(),o=JSON.stringify($e(a)),i=g.useRef(!1);return nr(()=>{i.current=!0}),g.useCallback((s,u={})=>{if(O(i.current,ar),!i.current)return;if(typeof s=="number"){r.go(s);return}let c=Se(s,JSON.parse(o),n,u.relative==="path");e==null&&t!=="/"&&(c.pathname=c.pathname==="/"?t:H([t,c.pathname])),He(typeof s=="string"?s:W(s),r.createHref(c),Ie(r),"reject"),(u.replace?r.replace:r.push)(c,u.state,u)},[t,r,o,n,e])}var In=g.createContext(null);function wa(){let{matches:e}=g.useContext(I);return e[e.length-1]?.params??{}}function ae(e,{relative:t}={}){let{matches:r}=g.useContext(I),{pathname:a}=T(),n=JSON.stringify($e(r));return g.useMemo(()=>Se(e,JSON.parse(n),a,t==="path"),[e,n,a,t])}function or(e,t){return ir(e,t)}function ir(e,t,r){L(Q(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:a}=g.useContext(N),{matches:n}=g.useContext(I),o=n[n.length-1],i=o?o.params:{},l=o?o.pathname:"/",s=o?o.pathnameBase:"/",u=o&&o.route;if(Ne){let f=u&&u.path||"";cr(l,!u||f.endsWith("*")||f.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${l}" (under <Route path="${f}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
2
2
|
|
|
3
3
|
Please change the parent <Route path="${f}"> to <Route path="${f==="/"?"*":`${f}/*`}">.`)}let c=T(),d;if(t){let f=typeof t=="string"?V(t):t;L(s==="/"||f.pathname?.startsWith(s),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${s}" but pathname "${f.pathname}" was given in the \`location\` prop.`),d=f}else d=c;let m=d.pathname||"/",h=m;if(s!=="/"){let f=s.replace(/^\//,"").split("/");h="/"+m.replace(/^\//,"").split("/").slice(f.length).join("/")}let y=r&&r.state.matches.length?r.state.matches.map(f=>Object.assign(f,{route:r.manifest[f.route.id]||f.route})):_e(e,{pathname:h});Ne&&(O(u||y!=null,`No routes matched location "${d.pathname}${d.search}${d.hash}" `),O(y==null||y[y.length-1].route.element!==void 0||y[y.length-1].route.Component!==void 0||y[y.length-1].route.lazy!==void 0,`Matched leaf route at location "${d.pathname}${d.search}${d.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`));let p=Pa(y&&y.map(f=>Object.assign({},f,{params:Object.assign({},i,f.params),pathname:H([s,a.encodeLocation?a.encodeLocation(f.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:f.pathname]),pathnameBase:f.pathnameBase==="/"?s:H([s,a.encodeLocation?a.encodeLocation(f.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:f.pathnameBase])})),n,r);return t&&p?g.createElement(X.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...d},navigationType:"POP"}},p):p}function Sa(){let e=ur(),t=Xt(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,a="rgba(200,200,200, 0.5)",n={padding:"0.5rem",backgroundColor:a},o={padding:"2px 4px",backgroundColor:a},i=null;return Ne&&(console.error("Error handled by React Router default ErrorBoundary:",e),i=g.createElement(g.Fragment,null,g.createElement("p",null,"\u{1F4BF} Hey developer \u{1F44B}"),g.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",g.createElement("code",{style:o},"ErrorBoundary")," or"," ",g.createElement("code",{style:o},"errorElement")," prop on your route."))),g.createElement(g.Fragment,null,g.createElement("h2",null,"Unexpected Application Error!"),g.createElement("h3",{style:{fontStyle:"italic"}},t),r?g.createElement("pre",{style:n},r):null,i)}var ba=g.createElement(Sa,null),lr=class extends g.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){let r=ga(e.digest);r&&(e=r)}let t=e!==void 0?g.createElement(I.Provider,{value:this.props.routeContext},g.createElement(je.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?g.createElement(Ea,{error:e},t):t}};lr.contextType=er;var Fe=new WeakMap;function Ea({children:e,error:t}){let{basename:r,navigator:a}=g.useContext(N);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let n=ya(t.digest);if(n){let o=Fe.get(t);if(o)throw o;let i=qt(n.location,r),l=i.absoluteURL||i.to;if(He(n.location,l,Ie(a),"allow-explicit"),da(l))throw new Error("Invalid redirect location");if(Qt&&!Fe.get(t))if(i.isExternal||n.reloadDocument)window.location.href=l;else{let s=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:n.replace}));throw Fe.set(t,s),s}return g.createElement("meta",{httpEquiv:"refresh",content:`0;url=${l}`})}}return e}function xa({routeContext:e,match:t,children:r}){let a=g.useContext(G);return a&&a.static&&a.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=t.route.id),g.createElement(I.Provider,{value:e},r)}function Pa(e,t=[],r){let a=r?.state;if(e==null){if(!a)return null;if(a.errors)e=a.matches;else if(t.length===0&&!a.initialized&&a.matches.length>0)e=a.matches;else return null}let n=e,o=a?.errors;if(o!=null){let c=n.findIndex(d=>d.route.id&&o?.[d.route.id]!==void 0);L(c>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(",")}`),n=n.slice(0,Math.min(n.length,c+1))}let i=!1,l=-1;if(r&&a){i=a.renderFallback;for(let c=0;c<n.length;c++){let d=n[c];if((d.route.HydrateFallback||d.route.hydrateFallbackElement)&&(l=c),d.route.id){let{loaderData:m,errors:h}=a,y=d.route.loader&&!m.hasOwnProperty(d.route.id)&&(!h||h[d.route.id]===void 0);if(d.route.lazy||y){r.isStatic&&(i=!0),l>=0?n=n.slice(0,l+1):n=[n[0]];break}}}}let s=r?.onError,u=a&&s?(c,d)=>{s(c,{location:a.location,params:a.matches?.[0]?.params??{},pattern:aa(a.matches),errorInfo:d})}:void 0;return n.reduceRight((c,d,m)=>{let h,y=!1,p=null,f=null;a&&(h=o&&d.route.id?o[d.route.id]:void 0,p=d.route.errorElement||ba,i&&(l<0&&m===0?(cr("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),y=!0,f=null):l===m&&(y=!0,f=d.route.hydrateFallbackElement||null)));let R=t.concat(n.slice(0,m+1)),w=()=>{let b;return h?b=p:y?b=f:d.route.Component?b=g.createElement(d.route.Component,null):d.route.element?b=d.route.element:b=c,g.createElement(xa,{match:d,routeContext:{outlet:c,matches:R,isDataRoute:a!=null},children:b})};return a&&(d.route.ErrorBoundary||d.route.errorElement||m===0)?g.createElement(lr,{location:a.location,revalidation:a.revalidation,component:p,error:h,children:w(),routeContext:{outlet:null,matches:R,isDataRoute:!0},onError:u}):w()},null)}function ze(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Ca(e){let t=g.useContext(G);return L(t,ze(e)),t}function Be(e){let t=g.useContext(re);return L(t,ze(e)),t}function La(e){let t=g.useContext(I);return L(t,ze(e)),t}function We(e){let t=La(e),r=t.matches[t.matches.length-1];return L(r.route.id,`${e} can only be used on routes that contain a unique "id"`),r.route.id}function Da(){return We("useRouteId")}function sr(){let e=Be("useNavigation");return g.useMemo(()=>{let{matches:t,historyAction:r,...a}=e.navigation;return a},[e.navigation])}function Ye(){let{matches:e,loaderData:t}=Be("useMatches");return g.useMemo(()=>e.map(r=>Ur(r,t)),[e,t])}function ur(){let e=g.useContext(je),t=Be("useRouteError"),r=We("useRouteError");return e!==void 0?e:t.errors?.[r]}function ka(){let{router:e}=Ca("useNavigate"),t=We("useNavigate"),r=g.useRef(!1);return nr(()=>{r.current=!0}),g.useCallback(async(n,o={})=>{O(r.current,ar),r.current&&(typeof n=="number"?await e.navigate(n):await e.navigate(n,{fromRouteId:t,...o}))},[e,t])}var $t={};function cr(e,t,r){!t&&!$t[e]&&($t[e]=!0,O(!1,r))}var Fa="useOptimistic",Hn=x[Fa];var Un=x.memo(Ta);function Ta({routes:e,manifest:t,future:r,state:a,isStatic:n,onError:o}){return ir(e,void 0,{manifest:t,state:a,isStatic:n,onError:o,future:r})}function Na({basename:e,children:t,initialEntries:r,initialIndex:a,useTransitions:n}){let o=x.useRef();o.current==null&&(o.current=jt({initialEntries:r,initialIndex:a,v5Compat:!0}));let i=o.current,[l,s]=x.useState({action:i.action,location:i.location}),u=x.useCallback(c=>{n===!1?s(c):x.startTransition(()=>s(c))},[n]);return x.useLayoutEffect(()=>i.listen(u),[i,u]),x.createElement(Ee,{basename:e,children:t,location:l.location,navigationType:l.action,navigator:i,useTransitions:n})}function Ma({to:e,replace:t,state:r,relative:a}){L(Q(),"<Navigate> may be used only in the context of a <Router> component.");let{static:n,navigator:o}=x.useContext(N);O(!n,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:i}=x.useContext(I),{pathname:l}=T(),s=q(),u=Se(e,$e(i),l,a==="path");He(typeof e=="string"?e:W(e),o.createHref(u),Ie(o),"reject");let c=JSON.stringify(u);return x.useEffect(()=>{s(JSON.parse(c),{replace:t,state:r,relative:a})},[s,c,a,t,r]),null}function dr(e){L(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function Ee({basename:e="/",children:t=null,location:r,navigationType:a="POP",navigator:n,static:o=!1,useTransitions:i}){L(!Q(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let l=e.replace(/^\/*/,"/"),s=x.useMemo(()=>({basename:l,navigator:n,static:o,useTransitions:i,future:{}}),[l,n,o,i]);typeof r=="string"&&(r=V(r));let{pathname:u="/",search:c="",hash:d="",state:m=null,key:h="default",mask:y}=r,p=x.useMemo(()=>{let f=U(u,l);return f==null?null:{location:{pathname:f,search:c,hash:d,state:m,key:h,mask:y},navigationType:a}},[l,u,c,d,m,h,a,y]);return O(p!=null,`<Router basename="${l}"> is not able to match the URL "${u}${c}${d}" because it does not start with the basename, so the <Router> won't render anything.`),p==null?null:x.createElement(N.Provider,{value:s},x.createElement(X.Provider,{children:t,value:p}))}function Oa({children:e,location:t}){return or(Re(e),t)}function Re(e,t=[]){let r=[];return x.Children.forEach(e,(a,n)=>{if(!x.isValidElement(a))return;let o=[...t,n];if(a.type===x.Fragment){r.push.apply(r,Re(a.props.children,o));return}L(a.type===dr,`[${typeof a.type=="string"?a.type:a.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),L(!a.props.index||!a.props.children,"An index route cannot have child routes.");let i={id:a.props.id||o.join("-"),caseSensitive:a.props.caseSensitive,element:a.props.element,Component:a.props.Component,index:a.props.index,path:a.props.path,middleware:a.props.middleware,loader:a.props.loader,action:a.props.action,hydrateFallbackElement:a.props.hydrateFallbackElement,HydrateFallback:a.props.HydrateFallback,errorElement:a.props.errorElement,ErrorBoundary:a.props.ErrorBoundary,hasErrorBoundary:a.props.hasErrorBoundary===!0||a.props.ErrorBoundary!=null||a.props.errorElement!=null,shouldRevalidate:a.props.shouldRevalidate,handle:a.props.handle,lazy:a.props.lazy};a.props.children&&(i.children=Re(a.props.children,o)),r.push(i)}),r}var pe="get",ye="application/x-www-form-urlencoded";function xe(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function Aa(e){return xe(e)&&e.tagName.toLowerCase()==="button"}function _a(e){return xe(e)&&e.tagName.toLowerCase()==="form"}function $a(e){return xe(e)&&e.tagName.toLowerCase()==="input"}function Ia(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Ha(e,t){return e.button===0&&(!t||t==="_self")&&!Ia(e)}function we(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,r)=>{let a=e[r];return t.concat(Array.isArray(a)?a.map(n=>[r,n]):[[r,a]])},[]))}function Ua(e,t){let r=we(e);return t&&t.forEach((a,n)=>{r.has(n)||t.getAll(n).forEach(o=>{r.append(n,o)})}),r}var he=null;function ja(){if(he===null)try{new FormData(document.createElement("form"),0),he=!1}catch{he=!0}return he}var za=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Te(e){return e!=null&&!za.has(e)?(O(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${ye}"`),null):e}function Ba(e,t){let r,a,n,o,i;if(_a(e)){let l=e.getAttribute("action");a=l?U(l,t):null,r=e.getAttribute("method")||pe,n=Te(e.getAttribute("enctype"))||ye,o=new FormData(e)}else if(Aa(e)||$a(e)&&(e.type==="submit"||e.type==="image")){let l=e.form;if(l==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let s=e.getAttribute("formaction")||l.getAttribute("action");if(a=s?U(s,t):null,r=e.getAttribute("formmethod")||l.getAttribute("method")||pe,n=Te(e.getAttribute("formenctype"))||Te(l.getAttribute("enctype"))||ye,o=new FormData(l,e),!ja()){let{name:u,type:c,value:d}=e;if(c==="image"){let m=u?`${u}.`:"";o.append(`${m}x`,"0"),o.append(`${m}y`,"0")}else u&&o.append(u,d)}}else{if(xe(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=pe,a=null,n=ye,i=e}return o&&n==="text/plain"&&(i=o,o=void 0),{action:a,method:r.toLowerCase(),encType:n,formData:o,body:i}}var jn=Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var Wa={"&":"\\u0026",">":"\\u003e","<":"\\u003c","\u2028":"\\u2028","\u2029":"\\u2029"},Ya=/[&><\u2028\u2029]/g;function It(e){return e.replace(Ya,t=>Wa[t])}function Je(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}var Va=Symbol("SingleFetchRedirect");function fr(e,t,r,a){let n=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return r?n.pathname.endsWith("/")?n.pathname=`${n.pathname}_.${a}`:n.pathname=`${n.pathname}.${a}`:n.pathname==="/"?n.pathname=`_root.${a}`:t&&U(n.pathname,t)==="/"?n.pathname=`${te(t)}/_root.${a}`:n.pathname=`${te(n.pathname)}.${a}`,n}async function Ja(e,t){if(e.id in t)return t[e.id];try{let r=await import(e.module);return t[e.id]=r,r}catch(r){if(console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(r),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode&&import.meta.hot)throw r;return window.location.reload(),new Promise(()=>{})}}function Ka(e){return e!=null&&typeof e.page=="string"}function Ga(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function Xa(e,t,r){let a=await Promise.all(e.map(async n=>{let o=t.routes[n.route.id];if(o){let i=await Ja(o,r);return i.links?i.links():[]}return[]}));return en(a.flat(1).filter(Ga).filter(n=>n.rel==="stylesheet"||n.rel==="preload").map(n=>n.rel==="stylesheet"?{...n,rel:"prefetch",as:"style"}:{...n,rel:"prefetch"}))}function Ht(e,t,r,a,n,o){let i=(s,u)=>r[u]?s.route.id!==r[u].route.id:!0,l=(s,u)=>r[u].pathname!==s.pathname||r[u].route.path?.endsWith("*")&&r[u].params["*"]!==s.params["*"];return o==="assets"?t.filter((s,u)=>i(s,u)||l(s,u)):o==="data"?t.filter((s,u)=>{let c=a.routes[s.route.id];if(!c||!c.hasLoader)return!1;if(i(s,u)||l(s,u))return!0;if(s.route.shouldRevalidate){let d=s.route.shouldRevalidate({currentUrl:new URL(n.pathname+n.search+n.hash,window.origin),currentParams:r[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:s.params,defaultShouldRevalidate:!0});if(typeof d=="boolean")return d}return!0}):[]}function Qa(e,t,{includeHydrateFallback:r}={}){return qa(e.map(a=>{let n=t.routes[a.route.id];if(!n)return[];let o=[n.module];return n.clientActionModule&&(o=o.concat(n.clientActionModule)),n.clientLoaderModule&&(o=o.concat(n.clientLoaderModule)),r&&n.hydrateFallbackModule&&(o=o.concat(n.hydrateFallbackModule)),n.imports&&(o=o.concat(n.imports)),o}).flat(1))}function qa(e){return[...new Set(e)]}function Za(e){let t={},r=Object.keys(e).sort();for(let a of r)t[a]=e[a];return t}function en(e,t){let r=new Set,a=new Set(t);return e.reduce((n,o)=>{if(t&&!Ka(o)&&o.as==="script"&&o.href&&a.has(o.href))return n;let l=JSON.stringify(Za(o));return r.has(l)||(r.add(l),n.push({key:l,link:o})),n},[])}function Ke(){let e=S.useContext(G);return Je(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function nn(){let e=S.useContext(re);return Je(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var le=S.createContext(void 0);le.displayName="FrameworkContext";function Pe(){let e=S.useContext(le);return Je(e,"You must render this element inside a <HydratedRouter> element"),e}function on(e,t){let r=S.useContext(le),[a,n]=S.useState(!1),[o,i]=S.useState(!1),{onFocus:l,onBlur:s,onMouseEnter:u,onMouseLeave:c,onTouchStart:d}=t,m=S.useRef(null);S.useEffect(()=>{if(e==="render"&&i(!0),e==="viewport"){let p=R=>{R.forEach(w=>{i(w.isIntersecting)})},f=new IntersectionObserver(p,{threshold:.5});return m.current&&f.observe(m.current),()=>{f.disconnect()}}},[e]),S.useEffect(()=>{if(a){let p=setTimeout(()=>{i(!0)},100);return()=>{clearTimeout(p)}}},[a]);let h=()=>{n(!0)},y=()=>{n(!1),i(!1)};return r?e!=="intent"?[o,m,{}]:[o,m,{onFocus:oe(l,h),onBlur:oe(s,y),onMouseEnter:oe(u,h),onMouseLeave:oe(c,y),onTouchStart:oe(d,h)}]:[!1,m,{}]}function oe(e,t){return r=>{e&&e(r),r.defaultPrevented||t(r)}}function mr({page:e,...t}){let r=fa(),{nonce:a}=Pe(),{router:n}=Ke(),o=S.useMemo(()=>_e(n.routes,e,n.basename),[n.routes,e,n.basename]);return o?(t.nonce==null&&a&&(t={...t,nonce:a}),r?S.createElement(sn,{page:e,matches:o,...t}):S.createElement(un,{page:e,matches:o,...t})):null}function ln(e){let{manifest:t,routeModules:r}=Pe(),[a,n]=S.useState([]);return S.useEffect(()=>{let o=!1;return Xa(e,t,r).then(i=>{o||n(i)}),()=>{o=!0}},[e,t,r]),a}function sn({page:e,matches:t,...r}){let a=T(),{future:n}=Pe(),{basename:o}=Ke(),i=S.useMemo(()=>{if(e===a.pathname+a.search+a.hash)return[];let l=fr(e,o,n.v8_trailingSlashAwareDataRequests,"rsc"),s=!1,u=[];for(let c of t)typeof c.route.shouldRevalidate=="function"?s=!0:u.push(c.route.id);return s&&u.length>0&&l.searchParams.set("_routes",u.join(",")),[l.pathname+l.search]},[o,n.v8_trailingSlashAwareDataRequests,e,a,t]);return S.createElement(S.Fragment,null,i.map(l=>S.createElement("link",{key:l,rel:"prefetch",as:"fetch",href:l,...r})))}function un({page:e,matches:t,...r}){let a=T(),{future:n,manifest:o,routeModules:i}=Pe(),{basename:l}=Ke(),{loaderData:s,matches:u}=nn(),c=S.useMemo(()=>Ht(e,t,u,o,a,"data"),[e,t,u,o,a]),d=S.useMemo(()=>Ht(e,t,u,o,a,"assets"),[e,t,u,o,a]),m=S.useMemo(()=>{if(e===a.pathname+a.search+a.hash)return[];let p=new Set,f=!1;if(t.forEach(w=>{let b=o.routes[w.route.id];!b||!b.hasLoader||(!c.some(P=>P.route.id===w.route.id)&&w.route.id in s&&i[w.route.id]?.shouldRevalidate||b.hasClientLoader?f=!0:p.add(w.route.id))}),p.size===0)return[];let R=fr(e,l,n.v8_trailingSlashAwareDataRequests,"data");return f&&p.size>0&&R.searchParams.set("_routes",t.filter(w=>p.has(w.route.id)).map(w=>w.route.id).join(",")),[R.pathname+R.search]},[l,n.v8_trailingSlashAwareDataRequests,s,a,o,c,t,e,i]),h=S.useMemo(()=>Qa(d,o),[d,o]),y=ln(d);return S.createElement(S.Fragment,null,m.map(p=>S.createElement("link",{key:p,rel:"prefetch",as:"fetch",href:p,...r})),h.map(p=>S.createElement("link",{key:p,rel:"modulepreload",href:p,...r})),y.map(({key:p,link:f})=>S.createElement("link",{key:p,nonce:r.nonce,...f,crossOrigin:f.crossOrigin??r.crossOrigin})))}function cn(...e){return t=>{e.forEach(r=>{typeof r=="function"?r(t):r!=null&&(r.current=t)})}}var dn=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{dn&&(window.__reactRouterVersion="7.18.3")}catch{}function fn({basename:e,children:t,useTransitions:r,window:a}){let n=v.useRef();n.current==null&&(n.current=zt({window:a,v5Compat:!0}));let o=n.current,[i,l]=v.useState({action:o.action,location:o.location}),s=v.useCallback(u=>{r===!1?l(u):v.startTransition(()=>l(u))},[r]);return v.useLayoutEffect(()=>o.listen(s),[o,s]),v.createElement(Ee,{basename:e,children:t,location:i.location,navigationType:i.action,navigator:o,useTransitions:r})}function pr({basename:e,children:t,history:r,useTransitions:a}){let[n,o]=v.useState({action:r.action,location:r.location}),i=v.useCallback(l=>{a===!1?o(l):v.startTransition(()=>o(l))},[a]);return v.useLayoutEffect(()=>r.listen(i),[r,i]),v.createElement(Ee,{basename:e,children:t,location:n.location,navigationType:n.action,navigator:r,useTransitions:a})}pr.displayName="unstable_HistoryRouter";var se=v.forwardRef(function({onClick:t,discover:r="render",prefetch:a="none",relative:n,reloadDocument:o,replace:i,mask:l,state:s,target:u,to:c,preventScrollReset:d,viewTransition:m,defaultShouldRevalidate:h,...y},p){let{basename:f,navigator:R,useTransitions:w}=v.useContext(N),b=typeof c=="string"&&Ae.test(c),P=qt(c,f);c=P.to;let E=be(c,{relative:n}),F=T(),k=null;if(l){let Y=Se(l,[],F.mask?F.mask.pathname:"/",!0);f!=="/"&&(Y.pathname=Y.pathname==="/"?f:H([f,Y.pathname])),k=R.createHref(Y)}let[$,K,B]=on(a,y),ue=wr(c,{replace:i,mask:l,state:s,target:u,preventScrollReset:d,relative:n,viewTransition:m,defaultShouldRevalidate:h,useTransitions:w});function Z(Y){t&&t(Y),Y.defaultPrevented||ue(Y)}let ce=!(P.isExternal||o),rt=v.createElement("a",{...y,...B,href:(ce?k:void 0)||P.absoluteURL||E,onClick:ce?Z:t,ref:cn(p,K),target:u,"data-discover":!b&&r==="render"?"true":void 0});return $&&!b?v.createElement(v.Fragment,null,rt,v.createElement(mr,{page:E})):rt});se.displayName="Link";var yr=v.forwardRef(function({"aria-current":t="page",caseSensitive:r=!1,className:a="",end:n=!1,style:o,to:i,viewTransition:l,children:s,...u},c){let d=ae(i,{relative:u.relative}),m=T(),h=v.useContext(re),{navigator:y,basename:p}=v.useContext(N),f=h!=null&&xr(d)&&l===!0,R=y.encodeLocation?y.encodeLocation(d).pathname:d.pathname,w=m.pathname,b=h&&h.navigation&&h.navigation.location?h.navigation.location.pathname:null;r||(w=w.toLowerCase(),b=b?b.toLowerCase():null,R=R.toLowerCase()),b&&p&&(b=U(b,p)||b);let P=R!=="/"&&R.endsWith("/")?R.length-1:R.length,E=w===R||!n&&w.startsWith(R)&&w.charAt(P)==="/",F=b!=null&&(b===R||!n&&b.startsWith(R)&&b.charAt(R.length)==="/"),k={isActive:E,isPending:F,isTransitioning:f},$=E?t:void 0,K;typeof a=="function"?K=a(k):K=[a,E?"active":null,F?"pending":null,f?"transitioning":null].filter(Boolean).join(" ");let B=typeof o=="function"?o(k):o;return v.createElement(se,{...u,"aria-current":$,className:K,ref:c,style:B,to:i,viewTransition:l},typeof s=="function"?s(k):s)});yr.displayName="NavLink";var gr=v.forwardRef(({discover:e="render",fetcherKey:t,navigate:r,reloadDocument:a,replace:n,state:o,method:i=pe,action:l,onSubmit:s,relative:u,preventScrollReset:c,viewTransition:d,defaultShouldRevalidate:m,...h},y)=>{let{useTransitions:p}=v.useContext(N),f=Sr(),R=br(l,{relative:u}),w=i.toLowerCase()==="get"?"get":"post",b=typeof l=="string"&&Ae.test(l);return v.createElement("form",{ref:y,method:w,action:R,onSubmit:a?s:E=>{if(s&&s(E),E.defaultPrevented)return;E.preventDefault();let F=E.nativeEvent.submitter,k=F?.getAttribute("formmethod")||i,$=()=>f(F||E.currentTarget,{fetcherKey:t,method:k,navigate:r,replace:n,state:o,relative:u,preventScrollReset:c,viewTransition:d,defaultShouldRevalidate:m});p&&r!==!1?v.startTransition(()=>$()):$()},...h,"data-discover":!b&&e==="render"?"true":void 0})});gr.displayName="Form";function vr({getKey:e,storageKey:t,...r}){let a=v.useContext(le),{basename:n}=v.useContext(N),o=T(),i=Ye();Er({getKey:e,storageKey:t});let l=v.useMemo(()=>{if(!a||!e)return null;let u=Oe(o,i,n,e);return u!==o.key?u:null},[]);if(!a||a.isSpaMode)return null;let s=((u,c)=>{if(!window.history.state||!window.history.state.key){let d=Math.random().toString(32).slice(2);window.history.replaceState({key:d},"")}try{let m=JSON.parse(sessionStorage.getItem(u)||"{}")[c||window.history.state.key];typeof m=="number"&&window.scrollTo(0,m)}catch(d){console.error(d),sessionStorage.removeItem(u)}}).toString();return r.nonce==null&&a?.nonce&&(r.nonce=a.nonce),v.createElement("script",{...r,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:`(${s})(${It(JSON.stringify(t||Me))}, ${It(JSON.stringify(l))})`}})}vr.displayName="ScrollRestoration";function Rr(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Ge(e){let t=v.useContext(G);return L(t,Rr(e)),t}function hn(e){let t=v.useContext(re);return L(t,Rr(e)),t}function wr(e,{target:t,replace:r,mask:a,state:n,preventScrollReset:o,relative:i,viewTransition:l,defaultShouldRevalidate:s,useTransitions:u}={}){let c=q(),d=T(),m=ae(e,{relative:i});return v.useCallback(h=>{if(Ha(h,t)){h.preventDefault();let y=r!==void 0?r:W(d)===W(m),p=()=>c(e,{replace:y,mask:a,state:n,preventScrollReset:o,relative:i,viewTransition:l,defaultShouldRevalidate:s});u?v.startTransition(()=>p()):p()}},[d,c,m,r,a,n,t,e,o,i,l,s,u])}function Xe(e){O(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=v.useRef(we(e)),r=v.useRef(!1),a=T(),n=v.useMemo(()=>Ua(a.search,r.current?null:t.current),[a.search]),o=q(),i=v.useCallback((l,s)=>{let u=we(typeof l=="function"?l(new URLSearchParams(n)):l);r.current=!0,o("?"+u,s)},[o,n]);return[n,i]}var mn=0,pn=()=>`__${String(++mn)}__`;function Sr(){let{router:e}=Ge("useSubmit"),{basename:t}=v.useContext(N),r=Da(),a=e.fetch,n=e.navigate;return v.useCallback(async(o,i={})=>{let{action:l,method:s,encType:u,formData:c,body:d}=Ba(o,t);if(i.navigate===!1){let m=i.fetcherKey||pn();await a(m,r,i.action||l,{defaultShouldRevalidate:i.defaultShouldRevalidate,preventScrollReset:i.preventScrollReset,formData:c,body:d,formMethod:i.method||s,formEncType:i.encType||u,flushSync:i.flushSync})}else await n(i.action||l,{defaultShouldRevalidate:i.defaultShouldRevalidate,preventScrollReset:i.preventScrollReset,formData:c,body:d,formMethod:i.method||s,formEncType:i.encType||u,replace:i.replace,state:i.state,fromRouteId:r,flushSync:i.flushSync,viewTransition:i.viewTransition})},[a,n,t,r])}function br(e,{relative:t}={}){let{basename:r}=v.useContext(N),a=v.useContext(I);L(a,"useFormAction must be used inside a RouteContext");let[n]=a.matches.slice(-1),o={...ae(e||".",{relative:t})},i=T();if(e==null){o.search=i.search;let l=new URLSearchParams(o.search),s=l.getAll("index");if(s.some(c=>c==="")){l.delete("index"),s.filter(d=>d).forEach(d=>l.append("index",d));let c=l.toString();o.search=c?`?${c}`:""}}return(!e||e===".")&&n.route.index&&(o.search=o.search?o.search.replace(/^\?/,"?index&"):"?index"),r!=="/"&&(o.pathname=o.pathname==="/"?r:H([r,o.pathname])),W(o)}var Me="react-router-scroll-positions",me={};function Oe(e,t,r,a){let n=null;return a&&(r!=="/"?n=a({...e,pathname:U(e.pathname,r)||e.pathname},t):n=a(e,t)),n==null&&(n=e.key),n}function Er({getKey:e,storageKey:t}={}){let{router:r}=Ge("useScrollRestoration"),{restoreScrollPosition:a,preventScrollReset:n}=hn("useScrollRestoration"),{basename:o}=v.useContext(N),i=T(),l=Ye(),s=sr();v.useEffect(()=>(window.history.scrollRestoration="manual",()=>{window.history.scrollRestoration="auto"}),[]),yn(v.useCallback(()=>{if(s.state==="idle"){let u=Oe(i,l,o,e);me[u]=window.scrollY}try{sessionStorage.setItem(t||Me,JSON.stringify(me))}catch(u){O(!1,`Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${u}).`)}window.history.scrollRestoration="auto"},[s.state,e,o,i,l,t])),typeof document<"u"&&(v.useLayoutEffect(()=>{try{let u=sessionStorage.getItem(t||Me);u&&(me=JSON.parse(u))}catch{}},[t]),v.useLayoutEffect(()=>{let u=r?.enableScrollRestoration(me,()=>window.scrollY,e?(c,d)=>Oe(c,d,o,e):void 0);return()=>u&&u()},[r,o,e]),v.useLayoutEffect(()=>{if(a!==!1){if(typeof a=="number"){window.scrollTo(0,a);return}try{if(i.hash){let u=document.getElementById(decodeURIComponent(i.hash.slice(1)));if(u){u.scrollIntoView();return}}}catch{O(!1,`"${i.hash.slice(1)}" is not a decodable element ID. The view will not scroll to it.`)}n!==!0&&window.scrollTo(0,0)}},[i,a,n]))}function yn(e,t){let{capture:r}=t||{};v.useEffect(()=>{let a=r!=null?{capture:r}:void 0;return window.addEventListener("pagehide",e,a),()=>{window.removeEventListener("pagehide",e,a)}},[e,r])}function xr(e,{relative:t}={}){let r=v.useContext(Ue);L(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:a}=Ge("useViewTransitionState"),n=ae(e,{relative:t});if(!r.isTransitioning)return!1;let o=U(r.currentLocation.pathname,a)||r.currentLocation.pathname,i=U(r.nextLocation.pathname,a)||r.nextLocation.pathname;return ie(n.pathname,i)!=null||ie(n.pathname,o)!=null}var Qe=D(M(),1),Cr=D(Nr(),1);var j=D(ee(),1);function Lr({context:e,own:t}){ne(e.store);let r=ht(),a=ft()?.live??e.store;ne(a);let n=vt();if(!r||a.batches().length===0&&n===0)return null;let o=(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(Qe.Suspense,{fallback:null,children:(0,j.jsx)(Ct,{})}),(0,j.jsx)(Qe.Suspense,{fallback:null,children:(0,j.jsx)(Lt,{})})]});return t?(0,Cr.createPortal)(o,t):(0,j.jsx)("div",{className:"graview-bar-own",children:o})}var A=D(M(),1);var J=D(M(),1),gn=(0,J.createContext)(null);function ii(){let e=new Map,t=new Set,r=()=>{for(let a of t)a()};return{count:a=>e.get(a)??0,place(a){return e.set(a,(e.get(a)??0)+1),r(),()=>{e.set(a,(e.get(a)??1)-1),r()}},subscribe(a){return t.add(a),()=>t.delete(a)}}}function Dr(e){let t=(0,J.useContext)(gn);(0,J.useLayoutEffect)(()=>t?.place(e),[t,e])}function li(e,t){return(0,J.useSyncExternalStore)(e.subscribe,()=>e.count(t)>0,()=>!1)}var kr=D(M(),1),z=D(ee(),1),qe="var(--graview-text-small)",Ze="var(--graview-text-body)",mi="var(--graview-font-display, var(--graview-font-body, system-ui))",et={maxWidth:760,margin:"0 auto",padding:"40px var(--graview-page-gutter, 20px) max(96px, calc(var(--graview-foot-room, 0px) + env(safe-area-inset-bottom, 0px)))",display:"grid",gridTemplateColumns:"minmax(0, 1fr)",gap:40},tt=1160,pi={...et,maxWidth:tt},Fr={margin:0,fontSize:"var(--graview-text-title)",lineHeight:1.2,letterSpacing:"-0.012em",overflowWrap:"anywhere",textWrap:"balance"},yi={margin:0,fontSize:"var(--graview-text-heading)",lineHeight:1.3,textWrap:"balance"},gi={margin:0,fontSize:qe,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--graview-ink-muted)"},vi={margin:0,fontSize:Ze,color:"var(--graview-ink-muted)",maxWidth:"60ch"},Tr={color:"var(--graview-ink-muted)",fontSize:qe},Ri={borderTop:"1px solid var(--graview-edge)",paddingTop:24},vn={color:"var(--graview-accent)",textDecorationColor:"color-mix(in srgb, currentColor 50%, transparent)",textDecorationThickness:1,textUnderlineOffset:"0.2em",display:"inline-flex",alignItems:"center",columnGap:"0.3em",minHeight:24},wi={...vn,textDecoration:"none"},Si={color:"inherit",textDecoration:"none",display:"inline-flex",alignItems:"center",minHeight:24},bi=`.graview-list{container-type:inline-size}
|
|
4
4
|
.graview-rows{display:grid;grid-template-columns:minmax(0,1fr);column-gap:1.5rem;margin:0;padding:0;list-style:none;border-top:1px solid var(--graview-edge)}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{f as k,h,i as b,n as S,o as w,p as I}from"./chunk.
|
|
1
|
+
import{f as k,h,i as b,n as S,o as w,p as I}from"./chunk.YGIJDHAV.js";import"./chunk.BJUUSIQY.js";import"./chunk.5POG3G2C.js";import"./chunk.2XSIJH5J.js";import"./chunk.ZVG3DR5G.js";import"./chunk.XOZU4OFA.js";import"./chunk.LA2DMHZC.js";import{a as A}from"./chunk.D5Q64GA4.js";import"./chunk.2QFKNTAZ.js";import"./chunk.UO544PZH.js";import"./chunk.4STDIZVI.js";import"./chunk.HZHNM2KI.js";import"./chunk.AVFOTYZR.js";import"./chunk.HOQMD6WQ.js";import{G as M,T as f}from"./chunk.N7T7VB77.js";import"./chunk.SDO3U72B.js";import"./chunk.F7PIW2EM.js";import"./chunk.FQLNBIQ5.js";import{b as d}from"./chunk.AJZBJBMO.js";var n=d(M(),1);var r=d(f(),1),C="several";function T({chosen:c,acts:p,onAct:N}){let t=A(),u=(0,n.useMemo)(()=>[...c].sort(),[c]),i=u.join(`
|
|
2
2
|
`),o=(0,n.useMemo)(()=>({on:"selection",ids:u}),[i]),l=(0,n.useMemo)(()=>p.filter(e=>e.open.length===0&&!e.more&&!e.destructive),[p]),g=(0,n.useMemo)(()=>new Map(l.map(e=>[h(e.id),e])),[l]),v=S(t,o,C),[y,x]=(0,n.useState)(null);(0,n.useEffect)(()=>{if(v!==void 0)return;let e=!0;return w(t,o,{by:C,ask:()=>b(t.ai,{store:t.store,target:o,principal:t.principal,interaction:k(),places:t.places,selection:t.selection,...t.place?{place:t.place}:{},shared:l.map(a=>({id:a.id,label:a.label,mutation:a.mutation,args:a.args}))})}).then(a=>{e&&x({key:i,result:a})}),()=>{e=!1}},[i]);let s=v??(y?.key===i?y.result:void 0);if(s===void 0)return(0,r.jsx)("span",{role:"status",className:"graview-several-quiet","data-testid":"several-ai-thinking",style:{textDecoration:"none"},children:"AI: thinking\u2026"});let m=s.offers.filter(e=>e.type!=="act"||g.has(e.id));if(m.length===0)return null;let E=e=>{let a=g.get(e.id);if(a){t.desk.record({...s.interaction,outcome:"accepted",accepted:[e.id]}),N(a);return}I(t,s,e)};return(0,r.jsx)("div",{role:"group","aria-label":"Suggested by AI",className:"graview-several-acts","data-testid":"several-ai",children:m.map(e=>(0,r.jsxs)("button",{type:"button",className:"graview-several-act","data-testid":"several-ai-offer","data-ai-offer":e.id,"data-ai-offer-type":e.type,onClick:()=>E(e),children:[e.label,(0,r.jsx)("span",{style:{color:"var(--graview-ink-faint)",fontWeight:400},children:" \xB7 suggested"})]},e.id))})}export{T as SeveralAi};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as y,b as h}from"./chunk.
|
|
1
|
+
import{a as y,b as h}from"./chunk.SKQO467Y.js";import"./chunk.6SO64TUI.js";import"./chunk.PGA5TUSN.js";import"./chunk.7R727IKU.js";import"./chunk.LQAT7FA6.js";import{id as b}from"./chunk.F7PIW2EM.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";var k=(d,i)=>({id:i.id,said:h(d,i),when:i.when,...i.alsoMine?{alsoMine:!0}:{}});async function A(d,i,t){let a=b(t.principal);if(a.id===void 0)return{ok:!1,error:"This seat acts for nobody the app knows by id, so there is nobody to tell. Nothing was kept."};let r=t.store.seenBy(a),p=async()=>(await t.subscriptions.list(a.id)).filter(n=>n.app===t.app);if(d==="list_subscriptions")return{ok:!0,data:{subscriptions:(await p()).map(n=>k(r,n))}};if(d==="unsubscribe"){let n=String(i.id??"");return(await p()).some(g=>g.id===n)?(await t.subscriptions.remove(n),{ok:!0,data:{removed:n}}):{ok:!1,error:`No subscription "${n}" of yours. list_subscriptions says which there are.`}}let o=String(i.on??""),c=n=>typeof i[n]=="string"&&i[n].trim()!==""?i[n].trim():void 0,e=c("record");if(e!==void 0&&!r.graph.getNode(e)){let n=t.store.resolveRef({name:"record",kinds:["*"]},e,a);if(!n.ok)return{ok:!1,error:`${n.message} Nothing was kept.`};e=n.id}let s=c("kind")??(e!==void 0&&o!=="act"?r.graph.getNode(e)?.kind:void 0),f=c("act"),m=c("condition"),u=o==="act"?{on:o,...f!==void 0?{act:f}:{},...e!==void 0?{record:e}:{}}:o==="created"&&s!==void 0?{on:o,kind:s}:o==="changed"?{on:o,...s!==void 0&&e===void 0?{kind:s}:{},...e!==void 0?{record:e}:{}}:o==="reaches"&&s!==void 0?{on:o,kind:s,condition:m??"",...e!==void 0?{record:e}:{}}:void 0;if(!u)return{ok:!1,error:'Say what to be told of: on is "act", "created", "changed" or "reaches", with a kind (or a record) for all but act. Nothing was kept.'};let l=y({schema:r.schema,allMutations:()=>t.store.allMutations(),graph:r.graph},u);if(l)return{ok:!1,error:`${l} Nothing was kept.`};let S=await t.subscriptions.add({who:a,app:t.app,when:u,...i.alsoMine===!0?{alsoMine:!0}:{}});return{ok:!0,data:{subscription:k(r,S)}}}export{A as runSubscriptionTool};
|