graview 0.1.44 → 0.1.46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/preview/{chunk.RVQYXPCM.js → chunk.2JJYGYT2.js} +1 -1
- package/dist/preview/{chunk.P5K7EYDK.js → chunk.3MMLRSRC.js} +1 -1
- package/dist/preview/{chunk.D2RK2KJD.js → chunk.3OSGN463.js} +1 -1
- package/dist/preview/{chunk.3M4VCAA3.js → chunk.3VFYSXMQ.js} +1 -1
- package/dist/preview/{chunk.ZN77U6SU.js → chunk.4HYJHGI4.js} +1 -1
- package/dist/preview/{chunk.BA4KQR5H.js → chunk.4KNEBLB7.js} +1 -1
- package/dist/preview/chunk.4OGOTHRD.js +1 -0
- package/dist/preview/{chunk.UXLJZIYX.js → chunk.4RJZVTW7.js} +1 -1
- package/dist/preview/chunk.4Y6VGQVQ.js +1 -0
- package/dist/preview/{chunk.F4DWRBO7.js → chunk.55D33E5A.js} +1 -1
- package/dist/preview/{chunk.QJJKITXF.js → chunk.5ESCD57M.js} +1 -1
- package/dist/preview/chunk.5K6KX3UC.js +1 -0
- package/dist/preview/chunk.5R2R364Q.js +1 -0
- package/dist/preview/{chunk.ALFW4ZJQ.js → chunk.63JLXGYX.js} +1 -1
- package/dist/preview/{chunk.7PUFYK3B.js → chunk.64WM4IBI.js} +1 -1
- package/dist/preview/chunk.6BDM2XRX.js +1 -0
- package/dist/preview/{chunk.ATKKTPJS.js → chunk.6MADC6DM.js} +1 -1
- package/dist/preview/{chunk.6BIRNR5P.js → chunk.6OPI4WWO.js} +1 -1
- package/dist/preview/{chunk.YERDP6YF.js → chunk.6QYJ2K6K.js} +1 -1
- package/dist/preview/{chunk.N5ULWKR4.js → chunk.6RY6OSE6.js} +1 -1
- package/dist/preview/{chunk.P546VMA5.js → chunk.6SOUQNXR.js} +1 -1
- package/dist/preview/chunk.6UIW664O.js +6 -0
- package/dist/preview/{chunk.7B5BZZBG.js → chunk.6WA6ASQB.js} +1 -1
- package/dist/preview/chunk.6YD2DLIC.js +1 -0
- package/dist/preview/{chunk.DLVNW4HU.js → chunk.A5VGTO3E.js} +1 -1
- package/dist/preview/{chunk.RNUGQRJI.js → chunk.AGIO2GRV.js} +29 -7
- package/dist/preview/{chunk.HKD5SR45.js → chunk.AQQZY6OY.js} +2 -2
- package/dist/preview/{chunk.AW2T3KFV.js → chunk.AS4CQBOQ.js} +1 -1
- package/dist/preview/chunk.ATDU5Y7V.js +1 -0
- package/dist/preview/chunk.AYA7SYIU.js +1 -0
- package/dist/preview/{chunk.WPLKHIO5.js → chunk.BAMPYMUE.js} +1 -1
- package/dist/preview/{chunk.JEMQ66FT.js → chunk.BCWPV4WR.js} +1 -1
- package/dist/preview/{chunk.GAN77YDU.js → chunk.BFKV4GKP.js} +6 -6
- package/dist/preview/{chunk.B7FZLIAO.js → chunk.BNPQUI3F.js} +1 -1
- package/dist/preview/chunk.BRDAO2OF.js +4 -0
- package/dist/preview/{chunk.DGXWL4GC.js → chunk.CICGAEBW.js} +2 -2
- package/dist/preview/{chunk.LKF4BBCW.js → chunk.DEUTHHGI.js} +1 -1
- package/dist/preview/{chunk.7AEE3VHC.js → chunk.DQOCBKC3.js} +1 -1
- package/dist/preview/{chunk.KERLVJ6I.js → chunk.DX357TZ3.js} +1 -1
- package/dist/preview/{chunk.2CPC3HQI.js → chunk.EAJB2PJZ.js} +1 -1
- package/dist/preview/{chunk.NPS2WN7T.js → chunk.EPUBSKKL.js} +1 -1
- package/dist/preview/chunk.F37DHXA2.js +1 -0
- package/dist/preview/{chunk.EW364363.js → chunk.F5PBK4TF.js} +2 -2
- package/dist/preview/chunk.FGR7KCI6.js +1 -0
- package/dist/preview/chunk.FO5BOBYV.js +1 -0
- package/dist/preview/chunk.FVOJCVRX.js +1 -0
- package/dist/preview/chunk.FXTBMW3S.js +1 -0
- package/dist/preview/chunk.GEPNIMXW.js +1 -0
- package/dist/preview/chunk.GVY5UQTJ.js +1 -0
- package/dist/preview/{chunk.4EPT2CQG.js → chunk.H7KCWCB4.js} +1 -1
- package/dist/preview/{chunk.FVHECT47.js → chunk.HBD7FBZS.js} +1 -1
- package/dist/preview/{chunk.MZOIPCDA.js → chunk.HDRD33II.js} +1 -1
- package/dist/preview/chunk.HZCA3UWJ.js +1 -0
- package/dist/preview/{chunk.HP72LB3B.js → chunk.I3GP5JW7.js} +1 -1
- package/dist/preview/{chunk.LKXYZK5H.js → chunk.IJABD7SI.js} +1 -1
- package/dist/preview/{chunk.27ZVVPRZ.js → chunk.IKX4VDTW.js} +1 -1
- package/dist/preview/chunk.ITYQUSZI.js +6 -0
- package/dist/preview/chunk.IW7YFPGG.js +1 -0
- package/dist/preview/{chunk.IBWPRK2R.js → chunk.JBW3DI7E.js} +1 -1
- package/dist/preview/chunk.JF3GD4H5.js +50 -0
- package/dist/preview/{chunk.RYNCEZ6Q.js → chunk.JHIUG25Q.js} +1 -1
- package/dist/preview/{chunk.UZSZPMRC.js → chunk.JLEC3USG.js} +1 -1
- package/dist/preview/chunk.JLIUUFK2.js +1 -0
- package/dist/preview/{chunk.XPIDPZKS.js → chunk.JLYNMAME.js} +1 -1
- package/dist/preview/{chunk.EYEIDL3T.js → chunk.JNIGZEOF.js} +1 -1
- package/dist/preview/chunk.JQLR6KO2.js +1 -0
- package/dist/preview/chunk.JT3IZIU5.js +33 -0
- package/dist/preview/{chunk.NBOZPPSM.js → chunk.KRGM25HF.js} +1 -1
- package/dist/preview/{chunk.UG23RICT.js → chunk.KWQ7QOHD.js} +1 -1
- package/dist/preview/{chunk.H4GHKBMH.js → chunk.L2PI7V4R.js} +1 -1
- package/dist/preview/{chunk.ZP6PS5Z4.js → chunk.LETJC5TD.js} +1 -1
- package/dist/preview/{chunk.V4DR25S4.js → chunk.LKN734RR.js} +1 -1
- package/dist/preview/{chunk.5JPELFMA.js → chunk.LKVXSC5O.js} +1 -1
- package/dist/preview/{chunk.REEDZSCG.js → chunk.LUNATPAB.js} +2 -2
- package/dist/preview/{chunk.4WCQWILK.js → chunk.LVEFQLGQ.js} +1 -1
- package/dist/preview/{chunk.FNF6XQI5.js → chunk.M5GJHVWZ.js} +1 -1
- package/dist/preview/chunk.MWONSI3P.js +1 -0
- package/dist/preview/{chunk.56DR42FA.js → chunk.N7VNEUJR.js} +1 -1
- package/dist/preview/{chunk.FIJNKSMQ.js → chunk.NGIPVTTE.js} +1 -1
- package/dist/preview/chunk.NITU5H4J.js +1 -0
- package/dist/preview/{chunk.6NFR2LYQ.js → chunk.NIVTK2W5.js} +1 -1
- package/dist/preview/chunk.NMIXBH37.js +1 -0
- package/dist/preview/{chunk.JGYGSNQY.js → chunk.NWA7Q6CI.js} +1 -1
- package/dist/preview/{chunk.REOYQTFP.js → chunk.O24DD2VF.js} +1 -1
- package/dist/preview/{chunk.U3CV5CCL.js → chunk.OHSJQYJN.js} +1 -1
- package/dist/preview/chunk.ONEYVLC2.js +1 -0
- package/dist/preview/{chunk.CDFVEL2Y.js → chunk.P4O5DGLN.js} +1 -1
- package/dist/preview/{chunk.LULTKYE3.js → chunk.PC6PID5X.js} +1 -1
- package/dist/preview/{chunk.IIB22IIP.js → chunk.PKUDIWIF.js} +1 -1
- package/dist/preview/{chunk.YTXEPWVW.js → chunk.PLWVLW22.js} +1 -1
- package/dist/preview/{chunk.TDCO7LEA.js → chunk.Q7RQC3F7.js} +1 -1
- package/dist/preview/{chunk.ZKBSEUK4.js → chunk.QGVLJTZS.js} +1 -1
- package/dist/preview/{chunk.QNJYXB3U.js → chunk.R2AG4NHQ.js} +1 -1
- package/dist/preview/chunk.R4OU7O6C.js +1 -0
- package/dist/preview/{chunk.YGX2AE36.js → chunk.RNBPDB37.js} +1 -1
- package/dist/preview/{chunk.IN4PKQO5.js → chunk.RNEJYIQ7.js} +1 -1
- package/dist/preview/{chunk.VAUG5TGZ.js → chunk.RTI3FEDD.js} +1 -1
- package/dist/preview/{chunk.Y2MIG2C2.js → chunk.RZXPBOGT.js} +1 -1
- package/dist/preview/chunk.S5MQVPLF.js +1 -0
- package/dist/preview/{chunk.MFLJIFZD.js → chunk.S6WHA4CW.js} +1 -1
- package/dist/preview/{chunk.YTZDCIX2.js → chunk.SL2FZ54V.js} +1 -1
- package/dist/preview/{chunk.3L7OEBJH.js → chunk.SS27NH5O.js} +1 -1
- package/dist/preview/chunk.T7O6K3IN.js +1 -0
- package/dist/preview/{chunk.3IUJ4GW7.js → chunk.TBQOSI4J.js} +1 -1
- package/dist/preview/{chunk.FBIK4LTM.js → chunk.TFVFJFXC.js} +2 -2
- package/dist/preview/{chunk.2O2THM2R.js → chunk.TOZJZXWQ.js} +1 -1
- package/dist/preview/{chunk.PL2P2OON.js → chunk.UHX4WTM7.js} +1 -1
- package/dist/preview/{chunk.OGF6UORU.js → chunk.UKAPFIPJ.js} +1 -1
- package/dist/preview/{chunk.64QDUERE.js → chunk.UNCS63AM.js} +1 -1
- package/dist/preview/chunk.UOXFALRL.js +1 -0
- package/dist/preview/chunk.UPQZU7UO.js +21 -0
- package/dist/preview/chunk.UR3XYOQ6.js +104 -0
- package/dist/preview/chunk.URO2EGY7.js +1 -0
- package/dist/preview/{chunk.TJO5Y2OJ.js → chunk.UVNVDLV5.js} +1 -1
- package/dist/preview/chunk.V3QUTJR2.js +2 -0
- package/dist/preview/{chunk.RDGFZPKN.js → chunk.V5Z2OED6.js} +1 -1
- package/dist/preview/{chunk.EJAWDI2V.js → chunk.VAFSSSSI.js} +1 -1
- package/dist/preview/{chunk.5WEEZ7WD.js → chunk.VBPK6ARF.js} +1 -1
- package/dist/preview/{chunk.DAZEFSWI.js → chunk.VC3BX2ZF.js} +1 -1
- package/dist/preview/{chunk.IQWKEGWG.js → chunk.VDVJCLGS.js} +1 -1
- package/dist/preview/{chunk.MWUP5X47.js → chunk.VW2VCPJX.js} +1 -1
- package/dist/preview/{chunk.O4VSQ2ER.js → chunk.W45NKVSV.js} +1 -1
- package/dist/preview/{chunk.3TBH2FMZ.js → chunk.WAB7UDHU.js} +1 -1
- package/dist/preview/{chunk.OK4FSBHI.js → chunk.WBHM5I3I.js} +1 -1
- package/dist/preview/chunk.WM2LWHTJ.js +1 -0
- package/dist/preview/chunk.WO3DDFFY.js +1 -0
- package/dist/preview/{chunk.JLOSQ5UY.js → chunk.WP5W44Y4.js} +2 -2
- package/dist/preview/chunk.WQONZBA3.js +5 -0
- package/dist/preview/{chunk.T6S3CEW7.js → chunk.WSTBCWW7.js} +2 -2
- package/dist/preview/chunk.X233NILF.js +1 -0
- package/dist/preview/{chunk.FUYMLDNJ.js → chunk.X25KXCWI.js} +1 -1
- package/dist/preview/{chunk.FNXW46U4.js → chunk.XSNAG4JT.js} +82 -72
- package/dist/preview/chunk.XWAMQPUM.js +25 -0
- package/dist/preview/chunk.XXDBZQNY.js +18 -0
- package/dist/preview/{chunk.IQ3LUSD6.js → chunk.XXEYRHRG.js} +1 -1
- package/dist/preview/{chunk.7UV7ODXU.js → chunk.Y5ARSVH4.js} +1 -1
- package/dist/preview/{chunk.TTSNHX3F.js → chunk.Z5IGHCZX.js} +1 -1
- package/dist/preview/{chunk.B2CIQ66N.js → chunk.Z6TMIAAB.js} +1 -1
- package/dist/preview/chunk.ZIEHF67C.js +1 -0
- package/dist/preview/chunk.ZTIF23VF.js +1 -0
- package/dist/preview/index.html +49 -45
- package/dist/preview/page.js +2 -34
- package/package.json +6 -6
- package/dist/preview/chunk.2EXY4AHX.js +0 -117
- package/dist/preview/chunk.3JATXDSP.js +0 -1
- package/dist/preview/chunk.3OKJ4GOA.js +0 -1
- package/dist/preview/chunk.3PNDXNX6.js +0 -1
- package/dist/preview/chunk.4B4DKCS4.js +0 -1
- package/dist/preview/chunk.4JWT6LIS.js +0 -25
- package/dist/preview/chunk.6VIZGLDK.js +0 -1
- package/dist/preview/chunk.7HL7CFXJ.js +0 -1
- package/dist/preview/chunk.7JVBVB4A.js +0 -1
- package/dist/preview/chunk.CSQNDAEK.js +0 -1
- package/dist/preview/chunk.EJOTTZWZ.js +0 -1
- package/dist/preview/chunk.ESU2DD3J.js +0 -1
- package/dist/preview/chunk.EZRGGPAN.js +0 -1
- package/dist/preview/chunk.GAFYE37S.js +0 -3
- package/dist/preview/chunk.GBCWI2LF.js +0 -2
- package/dist/preview/chunk.HB34VQKQ.js +0 -1
- package/dist/preview/chunk.HKA27VJO.js +0 -1
- package/dist/preview/chunk.IPHWGBZE.js +0 -6
- package/dist/preview/chunk.JQ7WY2VZ.js +0 -1
- package/dist/preview/chunk.JUT2VCFW.js +0 -1
- package/dist/preview/chunk.L6FWIQXS.js +0 -1
- package/dist/preview/chunk.LUPBT6YM.js +0 -1
- package/dist/preview/chunk.LYSHLKAX.js +0 -1
- package/dist/preview/chunk.LYUPJ4VV.js +0 -1
- package/dist/preview/chunk.MOF2D6DV.js +0 -1
- package/dist/preview/chunk.NTFCZYOR.js +0 -1
- package/dist/preview/chunk.OAWAUB4P.js +0 -49
- package/dist/preview/chunk.OG6GNGTX.js +0 -21
- package/dist/preview/chunk.PSTE3LZL.js +0 -5
- package/dist/preview/chunk.PX6VAZFJ.js +0 -1
- package/dist/preview/chunk.RLMW7DU6.js +0 -1
- package/dist/preview/chunk.URCC626R.js +0 -1
- package/dist/preview/chunk.WE5SA6TP.js +0 -1
- package/dist/preview/chunk.WNYPP52L.js +0 -1
- package/dist/preview/chunk.YE4GZVOX.js +0 -1
- package/dist/preview/chunk.YWVOACSX.js +0 -5
- package/dist/preview/chunk.YYPK7IDM.js +0 -1
- package/dist/preview/chunk.ZZ5F5I3O.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./chunk.AJZBJBMO.js";var e='"use strict";\n/*! @remote-dom/core and @remote-dom/polyfill \u2014 Copyright 2020-present, Shopify Inc. \u2014 MIT License.\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n * @graview/guest\'s worker runtime \u2014 Elastic License 2.0. */\n"use strict";(()=>{var Oe=globalThis,Kr=Oe.addEventListener,Zr=Oe.removeEventListener,Qr=Oe.postMessage,Jr=globalThis.queueMicrotask,un=globalThis.performance,eo=un?un.now.bind(un):Date.now,Re={listen:t=>Kr.call(Oe,"message",t),unlisten:t=>Zr.call(Oe,"message",t),post:t=>Qr.call(Oe,t),microtask:t=>Jr.call(globalThis,t),now:()=>eo()};var v=Symbol("name"),ue=Symbol("prefix"),de=Symbol("value"),S=Symbol("ns"),q=Symbol("owner"),I=Symbol("owner_document"),ne=Symbol("attributes"),M=Symbol("prev"),f=Symbol("next"),R=Symbol("child"),Y=Symbol("parent"),me=Symbol("host"),K=Symbol("data"),Ee=Symbol("listeners"),dn=Symbol("isTrusted"),Ae=Symbol("path"),_e=Symbol("stop_immediate_propagation"),Pe=Symbol("dispatching"),se=Symbol("content"),D=Symbol("hooks"),mt=Symbol("extensions"),Ne=Symbol("hooks_dispatch"),U=Symbol("is_connected"),Ce=Symbol("create_element"),qn=0,X=1,ke=2,Ie=3,Me=8,Te=9,Yn=10,fe=11,A="http://www.w3.org/1999/xhtml",Z="http://www.w3.org/2000/svg",Wn="http://www.w3.org/XML/1998/namespace",Xe="http://www.w3.org/2000/xmlns/";function ft(t){return t.split(/[\\t\\n\\f\\r ]+/).filter(Boolean)}function G(t){return t.replace(/[A-Z]/g,e=>String.fromCharCode(e.charCodeAt(0)+32))}function Xn(t){return t.replace(/[a-z]/g,e=>String.fromCharCode(e.charCodeAt(0)-32))}function C(t,e){let n=globalThis.DOMException;if(typeof n=="function")return new n(t,e);let r=new Error(t);return r.name=e,r}var $n=/^(?:[A-Za-z][^\\0\\t\\n\\f\\r\\u0020/>]*|[:_\\u0080-\\u{10FFFF}][A-Za-z0-9-.:_\\u0080-\\u{10FFFF}]*)$/u,Kn=/[\\0\\t\\n\\f\\r />=]/u,to=/[\\0\\t\\n\\f\\r />]/u;function ie(t){if(t==null)return null;let e=String(t);return e===""?null:e}function Zn(t){$n.test(t)||fn(t)}function mn(t){(t===""||Kn.test(t))&&fn(t)}function pt(t,e,n){let r=ie(t),o=String(e),s=o.indexOf(":"),i=s<0?null:o.slice(0,s),a=s<0?o:o.slice(s+1);if((i!=null&&(i===""||to.test(i))||(n==="element"?!$n.test(a):a===""||Kn.test(a)))&&fn(o),i!=null&&r==null)throw C(`A namespace is required for the prefix in "${o}"`,"NamespaceError");if(i==="xml"&&r!==Wn)throw C("The xml prefix requires the XML namespace","NamespaceError");if((o==="xmlns"||i==="xmlns")&&r!==Xe)throw C("The xmlns name requires the XMLNS namespace","NamespaceError");if(r===Xe&&o!=="xmlns"&&i!=="xmlns")throw C("The XMLNS namespace requires the xmlns name or prefix","NamespaceError");return{namespace:r,qualifiedName:o,prefix:i,localName:a}}function fn(t){throw C(`Invalid name: "${t}"`,"InvalidCharacterError")}var ht=0,gt=1,Qn=2,pn=3,no=typeof performance>"u"?Date.now:performance.now.bind(performance),V=class{static NONE=ht;static CAPTURING_PHASE=gt;static AT_TARGET=Qn;static BUBBLING_PHASE=pn;timeStamp=no();target=null;currentTarget=null;srcElement=null;bubbles=!1;cancelable=!1;composed=!1;defaultPrevented=!1;cancelBubble=!1;eventPhase=ht;[Ae]=[];[_e]=!1;[Pe]=!1;constructor(e,n){this.type=e,Object.defineProperty(this,dn,{writable:!0,value:!1}),n&&(n.bubbles&&(this.bubbles=n.bubbles),n.cancelable&&(this.cancelable=n.cancelable),n.composed&&(this.composed=n.composed))}get isTrusted(){return this[dn]}composedPath(){return[...this[Ae]]}stopPropagation(){this.cancelBubble=!0}stopImmediatePropagation(){this[_e]=!0,this.cancelBubble=!0}preventDefault(){this.cancelable&&(this.defaultPrevented=!0)}set returnValue(e){e||this.preventDefault()}get returnValue(){return!this.defaultPrevented}initEvent(e,n,r){this.type=e,this.bubbles=!!n,this.cancelable=!!r}};function hn(t,e,n){if(t.cancelBubble)return;let o=e[Ee]?.get(t.type)?.[n===gt?"capture":"bubble"];if(o)for(let s of[...o]){if(!o.has(s)||s.signal?.aborted)continue;t.eventPhase=t.target===e?Qn:n,t.currentTarget=e;let i=s.normalizedListener;try{typeof i=="object"?i.handleEvent(t):i.call(e,t)}catch(a){setTimeout(ro,0,a)}if(t[_e])break}}function ro(t){throw t}var $e=[],yt=new WeakMap;function bt(t,e){let n=yt.get(t);n?n.push(e):yt.set(t,[e]),$e[$e.length-1].push(t)}function B(t){let e=[];$e.push(e);let n;try{n=t()}catch(r){$e.pop();try{Jn(e)}catch{}throw r}return $e.pop(),Jn(e),n}function Jn(t){let e,n=!1;for(let r of t){let o=yt.get(r);if(o){for(;o.length>0;){let s=o.shift();try{s()}catch(i){n||(e=i,n=!0)}}yt.delete(r)}}if(n)throw e}var Et=[],Ke=[],gn=!1;function we(t){for(let e of t)Et.push(e),e[1]&&Ke.push(e[1]);if(!gn){gn=!0;try{let e,n=!1;for(let r=0;r<Et.length;r++){let[o,s]=Et[r];s&&Ke.splice(Ke.indexOf(s),1);try{o()}catch(i){n||(e=i,n=!0)}}if(n)throw e}finally{Et.length=0,Ke.length=0,gn=!1}}}function Ze(t){let e=t;for(;e;){if(Ke.includes(e))return!0;e=e[Y]??e[me]}return!1}var Qe=Symbol("listenerRegistrations"),pe=class{[Ee]=void 0;[Qe]=void 0;[I]=void 0;addEventListener(e,n,r){if(n==null)return;let o=r===!0||typeof r=="object"&&r.capture===!0,s=typeof r=="object"&&r.once===!0,i=typeof r=="object"?r.signal:void 0;if(i?.aborted)return;let a=yn(o),l=this[Qe];l||(l=new Map,this[Qe]=l);let c=l.get(e);c||(c={},l.set(e,c));let m=c[a];if(m||(m=new Map,c[a]=m),m.has(n))return;let p=this,h={type:e,listener:n,capture:o,once:s,normalizedListener:n,signal:i};(s||i)&&(h.normalizedListener=function(...k){if(h.signal?.aborted){Nt(p,h);return}return h.once&&Nt(p,h),typeof h.listener=="object"?h.listener.handleEvent(...k):h.listener.call(this,...k)});let g=this[Ee];g||(g=new Map,this[Ee]=g);let O=g.get(e);O||(O={},g.set(e,O));let b=O[a];if(b||(b=new Set,O[a]=b),m.set(n,h),b.add(h),i){let E=()=>{Nt(p,h)};h.abortListener=E,i.addEventListener("abort",E,{once:!0})}this[I]?.defaultView[Ne].addEventListener?.(this,e,n,r)}removeEventListener(e,n,r){return oo.call(this,e,n,r)}dispatchEvent(e){if(e[Pe])throw C("Failed to execute \'dispatchEvent\' on \'EventTarget\': The event is already being dispatched.","InvalidStateError");e[Pe]=!0;try{let n=[],r=this;for(;r!=null;)n.push(r),r=r.parentNode;e.target=this,e.srcElement=this,e[Ae]=n;for(let s=n.length;s--;)if(hn(e,n[s],gt),e.cancelBubble)return!e.defaultPrevented;let o=e.bubbles?n:n.slice(0,1);for(let s=0;s<o.length;s++)if(hn(e,o[s],pn),e.cancelBubble)return!e.defaultPrevented;return!e.defaultPrevented}finally{e[Pe]=!1,e.cancelBubble=!1,e[_e]=!1,e.eventPhase=ht,e.currentTarget=null,e[Ae]=[]}}};function oo(t,e,n){if(e==null)return;let r=n===!0||n&&n.capture===!0,o=yn(!!r),s=this[Qe]?.get(t)?.[o]?.get(e);s&&Nt(this,s)}function yn(t){return t?"capture":"bubble"}function Nt(t,e){let n=yn(e.capture),r=t[Qe],o=r?.get(e.type);if(!o)return;let s=o[n];if(!s||s.get(e.listener)!==e)return;s.delete(e.listener),s.size===0&&delete o[n],!o.bubble&&!o.capture&&r?.delete(e.type),e.signal&&e.abortListener&&e.signal.removeEventListener("abort",e.abortListener);let i=t[Ee],a=i?.get(e.type);if(!a)return;let l=a[n];l?.delete(e)&&(l.size===0&&delete a[n],!a.bubble&&!a.capture&&i?.delete(e.type),t[I]?.defaultView[Ne].removeEventListener?.(t,e.type,e.listener,e.capture))}var Q=class extends Array{item(e){return this[e]??null}};var et=0,er=1,Nn=2,Tn=3,tt=4,tr=0,nr=1,xt=2,vt=3,rr=4,En=5,or=6,sr=7,Tt=/^(?:--|-?[A-Za-z_\\u0080-\\u{10FFFF}])[A-Za-z0-9_\\u0080-\\u{10FFFF}-]*$/u;function so(t,e){let n=1,r=null;for(let o=e;o<t.length;o++){let s=t[o];if(r){s==="\\\\"?o++:s===r&&(r=null);continue}if(s===\'"\'||s==="\'")r=s;else if(s==="(")n++;else if(s===")"&&--n===0)return[t.slice(e,o),o+1]}return[t.slice(e),t.length]}function W(t){throw C(`Invalid or unsupported selector: "${t}"`,"SyntaxError")}function St(t,e){let n=typeof e=="string"?nt(e):[{combinator:tt,matchers:e}],r=null,o=t[R];return o&&n[0].matchers.length&&wn(o,n,s=>(r=s,!1)),r}function Ot(t,e){let n=typeof e=="string"?nt(e):[{combinator:tt,matchers:e}],r=new Q,o=t[R];return o&&n[0].matchers.length&&wn(o,n,s=>{r.push(s)}),r}function nt(t,e=!1,n=!1){let r={combinator:tt,matchers:[]},o=[r],s=/[\\t\\n\\f\\r ]*?([>\\t\\n\\f\\r +~]?)[\\t\\n\\f\\r ]*?(?:(?:\\[[\\t\\n\\f\\r ]*([^\\]=\\t\\n\\f\\r ]+)[\\t\\n\\f\\r ]*(?:=[\\t\\n\\f\\r ]*(?:([\'"])(.*?)\\3|([^\\]\\t\\n\\f\\r ]+)))?[\\t\\n\\f\\r ]*(?:\\]|$))|([#.]?)([^\\t\\n\\f\\r #.[>:+~()]+)|:(\\w+)(\\()?)/gi,i=t.replace(/^[\\t\\n\\f\\r ]+|[\\t\\n\\f\\r ]+$/g,"");i===""&&W(t);let a=0,l;for(;l=s.exec(i);){l.index!==a&&W(t),l[1]&&(r.matchers.length===0&&!(n&&o.length===1)&&W(t),l[1]===">"?r.combinator=er:l[1]==="+"?r.combinator=Tn:l[1]==="~"?r.combinator=Nn:r.combinator=et,r={combinator:tt,matchers:[]},o.push(r));let c=l[8]?G(l[8]):l[2]||l[7];l[7]!=null&&!l[6]&&r.matchers.length>0&&W(t);let p,h=l[4]??l[5]??l[7];if(l[2]){Tt.test(c)||W(t);let g=l[5],O=g?.[0];if(l[3]==null&&(O===\'"\'||O==="\'")){let b=l[0].lastIndexOf(g);h=i.slice(l.index+b+1),s.lastIndex=i.length}else g!=null&&!Tt.test(g)&&W(t);p=rr}else l[6]?(Tt.test(c)||W(t),p=l[6]==="#"?xt:vt):l[8]?p=l[9]==null?En:or:l[7]==="*"?p=tr:l[7]&&Tt.test(l[7])?p=nr:W(t);l[9]?([h,s.lastIndex]=so(i,s.lastIndex),c!=="has"&&c!=="not"&&W(t),c==="has"&&e&&W(t),nt(h,e||c==="has",c==="has")):p===En&&W(t),r.matchers.push({type:p,name:c,value:h}),a=s.lastIndex}return(a!==i.length||r.matchers.length===0)&&W(t),o}function io(t,e){let n=nt(e);return n[0]?.matchers.length?Je(t,n):!1}function ao(t,e){let n=nt(e,!0,!0),r=n[0];if(n.length===1&&r.matchers.length===0)return!1;let o=et,s={type:sr,name:":scope"};if(r.matchers.length===0?(o=r.combinator,r.matchers.push(s)):n.unshift({combinator:et,matchers:[s]}),n.some(({matchers:l})=>l.length===0))return!1;let i=o===Tn||o===Nn?t[f]:t[R];if(!i)return!1;let a=!1;return wn(i,n,()=>(a=!0,!1),t),a}function wn(t,e,n,r){let o=[],s=t;for(;s;){if(j(s)){if(Je(s,e,r)&&n(s)===!1)return!1;let i=s[R];if(i){let a=s[f];a&&o.push(a),s=i;continue}}s=s[f]??o.pop()??null}return!0}function Je(t,e,n){let{combinator:r,matchers:o}=e[e.length-1];if(r===tt){if(!wt(t,o,n))return!1;let a=e.slice(0,-1);return a.length===0||Je(t,a,n)}let s=r===er||r===et?Y:M,i=t[s];if(!i)return!1;if(r===et||r===Nn){for(;i;){if(j(i)&&wt(i,o,n)){let a=e.slice(0,-1);if(a.length===0||Je(i,a,n))return!0}i=i[s]}return!1}else{if(r===Tn&&!j(i)){for(;i&&!j(i);)i=i[s];if(!i)return!1}if(!j(i)||!wt(i,o,n))return!1;let a=e.slice(0,-1);return a.length===0||Je(i,a,n)}}function bn(t,e){return t.getAttributeNS(null,t.namespaceURI===A?G(e):e)}function wt(t,e,n){if(!t)return!1;if(Array.isArray(e)){for(let i of e)if(wt(t,i,n)===!1)return!1;return!0}let{type:r,name:o,value:s}=e;switch(r){case tr:return o==="*";case nr:return t.namespaceURI===A?t.localName===G(o):t.localName===o;case xt:return bn(t,"id")===o;case vt:let i=bn(t,"class");return i?ft(i).includes(o):!1;case rr:let a=bn(t,o);return s==null?a!=null:a===s;case sr:return t===n;case En:W(`:${o}`);case or:switch(o){case"has":return ao(t,s||"");case"not":return!io(t,s||"");default:W(`:${o}(${s})`)}}return!1}function lo(t){return t.nodeType===ke}function rt(t){return K in t}function vn(t){return t.nodeType===Ie}function co(t){return t.nodeType===Me}function j(t){return t.nodeType===X}function xn(t){return t.nodeType===fe}function cr(t){return"appendChild"in t}function Rt(t){let e=[],n=[t],r=new Set(n),o=new Set,s;for(;n.length>0;){let i=n.pop();if(r.delete(i),o.has(i))continue;let a=[];for(let l of st(i)){if(o.has(l)||(o.add(l),e.push(l),a.push(l),!j(l)))continue;let c=l[ne];if(c)for(let p of c)o.has(p)||(o.add(p),e.push(p));let m=l[se];m&&!o.has(m)&&!r.has(m)&&(r.add(m),n.push(m))}s??=a}return{nodes:e,treeNodes:s}}function ot(t,e){for(let n of t)n[I]=e}function ir(t,e){let n=t.constructor,r=new n(t.name,t.value,t.namespaceURI);return r[I]=e,r}function ar(t,e){if(vn(t))return e.createTextNode(t.data);if(co(t))return e.createComment(t.data);if(lo(t))return ir(t,e);if(j(t)){let n=e[Ce](t[v],t.namespaceURI,t[ue],t.localName);if(t[ne])for(let r=0;r<t[ne].length;r++){let o=t[ne].item(r);n.attributes.setNamedItem(ir(o,e))}return n}else{if(xn(t))return e.createDocumentFragment();{let n=new t.constructor;return n[I]=e,n}}}function At(t,e,n=t.ownerDocument){if(t.nodeType===Te)throw C("Cannot clone a document node","NotSupportedError");let r=ar(t,n);if(!e||!j(t)&&!xn(t))return r;let o=new Set([t]),s=[{source:t,destination:r,childIndex:0,cloningContent:!1}];for(;s.length>0;){let i=s[s.length-1],a,l;if(i.cloningContent)if(i.contentSource&&i.contentDestination)a=i.contentSource.childNodes[i.childIndex++],l=i.contentDestination;else{s.pop(),i.appendTo&&i.appendTo.appendChild(i.destination);continue}else if(a=i.source.childNodes[i.childIndex++],l=i.destination,!a){if(i.cloningContent=!0,i.childIndex=0,j(i.source)&&i.source.namespaceURI===A&&i.source.localName==="template"){let m=i.source[se];m&&(o.has(m)&&lr(),o.add(m),i.contentSource=m,i.contentDestination=i.destination.content)}continue}if(!a){s.pop(),i.appendTo&&i.appendTo.appendChild(i.destination);continue}o.has(a)&&lr(),o.add(a);let c=ar(a,n);j(a)||xn(a)?s.push({source:a,destination:c,appendTo:l,childIndex:0,cloningContent:!1}):l.appendChild(c)}return r}function lr(){throw new Error("Cannot clone a cyclic or repeated node graph")}function _t(t,e){let n=String(e);return n===""?null:St(t,[{type:xt,name:n}])}function Pt(t,e){let n=[...new Set(ft(String(e)))];return Ot(t,n.map(r=>({type:vt,name:r})))}function Ct(t,e){let n=String(e),r=G(n),o=[];for(let s of kt(t))j(s)&&(n==="*"||(s.namespaceURI===A?s[v]===r:s[v]===n))&&o.push(s);return o}function kt(t){let e=[],n=[],r=t[R];for(;r;){e.push(r);let o=r[R],s=r[f];o?(s&&n.push(s),r=o):r=s??n.pop()??null}return e}function st(t){let e=kt(t);return e.unshift(t),e}var J=class extends pe{nodeType=qn;[v]="";[Y]=null;[me]=null;[R]=null;[M]=null;[f]=null;[U]=!1;get[D](){return this[I].defaultView[Ne]}get localName(){return this[v]}get nodeName(){return this[v]}get ownerDocument(){return this[I]}get isConnected(){return this[U]}isDefaultNamespace(e){let n=ie(e);return uo(this)===n}get parentNode(){return this[Y]}set parentNode(e){}get parentElement(){let e=this[Y];return!e||e.nodeType!==1?null:e}set parentElement(e){}get previousSibling(){return this[M]}set previousSibling(e){}get nextSibling(){return this[f]}set nextSibling(e){}get previousElementSibling(){let e=this[M];for(;e&&e.nodeType!==1;)e=e[M];return e}set previousElementSibling(e){}get nextElementSibling(){let e=this[f];for(;e&&e.nodeType!==1;)e=e[f];return e}set nextElementSibling(e){}get firstChild(){return this[R]}set firstChild(e){}get lastChild(){let e=this[R];for(;e;){let n=e[f];if(n==null)break;e=n}return e}set lastChild(e){}get nodeValue(){return rt(this)?this.data:null}set nodeValue(e){rt(this)&&(this.data=e)}get textContent(){if(rt(this))return this.data;let e="";for(let n of kt(this))vn(n)&&(e+=n.data);return e}set textContent(e){if(rt(this))this.data=e;else if(cr(this)){let n=e==null?"":String(e);n===""?this.replaceChildren():this.replaceChildren(n)}}cloneNode(e){return At(this,e)}contains(e){let n=e;for(;n!=null;){if(n===this)return!0;n=n.parentNode}return!1}};function uo(t){let e=t;for(;e;)switch(e.nodeType){case X:{let n=e;if(n.prefix==null&&n.namespaceURI!=null)return n.namespaceURI;let r=n.attributes.getNamedItemNS(Xe,"xmlns");if(r!=null&&r.prefix==null)return ie(r.value);e=n.parentElement;break}case Te:e=e.documentElement;break;case Yn:case fe:return null;case ke:e=e.ownerElement;break;default:e=e.parentElement}return null}var ee=Symbol("insertNode"),Rn=Symbol("preflightInsertions"),It=Symbol("replaceNode"),he=class extends J{remove(){let e=this.parentNode;e&&e.removeChild(this)}replaceWith(...e){let n=xe(e),r=this.parentNode;if(r)return Sn(o=>{ae(r,n);let s=this[f];for(;s&&n.includes(s);)s=s[f];let i=On(r,n,o);this.parentNode===r?r[It](i,this,o):r[ee](i,s,o)})}before(...e){let n=xe(e),r=this.parentNode;if(r)return Sn(o=>{ae(r,n);let s=this[M];for(;s&&n.includes(s);)s=s[M];let i=On(r,n,o);r[ee](i,s?s[f]:r.firstChild,o)})}after(...e){let n=xe(e),r=this.parentNode;if(r)return Sn(o=>{ae(r,n);let s=this[f];for(;s&&n.includes(s);)s=s[f];let i=On(r,n,o);r[ee](i,s,o)})}};function Sn(t){return B(()=>{let e=[];try{t(e)}catch(n){try{we(e)}catch{}throw n}we(e)})}function xe(t){return t.map(e=>e instanceof J?e:String(e))}function it(t,e){return e instanceof J?e:t.ownerDocument.createTextNode(String(e))}function ae(t,e){for(let n of e){if(!(n instanceof J))continue;let r=t;for(;r;){if(r===n)throw C("Cannot insert a node into itself or one of its descendants","HierarchyRequestError");r=r[Y]??r[me]}}}function On(t,e,n){let r=[];for(let s of e)r.push(it(t,s));if(r.length===1)return r[0];let o=t.ownerDocument.createDocumentFragment();o[Rn](r);for(let s of r)o[ee](s,null,n);return o}var Mt,An=0,ur=0,dr=0,mr=0,De=!1,Pn=!1,at=!1,Dt=class{#t;#n=[];#e=new Set;#r=!1;constructor(e){if(typeof e!="function")throw new TypeError("MutationObserver callback must be a function");this.#t=e}observe(e,n={}){let r=mo(n),o=Mt??=new WeakMap,s=o.get(e);s==null&&(s=new Map,o.set(e,s));let i=s.get(this);i==null?An++:_n(i,-1),s.set(this,r),_n(r,1),this.#e.add(e)}disconnect(){let e=Mt;if(e!=null){for(let n of this.#e){let r=e.get(n),o=r?.get(this);o!=null&&(r.delete(this),An--,_n(o,-1)),r?.size===0&&e.delete(n)}this.#e.clear(),this.#n.length=0,An===0&&(Mt=void 0)}}takeRecords(){return this.#n.splice(0)}enqueue(e){this.#n.push(e),!this.#r&&(this.#r=!0,queueMicrotask(()=>{this.#r=!1;let n=this.takeRecords();n.length>0&&this.#t.call(this,n,this)}))}};function te(t){let e=Mt;if(e==null)return;let n=new Map,r=t.target;for(;r;){let o=e.get(r);if(o)for(let[s,i]of o){if(r!==t.target&&!i.subtree)continue;let a=!1;if(t.type==="attributes"){if(!i.attributes||i.attributeFilter&&!i.attributeFilter.has(t.attributeName??""))continue;a=i.attributeOldValue}else if(t.type==="characterData"){if(!i.characterData)continue;a=i.characterDataOldValue}else if(!i.childList)continue;n.set(s,n.get(s)===!0||a)}r=r.parentNode}for(let[o,s]of n)o.enqueue({addedNodes:t.addedNodes??new Q,attributeName:t.attributeName??null,attributeNamespace:t.attributeNamespace??null,nextSibling:t.nextSibling??null,oldValue:s?t.oldValue??null:null,previousSibling:t.previousSibling??null,removedNodes:t.removedNodes??new Q,target:t.target,type:t.type})}function Lt(...t){let e=new Q;return e.push(...t),e}function mo(t){if(t.attributes===!1&&(t.attributeOldValue||t.attributeFilter!=null))throw new TypeError("attributeOldValue and attributeFilter require attributes to be enabled");if(t.characterData===!1&&t.characterDataOldValue)throw new TypeError("characterDataOldValue requires characterData to be enabled");let e=t.attributes??(t.attributeOldValue===!0||t.attributeFilter!=null),n=t.characterData??t.characterDataOldValue===!0,r=t.childList===!0;if(!e&&!n&&!r)throw new TypeError("MutationObserver options must enable childList, attributes, or characterData");return{attributes:e,attributeFilter:t.attributeFilter==null?void 0:new Set(t.attributeFilter.map(String)),attributeOldValue:t.attributeOldValue===!0,characterData:n,characterDataOldValue:t.characterDataOldValue===!0,childList:r,subtree:t.subtree===!0}}function _n(t,e){t.attributes&&(ur+=e),t.characterData&&(dr+=e),t.childList&&(mr+=e),De=ur>0,Pn=dr>0,at=mr>0}var re=class extends he{childNodes=new Q;children=new Q;appendChild(e){return B(()=>this[ee](e,null))}insertBefore(e,n){return B(()=>this[ee](e,n||null))}append(...e){return B(()=>{let n=xe(e.filter(r=>r!=null));n.length>1&&ae(this,n);for(let r of n)this[ee](it(this,r),null)})}prepend(...e){return B(()=>{let n=xe(e.filter(o=>o!=null));n.length>1&&ae(this,n);let r=this.firstChild;for(let o of n)this[ee](it(this,o),r)})}replaceChildren(...e){return B(()=>{let n=xe(e.filter(o=>o!=null));ae(this,n);let r;for(;r=this.firstChild;)this.removeChildImmediately(r);for(let o of n)this[ee](it(this,o),null)})}removeChild(e){return B(()=>(this.removeChildImmediately(e),e))}removeChildImmediately(e){if(e.parentNode!==this)throw C("The node is not a child of this node","NotFoundError");let n=this[U]?st(e):void 0,r=e[M],o=e[f],s=Gt(this,e);if(n)for(let i of n)i[U]=!1;this.queueRemovalMutationRecord(this,e,r,o),n&&this.enqueueTreeReactions(n,"disconnectedCallback"),we(this.collectRemovalHookEffects(e,s))}replaceChild(e,n){return B(()=>this[It](e,n))}[It](e,n,r){if(ae(this,[e]),n.parentNode!==this)throw C("The reference node is not a child of this parent","NotFoundError");let o=n[M],s=n[f],i=this.prepareInsertion(e),a=this[U]?st(n):void 0,l=new Set(i.map(({node:h})=>h)),c=s;for(;c&&l.has(c);)c=c[f];let m=Gt(this,n);if(a){for(let g of a)g[U]=!1;let h=new Set(a);for(let g of i)h.has(g.node)&&(g.shouldDisconnect=!1)}this.commitInsertion(i,c);let p=this[U];return this.queueRemovalMutationRecord(this,n,o,s),this.queueInsertionMutationRecords(i),a&&this.enqueueTreeReactions(a,"disconnectedCallback"),this.enqueueInsertionReactions(i,p),this.performOrCollectHookEffects([...this.collectRemovalHookEffects(n,m),...this.collectInsertionHookEffects(i)],r),n}querySelectorAll(e){return Ot(this,e)}querySelector(e){return St(this,e)}[ee](e,n,r){return this.validateInsertion(e,n),this.insertIntoValidated(e,n,r),e}[Rn](e){for(let n of e)this.validateInsertion(n,null),this.prepareInsertion(n)}validateInsertion(e,n){if(ae(this,[e]),n&&n.parentNode!==this)throw C("The reference node is not a child of this parent","NotFoundError")}insertIntoValidated(e,n,r){e===n&&(n=e[f]);let o=this.prepareInsertion(e);this.commitInsertion(o,n);let s=this[U];this.queueInsertionMutationRecords(o),this.enqueueInsertionReactions(o,s),this.performOrCollectHookEffects(this.collectInsertionHookEffects(o),r)}performOrCollectHookEffects(e,n){n?n.push(...e):we(e)}prepareInsertion(e){let n=[];if(e.nodeType===fe){let i=e[R];for(;i;)n.push(i),i=i[f]}else n.push(e);let r=this[U],o=this[I],s=[];for(let i of n){let a=i[U],l=a||r,c,m;if(i[I]===o)l&&(c=st(i));else{let p=Rt(i);m=p.nodes,l&&(c=p.treeNodes)}s.push({node:i,nodes:c,adoption:m,shouldDisconnect:a})}return s}commitInsertion(e,n){for(let s of e){let i=s.node[Y];if(i){let a=s.node[M],l=s.node[f];s.source={parent:i,index:Gt(i,s.node),previousSibling:a,nextSibling:l}}}for(let s of e){let i=this.attachChild(s.node,n);s.insertIndex=i.index,s.previousSibling=i.previousSibling,s.nextSibling=i.nextSibling}let r=this[I];for(let{adoption:s}of e)s&&ot(s,r);let o=this[U];for(let{nodes:s}of e)if(s)for(let i of s)i[U]=o}attachChild(e,n){if(n){let s=n[M];e[f]=n,e[M]=s,s?s[f]=e:this[R]=e,n[M]=e}else{e[f]=null;let s=this[R];if(s){let i;for(;i=s[f];)s=i;s[f]=e,e[M]=s}else this[R]=e,e[M]=null}let r=j(e);e[Y]=this;let o;if(n){if(o=this.childNodes.indexOf(n),this.childNodes.splice(o,0,e),r){let s=n;for(;s&&!j(s);)s=s[f];s?this.children.splice(this.children.indexOf(s),0,e):this.children.push(e)}}else o=this.childNodes.length,this.childNodes.push(e),r&&this.children.push(e);return{index:o,previousSibling:e[M],nextSibling:e[f]}}queueRemovalMutationRecord(e,n,r,o){at&&te({type:"childList",target:e,removedNodes:Lt(n),previousSibling:r,nextSibling:o})}queueInsertionMutationRecords(e){if(at)for(let n of e){let{node:r,source:o}=n;o&&this.queueRemovalMutationRecord(o.parent,r,o.previousSibling,o.nextSibling),te({type:"childList",target:this,addedNodes:Lt(r),previousSibling:n.previousSibling,nextSibling:n.nextSibling})}}collectRemovalHookEffects(e,n){return this.nodeType!==X||Ze(this)?[]:[[()=>this[D].removeChild?.(this,e,n)]]}collectInsertionHookEffects(e){let n=[];for(let r of e){let{node:o,source:s}=r;s?.parent.nodeType===X&&!Ze(s.parent)&&n.push([()=>s.parent[D].removeChild?.(s.parent,o,s.index)]),this.nodeType===X&&!Ze(this)&&n.push([()=>this[D].insertChild?.(this,o,r.insertIndex),o])}return n}enqueueInsertionReactions(e,n){for(let r of e){let{nodes:o}=r;o&&(r.shouldDisconnect&&this.enqueueTreeReactions(o,"disconnectedCallback"),n&&this.enqueueTreeReactions(o,"connectedCallback"))}}enqueueTreeReactions(e,n){pr(e,n)}};function fr(t,e,n,r){if(e.parentNode!==t)throw Error("not a child of this node");let o=t[U]?n.treeNodes:void 0,s=e[M],i=e[f],a=Gt(t,e);if(o)for(let c of o)c[U]=!1;ot(n.nodes,r),at&&te({type:"childList",target:t,removedNodes:Lt(e),previousSibling:s,nextSibling:i}),o&&pr(o,"disconnectedCallback");let l=[];t.nodeType===X&&!Ze(t)&&l.push([()=>t[D].removeChild?.(t,e,a)]),we(l)}function Gt(t,e){let n=e[M],r=e[f];n?n[f]=r:t[R]=r,r&&(r[M]=n);let o=t.childNodes.indexOf(e);return t.childNodes.splice(o,1),j(e)&&t.children.splice(t.children.indexOf(e),1),e[Y]=null,e[f]=null,e[M]=null,o}function pr(t,e){for(let n of t){let r=n[e];typeof r=="function"&&bt(n,()=>r.call(n))}}function lt(t,e,n,r,o){let{observedAttributes:s}=t.constructor,{attributeChangedCallback:i}=t;i==null||s==null||!s.includes(e)||bt(t,()=>i.call(t,e,n,r,o))}var Ht=class{[R]=null;constructor(e){this[q]=e}getNamedItem(e){let n=String(e),r=this[q][S]===A?G(n):n,o=this[R];for(;o;){if(o.name===r)return o;o=o[f]}return null}getNamedItemNS(e,n){let r=ie(e),o=String(n),s=this[R];for(;s;){if(s.localName===o&&s[S]===r)return s;s=s[f]}return null}item(e){let n=this[R],r=0;for(;n;){if(r++===e)return n;n=n[f]}return null}get length(){let e=0,n=this[R];for(;n;)e++,n=n[f];return e}removeNamedItem(e){let n=String(e),r=this[q][S]===A?G(n):n;return B(()=>this.removeNamedItemImmediately(o=>o.name===r))}removeNamedItemNS(e,n){let r=ie(e),o=String(n);return B(()=>this.removeNamedItemImmediately(s=>s.localName===o&&s[S]===r))}removeNamedItemImmediately(e){let n=this[q],r=this[R],o=null;for(;r!=null;){if(e(r)){o&&(o[f]=r[f]),this[R]===r&&(this[R]=r[f]);let s=r.value;return r[f]=null,r[q]=null,De&&te({type:"attributes",target:n,attributeName:r.name,attributeNamespace:r[S],oldValue:s}),n[D].removeAttribute?.(n,r.name,r[S]),lt(n,r.localName,s,null,r[S]),r}o=r,r=r[f]}return null}setNamedItem(e){return B(()=>this.setNamedItemImmediately(e))}setNamedItemImmediately(e){let n=this[q],r=e[q];if(r!=null&&r!==n)throw C("The attribute is already in use by another element.","InUseAttributeError");let o=null,s=this[R],i=null;for(;s;){if(s.localName===e.localName&&s[S]===e[S]){if(s===e)return s;i?i[f]=e:this[R]=e,e[f]=s[f],s[f]=null,o=s;break}i=s,s=s[f]}o==null&&(i?i[f]=e:this[R]=e),e[q]=n,e[I]=n[I],o&&(o[q]=null);let a=o==null||o.value!==e.value,l=o!=null&&o.name!==e.name;return a&&De&&te({type:"attributes",target:n,attributeName:e.name,attributeNamespace:e[S],oldValue:o?.value??null}),l&&n[D].removeAttribute?.(n,o.name,o[S]),(a||l)&&n[D].setAttribute?.(n,e.name,e.value,e[S]),a&<(n,e.localName,o?.value??null,e.value,e[S]),o}setNamedItemNS(e){return this.setNamedItem(e)}*[Symbol.iterator](){let e=this[R];for(;e;)yield e,e=e[f]}};var ve=class extends J{nodeType=ke;[S]=null;[f]=null;[q]=null;constructor(e,n,r){super(),this[v]=e,this[de]=n,r&&(this[S]=r)}get nodeName(){return this[v]}set nodeName(e){}get name(){return this[v]}set name(e){}get localName(){if(this[S]==null)return this[v];let e=this[v].indexOf(":");return e<0?this[v]:this[v].slice(e+1)}get prefix(){if(this[S]==null)return null;let e=this[v].indexOf(":");return e<0?null:this[v].slice(0,e)}get value(){return this[de]}set value(e){let n=String(e),r=this[q];if(!r){this[de]=n;return}B(()=>{let o=this[de];this[de]=n,De&&o!==n&&te({type:"attributes",target:r,attributeName:this[v],attributeNamespace:this[S],oldValue:o}),this[D].setAttribute?.(r,this[v],n,this[S]),lt(r,this.localName,o,n,this[S])})}get nodeValue(){return this.value}set nodeValue(e){this.value=e}get ownerElement(){return this[q]}get namespaceURI(){return this[S]}get specified(){return!0}};var fo={amp:"&",AMP:"&",apos:"\'",gt:">",GT:">",lt:"<",LT:"<",quot:\'"\',QUOT:\'"\'},po=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),ho=/(?:<([a-z][a-z0-9-:]*)((?:[\\s]+[^<>\'"=/\\s]+(?:=([\'"])[^]*?\\3|=[^>\'"\\s]*|))*)[\\s]*(\\/?)\\s*>|<\\/([a-z][a-z0-9-:]*)>|<!--(.*?)-->|([^<>]+))/gi,yr=/\\s([^<>\'"=/\\n\\s]+)(?:=(["\'])([\\s\\S]*?)\\2|=([^>\'"\\n\\s]*)|)/g,go="|b|big|blockquote|body|br|center|code|dd|div|dl|dt|em|embed|h1|h2|h3|h4|h5|h6|head|hr|i|img|li|listing|menu|meta|nobr|ol|p|pre|ruby|s|small|span|strong|strike|sub|sup|table|tt|u|ul|var|",yo=/^(?:color|face|size)$/i;function hr(t){return t.replace(/&(?:(amp|AMP|apos|gt|GT|lt|LT|quot|QUOT)|#(\\d+)|#[xX]([\\da-fA-F]+));/g,(e,n,r,o)=>{if(n)return fo[n];let s=Number.parseInt(r??o,r?10:16);try{return String.fromCodePoint(s)}catch{return e}})}function br(t){return t.namespaceURI===A&&po.has(t.localName)}function gr(t){let e=t.localName;return t[S]===Z&&(e==="foreignObject"||e==="desc"||e==="title")}function bo(t,e){if(go.includes(`|${t}|`))return!0;if(t!=="font")return!1;for(let n of e.matchAll(yr))if(yo.test(n[1]))return!0;return!1}function Ut(t,e){let n=e.ownerDocument,r=n.createDocumentFragment(),o=[],s=r;for(let i of t.matchAll(ho)){let a=i[1];if(a){let l=i[2],c=G(a),m=o[o.length-1]?.element??e,p=m[S]===Z?Z:A;if(c==="svg")p=Z;else if(p===Z){if(gr(m))p=A;else if(bo(c,l)){for(;o.length>0;){let O=o[o.length-1];if(O.element[S]!==Z||gr(O.element))break;o.pop(),s=O.target}p=A}}let h=p===A?c:a,g=n[Ce](h,p,null,h);for(let O of l.matchAll(yr))g.setAttribute(O[1],hr(O[3]||O[4]||""));if(s.append(g),br(g)||p!==A&&i[4])continue;o.push({element:g,target:s}),s=p===A&&c==="template"?g.content:g}else if(i[5]){let l=G(i[5]);for(let c=o.length-1;c>=0;c--){let m=o[c],p=G(m.element[v]);if(p===l){s=m.target,o.length=c;break}if(m.element[S]===A&&p==="template")break}}else i[6]?s.append(n.createComment(i[6])):s.append(hr(i[7]))}return r}function Vt(t){return Nr([{type:"content",child:t[R]}])}function Er(t){return Nr([{type:"opening",node:t}])}function Nr(t){let e=[],n;for(;n=t.pop();)switch(n.type){case"opening":{let r=n.node;switch(r.nodeType){case X:{let o=r;e.push(`<${o[v]}`);let s=o[ne]?.[R];for(;s;){e.push(` ${s[v]}`);let a=s[de];a!==""&&(a=String(a).replace(/&/g,"&").replace(/"/g,"""),e.push(`="${a}"`)),s=s[f]}if(e.push(">"),br(o))break;let i=o.namespaceURI===A&&o.localName==="template"?o[se]:o;t.push({type:"closing",name:o[v]}),t.push({type:"content",child:i?.[R]??null});break}case Ie:{let o=r;e.push(o[K].replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">"));break}case Me:{let o=r;e.push(`<!--${o[K]}-->`);break}}break}case"content":{let r=n.child;r&&(t.push({type:"content",child:r[f]}),t.push({type:"opening",node:r}));break}case"closing":e.push(`</${n.name}>`);break}return e.join("")}var H=class extends re{nodeType=X;[S]=A;[ue]=null;get namespaceURI(){return this[S]}get prefix(){return this[ue]}get localName(){let e=this[ue];return e==null?this[v]:this[v].slice(e.length+1)}get nodeName(){return this[S]===A?Xn(this[v]):this[v]}get tagName(){return this.nodeName}get id(){return this.getAttributeNS(null,"id")??""}set id(e){this.setAttribute("id",String(e))}get slot(){return this.getAttributeNS(null,"slot")??""}set slot(e){let n=String(e);this.getAttributeNS(null,"slot")!==n&&this.attributes.setNamedItem(new ve("slot",n))}get attributes(){let e=this[ne];return e||(e=new Ht(this),this[ne]=e),e}getAttributeNames(){return[...this.attributes].map(e=>e.name)}getElementsByTagName(e){return Ct(this,e)}get firstElementChild(){return this.children[0]??null}getElementsByClassName(e){return Pt(this,e)}get lastElementChild(){return this.children[this.children.length-1]??null}get nextElementSibling(){let e=this.nextSibling;for(;e&&e.nodeType!==1;)e=e.nextSibling;return e}get previousElementSibling(){let e=this.previousSibling;for(;e&&e.nodeType!==1;)e=e.previousSibling;return e}setAttribute(e,n){let r=String(e),o=String(n);mn(r);let s=this[S]===A?G(r):r,i=this.attributes.getNamedItemNS(null,s);i?i.value=o:this.attributes.setNamedItem(new ve(s,o))}setAttributeNS(e,n,r){let o=ie(e),s=String(n),i=String(r),a=pt(o,s,"attribute"),l=this.attributes.getNamedItemNS(a.namespace,a.localName);l?l.value=i:this.attributes.setNamedItemNS(new ve(a.qualifiedName,i,a.namespace))}toggleAttribute(e,n){let r=String(e);mn(r);let o=this[S]===A?G(r):r,s=this.attributes.getNamedItemNS(null,o),i=n===void 0?void 0:!!n;return s==null?i===!1?!1:(this.attributes.setNamedItem(new ve(o,"")),!0):i===!0?!0:(this.attributes.removeNamedItemNS(null,o),!1)}getAttribute(e){let n=this.attributes.getNamedItem(e);return n&&n.value}getAttributeNS(e,n){let r=this.attributes.getNamedItemNS(e,n);return r&&r.value}hasAttribute(e){return this.attributes.getNamedItem(e)!=null}hasAttributeNS(e,n){return this.attributes.getNamedItemNS(e,n)!=null}removeAttribute(e){let n=String(e),r=this[S]===A?G(n):n;this.attributes.removeNamedItemNS(null,r)}removeAttributeNS(e,n){this.attributes.removeNamedItemNS(e,n)}get outerHTML(){return Er(this)}get innerHTML(){return Vt(this)}set innerHTML(e){if(e==null||e==="")this.replaceChildren();else{let n=Ut(String(e),this);this.replaceChildren(n)}}};var Le=class t extends H{[S]=Z;get ownerSVGElement(){let e=null,n=this.parentNode;for(;n instanceof t;)e=n,n=n.parentNode;return e}};var ge=class extends he{[K]="";constructor(e){super(),this[K]=e==null?"":String(e)}setData(e){let n=Pn,r=n?this[K]:null,o="";e!=null&&(o=typeof e=="string"?e:String(e)),this[K]=o,n&&r!==o&&te({type:"characterData",target:this,oldValue:r}),this[D].setText?.(this,o)}get data(){return this[K]}set data(e){this.setData(e)}};var Ge=class extends ge{nodeType=Ie;[v]="#text"};var He=class extends ge{nodeType=Me;[v]="#comment"};var Ue=class extends re{nodeType=fe;[v]="#document-fragment";[I]=typeof window<"u"?window.document:null;getElementById(e){return _t(this,e)}};var Ve=class extends H{get content(){let e=this[se];return e||(e=this.ownerDocument.createDocumentFragment(),e[me]=this,this[se]=e),e}set content(e){}set innerHTML(e){this.content.replaceChildren(Ut(String(e),this))}get innerHTML(){let e=this[se];return e?Vt(e):""}};var Bt=class extends H{};var zt=class extends H{};var jt=class extends H{};var ct=class extends re{nodeType=Te;[v]="#document";[U]=!0;constructor(e){super(),this.defaultView=e,this[I]=this,this.documentElement=qt(new jt,this,"html"),this.body=qt(new Bt,this,"body"),this.head=qt(new zt,this,"head"),this.appendChild(this.documentElement),this.documentElement.appendChild(this.head),this.documentElement.appendChild(this.body)}get textContent(){return null}set textContent(e){}getElementsByClassName(e){return Pt(this,e)}createElement(e){let n=String(e);return Zn(n),Cn(this,G(n))}createElementNS(e,n){let r=pt(e,n,"element");return Cn(this,r.qualifiedName,r.namespace,r.prefix,r.localName)}[Ce](e,n,r,o){return Cn(this,e,n,r,o)}createTextNode(e){let n=Ft(new Ge(e),this);return this[D].createText?.(n,n.data),n}createComment(e){return Ft(new He(e),this)}createDocumentFragment(){return Ft(new Ue,this)}createEvent(){return new V("")}getElementById(e){return _t(this,e)}getElementsByTagName(e){return Ct(this,e)}importNode(e,n){if(e.nodeType===Te)throw C("Cannot import a document node","NotSupportedError");return At(e,n,this)}adoptNode(e){if(e[I]===this)return e;let n=Rt(e);return B(()=>{let r=e.parentNode;return r?fr(r,e,n,this):ot(n.nodes,this),e})}};function Ft(t,e){return Object.defineProperty(t,I,{value:e,writable:!0,enumerable:!1}),t}function Cn(t,e,n=A,r=null,o=e){let s;if(n===Z)s=new Le;else if(n===A&&o==="template")s=new Ve;else if(n===A){let i=t.defaultView.customElements.get(o);s=i?new i:new H}else s=new H;return qt(s,t,e,n,r)}function qt(t,e,n,r=A,o=null){return Ft(t,e),Object.defineProperties(t,{[v]:{value:n},[S]:{value:r},[ue]:{value:o}}),e[D].createElement?.(t,r),t}var Yt=class extends V{constructor(e,n){super(e,n),this.detail=n?.detail??null}initCustomEvent(e,n,r,o){super.initEvent(e,n,r),this.detail=o??null}};var Wt=class extends V{constructor(e,n){super(e,n),this.message=n.message,this.filename=n.filename,this.lineno=n.lineno,this.colno=n.colno,this.error=n.error}};var Xt=class extends V{constructor(e,n){super(e,n),this.promise=n.promise,this.reason=n.reason}};var $t=class extends V{constructor(e,n){super(e,n),this.oldState=n.oldState,this.newState=n.newState}};var Kt=class extends V{constructor(e,n={}){super(e,n),this.relatedTarget=n.relatedTarget??null}};var Zt=class extends V{constructor(e,n={}){super(e,n),this.clipboardData=n.clipboardData??null}};var Qt=class extends H{};var Eo=/^[a-z][^A-Z\\u0000\\t\\n\\f\\r />]*-[^A-Z\\u0000\\t\\n\\f\\r />]*$/u,No=new Set(["annotation-xml","color-profile","font-face","font-face-src","font-face-uri","font-face-format","font-face-name","missing-glyph"]);function Tr(t){return Eo.test(t)&&!No.has(t)}function wr(t){return C(`Invalid custom element name: "${t}"`,"SyntaxError")}var Jt=class{registry=new Map;listenersByName=new Map;define(e,n,r){if(!Tr(e))throw wr(e);if(this.registry.has(e))throw C(`A custom element named "${e}" has already been defined`,"NotSupportedError");if(this.getName(n)!=null)throw C("This constructor has already been registered in this custom element registry","NotSupportedError");this.registry.set(e,n);let o=this.listenersByName.get(e);if(o!=null){this.listenersByName.delete(e);for(let s of o)s(n)}}get(e){return this.registry.get(e)}getName(e){for(let[n,r]of this.registry)if(r===e)return n;return null}whenDefined(e){if(!Tr(e))return Promise.reject(wr(e));let n=this.registry.get(e);if(n!=null)return Promise.resolve(n);let r=this.listenersByName.get(e);return r==null&&(r=[],this.listenersByName.set(e,r)),new Promise(o=>{r.push(o)})}upgrade(e){}initialize(e){}};var To=["onerror","onunhandledrejection"],vr=Symbol.for("@remote-dom/polyfill/global-property");function Sr(t){return Object.getOwnPropertyDescriptors(t)}function Or(t){let e={};for(let[n,r]of Object.entries(Object.getOwnPropertyDescriptors(pe.prototype)))n!=="constructor"&&typeof r.value=="function"&&(r.value=kn(r.value.bind(t)),e[n]=r);return e}function Rr(t){let e={};for(let n of To)e[n]={configurable:!0,enumerable:!0,get:kn(()=>t[n]),set:kn(r=>{t[n]=r})};return e}function wo(t){return Object.assign(Sr(t),Or(t),Rr(t))}function kn(t){return Object.defineProperty(t,vr,{value:!0}),t}function xr(t,e){for(let n of Reflect.ownKeys(e)){let r=xo(t,n);(r==null||vo(r))&&Object.defineProperty(t,n,e[n])}}function xo(t,e){let n=t;for(;n;){let r=Object.getOwnPropertyDescriptor(n,e);if(r)return r;n=Object.getPrototypeOf(n)}}function vo(t){return[t.value,t.get,t.set].some(e=>typeof e=="function"&&e[vr]===!0)}var Se=class extends pe{[D]={};[mt]=[];[Ne]=Oo(this);name="";window=this;parent=this;self=this;top=this;document=new ct(this);customElements=new Jt;location=globalThis.location;navigator=globalThis.navigator;Event=V;ErrorEvent=Wt;PromiseRejectionEvent=Xt;ToggleEvent=$t;FocusEvent=Kt;ClipboardEvent=Zt;EventTarget=pe;CustomEvent=Yt;Node=J;ParentNode=re;ChildNode=he;DocumentFragment=Ue;Document=ct;CharacterData=ge;Comment=He;Text=Ge;Element=H;HTMLElement=Qt;SVGElement=Le;HTMLTemplateElement=Ve;MutationObserver=Dt;#t=null;#n=null;#e=null;static with(...e){let n=this;return class extends n{constructor(){super();for(let o of e)So(this,o)}}}get onerror(){return this.#n}set onerror(e){this.#t&&this.removeEventListener("error",this.#t),e&&typeof e=="function"?(this.#n=e,this.#t=n=>{e(n.message??"Error",n.filename,n.lineno,n.colno,n.error)},this.addEventListener("error",this.#t)):(this.#t=null,this.#n=null)}get onunhandledrejection(){return this.#e}set onunhandledrejection(e){this.#e&&this.removeEventListener("unhandledrejection",this.#e),e&&typeof e=="function"?(this.#e=e,this.addEventListener("unhandledrejection",this.#e)):this.#e=null}static setGlobal(e){let n=globalThis.self,r=globalThis.window,o=Sr(e),s=Object.assign(Or(e),Rr(e));delete o.self,Object.defineProperties(globalThis,o),xr(globalThis,s),typeof n>"u"||n===r&&n!==globalThis?Object.defineProperty(globalThis,"self",{value:e,configurable:!0,writable:!0,enumerable:!0}):n!==globalThis&&(Object.defineProperties(n,o),xr(n,s))}static setGlobalThis(e){for(let n in e)e[n]===e&&(e[n]=globalThis);Object.defineProperties(globalThis,wo(e))}};function So(t,e){t[mt].push(e(t)??{})}function Oo(t){return{createElement:le.bind(null,t,"createElement"),setAttribute:le.bind(null,t,"setAttribute"),removeAttribute:le.bind(null,t,"removeAttribute"),createText:le.bind(null,t,"createText"),setText:le.bind(null,t,"setText"),insertChild:le.bind(null,t,"insertChild"),removeChild:le.bind(null,t,"removeChild"),addEventListener:le.bind(null,t,"addEventListener"),removeEventListener:le.bind(null,t,"removeEventListener")}}function le(t,e,...n){for(let s of t[mt])s[e]?.apply(s,n);let r=t[D];r[e]?.apply(r,n)}var en=new Se;var In="~";var ye=new WeakMap;function Be(t){return ye.get(t)}var Gn=new WeakMap,Ao=0;function $(t){let e=Gn.get(t);return e==null&&(e=String(Ao++),tn(t,e)),e}function tn(t,e){Gn.set(t,e)}var Dn=new WeakMap;function _o(t){return Dn.get(t)}var Ln=new WeakMap;function Po(t){let e=Ln.get(t);if(e!=null)return e;if(!(!(t instanceof Element)||t.tagName.includes("-"))){e={};for(let{name:n,value:r}of t.attributes)e[n]=r;return e}}var Co=new WeakMap;function ko(t){return Co.get(t)}function Hn(t,e,n){let r=Dn.get(t);if(r==null&&(r={},Dn.set(t,r)),r[e]===n)return;r[e]=n;let o=ye.get(t);o?.mutate([[3,$(t),e,n,1]])}function be(t,e,n){let r=Ln.get(t);if(r==null&&(r={},Ln.set(t,r)),r[e]===n)return;n==null?delete r[e]:r[e]=String(n);let o=ye.get(t);o?.mutate([[3,$(t),e,n,2]])}function ze(t,e){if(ye.get(t)!==e&&(ye.set(t,e),t.childNodes))for(let r=0;r<t.childNodes.length;r++)ze(t.childNodes[r],e)}function nn(t){if(ye.get(t)!=null&&(ye.delete(t),t.childNodes))for(let n=0;n<t.childNodes.length;n++)nn(t.childNodes[n])}function je(t){let{nodeType:e}=t;switch(e){case 1:return{id:$(t),type:e,element:t.localName,properties:Mn(_o(t)),attributes:Mn(Po(t)),eventListeners:Mn(ko(t)),children:Array.from(t.childNodes).map(je)};case 3:case 8:return{id:$(t),type:e,data:t.data};default:throw new Error(`Cannot serialize node of type ${t.nodeType} (${typeof t.nodeType})`)}}function Mn(t){return t?{...t}:void 0}function Un(t,e,...n){let r=Gn.get(t),o=ye.get(t);if(r==null||o==null)throw new Error(`Cannot call method ${e} on an unconnected node`);return o.call(r,e,...n)}var Fe=en[D];Fe.insertChild=(t,e,n)=>{let r=Be(t);r!=null&&(ze(e,r),r.mutate([[0,$(t),je(e),n]]))};Fe.removeChild=(t,e,n)=>{let r=Be(t);r!=null&&(nn(e),r.mutate([[1,$(t),n]]))};Fe.setText=(t,e)=>{let n=Be(t);n?.mutate([[2,$(t),e]])};Fe.setAttribute=(t,e,n)=>{t.tagName.includes("-")||be(t,e,n)};Fe.removeAttribute=(t,e)=>{t.tagName.includes("-")||be(t,e)};Se.setGlobal(en);function rn(t){if(typeof t=="string")return{type:"navigate",to:t};let{place:e,record:n,where:r,section:o}=t??{},s={...r===void 0?{}:{where:r},...o===void 0?{}:{section:String(o)}};return typeof e=="string"?{type:"navigate",place:e,...s}:typeof n=="string"?{type:"navigate",to:n,...s}:void 0}var _r=["wheel","drag","pinch"];function Pr(t){let e=t;return typeof t=="object"&&t!==null&&e.graview==="host-hello"&&typeof e.nonce=="string"}function kr(t,e={}){let n,r="",o,s=0,i=new Set,a=new Map,l=[],c=b=>{n?n.postMessage({...b,nonce:r}):l.push(b)},m=b=>{let E=b.data;if(!(!E||typeof E!="object")){if(E.type==="props"){o=E.props;for(let k of i)k(E.props)}else E.type==="answer"?(a.get(E.id)?.(E),a.delete(E.id)):E.type==="event"&&typeof E.listener=="number"?e.onEvent?.(E):E.type==="heartbeat"&&typeof E.beat=="number"&&c({type:"heartbeat",beat:E.beat});e.onMessage?.(E)}},p=()=>{},h=b=>{if(n||!t.fromHost(b)||!Pr(b.data)||b.data.protocol!==1)return;let E=b.ports[0];if(E){n=E,r=b.data.nonce,n.onmessage=m,n.start?.(),p();for(let k of l.splice(0))c(k)}};p=t.listen(h),t.ready({graview:"guest-ready",protocol:1});let g,O={get props(){return o},subscribe(b){return i.add(b),()=>i.delete(b)},act(b,E={}){let k=s+=1;return new Promise(L=>{a.set(k,L),c({type:"act",id:k,name:b,args:E})})},navigate(b){let E=rn(b);E&&c(E)},size(b){c({type:"size",height:b})},autoSize(b){let E=b??globalThis.document?.documentElement,k=globalThis.ResizeObserver;if(!E||!k||typeof E.getBoundingClientRect!="function")return()=>{};g?.disconnect();let L=new k(()=>O.size(Math.ceil(E.getBoundingClientRect().height)));return L.observe(E),g=L,()=>L.disconnect()},close(){g?.disconnect(),p(),n?.close(),i.clear()}};return{guest:O,send:c}}var Mr=["globalThis","Infinity","NaN","undefined","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape","Object","Function","Array","Number","Boolean","String","Symbol","BigInt","Date","Promise","RegExp","Math","JSON","Reflect","Proxy","Intl","Error","AggregateError","EvalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError","SuppressedError","Map","Set","WeakMap","WeakSet","WeakRef","FinalizationRegistry","Iterator","AsyncIterator","DisposableStack","AsyncDisposableStack","ArrayBuffer","SharedArrayBuffer","DataView","Atomics","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float16Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"],Dr=["window","parent","top","document","customElements","Event","ErrorEvent","PromiseRejectionEvent","ToggleEvent","FocusEvent","ClipboardEvent","CustomEvent","EventTarget","Node","ParentNode","ChildNode","DocumentFragment","Document","CharacterData","Comment","Text","Element","HTMLElement","SVGElement","HTMLTemplateElement","MutationObserver"],Lr=["self","postMessage","setTimeout","clearTimeout","setInterval","clearInterval","queueMicrotask","structuredClone","crypto","console","DOMException"],Gr=["TEMPORARY","PERSISTENT"],cl=Object.freeze([...Mr,...Dr,...Lr,...Gr]),ul=Object.freeze(["constructor","__defineGetter__","__defineSetter__","hasOwnProperty","__lookupGetter__","__lookupSetter__","isPrototypeOf","propertyIsEnumerable","toString","valueOf","__proto__","toLocaleString"]),Ir=t=>typeof t=="symbol"?`[${t.description??"symbol"}]`:t;function Hr(t=globalThis,e=[],n={}){let r=[],o=[],s=new Set([...Mr,...Dr,...Lr,...e,"constructor",Symbol.toStringTag]),i=(T,P)=>{let F=Reflect.getOwnPropertyDescriptor(T,P);return F===void 0||!("value"in F)||F.writable||F.configurable?!1:n.primitivesStay&&typeof P=="symbol"&&(typeof F.value!="object"||F.value===null)&&typeof F.value!="function"?!0:Gr.includes(P)&&typeof F.value=="number"},a=t,l=a.setTimeout,c=a.setInterval,m=a.crypto,p=(T,P)=>function(F,Ye,...dt){if(typeof F!="function")throw new TypeError(`${P} takes a function: a guest view cannot run code from text`);return T.call(t,F,Ye,...dt)},h=m?Object.freeze({getRandomValues:T=>m.getRandomValues(T)}):void 0,g=a.document?.defaultView;if(g&&g!==a)for(let T of Reflect.ownKeys(g))typeof T=="symbol"||s.has(T)||Reflect.deleteProperty(g,T)||o.push(`window.${T}`);let O=[];for(let T=t;T&&T!==Object.prototype;T=Object.getPrototypeOf(T))O.push(T);for(let T of O)for(let P of Reflect.ownKeys(T))s.has(P)||(Reflect.deleteProperty(T,P)?r.push(Ir(P)):i(T,P)||o.push(Ir(P)));let b=()=>function(){throw new EvalError("A guest view cannot make code from text.")},E=[Function.prototype,Object.getPrototypeOf(async function(){}),Object.getPrototypeOf(function*(){}),Object.getPrototypeOf(async function*(){})];for(let T of E){let P=b();Object.defineProperty(P,"prototype",{value:T,writable:!1,enumerable:!1,configurable:!1}),Reflect.defineProperty(T,"constructor",{value:P,writable:!1,enumerable:!1,configurable:!1})||o.push("Function.prototype.constructor"),T===Function.prototype&&Reflect.defineProperty(t,"Function",{value:P,writable:!0,enumerable:!1,configurable:!0})}let k=(T,P)=>{Reflect.defineProperty(t,T,{value:P,writable:!0,enumerable:!0,configurable:!0})||o.push(T)};k("setTimeout",p(l,"setTimeout")),k("setInterval",p(c,"setInterval")),h&&k("crypto",h);for(let T of O.slice(1))Object.freeze(T);for(let T of Reflect.ownKeys(t)){let P=Reflect.getOwnPropertyDescriptor(t,T);Reflect.defineProperty(t,T,"value"in P?{...P,writable:!1,configurable:!1}:{...P,configurable:!1})}let L;try{L=Reflect.preventExtensions(t)}catch{L=!1}return{removed:r,stuck:o,sealed:L}}var ut=class extends HTMLElement{constructor(){super(),tn(this,In)}connect(e){if(Be(this)===e||(ze(this,e),this.childNodes.length===0))return;let n=[];for(let r=0;r<this.childNodes.length;r++){let o=this.childNodes[r];n.push([0,In,je(o),r])}e.mutate(n)}updateRemoteProperty(e,n){Hn(this,e,n)}callRemoteMethod(e,...n){return Un(this,e,...n)}};var d={},on={empty:!0},Io={id:"text",class:"text",title:"text",lang:"text",dir:{oneOf:["ltr","rtl","auto"]},hidden:"text",tabindex:{oneOf:["-1","0"]},role:"text",style:"style",translate:{oneOf:["yes","no"]},spellcheck:{oneOf:["true","false"]},draggable:{oneOf:["true","false"]},inert:"boolean"},Vn={div:d,section:d,article:d,aside:d,header:d,footer:d,nav:d,hgroup:d,search:d,address:d,figure:d,figcaption:d,blockquote:d,p:d,pre:d,hr:on,br:on,wbr:on,h1:d,h2:d,h3:d,h4:d,h5:d,h6:d,span:d,strong:d,em:d,b:d,i:d,u:d,s:d,small:d,mark:d,abbr:d,cite:d,q:d,code:d,kbd:d,samp:d,var:d,sub:d,sup:d,dfn:d,bdi:d,bdo:d,ruby:d,rt:d,rp:d,time:{attributes:{datetime:"text"}},data:{attributes:{value:"text"}},del:{attributes:{datetime:"text"}},ins:{attributes:{datetime:"text"}},a:{attributes:{href:"link"}},ul:d,menu:d,dl:d,dt:d,dd:d,ol:{attributes:{start:"number",reversed:"boolean",type:{oneOf:["1","a","A","i","I"]}}},li:{attributes:{value:"number"}},table:d,caption:d,thead:d,tbody:d,tfoot:d,tr:d,colgroup:{attributes:{span:"number"}},col:{attributes:{span:"number"},empty:!0},th:{attributes:{colspan:"number",rowspan:"number",headers:"text",scope:{oneOf:["row","col","rowgroup","colgroup"]},abbr:"text"}},td:{attributes:{colspan:"number",rowspan:"number",headers:"text"}},details:{attributes:{open:"boolean",name:"text"}},summary:d,button:{attributes:{type:{oneOf:["button"]},disabled:"boolean",name:"text",value:"text"}},input:{empty:!0,attributes:{type:{oneOf:["text","search","number","range","checkbox","radio","date","time","datetime-local","month","week","color","email","tel","url"]},name:"text",value:"text",placeholder:"text",min:"text",max:"text",step:"text",checked:"boolean",disabled:"boolean",readonly:"boolean",required:"boolean",maxlength:"number",minlength:"number",size:"number",pattern:"text",multiple:"boolean",inputmode:"text",enterkeyhint:"text"}},select:{attributes:{name:"text",disabled:"boolean",multiple:"boolean",required:"boolean",size:"number"}},option:{attributes:{value:"text",selected:"boolean",disabled:"boolean",label:"text"}},optgroup:{attributes:{label:"text",disabled:"boolean"}},textarea:{attributes:{name:"text",placeholder:"text",rows:"number",cols:"number",disabled:"boolean",readonly:"boolean",required:"boolean",maxlength:"number",minlength:"number",wrap:{oneOf:["soft","hard","off"]}}},label:{attributes:{for:"text"}},fieldset:{attributes:{disabled:"boolean",name:"text"}},legend:d,output:d,meter:{attributes:{value:"number",min:"number",max:"number",low:"number",high:"number",optimum:"number"}},progress:{attributes:{value:"number",max:"number"}},img:{empty:!0,attributes:{src:"image",alt:"text",width:"number",height:"number",decoding:{oneOf:["async","sync","auto"]}}},"graview-video":on},Mo=["fill","fill-opacity","fill-rule","stroke","stroke-width","stroke-linecap","stroke-linejoin","stroke-dasharray","stroke-dashoffset","stroke-opacity","stroke-miterlimit","opacity","color","display","visibility","transform-origin","clip-path","clip-rule","marker-start","marker-mid","marker-end","font-family","font-size","font-weight","font-style","text-anchor","dominant-baseline","alignment-baseline","letter-spacing","text-decoration","paint-order","vector-effect","shape-rendering","pointer-events","stop-color","stop-opacity","overflow","mask"],Do={id:"text",class:"text",style:"style",lang:"text",role:"text",tabindex:{oneOf:["-1","0"]},transform:"geometry",...Object.fromEntries(Mo.map(t=>[t,"css"]))},qe={x:"geometry",y:"geometry",width:"geometry",height:"geometry"},sn={viewBox:"geometry",preserveAspectRatio:"geometry"},Ur={gradientUnits:{oneOf:["userSpaceOnUse","objectBoundingBox"]},gradientTransform:"geometry",spreadMethod:{oneOf:["pad","reflect","repeat"]},href:"fragment"},Vr={svg:{attributes:{...qe,...sn}},g:d,defs:d,symbol:{attributes:{...qe,...sn,refX:"geometry",refY:"geometry"}},use:{attributes:{...qe,href:"fragment"}},title:d,desc:d,path:{attributes:{d:"geometry",pathLength:"number"}},rect:{attributes:{...qe,rx:"geometry",ry:"geometry",pathLength:"number"}},circle:{attributes:{cx:"geometry",cy:"geometry",r:"geometry",pathLength:"number"}},ellipse:{attributes:{cx:"geometry",cy:"geometry",rx:"geometry",ry:"geometry",pathLength:"number"}},line:{attributes:{x1:"geometry",y1:"geometry",x2:"geometry",y2:"geometry",pathLength:"number"}},polyline:{attributes:{points:"geometry",pathLength:"number"}},polygon:{attributes:{points:"geometry",pathLength:"number"}},text:{attributes:{x:"geometry",y:"geometry",dx:"geometry",dy:"geometry",rotate:"geometry",textLength:"geometry",lengthAdjust:{oneOf:["spacing","spacingAndGlyphs"]}}},tspan:{attributes:{x:"geometry",y:"geometry",dx:"geometry",dy:"geometry",rotate:"geometry",textLength:"geometry"}},textPath:{attributes:{href:"fragment",startOffset:"geometry",method:{oneOf:["align","stretch"]},spacing:{oneOf:["auto","exact"]},side:{oneOf:["left","right"]}}},linearGradient:{attributes:{x1:"geometry",y1:"geometry",x2:"geometry",y2:"geometry",...Ur}},radialGradient:{attributes:{cx:"geometry",cy:"geometry",r:"geometry",fx:"geometry",fy:"geometry",fr:"geometry",...Ur}},stop:{attributes:{offset:"geometry"}},clipPath:{attributes:{clipPathUnits:{oneOf:["userSpaceOnUse","objectBoundingBox"]}}},mask:{attributes:{...qe,maskUnits:{oneOf:["userSpaceOnUse","objectBoundingBox"]},maskContentUnits:{oneOf:["userSpaceOnUse","objectBoundingBox"]}}},pattern:{attributes:{...qe,...sn,patternUnits:{oneOf:["userSpaceOnUse","objectBoundingBox"]},patternContentUnits:{oneOf:["userSpaceOnUse","objectBoundingBox"]},patternTransform:"geometry",href:"fragment"}},marker:{attributes:{...sn,markerWidth:"geometry",markerHeight:"geometry",refX:"geometry",refY:"geometry",orient:"geometry",markerUnits:{oneOf:["strokeWidth","userSpaceOnUse"]}}}};var Br={section:["aria-label","aria-labelledby","title"]};function Lo(t){return/^aria-[a-z]+$/.test(t)}function Go(t){return/^data-[a-z0-9][a-z0-9_.-]*$/.test(t)}var Ho=new Map(Object.keys(Vr).map(t=>[t.toLowerCase(),t]));function zr(t){return Ho.get(t.toLowerCase())}function jr(t,e,n){let r=n.toLowerCase(),o=t==="html"?[Vn[e]?.attributes,Io]:[Vr[e]?.attributes,Do],s=t==="svg"&&r==="xlink:href"?"href":r;for(let i of o)if(i){for(let[a,l]of Object.entries(i))if(a.toLowerCase()===s)return{name:a,kind:l}}if(Lo(r)||Go(r))return{name:r,kind:"text"}}var Fr="~",an=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),oe=(t,e=0)=>{if(t===null||typeof t=="string"||typeof t=="number"||typeof t=="boolean"||t===void 0)return t;if(!(e>64||typeof t!="object"))return Array.isArray(t)?t.map(n=>oe(n,e+1)):Object.fromEntries(Object.entries(t).map(([n,r])=>[n,oe(r,e+1)]))};function qr(){let t=new Map,e=new Map,n=new Map([[Fr,{children:[],listeners:new Map}]]),r=0,o=c=>{let m=e.get(c);return m===void 0&&(m=r+=1,e.set(c,m),t.set(m,{listener:c,count:0})),t.get(m).count+=1,m},s=c=>{let m=t.get(c);m&&(m.count-=1,!(m.count>0)&&(t.delete(c),e.delete(m.listener)))},i=c=>{let m=n.get(c);if(m){n.delete(c);for(let p of m.listeners.values())s(p);for(let p of m.children)i(p)}},a=(c,m,p=0)=>{if(!an(c)||p>64)return oe(c);let h=typeof c.id=="string"?c.id:void 0,g=m&&h!==void 0&&h!==Fr;g&&i(h);let O={children:[],listeners:new Map};g&&n.set(h,O);let b={};for(let[E,k]of Object.entries(c))E==="children"&&Array.isArray(k)?b[E]=k.map(L=>{let T=a(L,g,p+1);return g&&an(L)&&typeof L.id=="string"&&O.children.push(L.id),T}):E==="eventListeners"&&an(k)?b[E]=Object.fromEntries(Object.entries(k).map(([L,T])=>{if(typeof T!="function"||!g)return[L,void 0];let P=o(T);return O.listeners.set(L,P),[L,{listener:P}]})):b[E]=oe(k,p+1);return b},l=c=>{if(!Array.isArray(c))return oe(c);let[m,p]=c,h=typeof p=="string"?n.get(p):void 0;if(m===0){let g=a(c[2],h!==void 0),O=an(c[2])?c[2].id:void 0;if(h&&typeof O=="string"&&n.has(O)){let b=Number(c[3]);h.children.splice(Number.isInteger(b)&&b>=0&&b<=h.children.length?b:h.children.length,0,O)}return[m,oe(p),g,oe(c[3])]}if(m===1){let g=Number(c[2]);return h&&Number.isInteger(g)&&g>=0&&g<h.children.length&&i(h.children.splice(g,1)[0]),oe(c)}if(m===3&&c[4]===3){let g=String(c[2]),O=c[3],b=h&&typeof O=="function"?o(O):void 0,E=h?.listeners.get(g);return E!==void 0&&s(E),b===void 0?h?.listeners.delete(g):h.listeners.set(g,b),[m,oe(p),g,b===void 0?void 0:{listener:b},3]}return oe(c)};return{encode:c=>c.map(l),listener:c=>t.get(c)?.listener,get listening(){return t.size},get nodes(){return n.size-1}}}var ln="graview-view-root",Uo=["value","checked","key","pressed","files","refused","x","y","width","height","deltaX","deltaY","deltaMode","ctrlKey","metaKey","phase","pointerId","button","pressure","dx","dy","scale","rotation"],Vo=t=>t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/\'/g,"'"),Bo=t=>Object.freeze({html:t,toString:()=>t}),Yr=t=>typeof t=="object"&&t!==null&&typeof t.html=="string"&&Object.isFrozen(t),Wr=t=>t==null||t===!1?"":Array.isArray(t)?t.map(Wr).join(""):Yr(t)?t.html:Vo(String(t));function Xr(t){customElements.get(ln)||customElements.define(ln,ut);let e=Event,n=qr(),r=new Set,o=new Set,s,i=[],a=new Set;for(let u of["closest","matches","dataset"]){let y=()=>{throw new TypeError(`A view\'s element has no ${u}: graview.on hands event.element, the element its selector matched; read event.element.getAttribute("data-\\u2026").`)};u in Element.prototype||Object.defineProperty(Element.prototype,u,u==="dataset"?{get:y}:{value:y})}let l=document.createElement(ln),c=u=>{let y=N=>{for(let w of Array.from(N.childNodes)){if(w.nodeType!==1)continue;if($(w)===u)return w;let x=y(w);if(x)return x}};return y(l)},m=u=>{let y=c(u.target);if(!y)return;let N=new e(u.event,{bubbles:!0}),w={};for(let x of Uo)u[x]!==void 0&&(w[x]=u[x]);for(let x of Object.keys(w))Object.defineProperty(N,x,{value:w[x],enumerable:!0});y.dispatchEvent(N);for(let x of o){if(x.type!==u.event)continue;let _;try{_=new Set(Array.from(l.querySelectorAll(x.selector)))}catch{continue}for(let z=y;z&&z!==l;z=z.parentNode)if(_.has(z)){x.listener(Object.freeze({type:u.event,target:y,element:z,...w}));break}}},p=u=>{if(u.type==="dom-event"&&typeof u.target=="string")return m(u);if(u.type==="notice")return t.warn(u.text);if(u.type!=="props")return;s=u.props;let y=t.now();for(let x of r)try{x(u.props)}catch(_){t.threw(_)}let N=t.now()-y,w=u.push;typeof w=="number"&&t.microtask(()=>t.microtask(()=>t.send({type:"pushed",push:w,ms:N})))},h;l.connect({mutate(u){h||(h=[],t.microtask(()=>{let y=h??[];h=void 0,t.send({type:"render",records:n.encode(y)})})),h.push(...u)},call:()=>{}});let g=u=>u.nodeType===1?u.getAttribute("data-key")??u.getAttribute("id"):null,O=(u,y)=>u.nodeType===y.nodeType&&(u.nodeType!==1||u.localName===y.localName&&u.namespaceURI===y.namespaceURI&&g(u)===g(y));function b(u,y){let N=Array.from(y.childNodes),w=0;for(let x of N){let _=u.childNodes[w]??null;if(_&&O(_,x)){E(_,x),w+=1;continue}if(g(x)!==null){let ce=Array.from(u.childNodes).slice(w+1).find(We=>O(We,x));if(ce){u.insertBefore(ce,_),E(ce,x),w+=1;continue}}u.insertBefore(x,_),w+=1}for(;u.childNodes.length>w;)u.removeChild(u.lastChild)}function E(u,y){if(u.nodeType!==1){u.data!==y.data&&(u.data=y.data);return}let N=u,w=y,x=k(N);for(let _ of N.getAttributeNames())w.hasAttribute(_)||(N.removeAttribute(_),x&&be(N,_,void 0));for(let _ of w.getAttributeNames()){let z=w.getAttribute(_);N.getAttribute(_)!==z&&N.setAttribute(_,z),x&&be(N,_,z)}b(N,w)}let k=u=>u.localName.includes("-");function L(u){for(let y of Array.from(u.childNodes)){if(y.nodeType!==1)continue;let N=y;if(k(N))for(let w of N.getAttributeNames())be(N,w,N.getAttribute(w)??void 0);L(N)}}function T(u,y,N){for(let w of Array.from(u.childNodes)){if(w.nodeType!==1)continue;let x=w,_=x.localName,z=y||_.toLowerCase()==="svg",ce=z?zr(_):Object.prototype.hasOwnProperty.call(Vn,_.toLowerCase())?_.toLowerCase():void 0;if(!ce){N.add(`<${_}>`);continue}for(let We of x.getAttributeNames())(!jr(z?"svg":"html",ce,We)||!z&&Br[ce]?.includes(We.toLowerCase()))&&N.add(`${ce} ${We}`);T(x,z,N)}}function P(u){let y=document.createElement("div"),N=Array.isArray(u)?u:[u];for(let x of N)if(x!=null)if(typeof x=="string"||Yr(x)){let _=document.createElement("div");_.innerHTML=typeof x=="string"?x:x.html,y.append(...Array.from(_.childNodes))}else y.append(x);let w=new Set;T(y,!1,w),i=[...w],i.length>0&&t.warn(`The host will not draw: ${i.join(", ")}`),L(y),b(l,y)}let F=[],Ye=new Set(_r),dt="[]",cn=!1,Fn=()=>{cn||(cn=!0,t.microtask(()=>{cn=!1;let u=[...new Map([...o].filter(N=>Ye.has(N.type)).map(N=>[`${N.type} ${N.selector}`,{event:N.type,selector:N.selector}])).entries()].sort(([N],[w])=>N<w?-1:N>w?1:0).map(([,N])=>N),y=JSON.stringify(u);y!==dt&&(dt=y,t.send({type:"gestures",bound:u}))}))};return{view:Object.freeze({get props(){return s},onProps(u){return r.add(u),s&&u(s),()=>void r.delete(u)},render:P,style(u){typeof u!="string"||F.includes(u)||(F.push(u),t.send({type:"style",sheets:[...F]}))},on(u,y,N){let w={type:u,selector:y,listener:N};return o.add(w),typeof u=="string"&&!a.has(u)&&(a.add(u),t.send({type:"hears",events:[u]})),Ye.has(u)&&Fn(),()=>{o.delete(w),Ye.has(u)&&Fn()}},act:(u,y={})=>t.act(u,y),navigate(u){if(typeof u=="string")return t.navigate(u);let y=rn(u);y&&t.send(y)},html(u,...y){return Bo(u.reduce((N,w,x)=>N+w+(x<y.length?Wr(y[x]):""),""))},get refused(){return i},get hardening(){return t.hardening()}}),hear:p,find:u=>{try{let y=l.querySelectorAll(u)[0];return y?$(y):void 0}catch{return}}}}var jn={removed:[],stuck:[],sealed:!1,worker:!1},Bn=kr({listen(t){return Re.listen(t),()=>Re.unlisten(t)},fromHost:()=>!0,ready:t=>Re.post(t)},{onMessage:t=>$r.hear(t)}),$r=Xr({send:t=>Bn.send(t),act:(t,e)=>Bn.guest.act(t,e),navigate:t=>Bn.guest.navigate(t),microtask:Re.microtask,now:Re.now,threw:t=>console.error(t),warn:t=>console.warn(t),hardening:()=>jn}),zo=$r.view;Object.defineProperty(globalThis,"graview",{value:zo,enumerable:!0,configurable:!0,writable:!1});var zn="WorkerGlobalScope"in globalThis?Hr(globalThis,["graview"]):jn;jn=zn;if(zn.stuck.length>0)throw new Error(`The view\'s worker could not be hardened: ${zn.stuck.join(", ")} would not go.`);})();\n';export{e as VIEW_RUNTIME};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as y,b as h}from"./chunk.
|
|
1
|
+
import{a as y,b as h}from"./chunk.Z6TMIAAB.js";import"./chunk.RNEJYIQ7.js";import"./chunk.TBQOSI4J.js";import"./chunk.KWQ7QOHD.js";import{Gc as b}from"./chunk.AS4CQBOQ.js";import"./chunk.2AZTW66C.js";import"./chunk.AJZBJBMO.js";var k=(d,i)=>({id:i.id,said:h(d,i),when:i.when,...i.alsoMine?{alsoMine:!0}:{}});async function A(d,i,t){let a=b(t.principal);if(a.id===void 0)return{ok:!1,error:"This seat acts for nobody the app knows by id, so there is nobody to tell. Nothing was kept."};let r=t.store.seenBy(a),p=async()=>(await t.subscriptions.list(a.id)).filter(n=>n.app===t.app);if(d==="list_subscriptions")return{ok:!0,data:{subscriptions:(await p()).map(n=>k(r,n))}};if(d==="unsubscribe"){let n=String(i.id??"");return(await p()).some(g=>g.id===n)?(await t.subscriptions.remove(n),{ok:!0,data:{removed:n}}):{ok:!1,error:`No subscription "${n}" of yours. list_subscriptions says which there are.`}}let o=String(i.on??""),c=n=>typeof i[n]=="string"&&i[n].trim()!==""?i[n].trim():void 0,e=c("record");if(e!==void 0&&!r.graph.getNode(e)){let n=t.store.resolveRef({name:"record",kinds:["*"]},e,a);if(!n.ok)return{ok:!1,error:`${n.message} Nothing was kept.`};e=n.id}let s=c("kind")??(e!==void 0&&o!=="act"?r.graph.getNode(e)?.kind:void 0),f=c("act"),m=c("condition"),u=o==="act"?{on:o,...f!==void 0?{act:f}:{},...e!==void 0?{record:e}:{}}:o==="created"&&s!==void 0?{on:o,kind:s}:o==="changed"?{on:o,...s!==void 0&&e===void 0?{kind:s}:{},...e!==void 0?{record:e}:{}}:o==="reaches"&&s!==void 0?{on:o,kind:s,condition:m??"",...e!==void 0?{record:e}:{}}:void 0;if(!u)return{ok:!1,error:'Say what to be told of: on is "act", "created", "changed" or "reaches", with a kind (or a record) for all but act. Nothing was kept.'};let l=y({schema:r.schema,allMutations:()=>t.store.allMutations(),graph:r.graph},u);if(l)return{ok:!1,error:`${l} Nothing was kept.`};let S=await t.subscriptions.add({who:a,app:t.app,when:u,...i.alsoMine===!0?{alsoMine:!0}:{}});return{ok:!0,data:{subscription:k(r,S)}}}export{A as runSubscriptionTool};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as g}from"./chunk.TI4OSTQV.js";import{I as c,T as d,Tb as f,W as y,Xb as m,bb as h}from"./chunk.
|
|
1
|
+
import{a as g}from"./chunk.TI4OSTQV.js";import{I as c,T as d,Tb as f,W as y,Xb as m,bb as h}from"./chunk.AS4CQBOQ.js";function S(t,i=()=>!0){let e=f(t),n=new Set(t.map(o=>o.lineage?.suggestion));return t.filter(o=>o.suggests&&!o.withheld&&!e.has(o.id)&&!n.has(o.id)).map(({id:o,batch:s,suggests:r,intent:I,author:j,lineage:l,at:B})=>{let u=new Set;return JSON.stringify(r.map(p=>p.args),(p,a)=>(typeof a=="string"&&i(a)&&u.add(a),a)),{id:o,batch:s,calls:r,intent:I,author:j,...l?{lineage:l}:{},at:B,about:[...u]}})}function x(t,i){return t.ops.length>0&&t.ops.every(e=>e.suggests!==void 0||e.undoes!==void 0&&i(e.undoes)?.suggests!==void 0)}var A=t=>JSON.stringify([t.kind,t.id??"",t.name??""]);function M(t,i=()=>{}){let e=[];for(let n of t){if(x(n,i))continue;let o=e.at(-1);if(!m(n.author)){e.push({batch:n});continue}if(o&&"digest"in o&&A(o.digest.author)===A(n.author)){let s=[...o.digest.batches,n];e[e.length-1]={digest:{author:o.digest.author,batches:s,things:w(s),at:n.at}}}else e.push({digest:{author:n.author,batches:[n],things:w([n]),at:n.at}})}return e}var w=t=>t.reduce((i,e)=>i+(e.undone?0:e.ops.length),0);function P(t,i=d(new Date().toISOString())??c()){let e=d(t.at)??t.at.slice(0,10),n=e===i?"today":`on ${y(e)}`;return`Tidied ${t.things===1?"one thing":`${t.things} things`} ${n}`}var b=t=>t;function v(t,i){let e=g(t),n=e?.store??t,o=i??e?.principal,s=(o!==void 0?n.seenBy(o):n).log.all();return S(s,r=>n.graph.has(r))}function O(t,i,e){let n=v(t,e).find(o=>o.id===i);if(!n)throw new h("That suggestion is no longer waiting: it was accepted or declined, or it is not one you can see.");return n}function E(t,i,e={}){let n=g(t)?.store??t,o=e.author??b(n).by,s=O(n,i,o);return n.applyAll(s.calls,{...e,author:o,lineage:{...s.lineage,suggestion:i}})}function F(t,i,e={}){let n=g(t)?.store??t,o=e.author??b(n).by,s=O(n,i,o);return n.undo(s.batch,{...e,author:o})}export{M as a,P as b,v as c,E as d,F as e};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{k as a,l as o}from"./chunk.HZCA3UWJ.js";import"./chunk.JBW3DI7E.js";import"./chunk.AGIO2GRV.js";import"./chunk.NIVTK2W5.js";import"./chunk.OHSJQYJN.js";import"./chunk.DEUTHHGI.js";import"./chunk.EPUBSKKL.js";import"./chunk.ATDU5Y7V.js";import"./chunk.AQQZY6OY.js";import"./chunk.Y5ARSVH4.js";import"./chunk.PKUDIWIF.js";import"./chunk.VW2VCPJX.js";import"./chunk.WVUJXDXZ.js";import"./chunk.ZIEHF67C.js";import"./chunk.UHX4WTM7.js";import"./chunk.IKX4VDTW.js";import"./chunk.RNEJYIQ7.js";import"./chunk.TBQOSI4J.js";import"./chunk.KWQ7QOHD.js";import"./chunk.GZHZLJBF.js";import"./chunk.6MADC6DM.js";import"./chunk.OJGHDWI6.js";import"./chunk.JLEC3USG.js";import"./chunk.HDRD33II.js";import"./chunk.DX357TZ3.js";import"./chunk.H7KCWCB4.js";import"./chunk.XSNAG4JT.js";import{oa as n}from"./chunk.XWAMQPUM.js";import"./chunk.SDO3U72B.js";import"./chunk.AS4CQBOQ.js";import"./chunk.2AZTW66C.js";import"./chunk.AJZBJBMO.js";var w=new WeakMap;function s(e,i){let t=w.get(e);t||w.set(e,t=new Map);let r=t.get(i);return r||t.set(i,r=a(o(e,n(e)),e,i)),r}export{s as frameworkViews};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{l as O}from"./chunk.OJGHDWI6.js";import{e as C}from"./chunk.
|
|
1
|
+
import{l as O}from"./chunk.OJGHDWI6.js";import{e as C}from"./chunk.HDRD33II.js";import{$ as I,G as x,R as M,_ as w,aa as W,c as V,x as B,za as G}from"./chunk.XWAMQPUM.js";import{C as D,Ib as F,Ob as N,rc as _,sc as L,yc as j}from"./chunk.AS4CQBOQ.js";import{b as m}from"./chunk.AJZBJBMO.js";function H(t,e){let n=t.graph.getNode(e);if(!n)return[];let i=n.kind,a=t.schema.tryDefinition(i);if(!a)return[];let c=t.seenFor,u=c?j.keptFrom?.(t,c)?.(n):void 0,o=new Map;for(let r of t.allMutations()){let s=r.subject;if(!s||!(s.kinds==="*"||s.kinds.includes(i)))continue;let l=r.input.shape??{};for(let d of N(r,a)){if(u?.(d))continue;let b=d in l,k=[];for(let h of Object.keys(l)){if(h===s.arg||h===d||X(l[h]))continue;let v=F(r.input).find(S=>S.name===h);k.push({name:h,...v?{kinds:v.kinds}:{},...v?{candidates:v.kinds.includes("*")?t.graph.allNodes().map(S=>S.id):v.kinds.flatMap(S=>t.graph.nodesOfKind(S).map(J=>J.id))}:{},shape:C(r.input,h)})}let Q={field:d,mutation:r.name,title:r.title??r.name,shape:b?C(r.input,d):{type:"unknown"},takesValue:b,alternatives:[],open:k,call:h=>({name:r.name,args:b?{[s.arg]:e,[d]:h}:{[s.arg]:e}})};o.set(d,[...o.get(d)??[],Q])}}return[...o.values()].map(r=>{let s=[...r.filter(d=>d.takesValue),...r.filter(d=>!d.takesValue)],[f,...l]=s;return{...f,alternatives:l}})}function X(t){let e=D(t)?.type;return e==="optional"||e==="default"||e==="nullable"}var R=m(x(),1);function be(t){let{store:e,principal:n}=w(),i=W(),a=(0,R.useMemo)(()=>t===null?[]:H(e,t),[e,t,i]),c=(0,R.useCallback)((u,o,r={})=>{let s=u.call(o);e.apply({name:s.name,args:{...s.args,...r}},{author:n})},[e,n]);return{fields:a,commit:c}}var K=m(x(),1);function Qe(){let{brand:t}=w(),e=t?.kit;return(0,K.useMemo)(()=>_(e),[e])}function Je(t,e){let n=L(t,e),i={...n.color!==void 0?{color:n.color}:{},...n.pattern!==void 0?{pattern:n.pattern}:{},...n.width!==void 0?{width:n.width}:{},...n.cap!==void 0?{cap:n.cap}:{},...n.opacity!==void 0?{opacity:n.opacity}:{}};return{connector:n,style:O(e,{[e]:i})}}var $=m(x(),1);var g=m(M(),1);function Z(t){let e=t?.hint;return typeof e=="string"&&e.length>0?e:void 0}function ee(t){if(t instanceof Error&&t.message)return t.message;let e=String(t);return e==="[object Object]"?"The view threw without a message.":e}var U=class extends $.Component{static contextType=G;state={};static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,n){console.error(`[graview] the ${this.props.view??"view"} of ${this.props.kind} threw while rendering`,e,n.componentStack),this.context?.(e,{module:"@graview/react"})}render(){let{error:e}=this.state;if(!e)return this.props.children;let n=Z(e);return(0,g.jsxs)("div",{role:"alert","data-graview-view-error":this.props.kind,style:{display:"flex",flexDirection:"column",gap:"0.375rem",padding:"var(--graview-pad, 12px)",height:"100%",overflow:"auto",boxSizing:"border-box",borderRadius:"var(--graview-radius-sm, 6px)",background:"var(--graview-panel-warning, #fdf3ec)",color:"var(--graview-ink, #1a1a1a)",font:"var(--graview-font-body, 13px/1.45 system-ui)",fontSize:"0.875rem",lineHeight:1.45},children:[(0,g.jsx)("strong",{style:{color:"var(--graview-warn, #b4462a)"},children:this.props.view?`${this.props.view} could not draw`:"This view could not draw"}),(0,g.jsx)("span",{style:{color:"var(--graview-ink-muted, #555)"},children:this.props.kind}),(0,g.jsx)("span",{children:ee(e)}),n?(0,g.jsx)("span",{style:{color:"var(--graview-ink-muted, #555)"},children:n}):null]})}};var y=m(x(),1);var q=m(M(),1),A=(0,y.createContext)([]);function nt({sections:t,children:e}){let n=(0,y.useContext)(A),i=(0,y.useMemo)(()=>[...n,...t.filter(a=>!n.includes(a))],[n,t]);return(0,q.jsx)(A.Provider,{value:i,children:e})}function z(){let t=(0,y.useContext)(A),e=I()?.menuSections;return(0,y.useMemo)(()=>e?[...t,...e.filter(n=>!t.includes(n))]:t,[t,e])}function rt(){let t=z();return(0,y.useCallback)(e=>{for(let n of t)try{n(e)?.prepare?.()}catch{}},[t])}function ot(t){let e=z();if(t===null||e.length===0)return{start:[],end:[]};let n=e.flatMap(i=>{try{let a=i(t);return a&&((a.items?.length??0)>0||a.render)?[a]:[]}catch{return[]}});return{start:n.filter(i=>i.at==="start"),end:n.filter(i=>i.at!=="start")}}var te=m(x(),1);function st(){return w().activity}var P=(t,e)=>t.length*e*.58;var ne=156,re=2,E=ne-18,oe=7.1,ie=16;function ae(t,e){let n=0,i=E;for(let a of t.split(" ")){let c=e(a),u=i+e(" ")+c;if(u<=E)i=u;else{let o=Math.ceil(c/E)||1;n+=o,i=c-(o-1)*E}}return n}var se=16.25,Y=27,ce=(t,e)=>{let n=Math.ceil(t.length*oe/E);return e?Math.max(Y,Math.ceil(Math.max(n,ae(t,e))*se)+6):Math.max(Y,n*ie+6)};function ut(t,e,n){return t.length===0?0:10+t.reduce((i,a)=>i+ce(a,n),0)+(t.length-1)*re}var de=27,ue=8,lt=4,le=64,pt=t=>Math.max(1,Math.min(ue,t)),ft=t=>t*de+le;var p=m(x(),1);function gt(t,{units:e,target:n=0,legibleAt:i=260}){let[a,c]=(0,p.useState)(e);(0,p.useEffect)(()=>{let o=t.current;if(o===null||typeof ResizeObserver>"u")return;let r=new ResizeObserver(([s])=>{let f=s?.contentRect.width??0;f>0&&c(f)});return r.observe(o),()=>r.disconnect()},[t]);let u=a/e;return{scale:u,width:a,touchable:u*n>=24,legible:a>=i}}function xt(t="--graview-font-body",e="sans-serif"){let n=(0,p.useRef)(void 0),i=(0,p.useMemo)(()=>{if(typeof getComputedStyle!="function"||typeof document>"u")return e;let a=getComputedStyle(document.documentElement).getPropertyValue(t).trim();return a.length>0?a:e},[t,e]);return(0,p.useMemo)(()=>{n.current===void 0&&(n.current=typeof document>"u"?null:document.createElement("canvas").getContext("2d")??null);let a=n.current;return a===null?P:(c,u)=>{a.font=`${u}px ${i}`;let o=a.measureText(c).width;return o>0?o:P(c,u)}},[i])}var wt=(0,p.createContext)(void 0);var T=3;function pe(t){let e=V(t),n=e.focusId;if(!n)return null;if(e.within?.view){let[a]=B(n);if(a)return{at:`screen:${a}`,audience:!0}}return{at:n,audience:!1}}var fe=102,me=32;function St(t,e,n){let i=[],a=new Map,c=new Map,u=0;for(let o of t){let r=pe(o.stop),s=r?e(r.at):null;if(!r||!s){o.name&&i.push({kind:"edge",presence:o,point:{x:n-8,y:fe+u++*me}});continue}if(!o.name){let k=c.get(r.at);c.set(r.at,{n:(k?.n??0)+1,box:s});continue}let f=a.get(r.at)??[];if(f.push(o),a.set(r.at,f),f.length>T)continue;let l=s,d=f.length-1,b=r.audience?{x:l.x+l.width*.5+(d-1)*26,y:l.y+Math.min(l.height,24)}:{x:l.x+l.width*.5-26-d*26,y:l.y+l.height-4};i.push({kind:"person",presence:o,point:b,at:r.at,index:d,of:f.length,audience:r.audience})}for(let[o,r]of a){if(r.length<=T)continue;let s=e(o);s&&i.push({kind:"count",at:o,point:{x:s.x+s.width*.5+2*26+18,y:s.y+s.height-4},n:r.length-T})}for(let[o,{n:r,box:s}]of c)i.push({kind:"count",at:o,point:{x:s.x+s.width*.5+40,y:s.y+s.height-4},n:r});for(let o of t)if(o.name){if(o.robot?.at&&o.robot.mode!=="docked"){let r=e(o.robot.at);r&&i.push({kind:"robot",presence:o,point:{x:r.x+r.width/2+22,y:r.y+r.height-4},mode:o.robot.mode})}if(o.over){let r=e(o.over);r&&i.push({kind:"over",presence:o,box:r})}}return i}export{st as a,P as b,ne as c,re as d,Y as e,ut as f,de as g,lt as h,le as i,pt as j,ft as k,gt as l,xt as m,be as n,Qe as o,Je as p,St as q,U as r,nt as s,rt as t,ot as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as $}from"./chunk.
|
|
1
|
+
import{e as $}from"./chunk.V3QUTJR2.js";import{a as C}from"./chunk.UKAPFIPJ.js";import{g as M}from"./chunk.HDRD33II.js";import{ca as k,da as v,fa as j,vb as x}from"./chunk.AS4CQBOQ.js";function N(a,s){let c=a.tryDefinition(s),r=Object.keys(c?.fields?.shape??{}),m=[c?.lifecycle?.field,...r.filter(l=>/^(status|stage|state|phase)$/i.test(l))].filter(l=>l!==void 0&&r.includes(l));return[...new Set(m)].slice(0,1)}function P(a,s){return a.tryDefinition(s)?.fieldRoles?.title??"label"}function V(a,s,c={}){let r=s.map(e=>a.graph.getNode(e)).filter(e=>e!==void 0);if(r.length===0)return{acts:[],withheld:[]};let u=c.principal??{kind:"human"},m=C(a,r.map(e=>e.id),{...c.derive,principal:u,...c.context?{context:c.context}:{}}),l=new Map(a.allMutations().map(e=>[e.name,e])),g=[...new Set(r.map(e=>e.kind))],p=new Set(g.map(e=>P(a.schema,e))),h=new Set(m.affordances.filter(e=>e.provider==="schema").map(e=>e.mutation)),o=e=>{let n=l.get(e.mutation);if(!n?.subject)return;let t=r.length===1&&e.provider==="invariant"&&!h.has(e.mutation)&&e.args[n.subject.arg]===r[0].id;if(!(e.provider!=="schema"&&!t)&&!(r.length>1&&e.batch?.length!==r.length)&&n.derived?.act!=="edit"&&!e.open.some(i=>p.has(i.name)))return n},y=[],b=new Set;for(let e of m.affordances){let n=o(e);if(!n||b.has(n.name))continue;b.add(n.name);let{[n.subject.arg]:t,...i}=e.args;y.push({id:e.id,label:v(n),mutation:n.name,subject:n.subject.arg,args:i,open:e.open,...e.destructive||e.setsAside?{more:!0}:{},...e.destructive?{destructive:!0}:{},affordance:{...e,label:v(n)}})}if(g.length===1){let e=g[0];for(let n of N(a.schema,e))for(let t of $(a.schema,[...l.values()],e,n)){if(t.by==="none"||r.every(d=>d[n]===t.value))continue;let i=r.find(d=>d[n]!==t.value),f=t.acts.find(d=>{let D=t.by==="step"?{[d.subject.arg]:i.id}:{[d.subject.arg]:i.id,[n]:t.value};return a.permits({name:d.name,args:D},u).ok});if(!f)continue;let w=t.by==="step"?{}:{[n]:t.value};if(t.by==="step"&&y.some(d=>d.mutation===f.name))continue;let R=t.by==="step"?v(f):`Move to ${t.label}`,O=`set:${n}:${t.value}`;y.push({id:O,label:R,mutation:f.name,subject:f.subject.arg,args:w,open:[],affordance:{id:O,label:R,provider:"schema",mutation:f.name,args:{[f.subject.arg]:i.id,...w},open:[],score:0,why:`every one is ${e}`,nodeIds:r.map(d=>d.id)}})}}let S=[...y.filter(e=>!e.more),...y.filter(e=>e.more)],A=m.withheld.filter(e=>{let n=l.get(e.mutation);return n?.subject!==void 0&&n.derived?.act!=="edit"&&(r.length===1||e.batch?.length===r.length)}).map(e=>({label:v(l.get(e.mutation)),message:e.refusal.message}));return{acts:S,withheld:A}}function _(a,s,c,r={}){let u=r.author,m=a.allMutations().find(e=>e.name===s.mutation),l=e=>M(a.schema,a.allMutations(),e),g=e=>{let n=a.graph.getNode(e);return n?k(a.schema.tryDefinition(n.kind),n):e},p=[],h=[],o=[];for(let e of[...new Set(c)]){let n={name:s.mutation,args:{...s.args,[s.subject]:e}};if(!m){p.push({id:e,label:g(e),message:`There is no act \u201C${s.mutation}\u201D.`,reason:"invalid"});continue}let t=a.permits(n,u);if(!t.ok){p.push({id:e,label:g(e),message:t.refusal.message,reason:"forbidden"});continue}if(!a.wouldChange(n,u)){h.push(e);continue}o.push({id:e,call:n})}let y=e=>a.previewAll(e,{...u?{author:u}:{},...r.context?{context:r.context}:{}});for(let e=0;o.length>0;e+=1)try{y(o.map(n=>n.call));break}catch(n){let t=[];for(let i of o)try{y([i.call]),t.push(i)}catch(f){p.push({id:i.id,label:g(i.id),message:l(f),reason:x(f).reason})}if(t.length===o.length||e>o.length){for(let i of t)p.push({id:i.id,label:g(i.id),message:l(n),reason:x(n).reason});o=[];break}o=t}if(o.length===0)return{applied:[],unchanged:h,refused:p};let b=s.label??(m?v(m):s.mutation),S=[...new Set(o.map(e=>a.graph.getNode(e.id)?.kind))],A=`${b} \u2014 ${S.length===1&&S[0]?j(a.schema,S[0],o.length):`${o.length} records`}`;try{let e=a.applyAll(o.map(n=>n.call),{intent:A,...u?{author:u}:{},...r.via?{via:r.via}:{}});return{batch:e.batch,intent:A,applied:o.map(n=>n.id),unchanged:h,refused:p,result:e}}catch(e){let n=l(e),t=x(e).reason;return{applied:[],unchanged:h,refused:[...p,...o.map(i=>({id:i.id,label:g(i.id),message:n,reason:t}))],allOrNothing:!0}}}export{V as a,_ as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{a as y}from"./chunk.
|
|
1
|
+
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{a as y}from"./chunk.OHSJQYJN.js";import{m as g}from"./chunk.XSNAG4JT.js";import{G as R,R as c,wa as m}from"./chunk.XWAMQPUM.js";import{a as f}from"./chunk.SDO3U72B.js";import{la as p}from"./chunk.AS4CQBOQ.js";import{b as u}from"./chunk.AJZBJBMO.js";var o=u(R(),1);var r=u(c(),1),S,h=()=>S??=m(f(()=>(__graviewPreload(import.meta.url,["./chunk.Q7RQC3F7.js","./chunk.RNEJYIQ7.js","./chunk.TBQOSI4J.js","./chunk.KWQ7QOHD.js","./chunk.AS4CQBOQ.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.QGVLJTZS.js"))));function L(e){let[n,t]=(0,o.useState)(()=>h().current);return(0,o.useEffect)(()=>{if(!e||n)return;let i=!0;return h().load().then(a=>i&&t(a),()=>{}),()=>{i=!1}},[e,n]),n}function D(e,n){let t=L(n.length>0);return(0,o.useMemo)(()=>t?t.withLines(e,n):n,[t,e,n])}function I(e,n){let t=L(n.some(i=>i.shape));return(0,o.useMemo)(()=>{let i=new Map;if(!t)return i;for(let a of n){let l=t.ruleLine(a,e);l&&i.set(a.name,l)}return i},[t,e,n])}function M(e){let n=e.line;if(!(!n||e.message.endsWith(` \u2014 ${n.text}`)||e.message===b(e)))return e.message}function b(e){let n=e.line;return n?n.record!==void 0?`${n.record} \u2014 ${n.text}`:n.text:e.message}var P={name:{},op:{color:"var(--graview-ink-muted)",fontWeight:500},value:{fontWeight:600,fontVariantNumeric:"tabular-nums"},word:{color:"var(--graview-ink-muted)"},open:{color:"var(--graview-ink-faint)"},close:{color:"var(--graview-ink-faint)"}};function w({parts:e}){return(0,r.jsx)(r.Fragment,{children:e.map((n,t)=>(0,r.jsxs)("span",{children:[n.space?" ":"",(0,r.jsx)("span",{"data-graview-rule-part":n.as,style:P[n.as],children:n.text})]},t))})}function x(e,n){let t=p(e?.tryDefinition(n),n);return t.charAt(0).toUpperCase()+t.slice(1)}function C({line:e,schema:n,brand:t,lead:i=e.record===void 0?"kind":"record",stacked:a=!1,style:l}){let d=e.kind,s=i==="kind"?d?x(n,d):void 0:i==="record"?e.record:void 0,k=i==="kind"&&s?`${s}: ${e.said}`:i==="record"&&s?`${s} \u2014 ${e.said}`:e.said;return(0,r.jsxs)("span",{"data-graview-rule-line":"",style:{overflowWrap:"anywhere",...l},children:[(0,r.jsx)("span",{style:g,children:k}),(0,r.jsxs)("span",{"aria-hidden":"true",children:[i!=="none"&&d?(0,r.jsx)("span",{style:{display:"inline-flex",verticalAlign:"-0.1em",marginRight:"0.4em"},children:(0,r.jsx)(y,{kind:d,...n?{schema:n}:{},...t?{brand:t}:{},size:13})}):null,s?(0,r.jsxs)("span",{"data-graview-rule-head":"",style:{fontWeight:600,marginRight:i==="record"||a?0:"0.6em"},children:[s,i==="record"&&!a?(0,r.jsx)("span",{style:{color:"var(--graview-ink-faint)",fontWeight:400},children:" \u2014 "}):null]}):null,a&&s?(0,r.jsx)("br",{}):null,(0,r.jsx)(w,{parts:e.parts}),e.when&&e.when.length>0?(0,r.jsxs)("span",{"data-graview-rule-when":"",style:{color:"var(--graview-ink-faint)"},children:[", when ",(0,r.jsx)(w,{parts:e.when})]}):null]})]})}function z(e){return e.line?e.label&&e.label.trim().length>0?e.label:void 0:e.label&&e.label!==e.message&&!e.message.startsWith(e.label)?e.label:void 0}export{D as a,I as b,M as c,C as d,z as e};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as O}from"./chunk.
|
|
1
|
+
import{C as O}from"./chunk.AS4CQBOQ.js";var k=3,A=k+1,P=A+1,z=(o,r)=>o<r?-1:o>r?1:0;function L(o){return(o??0)>4?k:2}function N(o,r,a){let n=[];for(let d of Object.values(o.tryDefinition(r)?.edges??{}))if(d.to!=="*")for(let i of d.to)i!==r&&a.includes(i)&&!n.includes(i)&&n.push(i);return n}function W(o,r={}){let a=[...o.kinds],n=[...(r.order??[]).filter(e=>a.includes(e)),...a.filter(e=>!(r.order??[]).includes(e)).sort(z)].filter((e,t,s)=>s.indexOf(e)===t),d=e=>n.indexOf(e),i=new Map,g=[],h=(e,t,s)=>{i.set(e,{col:t,row:s,side:L(r.counts?.[e])}),g.push({col:t,row:s})};for(let e of n){let t=o.tryDefinition(e)?.plot??r.plots?.[e];t&&h(e,t.col,t.row)}let l=new Map(n.map(e=>[e,N(o,e,a)])),b=new Set(n.filter(e=>l.get(e).length>0||n.some(t=>l.get(t).includes(e)))),v=new Map,C=new Set,D=e=>{let t=v.get(e);if(t!==void 0)return t;if(C.has(e))return-1;C.add(e);let s=0;for(let c of l.get(e))s=Math.max(s,D(c)+1);return C.delete(e),v.set(e,s),s};for(let e of n)b.has(e)&&D(e);let f=[];for(let e of n)b.has(e)&&(f[v.get(e)]??=[]).push(e);let I=new Map,T=Math.max(1,Math.ceil(Math.sqrt(f.length))),H=Math.max(1,...f.map(e=>e?.length??0)),w=Math.max(P,Math.round(r.pitch??P)),R=(e,t)=>r.upright?{col:e%T*w,row:(Math.floor(e/T)*(H+1)+t)*w}:{col:t*w,row:e===0?0:-e*w},$=e=>!g.some(t=>V(t,e)),S=(e,t,s)=>{let c=s;for(;!$(R(t,c))&&c<s+64;)c++;return i.has(e)||h(e,R(t,c).col,R(t,c).row),c},x=0;f.forEach((e=[],t)=>{let s=u=>{let m=l.get(u).map(p=>I.get(p)).filter(p=>p!==void 0);return m.length>0?m.reduce((p,q)=>p+q,0)/m.length:1/0},c=[...e].sort((u,m)=>s(u)-s(m)||d(u)-d(m)),y=0;for(let u of c)i.has(u)||(y=S(u,t,y),I.set(u,y),x=Math.max(x,y+1),y++)});let j=n.filter(e=>!b.has(e)&&!i.has(e)),M=Math.max(r.upright?x:f.length,Math.ceil(Math.sqrt(j.length*2)),1),E=b.size>0?1:0;return j.forEach((e,t)=>{r.upright?S(e,f.length+E+Math.floor(t/M),t%M):S(e,t%M,x+E+Math.floor(t/M))}),i}function V(o,r){return Math.abs(o.col-r.col)<A&&Math.abs(o.row-r.row)<A}function X(o,r,a,n=.5){return{x:(o-r)*a/2,y:(o+r)*a*n/2}}var G=1,B=/^(done|completed?|closed|finished|shipped|sent|won|lost|passed|declined|dropped|answered|resolved|fixed|archived|cancell?ed|retired|released|published|delivered|paid|merged|rejected|written[-_ ]?up|out)$/i,F=/^(doing|in[-_ ]?progress|active|building|started|working|in[-_ ]?review|review(ing)?|fixing|ongoing|underway|testing|drafting|writing|running)$/i;function _(o,r,a){let n=O(o.tryDefinition(r)?.fields.shape?.[a]);for(;n&&n.innerType!==void 0&&n.type!=="enum";)n=O(n.innerType);if(n?.type!=="enum")return;let d=(n.entries?Object.values(n.entries):n.values??[]).filter(i=>typeof i=="string");return d.length>0?d:void 0}function J(o,r){let a=o.tryDefinition(r);if(!a)return;let n=a.lifecycle,d=Object.keys(a.fields.shape??{}),i=[n?.field,...d.filter(l=>/^(status|stage|state|phase)$/i.test(l))].find(l=>l!==void 0&&_(o,r,l)!==void 0);if(!i)return;let g=_(o,r,i),h=n?.field===i&&Array.isArray(n.retired)?n.retired:[];return{field:i,values:g,tiers:g.map(l=>h.includes(l)||B.test(l)?"done":F.test(l)?"active":"waiting")}}export{P as a,W as b,X as c,G as d,J as e};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{a as z,g as Z,h as ee}from"./chunk.P5K7EYDK.js";import{a as Q,b as X}from"./chunk.7PUFYK3B.js";import{b}from"./chunk.QJJKITXF.js";import{d as q}from"./chunk.LKF4BBCW.js";import{a as K}from"./chunk.UT6642FC.js";import{h as I}from"./chunk.MZOIPCDA.js";import{m as J}from"./chunk.FNXW46U4.js";import{Da as Y,G as F,Ha as _,J as P,O as L,P as T,R as U,_ as v,ga as G,ua as V}from"./chunk.4JWT6LIS.js";import{a as $}from"./chunk.SDO3U72B.js";import{Wa as H,ca as j,ea as E,qb as A}from"./chunk.AW2T3KFV.js";import{b as W}from"./chunk.AJZBJBMO.js";var c=W(F(),1);var te=W(F(),1);function ne(){let{ai:i,aiDesk:n}=v(),{entries:r}=P(n),a=i.off===!0;return(0,te.useEffect)(()=>{a||n.load()},[n,a]),a?[]:r}var e=W(U(),1),ae=V($(()=>(__graviewPreload(import.meta.url,["./chunk.IQWKEGWG.js","./chunk.QNJYXB3U.js","./chunk.FNXW46U4.js","./chunk.4JWT6LIS.js","./chunk.SDO3U72B.js","./chunk.AW2T3KFV.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.LYUPJ4VV.js")))),ge=ae.part((i,n)=>(0,e.jsx)(i.InteractionRow,{...n}),{quiet:!0,as:"li"}),ue=ae.part((i,n)=>(0,e.jsx)(i.ActivityFilter,{...n}),{quiet:!0,as:"div"}),ie=(i,n,r=re(i,[n]))=>({intent:n.intent,author:n.author.kind,...n.author.id?{authorId:n.author.id}:{},by:n.author,...n.ops[0]?.via?{via:n.ops[0].via}:{},...n.lineage?{basis:K(n.lineage)}:{},touched:[...new Set(n.ops.filter(a=>!A(a)).flatMap(a=>a.writes))],...ce(n.ops.filter(a=>!A(a)).flatMap(a=>a.writes),r),batch:n.id,at:n.at,...n.lineage?.interaction?{interaction:n.lineage.interaction}:{},seq:n.ops.at(-1).seq+1,...n.ops.every(A)?{withheld:!0}:{}});function he(i=4){let{store:n,principal:r}=v(),a=T(n,r),d=a.log.length;return(0,c.useMemo)(()=>{let s=a.batches(),l=re(a,s);return Q(s,o=>a.log.get(o)).reverse().slice(0,i).map(o=>{if("batch"in o)return ie(a,o.batch,l);let g=[...o.digest.batches].reverse().map(u=>ie(a,u,l));return{intent:X(o.digest),author:o.digest.author.kind,...o.digest.author.id?{authorId:o.digest.author.id}:{},by:o.digest.author,touched:[...new Set(g.flatMap(u=>u.touched))],batch:"",...g[0]?.at?{at:g[0].at}:{},seq:g[0]?.seq??0,digest:g}})},[a,d,i])}function re(i,n){let r=new Map;for(let a of n)for(let d of a.ops)if(!A(d))for(let s of d.primitives)(s.op==="add-node"||s.op==="remove-node")&&s.node&&r.set(s.node.id,j(i.schema.tryDefinition(s.node.kind),s.node));return r}function ce(i,n){let r={};for(let a of i){let d=n.get(a);d!==void 0&&(r[a]=d)}return Object.keys(r).length>0?{named:r}:{}}function ye({change:i}){let{store:n,principal:r,seats:a,people:d}=v();return(0,e.jsxs)("strong",{style:{fontWeight:600},children:[i.author==="human"&&i.by?.onBehalfOf===void 0&&(i.authorId===void 0||r.id===void 0||i.authorId===r.id)?"you":H(i.by??{kind:i.author,id:i.authorId},{graph:n.graph,schema:n.schema,seats:a,people:d}),I(i.via)?(0,e.jsxs)("span",{style:{fontWeight:400,color:"var(--graview-ink-muted)"},children:[", ",I(i.via)]}):null]})}function fe({change:i,goes:n}){let{store:r}=v(),[a,d]=(0,c.useState)(!1),s=i.digest??[];return(0,e.jsxs)("li",{"data-testid":"activity-digest",style:{display:"grid",gap:5,lineHeight:1.45},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:6},children:[(0,e.jsxs)("span",{style:{minWidth:0},children:[(0,e.jsx)(ye,{change:i})," ",(0,e.jsx)("span",{style:{color:"var(--graview-ink-muted)"},children:i.intent})]}),(0,e.jsx)("button",{type:"button","data-testid":"digest-toggle","aria-expanded":a,onClick:()=>d(l=>!l),style:{marginLeft:"auto",flex:"0 0 auto",display:"inline-flex",alignItems:"center",minHeight:24,minWidth:24,padding:"1px 8px",fontSize:"0.75rem"},children:a?"Hide":"Show each"})]}),a?(0,e.jsx)("ol",{"data-testid":"digest-changes",style:{margin:0,padding:"0 0 0 10px",listStyle:"none",display:"grid",gap:6,borderLeft:"1px solid var(--graview-edge)"},children:s.map(l=>(0,e.jsxs)("li",{"data-testid":"digest-change",style:{display:"grid",gap:3},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:6},children:[(0,e.jsxs)("span",{style:{minWidth:0},children:[(0,e.jsx)("span",{style:{color:"var(--graview-ink-muted)"},children:l.intent}),l.basis?(0,e.jsxs)("span",{"data-graview-lineage":"",style:{color:"var(--graview-ink-faint)"},children:[" \xB7 ",l.basis]}):null]}),l.withheld?null:(0,e.jsx)(B,{batch:l.batch})]}),l.touched.length>0?(0,e.jsx)("div",{"data-touched":l.touched.join(" "),style:{display:"flex",flexWrap:"wrap",gap:4},children:l.touched.slice(0,4).map(o=>(0,e.jsx)(M,{id:o,label:r.graph.has(o)?b(r,o):l.named?.[o]??b(r,o),go:n(o)},o))}):null]},l.batch))}):null]})}function B({batch:i}){let{store:n,principal:r,noteSeat:a}=v(),d=T(n,r),s=L()?.open??!1,l=d.log.length,[o,g]=(0,c.useState)(null),u=(0,c.useMemo)(()=>d.canUndo(i),[d,i,l]);if(s||!u.ok&&u.ops.length===0)return null;let w=!u.ok,k=w?u.includeBatches:[];return(0,e.jsxs)("span",{style:{marginLeft:"auto",flex:"0 0 auto",display:"grid",justifyItems:"end",gap:2},children:[(0,e.jsx)("button",{type:"button","data-testid":"undo-turn",title:w?`${u.message} \u2014 undo those too`:"Take this back, keeping everything since",onClick:()=>{g(null);try{let m=d.log.all().find(x=>x.batch===i&&x.author.kind==="agent");d.undo(w?[i,...k]:i,{author:r}),m&&a({type:"home",author:m.author})}catch(m){g(m instanceof Error?m.message:String(m))}},style:{display:"inline-flex",alignItems:"center",minHeight:24,minWidth:24,padding:"1px 8px",fontSize:"0.75rem",...w?{borderColor:"var(--graview-warn)",color:"var(--graview-warn)"}:{}},children:w?`undo +${k.length}`:"undo"}),o?(0,e.jsx)("span",{"data-testid":"undo-refused",role:"alert",style:{fontSize:"0.75rem",lineHeight:1.4,color:"var(--graview-warn)",maxWidth:260,textAlign:"right"},children:o}):null]})}function me({seq:i,intent:n}){let r=L();if(!r)return null;let a=r.past?.seq===i;return(0,e.jsx)("button",{type:"button","data-testid":"show-past","aria-label":`Show the app as it was after \u201C${n}\u201D`,title:"Show the app as it was here","aria-pressed":a,onPointerEnter:z,onFocus:z,onClick:()=>r.show(i),style:{display:"inline-flex",alignItems:"center",justifyContent:"center",minHeight:24,minWidth:24,padding:"1px 6px",fontSize:"0.75rem",flex:"0 0 auto"},children:(0,e.jsxs)("svg",{width:"13",height:"13",viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",children:[(0,e.jsx)("path",{d:"M2.5 8 a5.5 5.5 0 1 0 1.6-3.9",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),(0,e.jsx)("path",{d:"M2 2.5 V5.5 H5",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),(0,e.jsx)("path",{d:"M8 5 V8 L10 9.25",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})})}function ve(){let i=()=>{let n=new URL(window.location.href);return n.searchParams.set("fresh","1"),n.toString()};return(0,e.jsx)("a",{href:"#fresh","data-testid":"start-fresh",title:"Forget every edit made in this browser and return to the example",onClick:n=>{n.preventDefault(),window.location.assign(i())},style:{display:"inline-flex",alignItems:"center",minHeight:24,minWidth:24,fontSize:"0.8125rem",color:"var(--graview-ink-muted)",textDecoration:"underline",textDecorationColor:"var(--graview-edge-bright)",textUnderlineOffset:3},children:"Start fresh"})}function M({id:i,label:n,go:r}){return r?(0,e.jsx)("button",{type:"button","data-testid":"activity-record","data-record":i,title:`Go to ${n}`,onClick:()=>r(i),style:{all:"unset",display:"inline-flex",cursor:"pointer",borderRadius:7},className:"graview-activity-record",children:(0,e.jsx)(q,{label:n})}):(0,e.jsx)(q,{label:n})}function Oe({calls:i,seat:n,remembers:r=!1}){let a=he(),{store:d,principal:s,seats:l,people:o}=v(),g=ne(),[u,w]=(0,c.useState)("all"),[k,m]=(0,c.useState)(!1),x=t=>t!==void 0&&(t.id===s.id||t.onBehalfOf?.id===s.id)&&s.id!==void 0,oe=new Set(g.map(t=>t.id)),se=a.filter(t=>!(t.interaction!==void 0&&oe.has(t.interaction))&&(!k||x(t.by))),de=g.filter(t=>!k||x(t.by)).slice(0,4),C=[...u==="ai"?[]:se.map(t=>({at:t.at??"",change:t})),...u==="changes"?[]:de.map(t=>({at:t.at,entry:t}))].sort((t,y)=>t.at<y.at?1:t.at>y.at?-1:0),f=T(d,s),O=i.some(t=>t.phase==="running"),le=Z(),S=_("activity"),D=S.open,pe=G(),N=L(),R=t=>f.graph.has(t)?y=>{S.setOpen(!1),N?.past&&N.show(null),pe.record(y)}:null;return n===void 0&&i.length===0&&a.length===0&&g.length===0&&!r&&le===0?null:(0,e.jsxs)("div",{style:{position:"relative"},children:[(0,e.jsxs)("button",{type:"button","data-testid":"activity-button",...S.trigger,onClick:S.toggle,title:O?"An agent is working":"What has happened",style:{display:"inline-flex",alignItems:"center",gap:6,minHeight:30,padding:"0 8px",borderRadius:8,border:"1px solid transparent",background:"transparent",boxShadow:"none",fontSize:"0.875rem",whiteSpace:"nowrap",color:O?"var(--graview-accent)":"var(--graview-ink-muted)"},children:[O?(0,e.jsx)("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:999,background:"var(--graview-accent)"}}):null,a.length>0?a.length:"",(0,e.jsxs)("svg",{className:"graview-activity-mark",width:"15",height:"15",viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",style:{display:"var(--graview-activity-mark, none)"},children:[(0,e.jsx)("circle",{cx:"8",cy:"8",r:"5.75",fill:"none",stroke:"currentColor",strokeWidth:"1.4"}),(0,e.jsx)("path",{d:"M8 4.75 V8 L10.25 9.5",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})]}),(0,e.jsx)("span",{className:"graview-activity-word",children:" Activity"})]}),!D&&n!==void 0?(0,e.jsx)("div",{hidden:!0,"data-testid":"agent-seat-seated",children:n}):null,D?(0,e.jsxs)("section",{...S.pane,"aria-label":"Activity","data-testid":"activity","data-graview-offstage":"",style:{...Y,width:300,maxHeight:"min(52cqh, 460px)",overflow:"auto",display:"flex",flexDirection:"column",gap:9,padding:12,borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)"},children:[(0,e.jsx)("h2",{style:{...J,margin:0},children:"Activity"}),n!==void 0?(0,e.jsxs)("div",{"data-testid":"agent-seat-row",style:{display:"grid",gap:5,paddingBottom:i.length>0||C.length>0?9:0,...i.length>0||C.length>0?{borderBottom:"1px solid var(--graview-edge)"}:{}},children:[(0,e.jsx)("span",{style:{fontSize:"0.75rem",letterSpacing:"0.14em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},children:"The agent's seat"}),n]}):null,i.length>0?(0,e.jsx)("ol",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:7},children:i.slice(0,6).map((t,y)=>(0,e.jsxs)("li",{style:{display:"grid",gap:2,fontSize:"0.8125rem",lineHeight:1.45},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:6},children:[(0,e.jsx)("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:999,flex:"0 0 auto",background:t.phase==="running"?"var(--graview-accent)":t.phase==="failed"?"var(--graview-warn)":"var(--graview-edge-bright)"}}),(0,e.jsxs)("span",{style:{color:"var(--graview-ink)"},children:[t.mutating?"changed":"read"," \xB7"," ",f.allMutations().find(p=>p.name===t.name)?.title??E(t.name)]})]}),!t.mutating&&t.reads&&t.reads.length>0?(0,e.jsxs)("div",{"data-testid":"activity-reads",style:{display:"flex",flexWrap:"wrap",gap:4,paddingLeft:12},children:[[...new Set(t.reads)].slice(0,3).map(p=>(0,e.jsx)(M,{id:p,label:b(f,p),go:R(p)},p)),new Set(t.reads).size>3?(0,e.jsxs)("span",{style:{color:"var(--graview-ink-muted)"},children:["+",new Set(t.reads).size-3]}):null]}):Object.values(t.args).some(p=>typeof p=="string")?(0,e.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:4,paddingLeft:12},children:Object.entries(t.args).filter(p=>typeof p[1]=="string").slice(0,3).map(([p,h])=>(0,e.jsx)(M,{id:h,label:b(f,h),go:R(h)},p))}):null,t.error?(0,e.jsx)("div",{style:{paddingLeft:12,color:"var(--graview-warn)"},children:t.error}):null]},`${t.at}:${y}`))}):null,g.length>0?(0,e.jsx)(c.Suspense,{fallback:null,children:(0,e.jsx)(ue,{shows:u,onShows:w,mine:k,onMine:m})}):null,C.length>0?(0,e.jsx)("ol",{"data-testid":"diff-log",style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:6,fontSize:"0.8125rem"},children:C.map(({change:t,entry:y},p)=>y!==void 0?(0,e.jsx)(c.Suspense,{fallback:null,children:(0,e.jsx)(ge,{entry:y,undo:h=>(0,e.jsx)(B,{batch:h})})},`ai:${y.id}`):t.digest?(0,e.jsx)(fe,{change:t,goes:R},`digest:${t.digest[0]?.batch??p}`):t.withheld?(0,e.jsx)("li",{"data-testid":"withheld-change",style:{display:"grid",gap:3,lineHeight:1.45},children:(0,e.jsx)("span",{"data-touched":"",style:{color:"var(--graview-ink-muted)",fontStyle:"italic"},children:t.intent})},`change:${p}`):(0,e.jsxs)("li",{"data-batch":t.batch,style:{display:"grid",gap:3,lineHeight:1.45},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:6},children:[(0,e.jsxs)("span",{style:{minWidth:0},children:[(0,e.jsxs)("strong",{style:{fontWeight:600},children:[t.author==="human"&&t.by?.onBehalfOf===void 0&&(t.authorId===void 0||s.id===void 0||t.authorId===s.id)?"you":H(t.by??{kind:t.author,id:t.authorId},{graph:f.graph,schema:f.schema,seats:l,people:o}),I(t.via)?(0,e.jsxs)("span",{style:{fontWeight:400,color:"var(--graview-ink-muted)"},children:[", ",I(t.via)]}):null]})," ",(0,e.jsx)("span",{style:{color:"var(--graview-ink-muted)"},children:t.intent}),t.basis?(0,e.jsxs)("span",{"data-graview-lineage":"",style:{color:"var(--graview-ink-faint)"},children:[" \xB7 ",t.basis]}):null]}),t.batch?(0,e.jsx)(me,{seq:t.seq,intent:t.intent}):null,t.batch?(0,e.jsx)(B,{batch:t.batch}):null]}),(0,e.jsx)("div",{"data-touched":t.touched.join(" "),style:{display:"flex",flexWrap:"wrap",gap:4},children:t.touched.slice(0,4).map(h=>(0,e.jsx)(M,{id:h,label:f.graph.has(h)?b(f,h):t.named?.[h]??b(f,h),go:R(h)},h))})]},`change:${p}`))}):null,(0,e.jsx)(ee,{style:{paddingTop:8,borderTop:"1px solid var(--graview-edge)"}}),r?(0,e.jsxs)("div",{"data-testid":"remembered",style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:10,paddingTop:8,borderTop:"1px solid var(--graview-edge)",fontSize:"0.8125rem",color:"var(--graview-ink-faint)"},children:[(0,e.jsx)("span",{children:"Remembered in this browser"}),(0,e.jsx)(ve,{})]}):null]}):null]})}export{B as a,Oe as b};
|
|
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 z,g as Z,h as ee}from"./chunk.3MMLRSRC.js";import{a as Q,b as X}from"./chunk.64WM4IBI.js";import{b}from"./chunk.5ESCD57M.js";import{d as q}from"./chunk.DEUTHHGI.js";import{a as K}from"./chunk.UT6642FC.js";import{h as I}from"./chunk.HDRD33II.js";import{m as J}from"./chunk.XSNAG4JT.js";import{Fa as Y,G as F,J as P,Ja as _,O as L,P as T,R as U,_ as v,ga as G,wa as V}from"./chunk.XWAMQPUM.js";import{a as $}from"./chunk.SDO3U72B.js";import{Wa as H,ca as j,ea as E,qb as A}from"./chunk.AS4CQBOQ.js";import{b as W}from"./chunk.AJZBJBMO.js";var c=W(F(),1);var te=W(F(),1);function ne(){let{ai:i,aiDesk:n}=v(),{entries:r}=P(n),a=i.off===!0;return(0,te.useEffect)(()=>{a||n.load()},[n,a]),a?[]:r}var e=W(U(),1),ae=V($(()=>(__graviewPreload(import.meta.url,["./chunk.VDVJCLGS.js","./chunk.R2AG4NHQ.js","./chunk.XSNAG4JT.js","./chunk.XWAMQPUM.js","./chunk.SDO3U72B.js","./chunk.AS4CQBOQ.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.4Y6VGQVQ.js")))),ge=ae.part((i,n)=>(0,e.jsx)(i.InteractionRow,{...n}),{quiet:!0,as:"li"}),ue=ae.part((i,n)=>(0,e.jsx)(i.ActivityFilter,{...n}),{quiet:!0,as:"div"}),ie=(i,n,r=re(i,[n]))=>({intent:n.intent,author:n.author.kind,...n.author.id?{authorId:n.author.id}:{},by:n.author,...n.ops[0]?.via?{via:n.ops[0].via}:{},...n.lineage?{basis:K(n.lineage)}:{},touched:[...new Set(n.ops.filter(a=>!A(a)).flatMap(a=>a.writes))],...ce(n.ops.filter(a=>!A(a)).flatMap(a=>a.writes),r),batch:n.id,at:n.at,...n.lineage?.interaction?{interaction:n.lineage.interaction}:{},seq:n.ops.at(-1).seq+1,...n.ops.every(A)?{withheld:!0}:{}});function he(i=4){let{store:n,principal:r}=v(),a=T(n,r),d=a.log.length;return(0,c.useMemo)(()=>{let s=a.batches(),l=re(a,s);return Q(s,o=>a.log.get(o)).reverse().slice(0,i).map(o=>{if("batch"in o)return ie(a,o.batch,l);let g=[...o.digest.batches].reverse().map(u=>ie(a,u,l));return{intent:X(o.digest),author:o.digest.author.kind,...o.digest.author.id?{authorId:o.digest.author.id}:{},by:o.digest.author,touched:[...new Set(g.flatMap(u=>u.touched))],batch:"",...g[0]?.at?{at:g[0].at}:{},seq:g[0]?.seq??0,digest:g}})},[a,d,i])}function re(i,n){let r=new Map;for(let a of n)for(let d of a.ops)if(!A(d))for(let s of d.primitives)(s.op==="add-node"||s.op==="remove-node")&&s.node&&r.set(s.node.id,j(i.schema.tryDefinition(s.node.kind),s.node));return r}function ce(i,n){let r={};for(let a of i){let d=n.get(a);d!==void 0&&(r[a]=d)}return Object.keys(r).length>0?{named:r}:{}}function ye({change:i}){let{store:n,principal:r,seats:a,people:d}=v();return(0,e.jsxs)("strong",{style:{fontWeight:600},children:[i.author==="human"&&i.by?.onBehalfOf===void 0&&(i.authorId===void 0||r.id===void 0||i.authorId===r.id)?"you":H(i.by??{kind:i.author,id:i.authorId},{graph:n.graph,schema:n.schema,seats:a,people:d}),I(i.via)?(0,e.jsxs)("span",{style:{fontWeight:400,color:"var(--graview-ink-muted)"},children:[", ",I(i.via)]}):null]})}function fe({change:i,goes:n}){let{store:r}=v(),[a,d]=(0,c.useState)(!1),s=i.digest??[];return(0,e.jsxs)("li",{"data-testid":"activity-digest",style:{display:"grid",gap:5,lineHeight:1.45},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:6},children:[(0,e.jsxs)("span",{style:{minWidth:0},children:[(0,e.jsx)(ye,{change:i})," ",(0,e.jsx)("span",{style:{color:"var(--graview-ink-muted)"},children:i.intent})]}),(0,e.jsx)("button",{type:"button","data-testid":"digest-toggle","aria-expanded":a,onClick:()=>d(l=>!l),style:{marginLeft:"auto",flex:"0 0 auto",display:"inline-flex",alignItems:"center",minHeight:24,minWidth:24,padding:"1px 8px",fontSize:"0.75rem"},children:a?"Hide":"Show each"})]}),a?(0,e.jsx)("ol",{"data-testid":"digest-changes",style:{margin:0,padding:"0 0 0 10px",listStyle:"none",display:"grid",gap:6,borderLeft:"1px solid var(--graview-edge)"},children:s.map(l=>(0,e.jsxs)("li",{"data-testid":"digest-change",style:{display:"grid",gap:3},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:6},children:[(0,e.jsxs)("span",{style:{minWidth:0},children:[(0,e.jsx)("span",{style:{color:"var(--graview-ink-muted)"},children:l.intent}),l.basis?(0,e.jsxs)("span",{"data-graview-lineage":"",style:{color:"var(--graview-ink-faint)"},children:[" \xB7 ",l.basis]}):null]}),l.withheld?null:(0,e.jsx)(B,{batch:l.batch})]}),l.touched.length>0?(0,e.jsx)("div",{"data-touched":l.touched.join(" "),style:{display:"flex",flexWrap:"wrap",gap:4},children:l.touched.slice(0,4).map(o=>(0,e.jsx)(M,{id:o,label:r.graph.has(o)?b(r,o):l.named?.[o]??b(r,o),go:n(o)},o))}):null]},l.batch))}):null]})}function B({batch:i}){let{store:n,principal:r,noteSeat:a}=v(),d=T(n,r),s=L()?.open??!1,l=d.log.length,[o,g]=(0,c.useState)(null),u=(0,c.useMemo)(()=>d.canUndo(i),[d,i,l]);if(s||!u.ok&&u.ops.length===0)return null;let w=!u.ok,k=w?u.includeBatches:[];return(0,e.jsxs)("span",{style:{marginLeft:"auto",flex:"0 0 auto",display:"grid",justifyItems:"end",gap:2},children:[(0,e.jsx)("button",{type:"button","data-testid":"undo-turn",title:w?`${u.message} \u2014 undo those too`:"Take this back, keeping everything since",onClick:()=>{g(null);try{let m=d.log.all().find(x=>x.batch===i&&x.author.kind==="agent");d.undo(w?[i,...k]:i,{author:r}),m&&a({type:"home",author:m.author})}catch(m){g(m instanceof Error?m.message:String(m))}},style:{display:"inline-flex",alignItems:"center",minHeight:24,minWidth:24,padding:"1px 8px",fontSize:"0.75rem",...w?{borderColor:"var(--graview-warn)",color:"var(--graview-warn)"}:{}},children:w?`undo +${k.length}`:"undo"}),o?(0,e.jsx)("span",{"data-testid":"undo-refused",role:"alert",style:{fontSize:"0.75rem",lineHeight:1.4,color:"var(--graview-warn)",maxWidth:260,textAlign:"right"},children:o}):null]})}function me({seq:i,intent:n}){let r=L();if(!r)return null;let a=r.past?.seq===i;return(0,e.jsx)("button",{type:"button","data-testid":"show-past","aria-label":`Show the app as it was after \u201C${n}\u201D`,title:"Show the app as it was here","aria-pressed":a,onPointerEnter:z,onFocus:z,onClick:()=>r.show(i),style:{display:"inline-flex",alignItems:"center",justifyContent:"center",minHeight:24,minWidth:24,padding:"1px 6px",fontSize:"0.75rem",flex:"0 0 auto"},children:(0,e.jsxs)("svg",{width:"13",height:"13",viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",children:[(0,e.jsx)("path",{d:"M2.5 8 a5.5 5.5 0 1 0 1.6-3.9",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),(0,e.jsx)("path",{d:"M2 2.5 V5.5 H5",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),(0,e.jsx)("path",{d:"M8 5 V8 L10 9.25",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})})}function ve(){let i=()=>{let n=new URL(window.location.href);return n.searchParams.set("fresh","1"),n.toString()};return(0,e.jsx)("a",{href:"#fresh","data-testid":"start-fresh",title:"Forget every edit made in this browser and return to the example",onClick:n=>{n.preventDefault(),window.location.assign(i())},style:{display:"inline-flex",alignItems:"center",minHeight:24,minWidth:24,fontSize:"0.8125rem",color:"var(--graview-ink-muted)",textDecoration:"underline",textDecorationColor:"var(--graview-edge-bright)",textUnderlineOffset:3},children:"Start fresh"})}function M({id:i,label:n,go:r}){return r?(0,e.jsx)("button",{type:"button","data-testid":"activity-record","data-record":i,title:`Go to ${n}`,onClick:()=>r(i),style:{all:"unset",display:"inline-flex",cursor:"pointer",borderRadius:7},className:"graview-activity-record",children:(0,e.jsx)(q,{label:n})}):(0,e.jsx)(q,{label:n})}function Oe({calls:i,seat:n,remembers:r=!1}){let a=he(),{store:d,principal:s,seats:l,people:o}=v(),g=ne(),[u,w]=(0,c.useState)("all"),[k,m]=(0,c.useState)(!1),x=t=>t!==void 0&&(t.id===s.id||t.onBehalfOf?.id===s.id)&&s.id!==void 0,oe=new Set(g.map(t=>t.id)),se=a.filter(t=>!(t.interaction!==void 0&&oe.has(t.interaction))&&(!k||x(t.by))),de=g.filter(t=>!k||x(t.by)).slice(0,4),C=[...u==="ai"?[]:se.map(t=>({at:t.at??"",change:t})),...u==="changes"?[]:de.map(t=>({at:t.at,entry:t}))].sort((t,y)=>t.at<y.at?1:t.at>y.at?-1:0),f=T(d,s),O=i.some(t=>t.phase==="running"),le=Z(),S=_("activity"),D=S.open,pe=G(),N=L(),R=t=>f.graph.has(t)?y=>{S.setOpen(!1),N?.past&&N.show(null),pe.record(y)}:null;return n===void 0&&i.length===0&&a.length===0&&g.length===0&&!r&&le===0?null:(0,e.jsxs)("div",{style:{position:"relative"},children:[(0,e.jsxs)("button",{type:"button","data-testid":"activity-button",...S.trigger,onClick:S.toggle,title:O?"An agent is working":"What has happened",style:{display:"inline-flex",alignItems:"center",gap:6,minHeight:30,padding:"0 8px",borderRadius:8,border:"1px solid transparent",background:"transparent",boxShadow:"none",fontSize:"0.875rem",whiteSpace:"nowrap",color:O?"var(--graview-accent)":"var(--graview-ink-muted)"},children:[O?(0,e.jsx)("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:999,background:"var(--graview-accent)"}}):null,a.length>0?a.length:"",(0,e.jsxs)("svg",{className:"graview-activity-mark",width:"15",height:"15",viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",style:{display:"var(--graview-activity-mark, none)"},children:[(0,e.jsx)("circle",{cx:"8",cy:"8",r:"5.75",fill:"none",stroke:"currentColor",strokeWidth:"1.4"}),(0,e.jsx)("path",{d:"M8 4.75 V8 L10.25 9.5",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})]}),(0,e.jsx)("span",{className:"graview-activity-word",children:" Activity"})]}),!D&&n!==void 0?(0,e.jsx)("div",{hidden:!0,"data-testid":"agent-seat-seated",children:n}):null,D?(0,e.jsxs)("section",{...S.pane,"aria-label":"Activity","data-testid":"activity","data-graview-offstage":"",style:{...Y,width:300,maxHeight:"min(52cqh, 460px)",overflow:"auto",display:"flex",flexDirection:"column",gap:9,padding:12,borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)"},children:[(0,e.jsx)("h2",{style:{...J,margin:0},children:"Activity"}),n!==void 0?(0,e.jsxs)("div",{"data-testid":"agent-seat-row",style:{display:"grid",gap:5,paddingBottom:i.length>0||C.length>0?9:0,...i.length>0||C.length>0?{borderBottom:"1px solid var(--graview-edge)"}:{}},children:[(0,e.jsx)("span",{style:{fontSize:"0.75rem",letterSpacing:"0.14em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},children:"The agent's seat"}),n]}):null,i.length>0?(0,e.jsx)("ol",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:7},children:i.slice(0,6).map((t,y)=>(0,e.jsxs)("li",{style:{display:"grid",gap:2,fontSize:"0.8125rem",lineHeight:1.45},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:6},children:[(0,e.jsx)("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:999,flex:"0 0 auto",background:t.phase==="running"?"var(--graview-accent)":t.phase==="failed"?"var(--graview-warn)":"var(--graview-edge-bright)"}}),(0,e.jsxs)("span",{style:{color:"var(--graview-ink)"},children:[t.mutating?"changed":"read"," \xB7"," ",f.allMutations().find(p=>p.name===t.name)?.title??E(t.name)]})]}),!t.mutating&&t.reads&&t.reads.length>0?(0,e.jsxs)("div",{"data-testid":"activity-reads",style:{display:"flex",flexWrap:"wrap",gap:4,paddingLeft:12},children:[[...new Set(t.reads)].slice(0,3).map(p=>(0,e.jsx)(M,{id:p,label:b(f,p),go:R(p)},p)),new Set(t.reads).size>3?(0,e.jsxs)("span",{style:{color:"var(--graview-ink-muted)"},children:["+",new Set(t.reads).size-3]}):null]}):Object.values(t.args).some(p=>typeof p=="string")?(0,e.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:4,paddingLeft:12},children:Object.entries(t.args).filter(p=>typeof p[1]=="string").slice(0,3).map(([p,h])=>(0,e.jsx)(M,{id:h,label:b(f,h),go:R(h)},p))}):null,t.error?(0,e.jsx)("div",{style:{paddingLeft:12,color:"var(--graview-warn)"},children:t.error}):null]},`${t.at}:${y}`))}):null,g.length>0?(0,e.jsx)(c.Suspense,{fallback:null,children:(0,e.jsx)(ue,{shows:u,onShows:w,mine:k,onMine:m})}):null,C.length>0?(0,e.jsx)("ol",{"data-testid":"diff-log",style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:6,fontSize:"0.8125rem"},children:C.map(({change:t,entry:y},p)=>y!==void 0?(0,e.jsx)(c.Suspense,{fallback:null,children:(0,e.jsx)(ge,{entry:y,undo:h=>(0,e.jsx)(B,{batch:h})})},`ai:${y.id}`):t.digest?(0,e.jsx)(fe,{change:t,goes:R},`digest:${t.digest[0]?.batch??p}`):t.withheld?(0,e.jsx)("li",{"data-testid":"withheld-change",style:{display:"grid",gap:3,lineHeight:1.45},children:(0,e.jsx)("span",{"data-touched":"",style:{color:"var(--graview-ink-muted)",fontStyle:"italic"},children:t.intent})},`change:${p}`):(0,e.jsxs)("li",{"data-batch":t.batch,style:{display:"grid",gap:3,lineHeight:1.45},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:6},children:[(0,e.jsxs)("span",{style:{minWidth:0},children:[(0,e.jsxs)("strong",{style:{fontWeight:600},children:[t.author==="human"&&t.by?.onBehalfOf===void 0&&(t.authorId===void 0||s.id===void 0||t.authorId===s.id)?"you":H(t.by??{kind:t.author,id:t.authorId},{graph:f.graph,schema:f.schema,seats:l,people:o}),I(t.via)?(0,e.jsxs)("span",{style:{fontWeight:400,color:"var(--graview-ink-muted)"},children:[", ",I(t.via)]}):null]})," ",(0,e.jsx)("span",{style:{color:"var(--graview-ink-muted)"},children:t.intent}),t.basis?(0,e.jsxs)("span",{"data-graview-lineage":"",style:{color:"var(--graview-ink-faint)"},children:[" \xB7 ",t.basis]}):null]}),t.batch?(0,e.jsx)(me,{seq:t.seq,intent:t.intent}):null,t.batch?(0,e.jsx)(B,{batch:t.batch}):null]}),(0,e.jsx)("div",{"data-touched":t.touched.join(" "),style:{display:"flex",flexWrap:"wrap",gap:4},children:t.touched.slice(0,4).map(h=>(0,e.jsx)(M,{id:h,label:f.graph.has(h)?b(f,h):t.named?.[h]??b(f,h),go:R(h)},h))})]},`change:${p}`))}):null,(0,e.jsx)(ee,{style:{paddingTop:8,borderTop:"1px solid var(--graview-edge)"}}),r?(0,e.jsxs)("div",{"data-testid":"remembered",style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:10,paddingTop:8,borderTop:"1px solid var(--graview-edge)",fontSize:"0.8125rem",color:"var(--graview-ink-faint)"},children:[(0,e.jsx)("span",{children:"Remembered in this browser"}),(0,e.jsx)(ve,{})]}):null]}):null]})}export{B as a,Oe as b};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{a as A,b as D,c as T,d as L,e as C,f as S,h as N}from"./chunk.BRDAO2OF.js";import"./chunk.AJZBJBMO.js";var V=0,$=1,z=2,K=3,j=1,W=2,I=3,X=1,Y=3,J=8,_="~",x=r=>typeof r=="object"&&r!==null&&!Array.isArray(r),M=new Set(["input","select","textarea","option"]),q=new Set(["value","checked","selected"]);function F(r,n){let d=r.ownerDocument??r,g=n.maxNodes??5e3,m=[],p=new Map,k=new WeakMap,E={dom:r,name:"div",namespace:"html",children:[],id:_};p.set(_,E);let O=0,R=!1,l=e=>{m.push(e),m.length>200&&m.shift(),n.onRefused?.(e)},o=()=>({dom:d.createComment(""),children:[],refused:!0}),i=(e,a)=>{if(e.namespace==="html"&&e.name&&M.has(e.name))return e.dom;if(a?.namespace==="html"&&a.name==="textarea")return a.dom},v=(e,a,f)=>{let s=e.dom;if(f!=null&&typeof f!="string")return l({reason:"value",element:e.name,name:a});let t=N(e.namespace,e.name,a,f??null,n);if("refused"in t){let h=N(e.namespace,e.name,a,null,n);return"refused"in h||s.removeAttribute(h.name),l(t.refused)}for(let h of t.dropped??[])l(h);let c=e.namespace==="html"&&q.has(t.name)&&M.has(e.name),u=s,y=c?t.name==="value"?u.value:t.name==="checked"?u.checked:u.selected:void 0;t.value===null?s.removeAttribute(t.name):s.setAttribute(t.name,t.value),n.onAttribute?.(s,t.name),c&&(t.name==="value"&&"value"in u?(u.value=t.value??"",y!==u.value&&n.onFieldSet?.(s)):t.name==="checked"&&"checked"in u?(u.checked=t.value!==null,y!==u.checked&&n.onFieldSet?.(s)):t.name==="selected"&&"selected"in u&&(u.selected=t.value!==null,y!==u.selected&&n.onFieldSet?.(s.parentElement?.closest("select")??s)))},b=e=>{if(!e.refused){O-=1,e.id!==void 0&&p.delete(e.id);for(let a of e.children)b(a)}},w=(e,a)=>{if(!x(e)||typeof e.id!="string"||p.has(e.id))return l({reason:"record"}),o();if(O>=g)return l({reason:"budget"}),R||(R=!0,n.onOverBudget?.()),o();let f=e.id;if(e.type===J)return o();if(e.type===Y){if(S(a.namespace,a.name))return l({reason:"child",element:a.name}),o();let y=d.createTextNode(String(e.data??"").slice(0,A)),h={dom:y,children:[],text:!0,id:f,parent:a};return p.set(f,h),k.set(y,f),O+=1,h}if(e.type!==X)return l({reason:"record"}),o();let s=String(e.element);if(S(a.namespace,a.name))return l({reason:"child",element:s}),o();let t=C(s,a.namespace);if("refused"in t)return l(t.refused),o();let c=d.createElementNS(t.namespace==="svg"?T:D,t.name);t.as&&c.setAttribute("data-graview-as",t.as),t.namespace==="html"&&t.name==="img"&&c.setAttribute("referrerpolicy","no-referrer"),t.namespace==="html"&&t.name==="a"&&(c.setAttribute("target","_blank"),c.setAttribute("rel","noopener noreferrer"),c.setAttribute("referrerpolicy","no-referrer"));let u={dom:c,name:t.name,namespace:t.namespace,children:[],id:f,parent:a};if(p.set(f,u),k.set(c,f),O+=1,x(e.attributes))for(let[y,h]of Object.entries(e.attributes))v(u,y,h);if(n.decorate?.(c,t.name,t.namespace),x(e.properties))for(let y of Object.keys(e.properties))l({reason:"attribute",element:t.name,name:y});if(x(e.eventListeners))for(let y of Object.keys(e.eventListeners))e.eventListeners[y]!=null&&l({reason:"attribute",element:t.name,name:`on${y}`});if(Array.isArray(e.children))for(let y of e.children){let h=w(y,u);u.children.push(h),c.appendChild(h.dom)}return u},G=e=>{if(!Array.isArray(e))return l({reason:"record"});let[a,f]=e,s=typeof f=="string"?p.get(f):void 0;if(!s)return l({reason:"record"});switch(a){case V:{if(s.text)return l({reason:"record"});let t=Number(e[3]),c=Number.isInteger(t)&&t>=0&&t<=s.children.length?t:s.children.length,u=w(e[2],s);s.dom.insertBefore(u.dom,s.children[c]?.dom??null),s.children.splice(c,0,u),s.namespace==="html"&&s.name==="textarea"&&n.onFieldSet?.(s.dom);return}case $:{let t=Number(e[2]),c=s.children[t];if(!c)return l({reason:"record"});s.children.splice(t,1),c.dom.parentNode?.removeChild(c.dom),b(c);return}case z:{if(!s.text)return l({reason:"record"});s.dom.data=String(e[2]??"").slice(0,A);let t=i(s,s.parent);t&&n.onFieldSet?.(t);return}case K:{if(s===E||s.text)return l({reason:"record"});let t=String(e[2]),c=e[4]??j;return c===W?v(s,t,e[3]):l(c===j||c===I?{reason:"attribute",element:s.name,name:c===I?`on${t}`:t}:{reason:"record"})}default:return l({reason:"record"})}};return{apply(e,a){if(!Array.isArray(e))return l({reason:"record"}),!0;for(let f=0;f<e.length;f+=1){if(a&&f%32===0&&a())return!1;G(e[f])}return!0},get refused(){return m},get size(){return O},idOf:e=>k.get(e),elementOf(e){let a=p.get(e);return a&&!a.text&&a!==E?a.dom:void 0},dispose(){for(let e of E.children)b(e);for(E.children.length=0;r.firstChild;)r.removeChild(r.firstChild)}}}var P=["https:","mailto:","tel:"];function H(r){if(!(typeof r!="string"||r.length>2e3||/[\s<>"]/.test(r.trim())||r.trim()!==r))try{let n=new URL(r);return!P.includes(n.protocol)||n.protocol==="https:"&&(n.hostname===""||n.username!==""||n.password!=="")?void 0:n.href}catch{return}}function Q(r){let n=new Set,d=g=>{if(typeof g!="string"||!/^(https|mailto|tel):/i.test(g))return;let m=H(g);m&&n.add(m)};for(let g of[...r?.node?[r.node]:[],...r?.nodes??[]])for(let[m,p]of Object.entries(g))m==="id"||m==="kind"||(Array.isArray(p)?p.forEach(d):d(p));return n}function U(r){return(r??[]).flatMap(n=>{try{let d=new URL(n);return d.protocol==="https:"&&d.hostname!==""&&d.username===""&&d.password===""?[d.origin]:[]}catch{return[]}})}function Z(r,n){let d=H(r);if(d&&(n.handed.has(d)||d.startsWith("https:")&&U(n.origins).includes(new URL(d).origin)))return d}function ee(r,n){let d=r.length>120?`${r.slice(0,119)}\u2026`:r,g="";try{g=new URL(r).protocol}catch{g=""}if(!P.includes(g))return`The link "${d}" was not drawn: a view links only to an https:, mailto: or tel: address.`;let m=U(n);return`The link "${d}" was not drawn: it is no address this view was handed. A view links out only to an address a record it was shown holds (a url field), as the record holds it${m.length>0?`, or an https: address on ${m.join(", ")}`:""}; a record or a place of this app is <a data-record> or <a data-place>.`}var ne=`
|
|
2
|
+
:host { display: block; position: relative; contain: layout paint style; isolation: isolate; overflow: clip; min-width: 0; }
|
|
3
|
+
[data-graview-view-root] { color: var(--graview-ink, CanvasText); font-family: var(--graview-font-body, system-ui, sans-serif); line-height: 1.45; }
|
|
4
|
+
[data-graview-view-root] :is([data-graview-link], [data-graview-press]) { cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: rgb(128 128 128 / 0.16); }
|
|
5
|
+
[data-graview-view-root] a[href]::after { content: " \u2197" !important; content: " \u2197" / " (opens in a new tab)" !important; }
|
|
6
|
+
`,te=new Set(["Enter"," ","Escape","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End"]),B=["click","input","change","keydown"];function le(r,n){let d=r.ownerDocument,g=d.createElement("style");g.setAttribute("data-graview-region",""),g.textContent=ne;let m=d.createElement("style");m.setAttribute("data-graview-view-style","");let p=d.createElement("div");p.setAttribute("data-graview-view-root",""),r.append(g,m,p);let k=F(p,{origin:n.origin,...n.asset?{asset:n.asset}:{},...n.imageOrigins?{imageOrigins:n.imageOrigins}:{},...n.picture?{picture:n.picture}:{},...n.link?{link:n.link}:{},...n.onRefused?{onRefused:n.onRefused}:{},...n.maxNodes!==void 0?{maxNodes:n.maxNodes}:{},...n.onOverBudget?{onOverBudget:n.onOverBudget}:{},decorate:(o,i,v)=>{v==="html"&&i==="button"&&o.setAttribute("type","button"),v==="html"&&(i==="input"||i==="textarea"||i==="select")&&o.setAttribute("autocomplete","off"),n.decorate?.(o,i,v)},...n.onFieldSet?{onFieldSet:n.onFieldSet}:{},...n.onAttribute?{onAttribute:n.onAttribute}:{}}),E=[],O="",R=o=>{for(let i=o.composedPath()[0];i&&i!==p&&i!==r;i=i.parentNode)if(i.nodeType===1&&k.idOf(i)!==void 0)return i},l=o=>{let i=R(o);if(!i||o.type==="keydown"&&!te.has(o.key))return;let v=n.before?.(o,i,p);if(v===!1)return;let b=i,w=i.namespaceURI==="http://www.w3.org/1999/xhtml"&&["input","select","textarea"].includes(i.localName);n.send({type:"dom-event",target:k.idOf(i),event:o.type,...w?{value:String(b.value??"")}:{},...w&&(b.type==="checkbox"||b.type==="radio")?{checked:b.checked}:{},...o.type==="keydown"?{key:o.key}:{},...v??{}})};for(let o of B)r.addEventListener(o,l);return r.addEventListener("toggle",l,!0),{apply:(o,i)=>k.apply(o,i),style(o){let i=L(o);E.length=0;for(let v of i.refused)E.push({reason:"css",name:"stylesheet",css:v}),E.length>200&&E.shift();O=i.css,m.textContent=O},renderer:k,get refused(){return[...k.refused,...E]},get css(){return O},dispose(){for(let o of B)r.removeEventListener(o,l);r.removeEventListener("toggle",l,!0),k.dispose(),r.replaceChildren()}}}export{ne as REGION_CSS,le as createOpenDrawing,Q as handedLinks,Z as judgeLink,ee as linkRefusedWords};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as ot}from"./chunk.KSXB4LDF.js";import"./chunk.IIB22IIP.js";import{e as V,l as ue,m as G,q as st}from"./chunk.MWUP5X47.js";import{a as ee}from"./chunk.G4JJXA63.js";import"./chunk.OK4FSBHI.js";import{b as nt}from"./chunk.DAZEFSWI.js";import{d as tt}from"./chunk.3TBH2FMZ.js";import"./chunk.WE5SA6TP.js";import"./chunk.TDCO7LEA.js";import"./chunk.MZOIPCDA.js";import{d as et}from"./chunk.KERLVJ6I.js";import{c as Ze}from"./chunk.4EPT2CQG.js";import{I as ze,V as Je,Xc as Ne,Yc as Xe,ca as Ye,ga as qe,gb as Ve,hb as Qe,ka as Ae,la as F}from"./chunk.AW2T3KFV.js";import"./chunk.2AZTW66C.js";import"./chunk.AJZBJBMO.js";var At="Nothing by that name here.",$=o=>o.normalize("NFD").replace(/\p{M}+/gu,"").toLowerCase().replace(/[’']/g,"'").replace(/[^\p{L}\p{N}' ]+/gu," ").replace(/\s+/g," ").trim(),Nt=/^(?:(?:can you |could you |please )?(?:go|take me|bring me|head|jump|navigate|switch|get me)(?: back)? to|(?:please )?(?:open|show(?: me)?|bring up|let me see|view)) (.+)$/,St=/^(?:(?:can you |could you |please )?tell me (?:about|of)|what(?: is|'s| are) (?:in |on )?|describe|explain|who(?: is|'s)) (.+)$/,Ot=/^(?:what(?: is|'s| am i looking at| do i see)(?: (?:here|this|on (?:this|the) (?:page|screen)|in view|this place|this page))?|where am i|describe (?:this|here|this place|this page)|tell me about (?:this|here|this place|this page))$/,rt=new Set(["here","this","this place","this page","on this page","on the page","on this screen","in view"]),Ct=/^(?:date|day|when|on|at|the date|the day)$/,jt=/^(?:what(?: is|'s) (?:wrong|broken|the (?:problem|matter|trouble))|what needs (?:fixing|attention|doing)|any (?:problems|issues|trouble)|(?:show(?: me)? |go to |open )?(?:the )?(?:problems|issues|trouble|standing|what's wrong)|is (?:anything|something) (?:wrong|broken)|are there (?:any )?(?:problems|issues))(?: (?:with|about|on|in) (.+))?$/,z=o=>o.replace(/^(?:the|a|an|my|our) /,""),te=new Set(["the","a","an","my","our","all","any","of","that","which","who","are","is","be","what","whats","what's","with","me","show","list","every","there","do","i","have","we","due","for","please","were","was","by","from","in","on"]),ft=864e5,he=o=>Date.UTC(Number(o.slice(0,4)),Number(o.slice(5,7))-1,Number(o.slice(8,10))),xe=o=>new Date(o).toISOString().slice(0,10),C=(o,i)=>xe(he(o)+i*ft),xt=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],Mt=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Wt="(monday|tuesday|tues|wednesday|thursday|thurs|friday|saturday|sunday)",it="(january|february|march|april|may|june|july|august|september|october|november|december|jan|feb|mar|apr|jun|jul|aug|sept|sep|oct|nov|dec)",at="(\\d{1,2})(?:st|nd|rd|th)?",Dt=o=>xt.findIndex(i=>i.startsWith(o.slice(0,3))),dt=o=>Mt.findIndex(i=>o.startsWith(i.toLowerCase()));function Rt(o,i){return Je(o,{year:o.slice(0,4)!==i.slice(0,4)})}function Se(o,i,y){if(o<0||i<1||i>31)return;let f=Number(y.slice(0,4)),c=k=>{let j=Date.UTC(k,o,i);return new Date(j).getUTCMonth()===o?xe(j):void 0},p=c(f);if(p)return he(p)<he(y)-183*ft?c(f+1):p}function Oe(o,i,y){let f=new Date(he(i)).getUTCDay(),c=u=>{let S=(f-y+7)%7,w=C(i,-S+u*7);return{from:w,to:C(w,6)}},p=()=>{let u=`${i.slice(0,8)}01`,S=new Date(Date.UTC(Number(i.slice(0,4)),Number(i.slice(5,7)),1));return{from:u,to:C(xe(S.getTime()),-1)}},k=u=>u?{from:u,to:u,day:Rt(u,i)}:void 0,j=(u,S)=>{let w=Dt(S);return k(u==="this"||u==="next"?C(c(u==="next"?1:0).from,(w-y+7)%7):u==="last"?C(i,-((f-w+6)%7+1)):C(i,(w-f+7)%7))},J=u=>{let S=C(i,f===0?-1:6-f);return{from:C(S,u*7),to:C(S,u*7+1)}},B="\\b(?:(?:due |for |on |by )(?:the )?)?",P=[[/\b(?:overdue|past due|late)\b/,()=>({overdue:!0,to:C(i,-1)})],[/\b(?:due |for |on )?today\b/,()=>({from:i,to:i})],[/\b(?:due |for |on )?tomorrow\b/,()=>k(C(i,1))],[/\b(?:due |for |on )?yesterday\b/,()=>k(C(i,-1))],[/\b(?:due |for |on )?this week\b/,()=>c(0)],[/\b(?:due |for |on )?next week\b/,()=>c(1)],[/\b(?:due |for |on )?(?:last|previous) week\b/,()=>c(-1)],[/\b(?:due |for |on )?next weekend\b/,()=>J(1)],[/\b(?:due |for |on )?(?:this |the )?weekend\b/,()=>J(0)],[/\b(?:due |for |on )?this month\b/,()=>p()],[new RegExp(`${B}(\\d{4}) (\\d{2}) (\\d{2})\\b`),u=>k(Se(Number(u[2])-1,Number(u[3]),`${u[1]}-01-01`))],[new RegExp(`${B}${at} (?:of )?${it}\\b`),u=>k(Se(dt(u[2]),Number(u[1]),i))],[new RegExp(`${B}${it} (?:the )?${at}\\b`),u=>k(Se(dt(u[1]),Number(u[2]),i))],[new RegExp(`${B}(?:(this|next|last|coming) )?${Wt}\\b`),u=>j(u[1],u[2])]];for(let[u,S]of P){let w=o.match(u);if(!w)continue;let N=S(w);if(N)return{ask:{words:w[0],...N},rest:o.replace(w[0]," ").replace(/\s+/g," ").trim()}}}function ht(o,i,y={}){let f=y.principal??{kind:"human"},c=o.seenBy(f),p=c.schema,k=y.today??o.today?.()??ze(),j=y.weekStartsOn??1,J=o.kindsKeptFrom(f),B=o.modules.disabledKinds,P=p.kinds.filter(e=>!J.has(e)&&!B.has(e)),u=new Set(P),S=(y.places??[]).filter(e=>e.kind===null||u.has(e.kind)),w=c.graph,N=$(i).replace(/[?.!]+$/,"").trim();if(N.length===0)return{unresolved:!0};let M=e=>p.tryDefinition(e),H=e=>Ye(M(e.kind),e),I=e=>qe(p,e),se=e=>S.find(t=>t.kind===e&&t.address===Ne(p,e))?.address??Ne(p,e),ge=e=>Xe(p,e.kind,e.id),Me=e=>({to:"record",id:e.id,kind:e.kind,label:H(e),address:ge(e),said:`Went to ${H(e)}.`}),We=e=>{let t=`Went to ${e.title}.`;return e.kind===null?{to:"place",slug:e.slug,title:e.title,address:e.address,...e.slug==="overview"?{face:"scene"}:{},said:t}:e.lens||e.address.startsWith("/places/")?{to:"picture",kind:e.kind,as:e.slug,title:e.title,address:e.address,said:t}:{to:"kind",kind:e.kind,title:e.title,address:e.address,said:t}},De=()=>({unresolved:!0,say:At}),oe=e=>{let t=M(e.kind),s=et(e,t,{limit:3,excerpt:!0}).map(r=>r.alone.startsWith(r.label)?r.alone:`${r.label.toLowerCase()} ${r.alone}`).join(", "),n=c.violations().filter(r=>r.nodeIds.includes(e.id));return[`${H(e)} \u2014 ${Ae(F(t,e.kind))}${s?` (${s})`:""}.`,n.length>0?`Trouble: ${n.map(r=>r.message).join("; ")}.`:""].filter(Boolean).join(" ")},re=e=>{let t=new Set([G(e),G(z(e))]);for(let n of[" page"," view"," lens"," place"," picture"," list"])e.endsWith(n)&&(t.add(G(e.slice(0,-n.length))),t.add(G(z(e.slice(0,-n.length)))));t.delete("");let s=n=>t.has(G(n.title))||t.has(G(z($(n.title))))||t.has(G(n.slug));return S.find(n=>n.kind!==null&&n.address.startsWith("/places/")&&s(n))??S.find(s)},pe=e=>{let t=st(o,e,{principal:f,today:k,limit:6,near:!1,...y.selection?{from:y.selection}:{}}),s=t.hits.filter(r=>r.about==="node"&&u.has(r.kind)&&w.getNode(r.id)!==void 0),n=s.filter(r=>r.why.field==="label"&&r.why.strength==="exact");return n.length===1?{one:w.getNode(n[0].id),picks:s}:n.length>1?{picks:n}:s.length===1&&t.total===1?{one:w.getNode(s[0].id),picks:s}:{picks:s}},Re=e=>{let t=e.map(s=>`${s.label} (${F(M(s.kind),s.kind)})`);return`${e.length===1?"One thing matches":`${e.length} things match`}: ${t.join("; ")}.`},Ee=(e,t)=>{if(rt.has(e))return Le();let s=t?pe(z(e)||e):void 0,n=s?.one&&$(H(s.one))===$(z(e)||e)?void 0:re(e);if(n){let l=We(n);return{about:"place",say:t?`${l.said} ${me(n)}`:l.said,moves:[l],subject:n.slug}}let r=pe(z(e)||e);if(r.one){let l=Me(r.one);return{about:t?"describe":"record",say:t?`${l.said} ${oe(r.one)}`:l.said,moves:[l],subject:r.one.id}}if(r.picks.length>0)return{about:"picks",say:Re(r.picks),moves:[],picks:r.picks};let h=ae(e);if(h)return h;let d=Pe(e);if(d){if(d.rest.split(" ").every(l=>l===""||te.has(l))){let l=I(d.kind),v={to:"kind",kind:d.kind,title:l,address:se(d.kind),said:`Went to the ${l.toLowerCase()}.`};return{about:"kind",say:v.said,moves:[v]}}return{unresolved:!0}}return De()},me=e=>{if(e.kind===null){let h=P.map(l=>({kind:l,count:w.nodesOfKind(l).length})).filter(l=>l.count>0).map(l=>`${l.count} ${(l.count===1?F(M(l.kind),l.kind):I(l.kind)).toLowerCase()}`),d=c.violations().length;return[h.length>0?`It holds ${fe(h)}.`:"It holds nothing yet.",d>0?`${d===1?"One problem":`${d} problems`} to see to.`:""].filter(Boolean).join(" ")}let t=w.nodesOfKind(e.kind).length,s=I(e.kind).toLowerCase(),n=new Set(c.violations().flatMap(h=>h.nodeIds)),r=w.nodesOfKind(e.kind).filter(h=>n.has(h.id)).length;return[e.lens?`It draws the ${s} as ${Ae(e.lens)}${t>0?` \u2014 ${t} of them`:""}.`:`${t===0?"No":t} ${t===1?F(M(e.kind),e.kind):s} ${t===1?"is":"are"} here.`,r>0?`${r} ${r===1?"has":"have"} a problem.`:""].filter(Boolean).join(" ")},Le=()=>{let e=(y.selection??[]).map(s=>w.getNode(s)).find(s=>s!==void 0);if(e)return{about:"here",say:oe(e),moves:[],subject:e.id};let t=S.find(s=>s.slug===y.place)??S.find(s=>s.slug==="home");return t?{about:"here",say:`${t.title}. ${me(t)}`,moves:[],subject:t.slug}:{about:"here",say:me({slug:"home",title:"Home",kind:null,cardinality:"many",address:"/",stop:"#"}),moves:[]}},Pe=e=>{let t=P.flatMap(s=>[I(s),F(M(s),s),s].map(n=>({kind:s,name:$(n)}))).filter(s=>s.name.length>0).sort((s,n)=>n.name.length-s.name.length);for(let{kind:s,name:n}of t)if(!(` ${e} `.indexOf(` ${n} `)<0))return{kind:s,rest:` ${e} `.replace(` ${n} `," ").replace(/\s+/g," ").trim()}},ie=(e,t)=>{let s=V(p,e).filters.filter(d=>d.about==="field"&&d.type==="date");if(s.length===0)return;let n=s.find(d=>t.some(l=>$(d.key)===l||$(d.label)===l));if(n)return n;let r=M(e)?.fieldRoles??{};for(let d of["due","deadline","date","when","start","end"]){let l=r[d],v=l?s.find(x=>x.key===l):void 0;if(v)return v}return s.find(d=>["due","deadline","date","when","on","at"].includes(d.key.toLowerCase()))??(s.length===1?s[0]:void 0)},He=e=>{let t=M(e),s=V(p,e).filters;if(t?.lifecycle)return{conditions:[{key:"is",value:"current"}],holds:d=>ue(be,d,{key:"is",value:"current"})};let r=s.find(d=>d.about==="field"&&d.type==="boolean"&&ne.has($(d.key)));if(r)return{conditions:[{key:r.key,value:"false"}],holds:d=>d[r.key]!==!0};let h=s.find(d=>d.about==="field"&&d.type==="choice"&&(d.options??[]).some(l=>ne.has($(l))));if(h){let d=new Set((h.options??[]).filter(v=>ne.has($(v)))),l=(h.options??[]).filter(v=>!d.has(v));return l.length===1?{conditions:[{key:h.key,value:l[0]}],holds:v=>v[h.key]===l[0]}:"unsayable"}return{conditions:[],holds:()=>!0}},Ie=(e,t)=>{let s=e.words.startsWith("due")||$(t.key)==="due",n=Ct.test($(t.label));if(e.day)return s?`due ${e.day}`:n?`on ${e.day}`:`${t.label.toLowerCase()} on ${e.day}`;let r=e.words.replace(/^(?:due|for|on|by) (?:the )?/,"");return s?`due ${r}`:n?r:`${t.label.toLowerCase()} ${r}`},ye=new Set(c.violations().flatMap(e=>e.nodeIds)),be={schema:p,graph:c.graph,flagged:ye,today:k},ae=e=>{let t=Oe(e,k,j),s=Pe(t?.rest??e),n=s?.kind,r=(s?.rest??t?.rest??e).split(" ").filter(Boolean);if(!n&&t){let g=e.split(" "),m=P.filter(L=>ie(L,g)!==void 0),E=m.filter(L=>{let b=ie(L,g);return g.some(O=>$(b.key)===O||$(b.label)===O)}),U=m.length===1?m:E;if(U.length!==1)return;n=U[0]}if(!n)return;let h=V(p,n).filters,d=[],l=[],v=[],x=[],q=!1,de=[];for(let g=0;g<r.length;g++){let m=r[g],E=g>0&&(r[g-1]==="not"||r[g-1]==="un"),U=h.find(b=>b.about==="field"&&b.type==="choice"&&(b.options??[]).some(O=>$(O)===m));if(U&&!E){let b=(U.options??[]).find(O=>$(O)===m);d.push({key:U.key,value:b}),l.push(b);continue}let L=h.find(b=>b.about==="field"&&b.type==="boolean"&&[$(b.key),$(b.label)].some(O=>O===m||O===m.replace(/^un/,"")));if(L){let b=!E&&!(m.startsWith("un")&&!$(L.key).startsWith("un"));d.push({key:L.key,value:String(b)}),l.push(b?m:`not ${m.replace(/^un/,"")}`);continue}if(Pt.has(m)&&!E){let b=He(n);b==="unsayable"?(q=!0,x.push(O=>!ut(p,O))):(d.push(...b.conditions),x.push(b.holds)),l.push(m);continue}m==="not"||m==="un"||t&&h.some(b=>b.type==="date"&&($(b.key)===m||$(b.label)===m))||de.push(m)}if(r=de,r.some(g=>!te.has(g))||!t&&d.length===0&&x.length===0)return;let T=I(n).toLowerCase(),Q=I(n);if(t){let g=ie(n,e.split(" "));if(!g){let m={to:"kind",kind:n,title:Q,address:se(n),said:`Went to the ${T}.`};return{about:"kind",say:`${ee(Q)} carry no date, so I can't tell which are ${/^(?:due|for|on|overdue|past due|late)\b/.test(t.ask.words)?t.ask.words:`due ${t.ask.words}`}. ${m.said}`,moves:[m]}}if(t.ask.from&&d.push({key:g.key,value:`after:${C(t.ask.from,-1)}`}),t.ask.to&&d.push({key:g.key,value:`before:${C(t.ask.to,1)}`}),t.ask.overdue){let m=He(n);m==="unsayable"?(q=!0,x.push(E=>!ut(p,E))):(d.push(...m.conditions),x.push(m.holds))}t.ask.overdue?l.push("overdue"):v.push(Ie(t.ask,g))}let R=w.nodesOfKind(n).filter(g=>d.every(m=>ue(be,g,m))&&x.every(m=>m(g))),K=[...l,...v].join(" and "),Y=[...l,T,...v].join(" "),W=R.slice(0,6).map(g=>({about:"node",id:g.id,kind:n,label:H(g),why:{field:d[0]?.key??"label",reading:d[0]?.key??"Name",fragment:K,strength:"field"},current:!0,flagged:ye.has(g.id),address:ge(g)})),X=R.length===0?`No ${T} are ${K}.`:`${R.length===1?`One ${F(M(n),n)} is`:`${R.length} ${T} are`} ${K}: ${fe(R.slice(0,6).map(H))}${R.length>6?`, and ${R.length-6} more`:""}.`;if(q)return{about:"kind",say:X,moves:[],picks:W,offer:{draft:Y,label:"Show as a view"}};let Z=d.map(g=>`${g.key}:${g.value}`).join(","),we=`${se(n)}?${new URLSearchParams({filter:Z}).toString()}`,_={to:"kind",kind:n,title:ee(Y),filter:Z,address:we,said:`Went to the ${Y}.`};return{about:"kind",say:`${_.said} ${X}`,moves:[_],picks:W}},Te=e=>M(e)?.figure==="person"?!0:[e,F(M(e),e),I(e)].some(s=>$(s).split(" ").some(n=>Et.has(n))),pt=e=>{let t=[],s=n=>M(n)?.edges??{};for(let[n,r]of Object.entries(s(e)))for(let h of r.to??[])u.has(h)&&t.push({key:n,direction:"out",far:h,words:ct(`${r.description??""} ${n}`)});for(let n of P)for(let[r,h]of Object.entries(s(n)))(h.to??[]).includes(e)&&t.push({key:r,direction:"in",far:n,words:ct(`${h.inverse??""} ${r}`)});return t},mt=e=>{let t=e.match(/^(who|which|what)\b/)?.[1];if(!t)return;let s=Oe(e,k,j);if(!s||s.ask.overdue)return;let n=s.rest.split(" ").filter(Boolean),r=P.flatMap(a=>[I(a),F(M(a),a),a].map(A=>({kind:a,name:$(A)}))).filter(a=>a.name.length>0).sort((a,A)=>A.name.length-a.name.length),h=` ${n.join(" ")} `,d=[];for(let{kind:a,name:A}of r)h.includes(` ${A} `)&&(h=h.replace(` ${A} `," "),d.includes(a)||d.push(a));let l=h.match(/\b(?:is|are|was|were)\b|'s\b/)?.[0],v=h.replace(/'s\b/g," ").split(" ").filter(a=>a.length>0&&!te.has(a)&&!Ce.has(a)),x=t==="who"?d.find(Te):d[0];if(!x&&t!=="who")return;let q=d.find(a=>a!==x),de=v.flatMap(a=>[je(a),...lt.has(je(a))?[...lt]:[]]),T=P.filter(a=>q?a===q:a!==x).flatMap(a=>{let A=ie(a,e.split(" "))??V(p,a).filters.find(D=>D.about==="field"&&D.type==="date");return A?pt(a).filter(D=>(x?D.far===x:Te(D.far))&&D.far!==a).map(D=>({kind:a,field:A,relation:D,said:v.length===0||de.some(ve=>D.words.some(vt=>Lt(vt,ve)))})):[]}).filter(a=>a.said);if(T.length===0)return;let Q=T.filter(a=>n.some(A=>$(a.field.key)===A||$(a.field.label)===A)),R=T.length===1?T[0]:Q.length===1?Q[0]:void 0;if(!R)return;let{kind:K,field:Y,relation:W}=R,X=[...s.ask.from?[{key:Y.key,value:`after:${C(s.ask.from,-1)}`}]:[],...s.ask.to?[{key:Y.key,value:`before:${C(s.ask.to,1)}`}]:[]],Z=w.nodesOfKind(K).filter(a=>X.every(A=>ue(be,a,A))),we=a=>(W.direction==="out"?c.graph.out(a.id,W.key):c.graph.in(a.id,W.key)).filter(A=>A.kind===W.far&&u.has(W.far)),_=[],g=[];for(let a of Z){let A=we(a);A.length===0&&g.push(a);for(let D of A)_.some(ve=>ve.id===D.id)||_.push(D)}let m=Ie(s.ask,Y),E=s.ask.day?`On ${s.ask.day}`:ee(s.ask.words.replace(/^(?:due|for|on|by) (?:the )?/,"")),U=I(K).toLowerCase(),L=X.map(a=>`${a.key}:${a.value}`).join(","),b=`${U} ${m}`,O={to:"kind",kind:K,title:ee(b),filter:L,address:`${se(K)}?${new URLSearchParams({filter:L}).toString()}`,said:`Went to the ${b}.`};if(Z.length===0)return{about:"related",say:`No ${b}. ${O.said}`,moves:[O]};let le=v.join(" "),yt=l==="was"||l==="were",Ge=a=>yt?a===1?"was":"were":a===1?"is":"are",ce=_.map(H),bt=ce.length>8?[...ce.slice(0,8),`${ce.length-8} more`]:ce,kt=_.length===0?`${E}: nobody ${Ge(1)}${le?` ${le}`:""}.`:`${E}: ${fe(bt)}${le?` ${Ge(_.length)} ${le}`:""}.`,$t=t==="who"&&g.length>0?`${fe(g.slice(0,4).map(H))}${g.length>4?` and ${g.length-4} more`:""} ${g.length===1?"has":"have"} nobody.`:"",wt=_.slice(0,8).map(a=>({about:"node",id:a.id,kind:a.kind,label:H(a),why:{field:W.key,reading:Ze(p,W.direction==="out"?K:W.far,W.key,W.direction==="out"?"out":"in"),fragment:m,strength:"field"},current:!0,flagged:ye.has(a.id),address:ge(a)}));return{about:"related",say:[kt,$t,O.said].filter(Boolean).join(" "),moves:[O],picks:wt}},Ke=N.match(jt);if(Ke){let e=Ke[1];if(e&&!rt.has(e)&&!/^(?:it|this|that)$/.test(e)){let n=re(e),r=n?void 0:pe(z(e)||e);if(r?.one){let h=Me(r.one);return{about:"describe",say:`${h.said} ${oe(r.one)}`,moves:[h],subject:r.one.id}}if(!n)return r&&r.picks.length>0?{about:"picks",say:Re(r.picks),moves:[],picks:r.picks}:De()}if(e&&/^(?:it|this|that)$|^(?:here|this place|this page)$/.test(e)){let n=(y.selection??[]).map(r=>w.getNode(r)).find(r=>r!==void 0);if(n)return{about:"describe",say:oe(n),moves:[],subject:n.id}}let t=c.violations();if(t.length===0)return{about:"problems",say:"Nothing is wrong \u2014 every rule holds.",moves:[]};let s={to:"problems",address:"/problems",said:"Went to the problems."};return{about:"problems",say:`${s.said} ${Qe(t)}: ${t.slice(0,4).map(n=>n.message).join("; ")}${t.length>4?"\u2026":"."}`,moves:[s]}}if(Ot.test(N))return Le();let _e=mt(N);if(_e)return _e;let ke=Oe(N,k,j);if(ke&&!re(z(ke.ask.words))&&ke.rest.replace(/'s\b/g,"").split(" ").every(e=>e===""||te.has(e)||Ce.has(e))){let e=ae(N);if(e)return e}if(/^open /.test(N)){let e=ae(N);if(e)return e}let Fe=N.match(Nt)??N.match(/^(?:go|take me|head|get me)(?: back)? (home)$/);if(Fe)return Ee(Fe[1].trim(),!1);let Be=N.match(St);if(Be){let e=Ee(Be[1].trim(),!0);return"unresolved"in e&&e.unresolved&&!/^tell me|^describe/.test(N)?{unresolved:!0}:e}let $e=re(N);if($e){let e=We($e);return{about:"place",say:e.said,moves:[e],subject:$e.slug}}let Ue=ae(N);return Ue||{unresolved:!0}}var Ce=new Set(["who","whom","whose","which","what","whats","what's","who's"]),Et=new Set(["person","people","user","users","member","members","volunteer","volunteers","gardener","gardeners","player","players","staff","worker","workers","employee","employees","owner","owners","assignee","assignees","helper","helpers","student","students","teacher","teachers","customer","customers","client","clients","contact","contacts","author","authors"]),lt=new Set(["work","cover","staff","assign","do","run","schedul","roster","book","duty","serv","help"]);function je(o){let i=o.toLowerCase().replace(/'s$/,"");for(let y of["ing","ed","es","s"])if(i.length>y.length+2&&i.endsWith(y)){let f=i.slice(0,-y.length);return f.length>3&&f[f.length-1]===f[f.length-2]?f.slice(0,-1):f}return i}function ct(o){return o.toLowerCase().split(/[^a-z']+/).filter(i=>i.length>1&&!te.has(i)&&!Ce.has(i)&&!["it","they","them","their","its","this","here","to","at"].includes(i)).map(je)}var Lt=(o,i)=>o===i||o.length>=4&&i.length>=4&&(o.startsWith(i)||i.startsWith(o)),ne=new Set(["done","finished","complete","completed","closed","resolved","agreed","canceled","archived","shipped","delivered"]),Pt=new Set(["open","unfinished","outstanding","pending","remaining","undone","incomplete"]);function ut(o,i){return V(o,i.kind).filters.some(f=>f.about==="field"&&(f.type==="boolean"&&ne.has(f.key.toLowerCase())&&i[f.key]===!0||f.type==="choice"&&typeof i[f.key]=="string"&&ne.has(String(i[f.key]).toLowerCase())))}function fe(o){return o.length<=1?o[0]??"":`${o.slice(0,-1).join(", ")} and ${o[o.length-1]}`}function zt(o,i,y={}){let f=y.scene!==void 0?{...y.pages,scene:y.scene}:y.pages;return[...nt(o,i,f?{pages:f}:{})].map(({first:c,hidden:p,lens:k,...j})=>j)}function gt(o,i){return{...o.principal?{principal:o.principal}:{},...o.places?{places:o.places}:{},...o.selection?{selection:o.selection}:{},...o.place?{place:o.place}:{},...i??o.today?{today:i??o.today}:{},...o.weekStartsOn!==void 0?{weekStartsOn:o.weekStartsOn}:{}}}function Jt(o,i,y,f){let c=ht(o,i,gt(y,f));if(c.unresolved)return c.say?{reply:{say:c.say,proposals:[],grounded:!0}}:{};if(c.about==="picks")return{};let p=c.moves.length>0?{moves:c.moves}:{},k=c.subject?o.graph.getNode(c.subject):void 0;if(c.about==="problems")return{...p,problems:!0};if(k&&(c.about==="describe"||c.about==="here"))return{...p,told:k.id};let j=k?tt(o,ot(Ve(o.violations(),[k.id])).slice(0,3)):[];return{reply:{say:c.say,proposals:j,grounded:!0,...p,...c.picks&&c.picks.length>0?{picks:c.picks}:{},...c.offer?{offer:c.offer}:{}}}}function Yt(o,i,y={}){let f=gt(y),c=[];for(let p of i){let k=typeof p=="string"?p:typeof p=="object"&&p!==null&&typeof p.to=="string"?p.to:void 0;if(!k||k.trim().length===0)continue;let j=ht(o,/^(?:go|take me|open|show)\b/i.test(k.trim())?k:`go to ${k}`,f);if("moves"in j)for(let J of j.moves)c.some(B=>B.address===J.address)||c.push(J)}return c}export{At as NOTHING_BY_THAT_NAME,gt as askContextOf,Jt as goingFrom,Yt as movesFromNames,zt as placesFromViews,ht as resolveAsk};
|
|
1
|
+
import{a as ot}from"./chunk.KSXB4LDF.js";import"./chunk.PKUDIWIF.js";import{e as V,l as ue,m as G,q as st}from"./chunk.VW2VCPJX.js";import{a as ee}from"./chunk.G4JJXA63.js";import"./chunk.WBHM5I3I.js";import{b as nt}from"./chunk.VC3BX2ZF.js";import{d as tt}from"./chunk.WAB7UDHU.js";import"./chunk.IW7YFPGG.js";import"./chunk.Q7RQC3F7.js";import"./chunk.HDRD33II.js";import{d as et}from"./chunk.DX357TZ3.js";import{c as Ze}from"./chunk.H7KCWCB4.js";import{I as ze,V as Je,Xc as Ne,Yc as Xe,ca as Ye,ga as qe,gb as Ve,hb as Qe,ka as Ae,la as F}from"./chunk.AS4CQBOQ.js";import"./chunk.2AZTW66C.js";import"./chunk.AJZBJBMO.js";var At="Nothing by that name here.",$=o=>o.normalize("NFD").replace(/\p{M}+/gu,"").toLowerCase().replace(/[’']/g,"'").replace(/[^\p{L}\p{N}' ]+/gu," ").replace(/\s+/g," ").trim(),Nt=/^(?:(?:can you |could you |please )?(?:go|take me|bring me|head|jump|navigate|switch|get me)(?: back)? to|(?:please )?(?:open|show(?: me)?|bring up|let me see|view)) (.+)$/,St=/^(?:(?:can you |could you |please )?tell me (?:about|of)|what(?: is|'s| are) (?:in |on )?|describe|explain|who(?: is|'s)) (.+)$/,Ot=/^(?:what(?: is|'s| am i looking at| do i see)(?: (?:here|this|on (?:this|the) (?:page|screen)|in view|this place|this page))?|where am i|describe (?:this|here|this place|this page)|tell me about (?:this|here|this place|this page))$/,rt=new Set(["here","this","this place","this page","on this page","on the page","on this screen","in view"]),Ct=/^(?:date|day|when|on|at|the date|the day)$/,jt=/^(?:what(?: is|'s) (?:wrong|broken|the (?:problem|matter|trouble))|what needs (?:fixing|attention|doing)|any (?:problems|issues|trouble)|(?:show(?: me)? |go to |open )?(?:the )?(?:problems|issues|trouble|standing|what's wrong)|is (?:anything|something) (?:wrong|broken)|are there (?:any )?(?:problems|issues))(?: (?:with|about|on|in) (.+))?$/,z=o=>o.replace(/^(?:the|a|an|my|our) /,""),te=new Set(["the","a","an","my","our","all","any","of","that","which","who","are","is","be","what","whats","what's","with","me","show","list","every","there","do","i","have","we","due","for","please","were","was","by","from","in","on"]),ft=864e5,he=o=>Date.UTC(Number(o.slice(0,4)),Number(o.slice(5,7))-1,Number(o.slice(8,10))),xe=o=>new Date(o).toISOString().slice(0,10),C=(o,i)=>xe(he(o)+i*ft),xt=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],Mt=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Wt="(monday|tuesday|tues|wednesday|thursday|thurs|friday|saturday|sunday)",it="(january|february|march|april|may|june|july|august|september|october|november|december|jan|feb|mar|apr|jun|jul|aug|sept|sep|oct|nov|dec)",at="(\\d{1,2})(?:st|nd|rd|th)?",Dt=o=>xt.findIndex(i=>i.startsWith(o.slice(0,3))),dt=o=>Mt.findIndex(i=>o.startsWith(i.toLowerCase()));function Rt(o,i){return Je(o,{year:o.slice(0,4)!==i.slice(0,4)})}function Se(o,i,y){if(o<0||i<1||i>31)return;let f=Number(y.slice(0,4)),c=k=>{let j=Date.UTC(k,o,i);return new Date(j).getUTCMonth()===o?xe(j):void 0},p=c(f);if(p)return he(p)<he(y)-183*ft?c(f+1):p}function Oe(o,i,y){let f=new Date(he(i)).getUTCDay(),c=u=>{let S=(f-y+7)%7,w=C(i,-S+u*7);return{from:w,to:C(w,6)}},p=()=>{let u=`${i.slice(0,8)}01`,S=new Date(Date.UTC(Number(i.slice(0,4)),Number(i.slice(5,7)),1));return{from:u,to:C(xe(S.getTime()),-1)}},k=u=>u?{from:u,to:u,day:Rt(u,i)}:void 0,j=(u,S)=>{let w=Dt(S);return k(u==="this"||u==="next"?C(c(u==="next"?1:0).from,(w-y+7)%7):u==="last"?C(i,-((f-w+6)%7+1)):C(i,(w-f+7)%7))},J=u=>{let S=C(i,f===0?-1:6-f);return{from:C(S,u*7),to:C(S,u*7+1)}},B="\\b(?:(?:due |for |on |by )(?:the )?)?",P=[[/\b(?:overdue|past due|late)\b/,()=>({overdue:!0,to:C(i,-1)})],[/\b(?:due |for |on )?today\b/,()=>({from:i,to:i})],[/\b(?:due |for |on )?tomorrow\b/,()=>k(C(i,1))],[/\b(?:due |for |on )?yesterday\b/,()=>k(C(i,-1))],[/\b(?:due |for |on )?this week\b/,()=>c(0)],[/\b(?:due |for |on )?next week\b/,()=>c(1)],[/\b(?:due |for |on )?(?:last|previous) week\b/,()=>c(-1)],[/\b(?:due |for |on )?next weekend\b/,()=>J(1)],[/\b(?:due |for |on )?(?:this |the )?weekend\b/,()=>J(0)],[/\b(?:due |for |on )?this month\b/,()=>p()],[new RegExp(`${B}(\\d{4}) (\\d{2}) (\\d{2})\\b`),u=>k(Se(Number(u[2])-1,Number(u[3]),`${u[1]}-01-01`))],[new RegExp(`${B}${at} (?:of )?${it}\\b`),u=>k(Se(dt(u[2]),Number(u[1]),i))],[new RegExp(`${B}${it} (?:the )?${at}\\b`),u=>k(Se(dt(u[1]),Number(u[2]),i))],[new RegExp(`${B}(?:(this|next|last|coming) )?${Wt}\\b`),u=>j(u[1],u[2])]];for(let[u,S]of P){let w=o.match(u);if(!w)continue;let N=S(w);if(N)return{ask:{words:w[0],...N},rest:o.replace(w[0]," ").replace(/\s+/g," ").trim()}}}function ht(o,i,y={}){let f=y.principal??{kind:"human"},c=o.seenBy(f),p=c.schema,k=y.today??o.today?.()??ze(),j=y.weekStartsOn??1,J=o.kindsKeptFrom(f),B=o.modules.disabledKinds,P=p.kinds.filter(e=>!J.has(e)&&!B.has(e)),u=new Set(P),S=(y.places??[]).filter(e=>e.kind===null||u.has(e.kind)),w=c.graph,N=$(i).replace(/[?.!]+$/,"").trim();if(N.length===0)return{unresolved:!0};let M=e=>p.tryDefinition(e),H=e=>Ye(M(e.kind),e),I=e=>qe(p,e),se=e=>S.find(t=>t.kind===e&&t.address===Ne(p,e))?.address??Ne(p,e),ge=e=>Xe(p,e.kind,e.id),Me=e=>({to:"record",id:e.id,kind:e.kind,label:H(e),address:ge(e),said:`Went to ${H(e)}.`}),We=e=>{let t=`Went to ${e.title}.`;return e.kind===null?{to:"place",slug:e.slug,title:e.title,address:e.address,...e.slug==="overview"?{face:"scene"}:{},said:t}:e.lens||e.address.startsWith("/places/")?{to:"picture",kind:e.kind,as:e.slug,title:e.title,address:e.address,said:t}:{to:"kind",kind:e.kind,title:e.title,address:e.address,said:t}},De=()=>({unresolved:!0,say:At}),oe=e=>{let t=M(e.kind),s=et(e,t,{limit:3,excerpt:!0}).map(r=>r.alone.startsWith(r.label)?r.alone:`${r.label.toLowerCase()} ${r.alone}`).join(", "),n=c.violations().filter(r=>r.nodeIds.includes(e.id));return[`${H(e)} \u2014 ${Ae(F(t,e.kind))}${s?` (${s})`:""}.`,n.length>0?`Trouble: ${n.map(r=>r.message).join("; ")}.`:""].filter(Boolean).join(" ")},re=e=>{let t=new Set([G(e),G(z(e))]);for(let n of[" page"," view"," lens"," place"," picture"," list"])e.endsWith(n)&&(t.add(G(e.slice(0,-n.length))),t.add(G(z(e.slice(0,-n.length)))));t.delete("");let s=n=>t.has(G(n.title))||t.has(G(z($(n.title))))||t.has(G(n.slug));return S.find(n=>n.kind!==null&&n.address.startsWith("/places/")&&s(n))??S.find(s)},pe=e=>{let t=st(o,e,{principal:f,today:k,limit:6,near:!1,...y.selection?{from:y.selection}:{}}),s=t.hits.filter(r=>r.about==="node"&&u.has(r.kind)&&w.getNode(r.id)!==void 0),n=s.filter(r=>r.why.field==="label"&&r.why.strength==="exact");return n.length===1?{one:w.getNode(n[0].id),picks:s}:n.length>1?{picks:n}:s.length===1&&t.total===1?{one:w.getNode(s[0].id),picks:s}:{picks:s}},Re=e=>{let t=e.map(s=>`${s.label} (${F(M(s.kind),s.kind)})`);return`${e.length===1?"One thing matches":`${e.length} things match`}: ${t.join("; ")}.`},Ee=(e,t)=>{if(rt.has(e))return Le();let s=t?pe(z(e)||e):void 0,n=s?.one&&$(H(s.one))===$(z(e)||e)?void 0:re(e);if(n){let l=We(n);return{about:"place",say:t?`${l.said} ${me(n)}`:l.said,moves:[l],subject:n.slug}}let r=pe(z(e)||e);if(r.one){let l=Me(r.one);return{about:t?"describe":"record",say:t?`${l.said} ${oe(r.one)}`:l.said,moves:[l],subject:r.one.id}}if(r.picks.length>0)return{about:"picks",say:Re(r.picks),moves:[],picks:r.picks};let h=ae(e);if(h)return h;let d=Pe(e);if(d){if(d.rest.split(" ").every(l=>l===""||te.has(l))){let l=I(d.kind),v={to:"kind",kind:d.kind,title:l,address:se(d.kind),said:`Went to the ${l.toLowerCase()}.`};return{about:"kind",say:v.said,moves:[v]}}return{unresolved:!0}}return De()},me=e=>{if(e.kind===null){let h=P.map(l=>({kind:l,count:w.nodesOfKind(l).length})).filter(l=>l.count>0).map(l=>`${l.count} ${(l.count===1?F(M(l.kind),l.kind):I(l.kind)).toLowerCase()}`),d=c.violations().length;return[h.length>0?`It holds ${fe(h)}.`:"It holds nothing yet.",d>0?`${d===1?"One problem":`${d} problems`} to see to.`:""].filter(Boolean).join(" ")}let t=w.nodesOfKind(e.kind).length,s=I(e.kind).toLowerCase(),n=new Set(c.violations().flatMap(h=>h.nodeIds)),r=w.nodesOfKind(e.kind).filter(h=>n.has(h.id)).length;return[e.lens?`It draws the ${s} as ${Ae(e.lens)}${t>0?` \u2014 ${t} of them`:""}.`:`${t===0?"No":t} ${t===1?F(M(e.kind),e.kind):s} ${t===1?"is":"are"} here.`,r>0?`${r} ${r===1?"has":"have"} a problem.`:""].filter(Boolean).join(" ")},Le=()=>{let e=(y.selection??[]).map(s=>w.getNode(s)).find(s=>s!==void 0);if(e)return{about:"here",say:oe(e),moves:[],subject:e.id};let t=S.find(s=>s.slug===y.place)??S.find(s=>s.slug==="home");return t?{about:"here",say:`${t.title}. ${me(t)}`,moves:[],subject:t.slug}:{about:"here",say:me({slug:"home",title:"Home",kind:null,cardinality:"many",address:"/",stop:"#"}),moves:[]}},Pe=e=>{let t=P.flatMap(s=>[I(s),F(M(s),s),s].map(n=>({kind:s,name:$(n)}))).filter(s=>s.name.length>0).sort((s,n)=>n.name.length-s.name.length);for(let{kind:s,name:n}of t)if(!(` ${e} `.indexOf(` ${n} `)<0))return{kind:s,rest:` ${e} `.replace(` ${n} `," ").replace(/\s+/g," ").trim()}},ie=(e,t)=>{let s=V(p,e).filters.filter(d=>d.about==="field"&&d.type==="date");if(s.length===0)return;let n=s.find(d=>t.some(l=>$(d.key)===l||$(d.label)===l));if(n)return n;let r=M(e)?.fieldRoles??{};for(let d of["due","deadline","date","when","start","end"]){let l=r[d],v=l?s.find(x=>x.key===l):void 0;if(v)return v}return s.find(d=>["due","deadline","date","when","on","at"].includes(d.key.toLowerCase()))??(s.length===1?s[0]:void 0)},He=e=>{let t=M(e),s=V(p,e).filters;if(t?.lifecycle)return{conditions:[{key:"is",value:"current"}],holds:d=>ue(be,d,{key:"is",value:"current"})};let r=s.find(d=>d.about==="field"&&d.type==="boolean"&&ne.has($(d.key)));if(r)return{conditions:[{key:r.key,value:"false"}],holds:d=>d[r.key]!==!0};let h=s.find(d=>d.about==="field"&&d.type==="choice"&&(d.options??[]).some(l=>ne.has($(l))));if(h){let d=new Set((h.options??[]).filter(v=>ne.has($(v)))),l=(h.options??[]).filter(v=>!d.has(v));return l.length===1?{conditions:[{key:h.key,value:l[0]}],holds:v=>v[h.key]===l[0]}:"unsayable"}return{conditions:[],holds:()=>!0}},Ie=(e,t)=>{let s=e.words.startsWith("due")||$(t.key)==="due",n=Ct.test($(t.label));if(e.day)return s?`due ${e.day}`:n?`on ${e.day}`:`${t.label.toLowerCase()} on ${e.day}`;let r=e.words.replace(/^(?:due|for|on|by) (?:the )?/,"");return s?`due ${r}`:n?r:`${t.label.toLowerCase()} ${r}`},ye=new Set(c.violations().flatMap(e=>e.nodeIds)),be={schema:p,graph:c.graph,flagged:ye,today:k},ae=e=>{let t=Oe(e,k,j),s=Pe(t?.rest??e),n=s?.kind,r=(s?.rest??t?.rest??e).split(" ").filter(Boolean);if(!n&&t){let g=e.split(" "),m=P.filter(L=>ie(L,g)!==void 0),E=m.filter(L=>{let b=ie(L,g);return g.some(O=>$(b.key)===O||$(b.label)===O)}),U=m.length===1?m:E;if(U.length!==1)return;n=U[0]}if(!n)return;let h=V(p,n).filters,d=[],l=[],v=[],x=[],q=!1,de=[];for(let g=0;g<r.length;g++){let m=r[g],E=g>0&&(r[g-1]==="not"||r[g-1]==="un"),U=h.find(b=>b.about==="field"&&b.type==="choice"&&(b.options??[]).some(O=>$(O)===m));if(U&&!E){let b=(U.options??[]).find(O=>$(O)===m);d.push({key:U.key,value:b}),l.push(b);continue}let L=h.find(b=>b.about==="field"&&b.type==="boolean"&&[$(b.key),$(b.label)].some(O=>O===m||O===m.replace(/^un/,"")));if(L){let b=!E&&!(m.startsWith("un")&&!$(L.key).startsWith("un"));d.push({key:L.key,value:String(b)}),l.push(b?m:`not ${m.replace(/^un/,"")}`);continue}if(Pt.has(m)&&!E){let b=He(n);b==="unsayable"?(q=!0,x.push(O=>!ut(p,O))):(d.push(...b.conditions),x.push(b.holds)),l.push(m);continue}m==="not"||m==="un"||t&&h.some(b=>b.type==="date"&&($(b.key)===m||$(b.label)===m))||de.push(m)}if(r=de,r.some(g=>!te.has(g))||!t&&d.length===0&&x.length===0)return;let T=I(n).toLowerCase(),Q=I(n);if(t){let g=ie(n,e.split(" "));if(!g){let m={to:"kind",kind:n,title:Q,address:se(n),said:`Went to the ${T}.`};return{about:"kind",say:`${ee(Q)} carry no date, so I can't tell which are ${/^(?:due|for|on|overdue|past due|late)\b/.test(t.ask.words)?t.ask.words:`due ${t.ask.words}`}. ${m.said}`,moves:[m]}}if(t.ask.from&&d.push({key:g.key,value:`after:${C(t.ask.from,-1)}`}),t.ask.to&&d.push({key:g.key,value:`before:${C(t.ask.to,1)}`}),t.ask.overdue){let m=He(n);m==="unsayable"?(q=!0,x.push(E=>!ut(p,E))):(d.push(...m.conditions),x.push(m.holds))}t.ask.overdue?l.push("overdue"):v.push(Ie(t.ask,g))}let R=w.nodesOfKind(n).filter(g=>d.every(m=>ue(be,g,m))&&x.every(m=>m(g))),K=[...l,...v].join(" and "),Y=[...l,T,...v].join(" "),W=R.slice(0,6).map(g=>({about:"node",id:g.id,kind:n,label:H(g),why:{field:d[0]?.key??"label",reading:d[0]?.key??"Name",fragment:K,strength:"field"},current:!0,flagged:ye.has(g.id),address:ge(g)})),X=R.length===0?`No ${T} are ${K}.`:`${R.length===1?`One ${F(M(n),n)} is`:`${R.length} ${T} are`} ${K}: ${fe(R.slice(0,6).map(H))}${R.length>6?`, and ${R.length-6} more`:""}.`;if(q)return{about:"kind",say:X,moves:[],picks:W,offer:{draft:Y,label:"Show as a view"}};let Z=d.map(g=>`${g.key}:${g.value}`).join(","),we=`${se(n)}?${new URLSearchParams({filter:Z}).toString()}`,_={to:"kind",kind:n,title:ee(Y),filter:Z,address:we,said:`Went to the ${Y}.`};return{about:"kind",say:`${_.said} ${X}`,moves:[_],picks:W}},Te=e=>M(e)?.figure==="person"?!0:[e,F(M(e),e),I(e)].some(s=>$(s).split(" ").some(n=>Et.has(n))),pt=e=>{let t=[],s=n=>M(n)?.edges??{};for(let[n,r]of Object.entries(s(e)))for(let h of r.to??[])u.has(h)&&t.push({key:n,direction:"out",far:h,words:ct(`${r.description??""} ${n}`)});for(let n of P)for(let[r,h]of Object.entries(s(n)))(h.to??[]).includes(e)&&t.push({key:r,direction:"in",far:n,words:ct(`${h.inverse??""} ${r}`)});return t},mt=e=>{let t=e.match(/^(who|which|what)\b/)?.[1];if(!t)return;let s=Oe(e,k,j);if(!s||s.ask.overdue)return;let n=s.rest.split(" ").filter(Boolean),r=P.flatMap(a=>[I(a),F(M(a),a),a].map(A=>({kind:a,name:$(A)}))).filter(a=>a.name.length>0).sort((a,A)=>A.name.length-a.name.length),h=` ${n.join(" ")} `,d=[];for(let{kind:a,name:A}of r)h.includes(` ${A} `)&&(h=h.replace(` ${A} `," "),d.includes(a)||d.push(a));let l=h.match(/\b(?:is|are|was|were)\b|'s\b/)?.[0],v=h.replace(/'s\b/g," ").split(" ").filter(a=>a.length>0&&!te.has(a)&&!Ce.has(a)),x=t==="who"?d.find(Te):d[0];if(!x&&t!=="who")return;let q=d.find(a=>a!==x),de=v.flatMap(a=>[je(a),...lt.has(je(a))?[...lt]:[]]),T=P.filter(a=>q?a===q:a!==x).flatMap(a=>{let A=ie(a,e.split(" "))??V(p,a).filters.find(D=>D.about==="field"&&D.type==="date");return A?pt(a).filter(D=>(x?D.far===x:Te(D.far))&&D.far!==a).map(D=>({kind:a,field:A,relation:D,said:v.length===0||de.some(ve=>D.words.some(vt=>Lt(vt,ve)))})):[]}).filter(a=>a.said);if(T.length===0)return;let Q=T.filter(a=>n.some(A=>$(a.field.key)===A||$(a.field.label)===A)),R=T.length===1?T[0]:Q.length===1?Q[0]:void 0;if(!R)return;let{kind:K,field:Y,relation:W}=R,X=[...s.ask.from?[{key:Y.key,value:`after:${C(s.ask.from,-1)}`}]:[],...s.ask.to?[{key:Y.key,value:`before:${C(s.ask.to,1)}`}]:[]],Z=w.nodesOfKind(K).filter(a=>X.every(A=>ue(be,a,A))),we=a=>(W.direction==="out"?c.graph.out(a.id,W.key):c.graph.in(a.id,W.key)).filter(A=>A.kind===W.far&&u.has(W.far)),_=[],g=[];for(let a of Z){let A=we(a);A.length===0&&g.push(a);for(let D of A)_.some(ve=>ve.id===D.id)||_.push(D)}let m=Ie(s.ask,Y),E=s.ask.day?`On ${s.ask.day}`:ee(s.ask.words.replace(/^(?:due|for|on|by) (?:the )?/,"")),U=I(K).toLowerCase(),L=X.map(a=>`${a.key}:${a.value}`).join(","),b=`${U} ${m}`,O={to:"kind",kind:K,title:ee(b),filter:L,address:`${se(K)}?${new URLSearchParams({filter:L}).toString()}`,said:`Went to the ${b}.`};if(Z.length===0)return{about:"related",say:`No ${b}. ${O.said}`,moves:[O]};let le=v.join(" "),yt=l==="was"||l==="were",Ge=a=>yt?a===1?"was":"were":a===1?"is":"are",ce=_.map(H),bt=ce.length>8?[...ce.slice(0,8),`${ce.length-8} more`]:ce,kt=_.length===0?`${E}: nobody ${Ge(1)}${le?` ${le}`:""}.`:`${E}: ${fe(bt)}${le?` ${Ge(_.length)} ${le}`:""}.`,$t=t==="who"&&g.length>0?`${fe(g.slice(0,4).map(H))}${g.length>4?` and ${g.length-4} more`:""} ${g.length===1?"has":"have"} nobody.`:"",wt=_.slice(0,8).map(a=>({about:"node",id:a.id,kind:a.kind,label:H(a),why:{field:W.key,reading:Ze(p,W.direction==="out"?K:W.far,W.key,W.direction==="out"?"out":"in"),fragment:m,strength:"field"},current:!0,flagged:ye.has(a.id),address:ge(a)}));return{about:"related",say:[kt,$t,O.said].filter(Boolean).join(" "),moves:[O],picks:wt}},Ke=N.match(jt);if(Ke){let e=Ke[1];if(e&&!rt.has(e)&&!/^(?:it|this|that)$/.test(e)){let n=re(e),r=n?void 0:pe(z(e)||e);if(r?.one){let h=Me(r.one);return{about:"describe",say:`${h.said} ${oe(r.one)}`,moves:[h],subject:r.one.id}}if(!n)return r&&r.picks.length>0?{about:"picks",say:Re(r.picks),moves:[],picks:r.picks}:De()}if(e&&/^(?:it|this|that)$|^(?:here|this place|this page)$/.test(e)){let n=(y.selection??[]).map(r=>w.getNode(r)).find(r=>r!==void 0);if(n)return{about:"describe",say:oe(n),moves:[],subject:n.id}}let t=c.violations();if(t.length===0)return{about:"problems",say:"Nothing is wrong \u2014 every rule holds.",moves:[]};let s={to:"problems",address:"/problems",said:"Went to the problems."};return{about:"problems",say:`${s.said} ${Qe(t)}: ${t.slice(0,4).map(n=>n.message).join("; ")}${t.length>4?"\u2026":"."}`,moves:[s]}}if(Ot.test(N))return Le();let _e=mt(N);if(_e)return _e;let ke=Oe(N,k,j);if(ke&&!re(z(ke.ask.words))&&ke.rest.replace(/'s\b/g,"").split(" ").every(e=>e===""||te.has(e)||Ce.has(e))){let e=ae(N);if(e)return e}if(/^open /.test(N)){let e=ae(N);if(e)return e}let Fe=N.match(Nt)??N.match(/^(?:go|take me|head|get me)(?: back)? (home)$/);if(Fe)return Ee(Fe[1].trim(),!1);let Be=N.match(St);if(Be){let e=Ee(Be[1].trim(),!0);return"unresolved"in e&&e.unresolved&&!/^tell me|^describe/.test(N)?{unresolved:!0}:e}let $e=re(N);if($e){let e=We($e);return{about:"place",say:e.said,moves:[e],subject:$e.slug}}let Ue=ae(N);return Ue||{unresolved:!0}}var Ce=new Set(["who","whom","whose","which","what","whats","what's","who's"]),Et=new Set(["person","people","user","users","member","members","volunteer","volunteers","gardener","gardeners","player","players","staff","worker","workers","employee","employees","owner","owners","assignee","assignees","helper","helpers","student","students","teacher","teachers","customer","customers","client","clients","contact","contacts","author","authors"]),lt=new Set(["work","cover","staff","assign","do","run","schedul","roster","book","duty","serv","help"]);function je(o){let i=o.toLowerCase().replace(/'s$/,"");for(let y of["ing","ed","es","s"])if(i.length>y.length+2&&i.endsWith(y)){let f=i.slice(0,-y.length);return f.length>3&&f[f.length-1]===f[f.length-2]?f.slice(0,-1):f}return i}function ct(o){return o.toLowerCase().split(/[^a-z']+/).filter(i=>i.length>1&&!te.has(i)&&!Ce.has(i)&&!["it","they","them","their","its","this","here","to","at"].includes(i)).map(je)}var Lt=(o,i)=>o===i||o.length>=4&&i.length>=4&&(o.startsWith(i)||i.startsWith(o)),ne=new Set(["done","finished","complete","completed","closed","resolved","agreed","canceled","archived","shipped","delivered"]),Pt=new Set(["open","unfinished","outstanding","pending","remaining","undone","incomplete"]);function ut(o,i){return V(o,i.kind).filters.some(f=>f.about==="field"&&(f.type==="boolean"&&ne.has(f.key.toLowerCase())&&i[f.key]===!0||f.type==="choice"&&typeof i[f.key]=="string"&&ne.has(String(i[f.key]).toLowerCase())))}function fe(o){return o.length<=1?o[0]??"":`${o.slice(0,-1).join(", ")} and ${o[o.length-1]}`}function zt(o,i,y={}){let f=y.scene!==void 0?{...y.pages,scene:y.scene}:y.pages;return[...nt(o,i,f?{pages:f}:{})].map(({first:c,hidden:p,lens:k,...j})=>j)}function gt(o,i){return{...o.principal?{principal:o.principal}:{},...o.places?{places:o.places}:{},...o.selection?{selection:o.selection}:{},...o.place?{place:o.place}:{},...i??o.today?{today:i??o.today}:{},...o.weekStartsOn!==void 0?{weekStartsOn:o.weekStartsOn}:{}}}function Jt(o,i,y,f){let c=ht(o,i,gt(y,f));if(c.unresolved)return c.say?{reply:{say:c.say,proposals:[],grounded:!0}}:{};if(c.about==="picks")return{};let p=c.moves.length>0?{moves:c.moves}:{},k=c.subject?o.graph.getNode(c.subject):void 0;if(c.about==="problems")return{...p,problems:!0};if(k&&(c.about==="describe"||c.about==="here"))return{...p,told:k.id};let j=k?tt(o,ot(Ve(o.violations(),[k.id])).slice(0,3)):[];return{reply:{say:c.say,proposals:j,grounded:!0,...p,...c.picks&&c.picks.length>0?{picks:c.picks}:{},...c.offer?{offer:c.offer}:{}}}}function Yt(o,i,y={}){let f=gt(y),c=[];for(let p of i){let k=typeof p=="string"?p:typeof p=="object"&&p!==null&&typeof p.to=="string"?p.to:void 0;if(!k||k.trim().length===0)continue;let j=ht(o,/^(?:go|take me|open|show)\b/i.test(k.trim())?k:`go to ${k}`,f);if("moves"in j)for(let J of j.moves)c.some(B=>B.address===J.address)||c.push(J)}return c}export{At as NOTHING_BY_THAT_NAME,gt as askContextOf,Jt as goingFrom,Yt as movesFromNames,zt as placesFromViews,ht as resolveAsk};
|