@graview/guest 0.1.8 → 0.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +301 -2
- package/client.js +2 -0
- package/dist/channel.d.ts +11 -3
- package/dist/channel.d.ts.map +1 -1
- package/dist/channel.js +5 -1
- package/dist/channel.js.map +1 -1
- package/dist/cli.d.ts +16 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +75 -0
- package/dist/cli.js.map +1 -0
- package/dist/client-script.d.ts +3 -0
- package/dist/client-script.d.ts.map +1 -0
- package/dist/client-script.js +21 -0
- package/dist/client-script.js.map +1 -0
- package/dist/client.d.ts +2 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.generated.d.ts +4 -0
- package/dist/client.generated.d.ts.map +1 -0
- package/dist/client.generated.js +9 -0
- package/dist/client.generated.js.map +1 -0
- package/dist/client.js +12 -0
- package/dist/client.js.map +1 -0
- package/dist/headless/describe.d.ts +19 -0
- package/dist/headless/describe.d.ts.map +1 -0
- package/dist/headless/describe.js +255 -0
- package/dist/headless/describe.js.map +1 -0
- package/dist/headless/draw.d.ts +17 -0
- package/dist/headless/draw.d.ts.map +1 -0
- package/dist/headless/draw.js +25 -0
- package/dist/headless/draw.js.map +1 -0
- package/dist/headless/index.d.ts +99 -0
- package/dist/headless/index.d.ts.map +1 -0
- package/dist/headless/index.js +143 -0
- package/dist/headless/index.js.map +1 -0
- package/dist/headless/judge.d.ts +16 -0
- package/dist/headless/judge.d.ts.map +1 -0
- package/dist/headless/judge.js +52 -0
- package/dist/headless/judge.js.map +1 -0
- package/dist/headless/node.d.ts +8 -0
- package/dist/headless/node.d.ts.map +1 -0
- package/dist/headless/node.js +80 -0
- package/dist/headless/node.js.map +1 -0
- package/dist/headless/protocol.d.ts +71 -0
- package/dist/headless/protocol.d.ts.map +1 -0
- package/dist/headless/protocol.js +14 -0
- package/dist/headless/protocol.js.map +1 -0
- package/dist/headless/runtime.d.ts +2 -0
- package/dist/headless/runtime.d.ts.map +1 -0
- package/dist/headless/runtime.generated.d.ts +2 -0
- package/dist/headless/runtime.generated.d.ts.map +1 -0
- package/dist/headless/runtime.generated.js +8 -0
- package/dist/headless/runtime.generated.js.map +1 -0
- package/dist/headless/runtime.js +171 -0
- package/dist/headless/runtime.js.map +1 -0
- package/dist/headless/tree.d.ts +54 -0
- package/dist/headless/tree.d.ts.map +1 -0
- package/dist/headless/tree.js +128 -0
- package/dist/headless/tree.js.map +1 -0
- package/dist/host/css.d.ts +118 -0
- package/dist/host/css.d.ts.map +1 -0
- package/dist/host/css.js +963 -0
- package/dist/host/css.js.map +1 -0
- package/dist/host/draw-budget.d.ts +10 -0
- package/dist/host/draw-budget.d.ts.map +1 -0
- package/dist/host/draw-budget.js +29 -0
- package/dist/host/draw-budget.js.map +1 -0
- package/dist/host/frame.d.ts +19 -1
- package/dist/host/frame.d.ts.map +1 -1
- package/dist/host/frame.js +21 -2
- package/dist/host/frame.js.map +1 -1
- package/dist/host/index.d.ts +4 -3
- package/dist/host/index.d.ts.map +1 -1
- package/dist/host/index.js +7 -1
- package/dist/host/index.js.map +1 -1
- package/dist/host/kit.d.ts +6 -2
- package/dist/host/kit.d.ts.map +1 -1
- package/dist/host/kit.js +12 -5
- package/dist/host/kit.js.map +1 -1
- package/dist/host/links.d.ts +24 -0
- package/dist/host/links.d.ts.map +1 -0
- package/dist/host/links.js +35 -0
- package/dist/host/links.js.map +1 -0
- package/dist/host/manifest.d.ts +50 -0
- package/dist/host/manifest.d.ts.map +1 -0
- package/dist/host/manifest.js +103 -0
- package/dist/host/manifest.js.map +1 -0
- package/dist/host/open-draw.d.ts +44 -0
- package/dist/host/open-draw.d.ts.map +1 -0
- package/dist/host/open-draw.js +108 -0
- package/dist/host/open-draw.js.map +1 -0
- package/dist/host/open-judge.d.ts +53 -0
- package/dist/host/open-judge.d.ts.map +1 -0
- package/dist/host/open-judge.js +95 -0
- package/dist/host/open-judge.js.map +1 -0
- package/dist/host/open-render.d.ts +32 -0
- package/dist/host/open-render.d.ts.map +1 -0
- package/dist/host/open-render.js +262 -0
- package/dist/host/open-render.js.map +1 -0
- package/dist/host/press.d.ts +15 -0
- package/dist/host/press.d.ts.map +1 -0
- package/dist/host/press.js +156 -0
- package/dist/host/press.js.map +1 -0
- package/dist/host/react.d.ts +15 -2
- package/dist/host/react.d.ts.map +1 -1
- package/dist/host/react.js +13 -5
- package/dist/host/react.js.map +1 -1
- package/dist/host/session.d.ts +94 -1
- package/dist/host/session.d.ts.map +1 -1
- package/dist/host/session.js +103 -14
- package/dist/host/session.js.map +1 -1
- package/dist/host/theme.d.ts +14 -0
- package/dist/host/theme.d.ts.map +1 -0
- package/dist/host/theme.js +51 -0
- package/dist/host/theme.js.map +1 -0
- package/dist/host/view-runtime.generated.d.ts +2 -0
- package/dist/host/view-runtime.generated.d.ts.map +1 -0
- package/dist/host/view-runtime.generated.js +7 -0
- package/dist/host/view-runtime.generated.js.map +1 -0
- package/dist/host/view-source.d.ts +5 -0
- package/dist/host/view-source.d.ts.map +1 -0
- package/dist/host/view-source.js +39 -0
- package/dist/host/view-source.js.map +1 -0
- package/dist/host/view.d.ts +134 -0
- package/dist/host/view.d.ts.map +1 -0
- package/dist/host/view.js +381 -0
- package/dist/host/view.js.map +1 -0
- package/dist/host/views.d.ts +10 -0
- package/dist/host/views.d.ts.map +1 -0
- package/dist/host/views.js +15 -0
- package/dist/host/views.js.map +1 -0
- package/dist/host/worker-react.d.ts +51 -0
- package/dist/host/worker-react.d.ts.map +1 -0
- package/dist/host/worker-react.js +123 -0
- package/dist/host/worker-react.js.map +1 -0
- package/dist/host/worker-start.d.ts +49 -0
- package/dist/host/worker-start.d.ts.map +1 -0
- package/dist/host/worker-start.js +122 -0
- package/dist/host/worker-start.js.map +1 -0
- package/dist/host/worker.d.ts +17 -12
- package/dist/host/worker.d.ts.map +1 -1
- package/dist/host/worker.js +58 -117
- package/dist/host/worker.js.map +1 -1
- package/dist/host/writes.d.ts +49 -0
- package/dist/host/writes.d.ts.map +1 -0
- package/dist/host/writes.js +76 -0
- package/dist/host/writes.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/open-kit.d.ts +148 -0
- package/dist/open-kit.d.ts.map +1 -0
- package/dist/open-kit.js +321 -0
- package/dist/open-kit.js.map +1 -0
- package/dist/protocol.d.ts +109 -3
- package/dist/protocol.d.ts.map +1 -1
- package/dist/protocol.js +13 -0
- package/dist/protocol.js.map +1 -1
- package/dist/worker/harden.d.ts +13 -2
- package/dist/worker/harden.d.ts.map +1 -1
- package/dist/worker/harden.js +10 -4
- package/dist/worker/harden.js.map +1 -1
- package/dist/worker/natives.d.ts +1 -0
- package/dist/worker/natives.d.ts.map +1 -1
- package/dist/worker/natives.js +4 -0
- package/dist/worker/natives.js.map +1 -1
- package/dist/worker/view-global.d.ts +70 -0
- package/dist/worker/view-global.d.ts.map +1 -0
- package/dist/worker/view-global.js +264 -0
- package/dist/worker/view-global.js.map +1 -0
- package/dist/worker/view.d.ts +14 -0
- package/dist/worker/view.d.ts.map +1 -0
- package/dist/worker/view.js +64 -0
- package/dist/worker/view.js.map +1 -0
- package/package.json +30 -4
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* GENERATED by scripts/guest-view-runtime.mjs from src/worker/view.ts — do not edit.
|
|
3
|
+
* A worker view's runtime as one classic script (FR-96): the host puts it in
|
|
4
|
+
* front of a view's own source. Carries Remote DOM (MIT, Shopify Inc.).
|
|
5
|
+
*/
|
|
6
|
+
export const VIEW_RUNTIME = "\"use strict\";\n/*! @remote-dom/core and @remote-dom/polyfill — Copyright 2020-present, Shopify Inc. — 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 — Elastic License 2.0. */\n\"use strict\";(()=>{var we=globalThis,zr=we.addEventListener,jr=we.removeEventListener,Fr=we.postMessage,qr=globalThis.queueMicrotask,nn=globalThis.performance,Yr=nn?nn.now.bind(nn):Date.now,xe={listen:t=>zr.call(we,\"message\",t),unlisten:t=>jr.call(we,\"message\",t),post:t=>Fr.call(we,t),microtask:t=>qr.call(globalThis,t),now:()=>Yr()};var w=Symbol(\"name\"),ae=Symbol(\"prefix\"),le=Symbol(\"value\"),x=Symbol(\"ns\"),z=Symbol(\"owner\"),k=Symbol(\"owner_document\"),J=Symbol(\"attributes\"),I=Symbol(\"prev\"),p=Symbol(\"next\"),O=Symbol(\"child\"),j=Symbol(\"parent\"),ce=Symbol(\"host\"),Y=Symbol(\"data\"),he=Symbol(\"listeners\"),rn=Symbol(\"isTrusted\"),ve=Symbol(\"path\"),Se=Symbol(\"stop_immediate_propagation\"),Oe=Symbol(\"dispatching\"),ne=Symbol(\"content\"),M=Symbol(\"hooks\"),at=Symbol(\"extensions\"),ge=Symbol(\"hooks_dispatch\"),U=Symbol(\"is_connected\"),Re=Symbol(\"create_element\"),Un=0,q=1,Ae=2,_e=3,Pe=8,be=9,Gn=10,ue=11,R=\"http://www.w3.org/1999/xhtml\",W=\"http://www.w3.org/2000/svg\",Vn=\"http://www.w3.org/XML/1998/namespace\",Fe=\"http://www.w3.org/2000/xmlns/\";function lt(t){return t.split(/[\\t\\n\\f\\r ]+/).filter(Boolean)}function L(t){return t.replace(/[A-Z]/g,e=>String.fromCharCode(e.charCodeAt(0)+32))}function Bn(t){return t.replace(/[a-z]/g,e=>String.fromCharCode(e.charCodeAt(0)-32))}function P(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 zn=/^(?:[A-Za-z][^\\0\\t\\n\\f\\r\\u0020/>]*|[:_\\u0080-\\u{10FFFF}][A-Za-z0-9-.:_\\u0080-\\u{10FFFF}]*)$/u,jn=/[\\0\\t\\n\\f\\r />=]/u,Wr=/[\\0\\t\\n\\f\\r />]/u;function re(t){if(t==null)return null;let e=String(t);return e===\"\"?null:e}function Fn(t){zn.test(t)||sn(t)}function on(t){(t===\"\"||jn.test(t))&&sn(t)}function ct(t,e,n){let r=re(t),o=String(e),i=o.indexOf(\":\"),s=i<0?null:o.slice(0,i),a=i<0?o:o.slice(i+1);if((s!=null&&(s===\"\"||Wr.test(s))||(n===\"element\"?!zn.test(a):a===\"\"||jn.test(a)))&&sn(o),s!=null&&r==null)throw P(`A namespace is required for the prefix in \"${o}\"`,\"NamespaceError\");if(s===\"xml\"&&r!==Vn)throw P(\"The xml prefix requires the XML namespace\",\"NamespaceError\");if((o===\"xmlns\"||s===\"xmlns\")&&r!==Fe)throw P(\"The xmlns name requires the XMLNS namespace\",\"NamespaceError\");if(r===Fe&&o!==\"xmlns\"&&s!==\"xmlns\")throw P(\"The XMLNS namespace requires the xmlns name or prefix\",\"NamespaceError\");return{namespace:r,qualifiedName:o,prefix:s,localName:a}}function sn(t){throw P(`Invalid name: \"${t}\"`,\"InvalidCharacterError\")}var ut=0,dt=1,qn=2,an=3,Xr=typeof performance>\"u\"?Date.now:performance.now.bind(performance),G=class{static NONE=ut;static CAPTURING_PHASE=dt;static AT_TARGET=qn;static BUBBLING_PHASE=an;timeStamp=Xr();target=null;currentTarget=null;srcElement=null;bubbles=!1;cancelable=!1;composed=!1;defaultPrevented=!1;cancelBubble=!1;eventPhase=ut;[ve]=[];[Se]=!1;[Oe]=!1;constructor(e,n){this.type=e,Object.defineProperty(this,rn,{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[rn]}composedPath(){return[...this[ve]]}stopPropagation(){this.cancelBubble=!0}stopImmediatePropagation(){this[Se]=!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 ln(t,e,n){if(t.cancelBubble)return;let o=e[he]?.get(t.type)?.[n===dt?\"capture\":\"bubble\"];if(o)for(let i of[...o]){if(!o.has(i)||i.signal?.aborted)continue;t.eventPhase=t.target===e?qn:n,t.currentTarget=e;let s=i.normalizedListener;try{typeof s==\"object\"?s.handleEvent(t):s.call(e,t)}catch(a){setTimeout($r,0,a)}if(t[Se])break}}function $r(t){throw t}var qe=[],ft=new WeakMap;function mt(t,e){let n=ft.get(t);n?n.push(e):ft.set(t,[e]),qe[qe.length-1].push(t)}function V(t){let e=[];qe.push(e);let n;try{n=t()}catch(r){qe.pop();try{Yn(e)}catch{}throw r}return qe.pop(),Yn(e),n}function Yn(t){let e,n=!1;for(let r of t){let o=ft.get(r);if(o){for(;o.length>0;){let i=o.shift();try{i()}catch(s){n||(e=s,n=!0)}}ft.delete(r)}}if(n)throw e}var pt=[],Ye=[],cn=!1;function Ee(t){for(let e of t)pt.push(e),e[1]&&Ye.push(e[1]);if(!cn){cn=!0;try{let e,n=!1;for(let r=0;r<pt.length;r++){let[o,i]=pt[r];i&&Ye.splice(Ye.indexOf(i),1);try{o()}catch(s){n||(e=s,n=!0)}}if(n)throw e}finally{pt.length=0,Ye.length=0,cn=!1}}}function We(t){let e=t;for(;e;){if(Ye.includes(e))return!0;e=e[j]??e[ce]}return!1}var Xe=Symbol(\"listenerRegistrations\"),de=class{[he]=void 0;[Xe]=void 0;[k]=void 0;addEventListener(e,n,r){if(n==null)return;let o=r===!0||typeof r==\"object\"&&r.capture===!0,i=typeof r==\"object\"&&r.once===!0,s=typeof r==\"object\"?r.signal:void 0;if(s?.aborted)return;let a=un(o),u=this[Xe];u||(u=new Map,this[Xe]=u);let c=u.get(e);c||(c={},u.set(e,c));let f=c[a];if(f||(f=new Map,c[a]=f),f.has(n))return;let m=this,b={type:e,listener:n,capture:o,once:i,normalizedListener:n,signal:s};(i||s)&&(b.normalizedListener=function(...C){if(b.signal?.aborted){ht(m,b);return}return b.once&&ht(m,b),typeof b.listener==\"object\"?b.listener.handleEvent(...C):b.listener.call(this,...C)});let h=this[he];h||(h=new Map,this[he]=h);let v=h.get(e);v||(v={},h.set(e,v));let g=v[a];if(g||(g=new Set,v[a]=g),f.set(n,b),g.add(b),s){let y=()=>{ht(m,b)};b.abortListener=y,s.addEventListener(\"abort\",y,{once:!0})}this[k]?.defaultView[ge].addEventListener?.(this,e,n,r)}removeEventListener(e,n,r){return Kr.call(this,e,n,r)}dispatchEvent(e){if(e[Oe])throw P(\"Failed to execute 'dispatchEvent' on 'EventTarget': The event is already being dispatched.\",\"InvalidStateError\");e[Oe]=!0;try{let n=[],r=this;for(;r!=null;)n.push(r),r=r.parentNode;e.target=this,e.srcElement=this,e[ve]=n;for(let i=n.length;i--;)if(ln(e,n[i],dt),e.cancelBubble)return!e.defaultPrevented;let o=e.bubbles?n:n.slice(0,1);for(let i=0;i<o.length;i++)if(ln(e,o[i],an),e.cancelBubble)return!e.defaultPrevented;return!e.defaultPrevented}finally{e[Oe]=!1,e.cancelBubble=!1,e[Se]=!1,e.eventPhase=ut,e.currentTarget=null,e[ve]=[]}}};function Kr(t,e,n){if(e==null)return;let r=n===!0||n&&n.capture===!0,o=un(!!r),i=this[Xe]?.get(t)?.[o]?.get(e);i&&ht(this,i)}function un(t){return t?\"capture\":\"bubble\"}function ht(t,e){let n=un(e.capture),r=t[Xe],o=r?.get(e.type);if(!o)return;let i=o[n];if(!i||i.get(e.listener)!==e)return;i.delete(e.listener),i.size===0&&delete o[n],!o.bubble&&!o.capture&&r?.delete(e.type),e.signal&&e.abortListener&&e.signal.removeEventListener(\"abort\",e.abortListener);let s=t[he],a=s?.get(e.type);if(!a)return;let u=a[n];u?.delete(e)&&(u.size===0&&delete a[n],!a.bubble&&!a.capture&&s?.delete(e.type),t[k]?.defaultView[ge].removeEventListener?.(t,e.type,e.listener,e.capture))}var X=class extends Array{item(e){return this[e]??null}};var Ke=0,Wn=1,mn=2,pn=3,Qe=4,Xn=0,$n=1,Et=2,yt=3,Kn=4,fn=5,Qn=6,Zn=7,gt=/^(?:--|-?[A-Za-z_\\u0080-\\u{10FFFF}])[A-Za-z0-9_\\u0080-\\u{10FFFF}-]*$/u;function Qr(t,e){let n=1,r=null;for(let o=e;o<t.length;o++){let i=t[o];if(r){i===\"\\\\\"?o++:i===r&&(r=null);continue}if(i==='\"'||i===\"'\")r=i;else if(i===\"(\")n++;else if(i===\")\"&&--n===0)return[t.slice(e,o),o+1]}return[t.slice(e),t.length]}function F(t){throw P(`Invalid or unsupported selector: \"${t}\"`,\"SyntaxError\")}function Nt(t,e){let n=typeof e==\"string\"?Ze(e):[{combinator:Qe,matchers:e}],r=null,o=t[O];return o&&n[0].matchers.length&&hn(o,n,i=>(r=i,!1)),r}function Tt(t,e){let n=typeof e==\"string\"?Ze(e):[{combinator:Qe,matchers:e}],r=new X,o=t[O];return o&&n[0].matchers.length&&hn(o,n,i=>{r.push(i)}),r}function Ze(t,e=!1,n=!1){let r={combinator:Qe,matchers:[]},o=[r],i=/[\\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,s=t.replace(/^[\\t\\n\\f\\r ]+|[\\t\\n\\f\\r ]+$/g,\"\");s===\"\"&&F(t);let a=0,u;for(;u=i.exec(s);){u.index!==a&&F(t),u[1]&&(r.matchers.length===0&&!(n&&o.length===1)&&F(t),u[1]===\">\"?r.combinator=Wn:u[1]===\"+\"?r.combinator=pn:u[1]===\"~\"?r.combinator=mn:r.combinator=Ke,r={combinator:Qe,matchers:[]},o.push(r));let c=u[8]?L(u[8]):u[2]||u[7];u[7]!=null&&!u[6]&&r.matchers.length>0&&F(t);let m,b=u[4]??u[5]??u[7];if(u[2]){gt.test(c)||F(t);let h=u[5],v=h?.[0];if(u[3]==null&&(v==='\"'||v===\"'\")){let g=u[0].lastIndexOf(h);b=s.slice(u.index+g+1),i.lastIndex=s.length}else h!=null&&!gt.test(h)&&F(t);m=Kn}else u[6]?(gt.test(c)||F(t),m=u[6]===\"#\"?Et:yt):u[8]?m=u[9]==null?fn:Qn:u[7]===\"*\"?m=Xn:u[7]&>.test(u[7])?m=$n:F(t);u[9]?([b,i.lastIndex]=Qr(s,i.lastIndex),c!==\"has\"&&c!==\"not\"&&F(t),c===\"has\"&&e&&F(t),Ze(b,e||c===\"has\",c===\"has\")):m===fn&&F(t),r.matchers.push({type:m,name:c,value:b}),a=i.lastIndex}return(a!==s.length||r.matchers.length===0)&&F(t),o}function Zr(t,e){let n=Ze(e);return n[0]?.matchers.length?$e(t,n):!1}function Jr(t,e){let n=Ze(e,!0,!0),r=n[0];if(n.length===1&&r.matchers.length===0)return!1;let o=Ke,i={type:Zn,name:\":scope\"};if(r.matchers.length===0?(o=r.combinator,r.matchers.push(i)):n.unshift({combinator:Ke,matchers:[i]}),n.some(({matchers:u})=>u.length===0))return!1;let s=o===pn||o===mn?t[p]:t[O];if(!s)return!1;let a=!1;return hn(s,n,()=>(a=!0,!1),t),a}function hn(t,e,n,r){let o=[],i=t;for(;i;){if(B(i)){if($e(i,e,r)&&n(i)===!1)return!1;let s=i[O];if(s){let a=i[p];a&&o.push(a),i=s;continue}}i=i[p]??o.pop()??null}return!0}function $e(t,e,n){let{combinator:r,matchers:o}=e[e.length-1];if(r===Qe){if(!bt(t,o,n))return!1;let a=e.slice(0,-1);return a.length===0||$e(t,a,n)}let i=r===Wn||r===Ke?j:I,s=t[i];if(!s)return!1;if(r===Ke||r===mn){for(;s;){if(B(s)&&bt(s,o,n)){let a=e.slice(0,-1);if(a.length===0||$e(s,a,n))return!0}s=s[i]}return!1}else{if(r===pn&&!B(s)){for(;s&&!B(s);)s=s[i];if(!s)return!1}if(!B(s)||!bt(s,o,n))return!1;let a=e.slice(0,-1);return a.length===0||$e(s,a,n)}}function dn(t,e){return t.getAttributeNS(null,t.namespaceURI===R?L(e):e)}function bt(t,e,n){if(!t)return!1;if(Array.isArray(e)){for(let s of e)if(bt(t,s,n)===!1)return!1;return!0}let{type:r,name:o,value:i}=e;switch(r){case Xn:return o===\"*\";case $n:return t.namespaceURI===R?t.localName===L(o):t.localName===o;case Et:return dn(t,\"id\")===o;case yt:let s=dn(t,\"class\");return s?lt(s).includes(o):!1;case Kn:let a=dn(t,o);return i==null?a!=null:a===i;case Zn:return t===n;case fn:F(`:${o}`);case Qn:switch(o){case\"has\":return Jr(t,i||\"\");case\"not\":return!Zr(t,i||\"\");default:F(`:${o}(${i})`)}}return!1}function eo(t){return t.nodeType===Ae}function Je(t){return Y in t}function bn(t){return t.nodeType===_e}function to(t){return t.nodeType===Pe}function B(t){return t.nodeType===q}function gn(t){return t.nodeType===ue}function nr(t){return\"appendChild\"in t}function wt(t){let e=[],n=[t],r=new Set(n),o=new Set,i;for(;n.length>0;){let s=n.pop();if(r.delete(s),o.has(s))continue;let a=[];for(let u of tt(s)){if(o.has(u)||(o.add(u),e.push(u),a.push(u),!B(u)))continue;let c=u[J];if(c)for(let m of c)o.has(m)||(o.add(m),e.push(m));let f=u[ne];f&&!o.has(f)&&!r.has(f)&&(r.add(f),n.push(f))}i??=a}return{nodes:e,treeNodes:i}}function et(t,e){for(let n of t)n[k]=e}function Jn(t,e){let n=t.constructor,r=new n(t.name,t.value,t.namespaceURI);return r[k]=e,r}function er(t,e){if(bn(t))return e.createTextNode(t.data);if(to(t))return e.createComment(t.data);if(eo(t))return Jn(t,e);if(B(t)){let n=e[Re](t[w],t.namespaceURI,t[ae],t.localName);if(t[J])for(let r=0;r<t[J].length;r++){let o=t[J].item(r);n.attributes.setNamedItem(Jn(o,e))}return n}else{if(gn(t))return e.createDocumentFragment();{let n=new t.constructor;return n[k]=e,n}}}function xt(t,e,n=t.ownerDocument){if(t.nodeType===be)throw P(\"Cannot clone a document node\",\"NotSupportedError\");let r=er(t,n);if(!e||!B(t)&&!gn(t))return r;let o=new Set([t]),i=[{source:t,destination:r,childIndex:0,cloningContent:!1}];for(;i.length>0;){let s=i[i.length-1],a,u;if(s.cloningContent)if(s.contentSource&&s.contentDestination)a=s.contentSource.childNodes[s.childIndex++],u=s.contentDestination;else{i.pop(),s.appendTo&&s.appendTo.appendChild(s.destination);continue}else if(a=s.source.childNodes[s.childIndex++],u=s.destination,!a){if(s.cloningContent=!0,s.childIndex=0,B(s.source)&&s.source.namespaceURI===R&&s.source.localName===\"template\"){let f=s.source[ne];f&&(o.has(f)&&tr(),o.add(f),s.contentSource=f,s.contentDestination=s.destination.content)}continue}if(!a){i.pop(),s.appendTo&&s.appendTo.appendChild(s.destination);continue}o.has(a)&&tr(),o.add(a);let c=er(a,n);B(a)||gn(a)?i.push({source:a,destination:c,appendTo:u,childIndex:0,cloningContent:!1}):u.appendChild(c)}return r}function tr(){throw new Error(\"Cannot clone a cyclic or repeated node graph\")}function vt(t,e){let n=String(e);return n===\"\"?null:Nt(t,[{type:Et,name:n}])}function St(t,e){let n=[...new Set(lt(String(e)))];return Tt(t,n.map(r=>({type:yt,name:r})))}function Ot(t,e){let n=String(e),r=L(n),o=[];for(let i of Rt(t))B(i)&&(n===\"*\"||(i.namespaceURI===R?i[w]===r:i[w]===n))&&o.push(i);return o}function Rt(t){let e=[],n=[],r=t[O];for(;r;){e.push(r);let o=r[O],i=r[p];o?(i&&n.push(i),r=o):r=i??n.pop()??null}return e}function tt(t){let e=Rt(t);return e.unshift(t),e}var $=class extends de{nodeType=Un;[w]=\"\";[j]=null;[ce]=null;[O]=null;[I]=null;[p]=null;[U]=!1;get[M](){return this[k].defaultView[ge]}get localName(){return this[w]}get nodeName(){return this[w]}get ownerDocument(){return this[k]}get isConnected(){return this[U]}isDefaultNamespace(e){let n=re(e);return no(this)===n}get parentNode(){return this[j]}set parentNode(e){}get parentElement(){let e=this[j];return!e||e.nodeType!==1?null:e}set parentElement(e){}get previousSibling(){return this[I]}set previousSibling(e){}get nextSibling(){return this[p]}set nextSibling(e){}get previousElementSibling(){let e=this[I];for(;e&&e.nodeType!==1;)e=e[I];return e}set previousElementSibling(e){}get nextElementSibling(){let e=this[p];for(;e&&e.nodeType!==1;)e=e[p];return e}set nextElementSibling(e){}get firstChild(){return this[O]}set firstChild(e){}get lastChild(){let e=this[O];for(;e;){let n=e[p];if(n==null)break;e=n}return e}set lastChild(e){}get nodeValue(){return Je(this)?this.data:null}set nodeValue(e){Je(this)&&(this.data=e)}get textContent(){if(Je(this))return this.data;let e=\"\";for(let n of Rt(this))bn(n)&&(e+=n.data);return e}set textContent(e){if(Je(this))this.data=e;else if(nr(this)){let n=e==null?\"\":String(e);n===\"\"?this.replaceChildren():this.replaceChildren(n)}}cloneNode(e){return xt(this,e)}contains(e){let n=e;for(;n!=null;){if(n===this)return!0;n=n.parentNode}return!1}};function no(t){let e=t;for(;e;)switch(e.nodeType){case q:{let n=e;if(n.prefix==null&&n.namespaceURI!=null)return n.namespaceURI;let r=n.attributes.getNamedItemNS(Fe,\"xmlns\");if(r!=null&&r.prefix==null)return re(r.value);e=n.parentElement;break}case be:e=e.documentElement;break;case Gn:case ue:return null;case Ae:e=e.ownerElement;break;default:e=e.parentElement}return null}var K=Symbol(\"insertNode\"),Nn=Symbol(\"preflightInsertions\"),At=Symbol(\"replaceNode\"),fe=class extends ${remove(){let e=this.parentNode;e&&e.removeChild(this)}replaceWith(...e){let n=ye(e),r=this.parentNode;if(r)return En(o=>{oe(r,n);let i=this[p];for(;i&&n.includes(i);)i=i[p];let s=yn(r,n,o);this.parentNode===r?r[At](s,this,o):r[K](s,i,o)})}before(...e){let n=ye(e),r=this.parentNode;if(r)return En(o=>{oe(r,n);let i=this[I];for(;i&&n.includes(i);)i=i[I];let s=yn(r,n,o);r[K](s,i?i[p]:r.firstChild,o)})}after(...e){let n=ye(e),r=this.parentNode;if(r)return En(o=>{oe(r,n);let i=this[p];for(;i&&n.includes(i);)i=i[p];let s=yn(r,n,o);r[K](s,i,o)})}};function En(t){return V(()=>{let e=[];try{t(e)}catch(n){try{Ee(e)}catch{}throw n}Ee(e)})}function ye(t){return t.map(e=>e instanceof $?e:String(e))}function nt(t,e){return e instanceof $?e:t.ownerDocument.createTextNode(String(e))}function oe(t,e){for(let n of e){if(!(n instanceof $))continue;let r=t;for(;r;){if(r===n)throw P(\"Cannot insert a node into itself or one of its descendants\",\"HierarchyRequestError\");r=r[j]??r[ce]}}}function yn(t,e,n){let r=[];for(let i of e)r.push(nt(t,i));if(r.length===1)return r[0];let o=t.ownerDocument.createDocumentFragment();o[Nn](r);for(let i of r)o[K](i,null,n);return o}var _t,Tn=0,rr=0,or=0,ir=0,Ce=!1,xn=!1,rt=!1,Pt=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=ro(n),o=_t??=new WeakMap,i=o.get(e);i==null&&(i=new Map,o.set(e,i));let s=i.get(this);s==null?Tn++:wn(s,-1),i.set(this,r),wn(r,1),this.#e.add(e)}disconnect(){let e=_t;if(e!=null){for(let n of this.#e){let r=e.get(n),o=r?.get(this);o!=null&&(r.delete(this),Tn--,wn(o,-1)),r?.size===0&&e.delete(n)}this.#e.clear(),this.#n.length=0,Tn===0&&(_t=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 Q(t){let e=_t;if(e==null)return;let n=new Map,r=t.target;for(;r;){let o=e.get(r);if(o)for(let[i,s]of o){if(r!==t.target&&!s.subtree)continue;let a=!1;if(t.type===\"attributes\"){if(!s.attributes||s.attributeFilter&&!s.attributeFilter.has(t.attributeName??\"\"))continue;a=s.attributeOldValue}else if(t.type===\"characterData\"){if(!s.characterData)continue;a=s.characterDataOldValue}else if(!s.childList)continue;n.set(i,n.get(i)===!0||a)}r=r.parentNode}for(let[o,i]of n)o.enqueue({addedNodes:t.addedNodes??new X,attributeName:t.attributeName??null,attributeNamespace:t.attributeNamespace??null,nextSibling:t.nextSibling??null,oldValue:i?t.oldValue??null:null,previousSibling:t.previousSibling??null,removedNodes:t.removedNodes??new X,target:t.target,type:t.type})}function Ct(...t){let e=new X;return e.push(...t),e}function ro(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 wn(t,e){t.attributes&&(rr+=e),t.characterData&&(or+=e),t.childList&&(ir+=e),Ce=rr>0,xn=or>0,rt=ir>0}var ee=class extends fe{childNodes=new X;children=new X;appendChild(e){return V(()=>this[K](e,null))}insertBefore(e,n){return V(()=>this[K](e,n||null))}append(...e){return V(()=>{let n=ye(e.filter(r=>r!=null));n.length>1&&oe(this,n);for(let r of n)this[K](nt(this,r),null)})}prepend(...e){return V(()=>{let n=ye(e.filter(o=>o!=null));n.length>1&&oe(this,n);let r=this.firstChild;for(let o of n)this[K](nt(this,o),r)})}replaceChildren(...e){return V(()=>{let n=ye(e.filter(o=>o!=null));oe(this,n);let r;for(;r=this.firstChild;)this.removeChildImmediately(r);for(let o of n)this[K](nt(this,o),null)})}removeChild(e){return V(()=>(this.removeChildImmediately(e),e))}removeChildImmediately(e){if(e.parentNode!==this)throw P(\"The node is not a child of this node\",\"NotFoundError\");let n=this[U]?tt(e):void 0,r=e[I],o=e[p],i=kt(this,e);if(n)for(let s of n)s[U]=!1;this.queueRemovalMutationRecord(this,e,r,o),n&&this.enqueueTreeReactions(n,\"disconnectedCallback\"),Ee(this.collectRemovalHookEffects(e,i))}replaceChild(e,n){return V(()=>this[At](e,n))}[At](e,n,r){if(oe(this,[e]),n.parentNode!==this)throw P(\"The reference node is not a child of this parent\",\"NotFoundError\");let o=n[I],i=n[p],s=this.prepareInsertion(e),a=this[U]?tt(n):void 0,u=new Set(s.map(({node:b})=>b)),c=i;for(;c&&u.has(c);)c=c[p];let f=kt(this,n);if(a){for(let h of a)h[U]=!1;let b=new Set(a);for(let h of s)b.has(h.node)&&(h.shouldDisconnect=!1)}this.commitInsertion(s,c);let m=this[U];return this.queueRemovalMutationRecord(this,n,o,i),this.queueInsertionMutationRecords(s),a&&this.enqueueTreeReactions(a,\"disconnectedCallback\"),this.enqueueInsertionReactions(s,m),this.performOrCollectHookEffects([...this.collectRemovalHookEffects(n,f),...this.collectInsertionHookEffects(s)],r),n}querySelectorAll(e){return Tt(this,e)}querySelector(e){return Nt(this,e)}[K](e,n,r){return this.validateInsertion(e,n),this.insertIntoValidated(e,n,r),e}[Nn](e){for(let n of e)this.validateInsertion(n,null),this.prepareInsertion(n)}validateInsertion(e,n){if(oe(this,[e]),n&&n.parentNode!==this)throw P(\"The reference node is not a child of this parent\",\"NotFoundError\")}insertIntoValidated(e,n,r){e===n&&(n=e[p]);let o=this.prepareInsertion(e);this.commitInsertion(o,n);let i=this[U];this.queueInsertionMutationRecords(o),this.enqueueInsertionReactions(o,i),this.performOrCollectHookEffects(this.collectInsertionHookEffects(o),r)}performOrCollectHookEffects(e,n){n?n.push(...e):Ee(e)}prepareInsertion(e){let n=[];if(e.nodeType===ue){let s=e[O];for(;s;)n.push(s),s=s[p]}else n.push(e);let r=this[U],o=this[k],i=[];for(let s of n){let a=s[U],u=a||r,c,f;if(s[k]===o)u&&(c=tt(s));else{let m=wt(s);f=m.nodes,u&&(c=m.treeNodes)}i.push({node:s,nodes:c,adoption:f,shouldDisconnect:a})}return i}commitInsertion(e,n){for(let i of e){let s=i.node[j];if(s){let a=i.node[I],u=i.node[p];i.source={parent:s,index:kt(s,i.node),previousSibling:a,nextSibling:u}}}for(let i of e){let s=this.attachChild(i.node,n);i.insertIndex=s.index,i.previousSibling=s.previousSibling,i.nextSibling=s.nextSibling}let r=this[k];for(let{adoption:i}of e)i&&et(i,r);let o=this[U];for(let{nodes:i}of e)if(i)for(let s of i)s[U]=o}attachChild(e,n){if(n){let i=n[I];e[p]=n,e[I]=i,i?i[p]=e:this[O]=e,n[I]=e}else{e[p]=null;let i=this[O];if(i){let s;for(;s=i[p];)i=s;i[p]=e,e[I]=i}else this[O]=e,e[I]=null}let r=B(e);e[j]=this;let o;if(n){if(o=this.childNodes.indexOf(n),this.childNodes.splice(o,0,e),r){let i=n;for(;i&&!B(i);)i=i[p];i?this.children.splice(this.children.indexOf(i),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[I],nextSibling:e[p]}}queueRemovalMutationRecord(e,n,r,o){rt&&Q({type:\"childList\",target:e,removedNodes:Ct(n),previousSibling:r,nextSibling:o})}queueInsertionMutationRecords(e){if(rt)for(let n of e){let{node:r,source:o}=n;o&&this.queueRemovalMutationRecord(o.parent,r,o.previousSibling,o.nextSibling),Q({type:\"childList\",target:this,addedNodes:Ct(r),previousSibling:n.previousSibling,nextSibling:n.nextSibling})}}collectRemovalHookEffects(e,n){return this.nodeType!==q||We(this)?[]:[[()=>this[M].removeChild?.(this,e,n)]]}collectInsertionHookEffects(e){let n=[];for(let r of e){let{node:o,source:i}=r;i?.parent.nodeType===q&&!We(i.parent)&&n.push([()=>i.parent[M].removeChild?.(i.parent,o,i.index)]),this.nodeType===q&&!We(this)&&n.push([()=>this[M].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){ar(e,n)}};function sr(t,e,n,r){if(e.parentNode!==t)throw Error(\"not a child of this node\");let o=t[U]?n.treeNodes:void 0,i=e[I],s=e[p],a=kt(t,e);if(o)for(let c of o)c[U]=!1;et(n.nodes,r),rt&&Q({type:\"childList\",target:t,removedNodes:Ct(e),previousSibling:i,nextSibling:s}),o&&ar(o,\"disconnectedCallback\");let u=[];t.nodeType===q&&!We(t)&&u.push([()=>t[M].removeChild?.(t,e,a)]),Ee(u)}function kt(t,e){let n=e[I],r=e[p];n?n[p]=r:t[O]=r,r&&(r[I]=n);let o=t.childNodes.indexOf(e);return t.childNodes.splice(o,1),B(e)&&t.children.splice(t.children.indexOf(e),1),e[j]=null,e[p]=null,e[I]=null,o}function ar(t,e){for(let n of t){let r=n[e];typeof r==\"function\"&&mt(n,()=>r.call(n))}}function ot(t,e,n,r,o){let{observedAttributes:i}=t.constructor,{attributeChangedCallback:s}=t;s==null||i==null||!i.includes(e)||mt(t,()=>s.call(t,e,n,r,o))}var It=class{[O]=null;constructor(e){this[z]=e}getNamedItem(e){let n=String(e),r=this[z][x]===R?L(n):n,o=this[O];for(;o;){if(o.name===r)return o;o=o[p]}return null}getNamedItemNS(e,n){let r=re(e),o=String(n),i=this[O];for(;i;){if(i.localName===o&&i[x]===r)return i;i=i[p]}return null}item(e){let n=this[O],r=0;for(;n;){if(r++===e)return n;n=n[p]}return null}get length(){let e=0,n=this[O];for(;n;)e++,n=n[p];return e}removeNamedItem(e){let n=String(e),r=this[z][x]===R?L(n):n;return V(()=>this.removeNamedItemImmediately(o=>o.name===r))}removeNamedItemNS(e,n){let r=re(e),o=String(n);return V(()=>this.removeNamedItemImmediately(i=>i.localName===o&&i[x]===r))}removeNamedItemImmediately(e){let n=this[z],r=this[O],o=null;for(;r!=null;){if(e(r)){o&&(o[p]=r[p]),this[O]===r&&(this[O]=r[p]);let i=r.value;return r[p]=null,r[z]=null,Ce&&Q({type:\"attributes\",target:n,attributeName:r.name,attributeNamespace:r[x],oldValue:i}),n[M].removeAttribute?.(n,r.name,r[x]),ot(n,r.localName,i,null,r[x]),r}o=r,r=r[p]}return null}setNamedItem(e){return V(()=>this.setNamedItemImmediately(e))}setNamedItemImmediately(e){let n=this[z],r=e[z];if(r!=null&&r!==n)throw P(\"The attribute is already in use by another element.\",\"InUseAttributeError\");let o=null,i=this[O],s=null;for(;i;){if(i.localName===e.localName&&i[x]===e[x]){if(i===e)return i;s?s[p]=e:this[O]=e,e[p]=i[p],i[p]=null,o=i;break}s=i,i=i[p]}o==null&&(s?s[p]=e:this[O]=e),e[z]=n,e[k]=n[k],o&&(o[z]=null);let a=o==null||o.value!==e.value,u=o!=null&&o.name!==e.name;return a&&Ce&&Q({type:\"attributes\",target:n,attributeName:e.name,attributeNamespace:e[x],oldValue:o?.value??null}),u&&n[M].removeAttribute?.(n,o.name,o[x]),(a||u)&&n[M].setAttribute?.(n,e.name,e.value,e[x]),a&&ot(n,e.localName,o?.value??null,e.value,e[x]),o}setNamedItemNS(e){return this.setNamedItem(e)}*[Symbol.iterator](){let e=this[O];for(;e;)yield e,e=e[p]}};var Ne=class extends ${nodeType=Ae;[x]=null;[p]=null;[z]=null;constructor(e,n,r){super(),this[w]=e,this[le]=n,r&&(this[x]=r)}get nodeName(){return this[w]}set nodeName(e){}get name(){return this[w]}set name(e){}get localName(){if(this[x]==null)return this[w];let e=this[w].indexOf(\":\");return e<0?this[w]:this[w].slice(e+1)}get prefix(){if(this[x]==null)return null;let e=this[w].indexOf(\":\");return e<0?null:this[w].slice(0,e)}get value(){return this[le]}set value(e){let n=String(e),r=this[z];if(!r){this[le]=n;return}V(()=>{let o=this[le];this[le]=n,Ce&&o!==n&&Q({type:\"attributes\",target:r,attributeName:this[w],attributeNamespace:this[x],oldValue:o}),this[M].setAttribute?.(r,this[w],n,this[x]),ot(r,this.localName,o,n,this[x])})}get nodeValue(){return this.value}set nodeValue(e){this.value=e}get ownerElement(){return this[z]}get namespaceURI(){return this[x]}get specified(){return!0}};var oo={amp:\"&\",AMP:\"&\",apos:\"'\",gt:\">\",GT:\">\",lt:\"<\",LT:\"<\",quot:'\"',QUOT:'\"'},io=new Set([\"area\",\"base\",\"br\",\"col\",\"embed\",\"hr\",\"img\",\"input\",\"link\",\"meta\",\"param\",\"source\",\"track\",\"wbr\"]),so=/(?:<([a-z][a-z0-9-:]*)((?:[\\s]+[^<>'\"=/\\s]+(?:=(['\"])[^]*?\\3|=[^>'\"\\s]*|))*)[\\s]*(\\/?)\\s*>|<\\/([a-z][a-z0-9-:]*)>|<!--(.*?)-->|([^<>]+))/gi,ur=/\\s([^<>'\"=/\\n\\s]+)(?:=([\"'])([\\s\\S]*?)\\2|=([^>'\"\\n\\s]*)|)/g,ao=\"|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|\",lo=/^(?:color|face|size)$/i;function lr(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 oo[n];let i=Number.parseInt(r??o,r?10:16);try{return String.fromCodePoint(i)}catch{return e}})}function dr(t){return t.namespaceURI===R&&io.has(t.localName)}function cr(t){let e=t.localName;return t[x]===W&&(e===\"foreignObject\"||e===\"desc\"||e===\"title\")}function co(t,e){if(ao.includes(`|${t}|`))return!0;if(t!==\"font\")return!1;for(let n of e.matchAll(ur))if(lo.test(n[1]))return!0;return!1}function Mt(t,e){let n=e.ownerDocument,r=n.createDocumentFragment(),o=[],i=r;for(let s of t.matchAll(so)){let a=s[1];if(a){let u=s[2],c=L(a),f=o[o.length-1]?.element??e,m=f[x]===W?W:R;if(c===\"svg\")m=W;else if(m===W){if(cr(f))m=R;else if(co(c,u)){for(;o.length>0;){let v=o[o.length-1];if(v.element[x]!==W||cr(v.element))break;o.pop(),i=v.target}m=R}}let b=m===R?c:a,h=n[Re](b,m,null,b);for(let v of u.matchAll(ur))h.setAttribute(v[1],lr(v[3]||v[4]||\"\"));if(i.append(h),dr(h)||m!==R&&s[4])continue;o.push({element:h,target:i}),i=m===R&&c===\"template\"?h.content:h}else if(s[5]){let u=L(s[5]);for(let c=o.length-1;c>=0;c--){let f=o[c],m=L(f.element[w]);if(m===u){i=f.target,o.length=c;break}if(f.element[x]===R&&m===\"template\")break}}else s[6]?i.append(n.createComment(s[6])):i.append(lr(s[7]))}return r}function Dt(t){return mr([{type:\"content\",child:t[O]}])}function fr(t){return mr([{type:\"opening\",node:t}])}function mr(t){let e=[],n;for(;n=t.pop();)switch(n.type){case\"opening\":{let r=n.node;switch(r.nodeType){case q:{let o=r;e.push(`<${o[w]}`);let i=o[J]?.[O];for(;i;){e.push(` ${i[w]}`);let a=i[le];a!==\"\"&&(a=String(a).replace(/&/g,\"&\").replace(/\"/g,\""\"),e.push(`=\"${a}\"`)),i=i[p]}if(e.push(\">\"),dr(o))break;let s=o.namespaceURI===R&&o.localName===\"template\"?o[ne]:o;t.push({type:\"closing\",name:o[w]}),t.push({type:\"content\",child:s?.[O]??null});break}case _e:{let o=r;e.push(o[Y].replace(/&/g,\"&\").replace(/\"/g,\""\").replace(/</g,\"<\").replace(/>/g,\">\"));break}case Pe:{let o=r;e.push(`<!--${o[Y]}-->`);break}}break}case\"content\":{let r=n.child;r&&(t.push({type:\"content\",child:r[p]}),t.push({type:\"opening\",node:r}));break}case\"closing\":e.push(`</${n.name}>`);break}return e.join(\"\")}var H=class extends ee{nodeType=q;[x]=R;[ae]=null;get namespaceURI(){return this[x]}get prefix(){return this[ae]}get localName(){let e=this[ae];return e==null?this[w]:this[w].slice(e.length+1)}get nodeName(){return this[x]===R?Bn(this[w]):this[w]}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 Ne(\"slot\",n))}get attributes(){let e=this[J];return e||(e=new It(this),this[J]=e),e}getAttributeNames(){return[...this.attributes].map(e=>e.name)}getElementsByTagName(e){return Ot(this,e)}get firstElementChild(){return this.children[0]??null}getElementsByClassName(e){return St(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);on(r);let i=this[x]===R?L(r):r,s=this.attributes.getNamedItemNS(null,i);s?s.value=o:this.attributes.setNamedItem(new Ne(i,o))}setAttributeNS(e,n,r){let o=re(e),i=String(n),s=String(r),a=ct(o,i,\"attribute\"),u=this.attributes.getNamedItemNS(a.namespace,a.localName);u?u.value=s:this.attributes.setNamedItemNS(new Ne(a.qualifiedName,s,a.namespace))}toggleAttribute(e,n){let r=String(e);on(r);let o=this[x]===R?L(r):r,i=this.attributes.getNamedItemNS(null,o),s=n===void 0?void 0:!!n;return i==null?s===!1?!1:(this.attributes.setNamedItem(new Ne(o,\"\")),!0):s===!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[x]===R?L(n):n;this.attributes.removeNamedItemNS(null,r)}removeAttributeNS(e,n){this.attributes.removeNamedItemNS(e,n)}get outerHTML(){return fr(this)}get innerHTML(){return Dt(this)}set innerHTML(e){if(e==null||e===\"\")this.replaceChildren();else{let n=Mt(String(e),this);this.replaceChildren(n)}}};var ke=class t extends H{[x]=W;get ownerSVGElement(){let e=null,n=this.parentNode;for(;n instanceof t;)e=n,n=n.parentNode;return e}};var me=class extends fe{[Y]=\"\";constructor(e){super(),this[Y]=e==null?\"\":String(e)}setData(e){let n=xn,r=n?this[Y]:null,o=\"\";e!=null&&(o=typeof e==\"string\"?e:String(e)),this[Y]=o,n&&r!==o&&Q({type:\"characterData\",target:this,oldValue:r}),this[M].setText?.(this,o)}get data(){return this[Y]}set data(e){this.setData(e)}};var Ie=class extends me{nodeType=_e;[w]=\"#text\"};var Me=class extends me{nodeType=Pe;[w]=\"#comment\"};var De=class extends ee{nodeType=ue;[w]=\"#document-fragment\";[k]=typeof window<\"u\"?window.document:null;getElementById(e){return vt(this,e)}};var Le=class extends H{get content(){let e=this[ne];return e||(e=this.ownerDocument.createDocumentFragment(),e[ce]=this,this[ne]=e),e}set content(e){}set innerHTML(e){this.content.replaceChildren(Mt(String(e),this))}get innerHTML(){let e=this[ne];return e?Dt(e):\"\"}};var Lt=class extends H{};var Ht=class extends H{};var Ut=class extends H{};var it=class extends ee{nodeType=be;[w]=\"#document\";[U]=!0;constructor(e){super(),this.defaultView=e,this[k]=this,this.documentElement=Vt(new Ut,this,\"html\"),this.body=Vt(new Lt,this,\"body\"),this.head=Vt(new Ht,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 St(this,e)}createElement(e){let n=String(e);return Fn(n),vn(this,L(n))}createElementNS(e,n){let r=ct(e,n,\"element\");return vn(this,r.qualifiedName,r.namespace,r.prefix,r.localName)}[Re](e,n,r,o){return vn(this,e,n,r,o)}createTextNode(e){let n=Gt(new Ie(e),this);return this[M].createText?.(n,n.data),n}createComment(e){return Gt(new Me(e),this)}createDocumentFragment(){return Gt(new De,this)}createEvent(){return new G(\"\")}getElementById(e){return vt(this,e)}getElementsByTagName(e){return Ot(this,e)}importNode(e,n){if(e.nodeType===be)throw P(\"Cannot import a document node\",\"NotSupportedError\");return xt(e,n,this)}adoptNode(e){if(e[k]===this)return e;let n=wt(e);return V(()=>{let r=e.parentNode;return r?sr(r,e,n,this):et(n.nodes,this),e})}};function Gt(t,e){return Object.defineProperty(t,k,{value:e,writable:!0,enumerable:!1}),t}function vn(t,e,n=R,r=null,o=e){let i;if(n===W)i=new ke;else if(n===R&&o===\"template\")i=new Le;else if(n===R){let s=t.defaultView.customElements.get(o);i=s?new s:new H}else i=new H;return Vt(i,t,e,n,r)}function Vt(t,e,n,r=R,o=null){return Gt(t,e),Object.defineProperties(t,{[w]:{value:n},[x]:{value:r},[ae]:{value:o}}),e[M].createElement?.(t,r),t}var Bt=class extends G{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 zt=class extends G{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 jt=class extends G{constructor(e,n){super(e,n),this.promise=n.promise,this.reason=n.reason}};var Ft=class extends G{constructor(e,n){super(e,n),this.oldState=n.oldState,this.newState=n.newState}};var qt=class extends G{constructor(e,n={}){super(e,n),this.relatedTarget=n.relatedTarget??null}};var Yt=class extends G{constructor(e,n={}){super(e,n),this.clipboardData=n.clipboardData??null}};var Wt=class extends H{};var uo=/^[a-z][^A-Z\\u0000\\t\\n\\f\\r />]*-[^A-Z\\u0000\\t\\n\\f\\r />]*$/u,fo=new Set([\"annotation-xml\",\"color-profile\",\"font-face\",\"font-face-src\",\"font-face-uri\",\"font-face-format\",\"font-face-name\",\"missing-glyph\"]);function pr(t){return uo.test(t)&&!fo.has(t)}function hr(t){return P(`Invalid custom element name: \"${t}\"`,\"SyntaxError\")}var Xt=class{registry=new Map;listenersByName=new Map;define(e,n,r){if(!pr(e))throw hr(e);if(this.registry.has(e))throw P(`A custom element named \"${e}\" has already been defined`,\"NotSupportedError\");if(this.getName(n)!=null)throw P(\"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 i of o)i(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(!pr(e))return Promise.reject(hr(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 mo=[\"onerror\",\"onunhandledrejection\"],br=Symbol.for(\"@remote-dom/polyfill/global-property\");function Er(t){return Object.getOwnPropertyDescriptors(t)}function yr(t){let e={};for(let[n,r]of Object.entries(Object.getOwnPropertyDescriptors(de.prototype)))n!==\"constructor\"&&typeof r.value==\"function\"&&(r.value=Sn(r.value.bind(t)),e[n]=r);return e}function Nr(t){let e={};for(let n of mo)e[n]={configurable:!0,enumerable:!0,get:Sn(()=>t[n]),set:Sn(r=>{t[n]=r})};return e}function po(t){return Object.assign(Er(t),yr(t),Nr(t))}function Sn(t){return Object.defineProperty(t,br,{value:!0}),t}function gr(t,e){for(let n of Reflect.ownKeys(e)){let r=ho(t,n);(r==null||go(r))&&Object.defineProperty(t,n,e[n])}}function ho(t,e){let n=t;for(;n;){let r=Object.getOwnPropertyDescriptor(n,e);if(r)return r;n=Object.getPrototypeOf(n)}}function go(t){return[t.value,t.get,t.set].some(e=>typeof e==\"function\"&&e[br]===!0)}var Te=class extends de{[M]={};[at]=[];[ge]=Eo(this);name=\"\";window=this;parent=this;self=this;top=this;document=new it(this);customElements=new Xt;location=globalThis.location;navigator=globalThis.navigator;Event=G;ErrorEvent=zt;PromiseRejectionEvent=jt;ToggleEvent=Ft;FocusEvent=qt;ClipboardEvent=Yt;EventTarget=de;CustomEvent=Bt;Node=$;ParentNode=ee;ChildNode=fe;DocumentFragment=De;Document=it;CharacterData=me;Comment=Me;Text=Ie;Element=H;HTMLElement=Wt;SVGElement=ke;HTMLTemplateElement=Le;MutationObserver=Pt;#t=null;#n=null;#e=null;static with(...e){let n=this;return class extends n{constructor(){super();for(let o of e)bo(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=Er(e),i=Object.assign(yr(e),Nr(e));delete o.self,Object.defineProperties(globalThis,o),gr(globalThis,i),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),gr(n,i))}static setGlobalThis(e){for(let n in e)e[n]===e&&(e[n]=globalThis);Object.defineProperties(globalThis,po(e))}};function bo(t,e){t[at].push(e(t)??{})}function Eo(t){return{createElement:ie.bind(null,t,\"createElement\"),setAttribute:ie.bind(null,t,\"setAttribute\"),removeAttribute:ie.bind(null,t,\"removeAttribute\"),createText:ie.bind(null,t,\"createText\"),setText:ie.bind(null,t,\"setText\"),insertChild:ie.bind(null,t,\"insertChild\"),removeChild:ie.bind(null,t,\"removeChild\"),addEventListener:ie.bind(null,t,\"addEventListener\"),removeEventListener:ie.bind(null,t,\"removeEventListener\")}}function ie(t,e,...n){for(let i of t[at])i[e]?.apply(i,n);let r=t[M];r[e]?.apply(r,n)}var $t=new Te;var On=\"~\";var pe=new WeakMap;function He(t){return pe.get(t)}var Pn=new WeakMap,No=0;function Z(t){let e=Pn.get(t);return e==null&&(e=String(No++),Kt(t,e)),e}function Kt(t,e){Pn.set(t,e)}var An=new WeakMap;function To(t){return An.get(t)}var _n=new WeakMap;function wo(t){let e=_n.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 xo=new WeakMap;function vo(t){return xo.get(t)}function Cn(t,e,n){let r=An.get(t);if(r==null&&(r={},An.set(t,r)),r[e]===n)return;r[e]=n;let o=pe.get(t);o?.mutate([[3,Z(t),e,n,1]])}function Qt(t,e,n){let r=_n.get(t);if(r==null&&(r={},_n.set(t,r)),r[e]===n)return;n==null?delete r[e]:r[e]=String(n);let o=pe.get(t);o?.mutate([[3,Z(t),e,n,2]])}function Ue(t,e){if(pe.get(t)!==e&&(pe.set(t,e),t.childNodes))for(let r=0;r<t.childNodes.length;r++)Ue(t.childNodes[r],e)}function Zt(t){if(pe.get(t)!=null&&(pe.delete(t),t.childNodes))for(let n=0;n<t.childNodes.length;n++)Zt(t.childNodes[n])}function Ge(t){let{nodeType:e}=t;switch(e){case 1:return{id:Z(t),type:e,element:t.localName,properties:Rn(To(t)),attributes:Rn(wo(t)),eventListeners:Rn(vo(t)),children:Array.from(t.childNodes).map(Ge)};case 3:case 8:return{id:Z(t),type:e,data:t.data};default:throw new Error(`Cannot serialize node of type ${t.nodeType} (${typeof t.nodeType})`)}}function Rn(t){return t?{...t}:void 0}function kn(t,e,...n){let r=Pn.get(t),o=pe.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 Ve=$t[M];Ve.insertChild=(t,e,n)=>{let r=He(t);r!=null&&(Ue(e,r),r.mutate([[0,Z(t),Ge(e),n]]))};Ve.removeChild=(t,e,n)=>{let r=He(t);r!=null&&(Zt(e),r.mutate([[1,Z(t),n]]))};Ve.setText=(t,e)=>{let n=He(t);n?.mutate([[2,Z(t),e]])};Ve.setAttribute=(t,e,n)=>{t.tagName.includes(\"-\")||Qt(t,e,n)};Ve.removeAttribute=(t,e)=>{t.tagName.includes(\"-\")||Qt(t,e)};Te.setGlobal($t);function wr(t){let e=t;return typeof t==\"object\"&&t!==null&&e.graview===\"host-hello\"&&typeof e.nonce==\"string\"}function vr(t,e={}){let n,r=\"\",o,i=0,s=new Set,a=new Map,u=[],c=g=>{n?n.postMessage({...g,nonce:r}):u.push(g)},f=g=>{let y=g.data;if(!(!y||typeof y!=\"object\")){if(y.type===\"props\"){o=y.props;for(let C of s)C(y.props)}else y.type===\"answer\"?(a.get(y.id)?.(y),a.delete(y.id)):y.type===\"event\"&&typeof y.listener==\"number\"?e.onEvent?.(y):y.type===\"heartbeat\"&&typeof y.beat==\"number\"&&c({type:\"heartbeat\",beat:y.beat});e.onMessage?.(y)}},m=()=>{},b=g=>{if(n||!t.fromHost(g)||!wr(g.data)||g.data.protocol!==1)return;let y=g.ports[0];if(y){n=y,r=g.data.nonce,n.onmessage=f,n.start?.(),m();for(let C of u.splice(0))c(C)}};m=t.listen(b),t.ready({graview:\"guest-ready\",protocol:1});let h,v={get props(){return o},subscribe(g){return s.add(g),()=>s.delete(g)},act(g,y={}){let C=i+=1;return new Promise(D=>{a.set(C,D),c({type:\"act\",id:C,name:g,args:y})})},navigate(g){typeof g==\"string\"?c({type:\"navigate\",to:g}):g&&typeof g.place==\"string\"&&c({type:\"navigate\",place:g.place})},size(g){c({type:\"size\",height:g})},autoSize(g){let y=g??globalThis.document?.documentElement,C=globalThis.ResizeObserver;if(!y||!C||typeof y.getBoundingClientRect!=\"function\")return()=>{};h?.disconnect();let D=new C(()=>v.size(Math.ceil(y.getBoundingClientRect().height)));return D.observe(y),h=D,()=>D.disconnect()},close(){h?.disconnect(),m(),n?.close(),s.clear()}};return{guest:v,send:c}}var Or=[\"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\"],Rr=[\"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\"],Ar=[\"self\",\"postMessage\",\"setTimeout\",\"clearTimeout\",\"setInterval\",\"clearInterval\",\"queueMicrotask\",\"structuredClone\",\"crypto\",\"console\",\"DOMException\"],_r=[\"TEMPORARY\",\"PERSISTENT\"],Za=Object.freeze([...Or,...Rr,...Ar,..._r]),Ja=Object.freeze([\"constructor\",\"__defineGetter__\",\"__defineSetter__\",\"hasOwnProperty\",\"__lookupGetter__\",\"__lookupSetter__\",\"isPrototypeOf\",\"propertyIsEnumerable\",\"toString\",\"valueOf\",\"__proto__\",\"toLocaleString\"]),Sr=t=>typeof t==\"symbol\"?`[${t.description??\"symbol\"}]`:t;function Pr(t=globalThis,e=[],n={}){let r=[],o=[],i=new Set([...Or,...Rr,...Ar,...e,\"constructor\",Symbol.toStringTag]),s=(T,l)=>{let E=Reflect.getOwnPropertyDescriptor(T,l);return E===void 0||!(\"value\"in E)||E.writable||E.configurable?!1:n.primitivesStay&&typeof l==\"symbol\"&&(typeof E.value!=\"object\"||E.value===null)&&typeof E.value!=\"function\"?!0:_r.includes(l)&&typeof E.value==\"number\"},a=t,u=a.setTimeout,c=a.setInterval,f=a.crypto,m=(T,l)=>function(E,A,...N){if(typeof E!=\"function\")throw new TypeError(`${l} takes a function: a guest view cannot run code from text`);return T.call(t,E,A,...N)},b=f?Object.freeze({getRandomValues:T=>f.getRandomValues(T)}):void 0,h=a.document?.defaultView;if(h&&h!==a)for(let T of Reflect.ownKeys(h))typeof T==\"symbol\"||i.has(T)||Reflect.deleteProperty(h,T)||o.push(`window.${T}`);let v=[];for(let T=t;T&&T!==Object.prototype;T=Object.getPrototypeOf(T))v.push(T);for(let T of v)for(let l of Reflect.ownKeys(T))i.has(l)||(Reflect.deleteProperty(T,l)?r.push(Sr(l)):s(T,l)||o.push(Sr(l)));let g=()=>function(){throw new EvalError(\"A guest view cannot make code from text.\")},y=[Function.prototype,Object.getPrototypeOf(async function(){}),Object.getPrototypeOf(function*(){}),Object.getPrototypeOf(async function*(){})];for(let T of y){let l=g();Object.defineProperty(l,\"prototype\",{value:T,writable:!1,enumerable:!1,configurable:!1}),Reflect.defineProperty(T,\"constructor\",{value:l,writable:!1,enumerable:!1,configurable:!1})||o.push(\"Function.prototype.constructor\"),T===Function.prototype&&Reflect.defineProperty(t,\"Function\",{value:l,writable:!0,enumerable:!1,configurable:!0})}let C=(T,l)=>{Reflect.defineProperty(t,T,{value:l,writable:!0,enumerable:!0,configurable:!0})||o.push(T)};C(\"setTimeout\",m(u,\"setTimeout\")),C(\"setInterval\",m(c,\"setInterval\")),b&&C(\"crypto\",b);for(let T of v.slice(1))Object.freeze(T);for(let T of Reflect.ownKeys(t)){let l=Reflect.getOwnPropertyDescriptor(t,T);Reflect.defineProperty(t,T,\"value\"in l?{...l,writable:!1,configurable:!1}:{...l,configurable:!1})}let D;try{D=Reflect.preventExtensions(t)}catch{D=!1}return{removed:r,stuck:o,sealed:D}}var st=class extends HTMLElement{constructor(){super(),Kt(this,On)}connect(e){if(He(this)===e||(Ue(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,On,Ge(o),r])}e.mutate(n)}updateRemoteProperty(e,n){Cn(this,e,n)}callRemoteMethod(e,...n){return kn(this,e,...n)}};var d={},In={empty:!0},So={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\"},Mn={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:In,br:In,wbr:In,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:d,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\"]}}}},Oo=[\"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\"],Ro={id:\"text\",class:\"text\",style:\"style\",lang:\"text\",role:\"text\",tabindex:{oneOf:[\"-1\",\"0\"]},transform:\"geometry\",...Object.fromEntries(Oo.map(t=>[t,\"css\"]))},Be={x:\"geometry\",y:\"geometry\",width:\"geometry\",height:\"geometry\"},Jt={viewBox:\"geometry\",preserveAspectRatio:\"geometry\"},Cr={gradientUnits:{oneOf:[\"userSpaceOnUse\",\"objectBoundingBox\"]},gradientTransform:\"geometry\",spreadMethod:{oneOf:[\"pad\",\"reflect\",\"repeat\"]},href:\"fragment\"},kr={svg:{attributes:{...Be,...Jt}},g:d,defs:d,symbol:{attributes:{...Be,...Jt,refX:\"geometry\",refY:\"geometry\"}},use:{attributes:{...Be,href:\"fragment\"}},title:d,desc:d,path:{attributes:{d:\"geometry\",pathLength:\"number\"}},rect:{attributes:{...Be,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\",...Cr}},radialGradient:{attributes:{cx:\"geometry\",cy:\"geometry\",r:\"geometry\",fx:\"geometry\",fy:\"geometry\",fr:\"geometry\",...Cr}},stop:{attributes:{offset:\"geometry\"}},clipPath:{attributes:{clipPathUnits:{oneOf:[\"userSpaceOnUse\",\"objectBoundingBox\"]}}},mask:{attributes:{...Be,maskUnits:{oneOf:[\"userSpaceOnUse\",\"objectBoundingBox\"]},maskContentUnits:{oneOf:[\"userSpaceOnUse\",\"objectBoundingBox\"]}}},pattern:{attributes:{...Be,...Jt,patternUnits:{oneOf:[\"userSpaceOnUse\",\"objectBoundingBox\"]},patternContentUnits:{oneOf:[\"userSpaceOnUse\",\"objectBoundingBox\"]},patternTransform:\"geometry\",href:\"fragment\"}},marker:{attributes:{...Jt,markerWidth:\"geometry\",markerHeight:\"geometry\",refX:\"geometry\",refY:\"geometry\",orient:\"geometry\",markerUnits:{oneOf:[\"strokeWidth\",\"userSpaceOnUse\"]}}}};var Ir={section:[\"aria-label\",\"aria-labelledby\",\"title\"]};function Ao(t){return/^aria-[a-z]+$/.test(t)}function _o(t){return/^data-[a-z0-9][a-z0-9_.-]*$/.test(t)}var Po=new Map(Object.keys(kr).map(t=>[t.toLowerCase(),t]));function Mr(t){return Po.get(t.toLowerCase())}function Dr(t,e,n){let r=n.toLowerCase(),o=t===\"html\"?[Mn[e]?.attributes,So]:[kr[e]?.attributes,Ro],i=t===\"svg\"&&r===\"xlink:href\"?\"href\":r;for(let s of o)if(s){for(let[a,u]of Object.entries(s))if(a.toLowerCase()===i)return{name:a,kind:u}}if(Ao(r)||_o(r))return{name:r,kind:\"text\"}}var Lr=\"~\",en=t=>typeof t==\"object\"&&t!==null&&!Array.isArray(t),te=(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=>te(n,e+1)):Object.fromEntries(Object.entries(t).map(([n,r])=>[n,te(r,e+1)]))};function Hr(){let t=new Map,e=new Map,n=new Map([[Lr,{children:[],listeners:new Map}]]),r=0,o=c=>{let f=e.get(c);return f===void 0&&(f=r+=1,e.set(c,f),t.set(f,{listener:c,count:0})),t.get(f).count+=1,f},i=c=>{let f=t.get(c);f&&(f.count-=1,!(f.count>0)&&(t.delete(c),e.delete(f.listener)))},s=c=>{let f=n.get(c);if(f){n.delete(c);for(let m of f.listeners.values())i(m);for(let m of f.children)s(m)}},a=(c,f,m=0)=>{if(!en(c)||m>64)return te(c);let b=typeof c.id==\"string\"?c.id:void 0,h=f&&b!==void 0&&b!==Lr;h&&s(b);let v={children:[],listeners:new Map};h&&n.set(b,v);let g={};for(let[y,C]of Object.entries(c))y===\"children\"&&Array.isArray(C)?g[y]=C.map(D=>{let T=a(D,h,m+1);return h&&en(D)&&typeof D.id==\"string\"&&v.children.push(D.id),T}):y===\"eventListeners\"&&en(C)?g[y]=Object.fromEntries(Object.entries(C).map(([D,T])=>{if(typeof T!=\"function\"||!h)return[D,void 0];let l=o(T);return v.listeners.set(D,l),[D,{listener:l}]})):g[y]=te(C,m+1);return g},u=c=>{if(!Array.isArray(c))return te(c);let[f,m]=c,b=typeof m==\"string\"?n.get(m):void 0;if(f===0){let h=a(c[2],b!==void 0),v=en(c[2])?c[2].id:void 0;if(b&&typeof v==\"string\"&&n.has(v)){let g=Number(c[3]);b.children.splice(Number.isInteger(g)&&g>=0&&g<=b.children.length?g:b.children.length,0,v)}return[f,te(m),h,te(c[3])]}if(f===1){let h=Number(c[2]);return b&&Number.isInteger(h)&&h>=0&&h<b.children.length&&s(b.children.splice(h,1)[0]),te(c)}if(f===3&&c[4]===3){let h=String(c[2]),v=c[3],g=b&&typeof v==\"function\"?o(v):void 0,y=b?.listeners.get(h);return y!==void 0&&i(y),g===void 0?b?.listeners.delete(h):b.listeners.set(h,g),[f,te(m),h,g===void 0?void 0:{listener:g},3]}return te(c)};return{encode:c=>c.map(u),listener:c=>t.get(c)?.listener,get listening(){return t.size},get nodes(){return n.size-1}}}var tn=\"graview-view-root\",Co=t=>t.replace(/&/g,\"&\").replace(/</g,\"<\").replace(/>/g,\">\").replace(/\"/g,\""\").replace(/'/g,\"'\"),ko=t=>Object.freeze({html:t,toString:()=>t}),Ur=t=>typeof t==\"object\"&&t!==null&&typeof t.html==\"string\"&&Object.isFrozen(t),Gr=t=>t==null||t===!1?\"\":Array.isArray(t)?t.map(Gr).join(\"\"):Ur(t)?t.html:Co(String(t));function Vr(t){customElements.get(tn)||customElements.define(tn,st);let e=Event,n=Hr(),r=new Set,o=new Set,i,s=[],a=document.createElement(tn),u=l=>{let E=A=>{for(let N of Array.from(A.childNodes)){if(N.nodeType!==1)continue;if(Z(N)===l)return N;let S=E(N);if(S)return S}};return E(a)},c=l=>{let E=u(l.target);if(!E)return;let A=new e(l.event,{bubbles:!0});for(let N of[\"value\",\"checked\",\"key\",\"pressed\"])l[N]!==void 0&&Object.defineProperty(A,N,{value:l[N],enumerable:!0});E.dispatchEvent(A);for(let N of o){if(N.type!==l.event)continue;let S;try{S=new Set(Array.from(a.querySelectorAll(N.selector)))}catch{continue}for(let _=E;_&&_!==a;_=_.parentNode)if(S.has(_)){N.listener(Object.freeze({type:l.event,target:E,element:_,...l.value!==void 0?{value:l.value}:{},...l.checked!==void 0?{checked:l.checked}:{},...l.key!==void 0?{key:l.key}:{},...l.pressed!==void 0?{pressed:l.pressed}:{}}));break}}},f=l=>{if(l.type===\"dom-event\"&&typeof l.target==\"string\")return c(l);if(l.type!==\"props\")return;i=l.props;let E=t.now();for(let S of r)try{S(l.props)}catch(_){t.threw(_)}let A=t.now()-E,N=l.push;typeof N==\"number\"&&t.microtask(()=>t.microtask(()=>t.send({type:\"pushed\",push:N,ms:A})))},m;a.connect({mutate(l){m||(m=[],t.microtask(()=>{let E=m??[];m=void 0,t.send({type:\"render\",records:n.encode(E)})})),m.push(...l)},call:()=>{}});let b=l=>l.nodeType===1?l.getAttribute(\"data-key\")??l.getAttribute(\"id\"):null,h=(l,E)=>l.nodeType===E.nodeType&&(l.nodeType!==1||l.localName===E.localName&&l.namespaceURI===E.namespaceURI&&b(l)===b(E));function v(l,E){let A=Array.from(E.childNodes),N=0;for(let S of A){let _=l.childNodes[N]??null;if(_&&h(_,S)){g(_,S),N+=1;continue}if(b(S)!==null){let se=Array.from(l.childNodes).slice(N+1).find(je=>h(je,S));if(se){l.insertBefore(se,_),g(se,S),N+=1;continue}}l.insertBefore(S,_),N+=1}for(;l.childNodes.length>N;)l.removeChild(l.lastChild)}function g(l,E){if(l.nodeType!==1){l.data!==E.data&&(l.data=E.data);return}let A=l,N=E;for(let S of A.getAttributeNames())N.hasAttribute(S)||A.removeAttribute(S);for(let S of N.getAttributeNames()){let _=N.getAttribute(S);A.getAttribute(S)!==_&&A.setAttribute(S,_)}v(A,N)}function y(l,E,A){for(let N of Array.from(l.childNodes)){if(N.nodeType!==1)continue;let S=N,_=S.localName,ze=E||_.toLowerCase()===\"svg\",se=ze?Mr(_):Object.prototype.hasOwnProperty.call(Mn,_.toLowerCase())?_.toLowerCase():void 0;if(!se){A.add(`<${_}>`);continue}for(let je of S.getAttributeNames())(!Dr(ze?\"svg\":\"html\",se,je)||!ze&&Ir[se]?.includes(je.toLowerCase()))&&A.add(`${se} ${je}`);y(S,ze,A)}}function C(l){let E=document.createElement(\"div\"),A=Array.isArray(l)?l:[l];for(let S of A)if(S!=null)if(typeof S==\"string\"||Ur(S)){let _=document.createElement(\"div\");_.innerHTML=typeof S==\"string\"?S:S.html,E.append(...Array.from(_.childNodes))}else E.append(S);let N=new Set;y(E,!1,N),s=[...N],s.length>0&&t.warn(`The host will not draw: ${s.join(\", \")}`),v(a,E)}let D;return{view:Object.freeze({get props(){return i},onProps(l){return r.add(l),i&&l(i),()=>void r.delete(l)},render:C,style(l){typeof l!=\"string\"||l===D||(D=l,t.send({type:\"style\",css:l}))},on(l,E,A){let N={type:l,selector:E,listener:A};return o.add(N),()=>void o.delete(N)},act:(l,E={})=>t.act(l,E),navigate(l){typeof l==\"string\"?t.navigate(l):l&&typeof l.place==\"string\"&&t.send({type:\"navigate\",place:l.place})},html(l,...E){return ko(l.reduce((A,N,S)=>A+N+(S<E.length?Gr(E[S]):\"\"),\"\"))},get refused(){return s},get hardening(){return t.hardening()}}),hear:f}}var Hn={removed:[],stuck:[],sealed:!1,worker:!1},Dn=vr({listen(t){return xe.listen(t),()=>xe.unlisten(t)},fromHost:()=>!0,ready:t=>xe.post(t)},{onMessage:t=>Br.hear(t)}),Br=Vr({send:t=>Dn.send(t),act:(t,e)=>Dn.guest.act(t,e),navigate:t=>Dn.guest.navigate(t),microtask:xe.microtask,now:xe.now,threw:t=>console.error(t),warn:t=>console.warn(t),hardening:()=>Hn}),Io=Br.view;Object.defineProperty(globalThis,\"graview\",{value:Io,enumerable:!0,configurable:!0,writable:!1});var Ln=\"WorkerGlobalScope\"in globalThis?Pr(globalThis,[\"graview\"]):Hn;Hn=Ln;if(Ln.stuck.length>0)throw new Error(`The view's worker could not be hardened: ${Ln.stuck.join(\", \")} would not go.`);})();\n";
|
|
7
|
+
//# sourceMappingURL=view-runtime.generated.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"view-runtime.generated.js","sourceRoot":"","sources":["../../src/host/view-runtime.generated.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,MAAM,YAAY,GAAW,s46DAAs46D,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** What in a view's source keeps the host from running it, in sentences. Empty when it may run. */
|
|
2
|
+
export declare function checkViewSource(source: string): readonly string[];
|
|
3
|
+
/** The worker's whole script for a view's source: the runtime, then the view in a strict function of its own. */
|
|
4
|
+
export declare function viewScript(source: string): Promise<string>;
|
|
5
|
+
//# sourceMappingURL=view-source.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"view-source.d.ts","sourceRoot":"","sources":["../../src/host/view-source.ts"],"names":[],"mappings":"AAmBA,mGAAmG;AACnG,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAQjE;AAED,iHAAiH;AACjH,wBAAsB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAGhE"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* A VIEW WITH NO BUILD (FR-96).
|
|
3
|
+
*
|
|
4
|
+
* A chat writes a worker view as one plain script against the `graview`
|
|
5
|
+
* global — no imports, no bundler, no copy of the protocol — and the host
|
|
6
|
+
* makes it a worker: the runtime first (view-runtime.generated.ts: Remote
|
|
7
|
+
* DOM's polyfill, the hardening, the channel, the global), then the view,
|
|
8
|
+
* one strict classic script. A module worker is not an option: Chromium
|
|
9
|
+
* refuses one from a `blob:` URL in an opaque origin, which is where a
|
|
10
|
+
* chat's widget runs (FR-71).
|
|
11
|
+
*
|
|
12
|
+
* The hardened worker has no `eval`, no function constructor and no
|
|
13
|
+
* `importScripts`; the one way left to load code is `import()`, which is
|
|
14
|
+
* syntax, so a view whose text says `import` anywhere — in code, a string or
|
|
15
|
+
* a comment — is refused before it runs. A keyword cannot be spelled with
|
|
16
|
+
* an escape, so the text is the whole truth. `export` makes a classic script
|
|
17
|
+
* a syntax error, and is refused with a sentence rather than a failed start.
|
|
18
|
+
*/
|
|
19
|
+
/** What in a view's source keeps the host from running it, in sentences. Empty when it may run. */
|
|
20
|
+
export function checkViewSource(source) {
|
|
21
|
+
const findings = [];
|
|
22
|
+
if (typeof source !== "string")
|
|
23
|
+
return ["A view's source is text."];
|
|
24
|
+
if (/\bimport\b/.test(source))
|
|
25
|
+
findings.push("It says import: a view loads nothing, so the word may not appear in it at all, even in a string or a comment.");
|
|
26
|
+
if (/\bimportScripts\b/.test(source))
|
|
27
|
+
findings.push("It names importScripts: a view loads nothing.");
|
|
28
|
+
if (/^\s*export\b/m.test(source))
|
|
29
|
+
findings.push("It exports something: a view is a plain script that draws through the graview global, not a module.");
|
|
30
|
+
if (/\brequire\s*\(/.test(source))
|
|
31
|
+
findings.push("It calls require(): a view has no modules to require.");
|
|
32
|
+
return findings;
|
|
33
|
+
}
|
|
34
|
+
/** The worker's whole script for a view's source: the runtime, then the view in a strict function of its own. */
|
|
35
|
+
export async function viewScript(source) {
|
|
36
|
+
const { VIEW_RUNTIME } = await import("./view-runtime.generated.js");
|
|
37
|
+
return `${VIEW_RUNTIME}\n;(function () {\n"use strict";\n${source}\n})();\n`;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=view-source.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"view-source.js","sourceRoot":"","sources":["../../src/host/view-source.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,mGAAmG;AACnG,MAAM,UAAU,eAAe,CAAC,MAAc;IAC5C,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,IAAI,OAAO,MAAM,KAAK,QAAQ;QAAE,OAAO,CAAC,0BAA0B,CAAC,CAAC;IACpE,IAAI,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC;QAAE,QAAQ,CAAC,IAAI,CAAC,+GAA+G,CAAC,CAAC;IAC9J,IAAI,mBAAmB,CAAC,IAAI,CAAC,MAAM,CAAC;QAAE,QAAQ,CAAC,IAAI,CAAC,+CAA+C,CAAC,CAAC;IACrG,IAAI,eAAe,CAAC,IAAI,CAAC,MAAM,CAAC;QAAE,QAAQ,CAAC,IAAI,CAAC,qGAAqG,CAAC,CAAC;IACvJ,IAAI,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAC;QAAE,QAAQ,CAAC,IAAI,CAAC,uDAAuD,CAAC,CAAC;IAC1G,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,iHAAiH;AACjH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,MAAc;IAC7C,MAAM,EAAE,YAAY,EAAE,GAAG,MAAM,MAAM,CAAC,6BAA6B,CAAC,CAAC;IACrE,OAAO,GAAG,YAAY,qCAAqC,MAAM,WAAW,CAAC;AAC/E,CAAC"}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import type { AnySchema, Principal, Store } from "@graview/core";
|
|
2
|
+
import type { GuestPlace, GuestTheme } from "../protocol.js";
|
|
3
|
+
import { type WorkerViewManifest } from "./manifest.js";
|
|
4
|
+
import type { ViewRefusal } from "./open-draw.js";
|
|
5
|
+
import { type GuestLimits, type GuestStats, type GuestViewInput } from "./session.js";
|
|
6
|
+
import { type GuestWorkerSource } from "./worker-start.js";
|
|
7
|
+
import { type Destination } from "./links.js";
|
|
8
|
+
import { readTheme } from "./theme.js";
|
|
9
|
+
/** A worker view's code: its own source, which the host makes a worker of, or a whole worker script. */
|
|
10
|
+
export type WorkerViewCode = GuestWorkerSource | {
|
|
11
|
+
readonly source: string;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Why a worker view is not shown (FR-94). Past any limit the host stops
|
|
15
|
+
* the worker, draws the plain face of what the view was shown in its place
|
|
16
|
+
* (or the host's own `fallback`), and says why.
|
|
17
|
+
*/
|
|
18
|
+
export type WorkerViewFailure =
|
|
19
|
+
/** Its manifest names a kind, an edge or an act the app does not declare (FR-91): it was never started. */
|
|
20
|
+
"manifest"
|
|
21
|
+
/** Its code is longer than `maxSourceBytes`: it was never started. */
|
|
22
|
+
| "source"
|
|
23
|
+
/** The page's policy refused the worker, or it failed before it said ready. */
|
|
24
|
+
| "refused"
|
|
25
|
+
/** It threw before it drew anything. */
|
|
26
|
+
| "error"
|
|
27
|
+
/** It never said ready in `readyMs`, or its runtime went `silentMs` without answering the host's heartbeat. */
|
|
28
|
+
| "silent"
|
|
29
|
+
/** It drew more than `maxNodes`. */
|
|
30
|
+
| "nodes"
|
|
31
|
+
/** It sent more than `messages` messages in `messageWindowMs`. */
|
|
32
|
+
| "flood"
|
|
33
|
+
/** It took longer than `pushMs` to draw what it was shown. */
|
|
34
|
+
| "slow";
|
|
35
|
+
export interface WorkerViewLimits extends GuestLimits {
|
|
36
|
+
/** The longest a view's code may be, in bytes as UTF-8. 256 000 by default. */
|
|
37
|
+
readonly maxSourceBytes?: number;
|
|
38
|
+
/** The most nodes the view may draw at once. 5 000 by default. */
|
|
39
|
+
readonly maxNodes?: number;
|
|
40
|
+
/** How long it has to say ready, in milliseconds. 5 000 by default. */
|
|
41
|
+
readonly readyMs?: number;
|
|
42
|
+
/** How long its runtime may go without answering the host's heartbeat, once ready. 5 000 by default. */
|
|
43
|
+
readonly silentMs?: number;
|
|
44
|
+
/**
|
|
45
|
+
* How long the view may take over one push of what it is shown — its
|
|
46
|
+
* listeners' own time, as its runtime measures it, and the time until the
|
|
47
|
+
* runtime says it has drawn, as the host measures it — in milliseconds.
|
|
48
|
+
* 1 000 by default. Time the host's own page was held up is not counted.
|
|
49
|
+
*/
|
|
50
|
+
readonly pushMs?: number;
|
|
51
|
+
/**
|
|
52
|
+
* The most of any one second the host's page may spend drawing what the
|
|
53
|
+
* view sent, in milliseconds: past it the batch is left undrawn and the
|
|
54
|
+
* view is stopped as slow. 100 by default.
|
|
55
|
+
*/
|
|
56
|
+
readonly drawMs?: number;
|
|
57
|
+
}
|
|
58
|
+
export interface MountWorkerViewOptions<S extends AnySchema> {
|
|
59
|
+
/** What the view is and may touch (FR-91): its name, title, what it attaches to, what it reads, what it may ask. */
|
|
60
|
+
readonly manifest: WorkerViewManifest;
|
|
61
|
+
/**
|
|
62
|
+
* The view's code. `{ source }` is a plain script against the `graview`
|
|
63
|
+
* global, with no imports and no build (FR-96): the host puts the runtime
|
|
64
|
+
* in front of it. `{ script }` or `{ url }` is a whole worker script
|
|
65
|
+
* already, its runtime first (`@graview/guest/worker/view`).
|
|
66
|
+
*/
|
|
67
|
+
readonly worker: WorkerViewCode;
|
|
68
|
+
readonly store: Store<S>;
|
|
69
|
+
/** The viewer: what is pushed is what they may see, and what is asked for is applied as them. */
|
|
70
|
+
readonly principal: Principal;
|
|
71
|
+
/** Where the view is drawn: the record, or the members, the face hands it. */
|
|
72
|
+
readonly input?: () => GuestViewInput;
|
|
73
|
+
/**
|
|
74
|
+
* The view asked to go to a record or a named place of this app — by a
|
|
75
|
+
* link it drew (`<a data-record>`, `<a data-place>`) or from its code.
|
|
76
|
+
* Only a record the viewer may see and a place `places` lists get here;
|
|
77
|
+
* a worker view has no way to an address outside the app (FR-93).
|
|
78
|
+
*/
|
|
79
|
+
readonly onNavigate?: (to: Destination) => void;
|
|
80
|
+
/** The app's named places: what the view is told of, and may link to by slug. None by default. */
|
|
81
|
+
readonly places?: () => readonly GuestPlace[];
|
|
82
|
+
/**
|
|
83
|
+
* The app's look now. Read off the region by default: the `--graview-*`
|
|
84
|
+
* tokens it inherits, and the scheme of the nearest `data-graview-scheme`
|
|
85
|
+
* (the embed's), else its `color-scheme`.
|
|
86
|
+
*/
|
|
87
|
+
readonly theme?: () => GuestTheme;
|
|
88
|
+
readonly limits?: WorkerViewLimits;
|
|
89
|
+
/** The view is not going to be shown, and why: the reason, and a sentence saying it. */
|
|
90
|
+
readonly onFailure?: (reason: WorkerViewFailure, detail?: string) => void;
|
|
91
|
+
/**
|
|
92
|
+
* What is drawn in the view's place when it fails. By default the host
|
|
93
|
+
* draws the plain face of what the view was shown — its title, each
|
|
94
|
+
* record's label, and why the view was stopped — in the region; `false`
|
|
95
|
+
* leaves the region empty for a host that draws its own (the React
|
|
96
|
+
* registrations draw the kind's own face).
|
|
97
|
+
*/
|
|
98
|
+
readonly fallback?: false | ((region: HTMLElement, reason: WorkerViewFailure, detail: string) => void);
|
|
99
|
+
/** The page's origin, for a `blob:` image of its own. `location.origin` by default. */
|
|
100
|
+
readonly origin?: string;
|
|
101
|
+
/** Who made it, said under the region (ADR 0007: "Made by Claude for Nick"). Nothing by default. */
|
|
102
|
+
readonly author?: string;
|
|
103
|
+
}
|
|
104
|
+
export interface WorkerView {
|
|
105
|
+
/** The region the host owns: the view is drawn in its shadow root. */
|
|
106
|
+
readonly element: HTMLElement;
|
|
107
|
+
readonly shadow: ShadowRoot;
|
|
108
|
+
/** The worker, until it is stopped. */
|
|
109
|
+
readonly worker: Worker | undefined;
|
|
110
|
+
/** Push again: the view's input, or the app's look, moved. */
|
|
111
|
+
update(): void;
|
|
112
|
+
readonly stats: Readonly<GuestStats>;
|
|
113
|
+
/** What of the view's drawing and stylesheet was refused. */
|
|
114
|
+
readonly refused: readonly ViewRefusal[];
|
|
115
|
+
dispose(): void;
|
|
116
|
+
}
|
|
117
|
+
export { readTheme };
|
|
118
|
+
/**
|
|
119
|
+
* MOUNT A WORKER VIEW ON THE OPEN KIT (FR-90), AS A PLACE WITH A MANIFEST
|
|
120
|
+
* (FR-91).
|
|
121
|
+
*
|
|
122
|
+
* The view runs in a classic, hardened worker (FR-68–FR-71) and draws
|
|
123
|
+
* plain HTML, SVG and one stylesheet; the host draws them into a shadow
|
|
124
|
+
* root inside a region of its own — contained (`contain: layout paint
|
|
125
|
+
* style`), isolated, clipped — keeping only what the open kit allows. What
|
|
126
|
+
* could fetch or escape is not drawn, and is written down in `refused`.
|
|
127
|
+
* What it is handed is the viewer's sight cut to its manifest, with the
|
|
128
|
+
* app's look, pushed again when the app's scheme changes. A manifest that
|
|
129
|
+
* names what the app does not declare is refused before a worker starts.
|
|
130
|
+
* The sanitiser is fetched the first time a view draws, so a page that
|
|
131
|
+
* mounts none loads none of it.
|
|
132
|
+
*/
|
|
133
|
+
export declare function mountWorkerView<S extends AnySchema>(element: HTMLElement, options: MountWorkerViewOptions<S>): WorkerView;
|
|
134
|
+
//# sourceMappingURL=view.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"view.d.ts","sourceRoot":"","sources":["../../src/host/view.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACjE,OAAO,KAAK,EAAiB,UAAU,EAAc,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACxF,OAAO,EAAkC,KAAK,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACxF,OAAO,KAAK,EAAe,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC/D,OAAO,EAAuD,KAAK,WAAW,EAAE,KAAK,UAAU,EAAE,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAC3I,OAAO,EAAe,KAAK,iBAAiB,EAAsB,MAAM,mBAAmB,CAAC;AAI5F,OAAO,EAAe,KAAK,WAAW,EAAE,MAAM,YAAY,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAc,MAAM,YAAY,CAAC;AAEnD,wGAAwG;AACxG,MAAM,MAAM,cAAc,GAAG,iBAAiB,GAAG;IAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAE7E;;;;GAIG;AACH,MAAM,MAAM,iBAAiB;AAC3B,2GAA2G;AACzG,UAAU;AACZ,sEAAsE;GACpE,QAAQ;AACV,+EAA+E;GAC7E,SAAS;AACX,wCAAwC;GACtC,OAAO;AACT,+GAA+G;GAC7G,QAAQ;AACV,oCAAoC;GAClC,OAAO;AACT,kEAAkE;GAChE,OAAO;AACT,8DAA8D;GAC5D,MAAM,CAAC;AAEX,MAAM,WAAW,gBAAiB,SAAQ,WAAW;IACnD,+EAA+E;IAC/E,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IACjC,kEAAkE;IAClE,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,uEAAuE;IACvE,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,wGAAwG;IACxG,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B;;;;;OAKG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB;;;;OAIG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAwBD,MAAM,WAAW,sBAAsB,CAAC,CAAC,SAAS,SAAS;IACzD,oHAAoH;IACpH,QAAQ,CAAC,QAAQ,EAAE,kBAAkB,CAAC;IACtC;;;;;OAKG;IACH,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;IAChC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;IACzB,iGAAiG;IACjG,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B,8EAA8E;IAC9E,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,cAAc,CAAC;IACtC;;;;;OAKG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC,EAAE,EAAE,WAAW,KAAK,IAAI,CAAC;IAChD,kGAAkG;IAClG,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,SAAS,UAAU,EAAE,CAAC;IAC9C;;;;OAIG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,UAAU,CAAC;IAClC,QAAQ,CAAC,MAAM,CAAC,EAAE,gBAAgB,CAAC;IACnC,wFAAwF;IACxF,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,iBAAiB,EAAE,MAAM,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1E;;;;;;OAMG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC,CAAC;IACvG,uFAAuF;IACvF,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,oGAAoG;IACpG,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,UAAU;IACzB,sEAAsE;IACtE,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;IAC5B,uCAAuC;IACvC,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,8DAA8D;IAC9D,MAAM,IAAI,IAAI,CAAC;IACf,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,UAAU,CAAC,CAAC;IACrC,6DAA6D;IAC7D,QAAQ,CAAC,OAAO,EAAE,SAAS,WAAW,EAAE,CAAC;IACzC,OAAO,IAAI,IAAI,CAAC;CACjB;AAED,OAAO,EAAE,SAAS,EAAE,CAAC;AAErB;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,eAAe,CAAC,CAAC,SAAS,SAAS,EAAE,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,sBAAsB,CAAC,CAAC,CAAC,GAAG,UAAU,CAmUzH"}
|