graview 0.1.64 → 0.1.66
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/preview/chunk.2KFZHUAC.js +1 -0
- package/dist/preview/chunk.2MHNPBHC.js +1 -0
- package/dist/preview/{chunk.77JI5T4F.js → chunk.2VR7YEJ6.js} +1 -1
- package/dist/preview/chunk.32SHA3EY.js +1 -0
- package/dist/preview/chunk.3L4JMM3P.js +1 -0
- package/dist/preview/chunk.3PBTN7RO.js +1 -0
- package/dist/preview/chunk.45JP6VGJ.js +5 -0
- package/dist/preview/{chunk.DUP2CGVH.js → chunk.4AC2QM7T.js} +1 -1
- package/dist/preview/chunk.4FCFNAA4.js +1 -0
- package/dist/preview/chunk.4FDVINRJ.js +1 -0
- package/dist/preview/chunk.4JULYKGD.js +1 -0
- package/dist/preview/chunk.4U4D7WOI.js +1 -0
- package/dist/preview/chunk.4WGYUYWU.js +2 -0
- package/dist/preview/chunk.5B5SRTUK.js +1 -0
- package/dist/preview/chunk.5BX66FBP.js +1 -0
- package/dist/preview/chunk.5CXIEYHY.js +2 -0
- package/dist/preview/chunk.5EMIWORS.js +1 -0
- package/dist/preview/{chunk.D2XLECMP.js → chunk.5FNFRVTL.js} +1 -1
- package/dist/preview/chunk.5LJVOLKR.js +1 -0
- package/dist/preview/{chunk.APUQIELA.js → chunk.6EHHMWPP.js} +1 -1
- package/dist/preview/chunk.6EVMXBNB.js +1 -0
- package/dist/preview/chunk.6FQW6FNL.js +1 -0
- package/dist/preview/chunk.6HY6ZGEE.js +5 -0
- package/dist/preview/{chunk.K5YFUMRS.js → chunk.6LXIEM6B.js} +1 -1
- package/dist/preview/chunk.6MQ5NT7S.js +1 -0
- package/dist/preview/chunk.6P6NGZ6D.js +1 -0
- package/dist/preview/{chunk.XIVELWAM.js → chunk.6TLXFMX2.js} +1 -1
- package/dist/preview/chunk.72XP2ARZ.js +1 -0
- package/dist/preview/{chunk.2V7QTIAV.js → chunk.72ZCLEQC.js} +1 -1
- package/dist/preview/{chunk.ITBG37WJ.js → chunk.7BIPZTJB.js} +1 -1
- package/dist/preview/chunk.7VADSNPZ.js +1 -0
- package/dist/preview/{chunk.2VYGDY5Z.js → chunk.7VP6Y6D2.js} +1 -1
- package/dist/preview/{chunk.S7SHWDPR.js → chunk.7ZKBYXUM.js} +1 -1
- package/dist/preview/chunk.AK7NGFEX.js +6 -0
- package/dist/preview/{chunk.2VIS2NAT.js → chunk.ANS2IEEV.js} +1 -1
- package/dist/preview/{chunk.UDYFGYJP.js → chunk.B6JRTW3A.js} +1 -1
- package/dist/preview/chunk.BCQWAFGD.js +1 -0
- package/dist/preview/{chunk.7SRSE5IS.js → chunk.BFAFCVL4.js} +1 -1
- package/dist/preview/chunk.BGAC3B7X.js +1 -0
- package/dist/preview/chunk.BMENTGDC.js +21 -0
- package/dist/preview/chunk.BOCVLC7X.js +1 -0
- package/dist/preview/{chunk.7VAHHEDX.js → chunk.BUVTUAB5.js} +1 -1
- package/dist/preview/chunk.BXBEGMPO.js +22 -0
- package/dist/preview/{chunk.4XCYZRZ3.js → chunk.BZ7QWHAE.js} +1 -1
- package/dist/preview/chunk.C2C3AXGI.js +1141 -0
- package/dist/preview/chunk.CBXS23YH.js +23 -0
- package/dist/preview/chunk.CEQQIW7Z.js +1 -0
- package/dist/preview/chunk.CEVGND3Y.js +6 -0
- package/dist/preview/{chunk.WHX47OJM.js → chunk.CTASTRQN.js} +1 -1
- package/dist/preview/chunk.CU2WCYMK.js +1 -0
- package/dist/preview/{chunk.7CLKGKSF.js → chunk.CVPMSPCH.js} +1 -1
- package/dist/preview/chunk.DEHIR4EG.js +1 -0
- package/dist/preview/chunk.DPJNGFEZ.js +4 -0
- package/dist/preview/chunk.DQFHIJFN.js +1 -0
- package/dist/preview/chunk.DSYP43NN.js +1 -0
- package/dist/preview/chunk.DTCAUPLC.js +1 -0
- package/dist/preview/{chunk.4U45EY5M.js → chunk.DZFM6GSY.js} +1 -1
- package/dist/preview/chunk.E3UL4MCD.js +35 -0
- package/dist/preview/chunk.E4VRRWFP.js +1 -0
- package/dist/preview/chunk.E7EWNWAN.js +1 -0
- package/dist/preview/chunk.EG7OOJH5.js +1 -0
- package/dist/preview/{chunk.TQ2G4AM4.js → chunk.EMFOMSMI.js} +1 -1
- package/dist/preview/{chunk.5B7NG6WH.js → chunk.EQ4OODGO.js} +1 -1
- package/dist/preview/{chunk.CJHYGRWV.js → chunk.ES63XSIM.js} +1 -1
- package/dist/preview/chunk.EUAO4QNV.js +1 -0
- package/dist/preview/{chunk.47N2G7A5.js → chunk.EXYCN4WI.js} +1 -1
- package/dist/preview/chunk.F4VB6Q2W.js +1 -0
- package/dist/preview/chunk.F7672TKJ.js +1 -0
- package/dist/preview/chunk.FA42HCPW.js +1 -0
- package/dist/preview/{chunk.DLWFULWE.js → chunk.FBILPNGH.js} +1 -1
- package/dist/preview/chunk.FBJAQPZ6.js +1 -0
- package/dist/preview/{chunk.2DH42I7L.js → chunk.FDZE5LTJ.js} +2 -2
- package/dist/preview/chunk.FFOD5B4B.js +2 -0
- package/dist/preview/{chunk.TA2JTUNX.js → chunk.FIFUMX5X.js} +1 -1
- package/dist/preview/{chunk.T4TRJDBF.js → chunk.FK722SHI.js} +1 -1
- package/dist/preview/chunk.FV72U33M.js +1 -0
- package/dist/preview/chunk.FXT5CN32.js +19 -0
- package/dist/preview/chunk.GAFMWOME.js +1 -0
- package/dist/preview/{chunk.OXFDB5BB.js → chunk.GEFXU4VO.js} +1 -1
- package/dist/preview/chunk.GG47EIKO.js +1 -0
- package/dist/preview/chunk.GME63ZHI.js +1 -0
- package/dist/preview/{chunk.PVDDSBRG.js → chunk.GNEOSHQ6.js} +1 -1
- package/dist/preview/chunk.HOCD7KIR.js +1 -0
- package/dist/preview/chunk.HSSIMVVM.js +1 -0
- package/dist/preview/{chunk.ZA5TDCBC.js → chunk.I2737CPF.js} +1 -1
- package/dist/preview/chunk.I4Z7HVRT.js +1 -0
- package/dist/preview/chunk.IAEHUSQQ.js +1 -0
- package/dist/preview/chunk.IGK7EZCX.js +1 -0
- package/dist/preview/chunk.INHS3KTK.js +1 -0
- package/dist/preview/{chunk.JHUCKEJS.js → chunk.IWYMKGZZ.js} +1 -1
- package/dist/preview/chunk.J2MM6BUW.js +1 -0
- package/dist/preview/{chunk.JOM6MFVE.js → chunk.J7W2OFHY.js} +1 -1
- package/dist/preview/chunk.JMXXA4YG.js +1 -0
- package/dist/preview/chunk.JMYUQNXN.js +6 -0
- package/dist/preview/chunk.JO2X52D4.js +1 -0
- package/dist/preview/{chunk.YEXFVDRA.js → chunk.JXNVNFV4.js} +1 -1
- package/dist/preview/chunk.K6DFXDPZ.js +1 -0
- package/dist/preview/{chunk.WPQP54FM.js → chunk.KACSYPEV.js} +1 -1
- package/dist/preview/{chunk.R5MLRKAO.js → chunk.KBPJ7X7W.js} +1 -1
- package/dist/preview/chunk.KF27ME27.js +1 -0
- package/dist/preview/{chunk.WX23K7ZU.js → chunk.KSIEO5W7.js} +1 -1
- package/dist/preview/chunk.L25DCT5S.js +1 -0
- package/dist/preview/{chunk.UDU545CL.js → chunk.LETAQTLJ.js} +1 -1
- package/dist/preview/{chunk.VZAF3452.js → chunk.LGRVEHXT.js} +2 -2
- package/dist/preview/chunk.LINSO5PN.js +1 -0
- package/dist/preview/{chunk.XJWKIXPV.js → chunk.LLIURXFP.js} +1 -1
- package/dist/preview/{chunk.BVIJXL4J.js → chunk.LSN2IPAI.js} +1 -1
- package/dist/preview/chunk.M2JCFNHJ.js +1 -0
- package/dist/preview/{chunk.B3WVCSW5.js → chunk.M5FP4Y4Q.js} +1 -1
- package/dist/preview/{chunk.YSBTE3PX.js → chunk.M6ZN2KUO.js} +1 -1
- package/dist/preview/chunk.MODLZJD4.js +25 -0
- package/dist/preview/chunk.MWGZKZD6.js +1 -0
- package/dist/preview/{chunk.2JEN2RCB.js → chunk.NJRLJEJY.js} +1 -1
- package/dist/preview/chunk.NYLKG25K.js +4 -0
- package/dist/preview/{chunk.YMXWS4XN.js → chunk.OEIWIZCP.js} +1 -1
- package/dist/preview/{chunk.DQAMVVE6.js → chunk.OJY7VJ7D.js} +1 -1
- package/dist/preview/chunk.OMT4QUZY.js +23 -0
- package/dist/preview/{chunk.Z26T5E76.js → chunk.ONYBW45K.js} +1 -1
- package/dist/preview/chunk.OO2OP76C.js +1 -0
- package/dist/preview/{chunk.UJNLT3L6.js → chunk.OOSIKCOS.js} +1 -1
- package/dist/preview/{chunk.B6JR7EQO.js → chunk.OPTYYIGC.js} +1 -1
- package/dist/preview/{chunk.TMHVYI5R.js → chunk.OTV5XTBB.js} +1 -1
- package/dist/preview/{chunk.F6BNFLQM.js → chunk.OWFS2YDQ.js} +1 -1
- package/dist/preview/{chunk.CXDGE5ZS.js → chunk.OWO3OV62.js} +1 -1
- package/dist/preview/{chunk.4VRX7FCO.js → chunk.PAGEGBUD.js} +1 -1
- package/dist/preview/{chunk.NGRL3QOI.js → chunk.PDDIQ6PK.js} +1 -1
- package/dist/preview/{chunk.OW3M4OBN.js → chunk.PFQBCHQA.js} +1 -1
- package/dist/preview/{chunk.LDMBJC3B.js → chunk.PPSYUOH7.js} +1 -1
- package/dist/preview/{chunk.GH5UBSQI.js → chunk.PSQYDCVM.js} +1 -1
- package/dist/preview/chunk.QDVGHI7R.js +1 -0
- package/dist/preview/chunk.QFHWG4LN.js +1 -0
- package/dist/preview/chunk.QGIM2WAY.js +1 -0
- package/dist/preview/chunk.QHMHUL6B.js +3 -0
- package/dist/preview/chunk.QOS5T46W.js +1 -0
- package/dist/preview/{chunk.E4TXLT25.js → chunk.QPF4KSAW.js} +1 -1
- package/dist/preview/chunk.QQAZQDRW.js +1 -0
- package/dist/preview/chunk.QU52E5RG.js +3 -0
- package/dist/preview/{chunk.REXU6ARY.js → chunk.QWNSHISU.js} +2 -2
- package/dist/preview/chunk.RSMCTI2N.js +1 -0
- package/dist/preview/chunk.RWIN3POV.js +1 -0
- package/dist/preview/chunk.SSF47GUY.js +1 -0
- package/dist/preview/chunk.T6DPWW2K.js +3 -0
- package/dist/preview/chunk.TA36WBHK.js +1 -0
- package/dist/preview/chunk.TBY5IR7C.js +1 -0
- package/dist/preview/chunk.TGEL6EUA.js +1 -0
- package/dist/preview/chunk.TTGKX7LT.js +1 -0
- package/dist/preview/chunk.TXHYGFIZ.js +1 -0
- package/dist/preview/chunk.U3ED7W2U.js +1 -0
- package/dist/preview/chunk.U3HERHAI.js +88 -0
- package/dist/preview/chunk.U6QXLNHF.js +15 -0
- package/dist/preview/{chunk.P4TAX3HE.js → chunk.U6TEW6YD.js} +1 -1
- package/dist/preview/chunk.UJPX3BUV.js +1 -0
- package/dist/preview/chunk.V5I4GZEY.js +1 -0
- package/dist/preview/{chunk.HZPRMHSL.js → chunk.V7W5AQKL.js} +1 -1
- package/dist/preview/{chunk.77MLXWZV.js → chunk.VGHO3VCB.js} +1 -1
- package/dist/preview/{chunk.YIZPW7IK.js → chunk.VKZIEZ5C.js} +2 -2
- package/dist/preview/chunk.VT2YGDK2.js +1 -0
- package/dist/preview/{chunk.XCLW4GP7.js → chunk.W4YDPHCQ.js} +1 -1
- package/dist/preview/{chunk.2TCOLAL2.js → chunk.W53YNBSM.js} +1 -1
- package/dist/preview/chunk.WAB3L3ZI.js +1 -0
- package/dist/preview/chunk.WSDJPXJD.js +1 -0
- package/dist/preview/chunk.WSO7JOW5.js +1 -0
- package/dist/preview/{chunk.4DZOAB4D.js → chunk.WVLEGCRI.js} +1 -1
- package/dist/preview/chunk.XK65Y2KX.js +1 -0
- package/dist/preview/chunk.XMQG2PSM.js +50 -0
- package/dist/preview/{chunk.WFCE7NLK.js → chunk.XOE4KNP2.js} +2 -2
- package/dist/preview/chunk.Y7QDQ3WF.js +1 -0
- package/dist/preview/chunk.YIPXZUTT.js +2 -0
- package/dist/preview/chunk.YNEHJWJV.js +2 -0
- package/dist/preview/chunk.YXEO3Y65.js +1 -0
- package/dist/preview/chunk.Z274CL7J.js +1 -0
- package/dist/preview/chunk.Z7Y3R3YR.js +3 -0
- package/dist/preview/{chunk.JS2UZYGB.js → chunk.ZBVYD4OX.js} +1 -1
- package/dist/preview/{chunk.P6FNJR6E.js → chunk.ZD7T234N.js} +1 -1
- package/dist/preview/{chunk.2G5WLG3Z.js → chunk.ZQR2SN65.js} +1 -1
- package/dist/preview/chunk.ZR2TP3BF.js +111 -0
- package/dist/preview/chunk.ZRBGYXAO.js +6 -0
- package/dist/preview/index.html +57 -55
- package/dist/preview/page.js +2 -2
- package/dist/preview/splash.js +17 -14
- package/package.json +6 -6
- package/dist/preview/chunk.2D7K2IJQ.js +0 -4
- package/dist/preview/chunk.2E62YCMZ.js +0 -1
- package/dist/preview/chunk.2HV5FF6O.js +0 -1
- package/dist/preview/chunk.2JDAUKSN.js +0 -1133
- package/dist/preview/chunk.37I45R6V.js +0 -35
- package/dist/preview/chunk.3FKKH2XU.js +0 -74
- package/dist/preview/chunk.3J7XLJP2.js +0 -1
- package/dist/preview/chunk.3L37FY3G.js +0 -4
- package/dist/preview/chunk.3OEODIHB.js +0 -1
- package/dist/preview/chunk.3RD4JHVG.js +0 -88
- package/dist/preview/chunk.3RUV4HE4.js +0 -1
- package/dist/preview/chunk.3SAESG6X.js +0 -1
- package/dist/preview/chunk.4HTB6TX2.js +0 -1
- package/dist/preview/chunk.4Q5PCMGZ.js +0 -18
- package/dist/preview/chunk.52MBXPEK.js +0 -1
- package/dist/preview/chunk.5AD2QHWH.js +0 -3
- package/dist/preview/chunk.5HJ2GTKZ.js +0 -1
- package/dist/preview/chunk.5IEZF433.js +0 -2
- package/dist/preview/chunk.5PPCK7QT.js +0 -1
- package/dist/preview/chunk.6NRWLCIZ.js +0 -5
- package/dist/preview/chunk.75JQCTR6.js +0 -1
- package/dist/preview/chunk.7AOEZJRM.js +0 -1
- package/dist/preview/chunk.7ZG77OI3.js +0 -1
- package/dist/preview/chunk.7ZHH7WBN.js +0 -1
- package/dist/preview/chunk.AJEK3I5X.js +0 -6
- package/dist/preview/chunk.APRWUIE3.js +0 -1
- package/dist/preview/chunk.ATHLE33D.js +0 -1
- package/dist/preview/chunk.B2YTHEX5.js +0 -1
- package/dist/preview/chunk.BN42H3C6.js +0 -1
- package/dist/preview/chunk.CC7P435K.js +0 -9
- package/dist/preview/chunk.CM65MCHA.js +0 -1
- package/dist/preview/chunk.DJIF7IAQ.js +0 -2
- package/dist/preview/chunk.DMENNIHT.js +0 -1
- package/dist/preview/chunk.DN7UCBOA.js +0 -1
- package/dist/preview/chunk.DVSTLVIH.js +0 -15
- package/dist/preview/chunk.DYRULRFX.js +0 -1
- package/dist/preview/chunk.FN34P4IS.js +0 -1
- package/dist/preview/chunk.FUPYIOXZ.js +0 -1
- package/dist/preview/chunk.FXRYMT3U.js +0 -1
- package/dist/preview/chunk.G5BVZLCM.js +0 -1
- package/dist/preview/chunk.G7YLK4PX.js +0 -1
- package/dist/preview/chunk.GF62K25C.js +0 -1
- package/dist/preview/chunk.GFQPO3NC.js +0 -1
- package/dist/preview/chunk.GHHKRFPD.js +0 -1
- package/dist/preview/chunk.GP5DAA4P.js +0 -3
- package/dist/preview/chunk.HPG6CNKM.js +0 -1
- package/dist/preview/chunk.HSJEOM3W.js +0 -1
- package/dist/preview/chunk.IQGSEAQ2.js +0 -5
- package/dist/preview/chunk.K2HDEL7I.js +0 -1
- package/dist/preview/chunk.K2PXP5H6.js +0 -1
- package/dist/preview/chunk.K54ISAXN.js +0 -1
- package/dist/preview/chunk.KHXRJLLU.js +0 -50
- package/dist/preview/chunk.KMIFSPGQ.js +0 -1
- package/dist/preview/chunk.L4V5VLSM.js +0 -1
- package/dist/preview/chunk.LTOQ22ZJ.js +0 -1
- package/dist/preview/chunk.M5VHUIDB.js +0 -1
- package/dist/preview/chunk.N643PVQA.js +0 -1
- package/dist/preview/chunk.NJSK3UO2.js +0 -6
- package/dist/preview/chunk.NRPBTV6O.js +0 -21
- package/dist/preview/chunk.O7HHNQK4.js +0 -2
- package/dist/preview/chunk.PR74PGLC.js +0 -1
- package/dist/preview/chunk.QROPDEJF.js +0 -1
- package/dist/preview/chunk.QRT6BZR6.js +0 -1
- package/dist/preview/chunk.RDA35HZB.js +0 -2
- package/dist/preview/chunk.S6QZBWCJ.js +0 -1
- package/dist/preview/chunk.SADHOSRC.js +0 -19
- package/dist/preview/chunk.SJHUC4TL.js +0 -1
- package/dist/preview/chunk.SL5FXE3R.js +0 -1
- package/dist/preview/chunk.T4JP6BGP.js +0 -1
- package/dist/preview/chunk.TOLW64EO.js +0 -1
- package/dist/preview/chunk.TP3PZRHE.js +0 -1
- package/dist/preview/chunk.TUR2DA2M.js +0 -1
- package/dist/preview/chunk.TYIBLD2D.js +0 -1
- package/dist/preview/chunk.UD2GGG7L.js +0 -1
- package/dist/preview/chunk.UN2IAA5R.js +0 -1
- package/dist/preview/chunk.VLX7YWVH.js +0 -25
- package/dist/preview/chunk.VT4YBFZL.js +0 -1
- package/dist/preview/chunk.WMARJ5E3.js +0 -1
- package/dist/preview/chunk.X36BYTEG.js +0 -1
- package/dist/preview/chunk.XEG7ZDRG.js +0 -1
- package/dist/preview/chunk.XQ5RTPEF.js +0 -1
- package/dist/preview/chunk.YLOGIJOH.js +0 -1
- package/dist/preview/chunk.Z4XGEV34.js +0 -1
- package/dist/preview/chunk.ZNDVJGTY.js +0 -1
- package/dist/preview/chunk.ZQGLPP7A.js +0 -1
- /package/dist/preview/{chunk.GZHZLJBF.js → chunk.MIE4TJRW.js} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./chunk.AJZBJBMO.js";var O=e=>Array.isArray(e);function q(e){return e===!0||O(e)||typeof e.width!="number"?Y:e.width}function Q(e){if(e===!0)return()=>!0;if(O(e)){let a=new Set(e);return s=>a.has(s)}let t=new Map;for(let[a,s]of Object.entries(e))typeof s=="string"?t.set(a,new Set([s])):Array.isArray(s)&&t.set(a,new Set(s));return t.size===0?()=>!0:(a,s)=>t.get(a)?.has(s)??!1}var Y=1200,ee="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",J=100,I=4e7,B=e=>/^image\//i.test(e.type)&&!/^image\/svg/i.test(e.type);function P(e,t={}){let a={name:e.name,type:e.type,bytes:e.bytes};return/^video\//i.test(e.type)?{...a,...e.width!==void 0?{width:e.width}:{},...e.height!==void 0?{height:e.height}:{},...e.caption!==void 0?{caption:e.caption}:{},...e.duration!==void 0?{duration:e.duration}:{},...e.poster?{poster:!0}:{}}:B(e)?{...a,...e.width!==void 0?{width:e.width}:{},...e.height!==void 0?{height:e.height}:{},...e.caption!==void 0?{caption:e.caption}:{},...t.src!==void 0?{src:t.src}:{},...t.left!==void 0?{left:t.left}:{}}:a}var X=new Set(["id","kind","label"]),N=e=>{let t=e;return typeof t=="object"&&t!==null&&typeof t.href=="string"&&typeof t.name=="string"&&typeof t.type=="string"&&typeof t.bytes=="number"};function L(e,t){let a=s=>{let l;for(let[h,u]of Object.entries(s)){if(X.has(h))continue;let m=N(u)?t(u,s,h):Array.isArray(u)&&u.length>0&&u.every(N)?u.map(d=>t(d,s,h)):void 0;m!==void 0&&((l??={...s})[h]=m)}return l??s};return{...e,...e.node?{node:a(e.node)}:{},...e.nodes?{nodes:e.nodes.map(a)}:{}}}var F=e=>e.toLocaleString("en-US"),S=(e,t)=>`The picture "${e.name}" on ${t.label?`"${t.label}"`:"a record"}`;function U(e,t,a){let s=q(e),l=t?.pictureBytes??15e5,h=t?.picturesBytes??12e6,u=Math.round(s*Math.min(2,Math.max(1,a||1)));return{width:s,perFile:l,perView:h,need:u,reckon:d=>Math.min(l,Math.ceil(d.bytes*(d.width&&d.width>u?(u/d.width)**2:1))),chosen:Q(e)}}var j=(e,t)=>`${S(e,t)} is left out: at ${F(e.bytes)} bytes it is more than the host fetches for a view.`,C=(e,t,a,s)=>`${S(e,t)} is left out: the view ${a} is handed at most ${F(s)} bytes of pictures, and the pictures before it, in the order its records are handed, took them. A view that draws only some kinds' pictures says which ("pictures": ["<kind>"]).`;function te(e,t){let{perView:a,reckon:s,chosen:l}=U(t.pictures,t.limits,2),h=[],u=0;return{props:L(e,(d,f,b)=>{if(!B(d)||!l(f.kind,b))return P(d);let v=y=>(h.includes(y)||h.push(y),P(d,{left:y}));if(d.bytes>I)return v(j(d,f));let g=s(d);return u+g>a?v(C(d,f,t.view,a)):(u+=g,P(d,{src:t.standIn}))}),left:h}}function ne(e,t){let{width:a,perFile:s,perView:l,need:h,reckon:u,chosen:m}=U(t.pictures,t.limits,e.devicePixelRatio),d=t.shrink??((n,r,i)=>Z(e,n,r,i)),f=new Map,b=new Map,v=new Set,g=!1,y,k=-1/0,z=()=>{if(y!==void 0||g)return;let n=()=>{y=void 0,!g&&(k=e.performance.now(),t.moved())},r=k+J-e.performance.now();r<=0?(y=!0,queueMicrotask(n)):y=e.setTimeout(n,r)},$=n=>{v.has(n)||(v.add(n),t.onLeft?.(n))},x=n=>{n?.state==="ready"&&(b.delete(n.url),n.url.startsWith("blob:")&&e.URL.revokeObjectURL(n.url))},T=S,V,H=n=>new Promise(r=>{let i=new e.Image;i.onload=()=>r(!0),i.onerror=()=>r(!1),e.setTimeout(()=>r(!1),2e3),i.src=n}),M=n=>new Promise((r,i)=>{let w=new e.FileReader;w.onload=()=>r(String(w.result)),w.onerror=i,w.readAsDataURL(n)}),W=async n=>{if(t.as==="blob"){let i=e.URL.createObjectURL(n);return V??=H(i),await V?{url:i,drawn:i}:{url:i,drawn:await M(n)}}let r=await M(n);return{url:r,drawn:r}},E=(n,r,i)=>({state:"left",said:`${T(n,r)} could not be loaded for the view ${t.view}${i?`: the host answered ${i}.`:"."}${i&&!t.file?" A host that serves the app under a base says where a record's files are (file, on the view's definition).":""}`}),D=async(n,r)=>{let i=E(n,r),w=t.file?t.file(n.href):n.href;if(w===void 0)return i;let o=new e.URL(w,e.document.baseURI);if(o.origin!==e.location.origin||!/^https?:$/.test(o.protocol))return i;let p=await e.fetch(o.href,{credentials:"same-origin"}),A=(p.headers.get("content-type")??"").split(";")[0].trim();if(!p.ok)return E(n,r,String(p.status));if(!B({type:A}))return E(n,r,`${A||"no type"}, not a picture`);let c=new e.Blob([await p.arrayBuffer()],{type:A});if(c.size>I)return i;if(!(n.width!==void 0&&n.width<=h)||c.size>s){let G=await d(c,h,s).catch(()=>{});if(G)c=G;else if(c.size>s)return i}return c.size>s?{state:"left",said:`${T(n,r)} is left out: made as small as the ${F(a)} pixels across the view ${t.view} draws a picture at, it is still more than the ${F(s)} bytes one picture is handed.`}:{state:"ready",...await W(c)}},K=(n,r)=>{f.set(n.href,{state:"pending"}),D(n,r).then(i=>_(n.href,i),()=>_(n.href,{state:"left",said:`${T(n,r)} could not be loaded for the view ${t.view}.`}))},_=(n,r)=>{if(g||f.get(n)?.state!=="pending")return x(r);f.set(n,r),r.state==="ready"&&b.set(r.url,r.drawn),r.state==="left"&&$(r.said),z()};return{hand(n){if(g)return L(n,o=>P(o));let r=0,i=new Set,w=L(n,(o,p,A)=>{if(!B(o)||!m(p.kind,A))return P(o);i.add(o.href);let c=f.get(o.href);if(c?.state==="left")return P(o,{left:c.said});if(!c&&o.bytes>I)return c={state:"left",said:j(o,p)},f.set(o.href,c),$(c.said),P(o,{left:c.said});let R=u(o);if(r+R>l){let G=C(o,p,t.view,l);return $(G),P(o,{left:G})}return r+=R,c||K(o,p),P(o,c?.state==="ready"?{src:c.url}:{})});for(let[o,p]of f)i.has(o)||(x(p),f.delete(o));return w},drawn:n=>b.get(n),waiting:()=>y!==void 0||[...f.values()].some(n=>n.state==="pending"),dispose(){g=!0,y!==void 0&&y!==!0&&e.clearTimeout(y);for(let n of f.values())x(n);f.clear(),b.clear()}}}async function Z(e,t,a,s){if(typeof e.createImageBitmap!="function")return;let l=await e.createImageBitmap(t);try{if(l.width<=a&&t.size<=s)return t;let h=Math.min(1,a/l.width),u=Math.max(1,Math.round(l.width*h)),m=Math.max(1,Math.round(l.height*h)),d=e.document.createElement("canvas");d.width=u,d.height=m;let f=d.getContext("2d");if(!f)return;f.drawImage(l,0,0,u,m);let b=y=>new Promise(k=>d.toBlob(k,y,.85)),v=/^image\/(jpeg|webp|png)$/i.test(t.type)?t.type:"image/png",g=await b(v);return g&&g.size<=s?g:await b("image/jpeg")??g??void 0}finally{l.close()}}export{J as PICTURES_SETTLE_MS,I as PICTURE_FETCH_BYTES,ee as PICTURE_STAND_IN,Y as PICTURE_WIDTH,ne as createGuestPictures,P as guestFileOf,L as handFiles,B as isGuestPicture,U as pictureBudget,q as pictureWidthOf,Q as picturesChosen,te as standInPictures};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{a as y,b as k,c as b}from"./chunk.U5P23GO7.js";import{a as A}from"./chunk.GH5UBSQI.js";import{D as v,G as W,V as w,da as h}from"./chunk.VLX7YWVH.js";import{db as g}from"./chunk.IQGSEAQ2.js";import{b as d}from"./chunk.AJZBJBMO.js";var S=d(W(),1);var t=d(w(),1),l={display:"inline-flex",alignItems:"center",minHeight:24,minWidth:24,padding:"1px 8px",fontSize:"0.75rem"};function L({shows:e,onShows:i,mine:a,onMine:r}){let n={all:"All",changes:"Changes",ai:"AI"};return(0,t.jsxs)("div",{"data-testid":"activity-filter",role:"group","aria-label":"Show",style:{display:"flex",flexWrap:"wrap",gap:4,alignItems:"center"},children:[["all","changes","ai"].map(s=>(0,t.jsx)("button",{type:"button","data-shows":s,"aria-pressed":e===s,onClick:()=>i(s),style:{...l,...e===s?{borderColor:"var(--graview-accent)",color:"var(--graview-ink)"}:{}},children:n[s]},s)),(0,t.jsx)("button",{type:"button","data-testid":"activity-mine","aria-pressed":a,onClick:()=>r(!a),style:{...l,marginLeft:"auto",...a?{borderColor:"var(--graview-accent)",color:"var(--graview-ink)"}:{}},children:"Just mine"})]})}var $=e=>e.ask.kind==="suggest"?"suggest":e.ask.kind==="fill"?"fill in":e.ask.kind==="record"?"add one":e.ask.kind==="panel"?"draw a panel":`answer \u201C${e.ask.said}\u201D`;function T(e){let i=e.offered.filter(a=>e.accepted?.includes(a.id)).map(a=>a.label);switch(e.outcome){case"accepted":return i.length>0?`Took ${i.join(", ")}`:"Taken";case"partly":return`Took ${i.length} of ${e.offered.length}: ${i.join(", ")}`;case"dismissed":return"Dismissed";case"drawn":return e.panel?`Drew \u201C${e.panel.title}\u201D`:"Drew a panel";case"failed":return e.failed??"Failed";default:return"Offered, not yet taken"}}function O(e){let i=[...new Set((e.usage??[]).map(n=>n.model))];if(i.length===0)return null;let a=(e.usage??[]).flatMap(n=>n.costUsd===void 0?[]:[n.costUsd]),r=a.length>0?a.reduce((n,s)=>n+s,0):void 0;return`${i.join(", ")}${r!==void 0?` \xB7 $${r<.01?r.toPrecision(2):r.toFixed(2)}`:""}`}function V({entry:e,undo:i}){let{store:a,principal:r,seats:n,people:s,ai:I}=h(),c=A(),[p,u]=(0,S.useState)(!1),C=e.by.kind==="human"&&e.by.onBehalfOf===void 0&&(e.by.id===void 0||r.id===void 0||e.by.id===r.id)?"you":g(e.by,{graph:a.graph,schema:a.schema,seats:n,people:s}),f=O(e),x=v(I),m=o=>{u(!0),(__graviewPreload(import.meta.url,["./chunk.O7HHNQK4.js","./chunk.BJUUSIQY.js","./chunk.TQ2G4AM4.js","./chunk.X36BYTEG.js","./chunk.LDMBJC3B.js","./chunk.XOZU4OFA.js","./chunk.G7YLK4PX.js","./chunk.GH5UBSQI.js","./chunk.2JEN2RCB.js","./chunk.75JQCTR6.js","./chunk.5IEZF433.js","./chunk.5AD2QHWH.js","./chunk.3FKKH2XU.js","./chunk.DLWFULWE.js","./chunk.VLX7YWVH.js","./chunk.SDO3U72B.js","./chunk.IQGSEAQ2.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.SJHUC4TL.js")).then(o).finally(()=>u(!1))};return(0,t.jsxs)("li",{"data-testid":"activity-interaction","data-interaction":e.id,"data-outcome":e.outcome,style:y,children:[(0,t.jsx)("div",{"data-graview-activity-head":"",style:k,children:(0,t.jsxs)("span",{"data-graview-activity-words":"",style:b,children:[(0,t.jsx)("strong",{style:{fontWeight:600},children:C})," ",(0,t.jsxs)("span",{style:{color:"var(--graview-ink-muted)"},children:["asked AI to ",$(e)]}),(0,t.jsxs)("span",{style:{color:"var(--graview-ink-faint)"},children:[" \xB7 ",e.targetLabel]})]})}),e.offered.length>0&&e.outcome!=="accepted"&&e.outcome!=="partly"?(0,t.jsxs)("div",{"data-testid":"interaction-offered",style:{color:"var(--graview-ink-muted)"},children:["Offered ",e.offered.map(o=>o.label).join(", ")]}):null,(0,t.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:6,flexWrap:"wrap"},children:[(0,t.jsx)("span",{"data-testid":"interaction-outcome",style:{color:e.outcome==="failed"?"var(--graview-warn)":"var(--graview-ink)"},children:T(e)}),(e.batches??[]).map(o=>(0,t.jsx)("span",{"data-interaction-batch":o,style:{marginLeft:"auto"},children:i(o)},o))]}),f?(0,t.jsx)("div",{"data-testid":"interaction-model",style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)"},children:f}):null,x?(0,t.jsxs)("div",{style:{display:"flex",gap:6,flexWrap:"wrap"},children:[e.panel?(0,t.jsx)("button",{type:"button","data-testid":"interaction-reopen",disabled:p,onClick:()=>m(o=>o.drawPanel(c,e.panel)),style:l,children:"Show the panel"}):null,(0,t.jsx)("button",{type:"button","data-testid":"interaction-again",disabled:p,onClick:()=>m(o=>o.askAgain(c,e)),style:l,children:"Ask again"})]}):null]})}export{L as a,V as b};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as C,e as L,n as H,o as R,p as k}from"./chunk.O7HHNQK4.js";import"./chunk.BJUUSIQY.js";import"./chunk.TQ2G4AM4.js";import"./chunk.X36BYTEG.js";import"./chunk.LDMBJC3B.js";import"./chunk.XOZU4OFA.js";import"./chunk.G7YLK4PX.js";import{a as S}from"./chunk.GH5UBSQI.js";import"./chunk.2JEN2RCB.js";import"./chunk.75JQCTR6.js";import"./chunk.5IEZF433.js";import"./chunk.5AD2QHWH.js";import"./chunk.3FKKH2XU.js";import"./chunk.DLWFULWE.js";import{G as T,Ua as E,V as b}from"./chunk.VLX7YWVH.js";import"./chunk.SDO3U72B.js";import{sd as x}from"./chunk.IQGSEAQ2.js";import"./chunk.FQLNBIQ5.js";import{b as g}from"./chunk.AJZBJBMO.js";var t=g(T(),1);var c=g(b(),1);function N(n){if(!n||n.interaction.outcome==="failed")return null;let s=n.offers[0],o=s?n.interaction.offered.find(i=>i.id===s.id)?.confidence:void 0;return s&&o!==void 0&&o>=.6?{offer:s,confidence:o}:null}function V({rest:n,hold:s,leave:o}){let i=S(),u=(0,t.useMemo)(()=>C(n.target,e=>i.store.graph.has(e)),[n.target,i.store]),l=u.on==="record"&&L(i.ai)!==void 0,m=l?H(i,u):void 0,p=JSON.stringify(u),[y,I]=(0,t.useState)(null);(0,t.useEffect)(()=>{if(!l||m!==void 0)return;let e=!0;return R(i,u).then(r=>{e&&I({key:p,result:r})}),()=>{e=!1}},[p,l]);let w=m??(y?.key===p?y.result:void 0),f=l?N(w):null,v=f?.offer.id??null,h=(0,t.useRef)(null);if((0,t.useEffect)(()=>{if(v===null)return;let e=r=>{r.target instanceof Node&&h.current?.contains(r.target)||o(!0)};return document.addEventListener("pointerdown",e,{capture:!0,passive:!0}),document.addEventListener("contextmenu",e,{capture:!0,passive:!0}),addEventListener("scroll",e,{capture:!0,passive:!0}),addEventListener("resize",e,{passive:!0}),()=>{document.removeEventListener("pointerdown",e,{capture:!0}),document.removeEventListener("contextmenu",e,{capture:!0}),removeEventListener("scroll",e,{capture:!0}),removeEventListener("resize",e)}},[v,o]),(0,t.useLayoutEffect)(()=>{let e=h.current;if(!e)return;if(typeof e.showPopover=="function"&&!E(e))try{e.showPopover()}catch{}let r=n.element.getBoundingClientRect(),d=e.getBoundingClientRect(),O=r.top-d.height-4>=4?r.top-d.height-4:Math.min(innerHeight-d.height-4,r.top+4),A=Math.max(4,Math.min(innerWidth-d.width-4,r.right-d.width));e.style.top=`${Math.round(O)}px`,e.style.left=`${Math.round(A)}px`},[v,n.element]),!f)return null;let{offer:a,confidence:P}=f,M=a.type==="panel"?"a panel":a.type==="place"?"go there":a.type==="record"?"open it":"suggested";return(0,c.jsxs)("button",{ref:h,type:"button",popover:"manual","data-testid":"hover-chip","data-ai-offer":a.id,"data-ai-offer-type":a.type,"data-graview-overlay":"","data-graview-popover":"","aria-label":`Suggested by AI: ${a.label}`,title:`Suggested by AI, ${Math.round(P*100)}% sure`,onPointerEnter:s,onPointerLeave:()=>o(),onClick:()=>{n.element.closest("[tabindex], a[href], button")?.focus({preventScroll:!0}),o(!0),k(i,w,a)},style:$,children:[(0,c.jsxs)("span",{"aria-hidden":"true",style:{color:"var(--graview-accent)"},children:["\u2726"," "]}),a.label,(0,c.jsxs)("span",{style:{color:"var(--graview-ink-faint)"},children:[" \xB7 ",M]})]})}var $={position:"fixed",inset:"auto",top:0,left:0,margin:0,zIndex:x("toast"),boxSizing:"border-box",width:"max-content",maxWidth:"min(320px, calc(100vw - 8px))",height:"auto",minHeight:24,padding:"2px 10px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",borderRadius:999,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",color:"var(--graview-ink)",boxShadow:"var(--graview-lift-high)",font:"inherit",fontSize:"0.75rem",cursor:"pointer"};export{V as HoverChip};
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import{c as Nt,d as ne,e as Mt,f as Ot}from"./chunk.GHHKRFPD.js";import{a as Ft,b as Le,c as Tt}from"./chunk.6NRWLCIZ.js";import{m as kt}from"./chunk.ZQGLPP7A.js";import{g as St}from"./chunk.T4TRJDBF.js";import{a as vt}from"./chunk.2VYGDY5Z.js";import{d as wt}from"./chunk.5IEZF433.js";import{d as Rt}from"./chunk.5AD2QHWH.js";import{F as Lt,G as Dt,g as yt,h as gt,s as bt,t as Et,w as xt,x as Pt,y as Ct}from"./chunk.3FKKH2XU.js";import{c as Ar}from"./chunk.DLWFULWE.js";import{G as M,O as ht,Q as mt,V as ee,ea as pt}from"./chunk.VLX7YWVH.js";import{Vd as lt,Wd as st,Xd as ut,_c as nt,cd as ot,db as at,ga as Ce,le as ct,me as dt,ne as ft,pa as de,rd as it}from"./chunk.IQGSEAQ2.js";import{b as D}from"./chunk.AJZBJBMO.js";function _r(e,t){return lt(e,t).slice(1)}function fe(e,t){return e.kinds.find(r=>_r(e,r)===t)}function Mn(e,t,r){return st(e,t,r)}function On(e,t){return ut(e,t)}var _=D(M(),1),g=D(M(),1),x=D(M(),1),Ve=D(M(),1),yr=D(M(),1),S=D(M(),1),nn=D(M(),1),on=D(M(),1),ln=D(M(),1),v=D(M(),1),Dr=D(M(),1);var Ae=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,Bt=/^[\\/]{2}/;function $r(e,t){return t+e.replace(/\\/g,"/")}var At="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 Wt(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 Yt(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 Hr(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 Ir(){return Math.random().toString(36).substring(2,10)}function _t(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||Ir(),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 Hr(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=_t(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=_t(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 Ur(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(At,d),s=f,()=>{n.removeEventListener(At,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 Ur(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&&Bt.test(n)&&(n=a+n),new URL(n,a)}var jr;jr=new WeakMap;function _e(e,t,r="/"){return zr(e,t,r,!1)}function zr(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??Wr(e),s=null,u=ta(i);for(let c=0;s==null&&c<l.length;++c)s=ea(l[c],u,a);return s}function Br(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 Wr(e){let t=Vt(e);return Yr(t),t}function Vt(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}".`),Vt(i.children,t,m,d,s)),!(i.path==null&&!i.index)&&t.push({path:d,score:qr(d,i.index),routesMeta:m.map((h,y)=>{let[p,f]=Gt(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 Jt(i.path))o(i,l,!0,s)}),t}function Jt(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=Jt(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 Yr(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:Zr(t.routesMeta.map(a=>a.childrenIndex),r.routesMeta.map(a=>a.childrenIndex)))}var Vr=/^:[\w-]+$/,Jr=3,Kr=2,Gr=1,Xr=10,Qr=-2,$t=e=>e==="*";function qr(e,t){let r=e.split("/"),a=r.length;return r.some($t)&&(a+=Qr),t&&(a+=Kr),r.filter(n=>!$t(n)).reduce((n,o)=>n+(Vr.test(o)?Jr:o===""?Gr:Xr),a)}function Zr(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 ea(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?Kt(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:aa(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]=Gt(e.path,e.caseSensitive,e.end);return Kt(e,t,r,a)}function Kt(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 Gt(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 ta(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 Xt(e,t="/"){let{pathname:r,search:a="",hash:n=""}=typeof e=="string"?V(e):e,o;return r?(r=Qt(r),r.startsWith("/")||r.startsWith("\\")?o=It(r.substring(1),"/"):o=It(r,t)):o=t,{pathname:o,search:na(a),hash:oa(n)}}function It(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 ra(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function $e(e){let t=ra(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=Xt(n,l),u=i&&i!=="/"&&i.endsWith("/"),c=(o||i===".")&&r.endsWith("/");return!s.pathname.endsWith("/")&&(u||c)&&(s.pathname+="/"),s}var Qt=e=>e.replace(/[\\/]{2,}/g,"/"),H=e=>Qt(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 aa=e=>te(e).replace(/^\/*/,"/"),na=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,oa=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;var qt=class{constructor(e,t,r,a=!1){this.status=e,this.statusText=t||"",this.internal=a,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}};function Zt(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function ia(e){let t=e.map(r=>r.route.path).filter(Boolean);return H(t)||"/"}var er=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function tr(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(er)try{let o=new URL(window.location.href),i=Bt.test(r)?new URL($r(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 _n=Symbol("Uninstrumented");var $n=Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var Ht=new URL("http://localhost");function Ie(e){if(e.createURL)return e.createURL("/");try{return new URL(e.createHref("/"),Ht)}catch{return Ht}}function ke(e,t){return e.origin===t.origin&&(e.origin!=="null"||e.protocol===t.protocol&&e.host===t.host)}function la(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||!la(e,n)||!ke(n,o)))throw new Error("External navigation is not allowed")}var rr=["POST","PUT","PATCH","DELETE"],In=new Set(rr),sa=["GET",...rr],Hn=new Set(sa);var Un=Symbol("ResetLoaderData"),ua,ca,da,fa;ua=new WeakMap;ca=new WeakMap;da=new WeakMap;fa=new WeakMap;var ha=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function ma(e){try{return ha.includes(new URL(e).protocol)}catch{return!1}}var G=_.createContext(null);G.displayName="DataRouter";var re=_.createContext(null);re.displayName="DataRouterState";var ar=_.createContext(!1);function pa(){return _.useContext(ar)}var Ue=_.createContext({isTransitioning:!1});Ue.displayName="ViewTransition";var nr=_.createContext(new Map);nr.displayName="Fetchers";var ya=_.createContext(null);ya.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,or="REACT_ROUTER_ERROR",ga="REDIRECT",va="ROUTE_ERROR_RESPONSE";function Ra(e){if(e.startsWith(`${or}:${ga}:{`))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 wa(e){if(e.startsWith(`${or}:${va}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new qt(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 Sa(){return g.useContext(X).navigationType}var ir="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function lr(e){g.useContext(N).static||g.useLayoutEffect(e)}function q(){let{isDataRoute:e}=g.useContext(I);return e?Na():ba()}function ba(){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 lr(()=>{i.current=!0}),g.useCallback((s,u={})=>{if(O(i.current,ir),!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 jn=g.createContext(null);function Ea(){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 sr(e,t){return ur(e,t)}function ur(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||"";hr(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
|
-
|
|
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=Da(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 xa(){let e=fr(),t=Zt(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,a="rgba(200,200,200, 0.5)",n={padding:"0.5rem",backgroundColor:a},o={padding:"2px 4px",backgroundColor:a},i=null;return 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 Pa=g.createElement(xa,null),cr=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=wa(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(Ca,{error:e},t):t}};cr.contextType=ar;var Fe=new WeakMap;function Ca({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=Ra(t.digest);if(n){let o=Fe.get(t);if(o)throw o;let i=tr(n.location,r),l=i.absoluteURL||i.to;if(He(n.location,l,Ie(a),"allow-explicit"),ma(l))throw new Error("Invalid redirect location");if(er&&!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 La({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 Da(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:ia(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||Pa,i&&(l<0&&m===0?(hr("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(La,{match:d,routeContext:{outlet:c,matches:R,isDataRoute:a!=null},children:b})};return a&&(d.route.ErrorBoundary||d.route.errorElement||m===0)?g.createElement(cr,{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 ka(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 Fa(e){let t=g.useContext(I);return L(t,ze(e)),t}function We(e){let t=Fa(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 Ta(){return We("useRouteId")}function dr(){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=>Br(r,t)),[e,t])}function fr(){let e=g.useContext(je),t=Be("useRouteError"),r=We("useRouteError");return e!==void 0?e:t.errors?.[r]}function Na(){let{router:e}=ka("useNavigate"),t=We("useNavigate"),r=g.useRef(!1);return lr(()=>{r.current=!0}),g.useCallback(async(n,o={})=>{O(r.current,ir),r.current&&(typeof n=="number"?await e.navigate(n):await e.navigate(n,{fromRouteId:t,...o}))},[e,t])}var Ut={};function hr(e,t,r){!t&&!Ut[e]&&(Ut[e]=!0,O(!1,r))}var Ma="useOptimistic",zn=x[Ma];var Bn=x.memo(Oa);function Oa({routes:e,manifest:t,future:r,state:a,isStatic:n,onError:o}){return ur(e,void 0,{manifest:t,state:a,isStatic:n,onError:o,future:r})}function Aa({basename:e,children:t,initialEntries:r,initialIndex:a,useTransitions:n}){let o=x.useRef();o.current==null&&(o.current=Wt({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 _a({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 mr(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 $a({children:e,location:t}){return sr(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===mr,`[${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 Ia(e){return xe(e)&&e.tagName.toLowerCase()==="button"}function Ha(e){return xe(e)&&e.tagName.toLowerCase()==="form"}function Ua(e){return xe(e)&&e.tagName.toLowerCase()==="input"}function ja(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function za(e,t){return e.button===0&&(!t||t==="_self")&&!ja(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 Ba(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 Wa(){if(he===null)try{new FormData(document.createElement("form"),0),he=!1}catch{he=!0}return he}var Ya=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Te(e){return e!=null&&!Ya.has(e)?(O(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${ye}"`),null):e}function Va(e,t){let r,a,n,o,i;if(Ha(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(Ia(e)||Ua(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),!Wa()){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 Wn=Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var Ja={"&":"\\u0026",">":"\\u003e","<":"\\u003c","\u2028":"\\u2028","\u2029":"\\u2029"},Ka=/[&><\u2028\u2029]/g;function jt(e){return e.replace(Ka,t=>Ja[t])}function Je(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}var Ga=Symbol("SingleFetchRedirect");function pr(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 Xa(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 Qa(e){return e!=null&&typeof e.page=="string"}function qa(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 Za(e,t,r){let a=await Promise.all(e.map(async n=>{let o=t.routes[n.route.id];if(o){let i=await Xa(o,r);return i.links?i.links():[]}return[]}));return an(a.flat(1).filter(qa).filter(n=>n.rel==="stylesheet"||n.rel==="preload").map(n=>n.rel==="stylesheet"?{...n,rel:"prefetch",as:"style"}:{...n,rel:"prefetch"}))}function zt(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 en(e,t,{includeHydrateFallback:r}={}){return tn(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 tn(e){return[...new Set(e)]}function rn(e){let t={},r=Object.keys(e).sort();for(let a of r)t[a]=e[a];return t}function an(e,t){let r=new Set,a=new Set(t);return e.reduce((n,o)=>{if(t&&!Qa(o)&&o.as==="script"&&o.href&&a.has(o.href))return n;let l=JSON.stringify(rn(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 sn(){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 un(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 gr({page:e,...t}){let r=pa(),{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(dn,{page:e,matches:o,...t}):S.createElement(fn,{page:e,matches:o,...t})):null}function cn(e){let{manifest:t,routeModules:r}=Pe(),[a,n]=S.useState([]);return S.useEffect(()=>{let o=!1;return Za(e,t,r).then(i=>{o||n(i)}),()=>{o=!0}},[e,t,r]),a}function dn({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=pr(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 fn({page:e,matches:t,...r}){let a=T(),{future:n,manifest:o,routeModules:i}=Pe(),{basename:l}=Ke(),{loaderData:s,matches:u}=sn(),c=S.useMemo(()=>zt(e,t,u,o,a,"data"),[e,t,u,o,a]),d=S.useMemo(()=>zt(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=pr(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(()=>en(d,o),[d,o]),y=cn(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 hn(...e){return t=>{e.forEach(r=>{typeof r=="function"?r(t):r!=null&&(r.current=t)})}}var mn=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{mn&&(window.__reactRouterVersion="7.18.3")}catch{}function pn({basename:e,children:t,useTransitions:r,window:a}){let n=v.useRef();n.current==null&&(n.current=Yt({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 vr({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})}vr.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=tr(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]=un(a,y),ue=Er(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:hn(p,K),target:u,"data-discover":!b&&r==="render"?"true":void 0});return $&&!b?v.createElement(v.Fragment,null,rt,v.createElement(gr,{page:E})):rt});se.displayName="Link";var Rr=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&&Lr(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)});Rr.displayName="NavLink";var wr=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=xr(),R=Pr(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})});wr.displayName="Form";function Sr({getKey:e,storageKey:t,...r}){let a=v.useContext(le),{basename:n}=v.useContext(N),o=T(),i=Ye();Cr({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})(${jt(JSON.stringify(t||Me))}, ${jt(JSON.stringify(l))})`}})}Sr.displayName="ScrollRestoration";function br(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,br(e)),t}function yn(e){let t=v.useContext(re);return L(t,br(e)),t}function Er(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(za(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(()=>Ba(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 gn=0,vn=()=>`__${String(++gn)}__`;function xr(){let{router:e}=Ge("useSubmit"),{basename:t}=v.useContext(N),r=Ta(),a=e.fetch,n=e.navigate;return v.useCallback(async(o,i={})=>{let{action:l,method:s,encType:u,formData:c,body:d}=Va(o,t);if(i.navigate===!1){let m=i.fetcherKey||vn();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 Pr(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 Cr({getKey:e,storageKey:t}={}){let{router:r}=Ge("useScrollRestoration"),{restoreScrollPosition:a,preventScrollReset:n}=yn("useScrollRestoration"),{basename:o}=v.useContext(N),i=T(),l=Ye(),s=dr();v.useEffect(()=>(window.history.scrollRestoration="manual",()=>{window.history.scrollRestoration="auto"}),[]),Rn(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 Rn(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 Lr(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),kr=D(Ar(),1);var j=D(ee(),1);function Fr({context:e,own:t}){ne(e.store);let r=pt(),a=mt()?.live??e.store;ne(a);let n=St();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)(kt,{})}),(0,j.jsx)(Qe.Suspense,{fallback:null,children:(0,j.jsx)(Ft,{})})]});return t?(0,kr.createPortal)(o,t):(0,j.jsx)("div",{className:"graview-bar-own",children:o})}var A=D(M(),1);var J=D(M(),1),wn=(0,J.createContext)(null);function ui(){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 Tr(e){let t=(0,J.useContext)(wn);(0,J.useLayoutEffect)(()=>t?.place(e),[t,e])}function ci(e,t){return(0,J.useSyncExternalStore)(e.subscribe,()=>e.count(t)>0,()=>!1)}var Nr=D(M(),1),z=D(ee(),1),qe="var(--graview-text-small)",Ze="var(--graview-text-body)",gi="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,vi={...et,maxWidth:tt},Mr={margin:0,fontSize:"var(--graview-text-title)",lineHeight:1.2,letterSpacing:"-0.012em",overflowWrap:"anywhere",textWrap:"balance"},Ri={margin:0,fontSize:"var(--graview-text-heading)",lineHeight:1.3,textWrap:"balance"},wi={margin:0,fontSize:qe,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--graview-ink-muted)"},Si={margin:0,fontSize:Ze,color:"var(--graview-ink-muted)",maxWidth:"60ch"},Or={color:"var(--graview-ink-muted)",fontSize:qe},bi={borderTop:"1px solid var(--graview-edge)",paddingTop:24},Sn={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},Ei={...Sn,textDecoration:"none"},xi={color:"inherit",textDecoration:"none",display:"inline-flex",alignItems:"center",minHeight:24},Pi=`.graview-list{container-type:inline-size}
|
|
4
|
-
.graview-rows{display:grid;grid-template-columns:minmax(0,1fr);column-gap:1.5rem;margin:0;padding:0;list-style:none;border-top:1px solid var(--graview-edge)}
|
|
5
|
-
.graview-row{grid-column:1/-1;display:grid;grid-template-columns:subgrid;align-items:baseline;align-content:center;position:relative;box-sizing:border-box;min-height:2.75rem;padding:.5rem 0;border-bottom:1px solid var(--graview-edge);overflow-wrap:anywhere}
|
|
6
|
-
.graview-row-title{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;min-height:24px;color:inherit;text-decoration:none;font-size:var(--graview-text-body);font-weight:500;line-height:1.3;text-wrap:pretty;hyphens:manual}
|
|
7
|
-
.graview-row-title::after{content:"";position:absolute;inset:0}
|
|
8
|
-
.graview-row-title:focus-visible{outline:0}
|
|
9
|
-
.graview-row-title:focus-visible::after{outline:2px solid var(--graview-accent);outline-offset:-2px;border-radius:var(--graview-radius-sm)}
|
|
10
|
-
.graview-row:hover .graview-row-title{text-decoration:underline 1px color-mix(in srgb,currentColor 50%,transparent);text-underline-offset:.2em}
|
|
11
|
-
.graview-row:active .graview-row-title{color:var(--graview-accent)}
|
|
12
|
-
.graview-row :is(a,button):not(.graview-row-title){position:relative}
|
|
13
|
-
.graview-row-glance,.graview-row>[data-testid=search-why]{font-size:var(--graview-text-small);line-height:1.5;color:var(--graview-ink-muted)}
|
|
14
|
-
.graview-row>[data-testid=search-why]{grid-column:1/-1}
|
|
15
|
-
.graview-row-glance{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden}
|
|
16
|
-
.graview-chip{display:inline-block;padding:0 .5em;border-radius:var(--graview-radius-sm);background:color-mix(in srgb,var(--graview-ink) 7%,transparent);color:var(--graview-ink);font-weight:500;line-height:1.6;white-space:nowrap}
|
|
17
|
-
.graview-group-head{display:flex;gap:.5em;align-items:baseline;margin:0;padding:.375rem 0;font-family:var(--graview-font-body);font-size:var(--graview-text-small);font-weight:var(--graview-weight-label);line-height:1.3;letter-spacing:.02em;scroll-margin-top:4rem}
|
|
18
|
-
.graview-group-head>span{color:var(--graview-ink-muted);font-weight:var(--graview-weight-body)}
|
|
19
|
-
.graview-group-toggle{display:inline-flex;gap:.5em;align-items:center;min-height:2.75rem;margin:-.375rem 0;padding:0 .5rem 0 0;border:0;background:none;color:inherit;font:inherit;letter-spacing:inherit;text-align:start;cursor:pointer;border-radius:var(--graview-radius-sm)}
|
|
20
|
-
.graview-group-toggle:focus-visible{outline:2px solid var(--graview-accent);outline-offset:2px}
|
|
21
|
-
.graview-group-toggle>span{color:var(--graview-ink-muted);font-weight:var(--graview-weight-body)}
|
|
22
|
-
@container (min-width:36rem){.graview-rows{grid-template-columns:minmax(0,1fr) fit-content(40%)}.graview-group-head:has(+.graview-rows){position:sticky;top:0;z-index:${it.raised};background:var(--graview-ground)}}`,Ci={font:"inherit",fontSize:qe,padding:"8px 14px",borderRadius:"var(--graview-radius-sm, 8px)",border:"1px solid var(--graview-edge-bright)",background:"var(--graview-panel)",color:"var(--graview-ink)",cursor:"pointer"};function Li({kind:e,brand:t,size:r=10,schema:a}){return(0,z.jsx)(vt,{kind:e,...a?{schema:a}:{},...t?{brand:t}:{},size:Math.round(r*1.6)})}function Di(e,t){let a=[...new Set(t.targets.map(n=>n.kind))].map(n=>e.schema.tryDefinition(n)?.plural??Ce(n));return a.length>0?a.join(" and "):Ce(t.edgeKind)}function ki(e,t,r){return e.author.kind==="human"&&(e.author.id===void 0||t?.id===void 0||e.author.id===t.id)?"you":r?at(e.author,r):e.author.kind==="agent"?e.author.id??"an agent":e.author.id??e.author.kind}function Fi(e,t,r){return bn(e,t,r).map(a=>a.text).join(" \xB7 ")}function bn(e,t,r,a=()=>!1){return wt(e,t,{limit:3,said:[r],glance:!0}).map(n=>n.long?{text:Rt(n.stored,{markdown:n.markdown,most:100})}:a(n.key)?{text:n.alone,choice:n.key}:{text:n.alone})}function Ti({runs:e}){return(0,z.jsx)(z.Fragment,{children:e.map((t,r)=>{let a=r===0?"":t.choice===void 0&&e[r-1].choice===void 0?" \xB7 ":" ";return(0,z.jsx)(Nr.Fragment,{children:t.choice!==void 0?(0,z.jsxs)(z.Fragment,{children:[a,(0,z.jsx)("span",{className:"graview-chip","data-graview-field":t.choice,children:t.text})]}):`${a}${t.text}`},r)})})}var Ni=(e,t)=>de(e.schema,t),En=(e,t)=>{let r=e.kindsKeptFrom(t);return e.schema.kinds.filter(a=>!e.modules.disabledKinds.has(a)&&!r.has(a))},xn=e=>ft(En(e.store,e.principal),e.views?.arrangement?.()?.order),Mi=e=>{let t=new Set(e.views?.arrangement?.()?.hide??[]);return xn(e).filter(r=>!t.has(r))},Oi=e=>e.charAt(0).toUpperCase()+e.slice(1);var C=D(ee(),1);function Ji({context:e,children:t}){let{store:r,brand:a}=e;ne(r);let n=ht();return yt(e.embedded?void 0:ot(e.assetsAt??n,nt(a))),gt(e.embedded?void 0:a),(0,C.jsxs)("div",{style:{...e.embedded?{}:{minHeight:"100vh"},display:"flex",flexDirection:"column",background:"var(--graview-ground)",color:"var(--graview-ink)",fontFamily:"var(--graview-font-body, system-ui)",fontSize:Ze,lineHeight:1.5},children:[e.embedded?null:(0,C.jsx)(Cn,{context:e}),(0,C.jsx)("div",{style:{flex:1},children:t}),e.remembers?(0,C.jsx)("footer",{style:{borderTop:"1px solid var(--graview-edge)",padding:"14px 20px max(20px, calc(var(--graview-foot-room, 0px) + env(safe-area-inset-bottom, 0px)))",...Or},children:(0,C.jsx)("div",{style:{maxWidth:tt,margin:"0 auto",display:"flex",gap:14,flexWrap:"wrap",alignItems:"center",justifyContent:"flex-end"},children:(0,C.jsxs)("span",{"data-testid":"remembered",children:["Remembered in this browser \xB7 ",(0,C.jsx)(Nt,{})]})})}):null]})}var Pn=(0,A.createContext)(null);function Cn({context:e}){let{store:t,brand:r,sceneHref:a="/",invariantContext:n}=e,o=T(),i=q(),l=be("/").replace(/\/$/,""),s=(0,A.useContext)(Pn),u=s?.places===!1?[]:bt({store:t,principal:e.principal,views:e.views}),c=e.views?.arrangement?.(),d=`${o.pathname}${o.search}`,m=t.violations(n),h=m.length,y=Lt(m,"All rules hold"),p=o.pathname.split("/").filter(Boolean),f=p.length===2&&fe(t.schema,p[0])!==void 0&&t.graph.getNode(decodeURIComponent(p[1]))!==void 0;return(0,C.jsx)(C.Fragment,{children:(0,C.jsx)(Pt,{brand:r,name:r?.name??"Graview",description:r?.subtitle,home:{href:`${l}/`,go:()=>i("/"),current:o.pathname==="/"},faces:{scene:{label:ct(c),current:!1,go:()=>window.location.assign(a)},pages:{label:dt(c),current:!0,go:()=>{}}},places:u,current:Et(u,d),reach:{href:R=>`${l}${R}`,go:R=>i(R.path)},...s?{onFind:s.onFind,find:s.find}:{findBox:(0,C.jsx)(Fn,{context:e})},skips:(0,C.jsx)(Tt,{to:[{label:"Skip to the content",testid:"content",go:()=>{let R=document.querySelector("[data-graview-skip-target]");Le(R?.querySelector('[data-graview-choose-box][tabindex="0"]')??R??document.querySelector("main"))}},...f?[{label:"Skip to what can be done",testid:"acts",go:()=>void Le(document.querySelector("main [data-affordance]:not([disabled]):not([tabindex='-1'])")??document.querySelector("main [data-affordance]:not([disabled])")??document.querySelector("main"))}]:[]]}),tools:(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(se,{to:"/problems","data-testid":"standing-link","aria-label":y,title:y,style:{...xt,padding:h===0?0:"0 8px",textDecoration:"none",fontWeight:600,fontVariantNumeric:"tabular-nums",color:h===0?"var(--graview-ink-muted)":"var(--graview-warn)"},children:[(0,C.jsx)(Dt,{tone:h===0?"var(--graview-good)":"var(--graview-warn)"}),h>0?(0,C.jsx)("span",{"aria-hidden":"true",children:h}):null]}),s?null:(0,C.jsx)(Fr,{context:e}),e.views?(0,C.jsx)(Ct,{...e.signature?{signature:!0}:{}}):null]})})})}function Ki({context:e,style:t,bleedTop:r,children:a,...n}){let o=e.embedded||e.framed?"section":"main";return(0,C.jsxs)(o,{style:{...et,...t},"data-graview-page-main":"",...r?{"data-graview-bleed-top":""}:{},...n,children:[r?(0,C.jsx)("style",{children:Ln}):null,a]})}var Ln="@media (max-width:680px){[data-graview-bleed-top]:not(:has([data-graview-bleed]>[data-worker-view-fallback])){padding-top:0 !important}}";function Gi({when:e,children:t}){return e?(0,C.jsxs)("div",{"data-graview-bleed":"",style:{display:"grid",minWidth:0},children:[(0,C.jsx)("style",{children:Dn}),t]}):(0,C.jsx)(C.Fragment,{children:t})}var Dn="@media (max-width:680px){[data-graview-bleed]:not(:has(>[data-worker-view-fallback])){margin-inline:min(0px,calc(env(safe-area-inset-left,0px) - var(--graview-page-gutter,20px))) min(0px,calc(env(safe-area-inset-right,0px) - var(--graview-page-gutter,20px)))}}",kn={position:"absolute",width:1,height:1,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap"};function Xi({context:e,unseen:t,children:r,...a}){let n=`h${e.titleLevel??(e.framed&&!e.barAbove?1:2)}`;return(0,C.jsx)(n,{style:t?kn:Mr,"data-graview-page-title":"",...a,children:r})}function Fn({context:e,narrowsLists:t=!0,className:r,size:a}){Tr("find");let n=T(),o=q(),[i,l]=Xe(),s=n.pathname.split("/").filter(Boolean),u=t&&s.length===1&&fe(e.store.schema,s[0])!==void 0,c=n.pathname==="/search",d=u||c?i.get("q")??"":"",m=u?`Narrow ${de(e.store.schema,fe(e.store.schema,s[0])).toLowerCase()}\u2026`:"",[h,y]=(0,A.useState)(!0);(0,A.useLayoutEffect)(()=>{let P=R.current;if(!P||!m||typeof ResizeObserver>"u")return;let E=()=>{let k=getComputedStyle(P),$=document.createElement("canvas").getContext("2d");$&&($.font=`${k.fontWeight} ${k.fontSize} ${k.fontFamily}`,y($.measureText(m).width<=P.clientWidth-parseFloat(k.paddingLeft)-parseFloat(k.paddingRight)))};E();let F=new ResizeObserver(E);return F.observe(P),()=>F.disconnect()},[m]);let[p,f]=(0,A.useState)(d),R=(0,A.useRef)(null);(0,A.useEffect)(()=>{let P=E=>{if(E.defaultPrevented||E.altKey)return;let F=!E.shiftKey&&(E.metaKey||E.ctrlKey)&&E.key.toLowerCase()==="k",k=document.activeElement,$=k instanceof HTMLInputElement||k instanceof HTMLTextAreaElement||k instanceof HTMLSelectElement||k instanceof HTMLElement&&k.isContentEditable,K=E.key==="/"&&!E.metaKey&&!E.ctrlKey&&!$;if(!F&&!K)return;let B=R.current,ue=B?.closest("[data-graview-embed]"),Z=E.target,ce=Z===document.body||Z===document.documentElement;!B||!(ce||!ue||Z instanceof Node&&ue.contains(Z))||(E.preventDefault(),B.closest("[data-graview-app-bar]")?.querySelector('[data-testid="app-find-open"]')?.click(),requestAnimationFrame(()=>{B.focus(),B.select()}))};return document.addEventListener("keydown",P),()=>document.removeEventListener("keydown",P)},[]);let w=(0,A.useRef)(new Set([d]));(0,A.useEffect)(()=>{w.current.has(d)||(w.current=new Set([d]),f(d))},[d]);let b=P=>{if(f(P),w.current.add(P),u){let F=new URLSearchParams(i);P.trim()?F.set("q",P):F.delete("q"),l(F,{replace:!0});return}let E=P.trim()?`/search?${new URLSearchParams({q:P}).toString()}`:"/search";o(E,{replace:c})};return(0,C.jsxs)("form",{role:"search","aria-label":u?"Narrow this list":"Find anything",className:Ot("graview-find",r),...Mt(a),onSubmit:P=>{P.preventDefault(),u&&p.trim()&&o(`/search?${new URLSearchParams({q:p}).toString()}`)},children:[(0,C.jsx)("input",{ref:R,type:"search","data-testid":"nav-find",value:p,onChange:P=>b(P.target.value),placeholder:u?h?m:"Narrow\u2026":"Find\u2026","aria-keyshortcuts":"/ Meta+K Control+K","aria-label":u?"Narrow this list":"Find anything",className:"graview-find-box"}),(0,C.jsx)("style",{children:Tn})]})}var Tn=`:where(.graview-find){display:flex;min-width:0;flex:1 1 auto}
|
|
23
|
-
:where(.graview-find[data-size=md]){--graview-control-height:36px}
|
|
24
|
-
:where(.graview-find-box){box-sizing:border-box;width:100%;min-width:0;height:var(--graview-control-height,30px);padding:0 var(--graview-bar-find-end,10px) 0 10px;font:inherit;font-size:.875rem;color:var(--graview-ink);background:var(--graview-ground);border:1px solid var(--graview-edge);border-radius:8px}`;export{_r as a,fe as b,Mn as c,On as d,qe as e,gi as f,vi as g,Ri as h,wi as i,Si as j,Or as k,bi as l,Sn as m,Ei as n,xi as o,Pi as p,Ci as q,Li as r,Di as s,ki as t,Fi as u,bn as v,Ti as w,Ni as x,En as y,xn as z,Mi as A,Oi as B,Fr as C,be as D,T as E,Sa as F,q as G,Ea as H,Aa as I,_a as J,mr as K,$a as L,pn as M,se as N,Xe as O,wn as P,ui as Q,ci as R,Ji as S,Pn as T,Ki as U,Gi as V,Xi as W,Fn as X};
|
|
25
|
-
/*! Bundled license information:
|
|
26
|
-
|
|
27
|
-
react-router/dist/development/chunk-BV7QT456.mjs:
|
|
28
|
-
(**
|
|
29
|
-
* react-router v7.18.3
|
|
30
|
-
*
|
|
31
|
-
* Copyright (c) Remix Software Inc.
|
|
32
|
-
*
|
|
33
|
-
* This source code is licensed under the MIT license found in the
|
|
34
|
-
* LICENSE.md file in the root directory of this source tree.
|
|
35
|
-
*
|
|
36
|
-
* @license MIT
|
|
37
|
-
*)
|
|
38
|
-
|
|
39
|
-
react-router/dist/development/index.mjs:
|
|
40
|
-
(**
|
|
41
|
-
* react-router v7.18.3
|
|
42
|
-
*
|
|
43
|
-
* Copyright (c) Remix Software Inc.
|
|
44
|
-
*
|
|
45
|
-
* This source code is licensed under the MIT license found in the
|
|
46
|
-
* LICENSE.md file in the root directory of this source tree.
|
|
47
|
-
*
|
|
48
|
-
* @license MIT
|
|
49
|
-
*)
|
|
50
|
-
*/
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./chunk.KHRS2SKB.js";import"./chunk.PR74PGLC.js";import"./chunk.25VJPUDH.js";import"./chunk.T6PU3NKP.js";import"./chunk.B6JR7EQO.js";import{a as x,b as P,c as L}from"./chunk.FN34P4IS.js";import{b as R}from"./chunk.2DH42I7L.js";import"./chunk.VZAF3452.js";import"./chunk.WHX47OJM.js";import"./chunk.2D7K2IJQ.js";import"./chunk.QRT6BZR6.js";import"./chunk.2V7QTIAV.js";import"./chunk.Z26T5E76.js";import"./chunk.77JI5T4F.js";import"./chunk.SADHOSRC.js";import"./chunk.4DZOAB4D.js";import"./chunk.UDU545CL.js";import"./chunk.7VAHHEDX.js";import"./chunk.HJCQ6I3S.js";import"./chunk.DQAMVVE6.js";import"./chunk.OXFDB5BB.js";import"./chunk.DJIF7IAQ.js";import"./chunk.S6QZBWCJ.js";import"./chunk.LTOQ22ZJ.js";import"./chunk.2TCOLAL2.js";import"./chunk.2VYGDY5Z.js";import"./chunk.FUPYIOXZ.js";import"./chunk.APRWUIE3.js";import"./chunk.3OEODIHB.js";import"./chunk.WFCE7NLK.js";import"./chunk.BIDL7GQD.js";import"./chunk.TA2JTUNX.js";import"./chunk.HZPRMHSL.js";import"./chunk.TQ2G4AM4.js";import"./chunk.X36BYTEG.js";import"./chunk.LDMBJC3B.js";import"./chunk.XOZU4OFA.js";import"./chunk.G7YLK4PX.js";import"./chunk.Q5WEOX3Q.js";import"./chunk.2E62YCMZ.js";import"./chunk.DUP2CGVH.js";import"./chunk.YFVJUHAK.js";import"./chunk.YEXFVDRA.js";import"./chunk.WVUJXDXZ.js";import"./chunk.ZA5TDCBC.js";import"./chunk.2JEN2RCB.js";import"./chunk.7CLKGKSF.js";import"./chunk.TMHVYI5R.js";import"./chunk.R5MLRKAO.js";import"./chunk.YMXWS4XN.js";import"./chunk.GZHZLJBF.js";import{s as T}from"./chunk.3SAESG6X.js";import"./chunk.OJGHDWI6.js";import"./chunk.F6BNFLQM.js";import"./chunk.75JQCTR6.js";import"./chunk.5IEZF433.js";import"./chunk.5AD2QHWH.js";import"./chunk.3FKKH2XU.js";import"./chunk.DLWFULWE.js";import{G as S,I as $,V as p,da as C,fa as A}from"./chunk.VLX7YWVH.js";import"./chunk.SDO3U72B.js";import{ka as v,sd as k}from"./chunk.IQGSEAQ2.js";import"./chunk.FQLNBIQ5.js";import{b as i}from"./chunk.AJZBJBMO.js";var r=i(S(),1);var l=i(S(),1);var g=i(p(),1);var m={font:"inherit",fontSize:"0.875rem",minHeight:24,padding:0,border:0,borderRadius:2,background:"transparent",boxShadow:"none",color:"var(--graview-accent)",textDecoration:"underline",textUnderlineOffset:3,textAlign:"start",cursor:"pointer"};var e=i(p(),1);function Q({page:n=!1,go:E,onPick:y,onDiscard:N}){let{store:d,seatTalk:c}=C(),u=$(c),D=L(),h=E??D,{keep:M}=x(h),[H,f]=(0,r.useState)(!1);A();let t=u.draft;(0,r.useEffect)(()=>f(!1),[t]),(0,r.useEffect)(()=>{n||P(!1)},[n]);let w=(0,r.useRef)(null),b=t!==null&&!n;if((0,r.useLayoutEffect)(()=>{let s=w.current;if(!b||!s?.parentElement)return;let o=[];for(let a=s.previousElementSibling;a;a=a.previousElementSibling)a instanceof HTMLElement&&!a.inert&&a.tagName!=="STYLE"&&(a.inert=!0,o.push(a));return()=>{for(let a of o)a.inert=!1}},[b]),!t)return null;let G=R(t.drawn),F=d.schema.tryDefinition(t.kind),O=d.graph.nodesOfKind(t.kind).filter(s=>v(F,s)),q=()=>{c.setDraft(null),N?.()};return(0,e.jsxs)("section",{ref:w,"data-testid":"draft-frame","data-graview-draft-frame":n?"page":"scene","aria-label":`Draft: ${t.title}`,style:n?{display:"grid",gap:12,minWidth:0}:{position:"absolute",inset:12,zIndex:k("rail"),display:"grid",gridTemplateRows:"auto auto minmax(0, 1fr)",background:"var(--graview-panel)",border:"1px solid var(--graview-edge)",borderRadius:12,boxShadow:"var(--graview-lift-high)",overflow:"hidden",minHeight:0},children:[(0,e.jsxs)("p",{"data-testid":"draft-line",style:{...z,...n?{}:{padding:"10px 16px"}},children:[n?(0,e.jsx)("span",{children:"Draft"}):(0,e.jsxs)("span",{children:["Draft \u2014 ",(0,e.jsx)("span",{"data-testid":"draft-title",style:{color:"var(--graview-ink)",fontWeight:600},children:t.title})]}),(0,e.jsx)("span",{"aria-hidden":"true",children:"\xB7"}),(0,e.jsx)("button",{type:"button","data-testid":"draft-keep",disabled:H,title:`Keep \u201C${t.title}\u201D as a lens: a place of its own`,onClick:()=>{f(!0),M(t).finally(()=>f(!1))},style:m,children:"Keep as a lens"}),(0,e.jsx)("span",{"aria-hidden":"true",children:"\xB7"}),(0,e.jsx)("button",{type:"button","data-testid":"draft-discard",onClick:q,style:m,children:"Discard"})]}),u.draftNote?(0,e.jsx)("p",{"data-testid":"draft-note",role:"status",style:{margin:0,padding:n?0:"0 16px 8px",fontSize:"0.8125rem",color:"var(--graview-warn)"},children:u.draftNote}):(0,e.jsx)("span",{}),(0,e.jsx)("div",{"data-testid":"draft-lens","data-graview-draft":t.lens.name,role:"group","aria-label":t.title,tabIndex:0,style:n?{height:"min(72vh, 760px)",display:"grid",gridTemplateRows:"minmax(0, 1fr)",overflow:"auto",scrollbarGutter:"stable",border:"1px solid var(--graview-edge)",borderRadius:12,background:"var(--graview-panel)"}:{minHeight:0,overflow:"auto",scrollbarGutter:"stable",display:"grid",gridTemplateRows:"minmax(0, 1fr)"},onClick:s=>{let o=s.target?.closest("[data-graview-pick]")?.getAttribute("data-graview-pick");if(!o||!d.graph.getNode(o))return;s.preventDefault();let a=d.graph.getNode(o);y?(c.setDraft(null),y(o)):h({to:"record",id:o,kind:a.kind,label:o,address:"",said:""})},children:(0,e.jsx)(T,{kind:t.kind,view:t.title,children:(0,e.jsx)(G,{nodes:O,label:t.title,fidelity:"full",cardinality:"many",mode:"fullscreen",selected:!1})})})]})}var z={margin:0,display:"flex",flexWrap:"wrap",alignItems:"baseline",gap:"4px 8px",fontSize:"0.875rem",color:"var(--graview-ink-muted)",borderBottom:"1px solid var(--graview-edge)",paddingBottom:8};export{Q as DraftFrame};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as ae,b as oe,c as E}from"./chunk.NJSK3UO2.js";import{a as N,b as $}from"./chunk.G5BVZLCM.js";import{a as ne,e as te}from"./chunk.NGRL3QOI.js";import{e as Q,f as X,g as Y,h as Z,i as ee,j as re}from"./chunk.DN7UCBOA.js";import"./chunk.DMENNIHT.js";import{G as _,M as D,Ma as L,O as I,Q as j,V as M,ea as C,ka as B,na as S,qa as v,ra as R,ta as A,va as O}from"./chunk.VLX7YWVH.js";import"./chunk.SDO3U72B.js";import"./chunk.IQGSEAQ2.js";import"./chunk.FQLNBIQ5.js";import{b as x}from"./chunk.AJZBJBMO.js";var i=x(_(),1);var a=x(M(),1);function se(e,n){let r=e?.logo;if(!n||!r)return e;let o=t=>t.startsWith("/graview/assets/")?n(t):t;return{...e,logo:typeof r=="string"?o(r):{...r,light:o(r.light),...r.dark?{dark:o(r.dark)}:{}}}}var ie=e=>({...e.node?{node:{id:e.node.id}}:{},...e.nodes?{nodes:e.nodes.map(n=>({id:n.id}))}:{},...e.label!==void 0?{label:e.label}:{},fidelity:e.fidelity,cardinality:e.cardinality,mode:e.mode,selected:e.selected,...e.implicated?{implicated:e.implicated}:{},...e.flagged?{flagged:e.flagged}:{}});function q(e){let n=j(),r=n?.past?.seq,o=n?.host?.viewAt,t=(0,i.useMemo)(()=>r===void 0||!o||e.draft?void 0:o(e.manifest.name,r),[o,r,e]);return(0,i.useMemo)(()=>t===null?null:t===void 0?e:{...e,worker:t},[t,e])}function z({definition:e,store:n,principal:r,input:o,goTo:t,places:s,arrangement:l,scheme:d,brand:m,onFailure:u,drawsItsOwn:w,tick:f}){let p=(0,i.useRef)(null),y=(0,i.useRef)(null),h=D(),k=I(),V=(0,i.useContext)(B),b=(0,i.useMemo)(()=>se(m,k),[m,k]),c=(0,i.useRef)({input:o,goTo:t,places:s,arrangement:l,onFailure:u,brand:b,hostFiles:h,hostAssets:k,told:V});c.current={input:o,goTo:t,places:s,arrangement:l,onFailure:u,brand:b,hostFiles:h,hostAssets:k,told:V},(0,i.useEffect)(()=>{let H=p.current;if(!H)return;let T=e.file??(c.current.hostFiles?.src?W=>c.current.hostFiles?.src?.(W)??W:void 0);typeof e.worker=="function"&&E(e.worker).catch(()=>{});let J=$(N,({mountWorkerView:W})=>{y.current=W(H,{manifest:e.manifest,worker:e.worker,store:n,principal:r,input:()=>c.current.input?.()??{},goTo:()=>c.current.goTo,places:()=>c.current.places?.()??[],arrangement:()=>c.current.arrangement?.(),brand:()=>c.current.brand,onFailure:(g,U)=>c.current.onFailure(g,U),...w?{fallback:!1}:{},...e.limits?{limits:e.limits}:{},...e.author?{author:e.author}:{},...e.onProblem?{onProblem:e.onProblem}:{},...e.asset?{asset:e.asset}:c.current.hostAssets?{asset:g=>c.current.hostAssets?.(g)??g}:{},...T?{file:T}:{},...e.images?{images:e.images}:{},...e.links?{links:e.links}:{},files:()=>c.current.hostFiles,onContentHeight:g=>c.current.told?.(g)})});return()=>{J(),y.current?.dispose(),y.current=null}},[e,n,r]),(0,i.useEffect)(()=>y.current?.update(),[d,b,f]);let P=(0,a.jsx)("div",{ref:p,"data-worker-view-place":e.manifest.name,style:{minWidth:0}});if(!e.draft)return P;let G=e.manifest.title??e.manifest.name;return(0,a.jsxs)("div",{role:"group","aria-label":`Draft: ${G}`,"data-graview-draft-view":e.manifest.name,style:{display:"grid",gap:8,alignContent:"start",minWidth:0},children:[(0,a.jsxs)("p",{"data-testid":"draft-view-line",style:le,children:[(0,a.jsxs)("span",{children:["Draft \u2014 ",(0,a.jsx)("span",{style:{color:"var(--graview-ink)",fontWeight:600},children:G})]}),(0,a.jsx)("span",{"aria-hidden":"true",children:"\xB7"}),(0,a.jsx)("span",{children:"Not kept"})]}),P]})}var le={margin:0,display:"flex",flexWrap:"wrap",alignItems:"baseline",gap:"4px 8px",fontSize:"0.875rem",color:"var(--graview-ink-muted)",borderBottom:"1px solid var(--graview-edge)",paddingBottom:8};function K({view:e,props:n,fellBack:r}){return(0,a.jsx)("div",{"data-worker-view-fallback":"",...r?{"data-worker-view-fell-back":r.name,"data-worker-view-failed":r.reason}:{},style:{display:"contents"},children:(0,a.jsx)(e,{...n})})}function de({name:e,reason:n,children:r}){return(0,a.jsx)("div",{"data-worker-view-fell-back":e,"data-worker-view-failed":n,style:{display:"contents"},children:r})}function F(e,n={}){let r=n.fallback,o=e.manifest.replaces==="page";function t(s){let l=C(),d=S(),m=(0,i.useContext)(L),[u,w]=(0,i.useState)(null),f=(0,i.useRef)(s);f.current=s;let p=q(e);if(!l)return null;if(p===null)return r&&!(m&&v(r)&&!o)?(0,a.jsx)(K,{view:r,props:s}):null;if(u&&r)return m&&v(r)&&!o?null:(0,a.jsx)(K,{view:r,props:s,fellBack:{name:e.manifest.name,reason:u}});let y=n.beside&&!(m&&v(n.beside))?n.beside:void 0,h=(0,a.jsx)(z,{definition:p,store:l.store,principal:l.principal,input:()=>ie(f.current),goTo:d,places:()=>l.views.places(),arrangement:()=>l.views.arrangement?.(),scheme:l.scheme,brand:l.brand,tick:s,drawsItsOwn:r!==void 0,onFailure:(k,V)=>{w(k),e.onFailure?.(k,V)}});return y?(0,a.jsxs)("div",{"data-worker-view-beside":e.manifest.name,style:{display:"grid",gap:12,minWidth:0},children:[h,(0,a.jsx)(y,{...s})]}):h}return t.displayName=`WorkerView(${e.manifest.name})`,t}function ce(e,n){let{manifest:r}=n;if(r.attach==="home"){if(!e.home)throw new Error(`The worker view "${r.name}" is the home's body: draw it with workerHome, on the home.`);let u=e.homes?.(),w=n.draft?void 0:u?u.filter(p=>p.name===void 0).at(-1)?.view:e.homeView?.(),f=F(n,w?{fallback:w}:{});return e.home(r.bleed===!0?A(f):f,n.draft?void 0:{name:r.name}),e}let o={cardinality:r.cardinality,fidelity:"full"},t=e.lookup(r.attach,o)??e.resolve(r.attach,o)?.view,s=r.cardinality==="one",l=n.draft===!0,d=F(n,{...t&&!l?{fallback:t}:{},...s&&r.replaces!=="page"&&t?{beside:t}:{}});r.replaces==="page"&&R(d);let m=t?.says;return s&&r.replaces!=="page"&&typeof m=="function"&&(d.says=m),r.bleed===!0&&A(d),d.flows=r.flows!==!1,r.heading==="own"&&(d.ownHeading=!0),O(d,r.scene?.maxHeight!==void 0?{maxHeight:r.scene.maxHeight}:{}),e.register(r.attach,o,d,r.title?{title:r.title,...l?{}:{name:r.name},lens:"view",...r.reads?.kinds?.length?{reads:r.reads.kinds}:{}}:l?void 0:{name:r.name}),e}function ue(e,n={}){let r=n.fallback;function o({context:t}){let s=C(),l=S(),[d,m]=(0,i.useState)(null),u=q(e);return d&&r?(0,a.jsx)(de,{name:e.manifest.name,reason:d,children:(0,a.jsx)(r,{context:t})}):u===null&&r?(0,a.jsx)(r,{context:t}):u===null?null:(0,a.jsx)(z,{definition:u,store:t.store,principal:t.principal??s?.principal??{kind:"human"},goTo:l,...s?{places:()=>s.views.places(),arrangement:()=>s.views.arrangement?.(),scheme:s.scheme,brand:s.brand}:{},drawsItsOwn:r!==void 0,onFailure:(w,f)=>{m(w),e.onFailure?.(w,f)}})}return o.displayName=`WorkerHome(${e.manifest.name})`,o}export{X as checkManifest,ae as checkViewSource,te as judgeCodeAct,Q as manifestActs,ee as readsComputed,ce as registerWorkerView,ne as sightIsTotal,Y as unreadEdges,Z as unreadEdgesSentence,oe as viewScript,ue as workerHome,F as workerView,re as workerViewProps};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as B,b as ve}from"./chunk.2TCOLAL2.js";import{a as ye,c as he,d as be,f as we}from"./chunk.3OEODIHB.js";import{b as S,c as fe,d as me,j as ce,k as ge}from"./chunk.75JQCTR6.js";import{b as pe,k as q}from"./chunk.5IEZF433.js";import{c as de,f as ue}from"./chunk.5AD2QHWH.js";import{G as Re,V as se,ea as le,h as ae,u as ie}from"./chunk.VLX7YWVH.js";import{Ma as te,Xa as re,Ya as oe,ga as Z,la as ee,ta as ne}from"./chunk.IQGSEAQ2.js";import{b as W}from"./chunk.AJZBJBMO.js";var l=W(Re(),1);var i=W(se(),1);function qe({affordance:n,onApply:a,onCancel:u,store:w}){let y=le(),s=w??y?.store,[x,_]=(0,l.useState)({}),[p,D]=(0,l.useState)(""),[I,F]=(0,l.useState)(G),[J,V]=(0,l.useState)(void 0),U=(0,l.useId)(),L=(0,l.useRef)(null),A=n.open.filter(e=>!(e.name in x)),o=A[0],v=s.allMutations().find(e=>e.name===n.mutation),P=(0,l.useMemo)(()=>De(v,s,n.args??{}),[v,s,n.args]),d=o?P[o.name]:void 0,E=ge(n.open.filter(e=>e.shape?.type==="date").map(e=>e.name)),Se=(()=>{if(!E||o?.name!==E.end||o.shape?.type!=="date")return;let e=x[E.start];if(typeof e!="string")return;let r=P[E.start];return ce(typeof r=="string"?r:void 0,e,typeof d=="string"?d:void 0,{time:o.shape.time===!0,instant:o.shape.instant===!0})})();(0,l.useEffect)(()=>{D(Se??ke(d,o?.shape)),F(Array.isArray(d)?d:G),V(d)},[o?.name]),(0,l.useEffect)(()=>{L.current?.scrollIntoView?.({block:"nearest",inline:"nearest"})},[o?.name]),(0,l.useLayoutEffect)(()=>{let e=L.current,r=typeof document>"u"?null:document.activeElement,f=r instanceof HTMLElement&&r.getAttribute("data-affordance")===n.id;if(!e||r&&r!==document.body&&!e.contains(r)&&!f)return;let b=e.querySelector('[data-testid="ask-filter"], form input, [role=group] button:not([disabled])');b&&b!==r&&b.focus()},[o?.name]);let Y=ve({flow:"both",letters:!0});if(!o)return null;let h=e=>{let r=d!==void 0&&JSON.stringify(e)===JSON.stringify(d)?void 0:e,f={...x,[o.name]:r};if(n.open.filter(R=>!(R.name in f)).length===0){let R=a(Object.fromEntries(Object.entries(f).filter(([,M])=>M!==void 0)));R&&R.length>0&&_(Object.fromEntries(Object.entries(f).filter(([M])=>!R.includes(M))))}else _(f)},O=o.optional?(0,i.jsx)("button",{type:"button",onClick:()=>h(void 0),style:{fontSize:"0.8125rem"},children:"Skip"}):null,t=o.shape??{type:"unknown"},c=t.type==="number"?t.amount:void 0,g=Ee(o,t),m=q(s.schema,v,o.name),Q=te((v?.input?.shape??{})[o.name]),xe=oe((v?.input?.shape??{})[o.name]),N=re(o.name),Ae=typeof d=="boolean"?d?"yes":"no":d,[T,Oe]=(0,l.useState)(""),X=(0,l.useMemo)(()=>{let e=g.map(r=>s.graph.getNode(r)).filter(r=>r!==void 0);return pe(e,r=>s.schema.tryDefinition(r))},[g,s]),j=e=>{let r=Ce(s,t,e),f=t.type==="choice"||t.type==="several"&&t.of.type==="choice"?m.option(e):r,b=X.get(e);return b?`${f} \xB7 ${b}`:f},$=(0,l.useMemo)(()=>{let e=T.trim().toLowerCase();return e===""?g:g.filter(r=>j(r).toLowerCase().includes(e))},[g,T,s,t,X]),k=t.type==="several",H=t.type==="file"?t:t.type==="several"&&t.of.type==="file"?t.of:void 0,K=k&&g.length===0,C=o.kinds&&o.kinds.length>0&&!o.kinds.includes("*")?o.kinds.map(e=>Z(ne(s.schema.tryDefinition(e),e))).join(" or "):m.label,Ne=n.open.length>1?`${C} \xB7 ${n.open.length-A.length+1} of ${n.open.length}`:C;return(0,i.jsxs)("div",{ref:L,"data-graview-asking":n.id,style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr)",gap:4,padding:"5px 0 2px"},children:[n.open.length>1||g.length>0?(0,i.jsx)("span",{id:U,style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)"},children:Ne}):null,g.length>z?(0,i.jsx)("input",{type:"search",value:T,onChange:e=>Oe(e.target.value),placeholder:`Filter ${g.length}\u2026`,"aria-label":`Filter ${C}`,"data-testid":"ask-filter",onKeyDown:e=>{if(e.key!=="ArrowDown"||e.metaKey||e.ctrlKey||e.altKey)return;let r=Y.ref.current?.querySelector(`[${B}][tabindex="0"]`);r&&(e.preventDefault(),r.focus())},style:{font:"inherit",fontSize:"0.8125rem",minWidth:0,padding:"3px 7px"}}):null,xe?(0,i.jsxs)("form",{style:{display:"grid",gap:4},onSubmit:e=>{e.preventDefault(),h(J??(d===void 0?void 0:null))},children:[(0,i.jsx)(be,{value:J,onChange:V,start:N?x[N]??P[N]:void 0,label:`${N?q(s.schema,v,N).label:m.label} repeats`,name:o.name}),(0,i.jsxs)("span",{style:{display:"flex",gap:4},children:[(0,i.jsx)("button",{type:"submit",style:{fontSize:"0.8125rem"},children:A.length>1?"Next":"Apply"}),O]})]}):Q?(0,i.jsxs)("div",{style:{display:"grid",gap:4},children:[(0,i.jsx)(he,{relation:Q,value:d,onChange:h,label:m.label}),O]}):H?(0,i.jsxs)("div",{style:{display:"grid",gap:4},children:[(0,i.jsx)(ye,{as:"control",value:d,onChange:h,several:k,image:H.image===!0,video:H.video===!0,label:m.label}),O]}):g.length>0?(0,i.jsxs)("div",{...Y,role:"group","aria-labelledby":U,style:{display:"flex",flexWrap:"wrap",gap:4},children:[$.slice(0,z).map(e=>{let r=k?I.includes(e):e===Ae;return(0,i.jsx)("button",{type:"button",[B]:"","aria-label":`${C}: ${j(e)}`,...k?{"aria-pressed":r}:r?{"aria-current":!0}:{},style:{padding:"3px 9px",fontSize:"0.8125rem",...r?{borderColor:"var(--graview-accent)",color:"var(--graview-accent)"}:{}},onClick:()=>k?F(f=>f.includes(e)?f.filter(b=>b!==e):[...f,e]):h(t.type==="boolean"?e==="yes":e),children:j(e)},e)}),$.length>z?(0,i.jsxs)("span",{"data-testid":"ask-more",style:{alignSelf:"center",fontSize:"0.75rem",color:"var(--graview-ink-faint)"},children:[$.length-z," more \u2014 type to narrow"]}):null,$.length===0?(0,i.jsxs)("span",{"data-testid":"ask-none",style:{alignSelf:"center",fontSize:"0.75rem",color:"var(--graview-ink-faint)"},children:["None of the ",g.length," match that."]}):null,k?(0,i.jsx)("button",{type:"button",disabled:I.length===0,style:{fontSize:"0.8125rem"},onClick:()=>{let e=I;F(G),h(e)},children:A.length>1?"Next":"Apply"}):null,O]}):(0,i.jsxs)("form",{style:{display:"flex",flexWrap:"wrap",gap:4},onSubmit:e=>{if(e.preventDefault(),d!==void 0&&p===ke(d,t)){h(void 0);return}if(K){h(p.split(/[,\n]/).map(r=>r.trim()).filter(Boolean));return}if(p.trim().length!==0){if(c){let r=me(p,c);r!==void 0&&h(r);return}h(t.type==="number"?t.duration?ue(p)??p:Number(p):p)}},children:[t.type==="text"&&t.long?(0,i.jsx)("textarea",{autoFocus:!0,name:o.name,"aria-label":m.label,placeholder:m.label,value:p,rows:4,onChange:e=>D(e.target.value),onKeyDown:e=>{e.key==="Escape"?u():e.key==="Enter"&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())},style:{flex:"1 1 100%",minWidth:0,font:"inherit",fontSize:"0.875rem",lineHeight:1.45,padding:"5px 8px",borderRadius:7,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)",color:"var(--graview-ink)",resize:"vertical",fieldSizing:"content",minHeight:"5.5em",maxHeight:"40vh"}}):t.type==="date"?(0,i.jsx)(we,{autoFocus:!0,name:o.name,label:m.label,value:p===""?void 0:p,time:t.time===!0,instant:t.instant===!0,partial:t.partial===!0,onChange:e=>D(e??""),onCancel:u,boxStyle:{fontSize:"0.875rem",padding:"5px 8px",borderRadius:7,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)",color:"var(--graview-ink)"}}):(0,i.jsx)("input",{autoFocus:!0,type:t.type==="number"&&!t.duration&&!c?"number":t.type==="text"&&t.holds==="phone"?"tel":"text",...c?{inputMode:"decimal","data-graview-amount":c.format??"unit"}:{},name:o.name,"aria-label":m.label,placeholder:K?`${m.label}, separated by commas`:c?`${m.label}, ${S(c).hint} \u2014 ${S(c).prefix??""}${S(c).placeholder}${S(c).suffix?` ${S(c).suffix}`:""}`:m.label,value:p,...t.type==="number"&&t.min!==void 0?{min:t.min}:{},...t.type==="number"&&t.max!==void 0?{max:t.max}:{},...t.type==="number"&&t.step!==void 0?{step:t.step}:{},onChange:e=>D(e.target.value),onKeyDown:e=>{e.key==="Escape"&&u()},style:{flex:1,minWidth:0,font:"inherit",fontSize:"0.875rem",padding:"5px 8px",borderRadius:7,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)",color:"var(--graview-ink)"}}),(0,i.jsx)("button",{type:"submit",disabled:!K&&p.trim().length===0,style:{fontSize:"0.8125rem"},children:A.length>1?"Next":"Apply"}),O]})]})}var G=[];function De(n,a,u){let w=n?.derived?.act==="edit"&&n.subject?u[n.subject.arg]:void 0,y=typeof w=="string"?a.graph.getNode(w):void 0;return y?Object.fromEntries((n.writes??[]).filter(s=>y[s]!==void 0&&y[s]!==null).map(s=>[s,y[s]])):{}}function ke(n,a){return typeof n=="number"?a?.type==="number"&&a.amount?fe(n,a.amount):String(n):Array.isArray(n)?n.every(u=>typeof u=="string")?n.join(", "):"":typeof n!="string"?"":n}var z=10;function Ee(n,a){return n.candidates&&n.candidates.length>0?n.candidates:a.type==="choice"?a.options:a.type==="several"&&a.of.type==="choice"?a.of.options:a.type==="boolean"?$e:[]}var $e=["yes","no"];function Ce(n,a,u){return a.type==="boolean"||a.type==="choice"||a.type==="several"&&a.of.type==="choice"?u:ze(n,u)}function ze(n,a){let u=ae(a);if(u){let s=de(n.schema,n.graph.getNode(u.from)?.kind??"",u.kind,"out");return s.charAt(0).toUpperCase()+s.slice(1)}let w=ie(a);if(w.length>0)return w.map(s=>n.schema.tryDefinition(s)?.plural??`${s}s`).join(" + ");let y=n.graph.getNode(a);return y?ee(n.schema.tryDefinition(y.kind),y):a}export{qe as a,ze as b};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{e as $,g as F,h as P,i as B,l as K,m as H}from"./chunk.75JQCTR6.js";import"./chunk.5IEZF433.js";import"./chunk.5AD2QHWH.js";import"./chunk.3FKKH2XU.js";import"./chunk.DLWFULWE.js";import{G as se,Ka as A,V as S}from"./chunk.VLX7YWVH.js";import{a as q}from"./chunk.SDO3U72B.js";import"./chunk.IQGSEAQ2.js";import"./chunk.FQLNBIQ5.js";import{b as T}from"./chunk.AJZBJBMO.js";var r=T(se(),1);var j=T(S(),1),Z=A(q(()=>(__graviewPreload(import.meta.url,["./chunk.3FKKH2XU.js","./chunk.DLWFULWE.js","./chunk.VLX7YWVH.js","./chunk.SDO3U72B.js","./chunk.IQGSEAQ2.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.P6FNJR6E.js")))),U={Part:Z.part((n,t)=>(0,j.jsx)(n.WhenMonth,{...t}),{quiet:!0}),prefetch:()=>Z.prefetch()};var o=T(S(),1),E="try \u201Ctomorrow 3pm\u201D, \u201CFri 10:30\u201D or \u201C17 Oct\u201D";function _(n,t,i,b=!1){let y=Date.UTC(+n.day.slice(0,4),+n.day.slice(5,7)-1,+n.day.slice(8,10),0,t?n.minutes??0:0),x={weekday:b?"long":"short",year:"numeric",month:b?"long":"short",day:"numeric",...t?{hour:"numeric",minute:"2-digit"}:{},timeZone:"UTC"},h;try{h=new Intl.DateTimeFormat(i??"en-US",x)}catch{h=new Intl.DateTimeFormat("en-US",x)}return h.format(y).replace(/ /g," ")}function V(n,t){if(n.length===4)return n;let i=Date.UTC(+n.slice(0,4),+n.slice(5,7)-1,1);try{return new Intl.DateTimeFormat(t??"en-US",{month:"long",year:"numeric",timeZone:"UTC"}).format(i)}catch{return new Intl.DateTimeFormat("en-US",{month:"long",year:"numeric",timeZone:"UTC"}).format(i)}}function me({value:n,time:t,instant:i=!1,partial:b=!1,label:y,name:x,required:h,autoFocus:G,autoSelect:N,locale:s,onChange:J,onLeave:Q,onCancel:X,inputRef:W,boxStyle:Y}){let k=(0,r.useId)(),p=(0,r.useRef)(null),O=(0,r.useRef)(null),I=e=>b&&!t&&e!==void 0?K(e):void 0,C=e=>{let a=I(e);if(a!==void 0)return V(a,s);let l=F(e);return l?_(l,t,s):e??""},[g,D]=(0,r.useState)(()=>C(n)),[R,w]=(0,r.useState)(!1),[ee,L]=(0,r.useState)(n),[ne,te]=(0,r.useState)(n);n!==ne&&(te(n),n!==ee&&(L(n),D(C(n)))),(0,r.useEffect)(()=>{N&&(p.current?.focus(),p.current?.select())},[N]);let d=t&&i?B(s):void 0,M=g===C(n),u=F(n),c=I(M?n:g),f=c!==void 0?void 0:M?u:H(g,{today:$().day,time:t,...u?{base:u}:{},...s?{locale:s}:{}}),re=M?n:c!==void 0?c:f?P(f,{time:t,instant:i}):void 0,v=g.trim()==="",m=!v&&f===void 0&&c===void 0;(0,r.useEffect)(()=>{p.current?.setCustomValidity(m?`Not a date this reads \u2014 ${E}`:"")},[m]);let z=e=>{L(e),J(e)},oe=e=>{D(e);let a=I(e);if(a!==void 0)return z(a);let l=e.trim()===""?void 0:H(e,{today:$().day,time:t,...u?{base:u}:{},...s?{locale:s}:{}});z(l?P(l,{time:t,instant:i}):void 0)},ae=e=>{let a=t?{day:e,minutes:f?.minutes??u?.minutes??540}:{day:e},l=P(a,{time:t,instant:i});D(C(l)),z(l),w(!1),requestAnimationFrame(()=>{p.current?.focus(),p.current?.select()})},ie=v?`Type a date, or pick one \u2014 ${E}`:m?`Not a date this reads \u2014 ${E}`:c!==void 0?`${V(c,s)} (${c.length===4?"a year":"a month"} alone)`:f?`${_(f,t,s,!0)}${d?` ${d.short}`:""}`:"";return(0,o.jsxs)("span",{"data-graview-when":t?i?"instant":"moment":"day",style:{display:"inline-flex",flex:"1 1 14rem",flexWrap:"wrap",alignItems:"center",gap:"4px 6px",maxWidth:"100%",minWidth:0},onBlur:e=>{let a=e.relatedTarget;a&&e.currentTarget.contains(a)||!a&&typeof document<"u"&&!document.hasFocus()||(w(!1),Q?.(re))},children:[(0,o.jsx)("input",{ref:e=>{p.current=e,typeof W=="function"?W(e):W&&(W.current=e)},type:"text",name:x,required:h,autoFocus:G,"aria-label":y,"aria-describedby":`${k}-said`,"aria-invalid":m||void 0,autoComplete:"off",spellCheck:!1,enterKeyHint:"done",placeholder:t?"tomorrow 3pm":"17 Oct",value:g,"data-graview-part":"control",onChange:e=>oe(e.target.value),onKeyDown:e=>{e.key==="Escape"?(e.preventDefault(),X?.()):e.key==="ArrowDown"&&e.altKey&&(e.preventDefault(),w(!0))},style:{flex:"1 1 12ch",minWidth:"10ch",maxWidth:"100%",boxSizing:"border-box",font:"inherit",...Y}}),(0,o.jsx)("button",{ref:O,type:"button","aria-label":`Pick a date for ${y}`,"aria-expanded":R,"aria-controls":`${k}-month`,"data-graview-part":"when-pick",onClick:()=>w(e=>!e),onPointerEnter:()=>U.prefetch(),style:{display:"inline-flex",alignItems:"center",justifyContent:"center",minWidth:32,minHeight:32,padding:0,borderRadius:6},children:(0,o.jsxs)("svg",{"aria-hidden":"true",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.4",children:[(0,o.jsx)("rect",{x:"2",y:"3",width:"12",height:"11",rx:"1.5"}),(0,o.jsx)("path",{d:"M2 6.5h12M5.5 1.5v3M10.5 1.5v3"})]})}),(0,o.jsxs)("span",{id:`${k}-said`,"aria-live":"polite","data-graview-part":"when-said",...d?{"data-graview-zone":d.zone,title:`Times are in ${d.zone.replace(/_/g," ")} (${d.short})`}:{},style:{flexBasis:"100%",fontSize:"0.75rem",color:m?"var(--graview-bad)":"var(--graview-ink-faint)"},children:[ie,d&&!m&&!v?(0,o.jsx)("span",{"data-graview-part":"when-zone",children:` \xB7 ${(d.zone.split("/").at(-1)??d.zone).replace(/_/g," ")} time`}):null]}),R?(0,o.jsx)(r.Suspense,{fallback:null,children:(0,o.jsx)(U.Part,{id:`${k}-month`,label:y,selected:f?.day??u?.day,today:$().day,locale:s,onPick:ae,onClose:()=>{w(!1),O.current?.focus()}})}):null]})}export{me as WhenInput,_ as wallAsRead};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a,b,c,d,e,f,g,h,i,j,k}from"./chunk.DJIF7IAQ.js";import"./chunk.HZPRMHSL.js";import"./chunk.G7YLK4PX.js";import"./chunk.ZA5TDCBC.js";import"./chunk.2JEN2RCB.js";import"./chunk.7CLKGKSF.js";import"./chunk.TMHVYI5R.js";import"./chunk.R5MLRKAO.js";import"./chunk.YMXWS4XN.js";import"./chunk.5IEZF433.js";import"./chunk.5AD2QHWH.js";import"./chunk.IQGSEAQ2.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";export{g as columnActs,d as columnChoices,c as columnMoves,b as columnOf,e as columnReach,f as columnSteps,j as describePlace,k as placeText,h as resolveFor,i as shadowedPageSlots,a as statusColumns};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};function s(e){let t=[];return typeof e!="string"?["A view's source is text."]:(/\bimport\b/.test(e)&&t.push("It says import: a view loads nothing, so the word may not appear in it at all, even in a string or a comment."),/\bimportScripts\b/.test(e)&&t.push("It names importScripts: a view loads nothing."),/^\s*export\b/m.test(e)&&t.push("It exports something: a view is a plain script that draws through the graview global, not a module."),/\brequire\s*\(/.test(e)&&t.push("It calls require(): a view has no modules to require."),t)}var i,n=()=>i??=(__graviewPreload(import.meta.url,["./chunk.AJZBJBMO.js"]),import("./chunk.CXDGE5ZS.js")).catch(e=>{throw i=void 0,e});async function p(e){let{VIEW_RUNTIME:t}=await n();return`${t}
|
|
2
|
-
;(function () {
|
|
3
|
-
"use strict";
|
|
4
|
-
${e}
|
|
5
|
-
})();
|
|
6
|
-
`}var r=new WeakMap;function w(e){let t=r.get(e);return t||(t=Promise.resolve().then(e).catch(o=>{throw r.delete(e),o}),r.set(e,t)),t}export{s as a,p as b,w as c};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{a as gt,b as kt,c as xt,d as St,e as Tt,f as Mt,g as Et}from"./chunk.WX23K7ZU.js";import{a as ke,e as mt}from"./chunk.BBLIT7S7.js";import{a as bt,b as Te,c as Rt}from"./chunk.NJSK3UO2.js";import{a as ut,f as ct,g as pt,i as ft}from"./chunk.T4JP6BGP.js";import"./chunk.7SRSE5IS.js";import{j as yt}from"./chunk.3L37FY3G.js";import{e as vt}from"./chunk.NGRL3QOI.js";import"./chunk.B3WVCSW5.js";import{c as ht,f as wt,i as xe,j as Se}from"./chunk.DN7UCBOA.js";import{b as ae,e as de}from"./chunk.DMENNIHT.js";import"./chunk.HZPRMHSL.js";import{a as U}from"./chunk.SDO3U72B.js";import"./chunk.IQGSEAQ2.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";var Kt=["good","warn","bad","neutral","accent"],Gt=["value","max","aria-label","placeholder","disabled"],At=["click","change"],Me=["_blank","_self"],Wt=["section","div","span","strong","p","hr","a","button","input","progress"],le={type:{oneOf:Kt}},Ee={"gv-card":{host:"section",properties:{tone:le},events:{},children:"any"},"gv-group":{host:"div",properties:{direction:{type:{oneOf:["row","column"]}}},events:{},children:"any"},"gv-title":{host:"strong",properties:{},events:{},children:"text"},"gv-text":{host:"p",properties:{tone:le},events:{},children:"text"},"gv-badge":{host:"span",properties:{tone:le},events:{},children:"text"},"gv-field":{host:"div",properties:{label:{type:"string"}},events:{},children:"text"},"gv-progress":{host:"progress",properties:{value:{type:"number",as:"value"},max:{type:"number",as:"max"},label:{type:"string",as:"aria-label"}},events:{},children:"none"},"gv-divider":{host:"hr",properties:{},events:{},children:"none"},"gv-link":{host:"a",properties:{href:{type:"url"}},events:{},children:"text"},"gv-button":{host:"button",properties:{tone:le,disabled:{type:"boolean",as:"disabled"}},events:{press:{from:"click"}},children:"text"},"gv-input":{host:"input",properties:{label:{type:"string",as:"aria-label"},value:{type:"string",as:"value"},placeholder:{type:"string",as:"placeholder"}},events:{change:{from:"change",detail:"value"}},children:"none"}},Re=1e4;var rr=0,nr=1,or=2,sr=3,Ot=1,ir=2,ar=3,dr=1,lr=3,ur=8,Ke="~",Ge=(r,e)=>Object.prototype.hasOwnProperty.call(r,e),Z=r=>typeof r=="object"&&r!==null&&!Array.isArray(r);function _t(r,e){return e.type==="url"?"href":e.as??`data-gv-${r.toLowerCase()}`}var cr=2e3;function Lt(r,e){if(e==null)return{ok:!0,value:null};let a=r.type;if(a==="boolean")return typeof e=="boolean"?{ok:!0,value:e}:{ok:!1,reason:"value"};if(a==="number")return typeof e=="number"&&Number.isFinite(e)?{ok:!0,value:String(e)}:{ok:!1,reason:"value"};if(typeof e!="string"||e.length>cr)return{ok:!1,reason:a==="url"?"url":"value"};if(typeof a=="object")return a.oneOf.includes(e)?{ok:!0,value:e}:{ok:!1,reason:"value"};if(a==="url"){let p;try{p=new URL(e)}catch{return{ok:!1,reason:"url"}}return p.protocol!=="https:"||p.hostname===""||!/^https:\/\//i.test(e)?{ok:!1,reason:"url"}:{ok:!0,value:p.href}}return{ok:!0,value:e}}function pr(r){let e=r.host==="a";return Wt.includes(r.host)&&(r.target===void 0||e&&Me.includes(r.target))&&Object.values(r.properties).every(a=>a.type!=="url"||e)&&Object.values(r.properties).every(a=>a.as===void 0||a.type!=="url"&&Gt.includes(a.as))&&Object.values(r.events).every(a=>At.includes(a.from))}function Ae(r,e){let a=e.kit??Ee,p=e.maxNodes??2e3,o=r.ownerDocument,f=[],y=new Map,A={dom:r,name:Ke,component:{host:"div",properties:{},events:{},children:"any"},children:[],listeners:new Map,id:Ke};y.set(Ke,A);let W=e.links?new Set(e.links.origins.flatMap(n=>{try{let c=new URL(n);return c.protocol==="https:"&&c.hostname!==""?[c.origin]:[]}catch{return[]}})):void 0,P=0,M=0,D=!1,g=n=>{f.push(n),f.length>200&&f.shift()},x=()=>({dom:o.createComment(""),children:[],refused:!0,listeners:new Map}),L=(n,c,m)=>{let h=n.component;if(!Ge(h.properties,c))return g({reason:"property",element:n.name,name:c});let d=h.properties[c],i=Lt(d,m),w=i.ok&&d.type==="url"&&W&&typeof i.value=="string"&&!W.has(new URL(i.value).origin)?{ok:!1,reason:"url"}:i,E=n.dom,T=_t(c,d);if(!w.ok)return E.removeAttribute(T),g({reason:w.reason,element:n.name,name:c});let R=w.value;R===null||R===!1?E.removeAttribute(T):E.setAttribute(T,R===!0?"":R),T==="value"&&"value"in E&&(E.value=typeof R=="string"?R:""),T==="disabled"&&"disabled"in E&&(E.disabled=R!==null&&R!==!1)},b=(n,c,m)=>{let h=n.component;if(!Ge(h.events,c))return g({reason:"event",element:n.name,name:c});let d=n.listeners.get(c);if(d&&(d(),n.listeners.delete(c),M-=1),m==null)return;if(!Z(m)||typeof m.listener!="number")return g({reason:"value",element:n.name,name:c});let i=m.listener,w=h.events[c],E=n.dom,T=()=>e.onEvent(i,w.detail==="value"?String(E.value??""):void 0);E.addEventListener(w.from,T),n.listeners.set(c,()=>E.removeEventListener(w.from,T)),M+=1},S=n=>{if(!n.refused){P-=1,n.id!==void 0&&y.delete(n.id);for(let c of n.listeners.values())c();M-=n.listeners.size,n.listeners.clear();for(let c of n.children)S(c)}},k=(n,c)=>{if(!Z(n)||typeof n.id!="string"||y.has(n.id))return g({reason:"record"}),x();if(P>=p)return g({reason:"budget"}),D||(D=!0,e.onOverBudget?.()),x();let m=n.id,h=c.component.children;if(n.type===ur)return x();if(n.type===lr){if(h==="none")return g({reason:"child",element:c.name}),x();let T={dom:o.createTextNode(String(n.data??"").slice(0,Re)),children:[],text:!0,listeners:new Map,id:m};return y.set(m,T),P+=1,T}if(n.type!==dr)return g({reason:"record"}),x();let d=String(n.element);if(!Ge(a,d)||!pr(a[d]))return g({reason:"element",element:d}),x();if(h!=="any")return g({reason:"child",element:d}),x();let i=a[d],w=o.createElement(i.host);w.setAttribute("data-gv",d.replace(/^gv-/,"")),w.className=`graview-guest-${d.replace(/^gv-/,"")}`,i.host==="a"&&(w.setAttribute("rel","noopener noreferrer"),w.setAttribute("target",i.target??"_blank"),w.setAttribute("referrerpolicy","no-referrer")),i.host==="button"&&w.setAttribute("type","button");let E={dom:w,name:d,component:i,children:[],listeners:new Map,id:m};if(y.set(m,E),P+=1,Z(n.properties))for(let[T,R]of Object.entries(n.properties))L(E,T,R);if(Z(n.attributes))for(let T of Object.keys(n.attributes))g({reason:"attribute",element:d,name:T});if(Z(n.eventListeners))for(let[T,R]of Object.entries(n.eventListeners))b(E,T,R);if(Array.isArray(n.children))for(let T of n.children){let R=k(T,E);E.children.push(R),w.appendChild(R.dom)}return E},G=n=>{if(!Array.isArray(n))return g({reason:"record"});let[c,m]=n,h=typeof m=="string"?y.get(m):void 0;if(!h)return g({reason:"record"});switch(c){case rr:{if(h.text)return g({reason:"record"});let d=Number(n[3]),i=Number.isInteger(d)&&d>=0&&d<=h.children.length?d:h.children.length,w=k(n[2],h);h.dom.insertBefore(w.dom,h.children[i]?.dom??null),h.children.splice(i,0,w);return}case nr:{let d=Number(n[2]),i=h.children[d];if(!i)return g({reason:"record"});h.children.splice(d,1),i.dom.parentNode?.removeChild(i.dom),S(i);return}case or:if(!h.text)return g({reason:"record"});h.dom.data=String(n[2]??"").slice(0,Re);return;case sr:{if(h===A||h.text)return g({reason:"record"});let d=String(n[2]),i=n[4]??Ot;return i===Ot?L(h,d,n[3]):i===ar?b(h,d,n[3]):g(i===ir?{reason:"attribute",element:h.name,name:d}:{reason:"record"})}default:return g({reason:"record"})}};return{apply(n,c){if(!Array.isArray(n))return g({reason:"record"}),!0;for(let m=0;m<n.length;m+=1){if(c&&m%32===0&&c())return!1;G(n[m])}return!0},get refused(){return f},get size(){return P},get listening(){return M},dispose(){for(let n of A.children)S(n);A.children.length=0,r.replaceChildren()}}}var We=`
|
|
2
|
-
.graview-guest { display: flex; flex-direction: column; gap: 8px; min-width: 0; color: var(--graview-ink, inherit); font: inherit; }
|
|
3
|
-
.graview-guest-card { display: flex; flex-direction: column; gap: 6px; padding: 12px; border: 1px solid var(--graview-edge, #d0d0d0); border-radius: 10px; background: var(--graview-panel, transparent); }
|
|
4
|
-
.graview-guest-group { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
|
|
5
|
-
.graview-guest-group[data-gv-direction="row"] { flex-direction: row; flex-wrap: wrap; align-items: center; }
|
|
6
|
-
.graview-guest-title { font-weight: 600; font-size: 1rem; overflow-wrap: anywhere; }
|
|
7
|
-
.graview-guest-text { margin: 0; font-size: 0.875rem; line-height: 1.45; overflow-wrap: anywhere; }
|
|
8
|
-
.graview-guest-badge { align-self: flex-start; padding: 1px 8px; border: 1px solid currentColor; border-radius: 999px; font-size: 0.8125rem; font-weight: 600; }
|
|
9
|
-
.graview-guest-field { font-size: 0.875rem; overflow-wrap: anywhere; }
|
|
10
|
-
.graview-guest-field[data-gv-label]::before { content: attr(data-gv-label) " "; color: var(--graview-ink-muted, inherit); }
|
|
11
|
-
.graview-guest-progress { width: 100%; }
|
|
12
|
-
.graview-guest-divider { width: 100%; margin: 2px 0; border: 0; border-top: 1px solid var(--graview-edge, #d0d0d0); }
|
|
13
|
-
.graview-guest-link { color: var(--graview-accent, inherit); text-decoration: underline; }
|
|
14
|
-
.graview-guest-button { align-self: flex-start; font: inherit; padding: 4px 12px; border-radius: 8px; border: 1px solid var(--graview-edge, #d0d0d0); background: var(--graview-panel, transparent); color: inherit; cursor: pointer; }
|
|
15
|
-
.graview-guest-input { font: inherit; padding: 4px 8px; border-radius: 6px; border: 1px solid var(--graview-edge, #d0d0d0); }
|
|
16
|
-
.graview-guest [data-gv-tone="good"] { color: var(--graview-good, inherit); }
|
|
17
|
-
.graview-guest [data-gv-tone="bad"] { color: var(--graview-bad, inherit); }
|
|
18
|
-
.graview-guest [data-gv-tone="warn"] { color: var(--graview-warn, inherit); }
|
|
19
|
-
.graview-guest [data-gv-tone="accent"] { color: var(--graview-accent, inherit); }
|
|
20
|
-
.graview-guest [data-gv-tone="neutral"] { color: var(--graview-ink-muted, inherit); }
|
|
21
|
-
`;var It=new WeakSet;function fr(r,e){if(r.startsWith("blob:"))return"blob:";try{return new URL(r,e.location.href).origin}catch{return r}}function Pt(r,e,a){let p=fr(e,r),o=`this page's Content-Security-Policy${a?` (${a})`:""} does not allow a worker from ${p}: it needs worker-src ${p}`;return It.has(r)||(It.add(r),r.console?.warn?.(`Graview: worker views cannot start on this page, because ${o}. A host that will not allow ${p} serves each view's whole script from its own origin and passes worker: { url } (the @graview/guest README, "What the host page allows").`)),o}function mr(r,e){return r===""?!0:e.startsWith("blob:")?r.startsWith("blob"):e.startsWith(r)||r.startsWith(e)}function ue(r,e){let a="script"in e.source?r.URL.createObjectURL(new r.Blob([e.source.script],{type:"text/javascript"})):void 0,p="script"in e.source?a:e.source.url,o,f,y=!1,A=!1,W=0,P=0,M="",D=0,g=0,x=r.performance,L=x.now(),b,S=d=>{let i=d,w=String(i.effectiveDirective||i.violatedDirective||"").split(" ")[0];/^(worker-src|script-src|script-src-elem|child-src|default-src)$/.test(w)&&mr(String(i.blockedURI??""),p)&&(b=w)},k=r.document;k?.addEventListener("securitypolicyviolation",S);let G=()=>k?.removeEventListener("securitypolicyviolation",S),n=()=>{A||(A=!0,f?.close(),o?.terminate(),o=void 0,r.clearTimeout(W),r.clearInterval(P),G(),a&&r.URL.revokeObjectURL(a))},c=(d,i)=>{A||(n(),e.onStop(d,i))},m=()=>{r.clearTimeout(W),G(),M=gt();let d=new r.MessageChannel;f=d.port1;let i=Math.max(1,e.silentMs),w=Math.max(10,Math.min(1e3,Math.floor(i/4)));L=x.now();let E=L;P=r.setInterval(()=>{let R=x.now();if(R-E>w*2&&(L+=R-E-w),E=R,R-L>=i)return c("silent");D+=1,d.port1.postMessage({type:"heartbeat",beat:D})},w);let T={graview:"host-hello",protocol:1,nonce:M,view:e.name};o.postMessage(T,[d.port2]),e.onReady(M,d.port1,x.now()-h)},h=x.now();try{o=new r.Worker(p,{name:e.name})}catch(d){o=void 0;let i=d,w=i?.name==="SecurityError"?Pt(r,p,b):`the worker could not be made: ${String(i?.message??d)}`;queueMicrotask(()=>c("start",w))}return o&&(W=r.setTimeout(()=>c("start",`it never said it was ready in ${e.readyMs.toLocaleString("en-US")} ms`),e.readyMs),o.onerror=d=>{let i=typeof d.message=="string"&&d.message!==""?d.message:void 0;if(y)return void e.onError?.(i??"an error");r.clearTimeout(W),r.setTimeout(()=>!y&&c("start",b?Pt(r,p,b):i?`it failed before it said ready: ${i}`:"it failed before it said ready, and the engine gave no reason (a page policy that refuses it, or a script that does not load)"),0)},o.onmessage=d=>{if(!e.limiter.message()||y||!mt(d.data)||d.data.protocol!==1){e.onDropped();return}y=!0,m()}),{get worker(){return o},answer(d){let i=d;return typeof i!="object"||i===null||i.type!=="heartbeat"||i.nonce!==M?!1:(typeof i.beat=="number"&&i.beat>g&&i.beat<=D&&(g=i.beat,L=x.now()),!0)},stop:n}}function ce(r,e){let a=e(),p=0;return{draw(o){let f=e();f-a>=1e3&&(a=f,p=0);let y=r(),A=o(()=>p+(e()-f)>=y);return p+=e()-f,A&&p<y}}}var gr=Symbol.for("graview.view.clicked");function Nt(r,e){r[gr]=Object.freeze([...e])}function Vt(r){return!Number.isFinite(r)||r<=60?1:Math.min(4,Math.round(r/60*10)/10)}function Dt(r,e){return{...r,pushMs:Math.round(r.pushMs*e),drawMs:Math.round(r.drawMs*e)}}var Ct=new WeakMap;function Ht(r,e){let a=Ct.get(r);return a!==void 0?a:(Ct.set(r,e),e)}var yr=U(()=>(__graviewPreload(import.meta.url,["./chunk.3L37FY3G.js","./chunk.AJZBJBMO.js"]),import("./chunk.DVSTLVIH.js"))),hr=U(()=>(__graviewPreload(import.meta.url,["./chunk.NGRL3QOI.js","./chunk.B3WVCSW5.js","./chunk.DN7UCBOA.js","./chunk.DMENNIHT.js","./chunk.IQGSEAQ2.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.TYIBLD2D.js"))),wr=U(()=>(__graviewPreload(import.meta.url,["./chunk.AJZBJBMO.js"]),import("./chunk.K2HDEL7I.js"))),vr=U(()=>(__graviewPreload(import.meta.url,["./chunk.WVUJXDXZ.js","./chunk.ZA5TDCBC.js","./chunk.2JEN2RCB.js","./chunk.7CLKGKSF.js","./chunk.TMHVYI5R.js","./chunk.R5MLRKAO.js","./chunk.YMXWS4XN.js","./chunk.5AD2QHWH.js","./chunk.IQGSEAQ2.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.WMARJ5E3.js"))),br=U(()=>(__graviewPreload(import.meta.url,["./chunk.DN7UCBOA.js","./chunk.DMENNIHT.js","./chunk.IQGSEAQ2.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.OW3M4OBN.js"))),kr=U(()=>(__graviewPreload(import.meta.url,["./chunk.BBLIT7S7.js","./chunk.AJZBJBMO.js"]),import("./chunk.RRCPEHM4.js"))),xr=U(()=>(__graviewPreload(import.meta.url,["./chunk.WVUJXDXZ.js","./chunk.ZA5TDCBC.js","./chunk.2JEN2RCB.js","./chunk.7CLKGKSF.js","./chunk.TMHVYI5R.js","./chunk.R5MLRKAO.js","./chunk.YMXWS4XN.js","./chunk.5AD2QHWH.js","./chunk.IQGSEAQ2.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.5HJ2GTKZ.js")));function Sr(r,e,a){switch(r){case"manifest":return a??"Its manifest names something this app does not have.";case"source":return a??`Its code is longer than the ${e.maxSourceBytes.toLocaleString("en-US")} bytes a view may be.`;case"start":return`It could not start${a?`: ${a}.`:"."}`;case"error":return`It failed before it drew anything${a?`: ${a}`:"."}`;case"silent":return`It stopped answering for ${e.silentMs.toLocaleString("en-US")} ms.`;case"nodes":return`It drew more than the ${e.maxNodes.toLocaleString("en-US")} things a view may draw.`;case"flood":return`It sent more than ${e.messages} messages in ${e.messageWindowMs.toLocaleString("en-US")} ms.`;case"slow":return`It took longer than ${e.pushMs.toLocaleString("en-US")} ms to draw what it was shown.`}}function Tr(r,e){let a=r.ownerDocument,p=a.defaultView,{manifest:o}=e,f=a.createElement("div");f.className="graview-worker-view",f.setAttribute("role","region"),f.setAttribute("aria-label",o.title??o.name),f.setAttribute("data-worker-view",o.name),f.style.cssText="display:block;position:relative;contain:layout paint style;isolation:isolate;overflow:clip;min-width:0",r.appendChild(f);let y=f.attachShadow({mode:"open"}),A=e.author?a.createElement("p"):void 0;A&&(A.className="graview-worker-view-author",A.setAttribute("data-worker-view-author",o.name),A.style.cssText="margin:4px 0 0;font-size:0.75rem;color:var(--graview-ink-muted, inherit)",A.textContent=e.author,r.appendChild(A));let W={applied:0,refused:0,dropped:0},P=ae(e.limits),M={maxSourceBytes:e.limits?.maxSourceBytes??256e3,maxNodes:e.limits?.maxNodes??5e3,messages:e.limits?.messages??120,messageWindowMs:e.limits?.messageWindowMs??1e3,pushMs:e.limits?.pushMs??1e3,silentMs:e.limits?.silentMs??5e3,drawMs:e.limits?.drawMs??100},D={pushMs:M.pushMs,drawMs:M.drawMs},g,x,L,b,S,k,G=!1,n={applied:0,refused:0,dropped:0},c=[],m=()=>{if(!b)return;let t=b.stats;W.applied+=t.applied-n.applied,W.refused+=t.refused-n.refused,W.dropped+=t.dropped-n.dropped,n={...t}},h=()=>{},d,i,w=()=>{let t=y.querySelector("[data-graview-view-root]"),s=p.ResizeObserver;i||!t||typeof s!="function"||(i=new s(v=>{let K=v[v.length-1]?.borderBoxSize?.[0],_=Math.ceil(K?K.blockSize:t.offsetHeight);_!==d&&(d=_,f.setAttribute("data-graview-content-height",String(_)),e.onContentHeight?.(_))}),i.observe(t))},E=()=>{i&&(i.disconnect(),i=void 0,d=void 0,f.removeAttribute("data-graview-content-height"),e.onContentHeight?.(void 0))},T=0,R=()=>{},Oe=()=>{R(),R=()=>{},m(),b?.dispose(),b=void 0,S?.stop(),h(),p.clearInterval(T)},C=(t,s)=>{if(G)return;G=!0,Oe(),E(),k?.dispose();let v=Sr(t,M,s);f.removeAttribute("data-worker-view-drawn"),f.setAttribute("data-worker-view-failed",t),e.fallback!==!1&&(e.fallback??Bt)(f,t,v),e.onFailure?.(t,v)},Bt=(t,s,v)=>{let K=x??(()=>{try{return Se(e.store,e.principal,{manifest:o,...e.input?{input:e.input()}:{},...L?{computed:L}:{}})}catch{return}})(),_=a.createElement("div");_.setAttribute("data-graview-fallback",s),_.style.cssText="padding:12px;display:grid;gap:6px;color:var(--graview-ink, inherit);font-family:var(--graview-font-body, inherit)";let u=a.createElement("strong");u.textContent=o.title??o.name;let N=a.createElement("ul");N.style.cssText="margin:0;padding-left:1.2em";for(let H of[...K?.node?[K.node]:[],...K?.nodes??[]]){let se=a.createElement("li");se.textContent=H.label??H.id,N.appendChild(se)}let I=a.createElement("p");I.style.cssText="margin:0;font-size:0.8125rem;color:var(--graview-ink-muted, inherit)",I.textContent=`This view was stopped. ${v}`,_.append(u,N,I),y.replaceChildren(_)},_e=wt(o,e.store);if(_e.length>0)return queueMicrotask(()=>C("manifest",_e.join(" "))),he();let Le=t=>{if(("source"in t?new TextEncoder().encode(t.source).length:"script"in t?new TextEncoder().encode(t.script).length:0)>M.maxSourceBytes)return["source"];let v="source"in t?bt(t.source):[];return v.length>0?["source",v.join(" ")]:void 0},z=e.worker,Ie=typeof z=="function"?void 0:Le(z);if(Ie)return queueMicrotask(()=>C(...Ie)),he();let Pe=Et(p,()=>Ve(),"blob"),pe=()=>Mt(()=>e.theme?.()??St(f),e.brand,Pe),Ne=()=>{let t=e.brand?.()?.views;k?.theme(t?.css),k?.motion(t?.motion??"none")},Ce="",fe=()=>{Ce=JSON.stringify(pe()),Ne(),b?.push()},Ve=()=>{b&&JSON.stringify(pe())!==Ce&&fe()},Ut=Tt(a,Ve),F,Ft=xe(e.store,o)?xr().then(({computedOn:t})=>{L=t(e.store.schema)}):Promise.resolve(),$,$t=o.pictures?wr().then(({createGuestPictures:t})=>{G||(F=t(p,{as:"blob",view:`"${o.title??o.name}"`,pictures:o.pictures,...e.limits?{limits:e.limits}:{},...e.file?{file:e.file}:{},moved:()=>b?.push(),onLeft:s=>{B?.postMessage({type:"notice",text:s}),e.onProblem?.(s)}}))}):Promise.resolve();h=()=>{Ut(),Pe.dispose(),F?.dispose(),J?.dispose(),$?.dispose(),oe?.dispose()};let B,ee=t=>B?.postMessage(t),De=!1,He=!1,te=()=>f.toggleAttribute("data-worker-view-drawn",!G&&He&&k!==void 0&&c.length===0&&X.size===0&&!F?.waiting()&&!($?.waiting??0)),q=p.performance,X=new Map,re=q.now(),zt=()=>{if(T)return;let t=Math.max(10,Math.min(250,Math.floor(M.pushMs/4)));re=q.now(),T=p.setInterval(()=>{let s=q.now(),v=s-re>t*2?s-re-t:0;re=s;for(let[K,_]of X){let u=_+v;if(X.set(K,u),s-u>=M.pushMs)return C("slow")}},t)},qt=ce(()=>M.drawMs,()=>q.now()),je=()=>{},me=t=>{if(G)return;if(!k)return void c.push(t);let s=k;if(!qt.draw(K=>t[0]==="render"?s.apply(t[1],K):(s.style(t[1]),!0)))return C("slow");t[0]==="render"&&je()},Be=()=>new Set([...e.store.kindsKeptFrom(e.principal),...e.store.modules.disabledKinds]),Ue=()=>ct(e.store.schema,Be()),ge=()=>pt(e.store.schema,e.places?.()??[],{kept:Be(),...e.arrangement?{pages:e.arrangement()}:{}}),Y=ft({sees:t=>e.store.seenBy(e.principal).graph.has(t),places:ge,lists:Ue,schema:e.store.schema,...e.onNavigate?{onNavigate:e.onNavigate}:e.goTo?{onNavigate:t=>kt(e.goTo(),t)}:{},...e.hrefOf?{hrefOf:e.hrefOf}:!e.onNavigate&&e.goTo?{hrefOf:t=>xt(e.goTo(),t)}:{},onLost:t=>{B?.postMessage({type:"notice",text:t}),e.onProblem?.(t)}}),j=new Set,Fe=new Set,J,$e=!1,ze=()=>{$e||($e=!0,vr().then(({createGuestMedia:t})=>{G||(J=t(p,{view:`"${o.title??o.name}"`,pictures:o.pictures!==void 0,shown:()=>x,...e.file?{file:e.file}:{},onProblem:s=>{B?.postMessage({type:"notice",text:s}),e.onProblem?.(s)}}),J.refresh(y))},()=>e.onProblem?.(`The view "${o.title??o.name}" places a video or a full-screen viewer, and the host's player could not be loaded.`)))},qe=!1,Xe=!1,ne=new Map,Ye=()=>{qe||!o.accepts?.length||(qe=!0,br().then(({createGuestDrops:t})=>{G||($=t(p,{shadow:y,manifest:o,store:e.store,principal:e.principal,files:()=>e.files?.(),shown:()=>j,hears:()=>Xe,idOf:s=>k?.renderer.idOf(s),send:ee,change:(s,v)=>{if(!b)return{ok:!1,reason:"refused",message:"The view has gone."};let K=b.change(s,v);return m(),K},handed:(s,v)=>ne.set(s.href,{file:s,drop:v}),onProblem:s=>{B?.postMessage({type:"notice",text:s}),e.onProblem?.(s)},onBusy:()=>te()}),$.refresh())},()=>e.onProblem?.(`The view "${o.title??o.name}" takes files, and the host's drop could not be loaded.`)))},oe,Je=[],Qe=!1,Xt=t=>{Je=t,oe?.bind(t),!(Qe||t.length===0)&&(Qe=!0,kr().then(({createGuestGestures:s,unheardWords:v})=>{if(!G){if(o.gestures!==!0){let K=v(o.title??o.name);return B?.postMessage({type:"notice",text:K}),e.onProblem?.(K)}oe=s(y,{root:()=>y.querySelector("[data-graview-view-root]")??void 0,idOf:K=>k?.renderer.idOf(K),send:ee}),oe.bind(Je)}},()=>{}))},Yt=t=>{let s=e.store.seenBy(e.principal).graph;for(let v of j){let K=s.getNode(v);for(let _ of Object.values(K??{}))for(let u of ht(_))if(u.href===t)return u}},Ze=t=>{if(t.localName==="graview-video")return ze();t.hasAttribute("data-lightbox")&&(t.setAttribute("aria-haspopup","dialog"),ze())};Promise.all([yr(),hr()]).then(([{createOpenDrawing:t,handedLinks:s,judgeLink:v,linkRefusedWords:K},{createPressReader:_,createSaver:u,fillPrefills:N,judgePress:I,markPresses:H,prefillOf:se,quietPictures:Jt}])=>{if(G)return;let Q=_(),nt=(l,O)=>{let V=k?.renderer.idOf(l);V!==void 0&&ee({type:"dom-event",target:V,event:"acted",pressed:O})},we=u({reader:Q,save:(l,O)=>{if(!b)return;let V=b.pressed(I(e.store,o,j,l));m(),nt(O,{as:l.as,...V})}}),ot=()=>we.flush();p.addEventListener("pagehide",ot),R=()=>{p.removeEventListener("pagehide",ot),we.flush()};let Qt=new WeakSet;je=()=>{Y.refresh(y),H(y),Jt(y),N(y,Q,Qt,l=>se(e.store,e.principal,o,j,l)),J?.refresh(y),$?.refresh()};let st,it=new Set,Zt=()=>(st!==x&&([st,it]=[x,s(x)]),it),at=new Set;k=t(y,{origin:e.origin??p.location.origin,link:l=>v(l,{handed:Zt(),...e.links?{origins:e.links.origins}:{}}),...e.asset?{asset:e.asset}:{},...e.images?{imageOrigins:e.images.origins}:{},...o.pictures?{picture:l=>F?.drawn(l)}:{},onRefused:l=>{if(l.reason==="url"&&l.element==="a"&&l.address!==void 0&&!at.has(l.address)){at.add(l.address);let V=K(l.address,e.links?.origins);return B?.postMessage({type:"notice",text:V}),e.onProblem?.(V)}if(l.reason!=="url"||l.element!=="img"||l.address===void 0||Fe.has(l.address))return;Fe.add(l.address);let O=yt(l.address,{...e.images?{origins:e.images.origins}:{},assets:e.asset!==void 0},l.length);B?.postMessage({type:"notice",text:O}),e.onProblem?.(O)},...e.limits?.maxNodes!==void 0?{maxNodes:e.limits.maxNodes}:{},onOverBudget:()=>C("nodes"),send:ee,onFieldSet:l=>Q.filled(l),onAttribute:(l,O)=>{(O==="data-record"||O==="data-place")&&Y.link(l),O==="data-lightbox"&&Ze(l),O==="data-drop"&&Ye()},decorate:l=>{(l.hasAttribute("data-record")||l.hasAttribute("data-place"))&&Y.link(l),Ze(l),l.hasAttribute("data-drop")&&Ye()},before:(l,O,V)=>{Q.heard(l,O),we.heard(l,O,V),Y.pressed(l,O,V);let ve=O.closest("a[href]");ve&&V.contains(ve)&&!ve.hasAttribute("data-graview-link")&&l.type==="click"&&l.stopPropagation();let ie=O.closest("[data-lightbox]"),dt=l.type==="keydown"?l.key:void 0;if(ie&&V.contains(ie)&&l.isTrusted&&(l.type==="click"||(dt==="Enter"||dt===" ")&&ie.localName!=="button")&&(l.preventDefault(),l.stopPropagation(),J?.open(ie)),$?.before(l,O,V))return!1;let be=Q.press(l,O,V);if(!be||!b)return;l.stopPropagation(),l.type==="keydown"&&l.preventDefault();let er=b.pressed(I(e.store,o,j,be));m();let lt={as:be.as,...er},tr=O.closest("[data-act]");return queueMicrotask(()=>nt(tr,lt)),{pressed:lt}}}),Ne();for(let l of c.splice(0))me(l);w(),te()},()=>C("start","the view's drawing could not be loaded"));let ye=t=>S=ue(p,{source:t,name:o.name,limiter:P,readyMs:e.limits?.readyMs??5e3,silentMs:e.limits?.silentMs??5e3,onDropped:()=>W.dropped+=1,onStop:(s,v)=>C(s,v),onError:s=>{De||C("error",s)},onReady:(s,v,K)=>{B=v,g=Vt(Ht(p,K)),Object.assign(M,Dt(D,g)),zt();let _=de({store:e.store,principal:e.principal,view:o.name,nonce:s,send:u=>{u.type==="props"&&typeof u.push=="number"&&(X.set(u.push,q.now()),te()),v.postMessage(u)},props:()=>{let u=Se(e.store,e.principal,{manifest:o,...e.input?{input:e.input()}:{},theme:pe(),places:ut(ge()),...L?{computed:L}:{}}),N=j;return j=new Set([...u.node?[u.node.id]:[],...(u.nodes??[]).map(I=>I.id)]),x&&(N.size!==j.size||[...j].some(I=>!N.has(I)))&&k?.fade(),x=u,u},...F?{hand:F.hand}:{},judgeAct:(u,N)=>{let I=vt(e.store,o,u,N,{shown:j,file:H=>ne.get(H)?.file??Yt(H),dropped:H=>ne.get(H)?.drop});if(I.ok)for(let H of I.spent??[])ne.delete(H);return I},onHears:u=>{u.includes("drop")&&(Xe=!0)},onGestures:Xt,onClicks:u=>Nt(f,u),onRender:u=>{De=!0,me(["render",u])},onPushed:(u,N)=>{if(X.delete(u),N>=M.pushMs)return C("slow");He=!0,te()},onFlood:()=>C("flood"),onStyle:u=>me(["style",u]),places:()=>[...new Set([...ge().map(u=>u.as),...Ue().map(u=>u.slug)])],...e.limits?{limits:e.limits}:{},limiter:P});b=_,v.onmessage=({data:u})=>{if(!S?.answer(u)&&(_.receive(u),m(),!G&&u?.nonce===s&&u.type==="navigate")){let N={...u.where!==void 0?{where:u.where}:{},...u.section!==void 0?{section:u.section}:{}},I=typeof u.place=="string"?{place:u.place,...N}:typeof u.to=="string"&&{record:u.to,...N};I&&Y.go(I)}},fe()}}),et=o.pictures!==void 0||xe(e.store,o),tt=()=>Promise.all([$t.catch(()=>Promise.reject(new Error("the view's pictures could not be loaded"))),Ft.catch(()=>Promise.reject(new Error("the view's computed values could not be worked out")))]),rt=t=>{"source"in t?(et?Promise.all([Te(t.source),tt()]).then(([s])=>s):Te(t.source)).then(s=>{G||ye({script:s})},s=>C("start",s instanceof Error&&s.message.startsWith("the view's")?s.message:"the view's runtime could not be loaded")):et?tt().then(()=>{G||ye(t)},s=>C("start",s instanceof Error?s.message:"the view's pictures could not be loaded")):ye(t)};return typeof z=="function"?Rt(z).then(t=>{if(G)return;let s=Le(t);s?C(...s):rt(t)},t=>C("source",`Its code did not arrive${t instanceof Error&&t.message?`: ${t.message}`:""}.`)):rt(z),he();function he(){return{element:f,shadow:y,get worker(){return S?.worker},update:()=>{b&&fe()},get stats(){return m(),W},get refused(){return k?.refused??[]},get contentHeight(){return d},get pace(){return g},dispose(){G=!0,Oe(),i?.disconnect(),k?.dispose(),f.remove(),A?.remove()}}}}var jt="graview-guest-kit";function rn(r,e){let a=r.ownerDocument,p=a.defaultView;if(!a.getElementById(jt)){let S=a.createElement("style");S.id=jt,S.textContent=We,a.head.appendChild(S)}let o=a.createElement("div");o.className="graview-guest",o.setAttribute("role","group"),o.setAttribute("aria-label",e.title??e.view),o.setAttribute("data-guest-view",e.view),r.appendChild(o);let f={applied:0,refused:0,dropped:0},y=ae(e.limits),A=ce(()=>e.limits?.drawMs??100,()=>p.performance.now()),W,P,M,D=!1,g={applied:0,refused:0,dropped:0},x=()=>{if(!W)return;let S=W.stats;f.applied+=S.applied-g.applied,f.refused+=S.refused-g.refused,f.dropped+=S.dropped-g.dropped,g={...S}},L=()=>{x(),W?.dispose(),W=void 0,M?.stop()},b=(S,k)=>{D||(D=!0,L(),P?.dispose(),e.onFailure?.(S,k))};return M=ue(p,{source:e.worker,name:e.view,limiter:y,readyMs:e.limits?.readyMs??5e3,silentMs:e.limits?.silentMs??5e3,onDropped:()=>f.dropped+=1,onStop:(S,k)=>b(S,k),onReady:(S,k)=>{let G=Ae(o,{...e.kit?{kit:e.kit}:{},...e.links?{links:e.links}:{},onEvent:(c,m)=>k.postMessage({type:"event",listener:c,...m!==void 0?{detail:m}:{}}),...e.limits?.maxNodes!==void 0?{maxNodes:e.limits.maxNodes}:{},onOverBudget:()=>b("budget")});P=G;let n=de({store:e.store,principal:e.principal,view:e.view,nonce:S,send:c=>k.postMessage(c),onRender:c=>{A.draw(m=>G.apply(c,m))||b("slow")},...e.input?{input:e.input}:{},...e.onNavigate?{onNavigate:e.onNavigate}:{},onSize:e.onSize??(c=>o.style.minHeight=`${c}px`),...e.limits?{limits:e.limits}:{},limiter:y});W=n,k.onmessage=c=>{M?.answer(c.data)||(n.receive(c.data),x())},n.push()}}),{element:o,get worker(){return M?.worker},update:()=>W?.push(),get stats(){return x(),f},get refused(){return P?.refused??[]},dispose(){D=!0,L(),P?.dispose(),o.remove()}}}export{Ee as GUEST_KIT,We as GUEST_KIT_CSS,Me as KIT_LINK_TARGETS,Kt as KIT_TONES,Ae as createKitRenderer,_t as hostAttribute,Lt as kitValue,rn as mountGuestWorker,Tr as mountWorkerView};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{a as Ge}from"./chunk.BJUUSIQY.js";import{a as Ke}from"./chunk.TQ2G4AM4.js";import{a as Ve}from"./chunk.LDMBJC3B.js";import{a as Je}from"./chunk.GH5UBSQI.js";import{a as pe}from"./chunk.2JEN2RCB.js";import{c as ue}from"./chunk.3FKKH2XU.js";import{E as Oe,G as hn,J as _e,R as We,V as Ue,da as ze}from"./chunk.VLX7YWVH.js";import{Cd as qe,Ed as Be,Ib as je,ec as De,ga as B,la as ce,oa as W,oc as fe,qc as Le,ra as Ne,sd as He,ta as G}from"./chunk.IQGSEAQ2.js";import{j as ee}from"./chunk.FQLNBIQ5.js";import{b as xe}from"./chunk.AJZBJBMO.js";var kn=["search-miss","unanswered","refused","tool-invalid"];var _n=new RegExp("[\\u0000-\\u001f\\u007f-\\u009f\\u200b-\\u200f\\u2028-\\u202e\\u2066-\\u2069]","g");var K=e=>e.onBehalfOf?K(e.onBehalfOf):e.id!==void 0?`${e.kind}:${e.id}`:`${e.kind}:?`,ve=e=>e.toLowerCase().replace(/\s+/g," ").replace(/^[\s\p{P}]+|[\s\p{P}]+$/gu,"");var bn=new Set("a an and are at be by can do does for from has have how i in is it me my of on or our the their there this to was we what when where which who why will with you your".split(" "));function ne(e,n,t,i,o){let r=new Map;for(let f of e){let d=n(f);if(d===void 0)continue;let c=r.get(d)??{first:f,people:new Set,times:0,last:f};c.people.add(K(f.by)),c.times+=1,c.last=f,r.set(d,c)}return[...r.entries()].filter(([,f])=>f.people.size>=i).sort(([f,d],[c,a])=>a.people.size-d.people.size||a.times-d.times||f.localeCompare(c)).slice(0,o).map(([f,d])=>({...t(d.last,f),people:d.people.size,times:d.times}))}function wn(e,n={}){let t=Math.max(1,n.minPeople??2),i=n.most??12,o=n.reader?K(n.reader):void 0,r=e.filter(a=>!qe(a.by)&&(o===void 0||K(a.by)!==o)),f=Object.fromEntries(kn.map(a=>{let s=r.filter(u=>u.type===a);return[a,{events:s.length,people:new Set(s.map(u=>K(u.by))).size}]})),d=[],c=new Map;for(let a of r){let s=a.type==="search-miss"?a.words:a.type==="unanswered"?a.question:void 0;if(s!==void 0)for(let u of new Set(ve(s).split(/[^\p{L}\p{N}]+/u))){if(u.length<3||bn.has(u))continue;let g={...a,id:`${a.id}:${u}`};d.push(g),c.set(g,u)}}return{events:r.length,people:new Set(r.map(a=>K(a.by))).size,byType:f,searches:ne(r,a=>a.type==="search-miss"&&ve(a.words)||void 0,(a,s)=>({words:s}),t,i),questions:ne(r,a=>a.type==="unanswered"&&ve(a.question)||void 0,(a,s)=>({question:s}),t,i),words:ne(d,a=>c.get(a),(a,s)=>({word:s}),t,i),refusals:ne(r,a=>a.type==="refused"?`${a.act}|${a.code}`:void 0,a=>({act:a.act,code:a.code}),t,i),tools:ne(r,a=>a.type==="tool-invalid"?`${a.tool}|${a.act??""}`:void 0,a=>{let s=a;return{tool:s.tool,...s.act?{act:s.act}:{},...s.then?{then:s.then}:{}}},1,i)}}var Ye=e=>e.length>3&&e.endsWith("s")&&!e.endsWith("ss")?e.slice(0,-1):e;function An(e){let n=new Set,t=i=>{for(let o of i.toLowerCase().split(/[^\p{L}\p{N}]+/u))o.length>0&&n.add(Ye(o))};for(let i of e.kinds){let o=e.tryDefinition(i);t(i),t(G(o,i)),t(W(e,i));for(let r of[...o?.aliases??[],...Object.values(o?.fieldAliases??{}).flat()])t(r);for(let r of Object.keys(o?.fields?.shape??{}))t(r),t(B(r))}return n}function Qe(e,n,t={}){let i=wn(e,{most:8,...t}),o=An(n),r=i.searches.filter(s=>!s.words.split(/[^\p{L}\p{N}]+/u).some(u=>u.length>0&&o.has(Ye(u)))).map(s=>({words:s.words,people:s.people})),f=i.questions.map(s=>({question:s.question,people:s.people})),d=i.tools.map(s=>({tool:s.tool,...s.act?{act:s.act}:{},...s.then?{then:s.then}:{},times:s.times})),c=s=>`${s} ${s===1?"person":"people"}`;return{said:[...r.length>0?[`Searched for, found nothing, and nothing here is called it: ${r.map(s=>`\u201C${s.words}\u201D (${c(s.people)})`).join(", ")}.`]:[],...f.length>0?[`Asked and not answered: ${f.map(s=>`\u201C${s.question}\u201D (${c(s.people)})`).join(", ")}.`]:[],...d.length>0?[`Tool calls refused as invalid: ${d.map(s=>`${s.tool}${s.act?` (${s.act})`:""} ${s.times===1?"once":`${s.times} times`}${s.then?`, then worked as ${s.then}`:""}`).join("; ")}.`]:[]].join(`
|
|
2
|
-
`),unknownWords:r,questions:f,toolMistakes:d}}var Sn=e=>/^(?:aggregate|kind):([^,]+)$/.exec(e)?.[1];function Xe(e,n){let t=e.about??[];if(e.field!==void 0&&e.on!==void 0&&n(e.on))return{on:"field",id:e.on,field:e.field};let i=t.filter(n);if(i.length>1)return{on:"selection",ids:i};if(e.on!==void 0&&n(e.on))return{on:"record",id:e.on};if(i.length===1)return{on:"record",id:i[0]};let o=[e.on,...t].map(r=>r===void 0?void 0:Sn(r)).find(r=>r!==void 0);return e.place!==void 0?{on:"lens",place:e.place,...o?{kind:o}:{}}:o!==void 0?{on:"list",kind:o}:{on:"place",place:"home"}}var Q=e=>e.on==="record"||e.on==="field"?[e.id]:e.on==="selection"?e.ids:e.on==="act"&&e.id!==void 0?[e.id]:[],ye=(e,n)=>e.tryDefinition(n)?.fields?.shape??{},Y=(e,n)=>e.tryDefinition(n)?.edges??{},ge=(e,n)=>new Set(e.tryDefinition(n)?.display?.hide??[]),L=(e,n)=>ce(e.tryDefinition(n.kind),n),$e=(e,n,t)=>Ne(e.tryDefinition(n),t)||B(t),Ce=e=>typeof e=="boolean"?e?"yes":"no":String(e);function me(e,n){let t=e.kindsKeptFrom(n);return new Set(e.schema.kinds.filter(i=>!t.has(i)))}function Re(e,n,t,i){if(!e.permits(n,t).ok)return!1;if(!i)return!0;try{return e.previewAll([n],{author:t}).ops.length>0}catch{return!1}}function he(e,n,t){let i=e,{principal:o}=t,r=t.each??8,f=ee(i)?.store??i,d=f.seenBy(o),c=f.schema,a=me(f,o),s=l=>{let h=d.graph.getNode(l);return h&&a.has(h.kind)?h:void 0},u=f.allMutations(),g=new Map(u.map(l=>[l.name,l])),b=[],C=new Set,A=l=>{C.has(l.id)||(C.add(l.id),b.push(l))},m=l=>l.slice(0,r),x=Q(n).filter(l=>s(l)!==void 0);if(Q(n).length>0&&x.length===0)return{target:n,candidates:[]};let O=x.length===1?s(x[0]):void 0,k=O?.kind??(n.on==="list"?n.kind:n.on==="lens"?n.kind??t.places?.find(l=>l.as===n.place)?.kind:void 0)??(n.on==="selection"?s(x[0])?.kind:void 0);if(k!==void 0&&!a.has(k))return{target:n,candidates:[]};let p=(l,h)=>`act:${l}${Object.keys(h).length>0?`:${Object.values(h).map(R=>String(R)).join(",")}`:""}`,w=(l,h,R,E,$)=>{l.destructive||Object.values(h).some(y=>typeof y=="string"&&f.graph.has(y)&&s(y)===void 0)||Re(f,{name:l.name,args:{...h}},o,E.length===0)&&A({type:"act",id:p(l.name,h),label:R,description:$??l.description??R,mutation:l.name,args:h,asks:E})};if(n.on!=="place"||t.acts)if(t.acts)for(let l of t.acts){let h=g.get(l.mutation);!h||l.destructive||n.on==="act"&&l.mutation!==n.act||w(h,l.args,l.label,(l.open??[]).filter(R=>!R.optional).map(R=>R.name),l.why)}else{let l=O?[O]:[];for(let h of u){if(n.on==="act"&&h.name!==n.act)continue;let R=h.input.shape??{},E=$=>Object.entries(R).filter(([y,v])=>y!==$&&v.safeParse?.(void 0).success===!1).map(([y])=>y);if(h.subject)for(let $ of l)fe(c,h).includes($.kind)&&w(h,{[h.subject.arg]:$.id},`${h.title??B(h.name)}: ${L(c,$)}`,E(h.subject.arg));else k!==void 0&&(h.creates??[]).includes(k)&&w(h,{},h.title??B(h.name),E(void 0))}}let T=b.filter(l=>l.type==="act");b.splice(0,b.length,...m(T));let F=(l,h)=>{let R=Le(c,u).get(l.kind),E=ye(c,l.kind),$=ge(c,l.kind),y=[];for(let[v,D]of Object.entries(E)){if(h!==void 0?v!==h:$.has(v)||l[v]!==void 0)continue;let j=pe(D),J=j?.type==="enum"&&!j.multiple?j.options??[]:j?.type==="boolean"?[!0,!1]:[];if(J.length===0)continue;let _=(R?.get(v)??[]).map(N=>g.get(N)).find(N=>N?.subject!==void 0&&Re(f,{name:N.name,args:{[N.subject.arg]:l.id,[v]:J.find(Se=>Se!==l[v])??J[0]}},o,!0));if(_?.subject)for(let N of J)l[v]!==N&&y.push({type:"fill",id:`fill:${l.id}:${v}:${Ce(N)}`,label:`${$e(c,l.kind,v)}: ${Ce(N)}`,description:`Set ${$e(c,l.kind,v).toLowerCase()} of ${L(c,l)} to ${Ce(N)}`,record:l.id,field:v,value:N,call:{name:_.name,args:{[_.subject.arg]:l.id,[v]:N}}})}for(let[v,D]of Object.entries(Y(c,l.kind))){if(h!==void 0&&v!==h)continue;let j=D.to==="*"?[...a]:D.to.filter(I=>a.has(I)),J=new Set(d.graph.out(l.id,v).map(I=>I.id)),_=u.find(I=>(I.connects??[]).includes(v)&&I.subject!==void 0&&fe(c,I).includes(l.kind));if(!_?.subject)continue;let N=De(_.input).find(I=>I.name!==_.subject.arg);if(!N)continue;let Se=j.flatMap(I=>N.kinds.length===0||N.kinds.includes(I)?d.graph.nodesOfKind(I):[]).filter(I=>I.id!==l.id&&!J.has(I.id)&&s(I.id)!==void 0);for(let I of m(Se)){let Me={name:_.name,args:{[_.subject.arg]:l.id,[N.name]:I.id}};Re(f,Me,o,!0)&&y.push({type:"fill",id:`fill:${l.id}:${v}:${I.id}`,label:`${B(v)}: ${L(c,I)}`,description:`Link ${L(c,l)} to ${L(c,I)}${D.description?` as ${D.description}`:""}`,record:l.id,field:v,value:I.id,call:Me})}}return y};if(n.on==="field"&&O)for(let l of F(O,n.field))A(l);else if(O&&n.on==="record")for(let l of m(F(O)))A(l);let q=l=>{let h=W(c,l).toLowerCase(),R=[{type:"panel",id:`panel:${l}:list`,label:`A list of ${h}`,description:`Every ${G(c.tryDefinition(l),l).toLowerCase()} this viewer may see, as a list`,panel:{lens:"blocks",kind:l}}],E=ge(c,l);for(let[$,y]of Object.entries(ye(c,l))){if(E.has($))continue;let v=pe(y),D=$e(c,l,$).toLowerCase();if(v?.type==="enum")R.push({type:"panel",id:`panel:${l}:group:${$}`,label:`${V(h)} by ${D}`,description:`A list of ${h} grouped by ${D}`,panel:{lens:"blocks",kind:l,group:$}}),R.push({type:"panel",id:`panel:${l}:columns:${$}`,label:`Columns of ${h} by ${D}`,description:`${V(h)} in a column for each ${D}`,panel:{lens:"columns",kind:l,column:$}});else if(v?.type==="number"||v?.type==="integer"||v?.type==="date"||v?.type==="datetime"){let j=v.type==="date"||v.type==="datetime";R.push({type:"panel",id:`panel:${l}:sort:${$}`,label:`${V(h)} by ${D}`,description:`A list of ${h}, the ${j?"latest":"highest"} ${D} first`,panel:{lens:"blocks",kind:l,sort:{by:$,direction:"desc"}}}),j&&R.push({type:"panel",id:`panel:${l}:calendar:${$}`,label:`A calendar of ${h}`,description:`${V(h)} on a calendar by ${D}`,panel:{lens:"calendar",kind:l,start:$}})}}return R},H=n.on==="place"?[...a]:k!==void 0?[k]:[];for(let l of H)for(let h of m(q(l)))A(h);for(let l of m((t.places??[]).filter(h=>h.kind===void 0?n.on==="place":a.has(h.kind)&&(n.on==="place"||h.kind===k))))n.on==="lens"&&l.as===n.place||A({type:"place",id:`place:${l.as}`,label:l.title,description:`Go to ${l.title}`,place:l.as});if(O){let l=[];for(let[h,R]of Object.entries(Y(c,O.kind)))for(let E of d.graph.out(O.id,h))s(E.id)&&l.push({type:"record",id:`record:${E.id}`,label:L(c,E),description:`${V(R.description??B(h))}: ${L(c,E)}`,record:E.id,relation:h});for(let h of c.kinds)for(let[R,E]of Object.entries(Y(c,h)))if(!(E.to!=="*"&&!E.to.includes(O.kind)))for(let $ of d.graph.in(O.id,R))$.kind===h&&s($.id)&&l.push({type:"record",id:`record:${$.id}`,label:L(c,$),description:`${V(E.inverse??B(R))}: ${L(c,$)}`,record:$.id,relation:R});for(let h of m(l))A(h)}else if(n.on==="list"||n.on==="lens")for(let l of m(k!==void 0?d.graph.nodesOfKind(k):[]))s(l.id)&&A({type:"record",id:`record:${l.id}`,label:L(c,l),description:`Open ${L(c,l)}`,record:l.id});else if(n.on==="selection")for(let l of x){let h=s(l);A({type:"record",id:`record:${l}`,label:L(c,h),description:`Open ${L(c,h)}`,record:l})}return{target:n,candidates:b}}var V=e=>e&&`${e[0].toUpperCase()}${e.slice(1)}`,xn={columns:["board","kanban","column","lane","pipeline","stage","funnel"],board:["board","map","floor","layout","seat","slot"],calendar:["calendar","schedule","date","due","month","week","agenda","deadline","day"],timeline:["timeline","gantt","schedule","roadmap","span"],coverage:["coverage","matrix","grid","gap"],plan:["plan","floor","map","region","area"],blocks:["list","table","summary","overview","dashboard","card"]},On=new Set(["a","an","the","of","for","my","our","me","us","to","with","and","in","on","by","that","which","i","we","want","need","show","open","go","draw","make","new","view","views","panel","panels","page","lens","please","all","every","some","see","can","could","would","like","one","what","is","are","do","does","here","there","how","it","this","these","those"]),te=e=>e.length>3&&e.endsWith("ies")?`${e.slice(0,-3)}y`:e.length>3&&e.endsWith("s")&&!e.endsWith("ss")?e.slice(0,-1):e,Te=e=>e.toLowerCase().normalize("NFKD").replace(/[̀-ͯ]/g,"").split(/[^a-z0-9]+/).filter(Boolean);function Ze(e,n,t){let i=e,o=ee(i)?.store??i,r=o.schema,f=me(o,t.principal),d=o.seenBy(t.principal),c=Q(n),a=new Set;for(let p of c){let w=d.graph.getNode(p)?.kind;w!==void 0&&f.has(w)&&a.add(w)}if(c.length>0&&a.size===0)return[];if(n.on==="list"&&a.add(n.kind),n.on==="lens"){let p=n.kind??t.places.find(w=>w.as===n.place)?.kind;p!==void 0&&a.add(p)}let s=new Map;for(let p of r.kinds){if(!f.has(p))continue;let w=r.tryDefinition(p);for(let T of[p,G(w,p),W(r,p)])for(let F of Te(T))s.set(te(F),p)}let u=Te(t.said??"").filter(p=>!On.has(p)),g=new Set,b=[];for(let p of u){let w=s.get(te(p));w!==void 0?g.add(w):b.push(te(p))}let C=g.size>0?g:a;if((t.said??"").trim()!==""&&u.length===0)return[];if(C.size===0&&u.length===0)return[];let A=[];t.places.forEach((p,w)=>{if(p.hidden||n.on==="lens"&&p.as===n.place)return;let T=p.over??(p.kind!==void 0?[p.kind]:[]);if(T.length>0&&!T.some(H=>f.has(H)))return;let F=T.some(H=>C.has(H)),q=!F&&(p.reads??[]).some(H=>C.has(H));C.size>0&&!F&&!q||A.push({place:p,own:F,reads:q,at:w})});let m=p=>new Set(Te(p.title).map(te)),x=new Set(b.filter(p=>A.some(({place:w})=>m(w).has(p)))),O=[];for(let{place:p,own:w,reads:T,at:F}of A){let q=m(p),H=new Set((xn[p.lens??""]??[]).map(te)),l=b.filter($=>q.has($)||H.has($)&&!x.has($)).length,h=b.length-l;if(b.length>0&&l===0)continue;let R=!T&&h===0?"full":"partial",E=(w?4:T?2:1)+l*2-h+(R==="full"?1:0);O.push({view:{place:p.as,title:p.title,...p.kind!==void 0?{kind:p.kind}:{},fit:R},score:E,at:F})}return O.filter((p,w)=>!O.slice(0,w).some(T=>T.view.place===p.view.place&&T.view.title===p.view.title)).sort((p,w)=>w.score-p.score||p.at-w.at).slice(0,t.most??3).map(p=>p.view)}var Ee=new WeakMap;function vn(e){let n=2166136261;for(let t=0;t<e.length;t++)n^=e.charCodeAt(t),n=Math.imul(n,16777619)>>>0;return n.toString(36)}function $n(e,n){let t=e,i=ee(t)?.store??t,o=i.schema,r=me(i,n),d=i.allMutations().filter(A=>!A.destructive&&i.permits({name:A.name,args:{}},n).ok!==!1),c=`${[...r].join(",")}|${d.map(A=>A.name).join(",")}`,a=Ee.get(o)?.get(c);if(a)return a;let s=[...r].map(A=>{let m=ge(o,A),x={};for(let[w,T]of Object.entries(ye(o,A))){if(m.has(w))continue;let F=pe(T);F&&(x[w]=F.type==="enum"?`enum:${(F.options??[]).join("|")}`:F.type)}let O={};for(let[w,T]of Object.entries(Y(o,A)))O[w]=T.to==="*"?[...r]:T.to.filter(F=>r.has(F));let k=o.tryDefinition(A),p=Object.entries(k?.fieldAliases??{}).filter(([w,T])=>w in x&&T.length>0);return{kind:A,noun:G(o.tryDefinition(A),A),plural:W(o,A),fields:x,relations:O,...k?.aliases&&k.aliases.length>0?{aliases:k.aliases}:{},...p.length>0?{fieldAliases:Object.fromEntries(p)}:{}}}),u=d.map(A=>({name:A.name,title:A.title??B(A.name),...A.subject?{on:fe(o,A).filter(m=>r.has(m))}:{}})),g={kinds:s,acts:u},b={version:vn(JSON.stringify(g)),...g},C=Ee.get(o)??new Map;return C.set(c,b),Ee.set(o,C),b}var Cn=e=>e.name??e.id??e.kind;function en(e,n,t){let i=e,{principal:o}=t,r=ee(i)?.store??i,f=r.seenBy(o),d=r.schema,c=me(r,o),a=p=>{let w=f.graph.getNode(p);return w&&c.has(w.kind)?w:void 0},s=p=>({id:p.id,kind:p.kind,label:L(d,p)}),u=Q(n),g=u.length===1?a(u[0]):void 0,b=g?Object.fromEntries(Object.keys(ye(d,g.kind)).filter(p=>!ge(d,g.kind).has(p)&&g[p]!==void 0&&p!=="label").map(p=>[p,g[p]])):{},C={on:n.on,...g?{record:{...s(g),fields:b}}:{},...n.on==="field"&&g?{field:n.field}:{},...n.on==="list"&&c.has(n.kind)?{kind:n.kind}:{},...n.on==="lens"?{place:n.place,...n.kind&&c.has(n.kind)?{kind:n.kind}:{}}:{},...n.on==="place"?{place:n.place}:{},...n.on==="act"?{act:n.act}:{}},A=[...new Set([...n.on==="selection"?n.ids:[],...t.selection??[]])].flatMap(p=>{let w=a(p);return w?[s(w)]:[]}),m=[];if(g){for(let p of Object.keys(Y(d,g.kind)))for(let w of f.graph.out(g.id,p))a(w.id)&&m.push({...s(w),relation:p,direction:"out"});for(let p of d.kinds)for(let w of Object.keys(Y(d,p)))for(let T of f.graph.in(g.id,w))T.kind===p&&a(T.id)&&m.push({...s(T),relation:w,direction:"in"})}let x=f.batches().filter(p=>!p.ops.every(je)).slice(-(t.recent??6)).reverse().map(p=>({intent:p.intent,at:p.at,by:Cn(p.author)})),O=(t.purpose?.jobs??[]).filter(p=>Ge(p,o.roles)&&c.has(p.kind)).map(p=>({name:p.name,ask:p.ask,kind:p.kind})),k=t.purpose&&(t.purpose.for!==void 0||O.length>0)?{...t.purpose.for!==void 0?{for:t.purpose.for}:{},jobs:O}:void 0;return{...t.place!==void 0?{place:t.place}:{},target:C,selection:A,neighbors:m.slice(0,24),recent:x,schema:$n(r,o),...k?{purpose:k}:{},...t.friction?{friction:Qe(t.friction,d,{reader:o})}:{}}}function ie(e){if(!e.off)return e.fast??(e.decide?{model:e.name??"decide",decide:e.decide}:void 0)}function U(e){if(e.off)return;if(e.thinking)return e.thinking;let n=e.name??"model";if(e.complete){let t=e.complete;return{model:n,think:({system:i,prompt:o})=>t({prompt:o,system:i})}}if(e.turn){let t=e.turn;return{model:n,think:async({system:i,prompt:o})=>({text:await t({system:i,messages:[{role:"user",content:o}],tools:[],call:async()=>({error:"No tools here."})})})}}}var Pe=(e,n,t)=>e?n/1e6*(e.inputPerMillion??0)+t/1e6*(e.outputPerMillion??0):void 0,Ie=()=>`ai-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`;function Rn(e,n,t=[]){let i=o=>{let r=e.graph.getNode(o);return r?ce(e.schema.tryDefinition(r.kind),r):"a record"};switch(n.on){case"record":return i(n.id);case"field":return`${i(n.id)} \xB7 ${n.field}`;case"selection":return`${n.ids.length} records`;case"list":return e.schema.tryDefinition(n.kind)?W(e.schema,n.kind):n.kind;case"lens":case"place":return t.find(o=>o.as===n.place)?.title??(n.place==="home"?"Home":n.place);case"act":return n.act}}var nn=e=>e.type!=="act"||e.asks.length===0,be=(e,n)=>({id:e.id,type:e.type,label:e.label,...n!==void 0?{confidence:n}:{}});function X(e,n){let t=n.interaction??Ie(),i=he(n.store,n.target,{principal:n.principal,...n.acts?{acts:n.acts}:{},...n.places?{places:n.places}:{}}),o=en(n.store,n.target,{principal:n.principal,...n.place?{place:n.place}:{},...n.selection?{selection:n.selection}:{},...n.purpose?{purpose:n.purpose}:{}}),r=[];return{id:t,catalog:i,state:o,entry:{id:t,at:new Date().toISOString(),by:n.by??n.principal,target:n.target,targetLabel:Rn(n.store,n.target,n.places)},usage:r,meter:f=>{r.push(f),e.meter?.({...f,interaction:t})}}}async function oe(e,n,t,i){let o=await e.decide(n,t),{inputTokens:r,outputTokens:f}=o.usage,d=Pe(e.price,r,f);return i({tier:"fast",model:e.model,inputTokens:r,outputTokens:f,...d!==void 0?{costUsd:d}:{}}),o.answers}async function re(e,n,t,i,o){let r=await e.think({system:n,prompt:t,state:i.state,catalog:i.catalog}),f=r.usage?.inputTokens,d=r.usage?.outputTokens,c=r.usage?.costUsd??(f!==void 0?Pe(e.price,f,d??0):void 0);return o({tier:"thinking",model:e.model,...f!==void 0?{inputTokens:f}:{},...d!==void 0?{outputTokens:d}:{},...c!==void 0?{costUsd:c}:{}}),Ve(r.text)}function se(e,n){let t=new Map(e.map((i,o)=>[`c${o+1}`,i]));return{question:{type:"choice",instructions:n,criteria:Object.fromEntries([...t].map(([i,o])=>[i,`${o.label} \u2014 ${o.description}`]))},of:i=>t.get(i)}}function ae(e,n,t){if(e?.type!=="choice")return[];let i=e,o=Object.entries(i.probabilities).sort((r,f)=>f[1]-r[1]);return o.some(([r])=>r===i.choice)||o.unshift([i.choice,i.confidence]),o.flatMap(([r,f])=>{let d=n(r);return d?[{candidate:d,confidence:f}]:[]}).slice(0,t)}var M=(e,n,t,i)=>({interaction:{...e.entry,ask:{kind:t,said:n??""},offered:[],outcome:"failed",failed:i,usage:[...e.usage]},offers:[]}),Z="AI isn't on here.";async function tn(e,n,t=3){let i=X(e,n),o=n.said??"Suggest",r=i.catalog.candidates.filter(nn).slice(0,24);if(r.length===0)return{interaction:{...i.entry,ask:{kind:"suggest",said:o},offered:[],outcome:"offered",usage:[]},offers:[]};let f=ie(e),d=U(e),c=[];try{if(f){let{question:a,of:s}=se(r,"Which of these would the person most likely want to do next, here?"),u=await oe(f,{...i.state,candidates:r.map(g=>({id:g.id,type:g.type,says:g.description}))},{next:a},i.meter);c=ae(u.next,s,t)}else if(d){let a=await re(d,'You suggest what a person most likely wants to do next in an app. Answer only JSON: {"pick": [candidate ids, best first]}. Pick only ids from the candidates.',JSON.stringify({state:i.state,candidates:r.map(u=>({id:u.id,says:u.description}))}),i,i.meter);c=(Array.isArray(a?.pick)?a.pick.filter(u=>typeof u=="string"):[]).flatMap(u=>r.filter(g=>g.id===u)).slice(0,t).map(u=>({candidate:u}))}else return M(i,o,"suggest",Z)}catch(a){return M(i,o,"suggest",a instanceof Error?a.message:String(a))}return{interaction:{...i.entry,ask:{kind:"suggest",said:o},offered:c.map(({candidate:a,confidence:s})=>be(a,s)),outcome:"offered",usage:[...i.usage]},offers:c.map(({candidate:a})=>a)}}var Tn=e=>`several:${e}`;async function it(e,n,t=2){let i=X(e,{...n,acts:[]}),o=n.said??"Suggest for the chosen",r=n.target.on==="selection"?n.target.ids.length:1,d=[...n.shared.map(s=>({type:"act",id:Tn(s.id),label:s.label,description:`${s.label}, for all ${r} chosen`,mutation:s.mutation,args:s.args,asks:[]})),...i.catalog.candidates.filter(s=>s.type==="panel"||s.type==="place")].slice(0,24),c=ie(e);if(!c)return M(i,o,"suggest",Z);if(d.length===0)return{interaction:{...i.entry,ask:{kind:"suggest",said:o},offered:[],outcome:"offered",usage:[]},offers:[]};let a;try{let{question:s,of:u}=se(d,`Which of these would the person most likely want to do next with the ${r} records they chose together?`),g=await oe(c,{...i.state,candidates:d.map(b=>({id:b.id,type:b.type,says:b.description}))},{next:s},i.meter);a=ae(g.next,u,t).filter((b,C)=>C===0||b.confidence>=En)}catch(s){return M(i,o,"suggest",s instanceof Error?s.message:String(s))}return{interaction:{...i.entry,ask:{kind:"suggest",said:o},offered:a.map(({candidate:s,confidence:u})=>be(s,u)),outcome:"offered",usage:[...i.usage]},offers:a.map(({candidate:s})=>s)}}var En=.25;async function on(e,n){let t=X(e,n),i=n.said??"Fill in",o=t.catalog.candidates.filter(u=>u.type==="fill"),r=new Map;for(let u of o)r.set(u.field,[...r.get(u.field)??[],u]);if(r.size===0)return{interaction:{...t.entry,ask:{kind:"fill",said:i},offered:[],outcome:"offered",usage:[]},offers:[]};let f=ie(e),d=U(e),c=[];try{if(f){let u=[...r].map(([b,C],A)=>({key:`f${A+1}`,field:b,...se(C,`Which value fits "${b}" best for this record?`)})),g=await oe(f,t.state,Object.fromEntries(u.map(b=>[b.key,b.question])),t.meter);for(let b of u){let C=!Pn(n.store,n.target,b.field)&&In(n.store,n.target,b.field)!=="one";c.push(...ae(g[b.key],b.of,C?3:1).filter((A,m)=>m===0||A.confidence>=.4))}}else if(d){let u=await re(d,`You fill in a record's fields in an app. Answer only JSON: {"fills": [candidate ids]}, at most one per field, only ids from the candidates.`,JSON.stringify({state:t.state,candidates:o.map(C=>({id:C.id,says:C.description}))}),t,t.meter),g=Array.isArray(u?.fills)?u.fills.filter(C=>typeof C=="string"):[],b=new Set;for(let C of g){let A=o.find(m=>m.id===C);A?.type==="fill"&&!b.has(A.field)&&(b.add(A.field),c.push({candidate:A}))}}else return M(t,i,"fill",Z)}catch(u){return M(t,i,"fill",u instanceof Error?u.message:String(u))}let a=t.usage.at(-1)?.model,s=de(n.store,{interaction:t.id,target:n.target,basis:i,...a?{model:a}:{},proposals:c.flatMap(({candidate:u,confidence:g})=>u.type==="fill"?[{id:u.id,label:u.label,said:u.description,call:u.call,record:u.record,field:u.field,...g!==void 0?{confidence:g}:{}}]:[])},n.principal);return{interaction:{...t.entry,ask:{kind:"fill",said:i},offered:s.proposals.map(u=>({id:u.id,type:"fill",label:u.label,...u.confidence!==void 0?{confidence:u.confidence}:{}})),outcome:"offered",usage:[...t.usage]},offers:[],...s.proposals.length>0?{ghost:s}:{}}}function Pn(e,n,t){let i=n.on==="record"||n.on==="field"?n.id:void 0,o=i?e.graph.getNode(i)?.kind:void 0,r=(o?e.schema.tryDefinition(o)?.fields?.shape:void 0)??{};return t in r}function In(e,n,t){let i=n.on==="record"||n.on==="field"?n.id:void 0,o=i?e.graph.getNode(i)?.kind:void 0;return o?e.schema.tryDefinition(o)?.edges?.[t]?.cardinality:void 0}async function rn(e,n){let t=X(e,n),i=n.said??"Add one",o=new Set(n.store.allMutations().filter(s=>(s.creates??[]).length>0).map(s=>s.name)),r=t.catalog.candidates.filter(s=>s.type==="act"&&s.asks.length>0&&o.has(s.mutation));if(r.length===0)return M(t,i,"record","Nothing here makes a record.");let f=U(e);if(!f)return M(t,i,"record",Z);let d;try{let s=await re(f,'You propose one new record for an app by filling in an act. Answer only JSON: {"act": a candidate id, "args": {argument: value}}. Use only the candidates, and fill every argument the act asks for with a value that fits the state.',JSON.stringify({ask:i,state:t.state,candidates:r.map(b=>({id:b.id,says:b.description,asks:b.asks}))}),t,t.meter),u=r.find(b=>b.id===s?.act),g=typeof s?.args=="object"&&s.args!==null?s.args:{};u&&(d={act:u,args:Object.fromEntries(Object.entries(g).filter(([b])=>u.asks.includes(b)))})}catch(s){return M(t,i,"record",s instanceof Error?s.message:String(s))}if(!d)return M(t,i,"record","The model named no act this app has here.");let c=t.usage.at(-1)?.model,a=de(n.store,{interaction:t.id,target:n.target,basis:i,...c?{model:c}:{},proposals:[{id:d.act.id,label:d.act.label,said:d.act.description,call:{name:d.act.mutation,args:{...d.act.args,...d.args}}}]},n.principal);return a.proposals.length===0?M(t,i,"record","What the model proposed could not be made here."):{interaction:{...t.entry,ask:{kind:"record",said:i},offered:a.proposals.map(s=>({id:s.id,type:"act",label:s.said})),outcome:"offered",usage:[...t.usage]},offers:[d.act],ghost:a}}async function sn(e,n){let t=X(e,n),i=n.said??"Make a panel",o=t.catalog.candidates.filter(s=>s.type==="panel");if(o.length===0)return M(t,i,"panel","Nothing here can be drawn as a panel.");let r=ie(e),f=U(e),d;try{if(f){let s=await re(f,'You choose a panel to draw in an app. Answer only JSON: {"panel": a candidate id, "title": a short title}. Choose only among the candidates.',JSON.stringify({ask:i,state:t.state,candidates:o.map(g=>({id:g.id,says:g.description}))}),t,t.meter),u=o.find(g=>g.id===s?.panel);u&&(d={panel:u,...typeof s?.title=="string"&&s.title.trim()?{title:s.title.trim().slice(0,60)}:{}})}else if(r){let{question:s,of:u}=se(o,`Which panel answers this best: ${i}`),g=ae((await oe(r,t.state,{panel:s},t.meter)).panel,u,1)[0];g?.candidate.type==="panel"&&(d={panel:g.candidate,confidence:g.confidence})}else return M(t,i,"panel",Z)}catch(s){return M(t,i,"panel",s instanceof Error?s.message:String(s))}if(!d)return M(t,i,"panel","The model named no panel this app can draw.");let c=d.title??d.panel.label,a={title:c,recipe:{...d.panel.panel,title:c}};return{interaction:{...t.entry,ask:{kind:"panel",said:i},offered:[be(d.panel,d.confidence)],outcome:"drawn",panel:a,usage:[...t.usage]},offers:[d.panel],panel:a}}function Fn(e){return e.off?void 0:e.answer}var Mn=`You answer a person's question about what they are looking at in an app, from the state given and nothing else. Answer only JSON: {"answer": one to three short sentences, "pick": [candidate ids that act on the answer, best first, at most three]}. Pick only ids from the candidates, and none when nothing fits. Never say an id to the person.`;async function ot(e,n){let t=X(e,n),i=n.said.trim(),o=t.catalog.candidates.filter(m=>nn(m)||m.type==="panel"||m.type==="place"||m.type==="record").slice(0,32),r=Fn(e),f=U(e),d=ie(e),c="",a=[],s=m=>m.flatMap(x=>o.filter(O=>O.id===x)).slice(0,3).map(x=>({candidate:x}));try{if(r){let m=await r.answer({said:i,target:n.target,targetLabel:t.entry.targetLabel,state:t.state,catalog:{target:t.catalog.target,candidates:o},...n.follows?{follows:n.follows}:{}}),x=m.usage?.inputTokens,O=m.usage?.outputTokens,k=m.usage?.costUsd??(x!==void 0?Pe(r.price,x,O??0):void 0);t.meter({tier:"thinking",model:r.model,...x!==void 0?{inputTokens:x}:{},...O!==void 0?{outputTokens:O}:{},...k!==void 0?{costUsd:k}:{}}),c=typeof m.text=="string"?m.text.trim():"",a=s(m.pick??[])}else if(f){let m=await re(f,Mn,JSON.stringify({ask:i,about:t.entry.targetLabel,...n.follows?{follows:n.follows}:{},state:t.state,candidates:o.map(x=>({id:x.id,says:x.description}))}),t,t.meter);c=typeof m?.answer=="string"?m.answer.trim():"",a=s(Array.isArray(m?.pick)?m.pick:[])}else if(d&&o.length>0){let{question:m,of:x}=se(o,`Which of these best answers, or acts on: ${i}`),O=await oe(d,{...t.state,asked:i,candidates:o.map(k=>({id:k.id,type:k.type,says:k.description}))},{answer:m},t.meter);a=ae(O.answer,x,3),c=a.length>0?`These fit \u201C${i}\u201D.`:""}else return M(t,i,"ask",Z)}catch(m){return M(t,i,"ask",m instanceof Error?m.message:String(m))}if(!c&&a.length===0){let m=n.target.on==="place"||n.target.on==="lens"?n.target.place:void 0,x=n.target.on==="list"||n.target.on==="lens"?n.target.kind:void 0;return Be(n.store,{type:"unanswered",question:i,...m?{place:m}:{},...x?{kind:x}:{}},n.principal),M(t,i,"ask","The AI had no answer to that here.")}let u=t.usage.at(-1)?.model,g=a.flatMap(({candidate:m,confidence:x})=>{let O=ke(m);return O?[{...O,...x!==void 0?{confidence:x}:{}}]:[]}),b=g.length>0?de(n.store,{interaction:t.id,target:n.target,basis:i,...u?{model:u}:{},proposals:g},n.principal):void 0,C=a.map(({candidate:m})=>m).filter(m=>ke(m)===void 0),A=[...C.map(m=>be(m,a.find(x=>x.candidate===m)?.confidence)),...(b?.proposals??[]).map(m=>({id:m.id,type:m.field!==void 0?"fill":"act",label:m.label,...m.confidence!==void 0?{confidence:m.confidence}:{}}))];return{interaction:{...t.entry,ask:{kind:"ask",said:i},offered:A,outcome:"offered",...c?{answer:c}:{},usage:[...t.usage]},offers:C,...b&&b.proposals.length>0?{ghost:b}:{},...c?{answer:c}:{}}}function de(e,n,t){let i=n.proposals.flatMap(o=>{try{let r=e.previewAll([o.call],{author:t}),f=r.ops.map(d=>d.intent).join("; ");return r.ops.length>0?[{...o,said:f||o.said}]:[]}catch{return[]}});return{...n,proposals:i}}function ke(e){if(e.type==="fill")return{id:e.id,label:e.label,said:e.description,call:e.call,record:e.record,field:e.field};if(e.type==="act"&&e.asks.length===0)return{id:e.id,label:e.label,said:e.description,call:{name:e.mutation,args:{...e.args}}}}function an(e,n,t){let i=n.proposals.filter(r=>t.ids===void 0||t.ids.includes(r.id));if(i.length===0)return{ok:!1,refused:"Nothing was chosen."};let o=i.flatMap(r=>r.confidence===void 0?[]:[r.confidence]);try{let f=e.applyAll(i.map(d=>d.call),{author:t.author,via:`ai:${n.interaction}`,intent:n.basis,lineage:{basis:`Asked \u201C${n.basis}\u201D`,...n.model?{model:n.model}:{},...o.length>0?{confidence:Math.min(...o)}:{},interaction:n.interaction}}).ops[0]?.batch;return f?{ok:!0,batch:f,accepted:i.map(d=>d.id)}:{ok:!1,refused:"That changes nothing now."}}catch(r){return{ok:!1,refused:r instanceof Error?r.message:String(r)}}}function dn(e,n,t){let i=e.ask.kind==="suggest"?n.length>0:e.offered.length>0&&e.offered.every(o=>n.includes(o.id));return{...e,outcome:i?"accepted":"partly",accepted:n,batches:[...e.batches??[],t]}}var ln=e=>({...e,outcome:"dismissed"});var P=xe(hn(),1);var S=xe(Ue(),1);function fn(e,n,t){let i=n.on==="selection"?n.ids:n.on==="record"||n.on==="field"?[n.id]:[],o=i.length>0?Ke(e.store,i,{principal:e.principal,...i.length===1?{focus:i[0]}:{}}).affordances.map(r=>({mutation:r.mutation,label:r.label,args:r.args,open:r.open,why:r.why,...r.destructive?{destructive:!0}:{}})):void 0;return{store:e.store,target:n,principal:e.principal,interaction:Ie(),places:e.places,selection:e.selection,...o?{acts:o}:{},...e.place?{place:e.place}:{},...t?{said:t}:{},...e.app.purpose?{purpose:e.app.purpose}:{}}}async function un(e,n,t){let i=await (__graviewPreload(import.meta.url,["./chunk.REXU6ARY.js","./chunk.G4JJXA63.js","./chunk.BIDL7GQD.js","./chunk.TA2JTUNX.js","./chunk.HZPRMHSL.js","./chunk.LDMBJC3B.js","./chunk.XOZU4OFA.js","./chunk.G7YLK4PX.js","./chunk.Q5WEOX3Q.js","./chunk.2E62YCMZ.js","./chunk.DUP2CGVH.js","./chunk.YEXFVDRA.js","./chunk.WVUJXDXZ.js","./chunk.ZA5TDCBC.js","./chunk.2JEN2RCB.js","./chunk.7CLKGKSF.js","./chunk.TMHVYI5R.js","./chunk.R5MLRKAO.js","./chunk.YMXWS4XN.js","./chunk.75JQCTR6.js","./chunk.5IEZF433.js","./chunk.5AD2QHWH.js","./chunk.IQGSEAQ2.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.TP3PZRHE.js")),o=i.recipeDraft(n.recipe,{app:e.app,sight:i.draftSight(e.app,e.principal)});if(i.isDraftFailure(o))return o.failed;t?.(),e.seatTalk.setDraft(o,null),e.goTo.draft?.(),pn()}function pn(e=180){if(typeof document>"u")return;let n=document.querySelector('[data-testid="draft-keep"]'),t=document.activeElement,i=!t||t===document.body||t.closest?.("[inert]")!==null;if(n){i&&n.focus();return}e>0&&requestAnimationFrame(()=>pn(e-1))}async function le(e,n,t,i,o){let r=fn(e,t,i),f=n==="suggest"?await tn(e.ai,r):n==="fill"?await on(e.ai,r):n==="record"?await rn(e.ai,r):await sn(e.ai,r);if(f.interaction.outcome==="failed")return n!=="suggest"&&e.desk.record(f.interaction),f;let d=c=>{let a={...f.interaction,outcome:"failed",failed:c};return e.desk.record(a),{...f,interaction:a}};if(n==="fill"||n==="record"){if(!f.ghost||f.ghost.proposals.length===0)return d("Nothing here could be filled in.");o?.(),e.desk.setGhost({ghost:f.ghost}),e.desk.record(f.interaction)}if(n==="panel"&&f.panel){let c=await un(e,f.panel,o);if(c)return d(c);e.desk.record(f.interaction)}return f}var Fe=new WeakMap,Nn=64,cn=new WeakMap;function jn(e){let n=cn.get(e);if(!n){let t=n={n:0};cn.set(e,t),e.subscribe(()=>void(t.n+=1))}return n.n}var yn=(e,n)=>{let t=Q(n);return t.length>0?t.map(i=>e.graph.getNode(i)):[jn(e)]},gn=(e,n,t)=>JSON.stringify({target:n,seat:e.principal,by:t}),mn=(e,n,t)=>{let i=yn(e.store,n);return t.schema===e.store.schema&&t.ai===e.ai&&i.length===t.depends.length&&i.every((o,r)=>o===t.depends[r])};function Dn(e,n,t="menu"){let i=Fe.get(e.store)?.get(gn(e,n,t));return i?.result!==void 0&&mn(e,n,i)?i.result:void 0}function Ln(e,n,t){let i=Fe.get(e.store);i||Fe.set(e.store,i=new Map);let o=gn(e,n,t?.by??"menu"),r=i.get(o);if(r&&mn(e,n,r))return r.result?Promise.resolve(r.result):r.asked;let f=t?t.ask():le(e,"suggest",n),d={schema:e.store.schema,ai:e.ai,depends:yn(e.store,n),asked:f};i.delete(o),i.set(o,d),i.size>Nn&&i.delete(i.keys().next().value);let c=i;return f.then(a=>{a.interaction.outcome!=="failed"?d.result=a:c.get(o)===d&&c.delete(o)}),f}async function Hn(e,n,t,i){let o=n.interaction,r=ke(t);if(r){let f=o.usage?.at(-1)?.model,d=o.offered.find(a=>a.id===t.id)?.confidence,c=de(e.store,{interaction:o.id,target:o.target,basis:`${o.ask.said}: ${t.label}`,...f?{model:f}:{},proposals:[{...r,...d!==void 0?{confidence:d}:{}}]},e.principal);if(c.proposals.length===0){let a="That can't be done now.";return e.desk.record({...o,outcome:"failed",failed:a}),a}i?.(),e.desk.setGhost({ghost:c}),e.desk.record(o);return}if(t.type==="panel"){let f=t.label,d={title:f,recipe:{...t.panel,title:f}},c=await un(e,d,i);return e.desk.record(c?{...o,outcome:"failed",failed:c}:{...o,outcome:"drawn",accepted:[t.id],panel:d}),c}i?.(),t.type==="place"?e.goTo.place(t.place):t.type==="record"&&e.goTo.record(t.record),e.desk.record({...o,outcome:"accepted",accepted:[t.id]})}async function yt(e,n){if(n.ask.kind==="ask")return ue(e.desk,{target:n.target,asked:n.ask.said}),null;let t=n.ask.kind==="panel"||n.ask.kind==="record"?n.ask.kind:"fill";return le(e,t,n.target,n.ask.said)}var z={padding:"5px 10px",fontSize:"0.875rem",borderRadius:8,width:"100%",textAlign:"left",borderWidth:1,borderStyle:"solid",borderColor:"transparent",background:"none",boxShadow:"none"},we={margin:0,padding:"4px 10px",fontSize:"0.8125rem",color:"var(--graview-ink-muted)"};function gt({target:e,close:n}){let t=Je(),i=(0,P.useMemo)(()=>Xe(e,y=>t.store.graph.has(y)),[e,t.store]),o=(0,P.useMemo)(()=>{let y=fn(t,i);return he(t.store,i,{principal:t.principal,places:t.places,...y.acts?{acts:y.acts}:{}})},[t,i]),r=o.candidates.some(y=>y.type==="fill"),f=o.candidates.some(y=>y.type==="panel"),d=(0,P.useMemo)(()=>f?Ze(t.store,i,{principal:t.principal,places:t.places,most:1}):[],[f,t,i]),c=(0,P.useMemo)(()=>new Set(t.store.allMutations().filter(y=>(y.creates??[]).length>0).map(y=>y.name)),[t.store]),a=U(t.ai)!==void 0&&o.candidates.some(y=>y.type==="act"&&y.asks.length>0&&c.has(y.mutation)),s=Oe(t.ai),u=Dn(t,i),g=JSON.stringify(i),[b,C]=(0,P.useState)(!1),[A,m]=(0,P.useState)(null),[x,O]=(0,P.useState)(s&&u===void 0);(0,P.useEffect)(()=>{if(u!==void 0||!(s||b))return;let y=!0;return O(!0),Ln(t,i).then(v=>{y&&(m(v),O(!1))}),()=>{y=!1}},[g,b]);let k=u??A,p=(k?.offers??[]).filter(y=>!(y.type==="place"&&d.some(v=>v.place===y.place))).slice(0,Math.max(0,3-d.length)),w=k?.interaction.outcome==="failed"?k.interaction.failed??"The AI could not suggest anything here.":null,T=(0,P.useRef)(!1),F=(0,P.useRef)(null);(0,P.useLayoutEffect)(()=>{k===null||!T.current||(T.current=!1,F.current?.querySelector("button")?.focus())},[k]);let q=(0,P.useRef)(!0);(0,P.useEffect)(()=>()=>{q.current=!1},[]);let[H,l]=(0,P.useState)(!1),[h,R]=(0,P.useState)(null),E=y=>{if(H)return;l(!0),R(null);let v=!1;y(()=>{v=!0,n()}).then(j=>{q.current&&(l(!1),j?R(j):v||n())},j=>{q.current&&(l(!1),R(j instanceof Error?j.message:String(j)))})},$=y=>y.interaction.outcome==="failed"?y.interaction.failed??"The AI could not do that here.":void 0;return(0,S.jsxs)("div",{ref:F,"data-testid":"inline-ai",style:{display:"grid",gap:2},children:[x&&!b?(0,S.jsx)("p",{role:"status","data-testid":"inline-ai-thinking",style:we,children:"Thinking\u2026"}):H?(0,S.jsx)("p",{role:"status","data-testid":"inline-ai-asking",style:we,children:"Asking\u2026"}):h?(0,S.jsx)("p",{role:"alert","data-testid":"inline-ai-failed",style:{...we,color:"var(--graview-warn)"},children:h}):w?(0,S.jsx)("p",{role:"status",style:we,children:w}):null,(0,S.jsxs)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",gap:2},children:[p.map(y=>(0,S.jsx)("li",{children:(0,S.jsxs)("button",{type:"button","data-menu-item":`ai-offer:${y.id}`,"data-ai-offer":y.id,"data-ai-offer-type":y.type,onClick:()=>E(v=>Hn(t,k,y,v)),style:z,children:[y.label,(0,S.jsxs)("span",{style:{color:"var(--graview-ink-faint)"},children:[" \xB7 ",y.type==="panel"?"a panel":y.type==="place"?"go there":y.type==="record"?"open it":"suggested"]})]})},y.id)),!s&&k===null?(0,S.jsx)("li",{children:(0,S.jsx)("button",{type:"button","data-menu-item":"ai-suggest","aria-disabled":b||void 0,onClick:y=>{b||(T.current=document.activeElement===y.currentTarget,C(!0))},style:z,children:b?"Thinking\u2026":"Suggest\u2026"})}):null,r?(0,S.jsx)("li",{children:(0,S.jsx)("button",{type:"button","data-menu-item":"ai-fill",onClick:()=>E(async y=>$(await le(t,"fill",i,"Fill in",y))),style:z,children:"Fill in with AI"})}):null,a?(0,S.jsx)("li",{children:(0,S.jsx)("button",{type:"button","data-menu-item":"ai-record",onClick:()=>E(async y=>$(await le(t,"record",i,"Add one",y))),style:z,children:"Add one with AI"})}):null,d.map(y=>(0,S.jsx)("li",{children:(0,S.jsx)("button",{type:"button","data-menu-item":`ai-open:${y.place}`,"data-ai-existing":y.fit,onClick:()=>{n(),t.goTo.place(y.place),y.fit==="partial"&&ue(t.desk,{target:{on:"lens",place:y.place,...y.kind?{kind:y.kind}:{}}})},style:z,children:y.fit==="full"?`Open ${y.title}`:`Open and adjust ${y.title}`})},y.place)),f?(0,S.jsx)("li",{children:(0,S.jsx)("button",{type:"button","data-menu-item":"ai-panel",onClick:()=>E(async y=>$(await le(t,"panel",i,"Draw a panel",y))),style:z,children:d.length>0?"Draw a new view":"Draw a panel"})}):null,(0,S.jsx)("li",{children:(0,S.jsx)("button",{type:"button","data-menu-item":"ai-ask",onClick:()=>{let y=document.activeElement;n(),ue(t.desk,{target:i,returnTo:y instanceof HTMLElement&&y!==document.body?y:null})},style:z,children:"Ask about this\u2026"})})]})]})}var Ae={display:"inline-flex",alignItems:"center",minHeight:28,padding:"2px 10px",fontSize:"0.8125rem",borderRadius:8};function mt({placement:e="picture"}){let{store:n,principal:t,aiDesk:i}=ze(),o=We(n,t),{ghost:r,entries:f}=_e(i),[d,c]=(0,P.useState)(new Set);(0,P.useEffect)(()=>c(new Set),[r?.ghost.interaction]);let a=(0,P.useRef)(null),s=(0,P.useRef)(null),u=r?.batch;if((0,P.useEffect)(()=>{u!==void 0&&s.current?.focus()},[u]),!r)return null;let{ghost:g}=r,b=f.find(k=>k.id===g.interaction),C=()=>{let k=g.target.on==="record"||g.target.on==="field"?g.target.id:void 0,p=a.current?.closest("[data-graview-face], main")?.parentElement??document,w=(k?p.querySelector(`[data-graview-view="${CSS.escape(k)}"][tabindex]`):null)??document.querySelector("[data-graview-page-title]")??a.current?.closest("main")??document.querySelector("main");w&&!w.hasAttribute("tabindex")&&w.setAttribute("tabindex","-1"),w?.focus({preventScroll:!0}),i.setGhost(null)},A=g.proposals.filter(k=>!d.has(k.id)).map(k=>k.id),m=()=>{let k=an(o,g,{author:t,ids:A});if(!k.ok){i.setGhost({...r,refused:k.refused});return}b&&i.record(dn(b,k.accepted,k.batch)),i.setGhost({ghost:g,batch:k.batch,took:k.accepted.length,...r.onCard?{onCard:!0}:{}})},x=()=>{b&&r.batch===void 0&&i.record(ln(b)),C()},O=()=>{if(r.batch!==void 0)try{o.undo(r.batch,{author:t}),C()}catch(k){i.setGhost({...r,refused:k instanceof Error?k.message:String(k)})}};return(0,S.jsxs)("section",{ref:a,"data-testid":"ai-ghost","data-interaction":g.interaction,"aria-label":"Proposed by AI",style:{...e==="card"?{position:"static"}:{position:e==="page"?"fixed":"absolute",insetInline:"max(12px, calc(50% - 220px))",bottom:"calc(var(--graview-foot-room, 0px) + 72px)",zIndex:He("toast"),boxShadow:"var(--graview-lift-high)"},display:"grid",gap:8,padding:12,borderRadius:12,border:"1px dashed var(--graview-accent)",background:"var(--graview-float)",fontSize:"0.875rem"},children:[(0,S.jsx)("p",{style:{margin:0,color:"var(--graview-ink-muted)"},children:r.batch!==void 0?`Done: ${r.took===1?"one change":`${r.took} changes`}, as one.`:`Proposed by AI \xB7 ${g.basis}`}),r.batch===void 0?(0,S.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:4},children:g.proposals.map(k=>(0,S.jsx)("li",{"data-ghost-proposal":k.id,children:(0,S.jsxs)("label",{style:{display:"flex",alignItems:"baseline",gap:8,cursor:"pointer"},children:[(0,S.jsx)("input",{type:"checkbox",checked:!d.has(k.id),onChange:p=>{let w=new Set(d);p.target.checked?w.delete(k.id):w.add(k.id),c(w)}}),(0,S.jsx)("span",{style:{fontStyle:"italic",color:"var(--graview-ink)"},children:k.said}),k.confidence!==void 0?(0,S.jsxs)("span",{style:{color:"var(--graview-ink-faint)"},children:[Math.round(k.confidence*100),"% sure"]}):null]})},k.id))}):null,r.refused?(0,S.jsx)("p",{role:"alert",style:{margin:0,color:"var(--graview-warn)"},children:r.refused}):null,(0,S.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:r.batch===void 0?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)("button",{type:"button","data-testid":"ghost-accept",disabled:A.length===0,onClick:m,style:Ae,children:A.length===g.proposals.length?"Accept":`Accept ${A.length} of ${g.proposals.length}`}),(0,S.jsx)("button",{type:"button","data-testid":"ghost-dismiss",onClick:x,style:Ae,children:"Dismiss"})]}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)("button",{type:"button",ref:s,"data-testid":"ghost-undo",onClick:O,style:Ae,children:"Undo"}),(0,S.jsx)("button",{type:"button","data-testid":"ghost-close",onClick:C,style:Ae,children:"Close"})]})})]})}export{Xe as a,Q as b,he as c,Ze as d,ie as e,Ie as f,Rn as g,Tn as h,it as i,ot as j,fn as k,un as l,le as m,Dn as n,Ln as o,Hn as p,yt as q,gt as r,mt as s};
|