@nextwebwg/html-next 1.0.0-alpha.3 → 1.0.0-alpha.5
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 +10 -3
- package/dist/browser-loader.bundle.js +6 -6
- package/dist/browser-loader.d.ts.map +1 -1
- package/dist/browser-loader.js +1 -1
- package/dist/browser-loader.js.map +1 -1
- package/dist/browser.js +6 -6
- package/dist/forms.d.ts +26 -0
- package/dist/forms.d.ts.map +1 -0
- package/dist/forms.js +102 -0
- package/dist/forms.js.map +1 -0
- package/dist/generate.d.ts +1 -1
- package/dist/generate.js +1 -1
- package/dist/graph.d.ts.map +1 -1
- package/dist/graph.js +10 -1
- package/dist/graph.js.map +1 -1
- package/dist/resolve.d.ts +2 -2
- package/dist/resolve.d.ts.map +1 -1
- package/dist/resolve.js +31 -7
- package/dist/resolve.js.map +1 -1
- package/dist/targets/vue-host.d.ts.map +1 -1
- package/dist/targets/vue-host.js +10 -1
- package/dist/targets/vue-host.js.map +1 -1
- package/package.json +9 -5
package/dist/browser.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
var
|
|
2
|
-
`,r:"\r",t:" ","\\":"\\",'"':'"',"'":"'"}[o]??o}this.#l("Unterminated quoted keyword")}#s(e){return this.#d(),this.source.startsWith(e,this.#e)?(this.#e+=e.length,!0):!1}#a(e){this.#s(e)||this.#l(`Expected \`${e}\``)}#d(){for(;/\s/.test(this.source[this.#e]??"");)this.#e+=1}#l(e){throw new ce(e,this.#e)}};function Ne(t){let e=t.flatMap(o=>o.kind==="union"?o.members:[o]),n=new Map(e.map(o=>[U(o),o])),r=Array.from(n.values());return r.length===1?r[0]:{kind:"union",members:r}}function de(t){if(t.trim()==="")throw new ce("A type expression cannot be empty",0);return J(new Se(t).parse())}function $e(t){return typeof t=="object"&&t!==null&&"kind"in t&&["terminal","keyword","union","list","record","object"].includes(String(t.kind))}function le(t){return $e(t)?t:typeof t=="string"?{kind:"terminal",name:t}:Ne(t.enum.map(e=>({kind:"keyword",value:e})))}function U(t){let e=$e(t)?t:le(t);switch(e.kind){case"terminal":return e.name;case"keyword":return/^[A-Za-z_][A-Za-z0-9_-]*$/.test(e.value)?e.value:JSON.stringify(e.value);case"union":return e.members.map(n=>U(n)).join(" | ");case"list":return`list(${U(e.item)})`;case"record":return`record(${U(e.value)})`;case"object":return`object({ ${[...e.fields.map(n=>`${n.name}${n.optional?"?":""}: ${U(n.type)}`),...e.open?["..."]:[]].join(", ")} })`}}function j(t,e,n){return{ok:!1,issues:[{reason:t,message:e,path:n}]}}function Q(t,e){return typeof e=="number"?`${t}[${e}]`:/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(e)?`${t}.${e}`:`${t}[${JSON.stringify(e)}]`}function ut(t){if(typeof t!="object"||t===null||Array.isArray(t))return!1;let e=Object.getPrototypeOf(t);return e===Object.prototype||e===null}function Te(t){if(typeof t!="string")return t;try{return JSON.parse(t)}catch{return Symbol.for("html-next.bad-json")}}function yn(t,e){if(typeof t!="object"||t===null)return!1;if(t.kind===e&&"value"in t)return!0;let n=e==="trusted-html"?"TrustedHTML":"TrustedScript";return t.constructor?.name===n||Object.prototype.toString.call(t)===`[object ${n}]`}function gn(t,e,n){switch(e){case"string":return typeof t=="string"?{ok:!0,value:t}:j("typeMismatch","Must be a string.",n);case"boolean":return typeof t=="boolean"?{ok:!0,value:t}:t===""||t==="true"?{ok:!0,value:!0}:t==="false"?{ok:!0,value:!1}:j("typeMismatch","Must be true or false.",n);case"number":case"integer":{let r=typeof t=="number"?t:typeof t=="string"&&t.trim()!==""?Number(t):Number.NaN;return Number.isFinite(r)?e==="integer"&&!Number.isInteger(r)?j("typeMismatch","Must be an integer.",n):{ok:!0,value:r}:j("badInput",`Must be ${e==="integer"?"an integer":"a finite number"}.`,n)}case"null":return t===null?{ok:!0,value:null}:j("typeMismatch","Must be null.",n);case"absent":return t===void 0?{ok:!0,value:void 0}:j("typeMismatch","Must be absent.",n);case"trusted-html":case"trusted-script":return yn(t,e)?{ok:!0,value:t}:j("untrustedValue",`Must be a ${e==="trusted-html"?"TrustedHTML":"TrustedScript"} value.`,n);case"function":return typeof t=="function"?{ok:!0,value:t}:j("typeMismatch","Must be a function supplied through a property.",n);case"unknown":return{ok:!0,value:t}}}function Y(t,e,n){switch(e.kind){case"terminal":return gn(t,e.name,n);case"keyword":return t===e.value?{ok:!0,value:t}:j("typeMismatch",`Must be ${JSON.stringify(e.value)}.`,n);case"union":{for(let r of e.members){let o=Y(t,r,n);if(o.ok)return o}return j("typeMismatch",`Must match ${U(e)}.`,n)}case"list":{let r=Te(t);if(!Array.isArray(r))return j("typeMismatch","Must be a list.",n);let o=[],i=[];return r.forEach((a,s)=>{let c=Y(a,e.item,Q(n,s));c.ok?o.push(c.value):i.push(...c.issues)}),i.length===0?{ok:!0,value:o}:{ok:!1,issues:i}}case"record":{let r=Te(t);if(!ut(r))return j("typeMismatch","Must be a string-keyed record.",n);let o={},i=[];for(let[a,s]of Object.entries(r)){let c=Y(s,e.value,Q(n,a));c.ok?o[a]=c.value:i.push(...c.issues)}return i.length===0?{ok:!0,value:o}:{ok:!1,issues:i}}case"object":{let r=Te(t);if(!ut(r))return j("typeMismatch","Must be an object.",n);let o={},i=[],a=new Map(e.fields.map(s=>[s.name,s]));for(let s of e.fields){if(!(s.name in r)){s.optional||i.push({reason:"typeMismatch",message:"Required field is absent.",path:Q(n,s.name)});continue}let c=Y(r[s.name],s.type,Q(n,s.name));c.ok?o[s.name]=c.value:i.push(...c.issues)}for(let[s,c]of Object.entries(r))a.has(s)||(e.open?o[s]=c:i.push({reason:"typeMismatch",message:"Field is not declared by this closed object type.",path:Q(n,s)}));return i.length===0?{ok:!0,value:o}:{ok:!1,issues:i}}}}function _(t,e,n="$"){return Y(t,le(e),n)}function Ae(t,e){let n=_(t,e);if(!n.ok)throw new TypeError(n.issues.map(o=>`${o.path}: ${o.message}`).join("; "));let r=le(e);if(r.kind==="terminal"&&(r.name==="function"||r.name==="unknown"))throw new TypeError(`The ${r.name} type is property-only and cannot be serialized.`);return r.kind==="list"||r.kind==="record"||r.kind==="object"||r.kind==="union"&&typeof n.value=="object"&&n.value!==null?JSON.stringify(n.value):n.value===null?"null":n.value===void 0?"":String(n.value)}function B(t){let e=le(t);return e.kind==="terminal"?!["function","unknown","trusted-html","trusted-script"].includes(e.name):e.kind==="keyword"?!0:e.kind==="union"?e.members.every(B):e.kind==="list"?B(e.item):e.kind==="record"?B(e.value):e.fields.every(n=>B(n.type))}function He(t){let e;try{e=de(t)}catch(n){y("HC013",n instanceof Error?n.message:"Invalid prop type expression.")}return e.kind==="terminal"&&(e.name==="string"||e.name==="boolean"||e.name==="number")?e.name:e.kind==="keyword"?{enum:[e.value]}:e.kind==="union"&&e.members.every(n=>n.kind==="keyword")?{enum:e.members.map(n=>n.value)}:e}var E=Symbol("absent"),ee=class extends Error{constructor(n){super(`\`${n}\` is not declared in scope.`);this.identifier=n;this.name="UndeclaredName"}identifier},De=/\s*(?:(<=|>=|!=|\^=|\$=|\*=)|(\d+(?:\.\d*)?|\.\d+)|("(?:\\[\s\S]|[^"\\])*"|'(?:\\[\s\S]|[^'\\])*')|([A-Za-z_$][A-Za-z0-9_$]*)|([=<>+*/%(),.:{}[\]-])|$)/y,bn=/\\([\s\S])/g,wn=/%s/g,vn={or:1,and:2,"=":3,"!=":3,"^=":3,"$=":3,"*=":3,"<":4,"<=":4,">":4,">=":4,"+":5,"-":5,"*":6,"/":6,"%":6};function ft(t){return vn[t]??0}function kn(t){return t==="round"||t==="clamp"||t==="min"||t==="max"||t==="abs"||t==="format"}function Cn(t){let e=0,n=0,r="";function o(){De.lastIndex=e;let d=De.exec(t);if(d===null){let h=t.slice(e).trimStart()[0];throw h==='"'||h==="'"?new SyntaxError("Unterminated string literal."):new SyntaxError(`Unexpected character \`${h}\`.`)}e=De.lastIndex,d[1]!==void 0||d[5]!==void 0?(n=4,r=d[1]??d[5]):d[2]!==void 0?(n=1,r=Number(d[2])):d[3]!==void 0?(n=2,r=d[3].slice(1,-1).replace(bn,"$1")):d[4]!==void 0?(n=3,r=d[4]):(n=0,r="")}function i(d){return r!==d?!1:(o(),!0)}function a(d){if(!i(d))throw new SyntaxError(`Expected \`${d}\`.`)}function s(d){let h=c(),u=ft(r);for(;u>=d;){let p=r;o(),h={kind:"binary",op:p,left:h,right:s(u+1)},u=ft(r)}return h}function c(){if(n===3&&r==="not")return o(),{kind:"unary",op:"not",operand:c()};if(i("-"))return{kind:"unary",op:"-",operand:c()};let d=l();for(;n===4;)if(i(".")){if(n!==3)throw new SyntaxError("Expected a property name after `.`.");let h=r;o(),d={kind:"member",object:d,key:h}}else if(i("[")){let h=s(1);a("]"),d={kind:"index",object:d,index:h}}else break;return d}function l(){let d=n,h=r;if(d===1||d===2)return o(),{kind:"literal",value:h};if(d===4&&h==="("){o();let u=s(1);return a(")"),u}if(d===4&&h==="{"){o();let u=[];if(!i("}")){do{if(r==="}")break;if(n!==3&&n!==2)throw new SyntaxError("Object keys must be identifiers or strings.");let p=r;o(),a(":"),u.push({key:p,value:s(1)})}while(i(","));a("}")}return{kind:"object",pairs:u}}if(d===4&&h==="["){o();let u=[];if(!i("]")){do{if(r==="]")break;u.push(s(1))}while(i(","));a("]")}return{kind:"array",items:u}}if(d===3){let u=h;if(o(),u==="true")return{kind:"literal",value:!0};if(u==="false")return{kind:"literal",value:!1};if(u==="null")return{kind:"literal",value:null};if(r==="("&&kn(u)){o();let p=[];if(!i(")")){do p.push(s(1));while(i(","));a(")")}return{kind:"call",fn:u,args:p}}return{kind:"id",name:u}}throw new SyntaxError("Unexpected end of expression.")}o();let f=s(1);if(n!==0)throw new SyntaxError("Unexpected trailing input in expression.");return f}function X(t){return t===E||t===null}function L(t){if(t===E||t===null||t===!1)return!1;if(t===!0)return!0;if(typeof t=="string")return t.length>0;if(typeof t=="number")return t!==0&&t===t;if(Array.isArray(t))return t.length>0;for(let e in t)if(Object.hasOwn(t,e))return!0;return!1}function ue(t){return typeof t=="number"&&t===t?t:E}function H(t,e){switch(t.kind){case"literal":return t.value;case"id":{let n=e.get(t.name);if(n===void 0)throw new ee(t.name);return n}case"member":{let n=H(t.object,e);if(X(n)||typeof n!="object"||Array.isArray(n))return E;let r=n[t.key];return r===void 0?E:r}case"index":{let n=H(t.object,e),r=H(t.index,e);if(X(n)||X(r))return E;if(Array.isArray(n)&&typeof r=="number"){let o=n[r];return o===void 0?E:o}if(typeof n=="object"&&typeof r=="string"){let o=n[r];return o===void 0?E:o}return E}case"unary":{let n=H(t.operand,e);if(t.op==="not")return!L(n);let r=ue(n);return r===E?E:-r}case"binary":return xn(t,e);case"call":return En(t,e);case"object":{let n={};for(let r of t.pairs)n[r.key]=H(r.value,e);return n}case"array":{let n=[];for(let r of t.items)n.push(H(r,e));return n}}}function xn(t,e){let{op:n}=t;if(n==="and")return L(H(t.left,e))&&L(H(t.right,e));if(n==="or")return L(H(t.left,e))||L(H(t.right,e));let r=H(t.left,e),o=H(t.right,e);if(n==="=")return r===o;if(n==="!=")return r!==o;if(n==="^="||n==="$="||n==="*=")return typeof r!="string"||typeof o!="string"?E:n==="^="?r.startsWith(o):n==="$="?r.endsWith(o):r.includes(o);let i=ue(r),a=ue(o);if(i===E||a===E)return E;switch(n){case"<":return i<a;case"<=":return i<=a;case">":return i>a;case">=":return i>=a;case"+":return i+a;case"-":return i-a;case"*":return i*a;case"/":return i/a;case"%":return i%a;default:return E}}function En(t,e){let{args:n,fn:r}=t,o=[];for(let a of n)o.push(H(a,e));if(r==="format"){let a=o[0];if(typeof a!="string")return E;let s=1;return a.replace(wn,()=>s<o.length?P(o[s++]):"%s")}for(let a=0;a<o.length;a+=1){let s=ue(o[a]);if(s===E)return E;o[a]=s}let i=o;switch(r){case"abs":return i.length===1?Math.abs(i[0]):E;case"round":return i.length===1?Math.round(i[0]):E;case"min":return i.length>0?Math.min(...i):E;case"max":return i.length>0?Math.max(...i):E;case"clamp":return i.length===3?Math.min(Math.max(i[0],i[1]),i[2]):E;default:return E}}var pt=new Map;function Me(t){if(t.kind==="id")return t.name;if(t.kind==="member"){let e=Me(t.object);return e===void 0?void 0:`${e}.${t.key}`}if(t.kind==="index"&&t.index.kind==="literal"){let e=t.index.value;if(typeof e!="string"&&typeof e!="number")return;let n=Me(t.object);return n===void 0?void 0:`${n}.${e}`}}function O(t,e){let n=Me(t);if(n!==void 0){e.includes(n)||e.push(n);return}switch(t.kind){case"literal":return;case"id":return;case"member":O(t.object,e);return;case"index":O(t.object,e),O(t.index,e);return;case"unary":O(t.operand,e);return;case"binary":O(t.left,e),O(t.right,e);return;case"call":for(let r of t.args)O(r,e);return;case"object":for(let r of t.pairs)O(r.value,e);return;case"array":for(let r of t.items)O(r,e)}}function Pe(t,e){if(t.kind==="id")return e.push(t.name),!0;if(t.kind==="member")return Pe(t.object,e)?(e.push(t.key),!0):!1;if(t.kind!=="index"||!Pe(t.object,e))return!1;let n=t.index,r=n.kind==="literal"?n.value:void 0;return e.push(typeof r=="string"||typeof r=="number"?r:{kind:"index",expression:n}),!0}function fe(t){let e=pt.get(t);if(e!==void 0)return e;let n=Cn(t),r=[];return O(n,r),r.sort(),e={source:t,ast:n,dependencies:r},pt.set(t,e),e}function je(t,e){let n=[];if(!(!Pe(fe(t).ast,n)||!e.has(n[0])))return n}function mt(t,e){return H(fe(t).ast,e)}function I(t,e){return H("ast"in t?t.ast:t,e)}function P(t){return X(t)?"":Array.isArray(t)?t.map(P).join(" "):typeof t=="object"?"":String(t)}function Rn(t){return t.startsWith("aria-")||t==="contenteditable"||t==="draggable"||t==="spellcheck"}function ht(t,e=""){return typeof t=="boolean"&&Rn(e)?String(t):X(t)||t===!1?null:t===!0?"":typeof t=="number"||typeof t=="string"?String(t):Array.isArray(t)?t.map(P).join(" "):null}var Tn=new Set(["href","src","action","formaction","poster","data","xlink:href"]),Sn=new Set(["base","embed","iframe","link","meta","object","script","style","template"]),Nn=new Set(["srcdoc","style"]);function te(t){let e=t.replace(/[\u0000-\u0020\u007f]+/g,"");return/^(?:data|javascript|vbscript):/i.test(e)}function ne(t){return Tn.has(t.toLowerCase())}function Le(t,e,n){let r=e.createElement("template");r.innerHTML=t;for(let o of Array.from(r.content.querySelectorAll("*"))){if(n?.(o),Sn.has(o.localName)){o.remove();continue}for(let i of Array.from(o.attributes)){let a=i.name.toLowerCase();(a.startsWith("on")||Nn.has(a)||ne(a)&&te(i.value))&&o.removeAttribute(i.name)}}return r.content}var $n=/^(?:if|else-if|else|for|with|value|state|computed|data)$/,An=/^(?:@|v-|#|on:|use:|transition:|animate:)/,Hn=/^(?:innerhtml|outerhtml|srcdoc)$/,Dn=/^(?:base|embed|link|meta|object|script|style)$/;function yt(t){return $n.test(t)}function Oe(t,e){return Dn.test(t.toLowerCase())&&y("HT009",`<${t}> is not permitted in rendered component markup.`,e),t}function Ie(t,e,n=""){let r=t.toLowerCase();return(r.startsWith("on")||An.test(r))&&y("HT010",`Literal attribute \`${t}\` uses target-framework directive syntax that is not supported.`,e),r==="srcdoc"&&y("HT007","Literal `srcdoc` is not permitted in a component definition.",e),ne(r)&&te(n)&&y("HT007",`Literal \`${t}\` contains an executable URL.`,e),t}function gt(t,e){let n=t.toLowerCase();return(n.startsWith("on")||Hn.test(n))&&y("HT007",`Dynamic ${t} requires a future trusted-content type.`,e),t}function z(t){return"tagName"in t}function re(t){return t.nodeName==="#text"}function N(t){return"localName"in t?t.localName:t.tagName}function pe(t){return"attrs"in t?t.attrs:t.attributes}function V(t){return(N(t)==="template"?t.content:void 0)?.childNodes??t.childNodes}function oe(t){return"value"in t?t.value:"nodeValue"in t?t.nodeValue??"":""}function vt(t){let e=[];for(let n of t)n.nodeName!=="#comment"&&(!re(n)||oe(n).trim()!=="")&&e.push(n);return e}function x(t,e){return"attrs"in t?t.attrs.find(n=>n.name===e)?.value:t.getAttribute(e)??void 0}function kt(t){let e="";for(let n of V(t))re(n)&&(e+=oe(n));return e}function Ct(t,e){let n=[];for(let r of V(t))z(r)&&N(r)===e&&n.push(r);return n}function xt(t,e){for(let n of V(t)){if(!z(n))continue;let r=N(n);r==="link"&&y("HL001","External definition dependencies require the application-owned graph resolver.",e),Oe(r,e);for(let o of pe(n))/^on(?!:)/i.test(o.name)&&Ie(o.name,e,o.value);xt(n,e)}}var Mn=/^\$(?:if|each|where|sort|limit|key|with|match|when|else)$/,bt=/^(?:innerhtml|outerhtml|textcontent|innertext|srcdoc)$/,Pn=/^\s*([A-Za-z_$][\w$]*)\s*(?:,\s*([A-Za-z_$][\w$]*)\s*)?\bof\b\s*(.+)$/,wt=/^\s*(.+?)\s+\bas\b\s+([A-Za-z_$][\w$]*)\s*$/,ze=/^[a-z][a-z0-9-]*$/,jn=/^(?:prevent|stop|self|once|passive|capture|left|middle|right|ctrl|shift|alt|meta|exact|enter|escape|space|tab|up|down)$/,Ue=/^[A-Za-z_$][A-Za-z0-9_$-]*$/;function Ve(t,...e){let n=new Set(t.roots);for(let r of e)r!==void 0&&n.add(r);return{roots:n,writableRoots:t.writableRoots,handlers:t.handlers}}function S(t,e,n){let r=Vn(t,n);return Ln(r,e,n),r}function Ln(t,e,n){for(let r of t.dependencies){let o=r.split(".",1)[0];e.roots.has(o)||y("HT003",`Expression root \`${o}\` is not declared in this scope.`,n)}}function On(t,e,n){let r=Object.create(null),o=(a,s)=>{r[a]??=s},i=a=>{for(let s of pe(a))if(s.name.startsWith(":"))/^[A-Za-z][A-Za-z0-9_-]*$/.test(s.value)&&o(s.value,{attribute:s.name.slice(1).toLowerCase()});else if(s.name.startsWith(".")){let c=s.name.slice(1).toLowerCase();if(/^[A-Za-z][A-Za-z0-9_-]*$/.test(s.value)){let l=n.resolveDomProperty(N(a),c)??(s.value.toLowerCase()===c?s.value:c);o(s.value,{property:l})}}for(let s of V(a))z(s)&&N(s)!=="slot"&&i(s)};return i(t),r}function In(t,e,n,r=!0){let o=Object.create(null),i=Object.create(null);if(t===void 0)return o;let a=Ct(t,"prop");a.sort((s,c)=>{let l=x(s,"name")??"",f=x(c,"name")??"";return l<f?-1:l>f?1:0});for(let s of a){let c=x(s,"name");(c===void 0||c==="")&&y("HC010","A <prop> requires a `name` attribute.",n),/^[A-Za-z][A-Za-z0-9_-]*$/.test(c)||y("HC010",`Invalid prop name \`${c}\`.`,n);let l=x(s,"type");(l===void 0||l==="")&&y("HC013",`Prop \`${c}\` requires a \`type\` attribute.`,n);let f=c.toLowerCase(),d=i[f];d!==void 0&&y("HC011",`Props \`${d}\` and \`${c}\` collide after lowercase normalization.`,n),i[f]=c;let h=e[c];h===void 0&&r&&y("HC018",`Prop \`${c}\` is declared but never bound in the markup.`,n),h??={attribute:c.toLowerCase()};let u=He(l),p=x(s,"required")!==void 0,m=kt(s).trim();m===""&&y("HC003",`\`props.${c}.description\` must be a non-empty string.`,n),B(u)||y("HC017",`Prop \`${c}\` cannot be written as an HTML attribute; function, unknown, and trusted content types have no text form.`,n);let w=x(s,"default");p&&w!==void 0&&y("HC019",`Required prop \`${c}\` cannot also declare a default.`,n);let C={type:u,required:p,target:h,description:m};if(w!==void 0){let k=_(w,u);k.ok||y("HC015",`Default for prop \`${c}\` does not satisfy its type.`,n),C.default=k.value}o[c]=C}return o}function zn(t,e,n,r,o,i,a){let s=x(t,"component")??"";s.trim()===""&&y("HC003","`component` must be a non-empty string.",i),/^[a-z][a-z0-9]*(?:-[a-z0-9]+)+$/.test(s)||y("HC005","The `component` tag must be lowercase and contain a hyphen.",i);let c=x(t,"status");c!==void 0&&!/^(?:early|experimental|stable|deprecated)$/.test(c)&&y("HC007","Component `status` is not recognized.",i);let l=x(t,"summary");return l!==void 0&&l.trim()===""&&y("HC003","`summary` must be a non-empty string.",i),(!/^[a-z][a-z0-9-]*$/.test(n)||r&&!/^[a-z][a-z0-9]*(?:-[a-z0-9]+)+$/.test(n))&&y("HC008","`nativeElement` must be a lowercase HTML element or component tag.",i),{version:1,name:lt(s),tag:s,...c===void 0?{}:{status:c},...l===void 0?{}:{summary:l},nativeElement:n,props:In(e,o,i,a)}}function Vn(t,e){try{return fe(t)}catch{y("HT013",`Malformed expression \`${t}\`.`,e)}}function qn(t,e,n){let r=[];for(let o of vt(V(t))){z(o)||y("HC023","Handler bodies contain declarative step elements only.",n);let i=x(o,"$if"),a=i===void 0?void 0:S(i,e,n);if(N(o)==="set"){let s=x(o,"name")??"",c=x(o,":value"),l=x(o,"value");(s===""||c===void 0==(l===void 0))&&y("HC023","A <set> requires `name` and exactly one of `value` or `:value`.",n),S(s,e,n);let f=je(s,e.writableRoots);f===void 0&&y("HT005",`Handler write \`${s}\` is not rooted in declared state.`,n);let d={kind:"set",path:s,writablePath:f,value:S(c??JSON.stringify(l),e,n)};a!==void 0&&(d.guard=a),r.push(d);continue}if(N(o)==="dispatch"){let s=x(o,"event")??"";ze.test(s)||y("HC023","A <dispatch> requires a valid `event` name.",n);let c=x(o,":value"),l=x(o,"value");c!==void 0&&l!==void 0&&y("HC023","A <dispatch> may declare only one of `value` or `:value`.",n);let f=c===void 0&&l===void 0?void 0:S(c??JSON.stringify(l),e,n),d={kind:"dispatch",event:s};f!==void 0&&(d.value=f),a!==void 0&&(d.guard=a),r.push(d);continue}if(N(o)==="validate"||N(o)==="focus"){let s=x(o,"target")??x(o,"ref")??x(o,"name")??"";Ue.test(s)||y("HC023",`<${N(o)}> requires a valid target reference.`,n);let c={kind:N(o),target:s};a!==void 0&&(c.guard=a),r.push(c);continue}y("HC023",`<${N(o)}> is not a recognized handler step.`,n)}return r}function Un(t,e,n){let r=[],o=new Set(Object.keys(e.props)),i=new Set,a=new Set;if(t===void 0)return{declarations:r,scope:{roots:o,writableRoots:i,handlers:a}};let s=[],c=new Set,l=new Set;for(let d of V(t)){if(!z(d))continue;let h=d;s.push(h);let u=N(h);/^(?:prop|state|computed|data|handler|event|method)$/.test(u)||y("HC021",`<${u}> is not a recognized definition declaration.`,n);let p=x(h,"name")??"";if(p===""&&y("HC010",`A <${u}> requires a \`name\` attribute.`,n),u==="event"){l.has(p)&&y("HC020",`Event \`${p}\` is declared more than once.`,n),l.add(p);continue}c.has(p)&&y("HC020",`Declaration \`${p}\` collides in the flat component scope.`,n),c.add(p),o.add(p),u==="state"?i.add(p):u==="handler"&&a.add(p)}let f={roots:o,writableRoots:i,handlers:a};for(let d of s){let h=N(d);if(h==="prop")continue;let u=x(d,"name");if(h==="state"){let p=x(d,":value"),m=x(d,"value");p!==void 0&&m!==void 0&&y("HC013",`<state name="${u}"> may declare only one of \`value\` or \`:value\`.`,n);let w=p===void 0&&m===void 0?void 0:S(p??JSON.stringify(m),f,n),C={kind:h,name:u},k=x(d,"type");k!==void 0&&(He(k),C.type=k),m!==void 0&&(C.value=m),w!==void 0&&(C.expression=w),r.push(C);continue}if(h==="computed"){let p=x(d,"from");(p===void 0||p==="")&&y("HC013",`<computed name="${u}"> requires a \`from\` expression.`,n),r.push({kind:h,name:u,expression:S(p,f,n)});continue}if(h==="data"){let p=x(d,"src"),m=x(d,"type"),w=x(d,"debounce"),C=x(d,"poll"),k=[],g=new Set;for(let v of Ct(d,"param")){let R=x(v,"name")??"",T=x(v,":value");(!Ue.test(R)||T===void 0)&&y("HC024","A data <param> requires a valid `name` and a `:value` expression.",n),g.has(R)&&y("HC024",`Data source \`${u}\` repeats a parameter name.`,n),g.add(R),k.push({name:R,expression:S(T,f,n)})}let b={kind:h,name:u,parameters:k};p!==void 0&&(b.source=p),m!==void 0&&(b.type=m),w!==void 0&&(b.debounce=w),C!==void 0&&(b.poll=C),r.push(b);continue}if(h==="event"){r.push({kind:h,name:u,type:x(d,"type")??"object",bubbles:x(d,"bubbles")!=="false",composed:x(d,"composed")!=="false",cancelable:x(d,"cancelable")==="true"});continue}if(h==="method"){r.push({kind:h,name:u,exportName:x(d,"export")??u,returns:x(d,"returns")??"undefined"});continue}r.push({kind:"handler",name:u,steps:qn(d,f,n)})}for(let d of r)if(d.kind==="handler")for(let h of d.steps)h.kind==="dispatch"&&!l.has(h.event)&&y("HC023",`Handler \`${d.name}\` dispatches undeclared component event \`${h.event}\`.`,n);return{declarations:r,scope:f}}function Bn(t,e,n,r,o,i){let a=[];for(let s of t){if(s.name.startsWith("bind:")){let c=s.name.slice(5).toLowerCase();(c===""||bt.test(c))&&y("HT007",`Two-way binding cannot target \`${c||s.name}\`.`,o);let l=S(s.value,r,o),f=je(s.value,r.writableRoots);f===void 0&&y("HT005",`\`${s.value}\` is not a writable state-rooted path.`,o),a.push({kind:"attribute",name:c,expression:s.value,expressionPlan:l,twoWay:!0,writablePath:f});continue}if(s.name.startsWith("class:")||s.name.startsWith("style:")){let c=s.name.startsWith("class:")?"class":"style",l=s.name.slice(c.length+1);(c==="class"?l!==""&&!/\s/.test(l):/^(?:--[a-z0-9_-]+|[a-z][a-z0-9-]*)$/.test(l))||y("HT020",`\`${s.name}\` does not name a valid ${c} binding target.`,o),a.push({kind:"attribute",name:l,expression:s.value,expressionPlan:S(s.value,r,o),target:c});continue}if(s.name.startsWith("$")){let c=s.name.slice(1).toLowerCase();c!=="value"&&c!=="html"&&y("HT012",`\`$${c}\` is not a known content directive.`,o),a.push({kind:"directive",name:c,expression:s.value,expressionPlan:S(s.value,r,o)});continue}if(s.name.startsWith(":")){let c=s.name.slice(1).toLowerCase();bt.test(c)&&y("HT007",`\`:${c}\` cannot bind a raw content sink.`,o);let l=S(s.value,r,o);a.push({kind:"attribute",name:c,expression:s.value,expressionPlan:l});continue}if(s.name.startsWith(".")){let c=s.name.slice(1).toLowerCase(),l=S(s.value,r,o),f=i.resolveDomProperty(e,c);f===void 0&&y("HP001",`\`${c}\` is not a native property of <${e}>.`,o),gt(f,o),a.push({kind:"property",key:c,name:f,expression:s.value,expressionPlan:l});continue}Ie(s.name,o,s.value),a.push({kind:"literal",name:s.name,value:s.value})}return a}function _n(t,e,n){if(t===void 0)return;let r=[];for(let o of t){let[i="",...a]=o.name.slice(3).split(".");(!ze.test(i)||a.some(s=>!ze.test(s)))&&y("HT010",`\`${o.name}\` is not a valid declarative event binding.`,n);for(let s=0;s<a.length;s+=1){let c=a[s];a.indexOf(c)!==s&&y("HT010",`\`${o.name}\` repeats an event modifier.`,n),jn.test(c)||y("HT010",`\`${o.name}\` contains an unsupported event modifier.`,n)}a.includes("passive")&&a.includes("prevent")&&y("HT010",`\`${o.name}\` cannot combine passive and prevent.`,n),e.handlers.has(o.value)||y("HT010",`Event binding \`${o.name}\` names undeclared handler \`${o.value}\`.`,n),r.push({name:i,handler:o.value,modifiers:a})}return r}function Wn(t,e,n){if(t!==void 0)return Ue.test(t)||y("HT019","`$ref` requires a valid non-empty name.",n),e.has(t)&&y("HT019",`Reference \`${t}\` is duplicated.`,n),e.add(t),t}function Fn(t,e,n){if(t===void 0)return;let r=[],o=[];t.$if!==void 0&&r.push("$if"),t.$each!==void 0&&r.push("$each"),t.$with!==void 0&&r.push("$with"),t.$match!==void 0&&r.push("$match"),t.$when!==void 0&&r.push("$when"),t.$else!==void 0&&r.push("$else"),t.$where!==void 0&&o.push("$where"),t.$sort!==void 0&&o.push("$sort"),t.$limit!==void 0&&o.push("$limit"),t.$key!==void 0&&o.push("$key"),r.length>1&&y("HT014",`An element carries one structural directive; found ${r.join(", ")}.`,n);let i=t.$each;i===void 0&&o.length>0&&y("HT014",`${o.join(", ")} may only modify \`$each\`.`,n);let a=t.$if;if(a!==void 0){let f=a;return{kind:"if",test:f,testPlan:S(f,e,n)}}let s=t.$with;if(s!==void 0){let f=wt.exec(s);return f===null&&y("HT015","`$with` must be written `expr as name`.",n),{kind:"with",expr:f[1],expressionPlan:S(f[1],e,n),alias:f[2]}}if(i!==void 0){let f=Pn.exec(i);f===null&&y("HT016","`$each` must be written `item of items` (optionally `item, i of items`).",n);let d=f[1],h=f[2];(e.roots.has(d)||h!==void 0&&e.roots.has(h))&&y("HC020","Loop locals may not collide with an existing scope name.",n);let u=Ve(e,d,h,"loop"),p={kind:"each",item:d,list:f[3],listPlan:S(f[3],e,n)};h!==void 0&&(p.index=h);let m=t.$where;m!==void 0&&(p.where=m,p.wherePlan=S(m,u,n)),t.$sort!==void 0&&(p.sort=t.$sort);let w=t.$limit;w!==void 0&&(p.limit=w,p.limitPlan=S(w,u,n));let C=t.$key;return C!==void 0&&(p.key=C,p.keyPlan=S(C,u,n)),p}let c=t.$match;if(c!==void 0){let f=c.trim();if(f==="")return{kind:"match"};let d=wt.exec(f);return d===null&&y("HT017","`$match` scope must be written `expr as name`.",n),{kind:"match",expr:d[1],expressionPlan:S(d[1],e,n),alias:d[2]}}let l=t.$when;if(l!==void 0){let f=l;return{kind:"when",test:f,testPlan:S(f,e,n)}}if(t.$else!==void 0)return{kind:"else"}}function qe(t,e,n,r,o,i){let a=N(t);yt(a)&&y("HT009",`<${a}> is reserved but not supported by this profile.`,r),Oe(a,r);let s,c=[],l,f;for(let g of pe(t))Mn.test(g.name)?(s??={})[g.name]=g.value:g.name==="$ref"?f=g.value:g.name.startsWith("on:")?(l??=[]).push(g):g.name!=="as"&&c.push(g);let d=Fn(s,n,r),h=d?.kind==="each"?Ve(n,d.item,d.index,"loop"):d?.kind==="with"||d?.kind==="match"&&d.alias!==void 0?Ve(n,d.alias):n,u=Bn(c,a,e,h,r,i),p=_n(l,h,r),m=Wn(f,o.refs,r),w=[],C=V(t);for(let g of C)if(g.nodeName!=="#comment"){if(re(g)){let b=oe(g);b.trim()!==""&&w.push({kind:"text",value:b});continue}if(z(g)){if(N(g)==="slot"){let b=x(g,"name"),v=x(g,":name");b!==void 0&&v!==void 0&&y("HT008","A slot cannot declare both `name` and `:name`.",r);for(let M of pe(g))M.name!=="name"&&M.name!==":name"&&y("HT008","A slot has an unsupported attribute.",r);b===void 0&&v===void 0&&(o.defaults+=1,o.defaults>1&&y("HT008","A component may declare one default slot.",r)),b!==void 0&&((b===""||o.names.has(b))&&y("HT008",`Slot name \`${b}\` is empty or duplicated.`,r),o.names.add(b));let R=[];for(let M of V(g))if(M.nodeName!=="#comment")if(re(M)){let ae=oe(M);ae.trim()!==""&&R.push({kind:"text",value:ae})}else z(M)&&R.push(qe(M,e,h,r,o,i));let A={dynamic:v!==void 0,required:R.length===0};if(b!==void 0&&(A.name=b),o.contracts.push(A),b===void 0&&v===void 0&&R.length===0)w.push({kind:"slot"});else{let M={kind:"slot",fallback:R};b!==void 0&&(M.name=b),v!==void 0&&(M.nameExpression=S(v,h,r)),w.push(M)}continue}w.push(qe(g,e,h,r,o,i))}}if(u.some(g=>g.kind==="directive")&&w.length>0&&y("HT006","A content directive cannot coexist with children.",r),u.some(g=>g.kind==="property"&&g.name==="textContent")&&w.length>0&&y("HT006","A content-replacing property binding cannot coexist with children.",r),d?.kind==="match"){let g=0;for(let v of w)v.kind==="element"&&(g+=1);let b=!1;for(let v of w)v.kind==="element"&&(g-=1,v.flow?.kind==="when"?b&&y("HT018","A `$when` arm may not follow `$else`.",r):v.flow?.kind==="else"?(b&&y("HT018","A `$match` has at most one `$else`.",r),b=!0,g!==0&&y("HT018","`$else` must be the last arm.",r)):y("HT018","Every direct child of a `$match` must be a `$when` or `$else` arm.",r))}let k={kind:"element",name:a,attributes:u,children:w};return d!==void 0&&(k.flow=d),p!==void 0&&(k.events=p),m!==void 0&&(k.ref=m),k}function Et(t,e,n){let r=vt(t);(r.length!==1||!z(r[0])||N(r[0])!=="template"||x(r[0],"component")===void 0)&&y("HS001","A source must contain exactly one top-level <template component>.",e);let o=r[0],i,a=!1,s,c;for(let b of V(o)){if(b.nodeName==="#comment"||re(b)&&oe(b).trim()==="")continue;z(b)||y("HT001","A component's markup must be exactly one element root.",e);let v=N(b);v==="props"||v==="defs"?(i!==void 0&&y("HS002","A component has one optional declaration group, one markup root, and one optional <style>.",e),i=b,a=v==="props",xt(b,e)):v==="style"?(s!==void 0&&y("HS002","A component has one optional declaration group, one markup root, and one optional <style>.",e),s=b):c===void 0?c=b:y("HT001","A component's markup must be exactly one element root.",e)}c===void 0&&y("HT001","A component's markup must be exactly one element root.",e);let l=N(c),f=(x(c,"as")??l).split("|");for(let b=f.length-1;b>=0;b-=1)f[b]=f[b].trim(),f[b]===""&&f.splice(b,1);let d=!n.isNativeElement(l);d&&x(c,"as")!==void 0&&y("HT021","A delegated component root cannot also declare native `as` choices.",e),!d&&(f.length===0||!f.includes(l)||f.some((b,v)=>f.indexOf(b)!==v)||f.some(b=>!n.isNativeElement(b)))&&y("HT021","A polymorphic root must list unique native choices including its markup root.",e);let h=On(c,e,n),u=zn(o,i,l,d,h,e,a),{declarations:p,scope:m}=Un(a?void 0:i,u,e),w={defaults:0,names:new Set,contracts:[],refs:new Set},C=qe(c,u,m,e,w,n),k=x(o,"controller");k===""&&y("HC022","A controller specifier cannot be empty.",e);let g={source:{file:e},contract:u,template:C,css:s===void 0?"":kt(s).trim(),declarations:p,slots:w.contracts,root:d?{kind:"component",tag:l}:{kind:"native",element:l,choices:f}};return k!==void 0&&(g.controller=k),J(g)}var Rt=new WeakMap;function Gn(t){let e={},n={},r=o=>{if(o.includes("-"))return!1;if(Object.hasOwn(e,o))return e[o];let i=t.createElement(o),a=t.defaultView?.HTMLUnknownElement,s=a===void 0?i.constructor.name!=="HTMLUnknownElement":!(i instanceof a);return e[o]=s,s};return{isNativeElement:r,resolveDomProperty(o,i){if(!r(o))return;let a=`${o}:${i}`;if(a in n)return n[a]||void 0;let s=t.createElement(o),c=i.toLowerCase();for(;s!==null;){for(let l of Object.getOwnPropertyNames(s))if(l.toLowerCase()===c)return n[a]=l,l;s=Object.getPrototypeOf(s)}n[a]=""}}}function Be(t,e=t.ownerDocument.URL){(t.localName!=="template"||!t.hasAttribute("component"))&&y("HS001","A browser component carrier must be a <template component>.",e);let n=t.ownerDocument,r=Rt.get(n);return r===void 0&&(r=Gn(n),Rt.set(n,r)),Et([t],e,r)}function Tt(t,e,n){let r=n.createElement("template");r.innerHTML=t;let o;for(let a of r.content.childNodes)a.nodeType===1&&a.localName==="template"&&a.hasAttribute("component")&&(o!==void 0&&y("HS001","A component resource must contain exactly one <template component>.",e),o=a);o===void 0&&y("HS001","A component resource must contain exactly one <template component>.",e);let i=[];for(let a of r.content.childNodes){if(a===o||a.nodeType===8||a.nodeType===3&&(a.nodeValue??"").trim()==="")continue;(a.nodeType!==1||a.localName!=="link"||a.getAttribute("rel")!=="component")&&y("HT009","A component resource may contain only dependency links and one inert carrier.",e);let s=a.getAttribute("href");(s===null||s.trim()==="")&&y("HL006","A component dependency link requires a non-empty `href`.",e),i.push(s)}return{definition:Be(o,e),dependencies:i}}var me=class{#e=new Map;#t=new Map;define(e,n){this.#e.has(e)&&y("HR001",`More than one definition declares <${e}>.`),this.#e.set(e,Object.freeze(n));for(let r of this.#t.get(e)??[])r();this.#t.delete(e)}get(e){return this.#e.get(e)}whenDefined(e){return this.#e.has(e)?Promise.resolve():new Promise(n=>{let r=this.#t.get(e)??[];r.push(n),this.#t.set(e,r)})}addGraph(e,n){for(let r of e.nodes.values())r.shadowedByCustomElement||this.define(r.definition.contract.tag,{node:r,...r.controller===void 0||n===void 0?{}:{loadController:()=>n(r)}})}};var St=/^(?:[A-Za-z][A-Za-z\d+.-]*:|\/|\.\.?\/)/;function Nt(t){return new URL("./",t).href}function Zn(t,e){return t.endsWith("/")?e:Nt(e)}var he=class{#e;#t;constructor(e={},n="file:///"){this.#e=new URL(n).href,this.#t=new Map(Object.entries(e.imports??{}).map(([r,o])=>[r,new URL(o,this.#e).href]))}resolveRoot(e){if(St.test(e)){let n=new URL(e,this.#e).href;return Object.freeze({url:n,trustRoot:Nt(n)})}return this.#n(e)}resolveDependency(e,n,r){if(!St.test(e))return this.#n(e);let o=new URL(e,n).href;return Object.freeze({url:o,trustRoot:r})}assertFinalURL(e,n){return new URL(n,e.url).href}#n(e){let n=this.#t.get(e);if(n!==void 0)return Object.freeze({url:n,trustRoot:Zn(e,n),mapping:e});let r=Array.from(this.#t.keys()).filter(i=>i.endsWith("/")&&e.startsWith(i)).sort((i,a)=>a.length-i.length)[0];r===void 0&&y("HL002",`Bare resource specifier \`${e}\` is not mapped by the application.`);let o=this.#t.get(r);return Object.freeze({url:new URL(e.slice(r.length),o).href,trustRoot:o,mapping:r})}};var $t=new Map;function _e(t,e=n=>import(n)){let n=t.controller;if(n===void 0)return Promise.reject(new TypeError(`<${t.definition.contract.tag}> does not declare a controller.`));let r=$t.get(n.url);return r===void 0&&(r=e(n.url).then(o=>{let i=o?.default;return typeof i!="function"&&y("HJ002",`Controller module \`${n.url}\` must default-export a function.`,t.url),Object.freeze({...o,default:i})}).catch(o=>{if(o instanceof Error&&"diagnostic"in o)throw o;y("HJ001",`Controller module \`${n.url}\` failed to load: ${o instanceof Error?o.message:String(o)}.`,t.url)}),$t.set(n.url,r)),r}async function At(t,e=n=>import(n)){return(await _e(t,e)).default}function Kn(t,e,n){let r=new Set,o=t.replace(/\{([A-Za-z_$][A-Za-z0-9_$-]*)\}/g,(a,s)=>{r.add(s);let c=n[s];return c==null?"":encodeURIComponent(String(c))}),i=new URL(o,e);for(let[a,s]of Object.entries(n))if(!(r.has(a)||s==null))if(Array.isArray(s))for(let c of s)i.searchParams.append(a,String(c));else i.searchParams.set(a,String(s));return i.href}var ye=class{constructor(e){this.options=e;this.#e=e.fetch??globalThis.fetch.bind(globalThis),this.#t=e.setTimer??((n,r)=>setTimeout(n,r)),this.#n=e.clearTimer??(n=>clearTimeout(n))}options;#e;#t;#n;#o={};#i;#r;#c=0;#s=!1;update(e){this.#o={...e},this.#s=!0,this.#a();let n=++this.#c,r=()=>{this.#l(n)};(this.options.debounce??0)>0?this.#r=this.#t(r,this.options.debounce):r()}disconnect(){this.#s&&(this.#s=!1,this.#c+=1,this.#a())}#a(){this.#i?.abort(),this.#i=void 0,this.#r!==void 0&&this.#n(this.#r),this.#r=void 0}#d(e){return!this.#s||e!==this.#c}async#l(e){if(this.#d(e))return;let n=new AbortController;this.#i=n;let r=this.options;r.onState({pending:!0,value:null,error:null,ok:!1});try{let o=await this.#e(Kn(r.source,r.baseURL,this.#o),{signal:n.signal});if(!o.ok)throw new TypeError(`Request failed with ${o.status}.`);let i=r.type==="text"?await o.text():await o.json(),a=r.adapt===void 0?i:r.adapt(i);if(this.#d(e))return;r.onState({pending:!1,value:a,error:null,ok:!0})}catch(o){if(n.signal.aborted||this.#d(e))return;r.onState({pending:!1,value:null,error:o,ok:!1})}finally{this.#i===n&&(this.#i=void 0),!this.#d(e)&&(r.poll??0)>0&&(this.#r=this.#t(()=>{this.#l(e)},r.poll))}}};var $,Jn=0,Ht=100,We=new WeakMap,ge=new WeakMap;function Dt(t){let{dependency:e,previousSubscriber:n,nextSubscriber:r}=t;n===void 0?e.first=r:n.nextSubscriber=r,r===void 0?e.last=n:r.previousSubscriber=n}function Mt(t){if(t.length>8)return[];for(;t.length>0;)t.pop();return t}var Fe=class{#e=[];#t=[];#n=!1;#o=!1;enqueue(e){e.stopped||e.queued||(e.queued=!0,this.#e.push(e),!this.#n&&!this.#o&&(this.#n=!0,queueMicrotask(()=>{this.#n=!1,this.flush()})))}enqueueDependency(e){if(this.#o||this.#e.length>0)return!1;for(let n=e.first;n!==void 0;n=n.nextSubscriber){let r=n.effect;if(r.scheduler!==this){for(let o of this.#e)o.queued=!1;return this.#e=[],!1}r.queued||(r.queued=!0,this.#e.push(r))}return this.#n||(this.#n=!0,queueMicrotask(()=>{this.#n=!1,this.flush()})),!0}flush(){this.#o||this.#e.length===0||this.#i()}#i(){this.#o=!0;let e=0,n,r=0;try{for(;this.#e.length>0;){if(e+=1,e>Ht){for(let o of this.#e)o.queued=!1;this.#e=[],y("HR006","A reactive flush exceeded the propagation-depth limit.")}if(n=this.#e,n.length>1){let o=1,i=n[0];for(;o<n.length;){let a=n[o];if(i.priority>a.priority||i.priority===a.priority&&i.id>a.id)break;i=a,o+=1}o<n.length&&n.sort((a,s)=>a.priority-s.priority||a.id-s.id)}this.#e=this.#t,r=0;do{let o=n[r];if(o.queued=!1,r+=1,o.computed===void 0?o.execute():o.computed.refresh(),this.#e.length===1&&r===n.length&&this.#e[0].computed===void 0){e+=1,e>Ht&&(this.#e[0].queued=!1,this.#e=[],y("HR006","A reactive flush exceeded the propagation-depth limit."));let i=this.#e;this.#e=Mt(n),n=i,r=0}else this.#e.length>0&&this.#r(n,r)}while(r<n.length);this.#t=Mt(n),n=void 0}}finally{if(n!==void 0){for(;r<n.length;)n[r++].queued=!1;this.#t=[]}if(this.#e.length>0){for(let o of this.#e)o.queued=!1;this.#e=[]}this.#o=!1}}#r(e,n){if(this.#e.some(r=>r.computed!==void 0))for(let r=e.length-1;r>=n;r-=1){let o=e[r];o.computed===void 0&&(e.splice(r,1),this.#e.push(o))}}},be=class{constructor(e,n,r,o){this.scheduler=e;this.run=n;this.priority=r;this.computed=o}scheduler;run;priority;computed;id=Jn++;dependencies=void 0;stopped=!1;paused=!1;queued=!1;#e=void 0;#t=void 0;execute(){if(this.stopped||this.paused)return;if(this.#t=void 0,this.#e!==void 0){let n=this.#e;this.#e=void 0,n()}let e=$;$=this;try{let n=this.run();n!==void 0&&(this.#e=n)}finally{$=e;let n=this.#t,r=n===void 0?this.dependencies:n.nextDependency;for(n===void 0?this.dependencies=void 0:n.nextDependency=void 0;r!==void 0;){let o=r.nextDependency;Dt(r),r=o}}}track(e){let n=this.#t===void 0?this.dependencies:this.#t.nextDependency;if(n?.dependency===e){this.#t=n;return}for(let i=this.dependencies;i!==n;i=i?.nextDependency)if(i?.dependency===e)return;let r={dependency:e,effect:this,nextDependency:n,previousSubscriber:void 0,nextSubscriber:void 0};this.#t===void 0?this.dependencies=r:this.#t.nextDependency=r,this.#t=r;let o=e.first;if(this.computed!==void 0&&o!==void 0)r.nextSubscriber=o,o.previousSubscriber=r,e.first=r;else{let i=e.last;r.previousSubscriber=i,i===void 0?e.first=r:i.nextSubscriber=r,e.last=r}}schedule(){if(this.computed!==void 0){this.computed.invalidate();return}this.paused||this.scheduler.enqueue(this)}pause(){this.stopped||this.paused||(this.paused=!0,this.#n(),this.#e?.(),this.#e=void 0)}resume(){this.stopped||!this.paused||(this.paused=!1,this.execute())}stop(){this.stopped||(this.stopped=!0,this.#n(),this.#e?.(),this.#e=void 0)}#n(){let e=this.dependencies;for(;e!==void 0;){let n=e.nextDependency;Dt(e),e=n}this.dependencies=void 0,this.#t=void 0}},Ge=class{#e={first:void 0,last:void 0};#t;constructor(e){this.#t=e}get(){return $!==void 0&&$.track(this.#e),this.#t}set(e){Object.is(this.#t,e)||(this.#t=e,W(this.#e))}update(e){this.set(e(this.#t))}},we=class{#e;#t;#n;#o;#i=!1;#r=!0;#c=!1;#s=!1;constructor(e,n,r={first:void 0,last:void 0}){this.#e=r,this.#t=n,this.#n=new be(e,()=>this.#l(),0,this)}get(){return this.#n.paused||this.#n.stopped?this.#d():(this.#a(),$!==void 0&&$.track(this.#e),this.#o)}invalidate(){if(!(this.#n.stopped||this.#r)){this.#r=!0;for(let e=this.#e.first;e!==void 0;e=e.nextSubscriber)if(e.effect.computed===void 0){this.#n.scheduler.enqueue(this.#n);return}W(this.#e)}}refresh(){this.#a()}pause(){this.#n.stopped||this.#n.paused||(this.#r=!0,this.#n.pause())}resume(){this.#n.stopped||!this.#n.paused||(this.#n.paused=!1)}stop(){this.#n.stop()}#a(){if(this.#c&&y("HR006","A reactive computed value depends on itself."),!this.#r||this.#n.stopped||this.#n.paused)return;let e=this.#i;this.#n.execute(),e&&this.#s&&W(this.#e,$?.computed===void 0?void 0:$)}#d(){this.#c&&y("HR006","A reactive computed value depends on itself.");let e=$;this.#c=!0,$=void 0;try{return this.#t()}finally{$=e,this.#c=!1}}#l(){this.#c=!0,this.#r=!1;try{let e=this.#t();this.#s=!this.#i||!Object.is(this.#o,e),this.#o=e,this.#i=!0}catch(e){throw this.#r=!0,e}finally{this.#c=!1}}};function W(t,e){let n=t?.first;if(n===void 0)return;let r=n!==t.last;if(!r&&n.effect.computed!==void 0){n.effect!==e&&n.effect.computed.invalidate();return}if(n.effect.computed===void 0){if(e===void 0&&r&&n.effect.scheduler.enqueueDependency(t))return;for(let o=n;o!==void 0;){let i=o.nextSubscriber;o.effect!==e&&o.effect.schedule(),o=i}return}for(let o=n;o!==void 0;){let i=o.nextSubscriber;o.effect!==e&&o.effect.schedule(),o=i}}function Pt(t){return new Ge(t)}function jt(t,e){return new we(t,e)}function F(t,e,n=1,r=!0){let o=new be(t,e,n);return r?o.execute():o.paused=!0,o}var ve=class t{constructor(e=[],n=new Fe,r){this.scheduler=n;this.parent=r;for(let[o,i]of e)this.set(o,i)}scheduler;parent;#e=new Map;#t;#n;has(e){return this.#o(e)!==void 0||this.parent?.has(e)===!0}get(e){let n=this.#o(e);return n===void 0?this.parent?.get(e):($!==void 0&&$.track(n),n.value)}set(e,n){let r=this.#r(n),o=this.#o(e);if(o===void 0){o={value:r,first:void 0,last:void 0},this.#e.set(e,o),this.#n=o;return}Object.is(o.value,r)||(o.value=r,W(o))}defineComputed(e,n){let r=this.#o(e);r===void 0&&(r={value:null,first:void 0,last:void 0},this.#e.set(e,r),this.#n=r);let o=new we(this.scheduler,()=>this.#r(n()),r);return r.computed=o,Object.hasOwn(this,"get")||(this.get=this.#i),o}fork(e=[]){return new t(e,this.scheduler,this)}#o(e){return e!==this.#t&&(this.#t=e,this.#n=this.#e.get(e)),this.#n}#i(e){let n=this.#o(e);return n===void 0?this.parent?.get(e):n.computed!==void 0?n.computed.get():($!==void 0&&$.track(n),n.value)}#r(e){if(e===null||typeof e!="object")return e;let n=We.get(e);if(n!==void 0)return n;let r=new Proxy(e,{get:(o,i,a)=>{if($!==void 0){let s=ge.get(o);s===void 0&&(s=new Map,ge.set(o,s));let c=s.get(i);c===void 0&&(c={first:void 0,last:void 0},s.set(i,c)),$.track(c)}return this.#r(Reflect.get(o,i,a))},set:(o,i,a,s)=>{let c=Reflect.get(o,i,s),l=this.#r(a),f=Reflect.set(o,i,l,s);return Object.is(c,l)||W(ge.get(o)?.get(i)),f},deleteProperty:(o,i)=>{let a=Reflect.has(o,i),s=Reflect.deleteProperty(o,i);return a&&W(ge.get(o)?.get(i)),s}});return We.set(e,r),We.set(r,r),r}};var Qn=/\/\*[\s\S]*?\*\/|"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|--[\w-]+\s*:[^;{}]*|:(user-invalid|invalid|valid)(?![\w-])/g;function Lt(t){return t.replace(Qn,(e,n)=>n===void 0?e:`:is(:${n}, [data-${n}])`)}var G="data-component",ke="data-slotted";function It(t,e,n){let r=new Set((t.getAttribute(e)??"").split(/\s+/).filter(Boolean));r.add(n),t.setAttribute(e,Array.from(r).join(" "))}function Ce(t){t.nodeType===1&&t.setAttribute(ke,"")}function Ze(t){return`data-${t}-state`}var Ot={slotted:"[--slotted]",state:"[--state]"},Yn=/\/\*[\s\S]*?\*\/|"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|:(slotted|host-state)\(/g;function Xn(t,e=["slotted","host-state"]){return t.replace(Yn,(n,r)=>r===void 0||!e.includes(r)?n:`:where(${r==="slotted"?Ot.slotted:Ot.state}):is(`)}function er(t){return/:where\(\s*\[--slotted\]\s*\)/.test(t)?"slotted":"own"}function tr(t,e){let n=0;for(let r=e;r<t.length;r+=1){let o=t[r];if(o==='"'||o==="'"){let i=t.indexOf(o,r+1);r=i===-1?t.length:i}else if(o==="(")n+=1;else if(o===")"&&--n===0)return r}return t.length}var nr=/\[\s*([\w-]+)\s*(?:=\s*(?:"((?:\\.|[^"\\])*)"|'((?:\\.|[^'\\])*)'|([^\]\s]+))\s*)?\]/g;function rr(t,e,n,r){let o="";for(let i of t.matchAll(nr)){let a=r(i[1]),s=i[2]??i[3]??i[4];n.add(a),o+=`[${Ze(e)}~="${s===void 0?a:`${a}=${encodeURIComponent(s)}`}"]`}return o}function or(t){let e="";for(let n=0;n<t.length;n+=1){let r=t[n];if(r==="["){let s=t.indexOf("]",n),c=s===-1?t.length:s+1;e+=t.slice(n,c),n=c-1;continue}let o=e.at(-1),a=o===void 0||/[\s>+~(,]/.test(o)?/^[a-z][a-z0-9]*(?:-[a-z0-9]+)+(?![\w-]|\()/.exec(t.slice(n))?.[0]:void 0;if(a!==void 0){e+=`:is(${a}, :where([${G}~="${a}"]))`,n+=a.length-1;continue}e+=r}return e}function ir(t,e,n,r,o=i=>i){/:scope(?![\w-])/.test(t)&&y("HY003",`\`:scope\` is not part of component styles; select the root with \`:host\` (in <${e}>).`);let i="",a=0,s=/:where\(\s*\[--state\]\s*\):is\(/g;for(let c=s.exec(t);c!==null;c=s.exec(t)){let l=c.index+c[0].length-1,f=tr(t,l);i+=`${t.slice(a,c.index)}${n}${rr(t.slice(l+1,f),e,r,o)}`,a=f+1,s.lastIndex=a}return i+=t.slice(a),i=i.replace(/:where\(\s*\[--slotted\]\s*\):is\(/g,`:where([${ke}], [${ke}] *):is(`).replace(/:host(?![\w-])/g,n),or(Lt(i))}function sr(t,e,n,r){let o=`[${G}~="${t}"]`;return[r,e.trim()===""?"":`@scope (${o}) to ([${G}], [${ke}]) {
|
|
1
|
+
var W=class extends Error{diagnostic;constructor(e){let n=e.source?`${e.source}: `:"";super(`${n}${e.code}: ${e.message}`),this.name="HtmlDiagnosticError",this.diagnostic=Object.freeze({...e})}};function y(t,e,n){throw new W(n===void 0?{code:t,message:e}:{code:t,message:e,source:n})}function dt([t],[e]){return t.localeCompare(e)}async function lt(t,e){let n=new Map,r=new Map,o=new Map,i=async c=>{let l=new URL(c.url).href,f=r.get(l)??l,d=n.get(f);if(d!==void 0)return d.url;let h;try{h=await e.fetchComponent(l)}catch(g){if(g instanceof W)throw g;y("HL009",`Component \`${l}\` failed to load: ${g instanceof Error?g.message:String(g)}.`,l)}let u=e.resolver.assertFinalURL(c,h.url,l);r.set(l,u);let p=n.get(u);if(p!==void 0)return p.url;let m=e.parseComponentResource(h.source,u),w=m.definition,C=o.get(w.contract.tag);C!==void 0&&C!==u&&y("HL007",`Both \`${C}\` and \`${u}\` declare <${w.contract.tag}>.`,u),o.set(w.contract.tag,u);let k={url:u,trustRoot:c.trustRoot,definition:w,dependencies:[],shadowedByCustomElement:e.isCustomElementRegistered?.(w.contract.tag)??!1,complete:!1};if(n.set(u,k),w.controller!==void 0){let g;try{g=e.resolver.resolveDependency(w.controller,u,c.trustRoot)}catch(b){throw b instanceof W&&b.diagnostic.code==="HL003"&&y("HL005",`Controller \`${w.controller}\` is outside the component's approved root.`,u),b}k.controller=Object.freeze({specifier:w.controller,url:g.url})}for(let g of m.dependencies){let b=e.resolver.resolveDependency(g,u,c.trustRoot),v=await i(b);k.dependencies.includes(v)||k.dependencies.push(v)}return k.complete=!0,u},a=[];for(let c of t)a.push(await i(e.resolver.resolveRoot(c)));let s=[];for(let[c,l]of Array.from(n).sort(dt))l.complete||y("HL008",`Component graph did not finish loading \`${c}\`.`),s.push([c,Object.freeze({url:c,trustRoot:l.trustRoot,definition:l.definition,dependencies:Object.freeze(Array.from(l.dependencies)),...l.controller===void 0?{}:{controller:l.controller},shadowedByCustomElement:l.shadowedByCustomElement})]);return Object.freeze({roots:Object.freeze(a),nodes:new Map(s),tags:new Map(Array.from(o).sort(dt))})}function J(t){if(typeof t!="object"||t===null||Object.isFrozen(t))return t;for(let e of Object.values(t))J(e);return Object.freeze(t)}function ut(t){let e="",n=!0;for(let r of t)r==="-"?n=!0:(e+=n?r.toUpperCase():r,n=!1);return e}function Re(t){return t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}var yn=new Set(["string","boolean","number","integer","null","absent","trusted-html","trusted-script","function","unknown"]),ce=class extends SyntaxError{constructor(n,r){super(`${n} at character ${r+1}.`);this.position=r;this.name="TypeSyntaxError"}position},Se=class{constructor(e){this.source=e}source;#e=0;parse(){let e=this.#t();return this.#d(),this.#e!==this.source.length&&this.#l("Unexpected type syntax"),e}#t(){let e=[this.#n()];for(;this.#s("|");)e.push(this.#n());return e.length===1?e[0]:Ne(e)}#n(){let e=this.#r();for(;this.#s("?");)e=Ne([e,{kind:"terminal",name:"null"},{kind:"terminal",name:"absent"}]);return e}#r(){if(this.#s("(")){let r=this.#t();return this.#a(")"),r}let e=this.#c();if(e!==void 0)return{kind:"keyword",value:e};let n=this.#o();if(n===void 0&&this.#l("Expected a type, keyword, or group"),n==="list"||n==="record"){this.#a("(");let r=this.#t();return this.#a(")"),n==="list"?{kind:"list",item:r}:{kind:"record",value:r}}return n==="object"?this.#i():yn.has(n)?{kind:"terminal",name:n}:{kind:"keyword",value:n}}#i(){this.#a("("),this.#a("{");let e=[],n=!1;for(;!this.#s("}");){if(this.#d(),this.source.startsWith("...",this.#e))this.#e+=3,n=!0;else{let r=this.#c()??this.#o();r===void 0&&this.#l("Expected an object field or `...`");let o=this.#s("?");this.#a(":");let i=this.#t();e.some(a=>a.name===r)&&this.#l(`Duplicate object field \`${r}\``),e.push({name:r,type:i,optional:o})}if(this.#s("}"))break;this.#a(","),n&&(this.#d(),this.source.startsWith("}",this.#e)||this.#l("The open marker must be last"))}return this.#a(")"),{kind:"object",fields:e,open:n}}#o(){this.#d();let e=/^[A-Za-z_][A-Za-z0-9_-]*/.exec(this.source.slice(this.#e));if(e!==null)return this.#e+=e[0].length,e[0]}#c(){this.#d();let e=this.source[this.#e];if(e!=='"'&&e!=="'")return;this.#e+=1;let n="";for(;this.#e<this.source.length;){let r=this.source[this.#e++];if(r===e)return n;if(r!=="\\"){n+=r;continue}this.#e>=this.source.length&&this.#l("Unterminated escape");let o=this.source[this.#e++];n+={n:`
|
|
2
|
+
`,r:"\r",t:" ","\\":"\\",'"':'"',"'":"'"}[o]??o}this.#l("Unterminated quoted keyword")}#s(e){return this.#d(),this.source.startsWith(e,this.#e)?(this.#e+=e.length,!0):!1}#a(e){this.#s(e)||this.#l(`Expected \`${e}\``)}#d(){for(;/\s/.test(this.source[this.#e]??"");)this.#e+=1}#l(e){throw new ce(e,this.#e)}};function Ne(t){let e=t.flatMap(o=>o.kind==="union"?o.members:[o]),n=new Map(e.map(o=>[q(o),o])),r=Array.from(n.values());return r.length===1?r[0]:{kind:"union",members:r}}function de(t){if(t.trim()==="")throw new ce("A type expression cannot be empty",0);return J(new Se(t).parse())}function $e(t){return typeof t=="object"&&t!==null&&"kind"in t&&["terminal","keyword","union","list","record","object"].includes(String(t.kind))}function le(t){return $e(t)?t:typeof t=="string"?{kind:"terminal",name:t}:Ne(t.enum.map(e=>({kind:"keyword",value:e})))}function q(t){let e=$e(t)?t:le(t);switch(e.kind){case"terminal":return e.name;case"keyword":return/^[A-Za-z_][A-Za-z0-9_-]*$/.test(e.value)?e.value:JSON.stringify(e.value);case"union":return e.members.map(n=>q(n)).join(" | ");case"list":return`list(${q(e.item)})`;case"record":return`record(${q(e.value)})`;case"object":return`object({ ${[...e.fields.map(n=>`${n.name}${n.optional?"?":""}: ${q(n.type)}`),...e.open?["..."]:[]].join(", ")} })`}}function L(t,e,n){return{ok:!1,issues:[{reason:t,message:e,path:n}]}}function Q(t,e){return typeof e=="number"?`${t}[${e}]`:/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(e)?`${t}.${e}`:`${t}[${JSON.stringify(e)}]`}function ft(t){if(typeof t!="object"||t===null||Array.isArray(t))return!1;let e=Object.getPrototypeOf(t);return e===Object.prototype||e===null}function Te(t){if(typeof t!="string")return t;try{return JSON.parse(t)}catch{return Symbol.for("html-next.bad-json")}}function gn(t,e){if(typeof t!="object"||t===null)return!1;if(t.kind===e&&"value"in t)return!0;let n=e==="trusted-html"?"TrustedHTML":"TrustedScript";return t.constructor?.name===n||Object.prototype.toString.call(t)===`[object ${n}]`}function bn(t,e,n){switch(e){case"string":return typeof t=="string"?{ok:!0,value:t}:L("typeMismatch","Must be a string.",n);case"boolean":return typeof t=="boolean"?{ok:!0,value:t}:t===""||t==="true"?{ok:!0,value:!0}:t==="false"?{ok:!0,value:!1}:L("typeMismatch","Must be true or false.",n);case"number":case"integer":{let r=typeof t=="number"?t:typeof t=="string"&&t.trim()!==""?Number(t):Number.NaN;return Number.isFinite(r)?e==="integer"&&!Number.isInteger(r)?L("typeMismatch","Must be an integer.",n):{ok:!0,value:r}:L("badInput",`Must be ${e==="integer"?"an integer":"a finite number"}.`,n)}case"null":return t===null?{ok:!0,value:null}:L("typeMismatch","Must be null.",n);case"absent":return t===void 0?{ok:!0,value:void 0}:L("typeMismatch","Must be absent.",n);case"trusted-html":case"trusted-script":return gn(t,e)?{ok:!0,value:t}:L("untrustedValue",`Must be a ${e==="trusted-html"?"TrustedHTML":"TrustedScript"} value.`,n);case"function":return typeof t=="function"?{ok:!0,value:t}:L("typeMismatch","Must be a function supplied through a property.",n);case"unknown":return{ok:!0,value:t}}}function Y(t,e,n){switch(e.kind){case"terminal":return bn(t,e.name,n);case"keyword":return t===e.value?{ok:!0,value:t}:L("typeMismatch",`Must be ${JSON.stringify(e.value)}.`,n);case"union":{for(let r of e.members){let o=Y(t,r,n);if(o.ok)return o}return L("typeMismatch",`Must match ${q(e)}.`,n)}case"list":{let r=Te(t);if(!Array.isArray(r))return L("typeMismatch","Must be a list.",n);let o=[],i=[];return r.forEach((a,s)=>{let c=Y(a,e.item,Q(n,s));c.ok?o.push(c.value):i.push(...c.issues)}),i.length===0?{ok:!0,value:o}:{ok:!1,issues:i}}case"record":{let r=Te(t);if(!ft(r))return L("typeMismatch","Must be a string-keyed record.",n);let o={},i=[];for(let[a,s]of Object.entries(r)){let c=Y(s,e.value,Q(n,a));c.ok?o[a]=c.value:i.push(...c.issues)}return i.length===0?{ok:!0,value:o}:{ok:!1,issues:i}}case"object":{let r=Te(t);if(!ft(r))return L("typeMismatch","Must be an object.",n);let o={},i=[],a=new Map(e.fields.map(s=>[s.name,s]));for(let s of e.fields){if(!(s.name in r)){s.optional||i.push({reason:"typeMismatch",message:"Required field is absent.",path:Q(n,s.name)});continue}let c=Y(r[s.name],s.type,Q(n,s.name));c.ok?o[s.name]=c.value:i.push(...c.issues)}for(let[s,c]of Object.entries(r))a.has(s)||(e.open?o[s]=c:i.push({reason:"typeMismatch",message:"Field is not declared by this closed object type.",path:Q(n,s)}));return i.length===0?{ok:!0,value:o}:{ok:!1,issues:i}}}}function _(t,e,n="$"){return Y(t,le(e),n)}function Ae(t,e){let n=_(t,e);if(!n.ok)throw new TypeError(n.issues.map(o=>`${o.path}: ${o.message}`).join("; "));let r=le(e);if(r.kind==="terminal"&&(r.name==="function"||r.name==="unknown"))throw new TypeError(`The ${r.name} type is property-only and cannot be serialized.`);return r.kind==="list"||r.kind==="record"||r.kind==="object"||r.kind==="union"&&typeof n.value=="object"&&n.value!==null?JSON.stringify(n.value):n.value===null?"null":n.value===void 0?"":String(n.value)}function B(t){let e=le(t);return e.kind==="terminal"?!["function","unknown","trusted-html","trusted-script"].includes(e.name):e.kind==="keyword"?!0:e.kind==="union"?e.members.every(B):e.kind==="list"?B(e.item):e.kind==="record"?B(e.value):e.fields.every(n=>B(n.type))}function He(t){let e;try{e=de(t)}catch(n){y("HC013",n instanceof Error?n.message:"Invalid prop type expression.")}return e.kind==="terminal"&&(e.name==="string"||e.name==="boolean"||e.name==="number")?e.name:e.kind==="keyword"?{enum:[e.value]}:e.kind==="union"&&e.members.every(n=>n.kind==="keyword")?{enum:e.members.map(n=>n.value)}:e}var E=Symbol("absent"),ee=class extends Error{constructor(n){super(`\`${n}\` is not declared in scope.`);this.identifier=n;this.name="UndeclaredName"}identifier},De=/\s*(?:(<=|>=|!=|\^=|\$=|\*=)|(\d+(?:\.\d*)?|\.\d+)|("(?:\\[\s\S]|[^"\\])*"|'(?:\\[\s\S]|[^'\\])*')|([A-Za-z_$][A-Za-z0-9_$]*)|([=<>+*/%(),.:{}[\]-])|$)/y,wn=/\\([\s\S])/g,vn=/%s/g,kn={or:1,and:2,"=":3,"!=":3,"^=":3,"$=":3,"*=":3,"<":4,"<=":4,">":4,">=":4,"+":5,"-":5,"*":6,"/":6,"%":6};function pt(t){return kn[t]??0}function Cn(t){return t==="round"||t==="clamp"||t==="min"||t==="max"||t==="abs"||t==="format"}function xn(t){let e=0,n=0,r="";function o(){De.lastIndex=e;let d=De.exec(t);if(d===null){let h=t.slice(e).trimStart()[0];throw h==='"'||h==="'"?new SyntaxError("Unterminated string literal."):new SyntaxError(`Unexpected character \`${h}\`.`)}e=De.lastIndex,d[1]!==void 0||d[5]!==void 0?(n=4,r=d[1]??d[5]):d[2]!==void 0?(n=1,r=Number(d[2])):d[3]!==void 0?(n=2,r=d[3].slice(1,-1).replace(wn,"$1")):d[4]!==void 0?(n=3,r=d[4]):(n=0,r="")}function i(d){return r!==d?!1:(o(),!0)}function a(d){if(!i(d))throw new SyntaxError(`Expected \`${d}\`.`)}function s(d){let h=c(),u=pt(r);for(;u>=d;){let p=r;o(),h={kind:"binary",op:p,left:h,right:s(u+1)},u=pt(r)}return h}function c(){if(n===3&&r==="not")return o(),{kind:"unary",op:"not",operand:c()};if(i("-"))return{kind:"unary",op:"-",operand:c()};let d=l();for(;n===4;)if(i(".")){if(n!==3)throw new SyntaxError("Expected a property name after `.`.");let h=r;o(),d={kind:"member",object:d,key:h}}else if(i("[")){let h=s(1);a("]"),d={kind:"index",object:d,index:h}}else break;return d}function l(){let d=n,h=r;if(d===1||d===2)return o(),{kind:"literal",value:h};if(d===4&&h==="("){o();let u=s(1);return a(")"),u}if(d===4&&h==="{"){o();let u=[];if(!i("}")){do{if(r==="}")break;if(n!==3&&n!==2)throw new SyntaxError("Object keys must be identifiers or strings.");let p=r;o(),a(":"),u.push({key:p,value:s(1)})}while(i(","));a("}")}return{kind:"object",pairs:u}}if(d===4&&h==="["){o();let u=[];if(!i("]")){do{if(r==="]")break;u.push(s(1))}while(i(","));a("]")}return{kind:"array",items:u}}if(d===3){let u=h;if(o(),u==="true")return{kind:"literal",value:!0};if(u==="false")return{kind:"literal",value:!1};if(u==="null")return{kind:"literal",value:null};if(r==="("&&Cn(u)){o();let p=[];if(!i(")")){do p.push(s(1));while(i(","));a(")")}return{kind:"call",fn:u,args:p}}return{kind:"id",name:u}}throw new SyntaxError("Unexpected end of expression.")}o();let f=s(1);if(n!==0)throw new SyntaxError("Unexpected trailing input in expression.");return f}function X(t){return t===E||t===null}function j(t){if(t===E||t===null||t===!1)return!1;if(t===!0)return!0;if(typeof t=="string")return t.length>0;if(typeof t=="number")return t!==0&&t===t;if(Array.isArray(t))return t.length>0;for(let e in t)if(Object.hasOwn(t,e))return!0;return!1}function ue(t){return typeof t=="number"&&t===t?t:E}function H(t,e){switch(t.kind){case"literal":return t.value;case"id":{let n=e.get(t.name);if(n===void 0)throw new ee(t.name);return n}case"member":{let n=H(t.object,e);if(X(n)||typeof n!="object"||Array.isArray(n))return E;let r=n[t.key];return r===void 0?E:r}case"index":{let n=H(t.object,e),r=H(t.index,e);if(X(n)||X(r))return E;if(Array.isArray(n)&&typeof r=="number"){let o=n[r];return o===void 0?E:o}if(typeof n=="object"&&typeof r=="string"){let o=n[r];return o===void 0?E:o}return E}case"unary":{let n=H(t.operand,e);if(t.op==="not")return!j(n);let r=ue(n);return r===E?E:-r}case"binary":return En(t,e);case"call":return Rn(t,e);case"object":{let n={};for(let r of t.pairs)n[r.key]=H(r.value,e);return n}case"array":{let n=[];for(let r of t.items)n.push(H(r,e));return n}}}function En(t,e){let{op:n}=t;if(n==="and")return j(H(t.left,e))&&j(H(t.right,e));if(n==="or")return j(H(t.left,e))||j(H(t.right,e));let r=H(t.left,e),o=H(t.right,e);if(n==="=")return r===o;if(n==="!=")return r!==o;if(n==="^="||n==="$="||n==="*=")return typeof r!="string"||typeof o!="string"?E:n==="^="?r.startsWith(o):n==="$="?r.endsWith(o):r.includes(o);let i=ue(r),a=ue(o);if(i===E||a===E)return E;switch(n){case"<":return i<a;case"<=":return i<=a;case">":return i>a;case">=":return i>=a;case"+":return i+a;case"-":return i-a;case"*":return i*a;case"/":return i/a;case"%":return i%a;default:return E}}function Rn(t,e){let{args:n,fn:r}=t,o=[];for(let a of n)o.push(H(a,e));if(r==="format"){let a=o[0];if(typeof a!="string")return E;let s=1;return a.replace(vn,()=>s<o.length?P(o[s++]):"%s")}for(let a=0;a<o.length;a+=1){let s=ue(o[a]);if(s===E)return E;o[a]=s}let i=o;switch(r){case"abs":return i.length===1?Math.abs(i[0]):E;case"round":return i.length===1?Math.round(i[0]):E;case"min":return i.length>0?Math.min(...i):E;case"max":return i.length>0?Math.max(...i):E;case"clamp":return i.length===3?Math.min(Math.max(i[0],i[1]),i[2]):E;default:return E}}var mt=new Map;function Me(t){if(t.kind==="id")return t.name;if(t.kind==="member"){let e=Me(t.object);return e===void 0?void 0:`${e}.${t.key}`}if(t.kind==="index"&&t.index.kind==="literal"){let e=t.index.value;if(typeof e!="string"&&typeof e!="number")return;let n=Me(t.object);return n===void 0?void 0:`${n}.${e}`}}function O(t,e){let n=Me(t);if(n!==void 0){e.includes(n)||e.push(n);return}switch(t.kind){case"literal":return;case"id":return;case"member":O(t.object,e);return;case"index":O(t.object,e),O(t.index,e);return;case"unary":O(t.operand,e);return;case"binary":O(t.left,e),O(t.right,e);return;case"call":for(let r of t.args)O(r,e);return;case"object":for(let r of t.pairs)O(r.value,e);return;case"array":for(let r of t.items)O(r,e)}}function Pe(t,e){if(t.kind==="id")return e.push(t.name),!0;if(t.kind==="member")return Pe(t.object,e)?(e.push(t.key),!0):!1;if(t.kind!=="index"||!Pe(t.object,e))return!1;let n=t.index,r=n.kind==="literal"?n.value:void 0;return e.push(typeof r=="string"||typeof r=="number"?r:{kind:"index",expression:n}),!0}function fe(t){let e=mt.get(t);if(e!==void 0)return e;let n=xn(t),r=[];return O(n,r),r.sort(),e={source:t,ast:n,dependencies:r},mt.set(t,e),e}function Le(t,e){let n=[];if(!(!Pe(fe(t).ast,n)||!e.has(n[0])))return n}function ht(t,e){return H(fe(t).ast,e)}function I(t,e){return H("ast"in t?t.ast:t,e)}function P(t){return X(t)?"":Array.isArray(t)?t.map(P).join(" "):typeof t=="object"?"":String(t)}function Tn(t){return t.startsWith("aria-")||t==="contenteditable"||t==="draggable"||t==="spellcheck"}function yt(t,e=""){return typeof t=="boolean"&&Tn(e)?String(t):X(t)||t===!1?null:t===!0?"":typeof t=="number"||typeof t=="string"?String(t):Array.isArray(t)?t.map(P).join(" "):null}var Sn=new Set(["href","src","action","formaction","poster","data","xlink:href"]),Nn=new Set(["base","embed","iframe","link","meta","object","script","style","template"]),$n=new Set(["srcdoc","style"]);function te(t){let e=t.replace(/[\u0000-\u0020\u007f]+/g,"");return/^(?:data|javascript|vbscript):/i.test(e)}function ne(t){return Sn.has(t.toLowerCase())}function je(t,e,n){let r=e.createElement("template");r.innerHTML=t;for(let o of Array.from(r.content.querySelectorAll("*"))){if(n?.(o),Nn.has(o.localName)){o.remove();continue}for(let i of Array.from(o.attributes)){let a=i.name.toLowerCase();(a.startsWith("on")||$n.has(a)||ne(a)&&te(i.value))&&o.removeAttribute(i.name)}}return r.content}var An=/^(?:if|else-if|else|for|with|value|state|computed|data)$/,Hn=/^(?:@|v-|#|on:|use:|transition:|animate:)/,Dn=/^(?:innerhtml|outerhtml|srcdoc)$/,Mn=/^(?:base|embed|link|meta|object|script|style)$/;function gt(t){return An.test(t)}function Oe(t,e){return Mn.test(t.toLowerCase())&&y("HT009",`<${t}> is not permitted in rendered component markup.`,e),t}function Ie(t,e,n=""){let r=t.toLowerCase();return(r.startsWith("on")||Hn.test(r))&&y("HT010",`Literal attribute \`${t}\` uses target-framework directive syntax that is not supported.`,e),r==="srcdoc"&&y("HT007","Literal `srcdoc` is not permitted in a component definition.",e),ne(r)&&te(n)&&y("HT007",`Literal \`${t}\` contains an executable URL.`,e),t}function bt(t,e){let n=t.toLowerCase();return(n.startsWith("on")||Dn.test(n))&&y("HT007",`Dynamic ${t} requires a future trusted-content type.`,e),t}function z(t){return"tagName"in t}function re(t){return t.nodeName==="#text"}function N(t){return"localName"in t?t.localName:t.tagName}function pe(t){return"attrs"in t?t.attrs:t.attributes}function V(t){return(N(t)==="template"?t.content:void 0)?.childNodes??t.childNodes}function oe(t){return"value"in t?t.value:"nodeValue"in t?t.nodeValue??"":""}function kt(t){let e=[];for(let n of t)n.nodeName!=="#comment"&&(!re(n)||oe(n).trim()!=="")&&e.push(n);return e}function x(t,e){return"attrs"in t?t.attrs.find(n=>n.name===e)?.value:t.getAttribute(e)??void 0}function Ct(t){let e="";for(let n of V(t))re(n)&&(e+=oe(n));return e}function xt(t,e){let n=[];for(let r of V(t))z(r)&&N(r)===e&&n.push(r);return n}function Et(t,e){for(let n of V(t)){if(!z(n))continue;let r=N(n);r==="link"&&y("HL001","External definition dependencies require the application-owned graph resolver.",e),Oe(r,e);for(let o of pe(n))/^on(?!:)/i.test(o.name)&&Ie(o.name,e,o.value);Et(n,e)}}var Pn=/^\$(?:if|each|where|sort|limit|key|with|match|when|else)$/,wt=/^(?:innerhtml|outerhtml|textcontent|innertext|srcdoc)$/,Ln=/^\s*([A-Za-z_$][\w$]*)\s*(?:,\s*([A-Za-z_$][\w$]*)\s*)?\bof\b\s*(.+)$/,vt=/^\s*(.+?)\s+\bas\b\s+([A-Za-z_$][\w$]*)\s*$/,ze=/^[a-z][a-z0-9-]*$/,jn=/^(?:prevent|stop|self|once|passive|capture|left|middle|right|ctrl|shift|alt|meta|exact|enter|escape|space|tab|up|down)$/,qe=/^[A-Za-z_$][A-Za-z0-9_$-]*$/;function Ve(t,...e){let n=new Set(t.roots);for(let r of e)r!==void 0&&n.add(r);return{roots:n,writableRoots:t.writableRoots,handlers:t.handlers}}function S(t,e,n){let r=Un(t,n);return On(r,e,n),r}function On(t,e,n){for(let r of t.dependencies){let o=r.split(".",1)[0];e.roots.has(o)||y("HT003",`Expression root \`${o}\` is not declared in this scope.`,n)}}function In(t,e,n){let r=Object.create(null),o=(a,s)=>{r[a]??=s},i=a=>{for(let s of pe(a))if(s.name.startsWith(":"))/^[A-Za-z][A-Za-z0-9_-]*$/.test(s.value)&&o(s.value,{attribute:s.name.slice(1).toLowerCase()});else if(s.name.startsWith(".")){let c=s.name.slice(1).toLowerCase();if(/^[A-Za-z][A-Za-z0-9_-]*$/.test(s.value)){let l=n.resolveDomProperty(N(a),c)??(s.value.toLowerCase()===c?s.value:c);o(s.value,{property:l})}}for(let s of V(a))z(s)&&N(s)!=="slot"&&i(s)};return i(t),r}function zn(t,e,n,r=!0){let o=Object.create(null),i=Object.create(null);if(t===void 0)return o;let a=xt(t,"prop");a.sort((s,c)=>{let l=x(s,"name")??"",f=x(c,"name")??"";return l<f?-1:l>f?1:0});for(let s of a){let c=x(s,"name");(c===void 0||c==="")&&y("HC010","A <prop> requires a `name` attribute.",n),/^[A-Za-z][A-Za-z0-9_-]*$/.test(c)||y("HC010",`Invalid prop name \`${c}\`.`,n);let l=x(s,"type");(l===void 0||l==="")&&y("HC013",`Prop \`${c}\` requires a \`type\` attribute.`,n);let f=c.toLowerCase(),d=i[f];d!==void 0&&y("HC011",`Props \`${d}\` and \`${c}\` collide after lowercase normalization.`,n),i[f]=c;let h=e[c];h===void 0&&r&&y("HC018",`Prop \`${c}\` is declared but never bound in the markup.`,n),h??={attribute:c.toLowerCase()};let u=He(l),p=x(s,"required")!==void 0,m=Ct(s).trim();m===""&&y("HC003",`\`props.${c}.description\` must be a non-empty string.`,n),B(u)||y("HC017",`Prop \`${c}\` cannot be written as an HTML attribute; function, unknown, and trusted content types have no text form.`,n);let w=x(s,"default");p&&w!==void 0&&y("HC019",`Required prop \`${c}\` cannot also declare a default.`,n);let C={type:u,required:p,target:h,description:m};if(w!==void 0){let k=_(w,u);k.ok||y("HC015",`Default for prop \`${c}\` does not satisfy its type.`,n),C.default=k.value}o[c]=C}return o}function Vn(t,e,n,r,o,i,a){let s=x(t,"component")??"";s.trim()===""&&y("HC003","`component` must be a non-empty string.",i),/^[a-z][a-z0-9]*(?:-[a-z0-9]+)+$/.test(s)||y("HC005","The `component` tag must be lowercase and contain a hyphen.",i);let c=x(t,"status");c!==void 0&&!/^(?:early|experimental|stable|deprecated)$/.test(c)&&y("HC007","Component `status` is not recognized.",i);let l=x(t,"summary");return l!==void 0&&l.trim()===""&&y("HC003","`summary` must be a non-empty string.",i),(!/^[a-z][a-z0-9-]*$/.test(n)||r&&!/^[a-z][a-z0-9]*(?:-[a-z0-9]+)+$/.test(n))&&y("HC008","`nativeElement` must be a lowercase HTML element or component tag.",i),{version:1,name:ut(s),tag:s,...c===void 0?{}:{status:c},...l===void 0?{}:{summary:l},nativeElement:n,props:zn(e,o,i,a)}}function Un(t,e){try{return fe(t)}catch{y("HT013",`Malformed expression \`${t}\`.`,e)}}function qn(t,e,n){let r=[];for(let o of kt(V(t))){z(o)||y("HC023","Handler bodies contain declarative step elements only.",n);let i=x(o,"$if"),a=i===void 0?void 0:S(i,e,n);if(N(o)==="set"){let s=x(o,"name")??"",c=x(o,":value"),l=x(o,"value");(s===""||c===void 0==(l===void 0))&&y("HC023","A <set> requires `name` and exactly one of `value` or `:value`.",n),S(s,e,n);let f=Le(s,e.writableRoots);f===void 0&&y("HT005",`Handler write \`${s}\` is not rooted in declared state.`,n);let d={kind:"set",path:s,writablePath:f,value:S(c??JSON.stringify(l),e,n)};a!==void 0&&(d.guard=a),r.push(d);continue}if(N(o)==="dispatch"){let s=x(o,"event")??"";ze.test(s)||y("HC023","A <dispatch> requires a valid `event` name.",n);let c=x(o,":value"),l=x(o,"value");c!==void 0&&l!==void 0&&y("HC023","A <dispatch> may declare only one of `value` or `:value`.",n);let f=c===void 0&&l===void 0?void 0:S(c??JSON.stringify(l),e,n),d={kind:"dispatch",event:s};f!==void 0&&(d.value=f),a!==void 0&&(d.guard=a),r.push(d);continue}if(N(o)==="validate"||N(o)==="focus"){let s=x(o,"target")??x(o,"ref")??x(o,"name")??"";qe.test(s)||y("HC023",`<${N(o)}> requires a valid target reference.`,n);let c={kind:N(o),target:s};a!==void 0&&(c.guard=a),r.push(c);continue}y("HC023",`<${N(o)}> is not a recognized handler step.`,n)}return r}function Bn(t,e,n){let r=[],o=new Set(Object.keys(e.props)),i=new Set,a=new Set;if(t===void 0)return{declarations:r,scope:{roots:o,writableRoots:i,handlers:a}};let s=[],c=new Set,l=new Set;for(let d of V(t)){if(!z(d))continue;let h=d;s.push(h);let u=N(h);/^(?:prop|state|computed|data|handler|event|method)$/.test(u)||y("HC021",`<${u}> is not a recognized definition declaration.`,n);let p=x(h,"name")??"";if(p===""&&y("HC010",`A <${u}> requires a \`name\` attribute.`,n),u==="event"){l.has(p)&&y("HC020",`Event \`${p}\` is declared more than once.`,n),l.add(p);continue}c.has(p)&&y("HC020",`Declaration \`${p}\` collides in the flat component scope.`,n),c.add(p),o.add(p),u==="state"?i.add(p):u==="handler"&&a.add(p)}let f={roots:o,writableRoots:i,handlers:a};for(let d of s){let h=N(d);if(h==="prop")continue;let u=x(d,"name");if(h==="state"){let p=x(d,":value"),m=x(d,"value");p!==void 0&&m!==void 0&&y("HC013",`<state name="${u}"> may declare only one of \`value\` or \`:value\`.`,n);let w=p===void 0&&m===void 0?void 0:S(p??JSON.stringify(m),f,n),C={kind:h,name:u},k=x(d,"type");k!==void 0&&(He(k),C.type=k),m!==void 0&&(C.value=m),w!==void 0&&(C.expression=w),r.push(C);continue}if(h==="computed"){let p=x(d,"from");(p===void 0||p==="")&&y("HC013",`<computed name="${u}"> requires a \`from\` expression.`,n),r.push({kind:h,name:u,expression:S(p,f,n)});continue}if(h==="data"){let p=x(d,"src"),m=x(d,"type"),w=x(d,"debounce"),C=x(d,"poll"),k=[],g=new Set;for(let v of xt(d,"param")){let R=x(v,"name")??"",T=x(v,":value");(!qe.test(R)||T===void 0)&&y("HC024","A data <param> requires a valid `name` and a `:value` expression.",n),g.has(R)&&y("HC024",`Data source \`${u}\` repeats a parameter name.`,n),g.add(R),k.push({name:R,expression:S(T,f,n)})}let b={kind:h,name:u,parameters:k};p!==void 0&&(b.source=p),m!==void 0&&(b.type=m),w!==void 0&&(b.debounce=w),C!==void 0&&(b.poll=C),r.push(b);continue}if(h==="event"){r.push({kind:h,name:u,type:x(d,"type")??"object",bubbles:x(d,"bubbles")!=="false",composed:x(d,"composed")!=="false",cancelable:x(d,"cancelable")==="true"});continue}if(h==="method"){r.push({kind:h,name:u,exportName:x(d,"export")??u,returns:x(d,"returns")??"undefined"});continue}r.push({kind:"handler",name:u,steps:qn(d,f,n)})}for(let d of r)if(d.kind==="handler")for(let h of d.steps)h.kind==="dispatch"&&!l.has(h.event)&&y("HC023",`Handler \`${d.name}\` dispatches undeclared component event \`${h.event}\`.`,n);return{declarations:r,scope:f}}function _n(t,e,n,r,o,i){let a=[];for(let s of t){if(s.name.startsWith("bind:")){let c=s.name.slice(5).toLowerCase();(c===""||wt.test(c))&&y("HT007",`Two-way binding cannot target \`${c||s.name}\`.`,o);let l=S(s.value,r,o),f=Le(s.value,r.writableRoots);f===void 0&&y("HT005",`\`${s.value}\` is not a writable state-rooted path.`,o),a.push({kind:"attribute",name:c,expression:s.value,expressionPlan:l,twoWay:!0,writablePath:f});continue}if(s.name.startsWith("class:")||s.name.startsWith("style:")){let c=s.name.startsWith("class:")?"class":"style",l=s.name.slice(c.length+1);(c==="class"?l!==""&&!/\s/.test(l):/^(?:--[a-z0-9_-]+|[a-z][a-z0-9-]*)$/.test(l))||y("HT020",`\`${s.name}\` does not name a valid ${c} binding target.`,o),a.push({kind:"attribute",name:l,expression:s.value,expressionPlan:S(s.value,r,o),target:c});continue}if(s.name.startsWith("$")){let c=s.name.slice(1).toLowerCase();c!=="value"&&c!=="html"&&y("HT012",`\`$${c}\` is not a known content directive.`,o),a.push({kind:"directive",name:c,expression:s.value,expressionPlan:S(s.value,r,o)});continue}if(s.name.startsWith(":")){let c=s.name.slice(1).toLowerCase();wt.test(c)&&y("HT007",`\`:${c}\` cannot bind a raw content sink.`,o);let l=S(s.value,r,o);a.push({kind:"attribute",name:c,expression:s.value,expressionPlan:l});continue}if(s.name.startsWith(".")){let c=s.name.slice(1).toLowerCase(),l=S(s.value,r,o),f=i.resolveDomProperty(e,c);f===void 0&&y("HP001",`\`${c}\` is not a native property of <${e}>.`,o),bt(f,o),a.push({kind:"property",key:c,name:f,expression:s.value,expressionPlan:l});continue}Ie(s.name,o,s.value),a.push({kind:"literal",name:s.name,value:s.value})}return a}function Wn(t,e,n){if(t===void 0)return;let r=[];for(let o of t){let[i="",...a]=o.name.slice(3).split(".");(!ze.test(i)||a.some(s=>!ze.test(s)))&&y("HT010",`\`${o.name}\` is not a valid declarative event binding.`,n);for(let s=0;s<a.length;s+=1){let c=a[s];a.indexOf(c)!==s&&y("HT010",`\`${o.name}\` repeats an event modifier.`,n),jn.test(c)||y("HT010",`\`${o.name}\` contains an unsupported event modifier.`,n)}a.includes("passive")&&a.includes("prevent")&&y("HT010",`\`${o.name}\` cannot combine passive and prevent.`,n),e.handlers.has(o.value)||y("HT010",`Event binding \`${o.name}\` names undeclared handler \`${o.value}\`.`,n),r.push({name:i,handler:o.value,modifiers:a})}return r}function Fn(t,e,n){if(t!==void 0)return qe.test(t)||y("HT019","`$ref` requires a valid non-empty name.",n),e.has(t)&&y("HT019",`Reference \`${t}\` is duplicated.`,n),e.add(t),t}function Gn(t,e,n){if(t===void 0)return;let r=[],o=[];t.$if!==void 0&&r.push("$if"),t.$each!==void 0&&r.push("$each"),t.$with!==void 0&&r.push("$with"),t.$match!==void 0&&r.push("$match"),t.$when!==void 0&&r.push("$when"),t.$else!==void 0&&r.push("$else"),t.$where!==void 0&&o.push("$where"),t.$sort!==void 0&&o.push("$sort"),t.$limit!==void 0&&o.push("$limit"),t.$key!==void 0&&o.push("$key"),r.length>1&&y("HT014",`An element carries one structural directive; found ${r.join(", ")}.`,n);let i=t.$each;i===void 0&&o.length>0&&y("HT014",`${o.join(", ")} may only modify \`$each\`.`,n);let a=t.$if;if(a!==void 0){let f=a;return{kind:"if",test:f,testPlan:S(f,e,n)}}let s=t.$with;if(s!==void 0){let f=vt.exec(s);return f===null&&y("HT015","`$with` must be written `expr as name`.",n),{kind:"with",expr:f[1],expressionPlan:S(f[1],e,n),alias:f[2]}}if(i!==void 0){let f=Ln.exec(i);f===null&&y("HT016","`$each` must be written `item of items` (optionally `item, i of items`).",n);let d=f[1],h=f[2];(e.roots.has(d)||h!==void 0&&e.roots.has(h))&&y("HC020","Loop locals may not collide with an existing scope name.",n);let u=Ve(e,d,h,"loop"),p={kind:"each",item:d,list:f[3],listPlan:S(f[3],e,n)};h!==void 0&&(p.index=h);let m=t.$where;m!==void 0&&(p.where=m,p.wherePlan=S(m,u,n)),t.$sort!==void 0&&(p.sort=t.$sort);let w=t.$limit;w!==void 0&&(p.limit=w,p.limitPlan=S(w,u,n));let C=t.$key;return C!==void 0&&(p.key=C,p.keyPlan=S(C,u,n)),p}let c=t.$match;if(c!==void 0){let f=c.trim();if(f==="")return{kind:"match"};let d=vt.exec(f);return d===null&&y("HT017","`$match` scope must be written `expr as name`.",n),{kind:"match",expr:d[1],expressionPlan:S(d[1],e,n),alias:d[2]}}let l=t.$when;if(l!==void 0){let f=l;return{kind:"when",test:f,testPlan:S(f,e,n)}}if(t.$else!==void 0)return{kind:"else"}}function Ue(t,e,n,r,o,i){let a=N(t);gt(a)&&y("HT009",`<${a}> is reserved but not supported by this profile.`,r),Oe(a,r);let s,c=[],l,f;for(let g of pe(t))Pn.test(g.name)?(s??={})[g.name]=g.value:g.name==="$ref"?f=g.value:g.name.startsWith("on:")?(l??=[]).push(g):g.name!=="as"&&c.push(g);let d=Gn(s,n,r),h=d?.kind==="each"?Ve(n,d.item,d.index,"loop"):d?.kind==="with"||d?.kind==="match"&&d.alias!==void 0?Ve(n,d.alias):n,u=_n(c,a,e,h,r,i),p=Wn(l,h,r),m=Fn(f,o.refs,r),w=[],C=V(t);for(let g of C)if(g.nodeName!=="#comment"){if(re(g)){let b=oe(g);b.trim()!==""&&w.push({kind:"text",value:b});continue}if(z(g)){if(N(g)==="slot"){let b=x(g,"name"),v=x(g,":name");b!==void 0&&v!==void 0&&y("HT008","A slot cannot declare both `name` and `:name`.",r);for(let M of pe(g))M.name!=="name"&&M.name!==":name"&&y("HT008","A slot has an unsupported attribute.",r);b===void 0&&v===void 0&&(o.defaults+=1,o.defaults>1&&y("HT008","A component may declare one default slot.",r)),b!==void 0&&((b===""||o.names.has(b))&&y("HT008",`Slot name \`${b}\` is empty or duplicated.`,r),o.names.add(b));let R=[];for(let M of V(g))if(M.nodeName!=="#comment")if(re(M)){let ae=oe(M);ae.trim()!==""&&R.push({kind:"text",value:ae})}else z(M)&&R.push(Ue(M,e,h,r,o,i));let A={dynamic:v!==void 0,required:R.length===0};if(b!==void 0&&(A.name=b),o.contracts.push(A),b===void 0&&v===void 0&&R.length===0)w.push({kind:"slot"});else{let M={kind:"slot",fallback:R};b!==void 0&&(M.name=b),v!==void 0&&(M.nameExpression=S(v,h,r)),w.push(M)}continue}w.push(Ue(g,e,h,r,o,i))}}if(u.some(g=>g.kind==="directive")&&w.length>0&&y("HT006","A content directive cannot coexist with children.",r),u.some(g=>g.kind==="property"&&g.name==="textContent")&&w.length>0&&y("HT006","A content-replacing property binding cannot coexist with children.",r),d?.kind==="match"){let g=0;for(let v of w)v.kind==="element"&&(g+=1);let b=!1;for(let v of w)v.kind==="element"&&(g-=1,v.flow?.kind==="when"?b&&y("HT018","A `$when` arm may not follow `$else`.",r):v.flow?.kind==="else"?(b&&y("HT018","A `$match` has at most one `$else`.",r),b=!0,g!==0&&y("HT018","`$else` must be the last arm.",r)):y("HT018","Every direct child of a `$match` must be a `$when` or `$else` arm.",r))}let k={kind:"element",name:a,attributes:u,children:w};return d!==void 0&&(k.flow=d),p!==void 0&&(k.events=p),m!==void 0&&(k.ref=m),k}function Rt(t,e,n){let r=kt(t);(r.length!==1||!z(r[0])||N(r[0])!=="template"||x(r[0],"component")===void 0)&&y("HS001","A source must contain exactly one top-level <template component>.",e);let o=r[0],i,a=!1,s,c;for(let b of V(o)){if(b.nodeName==="#comment"||re(b)&&oe(b).trim()==="")continue;z(b)||y("HT001","A component's markup must be exactly one element root.",e);let v=N(b);v==="props"||v==="defs"?(i!==void 0&&y("HS002","A component has one optional declaration group, one markup root, and one optional <style>.",e),i=b,a=v==="props",Et(b,e)):v==="style"?(s!==void 0&&y("HS002","A component has one optional declaration group, one markup root, and one optional <style>.",e),s=b):c===void 0?c=b:y("HT001","A component's markup must be exactly one element root.",e)}c===void 0&&y("HT001","A component's markup must be exactly one element root.",e);let l=N(c),f=(x(c,"as")??l).split("|");for(let b=f.length-1;b>=0;b-=1)f[b]=f[b].trim(),f[b]===""&&f.splice(b,1);let d=!n.isNativeElement(l);d&&x(c,"as")!==void 0&&y("HT021","A delegated component root cannot also declare native `as` choices.",e),!d&&(f.length===0||!f.includes(l)||f.some((b,v)=>f.indexOf(b)!==v)||f.some(b=>!n.isNativeElement(b)))&&y("HT021","A polymorphic root must list unique native choices including its markup root.",e);let h=In(c,e,n),u=Vn(o,i,l,d,h,e,a),{declarations:p,scope:m}=Bn(a?void 0:i,u,e),w={defaults:0,names:new Set,contracts:[],refs:new Set},C=Ue(c,u,m,e,w,n),k=x(o,"controller");k===""&&y("HC022","A controller specifier cannot be empty.",e);let g={source:{file:e},contract:u,template:C,css:s===void 0?"":Ct(s).trim(),declarations:p,slots:w.contracts,root:d?{kind:"component",tag:l}:{kind:"native",element:l,choices:f}};return k!==void 0&&(g.controller=k),J(g)}var Tt=new WeakMap;function Zn(t){let e={},n={},r=o=>{if(o.includes("-"))return!1;if(Object.hasOwn(e,o))return e[o];let i=t.createElement(o),a=t.defaultView?.HTMLUnknownElement,s=a===void 0?i.constructor.name!=="HTMLUnknownElement":!(i instanceof a);return e[o]=s,s};return{isNativeElement:r,resolveDomProperty(o,i){if(!r(o))return;let a=`${o}:${i}`;if(a in n)return n[a]||void 0;let s=t.createElement(o),c=i.toLowerCase();for(;s!==null;){for(let l of Object.getOwnPropertyNames(s))if(l.toLowerCase()===c)return n[a]=l,l;s=Object.getPrototypeOf(s)}n[a]=""}}}function Be(t,e=t.ownerDocument.URL){(t.localName!=="template"||!t.hasAttribute("component"))&&y("HS001","A browser component carrier must be a <template component>.",e);let n=t.ownerDocument,r=Tt.get(n);return r===void 0&&(r=Zn(n),Tt.set(n,r)),Rt([t],e,r)}function St(t,e,n){let r=n.createElement("template");r.innerHTML=t;let o;for(let a of r.content.childNodes)a.nodeType===1&&a.localName==="template"&&a.hasAttribute("component")&&(o!==void 0&&y("HS001","A component resource must contain exactly one <template component>.",e),o=a);o===void 0&&y("HS001","A component resource must contain exactly one <template component>.",e);let i=[];for(let a of r.content.childNodes){if(a===o||a.nodeType===8||a.nodeType===3&&(a.nodeValue??"").trim()==="")continue;(a.nodeType!==1||a.localName!=="link"||a.getAttribute("rel")!=="component")&&y("HT009","A component resource may contain only dependency links and one inert carrier.",e);let s=a.getAttribute("href");(s===null||s.trim()==="")&&y("HL006","A component dependency link requires a non-empty `href`.",e),i.push(s)}return{definition:Be(o,e),dependencies:i}}var me=class{#e=new Map;#t=new Map;define(e,n){this.#e.has(e)&&y("HR001",`More than one definition declares <${e}>.`),this.#e.set(e,Object.freeze(n));for(let r of this.#t.get(e)??[])r();this.#t.delete(e)}get(e){return this.#e.get(e)}whenDefined(e){return this.#e.has(e)?Promise.resolve():new Promise(n=>{let r=this.#t.get(e)??[];r.push(n),this.#t.set(e,r)})}addGraph(e,n){for(let r of e.nodes.values())r.shadowedByCustomElement||this.define(r.definition.contract.tag,{node:r,...r.controller===void 0||n===void 0?{}:{loadController:()=>n(r)}})}};var Nt=/^(?:[A-Za-z][A-Za-z\d+.-]*:|\/|\.\.?\/)/;function $t(t){return new URL("./",t).href}function Kn(t){let e=new URL(t);return e.origin==="null"?$t(t):new URL("/",e).href}function Jn(t,e){return t.endsWith("/")?e:$t(e)}function _e(t,e){return t===e||t.startsWith(e.endsWith("/")?e:`${e}/`)}var he=class{#e;#t;#n;#r;constructor(e={},n="file:///",r=n){let o=new URL(n),i=new URL(r);this.#e=o.href,this.#t=i.origin,this.#n=Kn(i.href),this.#r=new Map(Object.entries(e.imports??{}).map(([a,s])=>[a,new URL(s,this.#e).href]))}resolveRoot(e){if(Nt.test(e)){let n=new URL(e,this.#e);return n.origin!==this.#t&&y("HL010",`Cross-origin component root \`${n.href}\` requires an application-owned import-map entry.`,this.#e),Object.freeze({url:n.href,trustRoot:this.#n})}return this.#i(e)}resolveDependency(e,n,r){if(!Nt.test(e))return this.#i(e);let o=new URL(e,n).href;return _e(o,r)||y("HL003",`Dependency \`${e}\` escapes approved root \`${r}\`.`,n),Object.freeze({url:o,trustRoot:r})}assertFinalURL(e,n,r=e.url){let o=new URL(n,e.url).href;return _e(o,e.trustRoot)||y("HL004",`Final component URL \`${o}\` escapes approved root \`${e.trustRoot}\`.`,r),o}#i(e){let n=this.#r.get(e);if(n!==void 0)return Object.freeze({url:n,trustRoot:Jn(e,n),mapping:e});let r=Array.from(this.#r.keys()).filter(a=>a.endsWith("/")&&e.startsWith(a)).sort((a,s)=>s.length-a.length)[0];r===void 0&&y("HL002",`Bare resource specifier \`${e}\` is not mapped by the application.`);let o=this.#r.get(r),i=new URL(e.slice(r.length),o).href;return _e(i,o)||y("HL003",`Mapped resource \`${e}\` escapes approved root \`${o}\`.`),Object.freeze({url:i,trustRoot:o,mapping:r})}};var At=new Map;function We(t,e=n=>import(n)){let n=t.controller;if(n===void 0)return Promise.reject(new TypeError(`<${t.definition.contract.tag}> does not declare a controller.`));let r=At.get(n.url);return r===void 0&&(r=e(n.url).then(o=>{let i=o?.default;return typeof i!="function"&&y("HJ002",`Controller module \`${n.url}\` must default-export a function.`,t.url),Object.freeze({...o,default:i})}).catch(o=>{if(o instanceof Error&&"diagnostic"in o)throw o;y("HJ001",`Controller module \`${n.url}\` failed to load: ${o instanceof Error?o.message:String(o)}.`,t.url)}),At.set(n.url,r)),r}async function Ht(t,e=n=>import(n)){return(await We(t,e)).default}function Qn(t,e,n){let r=new Set,o=t.replace(/\{([A-Za-z_$][A-Za-z0-9_$-]*)\}/g,(a,s)=>{r.add(s);let c=n[s];return c==null?"":encodeURIComponent(String(c))}),i=new URL(o,e);for(let[a,s]of Object.entries(n))if(!(r.has(a)||s==null))if(Array.isArray(s))for(let c of s)i.searchParams.append(a,String(c));else i.searchParams.set(a,String(s));return i.href}var ye=class{constructor(e){this.options=e;this.#e=e.fetch??globalThis.fetch.bind(globalThis),this.#t=e.setTimer??((n,r)=>setTimeout(n,r)),this.#n=e.clearTimer??(n=>clearTimeout(n))}options;#e;#t;#n;#r={};#i;#o;#c=0;#s=!1;update(e){this.#r={...e},this.#s=!0,this.#a();let n=++this.#c,r=()=>{this.#l(n)};(this.options.debounce??0)>0?this.#o=this.#t(r,this.options.debounce):r()}disconnect(){this.#s&&(this.#s=!1,this.#c+=1,this.#a())}#a(){this.#i?.abort(),this.#i=void 0,this.#o!==void 0&&this.#n(this.#o),this.#o=void 0}#d(e){return!this.#s||e!==this.#c}async#l(e){if(this.#d(e))return;let n=new AbortController;this.#i=n;let r=this.options;r.onState({pending:!0,value:null,error:null,ok:!1});try{let o=await this.#e(Qn(r.source,r.baseURL,this.#r),{signal:n.signal});if(!o.ok)throw new TypeError(`Request failed with ${o.status}.`);let i=r.type==="text"?await o.text():await o.json(),a=r.adapt===void 0?i:r.adapt(i);if(this.#d(e))return;r.onState({pending:!1,value:a,error:null,ok:!0})}catch(o){if(n.signal.aborted||this.#d(e))return;r.onState({pending:!1,value:null,error:o,ok:!1})}finally{this.#i===n&&(this.#i=void 0),!this.#d(e)&&(r.poll??0)>0&&(this.#o=this.#t(()=>{this.#l(e)},r.poll))}}};var $,Yn=0,Dt=100,Fe=new WeakMap,ge=new WeakMap;function Mt(t){let{dependency:e,previousSubscriber:n,nextSubscriber:r}=t;n===void 0?e.first=r:n.nextSubscriber=r,r===void 0?e.last=n:r.previousSubscriber=n}function Pt(t){if(t.length>8)return[];for(;t.length>0;)t.pop();return t}var Ge=class{#e=[];#t=[];#n=!1;#r=!1;enqueue(e){e.stopped||e.queued||(e.queued=!0,this.#e.push(e),!this.#n&&!this.#r&&(this.#n=!0,queueMicrotask(()=>{this.#n=!1,this.flush()})))}enqueueDependency(e){if(this.#r||this.#e.length>0)return!1;for(let n=e.first;n!==void 0;n=n.nextSubscriber){let r=n.effect;if(r.scheduler!==this){for(let o of this.#e)o.queued=!1;return this.#e=[],!1}r.queued||(r.queued=!0,this.#e.push(r))}return this.#n||(this.#n=!0,queueMicrotask(()=>{this.#n=!1,this.flush()})),!0}flush(){this.#r||this.#e.length===0||this.#i()}#i(){this.#r=!0;let e=0,n,r=0;try{for(;this.#e.length>0;){if(e+=1,e>Dt){for(let o of this.#e)o.queued=!1;this.#e=[],y("HR006","A reactive flush exceeded the propagation-depth limit.")}if(n=this.#e,n.length>1){let o=1,i=n[0];for(;o<n.length;){let a=n[o];if(i.priority>a.priority||i.priority===a.priority&&i.id>a.id)break;i=a,o+=1}o<n.length&&n.sort((a,s)=>a.priority-s.priority||a.id-s.id)}this.#e=this.#t,r=0;do{let o=n[r];if(o.queued=!1,r+=1,o.computed===void 0?o.execute():o.computed.refresh(),this.#e.length===1&&r===n.length&&this.#e[0].computed===void 0){e+=1,e>Dt&&(this.#e[0].queued=!1,this.#e=[],y("HR006","A reactive flush exceeded the propagation-depth limit."));let i=this.#e;this.#e=Pt(n),n=i,r=0}else this.#e.length>0&&this.#o(n,r)}while(r<n.length);this.#t=Pt(n),n=void 0}}finally{if(n!==void 0){for(;r<n.length;)n[r++].queued=!1;this.#t=[]}if(this.#e.length>0){for(let o of this.#e)o.queued=!1;this.#e=[]}this.#r=!1}}#o(e,n){if(this.#e.some(r=>r.computed!==void 0))for(let r=e.length-1;r>=n;r-=1){let o=e[r];o.computed===void 0&&(e.splice(r,1),this.#e.push(o))}}},be=class{constructor(e,n,r,o){this.scheduler=e;this.run=n;this.priority=r;this.computed=o}scheduler;run;priority;computed;id=Yn++;dependencies=void 0;stopped=!1;paused=!1;queued=!1;#e=void 0;#t=void 0;execute(){if(this.stopped||this.paused)return;if(this.#t=void 0,this.#e!==void 0){let n=this.#e;this.#e=void 0,n()}let e=$;$=this;try{let n=this.run();n!==void 0&&(this.#e=n)}finally{$=e;let n=this.#t,r=n===void 0?this.dependencies:n.nextDependency;for(n===void 0?this.dependencies=void 0:n.nextDependency=void 0;r!==void 0;){let o=r.nextDependency;Mt(r),r=o}}}track(e){let n=this.#t===void 0?this.dependencies:this.#t.nextDependency;if(n?.dependency===e){this.#t=n;return}for(let i=this.dependencies;i!==n;i=i?.nextDependency)if(i?.dependency===e)return;let r={dependency:e,effect:this,nextDependency:n,previousSubscriber:void 0,nextSubscriber:void 0};this.#t===void 0?this.dependencies=r:this.#t.nextDependency=r,this.#t=r;let o=e.first;if(this.computed!==void 0&&o!==void 0)r.nextSubscriber=o,o.previousSubscriber=r,e.first=r;else{let i=e.last;r.previousSubscriber=i,i===void 0?e.first=r:i.nextSubscriber=r,e.last=r}}schedule(){if(this.computed!==void 0){this.computed.invalidate();return}this.paused||this.scheduler.enqueue(this)}pause(){this.stopped||this.paused||(this.paused=!0,this.#n(),this.#e?.(),this.#e=void 0)}resume(){this.stopped||!this.paused||(this.paused=!1,this.execute())}stop(){this.stopped||(this.stopped=!0,this.#n(),this.#e?.(),this.#e=void 0)}#n(){let e=this.dependencies;for(;e!==void 0;){let n=e.nextDependency;Mt(e),e=n}this.dependencies=void 0,this.#t=void 0}},Ze=class{#e={first:void 0,last:void 0};#t;constructor(e){this.#t=e}get(){return $!==void 0&&$.track(this.#e),this.#t}set(e){Object.is(this.#t,e)||(this.#t=e,F(this.#e))}update(e){this.set(e(this.#t))}},we=class{#e;#t;#n;#r;#i=!1;#o=!0;#c=!1;#s=!1;constructor(e,n,r={first:void 0,last:void 0}){this.#e=r,this.#t=n,this.#n=new be(e,()=>this.#l(),0,this)}get(){return this.#n.paused||this.#n.stopped?this.#d():(this.#a(),$!==void 0&&$.track(this.#e),this.#r)}invalidate(){if(!(this.#n.stopped||this.#o)){this.#o=!0;for(let e=this.#e.first;e!==void 0;e=e.nextSubscriber)if(e.effect.computed===void 0){this.#n.scheduler.enqueue(this.#n);return}F(this.#e)}}refresh(){this.#a()}pause(){this.#n.stopped||this.#n.paused||(this.#o=!0,this.#n.pause())}resume(){this.#n.stopped||!this.#n.paused||(this.#n.paused=!1)}stop(){this.#n.stop()}#a(){if(this.#c&&y("HR006","A reactive computed value depends on itself."),!this.#o||this.#n.stopped||this.#n.paused)return;let e=this.#i;this.#n.execute(),e&&this.#s&&F(this.#e,$?.computed===void 0?void 0:$)}#d(){this.#c&&y("HR006","A reactive computed value depends on itself.");let e=$;this.#c=!0,$=void 0;try{return this.#t()}finally{$=e,this.#c=!1}}#l(){this.#c=!0,this.#o=!1;try{let e=this.#t();this.#s=!this.#i||!Object.is(this.#r,e),this.#r=e,this.#i=!0}catch(e){throw this.#o=!0,e}finally{this.#c=!1}}};function F(t,e){let n=t?.first;if(n===void 0)return;let r=n!==t.last;if(!r&&n.effect.computed!==void 0){n.effect!==e&&n.effect.computed.invalidate();return}if(n.effect.computed===void 0){if(e===void 0&&r&&n.effect.scheduler.enqueueDependency(t))return;for(let o=n;o!==void 0;){let i=o.nextSubscriber;o.effect!==e&&o.effect.schedule(),o=i}return}for(let o=n;o!==void 0;){let i=o.nextSubscriber;o.effect!==e&&o.effect.schedule(),o=i}}function Lt(t){return new Ze(t)}function jt(t,e){return new we(t,e)}function G(t,e,n=1,r=!0){let o=new be(t,e,n);return r?o.execute():o.paused=!0,o}var ve=class t{constructor(e=[],n=new Ge,r){this.scheduler=n;this.parent=r;for(let[o,i]of e)this.set(o,i)}scheduler;parent;#e=new Map;#t;#n;has(e){return this.#r(e)!==void 0||this.parent?.has(e)===!0}get(e){let n=this.#r(e);return n===void 0?this.parent?.get(e):($!==void 0&&$.track(n),n.value)}set(e,n){let r=this.#o(n),o=this.#r(e);if(o===void 0){o={value:r,first:void 0,last:void 0},this.#e.set(e,o),this.#n=o;return}Object.is(o.value,r)||(o.value=r,F(o))}defineComputed(e,n){let r=this.#r(e);r===void 0&&(r={value:null,first:void 0,last:void 0},this.#e.set(e,r),this.#n=r);let o=new we(this.scheduler,()=>this.#o(n()),r);return r.computed=o,Object.hasOwn(this,"get")||(this.get=this.#i),o}fork(e=[]){return new t(e,this.scheduler,this)}#r(e){return e!==this.#t&&(this.#t=e,this.#n=this.#e.get(e)),this.#n}#i(e){let n=this.#r(e);return n===void 0?this.parent?.get(e):n.computed!==void 0?n.computed.get():($!==void 0&&$.track(n),n.value)}#o(e){if(e===null||typeof e!="object")return e;let n=Fe.get(e);if(n!==void 0)return n;let r=new Proxy(e,{get:(o,i,a)=>{if($!==void 0){let s=ge.get(o);s===void 0&&(s=new Map,ge.set(o,s));let c=s.get(i);c===void 0&&(c={first:void 0,last:void 0},s.set(i,c)),$.track(c)}return this.#o(Reflect.get(o,i,a))},set:(o,i,a,s)=>{let c=Reflect.get(o,i,s),l=this.#o(a),f=Reflect.set(o,i,l,s);return Object.is(c,l)||F(ge.get(o)?.get(i)),f},deleteProperty:(o,i)=>{let a=Reflect.has(o,i),s=Reflect.deleteProperty(o,i);return a&&F(ge.get(o)?.get(i)),s}});return Fe.set(e,r),Fe.set(r,r),r}};var Xn=/\/\*[\s\S]*?\*\/|"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|--[\w-]+\s*:[^;{}]*|:(user-invalid|invalid|valid)(?![\w-])/g;function Ot(t){return t.replace(Xn,(e,n)=>n===void 0?e:`:is(:${n}, [data-${n}])`)}var Z="data-component",ke="data-slotted";function zt(t,e,n){let r=new Set((t.getAttribute(e)??"").split(/\s+/).filter(Boolean));r.add(n),t.setAttribute(e,Array.from(r).join(" "))}function Ce(t){t.nodeType===1&&t.setAttribute(ke,"")}function Ke(t){return`data-${t}-state`}var It={slotted:"[--slotted]",state:"[--state]"},er=/\/\*[\s\S]*?\*\/|"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|:(slotted|host-state)\(/g;function tr(t,e=["slotted","host-state"]){return t.replace(er,(n,r)=>r===void 0||!e.includes(r)?n:`:where(${r==="slotted"?It.slotted:It.state}):is(`)}function nr(t){return/:where\(\s*\[--slotted\]\s*\)/.test(t)?"slotted":"own"}function rr(t,e){let n=0;for(let r=e;r<t.length;r+=1){let o=t[r];if(o==='"'||o==="'"){let i=t.indexOf(o,r+1);r=i===-1?t.length:i}else if(o==="(")n+=1;else if(o===")"&&--n===0)return r}return t.length}var or=/\[\s*([\w-]+)\s*(?:=\s*(?:"((?:\\.|[^"\\])*)"|'((?:\\.|[^'\\])*)'|([^\]\s]+))\s*)?\]/g;function ir(t,e,n,r){let o="";for(let i of t.matchAll(or)){let a=r(i[1]),s=i[2]??i[3]??i[4];n.add(a),o+=`[${Ke(e)}~="${s===void 0?a:`${a}=${encodeURIComponent(s)}`}"]`}return o}function sr(t){let e="";for(let n=0;n<t.length;n+=1){let r=t[n];if(r==="["){let s=t.indexOf("]",n),c=s===-1?t.length:s+1;e+=t.slice(n,c),n=c-1;continue}let o=e.at(-1),a=o===void 0||/[\s>+~(,]/.test(o)?/^[a-z][a-z0-9]*(?:-[a-z0-9]+)+(?![\w-]|\()/.exec(t.slice(n))?.[0]:void 0;if(a!==void 0){e+=`:is(${a}, :where([${Z}~="${a}"]))`,n+=a.length-1;continue}e+=r}return e}function ar(t,e,n,r,o=i=>i){/:scope(?![\w-])/.test(t)&&y("HY003",`\`:scope\` is not part of component styles; select the root with \`:host\` (in <${e}>).`);let i="",a=0,s=/:where\(\s*\[--state\]\s*\):is\(/g;for(let c=s.exec(t);c!==null;c=s.exec(t)){let l=c.index+c[0].length-1,f=rr(t,l);i+=`${t.slice(a,c.index)}${n}${ir(t.slice(l+1,f),e,r,o)}`,a=f+1,s.lastIndex=a}return i+=t.slice(a),i=i.replace(/:where\(\s*\[--slotted\]\s*\):is\(/g,`:where([${ke}], [${ke}] *):is(`).replace(/:host(?![\w-])/g,n),sr(Ot(i))}function cr(t,e,n,r){let o=`[${Z}~="${t}"]`;return[r,e.trim()===""?"":`@scope (${o}) to ([${Z}], [${ke}]) {
|
|
3
3
|
${e}
|
|
4
|
-
}`,n.trim()===""?"":`@scope (${o}) to ([${
|
|
4
|
+
}`,n.trim()===""?"":`@scope (${o}) to ([${Z}]) {
|
|
5
5
|
${n}
|
|
6
6
|
}`].filter(i=>i!=="").join(`
|
|
7
|
-
`)}function
|
|
8
|
-
`)},C=w("own"),k=w("slotted");return
|
|
9
|
-
`)),stateNames:[...s]}}function qt(t,e){let n=[];for(let r of t){let o=e(r);(o===!0||typeof o=="string"&&o.length>0||typeof o=="number"&&o!==0&&!Number.isNaN(o))&&n.push(r),(typeof o=="string"||typeof o=="number")&&n.push(`${r}=${encodeURIComponent(String(o))}`)}return n.join(" ")}var xe=new WeakSet,Kt=new WeakMap,Ut=new WeakMap,cr=Symbol.for("@nextwebwg/html-next.runtime.v1");function Qe(t){return t[cr]??={}}function Z(t){return Kt.get(t)}function Jt(t){let e=Qe(t),n=e.registry;return(n===void 0||n.root!==t.documentElement)&&(n={root:t.documentElement,definitions:new Map,discoverySelector:void 0},e.registry=n),n}var Qt=new WeakMap;function Yt(t,e,n){let r=Vt(t,e,n);return Qt.set(e,r.stateNames),r.css}function Xt(t,e,n){t.definitions.set(e,n),t.discoverySelector!==void 0&&(t.discoverySelector+=`,${e}`)}function dr(t){return t.discoverySelector??=["template[component]","[data-component]",...Array.from(t.definitions.keys())].join(",")}function lr(t,e){let n=t.getAttribute("component")??"",r=`${t.ownerDocument.URL}#template[component="${n}"][${e+1}]`;t.hasAttribute("src")&&y("HL001","External definitions require the application-owned graph resolver.",r);let o=Be(t,r),i=Array.from(t.content.children).find(a=>a.localName==="style");return{wrapper:t,style:i,definition:o}}function en(t,e=document){let n=Jt(e),r=0;for(let o of t.nodes.values()){if(o.shadowedByCustomElement)continue;let i=o.definition.contract.tag;n.definitions.has(i)&&y("HR001",`More than one definition declares <${i}>.`);let a=o.definition.css===""?void 0:e.createElement("style");a!==void 0&&(a.textContent=Yt(o.definition.css,o.definition,e),e.head.append(a)),Xt(n,i,{definition:o.definition,style:a}),r+=1}return r}function Ye(t,e,n=!1){let r=t.type==="boolean"&&n&&e===""?!0:e,o=_(r,t.type);if(!o.ok){let i=o.issues.map(a=>`${a.path}: ${a.message}`).join("; ");y("HR002",`A prop invocation value does not satisfy its declared type. ${i}`)}return o.value}function ur(t,e,n){return n!==void 0?Ye(e,n):(e.required&&y("HC020",`Required prop \`${t}\` was not provided.`),e.default===void 0?E:e.default)}function fr(t,e){let n=Ut.get(t);if(n===void 0){let r=Object.create(null),o=Object.create(null);for(let i of Object.keys(t.contract.props)){let a=Re(i);r[a]=i,o[`data-${a}`]=i,a!==i.toLowerCase()&&(o[`data-${i.toLowerCase()}`]=i)}n=[r,o],Ut.set(t,n)}return n[e?1:0]}function pr(t,e,n=!1){let r=e.contract,o=fr(e,n),i=Object.create(null),a=[],s;for(let p of Array.from(t.attributes)){if(p.name.toLowerCase()==="as"&&e.root?.kind==="native"){s=p.value.toLowerCase();continue}let m=o[p.name.toLowerCase()];if(m===void 0){n||a.push(p);continue}i[m]=Ye(r.props[m],p.value,!n)}let c=e.root?.kind==="native"?n?t.localName:s??e.root.element:e.template.name;e.root?.kind==="native"&&!e.root.choices.includes(c)&&y(n?"HR005":"HR002",`<${r.tag}> cannot use root <${c}>; expected one of ${e.root.choices.join(", ")}.`);let l=new Set(Object.keys(i).filter(p=>i[p]!==void 0)),f=new ve;for(let[p,m]of Object.entries(r.props))m.required&&i[p]===void 0&&y("HC020",`Required prop \`${p}\` was not provided.`),f.set(p,i[p]!==void 0?i[p]:m.default===void 0?E:m.default);let d=e.declarations??[];for(let p of d)(p.kind==="state"||p.kind==="computed"||p.kind==="data")&&f.set(p.name,null);for(let p of d)p.kind==="data"?f.set(p.name,{pending:!0,value:null,error:null,ok:!1}):p.kind==="state"&&f.set(p.name,p.expression===void 0?null:D(p.expression.source,f));let h=[];for(let p of d)p.kind!=="computed"||p.expression===void 0||h.push(f.defineComputed(p.name,()=>I(p.expression,f)));let u=(()=>{try{return new URL(e.source.file,t.ownerDocument.baseURI).href}catch{return t.ownerDocument.baseURI}})();for(let p of d){if(p.kind!=="data"||p.source===void 0)continue;let m=p,w=p.source,C=new ye({source:w,baseURL:u,...m.type===void 0?{}:{type:m.type},...m.debounce===void 0?{}:{debounce:Number(m.debounce)},...m.poll===void 0?{}:{poll:Number(m.poll)},onState:k=>f.set(m.name,k)});h.push(F(f.scheduler,()=>{let k=Object.fromEntries(m.parameters.map(g=>[g.name,I(g.expression,f)]));return C.update(k),()=>C.disconnect()},0))}return{scope:f,passThrough:a,effects:h,rootName:c,explicit:l}}function Je(t,e){return t.fork(Object.entries(e))}function D(t,e){try{return mt(t,e)}catch(n){throw n instanceof ee&&y("HB001",n.message),n}}var ie="http://www.w3.org/2000/svg",Bt=new Map;function mr(t,e){if(t.namespaceURI!==ie)return e;let n=Bt.get(e);if(n===void 0){let r=t.ownerDocument.createElement("template");r.innerHTML=`<svg ${e}>`,n=r.content.firstChild.attributes[0]?.name??e,Bt.set(e,n)}return n}function tn(t,e,n){return e==="svg"||n.namespace===ie?t.createElementNS(ie,e):t.createElement(e)}function hr(t,e){let n=t.namespaceURI===ie&&t.localName!=="foreignObject"?ie:void 0;return n===e.namespace?e:Object.create(e,{namespace:{value:n,enumerable:!0}})}function q(t,e,n,r=1){t.effects.push(F(e.scheduler,n,r))}function nn(t,e,n){let[r,...o]=e;if(typeof r!="string")return;if(o.length===0){t.set(r,n);return}let i=t.get(r);for(let c=0;c<o.length-1;c+=1){let l=o[c],f=typeof l=="object"?I(l.expression,t):l;if(typeof f!="string"&&typeof f!="number"||i==null)return;i=i[f]}let a=o.at(-1),s=typeof a=="object"?I(a.expression,t):a;(typeof s=="string"||typeof s=="number")&&i!=null&&(i[s]=n)}function yr(t){return t instanceof HTMLInputElement?t.type==="checkbox"||t.type==="radio"?t.checked:t.type==="number"||t.type==="range"?Number.isNaN(t.valueAsNumber)?null:t.valueAsNumber:t.value:t instanceof HTMLSelectElement?t.multiple?Array.from(t.selectedOptions,e=>e.value):t.value:t instanceof HTMLTextAreaElement?t.value:t.value??t.getAttribute("value")}function gr(t,e,n){let r=e.toLowerCase();if(r==="checked"&&t instanceof HTMLInputElement)return t.checked=L(n),!0;if(r==="value"&&t instanceof HTMLSelectElement&&t.multiple){let o=new Set(Array.isArray(n)?n.map(String):[]);for(let i of Array.from(t.options))i.selected=o.has(i.value);return!0}return r==="value"&&(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement)?(t.value=n==null?"":String(n),!0):!1}function br(t,e,n,r){for(let o of t.steps)if(!(o.guard!==void 0&&!L(I(o.guard,n))))if(o.kind==="set")nn(n,o.writablePath,I(o.value,n));else if(o.kind==="dispatch"){let i=rn(r.definition,o.event),a=o.value===void 0?void 0:I(o.value,n);i!==void 0&&a!==void 0&&(_(a,de(i.type)).ok||y("HR002",`Event \`${o.event}\` detail does not satisfy its declared type.`)),on(r.root??e,o.event,a,i)}else{let i=r.refs[o.target];o.kind==="focus"?i?.focus():i?.reportValidity?.()}}function rn(t,e){return(t.declarations??[]).find(n=>n.kind==="event"&&n.name===e)}function on(t,e,n,r){return t.dispatchEvent(new CustomEvent(e,{detail:n,bubbles:r?.bubbles??!0,composed:r?.composed??!0,cancelable:r?.cancelable??!1}))}function wr(t,e,n){if(n.includes("self")&&t.target!==e)return!1;if(t instanceof MouseEvent){let o=n.filter(a=>["left","middle","right"].includes(a)),i={left:0,middle:1,right:2};if(o.length>0&&!o.some(a=>t.button===i[a]))return!1}let r=["ctrl","shift","alt","meta"];for(let o of r)if(n.includes(o)&&!t[`${o}Key`])return!1;if(n.includes("exact")&&r.some(o=>!n.includes(o)&&t[`${o}Key`]))return!1;if(t instanceof KeyboardEvent){let o=n.filter(a=>["enter","escape","space","tab","up","down","left","right"].includes(a)),i={enter:"Enter",escape:"Escape",space:" ",tab:"Tab",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight"};if(o.length>0&&!o.some(a=>t.key===i[a]))return!1}return!0}function _t(t,e,n,r){for(let o of e.events??[]){let i=(r.definition.declarations??[]).find(s=>s.kind==="handler"&&s.name===o.handler),a=s=>{wr(s,t,o.modifiers)&&(o.modifiers.includes("prevent")&&s.preventDefault(),o.modifiers.includes("stop")&&s.stopPropagation(),br(i,t,n,r))};if(o.name==="connect"||o.name==="disconnect"){(o.name==="connect"?r.connectCallbacks:r.disconnectCallbacks).add(()=>a(new Event(o.name)));continue}q(r,n,()=>(t.addEventListener(o.name,a,{capture:o.modifiers.includes("capture"),passive:o.modifiers.includes("passive"),once:o.modifiers.includes("once")}),()=>t.removeEventListener(o.name,a,{capture:o.modifiers.includes("capture")})),2)}}function vr(t,e,n){e=mr(t,e),n===null||ne(e)&&te(n)?t.removeAttribute(e):t.setAttribute(e,n)}function kr(t,e,n,r){let o=D(e.expression,n);e.name==="value"?t.textContent=P(o):t.replaceChildren(Le(P(o),r,i=>xe.add(i)))}function Cr(t,e,n){let r=D(t.expression,e);return t.name==="value"?n.createTextNode(P(r)):Le(P(r),n,o=>xe.add(o))}function xr(t,e){return typeof t=="number"&&typeof e=="number"?t-e:P(t).localeCompare(P(e))}function Er(t,e,n){let r=t.slice();if(e.where!==void 0){let o=e.where;r=r.filter(i=>L(D(o,Je(n,{[e.item]:i}))))}if(e.sort!==void 0){let o=e.sort.split(",").map(a=>a.trim()).filter(a=>a!==""),i=(a,s)=>a!==null&&typeof a=="object"&&!Array.isArray(a)?D(`${e.item}.${s}`,Je(n,{[e.item]:a})):a;r.sort((a,s)=>{for(let c of o){let l=c.startsWith("-"),f=l?c.slice(1).trim():c,d=xr(i(a,f),i(s,f));if(d!==0)return l?-d:d}return 0})}if(e.limit!==void 0){let o=D(e.limit,n);typeof o=="number"&&(r=r.slice(0,Math.max(0,Math.trunc(o))))}return r}function sn(t,e){let n=e.createDocumentFragment();return n.append(...t),Array.from(n.childNodes)}function Rr(t,e){let n=t.nextSibling;for(;n!==null&&n!==e;){let r=n.nextSibling;n.remove(),n=r}}function Tr(t,e,n,r,o){if(t.flow?.kind==="each")return Ar(t,e,n,r,o);let i=n.createComment("html-next:start"),a=n.createComment("html-next:end"),s=n.createDocumentFragment();s.append(i,a);let c=[];return q(o,e,()=>{for(let d of c)d.stop();c=[],Rr(i,a);let l=o.effects.length,f=[];if(t.flow?.kind==="if"){if(L(D(t.flow.test,e))){let{flow:d,...h}=t;f=se(h,e,n,r,o)}}else if(t.flow?.kind==="with"){let d=e.fork([[t.flow.alias,D(t.flow.expr,e)]]),{flow:h,...u}=t;f=se(u,d,n,r,o)}else t.flow?.kind==="match"&&(f=Hr(t,e,n,o));c=o.effects.slice(l),a.before(...sn(f,n))}),[s]}function Sr(t,e){if(t.end.nextSibling===e)return;let n=[],r=t.start;for(;r!==null&&(n.push(r),r!==t.end);)r=r.nextSibling;let o=e.parentNode;if(o===null)return;let i=o.moveBefore;for(let a of n)i===void 0?o.insertBefore(a,e):i.call(o,a,e)}function Nr(t){for(let n of t.effects)n.stop();let e=t.start;for(;e!==null;){let n=e.nextSibling;if(e.parentNode?.removeChild(e),e===t.end)break;e=n}}function $r(t){let e=-1,n=!0;for(let s of t)s<0||(s<e&&(n=!1),e=s);if(n)return;let r=[],o=new Int32Array(t.length).fill(-1);for(let s=0;s<t.length;s+=1){let c=t[s];if(c<0)continue;let l=0,f=r.length;for(;l<f;){let d=l+f>>>1;t[r[d]]<c?l=d+1:f=d}l>0&&(o[s]=r[l-1]),r[l]=s}let i=new Uint8Array(t.length),a=r.at(-1)??-1;for(;a>=0;)i[a]=1,a=o[a];return i}function Ar(t,e,n,r,o){let i=t.flow,a=n.createComment("html-next:each-start"),s=n.createComment("html-next:each-end"),c=n.createDocumentFragment();c.append(a,s);let l=new Map;return q(o,e,()=>{let f=D(i.list,e),d=Array.isArray(f)?Er(f,i,e):[],h=new Map,u=i.key!==void 0,p=u?[]:void 0,m;if(u){m=new Map;let g=0;for(let b of l.keys())m.set(b,g++)}let w=u?[]:void 0,{flow:C,...k}=t;for(let g=0;g<d.length;g+=1){let b=d[g],v={[i.item]:b,loop:{index:g,first:g===0,last:g===d.length-1,count:d.length}};i.index!==void 0&&(v[i.index]=g);let R,T=g;i.key!==void 0&&(R=e.fork(Object.entries(v)),T=D(i.key,R)),h.has(T)&&y("HR004",`A keyed list produced duplicate key \`${P(T)}\`.`);let A=l.get(T);if(A===void 0){R??=e.fork(Object.entries(v));let M=o.effects.length,ae=sn(se(k,R,n,r,o),n),st=n.createComment("html-next:item-start"),at=n.createComment("html-next:item-end");s.before(st,...ae,at),A={start:st,end:at,scope:R,effects:o.effects.slice(M)}}else A.scope.set(i.item,b),i.index!==void 0&&A.scope.set(i.index,g),A.scope.set("loop",v.loop);h.set(T,A),p?.push(A),w?.push(m?.get(T)??-1)}for(let[g,b]of l)h.has(g)||Nr(b);if(p!==void 0&&w!==void 0){let g=$r(w),b=s;for(let v=p.length-1;v>=0;v-=1){let R=p[v];(w[v]<0||g!==void 0&&g[v]!==1)&&Sr(R,b),b=R.start}}l=h}),[c]}function an(t,e,n,r,o,i){return t.flow?.kind==="if"||t.flow?.kind==="each"||t.flow?.kind==="with"||t.flow?.kind==="match"?o.committed&&o.frameworkOwned&&i!==void 0?[i]:Tr(t,e,n,r,o):se(t,e,n,r,o,i)}function Hr(t,e,n,r){let o=t.flow,i=o.expr!==void 0?Je(e,{[o.alias]:D(o.expr,e)}):e,a;for(let d of t.children)if(d.kind==="element"){if(d.flow?.kind==="when"&&L(D(d.flow.test,i))){a=d;break}if(d.flow?.kind==="else"){a=d;break}}if(a===void 0)return[];let{flow:s,...c}=a,l=se(c,i,n,[],r);if(t.name==="template")return l;let f=tn(n,t.name,r);for(let d of t.attributes)d.kind==="literal"&&f.setAttribute(d.name,d.value);return f.append(...l),[f]}function se(t,e,n,r,o,i){let a=t.attributes.find(m=>m.kind==="directive");if(t.name==="template"){if(a!==void 0){let m=n.createTextNode("");return q(o,e,()=>{let w=D(a.expression,e);a.name==="value"&&(m.data=P(w))}),a.name==="value"?[m]:[Cr(a,e,n)]}return cn(t.children,e,n,o)}let s=t===o.definition.template?o.rootName:t.name;if(o.frameworkOwned&&i instanceof Element&&i.localName!==s&&(i.getAttribute("data-component")??"").split(/\s+/).includes(t.name))return[i];if(o.hydrationRanges!==void 0&&!o.frameworkOwned&&i instanceof Element&&i.localName!==s&&(i.getAttribute("data-component")??"").split(/\s+/).includes(t.name)){let m=Xe(i,!1),w=b=>b.kind==="element"?b.attributes.find(v=>v.kind==="literal"&&v.name==="slot")?.value??"":"",C=m?.ranges.filter(b=>!b.fallback)??[],k=(b,v)=>{let R=0;for(let T of b)R+=Ee(T,e,n,o,v[R]).length};for(let b of C)k(t.children.filter(v=>w(v)===b.slot),b.content);let g=new Set(C.map(b=>b.slot));return k(t.children.filter(b=>!g.has(w(b))),m?.carried??[]),[i]}let c=i instanceof Element&&i.localName===s,l=c?i:tn(n,s,o);t===o.definition.template&&(o.root=l);let f=c?Array.from(l.childNodes):[],d=c&&(l instanceof HTMLInputElement||l instanceof HTMLTextAreaElement||l instanceof HTMLSelectElement)?{value:l.value,focused:l.ownerDocument.activeElement===l,...l instanceof HTMLInputElement?{checked:l.checked}:{},...l instanceof HTMLInputElement||l instanceof HTMLTextAreaElement?{selectionStart:l.selectionStart,selectionEnd:l.selectionEnd}:{}}:void 0;t.ref!==void 0&&(o.refs[t.ref]=l);for(let m of t.attributes)m.kind==="literal"&&l.setAttribute(m.name,m.value);for(let m of r){let w=m.name==="class"||m.name==="style"?l.getAttribute(m.name):null;l.setAttribute(m.name,w===null||w===""?m.value:`${w}${m.name==="class"?" ":"; "}${m.value}`)}for(let m of t.attributes)if(m.kind==="attribute"){if(q(o,e,()=>{let w=D(m.expression,e);m.target==="class"?l.classList.toggle(m.name,L(w)):m.target==="style"?l.style.setProperty(m.name,P(w)):m.twoWay===!0&&gr(l,m.name,w)||vr(l,m.name,ht(w,m.name))}),m.twoWay===!0&&m.writablePath!==void 0){let w=l instanceof HTMLSelectElement||l instanceof HTMLInputElement&&["checkbox","radio","file"].includes(l.type)?"change":"input",C=()=>{l instanceof HTMLInputElement&&l.type==="radio"&&!l.checked||nn(e,m.writablePath,yr(l))};q(o,e,()=>(l.addEventListener(w,C),()=>l.removeEventListener(w,C)),2)}}else m.kind==="property"&&q(o,e,()=>{l[m.name]=D(m.expression,e)});if(a!==void 0)return q(o,e,()=>kr(l,a,e,n)),_t(l,t,e,o),[l];let h=[],u=0,p=hr(l,o);for(let m of t.children){let w=u;if(o.frameworkOwned&&m.kind==="element"){let k=f.findIndex((g,b)=>b<u?!1:g instanceof Element&&(g.localName===m.name||(g.getAttribute("data-component")??"").split(/\s+/).includes(m.name)));k<0&&m.flow!==void 0&&(k=f.findIndex((g,b)=>b>=u&&g instanceof Comment)),k>=0&&(w=k)}let C=Ee(m,e,n,p,f[w]);h.push(...C),u=w+C.length}if(c&&!o.frameworkOwned){h=h.flatMap(m=>m.nodeType===11?Array.from(m.childNodes):[m]);for(let m=0;m<h.length;m+=1){let w=h[m];l.childNodes[m]!==w&&l.insertBefore(w,l.childNodes[m]??null)}for(;l.childNodes.length>h.length;)l.lastChild.remove()}else c||l.append(...h);return d!==void 0&&(l.value=d.value,l instanceof HTMLInputElement&&"checked"in d&&(l.checked=d.checked),(l instanceof HTMLInputElement||l instanceof HTMLTextAreaElement)&&"selectionStart"in d&&typeof d.selectionStart=="number"&&typeof d.selectionEnd=="number"&&(d.focused&&l.focus({preventScroll:!0}),l.setSelectionRange(d.selectionStart,d.selectionEnd))),_t(l,t,e,o),[l]}function cn(t,e,n,r){let o=[];for(let i of t)o.push(...Ee(i,e,n,r));return o}function Dr(t,e){return e.projectedSlotNames.get(t)??(t instanceof Element?t.getAttribute("slot")??"":"")}function Mr(t,e,n,r){let o=t.nameExpression===void 0?t.name??"":P(I(t.nameExpression,e)),i=r.projectedNodes.filter(d=>Dr(d,r)===o),a=r.hydrationRanges?.shift();if(a!==void 0){if(a.fallback){let d=[],h=0;for(let u of t.fallback??[]){let p=Ee(u,e,n,r,a.content[h]);d.push(...p),h+=p.length}return[a.markers[0],...d,...a.markers.slice(1)]}for(let d of a.content)Ce(d);return a.markers.length===1?[a.markers[0]]:[a.markers[0],...a.content,a.markers[1]]}let s=d=>`"${d.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}"`,c=(d,h)=>Pr(n,d,h),l=(d,h)=>{if(d.length===0)return[c("marker",`slot=${s(o)}`)];let u=`slot=${s(o)}${h?' fallback=""':""}`;return[c("start",u),...d,c("end","")]};if(i.length===0)return l(cn(t.fallback??[],e,n,r),!0);if(r.committed){for(let d of i)Ce(d);return l([...i],!1)}let f=n.createComment(`html-next:slot:${o}`);return r.slotInsertions.push({anchor:f,nodes:i}),l([f],!1)}function Wt(t){let e=new Map,n=t.trim(),r={amp:"&",lt:"<",gt:">",quot:'"',apos:"'"};for(;n!=="";){let o=/^([A-Za-z_:][-A-Za-z0-9._:]*)\s*=\s*(?:"([^"<]*)"|'([^'<]*)')(?:\s+|$)/.exec(n);if(o===null||e.has(o[1]))return new Map;let i=(o[2]??o[3]).replace(/&(#x[0-9a-fA-F]+|#\d+|amp|lt|gt|quot|apos);/g,(a,s)=>s.startsWith("#x")?String.fromCodePoint(parseInt(s.slice(2),16)):s.startsWith("#")?String.fromCodePoint(Number(s.slice(1))):r[s]);e.set(o[1],i),n=n.slice(o[0].length)}return e}var Ft=new WeakMap;function dn(t){let e=Ft.get(t);if(e===void 0){let n=t.createElement("div");n.innerHTML='<?probe x="1"?>',e=n.firstChild?.nodeType===7,Ft.set(t,e)}return e}function Pr(t,e,n){return dn(t)?t.createProcessingInstruction(e,n):t.createComment(`?${e}${n===""?"":` ${n}`}?`)}function Ke(t){if(t.nodeType===7){let n=t;return{target:n.target,attributes:Wt(n.data)}}if(t.nodeType!==8||dn(t.ownerDocument))return;let e=/^\?([A-Za-z][-A-Za-z0-9]*)(?:\s+([\s\S]*?))?\s*\??$/.exec(t.data);return e===null?void 0:{target:e[1],attributes:Wt(e[2]??"")}}function Xe(t,e=!0){let n=[],r=new Set,o=(s,c)=>{for(let l=0;l<s.length;l+=1){let f=s[l],d=Ke(f);if(d?.target==="marker"&&d.attributes.has("slot")){c.push({slot:d.attributes.get("slot"),fallback:!1,markers:[f],content:[]});continue}if(d?.target==="start"){let h=1,u=[],p;for(l+=1;l<s.length;l+=1){let m=Ke(s[l]);if(m?.target==="start")h+=1;else if(m?.target==="end"&&--h===0){p=s[l];break}u.push(s[l])}if(d.attributes.has("slot")){c.push({slot:d.attributes.get("slot"),fallback:d.attributes.has("fallback"),markers:p?[f,p]:[f],content:u});for(let m of u)r.add(m)}else o(u,c);continue}if(f instanceof Element)if(f!==t&&f.hasAttribute("data-component")){let h=Xe(f,!1);for(let u of h?.ranges??[])o(u.content,c)}else o(Array.from(f.childNodes),c)}};o(Array.from(t.childNodes),n);let i=Array.from(t.children).find(s=>s instanceof HTMLTemplateElement&&!r.has(s)&&s.previousSibling!==null&&Ke(s.previousSibling)?.target==="carrier");if(n.length===0&&i===void 0)return;let a=[];if(i!==void 0&&e){for(let s of Array.from(i.content.childNodes))a.push(t.ownerDocument.adoptNode(s));i.previousSibling.remove(),i.remove()}else i!==void 0&&a.push(...Array.from(i.content.childNodes));return{ranges:n,carried:a}}function Ee(t,e,n,r,o){if(t.kind==="text"){let i=o instanceof Text?o:n.createTextNode("");return i.data=t.value,[i]}return t.kind==="slot"?Mr(t,e,n,r):an(t,e,n,[],r,o)}function jr(t,e){let n=Qt.get(e.definition)??[];if(n.length===0)return;let r=Ze(e.definition.contract.tag);e.effects.push(F(e.scope.scheduler,()=>{let o=qt(n,i=>e.scope.get(i));o===""?t.removeAttribute(r):t.getAttribute(r)!==o&&t.setAttribute(r,o)},2))}function Lr(t,e){let n=e.definition.contract.props,r={},o={};for(let[f,d]of Object.entries(n)){let h=`data-${Re(f)}`;r[h]=f;let u=e.definition.template.attributes.some(p=>p.kind==="attribute"&&p.name===h);e.effects.push(F(e.scope.scheduler,()=>{let p=e.scope.get(f);if(!u&&!e.explicit.has(f))return;let m=p===void 0||p===E||p===null?null:Ae(p,d.type);o[h]=m,m===null?t.removeAttribute(h):t.setAttribute(h,m)},2))}let i=t.ownerDocument.defaultView?.MutationObserver,a=Object.keys(r);if(i===void 0||a.length===0)return;let s=new i(f=>{for(let d of f){let h=d.attributeName;if(h===null)continue;let u=r[h];if(u===void 0)continue;let p=t.getAttribute(h);if(h in o&&o[h]===p){delete o[h];continue}delete o[h];let m=n[u];p===null?e.explicit.delete(u):e.explicit.add(u),e.scope.set(u,p===null?ur(u,m,void 0):Ye(m,p,!0))}}),c=()=>s.observe(t,{attributes:!0,attributeFilter:a}),l=()=>s.disconnect();e.connectCallbacks.add(c),e.disconnectCallbacks.add(l)}function Or(t,e){for(let n of e.definition.declarations??[])n.kind==="method"&&Object.defineProperty(t,n.name,{configurable:!0,enumerable:!1,value:(...r)=>e.controllerModule===void 0?Promise.reject(new TypeError(`Controller method \`${n.name}\` is not ready for <${e.definition.contract.tag}>.`)):e.controllerModule.then(o=>{let i=o[n.exportName];return typeof i!="function"&&y("HJ003",`Controller does not export method \`${n.exportName}\`.`),Reflect.apply(i,void 0,[et(t),...r])})})}function Ir(t,e,n,r,o=new WeakMap,i=!1){let a=n&&t.contains(t.ownerDocument.activeElement)?t.ownerDocument.activeElement:null,s=a instanceof HTMLInputElement||a instanceof HTMLTextAreaElement?[a.selectionStart,a.selectionEnd]:void 0,{scope:c,passThrough:l,effects:f,rootName:d,explicit:h}=pr(t,e,n),u=r,p;if(n&&u===void 0){let b=Xe(t);if(b!==void 0){p=b.ranges;let v=[];for(let R of b.ranges)if(!R.fallback)for(let T of R.content)o.set(T,R.slot),v.push(T);v.push(...b.carried),u=v}else(e.slots??[]).length>0?y("HR005",`<${e.contract.tag}> has slots but its server-rendered root has no slot marks.`):u=[]}let m=n?u:Array.from(t.childNodes),w={definition:e,scope:c,refs:{},effects:f,connectCallbacks:new Set,disconnectCallbacks:new Set,connected:!1,explicit:h,frameworkOwned:i,projection:{nodes:n?u:Array.from(t.childNodes),slotNames:o}},C={definition:e,effects:f,refs:w.refs,connectCallbacks:w.connectCallbacks,disconnectCallbacks:w.disconnectCallbacks,projectedNodes:m,projectedSlotNames:o,slotInsertions:[],rootName:d,frameworkOwned:i,committed:n,hydrationRanges:p},k=an(e.template,c,t.ownerDocument,l,C,n?t:void 0);C.hydrationRanges=void 0;let g=k[0];return n&&g!==t&&y("HR005",`Server markup for <${e.contract.tag}> has an incompatible root.`),a instanceof HTMLElement&&(a.focus({preventScroll:!0}),s!==void 0&&(a instanceof HTMLInputElement||a instanceof HTMLTextAreaElement)&&typeof s[0]=="number"&&typeof s[1]=="number"&&a.setSelectionRange(s[0],s[1])),It(g,G,e.contract.tag),w.element=g,{invocation:t,nativeRoot:g,context:C,definition:e,instance:w,replace:!n}}function zr(t,e){e.sort((n,r)=>n.invocation.contains(r.invocation)?-1:r.invocation.contains(n.invocation)?1:0);for(let n of e){for(let r of n.context.slotInsertions){for(let o of r.nodes)Ce(o);r.anchor.replaceWith(...r.nodes)}n.replace&&n.invocation.replaceWith(n.nativeRoot),n.context.committed=!0,Kt.set(n.nativeRoot,n.instance),Lr(n.nativeRoot,n.instance),jr(n.nativeRoot,n.instance),Or(n.nativeRoot,n.instance),ln(n.instance)}}function Gt(t,e,n){t.nodeType===1&&t.matches(e)&&n.add(t);for(let r of t.querySelectorAll(e))n.add(r)}function Vr(t,e){let n=t.nodeType===1?t:void 0;if(n?.matches("[data-component]")===!0&&e(n),n?.childElementCount!==0)for(let r of t.querySelectorAll("[data-component]"))e(r)}function qr(t,e,n){let r=Jt(t),o=new Set,i=dr(r);for(let u of e)Gt(u,i,o);let a=[];for(let u of o)u.localName==="template"&&u.hasAttribute("component")&&!xe.has(u)&&a.push(lr(u,a.length));let s=new Map;for(let u of a){let p=u.definition.contract.tag;(r.definitions.has(p)||s.has(p))&&y("HR001",`More than one definition declares <${p}>.`),s.set(p,u)}let c=[],l=new Set,f=(u,p,m)=>{let{definition:w}=u;return xe.has(p)||t.defaultView?.customElements.get(w.contract.tag)!==void 0||n?.(p,w,m)===!1?!1:(c.push(Ir(p,w,m)),!0)},d=(u,p)=>{for(let m of p){let w=u.get(m.localName);if(w!==void 0&&f(w,m,!1),!m.hasAttribute("data-component"))continue;let C=Z(m);if(C!==void 0){C.frameworkOwned||l.add(m);continue}let k=!1;for(let g of new Set((m.getAttribute("data-component")??"").split(/\s+/))){let b=u.get(g);b!==void 0&&f(b,m,!0)&&(k=!0)}k&&l.add(m)}};if(d(r.definitions,o),s.size>0){let u=["[data-component]",...Array.from(s.keys())].join(","),p=new Set;Gt(t,u,p),d(s,p)}for(let u of a)Xt(r,u.definition.contract.tag,u),u.style!==void 0&&(u.style.textContent=Yt(u.style.textContent??"",u.definition,u.wrapper.ownerDocument),u.wrapper.ownerDocument.head.append(u.style)),u.wrapper.remove();zr(r,c);let h=c.map(u=>u.nativeRoot);for(let u of h)l.add(u);return{lowered:h,roots:Array.from(l)}}function Ur(t,e){let n=Qe(t),r=n.mutationHub;if(r===void 0){let i=t.defaultView?.MutationObserver;i===void 0&&y("HR003","Automatic component management requires a browser MutationObserver.");let a=new Set,s=new i(c=>{for(let l of Array.from(a))l(c)});r={observer:s,subscribers:a},n.mutationHub=r,s.observe(t,{childList:!0,subtree:!0})}r.subscribers.add(e);let o=!0;return()=>{o&&(o=!1,r.subscribers.delete(e),r.subscribers.size===0&&(r.observer.disconnect(),delete n.mutationHub))}}function ln(t){if(!t.connected){t.connected=!0;for(let e of t.effects)e.resume();for(let e of t.connectCallbacks)e();t.element?.dispatchEvent(new Event("connect"))}}function Zt(t){if(t.connected){t.element?.dispatchEvent(new Event("disconnect"));for(let e of t.disconnectCallbacks)e();t.connected=!1;for(let e of t.effects)e.pause()}}function et(t){let e=Z(t);if(e===void 0)return;if(e.host!==void 0)return e.host;let n=new Set((e.definition.declarations??[]).filter(a=>a.kind==="state").map(a=>a.name)),r=new Proxy({},{get:(a,s)=>{if(typeof s!="string")return;let c=e.scope.get(s);return c===E?void 0:c},set:(a,s,c)=>{if(typeof s!="string"||!n.has(s))throw new TypeError(`Only declared state roots are writable; \`${String(s)}\` is read-only.`);return e.scope.set(s,c),!0},has:(a,s)=>typeof s=="string"&&e.scope.has(s)}),o=new Proxy({},{get:(a,s)=>typeof s!="string"?void 0:(t instanceof HTMLFormElement?t:t.querySelector("form"))?.elements.namedItem(s)??t.querySelector(`[name="${CSS.escape(s)}"]`)??void 0}),i={element:t,state:r,refs:e.refs,elements:o,signal(a){return Pt(a)},computed(a){let s=jt(e.scope.scheduler,a);return e.connected||s.pause(),e.effects.unshift(s),s},effect(a){let s=F(e.scope.scheduler,a,2,e.connected);return e.effects.push(s),()=>s.stop()},on(a,s){if(a==="connect"){let c=s;return e.connectCallbacks.add(c),e.connected&&s(),()=>e.connectCallbacks.delete(c)}if(a==="disconnect"){let c=s;return e.disconnectCallbacks.add(c),()=>e.disconnectCallbacks.delete(c)}return t.addEventListener(a,s),()=>t.removeEventListener(a,s)},dispatch(a,s){return on(t,a,s,rn(e.definition,a))}};return e.host=Object.freeze(i),e.host}function un(t,e){let n=Z(t);n===void 0&&y("HJ003","A controller can attach only to a lowered component root."),n.controllerModule=e}function fn(t=document,e={}){let n=Qe(t);n.observer!==void 0&&y("HR003","This document is already being observed.");let r=new Map,o=e.onError??(d=>console.error(d)),i=!1,a=d=>{let h=r.get(d);r.delete(d);let u=Z(d);u!==void 0&&Zt(u);try{h?.()}catch(p){o(p)}},s=d=>{let h=Z(d);if(!(h===void 0||h.frameworkOwned||r.has(d)||!t.contains(d))){r.set(d,void 0);try{ln(h);let u=e.onConnect?.(d,h.definition);i?u?.():r.set(d,u)}catch(u){o(u)}}},c=d=>{if(i)return;let h=[];if(d===void 0)h.push(t);else{let u=[];for(let p of d){for(let m of p.removedNodes)m.nodeType===1&&Vr(m,w=>{r.has(w)&&u.push(w)});for(let m of p.addedNodes)m.nodeType===1&&h.push(m)}for(let p of u)t.contains(p)||a(p)}if(h.length>0)try{for(let u of qr(t,h,e.shouldLower).roots){if(i)break;s(u)}}catch(u){o(u)}};n.release=d=>{r.has(d)&&a(d)};let l=Ur(t,c),f=()=>{if(!i){i=!0,l(),delete n.observer,delete n.release;for(let d of r.values())try{d?.()}catch(h){o(h)}for(let d of r.keys()){let h=Z(d);h!==void 0&&Zt(h)}r.clear()}};return n.observer=f,c(),f}function Br(t){let e={};for(let n of t.querySelectorAll('script[type="importmap"]')){let r=JSON.parse(n.textContent??"{}");Object.assign(e,r.imports??{})}return{imports:e}}async function tt(t,e={}){let n=e.document??document,r=e.fetch??fetch,o=new he(e.importMap??Br(n),n.baseURI),i=await dt(t,{resolver:o,fetchComponent:async s=>{let c=await r(s);if(!c.ok)throw new TypeError(`Component request \`${s}\` failed with ${c.status}.`);return{url:c.url||s,source:await c.text()}},parseComponentResource:(s,c)=>Tt(s,c,n),isCustomElementRegistered:s=>n.defaultView?.customElements.get(s)!==void 0}),a=e.registry??new me;return a.addGraph(i,s=>At(s,e.importer)),Object.freeze({graph:i,registry:a})}function nt(t=document){return Object.freeze(Array.from(t.querySelectorAll('link[rel="component"][href]'),e=>e.getAttribute("href")).filter(e=>e.trim()!==""))}function rt(t=document,e={}){return tt(nt(t),{...e,document:t})}async function ot(t=document,e={}){let n=await rt(t,e);en(n.graph,t);let r=e.onError??(i=>console.error(i)),o=fn(t,{onError:r,onConnect(i,a){let s=n.registry.get(a.contract.tag)?.node;if(s?.controller===void 0)return;let c=_e(s,e.importer);un(i,c);let l=!1,f;return c.then(d=>l?void 0:d.default(et(i))).then(d=>{typeof d=="function"&&(l?d():f=d)}).catch(r),()=>{l=!0,f?.()}}});return Object.freeze({...n,stop:o})}var pn=Symbol.for("@nextwebwg/html-next/browser"),it=globalThis,mn=it[pn]??Object.freeze({ready:ot()});it[pn]=mn;var _r=mn.ready;it.HTMLNext??=Object.freeze({ready:_r,documentComponentRoots:nt,loadBrowserComponents:tt,loadDocumentComponents:rt,startBrowserComponents:ot});export{nt as documentComponentRoots,tt as loadBrowserComponents,rt as loadDocumentComponents,_r as ready,ot as startBrowserComponents};
|
|
7
|
+
`)}function Vt(t){if(typeof t=="string")return!0;if(t===null||typeof t!="object")return!1;if("enum"in t)return!0;let e=t;return e.kind==="union"?(e.members??[]).every(Vt):e.kind!=="list"&&e.kind!=="record"&&e.kind!=="object"}function dr(t,e,n){let r=new Set((t.declarations??[]).filter(o=>o.kind==="state").map(o=>o.name));for(let o of e){let i=t.contract.props[o];i===void 0&&!r.has(o)&&y("HY001",`\`:host-state()\` tests \`${o}\`, which is not a declared prop or state.`,n),i!==void 0&&!Vt(i.type)&&y("HY002",`\`:host-state()\` cannot test \`${o}\`, whose type is structured.`,n)}}function Ut(t,e,n,r){let o=e.contract.tag;if(t.trim()==="")return{css:"",stateNames:[]};let i=(n.defaultView??globalThis).CSSStyleSheet,a=tr(t),s=new Set,c=[],l=n.defaultView??globalThis,f=l.CSSStyleRule,d=l.CSSGroupingRule,h=new Map([...Object.keys(e.contract.props),...(e.declarations??[]).filter(g=>g.kind==="state").map(g=>g.name)].map(g=>[g.toLowerCase(),g])),u=g=>h.get(g.toLowerCase())??g,p=g=>{g.selectorText=ar(g.selectorText,o,":scope",s,u);for(let b of Array.from(g.cssRules??[]))b instanceof f&&p(b)},m=(g,b,v)=>{let R=g.cssRules;for(let T=0;T<R.length;){let A=R[T];A instanceof f?nr(A.selectorText)===b?(p(A),T+=1):g.deleteRule(T):A instanceof d?(m(A,b,!1),T+=1):(v&&b==="own"&&c.push(A.cssText),g.deleteRule(T))}},w=g=>{let b=new i;return b.replaceSync(a),m(b,g,!0),Array.from(b.cssRules,v=>v.cssText).join(`
|
|
8
|
+
`)},C=w("own"),k=w("slotted");return dr(e,s,r),{css:cr(o,C,k,c.join(`
|
|
9
|
+
`)),stateNames:[...s]}}function qt(t,e){let n=[];for(let r of t){let o=e(r);(o===!0||typeof o=="string"&&o.length>0||typeof o=="number"&&o!==0&&!Number.isNaN(o))&&n.push(r),(typeof o=="string"||typeof o=="number")&&n.push(`${r}=${encodeURIComponent(String(o))}`)}return n.join(" ")}var xe=new WeakSet,Jt=new WeakMap,Bt=new WeakMap,lr=Symbol.for("@nextwebwg/html-next.runtime.v1");function Ye(t){return t[lr]??={}}function K(t){return Jt.get(t)}function Qt(t){let e=Ye(t),n=e.registry;return(n===void 0||n.root!==t.documentElement)&&(n={root:t.documentElement,definitions:new Map,discoverySelector:void 0},e.registry=n),n}var Yt=new WeakMap;function Xt(t,e,n){let r=Ut(t,e,n);return Yt.set(e,r.stateNames),r.css}function en(t,e,n){t.definitions.set(e,n),t.discoverySelector!==void 0&&(t.discoverySelector+=`,${e}`)}function ur(t){return t.discoverySelector??=["template[component]","[data-component]",...Array.from(t.definitions.keys())].join(",")}function fr(t,e){let n=t.getAttribute("component")??"",r=`${t.ownerDocument.URL}#template[component="${n}"][${e+1}]`;t.hasAttribute("src")&&y("HL001","External definitions require the application-owned graph resolver.",r);let o=Be(t,r),i=Array.from(t.content.children).find(a=>a.localName==="style");return{wrapper:t,style:i,definition:o}}function tn(t,e=document){let n=Qt(e),r=0;for(let o of t.nodes.values()){if(o.shadowedByCustomElement)continue;let i=o.definition.contract.tag;n.definitions.has(i)&&y("HR001",`More than one definition declares <${i}>.`);let a=o.definition.css===""?void 0:e.createElement("style");a!==void 0&&(a.textContent=Xt(o.definition.css,o.definition,e),e.head.append(a)),en(n,i,{definition:o.definition,style:a}),r+=1}return r}function Xe(t,e,n=!1){let r=t.type==="boolean"&&n&&e===""?!0:e,o=_(r,t.type);if(!o.ok){let i=o.issues.map(a=>`${a.path}: ${a.message}`).join("; ");y("HR002",`A prop invocation value does not satisfy its declared type. ${i}`)}return o.value}function pr(t,e,n){return n!==void 0?Xe(e,n):(e.required&&y("HC020",`Required prop \`${t}\` was not provided.`),e.default===void 0?E:e.default)}function mr(t,e){let n=Bt.get(t);if(n===void 0){let r=Object.create(null),o=Object.create(null);for(let i of Object.keys(t.contract.props)){let a=Re(i);r[a]=i,o[`data-${a}`]=i,a!==i.toLowerCase()&&(o[`data-${i.toLowerCase()}`]=i)}n=[r,o],Bt.set(t,n)}return n[e?1:0]}function hr(t,e,n=!1){let r=e.contract,o=mr(e,n),i=Object.create(null),a=[],s;for(let p of Array.from(t.attributes)){if(p.name.toLowerCase()==="as"&&e.root?.kind==="native"){s=p.value.toLowerCase();continue}let m=o[p.name.toLowerCase()];if(m===void 0){n||a.push(p);continue}i[m]=Xe(r.props[m],p.value,!n)}let c=e.root?.kind==="native"?n?t.localName:s??e.root.element:e.template.name;e.root?.kind==="native"&&!e.root.choices.includes(c)&&y(n?"HR005":"HR002",`<${r.tag}> cannot use root <${c}>; expected one of ${e.root.choices.join(", ")}.`);let l=new Set(Object.keys(i).filter(p=>i[p]!==void 0)),f=new ve;for(let[p,m]of Object.entries(r.props))m.required&&i[p]===void 0&&y("HC020",`Required prop \`${p}\` was not provided.`),f.set(p,i[p]!==void 0?i[p]:m.default===void 0?E:m.default);let d=e.declarations??[];for(let p of d)(p.kind==="state"||p.kind==="computed"||p.kind==="data")&&f.set(p.name,null);for(let p of d)p.kind==="data"?f.set(p.name,{pending:!0,value:null,error:null,ok:!1}):p.kind==="state"&&f.set(p.name,p.expression===void 0?null:D(p.expression.source,f));let h=[];for(let p of d)p.kind!=="computed"||p.expression===void 0||h.push(f.defineComputed(p.name,()=>I(p.expression,f)));let u=(()=>{try{return new URL(e.source.file,t.ownerDocument.baseURI).href}catch{return t.ownerDocument.baseURI}})();for(let p of d){if(p.kind!=="data"||p.source===void 0)continue;let m=p,w=p.source,C=new ye({source:w,baseURL:u,...m.type===void 0?{}:{type:m.type},...m.debounce===void 0?{}:{debounce:Number(m.debounce)},...m.poll===void 0?{}:{poll:Number(m.poll)},onState:k=>f.set(m.name,k)});h.push(G(f.scheduler,()=>{let k=Object.fromEntries(m.parameters.map(g=>[g.name,I(g.expression,f)]));return C.update(k),()=>C.disconnect()},0))}return{scope:f,passThrough:a,effects:h,rootName:c,explicit:l}}function Qe(t,e){return t.fork(Object.entries(e))}function D(t,e){try{return ht(t,e)}catch(n){throw n instanceof ee&&y("HB001",n.message),n}}var ie="http://www.w3.org/2000/svg",_t=new Map;function yr(t,e){if(t.namespaceURI!==ie)return e;let n=_t.get(e);if(n===void 0){let r=t.ownerDocument.createElement("template");r.innerHTML=`<svg ${e}>`,n=r.content.firstChild.attributes[0]?.name??e,_t.set(e,n)}return n}function nn(t,e,n){return e==="svg"||n.namespace===ie?t.createElementNS(ie,e):t.createElement(e)}function gr(t,e){let n=t.namespaceURI===ie&&t.localName!=="foreignObject"?ie:void 0;return n===e.namespace?e:Object.create(e,{namespace:{value:n,enumerable:!0}})}function U(t,e,n,r=1){t.effects.push(G(e.scheduler,n,r))}function rn(t,e,n){let[r,...o]=e;if(typeof r!="string")return;if(o.length===0){t.set(r,n);return}let i=t.get(r);for(let c=0;c<o.length-1;c+=1){let l=o[c],f=typeof l=="object"?I(l.expression,t):l;if(typeof f!="string"&&typeof f!="number"||i==null)return;i=i[f]}let a=o.at(-1),s=typeof a=="object"?I(a.expression,t):a;(typeof s=="string"||typeof s=="number")&&i!=null&&(i[s]=n)}function br(t){return t instanceof HTMLInputElement?t.type==="checkbox"||t.type==="radio"?t.checked:t.type==="number"||t.type==="range"?Number.isNaN(t.valueAsNumber)?null:t.valueAsNumber:t.value:t instanceof HTMLSelectElement?t.multiple?Array.from(t.selectedOptions,e=>e.value):t.value:t instanceof HTMLTextAreaElement?t.value:t.value??t.getAttribute("value")}function wr(t,e,n){let r=e.toLowerCase();if(r==="checked"&&t instanceof HTMLInputElement)return t.checked=j(n),!0;if(r==="value"&&t instanceof HTMLSelectElement&&t.multiple){let o=new Set(Array.isArray(n)?n.map(String):[]);for(let i of Array.from(t.options))i.selected=o.has(i.value);return!0}return r==="value"&&(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement)?(t.value=n==null?"":String(n),!0):!1}function vr(t,e,n,r){for(let o of t.steps)if(!(o.guard!==void 0&&!j(I(o.guard,n))))if(o.kind==="set")rn(n,o.writablePath,I(o.value,n));else if(o.kind==="dispatch"){let i=on(r.definition,o.event),a=o.value===void 0?void 0:I(o.value,n);i!==void 0&&a!==void 0&&(_(a,de(i.type)).ok||y("HR002",`Event \`${o.event}\` detail does not satisfy its declared type.`)),sn(r.root??e,o.event,a,i)}else{let i=r.refs[o.target];o.kind==="focus"?i?.focus():i?.reportValidity?.()}}function on(t,e){return(t.declarations??[]).find(n=>n.kind==="event"&&n.name===e)}function sn(t,e,n,r){return t.dispatchEvent(new CustomEvent(e,{detail:n,bubbles:r?.bubbles??!0,composed:r?.composed??!0,cancelable:r?.cancelable??!1}))}function kr(t,e,n){if(n.includes("self")&&t.target!==e)return!1;if(t instanceof MouseEvent){let o=n.filter(a=>["left","middle","right"].includes(a)),i={left:0,middle:1,right:2};if(o.length>0&&!o.some(a=>t.button===i[a]))return!1}let r=["ctrl","shift","alt","meta"];for(let o of r)if(n.includes(o)&&!t[`${o}Key`])return!1;if(n.includes("exact")&&r.some(o=>!n.includes(o)&&t[`${o}Key`]))return!1;if(t instanceof KeyboardEvent){let o=n.filter(a=>["enter","escape","space","tab","up","down","left","right"].includes(a)),i={enter:"Enter",escape:"Escape",space:" ",tab:"Tab",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight"};if(o.length>0&&!o.some(a=>t.key===i[a]))return!1}return!0}function Wt(t,e,n,r){for(let o of e.events??[]){let i=(r.definition.declarations??[]).find(s=>s.kind==="handler"&&s.name===o.handler),a=s=>{kr(s,t,o.modifiers)&&(o.modifiers.includes("prevent")&&s.preventDefault(),o.modifiers.includes("stop")&&s.stopPropagation(),vr(i,t,n,r))};if(o.name==="connect"||o.name==="disconnect"){(o.name==="connect"?r.connectCallbacks:r.disconnectCallbacks).add(()=>a(new Event(o.name)));continue}U(r,n,()=>(t.addEventListener(o.name,a,{capture:o.modifiers.includes("capture"),passive:o.modifiers.includes("passive"),once:o.modifiers.includes("once")}),()=>t.removeEventListener(o.name,a,{capture:o.modifiers.includes("capture")})),2)}}function Cr(t,e,n){e=yr(t,e),n===null||ne(e)&&te(n)?t.removeAttribute(e):t.setAttribute(e,n)}function xr(t,e,n,r){let o=D(e.expression,n);e.name==="value"?t.textContent=P(o):t.replaceChildren(je(P(o),r,i=>xe.add(i)))}function Er(t,e,n){let r=D(t.expression,e);return t.name==="value"?n.createTextNode(P(r)):je(P(r),n,o=>xe.add(o))}function Rr(t,e){return typeof t=="number"&&typeof e=="number"?t-e:P(t).localeCompare(P(e))}function Tr(t,e,n){let r=t.slice();if(e.where!==void 0){let o=e.where;r=r.filter(i=>j(D(o,Qe(n,{[e.item]:i}))))}if(e.sort!==void 0){let o=e.sort.split(",").map(a=>a.trim()).filter(a=>a!==""),i=(a,s)=>a!==null&&typeof a=="object"&&!Array.isArray(a)?D(`${e.item}.${s}`,Qe(n,{[e.item]:a})):a;r.sort((a,s)=>{for(let c of o){let l=c.startsWith("-"),f=l?c.slice(1).trim():c,d=Rr(i(a,f),i(s,f));if(d!==0)return l?-d:d}return 0})}if(e.limit!==void 0){let o=D(e.limit,n);typeof o=="number"&&(r=r.slice(0,Math.max(0,Math.trunc(o))))}return r}function an(t,e){let n=e.createDocumentFragment();return n.append(...t),Array.from(n.childNodes)}function Sr(t,e){let n=t.nextSibling;for(;n!==null&&n!==e;){let r=n.nextSibling;n.remove(),n=r}}function Nr(t,e,n,r,o){if(t.flow?.kind==="each")return Dr(t,e,n,r,o);let i=n.createComment("html-next:start"),a=n.createComment("html-next:end"),s=n.createDocumentFragment();s.append(i,a);let c=[];return U(o,e,()=>{for(let d of c)d.stop();c=[],Sr(i,a);let l=o.effects.length,f=[];if(t.flow?.kind==="if"){if(j(D(t.flow.test,e))){let{flow:d,...h}=t;f=se(h,e,n,r,o)}}else if(t.flow?.kind==="with"){let d=e.fork([[t.flow.alias,D(t.flow.expr,e)]]),{flow:h,...u}=t;f=se(u,d,n,r,o)}else t.flow?.kind==="match"&&(f=Mr(t,e,n,o));c=o.effects.slice(l),a.before(...an(f,n))}),[s]}function $r(t,e){if(t.end.nextSibling===e)return;let n=[],r=t.start;for(;r!==null&&(n.push(r),r!==t.end);)r=r.nextSibling;let o=e.parentNode;if(o===null)return;let i=o.moveBefore;for(let a of n)i===void 0?o.insertBefore(a,e):i.call(o,a,e)}function Ar(t){for(let n of t.effects)n.stop();let e=t.start;for(;e!==null;){let n=e.nextSibling;if(e.parentNode?.removeChild(e),e===t.end)break;e=n}}function Hr(t){let e=-1,n=!0;for(let s of t)s<0||(s<e&&(n=!1),e=s);if(n)return;let r=[],o=new Int32Array(t.length).fill(-1);for(let s=0;s<t.length;s+=1){let c=t[s];if(c<0)continue;let l=0,f=r.length;for(;l<f;){let d=l+f>>>1;t[r[d]]<c?l=d+1:f=d}l>0&&(o[s]=r[l-1]),r[l]=s}let i=new Uint8Array(t.length),a=r.at(-1)??-1;for(;a>=0;)i[a]=1,a=o[a];return i}function Dr(t,e,n,r,o){let i=t.flow,a=n.createComment("html-next:each-start"),s=n.createComment("html-next:each-end"),c=n.createDocumentFragment();c.append(a,s);let l=new Map;return U(o,e,()=>{let f=D(i.list,e),d=Array.isArray(f)?Tr(f,i,e):[],h=new Map,u=i.key!==void 0,p=u?[]:void 0,m;if(u){m=new Map;let g=0;for(let b of l.keys())m.set(b,g++)}let w=u?[]:void 0,{flow:C,...k}=t;for(let g=0;g<d.length;g+=1){let b=d[g],v={[i.item]:b,loop:{index:g,first:g===0,last:g===d.length-1,count:d.length}};i.index!==void 0&&(v[i.index]=g);let R,T=g;i.key!==void 0&&(R=e.fork(Object.entries(v)),T=D(i.key,R)),h.has(T)&&y("HR004",`A keyed list produced duplicate key \`${P(T)}\`.`);let A=l.get(T);if(A===void 0){R??=e.fork(Object.entries(v));let M=o.effects.length,ae=an(se(k,R,n,r,o),n),at=n.createComment("html-next:item-start"),ct=n.createComment("html-next:item-end");s.before(at,...ae,ct),A={start:at,end:ct,scope:R,effects:o.effects.slice(M)}}else A.scope.set(i.item,b),i.index!==void 0&&A.scope.set(i.index,g),A.scope.set("loop",v.loop);h.set(T,A),p?.push(A),w?.push(m?.get(T)??-1)}for(let[g,b]of l)h.has(g)||Ar(b);if(p!==void 0&&w!==void 0){let g=Hr(w),b=s;for(let v=p.length-1;v>=0;v-=1){let R=p[v];(w[v]<0||g!==void 0&&g[v]!==1)&&$r(R,b),b=R.start}}l=h}),[c]}function cn(t,e,n,r,o,i){return t.flow?.kind==="if"||t.flow?.kind==="each"||t.flow?.kind==="with"||t.flow?.kind==="match"?o.committed&&o.frameworkOwned&&i!==void 0?[i]:Nr(t,e,n,r,o):se(t,e,n,r,o,i)}function Mr(t,e,n,r){let o=t.flow,i=o.expr!==void 0?Qe(e,{[o.alias]:D(o.expr,e)}):e,a;for(let d of t.children)if(d.kind==="element"){if(d.flow?.kind==="when"&&j(D(d.flow.test,i))){a=d;break}if(d.flow?.kind==="else"){a=d;break}}if(a===void 0)return[];let{flow:s,...c}=a,l=se(c,i,n,[],r);if(t.name==="template")return l;let f=nn(n,t.name,r);for(let d of t.attributes)d.kind==="literal"&&f.setAttribute(d.name,d.value);return f.append(...l),[f]}function se(t,e,n,r,o,i){let a=t.attributes.find(m=>m.kind==="directive");if(t.name==="template"){if(a!==void 0){let m=n.createTextNode("");return U(o,e,()=>{let w=D(a.expression,e);a.name==="value"&&(m.data=P(w))}),a.name==="value"?[m]:[Er(a,e,n)]}return dn(t.children,e,n,o)}let s=t===o.definition.template?o.rootName:t.name;if(o.frameworkOwned&&i instanceof Element&&i.localName!==s&&(i.getAttribute("data-component")??"").split(/\s+/).includes(t.name))return[i];if(o.hydrationRanges!==void 0&&!o.frameworkOwned&&i instanceof Element&&i.localName!==s&&(i.getAttribute("data-component")??"").split(/\s+/).includes(t.name)){let m=et(i,!1),w=b=>b.kind==="element"?b.attributes.find(v=>v.kind==="literal"&&v.name==="slot")?.value??"":"",C=m?.ranges.filter(b=>!b.fallback)??[],k=(b,v)=>{let R=0;for(let T of b)R+=Ee(T,e,n,o,v[R]).length};for(let b of C)k(t.children.filter(v=>w(v)===b.slot),b.content);let g=new Set(C.map(b=>b.slot));return k(t.children.filter(b=>!g.has(w(b))),m?.carried??[]),[i]}let c=i instanceof Element&&i.localName===s,l=c?i:nn(n,s,o);t===o.definition.template&&(o.root=l);let f=c?Array.from(l.childNodes):[],d=c&&(l instanceof HTMLInputElement||l instanceof HTMLTextAreaElement||l instanceof HTMLSelectElement)?{value:l.value,focused:l.ownerDocument.activeElement===l,...l instanceof HTMLInputElement?{checked:l.checked}:{},...l instanceof HTMLInputElement||l instanceof HTMLTextAreaElement?{selectionStart:l.selectionStart,selectionEnd:l.selectionEnd}:{}}:void 0;t.ref!==void 0&&(o.refs[t.ref]=l);for(let m of t.attributes)m.kind==="literal"&&l.setAttribute(m.name,m.value);for(let m of r){let w=m.name==="class"||m.name==="style"?l.getAttribute(m.name):null;l.setAttribute(m.name,w===null||w===""?m.value:`${w}${m.name==="class"?" ":"; "}${m.value}`)}for(let m of t.attributes)if(m.kind==="attribute"){if(U(o,e,()=>{let w=D(m.expression,e);m.target==="class"?l.classList.toggle(m.name,j(w)):m.target==="style"?l.style.setProperty(m.name,P(w)):m.twoWay===!0&&wr(l,m.name,w)||Cr(l,m.name,yt(w,m.name))}),m.twoWay===!0&&m.writablePath!==void 0){let w=l instanceof HTMLSelectElement||l instanceof HTMLInputElement&&["checkbox","radio","file"].includes(l.type)?"change":"input",C=()=>{l instanceof HTMLInputElement&&l.type==="radio"&&!l.checked||rn(e,m.writablePath,br(l))};U(o,e,()=>(l.addEventListener(w,C),()=>l.removeEventListener(w,C)),2)}}else m.kind==="property"&&U(o,e,()=>{l[m.name]=D(m.expression,e)});if(a!==void 0)return U(o,e,()=>xr(l,a,e,n)),Wt(l,t,e,o),[l];let h=[],u=0,p=gr(l,o);for(let m of t.children){let w=u;if(o.frameworkOwned&&m.kind==="element"){let k=f.findIndex((g,b)=>b<u?!1:g instanceof Element&&(g.localName===m.name||(g.getAttribute("data-component")??"").split(/\s+/).includes(m.name)));k<0&&m.flow!==void 0&&(k=f.findIndex((g,b)=>b>=u&&g instanceof Comment)),k>=0&&(w=k)}let C=Ee(m,e,n,p,f[w]);h.push(...C),u=w+C.length}if(c&&!o.frameworkOwned){h=h.flatMap(m=>m.nodeType===11?Array.from(m.childNodes):[m]);for(let m=0;m<h.length;m+=1){let w=h[m];l.childNodes[m]!==w&&l.insertBefore(w,l.childNodes[m]??null)}for(;l.childNodes.length>h.length;)l.lastChild.remove()}else c||l.append(...h);return d!==void 0&&(l.value=d.value,l instanceof HTMLInputElement&&"checked"in d&&(l.checked=d.checked),(l instanceof HTMLInputElement||l instanceof HTMLTextAreaElement)&&"selectionStart"in d&&typeof d.selectionStart=="number"&&typeof d.selectionEnd=="number"&&(d.focused&&l.focus({preventScroll:!0}),l.setSelectionRange(d.selectionStart,d.selectionEnd))),Wt(l,t,e,o),[l]}function dn(t,e,n,r){let o=[];for(let i of t)o.push(...Ee(i,e,n,r));return o}function Pr(t,e){return e.projectedSlotNames.get(t)??(t instanceof Element?t.getAttribute("slot")??"":"")}function Lr(t,e,n,r){let o=t.nameExpression===void 0?t.name??"":P(I(t.nameExpression,e)),i=r.projectedNodes.filter(d=>Pr(d,r)===o),a=r.hydrationRanges?.shift();if(a!==void 0){if(a.fallback){let d=[],h=0;for(let u of t.fallback??[]){let p=Ee(u,e,n,r,a.content[h]);d.push(...p),h+=p.length}return[a.markers[0],...d,...a.markers.slice(1)]}for(let d of a.content)Ce(d);return a.markers.length===1?[a.markers[0]]:[a.markers[0],...a.content,a.markers[1]]}let s=d=>`"${d.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}"`,c=(d,h)=>jr(n,d,h),l=(d,h)=>{if(d.length===0)return[c("marker",`slot=${s(o)}`)];let u=`slot=${s(o)}${h?' fallback=""':""}`;return[c("start",u),...d,c("end","")]};if(i.length===0)return l(dn(t.fallback??[],e,n,r),!0);if(r.committed){for(let d of i)Ce(d);return l([...i],!1)}let f=n.createComment(`html-next:slot:${o}`);return r.slotInsertions.push({anchor:f,nodes:i}),l([f],!1)}function Ft(t){let e=new Map,n=t.trim(),r={amp:"&",lt:"<",gt:">",quot:'"',apos:"'"};for(;n!=="";){let o=/^([A-Za-z_:][-A-Za-z0-9._:]*)\s*=\s*(?:"([^"<]*)"|'([^'<]*)')(?:\s+|$)/.exec(n);if(o===null||e.has(o[1]))return new Map;let i=(o[2]??o[3]).replace(/&(#x[0-9a-fA-F]+|#\d+|amp|lt|gt|quot|apos);/g,(a,s)=>s.startsWith("#x")?String.fromCodePoint(parseInt(s.slice(2),16)):s.startsWith("#")?String.fromCodePoint(Number(s.slice(1))):r[s]);e.set(o[1],i),n=n.slice(o[0].length)}return e}var Gt=new WeakMap;function ln(t){let e=Gt.get(t);if(e===void 0){let n=t.createElement("div");n.innerHTML='<?probe x="1"?>',e=n.firstChild?.nodeType===7,Gt.set(t,e)}return e}function jr(t,e,n){return ln(t)?t.createProcessingInstruction(e,n):t.createComment(`?${e}${n===""?"":` ${n}`}?`)}function Je(t){if(t.nodeType===7){let n=t;return{target:n.target,attributes:Ft(n.data)}}if(t.nodeType!==8||ln(t.ownerDocument))return;let e=/^\?([A-Za-z][-A-Za-z0-9]*)(?:\s+([\s\S]*?))?\s*\??$/.exec(t.data);return e===null?void 0:{target:e[1],attributes:Ft(e[2]??"")}}function et(t,e=!0){let n=[],r=new Set,o=(s,c)=>{for(let l=0;l<s.length;l+=1){let f=s[l],d=Je(f);if(d?.target==="marker"&&d.attributes.has("slot")){c.push({slot:d.attributes.get("slot"),fallback:!1,markers:[f],content:[]});continue}if(d?.target==="start"){let h=1,u=[],p;for(l+=1;l<s.length;l+=1){let m=Je(s[l]);if(m?.target==="start")h+=1;else if(m?.target==="end"&&--h===0){p=s[l];break}u.push(s[l])}if(d.attributes.has("slot")){c.push({slot:d.attributes.get("slot"),fallback:d.attributes.has("fallback"),markers:p?[f,p]:[f],content:u});for(let m of u)r.add(m)}else o(u,c);continue}if(f instanceof Element)if(f!==t&&f.hasAttribute("data-component")){let h=et(f,!1);for(let u of h?.ranges??[])o(u.content,c)}else o(Array.from(f.childNodes),c)}};o(Array.from(t.childNodes),n);let i=Array.from(t.children).find(s=>s instanceof HTMLTemplateElement&&!r.has(s)&&s.previousSibling!==null&&Je(s.previousSibling)?.target==="carrier");if(n.length===0&&i===void 0)return;let a=[];if(i!==void 0&&e){for(let s of Array.from(i.content.childNodes))a.push(t.ownerDocument.adoptNode(s));i.previousSibling.remove(),i.remove()}else i!==void 0&&a.push(...Array.from(i.content.childNodes));return{ranges:n,carried:a}}function Ee(t,e,n,r,o){if(t.kind==="text"){let i=o instanceof Text?o:n.createTextNode("");return i.data=t.value,[i]}return t.kind==="slot"?Lr(t,e,n,r):cn(t,e,n,[],r,o)}function Or(t,e){let n=Yt.get(e.definition)??[];if(n.length===0)return;let r=Ke(e.definition.contract.tag);e.effects.push(G(e.scope.scheduler,()=>{let o=qt(n,i=>e.scope.get(i));o===""?t.removeAttribute(r):t.getAttribute(r)!==o&&t.setAttribute(r,o)},2))}function Ir(t,e){let n=e.definition.contract.props,r={},o={};for(let[f,d]of Object.entries(n)){let h=`data-${Re(f)}`;r[h]=f;let u=e.definition.template.attributes.some(p=>p.kind==="attribute"&&p.name===h);e.effects.push(G(e.scope.scheduler,()=>{let p=e.scope.get(f);if(!u&&!e.explicit.has(f))return;let m=p===void 0||p===E||p===null?null:Ae(p,d.type);o[h]=m,m===null?t.removeAttribute(h):t.setAttribute(h,m)},2))}let i=t.ownerDocument.defaultView?.MutationObserver,a=Object.keys(r);if(i===void 0||a.length===0)return;let s=new i(f=>{for(let d of f){let h=d.attributeName;if(h===null)continue;let u=r[h];if(u===void 0)continue;let p=t.getAttribute(h);if(h in o&&o[h]===p){delete o[h];continue}delete o[h];let m=n[u];p===null?e.explicit.delete(u):e.explicit.add(u),e.scope.set(u,p===null?pr(u,m,void 0):Xe(m,p,!0))}}),c=()=>s.observe(t,{attributes:!0,attributeFilter:a}),l=()=>s.disconnect();e.connectCallbacks.add(c),e.disconnectCallbacks.add(l)}function zr(t,e){for(let n of e.definition.declarations??[])n.kind==="method"&&Object.defineProperty(t,n.name,{configurable:!0,enumerable:!1,value:(...r)=>e.controllerModule===void 0?Promise.reject(new TypeError(`Controller method \`${n.name}\` is not ready for <${e.definition.contract.tag}>.`)):e.controllerModule.then(o=>{let i=o[n.exportName];return typeof i!="function"&&y("HJ003",`Controller does not export method \`${n.exportName}\`.`),Reflect.apply(i,void 0,[tt(t),...r])})})}function Vr(t,e,n,r,o=new WeakMap,i=!1){let a=n&&t.contains(t.ownerDocument.activeElement)?t.ownerDocument.activeElement:null,s=a instanceof HTMLInputElement||a instanceof HTMLTextAreaElement?[a.selectionStart,a.selectionEnd]:void 0,{scope:c,passThrough:l,effects:f,rootName:d,explicit:h}=hr(t,e,n),u=r,p;if(n&&u===void 0){let b=et(t);if(b!==void 0){p=b.ranges;let v=[];for(let R of b.ranges)if(!R.fallback)for(let T of R.content)o.set(T,R.slot),v.push(T);v.push(...b.carried),u=v}else(e.slots??[]).length>0?y("HR005",`<${e.contract.tag}> has slots but its server-rendered root has no slot marks.`):u=[]}let m=n?u:Array.from(t.childNodes),w={definition:e,scope:c,refs:{},effects:f,connectCallbacks:new Set,disconnectCallbacks:new Set,connected:!1,explicit:h,frameworkOwned:i,projection:{nodes:n?u:Array.from(t.childNodes),slotNames:o}},C={definition:e,effects:f,refs:w.refs,connectCallbacks:w.connectCallbacks,disconnectCallbacks:w.disconnectCallbacks,projectedNodes:m,projectedSlotNames:o,slotInsertions:[],rootName:d,frameworkOwned:i,committed:n,hydrationRanges:p},k=cn(e.template,c,t.ownerDocument,l,C,n?t:void 0);C.hydrationRanges=void 0;let g=k[0];return n&&g!==t&&y("HR005",`Server markup for <${e.contract.tag}> has an incompatible root.`),a instanceof HTMLElement&&(a.focus({preventScroll:!0}),s!==void 0&&(a instanceof HTMLInputElement||a instanceof HTMLTextAreaElement)&&typeof s[0]=="number"&&typeof s[1]=="number"&&a.setSelectionRange(s[0],s[1])),zt(g,Z,e.contract.tag),w.element=g,{invocation:t,nativeRoot:g,context:C,definition:e,instance:w,replace:!n}}function Ur(t,e){e.sort((n,r)=>n.invocation.contains(r.invocation)?-1:r.invocation.contains(n.invocation)?1:0);for(let n of e){for(let r of n.context.slotInsertions){for(let o of r.nodes)Ce(o);r.anchor.replaceWith(...r.nodes)}n.replace&&n.invocation.replaceWith(n.nativeRoot),n.context.committed=!0,Jt.set(n.nativeRoot,n.instance),Ir(n.nativeRoot,n.instance),Or(n.nativeRoot,n.instance),zr(n.nativeRoot,n.instance),un(n.instance)}}function Zt(t,e,n){t.nodeType===1&&t.matches(e)&&n.add(t);for(let r of t.querySelectorAll(e))n.add(r)}function qr(t,e){let n=t.nodeType===1?t:void 0;if(n?.matches("[data-component]")===!0&&e(n),n?.childElementCount!==0)for(let r of t.querySelectorAll("[data-component]"))e(r)}function Br(t,e,n){let r=Qt(t),o=new Set,i=ur(r);for(let u of e)Zt(u,i,o);let a=[];for(let u of o)u.localName==="template"&&u.hasAttribute("component")&&!xe.has(u)&&a.push(fr(u,a.length));let s=new Map;for(let u of a){let p=u.definition.contract.tag;(r.definitions.has(p)||s.has(p))&&y("HR001",`More than one definition declares <${p}>.`),s.set(p,u)}let c=[],l=new Set,f=(u,p,m)=>{let{definition:w}=u;return xe.has(p)||t.defaultView?.customElements.get(w.contract.tag)!==void 0||n?.(p,w,m)===!1?!1:(c.push(Vr(p,w,m)),!0)},d=(u,p)=>{for(let m of p){let w=u.get(m.localName);if(w!==void 0&&f(w,m,!1),!m.hasAttribute("data-component"))continue;let C=K(m);if(C!==void 0){C.frameworkOwned||l.add(m);continue}let k=!1;for(let g of new Set((m.getAttribute("data-component")??"").split(/\s+/))){let b=u.get(g);b!==void 0&&f(b,m,!0)&&(k=!0)}k&&l.add(m)}};if(d(r.definitions,o),s.size>0){let u=["[data-component]",...Array.from(s.keys())].join(","),p=new Set;Zt(t,u,p),d(s,p)}for(let u of a)en(r,u.definition.contract.tag,u),u.style!==void 0&&(u.style.textContent=Xt(u.style.textContent??"",u.definition,u.wrapper.ownerDocument),u.wrapper.ownerDocument.head.append(u.style)),u.wrapper.remove();Ur(r,c);let h=c.map(u=>u.nativeRoot);for(let u of h)l.add(u);return{lowered:h,roots:Array.from(l)}}function _r(t,e){let n=Ye(t),r=n.mutationHub;if(r===void 0){let i=t.defaultView?.MutationObserver;i===void 0&&y("HR003","Automatic component management requires a browser MutationObserver.");let a=new Set,s=new i(c=>{for(let l of Array.from(a))l(c)});r={observer:s,subscribers:a},n.mutationHub=r,s.observe(t,{childList:!0,subtree:!0})}r.subscribers.add(e);let o=!0;return()=>{o&&(o=!1,r.subscribers.delete(e),r.subscribers.size===0&&(r.observer.disconnect(),delete n.mutationHub))}}function un(t){if(!t.connected){t.connected=!0;for(let e of t.effects)e.resume();for(let e of t.connectCallbacks)e();t.element?.dispatchEvent(new Event("connect"))}}function Kt(t){if(t.connected){t.element?.dispatchEvent(new Event("disconnect"));for(let e of t.disconnectCallbacks)e();t.connected=!1;for(let e of t.effects)e.pause()}}function tt(t){let e=K(t);if(e===void 0)return;if(e.host!==void 0)return e.host;let n=new Set((e.definition.declarations??[]).filter(a=>a.kind==="state").map(a=>a.name)),r=new Proxy({},{get:(a,s)=>{if(typeof s!="string")return;let c=e.scope.get(s);return c===E?void 0:c},set:(a,s,c)=>{if(typeof s!="string"||!n.has(s))throw new TypeError(`Only declared state roots are writable; \`${String(s)}\` is read-only.`);return e.scope.set(s,c),!0},has:(a,s)=>typeof s=="string"&&e.scope.has(s)}),o=new Proxy({},{get:(a,s)=>typeof s!="string"?void 0:(t instanceof HTMLFormElement?t:t.querySelector("form"))?.elements.namedItem(s)??t.querySelector(`[name="${CSS.escape(s)}"]`)??void 0}),i={element:t,state:r,refs:e.refs,elements:o,signal(a){return Lt(a)},computed(a){let s=jt(e.scope.scheduler,a);return e.connected||s.pause(),e.effects.unshift(s),s},effect(a){let s=G(e.scope.scheduler,a,2,e.connected);return e.effects.push(s),()=>s.stop()},on(a,s){if(a==="connect"){let c=s;return e.connectCallbacks.add(c),e.connected&&s(),()=>e.connectCallbacks.delete(c)}if(a==="disconnect"){let c=s;return e.disconnectCallbacks.add(c),()=>e.disconnectCallbacks.delete(c)}return t.addEventListener(a,s),()=>t.removeEventListener(a,s)},dispatch(a,s){return sn(t,a,s,on(e.definition,a))}};return e.host=Object.freeze(i),e.host}function fn(t,e){let n=K(t);n===void 0&&y("HJ003","A controller can attach only to a lowered component root."),n.controllerModule=e}function pn(t=document,e={}){let n=Ye(t);n.observer!==void 0&&y("HR003","This document is already being observed.");let r=new Map,o=e.onError??(d=>console.error(d)),i=!1,a=d=>{let h=r.get(d);r.delete(d);let u=K(d);u!==void 0&&Kt(u);try{h?.()}catch(p){o(p)}},s=d=>{let h=K(d);if(!(h===void 0||h.frameworkOwned||r.has(d)||!t.contains(d))){r.set(d,void 0);try{un(h);let u=e.onConnect?.(d,h.definition);i?u?.():r.set(d,u)}catch(u){o(u)}}},c=d=>{if(i)return;let h=[];if(d===void 0)h.push(t);else{let u=[];for(let p of d){for(let m of p.removedNodes)m.nodeType===1&&qr(m,w=>{r.has(w)&&u.push(w)});for(let m of p.addedNodes)m.nodeType===1&&h.push(m)}for(let p of u)t.contains(p)||a(p)}if(h.length>0)try{for(let u of Br(t,h,e.shouldLower).roots){if(i)break;s(u)}}catch(u){o(u)}};n.release=d=>{r.has(d)&&a(d)};let l=_r(t,c),f=()=>{if(!i){i=!0,l(),delete n.observer,delete n.release;for(let d of r.values())try{d?.()}catch(h){o(h)}for(let d of r.keys()){let h=K(d);h!==void 0&&Kt(h)}r.clear()}};return n.observer=f,c(),f}function Wr(t){let e={};for(let n of t.querySelectorAll('script[type="importmap"]')){let r=JSON.parse(n.textContent??"{}");Object.assign(e,r.imports??{})}return{imports:e}}async function nt(t,e={}){let n=e.document??document,r=e.fetch??fetch,o=new he(e.importMap??Wr(n),n.baseURI,n.URL),i=await lt(t,{resolver:o,fetchComponent:async s=>{let c=await r(s);if(!c.ok)throw new TypeError(`Component request \`${s}\` failed with ${c.status}.`);return{url:c.url||s,source:await c.text()}},parseComponentResource:(s,c)=>St(s,c,n),isCustomElementRegistered:s=>n.defaultView?.customElements.get(s)!==void 0}),a=e.registry??new me;return a.addGraph(i,s=>Ht(s,e.importer)),Object.freeze({graph:i,registry:a})}function rt(t=document){return Object.freeze(Array.from(t.querySelectorAll('link[rel="component"][href]'),e=>e.getAttribute("href")).filter(e=>e.trim()!==""))}function ot(t=document,e={}){return nt(rt(t),{...e,document:t})}async function it(t=document,e={}){let n=await ot(t,e);tn(n.graph,t);let r=e.onError??(i=>console.error(i)),o=pn(t,{onError:r,onConnect(i,a){let s=n.registry.get(a.contract.tag)?.node;if(s?.controller===void 0)return;let c=We(s,e.importer);fn(i,c);let l=!1,f;return c.then(d=>l?void 0:d.default(tt(i))).then(d=>{typeof d=="function"&&(l?d():f=d)}).catch(r),()=>{l=!0,f?.()}}});return Object.freeze({...n,stop:o})}var mn=Symbol.for("@nextwebwg/html-next/browser"),st=globalThis,hn=st[mn]??Object.freeze({ready:it()});st[mn]=hn;var Fr=hn.ready;st.HTMLNext??=Object.freeze({ready:Fr,documentComponentRoots:rt,loadBrowserComponents:nt,loadDocumentComponents:ot,startBrowserComponents:it});export{rt as documentComponentRoots,nt as loadBrowserComponents,ot as loadDocumentComponents,Fr as ready,it as startBrowserComponents};
|
package/dist/forms.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export interface FormState<T = unknown> {
|
|
2
|
+
readonly pending: boolean;
|
|
3
|
+
readonly value: T | null;
|
|
4
|
+
readonly error: unknown;
|
|
5
|
+
readonly ok: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface EnhancedFormOptions<T = unknown> {
|
|
8
|
+
readonly fetch?: typeof fetch;
|
|
9
|
+
readonly parse?: (response: Response) => Promise<T>;
|
|
10
|
+
readonly source?: string;
|
|
11
|
+
readonly parameters?: () => Readonly<Record<string, unknown>>;
|
|
12
|
+
readonly onState: (state: FormState<T>) => void;
|
|
13
|
+
}
|
|
14
|
+
export interface FormRequest {
|
|
15
|
+
readonly url: string;
|
|
16
|
+
readonly init: RequestInit;
|
|
17
|
+
}
|
|
18
|
+
export interface FormRequestOptions {
|
|
19
|
+
readonly source?: string;
|
|
20
|
+
readonly parameters?: Readonly<Record<string, unknown>>;
|
|
21
|
+
}
|
|
22
|
+
/** Builds the enhanced request from the browser's native successful-controls set. */
|
|
23
|
+
export declare function buildFormRequest(form: HTMLFormElement, submitter?: HTMLElement | null, options?: FormRequestOptions): FormRequest;
|
|
24
|
+
/** Adds abortable fetch enhancement while retaining native validation and request semantics. */
|
|
25
|
+
export declare function enhanceForm<T = unknown>(form: HTMLFormElement, options: EnhancedFormOptions<T>): () => void;
|
|
26
|
+
//# sourceMappingURL=forms.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"forms.d.ts","sourceRoot":"","sources":["../src/forms.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,SAAS,CAAC,CAAC,GAAG,OAAO;IACpC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,mBAAmB,CAAC,CAAC,GAAG,OAAO;IAC9C,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;IAC9B,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;IACpD,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAC9D,QAAQ,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC;CACjD;AAED,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;CAC5B;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,UAAU,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CACzD;AAMD,qFAAqF;AACrF,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,eAAe,EACrB,SAAS,CAAC,EAAE,WAAW,GAAG,IAAI,EAC9B,OAAO,GAAE,kBAAuB,GAC/B,WAAW,CAuCb;AAED,gGAAgG;AAChG,wBAAgB,WAAW,CAAC,CAAC,GAAG,OAAO,EACrC,IAAI,EAAE,eAAe,EACrB,OAAO,EAAE,mBAAmB,CAAC,CAAC,CAAC,GAC9B,MAAM,IAAI,CA+CZ"}
|
package/dist/forms.js
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
function appendSuccessfulValue(parameters, name, value) {
|
|
2
|
+
parameters.append(name, typeof value === "string" ? value : value.name);
|
|
3
|
+
}
|
|
4
|
+
/** Builds the enhanced request from the browser's native successful-controls set. */
|
|
5
|
+
export function buildFormRequest(form, submitter, options = {}) {
|
|
6
|
+
const submitControl = submitter instanceof HTMLButtonElement || submitter instanceof HTMLInputElement
|
|
7
|
+
? submitter
|
|
8
|
+
: undefined;
|
|
9
|
+
const action = submitControl?.hasAttribute("formaction") === true
|
|
10
|
+
? submitControl.formAction
|
|
11
|
+
: options.source ?? form.action;
|
|
12
|
+
const method = (submitControl?.hasAttribute("formmethod") === true ? submitControl.formMethod : form.method).toUpperCase() || "GET";
|
|
13
|
+
const enctype = submitControl?.hasAttribute("formenctype") === true ? submitControl.formEnctype : form.enctype;
|
|
14
|
+
const data = new FormData(form, submitter ?? undefined);
|
|
15
|
+
const used = new Set();
|
|
16
|
+
const expandedAction = (action || form.ownerDocument.URL).replace(/\{([A-Za-z_$][\w$-]*)\}/g, (_match, name) => {
|
|
17
|
+
used.add(name);
|
|
18
|
+
return encodeURIComponent(String(options.parameters?.[name] ?? ""));
|
|
19
|
+
});
|
|
20
|
+
for (const [name, value] of Object.entries(options.parameters ?? {})) {
|
|
21
|
+
if (used.has(name))
|
|
22
|
+
continue;
|
|
23
|
+
if (Array.isArray(value)) {
|
|
24
|
+
for (const item of value)
|
|
25
|
+
data.append(name, String(item));
|
|
26
|
+
}
|
|
27
|
+
else if (value !== undefined && value !== null)
|
|
28
|
+
data.append(name, String(value));
|
|
29
|
+
}
|
|
30
|
+
const url = new URL(expandedAction, form.ownerDocument.baseURI);
|
|
31
|
+
if (method === "GET" || method === "HEAD") {
|
|
32
|
+
for (const [name, value] of data)
|
|
33
|
+
appendSuccessfulValue(url.searchParams, name, value);
|
|
34
|
+
return { url: url.href, init: { method } };
|
|
35
|
+
}
|
|
36
|
+
if (enctype === "application/x-www-form-urlencoded") {
|
|
37
|
+
const body = new URLSearchParams();
|
|
38
|
+
for (const [name, value] of data)
|
|
39
|
+
appendSuccessfulValue(body, name, value);
|
|
40
|
+
return { url: url.href, init: { method, body } };
|
|
41
|
+
}
|
|
42
|
+
if (enctype === "text/plain") {
|
|
43
|
+
const body = [...data].map(([name, value]) => `${name}=${typeof value === "string" ? value : value.name}`).join("\r\n");
|
|
44
|
+
return { url: url.href, init: { method, body, headers: { "content-type": "text/plain" } } };
|
|
45
|
+
}
|
|
46
|
+
return { url: url.href, init: { method, body: data } };
|
|
47
|
+
}
|
|
48
|
+
/** Adds abortable fetch enhancement while retaining native validation and request semantics. */
|
|
49
|
+
export function enhanceForm(form, options) {
|
|
50
|
+
const request = options.fetch ?? globalThis.fetch.bind(globalThis);
|
|
51
|
+
const parse = options.parse ?? (async (response) => {
|
|
52
|
+
const contentType = response.headers.get("content-type") ?? "";
|
|
53
|
+
return (contentType.includes("json") ? response.json() : response.text());
|
|
54
|
+
});
|
|
55
|
+
let abort;
|
|
56
|
+
let generation = 0;
|
|
57
|
+
const submit = (event) => {
|
|
58
|
+
if (event.defaultPrevented || !form.checkValidity())
|
|
59
|
+
return;
|
|
60
|
+
let built;
|
|
61
|
+
let pending;
|
|
62
|
+
const nextAbort = new AbortController();
|
|
63
|
+
try {
|
|
64
|
+
built = buildFormRequest(form, event.submitter, {
|
|
65
|
+
...(options.source === undefined ? {} : { source: options.source }),
|
|
66
|
+
...(options.parameters === undefined ? {} : { parameters: options.parameters() }),
|
|
67
|
+
});
|
|
68
|
+
pending = request(built.url, { ...built.init, signal: nextAbort.signal });
|
|
69
|
+
}
|
|
70
|
+
catch {
|
|
71
|
+
// Enhancement never started; leave the event untouched for native navigation.
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
event.preventDefault();
|
|
75
|
+
abort?.abort();
|
|
76
|
+
abort = nextAbort;
|
|
77
|
+
const current = ++generation;
|
|
78
|
+
options.onState({ pending: true, value: null, error: null, ok: false });
|
|
79
|
+
void pending.then(async (response) => {
|
|
80
|
+
if (!response.ok)
|
|
81
|
+
throw new TypeError(`Request failed with ${response.status}.`);
|
|
82
|
+
const value = await parse(response);
|
|
83
|
+
if (current !== generation || nextAbort.signal.aborted)
|
|
84
|
+
return;
|
|
85
|
+
options.onState({ pending: false, value, error: null, ok: true });
|
|
86
|
+
form.dispatchEvent(new CustomEvent("success", { detail: value, bubbles: true }));
|
|
87
|
+
}).catch((error) => {
|
|
88
|
+
if (current !== generation || nextAbort.signal.aborted)
|
|
89
|
+
return;
|
|
90
|
+
options.onState({ pending: false, value: null, error, ok: false });
|
|
91
|
+
form.dispatchEvent(new CustomEvent("error", { detail: error, bubbles: true }));
|
|
92
|
+
});
|
|
93
|
+
};
|
|
94
|
+
form.addEventListener("submit", submit);
|
|
95
|
+
return () => {
|
|
96
|
+
generation += 1;
|
|
97
|
+
abort?.abort();
|
|
98
|
+
abort = undefined;
|
|
99
|
+
form.removeEventListener("submit", submit);
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
//# sourceMappingURL=forms.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"forms.js","sourceRoot":"","sources":["../src/forms.ts"],"names":[],"mappings":"AAyBA,SAAS,qBAAqB,CAAC,UAA2B,EAAE,IAAY,EAAE,KAAyB;IACjG,UAAU,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AAC1E,CAAC;AAED,qFAAqF;AACrF,MAAM,UAAU,gBAAgB,CAC9B,IAAqB,EACrB,SAA8B,EAC9B,OAAO,GAAuB,EAAE;IAEhC,MAAM,aAAa,GAAG,SAAS,YAAY,iBAAiB,IAAI,SAAS,YAAY,gBAAgB;QACnG,CAAC,CAAC,SAAS;QACX,CAAC,CAAC,SAAS,CAAC;IACd,MAAM,MAAM,GAAG,aAAa,EAAE,YAAY,CAAC,YAAY,CAAC,KAAK,IAAI;QAC/D,CAAC,CAAC,aAAa,CAAC,UAAU;QAC1B,CAAC,CAAC,OAAO,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,CAAC;IAClC,MAAM,MAAM,GAAG,CACb,aAAa,EAAE,YAAY,CAAC,YAAY,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAC5F,CAAC,WAAW,EAAE,IAAI,KAAK,CAAC;IACzB,MAAM,OAAO,GACX,aAAa,EAAE,YAAY,CAAC,aAAa,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC;IACjG,MAAM,IAAI,GAAG,IAAI,QAAQ,CAAC,IAAI,EAAE,SAAS,IAAI,SAAS,CAAC,CAAC;IACxD,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,MAAM,cAAc,GAAG,CAAC,MAAM,IAAI,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,0BAA0B,EAAE,CAAC,MAAM,EAAE,IAAY,EAAE,EAAE;QACrH,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACf,OAAO,kBAAkB,CAAC,MAAM,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IACtE,CAAC,CAAC,CAAC;IACH,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,UAAU,IAAI,EAAE,CAAC,EAAE,CAAC;QACrE,IAAI,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC;YAAE,SAAS;QAC7B,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YACzB,KAAK,MAAM,IAAI,IAAI,KAAK;gBAAE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;QAC5D,CAAC;aAAM,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI;YAAE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IACrF,CAAC;IACD,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,cAAc,EAAE,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IAChE,IAAI,MAAM,KAAK,KAAK,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;QAC1C,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,IAAI;YAAE,qBAAqB,CAAC,GAAG,CAAC,YAAY,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;QACvF,OAAO,EAAE,GAAG,EAAE,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,EAAE,CAAC;IAC7C,CAAC;IACD,IAAI,OAAO,KAAK,mCAAmC,EAAE,CAAC;QACpD,MAAM,IAAI,GAAG,IAAI,eAAe,EAAE,CAAC;QACnC,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,IAAI;YAAE,qBAAqB,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;QAC3E,OAAO,EAAE,GAAG,EAAE,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC;IACnD,CAAC;IACD,IAAI,OAAO,KAAK,YAAY,EAAE,CAAC;QAC7B,MAAM,IAAI,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,GAAG,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACxH,OAAO,EAAE,GAAG,EAAE,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,cAAc,EAAE,YAAY,EAAE,EAAE,EAAE,CAAC;IAC9F,CAAC;IACD,OAAO,EAAE,GAAG,EAAE,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC;AACzD,CAAC;AAED,gGAAgG;AAChG,MAAM,UAAU,WAAW,CACzB,IAAqB,EACrB,OAA+B;IAE/B,MAAM,OAAO,GAAG,OAAO,CAAC,KAAK,IAAI,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACnE,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,CAAC,KAAK,EAAE,QAAkB,EAAE,EAAE;QAC3D,MAAM,WAAW,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,EAAE,CAAC;QAC/D,OAAO,CAAC,WAAW,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAe,CAAC;IAC1F,CAAC,CAAC,CAAC;IACH,IAAI,KAAkC,CAAC;IACvC,IAAI,UAAU,GAAG,CAAC,CAAC;IACnB,MAAM,MAAM,GAAG,CAAC,KAAkB,EAAQ,EAAE;QAC1C,IAAI,KAAK,CAAC,gBAAgB,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE;YAAE,OAAO;QAC5D,IAAI,KAAkB,CAAC;QACvB,IAAI,OAA0B,CAAC;QAC/B,MAAM,SAAS,GAAG,IAAI,eAAe,EAAE,CAAC;QACxC,IAAI,CAAC;YACH,KAAK,GAAG,gBAAgB,CAAC,IAAI,EAAE,KAAK,CAAC,SAAS,EAAE;gBAC9C,GAAG,CAAC,OAAO,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC;gBACnE,GAAG,CAAC,OAAO,CAAC,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC;aAClF,CAAC,CAAC;YACH,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,EAAE,EAAE,GAAG,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,CAAC,MAAM,EAAE,CAAC,CAAC;QAC5E,CAAC;QAAC,MAAM,CAAC;YACP,8EAA8E;YAC9E,OAAO;QACT,CAAC;QACD,KAAK,CAAC,cAAc,EAAE,CAAC;QACvB,KAAK,EAAE,KAAK,EAAE,CAAC;QACf,KAAK,GAAG,SAAS,CAAC;QAClB,MAAM,OAAO,GAAG,EAAE,UAAU,CAAC;QAC7B,OAAO,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;QACxE,KAAK,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE;YACnC,IAAI,CAAC,QAAQ,CAAC,EAAE;gBAAE,MAAM,IAAI,SAAS,CAAC,uBAAuB,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC;YACjF,MAAM,KAAK,GAAG,MAAM,KAAK,CAAC,QAAQ,CAAC,CAAC;YACpC,IAAI,OAAO,KAAK,UAAU,IAAI,SAAS,CAAC,MAAM,CAAC,OAAO;gBAAE,OAAO;YAC/D,OAAO,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;YAClE,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,SAAS,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QACnF,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;YAC1B,IAAI,OAAO,KAAK,UAAU,IAAI,SAAS,CAAC,MAAM,CAAC,OAAO;gBAAE,OAAO;YAC/D,OAAO,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;YACnE,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,OAAO,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QACjF,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;IACF,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IACxC,OAAO,GAAG,EAAE;QACV,UAAU,IAAI,CAAC,CAAC;QAChB,KAAK,EAAE,KAAK,EAAE,CAAC;QACf,KAAK,GAAG,SAAS,CAAC;QAClB,IAAI,CAAC,mBAAmB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IAC7C,CAAC,CAAC;AACJ,CAAC"}
|